| OLD | NEW |
| 1 /* libFLAC - Free Lossless Audio Codec library | 1 /* libFLAC - Free Lossless Audio Codec library |
| 2 * Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007 Josh Coalson | 2 * Copyright (C) 2000-2009 Josh Coalson |
| 3 * Copyright (C) 2011-2014 Xiph.Org Foundation |
| 3 * | 4 * |
| 4 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 6 * are met: | 7 * are met: |
| 7 * | 8 * |
| 8 * - Redistributions of source code must retain the above copyright | 9 * - Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| 10 * | 11 * |
| 11 * - Redistributions in binary form must reproduce the above copyright | 12 * - Redistributions in binary form must reproduce the above copyright |
| 12 * notice, this list of conditions and the following disclaimer in the | 13 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 16 matching lines...) Expand all Loading... |
| 29 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 30 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 30 */ | 31 */ |
| 31 | 32 |
| 32 #ifndef FLAC__PRIVATE__LPC_H | 33 #ifndef FLAC__PRIVATE__LPC_H |
| 33 #define FLAC__PRIVATE__LPC_H | 34 #define FLAC__PRIVATE__LPC_H |
| 34 | 35 |
| 35 #ifdef HAVE_CONFIG_H | 36 #ifdef HAVE_CONFIG_H |
| 36 #include <config.h> | 37 #include <config.h> |
| 37 #endif | 38 #endif |
| 38 | 39 |
| 40 #include "private/cpu.h" |
| 39 #include "private/float.h" | 41 #include "private/float.h" |
| 40 #include "FLAC/format.h" | 42 #include "FLAC/format.h" |
| 41 | 43 |
| 42 #ifndef FLAC__INTEGER_ONLY_LIBRARY | 44 #ifndef FLAC__INTEGER_ONLY_LIBRARY |
| 43 | 45 |
| 44 /* | 46 /* |
| 45 * FLAC__lpc_window_data() | 47 * FLAC__lpc_window_data() |
| 46 * -------------------------------------------------------------------- | 48 * -------------------------------------------------------------------- |
| 47 * Applies the given window to the data. | 49 * Applies the given window to the data. |
| 48 * OPT: asm implementation | 50 * OPT: asm implementation |
| (...skipping 18 matching lines...) Expand all Loading... |
| 67 * OUT autoc[0,lag-1] | 69 * OUT autoc[0,lag-1] |
| 68 */ | 70 */ |
| 69 void FLAC__lpc_compute_autocorrelation(const FLAC__real data[], unsigned data_le
n, unsigned lag, FLAC__real autoc[]); | 71 void FLAC__lpc_compute_autocorrelation(const FLAC__real data[], unsigned data_le
n, unsigned lag, FLAC__real autoc[]); |
| 70 #ifndef FLAC__NO_ASM | 72 #ifndef FLAC__NO_ASM |
| 71 # ifdef FLAC__CPU_IA32 | 73 # ifdef FLAC__CPU_IA32 |
| 72 # ifdef FLAC__HAS_NASM | 74 # ifdef FLAC__HAS_NASM |
| 73 void FLAC__lpc_compute_autocorrelation_asm_ia32(const FLAC__real data[], unsigne
d data_len, unsigned lag, FLAC__real autoc[]); | 75 void FLAC__lpc_compute_autocorrelation_asm_ia32(const FLAC__real data[], unsigne
d data_len, unsigned lag, FLAC__real autoc[]); |
| 74 void FLAC__lpc_compute_autocorrelation_asm_ia32_sse_lag_4(const FLAC__real data[
], unsigned data_len, unsigned lag, FLAC__real autoc[]); | 76 void FLAC__lpc_compute_autocorrelation_asm_ia32_sse_lag_4(const FLAC__real data[
], unsigned data_len, unsigned lag, FLAC__real autoc[]); |
| 75 void FLAC__lpc_compute_autocorrelation_asm_ia32_sse_lag_8(const FLAC__real data[
], unsigned data_len, unsigned lag, FLAC__real autoc[]); | 77 void FLAC__lpc_compute_autocorrelation_asm_ia32_sse_lag_8(const FLAC__real data[
], unsigned data_len, unsigned lag, FLAC__real autoc[]); |
| 76 void FLAC__lpc_compute_autocorrelation_asm_ia32_sse_lag_12(const FLAC__real data
[], unsigned data_len, unsigned lag, FLAC__real autoc[]); | 78 void FLAC__lpc_compute_autocorrelation_asm_ia32_sse_lag_12(const FLAC__real data
[], unsigned data_len, unsigned lag, FLAC__real autoc[]); |
| 77 void FLAC__lpc_compute_autocorrelation_asm_ia32_3dnow(const FLAC__real data[], u
nsigned data_len, unsigned lag, FLAC__real autoc[]); | 79 void FLAC__lpc_compute_autocorrelation_asm_ia32_sse_lag_16(const FLAC__real data
[], unsigned data_len, unsigned lag, FLAC__real autoc[]); |
| 80 # endif |
| 81 # endif |
| 82 # if (defined FLAC__CPU_IA32 || defined FLAC__CPU_X86_64) && defined FLAC__HAS_
X86INTRIN |
| 83 # ifdef FLAC__SSE_SUPPORTED |
| 84 void FLAC__lpc_compute_autocorrelation_intrin_sse_lag_4(const FLAC__real data[],
unsigned data_len, unsigned lag, FLAC__real autoc[]); |
| 85 void FLAC__lpc_compute_autocorrelation_intrin_sse_lag_8(const FLAC__real data[],
unsigned data_len, unsigned lag, FLAC__real autoc[]); |
| 86 void FLAC__lpc_compute_autocorrelation_intrin_sse_lag_12(const FLAC__real data[]
, unsigned data_len, unsigned lag, FLAC__real autoc[]); |
| 87 void FLAC__lpc_compute_autocorrelation_intrin_sse_lag_16(const FLAC__real data[]
, unsigned data_len, unsigned lag, FLAC__real autoc[]); |
| 78 # endif | 88 # endif |
| 79 # endif | 89 # endif |
| 80 #endif | 90 #endif |
| 81 | 91 |
| 82 /* | 92 /* |
| 83 * FLAC__lpc_compute_lp_coefficients() | 93 * FLAC__lpc_compute_lp_coefficients() |
| 84 * -------------------------------------------------------------------- | 94 * -------------------------------------------------------------------- |
| 85 * Computes LP coefficients for orders 1..max_order. | 95 * Computes LP coefficients for orders 1..max_order. |
| 86 * Do not call if autoc[0] == 0.0. This means the signal is zero | 96 * Do not call if autoc[0] == 0.0. This means the signal is zero |
| 87 * and there is no point in calculating a predictor. | 97 * and there is no point in calculating a predictor. |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 * IN lp_quantization quantization of LP coefficients in bits | 147 * IN lp_quantization quantization of LP coefficients in bits |
| 138 * OUT residual[0,data_len-1] residual signal | 148 * OUT residual[0,data_len-1] residual signal |
| 139 */ | 149 */ |
| 140 void FLAC__lpc_compute_residual_from_qlp_coefficients(const FLAC__int32 *data, u
nsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_quantiza
tion, FLAC__int32 residual[]); | 150 void FLAC__lpc_compute_residual_from_qlp_coefficients(const FLAC__int32 *data, u
nsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_quantiza
tion, FLAC__int32 residual[]); |
| 141 void FLAC__lpc_compute_residual_from_qlp_coefficients_wide(const FLAC__int32 *da
ta, unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_qua
ntization, FLAC__int32 residual[]); | 151 void FLAC__lpc_compute_residual_from_qlp_coefficients_wide(const FLAC__int32 *da
ta, unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_qua
ntization, FLAC__int32 residual[]); |
| 142 #ifndef FLAC__NO_ASM | 152 #ifndef FLAC__NO_ASM |
| 143 # ifdef FLAC__CPU_IA32 | 153 # ifdef FLAC__CPU_IA32 |
| 144 # ifdef FLAC__HAS_NASM | 154 # ifdef FLAC__HAS_NASM |
| 145 void FLAC__lpc_compute_residual_from_qlp_coefficients_asm_ia32(const FLAC__int32
*data, unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp
_quantization, FLAC__int32 residual[]); | 155 void FLAC__lpc_compute_residual_from_qlp_coefficients_asm_ia32(const FLAC__int32
*data, unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp
_quantization, FLAC__int32 residual[]); |
| 146 void FLAC__lpc_compute_residual_from_qlp_coefficients_asm_ia32_mmx(const FLAC__i
nt32 *data, unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, in
t lp_quantization, FLAC__int32 residual[]); | 156 void FLAC__lpc_compute_residual_from_qlp_coefficients_asm_ia32_mmx(const FLAC__i
nt32 *data, unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, in
t lp_quantization, FLAC__int32 residual[]); |
| 157 void FLAC__lpc_compute_residual_from_qlp_coefficients_wide_asm_ia32(const FLAC__
int32 *data, unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, i
nt lp_quantization, FLAC__int32 residual[]); |
| 158 # endif |
| 159 # endif |
| 160 # if (defined FLAC__CPU_IA32 || defined FLAC__CPU_X86_64) && defined FLAC__HAS_
X86INTRIN |
| 161 # ifdef FLAC__SSE2_SUPPORTED |
| 162 void FLAC__lpc_compute_residual_from_qlp_coefficients_16_intrin_sse2(const FLAC_
_int32 *data, unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order,
int lp_quantization, FLAC__int32 residual[]); |
| 163 void FLAC__lpc_compute_residual_from_qlp_coefficients_intrin_sse2(const FLAC__in
t32 *data, unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, int
lp_quantization, FLAC__int32 residual[]); |
| 164 # endif |
| 165 # ifdef FLAC__SSE4_1_SUPPORTED |
| 166 void FLAC__lpc_compute_residual_from_qlp_coefficients_intrin_sse41(const FLAC__i
nt32 *data, unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, in
t lp_quantization, FLAC__int32 residual[]); |
| 167 void FLAC__lpc_compute_residual_from_qlp_coefficients_wide_intrin_sse41(const FL
AC__int32 *data, unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned orde
r, int lp_quantization, FLAC__int32 residual[]); |
| 168 # endif |
| 169 # ifdef FLAC__AVX2_SUPPORTED |
| 170 void FLAC__lpc_compute_residual_from_qlp_coefficients_16_intrin_avx2(const FLAC_
_int32 *data, unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order,
int lp_quantization, FLAC__int32 residual[]); |
| 171 void FLAC__lpc_compute_residual_from_qlp_coefficients_intrin_avx2(const FLAC__in
t32 *data, unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, int
lp_quantization, FLAC__int32 residual[]); |
| 172 void FLAC__lpc_compute_residual_from_qlp_coefficients_wide_intrin_avx2(const FLA
C__int32 *data, unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order
, int lp_quantization, FLAC__int32 residual[]); |
| 147 # endif | 173 # endif |
| 148 # endif | 174 # endif |
| 149 #endif | 175 #endif |
| 150 | 176 |
| 151 #endif /* !defined FLAC__INTEGER_ONLY_LIBRARY */ | 177 #endif /* !defined FLAC__INTEGER_ONLY_LIBRARY */ |
| 152 | 178 |
| 153 /* | 179 /* |
| 154 * FLAC__lpc_restore_signal() | 180 * FLAC__lpc_restore_signal() |
| 155 * -------------------------------------------------------------------- | 181 * -------------------------------------------------------------------- |
| 156 * Restore the original signal by summing the residual and the | 182 * Restore the original signal by summing the residual and the |
| 157 * predictor. | 183 * predictor. |
| 158 * | 184 * |
| 159 * IN residual[0,data_len-1] residual signal | 185 * IN residual[0,data_len-1] residual signal |
| 160 * IN data_len length of original signal | 186 * IN data_len length of original signal |
| 161 * IN qlp_coeff[0,order-1] quantized LP coefficients | 187 * IN qlp_coeff[0,order-1] quantized LP coefficients |
| 162 * IN order > 0 LP order | 188 * IN order > 0 LP order |
| 163 * IN lp_quantization quantization of LP coefficients in bits | 189 * IN lp_quantization quantization of LP coefficients in bits |
| 164 * *** IMPORTANT: the caller must pass in the historical samples: | 190 * *** IMPORTANT: the caller must pass in the historical samples: |
| 165 * IN data[-order,-1] previously-reconstructed historical samples | 191 * IN data[-order,-1] previously-reconstructed historical samples |
| 166 * OUT data[0,data_len-1] original signal | 192 * OUT data[0,data_len-1] original signal |
| 167 */ | 193 */ |
| 168 void FLAC__lpc_restore_signal(const FLAC__int32 residual[], unsigned data_len, c
onst FLAC__int32 qlp_coeff[], unsigned order, int lp_quantization, FLAC__int32 d
ata[]); | 194 void FLAC__lpc_restore_signal(const FLAC__int32 residual[], unsigned data_len, c
onst FLAC__int32 qlp_coeff[], unsigned order, int lp_quantization, FLAC__int32 d
ata[]); |
| 169 void FLAC__lpc_restore_signal_wide(const FLAC__int32 residual[], unsigned data_l
en, const FLAC__int32 qlp_coeff[], unsigned order, int lp_quantization, FLAC__in
t32 data[]); | 195 void FLAC__lpc_restore_signal_wide(const FLAC__int32 residual[], unsigned data_l
en, const FLAC__int32 qlp_coeff[], unsigned order, int lp_quantization, FLAC__in
t32 data[]); |
| 170 #ifndef FLAC__NO_ASM | 196 #ifndef FLAC__NO_ASM |
| 171 # ifdef FLAC__CPU_IA32 | 197 # ifdef FLAC__CPU_IA32 |
| 172 # ifdef FLAC__HAS_NASM | 198 # ifdef FLAC__HAS_NASM |
| 173 void FLAC__lpc_restore_signal_asm_ia32(const FLAC__int32 residual[], unsigned da
ta_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_quantization, FLAC
__int32 data[]); | 199 void FLAC__lpc_restore_signal_asm_ia32(const FLAC__int32 residual[], unsigned da
ta_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_quantization, FLAC
__int32 data[]); |
| 174 void FLAC__lpc_restore_signal_asm_ia32_mmx(const FLAC__int32 residual[], unsigne
d data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_quantization,
FLAC__int32 data[]); | 200 void FLAC__lpc_restore_signal_asm_ia32_mmx(const FLAC__int32 residual[], unsigne
d data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_quantization,
FLAC__int32 data[]); |
| 201 void FLAC__lpc_restore_signal_wide_asm_ia32(const FLAC__int32 residual[], unsign
ed data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_quantization,
FLAC__int32 data[]); |
| 175 # endif /* FLAC__HAS_NASM */ | 202 # endif /* FLAC__HAS_NASM */ |
| 176 # elif defined FLAC__CPU_PPC | 203 # endif /* FLAC__CPU_IA32 */ |
| 177 void FLAC__lpc_restore_signal_asm_ppc_altivec_16(const FLAC__int32 residual[], u
nsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_quantiza
tion, FLAC__int32 data[]); | 204 # if (defined FLAC__CPU_IA32 || defined FLAC__CPU_X86_64) && defined FLAC__HAS_
X86INTRIN |
| 178 void FLAC__lpc_restore_signal_asm_ppc_altivec_16_order8(const FLAC__int32 residu
al[], unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_q
uantization, FLAC__int32 data[]); | 205 # ifdef FLAC__SSE2_SUPPORTED |
| 179 # endif/* FLAC__CPU_IA32 || FLAC__CPU_PPC */ | 206 void FLAC__lpc_restore_signal_16_intrin_sse2(const FLAC__int32 residual[], unsig
ned data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_quantization
, FLAC__int32 data[]); |
| 207 # endif |
| 208 # ifdef FLAC__SSE4_1_SUPPORTED |
| 209 void FLAC__lpc_restore_signal_wide_intrin_sse41(const FLAC__int32 residual[], un
signed data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_quantizat
ion, FLAC__int32 data[]); |
| 210 # endif |
| 211 # endif |
| 180 #endif /* FLAC__NO_ASM */ | 212 #endif /* FLAC__NO_ASM */ |
| 181 | 213 |
| 182 #ifndef FLAC__INTEGER_ONLY_LIBRARY | 214 #ifndef FLAC__INTEGER_ONLY_LIBRARY |
| 183 | 215 |
| 184 /* | 216 /* |
| 185 * FLAC__lpc_compute_expected_bits_per_residual_sample() | 217 * FLAC__lpc_compute_expected_bits_per_residual_sample() |
| 186 * -------------------------------------------------------------------- | 218 * -------------------------------------------------------------------- |
| 187 * Compute the expected number of bits per residual signal sample | 219 * Compute the expected number of bits per residual signal sample |
| 188 * based on the LP error (which is related to the residual variance). | 220 * based on the LP error (which is related to the residual variance). |
| 189 * | 221 * |
| (...skipping 15 matching lines...) Expand all Loading... |
| 205 * IN total_samples > 0 # of samples in residual signal | 237 * IN total_samples > 0 # of samples in residual signal |
| 206 * IN overhead_bits_per_order # of bits overhead for each increase
d LP order | 238 * IN overhead_bits_per_order # of bits overhead for each increase
d LP order |
| 207 * (includes warmup sample size and qua
ntized LP coefficient) | 239 * (includes warmup sample size and qua
ntized LP coefficient) |
| 208 * RETURN [1,max_order] best order | 240 * RETURN [1,max_order] best order |
| 209 */ | 241 */ |
| 210 unsigned FLAC__lpc_compute_best_order(const FLAC__double lpc_error[], unsigned m
ax_order, unsigned total_samples, unsigned overhead_bits_per_order); | 242 unsigned FLAC__lpc_compute_best_order(const FLAC__double lpc_error[], unsigned m
ax_order, unsigned total_samples, unsigned overhead_bits_per_order); |
| 211 | 243 |
| 212 #endif /* !defined FLAC__INTEGER_ONLY_LIBRARY */ | 244 #endif /* !defined FLAC__INTEGER_ONLY_LIBRARY */ |
| 213 | 245 |
| 214 #endif | 246 #endif |
| OLD | NEW |