diff --git a/vp8/encoder/encodeframe.c b/vp8/encoder/encodeframe.c index 7f2b46daa908d97c99d21c45e33befbc3e6ac901..e9963684c24a23cb063db908c047e71f121a0c22 100644 --- a/vp8/encoder/encodeframe.c +++ b/vp8/encoder/encodeframe.c @@ -465,7 +465,7 @@ void encode_mb_row(VP8_COMP *cpi, else xd->mode_info_context->mbmi.segment_id = 0; - vp8cx_mb_init_quantizer(cpi, x); + vp8cx_mb_init_quantizer(cpi, x, 1); } else xd->mode_info_context->mbmi.segment_id = 0; // Set to Segment 0 by default @@ -1255,7 +1255,7 @@ int vp8cx_encode_inter_macroblock xd->mode_info_context->mbmi.segment_id = 0; /* segment_id changed, so update */ - vp8cx_mb_init_quantizer(cpi, x); + vp8cx_mb_init_quantizer(cpi, x, 1); } } } diff --git a/vp8/encoder/ethreading.c b/vp8/encoder/ethreading.c index 748942b23124a1415ef37e9b740d728b5401b538..557080dba50a760e5afe7e4ef122526b5149145b 100644 --- a/vp8/encoder/ethreading.c +++ b/vp8/encoder/ethreading.c @@ -20,7 +20,7 @@ extern int vp8cx_encode_inter_macroblock(VP8_COMP *cpi, MACROBLOCK *x, int recon_uvoffset); extern int vp8cx_encode_intra_macro_block(VP8_COMP *cpi, MACROBLOCK *x, TOKENEXTRA **t); -extern void vp8cx_mb_init_quantizer(VP8_COMP *cpi, MACROBLOCK *x); +extern void vp8cx_mb_init_quantizer(VP8_COMP *cpi, MACROBLOCK *x, int ok_to_skip); extern void vp8_build_block_offsets(MACROBLOCK *x); extern void vp8_setup_block_ptrs(MACROBLOCK *x); @@ -163,7 +163,7 @@ THREAD_FUNCTION thread_encoding_proc(void *p_data) else xd->mode_info_context->mbmi.segment_id = 0; - vp8cx_mb_init_quantizer(cpi, x); + vp8cx_mb_init_quantizer(cpi, x, 1); } else xd->mode_info_context->mbmi.segment_id = 0; // Set to Segment 0 by default diff --git a/vp8/encoder/quantize.c b/vp8/encoder/quantize.c index 9c759fd7e08e9228a7c8fe03d0720ef6d45bfff9..e57a264302d83b4adbf42f3b5b61ffcb0e5e7e28 100644 --- a/vp8/encoder/quantize.c +++ b/vp8/encoder/quantize.c @@ -583,7 +583,7 @@ void vp8cx_init_quantizer(VP8_COMP *cpi) cpi->zbin_mode_boost + \ x->act_zbin_adj ) ) >> 7) -void vp8cx_mb_init_quantizer(VP8_COMP *cpi, MACROBLOCK *x) +void vp8cx_mb_init_quantizer(VP8_COMP *cpi, MACROBLOCK *x, int ok_to_skip) { int i; int QIndex; @@ -607,7 +607,10 @@ void vp8cx_mb_init_quantizer(VP8_COMP *cpi, MACROBLOCK *x) else QIndex = cpi->common.base_qindex; - if (QIndex != x->q_index) + /* This initialization should be called at least once. Use ok_to_skip to + * decide if it is ok to skip. + */ + if (!ok_to_skip || QIndex != x->q_index) { // Y zbin_extra = ZBIN_EXTRA_Y; @@ -716,7 +719,7 @@ void vp8cx_frame_init_quantizer(VP8_COMP *cpi) cpi->zbin_mode_boost = 0; // MB level quantizer setup - vp8cx_mb_init_quantizer(cpi, &cpi->mb); + vp8cx_mb_init_quantizer(cpi, &cpi->mb, 0); } diff --git a/vp8/encoder/quantize.h b/vp8/encoder/quantize.h index f1f0156d8915940bf4438a24956bfb35302b8158..07b8813d1a7c4e07d1ee29add97ff9ea9fbdc4d8 100644 --- a/vp8/encoder/quantize.h +++ b/vp8/encoder/quantize.h @@ -86,7 +86,7 @@ struct VP8_COMP; extern void vp8_set_quantizer(struct VP8_COMP *cpi, int Q); extern void vp8cx_frame_init_quantizer(struct VP8_COMP *cpi); extern void vp8_update_zbin_extra(struct VP8_COMP *cpi, MACROBLOCK *x); -extern void vp8cx_mb_init_quantizer(struct VP8_COMP *cpi, MACROBLOCK *x); +extern void vp8cx_mb_init_quantizer(struct VP8_COMP *cpi, MACROBLOCK *x, int ok_to_skip); extern void vp8cx_init_quantizer(struct VP8_COMP *cpi); #endif diff --git a/vp8/encoder/rdopt.c b/vp8/encoder/rdopt.c index 7950960de57a68f9e5d81b97060756f45b69d4d6..3e3fd86f51066319e8060bbe45906c54f2722f0f 100644 --- a/vp8/encoder/rdopt.c +++ b/vp8/encoder/rdopt.c @@ -43,7 +43,6 @@ #endif -extern void vp8cx_mb_init_quantizer(VP8_COMP *cpi, MACROBLOCK *x); extern void vp8_update_zbin_extra(VP8_COMP *cpi, MACROBLOCK *x); #define MAXF(a,b) (((a) > (b)) ? (a) : (b))