Coverage Report

Created: 2025-07-11 06:39

/src/libavc/encoder/svc/isvce_downscaler_private_defs.h
Line
Count
Source (jump to first uncovered line)
1
/******************************************************************************
2
 *
3
 * Copyright (C) 2022 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
#ifndef _ISVCE_DOWNSCALER_PRIVATE_DEFS_H_
22
#define _ISVCE_DOWNSCALER_PRIVATE_DEFS_H_
23
#include "ih264_typedefs.h"
24
#include "isvc_macros.h"
25
#include "ih264_debug.h"
26
#include "isvc_structs.h"
27
#include "isvce_downscaler.h"
28
29
/* Macros */
30
38.4G
#define DOWNSCALER_Q 16
31
32
8.27G
#define FILTER_COEFF_Q 7
33
34
44.4G
#define NUM_SCALER_FILTER_TAPS 8
35
36
70.8G
#define NUM_SCALER_FILTER_PHASES 8
37
38
/* Typedefs */
39
typedef WORD8 (*FILTER_COEFF_ARRAY)[NUM_SCALER_FILTER_TAPS * 2];
40
41
typedef void FT_DOWNSCALER(downscaler_ctxt_t *ps_scaler_state, buffer_container_t *ps_src,
42
                           buffer_container_t *ps_dst, FILTER_COEFF_ARRAY pai1_filters,
43
                           UWORD32 u4_blk_wd, UWORD32 u4_blk_ht, UWORD8 u1_is_chroma);
44
45
/* Structs */
46
typedef struct
47
{
48
    /**
49
     * pointer to scratch buf
50
     */
51
    void *pv_scratch_buf;
52
53
    /**
54
     * initial offset while calculating input pixel location
55
     */
56
    WORD32 i4_init_offset;
57
58
    /**
59
     * increment to the centre pixel in horizontal direction
60
     */
61
    UWORD32 u4_horz_increment;
62
63
    /**
64
     * increment to the centre pixel in vertical direction
65
     */
66
    UWORD32 u4_vert_increment;
67
68
    /**
69
     * pointer to the filter coefficients
70
     */
71
    FILTER_COEFF_ARRAY pai1_filters;
72
73
    /**
74
     * function pointer to the leaf level function for horizontal scaling
75
     */
76
    FT_DOWNSCALER *pf_downscaler;
77
78
    /**
79
     * width of the input (highest SVC layer)
80
     */
81
    UWORD32 u4_in_wd;
82
83
    /**
84
     * height of the input (highest SVC layer)
85
     */
86
    UWORD32 u4_in_ht;
87
88
} downscaler_state_t;
89
90
static FORCEINLINE UWORD32 get_filter_phase(UWORD32 u4_center_pixel_pos)
91
3.47G
{
92
3.47G
    UWORD32 au4_phase_binning_pos[NUM_SCALER_FILTER_PHASES + 1];
93
3.47G
    UWORD32 i;
94
95
3.47G
    ASSERT(NUM_SCALER_FILTER_PHASES == 8);
96
97
34.7G
    for(i = 0; i < NUM_SCALER_FILTER_PHASES + 1; i++)
98
31.2G
    {
99
31.2G
        au4_phase_binning_pos[i] = (i << DOWNSCALER_Q) / NUM_SCALER_FILTER_PHASES;
100
31.2G
    }
101
102
3.47G
    u4_center_pixel_pos = u4_center_pixel_pos % (1 << DOWNSCALER_Q);
103
104
4.86G
    for(i = 0; i < NUM_SCALER_FILTER_PHASES; i++)
105
4.86G
    {
106
4.86G
        if((u4_center_pixel_pos < au4_phase_binning_pos[i + 1]) &&
107
4.86G
           (u4_center_pixel_pos >= au4_phase_binning_pos[i]))
108
3.47G
        {
109
3.47G
            return i;
110
3.47G
        }
111
4.86G
    }
112
113
0
    ASSERT(0);
114
115
0
    return 0;
116
0
}
isvce_downscaler.c:get_filter_phase
Line
Count
Source
91
3.33G
{
92
3.33G
    UWORD32 au4_phase_binning_pos[NUM_SCALER_FILTER_PHASES + 1];
93
3.33G
    UWORD32 i;
94
95
3.33G
    ASSERT(NUM_SCALER_FILTER_PHASES == 8);
96
97
33.3G
    for(i = 0; i < NUM_SCALER_FILTER_PHASES + 1; i++)
98
30.0G
    {
99
30.0G
        au4_phase_binning_pos[i] = (i << DOWNSCALER_Q) / NUM_SCALER_FILTER_PHASES;
100
30.0G
    }
101
102
3.33G
    u4_center_pixel_pos = u4_center_pixel_pos % (1 << DOWNSCALER_Q);
103
104
4.63G
    for(i = 0; i < NUM_SCALER_FILTER_PHASES; i++)
105
4.63G
    {
106
4.63G
        if((u4_center_pixel_pos < au4_phase_binning_pos[i + 1]) &&
107
4.63G
           (u4_center_pixel_pos >= au4_phase_binning_pos[i]))
108
3.33G
        {
109
3.33G
            return i;
110
3.33G
        }
111
4.63G
    }
112
113
0
    ASSERT(0);
114
115
0
    return 0;
116
0
}
isvce_downscaler_sse42.c:get_filter_phase
Line
Count
Source
91
134M
{
92
134M
    UWORD32 au4_phase_binning_pos[NUM_SCALER_FILTER_PHASES + 1];
93
134M
    UWORD32 i;
94
95
134M
    ASSERT(NUM_SCALER_FILTER_PHASES == 8);
96
97
1.34G
    for(i = 0; i < NUM_SCALER_FILTER_PHASES + 1; i++)
98
1.21G
    {
99
1.21G
        au4_phase_binning_pos[i] = (i << DOWNSCALER_Q) / NUM_SCALER_FILTER_PHASES;
100
1.21G
    }
101
102
134M
    u4_center_pixel_pos = u4_center_pixel_pos % (1 << DOWNSCALER_Q);
103
104
232M
    for(i = 0; i < NUM_SCALER_FILTER_PHASES; i++)
105
232M
    {
106
232M
        if((u4_center_pixel_pos < au4_phase_binning_pos[i + 1]) &&
107
232M
           (u4_center_pixel_pos >= au4_phase_binning_pos[i]))
108
134M
        {
109
134M
            return i;
110
134M
        }
111
232M
    }
112
113
0
    ASSERT(0);
114
115
0
    return 0;
116
0
}
117
118
/* SSE42 Declarations */
119
extern FT_DOWNSCALER isvce_horizontal_downscale_and_transpose_sse42;
120
121
/* NEON Declarations */
122
extern FT_DOWNSCALER isvce_horizontal_downscale_and_transpose_neon;
123
124
#endif