[FFmpeg-devel] [PATCH 5/5] avcodec/mpeg12: Move ff_mpeg1_clean_buffers decl to a new header

2022-09-29 Thread Andreas Rheinhardt
It allows to avoid including mpegvideo.h when including mpeg12.h.

Signed-off-by: Andreas Rheinhardt 
---
 libavcodec/mpeg12.c|  1 +
 libavcodec/mpeg12.h| 10 +++---
 libavcodec/mpeg12codecs.h  | 29 +
 libavcodec/mpeg12dec.c |  1 +
 libavcodec/mpegvideo_enc.c |  2 +-
 libavcodec/tests/mpeg12framerate.c |  3 +++
 6 files changed, 42 insertions(+), 4 deletions(-)
 create mode 100644 libavcodec/mpeg12codecs.h

diff --git a/libavcodec/mpeg12.c b/libavcodec/mpeg12.c
index 7f2aaea7c0..df6aba9d74 100644
--- a/libavcodec/mpeg12.c
+++ b/libavcodec/mpeg12.c
@@ -34,6 +34,7 @@
 #include "avcodec.h"
 #include "mpegvideo.h"
 #include "mpeg12.h"
+#include "mpeg12codecs.h"
 #include "mpeg12data.h"
 #include "mpeg12dec.h"
 #include "startcode.h"
diff --git a/libavcodec/mpeg12.h b/libavcodec/mpeg12.h
index b323728a33..4e2e67eae1 100644
--- a/libavcodec/mpeg12.h
+++ b/libavcodec/mpeg12.h
@@ -22,7 +22,7 @@
 #ifndef AVCODEC_MPEG12_H
 #define AVCODEC_MPEG12_H
 
-#include "mpegvideo.h"
+#include "libavutil/rational.h"
 
 /* Start codes. */
 #define SEQ_END_CODE0x01b7
@@ -34,9 +34,13 @@
 #define EXT_START_CODE  0x01b5
 #define USER_START_CODE 0x01b2
 
-void ff_mpeg1_clean_buffers(MpegEncContext *s);
+#include "version_major.h"
 #if FF_API_FLAG_TRUNCATED
-int ff_mpeg1_find_frame_end(ParseContext *pc, const uint8_t *buf, int 
buf_size, AVCodecParserContext *s);
+#include 
+
+struct ParseContext;
+struct AVCodecParserContext;
+int ff_mpeg1_find_frame_end(struct ParseContext *pc, const uint8_t *buf, int 
buf_size, struct AVCodecParserContext *s);
 #endif
 
 void ff_mpeg12_find_best_frame_rate(AVRational frame_rate,
diff --git a/libavcodec/mpeg12codecs.h b/libavcodec/mpeg12codecs.h
new file mode 100644
index 00..f8cf5503e2
--- /dev/null
+++ b/libavcodec/mpeg12codecs.h
@@ -0,0 +1,29 @@
+/*
+ * MPEG-1/2 codecs common code
+ * Copyright (c) 2007 Aurelien Jacobs 
+ *
+ * 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_MPEG12CODECS_H
+#define AVCODEC_MPEG12CODECS_H
+
+#include "mpegvideo.h"
+
+void ff_mpeg1_clean_buffers(MpegEncContext *s);
+
+#endif /* AVCODEC_MPEG12CODECS_H */
diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c
index dad1970f6c..df76a90c6c 100644
--- a/libavcodec/mpeg12dec.c
+++ b/libavcodec/mpeg12dec.c
@@ -47,6 +47,7 @@
 #include "internal.h"
 #include "mpeg_er.h"
 #include "mpeg12.h"
+#include "mpeg12codecs.h"
 #include "mpeg12data.h"
 #include "mpeg12dec.h"
 #include "mpegutils.h"
diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c
index 0b398c56ab..06c3ff4cbe 100644
--- a/libavcodec/mpegvideo_enc.c
+++ b/libavcodec/mpegvideo_enc.c
@@ -46,7 +46,7 @@
 #include "dct.h"
 #include "encode.h"
 #include "idctdsp.h"
-#include "mpeg12.h"
+#include "mpeg12codecs.h"
 #include "mpeg12data.h"
 #include "mpeg12enc.h"
 #include "mpegvideo.h"
diff --git a/libavcodec/tests/mpeg12framerate.c 
b/libavcodec/tests/mpeg12framerate.c
index 595bdb278a..f2d3e2472c 100644
--- a/libavcodec/tests/mpeg12framerate.c
+++ b/libavcodec/tests/mpeg12framerate.c
@@ -16,6 +16,9 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
+#include 
+
+#include "libavutil/log.h"
 #include "libavcodec/mpeg12.h"
 #include "libavcodec/mpeg12data.h"
 
-- 
2.34.1

___
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 4/5] configure, avcodec/Makefile: Remove obsolete mpegvideo dependencies

2022-09-29 Thread Andreas Rheinhardt
As long as ff_mpeg12_common_init() existed in mpeg12.c,
it added a dependency of mpeg12.o on mpegvideodata.o
(which provides ff_mpeg2_dc_scale_table, which is used
in ff_mpeg12_common_init()). mpegvideodata.o is normally
provided by the mpegvideo subsystem and therefore several
codecs and the MPEG-1/2 parser added a configure dependency
on said subsystem (additionally, the eatqi decoder just
added a Makefile dependency on mpegvideodata.o).

Given that ff_mpeg12_common_init() is no more, these dependencies
can be removed.

Signed-off-by: Andreas Rheinhardt 
---
 configure   | 7 +++
 libavcodec/Makefile | 4 ++--
 2 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/configure b/configure
index 6712d045d9..28d5b0cabe 100755
--- a/configure
+++ b/configure
@@ -2819,7 +2819,7 @@ dxa_decoder_deps="zlib"
 dxv_decoder_select="lzf texturedsp"
 eac3_decoder_select="ac3_decoder"
 eac3_encoder_select="ac3_encoder"
-eamad_decoder_select="aandcttables blockdsp bswapdsp idctdsp mpegvideo"
+eamad_decoder_select="aandcttables blockdsp bswapdsp idctdsp"
 eatgq_decoder_select="aandcttables"
 eatqi_decoder_select="aandcttables blockdsp bswapdsp idctdsp"
 exr_decoder_deps="zlib"
@@ -2873,7 +2873,7 @@ ljpeg_encoder_select="idctdsp jpegtables"
 lscr_decoder_select="inflate_wrapper"
 magicyuv_decoder_select="llviddsp"
 magicyuv_encoder_select="llvidencdsp"
-mdec_decoder_select="blockdsp bswapdsp idctdsp mpegvideo"
+mdec_decoder_select="blockdsp bswapdsp idctdsp"
 metasound_decoder_select="lsp mdct sinewin"
 mimic_decoder_select="blockdsp bswapdsp hpeldsp idctdsp"
 mjpeg_decoder_select="blockdsp hpeldsp exif idctdsp jpegtables"
@@ -2951,7 +2951,7 @@ sonic_decoder_select="golomb rangecoder"
 sonic_encoder_select="golomb rangecoder"
 sonic_ls_encoder_select="golomb rangecoder"
 sp5x_decoder_select="mjpeg_decoder"
-speedhq_decoder_select="mpegvideo"
+speedhq_decoder_select="blockdsp idctdsp"
 speedhq_encoder_select="mpegvideoenc"
 srgc_decoder_select="inflate_wrapper"
 svq1_decoder_select="hpeldsp"
@@ -3275,7 +3275,6 @@ av1_parser_select="cbs_av1"
 h264_parser_select="atsc_a53 golomb h264dsp h264parse"
 hevc_parser_select="hevcparse"
 mpegaudio_parser_select="mpegaudioheader"
-mpegvideo_parser_select="mpegvideo"
 mpeg4video_parser_select="h263dsp mpegvideodec qpeldsp"
 vc1_parser_select="vc1dsp"
 
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 14434dc06c..8022e9a5e7 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -332,7 +332,7 @@ OBJS-$(CONFIG_EAMAD_DECODER)   += eamad.o eaidct.o 
mpeg12.o \
 OBJS-$(CONFIG_EATGQ_DECODER)   += eatgq.o eaidct.o
 OBJS-$(CONFIG_EATGV_DECODER)   += eatgv.o
 OBJS-$(CONFIG_EATQI_DECODER)   += eatqi.o eaidct.o mpeg12.o \
-  mpeg12data.o mpegvideodata.o
+  mpeg12data.o
 OBJS-$(CONFIG_EIGHTBPS_DECODER)+= 8bps.o
 OBJS-$(CONFIG_EIGHTSVX_EXP_DECODER)+= 8svx.o
 OBJS-$(CONFIG_EIGHTSVX_FIB_DECODER)+= 8svx.o
@@ -659,7 +659,7 @@ OBJS-$(CONFIG_SOL_DPCM_DECODER)+= dpcm.o
 OBJS-$(CONFIG_SONIC_DECODER)   += sonic.o
 OBJS-$(CONFIG_SONIC_ENCODER)   += sonic.o
 OBJS-$(CONFIG_SONIC_LS_ENCODER)+= sonic.o
-OBJS-$(CONFIG_SPEEDHQ_DECODER) += speedhq.o mpeg12.o mpeg12data.o 
simple_idct.o
+OBJS-$(CONFIG_SPEEDHQ_DECODER) += speedhq.o mpeg12.o mpeg12data.o
 OBJS-$(CONFIG_SPEEDHQ_ENCODER) += speedhq.o mpeg12data.o mpeg12enc.o 
speedhqenc.o
 OBJS-$(CONFIG_SPEEX_DECODER)   += speexdec.o
 OBJS-$(CONFIG_SP5X_DECODER)+= sp5xdec.o
-- 
2.34.1

___
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 3/5] avcodec/mpeg12: Inline ff_mpeg12_common_init() into mpeg12enc.c

2022-09-29 Thread Andreas Rheinhardt
Signed-off-by: Andreas Rheinhardt 
---
 libavcodec/mpeg12.c| 9 -
 libavcodec/mpeg12.h| 2 --
 libavcodec/mpeg12enc.c | 4 +++-
 3 files changed, 3 insertions(+), 12 deletions(-)

diff --git a/libavcodec/mpeg12.c b/libavcodec/mpeg12.c
index d78e25a777..7f2aaea7c0 100644
--- a/libavcodec/mpeg12.c
+++ b/libavcodec/mpeg12.c
@@ -36,7 +36,6 @@
 #include "mpeg12.h"
 #include "mpeg12data.h"
 #include "mpeg12dec.h"
-#include "mpegvideodata.h"
 #include "startcode.h"
 
 static const uint8_t table_mb_ptype[7][2] = {
@@ -100,14 +99,6 @@ av_cold void ff_init_2d_vlc_rl(RLTable *rl, unsigned 
static_size, int flags)
 }
 }
 
