Coverage Report

Created: 2025-08-24 07:17

/src/libxaac/decoder/ixheaacd_sbr_dec.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 "ixheaacd_sbr_common.h"
22
#include "ixheaac_type_def.h"
23
24
#include "ixheaac_constants.h"
25
#include "ixheaac_basic_ops32.h"
26
#include "ixheaac_basic_ops16.h"
27
#include "ixheaac_basic_ops40.h"
28
#include "ixheaac_basic_ops.h"
29
30
#include "ixheaac_basic_op.h"
31
#include "ixheaacd_intrinsics.h"
32
#include "ixheaacd_common_rom.h"
33
#include "ixheaacd_basic_funcs.h"
34
#include "ixheaacd_bitbuffer.h"
35
#include "ixheaacd_defines.h"
36
37
#include "ixheaacd_pns.h"
38
39
#include "ixheaacd_aac_rom.h"
40
#include "ixheaacd_pulsedata.h"
41
42
#include "ixheaacd_drc_data_struct.h"
43
#include "ixheaacd_lt_predict.h"
44
#include "ixheaacd_cnst.h"
45
#include "ixheaacd_ec_defines.h"
46
#include "ixheaacd_ec_struct_def.h"
47
#include "ixheaacd_channelinfo.h"
48
#include "ixheaacd_drc_dec.h"
49
#include "ixheaacd_sbrdecoder.h"
50
51
#include "ixheaacd_defines.h"
52
#include "ixheaacd_sbrdecoder.h"
53
#include "ixheaacd_definitions.h"
54
#include "ixheaacd_error_codes.h"
55
56
#include "ixheaacd_pulsedata.h"
57
58
#include "ixheaacd_sbrdecsettings.h"
59
#include "ixheaacd_sbr_scale.h"
60
#include "ixheaacd_lpp_tran.h"
61
#include "ixheaacd_env_extr_part.h"
62
#include "ixheaacd_sbr_rom.h"
63
#include "ixheaacd_hybrid.h"
64
#include "ixheaacd_ps_dec.h"
65
#include "ixheaacd_env_extr.h"
66
67
#include "ixheaacd_qmf_dec.h"
68
69
#include "ixheaacd_env_calc.h"
70
#include "ixheaac_sbr_const.h"
71
72
#include "ixheaacd_pvc_dec.h"
73
#include "ixheaacd_sbr_dec.h"
74
#include "ixheaacd_env_extr.h"
75
#include "ixheaacd_env_calc.h"
76
#include "ixheaacd_ps_dec.h"
77
#include "ixheaacd_function_selector.h"
78
79
#include "ixheaacd_audioobjtypes.h"
80
81
VOID ixheaacd_qmf_enrg_calc(ia_sbr_dec_struct *ptr_sbr_dec,
82
134k
                            WORD32 upsample_ratio_idx, WORD32 low_pow_flag) {
83
134k
  WORD32 i, j;
84
134k
  if (upsample_ratio_idx == SBR_UPSAMPLE_IDX_4_1) {
85
1.36M
    for (i = 0; i < ptr_sbr_dec->str_codec_qmf_bank.num_time_slots; i++) {
86
22.8M
      for (j = 0; j < 16; j++) {
87
21.5M
        ptr_sbr_dec->qmf_energy_buf[i][j] =
88
21.5M
            ptr_sbr_dec->qmf_buf_real[2 + i][j] *
89
21.5M
            ptr_sbr_dec->qmf_buf_real[2 + i][j];
90
21.5M
        if (!low_pow_flag)
91
21.5M
          ptr_sbr_dec->qmf_energy_buf[i][j] +=
92
21.5M
              (ptr_sbr_dec->qmf_buf_imag[2 + i][j] *
93
21.5M
               ptr_sbr_dec->qmf_buf_imag[2 + i][j]);
94
21.5M
      }
95
1.34M
    }
96
97
357k
    for (i = 0; i < 16; i++) {
98
5.71M
      for (j = 0; j < 16; j++) {
99
5.37M
        ptr_sbr_dec->pvc_qmf_enrg_arr[32 * i + j] =
100
5.37M
            (ptr_sbr_dec->qmf_energy_buf[4 * i + 0][j] +
101
5.37M
             ptr_sbr_dec->qmf_energy_buf[4 * i + 1][j] +
102
5.37M
             ptr_sbr_dec->qmf_energy_buf[4 * i + 2][j] +
103
5.37M
             ptr_sbr_dec->qmf_energy_buf[4 * i + 3][j]) *
104
5.37M
            0.25f;
105
5.37M
      }
106
336k
    }
107
113k
  } else {
108
3.74M
    for (i = 0; i < ptr_sbr_dec->str_codec_qmf_bank.num_time_slots; i++) {
109
119M
      for (j = 0; j < 32; j++) {
110
116M
        ptr_sbr_dec->qmf_energy_buf[i][j] =
111
116M
            ptr_sbr_dec->qmf_buf_real[2 + i][j] *
112
116M
            ptr_sbr_dec->qmf_buf_real[2 + i][j];
113
116M
        if (!low_pow_flag)
114
116M
          ptr_sbr_dec->qmf_energy_buf[i][j] +=
115
116M
              (ptr_sbr_dec->qmf_buf_imag[2 + i][j] *
116
116M
               ptr_sbr_dec->qmf_buf_imag[2 + i][j]);
117
116M
      }
118
3.63M
    }
119
120
1.92M
    for (i = 0; i < 16; i++) {
121
59.8M
      for (j = 0; j < 32; j++) {
122
58.0M
        ptr_sbr_dec->pvc_qmf_enrg_arr[32 * i + j] =
123
58.0M
            (ptr_sbr_dec->qmf_energy_buf[2 * i + 0][j] +
124
58.0M
             ptr_sbr_dec->qmf_energy_buf[2 * i + 1][j]) *
125
58.0M
            0.5f;
126
58.0M
      }
127
1.81M
    }
128
113k
  }
129
134k
}
130
131
VOID ixheaacd_hbe_repl_spec(WORD32 x_over_qmf[MAX_NUM_PATCHES],
132
                            FLOAT32 qmf_buf_real[][64],
133
                            FLOAT32 qmf_buf_imag[][64], WORD32 no_bins,
134
39.2k
                            WORD32 max_stretch) {
135
39.2k
  WORD32 patch_bands;
136
39.2k
  WORD32 patch, band, col, target, source_bands, i;
137
39.2k
  WORD32 num_patches = 0;
138
139
235k
  for (i = 1; i < MAX_NUM_PATCHES; i++) {
140
196k
    if (x_over_qmf[i] != 0) {
141
92.2k
      num_patches++;
142
92.2k
    }
143
196k
  }
144
145
44.3k
  for (patch = (max_stretch - 1); patch < num_patches; patch++) {
146
5.10k
    patch_bands = x_over_qmf[patch + 1] - x_over_qmf[patch];
147
5.10k
    target = x_over_qmf[patch];
148
5.10k
    source_bands = x_over_qmf[max_stretch - 1] - x_over_qmf[max_stretch - 2];
149
11.7k
    while (patch_bands > 0) {
150
6.66k
      WORD32 ixheaacd_num_bands = source_bands;
151
6.66k
      WORD32 start_band = x_over_qmf[max_stretch - 1] - 1;
152
6.66k
      if (target + ixheaacd_num_bands >= x_over_qmf[patch + 1]) {
153
5.32k
        ixheaacd_num_bands = x_over_qmf[patch + 1] - target;
154
5.32k
      }
155
6.66k
      if ((((target + ixheaacd_num_bands - 1) & 1) +
156
6.66k
           ((x_over_qmf[max_stretch - 1] - 1) & 1)) &
157
6.66k
          1) {
158
2.29k
        if (ixheaacd_num_bands == source_bands) {
159
729
          ixheaacd_num_bands--;
160
1.56k
        } else {
161
1.56k
          start_band--;
162
1.56k
        }
163
2.29k
      }
164
6.66k
      if (!ixheaacd_num_bands) break;
165
433k
      for (col = 0; col < no_bins; col++) {
166
426k
        WORD32 i = 0;
167
426k
        band = target + ixheaacd_num_bands - 1;
168
426k
        if (64 <= band) {
169
0
          band = 63;
170
0
        }
171
426k
        if (x_over_qmf[patch + 1] <= band) {
172
0
          band = x_over_qmf[patch + 1] - 1;
173
0
        }
174
2.79M
        for (i = 0; i < ixheaacd_num_bands; i++, band--) {
175
2.36M
          qmf_buf_real[col][band] = qmf_buf_real[col][start_band - i];
176
2.36M
          qmf_buf_imag[col][band] = qmf_buf_imag[col][start_band - i];
177
2.36M
        }
178
426k
      }
179
6.66k
      target += ixheaacd_num_bands;
180
6.66k
      patch_bands -= ixheaacd_num_bands;
181
6.66k
    }
182
5.10k
  }
183
39.2k
}
184
185
VOID ixheaacd_esbr_analysis_filt_block(ia_sbr_dec_struct *ptr_sbr_dec,
186
                                       ia_sbr_tables_struct *sbr_tables_ptr,
187
370k
                                       WORD32 op_delay) {
188
370k
  FLOAT32 *core_coder_samples;
189
370k
  WORD32 *ptr_filt_states;
190
370k
  WORD32 *ptr_filt_states_1;
191
370k
  WORD32 *ptr_filt_states_2;
192
370k
  WORD32 *ptr_temp;
193
370k
  WORD32 *ptr_win_coeffs_1;
194
370k
  WORD32 *ptr_win_coeffs_2;
195
370k
  WORD32 *ptr_win_coeffs;
196
370k
  WORD32 *ploc_qmf_buf_real;
197
370k
  WORD32 *ploc_qmf_buf_imag;
198
370k
  WORD32 local_qmf_buffer[128] = {0};
199
370k
  WORD32 anal_buf[2 * 32];
200
370k
  WORD32 idx, z;
201
370k
  WORD32 core_syn_ch_index;
202
370k
  FLOAT32 gain;
203
370k
  WORD32 filt_offset;
204
370k
  WORD32 num_columns;
205
370k
  ia_qmf_dec_tables_struct *qmf_dec_tables_ptr =
206
370k
      sbr_tables_ptr->qmf_dec_tables_ptr;
207
370k
  ia_sbr_qmf_filter_bank_struct *pstr_qmf_anal_bank =
208
370k
      &ptr_sbr_dec->str_codec_qmf_bank;
209
370k
  core_coder_samples = ptr_sbr_dec->time_sample_buf;
210
370k
  ptr_filt_states = pstr_qmf_anal_bank->state_new_samples_pos_low_32;
211
370k
  ptr_win_coeffs_1 = pstr_qmf_anal_bank->filter_pos_32;
212
370k
  num_columns = pstr_qmf_anal_bank->no_channels;
213
214
370k
  switch (num_columns) {
215
35.7k
    case 16:
216
35.7k
      ptr_win_coeffs_2 = ptr_win_coeffs_1 + 64;
217
35.7k
      gain = 128.0f;
218
35.7k
      filt_offset = 64;
219
35.7k
      break;
220
34.2k
    case 24:
221
34.2k
      ptr_win_coeffs_2 = ptr_win_coeffs_1 + 24;
222
34.2k
      gain = 12.0f;
223
34.2k
      filt_offset = 24;
224
34.2k
      break;
225
300k
    case 32:
226
300k
      ptr_win_coeffs_2 = ptr_win_coeffs_1 + 64;
227
300k
      gain = 256.0f;
228
300k
      filt_offset = 64;
229
300k
      break;
230
0
    default:
231
0
      ptr_win_coeffs_2 = ptr_win_coeffs_1 + 64;
232
0
      gain = 256.0f;
233
0
      filt_offset = 64;
234
0
      break;
235
370k
  }
236
370k
  gain = 1.0f / gain;
237
238
370k
  pstr_qmf_anal_bank->usb = num_columns;
239
240
370k
  ploc_qmf_buf_real = &local_qmf_buffer[0];
241
370k
  ploc_qmf_buf_imag = &local_qmf_buffer[64];
242
243
370k
  ptr_filt_states_1 = pstr_qmf_anal_bank->anal_filter_states_32;
244
370k
  ptr_filt_states_2 = pstr_qmf_anal_bank->anal_filter_states_32 + num_columns;
245
246
13.3M
  for (idx = 0; idx < ptr_sbr_dec->str_codec_qmf_bank.num_time_slots; idx++) {
247
383M
    for (z = 0; z < num_columns; z++) {
248
370M
      ptr_filt_states[num_columns - 1 - z] =
249
370M
          (WORD32)(core_coder_samples[z] * (1 << 15));
250
370M
    }
251
13.0M
    ixheaacd_esbr_qmfanal32_winadd(ptr_filt_states_1, ptr_filt_states_2,
252
13.0M
                                   ptr_win_coeffs_1, ptr_win_coeffs_2, anal_buf,
253
13.0M
                                   num_columns);
254
255
13.0M
    core_coder_samples += num_columns;
256
257
13.0M
    ptr_filt_states -= num_columns;
258
13.0M
    if (ptr_filt_states < pstr_qmf_anal_bank->anal_filter_states_32) {
259
1.30M
      ptr_filt_states = pstr_qmf_anal_bank->anal_filter_states_32 +
260
1.30M
                        10 * num_columns - num_columns;
261
1.30M
    }
262
263
13.0M
    ptr_temp = ptr_filt_states_1;
264
13.0M
    ptr_filt_states_1 = ptr_filt_states_2;
265
13.0M
    ptr_filt_states_2 = ptr_temp;
266
267
13.0M
    ptr_win_coeffs_1 += filt_offset;
268
13.0M
    ptr_win_coeffs_2 += filt_offset;
269
270
13.0M
    ptr_win_coeffs = ptr_win_coeffs_1;
271
13.0M
    ptr_win_coeffs_1 = ptr_win_coeffs_2;
272
13.0M
    ptr_win_coeffs_2 = ptr_win_coeffs;
273
274
13.0M
    if (ptr_win_coeffs_2 >
275
13.0M
        (pstr_qmf_anal_bank->analy_win_coeff_32 + filt_offset * 10)) {
276
1.29M
      ptr_win_coeffs_1 = pstr_qmf_anal_bank->analy_win_coeff_32;
277
1.29M
      ptr_win_coeffs_2 = pstr_qmf_anal_bank->analy_win_coeff_32 + filt_offset;
278
1.29M
    }
279
280
13.0M
    ixheaacd_esbr_fwd_modulation(anal_buf, &ploc_qmf_buf_real[0],
281
13.0M
                                 &ploc_qmf_buf_imag[0], pstr_qmf_anal_bank,
282
13.0M
                                 qmf_dec_tables_ptr);
283
13.0M
    core_syn_ch_index = num_columns;
284
285
383M
    for (z = 0; z < core_syn_ch_index; z++) {
286
370M
      ptr_sbr_dec->qmf_buf_real[op_delay + idx][z] =
287
370M
          ((FLOAT32)ploc_qmf_buf_real[z] * gain);
288
370M
      ptr_sbr_dec->qmf_buf_imag[op_delay + idx][z] =
289
370M
          ((FLOAT32)ploc_qmf_buf_imag[z] * gain);
290
370M
    }
291
13.0M
  }
292
293
370k
  pstr_qmf_anal_bank->filter_pos_32 = ptr_win_coeffs_1;
294
370k
  pstr_qmf_anal_bank->state_new_samples_pos_low_32 = ptr_filt_states;
295
370k
}
296
297
VOID ixheaacd_esbr_synthesis_regrp(
298
    FLOAT32 *qmf_buf_real, FLOAT32 *qmf_buf_imag,
299
    ia_sbr_dec_struct *ptr_sbr_dec,
300
    ia_sbr_frame_info_data_struct *ptr_frame_data,
301
    ia_sbr_header_data_struct *ptr_header_data, WORD32 stereo_config_idx,
302
277k
    WORD32 apply_processing) {
303
277k
  WORD32 i, k;
304
277k
  WORD32 stop_border = 0;
305
277k
  WORD32 num_anal_bands = ptr_sbr_dec->str_codec_qmf_bank.no_channels;
306
277k
  WORD32 x_over_band = num_anal_bands;
307
308
277k
  if (apply_processing) {
309
222k
    if (ptr_header_data->sbr_ratio_idx == SBR_UPSAMPLE_IDX_4_1) {
310
12.4k
      stop_border = 4 * ptr_frame_data->str_frame_info_details.border_vec[0];
311
210k
    } else {
312
210k
      stop_border = 2 * ptr_frame_data->str_frame_info_details.border_vec[0];
313
210k
    }
314
222k
    x_over_band = ptr_header_data->pstr_freq_band_data->qmf_sb_prev;
315
222k
  }
316
317
277k
  if (stereo_config_idx > 0) {
318
112k
    for (i = 0; i < stop_border; i++) {
319
91.8k
      for (k = 0; k < 3; k++) {
320
68.8k
        *qmf_buf_real++ =
321
68.8k
            ptr_sbr_dec->qmf_buf_real[(2) + i + HYBRID_FILTER_DELAY][k];
322
68.8k
        *qmf_buf_imag++ =
323
68.8k
            ptr_sbr_dec->qmf_buf_imag[(2) + i + HYBRID_FILTER_DELAY][k];
324
68.8k
      }
325
326
347k
      for (; k < x_over_band; k++) {
327
324k
        *qmf_buf_real++ = ptr_sbr_dec->qmf_buf_real[(2) + i][k];
328
324k
        *qmf_buf_imag++ = ptr_sbr_dec->qmf_buf_imag[(2) + i][k];
329
324k
      }
330
331
1.09M
      for (; k < 64; k++) {
332
1.07M
        *qmf_buf_real++ = ptr_sbr_dec->sbr_qmf_out_real[(2) + i][k];
333
1.07M
        *qmf_buf_imag++ = ptr_sbr_dec->sbr_qmf_out_imag[(2) + i][k];
334
1.07M
      }
335
336
22.9k
      qmf_buf_real += 14;
337
22.9k
      qmf_buf_imag += 14;
338
22.9k
    }
339
340
89.0k
    x_over_band = ptr_header_data->pstr_freq_band_data->sub_band_start;
341
342
3.60M
    for (; i < ptr_sbr_dec->str_codec_qmf_bank.num_time_slots; i++) {
343
14.0M
      for (k = 0; k < 3; k++) {
344
10.5M
        *qmf_buf_real++ =
345
10.5M
            ptr_sbr_dec->qmf_buf_real[(2) + i + HYBRID_FILTER_DELAY][k];
346
10.5M
        *qmf_buf_imag++ =
347
10.5M
            ptr_sbr_dec->qmf_buf_imag[(2) + i + HYBRID_FILTER_DELAY][k];
348
10.5M
      }
349
350
114M
      for (; k < x_over_band; k++) {
351
110M
        *qmf_buf_real++ = ptr_sbr_dec->qmf_buf_real[(2) + i][k];
352
110M
        *qmf_buf_imag++ = ptr_sbr_dec->qmf_buf_imag[(2) + i][k];
353
110M
      }
354
355
107M
      for (; k < 64; k++) {
356
103M
        *qmf_buf_real++ = ptr_sbr_dec->sbr_qmf_out_real[(2) + i][k];
357
103M
        *qmf_buf_imag++ = ptr_sbr_dec->sbr_qmf_out_imag[(2) + i][k];
358
103M
      }
359
360
3.51M
      qmf_buf_real += 14;
361
3.51M
      qmf_buf_imag += 14;
362
3.51M
    }
363
364
187k
  } else {
365
281k
    for (i = 0; i < stop_border; i++) {
366
1.58M
      for (k = 0; k < x_over_band; k++) {
367
1.48M
        *qmf_buf_real++ = ptr_sbr_dec->qmf_buf_real[(2) + i][k];
368
1.48M
        *qmf_buf_imag++ = ptr_sbr_dec->qmf_buf_imag[(2) + i][k];
369
1.48M
      }
370
371
4.56M
      for (; k < 64; k++) {
372
4.47M
        *qmf_buf_real++ = ptr_sbr_dec->sbr_qmf_out_real[(2) + i][k];
373
4.47M
        *qmf_buf_imag++ = ptr_sbr_dec->sbr_qmf_out_imag[(2) + i][k];
374
4.47M
      }
375
376
93.1k
      qmf_buf_real += 14;
377
93.1k
      qmf_buf_imag += 14;
378
93.1k
    }
379
380
187k
    x_over_band = ptr_header_data->pstr_freq_band_data->sub_band_start;
381
382
6.16M
    for (; i < ptr_sbr_dec->str_codec_qmf_bank.num_time_slots; i++) {
383
86.7M
      for (k = 0; k < x_over_band; k++) {
384
80.7M
        *qmf_buf_real++ = ptr_sbr_dec->qmf_buf_real[(2) + i][k];
385
80.7M
        *qmf_buf_imag++ = ptr_sbr_dec->qmf_buf_imag[(2) + i][k];
386
80.7M
      }
387
388
307M
      for (; k < 64; k++) {
389
301M
        *qmf_buf_real++ = ptr_sbr_dec->sbr_qmf_out_real[(2) + i][k];
390
301M
        *qmf_buf_imag++ = ptr_sbr_dec->sbr_qmf_out_imag[(2) + i][k];
391
301M
      }
392
393
5.97M
      qmf_buf_real += 14;
394
5.97M
      qmf_buf_imag += 14;
395
5.97M
    }
396
187k
  }
397
277k
}
398
399
VOID ixheaacd_mps_esbr_synthesis_regrp(FLOAT32 *qmf_buf_real,
400
                                       FLOAT32 *qmf_buf_imag,
401
                                       ia_sbr_dec_struct *ptr_sbr_dec,
402
93.5k
                                       WORD32 stereo_config_idx) {
403
93.5k
  WORD32 i, k;
404
93.5k
  WORD32 num_anal_bands = ptr_sbr_dec->str_codec_qmf_bank.no_channels;
405
93.5k
  WORD32 x_over_band = num_anal_bands;
406
407
93.5k
  if (stereo_config_idx > 0) {
408
3.48M
    for (i = 0; i < ptr_sbr_dec->str_codec_qmf_bank.num_time_slots; i++) {
409
13.5M
      for (k = 0; k < 3; k++) {
410
10.1M
        *qmf_buf_real++ =
411
10.1M
            ptr_sbr_dec->qmf_buf_real[(2) + i + HYBRID_FILTER_DELAY][k];
412
10.1M
        *qmf_buf_imag++ =
413
10.1M
            ptr_sbr_dec->qmf_buf_imag[(2) + i + HYBRID_FILTER_DELAY][k];
414
10.1M
      }
415
416
88.1M
      for (; k < x_over_band; k++) {
417
84.7M
        *qmf_buf_real++ = ptr_sbr_dec->qmf_buf_real[(2) + i][k];
418
84.7M
        *qmf_buf_imag++ = ptr_sbr_dec->qmf_buf_imag[(2) + i][k];
419
84.7M
      }
420
421
125M
      for (; k < 64; k++) {
422
122M
        *qmf_buf_real++ = 0;
423
122M
        *qmf_buf_imag++ = 0;
424
122M
      }
425
426
3.39M
      qmf_buf_real += 14;
427
3.39M
      qmf_buf_imag += 14;
428
3.39M
    }
429
93.5k
  } else {
430
0
    for (i = 0; i < ptr_sbr_dec->str_codec_qmf_bank.num_time_slots; i++) {
431
0
      for (k = 0; k < x_over_band; k++) {
432
0
        *qmf_buf_real++ = ptr_sbr_dec->qmf_buf_real[(2) + i][k];
433
0
        *qmf_buf_imag++ = ptr_sbr_dec->qmf_buf_imag[(2) + i][k];
434
0
      }
435
436
0
      for (; k < 64; k++) {
437
0
        *qmf_buf_real++ = 0.0f;
438
0
        *qmf_buf_imag++ = 0.0f;
439
0
      }
440
441
0
      qmf_buf_real += 14;
442
0
      qmf_buf_imag += 14;
443
0
    }
444
0
  }
445
93.5k
}
446
447
VOID ixheaacd_esbr_synthesis_filt_block(
448
    ia_sbr_dec_struct *ptr_sbr_dec, ia_sbr_header_data_struct *ptr_header_data,
449
    ia_sbr_frame_info_data_struct *ptr_frame_data, WORD32 apply_processing,
450
    FLOAT32 **qmf_buf_real, FLOAT32 **qmf_buf_imag, WORD32 stereo_config_idx,
451
    ia_sbr_tables_struct *sbr_tables_ptr, WORD32 mps_sbr_flag, WORD32 ch_fac,
452
    WORD32 ps_enable, WORD32 skip_re_grouping, ia_ps_dec_struct *ptr_ps_dec,
453
386k
    FLAG drc_on, WORD32 drc_sbr_factors[][64]) {
454
455
386k
    WORD32 i, k;
456
386k
    WORD32 *ptr_filt_states;
457
386k
    WORD32 *ptr_filt_states_1;
458
386k
    WORD32 *ptr_filt_states_2;
459
386k
    WORD32 *filter_l;
460
386k
    WORD32 *ploc_qmf_buf_real;
461
386k
    WORD32 *ploc_qmf_buf_imag;
462
386k
    WORD32 out_scalefactor;
463
386k
    WORD32 sixty4, thrity2;
464
386k
    WORD32 no_synthesis_channels;
465
386k
    WORD32 ixheaacd_drc_offset;
466
386k
    FLOAT32 *syn_buffer;
467
386k
    WORD32 *local_qmf_buffer = ptr_sbr_dec->sbr_scratch_local;
468
386k
    WORD32 *time_out = &(ptr_sbr_dec->sbr_scratch_local[128]);
469
386k
  FLOAT32 *time_sample_buf;
470
386k
  if (ps_enable) {
471
32.5k
    time_sample_buf = ptr_ps_dec->time_sample_buf[0];
472
354k
  } else {
473
354k
    time_sample_buf = ptr_sbr_dec->time_sample_buf;
474
354k
  }
475
386k
    ia_sbr_qmf_filter_bank_struct *qmf_bank =
476
386k
        &ptr_sbr_dec->str_synthesis_qmf_bank;
477
386k
    ia_qmf_dec_tables_struct *qmf_dec_tables_ptr =
478
386k
        sbr_tables_ptr->qmf_dec_tables_ptr;
479
480
386k
  if (!skip_re_grouping) {
481
370k
    if (!mps_sbr_flag) {
482
277k
      ixheaacd_esbr_synthesis_regrp(&qmf_buf_real[0][0], &qmf_buf_imag[0][0],
483
277k
                                    ptr_sbr_dec, ptr_frame_data, ptr_header_data,
484
277k
                                    stereo_config_idx, apply_processing);
485
277k
      if (ps_enable) {
486
16.2k
        FLOAT32 factor = 1.0f;
487
113k
        for (i = ptr_ps_dec->num_sub_samples;i < (WORD32)ptr_ps_dec->num_sub_samples + 6;i++) {
488
585k
          for (k = 0; k < 5; k++)
489
488k
          {
490
488k
            if (drc_on)
491
488k
            {
492
488k
              if (ptr_sbr_dec->str_codec_qmf_bank.num_time_slots == 30)
493
0
              {
494
0
                factor = (FLOAT32)drc_sbr_factors[i + 30 - 25][k] / Q25;
495
0
              }
496
488k
              else
497
488k
              {
498
488k
                factor = (FLOAT32)drc_sbr_factors[i + 32 - 26][k] / Q25;
499
488k
              }
500
488k
            }
501
488k
            ptr_ps_dec->pp_qmf_buf_real[0][i][k] =
502
488k
              factor * ptr_sbr_dec->qmf_buf_real[SBR_HF_ADJ_OFFSET + i][k];
503
488k
            ptr_ps_dec->pp_qmf_buf_imag[0][i][k] =
504
488k
              factor * ptr_sbr_dec->qmf_buf_imag[SBR_HF_ADJ_OFFSET + i][k];
505
488k
          }
506
97.6k
        }
507
16.2k
      }
508
277k
      if (ps_enable && apply_processing) {
509
15.0k
        WORD32 usb = ptr_header_data->pstr_freq_band_data->sub_band_end;
510
511
15.0k
        ixheaacd_esbr_apply_ps(ptr_ps_dec,
512
15.0k
                               ptr_ps_dec->pp_qmf_buf_real[0],
513
15.0k
                               ptr_ps_dec->pp_qmf_buf_imag[0],
514
15.0k
                               ptr_ps_dec->pp_qmf_buf_real[1],
515
15.0k
                               ptr_ps_dec->pp_qmf_buf_imag[1],
516
15.0k
                               usb, sbr_tables_ptr->ps_tables_ptr,
517
15.0k
                               ptr_header_data->num_time_slots);
518
261k
      } else if (ps_enable) {
519
39.8k
        for (i = 0; i < (ptr_header_data->num_time_slots * 2); i++) {
520
2.51M
          for (k = 0; k < 64; k++) {
521
2.47M
            ptr_ps_dec->pp_qmf_buf_real[1][i][k] = ptr_ps_dec->pp_qmf_buf_real[0][i][k];
522
2.47M
            ptr_ps_dec->pp_qmf_buf_imag[1][i][k] = ptr_ps_dec->pp_qmf_buf_imag[0][i][k];
523
2.47M
          }
524
38.6k
        }
525
1.20k
      }
526
277k
    } else {
527
93.5k
      ixheaacd_mps_esbr_synthesis_regrp(&qmf_buf_real[0][0], &qmf_buf_imag[0][0],
528
93.5k
                                        ptr_sbr_dec, stereo_config_idx);
529
93.5k
    }
530
370k
  } else {
531
16.2k
    if (ps_enable) {
532
16.2k
      time_sample_buf = ptr_ps_dec->time_sample_buf[1];
533
16.2k
    }
534
16.2k
  }
535
536
386k
  if (drc_on)
537
39.2k
  {
538
39.2k
    FLOAT32 factor = 1.0f;
539
1.29M
    for (i = 0; i < ptr_sbr_dec->str_codec_qmf_bank.num_time_slots; i++)
540
1.25M
    {
541
81.5M
      for (k = 0; k < 64; k++)
542
80.3M
      {
543
80.3M
        if (ptr_sbr_dec->str_codec_qmf_bank.num_time_slots == 30)
544
40.3k
        {
545
40.3k
          factor = (FLOAT32)drc_sbr_factors[i + 30 - 25][k] / Q25;
546
40.3k
        }
547
80.2M
        else
548
80.2M
        {
549
80.2M
          factor = (FLOAT32)drc_sbr_factors[i + 32 - 26][k] / Q25;
550
80.2M
        }
551
80.3M
        qmf_buf_real[i][k] *= factor;
552
80.3M
        qmf_buf_imag[i][k] *= factor;
553
80.3M
      }
554
1.25M
    }
555
39.2k
  }
556
557
386k
  if (stereo_config_idx <= 0) {
558
204k
    out_scalefactor = 5;
559
204k
    no_synthesis_channels = qmf_bank->no_channels;
560
204k
    sixty4 = NO_SYNTHESIS_CHANNELS;
561
204k
    thrity2 = qmf_bank->no_channels;
562
563
204k
    if (no_synthesis_channels == NO_SYNTHESIS_CHANNELS_DOWN_SAMPLED)
564
368
    {
565
368
        qmf_bank->esbr_cos_twiddle =
566
368
          (WORD32 *)qmf_dec_tables_ptr->esbr_sin_cos_twiddle_l32;
567
368
        qmf_bank->esbr_alt_sin_twiddle =
568
368
          (WORD32 *)qmf_dec_tables_ptr->esbr_alt_sin_twiddle_l32;
569
368
    }
570
203k
    else
571
203k
    {
572
203k
      qmf_bank->esbr_cos_twiddle =
573
203k
        (WORD32 *)qmf_dec_tables_ptr->esbr_sin_cos_twiddle_l64;
574
203k
      qmf_bank->esbr_alt_sin_twiddle =
575
203k
        (WORD32 *)qmf_dec_tables_ptr->esbr_alt_sin_twiddle_l64;
576
203k
    }
577
578
204k
    qmf_bank->filter_pos_syn_32 +=
579
204k
        qmf_dec_tables_ptr->esbr_qmf_c - qmf_bank->p_filter_32;
580
204k
    qmf_bank->p_filter_32 = qmf_dec_tables_ptr->esbr_qmf_c;
581
582
204k
    ptr_filt_states = qmf_bank->filter_states_32;
583
584
204k
    ptr_filt_states_1 = &ptr_filt_states[0];
585
204k
    ptr_filt_states_2 = ptr_filt_states_1 + no_synthesis_channels;
586
587
204k
    filter_l = qmf_bank->filter_pos_syn_32;
588
589
204k
    ixheaacd_drc_offset = qmf_bank->ixheaacd_drc_offset;
590
591
6.79M
    for (i = 0; i < ptr_sbr_dec->str_codec_qmf_bank.num_time_slots; i++) {
592
428M
      for (k = 0; k < 64; k++) {
593
421M
        local_qmf_buffer[k + 0] = (WORD32)(qmf_buf_real[i][k] * 64);
594
421M
        local_qmf_buffer[k + 64] = (WORD32)(qmf_buf_imag[i][k] * 64);
595
421M
      }
596
6.58M
      ploc_qmf_buf_real = local_qmf_buffer;
597
6.58M
      ploc_qmf_buf_imag = local_qmf_buffer + 64;
598
599
6.58M
      ixheaacd_esbr_inv_modulation(ploc_qmf_buf_real,
600
6.58M
                                   &ptr_sbr_dec->str_synthesis_qmf_bank,
601
6.58M
                                   sbr_tables_ptr->qmf_dec_tables_ptr,
602
6.58M
                                   no_synthesis_channels);
603
604
6.58M
      ixheaacd_shiftrountine_with_rnd_hq(ploc_qmf_buf_real, ploc_qmf_buf_imag,
605
6.58M
                                         &ptr_filt_states[ixheaacd_drc_offset],
606
6.58M
                                         no_synthesis_channels,
607
6.58M
                                         out_scalefactor + 1);
608
609
6.58M
      if (no_synthesis_channels == NO_SYNTHESIS_CHANNELS_DOWN_SAMPLED) {
610
11.7k
        ixheaacd_esbr_qmfsyn32_winadd(ptr_filt_states_1, ptr_filt_states_2,
611
11.7k
                                      filter_l, &time_out[0], ch_fac);
612
613
11.7k
        if (!mps_sbr_flag) {
614
11.7k
          syn_buffer = time_sample_buf + i * 32;
615
11.7k
        } else {
616
0
          syn_buffer = ptr_sbr_dec->time_sample_buf + i * 32;
617
0
        }
618
388k
        for (k = 0; k < 32; k++) {
619
376k
          syn_buffer[k] = (FLOAT32)time_out[k] / (1 << 16);
620
376k
        }
621
622
11.7k
        ptr_filt_states_1 += thrity2;
623
11.7k
        ptr_filt_states_2 -= thrity2;
624
11.7k
        thrity2 = -thrity2;
625
11.7k
        ixheaacd_drc_offset -= 64;
626
627
11.7k
        if (ixheaacd_drc_offset < 0) ixheaacd_drc_offset += 640;
628
6.57M
      } else {
629
6.57M
        ixheaacd_esbr_qmfsyn64_winadd(ptr_filt_states_1, ptr_filt_states_2,
630
6.57M
                                      filter_l, &time_out[0], ch_fac);
631
632
6.57M
        if (!mps_sbr_flag) {
633
6.57M
          syn_buffer = time_sample_buf + i * 64;
634
6.57M
        } else {
635
0
          syn_buffer = ptr_sbr_dec->time_sample_buf + i * 64;
636
0
        }
637
427M
        for (k = 0; k < 64; k++) {
638
420M
          syn_buffer[k] = (FLOAT32)time_out[k] / (1 << 16);
639
420M
        }
640
641
6.57M
        ptr_filt_states_1 += sixty4;
642
6.57M
        ptr_filt_states_2 -= sixty4;
643
6.57M
        sixty4 = -sixty4;
644
6.57M
        ixheaacd_drc_offset -= 128;
645
646
6.57M
        if (ixheaacd_drc_offset < 0) ixheaacd_drc_offset += 1280;
647
6.57M
      }
648
649
6.58M
      filter_l += 64;
650
651
6.58M
      if (filter_l == qmf_bank->p_filter_32 + 640)
652
657k
        filter_l = (WORD32 *)qmf_bank->p_filter_32;
653
6.58M
    }
654
655
204k
    qmf_bank->filter_pos_syn_32 = filter_l;
656
204k
    qmf_bank->ixheaacd_drc_offset = ixheaacd_drc_offset;
657
204k
  }
658
659
386k
  if (!mps_sbr_flag) ptr_frame_data->reset_flag = 0;
660
386k
}
661
662
WORD32 ixheaacd_sbr_dec(
663
    ia_sbr_dec_struct *ptr_sbr_dec, WORD16 *ptr_time_data,
664
    ia_sbr_header_data_struct *ptr_header_data, ia_sbr_frame_info_data_struct *ptr_frame_data,
665
    ia_sbr_prev_frame_data_struct *ptr_frame_data_prev, ia_ps_dec_struct *ptr_ps_dec,
666
    ia_sbr_qmf_filter_bank_struct *ptr_qmf_synth_bank_r, ia_sbr_scale_fact_struct *ptr_sbr_sf_r,
667
    FLAG apply_processing, FLAG low_pow_flag, WORD32 *ptr_work_buf_core,
668
    ia_sbr_tables_struct *sbr_tables_ptr, ixheaacd_misc_tables *pstr_common_tables, WORD ch_fac,
669
    ia_pvc_data_struct *ptr_pvc_data, FLAG drc_on, WORD32 drc_sbr_factors[][64],
670
    WORD32 audio_object_type, WORD32 ldmps_present, VOID *self, WORD32 heaac_mps_present,
671
399k
    WORD32 ec_flag) {
672
399k
  WORD i, j, k;
673
399k
  WORD slot, reserve;
674
399k
  WORD save_lb_scale;
675
399k
  WORD op_delay;
676
399k
  IA_ERRORCODE err_code = IA_NO_ERROR;
677
678
399k
  WORD32 *p_arr_qmf_buf_real[MAX_ENV_COLS] = {0};
679
399k
  WORD32 *p_arr_qmf_buf_imag[MAX_ENV_COLS] = {0};
680
399k
  WORD32 *ptr;
681
399k
  WORD hbe_flag = ptr_header_data->hbe_flag;
682
683
399k
  FLOAT32 **pp_qmf_buf_real = NULL;
684
399k
  FLOAT32 **pp_qmf_buf_imag = NULL;
685
399k
  FLOAT32 pvc_dec_out_buf[16 * 64];
686
687
399k
  WORD upsample_ratio_idx = ptr_header_data->sbr_ratio_idx;
688
399k
  WORD no_bins;
689
399k
  WORD mps_sbr_flag = ptr_frame_data->mps_sbr_flag;
690
399k
  WORD stereo_config_idx = ptr_frame_data->stereo_config_idx;
691
399k
  WORD sbr_mode = ptr_frame_data->sbr_mode;
692
399k
  WORD usac_flag = ptr_header_data->usac_flag;
693
399k
  WORD add_slot = 0;
694
695
399k
  FLOAT32 *pvc_qmf_enrg_arr = (FLOAT32 *)ptr_sbr_dec->pvc_qmf_enrg_arr;
696
697
399k
  WORD32 dft_hbe_flag = ptr_header_data->esbr_hq;
698
399k
  WORD32 esbr_hbe_delay_offsets;
699
399k
  if (ptr_header_data->num_time_slots == 15)
700
23.8k
    esbr_hbe_delay_offsets = ESBR_HBE_DELAY_OFFSET_960;
701
375k
  else
702
375k
    esbr_hbe_delay_offsets = ESBR_HBE_DELAY_OFFSET;
703
704
399k
  memset(pvc_dec_out_buf, 0, 1024 * sizeof(FLOAT32));
705
399k
  memset(pvc_qmf_enrg_arr, 0, 512 * sizeof(FLOAT32));
706
399k
  if (audio_object_type == AOT_ER_AAC_ELD) {
707
60.2k
    op_delay = 0;
708
339k
  } else {
709
339k
    op_delay = 6;
710
339k
  }
711
712
399k
  if (ldmps_present == 1) add_slot = SBR_HF_ADJ_OFFSET;
713
714
399k
  if (!((audio_object_type == AOT_ER_AAC_ELD) || (audio_object_type == AOT_ER_AAC_LD))
715
399k
      && ptr_header_data->enh_sbr) {
716
339k
    ch_fac = 1;
717
339k
    pp_qmf_buf_real = ptr_sbr_dec->pp_qmf_buf_real;
718
339k
    pp_qmf_buf_imag = ptr_sbr_dec->pp_qmf_buf_imag;
719
339k
    if (upsample_ratio_idx == SBR_UPSAMPLE_IDX_4_1) {
720
24.9k
      op_delay = 2 * 6;
721
24.9k
    }
722
339k
  }
723
724
399k
  no_bins = (ptr_header_data->num_time_slots * ptr_header_data->time_step);
725
726
399k
  if ((audio_object_type == AOT_ER_AAC_ELD) ||
727
399k
      (audio_object_type == AOT_ER_AAC_LD)  ||
728
399k
      !ptr_header_data->enh_sbr) {
729
60.2k
    WORD32 num = op_delay;
730
60.2k
    WORD32 *ptr_pers_qmf_real = ptr_sbr_dec->ptr_sbr_overlap_buf;
731
60.2k
    WORD32 *p_scr_qmf_real = ptr_work_buf_core + (2 << (6 + !low_pow_flag));
732
733
60.2k
    if (ptr_header_data->num_time_slots != 15) {
734
36.4k
      if ((no_bins < LPC_ORDER) || ((no_bins + op_delay) > MAX_ENV_COLS)) {
735
0
        if (ec_flag)
736
0
          no_bins = LPC_ORDER;
737
0
        else
738
0
          return -1;
739
0
      }
740
36.4k
    } else {
741
23.7k
      if ((no_bins < LPC_ORDER) || ((no_bins + op_delay) > MAX_ENV_COLS_960)) {
742
0
        if (ec_flag)
743
0
          no_bins = LPC_ORDER;
744
0
        else
745
0
          return -1;
746
0
      }
747
23.7k
    }
748
749
60.2k
    if (!low_pow_flag) {
750
60.2k
      num = num << 1;
751
60.2k
    }
752
60.2k
    if (audio_object_type != AOT_ER_AAC_ELD) {
753
0
      memcpy(p_scr_qmf_real, ptr_pers_qmf_real,
754
0
             sizeof(WORD32) * NO_SYNTHESIS_CHANNELS * num);
755
0
    }
756
60.2k
    ptr = p_scr_qmf_real;
757
758
1.01M
    for (slot = 0; slot < op_delay + no_bins + add_slot; slot++) {
759
952k
      p_arr_qmf_buf_real[slot] = ptr;
760
952k
      ptr += NO_SYNTHESIS_CHANNELS;
761
762
952k
      if (!low_pow_flag) {
763
952k
        p_arr_qmf_buf_imag[slot] = ptr;
764
952k
        ptr += NO_SYNTHESIS_CHANNELS;
765
952k
      }
766
952k
    }
767
768
60.2k
    ptr_sbr_dec->str_sbr_scale_fact.lb_scale = 0;
769
770
60.2k
    if (apply_processing) {
771
60.2k
      ixheaacd_rescale_x_overlap(ptr_sbr_dec, ptr_header_data, ptr_frame_data,
772
60.2k
                                 ptr_frame_data_prev, p_arr_qmf_buf_real,
773
60.2k
                                 p_arr_qmf_buf_imag, low_pow_flag);
774
60.2k
    }
775
60.2k
  }
776
777
399k
  if ((audio_object_type == AOT_AAC_LC) && (heaac_mps_present == 1) && ptr_header_data->enh_sbr) {
778
329
    WORD32 num_anal_bands = ptr_sbr_dec->str_codec_qmf_bank.no_channels;
779
329
    WORD32 frame_move = 9 * num_anal_bands;
780
329
    WORD32 core_frame_size = ptr_header_data->core_frame_size;
781
782
329
    memcpy(&ptr_sbr_dec->core_sample_buf[core_frame_size],
783
329
           &ptr_sbr_dec->time_sample_buf[core_frame_size - frame_move],
784
329
           frame_move * sizeof(FLOAT32));
785
786
329
    memmove(&ptr_sbr_dec->time_sample_buf[frame_move], &ptr_sbr_dec->time_sample_buf[0],
787
329
            (core_frame_size - frame_move));
788
789
329
    memcpy(&ptr_sbr_dec->time_sample_buf[0], &ptr_sbr_dec->core_sample_buf[0],
790
329
           frame_move * sizeof(FLOAT32));
791
792
329
    memcpy(&ptr_sbr_dec->core_sample_buf[0], &ptr_sbr_dec->core_sample_buf[core_frame_size],
793
329
           frame_move * sizeof(FLOAT32));
794
329
  }
795
399k
  if ((audio_object_type == AOT_AAC_LC) && (heaac_mps_present == 1) &&
796
399k
    !ptr_header_data->enh_sbr) {
797
0
    WORD32 num_anal_bands = ptr_sbr_dec->str_codec_qmf_bank.no_channels;
798
0
    WORD32 frame_move = 9 * num_anal_bands;
799
0
    WORD32 core_frame_size = ptr_header_data->core_frame_size;
800
801
0
    memcpy(&ptr_sbr_dec->core_sample_buf_sbr[core_frame_size],
802
0
           &ptr_time_data[core_frame_size - frame_move],
803
0
           frame_move * sizeof(WORD16));
804
805
0
    memmove(&ptr_time_data[frame_move], &ptr_time_data[0],
806
0
            (core_frame_size - frame_move));
807
808
0
    memcpy(&ptr_time_data[0], &ptr_sbr_dec->core_sample_buf_sbr[0],
809
0
           frame_move * sizeof(WORD16));
810
811
0
    memcpy(&ptr_sbr_dec->core_sample_buf_sbr[0],
812
0
           &ptr_sbr_dec->core_sample_buf_sbr[core_frame_size],
813
0
           frame_move * sizeof(WORD16));
814
0
  }
815
816
399k
  if ((audio_object_type != AOT_ER_AAC_ELD) &&
817
399k
      (audio_object_type != AOT_ER_AAC_LD) &&
818
399k
      ptr_header_data->enh_sbr) {
819
339k
    WORD32 codec_x_delay = 0;
820
821
339k
    if (hbe_flag || !usac_flag) {
822
230k
      codec_x_delay = esbr_hbe_delay_offsets;
823
230k
    }
824
339k
    if (upsample_ratio_idx == SBR_UPSAMPLE_IDX_4_1) {
825
24.9k
      codec_x_delay = 2 * codec_x_delay;
826
24.9k
    }
827
    /* fixed decoder delay for bitstreams with SBR 4:1 and stereoConfigIndex 3
828
     */
829
339k
    if (ptr_header_data->num_time_slots != 15) {
830
339k
      if (mps_sbr_flag) op_delay = MPS_SBR_DELAY;
831
339k
    } else {
832
40
      if (mps_sbr_flag) op_delay = MPS_SBR_DELAY_960;
833
40
    }
834
835
339k
    {
836
339k
    memmove(
837
339k
        &ptr_sbr_dec->qmf_buf_real[0][0],
838
339k
        &ptr_sbr_dec
839
339k
             ->qmf_buf_real[ptr_sbr_dec->str_codec_qmf_bank.num_time_slots][0],
840
339k
        (op_delay + SBR_HF_ADJ_OFFSET + codec_x_delay) * sizeof(FLOAT32) * 64);
841
842
339k
    memmove(
843
339k
        &ptr_sbr_dec->qmf_buf_imag[0][0],
844
339k
        &ptr_sbr_dec
845
339k
             ->qmf_buf_imag[ptr_sbr_dec->str_codec_qmf_bank.num_time_slots][0],
846
339k
        (op_delay + SBR_HF_ADJ_OFFSET + codec_x_delay) * sizeof(FLOAT32) * 64);
847
848
339k
    memmove(&ptr_sbr_dec->sbr_qmf_out_real[0][0],
849
339k
            &ptr_sbr_dec->sbr_qmf_out_real[ptr_sbr_dec->str_codec_qmf_bank
850
339k
                                               .num_time_slots][0],
851
339k
            (op_delay + SBR_HF_ADJ_OFFSET) * sizeof(FLOAT32) * 64);
852
853
339k
    memmove(&ptr_sbr_dec->sbr_qmf_out_imag[0][0],
854
339k
            &ptr_sbr_dec->sbr_qmf_out_imag[ptr_sbr_dec->str_codec_qmf_bank
855
339k
                                               .num_time_slots][0],
856
339k
            (op_delay + SBR_HF_ADJ_OFFSET) * sizeof(FLOAT32) * 64);
857
858
339k
    if (hbe_flag) {
859
230k
      memmove(&ptr_sbr_dec->ph_vocod_qmf_real[0][0],
860
230k
              &ptr_sbr_dec->ph_vocod_qmf_real[ptr_sbr_dec->str_codec_qmf_bank
861
230k
                                                  .num_time_slots][0],
862
230k
              64 * sizeof(FLOAT32) * (op_delay + SBR_HF_ADJ_OFFSET));
863
864
230k
      memmove(ptr_sbr_dec->ph_vocod_qmf_imag,
865
230k
              ptr_sbr_dec->ph_vocod_qmf_imag +
866
230k
                  ptr_sbr_dec->str_codec_qmf_bank.num_time_slots,
867
230k
              64 * sizeof(FLOAT32) * (op_delay + SBR_HF_ADJ_OFFSET));
868
230k
        if (!usac_flag) {
869
23.5k
          WORD32 qmf_sb_prev = ptr_header_data->pstr_freq_band_data->qmf_sb_prev;
870
165k
          for (i = SBR_HF_ADJ_OFFSET; i < op_delay + SBR_HF_ADJ_OFFSET; ++i) {
871
141k
            memset(&ptr_sbr_dec->qmf_buf_real[i][qmf_sb_prev], 0, (64 - qmf_sb_prev));
872
141k
            memset(&ptr_sbr_dec->qmf_buf_imag[i][qmf_sb_prev], 0, (64 - qmf_sb_prev));
873
141k
          }
874
23.5k
        }
875
230k
      }
876
339k
    }
877
339k
    ixheaacd_esbr_analysis_filt_block(
878
339k
        ptr_sbr_dec, sbr_tables_ptr,
879
339k
        op_delay + codec_x_delay + SBR_HF_ADJ_OFFSET);
880
881
339k
    if (hbe_flag && apply_processing) {
882
208k
      if (dft_hbe_flag == 1) {
883
0
        WORD32 err_code = 0;
884
0
        ptr_sbr_dec->p_hbe_txposer->oversampling_flag =
885
0
            ptr_frame_data->over_sampling_flag;
886
0
        err_code = ixheaacd_dft_hbe_apply(
887
0
          ptr_sbr_dec->p_hbe_txposer,
888
0
          ptr_sbr_dec->qmf_buf_real + (op_delay + SBR_HF_ADJ_OFFSET) +
889
0
          esbr_hbe_delay_offsets,
890
0
          ptr_sbr_dec->qmf_buf_imag + (op_delay + SBR_HF_ADJ_OFFSET) +
891
0
          esbr_hbe_delay_offsets,
892
0
          ptr_sbr_dec->str_codec_qmf_bank.num_time_slots,
893
0
          ptr_sbr_dec->ph_vocod_qmf_real + (op_delay + SBR_HF_ADJ_OFFSET),
894
0
          ptr_sbr_dec->ph_vocod_qmf_imag + (op_delay + SBR_HF_ADJ_OFFSET),
895
0
          ptr_frame_data->pitch_in_bins, (FLOAT32 *)ptr_work_buf_core);
896
0
        if (err_code) return err_code;
897
208k
      } else {
898
208k
          WORD32 err_code = ixheaacd_qmf_hbe_apply(
899
208k
              ptr_sbr_dec->p_hbe_txposer,
900
208k
              ptr_sbr_dec->qmf_buf_real + (op_delay + SBR_HF_ADJ_OFFSET) +
901
208k
              esbr_hbe_delay_offsets,
902
208k
              ptr_sbr_dec->qmf_buf_imag + (op_delay + SBR_HF_ADJ_OFFSET) +
903
208k
              esbr_hbe_delay_offsets,
904
208k
              ptr_sbr_dec->str_codec_qmf_bank.num_time_slots,
905
208k
              ptr_sbr_dec->ph_vocod_qmf_real + (op_delay + SBR_HF_ADJ_OFFSET),
906
208k
              ptr_sbr_dec->ph_vocod_qmf_imag + (op_delay + SBR_HF_ADJ_OFFSET),
907
208k
              ptr_frame_data->pitch_in_bins, ptr_header_data);
908
208k
          if (err_code) return err_code;
909
910
208k
        if (upsample_ratio_idx == SBR_UPSAMPLE_IDX_4_1) {
911
24.7k
          ixheaacd_hbe_repl_spec(
912
24.7k
              &ptr_sbr_dec->p_hbe_txposer->x_over_qmf[0],
913
24.7k
              ptr_sbr_dec->ph_vocod_qmf_real + (op_delay + SBR_HF_ADJ_OFFSET),
914
24.7k
              ptr_sbr_dec->ph_vocod_qmf_imag + (op_delay + SBR_HF_ADJ_OFFSET),
915
24.7k
              ptr_sbr_dec->str_codec_qmf_bank.num_time_slots,
916
24.7k
              ptr_sbr_dec->p_hbe_txposer->max_stretch);
917
24.7k
        }
918
208k
      }
919
208k
    }
920
339k
    if (!mps_sbr_flag && apply_processing) {
921
222k
      err_code = ixheaacd_generate_hf(ptr_sbr_dec->qmf_buf_real + (SBR_HF_ADJ_OFFSET),
922
222k
                                      ptr_sbr_dec->qmf_buf_imag + (SBR_HF_ADJ_OFFSET),
923
222k
                                      ptr_sbr_dec->ph_vocod_qmf_real + (SBR_HF_ADJ_OFFSET),
924
222k
                                      ptr_sbr_dec->ph_vocod_qmf_imag + (SBR_HF_ADJ_OFFSET),
925
222k
                                      ptr_sbr_dec->sbr_qmf_out_real + (SBR_HF_ADJ_OFFSET),
926
222k
                                      ptr_sbr_dec->sbr_qmf_out_imag + (SBR_HF_ADJ_OFFSET),
927
222k
                                      ptr_frame_data, ptr_header_data, ldmps_present,
928
222k
                                      ptr_sbr_dec->str_codec_qmf_bank.num_time_slots, ec_flag);
929
222k
      if (err_code) return err_code;
930
931
222k
      ptr_pvc_data->pvc_rate = ptr_header_data->upsamp_fac;
932
933
222k
      if (sbr_mode == PVC_SBR) {
934
103k
        ixheaacd_qmf_enrg_calc(ptr_sbr_dec, upsample_ratio_idx, low_pow_flag);
935
103k
        if (ec_flag) {
936
0
          ptr_pvc_data->pvc_mode = 1;
937
0
        }
938
103k
        err_code = ixheaacd_pvc_process(
939
103k
            ptr_pvc_data, ptr_header_data->pstr_freq_band_data->sub_band_start,
940
103k
            ptr_frame_data->str_pvc_frame_info.border_vec[0],
941
103k
            &pvc_qmf_enrg_arr[0], &pvc_dec_out_buf[0]);
942
943
103k
        if (err_code) return err_code;
944
945
103k
        ptr_pvc_data->prev_pvc_flg = 1;
946
119k
      } else {
947
119k
        memset(pvc_dec_out_buf, 0, 1024 * sizeof(FLOAT32));
948
119k
        ptr_pvc_data->prev_pvc_flg = 0;
949
119k
      }
950
951
222k
      ptr_pvc_data->prev_first_bnd_idx =
952
222k
          ptr_header_data->pstr_freq_band_data->sub_band_start;
953
222k
      ptr_pvc_data->prev_pvc_rate = ptr_pvc_data->pvc_rate;
954
955
222k
      ptr_frame_data->pstr_sbr_header = ptr_header_data;
956
222k
      err_code = ixheaacd_sbr_env_calc(
957
222k
          ptr_frame_data, ptr_sbr_dec->sbr_qmf_out_real + (SBR_HF_ADJ_OFFSET),
958
222k
          ptr_sbr_dec->sbr_qmf_out_imag + (SBR_HF_ADJ_OFFSET),
959
222k
          ptr_sbr_dec->qmf_buf_real + (SBR_HF_ADJ_OFFSET),
960
222k
          ptr_sbr_dec->qmf_buf_imag + (SBR_HF_ADJ_OFFSET),
961
222k
          (ptr_header_data->hbe_flag == 0) ? NULL : ptr_sbr_dec->p_hbe_txposer->x_over_qmf,
962
222k
          ptr_sbr_dec->scratch_buff, pvc_dec_out_buf, ldmps_present, ec_flag);
963
964
222k
      if (err_code) return err_code;
965
966
222k
    } else {
967
7.60M
      for (i = 0; i < 64; i++) {
968
7.48M
        memset(ptr_sbr_dec->sbr_qmf_out_real[i], 0, 64 * sizeof(FLOAT32));
969
7.48M
        memset(ptr_sbr_dec->sbr_qmf_out_imag[i], 0, 64 * sizeof(FLOAT32));
970
7.48M
      }
971
116k
    }
972
973
339k
    if (!mps_sbr_flag) {
974
245k
      ptr_sbr_dec->band_count =
975
245k
          ptr_header_data->pstr_freq_band_data->sub_band_end;
976
245k
    } else
977
93.5k
      ptr_sbr_dec->band_count = ptr_sbr_dec->str_codec_qmf_bank.no_channels;
978
979
339k
    ixheaacd_esbr_synthesis_filt_block(
980
339k
        ptr_sbr_dec, ptr_header_data, ptr_frame_data, apply_processing,
981
339k
        pp_qmf_buf_real, pp_qmf_buf_imag, stereo_config_idx, sbr_tables_ptr,
982
339k
        mps_sbr_flag, ch_fac,
983
339k
        ((ptr_header_data->channel_mode == PS_STEREO) || ptr_header_data->enh_sbr_ps),
984
339k
        0, ptr_ps_dec, drc_on, drc_sbr_factors);
985
986
339k
    if (ptr_header_data->enh_sbr_ps || ptr_header_data->channel_mode == PS_STEREO) {
987
16.2k
      pp_qmf_buf_real = ptr_ps_dec->pp_qmf_buf_real[1];
988
16.2k
      pp_qmf_buf_imag = ptr_ps_dec->pp_qmf_buf_imag[1];
989
16.2k
      ixheaacd_esbr_synthesis_filt_block(
990
16.2k
          (ia_sbr_dec_struct *)
991
16.2k
          (&(((ia_handle_sbr_dec_inst_struct)self)->pstr_sbr_channel[1]->str_sbr_dec)),
992
16.2k
          (ia_sbr_header_data_struct *)
993
16.2k
          (&(((ia_handle_sbr_dec_inst_struct)self)->pstr_sbr_header[1])),
994
16.2k
          (ia_sbr_frame_info_data_struct *)
995
16.2k
          (&(((ia_handle_sbr_dec_inst_struct)self)->frame_buffer[1])), apply_processing,
996
16.2k
          pp_qmf_buf_real, pp_qmf_buf_imag, stereo_config_idx, sbr_tables_ptr,
997
16.2k
          mps_sbr_flag, ch_fac,
998
16.2k
          ((ptr_header_data->channel_mode == PS_STEREO) || ptr_header_data->enh_sbr_ps),
999
16.2k
          1, ptr_ps_dec, drc_on, drc_sbr_factors);
1000
16.2k
    }
1001
339k
    if (apply_processing && ec_flag) {
1002
0
      WORD16 *border_vec = ptr_frame_data->str_frame_info_details.border_vec;
1003
0
      ptr_frame_data_prev->end_position =
1004
0
          border_vec[ptr_frame_data->str_frame_info_details.num_env];
1005
0
    }
1006
339k
    ptr_frame_data->prev_sbr_mode = sbr_mode;
1007
1008
339k
    return 0;
1009
339k
  }
1010
1011
60.2k
  if (ldmps_present) {
1012
6.45k
    if (ptr_sbr_dec->str_codec_qmf_bank.no_channels > 32) {
1013
26
      if (ec_flag) {
1014
0
        ptr_sbr_dec->str_codec_qmf_bank.no_channels = 32;
1015
26
      } else {
1016
26
        return IA_FATAL_ERROR;
1017
26
      }
1018
26
    }
1019
6.42k
    ixheaacd_cplx_anal_qmffilt_32(
1020
6.42k
        (WORD32 *)ptr_time_data, &ptr_sbr_dec->str_sbr_scale_fact,
1021
6.42k
        &p_arr_qmf_buf_real[op_delay], &p_arr_qmf_buf_imag[op_delay],
1022
6.42k
        &ptr_sbr_dec->str_codec_qmf_bank, sbr_tables_ptr->qmf_dec_tables_ptr,
1023
6.42k
        ch_fac, 1);
1024
53.7k
  } else {
1025
53.7k
    ixheaacd_cplx_anal_qmffilt(
1026
53.7k
        ptr_time_data, &ptr_sbr_dec->str_sbr_scale_fact, &p_arr_qmf_buf_real[op_delay],
1027
53.7k
        &p_arr_qmf_buf_imag[op_delay], &ptr_sbr_dec->str_codec_qmf_bank,
1028
53.7k
        sbr_tables_ptr->qmf_dec_tables_ptr, ch_fac, low_pow_flag, audio_object_type);
1029
53.7k
  }
1030
1031
60.2k
  if (ldmps_present == 1) {
1032
6.42k
    for (j = SBR_HF_ADJ_OFFSET;
1033
108k
         j < ptr_sbr_dec->str_codec_qmf_bank.num_time_slots + SBR_HF_ADJ_OFFSET;
1034
101k
         j++) {
1035
6.62M
      for (k = 0; k < 64; k++) {
1036
6.52M
        WORD32 scale = 7;
1037
6.52M
        ptr_sbr_dec->mps_qmf_buf_real[j][k] = 0.0f;
1038
6.52M
        ptr_sbr_dec->mps_qmf_buf_imag[j][k] = 0.0f;
1039
6.52M
        if (k < ptr_sbr_dec->str_codec_qmf_bank.usb) {
1040
2.50M
          ptr_sbr_dec->mps_qmf_buf_real[j][k] +=
1041
2.50M
              (FLOAT32)(p_arr_qmf_buf_real[j][k] / (FLOAT32)(1 << scale));
1042
2.50M
          ptr_sbr_dec->mps_qmf_buf_imag[j][k] +=
1043
2.50M
              (FLOAT32)(p_arr_qmf_buf_imag[j][k] / (FLOAT32)(1 << scale));
1044
2.50M
        }
1045
6.52M
      }
1046
101k
    }
1047
6.42k
  }
1048
  /*ITTIAM : the size of real and img coeff are not same as that of the mps
1049
   * analysis.*/
1050
60.2k
  {
1051
60.2k
    WORD shift1, shift2;
1052
60.2k
    WORD min_shift;
1053
60.2k
    WORD shift_over;
1054
60.2k
    WORD reserve_ov1, reserve_ov2;
1055
60.2k
    WORD reservea[2];
1056
60.2k
    WORD i = 0;
1057
60.2k
    WORD usb = ptr_sbr_dec->str_codec_qmf_bank.usb;
1058
60.2k
    WORD iter_val = 1;
1059
60.2k
    if (audio_object_type == AOT_ER_AAC_ELD ||
1060
60.2k
        audio_object_type == AOT_ER_AAC_LD) {
1061
60.2k
      iter_val = 0;
1062
60.2k
    }
1063
60.2k
    do {
1064
60.2k
      WORD t1 = op_delay;
1065
60.2k
      WORD t2 = no_bins + op_delay;
1066
60.2k
      if (i) {
1067
0
        t1 = 0;
1068
0
        t2 = op_delay;
1069
0
      }
1070
60.2k
      reservea[i] = (*ixheaacd_ixheaacd_expsubbandsamples)(
1071
60.2k
          p_arr_qmf_buf_real, p_arr_qmf_buf_imag, 0, usb, t1, t2, low_pow_flag);
1072
60.2k
      i++;
1073
60.2k
    } while (i <= iter_val);
1074
60.2k
    ;
1075
1076
60.2k
    reserve = reservea[0];
1077
60.2k
    if (audio_object_type != AOT_ER_AAC_ELD &&
1078
60.2k
        audio_object_type != AOT_ER_AAC_LD)
1079
0
      reserve_ov1 = reservea[1];
1080
60.2k
    else
1081
60.2k
      reserve_ov1 = reserve;
1082
60.2k
    ptr_sbr_dec->max_samp_val = ixheaac_min32(reserve, reserve_ov1);
1083
1084
60.2k
    reserve_ov2 = (*ixheaacd_ixheaacd_expsubbandsamples)(
1085
60.2k
        ptr_sbr_dec->str_hf_generator.lpc_filt_states_real,
1086
60.2k
        ptr_sbr_dec->str_hf_generator.lpc_filt_states_imag, 0, usb, 0,
1087
60.2k
        LPC_ORDER, low_pow_flag);
1088
1089
60.2k
    reserve_ov1 = ixheaac_min32(reserve_ov1, reserve_ov2);
1090
1091
60.2k
    shift1 = ptr_sbr_dec->str_sbr_scale_fact.lb_scale + reserve;
1092
1093
60.2k
    shift2 = ptr_sbr_dec->str_sbr_scale_fact.ov_lb_scale + reserve_ov1;
1094
60.2k
    min_shift = ixheaac_min32(shift1, shift2);
1095
60.2k
    shift_over = (shift2 - min_shift);
1096
60.2k
    reserve -= (shift1 - min_shift);
1097
1098
60.2k
    ptr_sbr_dec->str_sbr_scale_fact.ov_lb_scale += (reserve_ov1 - shift_over);
1099
1100
60.2k
    (*ixheaacd_adjust_scale)(p_arr_qmf_buf_real, p_arr_qmf_buf_imag, 0, usb, 0,
1101
60.2k
                             op_delay, reserve_ov1 - shift_over, low_pow_flag);
1102
1103
60.2k
    (*ixheaacd_adjust_scale)(p_arr_qmf_buf_real, p_arr_qmf_buf_imag, 0, usb,
1104
60.2k
                             op_delay, (no_bins + op_delay), reserve,
1105
60.2k
                             low_pow_flag);
1106
1107
60.2k
    (*ixheaacd_adjust_scale)(ptr_sbr_dec->str_hf_generator.lpc_filt_states_real,
1108
60.2k
                             ptr_sbr_dec->str_hf_generator.lpc_filt_states_imag,
1109
60.2k
                             0, usb, 0, LPC_ORDER, reserve_ov1 - shift_over,
1110
60.2k
                             low_pow_flag);
1111
1112
60.2k
    ptr_sbr_dec->str_sbr_scale_fact.lb_scale += reserve;
1113
1114
60.2k
    save_lb_scale = ptr_sbr_dec->str_sbr_scale_fact.lb_scale;
1115
60.2k
  }
1116
1117
60.2k
  {
1118
60.2k
    WORD32 num = no_bins;
1119
60.2k
    WORD32 *p_loc_qmf_real =
1120
60.2k
        &p_arr_qmf_buf_real[op_delay][NO_ANALYSIS_CHANNELS];
1121
1122
60.2k
    if (!low_pow_flag) {
1123
60.2k
      num = num << 1;
1124
60.2k
    }
1125
1126
60.2k
    ixheaacd_clr_subsamples(p_loc_qmf_real, num - 1, (NO_SYN_ANA_CHANNELS));
1127
60.2k
  }
1128
1129
60.2k
  if (apply_processing) {
1130
60.2k
    WORD16 degree_alias[NO_SYNTHESIS_CHANNELS];
1131
60.2k
    WORD16 *border_vec = ptr_frame_data->str_frame_info_details.border_vec;
1132
1133
60.2k
    if (low_pow_flag) {
1134
0
      memset(degree_alias, 0, NO_SYNTHESIS_CHANNELS * sizeof(WORD16));
1135
0
    }
1136
1137
60.2k
    if (low_pow_flag) {
1138
0
      WORD32 com_low_band_scale;
1139
0
      ixheaacd_low_pow_hf_generator(
1140
0
          &ptr_sbr_dec->str_hf_generator, p_arr_qmf_buf_real, degree_alias,
1141
0
          border_vec[0] * ptr_header_data->time_step,
1142
0
          ptr_header_data->time_step *
1143
0
              ixheaac_sub16_sat(
1144
0
                  border_vec[ptr_frame_data->str_frame_info_details.num_env],
1145
0
                  ptr_header_data->num_time_slots),
1146
0
          ptr_header_data->pstr_freq_band_data->num_if_bands,
1147
0
          ptr_frame_data->max_qmf_subband_aac, ptr_frame_data->sbr_invf_mode,
1148
0
          ptr_frame_data_prev->sbr_invf_mode, ptr_sbr_dec->max_samp_val,
1149
0
          ptr_work_buf_core);
1150
1151
0
      com_low_band_scale =
1152
0
          ixheaac_min32(ptr_sbr_dec->str_sbr_scale_fact.ov_lb_scale,
1153
0
                         ptr_sbr_dec->str_sbr_scale_fact.lb_scale);
1154
1155
0
      ptr_sbr_dec->str_sbr_scale_fact.hb_scale =
1156
0
          (WORD16)(com_low_band_scale - 2);
1157
60.2k
    } else {
1158
60.2k
      if (ldmps_present == 1) {
1159
6.42k
        err_code = ixheaacd_generate_hf(ptr_sbr_dec->mps_qmf_buf_real + (SBR_HF_ADJ_OFFSET),
1160
6.42k
                                        ptr_sbr_dec->mps_qmf_buf_imag + (SBR_HF_ADJ_OFFSET),
1161
6.42k
                                        ptr_sbr_dec->ph_vocod_qmf_real + (SBR_HF_ADJ_OFFSET),
1162
6.42k
                                        ptr_sbr_dec->ph_vocod_qmf_imag + (SBR_HF_ADJ_OFFSET),
1163
6.42k
                                        ptr_sbr_dec->sbr_qmf_out_real + (SBR_HF_ADJ_OFFSET),
1164
6.42k
                                        ptr_sbr_dec->sbr_qmf_out_imag + (SBR_HF_ADJ_OFFSET),
1165
6.42k
                                        ptr_frame_data, ptr_header_data, ldmps_present,
1166
6.42k
                                        ptr_sbr_dec->str_codec_qmf_bank.num_time_slots, ec_flag);
1167
6.42k
        if (err_code) return err_code;
1168
53.7k
      } else {
1169
53.7k
        ixheaacd_hf_generator(
1170
53.7k
            &ptr_sbr_dec->str_hf_generator, &ptr_sbr_dec->str_sbr_scale_fact,
1171
53.7k
            p_arr_qmf_buf_real, p_arr_qmf_buf_imag, ptr_header_data->time_step,
1172
53.7k
            border_vec[0],
1173
53.7k
            ixheaac_sub16_sat(
1174
53.7k
                border_vec[ptr_frame_data->str_frame_info_details.num_env],
1175
53.7k
                ptr_header_data->num_time_slots),
1176
53.7k
            ptr_header_data->pstr_freq_band_data->num_if_bands,
1177
53.7k
            ptr_frame_data->max_qmf_subband_aac, ptr_frame_data->sbr_invf_mode,
1178
53.7k
            ptr_frame_data_prev->sbr_invf_mode, ptr_work_buf_core,
1179
53.7k
            audio_object_type);
1180
53.7k
      }
1181
60.2k
    }
1182
60.2k
    if (ldmps_present == 1) {
1183
6.42k
      ptr_frame_data->pstr_sbr_header = ptr_header_data;
1184
6.42k
      err_code = ixheaacd_sbr_env_calc(
1185
6.42k
          ptr_frame_data, ptr_sbr_dec->sbr_qmf_out_real + (SBR_HF_ADJ_OFFSET),
1186
6.42k
          ptr_sbr_dec->sbr_qmf_out_imag + (SBR_HF_ADJ_OFFSET),
1187
6.42k
          ptr_sbr_dec->qmf_buf_real + (SBR_HF_ADJ_OFFSET),
1188
6.42k
          ptr_sbr_dec->qmf_buf_imag + (SBR_HF_ADJ_OFFSET), NULL, ptr_sbr_dec->scratch_buff,
1189
6.42k
          pvc_dec_out_buf, ldmps_present, ec_flag);
1190
1191
121k
      for (j = 0; j < ptr_sbr_dec->str_codec_qmf_bank.num_time_slots + 2; j++) {
1192
4.63M
        for (k = ptr_sbr_dec->str_codec_qmf_bank.usb; k < 64; k++) {
1193
4.51M
          ptr_sbr_dec->mps_qmf_buf_real[j][k] +=
1194
4.51M
              ptr_sbr_dec->sbr_qmf_out_real[j][k];
1195
4.51M
          ptr_sbr_dec->mps_qmf_buf_imag[j][k] +=
1196
4.51M
              ptr_sbr_dec->sbr_qmf_out_imag[j][k];
1197
4.51M
        }
1198
114k
      }
1199
53.7k
    } else {
1200
53.7k
      err_code = ixheaacd_calc_sbrenvelope(
1201
53.7k
          &ptr_sbr_dec->str_sbr_scale_fact, &ptr_sbr_dec->str_sbr_calc_env,
1202
53.7k
          ptr_header_data, ptr_frame_data, ptr_frame_data_prev,
1203
53.7k
          p_arr_qmf_buf_real, p_arr_qmf_buf_imag, degree_alias, low_pow_flag,
1204
53.7k
          sbr_tables_ptr, pstr_common_tables,
1205
53.7k
          ptr_work_buf_core + (LPC_ORDER << (6 + !low_pow_flag)),
1206
53.7k
          audio_object_type);
1207
53.7k
      if (err_code) return err_code;
1208
53.7k
    }
1209
1210
60.2k
    memcpy(ptr_frame_data_prev->sbr_invf_mode, ptr_frame_data->sbr_invf_mode,
1211
60.2k
           ptr_header_data->pstr_freq_band_data->num_if_bands * sizeof(WORD32));
1212
1213
60.2k
    ptr_frame_data_prev->coupling_mode = ptr_frame_data->coupling_mode;
1214
60.2k
    ptr_frame_data_prev->max_qmf_subband_aac =
1215
60.2k
        ptr_frame_data->max_qmf_subband_aac;
1216
60.2k
    ptr_frame_data_prev->end_position =
1217
60.2k
        border_vec[ptr_frame_data->str_frame_info_details.num_env];
1218
60.2k
    ptr_frame_data_prev->amp_res = ptr_frame_data->amp_res;
1219
60.2k
  } else {
1220
0
    ptr_sbr_dec->str_sbr_scale_fact.hb_scale = save_lb_scale;
1221
0
  }
1222
1223
60.2k
  if (!low_pow_flag) {
1224
180k
    for (i = 0; i < LPC_ORDER; i++) {
1225
120k
      WORD32 *p_loc_qmf_real = &p_arr_qmf_buf_real[no_bins - LPC_ORDER + i][0];
1226
120k
      WORD32 *p_loc_qmf_imag = &p_arr_qmf_buf_imag[no_bins - LPC_ORDER + i][0];
1227
120k
      WORD32 *plpc_filt_states_real =
1228
120k
          &ptr_sbr_dec->str_hf_generator.lpc_filt_states_real[i][0];
1229
120k
      WORD32 *plpc_filt_states_imag =
1230
120k
          &ptr_sbr_dec->str_hf_generator.lpc_filt_states_imag[i][0];
1231
1232
120k
      memcpy(plpc_filt_states_real, p_loc_qmf_real,
1233
120k
             sizeof(WORD32) * (ptr_sbr_dec->str_codec_qmf_bank.usb));
1234
120k
      memcpy(plpc_filt_states_imag, p_loc_qmf_imag,
1235
120k
             sizeof(WORD32) * (ptr_sbr_dec->str_codec_qmf_bank.usb));
1236
120k
    }
1237
60.2k
  } else {
1238
0
    for (i = 0; i < LPC_ORDER; i++) {
1239
0
      WORD32 *p_loc_qmf_real = &p_arr_qmf_buf_real[no_bins - LPC_ORDER + i][0];
1240
0
      WORD32 *plpc_filt_states_real =
1241
0
          &ptr_sbr_dec->str_hf_generator.lpc_filt_states_real[i][0];
1242
0
      memcpy(plpc_filt_states_real, p_loc_qmf_real,
1243
0
             sizeof(WORD32) * (ptr_sbr_dec->str_codec_qmf_bank.usb));
1244
0
    }
1245
0
  }
1246
1247
60.2k
  if (apply_processing && ptr_header_data->channel_mode == PS_STEREO &&
1248
60.2k
      ((audio_object_type != AOT_ER_AAC_ELD) &&
1249
2.05k
       (audio_object_type != AOT_ER_AAC_LD))) {
1250
0
    WORD32 ps_scale;
1251
1252
0
    ixheaacd_init_ps_scale(ptr_ps_dec, &ptr_sbr_dec->str_sbr_scale_fact);
1253
1254
0
    ixheaacd_cplx_synt_qmffilt(p_arr_qmf_buf_real, p_arr_qmf_buf_imag, op_delay,
1255
0
                               ptr_sbr_dec->p_arr_qmf_buf_real, ptr_sbr_dec->p_arr_qmf_buf_imag,
1256
0
                               &ptr_sbr_dec->str_sbr_scale_fact, ptr_time_data,
1257
0
                               &ptr_sbr_dec->str_synthesis_qmf_bank, ptr_ps_dec,
1258
0
                               1, 0, sbr_tables_ptr, pstr_common_tables, ch_fac,
1259
0
                               drc_on, drc_sbr_factors, audio_object_type);
1260
1261
0
    ps_scale = ptr_sbr_dec->str_sbr_scale_fact.ps_scale;
1262
0
    ptr_sbr_sf_r->ov_lb_scale = ps_scale;
1263
0
    ptr_sbr_sf_r->lb_scale = ps_scale;
1264
0
    ptr_sbr_sf_r->hb_scale = ps_scale;
1265
1266
0
    ixheaacd_cplx_synt_qmffilt(p_arr_qmf_buf_real, p_arr_qmf_buf_imag, op_delay,
1267
0
                               ptr_sbr_dec->p_arr_qmf_buf_real, ptr_sbr_dec->p_arr_qmf_buf_imag,
1268
0
                               ptr_sbr_sf_r, ptr_time_data + 1,
1269
0
                               ptr_qmf_synth_bank_r, ptr_ps_dec, 0, 0,
1270
0
                               sbr_tables_ptr, pstr_common_tables, ch_fac,
1271
0
                               drc_on, drc_sbr_factors, audio_object_type);
1272
60.2k
  } else {
1273
60.2k
    ixheaacd_cplx_synt_qmffilt(p_arr_qmf_buf_real, p_arr_qmf_buf_imag, op_delay,
1274
60.2k
                               ptr_sbr_dec->p_arr_qmf_buf_real, ptr_sbr_dec->p_arr_qmf_buf_imag,
1275
60.2k
                               &ptr_sbr_dec->str_sbr_scale_fact, ptr_time_data,
1276
60.2k
                               &ptr_sbr_dec->str_synthesis_qmf_bank, ptr_ps_dec,
1277
60.2k
                               0, low_pow_flag, sbr_tables_ptr,
1278
60.2k
                               pstr_common_tables, ch_fac, drc_on,
1279
60.2k
                               drc_sbr_factors, audio_object_type);
1280
60.2k
  }
1281
1282
60.2k
  {
1283
60.2k
    WORD32 num = op_delay;
1284
60.2k
    if (audio_object_type != AOT_ER_AAC_ELD) {
1285
0
      WORD32 *p_loc_qmf_real = ptr_sbr_dec->ptr_sbr_overlap_buf;
1286
0
      WORD32 *p_loc_qmf_real_1 = &p_arr_qmf_buf_real[no_bins][0];
1287
0
      memcpy(p_loc_qmf_real, p_loc_qmf_real_1,
1288
0
             sizeof(WORD32) * NO_SYNTHESIS_CHANNELS * num);
1289
0
    }
1290
1291
60.2k
    if (!low_pow_flag) {
1292
60.2k
      num = num << 1;
1293
60.2k
    }
1294
1295
60.2k
    if (ldmps_present == 1) {
1296
6.42k
      memmove(&ptr_sbr_dec->mps_qmf_buf_real[0][0],
1297
6.42k
              &ptr_sbr_dec->mps_qmf_buf_real[ptr_sbr_dec->str_codec_qmf_bank
1298
6.42k
                                                 .num_time_slots][0],
1299
6.42k
              SBR_HF_ADJ_OFFSET * sizeof(FLOAT32) * 64);
1300
1301
6.42k
      memmove(&ptr_sbr_dec->mps_qmf_buf_imag[0][0],
1302
6.42k
              &ptr_sbr_dec->mps_qmf_buf_imag[ptr_sbr_dec->str_codec_qmf_bank
1303
6.42k
                                                 .num_time_slots][0],
1304
6.42k
              SBR_HF_ADJ_OFFSET * sizeof(FLOAT32) * 64);
1305
6.42k
    }
1306
60.2k
  }
1307
1308
60.2k
  ptr_sbr_dec->str_sbr_scale_fact.ov_lb_scale = save_lb_scale;
1309
60.2k
  return 0;
1310
60.2k
}
1311
1312
WORD32 ixheaacd_esbr_dec(ia_sbr_dec_struct *ptr_sbr_dec,
1313
                         ia_sbr_header_data_struct *ptr_header_data,
1314
                         ia_sbr_frame_info_data_struct *ptr_frame_data,
1315
                         FLAG apply_processing, FLAG low_pow_flag,
1316
31.1k
                         ia_sbr_tables_struct *ptr_sbr_tables, WORD ch_fac) {
1317
31.1k
  WORD32 i;
1318
31.1k
  WORD32 op_delay;
1319
1320
31.1k
  WORD32 codec_x_delay = 0;
1321
1322
31.1k
  FLOAT32 **pp_qmf_buf_real = ptr_sbr_dec->pp_qmf_buf_real;
1323
31.1k
  FLOAT32 **pp_qmf_buf_imag = ptr_sbr_dec->pp_qmf_buf_imag;
1324
1325
31.1k
  WORD32 upsample_ratio_idx = ptr_header_data->sbr_ratio_idx;
1326
1327
31.1k
  WORD32 mps_sbr_flag = ptr_frame_data->mps_sbr_flag;
1328
31.1k
  WORD32 stereo_config_idx = ptr_frame_data->stereo_config_idx;
1329
31.1k
  WORD32 hbe_flag = ptr_header_data->hbe_flag;
1330
31.1k
  WORD32 sbr_mode = ptr_frame_data->sbr_mode;
1331
1332
31.1k
  op_delay = 6;
1333
31.1k
  if (upsample_ratio_idx == SBR_UPSAMPLE_IDX_4_1) {
1334
10.7k
    op_delay = 2 * 6;
1335
10.7k
  }
1336
1337
31.1k
  ptr_sbr_dec->str_sbr_scale_fact.lb_scale = 0;
1338
31.1k
  {
1339
31.1k
    if (hbe_flag) {
1340
18.9k
      codec_x_delay = 32;
1341
18.9k
    }
1342
31.1k
    if (upsample_ratio_idx == SBR_UPSAMPLE_IDX_4_1) {
1343
10.7k
      codec_x_delay = 2 * codec_x_delay;
1344
10.7k
    }
1345
1346
31.1k
    memmove(
1347
31.1k
        &ptr_sbr_dec->qmf_buf_real[0][0],
1348
31.1k
        &ptr_sbr_dec
1349
31.1k
             ->qmf_buf_real[ptr_sbr_dec->str_codec_qmf_bank.num_time_slots][0],
1350
31.1k
        (op_delay + SBR_HF_ADJ_OFFSET + codec_x_delay) * sizeof(FLOAT32) * 64);
1351
31.1k
    memmove(
1352
31.1k
        &ptr_sbr_dec->qmf_buf_imag[0][0],
1353
31.1k
        &ptr_sbr_dec
1354
31.1k
             ->qmf_buf_imag[ptr_sbr_dec->str_codec_qmf_bank.num_time_slots][0],
1355
31.1k
        (op_delay + SBR_HF_ADJ_OFFSET + codec_x_delay) * sizeof(FLOAT32) * 64);
1356
1357
31.1k
    memmove(&ptr_sbr_dec->sbr_qmf_out_real[0][0],
1358
31.1k
            &ptr_sbr_dec->sbr_qmf_out_real[ptr_sbr_dec->str_codec_qmf_bank
1359
31.1k
                                               .num_time_slots][0],
1360
31.1k
            (op_delay + SBR_HF_ADJ_OFFSET) * sizeof(FLOAT32) * 64);
1361
31.1k
    memmove(&ptr_sbr_dec->sbr_qmf_out_imag[0][0],
1362
31.1k
            &ptr_sbr_dec->sbr_qmf_out_imag[ptr_sbr_dec->str_codec_qmf_bank
1363
31.1k
                                               .num_time_slots][0],
1364
31.1k
            (op_delay + SBR_HF_ADJ_OFFSET) * sizeof(FLOAT32) * 64);
1365
1366
31.1k
    if (hbe_flag) {
1367
18.9k
      memmove(&ptr_sbr_dec->ph_vocod_qmf_real[0][0],
1368
18.9k
              &ptr_sbr_dec->ph_vocod_qmf_real[ptr_sbr_dec->str_codec_qmf_bank
1369
18.9k
                                                  .num_time_slots][0],
1370
18.9k
              64 * sizeof(FLOAT32) * (op_delay + SBR_HF_ADJ_OFFSET));
1371
18.9k
      memmove(ptr_sbr_dec->ph_vocod_qmf_imag,
1372
18.9k
              ptr_sbr_dec->ph_vocod_qmf_imag +
1373
18.9k
                  ptr_sbr_dec->str_codec_qmf_bank.num_time_slots,
1374
18.9k
              64 * sizeof(FLOAT32) * (op_delay + SBR_HF_ADJ_OFFSET));
1375
18.9k
    }
1376
31.1k
  }
1377
1378
31.1k
  ixheaacd_esbr_analysis_filt_block(
1379
31.1k
      ptr_sbr_dec, ptr_sbr_tables,
1380
31.1k
      op_delay + codec_x_delay + SBR_HF_ADJ_OFFSET);
1381
1382
31.1k
  if (hbe_flag) {
1383
18.9k
    WORD32 err = ixheaacd_qmf_hbe_apply(
1384
18.9k
        ptr_sbr_dec->p_hbe_txposer,
1385
18.9k
        ptr_sbr_dec->qmf_buf_real + (op_delay + SBR_HF_ADJ_OFFSET) +
1386
18.9k
            ESBR_HBE_DELAY_OFFSET,
1387
18.9k
        ptr_sbr_dec->qmf_buf_imag + (op_delay + SBR_HF_ADJ_OFFSET) +
1388
18.9k
            ESBR_HBE_DELAY_OFFSET,
1389
18.9k
        ptr_sbr_dec->str_codec_qmf_bank.num_time_slots,
1390
18.9k
        ptr_sbr_dec->ph_vocod_qmf_real + (op_delay + SBR_HF_ADJ_OFFSET),
1391
18.9k
        ptr_sbr_dec->ph_vocod_qmf_imag + (op_delay + SBR_HF_ADJ_OFFSET),
1392
18.9k
        ptr_frame_data->pitch_in_bins, ptr_header_data);
1393
18.9k
    if (err) return err;
1394
1395
18.9k
    if (upsample_ratio_idx == SBR_UPSAMPLE_IDX_4_1) {
1396
10.7k
      ixheaacd_hbe_repl_spec(
1397
10.7k
          &ptr_sbr_dec->p_hbe_txposer->x_over_qmf[0],
1398
10.7k
          ptr_sbr_dec->ph_vocod_qmf_real + (op_delay + SBR_HF_ADJ_OFFSET),
1399
10.7k
          ptr_sbr_dec->ph_vocod_qmf_imag + (op_delay + SBR_HF_ADJ_OFFSET),
1400
10.7k
          ptr_sbr_dec->str_codec_qmf_bank.num_time_slots,
1401
10.7k
          ptr_sbr_dec->p_hbe_txposer->max_stretch);
1402
10.7k
    }
1403
18.9k
  }
1404
31.1k
  ixheaacd_qmf_enrg_calc(ptr_sbr_dec, upsample_ratio_idx, low_pow_flag);
1405
1406
2.02M
  for (i = 0; i < 64; i++) {
1407
1.99M
    memset(ptr_sbr_dec->sbr_qmf_out_real[i], 0, 64 * sizeof(FLOAT32));
1408
1.99M
    memset(ptr_sbr_dec->sbr_qmf_out_imag[i], 0, 64 * sizeof(FLOAT32));
1409
1.99M
  }
1410
1411
31.1k
  ptr_sbr_dec->band_count = ptr_sbr_dec->str_codec_qmf_bank.no_channels;
1412
1413
31.1k
  ixheaacd_esbr_synthesis_filt_block(
1414
31.1k
      ptr_sbr_dec, ptr_header_data, ptr_frame_data, apply_processing,
1415
31.1k
      pp_qmf_buf_real, pp_qmf_buf_imag, stereo_config_idx, ptr_sbr_tables,
1416
31.1k
      mps_sbr_flag, ch_fac, 0, 0, NULL, 0, NULL);
1417
1418
31.1k
  ptr_frame_data->prev_sbr_mode = sbr_mode;
1419
31.1k
  return 0;
1420
31.1k
}
1421
1422
WORD32 ixheaacd_sbr_dec_from_mps(FLOAT32 *p_mps_qmf_output, VOID *p_sbr_dec, VOID *p_sbr_frame,
1423
208k
                                 VOID *p_sbr_header, WORD32 ec_flag) {
1424
208k
  WORD32 i, k;
1425
208k
  ia_sbr_frame_info_data_struct *ptr_frame_data =
1426
208k
      (ia_sbr_frame_info_data_struct *)p_sbr_frame;
1427
208k
  ia_sbr_header_data_struct *ptr_header_data =
1428
208k
      (ia_sbr_header_data_struct *)p_sbr_header;
1429
208k
  ia_sbr_dec_struct *ptr_sbr_dec = (ia_sbr_dec_struct *)p_sbr_dec;
1430
208k
  ia_frame_info_struct *p_frame_info = &ptr_frame_data->str_frame_info_details;
1431
208k
  WORD32 no_bins;
1432
208k
  WORD32 upsample_ratio_idx = ptr_header_data->sbr_ratio_idx;
1433
208k
  WORD32 op_delay = 6 + SBR_HF_ADJ_OFFSET;
1434
208k
  WORD32 num_anal_bands = 40;
1435
208k
  WORD32 mps_sbr_flag = ptr_frame_data->mps_sbr_flag;
1436
208k
  WORD32 err = 0;
1437
1438
208k
  if (ptr_header_data->is_usf_4) {
1439
34.0k
    op_delay += 6;
1440
34.0k
  }
1441
1442
208k
  num_anal_bands = num_anal_bands - (upsample_ratio_idx << 3);
1443
1444
208k
  if (!mps_sbr_flag) {
1445
115k
    return 0;
1446
115k
  } else {
1447
93.4k
    ptr_frame_data->cov_count = ptr_sbr_dec->str_codec_qmf_bank.no_channels;
1448
93.4k
  }
1449
1450
93.4k
  no_bins = ptr_header_data->output_framesize / 64;
1451
1452
3.48M
  for (i = 0; i < no_bins; i++) {
1453
3.39M
    FLOAT32 *p_loc_mps_qmf_output =
1454
3.39M
        p_mps_qmf_output + i * (MAX_NUM_QMF_BANDS_ESBR * 2);
1455
69.5M
    for (k = 0; k < ptr_header_data->pstr_freq_band_data->sub_band_start; k++) {
1456
66.1M
      ptr_sbr_dec->mps_qmf_buf_real[op_delay + i][k] = *p_loc_mps_qmf_output++;
1457
66.1M
      ptr_sbr_dec->mps_qmf_buf_imag[op_delay + i][k] = *p_loc_mps_qmf_output++;
1458
1459
66.1M
      ptr_sbr_dec->mps_sbr_qmf_buf_real[SBR_HF_ADJ_OFFSET + i][k] =
1460
66.1M
          ptr_sbr_dec->qmf_buf_real[SBR_HF_ADJ_OFFSET + i][k];
1461
66.1M
      ptr_sbr_dec->mps_sbr_qmf_buf_imag[SBR_HF_ADJ_OFFSET + i][k] =
1462
66.1M
          ptr_sbr_dec->qmf_buf_real[SBR_HF_ADJ_OFFSET + i][k];
1463
66.1M
    }
1464
3.39M
  }
1465
1466
93.4k
  if (ptr_frame_data->reset_flag) {
1467
15.2k
    WORD32 l;
1468
15.2k
    WORD32 start_band = ptr_header_data->pstr_freq_band_data->qmf_sb_prev;
1469
15.2k
    WORD32 end_band = num_anal_bands;
1470
15.2k
    WORD32 start_slot =
1471
15.2k
        SBR_HF_ADJ_OFFSET + ptr_frame_data->rate * p_frame_info->border_vec[0];
1472
1473
120k
    for (l = start_slot; l < op_delay; l++) {
1474
919k
      for (k = start_band; k < end_band; k++) {
1475
813k
        ptr_sbr_dec->mps_qmf_buf_real[l][k] = 0.0;
1476
813k
        ptr_sbr_dec->mps_qmf_buf_imag[l][k] = 0.0;
1477
813k
      }
1478
105k
    }
1479
1480
45.7k
    for (l = 0; l < SBR_HF_ADJ_OFFSET; l++) {
1481
267k
      for (k = start_band; k < end_band; k++) {
1482
236k
        ptr_sbr_dec->mps_qmf_buf_real[l][k] = 0.0;
1483
236k
        ptr_sbr_dec->mps_qmf_buf_imag[l][k] = 0.0;
1484
236k
      }
1485
30.4k
    }
1486
15.2k
  }
1487
93.4k
  ptr_header_data->pstr_freq_band_data->qmf_sb_prev =
1488
93.4k
      ptr_header_data->pstr_freq_band_data->sub_band_start;
1489
1490
93.4k
  err = ixheaacd_generate_hf(ptr_sbr_dec->mps_qmf_buf_real + SBR_HF_ADJ_OFFSET,
1491
93.4k
                             ptr_sbr_dec->mps_qmf_buf_imag + SBR_HF_ADJ_OFFSET, NULL, NULL,
1492
93.4k
                             ptr_sbr_dec->mps_sbr_qmf_buf_real + SBR_HF_ADJ_OFFSET,
1493
93.4k
                             ptr_sbr_dec->mps_sbr_qmf_buf_imag + SBR_HF_ADJ_OFFSET,
1494
93.4k
                             ptr_frame_data, ptr_header_data, 0,
1495
93.4k
                             ptr_sbr_dec->str_codec_qmf_bank.num_time_slots, ec_flag);
1496
93.4k
  if (err) return err;
1497
1498
93.4k
  ptr_frame_data->pstr_sbr_header = ptr_header_data;
1499
93.4k
  ptr_frame_data->sbr_mode = ORIG_SBR;
1500
93.4k
  ptr_frame_data->prev_sbr_mode = ORIG_SBR;
1501
93.4k
  err = ixheaacd_sbr_env_calc(
1502
93.4k
      ptr_frame_data, ptr_sbr_dec->mps_sbr_qmf_buf_real + SBR_HF_ADJ_OFFSET,
1503
93.4k
      ptr_sbr_dec->mps_sbr_qmf_buf_imag + SBR_HF_ADJ_OFFSET,
1504
93.4k
      ptr_sbr_dec->mps_qmf_buf_real + SBR_HF_ADJ_OFFSET,
1505
93.4k
      ptr_sbr_dec->mps_qmf_buf_imag + SBR_HF_ADJ_OFFSET,
1506
93.4k
      (ptr_header_data->hbe_flag == 0) ? NULL : ptr_sbr_dec->p_hbe_txposer->x_over_qmf,
1507
93.4k
      ptr_sbr_dec->scratch_buff, NULL, 0, ec_flag);
1508
1509
93.4k
  if (err) return err;
1510
3.48M
  for (i = 0; i < no_bins; i++) {
1511
3.38M
    FLOAT32 *p_loc_mps_qmf_output =
1512
3.38M
        p_mps_qmf_output + i * (MAX_NUM_QMF_BANDS_ESBR * 2);
1513
69.5M
    for (k = 0; k < ptr_header_data->pstr_freq_band_data->sub_band_start; k++) {
1514
66.1M
      *p_loc_mps_qmf_output++ =
1515
66.1M
          ptr_sbr_dec->mps_qmf_buf_real[SBR_HF_ADJ_OFFSET + i][k];
1516
66.1M
      *p_loc_mps_qmf_output++ =
1517
66.1M
          ptr_sbr_dec->mps_qmf_buf_imag[SBR_HF_ADJ_OFFSET + i][k];
1518
66.1M
    }
1519
154M
    for (k = ptr_header_data->pstr_freq_band_data->sub_band_start; k < 64;
1520
150M
         k++) {
1521
150M
      *p_loc_mps_qmf_output++ =
1522
150M
          ptr_sbr_dec->mps_sbr_qmf_buf_real[SBR_HF_ADJ_OFFSET + i][k];
1523
150M
      *p_loc_mps_qmf_output++ =
1524
150M
          ptr_sbr_dec->mps_sbr_qmf_buf_imag[SBR_HF_ADJ_OFFSET + i][k];
1525
150M
    }
1526
3.38M
  }
1527
1528
915k
  for (i = 0; i < op_delay; i++) {
1529
822k
    memmove(ptr_sbr_dec->mps_qmf_buf_real[i],
1530
822k
            ptr_sbr_dec->mps_qmf_buf_real[no_bins + i], 64 * sizeof(FLOAT32));
1531
1532
822k
    memmove(ptr_sbr_dec->mps_qmf_buf_imag[i],
1533
822k
            ptr_sbr_dec->mps_qmf_buf_imag[no_bins + i], 64 * sizeof(FLOAT32));
1534
1535
822k
    memmove(ptr_sbr_dec->mps_sbr_qmf_buf_real[i],
1536
822k
            ptr_sbr_dec->mps_sbr_qmf_buf_real[no_bins + i],
1537
822k
            64 * sizeof(FLOAT32));
1538
1539
822k
    memmove(ptr_sbr_dec->mps_sbr_qmf_buf_imag[i],
1540
822k
            ptr_sbr_dec->mps_sbr_qmf_buf_imag[no_bins + i],
1541
822k
            64 * sizeof(FLOAT32));
1542
822k
  }
1543
1544
93.4k
  ptr_frame_data->reset_flag = 0;
1545
93.4k
  return err;
1546
93.4k
}