comparison g726.c @ 7059:54e5978dd41a libavcodec

Change iquant tables to int16.
author michael
date Tue, 17 Jun 2008 14:03:00 +0000
parents 819e52ba3125
children 3e51aa540377
comparison
equal deleted inserted replaced
7058:819e52ba3125 7059:54e5978dd41a
63 } 63 }
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 int16_t* iquant; /**< inverse quantization table */
69 const int16_t* W; /**< special table #1 ;-) */ 69 const int16_t* W; /**< special table #1 ;-) */
70 const uint8_t* 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 {
91 int y; /**< quantizer scaling factor for the next iteration */ 91 int y; /**< quantizer scaling factor for the next iteration */
92 } G726Context; 92 } G726Context;
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 int16_t iquant_tbl16[] =
97 { 116, 365, 365, 116 }; 97 { 116, 365, 365, 116 };
98 static const int16_t W_tbl16[] = 98 static const int16_t W_tbl16[] =
99 { -22, 439, 439, -22 }; 99 { -22, 439, 439, -22 };
100 static const uint8_t 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 int16_t iquant_tbl24[] =
106 { INT_MIN, 135, 273, 373, 373, 273, 135, INT_MIN }; 106 { INT16_MIN, 135, 273, 373, 373, 273, 135, INT16_MIN };
107 static const int16_t 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 uint8_t 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 int16_t iquant_tbl32[] =
115 { INT_MIN, 4, 135, 213, 273, 323, 373, 425, 115 { INT16_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, INT16_MIN };
117 static const int16_t 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 uint8_t 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 int16_t iquant_tbl40[] =
127 { INT_MIN, -66, 28, 104, 169, 224, 274, 318, 127 { INT16_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, INT16_MIN };
131 static const int16_t 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 };