[v5,13/13] media: AV1: Make sure that bit depth in correctly initialize

Message ID 20230330154043.1250736-14-benjamin.gaignard@collabora.com
State New
Headers
Series AV1 stateless decoder for RK3588 |

Commit Message

Benjamin Gaignard March 30, 2023, 3:40 p.m. UTC
  Make sure that bit_depth field of V4L2_CTRL_TYPE_AV1_SEQUENCE
is initialized correctly before using it.

Signed-off-by: Benjamin Gaignard <benjamin.gaignard@collabora.com>
---
 drivers/media/v4l2-core/v4l2-ctrls-core.c | 5 +++++
 1 file changed, 5 insertions(+)
  

Comments

Nicolas Dufresne April 11, 2023, 3:26 p.m. UTC | #1
Le jeudi 30 mars 2023 à 17:40 +0200, Benjamin Gaignard a écrit :
> Make sure that bit_depth field of V4L2_CTRL_TYPE_AV1_SEQUENCE
> is initialized correctly before using it.
> 
> Signed-off-by: Benjamin Gaignard <benjamin.gaignard@collabora.com>
> 
In v6, can you move this patch earlier ? I'm having bisection in mind. With that
being said:

Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>

> 
> ---
>  drivers/media/v4l2-core/v4l2-ctrls-core.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/drivers/media/v4l2-core/v4l2-ctrls-core.c b/drivers/media/v4l2-core/v4l2-ctrls-core.c
> index 9fd37e94db17..a662fb60f73f 100644
> --- a/drivers/media/v4l2-core/v4l2-ctrls-core.c
> +++ b/drivers/media/v4l2-core/v4l2-ctrls-core.c
> @@ -111,6 +111,7 @@ static void std_init_compound(const struct v4l2_ctrl *ctrl, u32 idx,
>  	struct v4l2_ctrl_vp9_frame *p_vp9_frame;
>  	struct v4l2_ctrl_fwht_params *p_fwht_params;
>  	struct v4l2_ctrl_h264_scaling_matrix *p_h264_scaling_matrix;
> +	struct v4l2_ctrl_av1_sequence *p_av1_sequence;
>  	void *p = ptr.p + idx * ctrl->elem_size;
>  
>  	if (ctrl->p_def.p_const)
> @@ -157,6 +158,10 @@ static void std_init_compound(const struct v4l2_ctrl *ctrl, u32 idx,
>  		p_vp9_frame->flags |= V4L2_VP9_FRAME_FLAG_X_SUBSAMPLING |
>  			V4L2_VP9_FRAME_FLAG_Y_SUBSAMPLING;
>  		break;
> +	case V4L2_CTRL_TYPE_AV1_SEQUENCE:
> +		p_av1_sequence = p;
> +		p_av1_sequence->bit_depth = 8;
> +		break;
>  	case V4L2_CTRL_TYPE_FWHT_PARAMS:
>  		p_fwht_params = p;
>  		p_fwht_params->version = V4L2_FWHT_VERSION;
  

Patch

diff --git a/drivers/media/v4l2-core/v4l2-ctrls-core.c b/drivers/media/v4l2-core/v4l2-ctrls-core.c
index 9fd37e94db17..a662fb60f73f 100644
--- a/drivers/media/v4l2-core/v4l2-ctrls-core.c
+++ b/drivers/media/v4l2-core/v4l2-ctrls-core.c
@@ -111,6 +111,7 @@  static void std_init_compound(const struct v4l2_ctrl *ctrl, u32 idx,
 	struct v4l2_ctrl_vp9_frame *p_vp9_frame;
 	struct v4l2_ctrl_fwht_params *p_fwht_params;
 	struct v4l2_ctrl_h264_scaling_matrix *p_h264_scaling_matrix;
+	struct v4l2_ctrl_av1_sequence *p_av1_sequence;
 	void *p = ptr.p + idx * ctrl->elem_size;
 
 	if (ctrl->p_def.p_const)
@@ -157,6 +158,10 @@  static void std_init_compound(const struct v4l2_ctrl *ctrl, u32 idx,
 		p_vp9_frame->flags |= V4L2_VP9_FRAME_FLAG_X_SUBSAMPLING |
 			V4L2_VP9_FRAME_FLAG_Y_SUBSAMPLING;
 		break;
+	case V4L2_CTRL_TYPE_AV1_SEQUENCE:
+		p_av1_sequence = p;
+		p_av1_sequence->bit_depth = 8;
+		break;
 	case V4L2_CTRL_TYPE_FWHT_PARAMS:
 		p_fwht_params = p;
 		p_fwht_params->version = V4L2_FWHT_VERSION;