Coverage Report

Created: 2025-11-10 06:22

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libxaac/encoder/ixheaace_sbr_misc.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 "ixheaac_type_def.h"
22
#include "ixheaace_sbr_misc.h"
23
24
19.5k
VOID ixheaace_shellsort_int(WORD32 *ptr_in, WORD32 n) {
25
19.5k
  WORD32 i, j, v;
26
19.5k
  WORD32 inc = 1;
27
28
42.8k
  do {
29
42.8k
    inc = 3 * inc + 1;
30
42.8k
  } while (inc <= n);
31
32
42.8k
  do {
33
42.8k
    inc = inc / 3;
34
35
317k
    for (i = inc + 1; i <= n; i++) {
36
274k
      v = ptr_in[i - 1];
37
274k
      j = i;
38
39
299k
      while (ptr_in[j - inc - 1] > v) {
40
25.4k
        ptr_in[j - 1] = ptr_in[j - inc - 1];
41
25.4k
        j -= inc;
42
43
25.4k
        if (j <= inc) {
44
961
          break;
45
961
        }
46
25.4k
      }
47
48
274k
      ptr_in[j - 1] = v;
49
274k
    }
50
42.8k
  } while (inc > 1);
51
19.5k
}
52
53
VOID ixheaace_add_vec_left(WORD32 *ptr_dst, WORD32 *ptr_length_dst, WORD32 *ptr_src,
54
30.5k
                           WORD32 length_src) {
55
30.5k
  WORD32 i;
56
57
83.2k
  for (i = length_src - 1; i >= 0; i--) {
58
52.7k
    ixheaace_add_left(ptr_dst, ptr_length_dst, ptr_src[i]);
59
52.7k
  }
60
30.5k
}
61
62
89.1k
VOID ixheaace_add_left(WORD32 *ptr_vector, WORD32 *ptr_length_vector, WORD32 value) {
63
89.1k
  WORD32 i;
64
65
382k
  for (i = *ptr_length_vector; i > 0; i--) {
66
293k
    ptr_vector[i] = ptr_vector[i - 1];
67
293k
  }
68
69
89.1k
  ptr_vector[0] = value;
70
71
89.1k
  (*ptr_length_vector)++;
72
89.1k
}
73
74
613k
VOID ixheaace_add_right(WORD32 *ptr_vector, WORD32 *ptr_length_vector, WORD32 value) {
75
613k
  ptr_vector[*ptr_length_vector] = value;
76
77
613k
  (*ptr_length_vector)++;
78
613k
}