Mercurial > libavcodec.hg
changeset 3464:9cda085ab7cc libavcodec
dither lpc cpeffs
author | michael |
---|---|
date | Thu, 13 Jul 2006 11:41:52 +0000 |
parents | 444bd402aebe |
children | 5607769c4933 |
files | flacenc.c |
diffstat | 1 files changed, 5 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/flacenc.c Wed Jul 12 16:49:14 2006 +0000 +++ b/flacenc.c Thu Jul 13 11:41:52 2006 +0000 @@ -661,7 +661,7 @@ int32_t *lpc_out, int *shift) { int i; - double cmax; + double cmax, error; int32_t qmax; int sh; @@ -697,8 +697,11 @@ } /* output quantized coefficients and level shift */ + error=0; for(i=0; i<order; i++) { - lpc_out[i] = (int32_t)(lpc_in[i] * (1 << sh)); + error += lpc_in[i] * (1 << sh); + lpc_out[i] = clip(lrintf(error), -qmax, qmax); + error -= lpc_out[i]; } *shift = sh; }