[FFmpeg-devel] [PATCH 09/12] swscale/internal: constify SwsFunc
Sean McGovern
gseanmcg at gmail.com
Tue Oct 8 08:40:24 EEST 2024
Hi,
On Mon, Oct 7, 2024 at 8:22 PM Niklas Haas <ffmpeg at haasn.xyz> wrote:
>
> On Mon, 07 Oct 2024 16:53:41 -0400 Sean McGovern <gseanmcg at gmail.com> wrote:
> > Hi,
> >
> > On Sun, Oct 6, 2024 at 6:31 PM Michael Niedermayer
> > <michael at niedermayer.cc> wrote:
> > >
> > > On Sat, Oct 05, 2024 at 09:24:00PM +0200, Niklas Haas wrote:
> > > > From: Niklas Haas <git at haasn.dev>
> > > >
> > > > I want to move away from having random leaf processing functions mutate
> > > > plane pointers, and while we're at it, we might as well make the strides
> > > > and tables const as well.
> > > >
> > > > Sponsored-by: Sovereign Tech Fund
> > > > Signed-off-by: Niklas Haas <git at haasn.dev>
> > > > ---
> > > > libswscale/aarch64/swscale_unscaled.c | 34 ++--
> > > > libswscale/alphablend.c | 6 +-
> > > > libswscale/arm/swscale_unscaled.c | 26 +--
> > > > libswscale/bayer_template.c | 4 +-
> > > > libswscale/loongarch/yuv2rgb_lasx.c | 12 +-
> > > > libswscale/loongarch/yuv2rgb_lsx.c | 12 +-
> > > > libswscale/ppc/yuv2rgb_altivec.c | 12 +-
> > > > libswscale/rgb2rgb.c | 2 +-
> > > > libswscale/rgb2rgb.h | 4 +-
> > > > libswscale/rgb2rgb_template.c | 2 +-
> > > > libswscale/swscale_internal.h | 12 +-
> > > > libswscale/swscale_unscaled.c | 242 +++++++++++++-------------
> > > > libswscale/x86/yuv2rgb.c | 54 +++---
> > > > libswscale/yuv2rgb.c | 6 +-
> > > > 14 files changed, 220 insertions(+), 208 deletions(-)
> > >
> > > should be ok
> >
> > Sorry for not checking this earlier, but PowerPC 32- and 64-bit builds
> > with AltiVec enabled now fail with:
> >
> > src/libswscale/ppc/yuv2yuv_altivec.c: In function ‘ff_get_unscaled_swscale_ppc’:
> > src/libswscale/ppc/yuv2yuv_altivec.c:199:33: error: assignment to
> > ‘SwsFunc’ {aka ‘int (*)(SwsContext *, const unsigned char * const*,
> > const int *, int, int, unsigned char * const*, const int *)’} from
> > incompatible pointer type ‘int (*)(SwsContext *, const uint8_t **, int
> > *, int, int, uint8_t **, int *)’ {aka ‘int (*)(SwsContext *, const
> > unsigned char **, int *, int, int, unsigned char **, int *)’}
> > [-Wincompatible-pointer-types]
> > 199 | c->convert_unscaled = yv12toyuy2_unscaled_altivec;
> > | ^
> > src/libswscale/ppc/yuv2yuv_altivec.c:201:33: error: assignment to
> > ‘SwsFunc’ {aka ‘int (*)(SwsContext *, const unsigned char * const*,
> > const int *, int, int, unsigned char * const*, const int *)’} from
> > incompatible pointer type ‘int (*)(SwsContext *, const uint8_t **, int
> > *, int, int, uint8_t **, int *)’ {aka ‘int (*)(SwsContext *, const
> > unsigned char **, int *, int, int, unsigned char **, int *)’}
> > [-Wincompatible-pointer-types]
> > 201 | c->convert_unscaled = yv12touyvy_unscaled_altivec;
> > | ^
> > make: *** [src/ffbuild/common.mak:81: libswscale/ppc/yuv2yuv_altivec.o] Error 1
>
> My bad for missing this one. Is there a public way I can test build on different
> platforms before submitting series? I would have thought that posting it on the
> ML is enough to trigger FATE runs on all platforms, but I didn't get any email
> reply to the series.
>
> Anyway, this should fix it:
>
> diff --git a/libswscale/ppc/yuv2yuv_altivec.c b/libswscale/ppc/yuv2yuv_altivec.c
> index 728e4d210c..d63feb6012 100644
> --- a/libswscale/ppc/yuv2yuv_altivec.c
> +++ b/libswscale/ppc/yuv2yuv_altivec.c
> @@ -31,10 +31,10 @@
>
> #if HAVE_ALTIVEC
>
> -static int yv12toyuy2_unscaled_altivec(SwsContext *c, const uint8_t *src[],
> - int srcStride[], int srcSliceY,
> - int srcSliceH, uint8_t *dstParam[],
> - int dstStride_a[])
> +static int yv12toyuy2_unscaled_altivec(SwsContext *c, const uint8_t *const src[],
> + const int srcStride[], int srcSliceY,
> + int srcSliceH, uint8_t *const dstParam[],
> + const int dstStride_a[])
> {
> uint8_t *dst = dstParam[0] + dstStride_a[0] * srcSliceY;
> // yv12toyuy2(src[0], src[1], src[2], dst, c->srcW, srcSliceH,
> @@ -107,10 +107,10 @@ static int yv12toyuy2_unscaled_altivec(SwsContext *c, const uint8_t *src[],
> return srcSliceH;
> }
>
> -static int yv12touyvy_unscaled_altivec(SwsContext *c, const uint8_t *src[],
> - int srcStride[], int srcSliceY,
> - int srcSliceH, uint8_t *dstParam[],
> - int dstStride_a[])
> +static int yv12touyvy_unscaled_altivec(SwsContext *c, const uint8_t *const src[],
> + const int srcStride[], int srcSliceY,
> + int srcSliceH, uint8_t *const dstParam[],
> + const int dstStride_a[])
> {
> uint8_t *dst = dstParam[0] + dstStride_a[0] * srcSliceY;
> // yv12toyuy2(src[0], src[1], src[2], dst, c->srcW, srcSliceH,
>
> >
Yes that works, thanks.
-- Sean McGovern
More information about the ffmpeg-devel
mailing list