Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
* [FFmpeg-devel] [PATCH 3/3] swscale/x86/yuv2yuvX: Process tails by jumping back into the main loop.
@ 2023-07-14 10:08 Alan Kelly
  2023-07-15 20:39 ` Michael Niedermayer
  0 siblings, 1 reply; 4+ messages in thread
From: Alan Kelly @ 2023-07-14 10:08 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Alan Kelly

---
 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".

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-07-17  9:30 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-14 10:08 [FFmpeg-devel] [PATCH 3/3] swscale/x86/yuv2yuvX: Process tails by jumping back into the main loop Alan Kelly
2023-07-15 20:39 ` Michael Niedermayer
2023-07-17  9:29   ` Alan Kelly
2023-07-17  9:30     ` Alan Kelly

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