lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Mon, 12 Jan 2015 16:38:25 +0100
From:	Hans Verkuil <hverkuil@...all.nl>
To:	Philipp Zabel <p.zabel@...gutronix.de>
CC:	Kamil Debski <k.debski@...sung.com>,
	Mauro Carvalho Chehab <mchehab@....samsung.com>,
	linux-media@...r.kernel.org, linux-kernel@...r.kernel.org,
	Frédéric Sureau <frederic.sureau@...alys.com>,
	Jean-Michel Hautbois <jean-michel.hautbois@...alys.com>,
	Nicolas Dufresne <nicolas.dufresne@...labora.com>
Subject: Re: [RFC PATCH] [media] coda: Use S_PARM to set nominal framerate
 for h.264 encoder

On 01/12/2015 04:35 PM, Philipp Zabel wrote:
> 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@...gutronix.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 ?

Certainly. But that wasn't in the patch :-)

Regards,

	Hans

> 
>>  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
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