1 /* 2 * 3 * Copyright 2015 Rockchip Electronics Co. LTD 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 #ifndef __VP9D_CODEC_H__ 18 #define __VP9D_CODEC_H__ 19 20 #include "mpp_frame.h" 21 #include "hal_dec_task.h" 22 23 #include "vp9d_syntax.h" 24 25 typedef struct VP9ParseContext { 26 RK_S32 n_frames; // 1-8 27 RK_S32 size[8]; 28 RK_S64 pts; 29 } VP9ParseContext; 30 #define MPP_PARSER_PTS_NB 4 31 32 typedef struct SplitContext { 33 RK_U8 *buffer; 34 RK_U32 buffer_size; 35 RK_S32 index; 36 RK_S32 last_index; 37 RK_U32 state; ///< contains the last few bytes in MSB order 38 RK_S32 frame_start_found; 39 RK_S32 overread; ///< the number of bytes which where irreversibly read from the next frame 40 RK_S32 overread_index; ///< the index into ParseContext.buffer of the overread bytes 41 RK_U64 state64; ///< contains the last 8 bytes in MSB order 42 RK_S64 pts; /* pts of the current frame */ 43 RK_S64 dts; /* dts of the current frame */ 44 RK_S64 frame_offset; /* offset of the current frame */ 45 RK_S64 cur_offset; /* current offset 46 (incremented by each av_parser_parse()) */ 47 RK_S64 next_frame_offset; /* offset of the next frame */ 48 49 /* private data */ 50 void *priv_data; 51 RK_S64 last_pts; 52 RK_S64 last_dts; 53 RK_S32 fetch_timestamp; 54 55 RK_S32 cur_frame_start_index; 56 RK_S64 cur_frame_offset[MPP_PARSER_PTS_NB]; 57 RK_S64 cur_frame_pts[MPP_PARSER_PTS_NB]; 58 RK_S64 cur_frame_dts[MPP_PARSER_PTS_NB]; 59 60 RK_S64 offset; ///< byte offset from starting packet start 61 RK_S64 cur_frame_end[MPP_PARSER_PTS_NB]; 62 /** 63 * Set by parser to 1 for key frames and 0 for non-key frames. 64 * It is initialized to -1, so if the parser doesn't set this flag, 65 * old-style fallback using AV_PICTURE_TYPE_I picture type as key frames 66 * will be used. 67 */ 68 RK_S32 key_frame; 69 RK_S32 eos; 70 } SplitContext_t; 71 72 typedef struct Vp9CodecContext { 73 74 void *priv_data; /* VP9Context */ 75 void *priv_data2; /* AVParserContext */ 76 77 RK_S32 pix_fmt; 78 79 RK_S32 profile; 80 #define FF_PROFILE_VP9_0 0 81 #define FF_PROFILE_VP9_1 1 82 #define FF_PROFILE_VP9_2 2 83 #define FF_PROFILE_VP9_3 3 84 85 RK_S32 level; 86 #define FF_LEVEL_UNKNOWN -99 87 88 MppFrameColorSpace colorspace; 89 90 MppFrameColorRange color_range; 91 92 RK_S32 width, height; 93 94 MppPacket pkt; 95 96 // DXVA_segmentation_VP9 segmentation; 97 DXVA_PicParams_VP9 pic_params; 98 // DXVA_Slice_VPx_Short slice_short; 99 RK_S32 eos; 100 } Vp9CodecContext; 101 102 #endif /*__VP9D_CODEC_H__*/ 103 104