[FFmpeg-devel] [PATCH v8 07/18] swscale/ops: introduce new low level framework
Niklas Haas
ffmpeg at haasn.xyz
Mon Jul 14 10:03:28 EEST 2025
On Sun, 13 Jul 2025 20:25:18 +0200 Andreas Rheinhardt <andreas.rheinhardt at outlook.com> wrote:
> Niklas Haas:
> > From: Niklas Haas <git at haasn.dev>
> >
> > See docs/swscale-v2.txt for an in-depth introduction to the new approach.
> >
> > This commit merely introduces the ops definitions and boilerplate functions.
> > The subsequent commits will flesh out the underlying implementation.
> > ---
> > libswscale/Makefile | 1 +
> > libswscale/ops.c | 524 ++++++++++++++++++++++++++++++++++++++++++++
> > libswscale/ops.h | 243 ++++++++++++++++++++
> > 3 files changed, 768 insertions(+)
> > create mode 100644 libswscale/ops.c
> > create mode 100644 libswscale/ops.h
> >
>
> > +
> > +static const char *describe_lin_mask(uint32_t mask)
> > +{
> > + /* Try to be fairly descriptive without assuming too much */
> > + static const struct {
> > + const char *name;
>
> Please avoid the relocations.
Could you please clarify what you mean by this?
>
> > + uint32_t mask;
> > + } patterns[] = {
> > + { "noop", 0 },
> > + { "luma", SWS_MASK_LUMA },
> > + { "alpha", SWS_MASK_ALPHA },
> > + { "luma+alpha", SWS_MASK_LUMA | SWS_MASK_ALPHA },
> > + { "dot3", 0b111 },
> > + { "dot4", 0b1111 },
>
> src/libswscale/ops.c:369:33: warning: binary constants are a C23 feature
> or GCC extension
> 369 | { "dot3", 0b111 },
> | ^~~~~
> src/libswscale/ops.c:370:33: warning: binary constants are a C23 feature
> or GCC extension
> 370 | { "dot4", 0b1111 },
> | ^~~~~~
>
> (There are also a few other instances of this at other places.)
Noted, will remove.
>
> > + { "row0", SWS_MASK_ROW(0) },
> > + { "row0+alpha", SWS_MASK_ROW(0) | SWS_MASK_ALPHA },
> > + { "col0", SWS_MASK_COL(0) },
> > + { "col0+off3", SWS_MASK_COL(0) | SWS_MASK_OFF3 },
> > + { "off3", SWS_MASK_OFF3 },
> > + { "off3+alpha", SWS_MASK_OFF3 | SWS_MASK_ALPHA },
> > + { "diag3", SWS_MASK_DIAG3 },
> > + { "diag4", SWS_MASK_DIAG4 },
> > + { "diag3+alpha", SWS_MASK_DIAG3 | SWS_MASK_ALPHA },
> > + { "diag3+off3", SWS_MASK_DIAG3 | SWS_MASK_OFF3 },
> > + { "diag3+off3+alpha", SWS_MASK_DIAG3 | SWS_MASK_OFF3 | SWS_MASK_ALPHA },
> > + { "diag4+off4", SWS_MASK_DIAG4 | SWS_MASK_OFF4 },
> > + { "matrix3", SWS_MASK_MAT3 },
> > + { "matrix3+off3", SWS_MASK_MAT3 | SWS_MASK_OFF3 },
> > + { "matrix3+off3+alpha", SWS_MASK_MAT3 | SWS_MASK_OFF3 | SWS_MASK_ALPHA },
> > + { "matrix4", SWS_MASK_MAT4 },
> > + { "matrix4+off4", SWS_MASK_MAT4 | SWS_MASK_OFF4 },
> > + };
> > +
> > + for (int i = 0; i < FF_ARRAY_ELEMS(patterns); i++) {
> > + if (!(mask & ~patterns[i].mask))
> > + return patterns[i].name;
> > + }
> > +
> > + return "full";
> > +}
> > +
> > +#endif
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe".
More information about the ffmpeg-devel
mailing list