Coverage Report

Created: 2026-01-10 06:30

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