Coverage Report

Created: 2026-03-31 06:52

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libxaac/decoder/ixheaacd_mps_res_block.c
Line
Count
Source
1
/******************************************************************************
2
 *
3
 * Copyright (C) 2023 The Android Open Source Project
4
 *
5
 * Licensed under the Apache License, Version 2.0 (the "License");
6
 * you may not use this file except in compliance with the License.
7
 * You may obtain a copy of the License at:
8
 *
9
 * http://www.apache.org/licenses/LICENSE-2.0
10
 *
11
 * Unless required by applicable law or agreed to in writing, software
12
 * distributed under the License is distributed on an "AS IS" BASIS,
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
16
 *
17
 *****************************************************************************
18
 * Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
19
*/
20
#include "ixheaac_type_def.h"
21
#include "ixheaac_constants.h"
22
#include "ixheaac_basic_ops32.h"
23
#include "ixheaac_basic_ops40.h"
24
#include "ixheaac_basic_ops.h"
25
#include "ixheaacd_bitbuffer.h"
26
#include "ixheaac_basic_op.h"
27
#include "ixheaacd_mps_aac_struct.h"
28
#include "ixheaacd_mps_res_rom.h"
29
#include "ixheaacd_mps_res_block.h"
30
#include "ixheaacd_mps_res_huffman.h"
31
32
static PLATFORM_INLINE WORD32 ixheaacd_res_extract_symbol(WORD32 value, WORD32 l_shift,
33
22.4k
                                                          WORD32 r_shift, WORD32 *pow_table_q17) {
34
22.4k
  WORD32 out;
35
22.4k
  out = (WORD16)((value << l_shift) >> r_shift);
36
37
22.4k
  if (out < 0) {
38
7.43k
    out = -out;
39
7.43k
    out = pow_table_q17[out];
40
7.43k
    out = -out;
41
7.43k
  } else
42
15.0k
    out = pow_table_q17[out];
43
44
22.4k
  return out;
45
22.4k
}
46
47
static PLATFORM_INLINE WORD32 ixheaacd_res_extract_signed_symbol(WORD32 value, WORD32 l_shift,
48
                                                                 WORD32 r_shift,
49
                                                                 WORD32 *pow_table_q17,
50
                                                                 WORD32 *temp_word,
51
88.1k
                                                                 WORD32 *pr_bit_pos) {
52
88.1k
  WORD32 out;
53
88.1k
  out = ixheaac_extu(value, l_shift, r_shift);
54
88.1k
  if (out) {
55
32.5k
    WORD32 bit_pos = *pr_bit_pos;
56
32.5k
    out = pow_table_q17[out];
57
32.5k
    if (*temp_word & 0x80000000) {
58
20.2k
      out = -out;
59
20.2k
    }
60
32.5k
    *temp_word = *temp_word << 1;
61
32.5k
    bit_pos++;
62
32.5k
    *pr_bit_pos = bit_pos;
63
32.5k
  }
64
88.1k
  return out;
65
88.1k
}
66
67
VOID ixheaacd_res_inverse_quant_lb(WORD32 *x_invquant, WORD t_bands, WORD32 *pow_table_q17,
68
76
                                   WORD8 *pulse_data) {
69
76
  WORD32 j;
70
76
  WORD32 temp;
71
76
  WORD32 q_abs;
72
73
10.3k
  for (j = t_bands - 1; j >= 0; j--) {
74
10.2k
    q_abs = *pulse_data++;
75
10.2k
    temp = (pow_table_q17[q_abs]);
76
10.2k
    *x_invquant++ = -temp;
77
10.2k
  }
78
76
}
79
80
static PLATFORM_INLINE WORD ixheaacd_res_c_block_decode_huff_word1(
81
    ia_bit_buf_struct *it_bit_buf, WORD32 *qp, WORD16 *offsets, WORD no_bands, WORD group_no,
82
126
    const UWORD16 *h_ori, WORD32 *pow_table_q17, WORD32 maximum_bins_short) {
83
126
  WORD32 sp1, sp2;
84
126
  WORD32 flush_cw;
85
126
  WORD32 i, value, norm_val, off;
86
126
  WORD idx, grp_idx;
87
126
  WORD32 out1, out2;
88
126
  WORD32 err_code = 0;
89
126
  WORD len_idx = 0;
90
126
  UWORD8 *ptr_read_next = it_bit_buf->ptr_read_next;
91
126
  WORD32 bit_pos = it_bit_buf->bit_pos;
92
126
  WORD32 read_word = ixheaacd_res_aac_showbits_32(ptr_read_next);
93
126
  ptr_read_next += 4;
94
95
411
  do {
96
411
    len_idx = offsets[1] - offsets[0];
97
411
    grp_idx = group_no;
98
2.58k
    do {
99
2.58k
      qp = qp + offsets[0];
100
2.58k
      idx = len_idx;
101
14.0k
      do {
102
14.0k
        {
103
14.0k
          UWORD16 first_offset;
104
14.0k
          WORD16 sign_ret_val;
105
14.0k
          UWORD32 read_word1;
106
14.0k
          UWORD16 *h;
107
108
14.0k
          read_word1 = read_word << bit_pos;
109
110
14.0k
          h = (UWORD16 *)h_ori;
111
14.0k
          h += (read_word1) >> (27);
112
14.0k
          sign_ret_val = *h;
113
114
14.0k
          first_offset = 5;
115
24.6k
          while (sign_ret_val > 0) {
116
10.6k
            bit_pos += first_offset;
117
10.6k
            ixheaacd_aac_read_byte_corr(&ptr_read_next, &bit_pos, &read_word,
118
10.6k
                                        it_bit_buf->ptr_bit_buf_end);
119
10.6k
            read_word1 = (read_word1) << (first_offset);
120
10.6k
            first_offset = (sign_ret_val >> 11);
121
10.6k
            h += sign_ret_val & (0x07FF);
122
10.6k
            h += (read_word1) >> (32 - first_offset);
123
10.6k
            sign_ret_val = *h;
124
10.6k
          }
125
14.0k
          bit_pos += ((sign_ret_val & 0x7fff) >> 11);
126
14.0k
          bit_pos = min(bit_pos, 31);
127
14.0k
          value = sign_ret_val & (0x07FF);
128
14.0k
        }
129
14.0k
        out1 = (value & 0x3E0) >> 5;
130
14.0k
        out2 = value & 0x1F;
131
132
14.0k
        flush_cw = read_word << bit_pos;
133
134
14.0k
        sp1 = out1;
135
14.0k
        sp2 = out2;
136
137
14.0k
        if (out1) {
138
10.7k
          if (flush_cw & 0x80000000) {
139
9.86k
            out1 = -out1;
140
9.86k
          }
141
10.7k
          bit_pos++;
142
10.7k
          flush_cw = (WORD32)flush_cw << 1;
143
10.7k
        }
144
145
14.0k
        if (out2) {
146
10.7k
          bit_pos++;
147
10.7k
          if (flush_cw & 0x80000000) {
148
724
            out2 = -out2;
149
724
          }
150
10.7k
        }
151
152
14.0k
        ixheaacd_aac_read_byte_corr(&ptr_read_next, &bit_pos, &read_word,
153
14.0k
                                    it_bit_buf->ptr_bit_buf_end);
154
14.0k
        if (sp1 == 16) {
155
297
          i = 4;
156
297
          value = ixheaac_extu(read_word, bit_pos, 23);
157
297
          value = value | 0xfffffe00;
158
297
          norm_val = ixheaac_norm32(value);
159
160
297
          i += (norm_val - 22);
161
297
          bit_pos += (norm_val - 21);
162
163
297
          ixheaacd_aac_read_byte_corr(&ptr_read_next, &bit_pos, &read_word,
164
297
                                      it_bit_buf->ptr_bit_buf_end);
165
166
297
          off = ixheaac_extu(read_word, bit_pos, 32 - i);
167
168
297
          bit_pos += i;
169
170
297
          ixheaacd_aac_read_byte_corr(&ptr_read_next, &bit_pos, &read_word,
171
297
                                      it_bit_buf->ptr_bit_buf_end);
172
173
297
          ixheaacd_aac_read_byte_corr(&ptr_read_next, &bit_pos, &read_word,
174
297
                                      it_bit_buf->ptr_bit_buf_end);
175
176
297
          i = off + ((WORD32)1 << i);
177
178
297
          if (i <= IQ_TABLE_SIZE_HALF)
179
230
            i = pow_table_q17[i];
180
67
          else {
181
67
            err_code |= ixheaacd_res_inv_quant(&i, pow_table_q17);
182
67
          }
183
184
297
          if (out1 < 0) {
185
80
            out1 = -i;
186
217
          } else {
187
217
            out1 = i;
188
217
          }
189
297
          *qp++ = out1;
190
13.7k
        } else {
191
13.7k
          if (out1 <= 0) {
192
13.0k
            out1 = -out1;
193
13.0k
            out1 = pow_table_q17[out1];
194
13.0k
            *qp++ = -out1;
195
13.0k
          } else {
196
647
            out1 = pow_table_q17[out1];
197
647
            *qp++ = out1;
198
647
          }
199
13.7k
        }
200
14.0k
        if (sp2 == 16) {
201
354
          i = 4;
202
354
          value = ixheaac_extu(read_word, bit_pos, 23);
203
354
          value = value | 0xfffffe00;
204
354
          norm_val = ixheaac_norm32(value);
205
206
354
          i += (norm_val - 22);
207
208
354
          bit_pos += (norm_val - 21);
209
210
354
          ixheaacd_aac_read_byte_corr(&ptr_read_next, &bit_pos, &read_word,
211
354
                                      it_bit_buf->ptr_bit_buf_end);
212
213
354
          off = ixheaac_extu(read_word, bit_pos, 32 - i);
214
215
354
          bit_pos += i;
216
217
354
          ixheaacd_aac_read_byte_corr(&ptr_read_next, &bit_pos, &read_word,
218
354
                                      it_bit_buf->ptr_bit_buf_end);
219
220
354
          ixheaacd_aac_read_byte_corr(&ptr_read_next, &bit_pos, &read_word,
221
354
                                      it_bit_buf->ptr_bit_buf_end);
222
223
354
          i = off + ((WORD32)1 << i);
224
225
354
          if (i <= IQ_TABLE_SIZE_HALF)
226
266
            i = pow_table_q17[i];
227
88
          else {
228
88
            err_code |= ixheaacd_res_inv_quant(&i, pow_table_q17);
229
88
          }
230
231
354
          if (out2 < 0) {
232
167
            out2 = -i;
233
187
          } else {
234
187
            out2 = i;
235
187
          }
236
354
          *qp++ = out2;
237
13.6k
        } else {
238
13.6k
          if (out2 <= 0) {
239
3.85k
            out2 = -out2;
240
3.85k
            out2 = pow_table_q17[out2];
241
3.85k
            *qp++ = -out2;
242
9.79k
          } else {
243
9.79k
            out2 = pow_table_q17[out2];
244
9.79k
            *qp++ = out2;
245
9.79k
          }
246
13.6k
        }
247
248
14.0k
        idx -= 2;
249
14.0k
      } while (idx != 0);
250
251
2.58k
      qp += (maximum_bins_short - offsets[1]);
252
2.58k
      grp_idx--;
253
2.58k
    } while (grp_idx != 0);
254
255
411
    offsets++;
256
411
    qp -= (maximum_bins_short * group_no);
257
411
    no_bands--;
258
411
  } while (no_bands >= 0);
259
260
126
  it_bit_buf->bit_pos = bit_pos;
261
126
  it_bit_buf->ptr_read_next = ptr_read_next - 4;
262
263
126
  return err_code;
264
126
}
265
266
static PLATFORM_INLINE WORD ixheaacd_res_c_block_decode_huff_word1_lb(
267
    ia_bit_buf_struct *it_bif_buf, WORD32 len, const UWORD16 *h_ori, WORD32 *x_invquant,
268
67
    WORD32 *pow_table_q17, WORD8 *p_pul_arr) {
269
67
  WORD32 sp1, sp2;
270
67
  WORD32 flush_cw;
271
67
  WORD32 i, value, norm_val, off;
272
67
  WORD idx;
273
67
  WORD32 out1, out2;
274
67
  WORD32 err_code = 0;
275
67
  UWORD8 *ptr_read_next = it_bif_buf->ptr_read_next;
276
67
  WORD32 bit_pos = it_bif_buf->bit_pos;
277
67
  WORD32 read_word = ixheaacd_res_aac_showbits_32(ptr_read_next);
278
67
  ptr_read_next += 4;
279
280
6.15k
  for (idx = len; idx != 0; idx -= 2) {
281
6.08k
    {
282
6.08k
      UWORD16 first_offset;
283
6.08k
      WORD16 sign_ret_val;
284
6.08k
      UWORD32 read_word1;
285
6.08k
      UWORD16 *h;
286
287
6.08k
      read_word1 = read_word << bit_pos;
288
289
6.08k
      h = (UWORD16 *)h_ori;
290
6.08k
      h += (read_word1) >> (27);
291
6.08k
      sign_ret_val = *h;
292
293
6.08k
      first_offset = 5;
294
9.82k
      while (sign_ret_val > 0) {
295
3.74k
        bit_pos += first_offset;
296
3.74k
        ixheaacd_aac_read_byte_corr(&ptr_read_next, &bit_pos, &read_word,
297
3.74k
                                    it_bif_buf->ptr_bit_buf_end);
298
3.74k
        read_word1 = (read_word1) << (first_offset);
299
300
3.74k
        first_offset = (sign_ret_val >> 11);
301
3.74k
        h += sign_ret_val & (0x07FF);
302
303
3.74k
        h += (read_word1) >> (32 - first_offset);
304
3.74k
        sign_ret_val = *h;
305
3.74k
      }
306
6.08k
      bit_pos += ((sign_ret_val & 0x7fff) >> 11);
307
6.08k
      bit_pos = min(bit_pos, 31);
308
6.08k
      value = sign_ret_val & (0x07FF);
309
6.08k
    }
310
311
6.08k
    flush_cw = read_word << bit_pos;
312
313
6.08k
    out1 = (value & 0x3E0) >> 5;
314
6.08k
    out2 = value & 0x1F;
315
316
6.08k
    sp1 = out1;
317
318
6.08k
    if (out1) {
319
3.53k
      if (flush_cw & 0x80000000) {
320
2.39k
        out1 = -out1;
321
2.39k
      }
322
323
3.53k
      bit_pos++;
324
3.53k
      flush_cw = (WORD32)flush_cw << 1;
325
3.53k
    }
326
327
6.08k
    sp2 = out2;
328
6.08k
    if (out2) {
329
3.45k
      bit_pos++;
330
3.45k
      if (flush_cw & 0x80000000) {
331
707
        out2 = -out2;
332
707
      }
333
3.45k
    }
334
335
6.08k
    ixheaacd_aac_read_byte_corr(&ptr_read_next, &bit_pos, &read_word,
336
6.08k
                                it_bif_buf->ptr_bit_buf_end);
337
338
6.08k
    if (sp1 == 16) {
339
375
      i = 4;
340
375
      value = ixheaac_extu(read_word, bit_pos, 23);
341
375
      value = value | 0xfffffe00;
342
375
      norm_val = ixheaac_norm32(value);
343
375
      i += (norm_val - 22);
344
375
      bit_pos += (norm_val - 21);
345
346
375
      ixheaacd_aac_read_byte_corr(&ptr_read_next, &bit_pos, &read_word,
347
375
                                  it_bif_buf->ptr_bit_buf_end);
348
349
375
      off = ixheaac_extu(read_word, bit_pos, 32 - i);
350
351
375
      bit_pos += i;
352
353
375
      ixheaacd_aac_read_byte_corr(&ptr_read_next, &bit_pos, &read_word,
354
375
                                  it_bif_buf->ptr_bit_buf_end);
355
375
      value = *p_pul_arr++;
356
375
      ixheaacd_aac_read_byte_corr(&ptr_read_next, &bit_pos, &read_word,
357
375
                                  it_bif_buf->ptr_bit_buf_end);
358
375
      i = off + ((WORD32)1 << i);
359
375
      i = add_d(i, value);
360
361
375
      if (i <= IQ_TABLE_SIZE_HALF)
362
319
        i = pow_table_q17[i];
363
56
      else {
364
56
        err_code |= ixheaacd_res_inv_quant(&i, pow_table_q17);
365
56
      }
366
375
      if (out1 < 0) {
367
186
        i = -i;
368
186
      }
369
375
      *x_invquant++ = i;
370
5.70k
    } else {
371
5.70k
      WORD8 temp = *p_pul_arr++;
372
5.70k
      if (out1 <= 0) {
373
4.75k
        out1 = sub_d(temp, out1);
374
4.75k
        out1 = pow_table_q17[out1];
375
4.75k
        *x_invquant++ = -out1;
376
4.75k
      } else {
377
950
        out1 = add_d(out1, temp);
378
950
        out1 = pow_table_q17[out1];
379
950
        *x_invquant++ = out1;
380
950
      }
381
5.70k
    }
382
383
6.08k
    if (sp2 == 16) {
384
457
      i = 4;
385
457
      value = ixheaac_extu(read_word, bit_pos, 23);
386
457
      value = value | 0xfffffe00;
387
457
      norm_val = ixheaac_norm32(value);
388
389
457
      i += (norm_val - 22);
390
391
457
      bit_pos += (norm_val - 21);
392
393
457
      ixheaacd_aac_read_byte_corr(&ptr_read_next, &bit_pos, &read_word,
394
457
                                  it_bif_buf->ptr_bit_buf_end);
395
396
457
      off = ixheaac_extu(read_word, bit_pos, 32 - i);
397
398
457
      bit_pos += i;
399
400
457
      ixheaacd_aac_read_byte_corr(&ptr_read_next, &bit_pos, &read_word,
401
457
                                  it_bif_buf->ptr_bit_buf_end);
402
457
      value = *p_pul_arr++;
403
457
      ixheaacd_aac_read_byte_corr(&ptr_read_next, &bit_pos, &read_word,
404
457
                                  it_bif_buf->ptr_bit_buf_end);
405
406
457
      i = off + ((WORD32)1 << i);
407
457
      i = add_d(i, value);
408
457
      if (i <= IQ_TABLE_SIZE_HALF)
409
328
        i = pow_table_q17[i];
410
129
      else {
411
129
        err_code |= ixheaacd_res_inv_quant(&i, pow_table_q17);
412
129
      }
413
414
457
      if (out2 < 0) {
415
128
        i = -i;
416
128
      }
417
457
      *x_invquant++ = i;
418
5.62k
    } else {
419
5.62k
      WORD8 temp = *p_pul_arr++;
420
5.62k
      if (out2 <= 0) {
421
3.20k
        out2 = sub_d(temp, out2);
422
3.20k
        out2 = pow_table_q17[out2];
423
3.20k
        *x_invquant++ = -out2;
424
3.20k
      } else {
425
2.41k
        out2 = add_d(out2, temp);
426
2.41k
        out2 = pow_table_q17[out2];
427
2.41k
        *x_invquant++ = out2;
428
2.41k
      }
429
5.62k
    }
430
6.08k
  }
431
432
67
  it_bif_buf->ptr_read_next = ptr_read_next - 4;
433
67
  it_bif_buf->bit_pos = bit_pos;
434
435
67
  return err_code;
436
67
}
437
438
static PLATFORM_INLINE WORD ixheaacd_res_c_block_decode_huff_word2_4(
439
    ia_bit_buf_struct *it_bit_buf, WORD32 *qp, WORD16 *offsets, WORD no_bands, WORD group_no,
440
340
    const UWORD16 *h_ori, WORD32 *pow_table_q17, WORD32 sign, WORD32 maximum_bins_short) {
441
340
  WORD32 value;
442
340
  WORD idx, grp_idx;
443
340
  WORD idx_len;
444
340
  WORD32 *qp_org;
445
446
340
  UWORD8 *ptr_read_next = it_bit_buf->ptr_read_next;
447
340
  WORD32 bit_pos = it_bit_buf->bit_pos;
448
340
  WORD32 read_word = ixheaacd_res_aac_showbits_32(ptr_read_next);
449
340
  ptr_read_next += 4;
450
340
  qp_org = qp;
451
1.74k
  do {
452
1.74k
    idx_len = offsets[1] - offsets[0];
453
1.74k
    grp_idx = group_no;
454
455
11.3k
    do {
456
11.3k
      qp = qp + offsets[0];
457
11.3k
      idx = idx_len;
458
19.0k
      do {
459
19.0k
        UWORD16 first_offset;
460
19.0k
        WORD16 sign_ret_val;
461
19.0k
        UWORD32 read_word1;
462
19.0k
        UWORD16 *h;
463
464
19.0k
        read_word1 = read_word << bit_pos;
465
466
19.0k
        h = (UWORD16 *)h_ori;
467
19.0k
        h += (read_word1) >> (27);
468
19.0k
        sign_ret_val = *h;
469
470
19.0k
        first_offset = 5;
471
21.6k
        while (sign_ret_val > 0) {
472
2.53k
          bit_pos += first_offset;
473
2.53k
          ixheaacd_aac_read_byte_corr(&ptr_read_next, &bit_pos, &read_word,
474
2.53k
                                      it_bit_buf->ptr_bit_buf_end);
475
2.53k
          read_word1 = (read_word1) << (first_offset);
476
477
2.53k
          first_offset = (sign_ret_val >> 11);
478
2.53k
          h += sign_ret_val & (0x07FF);
479
480
2.53k
          h += (read_word1) >> (32 - first_offset);
481
2.53k
          sign_ret_val = *h;
482
2.53k
        }
483
19.0k
        bit_pos += ((sign_ret_val & 0x7fff) >> 11);
484
19.0k
        bit_pos = min(bit_pos, 31);
485
19.0k
        value = sign_ret_val & (0x07FF);
486
487
19.0k
        if (sign) {
488
16.0k
          WORD32 temp_word;
489
16.0k
          temp_word = read_word << bit_pos;
490
491
16.0k
          *qp++ = ixheaacd_res_extract_signed_symbol(value, 24, 30, pow_table_q17, &temp_word,
492
16.0k
                                                     &bit_pos);
493
16.0k
          *qp++ = ixheaacd_res_extract_signed_symbol(value, 26, 30, pow_table_q17, &temp_word,
494
16.0k
                                                     &bit_pos);
495
16.0k
          *qp++ = ixheaacd_res_extract_signed_symbol(value, 28, 30, pow_table_q17, &temp_word,
496
16.0k
                                                     &bit_pos);
497
16.0k
          *qp++ = ixheaacd_res_extract_signed_symbol(value, 30, 30, pow_table_q17, &temp_word,
498
16.0k
                                                     &bit_pos);
499
16.0k
        } else {
500
3.01k
          *qp++ = ixheaacd_res_extract_symbol(value, 24, 30, pow_table_q17);
501
3.01k
          *qp++ = ixheaacd_res_extract_symbol(value, 26, 30, pow_table_q17);
502
3.01k
          *qp++ = ixheaacd_res_extract_symbol(value, 28, 30, pow_table_q17);
503
3.01k
          *qp++ = ixheaacd_res_extract_symbol(value, 30, 30, pow_table_q17);
504
3.01k
        }
505
506
19.0k
        ixheaacd_aac_read_byte_corr(&ptr_read_next, &bit_pos, &read_word,
507
19.0k
                                    it_bit_buf->ptr_bit_buf_end);
508
19.0k
        idx -= 4;
509
19.0k
      } while (idx != 0);
510
511
11.3k
      qp += (maximum_bins_short - offsets[1]);
512
11.3k
      grp_idx--;
513
11.3k
    } while (grp_idx != 0);
514
1.74k
    offsets++;
515
1.74k
    qp = qp_org;
516
1.74k
    no_bands--;
517
1.74k
  } while (no_bands >= 0);
518
519
340
  it_bit_buf->ptr_read_next = ptr_read_next - 4;
520
340
  it_bit_buf->bit_pos = bit_pos;
521
522
340
  return 0;
523
340
}
524
525
static PLATFORM_INLINE WORD ixheaacd_res_c_block_decode_huff_word2_4_lb(
526
    ia_bit_buf_struct *it_bit_buf, WORD32 len, const UWORD16 *h_ori, WORD32 *x_invquant,
527
330
    WORD32 *pow_table_q17, WORD8 *p_pul_arr, WORD32 sign) {
528
330
  WORD32 value;
529
330
  WORD idx;
530
531
330
  UWORD8 *ptr_read_next = it_bit_buf->ptr_read_next;
532
330
  WORD32 bit_pos = it_bit_buf->bit_pos;
533
330
  WORD32 read_word = ixheaacd_res_aac_showbits_32(ptr_read_next);
534
330
  ptr_read_next += 4;
535
536
8.98k
  for (idx = len; idx != 0; idx -= 4) {
537
8.65k
    WORD32 res;
538
8.65k
    WORD32 ampres, ampres1;
539
8.65k
    WORD32 ampres2, ampres3;
540
8.65k
    UWORD16 first_offset;
541
8.65k
    WORD16 sign_ret_val;
542
8.65k
    UWORD32 read_word1;
543
8.65k
    UWORD16 *h;
544
545
8.65k
    read_word1 = read_word << bit_pos;
546
547
8.65k
    h = (UWORD16 *)h_ori;
548
8.65k
    h += (read_word1) >> (27);
549
8.65k
    sign_ret_val = *h;
550
551
8.65k
    first_offset = 5;
552
10.6k
    while (sign_ret_val > 0) {
553
1.97k
      bit_pos += first_offset;
554
1.97k
      ixheaacd_aac_read_byte_corr(&ptr_read_next, &bit_pos, &read_word,
555
1.97k
                                  it_bit_buf->ptr_bit_buf_end);
556
1.97k
      read_word1 = (read_word1) << (first_offset);
557
558
1.97k
      first_offset = (sign_ret_val >> 11);
559
1.97k
      h += sign_ret_val & (0x07FF);
560
561
1.97k
      h += (read_word1) >> (32 - first_offset);
562
1.97k
      sign_ret_val = *h;
563
1.97k
    }
564
8.65k
    bit_pos += ((sign_ret_val & 0x7fff) >> 11);
565
8.65k
    bit_pos = min(bit_pos, 31);
566
567
8.65k
    value = sign_ret_val & (0x07FF);
568
569
8.65k
    if (sign) {
570
4.16k
      WORD32 out0, out1, out2, out3;
571
4.16k
      WORD32 ampout0, ampout1, ampout2, ampout3;
572
4.16k
      WORD32 temp_word;
573
4.16k
      temp_word = read_word << bit_pos;
574
575
4.16k
      out0 = (ixheaac_extu(value, 24, 30));
576
4.16k
      ampout0 = add_d(out0, *p_pul_arr++);
577
4.16k
      ampout0 = pow_table_q17[ampout0];
578
579
4.16k
      if (out0) {
580
2.12k
        if (temp_word & 0x80000000) {
581
432
          ampout0 = -ampout0;
582
432
        }
583
2.12k
        temp_word = temp_word << 1;
584
2.12k
        bit_pos++;
585
2.12k
      } else {
586
2.03k
        ampout0 = -ampout0;
587
2.03k
      }
588
589
4.16k
      out1 = (ixheaac_extu(value, 26, 30));
590
4.16k
      ampout1 = add_d(out1, *p_pul_arr++);
591
4.16k
      ampout1 = pow_table_q17[ampout1];
592
4.16k
      if (out1) {
593
1.97k
        if (temp_word & 0x80000000) {
594
306
          ampout1 = -(ampout1);
595
306
        }
596
1.97k
        temp_word = temp_word << 1;
597
1.97k
        bit_pos++;
598
2.19k
      } else {
599
2.19k
        ampout1 = -ampout1;
600
2.19k
      }
601
4.16k
      out2 = (ixheaac_extu(value, 28, 30));
602
4.16k
      ampout2 = add_d(out2, *p_pul_arr++);
603
4.16k
      ampout2 = pow_table_q17[ampout2];
604
4.16k
      if (out2) {
605
2.32k
        if (temp_word & 0x80000000) {
606
633
          ampout2 = -(ampout2);
607
633
        }
608
2.32k
        temp_word = temp_word << 1;
609
2.32k
        bit_pos++;
610
2.32k
      } else {
611
1.83k
        ampout2 = -ampout2;
612
1.83k
      }
613
614
4.16k
      *x_invquant++ = ampout0;
615
4.16k
      *x_invquant++ = ampout1;
616
4.16k
      *x_invquant++ = ampout2;
617
618
4.16k
      out3 = (ixheaac_extu(value, 30, 30));
619
4.16k
      ampout3 = add_d(out3, *p_pul_arr++);
620
4.16k
      ampout3 = pow_table_q17[ampout3];
621
4.16k
      if (out3) {
622
2.29k
        if (temp_word & 0x80000000) {
623
331
          ampout3 = -(ampout3);
624
331
        }
625
2.29k
        temp_word = temp_word << 1;
626
2.29k
        bit_pos++;
627
2.29k
      } else {
628
1.87k
        ampout3 = -ampout3;
629
1.87k
      }
630
631
4.16k
      *x_invquant++ = ampout3;
632
4.49k
    } else {
633
4.49k
      ampres = *p_pul_arr++;
634
4.49k
      res = (ixheaacd_res_exts(value, 24, 30));
635
4.49k
      if (res > 0) {
636
372
        ampres = add_d(res, ampres);
637
372
        ampres = pow_table_q17[ampres];
638
4.12k
      } else {
639
4.12k
        ampres = sub_d(ampres, res);
640
4.12k
        ampres = pow_table_q17[ampres];
641
4.12k
        ampres = -ampres;
642
4.12k
      }
643
4.49k
      res = (ixheaacd_res_exts(value, 26, 30));
644
4.49k
      ampres1 = *p_pul_arr++;
645
4.49k
      if (res > 0) {
646
200
        ampres1 = add_d(res, ampres1);
647
200
        ampres1 = pow_table_q17[ampres1];
648
4.29k
      } else {
649
4.29k
        ampres1 = sub_d(ampres1, res);
650
4.29k
        ampres1 = pow_table_q17[ampres1];
651
4.29k
        ampres1 = -ampres1;
652
4.29k
      }
653
4.49k
      res = (ixheaacd_res_exts(value, 28, 30));
654
4.49k
      ampres2 = *p_pul_arr++;
655
4.49k
      if (res > 0) {
656
162
        ampres2 = add_d(res, ampres2);
657
162
        ampres2 = pow_table_q17[ampres2];
658
4.33k
      } else {
659
4.33k
        ampres2 = sub_d(ampres2, res);
660
4.33k
        ampres2 = pow_table_q17[ampres2];
661
4.33k
        ampres2 = -ampres2;
662
4.33k
      }
663
4.49k
      res = (ixheaacd_res_exts(value, 30, 30));
664
4.49k
      ampres3 = *p_pul_arr++;
665
4.49k
      if (res > 0) {
666
137
        ampres3 = add_d(res, ampres3);
667
137
        ampres3 = pow_table_q17[ampres3];
668
4.35k
      } else {
669
4.35k
        ampres3 = sub_d(ampres3, res);
670
4.35k
        ampres3 = pow_table_q17[ampres3];
671
4.35k
        ampres3 = -ampres3;
672
4.35k
      }
673
4.49k
      *x_invquant++ = ampres;
674
4.49k
      *x_invquant++ = ampres1;
675
4.49k
      *x_invquant++ = ampres2;
676
4.49k
      *x_invquant++ = ampres3;
677
4.49k
    }
678
8.65k
    ixheaacd_aac_read_byte_corr(&ptr_read_next, &bit_pos, &read_word,
679
8.65k
                                it_bit_buf->ptr_bit_buf_end);
680
8.65k
  }
681
682
330
  it_bit_buf->ptr_read_next = ptr_read_next - 4;
683
330
  it_bit_buf->bit_pos = bit_pos;
684
685
330
  return 0;
686
330
}
687
688
static PLATFORM_INLINE WORD ixheaacd_res_c_block_decode_huff_word2_2(
689
    ia_bit_buf_struct *it_bif_buf, WORD32 *qp, WORD16 *offsets, WORD no_bands, WORD group_no,
690
    const UWORD16 *h_ori, WORD32 *pow_table_q17, WORD32 sign, WORD32 maximum_bins_short)
