Re: [PATCH 03/12] media: hantro: Fix H264 motion vector buffer offset
From: Ezequiel Garcia
Date: Tue Sep 10 2019 - 06:18:40 EST
Hi Jonas,
Thanks for fixing this, I'm happy we are reducing the amount
of black magic here.
On Sun, 2019-09-01 at 12:45 +0000, Jonas Karlman wrote:
> A decoded 8-bit 4:2:0 frame need memory for up to 448 macroblocks
> and is laid out in memory as follow:
>
> +-------------------+
> > Y-plane 256 MBs |
> +-------------------+
> > UV-plane 128 MBs |
> +-------------------+
> > MV buffer 64 MBs |
> +-------------------+
>
> The motion vector buffer offset is currently correct for 4:2:0 because
> the extra space for motion vectors is overallocated with an extra 64 MBs.
>
> Wrong offset for both destination and motion vector buffer are used
> for the bottom field of field encoded content, wrong offset is
> also used for 4:0:0 (monochrome) content.
>
> Fix this by always setting the motion vector address to the expected
> 384 MBs offset for 4:2:0 and 256 MBs offset for 4:0:0 content.
>
> Also use correct destination and motion vector buffer offset
> for the bottom field of field encoded content.
>
> While at it also extend the check for 4:0:0 (monochrome) to include an
> additional check for High Profile (100).
>
As with the scaling list, I believe it would make a lot of sense
to document this in the driver itself.
Thanks,
Ezequiel