diff mbox series

[v2,1/6] media: coda: round up decoded buffer size for all codecs

Message ID 20200318183536.15779-2-p.zabel@pengutronix.de (mailing list archive)
State New, archived
Headers show
Series v4l2 JPEG helpers and CODA960 JPEG decoder | expand

Commit Message

Philipp Zabel March 18, 2020, 6:35 p.m. UTC
The BIT decoders always write 16x16 macroblocks. Align stride and height to
avoid spilling luma data into the top of the chroma planes.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
---
New in v2.
---
 drivers/media/platform/coda/coda-common.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/drivers/media/platform/coda/coda-common.c b/drivers/media/platform/coda/coda-common.c
index d0d093dd8f7c..46163e524c1e 100644
--- a/drivers/media/platform/coda/coda-common.c
+++ b/drivers/media/platform/coda/coda-common.c
@@ -637,8 +637,8 @@  static int coda_try_fmt_vid_cap(struct file *file, void *priv,
 	if (ret < 0)
 		return ret;
 
-	/* The h.264 decoder only returns complete 16x16 macroblocks */
-	if (codec && codec->src_fourcc == V4L2_PIX_FMT_H264) {
+	/* The decoders always write complete macroblocks */
+	if (ctx->inst_type == CODA_INST_DECODER) {
 		f->fmt.pix.height = round_up(f->fmt.pix.height, 16);
 		f->fmt.pix.bytesperline = round_up(f->fmt.pix.width, 16);
 		f->fmt.pix.sizeimage = f->fmt.pix.bytesperline *