From: Michael Niedermayer <michael@niedermayer.cc>
To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
Subject: Re: [FFmpeg-devel] [RFC]] swscale modernization proposal
Date: Sun, 23 Jun 2024 19:27:43 +0200
Message-ID: <20240623172743.GZ4991@pb2> (raw)
In-Reply-To: <20240623002457.GB4285@haasn.xyz>
[-- Attachment #1.1: Type: text/plain, Size: 4378 bytes --]
On Sun, Jun 23, 2024 at 12:24:57AM +0200, Niklas Haas wrote:
> On Sat, 22 Jun 2024 21:52:42 +0200 Michael Niedermayer <michael@niedermayer.cc> wrote:
> > On Sat, Jun 22, 2024 at 05:10:28PM +0200, Niklas Haas wrote:
> > > On Sat, 22 Jun 2024 15:23:22 +0100 Andrew Sayers <ffmpeg-devel@pileofstuff.org> wrote:
> > > > On Sat, Jun 22, 2024 at 03:13:34PM +0200, Niklas Haas wrote:
> > > > [...]
> > > > >
> > > > > ## Comments / feedback?
> > > > >
> > > > > Does the above approach seem reasonable? How do people feel about introducing
> > > > > a new API vs. trying to hammer the existing API into the shape I want it to be?
> > > > >
> > > > > I've attached an example of what <avscale.h> could end up looking like. If
> > > > > there is broad agreement on this design, I will move on to an implementation.
> > > >
> > > > API users seem to have difficulty with this type of big change[[1],
> > > > and doing the interface before the implementation means there's less
> > > > reason for developers to switch while you're still looking for feedback.
> > > >
> > > > What's the plan to bring them along?
> > >
> > > Since SwsContext is entirely internal, we can continue providing the
> > > current API on top of whatever internal abstractions we arrive at. As
> > > a trivial example, sws_scale() can construct a temporary AVFrame based
> > > on the provided information, and simply pass that to avscale_frame(). So
> > > I don't think legacy API users are at risk, or pressure to switch,
> > > unless they want access to *new* functionality.
> > >
> > > For that, the harder step is moving from sws_scale() to
> > > sws_scale_frame(). This is something API users can *already* do. By
> > > contrast, moving from sws_scale_frame() to avscale_frame() should
> > > hopefully be simple, since it just requires making sure the AVFrame is
> > > correctly tagged. Usually, the flow is in the opposite direction - users
> > > receive a correctly tagged AVFrame and manually forward this information
> > > to the SwsContext. So, most of the time, moving to a fully AVFrame-based
> > > API will result in deleting code, rather than adding it.
> > >
> > > If we wanted to maximize the transition comfort, we should consider
> > > re-using the sws_scale_frame() entrypoint directly. The main reason I am
> > > hesitant to do this is because sws_scale_frame() is currently tied to
> > > the stateful configuration of SwsContext, and mostly ignores the AVFrame
> > > metadata. While changing that is possible, it possibly presents a bigger
> > > API break than simply introducing a new function.
> >
> > I agree we should keep using the same swscale.h header. It matches the library
> > name thats installed (thats also what the user expects and what (s)he is used to),
> > and its what users #include today.
> > Also its not a audio? scaler so the A is confusing.
> >
> > And sws_scale_frame() should be used obviously if thats as you say does
> > "maximize the transition comfort"
> >
> > Maybe simply adding an option for the library user to set the behavior
> > (favour AVFrame properties vs initial properties)
> > And then eventually deprecate and phase out the initial ones
> >
> > The big advantage here is that we capture all users, noone stays on the old
> > API. And the transition is also simpler, if its just a flag to flip for someone
> > to try the new fully stateless system.
>
> This could definitely work. We could then also eventually flip the
> condition to where the new behavior becomes the default, and you need to
> set a flag to *disable* it.
>
> And eventually deprecate sws_init_context(), sws_setCoefficients() etc.
> altogether and just have sws_alloc_context() + sws_scale_frame() be the
> preferred front-ends.
>
> I expect the actual amount of work to be similar; rather than taking
> SwsContext and pulling everything high-level out into AVScaleContext, we
> start with SwsContext and pull everything low-level out into separate
> sub-contexts (e.g. one SwsScaleContext for each individual scaling
> step).
Yes, i prefer this
thanks alot
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
"Nothing to hide" only works if the folks in power share the values of
you and everyone you know entirely and always will -- Tom Scott
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]
[-- Attachment #2: Type: text/plain, Size: 251 bytes --]
_______________________________________________
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".
next prev parent reply other threads:[~2024-06-23 17:27 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-22 13:13 Niklas Haas
2024-06-22 14:23 ` Andrew Sayers
2024-06-22 15:10 ` Niklas Haas
2024-06-22 19:52 ` Michael Niedermayer
2024-06-22 22:24 ` Niklas Haas
2024-06-23 17:27 ` Michael Niedermayer [this message]
2024-06-22 22:19 ` Vittorio Giovara
2024-06-22 22:39 ` Niklas Haas
2024-06-23 17:46 ` Michael Niedermayer
2024-06-23 19:00 ` Paul B Mahol
2024-06-23 17:57 ` James Almer
2024-06-23 18:40 ` Andrew Sayers
2024-06-24 14:33 ` Niklas Haas
2024-06-24 14:44 ` Vittorio Giovara
2024-06-25 15:31 ` Niklas Haas
2024-07-01 21:10 ` Stefano Sabatini
2024-06-29 7:41 ` Zhao Zhili
2024-06-29 10:58 ` Niklas Haas
2024-06-29 11:47 ` Niklas Haas
2024-06-29 12:35 ` Michael Niedermayer
2024-06-29 14:05 ` Niklas Haas
2024-06-29 14:11 ` James Almer
2024-06-30 6:25 ` Vittorio Giovara
2024-07-02 13:27 ` Niklas Haas
2024-07-03 13:25 ` Niklas Haas
2024-07-05 18:31 ` Niklas Haas
2024-07-05 21:34 ` Michael Niedermayer
2024-07-06 0:11 ` Hendrik Leppkes
2024-07-06 12:32 ` Niklas Haas
2024-07-06 16:42 ` Michael Niedermayer
2024-07-06 17:29 ` Hendrik Leppkes
2024-07-08 11:58 ` Ronald S. Bultje
2024-07-08 12:33 ` Andrew Sayers
2024-07-08 13:25 ` Ronald S. Bultje
2024-07-06 11:36 ` Andrew Sayers
2024-07-06 12:27 ` Niklas Haas
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240623172743.GZ4991@pb2 \
--to=michael@niedermayer.cc \
--cc=ffmpeg-devel@ffmpeg.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git