OLD | NEW |
1 /* Copyright (c) 2007-2008 CSIRO | 1 /* Copyright (c) 2007-2008 CSIRO |
2 Copyright (c) 2007-2009 Xiph.Org Foundation | 2 Copyright (c) 2007-2009 Xiph.Org Foundation |
3 Copyright (c) 2008-2009 Gregory Maxwell | 3 Copyright (c) 2008-2009 Gregory Maxwell |
4 Written by Jean-Marc Valin and Gregory Maxwell */ | 4 Written by Jean-Marc Valin and Gregory Maxwell */ |
5 /* | 5 /* |
6 Redistribution and use in source and binary forms, with or without | 6 Redistribution and use in source and binary forms, with or without |
7 modification, are permitted provided that the following conditions | 7 modification, are permitted provided that the following conditions |
8 are met: | 8 are met: |
9 | 9 |
10 - Redistributions of source code must retain the above copyright | 10 - Redistributions of source code must retain the above copyright |
(...skipping 23 matching lines...) Expand all Loading... |
34 #include "modes.h" | 34 #include "modes.h" |
35 #include "entenc.h" | 35 #include "entenc.h" |
36 #include "entdec.h" | 36 #include "entdec.h" |
37 #include "rate.h" | 37 #include "rate.h" |
38 | 38 |
39 /** Compute the amplitude (sqrt energy) in each of the bands | 39 /** Compute the amplitude (sqrt energy) in each of the bands |
40 * @param m Mode data | 40 * @param m Mode data |
41 * @param X Spectrum | 41 * @param X Spectrum |
42 * @param bandE Square root of the energy for each band (returned) | 42 * @param bandE Square root of the energy for each band (returned) |
43 */ | 43 */ |
44 void compute_band_energies(const CELTMode *m, const celt_sig *X, celt_ener *band
E, int end, int C, int M); | 44 void compute_band_energies(const CELTMode *m, const celt_sig *X, celt_ener *band
E, int end, int C, int LM); |
45 | 45 |
46 /*void compute_noise_energies(const CELTMode *m, const celt_sig *X, const opus_v
al16 *tonality, celt_ener *bandE);*/ | 46 /*void compute_noise_energies(const CELTMode *m, const celt_sig *X, const opus_v
al16 *tonality, celt_ener *bandE);*/ |
47 | 47 |
48 /** Normalise each band of X such that the energy in each band is | 48 /** Normalise each band of X such that the energy in each band is |
49 equal to 1 | 49 equal to 1 |
50 * @param m Mode data | 50 * @param m Mode data |
51 * @param X Spectrum (returned normalised) | 51 * @param X Spectrum (returned normalised) |
52 * @param bandE Square root of the energy for each band | 52 * @param bandE Square root of the energy for each band |
53 */ | 53 */ |
54 void normalise_bands(const CELTMode *m, const celt_sig * OPUS_RESTRICT freq, cel
t_norm * OPUS_RESTRICT X, const celt_ener *bandE, int end, int C, int M); | 54 void normalise_bands(const CELTMode *m, const celt_sig * OPUS_RESTRICT freq, cel
t_norm * OPUS_RESTRICT X, const celt_ener *bandE, int end, int C, int M); |
55 | 55 |
56 /** Denormalise each band of X to restore full amplitude | 56 /** Denormalise each band of X to restore full amplitude |
57 * @param m Mode data | 57 * @param m Mode data |
58 * @param X Spectrum (returned de-normalised) | 58 * @param X Spectrum (returned de-normalised) |
59 * @param bandE Square root of the energy for each band | 59 * @param bandE Square root of the energy for each band |
60 */ | 60 */ |
61 void denormalise_bands(const CELTMode *m, const celt_norm * OPUS_RESTRICT X, | 61 void denormalise_bands(const CELTMode *m, const celt_norm * OPUS_RESTRICT X, |
62 celt_sig * OPUS_RESTRICT freq, const opus_val16 *bandE, int start, int end
, int C, int M); | 62 celt_sig * OPUS_RESTRICT freq, const opus_val16 *bandE, int start, |
| 63 int end, int M, int downsample, int silence); |
63 | 64 |
64 #define SPREAD_NONE (0) | 65 #define SPREAD_NONE (0) |
65 #define SPREAD_LIGHT (1) | 66 #define SPREAD_LIGHT (1) |
66 #define SPREAD_NORMAL (2) | 67 #define SPREAD_NORMAL (2) |
67 #define SPREAD_AGGRESSIVE (3) | 68 #define SPREAD_AGGRESSIVE (3) |
68 | 69 |
69 int spreading_decision(const CELTMode *m, celt_norm *X, int *average, | 70 int spreading_decision(const CELTMode *m, const celt_norm *X, int *average, |
70 int last_decision, int *hf_average, int *tapset_decision, int update_hf, | 71 int last_decision, int *hf_average, int *tapset_decision, int update_hf, |
71 int end, int C, int M); | 72 int end, int C, int M); |
72 | 73 |
73 #ifdef MEASURE_NORM_MSE | 74 #ifdef MEASURE_NORM_MSE |
74 void measure_norm_mse(const CELTMode *m, float *X, float *X0, float *bandE, floa
t *bandE0, int M, int N, int C); | 75 void measure_norm_mse(const CELTMode *m, float *X, float *X0, float *bandE, floa
t *bandE0, int M, int N, int C); |
75 #endif | 76 #endif |
76 | 77 |
77 void haar1(celt_norm *X, int N0, int stride); | 78 void haar1(celt_norm *X, int N0, int stride); |
78 | 79 |
79 /** Quantisation/encoding of the residual spectrum | 80 /** Quantisation/encoding of the residual spectrum |
(...skipping 10 matching lines...) Expand all Loading... |
90 * @param spread Amount of spreading to use | 91 * @param spread Amount of spreading to use |
91 * @param dual_stereo Zero for MS stereo, non-zero for dual stereo | 92 * @param dual_stereo Zero for MS stereo, non-zero for dual stereo |
92 * @param intensity First band to use intensity stereo | 93 * @param intensity First band to use intensity stereo |
93 * @param tf_res Time-frequency resolution change | 94 * @param tf_res Time-frequency resolution change |
94 * @param total_bits Total number of bits that can be used for the frame (includ
ing the ones already spent) | 95 * @param total_bits Total number of bits that can be used for the frame (includ
ing the ones already spent) |
95 * @param balance Number of unallocated bits | 96 * @param balance Number of unallocated bits |
96 * @param en Entropy coder state | 97 * @param en Entropy coder state |
97 * @param LM log2() of the number of 2.5 subframes in the frame | 98 * @param LM log2() of the number of 2.5 subframes in the frame |
98 * @param codedBands Last band to receive bits + 1 | 99 * @param codedBands Last band to receive bits + 1 |
99 * @param seed Random generator seed | 100 * @param seed Random generator seed |
| 101 * @param arch Run-time architecture (see opus_select_arch()) |
100 */ | 102 */ |
101 void quant_all_bands(int encode, const CELTMode *m, int start, int end, | 103 void quant_all_bands(int encode, const CELTMode *m, int start, int end, |
102 celt_norm * X, celt_norm * Y, unsigned char *collapse_masks, const celt_en
er *bandE, int *pulses, | 104 celt_norm * X, celt_norm * Y, unsigned char *collapse_masks, |
103 int shortBlocks, int spread, int dual_stereo, int intensity, int *tf_res, | 105 const celt_ener *bandE, int *pulses, int shortBlocks, int spread, |
104 opus_int32 total_bits, opus_int32 balance, ec_ctx *ec, int M, int codedBan
ds, opus_uint32 *seed); | 106 int dual_stereo, int intensity, int *tf_res, opus_int32 total_bits, |
| 107 opus_int32 balance, ec_ctx *ec, int M, int codedBands, opus_uint32 *seed, |
| 108 int arch); |
105 | 109 |
106 void anti_collapse(const CELTMode *m, celt_norm *X_, unsigned char *collapse_mas
ks, int LM, int C, int size, | 110 void anti_collapse(const CELTMode *m, celt_norm *X_, |
107 int start, int end, opus_val16 *logE, opus_val16 *prev1logE, | 111 unsigned char *collapse_masks, int LM, int C, int size, int start, |
108 opus_val16 *prev2logE, int *pulses, opus_uint32 seed); | 112 int end, const opus_val16 *logE, const opus_val16 *prev1logE, |
| 113 const opus_val16 *prev2logE, const int *pulses, opus_uint32 seed, |
| 114 int arch); |
109 | 115 |
110 opus_uint32 celt_lcg_rand(opus_uint32 seed); | 116 opus_uint32 celt_lcg_rand(opus_uint32 seed); |
111 | 117 |
112 int hysteresis_decision(opus_val16 val, const opus_val16 *thresholds, const opus
_val16 *hysteresis, int N, int prev); | 118 int hysteresis_decision(opus_val16 val, const opus_val16 *thresholds, const opus
_val16 *hysteresis, int N, int prev); |
113 | 119 |
114 #endif /* BANDS_H */ | 120 #endif /* BANDS_H */ |
OLD | NEW |