xref: /rockchip-linux_mpp/utils/mpi_enc_utils.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 __MPI_ENC_UTILS_H__
18 #define __MPI_ENC_UTILS_H__
19 
20 #include <stdio.h>
21 
22 #include "rk_venc_cmd.h"
23 #include "iniparser.h"
24 
25 typedef struct MpiEncTestArgs_t {
26     char                *file_input;
27     char                *file_output;
28     char                *file_cfg;
29     dictionary          *cfg_ini;
30 
31     MppCodingType       type;
32     MppCodingType       type_src;       /* for file source input */
33     MppFrameFormat      format;
34     RK_S32              frame_num;
35     RK_S32              loop_cnt;
36     RK_S32              nthreads;
37     RK_S32              frm_step;
38 
39     RK_S32              width;
40     RK_S32              height;
41     RK_S32              hor_stride;
42     RK_S32              ver_stride;
43 
44     /* -rc */
45     RK_S32              rc_mode;
46 
47     /* -bps */
48     RK_S32              bps_target;
49     RK_S32              bps_max;
50     RK_S32              bps_min;
51 
52     /* -fps */
53     RK_S32              fps_in_flex;
54     RK_S32              fps_in_num;
55     RK_S32              fps_in_den;
56     RK_S32              fps_out_flex;
57     RK_S32              fps_out_num;
58     RK_S32              fps_out_den;
59 
60     /* -qc */
61     RK_S32              qp_init;
62     RK_S32              qp_min;
63     RK_S32              qp_max;
64     RK_S32              qp_min_i;
65     RK_S32              qp_max_i;
66 
67     /* -fqc */
68     RK_S32              fqp_min_i;
69     RK_S32              fqp_min_p;
70     RK_S32              fqp_max_i;
71     RK_S32              fqp_max_p;
72 
73     /* -g gop mode */
74     RK_S32              gop_mode;
75     RK_S32              gop_len;
76     RK_S32              vi_len;
77 
78     /* -sm scene_mode */
79     RK_S32              scene_mode;
80     RK_S32              rc_container;
81     RK_S32              bias_i;
82     RK_S32              bias_p;
83 
84     /* -qpdd cu_qp_delta_depth */
85     RK_S32              cu_qp_delta_depth;
86     RK_S32              anti_flicker_str;
87     RK_S32              atf_str;
88     RK_S32              atr_str_i;
89     RK_S32              atr_str_p;
90     RK_S32              atl_str;
91     RK_S32              sao_str_i;
92     RK_S32              sao_str_p;
93     RK_S32              lambda_idx_p;
94     RK_S32              lambda_idx_i;
95     RK_S32              speed;
96     /* -dbe deblur enable flag
97      * -dbs deblur strength
98      */
99     RK_S32              deblur_en;
100     RK_S32              deblur_str;
101 
102     /* -v q runtime log disable flag */
103     RK_U32              quiet;
104     /* -v f runtime fps log flag */
105     RK_U32              trace_fps;
106     FpsCalc             fps;
107     RK_U32              psnr_en;
108     RK_U32              ssim_en;
109     char                *file_slt;
110     RK_U32              kmpp_en;
111 } MpiEncTestArgs;
112 
113 #ifdef __cplusplus
114 extern "C" {
115 #endif
116 
117 RK_S32 mpi_enc_width_default_stride(RK_S32 width, MppFrameFormat fmt);
118 
119 /*
120  * gop_mode
121  * 0     - default IPPPP gop
122  * 1 ~ 3 - tsvc2 ~ tsvc4
123  * >=  4 - smart gop mode
124  */
125 MPP_RET mpi_enc_gen_ref_cfg(MppEncRefCfg ref, RK_S32 gop_mode);
126 MPP_RET mpi_enc_gen_smart_gop_ref_cfg(MppEncRefCfg ref, RK_S32 gop_len, RK_S32 vi_len);
127 MPP_RET mpi_enc_gen_osd_data(MppEncOSDData *osd_data, MppBufferGroup group,
128                              RK_U32 width, RK_U32 height, RK_U32 frame_cnt);
129 MPP_RET mpi_enc_gen_osd_plt(MppEncOSDPlt *osd_plt, RK_U32 frame_cnt);
130 
131 MpiEncTestArgs *mpi_enc_test_cmd_get(void);
132 MPP_RET mpi_enc_test_cmd_update_by_args(MpiEncTestArgs* cmd, int argc, char **argv);
133 MPP_RET mpi_enc_test_cmd_put(MpiEncTestArgs* cmd);
134 
135 MPP_RET mpi_enc_test_cmd_show_opt(MpiEncTestArgs* cmd);
136 
137 #ifdef __cplusplus
138 }
139 #endif
140 
141 #endif /*__MPI_ENC_UTILS_H__*/
142