[FFmpeg-devel] [PATCH 2/3] swscale/utils: correctly return from sws_init_single_context

Niklas Haas ffmpeg at haasn.xyz
Wed Nov 22 14:45:05 EET 2023


On Tue, 14 Nov 2023 23:52:50 +0100 Michael Niedermayer <michael at niedermayer.cc> wrote:
> would this result in overall cleaner code or do you see some problems
> with this ?
> 
> Given the messi-ness that the always setting results in i would maybe
> suggest to explore this and see if this is cleaner.
> 
> Its conceptually not wrong that if parameters change that init should
> be redone.

I gave this a try, but doing it internally is very tricky for a number
of reasons and does not present obvious advantages over requiring the
user to free+reinit if they wish to change range. So, the best long-term
solution here would be to simply remove srcRange/dstRange from the
signature of sws_setColorspaceDetails.

vf_scale is the only current user of this API inside ffmpeg itself, and
after the YUVJ removal series this call is no longer needed at all. (All
range setup happens at filter init time with filter range negotiation)

I think merging this series as-is represents the best short-term fix to
the existing fundamental issues with this design. But if you want to
rewrite all of swscale init code to allow graceful re-init on range
change, be my guest.


More information about the ffmpeg-devel mailing list