From: Philipp Zabel <p.zabel@pengutronix.de>
To: Hans Verkuil <hverkuil@xs4all.nl>
Cc: "Kamil Debski" <k.debski@samsung.com>,
"Mauro Carvalho Chehab" <mchehab@osg.samsung.com>,
linux-media@vger.kernel.org, linux-kernel@vger.kernel.org,
"Frédéric Sureau" <frederic.sureau@vodalys.com>,
"Jean-Michel Hautbois" <jean-michel.hautbois@vodalys.com>,
"Nicolas Dufresne" <nicolas.dufresne@collabora.com>
Subject: Re: [RFC PATCH] [media] coda: Use S_PARM to set nominal framerate for h.264 encoder
Date: Mon, 12 Jan 2015 16:35:59 +0100 [thread overview]
Message-ID: <1421076959.3081.63.camel@pengutronix.de> (raw)
In-Reply-To: <54B3E24B.5030403@xs4all.nl>
Hi Hans,
thank you for the comments!
Am Montag, den 12.01.2015, 16:03 +0100 schrieb Hans Verkuil:
> On 12/22/2014 05:00 PM, Philipp Zabel wrote:
> > The encoder needs to know the nominal framerate for the constant bitrate
> > control mechanism to work. Currently the only way to set the framerate is
> > by using VIDIOC_S_PARM on the output queue.
> >
> > Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
> > ---
> > drivers/media/platform/coda/coda-common.c | 29 +++++++++++++++++++++++++++++
> > 1 file changed, 29 insertions(+)
> >
> > diff --git a/drivers/media/platform/coda/coda-common.c b/drivers/media/platform/coda/coda-common.c
> > index 39330a7..63eb510 100644
> > --- a/drivers/media/platform/coda/coda-common.c
> > +++ b/drivers/media/platform/coda/coda-common.c
> > @@ -803,6 +803,32 @@ static int coda_decoder_cmd(struct file *file, void *fh,
> > return 0;
> > }
> >
> > +static int coda_g_parm(struct file *file, void *fh, struct v4l2_streamparm *a)
> > +{
> > + struct coda_ctx *ctx = fh_to_ctx(fh);
> > +
>
> If a->type != V4L2_BUF_TYPE_VIDEO_OUTPUT, then return -EINVAL.
If the decoder can retrieve the framerate from the stream, wouldn't it
make sense to allow G_PARM for a->type == V4L2_BUF_TYPE_VIDEO_CAPTURE ?
> Ditto for s_parm.
Will do.
> > + a->parm.output.timeperframe.denominator = 1;
> > + a->parm.output.timeperframe.numerator = ctx->params.framerate;
> > +
> > + return 0;
> > +}
> > +
> > +static int coda_s_parm(struct file *file, void *fh, struct v4l2_streamparm *a)
> > +{
> > + struct coda_ctx *ctx = fh_to_ctx(fh);
> > +
> > + if (a->type == V4L2_BUF_TYPE_VIDEO_OUTPUT &&
> > + a->parm.output.timeperframe.numerator != 0) {
> > + ctx->params.framerate = a->parm.output.timeperframe.denominator
> > + / a->parm.output.timeperframe.numerator;
>
> Hmm, what happens if the denominator is 1 and the numerator is 2?
> You probably want to clamp ctx->params.framerate to the range of allowed framerates.
> And at least ensure a framerate > 0.
>
> Also check with v4l2_compliance! You'd have caught at least the missing a->type check.
Oh dear, I need to improve my v4l-utils update habits. I'll fix this
patch and resend it.
regards
Philipp
next prev parent reply other threads:[~2015-01-12 15:36 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-22 16:00 Philipp Zabel
2015-01-12 15:03 ` Hans Verkuil
2015-01-12 15:35 ` Philipp Zabel [this message]
2015-01-12 15:38 ` Hans Verkuil
[not found] ` <54B7E978.5050505@vodalys.com>
2015-01-15 16:51 ` Nicolas Dufresne
2015-01-15 16:59 ` Frédéric Sureau
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=1421076959.3081.63.camel@pengutronix.de \
--to=p.zabel@pengutronix.de \
--cc=frederic.sureau@vodalys.com \
--cc=hverkuil@xs4all.nl \
--cc=jean-michel.hautbois@vodalys.com \
--cc=k.debski@samsung.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@osg.samsung.com \
--cc=nicolas.dufresne@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
Powered by JetHome