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_sub_pic_rc.h 25 * 26 * @brief 27 * Contains typdefs and externs used for invoking sub-pic RC 28 * 29 ******************************************************************************* 30 */ 31 32 #ifndef _ISVCE_SUB_PIC_RC_H_ 33 #define _ISVCE_SUB_PIC_RC_H_ 34 35 #include "ih264_typedefs.h" 36 #include "isvce_pred_structs.h" 37 #include "isvce_defs.h" 38 39 /* Structs */ 40 typedef struct svc_sub_pic_rc_constants_t 41 { 42 void *pv_state; 43 44 } svc_sub_pic_rc_constants_t; 45 46 typedef struct mb_bits_info_t 47 { 48 WORD64 i8_header_bits; 49 50 WORD64 i8_texture_bits; 51 } mb_bits_info_t; 52 53 typedef struct svc_sub_pic_rc_entropy_variables_t 54 { 55 coordinates_t s_mb_pos; 56 57 mb_bits_info_t s_mb_bits; 58 59 UWORD8 u1_spatial_layer_id; 60 } svc_sub_pic_rc_entropy_variables_t; 61 62 typedef struct svc_sub_pic_rc_layer_variables_t 63 { 64 WORD32 i4_max_num_reference_frames; 65 66 WORD32 i4_slice_type; 67 68 WORD32 i4_frame_num; 69 70 UWORD8 u1_frame_qp; 71 72 UWORD8 u1_min_qp; 73 74 UWORD8 u1_max_qp; 75 76 UWORD8 u1_spatial_layer_id; 77 } svc_sub_pic_rc_layer_variables_t; 78 79 typedef struct svc_sub_pic_rc_mb_variables_t 80 { 81 buffer_container_t as_quant_coeffs[NUM_SP_COMPONENTS]; 82 83 isvce_enc_pu_mv_t *aps_mvps[MAX_MVP_IDX + 1]; 84 85 coordinates_t s_mb_pos; 86 87 isvce_mb_info_t *ps_mb_info; 88 89 UWORD8 *apu1_nnzs[NUM_SP_COMPONENTS]; 90 91 UWORD32 u4_cbp; 92 } svc_sub_pic_rc_mb_variables_t; 93 94 typedef struct svc_sub_pic_rc_variables_t 95 { 96 svc_sub_pic_rc_layer_variables_t s_layer_variables; 97 98 svc_sub_pic_rc_mb_variables_t s_mb_variables; 99 100 } svc_sub_pic_rc_variables_t; 101 102 typedef struct svc_sub_pic_rc_ctxt_t 103 { 104 svc_sub_pic_rc_constants_t s_sub_pic_rc_constants; 105 106 svc_sub_pic_rc_variables_t s_sub_pic_rc_variables; 107 108 svc_sub_pic_rc_entropy_variables_t s_sub_pic_rc_entropy_variables; 109 } svc_sub_pic_rc_ctxt_t; 110 111 /* Function declarations */ 112 extern UWORD32 isvce_get_sub_pic_rc_ctxt_size(UWORD8 u1_num_spatial_layers, 113 DOUBLE d_spatial_res_ratio, UWORD32 u4_wd, 114 UWORD32 u4_ht); 115 116 extern void isvce_sub_pic_rc_ctxt_init(isvce_codec_t *ps_codec, iv_mem_rec_t *ps_mem_rec); 117 118 extern void isvce_sub_pic_rc_ctxt_layer_init(svc_sub_pic_rc_ctxt_t *ps_sub_pic_rc_ctxt); 119 120 extern void isvce_sub_pic_rc_ctxt_delete(svc_sub_pic_rc_ctxt_t *ps_sub_pic_rc_ctxt); 121 122 extern void isvce_sub_pic_rc_ctxt_update(svc_sub_pic_rc_ctxt_t *ps_sub_pic_rc_ctxt); 123 124 extern UWORD8 isvce_sub_pic_rc_get_mb_qp(svc_sub_pic_rc_ctxt_t *ps_sub_pic_rc_ctxt, 125 UWORD8 u1_cur_mb_qp); 126 127 extern void isvce_sub_pic_rc_get_entropy_data(svc_sub_pic_rc_ctxt_t *ps_sub_pic_rc_ctxt); 128 129 extern void isvce_sub_pic_rc_dump_data(svc_sub_pic_rc_ctxt_t *ps_sub_pic_rc_ctxt); 130 131 #endif 132