Eliminate some more warnings

This commit is contained in:
Steve Underwood 2013-10-16 00:47:29 +08:00
parent f236ca113d
commit 84324ab7b1
6 changed files with 61 additions and 76 deletions

View File

@ -20,8 +20,6 @@
* You should have received a copy of the GNU Lesser General Public
* License along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Id: bv16encoder.c,v 1.1.1.1 2009/11/19 12:10:48 steveu Exp $
*/
/*! \file */
@ -169,10 +167,10 @@ BV_DECLARE(int) bv16_encode(bv16_encode_state_t *cs,
/* Refine the pitch period in the neighborhood of coarse pitch period
also calculate the pitch predictor tap for single-tap predictor */
pp = refinepitch(dq, cpp, &ppt);
bs.ppidx = pp - MINPP;
bs.ppidx = (int16_t) (pp - MINPP);
/* Vector quantize 3 pitch predictor taps with minimum residual energy */
bs.bqidx = pitchtapquan(dq, pp, bq, &lg);
bs.bqidx = (int16_t) pitchtapquan(dq, pp, bq, &lg);
/* Get coefficients of long-term noise feedback filter */
if (ppt > 1.0)
@ -184,7 +182,7 @@ BV_DECLARE(int) bv16_encode(bv16_encode_state_t *cs,
/* Gain quantization */
lg = (lg < FRSZ) ? 0 : log(lg/FRSZ)/log(2.0);
bs.gidx = gainquan(&gainq, lg, cs->lgpm, cs->prevlg, cs->level);
bs.gidx = (int16_t) gainquan(&gainq, lg, cs->lgpm, cs->prevlg, cs->level);
/* Level estimation */
dummy = estl_alpha;

View File

@ -22,8 +22,6 @@
* You should have received a copy of the GNU Lesser General Public
* License along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Id: bv16excquan.c,v 1.1.1.1 2009/11/19 12:10:48 steveu Exp $
*/
/*! \file */
@ -241,9 +239,9 @@ void excquan(int16_t *idx, /* quantizer codebook index for uq[] vector */
/* The best codevector has been found; assign vq codebook index */
if (sign == 1.0F)
idx[iv++] = jmin;
idx[iv++] = (int16_t) jmin;
else
idx[iv++] = jmin + CBSZ; /* MSB of index is sign bit */
idx[iv++] = (int16_t) (jmin + CBSZ); /* MSB of index is sign bit */
fp3 = &cb[jmin*VDIM]; /* fp3 points to start of best codevector */
for (n = 0; n < VDIM; n++)

View File

@ -21,8 +21,6 @@
* You should have received a copy of the GNU Lesser General Public
* License along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Id: bv16lspquan.c,v 1.1.1.1 2009/11/19 12:10:48 steveu Exp $
*/
/*! \file */
@ -36,30 +34,26 @@
#include "bv16externs.h"
#include "bvcommon.h"
void vqmse(
Float *xq,
int16_t *idx,
Float *x,
const Float *cb,
int vdim,
int cbsz);
void vqmse(Float *xq,
int16_t *idx,
Float *x,
const Float *cb,
int vdim,
int cbsz);
void svqwmse(
Float *xq,
int16_t *idx,
Float *x,
Float *xa,
Float *w,
const Float *cb,
int vdim,
int cbsz);
void svqwmse(Float *xq,
int16_t *idx,
Float *x,
Float *xa,
Float *w,
const Float *cb,
int vdim,
int cbsz);
void lspquan(
Float *lspq,
int16_t *lspidx,
Float *lsp,
Float *lsppm
)
void lspquan(Float *lspq,
int16_t *lspidx,
Float *lsp,
Float *lsppm)
{
Float d[LPCO];
Float w[LPCO];
@ -75,7 +69,7 @@ void lspquan(
int i;
int k;
/* calculate the weights for weighted mean-square error distortion */
/* Calculate the weights for weighted mean-square error distortion */
for (i = 0; i < LPCO - 1; i++)
d[i] = lsp[i + 1] - lsp[i]; /* LSP difference vector */
w[0] = 1.0F/d[0];
@ -119,7 +113,7 @@ void lspquan(
for (i = 0; i < LPCO; i++)
lspe[i] = lspeq1[i] + lspeq2[i];
/* update lsp ma predictor memory */
/* Update lsp ma predictor memory */
i = LPCO * LSPPORDER - 1;
fp1 = &lsppm[i];
fp2 = &lsppm[i - 1];
@ -131,20 +125,20 @@ void lspquan(
fp2--;
}
/* calculate quantized lsp */
/* Calculate quantized lsp */
for (i = 0; i < LPCO; i++)
lspq[i] = lspa[i] + lspeq2[i];
/* ensure correct ordering of lsp to guarantee lpc filter stability */
/* Ensure correct ordering of lsp to guarantee lpc filter stability */
stblz_lsp(lspq, LPCO);
}
void vqmse(Float *xq, /* VQ output vector (quantized version of input vector) */
int16_t *idx, /* VQ codebook index for the nearest neighbor */
Float *x, /* input vector */
const Float *cb, /* VQ codebook */
int vdim, /* vector dimension */
int cbsz) /* codebook size (number of codevectors) */
void vqmse(Float *xq, /* VQ output vector (quantized version of input vector) */
int16_t *idx, /* VQ codebook index for the nearest neighbor */
Float *x, /* input vector */
const Float *cb, /* VQ codebook */
int vdim, /* vector dimension */
int cbsz) /* codebook size (number of codevectors) */
{
const Float *fp1;
Float dmin;
@ -166,7 +160,7 @@ void vqmse(Float *xq, /* VQ output vector (quantized version of input vector)
if (d < dmin)
{
dmin = d;
*idx = j;
*idx = (int16_t) j;
}
}
@ -176,23 +170,24 @@ void vqmse(Float *xq, /* VQ output vector (quantized version of input vector)
}
/* Signed WMSE VQ */
void svqwmse(
Float *xq, /* VQ output vector (quantized version of input vector) */
int16_t *idx, /* VQ codebook index for the nearest neighbor */
Float *x, /* input vector */
Float *xa, /* approximation prior to current stage */
Float *w, /* weights for weighted Mean-Square Error */
const Float *cb, /* VQ codebook */
int vdim, /* vector dimension */
int cbsz /* codebook size (number of codevectors) */
)
void svqwmse(Float *xq, /* VQ output vector (quantized version of input vector) */
int16_t *idx, /* VQ codebook index for the nearest neighbor */
Float *x, /* input vector */
Float *xa, /* approximation prior to current stage */
Float *w, /* weights for weighted Mean-Square Error */
const Float *cb, /* VQ codebook */
int vdim, /* vector dimension */
int cbsz) /* codebook size (number of codevectors) */
{
const Float *fp1;
const Float *fp2;
Float dmin;
Float d;
Float xqc[STBLDIM];
int j, k, stbl, sign=1;
int j;
int k;
int stbl;
int sign = 1;
Float e;
fp1 = cb;
@ -211,17 +206,17 @@ void svqwmse(
d += w[k]*e*e;
}
/* check candidate - negative sign */
/* Check candidate - negative sign */
if (d < dmin)
{
for (k = 0; k < STBLDIM; k++)
xqc[k] = xa[k] - *fp2++;
/* check stability - negative sign */
/* Check stability - negative sign */
stbl = stblchck(xqc, STBLDIM);
if (stbl > 0)
{
dmin = d;
*idx = j;
*idx = (int16_t) j;
sign = -1;
}
}
@ -237,18 +232,18 @@ void svqwmse(
d += w[k]*e*e;
}
/* check candidate - positive sign */
/* Check candidate - positive sign */
if (d < dmin)
{
for (k = 0; k < STBLDIM; k++)
xqc[k] = xa[k] + *fp2++;
/* check stability - positive sign */
/* Check stability - positive sign */
stbl = stblchck(xqc, STBLDIM);
if (stbl > 0)
{
dmin = d;
*idx = j;
*idx = (int16_t) j;
sign = +1;
}
}

View File

@ -20,8 +20,6 @@
* You should have received a copy of the GNU Lesser General Public
* License along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Id: bv32encoder.c,v 1.1.1.1 2009/11/19 12:10:48 steveu Exp $
*/
/*! \file */
@ -161,10 +159,10 @@ BV_DECLARE(int) bv32_encode(bv32_encode_state_t *cs,
/* Refine the pitch period in the neighborhood of coarse pitch period
also calculate the pitch predictor tap for single-tap predictor */
pp = bv32_refinepitch(dq, cpp, &ppt);
bs.ppidx = pp - MINPP;
bs.ppidx = (int16_t) (pp - MINPP);
/* vq 3 pitch predictor taps with minimum residual energy */
bs.bqidx = bv32_pitchtapquan(dq, pp, bq);
bs.bqidx = (int16_t) bv32_pitchtapquan(dq, pp, bq);
/* get coefficients for long-term noise feedback filter */
if (ppt > 1.0)
@ -190,9 +188,9 @@ BV_DECLARE(int) bv32_encode(bv32_encode_state_t *cs,
/* Log-gain quantization within each sub-frame */
lg = (ee < TMinE) ? MinE : log(ee/SFRSZ)/log(2.0);
bs.gidx[issf] = bv32_gainquan(gainq + issf, lg, cs->lgpm, cs->prevlg, cs->level);
bs.gidx[issf] = (int16_t) bv32_gainquan(gainq + issf, lg, cs->lgpm, cs->prevlg, cs->level);
/* Level estimation */
/* Level Estimation */
bv32_estlevel(cs->prevlg[0], &cs->level, &cs->lmax, &cs->lmin, &cs->lmean, &cs->x1);
/* Scale the excitation codebook */

View File

@ -20,8 +20,6 @@
* You should have received a copy of the GNU Lesser General Public
* License along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Id: bv32excquan.c,v 1.1.1.1 2009/11/19 12:10:48 steveu Exp $
*/
/*! \file */
@ -186,9 +184,9 @@ void bv32_excquan(Float *qv, /* output quantized excitation signal vector */
/* THE BEST CODEVECTOR HAS BEEN FOUND; ASSIGN VQ CODEBOOK INDEX */
if (sign == 1.0F)
idx[iv++] = jmin;
idx[iv++] = (int16_t) jmin;
else
idx[iv++] = jmin + CBSZ; /* MSB of index is sign bit */
idx[iv++] = (int16_t) (jmin + CBSZ); /* MSB of index is sign bit */
/* BORROW zbuf[] TO STORE FINAL VQ OUTPUT VECTOR WITH CORRECT SIGN */
fp3 = &cb[jmin*VDIM]; /* fp3 points to start of best codevector */

View File

@ -20,8 +20,6 @@
* You should have received a copy of the GNU Lesser General Public
* License along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Id: bv32lspquan.c,v 1.1.1.1 2009/11/19 12:10:48 steveu Exp $
*/
/*! \file */
@ -153,7 +151,7 @@ static void vqmse(Float *xq, /* VQ output vector (quantized version of input
if (d < dmin)
{
dmin = d;
*idx = j;
*idx = (int16_t) j;
}
}
@ -211,7 +209,7 @@ static void vqwmse_stbl(Float *xq, /* VQ output vector (quantized version of
if (d < dmin)
{
dmin = d;
*idx = j;
*idx = (int16_t) j;
}
}
}
@ -256,7 +254,7 @@ static void vqwmse(Float *xq, /* VQ output vector (quantized version of inp
if (d < dmin)
{
dmin = d;
*idx = j;
*idx = (int16_t) j;
}
}