Coverage Report

Created: 2026-01-09 06:51

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.3k
VOID ixheaace_shellsort_int(WORD32 *ptr_in, WORD32 n) {
25
18.3k
  WORD32 i, j, v;
26
18.3k
  WORD32 inc = 1;
27
28
40.1k
  do {
29
40.1k
    inc = 3 * inc + 1;
30
40.1k
  } while (inc <= n);
31
32
40.1k
  do {
33
40.1k
    inc = inc / 3;
34
35
298k
    for (i = inc + 1; i <= n; i++) {
36
258k
      v = ptr_in[i - 1];
37
258k
      j = i;
38
39
282k
      while (ptr_in[j - inc - 1] > v) {
40
24.4k
        ptr_in[j - 1] = ptr_in[j - inc - 1];
41
24.4k
        j -= inc;
42
43
24.4k
        if (j <= inc) {
44
938
          break;
45
938
        }
46
24.4k
      }
47
48
258k
      ptr_in[j - 1] = v;
49
258k
    }
50
40.1k
  } while (inc > 1);
51
18.3k
}
52
53
VOID ixheaace_add_vec_left(WORD32 *ptr_dst, WORD32 *ptr_length_dst, WORD32 *ptr_src,
54
27.9k
                           WORD32 length_src) {
55
27.9k
  WORD32 i;
56
57
74.5k
  for (i = length_src - 1; i >= 0; i--) {
58
46.5k
    ixheaace_add_left(ptr_dst, ptr_length_dst, ptr_src[i]);
59
46.5k
  }
60
27.9k
}
61
62
79.8k
VOID ixheaace_add_left(WORD32 *ptr_vector, WORD32 *ptr_length_vector, WORD32 value) {
63
79.8k
  WORD32 i;
64
65
340k
  for (i = *ptr_length_vector; i > 0; i--) {
66
261k
    ptr_vector[i] = ptr_vector[i - 1];
67
261k
  }
68
69
79.8k
  ptr_vector[0] = value;
70
71
79.8k
  (*ptr_length_vector)++;
72
79.8k
}
73
74
580k
VOID ixheaace_add_right(WORD32 *ptr_vector, WORD32 *ptr_length_vector, WORD32 value) {
75
580k
  ptr_vector[*ptr_length_vector] = value;
76
77
580k
  (*ptr_length_vector)++;
78
580k
}