Coverage Report

Created: 2025-08-26 06:53

/src/libxaac/decoder/ixheaacd_thumb_ps_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_arr.h"
29
#include "ixheaac_basic_ops.h"
30
31
#include "ixheaacd_defines.h"
32
#include "ixheaac_basic_op.h"
33
#include "ixheaacd_intrinsics.h"
34
#include "ixheaacd_common_rom.h"
35
#include "ixheaacd_basic_funcs.h"
36
#include "ixheaacd_bitbuffer.h"
37
#include "ixheaacd_sbrdecsettings.h"
38
#include "ixheaacd_defines.h"
39
#include "ixheaacd_pns.h"
40
#include "ixheaacd_aac_rom.h"
41
#include "ixheaacd_pulsedata.h"
42
43
#include "ixheaacd_drc_data_struct.h"
44
#include "ixheaacd_lt_predict.h"
45
#include "ixheaacd_cnst.h"
46
#include "ixheaacd_ec_defines.h"
47
#include "ixheaacd_ec_struct_def.h"
48
#include "ixheaacd_channelinfo.h"
49
#include "ixheaacd_drc_dec.h"
50
#include "ixheaacd_sbrdecoder.h"
51
#include "ixheaacd_sbr_scale.h"
52
#include "ixheaacd_lpp_tran.h"
53
#include "ixheaacd_env_extr_part.h"
54
#include "ixheaacd_sbr_rom.h"
55
#include "ixheaacd_hybrid.h"
56
#include "ixheaacd_ps_dec.h"
57
#include "ixheaacd_env_extr.h"
58
59
#include "ixheaacd_aac_rom.h"
60
#include "ixheaacd_ps_dec.h"
61
62
#include "ixheaacd_qmf_dec.h"
63
#include "ixheaacd_env_calc.h"
64
#include "ixheaac_sbr_const.h"
65
#include "ixheaacd_pvc_dec.h"
66
#include "ixheaacd_sbr_dec.h"
67
#include "ixheaacd_function_selector.h"
68
69
VOID ixheaacd_apply_ps(ia_ps_dec_struct *ptr_ps_dec, WORD32 **p_buf_left_real,
70
                       WORD32 **p_buf_left_imag, WORD32 *p_buf_right_real,
71
                       WORD32 *p_buf_right_imag,
72
                       ia_sbr_scale_fact_struct *sbr_scale_factor, WORD16 slot,
73
0
                       ia_sbr_tables_struct *sbr_tables_ptr, WORD no_col) {
74
75
0
  WORD16 shiftdelay;
76
77
0
  if (no_col != 30) {
78
0
    shiftdelay =
79
0
        (WORD16)((slot < (32 - MAX_OV_COLS)) ? 0 : (sbr_scale_factor->lb_scale -
80
0
            sbr_scale_factor->ps_scale));
81
0
  } else {
82
0
  shiftdelay =
83
0
      (WORD16)((slot < (no_col - MAX_OV_COLS)) ? 0 : (sbr_scale_factor->lb_scale -
84
0
          sbr_scale_factor->ps_scale));
85
0
  }
86
87
0
  ixheaacd_hybrid_analysis(p_buf_left_real[HYBRID_FILTER_DELAY],
88
0
                           ptr_ps_dec->ptr_hyb_left_re,
89
0
                           ptr_ps_dec->ptr_hyb_left_im, &ptr_ps_dec->str_hybrid,
90
0
                           shiftdelay, sbr_tables_ptr);
91
92
0
  (*ixheaacd_decorrelation)(ptr_ps_dec, p_buf_left_real[0], p_buf_left_imag[0],
93
0
                            p_buf_right_real, p_buf_right_imag,
94
0
                            sbr_tables_ptr->ps_tables_ptr);
95
96
0
  (*ixheaacd_apply_rot)(ptr_ps_dec, p_buf_left_real[0], p_buf_left_imag[0],
97
0
                        p_buf_right_real, p_buf_right_imag, sbr_tables_ptr,
98
0
                        ptr_ps_dec->str_hybrid.ptr_resol);
99
0
}
100
101
0
VOID ixheaacd_scale_ps_states(ia_ps_dec_struct *ptr_ps_dec, WORD16 scale) {
102
0
  WORD i, m;
103
0
  WORD32 delay;
104
105
0
  if (scale > 0) {
106
0
    WORD16 scale1 = scale;
107
0
    if (scale > 15) scale1 = 15;
108
109
0
    for (m = 0; m < 2; m++)
110
0
      ixheaacd_scale_short_vec_left(
111
0
          (WORD16 *)&ptr_ps_dec->delay_buf_qmf_ap_re_im[m][3 * 2],
112
0
          2 * NUM_OF_QUAD_MIRROR_FILTER_ALL_PASS_CHNLS, scale1);
113
114
0
    delay = 2 * HIGH_DEL * SMALL_DEL_STRT +
115
0
            2 * SMALL_DEL *
116
0
                (NUM_OF_QUAD_MIRROR_FILTER_ICC_CHNLS -
117
0
                 (NUM_OF_QUAD_MIRROR_FILTER_ALL_PASS_CHNLS + SMALL_DEL_STRT));
118
0
    ixheaacd_scale_short_vec_left((WORD16 *)ptr_ps_dec->delay_buf_qmf_ld_re_im,
119
0
                                  delay, scale1);
120
121
0
    delay = 2 * 16 * DEL_ALL_PASS + 2 * NUM_SER_AP_LINKS * 5 * 16;
122
0
    ixheaacd_scale_short_vec_left((WORD16 *)ptr_ps_dec->delay_buf_qmf_sub_re_im,
123
0
                                  delay, scale1);
124
125
0
    for (i = 0; i < NUM_SER_AP_LINKS; i++) {
126
0
      for (m = 0; m < ptr_ps_dec->delay_sample_ser[i]; m++) {
127
0
        ixheaacd_scale_short_vec_left(
128
0
            (WORD16 *)&ptr_ps_dec->delay_buf_qmf_ser_re_im[m][i][2 * 3],
129
0
            2 * NUM_OF_QUAD_MIRROR_FILTER_ALL_PASS_CHNLS, scale1);
130
0
      }
131
0
    }
132
133
0
    ixheaacd_scale_int_vec_left(
134
0
        ptr_ps_dec->str_hybrid.ptr_qmf_buf_re[0],
135
0
        2 * NO_QMF_CHANNELS_IN_HYBRID * ptr_ps_dec->str_hybrid.ptr_qmf_buf,
136
0
        scale);
137
138
0
    scale = (scale + scale);
139
140
0
    ixheaacd_scale_int_vec_left(ptr_ps_dec->peak_decay_diff, 3 * NUM_OF_BINS,
141
0
                                scale);
142
143
0
  } else {
144
0
    if (scale != 0) {
145
0
      scale = -scale;
146
0
      for (m = 0; m < 2; m++)
147
0
        ixheaacd_scale_short_vec_right(
148
0
            (WORD16 *)&ptr_ps_dec->delay_buf_qmf_ap_re_im[m][3 * 2],
149
0
            2 * NUM_OF_QUAD_MIRROR_FILTER_ALL_PASS_CHNLS, scale);
150
151
0
      delay = 2 * HIGH_DEL * SMALL_DEL_STRT +
152
0
              2 * SMALL_DEL *
153
0
                  (NUM_OF_QUAD_MIRROR_FILTER_ICC_CHNLS -
154
0
                   (NUM_OF_QUAD_MIRROR_FILTER_ALL_PASS_CHNLS + SMALL_DEL_STRT));
155
0
      ixheaacd_scale_short_vec_right(
156
0
          (WORD16 *)ptr_ps_dec->delay_buf_qmf_ld_re_im, delay, scale);
157
158
0
      delay = 2 * 16 * DEL_ALL_PASS + 2 * NUM_SER_AP_LINKS * 5 * 16;
159
0
      ixheaacd_scale_short_vec_right(
160
0
          (WORD16 *)ptr_ps_dec->delay_buf_qmf_sub_re_im, delay, scale);
161
162
0
      for (i = 0; i < NUM_SER_AP_LINKS; i++) {
163
0
        for (m = 0; m < ptr_ps_dec->delay_sample_ser[i]; m++) {
164
0
          ixheaacd_scale_short_vec_right(
165
0
              (WORD16 *)&ptr_ps_dec->delay_buf_qmf_ser_re_im[m][i][3 * 2],
166
0
              2 * NUM_OF_QUAD_MIRROR_FILTER_ALL_PASS_CHNLS, scale);
167
0
        }
168
0
      }
169
170
0
      ixheaacd_scale_int_vec_right(
171
0
          ptr_ps_dec->str_hybrid.ptr_qmf_buf_re[0],
172
0
          2 * NO_QMF_CHANNELS_IN_HYBRID * ptr_ps_dec->str_hybrid.ptr_qmf_buf,
173
0
          scale);
174
175
0
      scale = (scale + scale);
176
177
0
      ixheaacd_scale_int_vec_right(ptr_ps_dec->peak_decay_diff, 3 * NUM_OF_BINS,
178
0
                                   scale);
179
0
    }
180
0
  }
181
0
}