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 ******************************************************************************* 23 * @file 24 * isvce_cabac_structs.h 25 * 26 * @brief 27 * This file contains cabac related structure definitions. 28 * 29 * @author 30 * Doney Alex 31 * 32 * @remarks 33 * none 34 * 35 ******************************************************************************* 36 */ 37 38 #ifndef _ISVCE_CABAC_STRUCTS_H_ 39 #define _ISVCE_CABAC_STRUCTS_H_ 40 41 #include "ih264_typedefs.h" 42 #include "isvc_cabac_tables.h" 43 #include "ih264e_bitstream.h" 44 #include "ih264e_cabac_structs.h" 45 46 /** 47 ****************************************************************************** 48 * @brief MB info for cabac 49 ****************************************************************************** 50 */ 51 typedef struct isvce_mb_info_ctxt_t 52 { 53 /* Neighbour availability Variables needed to get CtxtInc, for CABAC */ 54 UWORD8 u1_mb_type; /* !< macroblock type: I/P/B/SI/SP */ 55 56 UWORD8 u1_cbp; /* !< Coded Block Pattern */ 57 UWORD8 u1_intrapred_chroma_mode; 58 59 /*************************************************************************/ 60 /* Arrangnment of AC CSBP */ 61 /* bits: b7 b6 b5 b4 b3 b2 b1 b0 */ 62 /* CSBP: V1 V0 U1 U0 Y3 Y2 Y1 Y0 */ 63 /*************************************************************************/ 64 UWORD8 u1_yuv_ac_csbp; 65 /*************************************************************************/ 66 /* Arrangnment of DC CSBP */ 67 /* bits: b7 b6 b5 b4 b3 b2 b1 b0 */ 68 /* CSBP: x x x x x Vdc Udc Ydc */ 69 /*************************************************************************/ 70 UWORD8 u1_yuv_dc_csbp; 71 72 WORD8 i1_ref_idx[4]; 73 UWORD8 u1_mv[4][4]; 74 75 UWORD8 u1_base_mode_flag; 76 } isvce_mb_info_ctxt_t; 77 78 /** 79 ****************************************************************************** 80 * @brief CABAC Context structure : Variables to handle Cabac 81 ****************************************************************************** 82 */ 83 typedef struct isvce_cabac_ctxt_t 84 { 85 /* Base pointer to all the cabac contexts */ 86 bin_ctxt_model au1_cabac_ctxt_table[NUM_SVC_CABAC_CTXTS]; 87 88 cab_csbp_t s_lft_csbp; 89 90 /** 91 * pointer to Bitstream structure 92 */ 93 bitstrm_t *ps_bitstrm; 94 95 /* Pointer to mb_info_ctxt_t map_base */ 96 isvce_mb_info_ctxt_t *ps_mb_map_ctxt_inc_base; 97 98 /* Pointer to encoding_envirnoment_t */ 99 encoding_envirnoment_t s_cab_enc_env; 100 101 /* These things need to be updated at each MbLevel */ 102 103 /* Prev ps_mb_qp_delta_ctxt */ 104 WORD8 i1_prevps_mb_qp_delta_ctxt; 105 106 /* Pointer to mb_info_ctxt_t map */ 107 isvce_mb_info_ctxt_t *ps_mb_map_ctxt_inc; 108 109 /* Pointer to default mb_info_ctxt_t */ 110 isvce_mb_info_ctxt_t *ps_def_ctxt_mb_info; 111 112 /* Pointer to current mb_info_ctxt_t */ 113 isvce_mb_info_ctxt_t *ps_curr_ctxt_mb_info; 114 115 /* Pointer to left mb_info_ctxt_t */ 116 isvce_mb_info_ctxt_t *ps_left_ctxt_mb_info; 117 118 /* Pointer to top mb_info_ctxt_t */ 119 isvce_mb_info_ctxt_t *ps_top_ctxt_mb_info; 120 121 /* Poniter to left csbp structure */ 122 cab_csbp_t *ps_lft_csbp; 123 UWORD8 *pu1_left_y_ac_csbp; 124 UWORD8 *pu1_left_uv_ac_csbp; 125 UWORD8 *pu1_left_yuv_dc_csbp; 126 127 /***************************************************************************/ 128 /* Ref_idx contexts are stored in the following way */ 129 /* Array Idx 0,1 for reference indices in Forward direction */ 130 /* Array Idx 2,3 for reference indices in backward direction */ 131 /***************************************************************************/ 132 /* Dimensions for u1_left_ref_ctxt_inc_arr is [2][4] for Mbaff:Top and Bot */ 133 WORD8 i1_left_ref_idx_ctx_inc_arr[2][4]; 134 WORD8 *pi1_left_ref_idx_ctxt_inc; 135 136 /* Dimensions for u1_left_mv_ctxt_inc_arr is [2][4][4] for Mbaff case */ 137 UWORD8 u1_left_mv_ctxt_inc_arr[2][4][4]; 138 UWORD8 (*pu1_left_mv_ctxt_inc)[4]; 139 140 } isvce_cabac_ctxt_t; 141 142 #endif 143