From patchwork Mon Mar 18 16:54:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Niklas Haas X-Patchwork-Id: 47186 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:958e:b0:1a3:31a3:7958 with SMTP id iu14csp1139967pzb; Mon, 18 Mar 2024 09:58:13 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUL/XIV7D06kcxYwAMU6HDmUp5cppH9susVTETKi4B37V786MB2kckobru3wQXQu8WEUxRWbh5M5RpbUueDjyq9aqNogarKNaO4Wg== X-Google-Smtp-Source: AGHT+IECnv00QsntLFZInnx2CPiDg9AipbyIBr+X7e5E3j16c22EmsHMXm9wdN4Qd0FF2iaXrHx1 X-Received: by 2002:a17:907:7896:b0:a46:b9eb:ae5 with SMTP id ku22-20020a170907789600b00a46b9eb0ae5mr176595ejc.24.1710781093013; Mon, 18 Mar 2024 09:58:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1710781092; cv=none; d=google.com; s=arc-20160816; b=uYpAWQi1l5EmZKwHh+7Lpcrp0xD1C7jINPQ+LSCgjIWeFNMTq6RdQaYTluQhKXGJkz 4BLk+v1Snb6+V1Mm0syhGGdLPdaIbDvMjMYZzjq9P1f0nS1wlwyPn4+STLf0Q6p3mMst weiLYKGOjiicpwpdDUxRiEDymIhO7F8ek1ca3j3+OYvf83zwQ4XmU+5tr7cE48z5BfPF BRn89oXgBFVnNm0U/qP6x0vdwmMivl6UbSvAxEvsqYmFwHaDI6FvNrBk/kfkGYvYMXpI hckdoeaw/mKv7adZdfdWKzQEYntQ/EYhWfYA60+BgWzl9zMTyzBx//2lOv5SBB8KW+Jd IF0Q== 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=z0aiWmb1mpaJ7LEkwESZBzoXNf8MVZCuYSwbeHU/vrQ=; fh=xmAeKtysnShNOmkhiJmYkS30uw4Fu2hvBJ7qlIwukxQ=; b=AYt2B3wFrx7/EYZBCFiVczQJB3ehizCy4lgScwxecpwkxWvszD0MqpRtCGMZg3Jzk+ xbgzjM9dtZYjdj9lwgTzYRD/eY3igxiOVn1jDMx2jT+8RMmxwNZ3/UUuInryFQ+VKJ2/ wjvxSZ+ayMNwgQP6HMPAjBMSuJsBFQc6Hg5ZeaV1tjyGobTEkoHzdGwANnmIPMYof0LW vBRDIO+wXm7GbBa/ZcbVfve7apnbEyDn3IhiEb+QgIuuzapGZ/FkzpF2KgzGjpmj4kGY 1t5vsOfR2NfvYJrPq+toZ+3Kr/Sd67H8HXqGOtCeYD1gY/gTJHoAqjmpkLlO9x2b5CKw Hh0g==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@haasn.xyz header.s=mail header.b="aOH/wUhp"; 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 bh20-20020a170906a0d400b00a46b6bd3c10si1615669ejb.970.2024.03.18.09.58.12; Mon, 18 Mar 2024 09:58:12 -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="aOH/wUhp"; 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 9DAAA68D37D; Mon, 18 Mar 2024 18:57:12 +0200 (EET) 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 0564368D336 for ; Mon, 18 Mar 2024 18:57:03 +0200 (EET) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=haasn.xyz; s=mail; t=1710781018; bh=KRxb7r85lmHnEi1FUaWwGWH0qDY323ZcsDYgRAitQNA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aOH/wUhpnS3FsQdOcTpNWEOWNYCkBN3Kb4is+Hpy6U5Aqzs54qjHkmRB/Jg5QWKMH NaCrVJZBc/Rf86TV7FqXc49OZKVtBRkN9CCCPrxms5Q1112pxtdERFyKZ+HvrH/1ye XKV57I8gji4cr0+p5Be0hVH/BOn1MgH3L0mBcvRc= Received: from haasn.dev (unknown [10.30.0.2]) by haasn.dev (Postfix) with ESMTP id 160FD43504; Mon, 18 Mar 2024 17:56:58 +0100 (CET) From: Niklas Haas To: ffmpeg-devel@ffmpeg.org Date: Mon, 18 Mar 2024 17:54:13 +0100 Message-ID: <20240318165651.75520-6-ffmpeg@haasn.xyz> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240318165651.75520-1-ffmpeg@haasn.xyz> References: <20240318165651.75520-1-ffmpeg@haasn.xyz> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v4 05/13] avcodec/h2645_sei: signal new AVFilmGrainParams members 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: Uh6dsmaShG8V From: Niklas Haas H.274 specifies that film grain parameters are signalled as intended for 4:4:4 frames, so we always signal this, regardless of the frame's actual subsampling. --- libavcodec/h2645_sei.c | 46 +++++++++++++++++++++++++----------------- 1 file changed, 28 insertions(+), 18 deletions(-) diff --git a/libavcodec/h2645_sei.c b/libavcodec/h2645_sei.c index e60606f43f9..73f894436fd 100644 --- a/libavcodec/h2645_sei.c +++ b/libavcodec/h2645_sei.c @@ -641,35 +641,45 @@ int ff_h2645_sei_to_frame(AVFrame *frame, H2645SEI *sei, h274 = &fgp->codec.h274; fgp->seed = seed; + fgp->width = frame->width; + fgp->height = frame->height; + + /* H.274 mandates film grain be applied to 4:4:4 frames */ + fgp->subsampling_x = fgp->subsampling_y = 0; h274->model_id = fgc->model_id; if (fgc->separate_colour_description_present_flag) { - h274->bit_depth_luma = fgc->bit_depth_luma; - h274->bit_depth_chroma = fgc->bit_depth_chroma; - h274->color_range = fgc->full_range + 1; - h274->color_primaries = fgc->color_primaries; - h274->color_trc = fgc->transfer_characteristics; - h274->color_space = fgc->matrix_coeffs; + fgp->bit_depth_luma = fgc->bit_depth_luma; + fgp->bit_depth_chroma = fgc->bit_depth_chroma; + fgp->color_range = fgc->full_range + 1; + fgp->color_primaries = fgc->color_primaries; + fgp->color_trc = fgc->transfer_characteristics; + fgp->color_space = fgc->matrix_coeffs; } else { - h274->bit_depth_luma = bit_depth_luma; - h274->bit_depth_chroma = bit_depth_chroma; + fgp->bit_depth_luma = bit_depth_luma; + fgp->bit_depth_chroma = bit_depth_chroma; if (vui->video_signal_type_present_flag) - h274->color_range = vui->video_full_range_flag + 1; - else - h274->color_range = AVCOL_RANGE_UNSPECIFIED; + fgp->color_range = vui->video_full_range_flag + 1; if (vui->colour_description_present_flag) { - h274->color_primaries = vui->colour_primaries; - h274->color_trc = vui->transfer_characteristics; - h274->color_space = vui->matrix_coeffs; - } else { - h274->color_primaries = AVCOL_PRI_UNSPECIFIED; - h274->color_trc = AVCOL_TRC_UNSPECIFIED; - h274->color_space = AVCOL_SPC_UNSPECIFIED; + fgp->color_primaries = vui->colour_primaries; + fgp->color_trc = vui->transfer_characteristics; + fgp->color_space = vui->matrix_coeffs; } } h274->blending_mode_id = fgc->blending_mode_id; h274->log2_scale_factor = fgc->log2_scale_factor; +#if FF_API_H274_FILM_GRAIN_VCS +FF_DISABLE_DEPRECATION_WARNINGS + h274->bit_depth_luma = fgp->bit_depth_luma; + h274->bit_depth_chroma = fgp->bit_depth_chroma; + h274->color_range = fgp->color_range; + h274->color_primaries = fgp->color_primaries; + h274->color_trc = fgp->color_trc; + h274->color_space = fgp->color_space; +FF_ENABLE_DEPRECATION_WARNINGS +#endif + memcpy(&h274->component_model_present, &fgc->comp_model_present_flag, sizeof(h274->component_model_present)); memcpy(&h274->num_intensity_intervals, &fgc->num_intensity_intervals,