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

Michael Niedermayer michael at niedermayer.cc
Wed Nov 22 15:16:48 EET 2023


Hi

On Wed, Nov 22, 2023 at 01:45:05PM +0100, Niklas Haas wrote:
> 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

ok


> 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.

this doesnt feel right

logic should be:

1. alloc struct
2. set all details for everything
3. init
4+ use
n free


or some API with
convert between 2 frames and have a automatically cached and managed context
where all details are either in the metadata of the frames itself or given to
the function

The whole idea of adjusting some details which could affect the required
codepath without init is fishy unless everything can be adjusted that way
and its the normal way of initing things

So IMHO

first lets figure out how this should be in the long run (moving to a
clean API and clean implemenattion)

and then find out how to move towards that in small steps that achieves
teh short term goals quickly

I dont like trying to achieve the short term goal with messy code
and the long term unrelated.
Because i have to maintain this and so i will not agree to something
that moves us away from a clean long term result

That said, if you must change the API, change the API, that i do not
mind

thx

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Freedom in capitalist society always remains about the same as it was in
ancient Greek republics: Freedom for slave owners. -- Vladimir Lenin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20231122/6902070b/attachment.sig>


More information about the ffmpeg-devel mailing list