[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190822194500.2071-7-jernej.skrabec@siol.net>
Date: Thu, 22 Aug 2019 21:44:58 +0200
From: Jernej Skrabec <jernej.skrabec@...l.net>
To: mchehab@...nel.org, hverkuil-cisco@...all.nl,
paul.kocialkowski@...tlin.com, mripard@...nel.org
Cc: pawel@...iak.com, m.szyprowski@...sung.com,
kyungmin.park@...sung.com, tfiga@...omium.org, wens@...e.org,
acourbot@...omium.org, gregkh@...uxfoundation.org,
jernej.skrabec@...l.net, linux-media@...r.kernel.org,
linux-kernel@...r.kernel.org, devel@...verdev.osuosl.org,
linux-arm-kernel@...ts.infradead.org, ezequiel@...labora.com,
jonas@...boo.se
Subject: [PATCH 6/8] media: cedrus: h264: Support multiple slices per frame
With recent changes, support for decoding multi-slice frames can be
easily added now.
Signal VPU if current slice is first in frame or not and add information
about first macroblock coordinates.
Signed-off-by: Jernej Skrabec <jernej.skrabec@...l.net>
---
drivers/staging/media/sunxi/cedrus/cedrus_h264.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/drivers/staging/media/sunxi/cedrus/cedrus_h264.c b/drivers/staging/media/sunxi/cedrus/cedrus_h264.c
index d6a782703c9b..b7260cfeb6f4 100644
--- a/drivers/staging/media/sunxi/cedrus/cedrus_h264.c
+++ b/drivers/staging/media/sunxi/cedrus/cedrus_h264.c
@@ -301,6 +301,8 @@ static void cedrus_set_params(struct cedrus_ctx *ctx,
dma_addr_t src_buf_addr;
u32 offset = slice->header_bit_size;
u32 len = (slice->size * 8) - offset;
+ unsigned int pic_width_in_mbs;
+ bool mbaff_pic;
u32 reg;
cedrus_write(dev, VE_H264_VLD_LEN, len);
@@ -370,12 +372,19 @@ static void cedrus_set_params(struct cedrus_ctx *ctx,
reg |= VE_H264_SPS_DIRECT_8X8_INFERENCE;
cedrus_write(dev, VE_H264_SPS, reg);
+ mbaff_pic = !(slice->flags & V4L2_H264_SLICE_FLAG_FIELD_PIC) &&
+ (sps->flags & V4L2_H264_SPS_FLAG_MB_ADAPTIVE_FRAME_FIELD);
+ pic_width_in_mbs = sps->pic_width_in_mbs_minus1 + 1;
+
// slice parameters
reg = 0;
+ reg |= ((slice->first_mb_in_slice % pic_width_in_mbs) & 0xff) << 24;
+ reg |= (((slice->first_mb_in_slice / pic_width_in_mbs) * (mbaff_pic + 1)) & 0xff) << 16;
reg |= decode->nal_ref_idc ? BIT(12) : 0;
reg |= (slice->slice_type & 0xf) << 8;
reg |= slice->cabac_init_idc & 0x3;
- reg |= VE_H264_SHS_FIRST_SLICE_IN_PIC;
+ if (run->first_slice)
+ reg |= VE_H264_SHS_FIRST_SLICE_IN_PIC;
if (slice->flags & V4L2_H264_SLICE_FLAG_FIELD_PIC)
reg |= VE_H264_SHS_FIELD_PIC;
if (slice->flags & V4L2_H264_SLICE_FLAG_BOTTOM_FIELD)
--
2.22.1
Powered by blists - more mailing lists