mirror of
https://github.com/claunia/flac.git
synced 2025-12-16 18:54:26 +00:00
in FLAC__lpc_quantize_coefficients(), clip shift to max_shiftlimit
This commit is contained in:
@@ -185,19 +185,11 @@ int FLAC__lpc_quantize_coefficients(const FLAC__real lp_coeff[], unsigned order,
|
|||||||
log2cmax--;
|
log2cmax--;
|
||||||
*shift = (int)precision - log2cmax - 1;
|
*shift = (int)precision - log2cmax - 1;
|
||||||
|
|
||||||
if(*shift < min_shiftlimit || *shift > max_shiftlimit) {
|
|
||||||
#ifdef FLAC__OVERFLOW_DETECT
|
|
||||||
fprintf(stderr,"FLAC__lpc_quantize_coefficients: shift out of limit: shift=%d cmax=%f precision=%u\n",*shift,cmax,precision+1);
|
|
||||||
#endif
|
|
||||||
#if 0
|
|
||||||
/*@@@ this does not seem to help at all, but was not extensively tested either: */
|
|
||||||
if(*shift > max_shiftlimit)
|
if(*shift > max_shiftlimit)
|
||||||
*shift = max_shiftlimit;
|
*shift = max_shiftlimit;
|
||||||
else
|
else if(*shift < min_shiftlimit)
|
||||||
#endif
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if(*shift >= 0) {
|
if(*shift >= 0) {
|
||||||
FLAC__double error = 0.0;
|
FLAC__double error = 0.0;
|
||||||
|
|||||||
Reference in New Issue
Block a user