[FFmpeg-devel] [PATCH 02/19] swscale: rename SwsContext to SwsInternal
Michael Niedermayer
michael at niedermayer.cc
Mon Oct 14 16:09:07 EEST 2024
On Sun, Oct 13, 2024 at 09:15:38PM +0200, Niklas Haas wrote:
> On Sun, 13 Oct 2024 19:31:05 +0200 Michael Niedermayer <michael at niedermayer.cc> wrote:
> > On Fri, Oct 11, 2024 at 12:26:49AM +0200, Niklas Haas wrote:
> > > From: Niklas Haas <git at haasn.dev>
> > >
> > > And preserve the public SwsContext as separate name. The motivation here
> > > is that I want to turn SwsContext into a public struct, while keeping the
> > > internal implementation hidden. Additionally, I also want to be able to
> > > use multiple internal implementations, e.g. for GPU devices.
> > >
> > > This commit does not include any functional changes. For the most part, it is
> > > a simple rename. The only complications arise from the public facing API
> > > functions, which preserve their current type (and hence require an additional
> > > unwrapping step internally), and the checkasm test framework, which directly
> > > accesses SwsInternal.
> > >
> > > For consistency, the affected functions that need to maintain a distionction
> > > have generally been changed to refer to the SwsContext as *sws, and the
> > > SwsInternal as *c.
> > >
> > > In an upcoming commit, I will provide a backing definition for the public
> > > SwsContext, and update `sws_internal()` to dereference the internal struct
> > > instead of merely casting it.
> > >
> > > Sponsored-by: Sovereign Tech Fund
> > > Signed-off-by: Niklas Haas <git at haasn.dev>
> >
> > breaks build on mingw64
> >
> > CC libswscale/x86/w64xmmtest.o
> > In file included from src/libswscale/x86/w64xmmtest.c:22:
> > src/libswscale/x86/w64xmmtest.c:25:23: warning: ‘struct SwsInternal’ declared inside parameter list will not be visible outside of this definition or declaration
> > 25 | wrap(sws_scale(struct SwsInternal *c, const uint8_t *const srcSlice[],
> > | ^~~~~~~~~~~
> > src/libavutil/x86/w64xmmtest.h:74:16: note: in definition of macro ‘wrap’
> > 74 | int __real_ ## func; \
> > | ^~~~
> > src/libswscale/x86/w64xmmtest.c:25:23: warning: ‘struct SwsInternal’ declared inside parameter list will not be visible outside of this definition or declaration
> > 25 | wrap(sws_scale(struct SwsInternal *c, const uint8_t *const srcSlice[],
> > | ^~~~~~~~~~~
> > src/libavutil/x86/w64xmmtest.h:75:16: note: in definition of macro ‘wrap’
> > 75 | int __wrap_ ## func; \
> > | ^~~~
> > src/libswscale/x86/w64xmmtest.c:25:23: warning: ‘struct SwsInternal’ declared inside parameter list will not be visible outside of this definition or declaration
> > 25 | wrap(sws_scale(struct SwsInternal *c, const uint8_t *const srcSlice[],
> > | ^~~~~~~~~~~
> > src/libavutil/x86/w64xmmtest.h:76:16: note: in definition of macro ‘wrap’
> > 76 | int __wrap_ ## func
> > | ^~~~
> > src/libavutil/x86/w64xmmtest.h:76:5: error: conflicting types for ‘__wrap_sws_scale’
> > 76 | int __wrap_ ## func
> > | ^~~~~~~
> > src/libswscale/x86/w64xmmtest.c:25:1: note: in expansion of macro ‘wrap’
> > 25 | wrap(sws_scale(struct SwsInternal *c, const uint8_t *const srcSlice[],
> > | ^~~~
> > src/libavutil/x86/w64xmmtest.h:75:5: note: previous declaration of ‘__wrap_sws_scale’ was here
> > 75 | int __wrap_ ## func; \
> > | ^~~~~~~
> > src/libswscale/x86/w64xmmtest.c:25:1: note: in expansion of macro ‘wrap’
> > 25 | wrap(sws_scale(struct SwsInternal *c, const uint8_t *const srcSlice[],
> > | ^~~~
> > src/libswscale/x86/w64xmmtest.c: In function ‘__wrap_sws_scale’:
> > src/libswscale/x86/w64xmmtest.c:29:32: warning: passing argument 1 of ‘__real_sws_scale’ from incompatible pointer type [-Wincompatible-pointer-types]
> > 29 | testxmmclobbers(sws_scale, c, srcSlice, srcStride, srcSliceY,
> > | ^
> > | |
> > | struct SwsInternal *
> > src/libavutil/x86/w64xmmtest.h:51:27: note: in definition of macro ‘testxmmclobbers’
> > 51 | ret = __real_ ## func(ctx, __VA_ARGS__); \
> > | ^~~
> > src/libswscale/x86/w64xmmtest.c:25:36: note: expected ‘struct SwsInternal *’ but argument is of type ‘struct SwsInternal *’
> > 25 | wrap(sws_scale(struct SwsInternal *c, const uint8_t *const srcSlice[],
> > | ~~~~~~~~~~~~~~~~~~~~^
> > src/libavutil/x86/w64xmmtest.h:74:16: note: in definition of macro ‘wrap’
> > 74 | int __real_ ## func; \
> > | ^~~~
> > make: *** [ffbuild/common.mak:81: libswscale/x86/w64xmmtest.o] Error 1
> > make: Target 'all' not remade because of errors.
> >
> > thx
>
> Fixed by
>
> diff --git a/libswscale/x86/w64xmmtest.c b/libswscale/x86/w64xmmtest.c
> index 33af90fd41..d405a0eab4 100644
> --- a/libswscale/x86/w64xmmtest.c
> +++ b/libswscale/x86/w64xmmtest.c
> @@ -22,7 +22,7 @@
> #include "libavutil/x86/w64xmmtest.h"
> #include "libswscale/swscale.h"
>
> -wrap(sws_scale(struct SwsInternal *c, const uint8_t *const srcSlice[],
> +wrap(sws_scale(SwsContext *c, const uint8_t *const srcSlice[],
> const int srcStride[], int srcSliceY, int srcSliceH,
> uint8_t *const dst[], const int dstStride[]))
> {
teh original patch #2 no longer applies
CONFLICT (content): Merge conflict in libswscale/output.c
do you have some up to date branch that can be used for testing ?
thx
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
Those who are best at talking, realize last or never when they are wrong.
-------------- 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/20241014/73b0f3d4/attachment.sig>
More information about the ffmpeg-devel
mailing list