Mercurial > libavcodec.hg
comparison mpegvideo_enc.c @ 8217:f88ab1c3e333 libavcodec
cosmetics: Rename aanscales to ff_aanscales, it will soon be externally visible.
author | diego |
---|---|
date | Wed, 26 Nov 2008 13:28:30 +0000 |
parents | a9734fe0811e |
children | 03054192daac |
comparison
equal
deleted
inserted
replaced
8216:018299720403 | 8217:f88ab1c3e333 |
---|---|
47 /* enable all paranoid tests for rounding, overflows, etc... */ | 47 /* enable all paranoid tests for rounding, overflows, etc... */ |
48 //#define PARANOID | 48 //#define PARANOID |
49 | 49 |
50 //#define DEBUG | 50 //#define DEBUG |
51 | 51 |
52 static const uint16_t aanscales[64] = { | 52 static const uint16_t ff_aanscales[64] = { |
53 /* precomputed values scaled up by 14 bits */ | 53 /* precomputed values scaled up by 14 bits */ |
54 16384, 22725, 21407, 19266, 16384, 12873, 8867, 4520, | 54 16384, 22725, 21407, 19266, 16384, 12873, 8867, 4520, |
55 22725, 31521, 29692, 26722, 22725, 17855, 12299, 6270, | 55 22725, 31521, 29692, 26722, 22725, 17855, 12299, 6270, |
56 21407, 29692, 27969, 25172, 21407, 16819, 11585, 5906, | 56 21407, 29692, 27969, 25172, 21407, 16819, 11585, 5906, |
57 19266, 26722, 25172, 22654, 19266, 15137, 10426, 5315, | 57 19266, 26722, 25172, 22654, 19266, 15137, 10426, 5315, |
89 #endif | 89 #endif |
90 ) { | 90 ) { |
91 for(i=0;i<64;i++) { | 91 for(i=0;i<64;i++) { |
92 const int j= dsp->idct_permutation[i]; | 92 const int j= dsp->idct_permutation[i]; |
93 /* 16 <= qscale * quant_matrix[i] <= 7905 */ | 93 /* 16 <= qscale * quant_matrix[i] <= 7905 */ |
94 /* 19952 <= aanscales[i] * qscale * quant_matrix[i] <= 249205026 */ | 94 /* 19952 <= ff_aanscales[i] * qscale * quant_matrix[i] <= 249205026 */ |
95 /* (1<<36)/19952 >= (1<<36)/(aanscales[i] * qscale * quant_matrix[i]) >= (1<<36)/249205026 */ | 95 /* (1 << 36) / 19952 >= (1 << 36) / (ff_aanscales[i] * qscale * quant_matrix[i]) >= (1 << 36) / 249205026 */ |
96 /* 3444240 >= (1<<36)/(aanscales[i] * qscale * quant_matrix[i]) >= 275 */ | 96 /* 3444240 >= (1 << 36) / (ff_aanscales[i] * qscale * quant_matrix[i]) >= 275 */ |
97 | 97 |
98 qmat[qscale][i] = (int)((UINT64_C(1) << QMAT_SHIFT) / | 98 qmat[qscale][i] = (int)((UINT64_C(1) << QMAT_SHIFT) / |
99 (qscale * quant_matrix[j])); | 99 (qscale * quant_matrix[j])); |
100 } | 100 } |
101 } else if (dsp->fdct == fdct_ifast | 101 } else if (dsp->fdct == fdct_ifast |
104 #endif | 104 #endif |
105 ) { | 105 ) { |
106 for(i=0;i<64;i++) { | 106 for(i=0;i<64;i++) { |
107 const int j= dsp->idct_permutation[i]; | 107 const int j= dsp->idct_permutation[i]; |
108 /* 16 <= qscale * quant_matrix[i] <= 7905 */ | 108 /* 16 <= qscale * quant_matrix[i] <= 7905 */ |
109 /* 19952 <= aanscales[i] * qscale * quant_matrix[i] <= 249205026 */ | 109 /* 19952 <= ff_aanscales[i] * qscale * quant_matrix[i] <= 249205026 */ |
110 /* (1<<36)/19952 >= (1<<36)/(aanscales[i] * qscale * quant_matrix[i]) >= (1<<36)/249205026 */ | 110 /* (1 << 36) / 19952 >= (1 << 36) / (ff_aanscales[i] * qscale * quant_matrix[i]) >= (1<<36)/249205026 */ |
111 /* 3444240 >= (1<<36)/(aanscales[i] * qscale * quant_matrix[i]) >= 275 */ | 111 /* 3444240 >= (1 << 36) / (ff_aanscales[i] * qscale * quant_matrix[i]) >= 275 */ |
112 | 112 |
113 qmat[qscale][i] = (int)((UINT64_C(1) << (QMAT_SHIFT + 14)) / | 113 qmat[qscale][i] = (int)((UINT64_C(1) << (QMAT_SHIFT + 14)) / |
114 (aanscales[i] * qscale * quant_matrix[j])); | 114 (ff_aanscales[i] * qscale * quant_matrix[j])); |
115 } | 115 } |
116 } else { | 116 } else { |
117 for(i=0;i<64;i++) { | 117 for(i=0;i<64;i++) { |
118 const int j= dsp->idct_permutation[i]; | 118 const int j= dsp->idct_permutation[i]; |
119 /* We can safely suppose that 16 <= quant_matrix[i] <= 255 | 119 /* We can safely suppose that 16 <= quant_matrix[i] <= 255 |
135 if (dsp->fdct == fdct_ifast | 135 if (dsp->fdct == fdct_ifast |
136 #ifndef FAAN_POSTSCALE | 136 #ifndef FAAN_POSTSCALE |
137 || dsp->fdct == ff_faandct | 137 || dsp->fdct == ff_faandct |
138 #endif | 138 #endif |
139 ) { | 139 ) { |
140 max= (8191LL*aanscales[i]) >> 14; | 140 max = (8191LL*ff_aanscales[i]) >> 14; |
141 } | 141 } |
142 while(((max * qmat[qscale][i]) >> shift) > INT_MAX){ | 142 while(((max * qmat[qscale][i]) >> shift) > INT_MAX){ |
143 shift++; | 143 shift++; |
144 } | 144 } |
145 } | 145 } |