From patchwork Fri Sep 20 00:42:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: wzq via ffmpeg-devel X-Patchwork-Id: 51663 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a59:d154:0:b0:48e:c0f8:d0de with SMTP id bt20csp661015vqb; Thu, 19 Sep 2024 17:43:03 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUX1tkIr3uQiZn06VLzD5LjfLL0xLCPkqyFOoZFuCsE7O+sp25TK6CWLL/vOE8aUwX9rgkNqEPaV3VJbADhZE7q@gmail.com X-Google-Smtp-Source: AGHT+IGECaTwNNcZSWFSFeAGne+x5+e5X7Q6VkxHlq1aXA+zxRiomIEujLbuUqJ1v/a+rq0lpJhz X-Received: by 2002:a2e:bea6:0:b0:2ef:307d:1f with SMTP id 38308e7fff4ca-2f7cb31a012mr2075461fa.1.1726792982806; Thu, 19 Sep 2024 17:43:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1726792982; cv=none; d=google.com; s=arc-20240605; b=RuVyJlHfCrVMjGtTLs18E2voRM1ndqSXVkahkPxqOPM3nN6LQL0IhXOYhTR13cjk9Z OLVwEEuIjYNcPtU9QaxvyV85APkxs4EBCOG31KXiSeaS02jCWFKcQxTf5u59D27OfKJb kc4asMOCF5FFhY1eWmd06Xelpv2qL082htCVBtipaTkgJQKxVyvsZdU2nWMUYFcfMsYu zG+FEkxuU3jU76UjUAEp0qlLwqCv1XFSox/kb40Ez2Nk/CtKLXKzClLOIMnv2TCR3KG/ AlIpo2XvfyQHq+8YO6OYeYCMt3uxhyGsEalqmqjP3mO7PPhxOPqCSGNm5dm87VSMAEzz cmQg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:content-transfer-encoding:cc:reply-to:from :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:mime-version:content-id:content-language :accept-language:message-id:date:thread-index:thread-topic:to :delivered-to; bh=kKsfwT/+nb8HHSgpJzrOyvlM6Q/+r+AmfeC6UKGdvDE=; fh=95aBa8D1rLPK8RMCJmEpewcRxmtn52v1CfXNTjgpso4=; b=LixeCedlSt6gHwbWY9av2d8/+yEiSTSuA4fwAG2Tegiq9PJA1K5tFh+VM1XzdJS7XK 3aPT8cIBWOUYqJdPZ57f56vWCy6OZOvvhkPpVPiDrp5VTQY79CI21wzYcYAcZ2i9KOwj 3u9BV2WWHaAv8Xg51CI7fZi4ErN9a6/Do5lUwjI8wTSu5AKjg2/7tDdtUAnrJWGOrAhU V2fHA1nCpBiGVdinoa9SrYHXFkdYj0aKgylTl9cPgsF3pHRRJK7F+8zrnwBDD+PDaC6U 9DOpU6X7t2LgtMlMu9T12d9lzVzkatRo7zdwVFJS4eIwZKmJV9GJYpdgMamIusZQEkJz 5INQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; 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 38308e7fff4ca-2f79d47b653si39057301fa.507.2024.09.19.17.43.02; Thu, 19 Sep 2024 17:43:02 -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; 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 B199568DCF3; Fri, 20 Sep 2024 03:42:58 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from smtp-fw-80007.amazon.com (smtp-fw-80007.amazon.com [99.78.197.218]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 3251268D7A6 for ; Fri, 20 Sep 2024 03:42:50 +0300 (EEST) X-IronPort-AV: E=Sophos;i="6.10,243,1719878400"; d="scan'208";a="332968788" Received: from pdx4-co-svc-p1-lb2-vlan2.amazon.com (HELO smtpout.prod.us-west-2.prod.farcaster.email.amazon.dev) ([10.25.36.210]) by smtp-border-fw-80007.pdx80.corp.amazon.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Sep 2024 00:42:48 +0000 Received: from EX19MTAUWB001.ant.amazon.com [10.0.21.151:31544] by smtpin.naws.us-west-2.prod.farcaster.email.amazon.dev [10.0.11.172:2525] with esmtp (Farcaster) id 0ddc4944-cb17-43f9-a358-2ba63d367988; Fri, 20 Sep 2024 00:42:47 +0000 (UTC) X-Farcaster-Flow-ID: 0ddc4944-cb17-43f9-a358-2ba63d367988 Received: from EX19D022UWC001.ant.amazon.com (10.13.139.251) by EX19MTAUWB001.ant.amazon.com (10.250.64.248) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA) id 15.2.1258.34; Fri, 20 Sep 2024 00:42:47 +0000 Received: from EX19D022UWC002.ant.amazon.com (10.13.139.216) by EX19D022UWC001.ant.amazon.com (10.13.139.251) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA) id 15.2.1258.34; Fri, 20 Sep 2024 00:42:47 +0000 Received: from EX19D022UWC002.ant.amazon.com ([fe80::e13f:1459:3a4b:7b06]) by EX19D022UWC002.ant.amazon.com ([fe80::e13f:1459:3a4b:7b06%5]) with mapi id 15.02.1258.034; Fri, 20 Sep 2024 00:42:47 +0000 To: FFmpeg development discussions and patches Thread-Topic: [PATCH 1/3] - libavcodec/aom_film_grain: Handle byte alignment when multiple film grain parameters sets are present in the bitstream Thread-Index: AQHbCvYDiEJ+6yTZnUutgd+1eFx+uQ== Date: Fri, 20 Sep 2024 00:42:47 +0000 Message-ID: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.13.138.196] Content-ID: <5F74AB2FCFEFF9478FD0E9BC015973ED@amazon.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 1/3] - libavcodec/aom_film_grain: Handle byte alignment when multiple film grain parameters sets are present in the bitstream 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: , X-Patchwork-Original-From: "Segall, Andrew via ffmpeg-devel" From: wzq via ffmpeg-devel Reply-To: FFmpeg development discussions and patches Cc: "Segall, Andrew" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: PHeueBlZOfQx More info: Series of patches to align the implementation of aom_film_grain.c with the AOM specification. First time committing. Suggestions very welcome. Signed-off-by: Andrew Segall > --- libavcodec/aom_film_grain.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) apply_units_log2 = get_bits(gb, 4); fgp->width = get_bits(gb, 12) << apply_units_log2; diff --git a/libavcodec/aom_film_grain.c b/libavcodec/aom_film_grain.c index e302567ba5..fdfa3dbf77 100644 --- a/libavcodec/aom_film_grain.c +++ b/libavcodec/aom_film_grain.c @@ -151,12 +151,24 @@ int ff_aom_parse_film_grain_sets(AVFilmGrainAFGS1Params *s, fgp->type = get_bits1(gb) ? AV_FILM_GRAIN_PARAMS_AV1 : AV_FILM_GRAIN_PARAMS_NONE; if (!fgp->type) + { + payload_bits = get_bits_count(gb) - start_position; + if (payload_bits > payload_size * 8) + goto error; + skip_bits(gb, payload_size * 8 - payload_bits); continue; + } fgp->seed = get_bits(gb, 16); update_grain = get_bits1(gb); if (!update_grain) + { + payload_bits = get_bits_count(gb) - start_position; + if (payload_bits > payload_size * 8) + goto error; + skip_bits(gb, payload_size * 8 - payload_bits); continue; + } From patchwork Fri Sep 20 00:44:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: wzq via ffmpeg-devel X-Patchwork-Id: 51665 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a59:d154:0:b0:48e:c0f8:d0de with SMTP id bt20csp661418vqb; Thu, 19 Sep 2024 17:44:23 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXoPmY/9Ql3WtIcOCMvz6QWF1iDBZoeJo66JwewicT/1vCo14/K3QJUs4iNxaDkJJeaNyw825kF7lW5VkoFEWVK@gmail.com X-Google-Smtp-Source: AGHT+IFRHuFdi9yAYpaPd/CgN9ahbUykjHbS282NiliyrF45BFhRxdz/Ie/q6uEkOWqJZm/PCLXQ X-Received: by 2002:a2e:70a:0:b0:2f7:6869:3b55 with SMTP id 38308e7fff4ca-2f7cb31c9e4mr7926151fa.21.1726793063253; Thu, 19 Sep 2024 17:44:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1726793063; cv=none; d=google.com; s=arc-20240605; b=IDnJveMoujbi0pFotAr66io7k80yZisol9jDuCdgZyP89SucP3K0aySJSHeUkbOVjR ceEfz0tLzTNXi7wlSvEcWmbV0hNr0JAcG8bC+bMWl0Ugu7xyJPi9TN+zNkgK/gxpwx/5 HgL7VIQreGKocXXfdtppzx/W7evwOwjou+h0Q9Aj/SbWlegKLq3LupoIq+EEF53vDpYH 3ESjG3t83S5hzA7SiYYIsjZXP5JEuXdFo+/V5MltIk4oHrlpxvYaDg2GmIK8EP14ncP+ sxRIHUEE901Y8xafIophe2WTco5TnDGUmu7KQZsLegtih//zGI4kl9SFkA1FRYiWMdBT kdOQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:content-transfer-encoding:cc:reply-to:from :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:mime-version:content-id:content-language :accept-language:message-id:date:thread-index:thread-topic:to :delivered-to; bh=Z8BY2E70/DIM9m2Rxdsax8V6zfWvX2ERw/4LVe/NAqA=; fh=95aBa8D1rLPK8RMCJmEpewcRxmtn52v1CfXNTjgpso4=; b=doPNQnypZnN4XbG/VJBjAhWr+1cxt0hgJvf2GsCwvmgFVLJBeEgMLsMlWqWEUWiJw7 8EbEdzRp/xuUyjS6hZBNA6kZT2gU3DmIPbOdMFCoiTRgkv8bf0/1olf/1xaFQPgz0qJT zt7p70pvxNv51g2495ADpGS+p0hDceqdfHSEBx4rnczHMel6T62OKzPWWNKS1VdkK9ey OY4ILF3WtPZw7M8uQJr4AKFSmbmLJ3aZGvR9Udg/4kR+Kmjir8qi1ftxu3jp8rUYq7Rg /xpnSu+xq9EiRnWqVecsFHR8tzLFxpjiaA24MVyAGe6PW8iqBbJap5SHVlSpxeL71JuU H6oQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; 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 38308e7fff4ca-2f79d47bffdsi40034981fa.563.2024.09.19.17.44.22; Thu, 19 Sep 2024 17:44:23 -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; 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 0BEC668DC68; Fri, 20 Sep 2024 03:44:20 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from smtp-fw-33001.amazon.com (smtp-fw-33001.amazon.com [207.171.190.10]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id F0AD168D905 for ; Fri, 20 Sep 2024 03:44:12 +0300 (EEST) X-IronPort-AV: E=Sophos;i="6.10,243,1719878400"; d="scan'208";a="369236921" Received: from iad12-co-svc-p1-lb1-vlan3.amazon.com (HELO smtpout.prod.us-west-2.prod.farcaster.email.amazon.dev) ([10.43.8.6]) by smtp-border-fw-33001.sea14.amazon.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Sep 2024 00:44:11 +0000 Received: from EX19MTAUWA002.ant.amazon.com [10.0.21.151:50763] by smtpin.naws.us-west-2.prod.farcaster.email.amazon.dev [10.0.39.219:2525] with esmtp (Farcaster) id ec81ca06-7de1-439b-b48f-ba1e06a1ff2f; Fri, 20 Sep 2024 00:44:08 +0000 (UTC) X-Farcaster-Flow-ID: ec81ca06-7de1-439b-b48f-ba1e06a1ff2f Received: from EX19D022UWC004.ant.amazon.com (10.13.139.244) by EX19MTAUWA002.ant.amazon.com (10.250.64.202) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA) id 15.2.1258.34; Fri, 20 Sep 2024 00:44:04 +0000 Received: from EX19D022UWC002.ant.amazon.com (10.13.139.216) by EX19D022UWC004.ant.amazon.com (10.13.139.244) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA) id 15.2.1258.34; Fri, 20 Sep 2024 00:44:04 +0000 Received: from EX19D022UWC002.ant.amazon.com ([fe80::e13f:1459:3a4b:7b06]) by EX19D022UWC002.ant.amazon.com ([fe80::e13f:1459:3a4b:7b06%5]) with mapi id 15.02.1258.034; Fri, 20 Sep 2024 00:44:04 +0000 To: FFmpeg development discussions and patches Thread-Topic: [PATCH 2/3] - libavcodec/aom_film_grain: Add apply_grain flag Thread-Index: AQHbCvYxuXE2oF2BOUaJdaIuMnhGvA== Date: Fri, 20 Sep 2024 00:44:03 +0000 Message-ID: <5674DDE0-D4B3-4F88-B889-28A02ED9FCA4@amazon.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.13.138.181] Content-ID: <463B4510F4CFC14481FB60AF5C50ECCF@amazon.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 2/3] - libavcodec/aom_film_grain: Add apply_grain flag 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: , X-Patchwork-Original-From: "Segall, Andrew via ffmpeg-devel" From: wzq via ffmpeg-devel Reply-To: FFmpeg development discussions and patches Cc: "Segall, Andrew" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: AG/2FZAC5A6n Details: Add support for the apply_grain_flag. This allows the film grain process to be enabled/disabled for different display properties. On 9/8/24, 12:06 AM, "Andrew Segall" > wrote: Signed-off-by: Andrew Segall > --- libavcodec/aom_film_grain.c | 6 ++++-- libavcodec/hevc/hevcdec.c | 5 ++++- libavfilter/vf_showinfo.c | 1 + libavutil/film_grain_params.h | 5 +++++ 4 files changed, 14 insertions(+), 3 deletions(-) * -- 2.46.0 diff --git a/libavcodec/aom_film_grain.c b/libavcodec/aom_film_grain.c index fdfa3dbf77..251a2793ac 100644 --- a/libavcodec/aom_film_grain.c +++ b/libavcodec/aom_film_grain.c @@ -149,8 +149,10 @@ int ff_aom_parse_film_grain_sets(AVFilmGrainAFGS1Params *s, fgp = &s->sets[set_idx]; aom = &fgp->codec.aom; - fgp->type = get_bits1(gb) ? AV_FILM_GRAIN_PARAMS_AV1 : AV_FILM_GRAIN_PARAMS_NONE; - if (!fgp->type) + fgp->type = AV_FILM_GRAIN_PARAMS_AV1; + + fgp->apply_grain = get_bits1(gb); + if ( !fgp->apply_grain) { payload_bits = get_bits_count(gb) - start_position; if (payload_bits > payload_size * 8) diff --git a/libavcodec/hevc/hevcdec.c b/libavcodec/hevc/hevcdec.c index d915d74d22..8dd4fb10c5 100644 --- a/libavcodec/hevc/hevcdec.c +++ b/libavcodec/hevc/hevcdec.c @@ -3155,7 +3155,10 @@ static int hevc_frame_end(HEVCContext *s) &s->h274db, fgp); break; case AV_FILM_GRAIN_PARAMS_AV1: - ret = ff_aom_apply_film_grain(out->frame_grain, out->f, fgp); + if(fgp->apply_grain) + ret = ff_aom_apply_film_grain(out->frame_grain, out->f, fgp); + else + out->needs_fg = 0; break; } av_assert1(ret >= 0); diff --git a/libavfilter/vf_showinfo.c b/libavfilter/vf_showinfo.c index f81df9d1bf..08e144ca46 100644 --- a/libavfilter/vf_showinfo.c +++ b/libavfilter/vf_showinfo.c @@ -455,6 +455,7 @@ static void dump_sei_film_grain_params_metadata(AVFilterContext *ctx, const AVFr } av_log(ctx, AV_LOG_INFO, "type %s; ", film_grain_type_names[fgp->type]); + av_log(ctx, AV_LOG_INFO, "apply_grain=%d; ", fgp->apply_grain); av_log(ctx, AV_LOG_INFO, "seed=%"PRIu64"; ", fgp->seed); av_log(ctx, AV_LOG_INFO, "width=%d; ", fgp->width); av_log(ctx, AV_LOG_INFO, "height=%d; ", fgp->height); diff --git a/libavutil/film_grain_params.h b/libavutil/film_grain_params.h index ccacab88fe..f3275923e1 100644 --- a/libavutil/film_grain_params.h +++ b/libavutil/film_grain_params.h @@ -241,6 +241,11 @@ typedef struct AVFilmGrainParams { */ enum AVFilmGrainParamsType type; + /** + * Specifies if film grain parameters are enabled. + */ + int apply_grain; + /** * Seed to use for the synthesis process, if the codec allows for it. From patchwork Fri Sep 20 00:45:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: wzq via ffmpeg-devel X-Patchwork-Id: 51664 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a59:d154:0:b0:48e:c0f8:d0de with SMTP id bt20csp661846vqb; Thu, 19 Sep 2024 17:45:44 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWMO5oqjGn9e8r7ful7fNGaFlR7GhabVHvRcC+Y80FpfPxsbifRX28eGgb3oBcQXhMv+N9oqeBFTSJ/PviEHjwb@gmail.com X-Google-Smtp-Source: AGHT+IFaMbA+7ThdwU56zJ7tFnGrvuDZHXqge2rDcabYO7+ZWNt83NankVjNOyVNe7QOSwDG1qy3 X-Received: by 2002:a05:6512:10d5:b0:536:53f0:2f8e with SMTP id 2adb3069b0e04-536ac31efe7mr602873e87.37.1726793144089; Thu, 19 Sep 2024 17:45:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1726793144; cv=none; d=google.com; s=arc-20240605; b=HWLgUVtBPKLBZR29FSWEtHXF/5jKQysc9GJfjkSp7NRuysSgBSNOqve0GvwLBHdxYJ vEm/mR4D8EMIRJcniz/WQiYJQa4S++2GHphsM0nXH4OL8emMiX/qL33LZ2MuFmpDWghv JV/iSbQlJB36U6iihlzAEftbmlCMt5sPJCMh7GL4R00QIRTWj1f11JWPVgKxFUs5jXXM 650PAYUI9Ww+yvdOGsBeCteSXF8lFM39pzZvby+TJZF+zCIDWKqDYjLxHYu36wk+rs8o Mzco2OOB957VrqzUH6qwUZypyLrZpBe4F58/ymglD6pwqmQGvvup+CkG+6nY6OaPu7v5 fP2w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:content-transfer-encoding:cc:reply-to:from :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:mime-version:content-id:content-language :accept-language:message-id:date:thread-index:thread-topic:to :delivered-to; bh=178nwh09D/Xo7Jh2W9uNkrp08tYNY7c6KkHqzwNwjn8=; fh=95aBa8D1rLPK8RMCJmEpewcRxmtn52v1CfXNTjgpso4=; b=S1HLcC51+Z1ljX5GKrj/ANFxhAlRq8jhg/Caje+rh+7p5CUBImfsZJpPf8APs9M4/A eKFgXwIdtxsr8jyjCidy/sd6w3SjsvJohAGjAIa4d8YLOQksqvVt5gdndB5YU02nbVxv xx58WpvlVIwDCcm5ciOdpg5ivvbj08W8D56oanrD0NaBP5XEjekODW5Pth+yFN2TQKA0 RyTDQ28ybHszfg8I6knf03O2d2JqMtVG3IwReWeSX/AVswtIukapUoQj5VyGV8Za7uzr AuTAJ8gUNUxF2kzxZsaqrElDoST9nz//0vpKA7/9rQxp39FaDgjiY2TAciDjzcQkNL98 x0Fg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; 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 a640c23a62f3a-a906133adf3si846212466b.883.2024.09.19.17.45.43; Thu, 19 Sep 2024 17:45:44 -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; 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 7F42568DD3A; Fri, 20 Sep 2024 03:45:41 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from smtp-fw-80007.amazon.com (smtp-fw-80007.amazon.com [99.78.197.218]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 3259068DBF5 for ; Fri, 20 Sep 2024 03:45:34 +0300 (EEST) X-IronPort-AV: E=Sophos;i="6.10,243,1719878400"; d="scan'208";a="332969248" Received: from pdx4-co-svc-p1-lb2-vlan2.amazon.com (HELO smtpout.prod.us-west-2.prod.farcaster.email.amazon.dev) ([10.25.36.210]) by smtp-border-fw-80007.pdx80.corp.amazon.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Sep 2024 00:45:32 +0000 Received: from EX19MTAUWA001.ant.amazon.com [10.0.38.20:49132] by smtpin.naws.us-west-2.prod.farcaster.email.amazon.dev [10.0.31.232:2525] with esmtp (Farcaster) id a1594fd4-7225-47d8-8e5c-4f42f5c13b4d; Fri, 20 Sep 2024 00:45:31 +0000 (UTC) X-Farcaster-Flow-ID: a1594fd4-7225-47d8-8e5c-4f42f5c13b4d Received: from EX19D022UWC001.ant.amazon.com (10.13.139.251) by EX19MTAUWA001.ant.amazon.com (10.250.64.204) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA) id 15.2.1258.34; Fri, 20 Sep 2024 00:45:31 +0000 Received: from EX19D022UWC002.ant.amazon.com (10.13.139.216) by EX19D022UWC001.ant.amazon.com (10.13.139.251) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA) id 15.2.1258.34; Fri, 20 Sep 2024 00:45:31 +0000 Received: from EX19D022UWC002.ant.amazon.com ([fe80::e13f:1459:3a4b:7b06]) by EX19D022UWC002.ant.amazon.com ([fe80::e13f:1459:3a4b:7b06%5]) with mapi id 15.02.1258.034; Fri, 20 Sep 2024 00:45:31 +0000 To: FFmpeg development discussions and patches Thread-Topic: [PATCH 3/3] - libavcodec/aom_film_grain: Mark AFGS1 parameters in the current message as eligible for selection Thread-Index: AQHbCvZlRYs9SzBPKEyPQBysQ0otfw== Date: Fri, 20 Sep 2024 00:45:31 +0000 Message-ID: <9EA48E88-54C5-45DD-81BE-EC486940112D@amazon.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.13.138.67] Content-ID: MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 3/3] - libavcodec/aom_film_grain: Mark AFGS1 parameters in the current message as eligible for selection 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: , X-Patchwork-Original-From: "Segall, Andrew via ffmpeg-devel" From: wzq via ffmpeg-devel Reply-To: FFmpeg development discussions and patches Cc: "Segall, Andrew" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: mg0aCRSsDDMs Details: Limit selection of the film grain parameters to (only) those received in the current message. Signed-off-by: Andrew Segall > --- libavcodec/aom_film_grain.c | 7 +++++++ libavutil/film_grain_params.h | 5 +++++ 2 files changed, 12 insertions(+) */ diff --git a/libavcodec/aom_film_grain.c b/libavcodec/aom_film_grain.c index 251a2793ac..1096069922 100644 --- a/libavcodec/aom_film_grain.c +++ b/libavcodec/aom_film_grain.c @@ -127,6 +127,12 @@ int ff_aom_parse_film_grain_sets(AVFilmGrainAFGS1Params *s, AVFilmGrainParams *fgp, *ref = NULL; int ret, num_sets, n, i, uv, num_y_coeffs, update_grain, luma_only; + // Mark existing film grain parameters as ineligible for use in the current frame + for(n =0; n < 8; n++) { + if( s->sets[n].type == AV_FILM_GRAIN_PARAMS_AV1 ) + s->sets[n].type = AV_FILM_GRAIN_PARAMS_AV1_INACTIVE; + } + ret = init_get_bits8(gb, payload, payload_size); if (ret < 0) return ret; @@ -149,6 +155,7 @@ int ff_aom_parse_film_grain_sets(AVFilmGrainAFGS1Params *s, fgp = &s->sets[set_idx]; aom = &fgp->codec.aom; + // Mark current film grain parameters as eligible for selection in the current frame fgp->type = AV_FILM_GRAIN_PARAMS_AV1; fgp->apply_grain = get_bits1(gb); diff --git a/libavutil/film_grain_params.h b/libavutil/film_grain_params.h index f3275923e1..1b507829fe 100644 --- a/libavutil/film_grain_params.h +++ b/libavutil/film_grain_params.h @@ -29,6 +29,11 @@ enum AVFilmGrainParamsType { */ AV_FILM_GRAIN_PARAMS_AV1, + /** + * + */ + AV_FILM_GRAIN_PARAMS_AV1_INACTIVE, + /** * The union is valid when interpreted as AVFilmGrainH274Params (codec.h274)