diff mbox

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

Message ID 20171022094755.72547-1-henrik@gramner.com
State New
Headers show

Commit Message

Henrik Gramner Oct. 22, 2017, 9:47 a.m. UTC
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(-)

Comments

Henrik Gramner Oct. 29, 2017, 8:34 a.m. UTC | #1
On Sun, Oct 22, 2017 at 11:47 AM, Henrik Gramner <henrik@gramner.com> wrote:
> 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.

Ping.
Michael Niedermayer Oct. 29, 2017, 8:26 p.m. UTC | #2
On Sun, Oct 22, 2017 at 11:47:55AM +0200, Henrik Gramner wrote:
> 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;
>          }
>      }
> -- 

This patch changes more than the log level as suggested by the
commit message.

[...]
diff mbox

Patch

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;
         }
     }