From 2353aee8a1a09dd28560bcaa63b53ec11355adca Mon Sep 17 00:00:00 2001 From: Josh Coalson Date: Fri, 26 Jan 2001 21:28:31 +0000 Subject: [PATCH] delete unused code --- src/libFLAC/encoder.c | 172 -------------------------------------------------- 1 file changed, 172 deletions(-) diff --git a/src/libFLAC/encoder.c b/src/libFLAC/encoder.c index 283a708..9815a9f 100644 --- a/src/libFLAC/encoder.c +++ b/src/libFLAC/encoder.c @@ -76,10 +76,6 @@ static unsigned encoder_evaluate_fixed_subframe_(const int32 signal[], int32 res static unsigned encoder_evaluate_lpc_subframe_(const int32 signal[], int32 residual[], uint32 abs_residual[], const real lp_coeff[], unsigned blocksize, unsigned bits_per_sample, unsigned order, unsigned qlp_coeff_precision, unsigned rice_parameter, unsigned max_partition_order, FLAC__Subframe *subframe); static unsigned encoder_evaluate_verbatim_subframe_(const int32 signal[], unsigned blocksize, unsigned bits_per_sample, FLAC__Subframe *subframe); static unsigned encoder_find_best_partition_order_(const int32 residual[], uint32 abs_residual[], unsigned residual_samples, unsigned predictor_order, unsigned rice_parameter, unsigned max_partition_order, unsigned *best_partition_order, unsigned best_parameters[]); -#if 0 -@@@ -static void encoder_promote_candidate_subframe_(FLAC__Subframe *best_subframe, FLAC__Subframe *candidata_subframe, unsigned *best_residual); -#endif static bool encoder_set_partitioned_rice_(const uint32 abs_residual[], const unsigned residual_samples, const unsigned predictor_order, const unsigned rice_parameter, const unsigned partition_order, unsigned parameters[], unsigned *bits); const char *FLAC__EncoderWriteStatusString[] = { @@ -978,16 +974,6 @@ unsigned encoder_find_best_partition_order_(const int32 residual[], uint32 abs_r return best_residual_bits; } -#if 0 -@@@ -void encoder_promote_candidate_subframe_(FLAC__Encoder *encoder) -{ - assert(encoder->state == FLAC__ENCODER_OK); - encoder->guts->best_subframe = encoder->guts->candidate_subframe; - encoder->guts->best_residual = !encoder->guts->best_residual; -} -#endif - #ifdef ESTIMATE_RICE_BITS #undef ESTIMATE_RICE_BITS #endif @@ -1055,161 +1041,3 @@ bool encoder_set_partitioned_rice_(const uint32 abs_residual[], const unsigned r *bits = bits_; return true; } - -#if 0 -@@@ -bool encoder_process_subframes_(FLAC__Encoder *encoder, bool is_last_frame, bool verbatim_only, const FLAC__FrameHeader *frame_header, unsigned channels, const int32 *integer_signal[], const real *real_signal[], FLAC__BitBuffer *frame) -{ - real fixed_residual_bits_per_sample[FLAC__MAX_FIXED_ORDER+1]; - real lpc_residual_bits_per_sample; - real autoc[FLAC__MAX_LPC_ORDER+1]; - real lp_coeff[FLAC__MAX_LPC_ORDER][FLAC__MAX_LPC_ORDER]; - real lpc_error[FLAC__MAX_LPC_ORDER]; - unsigned channel; - unsigned min_lpc_order, max_lpc_order, lpc_order; - unsigned min_fixed_order, max_fixed_order, guess_fixed_order, fixed_order; - unsigned max_partition_order; - unsigned min_qlp_coeff_precision, max_qlp_coeff_precision, qlp_coeff_precision; - unsigned rice_parameter; - unsigned candidate_bits, best_bits; - - if(is_last_frame) { - max_partition_order = 0; - } - else { - unsigned limit = 0, b = encoder->blocksize; - while(!(b & 1)) { - limit++; - b >>= 1; - } - max_partition_order = min(encoder->rice_optimization_level, limit); - } - - for(channel = 0; channel < channels; channel++) { - /* verbatim subframe is the baseline against which we measure other compressed subframes */ - best_bits = encoder_evaluate_verbatim_subframe_(frame_header->blocksize, frame_header->bits_per_sample, &(encoder->guts->best_subframe)); - - if(!verbatim_only && frame_header->blocksize >= FLAC__MAX_FIXED_ORDER) { - /* check for constant subframe */ - guess_fixed_order = FLAC__fixed_compute_best_predictor(integer_signal[channel]+FLAC__MAX_FIXED_ORDER, frame_header->blocksize-FLAC__MAX_FIXED_ORDER, fixed_residual_bits_per_sample); - if(fixed_residual_bits_per_sample[1] == 0.0) { - /* the above means integer_signal[channel]+FLAC__MAX_FIXED_ORDER is constant, now we just have to check the warmup samples */ - unsigned i, signal_is_constant = true; - for(i = 1; i <= FLAC__MAX_FIXED_ORDER; i++) { - if(integer_signal[channel][0] != integer_signal[channel][i]) { - signal_is_constant = false; - break; - } - } - if(signal_is_constant) { - candidate_bits = encoder_evaluate_constant_subframe_(integer_signal[channel][0], frame_header->bits_per_sample, &(encoder->guts->candidate_subframe)); - if(candidate_bits < best_bits) { - encoder_promote_candidate_subframe_(encoder); - best_bits = candidate_bits; - } - } - } - else { - /* encode fixed */ - if(encoder->do_exhaustive_model_search) { - min_fixed_order = 0; - max_fixed_order = FLAC__MAX_FIXED_ORDER; - } - else { - min_fixed_order = max_fixed_order = guess_fixed_order; - } - for(fixed_order = min_fixed_order; fixed_order <= max_fixed_order; fixed_order++) { - if(fixed_residual_bits_per_sample[fixed_order] >= (real)frame_header->bits_per_sample) - continue; /* don't even try */ - /* 0.5 is for rounding, another 1.0 is to account for the signed->unsigned conversion during rice coding */ - rice_parameter = (fixed_residual_bits_per_sample[fixed_order] > 0.0)? (unsigned)(fixed_residual_bits_per_sample[fixed_order]+1.5) : 0; - if(rice_parameter >= (1u << FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_PARAMETER_LEN)) - rice_parameter = (1u << FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_PARAMETER_LEN) - 1; - candidate_bits = encoder_evaluate_fixed_subframe_(integer_signal[channel], encoder->guts->residual[!encoder->guts->best_residual], encoder->guts->abs_residual, frame_header->blocksize, frame_header->bits_per_sample, fixed_order, rice_parameter, max_partition_order, &(encoder->guts->candidate_subframe)); - if(candidate_bits < best_bits) { - encoder_promote_candidate_subframe_(encoder); - best_bits = candidate_bits; - } - } - - /* encode lpc */ - if(encoder->max_lpc_order > 0) { - if(encoder->max_lpc_order >= frame_header->blocksize) - max_lpc_order = frame_header->blocksize-1; - else - max_lpc_order = encoder->max_lpc_order; - if(max_lpc_order > 0) { - FLAC__lpc_compute_autocorrelation(real_signal[channel], frame_header->blocksize, max_lpc_order+1, autoc); - FLAC__lpc_compute_lp_coefficients(autoc, max_lpc_order, lp_coeff, lpc_error); - if(encoder->do_exhaustive_model_search) { - min_lpc_order = 1; - } - else { - unsigned guess_lpc_order = FLAC__lpc_compute_best_order(lpc_error, max_lpc_order, frame_header->blocksize, frame_header->bits_per_sample); - min_lpc_order = max_lpc_order = guess_lpc_order; - } - if(encoder->do_qlp_coeff_prec_search) { - min_qlp_coeff_precision = FLAC__MIN_QLP_COEFF_PRECISION; - max_qlp_coeff_precision = 32 - frame_header->bits_per_sample - 1; - } - else { - min_qlp_coeff_precision = max_qlp_coeff_precision = encoder->qlp_coeff_precision; - } - for(lpc_order = min_lpc_order; lpc_order <= max_lpc_order; lpc_order++) { - lpc_residual_bits_per_sample = FLAC__lpc_compute_expected_bits_per_residual_sample(lpc_error[lpc_order-1], frame_header->blocksize); - if(lpc_residual_bits_per_sample >= (real)frame_header->bits_per_sample) - continue; /* don't even try */ - /* 0.5 is for rounding, another 1.0 is to account for the signed->unsigned conversion during rice coding */ - rice_parameter = (lpc_residual_bits_per_sample > 0.0)? (unsigned)(lpc_residual_bits_per_sample+1.5) : 0; - if(rice_parameter >= (1u << FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_PARAMETER_LEN)) - rice_parameter = (1u << FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_PARAMETER_LEN) - 1; - for(qlp_coeff_precision = min_qlp_coeff_precision; qlp_coeff_precision <= max_qlp_coeff_precision; qlp_coeff_precision++) { - candidate_bits = encoder_evaluate_lpc_subframe_(integer_signal[channel], encoder->guts->residual[!encoder->guts->best_residual], encoder->guts->abs_residual, lp_coeff[lpc_order-1], frame_header->blocksize, frame_header->bits_per_sample, lpc_order, qlp_coeff_precision, rice_parameter, max_partition_order, &(encoder->guts->candidate_subframe)); - if(candidate_bits > 0) { /* if == 0, there was a problem quantizing the lpcoeffs */ - if(candidate_bits < best_bits) { - encoder_promote_candidate_subframe_(encoder); - best_bits = candidate_bits; - } - } - } - } - } - } - } - } - - /* add the best subframe */ - switch(encoder->guts->best_subframe.type) { - case FLAC__SUBFRAME_TYPE_CONSTANT: - if(!FLAC__subframe_add_constant(&(encoder->guts->best_subframe.data.constant), frame_header->bits_per_sample, frame)) { - encoder->state = FLAC__ENCODER_FATAL_ERROR_WHILE_ENCODING; - return false; - } - break; - case FLAC__SUBFRAME_TYPE_FIXED: - encoder->guts->best_subframe.data.fixed.residual = encoder->guts->residual[encoder->guts->best_residual]; - if(!FLAC__subframe_add_fixed(&(encoder->guts->best_subframe.data.fixed), frame_header->blocksize - encoder->guts->best_subframe.data.fixed.order, frame_header->bits_per_sample, frame)) { - encoder->state = FLAC__ENCODER_FATAL_ERROR_WHILE_ENCODING; - return false; - } - break; - case FLAC__SUBFRAME_TYPE_LPC: - encoder->guts->best_subframe.data.lpc.residual = encoder->guts->residual[encoder->guts->best_residual]; - if(!FLAC__subframe_add_lpc(&(encoder->guts->best_subframe.data.lpc), frame_header->blocksize - encoder->guts->best_subframe.data.lpc.order, frame_header->bits_per_sample, frame)) { - encoder->state = FLAC__ENCODER_FATAL_ERROR_WHILE_ENCODING; - return false; - } - break; - case FLAC__SUBFRAME_TYPE_VERBATIM: - encoder->guts->best_subframe.data.verbatim.data = integer_signal[channel]; - if(!FLAC__subframe_add_verbatim(&(encoder->guts->best_subframe.data.verbatim), frame_header->blocksize, frame_header->bits_per_sample, frame)) { - encoder->state = FLAC__ENCODER_FATAL_ERROR_WHILE_ENCODING; - return false; - } - break; - } - } - - return true; -} -#endif -- 2.7.4