Coverage Report

Created: 2025-07-18 07:02

/src/libhevc/encoder/mem_req_and_acq.h
Line
Count
Source (jump to first uncovered line)
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
542k
{
80
    /* Make the size next multiple of alignment */
81
542k
    WORD32 i4_aligned_size = (((u4_size) + (i4_alignment - 1)) & (~(i4_alignment - 1)));
82
83
    /* Fill the memtab */
84
542k
    ps_mem_tab->u4_size = i4_aligned_size;
85
542k
    ps_mem_tab->i4_alignment = i4_alignment;
86
542k
    ps_mem_tab->e_usage = e_usage;
87
542k
    ps_mem_tab->e_mem_region = e_mem_region;
88
542k
}
Unexecuted instantiation: ihevce_rc_interface.c:fill_memtab
rate_control_api.c:fill_memtab
Line
Count
Source
79
24.6k
{
80
    /* Make the size next multiple of alignment */
81
24.6k
    WORD32 i4_aligned_size = (((u4_size) + (i4_alignment - 1)) & (~(i4_alignment - 1)));
82
83
    /* Fill the memtab */
84
24.6k
    ps_mem_tab->u4_size = i4_aligned_size;
85
24.6k
    ps_mem_tab->i4_alignment = i4_alignment;
86
24.6k
    ps_mem_tab->e_usage = e_usage;
87
24.6k
    ps_mem_tab->e_mem_region = e_mem_region;
88
24.6k
}
rc_rd_model_fix.c:fill_memtab
Line
Count
Source
79
222k
{
80
    /* Make the size next multiple of alignment */
81
222k
    WORD32 i4_aligned_size = (((u4_size) + (i4_alignment - 1)) & (~(i4_alignment - 1)));
82
83
    /* Fill the memtab */
84
222k
    ps_mem_tab->u4_size = i4_aligned_size;
85
222k
    ps_mem_tab->i4_alignment = i4_alignment;
86
222k
    ps_mem_tab->e_usage = e_usage;
87
222k
    ps_mem_tab->e_mem_region = e_mem_region;
88
222k
}
rc_sad_acc.c:fill_memtab
Line
Count
Source
79
24.6k
{
80
    /* Make the size next multiple of alignment */
81
24.6k
    WORD32 i4_aligned_size = (((u4_size) + (i4_alignment - 1)) & (~(i4_alignment - 1)));
82
83
    /* Fill the memtab */
84
24.6k
    ps_mem_tab->u4_size = i4_aligned_size;
85
24.6k
    ps_mem_tab->i4_alignment = i4_alignment;
86
24.6k
    ps_mem_tab->e_usage = e_usage;
87
24.6k
    ps_mem_tab->e_mem_region = e_mem_region;
88
24.6k
}
vbr_storage_vbv.c:fill_memtab
Line
Count
Source
79
24.6k
{
80
    /* Make the size next multiple of alignment */
81
24.6k
    WORD32 i4_aligned_size = (((u4_size) + (i4_alignment - 1)) & (~(i4_alignment - 1)));
82
83
    /* Fill the memtab */
84
24.6k
    ps_mem_tab->u4_size = i4_aligned_size;
85
24.6k
    ps_mem_tab->i4_alignment = i4_alignment;
86
24.6k
    ps_mem_tab->e_usage = e_usage;
87
24.6k
    ps_mem_tab->e_mem_region = e_mem_region;
88
24.6k
}
bit_allocation.c:fill_memtab
Line
Count
Source
79
24.6k
{
80
    /* Make the size next multiple of alignment */
81
24.6k
    WORD32 i4_aligned_size = (((u4_size) + (i4_alignment - 1)) & (~(i4_alignment - 1)));
82
83
    /* Fill the memtab */
84
24.6k
    ps_mem_tab->u4_size = i4_aligned_size;
85
24.6k
    ps_mem_tab->i4_alignment = i4_alignment;
86
24.6k
    ps_mem_tab->e_usage = e_usage;
87
24.6k
    ps_mem_tab->e_mem_region = e_mem_region;
88
24.6k
}
cbr_buffer_control.c:fill_memtab
Line
Count
Source
79
24.6k
{
80
    /* Make the size next multiple of alignment */
81
24.6k
    WORD32 i4_aligned_size = (((u4_size) + (i4_alignment - 1)) & (~(i4_alignment - 1)));
82
83
    /* Fill the memtab */
84
24.6k
    ps_mem_tab->u4_size = i4_aligned_size;
85
24.6k
    ps_mem_tab->i4_alignment = i4_alignment;
86
24.6k
    ps_mem_tab->e_usage = e_usage;
87
24.6k
    ps_mem_tab->e_mem_region = e_mem_region;
88
24.6k
}
est_sad.c:fill_memtab
Line
Count
Source
79
24.6k
{
80
    /* Make the size next multiple of alignment */
81
24.6k
    WORD32 i4_aligned_size = (((u4_size) + (i4_alignment - 1)) & (~(i4_alignment - 1)));
82
83
    /* Fill the memtab */
84
24.6k
    ps_mem_tab->u4_size = i4_aligned_size;
85
24.6k
    ps_mem_tab->i4_alignment = i4_alignment;
86
24.6k
    ps_mem_tab->e_usage = e_usage;
87
24.6k
    ps_mem_tab->e_mem_region = e_mem_region;
88
24.6k
}
fixed_point_error_bits.c:fill_memtab
Line
Count
Source
79
98.7k
{
80
    /* Make the size next multiple of alignment */
81
98.7k
    WORD32 i4_aligned_size = (((u4_size) + (i4_alignment - 1)) & (~(i4_alignment - 1)));
82
83
    /* Fill the memtab */
84
98.7k
    ps_mem_tab->u4_size = i4_aligned_size;
85
98.7k
    ps_mem_tab->i4_alignment = i4_alignment;
86
98.7k
    ps_mem_tab->e_usage = e_usage;
87
98.7k
    ps_mem_tab->e_mem_region = e_mem_region;
88
98.7k
}
init_qp.c:fill_memtab
Line
Count
Source
79
24.6k
{
80
    /* Make the size next multiple of alignment */
81
24.6k
    WORD32 i4_aligned_size = (((u4_size) + (i4_alignment - 1)) & (~(i4_alignment - 1)));
82
83
    /* Fill the memtab */
84
24.6k
    ps_mem_tab->u4_size = i4_aligned_size;
85
24.6k
    ps_mem_tab->i4_alignment = i4_alignment;
86
24.6k
    ps_mem_tab->e_usage = e_usage;
87
24.6k
    ps_mem_tab->e_mem_region = e_mem_region;
88
24.6k
}
mb_model_based.c:fill_memtab
Line
Count
Source
79
24.6k
{
80
    /* Make the size next multiple of alignment */
81
24.6k
    WORD32 i4_aligned_size = (((u4_size) + (i4_alignment - 1)) & (~(i4_alignment - 1)));
82
83
    /* Fill the memtab */
84
24.6k
    ps_mem_tab->u4_size = i4_aligned_size;
85
24.6k
    ps_mem_tab->i4_alignment = i4_alignment;
86
24.6k
    ps_mem_tab->e_usage = e_usage;
87
24.6k
    ps_mem_tab->e_mem_region = e_mem_region;
88
24.6k
}
picture_type.c:fill_memtab
Line
Count
Source
79
24.6k
{
80
    /* Make the size next multiple of alignment */
81
24.6k
    WORD32 i4_aligned_size = (((u4_size) + (i4_alignment - 1)) & (~(i4_alignment - 1)));
82
83
    /* Fill the memtab */
84
24.6k
    ps_mem_tab->u4_size = i4_aligned_size;
85
24.6k
    ps_mem_tab->i4_alignment = i4_alignment;
86
24.6k
    ps_mem_tab->e_usage = e_usage;
87
24.6k
    ps_mem_tab->e_mem_region = e_mem_region;
88
24.6k
}
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
542k
{
93
    /* Fill base for freeing the allocated memory */
94
542k
    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
542k
    if(e_func_type == USE_BASE)
108
180k
    {
109
180k
        if(ps_mem_tab->pv_base != 0)
110
180k
        {
111
180k
            ptr_to_be_filled[0] = ps_mem_tab->pv_base;
112
180k
            return (0);
113
180k
        }
114
0
        else
115
0
        {
116
0
            return (-1);
117
0
        }
118
180k
    }
119
361k
    return (0);
120
542k
}
Unexecuted instantiation: ihevce_rc_interface.c:use_or_fill_base
rate_control_api.c:use_or_fill_base
Line
Count
Source
92
24.6k
{
93
    /* Fill base for freeing the allocated memory */
94
24.6k
    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
24.6k
    if(e_func_type == USE_BASE)
108
8.22k
    {
109
8.22k
        if(ps_mem_tab->pv_base != 0)
110
8.22k
        {
111
8.22k
            ptr_to_be_filled[0] = ps_mem_tab->pv_base;
112
8.22k
            return (0);
113
8.22k
        }
114
0
        else
115
0
        {
116
0
            return (-1);
117
0
        }
118
8.22k
    }
119
16.4k
    return (0);
120
24.6k
}
rc_rd_model_fix.c:use_or_fill_base
Line
Count
Source
92
222k
{
93
    /* Fill base for freeing the allocated memory */
94
222k
    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
222k
    if(e_func_type == USE_BASE)
108
74.0k
    {
109
74.0k
        if(ps_mem_tab->pv_base != 0)
110
74.0k
        {
111
74.0k
            ptr_to_be_filled[0] = ps_mem_tab->pv_base;
112
74.0k
            return (0);
113
74.0k
        }
114
0
        else
115
0
        {
116
0
            return (-1);
117
0
        }
118
74.0k
    }
119
148k
    return (0);
120
222k
}
rc_sad_acc.c:use_or_fill_base
Line
Count
Source
92
24.6k
{
93
    /* Fill base for freeing the allocated memory */
94
24.6k
    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
24.6k
    if(e_func_type == USE_BASE)
108
8.22k
    {
109
8.22k
        if(ps_mem_tab->pv_base != 0)
110
8.22k
        {
111
8.22k
            ptr_to_be_filled[0] = ps_mem_tab->pv_base;
112
8.22k
            return (0);
113
8.22k
        }
114
0
        else
115
0
        {
116
0
            return (-1);
117
0
        }
118
8.22k
    }
119
16.4k
    return (0);
120
24.6k
}
vbr_storage_vbv.c:use_or_fill_base
Line
Count
Source
92
24.6k
{
93
    /* Fill base for freeing the allocated memory */
94
24.6k
    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
24.6k
    if(e_func_type == USE_BASE)
108
8.22k
    {
109
8.22k
        if(ps_mem_tab->pv_base != 0)
110
8.22k
        {
111
8.22k
            ptr_to_be_filled[0] = ps_mem_tab->pv_base;
112
8.22k
            return (0);
113
8.22k
        }
114
0
        else
115
0
        {
116
0
            return (-1);
117
0
        }
118
8.22k
    }
119
16.4k
    return (0);
120
24.6k
}
bit_allocation.c:use_or_fill_base
Line
Count
Source
92
24.6k
{
93
    /* Fill base for freeing the allocated memory */
94
24.6k
    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
24.6k
    if(e_func_type == USE_BASE)
108
8.22k
    {
109
8.22k
        if(ps_mem_tab->pv_base != 0)
110
8.22k
        {
111
8.22k
            ptr_to_be_filled[0] = ps_mem_tab->pv_base;
112
8.22k
            return (0);
113
8.22k
        }
114
0
        else
115
0
        {
116
0
            return (-1);
117
0
        }
118
8.22k
    }
119
16.4k
    return (0);
120
24.6k
}
cbr_buffer_control.c:use_or_fill_base
Line
Count
Source
92
24.6k
{
93
    /* Fill base for freeing the allocated memory */
94
24.6k
    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
24.6k
    if(e_func_type == USE_BASE)
108
8.22k
    {
109
8.22k
        if(ps_mem_tab->pv_base != 0)
110
8.22k
        {
111
8.22k
            ptr_to_be_filled[0] = ps_mem_tab->pv_base;
112
8.22k
            return (0);
113
8.22k
        }
114
0
        else
115
0
        {
116
0
            return (-1);
117
0
        }
118
8.22k
    }
119
16.4k
    return (0);
120
24.6k
}
est_sad.c:use_or_fill_base
Line
Count
Source
92
24.6k
{
93
    /* Fill base for freeing the allocated memory */
94
24.6k
    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
24.6k
    if(e_func_type == USE_BASE)
108
8.22k
    {
109
8.22k
        if(ps_mem_tab->pv_base != 0)
110
8.22k
        {
111
8.22k
            ptr_to_be_filled[0] = ps_mem_tab->pv_base;
112
8.22k
            return (0);
113
8.22k
        }
114
0
        else
115
0
        {
116
0
            return (-1);
117
0
        }
118
8.22k
    }
119
16.4k
    return (0);
120
24.6k
}
fixed_point_error_bits.c:use_or_fill_base
Line
Count
Source
92
98.7k
{
93
    /* Fill base for freeing the allocated memory */
94
98.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
98.7k
    if(e_func_type == USE_BASE)
108
32.9k
    {
109
32.9k
        if(ps_mem_tab->pv_base != 0)
110
32.9k
        {
111
32.9k
            ptr_to_be_filled[0] = ps_mem_tab->pv_base;
112
32.9k
            return (0);
113
32.9k
        }
114
0
        else
115
0
        {
116
0
            return (-1);
117
0
        }
118
32.9k
    }
119
65.8k
    return (0);
120
98.7k
}
init_qp.c:use_or_fill_base
Line
Count
Source
92
24.6k
{
93
    /* Fill base for freeing the allocated memory */
94
24.6k
    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
24.6k
    if(e_func_type == USE_BASE)
108
8.22k
    {
109
8.22k
        if(ps_mem_tab->pv_base != 0)
110
8.22k
        {
111
8.22k
            ptr_to_be_filled[0] = ps_mem_tab->pv_base;
112
8.22k
            return (0);
113
8.22k
        }
114
0
        else
115
0
        {
116
0
            return (-1);
117
0
        }
118
8.22k
    }
119
16.4k
    return (0);
120
24.6k
}
mb_model_based.c:use_or_fill_base
Line
Count
Source
92
24.6k
{
93
    /* Fill base for freeing the allocated memory */
94
24.6k
    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
24.6k
    if(e_func_type == USE_BASE)
108
8.22k
    {
109
8.22k
        if(ps_mem_tab->pv_base != 0)
110
8.22k
        {
111
8.22k
            ptr_to_be_filled[0] = ps_mem_tab->pv_base;
112
8.22k
            return (0);
113
8.22k
        }
114
0
        else
115
0
        {
116
0
            return (-1);
117
0
        }
118
8.22k
    }
119
16.4k
    return (0);
120
24.6k
}
picture_type.c:use_or_fill_base
Line
Count
Source
92
24.6k
{
93
    /* Fill base for freeing the allocated memory */
94
24.6k
    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
24.6k
    if(e_func_type == USE_BASE)
108
8.22k
    {
109
8.22k
        if(ps_mem_tab->pv_base != 0)
110
8.22k
        {
111
8.22k
            ptr_to_be_filled[0] = ps_mem_tab->pv_base;
112
8.22k
            return (0);
113
8.22k
        }
114
0
        else
115
0
        {
116
0
            return (-1);
117
0
        }
118
8.22k
    }
119
16.4k
    return (0);
120
24.6k
}
121
122
#endif /* _MEM_REQ_AND_ACQ_H_*/