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 7FE124A8F8 for ; Thu, 23 May 2024 12:28:26 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 810E968D4BD; Thu, 23 May 2024 15:28:03 +0300 (EEST) Received: from mail-pl1-f176.google.com (mail-pl1-f176.google.com [209.85.214.176]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id D9A6068D359 for ; Thu, 23 May 2024 15:27:54 +0300 (EEST) Received: by mail-pl1-f176.google.com with SMTP id d9443c01a7336-1f082d92864so122033005ad.1 for ; Thu, 23 May 2024 05:27:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1716467272; x=1717072072; darn=ffmpeg.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=R3r6NE177Cm/Y6zumu+K7fY8Spz32BAjPndW0/1HGH0=; b=e/2n6wBLYIzwfuBB+IzF8gSlYqt69ewshKpc6DCHehdf9BAAYJ6C/PtJlao5pLJRRs ejgHYSrG/STZ5rwHCX9+o/lBPgf6XSo2gevSs3CJOtXemqMm2xas7+SRS8WaxxFtKing cFf3dreBESytS+THnKp/j2jpLsSZ7hL8gM+WGLNP9eCb0fjCHD91CoqXRac+bLGpO5tm YqWDND0vrHrWqC7zt/jvWc0Sr5UJQtMQSgUOJ8JNlz69F07heAY17rGYJSkyQU+yRSVU A5bIcjXXmWTTgCGANPE3Wylxy26PtqeFxZtEn5ZvoKEmYpy7l9elD/nAD7tmbBBTae/v udRA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716467272; x=1717072072; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=R3r6NE177Cm/Y6zumu+K7fY8Spz32BAjPndW0/1HGH0=; b=ZksbQ3P0+WBaIOKkckfBnnN5dz+/VrTmSbfzivkpYwNeish/HQkhfJmUewu9U9PT3L 4rwvAiUh6d4D99oHsbb2eR1hjst9MmRwEdCMqLF7slNv1ceSAyBaV/wrjcZ0kEoX1jMI 2lq/vJtex8AIrD9zfEQzzWDwbLEAU4ie2KAstXzXFMMp+h8NuigHYuIGWeUaUi7+GchT tFtDCfn2WckvLHXORyPW6UcSQLewIR0Df6WQZkbVb5pvYas4d65B9vKzPmHyR4CaKLia Cnvt2Gt1Arz30CbXwfyPYDb/rxgWE+Nl+FgTc/9Ydx9vZQ5skFr162OYDsPaJzTk+YT5 z7OA== X-Gm-Message-State: AOJu0Yw3GCu+LQximkb8HjlvYdO5IRhzI71PSNGrRFEOjdzpuHasuFYk 2y4MSRI62zDOoKd/mZedGPUi/Otwp+ry6cI2vCsr0qNQ7kFQfFfg9HXsug== X-Google-Smtp-Source: AGHT+IFSnPr1Yu8W7bjOhVilgTY446xegKzLkIiuuS3dWdSSIwdfPdLr5ZgYnPGOjJrPYS6zaVN0Bg== X-Received: by 2002:a17:902:c405:b0:1f3:a6f:9de2 with SMTP id d9443c01a7336-1f31c9d027dmr57381065ad.50.1716467272066; Thu, 23 May 2024 05:27:52 -0700 (PDT) Received: from localhost.localdomain ([190.194.167.233]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1f335da4b87sm16158405ad.100.2024.05.23.05.27.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 May 2024 05:27:51 -0700 (PDT) From: James Almer To: ffmpeg-devel@ffmpeg.org Date: Thu, 23 May 2024 09:27:15 -0300 Message-ID: <20240523122716.2158-4-jamrial@gmail.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240523122716.2158-1-jamrial@gmail.com> References: <20240523122716.2158-1-jamrial@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 4/5] x86/vvc_sad: reduce gpr usage in all loop functions 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: This way they can be assembled on x86_32 targets. Signed-off-by: James Almer --- libavcodec/x86/vvc/vvc_sad.asm | 22 ++++++++++------------ libavcodec/x86/vvc/vvcdsp_init.c | 16 +++++++++++++--- 2 files changed, 23 insertions(+), 15 deletions(-) diff --git a/libavcodec/x86/vvc/vvc_sad.asm b/libavcodec/x86/vvc/vvc_sad.asm index 26df25ec66..9881b1180d 100644 --- a/libavcodec/x86/vvc/vvc_sad.asm +++ b/libavcodec/x86/vvc/vvc_sad.asm @@ -49,7 +49,7 @@ SECTION .text %endmacro %macro VVC_SAD 1 -cglobal vvc_sad_%1, 4, 7, 5, src1, src2, dx, dy, off1, block_h, off2 +cglobal vvc_sad_%1, 4, 6, 5, src1, src2, dx, dy, off, block_h %if UNIX64 == 0 mov block_hd, dword r5m %endif @@ -59,12 +59,12 @@ cglobal vvc_sad_%1, 4, 7, 5, src1, src2, dx, dy, off1, block_h, off2 sub dxq, 2 sub dyq, 2 - mov off1q, 2 - mov off2q, 2 + mov offq, 2 - add off1q, dyq - sub off2q, dyq + sub offq, dyq + add dyq, 2 +DEFINE_ARGS src1, src2, dx, off1, off2, block_h shl off1q, 7 shl off2q, 7 @@ -100,19 +100,19 @@ cglobal vvc_sad_%1, 4, 7, 5, src1, src2, dx, dy, off1, block_h, off2 %endmacro %macro VVC_SAD_LOOP 1 -cglobal vvc_sad_%1, 6, 8, 5, src1, src2, dx, dy, block_w, block_h, off1, off2 +cglobal vvc_sad_%1, 6, 7, 5, src1, src2, dx, dy, block_w, block_h, off movsxdifnidn dxq, dxd movsxdifnidn dyq, dyd sub dxq, 2 sub dyq, 2 - mov off1q, 2 - mov off2q, 2 + mov offq, 2 - add off1q, dyq - sub off2q, dyq + sub offq, dyq + add dyq, 2 +DEFINE_ARGS src1, src2, dx, off1, block_w, block_h, off2 shl off1q, 7 shl off2q, 7 @@ -159,7 +159,6 @@ DEFINE_ARGS src1, src2, dx, dy, block_w, block_h, row_idx RET %endmacro -%if ARCH_X86_64 INIT_XMM sse4 VVC_SAD 8 VVC_SAD_LOOP 16 @@ -168,4 +167,3 @@ INIT_YMM avx2 VVC_SAD 16 VVC_SAD_LOOP 32 %endif -%endif diff --git a/libavcodec/x86/vvc/vvcdsp_init.c b/libavcodec/x86/vvc/vvcdsp_init.c index cdf0e36b62..c0bd145191 100644 --- a/libavcodec/x86/vvc/vvcdsp_init.c +++ b/libavcodec/x86/vvc/vvcdsp_init.c @@ -311,6 +311,7 @@ ALF_FUNCS(16, 12, avx2) c->alf.filter[CHROMA] = ff_vvc_alf_filter_chroma_##bd##_avx2; \ c->alf.classify = ff_vvc_alf_classify_##bd##_avx2; \ } while (0) +#endif #define SAD_PROTOTYPE(w, opt) \ int bf(ff_vvc_sad, w, opt)(const int16_t *src0, const int16_t *src1, \ @@ -320,17 +321,17 @@ SAD_PROTOTYPE(8, sse4); SAD_PROTOTYPE(16, sse4); SAD_PROTOTYPE(16, avx2); SAD_PROTOTYPE(32, avx2); -#endif void ff_vvc_dsp_init_x86(VVCDSPContext *const c, const int bd) { -#if ARCH_X86_64 const int cpu_flags = av_get_cpu_flags(); switch (bd) { case 8: if (EXTERNAL_SSE4(cpu_flags)) { +#if ARCH_X86_64 MC_LINK_SSE4(8); +#endif c->inter.sad[0] = ff_vvc_sad_8_sse4; c->inter.sad[1] = c->inter.sad[2] = @@ -338,9 +339,11 @@ void ff_vvc_dsp_init_x86(VVCDSPContext *const c, const int bd) c->inter.sad[4] = ff_vvc_sad_16_sse4; } if (EXTERNAL_AVX2_FAST(cpu_flags)) { +#if ARCH_X86_64 ALF_INIT(8); AVG_INIT(8, avx2); MC_LINKS_AVX2(8); +#endif c->inter.sad[1] = ff_vvc_sad_16_avx2; c->inter.sad[2] = c->inter.sad[3] = @@ -349,7 +352,9 @@ void ff_vvc_dsp_init_x86(VVCDSPContext *const c, const int bd) break; case 10: if (EXTERNAL_SSE4(cpu_flags)) { +#if ARCH_X86_64 MC_LINK_SSE4(10); +#endif c->inter.sad[0] = ff_vvc_sad_8_sse4; c->inter.sad[1] = c->inter.sad[2] = @@ -357,10 +362,12 @@ void ff_vvc_dsp_init_x86(VVCDSPContext *const c, const int bd) c->inter.sad[4] = ff_vvc_sad_16_sse4; } if (EXTERNAL_AVX2_FAST(cpu_flags)) { +#if ARCH_X86_64 ALF_INIT(10); AVG_INIT(10, avx2); MC_LINKS_AVX2(10); MC_LINKS_16BPC_AVX2(10); +#endif c->inter.sad[1] = ff_vvc_sad_16_avx2; c->inter.sad[2] = c->inter.sad[3] = @@ -369,7 +376,9 @@ void ff_vvc_dsp_init_x86(VVCDSPContext *const c, const int bd) break; case 12: if (EXTERNAL_SSE4(cpu_flags)) { +#if ARCH_X86_64 MC_LINK_SSE4(12); +#endif c->inter.sad[0] = ff_vvc_sad_8_sse4; c->inter.sad[1] = c->inter.sad[2] = @@ -377,10 +386,12 @@ void ff_vvc_dsp_init_x86(VVCDSPContext *const c, const int bd) c->inter.sad[4] = ff_vvc_sad_16_sse4; } if (EXTERNAL_AVX2_FAST(cpu_flags)) { +#if ARCH_X86_64 ALF_INIT(12); AVG_INIT(12, avx2); MC_LINKS_AVX2(12); MC_LINKS_16BPC_AVX2(12); +#endif c->inter.sad[1] = ff_vvc_sad_16_avx2; c->inter.sad[2] = c->inter.sad[3] = @@ -390,5 +401,4 @@ void ff_vvc_dsp_init_x86(VVCDSPContext *const c, const int bd) default: break; } -#endif } -- 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".