Message ID | DB6PR0101MB2214B9C7F13193BF22BA9C1D8FCA9@DB6PR0101MB2214.eurprd01.prod.exchangelabs.com |
---|---|
State | Superseded |
Headers | show |
Series | [FFmpeg-devel] avfilter, avcodec/*_init.h: Use #if to disable code | expand |
Context | Check | Description |
---|---|---|
andriy/make_x86 | success | Make finished |
andriy/make_fate_x86 | success | Make fate finished |
On Fri, May 13, 2022 at 11:19 AM Andreas Rheinhardt <andreas.rheinhardt@outlook.com> wrote: > > Should fix the compilation issue reported in > https://ffmpeg.org/pipermail/ffmpeg-devel/2022-May/296373.html > and should also prevent such issues on arches other than X86. > Since this doesn't actually affect actual compilers, but custom scripts that generate project files, maybe those should just be updated to process header files? These issues are likely to come back, as this is a rather standard pattern for all our code, so this is just a bandaid. - Hendrik
> -----Original Message----- > From: ffmpeg-devel <ffmpeg-devel-bounces@ffmpeg.org> On Behalf Of > Andreas Rheinhardt > Sent: Friday, May 13, 2022 11:19 AM > To: ffmpeg-devel@ffmpeg.org > Cc: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> > Subject: [FFmpeg-devel] [PATCH] avfilter, avcodec/*_init.h: Use #if to > disable code > > Should fix the compilation issue reported in > https://ffmpeg.org/pipermail/ffmpeg-devel/2022-May/296373.html > and should also prevent such issues on arches other than X86. > > Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> > --- > libavcodec/v210dec_init.h | 3 ++- > libavcodec/v210enc_init.h | 3 ++- > libavfilter/af_afirdsp.h | 3 ++- > libavfilter/vf_blend_init.h | 3 ++- > libavfilter/vf_eq.h | 3 ++- > libavfilter/vf_gblur_init.h | 3 ++- > libavfilter/vf_hflip_init.h | 3 ++- > libavfilter/vf_nlmeans_init.h | 6 +++--- > libavfilter/vf_threshold_init.h | 3 ++- > 9 files changed, 19 insertions(+), 11 deletions(-) > > diff --git a/libavcodec/v210dec_init.h b/libavcodec/v210dec_init.h > index 305ab3911e..707c101ab0 100644 > --- a/libavcodec/v210dec_init.h > +++ b/libavcodec/v210dec_init.h > @@ -54,8 +54,9 @@ static void v210_planar_unpack_c(const uint32_t > *src, uint16_t *y, uint16_t *u, > static av_unused av_cold void ff_v210dec_init(V210DecContext *s) > { > s->unpack_frame = v210_planar_unpack_c; > - if (ARCH_X86) > + #if ARCH_X86 > ff_v210_x86_init(s); > + #endif > } > > #endif /* AVCODEC_V210DEC_INIT_H */ > diff --git a/libavcodec/v210enc_init.h b/libavcodec/v210enc_init.h > index 6d81cac319..09828d4a14 100644 > --- a/libavcodec/v210enc_init.h > +++ b/libavcodec/v210enc_init.h > @@ -83,8 +83,9 @@ static av_cold av_unused void > ff_v210enc_init(V210EncContext *s) > s->sample_factor_8 = 2; > s->sample_factor_10 = 1; > > - if (ARCH_X86) > + #if ARCH_X86 > ff_v210enc_init_x86(s); > + #endif > } > > #endif /* AVCODEC_V210ENC_INIT_H */ > diff --git a/libavfilter/af_afirdsp.h b/libavfilter/af_afirdsp.h > index 05182bebb4..8127194836 100644 > --- a/libavfilter/af_afirdsp.h > +++ b/libavfilter/af_afirdsp.h > @@ -54,8 +54,9 @@ static av_unused void > ff_afir_init(AudioFIRDSPContext *dsp) > { > dsp->fcmul_add = fcmul_add_c; > > - if (ARCH_X86) > + #if ARCH_X86 > ff_afir_init_x86(dsp); > + #endif > } > > #endif /* AVFILTER_AFIRDSP_H */ > diff --git a/libavfilter/vf_blend_init.h b/libavfilter/vf_blend_init.h > index 5fb2599490..b377219806 100644 > --- a/libavfilter/vf_blend_init.h > +++ b/libavfilter/vf_blend_init.h > @@ -194,8 +194,9 @@ static av_unused void ff_blend_init(FilterParams > *param, int depth) > param->blend = depth > 8 ? depth > 16 ? > blend_copybottom_32 : blend_copybottom_16 : blend_copybottom_8; > } > > - if (ARCH_X86) > + #if ARCH_X86 > ff_blend_init_x86(param, depth); > + #endif > } > > #endif /* AVFILTER_BLEND_INIT_H */ > diff --git a/libavfilter/vf_eq.h b/libavfilter/vf_eq.h > index a5756977d2..d68fb7295e 100644 > --- a/libavfilter/vf_eq.h > +++ b/libavfilter/vf_eq.h > @@ -123,8 +123,9 @@ void ff_eq_init_x86(EQContext *eq); > static av_unused void ff_eq_init(EQContext *eq) > { > eq->process = process_c; > - if (ARCH_X86) > + #if ARCH_X86 > ff_eq_init_x86(eq); > + #endif > } > > #endif /* AVFILTER_EQ_H */ > diff --git a/libavfilter/vf_gblur_init.h b/libavfilter/vf_gblur_init.h > index 0fee64bc98..9ff28c6f59 100644 > --- a/libavfilter/vf_gblur_init.h > +++ b/libavfilter/vf_gblur_init.h > @@ -115,8 +115,9 @@ static av_unused void ff_gblur_init(GBlurContext > *s) > s->horiz_slice = horiz_slice_c; > s->verti_slice = verti_slice_c; > s->postscale_slice = postscale_c; > - if (ARCH_X86) > + #if ARCH_X86 > ff_gblur_init_x86(s); > + #endif > } > > #endif /* AVFILTER_GBLUR_INIT_H */ > diff --git a/libavfilter/vf_hflip_init.h b/libavfilter/vf_hflip_init.h > index b58cfec901..63f9e3b92a 100644 > --- a/libavfilter/vf_hflip_init.h > +++ b/libavfilter/vf_hflip_init.h > @@ -101,8 +101,9 @@ static av_unused int ff_hflip_init(FlipContext *s, > int step[4], int nb_planes) > return AVERROR_BUG; > } > } > - if (ARCH_X86) > + #if ARCH_X86 > ff_hflip_init_x86(s, step, nb_planes); > + #endif > > return 0; > } > diff --git a/libavfilter/vf_nlmeans_init.h > b/libavfilter/vf_nlmeans_init.h > index 04ad8801b6..87fca13b2e 100644 > --- a/libavfilter/vf_nlmeans_init.h > +++ b/libavfilter/vf_nlmeans_init.h > @@ -129,11 +129,11 @@ static av_unused void > ff_nlmeans_init(NLMeansDSPContext *dsp) > dsp->compute_safe_ssd_integral_image = > compute_safe_ssd_integral_image_c; > dsp->compute_weights_line = compute_weights_line_c; > > - if (ARCH_AARCH64) > + #if ARCH_AARCH64 > ff_nlmeans_init_aarch64(dsp); > - > - if (ARCH_X86) > + #elif ARCH_X86 > ff_nlmeans_init_x86(dsp); > + #endif > } > > #endif /* AVFILTER_NLMEANS_INIT_H */ > diff --git a/libavfilter/vf_threshold_init.h > b/libavfilter/vf_threshold_init.h > index e79d2bb63d..c86e9da7f2 100644 > --- a/libavfilter/vf_threshold_init.h > +++ b/libavfilter/vf_threshold_init.h > @@ -84,8 +84,9 @@ static av_unused void > ff_threshold_init(ThresholdContext *s) > s->bpc = 2; > } > > - if (ARCH_X86) > + #if ARCH_X86 > ff_threshold_init_x86(s); > + #endif > } > > #endif /* AVFILTER_THRESHOLD_INIT_H */ > -- LGTM. Tested and working fine. Thank you very much! softworkz
diff --git a/libavcodec/v210dec_init.h b/libavcodec/v210dec_init.h index 305ab3911e..707c101ab0 100644 --- a/libavcodec/v210dec_init.h +++ b/libavcodec/v210dec_init.h @@ -54,8 +54,9 @@ static void v210_planar_unpack_c(const uint32_t *src, uint16_t *y, uint16_t *u, static av_unused av_cold void ff_v210dec_init(V210DecContext *s) { s->unpack_frame = v210_planar_unpack_c; - if (ARCH_X86) + #if ARCH_X86 ff_v210_x86_init(s); + #endif } #endif /* AVCODEC_V210DEC_INIT_H */ diff --git a/libavcodec/v210enc_init.h b/libavcodec/v210enc_init.h index 6d81cac319..09828d4a14 100644 --- a/libavcodec/v210enc_init.h +++ b/libavcodec/v210enc_init.h @@ -83,8 +83,9 @@ static av_cold av_unused void ff_v210enc_init(V210EncContext *s) s->sample_factor_8 = 2; s->sample_factor_10 = 1; - if (ARCH_X86) + #if ARCH_X86 ff_v210enc_init_x86(s); + #endif } #endif /* AVCODEC_V210ENC_INIT_H */ diff --git a/libavfilter/af_afirdsp.h b/libavfilter/af_afirdsp.h index 05182bebb4..8127194836 100644 --- a/libavfilter/af_afirdsp.h +++ b/libavfilter/af_afirdsp.h @@ -54,8 +54,9 @@ static av_unused void ff_afir_init(AudioFIRDSPContext *dsp) { dsp->fcmul_add = fcmul_add_c; - if (ARCH_X86) + #if ARCH_X86 ff_afir_init_x86(dsp); + #endif } #endif /* AVFILTER_AFIRDSP_H */ diff --git a/libavfilter/vf_blend_init.h b/libavfilter/vf_blend_init.h index 5fb2599490..b377219806 100644 --- a/libavfilter/vf_blend_init.h +++ b/libavfilter/vf_blend_init.h @@ -194,8 +194,9 @@ static av_unused void ff_blend_init(FilterParams *param, int depth) param->blend = depth > 8 ? depth > 16 ? blend_copybottom_32 : blend_copybottom_16 : blend_copybottom_8; } - if (ARCH_X86) + #if ARCH_X86 ff_blend_init_x86(param, depth); + #endif } #endif /* AVFILTER_BLEND_INIT_H */ diff --git a/libavfilter/vf_eq.h b/libavfilter/vf_eq.h index a5756977d2..d68fb7295e 100644 --- a/libavfilter/vf_eq.h +++ b/libavfilter/vf_eq.h @@ -123,8 +123,9 @@ void ff_eq_init_x86(EQContext *eq); static av_unused void ff_eq_init(EQContext *eq) { eq->process = process_c; - if (ARCH_X86) + #if ARCH_X86 ff_eq_init_x86(eq); + #endif } #endif /* AVFILTER_EQ_H */ diff --git a/libavfilter/vf_gblur_init.h b/libavfilter/vf_gblur_init.h index 0fee64bc98..9ff28c6f59 100644 --- a/libavfilter/vf_gblur_init.h +++ b/libavfilter/vf_gblur_init.h @@ -115,8 +115,9 @@ static av_unused void ff_gblur_init(GBlurContext *s) s->horiz_slice = horiz_slice_c; s->verti_slice = verti_slice_c; s->postscale_slice = postscale_c; - if (ARCH_X86) + #if ARCH_X86 ff_gblur_init_x86(s); + #endif } #endif /* AVFILTER_GBLUR_INIT_H */ diff --git a/libavfilter/vf_hflip_init.h b/libavfilter/vf_hflip_init.h index b58cfec901..63f9e3b92a 100644 --- a/libavfilter/vf_hflip_init.h +++ b/libavfilter/vf_hflip_init.h @@ -101,8 +101,9 @@ static av_unused int ff_hflip_init(FlipContext *s, int step[4], int nb_planes) return AVERROR_BUG; } } - if (ARCH_X86) + #if ARCH_X86 ff_hflip_init_x86(s, step, nb_planes); + #endif return 0; } diff --git a/libavfilter/vf_nlmeans_init.h b/libavfilter/vf_nlmeans_init.h index 04ad8801b6..87fca13b2e 100644 --- a/libavfilter/vf_nlmeans_init.h +++ b/libavfilter/vf_nlmeans_init.h @@ -129,11 +129,11 @@ static av_unused void ff_nlmeans_init(NLMeansDSPContext *dsp) dsp->compute_safe_ssd_integral_image = compute_safe_ssd_integral_image_c; dsp->compute_weights_line = compute_weights_line_c; - if (ARCH_AARCH64) + #if ARCH_AARCH64 ff_nlmeans_init_aarch64(dsp); - - if (ARCH_X86) + #elif ARCH_X86 ff_nlmeans_init_x86(dsp); + #endif } #endif /* AVFILTER_NLMEANS_INIT_H */ diff --git a/libavfilter/vf_threshold_init.h b/libavfilter/vf_threshold_init.h index e79d2bb63d..c86e9da7f2 100644 --- a/libavfilter/vf_threshold_init.h +++ b/libavfilter/vf_threshold_init.h @@ -84,8 +84,9 @@ static av_unused void ff_threshold_init(ThresholdContext *s) s->bpc = 2; } - if (ARCH_X86) + #if ARCH_X86 ff_threshold_init_x86(s); + #endif } #endif /* AVFILTER_THRESHOLD_INIT_H */
Should fix the compilation issue reported in https://ffmpeg.org/pipermail/ffmpeg-devel/2022-May/296373.html and should also prevent such issues on arches other than X86. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> --- libavcodec/v210dec_init.h | 3 ++- libavcodec/v210enc_init.h | 3 ++- libavfilter/af_afirdsp.h | 3 ++- libavfilter/vf_blend_init.h | 3 ++- libavfilter/vf_eq.h | 3 ++- libavfilter/vf_gblur_init.h | 3 ++- libavfilter/vf_hflip_init.h | 3 ++- libavfilter/vf_nlmeans_init.h | 6 +++--- libavfilter/vf_threshold_init.h | 3 ++- 9 files changed, 19 insertions(+), 11 deletions(-)