Coverage Report

Created: 2025-12-14 07:13

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
18.7k
VOID ixheaace_shellsort_int(WORD32 *ptr_in, WORD32 n) {
25
18.7k
  WORD32 i, j, v;
26
18.7k
  WORD32 inc = 1;
27
28
40.9k
  do {
29
40.9k
    inc = 3 * inc + 1;
30
40.9k
  } while (inc <= n);
31
32
40.9k
  do {
33
40.9k
    inc = inc / 3;
34
35
304k
    for (i = inc + 1; i <= n; i++) {
36
263k
      v = ptr_in[i - 1];
37
263k
      j = i;
38
39
287k
      while (ptr_in[j - inc - 1] > v) {
40
24.6k
        ptr_in[j - 1] = ptr_in[j - inc - 1];
41
24.6k
        j -= inc;
42
43
24.6k
        if (j <= inc) {
44
965
          break;
45
965
        }
46
24.6k
      }
47
48
263k
      ptr_in[j - 1] = v;
49
263k
    }
50
40.9k
  } while (inc > 1);
51
18.7k
}
52
53
VOID ixheaace_add_vec_left(WORD32 *ptr_dst, WORD32 *ptr_length_dst, WORD32 *ptr_src,
54
29.3k
                           WORD32 length_src) {
55
29.3k
  WORD32 i;
56
57
79.3k
  for (i = length_src - 1; i >= 0; i--) {
58
49.9k
    ixheaace_add_left(ptr_dst, ptr_length_dst, ptr_src[i]);
59
49.9k
  }
60
29.3k
}
61
62
84.1k
VOID ixheaace_add_left(WORD32 *ptr_vector, WORD32 *ptr_length_vector, WORD32 value) {
63
84.1k
  WORD32 i;
64
65
360k
  for (i = *ptr_length_vector; i > 0; i--) {
66
276k
    ptr_vector[i] = ptr_vector[i - 1];
67
276k
  }
68
69
84.1k
  ptr_vector[0] = value;
70
71
84.1k
  (*ptr_length_vector)++;
72
84.1k
}
73
74
600k
VOID ixheaace_add_right(WORD32 *ptr_vector, WORD32 *ptr_length_vector, WORD32 value) {
75
600k
  ptr_vector[*ptr_length_vector] = value;
76
77
600k
  (*ptr_length_vector)++;
78
600k
}