shithub: opus

Download patch

ref: 6518a836ab731b39d51143fb8d7466ae67beda6d
parent: b86d9782f16bad4c6ac7e8f674a5afe3ebda16e5
author: Timothy B. Terriberry <[email protected]>
date: Sat Jul 30 17:24:03 EDT 2011

Add extra entries to the shell code tables

Although the current encoder uses does not use them, the decoder
might have tried to use offsets beyond the end of these tables.
Inserting values here ensures that the stream can be decoded in a
well-defined way.
The particular values of these tables were chosen to match a
Gaussian distribution with sigma=3.93.

--- a/silk/silk_tables.h
+++ b/silk/silk_tables.h
@@ -55,9 +55,9 @@
 
 extern const opus_uint8  silk_max_pulses_table[ 4 ];                                             /*   4 */
 
-extern const opus_uint8  silk_shell_code_table0[  44 ];                                          /*  44 */
-extern const opus_uint8  silk_shell_code_table1[  65 ];                                          /*  65 */
-extern const opus_uint8  silk_shell_code_table2[  90 ];                                          /*  90 */
+extern const opus_uint8  silk_shell_code_table0[ 152 ];                                          /* 152 */
+extern const opus_uint8  silk_shell_code_table1[ 152 ];                                          /* 152 */
+extern const opus_uint8  silk_shell_code_table2[ 152 ];                                          /* 152 */
 extern const opus_uint8  silk_shell_code_table3[ 152 ];                                          /* 152 */
 extern const opus_uint8  silk_shell_code_table_offsets[ MAX_PULSES + 1 ];                        /*  17 */
 
--- a/silk/silk_tables_pulses_per_block.c
+++ b/silk/silk_tables_pulses_per_block.c
@@ -156,16 +156,29 @@
 }
 };
 
-const opus_uint8 silk_shell_code_table0[ 44 ] = {
+const opus_uint8 silk_shell_code_table0[ 152 ] = {
 	   128,      0,    214,     42,      0,    235,    128,     21,
 	     0,    244,    184,     72,     11,      0,    248,    214,
 	   128,     42,      7,      0,    248,    225,    170,     80,
 	    25,      5,      0,    251,    236,    198,    126,     54,
 	    18,      3,      0,    250,    238,    211,    159,     82,
-	    35,     15,      5,      0
+	    35,     15,      5,      0,    250,    231,    203,    168,
+	   128,     88,     53,     25,      6,      0,    252,    238,
+	   216,    185,    148,    108,     71,     40,     18,      4,
+	     0,    253,    243,    225,    199,    166,    128,     90,
+	    57,     31,     13,      3,      0,    254,    246,    233,
+	   212,    183,    147,    109,     73,     44,     23,     10,
+	     2,      0,    255,    250,    240,    223,    198,    166,
+	   128,     90,     58,     33,     16,      6,      1,      0,
+	   255,    251,    244,    231,    210,    181,    146,    110,
+	    75,     46,     25,     12,      5,      1,      0,    255,
+	   253,    248,    238,    221,    196,    164,    128,     92,
+	    60,     35,     18,      8,      3,      1,      0,    255,
+	   253,    249,    242,    229,    208,    180,    146,    110,
+	    76,     48,     27,     14,      7,      3,      1,      0
 };
 
-const opus_uint8 silk_shell_code_table1[ 65 ] = {
+const opus_uint8 silk_shell_code_table1[ 152 ] = {
 	   129,      0,    207,     50,      0,    236,    129,     20,
 	     0,    245,    185,     72,     10,      0,    249,    213,
 	   129,     42,      6,      0,    250,    226,    169,     87,
@@ -174,10 +187,20 @@
 	    47,     17,      3,      0,    255,    240,    217,    182,
 	   131,     81,     41,     11,      1,      0,    255,    254,
 	   233,    201,    159,    107,     61,     20,      2,      1,
-	     0
+	     0,    255,    249,    233,    206,    170,    128,     86,
+	    50,     23,      7,      1,      0,    255,    250,    238,
+	   217,    186,    148,    108,     70,     39,     18,      6,
+	     1,      0,    255,    252,    243,    226,    200,    166,
+	   128,     90,     56,     30,     13,      4,      1,      0,
+	   255,    252,    245,    231,    209,    180,    146,    110,
+	    76,     47,     25,     11,      4,      1,      0,    255,
+	   253,    248,    237,    219,    194,    163,    128,     93,
+	    62,     37,     19,      8,      3,      1,      0,    255,
+	   254,    250,    241,    226,    205,    177,    145,    111,
+	    79,     51,     30,     15,      6,      2,      1,      0
 };
 
-const opus_uint8 silk_shell_code_table2[ 90 ] = {
+const opus_uint8 silk_shell_code_table2[ 152 ] = {
 	   129,      0,    203,     54,      0,    234,    129,     23,
 	     0,    245,    184,     73,     10,      0,    250,    215,
 	   129,     41,      5,      0,    252,    232,    173,     86,
@@ -189,7 +212,14 @@
 	     0,    255,    248,    235,    213,    179,    133,     85,
 	    47,     19,      5,      1,      0,    255,    254,    243,
 	   221,    194,    159,    117,     70,     37,     12,      2,
-	     1,      0
+	     1,      0,    255,    254,    248,    234,    208,    171,
+	   128,     85,     48,     22,      8,      2,      1,      0,
+	   255,    254,    250,    240,    220,    189,    149,    107,
+	    67,     36,     16,      6,      2,      1,      0,    255,
+	   254,    251,    243,    227,    201,    166,    128,     90,
+	    55,     29,     13,      5,      2,      1,      0,    255,
+	   254,    252,    246,    234,    213,    183,    147,    109,
+	    73,     43,     22,     10,      4,      2,      1,      0
 };
 
 const opus_uint8 silk_shell_code_table3[ 152 ] = {