ref: c5c3fc3f9ffcd7d06e3a565ba31162193cb9d065
parent: 4208c44ee74d94a434da96e364a9dd028acfbbec
author: menno <menno>
date: Tue Aug 27 14:16:12 EDT 2002
Fixed point LTP
--- a/common/mp4v2/libmp4v2_st60.vcproj
+++ b/common/mp4v2/libmp4v2_st60.vcproj
@@ -65,7 +65,7 @@
Optimization="0"
AdditionalIncludeDirectories=".\"
PreprocessorDefinitions="WIN32,_DEBUG,_WINDOWS"
- RuntimeLibrary="1"
+ RuntimeLibrary="5"
UsePrecompiledHeader="2"
PrecompiledHeaderFile=".\ST_Debug/libmp4v2_st60.pch"
AssemblerListingLocation=".\ST_Debug/"
--- a/libfaad/common.h
+++ b/libfaad/common.h
@@ -16,7 +16,7 @@
** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
-** $Id: common.h,v 1.18 2002/08/27 10:24:54 menno Exp $
+** $Id: common.h,v 1.19 2002/08/27 18:16:12 menno Exp $
**/
#ifndef __COMMON_H__
@@ -126,12 +126,9 @@
#endif
-/* FIXED_POINT doesn't work everywhere yet */
+/* FIXED_POINT doesn't work with FFTW */
#ifdef FIXED_POINT
#undef MAIN_DEC
- #undef LTP_DEC
- #undef LD_DEC
- #undef SBR
#undef USE_FFTW
#endif
--- a/libfaad/decoder.c
+++ b/libfaad/decoder.c
@@ -16,7 +16,7 @@
** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
-** $Id: decoder.c,v 1.23 2002/08/27 10:24:54 menno Exp $
+** $Id: decoder.c,v 1.24 2002/08/27 18:16:12 menno Exp $
**/
#include <stdlib.h>
@@ -682,7 +682,7 @@
/* allocate the state only when needed */
if (pred_stat[ch] == NULL)
{
- pred_stat[ch] = (real_t*)malloc(frame_len * sizeof(pred_state));
+ pred_stat[ch] = (pred_state*)malloc(frame_len * sizeof(pred_state));
reset_all_predictors(pred_stat[ch], frame_len);
}
@@ -697,7 +697,7 @@
}
#endif
#ifdef LTP_DEC
- else if ((object_type == LTP)
+ if ((object_type == LTP)
#ifdef ERROR_RESILIENCE
|| (object_type == ER_LTP)
#endif
--- a/libfaad/filtbank.c
+++ b/libfaad/filtbank.c
@@ -16,7 +16,7 @@
** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
-** $Id: filtbank.c,v 1.16 2002/08/27 10:24:55 menno Exp $
+** $Id: filtbank.c,v 1.17 2002/08/27 18:16:12 menno Exp $
**/
#include "common.h"
@@ -79,11 +79,11 @@
/* low overlap window */
for (i = 0; i < 3*(frame_len_ld>>3); i++)
- fb->ld_window[1][i] = 0.0;
+ fb->ld_window[1][i] = COEF_CONST(0.0);
for (; i < 5*(frame_len_ld>>3); i++)
fb->ld_window[1][i] = COEF_CONST(sin((i-3*(frame_len_ld>>3)+0.5) * M_PI / (real_t)(frame_len_ld>>1)));
for (; i < frame_len_ld; i++)
- fb->ld_window[1][i] = 1.0;
+ fb->ld_window[1][i] = COEF_CONST(1.0);
#endif
return fb;
--- a/libfaad/libfaad.vcproj
+++ b/libfaad/libfaad.vcproj
@@ -24,7 +24,7 @@
AdditionalIncludeDirectories="fftw"
PreprocessorDefinitions="_DEBUG,WIN32,_LIB,FFTW_ENABLE_FLOAT"
BasicRuntimeChecks="3"
- RuntimeLibrary="1"
+ RuntimeLibrary="5"
UsePrecompiledHeader="2"
PrecompiledHeaderFile=".\Debug/libfaad.pch"
AssemblerListingLocation=".\Debug/"
--- a/libfaad/lt_predict.c
+++ b/libfaad/lt_predict.c
@@ -16,7 +16,7 @@
** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
-** $Id: lt_predict.c,v 1.8 2002/08/27 10:24:55 menno Exp $
+** $Id: lt_predict.c,v 1.9 2002/08/27 18:16:12 menno Exp $
**/
@@ -32,14 +32,14 @@
static real_t codebook[8] =
{
- REAL_CONST(0.570829),
- REAL_CONST(0.696616),
- REAL_CONST(0.813004),
- REAL_CONST(0.911304),
- REAL_CONST(0.984900),
- REAL_CONST(1.067894),
- REAL_CONST(1.194601),
- REAL_CONST(1.369533)
+ COEF_CONST(0.570829),
+ COEF_CONST(0.696616),
+ COEF_CONST(0.813004),
+ COEF_CONST(0.911304),
+ COEF_CONST(0.984900),
+ COEF_CONST(1.067894),
+ COEF_CONST(1.194601),
+ COEF_CONST(1.369533)
};
void lt_prediction(ic_stream *ics, ltp_info *ltp, real_t *spec,
@@ -65,8 +65,8 @@
{
/* The extra lookback M (N/2 for LD, 0 for LTP) is handled
in the buffer updating */
- x_est[i] = MUL(codebook[ltp->coef],
- lt_pred_stat[num_samples + i - ltp->lag]);
+ x_est[i] = MUL_R_C(lt_pred_stat[num_samples + i - ltp->lag],
+ codebook[ltp->coef]);
}
filter_bank_ltp(fb, ics->window_sequence, win_shape, win_shape_prev,
--- a/libfaad/mdct.c
+++ b/libfaad/mdct.c
@@ -16,7 +16,7 @@
** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
-** $Id: mdct.c,v 1.17 2002/08/27 10:24:55 menno Exp $
+** $Id: mdct.c,v 1.18 2002/08/27 18:16:12 menno Exp $
**/
/*
@@ -196,19 +196,7 @@
uint16_t N4 = N >> 2;
uint16_t N8 = N >> 3;
-#ifdef FIXED_POINT
- int16_t shift = -5;
- real_t scale;
- float32_t NN = N;
- while (NN >= 0.5)
- {
- NN /= 2;
- shift++;
- }
- scale = COEF_CONST(NN);
-#else
- real_t scale = N;
-#endif
+ real_t scale = REAL_CONST(N);
/* pre-FFT complex multiplication */
for (k = 0; k < N8; k++)
@@ -217,11 +205,6 @@
real_t zr = X_in[N - N4 - 1 - n] + X_in[N - N4 + n];
real_t zi = X_in[ N4 + n] - X_in[ N4 - 1 - n];
-#ifdef FIXED_POINT
- zr <<= 5;
- zi <<= 5;
-#endif
-
#ifdef USE_FFTW
Z1[k].re = -MUL_R_C(zr, sincos[k].cos) - MUL_R_C(zi, sincos[k].sin);
Z1[k].im = -MUL_R_C(zi, sincos[k].cos) + MUL_R_C(zr, sincos[k].sin);
@@ -254,15 +237,11 @@
{
uint16_t n = k << 1;
#ifdef USE_FFTW
- real_t zr = MUL_R_C(MUL_R_C(Z2[k].re, sincos[k].cos) + MUL_R_C(Z2[k].im, sincos[k].sin), scale);
- real_t zi = MUL_R_C(MUL_R_C(Z2[k].im, sincos[k].cos) - MUL_R_C(Z2[k].re, sincos[k].sin), scale);
+ real_t zr = MUL(MUL_R_C(Z2[k].re, sincos[k].cos) + MUL_R_C(Z2[k].im, sincos[k].sin), scale);
+ real_t zi = MUL(MUL_R_C(Z2[k].im, sincos[k].cos) - MUL_R_C(Z2[k].re, sincos[k].sin), scale);
#else
- real_t zr = MUL_R_C(MUL_R_C(Z1[n], sincos[k].cos) + MUL_R_C(Z1[n+1], sincos[k].sin), scale);
- real_t zi = MUL_R_C(MUL_R_C(Z1[n+1], sincos[k].cos) - MUL_R_C(Z1[n], sincos[k].sin), scale);
-#endif
-#ifdef FIXED_POINT
- zr <<= shift;
- zi <<= shift;
+ real_t zr = MUL(MUL_R_C(Z1[n], sincos[k].cos) + MUL_R_C(Z1[n+1], sincos[k].sin), scale);
+ real_t zi = MUL(MUL_R_C(Z1[n+1], sincos[k].cos) - MUL_R_C(Z1[n], sincos[k].sin), scale);
#endif
X_out[ n] = zr;