media: hantro: Read be32 words starting at every fourth byte
commite34bca49e4
upstream. Since (luma/chroma)_qtable is an array of unsigned char, indexing it returns consecutive byte locations, but we are supposed to read the arrays in four-byte words. Consequently, we should be pointing get_unaligned_be32() at consecutive word locations instead. Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@collabora.com> Reviewed-by: Ezequiel Garcia <ezequiel@collabora.com> Tested-by: Ezequiel Garcia <ezequiel@collabora.com> Cc: stable@vger.kernel.org Fixes:00c30f42c7
"media: rockchip vpu: remove some unused vars" Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
7ac962c5b7
commit
46b0e2900e
|
@ -67,12 +67,17 @@ hantro_h1_jpeg_enc_set_qtable(struct hantro_dev *vpu,
|
|||
unsigned char *chroma_qtable)
|
||||
{
|
||||
u32 reg, i;
|
||||
__be32 *luma_qtable_p;
|
||||
__be32 *chroma_qtable_p;
|
||||
|
||||
luma_qtable_p = (__be32 *)luma_qtable;
|
||||
chroma_qtable_p = (__be32 *)chroma_qtable;
|
||||
|
||||
for (i = 0; i < H1_JPEG_QUANT_TABLE_COUNT; i++) {
|
||||
reg = get_unaligned_be32(&luma_qtable[i]);
|
||||
reg = get_unaligned_be32(&luma_qtable_p[i]);
|
||||
vepu_write_relaxed(vpu, reg, H1_REG_JPEG_LUMA_QUAT(i));
|
||||
|
||||
reg = get_unaligned_be32(&chroma_qtable[i]);
|
||||
reg = get_unaligned_be32(&chroma_qtable_p[i]);
|
||||
vepu_write_relaxed(vpu, reg, H1_REG_JPEG_CHROMA_QUAT(i));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -98,12 +98,17 @@ rk3399_vpu_jpeg_enc_set_qtable(struct hantro_dev *vpu,
|
|||
unsigned char *chroma_qtable)
|
||||
{
|
||||
u32 reg, i;
|
||||
__be32 *luma_qtable_p;
|
||||
__be32 *chroma_qtable_p;
|
||||
|
||||
luma_qtable_p = (__be32 *)luma_qtable;
|
||||
chroma_qtable_p = (__be32 *)chroma_qtable;
|
||||
|
||||
for (i = 0; i < VEPU_JPEG_QUANT_TABLE_COUNT; i++) {
|
||||
reg = get_unaligned_be32(&luma_qtable[i]);
|
||||
reg = get_unaligned_be32(&luma_qtable_p[i]);
|
||||
vepu_write_relaxed(vpu, reg, VEPU_REG_JPEG_LUMA_QUAT(i));
|
||||
|
||||
reg = get_unaligned_be32(&chroma_qtable[i]);
|
||||
reg = get_unaligned_be32(&chroma_qtable_p[i]);
|
||||
vepu_write_relaxed(vpu, reg, VEPU_REG_JPEG_CHROMA_QUAT(i));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue