summaryrefslogtreecommitdiff
path: root/apps/codecs/libcook/cook_fixpoint.h
diff options
context:
space:
mode:
Diffstat (limited to 'apps/codecs/libcook/cook_fixpoint.h')
-rw-r--r--apps/codecs/libcook/cook_fixpoint.h53
1 files changed, 29 insertions, 24 deletions
diff --git a/apps/codecs/libcook/cook_fixpoint.h b/apps/codecs/libcook/cook_fixpoint.h
index 0f12b1340a..e416bc4ef5 100644
--- a/apps/codecs/libcook/cook_fixpoint.h
+++ b/apps/codecs/libcook/cook_fixpoint.h
@@ -54,29 +54,6 @@ static const FIXPU* cplscales[5] = {
54}; 54};
55 55
56/** 56/**
57 * Initialise fixed point implementation.
58 * Nothing to do for fixed point.
59 *
60 * @param q pointer to the COOKContext
61 */
62static inline int init_cook_math(COOKContext *q)
63{
64 return 0;
65}
66
67/**
68 * Free resources used by floating point implementation.
69 * Nothing to do for fixed point.
70 *
71 * @param q pointer to the COOKContext
72 */
73static inline void free_cook_math(COOKContext *q)
74{
75 return;
76}
77
78
79/**
80 * Fixed point multiply by power of two. 57 * Fixed point multiply by power of two.
81 * 58 *
82 * @param x fix point value 59 * @param x fix point value
@@ -167,7 +144,7 @@ static void scalar_dequant_math(COOKContext *q, int index,
167 } 144 }
168} 145}
169 146
170 147#ifdef TEST
171/** 148/**
172 * The modulated lapped transform, this takes transform coefficients 149 * The modulated lapped transform, this takes transform coefficients
173 * and transforms them into timedomain samples. 150 * and transforms them into timedomain samples.
@@ -205,7 +182,35 @@ static inline void imlt_math(COOKContext *q, FIXP *in)
205 q->mono_mdct_output[n + i] = fixp_mult_su(tmp, sincos_lookup[j]); 182 q->mono_mdct_output[n + i] = fixp_mult_su(tmp, sincos_lookup[j]);
206 } while (++i < n); 183 } while (++i < n);
207} 184}
185#else
186#include <codecs/lib/codeclib.h>
187
188static inline void imlt_math(COOKContext *q, FIXP *in)
189{
190 const int n = q->samples_per_channel;
191 const int step = 4 << (10 - av_log2(n));
192 int i = 0, j = step>>1;
193
194 mdct_backward(2 * n, in, q->mono_mdct_output);
208 195
196 do {
197 FIXP tmp = q->mono_mdct_output[i];
198
199 q->mono_mdct_output[i] =
200 fixp_mult_su(-q->mono_mdct_output[n + i], sincos_lookup[j]);
201 q->mono_mdct_output[n + i] = fixp_mult_su(tmp, sincos_lookup[j+1]);
202 j += step;
203 } while (++i < n/2);
204 do {
205 FIXP tmp = q->mono_mdct_output[i];
206
207 j -= step;
208 q->mono_mdct_output[i] =
209 fixp_mult_su(-q->mono_mdct_output[n + i], sincos_lookup[j+1]);
210 q->mono_mdct_output[n + i] = fixp_mult_su(tmp, sincos_lookup[j]);
211 } while (++i < n);
212}
213#endif
209 214
210/** 215/**
211 * Perform buffer overlapping. 216 * Perform buffer overlapping.