diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2012-01-30 05:20:58 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2012-01-30 05:20:58 +0100 |
commit | e1492151fb0c1ad2a9efbb2f2413b60113208b61 (patch) | |
tree | e4852fd092e2b2346c21e87d8b69987b2b4c2a68 /libavcodec/x86 | |
parent | 90bf7c7b41c9e78663ef3da00480f70854072932 (diff) | |
parent | 20a7d3178f2370ebd1f548c144bc90d1e1bcd81a (diff) | |
download | ffmpeg-e1492151fb0c1ad2a9efbb2f2413b60113208b61.tar.gz |
Merge remote-tracking branch 'qatar/master'
* qatar/master:
png: add missing #if HAVE_SSSE3 around function pointer assignment.
imdct36: mark SSE functions as using all 16 XMM registers.
png: move DSP functions to their own DSP context.
sunrast: Add a sample request for TIFF, IFF, and Experimental Rastfile formats.
sunrast: Cosmetics
sunrast: Remove if (unsigned int < 0) check.
sunrast: Replace magic number by a macro.
Conflicts:
libavcodec/dsputil.c
libavcodec/dsputil.h
libavcodec/pngdec.c
libavcodec/sunrast.c
libavcodec/x86/Makefile
libavcodec/x86/dsputil_mmx.c
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/x86')
-rw-r--r-- | libavcodec/x86/Makefile | 2 | ||||
-rw-r--r-- | libavcodec/x86/dsputil_mmx.c | 1 | ||||
-rw-r--r-- | libavcodec/x86/imdct36_sse.asm | 2 | ||||
-rw-r--r-- | libavcodec/x86/pngdsp-init.c (renamed from libavcodec/x86/png_mmx.c) | 79 |
4 files changed, 38 insertions, 46 deletions
diff --git a/libavcodec/x86/Makefile b/libavcodec/x86/Makefile index 1066b20139..5ba3942933 100644 --- a/libavcodec/x86/Makefile +++ b/libavcodec/x86/Makefile @@ -42,13 +42,13 @@ MMX-OBJS-$(CONFIG_CAVS_DECODER) += x86/cavsdsp_mmx.o MMX-OBJS-$(CONFIG_DNXHD_ENCODER) += x86/dnxhd_mmx.o MMX-OBJS-$(CONFIG_MPEGAUDIODSP) += x86/mpegaudiodec_mmx.o YASM-OBJS-$(CONFIG_MPEGAUDIODSP) += x86/imdct36_sse.o -MMX-OBJS-$(CONFIG_PNG_DECODER) += x86/png_mmx.o MMX-OBJS-$(CONFIG_ENCODERS) += x86/dsputilenc_mmx.o YASM-OBJS-$(CONFIG_ENCODERS) += x86/dsputilenc_yasm.o MMX-OBJS-$(CONFIG_GPL) += x86/idct_mmx.o MMX-OBJS-$(CONFIG_LPC) += x86/lpc_mmx.o YASM-OBJS-$(CONFIG_PRORES_LGPL_DECODER) += x86/proresdsp.o MMX-OBJS-$(CONFIG_PRORES_LGPL_DECODER) += x86/proresdsp-init.o +MMX-OBJS-$(CONFIG_PNG_DECODER) += x86/pngdsp-init.o YASM-OBJS-$(CONFIG_PRORES_DECODER) += x86/proresdsp.o MMX-OBJS-$(CONFIG_PRORES_DECODER) += x86/proresdsp-init.o MMX-OBJS-$(CONFIG_DWT) += x86/snowdsp_mmx.o \ diff --git a/libavcodec/x86/dsputil_mmx.c b/libavcodec/x86/dsputil_mmx.c index 6847e6e6f8..ad29029528 100644 --- a/libavcodec/x86/dsputil_mmx.c +++ b/libavcodec/x86/dsputil_mmx.c @@ -2671,7 +2671,6 @@ void dsputil_init_mmx(DSPContext* c, AVCodecContext *avctx) if (HAVE_AMD3DNOW && (mm_flags & AV_CPU_FLAG_3DNOW)) c->add_hfyu_median_prediction = add_hfyu_median_prediction_cmov; #endif - } else if (HAVE_AMD3DNOW && (mm_flags & AV_CPU_FLAG_3DNOW)) { c->prefetch = prefetch_3dnow; diff --git a/libavcodec/x86/imdct36_sse.asm b/libavcodec/x86/imdct36_sse.asm index 2482620368..e0205ec746 100644 --- a/libavcodec/x86/imdct36_sse.asm +++ b/libavcodec/x86/imdct36_sse.asm @@ -393,7 +393,7 @@ INIT_XMM sse %endif %macro DEFINE_FOUR_IMDCT 0 -cglobal four_imdct36_float, 5,5,8, out, buf, in, win, tmp +cglobal four_imdct36_float, 5,5,16, out, buf, in, win, tmp movlps m0, [inq+64] movhps m0, [inq+64 + 72] movlps m3, [inq+64 + 2*72] diff --git a/libavcodec/x86/png_mmx.c b/libavcodec/x86/pngdsp-init.c index 3b284122ff..089147c9e4 100644 --- a/libavcodec/x86/png_mmx.c +++ b/libavcodec/x86/pngdsp-init.c @@ -1,6 +1,6 @@ /* - * MMX optimized PNG utils - * Copyright (c) 2008 Loren Merritt + * x86 PNG optimizations. + * Copyright (c) 2008 Loren Merrit <lorenm@u.washington.edu> * * This file is part of FFmpeg. * @@ -17,46 +17,18 @@ * 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 "libavutil/cpu.h" #include "libavutil/x86_cpu.h" -#include "libavcodec/dsputil.h" -#include "libavcodec/png.h" +#include "libavcodec/pngdsp.h" #include "dsputil_mmx.h" -//#undef NDEBUG -//#include <assert.h> - -static void add_bytes_l2_mmx(uint8_t *dst, uint8_t *src1, uint8_t *src2, int w) -{ - x86_reg i=0; - __asm__ volatile( - "jmp 2f \n\t" - "1: \n\t" - "movq (%2, %0), %%mm0 \n\t" - "movq 8(%2, %0), %%mm1 \n\t" - "paddb (%3, %0), %%mm0 \n\t" - "paddb 8(%3, %0), %%mm1 \n\t" - "movq %%mm0, (%1, %0) \n\t" - "movq %%mm1, 8(%1, %0) \n\t" - "add $16, %0 \n\t" - "2: \n\t" - "cmp %4, %0 \n\t" - " js 1b \n\t" - : "+r" (i) - : "r"(dst), "r"(src1), "r"(src2), "r"((x86_reg)w-15) - ); - for(; i<w; i++) - dst[i] = src1[i] + src2[i]; -} - #define PAETH(cpu, abs3)\ -static void add_paeth_prediction_##cpu(uint8_t *dst, uint8_t *src, uint8_t *top, int w, int bpp)\ +static void add_png_paeth_prediction_##cpu(uint8_t *dst, uint8_t *src, uint8_t *top, int w, int bpp)\ {\ x86_reg i, end;\ - if(bpp>4) add_paeth_prediction_##cpu(dst+bpp/2, src+bpp/2, top+bpp/2, w-bpp/2, -bpp);\ + if(bpp>4) add_png_paeth_prediction_##cpu(dst+bpp/2, src+bpp/2, top+bpp/2, w-bpp/2, -bpp);\ if(bpp<0) bpp=-bpp;\ i= -bpp;\ end = w-3;\ @@ -128,16 +100,37 @@ PAETH(mmx2, ABS3_MMX2) PAETH(ssse3, ABS3_SSSE3) #endif -void ff_png_init_mmx(PNGDecContext *s) +static void add_bytes_l2_mmx(uint8_t *dst, uint8_t *src1, uint8_t *src2, int w) { - int mm_flags = av_get_cpu_flags(); + x86_reg i=0; + __asm__ volatile( + "jmp 2f \n\t" + "1: \n\t" + "movq (%2, %0), %%mm0 \n\t" + "movq 8(%2, %0), %%mm1 \n\t" + "paddb (%3, %0), %%mm0 \n\t" + "paddb 8(%3, %0), %%mm1 \n\t" + "movq %%mm0, (%1, %0) \n\t" + "movq %%mm1, 8(%1, %0) \n\t" + "add $16, %0 \n\t" + "2: \n\t" + "cmp %4, %0 \n\t" + " js 1b \n\t" + : "+r" (i) + : "r"(dst), "r"(src1), "r"(src2), "r"((x86_reg) w - 15) + ); + for (; i < w; i++) + dst[i] = src1[i] + src2[i]; +} - if (mm_flags & AV_CPU_FLAG_MMX2) { - s->add_bytes_l2 = add_bytes_l2_mmx; - s->add_paeth_prediction = add_paeth_prediction_mmx2; -#if HAVE_SSSE3 - if (mm_flags & AV_CPU_FLAG_SSSE3) - s->add_paeth_prediction = add_paeth_prediction_ssse3; -#endif - } +void ff_pngdsp_init_x86(PNGDSPContext *dsp) +{ + int flags = av_get_cpu_flags(); + + if (flags & AV_CPU_FLAG_MMX) + dsp->add_bytes_l2 = add_bytes_l2_mmx; + if (flags & AV_CPU_FLAG_MMX2) + dsp->add_paeth_prediction = add_png_paeth_prediction_mmx2; + if (HAVE_SSSE3 && flags & AV_CPU_FLAG_SSSE3) + dsp->add_paeth_prediction = add_png_paeth_prediction_ssse3; } |