From c2814bb8cc32362822b5a546c8de21b3a0e89032 Mon Sep 17 00:00:00 2001 From: Wang Chen Date: Mon, 10 Jul 2023 09:19:39 +0800 Subject: add example how to use rtcd Just use vp8_sixtap_predict as example but have not implemented it actually. Test: $ CROSS=riscv64-unknown-linux-gnu- ../libvpx/configure --target=riscv64-linux-gcc $ make Check if vp8_sixtap_predict functions have been replaced with those suffixed with "_rvv": $ riscv64-unknown-linux-gnu-nm ./vp8/decoder/decodeframe.c.o | grep vp8_sixtap_predict16x16 U vp8_sixtap_predict16x16_rvv Check if vp8_sixtap_predictMxN_rvv work. $ qemu-riscv64 -L $SYSROOT_RV64 ./build-test/test_libvpx --gtest_filter="RVV/SixtapPredictTest.TestWithPresetData/*" You should see print log output such as: "--> vp8_sixtap_predict4x4_rvv" "FAILED" is expected due to we have not implemented the actual algorithm. Signed-off-by: Wang Chen Co-authored-by: sun min --- build/make/Makefile | 4 +++ test/predict_test.cc | 9 +++++ vp8/common/riscv/sixtap_predict_rvv.c | 63 +++++++++++++++++++++++++++++++++++ vp8/common/rtcd_defs.pl | 8 ++--- vp8/vp8_common.mk | 3 ++ 5 files changed, 83 insertions(+), 4 deletions(-) create mode 100644 vp8/common/riscv/sixtap_predict_rvv.c diff --git a/build/make/Makefile b/build/make/Makefile index 65ac2290c..427330fd8 100644 --- a/build/make/Makefile +++ b/build/make/Makefile @@ -157,6 +157,10 @@ $(BUILD_PFX)%_lsx.c.o: CFLAGS += -mlsx $(BUILD_PFX)%_lasx.c.d: CFLAGS += -mlasx $(BUILD_PFX)%_lasx.c.o: CFLAGS += -mlasx +# RISCV +$(BUILD_PFX)%_rvv.c.d: CFLAGS += -march=rv64gcv +$(BUILD_PFX)%_rvv.c.o: CFLAGS += -march=rv64gcv + $(BUILD_PFX)%.c.d: %.c $(if $(quiet),@echo " [DEP] $@") $(qexec)mkdir -p $(dir $@) diff --git a/test/predict_test.cc b/test/predict_test.cc index 747297057..d686a9161 100644 --- a/test/predict_test.cc +++ b/test/predict_test.cc @@ -350,6 +350,15 @@ INSTANTIATE_TEST_SUITE_P( make_tuple(4, 4, &vp8_sixtap_predict4x4_mmi))); #endif +#if HAVE_RVV +INSTANTIATE_TEST_SUITE_P( + RVV, SixtapPredictTest, + ::testing::Values(make_tuple(16, 16, &vp8_sixtap_predict16x16_rvv), + make_tuple(8, 8, &vp8_sixtap_predict8x8_rvv), + make_tuple(8, 4, &vp8_sixtap_predict8x4_rvv), + make_tuple(4, 4, &vp8_sixtap_predict4x4_rvv))); +#endif + class BilinearPredictTest : public PredictTestBase {}; TEST_P(BilinearPredictTest, TestWithRandomData) { diff --git a/vp8/common/riscv/sixtap_predict_rvv.c b/vp8/common/riscv/sixtap_predict_rvv.c new file mode 100644 index 000000000..0345d026e --- /dev/null +++ b/vp8/common/riscv/sixtap_predict_rvv.c @@ -0,0 +1,63 @@ +#include +#include +#include "./vpx_config.h" +#include "./vp8_rtcd.h" + +#define UNUSED(x) (void)(x) + +void vp8_sixtap_predict4x4_rvv(unsigned char *src_ptr, int src_pixels_per_line, + int xoffset, int yoffset, + unsigned char *dst_ptr, int dst_pitch) +{ + UNUSED(src_ptr); + UNUSED(src_pixels_per_line); + UNUSED(xoffset); + UNUSED(yoffset); + UNUSED(dst_ptr); + UNUSED(dst_pitch); + + printf("--> vp8_sixtap_predict4x4_rvv\n"); +} + +void vp8_sixtap_predict8x4_rvv(unsigned char *src_ptr, int src_pixels_per_line, + int xoffset, int yoffset, + unsigned char *dst_ptr, int dst_pitch) +{ + UNUSED(src_ptr); + UNUSED(src_pixels_per_line); + UNUSED(xoffset); + UNUSED(yoffset); + UNUSED(dst_ptr); + UNUSED(dst_pitch); + + printf("--> vp8_sixtap_predict8x4_rvv\n"); +} + +void vp8_sixtap_predict8x8_rvv(unsigned char *src_ptr, int src_pixels_per_line, + int xoffset, int yoffset, + unsigned char *dst_ptr, int dst_pitch) +{ + UNUSED(src_ptr); + UNUSED(src_pixels_per_line); + UNUSED(xoffset); + UNUSED(yoffset); + UNUSED(dst_ptr); + UNUSED(dst_pitch); + + printf("--> vp8_sixtap_predict8x8_rvv\n"); +} + +void vp8_sixtap_predict16x16_rvv(unsigned char *src_ptr, + int src_pixels_per_line, int xoffset, + int yoffset, unsigned char *dst_ptr, + int dst_pitch) +{ + UNUSED(src_ptr); + UNUSED(src_pixels_per_line); + UNUSED(xoffset); + UNUSED(yoffset); + UNUSED(dst_ptr); + UNUSED(dst_pitch); + + printf("--> vp8_sixtap_predict16x16_rvv\n"); +} diff --git a/vp8/common/rtcd_defs.pl b/vp8/common/rtcd_defs.pl index 739a61284..3831a3c35 100644 --- a/vp8/common/rtcd_defs.pl +++ b/vp8/common/rtcd_defs.pl @@ -146,16 +146,16 @@ if (vpx_config("CONFIG_POSTPROC") eq "yes") { # Subpixel # add_proto qw/void vp8_sixtap_predict16x16/, "unsigned char *src_ptr, int src_pixels_per_line, int xoffset, int yoffset, unsigned char *dst_ptr, int dst_pitch"; -specialize qw/vp8_sixtap_predict16x16 sse2 ssse3 neon dspr2 msa mmi lsx/; +specialize qw/vp8_sixtap_predict16x16 sse2 ssse3 neon dspr2 msa mmi lsx rvv/; add_proto qw/void vp8_sixtap_predict8x8/, "unsigned char *src_ptr, int src_pixels_per_line, int xoffset, int yoffset, unsigned char *dst_ptr, int dst_pitch"; -specialize qw/vp8_sixtap_predict8x8 sse2 ssse3 neon dspr2 msa mmi lsx/; +specialize qw/vp8_sixtap_predict8x8 sse2 ssse3 neon dspr2 msa mmi lsx rvv/; add_proto qw/void vp8_sixtap_predict8x4/, "unsigned char *src_ptr, int src_pixels_per_line, int xoffset, int yoffset, unsigned char *dst_ptr, int dst_pitch"; -specialize qw/vp8_sixtap_predict8x4 sse2 ssse3 neon dspr2 msa mmi/; +specialize qw/vp8_sixtap_predict8x4 sse2 ssse3 neon dspr2 msa mmi rvv/; add_proto qw/void vp8_sixtap_predict4x4/, "unsigned char *src_ptr, int src_pixels_per_line, int xoffset, int yoffset, unsigned char *dst_ptr, int dst_pitch"; -specialize qw/vp8_sixtap_predict4x4 mmx ssse3 neon dspr2 msa mmi lsx/; +specialize qw/vp8_sixtap_predict4x4 mmx ssse3 neon dspr2 msa mmi lsx rvv/; add_proto qw/void vp8_bilinear_predict16x16/, "unsigned char *src_ptr, int src_pixels_per_line, int xoffset, int yoffset, unsigned char *dst_ptr, int dst_pitch"; specialize qw/vp8_bilinear_predict16x16 sse2 ssse3 neon msa/; diff --git a/vp8/vp8_common.mk b/vp8/vp8_common.mk index d485965d3..54bb5eadb 100644 --- a/vp8/vp8_common.mk +++ b/vp8/vp8_common.mk @@ -146,4 +146,7 @@ VP8_COMMON_SRCS-$(HAVE_NEON) += common/arm/neon/mbloopfilter_neon.c VP8_COMMON_SRCS-$(HAVE_NEON) += common/arm/neon/shortidct4x4llm_neon.c VP8_COMMON_SRCS-$(HAVE_NEON) += common/arm/neon/sixtappredict_neon.c +# common (rvv intrinsics) +VP8_COMMON_SRCS-$(HAVE_RVV) += common/riscv/sixtap_predict_rvv.c + $(eval $(call rtcd_h_template,vp8_rtcd,vp8/common/rtcd_defs.pl)) -- cgit v1.2.3