This is an automated email from the git hooks/post-receive script. Git pushed a commit to branch master in repository ffmpeg.
commit 10a0858f6d2bedcc93082f59302f622530ed11e0 Author: Andreas Rheinhardt <[email protected]> AuthorDate: Tue Nov 17 23:07:26 2026 +0100 Commit: Andreas Rheinhardt <[email protected]> CommitDate: Mon Nov 23 11:26:09 2026 +0100 avcodec/x86/vc1dsp_{mmx,mc}: Remove superseded MMX code This makes the VC-1 decoder family no longer use any MMX registers at all. Also remove the ff_pw_53 and ff_pw_128 constants which were only used by the now removed MMX code. (The removed code in vc1dsp_mmx.c took up 9437B with GCC and 32214B with Clang (both -O3); furthermore the MMX code in vc1dsp_mc.asm amounted to 656B. In contrast, the new SSSE3 code takes up only 5503B here.) Signed-off-by: Andreas Rheinhardt <[email protected]> --- libavcodec/x86/Makefile | 2 +- libavcodec/x86/constants.c | 4 +- libavcodec/x86/constants.h | 4 +- libavcodec/x86/vc1dsp.h | 34 ----- libavcodec/x86/vc1dsp_init.c | 13 +- libavcodec/x86/vc1dsp_mc.asm | 167 -------------------- libavcodec/x86/vc1dsp_mmx.c | 352 ------------------------------------------- tests/checkasm/vc1dsp.c | 2 +- 8 files changed, 5 insertions(+), 573 deletions(-) diff --git a/libavcodec/x86/Makefile b/libavcodec/x86/Makefile index b1b38ef8aa..85dd0460d4 100644 --- a/libavcodec/x86/Makefile +++ b/libavcodec/x86/Makefile @@ -33,7 +33,7 @@ OBJS-$(CONFIG_MPEGVIDEOENCDSP) += x86/mpegvideoencdsp_init.o X86ASM-OBJS-$(CONFIG_PIXBLOCKDSP) += x86/pixblockdsp_init.o X86ASM-OBJS-$(CONFIG_QPELDSP) += x86/qpeldsp_init.o X86ASM-OBJS-$(CONFIG_RV34DSP) += x86/rv34dsp_init.o -X86ASM-OBJS-$(CONFIG_VC1DSP) += x86/vc1dsp_init.o x86/vc1dsp_mmx.o +X86ASM-OBJS-$(CONFIG_VC1DSP) += x86/vc1dsp_init.o X86ASM-OBJS-$(CONFIG_VIDEODSP) += x86/videodsp_init.o X86ASM-OBJS-$(CONFIG_VP3DSP) += x86/vp3dsp_init.o X86ASM-OBJS-$(CONFIG_VP8DSP) += x86/vp8dsp_init.o diff --git a/libavcodec/x86/constants.c b/libavcodec/x86/constants.c index 0bea3e2ac9..1e6abf2bd2 100644 --- a/libavcodec/x86/constants.c +++ b/libavcodec/x86/constants.c @@ -1,5 +1,5 @@ /* - * MMX/SSE/AVX constants used across x86 dsp optimizations. + * XMM/YMM constants used across x86 dsp optimizations. * * This file is part of FFmpeg. * @@ -36,9 +36,7 @@ DECLARE_ASM_ALIGNED(16, const xmm_reg, ff_pw_9) = { 0x0009000900090009ULL, 0 DECLARE_ALIGNED(16, const xmm_reg, ff_pw_16) = { 0x0010001000100010ULL, 0x0010001000100010ULL }; DECLARE_ASM_ALIGNED(16, const xmm_reg, ff_pw_18) = { 0x0012001200120012ULL, 0x0012001200120012ULL }; DECLARE_ALIGNED(16, const xmm_reg, ff_pw_32) = { 0x0020002000200020ULL, 0x0020002000200020ULL }; -DECLARE_ASM_ALIGNED(8, const uint64_t, ff_pw_53) = 0x0035003500350035ULL; DECLARE_ASM_ALIGNED(16, const xmm_reg, ff_pw_64) = { 0x0040004000400040ULL, 0x0040004000400040ULL }; -DECLARE_ASM_ALIGNED(8, const uint64_t, ff_pw_128) = 0x0080008000800080ULL; DECLARE_ALIGNED(32, const ymm_reg, ff_pw_255) = { 0x00ff00ff00ff00ffULL, 0x00ff00ff00ff00ffULL, 0x00ff00ff00ff00ffULL, 0x00ff00ff00ff00ffULL }; DECLARE_ALIGNED(32, const ymm_reg, ff_pw_256) = { 0x0100010001000100ULL, 0x0100010001000100ULL, diff --git a/libavcodec/x86/constants.h b/libavcodec/x86/constants.h index 311794dae3..53164b7992 100644 --- a/libavcodec/x86/constants.h +++ b/libavcodec/x86/constants.h @@ -1,5 +1,5 @@ /* - * MMX/SSE constants used across x86 dsp optimizations. + * XMM/YMM constants used across x86 dsp optimizations. * * This file is part of FFmpeg. * @@ -36,9 +36,7 @@ extern const xmm_reg ff_pw_9; extern const xmm_reg ff_pw_16; extern const xmm_reg ff_pw_18; extern const xmm_reg ff_pw_32; -extern const uint64_t ff_pw_53; extern const xmm_reg ff_pw_64; -extern const uint64_t ff_pw_128; extern const ymm_reg ff_pw_255; extern const ymm_reg ff_pw_256; extern const ymm_reg ff_pw_512; diff --git a/libavcodec/x86/vc1dsp.h b/libavcodec/x86/vc1dsp.h deleted file mode 100644 index 912ea0be36..0000000000 --- a/libavcodec/x86/vc1dsp.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * VC-1 and WMV3 decoder - X86 DSP init functions - * - * 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 - */ - -#ifndef AVCODEC_X86_VC1DSP_H -#define AVCODEC_X86_VC1DSP_H - -#include "config.h" -#include "libavcodec/vc1dsp.h" - -#if HAVE_X86_6REGS && HAVE_INLINE_ASM && HAVE_MMX_EXTERNAL - -void ff_vc1dsp_init_mmx(VC1DSPContext *dsp); -void ff_vc1dsp_init_mmxext(VC1DSPContext *dsp); - -#endif /* HAVE_X86_6REGS && HAVE_INLINE_ASM && HAVE_MMX_EXTERNAL */ - -#endif /* AVCODEC_X86_VC1DSP_H */ diff --git a/libavcodec/x86/vc1dsp_init.c b/libavcodec/x86/vc1dsp_init.c index 1349162180..439165c408 100644 --- a/libavcodec/x86/vc1dsp_init.c +++ b/libavcodec/x86/vc1dsp_init.c @@ -1,5 +1,5 @@ /* - * VC-1 and WMV3 - DSP functions MMX-optimized + * VC-1 and WMV3 - ASM-optimized DSP functions * Copyright (c) 2007 Christophe GISQUET <[email protected]> * * Permission is hereby granted, free of charge, to any person @@ -28,7 +28,6 @@ #include "libavutil/cpu.h" #include "libavutil/x86/cpu.h" #include "libavcodec/vc1dsp.h" -#include "vc1dsp.h" #include "config.h" #define LOOP_FILTER4(EXT) \ @@ -99,16 +98,6 @@ av_cold void ff_vc1dsp_init_x86(VC1DSPContext *dsp) { int cpu_flags = av_get_cpu_flags(); -#if HAVE_X86_6REGS && HAVE_INLINE_ASM && HAVE_MMX_EXTERNAL - if (HAVE_X86_6REGS && INLINE_MMX(cpu_flags)) - if (EXTERNAL_MMX(cpu_flags)) - ff_vc1dsp_init_mmx(dsp); - - if (HAVE_X86_6REGS && INLINE_MMXEXT(cpu_flags)) - if (EXTERNAL_MMXEXT(cpu_flags)) - ff_vc1dsp_init_mmxext(dsp); -#endif /* HAVE_X86_6REGS && HAVE_INLINE_ASM && HAVE_MMX_EXTERNAL */ - #define ASSIGN_LF4(EXT) \ dsp->vc1_v_loop_filter4 = ff_vc1_v_loop_filter4_ ## EXT; \ dsp->vc1_h_loop_filter4 = ff_vc1_h_loop_filter4_ ## EXT diff --git a/libavcodec/x86/vc1dsp_mc.asm b/libavcodec/x86/vc1dsp_mc.asm index 70b4a1079f..0f75a6acb7 100644 --- a/libavcodec/x86/vc1dsp_mc.asm +++ b/libavcodec/x86/vc1dsp_mc.asm @@ -37,176 +37,9 @@ pw_53: times 8 dw 53 cextern pb_80 cextern pw_9 cextern pw_18 -cextern pw_128 SECTION .text -%if HAVE_MMX_INLINE - -; XXX some of these macros are not used right now, but they will in the future -; when more functions are ported. - -%macro OP_PUT 2 ; dst, src -%endmacro - -%macro OP_AVG 2 ; dst, src - pavgb %1, %2 -%endmacro - -%macro NORMALIZE_MMX 1 ; shift - paddw m3, m7 ; +bias-r - paddw m4, m7 ; +bias-r - psraw m3, %1 - psraw m4, %1 -%endmacro - -%macro TRANSFER_DO_PACK 2 ; op, dst - packuswb m3, m4 - %1 m3, [%2] - mova [%2], m3 -%endmacro - -%macro TRANSFER_DONT_PACK 2 ; op, dst - %1 m3, [%2] - %1 m3, [%2 + mmsize] - mova [%2], m3 - mova [mmsize + %2], m4 -%endmacro - -; see MSPEL_FILTER13_CORE for use as UNPACK macro -%macro DO_UNPACK 1 ; reg - punpcklbw %1, m0 -%endmacro -%macro DONT_UNPACK 1 ; reg -%endmacro - -; Compute the rounder 32-r or 8-r and unpacks it to m7 -%macro LOAD_ROUNDER_MMX 1 ; round - movd m7, %1 - punpcklwd m7, m7 - punpckldq m7, m7 -%endmacro - -%macro SHIFT2_LINE 5 ; off, r0, r1, r2, r3 - paddw m%3, m%4 - movh m%2, [srcq + stride_neg2] - pmullw m%3, m6 - punpcklbw m%2, m0 - movh m%5, [srcq + strideq] - psubw m%3, m%2 - punpcklbw m%5, m0 - paddw m%3, m7 - psubw m%3, m%5 - psraw m%3, shift - movu [dstq + %1], m%3 - add srcq, strideq -%endmacro - -INIT_MMX mmx -; void ff_vc1_put_ver_16b_shift2_mmx(int16_t *dst, const uint8_t *src, -; x86_reg stride, int rnd, int64_t shift) -; Sacrificing m6 makes it possible to pipeline loads from src -%if ARCH_X86_32 -cglobal vc1_put_ver_16b_shift2, 3,6,0, dst, src, stride - DECLARE_REG_TMP 3, 4, 5 - %define rnd r3mp - %define shift qword r4m -%else ; X86_64 -cglobal vc1_put_ver_16b_shift2, 4,7,0, dst, src, stride - DECLARE_REG_TMP 4, 5, 6 - %define rnd r3d - ; We need shift either in memory or in a mm reg as it's used in psraw - ; On WIN64, the arg is already on the stack - ; On UNIX64, m5 doesn't seem to be used -%if WIN64 - %define shift r4mp -%else ; UNIX64 - %define shift m5 - mova shift, r4q -%endif ; WIN64 -%endif ; X86_32 -%define stride_neg2 t0q -%define stride_9minus4 t1q -%define i t2q - mov stride_neg2, strideq - neg stride_neg2 - add stride_neg2, stride_neg2 - lea stride_9minus4, [strideq * 9 - 4] - mov i, 3 - LOAD_ROUNDER_MMX rnd - mova m6, [pw_9] - pxor m0, m0 -.loop: - movh m2, [srcq] - add srcq, strideq - movh m3, [srcq] - punpcklbw m2, m0 - punpcklbw m3, m0 - SHIFT2_LINE 0, 1, 2, 3, 4 - SHIFT2_LINE 24, 2, 3, 4, 1 - SHIFT2_LINE 48, 3, 4, 1, 2 - SHIFT2_LINE 72, 4, 1, 2, 3 - SHIFT2_LINE 96, 1, 2, 3, 4 - SHIFT2_LINE 120, 2, 3, 4, 1 - SHIFT2_LINE 144, 3, 4, 1, 2 - SHIFT2_LINE 168, 4, 1, 2, 3 - sub srcq, stride_9minus4 - add dstq, 8 - dec i - jnz .loop - RET -%undef rnd -%undef shift -%undef stride_neg2 -%undef stride_9minus4 -%undef i - -; void ff_vc1_*_hor_16b_shift2_mmx(uint8_t *dst, x86_reg stride, -; const int16_t *src, int rnd); -; Data is already unpacked, so some operations can directly be made from -; memory. -%macro HOR_16B_SHIFT2 2 ; op, opname -cglobal vc1_%2_hor_16b_shift2, 4, 5, 0, dst, stride, src, rnd, h - mov hq, 8 - sub srcq, 2 - sub rndd, (-1+9+9-1) * 1024 ; add -1024 bias - LOAD_ROUNDER_MMX rndd - mova m5, [pw_9] - mova m6, [pw_128] - -.loop: - mova m1, [srcq + 2 * 0] - mova m2, [srcq + 2 * 0 + mmsize] - mova m3, [srcq + 2 * 1] - mova m4, [srcq + 2 * 1 + mmsize] - paddw m3, [srcq + 2 * 2] - paddw m4, [srcq + 2 * 2 + mmsize] - paddw m1, [srcq + 2 * 3] - paddw m2, [srcq + 2 * 3 + mmsize] - pmullw m3, m5 - pmullw m4, m5 - psubw m3, m1 - psubw m4, m2 - NORMALIZE_MMX 7 - ; remove bias - paddw m3, m6 - paddw m4, m6 - TRANSFER_DO_PACK %1, dstq - add srcq, 24 - add dstq, strideq - dec hq - jnz .loop - - RET -%endmacro - -INIT_MMX mmx -HOR_16B_SHIFT2 OP_PUT, put - -INIT_MMX mmxext -HOR_16B_SHIFT2 OP_AVG, avg -%endif ; HAVE_MMX_INLINE - %define MOV8 movq %define MOV16 movu diff --git a/libavcodec/x86/vc1dsp_mmx.c b/libavcodec/x86/vc1dsp_mmx.c deleted file mode 100644 index 36591f83fc..0000000000 --- a/libavcodec/x86/vc1dsp_mmx.c +++ /dev/null @@ -1,352 +0,0 @@ -/* - * VC-1 and WMV3 - DSP functions MMX-optimized - * Copyright (c) 2007 Christophe GISQUET <[email protected]> - * - * Permission is hereby granted, free of charge, to any person - * obtaining a copy of this software and associated documentation - * files (the "Software"), to deal in the Software without - * restriction, including without limitation the rights to use, - * copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following - * conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES - * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT - * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - */ - -#include "libavutil/attributes.h" -#include "libavutil/mem_internal.h" -#include "libavutil/x86/asm.h" -#include "libavutil/x86/cpu.h" -#include "libavcodec/vc1dsp.h" -#include "constants.h" -#include "fpel.h" -#include "vc1dsp.h" - -#if HAVE_X86_6REGS && HAVE_INLINE_ASM && HAVE_MMX_EXTERNAL - -void ff_vc1_put_ver_16b_shift2_mmx(int16_t *dst, - const uint8_t *src, x86_reg stride, - int rnd, int64_t shift); -void ff_vc1_put_hor_16b_shift2_mmx(uint8_t *dst, x86_reg stride, - const int16_t *src, int rnd); -void ff_vc1_avg_hor_16b_shift2_mmxext(uint8_t *dst, x86_reg stride, - const int16_t *src, int rnd); - -#define OP_PUT(S,D) -#define OP_AVG(S,D) "pavgb " #S ", " #D " \n\t" - -/** Add rounder from mm7 to mm3 and pack result at destination */ -#define NORMALIZE_MMX(SHIFT) \ - "paddw %%mm7, %%mm3 \n\t" /* +bias-r */ \ - "paddw %%mm7, %%mm4 \n\t" /* +bias-r */ \ - "psraw "SHIFT", %%mm3 \n\t" \ - "psraw "SHIFT", %%mm4 \n\t" - -#define TRANSFER_DO_PACK(OP) \ - "packuswb %%mm4, %%mm3 \n\t" \ - OP((%2), %%mm3) \ - "movq %%mm3, (%2) \n\t" - -#define TRANSFER_DONT_PACK(OP) \ - OP(0(%2), %%mm3) \ - OP(8(%2), %%mm4) \ - "movq %%mm3, 0(%2) \n\t" \ - "movq %%mm4, 8(%2) \n\t" - -/** @see MSPEL_FILTER13_CORE for use as UNPACK macro */ -#define DO_UNPACK(reg) "punpcklbw %%mm0, " reg "\n\t" -#define DONT_UNPACK(reg) - -/** Compute the rounder 32-r or 8-r and unpacks it to mm7 */ -#define LOAD_ROUNDER_MMX(ROUND) \ - "movd "ROUND", %%mm7 \n\t" \ - "punpcklwd %%mm7, %%mm7 \n\t" \ - "punpckldq %%mm7, %%mm7 \n\t" - -/** - * Core of the 1/4 and 3/4 shift bicubic interpolation. - * - * @param UNPACK Macro unpacking arguments from 8 to 16 bits (can be empty). - * @param MOVQ "movd 1" or "movq 2", if data read is already unpacked. - * @param A1 Address of 1st tap (beware of unpacked/packed). - * @param A2 Address of 2nd tap - * @param A3 Address of 3rd tap - * @param A4 Address of 4th tap - */ -#define MSPEL_FILTER13_CORE(UNPACK, MOVQ, A1, A2, A3, A4) \ - MOVQ "*0+"A1", %%mm1 \n\t" \ - MOVQ "*4+"A1", %%mm2 \n\t" \ - UNPACK("%%mm1") \ - UNPACK("%%mm2") \ - "pmullw "MANGLE(ff_pw_3)", %%mm1\n\t" \ - "pmullw "MANGLE(ff_pw_3)", %%mm2\n\t" \ - MOVQ "*0+"A2", %%mm3 \n\t" \ - MOVQ "*4+"A2", %%mm4 \n\t" \ - UNPACK("%%mm3") \ - UNPACK("%%mm4") \ - "pmullw %%mm6, %%mm3 \n\t" /* *18 */ \ - "pmullw %%mm6, %%mm4 \n\t" /* *18 */ \ - "psubw %%mm1, %%mm3 \n\t" /* 18,-3 */ \ - "psubw %%mm2, %%mm4 \n\t" /* 18,-3 */ \ - MOVQ "*0+"A4", %%mm1 \n\t" \ - MOVQ "*4+"A4", %%mm2 \n\t" \ - UNPACK("%%mm1") \ - UNPACK("%%mm2") \ - "psllw $2, %%mm1 \n\t" /* 4* */ \ - "psllw $2, %%mm2 \n\t" /* 4* */ \ - "psubw %%mm1, %%mm3 \n\t" /* -4,18,-3 */ \ - "psubw %%mm2, %%mm4 \n\t" /* -4,18,-3 */ \ - MOVQ "*0+"A3", %%mm1 \n\t" \ - MOVQ "*4+"A3", %%mm2 \n\t" \ - UNPACK("%%mm1") \ - UNPACK("%%mm2") \ - "pmullw %%mm5, %%mm1 \n\t" /* *53 */ \ - "pmullw %%mm5, %%mm2 \n\t" /* *53 */ \ - "paddw %%mm1, %%mm3 \n\t" /* 4,53,18,-3 */ \ - "paddw %%mm2, %%mm4 \n\t" /* 4,53,18,-3 */ - -/** - * Macro to build the vertical 16 bits version of vc1_put_shift[13]. - * Here, offset=src_stride. Parameters passed A1 to A4 must use - * %3 (src_stride) and %4 (3*src_stride). - * - * @param NAME Either 1 or 3 - * @see MSPEL_FILTER13_CORE for information on A1->A4 - */ -#define MSPEL_FILTER13_VER_16B(NAME, A1, A2, A3, A4) \ -static void \ -vc1_put_ver_16b_ ## NAME ## _mmx(int16_t *dst, const uint8_t *src, \ - x86_reg src_stride, \ - int rnd, int64_t shift) \ -{ \ - int h = 8; \ - src -= src_stride; \ - __asm__ volatile( \ - LOAD_ROUNDER_MMX("%5") \ - "movq "MANGLE(ff_pw_53)", %%mm5\n\t" \ - "movq "MANGLE(ff_pw_18)", %%mm6\n\t" \ - ".p2align 3 \n\t" \ - "1: \n\t" \ - MSPEL_FILTER13_CORE(DO_UNPACK, "movd 1", A1, A2, A3, A4) \ - NORMALIZE_MMX("%6") \ - TRANSFER_DONT_PACK(OP_PUT) \ - /* Last 3 (in fact 4) bytes on the line */ \ - "movd 8+"A1", %%mm1 \n\t" \ - DO_UNPACK("%%mm1") \ - "movq %%mm1, %%mm3 \n\t" \ - "paddw %%mm1, %%mm1 \n\t" \ - "paddw %%mm3, %%mm1 \n\t" /* 3* */ \ - "movd 8+"A2", %%mm3 \n\t" \ - DO_UNPACK("%%mm3") \ - "pmullw %%mm6, %%mm3 \n\t" /* *18 */ \ - "psubw %%mm1, %%mm3 \n\t" /*18,-3 */ \ - "movd 8+"A3", %%mm1 \n\t" \ - DO_UNPACK("%%mm1") \ - "pmullw %%mm5, %%mm1 \n\t" /* *53 */ \ - "paddw %%mm1, %%mm3 \n\t" /*53,18,-3 */ \ - "movd 8+"A4", %%mm1 \n\t" \ - DO_UNPACK("%%mm1") \ - "psllw $2, %%mm1 \n\t" /* 4* */ \ - "psubw %%mm1, %%mm3 \n\t" \ - "paddw %%mm7, %%mm3 \n\t" \ - "psraw %6, %%mm3 \n\t" \ - "movq %%mm3, 16(%2) \n\t" \ - "add %3, %1 \n\t" \ - "add $24, %2 \n\t" \ - "decl %0 \n\t" \ - "jnz 1b \n\t" \ - : "+r"(h), "+r" (src), "+r" (dst) \ - : "r"(src_stride), "r"(3*src_stride), \ - "m"(rnd), "m"(shift) \ - NAMED_CONSTRAINTS_ADD(ff_pw_3,ff_pw_53,ff_pw_18) \ - : "memory" \ - ); \ -} - -/** - * Macro to build the horizontal 16 bits version of vc1_put_shift[13]. - * Here, offset=16 bits, so parameters passed A1 to A4 should be simple. - * - * @param NAME Either 1 or 3 - * @see MSPEL_FILTER13_CORE for information on A1->A4 - */ -#define MSPEL_FILTER13_HOR_16B(NAME, A1, A2, A3, A4, OP, OPNAME) \ -static void \ -OPNAME ## vc1_hor_16b_ ## NAME ## _mmx(uint8_t *dst, x86_reg stride, \ - const int16_t *src, int rnd) \ -{ \ - int h = 8; \ - src -= 1; \ - rnd -= (-4+58+13-3)*256; /* Add -256 bias */ \ - __asm__ volatile( \ - LOAD_ROUNDER_MMX("%4") \ - "movq "MANGLE(ff_pw_18)", %%mm6 \n\t" \ - "movq "MANGLE(ff_pw_53)", %%mm5 \n\t" \ - ".p2align 3 \n\t" \ - "1: \n\t" \ - MSPEL_FILTER13_CORE(DONT_UNPACK, "movq 2", A1, A2, A3, A4) \ - NORMALIZE_MMX("$7") \ - /* Remove bias */ \ - "paddw "MANGLE(ff_pw_128)", %%mm3 \n\t" \ - "paddw "MANGLE(ff_pw_128)", %%mm4 \n\t" \ - TRANSFER_DO_PACK(OP) \ - "add $24, %1 \n\t" \ - "add %3, %2 \n\t" \ - "decl %0 \n\t" \ - "jnz 1b \n\t" \ - : "+r"(h), "+r" (src), "+r" (dst) \ - : "r"(stride), "m"(rnd) \ - NAMED_CONSTRAINTS_ADD(ff_pw_3,ff_pw_18,ff_pw_53,ff_pw_128) \ - : "memory" \ - ); \ -} - -/** 1/4 shift bicubic interpolation */ -MSPEL_FILTER13_VER_16B(shift1, "0(%1,%4 )", "0(%1,%3,2)", "0(%1,%3 )", "0(%1 )") -MSPEL_FILTER13_HOR_16B(shift1, "2*3(%1)", "2*2(%1)", "2*1(%1)", "2*0(%1)", OP_PUT, put_) -MSPEL_FILTER13_HOR_16B(shift1, "2*3(%1)", "2*2(%1)", "2*1(%1)", "2*0(%1)", OP_AVG, avg_) - -/** 3/4 shift bicubic interpolation */ -MSPEL_FILTER13_VER_16B(shift3, "0(%1 )", "0(%1,%3 )", "0(%1,%3,2)", "0(%1,%4 )") -MSPEL_FILTER13_HOR_16B(shift3, "2*0(%1)", "2*1(%1)", "2*2(%1)", "2*3(%1)", OP_PUT, put_) -MSPEL_FILTER13_HOR_16B(shift3, "2*0(%1)", "2*1(%1)", "2*2(%1)", "2*3(%1)", OP_AVG, avg_) - -typedef void (*vc1_mspel_mc_filter_ver_16bits)(int16_t *dst, const uint8_t *src, x86_reg src_stride, int rnd, int64_t shift); -typedef void (*vc1_mspel_mc_filter_hor_16bits)(uint8_t *dst, x86_reg dst_stride, const int16_t *src, int rnd); - -/** - * Interpolate fractional pel values by applying proper vertical then - * horizontal filter. - * - * @param dst Destination buffer for interpolated pels. - * @param src Source buffer. - * @param stride Stride for both src and dst buffers. - * @param hmode Horizontal filter (expressed in quarter pixels shift). - * @param hmode Vertical filter. - * @param rnd Rounding bias. - */ -#define VC1_MSPEL_MC(OP, INSTR)\ -static void OP ## vc1_mspel_mc(uint8_t *dst, const uint8_t *src, ptrdiff_t stride,\ - int hmode, int vmode, int rnd)\ -{\ - static const vc1_mspel_mc_filter_ver_16bits vc1_put_shift_ver_16bits[] =\ - { NULL, vc1_put_ver_16b_shift1_mmx, ff_vc1_put_ver_16b_shift2_mmx, vc1_put_ver_16b_shift3_mmx };\ - static const vc1_mspel_mc_filter_hor_16bits vc1_put_shift_hor_16bits[] =\ - { NULL, OP ## vc1_hor_16b_shift1_mmx, ff_vc1_ ## OP ## hor_16b_shift2_ ## INSTR, OP ## vc1_hor_16b_shift3_mmx };\ -\ - __asm__ volatile(\ - "pxor %%mm0, %%mm0 \n\t"\ - ::: "memory"\ - );\ -\ - static const int shift_value[] = { 0, 5, 1, 5 };\ - int shift = (shift_value[hmode]+shift_value[vmode])>>1;\ - int r;\ - LOCAL_ALIGNED(16, int16_t, tmp, [12*8]);\ -\ - r = (1<<(shift-1)) + rnd-1;\ - vc1_put_shift_ver_16bits[vmode](tmp, src-1, stride, r, shift);\ -\ - vc1_put_shift_hor_16bits[hmode](dst, stride, tmp+1, 64-rnd);\ -} \ -static void OP ## vc1_mspel_mc_16(uint8_t *dst, const uint8_t *src, \ - int stride, int hmode, int vmode, int rnd)\ -{ \ - OP ## vc1_mspel_mc(dst + 0, src + 0, stride, hmode, vmode, rnd); \ - OP ## vc1_mspel_mc(dst + 8, src + 8, stride, hmode, vmode, rnd); \ - dst += 8*stride; src += 8*stride; \ - OP ## vc1_mspel_mc(dst + 0, src + 0, stride, hmode, vmode, rnd); \ - OP ## vc1_mspel_mc(dst + 8, src + 8, stride, hmode, vmode, rnd); \ -} - -VC1_MSPEL_MC(put_, mmx) -VC1_MSPEL_MC(avg_, mmxext) - -/** Macro to ease bicubic filter interpolation functions declarations */ -#define DECLARE_FUNCTION(a, b) \ -static void put_vc1_mspel_mc ## a ## b ## _mmx(uint8_t *dst, \ - const uint8_t *src, \ - ptrdiff_t stride, \ - int rnd) \ -{ \ - put_vc1_mspel_mc(dst, src, stride, a, b, rnd); \ -}\ -static void avg_vc1_mspel_mc ## a ## b ## _mmxext(uint8_t *dst, \ - const uint8_t *src, \ - ptrdiff_t stride, \ - int rnd) \ -{ \ - avg_vc1_mspel_mc(dst, src, stride, a, b, rnd); \ -}\ -static void put_vc1_mspel_mc ## a ## b ## _16_mmx(uint8_t *dst, \ - const uint8_t *src, \ - ptrdiff_t stride, \ - int rnd) \ -{ \ - put_vc1_mspel_mc_16(dst, src, stride, a, b, rnd); \ -}\ -static void avg_vc1_mspel_mc ## a ## b ## _16_mmxext(uint8_t *dst, \ - const uint8_t *src,\ - ptrdiff_t stride, \ - int rnd) \ -{ \ - avg_vc1_mspel_mc_16(dst, src, stride, a, b, rnd); \ -} - -DECLARE_FUNCTION(1, 1) -DECLARE_FUNCTION(1, 2) -DECLARE_FUNCTION(1, 3) - -DECLARE_FUNCTION(2, 1) -DECLARE_FUNCTION(2, 2) -DECLARE_FUNCTION(2, 3) - -DECLARE_FUNCTION(3, 1) -DECLARE_FUNCTION(3, 2) -DECLARE_FUNCTION(3, 3) - -#define FN_ASSIGN(OP, X, Y, INSN) \ - dsp->OP##vc1_mspel_pixels_tab[1][X+4*Y] = OP##vc1_mspel_mc##X##Y##INSN; \ - dsp->OP##vc1_mspel_pixels_tab[0][X+4*Y] = OP##vc1_mspel_mc##X##Y##_16##INSN - -av_cold void ff_vc1dsp_init_mmx(VC1DSPContext *dsp) -{ - FN_ASSIGN(put_, 1, 1, _mmx); - FN_ASSIGN(put_, 1, 2, _mmx); - FN_ASSIGN(put_, 1, 3, _mmx); - - FN_ASSIGN(put_, 2, 1, _mmx); - FN_ASSIGN(put_, 2, 2, _mmx); - FN_ASSIGN(put_, 2, 3, _mmx); - - FN_ASSIGN(put_, 3, 1, _mmx); - FN_ASSIGN(put_, 3, 2, _mmx); - FN_ASSIGN(put_, 3, 3, _mmx); -} - -av_cold void ff_vc1dsp_init_mmxext(VC1DSPContext *dsp) -{ - FN_ASSIGN(avg_, 1, 1, _mmxext); - FN_ASSIGN(avg_, 1, 2, _mmxext); - FN_ASSIGN(avg_, 1, 3, _mmxext); - - FN_ASSIGN(avg_, 2, 1, _mmxext); - FN_ASSIGN(avg_, 2, 2, _mmxext); - FN_ASSIGN(avg_, 2, 3, _mmxext); - - FN_ASSIGN(avg_, 3, 1, _mmxext); - FN_ASSIGN(avg_, 3, 2, _mmxext); - FN_ASSIGN(avg_, 3, 3, _mmxext); -} -#endif /* HAVE_X86_6REGS && HAVE_INLINE_ASM && HAVE_MMX_EXTERNAL */ diff --git a/tests/checkasm/vc1dsp.c b/tests/checkasm/vc1dsp.c index 52049a4aa3..532fcae63b 100644 --- a/tests/checkasm/vc1dsp.c +++ b/tests/checkasm/vc1dsp.c @@ -483,7 +483,7 @@ static void check_mspel_pixels(void) for (unsigned dxy = 0; dxy < 16; ++dxy) { if (!check_func(func[j][dxy], "vc1dsp.%s_mc%u%u_%u", tests[k].name, dxy & 3, dxy >> 2, blocksize)) continue; - declare_func_emms(AV_CPU_FLAG_MMX, void, uint8_t *, const uint8_t*, ptrdiff_t, int); + declare_func(void, uint8_t *, const uint8_t*, ptrdiff_t, int); size_t dst_offset = (rnd() % (MAX_BLOCK_SIZE / blocksize)) * blocksize; ptrdiff_t stride = (rnd() % (MAX_STRIDE / blocksize) + 1) * blocksize; size_t src_offset = 1 + stride + rnd() % MAX_BLOCK_SIZE; -- To stop receiving notification emails like this one, please contact [email protected]. _______________________________________________ ffmpeg-cvslog mailing list -- [email protected] To unsubscribe send an email to [email protected]
