Coverage Report

Created: 2025-08-03 06:57

/src/libxaac/encoder/ixheaace_psy_utils.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
#include "ixheaace_psy_utils.h"
26
#include "ixheaac_basic_ops32.h"
27
#include "ixheaac_basic_ops16.h"
28
#include "ixheaac_basic_ops40.h"
29
#include "ixheaac_basic_ops.h"
30
31
VOID ia_enhaacplus_enc_init_pre_echo_control(FLOAT32 *ptr_pb_threshold_nm1, WORD32 num_pb,
32
9.34k
                                             FLOAT32 *ptr_pb_threshold_quiet) {
33
9.34k
  memcpy(ptr_pb_threshold_nm1, ptr_pb_threshold_quiet, num_pb * sizeof(*ptr_pb_threshold_nm1));
34
9.34k
}
35
36
VOID ia_enhaacplus_enc_pre_echo_control(FLOAT32 *ptr_threshold_nm1, WORD32 num_sfb,
37
908k
                                        FLOAT32 min_rem_thr_factor, FLOAT32 *ptr_threshold) {
38
908k
  WORD32 i;
39
908k
  FLOAT32 tmp_threshold1, tmp_threshold2;
40
908k
  FLOAT32 *ptr_tmp_threshold = &ptr_threshold[0];
41
908k
  FLOAT32 *ptr_tmp_threshold_nm1 = &ptr_threshold_nm1[0];
42
43
22.0M
  for (i = num_sfb - 1; i >= 0; i--) {
44
21.1M
    FLOAT32 tmp_var;
45
46
21.1M
    tmp_var = *ptr_tmp_threshold;
47
48
21.1M
    tmp_threshold1 = *ptr_tmp_threshold_nm1 * 2.0f;
49
50
21.1M
    tmp_threshold2 = (min_rem_thr_factor * tmp_var);
51
52
    /* copy thresholds to internal memory */
53
21.1M
    *ptr_tmp_threshold_nm1++ = tmp_var;
54
55
21.1M
    tmp_var = MIN(tmp_var, tmp_threshold1);
56
57
21.1M
    tmp_var = MAX(tmp_var, tmp_threshold2);
58
21.1M
    *ptr_tmp_threshold++ = tmp_var;
59
21.1M
  }
60
908k
}