diff options
Diffstat (limited to 'libswscale')
-rw-r--r-- | libswscale/Makefile | 25 | ||||
-rw-r--r-- | libswscale/bfin/internal_bfin.S (renamed from libswscale/internal_bfin.S) | 0 | ||||
-rw-r--r-- | libswscale/bfin/swscale_bfin.c (renamed from libswscale/swscale_bfin.c) | 34 | ||||
-rw-r--r-- | libswscale/bfin/yuv2rgb_bfin.c (renamed from libswscale/yuv2rgb_bfin.c) | 110 | ||||
-rw-r--r-- | libswscale/colorspace-test.c (renamed from libswscale/cs_test.c) | 0 | ||||
-rw-r--r-- | libswscale/mlib/yuv2rgb_mlib.c (renamed from libswscale/yuv2rgb_mlib.c) | 4 | ||||
-rw-r--r-- | libswscale/ppc/swscale_altivec_template.c (renamed from libswscale/swscale_altivec_template.c) | 16 | ||||
-rw-r--r-- | libswscale/ppc/yuv2rgb_altivec.c (renamed from libswscale/yuv2rgb_altivec.c) | 12 | ||||
-rw-r--r-- | libswscale/rgb2rgb.c | 13 | ||||
-rw-r--r-- | libswscale/rgb2rgb.h | 14 | ||||
-rw-r--r-- | libswscale/rgb2rgb_template.c | 384 | ||||
-rw-r--r-- | libswscale/sparc/yuv2rgb_vis.c (renamed from libswscale/yuv2rgb_vis.c) | 6 | ||||
-rw-r--r-- | libswscale/swscale-example.c | 51 | ||||
-rw-r--r-- | libswscale/swscale.c | 377 | ||||
-rw-r--r-- | libswscale/swscale_internal.h | 22 | ||||
-rw-r--r-- | libswscale/swscale_template.c | 428 | ||||
-rw-r--r-- | libswscale/x86/yuv2rgb_mmx.c | 89 | ||||
-rw-r--r-- | libswscale/x86/yuv2rgb_template.c (renamed from libswscale/yuv2rgb_template.c) | 35 | ||||
-rw-r--r-- | libswscale/yuv2rgb.c | 175 |
19 files changed, 1380 insertions, 415 deletions
diff --git a/libswscale/Makefile b/libswscale/Makefile index 6d500abc65..bf75b64959 100644 --- a/libswscale/Makefile +++ b/libswscale/Makefile @@ -7,18 +7,25 @@ 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) += bfin/internal_bfin.o \ + bfin/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 -TESTS = cs_test swscale-example +MMX-OBJS-$(CONFIG_GPL) += x86/yuv2rgb_mmx.o \ -CLEANFILES = cs_test swscale-example +OBJS-$(HAVE_MMX) += $(MMX-OBJS-yes) + +EXAMPLES = swscale +TESTPROGS = colorspace + +DIRS = bfin mlib ppc sparc x86 include $(SUBDIR)../subdir.mak -$(SUBDIR)cs_test: $(SUBDIR)cs_test.o $(SUBDIR)$(LIBNAME) +$(SUBDIR)colorspace-test$(EXESUF): $(SUBDIR)colorspace-test.o $(SUBDIR)$(LIBNAME) -$(SUBDIR)swscale-example: $(SUBDIR)swscale-example.o $(SUBDIR)$(LIBNAME) -$(SUBDIR)swscale-example: EXTRALIBS += -lm +$(SUBDIR)swscale-example$(EXESUF): $(SUBDIR)swscale-example.o $(SUBDIR)$(LIBNAME) +$(SUBDIR)swscale-example$(EXESUF): EXTRALIBS += -lm diff --git a/libswscale/internal_bfin.S b/libswscale/bfin/internal_bfin.S index fb7bda7e12..fb7bda7e12 100644 --- a/libswscale/internal_bfin.S +++ b/libswscale/bfin/internal_bfin.S diff --git a/libswscale/swscale_bfin.c b/libswscale/bfin/swscale_bfin.c index ed7d9579b6..2ad81d847d 100644 --- a/libswscale/swscale_bfin.c +++ b/libswscale/bfin/swscale_bfin.c @@ -27,9 +27,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)) @@ -37,16 +37,16 @@ #define L1CODE #endif -int ff_bfin_uyvytoyv12 (const uint8_t *src, uint8_t *ydst, uint8_t *udst, uint8_t *vdst, - long width, long height, - long lumStride, long chromStride, long srcStride) L1CODE; +int ff_bfin_uyvytoyv12(const uint8_t *src, uint8_t *ydst, uint8_t *udst, uint8_t *vdst, + long width, long height, + long lumStride, long chromStride, long srcStride) L1CODE; -int ff_bfin_yuyvtoyv12 (const uint8_t *src, uint8_t *ydst, uint8_t *udst, uint8_t *vdst, - long width, long height, - long lumStride, long chromStride, long srcStride) L1CODE; +int ff_bfin_yuyvtoyv12(const uint8_t *src, uint8_t *ydst, uint8_t *udst, uint8_t *vdst, + long width, long height, + long lumStride, long chromStride, long srcStride) L1CODE; -static int uyvytoyv12_unscaled (SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY, - int srcSliceH, uint8_t* dst[], int dstStride[]) +static int uyvytoyv12_unscaled(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY, + int srcSliceH, uint8_t* dst[], int dstStride[]) { uint8_t *dsty = dst[0] + dstStride[0]*srcSliceY; uint8_t *dstu = dst[1] + dstStride[1]*srcSliceY/2; @@ -54,13 +54,14 @@ static int uyvytoyv12_unscaled (SwsContext *c, uint8_t* src[], int srcStride[], uint8_t *ip = src[0] + srcStride[0]*srcSliceY; int w = dstStride[0]; - ff_bfin_uyvytoyv12 (ip, dsty, dstu, dstv, w, srcSliceH, dstStride[0], dstStride[1], srcStride[0]); + ff_bfin_uyvytoyv12(ip, dsty, dstu, dstv, w, srcSliceH, + dstStride[0], dstStride[1], srcStride[0]); return srcSliceH; } -static int yuyvtoyv12_unscaled (SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY, - int srcSliceH, uint8_t* dst[], int dstStride[]) +static int yuyvtoyv12_unscaled(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY, + int srcSliceH, uint8_t* dst[], int dstStride[]) { uint8_t *dsty = dst[0] + dstStride[0]*srcSliceY; uint8_t *dstu = dst[1] + dstStride[1]*srcSliceY/2; @@ -68,13 +69,14 @@ static int yuyvtoyv12_unscaled (SwsContext *c, uint8_t* src[], int srcStride[], uint8_t *ip = src[0] + srcStride[0]*srcSliceY; int w = dstStride[0]; - ff_bfin_yuyvtoyv12 (ip, dsty, dstu, dstv, w, srcSliceH, dstStride[0], dstStride[1], srcStride[0]); + ff_bfin_yuyvtoyv12(ip, dsty, dstu, dstv, w, srcSliceH, + dstStride[0], dstStride[1], srcStride[0]); return srcSliceH; } -void ff_bfin_get_unscaled_swscale (SwsContext *c) +void ff_bfin_get_unscaled_swscale(SwsContext *c) { SwsFunc swScale = c->swScale; if (c->flags & SWS_CPU_CAPS_BFIN) diff --git a/libswscale/yuv2rgb_bfin.c b/libswscale/bfin/yuv2rgb_bfin.c index 58cc5b6a35..39e1ec87b5 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)) @@ -38,20 +38,20 @@ #define L1CODE #endif -void ff_bfin_yuv2rgb555_line (uint8_t *Y, uint8_t *U, uint8_t *V, uint8_t *out, - int w, uint32_t *coeffs) L1CODE; - -void ff_bfin_yuv2rgb565_line (uint8_t *Y, uint8_t *U, uint8_t *V, uint8_t *out, - int w, uint32_t *coeffs) L1CODE; +void ff_bfin_yuv2rgb555_line(uint8_t *Y, uint8_t *U, uint8_t *V, uint8_t *out, + int w, uint32_t *coeffs) L1CODE; -void ff_bfin_yuv2rgb24_line (uint8_t *Y, uint8_t *U, uint8_t *V, uint8_t *out, +void ff_bfin_yuv2rgb565_line(uint8_t *Y, uint8_t *U, uint8_t *V, uint8_t *out, int w, uint32_t *coeffs) L1CODE; +void ff_bfin_yuv2rgb24_line(uint8_t *Y, uint8_t *U, uint8_t *V, uint8_t *out, + int w, uint32_t *coeffs) L1CODE; + typedef void (* ltransform)(uint8_t *Y, uint8_t *U, uint8_t *V, uint8_t *out, int w, uint32_t *coeffs); -static void bfin_prepare_coefficients (SwsContext *c, int rgb, int masks) +static void bfin_prepare_coefficients(SwsContext *c, int rgb, int masks) { int oy; oy = c->yOffset&0xffff; @@ -88,18 +88,18 @@ static void bfin_prepare_coefficients (SwsContext *c, int rgb, int masks) } } -static int core_yuv420_rgb (SwsContext *c, - uint8_t **in, int *instrides, - int srcSliceY, int srcSliceH, - uint8_t **oplanes, int *outstrides, - ltransform lcscf, int rgb, int masks) +static int core_yuv420_rgb(SwsContext *c, + uint8_t **in, int *instrides, + int srcSliceY, int srcSliceH, + uint8_t **oplanes, int *outstrides, + ltransform lcscf, int rgb, int masks) { uint8_t *py,*pu,*pv,*op; int w = instrides[0]; int h2 = srcSliceH>>1; int i; - bfin_prepare_coefficients (c, rgb, masks); + bfin_prepare_coefficients(c, rgb, masks); py = in[0]; pu = in[1+(1^rgb)]; @@ -109,12 +109,12 @@ static int core_yuv420_rgb (SwsContext *c, for (i=0;i<h2;i++) { - lcscf (py, pu, pv, op, w, &c->oy); + lcscf(py, pu, pv, op, w, &c->oy); py += instrides[0]; op += outstrides[0]; - lcscf (py, pu, pv, op, w, &c->oy); + lcscf(py, pu, pv, op, w, &c->oy); py += instrides[0]; pu += instrides[1]; @@ -126,62 +126,62 @@ static int core_yuv420_rgb (SwsContext *c, } -static int bfin_yuv420_rgb555 (SwsContext *c, - uint8_t **in, int *instrides, - int srcSliceY, int srcSliceH, - uint8_t **oplanes, int *outstrides) -{ - return core_yuv420_rgb (c, in, instrides, srcSliceY, srcSliceH, oplanes, outstrides, - ff_bfin_yuv2rgb555_line, 1, 555); -} - -static int bfin_yuv420_bgr555 (SwsContext *c, - uint8_t **in, int *instrides, - int srcSliceY, int srcSliceH, - uint8_t **oplanes, int *outstrides) -{ - return core_yuv420_rgb (c, in, instrides, srcSliceY, srcSliceH, oplanes, outstrides, - ff_bfin_yuv2rgb555_line, 0, 555); -} - -static int bfin_yuv420_rgb24 (SwsContext *c, +static int bfin_yuv420_rgb555(SwsContext *c, uint8_t **in, int *instrides, int srcSliceY, int srcSliceH, uint8_t **oplanes, int *outstrides) { - return core_yuv420_rgb (c, in, instrides, srcSliceY, srcSliceH, oplanes, outstrides, - ff_bfin_yuv2rgb24_line, 1, 888); + return core_yuv420_rgb(c, in, instrides, srcSliceY, srcSliceH, oplanes, + outstrides, ff_bfin_yuv2rgb555_line, 1, 555); } -static int bfin_yuv420_bgr24 (SwsContext *c, +static int bfin_yuv420_bgr555(SwsContext *c, uint8_t **in, int *instrides, int srcSliceY, int srcSliceH, uint8_t **oplanes, int *outstrides) { - return core_yuv420_rgb (c, in, instrides, srcSliceY, srcSliceH, oplanes, outstrides, - ff_bfin_yuv2rgb24_line, 0, 888); + return core_yuv420_rgb(c, in, instrides, srcSliceY, srcSliceH, oplanes, + outstrides, ff_bfin_yuv2rgb555_line, 0, 555); } -static int bfin_yuv420_rgb565 (SwsContext *c, - uint8_t **in, int *instrides, - int srcSliceY, int srcSliceH, - uint8_t **oplanes, int *outstrides) +static int bfin_yuv420_rgb24(SwsContext *c, + uint8_t **in, int *instrides, + int srcSliceY, int srcSliceH, + uint8_t **oplanes, int *outstrides) { - return core_yuv420_rgb (c, in, instrides, srcSliceY, srcSliceH, oplanes, outstrides, - ff_bfin_yuv2rgb565_line, 1, 565); + return core_yuv420_rgb(c, in, instrides, srcSliceY, srcSliceH, oplanes, + outstrides, ff_bfin_yuv2rgb24_line, 1, 888); } -static int bfin_yuv420_bgr565 (SwsContext *c, - uint8_t **in, int *instrides, - int srcSliceY, int srcSliceH, - uint8_t **oplanes, int *outstrides) +static int bfin_yuv420_bgr24(SwsContext *c, + uint8_t **in, int *instrides, + int srcSliceY, int srcSliceH, + uint8_t **oplanes, int *outstrides) +{ + return core_yuv420_rgb(c, in, instrides, srcSliceY, srcSliceH, oplanes, + outstrides, ff_bfin_yuv2rgb24_line, 0, 888); +} + +static int bfin_yuv420_rgb565(SwsContext *c, + uint8_t **in, int *instrides, + int srcSliceY, int srcSliceH, + uint8_t **oplanes, int *outstrides) +{ + return core_yuv420_rgb(c, in, instrides, srcSliceY, srcSliceH, oplanes, + outstrides, ff_bfin_yuv2rgb565_line, 1, 565); +} + +static int bfin_yuv420_bgr565(SwsContext *c, + uint8_t **in, int *instrides, + int srcSliceY, int srcSliceH, + uint8_t **oplanes, int *outstrides) { - return core_yuv420_rgb (c, in, instrides, srcSliceY, srcSliceH, oplanes, outstrides, - ff_bfin_yuv2rgb565_line, 0, 565); + return core_yuv420_rgb(c, in, instrides, srcSliceY, srcSliceH, oplanes, + outstrides, ff_bfin_yuv2rgb565_line, 0, 565); } -SwsFunc ff_bfin_yuv2rgb_get_func_ptr (SwsContext *c) +SwsFunc ff_yuv2rgb_get_func_ptr_bfin(SwsContext *c) { SwsFunc f; diff --git a/libswscale/cs_test.c b/libswscale/colorspace-test.c index 2223ee3a31..2223ee3a31 100644 --- a/libswscale/cs_test.c +++ b/libswscale/colorspace-test.c diff --git a/libswscale/yuv2rgb_mlib.c b/libswscale/mlib/yuv2rgb_mlib.c index 68247914e7..a4bdd1986c 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[]){ @@ -73,7 +73,7 @@ static int mlib_YUV2RGB420_24(SwsContext *c, uint8_t* src[], int srcStride[], in } -SwsFunc sws_yuv2rgb_init_mlib(SwsContext *c) +SwsFunc ff_yuv2rgb_init_mlib(SwsContext *c) { switch(c->dstFormat){ case PIX_FMT_RGB24: return mlib_YUV2RGB420_24; diff --git a/libswscale/swscale_altivec_template.c b/libswscale/ppc/swscale_altivec_template.c index a008b966e8..0bf620bc83 100644 --- a/libswscale/swscale_altivec_template.c +++ b/libswscale/ppc/swscale_altivec_template.c @@ -6,18 +6,18 @@ * * This file is part of FFmpeg. * - * FFmpeg is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * 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 General Public License for more details. + * 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 General Public License - * along with FFmpeg; if not, write to the Free Software + * 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 */ diff --git a/libswscale/yuv2rgb_altivec.c b/libswscale/ppc/yuv2rgb_altivec.c index b3a87a0360..dc5894cda5 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 @@ -690,7 +690,7 @@ static int altivec_uyvy_rgb32 (SwsContext *c, So we just fall back to the C codes for this. */ -SwsFunc sws_yuv2rgb_init_altivec (SwsContext *c) +SwsFunc ff_yuv2rgb_init_altivec(SwsContext *c) { if (!(c->flags & SWS_CPU_CAPS_ALTIVEC)) return NULL; @@ -750,7 +750,7 @@ SwsFunc sws_yuv2rgb_init_altivec (SwsContext *c) return NULL; } -void sws_yuv2rgb_altivec_init_tables (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) { union { signed short tmp[8] __attribute__ ((aligned(16))); @@ -786,7 +786,7 @@ void sws_yuv2rgb_altivec_init_tables (SwsContext *c, const int inv_table[4],int void -altivec_yuv2packedX (SwsContext *c, +ff_yuv2packedX_altivec(SwsContext *c, int16_t *lumFilter, int16_t **lumSrc, int lumFilterSize, int16_t *chrFilter, int16_t **chrSrc, int chrFilterSize, uint8_t *dest, int dstW, int dstY) diff --git a/libswscale/rgb2rgb.c b/libswscale/rgb2rgb.c index ad69265c37..59b8e30a63 100644 --- a/libswscale/rgb2rgb.c +++ b/libswscale/rgb2rgb.c @@ -87,6 +87,19 @@ void (*yvu9_to_yuy2)(const uint8_t *src1, const uint8_t *src2, const uint8_t *sr long width, long height, long srcStride1, long srcStride2, long srcStride3, long dstStride); +void (*uyvytoyuv420)(uint8_t *ydst, uint8_t *udst, uint8_t *vdst, const uint8_t *src, + long width, long height, + long lumStride, long chromStride, long srcStride); +void (*uyvytoyuv422)(uint8_t *ydst, uint8_t *udst, uint8_t *vdst, const uint8_t *src, + long width, long height, + long lumStride, long chromStride, long srcStride); +void (*yuyvtoyuv420)(uint8_t *ydst, uint8_t *udst, uint8_t *vdst, const uint8_t *src, + long width, long height, + long lumStride, long chromStride, long srcStride); +void (*yuyvtoyuv422)(uint8_t *ydst, uint8_t *udst, uint8_t *vdst, const uint8_t *src, + long width, long height, + long lumStride, long chromStride, long srcStride); + #if ARCH_X86 && CONFIG_GPL DECLARE_ASM_CONST(8, uint64_t, mmx_null) = 0x0000000000000000ULL; diff --git a/libswscale/rgb2rgb.h b/libswscale/rgb2rgb.h index df912c8533..3850ef291d 100644 --- a/libswscale/rgb2rgb.h +++ b/libswscale/rgb2rgb.h @@ -142,6 +142,20 @@ extern void (*yvu9_to_yuy2)(const uint8_t *src1, const uint8_t *src2, const uint long srcStride1, long srcStride2, long srcStride3, long dstStride); + +extern void (*uyvytoyuv420)(uint8_t *ydst, uint8_t *udst, uint8_t *vdst, const uint8_t *src, + long width, long height, + long lumStride, long chromStride, long srcStride); +extern void (*uyvytoyuv422)(uint8_t *ydst, uint8_t *udst, uint8_t *vdst, const uint8_t *src, + long width, long height, + long lumStride, long chromStride, long srcStride); +extern void (*yuyvtoyuv420)(uint8_t *ydst, uint8_t *udst, uint8_t *vdst, const uint8_t *src, + long width, long height, + long lumStride, long chromStride, long srcStride); +extern void (*yuyvtoyuv422)(uint8_t *ydst, uint8_t *udst, uint8_t *vdst, const uint8_t *src, + long width, long height, + long lumStride, long chromStride, long srcStride); + void sws_rgb2rgb_init(int flags); #endif /* SWSCALE_RGB2RGB_H */ diff --git a/libswscale/rgb2rgb_template.c b/libswscale/rgb2rgb_template.c index b03f6424f7..09a57cab81 100644 --- a/libswscale/rgb2rgb_template.c +++ b/libswscale/rgb2rgb_template.c @@ -1339,7 +1339,7 @@ static inline void RENAME(rgb16to32)(const uint8_t *src, uint8_t *dst, long src_ static inline void RENAME(rgb32tobgr32)(const uint8_t *src, uint8_t *dst, long src_size) { - long idx = 15 - src_size; + x86_reg idx = 15 - src_size; const uint8_t *s = src-idx; uint8_t *d = dst-idx; #if HAVE_MMX @@ -1405,7 +1405,7 @@ static inline void RENAME(rgb24tobgr24)(const uint8_t *src, uint8_t *dst, long s { unsigned i; #if HAVE_MMX - long mmx_size= 23 - src_size; + x86_reg mmx_size= 23 - src_size; __asm__ volatile ( "test %%"REG_a", %%"REG_a" \n\t" "jns 2f \n\t" @@ -1476,7 +1476,7 @@ static inline void RENAME(yuvPlanartoyuy2)(const uint8_t *ysrc, const uint8_t *u long lumStride, long chromStride, long dstStride, long vertLumPerChroma) { long y; - const long chromWidth= width>>1; + const x86_reg chromWidth= width>>1; for (y=0; y<height; y++) { #if HAVE_MMX @@ -1628,7 +1628,7 @@ static inline void RENAME(yuvPlanartouyvy)(const uint8_t *ysrc, const uint8_t *u long lumStride, long chromStride, long dstStride, long vertLumPerChroma) { long y; - const long chromWidth= width>>1; + const x86_reg chromWidth= width>>1; for (y=0; y<height; y++) { #if HAVE_MMX @@ -1758,7 +1758,7 @@ static inline void RENAME(yuy2toyv12)(const uint8_t *src, uint8_t *ydst, uint8_t long lumStride, long chromStride, long srcStride) { long y; - const long chromWidth= width>>1; + const x86_reg chromWidth= width>>1; for (y=0; y<height; y+=2) { #if HAVE_MMX @@ -1900,7 +1900,7 @@ static inline void RENAME(planar2x)(const uint8_t *src, uint8_t *dst, long srcWi for (y=1; y<srcHeight; y++){ #if HAVE_MMX2 || HAVE_AMD3DNOW - const long mmxSize= srcWidth&~15; + const x86_reg mmxSize= srcWidth&~15; __asm__ volatile( "mov %4, %%"REG_a" \n\t" "1: \n\t" @@ -1944,7 +1944,7 @@ static inline void RENAME(planar2x)(const uint8_t *src, uint8_t *dst, long srcWi ); #else - const long mmxSize=1; + const x86_reg mmxSize=1; #endif dst[0 ]= (3*src[0] + src[srcStride])>>2; dst[dstStride]= ( src[0] + 3*src[srcStride])>>2; @@ -1996,7 +1996,7 @@ static inline void RENAME(uyvytoyv12)(const uint8_t *src, uint8_t *ydst, uint8_t long lumStride, long chromStride, long srcStride) { long y; - const long chromWidth= width>>1; + const x86_reg chromWidth= width>>1; for (y=0; y<height; y+=2) { #if HAVE_MMX @@ -2123,7 +2123,7 @@ static inline void RENAME(rgb24toyv12)(const uint8_t *src, uint8_t *ydst, uint8_ long lumStride, long chromStride, long srcStride) { long y; - const long chromWidth= width>>1; + const x86_reg chromWidth= width>>1; #if HAVE_MMX for (y=0; y<height-2; y+=2) { @@ -2196,7 +2196,7 @@ static inline void RENAME(rgb24toyv12)(const uint8_t *src, uint8_t *ydst, uint8_ MOVNTQ" %%mm0, (%1, %%"REG_a") \n\t" "add $8, %%"REG_a" \n\t" " js 1b \n\t" - : : "r" (src+width*3), "r" (ydst+width), "g" (-width) + : : "r" (src+width*3), "r" (ydst+width), "g" ((x86_reg)-width) : "%"REG_a, "%"REG_d ); ydst += lumStride; @@ -2440,7 +2440,7 @@ static void RENAME(interleaveBytes)(uint8_t *src1, uint8_t *src2, uint8_t *dest, "add $16, %%"REG_a" \n\t" "cmp %3, %%"REG_a" \n\t" " jb 1b \n\t" - ::"r"(dest), "r"(src1), "r"(src2), "r" (width-15) + ::"r"(dest), "r"(src1), "r"(src2), "r" ((x86_reg)width-15) : "memory", "%"REG_a"" ); #else @@ -2466,7 +2466,7 @@ static void RENAME(interleaveBytes)(uint8_t *src1, uint8_t *src2, uint8_t *dest, "add $16, %%"REG_a" \n\t" "cmp %3, %%"REG_a" \n\t" " jb 1b \n\t" - ::"r"(dest), "r"(src1), "r"(src2), "r" (width-15) + ::"r"(dest), "r"(src1), "r"(src2), "r" ((x86_reg)width-15) : "memory", "%"REG_a ); #endif @@ -2501,7 +2501,8 @@ static inline void RENAME(vu9_to_vu12)(const uint8_t *src1, const uint8_t *src2, long srcStride1, long srcStride2, long dstStride1, long dstStride2) { - long y,x,w,h; + x86_reg y; + long x,w,h; w=width/2; h=height/2; #if HAVE_MMX __asm__ volatile( @@ -2604,7 +2605,8 @@ static inline void RENAME(yvu9_to_yuy2)(const uint8_t *src1, const uint8_t *src2 long srcStride1, long srcStride2, long srcStride3, long dstStride) { - long y,x,w,h; + x86_reg x; + long y,w,h; w=width/2; h=height; for (y=0;y<h;y++){ const uint8_t* yp=src1+srcStride1*y; @@ -2689,6 +2691,354 @@ static inline void RENAME(yvu9_to_yuy2)(const uint8_t *src1, const uint8_t *src2 #endif } +static void RENAME(extract_even)(const uint8_t *src, uint8_t *dst, x86_reg count) +{ + dst += count; + src += 2*count; + count= - count; + +#if HAVE_MMX + if(count <= -16){ + count += 15; + __asm__ volatile( + "pcmpeqw %%mm7, %%mm7 \n\t" + "psrlw $8, %%mm7 \n\t" + "1: \n\t" + "movq -30(%1, %0, 2), %%mm0 \n\t" + "movq -22(%1, %0, 2), %%mm1 \n\t" + "movq -14(%1, %0, 2), %%mm2 \n\t" + "movq -6(%1, %0, 2), %%mm3 \n\t" + "pand %%mm7, %%mm0 \n\t" + "pand %%mm7, %%mm1 \n\t" + "pand %%mm7, %%mm2 \n\t" + "pand %%mm7, %%mm3 \n\t" + "packuswb %%mm1, %%mm0 \n\t" + "packuswb %%mm3, %%mm2 \n\t" + MOVNTQ" %%mm0,-15(%2, %0) \n\t" + MOVNTQ" %%mm2,- 7(%2, %0) \n\t" + "add $16, %0 \n\t" + " js 1b \n\t" + : "+r"(count) + : "r"(src), "r"(dst) + ); + count -= 15; + } +#endif + while(count<0){ + dst[count]= src[2*count]; + count++; + } +} + +static void RENAME(extract_even2)(const uint8_t *src, uint8_t *dst0, uint8_t *dst1, x86_reg count) +{ + dst0+= count; + dst1+= count; + src += 4*count; + count= - count; +#if HAVE_MMX + if(count <= -8){ + count += 7; + __asm__ volatile( + "pcmpeqw %%mm7, %%mm7 \n\t" + "psrlw $8, %%mm7 \n\t" + "1: \n\t" + "movq -28(%1, %0, 4), %%mm0 \n\t" + "movq -20(%1, %0, 4), %%mm1 \n\t" + "movq -12(%1, %0, 4), %%mm2 \n\t" + "movq -4(%1, %0, 4), %%mm3 \n\t" + "pand %%mm7, %%mm0 \n\t" + "pand %%mm7, %%mm1 \n\t" + "pand %%mm7, %%mm2 \n\t" + "pand %%mm7, %%mm3 \n\t" + "packuswb %%mm1, %%mm0 \n\t" + "packuswb %%mm3, %%mm2 \n\t" + "movq %%mm0, %%mm1 \n\t" + "movq %%mm2, %%mm3 \n\t" + "psrlw $8, %%mm0 \n\t" + "psrlw $8, %%mm2 \n\t" + "pand %%mm7, %%mm1 \n\t" + "pand %%mm7, %%mm3 \n\t" + "packuswb %%mm2, %%mm0 \n\t" + "packuswb %%mm3, %%mm1 \n\t" + MOVNTQ" %%mm0,- 7(%3, %0) \n\t" + MOVNTQ" %%mm1,- 7(%2, %0) \n\t" + "add $8, %0 \n\t" + " js 1b \n\t" + : "+r"(count) + : "r"(src), "r"(dst0), "r"(dst1) + ); + count -= 7; + } +#endif + while(count<0){ + dst0[count]= src[4*count+0]; + dst1[count]= src[4*count+2]; + count++; + } +} + +static void RENAME(extract_even2avg)(const uint8_t *src0, const uint8_t *src1, uint8_t *dst0, uint8_t *dst1, x86_reg count) +{ + dst0 += count; + dst1 += count; + src0 += 4*count; + src1 += 4*count; + count= - count; +#ifdef PAVGB + if(count <= -8){ + count += 7; + __asm__ volatile( + "pcmpeqw %%mm7, %%mm7 \n\t" + "psrlw $8, %%mm7 \n\t" + "1: \n\t" + "movq -28(%1, %0, 4), %%mm0 \n\t" + "movq -20(%1, %0, 4), %%mm1 \n\t" + "movq -12(%1, %0, 4), %%mm2 \n\t" + "movq -4(%1, %0, 4), %%mm3 \n\t" + PAVGB" -28(%2, %0, 4), %%mm0 \n\t" + PAVGB" -20(%2, %0, 4), %%mm1 \n\t" + PAVGB" -12(%2, %0, 4), %%mm2 \n\t" + PAVGB" - 4(%2, %0, 4), %%mm3 \n\t" + "pand %%mm7, %%mm0 \n\t" + "pand %%mm7, %%mm1 \n\t" + "pand %%mm7, %%mm2 \n\t" + "pand %%mm7, %%mm3 \n\t" + "packuswb %%mm1, %%mm0 \n\t" + "packuswb %%mm3, %%mm2 \n\t" + "movq %%mm0, %%mm1 \n\t" + "movq %%mm2, %%mm3 \n\t" + "psrlw $8, %%mm0 \n\t" + "psrlw $8, %%mm2 \n\t" + "pand %%mm7, %%mm1 \n\t" + "pand %%mm7, %%mm3 \n\t" + "packuswb %%mm2, %%mm0 \n\t" + "packuswb %%mm3, %%mm1 \n\t" + MOVNTQ" %%mm0,- 7(%4, %0) \n\t" + MOVNTQ" %%mm1,- 7(%3, %0) \n\t" + "add $8, %0 \n\t" + " js 1b \n\t" + : "+r"(count) + : "r"(src0), "r"(src1), "r"(dst0), "r"(dst1) + ); + count -= 7; + } +#endif + while(count<0){ + dst0[count]= (src0[4*count+0]+src1[4*count+0])>>1; + dst1[count]= (src0[4*count+2]+src1[4*count+2])>>1; + count++; + } +} + +static void RENAME(extract_odd2)(const uint8_t *src, uint8_t *dst0, uint8_t *dst1, x86_reg count) +{ + dst0+= count; + dst1+= count; + src += 4*count; + count= - count; +#if HAVE_MMX + if(count <= -8){ + count += 7; + __asm__ volatile( + "pcmpeqw %%mm7, %%mm7 \n\t" + "psrlw $8, %%mm7 \n\t" + "1: \n\t" + "movq -28(%1, %0, 4), %%mm0 \n\t" + "movq -20(%1, %0, 4), %%mm1 \n\t" + "movq -12(%1, %0, 4), %%mm2 \n\t" + "movq -4(%1, %0, 4), %%mm3 \n\t" + "psrlw $8, %%mm0 \n\t" + "psrlw $8, %%mm1 \n\t" + "psrlw $8, %%mm2 \n\t" + "psrlw $8, %%mm3 \n\t" + "packuswb %%mm1, %%mm0 \n\t" + "packuswb %%mm3, %%mm2 \n\t" + "movq %%mm0, %%mm1 \n\t" + "movq %%mm2, %%mm3 \n\t" + "psrlw $8, %%mm0 \n\t" + "psrlw $8, %%mm2 \n\t" + "pand %%mm7, %%mm1 \n\t" + "pand %%mm7, %%mm3 \n\t" + "packuswb %%mm2, %%mm0 \n\t" + "packuswb %%mm3, %%mm1 \n\t" + MOVNTQ" %%mm0,- 7(%3, %0) \n\t" + MOVNTQ" %%mm1,- 7(%2, %0) \n\t" + "add $8, %0 \n\t" + " js 1b \n\t" + : "+r"(count) |