Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
* [FFmpeg-devel] [PATCH 4/4] lavc/vp9dsp: R-V V ipred tm
@ 2024-03-02  7:42 flow gg
  2024-03-03  2:01 ` flow gg
  0 siblings, 1 reply; 3+ messages in thread
From: flow gg @ 2024-03-02  7:42 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

[-- Attachment #1: Type: text/plain, Size: 1 bytes --]



[-- Attachment #2: 0004-lavc-vp9dsp-R-V-V-ipred-tm.patch --]
[-- Type: text/x-patch, Size: 6536 bytes --]

From 3128765d298f5a44fd13be7b3da2ef88c96083f9 Mon Sep 17 00:00:00 2001
From: sunyuechi <sunyuechi@iscas.ac.cn>
Date: Sat, 2 Mar 2024 09:35:22 +0800
Subject: [PATCH 4/4] lavc/vp9dsp: R-V V ipred tm

C908:
vp9_tm_4x4_8bpp_c: 116.5
vp9_tm_4x4_8bpp_rvv_i32: 43.5
vp9_tm_8x8_8bpp_c: 416.2
vp9_tm_8x8_8bpp_rvv_i32: 86.0
vp9_tm_16x16_8bpp_c: 1665.5
vp9_tm_16x16_8bpp_rvv_i32: 187.2
vp9_tm_32x32_8bpp_c: 6974.2
vp9_tm_32x32_8bpp_rvv_i32: 625.7
---
 libavcodec/riscv/vp9_intra_rvv.S | 143 +++++++++++++++++++++++++++++++
 libavcodec/riscv/vp9dsp.h        |   8 ++
 libavcodec/riscv/vp9dsp_init.c   |   4 +
 3 files changed, 155 insertions(+)

diff --git a/libavcodec/riscv/vp9_intra_rvv.S b/libavcodec/riscv/vp9_intra_rvv.S
index 35fb0ebe10..a8265255c4 100644
--- a/libavcodec/riscv/vp9_intra_rvv.S
+++ b/libavcodec/riscv/vp9_intra_rvv.S
@@ -290,3 +290,146 @@ func ff_h_8x8_rvv, zve32x
 
         ret
 endfunc
+
+.macro tm_sum dst, top, offset
+        lbu          t3, \offset(a2)
+        sub          t3, t3, a4
+        vadd.vx      \dst, \top, t3
+.endm
+
+func ff_tm_32x32_rvv, zve32x
+        lbu          a4, -1(a3)
+        li           t5, 32
+
+        .macro tm_sum32 n1,n2,n3,n4,n5,n6,n7,n8
+
+        vsetvli      zero, t5, e16, m4, ta, ma
+        vle8.v       v8, (a3)
+        vzext.vf2    v28, v8
+
+        tm_sum       v0, v28, \n1
+        tm_sum       v4, v28, \n2
+        tm_sum       v8, v28, \n3
+        tm_sum       v12, v28, \n4
+        tm_sum       v16, v28, \n5
+        tm_sum       v20, v28, \n6
+        tm_sum       v24, v28, \n7
+        tm_sum       v28, v28, \n8
+
+        .irp n 0, 4, 8, 12, 16, 20, 24, 28
+        vmax.vx      v\n, v\n, zero
+        .endr
+
+        vsetvli      zero, zero, e8, m2, ta, ma
+        .irp n 0, 4, 8, 12, 16, 20, 24, 28
+        vnclipu.wi   v\n, v\n, 0
+        vse8.v       v\n, (a0)
+        add          a0, a0, a1
+        .endr
+
+        .endm
+
+        tm_sum32     31, 30, 29, 28, 27, 26, 25, 24
+        tm_sum32     23, 22, 21, 20, 19, 18, 17, 16
+        tm_sum32     15, 14, 13, 12, 11, 10, 9, 8
+        tm_sum32     7, 6, 5, 4, 3, 2, 1, 0
+
+        ret
+endfunc
+
+func ff_tm_16x16_rvv, zve32x
+        vsetivli      zero, 16, e16, m2, ta, ma
+        vle8.v        v8, (a3)
+        vzext.vf2     v30, v8
+        lbu           a4, -1(a3)
+
+        tm_sum       v0, v30, 15
+        tm_sum       v2, v30, 14
+        tm_sum       v4, v30, 13
+        tm_sum       v6, v30, 12
+        tm_sum       v8, v30, 11
+        tm_sum       v10, v30, 10
+        tm_sum       v12, v30, 9
+        tm_sum       v14, v30, 8
+        tm_sum       v16, v30, 7
+        tm_sum       v18, v30, 6
+        tm_sum       v20, v30, 5
+        tm_sum       v22, v30, 4
+        tm_sum       v24, v30, 3
+        tm_sum       v26, v30, 2
+        tm_sum       v28, v30, 1
+        tm_sum       v30, v30, 0
+
+        .irp n 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30
+        vmax.vx      v\n, v\n, zero
+        .endr
+
+        vsetvli      zero, zero, e8, m1, ta, ma
+        .irp n 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28
+        vnclipu.wi   v\n, v\n, 0
+        vse8.v       v\n, (a0)
+        add          a0, a0, a1
+        .endr
+        vnclipu.wi   v30, v30, 0
+        vse8.v       v30, (a0)
+
+        ret
+endfunc
+
+func ff_tm_8x8_rvv, zve32x
+        vsetivli     zero, 8, e16, m1, ta, ma
+        vle8.v       v8, (a3)
+        vzext.vf2    v28, v8
+        lbu          a4, -1(a3)
+
+        tm_sum       v16, v28, 7
+        tm_sum       v17, v28, 6
+        tm_sum       v18, v28, 5
+        tm_sum       v19, v28, 4
+        tm_sum       v20, v28, 3
+        tm_sum       v21, v28, 2
+        tm_sum       v22, v28, 1
+        tm_sum       v23, v28, 0
+
+        .irp n 16, 17, 18, 19, 20, 21, 22, 23
+        vmax.vx      v\n, v\n, zero
+        .endr
+
+        vsetvli      zero, zero, e8, mf2, ta, ma
+        .irp n 16, 17, 18, 19, 20, 21, 22
+        vnclipu.wi   v\n, v\n, 0
+        vse8.v       v\n, (a0)
+        add          a0, a0, a1
+        .endr
+        vnclipu.wi   v24, v23, 0
+        vse8.v       v24, (a0)
+
+        ret
+endfunc
+
+func ff_tm_4x4_rvv, zve32x
+        vsetivli     zero, 4, e16, mf2, ta, ma
+        vle8.v       v8, (a3)
+        vzext.vf2    v28, v8
+        lbu          a4, -1(a3)
+
+        tm_sum       v16, v28, 3
+        tm_sum       v17, v28, 2
+        tm_sum       v18, v28, 1
+        tm_sum       v19, v28, 0
+
+        .irp n 16, 17, 18, 19
+        vmax.vx      v\n, v\n, zero
+        .endr
+
+        vsetvli      zero, zero, e8, mf4, ta, ma
+        .irp n 16, 17, 18
+        vnclipu.wi   v\n, v\n, 0
+        vse8.v       v\n, (a0)
+        add          a0, a0, a1
+        .endr
+        vnclipu.wi   v24, v19, 0
+        vse8.v       v24, (a0)
+
+        ret
+endfunc
diff --git a/libavcodec/riscv/vp9dsp.h b/libavcodec/riscv/vp9dsp.h
index 2b2e0db0d8..cff2310e5c 100644
--- a/libavcodec/riscv/vp9dsp.h
+++ b/libavcodec/riscv/vp9dsp.h
@@ -72,5 +72,13 @@ void ff_h_16x16_rvv(uint8_t *dst, ptrdiff_t stride, const uint8_t *l,
                     const uint8_t *a);
 void ff_h_8x8_rvv(uint8_t *dst, ptrdiff_t stride, const uint8_t *l,
                   const uint8_t *a);
+void ff_tm_32x32_rvv(uint8_t *dst, ptrdiff_t stride, const uint8_t *l,
+                     const uint8_t *a);
+void ff_tm_16x16_rvv(uint8_t *dst, ptrdiff_t stride, const uint8_t *l,
+                     const uint8_t *a);
+void ff_tm_8x8_rvv(uint8_t *dst, ptrdiff_t stride, const uint8_t *l,
+                   const uint8_t *a);
+void ff_tm_4x4_rvv(uint8_t *dst, ptrdiff_t stride, const uint8_t *l,
+                   const uint8_t *a);
 
 #endif  // #ifndef AVCODEC_RISCV_VP9DSP_RISCV_H
diff --git a/libavcodec/riscv/vp9dsp_init.c b/libavcodec/riscv/vp9dsp_init.c
index 16aeeb260a..f08c8f6a42 100644
--- a/libavcodec/riscv/vp9dsp_init.c
+++ b/libavcodec/riscv/vp9dsp_init.c
@@ -57,6 +57,10 @@ static av_cold void vp9dsp_intrapred_init_rvv(VP9DSPContext *dsp, int bpp)
             dsp->intra_pred[TX_32X32][HOR_PRED] = ff_h_32x32_rvv;
             dsp->intra_pred[TX_16X16][HOR_PRED] = ff_h_16x16_rvv;
             dsp->intra_pred[TX_8X8][HOR_PRED] = ff_h_8x8_rvv;
+            dsp->intra_pred[TX_32X32][TM_VP8_PRED] = ff_tm_32x32_rvv;
+            dsp->intra_pred[TX_16X16][TM_VP8_PRED] = ff_tm_16x16_rvv;
+            dsp->intra_pred[TX_8X8][TM_VP8_PRED] = ff_tm_8x8_rvv;
+            dsp->intra_pred[TX_4X4][TM_VP8_PRED] = ff_tm_4x4_rvv;
         }
     #endif
 }
-- 
2.44.0


[-- Attachment #3: Type: text/plain, Size: 251 bytes --]

_______________________________________________
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".

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [FFmpeg-devel] [PATCH 4/4] lavc/vp9dsp: R-V V ipred tm
  2024-03-02  7:42 [FFmpeg-devel] [PATCH 4/4] lavc/vp9dsp: R-V V ipred tm flow gg
@ 2024-03-03  2:01 ` flow gg
  2024-03-22  6:03   ` flow gg
  0 siblings, 1 reply; 3+ messages in thread
From: flow gg @ 2024-03-03  2:01 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

[-- Attachment #1: Type: text/plain, Size: 135 bytes --]

Due to the PATCH 1/4 update, updates are made here.

flow gg <hlefthleft@gmail.com> 于2024年3月2日周六 15:42写道:

>
>

[-- Attachment #2: 0004-lavc-vp9dsp-R-V-V-ipred-tm.patch --]
[-- Type: text/x-patch, Size: 6536 bytes --]

From d7aa14940f52b627baf0ae4905e8af6038dc16fc Mon Sep 17 00:00:00 2001
From: sunyuechi <sunyuechi@iscas.ac.cn>
Date: Sat, 2 Mar 2024 09:35:22 +0800
Subject: [PATCH 4/4] lavc/vp9dsp: R-V V ipred tm

C908:
vp9_tm_4x4_8bpp_c: 116.5
vp9_tm_4x4_8bpp_rvv_i32: 43.5
vp9_tm_8x8_8bpp_c: 416.2
vp9_tm_8x8_8bpp_rvv_i32: 86.0
vp9_tm_16x16_8bpp_c: 1665.5
vp9_tm_16x16_8bpp_rvv_i32: 187.2
vp9_tm_32x32_8bpp_c: 6974.2
vp9_tm_32x32_8bpp_rvv_i32: 625.7
---
 libavcodec/riscv/vp9_intra_rvv.S | 143 +++++++++++++++++++++++++++++++
 libavcodec/riscv/vp9dsp.h        |   8 ++
 libavcodec/riscv/vp9dsp_init.c   |   4 +
 3 files changed, 155 insertions(+)

diff --git a/libavcodec/riscv/vp9_intra_rvv.S b/libavcodec/riscv/vp9_intra_rvv.S
index 6644c68e67..d3231c9836 100644
--- a/libavcodec/riscv/vp9_intra_rvv.S
+++ b/libavcodec/riscv/vp9_intra_rvv.S
@@ -260,3 +260,146 @@ func ff_h_8x8_rvv, zve32x
 
         ret
 endfunc
+
+.macro tm_sum dst, top, offset
+        lbu          t3, \offset(a2)
+        sub          t3, t3, a4
+        vadd.vx      \dst, \top, t3
+.endm
+
+func ff_tm_32x32_rvv, zve32x
+        lbu          a4, -1(a3)
+        li           t5, 32
+
+        .macro tm_sum32 n1,n2,n3,n4,n5,n6,n7,n8
+
+        vsetvli      zero, t5, e16, m4, ta, ma
+        vle8.v       v8, (a3)
+        vzext.vf2    v28, v8
+
+        tm_sum       v0, v28, \n1
+        tm_sum       v4, v28, \n2
+        tm_sum       v8, v28, \n3
+        tm_sum       v12, v28, \n4
+        tm_sum       v16, v28, \n5
+        tm_sum       v20, v28, \n6
+        tm_sum       v24, v28, \n7
+        tm_sum       v28, v28, \n8
+
+        .irp n 0, 4, 8, 12, 16, 20, 24, 28
+        vmax.vx      v\n, v\n, zero
+        .endr
+
+        vsetvli      zero, zero, e8, m2, ta, ma
+        .irp n 0, 4, 8, 12, 16, 20, 24, 28
+        vnclipu.wi   v\n, v\n, 0
+        vse8.v       v\n, (a0)
+        add          a0, a0, a1
+        .endr
+
+        .endm
+
+        tm_sum32     31, 30, 29, 28, 27, 26, 25, 24
+        tm_sum32     23, 22, 21, 20, 19, 18, 17, 16
+        tm_sum32     15, 14, 13, 12, 11, 10, 9, 8
+        tm_sum32     7, 6, 5, 4, 3, 2, 1, 0
+
+        ret
+endfunc
+
+func ff_tm_16x16_rvv, zve32x
+        vsetivli      zero, 16, e16, m2, ta, ma
+        vle8.v        v8, (a3)
+        vzext.vf2     v30, v8
+        lbu           a4, -1(a3)
+
+        tm_sum       v0, v30, 15
+        tm_sum       v2, v30, 14
+        tm_sum       v4, v30, 13
+        tm_sum       v6, v30, 12
+        tm_sum       v8, v30, 11
+        tm_sum       v10, v30, 10
+        tm_sum       v12, v30, 9
+        tm_sum       v14, v30, 8
+        tm_sum       v16, v30, 7
+        tm_sum       v18, v30, 6
+        tm_sum       v20, v30, 5
+        tm_sum       v22, v30, 4
+        tm_sum       v24, v30, 3
+        tm_sum       v26, v30, 2
+        tm_sum       v28, v30, 1
+        tm_sum       v30, v30, 0
+
+        .irp n 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30
+        vmax.vx      v\n, v\n, zero
+        .endr
+
+        vsetvli      zero, zero, e8, m1, ta, ma
+        .irp n 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28
+        vnclipu.wi   v\n, v\n, 0
+        vse8.v       v\n, (a0)
+        add          a0, a0, a1
+        .endr
+        vnclipu.wi   v30, v30, 0
+        vse8.v       v30, (a0)
+
+        ret
+endfunc
+
+func ff_tm_8x8_rvv, zve32x
+        vsetivli     zero, 8, e16, m1, ta, ma
+        vle8.v       v8, (a3)
+        vzext.vf2    v28, v8
+        lbu          a4, -1(a3)
+
+        tm_sum       v16, v28, 7
+        tm_sum       v17, v28, 6
+        tm_sum       v18, v28, 5
+        tm_sum       v19, v28, 4
+        tm_sum       v20, v28, 3
+        tm_sum       v21, v28, 2
+        tm_sum       v22, v28, 1
+        tm_sum       v23, v28, 0
+
+        .irp n 16, 17, 18, 19, 20, 21, 22, 23
+        vmax.vx      v\n, v\n, zero
+        .endr
+
+        vsetvli      zero, zero, e8, mf2, ta, ma
+        .irp n 16, 17, 18, 19, 20, 21, 22
+        vnclipu.wi   v\n, v\n, 0
+        vse8.v       v\n, (a0)
+        add          a0, a0, a1
+        .endr
+        vnclipu.wi   v24, v23, 0
+        vse8.v       v24, (a0)
+
+        ret
+endfunc
+
+func ff_tm_4x4_rvv, zve32x
+        vsetivli     zero, 4, e16, mf2, ta, ma
+        vle8.v       v8, (a3)
+        vzext.vf2    v28, v8
+        lbu          a4, -1(a3)
+
+        tm_sum       v16, v28, 3
+        tm_sum       v17, v28, 2
+        tm_sum       v18, v28, 1
+        tm_sum       v19, v28, 0
+
+        .irp n 16, 17, 18, 19
+        vmax.vx      v\n, v\n, zero
+        .endr
+
+        vsetvli      zero, zero, e8, mf4, ta, ma
+        .irp n 16, 17, 18
+        vnclipu.wi   v\n, v\n, 0
+        vse8.v       v\n, (a0)
+        add          a0, a0, a1
+        .endr
+        vnclipu.wi   v24, v19, 0
+        vse8.v       v24, (a0)
+
+        ret
+endfunc
diff --git a/libavcodec/riscv/vp9dsp.h b/libavcodec/riscv/vp9dsp.h
index 2b2e0db0d8..cff2310e5c 100644
--- a/libavcodec/riscv/vp9dsp.h
+++ b/libavcodec/riscv/vp9dsp.h
@@ -72,5 +72,13 @@ void ff_h_16x16_rvv(uint8_t *dst, ptrdiff_t stride, const uint8_t *l,
                     const uint8_t *a);
 void ff_h_8x8_rvv(uint8_t *dst, ptrdiff_t stride, const uint8_t *l,
                   const uint8_t *a);
+void ff_tm_32x32_rvv(uint8_t *dst, ptrdiff_t stride, const uint8_t *l,
+                     const uint8_t *a);
+void ff_tm_16x16_rvv(uint8_t *dst, ptrdiff_t stride, const uint8_t *l,
+                     const uint8_t *a);
+void ff_tm_8x8_rvv(uint8_t *dst, ptrdiff_t stride, const uint8_t *l,
+                   const uint8_t *a);
+void ff_tm_4x4_rvv(uint8_t *dst, ptrdiff_t stride, const uint8_t *l,
+                   const uint8_t *a);
 
 #endif  // #ifndef AVCODEC_RISCV_VP9DSP_RISCV_H
diff --git a/libavcodec/riscv/vp9dsp_init.c b/libavcodec/riscv/vp9dsp_init.c
index 16aeeb260a..f08c8f6a42 100644
--- a/libavcodec/riscv/vp9dsp_init.c
+++ b/libavcodec/riscv/vp9dsp_init.c
@@ -57,6 +57,10 @@ static av_cold void vp9dsp_intrapred_init_rvv(VP9DSPContext *dsp, int bpp)
             dsp->intra_pred[TX_32X32][HOR_PRED] = ff_h_32x32_rvv;
             dsp->intra_pred[TX_16X16][HOR_PRED] = ff_h_16x16_rvv;
             dsp->intra_pred[TX_8X8][HOR_PRED] = ff_h_8x8_rvv;
+            dsp->intra_pred[TX_32X32][TM_VP8_PRED] = ff_tm_32x32_rvv;
+            dsp->intra_pred[TX_16X16][TM_VP8_PRED] = ff_tm_16x16_rvv;
+            dsp->intra_pred[TX_8X8][TM_VP8_PRED] = ff_tm_8x8_rvv;
+            dsp->intra_pred[TX_4X4][TM_VP8_PRED] = ff_tm_4x4_rvv;
         }
     #endif
 }
-- 
2.44.0


[-- Attachment #3: Type: text/plain, Size: 251 bytes --]

_______________________________________________
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".

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [FFmpeg-devel] [PATCH 4/4] lavc/vp9dsp: R-V V ipred tm
  2024-03-03  2:01 ` flow gg
