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

Michael Niedermayer michael at niedermayer.cc
Sun Oct 29 22:26:19 EET 2017


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.

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Awnsering whenever a program halts or runs forever is
On a turing machine, in general impossible (turings halting problem).
On any real computer, always possible as a real computer has a finite number
of states N, and will either halt in less than N cycles or never halt.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20171029/49f1e264/attachment.sig>


More information about the ffmpeg-devel mailing list