xref: /rockchip-linux_mpp/mpp/common/vp8e_syntax.h (revision 437bfbeb9567cca9cd9080e3f6954aa9d6a94f18)
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 __VP8E_SYNTAX_H__
18 #define __VP8E_SYNTAX_H__
19 
20 #include "rk_type.h"
21 #include "mpp_enc_cfg.h"
22 
23 typedef struct {
24     RK_S32  a1;
25     RK_S32  a2;
26     RK_S32  qp_prev;
27     RK_S32  qs[15];
28     RK_S32  bits[15];
29     RK_S32  pos;
30     RK_S32  len;
31     RK_S32  zero_div;
32 } Vp8eLinReg;
33 
34 
35 typedef struct vp8e_feedback_t {
36     /* rc */
37     void *result;
38     RK_U32 hw_status; /* 0:corret, 1:error */
39 
40     RK_S32 qp_sum;
41     RK_S32 cp[10];
42     RK_S32 mad_count;
43     RK_S32 rlc_count;
44     RK_U32 out_strm_size;
45     RK_U32 out_hw_strm_size;
46     RK_S64 sse_sum;
47 } Vp8eFeedback;
48 
49 typedef struct vp8e_virture_buffer_t {
50     RK_S32 buffer_size;
51     RK_S32 bit_rate;     //MppEncRcCfg.bps_target
52     RK_S32 bps_max;
53     RK_S32 bps_min;
54     RK_S32 bit_per_pic;
55     RK_S32 pic_time_inc;
56     RK_S32 time_scale;
57     RK_S32 units_in_tic;
58     RK_S32 virtual_bit_cnt;
59     RK_S32 real_bit_cnt;
60     RK_S32 buffer_occupancy;
61     RK_S32 skip_frame_target;
62     RK_S32 skipped_frames;
63     RK_S32 bucket_fullness;
64     RK_S32 gop_rem;
65 } Vp8eVirBuf;
66 
67 typedef struct {
68     RK_U8  pic_rc_enable;
69     RK_U8  pic_skip;
70     RK_U8  frame_coded;
71     RK_S32 mb_per_pic;
72     RK_S32 mb_rows;
73     RK_S32 curr_frame_intra;
74     RK_S32 prev_frame_intra;
75     RK_S32 fixed_qp;
76     RK_S32 qp_hdr;
77     RK_S32 qp_min;
78     RK_S32 qp_max;
79     RK_S32 qp_hdr_prev;
80     RK_S32 fps_out_num;     //MppEncRcCfg.fps_out_num
81     RK_S32 fps_out_denom;  //MppEncRcCfg.fps_out_denom
82     RK_S32 fps_out;
83 
84     RK_S32 target_pic_size;
85     RK_S32 frame_bit_cnt;
86     RK_S32 gop_qp_sum;
87     RK_S32 gop_qp_div;
88     RK_S32 frame_cnt;
89     RK_S32 gop_len;
90     RK_S32 intra_qp_delta;
91     RK_S32 fixed_intra_qp;
92     RK_S32 mb_qp_adjustment;
93     RK_S32 intra_picture_rate;
94     RK_S32 golden_picture_rate;
95     RK_S32 altref_picture_rate;
96     RK_U32 time_inc;
97 
98     Vp8eLinReg lin_reg;
99     Vp8eLinReg r_error;
100     Vp8eVirBuf virbuf;
101 } Vp8eRc;
102 
103 typedef enum Vp8eSyntaxType_e {
104     VP8E_SYN_CFG,
105     VP8E_SYN_RC,
106 } Vp8eSyntaxType;
107 
108 typedef struct {
109     Vp8eSyntaxType type;
110     void *data;
111 } Vp8eSyntax;
112 #endif /*__VP8E_SYNTAX_H__*/
113