Commit befa8e66 authored by Ramiro Polla's avatar Ramiro Polla

Move yuv2rgb code to subdirs.

Originally committed as revision 29063 to svn://svn.mplayerhq.hu/mplayer/trunk/libswscale
parent b2cfd7e3
...@@ -7,14 +7,20 @@ HEADERS = swscale.h ...@@ -7,14 +7,20 @@ HEADERS = swscale.h
OBJS = rgb2rgb.o swscale.o swscale_avoption.o yuv2rgb.o OBJS = rgb2rgb.o swscale.o swscale_avoption.o yuv2rgb.o
OBJS-$(ARCH_BFIN) += internal_bfin.o swscale_bfin.o yuv2rgb_bfin.o OBJS-$(ARCH_BFIN) += internal_bfin.o swscale_bfin.o bfin/yuv2rgb_bfin.o
OBJS-$(CONFIG_MLIB) += yuv2rgb_mlib.o OBJS-$(CONFIG_MLIB) += mlib/yuv2rgb_mlib.o
OBJS-$(HAVE_ALTIVEC) += yuv2rgb_altivec.o OBJS-$(HAVE_ALTIVEC) += ppc/yuv2rgb_altivec.o
OBJS-$(HAVE_VIS) += yuv2rgb_vis.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 EXAMPLES = swscale-example
TESTPROGS = cs_test TESTPROGS = cs_test
DIRS = bfin mlib ppc sparc x86
include $(SUBDIR)../subdir.mak include $(SUBDIR)../subdir.mak
$(SUBDIR)cs_test: $(SUBDIR)cs_test.o $(SUBDIR)$(LIBNAME) $(SUBDIR)cs_test: $(SUBDIR)cs_test.o $(SUBDIR)$(LIBNAME)
......
...@@ -28,9 +28,9 @@ ...@@ -28,9 +28,9 @@
#include <assert.h> #include <assert.h>
#include "config.h" #include "config.h"
#include <unistd.h> #include <unistd.h>
#include "rgb2rgb.h" #include "libswscale/rgb2rgb.h"
#include "swscale.h" #include "libswscale/swscale.h"
#include "swscale_internal.h" #include "libswscale/swscale_internal.h"
#ifdef __FDPIC__ #ifdef __FDPIC__
#define L1CODE __attribute__ ((l1_text)) #define L1CODE __attribute__ ((l1_text))
......
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <assert.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, static int mlib_YUV2ARGB420_32(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY,
int srcSliceH, uint8_t* dst[], int dstStride[]){ int srcSliceH, uint8_t* dst[], int dstStride[]){
......
...@@ -91,9 +91,9 @@ adjustment. ...@@ -91,9 +91,9 @@ adjustment.
#include <inttypes.h> #include <inttypes.h>
#include <assert.h> #include <assert.h>
#include "config.h" #include "config.h"
#include "rgb2rgb.h" #include "libswscale/rgb2rgb.h"
#include "swscale.h" #include "libswscale/swscale.h"
#include "swscale_internal.h" #include "libswscale/swscale_internal.h"
#undef PROFILE_THE_BEAST #undef PROFILE_THE_BEAST
#undef INC_SCALING #undef INC_SCALING
......
...@@ -22,8 +22,8 @@ ...@@ -22,8 +22,8 @@
#include <inttypes.h> #include <inttypes.h>
#include <stdlib.h> #include <stdlib.h>
#include "swscale.h" #include "libswscale/swscale.h"
#include "swscale_internal.h" #include "libswscale/swscale_internal.h"
#define YUV2RGB_INIT \ #define YUV2RGB_INIT \
"wr %%g0, 0x10, %%gsr \n\t" \ "wr %%g0, 0x10, %%gsr \n\t" \
......
...@@ -221,7 +221,11 @@ SwsFunc ff_yuv2rgb_get_func_ptr(SwsContext *c); ...@@ -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); 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); 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_init_altivec(SwsContext *c);
SwsFunc ff_yuv2rgb_get_func_ptr_bfin(SwsContext *c);
void ff_yuv2packedX_altivec(SwsContext *c, void ff_yuv2packedX_altivec(SwsContext *c,
int16_t *lumFilter, int16_t **lumSrc, int lumFilterSize, int16_t *lumFilter, int16_t **lumSrc, int lumFilterSize,
int16_t *chrFilter, int16_t **chrSrc, int chrFilterSize, int16_t *chrFilter, int16_t **chrSrc, int chrFilterSize,
......
/*
* 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;
}
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
* *
* Copyright (C) 2009 Konstantin Shishkov * Copyright (C) 2009 Konstantin Shishkov
* *
* MMX/MMX2 template stuff (needed for fast movntq support),
* 1,4,8bpp support and context / deglobalize stuff * 1,4,8bpp support and context / deglobalize stuff
* by Michael Niedermayer (michaelni@gmx.at) * by Michael Niedermayer (michaelni@gmx.at)
* *
...@@ -35,37 +34,10 @@ ...@@ -35,37 +34,10 @@
#include "swscale_internal.h" #include "swscale_internal.h"
#include "libavutil/x86_cpu.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_32[8][8];
extern const uint8_t dither_8x8_73[8][8]; extern const uint8_t dither_8x8_73[8][8];
extern const uint8_t dither_8x8_220[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] = { const int32_t ff_yuv2rgb_coeffs[8][4] = {
{117504, 138453, 13954, 34903}, /* no sequence_display_extension */ {117504, 138453, 13954, 34903}, /* no sequence_display_extension */
{117504, 138453, 13954, 34903}, /* ITU-R Rec. 709 (1990) */ {117504, 138453, 13954, 34903}, /* ITU-R Rec. 709 (1990) */
...@@ -504,30 +476,7 @@ SwsFunc ff_yuv2rgb_get_func_ptr(SwsContext *c) ...@@ -504,30 +476,7 @@ SwsFunc ff_yuv2rgb_get_func_ptr(SwsContext *c)
{ {
SwsFunc t = NULL; SwsFunc t = NULL;
#if (HAVE_MMX2 || HAVE_MMX) && CONFIG_GPL #if (HAVE_MMX2 || HAVE_MMX) && CONFIG_GPL
if (c->flags & SWS_CPU_CAPS_MMX2) { t = ff_yuv2rgb_init_mmx(c);
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;
}
}
#endif #endif
#if HAVE_VIS #if HAVE_VIS
t = ff_yuv2rgb_init_vis(c); t = ff_yuv2rgb_init_vis(c);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment