changeset 11997:081702713f47 libavcodec

aacenc: Fill in the estimated codebook for the final computed scalefactor in the TLS.
author alexc
date Mon, 28 Jun 2010 21:42:57 +0000
parents e0dae84d60ae
children 2e7db647fef8
files aaccoder.c
diffstat 1 files changed, 3 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/aaccoder.c	Mon Jun 28 21:40:38 2010 +0000
+++ b/aaccoder.c	Mon Jun 28 21:42:57 2010 +0000
@@ -704,7 +704,6 @@
                     }
                     minscaler = FFMIN(minscaler, sce->sf_idx[w*16+g]);
                     cb = find_min_book(find_max_val(sce->ics.group_len[w], sce->ics.swb_sizes[g], scaled), sce->sf_idx[w*16+g]);
-                    sce->band_type[w*16+g] = cb;
                     for (w2 = 0; w2 < sce->ics.group_len[w]; w2++) {
                         int b;
                         dist += quantize_band_cost(s, coefs + w2*128,
@@ -748,12 +747,15 @@
             start = w*128;
             for (g = 0; g < sce->ics.num_swb; g++) {
                 int prevsc = sce->sf_idx[w*16+g];
+                const float *scaled = s->scoefs + start;
                 if (dists[w*16+g] > uplims[w*16+g] && sce->sf_idx[w*16+g] > 60)
                     sce->sf_idx[w*16+g]--;
                 sce->sf_idx[w*16+g] = av_clip(sce->sf_idx[w*16+g], minscaler, minscaler + SCALE_MAX_DIFF);
                 sce->sf_idx[w*16+g] = FFMIN(sce->sf_idx[w*16+g], 219);
                 if (sce->sf_idx[w*16+g] != prevsc)
                     fflag = 1;
+                sce->band_type[w*16+g] = find_min_book(find_max_val(sce->ics.group_len[w], sce->ics.swb_sizes[g], scaled), sce->sf_idx[w*16+g]);
+                start += sce->ics.swb_sizes[g];
             }
         }
         its++;