media: uapi: h264: Clean slice invariants syntax elements
authorEzequiel Garcia <ezequiel@collabora.com>
Tue, 25 Aug 2020 03:52:36 +0000 (05:52 +0200)
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Tue, 1 Sep 2020 12:13:28 +0000 (14:13 +0200)
commitd9358563179a7f01f9020ebbe201c7e54ba3af48
treec9c80894592191fd0008b9917cdf6f33cb2113b9
parent2287c5e65cbcc99633c412dbfe1d39bd9f7bf1ce
media: uapi: h264: Clean slice invariants syntax elements

The H.264 specification requires in section 7.4.3 "Slice header semantics",
that the following values shall be the same in all slice headers:

  pic_parameter_set_id
  frame_num
  field_pic_flag
  bottom_field_flag
  idr_pic_id
  pic_order_cnt_lsb
  delta_pic_order_cnt_bottom
  delta_pic_order_cnt[ 0 ]
  delta_pic_order_cnt[ 1 ]
  sp_for_switch_flag
  slice_group_change_cycle

These bitstream fields are part of the slice header, and therefore
passed redundantly on each slice. The purpose of the redundancy
is to make the codec fault-tolerant in network scenarios.

This is of course not needed to be reflected in the V4L2 controls,
given the bitstream has already been parsed by applications.
Therefore, move the redundant fields to the per-frame decode
parameters control (DECODE_PARAMS).

Field 'pic_parameter_set_id' is simply removed in this case,
because the PPS control must currently contain the active PPS.

Syntax elements dec_ref_pic_marking() and those related
to pic order count, remain invariant as well, and therefore,
the fields dec_ref_pic_marking_bit_size and pic_order_cnt_bit_size
are also common to all slices.

Signed-off-by: Ezequiel Garcia <ezequiel@collabora.com>
Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Tested-by: Jonas Karlman <jonas@kwiboo.se>
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/media/v4l2-core/v4l2-h264.c
drivers/staging/media/hantro/hantro_g1_h264_dec.c
drivers/staging/media/hantro/hantro_h264.c
drivers/staging/media/rkvdec/rkvdec-h264.c
drivers/staging/media/sunxi/cedrus/cedrus_h264.c
include/media/h264-ctrls.h
include/media/v4l2-h264.h