Coverage Report

Created: 2025-12-10 06:52

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libxaac/encoder/ixheaace_interface.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
21
#include <string.h>
22
#include "ixheaac_type_def.h"
23
#include "ixheaac_constants.h"
24
#include "ixheaace_aac_constants.h"
25
26
#include "ixheaace_psy_const.h"
27
#include "ixheaace_tns.h"
28
#include "ixheaace_tns_params.h"
29
#include "ixheaace_rom.h"
30
#include "ixheaace_common_rom.h"
31
#include "ixheaace_bitbuffer.h"
32
#include "ixheaace_block_switch.h"
33
#include "ixheaace_psy_data.h"
34
#include "ixheaace_interface.h"
35
36
VOID ia_enhaacplus_enc_build_interface(
37
    FLOAT32 *ptr_grouped_mdct_spec, ixheaace_sfb_energy *pstr_grouped_sfb_thres,
38
    ixheaace_sfb_energy *pstr_grouped_sfb_nrg, ixheaace_sfb_energy *pstr_grouped_sfb_spreaded_nrg,
39
    const ixheaace_sfb_energy_sum sfb_nrg_sum_lr, const ixheaace_sfb_energy_sum sfb_nrg_sum_ms,
40
    const WORD32 win_seq, const WORD32 win_shape, const WORD32 grouped_sfb_cnt,
41
    const WORD32 *ptr_grouped_sfb_offset, const WORD32 max_sfb_per_grp,
42
    const FLOAT32 *ptr_grouped_sfb_min_snr, const WORD32 total_groups_cnt,
43
357k
    const WORD32 *ptr_group_len, ixheaace_psy_out_channel *pstr_psy_out_ch) {
44
357k
  WORD32 j;
45
357k
  WORD32 grp;
46
357k
  WORD32 mask;
47
48
  /* Copy values to psy_out */
49
357k
  pstr_psy_out_ch->max_sfb_per_grp = max_sfb_per_grp;
50
357k
  pstr_psy_out_ch->sfb_count = grouped_sfb_cnt;
51
357k
  pstr_psy_out_ch->sfb_per_group = grouped_sfb_cnt / total_groups_cnt;
52
357k
  pstr_psy_out_ch->window_sequence = win_seq;
53
357k
  pstr_psy_out_ch->window_shape = win_shape;
54
357k
  pstr_psy_out_ch->ptr_spec_coeffs = ptr_grouped_mdct_spec;
55
56
357k
  pstr_psy_out_ch->ptr_sfb_energy = pstr_grouped_sfb_nrg->long_nrg;
57
357k
  pstr_psy_out_ch->ptr_sfb_thr = pstr_grouped_sfb_thres->long_nrg;
58
357k
  pstr_psy_out_ch->ptr_sfb_spread_energy = pstr_grouped_sfb_spreaded_nrg->long_nrg;
59
60
357k
  memcpy(&pstr_psy_out_ch->sfb_offsets[0], &ptr_grouped_sfb_offset[0],
61
357k
         sizeof(pstr_psy_out_ch->sfb_offsets[0]) * (grouped_sfb_cnt + 1));
62
357k
  memcpy(&pstr_psy_out_ch->sfb_min_snr[0], &ptr_grouped_sfb_min_snr[0],
63
357k
         sizeof(pstr_psy_out_ch->sfb_min_snr[0]) * (grouped_sfb_cnt));
64
65
  /* Generate grouping mask */
66
357k
  mask = 0;
67
68
902k
  for (grp = 0; grp < total_groups_cnt; grp++) {
69
545k
    mask <<= 1;
70
71
819k
    for (j = 1; j < ptr_group_len[grp]; j++) {
72
274k
      mask <<= 1;
73
274k
      mask |= 1;
74
274k
    }
75
545k
  }
76
  /* copy energy sums to psy_out for stereo preprocessing */
77
357k
  if (win_seq != SHORT_WINDOW) {
78
291k
    pstr_psy_out_ch->sfb_sum_lr_energy = sfb_nrg_sum_lr.long_nrg;
79
291k
    pstr_psy_out_ch->sfb_sum_ms_energy = sfb_nrg_sum_ms.long_nrg;
80
291k
  } else {
81
66.0k
    int i;
82
83
66.0k
    pstr_psy_out_ch->sfb_sum_ms_energy = 0;
84
66.0k
    pstr_psy_out_ch->sfb_sum_lr_energy = 0;
85
86
594k
    for (i = 0; i < TRANS_FAC; i++) {
87
528k
      pstr_psy_out_ch->sfb_sum_lr_energy += sfb_nrg_sum_lr.short_nrg[i];
88
528k
      pstr_psy_out_ch->sfb_sum_ms_energy += sfb_nrg_sum_ms.short_nrg[i];
89
528k
    }
90
66.0k
  }
91
92
357k
  pstr_psy_out_ch->grouping_mask = mask;
93
357k
}