[vpu_api_legacy]: support fbc fmt setup

Signed-off-by: Chen Jinsen <kevin.chen@rock-chips.com>
Change-Id: If43694ce50a0f163776a260a1a919d2f9d12a4d0
This commit is contained in:
Chen Jinsen
2021-03-13 15:59:47 +08:00
parent 23fa2f0bd3
commit a26e71291e
2 changed files with 10 additions and 2 deletions

View File

@@ -92,6 +92,7 @@ typedef enum VPU_API_CMD {
VPU_API_GET_FRAME_INFO, VPU_API_GET_FRAME_INFO,
VPU_API_SET_OUTPUT_BLOCK, VPU_API_SET_OUTPUT_BLOCK,
VPU_API_GET_EOS_STATUS, VPU_API_GET_EOS_STATUS,
VPU_API_SET_OUTPUT_MODE,
/* get sps/pps header */ /* get sps/pps header */
VPU_API_GET_EXTRA_INFO = 0x200, VPU_API_GET_EXTRA_INFO = 0x200,

View File

@@ -308,6 +308,10 @@ static RK_S32 init_frame_info(VpuCodecContext *ctx,
{ {
RK_S32 ret = -1; RK_S32 ret = -1;
MppFrame frame = NULL; MppFrame frame = NULL;
RK_U32 fbcOutFmt = 0;
if (ctx->private_data)
fbcOutFmt = *(RK_U32 *)ctx->private_data;
if (ctx->extra_cfg.bit_depth if (ctx->extra_cfg.bit_depth
|| ctx->extra_cfg.yuv_format) { || ctx->extra_cfg.yuv_format) {
@@ -335,7 +339,7 @@ static RK_S32 init_frame_info(VpuCodecContext *ctx,
mpp_frame_set_width(frame, p->ImgWidth); mpp_frame_set_width(frame, p->ImgWidth);
mpp_frame_set_height(frame, p->ImgHeight); mpp_frame_set_height(frame, p->ImgHeight);
mpp_frame_set_fmt(frame, (MppFrameFormat)p->CodecType); mpp_frame_set_fmt(frame, (MppFrameFormat)(p->CodecType | fbcOutFmt));
ret = mpi->control(mpp_ctx, MPP_DEC_SET_FRAME_INFO, (MppParam)frame); ret = mpi->control(mpp_ctx, MPP_DEC_SET_FRAME_INFO, (MppParam)frame);
/* output the parameters used */ /* output the parameters used */
@@ -521,7 +525,7 @@ static void setup_VPU_FRAME_from_mpp_frame(VPU_FRAME *vframe, MppFrame mframe)
vframe->ErrorInfo = mpp_frame_get_errinfo(mframe) | mpp_frame_get_discard(mframe); vframe->ErrorInfo = mpp_frame_get_errinfo(mframe) | mpp_frame_get_discard(mframe);
vframe->ShowTime.TimeHigh = (RK_U32)(pts >> 32); vframe->ShowTime.TimeHigh = (RK_U32)(pts >> 32);
vframe->ShowTime.TimeLow = (RK_U32)pts; vframe->ShowTime.TimeLow = (RK_U32)pts;
switch (mpp_frame_get_fmt(mframe)) { switch (mpp_frame_get_fmt(mframe) & MPP_FRAME_FMT_MASK) {
case MPP_FMT_YUV420SP: { case MPP_FMT_YUV420SP: {
vframe->ColorType = VPU_OUTPUT_FORMAT_YUV420_SEMIPLANAR; vframe->ColorType = VPU_OUTPUT_FORMAT_YUV420_SEMIPLANAR;
vframe->OutputWidth = 0x20; vframe->OutputWidth = 0x20;
@@ -1452,6 +1456,9 @@ RK_S32 VpuApiLegacy::control(VpuCodecContext *ctx, VPU_API_CMD cmd, void *param)
*((VPU_GENERIC *)param) = vpug; *((VPU_GENERIC *)param) = vpug;
mpicmd = MPI_CMD_BUTT; mpicmd = MPI_CMD_BUTT;
} break; } break;
case VPU_API_SET_OUTPUT_MODE: {
mpicmd = MPP_DEC_SET_OUTPUT_FORMAT;
} break;
case VPU_API_SET_IMMEDIATE_OUT: { case VPU_API_SET_IMMEDIATE_OUT: {
mpicmd = MPP_DEC_SET_IMMEDIATE_OUT; mpicmd = MPP_DEC_SET_IMMEDIATE_OUT;
} break; } break;