Coverage Report

Created: 2026-12-01 07:00

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
67.3k
                                                          WORD32 r_shift, WORD32 *pow_table_q17) {
34
67.3k
  WORD32 out;
35
67.3k
  out = (WORD16)((value << l_shift) >> r_shift);
36
37
67.3k
  if (out < 0) {
38
23.8k
    out = -out;
39
23.8k
    out = pow_table_q17[out];
40
23.8k
    out = -out;
41
23.8k
  } else
42
43.4k
    out = pow_table_q17[out];
43
44
67.3k
  return out;
45
67.3k
}
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
197k
                                                                 WORD32 *pr_bit_pos) {
52
197k
  WORD32 out;
53
197k
  out = ixheaac_extu(value, l_shift, r_shift);
54
197k
  if (out) {
55
75.6k
    WORD32 bit_pos = *pr_bit_pos;
56
75.6k
    out = pow_table_q17[out];
57
75.6k
    if (*temp_word & 0x80000000) {
58
45.9k
      out = -out;
59
45.9k
    }
60
75.6k
    *temp_word = *temp_word << 1;
61
75.6k
    bit_pos++;
62
75.6k
    *pr_bit_pos = bit_pos;
63
75.6k
  }
64
197k
  return out;
65
197k
}
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
7.53k
  for (j = t_bands - 1; j >= 0; j--) {
74
7.45k
    q_abs = *pulse_data++;
75
7.45k
    temp = (pow_table_q17[q_abs]);
76
7.45k
    *x_invquant++ = -temp;
77
7.45k
  }
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
160
    const UWORD16 *h_ori, WORD32 *pow_table_q17, WORD32 maximum_bins_short) {
83
160
  WORD32 sp1, sp2;
84
160
  WORD32 flush_cw;
85
160
  WORD32 i, value, norm_val, off;
86
160
  WORD idx, grp_idx;
87
160
  WORD32 out1, out2;
88
160
  WORD32 err_code = 0;
89
160
  WORD len_idx = 0;
90
160
  UWORD8 *ptr_read_next = it_bit_buf->ptr_read_next;
91
160
  WORD32 bit_pos = it_bit_buf->bit_pos;
92
160
  WORD32 read_word = ixheaacd_res_aac_showbits_32(ptr_read_next);
93
160
  ptr_read_next += 4;
94
95
650
  do {
96
650
    len_idx = offsets[1] - offsets[0];
97
650
    grp_idx = group_no;
98
4.03k
    do {
99
4.03k
      qp = qp + offsets[0];
100
4.03k
      idx = len_idx;
101
21.1k
      do {
102
21.1k
        {
103
21.1k
          UWORD16 first_offset;
104
21.1k
          WORD16 sign_ret_val;
105
21.1k
          UWORD32 read_word1;
106
21.1k
          UWORD16 *h;
107
108
21.1k
          read_word1 = read_word << bit_pos;
109
110
21.1k
          h = (UWORD16 *)h_ori;
111
21.1k
          h += (read_word1) >> (27);
112
21.1k
          sign_ret_val = *h;
113
114
21.1k
          first_offset = 5;
115
37.8k
          while (sign_ret_val > 0) {
116
16.7k
            bit_pos += first_offset;
117
16.7k
            ixheaacd_aac_read_byte_corr(&ptr_read_next, &bit_pos, &read_word,
118
16.7k
                                        it_bit_buf->ptr_bit_buf_end);
119
16.7k
            read_word1 = (read_word1) << (first_offset);
120
16.7k
            first_offset = (sign_ret_val >> 11);
121
16.7k
            h += sign_ret_val & (0x07FF);
122
16.7k
            h += (read_word1) >> (32 - first_offset);
123
16.7k
            sign_ret_val = *h;
124
16.7k
          }
125
21.1k
          bit_pos += ((sign_ret_val & 0x7fff) >> 11);
126
21.1k
          bit_pos = min(bit_pos, 31);
127
21.1k
          value = sign_ret_val & (0x07FF);
128
21.1k
        }
129
21.1k
        out1 = (value & 0x3E0) >> 5;
130
21.1k
        out2 = value & 0x1F;
131
132
21.1k
        flush_cw = read_word << bit_pos;
133
134
21.1k
        sp1 = out1;
135
21.1k
        sp2 = out2;
136
137
21.1k
        if (out1) {
138
16.6k
          if (flush_cw & 0x80000000) {
139
15.4k
            out1 = -out1;
140
15.4k
          }
141
16.6k
          bit_pos++;
142
16.6k
          flush_cw = (WORD32)flush_cw << 1;
143
16.6k
        }
144
145
21.1k
        if (out2) {
146
16.5k
          bit_pos++;
147
16.5k
          if (flush_cw & 0x80000000) {
148
993
            out2 = -out2;
149
993
          }
150
16.5k
        }
151
152
21.1k
        ixheaacd_aac_read_byte_corr(&ptr_read_next, &bit_pos, &read_word,
153
21.1k
                                    it_bit_buf->ptr_bit_buf_end);
154
21.1k
        if (sp1 == 16) {
155
463
          i = 4;
156
463
          value = ixheaac_extu(read_word, bit_pos, 23);
157
463
          value = value | 0xfffffe00;
158
463
          norm_val = ixheaac_norm32(value);
159
160
463
          i += (norm_val - 22);
161
463
          bit_pos += (norm_val - 21);
162
163
463
          ixheaacd_aac_read_byte_corr(&ptr_read_next, &bit_pos, &read_word,
164
463
                                      it_bit_buf->ptr_bit_buf_end);
165
166
463
          off = ixheaac_extu(read_word, bit_pos, 32 - i);
167
168
463
          bit_pos += i;
169
170
463
          ixheaacd_aac_read_byte_corr(&ptr_read_next, &bit_pos, &read_word,
171
463
                                      it_bit_buf->ptr_bit_buf_end);
172
173
463
          ixheaacd_aac_read_byte_corr(&ptr_read_next, &bit_pos, &read_word,
174
463
                                      it_bit_buf->ptr_bit_buf_end);
175
176
463
          i = off + ((WORD32)1 << i);
177
178
463
          if (i <= IQ_TABLE_SIZE_HALF)
179
382
            i = pow_table_q17[i];
180
81
          else {
181
81
            err_code |= ixheaacd_res_inv_quant(&i, pow_table_q17);
182
81
          }
183
184
463
          if (out1 < 0) {
185
153
            out1 = -i;
186
310
          } else {
187
310
            out1 = i;
188
310
          }
189
463
          *qp++ = out1;
190
20.6k
        } else {
191
20.6k
          if (out1 <= 0) {
192
19.7k
            out1 = -out1;
193
19.7k
            out1 = pow_table_q17[out1];
194
19.7k
            *qp++ = -out1;
195
19.7k
          } else {
196
877
            out1 = pow_table_q17[out1];
197
877
            *qp++ = out1;
198
877
          }
199
20.6k
        }
200
21.1k
        if (sp2 == 16) {
201
452
          i = 4;
202
452
          value = ixheaac_extu(read_word, bit_pos, 23);
203
452
          value = value | 0xfffffe00;
204
452
          norm_val = ixheaac_norm32(value);
205
206
452
          i += (norm_val - 22);
207
208
452
          bit_pos += (norm_val - 21);
209
210
452
          ixheaacd_aac_read_byte_corr(&ptr_read_next, &bit_pos, &read_word,
211
452
                                      it_bit_buf->ptr_bit_buf_end);
212
213
452
          off = ixheaac_extu(read_word, bit_pos, 32 - i);
214
215
452
          bit_pos += i;
216
217
452
          ixheaacd_aac_read_byte_corr(&ptr_read_next, &bit_pos, &read_word,
218
452
                                      it_bit_buf->ptr_bit_buf_end);
219
220
452
          ixheaacd_aac_read_byte_corr(&ptr_read_next, &bit_pos, &read_word,
221
452
                                      it_bit_buf->ptr_bit_buf_end);
222
223
452
          i = off + ((WORD32)1 << i);
224
225
452
          if (i <= IQ_TABLE_SIZE_HALF)
226
360
            i = pow_table_q17[i];
227
92
          else {
228
92
            err_code |= ixheaacd_res_inv_quant(&i, pow_table_q17);
229
92
          }
230
231
452
          if (out2 < 0) {
232
189
            out2 = -i;
233
263
          } else {
234
263
            out2 = i;
235
263
          }
236
452
          *qp++ = out2;
237
20.6k
        } else {
238
20.6k
          if (out2 <= 0) {
239
5.33k
            out2 = -out2;
240
5.33k
            out2 = pow_table_q17[out2];
241
5.33k
            *qp++ = -out2;
242
15.3k
          } else {
243
15.3k
            out2 = pow_table_q17[out2];
244
15.3k
            *qp++ = out2;
245
15.3k
          }
246
20.6k
        }
247
248
21.1k
        idx -= 2;
249
21.1k
      } while (idx != 0);
250
251
4.03k
      qp += (maximum_bins_short - offsets[1]);
252
4.03k
      grp_idx--;
253
4.03k
    } while (grp_idx != 0);
254
255
650
    offsets++;
256
650
    qp -= (maximum_bins_short * group_no);
257
650
    no_bands--;
258
650
  } while (no_bands >= 0);
259
260
160
  it_bit_buf->bit_pos = bit_pos;
261
160
  it_bit_buf->ptr_read_next = ptr_read_next - 4;
262
263
160
  return err_code;
264
160
}
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
115
    WORD32 *pow_table_q17, WORD8 *p_pul_arr) {
269
115
  WORD32 sp1, sp2;
270
115
  WORD32 flush_cw;
271
115
  WORD32 i, value, norm_val, off;
272
115
  WORD idx;
273
115
  WORD32 out1, out2;
274
115
  WORD32 err_code = 0;
275
115
  UWORD8 *ptr_read_next = it_bif_buf->ptr_read_next;
276
115
  WORD32 bit_pos = it_bif_buf->bit_pos;
277
115
  WORD32 read_word = ixheaacd_res_aac_showbits_32(ptr_read_next);
278
115
  ptr_read_next += 4;
279
280
16.0k
  for (idx = len; idx != 0; idx -= 2) {
281
15.9k
    {
282
15.9k
      UWORD16 first_offset;
283
15.9k
      WORD16 sign_ret_val;
284
15.9k
      UWORD32 read_word1;
285
15.9k
      UWORD16 *h;
286
287
15.9k
      read_word1 = read_word << bit_pos;
288
289
15.9k
      h = (UWORD16 *)h_ori;
290
15.9k
      h += (read_word1) >> (27);
291
15.9k
      sign_ret_val = *h;
292
293
15.9k
      first_offset = 5;
294
26.2k
      while (sign_ret_val > 0) {
295
10.2k
        bit_pos += first_offset;
296
10.2k
        ixheaacd_aac_read_byte_corr(&ptr_read_next, &bit_pos, &read_word,
297
10.2k
                                    it_bif_buf->ptr_bit_buf_end);
298
10.2k
        read_word1 = (read_word1) << (first_offset);
299
300
10.2k
        first_offset = (sign_ret_val >> 11);
301
10.2k
        h += sign_ret_val & (0x07FF);
302
303
10.2k
        h += (read_word1) >> (32 - first_offset);
304
10.2k
        sign_ret_val = *h;
305
10.2k
      }
306
15.9k
      bit_pos += ((sign_ret_val & 0x7fff) >> 11);
307
15.9k
      bit_pos = min(bit_pos, 31);
308
15.9k
      value = sign_ret_val & (0x07FF);
309
15.9k
    }
310
311
15.9k
    flush_cw = read_word << bit_pos;
312
313
15.9k
    out1 = (value & 0x3E0) >> 5;
314
15.9k
    out2 = value & 0x1F;
315
316
15.9k
    sp1 = out1;
317
318
15.9k
    if (out1) {
319
9.97k
      if (flush_cw & 0x80000000) {
320
8.51k
        out1 = -out1;
321
8.51k
      }
322
323
9.97k
      bit_pos++;
324
9.97k
      flush_cw = (WORD32)flush_cw << 1;
325
9.97k
    }
326
327
15.9k
    sp2 = out2;
328
15.9k
    if (out2) {
329
9.84k
      bit_pos++;
330
9.84k
      if (flush_cw & 0x80000000) {
331
1.19k
        out2 = -out2;
332
1.19k
      }
333
9.84k
    }
334
335
15.9k
    ixheaacd_aac_read_byte_corr(&ptr_read_next, &bit_pos, &read_word,
336
15.9k
                                it_bif_buf->ptr_bit_buf_end);
337
338
15.9k
    if (sp1 == 16) {
339
483
      i = 4;
340
483
      value = ixheaac_extu(read_word, bit_pos, 23);
341
483
      value = value | 0xfffffe00;
342
483
      norm_val = ixheaac_norm32(value);
343
483
      i += (norm_val - 22);
344
483
      bit_pos += (norm_val - 21);
345
346
483
      ixheaacd_aac_read_byte_corr(&ptr_read_next, &bit_pos, &read_word,
347
483
                                  it_bif_buf->ptr_bit_buf_end);
348
349
483
      off = ixheaac_extu(read_word, bit_pos, 32 - i);
350
351
483
      bit_pos += i;
352
353
483
      ixheaacd_aac_read_byte_corr(&ptr_read_next, &bit_pos, &read_word,
354
483
                                  it_bif_buf->ptr_bit_buf_end);
355
483
      value = *p_pul_arr++;
356
483
      ixheaacd_aac_read_byte_corr(&ptr_read_next, &bit_pos, &read_word,
357
483
                                  it_bif_buf->ptr_bit_buf_end);
358
483
      i = off + ((WORD32)1 << i);
359
483
      i = add_d(i, value);
360
361
483
      if (i <= IQ_TABLE_SIZE_HALF)
362
412
        i = pow_table_q17[i];
363
71
      else {
364
71
        err_code |= ixheaacd_res_inv_quant(&i, pow_table_q17);
365
71
      }
366
483
      if (out1 < 0) {
367
200
        i = -i;
368
200
      }
369
483
      *x_invquant++ = i;
370
15.4k
    } else {
371
15.4k
      WORD8 temp = *p_pul_arr++;
372
15.4k
      if (out1 <= 0) {
373
14.3k
        out1 = sub_d(temp, out1);
374
14.3k
        out1 = pow_table_q17[out1];
375
14.3k
        *x_invquant++ = -out1;
376
14.3k
      } else {
377
1.17k
        out1 = add_d(out1, temp);
378
1.17k
        out1 = pow_table_q17[out1];
379
1.17k
        *x_invquant++ = out1;
380
1.17k
      }
381
15.4k
    }
382
383
15.9k
    if (sp2 == 16) {
384
511
      i = 4;
385
511
      value = ixheaac_extu(read_word, bit_pos, 23);
386
511
      value = value | 0xfffffe00;
387
511
      norm_val = ixheaac_norm32(value);
388
389
511
      i += (norm_val - 22);
390
391
511
      bit_pos += (norm_val - 21);
392
393
511
      ixheaacd_aac_read_byte_corr(&ptr_read_next, &bit_pos, &read_word,
394
511
                                  it_bif_buf->ptr_bit_buf_end);
395
396
511
      off = ixheaac_extu(read_word, bit_pos, 32 - i);
397
398
511
      bit_pos += i;
399
400
511
      ixheaacd_aac_read_byte_corr(&ptr_read_next, &bit_pos, &read_word,
401
511
                                  it_bif_buf->ptr_bit_buf_end);
402
511
      value = *p_pul_arr++;
403
511
      ixheaacd_aac_read_byte_corr(&ptr_read_next, &bit_pos, &read_word,
404
511
                                  it_bif_buf->ptr_bit_buf_end);
405
406
511
      i = off + ((WORD32)1 << i);
407
511
      i = add_d(i, value);
408
511
      if (i <= IQ_TABLE_SIZE_HALF)
409
378
        i = pow_table_q17[i];
410
133
      else {
411
133
        err_code |= ixheaacd_res_inv_quant(&i, pow_table_q17);
412
133
      }
413
414
511
      if (out2 < 0) {
415
173
        i = -i;
416
173
      }
417
511
      *x_invquant++ = i;
418
15.4k
    } else {
419
15.4k
      WORD8 temp = *p_pul_arr++;
420
15.4k
      if (out2 <= 0) {
421
7.15k
        out2 = sub_d(temp, out2);
422
7.15k
        out2 = pow_table_q17[out2];
423
7.15k
        *x_invquant++ = -out2;
424
8.31k
      } else {
425
8.31k
        out2 = add_d(out2, temp);
426
8.31k
        out2 = pow_table_q17[out2];
427
8.31k
        *x_invquant++ = out2;
428
8.31k
      }
429
15.4k
    }
430
15.9k
  }
431
432
115
  it_bif_buf->ptr_read_next = ptr_read_next - 4;
433
115
  it_bif_buf->bit_pos = bit_pos;
434
435
115
  return err_code;
436
115
}
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
610
    const UWORD16 *h_ori, WORD32 *pow_table_q17, WORD32 sign, WORD32 maximum_bins_short) {
441
610
  WORD32 value;
442
610
  WORD idx, grp_idx;
443
610
  WORD idx_len;
444
610
  WORD32 *qp_org;
445
446
610
  UWORD8 *ptr_read_next = it_bit_buf->ptr_read_next;
447
610
  WORD32 bit_pos = it_bit_buf->bit_pos;
448
610
  WORD32 read_word = ixheaacd_res_aac_showbits_32(ptr_read_next);
449
610
  ptr_read_next += 4;
450
610
  qp_org = qp;
451
3.29k
  do {
452
3.29k
    idx_len = offsets[1] - offsets[0];
453
3.29k
    grp_idx = group_no;
454
455
22.3k
    do {
456
22.3k
      qp = qp + offsets[0];
457
22.3k
      idx = idx_len;
458
38.7k
      do {
459
38.7k
        UWORD16 first_offset;
460
38.7k
        WORD16 sign_ret_val;
461
38.7k
        UWORD32 read_word1;
462
38.7k
        UWORD16 *h;
463
464
38.7k
        read_word1 = read_word << bit_pos;
465
466
38.7k
        h = (UWORD16 *)h_ori;
467
38.7k
        h += (read_word1) >> (27);
468
38.7k
        sign_ret_val = *h;
469
470
38.7k
        first_offset = 5;
471
44.4k
        while (sign_ret_val > 0) {
472
5.69k
          bit_pos += first_offset;
473
5.69k
          ixheaacd_aac_read_byte_corr(&ptr_read_next, &bit_pos, &read_word,
474
5.69k
                                      it_bit_buf->ptr_bit_buf_end);
475
5.69k
          read_word1 = (read_word1) << (first_offset);
476
477
5.69k
          first_offset = (sign_ret_val >> 11);
478
5.69k
          h += sign_ret_val & (0x07FF);
479
480
5.69k
          h += (read_word1) >> (32 - first_offset);
481
5.69k
          sign_ret_val = *h;
482
5.69k
        }
483
38.7k
        bit_pos += ((sign_ret_val & 0x7fff) >> 11);
484
38.7k
        bit_pos = min(bit_pos, 31);
485
38.7k
        value = sign_ret_val & (0x07FF);
486
487
38.7k
        if (sign) {
488
31.6k
          WORD32 temp_word;
489
31.6k
          temp_word = read_word << bit_pos;
490
491
31.6k
          *qp++ = ixheaacd_res_extract_signed_symbol(value, 24, 30, pow_table_q17, &temp_word,
492
31.6k
                                                     &bit_pos);
493
31.6k
          *qp++ = ixheaacd_res_extract_signed_symbol(value, 26, 30, pow_table_q17, &temp_word,
494
31.6k
                                                     &bit_pos);
495
31.6k
          *qp++ = ixheaacd_res_extract_signed_symbol(value, 28, 30, pow_table_q17, &temp_word,
496
31.6k
                                                     &bit_pos);
497
31.6k
          *qp++ = ixheaacd_res_extract_signed_symbol(value, 30, 30, pow_table_q17, &temp_word,
498
31.6k
                                                     &bit_pos);
499
31.6k
        } else {
500
7.08k
          *qp++ = ixheaacd_res_extract_symbol(value, 24, 30, pow_table_q17);
501
7.08k
          *qp++ = ixheaacd_res_extract_symbol(value, 26, 30, pow_table_q17);
502
7.08k
          *qp++ = ixheaacd_res_extract_symbol(value, 28, 30, pow_table_q17);
503
7.08k
          *qp++ = ixheaacd_res_extract_symbol(value, 30, 30, pow_table_q17);
504
7.08k
        }
505
506
38.7k
        ixheaacd_aac_read_byte_corr(&ptr_read_next, &bit_pos, &read_word,
507
38.7k
                                    it_bit_buf->ptr_bit_buf_end);
508
38.7k
        idx -= 4;
509
38.7k
      } while (idx != 0);
510
511
22.3k
      qp += (maximum_bins_short - offsets[1]);
512
22.3k
      grp_idx--;
513
22.3k
    } while (grp_idx != 0);
514
3.29k
    offsets++;
515
3.29k
    qp = qp_org;
516
3.29k
    no_bands--;
517
3.29k
  } while (no_bands >= 0);
518
519
610
  it_bit_buf->ptr_read_next = ptr_read_next - 4;
520
610
  it_bit_buf->bit_pos = bit_pos;
521
522
610
  return 0;
523
610
}
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
335
    WORD32 *pow_table_q17, WORD8 *p_pul_arr, WORD32 sign) {
528
335
  WORD32 value;
529
335
  WORD idx;
530
531
335
  UWORD8 *ptr_read_next = it_bit_buf->ptr_read_next;
532
335
  WORD32 bit_pos = it_bit_buf->bit_pos;
533
335
  WORD32 read_word = ixheaacd_res_aac_showbits_32(ptr_read_next);
534
335
  ptr_read_next += 4;
535
536
11.0k
  for (idx = len; idx != 0; idx -= 4) {
537
10.7k
    WORD32 res;
538
10.7k
    WORD32 ampres, ampres1;
539
10.7k
    WORD32 ampres2, ampres3;
540
10.7k
    UWORD16 first_offset;
541
10.7k
    WORD16 sign_ret_val;
542
10.7k
    UWORD32 read_word1;
543
10.7k
    UWORD16 *h;
544
545
10.7k
    read_word1 = read_word << bit_pos;
546
547
10.7k
    h = (UWORD16 *)h_ori;
548
10.7k
    h += (read_word1) >> (27);
549
10.7k
    sign_ret_val = *h;
550
551
10.7k
    first_offset = 5;
552
12.9k
    while (sign_ret_val > 0) {
553
2.27k
      bit_pos += first_offset;
554
2.27k
      ixheaacd_aac_read_byte_corr(&ptr_read_next, &bit_pos, &read_word,
555
2.27k
                                  it_bit_buf->ptr_bit_buf_end);
556
2.27k
      read_word1 = (read_word1) << (first_offset);
557
558
2.27k
      first_offset = (sign_ret_val >> 11);
559
2.27k
      h += sign_ret_val & (0x07FF);
560
561
2.27k
      h += (read_word1) >> (32 - first_offset);
562
2.27k
      sign_ret_val = *h;
563
2.27k
    }
564
10.7k
    bit_pos += ((sign_ret_val & 0x7fff) >> 11);
565
10.7k
    bit_pos = min(bit_pos, 31);
566
567
10.7k
    value = sign_ret_val & (0x07FF);
568
569
10.7k
    if (sign) {
570
6.29k
      WORD32 out0, out1, out2, out3;
571
6.29k
      WORD32 ampout0, ampout1, ampout2, ampout3;
572
6.29k
      WORD32 temp_word;
573
6.29k
      temp_word = read_word << bit_pos;
574
575
6.29k
      out0 = (ixheaac_extu(value, 24, 30));
576
6.29k
      ampout0 = add_d(out0, *p_pul_arr++);
577
6.29k
      ampout0 = pow_table_q17[ampout0];
578
579
6.29k
      if (out0) {
580
3.07k
        if (temp_word & 0x80000000) {
581
1.18k
          ampout0 = -ampout0;
582
1.18k
        }
583
3.07k
        temp_word = temp_word << 1;
584
3.07k
        bit_pos++;
585
3.22k
      } else {
586
3.22k
        ampout0 = -ampout0;
587
3.22k
      }
588
589
6.29k
      out1 = (ixheaac_extu(value, 26, 30));
590
6.29k
      ampout1 = add_d(out1, *p_pul_arr++);
591
6.29k
      ampout1 = pow_table_q17[ampout1];
592
6.29k
      if (out1) {
593
2.13k
        if (temp_word & 0x80000000) {
594
315
          ampout1 = -(ampout1);
595
315
        }
596
2.13k
        temp_word = temp_word << 1;
597
2.13k
        bit_pos++;
598
4.16k
      } else {
599
4.16k
        ampout1 = -ampout1;
600
4.16k
      }
601
6.29k
      out2 = (ixheaac_extu(value, 28, 30));
602
6.29k
      ampout2 = add_d(out2, *p_pul_arr++);
603
6.29k
      ampout2 = pow_table_q17[ampout2];
604
6.29k
      if (out2) {
605
2.89k
        if (temp_word & 0x80000000) {
606
1.01k
          ampout2 = -(ampout2);
607
1.01k
        }
608
2.89k
        temp_word = temp_word << 1;
609
2.89k
        bit_pos++;
610
3.40k
      } else {
611
3.40k
        ampout2 = -ampout2;
612
3.40k
      }
613
614
6.29k
      *x_invquant++ = ampout0;
615
6.29k
      *x_invquant++ = ampout1;
616
6.29k
      *x_invquant++ = ampout2;
617
618
6.29k
      out3 = (ixheaac_extu(value, 30, 30));
619
6.29k
      ampout3 = add_d(out3, *p_pul_arr++);
620
6.29k
      ampout3 = pow_table_q17[ampout3];
621
6.29k
      if (out3) {
622
2.93k
        if (temp_word & 0x80000000) {
623
387
          ampout3 = -(ampout3);
624
387
        }
625
2.93k
        temp_word = temp_word << 1;
626
2.93k
        bit_pos++;
627
3.36k
      } else {
628
3.36k
        ampout3 = -ampout3;
629
3.36k
      }
630
631
6.29k
      *x_invquant++ = ampout3;
632
6.29k
    } else {
633
4.42k
      ampres = *p_pul_arr++;
634
4.42k
      res = (ixheaacd_res_exts(value, 24, 30));
635
4.42k
      if (res > 0) {
636
692
        ampres = add_d(res, ampres);
637
692
        ampres = pow_table_q17[ampres];
638
3.73k
      } else {
639
3.73k
        ampres = sub_d(ampres, res);
640
3.73k
        ampres = pow_table_q17[ampres];
641
3.73k
        ampres = -ampres;
642
3.73k
      }
643
4.42k
      res = (ixheaacd_res_exts(value, 26, 30));
644
4.42k
      ampres1 = *p_pul_arr++;
645
4.42k
      if (res > 0) {
646
257
        ampres1 = add_d(res, ampres1);
647
257
        ampres1 = pow_table_q17[ampres1];
648
4.16k
      } else {
649
4.16k
        ampres1 = sub_d(ampres1, res);
650
4.16k
        ampres1 = pow_table_q17[ampres1];
651
4.16k
        ampres1 = -ampres1;
652
4.16k
      }
653
4.42k
      res = (ixheaacd_res_exts(value, 28, 30));
654
4.42k
      ampres2 = *p_pul_arr++;
655
4.42k
      if (res > 0) {
656
229
        ampres2 = add_d(res, ampres2);
657
229
        ampres2 = pow_table_q17[ampres2];
658
4.19k
      } else {
659
4.19k
        ampres2 = sub_d(ampres2, res);
660
4.19k
        ampres2 = pow_table_q17[ampres2];
661
4.19k
        ampres2 = -ampres2;
662
4.19k
      }
663
4.42k
      res = (ixheaacd_res_exts(value, 30, 30));
664
4.42k
      ampres3 = *p_pul_arr++;
665
4.42k
      if (res > 0) {
666
189
        ampres3 = add_d(res, ampres3);
667
189
        ampres3 = pow_table_q17[ampres3];
668
4.23k
      } else {
669
4.23k
        ampres3 = sub_d(ampres3, res);
670
4.23k
        ampres3 = pow_table_q17[ampres3];
671
4.23k
        ampres3 = -ampres3;
672
4.23k
      }
673
4.42k
      *x_invquant++ = ampres;
674
4.42k
      *x_invquant++ = ampres1;
675
4.42k
      *x_invquant++ = ampres2;
676
4.42k
      *x_invquant++ = ampres3;
677
4.42k
    }
678
10.7k
    ixheaacd_aac_read_byte_corr(&ptr_read_next, &bit_pos, &read_word,
679
10.7k
                                it_bit_buf->ptr_bit_buf_end);
680
10.7k
  }
681
682
335
  it_bit_buf->ptr_read_next = ptr_read_next - 4;
683
335
  it_bit_buf->bit_pos = bit_pos;
684
685
335
  return 0;
686
335
}
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
521
{
693
521
  WORD32 value;
694
521
  WORD idx, grp_idx;
695
521
  WORD len_idx;
696
697
521
  WORD32 *qp_org = qp;
698
699
521
  UWORD8 *ptr_read_next = it_bif_buf->ptr_read_next;
700
521
  WORD32 bit_pos = it_bif_buf->bit_pos;
701
521
  WORD32 read_word = ixheaacd_res_aac_showbits_32(ptr_read_next);
702
521
  ptr_read_next += 4;
703
704
1.83k
  do {
705
1.83k
    len_idx = offsets[1] - offsets[0];
706
1.83k
    grp_idx = group_no;
707
11.7k
    do {
708
11.7k
      qp += offsets[0];
709
11.7k
      idx = len_idx;
710
54.7k
      do {
711
54.7k
        UWORD16 first_offset;
712
54.7k
        WORD16 sign_ret_val;
713
54.7k
        UWORD32 read_word1;
714
54.7k
        UWORD16 *h;
715
716
54.7k
        read_word1 = read_word << bit_pos;
717
718
54.7k
        h = (UWORD16 *)h_ori;
719
54.7k
        h += (read_word1) >> (27);
720
54.7k
        sign_ret_val = *h;
721
722
54.7k
        first_offset = 5;
723
61.6k
        while (sign_ret_val > 0) {
724
6.96k
          bit_pos += first_offset;
725
6.96k
          ixheaacd_aac_read_byte_corr(&ptr_read_next, &bit_pos, &read_word,
726
6.96k
                                      it_bif_buf->ptr_bit_buf_end);
727
6.96k
          read_word1 = (read_word1) << (first_offset);
728
729
6.96k
          first_offset = (sign_ret_val >> 11);
730
6.96k
          h += sign_ret_val & (0x07FF);
731
732
6.96k
          h += (read_word1) >> (32 - first_offset);
733
6.96k
          sign_ret_val = *h;
734
6.96k
        }
735
54.7k
        bit_pos += ((sign_ret_val & 0x7fff) >> 11);
736
54.7k
        bit_pos = min(bit_pos, 31);
737
54.7k
        value = sign_ret_val & (0x07FF);
738
739
54.7k
        if (sign) {
740
35.2k
          WORD32 temp_word;
741
35.2k
          temp_word = read_word << bit_pos;
742
743
35.2k
          *qp++ = ixheaacd_res_extract_signed_symbol(value, 24, 28, pow_table_q17, &temp_word,
744
35.2k
                                                     &bit_pos);
745
35.2k
          *qp++ = ixheaacd_res_extract_signed_symbol(value, 28, 28, pow_table_q17, &temp_word,
746
35.2k
                                                     &bit_pos);
747
35.2k
        } else {
748
19.5k
          *qp++ = ixheaacd_res_extract_symbol(value, 24, 28, pow_table_q17);
749
19.5k
          *qp++ = ixheaacd_res_extract_symbol(value, 28, 28, pow_table_q17);
750
19.5k
        }
751
752
54.7k
        ixheaacd_aac_read_byte_corr(&ptr_read_next, &bit_pos, &read_word,
753
54.7k
                                    it_bif_buf->ptr_bit_buf_end);
754
54.7k
        idx -= 2;
755
54.7k
      } while (idx != 0);
756
757
11.7k
      qp += (maximum_bins_short - offsets[1]);
758
11.7k
      grp_idx--;
759
11.7k
    } while (grp_idx != 0);
760
761
1.83k
    offsets++;
762
1.83k
    qp = qp_org;
763
1.83k
    no_bands--;
764
1.83k
  } while (no_bands >= 0);
765
766
521
  it_bif_buf->ptr_read_next = ptr_read_next - 4;
767
521
  it_bif_buf->bit_pos = bit_pos;
768
769
521
  return 0;
770
521
}
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
443
    WORD32 *pow_table_q17, WORD8 *p_pul_arr, WORD32 sign) {
775
443
  WORD32 value, res, ampres;
776
443
  WORD idx;
777
778
443
  UWORD8 *ptr_read_next = it_bit_buf->ptr_read_next;
779
443
  WORD32 bit_pos = it_bit_buf->bit_pos;
780
443
  WORD32 read_word = ixheaacd_res_aac_showbits_32(ptr_read_next);
781
443
  ptr_read_next += 4;
782
783
24.7k
  for (idx = len; idx != 0; idx -= 2) {
784
24.2k
    {
785
24.2k
      UWORD16 first_offset;
786
24.2k
      WORD16 sign_ret_val;
787
24.2k
      UWORD32 read_word1;
788
24.2k
      UWORD16 *h;
789
790
24.2k
      read_word1 = read_word << bit_pos;
791
792
24.2k
      h = (UWORD16 *)h_ori;
793
24.2k
      h += (read_word1) >> (27);
794
24.2k
      sign_ret_val = *h;
795
796
24.2k
      first_offset = 5;
797
26.6k
      while (sign_ret_val > 0) {
798
2.39k
        bit_pos += first_offset;
799
2.39k
        ixheaacd_aac_read_byte_corr(&ptr_read_next, &bit_pos, &read_word,
800
2.39k
                                    it_bit_buf->ptr_bit_buf_end);
801
2.39k
        read_word1 = (read_word1) << (first_offset);
802
803
2.39k
        first_offset = (sign_ret_val >> 11);
804
2.39k
        h += sign_ret_val & (0x07FF);
805
806
2.39k
        h += (read_word1) >> (32 - first_offset);
807
2.39k
        sign_ret_val = *h;
808
2.39k
      }
809
24.2k
      bit_pos += ((sign_ret_val & 0x7fff) >> 11);
810
24.2k
      bit_pos = min(bit_pos, 31);
811
812
24.2k
      value = sign_ret_val & (0x07FF);
813
24.2k
    }
814
815
24.2k
    if (sign) {
816
20.3k
      WORD32 out0, out1, temp_word;
817
20.3k
      WORD32 ampout0, ampout1;
818
819
20.3k
      ampout0 = *p_pul_arr++;
820
20.3k
      ampout1 = *p_pul_arr++;
821
822
20.3k
      out0 = value & 0xf0;
823
824
20.3k
      ampout0 = add_d(ampout0, (UWORD32)out0 >> 4);
825
20.3k
      ampout0 = pow_table_q17[ampout0];
826
827
20.3k
      out1 = value & 0xf;
828
20.3k
      ampout1 = add_d(out1, ampout1);
829
20.3k
      ampout1 = pow_table_q17[ampout1];
830
831
20.3k
      temp_word = read_word << bit_pos;
832
20.3k
      if (out0) {
833
15.5k
        if (temp_word & 0x80000000) {
834
5.97k
          ampout0 = -(ampout0);
835
5.97k
        }
836
15.5k
        bit_pos++;
837
15.5k
        temp_word = temp_word << 1;
838
15.5k
      } else {
839
4.83k
        ampout0 = -(ampout0);
840
4.83k
      }
841
20.3k
      if (out1) {
842
12.3k
        if (temp_word & 0x80000000) {
843
1.93k
          ampout1 = -(ampout1);
844
1.93k
        }
845
12.3k
        bit_pos++;
846
12.3k
      } else {
847
8.06k
        ampout1 = -(ampout1);
848
8.06k
      }
849
20.3k
      ixheaacd_aac_read_byte_corr(&ptr_read_next, &bit_pos, &read_word,
850
20.3k
                                  it_bit_buf->ptr_bit_buf_end);
851
20.3k
      *x_invquant++ = ampout0;
852
20.3k
      *x_invquant++ = ampout1;
853
20.3k
    } else {
854
3.87k
      res = ((value << 24) >> 28);
855
3.87k
      ampres = *p_pul_arr++;
856
3.87k
      if (res > 0) {
857
226
        ampres = add_d(res, ampres);
858
226
        *x_invquant++ = pow_table_q17[ampres];
859
3.64k
      } else {
860
3.64k
        ampres = sub_d(ampres, res);
861
3.64k
        ampres = pow_table_q17[ampres];
862
3.64k
        *x_invquant++ = -ampres;
863
3.64k
      }
864
865
3.87k
      res = ((value << 28) >> 28);
866
3.87k
      value = *p_pul_arr++;
867
3.87k
      if (res > 0) {
868
221
        ampres = add_d(res, value);
869
221
        *x_invquant++ = pow_table_q17[ampres];
870
3.65k
      } else {
871
3.65k
        ampres = sub_d(value, res);
872
3.65k
        ampres = pow_table_q17[ampres];
873
3.65k
        *x_invquant++ = -ampres;
874
3.65k
      }
875
3.87k
    }
876
24.2k
    ixheaacd_aac_read_byte_corr(&ptr_read_next, &bit_pos, &read_word,
877
24.2k
                                it_bit_buf->ptr_bit_buf_end);
878
24.2k
  }
879
443
  it_bit_buf->ptr_read_next = ptr_read_next - 4;
880
443
  it_bit_buf->bit_pos = bit_pos;
881
882
443
  return 0;
883
443
}
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
1.29k
    WORD32 maximum_bins_short) {
889
1.29k
  WORD ret_val = 0;
890
1.29k
  WORD start_bit_pos = it_bit_buf->bit_pos;
891
1.29k
  UWORD8 *start_read_pos = it_bit_buf->ptr_read_next;
892
1.29k
  const UWORD16 *h_ori = (UWORD16 *)(aac_tables_ptr->code_book[code_no]);
893
1.29k
  WORD32 *pow_table = (WORD32 *)aac_tables_ptr->res_block_tables_ptr->pow_table_q17;
894
1.29k
  WORD32 no_bands = band - start - 1;
895
1.29k
  WORD16 *p_band_off = band_offsets + start;
896
897
1.29k
  if (code_no == 11) {
898
160
    const UWORD16 *h_ori = aac_tables_ptr->res_huffmann_tables_ptr->huffman_codebook_11;
899
160
    ret_val =
900
160
        ixheaacd_res_c_block_decode_huff_word1(it_bit_buf, quantized_coef, p_band_off, no_bands,
901
160
                                               group_no, h_ori, pow_table, maximum_bins_short);
902
1.13k
  } else if (code_no <= 4) {
903
610
    WORD32 sign = 0;
904
905
610
    if (code_no > 2) sign = 1;
906
610
    ret_val = ixheaacd_res_c_block_decode_huff_word2_4(it_bit_buf, quantized_coef, p_band_off,
907
610
                                                       no_bands, group_no, h_ori, pow_table, sign,
908
610
                                                       maximum_bins_short);
909
610
  }
910
911
521
  else if (code_no <= 10) {
912
521
    WORD32 sign = 0;
913
914
521
    if (code_no > 6) sign = 1;
915
521
    ret_val = ixheaacd_res_c_block_decode_huff_word2_2(it_bit_buf, quantized_coef, p_band_off,
916
521
                                                       no_bands, group_no, h_ori, pow_table, sign,
917
521
                                                       maximum_bins_short);
918
521
  }
919
1.29k
  {
920
1.29k
    WORD bits_cons;
921
1.29k
    bits_cons = (WORD)(((it_bit_buf->ptr_read_next - start_read_pos) << 3) +
922
1.29k
                       (it_bit_buf->bit_pos - start_bit_pos));
923
1.29k
    it_bit_buf->cnt_bits -= bits_cons;
924
1.29k
  }
925
1.29k
  return ret_val;
926
1.29k
}
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
893
    ia_mps_dec_residual_aac_tables_struct *aac_tables_ptr, WORD32 *x_invquant, WORD8 *p_pul_arr) {
931
893
  WORD ret_val = 0;
932
893
  WORD start_bit_pos = it_bit_buf->bit_pos;
933
893
  WORD32 *pow_table = (WORD32 *)aac_tables_ptr->res_block_tables_ptr->pow_table_q17;
934
893
  UWORD8 *start_read_pos = it_bit_buf->ptr_read_next;
935
936
893
  const UWORD16 *h_ori = (UWORD16 *)(aac_tables_ptr->code_book[code_no]);
937
938
893
  if (code_no == 11) {
939
115
    const UWORD16 *h_ori = aac_tables_ptr->res_huffmann_tables_ptr->huffman_codebook_11;
940
115
    ret_val = ixheaacd_res_c_block_decode_huff_word1_lb(it_bit_buf, len, h_ori, x_invquant,
941
115
                                                        pow_table, p_pul_arr);
942
778
  } else if (code_no <= 4) {
943
335
    WORD32 sign = 0;
944
335
    if (code_no > 2) sign = 1;
945
335
    ret_val = ixheaacd_res_c_block_decode_huff_word2_4_lb(it_bit_buf, len, h_ori, x_invquant,
946
335
                                                          pow_table, p_pul_arr, sign);
947
443
  } else if (code_no <= 10) {
948
443
    WORD32 sign = 0;
949
443
    if (code_no > 6) sign = 1;
950
443
    ret_val = ixheaacd_res_c_block_decode_huff_word2_2_lb(it_bit_buf, len, h_ori, x_invquant,
951
443
                                                          pow_table, p_pul_arr, sign);
952
443
  }
953
954
893
  {
955
893
    WORD bits_cons;
956
893
    if (it_bit_buf->bit_pos <= 7) {
957
315
      bits_cons = (WORD)(((it_bit_buf->ptr_read_next - start_read_pos) << 3) +
958
315
                         (it_bit_buf->bit_pos - start_bit_pos));
959
315
      it_bit_buf->cnt_bits -= bits_cons;
960
578
    } else {
961
578
      it_bit_buf->ptr_read_next += (it_bit_buf->bit_pos) >> 3;
962
578
      it_bit_buf->bit_pos = it_bit_buf->bit_pos & 0x7;
963
964
578
      bits_cons = (WORD)(((it_bit_buf->ptr_read_next - start_read_pos) << 3) +
965
578
                         ((it_bit_buf->bit_pos - start_bit_pos)));
966
578
      it_bit_buf->cnt_bits -= bits_cons;
967
578
    }
968
893
  }
969
893
  return ret_val;
970
893
}
971
972
static VOID ixheaacd_res_apply_one_scf(WORD32 scale_factor, WORD32 *x_invquant, WORD32 end,
973
57.5k
                                       WORD32 *scale_table_ptr) {
974
57.5k
  WORD32 j;
975
976
57.5k
  WORD32 temp_1;
977
57.5k
  WORD32 q_factor;
978
57.5k
  WORD32 buffer1;
979
57.5k
  WORD16 scale_short;
980
981
57.5k
  if (scale_factor < 24) {
982
117k
    for (j = end; j > 0; j--) {
983
105k
      *x_invquant++ = 0;
984
105k
    }
985
45.0k
  } else {
986
45.0k
    WORD32 shift;
987
45.0k
    q_factor = 37 - (scale_factor >> 2);
988
989
45.0k
    scale_short = scale_table_ptr[(scale_factor & 0x0003)];
990
991
45.0k
    shift = q_factor;
992
993
45.0k
    if (shift > 0) {
994
4.95k
      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
4.95k
      } else {
1003
58.3k
        for (j = end; j > 0; j--) {
1004
53.3k
          temp_1 = *x_invquant;
1005
1006
53.3k
          buffer1 = ixheaac_mult32x16in32_shl(temp_1, scale_short);
1007
1008
53.3k
          buffer1 = ixheaac_shr32(buffer1, shift);
1009
53.3k
          *x_invquant++ = buffer1;
1010
53.3k
        }
1011
4.95k
      }
1012
40.0k
    } else {
1013
40.0k
      shift = -shift;
1014
40.0k
      if (shift > 0) {
1015
39.5k
        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
39.5k
        } else {
1026
382k
          for (j = end; j > 0; j--) {
1027
342k
            temp_1 = *x_invquant;
1028
342k
            temp_1 = ixheaac_shl32(temp_1, shift - 1);
1029
1030
342k
            buffer1 = ixheaac_mult32x16in32_shl(temp_1, scale_short);
1031
1032
342k
            buffer1 = ixheaac_shl32(buffer1, 1);
1033
342k
            *x_invquant++ = buffer1;
1034
342k
          }
1035
39.5k
        }
1036
39.5k
      } else {
1037
539
        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
539
        } else {
1046
7.74k
          for (j = end; j > 0; j--) {
1047
7.20k
            temp_1 = *x_invquant;
1048
1049
7.20k
            buffer1 = ixheaac_mult32x16in32_shl(temp_1, scale_short);
1050
1051
7.20k
            *x_invquant++ = buffer1;
1052
7.20k
          }
1053
539
        }
1054
539
      }
1055
40.0k
    }
1056
45.0k
  }
1057
57.5k
}
1058
1059
VOID ixheaacd_res_apply_scfs(WORD32 *x_invquant, WORD16 *sc_factor, WORD t_bands, WORD8 *offset,
1060
6.98k
                             WORD32 *scale_table_ptr) {
1061
6.98k
  WORD32 i;
1062
6.98k
  WORD16 scale_factor;
1063
1064
64.5k
  for (i = t_bands - 1; i >= 0; i--) {
1065
57.5k
    scale_factor = *sc_factor++;
1066
57.5k
    ixheaacd_res_apply_one_scf(scale_factor, x_invquant, *offset, scale_table_ptr);
1067
57.5k
    x_invquant += *offset;
1068
57.5k
    offset++;
1069
57.5k
  }
1070
6.98k
}