summaryrefslogtreecommitdiff
path: root/libavcodec/x86/dnxhdenc.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-08-24 14:22:38 +0200
committerMichael Niedermayer <michaelni@gmx.at>2012-08-24 14:30:40 +0200
commitbec180e1127f6753b5af1e6e5242020e0de12366 (patch)
treeb27493eb57b5a484bde3cbc5740d9e60f06f9776 /libavcodec/x86/dnxhdenc.c
parent6b72615c32d7f3bc53a6d6075042aee626d07412 (diff)
parenta1bcc76e6036e78f25cbb7323c145056cfca9d93 (diff)
Merge commit 'a1bcc76e6036e78f25cbb7323c145056cfca9d93'
* commit 'a1bcc76e6036e78f25cbb7323c145056cfca9d93': (21 commits) cmdutils: fix a memleak when specifying an option twice. x86: mpegvideo: more sensible names for optimization file and init function x86: mpegvideoenc: Split optimizations off into a separate file dnxhdenc: x86: more sensible names for optimization file and init function svq1/svq3: Move common code out of SVQ1 decoder-specific file dirac: add Comments and references to the standard lavr: x86: optimized 6-channel flt to fltp conversion lavr: x86: optimized 2-channel flt to fltp conversion lavr: x86: optimized 6-channel flt to s16p conversion lavr: x86: optimized 2-channel flt to s16p conversion lavr: x86: optimized 6-channel s16 to fltp conversion lavr: x86: optimized 2-channel s16 to fltp conversion lavr: x86: optimized 6-channel s16 to s16p conversion lavr: x86: optimized 2-channel s16 to s16p conversion lavr: x86: optimized 2-channel fltp to flt conversion lavr: x86: optimized 6-channel fltp to s16 conversion lavr: x86: optimized 2-channel fltp to s16 conversion lavr: x86: optimized 6-channel s16p to flt conversion lavr: x86: optimized 2-channel s16p to flt conversion lavr: x86: optimized 6-channel s16p to s16 conversion ... Conflicts: libavcodec/dirac.c libavcodec/mpegvideo.h libavcodec/x86/Makefile Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/x86/dnxhdenc.c')
-rw-r--r--libavcodec/x86/dnxhdenc.c65
1 files changed, 65 insertions, 0 deletions
diff --git a/libavcodec/x86/dnxhdenc.c b/libavcodec/x86/dnxhdenc.c
new file mode 100644
index 0000000000..8b0c2ad225
--- /dev/null
+++ b/libavcodec/x86/dnxhdenc.c
@@ -0,0 +1,65 @@
+/*
+ * VC3/DNxHD SIMD functions
+ * Copyright (c) 2007 Baptiste Coudurier <baptiste dot coudurier at smartjog dot com>
+ *
+ * VC-3 encoder funded by the British Broadcasting Corporation
+ *
+ * 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 "libavutil/x86/asm.h"
+#include "libavcodec/dnxhdenc.h"
+
+#if HAVE_INLINE_ASM
+
+static void get_pixels_8x4_sym_sse2(DCTELEM *block, const uint8_t *pixels, int line_size)
+{
+ __asm__ volatile(
+ "pxor %%xmm5, %%xmm5 \n\t"
+ "movq (%0), %%xmm0 \n\t"
+ "add %2, %0 \n\t"
+ "movq (%0), %%xmm1 \n\t"
+ "movq (%0, %2), %%xmm2 \n\t"
+ "movq (%0, %2,2), %%xmm3 \n\t"
+ "punpcklbw %%xmm5, %%xmm0 \n\t"
+ "punpcklbw %%xmm5, %%xmm1 \n\t"
+ "punpcklbw %%xmm5, %%xmm2 \n\t"
+ "punpcklbw %%xmm5, %%xmm3 \n\t"
+ "movdqa %%xmm0, (%1) \n\t"
+ "movdqa %%xmm1, 16(%1) \n\t"
+ "movdqa %%xmm2, 32(%1) \n\t"
+ "movdqa %%xmm3, 48(%1) \n\t"
+ "movdqa %%xmm3 , 64(%1) \n\t"
+ "movdqa %%xmm2 , 80(%1) \n\t"
+ "movdqa %%xmm1 , 96(%1) \n\t"
+ "movdqa %%xmm0, 112(%1) \n\t"
+ : "+r" (pixels)
+ : "r" (block), "r" ((x86_reg)line_size)
+ );
+}
+
+#endif /* HAVE_INLINE_ASM */
+
+void ff_dnxhdenc_init_x86(DNXHDEncContext *ctx)
+{
+#if HAVE_INLINE_ASM
+ if (av_get_cpu_flags() & AV_CPU_FLAG_SSE2) {
+ if (ctx->cid_table->bit_depth == 8)
+ ctx->get_pixels_8x4_sym = get_pixels_8x4_sym_sse2;
+ }
+#endif /* HAVE_INLINE_ASM */
+}