Commit 8c050aca authored by Fei Shao's avatar Fei Shao Committed by Zheng Zengkai
Browse files

media: mtk-jpegenc: Fix bug in JPEG encode quality selection

stable inclusion
from stable-v6.6.2
commit 495fd088870c9c5c20133046ff60d96f02bf70e1
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I8IW7G

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=495fd088870c9c5c20133046ff60d96f02bf70e1



--------------------------------

[ Upstream commit 0aeccc63f3bc4cfd49dc4893da1409402ee6b295 ]

The driver uses the upper-bound approach to decide the target JPEG
encode quality, but there's a logic bug that if the desired quality is
higher than what the driver can support, the driver falls back to using
the worst quality.

Fix the bug by assuming using the best quality in the beginning, and
with trivial refactor to avoid long lines.

Fixes: 45f13a57 ("media: platform: Add jpeg enc feature")
Signed-off-by: default avatarFei Shao <fshao@chromium.org>
Reviewed-by: default avatarChen-Yu Tsai <wenst@chromium.org>
Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
Signed-off-by: default avatarZheng Zengkai <zhengzengkai@huawei.com>
parent 17003dc7
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment