From: Ramiro Polla Date: Thu, 26 Mar 2009 01:30:10 +0000 (+0000) Subject: Move yuv2rgb code to subdirs. X-Git-Tag: android-x86-4.4-r1~27130 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=befa8e665c460244ba523131e6c22b19ab269e77;p=android-x86%2Fexternal-ffmpeg.git Move yuv2rgb code to subdirs. Originally committed as revision 29063 to svn://svn.mplayerhq.hu/mplayer/trunk/libswscale --- diff --git a/libswscale/Makefile b/libswscale/Makefile index 4d17e5b2b7..448ad30594 100644 --- a/libswscale/Makefile +++ b/libswscale/Makefile @@ -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) diff --git a/libswscale/yuv2rgb_bfin.c b/libswscale/bfin/yuv2rgb_bfin.c similarity index 98% rename from libswscale/yuv2rgb_bfin.c rename to libswscale/bfin/yuv2rgb_bfin.c index 2cc6962d01..39e1ec87b5 100644 --- a/libswscale/yuv2rgb_bfin.c +++ b/libswscale/bfin/yuv2rgb_bfin.c @@ -28,9 +28,9 @@ #include #include "config.h" #include -#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)) diff --git a/libswscale/yuv2rgb_mlib.c b/libswscale/mlib/yuv2rgb_mlib.c similarity index 98% rename from libswscale/yuv2rgb_mlib.c rename to libswscale/mlib/yuv2rgb_mlib.c index c8966b9fd5..a4bdd1986c 100644 --- a/libswscale/yuv2rgb_mlib.c +++ b/libswscale/mlib/yuv2rgb_mlib.c @@ -28,7 +28,7 @@ #include #include -#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[]){ diff --git a/libswscale/yuv2rgb_altivec.c b/libswscale/ppc/yuv2rgb_altivec.c similarity index 99% rename from libswscale/yuv2rgb_altivec.c rename to libswscale/ppc/yuv2rgb_altivec.c index e029805b3c..dc5894cda5 100644 --- a/libswscale/yuv2rgb_altivec.c +++ b/libswscale/ppc/yuv2rgb_altivec.c @@ -91,9 +91,9 @@ adjustment. #include #include #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 diff --git a/libswscale/yuv2rgb_vis.c b/libswscale/sparc/yuv2rgb_vis.c similarity index 99% rename from libswscale/yuv2rgb_vis.c rename to libswscale/sparc/yuv2rgb_vis.c index fd5d0ba2f9..cdbe140b20 100644 --- a/libswscale/yuv2rgb_vis.c +++ b/libswscale/sparc/yuv2rgb_vis.c @@ -22,8 +22,8 @@ #include #include -#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" \ diff --git a/libswscale/swscale_internal.h b/libswscale/swscale_internal.h index 7e385da93f..91f05ad004 100644 --- a/libswscale/swscale_internal.h +++ b/libswscale/swscale_internal.h @@ -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 index 0000000000..ced537fcce --- /dev/null +++ b/libswscale/x86/yuv2rgb_mmx.c @@ -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 +#include +#include +#include + +#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; +} diff --git a/libswscale/yuv2rgb_template.c b/libswscale/x86/yuv2rgb_template.c similarity index 100% rename from libswscale/yuv2rgb_template.c rename to libswscale/x86/yuv2rgb_template.c diff --git a/libswscale/yuv2rgb.c b/libswscale/yuv2rgb.c index 112d4a375c..d8438c0c66 100644 --- a/libswscale/yuv2rgb.c +++ b/libswscale/yuv2rgb.c @@ -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) * @@ -35,37 +34,10 @@ #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);