From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 8714842939 for ; Mon, 10 Jan 2022 08:19:43 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 53C4468AEA4; Mon, 10 Jan 2022 10:19:41 +0200 (EET) Received: from w4.tutanota.de (w4.tutanota.de [81.3.6.165]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 026EE68A744 for ; Mon, 10 Jan 2022 10:19:34 +0200 (EET) Received: from w3.tutanota.de (unknown [192.168.1.164]) by w4.tutanota.de (Postfix) with ESMTP id A51CD1060235 for ; Mon, 10 Jan 2022 08:19:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1641802774; s=s1; d=lynne.ee; h=From:From:To:To:Subject:Subject:Content-Description:Content-ID:Content-Type:Content-Type:Content-Transfer-Encoding:Content-Transfer-Encoding:Cc:Date:Date:In-Reply-To:In-Reply-To:MIME-Version:MIME-Version:Message-ID:Message-ID:Reply-To:References:References:Sender; bh=c/BmmuYOo8WxuwKoQL9gwEok+i8yz5csPDKu8snyZB4=; b=xK3fGtNNQdHNdx9cBYdZKUkpXNYk4H7hmvssiTDvx7u631FuWuM5I91SMDJpNONH jrRTcMM0Cmf6Wm/v+xRGxtvw/PGZ6CdPHLS0VxET3qtXLBTuXk6cdtxoYBcR2l9LtLf VHca94g06TrqyWyAAPN+5ZlJsNX6I5u2o2+QAyaNoeHF7ROC8GizS4WN461CJeD0i5+ XgRkMg39wFbkvIdbkrmLLZi1u9jVEjLnbD5bOLqNXst4dpGmgbgg35ERzjGwuABzSB6 TysazV25yKwPrPVqrIaTF+SDGbNAhUUrXwyNuymEuG0Gcgubw8NGh+sa2WMCVifyfvB kvb+KCzfMg== Date: Mon, 10 Jan 2022 09:19:34 +0100 (CET) From: Lynne To: FFmpeg development discussions and patches Message-ID: In-Reply-To: <20220110072917.2140-1-ffmpeg@haasn.xyz> References: <20220110072917.2140-1-ffmpeg@haasn.xyz> MIME-Version: 1.0 Subject: Re: [FFmpeg-devel] [PATCH] lavfi/vf_libplacebo: fix side data stripping logic 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 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: 10 Jan 2022, 08:29 by ffmpeg@haasn.xyz: > From: Niklas Haas > > This was accidentally comparing s->colorspace against out->colorspace, > which is wrong - the intent was to compare in->colorspace against > out->colorspace. > > We also forgot to strip mastering metadata. Finally, the order is sort > of wrong - we should strip this side data *before* process_frames, > because otherwise it may end up being seen and used by libplacebo. > > Signed-off-by: Niklas Haas > --- > libavfilter/vf_libplacebo.c | 21 ++++++++++++--------- > 1 file changed, 12 insertions(+), 9 deletions(-) > > diff --git a/libavfilter/vf_libplacebo.c b/libavfilter/vf_libplacebo.c > index 1386aaeb3a..31ae28ac38 100644 > --- a/libavfilter/vf_libplacebo.c > +++ b/libavfilter/vf_libplacebo.c > @@ -390,7 +390,7 @@ fail: > > static int filter_frame(AVFilterLink *link, AVFrame *in) > { > - int err, changed; > + int err, changed_csp; > AVFilterContext *ctx = link->dst; > LibplaceboContext *s = ctx->priv; > AVFilterLink *outlink = ctx->outputs[0]; > @@ -426,22 +426,25 @@ static int filter_frame(AVFilterLink *link, AVFrame *in) > if (s->color_primaries >= 0) > out->color_primaries = s->color_primaries; > > - RET(process_frames(ctx, out, in)); > - > - int changed_csp = s->colorspace != out->colorspace || > - s->color_range != out->color_range || > - s->color_trc != out->color_trc || > - s->color_primaries != out->color_primaries; > + changed_csp = in->colorspace != out->colorspace || > + in->color_range != out->color_range || > + in->color_trc != out->color_trc || > + in->color_primaries != out->color_primaries; > > + /* Strip side data if no longer relevant */ > + if (changed_csp) { > + av_frame_remove_side_data(out, AV_FRAME_DATA_MASTERING_DISPLAY_METADATA); > + av_frame_remove_side_data(out, AV_FRAME_DATA_CONTENT_LIGHT_LEVEL); > + } > if (s->apply_dovi || changed_csp) { > - /* Strip side data if no longer relevant */ > av_frame_remove_side_data(out, AV_FRAME_DATA_DOVI_RPU_BUFFER); > av_frame_remove_side_data(out, AV_FRAME_DATA_DOVI_METADATA); > } > - > if (s->apply_filmgrain) > av_frame_remove_side_data(out, AV_FRAME_DATA_FILM_GRAIN_PARAMS); > > + RET(process_frames(ctx, out, in)); > + > av_frame_free(&in); > > return ff_filter_frame(outlink, out); > Pushed to both master and release/5.0, thanks. _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".