diff options
author | Nils Wallménius <nils@rockbox.org> | 2013-05-20 22:25:57 +0200 |
---|---|---|
committer | Nils Wallménius <nils@rockbox.org> | 2013-08-31 08:30:51 +0200 |
commit | 580b307fd791c0997a8831bc800bba87797bfb7e (patch) | |
tree | 807846056f06fd944a750ce41217a877910ebd59 /lib/rbcodec/codecs/libopus/celt/bands.h | |
parent | 74761b70acd96cecc0d35450dd56a98ad9ee7d3d (diff) | |
download | rockbox-580b307fd791c0997a8831bc800bba87797bfb7e.tar.gz rockbox-580b307fd791c0997a8831bc800bba87797bfb7e.zip |
Sync opus codec to upstream git
Sync opus codec to upstream commit
02fed471a4568852d6618e041c4f2af0d7730ee2 (August 30 2013)
This brings in a lot of optimizations but also makes the diff
between our codec and the upstream much smaller as most of our
optimizations have been upstreamed or supeceded.
Speedups across the board for CELT mode files:
64kbps 128kbps
H300 9.82MHz 15.48MHz
c200 4.86MHz 9.63MHz
fuze v1 10.32MHz 15.92MHz
For the silk mode test file (16kbps) arm targets get a speedup
of about 2MHz while the H300 is 7.8MHz slower, likely because it's
now using the pseudostack more rather than the real stack which
is in iram. Patches to get around that are upcomming.
Change-Id: Ifecf963e461c51ac42e09dac1e91bc4bc3b12fa3
Diffstat (limited to 'lib/rbcodec/codecs/libopus/celt/bands.h')
-rw-r--r-- | lib/rbcodec/codecs/libopus/celt/bands.h | 31 |
1 files changed, 25 insertions, 6 deletions
diff --git a/lib/rbcodec/codecs/libopus/celt/bands.h b/lib/rbcodec/codecs/libopus/celt/bands.h index 9ff8ffd7ba..96ba52a649 100644 --- a/lib/rbcodec/codecs/libopus/celt/bands.h +++ b/lib/rbcodec/codecs/libopus/celt/bands.h | |||
@@ -39,7 +39,7 @@ | |||
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 bands 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 *bandE, int end, int C, int M); | 44 | void compute_band_energies(const CELTMode *m, const celt_sig *X, celt_ener *bandE, int end, int C, int M); |
45 | 45 | ||
@@ -49,16 +49,17 @@ void compute_band_energies(const CELTMode *m, const celt_sig *X, celt_ener *band | |||
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 bands 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, celt_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, celt_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 bands 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, celt_sig * OPUS_RESTRICT freq, const celt_ener *bandE, int end, int C, int M); | 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 | 63 | ||
63 | #define SPREAD_NONE (0) | 64 | #define SPREAD_NONE (0) |
64 | #define SPREAD_LIGHT (1) | 65 | #define SPREAD_LIGHT (1) |
@@ -76,14 +77,30 @@ void measure_norm_mse(const CELTMode *m, float *X, float *X0, float *bandE, floa | |||
76 | void haar1(celt_norm *X, int N0, int stride); | 77 | void haar1(celt_norm *X, int N0, int stride); |
77 | 78 | ||
78 | /** Quantisation/encoding of the residual spectrum | 79 | /** Quantisation/encoding of the residual spectrum |
80 | * @param encode flag that indicates whether we're encoding (1) or decoding (0) | ||
79 | * @param m Mode data | 81 | * @param m Mode data |
82 | * @param start First band to process | ||
83 | * @param end Last band to process + 1 | ||
80 | * @param X Residual (normalised) | 84 | * @param X Residual (normalised) |
85 | * @param Y Residual (normalised) for second channel (or NULL for mono) | ||
86 | * @param collapse_masks Anti-collapse tracking mask | ||
87 | * @param bandE Square root of the energy for each band | ||
88 | * @param pulses Bit allocation (per band) for PVQ | ||
89 | * @param shortBlocks Zero for long blocks, non-zero for short blocks | ||
90 | * @param spread Amount of spreading to use | ||
91 | * @param dual_stereo Zero for MS stereo, non-zero for dual stereo | ||
92 | * @param intensity First band to use intensity stereo | ||
93 | * @param tf_res Time-frequency resolution change | ||
81 | * @param total_bits Total number of bits that can be used for the frame (including the ones already spent) | 94 | * @param total_bits Total number of bits that can be used for the frame (including the ones already spent) |
82 | * @param enc Entropy encoder | 95 | * @param balance Number of unallocated bits |
96 | * @param en Entropy coder state | ||
97 | * @param LM log2() of the number of 2.5 subframes in the frame | ||
98 | * @param codedBands Last band to receive bits + 1 | ||
99 | * @param seed Random generator seed | ||
83 | */ | 100 | */ |
84 | void quant_all_bands(int encode, const CELTMode *m, int start, int end, | 101 | 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, | 102 | 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, | 103 | int shortBlocks, int spread, 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); | 104 | opus_int32 total_bits, opus_int32 balance, ec_ctx *ec, int M, int codedBands, opus_uint32 *seed); |
88 | 105 | ||
89 | void anti_collapse(const CELTMode *m, celt_norm *X_, unsigned char *collapse_masks, int LM, int C, int size, | 106 | void anti_collapse(const CELTMode *m, celt_norm *X_, unsigned char *collapse_masks, int LM, int C, int size, |
@@ -92,4 +109,6 @@ void anti_collapse(const CELTMode *m, celt_norm *X_, unsigned char *collapse_mas | |||
92 | 109 | ||
93 | opus_uint32 celt_lcg_rand(opus_uint32 seed); | 110 | opus_uint32 celt_lcg_rand(opus_uint32 seed); |
94 | 111 | ||
112 | int hysteresis_decision(opus_val16 val, const opus_val16 *thresholds, const opus_val16 *hysteresis, int N, int prev); | ||
113 | |||
95 | #endif /* BANDS_H */ | 114 | #endif /* BANDS_H */ |