Coverage Report

Created: 2026-06-13 06:29

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libhevc/encoder/mem_req_and_acq.h
Line
Count
Source
1
/******************************************************************************
2
 *
3
 * Copyright (C) 2018 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
 * @file mem_req_and_acq.h
22
 * @brief Interface for mem request, acquiring and freeing
23
 * @author K. J. Nitthilan
24
 * @version 1.0
25
 * @date 2009-04-21
26
 */
27
#ifndef _MEM_REQ_AND_ACQ_H_
28
#define _MEM_REQ_AND_ACQ_H_
29
30
typedef enum
31
{
32
    ALIGN_BYTE = 1,
33
    ALIGN_WORD16 = 2,
34
    ALIGN_WORD32 = 4,
35
    ALIGN_WORD64 = 8,
36
    ALIGN_128_BYTE = 128
37
} ITT_MEM_ALIGNMENT_TYPE_E;
38
39
typedef enum
40
{
41
    SCRATCH = 0,
42
    PERSISTENT = 1,
43
    WRITEONCE = 2
44
} ITT_MEM_USAGE_TYPE_E;
45
46
typedef enum
47
{
48
    L1D = 0,
49
    SL2 = 1,
50
    DDR = 3
51
} ITT_MEM_REGION_E;
52
53
typedef enum
54
{
55
    GET_NUM_MEMTAB = 0,
56
    FILL_MEMTAB = 1,
57
    USE_BASE = 2,
58
    FILL_BASE = 3
59
} ITT_FUNC_TYPE_E;
60
61
/*NOTE : This should be an exact replica of IALG_MemRec, any change in IALG_MemRec
62
         must be replected here*/
63
typedef struct
64
{
65
    UWORD32 u4_size; /* Size in bytes */
66
    WORD32 i4_alignment; /* Alignment in bytes */
67
    ITT_MEM_REGION_E
68
    e_mem_region; /* decides which memory region to be placed */
69
    ITT_MEM_USAGE_TYPE_E e_usage; /* memory is scratch or persistent */
70
    void *pv_base; /* Base pointer for allocated memory */
71
} itt_memtab_t;
72
73
static __inline void fill_memtab(
74
    itt_memtab_t *ps_mem_tab,
75
    WORD32 u4_size,
76
    WORD32 i4_alignment,
77
    ITT_MEM_USAGE_TYPE_E e_usage,
78
    ITT_MEM_REGION_E e_mem_region)
