Coverage Report

Created: 2025-08-29 06:15

/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
23.2k
VOID ixheaace_shellsort_int(WORD32 *ptr_in, WORD32 n) {
25
23.2k
  WORD32 i, j, v;
26
23.2k
  WORD32 inc = 1;
27
28
50.7k
  do {
29
50.7k
    inc = 3 * inc + 1;
30
50.7k
  } while (inc <= n);
31
32
50.7k
  do {
33
50.7k
    inc = inc / 3;
34
35
374k
    for (i = inc + 1; i <= n; i++) {
36
324k
      v = ptr_in[i - 1];
37
324k
      j = i;
38
39
354k
      while (ptr_in[j - inc - 1] > v) {
40
31.1k
        ptr_in[j - 1] = ptr_in[j - inc - 1];
41
31.1k
        j -= inc;
42
43
31.1k
        if (j <= inc) {
44
1.26k
          break;
45
1.26k
        }
46
31.1k
      }
47
48
324k
      ptr_in[j - 1] = v;
49
324k
    }
50
50.7k
  } while (inc > 1);
51
23.2k
}
52
53
VOID ixheaace_add_vec_left(WORD32 *ptr_dst, WORD32 *ptr_length_dst, WORD32 *ptr_src,
54
35.6k
                           WORD32 length_src) {
55
35.6k
  WORD32 i;
56
57
98.0k
  for (i = length_src - 1; i >= 0; i--) {
58
62.3k
    ixheaace_add_left(ptr_dst, ptr_length_dst, ptr_src[i]);
59
62.3k
  }
60
35.6k
}
61
62
108k
VOID ixheaace_add_left(WORD32 *ptr_vector, WORD32 *ptr_length_vector, WORD32 value) {
63
108k
  WORD32 i;
64
65
466k
  for (i = *ptr_length_vector; i > 0; i--) {
66
357k
    ptr_vector[i] = ptr_vector[i - 1];
67
357k
  }
68
69
108k
  ptr_vector[0] = value;
70
71
108k
  (*ptr_length_vector)++;
72
108k
}
73
74
734k
VOID ixheaace_add_right(WORD32 *ptr_vector, WORD32 *ptr_length_vector, WORD32 value) {
75
734k
  ptr_vector[*ptr_length_vector] = value;
76
77
734k
  (*ptr_length_vector)++;
78
734k
}