summaryrefslogtreecommitdiff
path: root/vp8/encoder/rdopt.c
diff options
context:
space:
mode:
authorYaowu Xu <yaowu@google.com>2011-01-19 16:21:01 -0800
committerYaowu Xu <yaowu@google.com>2011-01-28 09:43:23 -0800
commit8f279596cbb7a6a3016fdc00624bc33ba36641bf (patch)
treef812172649751199f2c6796c01ab3a5047b04f55 /vp8/encoder/rdopt.c
parent82266a1ac971c2f7b0984e717cb9353309a8ed7c (diff)
downloadlibvpx-8f279596cbb7a6a3016fdc00624bc33ba36641bf.tar
libvpx-8f279596cbb7a6a3016fdc00624bc33ba36641bf.tar.gz
libvpx-8f279596cbb7a6a3016fdc00624bc33ba36641bf.tar.bz2
libvpx-8f279596cbb7a6a3016fdc00624bc33ba36641bf.zip
change the threshold of DC check for encode breakout
Previously, the DC check is to make sure there is no code-able DC shift for quantizer Q0, which has been verified rather conservative. This commit changes the criteria to have two components, DC and AC, to address the conservativeness. First, it checks if all AC energy is enough to contribute a single non-zero quantized AC coefficient. Second, for DC, the decision to skip further considers two possible scenarios: 1. There is no code-able 2nd order DC coefficient at all; 2 The residue is relatively flat, but the uniform DC change is very small, i.e. less than 1/2 gray level per pixel. Comparing to previous criteria, the new criteria is about 10% to 15% faster in encoding time with a very small quality loss. (threshold ~1000 and quality range 33db-45db) It should be noted that this commit enables "automatic" static threshold for encodebreakout if a non-zero small value is passed in to encoder. Change-Id: I0f77719a1ac2c2dfddbd950d84920df374515ce3
Diffstat (limited to 'vp8/encoder/rdopt.c')
-rw-r--r--vp8/encoder/rdopt.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/vp8/encoder/rdopt.c b/vp8/encoder/rdopt.c
index 36420aad1..fcff74778 100644
--- a/vp8/encoder/rdopt.c
+++ b/vp8/encoder/rdopt.c
@@ -2267,22 +2267,28 @@ int vp8_rd_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset, int
else if (x->encode_breakout)
{
int sum, sse;
+ int threshold = (xd->block[0].dequant[1]
+ * xd->block[0].dequant[1] >>4);
+
+ if(threshold < x->encode_breakout)
+ threshold = x->encode_breakout;
VARIANCE_INVOKE(&cpi->rtcd.variance, get16x16var)
(x->src.y_buffer, x->src.y_stride,
x->e_mbd.predictor, 16, (unsigned int *)(&sse), &sum);
- if (sse < x->encode_breakout)
+ if (sse < threshold)
{
// Check u and v to make sure skip is ok
int sse2 = 0;
-
- // add dc check
- if (abs(sum) < (cpi->common.Y2dequant[0][0] << 2))
+ /* If theres is no codeable 2nd order dc
+ or a very small uniform pixel change change */
+ if (abs(sum) < (xd->block[24].dequant[0]<<2)||
+ ((sum * sum>>8) > sse && abs(sum) <128))
{
sse2 = VP8_UVSSE(x, IF_RTCD(&cpi->rtcd.variance));
- if (sse2 * 2 < x->encode_breakout)
+ if (sse2 * 2 < threshold)
{
x->skip = 1;
distortion2 = sse + sse2;
@@ -2428,6 +2434,7 @@ int vp8_rd_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset, int
if (x->skip)
break;
+
}
// Reduce the activation RD thresholds for the best choice mode