[FFmpeg-cvslog] checkasm/huffyuvdsp: test for add_hfyu_left_pred_bgr32

2023-11-15 Thread Rémi Denis-Courmont
ffmpeg | branch: master | Rémi Denis-Courmont  | Sun Nov 12 
15:41:59 2023 +0200| [6b708cd7831342496b4430ef8c62ad9b8d836dd4] | committer: 
Rémi Denis-Courmont

checkasm/huffyuvdsp: test for add_hfyu_left_pred_bgr32

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=6b708cd7831342496b4430ef8c62ad9b8d836dd4
---

 tests/checkasm/huffyuvdsp.c | 30 ++
 1 file changed, 30 insertions(+)

diff --git a/tests/checkasm/huffyuvdsp.c b/tests/checkasm/huffyuvdsp.c
index 6ba27e267f..a08f5a8391 100644
--- a/tests/checkasm/huffyuvdsp.c
+++ b/tests/checkasm/huffyuvdsp.c
@@ -64,6 +64,34 @@ static void check_add_int16(HuffYUVDSPContext *c, unsigned 
mask, int width, cons
 av_free(dst1);
 }
 
+static void check_add_hfyu_left_pred_bgr32(HuffYUVDSPContext *c)
+{
+#define BUF_SIZE 1080
+uint8_t src[4 * BUF_SIZE], dst0[4 * BUF_SIZE], dst1[4 * BUF_SIZE];
+uint8_t left[4], left0[4], left1[4];
+
+declare_func(void, uint8_t *d, const uint8_t *s, intptr_t w, uint8_t *l);
+
+randomize_buffers(src, sizeof (src));
+randomize_buffers(left, sizeof (left));
+memcpy(left0, left, sizeof (left));
+memcpy(left1, left, sizeof (left));
+
+if (check_func(c->add_hfyu_left_pred_bgr32, "add_hfyu_left_pred_bgr32")) {
+call_ref(dst0, src, BUF_SIZE, left0);
+call_new(dst1, src, BUF_SIZE, left1);
+
+if (memcmp(dst0, dst1, sizeof (dst0)) != 0 ||
+memcmp(left0, left1, sizeof (left0)) != 0) {
+fail();
+}
+
+bench_new(dst1, src, BUF_SIZE, left);
+}
+
+report("add_hfyu_left_pred_bgr32");
+}
+
 void checkasm_check_huffyuvdsp(void)
 {
 HuffYUVDSPContext c;
@@ -78,4 +106,6 @@ void checkasm_check_huffyuvdsp(void)
 /*! test always with the same size (for perf test) */
 check_add_int16(&c, 65535, 16*128, "add_int16_128");
 report("add_int16_128");
+
+check_add_hfyu_left_pred_bgr32(&c);
 }

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

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


[FFmpeg-cvslog] lavc/huffyuvdsp: basic R-V V add_hfyu_left_pred_bgr32

2023-11-15 Thread Rémi Denis-Courmont
ffmpeg | branch: master | Rémi Denis-Courmont  | Sun Nov 12 
15:38:45 2023 +0200| [90a779bed6a269d2fe63887d970461418ece72b4] | committer: 
Rémi Denis-Courmont

lavc/huffyuvdsp: basic R-V V add_hfyu_left_pred_bgr32

Better performance can probably be achieved with a more intricate
unrolled loop, but this is a start:

add_hfyu_left_pred_bgr32_c: 15084.0
add_hfyu_left_pred_bgr32_rvv_i32: 10280.2

This would actually be cleaner with the RISC-V P extension, but that is
not ratified yet (I think?) and usually not supported if V is supported.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=90a779bed6a269d2fe63887d970461418ece72b4
---

 libavcodec/riscv/huffyuvdsp_init.c |  6 +-
 libavcodec/riscv/huffyuvdsp_rvv.S  | 16 
 2 files changed, 21 insertions(+), 1 deletion(-)

diff --git a/libavcodec/riscv/huffyuvdsp_init.c 
b/libavcodec/riscv/huffyuvdsp_init.c
index 115b25881c..b49b3dc097 100644
--- a/libavcodec/riscv/huffyuvdsp_init.c
+++ b/libavcodec/riscv/huffyuvdsp_init.c
@@ -24,6 +24,8 @@
 #include "libavcodec/huffyuvdsp.h"
 
 void ff_add_int16_rvv(uint16_t *dst, const uint16_t *src, unsigned m, int w);
+void ff_add_hfyu_left_pred_bgr32_rvv(uint8_t *dst, const uint8_t *src,
+ intptr_t w, uint8_t *left);
 
 av_cold void ff_huffyuvdsp_init_riscv(HuffYUVDSPContext *c,
   enum AVPixelFormat pix_fmt)