-av_cold void ff_mpeg12_common_init(MpegEncContext *s)
-{
-
-s->y_dc_scale_table =
-s->c_dc_scale_table = ff_mpeg2_dc_scale_table[s->intra_dc_precision];
-
-}
-
 void ff_mpeg1_clean_buffers(MpegEncContext *s)
 {
 s->last_dc[0] = 1 << (7 + s->intra_dc_precision);
diff --git a/libavcodec/mpeg12.h b/libavcodec/mpeg12.h
index e0406b32d9..b323728a33 100644
--- a/libavcodec/mpeg12.h
+++ b/libavcodec/mpeg12.h
@@ -34,8 +34,6 @@
 #define EXT_START_CODE  0x01b5
 #define USER_START_CODE 0x01b2
 
-void ff_mpeg12_common_init(MpegEncContext *s);
-
 void ff_mpeg1_clean_buffers(MpegEncContext *s);
 #if FF_API_FLAG_TRUNCATED
 int ff_mpeg1_find_frame_end(ParseContext *pc, const uint8_t *buf, int 
buf_size, AVCodecParserContext *s);
diff --git a/libavcodec/mpeg12enc.c b/libavcodec/mpeg12enc.c
index f636afe42d..01cfd1c1fa 100644
--- a/libavcodec/mpeg12enc.c
+++ b/libavcodec/mpeg12enc.c
@@ -46,6 +46,7 @@
 #include "mpeg12vlc.h"
 #include "mpegutils.h"
 #include "mpegvideo.h"
+#include "mpegvideodata.h"
 #include "mpegvideoenc.h"
 #include "profiles.h"
 
@@ -1133,7 +1134,8 @@ av_cold void ff_mpeg1_encode_init(MpegEncContext *s)
 {
 static AVOnce init_static_once = AV_ONCE_INIT;
 
-ff_mpeg12_common_init(s);
+s->y_dc_scale_table =
+s->c_dc_scale_table = ff_mpeg2_dc_scale_table[s->intra_dc_precision];
 
 s->me.mv_penalty = mv_penalty;
 s->fcode_tab = fcode_tab;
-- 
2.34.1

___
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 2/5] avcodec/mpeg12dec: Don't call ff_mpeg12_common_init()

2022-09-29 Thread Andreas Rheinhardt
It only sets [yc]_dc_scale_table and these tables are only
read in ff_set_qscale(); but the MPEG-1/2 decoders don't call
ff_set_qscale() at all.
(Furthermore, given that intra_dc_precision is always zero
for a decoder at this point, ff_mpeg12_common_init()
actually set these pointers to what ff_mpv_common_defaults()
already set them.)

Signed-off-by: Andreas Rheinhardt 
---
 libavcodec/mpeg12dec.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c
index 7133696f3c..dad1970f6c 100644
--- a/libavcodec/mpeg12dec.c
+++ b/libavcodec/mpeg12dec.c
@@ -1062,7 +1062,6 @@ static av_cold int mpeg_decode_init(AVCodecContext *avctx)
 /* we need some permutation to store matrices,
  * until the decoder sets the real permutation. */
 ff_mpv_idct_init(s2);
-ff_mpeg12_common_init(&s->mpeg_enc_ctx);
 ff_mpeg12_init_vlcs();
 
 s2->chroma_format  = 1;
@@ -3075,7 +3074,6 @@ static av_cold int ipu_decode_init(AVCodecContext *avctx)
 
 ff_mpv_decode_init(m, avctx);
 ff_mpv_idct_init(m);
-ff_mpeg12_common_init(m);
 ff_mpeg12_init_vlcs();
 
 for (int i = 0; i < 64; i++) {
-- 
2.34.1

___
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 1/5] avcodec/mpeg12vlc: Move MPEG-1/2 RL VLCs to it

2022-09-29 Thread Andreas Rheinhardt
It is better place for these declarations than
mpeg12data.h as RL VLC are just a variant of VLCs.

Signed-off-by: Andreas Rheinhardt 
---
 libavcodec/mpeg12data.c |  1 +
 libavcodec/mpeg12data.h |  4 
 libavcodec/mpeg12dec.h  | 10 --
 libavcodec/mpeg12enc.c  |  1 +
 libavcodec/mpeg12enc.h  |  3 ---
 libavcodec/mpeg12vlc.h  | 15 +++
 libavcodec/speedhq.c|  2 +-
 libavcodec/speedhqenc.c |  2 +-
 8 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/libavcodec/mpeg12data.c b/libavcodec/mpeg12data.c
index 4da96d7da3..e301310b9f 100644
--- a/libavcodec/mpeg12data.c
+++ b/libavcodec/mpeg12data.c
@@ -26,6 +26,7 @@
  */
 
 #include "mpeg12data.h"
+#include "mpeg12vlc.h"
 
 const uint16_t ff_mpeg1_default_intra_matrix[256] = {
 8, 16, 19, 22, 26, 27, 29, 34,
diff --git a/libavcodec/mpeg12data.h b/libavcodec/mpeg12data.h
index f51faf4607..bc39655fbf 100644
--- a/libavcodec/mpeg12data.h
+++ b/libavcodec/mpeg12data.h
@@ -30,7 +30,6 @@
 
 #include 
 #include "libavutil/rational.h"
-#include "rl.h"
 
 extern const uint16_t ff_mpeg1_default_intra_matrix[];
 extern const uint16_t ff_mpeg1_default_non_intra_matrix[64];
@@ -40,9 +39,6 @@ extern const unsigned char ff_mpeg12_vlc_dc_lum_bits[12];
 extern const uint16_t ff_mpeg12_vlc_dc_chroma_code[12];
 extern const unsigned char ff_mpeg12_vlc_dc_chroma_bits[12];
 
-extern RLTable ff_rl_mpeg1;
-extern RLTable ff_rl_mpeg2;
-
 extern const uint8_t ff_mpeg12_mbAddrIncrTable[36][2];
 extern const uint8_t ff_mpeg12_mbPatTable[64][2];
 
diff --git a/libavcodec/mpeg12dec.h b/libavcodec/mpeg12dec.h
index b4e94a92ce..4c015d3096 100644
--- a/libavcodec/mpeg12dec.h
+++ b/libavcodec/mpeg12dec.h
@@ -24,16 +24,6 @@
 
 #include "get_bits.h"
 #include "mpeg12vlc.h"
-#include "rl.h"
-
-#define INIT_2D_VLC_RL(rl, static_size, flags)\
-{\
-static RL_VLC_ELEM rl_vlc_table[static_size];\
-rl.rl_vlc[0] = rl_vlc_table;\
-ff_init_2d_vlc_rl(&rl, static_size, flags);\
-}
-
-void ff_init_2d_vlc_rl(RLTable *rl, unsigned static_size, int flags);
 
 static inline int decode_dc(GetBitContext *gb, int component)
 {
diff --git a/libavcodec/mpeg12enc.c b/libavcodec/mpeg12enc.c
index e1f09b7ede..f636afe42d 100644
--- a/libavcodec/mpeg12enc.c
+++ b/libavcodec/mpeg12enc.c
@@ -43,6 +43,7 @@
 #include "mpeg12.h"
 #include "mpeg12data.h"
 #include "mpeg12enc.h"
+#include "mpeg12vlc.h"
 #include "mpegutils.h"
 #include "mpegvideo.h"
 #include "mpegvideoenc.h"
diff --git a/libavcodec/mpeg12enc.h b/libavcodec/mpeg12enc.h
index fbbc43f891..0455e5e4e2 100644
--- a/libavcodec/mpeg12enc.h
+++ b/libavcodec/mpeg12enc.h
@@ -25,9 +25,6 @@
 #include 
 
 #include "mpegvideo.h"
-#include "rl.h"
-
-void ff_mpeg1_init_uni_ac_vlc(const RLTable *rl, uint8_t *uni_ac_vlc_len);
 
 void ff_mpeg1_encode_picture_header(MpegEncContext *s, int picture_number);
 void ff_mpeg1_encode_mb(MpegEncContext *s, int16_t block[8][64],
diff --git a/libavcodec/mpeg12vlc.h b/libavcodec/mpeg12vlc.h
index 70aca645cb..4fb19371f0 100644
--- a/libavcodec/mpeg12vlc.h
+++ b/libavcodec/mpeg12vlc.h
@@ -28,6 +28,7 @@
 #ifndef AVCODEC_MPEG12VLC_H
 #define AVCODEC_MPEG12VLC_H
 
+#include "rl.h"
 #include "vlc.h"
 
 #define DC_VLC_BITS 9
@@ -49,4 +50,18 @@ extern VLC ff_mv_vlc;
 
 void ff_mpeg12_init_vlcs(void);
 
+#define INIT_2D_VLC_RL(rl, static_size, flags)\
+{\
+static RL_VLC_ELEM rl_vlc_table[static_size];\
+rl.rl_vlc[0] = rl_vlc_table;\
+ff_init_2d_vlc_rl(&rl, static_size, flags);\
+}
+
+extern RLTable ff_rl_mpeg1;
+extern RLTable ff_rl_mpeg2;
+
+void ff_init_2d_vlc_rl(RLTable *rl, unsigned static_size, int flags);
+
+void ff_mpeg1_init_uni_ac_vlc(const RLTable *rl, uint8_t *uni_ac_vlc_len);
+
 #endif /* AVCODEC_MPEG12VLC_H */
diff --git a/libavcodec/speedhq.c b/libavcodec/speedhq.c
index 11d3311794..6dbba02776 100644
--- a/libavcodec/speedhq.c
+++ b/libavcodec/speedhq.c
@@ -38,9 +38,9 @@
 #include "idctdsp.h"
 #include "libavutil/thread.h"
 #include "mathops.h"
-#include "mpeg12dec.h"
 #include "mpeg12data.h"
 #include "mpeg12vlc.h"
+#include "rl.h"
 
 #define MAX_INDEX (64 - 1)
 
diff --git a/libavcodec/speedhqenc.c b/libavcodec/speedhqenc.c
index 747ed679bd..4a009bd070 100644
--- a/libavcodec/speedhqenc.c
+++ b/libavcodec/speedhqenc.c
@@ -34,7 +34,7 @@
 #include "avcodec.h"
 #include "codec_internal.h"
 #include "mpeg12data.h"
-#include "mpeg12enc.h"
+#include "mpeg12vlc.h"
 #include "mpegvideo.h"
 #include "mpegvideoenc.h"
 #include "speedhqenc.h"
-- 
2.34.1

___
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] [FFmpeg-cvslog] avcodec/mlpdec: relax channels checking

2022-09-29 Thread Michael Niedermayer
On Fri, Sep 30, 2022 at 12:03:25AM +0200, Michael Niedermayer wrote:
> On Thu, Sep 29, 2022 at 11:59:18PM +0200, Michael Niedermayer wrote:
> > On Sun, Sep 18, 2022 at 01:21:23PM +, Paul B Mahol wrote:
> > > ffmpeg | branch: master | Paul B Mahol  | Sat Sep 17 
> > > 14:08:58 2022 +0200| [adaa06581c5444c94eef72d61b8166f096e2687a] | 
> > > committer: Paul B Mahol
> > > 
> > > avcodec/mlpdec: relax channels checking
> > > 
> > > Internal TrueHD decoder channel rematrix can mix 2 stereo substreams
> > > into single mono stream.
> > > 
> > > Fixes #1726
> > > 
> > > > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=adaa06581c5444c94eef72d61b8166f096e2687a
> > > ---
> > > 
> > >  libavcodec/mlpdec.c | 23 +--
> > >  1 file changed, 1 insertion(+), 22 deletions(-)
> > 
> > This produces out of array accesses
> > 
> > Also this was never posted to the mailing list. Simply removing checks is 
> > not
> > a solution, how can that even be a solution ?!
> > 
> > please make sure you post all patches especially ones thats have not been 
> > tested
> > very well to the mailing list
> 
> I see it was posted to the ML, iam sorry it seems i must have missed it 
> somehow
> its still buggy though

patch which seems to fix this is attached. Didnt had as much time to write this
ATM as i would have liked ...
Please review.

thx

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

If a bugfix only changes things apparently unrelated to the bug with no
further explanation, that is a good sign that the bugfix is wrong.


signature.asc
Description: PGP signature
___
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 2/3] avcodec/speexdec: Check channels > 2

2022-09-29 Thread Michael Niedermayer
More than 2 channels seems unsupported, the code seems to just output empty 
extra channels

Fixes: Timeout
Fixes: 
51569/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SPEEX_fuzzer-5511509165342720

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer 
---
 libavcodec/speexdec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/speexdec.c b/libavcodec/speexdec.c
index 9793d939fcb..08c7e77e7d5 100644
--- a/libavcodec/speexdec.c
+++ b/libavcodec/speexdec.c
@@ -1452,7 +1452,7 @@ static av_cold int speex_decode_init(AVCodecContext 
*avctx)
 return AVERROR_INVALIDDATA;
 
 s->nb_channels = avctx->ch_layout.nb_channels;
-if (s->nb_channels <= 0)
+if (s->nb_channels <= 0 || s->nb_channels > 2)
 return AVERROR_INVALIDDATA;
 
 switch (s->rate) {
-- 
2.17.1

___
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 1/3] avformat/vividas: Check packet size

2022-09-29 Thread Michael Niedermayer
Fixes: signed integer overflow: 119760682 - -2084600173 cannot be represented 
in type 'int'
Fixes: 
50993/clusterfuzz-testcase-minimized-ffmpeg_dem_VIVIDAS_fuzzer-6745781167587328

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer 
---
 libavformat/vividas.c | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/libavformat/vividas.c b/libavformat/vividas.c
index e9954f73ed0..ed4e573df87 100644
--- a/libavformat/vividas.c
+++ b/libavformat/vividas.c
@@ -683,6 +683,7 @@ static int viv_read_packet(AVFormatContext *s,
 
 if (viv->sb_entries[viv->current_sb_entry].flag == 0) {
 uint64_t v_size = ffio_read_varlen(pb);
+int last = 0, last_start;
 
 if (!viv->num_audio)
 return AVERROR_INVALIDDATA;
@@ -706,12 +707,18 @@ static int viv_read_packet(AVFormatContext *s,
 
 if (i > 0 && start == 0)
 break;
+if (start < last)
+return AVERROR_INVALIDDATA;
 
 viv->n_audio_subpackets = i + 1;
+last =
 viv->audio_subpackets[i].start = start;
 viv->audio_subpackets[i].pcm_bytes = pcm_bytes;
 }
+last_start =
 viv->audio_subpackets[viv->n_audio_subpackets].start = (int)(off - 
avio_tell(pb));
+if (last_start < last)
+return AVERROR_INVALIDDATA;
 viv->current_audio_subpacket = 0;
 
 } else {
-- 
2.17.1

___
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 3/3] avcodec/mlpdec: add max channels check

2022-09-29 Thread Michael Niedermayer
Fixes: out of array access
Fixes: 
51648/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TRUEHD_fuzzer-4644322217164800

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer 
---
 libavcodec/mlpdec.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/libavcodec/mlpdec.c b/libavcodec/mlpdec.c
index 635f92895c5..0b0eb759901 100644
--- a/libavcodec/mlpdec.c
+++ b/libavcodec/mlpdec.c
@@ -547,6 +547,9 @@ static int read_restart_header(MLPDecodeContext *m, 
GetBitContext *gbp,
 return AVERROR_PATCHWELCOME;
 }
 
+if (max_channel + 1 > MAX_CHANNELS || max_channel + 1 < min_channel)
+return AVERROR_INVALIDDATA;
+
 s->min_channel= min_channel;
 s->max_channel= max_channel;
 s->coded_channels = ((1LL << (max_channel - min_channel + 1)) - 1) << 
min_channel;
-- 
2.17.1

___
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] [FFmpeg-cvslog] avcodec/mlpdec: relax channels checking

2022-09-29 Thread Michael Niedermayer
On Thu, Sep 29, 2022 at 11:59:18PM +0200, Michael Niedermayer wrote:
> On Sun, Sep 18, 2022 at 01:21:23PM +, Paul B Mahol wrote:
> > ffmpeg | branch: master | Paul B Mahol  | Sat Sep 17 
> > 14:08:58 2022 +0200| [adaa06581c5444c94eef72d61b8166f096e2687a] | 
> > committer: Paul B Mahol
> > 
> > avcodec/mlpdec: relax channels checking
> > 
> > Internal TrueHD decoder channel rematrix can mix 2 stereo substreams
> > into single mono stream.
> > 
> > Fixes #1726
> > 
> > > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=adaa06581c5444c94eef72d61b8166f096e2687a
> > ---
> > 
> >  libavcodec/mlpdec.c | 23 +--
> >  1 file changed, 1 insertion(+), 22 deletions(-)
> 
> This produces out of array accesses
> 
> Also this was never posted to the mailing list. Simply removing checks is not
> a solution, how can that even be a solution ?!
> 
> please make sure you post all patches especially ones thats have not been 
> tested
> very well to the mailing list

I see it was posted to the ML, iam sorry it seems i must have missed it somehow
its still buggy though


[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

"Nothing to hide" only works if the folks in power share the values of
you and everyone you know entirely and always will -- Tom Scott



signature.asc
Description: PGP signature
___
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] [FFmpeg-cvslog] avcodec/mlpdec: relax channels checking

2022-09-29 Thread Michael Niedermayer
On Sun, Sep 18, 2022 at 01:21:23PM +, Paul B Mahol wrote:
> ffmpeg | branch: master | Paul B Mahol  | Sat Sep 17 
> 14:08:58 2022 +0200| [adaa06581c5444c94eef72d61b8166f096e2687a] | committer: 
> Paul B Mahol
> 
> avcodec/mlpdec: relax channels checking
> 
> Internal TrueHD decoder channel rematrix can mix 2 stereo substreams
> into single mono stream.
> 
> Fixes #1726
> 
> > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=adaa06581c5444c94eef72d61b8166f096e2687a
> ---
> 
>  libavcodec/mlpdec.c | 23 +--
>  1 file changed, 1 insertion(+), 22 deletions(-)

This produces out of array accesses

Also this was never posted to the mailing list. Simply removing checks is not
a solution, how can that even be a solution ?!

please make sure you post all patches especially ones thats have not been tested
very well to the mailing list

thx


==764==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x6270365c 
at pc 0x00571644 bp 0x7ffe8bba5f60 sp 0x7ffe8bba5f58
READ of size 4 at 0x6270365c thread T0
SCARINESS: 27 (4-byte-read-heap-buffer-overflow-far-from-bounds)
#0 0x571643 in ff_mlp_pack_output /src/ffmpeg/libavcodec/mlpdsp.c:116:30
#1 0x56f95f in output_data /src/ffmpeg/libavcodec/mlpdec.c:1126:30
#2 0x56bee8 in read_access_unit /src/ffmpeg/libavcodec/mlpdec.c:1354:16
#3 0x51f46a in decode_simple_internal /src/ffmpeg/libavcodec/decode.c:307:15
#4 0x51f46a in decode_simple_receive_frame 
/src/ffmpeg/libavcodec/decode.c:563:15
#5 0x51f46a in decode_receive_frame_internal 
/src/ffmpeg/libavcodec/decode.c:584:15
#6 0x51ea5d in avcodec_send_packet /src/ffmpeg/libavcodec/decode.c:665:15
#7 0x5054ab in LLVMFuzzerTestOneInput 
/src/ffmpeg/tools/target_dec_fuzzer.c:510:25
#8 0xd9ec9a in ExecuteFilesOnyByOne 
aflplusplus/utils/aflpp_driver/aflpp_driver.c:234:7
#9 0xd9ea6c in main aflplusplus/utils/aflpp_driver/aflpp_driver.c:318:12
#10 0x7f5a5cfd90b2 in __libc_start_main 
/build/glibc-eX1tMB/glibc-2.31/csu/libc-start.c:308:16
#11 0x442f0d in _start
0x6270365c is located 28 bytes to the right of 13632-byte region 
[0x62700100,0x62703640)
allocated by thread T0 here:
#0 0x4c4e97 in posix_memalign 
/src/llvm-project/compiler-rt/lib/asan/asan_malloc_linux.cpp:145:3
#1 0xcebcb1 in av_malloc /src/ffmpeg/libavutil/mem.c:105:9
#2 0xcebcb1 in av_mallocz /src/ffmpeg/libavutil/mem.c:266:17
#3 0x57270b in init_context_defaults /src/ffmpeg/libavcodec/options.c:129:24
#4 0x57270b in avcodec_alloc_context3 /src/ffmpeg/libavcodec/options.c:156:9
#5 0x502963 in LLVMFuzzerTestOneInput 
/src/ffmpeg/tools/target_dec_fuzzer.c:311:27
#6 0xd9ec9a in ExecuteFilesOnyByOne 
aflplusplus/utils/aflpp_driver/aflpp_driver.c:234:7
SUMMARY: AddressSanitizer: heap-buffer-overflow 
(/mnt/scratch0/clusterfuzz/bot/builds/clusterfuzz-builds-afl_ffmpeg_bbf927d7e4cde0b71897048111a2d684e48dfab7/revisions/ffmpeg_AV_CODEC_ID_TRUEHD_fuzzer+0x571643)
Shadow bytes around the buggy address:
  0x0c4e7fff8670: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c4e7fff8680: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c4e7fff8690: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c4e7fff86a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c4e7fff86b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
=>0x0c4e7fff86c0: 00 00 00 00 00 00 00 00 fa fa fa[fa]fa fa fa fa
  0x0c4e7fff86d0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c4e7fff86e0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c4e7fff86f0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c4e7fff8700: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c4e7fff8710: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
Shadow byte legend (one shadow byte represents 8 application bytes):
  Addressable:   00
  Partially addressable: 01 02 03 04 05 06 07
  Heap left redzone:   fa
  Freed heap region:   fd
  Stack left redzone:  f1
  Stack mid redzone:   f2
  Stack right redzone: f3
  Stack after return:  f5
  Stack use after scope:   f8
  Global redzone:  f9
  Global init order:   f6
  Poisoned by user:f7
  Container overflow:  fc
  Array cookie:ac
  Intra object redzone:bb
  ASan internal:   fe
  Left alloca redzone: ca
  Right alloca redzone:cb
==764==ABORTING


[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Awnsering whenever a program halts or runs forever is
On a turing machine, in general impossible (turings halting problem).
On any real computer, always possible as a real computer has a finite number
of states N, and will either halt in less than N cycles or never halt.


signature.asc
Description: PGP signature
___
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...@ffm

[FFmpeg-devel] [PATCH] avcodec/vorbis: Split data declarations out into new header

2022-09-29 Thread Andreas Rheinhardt
vorbis.h currently contains stuff only used by the native
Vorbis codecs and some Vorbis tables, which are also used by
Opus and libvorbis. Therefore split the data out into a header
of its own.

Signed-off-by: Andreas Rheinhardt 
---
 libavcodec/libopusdec.c   |  2 +-
 libavcodec/libopusenc.c   |  2 +-
 libavcodec/libvorbisenc.c |  1 -
 libavcodec/opus.c |  2 +-
 libavcodec/vorbis.c   |  1 +
 libavcodec/vorbis.h   | 10 ++
 libavcodec/vorbis_data.c  |  2 +-
 libavcodec/vorbis_data.h  | 34 ++
 libavcodec/vorbisdec.c|  1 +
 libavcodec/vorbisenc.c|  1 +
 10 files changed, 43 insertions(+), 13 deletions(-)
 create mode 100644 libavcodec/vorbis_data.h

diff --git a/libavcodec/libopusdec.c b/libavcodec/libopusdec.c
index 31a04dfbeb..9b9a610343 100644
--- a/libavcodec/libopusdec.c
+++ b/libavcodec/libopusdec.c
@@ -31,9 +31,9 @@
 #include "codec_internal.h"
 #include "decode.h"
 #include "internal.h"
-#include "vorbis.h"
 #include "mathops.h"
 #include "libopus.h"
+#include "vorbis_data.h"
 
 struct libopus_context {
 AVClass *class;
diff --git a/libavcodec/libopusenc.c b/libavcodec/libopusenc.c
index 81e765403f..75bc491c9e 100644
--- a/libavcodec/libopusenc.c
+++ b/libavcodec/libopusenc.c
@@ -29,8 +29,8 @@
 #include "codec_internal.h"
 #include "encode.h"
 #include "libopus.h"
-#include "vorbis.h"
 #include "audio_frame_queue.h"
+#include "vorbis_data.h"
 
 typedef struct LibopusEncOpts {
 int vbr;
diff --git a/libavcodec/libvorbisenc.c b/libavcodec/libvorbisenc.c
index f78a88bbcd..6331cf0d79 100644
--- a/libavcodec/libvorbisenc.c
+++ b/libavcodec/libvorbisenc.c
@@ -29,7 +29,6 @@
 #include "codec_internal.h"
 #include "encode.h"
 #include "version.h"
-#include "vorbis.h"
 #include "vorbis_parser.h"
 
 
diff --git a/libavcodec/opus.c b/libavcodec/opus.c
index 3540206347..b91f57dec3 100644
--- a/libavcodec/opus.c
+++ b/libavcodec/opus.c
@@ -33,7 +33,7 @@
 #include "opus_celt.h"
 #include "opustab.h"
 #include "internal.h"
-#include "vorbis.h"
+#include "vorbis_data.h"
 
 static const uint16_t opus_frame_duration[32] = {
 480, 960, 1920, 2880,
diff --git a/libavcodec/vorbis.c b/libavcodec/vorbis.c
index cca2aa7c63..d0b660b44a 100644
--- a/libavcodec/vorbis.c
+++ b/libavcodec/vorbis.c
@@ -30,6 +30,7 @@
 
 #include "avcodec.h"
 #include "vorbis.h"
+#include "vorbis_data.h"
 
 
 /* Helper functions */
diff --git a/libavcodec/vorbis.h b/libavcodec/vorbis.h
index 0dd109dd2e..aa1ec5719d 100644
--- a/libavcodec/vorbis.h
+++ b/libavcodec/vorbis.h
@@ -21,15 +21,9 @@
 #ifndef AVCODEC_VORBIS_H
 #define AVCODEC_VORBIS_H
 
-#include "avcodec.h"
+#include 
 
-extern const float ff_vorbis_floor1_inverse_db_table[256];
-extern const float * const ff_vorbis_vwin[8];
-extern const uint8_t ff_vorbis_channel_layout_offsets[8][8];
-#if FF_API_OLD_CHANNEL_LAYOUT
-extern const uint64_t ff_vorbis_channel_layouts[9];
-#endif
-extern const AVChannelLayout ff_vorbis_ch_layouts[9];
+#include "avcodec.h"
 
 typedef struct vorbis_floor1_entry {
 uint16_t x;
diff --git a/libavcodec/vorbis_data.c b/libavcodec/vorbis_data.c
index 4f4ea03f15..1ebe146d8f 100644
--- a/libavcodec/vorbis_data.c
+++ b/libavcodec/vorbis_data.c
@@ -21,7 +21,7 @@
 #include "libavutil/channel_layout.h"
 #include "libavutil/mem_internal.h"
 
-#include "vorbis.h"
+#include "vorbis_data.h"
 
 const uint8_t ff_vorbis_channel_layout_offsets[8][8] = {
 { 0 },
diff --git a/libavcodec/vorbis_data.h b/libavcodec/vorbis_data.h
new file mode 100644
index 00..0fe19e509f
--- /dev/null
+++ b/libavcodec/vorbis_data.h
@@ -0,0 +1,34 @@
+/*
+ * 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_VORBIS_DATA_H
+#define AVCODEC_VORBIS_DATA_H
+
+#include 
+
+#include "libavutil/channel_layout.h"
+
+extern const float ff_vorbis_floor1_inverse_db_table[256];
+extern const float * const ff_vorbis_vwin[8];
+extern const uint8_t ff_vorbis_channel_layout_offsets[8][8];
+#if FF_API_OLD_CHANNEL_LAYOUT
+extern const uint64_t ff_vorbis_channel_layouts[9];
+#endif
+extern const AVChannelLayout ff_vorbis_ch_layouts[9];
+
+#endif /* AVCODEC_VORBIS_DATA_H */
diff --git a/libavcodec/vorbisdec.c b/libavcodec/vorbisdec.c
index 4a85500c10..715a7f7d03 100644
--- a/libavcodec/vorbisdec.c
+++ b/libavco

[FFmpeg-devel] [PATCH] avutil/channel_layout: Don't mention dead project

2022-09-29 Thread Andreas Rheinhardt
Signed-off-by: Andreas Rheinhardt 
---
 libavutil/channel_layout.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavutil/channel_layout.h b/libavutil/channel_layout.h
index ff2b57bbe3..7808573118 100644
--- a/libavutil/channel_layout.h
+++ b/libavutil/channel_layout.h
@@ -270,7 +270,7 @@ typedef struct AVChannelCustom {
  * ignoring everything but the channel count, as long as 
av_channel_layout_check()
  * considers they are valid.
  *
- * Unlike most structures in Libav, sizeof(AVChannelLayout) is a part of the
+ * Unlike most structures in FFmpeg, sizeof(AVChannelLayout) is a part of the
  * public ABI and may be used by the caller. E.g. it may be allocated on stack
  * or embedded in caller-defined structs.
  *
-- 
2.34.1

___
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 1/5] avutil/pixdesc: Remove always-false checks

2022-09-29 Thread Andreas Rheinhardt
Andreas Rheinhardt:
> ff_check_pixfmt_descriptors() was added in commit
> 20e99a9c10cdbe9ad659dce5bdec569d744f8219. At this time,
> the values of enum AVPixelFormat were not contiguous;
> instead there was a jump from 111 to 291 (or from 115
> to 295 depending upon AV_PIX_FMT_ABI_GIT_MASTER).
> ff_check_pixfmt_descriptors() accounts for this
> by skipping empty descriptors. Yet this issue no longer
> exists: There are no holes.
> 
> The check for said holes makes GCC believe that the name
> can be NULL; because it is used as argument corresponding to
> %s in a log statement, it therefore emits a warning
> (since d75c4693fef51e8f0a1b88798530f4c5147ea906). Therefore
> this commit simply removes these checks.
> 
> Also move the checks for name before the log statement.
> 
> Signed-off-by: Andreas Rheinhardt 
> ---
>  libavutil/pixdesc.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/libavutil/pixdesc.c b/libavutil/pixdesc.c
> index 3ac44614a7..c42a0242c5 100644
> --- a/libavutil/pixdesc.c
> +++ b/libavutil/pixdesc.c
> @@ -2922,13 +2922,11 @@ void ff_check_pixfmt_descriptors(void){
>  int linesize[4] = {0,0,0,0};
>  uint16_t tmp[2];
>  
> -if (!d->name && !d->nb_components && !d->log2_chroma_w && 
> !d->log2_chroma_h && !d->flags)
> -continue;
> +av_assert0(d->name && d->name[0]);
>  av_log(NULL, AV_LOG_INFO, "Checking: %s\n", d->name);
>  av_assert0(d->log2_chroma_w <= 3);
>  av_assert0(d->log2_chroma_h <= 3);
>  av_assert0(d->nb_components <= 4);
> -av_assert0(d->name && d->name[0]);
>  av_assert2(av_get_pix_fmt(d->name) == i);
>  
>  for (j=0; jcomp); j++) {

Will apply this patchset (with the issue pointed out by Anton fixed)
tomorrow unless there are objections.

- Andreas

___
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/opusdsp: RISC-V F deemphasis

2022-09-29 Thread Rémi Denis-Courmont
Le torstaina 29. syyskuuta 2022, 22.51.59 EEST r...@remlab.net a écrit :
> From: Rémi Denis-Courmont 
> 
> This saves almost exactly 25% on SiFive U74.
> 
> deemphasis_c: 11536.2
> deemphasis_rvf: 8654.2

So well, if you trust godbolt.org, some better compiler is able to optimise 
the C version correctly, just not Debian GCC 12.2.

I could still use a review on the AAC restrict qualification patch though.

-- 
レミ・デニ-クールモン
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/opusdsp: RISC-V F deemphasis

2022-09-29 Thread remi
From: Rémi Denis-Courmont 

This saves almost exactly 25% on SiFive U74.

deemphasis_c: 11536.2
deemphasis_rvf: 8654.2
---
 libavcodec/opusdsp.c|  2 ++
 libavcodec/opusdsp.h|  1 +
 libavcodec/riscv/Makefile   |  2 ++
 libavcodec/riscv/opusdsp_init.c | 36 +
 libavcodec/riscv/opusdsp_rvf.S  | 41 +
 5 files changed, 82 insertions(+)
 create mode 100644 libavcodec/riscv/opusdsp_init.c
 create mode 100644 libavcodec/riscv/opusdsp_rvf.S

diff --git a/libavcodec/opusdsp.c b/libavcodec/opusdsp.c
index badcfcc884..0764d712e4 100644
--- a/libavcodec/opusdsp.c
+++ b/libavcodec/opusdsp.c
@@ -58,6 +58,8 @@ av_cold void ff_opus_dsp_init(OpusDSP *ctx)
 
 #if ARCH_AARCH64
 ff_opus_dsp_init_aarch64(ctx);
+#elif ARCH_RISCV
+ff_opus_dsp_init_riscv(ctx);
 #elif ARCH_X86
 ff_opus_dsp_init_x86(ctx);
 #endif
diff --git a/libavcodec/opusdsp.h b/libavcodec/opusdsp.h
index 3ea3d14bf0..c2a301e832 100644
--- a/libavcodec/opusdsp.h
+++ b/libavcodec/opusdsp.h
@@ -30,5 +30,6 @@ void ff_opus_dsp_init(OpusDSP *ctx);
 
 void ff_opus_dsp_init_x86(OpusDSP *ctx);
 void ff_opus_dsp_init_aarch64(OpusDSP *ctx);
+void ff_opus_dsp_init_riscv(OpusDSP *ctx);
 
 #endif /* AVCODEC_OPUSDSP_H */
diff --git a/libavcodec/riscv/Makefile b/libavcodec/riscv/Makefile
index 0fb2c81c75..ef7d1169fe 100644
--- a/libavcodec/riscv/Makefile
+++ b/libavcodec/riscv/Makefile
@@ -7,6 +7,8 @@ OBJS-$(CONFIG_FMTCONVERT) += riscv/fmtconvert_init.o
 RVV-OBJS-$(CONFIG_FMTCONVERT) += riscv/fmtconvert_rvv.o
 OBJS-$(CONFIG_IDCTDSP) += riscv/idctdsp_init.o
 RVV-OBJS-$(CONFIG_IDCTDSP) += riscv/idctdsp_rvv.o
+OBJS-$(CONFIG_OPUS_DECODER) += riscv/opusdsp_init.o \
+   riscv/opusdsp_rvf.o
 OBJS-$(CONFIG_PIXBLOCKDSP) += riscv/pixblockdsp_init.o \
   riscv/pixblockdsp_rvi.o
 RVV-OBJS-$(CONFIG_PIXBLOCKDSP) += riscv/pixblockdsp_rvv.o
diff --git a/libavcodec/riscv/opusdsp_init.c b/libavcodec/riscv/opusdsp_init.c
new file mode 100644
index 00..dddf27affb
--- /dev/null
+++ b/libavcodec/riscv/opusdsp_init.c
@@ -0,0 +1,36 @@
+/*
+ * Copyright © 2022 Rémi Denis-Courmont.
+ *
+ * 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 "config.h"
+
+#include "libavutil/attributes.h"
+#include "libavutil/cpu.h"
+#include "libavutil/riscv/cpu.h"
+#include "libavcodec/opusdsp.h"
+
+float ff_opus_deemphasis_rvf(float *out, float *in, float c, int len);
+
+av_cold void ff_opus_dsp_init_riscv(OpusDSP *d)
+{
+int flags = av_get_cpu_flags();
+
+if (flags & AV_CPU_FLAG_RVF)
+d->deemphasis = ff_opus_deemphasis_rvf;
+}
diff --git a/libavcodec/riscv/opusdsp_rvf.S b/libavcodec/riscv/opusdsp_rvf.S
new file mode 100644
index 00..b1eaa35d92
--- /dev/null
+++ b/libavcodec/riscv/opusdsp_rvf.S
@@ -0,0 +1,41 @@
+/*
+ * Copyright © 2022 Rémi Denis-Courmont.
+ *
+ * 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 "config.h"
+#include "libavutil/riscv/asm.S"
+
+func ff_opus_deemphasis_rvf, f
+NOHWF   fmv.w.x fa0, a2
+NOHWF   mv  a2, a3
+sllia2, a2, 2
+li  t0, 0x3f599a00 // 0.85
+add a2, a1, a2
+fmv.w.x ft0, t0
+1:
+flw ft1, (a1)
+addia0, a0, 4
+fmadd.s fa0, fa0, ft0, ft1
+addia1, a1, 4
+fsw fa0, -4(a0)
+bne a1, a2, 1b
+
+NOHWF   fmv.x.w a0, fa0
+ret
+endfunc
-- 
2.37.2

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

Re: [FFmpeg-devel] [PATCH] lavf/async: Fix wrapped_url_read return value

2022-09-29 Thread Guangyu Sun
On Wed, Sep 28, 2022 at 7:08 AM Anton Khirnov  wrote:
>
> Quoting Guangyu Sun (2022-09-19 07:22:39)
> > This fixes a regression from commit 36117968ad.
> >
> > wrapped_url_read() used to be able to return positive number from
> > ffurl_read(). It relies on the result to check if EOF is reached in
> > async_buffer_task().
> >
> > Test case:
> >   ffmpeg -f lavfi -i testsrc -t 1 test.mp4
> >   ffmpeg -i async:test.mp4
> >
> > Signed-off-by: Guangyu Sun 
> > ---
> >  libavformat/async.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/libavformat/async.c b/libavformat/async.c
> > index 547417aa1e..a929f4d16e 100644
> > --- a/libavformat/async.c
> > +++ b/libavformat/async.c
> > @@ -139,7 +139,7 @@ static int wrapped_url_read(void *src, void *dst, 
> > size_t *size)
> >  *size = ret > 0 ? ret : 0;
> >  c->inner_io_error = ret < 0 ? ret : 0;
> >
> > -return c->inner_io_error;
> > +return ret;
>
> This is wrong, FIFO callbacks must return 0 on success. This should be
> handled in ring_write() instead.

Thanks. I just submitted a new version.

Guangyu

>
> --
> Anton Khirnov
___
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 v2] lavf/async: Fix ring_write return value

2022-09-29 Thread Guangyu Sun
his fixes a regression from commit 36117968ad.

wrapped_url_read() used to be able to return positive number from
ffurl_read(). It relies on the result to check if EOF is reached in
async_buffer_task().

But FIFO callbacks must return 0 on success. This should be handled
in ring_write() instead.

Test case:
  ffmpeg -f lavfi -i testsrc -t 1 test.mp4
  ffmpeg -i async:test.mp4

Signed-off-by: Guangyu Sun 
---
 libavformat/async.c | 8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/libavformat/async.c b/libavformat/async.c
index 547417aa1e..3c6f89cab9 100644
--- a/libavformat/async.c
+++ b/libavformat/async.c
@@ -144,8 +144,14 @@ static int wrapped_url_read(void *src, void *dst, size_t 
*size)
 
 static int ring_write(RingBuffer *ring, URLContext *h, size_t size)
 {
+int ret;
+
 av_assert2(size <= ring_space(ring));
-return av_fifo_write_from_cb(ring->fifo, wrapped_url_read, h, &size);
+ret = av_fifo_write_from_cb(ring->fifo, wrapped_url_read, h, &size);
+if (ret < 0)
+return ret;
+
+return size;
 }
 
 static int ring_size_of_read_back(RingBuffer *ring)
-- 
2.37.1

___
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 4/4] swscale/output: add rgbaf32 output support

2022-09-29 Thread mindmark
From: Mark Reid 

---
 libswscale/output.c  | 89 
 libswscale/swscale_unscaled.c|  4 +-
 libswscale/tests/floatimg_cmp.c  |  4 +-
 libswscale/utils.c   | 16 +++--
 libswscale/yuv2rgb.c |  2 +
 tests/ref/fate/filter-pixdesc-rgbaf32be  |  1 +
 tests/ref/fate/filter-pixdesc-rgbaf32le  |  1 +
 tests/ref/fate/filter-pixdesc-rgbf32be   |  1 +
 tests/ref/fate/filter-pixdesc-rgbf32le   |  1 +
 tests/ref/fate/filter-pixfmts-copy   |  4 ++
 tests/ref/fate/filter-pixfmts-crop   |  4 ++
 tests/ref/fate/filter-pixfmts-field  |  4 ++
 tests/ref/fate/filter-pixfmts-fieldorder |  4 ++
 tests/ref/fate/filter-pixfmts-hflip  |  4 ++
 tests/ref/fate/filter-pixfmts-il |  4 ++
 tests/ref/fate/filter-pixfmts-null   |  4 ++
 tests/ref/fate/filter-pixfmts-scale  |  4 ++
 tests/ref/fate/filter-pixfmts-transpose  |  4 ++
 tests/ref/fate/filter-pixfmts-vflip  |  4 ++
 tests/ref/fate/sws-floatimg-cmp  | 16 +
 20 files changed, 167 insertions(+), 8 deletions(-)
 create mode 100644 tests/ref/fate/filter-pixdesc-rgbaf32be
 create mode 100644 tests/ref/fate/filter-pixdesc-rgbaf32le
 create mode 100644 tests/ref/fate/filter-pixdesc-rgbf32be
 create mode 100644 tests/ref/fate/filter-pixdesc-rgbf32le

diff --git a/libswscale/output.c b/libswscale/output.c
index 0e1c1225a0..b3e064ae8d 100644
--- a/libswscale/output.c
+++ b/libswscale/output.c
@@ -2474,6 +2474,89 @@ yuv2gbrpf32_full_X_c(SwsContext *c, const int16_t 
*lumFilter,
 }
 }
 
+static void
+yuv2rgbaf32_full_X_c(SwsContext *c, const int16_t *lumFilter,
+const int16_t **lumSrcx, int lumFilterSize,
+const int16_t *chrFilter, const int16_t **chrUSrcx,
+const int16_t **chrVSrcx, int chrFilterSize,
+const int16_t **alpSrcx, uint8_t *dest,
+int dstW, int y)
+{
+const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(c->dstFormat);
+int i;
+int hasAlpha = (desc->flags & AV_PIX_FMT_FLAG_ALPHA) && alpSrcx;
+int pixelStep = desc->flags & AV_PIX_FMT_FLAG_ALPHA ? 4 : 3;
+uint32_t *dest32 = (uint32_t*)dest;
+const int32_t **lumSrc  = (const int32_t**)lumSrcx;
+const int32_t **chrUSrc = (const int32_t**)chrUSrcx;
+const int32_t **chrVSrc = (const int32_t**)chrVSrcx;
+const int32_t **alpSrc  = (const int32_t**)alpSrcx;
+static const float float_mult = 1.0f / 65535.0f;
+
+for (i = 0; i < dstW; i++) {
+int j;
+int Y = -0x4000;
+int U = -(128 << 23);
+int V = -(128 << 23);
+int R, G, B, A;
+
+for (j = 0; j < lumFilterSize; j++)
+Y += lumSrc[j][i] * (unsigned)lumFilter[j];
+
+for (j = 0; j < chrFilterSize; j++) {
+U += chrUSrc[j][i] * (unsigned)chrFilter[j];
+V += chrVSrc[j][i] * (unsigned)chrFilter[j];
+}
+
+Y >>= 14;
+Y += 0x1;
+U >>= 14;
+V >>= 14;
+
+if (hasAlpha) {
+A = -0x4000;
+
+for (j = 0; j < lumFilterSize; j++)
+A += alpSrc[j][i] * (unsigned)lumFilter[j];
+
+A >>= 1;
+A += 0x20002000;
+}
+
+Y -= c->yuv2rgb_y_offset;
+Y *= c->yuv2rgb_y_coeff;
+Y += 1 << 13;
+R = V * c->yuv2rgb_v2r_coeff;
+G = V * c->yuv2rgb_v2g_coeff + U * c->yuv2rgb_u2g_coeff;
+B =U * c->yuv2rgb_u2b_coeff;
+
+R = av_clip_uintp2(Y + R, 30);
+G = av_clip_uintp2(Y + G, 30);
+B = av_clip_uintp2(Y + B, 30);
+
+dest32[0] = av_float2int(float_mult * (float)(R >> 14));
+dest32[1] = av_float2int(float_mult * (float)(G >> 14));
+dest32[2] = av_float2int(float_mult * (float)(B >> 14));
+if (hasAlpha)
+dest32[3] = av_float2int(float_mult * (float)(av_clip_uintp2(A, 
30) >> 14));
+
+dest32 += pixelStep;
+}
+if ((!isBE(c->dstFormat)) != (!HAVE_BIGENDIAN)) {
+dest32 = (uint32_t*)dest;
+for (i = 0; i < dstW; i++) {
+dest32[0] = av_bswap32(dest32[0]);
+dest32[1] = av_bswap32(dest32[1]);
+dest32[2] = av_bswap32(dest32[2]);
+if (hasAlpha)
+dest32[3] = av_bswap32(dest32[3]);
+
+dest32 += pixelStep;
+}
+}
+
+}
+
 static void
 yuv2ya8_1_c(SwsContext *c, const int16_t *buf0,
 const int16_t *ubuf[2], const int16_t *vbuf[2],
@@ -2986,6 +3069,12 @@ av_cold void ff_sws_init_output_funcs(SwsContext *c,
 }
 break;
 
+case AV_PIX_FMT_RGBF32LE:
+case AV_PIX_FMT_RGBF32BE:
+case AV_PIX_FMT_RGBAF32LE:
+case AV_PIX_FMT_RGBAF32BE:
+*yuv2packedX = yuv2rgbaf32_full_X_c;
+break;
 case AV_PIX_FMT_RGB24:
 *yuv2packedX = yuv2rgb24_full_X_c;
 *yuv2packed2 = yuv2rgb24_full_2_c;

[FFmpeg-devel] [PATCH 3/4] avfilter/vf_transpose: add support for packed rgb float formats

2022-09-29 Thread mindmark
From: Mark Reid 

---
 libavfilter/vf_transpose.c | 44 ++
 1 file changed, 44 insertions(+)

diff --git a/libavfilter/vf_transpose.c b/libavfilter/vf_transpose.c
index 469e66729f..1023d6fe82 100644
--- a/libavfilter/vf_transpose.c
+++ b/libavfilter/vf_transpose.c
@@ -174,6 +174,46 @@ static void transpose_8x8_64_c(uint8_t *src, ptrdiff_t 
src_linesize,
 transpose_block_64_c(src, src_linesize, dst, dst_linesize, 8, 8);
 }
 
+static inline void transpose_block_96_c(uint8_t *src, ptrdiff_t src_linesize,
+uint8_t *dst, ptrdiff_t dst_linesize,
+int w, int h)
+{
+int x, y;
+for (y = 0; y < h; y++, dst += dst_linesize, src += 12) {
+for (x = 0; x < w; x++) {
+*((uint32_t *)(dst+0 + 12*x)) = *((uint32_t *)(src+0 + 
x*src_linesize));
+*((uint32_t *)(dst+4 + 12*x)) = *((uint32_t *)(src+4 + 
x*src_linesize));
+*((uint32_t *)(dst+8 + 12*x)) = *((uint32_t *)(src+8 + 
x*src_linesize));
+}
+}
+}
+
+static void transpose_8x8_96_c(uint8_t *src, ptrdiff_t src_linesize,
+   uint8_t *dst, ptrdiff_t dst_linesize)
+{
+transpose_block_96_c(src, src_linesize, dst, dst_linesize, 8, 8);
+}
+
+
+static inline void transpose_block_128_c(uint8_t *src, ptrdiff_t src_linesize,
+ uint8_t *dst, ptrdiff_t dst_linesize,
+ int w, int h)
+{
+int x, y;
+for (y = 0; y < h; y++, dst += dst_linesize, src += 16) {
+for (x = 0; x < w; x++) {
+*((uint64_t *)(dst+0 + 16*x)) = *((uint64_t *)(src+0 + 
x*src_linesize));
+*((uint64_t *)(dst+8 + 16*x)) = *((uint64_t *)(src+8 + 
x*src_linesize));
+}
+}
+}
+
+static void transpose_8x8_128_c(uint8_t *src, ptrdiff_t src_linesize,
+uint8_t *dst, ptrdiff_t dst_linesize)
+{
+transpose_block_128_c(src, src_linesize, dst, dst_linesize, 8, 8);
+}
+
 static int config_props_output(AVFilterLink *outlink)
 {
 AVFilterContext *ctx = outlink->src;
@@ -232,6 +272,10 @@ static int config_props_output(AVFilterLink *outlink)
 v->transpose_8x8   = transpose_8x8_48_c; break;
 case 8: v->transpose_block = transpose_block_64_c;
 v->transpose_8x8   = transpose_8x8_64_c; break;
+case 12: v->transpose_block = transpose_block_96_c;
+ v->transpose_8x8   = transpose_8x8_96_c; break;
+case 16: v->transpose_block = transpose_block_128_c;
+ v->transpose_8x8   = transpose_8x8_128_c; break;
 }
 }
 
-- 
2.31.1.windows.1

___
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 2/4] avfilter/vf_hflip: add support for packed rgb float formats

2022-09-29 Thread mindmark
From: Mark Reid 

---
 libavfilter/vf_hflip_init.h | 25 +
 1 file changed, 25 insertions(+)

diff --git a/libavfilter/vf_hflip_init.h b/libavfilter/vf_hflip_init.h
index d0319f463d..31173f73fc 100644
--- a/libavfilter/vf_hflip_init.h
+++ b/libavfilter/vf_hflip_init.h
@@ -86,6 +86,29 @@ static void hflip_qword_c(const uint8_t *ssrc, uint8_t 
*ddst, int w)
 dst[j] = src[-j];
 }
 
+static void hflip_b96_c(const uint8_t *ssrc, uint8_t *ddst, int w)
+{
+const uint32_t *in = (const uint32_t *)ssrc;
+uint32_t *out = (uint32_t *)ddst;
+
+for (int j = 0; j < w; j++, out += 3, in -= 3) {
+out[0] = in[0];
+out[1] = in[1];
+out[2] = in[2];
+}
+}
+
+static void hflip_b128_c(const uint8_t *ssrc, uint8_t *ddst, int w)
+{
+const uint64_t *in = (const uint64_t *)ssrc;
+uint64_t *out = (uint64_t *)ddst;
+
+for (int j = 0; j < w; j++, out += 2, in -= 2) {
+out[0] = in[0];
+out[1] = in[1];
+}
+}
+
 static av_unused int ff_hflip_init(FlipContext *s, int step[4], int nb_planes)
 {
 for (int i = 0; i < nb_planes; i++) {
@@ -97,6 +120,8 @@ static av_unused int ff_hflip_init(FlipContext *s, int 
step[4], int nb_planes)
 case 4: s->flip_line[i] = hflip_dword_c; break;
 case 6: s->flip_line[i] = hflip_b48_c;   break;
 case 8: s->flip_line[i] = hflip_qword_c; break;
+case 12: s->flip_line[i] = hflip_b96_c; break;
+case 16: s->flip_line[i] = hflip_b128_c; break;
 default:
 return AVERROR_BUG;
 }
-- 
2.31.1.windows.1

___
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 1/4] swscale/input: add rgbaf32 input support

2022-09-29 Thread mindmark
From: Mark Reid 

---
 libswscale/input.c | 172 +
 libswscale/utils.c |   4 ++
 2 files changed, 176 insertions(+)

diff --git a/libswscale/input.c b/libswscale/input.c
index 7ff7bfaa01..4683284b0b 100644
--- a/libswscale/input.c
+++ b/libswscale/input.c
@@ -1284,6 +1284,136 @@ static void rgbaf16##endian_name##ToA_c(uint8_t *_dst, 
const uint8_t *_src, cons
 rgbaf16_funcs_endian(le, 0)
 rgbaf16_funcs_endian(be, 1)
 
+#define rdpx(src) (is_be ? av_int2float(AV_RB32(&src)): 
av_int2float(AV_RL32(&src)))
+
+static av_always_inline void rgbaf32ToUV_half_endian(uint16_t *dstU, uint16_t 
*dstV, int is_be,
+ const float *src, int 
width,
+ int32_t *rgb2yuv, int 
comp)
+{
+int32_t ru = rgb2yuv[RU_IDX], gu = rgb2yuv[GU_IDX], bu = rgb2yuv[BU_IDX];
+int32_t rv = rgb2yuv[RV_IDX], gv = rgb2yuv[GV_IDX], bv = rgb2yuv[BV_IDX];
+int i;
+for (i = 0; i < width; i++) {
+int r = (lrintf(av_clipf(65535.0f * rdpx(src[i*(comp*2)+0]), 0.0f, 
65535.0f)) +
+ lrintf(av_clipf(65535.0f * rdpx(src[i*(comp*2)+4]), 0.0f, 
65535.0f))) >> 1;
+int g = (lrintf(av_clipf(65535.0f * rdpx(src[i*(comp*2)+1]), 0.0f, 
65535.0f)) +
+ lrintf(av_clipf(65535.0f * rdpx(src[i*(comp*2)+5]), 0.0f, 
65535.0f))) >> 1;
+int b = (lrintf(av_clipf(65535.0f * rdpx(src[i*(comp*2)+2]), 0.0f, 
65535.0f)) +
+ lrintf(av_clipf(65535.0f * rdpx(src[i*(comp*2)+6]), 0.0f, 
65535.0f))) >> 1;
+
+dstU[i] = (ru*r + gu*g + bu*b + (0x10001<<(RGB2YUV_SHIFT-1))) >> 
RGB2YUV_SHIFT;
+dstV[i] = (rv*r + gv*g + bv*b + (0x10001<<(RGB2YUV_SHIFT-1))) >> 
RGB2YUV_SHIFT;
+}
+}
+
+static av_always_inline void rgbaf32ToUV_endian(uint16_t *dstU, uint16_t 
*dstV, int is_be,
+const float *src, int width,
+int32_t *rgb2yuv, int comp)
+{
+int32_t ru = rgb2yuv[RU_IDX], gu = rgb2yuv[GU_IDX], bu = rgb2yuv[BU_IDX];
+int32_t rv = rgb2yuv[RV_IDX], gv = rgb2yuv[GV_IDX], bv = rgb2yuv[BV_IDX];
+int i;
+for (i = 0; i < width; i++) {
+int r = lrintf(av_clipf(65535.0f * rdpx(src[i*comp+0]), 0.0f, 
65535.0f));
+int g = lrintf(av_clipf(65535.0f * rdpx(src[i*comp+1]), 0.0f, 
65535.0f));
+int b = lrintf(av_clipf(65535.0f * rdpx(src[i*comp+2]), 0.0f, 
65535.0f));
+
+dstU[i] = (ru*r + gu*g + bu*b + (0x10001<<(RGB2YUV_SHIFT-1))) >> 
RGB2YUV_SHIFT;
+dstV[i] = (rv*r + gv*g + bv*b + (0x10001<<(RGB2YUV_SHIFT-1))) >> 
RGB2YUV_SHIFT;
+}
+}
+
+static av_always_inline void rgbaf32ToY_endian(uint16_t *dst, const float 
*src, int is_be,
+   int width, int32_t *rgb2yuv, 
int comp)
+{
+int32_t ry = rgb2yuv[RY_IDX], gy = rgb2yuv[GY_IDX], by = rgb2yuv[BY_IDX];
+int i;
+for (i = 0; i < width; i++) {
+int r = lrintf(av_clipf(65535.0f * rdpx(src[i*comp+0]), 0.0f, 
65535.0f));
+int g = lrintf(av_clipf(65535.0f * rdpx(src[i*comp+1]), 0.0f, 
65535.0f));
+int b = lrintf(av_clipf(65535.0f * rdpx(src[i*comp+2]), 0.0f, 
65535.0f));
+
+dst[i] = (ry*r + gy*g + by*b + (0x2001<<(RGB2YUV_SHIFT-1))) >> 
RGB2YUV_SHIFT;
+}
+}
+
+static av_always_inline void rgbaf32ToA_endian(uint16_t *dst, const float 
*src, int is_be,
+   int width, void *opq)
+{
+int i;
+for (i=0; isrcFormat;
@@ -1570,6 +1700,18 @@ av_cold void ff_sws_init_input_funcs(SwsContext *c)
 case AV_PIX_FMT_RGBAF16LE:
 c->chrToYV12 = rgbaf16leToUV_half_c;
 break;
+case AV_PIX_FMT_RGBF32BE:
+c->chrToYV12 = rgbf32beToUV_half_c;
+break;
+case AV_PIX_FMT_RGBAF32BE:
+c->chrToYV12 = rgbaf32beToUV_half_c;
+break;
+case AV_PIX_FMT_RGBF32LE:
+c->chrToYV12 = rgbf32leToUV_half_c;
+break;
+case AV_PIX_FMT_RGBAF32LE:
+c->chrToYV12 = rgbaf32leToUV_half_c;
+break;
 }
 } else {
 switch (srcFormat) {
@@ -1663,6 +1805,18 @@ av_cold void ff_sws_init_input_funcs(SwsContext *c)
 case AV_PIX_FMT_RGBAF16LE:
 c->chrToYV12 = rgbaf16leToUV_c;
 break;
+case AV_PIX_FMT_RGBF32BE:
+c->chrToYV12 = rgbf32beToUV_c;
+break;
+case AV_PIX_FMT_RGBAF32BE:
+c->chrToYV12 = rgbaf32beToUV_c;
+break;
+case AV_PIX_FMT_RGBF32LE:
+c->chrToYV12 = rgbf32leToUV_c;
+break;
+case AV_PIX_FMT_RGBAF32LE:
+c->chrToYV12 = rgbaf32leToUV_c;
+break;
 }
 }
 
@@ -1973,6 +2127,18 @@ av_cold void ff_sws_init_input_funcs(SwsContext *c)
 case AV_PIX_FMT_RGBAF16LE:
 c->lumToYV12 = rgbaf16leToY_c;
 break;
+case AV_PIX_FMT_RGBF32BE:
+ 

[FFmpeg-devel] [PATCH 0/4] swscale rgbaf32 input/output support

2022-09-29 Thread mindmark
From: Mark Reid 

This patch series adds swscale input/output support for the packed rgb float 
formats.
A few of the filters also needed support the larger 96/128 bit packed pixel 
sizes.

I also plan to eventually add lossless unscaled conversions between the planer 
and packed formats.

Mark Reid (4):
  swscale/input: add rgbaf32 input support
  avfilter/vf_hflip: add support for packed rgb float formats
  avfilter/vf_transpose: add support for packed rgb float formats
  swscale/output: add rgbaf32 output support

 libavfilter/vf_hflip_init.h  |  25 
 libavfilter/vf_transpose.c   |  44 ++
 libswscale/input.c   | 172 +++
 libswscale/output.c  |  89 
 libswscale/swscale_unscaled.c|   4 +-
 libswscale/tests/floatimg_cmp.c  |   4 +-
 libswscale/utils.c   |  12 +-
 libswscale/yuv2rgb.c |   2 +
 tests/ref/fate/filter-pixdesc-rgbaf32be  |   1 +
 tests/ref/fate/filter-pixdesc-rgbaf32le  |   1 +
 tests/ref/fate/filter-pixdesc-rgbf32be   |   1 +
 tests/ref/fate/filter-pixdesc-rgbf32le   |   1 +
 tests/ref/fate/filter-pixfmts-copy   |   4 +
 tests/ref/fate/filter-pixfmts-crop   |   4 +
 tests/ref/fate/filter-pixfmts-field  |   4 +
 tests/ref/fate/filter-pixfmts-fieldorder |   4 +
 tests/ref/fate/filter-pixfmts-hflip  |   4 +
 tests/ref/fate/filter-pixfmts-il |   4 +
 tests/ref/fate/filter-pixfmts-null   |   4 +
 tests/ref/fate/filter-pixfmts-scale  |   4 +
 tests/ref/fate/filter-pixfmts-transpose  |   4 +
 tests/ref/fate/filter-pixfmts-vflip  |   4 +
 tests/ref/fate/sws-floatimg-cmp  |  16 +++
 23 files changed, 408 insertions(+), 4 deletions(-)
 create mode 100644 tests/ref/fate/filter-pixdesc-rgbaf32be
 create mode 100644 tests/ref/fate/filter-pixdesc-rgbaf32le
 create mode 100644 tests/ref/fate/filter-pixdesc-rgbf32be
 create mode 100644 tests/ref/fate/filter-pixdesc-rgbf32le

--
2.31.1.windows.1

___
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 4/6] avcodec/jrevdct: Fix UB left shifts of negative numbers

2022-09-29 Thread Andreas Rheinhardt
Michael Niedermayer:
> On Wed, Sep 28, 2022 at 08:58:16PM +0200, Andreas Rheinhardt wrote:
>> Affected the rv20-1239 FATE test.
>>
>> Signed-off-by: Andreas Rheinhardt 
>> ---
>>  libavcodec/jrevdct.c | 38 +++---
>>  1 file changed, 19 insertions(+), 19 deletions(-)
> 
> iam a bit surprised this was not spotted long ago but LGTM
> 
> thx
> 

Most of these changes are in ff_j_rev_dct4 which is only used if lowres
== 1; I guess the fuzzer doesn't use lowres which explains why this has
not been found before.

- Andreas

___
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 4/6] avcodec/jrevdct: Fix UB left shifts of negative numbers

2022-09-29 Thread Michael Niedermayer
On Wed, Sep 28, 2022 at 08:58:16PM +0200, Andreas Rheinhardt wrote:
> Affected the rv20-1239 FATE test.
> 
> Signed-off-by: Andreas Rheinhardt 
> ---
>  libavcodec/jrevdct.c | 38 +++---
>  1 file changed, 19 insertions(+), 19 deletions(-)

iam a bit surprised this was not spotted long ago but LGTM

thx

[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Concerning the gods, I have no means of knowing whether they exist or not
or of what sort they may be, because of the obscurity of the subject, and
the brevity of human life -- Protagoras


signature.asc
Description: PGP signature
___
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 5/6] avcodec/mpegvideo: Fix undefined left shift of negative numbers

2022-09-29 Thread Michael Niedermayer
On Wed, Sep 28, 2022 at 08:58:17PM +0200, Andreas Rheinhardt wrote:
> Fixes the rv20-1239 FATE-test.
> 
> Signed-off-by: Andreas Rheinhardt 
> ---
>  libavcodec/mpegvideo.c | 8 
>  1 file changed, 4 insertions(+), 4 deletions(-)

LGTM

thx

[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Modern terrorism, a quick summary: Need oil, start war with country that
has oil, kill hundread thousand in war. Let country fall into chaos,
be surprised about raise of fundamantalists. Drop more bombs, kill more
people, be surprised about them taking revenge and drop even more bombs
and strip your own citizens of their rights and freedoms. to be continued


signature.asc
Description: PGP signature
___
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 1/2] avformat/vividas: Check packet size

2022-09-29 Thread Michael Niedermayer
On Thu, Sep 29, 2022 at 04:10:22PM +0200, Anton Khirnov wrote:
> Quoting Michael Niedermayer (2022-09-29 00:35:09)
> > On Wed, Sep 28, 2022 at 05:16:05PM +0200, Anton Khirnov wrote:
> > > Quoting Michael Niedermayer (2022-09-22 20:08:51)
> > > > Fixes: signed integer overflow: 119760682 - -2084600173 cannot be 
> > > > represented in type 'int'
> > > > Fixes: 
> > > > 50993/clusterfuzz-testcase-minimized-ffmpeg_dem_VIVIDAS_fuzzer-6745781167587328
> > > > 
> > > > Found-by: continuous fuzzing process 
> > > > https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> > > > Signed-off-by: Michael Niedermayer 
> > > > ---
> > > >  libavformat/vividas.c | 13 +++--
> > > >  1 file changed, 11 insertions(+), 2 deletions(-)
> > > > 
> > > > diff --git a/libavformat/vividas.c b/libavformat/vividas.c
> > > > index e9954f73ed0..e8efe49a5c0 100644
> > > > --- a/libavformat/vividas.c
> > > > +++ b/libavformat/vividas.c
> > > > @@ -683,6 +683,7 @@ static int viv_read_packet(AVFormatContext *s,
> > > >  
> > > >  if (viv->sb_entries[viv->current_sb_entry].flag == 0) {
> > > >  uint64_t v_size = ffio_read_varlen(pb);
> > > > +int last, last_start;
> > > >  
> > > >  if (!viv->num_audio)
> > > >  return AVERROR_INVALIDDATA;
> > > > @@ -704,14 +705,22 @@ static int viv_read_packet(AVFormatContext *s,
> > > >  start = ffio_read_varlen(pb);
> > > >  pcm_bytes = ffio_read_varlen(pb);
> > > >  
> > > > -if (i > 0 && start == 0)
> > > > -break;
> > > > +if (i > 0) {
> > > > +if (start == 0)
> > > > +break;
> > > > +if (start < last || start - (unsigned)last > INT_MAX)
> > > 
> > > What is the second condition for?
> > 
> > start is signed int so are "copyies" of it
> > "start < last" would allow a negative last with a large start
> > the 2nd check handles that.
> > the difference of consequtive values are stored as int later
> > 
> > The patch tried to leave the storage types and check for it.
> > The types could be changed or some other checks could be used
> > I was undecided on this patch a bit too. I picked this mainly
> > to keep changes more minimal but maybe this was not the best
> > choice
> 
> Checking that start >= 0 would fix this as well, wouldn't it?

i agree


>  I don't
> think it makes sense for it to be negative.

well no, but i tried to minimize the chance of breaking something
so the fix ended up looking a bit wonky
ill change it to check for start >= 0

thx

[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The worst form of inequality is to try to make unequal things equal.
-- Aristotle


signature.asc
Description: PGP signature
___
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 1/2] avformat/vividas: Check packet size

2022-09-29 Thread Anton Khirnov
Quoting Michael Niedermayer (2022-09-29 00:35:09)
> On Wed, Sep 28, 2022 at 05:16:05PM +0200, Anton Khirnov wrote:
> > Quoting Michael Niedermayer (2022-09-22 20:08:51)
> > > Fixes: signed integer overflow: 119760682 - -2084600173 cannot be 
> > > represented in type 'int'
> > > Fixes: 
> > > 50993/clusterfuzz-testcase-minimized-ffmpeg_dem_VIVIDAS_fuzzer-6745781167587328
> > > 
> > > Found-by: continuous fuzzing process 
> > > https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> > > Signed-off-by: Michael Niedermayer 
> > > ---
> > >  libavformat/vividas.c | 13 +++--
> > >  1 file changed, 11 insertions(+), 2 deletions(-)
> > > 
> > > diff --git a/libavformat/vividas.c b/libavformat/vividas.c
> > > index e9954f73ed0..e8efe49a5c0 100644
> > > --- a/libavformat/vividas.c
> > > +++ b/libavformat/vividas.c
> > > @@ -683,6 +683,7 @@ static int viv_read_packet(AVFormatContext *s,
> > >  
> > >  if (viv->sb_entries[viv->current_sb_entry].flag == 0) {
> > >  uint64_t v_size = ffio_read_varlen(pb);
> > > +int last, last_start;
> > >  
> > >  if (!viv->num_audio)
> > >  return AVERROR_INVALIDDATA;
> > > @@ -704,14 +705,22 @@ static int viv_read_packet(AVFormatContext *s,
> > >  start = ffio_read_varlen(pb);
> > >  pcm_bytes = ffio_read_varlen(pb);
> > >  
> > > -if (i > 0 && start == 0)
> > > -break;
> > > +if (i > 0) {
> > > +if (start == 0)
> > > +break;
> > > +if (start < last || start - (unsigned)last > INT_MAX)
> > 
> > What is the second condition for?
> 
> start is signed int so are "copyies" of it
> "start < last" would allow a negative last with a large start
> the 2nd check handles that.
> the difference of consequtive values are stored as int later
> 
> The patch tried to leave the storage types and check for it.
> The types could be changed or some other checks could be used
> I was undecided on this patch a bit too. I picked this mainly
> to keep changes more minimal but maybe this was not the best
> choice

Checking that start >= 0 would fix this as well, wouldn't it? I don't
think it makes sense for it to be negative.

-- 
Anton Khirnov
___
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 v2] avformat/mpegtsenc: add omit_rai flag

2022-09-29 Thread Zhao Zhili
From: Zhao Zhili 

Add PCR at keyframe can be undesirable when -pcr_period is
specified. Add an flag to disable this behavior.

Signed-off-by: Zhao Zhili 
---
v2: change pcr_at_keyframe to omit_rai

 doc/muxers.texi | 2 ++
 libavformat/mpegtsenc.c | 6 +-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/doc/muxers.texi b/doc/muxers.texi
index b2f4326aae..4edbb22b00 100644
--- a/doc/muxers.texi
+++ b/doc/muxers.texi
@@ -1915,6 +1915,8 @@ Conform to System B (DVB) instead of System A (ATSC).
 Mark the initial packet of each stream as discontinuity.
 @item nit
 Emit NIT table.
+@item omit_rai
+Disable writing of random access indicator.
 @end table
 
 @item mpegts_copyts @var{boolean}
diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c
index 5148a6aecd..48d39e6a7d 100644
--- a/libavformat/mpegtsenc.c
+++ b/libavformat/mpegtsenc.c
@@ -112,6 +112,7 @@ typedef struct MpegTSWrite {
 #define MPEGTS_FLAG_SYSTEM_B0x08
 #define MPEGTS_FLAG_DISCONT 0x10
 #define MPEGTS_FLAG_NIT 0x20
+#define MPEGTS_FLAG_OMIT_RAI0x40
 int flags;
 int copyts;
 int tables_version;
@@ -1566,7 +1567,8 @@ static void mpegts_write_pes(AVFormatContext *s, AVStream 
*st,
 q = get_ts_payload_start(buf);
 ts_st->discontinuity = 0;
 }
-if (key && is_start && pts != AV_NOPTS_VALUE &&
+if (!(ts->flags & MPEGTS_FLAG_OMIT_RAI) &&
+key && is_start && pts != AV_NOPTS_VALUE &&
 !is_dvb_teletext /* adaptation+payload forbidden for teletext 
(ETSI EN 300 472 V1.3.1 4.1) */) {
 // set Random Access for key frames
 if (ts_st->pcr_period)
@@ -2282,6 +2284,8 @@ static const AVOption options[] = {
   0, AV_OPT_TYPE_CONST, { .i64 = MPEGTS_FLAG_DISCONT }, 0, INT_MAX, ENC, 
"mpegts_flags" },
 { "nit", "Enable NIT transmission",
   0, AV_OPT_TYPE_CONST, { .i64 = MPEGTS_FLAG_NIT}, 0, INT_MAX, ENC, 
"mpegts_flags" },
+{ "omit_rai", "Disable writing of random access indicator",
+  0, AV_OPT_TYPE_CONST, { .i64 = MPEGTS_FLAG_OMIT_RAI }, 0, INT_MAX, ENC, 
"mpegts_flags" },
 { "mpegts_copyts", "don't offset dts/pts", OFFSET(copyts), 
AV_OPT_TYPE_BOOL, { .i64 = -1 }, -1, 1, ENC },
 { "tables_version", "set PAT, PMT, SDT and NIT version", 
OFFSET(tables_version), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 31, ENC },
 { "omit_video_pes_length", "Omit the PES packet length for video packets",
-- 
2.25.1

___
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] avformat/mov: parse the last moof box when mp4 segment format

2022-09-29 Thread zhilizhao(赵志立)


> On Sep 1, 2022, at 18:22, 1035567...@qq.com wrote:
> 
> From: Wang Yaqiang 
> 
> In the format of mp4 segment, the bitrate calculation of
> stream depends on the sample_size in moof->traf->trun box.
> In the original logic, when the last sidx box is read,
> it is not parsed backwards, and the total sample_size calculation is smaller.
> As a result, the bitrate displayed by ffprobe is also smaller than the actual.
> Increasing the moof_count variable ensures that the last moof is parsed.
> 
> Test method: You can use -c copy remux a fmp4 file as mp4
> and ffprobe the two files will find that the bitrate is inconsistent
> Befor patch:
> Stream #0:1[0x2](und): Audio: aac (HE-AAC) (mp4a / 0x6134706D), 44100 Hz, 
> stereo, fltp, 59 kb/s
> After patch:
> Stream #0:1[0x2](und): Audio: aac (HE-AAC) (mp4a / 0x6134706D), 44100 Hz, 
> stereo, fltp, 96 kb/s (default)
> 
> Signed-off-by: Wang Yaqiang 
> ---
> libavformat/isom.h | 1 +
> libavformat/mov.c  | 8 +++-
> 2 files changed, 8 insertions(+), 1 deletion(-)
> 
> diff --git a/libavformat/isom.h b/libavformat/isom.h
> index f05c2d9c28..183a3c486b 100644
> --- a/libavformat/isom.h
> +++ b/libavformat/isom.h
> @@ -296,6 +296,7 @@ typedef struct MOVContext {
> int has_looked_for_mfra;
> int use_tfdt;
> MOVFragmentIndex frag_index;
> +int moof_count; //ensure last fragment parse moof box
> int atom_depth;
> unsigned int aax_mode;  ///< 'aax' file has been detected
> uint8_t file_key[20];
> diff --git a/libavformat/mov.c b/libavformat/mov.c
> index 14550e6456..396658e342 100644
> --- a/libavformat/mov.c
> +++ b/libavformat/mov.c
> @@ -7784,12 +7784,15 @@ static int mov_read_default(MOVContext *c, 
> AVIOContext *pb, MOVAtom atom)
> int64_t start_pos = avio_tell(pb);
> int64_t left;
> int err = parse(c, pb, a);
> +if (a.type == MKTAG('m','o','o','f')) {
> +c->moof_count ++;
> +}
> if (err < 0) {
> c->atom_depth --;
> return err;
> }
> if (c->found_moov && c->found_mdat && a.size <= INT64_MAX - 
> start_pos &&
> -((!(pb->seekable & AVIO_SEEKABLE_NORMAL) || c->fc->flags & 
> AVFMT_FLAG_IGNIDX || c->frag_index.complete) ||
> +((!(pb->seekable & AVIO_SEEKABLE_NORMAL) || c->fc->flags & 
> AVFMT_FLAG_IGNIDX || (c->frag_index.complete && c->moof_count >= 
> c->frag_index.nb_items)) ||
>  start_pos + a.size == avio_size(pb))) {
> if (!(pb->seekable & AVIO_SEEKABLE_NORMAL) || c->fc->flags & 
> AVFMT_FLAG_IGNIDX || c->frag_index.complete)
> c->next_root_atom = start_pos + a.size;

No, it breaks the use case with global sidx. We can achieve fast
startup with global sidx.

The patch describes an issue with multiple sidx cases, actually
it’s more serious with global sidx. In the first case, the bitrate
is a little inaccurate. Bitrate is near zero for the second case.

I have two ideas:

1. Just skip bitrate calculation from sc->data_size if sidx exist,
e.g.,

@@ -8500,7 +8500,7 @@ static int mov_read_header(AVFormatContext *s)
 for (i = 0; i < s->nb_streams; i++) {
 AVStream *st = s->streams[i];
 MOVStreamContext *sc = st->priv_data;
-if (st->duration > 0) {
+if (st->duration > 0 && !sc->has_sidx) {
 /* Akin to sc->data_size * 8 * sc->time_scale / st->duration 
but accounting for overflows. */
 st->codecpar->bit_rate = av_rescale(sc->data_size, ((int64_t) 
sc->time_scale) * 8, st->duration);
 if (st->codecpar->bit_rate == INT64_MIN) {

It’s simple, and bitrate information has multiple sources. 

2. Add a option to prevent mark complete when reading sidx

@@ -5446,7 +5446,7 @@ static int mov_read_sidx(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
 // See if the remaining bytes are just an mfra which we can ignore.
 is_complete = offset == stream_size;
-if (!is_complete && (pb->seekable & AVIO_SEEKABLE_NORMAL) && stream_size > 
0 ) {
+if (!is_complete && (pb->seekable & AVIO_SEEKABLE_NORMAL) && stream_size > 
0 && !parse_full) {

Then

@@ -8500,7 +8500,7 @@ static int mov_read_header(AVFormatContext *s)
 for (i = 0; i < s->nb_streams; i++) {
 AVStream *st = s->streams[i];
 MOVStreamContext *sc = st->priv_data;
-if (st->duration > 0) {
+if (st->duration > 0 && (!sc->has_sidx || parse_full)) {

It’s such a corner case and I can’t find a suitable name for this option.

Any ideas?

> @@ -8361,6 +8364,9 @@ static int mov_read_header(AVFormatContext *s)
> av_log(s, AV_LOG_ERROR, "moov atom not found\n");
> return AVERROR_INVALIDDATA;
> }
> +if (mov->frag_index.nb_items > mov->moof_count) {
> +av_log(s, AV_LOG_WARNING, "the number of moof is less then fragment 
> count\n");
> +}
> av_log(mov->fc, AV_LOG_TRACE, "on_parse_e

Re: [FFmpeg-devel] [PATCH] arm: vc1dsp: Canonicalize the syntax for aligned NEON loads/stores

2022-09-29 Thread Martin Storsjö

On Wed, 28 Sep 2022, Martin Storsjö wrote:


This hopefully should fix building with older toolchains, hopefully
fixing the fate failures on
http://fate.ffmpeg.org/history.cgi?slot=armel5tej-qemu-debian-gcc4.4.

Signed-off-by: Martin Storsjö 
---
libavcodec/arm/vc1dsp_neon.S | 40 ++--
1 file changed, 20 insertions(+), 20 deletions(-)


I'll go ahead and push this, as I don't foresee objections to it.

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