I have noticed lpc slowdown both in encoding and decoding, not
related to new config.h stuff. It seems there is wrong choosing of
fastest possible version of lpc function. Patch is attached.
--
Miroslav Lichvar
-------------- next part --------------
Index: src/libFLAC/stream_decoder.c
==================================================================RCS file:
/cvsroot/flac/flac/src/libFLAC/stream_decoder.c,v
retrieving revision 1.70
diff -u -r1.70 stream_decoder.c
--- src/libFLAC/stream_decoder.c 18 Oct 2002 05:49:20 -0000 1.70
+++ src/libFLAC/stream_decoder.c 20 Oct 2002 11:37:04 -0000
@@ -23,6 +23,7 @@
#include "FLAC/assert.h"
#include "protected/stream_decoder.h"
#include "private/bitbuffer.h"
+#include "private/bitmath.h"
#include "private/cpu.h"
#include "private/crc.h"
#include "private/fixed.h"
@@ -1738,10 +1739,11 @@
/* decode the subframe */
memcpy(decoder->private_->output[channel], subframe->warmup,
sizeof(FLAC__int32) * order);
- if(bps <= 16 && subframe->qlp_coeff_precision <= 16)
-
decoder->private_->local_lpc_restore_signal_16bit(decoder->private_->residual[channel],
decoder->private_->frame.header.blocksize-order, subframe->qlp_coeff,
order, subframe->quantization_level,
decoder->private_->output[channel]+order);
- else if(bps + subframe->qlp_coeff_precision + order <= 32)
-
decoder->private_->local_lpc_restore_signal(decoder->private_->residual[channel],
decoder->private_->frame.header.blocksize-order, subframe->qlp_coeff,
order, subframe->quantization_level,
decoder->private_->output[channel]+order);
+ if(bps + subframe->qlp_coeff_precision + FLAC__bitmath_ilog2(order) <=
32)
+ if(bps <= 16 && subframe->qlp_coeff_precision <= 16)
+
decoder->private_->local_lpc_restore_signal_16bit(decoder->private_->residual[channel],
decoder->private_->frame.header.blocksize-order, subframe->qlp_coeff,
order, subframe->quantization_level,
decoder->private_->output[channel]+order);
+ else
+
decoder->private_->local_lpc_restore_signal(decoder->private_->residual[channel],
decoder->private_->frame.header.blocksize-order, subframe->qlp_coeff,
order, subframe->quantization_level,
decoder->private_->output[channel]+order);
else
decoder->private_->local_lpc_restore_signal_64bit(decoder->private_->residual[channel],
decoder->private_->frame.header.blocksize-order, subframe->qlp_coeff,
order, subframe->quantization_level,
decoder->private_->output[channel]+order);
Index: src/libFLAC/stream_encoder.c
==================================================================RCS file:
/cvsroot/flac/flac/src/libFLAC/stream_encoder.c,v
retrieving revision 1.49
diff -u -r1.49 stream_encoder.c
--- src/libFLAC/stream_encoder.c 18 Oct 2002 05:49:20 -0000 1.49
+++ src/libFLAC/stream_encoder.c 20 Oct 2002 11:37:18 -0000
@@ -2267,10 +2267,11 @@
if(ret != 0)
return 0; /* this is a hack to indicate to the caller that we can't do lp
at this order on this subframe */
- if(subframe_bps <= 16 && qlp_coeff_precision <= 16)
-
encoder->private_->local_lpc_compute_residual_from_qlp_coefficients_16bit(signal+order,
residual_samples, qlp_coeff, order, quantization, residual);
- else if(subframe_bps + qlp_coeff_precision + order <= 32)
-
encoder->private_->local_lpc_compute_residual_from_qlp_coefficients(signal+order,
residual_samples, qlp_coeff, order, quantization, residual);
+ if(subframe_bps + qlp_coeff_precision + FLAC__bitmath_ilog2(order) <= 32)
+ if(subframe_bps <= 16 && qlp_coeff_precision <= 16)
+
encoder->private_->local_lpc_compute_residual_from_qlp_coefficients_16bit(signal+order,
residual_samples, qlp_coeff, order, quantization, residual);
+ else
+
encoder->private_->local_lpc_compute_residual_from_qlp_coefficients(signal+order,
residual_samples, qlp_coeff, order, quantization, residual);
else
encoder->private_->local_lpc_compute_residual_from_qlp_coefficients_64bit(signal+order,
residual_samples, qlp_coeff, order, quantization, residual);