Coverage Report

Created: 2025-11-24 06:46

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
449k
{
80
    /* Make the size next multiple of alignment */
81
449k
    WORD32 i4_aligned_size = (((u4_size) + (i4_alignment - 1)) & (~(i4_alignment - 1)));
82
83
    /* Fill the memtab */
84
449k
    ps_mem_tab->u4_size = i4_aligned_size;
85
449k
    ps_mem_tab->i4_alignment = i4_alignment;
86
449k
    ps_mem_tab->e_usage = e_usage;
87
449k
    ps_mem_tab->e_mem_region = e_mem_region;
88
449k
}
Unexecuted instantiation: ihevce_rc_interface.c:fill_memtab
rate_control_api.c:fill_memtab
Line
Count
Source
79
20.4k
{
80
    /* Make the size next multiple of alignment */
81
20.4k
    WORD32 i4_aligned_size = (((u4_size) + (i4_alignment - 1)) & (~(i4_alignment - 1)));
82
83
    /* Fill the memtab */
84
20.4k
    ps_mem_tab->u4_size = i4_aligned_size;
85
20.4k
    ps_mem_tab->i4_alignment = i4_alignment;
86
20.4k
    ps_mem_tab->e_usage = e_usage;
87
20.4k
    ps_mem_tab->e_mem_region = e_mem_region;
88
20.4k
}
rc_rd_model_fix.c:fill_memtab
Line
Count
Source
79
183k
{
80
    /* Make the size next multiple of alignment */
81
183k
    WORD32 i4_aligned_size = (((u4_size) + (i4_alignment - 1)) & (~(i4_alignment - 1)));
82
83
    /* Fill the memtab */
84
183k
    ps_mem_tab->u4_size = i4_aligned_size;
85
183k
    ps_mem_tab->i4_alignment = i4_alignment;
86
183k
    ps_mem_tab->e_usage = e_usage;
87
183k
    ps_mem_tab->e_mem_region = e_mem_region;
88
183k
}
rc_sad_acc.c:fill_memtab
Line
Count
Source
79
20.4k
{
80
    /* Make the size next multiple of alignment */
81
20.4k
    WORD32 i4_aligned_size = (((u4_size) + (i4_alignment - 1)) & (~(i4_alignment - 1)));
82
83
    /* Fill the memtab */
84
20.4k
    ps_mem_tab->u4_size = i4_aligned_size;
85
20.4k
    ps_mem_tab->i4_alignment = i4_alignment;
86
20.4k
    ps_mem_tab->e_usage = e_usage;
87
20.4k
    ps_mem_tab->e_mem_region = e_mem_region;
88
20.4k
}
vbr_storage_vbv.c:fill_memtab
Line
Count
Source
79
20.4k
{
80
    /* Make the size next multiple of alignment */
81
20.4k
    WORD32 i4_aligned_size = (((u4_size) + (i4_alignment - 1)) & (~(i4_alignment - 1)));
82
83
    /* Fill the memtab */
84
20.4k
    ps_mem_tab->u4_size = i4_aligned_size;
85
20.4k
    ps_mem_tab->i4_alignment = i4_alignment;
86
20.4k
    ps_mem_tab->e_usage = e_usage;
87
20.4k
    ps_mem_tab->e_mem_region = e_mem_region;
88
20.4k
}
bit_allocation.c:fill_memtab
Line
Count
Source
79
20.4k
{
80
    /* Make the size next multiple of alignment */
81
20.4k
    WORD32 i4_aligned_size = (((u4_size) + (i4_alignment - 1)) & (~(i4_alignment - 1)));
82
83
    /* Fill the memtab */
84
20.4k
    ps_mem_tab->u4_size = i4_aligned_size;
85
20.4k
    ps_mem_tab->i4_alignment = i4_alignment;
86
20.4k
    ps_mem_tab->e_usage = e_usage;
87
20.4k
    ps_mem_tab->e_mem_region = e_mem_region;
88
20.4k
}
cbr_buffer_control.c:fill_memtab
Line
Count
Source
79
20.4k
{
80
    /* Make the size next multiple of alignment */
81
20.4k
    WORD32 i4_aligned_size = (((u4_size) + (i4_alignment - 1)) & (~(i4_alignment - 1)));
82
83
    /* Fill the memtab */
84
20.4k
    ps_mem_tab->u4_size = i4_aligned_size;
85
20.4k
    ps_mem_tab->i4_alignment = i4_alignment;
86
20.4k
    ps_mem_tab->e_usage = e_usage;
87
20.4k
    ps_mem_tab->e_mem_region = e_mem_region;
88
20.4k
}
est_sad.c:fill_memtab
Line
Count
Source
79
20.4k
{
80
    /* Make the size next multiple of alignment */
81
20.4k
    WORD32 i4_aligned_size = (((u4_size) + (i4_alignment - 1)) & (~(i4_alignment - 1)));
82
83
    /* Fill the memtab */
84
20.4k
    ps_mem_tab->u4_size = i4_aligned_size;
85
20.4k
    ps_mem_tab->i4_alignment = i4_alignment;
86
20.4k
    ps_mem_tab->e_usage = e_usage;
87
20.4k
    ps_mem_tab->e_mem_region = e_mem_region;
88
20.4k
}
fixed_point_error_bits.c:fill_memtab
Line
Count
Source
79
81.7k
{
80
    /* Make the size next multiple of alignment */
81
81.7k
    WORD32 i4_aligned_size = (((u4_size) + (i4_alignment - 1)) & (~(i4_alignment - 1)));
82
83
    /* Fill the memtab */
84
81.7k
    ps_mem_tab->u4_size = i4_aligned_size;
85
81.7k
    ps_mem_tab->i4_alignment = i4_alignment;
86
81.7k
    ps_mem_tab->e_usage = e_usage;
87
81.7k
    ps_mem_tab->e_mem_region = e_mem_region;
88
81.7k
}
init_qp.c:fill_memtab
Line
Count
Source
79
20.4k
{
80
    /* Make the size next multiple of alignment */
81
20.4k
    WORD32 i4_aligned_size = (((u4_size) + (i4_alignment - 1)) & (~(i4_alignment - 1)));
82
83
    /* Fill the memtab */
84
20.4k
    ps_mem_tab->u4_size = i4_aligned_size;
85
20.4k
    ps_mem_tab->i4_alignment = i4_alignment;
86
20.4k
    ps_mem_tab->e_usage = e_usage;
87
20.4k
    ps_mem_tab->e_mem_region = e_mem_region;
88
20.4k
}
mb_model_based.c:fill_memtab
Line
Count
Source
79
20.4k
{
80
    /* Make the size next multiple of alignment */
81
20.4k
    WORD32 i4_aligned_size = (((u4_size) + (i4_alignment - 1)) & (~(i4_alignment - 1)));
82
83
    /* Fill the memtab */
84
20.4k
    ps_mem_tab->u4_size = i4_aligned_size;
85
20.4k
    ps_mem_tab->i4_alignment = i4_alignment;
86
20.4k
    ps_mem_tab->e_usage = e_usage;
87
20.4k
    ps_mem_tab->e_mem_region = e_mem_region;
88
20.4k
}
picture_type.c:fill_memtab
Line
Count
Source
79
20.4k
{
80
    /* Make the size next multiple of alignment */
81
20.4k
    WORD32 i4_aligned_size = (((u4_size) + (i4_alignment - 1)) & (~(i4_alignment - 1)));
82
83
    /* Fill the memtab */
84
20.4k
    ps_mem_tab->u4_size = i4_aligned_size;
85
20.4k
    ps_mem_tab->i4_alignment = i4_alignment;
86
20.4k
    ps_mem_tab->e_usage = e_usage;
87
20.4k
    ps_mem_tab->e_mem_region = e_mem_region;
88
20.4k
}
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
449k
{
93
    /* Fill base for freeing the allocated memory */
94
449k
    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
449k
    if(e_func_type == USE_BASE)
108
149k
    {
109
149k
        if(ps_mem_tab->pv_base != 0)
110
149k
        {
111
149k
            ptr_to_be_filled[0] = ps_mem_tab->pv_base;
112
149k
            return (0);
113
149k
        }
114
0
        else
115
0
        {
116
0
            return (-1);
117
0
        }
118
149k
    }
119
299k
    return (0);
120
449k
}
Unexecuted instantiation: ihevce_rc_interface.c:use_or_fill_base
rate_control_api.c:use_or_fill_base
Line
Count
Source
92
20.4k
{
93
    /* Fill base for freeing the allocated memory */
94
20.4k
    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
20.4k
    if(e_func_type == USE_BASE)
108
6.81k
    {
109
6.81k
        if(ps_mem_tab->pv_base != 0)
110
6.81k
        {
111
6.81k
            ptr_to_be_filled[0] = ps_mem_tab->pv_base;
112
6.81k
            return (0);
113
6.81k
        }
114
0
        else
115
0
        {
116
0
            return (-1);
117
0
        }
118
6.81k
    }
119
13.6k
    return (0);
120
20.4k
}
rc_rd_model_fix.c:use_or_fill_base
Line
Count
Source
92
183k
{
93
    /* Fill base for freeing the allocated memory */
94
183k
    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
183k
    if(e_func_type == USE_BASE)
108
61.3k
    {
109
61.3k
        if(ps_mem_tab->pv_base != 0)
110
61.3k
        {
111
61.3k
            ptr_to_be_filled[0] = ps_mem_tab->pv_base;
112
61.3k
            return (0);
113
61.3k
        }
114
0
        else
115
0
        {
116
0
            return (-1);
117
0
        }
118
61.3k
    }
119
122k
    return (0);
120
183k
}
rc_sad_acc.c:use_or_fill_base
Line
Count
Source
92
20.4k
{
93
    /* Fill base for freeing the allocated memory */
94
20.4k
    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
20.4k
    if(e_func_type == USE_BASE)
108
6.81k
    {
109
6.81k
        if(ps_mem_tab->pv_base != 0)
110
6.81k
        {
111
6.81k
            ptr_to_be_filled[0] = ps_mem_tab->pv_base;
112
6.81k
            return (0);
113
6.81k
        }
114
0
        else
115
0
        {
116
0
            return (-1);
117
0
        }
118
6.81k
    }
119
13.6k
    return (0);
120
20.4k
}
vbr_storage_vbv.c:use_or_fill_base
Line
Count
Source
92
20.4k
{
93
    /* Fill base for freeing the allocated memory */
94
20.4k
    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
20.4k
    if(e_func_type == USE_BASE)
108
6.81k
    {
109
6.81k
        if(ps_mem_tab->pv_base != 0)
110
6.81k
        {
111
6.81k
            ptr_to_be_filled[0] = ps_mem_tab->pv_base;
112
6.81k
            return (0);
113
6.81k
        }
114
0
        else
115
0
        {
116
0
            return (-1);
117
0
        }
118
6.81k
    }
119
13.6k
    return (0);
120
20.4k
}
bit_allocation.c:use_or_fill_base
Line
Count
Source
92
20.4k
{
93
    /* Fill base for freeing the allocated memory */
94
20.4k
    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
20.4k
    if(e_func_type == USE_BASE)
108
6.81k
    {
109
6.81k
        if(ps_mem_tab->pv_base != 0)
110
6.81k
        {
111
6.81k
            ptr_to_be_filled[0] = ps_mem_tab->pv_base;
112
6.81k
            return (0);
113
6.81k
        }
114
0
        else
115
0
        {
116
0
            return (-1);
117
0
        }
118
6.81k
    }
119
13.6k
    return (0);
120
20.4k
}
cbr_buffer_control.c:use_or_fill_base
Line
Count
Source
92
20.4k
{
93
    /* Fill base for freeing the allocated memory */
94
20.4k
    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
20.4k
    if(e_func_type == USE_BASE)
108
6.81k
    {
109
6.81k
        if(ps_mem_tab->pv_base != 0)
110
6.81k
        {
111
6.81k
            ptr_to_be_filled[0] = ps_mem_tab->pv_base;
112
6.81k
            return (0);
113
6.81k
        }
114
0
        else
115
0
        {
116
0
            return (-1);
117
0
        }
118
6.81k
    }
119
13.6k
    return (0);
120
20.4k
}
est_sad.c:use_or_fill_base
Line
Count
Source
92
20.4k
{
93
    /* Fill base for freeing the allocated memory */
94
20.4k
    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
20.4k
    if(e_func_type == USE_BASE)
108
6.81k
    {
109
6.81k
        if(ps_mem_tab->pv_base != 0)
110
6.81k
        {
111
6.81k
            ptr_to_be_filled[0] = ps_mem_tab->pv_base;
112
6.81k
            return (0);
113
6.81k
        }
114
0
        else
115
0
        {
116
0
            return (-1);
117
0
        }
118
6.81k
    }
119
13.6k
    return (0);
120
20.4k
}
fixed_point_error_bits.c:use_or_fill_base
Line
Count
Source
92
81.7k
{
93
    /* Fill base for freeing the allocated memory */
94
81.7k
    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
81.7k
    if(e_func_type == USE_BASE)
108
27.2k
    {
109
27.2k
        if(ps_mem_tab->pv_base != 0)
110
27.2k
        {
111
27.2k
            ptr_to_be_filled[0] = ps_mem_tab->pv_base;
112
27.2k
            return (0);
113
27.2k
        }
114
0
        else
115
0
        {
116
0
            return (-1);
117
0
        }
118
27.2k
    }
119
54.4k
    return (0);
120
81.7k
}
init_qp.c:use_or_fill_base
Line
Count
Source
92
20.4k
{
93
    /* Fill base for freeing the allocated memory */
94
20.4k
    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
20.4k
    if(e_func_type == USE_BASE)
108
6.81k
    {
109
6.81k
        if(ps_mem_tab->pv_base != 0)
110
6.81k
        {
111
6.81k
            ptr_to_be_filled[0] = ps_mem_tab->pv_base;
112
6.81k
            return (0);
113
6.81k
        }
114
0
        else
115
0
        {
116
0
            return (-1);
117
0
        }
118
6.81k
    }
119
13.6k
    return (0);
120
20.4k
}
mb_model_based.c:use_or_fill_base
Line
Count
Source
92
20.4k
{
93
    /* Fill base for freeing the allocated memory */
94
20.4k
    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
20.4k
    if(e_func_type == USE_BASE)
108
6.81k
    {
109
6.81k
        if(ps_mem_tab->pv_base != 0)
110
6.81k
        {
111
6.81k
            ptr_to_be_filled[0] = ps_mem_tab->pv_base;
112
6.81k
            return (0);
113
6.81k
        }
114
0
        else
115
0
        {
116
0
            return (-1);
117
0
        }
118
6.81k
    }
119
13.6k
    return (0);
120
20.4k
}
picture_type.c:use_or_fill_base
Line
Count
Source
92
20.4k
{
93
    /* Fill base for freeing the allocated memory */
94
20.4k
    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
20.4k
    if(e_func_type == USE_BASE)
108
6.81k
    {
109
6.81k
        if(ps_mem_tab->pv_base != 0)
110
6.81k
        {
111
6.81k
            ptr_to_be_filled[0] = ps_mem_tab->pv_base;
112
6.81k
            return (0);
113
6.81k
        }
114
0
        else
115
0
        {
116
0
            return (-1);
117
0
        }
118
6.81k
    }
119
13.6k
    return (0);
120
20.4k
}
121
122
#endif /* _MEM_REQ_AND_ACQ_H_*/