[FFmpeg-cvslog] avcodec/riscv/vp9dsp: Fix inclusion guard

2024-04-29 Thread Andreas Rheinhardt
ffmpeg | branch: master | Andreas Rheinhardt  | 
Mon Apr 29 20:32:39 2024 +0200| [08781ebe1aabe99b94e2ee949ca0c95c1443c756] | 
committer: Andreas Rheinhardt

avcodec/riscv/vp9dsp: Fix inclusion guard

Fixes fate-source.

Reviewed-by: Jan Ekström 
Signed-off-by: Andreas Rheinhardt 

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

 libavcodec/riscv/vp9dsp.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/libavcodec/riscv/vp9dsp.h b/libavcodec/riscv/vp9dsp.h
index 0540c7303d..25047ed507 100644
--- a/libavcodec/riscv/vp9dsp.h
+++ b/libavcodec/riscv/vp9dsp.h
@@ -18,8 +18,8 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
-#ifndef AVCODEC_RISCV_VP9DSP_RISCV_H
-#define AVCODEC_RISCV_VP9DSP_RISCV_H
+#ifndef AVCODEC_RISCV_VP9DSP_H
+#define AVCODEC_RISCV_VP9DSP_H
 
 #include 
 #include 
@@ -168,4 +168,4 @@ VP9_COPY_RISCV_RVI_FUNC(4);
 #undef VP9_BILINEAR_RISCV_RVV_FUNC
 #undef VP9_COPY_AVG_RISCV_RVV_FUNC
 
-#endif  // #ifndef AVCODEC_RISCV_VP9DSP_RISCV_H
+#endif  // #ifndef AVCODEC_RISCV_VP9DSP_H

___
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/vp9dsp: R-V V ipred dc

2024-04-29 Thread sunyuechi
ffmpeg | branch: master | sunyuechi  | Mon Feb 26 
14:42:17 2024 +0800| [c3a96f97f8fda0b16b3c3f83338e98523233b24f] | committer: 
Rémi Denis-Courmont

lavc/vp9dsp: R-V V ipred dc

C908:
vp9_dc_8x8_8bpp_c: 46.0
vp9_dc_8x8_8bpp_rvv_i64: 41.0
vp9_dc_16x16_8bpp_c: 109.2
vp9_dc_16x16_8bpp_rvv_i32: 72.7
vp9_dc_32x32_8bpp_c: 365.2
vp9_dc_32x32_8bpp_rvv_i32: 165.5
vp9_dc_127_8x8_8bpp_c: 23.0
vp9_dc_127_8x8_8bpp_rvv_i64: 22.0
vp9_dc_127_16x16_8bpp_c: 70.2
vp9_dc_127_16x16_8bpp_rvv_i32: 50.2
vp9_dc_127_32x32_8bpp_c: 295.2
vp9_dc_127_32x32_8bpp_rvv_i32: 136.7
vp9_dc_128_8x8_8bpp_c: 23.0
vp9_dc_128_8x8_8bpp_rvv_i64: 22.0
vp9_dc_128_16x16_8bpp_c: 70.2
vp9_dc_128_16x16_8bpp_rvv_i32: 50.2
vp9_dc_128_32x32_8bpp_c: 295.2
vp9_dc_128_32x32_8bpp_rvv_i32: 136.7
vp9_dc_129_8x8_8bpp_c: 23.0
vp9_dc_129_8x8_8bpp_rvv_i64: 22.0
vp9_dc_129_16x16_8bpp_c: 70.2
vp9_dc_129_16x16_8bpp_rvv_i32: 50.2
vp9_dc_129_32x32_8bpp_c: 295.2
vp9_dc_129_32x32_8bpp_rvv_i32: 136.7
vp9_dc_left_8x8_8bpp_c: 38.0
vp9_dc_left_8x8_8bpp_rvv_i64: 36.0
vp9_dc_left_16x16_8bpp_c: 93.2
vp9_dc_left_16x16_8bpp_rvv_i32: 67.7
vp9_dc_left_32x32_8bpp_c: 333.2
vp9_dc_left_32x32_8bpp_rvv_i32: 158.5
vp9_dc_top_8x8_8bpp_c: 38.7
vp9_dc_top_8x8_8bpp_rvv_i64: 36.0
vp9_dc_top_16x16_8bpp_c: 93.2
vp9_dc_top_16x16_8bpp_rvv_i32: 67.7
vp9_dc_top_32x32_8bpp_c: 333.2
vp9_dc_top_32x32_8bpp_rvv_i32: 156.2

