From patchwork Sun Sep 5 11:02:57 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Niklas Haas X-Patchwork-Id: 30002 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6602:2a4a:0:0:0:0 with SMTP id k10csp2855792iov; Sun, 5 Sep 2021 04:03:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxiukYMumtM4S3vJTvEj/LMxRIVg43cdvDJc+/CpUK8vsbaVXcH6Bkj61D/kGcizci4RWTW X-Received: by 2002:a05:6402:4d:: with SMTP id f13mr8206068edu.275.1630839794193; Sun, 05 Sep 2021 04:03:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630839794; cv=none; d=google.com; s=arc-20160816; b=ms5Lxw6wIUvBTAQOSE05KQMCIsROUyTj/jcij+xlO7PF63nYoCTcNalYTSDvV2XgG5 Q98/isEJBFp2yfIBNTYLTxypqy1GLX0Vgktlbj5BlS7tdUykfXAT+pacDzT343kjZRTg C8smiVuD6O/qJqU7J6o5UQZXYgP4hMNEHH7Kz1TOKVXVcj19tXLVWRScDqmJc451V1uN kRMDgxXbHGZx0KXSIOh0B86nQNhnAgkEQfB3CwEQbhI1LLYE0iMQ5QoFgjgCGjqqOxId qw84FS3iZmWKZ2rlmBpmuPGwDtVwZRdUK6elB6n7VrHJd5QyQsNHPKMvSAfkyVM8i/VQ uhnQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature:delivered-to; bh=kVtJmoVC4Fr1dXPNLO6eF1x2A34hNEiAxv5v3rplV5A=; b=O/G4E8OOZUF0ba3ev5zuOxLrnMTNnMo/1pTrFO3H3yyaq8mkbhupnsJYRG/zDUw1dv cryD6bC/LT9CIfCPOYHwU33pbobBlhPEJs5l494cS2mK3Gbj/wDyQzS5nNLRaz+She9f x8JP+VYds+FX7rpr6PCPNTU2ZP8e3/KTdiKIBpE/hNngPncWjd4aINAXf8PRCwXxlrlr wWkYNIezyf6DdTiatTfo9QMLW873h0QOdv0gJF1GInrJqEj+B4LkXTd6+vGsBaVvdngV z/3x3RLeVyZia5rYc0YFUgSSsHGgNoQWC38+q8yOSlsT3wUInYnNdfsCQngI+mwGKA8T 48BQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@haasn.xyz header.s=mail header.b="Dfqko/fa"; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id ka11si4826472ejc.367.2021.09.05.04.03.13; Sun, 05 Sep 2021 04:03:14 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@haasn.xyz header.s=mail header.b="Dfqko/fa"; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 8F0BC68811D; Sun, 5 Sep 2021 14:03:08 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from haasn.dev (haasn.dev [78.46.187.166]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id F316F680830 for ; Sun, 5 Sep 2021 14:03:01 +0300 (EEST) Received: from haasn.dev (unknown [10.30.0.2]) by haasn.dev (Postfix) with ESMTP id BC39247797; Sun, 5 Sep 2021 13:03:01 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=haasn.xyz; s=mail; t=1630839781; bh=5F6pn2v4tzYPSdtUL6OltVAs94iidyRCM0BCZl0EONs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Dfqko/fanuQQ4JDcRBZ+CSkVXRuq5KScks72KkvjnvfMtSjSGgT73TSJGtaJFTsR0 pjcyemYtxpO9KxsSegIWOXpYyIZJ+beOuxqNVf6j5WuyPEQ1bcvSgdn3UUJf0E9ivk ryWgAeBj3RQnPw1bZWSVMkRE/m31UrNsBWJLezwc= From: Niklas Haas To: ffmpeg-devel@ffmpeg.org Date: Sun, 5 Sep 2021 13:02:57 +0200 Message-Id: <20210905110257.58834-2-ffmpeg@haasn.xyz> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210905110257.58834-1-ffmpeg@haasn.xyz> References: <20210905110257.58834-1-ffmpeg@haasn.xyz> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 2/2] avcodec/h274: trim unnecessarily large array X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 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 Cc: Niklas Haas Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: CoyspmyGao78 From: Niklas Haas We only ever read to idx+3, so 256 values are overkill. --- libavcodec/h274.c | 21 +++------------------ 1 file changed, 3 insertions(+), 18 deletions(-) diff --git a/libavcodec/h274.c b/libavcodec/h274.c index a59d09b66e..54e33030c2 100644 --- a/libavcodec/h274.c +++ b/libavcodec/h274.c @@ -30,7 +30,7 @@ #include "h274.h" -static const int8_t Gaussian_LUT[2048+256]; +static const int8_t Gaussian_LUT[2048+4]; static const uint32_t Seed_LUT[256]; static const int8_t R64T[64][64]; @@ -291,7 +291,7 @@ int ff_h274_apply_film_grain(AVFrame *out_frame, const AVFrame *in_frame, } // These tables are all taken from the SMPTE RDD 5-2006 specification -static const int8_t Gaussian_LUT[2048+256] = { +static const int8_t Gaussian_LUT[2048+4] = { -11, 12, 103, -11, 42, -35, 12, 59, 77, 98, -87, 3, 65, -78, 45, 56, -51, 21, 13, -11, -20, -19, 33, -127, 17, -6, -105, 18, 19, 71, 48, -10, -38, 42, -2, 75, -67, 52, -90, 33, -47, 21, -3, -56, 49, 1, -57, -42, -1, 120, -127, @@ -419,22 +419,7 @@ static const int8_t Gaussian_LUT[2048+256] = { 4, -66, -81, 122, -20, -34, -37, -84, 127, 68, 46, 17, 47, // Repeat the beginning of the array to allow wrapping reads - -11, 12, 103, -11, 42, -35, 12, 59, 77, 98, -87, 3, 65, -78, 45, 56, -51, 21, - 13, -11, -20, -19, 33, -127, 17, -6, -105, 18, 19, 71, 48, -10, -38, 42, - -2, 75, -67, 52, -90, 33, -47, 21, -3, -56, 49, 1, -57, -42, -1, 120, -127, - -108, -49, 9, 14, 127, 122, 109, 52, 127, 2, 7, 114, 19, 30, 12, 77, 112, - 82, -61, -127, 111, -52, -29, 2, -49, -24, 58, -29, -73, 12, 112, 67, 79, - -3, -114, -87, -6, -5, 40, 58, -81, 49, -27, -31, -34, -105, 50, 16, -24, - -35, -14, -15, -127, -55, -22, -55, -127, -112, 5, -26, -72, 127, 127, -2, - 41, 87, -65, -16, 55, 19, 91, -81, -65, -64, 35, -7, -54, 99, -7, 88, 125, - -26, 91, 0, 63, 60, -14, -23, 113, -33, 116, 14, 26, 51, -16, 107, -8, 53, - 38, -34, 17, -7, 4, -91, 6, 63, 63, -15, 39, -36, 19, 55, 17, -51, 40, 33, - -37, 126, -39, -118, 17, -30, 0, 19, 98, 60, 101, -12, -73, -17, -52, 98, - 3, 3, 60, 33, -3, -2, 10, -42, -106, -38, 14, 127, 16, -127, -31, -86, -39, - -56, 46, -41, 75, 23, -19, -22, -70, 74, -54, -2, 32, -45, 17, -92, 59, - -64, -67, 56, -102, -29, -87, -34, -92, 68, 5, -74, -61, 93, -43, 14, -26, - -38, -126, -17, 16, -127, 64, 34, 31, 93, 17, -51, -59, 71, 77, 81, 127, - 127, 61, 33, -106, -93, 0, 0, 75, + -11, 12, 103, -11, }; static const uint32_t Seed_LUT[256] = {