Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2725265pxj; Mon, 14 Jun 2021 05:53:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy/IkOt6jw0JpUX9kXFztd+d1OTSwzp4vUTM8eo4Yo/V2SUSSnccsFDLHmG48qWkokxzF0y X-Received: by 2002:a17:906:a203:: with SMTP id r3mr15489929ejy.361.1623675209871; Mon, 14 Jun 2021 05:53:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623675209; cv=none; d=google.com; s=arc-20160816; b=s2WzKJ6jCY1g6uQ2eh79gb5e4GK9PgO8r6kIU2/6D91xh6KANLecABasGkgzFi8Gin LYX0duLu0Y+WxEGN2rZdNV/C44ZxjSm9C1aKQAO+qT9bHc934uP2FML2NFIr0YdKSeJ0 U3i7bwrBu7ojwCpDDzvoDHsSL8pXDoFDxBgz2KE0dCN70RiC/MFP18pvCpS7GinsvL19 G4WI0qu8afPRdHOA3aVkKqKaYoGjbl6jA0jvADvVKps9hn7cCRcUMUDb9wf2Thm9V8+5 utWh//6xMhiY/7uzHa0je8vCK4a7C8znlG9oMs1+4EbDjY/KBlLgMsmqEW/IWA7zKEl8 xN1g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:organization:references:in-reply-to:date:cc:to:from :subject:message-id; bh=M3b5fh8GBaX28BMDOThrhv5xy3r1aaUuyHE7hMbdydU=; b=c24Dv7UAetRMKtMqy/rs+eEj0M4a2o72JSbDEWHa+IkiraAlV34eugB7qaTdcQok7a EfrRpgWurU4TapqUCOwO3IkYQA5JBFoDSU7W1jAt9liNQCPtMVetP3Ovp3qJDiE+wa5o 3+u3NxHuFHs6zLzXZypaZGjSiLbYS4iSWpCSdloVnVCj9I4Ag1qoD73TZttAHB6P91fs 4H4H6o0YJ1kSki+Xzlle/RwV7mqrTDziPhK8BrVQiDqmpo04+F7IWrw15aOnRFuzMn/x LPB3mfLw98xsfQLiGT4SY1tRYwlUGZTnOAhq3AntiUUlh1rUZyXekFMhINdSwy9kYXxX dHNQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b18si11544847edv.227.2021.06.14.05.53.07; Mon, 14 Jun 2021 05:53:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233732AbhFNMx0 (ORCPT + 99 others); Mon, 14 Jun 2021 08:53:26 -0400 Received: from bhuna.collabora.co.uk ([46.235.227.227]:48788 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233721AbhFNMxK (ORCPT ); Mon, 14 Jun 2021 08:53:10 -0400 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: ezequiel) with ESMTPSA id D30551F4035A Message-ID: <96e63be705b04b40a943307c81ed71e8c573ef96.camel@collabora.com> Subject: Re: [PATCH v2 7/8] media: hevc: Add scaling matrix control From: Ezequiel Garcia To: Benjamin Gaignard , Hans Verkuil , p.zabel@pengutronix.de, mchehab@kernel.org, shawnguo@kernel.org, s.hauer@pengutronix.de, festevam@gmail.com, gregkh@linuxfoundation.org, mripard@kernel.org, paul.kocialkowski@bootlin.com, wens@csie.org, jernej.skrabec@siol.net, emil.l.velikov@gmail.com, andrzej.p@collabora.com, jc@kynesim.co.uk, jernej.skrabec@gmail.com Cc: kernel@pengutronix.de, linux-imx@nxp.com, linux-media@vger.kernel.org, linux-rockchip@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Date: Mon, 14 Jun 2021 09:50:46 -0300 In-Reply-To: References: <20210610154442.806107-1-benjamin.gaignard@collabora.com> <20210610154442.806107-8-benjamin.gaignard@collabora.com> <87a1e585-688e-7c4d-b9a9-24f42772a1a8@xs4all.nl> Organization: Collabora Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.38.2-1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 2021-06-14 at 09:43 +0200, Benjamin Gaignard wrote: > > Le 14/06/2021 à 09:27, Hans Verkuil a écrit : > > On 10/06/2021 17:44, Benjamin Gaignard wrote: > > > HEVC scaling lists are used for the scaling process for transform > > > coefficients. > > > V4L2_HEVC_SPS_FLAG_SCALING_LIST_ENABLED has to set when they are > > > encoded in the bitstream. > > Comparing H264 with HEVC I noticed that the corresponding flag for H264 is > > called V4L2_H264_PPS_FLAG_SCALING_MATRIX_PRESENT. > > > > Should those names be aligned? Also, it is part of PPS for H264 and SPS in HEVC, > > is that difference correct? > > In ITU specifications ("7.4.3.2.1 General sequence parameter set RBSP semantics") this flag is define like that: > scaling_list_enabled_flag equal to 1 specifies that a scaling list is used for the scaling process for transform coefficients. > scaling_list_enabled_flag equal to 0 specifies that scaling list is not used for the scaling process for transform coefficients. > > So for me the naming is correct. > The bitstream is really parsed in userspace (gstreamer, ffmpeg, chromium). Not all bitstream parameters need to be passed as-is, because the kernel is actually a sort of low-level layer in the decoder stack. I think it's probably most appropriate to follow our H.264 interface semantics, see https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=54889c51b833d236228f983be16212fbe806bb89. The H.264 story goes like this: * Default scaling list is used for decoding, but can be modified by a bitstream-provided scaling list. * The scaling list modification can be in SPS or in PPS. * For each frame, the SPS and PPS headers will tell if a modified scaling list must be used for decoding, and if it's provided in the SPS header or the PPS header. The userspace parser must take care of this, and pass a scaling matrix to the kernel via V4L2_CID_MPEG_VIDEO_H264_SCALING_MATRIX, setting PPS_FLAG_SCALING_MATRIX_PRESENT. This flag is at the PPS control, so the scaling modification can be applied on each frame. In other words, the kernel interface is simpler, it just receives a scaling matrix and a flag telling if it must be used or not. We should probably clarify the documentation, so this process is more clear. From the HEVC spec, it seems the process should be similar. The only difference is the SPS "scaling_list_enabled_flag" parameter, which doesn't exist in H.264. Nicolas: what do you think? Thanks, Ezequiel