mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH RFC 0/2] media: stateless MPEG-1 decoding, cedrus support
@ 2026-11-19 16:34 Arun Iyengar via B4 Relay
  2026-11-19 16:34 ` [PATCH RFC 1/2] media: uapi: mpeg2: add MPEG-1 flags and the MPEG-1 parsed slice format Arun Iyengar via B4 Relay
  2026-11-19 16:34 ` [PATCH RFC 2/2] media: cedrus: mpeg2: decode MPEG-1 as V4L2_PIX_FMT_MPEG1_SLICE Arun Iyengar via B4 Relay
  0 siblings, 2 replies; 3+ messages in thread
From: Arun Iyengar via B4 Relay @ 2026-11-19 16:34 UTC (permalink / raw)
  To: Hans Verkuil, Nicolas Dufresne, Mauro Carvalho Chehab,
	Benjamin Gaignard, Philipp Zabel, Maxime Ripard,
	Paul Kocialkowski, Greg Kroah-Hartman, Chen-Yu Tsai,
	Jernej Skrabec, Samuel Holland
  Cc: Jonas Karlman, linux-media, linux-kernel, linux-rockchip,
	linux-staging, linux-arm-kernel, linux-sunxi,
	Christian Stefan Kövér-Draxl, Arun Iyengar

Builds on Jernej Skrabec's cedrus work; tested with an FFmpeg hwaccel
on top of Jonas Karlman's V4L2 request API series (FFmpeg PR 20847).

MPEG-1 decoded as MPEG-2 is wrong: the mismatch control differs, and
MPEG-1 has full pel motion vectors and D-pictures. Patch 1 adds
V4L2_PIX_FMT_MPEG1_SLICE, which reuses the MPEG-2 controls with one
sequence flag and two picture flags; hantro rejects the new flags and
D-pictures (compile tested only). Patch 2 implements it in cedrus.

RFC questions:
- Is a separate pixel format the right way to make MPEG-1
  discoverable? Christian's Amlogic series decodes MPEG-1 through
  V4L2_PIX_FMT_MPEG2_SLICE.
- V4L2_MPEG2_SEQ_FLAG_MPEG1 is redundant with the format. I kept it so
  that the controls describe the bitstream on their own; happy to drop
  it.

FFmpeg patches (the second corrects D-picture handling of the first):
https://github.com/SomeComputerGuy/orangepizero2/blob/7ed24f39cbf0f4b285cd142c291267c9cfb818f4/patches/ffmpeg/0304-avcodec-add-V4L2-Request-API-MPEG-1-hwaccel.patch
https://github.com/SomeComputerGuy/orangepizero2/blob/7ed24f39cbf0f4b285cd142c291267c9cfb818f4/patches/ffmpeg/0309-avcodec-mpeg12dec-hand-D-pictures-only-to-hwaccels-t.patch

Tested on H616 only, on media-committers next: MPEG-1 (D-pictures
included), MPEG-2, H.264 and H.265 decode bit-exact against FFmpeg
software decoding; v4l2-compliance 49 of 49 with the v4l-utils patch
that teaches it the new format (sent separately).

Developed with Claude (Anthropic) as a coding assistant, which wrote
the code and the commit messages. I reviewed and tested them as
described above.

---
Arun Iyengar (2):
      media: uapi: mpeg2: add MPEG-1 flags and the MPEG-1 parsed slice format
      media: cedrus: mpeg2: decode MPEG-1 as V4L2_PIX_FMT_MPEG1_SLICE

 .../media/v4l/ext-ctrls-codec-stateless.rst        | 35 ++++++++++++++++++--
 .../userspace-api/media/v4l/pixfmt-compressed.rst  | 23 +++++++++++++
 drivers/media/platform/verisilicon/hantro_drv.c    | 12 +++++++
 drivers/media/v4l2-core/v4l2-ctrls-core.c          |  1 +
 drivers/media/v4l2-core/v4l2-ioctl.c               |  1 +
 drivers/staging/media/sunxi/cedrus/cedrus.c        | 22 +++++++++++++
 drivers/staging/media/sunxi/cedrus/cedrus_dec.c    |  1 +
 drivers/staging/media/sunxi/cedrus/cedrus_hw.c     |  1 +
 drivers/staging/media/sunxi/cedrus/cedrus_mpeg2.c  | 38 +++++++++++++++++++---
 drivers/staging/media/sunxi/cedrus/cedrus_video.c  |  7 ++++
 include/uapi/linux/v4l2-controls.h                 |  3 ++
 include/uapi/linux/videodev2.h                     |  1 +
 12 files changed, 139 insertions(+), 6 deletions(-)
---
base-commit: aa0f4c41d4870a18e65772a1817af16427200371
change-id: 20261114-b4-cedrus-mpeg1-8baae5a2eefe

Best regards,
--  
Arun Iyengar <aiyengar1990@gmail.com>



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

end of thread, other threads:[~2026-11-19 16:34 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-19 16:34 [PATCH RFC 0/2] media: stateless MPEG-1 decoding, cedrus support Arun Iyengar via B4 Relay
2026-11-19 16:34 ` [PATCH RFC 1/2] media: uapi: mpeg2: add MPEG-1 flags and the MPEG-1 parsed slice format Arun Iyengar via B4 Relay
2026-11-19 16:34 ` [PATCH RFC 2/2] media: cedrus: mpeg2: decode MPEG-1 as V4L2_PIX_FMT_MPEG1_SLICE Arun Iyengar via B4 Relay

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®