Originally committed as revision 19459 to svn://svn.ffmpeg.org/ffmpeg/trunk
Showing the changes to libavcodec/aaccoder.c (1 of 1 file). Show all
Unified · Split
| @@ -61,7 +61,8 @@ static const uint8_t *run_value_bits[2] = { · 60 unmodified lines | ||
| 61 | 61 | */ |
| 62 | 62 | static av_always_inline int quant(float coef, const float Q) |
| 63 | 63 | { |
| 64 | − return pow(coef * Q, 0.75) + 0.4054; | |
| 64 | + float a = coef * Q; | |
| 65 | + return sqrtf(a * sqrtf(a)) + 0.4054; | |
| 65 | 66 | } |
| 66 | 67 | |
| 67 | 68 | static void quantize_bands(int (*out)[2], const float *in, const float *scaled, |
| @@ -84,8 +85,10 @@ static void abs_pow34_v(float *out, const float *in, const int size) · 16 unmodified lines | ||
| 84 | 85 | { |
| 85 | 86 | #ifndef USE_REALLY_FULL_SEARCH |
| 86 | 87 | int i; |
| 87 | − for (i = 0; i < size; i++) | |
| 88 | − out[i] = pow(fabsf(in[i]), 0.75); | |
| 88 | + for (i = 0; i < size; i++) { | |
| 89 | + float a = fabsf(in[i]); | |
| 90 | + out[i] = sqrtf(a * sqrtf(a)); | |
| 91 | + } | |
| 89 | 92 | #endif /* USE_REALLY_FULL_SEARCH */ |
| 90 | 93 | } |
| 91 | 94 | |
| @@ -110,7 +113,7 @@ static float quantize_band_cost(struct AACEncContext *s, const float *in, · 18 unmodified lines | ||
| 110 | 113 | const int dim = cb < FIRST_PAIR_BT ? 4 : 2; |
| 111 | 114 | int resbits = 0; |
| 112 | 115 | #ifndef USE_REALLY_FULL_SEARCH |
| 113 | − const float Q34 = pow(Q, 0.75); | |
| 116 | + const float Q34 = sqrtf(Q * sqrtf(Q)); | |
| 114 | 117 | const int range = aac_cb_range[cb]; |
| 115 | 118 | const int maxval = aac_cb_maxval[cb]; |
| 116 | 119 | int offs[4]; |
| @@ -225,7 +228,7 @@ static void quantize_and_encode_band(struct AACEncContext *s, PutBitContext *pb, · 108 unmodified lines | ||
| 225 | 228 | const int dim = (cb < FIRST_PAIR_BT) ? 4 : 2; |
| 226 | 229 | int i, j, k; |
| 227 | 230 | #ifndef USE_REALLY_FULL_SEARCH |
| 228 | − const float Q34 = pow(Q, 0.75); | |
| 231 | + const float Q34 = sqrtf(Q * sqrtf(Q)); | |
| 229 | 232 | const int range = aac_cb_range[cb]; |
| 230 | 233 | const int maxval = aac_cb_maxval[cb]; |
| 231 | 234 | int offs[4]; |