Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp4382915ybi; Mon, 3 Jun 2019 09:57:34 -0700 (PDT) X-Google-Smtp-Source: APXvYqwB4nWGimcLMQ0J9rpOjYPlQz2rigc5nrtrcZPpEHaORHwQcuta0UZ4aByw20zMTMy5ocot X-Received: by 2002:aa7:8e45:: with SMTP id d5mr23524615pfr.172.1559581054121; Mon, 03 Jun 2019 09:57:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559581054; cv=none; d=google.com; s=arc-20160816; b=XqcwcWP28FotPt+Z+4QL2/YmK8WmPoNYptUT+nPahpaEEZaATHesFDTtVPPp2Zaxrf hbXyb4tFif7XbkBTh51XvhWyPf8jKrhPi8wDzbhgbigTt1QMQg7PuKdqhc1uc91mALnq OfEdYP8yhWtVqAk4YwfNqi9BABf2F3YlXodeyVihekJJ6uOGLRad1nA/Fnxgr/Fs5MUs UrjmAcA4RXYvCeaIsDeRvzT5ZUKclb+UJvjAiJGy32i1iGxP/oWHd+00f8Ql+FnHw+jN DpBfORt1qEABQwlS6jDyjKOu/aioV1dcj7k/E+6wz+NEGN7l3LO3rMP4t8y6kp9FfGRl qCCQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=m3byrH7iwusQVQ2+NzL8O69ZbV79wtoOA5fbtJW476Q=; b=zVQsqaKLJcwsFm+hEmL+89ADpj0inU//s1RD+TgwOdeyiRIWTJ303cxad27hgmARou xywffJHyIk/zH8yLZp+1tjIrspyjMJ6SLY85cRFK8cbY2SZQjcAXO5/hh3Lr0pX0DE2a Ulk3GaHPQegSUAhELUh/JVRfOt1weOLy9EcCOU/RxRKAv0ZPsGRkmeMFJC+puBlDWo4h jpb1q/vy+WT+WKH33HHhXzN4znlctvYVNvS+hy87SNiFJSid9QUg4Vz24f7AFmcs4j9K wGOVblG9HCf3GsiqpSf1zZa46KcLSo8ARSmwylhaphzilo6htE11tMv9JUJo8l/VWl/c FM+Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 31si23449770plz.290.2019.06.03.09.57.18; Mon, 03 Jun 2019 09:57:34 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727998AbfFCLzl (ORCPT + 99 others); Mon, 3 Jun 2019 07:55:41 -0400 Received: from relay7-d.mail.gandi.net ([217.70.183.200]:44303 "EHLO relay7-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726179AbfFCLzl (ORCPT ); Mon, 3 Jun 2019 07:55:41 -0400 X-Originating-IP: 90.88.144.139 Received: from localhost (aaubervilliers-681-1-24-139.w90-88.abo.wanadoo.fr [90.88.144.139]) (Authenticated sender: maxime.ripard@bootlin.com) by relay7-d.mail.gandi.net (Postfix) with ESMTPSA id E0F012000E; Mon, 3 Jun 2019 11:55:36 +0000 (UTC) Date: Mon, 3 Jun 2019 13:55:36 +0200 From: Maxime Ripard To: Jernej Skrabec Cc: paul.kocialkowski@bootlin.com, wens@csie.org, mchehab@kernel.org, gregkh@linuxfoundation.org, linux-media@vger.kernel.org, devel@driverdev.osuosl.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 3/7] media: cedrus: Fix decoding for some H264 videos Message-ID: <20190603115536.j5lan6wtmbxpoe2k@flea> References: <20190530211516.1891-1-jernej.skrabec@siol.net> <20190530211516.1891-4-jernej.skrabec@siol.net> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="vveoqlv6ysvji45v" Content-Disposition: inline In-Reply-To: <20190530211516.1891-4-jernej.skrabec@siol.net> User-Agent: NeoMutt/20180716 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --vveoqlv6ysvji45v Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Hi, On Thu, May 30, 2019 at 11:15:12PM +0200, Jernej Skrabec wrote: > It seems that for some H264 videos at least one bitstream parsing > trigger must be called in order to be decoded correctly. There is no > explanation why this helps, but it was observed that two sample videos > with this fix are now decoded correctly and there is no regression with > others. > > Signed-off-by: Jernej Skrabec > --- > I have two samples which are fixed by this: > http://jernej.libreelec.tv/videos/h264/test.mkv > http://jernej.libreelec.tv/videos/h264/Dredd%20%E2%80%93%20DTS%20Sound%20Check%20DTS-HD%20MA%207.1.m2ts > > Although second one also needs support for multi-slice frames, which is not yet implemented here. > > .../staging/media/sunxi/cedrus/cedrus_h264.c | 22 ++++++++++++++++--- > 1 file changed, 19 insertions(+), 3 deletions(-) > > diff --git a/drivers/staging/media/sunxi/cedrus/cedrus_h264.c b/drivers/staging/media/sunxi/cedrus/cedrus_h264.c > index cc8d17f211a1..d0ee3f90ff46 100644 > --- a/drivers/staging/media/sunxi/cedrus/cedrus_h264.c > +++ b/drivers/staging/media/sunxi/cedrus/cedrus_h264.c > @@ -6,6 +6,7 @@ > * Copyright (c) 2018 Bootlin > */ > > +#include > #include > > #include > @@ -289,6 +290,20 @@ static void cedrus_write_pred_weight_table(struct cedrus_ctx *ctx, > } > } We should have a comment here explaining why that is needed > +static void cedrus_skip_bits(struct cedrus_dev *dev, int num) > +{ > + for (; num > 32; num -= 32) { > + cedrus_write(dev, VE_H264_TRIGGER_TYPE, 0x3 | (32 << 8)); Using defines here would be great > + while (cedrus_read(dev, VE_H264_STATUS) & (1 << 8)) > + udelay(1); > + } A new line here would be great > + if (num > 0) { > + cedrus_write(dev, VE_H264_TRIGGER_TYPE, 0x3 | (num << 8)); > + while (cedrus_read(dev, VE_H264_STATUS) & (1 << 8)) > + udelay(1); > + } Can't we make that a bit simpler by not duplicating the loop? Something like: int current = 0; while (current < num) { int tmp = min(num - current, 32); cedrus_write(dev, VE_H264_TRIGGER_TYPE, 0x3 | (current << 8)) while (...) ... current += tmp; } Maxime -- Maxime Ripard, Bootlin Embedded Linux and Kernel engineering https://bootlin.com --vveoqlv6ysvji45v Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEABYIAB0WIQRcEzekXsqa64kGDp7j7w1vZxhRxQUCXPUKuAAKCRDj7w1vZxhR xa7AAP9ziESwTw+9Wv7wL7C0BfDMaT38Drny6yfPw3LoggkqrwEAxQK0/0WKA7bE Ny7/W1EpBNFeb58M3ZPKD2rZ9JmR3Qw= =ESPy -----END PGP SIGNATURE----- --vveoqlv6ysvji45v--