From: Tomasz Figa <tfiga@chromium.org>
To: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Cc: linux-media@vger.kernel.org,
Michael Tretter <m.tretter@pengutronix.de>,
Nicolas Dufresne <nicolas@ndufresne.ca>
Subject: Re: [PATCHv2 1/2] media: docs-rst: Document memory-to-memory video encoder interface
Date: Wed, 20 May 2020 19:07:19 +0000 [thread overview]
Message-ID: <20200520190719.GA35530@chromium.org> (raw)
In-Reply-To: <20200520100159.2094831-2-hverkuil-cisco@xs4all.nl>
Hi Hans,
On Wed, May 20, 2020 at 12:01:58PM +0200, Hans Verkuil wrote:
> From: Tomasz Figa <tfiga@chromium.org>
>
> Due to complexity of the video encoding process, the V4L2 drivers of
> stateful encoder hardware require specific sequences of V4L2 API calls
> to be followed. These include capability enumeration, initialization,
> encoding, encode parameters change, drain and reset.
>
> Specifics of the above have been discussed during Media Workshops at
> LinuxCon Europe 2012 in Barcelona and then later Embedded Linux
> Conference Europe 2014 in Düsseldorf. The de facto Codec API that
> originated at those events was later implemented by the drivers we already
> have merged in mainline, such as s5p-mfc or coda.
>
> The only thing missing was the real specification included as a part of
> Linux Media documentation. Fix it now and document the encoder part of
> the Codec API.
>
> Signed-off-by: Tomasz Figa <tfiga@chromium.org>
> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
> ---
> .../userspace-api/media/v4l/dev-encoder.rst | 727 ++++++++++++++++++
> .../userspace-api/media/v4l/dev-mem2mem.rst | 1 +
> .../userspace-api/media/v4l/pixfmt-v4l2.rst | 5 +
> .../userspace-api/media/v4l/v4l2.rst | 2 +
> .../media/v4l/vidioc-encoder-cmd.rst | 51 +-
> 5 files changed, 766 insertions(+), 20 deletions(-)
> create mode 100644 Documentation/userspace-api/media/v4l/dev-encoder.rst
>
Thanks a lot for taking care of the remaining updates. Just one comment
inline.
[snip]
> +4. Set the raw and coded frame interval on the ``OUTPUT`` queue via
> + :c:func:`VIDIOC_S_PARM`
> +
> + * ** Required fields:**
> +
> + ``type``
> + a ``V4L2_BUF_TYPE_*`` enum appropriate for ``OUTPUT``.
> +
> + ``parm.output``
> + set all fields except ``parm.output.timeperframe`` to 0.
> +
> + ``parm.output.timeperframe``
> + the desired frame interval; the encoder may adjust it to
> + match hardware requirements.
> +
> + * **Return fields:**
> +
> + ``parm.output.timeperframe``
> + the adjusted frame interval.
> +
> + .. important::
> +
> + Changing the ``OUTPUT`` frame interval *also* sets the framerate that
> + the encoder uses to encode the video. So setting the frame interval
> + to 1/24 (or 24 frames per second) will produce a coded video stream
> + that can be played back at that speed. The frame interval for the
> + ``OUTPUT`` queue is just a hint, the application may provide raw
> + frames at a different rate. It can be used by the driver to help
> + schedule multiple encoders running in parallel.
> +
> + In the next step the ``CAPTURE`` frame interval can optionally be
> + changed to a different value. This is useful for off-line encoding
> + were the coded frame interval can be different from the rate at
> + which raw frames are supplied.
> +
> + .. important::
> +
> + ``timeperframe`` deals with *frames*, not fields. So for interlaced
> + formats this is the time per two fields, since a frame consists of
> + a top and a bottom field.
> +
> + .. note::
> +
> + It is due to historical reasons that changing the ``OUTPUT`` frame
> + interval also changes the coded frame interval on the ``CAPTURE``
> + queue. Ideally these would be independent settings, but that would
> + break the existing API.
> +
Should we explicitly state that setting the OUTPUT frame interval resets
the CAPTURE frame interval to the same value?
Best regards,
Tomasz
next prev parent reply other threads:[~2020-05-20 19:07 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-20 10:01 [PATCHv2 0/2] Stateful Encoding: final bits Hans Verkuil
2020-05-20 10:01 ` [PATCHv2 1/2] media: docs-rst: Document memory-to-memory video encoder interface Hans Verkuil
2020-05-20 19:07 ` Tomasz Figa [this message]
2020-05-20 20:32 ` Nicolas Dufresne
2020-05-26 8:32 ` Hans Verkuil
2020-05-26 16:01 ` Tomasz Figa
2020-05-28 7:44 ` Michael Tretter
2020-05-28 8:48 ` Hans Verkuil
2020-05-28 12:02 ` Tomasz Figa
2020-05-20 20:33 ` Stanimir Varbanov
2020-05-26 8:18 ` Hans Verkuil
2020-05-20 10:01 ` [PATCHv2 2/2] vidioc-g-parm.rst: update the VIDIOC_G/S_PARM documentation Hans Verkuil
2020-05-20 19:09 ` Tomasz Figa
2020-05-20 19:11 ` [PATCHv2 0/2] Stateful Encoding: final bits Tomasz Figa
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=20200520190719.GA35530@chromium.org \
--to=tfiga@chromium.org \
--cc=hverkuil-cisco@xs4all.nl \
--cc=linux-media@vger.kernel.org \
--cc=m.tretter@pengutronix.de \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.