Skip to content

Commit

Permalink
media: mediatek: vcodec: Fix bitstream crop information error
Browse files Browse the repository at this point in the history
Usually, the real bitstream width and height will set to driver
by vidioc_s_fmt, and vidioc_try_fmt() does align to get the
buffer width and height, driver calculate the encoded bitstream
crop information through them. The aligned resolution will be set
as real resolution now if user didn't set crop info by
V4L2_SEL_TGT_CROP, and the encoded bitstream may exist green line
because of crop information error.

Fixs: 'b6c57d313f5f8 ("media: mtk-vcodec: venc: remove redundant code")'

Signed-off-by: Irui Wang <[email protected]>
Signed-off-by: Hans Verkuil <[email protected]>
Signed-off-by: Mauro Carvalho Chehab <[email protected]>
  • Loading branch information
irui-wang authored and mchehab committed Aug 30, 2022
1 parent 223afdf commit cd61f3c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions drivers/media/platform/mediatek/vcodec/mtk_vcodec_enc.c
Original file line number Diff line number Diff line change
Expand Up @@ -503,13 +503,13 @@ static int vidioc_venc_s_fmt_out(struct file *file, void *priv,
f->fmt.pix.pixelformat = fmt->fourcc;
}

ret = vidioc_try_fmt_out(ctx, f, fmt);
q_data->visible_width = f->fmt.pix_mp.width;
q_data->visible_height = f->fmt.pix_mp.height;
q_data->fmt = fmt;
ret = vidioc_try_fmt_out(ctx, f, q_data->fmt);
if (ret)
return ret;

q_data->fmt = fmt;
q_data->visible_width = f->fmt.pix_mp.width;
q_data->visible_height = f->fmt.pix_mp.height;
q_data->coded_width = f->fmt.pix_mp.width;
q_data->coded_height = f->fmt.pix_mp.height;

Expand Down

0 comments on commit cd61f3c

Please sign in to comment.