comparison libgsmefr/dec_lag6.c @ 190:f387ee919f2c

libgsmefr/dec_lag6.c: perf opt
author Mychaela Falconia <falcon@freecalypso.org>
date Tue, 03 Jan 2023 04:04:59 +0000
parents cb080ec1817e
children
comparison
equal deleted inserted replaced
189:7dd6336e15b2 190:f387ee919f2c
41 Word16 pit_flag; 41 Word16 pit_flag;
42 Word16 T0, i; 42 Word16 T0, i;
43 43
44 pit_flag = i_subfr; move16 (); /* flag for 1st or 3rd subframe */ 44 pit_flag = i_subfr; move16 (); /* flag for 1st or 3rd subframe */
45 test (); 45 test ();
46 if (sub (i_subfr, L_frame_by2) == 0) 46 if (i_subfr == L_frame_by2)
47 { 47 {
48 pit_flag = 0; move16 (); 48 pit_flag = 0; move16 ();
49 } 49 }
50 test (); 50 test ();
51 if (pit_flag == 0) /* if 1st or 3rd subframe */ 51 if (pit_flag == 0) /* if 1st or 3rd subframe */
52 { 52 {
53 test (); 53 test ();
54 if (bfi == 0) 54 if (bfi == 0)
55 { /* if bfi == 0 decode pitch */ 55 { /* if bfi == 0 decode pitch */
56 test (); 56 test ();
57 if (sub (index, 463) < 0) 57 if (index < 463)
58 { 58 {
59 /* T0 = (index+5)/6 + 17 */ 59 /* T0 = (index+5)/6 + 17 */
60 T0 = add (mult (add (index, 5), 5462), 17); 60 T0 = add (mult (add (index, 5), 5462), 17);
61 i = add (add (T0, T0), T0); 61 i = add (add (T0, T0), T0);
62 /* *T0_frac = index - T0*6 + 105 */ 62 /* *T0_frac = index - T0*6 + 105 */
63 *T0_frac = add (sub (index, add (i, i)), 105); 63 *T0_frac = add (sub (index, add (i, i)), 105);
64 move16 (); 64 move16 ();
65 } 65 }
66 else 66 else
67 { 67 {
68 T0 = sub (index, 368); 68 T0 = index - 368;
69 *T0_frac = 0; move16 (); 69 *T0_frac = 0; move16 ();
70 } 70 }
71 } 71 }
72 else 72 else
73 /* bfi == 1 */ 73 /* bfi == 1 */
77 } 77 }
78 78
79 /* find T0_min and T0_max for 2nd (or 4th) subframe */ 79 /* find T0_min and T0_max for 2nd (or 4th) subframe */
80 80
81 *T0_min = sub (T0, 5); 81 *T0_min = sub (T0, 5);
82 if (sub (*T0_min, pit_min) < 0) 82 if (*T0_min < pit_min)
83 { 83 {
84 *T0_min = pit_min; 84 *T0_min = pit_min;
85 } 85 }
86 *T0_max = add (*T0_min, 9); 86 *T0_max = add (*T0_min, 9);
87 if (sub (*T0_max, pit_max) > 0) 87 if (*T0_max > pit_max)
88 { 88 {
89 *T0_max = pit_max; 89 *T0_max = pit_max;
90 *T0_min = sub (*T0_max, 9); 90 *T0_min = sub (*T0_max, 9);
91 } 91 }
92 } 92 }
93 else 93 else
94 /* second or fourth subframe */ 94 /* second or fourth subframe */
95 { 95 {
96 test (); test (); 96 test (); test ();
97 /* if bfi == 0 decode pitch */ 97 /* if bfi == 0 decode pitch */
98 if ((bfi == 0) && (sub (index, 61) < 0)) 98 if ((bfi == 0) && (index < 61))
99 { 99 {
100 /* i = (index+5)/6 - 1 */ 100 /* i = (index+5)/6 - 1 */
101 i = sub (mult (add (index, 5), 5462), 1); 101 i = sub (mult (add (index, 5), 5462), 1);
102 T0 = add (i, *T0_min); 102 T0 = add (i, *T0_min);
103 i = add (add (i, i), i); 103 i = add (add (i, i), i);