From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 4868E4A9A1 for ; Wed, 5 Jun 2024 20:51:29 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 7562668D5B7; Wed, 5 Jun 2024 23:51:28 +0300 (EEST) Received: from mail-pf1-f177.google.com (mail-pf1-f177.google.com [209.85.210.177]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 3265C68D250 for ; Wed, 5 Jun 2024 23:51:22 +0300 (EEST) Received: by mail-pf1-f177.google.com with SMTP id d2e1a72fcca58-7025e7a42dcso174007b3a.1 for ; Wed, 05 Jun 2024 13:51:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1717620679; x=1718225479; darn=ffmpeg.org; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:from:to:cc:subject:date:message-id:reply-to; bh=eXvyMhFEJnp+zS4gn13ECfFnaaLd802k4fSv0xE6glI=; b=ca3mH8+Vo5gmR1jM9EdUWfKyoaclV9iBfcQdLaMsHJ3h1ZcswPpQvXI5AA2VUOOdq/ Fp2Lup+MwRAgS72syeZmrtjrvuyWYCsuWOrpAwPogtHOnKdg6c2mD26vqMEtxiHD1dgc zn3qSm0hO3cL0C/SmUXfzlZVL8DhS0IhpyiBOlTs/pR4mVB9ZImqiqI73aNgPMM76bjT Z5hDBa6zZLc26G2FayFt420I3YbItNoWe49kVMSzSJdThHO2vsbIwfoV2kQENiF1lUAc R74d+H1+q9UlKVbV0mhCMoCFxlmJSX3Jb0Y9sQ9YMDL4X6qHbfDNp9wqQmPBuAN/e0Yf wiqw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717620679; x=1718225479; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=eXvyMhFEJnp+zS4gn13ECfFnaaLd802k4fSv0xE6glI=; b=mDPUAIF3ZJW8JKyl/pv9k5abrP66aYt0cpIcYBZTRLIaXf04fFrbh0fdgUkb+Y4L0z KLXjic7dS9w430lWq8remd1tbDkvmEaVCF3wSdyuZqdmXyLTy+gA5U9Wc5zTgdmArh3d qzSzOKbXRAuYT0XBT05DHuA72llmC0/ds2dNyrpq2yjdScX3R8PH6zVxGKkpOou7SpGo 7lVB+/KZ24oLxydpC+weR77oDaIPhsPFsgH1QlZ5ngbdSgOC1tMKli3CA2ZhWB0DbMur znt3Fa7mmJI3w4z72ncJb0ATqIEjEjSrFtows0WJ9OLcvk3UgQrRCIGcJ4lMA2tFNdff X08w== X-Gm-Message-State: AOJu0YyHoufaw3ewIo/GpIpciOFp+96cTTN90p3QMKYlIRWvVHlcrCvq CWjsDQDfL4JX91kum4o/FhlkVl08VL4VyBNqf1EPf4O12eScncdpMFMrfw== X-Google-Smtp-Source: AGHT+IFyfQFgvWYdjK1PT/Boj0PjKC/cyYvze1jPxtfstVs3FjxvZ73ND1SIJwsTFIpKY2F8b0cKLg== X-Received: by 2002:a05:6a00:1397:b0:6ed:60a4:6d9c with SMTP id d2e1a72fcca58-703e5921394mr4090937b3a.4.1717620678436; Wed, 05 Jun 2024 13:51:18 -0700 (PDT) Received: from localhost.localdomain ([190.194.167.233]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-703e5b54885sm1731288b3a.161.2024.06.05.13.51.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Jun 2024 13:51:17 -0700 (PDT) From: James Almer To: ffmpeg-devel@ffmpeg.org Date: Wed, 5 Jun 2024 17:51:16 -0300 Message-ID: <20240605205116.3258-1-jamrial@gmail.com> X-Mailer: git-send-email 2.45.1 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH] swscale/x86/rgb2rgb: replace shuffle_bytes_2103_mmxext with an SSE2 version X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: shuffle_bytes_2103_c: 46.5 shuffle_bytes_2103_mmxext: 29.3 shuffle_bytes_2103_sse2: 12.5 Signed-off-by: James Almer --- libswscale/x86/rgb2rgb.c | 6 ++---- libswscale/x86/rgb_2_rgb.asm | 30 +++++++++++------------------- 2 files changed, 13 insertions(+), 23 deletions(-) diff --git a/libswscale/x86/rgb2rgb.c b/libswscale/x86/rgb2rgb.c index 21ccfafe51..912fe431b3 100644 --- a/libswscale/x86/rgb2rgb.c +++ b/libswscale/x86/rgb2rgb.c @@ -116,7 +116,7 @@ DECLARE_ALIGNED(8, extern const uint64_t, ff_bgr2UVOffset); #endif /* HAVE_INLINE_ASM */ -void ff_shuffle_bytes_2103_mmxext(const uint8_t *src, uint8_t *dst, int src_size); +void ff_shuffle_bytes_2103_sse2(const uint8_t *src, uint8_t *dst, int src_size); void ff_shuffle_bytes_2103_ssse3(const uint8_t *src, uint8_t *dst, int src_size); void ff_shuffle_bytes_0321_ssse3(const uint8_t *src, uint8_t *dst, int src_size); void ff_shuffle_bytes_1230_ssse3(const uint8_t *src, uint8_t *dst, int src_size); @@ -154,10 +154,8 @@ av_cold void rgb2rgb_init_x86(void) rgb2rgb_init_avx(); #endif /* HAVE_INLINE_ASM */ - if (EXTERNAL_MMXEXT(cpu_flags)) { - shuffle_bytes_2103 = ff_shuffle_bytes_2103_mmxext; - } if (EXTERNAL_SSE2(cpu_flags)) { + shuffle_bytes_2103 = ff_shuffle_bytes_2103_sse2; #if ARCH_X86_64 uyvytoyuv422 = ff_uyvytoyuv422_sse2; #endif diff --git a/libswscale/x86/rgb_2_rgb.asm b/libswscale/x86/rgb_2_rgb.asm index 0bf1278718..2d2ac778b7 100644 --- a/libswscale/x86/rgb_2_rgb.asm +++ b/libswscale/x86/rgb_2_rgb.asm @@ -25,7 +25,7 @@ SECTION_RODATA -pb_mask_shuffle2103_mmx times 8 dw 255 +pb_mask_shuffle2103 times 8 dw 255 pb_shuffle2103: db 2, 1, 0, 3, 6, 5, 4, 7, 10, 9, 8, 11, 14, 13, 12, 15 pb_shuffle0321: db 0, 3, 2, 1, 4, 7, 6, 5, 8, 11, 10, 9, 12, 15, 14, 13 pb_shuffle1230: db 1, 2, 3, 0, 5, 6, 7, 4, 9, 10, 11, 8, 13, 14, 15, 12 @@ -50,11 +50,10 @@ SECTION .text ;------------------------------------------------------------------------------ ; shuffle_bytes_2103_mmext (const uint8_t *src, uint8_t *dst, int src_size) ;------------------------------------------------------------------------------ -INIT_MMX mmxext -cglobal shuffle_bytes_2103, 3, 5, 8, src, dst, w, tmp, x - mova m6, [pb_mask_shuffle2103_mmx] - mova m7, m6 - psllq m7, 8 +INIT_XMM sse2 +cglobal shuffle_bytes_2103, 3, 5, 4, src, dst, w, tmp, x + mova m2, [pb_mask_shuffle2103] + psllq m3, m2, 8 movsxdifnidn wq, wd mov xq, wq @@ -86,28 +85,21 @@ jge .end .loop_simd: movu m0, [srcq+wq] - movu m1, [srcq+wq+8] - - pshufw m3, m0, 177 - pshufw m5, m1, 177 - pand m0, m7 - pand m3, m6 + pshuflw m1, m0, 0xb1 + pshufhw m1, m1, 0xb1 - pand m1, m7 - pand m5, m6 + pand m0, m3 + pand m1, m2 - por m0, m3 - por m1, m5 + por m0, m1 movu [dstq+wq], m0 - movu [dstq+wq + 8], m1 - add wq, mmsize*2 + add wq, mmsize jl .loop_simd .end: - emms RET ;------------------------------------------------------------------------------ -- 2.45.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".