@@ -31,7 +33,9 @@ av_cold void ff_huffyuvdsp_init_riscv(HuffYUVDSPContext *c,
 #if HAVE_RVV
 int flags = av_get_cpu_flags();
 
-if ((flags & AV_CPU_FLAG_RVV_I32) && (flags & AV_CPU_FLAG_RVB_ADDR))
+if ((flags & AV_CPU_FLAG_RVV_I32) && (flags & AV_CPU_FLAG_RVB_ADDR)) {
 c->add_int16 = ff_add_int16_rvv;
+c->add_hfyu_left_pred_bgr32 = ff_add_hfyu_left_pred_bgr32_rvv;
+}
 #endif
 }
diff --git a/libavcodec/riscv/huffyuvdsp_rvv.S 
b/libavcodec/riscv/huffyuvdsp_rvv.S
index f8926fdaea..9c4434907d 100644
--- a/libavcodec/riscv/huffyuvdsp_rvv.S
+++ b/libavcodec/riscv/huffyuvdsp_rvv.S
@@ -35,3 +35,19 @@ func ff_add_int16_rvv, zve32x
 
 ret
 endfunc
+
+func ff_add_hfyu_left_pred_bgr32_rvv, zve32x
+vsetivli zero, 4, e8, m1, ta, ma
+vle8.v  v8, (a3)
+sh2add  a2, a2, a1
+1:
+vle8.v  v0, (a1)
+vadd.vv v8, v8, v0
+addia1, a1, 4
+vse8.v  v8, (a0)
+addia0, a0, 4
+bne a2, a1, 1b
+
+vse8.v  v8, (a3)
+ret
+endfunc

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

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


[FFmpeg-cvslog] avcodec/vp8: Export `vp8_token_update_probs` variable

2023-11-15 Thread Dai , Jianhui J
ffmpeg | branch: master | Dai, Jianhui J 
 | Mon Nov 13 01:44:06 2023 +| 
[5cb8accd09054f8d9dd63f325a290a1008ce1e7e] | committer: Ronald S. Bultje

avcodec/vp8: Export `vp8_token_update_probs` variable

This commit exports the `vp8_token_update_probs` variable to internal
library scope to facilitate its reuse within the library.

Signed-off-by: Jianhui Dai 
Signed-off-by: Ronald S. Bultje 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=5cb8accd09054f8d9dd63f325a290a1008ce1e7e
---

 libavcodec/vp8.c |   2 +-
 libavcodec/vp8data.c | 170 ++
 libavcodec/vp8data.h | 171 +--
 3 files changed, 172 insertions(+), 171 deletions(-)

diff --git a/libavcodec/vp8.c b/libavcodec/vp8.c
index ffc430dd32..83c60adeb0 100644
--- a/libavcodec/vp8.c
+++ b/libavcodec/vp8.c
@@ -458,7 +458,7 @@ static void vp78_update_probability_tables(VP8Context *s)
 for (j = 0; j < 8; j++)
 for (k = 0; k < 3; k++)
 for (l = 0; l < NUM_DCT_TOKENS-1; l++)
