From: <fla...@gm...> - 2007-12-14 21:29:59
|
# [node 17844fd6205baeeb6fe291a0b5fcf72d17e8a649 part 23] diff -r 65ca6da53fa384d225daafad7db0450bc5876326 -r 17844fd6205baeeb6fe291a0b5fcf72d17e8a649 contrib/ffmpeg/libswscale/rgb2rgb.c --- a/contrib/ffmpeg/libswscale/rgb2rgb.c Fri Dec 14 19:14:45 2007 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,665 +0,0 @@ -/* - * - * rgb2rgb.c, Software RGB to RGB convertor - * pluralize by Software PAL8 to RGB convertor - * Software YUV to YUV convertor - * Software YUV to RGB convertor - * Written by Nick Kurshev. - * palette & YUV & runtime CPU stuff by Michael (mic...@gm...) - * - * 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 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. - * - * You should have received a copy of the GNU General Public License - * along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - * - * the C code (not assembly, mmx, ...) of this file can be used - * under the LGPL license too - */ -#include <inttypes.h> -#include "config.h" -#include "rgb2rgb.h" -#include "swscale.h" -#include "swscale_internal.h" -#include "x86_cpu.h" -#include "bswap.h" -#ifdef USE_FASTMEMCPY -#include "libvo/fastmemcpy.h" -#endif - -#define FAST_BGR2YV12 // use 7 bit coeffs instead of 15bit - -void (*rgb24to32)(const uint8_t *src,uint8_t *dst,long src_size); -void (*rgb24to16)(const uint8_t *src,uint8_t *dst,long src_size); -void (*rgb24to15)(const uint8_t *src,uint8_t *dst,long src_size); -void (*rgb32to24)(const uint8_t *src,uint8_t *dst,long src_size); -void (*rgb32to16)(const uint8_t *src,uint8_t *dst,long src_size); -void (*rgb32to15)(const uint8_t *src,uint8_t *dst,long src_size); -void (*rgb15to16)(const uint8_t *src,uint8_t *dst,long src_size); -void (*rgb15to24)(const uint8_t *src,uint8_t *dst,long src_size); -void (*rgb15to32)(const uint8_t *src,uint8_t *dst,long src_size); -void (*rgb16to15)(const uint8_t *src,uint8_t *dst,long src_size); -void (*rgb16to24)(const uint8_t *src,uint8_t *dst,long src_size); -void (*rgb16to32)(const uint8_t *src,uint8_t *dst,long src_size); -//void (*rgb24tobgr32)(const uint8_t *src, uint8_t *dst, long src_size); -void (*rgb24tobgr24)(const uint8_t *src, uint8_t *dst, long src_size); -void (*rgb24tobgr16)(const uint8_t *src, uint8_t *dst, long src_size); -void (*rgb24tobgr15)(const uint8_t *src, uint8_t *dst, long src_size); -void (*rgb32tobgr32)(const uint8_t *src, uint8_t *dst, long src_size); -//void (*rgb32tobgr24)(const uint8_t *src, uint8_t *dst, long src_size); -void (*rgb32tobgr16)(const uint8_t *src, uint8_t *dst, long src_size); -void (*rgb32tobgr15)(const uint8_t *src, uint8_t *dst, long src_size); - -void (*yv12toyuy2)(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst, - long width, long height, - long lumStride, long chromStride, long dstStride); -void (*yv12touyvy)(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst, - long width, long height, - long lumStride, long chromStride, long dstStride); -void (*yuv422ptoyuy2)(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst, - long width, long height, - long lumStride, long chromStride, long dstStride); -void (*yuy2toyv12)(const uint8_t *src, uint8_t *ydst, uint8_t *udst, uint8_t *vdst, - long width, long height, - long lumStride, long chromStride, long srcStride); -void (*rgb24toyv12)(const uint8_t *src, uint8_t *ydst, uint8_t *udst, uint8_t *vdst, - long width, long height, - long lumStride, long chromStride, long srcStride); -void (*planar2x)(const uint8_t *src, uint8_t *dst, long width, long height, - long srcStride, long dstStride); -void (*interleaveBytes)(uint8_t *src1, uint8_t *src2, uint8_t *dst, - long width, long height, long src1Stride, - long src2Stride, long dstStride); -void (*vu9_to_vu12)(const uint8_t *src1, const uint8_t *src2, - uint8_t *dst1, uint8_t *dst2, - long width, long height, - long srcStride1, long srcStride2, - long dstStride1, long dstStride2); -void (*yvu9_to_yuy2)(const uint8_t *src1, const uint8_t *src2, const uint8_t *src3, - uint8_t *dst, - long width, long height, - long srcStride1, long srcStride2, - long srcStride3, long dstStride); - -#if defined(ARCH_X86) && defined(CONFIG_GPL) -static const uint64_t mmx_null __attribute__((aligned(8))) = 0x0000000000000000ULL; -static const uint64_t mmx_one __attribute__((aligned(8))) = 0xFFFFFFFFFFFFFFFFULL; -static const uint64_t mask32b attribute_used __attribute__((aligned(8))) = 0x000000FF000000FFULL; -static const uint64_t mask32g attribute_used __attribute__((aligned(8))) = 0x0000FF000000FF00ULL; -static const uint64_t mask32r attribute_used __attribute__((aligned(8))) = 0x00FF000000FF0000ULL; -static const uint64_t mask32 __attribute__((aligned(8))) = 0x00FFFFFF00FFFFFFULL; -static const uint64_t mask3216br __attribute__((aligned(8)))=0x00F800F800F800F8ULL; -static const uint64_t mask3216g __attribute__((aligned(8)))=0x0000FC000000FC00ULL; -static const uint64_t mask3215g __attribute__((aligned(8)))=0x0000F8000000F800ULL; -static const uint64_t mul3216 __attribute__((aligned(8))) = 0x2000000420000004ULL; -static const uint64_t mul3215 __attribute__((aligned(8))) = 0x2000000820000008ULL; -static const uint64_t mask24b attribute_used __attribute__((aligned(8))) = 0x00FF0000FF0000FFULL; -static const uint64_t mask24g attribute_used __attribute__((aligned(8))) = 0xFF0000FF0000FF00ULL; -static const uint64_t mask24r attribute_used __attribute__((aligned(8))) = 0x0000FF0000FF0000ULL; -static const uint64_t mask24l __attribute__((aligned(8))) = 0x0000000000FFFFFFULL; -static const uint64_t mask24h __attribute__((aligned(8))) = 0x0000FFFFFF000000ULL; -static const uint64_t mask24hh __attribute__((aligned(8))) = 0xffff000000000000ULL; -static const uint64_t mask24hhh __attribute__((aligned(8))) = 0xffffffff00000000ULL; -static const uint64_t mask24hhhh __attribute__((aligned(8))) = 0xffffffffffff0000ULL; -static const uint64_t mask15b __attribute__((aligned(8))) = 0x001F001F001F001FULL; /* 00000000 00011111 xxB */ -static const uint64_t mask15rg __attribute__((aligned(8))) = 0x7FE07FE07FE07FE0ULL; /* 01111111 11100000 RGx */ -static const uint64_t mask15s __attribute__((aligned(8))) = 0xFFE0FFE0FFE0FFE0ULL; -static const uint64_t mask15g __attribute__((aligned(8))) = 0x03E003E003E003E0ULL; -static const uint64_t mask15r __attribute__((aligned(8))) = 0x7C007C007C007C00ULL; -#define mask16b mask15b -static const uint64_t mask16g __attribute__((aligned(8))) = 0x07E007E007E007E0ULL; -static const uint64_t mask16r __attribute__((aligned(8))) = 0xF800F800F800F800ULL; -static const uint64_t red_16mask __attribute__((aligned(8))) = 0x0000f8000000f800ULL; -static const uint64_t green_16mask __attribute__((aligned(8)))= 0x000007e0000007e0ULL; -static const uint64_t blue_16mask __attribute__((aligned(8))) = 0x0000001f0000001fULL; [... 413 lines omitted ...] - *d++ = (bgr&0x7E0)>>3; - *d++ = (bgr&0x1F)<<3; - } -} - -void rgb16tobgr16(const uint8_t *src, uint8_t *dst, long src_size) -{ - long i; - long num_pixels = src_size >> 1; - - for(i=0; i<num_pixels; i++) - { - unsigned b,g,r; - register uint16_t rgb; - rgb = src[2*i]; - r = rgb&0x1F; - g = (rgb&0x7E0)>>5; - b = (rgb&0xF800)>>11; - dst[2*i] = (b&0x1F) | ((g&0x3F)<<5) | ((r&0x1F)<<11); - } -} - -void rgb16tobgr15(const uint8_t *src, uint8_t *dst, long src_size) -{ - long i; - long num_pixels = src_size >> 1; - - for(i=0; i<num_pixels; i++) - { - unsigned b,g,r; - register uint16_t rgb; - rgb = src[2*i]; - r = rgb&0x1F; - g = (rgb&0x7E0)>>5; - b = (rgb&0xF800)>>11; - dst[2*i] = (b&0x1F) | ((g&0x1F)<<5) | ((r&0x1F)<<10); - } -} - -void rgb15tobgr32(const uint8_t *src, uint8_t *dst, long src_size) -{ - const uint16_t *end; - uint8_t *d = (uint8_t *)dst; - const uint16_t *s = (const uint16_t *)src; - end = s + src_size/2; - while(s < end) - { - register uint16_t bgr; - bgr = *s++; - #ifdef WORDS_BIGENDIAN - *d++ = 0; - *d++ = (bgr&0x1F)<<3; - *d++ = (bgr&0x3E0)>>2; - *d++ = (bgr&0x7C00)>>7; - #else - *d++ = (bgr&0x7C00)>>7; - *d++ = (bgr&0x3E0)>>2; - *d++ = (bgr&0x1F)<<3; - *d++ = 0; - #endif - } -} - -void rgb15tobgr24(const uint8_t *src, uint8_t *dst, long src_size) -{ - const uint16_t *end; - uint8_t *d = (uint8_t *)dst; - const uint16_t *s = (uint16_t *)src; - end = s + src_size/2; - while(s < end) - { - register uint16_t bgr; - bgr = *s++; - *d++ = (bgr&0x7C00)>>7; - *d++ = (bgr&0x3E0)>>2; - *d++ = (bgr&0x1F)<<3; - } -} - -void rgb15tobgr16(const uint8_t *src, uint8_t *dst, long src_size) -{ - long i; - long num_pixels = src_size >> 1; - - for(i=0; i<num_pixels; i++) - { - unsigned b,g,r; - register uint16_t rgb; - rgb = src[2*i]; - r = rgb&0x1F; - g = (rgb&0x3E0)>>5; - b = (rgb&0x7C00)>>10; - dst[2*i] = (b&0x1F) | ((g&0x3F)<<5) | ((r&0x1F)<<11); - } -} - -void rgb15tobgr15(const uint8_t *src, uint8_t *dst, long src_size) -{ - long i; - long num_pixels = src_size >> 1; - - for(i=0; i<num_pixels; i++) - { - unsigned b,g,r; - register uint16_t rgb; - rgb = src[2*i]; - r = rgb&0x1F; - g = (rgb&0x3E0)>>5; - b = (rgb&0x7C00)>>10; - dst[2*i] = (b&0x1F) | ((g&0x1F)<<5) | ((r&0x1F)<<10); - } -} - -void rgb8tobgr8(const uint8_t *src, uint8_t *dst, long src_size) -{ - long i; - long num_pixels = src_size; - for(i=0; i<num_pixels; i++) - { - unsigned b,g,r; - register uint8_t rgb; - rgb = src[i]; - r = (rgb&0x07); - g = (rgb&0x38)>>3; - b = (rgb&0xC0)>>6; - dst[i] = ((b<<1)&0x07) | ((g&0x07)<<3) | ((r&0x03)<<6); - } -} diff -r 65ca6da53fa384d225daafad7db0450bc5876326 -r 17844fd6205baeeb6fe291a0b5fcf72d17e8a649 contrib/ffmpeg/libswscale/rgb2rgb.h --- a/contrib/ffmpeg/libswscale/rgb2rgb.h Fri Dec 14 19:14:45 2007 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,147 +0,0 @@ -/* - * - * rgb2rgb.h, Software RGB to RGB convertor - * pluralize by Software PAL8 to RGB convertor - * Software YUV to YUV convertor - * Software YUV to RGB convertor - * Written by Nick Kurshev. - * palette & YUV & runtime CPU stuff by Michael (mic...@gm...) - * - * 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 St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef RGB2RGB_INCLUDED -#define RGB2RGB_INCLUDED - -// Note: do not fix the dependence on stdio.h - -/* A full collection of rgb to rgb(bgr) convertors */ -extern void (*rgb24to32)(const uint8_t *src,uint8_t *dst,long src_size); -extern void (*rgb24to16)(const uint8_t *src,uint8_t *dst,long src_size); -extern void (*rgb24to15)(const uint8_t *src,uint8_t *dst,long src_size); -extern void (*rgb32to24)(const uint8_t *src,uint8_t *dst,long src_size); -extern void (*rgb32to16)(const uint8_t *src,uint8_t *dst,long src_size); -extern void (*rgb32to15)(const uint8_t *src,uint8_t *dst,long src_size); -extern void (*rgb15to16)(const uint8_t *src,uint8_t *dst,long src_size); -extern void (*rgb15to24)(const uint8_t *src,uint8_t *dst,long src_size); -extern void (*rgb15to32)(const uint8_t *src,uint8_t *dst,long src_size); -extern void (*rgb16to15)(const uint8_t *src,uint8_t *dst,long src_size); -extern void (*rgb16to24)(const uint8_t *src,uint8_t *dst,long src_size); -extern void (*rgb16to32)(const uint8_t *src,uint8_t *dst,long src_size); -extern void (*rgb24tobgr24)(const uint8_t *src, uint8_t *dst, long src_size); -extern void (*rgb24tobgr16)(const uint8_t *src, uint8_t *dst, long src_size); -extern void (*rgb24tobgr15)(const uint8_t *src, uint8_t *dst, long src_size); -extern void (*rgb32tobgr32)(const uint8_t *src, uint8_t *dst, long src_size); -extern void (*rgb32tobgr16)(const uint8_t *src, uint8_t *dst, long src_size); -extern void (*rgb32tobgr15)(const uint8_t *src, uint8_t *dst, long src_size); - -extern void rgb24tobgr32(const uint8_t *src, uint8_t *dst, long src_size); -extern void rgb32tobgr24(const uint8_t *src, uint8_t *dst, long src_size); -extern void rgb16tobgr32(const uint8_t *src, uint8_t *dst, long src_size); -extern void rgb16tobgr24(const uint8_t *src, uint8_t *dst, long src_size); -extern void rgb16tobgr16(const uint8_t *src, uint8_t *dst, long src_size); -extern void rgb16tobgr15(const uint8_t *src, uint8_t *dst, long src_size); -extern void rgb15tobgr32(const uint8_t *src, uint8_t *dst, long src_size); -extern void rgb15tobgr24(const uint8_t *src, uint8_t *dst, long src_size); -extern void rgb15tobgr16(const uint8_t *src, uint8_t *dst, long src_size); -extern void rgb15tobgr15(const uint8_t *src, uint8_t *dst, long src_size); -extern void rgb8tobgr8(const uint8_t *src, uint8_t *dst, long src_size); - - -extern void palette8torgb32(const uint8_t *src, uint8_t *dst, long num_pixels, const uint8_t *palette); -extern void palette8tobgr32(const uint8_t *src, uint8_t *dst, long num_pixels, const uint8_t *palette); -extern void palette8torgb24(const uint8_t *src, uint8_t *dst, long num_pixels, const uint8_t *palette); -extern void palette8tobgr24(const uint8_t *src, uint8_t *dst, long num_pixels, const uint8_t *palette); -extern void palette8torgb16(const uint8_t *src, uint8_t *dst, long num_pixels, const uint8_t *palette); -extern void palette8tobgr16(const uint8_t *src, uint8_t *dst, long num_pixels, const uint8_t *palette); -extern void palette8torgb15(const uint8_t *src, uint8_t *dst, long num_pixels, const uint8_t *palette); -extern void palette8tobgr15(const uint8_t *src, uint8_t *dst, long num_pixels, const uint8_t *palette); - -/** - * - * height should be a multiple of 2 and width should be a multiple of 16 (if this is a - * problem for anyone then tell me, and ill fix it) - * chrominance data is only taken from every secound line others are ignored FIXME write HQ version - */ -//void uyvytoyv12(const uint8_t *src, uint8_t *ydst, uint8_t *udst, uint8_t *vdst, - -/** - * - * height should be a multiple of 2 and width should be a multiple of 16 (if this is a - * problem for anyone then tell me, and ill fix it) - */ -extern void (*yv12toyuy2)(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst, - long width, long height, - long lumStride, long chromStride, long dstStride); - -/** - * - * width should be a multiple of 16 - */ -extern void (*yuv422ptoyuy2)(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst, - long width, long height, - long lumStride, long chromStride, long dstStride); - -/** - * - * height should be a multiple of 2 and width should be a multiple of 16 (if this is a - * problem for anyone then tell me, and ill fix it) - */ -extern void (*yuy2toyv12)(const uint8_t *src, uint8_t *ydst, uint8_t *udst, uint8_t *vdst, - long width, long height, - long lumStride, long chromStride, long srcStride); - -/** - * - * height should be a multiple of 2 and width should be a multiple of 16 (if this is a - * problem for anyone then tell me, and ill fix it) - */ -extern void (*yv12touyvy)(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst, - long width, long height, - long lumStride, long chromStride, long dstStride); - -/** - * - * height should be a multiple of 2 and width should be a multiple of 2 (if this is a - * problem for anyone then tell me, and ill fix it) - * chrominance data is only taken from every secound line others are ignored FIXME write HQ version - */ -extern void (*rgb24toyv12)(const uint8_t *src, uint8_t *ydst, uint8_t *udst, uint8_t *vdst, - long width, long height, - long lumStride, long chromStride, long srcStride); -extern void (*planar2x)(const uint8_t *src, uint8_t *dst, long width, long height, - long srcStride, long dstStride); - -extern void (*interleaveBytes)(uint8_t *src1, uint8_t *src2, uint8_t *dst, - long width, long height, long src1Stride, - long src2Stride, long dstStride); - -extern void (*vu9_to_vu12)(const uint8_t *src1, const uint8_t *src2, - uint8_t *dst1, uint8_t *dst2, - long width, long height, - long srcStride1, long srcStride2, - long dstStride1, long dstStride2); - -extern void (*yvu9_to_yuy2)(const uint8_t *src1, const uint8_t *src2, const uint8_t *src3, - uint8_t *dst, - long width, long height, - long srcStride1, long srcStride2, - long srcStride3, long dstStride); - -void sws_rgb2rgb_init(int flags); - -#endif diff -r 65ca6da53fa384d225daafad7db0450bc5876326 -r 17844fd6205baeeb6fe291a0b5fcf72d17e8a649 contrib/ffmpeg/libswscale/rgb2rgb_template.c --- a/contrib/ffmpeg/libswscale/rgb2rgb_template.c Fri Dec 14 19:14:45 2007 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,2688 +0,0 @@ -/* - * - * rgb2rgb.c, Software RGB to RGB convertor - * pluralize by Software PAL8 to RGB convertor - * Software YUV to YUV convertor - * Software YUV to RGB convertor - * Written by Nick Kurshev. - * palette & YUV & runtime CPU stuff by Michael (mic...@gm...) - * lot of big-endian byteorder fixes by Alex Beregszaszi - * - * 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 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. - * - * You should have received a copy of the GNU General Public License - * along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - * - * the C code (not assembly, mmx, ...) of this file can be used - * under the LGPL license too - */ - -#include <stddef.h> -#include <inttypes.h> /* for __WORDSIZE */ - -#ifndef __WORDSIZE -// #warning You have misconfigured system and probably will lose performance! -#define __WORDSIZE MP_WORDSIZE -#endif - -#undef PREFETCH -#undef MOVNTQ -#undef EMMS -#undef SFENCE -#undef MMREG_SIZE -#undef PREFETCHW -#undef PAVGB - -#ifdef HAVE_SSE2 -#define MMREG_SIZE 16 -#else -#define MMREG_SIZE 8 -#endif - -#ifdef HAVE_3DNOW -#define PREFETCH "prefetch" -#define PREFETCHW "prefetchw" -#define PAVGB "pavgusb" -#elif defined ( HAVE_MMX2 ) -#define PREFETCH "prefetchnta" -#define PREFETCHW "prefetcht0" -#define PAVGB "pavgb" -#else -#ifdef __APPLE__ -#define PREFETCH "#" -#define PREFETCHW "#" -#else -#define PREFETCH " # nop" -#define PREFETCHW " # nop" -#endif -#endif - -#ifdef HAVE_3DNOW -/* On K6 femms is faster of emms. On K7 femms is directly mapped on emms. */ -#define EMMS "femms" -#else -#define EMMS "emms" -#endif - -#ifdef HAVE_MMX2 -#define MOVNTQ "movntq" -#define SFENCE "sfence" -#else -#define MOVNTQ "movq" -#define SFENCE " # nop" -#endif - -static inline void RENAME(rgb24to32)(const uint8_t *src,uint8_t *dst,long src_size) -{ - uint8_t *dest = dst; - const uint8_t *s = src; - const uint8_t *end; -#ifdef HAVE_MMX - const uint8_t *mm_end; -#endif - end = s + src_size; -#ifdef HAVE_MMX - __asm __volatile(PREFETCH" %0"::"m"(*s):"memory"); - mm_end = end - 23; - __asm __volatile("movq %0, %%mm7"::"m"(mask32):"memory"); - while(s < mm_end) - { - __asm __volatile( - PREFETCH" 32%1\n\t" - "movd %1, %%mm0\n\t" - "punpckldq 3%1, %%mm0\n\t" - "movd 6%1, %%mm1\n\t" - "punpckldq 9%1, %%mm1\n\t" - "movd 12%1, %%mm2\n\t" - "punpckldq 15%1, %%mm2\n\t" - "movd 18%1, %%mm3\n\t" - "punpckldq 21%1, %%mm3\n\t" - "pand %%mm7, %%mm0\n\t" - "pand %%mm7, %%mm1\n\t" - "pand %%mm7, %%mm2\n\t" - "pand %%mm7, %%mm3\n\t" - MOVNTQ" %%mm0, %0\n\t" - MOVNTQ" %%mm1, 8%0\n\t" - MOVNTQ" %%mm2, 16%0\n\t" - MOVNTQ" %%mm3, 24%0" - :"=m"(*dest) - :"m"(*s) - :"memory"); - dest += 32; - s += 24; - } [... 2436 lines omitted ...] - "movq 16%1, %%mm4\n\t" - "movq 24%1, %%mm6\n\t" - "movq %%mm0, %%mm1\n\t" - "movq %%mm2, %%mm3\n\t" - "movq %%mm4, %%mm5\n\t" - "movq %%mm6, %%mm7\n\t" - "punpcklbw %%mm0, %%mm0\n\t" - "punpckhbw %%mm1, %%mm1\n\t" - "punpcklbw %%mm2, %%mm2\n\t" - "punpckhbw %%mm3, %%mm3\n\t" - "punpcklbw %%mm4, %%mm4\n\t" - "punpckhbw %%mm5, %%mm5\n\t" - "punpcklbw %%mm6, %%mm6\n\t" - "punpckhbw %%mm7, %%mm7\n\t" - MOVNTQ" %%mm0, %0\n\t" - MOVNTQ" %%mm1, 8%0\n\t" - MOVNTQ" %%mm2, 16%0\n\t" - MOVNTQ" %%mm3, 24%0\n\t" - MOVNTQ" %%mm4, 32%0\n\t" - MOVNTQ" %%mm5, 40%0\n\t" - MOVNTQ" %%mm6, 48%0\n\t" - MOVNTQ" %%mm7, 56%0" - :"=m"(d[2*x]) - :"m"(s2[x]) - :"memory"); - } -#endif - for(;x<w;x++) d[2*x]=d[2*x+1]=s2[x]; - } -#ifdef HAVE_MMX - asm( - EMMS" \n\t" - SFENCE" \n\t" - ::: "memory" - ); -#endif -} - -static inline void RENAME(yvu9_to_yuy2)(const uint8_t *src1, const uint8_t *src2, const uint8_t *src3, - uint8_t *dst, - long width, long height, - long srcStride1, long srcStride2, - long srcStride3, long dstStride) -{ - long y,x,w,h; - w=width/2; h=height; - for(y=0;y<h;y++){ - const uint8_t* yp=src1+srcStride1*y; - const uint8_t* up=src2+srcStride2*(y>>2); - const uint8_t* vp=src3+srcStride3*(y>>2); - uint8_t* d=dst+dstStride*y; - x=0; -#ifdef HAVE_MMX - for(;x<w-7;x+=8) - { - asm volatile( - PREFETCH" 32(%1, %0)\n\t" - PREFETCH" 32(%2, %0)\n\t" - PREFETCH" 32(%3, %0)\n\t" - "movq (%1, %0, 4), %%mm0\n\t" /* Y0Y1Y2Y3Y4Y5Y6Y7 */ - "movq (%2, %0), %%mm1\n\t" /* U0U1U2U3U4U5U6U7 */ - "movq (%3, %0), %%mm2\n\t" /* V0V1V2V3V4V5V6V7 */ - "movq %%mm0, %%mm3\n\t" /* Y0Y1Y2Y3Y4Y5Y6Y7 */ - "movq %%mm1, %%mm4\n\t" /* U0U1U2U3U4U5U6U7 */ - "movq %%mm2, %%mm5\n\t" /* V0V1V2V3V4V5V6V7 */ - "punpcklbw %%mm1, %%mm1\n\t" /* U0U0 U1U1 U2U2 U3U3 */ - "punpcklbw %%mm2, %%mm2\n\t" /* V0V0 V1V1 V2V2 V3V3 */ - "punpckhbw %%mm4, %%mm4\n\t" /* U4U4 U5U5 U6U6 U7U7 */ - "punpckhbw %%mm5, %%mm5\n\t" /* V4V4 V5V5 V6V6 V7V7 */ - - "movq %%mm1, %%mm6\n\t" - "punpcklbw %%mm2, %%mm1\n\t" /* U0V0 U0V0 U1V1 U1V1*/ - "punpcklbw %%mm1, %%mm0\n\t" /* Y0U0 Y1V0 Y2U0 Y3V0*/ - "punpckhbw %%mm1, %%mm3\n\t" /* Y4U1 Y5V1 Y6U1 Y7V1*/ - MOVNTQ" %%mm0, (%4, %0, 8)\n\t" - MOVNTQ" %%mm3, 8(%4, %0, 8)\n\t" - - "punpckhbw %%mm2, %%mm6\n\t" /* U2V2 U2V2 U3V3 U3V3*/ - "movq 8(%1, %0, 4), %%mm0\n\t" - "movq %%mm0, %%mm3\n\t" - "punpcklbw %%mm6, %%mm0\n\t" /* Y U2 Y V2 Y U2 Y V2*/ - "punpckhbw %%mm6, %%mm3\n\t" /* Y U3 Y V3 Y U3 Y V3*/ - MOVNTQ" %%mm0, 16(%4, %0, 8)\n\t" - MOVNTQ" %%mm3, 24(%4, %0, 8)\n\t" - - "movq %%mm4, %%mm6\n\t" - "movq 16(%1, %0, 4), %%mm0\n\t" - "movq %%mm0, %%mm3\n\t" - "punpcklbw %%mm5, %%mm4\n\t" - "punpcklbw %%mm4, %%mm0\n\t" /* Y U4 Y V4 Y U4 Y V4*/ - "punpckhbw %%mm4, %%mm3\n\t" /* Y U5 Y V5 Y U5 Y V5*/ - MOVNTQ" %%mm0, 32(%4, %0, 8)\n\t" - MOVNTQ" %%mm3, 40(%4, %0, 8)\n\t" - - "punpckhbw %%mm5, %%mm6\n\t" - "movq 24(%1, %0, 4), %%mm0\n\t" - "movq %%mm0, %%mm3\n\t" - "punpcklbw %%mm6, %%mm0\n\t" /* Y U6 Y V6 Y U6 Y V6*/ - "punpckhbw %%mm6, %%mm3\n\t" /* Y U7 Y V7 Y U7 Y V7*/ - MOVNTQ" %%mm0, 48(%4, %0, 8)\n\t" - MOVNTQ" %%mm3, 56(%4, %0, 8)\n\t" - - : "+r" (x) - : "r"(yp), "r" (up), "r"(vp), "r"(d) - :"memory"); - } -#endif - for(; x<w; x++) - { - const long x2= x<<2; - d[8*x+0]=yp[x2]; - d[8*x+1]=up[x]; - d[8*x+2]=yp[x2+1]; - d[8*x+3]=vp[x]; - d[8*x+4]=yp[x2+2]; - d[8*x+5]=up[x]; - d[8*x+6]=yp[x2+3]; - d[8*x+7]=vp[x]; - } - } -#ifdef HAVE_MMX - asm( - EMMS" \n\t" - SFENCE" \n\t" - ::: "memory" - ); -#endif -} diff -r 65ca6da53fa384d225daafad7db0450bc5876326 -r 17844fd6205baeeb6fe291a0b5fcf72d17e8a649 contrib/ffmpeg/libswscale/swscale-example.c --- a/contrib/ffmpeg/libswscale/swscale-example.c Fri Dec 14 19:14:45 2007 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,229 +0,0 @@ -/* - * Copyright (C) 2003 Michael Niedermayer <mic...@gm...> - * - * 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 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. - * - * You should have received a copy of the GNU General Public License - * along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <inttypes.h> -#include <stdarg.h> - -#undef HAVE_AV_CONFIG_H -#include "avutil.h" -#include "swscale.h" -#include "swscale_internal.h" -#include "rgb2rgb.h" - -static uint64_t getSSD(uint8_t *src1, uint8_t *src2, int stride1, int stride2, int w, int h){ - int x,y; - uint64_t ssd=0; - -//printf("%d %d\n", w, h); - - for(y=0; y<h; y++){ - for(x=0; x<w; x++){ - int d= src1[x + y*stride1] - src2[x + y*stride2]; - ssd+= d*d; -//printf("%d", abs(src1[x + y*stride1] - src2[x + y*stride2])/26 ); - } -//printf("\n"); - } - return ssd; -} - -// test by ref -> src -> dst -> out & compare out against ref -// ref & out are YV12 -static int doTest(uint8_t *ref[3], int refStride[3], int w, int h, int srcFormat, int dstFormat, - int srcW, int srcH, int dstW, int dstH, int flags){ - uint8_t *src[3]; - uint8_t *dst[3]; - uint8_t *out[3]; - int srcStride[3], dstStride[3]; - int i; - uint64_t ssdY, ssdU, ssdV; - struct SwsContext *srcContext, *dstContext, *outContext; - int res; - - res = 0; - for(i=0; i<3; i++){ - // avoid stride % bpp != 0 - if(srcFormat==PIX_FMT_RGB24 || srcFormat==PIX_FMT_BGR24) - srcStride[i]= srcW*3; - else - srcStride[i]= srcW*4; - - if(dstFormat==PIX_FMT_RGB24 || dstFormat==PIX_FMT_BGR24) - dstStride[i]= dstW*3; - else - dstStride[i]= dstW*4; - - src[i]= (uint8_t*) malloc(srcStride[i]*srcH); - dst[i]= (uint8_t*) malloc(dstStride[i]*dstH); - out[i]= (uint8_t*) malloc(refStride[i]*h); - if ((src[i] == NULL) || (dst[i] == NULL) || (out[i] == NULL)) { - perror("Malloc"); - res = -1; - - goto end; - } - } - - dstContext = outContext = NULL; - srcContext= sws_getContext(w, h, PIX_FMT_YUV420P, srcW, srcH, srcFormat, flags, NULL, NULL, NULL); - if (srcContext == NULL) { - fprintf(stderr, "Failed to get %s ---> %s\n", - sws_format_name(PIX_FMT_YUV420P), - sws_format_name(srcFormat)); - res = -1; - - goto end; - } - dstContext= sws_getContext(srcW, srcH, srcFormat, dstW, dstH, dstFormat, flags, NULL, NULL, NULL); - if (dstContext == NULL) { - fprintf(stderr, "Failed to get %s ---> %s\n", - sws_format_name(srcFormat), - sws_format_name(dstFormat)); - res = -1; - - goto end; - } - outContext= sws_getContext(dstW, dstH, dstFormat, w, h, PIX_FMT_YUV420P, flags, NULL, NULL, NULL); - if (outContext == NULL) { - fprintf(stderr, "Failed to get %s ---> %s\n", - sws_format_name(dstFormat), - sws_format_name(PIX_FMT_YUV420P)); - res = -1; - - goto end; - } -// printf("test %X %X %X -> %X %X %X\n", (int)ref[0], (int)ref[1], (int)ref[2], -// (int)src[0], (int)src[1], (int)src[2]); - - sws_scale(srcContext, ref, refStride, 0, h , src, srcStride); - sws_scale(dstContext, src, srcStride, 0, srcH, dst, dstStride); - sws_scale(outContext, dst, dstStride, 0, dstH, out, refStride); - -#if defined(ARCH_X86) - asm volatile ("emms\n\t"); -#endif - - ssdY= getSSD(ref[0], out[0], refStride[0], refStride[0], w, h); - ssdU= getSSD(ref[1], out[1], refStride[1], refStride[1], (w+1)>>1, (h+1)>>1); - ssdV= getSSD(ref[2], out[2], refStride[2], refStride[2], (w+1)>>1, (h+1)>>1); - - if(srcFormat == PIX_FMT_GRAY8 || dstFormat==PIX_FMT_GRAY8) ssdU=ssdV=0; //FIXME check that output is really gray - - ssdY/= w*h; - ssdU/= w*h/4; - ssdV/= w*h/4; - - if(ssdY>100 || ssdU>100 || ssdV>100){ - printf(" %s %dx%d -> %s %4dx%4d flags=%2d SSD=%5lld,%5lld,%5lld\n", - sws_format_name(srcFormat), srcW, srcH, - sws_format_name(dstFormat), dstW, dstH, - flags, - ssdY, ssdU, ssdV); - } - - end: - - sws_freeContext(srcContext); - sws_freeContext(dstContext); - sws_freeContext(outContext); - - for(i=0; i<3; i++){ - free(src[i]); - free(dst[i]); - free(out[i]); - } - - return res; -} - -void fast_memcpy(void *a, void *b, int s){ //FIXME - memcpy(a, b, s); -} - -static void selfTest(uint8_t *src[3], int stride[3], int w, int h){ - enum PixelFormat srcFormat, dstFormat; - int srcW, srcH, dstW, dstH; - int flags; - - for(srcFormat = 0; srcFormat < PIX_FMT_NB; srcFormat++) { - for(dstFormat = 0; dstFormat < PIX_FMT_NB; dstFormat++) { - printf("%s -> %s\n", - sws_format_name(srcFormat), - sws_format_name(dstFormat)); - - srcW= w; - srcH= h; - for(dstW=w - w/3; dstW<= 4*w/3; dstW+= w/3){ - for(dstH=h - h/3; dstH<= 4*h/3; dstH+= h/3){ - for(flags=1; flags<33; flags*=2) { - int res; - - res = doTest(src, stride, w, h, srcFormat, dstFormat, - srcW, srcH, dstW, dstH, flags); - if (res < 0) { - dstW = 4 * w / 3; - dstH = 4 * h / 3; - flags = 33; - } - } - } - } - } - } -} - -#define W 96 -#define H 96 - -int main(int argc, char **argv){ - uint8_t rgb_data[W*H*4]; - uint8_t *rgb_src[3]= {rgb_data, NULL, NULL}; - int rgb_stride[3]={4*W, 0, 0}; - uint8_t data[3][W*H]; - uint8_t *src[3]= {data[0], data[1], data[2]}; - int stride[3]={W, W, W}; - int x, y; - struct SwsContext *sws; - - sws= sws_getContext(W/12, H/12, PIX_FMT_RGB32, W, H, PIX_FMT_YUV420P, 2, NULL, NULL, NULL); - - for(y=0; y<H; y++){ - for(x=0; x<W*4; x++){ - rgb_data[ x + y*4*W]= random(); - } - } -#if defined(ARCH_X86) - sws_rgb2rgb_init(SWS_CPU_CAPS_MMX*0); -#else - sws_rgb2rgb_init(0); -#endif - sws_scale(sws, rgb_src, rgb_stride, 0, H , src, stride); - -#if defined(ARCH_X86) - asm volatile ("emms\n\t"); -#endif - - selfTest(src, stride, W, H); - - return 123; -} diff -r 65ca6da53fa384d225daafad7db0450bc5876326 -r 17844fd6205baeeb6fe291a0b5fcf72d17e8a649 contrib/ffmpeg/libswscale/swscale.c --- a/contrib/ffmpeg/libswscale/swscale.c Fri Dec 14 19:14:45 2007 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,2868 +0,0 @@ -/* - * Copyright (C) 2001-2003 Michael Niedermayer <mic...@gm...> - * - * 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 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. - * - * You should have received a copy of the GNU General Public License - * along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - * - * the C code (not assembly, mmx, ...) of this file can be used - * under the LGPL license too - */ - -/* - supported Input formats: YV12, I420/IYUV, YUY2, UYVY, BGR32, BGR24, BGR16, BGR15, RGB32, RGB24, Y8/Y800, YVU9/IF09, PAL8 - supported output formats: YV12, I420/IYUV, YUY2, UYVY, {BGR,RGB}{1,4,8,15,16,24,32}, Y8/Y800, YVU9/IF09 - {BGR,RGB}{1,4,8,15,16} support dithering - - unscaled special converters (YV12=I420=IYUV, Y800=Y8) - YV12 -> {BGR,RGB}{1,4,8,15,16,24,32} - x -> x - YUV9 -> YV12 - YUV9/YV12 -> Y800 - Y800 -> YUV9/YV12 - BGR24 -> BGR32 & RGB24 -> RGB32 - BGR32 -> BGR24 & RGB32 -> RGB24 - BGR15 -> BGR16 -*/ - -/* -tested special converters (most are tested actually but i didnt write it down ...) - YV12 -> BGR16 - YV12 -> YV12 - BGR15 -> BGR16 - BGR16 -> BGR16 - YVU9 -> YV12 - -untested special converters - YV12/I420 -> BGR15/BGR24/BGR32 (its the yuv2rgb stuff, so it should be ok) - YV12/I420 -> YV12/I420 - YUY2/BGR15/BGR24/BGR32/RGB24/RGB32 -> same format - BGR24 -> BGR32 & RGB24 -> RGB32 - BGR32 -> BGR24 & RGB32 -> RGB24 - BGR24 -> YV12 -*/ - -#include <inttypes.h> -#include <string.h> -#include <math.h> -#include <stdio.h> -#include <unistd.h> -#include "config.h" -#include <assert.h> -#ifdef HAVE_SYS_MMAN_H -#include <sys/mman.h> -#if defined(MAP_ANON) && !defined(MAP_ANONYMOUS) -#define MAP_ANONYMOUS MAP_ANON -#endif -#endif -#include "swscale.h" -#include "swscale_internal.h" -#include "x86_cpu.h" -#include "bswap.h" -#include "rgb2rgb.h" -#ifdef USE_FASTMEMCPY -#include "libvo/fastmemcpy.h" -#endif - -#undef MOVNTQ -#undef PAVGB - -//#undef HAVE_MMX2 -//#define HAVE_3DNOW -//#undef HAVE_MMX -//#undef ARCH_X86 -//#define WORDS_BIGENDIAN -#define DITHER1XBPP - -#define FAST_BGR2YV12 // use 7 bit coeffs instead of 15bit - -#define RET 0xC3 //near return opcode for X86 - -#ifdef MP_DEBUG -#define ASSERT(x) assert(x); -#else -#define ASSERT(x) ; -#endif - -#ifdef M_PI -#define PI M_PI -#else -#define PI 3.14159265358979323846 -#endif - -#define isSupportedIn(x) ((x)==PIX_FMT_YUV420P || (x)==PIX_FMT_YUYV422 || (x)==PIX_FMT_UYVY422\ - || (x)==PIX_FMT_RGB32|| (x)==PIX_FMT_BGR24|| (x)==PIX_FMT_BGR565|| (x)==PIX_FMT_BGR555\ - || (x)==PIX_FMT_BGR32|| (x)==PIX_FMT_RGB24|| (x)==PIX_FMT_RGB565|| (x)==PIX_FMT_RGB555\ - || (x)==PIX_FMT_GRAY8 || (x)==PIX_FMT_YUV410P\ - || (x)==PIX_FMT_GRAY16BE || (x)==PIX_FMT_GRAY16LE\ - || (x)==PIX_FMT_YUV444P || (x)==PIX_FMT_YUV422P || (x)==PIX_FMT_YUV411P\ - || (x)==PIX_FMT_PAL8 || (x)==PIX_FMT_BGR8 || (x)==PIX_FMT_RGB8\ - || (x)==PIX_FMT_BGR4_BYTE || (x)==PIX_FMT_RGB4_BYTE) -#define isSupportedOut(x) ((x)==PIX_FMT_YUV420P || (x)==PIX_FMT_YUYV422 || (x)==PIX_FMT_UYVY422\ - || (x)==PIX_FMT_YUV444P || (x)==PIX_FMT_YUV422P || (x)==PIX_FMT_YUV411P\ - || isRGB(x) || isBGR(x)\ - || (x)==PIX_FMT_NV12 || (x)==PIX_FMT_NV21\ - || (x)==PIX_FMT_GRAY16BE || (x)==PIX_FMT_GRAY16LE\ - || (x)==PIX_FMT_GRAY8 || (x)==PIX_FMT_YUV410P) -#define isPacked(x) ((x)==PIX_FMT_PAL8 || (x)==PIX_FMT_YUYV422 ||\ - (x)==PIX_FMT_UYVY422 || isRGB(x) || isBGR(x)) - -#define RGB2YUV_SHIFT 16 -#define BY ((int)( 0.098*(1<<RGB2YUV_SHIFT)+0.5)) -#define BV ((int)(-0.071*(1<<RGB2YUV_SHIFT)+0.5)) [... 2616 lines omitted ...] - if(!a) return; - av_free(a->coeff); - a->coeff=NULL; - a->length=0; - av_free(a); -} - -void sws_freeFilter(SwsFilter *filter){ - if(!filter) return; - - if(filter->lumH) sws_freeVec(filter->lumH); - if(filter->lumV) sws_freeVec(filter->lumV); - if(filter->chrH) sws_freeVec(filter->chrH); - if(filter->chrV) sws_freeVec(filter->chrV); - av_free(filter); -} - - -void sws_freeContext(SwsContext *c){ - int i; - if(!c) return; - - if(c->lumPixBuf) - { - for(i=0; i<c->vLumBufSize; i++) - { - av_free(c->lumPixBuf[i]); - c->lumPixBuf[i]=NULL; - } - av_free(c->lumPixBuf); - c->lumPixBuf=NULL; - } - - if(c->chrPixBuf) - { - for(i=0; i<c->vChrBufSize; i++) - { - av_free(c->chrPixBuf[i]); - c->chrPixBuf[i]=NULL; - } - av_free(c->chrPixBuf); - c->chrPixBuf=NULL; - } - - av_free(c->vLumFilter); - c->vLumFilter = NULL; - av_free(c->vChrFilter); - c->vChrFilter = NULL; - av_free(c->hLumFilter); - c->hLumFilter = NULL; - av_free(c->hChrFilter); - c->hChrFilter = NULL; -#ifdef HAVE_ALTIVEC - av_free(c->vYCoeffsBank); - c->vYCoeffsBank = NULL; - av_free(c->vCCoeffsBank); - c->vCCoeffsBank = NULL; -#endif - - av_free(c->vLumFilterPos); - c->vLumFilterPos = NULL; - av_free(c->vChrFilterPos); - c->vChrFilterPos = NULL; - av_free(c->hLumFilterPos); - c->hLumFilterPos = NULL; - av_free(c->hChrFilterPos); - c->hChrFilterPos = NULL; - -#if defined(ARCH_X86) && defined(CONFIG_GPL) -#ifdef MAP_ANONYMOUS - if(c->funnyYCode) munmap(c->funnyYCode, MAX_FUNNY_CODE_SIZE); - if(c->funnyUVCode) munmap(c->funnyUVCode, MAX_FUNNY_CODE_SIZE); -#else - av_free(c->funnyYCode); - av_free(c->funnyUVCode); -#endif - c->funnyYCode=NULL; - c->funnyUVCode=NULL; -#endif /* defined(ARCH_X86) */ - - av_free(c->lumMmx2Filter); - c->lumMmx2Filter=NULL; - av_free(c->chrMmx2Filter); - c->chrMmx2Filter=NULL; - av_free(c->lumMmx2FilterPos); - c->lumMmx2FilterPos=NULL; - av_free(c->chrMmx2FilterPos); - c->chrMmx2FilterPos=NULL; - av_free(c->yuvTable); - c->yuvTable=NULL; - - av_free(c); -} - -/** - * Checks if context is valid or reallocs a new one instead. - * If context is NULL, just calls sws_getContext() to get a new one. - * Otherwise, checks if the parameters are the same already saved in context. - * If that is the case, returns the current context. - * Otherwise, frees context and gets a new one. - * - * Be warned that srcFilter, dstFilter are not checked, they are - * asumed to remain valid. - */ -struct SwsContext *sws_getCachedContext(struct SwsContext *context, - int srcW, int srcH, int srcFormat, - int dstW, int dstH, int dstFormat, int flags, - SwsFilter *srcFilter, SwsFilter *dstFilter, double *param) -{ - if (context != NULL) { - if ((context->srcW != srcW) || (context->srcH != srcH) || - (context->srcFormat != srcFormat) || - (context->dstW != dstW) || (context->dstH != dstH) || - (context->dstFormat != dstFormat) || (context->flags != flags) || - (context->param != param)) - { - sws_freeContext(context); - context = NULL; - } - } - if (context == NULL) { - return sws_getContext(srcW, srcH, srcFormat, - dstW, dstH, dstFormat, flags, - srcFilter, dstFilter, param); - } - return context; -} - diff -r 65ca6da53fa384d225daafad7db0450bc5876326 -r 17844fd6205baeeb6fe291a0b5fcf72d17e8a649 contrib/ffmpeg/libswscale/swscale.h --- a/contrib/ffmpeg/libswscale/swscale.h Fri Dec 14 19:14:45 2007 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,148 +0,0 @@ -/* - * Copyright (C) 2001-2003 Michael Niedermayer <mic...@gm...> - * - * 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 St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef SWSCALE_H -#define SWSCALE_H - -/** - * @file swscale.h - * @brief - * external api for the swscale stuff - */ - -#include "avutil.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#define AV_STRINGIFY(s) AV_TOSTRING(s) -#define AV_TOSTRING(s) #s - -#define LIBSWSCALE_VERSION_INT ((0<<16)+(5<<8)+0) -#define LIBSWSCALE_VERSION 0.5.0 -#define LIBSWSCALE_BUILD LIBSWSCALE_VERSION_INT - -#define LIBSWSCALE_IDENT "SwS" AV_STRINGIFY(LIBSWSCALE_VERSION) - -/* values for the flags, the stuff on the command line is different */ -#define SWS_FAST_BILINEAR 1 -#define SWS_BILINEAR 2 -#define SWS_BICUBIC 4 -#define SWS_X 8 -#define SWS_POINT 0x10 -#define SWS_AREA 0x20 -#define SWS_BICUBLIN 0x40 -#define SWS_GAUSS 0x80 -#define SWS_SINC 0x100 -#define SWS_LANCZOS 0x200 -#define SWS_SPLINE 0x400 - -#define SWS_SRC_V_CHR_DROP_MASK 0x30000 -#define SWS_SRC_V_CHR_DROP_SHIFT 16 - -#define SWS_PARAM_DEFAULT 123456 - -#define SWS_PRINT_INFO 0x1000 - -//the following 3 flags are not completly implemented -//internal chrominace subsamling info -#define SWS_FULL_CHR_H_INT 0x2000 -//input subsampling info -#define SWS_FULL_CHR_H_INP 0x4000 -#define SWS_DIRECT_BGR 0x8000 -#define SWS_ACCURATE_RND 0x40000 - -#define SWS_CPU_CAPS_MMX 0x80000000 -#define SWS_CPU_CAPS_MMX2 0x20000000 -#define SWS_CPU_CAPS_3DNOW 0x40000000 -#define SWS_CPU_CAPS_ALTIVEC 0x10000000 - -#define SWS_MAX_REDUCE_CUTOFF 0.002 - -#define SWS_CS_ITU709 1 -#define SWS_CS_FCC 4 -#define SWS_CS_ITU601 5 -#define SWS_CS_ITU624 5 -#define SWS_CS_SMPTE170M 5 -#define SWS_CS_SMPTE240M 7 -#define SWS_CS_DEFAULT 5 - - - -// when used for filters they must have an odd number of elements -// coeffs cannot be shared between vectors -typedef struct { - double *coeff; - int length; -} SwsVector; - -// vectors can be shared -typedef struct { - SwsVector *lumH; - SwsVector *lumV; - SwsVector *chrH; - SwsVector *chrV; -} SwsFilter; - -struct SwsContext; - -void sws_freeContext(struct SwsContext *swsContext); - -struct SwsContext *sws_getContext(int srcW, int srcH, int srcFormat, int dstW, int dstH, int dstFormat, int flags, - SwsFilter *srcFilter, SwsFilter *dstFilter, double *param); -int sws_scale(struct SwsContext *context, uint8_t* src[], int srcStride[], int srcSliceY, - int srcSliceH, uint8_t* dst[], int dstStride[]); -int sws_scale_ordered(struct SwsContext *context, uint8_t* src[], int srcStride[], int srcSliceY, - int srcSliceH, uint8_t* dst[], int dstStride[]) attribute_deprecated; - - -int sws_setColorspaceDetails(struct SwsContext *c, const int inv_table[4], int srcRange, const int table[4], int dstRange, int brightness, int contrast, int saturation); -int sws_getColorspaceDetails(struct SwsContext *c, int **inv_table, int *srcRange, int **table, int *dstRange, int *brightness, int *contrast, int *saturation); -SwsVector *sws_getGaussianVec(double variance, double quality); -SwsVector *sws_getConstVec(double c, int length); -SwsVector *sws_getIdentityVec(void); -void sws_scaleVec(SwsVector *a, double scalar); -void sws_normalizeVec(SwsVector *a, double height); -void sws_convVec(SwsVector *a, SwsVector *b); -void sws_addVec(SwsVector *a, SwsVector *b); -void sws_subVec(SwsVector *a, SwsVector *b); -void sws_shiftVec(SwsVector *a, int shift); -SwsVector *sws_cloneVec(SwsVector *a); - -void sws_printVec(SwsVector *a); -void sws_freeVec(SwsVector *a); - -SwsFilter *sws_getDefaultFilter(float lumaGBlur, float chromaGBlur, - float lumaSarpen, float chromaSharpen, - float chromaHShift, float chromaVShift, - int verbose); -void sws_freeFilter(SwsFilter *filter); - -struct SwsContext *sws_getCachedContext(struct SwsContext *context, - int srcW, int srcH, int srcFormat, - int dstW, int dstH, int dstFormat, int flags, - SwsFilter *srcFilter, SwsFilter *dstFilter, double *param); - -#ifdef __cplusplus -} -#endif - -#endif diff -r 65ca6da53fa384d225daafad7db0450bc5876326 -r 17844fd6205baeeb6fe291a0b5fcf72d17e8a649 contrib/ffmpeg/libswscale/swscale_altivec_template.c --- a/contrib/ffmpeg/libswscale/swscale_altivec_template.c Fri Dec 14 19:14:45 2007 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,548 +0,0 @@ -/* - * AltiVec-enhanced yuv2yuvX - * - * Copyright (C) 2004 Romain Dolbeau <ro...@do...> - * based on the equivalent C code in "postproc/swscale.c" - * - * 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 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. - * - * You should have received a copy of the GNU General Public License - * along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifdef CONFIG_DARWIN -#define AVV(x...) (x) -#else -#define AVV(x...) {x} -#endif - -#define vzero vec_splat_s32(0) - -static inline void -altivec_packIntArrayToCharArray(int *val, uint8_t* dest, int dstW) { - register int i; - vector unsigned int altivec_vectorShiftInt19 = - vec_add(vec_splat_u32(10),vec_splat_u32(9)); - if ((unsigned long)dest % 16) { - /* badly aligned store, we force store alignement */ - /* and will handle load misalignement on val w/ vec_perm */ - vector unsigned char perm1; - vector signed int v1; - for (i = 0 ; (i < dstW) && - (((unsigned long)dest + i) % 16) ; i++) { - int t = val[i] >> 19; - dest[i] = (t < 0) ? 0 : ((t > 255) ? 255 : t); - } - perm1 = vec_lvsl(i << 2, val); - v1 = vec_ld(i << 2, val); - for ( ; i < (dstW - 15); i+=16) { - int offset = i << 2; - vector signed int v2 = vec_ld(offset + 16, val); - vector signed int v3 = vec_ld(offset + 32, val); - vector signed int v4 = vec_ld(offset + 48, val); - vector signed int v5 = vec_ld(offset + 64, val); - vector signed int v12 = vec_perm(v1,v2,perm1); - vector signed int v23 = vec_perm(v2,v3,perm1); - vector signed int v34 = vec_perm(v3,v4,perm1); - vector signed int v45 = vec_perm(v4,v5,perm1); - - vector signed int vA = vec_sra(v12, altivec_vectorShiftInt19); - vector signed int vB = vec_sra(v23, altivec_vectorShiftInt19); - vector signed int vC = vec_sra(v34, altivec_vectorShiftInt19); - vector signed int vD = vec_sra(v45, altivec_vectorShiftInt19); - vector unsigned short vs1 = vec_packsu(vA, vB); - vector unsigned short vs2 = vec_packsu(vC, vD); - vector unsigned char vf = vec_packsu(vs1, vs2); - vec_st(vf, i, dest); - v1 = v5; - } - } else { // dest is properly aligned, great - for (i = 0; i < (dstW - 15); i+=16) { - int offset = i << 2; - vector signed int v1 = vec_ld(offset, val); - vector signed int v2 = vec_ld(offset + 16, val); - vector signed int v3 = vec_ld(offset + 32, val); - vector signed int v4 = vec_ld(offset + 48, val); - vector signed int v5 = vec_sra(v1, altivec_vectorShiftInt19); - vector signed int v6 = vec_sra(v2, altivec_vectorShiftInt19); - vector signed int v7 = vec_sra(v3, altivec_vectorShiftInt19); - vector signed int v8 = vec_sra(v4, altivec_vectorShiftInt19); - vector unsigned short vs1 = vec_packsu(v5, v6); - vector unsigned short vs2 = vec_packsu(v7, v8); - vector unsigned char vf = vec_packsu(vs1, vs2); - vec_st(vf, i, dest); - } - } - for ( ; i < dstW ; i++) { - int t = val[i] >> 19; - dest[i] = (t < 0) ? 0 : ((t > 255) ? 255 : t); - } -} - -static inline void -yuv2yuvX_altivec_real(int16_t *lumFilter, int16_t **lumSrc, int lumFilterSize, - int16_t *chrFilter, int16_t **chrSrc, int chrFilterSize, - uint8_t *dest, uint8_t *uDest, uint8_t *vDest, int dstW, int chrDstW) -{ - const vector signed int vini = {(1 << 18), (1 << 18), (1 << 18), (1 << 18)}; - register int i, j; - { - int __attribute__ ((aligned (16))) val[dstW]; - - for (i = 0; i < (dstW -7); i+=4) { - vec_st(vini, i << 2, val); - } - for (; i < dstW; i++) { - val[i] = (1 << 18); - } - - for (j = 0; j < lumFilterSize; j++) { - vector signed short l1, vLumFilter = vec_ld(j << 1, lumFilter); - vector unsigned char perm, perm0 = vec_lvsl(j << 1, lumFilter); - vLumFilter = vec_perm(vLumFilter, vLumFilter, perm0); - vLumFilter = vec_splat(vLumFilter, 0); // lumFilter[j] is loaded 8 times in vLumFilter - - perm = vec_lvsl(0, lumSrc[j]); - l1 = vec_ld(0, lumSrc[j]); - - for (i = 0; i < (dstW - 7); i+=8) { - int offset = i << 2; - vector signed short l2 = vec_ld((i << 1) + 16, lumSrc[j]); - - vector signed int v1 = vec_ld(offset, val); - vector signed int v2 = vec_ld(offset + 16, val); [... 296 lines omitted ...] - - for(y=0; y<height; y++) - { - int i; - for (i = 0; i < width - 31; i+= 32) { - const unsigned int j = i >> 1; - vector unsigned char v_yA = vec_ld(i, ysrc); - vector unsigned char v_yB = vec_ld(i + 16, ysrc); - vector unsigned char v_yC = vec_ld(i + 32, ysrc); - vector unsigned char v_y1 = vec_perm(v_yA, v_yB, yperm); - vector unsigned char v_y2 = vec_perm(v_yB, v_yC, yperm); - vector unsigned char v_uA = vec_ld(j, usrc); - vector unsigned char v_uB = vec_ld(j + 16, usrc); - vector unsigned char v_u = vec_perm(v_uA, v_uB, vec_lvsl(j, usrc)); - vector unsigned char v_vA = vec_ld(j, vsrc); - vector unsigned char v_vB = vec_ld(j + 16, vsrc); - vector unsigned char v_v = vec_perm(v_vA, v_vB, vec_lvsl(j, vsrc)); - vector unsigned char v_uv_a = vec_mergeh(v_u, v_v); - vector unsigned char v_uv_b = vec_mergel(v_u, v_v); - vector unsigned char v_yuy2_0 = vec_mergeh(v_y1, v_uv_a); - vector unsigned char v_yuy2_1 = vec_mergel(v_y1, v_uv_a); - vector unsigned char v_yuy2_2 = vec_mergeh(v_y2, v_uv_b); - vector unsigned char v_yuy2_3 = vec_mergel(v_y2, v_uv_b); - vec_st(v_yuy2_0, (i << 1), dst); - vec_st(v_yuy2_1, (i << 1) + 16, dst); - vec_st(v_yuy2_2, (i << 1) + 32, dst); - vec_st(v_yuy2_3, (i << 1) + 48, dst); - } - if (i < width) { - const unsigned int j = i >> 1; - vector unsigned char v_y1 = vec_ld(i, ysrc); - vector unsigned char v_u = vec_ld(j, usrc); - vector unsigned char v_v = vec_ld(j, vsrc); - vector unsigned char v_uv_a = vec_mergeh(v_u, v_v); - vector unsigned char v_yuy2_0 = vec_mergeh(v_y1, v_uv_a); - vector unsigned char v_yuy2_1 = vec_mergel(v_y1, v_uv_a); - vec_st(v_yuy2_0, (i << 1), dst); - vec_st(v_yuy2_1, (i << 1) + 16, dst); - } - if((y&(vertLumPerChroma-1))==(vertLumPerChroma-1) ) - { - usrc += chromStride; - vsrc += chromStride; - } - ysrc += lumStride; - dst += dstStride; - } - - return srcSliceH; -} - -static inline int yv12touyvy_unscaled_altivec(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY, - int srcSliceH, uint8_t* dstParam[], int dstStride_a[]) { - uint8_t *dst=dstParam[0] + dstStride_a[0]*srcSliceY; - // yv12toyuy2( src[0],src[1],src[2],dst,c->srcW,srcSliceH,srcStride[0],srcStride[1],dstStride[0] ); - uint8_t *ysrc = src[0]; - uint8_t *usrc = src[1]; - uint8_t *vsrc = src[2]; - const int width = c->srcW; - const int height = srcSliceH; - const int lumStride = srcStride[0]; - const int chromStride = srcStride[1]; - const int dstStride = dstStride_a[0]; - const int vertLumPerChroma = 2; - const vector unsigned char yperm = vec_lvsl(0, ysrc); - register unsigned int y; - - if(width&15){ - yv12touyvy( ysrc, usrc, vsrc, dst,c->srcW,srcSliceH, lumStride, chromStride, dstStride); - return srcSliceH; - } - - /* this code assume: - - 1) dst is 16 bytes-aligned - 2) dstStride is a multiple of 16 - 3) width is a multiple of 16 - 4) lum&chrom stride are multiple of 8 - */ - - for(y=0; y<height; y++) - { - int i; - for (i = 0; i < width - 31; i+= 32) { - const unsigned int j = i >> 1; - vector unsigned char v_yA = vec_ld(i, ysrc); - vector unsigned char v_yB = vec_ld(i + 16, ysrc); - vector unsigned char v_yC = vec_ld(i + 32, ysrc); - vector unsigned char v_y1 = vec_perm(v_yA, v_yB, yperm); - vector unsigned char v_y2 = vec_perm(v_yB, v_yC, yperm); - vector unsigned char v_uA = vec_ld(j, usrc); - vector unsigned char v_uB = vec_ld(j + 16, usrc); - vector unsigned char v_u = vec_perm(v_uA, v_uB, vec_lvsl(j, usrc)); - vector unsigned char v_vA = vec_ld(j, vsrc); - vector unsigned char v_vB = vec_ld(j + 16, vsrc); - vector unsigned char v_v = vec_perm(v_vA, v_vB, vec_lvsl(j, vsrc)); - vector unsigned char v_uv_a = vec_mergeh(v_u, v_v); - vector unsigned char v_uv_b = vec_mergel(v_u, v_v); - vector unsigned char v_uyvy_0 = vec_mergeh(v_uv_a, v_y1); - vector unsigned char v_uyvy_1 = vec_mergel(v_uv_a, v_y1); - vector unsigned char v_uyvy_2 = vec_mergeh(v_uv_b, v_y2); - vector unsigned char v_uyvy_3 = vec_mergel(v_uv_b, v_y2); - vec_st(v_uyvy_0, (i << 1), dst); - vec_st(v_uyvy_1, (i << 1) + 16, dst); - vec_st(v_uyvy_2, (i << 1) + 32, dst); - vec_st(v_uyvy_3, (i << 1) + 48, dst); - } - if (i < width) { - const unsigned int j = i >> 1; - vector unsigned char v_y1 = vec_ld(i, ysrc); - vector unsigned char v_u = vec_ld(j, usrc); - vector unsigned char v_v = vec_ld(j, vsrc); - vector unsigned char v_uv_a = vec_mergeh(v_u, v_v); - vector unsigned char v_uyvy_0 = vec_mergeh(v_uv_a, v_y1); - vector unsigned char v_uyvy_1 = vec_mergel(v_uv_a, v_y1); - vec_st(v_uyvy_0, (i << 1), dst); - vec_st(v_uyvy_1, (i << 1) + 16, dst); - } - if((y&(vertLumPerChroma-1))==(vertLumPerChroma-1) ) - { - usrc += chromStride; - vsrc += chromStride; - } - ysrc += lumStride; - dst += dstStride; - } - return srcSliceH; -} diff -r 65ca6da53fa384d225daafad7db0450bc5876326 -r 17844fd6205baeeb6fe291a0b5fcf72d17e8a649 contrib/ffmpeg/libswscale/swscale_internal.h --- a/contrib/ffmpeg/libswscale/swscale_internal.h Fri Dec 14 19:14:45 2007 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,224 +0,0 @@ -/* - * Copyright (C) 2001-2003 Michael Niedermayer <mic...@gm...> - * - * 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 St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef SWSCALE_INTERNAL_H -#define SWSCALE_INTERNAL_H - -#ifdef HAVE_ALTIVEC_H -#include <altivec.h> -#endif - -#include "avutil.h" - -#ifdef CONFIG_DARWIN -#define AVV(x...) (x) -#else -#define AVV(x...) {x} -#endif - -#define MAX_FILTER_SIZE 256 - -typedef int (*SwsFunc)(struct SwsContext *context, uint8_t* src[], int srcStride[], int srcSliceY, - int srcSliceH, uint8_t* dst[], int dstStride[]); - -/* this struct should be aligned on at least 32-byte boundary */ -typedef struct SwsContext{ - /** - * info on struct for av_log - */ - AVClass *av_class; - - /** - * - * Note the src,dst,srcStride,dstStride will be copied, in the sws_scale() warper so they can freely be modified here - */ - SwsFunc swScale; - int srcW, srcH, dstH; - int chrSrcW, chrSrcH, chrDstW, chrDstH; - int lumXInc, chrXInc; - int lumYInc, chrYInc; - int dstFormat, srcFormat; ///< format 4:2:0 type is allways YV12 - int origDstFormat, origSrcFormat; ///< format - int chrSrcHSubSample, chrSrcVSubSample; - int chrIntHSubSample, chrIntVSubSample; - int chrDstHSubSample, chrDstVSubSample; - int vChrDrop; - int sliceDir; - double param[2]; - - int16_t **lumPixBuf; - int16_t **chrPixBuf; - int16_t *hLumFilter; - int16_t *hLumFilterPos; - int16_t *hChrFilter; - int16_t *hChrFilterPos; - int16_t *vLumFilter; - int16_t *vLumFilterPos; - int16_t *vChrFilter; - int16_t *vChrFilterPos; - - uint8_t formatConvBuffer[4000]; //FIXME dynamic alloc, but we have to change a lot of code for this to be useful - - int hLumFilterSize; - int hChrFilterSize; - int vLumFilterSize; - int vChrFilterSize; - int vLumBufSize; - int vChrBufSize; - - uint8_t *funnyYCode; - uint8_t *funnyUVCode; - int32_t *lumMmx2FilterPos; - int32_t *chrMmx2FilterPos; - int16_t *lumMmx2Filter; - int16_t *chrMmx2Filter; - - int canMMX2BeUsed; - - int lastInLumBuf; - int lastInChrBuf; - int lumBufIndex; - int chrBufIndex; - int dstY; - int flags; - void * yuvTable; // pointer to the yuv->rgb table start so it can be freed() - uint8_t * table_rV[256]; - uint8_t * table_gU[256]; - int table_gV[256]; - uint8_t * table_bU[256]; - - //Colorspace stuff - int contrast, brightness, saturation; // for sws_getColorspaceDetails - int srcColorspaceTable[4]; - int dstColorspaceTable[4]; - int srcRange, dstRange; - -#define RED_DITHER "0*8" -#define GREEN_DITHER "1*8" -#define BLUE_DITHER "2*8" -#define Y_COEFF "3*8" -#define VR_COEFF "4*8" -#define UB_COEFF "5*8" -#define VG_COEFF "6*8" -#define UG_COEFF "7*8" -#define Y_OFFSET "8*8" -#define U_OFFSET "9*8" -#define V_OFFSET "10*8" -#define LUM_MMX_FILTER_OFFSET "11*8" -#define CHR_MMX_FILTER_OFFSET "11*8+4*4*256" -#define DSTW_OFFSET "11*8+4*4*256*2" //do not change, its hardcoded in the asm -#define ESP_OFFSET "11*8+4*4*256*2+8" -#define VROUNDER_OFFSET "11*8+4*4*256*2+16" -#define U_TEMP "11*8+4*4*256*2+24" -#define V_TEMP "11*8+4*4*256*2+32" - - uint64_t redDither __attribute__((aligned(8))); - uint64_t greenDither __attribute__((aligned(8))); - uint64_t blueDither __attribute__((aligned(8))); - - uint64_t yCoeff __attribute__((aligned(8))); - uint64_t vrCoeff __attribute__((aligned(8))); - uint64_t ubCoeff __attribute__((aligned(8))); - uint64_t vgCoeff __attribute__((aligned(8))); - uint64_t ugCoeff __attribute__((aligned(8))); - uint64_t yOffset __attribute__((aligned(8))); - uint64_t uOffset __attribute__((aligned(8))); - uint64_t vOffset __attribute__((aligned(8))); - int32_t lumMmxFilter[4*MAX_FILTER_SIZE]; - int32_t chrMmxFilter[4*MAX_FILTER_SIZE]; - int dstW; - uint64_t esp __attribute__((aligned(8))); - uint64_t vRounder __attribute__((aligned(8))); - uint64_t u_temp __attribute__((aligned(8))); - uint64_t v_temp __attribute__((aligned(8))); - -#ifdef HAVE_ALTIVEC - - vector signed short CY; - vector signed short CRV; - vector signed short CBU; - vector signed short CGU; - vector signed short CGV; - vector signed short OY; - vector unsigned short CSHIFT; - vector signed short *vYCoeffsBank, *vCCoeffsBank; - -#endif - -} SwsContext; -//FIXME check init (where 0) - -SwsFunc yuv2rgb_get_func_ptr (SwsContext *c); -int yuv2rgb_c_init_tables (SwsContext *c, const int inv_table[4], int fullRange, int brightness, int contrast, int saturation); - -char *sws_format_name(int format); - -//FIXME replace this with something faster -#define isPlanarYUV(x) ((x)==PIX_FMT_YUV410P || (x)==PIX_FMT_YUV420P \ - || (x)==PIX_FMT_YUV411P || (x)==PIX_FMT_YUV422P \ - || (x)==PIX_FMT_YUV444P || (x)==PIX_FMT_NV12 \ - || (x)==PIX_FMT_NV21) -#define isYUV(x) ((x)==PIX_FMT_UYVY422 || (x)==PIX_FMT_YUYV422 || isPlanarYUV(x)) -#define isGray(x) ((x)==PIX_FMT_GRAY8 || (x)==PIX_FMT_GRAY16BE || (x)==PIX_FMT_GRAY16LE) -#define isGray16(x) ((x)==PIX_FMT_GRAY16BE || (x)==PIX_FMT_GRAY16LE) -#define isRGB(x) ((x)==PIX_FMT_BGR32 || (x)==PIX_FMT_RGB24 \ - || (x)==PIX_FMT_RGB565 || (x)==PIX_FMT_RGB555 \ - || (x)==PIX_FMT_RGB8 || (x)==PIX_FMT_RGB4 || (x)==PIX_FMT_RGB4_BYTE \ - || (x)==PIX_FMT_MONOBLACK) -#define isBGR(x) ((x)==PIX_FMT_RGB32 || (x)==PIX_FMT_BGR24 \ - || (x)==PIX_FMT_BGR565 || (x)==PIX_FMT_BGR555 \ - || (x)==PIX_FMT_BGR8 || (x)==PIX_FMT_BGR4 || (x)==PIX_FMT_BGR4_BYTE \ - || (x)==PIX_FMT_MONOBLACK) - -static inline int fmt_depth(int fmt) -{ - switch(fmt) { - case PIX_FMT_BGRA... [truncated message content] |