diff mbox series

[FFmpeg-devel] avcodec/x86/vvc/vvcdsp_init: fix unresolved external symbol on ARCH_X86_32

Message ID OSZP286MB21736B6DF664212942F81A7FCA472@OSZP286MB2173.JPNP286.PROD.OUTLOOK.COM
State Accepted
Commit 3372876888db8bc8dd27350549654d11d5bb40a6
Headers show
Series [FFmpeg-devel] avcodec/x86/vvc/vvcdsp_init: fix unresolved external symbol on ARCH_X86_32 | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Wu Jianhua Feb. 5, 2024, 11:59 a.m. UTC
From: Wu Jianhua <toqsxw@outlook.com>

Signed-off-by: Wu Jianhua <toqsxw@outlook.com>
---
 libavcodec/x86/vvc/vvcdsp_init.c | 78 ++++++++++++++++----------------
 1 file changed, 40 insertions(+), 38 deletions(-)

Comments

Andreas Rheinhardt Feb. 5, 2024, 12:06 p.m. UTC | #1
toqsxw@outlook.com:
> From: Wu Jianhua <toqsxw@outlook.com>
> 
> Signed-off-by: Wu Jianhua <toqsxw@outlook.com>
> ---
>  libavcodec/x86/vvc/vvcdsp_init.c | 78 ++++++++++++++++----------------
>  1 file changed, 40 insertions(+), 38 deletions(-)
> 
> diff --git a/libavcodec/x86/vvc/vvcdsp_init.c b/libavcodec/x86/vvc/vvcdsp_init.c
> index 909ef9f56b..8ee4074350 100644
> --- a/libavcodec/x86/vvc/vvcdsp_init.c
> +++ b/libavcodec/x86/vvc/vvcdsp_init.c
> @@ -31,6 +31,7 @@
>  #include "libavcodec/vvc/vvcdsp.h"
>  #include "libavcodec/x86/h26x/h2656dsp.h"
>  
> +#if ARCH_X86_64
>  #define FW_PUT(name, depth, opt) \
>  static void ff_vvc_put_ ## name ## _ ## depth ## _##opt(int16_t *dst, const uint8_t *src, ptrdiff_t srcstride, \
>                                                   int height, const int8_t *hf, const int8_t *vf, int width)    \
> @@ -204,51 +205,52 @@ AVG_FUNCS(16, 12, avx2)
>      c->inter.avg    = bf(avg, bd, opt);                                 \
>      c->inter.w_avg  = bf(w_avg, bd, opt);                               \
>  } while (0)
> +#endif
>  
>  void ff_vvc_dsp_init_x86(VVCDSPContext *const c, const int bd)
>  {
> +#if ARCH_X86_64
>      const int cpu_flags = av_get_cpu_flags();
>  
> -    if (ARCH_X86_64) {
> -        if (bd == 8) {
> -            if (EXTERNAL_SSE4(cpu_flags)) {
> -                MC_LINK_SSE4(8);
> -            }
> -            if (EXTERNAL_AVX2_FAST(cpu_flags)) {
> -                MC_LINKS_AVX2(8);
> -            }
> -        } else if (bd == 10) {
> -            if (EXTERNAL_SSE4(cpu_flags)) {
> -                MC_LINK_SSE4(10);
> -            }
> -            if (EXTERNAL_AVX2_FAST(cpu_flags)) {
> -                MC_LINKS_AVX2(10);
> -                MC_LINKS_16BPC_AVX2(10);
> -            }
> -        } else if (bd == 12) {
> -            if (EXTERNAL_SSE4(cpu_flags)) {
> -                MC_LINK_SSE4(12);
> -            }
> -            if (EXTERNAL_AVX2_FAST(cpu_flags)) {
> -                MC_LINKS_AVX2(12);
> -                MC_LINKS_16BPC_AVX2(12);
> -            }
> +    if (bd == 8) {
> +        if (EXTERNAL_SSE4(cpu_flags)) {
> +            MC_LINK_SSE4(8);
>          }
> +        if (EXTERNAL_AVX2_FAST(cpu_flags)) {
> +            MC_LINKS_AVX2(8);
> +        }
> +    } else if (bd == 10) {
> +        if (EXTERNAL_SSE4(cpu_flags)) {
> +            MC_LINK_SSE4(10);
> +        }
> +        if (EXTERNAL_AVX2_FAST(cpu_flags)) {
> +            MC_LINKS_AVX2(10);
> +            MC_LINKS_16BPC_AVX2(10);
> +        }
> +    } else if (bd == 12) {
> +        if (EXTERNAL_SSE4(cpu_flags)) {
> +            MC_LINK_SSE4(12);
> +        }
> +        if (EXTERNAL_AVX2_FAST(cpu_flags)) {
> +            MC_LINKS_AVX2(12);
> +            MC_LINKS_16BPC_AVX2(12);
> +        }
> +    }
>  
> -        if (EXTERNAL_AVX2(cpu_flags)) {
> -            switch (bd) {
> -                case 8:
> -                    AVG_INIT(8, avx2);
> -                    break;
> -                case 10:
> -                    AVG_INIT(10, avx2);
> -                    break;
> -                case 12:
> -                    AVG_INIT(12, avx2);
> -                    break;
> -                default:
> -                    break;
> -            }
> +    if (EXTERNAL_AVX2(cpu_flags)) {
> +        switch (bd) {
> +            case 8:
> +                AVG_INIT(8, avx2);
> +                break;
> +            case 10:
> +                AVG_INIT(10, avx2);
> +                break;
> +            case 12:
> +                AVG_INIT(12, avx2);
> +                break;
> +            default:
> +                break;
>          }
>      }
> +#endif
>  }

Are really all of these functions unavailable for 32bit?

- Andreas
Wu Jianhua Feb. 5, 2024, 12:11 p.m. UTC | #2
> 发件人: ffmpeg-devel <ffmpeg-devel-bounces@ffmpeg.org> 代表 Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
> 发送时间: 2024年2月5日 4:06
> 收件人: ffmpeg-devel@ffmpeg.org
> 主题: Re: [FFmpeg-devel] [PATCH] avcodec/x86/vvc/vvcdsp_init: fix unresolved external symbol on ARCH_X86_32
>
> toqsxw@outlook.com:
>> From: Wu Jianhua <toqsxw@outlook.com>
>>
>> Signed-off-by: Wu Jianhua <toqsxw@outlook.com>
>> ---
>>  libavcodec/x86/vvc/vvcdsp_init.c | 78 ++++++++++++++++----------------
>>  1 file changed, 40 insertions(+), 38 deletions(-)
>>
>> diff --git a/libavcodec/x86/vvc/vvcdsp_init.c b/libavcodec/x86/vvc/vvcdsp_init.c
>> index 909ef9f56b..8ee4074350 100644
>> --- a/libavcodec/x86/vvc/vvcdsp_init.c
>> +++ b/libavcodec/x86/vvc/vvcdsp_init.c
>> @@ -31,6 +31,7 @@
>>  #include "libavcodec/vvc/vvcdsp.h"
>>  #include "libavcodec/x86/h26x/h2656dsp.h"
>>
>
> Are really all of these functions unavailable for 32bit?
>
> - Andreas

Yes. Both libavcodec\x86\vvc\vvc_mc.asm and libavcodec\x86\h26x\h2656_inter.asm are wrapped in ARCH_X86_64.
Wang Bin Feb. 7, 2024, 9:47 a.m. UTC | #3
Andreas Rheinhardt <andreas.rheinhardt@outlook.com> 于2024年2月5日周一 20:04写道:

> toqsxw@outlook.com:
> > From: Wu Jianhua <toqsxw@outlook.com>
> >
> > Signed-off-by: Wu Jianhua <toqsxw@outlook.com>
> > ---
> >  libavcodec/x86/vvc/vvcdsp_init.c | 78 ++++++++++++++++----------------
> >  1 file changed, 40 insertions(+), 38 deletions(-)
> >
> > diff --git a/libavcodec/x86/vvc/vvcdsp_init.c
> b/libavcodec/x86/vvc/vvcdsp_init.c
> > index 909ef9f56b..8ee4074350 100644
> > --- a/libavcodec/x86/vvc/vvcdsp_init.c
> > +++ b/libavcodec/x86/vvc/vvcdsp_init.c
> > @@ -31,6 +31,7 @@
> >  #include "libavcodec/vvc/vvcdsp.h"
> >  #include "libavcodec/x86/h26x/h2656dsp.h"
> >
> > +#if ARCH_X86_64
> >  #define FW_PUT(name, depth, opt) \
> >  static void ff_vvc_put_ ## name ## _ ## depth ## _##opt(int16_t *dst,
> const uint8_t *src, ptrdiff_t srcstride, \
> >                                                   int height, const
> int8_t *hf, const int8_t *vf, int width)    \
> > @@ -204,51 +205,52 @@ AVG_FUNCS(16, 12, avx2)
> >      c->inter.avg    = bf(avg, bd, opt);
>  \
> >      c->inter.w_avg  = bf(w_avg, bd, opt);
>  \
> >  } while (0)
> > +#endif
> >
> >  void ff_vvc_dsp_init_x86(VVCDSPContext *const c, const int bd)
> >  {
> > +#if ARCH_X86_64
> >      const int cpu_flags = av_get_cpu_flags();
> >
> > -    if (ARCH_X86_64) {
> > -        if (bd == 8) {
> > -            if (EXTERNAL_SSE4(cpu_flags)) {
> > -                MC_LINK_SSE4(8);
> > -            }
> > -            if (EXTERNAL_AVX2_FAST(cpu_flags)) {
> > -                MC_LINKS_AVX2(8);
> > -            }
> > -        } else if (bd == 10) {
> > -            if (EXTERNAL_SSE4(cpu_flags)) {
> > -                MC_LINK_SSE4(10);
> > -            }
> > -            if (EXTERNAL_AVX2_FAST(cpu_flags)) {
> > -                MC_LINKS_AVX2(10);
> > -                MC_LINKS_16BPC_AVX2(10);
> > -            }
> > -        } else if (bd == 12) {
> > -            if (EXTERNAL_SSE4(cpu_flags)) {
> > -                MC_LINK_SSE4(12);
> > -            }
> > -            if (EXTERNAL_AVX2_FAST(cpu_flags)) {
> > -                MC_LINKS_AVX2(12);
> > -                MC_LINKS_16BPC_AVX2(12);
> > -            }
> > +    if (bd == 8) {
> > +        if (EXTERNAL_SSE4(cpu_flags)) {
> > +            MC_LINK_SSE4(8);
> >          }
> > +        if (EXTERNAL_AVX2_FAST(cpu_flags)) {
> > +            MC_LINKS_AVX2(8);
> > +        }
> > +    } else if (bd == 10) {
> > +        if (EXTERNAL_SSE4(cpu_flags)) {
> > +            MC_LINK_SSE4(10);
> > +        }
> > +        if (EXTERNAL_AVX2_FAST(cpu_flags)) {
> > +            MC_LINKS_AVX2(10);
> > +            MC_LINKS_16BPC_AVX2(10);
> > +        }
> > +    } else if (bd == 12) {
> > +        if (EXTERNAL_SSE4(cpu_flags)) {
> > +            MC_LINK_SSE4(12);
> > +        }
> > +        if (EXTERNAL_AVX2_FAST(cpu_flags)) {
> > +            MC_LINKS_AVX2(12);
> > +            MC_LINKS_16BPC_AVX2(12);
> > +        }
> > +    }
> >
> > -        if (EXTERNAL_AVX2(cpu_flags)) {
> > -            switch (bd) {
> > -                case 8:
> > -                    AVG_INIT(8, avx2);
> > -                    break;
> > -                case 10:
> > -                    AVG_INIT(10, avx2);
> > -                    break;
> > -                case 12:
> > -                    AVG_INIT(12, avx2);
> > -                    break;
> > -                default:
> > -                    break;
> > -            }
> > +    if (EXTERNAL_AVX2(cpu_flags)) {
> > +        switch (bd) {
> > +            case 8:
> > +                AVG_INIT(8, avx2);
> > +                break;
> > +            case 10:
> > +                AVG_INIT(10, avx2);
> > +                break;
> > +            case 12:
> > +                AVG_INIT(12, avx2);
> > +                break;
> > +            default:
> > +                break;
> >          }
> >      }
> > +#endif
> >  }
>
> Are really all of these functions unavailable for 32bit?
>
> - Andreas
>
>
http://fate.ffmpeg.org/log.cgi?time=20240207055809&slot=x86_32-msvc14-dll-md-windows-native&log=compile
Andreas Rheinhardt Feb. 7, 2024, 10:02 a.m. UTC | #4
Wu Jianhua:
>> 发件人: ffmpeg-devel <ffmpeg-devel-bounces@ffmpeg.org> 代表 Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
>> 发送时间: 2024年2月5日 4:06
>> 收件人: ffmpeg-devel@ffmpeg.org
>> 主题: Re: [FFmpeg-devel] [PATCH] avcodec/x86/vvc/vvcdsp_init: fix unresolved external symbol on ARCH_X86_32
>>
>> toqsxw@outlook.com:
>>> From: Wu Jianhua <toqsxw@outlook.com>
>>>
>>> Signed-off-by: Wu Jianhua <toqsxw@outlook.com>
>>> ---
>>>  libavcodec/x86/vvc/vvcdsp_init.c | 78 ++++++++++++++++----------------
>>>  1 file changed, 40 insertions(+), 38 deletions(-)
>>>
>>> diff --git a/libavcodec/x86/vvc/vvcdsp_init.c b/libavcodec/x86/vvc/vvcdsp_init.c
>>> index 909ef9f56b..8ee4074350 100644
>>> --- a/libavcodec/x86/vvc/vvcdsp_init.c
>>> +++ b/libavcodec/x86/vvc/vvcdsp_init.c
>>> @@ -31,6 +31,7 @@
>>>  #include "libavcodec/vvc/vvcdsp.h"
>>>  #include "libavcodec/x86/h26x/h2656dsp.h"
>>>
>>
>> Are really all of these functions unavailable for 32bit?
>>
>> - Andreas
> 
> Yes. Both libavcodec\x86\vvc\vvc_mc.asm and libavcodec\x86\h26x\h2656_inter.asm are wrapped in ARCH_X86_64.

Patch seems ok then.

- Andreas
Nuo Mi Feb. 7, 2024, 2:58 p.m. UTC | #5
On Wed, Feb 7, 2024 at 6:00 PM Andreas Rheinhardt <
andreas.rheinhardt@outlook.com> wrote:

> Wu Jianhua:
> >> 发件人: ffmpeg-devel <ffmpeg-devel-bounces@ffmpeg.org> 代表 Andreas
> Rheinhardt <andreas.rheinhardt@outlook.com>
> >> 发送时间: 2024年2月5日 4:06
> >> 收件人: ffmpeg-devel@ffmpeg.org
> >> 主题: Re: [FFmpeg-devel] [PATCH] avcodec/x86/vvc/vvcdsp_init: fix
> unresolved external symbol on ARCH_X86_32
> >>
> >> toqsxw@outlook.com:
> >>> From: Wu Jianhua <toqsxw@outlook.com>
> >>>
> >>> Signed-off-by: Wu Jianhua <toqsxw@outlook.com>
> >>> ---
> >>>  libavcodec/x86/vvc/vvcdsp_init.c | 78 ++++++++++++++++----------------
> >>>  1 file changed, 40 insertions(+), 38 deletions(-)
> >>>
> >>> diff --git a/libavcodec/x86/vvc/vvcdsp_init.c
> b/libavcodec/x86/vvc/vvcdsp_init.c
> >>> index 909ef9f56b..8ee4074350 100644
> >>> --- a/libavcodec/x86/vvc/vvcdsp_init.c
> >>> +++ b/libavcodec/x86/vvc/vvcdsp_init.c
> >>> @@ -31,6 +31,7 @@
> >>>  #include "libavcodec/vvc/vvcdsp.h"
> >>>  #include "libavcodec/x86/h26x/h2656dsp.h"
> >>>
> >>
> >> Are really all of these functions unavailable for 32bit?
> >>
> >> - Andreas
> >
> > Yes. Both libavcodec\x86\vvc\vvc_mc.asm and
> libavcodec\x86\h26x\h2656_inter.asm are wrapped in ARCH_X86_64.
>
> Patch seems ok then.
>
applied, thank you all

>
> - Andreas
>
>
> _______________________________________________
> 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".
>
diff mbox series

Patch

diff --git a/libavcodec/x86/vvc/vvcdsp_init.c b/libavcodec/x86/vvc/vvcdsp_init.c
index 909ef9f56b..8ee4074350 100644
--- a/libavcodec/x86/vvc/vvcdsp_init.c
+++ b/libavcodec/x86/vvc/vvcdsp_init.c
@@ -31,6 +31,7 @@ 
 #include "libavcodec/vvc/vvcdsp.h"
 #include "libavcodec/x86/h26x/h2656dsp.h"
 
+#if ARCH_X86_64
 #define FW_PUT(name, depth, opt) \
 static void ff_vvc_put_ ## name ## _ ## depth ## _##opt(int16_t *dst, const uint8_t *src, ptrdiff_t srcstride, \
                                                  int height, const int8_t *hf, const int8_t *vf, int width)    \
@@ -204,51 +205,52 @@  AVG_FUNCS(16, 12, avx2)
     c->inter.avg    = bf(avg, bd, opt);                                 \
     c->inter.w_avg  = bf(w_avg, bd, opt);                               \
 } while (0)
+#endif
 
 void ff_vvc_dsp_init_x86(VVCDSPContext *const c, const int bd)
 {
+#if ARCH_X86_64
     const int cpu_flags = av_get_cpu_flags();
 
-    if (ARCH_X86_64) {
-        if (bd == 8) {
-            if (EXTERNAL_SSE4(cpu_flags)) {
-                MC_LINK_SSE4(8);
-            }
-            if (EXTERNAL_AVX2_FAST(cpu_flags)) {
-                MC_LINKS_AVX2(8);
-            }
-        } else if (bd == 10) {
-            if (EXTERNAL_SSE4(cpu_flags)) {
-                MC_LINK_SSE4(10);
-            }
-            if (EXTERNAL_AVX2_FAST(cpu_flags)) {
-                MC_LINKS_AVX2(10);
-                MC_LINKS_16BPC_AVX2(10);
-            }
-        } else if (bd == 12) {
-            if (EXTERNAL_SSE4(cpu_flags)) {
-                MC_LINK_SSE4(12);
-            }
-            if (EXTERNAL_AVX2_FAST(cpu_flags)) {
-                MC_LINKS_AVX2(12);
-                MC_LINKS_16BPC_AVX2(12);
-            }
+    if (bd == 8) {
+        if (EXTERNAL_SSE4(cpu_flags)) {
+            MC_LINK_SSE4(8);
         }
+        if (EXTERNAL_AVX2_FAST(cpu_flags)) {
+            MC_LINKS_AVX2(8);
+        }
+    } else if (bd == 10) {
+        if (EXTERNAL_SSE4(cpu_flags)) {
+            MC_LINK_SSE4(10);
+        }
+        if (EXTERNAL_AVX2_FAST(cpu_flags)) {
+            MC_LINKS_AVX2(10);
+            MC_LINKS_16BPC_AVX2(10);
+        }
+    } else if (bd == 12) {
+        if (EXTERNAL_SSE4(cpu_flags)) {
+            MC_LINK_SSE4(12);
+        }
+        if (EXTERNAL_AVX2_FAST(cpu_flags)) {
+            MC_LINKS_AVX2(12);
+            MC_LINKS_16BPC_AVX2(12);
+        }
+    }
 
-        if (EXTERNAL_AVX2(cpu_flags)) {
-            switch (bd) {
-                case 8:
-                    AVG_INIT(8, avx2);
-                    break;
-                case 10:
-                    AVG_INIT(10, avx2);
-                    break;
-                case 12:
-                    AVG_INIT(12, avx2);
-                    break;
-                default:
-                    break;
-            }
+    if (EXTERNAL_AVX2(cpu_flags)) {
+        switch (bd) {
+            case 8:
+                AVG_INIT(8, avx2);
+                break;
+            case 10:
+                AVG_INIT(10, avx2);
+                break;
+            case 12:
+                AVG_INIT(12, avx2);
+                break;
+            default:
+                break;
         }
     }
+#endif
 }