From 3225b893e80627aa95e924ec789468db6c38f82c Mon Sep 17 00:00:00 2001 From: Yaowu Xu <yaowu@google.com> Date: Tue, 8 Jun 2010 13:32:15 -0700 Subject: [PATCH] minor cleanup of quantizer and fdct code Change-Id: I7ccc580410bea096a70dce0cc3d455348d4287c5 --- vp8/encoder/block.h | 1 - vp8/encoder/ethreading.c | 1 - vp8/encoder/onyx_if.c | 1 - vp8/encoder/quantize.c | 55 ++++++++++++---------------------------- 4 files changed, 16 insertions(+), 42 deletions(-) diff --git a/vp8/encoder/block.h b/vp8/encoder/block.h index 36648cddc5..2e866ddf42 100644 --- a/vp8/encoder/block.h +++ b/vp8/encoder/block.h @@ -102,7 +102,6 @@ typedef struct void (*vp8_short_fdct8x4)(short *input, short *output, int pitch); void (*short_fdct4x4rd)(short *input, short *output, int pitch); void (*short_fdct8x4rd)(short *input, short *output, int pitch); - void (*vp8_short_fdct4x4_ptr)(short *input, short *output, int pitch); void (*short_walsh4x4)(short *input, short *output, int pitch); void (*quantize_b)(BLOCK *b, BLOCKD *d); diff --git a/vp8/encoder/ethreading.c b/vp8/encoder/ethreading.c index 640a84db7e..11b19368f2 100644 --- a/vp8/encoder/ethreading.c +++ b/vp8/encoder/ethreading.c @@ -260,7 +260,6 @@ static void setup_mbby_copy(MACROBLOCK *mbdst, MACROBLOCK *mbsrc) z->short_fdct4x4rd = x->short_fdct4x4rd; z->short_fdct8x4rd = x->short_fdct8x4rd; z->short_fdct8x4rd = x->short_fdct8x4rd; - z->vp8_short_fdct4x4_ptr = x->vp8_short_fdct4x4_ptr; z->short_walsh4x4 = x->short_walsh4x4; z->quantize_b = x->quantize_b; diff --git a/vp8/encoder/onyx_if.c b/vp8/encoder/onyx_if.c index c0ca5b3062..a2a27d3ae0 100644 --- a/vp8/encoder/onyx_if.c +++ b/vp8/encoder/onyx_if.c @@ -1144,7 +1144,6 @@ void vp8_set_speed_features(VP8_COMP *cpi) cpi->mb.short_fdct4x4rd = FDCT_INVOKE(&cpi->rtcd.fdct, fast4x4); } - cpi->mb.vp8_short_fdct4x4_ptr = FDCT_INVOKE(&cpi->rtcd.fdct, short4x4); cpi->mb.short_walsh4x4 = FDCT_INVOKE(&cpi->rtcd.fdct, walsh_short4x4); if (cpi->sf.improved_quant) diff --git a/vp8/encoder/quantize.c b/vp8/encoder/quantize.c index f2c3d2f817..73e80e36cf 100644 --- a/vp8/encoder/quantize.c +++ b/vp8/encoder/quantize.c @@ -56,9 +56,7 @@ void vp8_fast_quantize_b_c(BLOCK *b, BLOCKD *d) } } } - d->eob = eob + 1; - } void vp8_regular_quantize_b(BLOCK *b, BLOCKD *d) @@ -112,61 +110,40 @@ void vp8_regular_quantize_b(BLOCK *b, BLOCKD *d) d->eob = eob + 1; } + void vp8_quantize_mby(MACROBLOCK *x) { int i; + int has_2nd_order = (x->e_mbd.mbmi.mode != B_PRED + && x->e_mbd.mbmi.mode != SPLITMV); - if (x->e_mbd.mbmi.mode != B_PRED && x->e_mbd.mbmi.mode != SPLITMV) + for (i = 0; i < 16; i++) { - for (i = 0; i < 16; i++) - { - x->quantize_b(&x->block[i], &x->e_mbd.block[i]); - x->e_mbd.mbmi.mb_skip_coeff &= (x->e_mbd.block[i].eob < 2); - } + x->quantize_b(&x->block[i], &x->e_mbd.block[i]); + x->e_mbd.mbmi.mb_skip_coeff &= + (x->e_mbd.block[i].eob <= has_2nd_order); + } + if(has_2nd_order) + { x->quantize_b(&x->block[24], &x->e_mbd.block[24]); x->e_mbd.mbmi.mb_skip_coeff &= (!x->e_mbd.block[24].eob); - - } - else - { - for (i = 0; i < 16; i++) - { - x->quantize_b(&x->block[i], &x->e_mbd.block[i]); - x->e_mbd.mbmi.mb_skip_coeff &= (!x->e_mbd.block[i].eob); - } } } void vp8_quantize_mb(MACROBLOCK *x) { int i; + int has_2nd_order=(x->e_mbd.mbmi.mode != B_PRED + && x->e_mbd.mbmi.mode != SPLITMV); x->e_mbd.mbmi.mb_skip_coeff = 1; - - if (x->e_mbd.mbmi.mode != B_PRED && x->e_mbd.mbmi.mode != SPLITMV) + for (i = 0; i < 24+has_2nd_order; i++) { - for (i = 0; i < 16; i++) - { - x->quantize_b(&x->block[i], &x->e_mbd.block[i]); - x->e_mbd.mbmi.mb_skip_coeff &= (x->e_mbd.block[i].eob < 2); - } - - for (i = 16; i < 25; i++) - { - x->quantize_b(&x->block[i], &x->e_mbd.block[i]); - x->e_mbd.mbmi.mb_skip_coeff &= (!x->e_mbd.block[i].eob); - } - } - else - { - for (i = 0; i < 24; i++) - { - x->quantize_b(&x->block[i], &x->e_mbd.block[i]); - x->e_mbd.mbmi.mb_skip_coeff &= (!x->e_mbd.block[i].eob); - } + x->quantize_b(&x->block[i], &x->e_mbd.block[i]); + x->e_mbd.mbmi.mb_skip_coeff &= + (x->e_mbd.block[i].eob <= (has_2nd_order && i<16)); } - } -- GitLab