From: Jonas Karlman <jonas@kwiboo.se>
To: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>,
Mauro Carvalho Chehab <mchehab@kernel.org>,
"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>
Cc: Alex Bee <knaerzche@gmail.com>,
Nicolas Dufresne <nicolas.dufresne@collabora.com>,
Benjamin Gaignard <benjamin.gaignard@collabora.com>,
Sebastian Fricke <sebastian.fricke@collabora.com>,
Christopher Obbard <chris.obbard@collabora.com>,
linux-media@vger.kernel.org, linux-rockchip@lists.infradead.org,
linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org,
Jonas Karlman <jonas@kwiboo.se>
Subject: [PATCH v3 06/10] media: rkvdec: Extract rkvdec_fill_decoded_pixfmt helper method
Date: Sun, 29 Oct 2023 18:34:13 +0000 [thread overview]
Message-ID: <20231029183427.1781554-7-jonas@kwiboo.se> (raw)
In-Reply-To: <20231029183427.1781554-1-jonas@kwiboo.se>
This extract setting decoded pixfmt into a helper method, current code
is replaced with a call to the new helper method.
Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
---
v3:
- No changes
drivers/staging/media/rkvdec/rkvdec.c | 29 ++++++++++++++-------------
1 file changed, 15 insertions(+), 14 deletions(-)
diff --git a/drivers/staging/media/rkvdec/rkvdec.c b/drivers/staging/media/rkvdec/rkvdec.c
index 84a41792cb4b..8d8ab529537c 100644
--- a/drivers/staging/media/rkvdec/rkvdec.c
+++ b/drivers/staging/media/rkvdec/rkvdec.c
@@ -27,6 +27,17 @@
#include "rkvdec.h"
#include "rkvdec-regs.h"
+static void rkvdec_fill_decoded_pixfmt(struct rkvdec_ctx *ctx,
+ struct v4l2_pix_format_mplane *pix_mp)
+{
+ v4l2_fill_pixfmt_mp(pix_mp, pix_mp->pixelformat,
+ pix_mp->width, pix_mp->height);
+ pix_mp->plane_fmt[0].sizeimage += 128 *
+ DIV_ROUND_UP(pix_mp->width, 16) *
+ DIV_ROUND_UP(pix_mp->height, 16);
+ pix_mp->field = V4L2_FIELD_NONE;
+}
+
static int rkvdec_try_ctrl(struct v4l2_ctrl *ctrl)
{
struct rkvdec_ctx *ctx = container_of(ctrl->handler, struct rkvdec_ctx, ctrl_hdl);
@@ -192,13 +203,9 @@ static void rkvdec_reset_decoded_fmt(struct rkvdec_ctx *ctx)
rkvdec_reset_fmt(ctx, f, ctx->coded_fmt_desc->decoded_fmts[0]);
f->type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE;
- v4l2_fill_pixfmt_mp(&f->fmt.pix_mp,
- ctx->coded_fmt_desc->decoded_fmts[0],
- ctx->coded_fmt.fmt.pix_mp.width,
- ctx->coded_fmt.fmt.pix_mp.height);
- f->fmt.pix_mp.plane_fmt[0].sizeimage += 128 *
- DIV_ROUND_UP(f->fmt.pix_mp.width, 16) *
- DIV_ROUND_UP(f->fmt.pix_mp.height, 16);
+ f->fmt.pix_mp.width = ctx->coded_fmt.fmt.pix_mp.width;
+ f->fmt.pix_mp.height = ctx->coded_fmt.fmt.pix_mp.height;
+ rkvdec_fill_decoded_pixfmt(ctx, &f->fmt.pix_mp);
}
static int rkvdec_enum_framesizes(struct file *file, void *priv,
@@ -264,13 +271,7 @@ static int rkvdec_try_capture_fmt(struct file *file, void *priv,
&pix_mp->height,
&coded_desc->frmsize);
- v4l2_fill_pixfmt_mp(pix_mp, pix_mp->pixelformat,
- pix_mp->width, pix_mp->height);
- pix_mp->plane_fmt[0].sizeimage +=
- 128 *
- DIV_ROUND_UP(pix_mp->width, 16) *
- DIV_ROUND_UP(pix_mp->height, 16);
- pix_mp->field = V4L2_FIELD_NONE;
+ rkvdec_fill_decoded_pixfmt(ctx, pix_mp);
return 0;
}
--
2.42.0
next prev parent reply other threads:[~2023-10-29 18:35 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-29 18:34 [PATCH v3 00/10] media: rkvdec: Add H.264 High 10 and 4:2:2 profile support Jonas Karlman
2023-10-29 18:34 ` [PATCH v3 01/10] media: v4l2-common: Add helpers to calculate bytesperline and sizeimage Jonas Karlman
2023-10-29 18:34 ` [PATCH v3 02/10] media: v4l2: Add NV15 and NV20 pixel formats Jonas Karlman
2023-10-29 18:34 ` [PATCH v3 03/10] media: rkvdec: h264: Use bytesperline and buffer height as virstride Jonas Karlman
2023-10-29 18:34 ` [PATCH v3 04/10] media: rkvdec: h264: Don't hardcode SPS/PPS parameters Jonas Karlman
2023-10-29 18:34 ` [PATCH v3 05/10] media: rkvdec: h264: Remove SPS validation at streaming start Jonas Karlman
2023-10-29 18:34 ` Jonas Karlman [this message]
2023-10-29 18:34 ` [PATCH v3 07/10] media: rkvdec: Move rkvdec_reset_decoded_fmt() function Jonas Karlman
2023-10-29 18:34 ` [PATCH v3 08/10] media: rkvdec: Prepare for adding format validation ops Jonas Karlman
2023-10-29 18:34 ` [PATCH v3 09/10] media: rkvdec: Add get_fmt_opaque and valid_fmt ops Jonas Karlman
2023-10-29 18:34 ` [PATCH v3 10/10] media: rkvdec: h264: Support High 10 and 4:2:2 profiles Jonas Karlman
2023-12-22 14:15 ` [PATCH v3 00/10] media: rkvdec: Add H.264 High 10 and 4:2:2 profile support Christopher Obbard
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=20231029183427.1781554-7-jonas@kwiboo.se \
--to=jonas@kwiboo.se \
--cc=benjamin.gaignard@collabora.com \
--cc=chris.obbard@collabora.com \
--cc=ezequiel@vanguardiasur.com.ar \
--cc=gregkh@linuxfoundation.org \
--cc=knaerzche@gmail.com \
--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=sebastian.fricke@collabora.com \
/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