Coverage Report

Created: 2026-02-26 06:35

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
265k
                             WORD32 *ptr_m_prev, ia_heaac_mps_state_struct *pstr_mps_state) {
41
265k
  WORD32 ts, ps = 0, pb;
42
265k
  WORD32 *r_out;
43
265k
  const WORD32 *reciprocal_tab = pstr_mps_state->ia_mps_dec_mps_table.m1_m2_table_ptr->reciprocal;
44
45
265k
  WORD32 num_parameter_bands = pstr_mps_state->num_parameter_bands;
46
265k
  WORD32 num_parameter_sets = pstr_mps_state->num_parameter_sets;
47
48
265k
  WORD32 prev_slot = -1;
49
265k
  WORD32 *prm_slot = pstr_mps_state->aux_struct->param_slot;
50
265k
  WORD32 curr_slot = *prm_slot;
51
52
265k
  WORD32 temp = reciprocal_tab[curr_slot];
53
265k
  r_out = ptr_r;
54
55
5.39M
  for (ts = prev_slot + 1; ts <= curr_slot; ts++) {
56
98.4M
    for (pb = 0; pb < num_parameter_bands; pb++) {
57
93.2M
      WORD32 alpha = temp * (ts + 1);
58
93.2M
      WORD32 one_minus_alpha;
59
93.2M
      WORD64 result;
60
61
93.2M
      one_minus_alpha = (ONE_IN_Q28 - alpha);
62
63
93.2M
      result = ((WORD64)(*ptr_m_prev) * (WORD64)one_minus_alpha);
64
93.2M
      result += ((WORD64)(m[ps][pb]) * (WORD64)alpha);
65
66
93.2M
      *r_out++ = (WORD32)((WORD64)result >> 28);
67
93.2M
      ptr_m_prev++;
68
93.2M
    }
69
5.12M
    ptr_m_prev -= num_parameter_bands;
70
5.12M
  }
71
72
496k
  for (ps = 1; ps < num_parameter_sets; ps++) {
73
230k
    WORD32 prev_slot = prm_slot[ps - 1];
74
230k
    WORD32 curr_slot = prm_slot[ps];
75
76
230k
    temp = reciprocal_tab[curr_slot - prev_slot - 1];
77
78
2.43M
    for (ts = (prev_slot) + 1; ts <= (curr_slot); ts++) {
79
42.0M
      for (pb = 0; pb < num_parameter_bands; pb++) {
80
39.8M
        WORD32 alpha = (ts - prev_slot) * temp;
81
39.8M
        WORD64 result;
82
39.8M
        WORD32 one_minus_alpha;
83
39.8M
        one_minus_alpha = (ONE_IN_Q28 - alpha);
84
85
39.8M
        result = ((WORD64)(m[ps - 1][pb]) * (WORD64)one_minus_alpha);
86
39.8M
        result += ((WORD64)(m[ps][pb]) * (WORD64)alpha);
87
88
39.8M
        *r_out++ = (WORD32)((WORD64)result >> 28);
89
39.8M
      }
90
2.20M
    }
91
230k
  }
92
265k
  return;
93
265k
}
94
95
265k
VOID ixheaacd_apply_abs_kernels(WORD32 *ptr_r_in, WORD32 *ptr_r_out, SIZE_T *ptr_params) {
96
265k
  WORD32 ts, qb;
97
265k
  SIZE_T *idx_ptr = (SIZE_T *)ptr_params[0];
98
265k
  WORD32 time_slots = (WORD32)ptr_params[1];
99
265k
  WORD32 num_parameter_bands = (WORD32)ptr_params[2];
100
265k
  WORD32 hybrid_bands = (WORD32)ptr_params[3];
101
102
7.57M
  for (ts = 0; ts < time_slots; ts++) {
103
7.31M
    SIZE_T *idx = idx_ptr;
104
430M
    for (qb = 0; qb < hybrid_bands; qb++) {
105
422M
      WORD32 idx_v = (WORD32)(*idx);
106
422M
      *ptr_r_out++ = *(ptr_r_in + idx_v);
107
422M
      idx++;
108
422M
    }
109
7.31M
    ptr_r_in += num_parameter_bands;
110
7.31M
  }
111
265k
  return;
112
265k
}