Received: by 2002:a25:ca44:0:0:0:0:0 with SMTP id a65csp1098435ybg; Mon, 27 Jul 2020 07:53:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy3qDSt7UoGdEH1N6lNjhsevEHsqD5U38aj4k5c18n9pvmBg/sSYgsKJA4HlksnEohLEBTI X-Received: by 2002:a50:fc8d:: with SMTP id f13mr4284768edq.380.1595861630786; Mon, 27 Jul 2020 07:53:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595861630; cv=none; d=google.com; s=arc-20160816; b=fm4Ts7AKO6OAqMIs89xlRBVCt+2b6CrkkklaHUOaKe4WaxF8cNTAak4cnXxg6C5wtz 9KQvNwENBnsIry5EcMW1hpbNcKG1lJ2hVcpdE565d0e529AdPiL3EpfKefnxHLoDxKgP HUzCW6gvwqDKRBEkmkT0gAbj0ib2Rz2ptpJjAAHaveqM9UEpJnZVQPLwnBpV8CsNXFG6 Ci9wL5+NrwmyEng9PTlBWLiPtk1X4zV7i0MUMsYTe/p5kJIKpbJUqaaLBhDww0X0RfZ0 6PSxuU1/seS+7wnetbD8H0pWxf551t24xMfmTksD0NILRbP9n8xnOux41JoKTWNeAjZP m9BA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=DMgN5tZMxqYrW7jQ12rF21saA28TBC0yxDThKi4Y2Xk=; b=TjDwlxkUDdROWVdJmzUxLENcAYWnq44W+8VU/ikokDS2CR8HZD75gUQku8Dkm1f+A/ /e9/vt2gGfbJgGEax/evjeqi0sLJVCM0mPJdlcblVANaEiXrOvHJjN6ygsaNfhkL22DN PWl6L+FIkIniFqEwSXgxVb+mCTP7xkHB41FY0pEAls3rEDIkhZMzaEluyDiVdTQAjp5L EPhkehMsSHbpjemaWpCmrvehOQe6Pw3pDvruMcDNclDvZjJ3VxzLJiF+37GDltvhDXP0 Lz/2btG80PSL+v7qDCt90Ak84AElklf6j8l/+T/rXxZMtsmKhj2orxNa/fUkYp4FHD2y p1LQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=hxLR76E4; 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=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a18si3653230ejt.742.2020.07.27.07.53.28; Mon, 27 Jul 2020 07:53:50 -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; dkim=pass header.i=@chromium.org header.s=google header.b=hxLR76E4; 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=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729687AbgG0OxG (ORCPT + 99 others); Mon, 27 Jul 2020 10:53:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42136 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728593AbgG0OxF (ORCPT ); Mon, 27 Jul 2020 10:53:05 -0400 Received: from mail-ed1-x542.google.com (mail-ed1-x542.google.com [IPv6:2a00:1450:4864:20::542]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 37369C0619D2 for ; Mon, 27 Jul 2020 07:53:05 -0700 (PDT) Received: by mail-ed1-x542.google.com with SMTP id di22so5184224edb.12 for ; Mon, 27 Jul 2020 07:53:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=DMgN5tZMxqYrW7jQ12rF21saA28TBC0yxDThKi4Y2Xk=; b=hxLR76E4N9viPtHqqQtAE8b60wZVrZdsC9t3ff7Tm0CZxzG/syJaZW3kduG89h50wS tq6gKpMa4gYp4isW/rKyf+FqFfB0lxcdUASPxgL2r4qRijur9HU0j4xNot3v0YkOX+Pf JVNFga9Tzr/K51kVqTwHwtFqZLJDFRnbhVWN4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=DMgN5tZMxqYrW7jQ12rF21saA28TBC0yxDThKi4Y2Xk=; b=GPAiWOGkFoHNUAmUMmGVUnIkYCct2yTvvcNo06sW53giaAWcCFsAtSaPHZYQ4gjdl0 uP9lxHzwDPIjpR09vnld/D23DsicbvnlJb/3UukFPR/5xAbWpYIucMvUxDqXWDeQm64y gwCXzDg4bR2p7sPKHEMYXwU8H8IbcVf7gQrrPWnZfPhrRKJaS48yLWVmsvdP8qvcDSrs gxaMwN9iUevoVfYGvK+pDsqBuMRpcQIctVQVWXABcOOkLEuO3KGO6L0bWIhtWb7FFqh2 M6rnTf1/vAC71h7T0zsl8Rmn9wfmIHrOg3gQPrGEmFWzs/eyWSUKphv8pPkq57KEdZAT v7GQ== X-Gm-Message-State: AOAM530sIZZl7utRzT5I7wn3aI2NaFqPfh+4qtosijcF+aQLZ+4amge7 S+UZy2ld33onQHC2LLmD5dQsuFqPiibLVA== X-Received: by 2002:a50:f19c:: with SMTP id x28mr19369236edl.295.1595861583522; Mon, 27 Jul 2020 07:53:03 -0700 (PDT) Received: from mail-wr1-f41.google.com (mail-wr1-f41.google.com. [209.85.221.41]) by smtp.gmail.com with ESMTPSA id k22sm3527437edo.24.2020.07.27.07.53.02 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 27 Jul 2020 07:53:02 -0700 (PDT) Received: by mail-wr1-f41.google.com with SMTP id a15so15183588wrh.10 for ; Mon, 27 Jul 2020 07:53:02 -0700 (PDT) X-Received: by 2002:adf:fe12:: with SMTP id n18mr20714835wrr.295.1595861581935; Mon, 27 Jul 2020 07:53:01 -0700 (PDT) MIME-Version: 1.0 References: <20200715202233.185680-1-ezequiel@collabora.com> <20200715202233.185680-9-ezequiel@collabora.com> <636aab0a2be83e751a82a84ac3946afec2c87a17.camel@collabora.com> In-Reply-To: <636aab0a2be83e751a82a84ac3946afec2c87a17.camel@collabora.com> From: Tomasz Figa Date: Mon, 27 Jul 2020 16:52:50 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 08/10] media: uapi: h264: Clean slice invariants syntax elements To: Ezequiel Garcia Cc: Alexandre Courbot , Linux Media Mailing List , LKML , kernel@collabora.com, Jonas Karlman , Hans Verkuil , Jeffrey Kardatzke , Nicolas Dufresne , Philipp Zabel , Maxime Ripard , Paul Kocialkowski Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jul 27, 2020 at 4:39 PM Ezequiel Garcia wrote: > > Hi Alexandre, > > Thanks a lot for the review. > > On Sat, 2020-07-25 at 23:34 +0900, Alexandre Courbot wrote: > > On Thu, Jul 16, 2020 at 5:23 AM Ezequiel Garcia wrote: > > > The H.264 specification requires in its "Slice header semantics" > > > section that the following values shall be the same in all slice headers: > > > > > > pic_parameter_set_id > > > frame_num > > > field_pic_flag > > > bottom_field_flag > > > idr_pic_id > > > pic_order_cnt_lsb > > > delta_pic_order_cnt_bottom > > > delta_pic_order_cnt[ 0 ] > > > delta_pic_order_cnt[ 1 ] > > > sp_for_switch_flag > > > slice_group_change_cycle > > > > > > and can therefore be moved to the per-frame decode parameters control. > > > > I am really not a H.264 expert, so this question may not be relevant, > > All questions are welcome. I'm more than happy to discuss this patchset. > > > but are these values specified for every slice header in the > > bitstream, or are they specified only once per frame? > > > > I am asking this because it would certainly make user-space code > > simpler if we could remain as close to the bitstream as possible. If > > these values are specified once per slice, then factorizing them would > > leave user-space with the burden of deciding what to do if they change > > across slices. > > > > Note that this is a double-edged sword, because it is not necessarily > > better to leave the firmware in charge of deciding what to do in such > > a case. :) So hopefully these are only specified once per frame in the > > bitstream, in which case your proposal makes complete sense. > > Frame-based hardwares accelerators such as Hantro and Rockchip VDEC > are doing the slice header parsing themselves. Therefore, the > driver is not really parsing these fields on each slice header. > > Currently, we are already using only the first slice in a frame, > as you can see from: > > if (slices[0].flags & V4L2_H264_SLICE_FLAG_FIELD_PIC) > reg |= G1_REG_DEC_CTRL0_PIC_FIELDMODE_E; > > Even if these fields are transported in the slice header, > I think it makes sense for us to split them into the decode params > (per-frame) control. > > They are really specified to be the same across all slices, > so even I'd say if a bitstream violates this, it's likely > either a corrupted bitstream or an encoder bug. > > OTOH, one thing this makes me realize is that the slice params control > is wrongly specified as an array. It is _not_. > Namely, this text > should be removed: > > This structure is expected to be passed as an array, with one > entry for each slice included in the bitstream buffer. > > As the API is really not defined that way. > > I'll remove that on next iteration. The v4l2_ctrl_h264_slice_params struct has more data than those that are deemed to be the same across all the slices. A remarkable example are the size and start_byte_offset fields.