On Fri, 2020-11-20 at 10:30 +0100, Hans Verkuil wrote: > On 18/11/2020 19:46, Ezequiel Garcia wrote: > > Check that all the fields that correspond or are related > > to a H264 specification syntax element have legal values. > > > > Signed-off-by: Ezequiel Garcia <ezequiel@xxxxxxxxxxxxx> > > --- > > drivers/media/v4l2-core/v4l2-ctrls.c | 83 ++++++++++++++++++++++++++++ > > 1 file changed, 83 insertions(+) > > [..] > > case V4L2_CTRL_TYPE_H264_DECODE_PARAMS: > > p_h264_dec_params = p; > > > > + if (p_h264_dec_params->nal_ref_idc > 3) > > + return -EINVAL; > > for (i = 0; i < V4L2_H264_NUM_DPB_ENTRIES; i++) { > > struct v4l2_h264_dpb_entry *dpb_entry = > > &p_h264_dec_params->dpb[i]; > > > > General question: I don't see anything in std_init_compound() for these > controls. Is initializing these compound controls to 0 enough to make them > pass std_validate_compound()? It probably is, otherwise you'd see errors > in the compliance test, I guess. > guess. > Indeed. You can see all the checks are for fields to not exceed some maximum value. This is common in H264/HEVC: you'll see spread of _minusN syntax. This is so to make zero-valued syntax common, which in turns creates more redundancy, and make headers more compressed. Thanks, Ezequiel