Coverage Report

Created: 2026-03-21 07:02

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libxaac/decoder/ixheaacd_mps_res_channel_info.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_bitbuffer.h"
22
#include "ixheaacd_cnst.h"
23
#include "ixheaacd_mps_aac_struct.h"
24
#include "ixheaacd_mps_res_rom.h"
25
#include "ixheaac_basic_op.h"
26
#include "ixheaacd_mps_res.h"
27
28
const WORD16 *ixheaacd_res_get_sfb_offsets(
29
    ia_mps_dec_residual_ics_info_struct *p_ics_info,
30
1.35k
    ia_mps_dec_residual_aac_tables_struct *aac_tables_ptr) {
31
1.35k
  if (p_ics_info->window_sequence != EIGHT_SHORT_SEQUENCE) {
32
818
    return aac_tables_ptr->sfb_index_long;
33
818
  } else {
34
537
    return aac_tables_ptr->sfb_index_short;
35
537
  }
36
1.35k
}
37
38
const WORD8 *ixheaacd_res_get_sfb_width(ia_mps_dec_residual_ics_info_struct *p_ics_info,
39
1.09k
                                        ia_mps_dec_residual_aac_tables_struct *aac_tables_ptr) {
40
1.09k
  if (p_ics_info->window_sequence != EIGHT_SHORT_SEQUENCE) {
41
722
    return aac_tables_ptr->sfb_index_long_width;
42
722
  } else {
43
374
    return aac_tables_ptr->sfb_index_short_width;
44
374
  }
45
1.09k
}
46
47
WORD16 ixheaacd_res_ics_read(ia_bit_buf_struct *it_bif_buf,
48
                             ia_mps_dec_residual_ics_info_struct *p_ics_info,
49
1.19k
                             WORD8 tot_sf_bands_ls[2]) {
50
1.19k
  WORD i;
51
1.19k
  WORD mask;
52
1.19k
  WORD tmp = 0;
53
54
1.19k
  tmp = ixheaacd_read_bits_buf(it_bif_buf, 4);
55
1.19k
  p_ics_info->window_sequence = (WORD16)((tmp & 0x6) >> 1);
56
57
1.19k
  if (p_ics_info->window_sequence != EIGHT_SHORT_SEQUENCE) {
58
775
    p_ics_info->total_sf_bands = tot_sf_bands_ls[0];
59
60
775
    p_ics_info->window_groups = 1;
61
775
    p_ics_info->window_group_length[0] = 1;
62
63
775
    tmp = ixheaacd_read_bits_buf(it_bif_buf, 7);
64
775
    p_ics_info->max_sf_bands = (tmp & 0x7E) >> 1;
65
66
775
    if (tmp & 1) {
67
9
      return (WORD16)((WORD32)AAC_DEC_PREDICTION_NOT_SUPPORTED_IN_LC_AAC);
68
9
    }
69
775
  } else {
70
419
    WORD32 win_grp = 0, tmp2;
71
419
    p_ics_info->total_sf_bands = tot_sf_bands_ls[1];
72
73
419
    tmp = ixheaacd_read_bits_buf(it_bif_buf, 11);
74
419
    p_ics_info->max_sf_bands = (tmp & 0x780) >> 7;
75
76
419
    tmp2 = (tmp & 0x7F);
77
78
3.33k
    for (i = 0; i < 7; i++) {
79
2.91k
      mask = (1 << sub_d(6, i));
80
2.91k
      p_ics_info->window_group_length[i] = 1;
81
2.91k
      if (tmp2 & mask) {
82
2.03k
        p_ics_info->window_group_length[win_grp] =
83
2.03k
            add_d(p_ics_info->window_group_length[win_grp], 1);
84
2.03k
      } else {
85
878
        win_grp = add_d(win_grp, 1);
86
878
      }
87
2.91k
    }
88
89
419
    p_ics_info->window_group_length[7] = 1;
90
419
    p_ics_info->window_groups = add_d(win_grp, 1);
91
419
  }
92
93
1.18k
  if (p_ics_info->max_sf_bands > p_ics_info->total_sf_bands)
94
4
    return (WORD16)IA_XHEAAC_DEC_EXE_NONFATAL_EXCEEDS_SFB_TRANSMITTED;
95
96
1.18k
  return AAC_DEC_OK;
97
1.18k
}