Commit c0918613 authored by Rostislav Pehlivanov's avatar Rostislav Pehlivanov

aacenc: use av_clip() instead of av_clip() during quantization

Seems like clang might be miscompiling it and causing a signed integer overflow,
making a FATE test fail.
Doesn't seem to affect performance, it only runs on the ESC codebook.
Reviewed-by: 's avatarClaudio Freire <klaussfreire@gmail.com>
Signed-off-by: 's avatarRostislav Pehlivanov <atomnuker@gmail.com>
parent bf1495d9
...@@ -141,7 +141,7 @@ static av_always_inline float quantize_and_encode_band_cost_template( ...@@ -141,7 +141,7 @@ static av_always_inline float quantize_and_encode_band_cost_template(
if (BT_ESC) { if (BT_ESC) {
for (j = 0; j < 2; j++) { for (j = 0; j < 2; j++) {
if (ff_aac_codebook_vectors[cb-1][curidx*2+j] == 64.0f) { if (ff_aac_codebook_vectors[cb-1][curidx*2+j] == 64.0f) {
int coef = av_clip_uintp2(quant(fabsf(in[i+j]), Q, ROUNDING), 13); int coef = av_clip(quant(fabsf(in[i+j]), Q, ROUNDING), 0, (1 << 13) - 1);
int len = av_log2(coef); int len = av_log2(coef);
put_bits(pb, len - 4 + 1, (1 << (len - 4 + 1)) - 2); put_bits(pb, len - 4 + 1, (1 << (len - 4 + 1)) - 2);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment