public inbox for linux-staging@lists.linux.dev
 help / color / mirror / Atom feed
From: Jernej Skrabec <jernej.skrabec@gmail.com>
To: ezequiel@vanguardiasur.com.ar, p.zabel@pengutronix.de
Cc: mchehab@kernel.org, hverkuil-cisco@xs4all.nl,
	benjamin.gaignard@collabora.com, nicolas.dufresne@collabora.com,
	gregkh@linuxfoundation.org, linux-media@vger.kernel.org,
	linux-staging@lists.linux.dev,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, linux-rockchip@lists.infradead.org,
	Jernej Skrabec <jernej.skrabec@gmail.com>
Subject: [PATCH v2 5/7] media: hantro: postproc: Properly calculate chroma offset
Date: Thu, 16 Jun 2022 22:25:11 +0200	[thread overview]
Message-ID: <20220616202513.351039-6-jernej.skrabec@gmail.com> (raw)
In-Reply-To: <20220616202513.351039-1-jernej.skrabec@gmail.com>

Currently chroma offset calculation assumes only 1 byte per luma, with
no consideration for stride.

Take necessary information from destination pixel format which makes
calculation completely universal.

Signed-off-by: Jernej Skrabec <jernej.skrabec@gmail.com>
---
 drivers/staging/media/hantro/hantro_postproc.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/media/hantro/hantro_postproc.c b/drivers/staging/media/hantro/hantro_postproc.c
index 8933b4af73ed..a0928c508434 100644
--- a/drivers/staging/media/hantro/hantro_postproc.c
+++ b/drivers/staging/media/hantro/hantro_postproc.c
@@ -113,12 +113,14 @@ static void hantro_postproc_g2_enable(struct hantro_ctx *ctx)
 {
 	struct hantro_dev *vpu = ctx->dev;
 	struct vb2_v4l2_buffer *dst_buf;
-	size_t chroma_offset = ctx->dst_fmt.width * ctx->dst_fmt.height;
 	int down_scale = down_scale_factor(ctx);
+	size_t chroma_offset;
 	dma_addr_t dst_dma;
 
 	dst_buf = hantro_get_dst_buf(ctx);
 	dst_dma = vb2_dma_contig_plane_dma_addr(&dst_buf->vb2_buf, 0);
+	chroma_offset = ctx->dst_fmt.plane_fmt[0].bytesperline *
+			ctx->dst_fmt.height;
 
 	if (down_scale) {
 		hantro_reg_write(vpu, &g2_down_scale_e, 1);
-- 
2.36.1


  parent reply	other threads:[~2022-06-16 20:25 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-16 20:25 [PATCH v2 0/7] media: hantro: Add 10-bit support Jernej Skrabec
2022-06-16 20:25 ` [PATCH v2 1/7] media: Add P010 tiled format Jernej Skrabec
2022-06-28 19:05   ` Ezequiel Garcia
2022-06-16 20:25 ` [PATCH v2 2/7] media: hantro: Support format filtering by depth Jernej Skrabec
2022-06-29 19:14   ` Ezequiel Garcia
2022-06-16 20:25 ` [PATCH v2 3/7] media: hantro: postproc: Fix buffer size calculation Jernej Skrabec
2022-06-28 15:54   ` Ezequiel Garcia
2022-06-28 16:13     ` Jernej Škrabec
2022-06-28 20:06       ` Nicolas Dufresne
2022-06-29 17:01         ` Ezequiel Garcia
2022-06-16 20:25 ` [PATCH v2 4/7] media: hantro: postproc: Fix legacy regs configuration Jernej Skrabec
2022-06-16 20:25 ` Jernej Skrabec [this message]
2022-06-29 19:14   ` [PATCH v2 5/7] media: hantro: postproc: Properly calculate chroma offset Ezequiel Garcia
2022-06-16 20:25 ` [PATCH v2 6/7] media: hantro: Store VP9 bit depth in context Jernej Skrabec
2022-06-28 21:06   ` Ezequiel Garcia
2022-06-29 19:17   ` Ezequiel Garcia
2022-06-16 20:25 ` [PATCH v2 7/7] media: hantro: sunxi: Enable 10-bit decoding Jernej Skrabec
2022-06-29 19:19   ` Ezequiel Garcia
2022-06-17 12:04 ` [PATCH v2 0/7] media: hantro: Add 10-bit support Benjamin Gaignard

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220616202513.351039-6-jernej.skrabec@gmail.com \
    --to=jernej.skrabec@gmail.com \
    --cc=benjamin.gaignard@collabora.com \
    --cc=ezequiel@vanguardiasur.com.ar \
    --cc=gregkh@linuxfoundation.org \
    --cc=hverkuil-cisco@xs4all.nl \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=linux-staging@lists.linux.dev \
    --cc=mchehab@kernel.org \
    --cc=nicolas.dufresne@collabora.com \
    --cc=p.zabel@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox