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 376D4491EE for ; Mon, 5 Feb 2024 17:15:02 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 1B88F68D14E; Mon, 5 Feb 2024 19:15:00 +0200 (EET) Received: from haasn.dev (haasn.dev [78.46.187.166]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 53F4668C7C2 for ; Mon, 5 Feb 2024 19:14:53 +0200 (EET) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=haasn.xyz; s=mail; t=1707153293; bh=0kqCS0ZloSjz/apnD4fJ27rzUzCPoyKq6zl9OcwL690=; h=Date:From:To:Subject:In-Reply-To:References:From; b=D2vUEocWnh/DH4A/q3hm0a+MjxY4gDyexXD0Mdb8uoNXGvROxluG4EjHWgo2auXKM iCV+rAaq8Lgu8gFAR+TfFIHc/ZGSZqgm8VgpLEUOJTjPcceY17Xdj34hAPNJAMoX7p DnYRIfKjcovVL07ug4P9f//xhQCpzhOSkzucfnDY= Received: from haasn.dev (unknown [10.30.0.2]) by haasn.dev (Postfix) with ESMTP id 15852406AC for ; Mon, 5 Feb 2024 18:14:53 +0100 (CET) Date: Mon, 5 Feb 2024 18:14:52 +0100 Message-ID: <20240205181452.GB19481@haasn.xyz> From: Niklas Haas To: FFmpeg development discussions and patches In-Reply-To: <20240112211046.GB6420@pb2> References: <20240112082950.41637-1-ffmpeg@haasn.xyz> <20240112082950.41637-7-ffmpeg@haasn.xyz> <20240112211046.GB6420@pb2> MIME-Version: 1.0 Content-Disposition: inline Subject: Re: [FFmpeg-devel] [PATCH 06/11] fftools/ffmpeg_filter: simplify choose_pix_fmts 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: On Fri, 12 Jan 2024 22:10:46 +0100 Michael Niedermayer wrote: > On Fri, Jan 12, 2024 at 09:26:03AM +0100, Niklas Haas wrote: > > From: Niklas Haas > > > > The only meaningful difference between choose_pix_fmts and the default > > code was the inclusion of an extra branch for `keep_pix_fmt` being true. > > > > However, in this case, we either: > > 1. Force the specific `ofp->format` that we inherited from > > ofilter_bind_ost, or if no format was set: > > 2. Print an empty format list > > > > Both of these goals can be accomplished by simply moving the decision > > logic to ofilter_bind_ost, to avoid setting any format list when > > keep_pix_fmt is enabled. This is arguably cleaner as it moves format > > selection logic to a single function. In the case of branch 1, nothing > > else needs to be done as we already force the format provided in > > ofp->format, if any is set. Add an assertion to verify this assumption > > just in case. > > > > (Side note: The "choose_*" family of functions are arguably misnomers, > > as they should really be called "print_*" - their current behavior is to > > print the relevant format lists to the `vf/af_format` filter arguments) > > --- > > fftools/ffmpeg_filter.c | 49 ++++++++--------------------------------- > > 1 file changed, 9 insertions(+), 40 deletions(-) > > > ./ffmpeg -y -i fate-suite/lena.pnm -pix_fmt +yuv444p -vf scale -strict -1 -bitexact -threads 2 -thread_type slice file-2s-444.jpg > > Assertion !ost->keep_pix_fmt || (!ofp->format && !ofp->formats) failed at fftools/ffmpeg_filter.c:1240 > Aborted (core dumped) Wrong logic on the assertion, should be: !ost->keep_pix_fmt || ofp->format != AV_PIX_FMT_NONE || !ofp->formats The explanation here is that before this patch, keep_pix_fmt made the filter disregard `ofp->formats` and always choose what was set in `ofp->format` - even if it was NULL. This assertion guarantees that the simplified choose_pix_fmts still does the same thing, since it will hit either the ofp->format being set branch or the ofp->formats being NULL branch. Fixed locally. _______________________________________________ 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".