annotate libtwamr/cbsearch.c @ 458:e26b974f7ba3

doc/AMR-study-utils: update for the current situation
author Mychaela Falconia <falcon@freecalypso.org>
date Fri, 10 May 2024 18:45:36 +0000
parents 4614f1a97e1a
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
328
4614f1a97e1a libtwamr: integrate cbsearch.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1 /*
4614f1a97e1a libtwamr: integrate cbsearch.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
2 *****************************************************************************
4614f1a97e1a libtwamr: integrate cbsearch.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
3 *
4614f1a97e1a libtwamr: integrate cbsearch.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
4 * GSM AMR-NB speech codec R98 Version 7.6.0 December 12, 2001
4614f1a97e1a libtwamr: integrate cbsearch.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
5 * R99 Version 3.3.0
4614f1a97e1a libtwamr: integrate cbsearch.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
6 * REL-4 Version 4.1.0
4614f1a97e1a libtwamr: integrate cbsearch.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
7 *
4614f1a97e1a libtwamr: integrate cbsearch.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
8 *****************************************************************************
4614f1a97e1a libtwamr: integrate cbsearch.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
9 *
4614f1a97e1a libtwamr: integrate cbsearch.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
10 * File : cbsearch.c
4614f1a97e1a libtwamr: integrate cbsearch.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
11 * Purpose : Inovative codebook search (find index and gain)
4614f1a97e1a libtwamr: integrate cbsearch.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
12 *
4614f1a97e1a libtwamr: integrate cbsearch.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
13 *****************************************************************************
4614f1a97e1a libtwamr: integrate cbsearch.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
14 */
4614f1a97e1a libtwamr: integrate cbsearch.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
15
4614f1a97e1a libtwamr: integrate cbsearch.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
16 /*
4614f1a97e1a libtwamr: integrate cbsearch.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
17 *****************************************************************************
4614f1a97e1a libtwamr: integrate cbsearch.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
18 * MODULE INCLUDE FILE AND VERSION ID
4614f1a97e1a libtwamr: integrate cbsearch.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
19 *****************************************************************************
4614f1a97e1a libtwamr: integrate cbsearch.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
20 */
4614f1a97e1a libtwamr: integrate cbsearch.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
21 #include "namespace.h"
4614f1a97e1a libtwamr: integrate cbsearch.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
22 #include "cbsearch.h"
4614f1a97e1a libtwamr: integrate cbsearch.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
23
4614f1a97e1a libtwamr: integrate cbsearch.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
24 /*
4614f1a97e1a libtwamr: integrate cbsearch.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
25 *****************************************************************************
4614f1a97e1a libtwamr: integrate cbsearch.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
26 * INCLUDE FILES
4614f1a97e1a libtwamr: integrate cbsearch.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
27 *****************************************************************************
4614f1a97e1a libtwamr: integrate cbsearch.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
28 */
4614f1a97e1a libtwamr: integrate cbsearch.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
29 #include "tw_amr.h"
4614f1a97e1a libtwamr: integrate cbsearch.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
30 #include "typedef.h"
4614f1a97e1a libtwamr: integrate cbsearch.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
31 #include "c2_9pf.h"
4614f1a97e1a libtwamr: integrate cbsearch.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
32 #include "c2_11pf.h"
4614f1a97e1a libtwamr: integrate cbsearch.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
33 #include "c3_14pf.h"
4614f1a97e1a libtwamr: integrate cbsearch.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
34 #include "c4_17pf.h"
4614f1a97e1a libtwamr: integrate cbsearch.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
35 #include "c8_31pf.h"
4614f1a97e1a libtwamr: integrate cbsearch.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
36 #include "c1035pf.h"
4614f1a97e1a libtwamr: integrate cbsearch.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
37 #include "basic_op.h"
4614f1a97e1a libtwamr: integrate cbsearch.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
38 #include "no_count.h"
4614f1a97e1a libtwamr: integrate cbsearch.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
39 #include "cnst.h"
4614f1a97e1a libtwamr: integrate cbsearch.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
40
4614f1a97e1a libtwamr: integrate cbsearch.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
41 /*
4614f1a97e1a libtwamr: integrate cbsearch.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
42 *****************************************************************************
4614f1a97e1a libtwamr: integrate cbsearch.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
43 * PUBLIC PROGRAM CODE
4614f1a97e1a libtwamr: integrate cbsearch.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
44 *****************************************************************************
4614f1a97e1a libtwamr: integrate cbsearch.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
45 */
4614f1a97e1a libtwamr: integrate cbsearch.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
46 int cbsearch(Word16 x[], /* i : target vector, Q0 */
4614f1a97e1a libtwamr: integrate cbsearch.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
47 Word16 h[], /* i : impulse response of weighted synthesis */
4614f1a97e1a libtwamr: integrate cbsearch.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
48 /* filter h[-L_subfr..-1] must be set to */
4614f1a97e1a libtwamr: integrate cbsearch.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
49 /* zero. Q12 */
4614f1a97e1a libtwamr: integrate cbsearch.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
50 Word16 T0, /* i : Pitch lag */
4614f1a97e1a libtwamr: integrate cbsearch.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
51 Word16 pitch_sharp, /* i : Last quantized pitch gain, Q14 */
4614f1a97e1a libtwamr: integrate cbsearch.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
52 Word16 gain_pit, /* i : Pitch gain, Q14 */
4614f1a97e1a libtwamr: integrate cbsearch.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
53 Word16 res2[], /* i : Long term prediction residual, Q0 */
4614f1a97e1a libtwamr: integrate cbsearch.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
54 Word16 code[], /* o : Innovative codebook, Q13 */
4614f1a97e1a libtwamr: integrate cbsearch.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
55 Word16 y[], /* o : filtered fixed codebook excitation, Q12 */
4614f1a97e1a libtwamr: integrate cbsearch.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
56 Word16 **anap, /* o : Signs of the pulses */
4614f1a97e1a libtwamr: integrate cbsearch.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
57 enum Mode mode,/* i : coder mode */
4614f1a97e1a libtwamr: integrate cbsearch.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
58 Word16 subNr) /* i : subframe number */
4614f1a97e1a libtwamr: integrate cbsearch.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
59 {
4614f1a97e1a libtwamr: integrate cbsearch.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
60 Word16 index;
4614f1a97e1a libtwamr: integrate cbsearch.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
61 Word16 i, temp, pit_sharpTmp;
4614f1a97e1a libtwamr: integrate cbsearch.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
62
4614f1a97e1a libtwamr: integrate cbsearch.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
63 /* For MR74, the pre and post CB pitch sharpening is included in the
4614f1a97e1a libtwamr: integrate cbsearch.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
64 * codebook search routine, while for MR122 is it not.
4614f1a97e1a libtwamr: integrate cbsearch.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
65 */
4614f1a97e1a libtwamr: integrate cbsearch.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
66
4614f1a97e1a libtwamr: integrate cbsearch.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
67 test (); test ();
4614f1a97e1a libtwamr: integrate cbsearch.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
68 if ((sub (mode, MR475) == 0) || (sub (mode, MR515) == 0))
4614f1a97e1a libtwamr: integrate cbsearch.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
69 { /* MR475, MR515 */ move16 ();
4614f1a97e1a libtwamr: integrate cbsearch.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
70 *(*anap)++ = code_2i40_9bits(subNr, x, h, T0, pitch_sharp,
4614f1a97e1a libtwamr: integrate cbsearch.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
71 code, y, &index);
4614f1a97e1a libtwamr: integrate cbsearch.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
72 *(*anap)++ = index; /* sign index */ move16 ();
4614f1a97e1a libtwamr: integrate cbsearch.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
73 }
4614f1a97e1a libtwamr: integrate cbsearch.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
74 else if (sub (mode, MR59) == 0)
4614f1a97e1a libtwamr: integrate cbsearch.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
75 { /* MR59 */
4614f1a97e1a libtwamr: integrate cbsearch.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
76 test (); move16 ();
4614f1a97e1a libtwamr: integrate cbsearch.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
77 *(*anap)++ = code_2i40_11bits(x, h, T0, pitch_sharp, code, y, &index);
4614f1a97e1a libtwamr: integrate cbsearch.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
78 *(*anap)++ = index; /* sign index */ move16 ();
4614f1a97e1a libtwamr: integrate cbsearch.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
79 }
4614f1a97e1a libtwamr: integrate cbsearch.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
80 else if (sub (mode, MR67) == 0)
4614f1a97e1a libtwamr: integrate cbsearch.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
81 { /* MR67 */
4614f1a97e1a libtwamr: integrate cbsearch.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
82 test (); test (); move16 ();
4614f1a97e1a libtwamr: integrate cbsearch.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
83 *(*anap)++ = code_3i40_14bits(x, h, T0, pitch_sharp, code, y, &index);
4614f1a97e1a libtwamr: integrate cbsearch.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
84 *(*anap)++ = index; /* sign index */ move16 ();
4614f1a97e1a libtwamr: integrate cbsearch.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
85 }
4614f1a97e1a libtwamr: integrate cbsearch.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
86 else if (sub (mode, MR74) == 0 || sub (mode, MR795) == 0)
4614f1a97e1a libtwamr: integrate cbsearch.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
87 { /* MR74, MR795 */
4614f1a97e1a libtwamr: integrate cbsearch.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
88 test (); test (); test (); move16 ();
4614f1a97e1a libtwamr: integrate cbsearch.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
89 *(*anap)++ = code_4i40_17bits(x, h, T0, pitch_sharp, code, y, &index);
4614f1a97e1a libtwamr: integrate cbsearch.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
90 *(*anap)++ = index; /* sign index */ move16 ();
4614f1a97e1a libtwamr: integrate cbsearch.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
91 }
4614f1a97e1a libtwamr: integrate cbsearch.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
92 else if (sub (mode, MR102) == 0)
4614f1a97e1a libtwamr: integrate cbsearch.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
93 { /* MR102 */
4614f1a97e1a libtwamr: integrate cbsearch.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
94 test (); test (); test ();
4614f1a97e1a libtwamr: integrate cbsearch.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
95 /*-------------------------------------------------------------*
4614f1a97e1a libtwamr: integrate cbsearch.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
96 * - include pitch contribution into impulse resp. h1[] *
4614f1a97e1a libtwamr: integrate cbsearch.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
97 *-------------------------------------------------------------*/
4614f1a97e1a libtwamr: integrate cbsearch.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
98 /* pit_sharpTmp = pit_sharp; */
4614f1a97e1a libtwamr: integrate cbsearch.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
99 /* if (pit_sharpTmp > 1.0) pit_sharpTmp = 1.0; */
4614f1a97e1a libtwamr: integrate cbsearch.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
100 pit_sharpTmp = shl (pitch_sharp, 1);
4614f1a97e1a libtwamr: integrate cbsearch.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
101 for (i = T0; i < L_SUBFR; i++)
4614f1a97e1a libtwamr: integrate cbsearch.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
102 {
4614f1a97e1a libtwamr: integrate cbsearch.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
103 temp = mult(h[i - T0], pit_sharpTmp);
4614f1a97e1a libtwamr: integrate cbsearch.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
104 h[i] = add(h[i], temp); move16 ();
4614f1a97e1a libtwamr: integrate cbsearch.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
105 }
4614f1a97e1a libtwamr: integrate cbsearch.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
106
4614f1a97e1a libtwamr: integrate cbsearch.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
107 /*--------------------------------------------------------------*
4614f1a97e1a libtwamr: integrate cbsearch.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
108 * - Innovative codebook search (find index and gain) *
4614f1a97e1a libtwamr: integrate cbsearch.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
109 *--------------------------------------------------------------*/
4614f1a97e1a libtwamr: integrate cbsearch.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
110 code_8i40_31bits (x, res2, h, code, y, *anap);
4614f1a97e1a libtwamr: integrate cbsearch.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
111 *anap += 7; add(0,0);
4614f1a97e1a libtwamr: integrate cbsearch.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
112
4614f1a97e1a libtwamr: integrate cbsearch.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
113 /*-------------------------------------------------------*
4614f1a97e1a libtwamr: integrate cbsearch.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
114 * - Add the pitch contribution to code[]. *
4614f1a97e1a libtwamr: integrate cbsearch.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
115 *-------------------------------------------------------*/
4614f1a97e1a libtwamr: integrate cbsearch.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
116 for (i = T0; i < L_SUBFR; i++)
4614f1a97e1a libtwamr: integrate cbsearch.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
117 {
4614f1a97e1a libtwamr: integrate cbsearch.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
118 temp = mult (code[i - T0], pit_sharpTmp);
4614f1a97e1a libtwamr: integrate cbsearch.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
119 code[i] = add (code[i], temp); move16 ();
4614f1a97e1a libtwamr: integrate cbsearch.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
120 }
4614f1a97e1a libtwamr: integrate cbsearch.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
121 }
4614f1a97e1a libtwamr: integrate cbsearch.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
122 else
4614f1a97e1a libtwamr: integrate cbsearch.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
123 { /* MR122 */
4614f1a97e1a libtwamr: integrate cbsearch.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
124 /*-------------------------------------------------------------*
4614f1a97e1a libtwamr: integrate cbsearch.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
125 * - include pitch contribution into impulse resp. h1[] *
4614f1a97e1a libtwamr: integrate cbsearch.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
126 *-------------------------------------------------------------*/
4614f1a97e1a libtwamr: integrate cbsearch.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
127 test (); test (); test ();
4614f1a97e1a libtwamr: integrate cbsearch.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
128
4614f1a97e1a libtwamr: integrate cbsearch.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
129 /* pit_sharpTmp = gain_pit; */
4614f1a97e1a libtwamr: integrate cbsearch.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
130 /* if (pit_sharpTmp > 1.0) pit_sharpTmp = 1.0; */
4614f1a97e1a libtwamr: integrate cbsearch.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
131 pit_sharpTmp = shl (gain_pit, 1);
4614f1a97e1a libtwamr: integrate cbsearch.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
132
4614f1a97e1a libtwamr: integrate cbsearch.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
133 for (i = T0; i < L_SUBFR; i++)
4614f1a97e1a libtwamr: integrate cbsearch.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
134 {
4614f1a97e1a libtwamr: integrate cbsearch.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
135 temp = mult(h[i - T0], pit_sharpTmp);
4614f1a97e1a libtwamr: integrate cbsearch.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
136 h[i] = add(h[i], temp); move16 ();
4614f1a97e1a libtwamr: integrate cbsearch.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
137 }
4614f1a97e1a libtwamr: integrate cbsearch.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
138 /*--------------------------------------------------------------*
4614f1a97e1a libtwamr: integrate cbsearch.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
139 * - Innovative codebook search (find index and gain) *
4614f1a97e1a libtwamr: integrate cbsearch.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
140 *--------------------------------------------------------------*/
4614f1a97e1a libtwamr: integrate cbsearch.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
141
4614f1a97e1a libtwamr: integrate cbsearch.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
142 code_10i40_35bits (x, res2, h, code, y, *anap);
4614f1a97e1a libtwamr: integrate cbsearch.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
143 *anap += 10; add(0,0);
4614f1a97e1a libtwamr: integrate cbsearch.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
144
4614f1a97e1a libtwamr: integrate cbsearch.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
145 /*-------------------------------------------------------*
4614f1a97e1a libtwamr: integrate cbsearch.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
146 * - Add the pitch contribution to code[]. *
4614f1a97e1a libtwamr: integrate cbsearch.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
147 *-------------------------------------------------------*/
4614f1a97e1a libtwamr: integrate cbsearch.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
148 for (i = T0; i < L_SUBFR; i++)
4614f1a97e1a libtwamr: integrate cbsearch.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
149 {
4614f1a97e1a libtwamr: integrate cbsearch.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
150 temp = mult (code[i - T0], pit_sharpTmp);
4614f1a97e1a libtwamr: integrate cbsearch.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
151 code[i] = add (code[i], temp); move16 ();
4614f1a97e1a libtwamr: integrate cbsearch.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
152 }
4614f1a97e1a libtwamr: integrate cbsearch.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
153 }
4614f1a97e1a libtwamr: integrate cbsearch.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
154
4614f1a97e1a libtwamr: integrate cbsearch.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
155 return 0;
4614f1a97e1a libtwamr: integrate cbsearch.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
156 }