update copyright date to include 2002
[platform/upstream/flac.git] / src / libFLAC / include / private / fixed.h
1 /* libFLAC - Free Lossless Audio Codec library
2  * Copyright (C) 2000,2001,2002  Josh Coalson
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Library General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Library General Public License for more details.
13  *
14  * You should have received a copy of the GNU Library General Public
15  * License along with this library; if not, write to the
16  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17  * Boston, MA  02111-1307, USA.
18  */
19
20 #ifndef FLAC__PRIVATE__FIXED_H
21 #define FLAC__PRIVATE__FIXED_H
22
23 #include "FLAC/format.h"
24
25 /*
26  *      FLAC__fixed_compute_best_predictor()
27  *      --------------------------------------------------------------------
28  *      Compute the best fixed predictor and the expected bits-per-sample
29  *  of the residual signal for each order.  The _wide() version uses
30  *  64-bit integers which is statistically necessary when bits-per-
31  *  sample + log2(blocksize) > 30
32  *
33  *      IN data[0,data_len-1]
34  *      IN data_len
35  *      OUT residual_bits_per_sample[0,FLAC__MAX_FIXED_ORDER]
36  */
37 unsigned FLAC__fixed_compute_best_predictor(const FLAC__int32 data[], unsigned data_len, FLAC__real residual_bits_per_sample[FLAC__MAX_FIXED_ORDER+1]);
38 #ifndef FLAC__NO_ASM
39 #ifdef FLAC__CPU_IA32
40 #ifdef FLAC__HAS_NASM
41 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]);
42 #endif
43 #endif
44 #endif
45 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]);
46
47 /*
48  *      FLAC__fixed_compute_residual()
49  *      --------------------------------------------------------------------
50  *      Compute the residual signal obtained from sutracting the predicted
51  *      signal from the original.
52  *
53  *      IN data[-order,data_len-1]        original signal (NOTE THE INDICES!)
54  *      IN data_len                       length of original signal
55  *      IN order <= FLAC__MAX_FIXED_ORDER fixed-predictor order
56  *      OUT residual[0,data_len-1]        residual signal
57  */
58 void FLAC__fixed_compute_residual(const FLAC__int32 data[], unsigned data_len, unsigned order, FLAC__int32 residual[]);
59
60 /*
61  *      FLAC__fixed_restore_signal()
62  *      --------------------------------------------------------------------
63  *      Restore the original signal by summing the residual and the
64  *      predictor.
65  *
66  *      IN residual[0,data_len-1]         residual signal
67  *      IN data_len                       length of original signal
68  *      IN order <= FLAC__MAX_FIXED_ORDER fixed-predictor order
69  *      *** IMPORTANT: the caller must pass in the historical samples:
70  *      IN  data[-order,-1]               previously-reconstructed historical samples
71  *      OUT data[0,data_len-1]            original signal
72  */
73 void FLAC__fixed_restore_signal(const FLAC__int32 residual[], unsigned data_len, unsigned order, FLAC__int32 data[]);
74
75 #endif