summaryrefslogtreecommitdiff
path: root/libavcodec/aacenc_quantization_misc.h
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_quantization_misc.h
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_quantization_misc.h')
-rw-r--r--libavcodec/aacenc_quantization_misc.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/libavcodec/aacenc_quantization_misc.h b/libavcodec/aacenc_quantization_misc.h
index eaa71c9689..28676ca8d5 100644
--- a/libavcodec/aacenc_quantization_misc.h
+++ b/libavcodec/aacenc_quantization_misc.h
@@ -36,11 +36,12 @@ static inline float quantize_band_cost_cached(struct AACEncContext *s, int w, in
AACQuantizeBandCostCacheEntry *entry;
av_assert1(scale_idx >= 0 && scale_idx < 256);
entry = &s->quantize_band_cost_cache[scale_idx][w*16+g];
- if (entry->bits < 0 || entry->cb != cb || entry->rtz != rtz) {
+ if (entry->generation != s->quantize_band_cost_cache_generation || entry->cb != cb || entry->rtz != rtz) {
entry->rd = quantize_band_cost(s, in, scaled, size, scale_idx,
cb, lambda, uplim, &entry->bits, &entry->energy, rtz);
entry->cb = cb;
entry->rtz = rtz;
+ entry->generation = s->quantize_band_cost_cache_generation;
}
if (bits)
*bits = entry->bits;