[FFmpeg-cvslog] fftools/ffmpeg_mux_init: Fix double-free on error

2024-03-25 Thread Andreas Rheinhardt
ffmpeg | branch: master | Andreas Rheinhardt  | 
Mon Mar 25 16:54:25 2024 +0100| [ced5c5fdb8634d39ca9472a2026b2d2fea16c4e5] | 
committer: Andreas Rheinhardt

fftools/ffmpeg_mux_init: Fix double-free on error

MATCH_PER_STREAM_OPT iterates over all options of a given
OptionDef and tests whether they apply to the current stream;
if so, they are set to ost->apad, otherwise, the code errors
out. If no error happens, ost->apad is av_strdup'ed in order
to take ownership of this pointer.

But this means that setting it originally was premature,
as it leads to double-frees when an error happens lateron.
This can simply be reproduced with
ffmpeg -filter_complex anullsrc  -apad bar -apad:n baz -f null -
This is a regression since 83ace80bfd80fcdba2c65fa1d554923ea931d5bd.

Fix this by using a temporary variable instead of directly
setting ost->apad. Also only strdup the string if it actually
is != NULL.

Reviewed-by: Marth64 
Signed-off-by: Andreas Rheinhardt 

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

 fftools/ffmpeg_mux_init.c | 9 +++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/fftools/ffmpeg_mux_init.c b/fftools/ffmpeg_mux_init.c
