linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC RESEND 0/3] vp9 v4l2 stateless uapi
@ 2021-04-21 10:00 Andrzej Pietrasiewicz
  2021-04-21 10:00 ` [RFC RESEND 1/3] media: rkvdec: Fix .buf_prepare Andrzej Pietrasiewicz
                   ` (3 more replies)
  0 siblings, 4 replies; 14+ messages in thread
From: Andrzej Pietrasiewicz @ 2021-04-21 10:00 UTC (permalink / raw)
  To: linux-media
  Cc: linux-rockchip, devel, Mauro Carvalho Chehab, Ezequiel Garcia,
	Greg Kroah-Hartman, Andrzej Pietrasiewicz, kernel

Dear All,

This is an RFC on stateless uapi for vp9 decoding with v4l2. This work is based on https://lkml.org/lkml/2020/11/2/1043, but has been substantially reworked. The important change is that the v4l2 control used to pass boolean decoder probabilities has been made unidirectional, and is now called V4L2_CID_STATELESS_VP9_COMPRESSED_HDR_PROBS.

In the previous proposal, to queue a frame the userspace must fully dequeue the previous one, which effectively results in a forced lockstep behavior and defeats vb2's capability to enqueue multiple buffers. Such a design was a consequence of backward probability updates being performed by the kernel driver (which has direct access to appropriate counter values) but forward probability updates being coupled with compressed header parsing performed by the userspace.

In vp9 the boolean decoder used to decode the bitstream needs certain parameters to work. Those are probabilities, which change with each frame. After each frame is decoded it is known how many times a given symbol occured in the frame, so the probabilities can be adapted. This process is known as backward probabilities update. A next frame header can also contain information which modifies probabilities resulting from backward update. The said modification is called forward probabilities update. The data for backward update is generated by the decoder hardware, while the data for forward update is prepared by reading the compressed frame header. The natural place to parse something is userspace, while the natural place to access hardware-provided counters is the kernel. Such responsibilties assignment was used in the original work.

To overcome the lockstep, we moved forward probability updates to the kernel, while leaving parsing them in userspace. This way the v4l2 control which is used to pass the probs becomes unidirectional (user->kernel) and the userspace can keep parsing and enqueueing succeeding frames.

If a particular driver parses the compressed header and does backward probability updates on its own then V4L2_CID_STATELESS_VP9_COMPRESSED_HDR_PROBS does not need to be used.

This series adds vp9 uapi in proper locations, which means it is a proper, "official" uapi, as opposed to staging uapi which was proposed in the above mentioned lkml thread.

The series adds vp9 support to rkvdec driver.

Rebased onto media_tree.

I kindly ask for your comments.

TODO:

- potentially fine-tune the uAPI (add/remove fields, move between structs)
- write another driver (intended g2 @ iMX8)
- verify the added documentation

Regards,

Andrzej

Andrzej Pietrasiewicz (1):
  media: uapi: Add VP9 stateless decoder controls

Boris Brezillon (1):
  media: rkvdec: Add the VP9 backend

Ezequiel Garcia (1):
  media: rkvdec: Fix .buf_prepare

 .../userspace-api/media/v4l/biblio.rst        |   10 +
 .../media/v4l/ext-ctrls-codec-stateless.rst   |  523 +++
 .../media/v4l/pixfmt-compressed.rst           |   15 +
 .../media/v4l/vidioc-g-ext-ctrls.rst          |    8 +
 .../media/v4l/vidioc-queryctrl.rst            |   12 +
 .../media/videodev2.h.rst.exceptions          |    2 +
 drivers/media/v4l2-core/v4l2-ctrls.c          |  244 ++
 drivers/media/v4l2-core/v4l2-ioctl.c          |    1 +
 drivers/staging/media/rkvdec/Makefile         |    2 +-
 drivers/staging/media/rkvdec/rkvdec-vp9.c     | 2846 +++++++++++++++++
 drivers/staging/media/rkvdec/rkvdec.c         |   62 +-
 drivers/staging/media/rkvdec/rkvdec.h         |    6 +
 include/media/v4l2-ctrls.h                    |    4 +
 include/uapi/linux/v4l2-controls.h            |  455 +++
 include/uapi/linux/videodev2.h                |    6 +
 15 files changed, 4190 insertions(+), 6 deletions(-)
 create mode 100644 drivers/staging/media/rkvdec/rkvdec-vp9.c

-- 
2.17.1


^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2021-05-05 18:00 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-21 10:00 [RFC RESEND 0/3] vp9 v4l2 stateless uapi Andrzej Pietrasiewicz
2021-04-21 10:00 ` [RFC RESEND 1/3] media: rkvdec: Fix .buf_prepare Andrzej Pietrasiewicz
2021-04-21 10:00 ` [RFC RESEND 2/3] media: uapi: Add VP9 stateless decoder controls Andrzej Pietrasiewicz
2021-04-29 10:20   ` Hans Verkuil
2021-04-30 16:54     ` Andrzej Pietrasiewicz
2021-05-05 17:36     ` Nicolas Dufresne
2021-04-21 10:00 ` [RFC RESEND 3/3] media: rkvdec: Add the VP9 backend Andrzej Pietrasiewicz
2021-04-29 10:28   ` Hans Verkuil
2021-04-26  7:38 ` [RFC RESEND 0/3] vp9 v4l2 stateless uapi Hans Verkuil
2021-04-26 17:37   ` Nicolas Dufresne
2021-04-26 23:34     ` Ezequiel Garcia
2021-04-29  9:23       ` Hans Verkuil
2021-04-29 19:38         ` Nicolas Dufresne
2021-04-30  8:12           ` Hans Verkuil

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