Signed-off-by: Rémi Denis-Courmont 

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

 libavcodec/riscv/Makefile|   2 +
 libavcodec/riscv/vp9_intra_rvv.S | 115 ++
 libavcodec/riscv/vp9dsp.h| 171 +++
 libavcodec/riscv/vp9dsp_init.c   |  61 ++
 libavcodec/vp9dsp.c  |   2 +
 libavcodec/vp9dsp.h  |   1 +
 6 files changed, 352 insertions(+)

diff --git a/libavcodec/riscv/Makefile b/libavcodec/riscv/Makefile
index 6c2ce3001a..69ccd0896d 100644
--- a/libavcodec/riscv/Makefile
+++ b/libavcodec/riscv/Makefile
@@ -58,5 +58,7 @@ OBJS-$(CONFIG_VC1DSP) += riscv/vc1dsp_init.o
 RVV-OBJS-$(CONFIG_VC1DSP) += riscv/vc1dsp_rvv.o
 OBJS-$(CONFIG_VP8DSP) += riscv/vp8dsp_init.o
 RVV-OBJS-$(CONFIG_VP8DSP) += riscv/vp8dsp_rvv.o
+OBJS-$(CONFIG_VP9_DECODER) += riscv/vp9dsp_init.o
+RVV-OBJS-$(CONFIG_VP9_DECODER) += riscv/vp9_intra_rvv.o
 OBJS-$(CONFIG_VORBIS_DECODER) += riscv/vorbisdsp_init.o
 RVV-OBJS-$(CONFIG_VORBIS_DECODER) += riscv/vorbisdsp_rvv.o
diff --git a/libavcodec/riscv/vp9_intra_rvv.S b/libavcodec/riscv/vp9_intra_rvv.S
new file mode 100644
index 00..db9774c263
--- /dev/null
+++ b/libavcodec/riscv/vp9_intra_rvv.S
@@ -0,0 +1,115 @@
+/*
+ * Copyright (c) 2024 Institue of Software Chinese Academy of Sciences (ISCAS).
+ *
+ * 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
+ */
+
+#include "libavutil/riscv/asm.S"
+
+.macro avgdc size
+vwredsumu.vs v16, v8, v16
+vsetivli zero, 1, e16, m1, ta, ma
+vmv.x.s  t1, v16
+addi t1, t1, 1 << (\size - 1)
+srai t1, t1, \size
+.endm
+
+.macro getdc type size
+.ifc \type,top
+vmv.v.x  v16, zero
+vle8.v   v8, (a3)
+avgdc\size
+.elseif \type == left
+vmv.v.x  v16, zero
+vle8.v   v8, (a2)
+avgdc\size
+.elseif \type == dc
+vmv.v.x  v16, zero
+vle8.v   v8, (a2)
+vwredsumu.vs v16, v8, v16
+vle8.v   v8, (a3)
+avgdc\size
+.else
+li   t1, \type
+.endif
+.endm
+
+.macro dc_e32 type size n restore
+.ifc \size,32
+li   t0, 32
+vsetvli  zero, t0, e8, m2, ta, ma
+.else
+vsetivli zero, 16, e8, m1, ta, ma
+.endif
+getdc\type \n
+
+.if \restore == 1 && \size == 32
+vsetvli  zero, t0, e8, m2, ta, ma
+.elseif \restore == 1 && \size == 16
+vsetivli zero, 16, e8, m1, ta, ma
+.endif
+vmv.v.x  v0, t1
+
+.rept \size
+vse8.v   v0, (a0)
+add  a0, a0, a1
+.endr
+
+ret
+.endm
+
+.macro dc_e64 type size n restore
+vsetivli zero, 8, e8, mf2, ta, ma
+getdc\type \n
+
+li   t0, 64
+vsetvli  zero, t0, e8, m4, ta, 

