]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
media: amphion: adjust the encoder's value range of gop size
authorMing Qian <ming.qian@nxp.com>
Fri, 15 Jul 2022 07:38:00 +0000 (09:38 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 24 Oct 2022 07:57:49 +0000 (09:57 +0200)
[ Upstream commit 996f4e89fabe44ab9ac0aabb0697aeecbe717eca ]

adjust the value range of gop size from [0, 65535] to [1, 8000].
when the gop size is set to a too large value,
it may affect the encoded picture quality.
so constrain it to a reasonable range.

Fixes: 0401e659c1f92 ("media: amphion: add v4l2 m2m vpu encoder stateful driver")
Signed-off-by: Ming Qian <ming.qian@nxp.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/media/platform/amphion/venc.c

index 43d61d82f58c291b83e7093a26124436a3483e9f..0f21a181c1de92d9748ed519e9b6eefdecfb0d69 100644 (file)
@@ -644,7 +644,7 @@ static int venc_ctrl_init(struct vpu_inst *inst)
                          BITRATE_DEFAULT_PEAK);
 
        v4l2_ctrl_new_std(&inst->ctrl_handler, &venc_ctrl_ops,
-                         V4L2_CID_MPEG_VIDEO_GOP_SIZE, 0, (1 << 16) - 1, 1, 30);
+                         V4L2_CID_MPEG_VIDEO_GOP_SIZE, 1, 8000, 1, 30);
 
        v4l2_ctrl_new_std(&inst->ctrl_handler, &venc_ctrl_ops,
                          V4L2_CID_MPEG_VIDEO_B_FRAMES, 0, 4, 1, 0);