Coverage Report

Created: 2025-08-26 06:53

/src/libxaac/decoder/ixheaacd_pns_js_thumb.c
Line
Count
Source (jump to first uncovered line)
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
494k
    ia_aac_dec_channel_info_struct *ptr_aac_dec_channel_info, WORD16 pns_band) {
66
494k
  ia_pns_correlation_info_struct *ptr_corr_info =
67
494k
      ptr_aac_dec_channel_info->pstr_pns_corr_info;
68
69
494k
  return ((ptr_corr_info->correlated[(pns_band >> PNS_BAND_FLAGS_SHIFT)] >>
70
494k
           (pns_band & PNS_BAND_FLAGS_MASK)) &
71
494k
          1);
72
494k
}
73
74
VOID ixheaacd_gen_rand_vec(WORD32 scale, WORD shift, WORD32 *ptr_spec_coef,
75
494k
                           WORD32 sfb_width, WORD32 *seed) {
76
494k
  WORD nrg_scale;
77
494k
  WORD32 nrg = 0;
78
494k
  WORD32 *spec = ptr_spec_coef;
79
494k
  WORD32 sfb;
80
81
6.29M
  for (sfb = 0; sfb <= sfb_width; sfb++) {
82
5.80M
    *seed = (WORD32)(((WORD64)1664525 * (WORD64)(*seed)) + (WORD64)1013904223);
83
84
5.80M
    *spec = (*seed >> 3);
85
86
5.80M
    nrg = ixheaac_add32_sat(nrg, ixheaac_mult32_shl_sat(*spec, *spec));
87
88
5.80M
    spec++;
89
5.80M
  }
90
91
494k
  nrg_scale = ixheaac_norm32(nrg);
92
93
494k
  if (nrg_scale > 0) {
94
494k
    nrg_scale &= ~1;
95
494k
    nrg = ixheaac_shl32_sat(nrg, nrg_scale);
96
494k
    shift = shift - (nrg_scale >> 1);
97
494k
  }
98
99
494k
  nrg = ixheaacd_sqrt(nrg);
100
494k
  scale = ixheaac_div32_pos_normb(scale, nrg);
101
102
494k
  spec = ptr_spec_coef;
103
104
494k
  if (shift < -31) {
105
36.7k
    shift = -31;
106
36.7k
  }
107
6.29M
  for (sfb = 0; sfb <= sfb_width; sfb++) {
108
5.80M
    *spec = ixheaac_shr32_dir_sat_limit(ixheaac_mult32_shl_sat(*spec, scale),
109
5.80M
                                         shift);
110
5.80M
    spec++;
111
5.80M
  }
112
494k
}
113
114
VOID ixheaacd_pns_process(ia_aac_dec_channel_info_struct *ptr_aac_dec_channel_info[CHANNELS],
115
253k
                          WORD32 channel, ia_aac_dec_tables_struct *ptr_aac_tables) {
116
253k
  ia_pns_info_struct *ptr_pns_info =
117
253k
      &ptr_aac_dec_channel_info[channel]->str_pns_info;
118
253k
  ia_ics_info_struct *ptr_ics_info =
119
253k
      &ptr_aac_dec_channel_info[channel]->str_ics_info;
120
253k
  WORD16 maximum_bins_short = ptr_ics_info->frame_length >> 3;
121
253k
  WORD32 *ptr_scale_mant_tab =
122
253k
      ptr_aac_tables->pstr_block_tables->scale_mant_tab;
123
124
253k
  if (ptr_pns_info->pns_active) {
125
37.2k
    const WORD16 *swb_offset =
126
37.2k
        ptr_aac_tables->str_aac_sfb_info[ptr_ics_info->window_sequence]
127
37.2k
            .sfb_index;
128
129
37.2k
    WORD num_win_group, grp_len, sfb;
130
37.2k
    WORD32 *spec = &ptr_aac_dec_channel_info[channel]->ptr_spec_coeff[0];
131
132
83.5k
    for (num_win_group = 0; num_win_group < ptr_ics_info->num_window_groups;
133
46.2k
         num_win_group++) {
134
46.2k
      grp_len = ptr_ics_info->window_group_length[num_win_group];
135
136
46.2k
      for (grp_len = 0;
137
123k
           grp_len < ptr_ics_info->window_group_length[num_win_group];
138
77.2k
           grp_len++) {
139
1.38M
        for (sfb = 0; sfb < ptr_ics_info->max_sfb; sfb++) {
140
1.30M
          WORD16 pns_band = ((num_win_group << 4) + sfb);
141
142
1.30M
          if (ptr_aac_dec_channel_info[channel]
143
1.30M
                  ->str_pns_info.pns_used[pns_band]) {
144
494k
            WORD32 scale_mant;
145
494k
            WORD32 scale_exp;
146
494k
            WORD32 sfb_width = swb_offset[sfb + 1] - swb_offset[sfb] - 1;
147
494k
            WORD32 *ptr_spec = &spec[swb_offset[sfb]];
148
149
494k
            scale_mant = ptr_scale_mant_tab[ptr_aac_dec_channel_info[channel]
150
494k
                                                ->ptr_scale_factor[pns_band] &
151
494k
                                            PNS_SCALE_MANT_TAB_MASK];
152
494k
            scale_exp = add_d(sub_d(31, (ptr_aac_dec_channel_info[channel]
153
494k
                                             ->ptr_scale_factor[pns_band] >>
154
494k
                                         PNS_SCALEFACTOR_SCALING)),
155
494k
                              PNS_SCALE_MANT_TAB_SCALING);
156
157
494k
            if (ixheaacd_is_correlation(ptr_aac_dec_channel_info[LEFT],
158
494k
                                        pns_band)) {
159
85.1k
              if (channel == 0) {
160
50.6k
                ptr_aac_dec_channel_info[LEFT]
161
50.6k
                    ->pstr_pns_corr_info->random_vector[pns_band] =
162
50.6k
                    ptr_aac_dec_channel_info[LEFT]
163
50.6k
                        ->pstr_pns_rand_vec_data->current_seed;
164
165
50.6k
                ixheaacd_gen_rand_vec(
166
50.6k
                    scale_mant, scale_exp, ptr_spec, sfb_width,
167
50.6k
                    &(ptr_aac_dec_channel_info[LEFT]
168
50.6k
                          ->pstr_pns_rand_vec_data->current_seed));
169
50.6k
              }
170
171
34.5k
              else {
172
34.5k
                ixheaacd_gen_rand_vec(
173
34.5k
                    scale_mant, scale_exp, ptr_spec, sfb_width,
174
34.5k
                    &(ptr_aac_dec_channel_info[LEFT]
175
34.5k
                          ->pstr_pns_corr_info->random_vector[pns_band]));
176
34.5k
              }
177
178
85.1k
            }
179
180
409k
            else {
181
409k
              ixheaacd_gen_rand_vec(
182
409k
                  scale_mant, scale_exp, ptr_spec, sfb_width,
183
409k
                  &(ptr_aac_dec_channel_info[LEFT]
184
409k
                        ->pstr_pns_rand_vec_data->current_seed));
185
409k
            }
186
494k
          }
187
1.30M
        }
188
189
77.2k
        if (maximum_bins_short == 120)
190
25.7k
          spec += maximum_bins_short;
191
51.4k
        else
192
51.4k
          spec += 128;
193
77.2k
      }
194
46.2k
    }
195
37.2k
  }
196
197
253k
  if (channel == 0) {
198
229k
    ptr_aac_dec_channel_info[0]->pstr_pns_rand_vec_data->pns_frame_number++;
199
229k
  }
200
253k
}
201
202
VOID ixheaacd_tns_decode_coef(const ia_filter_info_struct *filter,
203
                              WORD16 *parcor_coef,
204
38.1k
                              ia_aac_dec_tables_struct *ptr_aac_tables) {
205
38.1k
  WORD order, resolution;
206
38.1k
  WORD16 *ptr_par_coef = parcor_coef;
207
38.1k
  WORD16 *tns_coeff_ptr;
208
38.1k
  WORD8 ixheaacd_drc_offset = 4;
209
38.1k
  WORD8 *ptr_coef = (WORD8 *)filter->coef;
210
211
38.1k
  resolution = filter->resolution;
212
38.1k
  tns_coeff_ptr = ptr_aac_tables->pstr_block_tables->tns_coeff3_16;
213
214
38.1k
  if (resolution) {
215
25.7k
    tns_coeff_ptr = ptr_aac_tables->pstr_block_tables->tns_coeff4_16;
216
25.7k
    ixheaacd_drc_offset = ixheaacd_drc_offset << 1;
217
25.7k
  }
218
219
261k
  for (order = 0; order < filter->order; order++) {
220
223k
    WORD8 temp = *ptr_coef++;
221
223k
    *ptr_par_coef++ = tns_coeff_ptr[temp + ixheaacd_drc_offset];
222
223k
  }
223
38.1k
}
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
79.3k
    WORD32 ar_flag, WORD32 *predicted_spectrum) {
252
79.3k
  WORD i;
253
79.3k
  WORD16 scale_lpc;
254
255
79.3k
  ia_tns_info_aac_struct *ptr_tns_info =
256
79.3k
      &ptr_aac_dec_channel_info->str_tns_info;
257
79.3k
  WORD32 *spec = ptr_aac_dec_channel_info->ptr_spec_coeff;
258
79.3k
  WORD32 *scratch_buf = ptr_aac_dec_channel_info->scratch_buf_ptr;
259
260
79.3k
  WORD win, filt, start, stop, size, scale_spec;
261
79.3k
  ia_ics_info_struct *ptr_ics_info = &ptr_aac_dec_channel_info->str_ics_info;
262
79.3k
  WORD num_window, tns_max_bands, win_seq;
263
79.3k
  WORD16 maximum_bins_short = ptr_ics_info->frame_length >> 3;
264
79.3k
  WORD position;
265
266
79.3k
  WORD32 parcor_coef[MAX_ORDER + 1];
267
79.3k
  WORD16 parcor_coef_16[MAX_ORDER + 1];
268
269
79.3k
  WORD32 lpc_coef[MAX_ORDER + 1];
270
79.3k
  WORD16 lpc_coef_16[MAX_ORDER + 1];
271
272
79.3k
  const WORD16 *ptr_sfb_table;
273
274
79.3k
  WORD16 max_bin_long = ptr_ics_info->frame_length;
275
276
79.3k
  win_seq = ptr_ics_info->window_sequence == 0
277
79.3k
                ? 0
278
79.3k
                : (ptr_ics_info->window_sequence % 2 == 0);
279
280
79.3k
  if (ar_flag)
281
68.0k
    spec = ptr_aac_dec_channel_info->ptr_spec_coeff;
282
11.2k
  else {
283
11.2k
    spec = predicted_spectrum;
284
11.2k
  }
285
286
79.3k
  if (object_type == AOT_ER_AAC_ELD || object_type == AOT_ER_AAC_LD ||
287
79.3k
      object_type == AOT_AAC_LTP) {
288
40.3k
    if (512 == ptr_ics_info->frame_length) {
289
30.4k
      tns_max_bands =
290
30.4k
          ptr_aac_tables->pstr_block_tables
291
30.4k
              ->tns_max_bands_tbl_ld[ptr_ics_info->sampling_rate_index];
292
30.4k
      win_seq = 1;
293
30.4k
      num_window = win_seq;
294
30.4k
    } else if (480 == ptr_ics_info->frame_length) {
295
5.41k
      tns_max_bands =
296
5.41k
          ptr_aac_tables->pstr_block_tables
297
5.41k
              ->tns_max_bands_tbl_480[ptr_ics_info->sampling_rate_index];
298
5.41k
      win_seq = 1;
299
5.41k
      num_window = win_seq;
300
5.41k
    } else {
301
4.52k
      tns_max_bands =
302
4.52k
          ptr_aac_tables->pstr_block_tables
303
4.52k
              ->tns_max_bands_tbl[ptr_ics_info->sampling_rate_index][win_seq];
304
305
4.52k
      num_window = win_seq ? 8 : 1;
306
4.52k
    }
307
40.3k
  } else {
308
38.9k
    tns_max_bands =
309
38.9k
        ptr_aac_tables->pstr_block_tables
310
38.9k
            ->tns_max_bands_tbl[ptr_ics_info->sampling_rate_index][win_seq];
311
312
38.9k
    num_window = win_seq ? 8 : 1;
313
38.9k
  }
314
315
79.3k
  ptr_sfb_table =
316
79.3k
      ptr_aac_tables->str_aac_sfb_info[ptr_ics_info->window_sequence].sfb_index;
317
318
229k
  for (win = 0; win < num_window; win++) {
319
149k
    WORD n_filt = ptr_tns_info->n_filt[win];
320
321
235k
    for (filt = 0; filt < n_filt; filt++) {
322
85.5k
      ia_filter_info_struct *filter = &ptr_tns_info->str_filter[win][filt];
323
324
85.5k
      if (filter->order <= 0) {
325
13.5k
        continue;
326
13.5k
      }
327
328
71.9k
      if ((object_type == AOT_ER_AAC_LD) || (object_type == AOT_AAC_LTP) ||
329
71.9k
          (num_ch > 2)) {
330
33.8k
        ixheaacd_tns_decode_coefficients(filter, parcor_coef, ptr_aac_tables);
331
332
38.1k
      } else {
333
38.1k
        ixheaacd_tns_decode_coef(filter, parcor_coef_16, ptr_aac_tables);
334
38.1k
      }
335
336
71.9k
      start = ixheaac_min32(ixheaac_min32(filter->start_band, tns_max_bands),
337
71.9k
                             ptr_ics_info->max_sfb);
338
339
71.9k
      start = ptr_sfb_table[start];
340
341
71.9k
      stop = ixheaac_min32(ixheaac_min32(filter->stop_band, tns_max_bands),
342
71.9k
                            ptr_ics_info->max_sfb);
343
344
71.9k
      stop = ptr_sfb_table[stop];
345
346
71.9k
      size = (stop - start);
347
348
71.9k
      if (size <= 0) {
349
13.3k
        continue;
350
13.3k
      }
351
58.5k
      if ((object_type == AOT_ER_AAC_LD) || (object_type == AOT_AAC_LTP) ||
352
58.5k
          (num_ch > 2)) {
353
27.8k
        ixheaacd_tns_parcor_to_lpc(parcor_coef, lpc_coef, &scale_lpc,
354
27.8k
                                   filter->order);
355
356
30.7k
      } else {
357
30.7k
        (*ixheaacd_tns_parcor_lpc_convert)(parcor_coef_16, lpc_coef_16,
358
30.7k
                                           &scale_lpc, filter->order);
359
30.7k
      }
360
361
58.5k
      {
362
58.5k
        WORD32 *ptr_tmp;
363
364
58.5k
        if (maximum_bins_short == 120)
365
16.2k
          ptr_tmp = spec + (win * maximum_bins_short) + start;
366
42.3k
        else
367
42.3k
          ptr_tmp = spec + (win << 7) + start;
368
369
58.5k
        scale_spec = (*ixheaacd_calc_max_spectral_line)(ptr_tmp, size);
370
58.5k
      }
371
372
58.5k
      if (filter->direction == -1) {
373
29.4k
        position = stop - 1;
374
375
29.4k
        if (maximum_bins_short == 120) {
376
11.6k
          if (((win * maximum_bins_short) + position) < filter->order) continue;
377
17.8k
        } else {
378
17.8k
          if (((win << 7) + position) < filter->order) continue;
379
17.8k
        }
380
381
29.4k
      } else {
382
29.0k
        position = start;
383
29.0k
        if (maximum_bins_short == 120) {
384
4.58k
          if ((((win * maximum_bins_short) + position) + filter->order) > max_bin_long)
385
0
            continue;
386
24.4k
        } else {
387
24.4k
          if ((((win << 7) + position) + filter->order) > MAX_BINS_LONG) continue;
388
24.4k
        }
389
29.0k
      }
390
391
55.7k
      if ((num_ch <= 2) &&
392
55.7k
          ((object_type != AOT_ER_AAC_LD) && (object_type != AOT_AAC_LTP)))
393
27.8k
        scale_spec = ((scale_spec - 4) - scale_lpc);
394
27.8k
      else {
395
27.8k
        if (scale_spec > 17)
396
1.12k
          scale_spec = ((scale_spec - 6) - scale_lpc);
397
26.6k
        else if (scale_spec > 11)
398
431
          scale_spec = ((scale_spec - 5) - scale_lpc);
399
26.2k
        else
400
26.2k
          scale_spec = ((scale_spec - 4) - scale_lpc);
401
27.8k
      }
402
403
55.7k
      if (scale_spec > 0) {
404
18.6k
        scale_spec = ixheaac_min32(scale_spec, 31);
405
406
18.6k
        if ((object_type == AOT_ER_AAC_LD) || (object_type == AOT_AAC_LTP) ||
407
18.6k
            (num_ch > 2)) {
408
6.27k
          if (ar_flag)
409
5.20k
          {
410
5.20k
            if (maximum_bins_short == 120) {
411
253
              (*ixheaacd_tns_ar_filter_fixed)(&spec[(win * maximum_bins_short) + position],
412
253
                                              size, filter->direction,
413
253
                                              (WORD32 *)lpc_coef, filter->order,
414
253
                                              (WORD32)scale_lpc, scale_spec);
415
4.95k
            } else {
416
4.95k
              (*ixheaacd_tns_ar_filter_fixed)(&spec[(win << 7) + position], size,
417
4.95k
                                              filter->direction,
418
4.95k
                                              (WORD32 *)lpc_coef, filter->order,
419
4.95k
                                              (WORD32)scale_lpc, scale_spec);
420
4.95k
            }
421
5.20k
          } else {
422
1.07k
            if (maximum_bins_short == 120) {
423
27
              ixheaacd_tns_ma_filter_fixed_ld(&spec[(win * maximum_bins_short) + position],
424
27
                                              size, filter->direction, lpc_coef,
425
27
                                              filter->order, scale_lpc);
426
1.04k
            } else {
427
1.04k
              ixheaacd_tns_ma_filter_fixed_ld(&spec[(win << 7) + position], size,
428
1.04k
                                              filter->direction, lpc_coef,
429
1.04k
                                              filter->order, scale_lpc);
430
1.04k
            }
431
1.07k
          }
432
12.4k
        } else {
433
12.4k
          if (object_type == AOT_ER_AAC_ELD) scale_spec = scale_spec - 1;
434
12.4k
          if (maximum_bins_short == 120) {
435
9.01k
            (*ixheaacd_tns_ar_filter)(&spec[(win * maximum_bins_short) + position], size,
436
9.01k
                                      filter->direction, lpc_coef_16,
437
9.01k
                                      filter->order, (WORD32)scale_lpc,
438
9.01k
                                      scale_spec, scratch_buf);
439
9.01k
          } else {
440
3.39k
            (*ixheaacd_tns_ar_filter)(&spec[(win << 7) + position], size,
441
3.39k
                                      filter->direction, lpc_coef_16,
442
3.39k
                                      filter->order, (WORD32)scale_lpc,
443
3.39k
                                      scale_spec, scratch_buf);
444
3.39k
          }
445
12.4k
        }
446
18.6k
      }
447
448
37.0k
      else {
449
37.0k
        WORD32 *ptr_tmp;
450
451
37.0k
        if (maximum_bins_short == 120)
452
5.20k
          ptr_tmp = spec + (win * maximum_bins_short) + start;
453
31.8k
        else
454
31.8k
          ptr_tmp = spec + (win >> 7) + start;
455
456
37.0k
        scale_spec = -scale_spec;
457
37.0k
        scale_spec = ixheaac_min32(scale_spec, 31);
458
459
4.96M
        for (i = size; i != 0; i--) {
460
4.92M
          *ptr_tmp = (*ptr_tmp >> scale_spec);
461
4.92M
          ptr_tmp++;
462
4.92M
        }
463
464
37.0k
        if ((object_type == AOT_ER_AAC_LD) || (object_type == AOT_AAC_LTP) ||
465
37.0k
            num_ch > 2) {
466
21.5k
          if (ar_flag) {
467
8.94k
            if (maximum_bins_short == 120) {
468
105
              (*ixheaacd_tns_ar_filter_fixed)(
469
105
                  &spec[(win * maximum_bins_short) + position], size, filter->direction,
470
105
                  (WORD32 *)lpc_coef, filter->order, scale_lpc, 0);
471
8.84k
            } else {
472
8.84k
              (*ixheaacd_tns_ar_filter_fixed)(
473
8.84k
                  &spec[(win << 7) + position], size, filter->direction,
474
8.84k
                  (WORD32 *)lpc_coef, filter->order, scale_lpc, 0);
475
8.84k
            }
476
12.5k
          } else {
477
12.5k
            if (maximum_bins_short == 120) {
478
11
              ixheaacd_tns_ma_filter_fixed_ld(&spec[(win * maximum_bins_short) + position],
479
11
                                              size, filter->direction, lpc_coef,
480
11
                                              filter->order, scale_lpc);
481
12.5k
            } else {
482
12.5k
              ixheaacd_tns_ma_filter_fixed_ld(&spec[(win << 7) + position], size,
483
12.5k
                                              filter->direction, lpc_coef,
484
12.5k
                                              filter->order, scale_lpc);
485
12.5k
            }
486
12.5k
          }
487
21.5k
        } else {
488
15.4k
          if (object_type == AOT_ER_AAC_ELD) {
489
1.26k
            scale_lpc = scale_lpc - 1;
490
1.26k
          }
491
492
15.4k
          if (maximum_bins_short == 120) {
493
5.08k
            (*ixheaacd_tns_ar_filter)(&spec[(win * maximum_bins_short) + position], size,
494
5.08k
                                      filter->direction, lpc_coef_16,
495
5.08k
                                      filter->order, scale_lpc, 0, scratch_buf);
496
10.3k
          } else {
497
10.3k
            (*ixheaacd_tns_ar_filter)(&spec[(win << 7) + position], size,
498
10.3k
                                      filter->direction, lpc_coef_16,
499
10.3k
                                      filter->order, scale_lpc, 0, scratch_buf);
500
10.3k
          }
501
15.4k
        }
502
503
37.0k
        if (maximum_bins_short == 120)
504
5.20k
          ptr_tmp = spec + (win * maximum_bins_short) + start;
505
31.8k
        else
506
31.8k
          ptr_tmp = spec + (win << 7) + start;
507
508
4.96M
        for (i = size; i != 0; i--) {
509
4.92M
          *ptr_tmp = (*ptr_tmp << scale_spec);
510
4.92M
          ptr_tmp++;
511
4.92M
        }
512
37.0k
      }
513
55.7k
    }
514
149k
  }
515
79.3k
}