media: imx-jpeg: Implement g_selection and s_selection
authorMing Qian <ming.qian@nxp.com>
Tue, 27 Sep 2022 03:12:16 +0000 (11:12 +0800)
committerHans Verkuil <hverkuil-cisco@xs4all.nl>
Fri, 30 Sep 2022 14:39:40 +0000 (16:39 +0200)
commit8b450a82a3dc3108b3718b68edf58c60aeed1801
treea13455ae8a18fb82a3df4ae88b1a00209a264800
parentbf8460d2f4e6a135998a8318f870caeed3106641
media: imx-jpeg: Implement g_selection and s_selection

The codec can support any image size WxH,
with arbitrary W (image width) and H (image height) dimensions.

But it requires buffer alignment,
so driver can report the aligned resolution through the g_fmt,
and report the actual resolution through the g_selection.

For encoder, it even support to encode a smaller jpeg
than the original picture through s_selection api.

For the decoder, we do not support cropping a portion smaller
than the original picture, due to hardware limitations (wrapper side).

Fixes: 9e7aa76cdb02 ("media: imx-jpeg: Align upwards buffer size")
Signed-off-by: Ming Qian <ming.qian@nxp.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c
drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.h