Coverage Report

Created: 2025-11-11 06:42

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libavc/encoder/svc/isvce_downscaler_private_defs.h
Line
Count
Source
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
45.7G
#define DOWNSCALER_Q 16
31
32
9.89G
#define FILTER_COEFF_Q 7
33
34
53.1G
#define NUM_SCALER_FILTER_TAPS 8
35
36
84.3G
#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
4.13G
{
92
4.13G
    UWORD32 au4_phase_binning_pos[NUM_SCALER_FILTER_PHASES + 1];
93
4.13G
    UWORD32 i;
94
95
4.13G
    ASSERT(NUM_SCALER_FILTER_PHASES == 8);
96
97
41.3G
    for(i = 0; i < NUM_SCALER_FILTER_PHASES + 1; i++)
98
37.2G
    {
99
37.2G
        au4_phase_binning_pos[i] = (i << DOWNSCALER_Q) / NUM_SCALER_FILTER_PHASES;
100
37.2G
    }
101
102
4.13G
    u4_center_pixel_pos = u4_center_pixel_pos % (1 << DOWNSCALER_Q);
103
104
5.68G
    for(i = 0; i < NUM_SCALER_FILTER_PHASES; i++)
105
5.68G
    {
106
5.68G
        if((u4_center_pixel_pos < au4_phase_binning_pos[i + 1]) &&
107
4.13G
           (u4_center_pixel_pos >= au4_phase_binning_pos[i]))
108
4.13G
        {
109
4.13G
            return i;
110
4.13G
        }
111
5.68G
    }
112
113
0
    ASSERT(0);
114
115
0
    return 0;
116
0
}
isvce_downscaler.c:get_filter_phase
Line
Count
Source
91
3.98G
{
92
3.98G
    UWORD32 au4_phase_binning_pos[NUM_SCALER_FILTER_PHASES + 1];
93
3.98G
    UWORD32 i;
94
95
3.98G
    ASSERT(NUM_SCALER_FILTER_PHASES == 8);
96
97
39.8G
    for(i = 0; i < NUM_SCALER_FILTER_PHASES + 1; i++)
98
35.9G
    {
99
35.9G
        au4_phase_binning_pos[i] = (i << DOWNSCALER_Q) / NUM_SCALER_FILTER_PHASES;
100
35.9G
    }
101
102
3.98G
    u4_center_pixel_pos = u4_center_pixel_pos % (1 << DOWNSCALER_Q);
103
104
5.43G
    for(i = 0; i < NUM_SCALER_FILTER_PHASES; i++)
105
5.43G
    {
106
5.43G
        if((u4_center_pixel_pos < au4_phase_binning_pos[i + 1]) &&
107
3.98G
           (u4_center_pixel_pos >= au4_phase_binning_pos[i]))
108
3.98G
        {
109
3.98G
            return i;
110
3.98G
        }
111
5.43G
    }
112
113
0
    ASSERT(0);
114
115
0
    return 0;
116
0
}
isvce_downscaler_sse42.c:get_filter_phase
Line
Count
Source
91
149M
{
92
149M
    UWORD32 au4_phase_binning_pos[NUM_SCALER_FILTER_PHASES + 1];
93
149M
    UWORD32 i;
94
95
149M
    ASSERT(NUM_SCALER_FILTER_PHASES == 8);
96
97
1.49G
    for(i = 0; i < NUM_SCALER_FILTER_PHASES + 1; i++)
98
1.34G
    {
99
1.34G
        au4_phase_binning_pos[i] = (i << DOWNSCALER_Q) / NUM_SCALER_FILTER_PHASES;
100
1.34G
    }
101
102
149M
    u4_center_pixel_pos = u4_center_pixel_pos % (1 << DOWNSCALER_Q);
103
104
248M
    for(i = 0; i < NUM_SCALER_FILTER_PHASES; i++)
105
248M
    {
106
248M
        if((u4_center_pixel_pos < au4_phase_binning_pos[i + 1]) &&
107
149M
           (u4_center_pixel_pos >= au4_phase_binning_pos[i]))
108
149M
        {
109
149M
            return i;
110
149M
        }
111
248M
    }
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