79
13.9k
{
80
    /* Make the size next multiple of alignment */
81
13.9k
    WORD32 i4_aligned_size = (((u4_size) + (i4_alignment - 1)) & (~(i4_alignment - 1)));
82
83
    /* Fill the memtab */
84
13.9k
    ps_mem_tab->u4_size = i4_aligned_size;
85
13.9k
    ps_mem_tab->i4_alignment = i4_alignment;
86
13.9k
    ps_mem_tab->e_usage = e_usage;
87
13.9k
    ps_mem_tab->e_mem_region = e_mem_region;
88
13.9k
}
Unexecuted instantiation: ihevce_rc_interface.c:fill_memtab
rate_control_api.c:fill_memtab
Line
Count
Source
79
633
{
80
    /* Make the size next multiple of alignment */
81
633
    WORD32 i4_aligned_size = (((u4_size) + (i4_alignment - 1)) & (~(i4_alignment - 1)));
82
83
    /* Fill the memtab */
84
633
    ps_mem_tab->u4_size = i4_aligned_size;
85
633
    ps_mem_tab->i4_alignment = i4_alignment;
86
633
    ps_mem_tab->e_usage = e_usage;
87
633
    ps_mem_tab->e_mem_region = e_mem_region;
88
633
}
rc_rd_model_fix.c:fill_memtab
Line
Count
Source
79
5.69k
{
80
    /* Make the size next multiple of alignment */
81
5.69k
    WORD32 i4_aligned_size = (((u4_size) + (i4_alignment - 1)) & (~(i4_alignment - 1)));
82
83
    /* Fill the memtab */
84
5.69k
    ps_mem_tab->u4_size = i4_aligned_size;
85
5.69k
    ps_mem_tab->i4_alignment = i4_alignment;
86
5.69k
    ps_mem_tab->e_usage = e_usage;
87
5.69k
    ps_mem_tab->e_mem_region = e_mem_region;
88
5.69k
}
rc_sad_acc.c:fill_memtab
Line
Count
Source
79
633
{
80
    /* Make the size next multiple of alignment */
81
633
    WORD32 i4_aligned_size = (((u4_size) + (i4_alignment - 1)) & (~(i4_alignment - 1)));
82
83
    /* Fill the memtab */
84
633
    ps_mem_tab->u4_size = i4_aligned_size;
85
633
    ps_mem_tab->i4_alignment = i4_alignment;
86
633
    ps_mem_tab->e_usage = e_usage;
87
633
    ps_mem_tab->e_mem_region = e_mem_region;
88
633
}
vbr_storage_vbv.c:fill_memtab
Line
Count
Source
79
633
{
80
    /* Make the size next multiple of alignment */
81
633
    WORD32 i4_aligned_size = (((u4_size) + (i4_alignment - 1)) & (~(i4_alignment - 1)));
82
83
    /* Fill the memtab */
84
633
    ps_mem_tab->u4_size = i4_aligned_size;
85
633
    ps_mem_tab->i4_alignment = i4_alignment;
86
633
    ps_mem_tab->e_usage = e_usage;
87
633
    ps_mem_tab->e_mem_region = e_mem_region;
88
633
}
bit_allocation.c:fill_memtab
Line
Count
Source
79
633
{
80
    /* Make the size next multiple of alignment */
81
633
    WORD32 i4_aligned_size = (((u4_size) + (i4_alignment - 1)) & (~(i4_alignment - 1)));
82
83
    /* Fill the memtab */
84
633
    ps_mem_tab->u4_size = i4_aligned_size;
85
633
    ps_mem_tab->i4_alignment = i4_alignment;
86
633
    ps_mem_tab->e_usage = e_usage;
87
633
    ps_mem_tab->e_mem_region = e_mem_region;
88
633
}
cbr_buffer_control.c:fill_memtab
Line
Count
Source
79
633
{
80
    /* Make the size next multiple of alignment */
81
633
    WORD32 i4_aligned_size = (((u4_size) + (i4_alignment - 1)) & (~(i4_alignment - 1)));
82
83
    /* Fill the memtab */
84
633
    ps_mem_tab->u4_size = i4_aligned_size;
85
633
    ps_mem_tab->i4_alignment = i4_alignment;
86
633
    ps_mem_tab->e_usage = e_usage;
87
633
    ps_mem_tab->e_mem_region = e_mem_region;
88
633
}
est_sad.c:fill_memtab
Line
Count
Source
79
633
{
80
    /* Make the size next multiple of alignment */
81
633
    WORD32 i4_aligned_size = (((u4_size) + (i4_alignment - 1)) & (~(i4_alignment - 1)));
82
83
    /* Fill the memtab */
84
633
    ps_mem_tab->u4_size = i4_aligned_size;
85
633
    ps_mem_tab->i4_alignment = i4_alignment;
86
633
    ps_mem_tab->e_usage = e_usage;
87
633
    ps_mem_tab->e_mem_region = e_mem_region;
88
633
}
fixed_point_error_bits.c:fill_memtab
Line
Count
Source
79
2.53k
{
80
    /* Make the size next multiple of alignment */
81
2.53k
    WORD32 i4_aligned_size = (((u4_size) + (i4_alignment - 1)) & (~(i4_alignment - 1)));
82
83
    /* Fill the memtab */
84
2.53k
    ps_mem_tab->u4_size = i4_aligned_size;
85
2.53k
    ps_mem_tab->i4_alignment = i4_alignment;
86
2.53k
    ps_mem_tab->e_usage = e_usage;
87
2.53k
    ps_mem_tab->e_mem_region = e_mem_region;
88
2.53k
}
init_qp.c:fill_memtab
Line
Count
Source
79
633
{
80
    /* Make the size next multiple of alignment */
81
633
    WORD32 i4_aligned_size = (((u4_size) + (i4_alignment - 1)) & (~(i4_alignment - 1)));
82
83
    /* Fill the memtab */
84
633
    ps_mem_tab->u4_size = i4_aligned_size;
85
633
    ps_mem_tab->i4_alignment = i4_alignment;
86
633
    ps_mem_tab->e_usage = e_usage;
87
633
    ps_mem_tab->e_mem_region = e_mem_region;
88
633
}
mb_model_based.c:fill_memtab
Line
Count
Source
79
633
{
80
    /* Make the size next multiple of alignment */
81
633
    WORD32 i4_aligned_size = (((u4_size) + (i4_alignment - 1)) & (~(i4_alignment - 1)));
82
83
    /* Fill the memtab */
84
633
    ps_mem_tab->u4_size = i4_aligned_size;
85
633
    ps_mem_tab->i4_alignment = i4_alignment;
86
633
    ps_mem_tab->e_usage = e_usage;
87
633
    ps_mem_tab->e_mem_region = e_mem_region;
88
633
}
picture_type.c:fill_memtab
Line
Count
Source
79
633
{
80
    /* Make the size next multiple of alignment */
81
633
    WORD32 i4_aligned_size = (((u4_size) + (i4_alignment - 1)) & (~(i4_alignment - 1)));
82
83
    /* Fill the memtab */
84
633
    ps_mem_tab->u4_size = i4_aligned_size;
85
633
    ps_mem_tab->i4_alignment = i4_alignment;
86
633
    ps_mem_tab->e_usage = e_usage;
87
633
    ps_mem_tab->e_mem_region = e_mem_region;
88
633
}
89
90
static __inline WORD32
91
    use_or_fill_base(itt_memtab_t *ps_mem_tab, void **ptr_to_be_filled, ITT_FUNC_TYPE_E e_func_type)
