OSDN Git Service

media: hantro: Write quantization table registers in increasing addresses order
authorAndrzej Pietrasiewicz <andrzej.p@collabora.com>
Mon, 27 Jan 2020 14:30:09 +0000 (15:30 +0100)
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Mon, 24 Feb 2020 16:20:04 +0000 (17:20 +0100)
commit1b3bb574569e5fe5aeb0a9c73848430b7e271c20
tree77c57407fc6707b22dba2de926551a51df830004
parent85bdcb7eaae7c39dba9420de6df1cb227cf05732
media: hantro: Write quantization table registers in increasing addresses order

Luma and chroma qtables need to be written into two 16-register blocks,
each table consisting of 64 bytes total. The blocks are contiguous and
start at offset 0 for luma and at offset 0x40 for chroma.

The seemingly innocent optimization of writing the two blocks using one
loop causes side effects which result in improper values of quantization
tables being used by the hardware during encoding. Visually this results
in macroblocking artifacts around contrasting edges in encoded images. The
artifacts look like horizontally flipped shadows of the said edges.
Changing the write operations to non-relaxed variant doesn't help.

This patch removes this premature optimization and after this change the
macroblocking artifacts around contrasting edges are gone.

Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@collabora.com>
Tested-by: Ezequiel Garcia <ezequiel@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
drivers/staging/media/hantro/hantro_h1_jpeg_enc.c
drivers/staging/media/hantro/rk3399_vpu_hw_jpeg_enc.c