first pass at making an integer-only flavor of the libraries. move FLAC__real out of ordinals.h to src/libFLAC/include/private/float.h, add FLAC__double and FLAC__float and use these everywhere instead of double and float, and don't typedef FLAC__real/float/double when building in integer-only mode. still need to provide integer substitutes in several places.

This commit is contained in:
Josh Coalson
2004-10-20 00:21:50 +00:00
parent 5899bcb73e
commit 0975843bed
10 changed files with 83 additions and 76 deletions

View File

@@ -32,12 +32,13 @@
#ifndef FLAC__PRIVATE__FIXED_H
#define FLAC__PRIVATE__FIXED_H
#include "FLAC/format.h"
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "private/float.h"
#include "FLAC/format.h"
/*
* FLAC__fixed_compute_best_predictor()
* --------------------------------------------------------------------
@@ -50,15 +51,15 @@
* IN data_len
* OUT residual_bits_per_sample[0,FLAC__MAX_FIXED_ORDER]
*/
unsigned FLAC__fixed_compute_best_predictor(const FLAC__int32 data[], unsigned data_len, FLAC__real residual_bits_per_sample[FLAC__MAX_FIXED_ORDER+1]);
unsigned FLAC__fixed_compute_best_predictor(const FLAC__int32 data[], unsigned data_len, FLAC__float residual_bits_per_sample[FLAC__MAX_FIXED_ORDER+1]);
#ifndef FLAC__NO_ASM
#ifdef FLAC__CPU_IA32
#ifdef FLAC__HAS_NASM
unsigned FLAC__fixed_compute_best_predictor_asm_ia32_mmx_cmov(const FLAC__int32 data[], unsigned data_len, FLAC__real residual_bits_per_sample[FLAC__MAX_FIXED_ORDER+1]);
unsigned FLAC__fixed_compute_best_predictor_asm_ia32_mmx_cmov(const FLAC__int32 data[], unsigned data_len, FLAC__float residual_bits_per_sample[FLAC__MAX_FIXED_ORDER+1]);
#endif
#endif
#endif
unsigned FLAC__fixed_compute_best_predictor_wide(const FLAC__int32 data[], unsigned data_len, FLAC__real residual_bits_per_sample[FLAC__MAX_FIXED_ORDER+1]);
unsigned FLAC__fixed_compute_best_predictor_wide(const FLAC__int32 data[], unsigned data_len, FLAC__float residual_bits_per_sample[FLAC__MAX_FIXED_ORDER+1]);
/*
* FLAC__fixed_compute_residual()

View File

@@ -32,12 +32,13 @@
#ifndef FLAC__PRIVATE__LPC_H
#define FLAC__PRIVATE__LPC_H
#include "FLAC/format.h"
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "private/float.h"
#include "FLAC/format.h"
/*
* FLAC__lpc_compute_autocorrelation()
* --------------------------------------------------------------------
@@ -81,7 +82,7 @@ void FLAC__lpc_compute_autocorrelation_asm_ia32_3dnow(const FLAC__real data[], u
* in lp_coeff[8][0,8], the LP coefficients for order 8 will be
* in lp_coeff[7][0,7], etc.
*/
void FLAC__lpc_compute_lp_coefficients(const FLAC__real autoc[], unsigned max_order, FLAC__real lp_coeff[][FLAC__MAX_LPC_ORDER], FLAC__real error[]);
void FLAC__lpc_compute_lp_coefficients(const FLAC__real autoc[], unsigned max_order, FLAC__real lp_coeff[][FLAC__MAX_LPC_ORDER], FLAC__double error[]);
/*
* FLAC__lpc_quantize_coefficients()
@@ -168,8 +169,8 @@ void FLAC__lpc_restore_signal_asm_ppc_altivec_16_order8(const FLAC__int32 residu
* IN total_samples > 0 # of samples in residual signal
* RETURN expected bits per sample
*/
FLAC__real FLAC__lpc_compute_expected_bits_per_residual_sample(FLAC__real lpc_error, unsigned total_samples);
FLAC__real FLAC__lpc_compute_expected_bits_per_residual_sample_with_error_scale(FLAC__real lpc_error, double error_scale);
FLAC__double FLAC__lpc_compute_expected_bits_per_residual_sample(FLAC__double lpc_error, unsigned total_samples);
FLAC__double FLAC__lpc_compute_expected_bits_per_residual_sample_with_error_scale(FLAC__double lpc_error, FLAC__double error_scale);
/*
* FLAC__lpc_compute_best_order()
@@ -183,6 +184,6 @@ FLAC__real FLAC__lpc_compute_expected_bits_per_residual_sample_with_error_scale(
* IN bits_per_signal_sample # of bits per sample in the original signal
* RETURN [1,max_order] best order
*/
unsigned FLAC__lpc_compute_best_order(const FLAC__real lpc_error[], unsigned max_order, unsigned total_samples, unsigned bits_per_signal_sample);
unsigned FLAC__lpc_compute_best_order(const FLAC__double lpc_error[], unsigned max_order, unsigned total_samples, unsigned bits_per_signal_sample);
#endif

View File

@@ -32,8 +32,13 @@
#ifndef FLAC__PRIVATE__MEMORY_H
#define FLAC__PRIVATE__MEMORY_H
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <stdlib.h> /* for size_t */
#include "private/float.h"
#include "FLAC/ordinals.h" /* for FLAC__bool */
/* Returns the unaligned address returned by malloc.