Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: James Almer <jamrial@gmail.com>
To: ffmpeg-devel@ffmpeg.org
Subject: [FFmpeg-devel] [PATCH 2/5] x86/vvc_sad: optimize vvc_sad_16
Date: Thu, 23 May 2024 09:27:13 -0300
Message-ID: <20240523122716.2158-2-jamrial@gmail.com> (raw)
In-Reply-To: <20240523122716.2158-1-jamrial@gmail.com>

Signed-off-by: James Almer <jamrial@gmail.com>
---
 libavcodec/x86/vvc/vvc_sad.asm | 27 ++++++++++++++-------------
 1 file changed, 14 insertions(+), 13 deletions(-)

diff --git a/libavcodec/x86/vvc/vvc_sad.asm b/libavcodec/x86/vvc/vvc_sad.asm
index a20818530f..829dbce489 100644
--- a/libavcodec/x86/vvc/vvc_sad.asm
+++ b/libavcodec/x86/vvc/vvc_sad.asm
@@ -96,7 +96,7 @@ cglobal vvc_sad_8, 6, 9, 5, src1, src2, dx, dy, block_w, block_h, off1, off2, ro
         movd          eax, xm0
     RET
 
-cglobal vvc_sad_16, 6, 9, 5, src1, src2, dx, dy, block_w, block_h, off1, off2, row_idx
+cglobal vvc_sad_16, 6, 8, 5, src1, src2, dx, dy, block_w, block_h, off1, off2
     movsxdifnidn    dxq, dxd
     movsxdifnidn    dyq, dyd
 
@@ -121,26 +121,27 @@ cglobal vvc_sad_16, 6, 9, 5, src1, src2, dx, dy, block_w, block_h, off1, off2, r
     pxor               m3, m3
     vpbroadcastd       m4, [pw_1]
 
-        sar      block_wd, 4
+        shl      block_wd, 1
+        add         src1q, block_wq
+        add         src2q, block_wq
+        neg      block_wq
+
+DEFINE_ARGS src1, src2, dx, dy, block_w, block_h, row_idx
         .loop_height:
-        mov         off1q, src1q
-        mov         off2q, src2q
-        mov      row_idxd, block_wd
+        mov      row_idxq, block_wq
 
         .loop_width:
-            movu               m0, [src1q]
-            movu               m1, [src2q]
+            movu               m0, [src1q+row_idxq]
+            movu               m1, [src2q+row_idxq]
             MIN_MAX_SAD        m1, m0, m2
             pmaddwd            m1, m4
             paddd              m3, m1
 
-            add             src1q, 32
-            add             src2q, 32
-            dec          row_idxd
-            jg        .loop_width
+            add          row_idxq, mmsize
+            jl        .loop_width
 
-        lea         src1q, [off1q + ROWS * MAX_PB_SIZE * 2]
-        lea         src2q, [off2q + ROWS * MAX_PB_SIZE * 2]
+        add         src1q, ROWS * MAX_PB_SIZE * 2
+        add         src2q, ROWS * MAX_PB_SIZE * 2
 
         sub      block_hd, 2
         jg   .loop_height
-- 
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".

  reply	other threads:[~2024-05-23 12:28 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-23 12:27 [FFmpeg-devel] [PATCH 1/5] avcodec/vvc_mc: split the SAD dsp prototype into one function per blocksize width James Almer
2024-05-23 12:27 ` James Almer [this message]
2024-05-23 12:27 ` [FFmpeg-devel] [PATCH 3/5] x86/vvc_sad: add sse4 versions of all functions James Almer
2024-05-23 12:27 ` [FFmpeg-devel] [PATCH 4/5] x86/vvc_sad: reduce gpr usage in all loop functions James Almer
2024-05-23 12:27 ` [FFmpeg-devel] [PATCH 5/5] x86/vvc_sad: reindent after the previous changes James Almer
2024-05-23 12:35 ` [FFmpeg-devel] [PATCH 1/5] avcodec/vvc_mc: split the SAD dsp prototype into one function per blocksize width 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=20240523122716.2158-2-jamrial@gmail.com \
    --to=jamrial@gmail.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