Re: [FFmpeg-devel] [PATCH] lavc/vp8dsp: R-V V put_vp8_pixels

2024-02-21 Thread flow gg
This vp8dsp.h is from libavcodec/aarch64/vp8dsp.h
It simply changes AARCH64 to RISCV
libavcodec/arm/vp8dsp.h uses a similar method (arm in this header file
added 4 lines of other arm function declarations)
I want to simply use the same pattern

Rémi Denis-Courmont  于2024年2月22日周四 02:02写道:

> Hello,
>
> Le maanantaina 19. helmikuuta 2024, 13.13.43 EET flow gg a écrit :
> > The reason for using m1+le8 instead of stride load + larger group
> > multipliers is the same as in "[FFmpeg-devel] [PATCH 1/7] lavc/me_cmp:
> R-V
> > V pix_abs."
> >
> > In the test, there is
> >
> > #define src (buf + 2 * SRC_BUF_STRIDE + 2 + 1)
> >
> > Therefore, not using e8 will result : (fatal signal 7: Bus error).
>
> Yes, you could also just say that alignment is insufficient :)
>
> It is still possible to load rectangles of up to 8 columns using vlseg8e8,
> but
> it might be slower than just repeating the 8 regular loads, and it won't
> work
> if you need calculations between rows.
>
> I may be missing something but I don't understand what purpose the header
> file
> serves here?
>
> --
> Rémi Denis-Courmont
> http://www.remlab.net/
>
>
>
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
>
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH] lavc/vp8dsp: R-V V put_vp8_pixels

2024-02-21 Thread Rémi Denis-Courmont
Hello,

Le maanantaina 19. helmikuuta 2024, 13.13.43 EET flow gg a écrit :
> The reason for using m1+le8 instead of stride load + larger group
> multipliers is the same as in "[FFmpeg-devel] [PATCH 1/7] lavc/me_cmp: R-V
> V pix_abs."
> 
> In the test, there is
> 
> #define src (buf + 2 * SRC_BUF_STRIDE + 2 + 1)
> 
> Therefore, not using e8 will result : (fatal signal 7: Bus error).

Yes, you could also just say that alignment is insufficient :)

It is still possible to load rectangles of up to 8 columns using vlseg8e8, but 
it might be slower than just repeating the 8 regular loads, and it won't work 
if you need calculations between rows.

I may be missing something but I don't understand what purpose the header file 
serves here?

-- 
Rémi Denis-Courmont
http://www.remlab.net/



___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH] lavc/vp8dsp: R-V V put_vp8_pixels

2024-02-19 Thread flow gg
The reason for using m1+le8 instead of stride load + larger group
multipliers is the same as in "[FFmpeg-devel] [PATCH 1/7] lavc/me_cmp: R-V
V pix_abs."

In the test, there is

#define src (buf + 2 * SRC_BUF_STRIDE + 2 + 1)

Therefore, not using e8 will result : (fatal signal 7: Bus error).
From 6daaabd19c26b01b948804e4ec84a6f606746ec7 Mon Sep 17 00:00:00 2001
From: sunyuechi 
Date: Mon, 19 Feb 2024 18:03:58 +0800
Subject: [PATCH] lavc/vp8dsp: R-V V put_vp8_pixels

C908:
vp8_put_pixels4_c: 87.5
vp8_put_pixels4_rvv_i32: 42.7
vp8_put_pixels8_c: 284.5
vp8_put_pixels8_rvv_i32: 77.7
vp8_put_pixels16_c: 1087.7
vp8_put_pixels16_rvv_i32: 108.0
---
 libavcodec/riscv/vp8dsp.h  | 75 ++
 libavcodec/riscv/vp8dsp_init.c | 22 ++
 libavcodec/riscv/vp8dsp_rvv.S  | 27 
 libavcodec/vp8dsp.c|  2 +
 libavcodec/vp8dsp.h|  1 +
 5 files changed, 127 insertions(+)
 create mode 100644 libavcodec/riscv/vp8dsp.h

diff --git a/libavcodec/riscv/vp8dsp.h b/libavcodec/riscv/vp8dsp.h
new file mode 100644
index 00..971c5c0a96
--- /dev/null
+++ b/libavcodec/riscv/vp8dsp.h
@@ -0,0 +1,75 @@
+/*
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef AVCODEC_RISCV_VP8DSP_H
+#define AVCODEC_RISCV_VP8DSP_H
+
+#include "libavcodec/vp8dsp.h"
+
+#define VP8_LF_Y(hv, inner, opt) \
+void ff_vp8_##hv##_loop_filter16##inner##_##opt(uint8_t *dst,\
+ptrdiff_t stride,\
+int flim_E, int flim_I,  \
+int hev_thresh)
+
+#define VP8_LF_UV(hv, inner, opt)\
+void ff_vp8_##hv##_loop_filter8uv##inner##_##opt(uint8_t *dstU,  \
+ uint8_t *dstV,  \
+ ptrdiff_t stride,   \
+ int flim_E, int flim_I, \
+ int hev_thresh)
+
+#define VP8_LF_SIMPLE(hv, opt)  \
+void ff_vp8_##hv##_loop_filter16_simple_##opt(uint8_t *dst, \
+  ptrdiff_t stride, \
+  int flim)
+
+#define VP8_LF_HV(inner, opt)   \
+VP8_LF_Y(h,  inner, opt);   \
+VP8_LF_Y(v,  inner, opt);   \
+VP8_LF_UV(h, inner, opt);   \
+VP8_LF_UV(v, inner, opt)
+
+#define VP8_LF(opt) \
+VP8_LF_HV(,   opt); \
+VP8_LF_HV(_inner, opt); \
+VP8_LF_SIMPLE(h, opt);  \
+VP8_LF_SIMPLE(v, opt)
+
+#define VP8_MC(n, opt)  \
+void ff_put_vp8_##n##_##opt(uint8_t *dst, ptrdiff_t dststride,  \
+const uint8_t *src, ptrdiff_t srcstride,\
+int h, int x, int y)
+
+#define VP8_EPEL(w, opt)\
+VP8_MC(pixels ## w, opt);   \
+VP8_MC(epel ## w ## _h4, opt);  \
+VP8_MC(epel ## w ## _h6, opt);  \
+VP8_MC(epel ## w ## _v4, opt);  \
+VP8_MC(epel ## w ## _h4v4, opt);\
+VP8_MC(epel ## w ## _h6v4, opt);\
+VP8_MC(epel ## w ## _v6, opt);  \
+VP8_MC(epel ## w ## _h4v6, opt);\
+VP8_MC(epel ## w ## _h6v6, opt)
+
+#define VP8_BILIN(w, opt)   \
+VP8_MC(bilin ## w ## _h, opt);  \
+VP8_MC(bilin ## w ## _v, opt);  \
+VP8_MC(bilin ## w ## _hv, opt)
+
+#endif /* AVCODEC_RISCV_VP8DSP_H */
diff --git a/libavcodec/riscv/vp8dsp_init.c b/libavcodec/riscv/vp8dsp_init.c
index af57aabb71..c364de3dc9 100644
--- a/libavcodec/riscv/vp8dsp_init.c
+++ b/libavcodec/riscv/vp8dsp_init.c
@@ -24,11 +24,33 @@
 #include "libavutil/cpu.h"
 #include "libavutil/riscv/cpu.h"
 #include "libavcodec/vp8dsp.h"
+#include "vp8dsp.h"
 
 void f