diff --git a/test/mpi_enc_test.c b/test/mpi_enc_test.c index 60b4b576..2bc874d7 100644 --- a/test/mpi_enc_test.c +++ b/test/mpi_enc_test.c @@ -98,6 +98,7 @@ int mpi_enc_test(MpiEncTestCmd *cmd) fp_input = fopen(cmd->file_input, "rb"); if (NULL == fp_input) { mpp_err("failed to open input file %s\n", cmd->file_input); + ret = MPP_ERR_OPEN_FILE; goto MPP_TEST_OUT; } } @@ -106,6 +107,7 @@ int mpi_enc_test(MpiEncTestCmd *cmd) fp_output = fopen(cmd->file_output, "w+b"); if (NULL == fp_output) { mpp_err("failed to open output file %s\n", cmd->file_output); + ret = MPP_ERR_OPEN_FILE; goto MPP_TEST_OUT; } } @@ -153,6 +155,7 @@ int mpi_enc_test(MpiEncTestCmd *cmd) } memset(&mpp_cfg, 0, sizeof(mpp_cfg)); + mpp_cfg.size = sizeof(mpp_cfg); mpp_cfg.width = width; mpp_cfg.height = height; mpp_cfg.format = ENC_INPUT_YUV420_PLANAR; diff --git a/test/vpu_api_test.c b/test/vpu_api_test.c index 406abbac..7417251d 100644 --- a/test/vpu_api_test.c +++ b/test/vpu_api_test.c @@ -254,15 +254,6 @@ static RK_S32 vpu_encode_demo(VpuApiDemoCmdContext_t *cmd) RK_U32 w_align = 0; RK_U32 h_align = 0; -#ifdef FOR_TEST_ENCODE - ctx = (struct VpuCodecContext*)malloc(sizeof(struct VpuCodecContext)); - if (!ctx) { - mpp_err("Input context has not been properly allocated"); - return -1; - } - memset(ctx, 0, sizeof(struct VpuCodecContext)); -#endif - int Format = ENC_INPUT_YUV420_PLANAR; if (cmd == NULL) { @@ -301,6 +292,13 @@ static RK_S32 vpu_encode_demo(VpuApiDemoCmdContext_t *cmd) } #ifdef FOR_TEST_ENCODE + ctx = (struct VpuCodecContext*)malloc(sizeof(struct VpuCodecContext)); + if (!ctx) { + mpp_err("Input context has not been properly allocated"); + return -1; + } + memset(ctx, 0, sizeof(struct VpuCodecContext)); + ctx->videoCoding = OMX_RK_VIDEO_CodingAVC; ctx->codecType = CODEC_ENCODER; ctx->width = cmd->width; @@ -370,11 +368,20 @@ static RK_S32 vpu_encode_demo(VpuApiDemoCmdContext_t *cmd) fflush(pOutFile); } - ctx->control(ctx, VPU_API_ENC_SETFORMAT, &Format); + ret = ctx->control(ctx, VPU_API_ENC_SETFORMAT, &Format); + if (ret) + mpp_err("VPU_API_ENC_SETFORMAT ret %d\n", ret); + + ret = ctx->control(ctx, VPU_API_ENC_GETCFG, enc_param); + if (ret) + mpp_log("VPU_API_ENC_GETCFG ret %d\n", ret); - ctx->control(ctx, VPU_API_ENC_GETCFG, enc_param); enc_param->rc_mode = 1; - ctx->control(ctx, VPU_API_ENC_SETCFG, enc_param); + + ret = ctx->control(ctx, VPU_API_ENC_SETCFG, enc_param); + if (ret) + mpp_log("VPU_API_ENC_SETCFG ret %d\n", ret); + /* ** vpu api encode process. */