[FFmpeg-devel] [PATCH v3 2/2] lavc/rv40dsp: fix RISC-V chroma_mc

Ronald S. Bultje rsbultje at gmail.com
Tue Dec 10 18:44:12 EET 2024


Hi,

On Fri, Dec 6, 2024 at 2:24 PM Rémi Denis-Courmont <remi at remlab.net> wrote:

>
>
> Le 6 décembre 2024 13:19:29 GMT+01:00, Niklas Haas <ffmpeg at haasn.xyz> a
> écrit :
> >On Thu, 05 Dec 2024 21:41:51 +0800 uk7b-at-foxmail.com at ffmpeg.org wrote:
> >> From: sunyuechi <sunyuechi at iscas.ac.cn>
> >>
> >> ---
> >>  libavcodec/riscv/rv40dsp_rvv.S | 116 ++++++++++++++++++++++-----------
> >>  1 file changed, 78 insertions(+), 38 deletions(-)
> >>
> >> diff --git a/libavcodec/riscv/rv40dsp_rvv.S
> b/libavcodec/riscv/rv40dsp_rvv.S
> >> index ca431eb8ab..d4beb7f1e9 100644
> >> --- a/libavcodec/riscv/rv40dsp_rvv.S
> >> +++ b/libavcodec/riscv/rv40dsp_rvv.S
> >> @@ -20,15 +20,30 @@
> >>
> >>  #include "libavutil/riscv/asm.S"
> >>
> >> -.macro manual_avg dst src1 src2
> >> -        vadd.vv         \dst, \src1, \src2
> >> -        vadd.vi         \dst, \dst, 1
> >> -        vsrl.vi         \dst, \dst, 1
> >> -.endm
> >> +const rv40_bias
> >> +    .byte  0, 16, 32, 16
> >> +    .byte 32, 28, 32, 28
> >> +    .byte  0, 32, 16, 32
> >> +    .byte 32, 28, 32, 28
> >> +endconst
> >>
> >>  .macro  do_chroma_mc type unroll
> >> -        csrwi           vxrm, 2
> >> +        csrwi           vxrm, 0
> >> +        addi            sp, sp, -16
> >> +#if __riscv_xlen == 32
> >> +        sw              s2, (sp)
> >> +#elif __riscv_xlen == 64
> >> +        sd              s2, (sp)
> >> +#else
> >> +        sq              s2, (sp)
> >> +#endif
> >
> >You can use the macro `sx` from libavcodec/riscv/h264qpel_rvv.S
> >
> >(I suggest to move them into some common include path)
>
> As we need to backport this, should we merge this to stable and the sx/lx
> version to master? Or should we merge this to master so that we can
> cherry-pick the exact patch to master?
>

As discussed on IRC, I've merged this for now. The refactor can (and
should) be done on top of this, but this allows for backporting.

Ronald


More information about the ffmpeg-devel mailing list