Move yuv2rgb code to subdirs.
authorRamiro Polla <ramiro.polla@gmail.com>
Thu, 26 Mar 2009 01:30:10 +0000 (01:30 +0000)
committerRamiro Polla <ramiro.polla@gmail.com>
Thu, 26 Mar 2009 01:30:10 +0000 (01:30 +0000)
Originally committed as revision 29063 to svn://svn.mplayerhq.hu/mplayer/trunk/libswscale

libswscale/Makefile
libswscale/bfin/yuv2rgb_bfin.c [moved from libswscale/yuv2rgb_bfin.c with 98% similarity]
libswscale/mlib/yuv2rgb_mlib.c [moved from libswscale/yuv2rgb_mlib.c with 98% similarity]
libswscale/ppc/yuv2rgb_altivec.c [moved from libswscale/yuv2rgb_altivec.c with 99% similarity]
libswscale/sparc/yuv2rgb_vis.c [moved from libswscale/yuv2rgb_vis.c with 99% similarity]
libswscale/swscale_internal.h
libswscale/x86/yuv2rgb_mmx.c [new file with mode: 0644]
libswscale/x86/yuv2rgb_template.c [moved from libswscale/yuv2rgb_template.c with 100% similarity]
libswscale/yuv2rgb.c

index 4d17e5b2b7087796b51edeb547bc623e452b3fa3..448ad30594cd96a227075cf409866da2297445ae 100644 (file)
@@ -7,14 +7,20 @@ HEADERS = swscale.h
 
 OBJS = rgb2rgb.o swscale.o swscale_avoption.o yuv2rgb.o
 
-OBJS-$(ARCH_BFIN)          +=  internal_bfin.o swscale_bfin.o yuv2rgb_bfin.o
-OBJS-$(CONFIG_MLIB)        +=  yuv2rgb_mlib.o
-OBJS-$(HAVE_ALTIVEC)       +=  yuv2rgb_altivec.o
-OBJS-$(HAVE_VIS)           +=  yuv2rgb_vis.o
+OBJS-$(ARCH_BFIN)          +=  internal_bfin.o swscale_bfin.o bfin/yuv2rgb_bfin.o
+OBJS-$(CONFIG_MLIB)        +=  mlib/yuv2rgb_mlib.o
+OBJS-$(HAVE_ALTIVEC)       +=  ppc/yuv2rgb_altivec.o
+OBJS-$(HAVE_VIS)           +=  sparc/yuv2rgb_vis.o
+
+MMX-OBJS-$(CONFIG_GPL)     +=  x86/yuv2rgb_mmx.o        \
+
+OBJS-$(HAVE_MMX)           +=  $(MMX-OBJS-yes)
 
 EXAMPLES  = swscale-example
 TESTPROGS = cs_test
 
+DIRS = bfin mlib ppc sparc x86
+
 include $(SUBDIR)../subdir.mak
 
 $(SUBDIR)cs_test: $(SUBDIR)cs_test.o $(SUBDIR)$(LIBNAME)
similarity index 98%
rename from libswscale/yuv2rgb_bfin.c
rename to libswscale/bfin/yuv2rgb_bfin.c
index 2cc6962d01a926682f57fa145fcc2b9a882f8e90..39e1ec87b57ee88d2dd20a5bbb4b856d5de07670 100644 (file)
@@ -28,9 +28,9 @@
 #include <assert.h>
 #include "config.h"
 #include <unistd.h>
-#include "rgb2rgb.h"
-#include "swscale.h"
-#include "swscale_internal.h"
+#include "libswscale/rgb2rgb.h"
+#include "libswscale/swscale.h"
+#include "libswscale/swscale_internal.h"
 
 #ifdef __FDPIC__
 #define L1CODE __attribute__ ((l1_text))
similarity index 98%
rename from libswscale/yuv2rgb_mlib.c
rename to libswscale/mlib/yuv2rgb_mlib.c
index c8966b9fd5a12851a1c0223416d4f85f7f63e1e8..a4bdd1986ccbabc3974bc6804bb4dce0058b77f6 100644 (file)
@@ -28,7 +28,7 @@
 #include <stdlib.h>
 #include <assert.h>
 