index 818d76acda..d3d7d022ff 100644
--- a/fftools/ffmpeg_mux_init.c
+++ b/fftools/ffmpeg_mux_init.c
@@ -832,6 +832,7 @@ static int new_stream_audio(Muxer *mux, const 
OptionsContext *o,
 int channels = 0;
 char *layout = NULL;
 char *sample_fmt = NULL;
+const char *apad = NULL;
 
 MATCH_PER_STREAM_OPT(audio_channels, i, channels, oc, st);
 if (channels) {
@@ -854,8 +855,12 @@ static int new_stream_audio(Muxer *mux, const 
OptionsContext *o,
 
 MATCH_PER_STREAM_OPT(audio_sample_rate, i, audio_enc->sample_rate, oc, 
st);
 
-MATCH_PER_STREAM_OPT(apad, str, ost->apad, oc, st);
-ost->apad = av_strdup(ost->apad);
+MATCH_PER_STREAM_OPT(apad, str, apad, oc, st);
+if (apad) {
+ost->apad = av_strdup(apad);
+if (!ost->apad)
+return AVERROR(ENOMEM);
+}
 }
 
 return 0;

___
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/internal: Move FF_FMT_INIT_CLEANUP to demux.h

2024-03-25 Thread Andreas Rheinhardt
ffmpeg | branch: master | Andreas Rheinhardt  | 
Fri Mar 15 18:08:11 2024 +0100| [4a4dcde339b8e50f5cf77a6048bf665a2be27133] | 
committer: Andreas Rheinhardt

avformat/internal: Move FF_FMT_INIT_CLEANUP to demux.h

and rename it to FF_INFMT_INIT_CLEANUP. This flag is demuxer-only,
so this is the more appropriate place for it.
This does not preclude adding internal flags common to both
demuxer and muxer in the future.

Signed-off-by: Andreas Rheinhardt 

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

 libavdevice/lavfi.c   | 2 +-
 libavformat/4xm.c | 2 +-
 libavformat/aadec.c   | 2 +-
 libavformat/aaxdec.c  | 2 +-
 libavformat/ape.c | 2 +-
 libavformat/aqtitledec.c  | 2 +-
 libavformat/assdec.c  | 2 +-
 libavformat/av1dec.c  | 4 ++--
 libavformat/avidec.c  | 2 +-
 libavformat/brstm.c   | 4 ++--
 libavformat/concatdec.c   | 2 +-
 libavformat/dashdec.c | 2 +-
 libavformat/demux.c   | 2 +-
 libavformat/demux.h   | 8 +++-
 libavformat/dvdvideodec.c | 2 +-
 libavformat/evcdec.c  | 2 +-
 libavformat/hls.c | 2 +-
 libavformat/iamfdec.c | 2 +-
 libavformat/icodec.c  | 2 +-
 libavformat/imfdec.c  | 2 +-
 libavformat/internal.h| 6 --
 libavformat/jacosubdec.c  | 2 +-
 libavformat/jpegxl_anim_dec.c | 2 +-
 libavformat/jvdec.c   | 2 +-
 libavformat/lafdec.c  | 2 +-
 libavformat/libgme.c  | 2 +-
 libavformat/libopenmpt.c  | 2 +-
 libavformat/lrcdec.c  | 2 +-
 libavformat/matroskadec.c | 4 ++--
 libavformat/mccdec.c  | 2 +-
 libavformat/microdvddec.c | 2 +-
 libavformat/mlvdec.c  | 2 +-
 libavformat/moflex.c  | 2 +-
 libavformat/mov.c | 2 +-
 libavformat/mpeg.c| 2 +-
 libavformat/mpl2dec.c | 2 +-
 libavformat/mpsubdec.c| 2 +-
 libavformat/mxfdec.c  | 2 +-
 libavformat/nsvdec.c  | 2 +-
 libavformat/nutdec.c  | 2 +-
 libavformat/oggdec.c  | 2 +-
 libavformat/omadec.c  | 2 +-
 libavformat/paf.c | 2 +-
 libavformat/pdvdec.c  | 2 +-
 libavformat/pjsdec.c  | 2 +-
 libavformat/pp_bnk.c  | 2 +-
 libavformat/realtextdec.c | 2 +-
 libavformat/rmdec.c   | 4 ++--
 libavformat/samidec.c | 2 +-
 libavformat/sccdec.c  | 2 +-
 libavformat/scd.c | 2 +-
 libavformat/segafilm.c| 2 +-
 libavformat/sierravmd.c   | 2 +-
 libavformat/srtdec.c  | 2 +-
 libavformat/stldec.c  | 2 +-
 libavformat/subviewer1dec.c   | 2 +-
 libavformat/subviewerdec.c| 2 +-
 libavformat/tedcaptionsdec.c  | 2 +-
 libavformat/tiertexseq.c  | 2 +-
 libavformat/vapoursynth.c | 2 +-
 libavformat/vividas.c | 2 +-
 libavformat/vplayerdec.c  | 2 +-
 libavformat/wc3movie.c| 2 +-
 libavformat/webvttdec.c   | 2 +-
 libavformat/xmv.c | 2 +-
 65 files changed, 74 insertions(+), 74 deletions(-)

diff --git a/libavdevice/lavfi.c b/libavdevice/lavfi.c
index 58ad62bd97..ce10d61f8a 100644
--- a/libavdevice/lavfi.c
+++ b/libavdevice/lavfi.c
@@ -503,5 +503,5 @@ const FFInputFormat ff_lavfi_demuxer = {
 .read_header= lavfi_read_header,
 .read_packet= lavfi_read_packet,
 .read_close = lavfi_read_close,
-.flags_internal = FF_FMT_INIT_CLEANUP,
+.flags_internal = FF_INFMT_FLAG_INIT_CLEANUP,
 };
diff --git a/libavformat/4xm.c b/libavformat/4xm.c
index 3424791b81..516c7866bd 100644
--- a/libavformat/4xm.c
+++ b/libavformat/4xm.c
@@ -401,7 +401,7 @@ const FFInputFormat ff_fourxm_demuxer = {
 .p.name = "4xm",
 .p.long_name= NULL_IF_CONFIG_SMALL("4X Technologies"),
 .priv_data_size = sizeof(FourxmDemuxContext),
-.flags_internal = FF_FMT_INIT_CLEANUP,
+.flags_internal = FF_INFMT_FLAG_INIT_CLEANUP,
 .read_probe = fourxm_probe,
 .read_header= fourxm_read_header,
 .read_packet= fourxm_read_packet,
diff --git a/libavformat/aadec.c b/libavformat/aadec.c
index dd698d0d5d..c39fb51a8d 100644
--- a/libavformat/aadec.c
+++ b/libavformat/aadec.c
@@ -383,5 +383,5 @@ const FFInputFormat ff_aa_demuxer = {
 .read_packet= aa_read_packet,
 .read_seek  = aa_read_seek,
 .read_close = aa_read_close,
-.flags_internal = FF_FMT_INIT_CLEANUP,
+.flags_internal = FF_INFMT_FLAG_INIT_CLEANUP,
 };
diff --git a/libavformat/aaxdec.c b/libavformat/aaxdec.c
index 0ccd4944db..830ae5d89e 100644
--- a/libavformat/aaxdec.c
+++ b/libavformat/aaxdec.c
@@ -389,7 +389,7 @@ const FFInputFormat ff_aax_demuxer = {
 .p.extensions   = "aax",
 .p.flags= AVFMT_GENERIC_INDEX,
 .priv_data_size = sizeof(AAXContext),
-.flags_internal = FF_FMT_INIT_CLEANUP,
+.flags_internal = FF_INFMT_FLAG_INIT_CLEANUP,
 .read_probe = aax_probe,
 .read_header= aax_read_header,

[FFmpeg-cvslog] avformat/vqf: Return 0 on success in read_packet

2024-03-25 Thread Andreas Rheinhardt
ffmpeg | branch: master | Andreas Rheinhardt  | 
Sun Mar 17 20:38:11 2024 +0100| [27af88fb7fe6ecbcda60f46f8f22f2ca324eb7ec] | 
committer: Andreas Rheinhardt

avformat/vqf: Return 0 on success in read_packet

Demuxers are not supposed to return the size of the packet read.

Signed-off-by: Andreas Rheinhardt 

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

 libavformat/vqf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/vqf.c b/libavformat/vqf.c
index 4c7f5aa22e..409c014a92 100644
--- a/libavformat/vqf.c
+++ b/libavformat/vqf.c
@@ -259,7 +259,7 @@ static int vqf_read_packet(AVFormatContext *s, AVPacket 
*pkt)
 c->last_frame_bits = pkt->data[size+1];
 c->remaining_bits  = (size << 3) - c->frame_bit_len + c->remaining_bits;
 
-return size+2;
+return 0;
 }
 
 static int vqf_read_seek(AVFormatContext *s,

___
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/cdg: Don't store avio_size() return value in int

2024-03-25 Thread Andreas Rheinhardt
ffmpeg | branch: master | Andreas Rheinhardt  | 
Sat Mar 16 00:20:47 2024 +0100| [29aa499fc965ebd539ec5076a2b9293edc07acf8] | 
committer: Andreas Rheinhardt

avformat/cdg: Don't store avio_size() return value in int

Signed-off-by: Andreas Rheinhardt 

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

 libavformat/cdg.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/cdg.c b/libavformat/cdg.c
index 2030cdff89..43d919e302 100644
--- a/libavformat/cdg.c
+++ b/libavformat/cdg.c
@@ -46,7 +46,7 @@ static int read_probe(const AVProbeData *p)
 static int read_header(AVFormatContext *s)
 {
 AVStream *vst;
-int ret;
+int64_t ret;
 
 vst = avformat_new_stream(s, NULL);
 if (!vst)

___
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/lafdec: Fix shadowing

2024-03-25 Thread Andreas Rheinhardt
ffmpeg | branch: master | Andreas Rheinhardt  | 
Sun Mar 17 22:51:27 2024 +0100| [cee70b9f1b378ae1ea6c4aaa7178d89f39768ea8] | 
committer: Andreas Rheinhardt

avformat/lafdec: Fix shadowing

Signed-off-by: Andreas Rheinhardt 

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

 libavformat/lafdec.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavformat/lafdec.c b/libavformat/lafdec.c
index 05f30691ba..77eab2ea6b 100644
--- a/libavformat/lafdec.c
+++ b/libavformat/lafdec.c
@@ -148,8 +148,8 @@ static int laf_read_header(AVFormatContext *ctx)
 if (!s->data)
 return AVERROR(ENOMEM);
 
-for (int st = 0; st < st_count; st++) {
-StreamParams *stp = >p[st];
+for (unsigned i = 0; i < st_count; i++) {
+StreamParams *stp = >p[i];
 AVCodecParameters *par;
 AVStream *st = avformat_new_stream(ctx, NULL);
 if (!st)

___
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/argo_cvg: Avoid relocations for ArgoCVGOverride

2024-03-25 Thread Andreas Rheinhardt
ffmpeg | branch: master | Andreas Rheinhardt  | 
Fri Mar 15 22:30:09 2024 +0100| [aa8c7dc3d8d5312954d7a13486fa0cdedfc31c7f] | 
committer: Andreas Rheinhardt

avformat/argo_cvg: Avoid relocations for ArgoCVGOverride

The average length of the strings used here does not differ much
from the length of the longest string; therefore it makes sense
to use an array big enough for the longest string and not
a pointer to a string. This also moves this array into .rodata
(from .data.rel.ro).

Signed-off-by: Andreas Rheinhardt 

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

 libavformat/argo_cvg.c | 38 ++
 1 file changed, 26 insertions(+), 12 deletions(-)

diff --git a/libavformat/argo_cvg.c b/libavformat/argo_cvg.c
index 5db2a85dd8..03ae6fa59e 100644
--- a/libavformat/argo_cvg.c
+++ b/libavformat/argo_cvg.c
@@ -47,13 +47,6 @@ typedef struct ArgoCVGHeader {
 uint32_t reverb; /*< Reverb flag. */
 } ArgoCVGHeader;
 
-typedef struct ArgoCVGOverride {
-const char*name;
-ArgoCVGHeader header;
-uint32_t  checksum;
-int   sample_rate;
-} ArgoCVGOverride;
-
 typedef struct ArgoCVGDemuxContext {
 ArgoCVGHeader header;
 uint32_t  checksum;
@@ -72,12 +65,33 @@ typedef struct ArgoCVGMuxContext {
 
 #if CONFIG_ARGO_CVG_DEMUXER
 /* "Special" files that are played at a different rate. */
+//  FILE(NAME, SIZE, LOOP, REVERB, CHECKSUM, SAMPLE_RATE)
+#define OVERRIDE_FILES(FILE)   \
+FILE(CRYS, 23592, 0, 1, 2495499, 88200) /* Beta */ \
+FILE(REDCRY88, 38280, 0, 1, 4134848, 88200) /* Beta */ \
+FILE(DANLOOP1, 54744, 1, 0, 5684641, 37800) /* Beta */ \
+FILE(PICKUP88, 12904, 0, 1, 1348091, 48000) /* Beta */ \
+FILE(SELECT1,   5080, 0, 1,  549987, 44100) /* Beta */ \
+
+#define MAX_FILENAME_SIZE(NAME, SIZE, LOOP, REVERB, CHECKSUM, SAMPLE_RATE) \
+MAX_SIZE_BEFORE_ ## NAME,  \
+MAX_SIZE_UNTIL_ ## NAME ## _MINUS1 = FFMAX(sizeof(#NAME ".CVG"), 
MAX_SIZE_BEFORE_ ## NAME) - 1,
+enum {
+OVERRIDE_FILES(MAX_FILENAME_SIZE)
+MAX_OVERRIDE_FILENAME_SIZE
+};
+
+typedef struct ArgoCVGOverride {
+const charname[MAX_OVERRIDE_FILENAME_SIZE];
+ArgoCVGHeader header;
+uint32_t  checksum;
+int   sample_rate;
+} ArgoCVGOverride;
+
+#define FILE(NAME, SIZE, LOOP, REVERB, CHECKSUM, SAMPLE_RATE) \
+{ #NAME ".CVG", { SIZE, LOOP, REVERB }, CHECKSUM, SAMPLE_RATE },
 static const ArgoCVGOverride overrides[] = {
-{ "CRYS.CVG", { 23592, 0, 1 }, 2495499, 88200 }, /* Beta */
-{ "REDCRY88.CVG", { 38280, 0, 1 }, 4134848, 88200 }, /* Beta */
-{ "DANLOOP1.CVG", { 54744, 1, 0 }, 5684641, 37800 }, /* Beta */
-{ "PICKUP88.CVG", { 12904, 0, 1 }, 1348091, 48000 }, /* Beta */
-{ "SELECT1.CVG",  {  5080, 0, 1 },  549987, 44100 }, /* Beta */
+OVERRIDE_FILES(FILE)
 };
 
 static int argo_cvg_probe(const AVProbeData *p)

___
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/wvedec: Inline constant

2024-03-25 Thread Andreas Rheinhardt
ffmpeg | branch: master | Andreas Rheinhardt  | 
Sun Mar 17 20:21:01 2024 +0100| [88f803cf64517c70e808420fddcba7bb1788645b] | 
committer: Andreas Rheinhardt

avformat/wvedec: Inline constant

Signed-off-by: Andreas Rheinhardt 

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

 libavformat/wvedec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/wvedec.c b/libavformat/wvedec.c
index 43e6359892..13934b78e4 100644
--- a/libavformat/wvedec.c
+++ b/libavformat/wvedec.c
@@ -45,7 +45,7 @@ static int wve_read_header(AVFormatContext *s)
 st->codecpar->codec_id= AV_CODEC_ID_PCM_ALAW;
 st->codecpar->sample_rate = 8000;
 st->codecpar->ch_layout.nb_channels = 1;
-st->codecpar->bits_per_coded_sample = 
av_get_bits_per_sample(st->codecpar->codec_id);
+st->codecpar->bits_per_coded_sample = 8;
 st->codecpar->block_align = st->codecpar->bits_per_coded_sample *
 st->codecpar->ch_layout.nb_channels / 8;
 avpriv_set_pts_info(st, 64, 1, st->codecpar->sample_rate);

___
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/wady: Combine skips

2024-03-25 Thread Andreas Rheinhardt
ffmpeg | branch: master | Andreas Rheinhardt  | 
Sun Mar 17 20:32:24 2024 +0100| [69b85a69bdf0273c17c55adda15a7c1ddf6771bc] | 
committer: Andreas Rheinhardt

avformat/wady: Combine skips

Signed-off-by: Andreas Rheinhardt 

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

 libavformat/wady.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/libavformat/wady.c b/libavformat/wady.c
index 81a64c6d3f..a6c61ffcaa 100644
--- a/libavformat/wady.c
+++ b/libavformat/wady.c
@@ -46,13 +46,12 @@ static int wady_read_header(AVFormatContext *s)
 int channels, ret;
 AVStream *st;
 
-avio_skip(pb, 4);
+avio_skip(pb, 4 + 1);
 
 st = avformat_new_stream(s, NULL);
 if (!st)
 return AVERROR(ENOMEM);
 
-avio_skip(pb, 1);
 par  = st->codecpar;
 par->codec_type  = AVMEDIA_TYPE_AUDIO;
 par->codec_id= AV_CODEC_ID_WADY_DPCM;

___
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/avr: Combine skips

2024-03-25 Thread Andreas Rheinhardt
ffmpeg | branch: master | Andreas Rheinhardt  | 
Fri Mar 15 22:58:46 2024 +0100| [cdff5a2c0cfa978b97398dd4e95cc2a292d05525] | 
committer: Andreas Rheinhardt

avformat/avr: Combine skips

Signed-off-by: Andreas Rheinhardt 

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

 libavformat/avr.c | 12 +++-
 1 file changed, 3 insertions(+), 9 deletions(-)

diff --git a/libavformat/avr.c b/libavformat/avr.c
index 12286c04d4..261edef4b5 100644
--- a/libavformat/avr.c
+++ b/libavformat/avr.c
@@ -49,8 +49,7 @@ static int avr_read_header(AVFormatContext *s)
 
 st->codecpar->codec_type = AVMEDIA_TYPE_AUDIO;
 
-avio_skip(s->pb, 4); // magic
-avio_skip(s->pb, 8); // sample_name
+avio_skip(s->pb, 4 /* magic */ + 8 /* sample_name */);
 
 chan = avio_rb16(s->pb);
 if (!chan) {
@@ -66,18 +65,13 @@ static int avr_read_header(AVFormatContext *s)
 
 sign = avio_rb16(s->pb);
 
-avio_skip(s->pb, 2); // loop
-avio_skip(s->pb, 2); // midi
-avio_skip(s->pb, 1); // replay speed
+avio_skip(s->pb, 2 /* loop */ + 2 /* midi */ + 1 /* replay speed */);
 
 st->codecpar->sample_rate = avio_rb24(s->pb);
 if (st->codecpar->sample_rate == 0)
 return AVERROR_INVALIDDATA;
 
-avio_skip(s->pb, 4 * 3);
-avio_skip(s->pb, 2 * 3);
-avio_skip(s->pb, 20);
-avio_skip(s->pb, 64);
+avio_skip(s->pb, 4 * 3 + 2 * 3 + 20 + 64);
 
 st->codecpar->codec_id = ff_get_pcm_codec_id(bps, 0, 1, sign);
 if (st->codecpar->codec_id == AV_CODEC_ID_NONE) {

___
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/fsb: Don't set data_offset manually

2024-03-25 Thread Andreas Rheinhardt
ffmpeg | branch: master | Andreas Rheinhardt  | 
Fri Mar 22 20:43:28 2024 +0100| [56ba83ff2d7225189cee296b6a5c33ba6619e521] | 
committer: Andreas Rheinhardt

avformat/fsb: Don't set data_offset manually

It is set generically to the value that it is to here.

Signed-off-by: Andreas Rheinhardt 

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

 libavformat/fsb.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/libavformat/fsb.c b/libavformat/fsb.c
index 4189822d8e..0febeffd56 100644
--- a/libavformat/fsb.c
+++ b/libavformat/fsb.c
@@ -157,7 +157,6 @@ static int fsb_read_header(AVFormatContext *s)
 }
 
 avio_skip(pb, offset - avio_tell(pb));
-ffformatcontext(s)->data_offset = avio_tell(pb);
 
 avpriv_set_pts_info(st, 64, 1, par->sample_rate);
 

___
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/fitsdec: Don't use AVBPrint for temporary storage

2024-03-25 Thread Andreas Rheinhardt
ffmpeg | branch: master | Andreas Rheinhardt  | 
Fri Mar 22 19:22:25 2024 +0100| [b93ed5c28ecc06a0a5e54994439c9a65fa0f96c4] | 
committer: Andreas Rheinhardt

avformat/fitsdec: Don't use AVBPrint for temporary storage

Most of the data in the temporary storage ends up being
returned to the user as AVPacket.data, so it makes sense
to avoid using the AVBPrint for temporary storage altogether
(in particular in light of the fact that the blocks read here
are too big for the small-string optimization anyway) and
read the data directly into AVPacket.data. This also avoids
another memcpy() from a stack buffer to the AVBPrint in ts_image()
(that could always have been avoided with av_bprint_get_buffer()).

These changes also allow to use av_append_packet(), which
greatly simplifies the code; furthermore, one can avoid cleanup
code on error as the packet is already unreferenced generically
on error.

There are two user-visible changes from this patch:
1. Truncated packets are now marked as corrupt.
2. AVPacket.pos is set (it corresponds to the discarded header
line, 80 bytes before the position corresponding to the
actual packet data).

Furthermore, this patch also removes code that triggered
a -Wtautological-constant-out-of-range-compare warning
from Clang (namely a comparison of an unsigned and INT64_MAX
in an assert).

Signed-off-by: Andreas Rheinhardt 

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

 libavformat/fitsdec.c | 80 ---
 1 file changed, 25 insertions(+), 55 deletions(-)

diff --git a/libavformat/fitsdec.c b/libavformat/fitsdec.c
index fe2dd5ad5d..6771dda327 100644
--- a/libavformat/fitsdec.c
+++ b/libavformat/fitsdec.c
@@ -24,13 +24,10 @@
  * FITS demuxer.
  */
 
-#include "libavutil/avassert.h"
-#include "libavutil/intreadwrite.h"
 #include "demux.h"
 #include "internal.h"
 #include "libavutil/opt.h"
 #include "libavcodec/fits.h"
-#include "libavutil/bprint.h"
 
 #define FITS_BLOCK_SIZE 2880
 
@@ -71,31 +68,31 @@ static int fits_read_header(AVFormatContext *s)
  * @param s pointer to AVFormat Context
  * @param fits pointer to FITSContext
  * @param header pointer to FITSHeader
- * @param avbuf pointer to AVBPrint to store the header
+ * @param pkt pointer to AVPacket to store the header
  * @param data_size to store the size of data part
- * @return 1 if image found, 0 if any other extension and AVERROR_INVALIDDATA 
otherwise
+ * @return 1 if image found, 0 if any other extension and AVERROR code 
otherwise
  */
-static int64_t is_image(AVFormatContext *s, FITSContext *fits, FITSHeader 
*header,
- AVBPrint *avbuf, uint64_t *data_size)
+static int is_image(AVFormatContext *s, FITSContext *fits, FITSHeader *header,
+AVPacket *pkt, uint64_t *data_size)
 {
 int i, ret, image = 0;
-char buf[FITS_BLOCK_SIZE] = { 0 };
-int64_t buf_size = 0, size = 0, t;
+int64_t size = 0, t;
 
 do {
-ret = avio_read(s->pb, buf, FITS_BLOCK_SIZE);
+const uint8_t *buf, *buf_end;
+ret = av_append_packet(s->pb, pkt, FITS_BLOCK_SIZE);
 if (ret < 0) {
 return ret;
 } else if (ret < FITS_BLOCK_SIZE) {
 return AVERROR_INVALIDDATA;
 }
 
-av_bprint_append_data(avbuf, buf, FITS_BLOCK_SIZE);
 ret = 0;
-buf_size = 0;
-while(!ret && buf_size < FITS_BLOCK_SIZE) {
-ret = avpriv_fits_header_parse_line(s, header, buf + buf_size, 
NULL);
-buf_size += 80;
+buf_end = pkt->data + pkt->size;
+buf = buf_end - FITS_BLOCK_SIZE;
+while(!ret && buf < buf_end) {
+ret = avpriv_fits_header_parse_line(s, header, buf, NULL);
+buf += 80;
 }
 } while (!ret);
 if (ret < 0)
@@ -142,12 +139,10 @@ static int64_t is_image(AVFormatContext *s, FITSContext 
*fits, FITSHeader *heade
 
 static int fits_read_packet(AVFormatContext *s, AVPacket *pkt)
 {
-int64_t pos, ret;
 uint64_t size;
 FITSContext *fits = s->priv_data;
 FITSHeader header;
-AVBPrint avbuf;
-char *buf;
+int ret;
 
 if (fits->first_image) {
 avpriv_fits_header_init(, STATE_SIMPLE);
@@ -155,57 +150,32 @@ static int fits_read_packet(AVFormatContext *s, AVPacket 
*pkt)
 avpriv_fits_header_init(, STATE_XTENSION);
 }
 
-av_bprint_init(, FITS_BLOCK_SIZE, AV_BPRINT_SIZE_UNLIMITED);
-while ((ret = is_image(s, fits, , , )) == 0) {
-av_bprint_finalize(, NULL);
-pos = avio_skip(s->pb, size);
+while ((ret = is_image(s, fits, , pkt, )) == 0) {
+int64_t pos = avio_skip(s->pb, size);
 if (pos < 0)
 return pos;
 
-av_bprint_init(, FITS_BLOCK_SIZE, AV_BPRINT_SIZE_UNLIMITED);
 avpriv_fits_header_init(, STATE_XTENSION);
+av_packet_unref(pkt);
 }
 if (ret < 0)
-goto fail;
-
-if (!av_bprint_is_complete()) {
-  

[FFmpeg-cvslog] avformat/g722: Inline constants

2024-03-25 Thread Andreas Rheinhardt
ffmpeg | branch: master | Andreas Rheinhardt  | 
Fri Mar 15 20:14:41 2024 +0100| [8768188581b4e47125d8eab625920e8ad65ed2d9] | 
committer: Andreas Rheinhardt

avformat/g722: Inline constants

Forgotten in 5f0e161dd61552ad70760bad35b869eaec7368ff.

Signed-off-by: Andreas Rheinhardt 

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

 libavformat/g722.c | 6 +-
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/libavformat/g722.c b/libavformat/g722.c
index 15519d90b5..adb78e8db5 100644
--- a/libavformat/g722.c
+++ b/libavformat/g722.c
@@ -19,7 +19,6 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
-#include "libavutil/avassert.h"
 #include "avformat.h"
 #include "demux.h"
 #include "internal.h"
@@ -38,10 +37,7 @@ static int g722_read_header(AVFormatContext *s)
 st->codecpar->sample_rate = 16000;
 st->codecpar->ch_layout   = (AVChannelLayout)AV_CHANNEL_LAYOUT_MONO;
 
-st->codecpar->bits_per_coded_sample =
-av_get_bits_per_sample(st->codecpar->codec_id);
-
-av_assert0(st->codecpar->bits_per_coded_sample > 0);
+st->codecpar->bits_per_coded_sample = 4;
 
 avpriv_set_pts_info(st, 64, 1, st->codecpar->sample_rate);
 return 0;

___
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/hls: Don't access FFInputFormat.raw_codec_id

2024-03-25 Thread Andreas Rheinhardt
ffmpeg | branch: master | Andreas Rheinhardt  | 
Mon Mar 18 00:24:39 2024 +0100| [5144455c201185861072e66884bba16c48b4812d] | 
committer: Andreas Rheinhardt

avformat/hls: Don't access FFInputFormat.raw_codec_id

It is an implementation detail of other input formats whether
they use raw_codec_id or not. The HLS demuxer should not rely
on this.

Signed-off-by: Andreas Rheinhardt 

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

 libavformat/hls.c   | 10 ++
 libavformat/hls_sample_encryption.c |  1 +
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/libavformat/hls.c b/libavformat/hls.c
index f6b44c2e35..94defa9384 100644
--- a/libavformat/hls.c
+++ b/libavformat/hls.c
@@ -2100,10 +2100,12 @@ static int hls_read_header(AVFormatContext *s)
  */
 if (seg && seg->key_type == KEY_SAMPLE_AES && pls->is_id3_timestamped 
&&
 pls->audio_setup_info.codec_id != AV_CODEC_ID_NONE) {
-void *iter = NULL;
-while ((in_fmt = av_demuxer_iterate()))
-if (ffifmt(in_fmt)->raw_codec_id == 
pls->audio_setup_info.codec_id)
-break;
+av_assert1(pls->audio_setup_info.codec_id == AV_CODEC_ID_AAC ||
+   pls->audio_setup_info.codec_id == AV_CODEC_ID_AC3 ||
+   pls->audio_setup_info.codec_id == AV_CODEC_ID_EAC3);
+// Keep this list in sync with ff_hls_senc_read_audio_setup_info()
+in_fmt = av_find_input_format(pls->audio_setup_info.codec_id == 
AV_CODEC_ID_AAC ? "aac" :
+  pls->audio_setup_info.codec_id == 
AV_CODEC_ID_AC3 ? "ac3" : "eac3");
 } else {
 pls->ctx->probesize = s->probesize > 0 ? s->probesize : 1024 * 4;
 pls->ctx->max_analyze_duration = s->max_analyze_duration > 0 ? 
s->max_analyze_duration : 4 * AV_TIME_BASE;
diff --git a/libavformat/hls_sample_encryption.c 
b/libavformat/hls_sample_encryption.c
index d5b4c11b66..f412836d4f 100644
--- a/libavformat/hls_sample_encryption.c
+++ b/libavformat/hls_sample_encryption.c
@@ -64,6 +64,7 @@ void ff_hls_senc_read_audio_setup_info(HLSAudioSetupInfo 
*info, const uint8_t *b
 
 info->codec_tag = AV_RL32(buf);
 
+/* Always keep this list in sync with the one from hls_read_header() */
 if (info->codec_tag == MKTAG('z','a','a','c'))
 info->codec_id = AV_CODEC_ID_AAC;
 else if (info->codec_tag == MKTAG('z','a','c','3'))

___
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] configure: Make hls demuxer select AAC, AC3 and EAC3 demuxers

2024-03-25 Thread Andreas Rheinhardt
ffmpeg | branch: master | Andreas Rheinhardt  | 
Sun Mar 17 23:59:26 2024 +0100| [8d8b5947c3369a46e62969dfefd7e112d256] | 
committer: Andreas Rheinhardt

configure: Make hls demuxer select AAC, AC3 and EAC3 demuxers

The code relies on their presence and would presumably crash
when retrieving in_fmt->name if an encrypted stream with a codec id
without demuxer were encountered.

Signed-off-by: Andreas Rheinhardt 

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

 configure | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/configure b/configure
index 9fa639fca6..2a1d22310b 100755
--- a/configure
+++ b/configure
@@ -3588,7 +3588,7 @@ flac_demuxer_select="flac_parser"
 flv_muxer_select="aac_adtstoasc_bsf"
 gxf_muxer_select="pcm_rechunk_bsf"
 hds_muxer_select="flv_muxer"
-hls_demuxer_select="adts_header ac3_parser mov_demuxer mpegts_demuxer"
+hls_demuxer_select="aac_demuxer ac3_demuxer adts_header ac3_parser 
eac3_demuxer mov_demuxer mpegts_demuxer"
 hls_muxer_select="mov_muxer mpegts_muxer"
 iamf_demuxer_select="iamfdec"
 iamf_muxer_select="iamfenc"

___
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/mux: Remove check for AVFMT_ALLOW_FLUSH

2024-03-25 Thread Andreas Rheinhardt
ffmpeg | branch: master | Andreas Rheinhardt  | 
Sat Mar 23 00:57:32 2024 +0100| [a990e6fa01cb4436e26d0aa628307305cd475bef] | 
committer: Andreas Rheinhardt

avformat/mux: Remove check for AVFMT_ALLOW_FLUSH

Due to the bump it is now certain that all devices
that support flushing have the proper internal flag set.
(Notice that the check for LIBAVFORMAT_VERSION was wrong.)

Signed-off-by: Andreas Rheinhardt 

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

 libavformat/mux.c | 6 --
 1 file changed, 6 deletions(-)

diff --git a/libavformat/mux.c b/libavformat/mux.c
index f23eb0188d..630204a8ec 100644
--- a/libavformat/mux.c
+++ b/libavformat/mux.c
@@ -1236,13 +1236,7 @@ int av_write_frame(AVFormatContext *s, AVPacket *in)
 int ret;
 
 if (!in) {
-#if FF_API_ALLOW_FLUSH || LIBAVFORMAT_VERSION_MAJOR >= 61
-// Hint: The pulse audio output device has this set,
-// so we can't switch the check to FF_OFMT_FLAG_ALLOW_FLUSH 
immediately.
-if (s->oformat->flags & AVFMT_ALLOW_FLUSH) {
-#else
 if (ffofmt(s->oformat)->flags_internal & FF_OFMT_FLAG_ALLOW_FLUSH) {
-#endif
 ret = ffofmt(s->oformat)->write_packet(s, NULL);
 flush_if_needed(s);
 if (ret >= 0 && s->pb && s->pb->error < 0)

___
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/file: Combine all CONFIG_ANDROID_CONTENT_PROTOCOL blocks

2024-03-25 Thread Andreas Rheinhardt
ffmpeg | branch: master | Andreas Rheinhardt  | 
Sat Mar 23 13:10:40 2024 +0100| [e95dd6f53e49325f95ac2243acf3667a6ddf40ac] | 
committer: Andreas Rheinhardt

avformat/file: Combine all CONFIG_ANDROID_CONTENT_PROTOCOL blocks

Besides improving readability this also ensures that
a developer who has the android content protocol enabled
and works on the other parts of the file will not
forget to add necessary inclusions just because of
(indirect) inclusions from the files included only
when said protocol is enabled.

Reviewed-by: Matthieu Bouron 
Signed-off-by: Andreas Rheinhardt 

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

 libavformat/file.c | 36 +++-
 1 file changed, 15 insertions(+), 21 deletions(-)

diff --git a/libavformat/file.c b/libavformat/file.c
index 8f3b35c795..182995717a 100644
--- a/libavformat/file.c
+++ b/libavformat/file.c
@@ -40,12 +40,6 @@
 #include 
 #include "os_support.h"
 #include "url.h"
-#if CONFIG_ANDROID_CONTENT_PROTOCOL
-#include 
-#include "libavcodec/jni.h"
-#include "libavcodec/ffjni.c"
-#endif
-
 
 /* Some systems may not have S_ISFIFO */
 #ifndef S_ISFIFO
@@ -107,21 +101,6 @@ typedef struct FileContext {
 int64_t initial_pos;
 } FileContext;
 
-
-#if CONFIG_ANDROID_CONTENT_PROTOCOL
-static const AVOption android_content_options[] = {
-{ "blocksize", "set I/O operation maximum block size", 
offsetof(FileContext, blocksize), AV_OPT_TYPE_INT, { .i64 = INT_MAX }, 1, 
INT_MAX, AV_OPT_FLAG_ENCODING_PARAM },
-{ NULL }
-};
-
-static const AVClass android_content_class = {
-.class_name = "android_content",
-.item_name  = av_default_item_name,
-.option = android_content_options,
-.version= LIBAVUTIL_VERSION_INT,
-};
-#endif
-
 static const AVOption file_options[] = {
 { "truncate", "truncate existing files on write", offsetof(FileContext, 
trunc), AV_OPT_TYPE_BOOL, { .i64 = 1 }, 0, 1, AV_OPT_FLAG_ENCODING_PARAM },
 { "blocksize", "set I/O operation maximum block size", 
offsetof(FileContext, blocksize), AV_OPT_TYPE_INT, { .i64 = INT_MAX }, 1, 
INT_MAX, AV_OPT_FLAG_ENCODING_PARAM },
@@ -547,6 +526,9 @@ const URLProtocol ff_fd_protocol = {
 #endif /* CONFIG_FD_PROTOCOL */
 
 #if CONFIG_ANDROID_CONTENT_PROTOCOL
+#include 
+#include "libavcodec/jni.h"
+#include "libavcodec/ffjni.c"
 
 typedef struct JFields {
 jclass uri_class;
@@ -670,6 +652,18 @@ done:
 return ret;
 }
 
+static const AVOption android_content_options[] = {
+{ "blocksize", "set I/O operation maximum block size", 
offsetof(FileContext, blocksize), AV_OPT_TYPE_INT, { .i64 = INT_MAX }, 1, 
INT_MAX, AV_OPT_FLAG_ENCODING_PARAM },
+{ NULL }
+};
+
+static const AVClass android_content_class = {
+.class_name = "android_content",
+.item_name  = av_default_item_name,
+.option = android_content_options,
+.version= LIBAVUTIL_VERSION_INT,
+};
+
 const URLProtocol ff_android_content_protocol = {
 .name= "content",
 .url_open= android_content_open,

___
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/file: Constify android content protocol

2024-03-25 Thread Andreas Rheinhardt
ffmpeg | branch: master | Andreas Rheinhardt  | 
Sat Mar 23 13:06:05 2024 +0100| [ebe832640945c531b0ee9b82ae745a11cd9f8e71] | 
committer: Andreas Rheinhardt

avformat/file: Constify android content protocol

(The discrepancy between the definition and the declaration
in protocols.c is actually UB.)

Reviewed-by: Matthieu Bouron 
Signed-off-by: Andreas Rheinhardt 

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

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

diff --git a/libavformat/file.c b/libavformat/file.c
index dd5819c06f..8f3b35c795 100644
--- a/libavformat/file.c
+++ b/libavformat/file.c
@@ -670,7 +670,7 @@ done:
 return ret;
 }
 
-URLProtocol ff_android_content_protocol = {
+const URLProtocol ff_android_content_protocol = {
 .name= "content",
 .url_open= android_content_open,
 .url_read= file_read,

___
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/mpegutils: Simplify indenting

2024-03-25 Thread Andreas Rheinhardt
ffmpeg | branch: master | Andreas Rheinhardt  | 
Sat Mar 23 13:04:23 2024 +0100| [a6189ba896b207c40007704a1aec7ef68a8eb50b] | 
committer: Andreas Rheinhardt

avcodec/mpegutils: Simplify indenting

Signed-off-by: Andreas Rheinhardt 

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

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

diff --git a/libavcodec/mpegutils.c b/libavcodec/mpegutils.c
index 7f499b3d0f..d94e8f422f 100644
--- a/libavcodec/mpegutils.c
+++ b/libavcodec/mpegutils.c
@@ -265,7 +265,7 @@ void ff_print_debug_info2(AVCodecContext *avctx, AVFrame 
*pict,
 margin_left++;
 
 av_bprint_init(, 1, AV_BPRINT_SIZE_UNLIMITED);
-av_bprintf(, "%*s", margin_left, " ");
+av_bprint_chars(, ' ', margin_left);
 
 n = 0;
 if (avctx->debug & FF_DEBUG_SKIP)

___
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/mpegutils: Avoid allocations when using AVBPrint

2024-03-25 Thread Andreas Rheinhardt
ffmpeg | branch: master | Andreas Rheinhardt  | 
Sat Mar 23 13:01:11 2024 +0100| [5eda98f382103be8bc626fa36408b51a996b6518] | 
committer: Andreas Rheinhardt

avcodec/mpegutils: Avoid allocations when using AVBPrint

Signed-off-by: Andreas Rheinhardt 

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

 libavcodec/mpegutils.c | 21 +
 1 file changed, 5 insertions(+), 16 deletions(-)

diff --git a/libavcodec/mpegutils.c b/libavcodec/mpegutils.c
index fc3e270631..7f499b3d0f 100644
--- a/libavcodec/mpegutils.c
+++ b/libavcodec/mpegutils.c
@@ -252,7 +252,6 @@ void ff_print_debug_info2(AVCodecContext *avctx, AVFrame 
*pict,
 if (avctx->debug & (FF_DEBUG_SKIP | FF_DEBUG_QP | FF_DEBUG_MB_TYPE)) {
 int x,y;
 AVBPrint buf;
-char *str = NULL;
 int n;
 int margin_left;
 int x_step;
@@ -278,16 +277,11 @@ void ff_print_debug_info2(AVCodecContext *avctx, AVFrame 
*pict,
 x_step = (mb_width * 16 > 999) ? 8 : 4;
 for (x = 0; x < mb_width; x += x_step)
 av_bprintf(, "%-*d", n * x_step, x << 4);
-n = av_bprint_finalize(, );
-if (n < 0) {
-av_log(avctx, AV_LOG_ERROR, "%s failed, %s\n", __func__, 
av_err2str(n));
-return;
-}
-av_log(avctx, AV_LOG_DEBUG, "%s\n", str);
-av_freep();
+
+av_log(avctx, AV_LOG_DEBUG, "%s\n", buf.str);
 
 for (y = 0; y < mb_height; y++) {
-av_bprint_init(, 1, AV_BPRINT_SIZE_UNLIMITED);
+av_bprint_clear();
 for (x = 0; x < mb_width; x++) {
 if (x == 0)
 av_bprintf(, "%*d ", margin_left - 1, y << 4);
@@ -310,13 +304,8 @@ void ff_print_debug_info2(AVCodecContext *avctx, AVFrame 
*pict,
 }
 }
 
-n = av_bprint_finalize(, );
-if (n < 0) {
-av_log(avctx, AV_LOG_ERROR, "%s failed, %s\n", __func__, 
av_err2str(n));
-return;
-}
-av_log(avctx, AV_LOG_DEBUG, "%s\n", str);
-av_freep();
+av_log(avctx, AV_LOG_DEBUG, "%s\n", buf.str);
 }
+av_bprint_finalize(, NULL);
 }
 }

___
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] fftools/ffmpeg_filter: remove prototype for non existent function

2024-03-25 Thread James Almer
ffmpeg | branch: master | James Almer  | Sun Mar 24 10:32:45 
2024 -0300| [0963ef4996ca94eb37c0c29d9b9e18ac00fe5f29] | committer: James Almer

fftools/ffmpeg_filter: remove prototype for non existent function

Signed-off-by: James Almer 

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

 fftools/ffmpeg.h | 7 ---
 1 file changed, 7 deletions(-)

diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h
index 7454089c2d..6394cca1e7 100644
--- a/fftools/ffmpeg.h
+++ b/fftools/ffmpeg.h
@@ -698,13 +698,6 @@ const FrameData *frame_data_c(AVFrame *frame);
 FrameData   *packet_data  (AVPacket *pkt);
 const FrameData *packet_data_c(AVPacket *pkt);
 
-/**
- * Set up fallback filtering parameters from a decoder context. They will only
- * be used if no frames are ever sent on this input, otherwise the actual
- * parameters are taken from the frame.
- */
-int ifilter_parameters_from_dec(InputFilter *ifilter, const AVCodecContext 
*dec);
-
 int ofilter_bind_ost(OutputFilter *ofilter, OutputStream *ost,
  unsigned sched_idx_enc);
 

___
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] fftools/ffmpeg_filter: remove unused struct from InputFilterPriv

2024-03-25 Thread James Almer
ffmpeg | branch: master | James Almer  | Sun Mar 24 10:32:11 
2024 -0300| [767e7d3d2b44b14158220917253580baf98750df] | committer: James Almer

fftools/ffmpeg_filter: remove unused struct from InputFilterPriv

It's already in InputFilterOptions.

Signed-off-by: James Almer 

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

 fftools/ffmpeg_filter.c | 16 
 1 file changed, 16 deletions(-)

diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c
index 3d88482d07..171e47be9e 100644
--- a/fftools/ffmpeg_filter.c
+++ b/fftools/ffmpeg_filter.c
@@ -145,22 +145,6 @@ typedef struct InputFilterPriv {
 int displaymatrix_present;
 int32_t displaymatrix[9];
 
-// fallback parameters to use when no input is ever sent
-struct {
-AVRational  time_base;
-
-int format;
-
-int width;
-int height;
-AVRational  sample_aspect_ratio;
-enum AVColorSpace   color_space;
-enum AVColorRange   color_range;
-
-int sample_rate;
-AVChannelLayout ch_layout;
-} fallback;
-
 struct {
 AVFrame *frame;
 

___
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 use cur_item_id as array index

2024-03-25 Thread James Almer
ffmpeg | branch: master | James Almer  | Mon Mar 25 00:06:08 
2024 -0300| [abcdd3aed7c9c1759fcd54b287b1f7a48067822f] | committer: James Almer

avformat/mov: don't use cur_item_id as array index

Reviewed-by: Michael Niedermayer 
Signed-off-by: James Almer 

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

 libavformat/mov.c | 16 ++--
 1 file changed, 6 insertions(+), 10 deletions(-)

diff --git a/libavformat/mov.c b/libavformat/mov.c
index f954b924a0..9f2ea97a5b 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -8085,7 +8085,6 @@ static int mov_read_iloc(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
 memset(c->heif_item + c->nb_heif_item, 0,
sizeof(*c->heif_item) * (item_count - c->nb_heif_item));
 c->nb_heif_item = FFMAX(c->nb_heif_item, item_count);
-c->cur_item_id = 0;
 
 av_log(c->fc, AV_LOG_TRACE, "iloc: item_count %d\n", item_count);
 for (int i = 0; i < item_count; i++) {
@@ -8127,7 +8126,7 @@ static int mov_read_iloc(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
 return atom.size;
 }
 
-static int mov_read_infe(MOVContext *c, AVIOContext *pb, MOVAtom atom)
+static int mov_read_infe(MOVContext *c, AVIOContext *pb, MOVAtom atom, int idx)
 {
 AVBPrint item_name;
 int64_t size = atom.size;
@@ -8164,21 +8163,19 @@ static int mov_read_infe(MOVContext *c, AVIOContext 
*pb, MOVAtom atom)
 avio_skip(pb, size);
 
 if (ret)
-av_bprint_finalize(_name, >heif_item[c->cur_item_id].name);
-c->heif_item[c->cur_item_id].item_id = item_id;
-c->heif_item[c->cur_item_id].type= item_type;
+av_bprint_finalize(_name, >heif_item[idx].name);
+c->heif_item[idx].item_id = item_id;
+c->heif_item[idx].type= item_type;
 
 switch (item_type) {
 case MKTAG('a','v','0','1'):
 case MKTAG('h','v','c','1'):
-ret = heif_add_stream(c, >heif_item[c->cur_item_id]);
+ret = heif_add_stream(c, >heif_item[idx]);
 if (ret < 0)
 return ret;
 break;
 }
 
-c->cur_item_id++;
-
 return 0;
 }
 
@@ -8210,14 +8207,13 @@ static int mov_read_iinf(MOVContext *c, AVIOContext 
*pb, MOVAtom atom)
 memset(c->heif_item + c->nb_heif_item, 0,
sizeof(*c->heif_item) * (entry_count - c->nb_heif_item));
 c->nb_heif_item = FFMAX(c->nb_heif_item, entry_count);
-c->cur_item_id = 0;
 
 for (int i = 0; i < entry_count; i++) {
 MOVAtom infe;
 
 infe.size = avio_rb32(pb) - 8;
 infe.type = avio_rl32(pb);
-ret = mov_read_infe(c, pb, infe);
+ret = mov_read_infe(c, pb, infe, i);
 if (ret < 0)
 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".


[FFmpeg-cvslog] avformat/jacosubdec: clarify code

2024-03-25 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Tue 
Oct 10 19:52:33 2023 +0200| [e83e8d443b5b86aabf17d1cfb7fba9abf15e24fd] | 
committer: Michael Niedermayer

avformat/jacosubdec: clarify code

add comments, rename variables and indent things differently

Signed-off-by: Michael Niedermayer 

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

 libavformat/jacosubdec.c | 18 +-
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/libavformat/jacosubdec.c b/libavformat/jacosubdec.c
index 8b0aa312fc..447397b6a7 100644
--- a/libavformat/jacosubdec.c
+++ b/libavformat/jacosubdec.c
@@ -128,28 +128,28 @@ shift_and_ret:
 static int get_shift(unsigned timeres, const char *buf)
 {
 int sign = 1;
-int a = 0, b = 0, c = 0, d = 0;
+int h = 0, m = 0, s = 0, d = 0;
 int64_t ret;
 #define SSEP "%*1[.:]"
-int n = sscanf(buf, "%d"SSEP"%d"SSEP"%d"SSEP"%d", , , , );
+int n = sscanf(buf, "%d"SSEP"%d"SSEP"%d"SSEP"%d", , , , );
 #undef SSEP
 
-if (a == INT_MIN)
+if (h == INT_MIN)
 return 0;
 
-if (*buf == '-' || a < 0) {
+if (*buf == '-' || h < 0) {
 sign = -1;
-a = FFABS(a);
+h = FFABS(h);
 }
 
 ret = 0;
 switch (n) {
-case 1:  a = 0;
-case 2:c = b; b = a; a = 0;
-case 3: d = c; c = b; b = a; a = 0;
+case 1:h = 0;   //clear all in case of a single 
parameter
+case 2: s = m; m = h; h = 0;//shift into second subsecondd
+case 3: d = s; s = m; m = h; h = 0; //shift into minute second 
subsecond
 }
 
-ret = (int64_t)a*3600 + (int64_t)b*60 + c;
+ret = (int64_t)h*3600 + (int64_t)m*60 + s;
 if (FFABS(ret) > (INT64_MAX - FFABS(d)) / timeres)
 return 0;
 ret = sign * (ret * timeres + d);

___
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/concatdec: clip outpoint - inpoint overflow in get_best_effort_duration()

2024-03-25 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Tue 
Dec 26 03:51:23 2023 +0100| [dd733b2be472cea766c62984237533b239e9a93d] | 
committer: Michael Niedermayer

avformat/concatdec: clip outpoint - inpoint overflow in 
get_best_effort_duration()

An alternative would be to limit all time/duration fields to below 64bit

Fixes: signed integer overflow: -9300 - 922337203683900 cannot be 
represented in type 'long long'
Fixes: 
64546/clusterfuzz-testcase-minimized-ffmpeg_dem_CONCAT_fuzzer-5110813828186112

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer 

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

 libavformat/concatdec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/concatdec.c b/libavformat/concatdec.c
index ac541a592f..ca3a0f6369 100644
--- a/libavformat/concatdec.c
+++ b/libavformat/concatdec.c
@@ -323,7 +323,7 @@ static int64_t get_best_effort_duration(ConcatFile *file, 
AVFormatContext *avf)
 if (file->user_duration != AV_NOPTS_VALUE)
 return file->user_duration;
 if (file->outpoint != AV_NOPTS_VALUE)
-return file->outpoint - file->file_inpoint;
+return av_sat_sub64(file->outpoint, file->file_inpoint);
 if (avf->duration > 0)
 return avf->duration - (file->file_inpoint - file->file_start_time);
 if (file->next_dts != AV_NOPTS_VALUE)

___
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/osq: avoid several signed integer overflows

2024-03-25 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Tue 
Dec 26 00:33:02 2023 +0100| [b54c9a9c8f44a9272dc0ee3c9f11ce54cba74008] | 
committer: Michael Niedermayer

avcodec/osq: avoid several signed integer overflows

Fixes: signed integer overflow: 178459578 + 2009763270 cannot be represented in 
type 'int'
Fixes: 
62285/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_OSQ_fuzzer-5013423686287360

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer 

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

 libavcodec/osq.c | 24 
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/libavcodec/osq.c b/libavcodec/osq.c
index f47213bf0c..650cfcd98c 100644
--- a/libavcodec/osq.c
+++ b/libavcodec/osq.c
@@ -221,8 +221,8 @@ static int osq_channel_parameters(AVCodecContext *avctx, 
int ch)
 #define C (-3)
 #define D (-4)
 #define E (-5)
-#define P2 ((dst[A] + dst[A]) - dst[B])
-#define P3 ((dst[A] - dst[B]) * 3 + dst[C])
+#define P2 (((unsigned)dst[A] + dst[A]) - dst[B])
+#define P3 (((unsigned)dst[A] - dst[B]) * 3 + dst[C])
 
 static int do_decode(AVCodecContext *avctx, AVFrame *frame, int decorrelate, 
int downsample)
 {
@@ -272,10 +272,10 @@ static int do_decode(AVCodecContext *avctx, AVFrame 
*frame, int decorrelate, int
 case 0:
 break;
 case 1:
-dst[n] += dst[A];
+dst[n] += (unsigned)dst[A];
 break;
 case 2:
-dst[n] += dst[A] + p;
+dst[n] += (unsigned)dst[A] + p;
 break;
 case 3:
 dst[n] += P2;
@@ -290,28 +290,28 @@ static int do_decode(AVCodecContext *avctx, AVFrame 
*frame, int decorrelate, int
 dst[n] += P3 + p;
 break;
 case 7:
-dst[n] += (P2 + P3) / 2 + p;
+dst[n] += (int)(P2 + P3) / 2 + (unsigned)p;
 break;
 case 8:
-dst[n] += (P2 + P3) / 2;
+dst[n] += (int)(P2 + P3) / 2;
 break;
 case 9:
-dst[n] += (P2 * 2 + P3) / 3 + p;
+dst[n] += (int)(P2 * 2 + P3) / 3 + (unsigned)p;
 break;
 case 10:
-dst[n] += (P2 + P3 * 2) / 3 + p;
+dst[n] += (int)(P2 + P3 * 2) / 3 + (unsigned)p;
 break;
 case 11:
-dst[n] += (dst[A] + dst[B]) / 2;
+dst[n] += (int)((unsigned)dst[A] + dst[B]) / 2;
 break;
 case 12:
-dst[n] += dst[B];
+dst[n] += (unsigned)dst[B];
 break;
 case 13:
-dst[n] += (dst[D] + dst[B]) / 2;
+dst[n] += (int)(unsigned)(dst[D] + dst[B]) / 2;
 break;
 case 14:
-dst[n] += (P2 + dst[A]) / 2 + p;
+dst[n] += (int)((unsigned)P2 + dst[A]) / 2 + (unsigned)p;
 break;
 default:
 return AVERROR_INVALIDDATA;

___
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] lavf/movenc: small cleanup for style

2024-03-25 Thread Jun Zhao
ffmpeg | branch: master | Jun Zhao  | Thu Mar 21 10:31:13 
2024 +0800| [5ebcca4e08bf6063b227a23d8e87e56bba52ff18] | committer: Jun Zhao

lavf/movenc: small cleanup for style

Small cleanup for style, indent, switch case lables.
BTW, the preferred way to ease multiple indentation levels in a
switch statement is to align the switch and its subordinate
case labels in the same column

Signed-off-by: Jun Zhao 

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

 libavformat/movenc.c | 71 ++--
 1 file changed, 35 insertions(+), 36 deletions(-)

diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index ee6734995d..b97c479cc4 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -668,10 +668,10 @@ static int mov_write_enda_tag(AVIOContext *pb)
 
 static int mov_write_enda_tag_be(AVIOContext *pb)
 {
-  avio_wb32(pb, 10);
-  ffio_wfourcc(pb, "enda");
-  avio_wb16(pb, 0); /* big endian */
-  return 10;
+avio_wb32(pb, 10);
+ffio_wfourcc(pb, "enda");
+avio_wb16(pb, 0); /* big endian */
+return 10;
 }
 
 static void put_descr(AVIOContext *pb, int tag, unsigned int size)
@@ -979,9 +979,9 @@ static int mov_write_wave_tag(AVFormatContext *s, 
AVIOContext *pb, MOVTrack *tra
 ffio_wfourcc(pb, "wave");
 
 if (track->par->codec_id != AV_CODEC_ID_QDM2) {
-avio_wb32(pb, 12);/* size */
-ffio_wfourcc(pb, "frma");
-avio_wl32(pb, track->tag);
+avio_wb32(pb, 12);/* size */
+ffio_wfourcc(pb, "frma");
+avio_wl32(pb, track->tag);
 }
 
 if (track->par->codec_id == AV_CODEC_ID_AAC) {
@@ -991,9 +991,9 @@ static int mov_write_wave_tag(AVFormatContext *s, 
AVIOContext *pb, MOVTrack *tra
 avio_wb32(pb, 0);
 mov_write_esds_tag(pb, track);
 } else if (mov_pcm_le_gt16(track->par->codec_id))  {
-  mov_write_enda_tag(pb);
+mov_write_enda_tag(pb);
 } else if (mov_pcm_be_gt16(track->par->codec_id))  {
-  mov_write_enda_tag_be(pb);
+mov_write_enda_tag_be(pb);
 } else if (track->par->codec_id == AV_CODEC_ID_AMR_NB) {
 mov_write_amr_tag(pb, track);
 } else if (track->par->codec_id == AV_CODEC_ID_AC3) {
@@ -1805,11 +1805,11 @@ static const struct {
 
 static int mov_get_dnxhd_codec_tag(AVFormatContext *s, MOVTrack *track)
 {
-  int tag = MKTAG('A','V','d','n');
-  if (track->par->profile != AV_PROFILE_UNKNOWN &&
-  track->par->profile != AV_PROFILE_DNXHD)
-  tag = MKTAG('A','V','d','h');
-  return tag;
+int tag = MKTAG('A','V','d','n');
+if (track->par->profile != AV_PROFILE_UNKNOWN &&
+track->par->profile != AV_PROFILE_DNXHD)
+tag = MKTAG('A','V','d','h');
+return tag;
 }
 
 static int mov_get_rawvideo_codec_tag(AVFormatContext *s, MOVTrack *track)
@@ -2997,18 +2997,18 @@ static int mov_write_gmhd_tag(AVIOContext *pb, MOVTrack 
*track)
  * bytes are copied verbatim.
  */
 if (track->tag != MKTAG('c','6','0','8')) {
-avio_wb32(pb, 0x2C);   /* size */
-ffio_wfourcc(pb, "text");
-avio_wb16(pb, 0x01);
-avio_wb32(pb, 0x00);
-avio_wb32(pb, 0x00);
-avio_wb32(pb, 0x00);
-avio_wb32(pb, 0x01);
-avio_wb32(pb, 0x00);
-avio_wb32(pb, 0x00);
-avio_wb32(pb, 0x00);
-avio_wb32(pb, 0x4000);
-avio_wb16(pb, 0x);
+avio_wb32(pb, 0x2C);   /* size */
+ffio_wfourcc(pb, "text");
+avio_wb16(pb, 0x01);
+avio_wb32(pb, 0x00);
+avio_wb32(pb, 0x00);
+avio_wb32(pb, 0x00);
+avio_wb32(pb, 0x01);
+avio_wb32(pb, 0x00);
+avio_wb32(pb, 0x00);
+avio_wb32(pb, 0x00);
+avio_wb32(pb, 0x4000);
+avio_wb16(pb, 0x);
 }
 
 if (track->par->codec_tag == MKTAG('t','m','c','d')) {
@@ -4853,16 +4853,15 @@ static int mov_write_isml_manifest(AVIOContext *pb, 
MOVMuxContext *mov, AVFormat
 param_write_int(pb, "DisplayHeight", track->par->height);
 } else {
 if (track->par->codec_id == AV_CODEC_ID_AAC) {
-switch (track->par->profile)
-{
-case AV_PROFILE_AAC_HE_V2:
-param_write_string(pb, "FourCC", "AACP");
-break;
-case AV_PROFILE_AAC_HE:
-param_write_string(pb, "FourCC", "AACH");
-break;
-default:
-param_write_string(pb, "FourCC", "AACL");
+switch (track->par->profile) {
+case AV_PROFILE_AAC_HE_V2:
+param_write_string(pb, "FourCC", "AACP");
+break;
+case AV_PROFILE_AAC_HE:
+param_write_string(pb, "FourCC", "AACH");
+break;
+default:
+param_write_string(pb, "FourCC", "AACL");
 }
 } else if (track->par->codec_id == 

[FFmpeg-cvslog] avformat/cafdec: Check that data chunk end fits within 64bit

2024-03-25 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Sat 
Sep 30 00:45:33 2023 +0200| [b792e4d4c772b7b5ef8ea32be187a871000e50c2] | 
committer: Michael Niedermayer

avformat/cafdec: Check that data chunk end fits within 64bit

Fixes: signed integer overflow: 64 + 9223372036854775803 cannot be represented 
in type 'long long'
Fixes: 
51896/clusterfuzz-testcase-minimized-ffmpeg_dem_CAF_fuzzer-6536881135550464
Fixes: 
62276/clusterfuzz-testcase-minimized-ffmpeg_dem_CAF_fuzzer-6536881135550464

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer 

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

 libavformat/cafdec.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/libavformat/cafdec.c b/libavformat/cafdec.c
index 72809fd1de..07a2939a7a 100644
--- a/libavformat/cafdec.c
+++ b/libavformat/cafdec.c
@@ -343,6 +343,9 @@ static int read_header(AVFormatContext *s)
 avio_skip(pb, 4); /* edit count */
 caf->data_start = avio_tell(pb);
 caf->data_size  = size < 0 ? -1 : size - 4;
+if (caf->data_start < 0 || caf->data_size > INT64_MAX - 
caf->data_start)
+return AVERROR_INVALIDDATA;
+
 if (caf->data_size > 0 && (pb->seekable & AVIO_SEEKABLE_NORMAL))
 avio_skip(pb, caf->data_size);
 found_data = 1;

___
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/iff: Saturate avio_tell() + 12

2024-03-25 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Sat 
Sep 30 00:56:06 2023 +0200| [b8e754525ca3d3fd835f7360e11f29b02b39cd62] | 
committer: Michael Niedermayer

avformat/iff: Saturate avio_tell() + 12

Fixes: signed integer overflow: 9223372036854775796 + 12 cannot be represented 
in type 'long long'
Fixes: 
51896/clusterfuzz-testcase-minimized-ffmpeg_dem_IFF_fuzzer-4898373660704768

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer 

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

 libavformat/iff.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavformat/iff.c b/libavformat/iff.c
index 633e0c11fd..0cbe125337 100644
--- a/libavformat/iff.c
+++ b/libavformat/iff.c
@@ -218,7 +218,7 @@ static int parse_dsd_diin(AVFormatContext *s, AVStream *st, 
uint64_t eof)
 {
 AVIOContext *pb = s->pb;
 
-while (avio_tell(pb) + 12 <= eof && !avio_feof(pb)) {
+while (av_sat_add64(avio_tell(pb), 12) <= eof && !avio_feof(pb)) {
 uint32_t tag  = avio_rl32(pb);
 uint64_t size = avio_rb64(pb);
 uint64_t orig_pos = avio_tell(pb);
@@ -255,7 +255,7 @@ static int parse_dsd_prop(AVFormatContext *s, AVStream *st, 
uint64_t eof)
 int dsd_layout[6];
 ID3v2ExtraMeta *id3v2_extra_meta;
 
-while (avio_tell(pb) + 12 <= eof && !avio_feof(pb)) {
+while (av_sat_add64(avio_tell(pb), 12) <= eof && !avio_feof(pb)) {
 uint32_t tag  = avio_rl32(pb);
 uint64_t size = avio_rb64(pb);
 uint64_t orig_pos = avio_tell(pb);

___
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/dxa: Adjust order of operations around block align

2024-03-25 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Sat 
Sep 30 00:51:29 2023 +0200| [50d8e4f27398fd5778485a827d7a2817921f8540] | 
committer: Michael Niedermayer

avformat/dxa: Adjust order of operations around block align

Fixes: 
51896/clusterfuzz-testcase-minimized-ffmpeg_dem_DXA_fuzzer-5730576523198464
Fixes: signed integer overflow: 2147483566 + 82 cannot be represented in type 
'int'

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer 

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

 libavformat/dxa.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/dxa.c b/libavformat/dxa.c
index 58757e8358..813e665a27 100644
--- a/libavformat/dxa.c
+++ b/libavformat/dxa.c
@@ -123,7 +123,7 @@ static int dxa_read_header(AVFormatContext *s)
 if(ast->codecpar->block_align) {
 if (c->bpc > INT_MAX - ast->codecpar->block_align + 1)
 return AVERROR_INVALIDDATA;
-c->bpc = ((c->bpc + ast->codecpar->block_align - 1) / 
ast->codecpar->block_align) * ast->codecpar->block_align;
+c->bpc = ((c->bpc - 1 + ast->codecpar->block_align) / 
ast->codecpar->block_align) * ast->codecpar->block_align;
 }
 c->bytes_left = fsize;
 c->wavpos = avio_tell(pb);

___
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/cafdec: dont seek beyond 64bit

2024-03-25 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Sat 
Sep 30 00:38:17 2023 +0200| [d973fcbcc2f944752ff10e6a76b0b2d9329937a7] | 
committer: Michael Niedermayer

avformat/cafdec: dont seek beyond 64bit

Fixes: signed integer overflow: 64 + 9223372036854775807 cannot be represented 
in type 'long long'
Fixes: 
51896/clusterfuzz-testcase-minimized-ffmpeg_dem_CAF_fuzzer-6418242730328064
Fixes: 
62276/clusterfuzz-testcase-minimized-ffmpeg_dem_CAF_fuzzer-6418242730328064

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer 

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

 libavformat/cafdec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/cafdec.c b/libavformat/cafdec.c
index 426c56b9bd..72809fd1de 100644
--- a/libavformat/cafdec.c
+++ b/libavformat/cafdec.c
@@ -271,7 +271,7 @@ static int read_pakt_chunk(AVFormatContext *s, int64_t size)
 }
 }
 
-if (avio_tell(pb) - ccount > size) {
+if (avio_tell(pb) - ccount > size || size > INT64_MAX - ccount) {
 av_log(s, AV_LOG_ERROR, "error reading packet table\n");
 return AVERROR_INVALIDDATA;
 }

___
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/avidec: support huge durations

2024-03-25 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Sat 
Sep 30 00:27:14 2023 +0200| [d384af52261ff01ee35c05d46303d617de5305bb] | 
committer: Michael Niedermayer

avformat/avidec: support huge durations

Fixes: signed integer overflow: 109817402400 * 301990077 cannot be represented 
in type 'long long'
Fixes: 
51896/clusterfuzz-testcase-minimized-ffmpeg_dem_AVI_fuzzer-6706191715139584
Fixes: 
62276/clusterfuzz-testcase-minimized-ffmpeg_dem_AVI_fuzzer-6706191715139584

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer 

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

 libavformat/avidec.c | 14 ++
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/libavformat/avidec.c b/libavformat/avidec.c
index 985a9bf022..bfa5c02a20 100644
--- a/libavformat/avidec.c
+++ b/libavformat/avidec.c
@@ -27,6 +27,7 @@
 #include "libavutil/avstring.h"
 #include "libavutil/opt.h"
 #include "libavutil/dict.h"
+#include "libavutil/integer.h"
 #include "libavutil/internal.h"
 #include "libavutil/intreadwrite.h"
 #include "libavutil/mathematics.h"
@@ -476,7 +477,7 @@ static int calculate_bitrate(AVFormatContext *s)
 AVStream *st = s->streams[i];
 FFStream *const sti = ffstream(st);
 int64_t duration;
-int64_t bitrate;
+AVInteger bitrate_i, den_i, num_i;
 
 for (j = 0; j < sti->nb_index_entries; j++)
 len += sti->index_entries[j].size;
@@ -484,9 +485,14 @@ static int calculate_bitrate(AVFormatContext *s)
 if (sti->nb_index_entries < 2 || st->codecpar->bit_rate > 0)
 continue;
 duration = sti->index_entries[j-1].timestamp - 
sti->index_entries[0].timestamp;
-bitrate = av_rescale(8*len, st->time_base.den, duration * 
st->time_base.num);
-if (bitrate > 0) {
-st->codecpar->bit_rate = bitrate;
+den_i = av_mul_i(av_int2i(duration), av_int2i(st->time_base.num));
+num_i = av_add_i(av_mul_i(av_int2i(8*len), 
av_int2i(st->time_base.den)), av_shr_i(den_i, 1));
+bitrate_i = av_div_i(num_i, den_i);
+if (av_cmp_i(bitrate_i, av_int2i(INT64_MAX)) <= 0) {
+int64_t bitrate = av_i2int(bitrate_i);
+if (bitrate > 0) {
+st->codecpar->bit_rate = bitrate;
+}
 }
 }
 return 1;

___
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/get_buffer: Add a warning on failed allocation from a fixed pool

2024-03-25 Thread Mark Thompson
ffmpeg | branch: master | Mark Thompson  | Sun Mar 17 20:51:29 
2024 +| [4743c9e87a629d6af53b508c6a36135590622c16] | committer: Mark 
Thompson

lavc/get_buffer: Add a warning on failed allocation from a fixed pool

For hardware cases where we are forced to have a fixed pool of frames
allocated up-front (such as array textures on decoder output), suggest
a possible workaround to the user if an allocation fails because the
pool is exhausted.

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

 libavcodec/get_buffer.c | 16 
 libavcodec/internal.h   |  6 ++
 2 files changed, 22 insertions(+)

diff --git a/libavcodec/get_buffer.c b/libavcodec/get_buffer.c
index 46c20781af..9b35fde7c6 100644
--- a/libavcodec/get_buffer.c
+++ b/libavcodec/get_buffer.c
@@ -257,6 +257,22 @@ int avcodec_default_get_buffer2(AVCodecContext *avctx, 
AVFrame *frame, int flags
 
 if (avctx->hw_frames_ctx) {
 ret = av_hwframe_get_buffer(avctx->hw_frames_ctx, frame, 0);
+if (ret == AVERROR(ENOMEM)) {
+AVHWFramesContext *frames_ctx =
+(AVHWFramesContext*)avctx->hw_frames_ctx->data;
+if (frames_ctx->initial_pool_size > 0 &&
+!avctx->internal->warned_on_failed_allocation_from_fixed_pool) 
{
+av_log(avctx, AV_LOG_WARNING, "Failed to allocate a %s/%s "
+   "frame from a fixed pool of hardware frames.\n",
+   av_get_pix_fmt_name(frames_ctx->format),
+   av_get_pix_fmt_name(frames_ctx->sw_format));
+av_log(avctx, AV_LOG_WARNING, "Consider setting "
+   "extra_hw_frames to a larger value "
+   "(currently set to %d, giving a pool size of %d).\n",
+   avctx->extra_hw_frames, frames_ctx->initial_pool_size);
+avctx->internal->warned_on_failed_allocation_from_fixed_pool = 
1;
+}
+}
 frame->width  = avctx->coded_width;
 frame->height = avctx->coded_height;
 return ret;
diff --git a/libavcodec/internal.h b/libavcodec/internal.h
index 04f7cebdcb..64fe0122c8 100644
--- a/libavcodec/internal.h
+++ b/libavcodec/internal.h
@@ -144,6 +144,12 @@ typedef struct AVCodecInternal {
 #if CONFIG_LCMS2
 FFIccContext icc; /* used to read and write embedded ICC profiles */
 #endif
+
+/**
+ * Set when the user has been warned about a failed allocation from
+ * a fixed frame pool.
+ */
+int warned_on_failed_allocation_from_fixed_pool;
 } AVCodecInternal;
 
 /**

___
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/id3v2: read_uslt() check for the amount read

2024-03-25 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Wed 
Mar 20 03:51:05 2024 +0100| [c0f4abe2aa0117a10fb651f2c1c030d4cd516081] | 
committer: Michael Niedermayer

avformat/id3v2: read_uslt() check for the amount read

Fixes: timeout
Fixes: 
66783/clusterfuzz-testcase-minimized-ffmpeg_dem_GENH_fuzzer-5356884892647424

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer 

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

 libavformat/id3v2.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/id3v2.c b/libavformat/id3v2.c
index d83716dcf4..e0a7e3f3ea 100644
--- a/libavformat/id3v2.c
+++ b/libavformat/id3v2.c
@@ -370,7 +370,7 @@ static void read_uslt(AVFormatContext *s, AVIOContext *pb, 
int taglen,
 int encoding;
 int ok = 0;
 
-if (taglen < 1)
+if (taglen < 4)
 goto error;
 
 encoding = avio_r8(pb);

___
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] tools/target_dec_fuzzer: Adjust RKA threshold up further

2024-03-25 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Wed 
Mar 20 03:39:01 2024 +0100| [b7cdaff7e23d547657ca9139dfae41e124e087b6] | 
committer: Michael Niedermayer

tools/target_dec_fuzzer: Adjust RKA threshold up further

Fixes: timeout
Fixes: 
66636/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_RKA_fuzzer-5030913165557760

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer 

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

 tools/target_dec_fuzzer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/target_dec_fuzzer.c b/tools/target_dec_fuzzer.c
index 57ba24a308..8d19988999 100644
--- a/tools/target_dec_fuzzer.c
+++ b/tools/target_dec_fuzzer.c
@@ -274,7 +274,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t 
size) {
 case AV_CODEC_ID_PAF_VIDEO:   maxpixels  /= 16;break;
 case AV_CODEC_ID_PRORES:  maxpixels  /= 256;   break;
 case AV_CODEC_ID_QPEG:maxpixels  /= 256;   break;
-case AV_CODEC_ID_RKA: maxsamples /= 65536; break;
+case AV_CODEC_ID_RKA: maxsamples /= 1<<20; break;
 case AV_CODEC_ID_RSCC:maxpixels  /= 256;   break;
 case AV_CODEC_ID_RASC:maxpixels  /= 16;break;
 case AV_CODEC_ID_RTV1:maxpixels  /= 16;break;

___
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/vmixdec: Check shift before use

2024-03-25 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Wed 
Mar 20 03:30:56 2024 +0100| [70b26b693e9e06bcd9fe83ee5063ee40e32ce02f] | 
committer: Michael Niedermayer

avcodec/vmixdec: Check shift before use

Fixes: shift exponent 32 is too large for 32-bit type 'unsigned int'
Fixes: 
65909/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VMIX_fuzzer-519459745831321

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer 

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

 libavcodec/vmixdec.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/libavcodec/vmixdec.c b/libavcodec/vmixdec.c
index d6b6e3557f..ab283d13db 100644
--- a/libavcodec/vmixdec.c
+++ b/libavcodec/vmixdec.c
@@ -235,6 +235,9 @@ static int decode_frame(AVCodecContext *avctx,
 else if (offset != 3)
 return AVERROR_INVALIDDATA;
 
+if (s->lshift > 31)
+return AVERROR_INVALIDDATA;
+
 q = quality[FFMIN(avpkt->data[offset - 2], FF_ARRAY_ELEMS(quality)-1)];
 for (int n = 0; n < 64; n++)
 s->factors[n] = quant[n] * q;

___
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: Check sample_count and auxiliary_info_default_size to be 0

2024-03-25 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Wed 
Mar 20 02:06:34 2024 +0100| [3c43299e9e642e73b31be7ac7c49700949946e13] | 
committer: Michael Niedermayer

avformat/mov: Check sample_count and auxiliary_info_default_size to be 0

This combination causes 0 size arrays to be allocated and to leak later

Fixes: memleak
Fixes: 
64342/clusterfuzz-testcase-minimized-ffmpeg_dem_MOV_fuzzer-4520993686945792

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer 

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

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

diff --git a/libavformat/mov.c b/libavformat/mov.c
index 8d1135270c..f954b924a0 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -6994,6 +6994,9 @@ static int mov_read_saiz(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
 sample_count = avio_rb32(pb);
 
 if (encryption_index->auxiliary_info_default_size == 0) {
+if (sample_count == 0)
+return AVERROR_INVALIDDATA;
+
 encryption_index->auxiliary_info_sizes = av_malloc(sample_count);
 if (!encryption_index->auxiliary_info_sizes)
 return AVERROR(ENOMEM);

___
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/wady: Check >0 samplerate and channels 1 || 2.

2024-03-25 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Tue 
Mar 19 23:24:11 2024 +0100| [6f9e90ab0bede36cc960a099e8f19998345e7164] | 
committer: Michael Niedermayer

avformat/wady: Check >0 samplerate and channels 1 || 2.

The WADY decoder only supports mono and stereo

This fixes a probetest failure

Signed-off-by: Michael Niedermayer 

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

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

diff --git a/libavformat/wady.c b/libavformat/wady.c
index 6dcc0018f3..81a64c6d3f 100644
--- a/libavformat/wady.c
+++ b/libavformat/wady.c
@@ -32,7 +32,8 @@ static int wady_probe(const AVProbeData *p)
 return 0;
 if (p->buf[4] != 0 || p->buf[5] == 0 ||
 AV_RL16(p->buf+6) == 0 ||
-AV_RL32(p->buf+8) == 0)
+AV_RL16(p->buf+6) > 2 ||
+(int32_t)AV_RL32(p->buf+8) <= 0)
 return 0;
 
 return AVPROBE_SCORE_MAX / 3 * 2;

___
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] avutil/timestamp: introduce av_ts_make_time_string2 for better precision

2024-03-25 Thread Marton Balint
ffmpeg | branch: master | Marton Balint  | Sun Mar 17 23:35:24 
2024 +0100| [5df901ffa56e0ff225fcc129c751befeb3b4d0d0] | committer: Marton 
Balint

avutil/timestamp: introduce av_ts_make_time_string2 for better precision

av_ts_make_time_string() used "%.6g" format, but this format was losing
precision even when the timestamp to be printed was not that large. For example
for 3 hours (10800) seconds, only 1 decimal digit was printed, which made this
format inaccurate when it was used in e.g. the silencedetect filter. Other
detection filters printing timestamps had similar issues. Also time base
parameter of the function was *AVRational instead of AVRational.

Resolve these problems by introducing a new function, av_ts_make_time_string2().

We change the used format to "%.*f", use a precision of 6, except when printing
values near 0, in which case we calculate the precision dynamically to aim for
a similar precision in normal form as with %.6g.  No longer using scientific
representation can make parsing the timestamp easier for the users, we can
safely do this because the theoretical maximum of INT64_MAX*INT32_MAX still
fits into the string buffer in normal form.

We somewhat imitate %g by trimming ending zeroes and the potential decimal
point characters. In order not to trim "inf" as well, we assume that the
decimal point string does not contain the letter "f". Note that depending on
printf %f implementation, we might trim "infinity" to "inf".

Thanks for Allan Cady for bringing up this issue.

Signed-off-by: Marton Balint 

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

 doc/APIchanges|  5 +
 libavutil/Makefile|  1 +
 libavutil/timestamp.c | 36 
 libavutil/timestamp.h |  8 
 libavutil/version.h   |  2 +-
 5 files changed, 51 insertions(+), 1 deletion(-)

diff --git a/doc/APIchanges b/doc/APIchanges
index 7762907255..38fbfcca20 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -2,6 +2,11 @@ The last version increases of all libraries were on 2024-03-07
 
 API changes, most recent first:
 
+2024-03-xx - xx - lavu 59.7.100 - timestamp.h
+  Add av_ts_make_time_string2() for better timestamp precision, the new
+  function accepts AVRational as time base instead of *AVRational, and is not
+  an inline function like its predecessor.
+
 2024-03-xx - xx - lavu 59.6.100 - film_grain_params.h
   Add av_film_grain_params_select().
 
diff --git a/libavutil/Makefile b/libavutil/Makefile
index 008fcfcd9c..6e6fa8d800 100644
--- a/libavutil/Makefile
+++ b/libavutil/Makefile
@@ -174,6 +174,7 @@ OBJS = adler32.o
\
threadmessage.o  \
time.o   \
timecode.o   \
+   timestamp.o  \
tree.o   \
twofish.o\
utils.o  \
diff --git a/libavutil/timestamp.c b/libavutil/timestamp.c
new file mode 100644
index 00..2a3e3012a4
--- /dev/null
+++ b/libavutil/timestamp.c
@@ -0,0 +1,36 @@
+/*
+ * 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 "timestamp.h"
+
+char *av_ts_make_time_string2(char *buf, int64_t ts, AVRational tb)
+{
+if (ts == AV_NOPTS_VALUE) {
+snprintf(buf, AV_TS_MAX_STRING_SIZE, "NOPTS");
+} else {
+double val = av_q2d(tb) * ts;
+double log = floor(log10(fabs(val)));
+int precision = (isfinite(log) && log < 0) ? -log + 5 : 6;
+int last = snprintf(buf, AV_TS_MAX_STRING_SIZE, "%.*f", precision, 
val);
+last = FFMIN(last, AV_TS_MAX_STRING_SIZE - 1) - 1;
+for (; last && buf[last] == '0'; last--);
+for (; last && buf[last] != 'f' && (buf[last] < '0' || buf[0] > '9'); 
last--);
+buf[last + 1] = '\0';
+}
+return buf;
+}
diff --git a/libavutil/timestamp.h b/libavutil/timestamp.h
index 2b37781eba..7e6da894df 

[FFmpeg-cvslog] avutil/timestamp: change precision of av_ts_make_time_string()

2024-03-25 Thread Marton Balint
ffmpeg | branch: master | Marton Balint  | Sat Mar 23 03:12:16 
2024 +0100| [8c936e9b437aaed0ca10f3ec2edebf06cad6a5b5] | committer: Marton 
Balint

avutil/timestamp: change precision of av_ts_make_time_string()

By calling the av_ts_make_time_string2() from the function we can fix the
precision issue.

Signed-off-by: Marton Balint 

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

 libavutil/timestamp.h|  4 +---
 tests/ref/fate/filter-metadata-scdet | 12 ++--
 tests/ref/fate/filter-metadata-silencedetect |  2 +-
 3 files changed, 8 insertions(+), 10 deletions(-)

diff --git a/libavutil/timestamp.h b/libavutil/timestamp.h
index 7e6da894df..fa53a46b98 100644
--- a/libavutil/timestamp.h
+++ b/libavutil/timestamp.h
@@ -73,9 +73,7 @@ char *av_ts_make_time_string2(char *buf, int64_t ts, 
AVRational tb);
 static inline char *av_ts_make_time_string(char *buf, int64_t ts,
const AVRational *tb)
 {
-if (ts == AV_NOPTS_VALUE) snprintf(buf, AV_TS_MAX_STRING_SIZE, "NOPTS");
-else  snprintf(buf, AV_TS_MAX_STRING_SIZE, "%.6g", 
av_q2d(*tb) * ts);
-return buf;
+return av_ts_make_time_string2(buf, ts, *tb);
 }
 
 /**
diff --git a/tests/ref/fate/filter-metadata-scdet 
b/tests/ref/fate/filter-metadata-scdet
index ca5dbaaefc..d385920fcd 100644
--- a/tests/ref/fate/filter-metadata-scdet
+++ b/tests/ref/fate/filter-metadata-scdet
@@ -1,11 +1,11 @@
 
pts=1620|tag:lavfi.scd.score=59.252|tag:lavfi.scd.mafd=60.175|tag:lavfi.scd.time=2.7
 
pts=4140|tag:lavfi.scd.score=36.070|tag:lavfi.scd.mafd=44.209|tag:lavfi.scd.time=6.9
-pts=5800|tag:lavfi.scd.score=55.819|tag:lavfi.scd.mafd=55.819|tag:lavfi.scd.time=9.7
+pts=5800|tag:lavfi.scd.score=55.819|tag:lavfi.scd.mafd=55.819|tag:lavfi.scd.time=9.67
 
pts=6720|tag:lavfi.scd.score=18.580|tag:lavfi.scd.mafd=22.505|tag:lavfi.scd.time=11.2
 
pts=8160|tag:lavfi.scd.score=49.240|tag:lavfi.scd.mafd=49.444|tag:lavfi.scd.time=13.6
-pts=9760|tag:lavfi.scd.score=51.497|tag:lavfi.scd.mafd=51.801|tag:lavfi.scd.time=16.2667
-pts=14080|tag:lavfi.scd.score=34.165|tag:lavfi.scd.mafd=34.337|tag:lavfi.scd.time=23.4667
-pts=15700|tag:lavfi.scd.score=58.310|tag:lavfi.scd.mafd=58.315|tag:lavfi.scd.time=26.1667
-pts=18500|tag:lavfi.scd.score=16.504|tag:lavfi.scd.mafd=19.603|tag:lavfi.scd.time=30.8333
+pts=9760|tag:lavfi.scd.score=51.497|tag:lavfi.scd.mafd=51.801|tag:lavfi.scd.time=16.27
+pts=14080|tag:lavfi.scd.score=34.165|tag:lavfi.scd.mafd=34.337|tag:lavfi.scd.time=23.47
+pts=15700|tag:lavfi.scd.score=58.310|tag:lavfi.scd.mafd=58.315|tag:lavfi.scd.time=26.17
+pts=18500|tag:lavfi.scd.score=16.504|tag:lavfi.scd.mafd=19.603|tag:lavfi.scd.time=30.83
 
pts=20040|tag:lavfi.scd.score=13.764|tag:lavfi.scd.mafd=19.060|tag:lavfi.scd.time=33.4
-pts=21760|tag:lavfi.scd.score=64.451|tag:lavfi.scd.mafd=64.551|tag:lavfi.scd.time=36.2667
+pts=21760|tag:lavfi.scd.score=64.451|tag:lavfi.scd.mafd=64.551|tag:lavfi.scd.time=36.27
diff --git a/tests/ref/fate/filter-metadata-silencedetect 
b/tests/ref/fate/filter-metadata-silencedetect
index bc53fea047..e66ffe5fdd 100644
--- a/tests/ref/fate/filter-metadata-silencedetect
+++ b/tests/ref/fate/filter-metadata-silencedetect
@@ -1,5 +1,5 @@
 
pts=0|tag:lavfi.silence_duration=0.523107|tag:lavfi.silence_end=0.690023|tag:lavfi.silence_start=0.736417
-pts=46080|tag:lavfi.silence_start=1.27626|tag:lavfi.silence_end=1.80751|tag:lavfi.silence_duration=0.531247
+pts=46080|tag:lavfi.silence_start=1.276259|tag:lavfi.silence_end=1.807506|tag:lavfi.silence_duration=0.531247
 pts=92160
 pts=138240
 pts=184320

___
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] avutil/timestamp: change precision of av_ts_make_time_string()

2024-03-25 Thread Marton Balint
ffmpeg | branch: master | Marton Balint  | Sat Mar 23 03:12:16 
2024 +0100| [4be4b20a4feb33dc54356feedd85baf8ace4ddd5] | committer: Marton 
Balint

avutil/timestamp: change precision of av_ts_make_time_string()

By calling the av_ts_make_time_string2() from the function we can fix the
precision issue.

Signed-off-by: Marton Balint 

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

 libavutil/timestamp.h|  4 +---
 tests/ref/fate/filter-metadata-scdet | 12 ++--
 tests/ref/fate/filter-metadata-silencedetect |  2 +-
 3 files changed, 8 insertions(+), 10 deletions(-)

diff --git a/libavutil/timestamp.h b/libavutil/timestamp.h
index 7e6da894df..fa53a46b98 100644
--- a/libavutil/timestamp.h
+++ b/libavutil/timestamp.h
@@ -73,9 +73,7 @@ char *av_ts_make_time_string2(char *buf, int64_t ts, 
AVRational tb);
 static inline char *av_ts_make_time_string(char *buf, int64_t ts,
const AVRational *tb)
 {
-if (ts == AV_NOPTS_VALUE) snprintf(buf, AV_TS_MAX_STRING_SIZE, "NOPTS");
-else  snprintf(buf, AV_TS_MAX_STRING_SIZE, "%.6g", 
av_q2d(*tb) * ts);
-return buf;
+return av_ts_make_time_string2(buf, ts, *tb);
 }
 
 /**
diff --git a/tests/ref/fate/filter-metadata-scdet 
b/tests/ref/fate/filter-metadata-scdet
index ca5dbaaefc..d385920fcd 100644
--- a/tests/ref/fate/filter-metadata-scdet
+++ b/tests/ref/fate/filter-metadata-scdet
@@ -1,11 +1,11 @@
 
pts=1620|tag:lavfi.scd.score=59.252|tag:lavfi.scd.mafd=60.175|tag:lavfi.scd.time=2.7
 
pts=4140|tag:lavfi.scd.score=36.070|tag:lavfi.scd.mafd=44.209|tag:lavfi.scd.time=6.9
-pts=5800|tag:lavfi.scd.score=55.819|tag:lavfi.scd.mafd=55.819|tag:lavfi.scd.time=9.7
+pts=5800|tag:lavfi.scd.score=55.819|tag:lavfi.scd.mafd=55.819|tag:lavfi.scd.time=9.67
 
pts=6720|tag:lavfi.scd.score=18.580|tag:lavfi.scd.mafd=22.505|tag:lavfi.scd.time=11.2
 
pts=8160|tag:lavfi.scd.score=49.240|tag:lavfi.scd.mafd=49.444|tag:lavfi.scd.time=13.6
-pts=9760|tag:lavfi.scd.score=51.497|tag:lavfi.scd.mafd=51.801|tag:lavfi.scd.time=16.2667
-pts=14080|tag:lavfi.scd.score=34.165|tag:lavfi.scd.mafd=34.337|tag:lavfi.scd.time=23.4667
-pts=15700|tag:lavfi.scd.score=58.310|tag:lavfi.scd.mafd=58.315|tag:lavfi.scd.time=26.1667
-pts=18500|tag:lavfi.scd.score=16.504|tag:lavfi.scd.mafd=19.603|tag:lavfi.scd.time=30.8333
+pts=9760|tag:lavfi.scd.score=51.497|tag:lavfi.scd.mafd=51.801|tag:lavfi.scd.time=16.27
+pts=14080|tag:lavfi.scd.score=34.165|tag:lavfi.scd.mafd=34.337|tag:lavfi.scd.time=23.47
+pts=15700|tag:lavfi.scd.score=58.310|tag:lavfi.scd.mafd=58.315|tag:lavfi.scd.time=26.17
+pts=18500|tag:lavfi.scd.score=16.504|tag:lavfi.scd.mafd=19.603|tag:lavfi.scd.time=30.83
 
pts=20040|tag:lavfi.scd.score=13.764|tag:lavfi.scd.mafd=19.060|tag:lavfi.scd.time=33.4
-pts=21760|tag:lavfi.scd.score=64.451|tag:lavfi.scd.mafd=64.551|tag:lavfi.scd.time=36.2667
+pts=21760|tag:lavfi.scd.score=64.451|tag:lavfi.scd.mafd=64.551|tag:lavfi.scd.time=36.27
diff --git a/tests/ref/fate/filter-metadata-silencedetect 
b/tests/ref/fate/filter-metadata-silencedetect
index bc53fea047..e66ffe5fdd 100644
--- a/tests/ref/fate/filter-metadata-silencedetect
+++ b/tests/ref/fate/filter-metadata-silencedetect
@@ -1,5 +1,5 @@
 
pts=0|tag:lavfi.silence_duration=0.523107|tag:lavfi.silence_end=0.690023|tag:lavfi.silence_start=0.736417
-pts=46080|tag:lavfi.silence_start=1.27626|tag:lavfi.silence_end=1.80751|tag:lavfi.silence_duration=0.531247
+pts=46080|tag:lavfi.silence_start=1.276259|tag:lavfi.silence_end=1.807506|tag:lavfi.silence_duration=0.531247
 pts=92160
 pts=138240
 pts=184320

___
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] avutil/timestamp: introduce av_ts_make_time_string2 for better precision

2024-03-25 Thread Marton Balint
ffmpeg | branch: master | Marton Balint  | Sun Mar 17 23:35:24 
2024 +0100| [ac8fefdbc418b4e71e6af9b5f0aab4dbc9e9311f] | committer: Marton 
Balint

avutil/timestamp: introduce av_ts_make_time_string2 for better precision

av_ts_make_time_string() used "%.6g" format, but this format was losing
precision even when the timestamp to be printed was not that large. For example
for 3 hours (10800) seconds, only 1 decimal digit was printed, which made this
format inaccurate when it was used in e.g. the silencedetect filter. Other
detection filters printing timestamps had similar issues. Also time base
parameter of the function was *AVRational instead of AVRational.

Resolve these problems by introducing a new function, av_ts_make_time_string2().

We change the used format to "%.*f", use a precision of 6, except when printing
values near 0, in which case we calculate the precision dynamically to aim for
a similar precision in normal form as with %.6g.  No longer using scientific
representation can make parsing the timestamp easier for the users, we can
safely do this because the theoretical maximum of INT64_MAX*INT32_MAX still
fits into the string buffer in normal form.

We somewhat imitate %g by trimming ending zeroes and the potential decimal
point characters. In order not to trim "inf" as well, we assume that the
decimal point string does not contain the letter "f". Note that depending on
printf %f implementation, we might trim "infinity" to "inf".

Thanks for Allan Cady for bringing up this issue.

Signed-off-by: Marton Balint 

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

 doc/APIchanges|  5 +
 libavutil/Makefile|  1 +
 libavutil/timestamp.c | 36 
 libavutil/timestamp.h |  8 
 libavutil/version.h   |  2 +-
 5 files changed, 51 insertions(+), 1 deletion(-)

diff --git a/doc/APIchanges b/doc/APIchanges
index 7762907255..38fbfcca20 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -2,6 +2,11 @@ The last version increases of all libraries were on 2024-03-07
 
 API changes, most recent first:
 
+2024-03-xx - xx - lavu 59.7.100 - timestamp.h
+  Add av_ts_make_time_string2() for better timestamp precision, the new
+  function accepts AVRational as time base instead of *AVRational, and is not
+  an inline function like its predecessor.
+
 2024-03-xx - xx - lavu 59.6.100 - film_grain_params.h
   Add av_film_grain_params_select().
 
diff --git a/libavutil/Makefile b/libavutil/Makefile
index 008fcfcd9c..6e6fa8d800 100644
--- a/libavutil/Makefile
+++ b/libavutil/Makefile
@@ -174,6 +174,7 @@ OBJS = adler32.o
\
threadmessage.o  \
time.o   \
timecode.o   \
+   timestamp.o  \
tree.o   \
twofish.o\
utils.o  \
diff --git a/libavutil/timestamp.c b/libavutil/timestamp.c
new file mode 100644
index 00..2a3e3012a4
--- /dev/null
+++ b/libavutil/timestamp.c
@@ -0,0 +1,36 @@
+/*
+ * 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 "timestamp.h"
+
+char *av_ts_make_time_string2(char *buf, int64_t ts, AVRational tb)
+{
+if (ts == AV_NOPTS_VALUE) {
+snprintf(buf, AV_TS_MAX_STRING_SIZE, "NOPTS");
+} else {
+double val = av_q2d(tb) * ts;
+double log = floor(log10(fabs(val)));
+int precision = (isfinite(log) && log < 0) ? -log + 5 : 6;
+int last = snprintf(buf, AV_TS_MAX_STRING_SIZE, "%.*f", precision, 
val);
+last = FFMIN(last, AV_TS_MAX_STRING_SIZE - 1) - 1;
+for (; last && buf[last] == '0'; last--);
+for (; last && buf[last] != 'f' && (buf[last] < '0' || buf[0] > '9'); 
last--);
+buf[last + 1] = '\0';
+}
+return buf;
+}
diff --git a/libavutil/timestamp.h b/libavutil/timestamp.h
index 2b37781eba..7e6da894df 

[FFmpeg-cvslog] avcodec/x86/h264_idct: Fix incorrect xmm spilling on win64

2024-03-25 Thread Henrik Gramner
ffmpeg | branch: master | Henrik Gramner  | Sun Mar 24 
20:04:17 2024 +0100| [7c003b63c85aadf57ca10be849bd9895a4eeeb87] | committer: 
Henrik Gramner

avcodec/x86/h264_idct: Fix incorrect xmm spilling on win64

Broken in afa471d0efed1df5dca6eeeb2fcdd211ae4cad4e. It just happened
to work before due to x86inc.asm previously performing XMM spills in
INIT_MMX mode which was more of a bug than an intentional feature.

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

 libavcodec/x86/h264_idct.asm | 12 +++-
 1 file changed, 3 insertions(+), 9 deletions(-)

diff --git a/libavcodec/x86/h264_idct.asm b/libavcodec/x86/h264_idct.asm
index b29ddde200..d9c3c9c862 100644
--- a/libavcodec/x86/h264_idct.asm
+++ b/libavcodec/x86/h264_idct.asm
@@ -716,11 +716,9 @@ RET
 %endif
 %endmacro
 
-%macro IDCT_DC_DEQUANT 1
-cglobal h264_luma_dc_dequant_idct, 3, 4, %1
-; manually spill XMM registers for Win64 because
-; the code here is initialized with INIT_MMX
-WIN64_SPILL_XMM %1
+INIT_XMM sse2
+cglobal h264_luma_dc_dequant_idct, 3, 4, 7
+INIT_MMX cpuname
 movqm3, [r1+24]
 movqm2, [r1+16]
 movqm1, [r1+ 8]
@@ -757,10 +755,6 @@ cglobal h264_luma_dc_dequant_idct, 3, 4, %1
 movd  xmm6, t1d
 DEQUANT_STORE xmm6
 RET
-%endmacro
-
-INIT_MMX sse2
-IDCT_DC_DEQUANT 7
 
 %ifdef __NASM_VER__
 %if __NASM_MAJOR__ >= 2 && __NASM_MINOR__ >= 4

___
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_chan: Use anonymous enum

2024-03-25 Thread Andreas Rheinhardt
ffmpeg | branch: master | Andreas Rheinhardt  | 
Mon Mar 25 15:50:54 2024 +0100| [316239096b15ed193056aada1555e84cce402b3a] | 
committer: Andreas Rheinhardt

avformat/mov_chan: Use anonymous enum

Fixes many -Wenum-conversion warnings with Clang caused by
e6c2c8703732bc46395c65c530038c8146df0deb.
See e.g.
https://fate.ffmpeg.org/log.cgi?time=20240325033545=aarch64-linux-clang-10=compile

Reviewed-by: Henrik Gramner 
Reviewed-by: James Almer 
Signed-off-by: Andreas Rheinhardt 

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

 libavformat/mov_chan.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/mov_chan.c b/libavformat/mov_chan.c
index d5225acddf..287059d65b 100644
--- a/libavformat/mov_chan.c
+++ b/libavformat/mov_chan.c
@@ -30,7 +30,7 @@
 #include "libavcodec/codec_id.h"
 #include "mov_chan.h"
 
-enum ShortChannelName {
+enum {
 c_L  = AV_CHAN_FRONT_LEFT,
 c_R  = AV_CHAN_FRONT_RIGHT,
 c_C  = AV_CHAN_FRONT_CENTER,

___
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] fate/source: Fix FATE reference file

2024-03-25 Thread Andreas Rheinhardt
ffmpeg | branch: master | Andreas Rheinhardt  | 
Mon Mar 25 15:17:17 2024 +0100| [a8255aa357fd8944ddc1393b12247201b6ecb5fe] | 
committer: Andreas Rheinhardt

fate/source: Fix FATE reference file

Forgotten in ecdc94b97f809d5f2b88640842fd0541951ad295.

Signed-off-by: Andreas Rheinhardt 

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

 tests/ref/fate/source | 2 --
 1 file changed, 2 deletions(-)

diff --git a/tests/ref/fate/source b/tests/ref/fate/source
index 8bb58b61f1..7b5f14b4f0 100644
--- a/tests/ref/fate/source
+++ b/tests/ref/fate/source
@@ -23,8 +23,6 @@ compat/djgpp/math.h
 compat/float/float.h
 compat/float/limits.h
 libavcodec/bitstream_template.h
-libavcodec/vulkan_video_codec_av1std_decode_mesa.h
-libavcodec/vulkan_video_codec_av1std_mesa.h
 tools/decode_simple.h
 Use of av_clip() where av_clip_uintp2() could be used:
 Use of av_clip() where av_clip_intp2() could be used:

___
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] avutil/channel_layout: don't clear the opaque pointer on type conversion

2024-03-25 Thread James Almer
ffmpeg | branch: master | James Almer  | Fri Mar 22 13:00:46 
2024 -0300| [65a04cae6ff89e8543e83e83533760b9c1b57b68] | committer: James Almer

avutil/channel_layout: don't clear the opaque pointer on type conversion

Otherwise it would not be lossless.

Signed-off-by: James Almer 

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

 libavutil/channel_layout.c | 8 
 1 file changed, 8 insertions(+)

diff --git a/libavutil/channel_layout.c b/libavutil/channel_layout.c
index a83618bcc7..3054ee08a5 100644
--- a/libavutil/channel_layout.c
+++ b/libavutil/channel_layout.c
@@ -902,9 +902,11 @@ int av_channel_layout_retype(AVChannelLayout 
*channel_layout, enum AVChannelOrde
 lossy = 1;
 }
 if (!lossy || allow_lossy) {
+void *opaque = channel_layout->opaque;
 av_channel_layout_uninit(channel_layout);
 channel_layout->order   = AV_CHANNEL_ORDER_UNSPEC;
 channel_layout->nb_channels = nb_channels;
+channel_layout->opaque  = opaque;
 return lossy;
 }
 return AVERROR(ENOSYS);
@@ -916,8 +918,10 @@ int av_channel_layout_retype(AVChannelLayout 
*channel_layout, enum AVChannelOrde
 return AVERROR(ENOSYS);
 lossy = has_channel_names(channel_layout);
 if (!lossy || allow_lossy) {
+void *opaque = channel_layout->opaque;
 av_channel_layout_uninit(channel_layout);
 av_channel_layout_from_mask(channel_layout, mask);
+channel_layout->opaque = opaque;
 return lossy;
 }
 }
@@ -925,6 +929,7 @@ int av_channel_layout_retype(AVChannelLayout 
*channel_layout, enum AVChannelOrde
 case AV_CHANNEL_ORDER_CUSTOM: {
 AVChannelLayout custom = { 0 };
 int ret = av_channel_layout_custom_init(, 
channel_layout->nb_channels);
+void *opaque = channel_layout->opaque;
 if (ret < 0)
 return ret;
 if (channel_layout->order != AV_CHANNEL_ORDER_UNSPEC)
@@ -932,6 +937,7 @@ int av_channel_layout_retype(AVChannelLayout 
*channel_layout, enum AVChannelOrde
 custom.u.map[i].id = 
av_channel_layout_channel_from_index(channel_layout, i);
 av_channel_layout_uninit(channel_layout);
 *channel_layout = custom;
+channel_layout->opaque = opaque;
 return 0;
 }
 case AV_CHANNEL_ORDER_AMBISONIC:
@@ -946,10 +952,12 @@ int av_channel_layout_retype(AVChannelLayout 
*channel_layout, enum AVChannelOrde
 return AVERROR(ENOSYS);
 lossy = has_channel_names(channel_layout);
 if (!lossy || allow_lossy) {
+void *opaque = channel_layout->opaque;
 av_channel_layout_uninit(channel_layout);
 channel_layout->order   = AV_CHANNEL_ORDER_AMBISONIC;
 channel_layout->nb_channels = nb_channels;
 channel_layout->u.mask  = mask;
+channel_layout->opaque  = opaque;
 return lossy;
 }
 }

___
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] avutil/hwcontext_qsv: Fix mixed declaration and code

2024-03-25 Thread Andreas Rheinhardt
ffmpeg | branch: master | Andreas Rheinhardt  | 
Sun Mar 24 21:29:44 2024 +0100| [1f1b773859a6f1491b1fa9f310a97ee038755263] | 
committer: Andreas Rheinhardt

avutil/hwcontext_qsv: Fix mixed declaration and code

Reviewed-by: Xiang, Haihao 
Signed-off-by: Andreas Rheinhardt 

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

 libavutil/hwcontext_qsv.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavutil/hwcontext_qsv.c b/libavutil/hwcontext_qsv.c
index e5e043d2d1..c7c7878644 100644
--- a/libavutil/hwcontext_qsv.c
+++ b/libavutil/hwcontext_qsv.c
@@ -1121,7 +1121,8 @@ fail:
 static int qsv_init_internal_session(AVHWFramesContext *ctx,
  mfxSession *session, int upload)
 {
-AVQSVFramesContext *frames_hwctx = ctx->hwctx;
+QSVFramesContext  *s = ctx->hwctx;
+AVQSVFramesContext *frames_hwctx = >p;
 QSVDeviceContext   *device_priv  = ctx->device_ctx->hwctx;
 AVQSVDeviceContext *hwctx= _priv->p;
 int opaque = 0;
@@ -1153,7 +1154,6 @@ static int qsv_init_internal_session(AVHWFramesContext 
*ctx,
 }
 
 #if QSV_HAVE_OPAQUE
-QSVFramesContext  *s = ctx->hwctx;
 opaque = !!(frames_hwctx->frame_type & MFX_MEMTYPE_OPAQUE_FRAME);
 #endif
 

___
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] vulkan_av1: port to the new stable API

2024-03-25 Thread Lynne
ffmpeg | branch: master | Lynne  | Fri Jan 19 10:49:02 2024 
+1000| [ecdc94b97f809d5f2b88640842fd0541951ad295] | committer: Lynne

vulkan_av1: port to the new stable API

Co-Authored-by: Dave Airlie 

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

 configure  |   4 +-
 libavcodec/Makefile|   5 +-
 libavcodec/vulkan_av1.c| 514 -
 libavcodec/vulkan_decode.c |  31 +-
 libavcodec/vulkan_decode.h |   2 +-
 libavcodec/vulkan_video.h  |   2 -
 libavcodec/vulkan_video_codec_av1std_decode_mesa.h |  36 --
 libavcodec/vulkan_video_codec_av1std_mesa.h| 403 
 libavutil/hwcontext_vulkan.c   |   2 +-
 libavutil/vulkan_functions.h   |   2 +-
 libavutil/vulkan_loader.h  |   2 +-
 11 files changed, 306 insertions(+), 697 deletions(-)

diff --git a/configure b/configure
index e853deb51d..9fa639fca6 100755
--- a/configure
+++ b/configure
@@ -7300,8 +7300,8 @@ enabled vdpau &&
 check_lib vdpau_x11 "vdpau/vdpau.h vdpau/vdpau_x11.h" 
vdp_device_create_x11 -lvdpau -lX11
 
 if enabled vulkan; then
-check_pkg_config_header_only vulkan "vulkan >= 1.3.255" "vulkan/vulkan.h" 
"defined VK_VERSION_1_3" ||
-check_cpp_condition vulkan "vulkan/vulkan.h" "defined(VK_VERSION_1_4) 
|| (defined(VK_VERSION_1_3) && VK_HEADER_VERSION >= 255)"
+check_pkg_config_header_only vulkan "vulkan >= 1.3.277" "vulkan/vulkan.h" 
"defined VK_VERSION_1_3" ||
+check_cpp_condition vulkan "vulkan/vulkan.h" "defined(VK_VERSION_1_4) 
|| (defined(VK_VERSION_1_3) && VK_HEADER_VERSION >= 277)"
 fi
 
 if disabled vulkan; then
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 7ef2e03ca6..9ce6d445c1 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -1258,8 +1258,7 @@ SKIPHEADERS+= %_tablegen.h
  \
   aacenc_quantization.h \
   aacenc_quantization_misc.h\
   bitstream_template.h  \
-  vulkan_video_codec_av1std_mesa.h \
-  $(ARCH)/vpx_arith.h  \
+  $(ARCH)/vpx_arith.h   \
 
 SKIPHEADERS-$(CONFIG_AMF)  += amfenc.h
 SKIPHEADERS-$(CONFIG_D3D11VA)  += d3d11va.h dxva2_internal.h
@@ -1280,7 +1279,7 @@ SKIPHEADERS-$(CONFIG_QSVENC)   += qsvenc.h
 SKIPHEADERS-$(CONFIG_VAAPI)+= vaapi_decode.h vaapi_hevc.h 
vaapi_encode.h
 SKIPHEADERS-$(CONFIG_VDPAU)+= vdpau.h vdpau_internal.h
 SKIPHEADERS-$(CONFIG_VIDEOTOOLBOX) += videotoolbox.h vt_internal.h
-SKIPHEADERS-$(CONFIG_VULKAN)   += vulkan.h vulkan_video.h 
vulkan_decode.h vulkan_video_codec_av1std_decode_mesa.h
+SKIPHEADERS-$(CONFIG_VULKAN)   += vulkan.h vulkan_video.h 
vulkan_decode.h
 SKIPHEADERS-$(CONFIG_V4L2_M2M) += v4l2_buffers.h v4l2_context.h 
v4l2_m2m.h
 SKIPHEADERS-$(CONFIG_ZLIB) += zlib_wrapper.h
 
diff --git a/libavcodec/vulkan_av1.c b/libavcodec/vulkan_av1.c
index 5afd5353cc..c9e398eaec 100644
--- a/libavcodec/vulkan_av1.c
+++ b/libavcodec/vulkan_av1.c
@@ -26,7 +26,7 @@
 const FFVulkanDecodeDescriptor ff_vk_dec_av1_desc = {
 .codec_id = AV_CODEC_ID_AV1,
 .decode_extension = FF_VK_EXT_VIDEO_DECODE_AV1,
-.decode_op= 0x0100, /* TODO fix this */
+.decode_op= VK_VIDEO_CODEC_OPERATION_DECODE_AV1_BIT_KHR,
 .ext_props = {
 .extensionName = VK_STD_VULKAN_VIDEO_CODEC_AV1_DECODE_EXTENSION_NAME,
 .specVersion   = VK_STD_VULKAN_VIDEO_CODEC_AV1_DECODE_SPEC_VERSION,
@@ -36,33 +36,47 @@ const FFVulkanDecodeDescriptor ff_vk_dec_av1_desc = {
 typedef struct AV1VulkanDecodePicture {
 FFVulkanDecodePicture   vp;
 
-/* Workaround for a spec issue.
- *Can be removed once no longer needed, and threading can be enabled. */
+/* TODO: investigate if this can be removed to make decoding completely
+ * independent. */
 FFVulkanDecodeContext  *dec;
 
-StdVideoAV1MESATiletiles[MAX_TILES];
-StdVideoAV1MESATileListtile_list;
-const uint32_t*tile_offsets;
+uint32_t tile_sizes[MAX_TILES];
 
 /* Current picture */
-VkVideoDecodeAV1DpbSlotInfoMESAvkav1_ref;
-StdVideoAV1MESAFrameHeader av1_frame_header;
-VkVideoDecodeAV1PictureInfoMESAav1_pic_info;
+StdVideoDecodeAV1ReferenceInfo std_ref;
+VkVideoDecodeAV1DpbSlotInfoKHR vkav1_ref;
+uint16_t width_in_sbs_minus1[64];
+uint16_t height_in_sbs_minus1[64];
+uint16_t mi_col_starts[64];
+uint16_t mi_row_starts[64];
+ 

[FFmpeg-cvslog] av1dec: add AV1_REF_FRAME_NONE

2024-03-25 Thread Lynne
ffmpeg | branch: master | Lynne  | Sun Mar 17 19:31:17 2024 
+0100| [998aa66a10546be207d5dfc1a4a76bc2ce9ea07c] | committer: Lynne

av1dec: add AV1_REF_FRAME_NONE

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

 libavcodec/av1.h |  1 +
 libavcodec/cbs_av1_syntax_template.c | 12 ++--
 2 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/libavcodec/av1.h b/libavcodec/av1.h
index 8704bc41c1..94e88f8484 100644
--- a/libavcodec/av1.h
+++ b/libavcodec/av1.h
@@ -58,6 +58,7 @@ enum {
 
 // Reference frames (section 6.10.24).
 enum {
+AV1_REF_FRAME_NONE= -1,
 AV1_REF_FRAME_INTRA   = 0,
 AV1_REF_FRAME_LAST= 1,
 AV1_REF_FRAME_LAST2   = 2,
diff --git a/libavcodec/cbs_av1_syntax_template.c 
b/libavcodec/cbs_av1_syntax_template.c
index 2979c5d98f..3f4b13a177 100644
--- a/libavcodec/cbs_av1_syntax_template.c
+++ b/libavcodec/cbs_av1_syntax_template.c
@@ -360,7 +360,7 @@ static int FUNC(set_frame_refs)(CodedBitstreamContext *ctx, 
RWContext *rw,
 int i, j;
 
 for (i = 0; i < AV1_REFS_PER_FRAME; i++)
-ref_frame_idx[i] = -1;
+ref_frame_idx[i] = AV1_REF_FRAME_NONE;
 ref_frame_idx[AV1_REF_FRAME_LAST - AV1_REF_FRAME_LAST] = 
current->last_frame_idx;
 ref_frame_idx[AV1_REF_FRAME_GOLDEN - AV1_REF_FRAME_LAST] = 
current->golden_frame_idx;
 
@@ -378,7 +378,7 @@ static int FUNC(set_frame_refs)(CodedBitstreamContext *ctx, 
RWContext *rw,
 latest_order_hint = shifted_order_hints[current->last_frame_idx];
 earliest_order_hint = shifted_order_hints[current->golden_frame_idx];
 
-ref = -1;
+ref = AV1_REF_FRAME_NONE;
 for (i = 0; i < AV1_NUM_REF_FRAMES; i++) {
 int hint = shifted_order_hints[i];
 if (!used_frame[i] && hint >= cur_frame_hint &&
@@ -392,7 +392,7 @@ static int FUNC(set_frame_refs)(CodedBitstreamContext *ctx, 
RWContext *rw,
 used_frame[ref] = 1;
 }
 
-ref = -1;
+ref = AV1_REF_FRAME_NONE;
 for (i = 0; i < AV1_NUM_REF_FRAMES; i++) {
 int hint = shifted_order_hints[i];
 if (!used_frame[i] && hint >= cur_frame_hint &&
@@ -406,7 +406,7 @@ static int FUNC(set_frame_refs)(CodedBitstreamContext *ctx, 
RWContext *rw,
 used_frame[ref] = 1;
 }
 
-ref = -1;
+ref = AV1_REF_FRAME_NONE;
 for (i = 0; i < AV1_NUM_REF_FRAMES; i++) {
 int hint = shifted_order_hints[i];
 if (!used_frame[i] && hint >= cur_frame_hint &&
@@ -423,7 +423,7 @@ static int FUNC(set_frame_refs)(CodedBitstreamContext *ctx, 
RWContext *rw,
 for (i = 0; i < AV1_REFS_PER_FRAME - 2; i++) {
 int ref_frame = ref_frame_list[i];
 if (ref_frame_idx[ref_frame - AV1_REF_FRAME_LAST] < 0 ) {
-ref = -1;
+ref = AV1_REF_FRAME_NONE;
 for (j = 0; j < AV1_NUM_REF_FRAMES; j++) {
 int hint = shifted_order_hints[j];
 if (!used_frame[j] && hint < cur_frame_hint &&
@@ -439,7 +439,7 @@ static int FUNC(set_frame_refs)(CodedBitstreamContext *ctx, 
RWContext *rw,
 }
 }
 
-ref = -1;
+ref = AV1_REF_FRAME_NONE;
 for (i = 0; i < AV1_NUM_REF_FRAMES; i++) {
 int hint = shifted_order_hints[i];
 if (ref < 0 || hint < earliest_order_hint) {

___
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/cbs_av1: Save more frame ordering information

2024-03-25 Thread Mark Thompson
ffmpeg | branch: master | Mark Thompson  | Wed Mar 20 20:35:28 
2024 +| [cafb4c554845332eeb33284cf6498049997dc67e] | committer: Lynne

lavc/cbs_av1: Save more frame ordering information

This is wanted by the Vulkan decoder.

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

 libavcodec/cbs_av1.h |  5 +
 libavcodec/cbs_av1_syntax_template.c | 25 +
 2 files changed, 26 insertions(+), 4 deletions(-)

diff --git a/libavcodec/cbs_av1.h b/libavcodec/cbs_av1.h
index a5402f069d..a027013bc7 100644
--- a/libavcodec/cbs_av1.h
+++ b/libavcodec/cbs_av1.h
@@ -427,6 +427,8 @@ typedef struct AV1ReferenceFrameState {
 int bit_depth;  // RefBitDepth
 int order_hint; // RefOrderHint
 
+int saved_order_hints[AV1_TOTAL_REFS_PER_FRAME]; // SavedOrderHints[ref]
+
 int8_t  loop_filter_ref_deltas[AV1_TOTAL_REFS_PER_FRAME];
 int8_t  loop_filter_mode_deltas[2];
 uint8_t feature_enabled[AV1_MAX_SEGMENTS][AV1_SEG_LVL_MAX];
@@ -464,6 +466,9 @@ typedef struct CodedBitstreamAV1Context {
 int tile_rows;
 int tile_num;
 
+int order_hints[AV1_TOTAL_REFS_PER_FRAME]; // OrderHints
+int ref_frame_sign_bias[AV1_TOTAL_REFS_PER_FRAME]; // RefFrameSignBias
+
 AV1ReferenceFrameState ref[AV1_NUM_REF_FRAMES];
 
 // AVOptions
diff --git a/libavcodec/cbs_av1_syntax_template.c 
b/libavcodec/cbs_av1_syntax_template.c
index 3be1f2d30f..2979c5d98f 100644
--- a/libavcodec/cbs_av1_syntax_template.c
+++ b/libavcodec/cbs_av1_syntax_template.c
@@ -1414,6 +1414,8 @@ static int 
FUNC(uncompressed_header)(CodedBitstreamContext *ctx, RWContext *rw,
 priv->ref[i].valid = 0;
 priv->ref[i].order_hint = 0;
 }
+for (i = 0; i < AV1_REFS_PER_FRAME; i++)
+priv->order_hints[i + AV1_REF_FRAME_LAST] = 0;
 }
 
 flag(disable_cdf_update);
@@ -1568,11 +1570,20 @@ static int 
FUNC(uncompressed_header)(CodedBitstreamContext *ctx, RWContext *rw,
 else
 flag(use_ref_frame_mvs);
 
-infer(allow_intrabc, 0);
-}
+for (i = 0; i < AV1_REFS_PER_FRAME; i++) {
+int ref_frame = AV1_REF_FRAME_LAST + i;
+int hint = priv->ref[current->ref_frame_idx[i]].order_hint;
+priv->order_hints[ref_frame] = hint;
+if (!seq->enable_order_hint) {
+priv->ref_frame_sign_bias[ref_frame] = 0;
+} else {
+priv->ref_frame_sign_bias[ref_frame] =
+cbs_av1_get_relative_dist(seq, hint,
+  current->order_hint) > 0;
+}
+}
 
-if (!frame_is_intra) {
-// Derive reference frame sign biases.
+infer(allow_intrabc, 0);
 }
 
 if (seq->reduced_still_picture_header || current->disable_cdf_update)
@@ -1674,6 +1685,12 @@ update_refs:
 .bit_depth  = priv->bit_depth,
 .order_hint = priv->order_hint,
 };
+
+for (int j = 0; j < AV1_REFS_PER_FRAME; j++) {
+priv->ref[i].saved_order_hints[j + AV1_REF_FRAME_LAST] =
+priv->order_hints[j + AV1_REF_FRAME_LAST];
+}
+
 memcpy(priv->ref[i].loop_filter_ref_deltas, 
current->loop_filter_ref_deltas,
sizeof(current->loop_filter_ref_deltas));
 memcpy(priv->ref[i].loop_filter_mode_deltas, 
current->loop_filter_mode_deltas,

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