Mercurial > libavcodec.hg
comparison mpegvideo_enc.c @ 6401:345cffb2c613 libavcodec
Fix trellis quant + AAN DCT.
author | michael |
---|---|
date | Mon, 25 Feb 2008 22:43:42 +0000 |
parents | e830a3633548 |
children | 493dc59d469a |
comparison
equal
deleted
inserted
replaced
6400:a1d0b3a421f6 | 6401:345cffb2c613 |
---|---|
57 19266, 26722, 25172, 22654, 19266, 15137, 10426, 5315, | 57 19266, 26722, 25172, 22654, 19266, 15137, 10426, 5315, |
58 16384, 22725, 21407, 19266, 16384, 12873, 8867, 4520, | 58 16384, 22725, 21407, 19266, 16384, 12873, 8867, 4520, |
59 12873, 17855, 16819, 15137, 12873, 10114, 6967, 3552, | 59 12873, 17855, 16819, 15137, 12873, 10114, 6967, 3552, |
60 8867 , 12299, 11585, 10426, 8867, 6967, 4799, 2446, | 60 8867 , 12299, 11585, 10426, 8867, 6967, 4799, 2446, |
61 4520 , 6270, 5906, 5315, 4520, 3552, 2446, 1247 | 61 4520 , 6270, 5906, 5315, 4520, 3552, 2446, 1247 |
62 }; | |
63 | |
64 static const uint16_t inv_aanscales[64] = { | |
65 4096, 2953, 3135, 3483, 4096, 5213, 7568, 14846, | |
66 2953, 2129, 2260, 2511, 2953, 3759, 5457, 10703, | |
67 3135, 2260, 2399, 2666, 3135, 3990, 5793, 11363, | |
68 3483, 2511, 2666, 2962, 3483, 4433, 6436, 12625, | |
69 4096, 2953, 3135, 3483, 4096, 5213, 7568, 14846, | |
70 5213, 3759, 3990, 4433, 5213, 6635, 9633, 18895, | |
71 7568, 5457, 5793, 6436, 7568, 9633, 13985, 27432, | |
72 14846, 10703, 11363, 12625, 14846, 18895, 27432, 53809, | |
62 }; | 73 }; |
63 | 74 |
64 static uint8_t default_mv_penalty[MAX_FCODE+1][MAX_MV*2+1]; | 75 static uint8_t default_mv_penalty[MAX_FCODE+1][MAX_MV*2+1]; |
65 static uint8_t default_fcode_tab[MAX_MV*2+1]; | 76 static uint8_t default_fcode_tab[MAX_MV*2+1]; |
66 | 77 |
3065 score_tab[start_i]= 0; | 3076 score_tab[start_i]= 0; |
3066 survivor[0]= start_i; | 3077 survivor[0]= start_i; |
3067 survivor_count= 1; | 3078 survivor_count= 1; |
3068 | 3079 |
3069 for(i=start_i; i<=last_non_zero; i++){ | 3080 for(i=start_i; i<=last_non_zero; i++){ |
3070 int level_index, j; | 3081 int level_index, j, zero_distoration; |
3071 const int dct_coeff= FFABS(block[ scantable[i] ]); | 3082 int dct_coeff= FFABS(block[ scantable[i] ]); |
3072 const int zero_distoration= dct_coeff*dct_coeff; | |
3073 int best_score=256*256*256*120; | 3083 int best_score=256*256*256*120; |
3084 | |
3085 if ( s->dsp.fdct == fdct_ifast | |
3086 #ifndef FAAN_POSTSCALE | |
3087 || s->dsp.fdct == ff_faandct | |
3088 #endif | |
3089 ) | |
3090 dct_coeff= (dct_coeff*inv_aanscales[ scantable[i] ]) >> 12; | |
3091 zero_distoration= dct_coeff*dct_coeff; | |
3092 | |
3074 for(level_index=0; level_index < coeff_count[i]; level_index++){ | 3093 for(level_index=0; level_index < coeff_count[i]; level_index++){ |
3075 int distoration; | 3094 int distoration; |
3076 int level= coeff[level_index][i]; | 3095 int level= coeff[level_index][i]; |
3077 const int alevel= FFABS(level); | 3096 const int alevel= FFABS(level); |
3078 int unquant_coeff; | 3097 int unquant_coeff; |