diff options
Diffstat (limited to 'apps/codecs/libcook/cook_fixpoint.h')
| -rw-r--r-- | apps/codecs/libcook/cook_fixpoint.h | 53 |
1 files changed, 29 insertions, 24 deletions
diff --git a/apps/codecs/libcook/cook_fixpoint.h b/apps/codecs/libcook/cook_fixpoint.h index 0f12b13..e416bc4 100644 --- a/apps/codecs/libcook/cook_fixpoint.h +++ b/apps/codecs/libcook/cook_fixpoint.h @@ -54,29 +54,6 @@ static const FIXPU* cplscales[5] = { }; /** - * Initialise fixed point implementation. - * Nothing to do for fixed point. - * - * @param q pointer to the COOKContext - */ -static inline int init_cook_math(COOKContext *q) -{ - return 0; -} - -/** - * Free resources used by floating point implementation. - * Nothing to do for fixed point. - * - * @param q pointer to the COOKContext - */ -static inline void free_cook_math(COOKContext *q) -{ - return; -} - - -/** * Fixed point multiply by power of two. * * @param x fix point value @@ -167,7 +144,7 @@ static void scalar_dequant_math(COOKContext *q, int index, } } - +#ifdef TEST /** * The modulated lapped transform, this takes transform coefficients * and transforms them into timedomain samples. @@ -205,7 +182,35 @@ static inline void imlt_math(COOKContext *q, FIXP *in) q->mono_mdct_output[n + i] = fixp_mult_su(tmp, sincos_lookup[j]); } while (++i < n); } +#else +#include <codecs/lib/codeclib.h> + +static inline void imlt_math(COOKContext *q, FIXP *in) +{ + const int n = q->samples_per_channel; + const int step = 4 << (10 - av_log2(n)); + int i = 0, j = step>>1; + + mdct_backward(2 * n, in, q->mono_mdct_output); + do { + FIXP tmp = q->mono_mdct_output[i]; + + q->mono_mdct_output[i] = + fixp_mult_su(-q->mono_mdct_output[n + i], sincos_lookup[j]); + q->mono_mdct_output[n + i] = fixp_mult_su(tmp, sincos_lookup[j+1]); + j += step; + } while (++i < n/2); + do { + FIXP tmp = q->mono_mdct_output[i]; + + j -= step; + q->mono_mdct_output[i] = + fixp_mult_su(-q->mono_mdct_output[n + i], sincos_lookup[j+1]); + q->mono_mdct_output[n + i] = fixp_mult_su(tmp, sincos_lookup[j]); + } while (++i < n); +} +#endif /** * Perform buffer overlapping. |