From: Johann Date: Wed, 13 Apr 2011 17:45:58 +0000 (-0400) Subject: store quant_shift as an unsigned char X-Git-Tag: v0.9.7~213^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=70f30aa95d70d07808af01c368a5687cbc06e6a5;p=platform%2Fupstream%2Flibvpx.git store quant_shift as an unsigned char in encodframe.c, quant_shift is set to 0 or 1 in vp8cx_invert_quant only use 8 bits to store this, instead of 16. will allow saving an xmm register in an updated version of the regular quantize Change-Id: Ie88c47fe2aff5af0283dab1147fb2791e4b12f90 --- diff --git a/vp8/encoder/block.h b/vp8/encoder/block.h index 5a2568d..6de4c85 100644 --- a/vp8/encoder/block.h +++ b/vp8/encoder/block.h @@ -34,7 +34,7 @@ typedef struct // 16 Y blocks, 4 U blocks, 4 V blocks each with 16 entries short *quant; short *quant_fast; - short *quant_shift; + unsigned char *quant_shift; short *zbin; short *zrun_zbin_boost; short *round; diff --git a/vp8/encoder/encodeframe.c b/vp8/encoder/encodeframe.c index 1dbf46e..66718b5 100644 --- a/vp8/encoder/encodeframe.c +++ b/vp8/encoder/encodeframe.c @@ -147,7 +147,7 @@ static const int qzbin_factors_y2[129] = #define EXACT_QUANT #ifdef EXACT_QUANT static void vp8cx_invert_quant(int improved_quant, short *quant, - short *shift, short d) + unsigned char *shift, short d) { if(improved_quant) { diff --git a/vp8/encoder/onyx_int.h b/vp8/encoder/onyx_int.h index 0e53f68..c11c097 100644 --- a/vp8/encoder/onyx_int.h +++ b/vp8/encoder/onyx_int.h @@ -251,17 +251,17 @@ typedef struct { DECLARE_ALIGNED(16, short, Y1quant[QINDEX_RANGE][16]); - DECLARE_ALIGNED(16, short, Y1quant_shift[QINDEX_RANGE][16]); + DECLARE_ALIGNED(16, unsigned char, Y1quant_shift[QINDEX_RANGE][16]); DECLARE_ALIGNED(16, short, Y1zbin[QINDEX_RANGE][16]); DECLARE_ALIGNED(16, short, Y1round[QINDEX_RANGE][16]); DECLARE_ALIGNED(16, short, Y2quant[QINDEX_RANGE][16]); - DECLARE_ALIGNED(16, short, Y2quant_shift[QINDEX_RANGE][16]); + DECLARE_ALIGNED(16, unsigned char, Y2quant_shift[QINDEX_RANGE][16]); DECLARE_ALIGNED(16, short, Y2zbin[QINDEX_RANGE][16]); DECLARE_ALIGNED(16, short, Y2round[QINDEX_RANGE][16]); DECLARE_ALIGNED(16, short, UVquant[QINDEX_RANGE][16]); - DECLARE_ALIGNED(16, short, UVquant_shift[QINDEX_RANGE][16]); + DECLARE_ALIGNED(16, unsigned char, UVquant_shift[QINDEX_RANGE][16]); DECLARE_ALIGNED(16, short, UVzbin[QINDEX_RANGE][16]); DECLARE_ALIGNED(16, short, UVround[QINDEX_RANGE][16]); diff --git a/vp8/encoder/quantize.c b/vp8/encoder/quantize.c index 803e3a5..86ed267 100644 --- a/vp8/encoder/quantize.c +++ b/vp8/encoder/quantize.c @@ -27,7 +27,7 @@ void vp8_fast_quantize_b_c(BLOCK *b, BLOCKD *d) short *zbin_ptr = b->zbin; short *round_ptr = b->round; short *quant_ptr = b->quant_fast; - short *quant_shift_ptr = b->quant_shift; + unsigned char *quant_shift_ptr = b->quant_shift; short *qcoeff_ptr = d->qcoeff; short *dqcoeff_ptr = d->dqcoeff; short *dequant_ptr = d->dequant; @@ -112,7 +112,7 @@ void vp8_regular_quantize_b(BLOCK *b, BLOCKD *d) short *zbin_ptr = b->zbin; short *round_ptr = b->round; short *quant_ptr = b->quant; - short *quant_shift_ptr = b->quant_shift; + unsigned char *quant_shift_ptr = b->quant_shift; short *qcoeff_ptr = d->qcoeff; short *dqcoeff_ptr = d->dqcoeff; short *dequant_ptr = d->dequant; @@ -166,7 +166,7 @@ void vp8_strict_quantize_b(BLOCK *b, BLOCKD *d) int sz; short *coeff_ptr; short *quant_ptr; - short *quant_shift_ptr; + unsigned char *quant_shift_ptr; short *qcoeff_ptr; short *dqcoeff_ptr; short *dequant_ptr; diff --git a/vp8/encoder/x86/quantize_sse2.asm b/vp8/encoder/x86/quantize_sse2.asm index 5e40dc7..7b7ae70 100644 --- a/vp8/encoder/x86/quantize_sse2.asm +++ b/vp8/encoder/x86/quantize_sse2.asm @@ -142,7 +142,7 @@ sym(vp8_regular_quantize_b_sse2): movsx edi, WORD PTR[rsp + temp_qcoeff + %1 * 2] ; downshift by quant_shift[rc] - movsx ecx, WORD PTR[rax + %1 * 2] ; quant_shift_ptr[rc] + movsx cx, BYTE PTR[rax + %1] ; quant_shift_ptr[rc] sar edi, cl ; also sets Z bit je rq_zigzag_loop_%1 ; !y mov WORD PTR[rsp + qcoeff + %1 * 2], di ;qcoeff_ptr[rc] = temp_qcoeff[rc]