[FFmpeg-cvslog] checkasm/vc1dsp: add mspel_pixels test

2024-04-29 Thread sunyuechi
ffmpeg | branch: master | sunyuechi  | Fri Mar  1 
19:45:53 2024 +0800| [dedc2456bf97003323fbfd61f94a6b345062e7d4] | committer: 
Rémi Denis-Courmont

checkasm/vc1dsp: add mspel_pixels test

Signed-off-by: Rémi Denis-Courmont 

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

 tests/checkasm/vc1dsp.c | 37 +
 1 file changed, 37 insertions(+)

diff --git a/tests/checkasm/vc1dsp.c b/tests/checkasm/vc1dsp.c
index 8ad2b51acf..407d9e5fe8 100644
--- a/tests/checkasm/vc1dsp.c
+++ b/tests/checkasm/vc1dsp.c
@@ -439,6 +439,40 @@ static void check_unescape(void)
 }
 }
 
+static void check_mspel_pixels(void)
+{
+LOCAL_ALIGNED_8(uint8_t, src0, [32 * 32]);
+LOCAL_ALIGNED_8(uint8_t, src1, [32 * 32]);
+LOCAL_ALIGNED_8(uint8_t, dst0, [32 * 32]);
+LOCAL_ALIGNED_8(uint8_t, dst1, [32 * 32]);
+
+VC1DSPContext h;
+
+const test tests[] = {
+VC1DSP_SIZED_TEST(put_vc1_mspel_pixels_tab[0][0], 16, 16)
+VC1DSP_SIZED_TEST(put_vc1_mspel_pixels_tab[1][0], 8, 8)
+VC1DSP_SIZED_TEST(avg_vc1_mspel_pixels_tab[0][0], 16, 16)
+VC1DSP_SIZED_TEST(avg_vc1_mspel_pixels_tab[1][0], 8, 8)
+};
+
+ff_vc1dsp_init();
+
+for (size_t t = 0; t < FF_ARRAY_ELEMS(tests); ++t) {
+void (*func)(uint8_t *, const uint8_t*, ptrdiff_t, int) = *(void 
**)((intptr_t)  + tests[t].offset);
+if (check_func(func, "vc1dsp.%s", tests[t].name)) {
+declare_func_emms(AV_CPU_FLAG_MMX, void, uint8_t *, const 
uint8_t*, ptrdiff_t, int);
+RANDOMIZE_BUFFER8(dst, 32 * 32);
+RANDOMIZE_BUFFER8(src, 32 * 32);
+call_ref(dst0, src0, 32, 0);
+call_new(dst1, src1, 32, 0);
+if (memcmp(dst0, dst1, 32 * 32)) {
+fail();
+}
+bench_new(dst1, src0, 32, 0);
+}
+}
+}
+
 void checkasm_check_vc1dsp(void)
 {
 check_inv_trans_inplace();
@@ -450,4 +484,7 @@ void checkasm_check_vc1dsp(void)
 
 check_unescape();
 report("unescape_buffer");
+
+check_mspel_pixels();
+report("mspel_pixels");
 }

___
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] opustab: macro constant as a double

2024-04-29 Thread Lynne
ffmpeg | branch: master | Lynne  | Mon Apr 29 01:44:46 2024 
+0200| [f492095bd3e22ecf5565a08437a0816910bac949] | committer: Lynne

opustab: macro constant as a double

May increase intermediate precision on some compilers.

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

 libavcodec/opustab.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/opustab.c b/libavcodec/opustab.c
