[FFmpeg-devel] [PATCH] libswscale/swscale.c: Clarify what exactly 'data is not aligned' to

Michael Niedermayer michael at niedermayer.cc
Tue Dec 22 01:18:14 EET 2020


On Sat, Dec 19, 2020 at 07:50:39PM +0100, Franziska Thul wrote:
> libswscale/swscale.c emits a Warning that 'data is not aligned', but doesn't explain
> why, leaving users without any clue on how to address this issue.
> This patch simply adds that data is not aligned 'to 16 pixel boundaries'.
> 
> Idealy, the warning would say which values are not aligned, too, but since the
> variables' uses are probably explained elsewhere, I could only speculate.
> 
> ---
>  libswscale/swscale.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/libswscale/swscale.c b/libswscale/swscale.c
> index 9cb7e8f6ac..69349a7349 100644
> --- a/libswscale/swscale.c
> +++ b/libswscale/swscale.c
> @@ -311,8 +311,7 @@ static int swscale(SwsContext *c, const uint8_t *src[],
>          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");
> +                   "Warning: dstStride is not aligned to a 16 pixel boundary! Cannot do aligned memory accesses anymore.\n");
>              warnedAlready = 1;
>          }
>      }
> @@ -325,7 +324,7 @@ static int swscale(SwsContext *c, const uint8_t *src[],
>          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");
> +            av_log(c, AV_LOG_WARNING, "Warning: data is not aligned to a 16 pixel boundary! This can lead to a speed loss.\n");
>              warnedAlready=1;
>          }

all the alignment is by byte not by pixel

thx

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

Opposition brings concord. Out of discord comes the fairest harmony.
-- Heraclitus
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20201222/d3080a69/attachment.sig>


More information about the ffmpeg-devel mailing list