From 9e190dfbfe5a5d4662370f6580ff08de3c0a8d01 Mon Sep 17 00:00:00 2001 From: Jim Bankoski Date: Wed, 12 Feb 2014 14:16:55 -0800 Subject: fast approximate model_rd_from_var_lapndz Change-Id: Ieceaa16312941992d4a57455e336d625dfe4e094 --- vp9/encoder/vp9_rdopt.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'vp9') diff --git a/vp9/encoder/vp9_rdopt.c b/vp9/encoder/vp9_rdopt.c index cae7884fd..8f03cdedb 100644 --- a/vp9/encoder/vp9_rdopt.c +++ b/vp9/encoder/vp9_rdopt.c @@ -444,8 +444,21 @@ static void model_rd_for_sb(VP9_COMP *cpi, BLOCK_SIZE bsize, if (i == 0) x->pred_sse[ref] = sse; - if (cpi->sf.use_pick_mode) { - dist_sum += (int)sse; + + // Fast approximate the modelling function. + if (cpi->oxcf.cpu_used < -4) { + int rate; + int64_t dist; + int64_t square_error = sse; + int quantizer = (pd->dequant[1] >> 3); + + if ( quantizer < 120) + rate = (square_error * (280-quantizer) )>> 8; + else + rate = 0; + dist = (square_error * quantizer) >> 8; + rate_sum += rate; + dist_sum += dist; } else { int rate; int64_t dist; -- cgit v1.2.3