-if (vpx_rac_get_prob_branchy(c, 
vp8_token_update_probs[i][j][k][l])) {
+if (vpx_rac_get_prob_branchy(c, 
ff_vp8_token_update_probs[i][j][k][l])) {
 int prob = vp89_rac_get_uint(c, 8);
 for (m = 0; vp8_coeff_band_indexes[j][m] >= 0; m++)
 
s->prob->token[i][vp8_coeff_band_indexes[j][m]][k][l] = prob;
diff --git a/libavcodec/vp8data.c b/libavcodec/vp8data.c
index 857406928a..675c2a033d 100644
--- a/libavcodec/vp8data.c
+++ b/libavcodec/vp8data.c
@@ -40,3 +40,173 @@ const uint8_t *const ff_vp8_dct_cat_prob[] = {
 vp8_dct_cat6_prob,
 };
 
+const uint8_t ff_vp8_token_update_probs[4][8][3][11] = {
+{
+{
+{ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
+{ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
+{ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
+},
+{
+{ 176, 246, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
+{ 223, 241, 252, 255, 255, 255, 255, 255, 255, 255, 255 },
+{ 249, 253, 253, 255, 255, 255, 255, 255, 255, 255, 255 },
+},
+{
+{ 255, 244, 252, 255, 255, 255, 255, 255, 255, 255, 255 },
+{ 234, 254, 254, 255, 255, 255, 255, 255, 255, 255, 255 },
+{ 253, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
+},
+{
+{ 255, 246, 254, 255, 255, 255, 255, 255, 255, 255, 255 },
+{ 239, 253, 254, 255, 255, 255, 255, 255, 255, 255, 255 },
+{ 254, 255, 254, 255, 255, 255, 255, 255, 255, 255, 255 },
+},
+{
+{ 255, 248, 254, 255, 255, 255, 255, 255, 255, 255, 255 },
+{ 251, 255, 254, 255, 255, 255, 255, 255, 255, 255, 255 },
+{ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
+},
+{
+{ 255, 253, 254, 255, 255, 255, 255, 255, 255, 255, 255 },
+{ 251, 254, 254, 255, 255, 255, 255, 255, 255, 255, 255 },
+{ 254, 255, 254, 255, 255, 255, 255, 255, 255, 255, 255 },
+},
+{
+{ 255, 254, 253, 255, 254, 255, 255, 255, 255, 255, 255 },
+{ 250, 255, 254, 255, 254, 255, 255, 255, 255, 255, 255 },
+{ 254, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
+},
+{
+{ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
+{ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
+{ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
+},
+},
+{
+{
+{ 217, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
+{ 225, 252, 241, 253, 255, 255, 254, 255, 255, 255, 255 },
+{ 234, 250, 241, 250, 253, 255, 253, 254, 255, 255, 255 },
+},
+{
+{ 255, 254, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
+{ 223, 254, 254, 255, 255, 255, 255, 255, 255, 255, 255 },
+{ 238, 253, 254, 254, 255, 255, 255, 255, 255, 255, 255 },
+},
+{
+{ 255, 248, 254, 255, 255, 255, 255, 255, 255, 255, 255 },
+{ 249, 254, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
+{ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
+},
+{
+{ 255, 253, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
+{ 247, 254, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
+{ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
+},
+{
+{ 255, 253, 254, 255, 255, 255, 255, 255, 255, 255, 255 },
+{ 252, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
+{ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
+},
+{
+{ 255, 254, 254, 255, 255, 255, 255, 255,

[FFmpeg-cvslog] avcodec/cbs_vp8: Add support for VP8 codec bitstream

2023-11-15 Thread Dai , Jianhui J
ffmpeg | branch: master | Dai, Jianhui J 
 | Mon Nov 13 01:53:35 2023 +| 
[c9fe9fb86300c240da5e9c1441445c8dee5c7bce] | committer: Ronald S. Bultje

avcodec/cbs_vp8: Add support for VP8 codec bitstream

This commit adds support for VP8 bitstream read methods to the cbs
codec. This enables the trace_headers bitstream filter to support VP8,
in addition to AV1, H.264, H.265, and VP9. This can be useful for
debugging VP8 stream issues.

The CBS VP8 implements a simple VP8 boolean decoder using GetBitContext
to read the bitstream.

Only the read methods `read_unit` and `split_fragment` are implemented.
The write methods `write_unit` and `assemble_fragment` return the error
code AVERROR_PATCHWELCOME. This is because CBS VP8 write is unlikely to
be used by any applications at the moment. The write methods can be
added later if there is a real need for them.

TESTS: ffmpeg -i fate-suite/vp8/frame_size_change.webm -vcodec copy
-bsf:v trace_headers -f null -

Signed-off-by: Jianhui Dai 
Signed-off-by: Ronald S. Bultje 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c9fe9fb86300c240da5e9c1441445c8dee5c7bce
---

 configure|   4 +-
 libavcodec/Makefile  |   1 +
 libavcodec/cbs.c |   6 +
 libavcodec/cbs_internal.h|   1 +
 libavcodec/cbs_vp8.c | 380 +++
 libavcodec/cbs_vp8.h | 133 
 libavcodec/cbs_vp8_syntax_template.c | 248 +++
 7 files changed, 772 insertions(+), 1 deletion(-)

diff --git a/configure b/configure
index 055d558c5a..d6e4a1e7df 100755
--- a/configure
+++ b/configure
@@ -2471,6 +2471,7 @@ CONFIG_EXTRA="
 cbs_h266
 cbs_jpeg
 cbs_mpeg2
+cbs_vp8
 cbs_vp9
 deflate_wrapper
 dirac_parse
@@ -2756,6 +2757,7 @@ cbs_h265_select="cbs"
 cbs_h266_select="cbs"
 cbs_jpeg_select="cbs"
 cbs_mpeg2_select="cbs"
+cbs_vp8_select="cbs"
 cbs_vp9_select="cbs"
 deflate_wrapper_deps="zlib"
 dirac_parse_select="golomb"
@@ -3340,7 +3342,7 @@ h264_redundant_pps_bsf_select="cbs_h264"
 hevc_metadata_bsf_select="cbs_h265"
 mjpeg2jpeg_bsf_select="jpegtables"
 mpeg2_metadata_bsf_select="cbs_mpeg2"
-trace_headers_bsf_select="cbs"
+trace_headers_bsf_select="cbs cbs_vp8"
 vp9_metadata_bsf_select="cbs_vp9"
 vvc_metadata_bsf_select="cbs_h266"
 
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 57d57f3ab5..a6dff5e61b 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -81,6 +81,7 @@ OBJS-$(CONFIG_CBS_H265)+= cbs_h2645.o 
cbs_sei.o h2645_parse.o
 OBJS-$(CONFIG_CBS_H266)+= cbs_h2645.o cbs_sei.o h2645_parse.o
 OBJS-$(CONFIG_CBS_JPEG)+= cbs_jpeg.o
 OBJS-$(CONFIG_CBS_MPEG2)   += cbs_mpeg2.o
+OBJS-$(CONFIG_CBS_VP8) += cbs_vp8.o vp8data.o
 OBJS-$(CONFIG_CBS_VP9) += cbs_vp9.o
 OBJS-$(CONFIG_CRYSTALHD)   += crystalhd.o
 OBJS-$(CONFIG_DEFLATE_WRAPPER) += zlib_wrapper.o
diff --git a/libavcodec/cbs.c b/libavcodec/cbs.c
index cdd7adebeb..de7b1361aa 100644
--- a/libavcodec/cbs.c
+++ b/libavcodec/cbs.c
@@ -50,6 +50,9 @@ static const CodedBitstreamType *const cbs_type_table[] = {
 #if CONFIG_CBS_MPEG2
 &ff_cbs_type_mpeg2,
 #endif
+#if CONFIG_CBS_VP8
+&ff_cbs_type_vp8,
+#endif
 #if CONFIG_CBS_VP9
 &ff_cbs_type_vp9,
 #endif
@@ -74,6 +77,9 @@ const enum AVCodecID ff_cbs_all_codec_ids[] = {
 #if CONFIG_CBS_MPEG2
 AV_CODEC_ID_MPEG2VIDEO,
 #endif
+#if CONFIG_CBS_VP8
+AV_CODEC_ID_VP8,
+#endif
 #if CONFIG_CBS_VP9
 AV_CODEC_ID_VP9,
 #endif
diff --git a/libavcodec/cbs_internal.h b/libavcodec/cbs_internal.h
index 07220f1f3e..d982262bd9 100644
--- a/libavcodec/cbs_internal.h
+++ b/libavcodec/cbs_internal.h
@@ -341,6 +341,7 @@ extern const CodedBitstreamType ff_cbs_type_h265;
 extern const CodedBitstreamType ff_cbs_type_h266;
 extern const CodedBitstreamType ff_cbs_type_jpeg;
 extern const CodedBitstreamType ff_cbs_type_mpeg2;
+extern const CodedBitstreamType ff_cbs_type_vp8;
 extern const CodedBitstreamType ff_cbs_type_vp9;
 
 
diff --git a/libavcodec/cbs_vp8.c b/libavcodec/cbs_vp8.c
new file mode 100644
index 00..01d4b9cefe
--- /dev/null
+++ b/libavcodec/cbs_vp8.c
@@ -0,0 +1,380 @@
+/*
+ * 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 St

[FFmpeg-cvslog] x86/flacds: clear the high bits from pred_order in lpc_32 functions

2023-11-15 Thread James Almer
ffmpeg | branch: master | James Almer  | Wed Nov 15 16:09:05 
2023 -0300| [78f55457c9be420f4109da45de42a36338d56aca] | committer: James Almer

x86/flacds: clear the high bits from pred_order in lpc_32 functions

Reviewed-by: Ronald S. Bultje 
Signed-off-by: James Almer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=78f55457c9be420f4109da45de42a36338d56aca
---

 libavcodec/x86/flacdsp.asm | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libavcodec/x86/flacdsp.asm b/libavcodec/x86/flacdsp.asm
index 44416e4dfd..4b2fd65435 100644
--- a/libavcodec/x86/flacdsp.asm
+++ b/libavcodec/x86/flacdsp.asm
@@ -43,6 +43,7 @@ INIT_XMM %1
 cglobal flac_lpc_32, 5,6,5, decoded, coeffs, pred_order, qlevel, len, j
 sublend, pred_orderd
 jle .ret
+movsxdifnidn pred_orderq, pred_orderd
 leadecodedq, [decodedq+pred_orderq*4-8]
 leacoeffsq, [coeffsq+pred_orderq*4]
 negpred_orderq

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

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