Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClaudio Freire <klaussfreire@gmail.com>2015-10-12 09:56:22 +0300
committerClaudio Freire <klaussfreire@gmail.com>2015-10-12 09:56:22 +0300
commitb629c67ddfceb7026e407685f04d1bb09cb08d31 (patch)
tree71bd57e7a1b2d8bd8bbc5d82b259bd847e4fb853 /libavcodec/aacenc.h
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.h')
-rw-r--r--libavcodec/aacenc.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/libavcodec/aacenc.h b/libavcodec/aacenc.h
index 99f50edc9c..98b38a4bde 100644
--- a/libavcodec/aacenc.h
+++ b/libavcodec/aacenc.h
@@ -75,6 +75,15 @@ typedef struct AACCoefficientsEncoder {
extern AACCoefficientsEncoder ff_aac_coders[];
+typedef struct AACQuantizeBandCostCacheEntry {
+ float rd;
+ float energy;
+ int bits; ///< -1 means uninitialized entry
+ char cb;
+ char rtz;
+ char padding[2]; ///< Keeps the entry size a multiple of 32 bits
+} AACQuantizeBandCostCacheEntry;
+
/**
* AAC encoder context
*/
@@ -109,11 +118,15 @@ typedef struct AACEncContext {
DECLARE_ALIGNED(16, int, qcoefs)[96]; ///< quantized coefficients
DECLARE_ALIGNED(32, float, scoefs)[1024]; ///< scaled coefficients
+ AACQuantizeBandCostCacheEntry quantize_band_cost_cache[256][128]; ///< memoization area for quantize_band_cost
+
struct {
float *samples;
} buffer;
} AACEncContext;
void ff_aac_coder_init_mips(AACEncContext *c);
+void ff_quantize_band_cost_cache_init(struct AACEncContext *s);
+
#endif /* AVCODEC_AACENC_H */