92
13.9k
{
93
    /* Fill base for freeing the allocated memory */
94
13.9k
    if(e_func_type == FILL_BASE)
95
0
    {
96
0
        if(ptr_to_be_filled[0] != 0)
97
0
        {
98
0
            ps_mem_tab->pv_base = ptr_to_be_filled[0];
99
0
            return (0);
100
0
        }
101
0
        else
102
0
        {
103
0
            return (-1);
104
0
        }
105
0
    }
106
    /* obtain the allocated memory from base pointer */
107
13.9k
    if(e_func_type == USE_BASE)
108
4.64k
    {
109
4.64k
        if(ps_mem_tab->pv_base != 0)
110
4.64k
        {
111
4.64k
            ptr_to_be_filled[0] = ps_mem_tab->pv_base;
112
4.64k
            return (0);
113
4.64k
        }
114
0
        else
115
0
        {
116
0
            return (-1);
117
0
        }
118
4.64k
    }
119
9.28k
    return (0);
120
13.9k
}
Unexecuted instantiation: ihevce_rc_interface.c:use_or_fill_base
rate_control_api.c:use_or_fill_base
Line
Count
Source
92
633
{
93
    /* Fill base for freeing the allocated memory */
94
633
    if(e_func_type == FILL_BASE)
95
0
    {
96
0
        if(ptr_to_be_filled[0] != 0)
97
0
        {
98
0
            ps_mem_tab->pv_base = ptr_to_be_filled[0];
99
0
            return (0);
100
0
        }
101
0
        else
102
0
        {
103
0
            return (-1);
104
0
        }
105
0
    }
106
    /* obtain the allocated memory from base pointer */
107
633
    if(e_func_type == USE_BASE)
108
211
    {
109
211
        if(ps_mem_tab->pv_base != 0)
110
211
        {
111
211
            ptr_to_be_filled[0] = ps_mem_tab->pv_base;
112
211
            return (0);
113
211
        }
114
0
        else
115
0
        {
116
0
            return (-1);
117
0
        }
118
211
    }
119
422
    return (0);
120
633
}
rc_rd_model_fix.c:use_or_fill_base
Line
Count
Source
92
5.69k
{
93
    /* Fill base for freeing the allocated memory */
94
5.69k
    if(e_func_type == FILL_BASE)
95
0
    {
96
0
        if(ptr_to_be_filled[0] != 0)
97
0
        {
98
0
            ps_mem_tab->pv_base = ptr_to_be_filled[0];
99
0
            return (0);
100
0
        }
101
0
        else
102
0
        {
103
0
            return (-1);
104
0
        }
105
0
    }
106
    /* obtain the allocated memory from base pointer */
107
5.69k
    if(e_func_type == USE_BASE)
108
1.89k
    {
109
1.89k
        if(ps_mem_tab->pv_base != 0)
110
1.89k
        {
111
1.89k
            ptr_to_be_filled[0] = ps_mem_tab->pv_base;
112
1.89k
            return (0);
113
1.89k
        }
114
0
        else
115
0
        {
116
0
            return (-1);
117
0
        }
118
1.89k
    }
119
3.79k
    return (0);
120
5.69k
}
rc_sad_acc.c:use_or_fill_base
Line
Count
Source
92
633
{
93
    /* Fill base for freeing the allocated memory */
94
633
    if(e_func_type == FILL_BASE)
95
0
    {
96
0
        if(ptr_to_be_filled[0] != 0)
97
0
        {
98
0
            ps_mem_tab->pv_base = ptr_to_be_filled[0];
99
0
            return (0);
100
0
        }
101
0
        else
102
0
        {
103
0
            return (-1);
104
0
        }
105
0
    }
106
    /* obtain the allocated memory from base pointer */
107
633
    if(e_func_type == USE_BASE)
108
211
    {
109
211
        if(ps_mem_tab->pv_base != 0)
110
211
        {
111
211
            ptr_to_be_filled[0] = ps_mem_tab->pv_base;
112
211
            return (0);
113
211
        }
114
0
        else
115
0
        {
116
0
            return (-1);
117
0
        }
118
211
    }
119
422
    return (0);
120
633
}
vbr_storage_vbv.c:use_or_fill_base
Line
Count
Source
92
633
{
93
    /* Fill base for freeing the allocated memory */
94
633
    if(e_func_type == FILL_BASE)
95
0
    {
96
0
        if(ptr_to_be_filled[0] != 0)
97
0
        {
98
0
            ps_mem_tab->pv_base = ptr_to_be_filled[0];
99
0
            return (0);
100
0
        }
101
0
        else
102
0
        {
103
0
            return (-1);
104
0
        }
105
0
    }
106
    /* obtain the allocated memory from base pointer */
107
633
    if(e_func_type == USE_BASE)
108
211
    {
109
211
        if(ps_mem_tab->pv_base != 0)
110
211
        {
111
211
            ptr_to_be_filled[0] = ps_mem_tab->pv_base;
112
211
            return (0);
113
211
        }
114
0
        else
115
0
        {
116
0
            return (-1);
117
0
        }
118
211
    }
119
422
    return (0);
120
633
}
bit_allocation.c:use_or_fill_base
Line
Count
Source
92
633
{
93
    /* Fill base for freeing the allocated memory */
94
633
    if(e_func_type == FILL_BASE)
95
0
    {
96
0
        if(ptr_to_be_filled[0] != 0)
97
0
        {
98
0
            ps_mem_tab->pv_base = ptr_to_be_filled[0];
99
0
            return (0);
100
0
        }
101
0
        else
102
0
        {
103
0
            return (-1);
104
0
        }
105
0
    }
106
    /* obtain the allocated memory from base pointer */
107
633
    if(e_func_type == USE_BASE)
108
211
    {
109
211
        if(ps_mem_tab->pv_base != 0)
110
211
        {
111
211
            ptr_to_be_filled[0] = ps_mem_tab->pv_base;
112
211
            return (0);
113
211
        }
114
0
        else
115
0
        {
116
0
            return (-1);
117
0
        }
118
211
    }
119
422
    return (0);
120
633
}
cbr_buffer_control.c:use_or_fill_base
Line
Count
Source
92
633
{
93
    /* Fill base for freeing the allocated memory */
94
633
    if(e_func_type == FILL_BASE)
95
0
    {
96
0
        if(ptr_to_be_filled[0] != 0)
97
0
        {
98
0
            ps_mem_tab->pv_base = ptr_to_be_filled[0];
99
0
            return (0);
100
0
        }
101
0
        else
102
0
        {
103
0
            return (-1);
104
0
        }
105
0
    }
106
    /* obtain the allocated memory from base pointer */
107
633
    if(e_func_type == USE_BASE)
108
211
    {
109
211
        if(ps_mem_tab->pv_base != 0)
110
211
        {
111
211
            ptr_to_be_filled[0] = ps_mem_tab->pv_base;
112
211
            return (0);
113
211
        }
114
0
        else
115
0
        {
116
0
            return (-1);
117
0
        }
118
211
    }
119
422
    return (0);
120
633
}
est_sad.c:use_or_fill_base
Line
Count
Source
92
633
{
93
    /* Fill base for freeing the allocated memory */
94
633
    if(e_func_type == FILL_BASE)
95
0
    {
96
0
        if(ptr_to_be_filled[0] != 0)
97
0
        {
98
0
            ps_mem_tab->pv_base = ptr_to_be_filled[0];
99
0
            return (0);
100
0
        }
101
0
        else
102
0
        {
103
0
            return (-1);
104
0
        }
105
0
    }
106
    /* obtain the allocated memory from base pointer */
107
633
    if(e_func_type == USE_BASE)
108
211
    {
109
211
        if(ps_mem_tab->pv_base != 0)
110
211
        {
111
211
            ptr_to_be_filled[0] = ps_mem_tab->pv_base;
112
211
            return (0);
113
211
        }
114
0
        else
115
0
        {
116
0
            return (-1);
117
0
        }
118
211
    }
119
422
    return (0);
120
633
}
fixed_point_error_bits.c:use_or_fill_base
Line
Count
Source
92
2.53k
{
93
    /* Fill base for freeing the allocated memory */
94
2.53k
    if(e_func_type == FILL_BASE)
95
0
    {
96
0
        if(ptr_to_be_filled[0] != 0)
97
0
        {
98
0
            ps_mem_tab->pv_base = ptr_to_be_filled[0];
99
0
            return (0);
100
0
        }
101
0
        else
102
0
        {
103
0
            return (-1);
104
0
        }
105
0
    }
106
    /* obtain the allocated memory from base pointer */
107
2.53k
    if(e_func_type == USE_BASE)
108
844
    {
109
844
        if(ps_mem_tab->pv_base != 0)
110
844
        {
111
844
            ptr_to_be_filled[0] = ps_mem_tab->pv_base;
112
844
            return (0);
113
844
        }
114
0
        else
115
0
        {
116
0
            return (-1);
117
0
        }
118
844
    }
119
1.68k
    return (0);
120
2.53k
}
init_qp.c:use_or_fill_base
Line
Count
Source
92
633
{
93
    /* Fill base for freeing the allocated memory */
94
633
    if(e_func_type == FILL_BASE)
95
0
    {
96
0
        if(ptr_to_be_filled[0] != 0)
97
0
        {
98
0
            ps_mem_tab->pv_base = ptr_to_be_filled[0];
99
0
            return (0);
100
0
        }
101
0
        else
102
0
        {
103
0
            return (-1);
104
0
        }
105
0
    }
106
    /* obtain the allocated memory from base pointer */
107
633
    if(e_func_type == USE_BASE)
108
211
    {
109
211
        if(ps_mem_tab->pv_base != 0)
110
211
        {
111
211
            ptr_to_be_filled[0] = ps_mem_tab->pv_base;
112
211
            return (0);
113
211
        }
114
0
        else
115
0
        {
116
0
            return (-1);
117
0
        }
118
211
    }
119
422
    return (0);
120
633
}
mb_model_based.c:use_or_fill_base
Line
Count
Source
92
633
{
93
    /* Fill base for freeing the allocated memory */
94
633
    if(e_func_type == FILL_BASE)
95
0
    {
96
0
        if(ptr_to_be_filled[0] != 0)
97
0
        {
98
0
            ps_mem_tab->pv_base = ptr_to_be_filled[0];
99
0
            return (0);
100
0
        }
101
0
        else
102
0
        {
103
0
            return (-1);
104
0
        }
105
0
    }
106
    /* obtain the allocated memory from base pointer */
107
633
    if(e_func_type == USE_BASE)
108
211
    {
109
211
        if(ps_mem_tab->pv_base != 0)
110
211
        {
111
211
            ptr_to_be_filled[0] = ps_mem_tab->pv_base;
112
211
            return (0);
113
211
        }
114
0
        else
115
0
        {
116
0
            return (-1);
117
0
        }
118
211
    }
119
422
    return (0);
120
633
}
picture_type.c:use_or_fill_base
Line
Count
Source
92
633
{
93
    /* Fill base for freeing the allocated memory */
94
633
    if(e_func_type == FILL_BASE)
95
0
    {
96
0
        if(ptr_to_be_filled[0] != 0)
97
0
        {
98
0
            ps_mem_tab->pv_base = ptr_to_be_filled[0];
99
0
            return (0);
100
0
        }
101
0
        else
102
0
        {
103
0
            return (-1);
104
0
        }
105
0
    }
106
    /* obtain the allocated memory from base pointer */
107
633
    if(e_func_type == USE_BASE)
108
211
    {
109
211
        if(ps_mem_tab->pv_base != 0)
110
211
        {
111
211
            ptr_to_be_filled[0] = ps_mem_tab->pv_base;
112
211
            return (0);
113
211
        }
114
0
        else
115
0
        {
116
0
            return (-1);
117
0
        }
118
211
    }
119
422
    return (0);
120
633
}
121
122
#endif /* _MEM_REQ_AND_ACQ_H_*/