From patchwork Thu Feb 13 02:59:14 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Almer X-Patchwork-Id: 17771 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 2737C44B4C4 for ; Thu, 13 Feb 2020 05:08:13 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id F33CA68AEA0; Thu, 13 Feb 2020 05:08:12 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-qt1-f196.google.com (mail-qt1-f196.google.com [209.85.160.196]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 0B0EA68A171 for ; Thu, 13 Feb 2020 05:08:06 +0200 (EET) Received: by mail-qt1-f196.google.com with SMTP id t13so3367876qto.3 for ; Wed, 12 Feb 2020 19:08:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=/5VoWbdV99Eie0mEipUIhRunQNGibDhNaO7aNiIDxmM=; b=K646b5obGLF+qTTE1aPRyYoh366SNbFGNknutSnWoCzCb2YXQEzRi72ciacU20Xmi2 1ufpD6TbHU78e7juHEbFXYCy1T3mz2Do8SXy+0/NeH09VkmxXxPD77UcdCwe1vo/rb7u Yt8H/DDMr1TKkKZh5bKfgkZvAn9VJWWr/a6VbyYfhd6YpAeAYwBt4vhbsB1JygWzJ+4E eiyd3nZJVqmVh050ZR8j1LRtN5UvrNyFgNOn9ql1Mob0qE7CGb1DKVMtHUgY6bl5CGlJ IkqvDbw0dB8Ii+SqjMhFZb0TC277Mde4ZzKOZwMyREs5j/A8LxWHheReuXaH8g0AXZ91 KtBg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=/5VoWbdV99Eie0mEipUIhRunQNGibDhNaO7aNiIDxmM=; b=p6AaScLk9iGLBVAJb/XHLT/IjBWes/gzbfBWkw7GPYULzaNWeP0+HY1FyNpbC484JA 9uke0QdFusGP06bjbNFMUx2IgFvgZte9OrfEdAgj+BoLYb9Zc1ka5A8hzG2UBEH40/s0 YFwOQ6y5FtDHiyb2BgPds3IXKg3x6RLoDHkKlWaa6la/txUQJi0G9cp6xFSC02sJeWap loHmE9Mh3+C+0goKdkAdu6PJXe0j/F3O+ZtbgVoKChSAPcg0a6xRzgQsEzJV0Wuf4xLv V5+FVaQPColxh3mq/ckwHycOYxHK95sV4BzptIKy/BPD0GhLmaQke7Q1VtCwNvFkwOoy r5Hw== X-Gm-Message-State: APjAAAWQ5vTK1a1wrqSA2XSVmOc7W3vWxphuXBfIqbxs4lkpanNO/9ki kaKyX4F3PoSY7YHO+K1N6QRLdLmt X-Google-Smtp-Source: APXvYqzJzpPnCHfo5DUEifmhQwBsCm8bKVbtObmXO3OcQsANW5vaE46o3VI8xYsk1EXO9maIluZVJw== X-Received: by 2002:ac8:704:: with SMTP id g4mr9914306qth.197.1581562802306; Wed, 12 Feb 2020 19:00:02 -0800 (PST) Received: from localhost.localdomain ([191.83.217.165]) by smtp.gmail.com with ESMTPSA id v55sm768018qtc.1.2020.02.12.19.00.01 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Feb 2020 19:00:01 -0800 (PST) From: James Almer To: ffmpeg-devel@ffmpeg.org Date: Wed, 12 Feb 2020 23:59:14 -0300 Message-Id: <20200213025914.5451-1-jamrial@gmail.com> X-Mailer: git-send-email 2.25.0 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH] avcodec/cbs_av1: add missing value constrains to point_y_value, point_cb_value and point_cr_value X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" If i is greater than 0, it is a requirement of bitstream conformance that point_y_value[ i ] is greater than point_y_value[ i - 1 ]. If i is greater than 0, it is a requirement of bitstream conformance that point_cb_value[ i ] is greater than point_cb_value[ i - 1 ]. If i is greater than 0, it is a requirement of bitstream conformance that point_cr_value[ i ] is greater than point_cr_value[ i - 1 ]. Signed-off-by: James Almer --- libavcodec/cbs_av1_syntax_template.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/libavcodec/cbs_av1_syntax_template.c b/libavcodec/cbs_av1_syntax_template.c index b62e07fb11..614097bc7e 100644 --- a/libavcodec/cbs_av1_syntax_template.c +++ b/libavcodec/cbs_av1_syntax_template.c @@ -1156,7 +1156,8 @@ static int FUNC(film_grain_params)(CodedBitstreamContext *ctx, RWContext *rw, fc(4, num_y_points, 0, 14); for (i = 0; i < current->num_y_points; i++) { - fbs(8, point_y_value[i], 1, i); + fcs(8, point_y_value[i], + i ? current->point_y_value[i - 1] + 1 : 0, MAX_UINT_BITS(8), 1, i); fbs(8, point_y_scaling[i], 1, i); } @@ -1175,12 +1176,14 @@ static int FUNC(film_grain_params)(CodedBitstreamContext *ctx, RWContext *rw, } else { fc(4, num_cb_points, 0, 10); for (i = 0; i < current->num_cb_points; i++) { - fbs(8, point_cb_value[i], 1, i); + fcs(8, point_cb_value[i], + i ? current->point_cb_value[i - 1] + 1 : 0, MAX_UINT_BITS(8), 1, i); fbs(8, point_cb_scaling[i], 1, i); } fc(4, num_cr_points, 0, 10); for (i = 0; i < current->num_cr_points; i++) { - fbs(8, point_cr_value[i], 1, i); + fcs(8, point_cr_value[i], + i ? current->point_cr_value[i - 1] + 1 : 0, MAX_UINT_BITS(8), 1, i); fbs(8, point_cr_scaling[i], 1, i); } }