From c5cb9c946bb2b27ddd1284d2c66e0c3b20e77763 Mon Sep 17 00:00:00 2001 From: Kostya Shishkov Date: Sat, 6 Nov 2010 13:31:17 +0000 Subject: [PATCH] try to give TrueSpeech decoder tables more sensible names Originally committed as revision 25681 to svn://svn.ffmpeg.org/ffmpeg/trunk --- libavcodec/truespeech.c | 14 +++++++------- libavcodec/truespeech_data.h | 12 ++++++------ 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/libavcodec/truespeech.c b/libavcodec/truespeech.c index eafbca52d..807329ee1 100644 --- a/libavcodec/truespeech.c +++ b/libavcodec/truespeech.c @@ -165,7 +165,7 @@ static void truespeech_correlate_filter(TSContext *dec) dec->cvector[i] = (8 - dec->vector[i]) >> 3; } for(i = 0; i < 8; i++) - dec->cvector[i] = (dec->cvector[i] * ts_230[i]) >> 15; + dec->cvector[i] = (dec->cvector[i] * ts_decay_994_1000[i]) >> 15; dec->filtval = dec->vector[0]; } @@ -207,7 +207,7 @@ static void truespeech_apply_twopoint_filter(TSContext *dec, int quart) off = (t / 25) + dec->offset1[quart >> 1] + 18; ptr0 = tmp + 145 - off; ptr1 = tmp + 146; - filter = (const int16_t*)ts_240 + (t % 25) * 2; + filter = (const int16_t*)ts_order2_coeffs + (t % 25) * 2; for(i = 0; i < 60; i++){ t = (ptr0[0] * filter[0] + ptr0[1] * filter[1] + 0x2000) >> 14; ptr0++; @@ -228,11 +228,11 @@ static void truespeech_place_pulses(TSContext *dec, int16_t *out, int quart) for(i = 0; i < 7; i++) { t = dec->pulseval[quart] & 3; dec->pulseval[quart] >>= 2; - tmp[6 - i] = ts_562[dec->pulseoff[quart] * 4 + t]; + tmp[6 - i] = ts_pulse_scales[dec->pulseoff[quart] * 4 + t]; } coef = dec->pulsepos[quart] >> 15; - ptr1 = (const int16_t*)ts_140 + 30; + ptr1 = (const int16_t*)ts_pulse_values + 30; ptr2 = tmp; for(i = 0, j = 3; (i < 30) && (j > 0); i++){ t = *ptr1++; @@ -245,7 +245,7 @@ static void truespeech_place_pulses(TSContext *dec, int16_t *out, int quart) } } coef = dec->pulsepos[quart] & 0x7FFF; - ptr1 = (const int16_t*)ts_140; + ptr1 = (const int16_t*)ts_pulse_values; for(i = 30, j = 4; (i < 60) && (j > 0); i++){ t = *ptr1++; if(coef >= t) @@ -291,7 +291,7 @@ static void truespeech_synth(TSContext *dec, int16_t *out, int quart) } for(i = 0; i < 8; i++) - t[i] = (ts_5E2[i] * ptr1[i]) >> 15; + t[i] = (ts_decay_35_64[i] * ptr1[i]) >> 15; ptr0 = dec->tmp2; for(i = 0; i < 60; i++){ @@ -305,7 +305,7 @@ static void truespeech_synth(TSContext *dec, int16_t *out, int quart) } for(i = 0; i < 8; i++) - t[i] = (ts_5F2[i] * ptr1[i]) >> 15; + t[i] = (ts_decay_3_4[i] * ptr1[i]) >> 15; ptr0 = dec->tmp3; for(i = 0; i < 60; i++){ diff --git a/libavcodec/truespeech_data.h b/libavcodec/truespeech_data.h index eef7da8ee..73ebda5e8 100644 --- a/libavcodec/truespeech_data.h +++ b/libavcodec/truespeech_data.h @@ -71,7 +71,7 @@ static const int16_t * const ts_codebook[8] = { }; /* table used for decoding pulse positions */ -static const int16_t ts_140[120] = { +static const int16_t ts_pulse_values[120] = { 0x0E46, 0x0CCC, 0x0B6D, 0x0A28, 0x08FC, 0x07E8, 0x06EB, 0x0604, 0x0532, 0x0474, 0x03C9, 0x0330, 0x02A8, 0x0230, 0x01C7, 0x016C, 0x011E, 0x00DC, 0x00A5, 0x0078, 0x0054, 0x0038, 0x0023, 0x0014, @@ -94,11 +94,11 @@ static const int16_t ts_140[120] = { }; /* filter for correlated input filter */ -static const int16_t ts_230[8] = +static const int16_t ts_decay_994_1000[8] = { 0x7F3B, 0x7E78, 0x7DB6, 0x7CF5, 0x7C35, 0x7B76, 0x7AB8, 0x79FC }; /* two-point filters table */ -static const int16_t ts_240[25 * 2] = { +static const int16_t ts_order2_coeffs[25 * 2] = { 0xED2F, 0x5239, 0x54F1, 0xE4A9, 0x2620, 0xEE3E, @@ -131,7 +131,7 @@ static const int16_t ts_240[25 * 2] = { }; /* possible pulse values */ -static const int16_t ts_562[64] = { +static const int16_t ts_pulse_scales[64] = { 0x0002, 0x0006, 0xFFFE, 0xFFFA, 0x0004, 0x000C, 0xFFFC, 0xFFF4, 0x0006, 0x0012, 0xFFFA, 0xFFEE, @@ -151,9 +151,9 @@ static const int16_t ts_562[64] = { }; /* filters used in final output calculations */ -static const int16_t ts_5E2[8] = +static const int16_t ts_decay_35_64[8] = { 0x4666, 0x26B8, 0x154C, 0x0BB6, 0x0671, 0x038B, 0x01F3, 0x0112 }; -static const int16_t ts_5F2[8] = +static const int16_t ts_decay_3_4[8] = { 0x6000, 0x4800, 0x3600, 0x2880, 0x1E60, 0x16C8, 0x1116, 0x0CD1 }; #endif /* AVCODEC_TRUESPEECH_DATA_H */ -- 2.11.0