linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stanimir Varbanov <stanimir.varbanov@linaro.org>
To: Loic Poulain <loic.poulain@linaro.org>
Cc: linux-media@vger.kernel.org,
	Mauro Carvalho Chehab <mchehab+samsung@kernel.org>,
	Nicolas Dufresne <nicolas@ndufresne.ca>
Subject: Re: [PATCH v4] venus: venc: Fix enum frameintervals
Date: Thu, 17 Oct 2019 18:47:15 +0300	[thread overview]
Message-ID: <92e1234e-174a-3fa5-f77c-ae0072bd22c2@linaro.org> (raw)
In-Reply-To: <CAMZdPi8D8WQJJ5U15_4A4HgXjJNUR2BOGZJUc85wgX+=QsTZ0w@mail.gmail.com>

Hi Loic,

On 10/17/19 6:08 PM, Loic Poulain wrote:
> Hi Stanimir,
> 
> On Thu, 3 Oct 2019 at 12:15, Stanimir Varbanov
> <stanimir.varbanov@linaro.org> wrote:
>>
>> I have tested this on db410c with following gst pipeline:
>>
>> gst-launch-1.0 -v videotestsrc !
>> video/x-raw,format=NV12,width=1280,height=960,framerate=24/1 !
>> v4l2h264enc
>> extra-controls="controls,h264_profile=4,h264_level="5",video_bitrate=10000000;"
>> ! filesink location=gstenc.h264
>>
>> Loic, could you give it a try on db820c too?
>>
>> Here is the info on the bug which I try to fix with current patch:
>>
>> https://bugs.96boards.org/show_bug.cgi?id=513
>>
>> On 10/3/19 1:10 PM, Stanimir Varbanov wrote:
>>> This fixes an issue when setting the encoder framerate because of
>>> missing precision. Now the frameinterval type is changed to
>>> TYPE_CONTINUOUS and step = 1. Also the math is changed when
>>> framerate property is called - the firmware side expects the
>>> framerate in Q16 values.
>>>
>>> Signed-off-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>
>>> ---
>>>
>>> Changes since v3:
>>> Keep min/max numerator one, and divide frate(max/min) to frame
>>> factor (returned framerate max/min capabilities are in range
>>> 1 to 120fps but in Q16 i.e. 65536 to 7864320).
>>>
>>>  drivers/media/platform/qcom/venus/venc.c | 17 ++++++++++++-----
>>>  1 file changed, 12 insertions(+), 5 deletions(-)
>>>
>>> diff --git a/drivers/media/platform/qcom/venus/venc.c b/drivers/media/platform/qcom/venus/venc.c
>>> index 1b7fb2d5887c..133ff7eceb83 100644
>>> --- a/drivers/media/platform/qcom/venus/venc.c
>>> +++ b/drivers/media/platform/qcom/venus/venc.c
>>> @@ -22,6 +22,7 @@
>>>  #include "venc.h"
>>>
>>>  #define NUM_B_FRAMES_MAX     4
>>> +#define FRAMERATE_FACTOR     BIT(16)
>>>
>>>  /*
>>>   * Three resons to keep MPLANE formats (despite that the number of planes
>>> @@ -576,7 +577,7 @@ static int venc_enum_frameintervals(struct file *file, void *fh,
>>>       struct venus_inst *inst = to_inst(file);
>>>       const struct venus_format *fmt;
>>>
>>> -     fival->type = V4L2_FRMIVAL_TYPE_STEPWISE;
>>> +     fival->type = V4L2_FRMIVAL_TYPE_CONTINUOUS;
>>>
>>>       fmt = find_format(inst, fival->pixel_format,
>>>                         V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE);
>>> @@ -600,11 +601,11 @@ static int venc_enum_frameintervals(struct file *file, void *fh,
>>>               return -EINVAL;
>>>
>>>       fival->stepwise.min.numerator = 1;
>>> -     fival->stepwise.min.denominator = frate_max(inst);
>>> +     fival->stepwise.min.denominator = frate_max(inst) / FRAMERATE_FACTOR;
> 
> On 820c frate_max() returns 120 set denominator to 0, and causes
> gstreamer failure.

OK, thanks!

We have two options
- unify frate_min/max() to return in Q16 depending on the hfi version
- or move frame_factor in frate_min/max() and return the framerate (1..120)


-- 
regards,
Stan

  reply	other threads:[~2019-10-17 15:47 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-03 10:10 [PATCH v4] venus: venc: Fix enum frameintervals Stanimir Varbanov
2019-10-03 10:15 ` Stanimir Varbanov
2019-10-17 15:08   ` Loic Poulain
2019-10-17 15:47     ` Stanimir Varbanov [this message]
2019-10-17 17:50       ` Loic Poulain
2019-10-04 11:48 ` Mauro Carvalho Chehab

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=92e1234e-174a-3fa5-f77c-ae0072bd22c2@linaro.org \
    --to=stanimir.varbanov@linaro.org \
    --cc=linux-media@vger.kernel.org \
    --cc=loic.poulain@linaro.org \
    --cc=mchehab+samsung@kernel.org \
    --cc=nicolas@ndufresne.ca \
    /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;
as well as URLs for NNTP newsgroup(s).