diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2011-03-17 16:53:58 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2011-03-17 17:22:52 +0100 |
commit | 0fecf2642b9d909820683647c70031a954f5e58d (patch) | |
tree | 36ca02de9fa27a049829fb589517223d2d0ce5f5 /libavcodec/aaccoder.c | |
parent | e309fdc7018a1027d187ec27fb1d69a41a4ee167 (diff) | |
parent | f1f60f5252b0b448adcce0c1c52f3161ee69b9bf (diff) | |
download | ffmpeg-0fecf2642b9d909820683647c70031a954f5e58d.tar.gz |
Merge remote-tracking branch 'newdev/master'
Conflicts:
Changelog
doc/APIchanges
doc/optimization.txt
libavformat/avio.h
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/aaccoder.c')
-rw-r--r-- | libavcodec/aaccoder.c | 52 |
1 files changed, 26 insertions, 26 deletions
diff --git a/libavcodec/aaccoder.c b/libavcodec/aaccoder.c index 8063fb6cd4..79723c61ef 100644 --- a/libavcodec/aaccoder.c +++ b/libavcodec/aaccoder.c @@ -146,34 +146,34 @@ static av_always_inline float quantize_and_encode_band_cost_template( curidx *= range; curidx += quants[j] + off; } - curbits = ff_aac_spectral_bits[cb-1][curidx]; - vec = &ff_aac_codebook_vectors[cb-1][curidx*dim]; - if (BT_UNSIGNED) { - for (k = 0; k < dim; k++) { - float t = fabsf(in[i+k]); - float di; - if (BT_ESC && vec[k] == 64.0f) { //FIXME: slow - if (t >= CLIPPED_ESCAPE) { - di = t - CLIPPED_ESCAPE; - curbits += 21; - } else { - int c = av_clip(quant(t, Q), 0, 8191); - di = t - c*cbrtf(c)*IQ; - curbits += av_log2(c)*2 - 4 + 1; - } + curbits = ff_aac_spectral_bits[cb-1][curidx]; + vec = &ff_aac_codebook_vectors[cb-1][curidx*dim]; + if (BT_UNSIGNED) { + for (k = 0; k < dim; k++) { + float t = fabsf(in[i+k]); + float di; + if (BT_ESC && vec[k] == 64.0f) { //FIXME: slow + if (t >= CLIPPED_ESCAPE) { + di = t - CLIPPED_ESCAPE; + curbits += 21; } else { - di = t - vec[k]*IQ; + int c = av_clip(quant(t, Q), 0, 8191); + di = t - c*cbrtf(c)*IQ; + curbits += av_log2(c)*2 - 4 + 1; } - if (vec[k] != 0.0f) - curbits++; - rd += di*di; - } - } else { - for (k = 0; k < dim; k++) { - float di = in[i+k] - vec[k]*IQ; - rd += di*di; + } else { + di = t - vec[k]*IQ; } + if (vec[k] != 0.0f) + curbits++; + rd += di*di; } + } else { + for (k = 0; k < dim; k++) { + float di = in[i+k] - vec[k]*IQ; + rd += di*di; + } + } cost += rd * lambda + curbits; resbits += curbits; if (cost >= uplim) @@ -575,7 +575,7 @@ static void search_for_quantizers_anmr(AVCodecContext *avctx, AACEncContext *s, int qnrg = av_clip_uint8(log2f(sqrtf(qnrgf/qcnt))*4 - 31 + SCALE_ONE_POS - SCALE_DIV_512); q1 = qnrg + 30; q0 = qnrg - 30; - //av_log(NULL, AV_LOG_ERROR, "q0 %d, q1 %d\n", q0, q1); + //av_log(NULL, AV_LOG_ERROR, "q0 %d, q1 %d\n", q0, q1); if (q0 < q0low) { q1 += q0low - q0; q0 = q0low; @@ -723,7 +723,7 @@ static void search_for_quantizers_twoloop(AVCodecContext *avctx, sce->zeroes[w*16+g] = !nz; if (nz) minthr = FFMIN(minthr, uplim); - allz = FFMAX(allz, nz); + allz |= nz; } } for (w = 0; w < sce->ics.num_windows; w += sce->ics.group_len[w]) { |