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 38 RK_S32 width; 39 RK_S32 height; 40 RK_S32 hor_stride; 41 RK_S32 ver_stride; 42 43 /* -rc */ 44 RK_S32 rc_mode; 45 46 /* -bps */ 47 RK_S32 bps_target; 48 RK_S32 bps_max; 49 RK_S32 bps_min; 50 51 /* -fps */ 52 RK_S32 fps_in_flex; 53 RK_S32 fps_in_num; 54 RK_S32 fps_in_den; 55 RK_S32 fps_out_flex; 56 RK_S32 fps_out_num; 57 RK_S32 fps_out_den; 58 59 /* -qc */ 60 RK_S32 qp_init; 61 RK_S32 qp_min; 62 RK_S32 qp_max; 63 RK_S32 qp_min_i; 64 RK_S32 qp_max_i; 65 66 /* -g gop mode */ 67 RK_S32 gop_mode; 68 RK_S32 gop_len; 69 RK_S32 vi_len; 70 71 /* -v q runtime log disable flag */ 72 RK_U32 quiet; 73 /* -v f runtime fps log flag */ 74 RK_U32 trace_fps; 75 FpsCalc fps; 76 RK_U32 psnr_en; 77 RK_U32 ssim_en; 78 char *file_slt; 79 } MpiEncTestArgs; 80 81 #ifdef __cplusplus 82 extern "C" { 83 #endif 84 85 RK_S32 mpi_enc_width_default_stride(RK_S32 width, MppFrameFormat fmt); 86 87 /* 88 * gop_mode 89 * 0 - default IPPPP gop 90 * 1 ~ 3 - tsvc2 ~ tsvc4 91 * >= 4 - smart gop mode 92 */ 93 MPP_RET mpi_enc_gen_ref_cfg(MppEncRefCfg ref, RK_S32 gop_mode); 94 MPP_RET mpi_enc_gen_smart_gop_ref_cfg(MppEncRefCfg ref, RK_S32 gop_len, RK_S32 vi_len); 95 MPP_RET mpi_enc_gen_osd_data(MppEncOSDData *osd_data, MppBufferGroup group, 96 RK_U32 width, RK_U32 height, RK_U32 frame_cnt); 97 MPP_RET mpi_enc_gen_osd_plt(MppEncOSDPlt *osd_plt, RK_U32 frame_cnt); 98 99 MpiEncTestArgs *mpi_enc_test_cmd_get(void); 100 MPP_RET mpi_enc_test_cmd_update_by_args(MpiEncTestArgs* cmd, int argc, char **argv); 101 MPP_RET mpi_enc_test_cmd_put(MpiEncTestArgs* cmd); 102 103 MPP_RET mpi_enc_test_cmd_show_opt(MpiEncTestArgs* cmd); 104 105 #ifdef __cplusplus 106 } 107 #endif 108 109 #endif /*__MPI_ENC_UTILS_H__*/ 110