diff options
author | Mans Rullgard <mans@mansr.com> | 2011-05-16 15:57:04 +0100 |
---|---|---|
committer | Mans Rullgard <mans@mansr.com> | 2011-05-16 16:20:18 +0100 |
commit | 721d6f2dc5437df21ae17923b29fa2be847764c7 (patch) | |
tree | 69c5ac489cf0c51f7dcac8711343eec7103e8a25 /libavcodec | |
parent | 257de5fb25454209ccb3fd152d1ff3c98813e2ce (diff) | |
download | ffmpeg-721d6f2dc5437df21ae17923b29fa2be847764c7.tar.gz |
dct: bypass table allocation for DCT_II of size 32
The size-32 DCT_II has a special implementation which doesn't use
the normal tables. Skipping allocation of these in this case saves
some memory.
Signed-off-by: Mans Rullgard <mans@mansr.com>
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/dct.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/libavcodec/dct.c b/libavcodec/dct.c index 83ea00f9cb..e7a8f227b7 100644 --- a/libavcodec/dct.c +++ b/libavcodec/dct.c @@ -180,9 +180,14 @@ av_cold int ff_dct_init(DCTContext *s, int nbits, enum DCTTransformType inverse) int n = 1 << nbits; int i; + memset(s, 0, sizeof(*s)); + s->nbits = nbits; s->inverse = inverse; + if (inverse == DCT_II && nbits == 5) { + s->dct_calc = dct32_func; + } else { ff_init_ff_cos_tabs(nbits+2); s->costab = ff_cos_tabs[nbits+2]; @@ -203,9 +208,7 @@ av_cold int ff_dct_init(DCTContext *s, int nbits, enum DCTTransformType inverse) case DCT_III: s->dct_calc = ff_dct_calc_III_c; break; case DST_I : s->dct_calc = ff_dst_calc_I_c; break; } - - if (inverse == DCT_II && nbits == 5) - s->dct_calc = dct32_func; + } s->dct32 = dct32; if (HAVE_MMX) ff_dct_init_mmx(s); |