[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240618194647.742037-5-jonas@kwiboo.se>
Date: Tue, 18 Jun 2024 19:46:28 +0000
From: Jonas Karlman <jonas@...boo.se>
To: Ezequiel Garcia <ezequiel@...guardiasur.com.ar>, Mauro Carvalho Chehab
<mchehab@...nel.org>, Hans Verkuil <hverkuil-cisco@...all.nl>, "Greg
Kroah-Hartman" <gregkh@...uxfoundation.org>
Cc: Alex Bee <knaerzche@...il.com>, Nicolas Dufresne
<nicolas.dufresne@...labora.com>, Benjamin Gaignard
<benjamin.gaignard@...labora.com>, Sebastian Fricke
<sebastian.fricke@...labora.com>, Christopher Obbard
<chris.obbard@...labora.com>, Detlev Casanova
<detlev.casanova@...labora.com>, linux-media@...r.kernel.org,
linux-rockchip@...ts.infradead.org, linux-staging@...ts.linux.dev,
linux-kernel@...r.kernel.org, Jonas Karlman <jonas@...boo.se>
Subject: [PATCH v5 04/10] media: rkvdec: h264: Don't hardcode SPS/PPS parameters
From: Alex Bee <knaerzche@...il.com>
Some SPS/PPS parameters are currently hardcoded in the driver even
though they exist in the stable uapi controls.
Use values from SPS/PPS controls instead of hardcoding them.
Signed-off-by: Alex Bee <knaerzche@...il.com>
[jonas@...boo.se: constraint_set_flags condition, commit message]
Signed-off-by: Jonas Karlman <jonas@...boo.se>
Reviewed-by: Nicolas Dufresne <nicolas.dufresne@...labora.com>
Tested-by: Nicolas Dufresne <nicolas.dufresne@...labora.com>
Tested-by: Christopher Obbard <chris.obbard@...labora.com>
---
v5:
- Collect r-b and t-b tags
v4:
- No change
v3:
- New patch
drivers/staging/media/rkvdec/rkvdec-h264.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/drivers/staging/media/rkvdec/rkvdec-h264.c b/drivers/staging/media/rkvdec/rkvdec-h264.c
index 7a1e76d423df..8bce8902b8dd 100644
--- a/drivers/staging/media/rkvdec/rkvdec-h264.c
+++ b/drivers/staging/media/rkvdec/rkvdec-h264.c
@@ -655,13 +655,14 @@ static void assemble_hw_pps(struct rkvdec_ctx *ctx,
#define WRITE_PPS(value, field) set_ps_field(hw_ps->info, field, value)
/* write sps */
- WRITE_PPS(0xf, SEQ_PARAMETER_SET_ID);
- WRITE_PPS(0xff, PROFILE_IDC);
- WRITE_PPS(1, CONSTRAINT_SET3_FLAG);
+ WRITE_PPS(sps->seq_parameter_set_id, SEQ_PARAMETER_SET_ID);
+ WRITE_PPS(sps->profile_idc, PROFILE_IDC);
+ WRITE_PPS(!!(sps->constraint_set_flags & (1 << 3)), CONSTRAINT_SET3_FLAG);
WRITE_PPS(sps->chroma_format_idc, CHROMA_FORMAT_IDC);
WRITE_PPS(sps->bit_depth_luma_minus8, BIT_DEPTH_LUMA);
WRITE_PPS(sps->bit_depth_chroma_minus8, BIT_DEPTH_CHROMA);
- WRITE_PPS(0, QPPRIME_Y_ZERO_TRANSFORM_BYPASS_FLAG);
+ WRITE_PPS(!!(sps->flags & V4L2_H264_SPS_FLAG_QPPRIME_Y_ZERO_TRANSFORM_BYPASS),
+ QPPRIME_Y_ZERO_TRANSFORM_BYPASS_FLAG);
WRITE_PPS(sps->log2_max_frame_num_minus4, LOG2_MAX_FRAME_NUM_MINUS4);
WRITE_PPS(sps->max_num_ref_frames, MAX_NUM_REF_FRAMES);
WRITE_PPS(sps->pic_order_cnt_type, PIC_ORDER_CNT_TYPE);
@@ -688,8 +689,8 @@ static void assemble_hw_pps(struct rkvdec_ctx *ctx,
DIRECT_8X8_INFERENCE_FLAG);
/* write pps */
- WRITE_PPS(0xff, PIC_PARAMETER_SET_ID);
- WRITE_PPS(0x1f, PPS_SEQ_PARAMETER_SET_ID);
+ WRITE_PPS(pps->pic_parameter_set_id, PIC_PARAMETER_SET_ID);
+ WRITE_PPS(pps->seq_parameter_set_id, PPS_SEQ_PARAMETER_SET_ID);
WRITE_PPS(!!(pps->flags & V4L2_H264_PPS_FLAG_ENTROPY_CODING_MODE),
ENTROPY_CODING_MODE_FLAG);
WRITE_PPS(!!(pps->flags & V4L2_H264_PPS_FLAG_BOTTOM_FIELD_PIC_ORDER_IN_FRAME_PRESENT),
--
2.45.2
Powered by blists - more mailing lists