summaryrefslogtreecommitdiff
path: root/libavcodec/aacenc.c
diff options
context:
space:
mode:
authorReimar Döffinger <Reimar.Doeffinger@gmx.de>2016-03-06 17:28:42 +0100
committerReimar Döffinger <Reimar.Doeffinger@gmx.de>2016-03-08 23:56:51 +0100
commitb91e3763905ad95602f2b4e91d37415692573248 (patch)
treee1d41e6d4d080ab85612d599c43d21608920f434 /libavcodec/aacenc.c
parentb3e0371818917364be0b2f4b24831b4ed987392f (diff)
downloadffmpeg-b91e3763905ad95602f2b4e91d37415692573248.tar.gz
aacenc: use generational cache instead of resetting.
Approximately 11% faster transcoding from mp3 with default settings. Signed-off-by: Reimar Döffinger <Reimar.Doeffinger@gmx.de>
Diffstat (limited to 'libavcodec/aacenc.c')
-rw-r--r--libavcodec/aacenc.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/libavcodec/aacenc.c b/libavcodec/aacenc.c
index 5a70da1764..023260a7ae 100644
--- a/libavcodec/aacenc.c
+++ b/libavcodec/aacenc.c
@@ -78,11 +78,10 @@ static void put_audio_specific_config(AVCodecContext *avctx)
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;
- }
+ ++s->quantize_band_cost_cache_generation;
+ if (s->quantize_band_cost_cache_generation == 0) {
+ memset(s->quantize_band_cost_cache, 0, sizeof(s->quantize_band_cost_cache));
+ s->quantize_band_cost_cache_generation = 1;
}
}