691
692
197
{
693
197
  WORD32 value;
694
197
  WORD idx, grp_idx;
695
197
  WORD len_idx;
696
697
197
  WORD32 *qp_org = qp;
698
699
197
  UWORD8 *ptr_read_next = it_bif_buf->ptr_read_next;
700
197
  WORD32 bit_pos = it_bif_buf->bit_pos;
701
197
  WORD32 read_word = ixheaacd_res_aac_showbits_32(ptr_read_next);
702
197
  ptr_read_next += 4;
703
704
738
  do {
705
738
    len_idx = offsets[1] - offsets[0];
706
738
    grp_idx = group_no;
707
4.47k
    do {
708
4.47k
      qp += offsets[0];
709
4.47k
      idx = len_idx;
710
17.1k
      do {
711
17.1k
        UWORD16 first_offset;
712
17.1k
        WORD16 sign_ret_val;
713
17.1k
        UWORD32 read_word1;
714
17.1k
        UWORD16 *h;
715
716
17.1k
        read_word1 = read_word << bit_pos;
717
718
17.1k
        h = (UWORD16 *)h_ori;
719
17.1k
        h += (read_word1) >> (27);
720
17.1k
        sign_ret_val = *h;
721
722
17.1k
        first_offset = 5;
723
22.6k
        while (sign_ret_val > 0) {
724
5.47k
          bit_pos += first_offset;
725
5.47k
          ixheaacd_aac_read_byte_corr(&ptr_read_next, &bit_pos, &read_word,
726
5.47k
                                      it_bif_buf->ptr_bit_buf_end);
727
5.47k
          read_word1 = (read_word1) << (first_offset);
728
729
5.47k
          first_offset = (sign_ret_val >> 11);
730
5.47k
          h += sign_ret_val & (0x07FF);
731
732
5.47k
          h += (read_word1) >> (32 - first_offset);
733
5.47k
          sign_ret_val = *h;
734
5.47k
        }
735
17.1k
        bit_pos += ((sign_ret_val & 0x7fff) >> 11);
736
17.1k
        bit_pos = min(bit_pos, 31);
737
17.1k
        value = sign_ret_val & (0x07FF);
738
739
17.1k
        if (sign) {
740
11.9k
          WORD32 temp_word;
741
11.9k
          temp_word = read_word << bit_pos;
742
743
11.9k
          *qp++ = ixheaacd_res_extract_signed_symbol(value, 24, 28, pow_table_q17, &temp_word,
744
11.9k
                                                     &bit_pos);
745
11.9k
          *qp++ = ixheaacd_res_extract_signed_symbol(value, 28, 28, pow_table_q17, &temp_word,
746
11.9k
                                                     &bit_pos);
747
11.9k
        } else {
748
5.20k
          *qp++ = ixheaacd_res_extract_symbol(value, 24, 28, pow_table_q17);
749
5.20k
          *qp++ = ixheaacd_res_extract_symbol(value, 28, 28, pow_table_q17);
750
5.20k
        }
751
752
17.1k
        ixheaacd_aac_read_byte_corr(&ptr_read_next, &bit_pos, &read_word,
753
17.1k
                                    it_bif_buf->ptr_bit_buf_end);
754
17.1k
        idx -= 2;
755
17.1k
      } while (idx != 0);
756
757
4.47k
      qp += (maximum_bins_short - offsets[1]);
758
4.47k
      grp_idx--;
759
4.47k
    } while (grp_idx != 0);
760
761
738
    offsets++;
762
738
    qp = qp_org;
763
738
    no_bands--;
764
738
  } while (no_bands >= 0);
765
766
197
  it_bif_buf->ptr_read_next = ptr_read_next - 4;
767
197
  it_bif_buf->bit_pos = bit_pos;
768
769
197
  return 0;
770
197
}
771
772
static PLATFORM_INLINE WORD ixheaacd_res_c_block_decode_huff_word2_2_lb(
773
    ia_bit_buf_struct *it_bit_buf, WORD32 len, const UWORD16 *h_ori, WORD32 *x_invquant,
774
294
    WORD32 *pow_table_q17, WORD8 *p_pul_arr, WORD32 sign) {
775
294
  WORD32 value, res, ampres;
776
294
  WORD idx;
777
778
294
  UWORD8 *ptr_read_next = it_bit_buf->ptr_read_next;
779
294
  WORD32 bit_pos = it_bit_buf->bit_pos;
780
294
  WORD32 read_word = ixheaacd_res_aac_showbits_32(ptr_read_next);
781
294
  ptr_read_next += 4;
782
783
11.1k
  for (idx = len; idx != 0; idx -= 2) {
784
10.8k
    {
785
10.8k
      UWORD16 first_offset;
786
10.8k
      WORD16 sign_ret_val;
787
10.8k
      UWORD32 read_word1;
788
10.8k
      UWORD16 *h;
789
790
10.8k
      read_word1 = read_word << bit_pos;
791
792
10.8k
      h = (UWORD16 *)h_ori;
793
10.8k
      h += (read_word1) >> (27);
794
10.8k
      sign_ret_val = *h;
795
796
10.8k
      first_offset = 5;
797
12.6k
      while (sign_ret_val > 0) {
798
1.78k
        bit_pos += first_offset;
799
1.78k
        ixheaacd_aac_read_byte_corr(&ptr_read_next, &bit_pos, &read_word,
800
1.78k
                                    it_bit_buf->ptr_bit_buf_end);
801
1.78k
        read_word1 = (read_word1) << (first_offset);
802
803
1.78k
        first_offset = (sign_ret_val >> 11);
804
1.78k
        h += sign_ret_val & (0x07FF);
805
806
1.78k
        h += (read_word1) >> (32 - first_offset);
807
1.78k
        sign_ret_val = *h;
808
1.78k
      }
809
10.8k
      bit_pos += ((sign_ret_val & 0x7fff) >> 11);
810
10.8k
      bit_pos = min(bit_pos, 31);
811
812
10.8k
      value = sign_ret_val & (0x07FF);
813
10.8k
    }
814
815
10.8k
    if (sign) {
816
7.02k
      WORD32 out0, out1, temp_word;
817
7.02k
      WORD32 ampout0, ampout1;
818
819
7.02k
      ampout0 = *p_pul_arr++;
820
7.02k
      ampout1 = *p_pul_arr++;
821
822
7.02k
      out0 = value & 0xf0;
823
824
7.02k
      ampout0 = add_d(ampout0, (UWORD32)out0 >> 4);
825
7.02k
      ampout0 = pow_table_q17[ampout0];
826
827
7.02k
      out1 = value & 0xf;
828
7.02k
      ampout1 = add_d(out1, ampout1);
829
7.02k
      ampout1 = pow_table_q17[ampout1];
830
831
7.02k
      temp_word = read_word << bit_pos;
832
7.02k
      if (out0) {
833
4.45k
        if (temp_word & 0x80000000) {
834
1.57k
          ampout0 = -(ampout0);
835
1.57k
        }
836
4.45k
        bit_pos++;
837
4.45k
        temp_word = temp_word << 1;
838
4.45k
      } else {
839
2.56k
        ampout0 = -(ampout0);
840
2.56k
      }
841
7.02k
      if (out1) {
842
4.30k
        if (temp_word & 0x80000000) {
843
1.24k
          ampout1 = -(ampout1);
844
1.24k
        }
845
4.30k
        bit_pos++;
846
4.30k
      } else {
847
2.71k
        ampout1 = -(ampout1);
848
2.71k
      }
849
7.02k
      ixheaacd_aac_read_byte_corr(&ptr_read_next, &bit_pos, &read_word,
850
7.02k
                                  it_bit_buf->ptr_bit_buf_end);
851
7.02k
      *x_invquant++ = ampout0;
852
7.02k
      *x_invquant++ = ampout1;
853
7.02k
    } else {
854
3.84k
      res = ((value << 24) >> 28);
855
3.84k
      ampres = *p_pul_arr++;
856
3.84k
      if (res > 0) {
857
267
        ampres = add_d(res, ampres);
858
267
        *x_invquant++ = pow_table_q17[ampres];
859
3.57k
      } else {
860
3.57k
        ampres = sub_d(ampres, res);
861
3.57k
        ampres = pow_table_q17[ampres];
862
3.57k
        *x_invquant++ = -ampres;
863
3.57k
      }
864
865
3.84k
      res = ((value << 28) >> 28);
866
3.84k
      value = *p_pul_arr++;
867
3.84k
      if (res > 0) {
868
237
        ampres = add_d(res, value);
869
237
        *x_invquant++ = pow_table_q17[ampres];
870
3.60k
      } else {
871
3.60k
        ampres = sub_d(value, res);
872
3.60k
        ampres = pow_table_q17[ampres];
873
3.60k
        *x_invquant++ = -ampres;
874
3.60k
      }
875
3.84k
    }
876
10.8k
    ixheaacd_aac_read_byte_corr(&ptr_read_next, &bit_pos, &read_word,
877
10.8k
                                it_bit_buf->ptr_bit_buf_end);
878
10.8k
  }
879
294
  it_bit_buf->ptr_read_next = ptr_read_next - 4;
880
294
  it_bit_buf->bit_pos = bit_pos;
881
882
294
  return 0;
883
294
}
884
885
WORD ixheaacd_res_c_block_decode_huff_word_all(
886
    ia_bit_buf_struct *it_bit_buf, WORD32 code_no, WORD32 *quantized_coef, WORD16 *band_offsets,
887
    WORD start, WORD band, WORD group_no, ia_mps_dec_residual_aac_tables_struct *aac_tables_ptr,
888
663
    WORD32 maximum_bins_short) {
889
663
  WORD ret_val = 0;
890
663
  WORD start_bit_pos = it_bit_buf->bit_pos;
891
663
  UWORD8 *start_read_pos = it_bit_buf->ptr_read_next;
892
663
  const UWORD16 *h_ori = (UWORD16 *)(aac_tables_ptr->code_book[code_no]);
893
663
  WORD32 *pow_table = (WORD32 *)aac_tables_ptr->res_block_tables_ptr->pow_table_q17;
894
663
  WORD32 no_bands = band - start - 1;
895
663
  WORD16 *p_band_off = band_offsets + start;
896
897
663
  if (code_no == 11) {
898
126
    const UWORD16 *h_ori = aac_tables_ptr->res_huffmann_tables_ptr->huffman_codebook_11;
899
126
    ret_val =
900
126
        ixheaacd_res_c_block_decode_huff_word1(it_bit_buf, quantized_coef, p_band_off, no_bands,
901
126
                                               group_no, h_ori, pow_table, maximum_bins_short);
902
537
  } else if (code_no <= 4) {
903
340
    WORD32 sign = 0;
904
905
340
    if (code_no > 2) sign = 1;
906
340
    ret_val = ixheaacd_res_c_block_decode_huff_word2_4(it_bit_buf, quantized_coef, p_band_off,
907
340
                                                       no_bands, group_no, h_ori, pow_table, sign,
908
340
                                                       maximum_bins_short);
909
340
  }
910
911
197
  else if (code_no <= 10) {
912
197
    WORD32 sign = 0;
913
914
197
    if (code_no > 6) sign = 1;
915
197
    ret_val = ixheaacd_res_c_block_decode_huff_word2_2(it_bit_buf, quantized_coef, p_band_off,
916
197
                                                       no_bands, group_no, h_ori, pow_table, sign,
917
197
                                                       maximum_bins_short);
918
197
  }
919
663
  {
920
663
    WORD bits_cons;
921
663
    bits_cons = (WORD)(((it_bit_buf->ptr_read_next - start_read_pos) << 3) +
922
663
                       (it_bit_buf->bit_pos - start_bit_pos));
923
663
    it_bit_buf->cnt_bits -= bits_cons;
924
663
  }
925
663
  return ret_val;
926
663
}
927
928
WORD ixheaacd_res_c_block_decode_huff_word_all_lb(
929
    ia_bit_buf_struct *it_bit_buf, WORD32 code_no, WORD32 len,
930
691
    ia_mps_dec_residual_aac_tables_struct *aac_tables_ptr, WORD32 *x_invquant, WORD8 *p_pul_arr) {
931
691
  WORD ret_val = 0;
932
691
  WORD start_bit_pos = it_bit_buf->bit_pos;
933
691
  WORD32 *pow_table = (WORD32 *)aac_tables_ptr->res_block_tables_ptr->pow_table_q17;
934
691
  UWORD8 *start_read_pos = it_bit_buf->ptr_read_next;
935
936
691
  const UWORD16 *h_ori = (UWORD16 *)(aac_tables_ptr->code_book[code_no]);
937
938
691
  if (code_no == 11) {
939
67
    const UWORD16 *h_ori = aac_tables_ptr->res_huffmann_tables_ptr->huffman_codebook_11;
940
67
    ret_val = ixheaacd_res_c_block_decode_huff_word1_lb(it_bit_buf, len, h_ori, x_invquant,
941
67
                                                        pow_table, p_pul_arr);
942
624
  } else if (code_no <= 4) {
943
330
    WORD32 sign = 0;
944
330
    if (code_no > 2) sign = 1;
945
330
    ret_val = ixheaacd_res_c_block_decode_huff_word2_4_lb(it_bit_buf, len, h_ori, x_invquant,
946
330
                                                          pow_table, p_pul_arr, sign);
947
330
  } else if (code_no <= 10) {
948
294
    WORD32 sign = 0;
949
294
    if (code_no > 6) sign = 1;
950
294
    ret_val = ixheaacd_res_c_block_decode_huff_word2_2_lb(it_bit_buf, len, h_ori, x_invquant,
951
294
                                                          pow_table, p_pul_arr, sign);
952
294
  }
953
954
691
  {
955
691
    WORD bits_cons;
956
691
    if (it_bit_buf->bit_pos <= 7) {
957
304
      bits_cons = (WORD)(((it_bit_buf->ptr_read_next - start_read_pos) << 3) +
958
304
                         (it_bit_buf->bit_pos - start_bit_pos));
959
304
      it_bit_buf->cnt_bits -= bits_cons;
960
387
    } else {
961
387
      it_bit_buf->ptr_read_next += (it_bit_buf->bit_pos) >> 3;
962
387
      it_bit_buf->bit_pos = it_bit_buf->bit_pos & 0x7;
963
964
387
      bits_cons = (WORD)(((it_bit_buf->ptr_read_next - start_read_pos) << 3) +
965
387
                         ((it_bit_buf->bit_pos - start_bit_pos)));
966
387
      it_bit_buf->cnt_bits -= bits_cons;
967
387
    }
968
691
  }
969
691
  return ret_val;
970
691
}
971
972
static VOID ixheaacd_res_apply_one_scf(WORD32 scale_factor, WORD32 *x_invquant, WORD32 end,
973
28.7k
                                       WORD32 *scale_table_ptr) {
974
28.7k
  WORD32 j;
975
976
28.7k
  WORD32 temp_1;
977
28.7k
  WORD32 q_factor;
978
28.7k
  WORD32 buffer1;
979
28.7k
  WORD16 scale_short;
980
981
28.7k
  if (scale_factor < 24) {
982
72.6k
    for (j = end; j > 0; j--) {
983
65.4k
      *x_invquant++ = 0;
984
65.4k
    }
985
21.6k
  } else {
986
21.6k
    WORD32 shift;
987
21.6k
    q_factor = 37 - (scale_factor >> 2);
988
989
21.6k
    scale_short = scale_table_ptr[(scale_factor & 0x0003)];
990
991
21.6k
    shift = q_factor;
992
993
21.6k
    if (shift > 0) {
994
2.71k
      if (scale_short == (WORD16)0x8000) {
995
0
        for (j = end; j > 0; j--) {
996
0
          temp_1 = *x_invquant;
997
998
0
          buffer1 = ixheaac_mult32x16in32_shl_sat(temp_1, scale_short);
999
0
          buffer1 = ixheaac_shr32(buffer1, shift);
1000
0
          *x_invquant++ = buffer1;
1001
0
        }
1002
2.71k
      } else {
1003
31.9k
        for (j = end; j > 0; j--) {
1004
29.2k
          temp_1 = *x_invquant;
1005
1006
29.2k
          buffer1 = ixheaac_mult32x16in32_shl(temp_1, scale_short);
1007
1008
29.2k
          buffer1 = ixheaac_shr32(buffer1, shift);
1009
29.2k
          *x_invquant++ = buffer1;
1010
29.2k
        }
1011
2.71k
      }
1012
18.9k
    } else {
1013
18.9k
      shift = -shift;
1014
18.9k
      if (shift > 0) {
1015
18.6k
        if (scale_short == (WORD16)0x8000) {
1016
0
          for (j = end; j > 0; j--) {
1017
0
            temp_1 = *x_invquant;
1018
0
            temp_1 = ixheaac_shl32(temp_1, shift - 1);
1019
1020
0
            buffer1 = ixheaac_mult32x16in32_shl_sat(temp_1, scale_short);
1021
1022
0
            buffer1 = ixheaac_shl32(buffer1, 1);
1023
0
            *x_invquant++ = buffer1;
1024
0
          }
1025
18.6k
        } else {
1026
172k
          for (j = end; j > 0; j--) {
1027
154k
            temp_1 = *x_invquant;
1028
154k
            temp_1 = ixheaac_shl32(temp_1, shift - 1);
1029
1030
154k
            buffer1 = ixheaac_mult32x16in32_shl(temp_1, scale_short);
1031
1032
154k
            buffer1 = ixheaac_shl32(buffer1, 1);
1033
154k
            *x_invquant++ = buffer1;
1034
154k
          }
1035
18.6k
        }
1036
18.6k
      } else {
1037
206
        if (scale_short == (WORD16)0x8000) {
1038
0
          for (j = end; j > 0; j--) {
1039
0
            temp_1 = *x_invquant;
1040
1041
0
            buffer1 = ixheaac_mult32x16in32_shl_sat(temp_1, scale_short);
1042
1043
0
            *x_invquant++ = buffer1;
1044
0
          }
1045
206
        } else {
1046
1.68k
          for (j = end; j > 0; j--) {
1047
1.48k
            temp_1 = *x_invquant;
1048
1049
1.48k
            buffer1 = ixheaac_mult32x16in32_shl(temp_1, scale_short);
1050
1051
1.48k
            *x_invquant++ = buffer1;
1052
1.48k
          }
1053
206
        }
1054
206
      }
1055
18.9k
    }
1056
21.6k
  }
1057
28.7k
}
1058
1059
VOID ixheaacd_res_apply_scfs(WORD32 *x_invquant, WORD16 *sc_factor, WORD t_bands, WORD8 *offset,
1060
4.16k
                             WORD32 *scale_table_ptr) {
1061
4.16k
  WORD32 i;
1062
4.16k
  WORD16 scale_factor;
1063
1064
32.9k
  for (i = t_bands - 1; i >= 0; i--) {
1065
28.7k
    scale_factor = *sc_factor++;
1066
28.7k
    ixheaacd_res_apply_one_scf(scale_factor, x_invquant, *offset, scale_table_ptr);
1067
28.7k
    x_invquant += *offset;
1068
28.7k
    offset++;
1069
28.7k
  }
1070
4.16k
}