diff options
Diffstat (limited to 'lib/rbcodec/codecs/libopus/celt/bands.h')
-rw-r--r-- | lib/rbcodec/codecs/libopus/celt/bands.h | 95 |
1 files changed, 95 insertions, 0 deletions
diff --git a/lib/rbcodec/codecs/libopus/celt/bands.h b/lib/rbcodec/codecs/libopus/celt/bands.h new file mode 100644 index 0000000000..9ff8ffd7ba --- /dev/null +++ b/lib/rbcodec/codecs/libopus/celt/bands.h | |||
@@ -0,0 +1,95 @@ | |||
1 | /* Copyright (c) 2007-2008 CSIRO | ||
2 | Copyright (c) 2007-2009 Xiph.Org Foundation | ||
3 | Copyright (c) 2008-2009 Gregory Maxwell | ||
4 | Written by Jean-Marc Valin and Gregory Maxwell */ | ||
5 | /* | ||
6 | Redistribution and use in source and binary forms, with or without | ||
7 | modification, are permitted provided that the following conditions | ||
8 | are met: | ||
9 | |||
10 | - Redistributions of source code must retain the above copyright | ||
11 | notice, this list of conditions and the following disclaimer. | ||
12 | |||
13 | - Redistributions in binary form must reproduce the above copyright | ||
14 | notice, this list of conditions and the following disclaimer in the | ||
15 | documentation and/or other materials provided with the distribution. | ||
16 | |||
17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
18 | ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
19 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | ||
20 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER | ||
21 | OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | ||
22 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | ||
23 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | ||
24 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF | ||
25 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | ||
26 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
27 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
28 | */ | ||
29 | |||
30 | #ifndef BANDS_H | ||
31 | #define BANDS_H | ||
32 | |||
33 | #include "arch.h" | ||
34 | #include "modes.h" | ||
35 | #include "entenc.h" | ||
36 | #include "entdec.h" | ||
37 | #include "rate.h" | ||
38 | |||
39 | /** Compute the amplitude (sqrt energy) in each of the bands | ||
40 | * @param m Mode data | ||
41 | * @param X Spectrum | ||
42 | * @param bands Square root of the energy for each band (returned) | ||
43 | */ | ||
44 | void compute_band_energies(const CELTMode *m, const celt_sig *X, celt_ener *bandE, int end, int C, int M); | ||
45 | |||
46 | /*void compute_noise_energies(const CELTMode *m, const celt_sig *X, const opus_val16 *tonality, celt_ener *bandE);*/ | ||
47 | |||
48 | /** Normalise each band of X such that the energy in each band is | ||
49 | equal to 1 | ||
50 | * @param m Mode data | ||
51 | * @param X Spectrum (returned normalised) | ||
52 | * @param bands Square root of the energy for each band | ||
53 | */ | ||
54 | void normalise_bands(const CELTMode *m, const celt_sig * OPUS_RESTRICT freq, celt_norm * OPUS_RESTRICT X, const celt_ener *bandE, int end, int C, int M); | ||
55 | |||
56 | /** Denormalise each band of X to restore full amplitude | ||
57 | * @param m Mode data | ||
58 | * @param X Spectrum (returned de-normalised) | ||
59 | * @param bands Square root of the energy for each band | ||
60 | */ | ||
61 | void denormalise_bands(const CELTMode *m, const celt_norm * OPUS_RESTRICT X, celt_sig * OPUS_RESTRICT freq, const celt_ener *bandE, int end, int C, int M); | ||
62 | |||
63 | #define SPREAD_NONE (0) | ||
64 | #define SPREAD_LIGHT (1) | ||
65 | #define SPREAD_NORMAL (2) | ||
66 | #define SPREAD_AGGRESSIVE (3) | ||
67 | |||
68 | int spreading_decision(const CELTMode *m, celt_norm *X, int *average, | ||
69 | int last_decision, int *hf_average, int *tapset_decision, int update_hf, | ||
70 | int end, int C, int M); | ||
71 | |||
72 | #ifdef MEASURE_NORM_MSE | ||
73 | void measure_norm_mse(const CELTMode *m, float *X, float *X0, float *bandE, float *bandE0, int M, int N, int C); | ||
74 | #endif | ||
75 | |||
76 | void haar1(celt_norm *X, int N0, int stride); | ||
77 | |||
78 | /** Quantisation/encoding of the residual spectrum | ||
79 | * @param m Mode data | ||
80 | * @param X Residual (normalised) | ||
81 | * @param total_bits Total number of bits that can be used for the frame (including the ones already spent) | ||
82 | * @param enc Entropy encoder | ||
83 | */ | ||
84 | void quant_all_bands(int encode, const CELTMode *m, int start, int end, | ||
85 | celt_norm * X, celt_norm * Y, unsigned char *collapse_masks, const celt_ener *bandE, int *pulses, | ||
86 | int time_domain, int fold, int dual_stereo, int intensity, int *tf_res, | ||
87 | opus_int32 total_bits, opus_int32 balance, ec_ctx *ec, int M, int codedBands, opus_uint32 *seed); | ||
88 | |||
89 | void anti_collapse(const CELTMode *m, celt_norm *X_, unsigned char *collapse_masks, int LM, int C, int size, | ||
90 | int start, int end, opus_val16 *logE, opus_val16 *prev1logE, | ||
91 | opus_val16 *prev2logE, int *pulses, opus_uint32 seed); | ||
92 | |||
93 | opus_uint32 celt_lcg_rand(opus_uint32 seed); | ||
94 | |||
95 | #endif /* BANDS_H */ | ||