unsigned (*local_fixed_compute_best_predictor)(const int32 data[], unsigned data_len, real residual_bits_per_sample[FLAC__MAX_FIXED_ORDER+1]);
void (*local_lpc_compute_autocorrelation)(const real data[], unsigned data_len, unsigned lag, real autoc[]);
void (*local_lpc_compute_residual_from_qlp_coefficients)(const int32 data[], unsigned data_len, const int32 qlp_coeff[], unsigned order, int lp_quantization, int32 residual[]);
+ void (*local_lpc_compute_residual_from_qlp_coefficients_16bit)(const int32 data[], unsigned data_len, const int32 qlp_coeff[], unsigned order, int lp_quantization, int32 residual[]);
bool use_slow; /* use slow 64-bit versions of some functions */
FLAC__EncoderWriteStatus (*write_callback)(const FLAC__Encoder *encoder, const byte buffer[], unsigned bytes, unsigned samples, unsigned current_frame, void *client_data);
void (*metadata_callback)(const FLAC__Encoder *encoder, const FLAC__StreamMetaData *metadata, void *client_data);
encoder->guts->local_lpc_compute_autocorrelation = FLAC__lpc_compute_autocorrelation;
encoder->guts->local_fixed_compute_best_predictor = FLAC__fixed_compute_best_predictor;
encoder->guts->local_lpc_compute_residual_from_qlp_coefficients = FLAC__lpc_compute_residual_from_qlp_coefficients;
+ encoder->guts->local_lpc_compute_residual_from_qlp_coefficients_16bit = FLAC__lpc_compute_residual_from_qlp_coefficients;
/* now override with asm where appropriate */
#ifndef FLAC__NO_ASM
FLAC__ASSERT(encoder->guts->cpuinfo.use_asm);
{//@@@
encoder->guts->local_fixed_compute_best_predictor = FLAC__fixed_compute_best_predictor_asm_i386_mmx_cmov;
fprintf(stderr,"@@@ got _asm_i386_mmx_cmov of fixed_compute_best_predictor()\n");}
-#if 0
- /* @@@ MMX version needs bps check */
- if(encoder->guts->cpuinfo.data.ia32.mmx && @@@bps check here@@@)
-{//@@@
- encoder->guts->local_lpc_compute_residual_from_qlp_coefficients = FLAC__lpc_compute_residual_from_qlp_coefficients_asm_i386_mmx;
-fprintf(stderr,"@@@ got _asm_i386_mmx of lpc_compute_residual_from_qlp_coefficients()\n");}
- else
-#endif
-{//@@@
+ if(encoder->guts->cpuinfo.data.ia32.mmx) {
encoder->guts->local_lpc_compute_residual_from_qlp_coefficients = FLAC__lpc_compute_residual_from_qlp_coefficients_asm_i386;
-fprintf(stderr,"@@@ got _asm_i386 of lpc_compute_residual_from_qlp_coefficients()\n");}
+ encoder->guts->local_lpc_compute_residual_from_qlp_coefficients_16bit = FLAC__lpc_compute_residual_from_qlp_coefficients_asm_i386_mmx;
+fprintf(stderr,"@@@ got _asm_i386_mmx of lpc_compute_residual_from_qlp_coefficients()\n");
+ }
+ else {
+ encoder->guts->local_lpc_compute_residual_from_qlp_coefficients = FLAC__lpc_compute_residual_from_qlp_coefficients_asm_i386;
+ encoder->guts->local_lpc_compute_residual_from_qlp_coefficients_16bit = FLAC__lpc_compute_residual_from_qlp_coefficients_asm_i386;
+fprintf(stderr,"@@@ got _asm_i386 of lpc_compute_residual_from_qlp_coefficients()\n");
+ }
#endif
#endif
#endif
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 */
- encoder->guts->local_lpc_compute_residual_from_qlp_coefficients(signal+order, residual_samples, qlp_coeff, order, quantization, residual);
+ if(subframe_bps <= 16 && qlp_coeff_precision <= 16)
+ encoder->guts->local_lpc_compute_residual_from_qlp_coefficients_16bit(signal+order, residual_samples, qlp_coeff, order, quantization, residual);
+ else
+ encoder->guts->local_lpc_compute_residual_from_qlp_coefficients(signal+order, residual_samples, qlp_coeff, order, quantization, residual);
subframe->type = FLAC__SUBFRAME_TYPE_LPC;
void (*metadata_callback)(const FLAC__StreamDecoder *decoder, const FLAC__StreamMetaData *metadata, void *client_data);
void (*error_callback)(const FLAC__StreamDecoder *decoder, FLAC__StreamDecoderErrorStatus status, void *client_data);
void (*local_lpc_restore_signal)(const int32 residual[], unsigned data_len, const int32 qlp_coeff[], unsigned order, int lp_quantization, int32 data[]);
+ void (*local_lpc_restore_signal_16bit)(const int32 residual[], unsigned data_len, const int32 qlp_coeff[], unsigned order, int lp_quantization, int32 data[]);
void *client_data;
FLAC__BitBuffer input;
int32 *output[FLAC__MAX_CHANNELS];
FLAC__cpu_info(&decoder->guts->cpuinfo);
/* first default to the non-asm routines */
decoder->guts->local_lpc_restore_signal = FLAC__lpc_restore_signal;
+ decoder->guts->local_lpc_restore_signal_16bit = FLAC__lpc_restore_signal;
/* now override with asm where appropriate */
#ifndef FLAC__NO_ASM
FLAC__ASSERT(decoder->guts->cpuinfo.use_asm);
#ifdef FLAC__CPU_IA32
FLAC__ASSERT(decoder->guts->cpuinfo.type == FLAC__CPUINFO_TYPE_IA32);
#ifdef FLAC__HAS_NASM
-#if 0
- /* @@@ MMX version needs bps check */
- if(decoder->guts->cpuinfo.data.ia32.mmx && @@@bps check here@@@)
-{//@@@
- decoder->guts->local_lpc_restore_signal = FLAC__lpc_restore_signal_asm_i386_mmx;
-fprintf(stderr,"@@@ got _asm_i386_mmx of lpc_restore_signal()\n");}
- else
-#endif
-{//@@@
+ if(decoder->guts->cpuinfo.data.ia32.mmx) {
decoder->guts->local_lpc_restore_signal = FLAC__lpc_restore_signal_asm_i386;
-fprintf(stderr,"@@@ got _asm_i386 of lpc_restore_signal()\n");}
+ decoder->guts->local_lpc_restore_signal_16bit = FLAC__lpc_restore_signal_asm_i386_mmx;
+fprintf(stderr,"@@@ got _asm_i386_mmx of lpc_restore_signal()\n");
+ }
+ else {
+ decoder->guts->local_lpc_restore_signal = FLAC__lpc_restore_signal_asm_i386;
+ decoder->guts->local_lpc_restore_signal_16bit = FLAC__lpc_restore_signal_asm_i386;
+fprintf(stderr,"@@@ got _asm_i386 of lpc_restore_signal()\n");
+ }
#endif
#endif
#endif
/* decode the subframe */
memcpy(decoder->guts->output[channel], subframe->warmup, sizeof(int32) * order);
- decoder->guts->local_lpc_restore_signal(decoder->guts->residual[channel], decoder->guts->frame.header.blocksize-order, subframe->qlp_coeff, order, subframe->quantization_level, decoder->guts->output[channel]+order);
+ if(bps <= 16 && subframe->qlp_coeff_precision <= 16)
+ decoder->guts->local_lpc_restore_signal_16bit(decoder->guts->residual[channel], decoder->guts->frame.header.blocksize-order, subframe->qlp_coeff, order, subframe->quantization_level, decoder->guts->output[channel]+order);
+ else
+ decoder->guts->local_lpc_restore_signal(decoder->guts->residual[channel], decoder->guts->frame.header.blocksize-order, subframe->qlp_coeff, order, subframe->quantization_level, decoder->guts->output[channel]+order);
return true;
}