From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> To: ffmpeg-devel@ffmpeg.org Cc: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> Subject: [FFmpeg-devel] [PATCH 33/41] avcodec/x86/h264_qpel: Disable overridden functions on x64 Date: Fri, 10 Jun 2022 01:55:15 +0200 Message-ID: <DB6PR0101MB2214EB7F33C2C0EC0F495DE58FA79@DB6PR0101MB2214.eurprd01.prod.exchangelabs.com> (raw) In-Reply-To: <DB6PR0101MB2214F3355A6887EB7203DAA38FA79@DB6PR0101MB2214.eurprd01.prod.exchangelabs.com> x64 always has MMX, MMXEXT, SSE and SSE2 and this means that some functions for MMX, MMXEXT, SSE and 3dnow are always overridden by other functions (unless one e.g. explicitly disables SSE2). This commit therefore disables several MMXEXT functions (that are overridden by SSE2 functions) at compile-time for x64. Notice that some 10-bit SSE2 functions are overridden by sse2_cache64 functions in the same code block. This is suboptimal and the functions that are overridden should either be removed or the sse2_cache64 functions be put behind suitable checks. This commit does neither. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> --- I would love to get input on what to do with these sse2_cache64 functions. If no one says anything, I will send a patch that retains the current behaviour and removes the functions overridden by the sse2_cache64 functions. libavcodec/x86/h264_qpel.c | 44 +++++++++++++++++++++---------- libavcodec/x86/h264_qpel_8bit.asm | 4 +++ 2 files changed, 34 insertions(+), 14 deletions(-) diff --git a/libavcodec/x86/h264_qpel.c b/libavcodec/x86/h264_qpel.c index fd1070247b..cb5f8a126c 100644 --- a/libavcodec/x86/h264_qpel.c +++ b/libavcodec/x86/h264_qpel.c @@ -236,7 +236,11 @@ static av_always_inline void ff_ ## OPNAME ## h264_qpel16_hv_lowpass_ ## MMX(uin #define ff_put_h264_qpel8or16_hv2_lowpass_sse2 ff_put_h264_qpel8or16_hv2_lowpass_mmxext #define ff_avg_h264_qpel8or16_hv2_lowpass_sse2 ff_avg_h264_qpel8or16_hv2_lowpass_mmxext -#define H264_MC(OPNAME, SIZE, MMX, ALIGN) \ +#define H264_MC_C_H(OPNAME, SIZE, MMX, ALIGN) \ +H264_MC_C(OPNAME, SIZE, MMX, ALIGN)\ +H264_MC_H(OPNAME, SIZE, MMX, ALIGN)\ + +#define H264_MC_C_V_H_HV(OPNAME, SIZE, MMX, ALIGN) \ H264_MC_C(OPNAME, SIZE, MMX, ALIGN)\ H264_MC_V(OPNAME, SIZE, MMX, ALIGN)\ H264_MC_H(OPNAME, SIZE, MMX, ALIGN)\ @@ -372,13 +376,9 @@ static void OPNAME ## h264_qpel ## SIZE ## _mc32_ ## MMX(uint8_t *dst, const uin ff_ ## OPNAME ## pixels ## SIZE ## _l2_shift5_mmxext(dst, halfV+3, halfHV, stride, SIZE, SIZE);\ }\ -#define H264_MC_4816(MMX)\ -H264_MC(put_, 4, MMX, 8)\ -H264_MC(put_, 8, MMX, 8)\ -H264_MC(put_, 16,MMX, 8)\ -H264_MC(avg_, 4, MMX, 8)\ -H264_MC(avg_, 8, MMX, 8)\ -H264_MC(avg_, 16,MMX, 8)\ +#define H264_MC(QPEL, SIZE, MMX, ALIGN)\ +QPEL(put_, SIZE, MMX, ALIGN) \ +QPEL(avg_, SIZE, MMX, ALIGN) \ #define H264_MC_816(QPEL, XMM)\ QPEL(put_, 8, XMM, 16)\ @@ -397,7 +397,14 @@ QPEL_H264_H_XMM(avg_,AVG_MMXEXT_OP, ssse3) QPEL_H264_HV_XMM(put_, PUT_OP, ssse3) QPEL_H264_HV_XMM(avg_,AVG_MMXEXT_OP, ssse3) -H264_MC_4816(mmxext) +H264_MC(H264_MC_C_V_H_HV, 4, mmxext, 8) +#if ARCH_X86_32 +H264_MC(H264_MC_C_V_H_HV, 8, mmxext, 8) +H264_MC(H264_MC_C_V_H_HV, 16, mmxext, 8) +#else +H264_MC(H264_MC_C_H, 8, mmxext, 8) +H264_MC(H264_MC_C_H, 16, mmxext, 8) +#endif H264_MC_816(H264_MC_V, sse2) H264_MC_816(H264_MC_HV, sse2) H264_MC_816(H264_MC_H, ssse3) @@ -499,12 +506,16 @@ QPEL16(mmxext) #endif /* HAVE_X86ASM */ -#define SET_QPEL_FUNCS(PFX, IDX, SIZE, CPU, PREFIX) \ +#define SET_QPEL_FUNCS0123(PFX, IDX, SIZE, CPU, PREFIX) \ do { \ c->PFX ## _pixels_tab[IDX][ 0] = PREFIX ## PFX ## SIZE ## _mc00_ ## CPU; \ c->PFX ## _pixels_tab[IDX][ 1] = PREFIX ## PFX ## SIZE ## _mc10_ ## CPU; \ c->PFX ## _pixels_tab[IDX][ 2] = PREFIX ## PFX ## SIZE ## _mc20_ ## CPU; \ c->PFX ## _pixels_tab[IDX][ 3] = PREFIX ## PFX ## SIZE ## _mc30_ ## CPU; \ + } while (0) +#define SET_QPEL_FUNCS(PFX, IDX, SIZE, CPU, PREFIX) \ + do { \ + SET_QPEL_FUNCS0123(PFX, IDX, SIZE, CPU, PREFIX); \ c->PFX ## _pixels_tab[IDX][ 4] = PREFIX ## PFX ## SIZE ## _mc01_ ## CPU; \ c->PFX ## _pixels_tab[IDX][ 5] = PREFIX ## PFX ## SIZE ## _mc11_ ## CPU; \ c->PFX ## _pixels_tab[IDX][ 6] = PREFIX ## PFX ## SIZE ## _mc21_ ## CPU; \ @@ -543,11 +554,16 @@ av_cold void ff_h264qpel_init_x86(H264QpelContext *c, int bit_depth) if (EXTERNAL_MMXEXT(cpu_flags)) { if (!high_bit_depth) { - SET_QPEL_FUNCS(put_h264_qpel, 0, 16, mmxext, ); - SET_QPEL_FUNCS(put_h264_qpel, 1, 8, mmxext, ); +#if ARCH_X86_32 +#define SET_MMXEXT_QPEL_FUNCS(PFX, IDX, SIZE, CPU, PREFIX) SET_QPEL_FUNCS(PFX, IDX, SIZE, CPU, PREFIX) +#else +#define SET_MMXEXT_QPEL_FUNCS(PFX, IDX, SIZE, CPU, PREFIX) SET_QPEL_FUNCS0123(PFX, IDX, SIZE, CPU, PREFIX) +#endif + SET_MMXEXT_QPEL_FUNCS(put_h264_qpel, 0, 16, mmxext, ); + SET_MMXEXT_QPEL_FUNCS(put_h264_qpel, 1, 8, mmxext, ); SET_QPEL_FUNCS(put_h264_qpel, 2, 4, mmxext, ); - SET_QPEL_FUNCS(avg_h264_qpel, 0, 16, mmxext, ); - SET_QPEL_FUNCS(avg_h264_qpel, 1, 8, mmxext, ); + SET_MMXEXT_QPEL_FUNCS(avg_h264_qpel, 0, 16, mmxext, ); + SET_MMXEXT_QPEL_FUNCS(avg_h264_qpel, 1, 8, mmxext, ); SET_QPEL_FUNCS(avg_h264_qpel, 2, 4, mmxext, ); } else if (bit_depth == 10) { #if ARCH_X86_32 diff --git a/libavcodec/x86/h264_qpel_8bit.asm b/libavcodec/x86/h264_qpel_8bit.asm index 03c7d88f8c..72e98248d8 100644 --- a/libavcodec/x86/h264_qpel_8bit.asm +++ b/libavcodec/x86/h264_qpel_8bit.asm @@ -461,9 +461,11 @@ cglobal %1_h264_qpel8or16_v_lowpass_op, 5,5,8 ; dst, src, dstStride, srcStride, REP_RET %endmacro +%if ARCH_X86_32 INIT_MMX mmxext QPEL8OR16_V_LOWPASS_OP put QPEL8OR16_V_LOWPASS_OP avg +%endif INIT_XMM sse2 QPEL8OR16_V_LOWPASS_OP put @@ -581,8 +583,10 @@ cglobal %1_h264_qpel8or16_hv1_lowpass_op, 4,4,8 ; src, tmp, srcStride, size REP_RET %endmacro +%if ARCH_X86_32 INIT_MMX mmxext QPEL8OR16_HV1_LOWPASS_OP put +%endif INIT_XMM sse2 QPEL8OR16_HV1_LOWPASS_OP put -- 2.34.1 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
next prev parent reply other threads:[~2022-06-10 0:01 UTC|newest] Thread overview: 46+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-06-09 23:15 [FFmpeg-devel] [PATCH 00/41] Stop including superseded functions for x64 Andreas Rheinhardt 2022-06-09 23:54 ` [FFmpeg-devel] [PATCH 01/41] avcodec/x86/qpeldsp: Remove unused ff_put_no_rnd_pixels16_l2_3dnow Andreas Rheinhardt 2022-06-09 23:54 ` [FFmpeg-devel] [PATCH 02/41] avcodec/x86/hevcdsp_init: Remove unnecessary inclusion of get_bits.h Andreas Rheinhardt 2022-06-09 23:54 ` [FFmpeg-devel] [PATCH 03/41] avcodec/hevcdec: Make ff_hevc_pel_weight static Andreas Rheinhardt 2022-06-09 23:54 ` [FFmpeg-devel] [PATCH 04/41] avcodec/v4l2_m2m: Remove unused ff_v4l2_m2m_codec_full_reinit Andreas Rheinhardt 2022-06-09 23:54 ` [FFmpeg-devel] [PATCH 05/41] avcodec/videodsp: Make ff_emulated_edge_mc_16 static Andreas Rheinhardt 2022-06-10 15:50 ` Ronald S. Bultje 2022-06-10 16:07 ` Andreas Rheinhardt 2022-06-09 23:54 ` [FFmpeg-devel] [PATCH 06/41] avcodec/x86/fpel: Remove unused ff_avg_pixels4_mmx Andreas Rheinhardt 2022-06-09 23:54 ` [FFmpeg-devel] [PATCH 07/41] avcodec/x86/rv34dsp: Remove unused ff_rv34_idct_dc_mmxext Andreas Rheinhardt 2022-06-09 23:54 ` [FFmpeg-devel] [PATCH 08/41] avcodec/x86/h264_qpel_8bit: Remove unused function Andreas Rheinhardt 2022-06-09 23:54 ` [FFmpeg-devel] [PATCH 09/41] avcodec/x86/vc1dsp_init: Disable overridden functions on x64 Andreas Rheinhardt 2022-06-09 23:54 ` [FFmpeg-devel] [PATCH 10/41] avcodec/x86/ac3dsp_init: " Andreas Rheinhardt 2022-06-09 23:54 ` [FFmpeg-devel] [PATCH 11/41] avcodec/x86/audiodsp_init: " Andreas Rheinhardt 2022-06-09 23:54 ` [FFmpeg-devel] [PATCH 12/41] avcodec/x86/diracdsp_init: " Andreas Rheinhardt 2022-06-09 23:54 ` [FFmpeg-devel] [PATCH 13/41] avcodec/x86/mpegvideoenc: " Andreas Rheinhardt 2022-06-09 23:54 ` [FFmpeg-devel] [PATCH 14/41] avcodec/x86/fdct: " Andreas Rheinhardt 2022-06-09 23:54 ` [FFmpeg-devel] [PATCH 15/41] avcodec/x86/hevcdsp_init: " Andreas Rheinhardt 2022-06-09 23:54 ` [FFmpeg-devel] [PATCH 16/41] avcodec/x86/rv40dsp_init: " Andreas Rheinhardt 2022-06-09 23:54 ` [FFmpeg-devel] [PATCH 17/41] avcodec/x86/cavsdsp: " Andreas Rheinhardt 2022-06-09 23:55 ` [FFmpeg-devel] [PATCH 18/41] avcodec/x86/h264_intrapred_init: " Andreas Rheinhardt 2022-06-09 23:55 ` [FFmpeg-devel] [PATCH 19/41] avfilter/x86/vf_noise: " Andreas Rheinhardt 2022-06-09 23:55 ` [FFmpeg-devel] [PATCH 20/41] avcodec/x86/me_cmp: " Andreas Rheinhardt 2022-06-09 23:55 ` [FFmpeg-devel] [PATCH 21/41] avcodec/x86/mpegvideoencdsp: Disable ff_pix_norm1_mmx " Andreas Rheinhardt 2022-06-09 23:55 ` [FFmpeg-devel] [PATCH 22/41] avcodec/x86/h264dsp_init: Disable overridden functions " Andreas Rheinhardt 2022-06-09 23:55 ` [FFmpeg-devel] [PATCH 23/41] avcodec/x86/sbrdsp_init: " Andreas Rheinhardt 2022-06-09 23:55 ` [FFmpeg-devel] [PATCH 24/41] avcodec/x86/idctdsp_init: " Andreas Rheinhardt 2022-06-09 23:55 ` [FFmpeg-devel] [PATCH 25/41] avcodec/x86/blockdsp_init: " Andreas Rheinhardt 2022-06-09 23:55 ` [FFmpeg-devel] [PATCH 26/41] avcodec/x86/pixblockdsp_init: " Andreas Rheinhardt 2022-06-09 23:55 ` [FFmpeg-devel] [PATCH 27/41] avcodec/x86/lossless_audiodsp_init: " Andreas Rheinhardt 2022-06-09 23:55 ` [FFmpeg-devel] [PATCH 28/41] avcodec/x86/svq1enc_init: " Andreas Rheinhardt 2022-06-09 23:55 ` [FFmpeg-devel] [PATCH 29/41] avcodec/x86/fmtconvert_init: " Andreas Rheinhardt 2022-06-09 23:55 ` [FFmpeg-devel] [PATCH 30/41] avcodec/x86/hpeldsp_vp3_init: " Andreas Rheinhardt 2022-06-09 23:55 ` [FFmpeg-devel] [PATCH 31/41] avcodec/x86/hpeldsp_init: " Andreas Rheinhardt 2022-06-09 23:55 ` [FFmpeg-devel] [PATCH 32/41] avcodec/x86/h264_qpel: Make functions only used here static Andreas Rheinhardt 2022-06-09 23:55 ` Andreas Rheinhardt [this message] 2022-06-09 23:55 ` [FFmpeg-devel] [PATCH 34/41] avcodec/x86/h264chroma_init: Disable overridden functions on x64 Andreas Rheinhardt 2022-06-09 23:55 ` [FFmpeg-devel] [PATCH 35/41] swresample/x86/audio_convert_init: " Andreas Rheinhardt 2022-06-09 23:55 ` [FFmpeg-devel] [PATCH 36/41] swresample/x86/rematrix_init: " Andreas Rheinhardt 2022-06-09 23:55 ` [FFmpeg-devel] [PATCH 37/41] swscale/x86/rgb2rgb: " Andreas Rheinhardt 2022-06-09 23:55 ` [FFmpeg-devel] [PATCH 38/41] swscale/x86/yuv2rgb: " Andreas Rheinhardt 2022-06-09 23:55 ` [FFmpeg-devel] [PATCH 39/41] swscale/x86/swscale: " Andreas Rheinhardt 2022-06-09 23:55 ` [FFmpeg-devel] [PATCH 40/41] avfilter/x86/vf_eq_init: " Andreas Rheinhardt 2022-06-09 23:55 ` [FFmpeg-devel] [PATCH 41/41] avutil/x86/pixelutils_init: " Andreas Rheinhardt 2022-06-11 20:14 ` [FFmpeg-devel] [PATCH 00/41] Stop including superseded functions for x64 Andreas Rheinhardt 2022-06-20 11:16 ` Andreas Rheinhardt
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=DB6PR0101MB2214EB7F33C2C0EC0F495DE58FA79@DB6PR0101MB2214.eurprd01.prod.exchangelabs.com \ --to=andreas.rheinhardt@outlook.com \ --cc=ffmpeg-devel@ffmpeg.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel This inbox may be cloned and mirrored by anyone: git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git # If you have public-inbox 1.1+ installed, you may # initialize and index your mirror using the following commands: public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \ ffmpegdev@gitmailbox.com public-inbox-index ffmpegdev Example config snippet for mirrors. AGPL code for this site: git clone https://public-inbox.org/public-inbox.git