linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Philipp Zabel <p.zabel@pengutronix.de>
To: linux-media@vger.kernel.org
Cc: Hans Verkuil <hverkuil@xs4all.nl>,
	Ezequiel Garcia <ezequiel@collabora.com>,
	Nicolas Dufresne <nicolas.dufresne@collabora.com>,
	Tomasz Figa <tfiga@chromium.org>, Jonas Karlman <jonas@kwiboo.se>,
	Paul Kocialkowski <paul.kocialkowski@bootlin.com>,
	Boris Brezillon <boris.brezillon@collabora.com>,
	kernel@pengutronix.de
Subject: [PATCH 2/2] media: hantro: h264: per-slice num_ref_idx_l[01]_active override
Date: Thu,  5 Sep 2019 12:15:33 +0200	[thread overview]
Message-ID: <20190905101533.525-2-p.zabel@pengutronix.de> (raw)
In-Reply-To: <20190905101533.525-1-p.zabel@pengutronix.de>

If the slice header had the num_ref_idx_active_override flag set, we
should use the num_ref_idx_l[01]_active_minus1 fields instead of the
defaults from the PPS.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
---
 drivers/staging/media/hantro/hantro_g1_h264_dec.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/media/hantro/hantro_g1_h264_dec.c b/drivers/staging/media/hantro/hantro_g1_h264_dec.c
index 7ab534936843..544cf92ab62c 100644
--- a/drivers/staging/media/hantro/hantro_g1_h264_dec.c
+++ b/drivers/staging/media/hantro/hantro_g1_h264_dec.c
@@ -28,6 +28,8 @@ static void set_params(struct hantro_ctx *ctx)
 	const struct v4l2_ctrl_h264_pps *pps = ctrls->pps;
 	struct vb2_v4l2_buffer *src_buf = hantro_get_src_buf(ctx);
 	struct hantro_dev *vpu = ctx->dev;
+	unsigned char refidx0_active;
+	unsigned char refidx1_active;
 	u32 reg;
 
 	/* Decoder control register 0. */
@@ -101,9 +103,16 @@ static void set_params(struct hantro_ctx *ctx)
 	vdpu_write_relaxed(vpu, reg, G1_REG_DEC_CTRL5);
 
 	/* Decoder control register 6. */
+	if (sps->flags & V4L2_H264_SLICE_FLAG_NUM_REF_IDX_ACTIVE_OVERRIDE) {
+		refidx0_active = slices[0].num_ref_idx_l0_active_minus1 + 1;
+		refidx1_active = slices[0].num_ref_idx_l1_active_minus1 + 1;
+	} else {
+		refidx0_active = pps->num_ref_idx_l0_default_active_minus1 + 1;
+		refidx1_active = pps->num_ref_idx_l1_default_active_minus1 + 1;
+	}
 	reg = G1_REG_DEC_CTRL6_PPS_ID(slices[0].pic_parameter_set_id) |
-	      G1_REG_DEC_CTRL6_REFIDX0_ACTIVE(pps->num_ref_idx_l0_default_active_minus1 + 1) |
-	      G1_REG_DEC_CTRL6_REFIDX1_ACTIVE(pps->num_ref_idx_l1_default_active_minus1 + 1) |
+	      G1_REG_DEC_CTRL6_REFIDX0_ACTIVE(refidx0_active) |
+	      G1_REG_DEC_CTRL6_REFIDX1_ACTIVE(refidx1_active) |
 	      G1_REG_DEC_CTRL6_POC_LENGTH(slices[0].pic_order_cnt_bit_size);
 	vdpu_write_relaxed(vpu, reg, G1_REG_DEC_CTRL6);
 
-- 
2.20.1


  reply	other threads:[~2019-09-05 10:15 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-05 10:15 [PATCH 1/2] media: uapi: h264: Add num_ref_idx_active_override_flag Philipp Zabel
2019-09-05 10:15 ` Philipp Zabel [this message]
2019-09-05 10:34   ` [PATCH 2/2] media: hantro: h264: per-slice num_ref_idx_l[01]_active override Tomasz Figa
2019-09-05 11:04     ` Philipp Zabel
2019-09-05 10:31 ` [PATCH 1/2] media: uapi: h264: Add num_ref_idx_active_override_flag Tomasz Figa
2019-09-05 10:39   ` Philipp Zabel
2019-09-05 14:17     ` Nicolas Dufresne
2019-09-09  7:09       ` Tomasz Figa
2019-09-09  7:30         ` Philipp Zabel
2019-09-09  9:40           ` Tomasz Figa
2019-10-03 21:06             ` Paul Kocialkowski
2019-10-03 21:07 ` Paul Kocialkowski

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=20190905101533.525-2-p.zabel@pengutronix.de \
    --to=p.zabel@pengutronix.de \
    --cc=boris.brezillon@collabora.com \
    --cc=ezequiel@collabora.com \
    --cc=hverkuil@xs4all.nl \
    --cc=jonas@kwiboo.se \
    --cc=kernel@pengutronix.de \
    --cc=linux-media@vger.kernel.org \
    --cc=nicolas.dufresne@collabora.com \
    --cc=paul.kocialkowski@bootlin.com \
    --cc=tfiga@chromium.org \
    /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;
as well as URLs for NNTP newsgroup(s).