Correct bad indentation in aaccoder Clarify and correct comments in 3GPP psymodel, other cosmetics.
Showing the changes to libavcodec/aaccoder.c (1 of 2 files). Show all
Unified · Split
| @@ -146,34 +146,34 @@ static av_always_inline float quantize_and_encode_band_cost_template( · 145 unmodified lines | |||
| 146 | curidx *= range; | 146 | curidx *= range; |
| 147 | curidx += quants[j] + off; | 147 | curidx += quants[j] + off; |
| 148 | } | 148 | } |
| 149 | curbits = ff_aac_spectral_bits[cb-1][curidx]; | 149 | curbits = ff_aac_spectral_bits[cb-1][curidx]; |
| 150 | vec = &ff_aac_codebook_vectors[cb-1][curidx*dim]; | 150 | vec = &ff_aac_codebook_vectors[cb-1][curidx*dim]; |
| 151 | if (BT_UNSIGNED) { | 151 | if (BT_UNSIGNED) { |
| 152 | for (k = 0; k < dim; k++) { | 152 | for (k = 0; k < dim; k++) { |
| 153 | float t = fabsf(in[i+k]); | 153 | float t = fabsf(in[i+k]); |
| 154 | float di; | 154 | float di; |
| 155 | if (BT_ESC && vec[k] == 64.0f) { //FIXME: slow | 155 | if (BT_ESC && vec[k] == 64.0f) { //FIXME: slow |
| 156 | if (t >= CLIPPED_ESCAPE) { | 156 | if (t >= CLIPPED_ESCAPE) { |
| 157 | di = t - CLIPPED_ESCAPE; | 157 | di = t - CLIPPED_ESCAPE; |
| 158 | curbits += 21; | 158 | curbits += 21; |
| 159 | } else { | ||
| 160 | int c = av_clip(quant(t, Q), 0, 8191); | ||
| 161 | di = t - c*cbrtf(c)*IQ; | ||
| 162 | curbits += av_log2(c)*2 - 4 + 1; | ||
| 163 | } | ||
| 164 | } else { | 159 | } else { |
| 165 | di = t - vec[k]*IQ; | 160 | int c = av_clip(quant(t, Q), 0, 8191); |
| 161 | di = t - c*cbrtf(c)*IQ; | ||
| 162 | curbits += av_log2(c)*2 - 4 + 1; | ||
| 166 | } | 163 | } |
| 167 | if (vec[k] != 0.0f) | 164 | } else { |
| 168 | curbits++; | 165 | di = t - vec[k]*IQ; |
| 169 | rd += di*di; | ||
| 170 | } | ||
| 171 | } else { | ||
| 172 | for (k = 0; k < dim; k++) { | ||
| 173 | float di = in[i+k] - vec[k]*IQ; | ||
| 174 | rd += di*di; | ||
| 175 | } | 166 | } |
| 167 | if (vec[k] != 0.0f) | ||
| 168 | curbits++; | ||
| 169 | rd += di*di; | ||
| 176 | } | 170 | } |
| 171 | } else { | ||
| 172 | for (k = 0; k < dim; k++) { | ||
| 173 | float di = in[i+k] - vec[k]*IQ; | ||
| 174 | rd += di*di; | ||
| 175 | } | ||
| 176 | } | ||
| 177 | cost += rd * lambda + curbits; | 177 | cost += rd * lambda + curbits; |
| 178 | resbits += curbits; | 178 | resbits += curbits; |
| 179 | if (cost >= uplim) | 179 | if (cost >= uplim) |
| @@ -575,7 +575,7 @@ static void search_for_quantizers_anmr(AVCodecContext *avctx, AACEncContext *s, · 395 unmodified lines | |||
| 575 | int qnrg = av_clip_uint8(log2f(sqrtf(qnrgf/qcnt))*4 - 31 + SCALE_ONE_POS - SCALE_DIV_512); | 575 | int qnrg = av_clip_uint8(log2f(sqrtf(qnrgf/qcnt))*4 - 31 + SCALE_ONE_POS - SCALE_DIV_512); |
| 576 | q1 = qnrg + 30; | 576 | q1 = qnrg + 30; |
| 577 | q0 = qnrg - 30; | 577 | q0 = qnrg - 30; |
| 578 | //av_log(NULL, AV_LOG_ERROR, "q0 %d, q1 %d\n", q0, q1); | 578 | //av_log(NULL, AV_LOG_ERROR, "q0 %d, q1 %d\n", q0, q1); |
| 579 | if (q0 < q0low) { | 579 | if (q0 < q0low) { |
| 580 | q1 += q0low - q0; | 580 | q1 += q0low - q0; |
| 581 | q0 = q0low; | 581 | q0 = q0low; |