Coverage Report

Created: 2026-04-12 06:52

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libxaac/decoder/ixheaacd_pns_js_thumb.c
Line
Count
Source
1
/******************************************************************************
2
 *                                                                            *
3
 * Copyright (C) 2018 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 <string.h>
21
#include <stdio.h>
22
#include <stdlib.h>
23
#include "ixheaacd_sbr_common.h"
24
#include "ixheaac_type_def.h"
25
#include "ixheaac_constants.h"
26
#include "ixheaac_basic_ops32.h"
27
#include "ixheaac_basic_ops16.h"
28
#include "ixheaac_basic_ops40.h"
29
#include "ixheaac_basic_ops.h"
30
31
#include "ixheaacd_bitbuffer.h"
32
33
#include "ixheaacd_error_codes.h"
34
#include "ixheaacd_defines.h"
35
#include "ixheaacd_aac_rom.h"
36
#include "ixheaacd_common_rom.h"
37
#include "ixheaacd_basic_funcs.h"
38
#include "ixheaacd_aac_imdct.h"
39
#include "ixheaac_basic_op.h"
40
#include "ixheaacd_intrinsics.h"
41
42
#include "ixheaacd_pulsedata.h"
43
44
#include "ixheaacd_pns.h"
45
#include "ixheaacd_drc_data_struct.h"
46
47
#include "ixheaacd_lt_predict.h"
48
#include "ixheaacd_cnst.h"
49
#include "ixheaacd_ec_defines.h"
50
#include "ixheaacd_ec_struct_def.h"
51
#include "ixheaacd_channelinfo.h"
52
#include "ixheaacd_drc_dec.h"
53
#include "ixheaacd_sbrdecoder.h"
54
#include "ixheaacd_block.h"
55
56
#include "ixheaacd_channel.h"
57
58
#include "ixheaacd_audioobjtypes.h"
59
#include "ixheaacd_latmdemux.h"
60
#include "ixheaacd_aacdec.h"
61
#include "ixheaacd_tns.h"
62
#include "ixheaacd_function_selector.h"
63
64
static PLATFORM_INLINE WORD16 ixheaacd_is_correlation(
65
537k
    ia_aac_dec_channel_info_struct *ptr_aac_dec_channel_info, WORD16 pns_band) {
66
537k
  ia_pns_correlation_info_struct *ptr_corr_info =
67
537k
      ptr_aac_dec_channel_info->pstr_pns_corr_info;
68
69
537k
  return ((ptr_corr_info->correlated[(pns_band >> PNS_BAND_FLAGS_SHIFT)] >>
70
537k
           (pns_band & PNS_BAND_FLAGS_MASK)) &
71
537k
          1);
72
537k
}
73
74
VOID ixheaacd_gen_rand_vec(WORD32 scale, WORD shift, WORD32 *ptr_spec_coef,
75
537k
                           WORD32 sfb_width, WORD32 *seed) {
76
537k
  WORD nrg_scale;
77
537k
  WORD32 nrg = 0;
78
537k
  WORD32 *spec = ptr_spec_coef;
79
537k
  WORD32 sfb;
80
81
6.53M
  for (sfb = 0; sfb <= sfb_width; sfb++) {
82
6.00M
    *seed = (WORD32)(((WORD64)1664525 * (WORD64)(*seed)) + (WORD64)1013904223);
83
84
6.00M
    *spec = (*seed >> 3);
85
86
6.00M
    nrg = ixheaac_add32_sat(nrg, ixheaac_mult32_shl_sat(*spec, *spec));
87
88
6.00M
    spec++;
89
6.00M
  }
90
91
537k
  nrg_scale = ixheaac_norm32(nrg);
92
93
537k
  if (nrg_scale > 0) {
94
537k
    nrg_scale &= ~1;
95
537k
    nrg = ixheaac_shl32_sat(nrg, nrg_scale);
96
537k
    shift = shift - (nrg_scale >> 1);
97
537k
  }
98
99
537k
  nrg = ixheaacd_sqrt(nrg);
100
537k
  scale = ixheaac_div32_pos_normb(scale, nrg);
101
102
537k
  spec = ptr_spec_coef;
103
104
537k
  if (shift < -31) {
105
22.3k
    shift = -31;
106
22.3k
  }
107
6.53M
  for (sfb = 0; sfb <= sfb_width; sfb++) {
108
6.00M
    *spec = ixheaac_shr32_dir_sat_limit(ixheaac_mult32_shl_sat(*spec, scale),
109
6.00M
                                         shift);
110
6.00M
    spec++;
111
6.00M
  }
112
537k
}
113
114
VOID ixheaacd_pns_process(ia_aac_dec_channel_info_struct *ptr_aac_dec_channel_info[CHANNELS],
115
220k
                          WORD32 channel, ia_aac_dec_tables_struct *ptr_aac_tables) {
116
220k
  ia_pns_info_struct *ptr_pns_info =
117
220k
      &ptr_aac_dec_channel_info[channel]->str_pns_info;
118
220k
  ia_ics_info_struct *ptr_ics_info =
119
220k
      &ptr_aac_dec_channel_info[channel]->str_ics_info;
120
220k
  WORD16 maximum_bins_short = ptr_ics_info->frame_length >> 3;
121
220k
  WORD32 *ptr_scale_mant_tab =
122
220k
      ptr_aac_tables->pstr_block_tables->scale_mant_tab;
123
124
220k
  if (ptr_pns_info->pns_active) {
125
33.3k
    const WORD16 *swb_offset =
126
33.3k
        ptr_aac_tables->str_aac_sfb_info[ptr_ics_info->window_sequence]
127
33.3k
            .sfb_index;
128
129
33.3k
    WORD num_win_group, grp_len, sfb;
130
33.3k
    WORD32 *spec = &ptr_aac_dec_channel_info[channel]->ptr_spec_coeff[0];
131
132
72.4k
    for (num_win_group = 0; num_win_group < ptr_ics_info->num_window_groups;
133
39.0k
         num_win_group++) {
134
39.0k
      grp_len = ptr_ics_info->window_group_length[num_win_group];
135
136
39.0k
      for (grp_len = 0;
137
116k
           grp_len < ptr_ics_info->window_group_length[num_win_group];
138
77.6k
           grp_len++) {
139
1.32M
        for (sfb = 0; sfb < ptr_ics_info->max_sfb; sfb++) {
140
1.24M
          WORD16 pns_band = ((num_win_group << 4) + sfb);
141
142
1.24M
          if (ptr_aac_dec_channel_info[channel]
143
1.24M
                  ->str_pns_info.pns_used[pns_band]) {
144
537k
            WORD32 scale_mant;
145
537k
            WORD32 scale_exp;
146
537k
            WORD32 sfb_width = swb_offset[sfb + 1] - swb_offset[sfb] - 1;
147
537k
            WORD32 *ptr_spec = &spec[swb_offset[sfb]];
148
149
537k
            scale_mant = ptr_scale_mant_tab[ptr_aac_dec_channel_info[channel]
150
537k
                                                ->ptr_scale_factor[pns_band] &
151
537k
                                            PNS_SCALE_MANT_TAB_MASK];
152
537k
            scale_exp = add_d(sub_d(31, (ptr_aac_dec_channel_info[channel]
153
537k
                                             ->ptr_scale_factor[pns_band] >>
154
537k
                                         PNS_SCALEFACTOR_SCALING)),
155
537k
                              PNS_SCALE_MANT_TAB_SCALING);
156
157
537k
            if (ixheaacd_is_correlation(ptr_aac_dec_channel_info[LEFT],
158
537k
                                        pns_band)) {
159
52.3k
              if (channel == 0) {
160
31.1k
                ptr_aac_dec_channel_info[LEFT]
161
31.1k
                    ->pstr_pns_corr_info->random_vector[pns_band] =
162
31.1k
                    ptr_aac_dec_channel_info[LEFT]
163
31.1k
                        ->pstr_pns_rand_vec_data->current_seed;
164
165
31.1k
                ixheaacd_gen_rand_vec(
166
31.1k
                    scale_mant, scale_exp, ptr_spec, sfb_width,
167
31.1k
                    &(ptr_aac_dec_channel_info[LEFT]
168
31.1k
                          ->pstr_pns_rand_vec_data->current_seed));
169
31.1k
              }
170
171
21.1k
              else {
172
21.1k
                ixheaacd_gen_rand_vec(
173
21.1k
                    scale_mant, scale_exp, ptr_spec, sfb_width,
174
21.1k
                    &(ptr_aac_dec_channel_info[LEFT]
175
21.1k
                          ->pstr_pns_corr_info->random_vector[pns_band]));
176
21.1k
              }
177
178
52.3k
            }
179
180
485k
            else {
181
485k
              ixheaacd_gen_rand_vec(
182
485k
                  scale_mant, scale_exp, ptr_spec, sfb_width,
183
485k
                  &(ptr_aac_dec_channel_info[LEFT]
184
485k
                        ->pstr_pns_rand_vec_data->current_seed));
185
485k
            }
186
537k
          }
187
1.24M
        }
188
189
77.6k
        if (maximum_bins_short == 120)
190
23.5k
          spec += maximum_bins_short;
191
54.0k
        else
192
54.0k
          spec += 128;
193
77.6k
      }
194
39.0k
    }
195
33.3k
  }
196
197
220k
  if (channel == 0) {
198
201k
    ptr_aac_dec_channel_info[0]->pstr_pns_rand_vec_data->pns_frame_number++;
199
201k
  }
200
220k
}
201
202
VOID ixheaacd_tns_decode_coef(const ia_filter_info_struct *filter,
203
                              WORD16 *parcor_coef,
204
30.7k
                              ia_aac_dec_tables_struct *ptr_aac_tables) {
205
30.7k
  WORD order, resolution;
206
30.7k
  WORD16 *ptr_par_coef = parcor_coef;
207
30.7k
  WORD16 *tns_coeff_ptr;
208
30.7k
  WORD8 ixheaacd_drc_offset = 4;
209
30.7k
  WORD8 *ptr_coef = (WORD8 *)filter->coef;
210
211
30.7k
  resolution = filter->resolution;
212
30.7k
  tns_coeff_ptr = ptr_aac_tables->pstr_block_tables->tns_coeff3_16;
213
214
30.7k
  if (resolution) {
215
19.1k
    tns_coeff_ptr = ptr_aac_tables->pstr_block_tables->tns_coeff4_16;
216
19.1k
    ixheaacd_drc_offset = ixheaacd_drc_offset << 1;
217
19.1k
  }
218
219
211k
  for (order = 0; order < filter->order; order++) {
220
180k
    WORD8 temp = *ptr_coef++;
221
180k
    *ptr_par_coef++ = tns_coeff_ptr[temp + ixheaacd_drc_offset];
222
180k
  }
223
30.7k
}
224
225
VOID ixheaacd_tns_decode_coef_ld(const ia_filter_info_struct *filter,
226
                                 WORD32 *parcor_coef,
227
0
                                 ia_aac_dec_tables_struct *ptr_aac_tables) {
228
0
  WORD order, resolution;
229
0
  WORD32 *ptr_par_coef = parcor_coef;
230
0
  WORD32 *tns_coeff_ptr;
231
0
  WORD8 offset = 4;
232
0
  WORD8 *ptr_coef = (WORD8 *)filter->coef;
233
234
0
  resolution = filter->resolution;
235
0
  tns_coeff_ptr = ptr_aac_tables->pstr_block_tables->tns_coeff3;
236
237
0
  if (resolution) {
238
0
    tns_coeff_ptr = ptr_aac_tables->pstr_block_tables->tns_coeff4;
239
0
    offset = offset << 1;
240
0
  }
241
242
0
  for (order = 0; order < filter->order; order++) {
243
0
    WORD8 temp = *ptr_coef++;
244
0
    *ptr_par_coef++ = tns_coeff_ptr[temp + offset];
245
0
  }
246
0
}
247
248
VOID ixheaacd_aac_tns_process(
249
    ia_aac_dec_channel_info_struct *ptr_aac_dec_channel_info, WORD32 num_ch,
250
    ia_aac_dec_tables_struct *ptr_aac_tables, WORD32 object_type,
251
67.3k
    WORD32 ar_flag, WORD32 *predicted_spectrum) {
252
67.3k
  WORD i;
253
67.3k
  WORD16 scale_lpc;
254
255
67.3k
  ia_tns_info_aac_struct *ptr_tns_info =
256
67.3k
      &ptr_aac_dec_channel_info->str_tns_info;
257
67.3k
  WORD32 *spec = ptr_aac_dec_channel_info->ptr_spec_coeff;
258
67.3k
  WORD32 *scratch_buf = ptr_aac_dec_channel_info->scratch_buf_ptr;
259
260
67.3k
  WORD win, filt, start, stop, size, scale_spec;
261
67.3k
  ia_ics_info_struct *ptr_ics_info = &ptr_aac_dec_channel_info->str_ics_info;
262
67.3k
  WORD num_window, tns_max_bands, win_seq;
263
67.3k
  WORD16 maximum_bins_short = ptr_ics_info->frame_length >> 3;
264
67.3k
  WORD position;
265
266
67.3k
  WORD32 parcor_coef[MAX_ORDER + 1];
267
67.3k
  WORD16 parcor_coef_16[MAX_ORDER + 1];
268
269
67.3k
  WORD32 lpc_coef[MAX_ORDER + 1];
270
67.3k
  WORD16 lpc_coef_16[MAX_ORDER + 1];
271
272
67.3k
  const WORD16 *ptr_sfb_table;
273
274
67.3k
  WORD16 max_bin_long = ptr_ics_info->frame_length;
275
276
67.3k
  win_seq = ptr_ics_info->window_sequence == 0
277
67.3k
                ? 0
278
67.3k
                : (ptr_ics_info->window_sequence % 2 == 0);
279
280
67.3k
  if (ar_flag)
281
57.2k
    spec = ptr_aac_dec_channel_info->ptr_spec_coeff;
282
10.1k
  else {
283
10.1k
    spec = predicted_spectrum;
284
10.1k
  }
285
286
67.3k
  if (object_type == AOT_ER_AAC_ELD || object_type == AOT_ER_AAC_LD ||
287
37.9k
      object_type == AOT_AAC_LTP) {
288
37.9k
    if (512 == ptr_ics_info->frame_length) {
289
26.2k
      tns_max_bands =
290
26.2k
          ptr_aac_tables->pstr_block_tables
291
26.2k
              ->tns_max_bands_tbl_ld[ptr_ics_info->sampling_rate_index];
292
26.2k
      win_seq = 1;
293
26.2k
      num_window = win_seq;
294
26.2k
    } else if (480 == ptr_ics_info->frame_length) {
295
5.10k
      tns_max_bands =
296
5.10k
          ptr_aac_tables->pstr_block_tables
297
5.10k
              ->tns_max_bands_tbl_480[ptr_ics_info->sampling_rate_index];
298
5.10k
      win_seq = 1;
299
5.10k
      num_window = win_seq;
300
6.59k
    } else {
301
6.59k
      tns_max_bands =
302
6.59k
          ptr_aac_tables->pstr_block_tables
303
6.59k
              ->tns_max_bands_tbl[ptr_ics_info->sampling_rate_index][win_seq];
304
305
6.59k
      num_window = win_seq ? 8 : 1;
306
6.59k
    }
307
37.9k
  } else {
308
29.4k
    tns_max_bands =
309
29.4k
        ptr_aac_tables->pstr_block_tables
310
29.4k
            ->tns_max_bands_tbl[ptr_ics_info->sampling_rate_index][win_seq];
311
312
29.4k
    num_window = win_seq ? 8 : 1;
313
29.4k
  }
314
315
67.3k
  ptr_sfb_table =
316
67.3k
      ptr_aac_tables->str_aac_sfb_info[ptr_ics_info->window_sequence].sfb_index;
317
318
192k
  for (win = 0; win < num_window; win++) {
319
124k
    WORD n_filt = ptr_tns_info->n_filt[win];
320
321
192k
    for (filt = 0; filt < n_filt; filt++) {
322
67.8k
      ia_filter_info_struct *filter = &ptr_tns_info->str_filter[win][filt];
323
324
67.8k
      if (filter->order <= 0) {
325
8.78k
        continue;
326
8.78k
      }
327
328
59.0k
      if ((object_type == AOT_ER_AAC_LD) || (object_type == AOT_AAC_LTP) ||
329
30.9k
          (num_ch > 2)) {
330
28.2k
        ixheaacd_tns_decode_coefficients(filter, parcor_coef, ptr_aac_tables);
331
332
30.7k
      } else {
333
30.7k
        ixheaacd_tns_decode_coef(filter, parcor_coef_16, ptr_aac_tables);
334
30.7k
      }
335
336
59.0k
      start = ixheaac_min32(ixheaac_min32(filter->start_band, tns_max_bands),
337
59.0k
                             ptr_ics_info->max_sfb);
338
339
59.0k
      start = ptr_sfb_table[start];
340
341
59.0k
      stop = ixheaac_min32(ixheaac_min32(filter->stop_band, tns_max_bands),
342
59.0k
                            ptr_ics_info->max_sfb);
343
344
59.0k
      stop = ptr_sfb_table[stop];
345
346
59.0k
      size = (stop - start);
347
348
59.0k
      if (size <= 0) {
349
9.76k
        continue;
350
9.76k
      }
351
49.2k
      if ((object_type == AOT_ER_AAC_LD) || (object_type == AOT_AAC_LTP) ||
352
25.9k
          (num_ch > 2)) {
353
23.4k
        ixheaacd_tns_parcor_to_lpc(parcor_coef, lpc_coef, &scale_lpc,
354
23.4k
                                   filter->order);
355
356
25.8k
      } else {
357
25.8k
        (*ixheaacd_tns_parcor_lpc_convert)(parcor_coef_16, lpc_coef_16,
358
25.8k
                                           &scale_lpc, filter->order);
359
25.8k
      }
360
361
49.2k
      {
362
49.2k
        WORD32 *ptr_tmp;
363
364
49.2k
        if (maximum_bins_short == 120)
365
9.92k
          ptr_tmp = spec + (win * maximum_bins_short) + start;
366
39.3k
        else
367
39.3k
          ptr_tmp = spec + (win << 7) + start;
368
369
49.2k
        scale_spec = (*ixheaacd_calc_max_spectral_line)(ptr_tmp, size);
370
49.2k
      }
371
372
49.2k
      if (filter->direction == -1) {
373
24.8k
        position = stop - 1;
374
375
24.8k
        if (maximum_bins_short == 120) {
376
7.66k
          if (((win * maximum_bins_short) + position) < filter->order) continue;
377
17.2k
        } else {
378
17.2k
          if (((win << 7) + position) < filter->order) continue;
379
17.2k
        }
380
381
24.8k
      } else {
382
24.4k
        position = start;
383
24.4k
        if (maximum_bins_short == 120) {
384
2.26k
          if ((((win * maximum_bins_short) + position) + filter->order) > max_bin_long)
385
0
            continue;
386
22.1k
        } else {
387
22.1k
          if ((((win << 7) + position) + filter->order) > MAX_BINS_LONG) continue;
388
22.1k
        }
389
24.4k
      }
390
391
47.5k
      if ((num_ch <= 2) &&
392
47.4k
          ((object_type != AOT_ER_AAC_LD) && (object_type != AOT_AAC_LTP)))
393
24.1k
        scale_spec = ((scale_spec - 4) - scale_lpc);
394
23.4k
      else {
395
23.4k
        if (scale_spec > 17)
396
762
          scale_spec = ((scale_spec - 6) - scale_lpc);
397
22.7k
        else if (scale_spec > 11)
398
292
          scale_spec = ((scale_spec - 5) - scale_lpc);
399
22.4k
        else
400
22.4k
          scale_spec = ((scale_spec - 4) - scale_lpc);
401
23.4k
      }
402
403
47.5k
      if (scale_spec > 0) {
404
12.8k
        scale_spec = ixheaac_min32(scale_spec, 31);
405
406
12.8k
        if ((object_type == AOT_ER_AAC_LD) || (object_type == AOT_AAC_LTP) ||
407
8.56k
            (num_ch > 2)) {
408
4.34k
          if (ar_flag)
409
3.71k
          {
410
3.71k
            if (maximum_bins_short == 120) {
411
224
              (*ixheaacd_tns_ar_filter_fixed)(&spec[(win * maximum_bins_short) + position],
412
224
                                              size, filter->direction,
413
224
                                              (WORD32 *)lpc_coef, filter->order,
414
224
                                              (WORD32)scale_lpc, scale_spec);
415
3.48k
            } else {
416
3.48k
              (*ixheaacd_tns_ar_filter_fixed)(&spec[(win << 7) + position], size,
417
3.48k
                                              filter->direction,
418
3.48k
                                              (WORD32 *)lpc_coef, filter->order,
419
3.48k
                                              (WORD32)scale_lpc, scale_spec);
420
3.48k
            }
421
3.71k
          } else {
422
634
            if (maximum_bins_short == 120) {
423
51
              ixheaacd_tns_ma_filter_fixed_ld(&spec[(win * maximum_bins_short) + position],
424
51
                                              size, filter->direction, lpc_coef,
425
51
                                              filter->order, scale_lpc);
426
583
            } else {
427
583
              ixheaacd_tns_ma_filter_fixed_ld(&spec[(win << 7) + position], size,
428
583
                                              filter->direction, lpc_coef,
429
583
                                              filter->order, scale_lpc);
430
583
            }
431
634
          }
432
8.51k
        } else {
433
8.51k
          if (object_type == AOT_ER_AAC_ELD) scale_spec = scale_spec - 1;
434
8.51k
          if (maximum_bins_short == 120) {
435
4.99k
            (*ixheaacd_tns_ar_filter)(&spec[(win * maximum_bins_short) + position], size,
436
4.99k
                                      filter->direction, lpc_coef_16,
437
4.99k
                                      filter->order, (WORD32)scale_lpc,
438
4.99k
                                      scale_spec, scratch_buf);
439
4.99k
          } else {
440
3.52k
            (*ixheaacd_tns_ar_filter)(&spec[(win << 7) + position], size,
441
3.52k
                                      filter->direction, lpc_coef_16,
442
3.52k
                                      filter->order, (WORD32)scale_lpc,
443
3.52k
                                      scale_spec, scratch_buf);
444
3.52k
          }
445
8.51k
        }
446
12.8k
      }
447
448
34.7k
      else {
449
34.7k
        WORD32 *ptr_tmp;
450
451
34.7k
        if (maximum_bins_short == 120)
452
3.79k
          ptr_tmp = spec + (win * maximum_bins_short) + start;
453
30.9k
        else
454
30.9k
          ptr_tmp = spec + (win >> 7) + start;
455
456
34.7k
        scale_spec = -scale_spec;
457
34.7k
        scale_spec = ixheaac_min32(scale_spec, 31);
458
459
4.85M
        for (i = size; i != 0; i--) {
460
4.81M
          *ptr_tmp = (*ptr_tmp >> scale_spec);
461
4.81M
          ptr_tmp++;
462
4.81M
        }
463
464
34.7k
        if ((object_type == AOT_ER_AAC_LD) || (object_type == AOT_AAC_LTP) ||
465
19.1k
            num_ch > 2) {
466
19.1k
          if (ar_flag) {
467
8.18k
            if (maximum_bins_short == 120) {
468
79
              (*ixheaacd_tns_ar_filter_fixed)(
469
79
                  &spec[(win * maximum_bins_short) + position], size, filter->direction,
470
79
                  (WORD32 *)lpc_coef, filter->order, scale_lpc, 0);
471
8.10k
            } else {
472
8.10k
              (*ixheaacd_tns_ar_filter_fixed)(
473
8.10k
                  &spec[(win << 7) + position], size, filter->direction,
474
8.10k
                  (WORD32 *)lpc_coef, filter->order, scale_lpc, 0);
475
8.10k
            }
476
10.9k
          } else {
477
10.9k
            if (maximum_bins_short == 120) {
478
29
              ixheaacd_tns_ma_filter_fixed_ld(&spec[(win * maximum_bins_short) + position],
479
29
                                              size, filter->direction, lpc_coef,
480
29
                                              filter->order, scale_lpc);
481
10.9k
            } else {
482
10.9k
              ixheaacd_tns_ma_filter_fixed_ld(&spec[(win << 7) + position], size,
483
10.9k
                                              filter->direction, lpc_coef,
484
10.9k
                                              filter->order, scale_lpc);
485
10.9k
            }
486
10.9k
          }
487
19.1k
        } else {
488
15.5k
          if (object_type == AOT_ER_AAC_ELD) {
489
3.19k
            scale_lpc = scale_lpc - 1;
490
3.19k
          }
491
492
15.5k
          if (maximum_bins_short == 120) {
493
3.68k
            (*ixheaacd_tns_ar_filter)(&spec[(win * maximum_bins_short) + position], size,
494
3.68k
                                      filter->direction, lpc_coef_16,
495
3.68k
                                      filter->order, scale_lpc, 0, scratch_buf);
496
11.8k
          } else {
497
11.8k
            (*ixheaacd_tns_ar_filter)(&spec[(win << 7) + position], size,
498
11.8k
                                      filter->direction, lpc_coef_16,
499
11.8k
                                      filter->order, scale_lpc, 0, scratch_buf);
500
11.8k
          }
501
15.5k
        }
502
503
34.7k
        if (maximum_bins_short == 120)
504
3.79k
          ptr_tmp = spec + (win * maximum_bins_short) + start;
505
30.9k
        else
506
30.9k
          ptr_tmp = spec + (win << 7) + start;
507
508
4.85M
        for (i = size; i != 0; i--) {
509
4.81M
          *ptr_tmp = (*ptr_tmp << scale_spec);
510
4.81M
          ptr_tmp++;
511
4.81M
        }
512
34.7k
      }
513
47.5k
    }
514
124k
  }
515
67.3k
}