-#include "swscale.h"
+#include "libswscale/swscale.h"
 
 static int mlib_YUV2ARGB420_32(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY,
                                int srcSliceH, uint8_t* dst[], int dstStride[]){
similarity index 99%
rename from libswscale/yuv2rgb_altivec.c
rename to libswscale/ppc/yuv2rgb_altivec.c
index e029805b3ceb3708f2a3023b816fc4599b5538d7..dc5894cda53219f1f42285c687b83fb322a06e3d 100644 (file)
@@ -91,9 +91,9 @@ adjustment.
 #include <inttypes.h>
 #include <assert.h>
 #include "config.h"
-#include "rgb2rgb.h"
-#include "swscale.h"
-#include "swscale_internal.h"
+#include "libswscale/rgb2rgb.h"
+#include "libswscale/swscale.h"
+#include "libswscale/swscale_internal.h"
 
 #undef PROFILE_THE_BEAST
 #undef INC_SCALING
similarity index 99%
rename from libswscale/yuv2rgb_vis.c
rename to libswscale/sparc/yuv2rgb_vis.c
index fd5d0ba2f911f43196afe59c6c525c782374ca8b..cdbe140b201fab9573bfe0208f6c22d81878bdf3 100644 (file)
@@ -22,8 +22,8 @@
 #include <inttypes.h>
 #include <stdlib.h>
 
-#include "swscale.h"
-#include "swscale_internal.h"
+#include "libswscale/swscale.h"
+#include "libswscale/swscale_internal.h"
 
 #define YUV2RGB_INIT \
     "wr %%g0, 0x10, %%gsr \n\t" \
index 7e385da93fdf76a2b0dd70533442ccb3a4ef0f7d..91f05ad0040be11e8a1607681ce5e43cc2ba3578 100644 (file)
@@ -221,7 +221,11 @@ SwsFunc ff_yuv2rgb_get_func_ptr(SwsContext *c);
 int ff_yuv2rgb_c_init_tables(SwsContext *c, const int inv_table[4], int fullRange, int brightness, int contrast, int saturation);
 
 void ff_yuv2rgb_init_tables_altivec(SwsContext *c, const int inv_table[4], int brightness, int contrast, int saturation);
+SwsFunc ff_yuv2rgb_init_mmx(SwsContext *c);
+SwsFunc ff_yuv2rgb_init_vis(SwsContext *c);
+SwsFunc ff_yuv2rgb_init_mlib(SwsContext *c);
 SwsFunc ff_yuv2rgb_init_altivec(SwsContext *c);
+SwsFunc ff_yuv2rgb_get_func_ptr_bfin(SwsContext *c);
 void ff_yuv2packedX_altivec(SwsContext *c,
                           int16_t *lumFilter, int16_t **lumSrc, int lumFilterSize,
                           int16_t *chrFilter, int16_t **chrSrc, int chrFilterSize,
diff --git a/libswscale/x86/yuv2rgb_mmx.c b/libswscale/x86/yuv2rgb_mmx.c
new file mode 100644 (file)
index 0000000..ced537f
--- /dev/null
@@ -0,0 +1,89 @@
+/*
+ * software YUV to RGB converter
+ *
+ * Copyright (C) 2009 Konstantin Shishkov
+ *
+ * MMX/MMX2 template stuff (needed for fast movntq support),
+ * 1,4,8bpp support and context / deglobalize stuff
+ * by Michael Niedermayer (michaelni@gmx.at)
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <inttypes.h>
+#include <assert.h>
+
+#include "config.h"
+#include "libswscale/rgb2rgb.h"
+#include "libswscale/swscale.h"
+#include "libswscale/swscale_internal.h"
+#include "libavutil/x86_cpu.h"
+
+#define DITHER1XBPP // only for MMX
+
+/* hope these constant values are cache line aligned */
+DECLARE_ASM_CONST(8, uint64_t, mmx_00ffw)   = 0x00ff00ff00ff00ffULL;
+DECLARE_ASM_CONST(8, uint64_t, mmx_redmask) = 0xf8f8f8f8f8f8f8f8ULL;
+DECLARE_ASM_CONST(8, uint64_t, mmx_grnmask) = 0xfcfcfcfcfcfcfcfcULL;
+
+//MMX versions
+#undef RENAME
+#undef HAVE_MMX2
+#undef HAVE_AMD3DNOW
+#define HAVE_MMX2 0
+#define HAVE_AMD3DNOW 0
+#define RENAME(a) a ## _MMX
+#include "yuv2rgb_template.c"
+
+//MMX2 versions
+#undef RENAME
+#undef HAVE_MMX2
+#define HAVE_MMX2 1
+#define RENAME(a) a ## _MMX2
+#include "yuv2rgb_template.c"
+
+SwsFunc ff_yuv2rgb_init_mmx(SwsContext *c)
+{
+    if (c->flags & SWS_CPU_CAPS_MMX2) {
+        switch (c->dstFormat) {
+        case PIX_FMT_RGB32:
+            if (CONFIG_SWSCALE_ALPHA && c->srcFormat == PIX_FMT_YUVA420P){
+                if (HAVE_7REGS) return yuva420_rgb32_MMX2;
+                break;
+            }else return yuv420_rgb32_MMX2;
+        case PIX_FMT_BGR24:  return yuv420_rgb24_MMX2;
+        case PIX_FMT_RGB565: return yuv420_rgb16_MMX2;
+        case PIX_FMT_RGB555: return yuv420_rgb15_MMX2;
+        }
+    }
+    if (c->flags & SWS_CPU_CAPS_MMX) {
+        switch (c->dstFormat) {
+        case PIX_FMT_RGB32:
+            if (CONFIG_SWSCALE_ALPHA && c->srcFormat == PIX_FMT_YUVA420P){
+                if (HAVE_7REGS) return yuva420_rgb32_MMX;
+                break;
+            }else return yuv420_rgb32_MMX;
+        case PIX_FMT_BGR24:  return yuv420_rgb24_MMX;
+        case PIX_FMT_RGB565: return yuv420_rgb16_MMX;
+        case PIX_FMT_RGB555: return yuv420_rgb15_MMX;
+        }
+    }
+
+    return NULL;
+}
index 112d4a375c69ed404fb8b03bc587b2f939395d3b..d8438c0c6695ce95cb64b0fa8ab835f33163db9c 100644 (file)
@@ -3,7 +3,6 @@
  *
  * Copyright (C) 2009 Konstantin Shishkov
  *
- * MMX/MMX2 template stuff (needed for fast movntq support),
  * 1,4,8bpp support and context / deglobalize stuff
  * by Michael Niedermayer (michaelni@gmx.at)
  *
 #include "swscale_internal.h"
 #include "libavutil/x86_cpu.h"
 
-#define DITHER1XBPP // only for MMX
-
 extern const uint8_t dither_8x8_32[8][8];
 extern const uint8_t dither_8x8_73[8][8];
 extern const uint8_t dither_8x8_220[8][8];
 
-#if HAVE_MMX && CONFIG_GPL
-
-/* hope these constant values are cache line aligned */
-DECLARE_ASM_CONST(8, uint64_t, mmx_00ffw)   = 0x00ff00ff00ff00ffULL;
-DECLARE_ASM_CONST(8, uint64_t, mmx_redmask) = 0xf8f8f8f8f8f8f8f8ULL;
-DECLARE_ASM_CONST(8, uint64_t, mmx_grnmask) = 0xfcfcfcfcfcfcfcfcULL;
-
-//MMX versions
-#undef RENAME
-#undef HAVE_MMX2
-#undef HAVE_AMD3DNOW
-#define HAVE_MMX2 0
-#define HAVE_AMD3DNOW 0
-#define RENAME(a) a ## _MMX
-#include "yuv2rgb_template.c"
-
-//MMX2 versions
-#undef RENAME
-#undef HAVE_MMX2
-#define HAVE_MMX2 1
-#define RENAME(a) a ## _MMX2
-#include "yuv2rgb_template.c"
-
-#endif /* HAVE_MMX && CONFIG_GPL */
-
 const int32_t ff_yuv2rgb_coeffs[8][4] = {
     {117504, 138453, 13954, 34903}, /* no sequence_display_extension */
     {117504, 138453, 13954, 34903}, /* ITU-R Rec. 709 (1990) */
@@ -504,30 +476,7 @@ SwsFunc ff_yuv2rgb_get_func_ptr(SwsContext *c)
 {
     SwsFunc t = NULL;
 #if (HAVE_MMX2 || HAVE_MMX) && CONFIG_GPL
-    if (c->flags & SWS_CPU_CAPS_MMX2) {
-        switch (c->dstFormat) {
-        case PIX_FMT_RGB32:
-            if (CONFIG_SWSCALE_ALPHA && c->srcFormat == PIX_FMT_YUVA420P){
-                if (HAVE_7REGS) return yuva420_rgb32_MMX2;
-                break;
-            }else return yuv420_rgb32_MMX2;
-        case PIX_FMT_BGR24:  return yuv420_rgb24_MMX2;
-        case PIX_FMT_RGB565: return yuv420_rgb16_MMX2;
-        case PIX_FMT_RGB555: return yuv420_rgb15_MMX2;
-        }
-    }
-    if (c->flags & SWS_CPU_CAPS_MMX) {
-        switch (c->dstFormat) {
-        case PIX_FMT_RGB32:
-            if (CONFIG_SWSCALE_ALPHA && c->srcFormat == PIX_FMT_YUVA420P){
-                if (HAVE_7REGS) return yuva420_rgb32_MMX;
-                break;
-            }else return yuv420_rgb32_MMX;
-        case PIX_FMT_BGR24:  return yuv420_rgb24_MMX;
-        case PIX_FMT_RGB565: return yuv420_rgb16_MMX;
-        case PIX_FMT_RGB555: return yuv420_rgb15_MMX;
-        }
-    }
+     t = ff_yuv2rgb_init_mmx(c);
 #endif
 #if HAVE_VIS
     t = ff_yuv2rgb_init_vis(c);