diff mbox series

[FFmpeg-devel,3/3] lavc/h264dsp: R-V V h264_add_pixels8_clear

Message ID CAEa-L+shaSbos6f9aRMU36ARb+5+ncf3wUXV8Lz0_DaOSuTckA@mail.gmail.com
State New
Headers show
Series [FFmpeg-devel,1/3] checkasm/h264dsp: add h264_add_pixels_clear test | expand

Checks

Context Check Description
andriy/configure_x86 warning Failed to apply patch
yinshiyou/configure_loongarch64 warning Failed to apply patch

Commit Message

flow gg Dec. 25, 2023, 4:01 a.m. UTC
C908
h264_add_pixels8_clear_c: 262.0
h264_add_pixels8_clear_rvv_i64: 59.0

Comments

flow gg Jan. 11, 2024, 4:56 p.m. UTC | #1
ping

flow gg <hlefthleft@gmail.com> 于2023年12月25日周一 12:01写道:

> C908
> h264_add_pixels8_clear_c: 262.0
> h264_add_pixels8_clear_rvv_i64: 59.0
>
diff mbox series

Patch

From 11218f9067566fa3ace8821b4b890457d6ea17f9 Mon Sep 17 00:00:00 2001
From: sunyuechi <sunyuechi@iscas.ac.cn>
Date: Mon, 25 Dec 2023 00:07:09 +0800
Subject: [PATCH 3/3] lavc/h264dsp: R-V V h264_add_pixels8_clear

C908
h264_add_pixels8_clear_c: 262.0
h264_add_pixels8_clear_rvv_i64: 59.0
---
 libavcodec/riscv/h264dsp_init.c |  2 ++
 libavcodec/riscv/h264dsp_rvv.S  | 22 ++++++++++++++++++++++
 2 files changed, 24 insertions(+)

diff --git a/libavcodec/riscv/h264dsp_init.c b/libavcodec/riscv/h264dsp_init.c
index 2538bc01a5..5630b08efd 100644
--- a/libavcodec/riscv/h264dsp_init.c
+++ b/libavcodec/riscv/h264dsp_init.c
@@ -26,6 +26,7 @@ 
 #include "libavcodec/h264dsp.h"
 
 void ff_h264_add_pixels4_clear_rvv(uint8_t *dst, int16_t *block, int stride);
+void ff_h264_add_pixels8_clear_rvv(uint8_t *dst, int16_t *block, int stride);
 
 av_cold void ff_h264dsp_init_riscv(H264DSPContext *c, const int bit_depth, const int chroma_format_idc)
 {
@@ -35,6 +36,7 @@  av_cold void ff_h264dsp_init_riscv(H264DSPContext *c, const int bit_depth, const
     if (flags & AV_CPU_FLAG_RVV_I64) {
         if (bit_depth == 8) {
             c->h264_add_pixels4_clear = ff_h264_add_pixels4_clear_rvv;
+            c->h264_add_pixels8_clear = ff_h264_add_pixels8_clear_rvv;
         }
     }
 #endif
diff --git a/libavcodec/riscv/h264dsp_rvv.S b/libavcodec/riscv/h264dsp_rvv.S
index e6b943f57e..6a7ecb6858 100644
--- a/libavcodec/riscv/h264dsp_rvv.S
+++ b/libavcodec/riscv/h264dsp_rvv.S
@@ -40,3 +40,25 @@  func ff_h264_add_pixels4_clear_rvv, zve64x
 
         ret
 endfunc
+
+func ff_h264_add_pixels8_clear_rvv, zve64x
+        vsetivli   zero, 16, e8, m1, ta, ma
+        vle64.v    v24, (a1)
+        li         t1, 8*8
+        vsetvli    zero, t1, e16, m8, ta, ma
+        li         t0, 0xff
+        vand.vx    v24, v24, t0
+        addi       a1, a1, 8*8*2
+        vsetivli   zero, 16, e8, m1, ta, ma
+        vse64.v    v0, (a1)
+        vsetvli    zero, t1, e8, m4, ta, ma
+        vnclipu.wi v24, v24, 0
+        vsetivli   zero, 8, e8, mf2, ta, ma
+        vle64.v    v8, (a0)
+        vsetvli    zero, t1, e8, m4, ta, ma
+        vadd.vv    v24, v24, v8
+        vsetivli   zero, 8, e8, mf2, ta, ma
+        vse64.v    v24, (a0)
+
+        ret
+endfunc
-- 
2.43.0