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 ******************************************************************************* 22 * @file 23 * isvce_defs.h 24 * 25 * @brief 26 * Definitions used in the encoder 27 * 28 * @author 29 * ittiam 30 * 31 * @remarks 32 * None 33 * 34 ******************************************************************************* 35 */ 36 37 #ifndef _ISVCE_DEFS_H_ 38 #define _ISVCE_DEFS_H_ 39 40 #include "ih264e_defs.h" 41 42 #define SVC_MAX_NUM_BFRAMES 0 43 44 #define DEFAULT_INIT_QP 1 45 46 #define SVC_MAX_NUM_INP_FRAMES ((SVC_MAX_NUM_BFRAMES) + 2) 47 48 #define LOG2_MAX_FRAME_NUM_MINUS4 12 49 50 #define ENC_MAX_PU_IN_MB ((MB_SIZE / ENC_MIN_PU_SIZE) * (MB_SIZE / ENC_MIN_PU_SIZE)) 51 52 #define MAX_REF_FRAMES_PER_PRED_DIR 1 53 54 #define SVC_MAX_SLICE_HDR_CNT 1 55 56 #define MAX_LAYER_REFERENCE_PICS 1 57 58 #define ENABLE_RESIDUAL_PREDICTION 1 59 60 #define ENABLE_ILP_MV 1 61 62 #define USE_ILP_MV_IN_ME (1 && (ENABLE_ILP_MV)) 63 64 #define USE_ILP_MV_AS_MVP (1 && (ENABLE_ILP_MV)) 65 66 #define MAX_MVP_IDX (USE_ILP_MV_AS_MVP ? 1 : 0) 67 68 #define ENABLE_IBL_MODE 1 69 70 #define ENABLE_INTRA_BASE_DEBLOCK (0 && (ENABLE_IBL_MODE)) 71 72 #define ENABLE_MODE_STAT_VISUALISER 0 73 74 #define FORCE_FAST_INTRA4X4 0 75 76 #define FORCE_DISTORTION_BASED_INTRA_4X4_GATING 1 77 78 #define ENABLE_INTRA16X16_BASED_INTRA4X4_GATING 0 79 80 #define ENABLE_ILP_BASED_INTRA4X4_GATING 0 81 82 #define DISABLE_POST_ENC_SKIP 1 83 84 #define ENABLE_RE_ENC_AS_SKIP 1 85 86 #define MAX_ILP_MV_IN_NBR_RGN 4 87 88 /* L, T, TL, TR, Zero, Skip, 'Temporal Skip', ILP */ 89 #define MAX_FPEL_SEARCH_CANDIDATES (7 + MAX_PU_IN_MB + MAX_ILP_MV_IN_NBR_RGN) 90 91 #define NUM_SVCE_RC_MEMTABS 45 92 93 #define SVCE_MAX_INP_DIM 1920 94 95 #define SVCE_MAX_INP_FRAME_SIZE (1920 * 1088) 96 97 /** 98 *************************************************************************** 99 * Enum to hold various mem records being request 100 **************************************************************************** 101 */ 102 typedef enum ISVCE_MEMREC_TYPES_T 103 { 104 /** 105 * Codec Object at API level 106 */ 107 ISVCE_MEM_REC_IV_OBJ, 108 109 /** 110 * Codec context 111 */ 112 ISVCE_MEM_REC_CODEC, 113 114 /** 115 * Cabac context 116 */ 117 ISVCE_MEM_REC_CABAC, 118 119 /** 120 * Cabac context_mb_info 121 */ 122 ISVCE_MEM_REC_CABAC_MB_INFO, 123 124 /** 125 * entropy context 126 */ 127 ISVCE_MEM_REC_ENTROPY, 128 129 /** 130 * Buffer to hold coeff data 131 */ 132 ISVCE_MEM_REC_MB_COEFF_DATA, 133 134 /** 135 * Buffer to hold coeff data 136 */ 137 ISVCE_MEM_REC_MB_HEADER_DATA, 138 139 /** 140 * Motion vector bank 141 */ 142 ISVCE_MEM_REC_MVBANK, 143 144 /** 145 * Motion vector bits 146 */ 147 ISVCE_MEM_REC_MVBITS, 148 149 /** 150 * Holds mem records passed to the codec. 151 */ 152 ISVCE_MEM_REC_BACKUP, 153 154 /** 155 * Holds SPS 156 */ 157 ISVCE_MEM_REC_SPS, 158 159 /** 160 * Holds PPS 161 */ 162 ISVCE_MEM_REC_PPS, 163 164 /** 165 * Holds SVC NALU Extension data 166 */ 167 ISVCE_MEM_REC_SVC_NALU_EXT, 168 169 /** 170 * Holds subset SPS data 171 */ 172 ISVCE_MEM_REC_SUBSET_SPS, 173 174 /** 175 * Holds Slice Headers 176 */ 177 ISVCE_MEM_REC_SLICE_HDR, 178 179 /** 180 * Holds SVC Slice Headers 181 */ 182 ISVCE_MEM_REC_SVC_SLICE_HDR, 183 184 /** 185 * Contains map indicating slice index per MB basis 186 */ 187 ISVCE_MEM_REC_SLICE_MAP, 188 189 /** 190 * Holds thread handles 191 */ 192 ISVCE_MEM_REC_THREAD_HANDLE, 193 194 /** 195 * Holds control call mutex 196 */ 197 ISVCE_MEM_REC_CTL_MUTEX, 198 199 /** 200 * Holds entropy call mutex 201 */ 202 ISVCE_MEM_REC_ENTROPY_MUTEX, 203 204 /** 205 * Holds memory for Process JOB Queue 206 */ 207 ISVCE_MEM_REC_PROC_JOBQ, 208 209 /** 210 * Holds memory for Entropy JOB Queue 211 */ 212 ISVCE_MEM_REC_ENTROPY_JOBQ, 213 214 /** 215 * Contains status map indicating processing status per MB basis 216 */ 217 ISVCE_MEM_REC_PROC_MAP, 218 219 /** 220 * Contains status map indicating deblocking status per MB basis 221 */ 222 ISVCE_MEM_REC_DBLK_MAP, 223 224 /* 225 * Contains AIR map and mask 226 */ 227 ISVCE_MEM_REC_AIR_MAP, 228 229 /** 230 * Contains status map indicating ME status per MB basis 231 */ 232 ISVCE_MEM_REC_ME_MAP, 233 234 /** 235 * Holds dpb manager context 236 */ 237 ISVCE_MEM_REC_DPB_MGR, 238 239 /** 240 * Holds intermediate buffers needed during processing stage 241 * Memory for process contexts is allocated in this memtab 242 */ 243 ISVCE_MEM_REC_PROC_SCRATCH, 244 245 /** 246 * Holds buffers for vert_bs, horz_bs and QP (all frame level) 247 */ 248 ISVCE_MEM_REC_QUANT_PARAM, 249 250 /** 251 * Holds top row syntax information 252 */ 253 ISVCE_MEM_REC_TOP_ROW_SYN_INFO, 254 255 /** 256 * Holds buffers for vert_bs, horz_bs and QP (all frame level) 257 */ 258 ISVCE_MEM_REC_BS_QP, 259 260 /** 261 * Holds input buffer manager context 262 */ 263 ISVCE_MEM_REC_INP_PIC, 264 265 /** 266 * Holds output buffer manager context 267 */ 268 ISVCE_MEM_REC_OUT, 269 270 /** 271 * Holds picture buffer manager context and array of pic_buf_ts 272 * Also holds reference picture buffers in non-shared mode 273 */ 274 ISVCE_MEM_REC_REF_PIC, 275 276 /* 277 * Mem record for color space conversion 278 */ 279 ISVCE_MEM_REC_CSC, 280 281 /** 282 * NMB info struct 283 */ 284 ISVCE_MEM_REC_MB_INFO_NMB, 285 286 /** 287 * SVC Spatial layer Inputs 288 */ 289 ISVCE_MEM_SVC_SPAT_INP, 290 291 /** 292 * Downscaler memory records 293 */ 294 ISVCE_MEM_DOWN_SCALER, 295 296 /** 297 * SVC ILP data 298 */ 299 ISVCE_MEM_SVC_ILP_DATA, 300 301 /** 302 * SVC ILP MV Context 303 */ 304 ISVCE_MEM_SVC_ILP_MV_CTXT, 305 306 /** 307 * SVC ResPred Context 308 */ 309 ISVCE_MEM_SVC_RES_PRED_CTXT, 310 311 /** 312 * SVC inter-layer intra pred context 313 */ 314 ISVCE_MEM_SVC_INTRA_PRED_CTXT, 315 316 /** 317 * RC Utils Context 318 */ 319 ISVCE_MEM_SVC_RC_UTILS_CTXT, 320 321 /** 322 * SubPic RC Context 323 */ 324 ISVCE_MEM_SVC_SUB_PIC_RC_CTXT, 325 326 #if ENABLE_MODE_STAT_VISUALISER 327 ISVCE_MEM_MODE_STAT_VISUALISER_BUF, 328 #endif 329 330 /** 331 * Rate control of memory records. 332 */ 333 ISVCE_MEM_REC_RC, 334 335 /** 336 * Place holder to compute number of memory records. 337 */ 338 ISVCE_MEM_REC_CNT = ISVCE_MEM_REC_RC + NUM_SVCE_RC_MEMTABS, 339 340 /* 341 * Do not add anything below 342 */ 343 } ISVCE_MEMREC_TYPES_T; 344 345 #endif 346