Coverage Report

Created: 2025-11-10 06:22

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