diff options
author | Ramiro Polla <ramiro.polla@gmail.com> | 2009-03-26 01:30:10 +0000 |
---|---|---|
committer | Ramiro Polla <ramiro.polla@gmail.com> | 2009-03-26 01:30:10 +0000 |
commit | befa8e665c460244ba523131e6c22b19ab269e77 (patch) | |
tree | 9a51f7b45c2386a9022bdfbe17c300df49d8fd54 | |
parent | b2cfd7e360189d6f7eab23200c306ed467148423 (diff) | |
download | ffmpeg-streaming-befa8e665c460244ba523131e6c22b19ab269e77.zip ffmpeg-streaming-befa8e665c460244ba523131e6c22b19ab269e77.tar.gz |
Move yuv2rgb code to subdirs.
Originally committed as revision 29063 to svn://svn.mplayerhq.hu/mplayer/trunk/libswscale
-rw-r--r-- | libswscale/Makefile | 14 | ||||
-rw-r--r-- | libswscale/bfin/yuv2rgb_bfin.c (renamed from libswscale/yuv2rgb_bfin.c) | 6 | ||||
-rw-r--r-- | libswscale/mlib/yuv2rgb_mlib.c (renamed from libswscale/yuv2rgb_mlib.c) | 2 | ||||
-rw-r--r-- | libswscale/ppc/yuv2rgb_altivec.c (renamed from libswscale/yuv2rgb_altivec.c) | 6 | ||||
-rw-r--r-- | libswscale/sparc/yuv2rgb_vis.c (renamed from libswscale/yuv2rgb_vis.c) | 4 | ||||
-rw-r--r-- | libswscale/swscale_internal.h | 4 | ||||
-rw-r--r-- | libswscale/x86/yuv2rgb_mmx.c | 89 | ||||
-rw-r--r-- | libswscale/x86/yuv2rgb_template.c (renamed from libswscale/yuv2rgb_template.c) | 0 | ||||
-rw-r--r-- | libswscale/yuv2rgb.c | 53 |
9 files changed, 113 insertions, 65 deletions
diff --git a/libswscale/Makefile b/libswscale/Makefile index 4d17e5b..448ad30 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 index 2cc6962..39e1ec8 100644 --- a/libswscale/yuv2rgb_bfin.c +++ b/libswscale/bfin/yuv2rgb_bfin.c @@ -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)) diff --git a/libswscale/yuv2rgb_mlib.c b/libswscale/mlib/yuv2rgb_mlib.c index c8966b9..a4bdd19 100644 --- a/libswscale/yuv2rgb_mlib.c +++ b/libswscale/mlib/yuv2rgb_mlib.c @@ -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[]){ diff --git a/libswscale/yuv2rgb_altivec.c b/libswscale/ppc/yuv2rgb_altivec.c index e029805..dc5894c 100644 --- a/libswscale/yuv2rgb_altivec.c +++ b/libswscale/ppc/yuv2rgb_altivec.c @@ -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 diff --git a/libswscale/yuv2rgb_vis.c b/libswscale/sparc/yuv2rgb_vis.c index fd5d0ba..cdbe140 100644 --- a/libswscale/yuv2rgb_vis.c +++ b/libswscale/sparc/yuv2rgb_vis.c @@ -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" \ diff --git a/libswscale/swscale_internal.h b/libswscale/swscale_internal.h index 7e385da..91f05ad 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 0000000..ced537f --- /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 <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; +} diff --git a/libswscale/yuv2rgb_template.c b/libswscale/x86/yuv2rgb_template.c index 798eff0..798eff0 100644 --- a/libswscale/yuv2rgb_template.c +++ b/libswscale/x86/yuv2rgb_template.c diff --git a/libswscale/yuv2rgb.c b/libswscale/yuv2rgb.c index 112d4a3..d8438c0 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); |