diff options
author | Rémi Denis-Courmont <remi@remlab.net> | 2023-07-16 15:08:08 +0300 |
---|---|---|
committer | Rémi Denis-Courmont <remi@remlab.net> | 2023-07-19 19:29:35 +0300 |
commit | b6585eb04c0f63f231ed16266c6ad893522dc750 (patch) | |
tree | bc10e79af8332dd8c925a5fafa5546450c3e3b88 /libavcodec | |
parent | 98e4dd39c5d59d62f61f48f6e4a0192f6b46e5aa (diff) | |
download | ffmpeg-b6585eb04c0f63f231ed16266c6ad893522dc750.tar.gz |
lavu: add/use flag for RISC-V Zba extension
The code was blindly assuming that Zbb or V implied Zba. While the
earlier is practically always true, the later broke some QEMU setups,
as V was introduced earlier than Zba.
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/riscv/aacpsdsp_init.c | 11 | ||||
-rw-r--r-- | libavcodec/riscv/alacdsp_init.c | 2 | ||||
-rw-r--r-- | libavcodec/riscv/audiodsp_init.c | 12 | ||||
-rw-r--r-- | libavcodec/riscv/bswapdsp_init.c | 16 | ||||
-rw-r--r-- | libavcodec/riscv/fmtconvert_init.c | 2 | ||||
-rw-r--r-- | libavcodec/riscv/h264_chroma_init_riscv.c | 3 | ||||
-rw-r--r-- | libavcodec/riscv/vorbisdsp_init.c | 2 |
7 files changed, 28 insertions, 20 deletions
diff --git a/libavcodec/riscv/aacpsdsp_init.c b/libavcodec/riscv/aacpsdsp_init.c index f42baf4251..c5ec796232 100644 --- a/libavcodec/riscv/aacpsdsp_init.c +++ b/libavcodec/riscv/aacpsdsp_init.c @@ -43,13 +43,16 @@ av_cold void ff_psdsp_init_riscv(PSDSPContext *c) int flags = av_get_cpu_flags(); if (flags & AV_CPU_FLAG_RVV_F32) { - c->add_squares = ff_ps_add_squares_rvv; - c->mul_pair_single = ff_ps_mul_pair_single_rvv; c->hybrid_analysis = ff_ps_hybrid_analysis_rvv; - c->stereo_interpolate[0] = ff_ps_stereo_interpolate_rvv; + + if (flags & AV_CPU_FLAG_RVB_ADDR) { + c->add_squares = ff_ps_add_squares_rvv; + c->mul_pair_single = ff_ps_mul_pair_single_rvv; + c->stereo_interpolate[0] = ff_ps_stereo_interpolate_rvv; + } } - if (flags & AV_CPU_FLAG_RVV_I32) { + if ((flags & AV_CPU_FLAG_RVV_I32) && (flags & AV_CPU_FLAG_RVB_ADDR)) { c->hybrid_analysis_ileave = ff_ps_hybrid_analysis_ileave_rvv; c->hybrid_synthesis_deint = ff_ps_hybrid_synthesis_deint_rvv; } diff --git a/libavcodec/riscv/alacdsp_init.c b/libavcodec/riscv/alacdsp_init.c index fa8a7c8129..cd6dc4f8ae 100644 --- a/libavcodec/riscv/alacdsp_init.c +++ b/libavcodec/riscv/alacdsp_init.c @@ -41,7 +41,7 @@ av_cold void ff_alacdsp_init_riscv(ALACDSPContext *c) #if HAVE_RVV && (__riscv_xlen == 64) int flags = av_get_cpu_flags(); - if (flags & AV_CPU_FLAG_RVV_I32) { + if ((flags & AV_CPU_FLAG_RVV_I32) && (flags & AV_CPU_FLAG_RVB_ADDR)) { c->decorrelate_stereo = ff_alac_decorrelate_stereo_rvv; c->append_extra_bits[0] = ff_alac_append_extra_bits_mono_rvv; c->append_extra_bits[1] = ff_alac_append_extra_bits_stereo_rvv; diff --git a/libavcodec/riscv/audiodsp_init.c b/libavcodec/riscv/audiodsp_init.c index 32c3c6794d..9ab59c011e 100644 --- a/libavcodec/riscv/audiodsp_init.c +++ b/libavcodec/riscv/audiodsp_init.c @@ -38,11 +38,13 @@ av_cold void ff_audiodsp_init_riscv(AudioDSPContext *c) if (flags & AV_CPU_FLAG_RVF) c->vector_clipf = ff_vector_clipf_rvf; #if HAVE_RVV - if (flags & AV_CPU_FLAG_RVV_I32) { - c->scalarproduct_int16 = ff_scalarproduct_int16_rvv; - c->vector_clip_int32 = ff_vector_clip_int32_rvv; + if (flags & AV_CPU_FLAG_RVB_ADDR) { + if (flags & AV_CPU_FLAG_RVV_I32) { + c->scalarproduct_int16 = ff_scalarproduct_int16_rvv; + c->vector_clip_int32 = ff_vector_clip_int32_rvv; + } + if (flags & AV_CPU_FLAG_RVV_F32) + c->vector_clipf = ff_vector_clipf_rvv; } - if (flags & AV_CPU_FLAG_RVV_F32) - c->vector_clipf = ff_vector_clipf_rvv; #endif } diff --git a/libavcodec/riscv/bswapdsp_init.c b/libavcodec/riscv/bswapdsp_init.c index abe84ec1f7..6ad63e3805 100644 --- a/libavcodec/riscv/bswapdsp_init.c +++ b/libavcodec/riscv/bswapdsp_init.c @@ -31,16 +31,18 @@ void ff_bswap16_buf_rvv(uint16_t *dst, const uint16_t *src, int len); av_cold void ff_bswapdsp_init_riscv(BswapDSPContext *c) { - int cpu_flags = av_get_cpu_flags(); + int flags = av_get_cpu_flags(); + if (flags & AV_CPU_FLAG_RVB_ADDR) { #if (__riscv_xlen >= 64) - if (cpu_flags & AV_CPU_FLAG_RVB_BASIC) - c->bswap_buf = ff_bswap32_buf_rvb; + if (flags & AV_CPU_FLAG_RVB_BASIC) + c->bswap_buf = ff_bswap32_buf_rvb; #endif #if HAVE_RVV - if (cpu_flags & AV_CPU_FLAG_RVV_I32) { - c->bswap_buf = ff_bswap32_buf_rvv; - c->bswap16_buf = ff_bswap16_buf_rvv; - } + if (flags & AV_CPU_FLAG_RVV_I32) { + c->bswap_buf = ff_bswap32_buf_rvv; + c->bswap16_buf = ff_bswap16_buf_rvv; + } #endif + } } diff --git a/libavcodec/riscv/fmtconvert_init.c b/libavcodec/riscv/fmtconvert_init.c index 2ded9d3615..f5eeafba45 100644 --- a/libavcodec/riscv/fmtconvert_init.c +++ b/libavcodec/riscv/fmtconvert_init.c @@ -36,7 +36,7 @@ av_cold void ff_fmt_convert_init_riscv(FmtConvertContext *c) #if HAVE_RVV int flags = av_get_cpu_flags(); - if (flags & AV_CPU_FLAG_RVV_F32) { + if ((flags & AV_CPU_FLAG_RVV_F32) && (flags & AV_CPU_FLAG_RVB_ADDR)) { c->int32_to_float_fmul_scalar = ff_int32_to_float_fmul_scalar_rvv; c->int32_to_float_fmul_array8 = ff_int32_to_float_fmul_array8_rvv; } diff --git a/libavcodec/riscv/h264_chroma_init_riscv.c b/libavcodec/riscv/h264_chroma_init_riscv.c index 7c905edfcd..f3e912823b 100644 --- a/libavcodec/riscv/h264_chroma_init_riscv.c +++ b/libavcodec/riscv/h264_chroma_init_riscv.c @@ -33,7 +33,8 @@ av_cold void ff_h264chroma_init_riscv(H264ChromaContext *c, int bit_depth) #if HAVE_RVV int flags = av_get_cpu_flags(); - if (bit_depth == 8 && (flags & AV_CPU_FLAG_RVV_I32) && ff_get_rv_vlenb() >= 16) { + if (bit_depth == 8 && (flags & AV_CPU_FLAG_RVV_I32) && + (flags & AV_CPU_FLAG_RVB_ADDR) && ff_get_rv_vlenb() >= 16) { c->put_h264_chroma_pixels_tab[0] = h264_put_chroma_mc8_rvv; c->avg_h264_chroma_pixels_tab[0] = h264_avg_chroma_mc8_rvv; } diff --git a/libavcodec/riscv/vorbisdsp_init.c b/libavcodec/riscv/vorbisdsp_init.c index 0c56ffcb9b..0bbbcb68de 100644 --- a/libavcodec/riscv/vorbisdsp_init.c +++ b/libavcodec/riscv/vorbisdsp_init.c @@ -31,7 +31,7 @@ av_cold void ff_vorbisdsp_init_riscv(VorbisDSPContext *c) #if HAVE_RVV int flags = av_get_cpu_flags(); - if (flags & AV_CPU_FLAG_RVV_I32) + if ((flags & AV_CPU_FLAG_RVV_I32) && (flags & AV_CPU_FLAG_RVB_ADDR)) c->vorbis_inverse_coupling = ff_vorbis_inverse_coupling_rvv; #endif } |