diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2014-05-27 23:07:36 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2014-05-27 23:16:06 +0200 |
commit | e2abc0d5cacc22aa900de8ac26160ea1b786a7b5 (patch) | |
tree | 536e4539c573752b2b446d2c8ef17d9d62927815 /libavcodec/x86/huffyuvdsp_mmx.c | |
parent | 43c57dbe14545d13dbfd8aae341b45514e8bcfbb (diff) | |
parent | 0d439fbede03854eac8a978cccf21a3425a3c82d (diff) | |
download | ffmpeg-e2abc0d5cacc22aa900de8ac26160ea1b786a7b5.tar.gz |
Merge commit '0d439fbede03854eac8a978cccf21a3425a3c82d'
* commit '0d439fbede03854eac8a978cccf21a3425a3c82d':
dsputil: Split off HuffYUV decoding bits into their own context
Conflicts:
configure
libavcodec/dsputil.c
libavcodec/dsputil.h
libavcodec/huffyuv.h
libavcodec/huffyuvdec.c
libavcodec/lagarith.c
libavcodec/vble.c
libavcodec/x86/Makefile
libavcodec/x86/dsputil.asm
libavcodec/x86/dsputil_init.c
libavcodec/x86/dsputil_mmx.c
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/x86/huffyuvdsp_mmx.c')
-rw-r--r-- | libavcodec/x86/huffyuvdsp_mmx.c | 91 |
1 files changed, 91 insertions, 0 deletions
diff --git a/libavcodec/x86/huffyuvdsp_mmx.c b/libavcodec/x86/huffyuvdsp_mmx.c new file mode 100644 index 0000000000..59422107d3 --- /dev/null +++ b/libavcodec/x86/huffyuvdsp_mmx.c @@ -0,0 +1,91 @@ +/* + * Copyright (c) 2009 Loren Merritt <lorenm@u.washington.edu> + * + * 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 "config.h" +#include "libavutil/x86/asm.h" +#include "huffyuvdsp.h" + +#if HAVE_INLINE_ASM + +#if HAVE_7REGS +void ff_add_hfyu_median_pred_cmov(uint8_t *dst, const uint8_t *top, + const uint8_t *diff, int w, + int *left, int *left_top) +{ + x86_reg w2 = -w; + x86_reg x; + int l = *left & 0xff; + int tl = *left_top & 0xff; + int t; + __asm__ volatile ( + "mov %7, %3 \n" + "1: \n" + "movzbl (%3, %4), %2 \n" + "mov %2, %k3 \n" + "sub %b1, %b3 \n" + "add %b0, %b3 \n" + "mov %2, %1 \n" + "cmp %0, %2 \n" + "cmovg %0, %2 \n" + "cmovg %1, %0 \n" + "cmp %k3, %0 \n" + "cmovg %k3, %0 \n" + "mov %7, %3 \n" + "cmp %2, %0 \n" + "cmovl %2, %0 \n" + "add (%6, %4), %b0 \n" + "mov %b0, (%5, %4) \n" + "inc %4 \n" + "jl 1b \n" + : "+&q"(l), "+&q"(tl), "=&r"(t), "=&q"(x), "+&r"(w2) + : "r"(dst + w), "r"(diff + w), "rm"(top + w) + ); + *left = l; + *left_top = tl; +} +#endif + +void ff_add_bytes_mmx(uint8_t *dst, uint8_t *src, int w) +{ + x86_reg i = 0; + + __asm__ volatile ( + "jmp 2f \n\t" + "1: \n\t" + "movq (%1, %0), %%mm0 \n\t" + "movq (%2, %0), %%mm1 \n\t" + "paddb %%mm0, %%mm1 \n\t" + "movq %%mm1, (%2, %0) \n\t" + "movq 8(%1, %0), %%mm0 \n\t" + "movq 8(%2, %0), %%mm1 \n\t" + "paddb %%mm0, %%mm1 \n\t" + "movq %%mm1, 8(%2, %0) \n\t" + "add $16, %0 \n\t" + "2: \n\t" + "cmp %3, %0 \n\t" + "js 1b \n\t" + : "+r" (i) + : "r" (src), "r" (dst), "r" ((x86_reg) w - 15)); + + for (; i < w; i++) + dst[i + 0] += src[i + 0]; +} + +#endif /* HAVE_INLINE_ASM */ |