index 47624fe651..917375253e 100644
--- a/libavcodec/opustab.c
+++ b/libavcodec/opustab.c
@@ -1164,7 +1164,7 @@ const uint32_t * const ff_celt_pvq_u_row[15] = {
  * libopus uses a slighly rounded constant, set to 0.85 exactly,
  * to simplify its fixed-point version, but it's not significant to impact
  * compliance. */
-#define CELT_EMPH_COEFF 0.8500061035f
+#define CELT_EMPH_COEFF 0.8500061035
 
 DECLARE_ALIGNED(16, const float, ff_opus_deemph_weights)[] = {
 CELT_EMPH_COEFF,

___
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] avformat/mov: don't read key_size bytes twice in the keys atom

2024-04-29 Thread James Almer
ffmpeg | branch: release/7.0 | James Almer  | Mon Apr  1 
23:54:53 2024 -0300| [fb8f0ea7b31d78e8a14d79549a76fd71de390907] | committer: 
James Almer

avformat/mov: don't read key_size bytes twice in the keys atom

We only support mdta as type, yet we were not skipping other types,
but rather reading key_size worth of bytes twice per entry.

Signed-off-by: James Almer 
(cherry picked from commit 5a06d3810e41134ee9c2941cc0b371da62b539db)

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

 libavformat/mov.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libavformat/mov.c b/libavformat/mov.c
index d551a0f8e0..056890c85b 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -5048,6 +5048,7 @@ static int mov_read_keys(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
 key_size -= 8;
 if (type != MKTAG('m','d','t','a')) {
 avio_skip(pb, key_size);
+continue;
 }
 c->meta_keys[i] = av_mallocz(key_size + 1);
 if (!c->meta_keys[i])

___
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] avformat/mov: take into account the first eight bytes in the keys atom

2024-04-29 Thread James Almer
ffmpeg | branch: release/7.0 | James Almer  | Mon Apr  1 
23:52:53 2024 -0300| [0085da21b4ca67d9c1d4423d081f7139ba666dea] | committer: 
James Almer

avformat/mov: take into account the first eight bytes in the keys atom

Signed-off-by: James Almer 
(cherry picked from commit 3d12ba77d9a4660b2e71889d1c2f99e8f3ade98b)

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

 libavformat/mov.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libavformat/mov.c b/libavformat/mov.c
index 9291195a8f..d551a0f8e0 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -5023,6 +5023,7 @@ static int mov_read_keys(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
 
 avio_skip(pb, 4);
 count = avio_rb32(pb);
+atom.size -= 8;
 if (count > UINT_MAX / sizeof(*c->meta_keys) - 1) {
 av_log(c->fc, AV_LOG_ERROR,
"The 'keys' atom with the invalid key count: %"PRIu32"\n", 
count);

___
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] avformat/mov: fix the check for the heif item parsing loop

2024-04-29 Thread James Almer
ffmpeg | branch: release/7.0 | James Almer  | Sat Apr 27 
19:38:13 2024 -0300| [64a048d4cc0a2806c29348012165dea0c6a08613] | committer: 
James Almer

avformat/mov: fix the check for the heif item parsing loop

Fixes: Null pointer dereference
Fixes: 
67861/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5352628142800896

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: James Almer 
(cherry picked from commit 31327c2d075a413749c1461c06382993b9bba90e)

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

 libavformat/mov.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libavformat/mov.c b/libavformat/mov.c
index d9009f2eab..9291195a8f 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -9427,7 +9427,8 @@ static int mov_parse_tiles(AVFormatContext *s)
 break;
 }
 
-if (k == grid->nb_tiles) {
+if (k == mov->nb_heif_item) {
+av_assert0(loop);
 av_log(s, AV_LOG_WARNING, "HEIF item id %d referenced by grid 
id %d doesn't "
   "exist\n",
tile_id, grid->item->item_id);

___
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/mediacodecenc: Flush bsf after create extradata

2024-04-29 Thread Zhao Zhili
ffmpeg | branch: master | Zhao Zhili  | Tue Apr 23 
22:27:50 2024 +0800| [cf4af4bca0368afd36e1c77980bf5e8a165bb99a] | committer: 
Zhao Zhili

avcodec/mediacodecenc: Flush bsf after create extradata

Avoid leaving any data inside bsf while also avoid keep bsf in
EOF state.

Signed-off-by: Zhao Zhili 

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

 libavcodec/mediacodecenc.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libavcodec/mediacodecenc.c b/libavcodec/mediacodecenc.c
index c87a0d86c5..bbf570e7be 100644
--- a/libavcodec/mediacodecenc.c
+++ b/libavcodec/mediacodecenc.c
@@ -681,6 +681,7 @@ bailout:
 s->eof_sent = 0;
 ff_AMediaCodec_flush(s->codec);
 }
+av_bsf_flush(s->bsf);
 av_packet_free();
 return ret;
 }

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