@ 2024-03-22  6:03   ` flow gg
  0 siblings, 0 replies; 3+ messages in thread
From: flow gg @ 2024-03-22  6:03 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

[-- Attachment #1: Type: text/plain, Size: 295 bytes --]

Because the previous patch was updated, so it was updated in this response

flow gg <hlefthleft@gmail.com> 于2024年3月3日周日 10:01写道:

> Due to the PATCH 1/4 update, updates are made here.
>
> flow gg <hlefthleft@gmail.com> 于2024年3月2日周六 15:42写道:
>
>>
>>

[-- Attachment #2: 0004-lavc-vp9dsp-R-V-V-ipred-tm.patch --]
[-- Type: text/x-patch, Size: 6649 bytes --]

From 9561d35be25c330a0be3a371269289ce21f5ada3 Mon Sep 17 00:00:00 2001
From: sunyuechi <sunyuechi@iscas.ac.cn>
Date: Thu, 21 Mar 2024 21:42:25 +0800
Subject: [PATCH 4/4] lavc/vp9dsp: R-V V ipred tm

C908:
vp9_tm_4x4_8bpp_c: 116.5
vp9_tm_4x4_8bpp_rvv_i32: 43.5
vp9_tm_8x8_8bpp_c: 416.2
vp9_tm_8x8_8bpp_rvv_i32: 86.0
vp9_tm_16x16_8bpp_c: 1665.5
vp9_tm_16x16_8bpp_rvv_i32: 187.2
vp9_tm_32x32_8bpp_c: 6974.2
vp9_tm_32x32_8bpp_rvv_i32: 625.7
---
 libavcodec/riscv/vp9_intra_rvv.S | 143 +++++++++++++++++++++++++++++++
 libavcodec/riscv/vp9dsp.h        |   8 ++
 libavcodec/riscv/vp9dsp_init.c   |   4 +
 3 files changed, 155 insertions(+)

diff --git a/libavcodec/riscv/vp9_intra_rvv.S b/libavcodec/riscv/vp9_intra_rvv.S
index bf7f6d8692..81590e4f0f 100644
--- a/libavcodec/riscv/vp9_intra_rvv.S
+++ b/libavcodec/riscv/vp9_intra_rvv.S
@@ -213,3 +213,146 @@ func ff_h_8x8_rvv, zve32x
 
         ret
 endfunc
+
+.macro tm_sum dst, top, offset
+        lbu          t3, \offset(a2)
+        sub          t3, t3, a4
+        vadd.vx      \dst, \top, t3
+.endm
+
+func ff_tm_32x32_rvv, zve32x
+        lbu          a4, -1(a3)
+        li           t5, 32
+
+        .macro tm_sum32 n1,n2,n3,n4,n5,n6,n7,n8
+
+        vsetvli      zero, t5, e16, m4, ta, ma
+        vle8.v       v8, (a3)
+        vzext.vf2    v28, v8
+
+        tm_sum       v0, v28, \n1
+        tm_sum       v4, v28, \n2
+        tm_sum       v8, v28, \n3
+        tm_sum       v12, v28, \n4
+        tm_sum       v16, v28, \n5
+        tm_sum       v20, v28, \n6
+        tm_sum       v24, v28, \n7
+        tm_sum       v28, v28, \n8
+
+        .irp n 0, 4, 8, 12, 16, 20, 24, 28
+        vmax.vx      v\n, v\n, zero
+        .endr
+
+        vsetvli      zero, zero, e8, m2, ta, ma
+        .irp n 0, 4, 8, 12, 16, 20, 24, 28
+        vnclipu.wi   v\n, v\n, 0
+        vse8.v       v\n, (a0)
+        add          a0, a0, a1
+        .endr
+
+        .endm
+
+        tm_sum32     31, 30, 29, 28, 27, 26, 25, 24
+        tm_sum32     23, 22, 21, 20, 19, 18, 17, 16
+        tm_sum32     15, 14, 13, 12, 11, 10, 9, 8
+        tm_sum32     7, 6, 5, 4, 3, 2, 1, 0
+
+        ret
+endfunc
+
+func ff_tm_16x16_rvv, zve32x
+        vsetivli      zero, 16, e16, m2, ta, ma
+        vle8.v        v8, (a3)
+        vzext.vf2     v30, v8
+        lbu           a4, -1(a3)
+
+        tm_sum       v0, v30, 15
+        tm_sum       v2, v30, 14
+        tm_sum       v4, v30, 13
+        tm_sum       v6, v30, 12
+        tm_sum       v8, v30, 11
+        tm_sum       v10, v30, 10
+        tm_sum       v12, v30, 9
+        tm_sum       v14, v30, 8
+        tm_sum       v16, v30, 7
+        tm_sum       v18, v30, 6
+        tm_sum       v20, v30, 5
+        tm_sum       v22, v30, 4
+        tm_sum       v24, v30, 3
+        tm_sum       v26, v30, 2
+        tm_sum       v28, v30, 1
+        tm_sum       v30, v30, 0
+
+        .irp n 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30
+        vmax.vx      v\n, v\n, zero
+        .endr
+
+        vsetvli      zero, zero, e8, m1, ta, ma
+        .irp n 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28
+        vnclipu.wi   v\n, v\n, 0
+        vse8.v       v\n, (a0)
+        add          a0, a0, a1
+        .endr
+        vnclipu.wi   v30, v30, 0
+        vse8.v       v30, (a0)
+
+        ret
+endfunc
+
+func ff_tm_8x8_rvv, zve32x
+        vsetivli     zero, 8, e16, m1, ta, ma
+        vle8.v       v8, (a3)
+        vzext.vf2    v28, v8
+        lbu          a4, -1(a3)
+
+        tm_sum       v16, v28, 7
+        tm_sum       v17, v28, 6
+        tm_sum       v18, v28, 5
+        tm_sum       v19, v28, 4
+        tm_sum       v20, v28, 3
+        tm_sum       v21, v28, 2
+        tm_sum       v22, v28, 1
+        tm_sum       v23, v28, 0
+
+        .irp n 16, 17, 18, 19, 20, 21, 22, 23
+        vmax.vx      v\n, v\n, zero
+        .endr
+
+        vsetvli      zero, zero, e8, mf2, ta, ma
+        .irp n 16, 17, 18, 19, 20, 21, 22
+        vnclipu.wi   v\n, v\n, 0
+        vse8.v       v\n, (a0)
+        add          a0, a0, a1
+        .endr
+        vnclipu.wi   v24, v23, 0
+        vse8.v       v24, (a0)
+
+        ret
+endfunc
+
+func ff_tm_4x4_rvv, zve32x
+        vsetivli     zero, 4, e16, mf2, ta, ma
+        vle8.v       v8, (a3)
+        vzext.vf2    v28, v8
+        lbu          a4, -1(a3)
+
+        tm_sum       v16, v28, 3
+        tm_sum       v17, v28, 2
+        tm_sum       v18, v28, 1
+        tm_sum       v19, v28, 0
+
+        .irp n 16, 17, 18, 19
+        vmax.vx      v\n, v\n, zero
+        .endr
+
+        vsetvli      zero, zero, e8, mf4, ta, ma
+        .irp n 16, 17, 18
+        vnclipu.wi   v\n, v\n, 0
+        vse8.v       v\n, (a0)
+        add          a0, a0, a1
+        .endr
+        vnclipu.wi   v24, v19, 0
+        vse8.v       v24, (a0)
+
+        ret
+endfunc
diff --git a/libavcodec/riscv/vp9dsp.h b/libavcodec/riscv/vp9dsp.h
index 51d9bc3957..0bf7d18a7a 100644
--- a/libavcodec/riscv/vp9dsp.h
+++ b/libavcodec/riscv/vp9dsp.h
@@ -72,6 +72,14 @@ void ff_h_16x16_rvv(uint8_t *dst, ptrdiff_t stride, const uint8_t *l,
                     const uint8_t *a);
 void ff_h_8x8_rvv(uint8_t *dst, ptrdiff_t stride, const uint8_t *l,
                   const uint8_t *a);
+void ff_tm_32x32_rvv(uint8_t *dst, ptrdiff_t stride, const uint8_t *l,
+                     const uint8_t *a);
+void ff_tm_16x16_rvv(uint8_t *dst, ptrdiff_t stride, const uint8_t *l,
+                     const uint8_t *a);
+void ff_tm_8x8_rvv(uint8_t *dst, ptrdiff_t stride, const uint8_t *l,
+                   const uint8_t *a);
+void ff_tm_4x4_rvv(uint8_t *dst, ptrdiff_t stride, const uint8_t *l,
+                   const uint8_t *a);
 
 #define VP9_8TAP_RISCV_RVV_FUNC(SIZE, type, type_idx)                         \
 void ff_put_8tap_##type##_##SIZE##h_rvv(uint8_t *dst, ptrdiff_t dststride,   \
diff --git a/libavcodec/riscv/vp9dsp_init.c b/libavcodec/riscv/vp9dsp_init.c
index 16aeeb260a..f08c8f6a42 100644
--- a/libavcodec/riscv/vp9dsp_init.c
+++ b/libavcodec/riscv/vp9dsp_init.c
@@ -57,6 +57,10 @@ static av_cold void vp9dsp_intrapred_init_rvv(VP9DSPContext *dsp, int bpp)
             dsp->intra_pred[TX_32X32][HOR_PRED] = ff_h_32x32_rvv;
             dsp->intra_pred[TX_16X16][HOR_PRED] = ff_h_16x16_rvv;
             dsp->intra_pred[TX_8X8][HOR_PRED] = ff_h_8x8_rvv;
+            dsp->intra_pred[TX_32X32][TM_VP8_PRED] = ff_tm_32x32_rvv;
+            dsp->intra_pred[TX_16X16][TM_VP8_PRED] = ff_tm_16x16_rvv;
+            dsp->intra_pred[TX_8X8][TM_VP8_PRED] = ff_tm_8x8_rvv;
+            dsp->intra_pred[TX_4X4][TM_VP8_PRED] = ff_tm_4x4_rvv;
         }
     #endif
 }
-- 
2.44.0


[-- Attachment #3: Type: text/plain, Size: 251 bytes --]

_______________________________________________
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".

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-03-22  6:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-02  7:42 [FFmpeg-devel] [PATCH 4/4] lavc/vp9dsp: R-V V ipred tm flow gg
2024-03-03  2:01 ` flow gg
2024-03-22  6:03   ` flow gg

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git