xref: /rockchip-linux_mpp/mpp/codec/inc/rc/rc_vepu.h (revision 437bfbeb9567cca9cd9080e3f6954aa9d6a94f18)
1 /*
2  * Copyright 2016 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 __RC_VEPU_H__
18 #define __RC_VEPU_H__
19 
20 #include "rk_type.h"
21 
22 #define VEPU_BLK_RC_CTRL_LEVELS         7
23 #define VEPU_BLK_RC_CHECK_POINTS_MAX    10
24 
25 typedef struct RcVepuSet_t {
26     RK_S32  qp_init;
27     RK_S32  qp_min;
28     RK_S32  qp_max;
29 
30     RK_S32  mad_qp_delta;
31     RK_S32  mad_threshold;
32 
33     /*
34      * cp = checkpoint
35      *
36      * vepu1 and vepu2 use check point to control qp change accoring to runtime
37      * bit rate change in one frame.
38      *
39      * cp_distance_mbs defines how many the mb number between two checkpoints
40      *
41      * cp_target define the target bitrate on each checkpoint
42      *
43      * target_error and delta_qp define the qp delta value on the checkpoint when
44      * the bitrate error different to cp_target is happened.
45      */
46     RK_S32  cp_distance_mbs;
47     RK_S32  cp_target[VEPU_BLK_RC_CHECK_POINTS_MAX];
48     RK_S32  target_error[VEPU_BLK_RC_CTRL_LEVELS];
49     RK_S32  delta_qp[VEPU_BLK_RC_CTRL_LEVELS];
50 } RcVepuSet;
51 
52 typedef struct RcVepuRet_t {
53     RK_S32  stream_size;
54 
55     RK_S32  qp_sum;
56     RK_S32  mad_count;
57     RK_S32  rlc_count;
58 
59     RK_S32  cp_bits[VEPU_BLK_RC_CHECK_POINTS_MAX];
60 } RcVepuRet;
61 
62 #endif /* __RC_VEPU_H__ */
63