summaryrefslogtreecommitdiff
path: root/libavcodec/aacenc.c
diff options
context:
space:
mode:
authorClaudio Freire <klaussfreire@gmail.com>2015-10-12 03:56:22 -0300
committerClaudio Freire <klaussfreire@gmail.com>2015-10-12 03:56:22 -0300
commitb629c67ddfceb7026e407685f04d1bb09cb08d31 (patch)
tree71bd57e7a1b2d8bd8bbc5d82b259bd847e4fb853 /libavcodec/aacenc.c
parentce0834bdd6e6490d240d76ec8d7845ca0aef1e44 (diff)
AAC encoder: memoize quantize_band_cost
The bulk of calls to quantize_band_cost are replaced by a call to a version that memoizes, greatly improving performance, since during coefficient search there is a great deal of repeat work. Memoization cannot always be applied, so do this in a different function, and leave the original as-is.
Diffstat (limited to 'libavcodec/aacenc.c')
-rw-r--r--libavcodec/aacenc.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/libavcodec/aacenc.c b/libavcodec/aacenc.c
index 3e21bfffa0..9e96cbcfa1 100644
--- a/libavcodec/aacenc.c
+++ b/libavcodec/aacenc.c
@@ -71,6 +71,16 @@ static void put_audio_specific_config(AVCodecContext *avctx)
flush_put_bits(&pb);
}
+void ff_quantize_band_cost_cache_init(struct AACEncContext *s)
+{
+ int sf, g;
+ for (sf = 0; sf < 256; sf++) {
+ for (g = 0; g < 128; g++) {
+ s->quantize_band_cost_cache[sf][g].bits = -1;
+ }
+ }
+}
+
#define WINDOW_FUNC(type) \
static void apply_ ##type ##_window(AVFloatDSPContext *fdsp, \
SingleChannelElement *sce, \