From: Jianhua Lin <jianhua.lin@mediatek.com>
To: <mchehab@kernel.org>, <matthias.bgg@gmail.com>,
<angelogioacchino.delregno@collabora.com>
Cc: <linux-kernel@vger.kernel.org>,
<linux-arm-kernel@lists.infradead.org>,
<linux-mediatek@lists.infradead.org>,
<Project_Global_Chrome_Upstream_Group@mediatek.com>,
jianhua.lin <jianhua.lin@mediatek.com>
Subject: [PATCH 1/1] media: mediatek: jpeg: fix buffer alignment
Date: Fri, 18 Apr 2025 11:25:59 +0800 [thread overview]
Message-ID: <20250418032559.31043-1-jianhua.lin@mediatek.com> (raw)
From: "jianhua.lin" <jianhua.lin@mediatek.com>
The JPEG encoder image stride register must be MCU aligned.
For YUV422, it's 32-byte aligned, and for YUV420, it's
16-byte aligned.
The minimal DCT block size is 8x8, so the vertical buffer
alignment for YUV422 is 8-byte aligned, and for YUV420,
it's 16-byte aligned.
Signed-off-by: jianhua.lin <jianhua.lin@mediatek.com>
---
.../platform/mediatek/jpeg/mtk_jpeg_core.c | 24 +++++++++----------
1 file changed, 12 insertions(+), 12 deletions(-)
diff --git a/drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c b/drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c
index 834d2a354692..7dd652e5b6d4 100644
--- a/drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c
+++ b/drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c
@@ -40,8 +40,8 @@ static struct mtk_jpeg_fmt mtk_jpeg_enc_formats[] = {
.h_sample = {4, 4},
.v_sample = {4, 2},
.colplanes = 2,
- .h_align = 4,
- .v_align = 4,
+ .h_align = 16,
+ .v_align = 16,
.flags = MTK_JPEG_FMT_FLAG_OUTPUT,
},
{
@@ -50,8 +50,8 @@ static struct mtk_jpeg_fmt mtk_jpeg_enc_formats[] = {
.h_sample = {4, 4},
.v_sample = {4, 2},
.colplanes = 2,
- .h_align = 4,
- .v_align = 4,
+ .h_align = 16,
+ .v_align = 16,
.flags = MTK_JPEG_FMT_FLAG_OUTPUT,
},
{
@@ -60,8 +60,8 @@ static struct mtk_jpeg_fmt mtk_jpeg_enc_formats[] = {
.h_sample = {8},
.v_sample = {4},
.colplanes = 1,
- .h_align = 5,
- .v_align = 3,
+ .h_align = 32,
+ .v_align = 8,
.flags = MTK_JPEG_FMT_FLAG_OUTPUT,
},
{
@@ -70,8 +70,8 @@ static struct mtk_jpeg_fmt mtk_jpeg_enc_formats[] = {
.h_sample = {8},
.v_sample = {4},
.colplanes = 1,
- .h_align = 5,
- .v_align = 3,
+ .h_align = 32,
+ .v_align = 8,
.flags = MTK_JPEG_FMT_FLAG_OUTPUT,
},
};
@@ -87,8 +87,8 @@ static struct mtk_jpeg_fmt mtk_jpeg_dec_formats[] = {
.h_sample = {4, 2, 2},
.v_sample = {4, 2, 2},
.colplanes = 3,
- .h_align = 5,
- .v_align = 4,
+ .h_align = 16,
+ .v_align = 16,
.flags = MTK_JPEG_FMT_FLAG_CAPTURE,
},
{
@@ -96,8 +96,8 @@ static struct mtk_jpeg_fmt mtk_jpeg_dec_formats[] = {
.h_sample = {4, 2, 2},
.v_sample = {4, 4, 4},
.colplanes = 3,
- .h_align = 5,
- .v_align = 3,
+ .h_align = 32,
+ .v_align = 8,
.flags = MTK_JPEG_FMT_FLAG_CAPTURE,
},
};
--
2.46.0
next reply other threads:[~2025-04-18 3:26 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-18 3:25 Jianhua Lin [this message]
2025-04-22 14:37 ` AngeloGioacchino Del Regno
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250418032559.31043-1-jianhua.lin@mediatek.com \
--to=jianhua.lin@mediatek.com \
--cc=Project_Global_Chrome_Upstream_Group@mediatek.com \
--cc=angelogioacchino.delregno@collabora.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=matthias.bgg@gmail.com \
--cc=mchehab@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®