From 73422d3b2d7d9c2f08d491de708662740b6b3e6d Mon Sep 17 00:00:00 2001 From: Alex Converse Date: Thu, 30 Jul 2015 15:33:47 -0700 Subject: [PATCH] Short circuit rate_block in block_rd_txfm. Don't run rate_block (cost_coeffs) if distortion alone is enough to surpass best_rd. This decreases 2nd pass runtime on HD at speed 2 by about 2%. There is zero effect on output if tx_cache is removed. Change-Id: Ia3b1cc77bfbe6ee988c395fde06c0eb92940b784 --- vp9/encoder/vp9_rdopt.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/vp9/encoder/vp9_rdopt.c b/vp9/encoder/vp9_rdopt.c index 43fa77c20..61f77e8e5 100644 --- a/vp9/encoder/vp9_rdopt.c +++ b/vp9/encoder/vp9_rdopt.c @@ -551,6 +551,12 @@ static void block_rd_txfm(int plane, int block, BLOCK_SIZE plane_bsize, #endif // CONFIG_VP9_HIGHBITDEPTH } + rd = RDCOST(x->rdmult, x->rddiv, 0, dist); + if (args->this_rd + rd > args->best_rd) { + args->exit_early = 1; + return; + } + rate = rate_block(plane, block, plane_bsize, tx_size, args); rd1 = RDCOST(x->rdmult, x->rddiv, rate, dist); rd2 = RDCOST(x->rdmult, x->rddiv, 0, sse);