media: uapi: mpeg2: rework quantisation matrices semantics
authorEzequiel Garcia <ezequiel@collabora.com>
Thu, 29 Apr 2021 14:48:10 +0000 (16:48 +0200)
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Sun, 23 May 2021 17:21:30 +0000 (19:21 +0200)
commit81bbb65f19819440b42270e1f033d9b14279540c
tree16cb3e8d6be8ca1a76b3bc01cdcef87112717146
parent118f3e1562f2b15e30ed65a2718cd9ed710054b1
media: uapi: mpeg2: rework quantisation matrices semantics

As stated in the MPEG-2 specification, section 6.3.7 "Quant matrix
extension":

  Each quantisation matrix has a default set of values. When a
  sequence_header_code is decoded all matrices shall be reset to
  their default values. User defined matrices may be downloaded
  and this can occur in a sequence_header() or in a
  quant_matrix_extension().

The load_intra_quantiser_matrix syntax elements are transmitted
in the bitstream headers, signalling that a quantisation matrix
needs to be loaded and used for pictures transmitted afterwards
(until the matrices are reset).

This "load" semantics are implemented in the V4L2 interface
without the need of any "load" flags: passing the control
is effectively a load.

Therefore, rework the V4L2_CID_MPEG_VIDEO_MPEG2_QUANTISATION
semantics to match the MPEG-2 semantics. Quantisation matrices
values are now initialized by the V4L2 control core to their
reset default value, and applications are expected to reset
their values as specified.

The quantisation control is therefore optional, and used to
load bitstream-defined values in the quantisation matrices.

Signed-off-by: Ezequiel Garcia <ezequiel@collabora.com>
Co-developed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Tested-by: Jernej Skrabec <jernej.skrabec@siol.net>
Reviewed-by: Jernej Skrabec <jernej.skrabec@siol.net>
Tested-by: Daniel Almeida <daniel.almeida@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst
drivers/media/v4l2-core/v4l2-ctrls.c
drivers/staging/media/sunxi/cedrus/cedrus_mpeg2.c
include/media/mpeg2-ctrls.h