Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion celt/bands.c
Original file line number Diff line number Diff line change
Expand Up @@ -937,7 +937,7 @@ static unsigned oaci_quant_partition(struct band_ctx *ctx, celt_norm *X,

/* If we need 1.5 more bit than we can produce, split the band in two. */
cache = m->cache.bits + m->cache.index[N];
if (LM != -1 && b > (cache[0] << BITRES) + 12 && N > 2) {
if (b > (cache[0] << BITRES) + 12 && N > 2 && (N & 1) == 0) {
int mbits, sbits, delta;
int itheta;
struct split_ctx sctx;
Expand Down
4 changes: 1 addition & 3 deletions celt/cwrs.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,7 @@
#include "mathops.h"
#include "arch.h"

#if defined(CUSTOM_MODES)
# define CWRS_EXTRA_ROWS
#endif
#define CWRS_EXTRA_ROWS

#if defined(CUSTOM_MODES)

Expand Down
2 changes: 1 addition & 1 deletion celt/modes.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@

static const oac_int16 eband5ms[] = {
/*0 200 400 600 800 1k 1.2 1.4 1.6 2k 2.4 2.8 3.2 4k 4.8 5.6 6.8 8k 9.6 12k 15.6 */
0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 12, 14, 16, 20, 24, 28, 34, 40, 48, 60, 78, 100
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this fix a long-standing typo or is there an advantage to switching to a 16-bin band?

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, I think I understand, this would allow the band to be split up to four times. Useful for high frequency tones?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct, the new bands are 16 and 24 wide instead of 18 and 22, so they can split much deeper.

0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 12, 14, 16, 20, 24, 28, 34, 40, 48, 60, 76, 100
};

/* Alternate tuning (partially derived from Vorbis) */
Expand Down
6 changes: 4 additions & 2 deletions celt/rate.c
Original file line number Diff line number Diff line change
Expand Up @@ -192,8 +192,10 @@ void oaci_compute_pulse_cache(CELTMode *m, int LM) {
/* Even-sized bands bigger than N=2 can be split one more time.
As of commit 44203907 all bands >1 are even, including custom modes.*/
if (N0 > 2) {
N0 >>= 1;
LM0--;
while ((N0 & 1) == 0 && N0 > 2) {
N0 >>= 1;
LM0--;
}
}
/* N0=1 bands can't be split down to N<2. */
else if (N0 <= 1) {
Expand Down
132 changes: 50 additions & 82 deletions celt/static_modes_fixed.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,25 +42,26 @@ static const celt_coef window120[120] = {
#ifndef DEF_LOGN400
# define DEF_LOGN400
static const oac_int16 logN400[21] = {
0, 0, 0, 0, 0, 0, 0, 0, 8, 8, 8, 8, 16, 16, 16, 21, 21, 24, 29, 34, 36, };
0, 0, 0, 0, 0, 0, 0, 0, 8, 8, 8, 8, 16, 16, 16, 21, 21, 24, 29, 32, 37, };
#endif

#ifndef DEF_PULSE_CACHE50
# define DEF_PULSE_CACHE50
static const oac_int16 cache_index50[177] = {
-1, 67, 57, 262, 33, -1, 229, -1, 0, 464, -1, 621, 197, -1, -1,
-1, 69, -1, 431, -1, -1, -1, 589, -1, 164, -1, -1, -1, -1, -1,
-1, -1, 102, -1, -1, -1, 399, -1, -1, -1, -1, -1, -1, -1, 559,
static const oac_int16 cache_index50[193] = {
-1, 67, 57, 262, 33, -1, 229, -1, 0, -1, -1, -1, 197, -1, -1,
-1, 69, -1, -1, -1, -1, -1, -1, -1, 164, -1, -1, -1, -1, -1,
-1, -1, 102, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, 133, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, 279, -1, -1, -1, -1, -1, -1, -1, 369, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 527, -1,
-1, -1, -1, -1, 279, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, 308, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, 340, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, 340, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 497, };
static const unsigned char cache_bits50[653] = {
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 369, };
static const unsigned char cache_bits50[400] = {
32, 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 4, 4, 5, 5,
6, 7, 8, 9, 10, 11, 12, 13, 15, 16, 17, 18, 19, 20, 21,
23, 24, 25, 23, 0, 1, 1, 1, 2, 3, 3, 4, 6, 7, 9,
Expand All @@ -85,39 +86,22 @@ static const unsigned char cache_bits50[653] = {
1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3,
3, 3, 4, 4, 4, 4, 4, 5, 5, 5, 28, 0, 0, 0, 0,
1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 3,
3, 3, 3, 3, 3, 3, 4, 4, 4, 29, 0, 0, 0, 1, 1,
1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3,
3, 4, 4, 4, 4, 4, 5, 5, 5, 31, 0, 0, 0, 1, 1,
1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4,
4, 4, 5, 5, 5, 6, 6, 6, 6, 7, 7, 32, 0, 0, 1,
1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5,
5, 5, 6, 6, 7, 7, 7, 8, 8, 9, 9, 10, 10, 11, 32,
0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 5, 6,
6, 7, 8, 8, 9, 10, 11, 12, 13, 15, 16, 17, 18, 18, 19,
20, 21, 29, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1,
2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 4,
4, 4, 31, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 2, 2,
2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4,
5, 5, 5, 5, 29, 0, 0, 0, 1, 1, 1, 1, 1, 1, 2,
2, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5,
5, 5, 6, 6, 31, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2,
2, 3, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6, 7,
7, 7, 8, 8, 9, 9, 31, 0, 0, 1, 1, 1, 1, 2, 2,
2, 3, 3, 3, 4, 4, 5, 5, 6, 6, 7, 8, 8, 9, 10,
10, 11, 12, 13, 14, 15, 16, 17, };
3, 3, 3, 3, 3, 4, 4, 4, 4, 30, 0, 0, 0, 0, 1,
1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 3,
3, 3, 3, 3, 3, 3, 4, 4, 4, 4, };
static const unsigned char cache_caps50[168] = {
224, 224, 224, 224, 224, 224, 224, 224, 160, 160, 160, 160, 185, 185, 185,
176, 176, 172, 137, 65, 36, 224, 224, 224, 224, 224, 224, 224, 224, 240,
240, 240, 240, 207, 207, 207, 197, 197, 187, 146, 68, 39, 160, 160, 160,
160, 160, 160, 160, 160, 185, 185, 185, 185, 193, 193, 193, 182, 182, 176,
140, 66, 37, 240, 240, 240, 240, 240, 240, 240, 240, 207, 207, 207, 207,
204, 204, 204, 192, 192, 184, 145, 68, 39, 185, 185, 185, 185, 185, 185,
185, 185, 193, 193, 193, 193, 193, 193, 193, 182, 182, 176, 142, 67, 38,
176, 176, 193, 182, 193, 182, 224, 224, 224, 224, 224, 224, 224, 224, 240,
240, 240, 240, 207, 207, 207, 197, 197, 204, 192, 201, 187, 160, 160, 160,
160, 160, 160, 160, 160, 185, 185, 185, 185, 193, 193, 193, 182, 182, 193,
182, 194, 183, 240, 240, 240, 240, 240, 240, 240, 240, 207, 207, 207, 207,
204, 204, 204, 192, 192, 201, 187, 198, 185, 185, 185, 185, 185, 185, 185,
185, 185, 193, 193, 193, 193, 193, 193, 193, 182, 182, 194, 183, 194, 182,
207, 207, 207, 207, 207, 207, 207, 207, 204, 204, 204, 204, 201, 201, 201,
187, 187, 180, 144, 68, 39, 193, 193, 193, 193, 193, 193, 193, 193, 193,
193, 193, 193, 194, 194, 194, 183, 183, 177, 142, 67, 38, 204, 204, 204,
204, 204, 204, 204, 204, 201, 201, 201, 201, 198, 198, 198, 185, 185, 179,
143, 68, 39, };
187, 187, 198, 185, 196, 184, 193, 193, 193, 193, 193, 193, 193, 193, 193,
193, 193, 193, 194, 194, 194, 183, 183, 194, 182, 194, 182, 204, 204, 204,
204, 204, 204, 204, 204, 201, 201, 201, 201, 198, 198, 198, 185, 185, 196,
184, 195, 183, };
#endif

#ifndef FFT_TWIDDLES48000_960
Expand Down Expand Up @@ -903,7 +887,7 @@ static const CELTMode mode48000_960_120 = {
logN400, /* logN */
window120, /* window */
{1920, 3, {&fft_state48000_960_0, &fft_state48000_960_1, &fft_state48000_960_2, &fft_state48000_960_3, }, mdct_twiddles960}, /* mdct */
{653, cache_index50, cache_bits50, cache_caps50}, /* cache */
{400, cache_index50, cache_bits50, cache_caps50}, /* cache */
};

#ifdef ENABLE_QEXT
Expand Down Expand Up @@ -964,25 +948,26 @@ static const celt_coef window240[240] = {
#ifndef DEF_LOGN400
# define DEF_LOGN400
static const oac_int16 logN400[21] = {
0, 0, 0, 0, 0, 0, 0, 0, 8, 8, 8, 8, 16, 16, 16, 21, 21, 24, 29, 34, 36, };
0, 0, 0, 0, 0, 0, 0, 0, 8, 8, 8, 8, 16, 16, 16, 21, 21, 24, 29, 32, 37, };
#endif

#ifndef DEF_PULSE_CACHE50
# define DEF_PULSE_CACHE50
static const oac_int16 cache_index50[177] = {
-1, 67, 57, 262, 33, -1, 229, -1, 0, 464, -1, 621, 197, -1, -1,
-1, 69, -1, 431, -1, -1, -1, 589, -1, 164, -1, -1, -1, -1, -1,
-1, -1, 102, -1, -1, -1, 399, -1, -1, -1, -1, -1, -1, -1, 559,
static const oac_int16 cache_index50[193] = {
-1, 67, 57, 262, 33, -1, 229, -1, 0, -1, -1, -1, 197, -1, -1,
-1, 69, -1, -1, -1, -1, -1, -1, -1, 164, -1, -1, -1, -1, -1,
-1, -1, 102, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, 133, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, 279, -1, -1, -1, -1, -1, -1, -1, 369, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 527, -1,
-1, -1, -1, -1, 279, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, 308, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, 340, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, 340, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 497, };
static const unsigned char cache_bits50[653] = {
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 369, };
static const unsigned char cache_bits50[400] = {
32, 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 4, 4, 5, 5,
6, 7, 8, 9, 10, 11, 12, 13, 15, 16, 17, 18, 19, 20, 21,
23, 24, 25, 23, 0, 1, 1, 1, 2, 3, 3, 4, 6, 7, 9,
Expand All @@ -1007,39 +992,22 @@ static const unsigned char cache_bits50[653] = {
1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3,
3, 3, 4, 4, 4, 4, 4, 5, 5, 5, 28, 0, 0, 0, 0,
1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 3,
3, 3, 3, 3, 3, 3, 4, 4, 4, 29, 0, 0, 0, 1, 1,
1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3,
3, 4, 4, 4, 4, 4, 5, 5, 5, 31, 0, 0, 0, 1, 1,
1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4,
4, 4, 5, 5, 5, 6, 6, 6, 6, 7, 7, 32, 0, 0, 1,
1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5,
5, 5, 6, 6, 7, 7, 7, 8, 8, 9, 9, 10, 10, 11, 32,
0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 5, 6,
6, 7, 8, 8, 9, 10, 11, 12, 13, 15, 16, 17, 18, 18, 19,
20, 21, 29, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1,
2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 4,
4, 4, 31, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 2, 2,
2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4,
5, 5, 5, 5, 29, 0, 0, 0, 1, 1, 1, 1, 1, 1, 2,
2, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5,
5, 5, 6, 6, 31, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2,
2, 3, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6, 7,
7, 7, 8, 8, 9, 9, 31, 0, 0, 1, 1, 1, 1, 2, 2,
2, 3, 3, 3, 4, 4, 5, 5, 6, 6, 7, 8, 8, 9, 10,
10, 11, 12, 13, 14, 15, 16, 17, };
3, 3, 3, 3, 3, 4, 4, 4, 4, 30, 0, 0, 0, 0, 1,
1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 3,
3, 3, 3, 3, 3, 3, 4, 4, 4, 4, };
static const unsigned char cache_caps50[168] = {
224, 224, 224, 224, 224, 224, 224, 224, 160, 160, 160, 160, 185, 185, 185,
176, 176, 172, 137, 65, 36, 224, 224, 224, 224, 224, 224, 224, 224, 240,
240, 240, 240, 207, 207, 207, 197, 197, 187, 146, 68, 39, 160, 160, 160,
160, 160, 160, 160, 160, 185, 185, 185, 185, 193, 193, 193, 182, 182, 176,
140, 66, 37, 240, 240, 240, 240, 240, 240, 240, 240, 207, 207, 207, 207,
204, 204, 204, 192, 192, 184, 145, 68, 39, 185, 185, 185, 185, 185, 185,
185, 185, 193, 193, 193, 193, 193, 193, 193, 182, 182, 176, 142, 67, 38,
176, 176, 193, 182, 193, 182, 224, 224, 224, 224, 224, 224, 224, 224, 240,
240, 240, 240, 207, 207, 207, 197, 197, 204, 192, 201, 187, 160, 160, 160,
160, 160, 160, 160, 160, 185, 185, 185, 185, 193, 193, 193, 182, 182, 193,
182, 194, 183, 240, 240, 240, 240, 240, 240, 240, 240, 207, 207, 207, 207,
204, 204, 204, 192, 192, 201, 187, 198, 185, 185, 185, 185, 185, 185, 185,
185, 185, 193, 193, 193, 193, 193, 193, 193, 182, 182, 194, 183, 194, 182,
207, 207, 207, 207, 207, 207, 207, 207, 204, 204, 204, 204, 201, 201, 201,
187, 187, 180, 144, 68, 39, 193, 193, 193, 193, 193, 193, 193, 193, 193,
193, 193, 193, 194, 194, 194, 183, 183, 177, 142, 67, 38, 204, 204, 204,
204, 204, 204, 204, 204, 201, 201, 201, 201, 198, 198, 198, 185, 185, 179,
143, 68, 39, };
187, 187, 198, 185, 196, 184, 193, 193, 193, 193, 193, 193, 193, 193, 193,
193, 193, 193, 194, 194, 194, 183, 183, 194, 182, 194, 182, 204, 204, 204,
204, 204, 204, 204, 204, 201, 201, 201, 201, 198, 198, 198, 185, 185, 196,
184, 195, 183, };
#endif

#ifndef FFT_TWIDDLES96000_1920
Expand Down Expand Up @@ -2485,7 +2453,7 @@ static const CELTMode mode96000_1920_240 = {
logN400, /* logN */
window240, /* window */
{3840, 3, {&fft_state96000_1920_0, &fft_state96000_1920_1, &fft_state96000_1920_2, &fft_state96000_1920_3, }, mdct_twiddles1920}, /* mdct */
{653, cache_index50, cache_bits50, cache_caps50}, /* cache */
{400, cache_index50, cache_bits50, cache_caps50}, /* cache */
};
#endif /* ENABLE_QEXT */

Expand Down
Loading