[FFmpeg-devel] avfilter/vf_convolution: Fix build failures

Submitted by Andreas Rheinhardt on Aug. 12, 2019, 1:14 a.m.

Details

Message ID 20190812011455.57668-1-andreas.rheinhardt@gmail.com
State Accepted
Commit 8fcc5d963ebc5a9b8ee21fc79e5f3526f62a605d
Headers show

Commit Message

Andreas Rheinhardt Aug. 12, 2019, 1:14 a.m.
98e419cb added SIMD for the convolution filter for x64 systems. As
usual, it used a check of the form
if (ARCH_X86_64)
    ff_convolution_init_x86(s);
and thereby relied on the compiler eliminating this pseudo-runtime check
at compiletime for non x64 systems (for which ff_convolution_init_x86
isn't defined) to compile. But vf_convolution.c contains more than one
filter and if the convolution filter is disabled, but one of the other
filters (prewitt, sobel, roberts) is enabled, the build will fail on x64,
because ff_convolution_init_x86 isn't defined in this case.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
---
Found via ubitux2's random FATE box:
http://fate.ffmpeg.org/history.cgi?slot=x86_64-archlinux-gcc-random

 libavfilter/vf_convolution.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Comments

Ruiling Song Aug. 12, 2019, 1:46 a.m.
> -----Original Message-----

> From: ffmpeg-devel [mailto:ffmpeg-devel-bounces@ffmpeg.org] On Behalf

> Of Andreas Rheinhardt

> Sent: Monday, August 12, 2019 9:15 AM

> To: ffmpeg-devel@ffmpeg.org

> Cc: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>

> Subject: [FFmpeg-devel] [PATCH] avfilter/vf_convolution: Fix build failures

> 

> 98e419cb added SIMD for the convolution filter for x64 systems. As

> usual, it used a check of the form

> if (ARCH_X86_64)

>     ff_convolution_init_x86(s);

> and thereby relied on the compiler eliminating this pseudo-runtime check

> at compiletime for non x64 systems (for which ff_convolution_init_x86

> isn't defined) to compile. But vf_convolution.c contains more than one

> filter and if the convolution filter is disabled, but one of the other

> filters (prewitt, sobel, roberts) is enabled, the build will fail on x64,

> because ff_convolution_init_x86 isn't defined in this case.


Sorry I missed that. Thanks for the fix. The patch LGTM.
> 

> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>

> ---

> Found via ubitux2's random FATE box:

> http://fate.ffmpeg.org/history.cgi?slot=x86_64-archlinux-gcc-random

> 

>  libavfilter/vf_convolution.c | 5 +++--

>  1 file changed, 3 insertions(+), 2 deletions(-)

> 

> diff --git a/libavfilter/vf_convolution.c b/libavfilter/vf_convolution.c

> index e3bf1df79f..f29df38a20 100644

> --- a/libavfilter/vf_convolution.c

> +++ b/libavfilter/vf_convolution.c

> @@ -588,8 +588,9 @@ static int config_input(AVFilterLink *inlink)

>                      s->filter[p] = filter16_7x7;

>              }

>          }

> -        if (ARCH_X86_64)

> -            ff_convolution_init_x86(s);

> +#if CONFIG_CONVOLUTION_FILTER && ARCH_X86_64

> +        ff_convolution_init_x86(s);

> +#endif

>      } else if (!strcmp(ctx->filter->name, "prewitt")) {

>          if (s->depth > 8)

>              for (p = 0; p < s->nb_planes; p++)

> --

> 2.21.0

> 

> _______________________________________________

> 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".
Ruiling Song Aug. 13, 2019, 12:38 a.m.
> -----Original Message-----

> From: ffmpeg-devel [mailto:ffmpeg-devel-bounces@ffmpeg.org] On Behalf

> Of Andreas Rheinhardt

> Sent: Monday, August 12, 2019 9:15 AM

> To: ffmpeg-devel@ffmpeg.org

> Cc: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>

> Subject: [FFmpeg-devel] [PATCH] avfilter/vf_convolution: Fix build failures

> 

> 98e419cb added SIMD for the convolution filter for x64 systems. As

> usual, it used a check of the form

> if (ARCH_X86_64)

>     ff_convolution_init_x86(s);

> and thereby relied on the compiler eliminating this pseudo-runtime check

> at compiletime for non x64 systems (for which ff_convolution_init_x86

> isn't defined) to compile. But vf_convolution.c contains more than one

> filter and if the convolution filter is disabled, but one of the other

> filters (prewitt, sobel, roberts) is enabled, the build will fail on x64,

> because ff_convolution_init_x86 isn't defined in this case.

> 

> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>

> ---

Will apply.

> Found via ubitux2's random FATE box:

> http://fate.ffmpeg.org/history.cgi?slot=x86_64-archlinux-gcc-random

[...]

Patch hide | download patch | download mbox

diff --git a/libavfilter/vf_convolution.c b/libavfilter/vf_convolution.c
index e3bf1df79f..f29df38a20 100644
--- a/libavfilter/vf_convolution.c
+++ b/libavfilter/vf_convolution.c
@@ -588,8 +588,9 @@  static int config_input(AVFilterLink *inlink)
                     s->filter[p] = filter16_7x7;
             }
         }
-        if (ARCH_X86_64)
-            ff_convolution_init_x86(s);
+#if CONFIG_CONVOLUTION_FILTER && ARCH_X86_64
+        ff_convolution_init_x86(s);
+#endif
     } else if (!strcmp(ctx->filter->name, "prewitt")) {
         if (s->depth > 8)
             for (p = 0; p < s->nb_planes; p++)