Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp894365ybg; Fri, 18 Oct 2019 08:56:03 -0700 (PDT) X-Google-Smtp-Source: APXvYqyv+bGkz4tZWwYLvETEn7BS9qT6Cu+KPjYO9/SuCQUDxf/pVx/2r5GBaWg1w4GBC5iaSjbW X-Received: by 2002:a05:6402:a4f:: with SMTP id bt15mr10424962edb.121.1571414163498; Fri, 18 Oct 2019 08:56:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571414163; cv=none; d=google.com; s=arc-20160816; b=D1kqnFrP40ue/UJ/TE5K/u21q87o0pUTu8YtQBv2R4DjDEjjm/HB6fcjd5r7K/imka OrQOYM5lY+0ilDcQQNPYxWWX3Jx65IIaQPsLzcH9EjzsTgOdxNQqPM5kAbqREfWAyG40 PSBoQEJGHZ1HuJZeP0UFsNUEElQR/eQJf/CrHZ8YgfWZKqeIKGmDLlKNeaZbXpbFxyUu 7Q5/d+nsI1nUo6J+jalJe06K8qe/o2QGFf8wGdN3NjpFHplBnBuLL/sTPtDsjcIXyU2t TPQ4+ongwUKIs1mpuAC2+bBRVi7yJa3Vd3UjmZpimDDwxuS8qWYgdrQpSpJ1V4G8emLH 5anA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=fqfvJwGghxY/zvJczuG3/Ld93T9mcoCDDrIkbXWs7Sk=; b=tbz2VYb+igTM0baTrY40QlF5sx0Xx5PO5DCAiupUKkXck+bSZfZoS5XMMyx16jdETi DPUTwRGe4vfRayimHAS3l6YtuyXhZmQtcOYR+YOycTaHLUXbqq+8kkR7zlqxFwgH9MJ+ mdBgY5fR6EZDiq77YZctQYz+KsksFtmJ9RXXUQbg66Q5Yx6qR1IjkGkphRH2W4c9bRRy 3jIS9xvojfNY2gpSoVdwcy2Ew3/HPSUi+0MI/VRa2Gt73lZVW9wy1XMNicnjTHq+KZdU NrE+NiluMM8YKgX3troYRL93oQTKy19PcDWgfHTE0tE0DAcIa0Wkkh6HFeTh7R2y6ACs p9BA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=po5ekprx; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p38si4126089edc.449.2019.10.18.08.55.40; Fri, 18 Oct 2019 08:56:03 -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; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=po5ekprx; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390776AbfJQM6D (ORCPT + 99 others); Thu, 17 Oct 2019 08:58:03 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:40762 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726534AbfJQM6D (ORCPT ); Thu, 17 Oct 2019 08:58:03 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=Content-Transfer-Encoding: Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Subject:Cc:To: From:Date:Sender:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=fqfvJwGghxY/zvJczuG3/Ld93T9mcoCDDrIkbXWs7Sk=; b=po5ekprxuyc4XbZj/GiSZZOxK XnmJuBTsnFVusvf8RHqb32e2q+BmM2FLOphxhDvtk100NFpDBCIJDmALheko0WV94K640qpsZBEf6 VDmAMk6fwXdR4STE0QPGHixD/qfmg5dirQ/+mR47pm+PwKrf69zIVmSnmJXN7wI3UzGAwQAfug5CB NOQ2eO28le2sE8uQlLKcBeyvLXrRj4vbfixTaHuis7SrNbS+txcPtnMBawip8mC3BO8RKfnRsop4U hGzu2L34yC0b1u++srYXLiy3fHJkhIsZro05OdLPxkzL4gBWXseVaW2TzTPGxfVYsTT75hKwlPOq3 XhVZZjgvw==; Received: from [179.95.49.118] (helo=coco.lan) by bombadil.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1iL5Lp-0006o4-7D; Thu, 17 Oct 2019 12:57:57 +0000 Date: Thu, 17 Oct 2019 09:57:51 -0300 From: Mauro Carvalho Chehab To: Paul Kocialkowski Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@googlegroups.com, Chen-Yu Tsai , Maxime Ripard , Hans Verkuil , Ezequiel Garcia , Tomasz Figa , Nicolas Dufresne , Jernej Skrabec , Jonas Karlman , Thomas Petazzoni Subject: Re: [PATCH v8 3/3] media: cedrus: Add HEVC/H.265 decoding support Message-ID: <20191017095751.5a229051@coco.lan> In-Reply-To: <20190927143411.141526-4-paul.kocialkowski@bootlin.com> References: <20190927143411.141526-1-paul.kocialkowski@bootlin.com> <20190927143411.141526-4-paul.kocialkowski@bootlin.com> X-Mailer: Claws Mail 3.17.4 (GTK+ 2.24.32; x86_64-redhat-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Em Fri, 27 Sep 2019 16:34:11 +0200 Paul Kocialkowski escreveu: > This introduces support for HEVC/H.265 to the Cedrus VPU driver, with > both uni-directional and bi-directional prediction modes supported. > > Field-coded (interlaced) pictures, custom quantization matrices and > 10-bit output are not supported at this point. > > Signed-off-by: Paul Kocialkowski > --- ... > + unsigned int ctb_size_luma = > + 1 << log2_max_luma_coding_block_size; Shifts like this is a little scary. "1" constant is signed. So, if log2_max_luma_coding_block_size is 31, the above logic has undefined behavior. Different archs and C compilers may handle it on different ways. > +#define VE_DEC_H265_LOW_ADDR_PRIMARY_CHROMA(a) \ > + (((a) << 24) & GENMASK(31, 24)) Same applies here and on other similar macros. You need to enforce (a) to be unsigned, as otherwise the behavior is undefined. Btw, this is a recurrent pattern on this file. I would define a macro, e. g. something like: #define MASK_BITS_AND_SHIFT(v, high, low) \ ((UL(v) << low) & GENMASK(high, low)) And use it for all similar patterns here. The best would be to include such macro at linux/bits.h, although some upstream discussion is required. So, for now, let's add it at this header file, but work upstream to have it merged there. Thanks, Mauro