Mercurial > libavcodec.hg
changeset 3488:a647bf3a7fa8 libavcodec
replace *_dequant (2 intra, 1 inter) by qmat (3 intra, 3 inter) (needed for theora according to spec)
author | michael |
---|---|
date | Mon, 17 Jul 2006 08:09:08 +0000 |
parents | 26d3704e12c0 |
children | 9aacd9410e57 |
files | vp3.c |
diffstat | 1 files changed, 39 insertions(+), 40 deletions(-) [+] |
line wrap: on
line diff
--- a/vp3.c Sun Jul 16 21:09:32 2006 +0000 +++ b/vp3.c Mon Jul 17 08:09:08 2006 +0000 @@ -285,9 +285,7 @@ /* these arrays need to be on 16-byte boundaries since SSE2 operations * index into them */ - DECLARE_ALIGNED_16(int16_t, intra_y_dequant[64]); - DECLARE_ALIGNED_16(int16_t, intra_c_dequant[64]); - DECLARE_ALIGNED_16(int16_t, inter_dequant[64]); + DECLARE_ALIGNED_16(int16_t, qmat[2][4][64]); //<qmat[is_inter][plane] /* This table contains superblock_count * 16 entries. Each set of 16 * numbers corresponds to the fragment indices 0..15 of the superblock. @@ -667,20 +665,20 @@ #define SCALER 4 /* scale DC quantizers */ - s->intra_y_dequant[0] = s->coded_intra_y_dequant[0] * dc_scale_factor / 100; - if (s->intra_y_dequant[0] < MIN_DEQUANT_VAL * 2) - s->intra_y_dequant[0] = MIN_DEQUANT_VAL * 2; - s->intra_y_dequant[0] *= SCALER; - - s->intra_c_dequant[0] = s->coded_intra_c_dequant[0] * dc_scale_factor / 100; - if (s->intra_c_dequant[0] < MIN_DEQUANT_VAL * 2) - s->intra_c_dequant[0] = MIN_DEQUANT_VAL * 2; - s->intra_c_dequant[0] *= SCALER; - - s->inter_dequant[0] = s->coded_inter_dequant[0] * dc_scale_factor / 100; - if (s->inter_dequant[0] < MIN_DEQUANT_VAL * 4) - s->inter_dequant[0] = MIN_DEQUANT_VAL * 4; - s->inter_dequant[0] *= SCALER; + s->qmat[0][0][0] = s->coded_intra_y_dequant[0] * dc_scale_factor / 100; + if (s->qmat[0][0][0] < MIN_DEQUANT_VAL * 2) + s->qmat[0][0][0] = MIN_DEQUANT_VAL * 2; + s->qmat[0][0][0] *= SCALER; + + s->qmat[0][1][0] = s->coded_intra_c_dequant[0] * dc_scale_factor / 100; + if (s->qmat[0][1][0] < MIN_DEQUANT_VAL * 2) + s->qmat[0][1][0] = MIN_DEQUANT_VAL * 2; + s->qmat[0][1][0] *= SCALER; + + s->qmat[1][0][0] = s->coded_inter_dequant[0] * dc_scale_factor / 100; + if (s->qmat[1][0][0] < MIN_DEQUANT_VAL * 4) + s->qmat[1][0][0] = MIN_DEQUANT_VAL * 4; + s->qmat[1][0][0] *= SCALER; /* scale AC quantizers, zigzag at the same time in preparation for * the dequantization phase */ @@ -688,29 +686,33 @@ int k= s->scantable.scantable[i]; j = s->scantable.permutated[i]; - s->intra_y_dequant[j] = s->coded_intra_y_dequant[k] * ac_scale_factor / 100; - if (s->intra_y_dequant[j] < MIN_DEQUANT_VAL) - s->intra_y_dequant[j] = MIN_DEQUANT_VAL; - s->intra_y_dequant[j] *= SCALER; - - s->intra_c_dequant[j] = s->coded_intra_c_dequant[k] * ac_scale_factor / 100; - if (s->intra_c_dequant[j] < MIN_DEQUANT_VAL) - s->intra_c_dequant[j] = MIN_DEQUANT_VAL; - s->intra_c_dequant[j] *= SCALER; - - s->inter_dequant[j] = s->coded_inter_dequant[k] * ac_scale_factor / 100; - if (s->inter_dequant[j] < MIN_DEQUANT_VAL * 2) - s->inter_dequant[j] = MIN_DEQUANT_VAL * 2; - s->inter_dequant[j] *= SCALER; + s->qmat[0][0][j] = s->coded_intra_y_dequant[k] * ac_scale_factor / 100; + if (s->qmat[0][0][j] < MIN_DEQUANT_VAL) + s->qmat[0][0][j] = MIN_DEQUANT_VAL; + s->qmat[0][0][j] *= SCALER; + + s->qmat[0][1][j] = s->coded_intra_c_dequant[k] * ac_scale_factor / 100; + if (s->qmat[0][1][j] < MIN_DEQUANT_VAL) + s->qmat[0][1][j] = MIN_DEQUANT_VAL; + s->qmat[0][1][j] *= SCALER; + + s->qmat[1][0][j] = s->coded_inter_dequant[k] * ac_scale_factor / 100; + if (s->qmat[1][0][j] < MIN_DEQUANT_VAL * 2) + s->qmat[1][0][j] = MIN_DEQUANT_VAL * 2; + s->qmat[1][0][j] *= SCALER; } - memset(s->qscale_table, (FFMAX(s->intra_y_dequant[1], s->intra_c_dequant[1])+8)/16, 512); //FIXME finetune + memcpy(s->qmat[0][2], s->qmat[0][1], sizeof(s->qmat[0][0])); + memcpy(s->qmat[1][1], s->qmat[1][0], sizeof(s->qmat[0][0])); + memcpy(s->qmat[1][2], s->qmat[1][0], sizeof(s->qmat[0][0])); + + memset(s->qscale_table, (FFMAX(s->qmat[0][0][1], s->qmat[0][1][1])+8)/16, 512); //FIXME finetune /* print debug information as requested */ debug_dequantizers("intra Y dequantizers:\n"); for (i = 0; i < 8; i++) { for (j = i * 8; j < i * 8 + 8; j++) { - debug_dequantizers(" %4d,", s->intra_y_dequant[j]); + debug_dequantizers(" %4d,", s->qmat[0][0][j]); } debug_dequantizers("\n"); } @@ -719,7 +721,7 @@ debug_dequantizers("intra C dequantizers:\n"); for (i = 0; i < 8; i++) { for (j = i * 8; j < i * 8 + 8; j++) { - debug_dequantizers(" %4d,", s->intra_c_dequant[j]); + debug_dequantizers(" %4d,", s->qmat[0][1][j]); } debug_dequantizers("\n"); } @@ -728,7 +730,7 @@ debug_dequantizers("interframe dequantizers:\n"); for (i = 0; i < 8; i++) { for (j = i * 8; j < i * 8 + 8; j++) { - debug_dequantizers(" %4d,", s->inter_dequant[j]); + debug_dequantizers(" %4d,", s->qmat[1][0][j]); } debug_dequantizers("\n"); } @@ -1847,12 +1849,9 @@ motion_source + stride + 1 + d, stride, 8); } - dequantizer = s->inter_dequant; + dequantizer = s->qmat[1][plane]; }else{ - if (plane == 0) - dequantizer = s->intra_y_dequant; - else - dequantizer = s->intra_c_dequant; + dequantizer = s->qmat[0][plane]; } /* dequantize the DCT coefficients */