summaryrefslogtreecommitdiffstats
path: root/drivers/staging
diff options
context:
space:
mode:
authorEzequiel Garcia <ezequiel@collabora.com>2019-04-25 03:12:24 -0400
committerMauro Carvalho Chehab <mchehab+samsung@kernel.org>2019-05-28 12:09:46 -0400
commit92cd4307baf3f08a9bdc5105aa427815a3e1d5d1 (patch)
tree2e3f19c9eb3c73bdd4f3622e03fd8bc5aa76a461 /drivers/staging
parent365f3bfc5f4b4bd9a3fa2b2573b881794199e22a (diff)
media: rockchip/vpu: Cleanup macroblock alignment
We need to make the macrobock alignment generic, in order to support multiple codecs. Signed-off-by: Ezequiel Garcia <ezequiel@collabora.com> Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Diffstat (limited to 'drivers/staging')
-rw-r--r--drivers/staging/media/rockchip/vpu/rockchip_vpu_enc.c20
1 files changed, 8 insertions, 12 deletions
diff --git a/drivers/staging/media/rockchip/vpu/rockchip_vpu_enc.c b/drivers/staging/media/rockchip/vpu/rockchip_vpu_enc.c
index 7fe104b75ba0..aef939846240 100644
--- a/drivers/staging/media/rockchip/vpu/rockchip_vpu_enc.c
+++ b/drivers/staging/media/rockchip/vpu/rockchip_vpu_enc.c
@@ -204,8 +204,8 @@ vidioc_try_fmt_cap_mplane(struct file *file, void *priv, struct v4l2_format *f)
fmt->frmsize.min_height,
fmt->frmsize.max_height);
/* Round up to macroblocks. */
- pix_mp->width = round_up(pix_mp->width, JPEG_MB_DIM);
- pix_mp->height = round_up(pix_mp->height, JPEG_MB_DIM);
+ pix_mp->width = round_up(pix_mp->width, fmt->frmsize.step_width);
+ pix_mp->height = round_up(pix_mp->height, fmt->frmsize.step_height);
/*
* For compressed formats the application can specify
@@ -249,8 +249,8 @@ vidioc_try_fmt_out_mplane(struct file *file, void *priv, struct v4l2_format *f)
ctx->vpu_dst_fmt->frmsize.min_height,
ctx->vpu_dst_fmt->frmsize.max_height);
/* Round up to macroblocks. */
- width = round_up(width, JPEG_MB_DIM);
- height = round_up(height, JPEG_MB_DIM);
+ width = round_up(width, ctx->vpu_dst_fmt->frmsize.step_width);
+ height = round_up(height, ctx->vpu_dst_fmt->frmsize.step_height);
/* Fill remaining fields */
v4l2_fill_pixfmt_mp(pix_mp, fmt->fourcc, width, height);
@@ -339,10 +339,8 @@ vidioc_s_fmt_out_mplane(struct file *file, void *priv, struct v4l2_format *f)
ctx->dst_fmt.height = pix_mp->height;
vpu_debug(0, "OUTPUT codec mode: %d\n", ctx->vpu_src_fmt->codec_mode);
- vpu_debug(0, "fmt - w: %d, h: %d, mb - w: %d, h: %d\n",
- pix_mp->width, pix_mp->height,
- JPEG_MB_WIDTH(pix_mp->width),
- JPEG_MB_HEIGHT(pix_mp->height));
+ vpu_debug(0, "fmt - w: %d, h: %d\n",
+ pix_mp->width, pix_mp->height);
return 0;
}
@@ -381,10 +379,8 @@ vidioc_s_fmt_cap_mplane(struct file *file, void *priv, struct v4l2_format *f)
ctx->dst_fmt = *pix_mp;
vpu_debug(0, "CAPTURE codec mode: %d\n", ctx->vpu_dst_fmt->codec_mode);
- vpu_debug(0, "fmt - w: %d, h: %d, mb - w: %d, h: %d\n",
- pix_mp->width, pix_mp->height,
- JPEG_MB_WIDTH(pix_mp->width),
- JPEG_MB_HEIGHT(pix_mp->height));
+ vpu_debug(0, "fmt - w: %d, h: %d\n",
+ pix_mp->width, pix_mp->height);
/*
* Current raw format might have become invalid with newly