ih264e_rc_mem_interface.h revision 8d3d303c7942ced6a987a52db8977d768dc3605f
1/****************************************************************************** 2 * 3 * Copyright (C) 2015 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/** 22****************************************************************************** 23* @file 24* ih264e_rc_mem_interface.h 25* 26* @brief 27* This file contains function declaration and structures for rate control 28* memtabs 29* 30* @author 31* ittiam 32* 33* @remarks 34* The rate control library is a global library across various codecs. It 35* anticipates certain structures definitions. Those definitions are to be 36* imported from global workspace. Instead of that, the structures needed for 37* rc library are copied in to this file and exported to rc library. If the 38* structures / enums / ... in the global workspace change, this file also needs 39* to be modified accordingly. 40* 41****************************************************************************** 42*/ 43#ifndef IH264E_RC_MEM_INTERFACE_H_ 44#define IH264E_RC_MEM_INTERFACE_H_ 45 46 47/*****************************************************************************/ 48/* Function Macros */ 49/*****************************************************************************/ 50 51#define FILL_MEMTAB(m_pv_mem_rec, m_j, m_mem_size, m_align, m_type) \ 52{ \ 53 m_pv_mem_rec[m_j].u4_size = sizeof(iv_mem_rec_t); \ 54 m_pv_mem_rec[m_j].u4_mem_size = m_mem_size; \ 55 m_pv_mem_rec[m_j].u4_mem_alignment = m_align; \ 56 m_pv_mem_rec[m_j].e_mem_type = m_type; \ 57} 58 59/*****************************************************************************/ 60/* Enums */ 61/*****************************************************************************/ 62typedef enum 63{ 64 ALIGN_BYTE = 1, 65 ALIGN_WORD16 = 2, 66 ALIGN_WORD32 = 4, 67 ALIGN_WORD64 = 8, 68 ALIGN_128_BYTE = 128 69}ITT_MEM_ALIGNMENT_TYPE_E; 70 71typedef enum 72{ 73 SCRATCH = 0, 74 PERSISTENT = 1, 75 WRITEONCE = 2 76}ITT_MEM_USAGE_TYPE_E; 77 78typedef enum 79{ 80 L1D = 0, 81 SL2 = 1, 82 DDR = 3 83}ITT_MEM_REGION_E; 84 85typedef enum 86{ 87 GET_NUM_MEMTAB = 0, 88 FILL_MEMTAB = 1, 89 USE_BASE = 2, 90 FILL_BASE =3 91}ITT_FUNC_TYPE_E; 92 93 94/*****************************************************************************/ 95/* Structures */ 96/*****************************************************************************/ 97 98/*NOTE : This should be an exact replica of IALG_MemRec, any change in IALG_MemRec 99 must be replicated here*/ 100typedef struct 101{ 102 /* Size in bytes */ 103 UWORD32 u4_size; 104 105 /* Alignment in bytes */ 106 WORD32 i4_alignment; 107 108 /* decides which memory region to be placed */ 109 ITT_MEM_REGION_E e_mem_region; 110 111 /* memory is scratch or persistent */ 112 ITT_MEM_USAGE_TYPE_E e_usage; 113 114 /* Base pointer for allocated memory */ 115 void *pv_base; 116} itt_memtab_t; 117 118 119/*****************************************************************************/ 120/* Extern Function Declarations */ 121/*****************************************************************************/ 122 123/** 124****************************************************************************** 125* 126* @brief This function fills memory record attributes 127* 128* @par Description 129* This function fills memory record attributes 130* 131* @param[in] ps_mem_tab 132* pointer to mem records 133* 134* @param[in] u4_size 135* size of the record 136* 137* @param[in] i4_alignment 138* memory alignment size 139* 140* @param[in] e_usage 141* usage 142* 143* @param[in] e_mem_region 144* mem region 145* 146* @return void 147* 148****************************************************************************** 149*/ 150void fill_memtab(itt_memtab_t *ps_mem_tab, WORD32 u4_size, WORD32 i4_alignment, 151 ITT_MEM_USAGE_TYPE_E e_usage, ITT_MEM_REGION_E e_mem_region); 152 153/** 154****************************************************************************** 155* 156* @brief This function fills memory record attributes 157* 158* @par Description 159* This function fills memory record attributes 160* 161* @param[in] ps_mem_tab 162* pointer to mem records 163* 164* @param[in] ptr_to_be_filled 165* handle to the memory record storage space 166* 167* @param[in] e_func_type 168* enum that dictates fill memory records or use memory records 169* 170* @return void 171* 172****************************************************************************** 173*/ 174WORD32 use_or_fill_base(itt_memtab_t *ps_mem_tab, void **ptr_to_be_filled, 175 ITT_FUNC_TYPE_E e_func_type); 176 177 178#endif // IH264E_RC_MEM_INTERFACE_H_ 179 180