1 /* 2 * Copyright 2015 Rockchip Electronics Co. LTD 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 #ifndef __HAL_H264D_VDPU_COM_H__ 18 #define __HAL_H264D_VDPU_COM_H__ 19 20 #include "rk_type.h" 21 22 #include "hal_h264d_global.h" 23 24 #define VDPU_CABAC_TAB_SIZE (3680) /* bytes */ 25 #define VDPU_POC_BUF_SIZE (34*4) /* bytes */ 26 #define VDPU_SCALING_LIST_SIZE (6*16+2*64) /* bytes */ 27 28 #define DEBUG_REF_LIST 0 29 30 extern const RK_U32 vdpu_cabac_table[VDPU_CABAC_TAB_SIZE / 4]; 31 extern const RK_U32 vdpu_value_list[34]; 32 33 typedef struct h264d_vdpu_dpb_info_t { 34 RK_U8 valid; 35 36 RK_S32 slot_index; 37 RK_U32 is_long_term; 38 RK_S32 top_poc; 39 RK_S32 bot_poc; 40 RK_U16 frame_num; 41 RK_U32 long_term_frame_idx; 42 RK_U32 long_term_pic_num; 43 RK_U32 top_used; 44 RK_U32 bot_used; 45 RK_U32 view_id; 46 RK_U32 colmv_is_used; 47 RK_U32 field_flag; 48 RK_U32 is_ilt_flag; 49 RK_U32 voidx; 50 51 RK_U8 have_same; 52 RK_U32 new_dpb_idx; 53 } H264dVdpuDpbInfo_t; 54 55 typedef struct h264d_vdpu_ref_pic_info_t { 56 RK_U32 valid; 57 58 RK_S32 dpb_idx; 59 RK_S32 bottom_flag; 60 } H264dVdpuRefPicInfo_t; 61 62 typedef struct h264d_vdpu_priv_t { 63 RK_U32 layed_id; 64 65 H264dVdpuDpbInfo_t old_dpb[2][16]; 66 H264dVdpuDpbInfo_t new_dpb[16]; 67 H264dVdpuDpbInfo_t *ilt_dpb; 68 H264dVdpuRefPicInfo_t refinfo[3][32]; //!< listP listB0 list1 69 } H264dVdpuPriv_t; 70 71 typedef struct h264d_vdpu_buf_t { 72 RK_U32 valid; 73 74 MppBuffer buf; 75 void *cabac_ptr; 76 void *poc_ptr; 77 void *sclst_ptr; 78 void *regs; 79 } H264dVdpuBuf_t; 80 81 typedef struct h264d_refs_list_t { 82 RK_S32 idx; 83 RK_S32 cur_poc; 84 85 RK_S32 lt_flag; 86 RK_S32 ref_poc; 87 RK_S32 ref_picnum; 88 RK_S32 ref_flag; 89 } H264dRefsList_t; 90 91 typedef struct h264d_vdpu_reg_ctx_t { 92 H264dVdpuBuf_t reg_buf[3]; 93 94 MppBuffer buf; 95 void *cabac_ptr; 96 void *poc_ptr; 97 void *sclst_ptr; 98 void *regs; 99 } H264dVdpuRegCtx_t; 100 101 #ifdef __cplusplus 102 extern "C" { 103 #endif 104 105 RK_U32 vdpu_ver_align(RK_U32 val); 106 RK_U32 vdpu_hor_align(RK_U32 val); 107 108 MPP_RET adjust_input(H264dVdpuPriv_t *priv, 109 DXVA_Slice_H264_Long *p_long, 110 DXVA_PicParams_H264_MVC *pp); 111 112 RK_S32 compare_p(const void *a, const void *b); 113 RK_S32 compare_b0(const void *a, const void *b); 114 RK_S32 compare_b1(const void *a, const void *b); 115 116 #ifdef __cplusplus 117 } 118 #endif 119 120 #endif 121