From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 58253C3A5A2 for ; Tue, 10 Sep 2019 10:18:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3956D2089F for ; Tue, 10 Sep 2019 10:18:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2393676AbfIJKSi (ORCPT ); Tue, 10 Sep 2019 06:18:38 -0400 Received: from bhuna.collabora.co.uk ([46.235.227.227]:40268 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729475AbfIJKSi (ORCPT ); Tue, 10 Sep 2019 06:18:38 -0400 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: ezequiel) with ESMTPSA id 8C97828C51D Message-ID: <255f22b1ddea5fa81104865769eec0fcb5617b36.camel@collabora.com> Subject: Re: [PATCH 03/12] media: hantro: Fix H264 motion vector buffer offset From: Ezequiel Garcia To: Jonas Karlman Cc: Mauro Carvalho Chehab , Hans Verkuil , Boris Brezillon , Philipp Zabel , Paul Kocialkowski , "linux-media@vger.kernel.org" , "linux-rockchip@lists.infradead.org" , "linux-kernel@vger.kernel.org" Date: Tue, 10 Sep 2019 11:18:34 +0100 In-Reply-To: References: <20190901124531.23645-1-jonas@kwiboo.se> Organization: Collabora Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.30.5-1.1 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org 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