aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/lpc.h
diff options
context:
space:
mode:
authorDjordje Pesut <djordje.pesut@imgtec.com>2015-07-20 13:36:17 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2015-07-20 17:20:16 +0200
commitf85bc147fb87de048ccc5767e186ac59ec0284ef (patch)
treeb94b04d6110ec84a79fa1466d29c700d04d1f841 /libavcodec/lpc.h
parentb0414da90d6da34144ad9dadd5445fe62cf755a6 (diff)
downloadffmpeg-f85bc147fb87de048ccc5767e186ac59ec0284ef.tar.gz
avcodec: Implementation of AAC_fixed_decoder (SBR-module)
Add fixed poind code. Signed-off-by: Nedeljko Babic <nedeljko.babic@imgtec.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec/lpc.h')
-rw-r--r--libavcodec/lpc.h15
1 files changed, 10 insertions, 5 deletions
diff --git a/libavcodec/lpc.h b/libavcodec/lpc.h
index 96acb37146..9b76e2fb43 100644
--- a/libavcodec/lpc.h
+++ b/libavcodec/lpc.h
@@ -25,6 +25,7 @@
#include <stdint.h>
#include "libavutil/avassert.h"
#include "libavutil/lls.h"
+#include "aac_defines.h"
#define ORDER_METHOD_EST 0
#define ORDER_METHOD_2LEVEL 1
@@ -111,11 +112,15 @@ void ff_lpc_init_x86(LPCContext *s);
*/
void ff_lpc_end(LPCContext *s);
+#if USE_FIXED
+#define LPC_TYPE int
+#else
#ifdef LPC_USE_DOUBLE
#define LPC_TYPE double
#else
#define LPC_TYPE float
#endif
+#endif // USE_FIXED
/**
* Schur recursion.
@@ -152,7 +157,7 @@ static inline void compute_ref_coefs(const LPC_TYPE *autoc, int max_order,
* Levinson-Durbin recursion.
* Produce LPC coefficients from autocorrelation data.
*/
-static inline int compute_lpc_coefs(const LPC_TYPE *autoc, int max_order,
+static inline int AAC_RENAME(compute_lpc_coefs)(const LPC_TYPE *autoc, int max_order,
LPC_TYPE *lpc, int lpc_stride, int fail,
int normalize)
{
@@ -169,14 +174,14 @@ static inline int compute_lpc_coefs(const LPC_TYPE *autoc, int max_order,
return -1;
for(i=0; i<max_order; i++) {
- LPC_TYPE r = -autoc[i];
+ LPC_TYPE r = AAC_SRA_R(-autoc[i], 5);
if (normalize) {
for(j=0; j<i; j++)
r -= lpc_last[j] * autoc[i-j-1];
r /= err;
- err *= 1.0 - (r * r);
+ err *= FIXR(1.0) - (r * r);
}
lpc[i] = r;
@@ -184,8 +189,8 @@ static inline int compute_lpc_coefs(const LPC_TYPE *autoc, int max_order,
for(j=0; j < (i+1)>>1; j++) {
LPC_TYPE f = lpc_last[ j];
LPC_TYPE b = lpc_last[i-1-j];
- lpc[ j] = f + r * b;
- lpc[i-1-j] = b + r * f;
+ lpc[ j] = f + AAC_MUL26(r, b);
+ lpc[i-1-j] = b + AAC_MUL26(r, f);
}
if (fail && err < 0)