comparison g726.c @ 7053:e3ee81021cf1 libavcodec

Use smaller data types for tables.
author michael
date Mon, 16 Jun 2008 23:51:07 +0000
parents 80ead68858f3
children 2fabac9dedea
comparison
equal deleted inserted replaced
7052:80ead68858f3 7053:e3ee81021cf1
64 64
65 typedef struct G726Tables { 65 typedef struct G726Tables {
66 int bits; /**< bits per sample */ 66 int bits; /**< bits per sample */
67 const int* quant; /**< quantization table */ 67 const int* quant; /**< quantization table */
68 const int* iquant; /**< inverse quantization table */ 68 const int* iquant; /**< inverse quantization table */
69 const int* W; /**< special table #1 ;-) */ 69 const int16_t* W; /**< special table #1 ;-) */
70 const int* F; /**< special table #2 */ 70 const uint8_t* F; /**< special table #2 */
71 } G726Tables; 71 } G726Tables;
72 72
73 typedef struct G726Context { 73 typedef struct G726Context {
74 const G726Tables* tbls; /**< static tables needed for computation */ 74 const G726Tables* tbls; /**< static tables needed for computation */
75 75
93 93
94 static const int quant_tbl16[] = /**< 16kbit/s 2bits per sample */ 94 static const int quant_tbl16[] = /**< 16kbit/s 2bits per sample */
95 { 260, INT_MAX }; 95 { 260, INT_MAX };
96 static const int iquant_tbl16[] = 96 static const int iquant_tbl16[] =
97 { 116, 365, 365, 116 }; 97 { 116, 365, 365, 116 };
98 static const int W_tbl16[] = 98 static const int16_t W_tbl16[] =
99 { -22, 439, 439, -22 }; 99 { -22, 439, 439, -22 };
100 static const int F_tbl16[] = 100 static const uint8_t F_tbl16[] =
101 { 0, 7, 7, 0 }; 101 { 0, 7, 7, 0 };
102 102
103 static const int quant_tbl24[] = /**< 24kbit/s 3bits per sample */ 103 static const int quant_tbl24[] = /**< 24kbit/s 3bits per sample */
104 { 7, 217, 330, INT_MAX }; 104 { 7, 217, 330, INT_MAX };
105 static const int iquant_tbl24[] = 105 static const int iquant_tbl24[] =
106 { INT_MIN, 135, 273, 373, 373, 273, 135, INT_MIN }; 106 { INT_MIN, 135, 273, 373, 373, 273, 135, INT_MIN };
107 static const int W_tbl24[] = 107 static const int16_t W_tbl24[] =
108 { -4, 30, 137, 582, 582, 137, 30, -4 }; 108 { -4, 30, 137, 582, 582, 137, 30, -4 };
109 static const int F_tbl24[] = 109 static const uint8_t F_tbl24[] =
110 { 0, 1, 2, 7, 7, 2, 1, 0 }; 110 { 0, 1, 2, 7, 7, 2, 1, 0 };
111 111
112 static const int quant_tbl32[] = /**< 32kbit/s 4bits per sample */ 112 static const int quant_tbl32[] = /**< 32kbit/s 4bits per sample */
113 { -125, 79, 177, 245, 299, 348, 399, INT_MAX }; 113 { -125, 79, 177, 245, 299, 348, 399, INT_MAX };
114 static const int iquant_tbl32[] = 114 static const int iquant_tbl32[] =
115 { INT_MIN, 4, 135, 213, 273, 323, 373, 425, 115 { INT_MIN, 4, 135, 213, 273, 323, 373, 425,
116 425, 373, 323, 273, 213, 135, 4, INT_MIN }; 116 425, 373, 323, 273, 213, 135, 4, INT_MIN };
117 static const int W_tbl32[] = 117 static const int16_t W_tbl32[] =
118 { -12, 18, 41, 64, 112, 198, 355, 1122, 118 { -12, 18, 41, 64, 112, 198, 355, 1122,
119 1122, 355, 198, 112, 64, 41, 18, -12}; 119 1122, 355, 198, 112, 64, 41, 18, -12};
120 static const int F_tbl32[] = 120 static const uint8_t F_tbl32[] =
121 { 0, 0, 0, 1, 1, 1, 3, 7, 7, 3, 1, 1, 1, 0, 0, 0 }; 121 { 0, 0, 0, 1, 1, 1, 3, 7, 7, 3, 1, 1, 1, 0, 0, 0 };
122 122
123 static const int quant_tbl40[] = /**< 40kbit/s 5bits per sample */ 123 static const int quant_tbl40[] = /**< 40kbit/s 5bits per sample */
124 { -122, -16, 67, 138, 197, 249, 297, 338, 124 { -122, -16, 67, 138, 197, 249, 297, 338,
125 377, 412, 444, 474, 501, 527, 552, INT_MAX }; 125 377, 412, 444, 474, 501, 527, 552, INT_MAX };
126 static const int iquant_tbl40[] = 126 static const int iquant_tbl40[] =
127 { INT_MIN, -66, 28, 104, 169, 224, 274, 318, 127 { INT_MIN, -66, 28, 104, 169, 224, 274, 318,
128 358, 395, 429, 459, 488, 514, 539, 566, 128 358, 395, 429, 459, 488, 514, 539, 566,
129 566, 539, 514, 488, 459, 429, 395, 358, 129 566, 539, 514, 488, 459, 429, 395, 358,
130 318, 274, 224, 169, 104, 28, -66, INT_MIN }; 130 318, 274, 224, 169, 104, 28, -66, INT_MIN };
131 static const int W_tbl40[] = 131 static const int16_t W_tbl40[] =
132 { 14, 14, 24, 39, 40, 41, 58, 100, 132 { 14, 14, 24, 39, 40, 41, 58, 100,
133 141, 179, 219, 280, 358, 440, 529, 696, 133 141, 179, 219, 280, 358, 440, 529, 696,
134 696, 529, 440, 358, 280, 219, 179, 141, 134 696, 529, 440, 358, 280, 219, 179, 141,
135 100, 58, 41, 40, 39, 24, 14, 14 }; 135 100, 58, 41, 40, 39, 24, 14, 14 };
136 static const int F_tbl40[] = 136 static const uint8_t F_tbl40[] =
137 { 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 3, 4, 5, 6, 6, 137 { 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 3, 4, 5, 6, 6,
138 6, 6, 5, 4, 3, 2, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0 }; 138 6, 6, 5, 4, 3, 2, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0 };
139 139
140 static const G726Tables G726Tables_pool[] = 140 static const G726Tables G726Tables_pool[] =
141 {{ 2, quant_tbl16, iquant_tbl16, W_tbl16, F_tbl16 }, 141 {{ 2, quant_tbl16, iquant_tbl16, W_tbl16, F_tbl16 },