[FFmpeg-devel] [PATCH] swscale: Reduce verbosity of misalignment reporting

Henrik Gramner henrik at gramner.com
Sun Oct 22 12:47:55 EEST 2017


It's a bit overzealous to complain about misalignment with AV_LOG_WARNING,
especially since memory bandwidth is much more likely to be the bottleneck
compared to data alignment which the user may not even have control over.
---
 libswscale/swscale.c | 18 +++---------------
 1 file changed, 3 insertions(+), 15 deletions(-)

diff --git a/libswscale/swscale.c b/libswscale/swscale.c
index 7f3e22355f..4eca79edc2 100644
--- a/libswscale/swscale.c
+++ b/libswscale/swscale.c
@@ -307,26 +307,14 @@ static int swscale(SwsContext *c, const uint8_t *src[],
     DEBUG_BUFFERS("vLumFilterSize: %d vChrFilterSize: %d\n",
                   vLumFilterSize, vChrFilterSize);
 
-    if (dstStride[0]&15 || dstStride[1]&15 ||
-        dstStride[2]&15 || dstStride[3]&15) {
-        static int warnedAlready = 0; // FIXME maybe move this into the context
-        if (flags & SWS_PRINT_INFO && !warnedAlready) {
-            av_log(c, AV_LOG_WARNING,
-                   "Warning: dstStride is not aligned!\n"
-                   "         ->cannot do aligned memory accesses anymore\n");
-            warnedAlready = 1;
-        }
-    }
-
     if (   (uintptr_t)dst[0]&15 || (uintptr_t)dst[1]&15 || (uintptr_t)dst[2]&15
         || (uintptr_t)src[0]&15 || (uintptr_t)src[1]&15 || (uintptr_t)src[2]&15
         || dstStride[0]&15 || dstStride[1]&15 || dstStride[2]&15 || dstStride[3]&15
         || srcStride[0]&15 || srcStride[1]&15 || srcStride[2]&15 || srcStride[3]&15
     ) {
-        static int warnedAlready=0;
-        int cpu_flags = av_get_cpu_flags();
-        if (HAVE_MMXEXT && (cpu_flags & AV_CPU_FLAG_SSE2) && !warnedAlready){
-            av_log(c, AV_LOG_WARNING, "Warning: data is not aligned! This can lead to a speed loss\n");
+        static int warnedAlready=0; // FIXME maybe move this into the context
+        if (flags & SWS_PRINT_INFO && !warnedAlready) {
+            av_log(c, AV_LOG_VERBOSE, "Data is misaligned, this may reduce performance.\n");
             warnedAlready=1;
         }
     }
-- 
2.11.0



More information about the ffmpeg-devel mailing list