annotate libtwamr/enc_lag3.c @ 470:ea89eb8291bf

libgsmefr: add RTP-encoded DHF const datum to public API
author Mychaela Falconia <falcon@freecalypso.org>
date Tue, 14 May 2024 07:13:59 +0000
parents 0349de7c45b7
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
363
0349de7c45b7 libtwamr: integrate enc_lag[36].c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1 /*
0349de7c45b7 libtwamr: integrate enc_lag[36].c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
2 ********************************************************************************
0349de7c45b7 libtwamr: integrate enc_lag[36].c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
3 *
0349de7c45b7 libtwamr: integrate enc_lag[36].c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
4 * GSM AMR-NB speech codec R98 Version 7.6.0 December 12, 2001
0349de7c45b7 libtwamr: integrate enc_lag[36].c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
5 * R99 Version 3.3.0
0349de7c45b7 libtwamr: integrate enc_lag[36].c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
6 * REL-4 Version 4.1.0
0349de7c45b7 libtwamr: integrate enc_lag[36].c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
7 *
0349de7c45b7 libtwamr: integrate enc_lag[36].c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
8 ********************************************************************************
0349de7c45b7 libtwamr: integrate enc_lag[36].c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
9 *
0349de7c45b7 libtwamr: integrate enc_lag[36].c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
10 * File : enc_lag3.c
0349de7c45b7 libtwamr: integrate enc_lag[36].c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
11 * Purpose : Encoding of fractional pitch lag with 1/3 resolution.
0349de7c45b7 libtwamr: integrate enc_lag[36].c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
12 *
0349de7c45b7 libtwamr: integrate enc_lag[36].c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
13 ********************************************************************************
0349de7c45b7 libtwamr: integrate enc_lag[36].c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
14 */
0349de7c45b7 libtwamr: integrate enc_lag[36].c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
15 /*
0349de7c45b7 libtwamr: integrate enc_lag[36].c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
16 ********************************************************************************
0349de7c45b7 libtwamr: integrate enc_lag[36].c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
17 * MODULE INCLUDE FILE AND VERSION ID
0349de7c45b7 libtwamr: integrate enc_lag[36].c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
18 ********************************************************************************
0349de7c45b7 libtwamr: integrate enc_lag[36].c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
19 */
0349de7c45b7 libtwamr: integrate enc_lag[36].c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
20 #include "namespace.h"
0349de7c45b7 libtwamr: integrate enc_lag[36].c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
21 #include "enc_lag3.h"
0349de7c45b7 libtwamr: integrate enc_lag[36].c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
22
0349de7c45b7 libtwamr: integrate enc_lag[36].c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
23 /*
0349de7c45b7 libtwamr: integrate enc_lag[36].c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
24 ********************************************************************************
0349de7c45b7 libtwamr: integrate enc_lag[36].c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
25 * INCLUDE FILES
0349de7c45b7 libtwamr: integrate enc_lag[36].c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
26 ********************************************************************************
0349de7c45b7 libtwamr: integrate enc_lag[36].c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
27 */
0349de7c45b7 libtwamr: integrate enc_lag[36].c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
28 #include "typedef.h"
0349de7c45b7 libtwamr: integrate enc_lag[36].c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
29 #include "basic_op.h"
0349de7c45b7 libtwamr: integrate enc_lag[36].c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
30 #include "no_count.h"
0349de7c45b7 libtwamr: integrate enc_lag[36].c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
31 #include "cnst.h"
0349de7c45b7 libtwamr: integrate enc_lag[36].c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
32
0349de7c45b7 libtwamr: integrate enc_lag[36].c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
33 /*
0349de7c45b7 libtwamr: integrate enc_lag[36].c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
34 ********************************************************************************
0349de7c45b7 libtwamr: integrate enc_lag[36].c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
35 * PUBLIC PROGRAM CODE
0349de7c45b7 libtwamr: integrate enc_lag[36].c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
36 ********************************************************************************
0349de7c45b7 libtwamr: integrate enc_lag[36].c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
37 */
0349de7c45b7 libtwamr: integrate enc_lag[36].c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
38 /*************************************************************************
0349de7c45b7 libtwamr: integrate enc_lag[36].c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
39 *
0349de7c45b7 libtwamr: integrate enc_lag[36].c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
40 * FUNCTION: Enc_lag3
0349de7c45b7 libtwamr: integrate enc_lag[36].c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
41 *
0349de7c45b7 libtwamr: integrate enc_lag[36].c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
42 * PURPOSE: Encoding of fractional pitch lag with 1/3 resolution.
0349de7c45b7 libtwamr: integrate enc_lag[36].c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
43 *
0349de7c45b7 libtwamr: integrate enc_lag[36].c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
44 * DESCRIPTION:
0349de7c45b7 libtwamr: integrate enc_lag[36].c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
45 * First and third subframes:
0349de7c45b7 libtwamr: integrate enc_lag[36].c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
46 * --------------------------
0349de7c45b7 libtwamr: integrate enc_lag[36].c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
47 * The pitch range is divided as follows:
0349de7c45b7 libtwamr: integrate enc_lag[36].c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
48 * 19 1/3 to 84 2/3 resolution 1/3
0349de7c45b7 libtwamr: integrate enc_lag[36].c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
49 * 85 to 143 resolution 1
0349de7c45b7 libtwamr: integrate enc_lag[36].c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
50 *
0349de7c45b7 libtwamr: integrate enc_lag[36].c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
51 * The period is encoded with 8 bits.
0349de7c45b7 libtwamr: integrate enc_lag[36].c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
52 * For the range with fractions:
0349de7c45b7 libtwamr: integrate enc_lag[36].c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
53 * index = (T-19)*3 + frac - 1;
0349de7c45b7 libtwamr: integrate enc_lag[36].c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
54 * where T=[19..85] and frac=[-1,0,1]
0349de7c45b7 libtwamr: integrate enc_lag[36].c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
55 * and for the integer only range
0349de7c45b7 libtwamr: integrate enc_lag[36].c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
56 * index = (T - 85) + 197; where T=[86..143]
0349de7c45b7 libtwamr: integrate enc_lag[36].c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
57 *
0349de7c45b7 libtwamr: integrate enc_lag[36].c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
58 * Second and fourth subframes:
0349de7c45b7 libtwamr: integrate enc_lag[36].c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
59 * ----------------------------
0349de7c45b7 libtwamr: integrate enc_lag[36].c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
60 * For the 2nd and 4th subframes a resolution of 1/3 is always used,
0349de7c45b7 libtwamr: integrate enc_lag[36].c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
61 * and the search range is relative to the lag in previous subframe.
0349de7c45b7 libtwamr: integrate enc_lag[36].c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
62 * If t0 is the lag in the previous subframe then
0349de7c45b7 libtwamr: integrate enc_lag[36].c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
63 * t_min=t0-5 and t_max=t0+4 and the range is given by
0349de7c45b7 libtwamr: integrate enc_lag[36].c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
64 * t_min - 2/3 to t_max + 2/3
0349de7c45b7 libtwamr: integrate enc_lag[36].c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
65 *
0349de7c45b7 libtwamr: integrate enc_lag[36].c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
66 * The period in the 2nd (and 4th) subframe is encoded with 5 bits:
0349de7c45b7 libtwamr: integrate enc_lag[36].c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
67 * index = (T-(t_min-1))*3 + frac - 1;
0349de7c45b7 libtwamr: integrate enc_lag[36].c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
68 * where T=[t_min-1..t_max+1]
0349de7c45b7 libtwamr: integrate enc_lag[36].c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
69 *
0349de7c45b7 libtwamr: integrate enc_lag[36].c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
70 *************************************************************************/
0349de7c45b7 libtwamr: integrate enc_lag[36].c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
71 Word16
0349de7c45b7 libtwamr: integrate enc_lag[36].c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
72 Enc_lag3( /* o : Return index of encoding */
0349de7c45b7 libtwamr: integrate enc_lag[36].c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
73 Word16 T0, /* i : Pitch delay */
0349de7c45b7 libtwamr: integrate enc_lag[36].c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
74 Word16 T0_frac, /* i : Fractional pitch delay */
0349de7c45b7 libtwamr: integrate enc_lag[36].c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
75 Word16 T0_prev, /* i : Integer pitch delay of last subframe */
0349de7c45b7 libtwamr: integrate enc_lag[36].c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
76 Word16 T0_min, /* i : minimum of search range */
0349de7c45b7 libtwamr: integrate enc_lag[36].c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
77 Word16 T0_max, /* i : maximum of search range */
0349de7c45b7 libtwamr: integrate enc_lag[36].c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
78 Word16 delta_flag, /* i : Flag for 1st (or 3rd) subframe */
0349de7c45b7 libtwamr: integrate enc_lag[36].c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
79 Word16 flag4 /* i : Flag for encoding with 4 bits */
0349de7c45b7 libtwamr: integrate enc_lag[36].c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
80 )
0349de7c45b7 libtwamr: integrate enc_lag[36].c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
81 {
0349de7c45b7 libtwamr: integrate enc_lag[36].c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
82 Word16 index, i, tmp_ind, uplag;
0349de7c45b7 libtwamr: integrate enc_lag[36].c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
83 Word16 tmp_lag;
0349de7c45b7 libtwamr: integrate enc_lag[36].c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
84
0349de7c45b7 libtwamr: integrate enc_lag[36].c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
85 test ();
0349de7c45b7 libtwamr: integrate enc_lag[36].c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
86 if (delta_flag == 0)
0349de7c45b7 libtwamr: integrate enc_lag[36].c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
87 { /* if 1st or 3rd subframe */
0349de7c45b7 libtwamr: integrate enc_lag[36].c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
88
0349de7c45b7 libtwamr: integrate enc_lag[36].c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
89 /* encode pitch delay (with fraction) */
0349de7c45b7 libtwamr: integrate enc_lag[36].c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
90
0349de7c45b7 libtwamr: integrate enc_lag[36].c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
91 test ();
0349de7c45b7 libtwamr: integrate enc_lag[36].c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
92 if (sub (T0, 85) <= 0)
0349de7c45b7 libtwamr: integrate enc_lag[36].c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
93 {
0349de7c45b7 libtwamr: integrate enc_lag[36].c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
94 /* index = T0*3 - 58 + T0_frac */
0349de7c45b7 libtwamr: integrate enc_lag[36].c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
95 i = add (add (T0, T0), T0);
0349de7c45b7 libtwamr: integrate enc_lag[36].c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
96 index = add (sub (i, 58), T0_frac);
0349de7c45b7 libtwamr: integrate enc_lag[36].c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
97 }
0349de7c45b7 libtwamr: integrate enc_lag[36].c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
98 else
0349de7c45b7 libtwamr: integrate enc_lag[36].c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
99 {
0349de7c45b7 libtwamr: integrate enc_lag[36].c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
100 index = add (T0, 112);
0349de7c45b7 libtwamr: integrate enc_lag[36].c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
101 }
0349de7c45b7 libtwamr: integrate enc_lag[36].c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
102 }
0349de7c45b7 libtwamr: integrate enc_lag[36].c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
103 else
0349de7c45b7 libtwamr: integrate enc_lag[36].c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
104 { /* if second or fourth subframe */
0349de7c45b7 libtwamr: integrate enc_lag[36].c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
105 test ();
0349de7c45b7 libtwamr: integrate enc_lag[36].c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
106 if (flag4 == 0) {
0349de7c45b7 libtwamr: integrate enc_lag[36].c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
107
0349de7c45b7 libtwamr: integrate enc_lag[36].c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
108 /* 'normal' encoding: either with 5 or 6 bit resolution */
0349de7c45b7 libtwamr: integrate enc_lag[36].c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
109
0349de7c45b7 libtwamr: integrate enc_lag[36].c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
110 /* index = 3*(T0 - T0_min) + 2 + T0_frac */
0349de7c45b7 libtwamr: integrate enc_lag[36].c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
111 i = sub (T0, T0_min);
0349de7c45b7 libtwamr: integrate enc_lag[36].c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
112 i = add (add (i, i), i);
0349de7c45b7 libtwamr: integrate enc_lag[36].c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
113 index = add (add (i, 2), T0_frac);
0349de7c45b7 libtwamr: integrate enc_lag[36].c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
114 }
0349de7c45b7 libtwamr: integrate enc_lag[36].c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
115 else {
0349de7c45b7 libtwamr: integrate enc_lag[36].c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
116
0349de7c45b7 libtwamr: integrate enc_lag[36].c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
117 /* encoding with 4 bit resolution */
0349de7c45b7 libtwamr: integrate enc_lag[36].c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
118
0349de7c45b7 libtwamr: integrate enc_lag[36].c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
119 tmp_lag = T0_prev; move16 ();
0349de7c45b7 libtwamr: integrate enc_lag[36].c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
120
0349de7c45b7 libtwamr: integrate enc_lag[36].c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
121 test ();
0349de7c45b7 libtwamr: integrate enc_lag[36].c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
122 if ( sub( sub(tmp_lag, T0_min), 5) > 0)
0349de7c45b7 libtwamr: integrate enc_lag[36].c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
123 tmp_lag = add (T0_min, 5);
0349de7c45b7 libtwamr: integrate enc_lag[36].c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
124 test ();
0349de7c45b7 libtwamr: integrate enc_lag[36].c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
125 if ( sub( sub(T0_max, tmp_lag), 4) > 0)
0349de7c45b7 libtwamr: integrate enc_lag[36].c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
126 tmp_lag = sub (T0_max, 4);
0349de7c45b7 libtwamr: integrate enc_lag[36].c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
127
0349de7c45b7 libtwamr: integrate enc_lag[36].c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
128 uplag = add (add (add (T0, T0), T0), T0_frac);
0349de7c45b7 libtwamr: integrate enc_lag[36].c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
129
0349de7c45b7 libtwamr: integrate enc_lag[36].c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
130 i = sub (tmp_lag, 2);
0349de7c45b7 libtwamr: integrate enc_lag[36].c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
131 tmp_ind = add (add (i, i), i);
0349de7c45b7 libtwamr: integrate enc_lag[36].c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
132
0349de7c45b7 libtwamr: integrate enc_lag[36].c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
133 test ();
0349de7c45b7 libtwamr: integrate enc_lag[36].c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
134 if (sub (tmp_ind, uplag) >= 0) {
0349de7c45b7 libtwamr: integrate enc_lag[36].c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
135 index = add (sub (T0, tmp_lag), 5);
0349de7c45b7 libtwamr: integrate enc_lag[36].c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
136 }
0349de7c45b7 libtwamr: integrate enc_lag[36].c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
137 else
0349de7c45b7 libtwamr: integrate enc_lag[36].c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
138 {
0349de7c45b7 libtwamr: integrate enc_lag[36].c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
139 i = add (tmp_lag, 1);
0349de7c45b7 libtwamr: integrate enc_lag[36].c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
140 i = add (add (i, i), i);
0349de7c45b7 libtwamr: integrate enc_lag[36].c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
141
0349de7c45b7 libtwamr: integrate enc_lag[36].c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
142 test ();
0349de7c45b7 libtwamr: integrate enc_lag[36].c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
143 if (sub (i, uplag) > 0) {
0349de7c45b7 libtwamr: integrate enc_lag[36].c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
144 index = add ( sub (uplag, tmp_ind), 3);
0349de7c45b7 libtwamr: integrate enc_lag[36].c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
145 }
0349de7c45b7 libtwamr: integrate enc_lag[36].c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
146 else {
0349de7c45b7 libtwamr: integrate enc_lag[36].c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
147 index = add (sub (T0, tmp_lag), 11);
0349de7c45b7 libtwamr: integrate enc_lag[36].c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
148 }
0349de7c45b7 libtwamr: integrate enc_lag[36].c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
149 }
0349de7c45b7 libtwamr: integrate enc_lag[36].c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
150
0349de7c45b7 libtwamr: integrate enc_lag[36].c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
151 } /* end if (encoding with 4 bit resolution) */
0349de7c45b7 libtwamr: integrate enc_lag[36].c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
152 } /* end if (second of fourth subframe) */
0349de7c45b7 libtwamr: integrate enc_lag[36].c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
153
0349de7c45b7 libtwamr: integrate enc_lag[36].c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
154 return index;
0349de7c45b7 libtwamr: integrate enc_lag[36].c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
155 }