Coverage Report

Created: 2025-11-09 07:01

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libxaac/decoder/ixheaacd_mps_apply_common.c
Line
Count
Source
1
/******************************************************************************
2
 *
3
 * Copyright (C) 2023 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 "ixheaac_type_def.h"
21
#include "ixheaacd_mps_struct_def.h"
22
#include "ixheaacd_mps_res_rom.h"
23
#include "ixheaacd_mps_aac_struct.h"
24
#include "ixheaac_constants.h"
25
#include "ixheaacd_bitbuffer.h"
26
#include "ixheaacd_common_rom.h"
27
#include "ixheaacd_sbrdecsettings.h"
28
#include "ixheaacd_sbr_scale.h"
29
#include "ixheaacd_env_extr_part.h"
30
#include "ixheaacd_sbr_rom.h"
31
#include "ixheaacd_hybrid.h"
32
#include "ixheaacd_ps_dec.h"
33
#include "ixheaacd_mps_polyphase.h"
34
#include "ixheaacd_config.h"
35
#include "ixheaacd_qmf_dec.h"
36
#include "ixheaacd_mps_dec.h"
37
#include "ixheaacd_mps_macro_def.h"
38
39
VOID ixheaacd_dec_interp_umx(WORD32 m[MAX_PARAMETER_SETS][MAX_PARAMETER_BANDS], WORD32 *ptr_r,
40
392k
                             WORD32 *ptr_m_prev, ia_heaac_mps_state_struct *pstr_mps_state) {
41
392k
  WORD32 ts, ps = 0, pb;
42
392k
  WORD32 *r_out;
43
392k
  const WORD32 *reciprocal_tab = pstr_mps_state->ia_mps_dec_mps_table.m1_m2_table_ptr->reciprocal;
44
45
392k
  WORD32 num_parameter_bands = pstr_mps_state->num_parameter_bands;
46
392k
  WORD32 num_parameter_sets = pstr_mps_state->num_parameter_sets;
47
48
392k
  WORD32 prev_slot = -1;
49
392k
  WORD32 *prm_slot = pstr_mps_state->aux_struct->param_slot;
50
392k
  WORD32 curr_slot = *prm_slot;
51
52
392k
  WORD32 temp = reciprocal_tab[curr_slot];
53
392k
  r_out = ptr_r;
54
55
8.28M
  for (ts = prev_slot + 1; ts <= curr_slot; ts++) {
56
151M
    for (pb = 0; pb < num_parameter_bands; pb++) {
57
143M
      WORD32 alpha = temp * (ts + 1);
58
143M
      WORD32 one_minus_alpha;
59
143M
      WORD64 result;
60
61
143M
      one_minus_alpha = (ONE_IN_Q28 - alpha);
62
63
143M
      result = ((WORD64)(*ptr_m_prev) * (WORD64)one_minus_alpha);
64
143M
      result += ((WORD64)(m[ps][pb]) * (WORD64)alpha);
65
66
143M
      *r_out++ = (WORD32)((WORD64)result >> 28);
67
143M
      ptr_m_prev++;
68
143M
    }
69
7.89M
    ptr_m_prev -= num_parameter_bands;
70
7.89M
  }
71
72
729k
  for (ps = 1; ps < num_parameter_sets; ps++) {
73
337k
    WORD32 prev_slot = prm_slot[ps - 1];
74
337k
    WORD32 curr_slot = prm_slot[ps];
75
76
337k
    temp = reciprocal_tab[curr_slot - prev_slot - 1];
77
78
3.62M
    for (ts = (prev_slot) + 1; ts <= (curr_slot); ts++) {
79
63.0M
      for (pb = 0; pb < num_parameter_bands; pb++) {
80
59.8M
        WORD32 alpha = (ts - prev_slot) * temp;
81
59.8M
        WORD64 result;
82
59.8M
        WORD32 one_minus_alpha;
83
59.8M
        one_minus_alpha = (ONE_IN_Q28 - alpha);
84
85
59.8M
        result = ((WORD64)(m[ps - 1][pb]) * (WORD64)one_minus_alpha);
86
59.8M
        result += ((WORD64)(m[ps][pb]) * (WORD64)alpha);
87
88
59.8M
        *r_out++ = (WORD32)((WORD64)result >> 28);
89
59.8M
      }
90
3.29M
    }
91
337k
  }
92
392k
  return;
93
392k
}
94
95
392k
VOID ixheaacd_apply_abs_kernels(WORD32 *ptr_r_in, WORD32 *ptr_r_out, SIZE_T *ptr_params) {
96
392k
  WORD32 ts, qb;
97
392k
  SIZE_T *idx_ptr = (SIZE_T *)ptr_params[0];
98
392k
  WORD32 time_slots = (WORD32)ptr_params[1];
99
392k
  WORD32 num_parameter_bands = (WORD32)ptr_params[2];
100
392k
  WORD32 hybrid_bands = (WORD32)ptr_params[3];
101
102
11.5M
  for (ts = 0; ts < time_slots; ts++) {
103
11.1M
    SIZE_T *idx = idx_ptr;
104
667M
    for (qb = 0; qb < hybrid_bands; qb++) {
105
656M
      WORD32 idx_v = (WORD32)(*idx);
106
656M
      *ptr_r_out++ = *(ptr_r_in + idx_v);
107
656M
      idx++;
108
656M
    }
109
11.1M
    ptr_r_in += num_parameter_bands;
110
11.1M
  }
111
392k
  return;
112
392k
}