feat[mpi_enc_test]: Support enc for kmpp flow

Add param -kmpp to enable kmpp.

Change-Id: Id0e0dd64cca8f4da29fa7048f22beb3918162bd6
Signed-off-by: Yandong Lin <yandong.lin@rock-chips.com>
This commit is contained in:
Yandong Lin
2024-12-30 21:51:13 +08:00
committed by Herman Chen
parent 6bcfb2c0f7
commit 5b940db958
3 changed files with 67 additions and 1 deletions

View File

@@ -23,6 +23,7 @@
#include <string.h>
#include <math.h>
#include "rk_mpi.h"
#include "rk_venc_kcfg.h"
#include "mpp_env.h"
#include "mpp_mem.h"
@@ -99,6 +100,8 @@ typedef struct {
CamSource *cam_ctx;
MppEncRoiCtx roi_ctx;
MppVencKcfg init_kcfg;
// resources
size_t header_size;
size_t frame_size;
@@ -199,6 +202,43 @@ static RK_S32 get_mdinfo_size(MpiEncTestData *p, MppCodingType type)
return md_size;
}
static MPP_RET kmpp_cfg_init(MpiEncMultiCtxInfo *info)
{
MppVencKcfg init_kcfg = NULL;
MpiEncTestData *p = &info->ctx;
MPP_RET ret = MPP_NOK;
mpp_venc_kcfg_init(&init_kcfg, MPP_VENC_KCFG_TYPE_INIT);
if (!init_kcfg) {
mpp_err_f("kmpp_venc_init_cfg_init failed\n");
return ret;
}
p->init_kcfg = init_kcfg;
mpp_venc_kcfg_set_u32(init_kcfg, "type", MPP_CTX_ENC);
mpp_venc_kcfg_set_u32(init_kcfg, "coding", p->type);
mpp_venc_kcfg_set_s32(init_kcfg, "chan_id", 0);
mpp_venc_kcfg_set_s32(init_kcfg, "online", 0);
mpp_venc_kcfg_set_u32(init_kcfg, "buf_size", 0);
mpp_venc_kcfg_set_u32(init_kcfg, "max_strm_cnt", 0);
mpp_venc_kcfg_set_u32(init_kcfg, "shared_buf_en", 0);
mpp_venc_kcfg_set_u32(init_kcfg, "smart_en", 0);
mpp_venc_kcfg_set_u32(init_kcfg, "max_width", p->width);
mpp_venc_kcfg_set_u32(init_kcfg, "max_height", p->height);
mpp_venc_kcfg_set_u32(init_kcfg, "max_lt_cnt", 0);
mpp_venc_kcfg_set_u32(init_kcfg, "qpmap_en", 0);
mpp_venc_kcfg_set_u32(init_kcfg, "chan_dup", 0);
mpp_venc_kcfg_set_u32(init_kcfg, "tmvp_enable", 0);
mpp_venc_kcfg_set_u32(init_kcfg, "only_smartp", 0);
ret = p->mpi->control(p->ctx, MPP_SET_VENC_INIT_KCFG, init_kcfg);
if (ret)
mpp_err_f("mpi control set kmpp enc cfg failed ret %d\n", ret);
return ret;
}
MPP_RET test_ctx_init(MpiEncMultiCtxInfo *info)
{
MpiEncTestArgs *cmd = info->cmd;
@@ -1049,6 +1089,9 @@ void *enc_test(void *arg)
goto MPP_TEST_OUT;
}
if (cmd->kmpp_en)
kmpp_cfg_init(info);
ret = mpp_init(p->ctx, MPP_CTX_ENC, p->type);
if (ret) {
mpp_err("mpp_init failed ret %d\n", ret);
@@ -1134,6 +1177,8 @@ MPP_TEST_OUT:
mpp_enc_roi_deinit(p->roi_ctx);
p->roi_ctx = NULL;
}
if (p->init_kcfg)
mpp_venc_kcfg_deinit(p->init_kcfg);
test_ctx_deinit(p);