From 862338fe3154e09ff0c410fd410d519588d47cf2 Mon Sep 17 00:00:00 2001 From: Andreas Rheinhardt Date: Sun, 1 Mar 2026 21:50:17 +0100 Subject: [PATCH] swscale/rgb2rgb: Remove set-but-unused functions yuy2toyv12, vu9_to_vu12 and yvu9_to_yuy2 are unused. Removing them saved 7808B of .text and 102B of .text.unlikely as well as 24B of .bss here. Thanks to James Almer for pointing out that yuy2toyv12 is unused. Signed-off-by: Andreas Rheinhardt --- libswscale/rgb2rgb.c | 14 -- libswscale/rgb2rgb.h | 20 --- libswscale/rgb2rgb_template.c | 90 ----------- libswscale/x86/rgb2rgb.c | 280 ---------------------------------- 4 files changed, 404 deletions(-) diff --git a/libswscale/rgb2rgb.c b/libswscale/rgb2rgb.c index 00e785f0c8..4bba657bd1 100644 --- a/libswscale/rgb2rgb.c +++ b/libswscale/rgb2rgb.c @@ -78,10 +78,6 @@ void (*yuv422ptouyvy)(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst, int width, int height, int lumStride, int chromStride, int dstStride); -void (*yuy2toyv12)(const uint8_t *src, uint8_t *ydst, - uint8_t *udst, uint8_t *vdst, - int width, int height, - int lumStride, int chromStride, int srcStride); void (*ff_rgb24toyv12)(const uint8_t *src, uint8_t *ydst, uint8_t *udst, uint8_t *vdst, int width, int height, @@ -95,16 +91,6 @@ void (*interleaveBytes)(const uint8_t *src1, const uint8_t *src2, uint8_t *dst, void (*deinterleaveBytes)(const uint8_t *src, uint8_t *dst1, uint8_t *dst2, int width, int height, int srcStride, int dst1Stride, int dst2Stride); -void (*vu9_to_vu12)(const uint8_t *src1, const uint8_t *src2, - uint8_t *dst1, uint8_t *dst2, - int width, int height, - int srcStride1, int srcStride2, - int dstStride1, int dstStride2); -void (*yvu9_to_yuy2)(const uint8_t *src1, const uint8_t *src2, - const uint8_t *src3, uint8_t *dst, - int width, int height, - int srcStride1, int srcStride2, - int srcStride3, int dstStride); void (*uyvytoyuv420)(uint8_t *ydst, uint8_t *udst, uint8_t *vdst, const uint8_t *src, int width, int height, int lumStride, int chromStride, int srcStride); diff --git a/libswscale/rgb2rgb.h b/libswscale/rgb2rgb.h index 0d0f7c3a28..ed6e08a565 100644 --- a/libswscale/rgb2rgb.h +++ b/libswscale/rgb2rgb.h @@ -108,14 +108,6 @@ extern void (*yuv422ptoyuy2)(const uint8_t *ysrc, const uint8_t *usrc, const uin int width, int height, int lumStride, int chromStride, int dstStride); -/** - * Height should be a multiple of 2 and width should be a multiple of 16. - * (If this is a problem for anyone then tell me, and I will fix it.) - */ -extern void (*yuy2toyv12)(const uint8_t *src, uint8_t *ydst, uint8_t *udst, uint8_t *vdst, - int width, int height, - int lumStride, int chromStride, int srcStride); - /** * Height should be a multiple of 2 and width should be a multiple of 16. * (If this is a problem for anyone then tell me, and I will fix it.) @@ -150,18 +142,6 @@ extern void (*deinterleaveBytes)(const uint8_t *src, uint8_t *dst1, uint8_t *dst int width, int height, int srcStride, int dst1Stride, int dst2Stride); -extern void (*vu9_to_vu12)(const uint8_t *src1, const uint8_t *src2, - uint8_t *dst1, uint8_t *dst2, - int width, int height, - int srcStride1, int srcStride2, - int dstStride1, int dstStride2); - -extern void (*yvu9_to_yuy2)(const uint8_t *src1, const uint8_t *src2, const uint8_t *src3, - uint8_t *dst, - int width, int height, - int srcStride1, int srcStride2, - int srcStride3, int dstStride); - extern void (*uyvytoyuv420)(uint8_t *ydst, uint8_t *udst, uint8_t *vdst, const uint8_t *src, int width, int height, int lumStride, int chromStride, int srcStride); diff --git a/libswscale/rgb2rgb_template.c b/libswscale/rgb2rgb_template.c index f71be33ac4..48959b6b5f 100644 --- a/libswscale/rgb2rgb_template.c +++ b/libswscale/rgb2rgb_template.c @@ -528,40 +528,6 @@ static inline void yuv422ptoyuy2_c(const uint8_t *ysrc, const uint8_t *usrc, chromStride, dstStride, 1); } -/** - * Height should be a multiple of 2 and width should be a multiple of 16. - * (If this is a problem for anyone then tell me, and I will fix it.) - */ -static inline void yuy2toyv12_c(const uint8_t *src, uint8_t *ydst, - uint8_t *udst, uint8_t *vdst, - int width, int height, int lumStride, - int chromStride, int srcStride) -{ - int y; - const int chromWidth = width >> 1; - - for (y = 0; y < height; y += 2) { - int i; - for (i = 0; i < chromWidth; i++) { - ydst[2 * i + 0] = src[4 * i + 0]; - udst[i] = src[4 * i + 1]; - ydst[2 * i + 1] = src[4 * i + 2]; - vdst[i] = src[4 * i + 3]; - } - ydst += lumStride; - src += srcStride; - - for (i = 0; i < chromWidth; i++) { - ydst[2 * i + 0] = src[4 * i + 0]; - ydst[2 * i + 1] = src[4 * i + 2]; - } - udst += chromStride; - vdst += chromStride; - ydst += lumStride; - src += srcStride; - } -} - static inline void planar2x_c(const uint8_t *src, uint8_t *dst, int srcWidth, int srcHeight, int srcStride, int dstStride) { @@ -710,59 +676,6 @@ static void deinterleaveBytes_c(const uint8_t *src, uint8_t *dst1, uint8_t *dst2 } } -static inline void vu9_to_vu12_c(const uint8_t *src1, const uint8_t *src2, - uint8_t *dst1, uint8_t *dst2, - int width, int height, - int srcStride1, int srcStride2, - int dstStride1, int dstStride2) -{ - int x, y; - int w = width / 2; - int h = height / 2; - - for (y = 0; y < h; y++) { - const uint8_t *s1 = src1 + srcStride1 * (y >> 1); - uint8_t *d = dst1 + dstStride1 * y; - for (x = 0; x < w; x++) - d[2 * x] = d[2 * x + 1] = s1[x]; - } - for (y = 0; y < h; y++) { - const uint8_t *s2 = src2 + srcStride2 * (y >> 1); - uint8_t *d = dst2 + dstStride2 * y; - for (x = 0; x < w; x++) - d[2 * x] = d[2 * x + 1] = s2[x]; - } -} - -static inline void yvu9_to_yuy2_c(const uint8_t *src1, const uint8_t *src2, - const uint8_t *src3, uint8_t *dst, - int width, int height, - int srcStride1, int srcStride2, - int srcStride3, int dstStride) -{ - int x, y; - int w = width / 2; - int h = height; - - for (y = 0; y < h; y++) { - const uint8_t *yp = src1 + srcStride1 * y; - const uint8_t *up = src2 + srcStride2 * (y >> 2); - const uint8_t *vp = src3 + srcStride3 * (y >> 2); - uint8_t *d = dst + dstStride * y; - for (x = 0; x < w; x++) { - const int x2 = x << 2; - d[8 * x + 0] = yp[x2]; - d[8 * x + 1] = up[x]; - d[8 * x + 2] = yp[x2 + 1]; - d[8 * x + 3] = vp[x]; - d[8 * x + 4] = yp[x2 + 2]; - d[8 * x + 5] = up[x]; - d[8 * x + 6] = yp[x2 + 3]; - d[8 * x + 7] = vp[x]; - } - } -} - static void extract_even_c(const uint8_t *src, uint8_t *dst, int count) { dst += count; @@ -948,13 +861,10 @@ static av_cold void rgb2rgb_init_c(void) yv12touyvy = yv12touyvy_c; yuv422ptoyuy2 = yuv422ptoyuy2_c; yuv422ptouyvy = yuv422ptouyvy_c; - yuy2toyv12 = yuy2toyv12_c; planar2x = planar2x_c; ff_rgb24toyv12 = ff_rgb24toyv12_c; interleaveBytes = interleaveBytes_c; deinterleaveBytes = deinterleaveBytes_c; - vu9_to_vu12 = vu9_to_vu12_c; - yvu9_to_yuy2 = yvu9_to_yuy2_c; uyvytoyuv420 = uyvytoyuv420_c; uyvytoyuv422 = uyvytoyuv422_c; diff --git a/libswscale/x86/rgb2rgb.c b/libswscale/x86/rgb2rgb.c index 48a73bd0b2..f2b434f611 100644 --- a/libswscale/x86/rgb2rgb.c +++ b/libswscale/x86/rgb2rgb.c @@ -1272,107 +1272,6 @@ static inline void yuv422ptoyuy2_mmxext(const uint8_t *ysrc, const uint8_t *usrc yuvPlanartoyuy2_mmxext(ysrc, usrc, vsrc, dst, width, height, lumStride, chromStride, dstStride, 1); } -/** - * Height should be a multiple of 2 and width should be a multiple of 16. - * (If this is a problem for anyone then tell me, and I will fix it.) - */ -static inline void yuy2toyv12_mmxext(const uint8_t *src, uint8_t *ydst, uint8_t *udst, uint8_t *vdst, - int width, int height, - int lumStride, int chromStride, int srcStride) -{ - const x86_reg chromWidth= width>>1; - for (int y = 0; y < height; y += 2) { - __asm__ volatile( - "xor %%"FF_REG_a", %%"FF_REG_a"\n\t" - "pcmpeqw %%mm7, %%mm7 \n\t" - "psrlw $8, %%mm7 \n\t" // FF,00,FF,00... - ".p2align 4 \n\t" - "1: \n\t" - PREFETCH" 64(%0, %%"FF_REG_a", 4) \n\t" - "movq (%0, %%"FF_REG_a", 4), %%mm0 \n\t" // YUYV YUYV(0) - "movq 8(%0, %%"FF_REG_a", 4), %%mm1 \n\t" // YUYV YUYV(4) - "movq %%mm0, %%mm2 \n\t" // YUYV YUYV(0) - "movq %%mm1, %%mm3 \n\t" // YUYV YUYV(4) - "psrlw $8, %%mm0 \n\t" // U0V0 U0V0(0) - "psrlw $8, %%mm1 \n\t" // U0V0 U0V0(4) - "pand %%mm7, %%mm2 \n\t" // Y0Y0 Y0Y0(0) - "pand %%mm7, %%mm3 \n\t" // Y0Y0 Y0Y0(4) - "packuswb %%mm1, %%mm0 \n\t" // UVUV UVUV(0) - "packuswb %%mm3, %%mm2 \n\t" // YYYY YYYY(0) - - MOVNTQ" %%mm2, (%1, %%"FF_REG_a", 2) \n\t" - - "movq 16(%0, %%"FF_REG_a", 4), %%mm1 \n\t" // YUYV YUYV(8) - "movq 24(%0, %%"FF_REG_a", 4), %%mm2 \n\t" // YUYV YUYV(12) - "movq %%mm1, %%mm3 \n\t" // YUYV YUYV(8) - "movq %%mm2, %%mm4 \n\t" // YUYV YUYV(12) - "psrlw $8, %%mm1 \n\t" // U0V0 U0V0(8) - "psrlw $8, %%mm2 \n\t" // U0V0 U0V0(12) - "pand %%mm7, %%mm3 \n\t" // Y0Y0 Y0Y0(8) - "pand %%mm7, %%mm4 \n\t" // Y0Y0 Y0Y0(12) - "packuswb %%mm2, %%mm1 \n\t" // UVUV UVUV(8) - "packuswb %%mm4, %%mm3 \n\t" // YYYY YYYY(8) - - MOVNTQ" %%mm3, 8(%1, %%"FF_REG_a", 2) \n\t" - - "movq %%mm0, %%mm2 \n\t" // UVUV UVUV(0) - "movq %%mm1, %%mm3 \n\t" // UVUV UVUV(8) - "psrlw $8, %%mm0 \n\t" // V0V0 V0V0(0) - "psrlw $8, %%mm1 \n\t" // V0V0 V0V0(8) - "pand %%mm7, %%mm2 \n\t" // U0U0 U0U0(0) - "pand %%mm7, %%mm3 \n\t" // U0U0 U0U0(8) - "packuswb %%mm1, %%mm0 \n\t" // VVVV VVVV(0) - "packuswb %%mm3, %%mm2 \n\t" // UUUU UUUU(0) - - MOVNTQ" %%mm0, (%3, %%"FF_REG_a") \n\t" - MOVNTQ" %%mm2, (%2, %%"FF_REG_a") \n\t" - - "add $8, %%"FF_REG_a" \n\t" - "cmp %4, %%"FF_REG_a" \n\t" - " jb 1b \n\t" - ::"r"(src), "r"(ydst), "r"(udst), "r"(vdst), "g" (chromWidth) - : "memory", "%"FF_REG_a - ); - - ydst += lumStride; - src += srcStride; - - __asm__ volatile( - "xor %%"FF_REG_a", %%"FF_REG_a"\n\t" - ".p2align 4 \n\t" - "1: \n\t" - PREFETCH" 64(%0, %%"FF_REG_a", 4) \n\t" - "movq (%0, %%"FF_REG_a", 4), %%mm0 \n\t" // YUYV YUYV(0) - "movq 8(%0, %%"FF_REG_a", 4), %%mm1 \n\t" // YUYV YUYV(4) - "movq 16(%0, %%"FF_REG_a", 4), %%mm2 \n\t" // YUYV YUYV(8) - "movq 24(%0, %%"FF_REG_a", 4), %%mm3 \n\t" // YUYV YUYV(12) - "pand %%mm7, %%mm0 \n\t" // Y0Y0 Y0Y0(0) - "pand %%mm7, %%mm1 \n\t" // Y0Y0 Y0Y0(4) - "pand %%mm7, %%mm2 \n\t" // Y0Y0 Y0Y0(8) - "pand %%mm7, %%mm3 \n\t" // Y0Y0 Y0Y0(12) - "packuswb %%mm1, %%mm0 \n\t" // YYYY YYYY(0) - "packuswb %%mm3, %%mm2 \n\t" // YYYY YYYY(8) - - MOVNTQ" %%mm0, (%1, %%"FF_REG_a", 2) \n\t" - MOVNTQ" %%mm2, 8(%1, %%"FF_REG_a", 2) \n\t" - - "add $8, %%"FF_REG_a"\n\t" - "cmp %4, %%"FF_REG_a"\n\t" - " jb 1b \n\t" - - ::"r"(src), "r"(ydst), "r"(udst), "r"(vdst), "g" (chromWidth) - : "memory", "%"FF_REG_a - ); - udst += chromStride; - vdst += chromStride; - ydst += lumStride; - src += srcStride; - } - __asm__ volatile(EMMS" \n\t" - SFENCE" \n\t" - :::"memory"); -} - static inline void planar2x_mmxext(const uint8_t *src, uint8_t *dst, int srcWidth, int srcHeight, int srcStride, int dstStride) { dst[0]= src[0]; @@ -1677,182 +1576,6 @@ static inline void rgb24toyv12_mmxext(const uint8_t *src, uint8_t *ydst, uint8_t } #endif /* HAVE_7REGS */ -static inline void vu9_to_vu12_mmxext(const uint8_t *src1, const uint8_t *src2, - uint8_t *dst1, uint8_t *dst2, - int width, int height, - int srcStride1, int srcStride2, - int dstStride1, int dstStride2) -{ - int w,h; - w=width/2; h=height/2; - __asm__ volatile( - PREFETCH" %0 \n\t" - PREFETCH" %1 \n\t" - ::"m"(*(src1+srcStride1)),"m"(*(src2+srcStride2)):"memory"); - for (x86_reg y = 0; y < h; y++) { - const uint8_t* s1=src1+srcStride1*(y>>1); - uint8_t* d=dst1+dstStride1*y; - x86_reg x = 0; - for (;x>1); - uint8_t* d=dst2+dstStride2*y; - x86_reg x = 0; - for (;x>2); - const uint8_t* vp=src3+srcStride3*(y>>2); - uint8_t* d=dst+dstStride*y; - x86_reg x = 0; - for (;x