[FFmpeg-devel] [PATCH 08/11] aacenc: use the encode_special_band_scalefactors function
Rostislav Pehlivanov
atomnuker at gmail.com
Fri Jun 26 22:16:37 CEST 2015
This commit makes use of the previously added function and enables the coding of IS and PNS scalefactor indices for their corresponding band_types. This commit does not alter the functionality of the encoder.
---
libavcodec/aaccoder.c | 4 ++++
libavcodec/aacenc.c | 7 +++++++
libavcodec/aacenc.h | 1 +
3 files changed, 12 insertions(+)
diff --git a/libavcodec/aaccoder.c b/libavcodec/aaccoder.c
index 02ffe17..10c64c0 100644
--- a/libavcodec/aaccoder.c
+++ b/libavcodec/aaccoder.c
@@ -1210,24 +1210,28 @@ AACCoefficientsEncoder ff_aac_coders[AAC_CODER_NB] = {
search_for_quantizers_faac,
encode_window_bands_info,
quantize_and_encode_band,
+ set_special_band_scalefactors,
search_for_ms,
},
[AAC_CODER_ANMR] = {
search_for_quantizers_anmr,
encode_window_bands_info,
quantize_and_encode_band,
+ set_special_band_scalefactors,
search_for_ms,
},
[AAC_CODER_TWOLOOP] = {
search_for_quantizers_twoloop,
codebook_trellis_rate,
quantize_and_encode_band,
+ set_special_band_scalefactors,
search_for_ms,
},
[AAC_CODER_FAST] = {
search_for_quantizers_fast,
encode_window_bands_info,
quantize_and_encode_band,
+ set_special_band_scalefactors,
search_for_ms,
},
};
diff --git a/libavcodec/aacenc.c b/libavcodec/aacenc.c
index a2ff04f..562d0cc 100644
--- a/libavcodec/aacenc.c
+++ b/libavcodec/aacenc.c
@@ -669,6 +669,13 @@ static int aac_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
s->coder->search_for_ms(s, cpe, s->lambda);
}
}
+ if (s->coder->set_special_band_scalefactors) {
+ for (ch = 0; ch < chans; ch++) {
+ s->cur_channel = start_ch + ch;
+ s->coder->set_special_band_scalefactors(s, &cpe->ch[ch]);
+ }
+ }
+ s->cur_channel = start_ch;
adjust_frame_information(cpe, chans);
if (chans == 2) {
put_bits(&s->pb, 1, cpe->common_window);
diff --git a/libavcodec/aacenc.h b/libavcodec/aacenc.h
index 7c1f277..cc1b06a 100644
--- a/libavcodec/aacenc.h
+++ b/libavcodec/aacenc.h
@@ -54,6 +54,7 @@ typedef struct AACCoefficientsEncoder {
int win, int group_len, const float lambda);
void (*quantize_and_encode_band)(struct AACEncContext *s, PutBitContext *pb, const float *in, int size,
int scale_idx, int cb, const float lambda);
+ void (*set_special_band_scalefactors)(struct AACEncContext *s, SingleChannelElement *sce);
void (*search_for_ms)(struct AACEncContext *s, ChannelElement *cpe, const float lambda);
} AACCoefficientsEncoder;
--
2.1.4
More information about the ffmpeg-devel
mailing list