From patchwork Fri Dec 13 20:44:49 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Almer X-Patchwork-Id: 16777 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 2D68744908D for ; Fri, 13 Dec 2019 22:45:18 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 0328E68AB33; Fri, 13 Dec 2019 22:45:18 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pj1-f66.google.com (mail-pj1-f66.google.com [209.85.216.66]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 885E968A5C3 for ; Fri, 13 Dec 2019 22:45:11 +0200 (EET) Received: by mail-pj1-f66.google.com with SMTP id ca19so209827pjb.8 for ; Fri, 13 Dec 2019 12:45:11 -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=q6+C1qZzZSPTHyUZRQUAhWX2EwNcCFv7kiTEbNonrKg=; b=mjmeKAfO3V24hH76Gr98ZCXPI692YQEmOxZRsP+O71BEkpHeUgM/NmoX1xVuzHSEzg 4IIQfYSPlI+F8UJ7T7FStwWvylQP/uDoL6DlOXLKOn94iNaWg8lmzqj8TSRcuJ7H5hto 3HXZiAv7DJ478XH/WmW0QVyxRSyx6+FK/BFnCwmN8AGHbON6zCc6TRP/Pc+d+iLZG3b6 pFHAfIypKZCjKqAYl6OpT09F/rSzsw0i6vuJc3CbOX/Vp9wkWonhBMGblFDVkjp/0Cle gM+DAfwxoWaYSigZBODHpRiBTE1qF4EgBUa3cJ7wrl3VQme9Mvgl7kbJAtcO5g42LYYB c4ow== 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=q6+C1qZzZSPTHyUZRQUAhWX2EwNcCFv7kiTEbNonrKg=; b=aqs7gdWWju9UR0wA+iIs7M/rJKCVxyf/q8yp27RkVtv0cq7uPE2JDJYmgmbYxOLagD O3RD+CafNj5iGWfMrhMoe8+R3wJoyyH8vbb2gkr1yilV51w6dkF6J8xVFc8Lv/AKcvqu /krPR4bdSsQ6I69GJBzFutXR3SZV6/cQHLzmSu3DOHRYToxNb8V42/WOBva+zVvApU0Z 3uxzwYelPJ68wxSpUxPRYvl19b8/0lsgYuz448r5obmuUbQczyTGe2Qwaj/1V+AmQ1Up v2pDBnbLL88PIoN6DGneMB4n1QCVrAv1Ferh6HVbvyaEcG9YbwIglr9AxHdnxMYrqWGz Nxbg== X-Gm-Message-State: APjAAAUdGfcjQO7SoNDAyTv5267b9J8ZblJuvb3SWttJSmyUV4GRg6bD GAwj7Itzc6UdijSEsC3Cu0BqsQtw X-Google-Smtp-Source: APXvYqwkkkVP1Zn5R/X9u0Zql0kMZpOXoV9eMeqtFxLSP4SfsVl5IJBmfXrGaD0dfdO6pEfchtzEBA== X-Received: by 2002:a17:902:6b0c:: with SMTP id o12mr1413793plk.173.1576269909408; Fri, 13 Dec 2019 12:45:09 -0800 (PST) Received: from localhost.localdomain ([181.23.77.192]) by smtp.gmail.com with ESMTPSA id o12sm10554165pjf.19.2019.12.13.12.45.08 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Dec 2019 12:45:08 -0800 (PST) From: James Almer To: ffmpeg-devel@ffmpeg.org Date: Fri, 13 Dec 2019 17:44:49 -0300 Message-Id: <20191213204449.2722-1-jamrial@gmail.com> X-Mailer: git-send-email 2.24.0 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH] avcodec/cbs_av1: add missing valid range of values for num_cb_points and num_cr_points 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" It is a requirement of bitstream conformance that num_cr_points is less than or equal to 10. It is a requirement of bitstream conformance that num_cb_points is less than or equal to 10. Signed-off-by: James Almer --- libavcodec/cbs_av1.h | 8 ++++---- libavcodec/cbs_av1_syntax_template.c | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/libavcodec/cbs_av1.h b/libavcodec/cbs_av1.h index 643e76793f..9306bc59d6 100644 --- a/libavcodec/cbs_av1.h +++ b/libavcodec/cbs_av1.h @@ -260,11 +260,11 @@ typedef struct AV1RawFrameHeader { uint8_t point_y_scaling[16]; uint8_t chroma_scaling_from_luma; uint8_t num_cb_points; - uint8_t point_cb_value[16]; - uint8_t point_cb_scaling[16]; + uint8_t point_cb_value[10]; + uint8_t point_cb_scaling[10]; uint8_t num_cr_points; - uint8_t point_cr_value[16]; - uint8_t point_cr_scaling[16]; + uint8_t point_cr_value[10]; + uint8_t point_cr_scaling[10]; uint8_t grain_scaling_minus_8; uint8_t ar_coeff_lag; uint8_t ar_coeffs_y_plus_128[24]; diff --git a/libavcodec/cbs_av1_syntax_template.c b/libavcodec/cbs_av1_syntax_template.c index f53955c52e..848348af7d 100644 --- a/libavcodec/cbs_av1_syntax_template.c +++ b/libavcodec/cbs_av1_syntax_template.c @@ -1174,12 +1174,12 @@ static int FUNC(film_grain_params)(CodedBitstreamContext *ctx, RWContext *rw, infer(num_cb_points, 0); infer(num_cr_points, 0); } else { - fb(4, num_cb_points); + fc(4, num_cb_points, 0, 10); for (i = 0; i < current->num_cb_points; i++) { fbs(8, point_cb_value[i], 1, i); fbs(8, point_cb_scaling[i], 1, i); } - fb(4, num_cr_points); + fc(4, num_cr_points, 0, 10); for (i = 0; i < current->num_cr_points; i++) { fbs(8, point_cr_value[i], 1, i); fbs(8, point_cr_scaling[i], 1, i);