Skip to content

Commit

Permalink
[hal_jpegd]: Add have_pp check
Browse files Browse the repository at this point in the history
Change-Id: Id9b9a5004d0bdc5fd88e084966ada360f575b1a7
Signed-off-by: Herman Chen <[email protected]>
  • Loading branch information
HermanChen committed Aug 23, 2021
1 parent 6da83e5 commit 549ef87
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 1 deletion.
2 changes: 2 additions & 0 deletions mpp/hal/vpu/jpegd/hal_jpegd_base.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ typedef struct JpegdHalCtx {
MppBufSlots frame_slots;
MppDev dev;
MppClientType dev_type;
RK_U32 codec_type;
void *regs;
MppBufferGroup group;
MppBuffer frame_buf;
Expand All @@ -55,6 +56,7 @@ typedef struct JpegdHalCtx {
RK_S32 pkt_fd; /* input stream's physical address(fd) */
RK_S32 frame_fd; /* output picture's physical address(fd) */

RK_U32 have_pp;
PPInfo pp_info;
} JpegdHalCtx;

Expand Down
12 changes: 11 additions & 1 deletion mpp/hal/vpu/jpegd/hal_jpegd_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,15 @@ void jpegd_write_qp_ac_dc_table(JpegdHalCtx *ctx,
return;
}

void jpegd_check_have_pp(JpegdHalCtx *ctx)
{
ctx->codec_type = mpp_get_vcodec_type();
ctx->have_pp = ((ctx->dev_type == VPU_CLIENT_VDPU1) &&
(ctx->codec_type & (1 << VPU_CLIENT_VDPU1_PP))) ||
((ctx->dev_type == VPU_CLIENT_VDPU2) &&
(ctx->codec_type & (1 << VPU_CLIENT_VDPU2_PP)));
}

MPP_RET jpegd_setup_output_fmt(JpegdHalCtx *ctx, JpegdSyntax *s, RK_S32 output)
{
jpegd_dbg_func("enter\n");
Expand All @@ -442,7 +451,8 @@ MPP_RET jpegd_setup_output_fmt(JpegdHalCtx *ctx, JpegdSyntax *s, RK_S32 output)
MppFrame frm = NULL;
MPP_RET ret = MPP_OK;

if (ctx->set_output_fmt_flag && (ctx->output_fmt != s->output_fmt)) {
if (ctx->have_pp && ctx->set_output_fmt_flag &&
ctx->output_fmt != s->output_fmt) {
MppFrameFormat fmt = MPP_FMT_BUTT;

/* Using pp to convert all format to yuv420sp */
Expand Down
1 change: 1 addition & 0 deletions mpp/hal/vpu/jpegd/hal_jpegd_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ RK_U32 jpegd_vdpu_tail_0xFF_patch(MppBuffer stream, RK_U32 length);
void jpegd_write_qp_ac_dc_table(JpegdHalCtx *ctx,
JpegdSyntax*syntax);

void jpegd_check_have_pp(JpegdHalCtx *ctx);
MPP_RET jpegd_setup_output_fmt(JpegdHalCtx *ctx, JpegdSyntax *syntax,
RK_S32 output);

Expand Down
1 change: 1 addition & 0 deletions mpp/hal/vpu/jpegd/hal_jpegd_vdpu1.c
Original file line number Diff line number Diff line change
Expand Up @@ -785,6 +785,7 @@ MPP_RET hal_jpegd_vdpu1_init(void *hal, MppHalCfg *cfg)
pp_info->pp_enable = 0;
pp_info->pp_in_fmt = PP_IN_FORMAT_YUV420SEMI;
pp_info->pp_out_fmt = PP_OUT_FORMAT_YUV420INTERLAVE;
jpegd_check_have_pp(JpegHalCtx);

JpegHalCtx->output_fmt = MPP_FMT_YUV420SP;
JpegHalCtx->set_output_fmt_flag = 0;
Expand Down
1 change: 1 addition & 0 deletions mpp/hal/vpu/jpegd/hal_jpegd_vdpu2.c
Original file line number Diff line number Diff line change
Expand Up @@ -771,6 +771,7 @@ MPP_RET hal_jpegd_vdpu2_init(void *hal, MppHalCfg *cfg)
pp_info->pp_enable = 0;
pp_info->pp_in_fmt = PP_IN_FORMAT_YUV420SEMI;
pp_info->pp_out_fmt = PP_OUT_FORMAT_YUV420INTERLAVE;
jpegd_check_have_pp(JpegHalCtx);

JpegHalCtx->output_fmt = MPP_FMT_YUV420SP;
JpegHalCtx->set_output_fmt_flag = 0;
Expand Down

0 comments on commit 549ef87

Please sign in to comment.