Coverage Report

Created: 2025-11-09 07:01

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