Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: Alan Kelly <alankelly-at-google.com@ffmpeg.org>
To: ffmpeg-devel@ffmpeg.org
Cc: Alan Kelly <alankelly@google.com>
Subject: [FFmpeg-devel] [PATCH 3/3] swscale/x86/yuv2yuvX: Process tails by jumping back into the main loop.
Date: Fri, 14 Jul 2023 12:08:46 +0200
Message-ID: <20230714100847.475017-1-alankelly@google.com> (raw)

---
 libswscale/x86/swscale.c    | 11 ++++-------
 libswscale/x86/yuv2yuvX.asm | 12 ++++++++++--
 2 files changed, 14 insertions(+), 9 deletions(-)

diff --git a/libswscale/x86/swscale.c b/libswscale/x86/swscale.c
index 52423a1199..71434f58d3 100644
--- a/libswscale/x86/swscale.c
+++ b/libswscale/x86/swscale.c
@@ -202,17 +202,14 @@ static void yuv2yuvX_ ##opt(const int16_t *filter, int filterSize, \
                            const int16_t **src, uint8_t *dest, int dstW, \
                            const uint8_t *dither, int offset) \
 { \
-    int remainder = (dstW % step); \
-    int pixelsProcessed = dstW - remainder; \
     if(((uintptr_t)dest) & 15){ \
         yuv2yuvX_mmxext(filter, filterSize, src, dest, dstW, dither, offset); \
         return; \
     } \
-    if(pixelsProcessed > 0) \
-        ff_yuv2yuvX_ ##opt(filter, filterSize - 1, 0, dest - offset, pixelsProcessed + offset, dither, offset); \
-    if(remainder > 0){ \
-      yuv2yuvX_ ##tail(filter, filterSize, src, dest, dstW, dither, offset); \
-    } \
+    if (dstW >= step) \
+        ff_yuv2yuvX_ ##opt(filter, filterSize - 1, 0, dest - offset, dstW + offset, dither, offset); \
+    else \
+        yuv2yuvX_ ##tail(filter, filterSize, src, dest, dstW, dither, offset); \
     return; \
 }
 
diff --git a/libswscale/x86/yuv2yuvX.asm b/libswscale/x86/yuv2yuvX.asm
index 57bfa09d66..ad0e8bd448 100644
--- a/libswscale/x86/yuv2yuvX.asm
+++ b/libswscale/x86/yuv2yuvX.asm
@@ -54,6 +54,8 @@ cglobal yuv2yuvX, 7, 7, 8, filter, filterSize, src, dest, dstW, dither, offset
 %else
     movq                 xm3, [ditherq]
 %endif ; avx2
+    mov                  ditherq, dstWq
+    sub                  dstWq, mmsize * unroll
 
 %if cpuflag(avx512)
     mova                 m15, [permutation]
@@ -131,8 +133,14 @@ cglobal yuv2yuvX, 7, 7, 8, filter, filterSize, src, dest, dstW, dither, offset
     add                  offsetq, mmsize * unroll
     mov                  filterSizeq, filterq
     cmp                  offsetq, dstWq
-    jb                  .outerloop
-    RET
+    jb                   .outerloop
+
+    mov                  dstWq, offsetq
+    mov                  offsetq, ditherq
+    sub                  offsetq, mmsize * unroll
+    cmp                  dstWq, ditherq
+    jb                   .outerloop
+    REP_RET
 %endmacro
 
 INIT_MMX mmxext
-- 
2.41.0.255.g8b1d071c50-goog

_______________________________________________
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:[~2023-07-14 10:09 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-14 10:08 Alan Kelly [this message]
2023-07-15 20:39 ` Michael Niedermayer
2023-07-17  9:29   ` Alan Kelly
2023-07-17  9:30     ` Alan Kelly

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=20230714100847.475017-1-alankelly@google.com \
    --to=alankelly-at-google.com@ffmpeg.org \
    --cc=alankelly@google.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