diff options
author | Rostislav Pehlivanov <atomnuker@gmail.com> | 2015-08-21 20:36:09 +0300 |
---|---|---|
committer | Rostislav Pehlivanov <atomnuker@gmail.com> | 2015-08-21 20:36:09 +0300 |
commit | e6c9f3a166adb46855ae5ae3e3757a69f9b1c972 (patch) | |
tree | 341397e3a66b5ce7b163030b2b7f16805b65ba2f /libavcodec/aacenc.c | |
parent | 32be264cea542b4dc721b10092bf1dfe511a28ee (diff) |
aacenc: reset special bands in the main frame encoding function
This commit moves the resetting of special bands (above RESERVED_BT)
to the main frame encoding function rather than the way it was done
previously in their corresponding search_for_... functions.
The reason why special bands need to be reset is that while normal
bands get chosen for every frame by the coder (twoloop by default)
the coders do not touch any special sfbs and will therefore
make them persist throughout the file.
If we zero them out any bands left unmarked will be chosen by
the second part of the coder (the trellis function in aaccoder.c).
Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
Diffstat (limited to 'libavcodec/aacenc.c')
-rw-r--r-- | libavcodec/aacenc.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/libavcodec/aacenc.c b/libavcodec/aacenc.c index 8d48790745..eac2e92e7a 100644 --- a/libavcodec/aacenc.c +++ b/libavcodec/aacenc.c @@ -560,8 +560,13 @@ static int aac_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, memset(cpe->ms_mask, 0, sizeof(cpe->ms_mask)); put_bits(&s->pb, 3, tag); put_bits(&s->pb, 4, chan_el_counter[tag]++); - for (ch = 0; ch < chans; ch++) - coeffs[ch] = cpe->ch[ch].coeffs; + for (ch = 0; ch < chans; ch++) { + sce = &cpe->ch[ch]; + coeffs[ch] = sce->coeffs; + for (w = 0; w < 128; w++) + if (sce->band_type[w] > RESERVED_BT) + sce->band_type[w] = 0; + } s->psy.model->analyze(&s->psy, start_ch, coeffs, wi); for (ch = 0; ch < chans; ch++) { s->cur_channel = start_ch + ch; |