[FFmpeg-soc] [soc]: r4038 - in amr: amrnbfloatdata.h amrnbfloatdec.c
kmalaussene
subversion at mplayerhq.hu
Tue Feb 10 23:32:12 CET 2009
Author: kmalaussene
Date: Tue Feb 10 23:32:12 2009
New Revision: 4038
Log:
Simplify reset_state function by using and packing the init values in tables.
Modified:
amr/amrnbfloatdata.h
amr/amrnbfloatdec.c
Modified: amr/amrnbfloatdata.h
==============================================================================
--- amr/amrnbfloatdata.h Tue Feb 10 22:45:21 2009 (r4037)
+++ amr/amrnbfloatdata.h Tue Feb 10 23:32:12 2009 (r4038)
@@ -288,6 +288,23 @@ static const AMROrder order_MODE_DTX[35]
};
+/**
+ * Initialize values for the lsp vector from the 4th subframe of the
+ * previous subframe values.
+ *
+ * @note: Taken from Decoder_amr_reset in Q15 using val/1000
+ */
+ static const int8_t lsp_sub4_init[LP_FILTER_ORDER] = { 30, 26, 21, 15, 8, 0, -8, -15, -21, -26 };
+
+/**
+ * Initialize mean lsp values.
+ *
+ * @note: Taken from Decoder_amr_reset in Q15
+ */
+ static const int16_t lsp_avg_init[LP_FILTER_ORDER] = {
+ 1384, 2077, 3420, 5108, 6742, 8122, 9863, 11092, 12714, 13701
+};
+
// LSF tables
static const float lsf_3_1[256][3] = {
Modified: amr/amrnbfloatdec.c
==============================================================================
--- amr/amrnbfloatdec.c Tue Feb 10 22:45:21 2009 (r4037)
+++ amr/amrnbfloatdec.c Tue Feb 10 23:32:12 2009 (r4038)
@@ -87,32 +87,10 @@ static void reset_state(AMRContext *p)
{
int i;
- // Initialize values for the lsp vector from the 4th subframe of the
- // previous subframe values.
- // Taken from Decoder_amr_reset using val/(float)(1<<15).
- p->prev_lsp_sub4[0] = 0.91552734375;
- p->prev_lsp_sub4[1] = 0.79345703125;
- p->prev_lsp_sub4[2] = 0.640869140625;
- p->prev_lsp_sub4[3] = 0.457763671875;
- p->prev_lsp_sub4[4] = 0.244140625;
- p->prev_lsp_sub4[5] = 0.0;
- p->prev_lsp_sub4[6] = -0.244140625;
- p->prev_lsp_sub4[7] = -0.457763671875;
- p->prev_lsp_sub4[8] = -0.640869140625;
- p->prev_lsp_sub4[9] = -0.79345703125;
-
- // Initialize mean lsp values.
- // Taken from Decoder_amr_reset using val/(float)(1<<15).
- p->lsp_avg[0] = 0.042236328125;
- p->lsp_avg[1] = 0.063385009765625;
- p->lsp_avg[2] = 0.1043701171875;
- p->lsp_avg[3] = 0.1558837890625;
- p->lsp_avg[4] = 0.20574951171875;
- p->lsp_avg[5] = 0.24786376953125;
- p->lsp_avg[6] = 0.300994873046875;
- p->lsp_avg[7] = 0.3385009765625;
- p->lsp_avg[8] = 0.38800048828125;
- p->lsp_avg[9] = 0.418121337890625;
+ for(i=0; i<LP_FILTER_ORDER; i++) {
+ p->prev_lsp_sub4[i] = lsp_sub4_init[i] * 1000 / (float)(1 << 15);
+ p->lsp_avg[i] = lsp_avg_init[i] / (float)(1 << 15);
+ }
for(i=0; i<4; i++) {
p->prediction_error[i] = MIN_ENERGY;
More information about the FFmpeg-soc
mailing list