[FFmpeg-devel] [PATCH 3/6] avcodec/ffwavesynth: use uint32_t to compute difference, it is enough
Fixes: signed integer overflow: 6494225984479297536 - -6043795377581187040 cannot be represented in type 'long' Fixes: 15285/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FFWAVESYNTH_fuzzer-5632780307791872 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavcodec/ffwavesynth.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/ffwavesynth.c b/libavcodec/ffwavesynth.c index b2cc7c8fc1..793eada7a5 100644 --- a/libavcodec/ffwavesynth.c +++ b/libavcodec/ffwavesynth.c @@ -215,7 +215,7 @@ static void wavesynth_seek(struct wavesynth_context *ws, int64_t ts) ws->next_inter = i; ws->next_ts = i < ws->nb_inter ? ws->inter[i].ts_start : INF_TS; *last = -1; -lcg_seek(>dither_state, ts - ws->cur_ts); +lcg_seek(>dither_state, (uint32_t)ts - ws->cur_ts); if (ws->pink_need) { int64_t pink_ts_cur = (ws->cur_ts + PINK_UNIT - 1) & ~(PINK_UNIT - 1); int64_t pink_ts_next = ts & ~(PINK_UNIT - 1); -- 2.22.0 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 2/6] avcodec/ffwavesynth: Simplify lcg_seek(), avoid negative case
Fixes: negation of -9223372036854775808 cannot be represented in type 'int64_t' (aka 'long'); cast to an unsigned type to negate this value to itself Fixes: 15289/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FFWAVESYNTH_fuzzer-5709034499342336 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavcodec/ffwavesynth.c | 12 +++- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/libavcodec/ffwavesynth.c b/libavcodec/ffwavesynth.c index cf8c780f3e..b2cc7c8fc1 100644 --- a/libavcodec/ffwavesynth.c +++ b/libavcodec/ffwavesynth.c @@ -113,18 +113,12 @@ static uint32_t lcg_next(uint32_t *s) return *s; } -static void lcg_seek(uint32_t *s, int64_t dt) +static void lcg_seek(uint32_t *s, uint32_t dt) { uint32_t a, c, t = *s; -if (dt >= 0) { -a = LCG_A; -c = LCG_C; -} else { /* coefficients for a step backward */ -a = LCG_AI; -c = (uint32_t)(-LCG_AI * LCG_C); -dt = -dt; -} +a = LCG_A; +c = LCG_C; while (dt) { if (dt & 1) t = a * t + c; -- 2.22.0 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 6/6] avcodec/flicvideo: More strictly check chunk size for FLI_COPY
Fixes: Timeout (40sec -> 13sec) Fixes: 15417/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FLIC_fuzzer-5679812615602176 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavcodec/flicvideo.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/flicvideo.c b/libavcodec/flicvideo.c index 2474a9ca72..209df591cf 100644 --- a/libavcodec/flicvideo.c +++ b/libavcodec/flicvideo.c @@ -729,9 +729,9 @@ static int flic_decode_frame_15_16BPP(AVCodecContext *avctx, case FLI_COPY: case FLI_DTA_COPY: /* copy the chunk (uncompressed frame) */ -if (chunk_size - 6 > (unsigned int)(FFALIGN(s->avctx->width, 2) * s->avctx->height)*2) { +if (chunk_size - 6 != (unsigned int)(FFALIGN(s->avctx->width, 2) * s->avctx->height)*2) { av_log(avctx, AV_LOG_ERROR, "In chunk FLI_COPY : source data (%d bytes) " \ - "bigger than image, skipping chunk\n", chunk_size - 6); + "different than image, skipping chunk\n", chunk_size - 6); bytestream2_skip(, chunk_size - 6); } else { -- 2.22.0 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 5/6] avcodec/flicvideo: Fix off by 1 error in flic_decode_frame_24BPP()
Fixes: out of array access Fixes: 15360/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FLIC_fuzzer-5653837190266880 Fixes: 15412/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FLIC_fuzzer-5740537648250880 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavcodec/flicvideo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/flicvideo.c b/libavcodec/flicvideo.c index cd9cd089af..2474a9ca72 100644 --- a/libavcodec/flicvideo.c +++ b/libavcodec/flicvideo.c @@ -900,7 +900,7 @@ static int flic_decode_frame_24BPP(AVCodecContext *avctx, } else { if (bytestream2_tell() + 2*byte_run > stream_ptr_after_chunk) break; -CHECK_PIXEL_PTR(2 * byte_run); +CHECK_PIXEL_PTR(3 * byte_run); for (j = 0; j < byte_run; j++, pixel_countdown--) { pixel = bytestream2_get_le24(); AV_WL24([pixel_ptr], pixel); -- 2.22.0 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 1/6] avcodec/ffwavesynth: Fix backward lcg_seek()
Signed-off-by: Michael Niedermayer --- libavcodec/ffwavesynth.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/ffwavesynth.c b/libavcodec/ffwavesynth.c index a66113972b..cf8c780f3e 100644 --- a/libavcodec/ffwavesynth.c +++ b/libavcodec/ffwavesynth.c @@ -122,7 +122,7 @@ static void lcg_seek(uint32_t *s, int64_t dt) c = LCG_C; } else { /* coefficients for a step backward */ a = LCG_AI; -c = (uint32_t)(LCG_AI * LCG_C); +c = (uint32_t)(-LCG_AI * LCG_C); dt = -dt; } while (dt) { -- 2.22.0 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 4/6] avcodec/flicvideo: Make line_packets int
Fixes: signed integer overflow: -32768 * 196032 cannot be represented in type 'int' Fixes: 15300/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FLIC_fuzzer-5733319519502336 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavcodec/flicvideo.c | 14 +++--- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/libavcodec/flicvideo.c b/libavcodec/flicvideo.c index ba5bda48c4..cd9cd089af 100644 --- a/libavcodec/flicvideo.c +++ b/libavcodec/flicvideo.c @@ -175,7 +175,7 @@ static int flic_decode_frame_8BPP(AVCodecContext *avctx, int lines; int compressed_lines; int starting_line; -signed short line_packets; +int line_packets; int y_ptr; int byte_run; int pixel_skip; @@ -274,7 +274,7 @@ static int flic_decode_frame_8BPP(AVCodecContext *avctx, break; if (y_ptr > pixel_limit) return AVERROR_INVALIDDATA; -line_packets = bytestream2_get_le16(); +line_packets = (int16_t)bytestream2_get_le16(); if ((line_packets & 0xC000) == 0xC000) { // line skip opcode line_packets = -line_packets; @@ -340,7 +340,7 @@ static int flic_decode_frame_8BPP(AVCodecContext *avctx, pixel_countdown = s->avctx->width; if (bytestream2_tell() + 1 > stream_ptr_after_chunk) break; -line_packets = bytestream2_get_byte(); +line_packets = (int16_t)bytestream2_get_byte(); if (line_packets > 0) { for (i = 0; i < line_packets; i++) { /* account for the skip bytes */ @@ -508,7 +508,7 @@ static int flic_decode_frame_15_16BPP(AVCodecContext *avctx, int lines; int compressed_lines; -signed short line_packets; +int line_packets; int y_ptr; int byte_run; int pixel_skip; @@ -572,7 +572,7 @@ static int flic_decode_frame_15_16BPP(AVCodecContext *avctx, break; if (y_ptr > pixel_limit) return AVERROR_INVALIDDATA; -line_packets = bytestream2_get_le16(); +line_packets = (int16_t)bytestream2_get_le16(); if (line_packets < 0) { line_packets = -line_packets; if (line_packets > s->avctx->height) @@ -806,7 +806,7 @@ static int flic_decode_frame_24BPP(AVCodecContext *avctx, int lines; int compressed_lines; -signed short line_packets; +int line_packets; int y_ptr; int byte_run; int pixel_skip; @@ -870,7 +870,7 @@ static int flic_decode_frame_24BPP(AVCodecContext *avctx, break; if (y_ptr > pixel_limit) return AVERROR_INVALIDDATA; -line_packets = bytestream2_get_le16(); +line_packets = (int16_t)bytestream2_get_le16(); if (line_packets < 0) { line_packets = -line_packets; if (line_packets > s->avctx->height) -- 2.22.0 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH v4] vf_drawtext: Add pkt_pos, pkt_duration, pkt_size as variables
> Am 21.06.2019 um 14:53 schrieb Nicolas George : > > greg Luce (12019-06-21): >> I had them in a single patch before but split them as requested here >> http://ffmpeg.org/pipermail/ffmpeg-devel/2019-June/245613.html >> Is there something I'm missing that allows me to split the patch but >> have the code and doc in the same patch? > > Asking you to split was, I think, a mistake: a new feature and its > documentation belong in the same commit, even if they were written by > different persons. These were two different and independent patches written by two different persons. Carl Eugen ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH] libavformat/mux: Fix audio_preload
Commit 31f9032b added the audio_preload feature; its goal is to interleave audio earlier than the rest. Unfortunately, it has never ever worked, because the check for whether a packet should be interleaved before or after another packet was completely wrong: When audio_preload vanishes, interleave_compare_dts returns 1 if the new packet should be interleaved earlier than the packet it is compared with and that is what the rest of the code expects. But the codepath used when audio_preload is set does the opposite. Signed-off-by: Andreas Rheinhardt --- libavformat/mux.c | 7 +++ libavformat/version.h | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/libavformat/mux.c b/libavformat/mux.c index 83fe1de78f..e954c0326b 100644 --- a/libavformat/mux.c +++ b/libavformat/mux.c @@ -1005,11 +1005,10 @@ static int interleave_compare_dts(AVFormatContext *s, AVPacket *next, int64_t ts = av_rescale_q(pkt ->dts, st ->time_base, AV_TIME_BASE_Q) - s->audio_preload*(st ->codecpar->codec_type == AVMEDIA_TYPE_AUDIO); int64_t ts2= av_rescale_q(next->dts, st2->time_base, AV_TIME_BASE_Q) - s->audio_preload*(st2->codecpar->codec_type == AVMEDIA_TYPE_AUDIO); if (ts == ts2) { -ts= ( pkt ->dts* st->time_base.num*AV_TIME_BASE - s->audio_preload*(int64_t)(st ->codecpar->codec_type == AVMEDIA_TYPE_AUDIO)* st->time_base.den)*st2->time_base.den - -( next->dts*st2->time_base.num*AV_TIME_BASE - s->audio_preload*(int64_t)(st2->codecpar->codec_type == AVMEDIA_TYPE_AUDIO)*st2->time_base.den)* st->time_base.den; -ts2=0; +ts = (pkt ->dts* st->time_base.num*AV_TIME_BASE - s->audio_preload*(int64_t)(st ->codecpar->codec_type == AVMEDIA_TYPE_AUDIO)* st->time_base.den)*st2->time_base.den; +ts2 = (next->dts*st2->time_base.num*AV_TIME_BASE - s->audio_preload*(int64_t)(st2->codecpar->codec_type == AVMEDIA_TYPE_AUDIO)*st2->time_base.den)* st->time_base.den; } -comp= (ts>ts2) - (ts ts) - (ts2 < ts); } if (comp == 0) diff --git a/libavformat/version.h b/libavformat/version.h index 52dd95f5c6..39b00f62ab 100644 --- a/libavformat/version.h +++ b/libavformat/version.h @@ -33,7 +33,7 @@ // Also please add any ticket numbers that you believe might be affected here #define LIBAVFORMAT_VERSION_MAJOR 58 #define LIBAVFORMAT_VERSION_MINOR 28 -#define LIBAVFORMAT_VERSION_MICRO 100 +#define LIBAVFORMAT_VERSION_MICRO 101 #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \ LIBAVFORMAT_VERSION_MINOR, \ -- 2.21.0 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 3/3] avformat/vividas: reduce keybits to require half the space
On Sat, Jun 08, 2019 at 08:23:22AM +0200, Reimar Döffinger wrote: > > > On 07.06.2019, at 23:56, Michael Niedermayer wrote: > > > Signed-off-by: Michael Niedermayer > > --- > > libavformat/vividas.c | 12 ++-- > > 1 file changed, 6 insertions(+), 6 deletions(-) > > > > diff --git a/libavformat/vividas.c b/libavformat/vividas.c > > index 5e303b9c52..72f2093d13 100644 > > --- a/libavformat/vividas.c > > +++ b/libavformat/vividas.c > > @@ -78,11 +78,11 @@ static int viv_probe(const AVProbeData *p) > > return AVPROBE_SCORE_MAX; > > } > > > > -static const unsigned short keybits[32] = { > > - 163, 416, 893, 82, 223, 572, 1137, 430, > > - 659, 1104, 13, 626, 695, 972, 1465, 686, > > - 843, 1216, 317, 1122, 1383, 92, 513, 1158, > > -1243, 48, 573, 1306, 1495, 396, 1009, 350, > > +static const uint8_t keybits[32] = { > > + 20, 52, 111, 10, 27, 71, 142, 53, > > + 82, 138, 1, 78, 86, 121, 183, 85, > > +105, 152, 39, 140, 172, 11, 64, 144, > > +155, 6, 71, 163, 186, 49, 126, 43, > > }; > > > > static uint32_t decode_key(uint8_t *buf) > > @@ -91,7 +91,7 @@ static uint32_t decode_key(uint8_t *buf) > > > > for (int i = 0; i < 32; i++) { > > unsigned p = keybits[i]; > > -key |= (unsigned)!!(buf[p>>3] & (1<<(p&7))) << i; > > +key |= (unsigned)!!(buf[p] & (1<<((i*5+3)&7))) << i; > > If you are changing it anyway, maybe this should just be > (((buf[p] >> ((i*5+3)&7)) & 1u) << i; > ? > Though I feel like there's a few parenthesis too many and maybe > an intermediate variable would be best... will apply patchset with this change thx [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Dictatorship: All citizens are under surveillance, all their steps and actions recorded, for the politicians to enforce control. Democracy: All politicians are under surveillance, all their steps and actions recorded, for the citizens to enforce control. signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH v3] ffprobe: Fix memory leak
On 6/21/2019 11:41 AM, Derek Buitenhuis wrote: > This packet was not necessarily unreferenced. > > Signed-off-by: Derek Buitenhuis > --- > fftools/ffprobe.c | 4 +--- > 1 file changed, 1 insertion(+), 3 deletions(-) > > diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c > index 3becb6330e..5aaddb0308 100644 > --- a/fftools/ffprobe.c > +++ b/fftools/ffprobe.c > @@ -2429,9 +2429,7 @@ static int read_interval_packets(WriterContext *w, > InputFile *ifile, > } > av_packet_unref(); > } > -av_init_packet(); > -pkt.data = NULL; > -pkt.size = 0; > +av_packet_unref(); > //Flush remaining frames that are cached in the decoder > for (i = 0; i < fmt_ctx->nb_streams; i++) { > pkt.stream_index = i; LGTM. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 3/4] avformat/wsddec: Fix undefined shift
On Sat, Jun 08, 2019 at 06:11:02PM +0200, Reimar Döffinger wrote: > > > On 08.06.2019, at 11:28, Michael Niedermayer wrote: > > > Fixes: left shift of 1 by 31 places cannot be represented in type 'int' > > Fixes: > > 15123/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5738039235575808 > > > > Found-by: continuous fuzzing process > > https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg > > Signed-off-by: Michael Niedermayer > > --- > > libavformat/wsddec.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/libavformat/wsddec.c b/libavformat/wsddec.c > > index dfa8014b1c..43660d4cea 100644 > > --- a/libavformat/wsddec.c > > +++ b/libavformat/wsddec.c > > @@ -137,7 +137,7 @@ static int wsd_read_header(AVFormatContext *s) > > if (!(channel_assign & 1)) { > > int i; > > for (i = 1; i < 32; i++) > > -if (channel_assign & (1 << i)) > > +if (channel_assign & (1U << i)) > > I'd be in favour of switching these kind of checks to > (a>>i)&1 > as this is a much less risky idiom and IMO it would be best to spread that > style... will push patchset with this change thanks [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB The educated differ from the uneducated as much as the living from the dead. -- Aristotle signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH v2] ffprobe: Fix memory leak
On 6/21/2019 11:39 AM, Derek Buitenhuis wrote: > On 21/06/2019 15:26, James Almer wrote: >> Remove the three lines below as well before pushing. They are >> superfluous as av_packet_unref() does the same internally. > > OK. > > The documentation for av_packet_unref says it sets the 'remaining' > fields to default values, but av_init_packet says it sets the > 'optional' fields to default values. Not clear if they mean > the same thing. Looking at the source, it's clear, but I prefer > not to do that, since it encourages relying on undocumented > behavior. > > - Derek The doxy says "Unreference the buffer referenced by the packet and reset the remaining packet fields to their default values", which means it unrefs the AVBufferRef, and then sets the remaining fields in the packet to default values, effectively wiping the whole struct. av_init_packet() does indeed change only a subset of fields, as stated by the doxy, which is why the data and size fields are set to NULL/0 in this function right after it, as those are not touched by it. Since you want to wipe the packet, calling av_packet_unref() on it does a thorough job. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH] avcodec/fmvc: Check if header fields are available before allocating the image
On Mon, Jun 03, 2019 at 10:55:20AM +0200, Paul B Mahol wrote: > On 6/2/19, Michael Niedermayer wrote: > > Fixes: Timeout (15sec -> 0.5sec) > > Fixes: > > 14846/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FMVC_fuzzer-5068322120400896 > > > > Found-by: continuous fuzzing process > > https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg > > Signed-off-by: Michael Niedermayer > > OK will apply thx [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Democracy is the form of government in which you can choose your dictator signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v3] ffprobe: Fix memory leak
This packet was not necessarily unreferenced. Signed-off-by: Derek Buitenhuis --- fftools/ffprobe.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c index 3becb6330e..5aaddb0308 100644 --- a/fftools/ffprobe.c +++ b/fftools/ffprobe.c @@ -2429,9 +2429,7 @@ static int read_interval_packets(WriterContext *w, InputFile *ifile, } av_packet_unref(); } -av_init_packet(); -pkt.data = NULL; -pkt.size = 0; +av_packet_unref(); //Flush remaining frames that are cached in the decoder for (i = 0; i < fmt_ctx->nb_streams; i++) { pkt.stream_index = i; -- 2.20.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH] avcodec/wcmv: check remaining space vs. blocks
On Sun, Jun 02, 2019 at 01:25:32AM +0200, Michael Niedermayer wrote: > Fixes: Timeout (18sec -> 7sec) > Fixes: > 14835/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WCMV_fuzzer-5646714897170432 > > Found-by: continuous fuzzing process > https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg > Signed-off-by: Michael Niedermayer > --- > libavcodec/wcmv.c | 3 +++ > 1 file changed, 3 insertions(+) will apply [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Take away the freedom of one citizen and you will be jailed, take away the freedom of all citizens and you will be congratulated by your peers in Parliament. signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH v2] ffprobe: Fix memory leak
On 21/06/2019 15:26, James Almer wrote: > Remove the three lines below as well before pushing. They are > superfluous as av_packet_unref() does the same internally. OK. The documentation for av_packet_unref says it sets the 'remaining' fields to default values, but av_init_packet says it sets the 'optional' fields to default values. Not clear if they mean the same thing. Looking at the source, it's clear, but I prefer not to do that, since it encourages relying on undocumented behavior. - Derek ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH V1 2/3] ffmpeg_opt: Respect default disposition when select audio/video
On Thu, Jun 20, 2019 at 12:50:33PM +0800, Jun Zhao wrote: > From: Jun Zhao > > Respect default disposition when select audio/video > > Signed-off-by: Jun Zhao > --- > fftools/ffmpeg_opt.c |6 -- > 1 files changed, 4 insertions(+), 2 deletions(-) this is probably ok some testcase in fate would probably be good [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Elect your leaders based on what they did after the last election, not based on what they say before an election. signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH v2] ffprobe: Fix memory leak
Derek Buitenhuis (12019-06-21): > The previous instructions is not an unref if it hits one of the breaks > in the loop above. Of course. Sorry for wasting your time. Regards, -- Nicolas George signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH v2] ffprobe: Fix memory leak
On 21/06/2019 15:26, Nicolas George wrote: > How can the packet not be unreferenced when the very previous > instruction is av_packet_unref()? All the code paths I see either pass > through the existing av_packet_unref() before reaching the new one or > arrive with a blank packet. Am I missing something? The previous instructions is not an unref if it hits one of the breaks in the loop above. - Derek ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH] set AVFrame decode_error_flags to FF_DECODE_ERROR_CONCEALMENT_ACTIVE in case of concealed errors
Thanks Michael, I submitted two new patches. I add a new value FF_DECODE_ERROR_DECODE_SLICES. FF_DECODE_ERROR_DECODE_SLICES indicates that error(s) occurred during slices decoding but the return code is set to zero (set where previously FF_DECODE_ERROR_CONCEALMENT_ACTIVE was set). FF_DECODE_ERROR_CONCEALMENT_ACTIVE indicates that an attempt to correct those errors was made (set where you suggested) Amir On Wed, Jun 19, 2019 at 12:38 PM Michael Niedermayer wrote: > On Tue, Jun 18, 2019 at 03:14:47PM +0300, Amir Z wrote: > > Thanks Michael, > > > > The reason I set the flag before the log line in ff_er_frame_end is > because > > the code might never get there even though the return value is set to > zero. > > > > Should we use two different values ? > > if there are 2 semantically different cases, maybe yes > > thx > > [...] > -- > Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB > > Opposition brings concord. Out of discord comes the fairest harmony. > -- Heraclitus > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > To unsubscribe, visit link above, or email > ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe". ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH v2] ffprobe: Fix memory leak
On 6/21/2019 11:15 AM, Derek Buitenhuis wrote: > This packet was not necessarily unreferenced. > > Signed-off-by: Derek Buitenhuis > --- > fftools/ffprobe.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c > index 3becb6330e..dac70ba5a1 100644 > --- a/fftools/ffprobe.c > +++ b/fftools/ffprobe.c > @@ -2429,6 +2429,8 @@ static int read_interval_packets(WriterContext *w, > InputFile *ifile, > } > av_packet_unref(); > } > +av_packet_unref(); > + Remove the three lines below as well before pushing. They are superfluous as av_packet_unref() does the same internally. > av_init_packet(); > pkt.data = NULL; > pkt.size = 0; > ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH v2] ffprobe: Fix memory leak
Derek Buitenhuis (12019-06-21): > This packet was not necessarily unreferenced. > > Signed-off-by: Derek Buitenhuis > --- > fftools/ffprobe.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c > index 3becb6330e..dac70ba5a1 100644 > --- a/fftools/ffprobe.c > +++ b/fftools/ffprobe.c > @@ -2429,6 +2429,8 @@ static int read_interval_packets(WriterContext *w, > InputFile *ifile, > } > av_packet_unref(); > } > +av_packet_unref(); > + How can the packet not be unreferenced when the very previous instruction is av_packet_unref()? All the code paths I see either pass through the existing av_packet_unref() before reaching the new one or arrive with a blank packet. Am I missing something? > av_init_packet(); > pkt.data = NULL; > pkt.size = 0; Regards, -- Nicolas George signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH] ffprobe: Fix memory leak
On 6/21/2019 11:13 AM, Derek Buitenhuis wrote: > On 21/06/2019 14:46, James Almer wrote: >> Why not just call this unconditionally instead of the init() + zero below? > > I wasn't sure from a quick skim if these packets were > referenced elsewhere (and thus unrefercing twice would > be problematic). Unreferencing a packet cleans the struct, so calling unref() on it again is basically a no-op. > > If it's safe to do so, I will. > > - Derel > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > To unsubscribe, visit link above, or email > ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe". > ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH] ffprobe: Fix memory leak
On 21/06/2019 14:46, James Almer wrote: > Why not just call this unconditionally instead of the init() + zero below? I wasn't sure from a quick skim if these packets were referenced elsewhere (and thus unrefercing twice would be problematic). If it's safe to do so, I will. - Derel ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v2] ffprobe: Fix memory leak
This packet was not necessarily unreferenced. Signed-off-by: Derek Buitenhuis --- fftools/ffprobe.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c index 3becb6330e..dac70ba5a1 100644 --- a/fftools/ffprobe.c +++ b/fftools/ffprobe.c @@ -2429,6 +2429,8 @@ static int read_interval_packets(WriterContext *w, InputFile *ifile, } av_packet_unref(); } +av_packet_unref(); + av_init_packet(); pkt.data = NULL; pkt.size = 0; -- 2.20.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH] add FF_DECODE_ERROR_DECODE_SLICES flag for AVFrame.decode_error_flags
FF_DECODE_ERROR_DECODE_SLICES is set when decoding slices result with error(s) but the returned value from avcodec_receive_frame is zero Signed-off-by: Amir Pauker --- doc/APIchanges | 3 +++ libavutil/frame.h | 1 + libavutil/version.h | 2 +- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/doc/APIchanges b/doc/APIchanges index 29a1936..b5fadc2 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -15,6 +15,9 @@ libavutil: 2017-10-21 API changes, most recent first: +2019-06-21 - XX - lavu 56.30.100 - frame.h + Add FF_DECODE_ERROR_DECODE_SLICES + 2019-06-14 - XX - lavu 56.29.100 - frame.h Add FF_DECODE_ERROR_CONCEALMENT_ACTIVE diff --git a/libavutil/frame.h b/libavutil/frame.h index 54e682e..732b077 100644 --- a/libavutil/frame.h +++ b/libavutil/frame.h @@ -564,6 +564,7 @@ typedef struct AVFrame { #define FF_DECODE_ERROR_INVALID_BITSTREAM 1 #define FF_DECODE_ERROR_MISSING_REFERENCE 2 #define FF_DECODE_ERROR_CONCEALMENT_ACTIVE 4 +#define FF_DECODE_ERROR_DECODE_SLICES 8 /** * number of audio channels, only used for audio. diff --git a/libavutil/version.h b/libavutil/version.h index dccbb38..e16b93e 100644 --- a/libavutil/version.h +++ b/libavutil/version.h @@ -79,7 +79,7 @@ */ #define LIBAVUTIL_VERSION_MAJOR 56 -#define LIBAVUTIL_VERSION_MINOR 29 +#define LIBAVUTIL_VERSION_MINOR 30 #define LIBAVUTIL_VERSION_MICRO 100 #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \ -- 2.1.4 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH] set AVFrame decode_error_flags in case of decoding error by h264dec
set AVFrame decode_error_flags in case h->slice_ctx->er.error_occurred is set after the call to ff_h264_execute_decode_slices. This allows the user to detect concealed decoding errors in the call to avcodec_receive_frame Signed-off-by: Amir Pauker --- libavcodec/error_resilience.c | 2 ++ libavcodec/h264dec.c | 5 + 2 files changed, 7 insertions(+) diff --git a/libavcodec/error_resilience.c b/libavcodec/error_resilience.c index 35d0c60..ca22871 100644 --- a/libavcodec/error_resilience.c +++ b/libavcodec/error_resilience.c @@ -1121,6 +1121,8 @@ void ff_er_frame_end(ERContext *s) av_log(s->avctx, AV_LOG_INFO, "concealing %d DC, %d AC, %d MV errors in %c frame\n", dc_error, ac_error, mv_error, av_get_picture_type_char(s->cur_pic.f->pict_type)); +s->cur_pic.f->decode_error_flags |= FF_DECODE_ERROR_CONCEALMENT_ACTIVE; + is_intra_likely = is_intra_more_likely(s); /* set unknown mb-type to most likely */ diff --git a/libavcodec/h264dec.c b/libavcodec/h264dec.c index 837c3b7..8d1bd16 100644 --- a/libavcodec/h264dec.c +++ b/libavcodec/h264dec.c @@ -761,6 +761,11 @@ static int decode_nal_units(H264Context *h, const uint8_t *buf, int buf_size) if (ret < 0 && (h->avctx->err_recognition & AV_EF_EXPLODE)) goto end; +// set decode_error_flags to allow users to detect concealed decoding errors +if ((ret < 0 || h->slice_ctx->er.error_occurred) && h->cur_pic_ptr) { +h->cur_pic_ptr->f->decode_error_flags |= FF_DECODE_ERROR_DECODE_SLICES; +} + ret = 0; end: -- 2.1.4 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH] ffprobe: Fix memory leak
On 6/21/2019 10:36 AM, Derek Buitenhuis wrote: > This packet was not necessarily unreferenced. > > Signed-off-by: Derek Buitenhuis > --- > fftools/ffprobe.c | 10 +- > 1 file changed, 9 insertions(+), 1 deletion(-) > > diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c > index 3becb6330e..52f24e7dfd 100644 > --- a/fftools/ffprobe.c > +++ b/fftools/ffprobe.c > @@ -2351,6 +2351,7 @@ static int read_interval_packets(WriterContext *w, > InputFile *ifile, > int ret = 0, i = 0, frame_count = 0; > int64_t start = -INT64_MAX, end = interval->end; > int has_start = 0, has_end = interval->has_end && > !interval->end_is_offset; > +int needs_unref = 0; > > av_init_packet(); > > @@ -2410,9 +2411,12 @@ static int read_interval_packets(WriterContext *w, > InputFile *ifile, > } > > if (interval->end_is_offset && interval->duration_frames) { > -if (frame_count >= interval->end) > +if (frame_count >= interval->end) { > +needs_unref = 1; > break; > +} > } else if (has_end && *cur_ts != AV_NOPTS_VALUE && *cur_ts >= > end) { > +needs_unref = 1; > break; > } > > @@ -2429,6 +2433,10 @@ static int read_interval_packets(WriterContext *w, > InputFile *ifile, > } > av_packet_unref(); > } > + > +if (needs_unref) > +av_packet_unref(); Why not just call this unconditionally instead of the init() + zero below? > + > av_init_packet(); > pkt.data = NULL; > pkt.size = 0; > ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH] ffprobe: Fix memory leak
This packet was not necessarily unreferenced. Signed-off-by: Derek Buitenhuis --- fftools/ffprobe.c | 10 +- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c index 3becb6330e..52f24e7dfd 100644 --- a/fftools/ffprobe.c +++ b/fftools/ffprobe.c @@ -2351,6 +2351,7 @@ static int read_interval_packets(WriterContext *w, InputFile *ifile, int ret = 0, i = 0, frame_count = 0; int64_t start = -INT64_MAX, end = interval->end; int has_start = 0, has_end = interval->has_end && !interval->end_is_offset; +int needs_unref = 0; av_init_packet(); @@ -2410,9 +2411,12 @@ static int read_interval_packets(WriterContext *w, InputFile *ifile, } if (interval->end_is_offset && interval->duration_frames) { -if (frame_count >= interval->end) +if (frame_count >= interval->end) { +needs_unref = 1; break; +} } else if (has_end && *cur_ts != AV_NOPTS_VALUE && *cur_ts >= end) { +needs_unref = 1; break; } @@ -2429,6 +2433,10 @@ static int read_interval_packets(WriterContext *w, InputFile *ifile, } av_packet_unref(); } + +if (needs_unref) +av_packet_unref(); + av_init_packet(); pkt.data = NULL; pkt.size = 0; -- 2.20.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v6] vf_drawtext: Add pkt_pos, pkt_duration, pkt_size as variables
Info at https://trac.ffmpeg.org/ticket/7947 Changes to vf_drawtext.c written by Calvin Walton Changes to filters.texi written by greg Luce with lots of help from Moritz Barsnick and Gyan [PATCH]-vf_drawtext-Add-pkt_pos-pkt_duration-pkt_size-as-var.patch Description: Binary data ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH v5] vf_drawtext: Add pkt_pos, pkt_duration, pkt_size as variables
> Do you consider the doc change to be more important than the code > change? > > If not, you need to change the From line of the commit. Makes sense! ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH v5] vf_drawtext: Add pkt_pos, pkt_duration, pkt_size as variables
greg Luce (12019-06-21): > From: greg Luce > Changes to vf_drawtext.c written by > Calvin Walton > > Changes to filters.texi written by > greg Luce > with lots of help from Moritz Barsnick and Gyan Do you consider the doc change to be more important than the code change? If not, you need to change the From line of the commit. Regards, -- Nicolas George signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v5] vf_drawtext: Add pkt_pos, pkt_duration, pkt_size as variables
Info at https://trac.ffmpeg.org/ticket/7947 Changes to vf_drawtext.c written by Calvin Walton Changes to filters.texi written by greg Luce with lots of help from Moritz Barsnick and Gyan [PATCH]-vf_drawtext-Add-pkt_pos-pkt_duration-pkt_size-as-var.patch Description: Binary data ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH v4] vf_drawtext: Add pkt_pos, pkt_duration, pkt_size as variables
Thanks will resubmit that way On Fri, 21 Jun 2019 at 08:53, Nicolas George wrote: > > greg Luce (12019-06-21): > > I had them in a single patch before but split them as requested here > > http://ffmpeg.org/pipermail/ffmpeg-devel/2019-June/245613.html > > Is there something I'm missing that allows me to split the patch but > > have the code and doc in the same patch? > > Asking you to split was, I think, a mistake: a new feature and its > documentation belong in the same commit, even if they were written by > different persons. > > Just make sure the commit message states authorship accurately. > > Regards, > > -- > Nicolas George > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > To unsubscribe, visit link above, or email > ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe". ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH v4] vf_drawtext: Add pkt_pos, pkt_duration, pkt_size as variables
greg Luce (12019-06-21): > I had them in a single patch before but split them as requested here > http://ffmpeg.org/pipermail/ffmpeg-devel/2019-June/245613.html > Is there something I'm missing that allows me to split the patch but > have the code and doc in the same patch? Asking you to split was, I think, a mistake: a new feature and its documentation belong in the same commit, even if they were written by different persons. Just make sure the commit message states authorship accurately. Regards, -- Nicolas George signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH v4] vf_drawtext: Add pkt_pos, pkt_duration, pkt_size as variables
> code changes should be ok > the doc and code belong in the same patch/commit though I had them in a single patch before but split them as requested here http://ffmpeg.org/pipermail/ffmpeg-devel/2019-June/245613.html Is there something I'm missing that allows me to split the patch but have the code and doc in the same patch? ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 1/2] avcodec/cbs_h265: fix valid range of num_tile_{columns, rows}_minus1 in H265RawPPS
On 6/21/2019 1:24 AM, Gyan wrote: > > > On 20-06-2019 11:15 PM, James Almer wrote: >> The spec states they can't be higher than the respective dimensions of >> the >> stream in CTBs. >> >> Signed-off-by: James Almer >> --- >> I don't think it's wise further limiting the range to the maximum >> currently >> defined for level 6.2 using those two HEVC_ defines, since a stream >> could in >> theory go beyond them (New levels defined in the future?), but the >> alternative >> is making the column_width_minus1 and row_height_minus1 arrays much >> bigger, or >> dinamically allocated. > dinamically--> dynamically Thanks, but that's not part of the commit message, so it'll not make it out of this mailing list. > >> >> libavcodec/cbs_h265_syntax_template.c | 13 +++-- >> 1 file changed, 11 insertions(+), 2 deletions(-) >> >> diff --git a/libavcodec/cbs_h265_syntax_template.c >> b/libavcodec/cbs_h265_syntax_template.c >> index f279d283d9..d2a20ddb35 100644 >> --- a/libavcodec/cbs_h265_syntax_template.c >> +++ b/libavcodec/cbs_h265_syntax_template.c >> @@ -1045,8 +1045,17 @@ static int FUNC(pps)(CodedBitstreamContext >> *ctx, RWContext *rw, >> flag(entropy_coding_sync_enabled_flag); >> if (current->tiles_enabled_flag) { >> - ue(num_tile_columns_minus1, 0, HEVC_MAX_TILE_COLUMNS); >> - ue(num_tile_rows_minus1, 0, HEVC_MAX_TILE_ROWS); >> + unsigned int min_cb_log2_size_y = >> sps->log2_min_luma_coding_block_size_minus3 + 3; >> + unsigned int ctb_log2_size_y = >> + min_cb_log2_size_y + >> sps->log2_diff_max_min_luma_coding_block_size; >> + unsigned int ctb_size_y = 1 << ctb_log2_size_y; >> + unsigned int pic_width_in_ctbs_y = >> + (sps->pic_width_in_luma_samples + ctb_size_y - 1) / >> ctb_size_y; >> + unsigned int pic_height_in_ctbs_y = >> + (sps->pic_height_in_luma_samples + ctb_size_y - 1) / >> ctb_size_y; >> + >> + ue(num_tile_columns_minus1, 0, FFMIN(pic_width_in_ctbs_y - 1, >> HEVC_MAX_TILE_COLUMNS - 1)); >> + ue(num_tile_rows_minus1, 0, FFMIN(pic_height_in_ctbs_y - >> 1, HEVC_MAX_TILE_ROWS - 1)); >> flag(uniform_spacing_flag); >> if (!current->uniform_spacing_flag) { >> for (i = 0; i < current->num_tile_columns_minus1; i++) > > Gyan > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > To unsubscribe, visit link above, or email > ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe". ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH v4] vf_drawtext: Add pkt_pos, pkt_duration, pkt_size as variables
On Thu, Jun 20, 2019 at 12:06:38PM -0400, greg Luce wrote: > Info at https://trac.ffmpeg.org/ticket/7947 > C code in file 0001, documentation and version tick in file 0002 > Documentation written with help from Gyan and Moritz Barsnick > Documentation patch has info in what I hope is the commit message > vf_drawtext.c |9 + > 1 file changed, 9 insertions(+) > 3b8f4ca7b73192f2cafd1c563ab1b5c064de678b > 0001-vf_drawtext-Add-pkt_pos-pkt_duration-pkt_size-as-var.patch > From b4b119d490d98c713ebb8a2288a2e2e3017e56ea Mon Sep 17 00:00:00 2001 > From: Calvin Walton > Date: Fri, 7 Jun 2019 15:06:36 -0400 > Subject: [PATCH] vf_drawtext: Add pkt_pos, pkt_duration, pkt_size as variables > > --- > libavfilter/vf_drawtext.c | 9 + > 1 file changed, 9 insertions(+) code changes should be ok the doc and code belong in the same patch/commit though thx [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB The smallest minority on earth is the individual. Those who deny individual rights cannot claim to be defenders of minorities. - Ayn Rand signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [Patch V2] lavf/qsv_scale: add scaling modes support
> Subject: [Patch V2] lavf/qsv_scale: add scaling modes support > > low_power mode will use a fixed HW engine (SFC), thus can offload EU > usage. > high quality mode will take EU usage (AVS sampler). > > Performance and EU usage (Render usage) comparsion on Intel(R) Xeon(R) > CPU E3-1225 v5 @ 3.30GHz: > > High quality mode : ffmpeg -hwaccel qsv -c:v h264_qsv -i > bbb_sunflower_1080p_30fps_normal_2000frames.h264 \ -vf > scale_qsv=w=1280:h=736:mode=hq -f null - > fps=389 > RENDER usage: 28.10 (provided by MSDK metrics_monitor) > > Low Power mode: ffmpeg -hwaccel qsv -c:v h264_qsv -i > ~/bbb_sunflower_1080p_30fps_normal_2000frames.h264 \ -vf > scale_qsv=w=1280:h=736:mode=low_power -f null - > fps=343 > RENDER usage: 0.00 > > Low power mode (SFC) may be disabled if not supported by MSDK/Driver/HW, > and replaced by AVS mode interanlly. > > Signed-off-by: Zhong Li > --- > libavfilter/vf_scale_qsv.c | 40 > +++- > 1 file changed, 35 insertions(+), 5 deletions(-) > > diff --git a/libavfilter/vf_scale_qsv.c b/libavfilter/vf_scale_qsv.c index > db7715f..499534e 100644 > --- a/libavfilter/vf_scale_qsv.c > +++ b/libavfilter/vf_scale_qsv.c > @@ -69,6 +69,8 @@ enum var_name { > VARS_NB > }; > > +#define QSV_HAVE_SCALING_CONFIG QSV_VERSION_ATLEAST(1, 19) > + > typedef struct QSVScaleContext { > const AVClass *class; > > @@ -88,7 +90,14 @@ typedef struct QSVScaleContext { > int nb_surface_ptrs_out; > > mfxExtOpaqueSurfaceAlloc opaque_alloc; > -mfxExtBuffer*ext_buffers[1]; > + > +#if QSV_HAVE_SCALING_CONFIG > +mfxExtVPPScaling scale_conf; > +#endif > +int mode; > + > +mfxExtBuffer *ext_buffers[1 + > QSV_HAVE_SCALING_CONFIG]; > +int num_ext_buf; > > int shift_width, shift_height; > > @@ -285,6 +294,8 @@ static int init_out_session(AVFilterContext *ctx) > mfxStatus err; > int i; > > +s->num_ext_buf = 0; > + > /* extract the properties of the "master" session given to us */ > err = MFXQueryIMPL(device_hwctx->session, ); > if (err == MFX_ERR_NONE) > @@ -357,10 +368,7 @@ static int init_out_session(AVFilterContext *ctx) > s->opaque_alloc.Header.BufferId = > MFX_EXTBUFF_OPAQUE_SURFACE_ALLOCATION; > s->opaque_alloc.Header.BufferSz = sizeof(s->opaque_alloc); > > -s->ext_buffers[0] = (mfxExtBuffer*)>opaque_alloc; > - > -par.ExtParam= s->ext_buffers; > -par.NumExtParam = FF_ARRAY_ELEMS(s->ext_buffers); > +s->ext_buffers[s->num_ext_buf++] = > + (mfxExtBuffer*)>opaque_alloc; > > par.IOPattern = MFX_IOPATTERN_IN_OPAQUE_MEMORY | > MFX_IOPATTERN_OUT_OPAQUE_MEMORY; > } else { > @@ -396,6 +404,18 @@ static int init_out_session(AVFilterContext *ctx) > par.IOPattern = MFX_IOPATTERN_IN_VIDEO_MEMORY | > MFX_IOPATTERN_OUT_VIDEO_MEMORY; > } > > +#if QSV_HAVE_SCALING_CONFIG > +memset(>scale_conf, 0, sizeof(mfxExtVPPScaling)); > +s->scale_conf.Header.BufferId = MFX_EXTBUFF_VPP_SCALING; > +s->scale_conf.Header.BufferSz = sizeof(mfxExtVPPScaling); > +s->scale_conf.ScalingMode = s->mode; > +s->ext_buffers[s->num_ext_buf++] = > (mfxExtBuffer*)>scale_conf; > +av_log(ctx, AV_LOG_VERBOSE, "Scaling mode: %"PRIu16"\n", > s->mode); > +#endif > + > +par.ExtParam= s->ext_buffers; > +par.NumExtParam = s->num_ext_buf; > + > par.AsyncDepth = 1;// TODO async > > par.vpp.In = in_frames_hwctx->surfaces[0].Info; > @@ -595,6 +615,16 @@ static const AVOption options[] = { > { "h", "Output video height", OFFSET(h_expr), > AV_OPT_TYPE_STRING, { .str = "ih" }, .flags = FLAGS }, > { "format", "Output pixel format", OFFSET(format_str), > AV_OPT_TYPE_STRING, { .str = "same" }, .flags = FLAGS }, > > +#if QSV_HAVE_SCALING_CONFIG > +{ "mode", "set scaling mode",OFFSET(mode), > AV_OPT_TYPE_INT,{ .i64 = MFX_SCALING_MODE_DEFAULT}, > MFX_SCALING_MODE_DEFAULT, MFX_SCALING_MODE_QUALITY, FLAGS, > "mode"}, > +{ "low_power", "low power mode",0, > AV_OPT_TYPE_CONST, { .i64 = MFX_SCALING_MODE_LOWPOWER}, > INT_MIN, INT_MAX, FLAGS, "mode"}, > +{ "hq","high quality mode", 0, > AV_OPT_TYPE_CONST, { .i64 = MFX_SCALING_MODE_QUALITY}, > INT_MIN, INT_MAX, FLAGS, "mode"}, > +#else > +{ "mode", "(not supported)", OFFSET(mode), > AV_OPT_TYPE_INT,{ .i64 = 0}, 0, INT_MAX, FLAGS, "mode"}, > +{ "low_power", "", 0, > AV_OPT_TYPE_CONST, { .i64 = 1}, 0, 0, FLAGS, "mode"}, > +{ "hq","", 0, > AV_OPT_TYPE_CONST, { .i64 = 2}, 0, 0, FLAGS, "mode"}, > +#endif > + > { NULL }, > }; > > -- > 2.7.4 Ping ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email
Re: [FFmpeg-devel] [PATCH V1] lavfi/normalize: improve the performance
On Thu, Jun 20, 2019 at 09:43:46PM +0800, Jun Zhao wrote: > From: Jun Zhao > > Remove unnecessary max value found, it's will improve the performance > about 10%. Used the test command like: > ffmpeg -i 1080P.mp4 -an -vf normalize -f null /dev/null, the FPS change > from 96fps to 107fps. > > Signed-off-by: Jun Zhao > --- > libavfilter/vf_normalize.c |7 +++ > 1 files changed, 3 insertions(+), 4 deletions(-) > > diff --git a/libavfilter/vf_normalize.c b/libavfilter/vf_normalize.c > index 48eea59..40dc031 100644 > --- a/libavfilter/vf_normalize.c > +++ b/libavfilter/vf_normalize.c > @@ -143,14 +143,13 @@ static void normalize(NormalizeContext *s, AVFrame *in, > AVFrame *out) > min[c].in = max[c].in = in->data[0][s->co[c]]; > for (y = 0; y < in->height; y++) { > uint8_t *inp = in->data[0] + y * in->linesize[0]; > -uint8_t *outp = out->data[0] + y * out->linesize[0]; > for (x = 0; x < in->width; x++) { > for (c = 0; c < 3; c++) { > -min[c].in = FFMIN(min[c].in, inp[s->co[c]]); > -max[c].in = FFMAX(max[c].in, inp[s->co[c]]); > +uint8_t val = inp[s->co[c]]; > +if (val < min[c].in) min[c].in = val; > +else if (val > max[c].in) max[c].in = val; > } > inp += s->step; > -outp += s->step; outp should just be removed, a patch for that certainly would be accepted. But I am very skeptical towards the rest of the change. In a way I would expect the compiler should be able to optimize this. However this code is clearly completely unoptimized, and thus I don't think making it more complex for a minor optimization that gives just 10% is worth it. A proper optimization would get rid of the s->co indirection in the inner loop - it really is not necessary for the limited format support the code has. This would then also allow for SIMD optimization, which should give a vastly larger speedup - and possibly the compiler would even be able to auto-vectorize. This applies even more to the processing step - the transform calculation done in SIMD is almost certain to be cheaper than a LUT lookup - at least if switch to fixed-point arithmetic instead of float. Side note: I haven't really figured out what the point of all this s->co complexity is supposed to be. The only thing the code seems to actually care is whether there is an alpha channel, and if so where it is. But the quickest path to a significant speedup would be to write a SIMD version of the normalize function specific to that format and the SIMD instruction set available and call it instead of normalize if applicable. I would expect that you should see at least a 3x speedup if using e.g. SSE2 (which is why I don't consider a 10% speedup worth changing the code for really). Best regards, Reimar Döffinger ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 1/2] avcodec/bink: Fix integer overflow in unquantize_dct_coeffs()
On 18.06.2019, at 14:55, Michael Niedermayer wrote: > Fixes: signed integer overflow: -3447 * 2883584 cannot be represented in type > 'int' > Fixes: > 15265/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_BINK_fuzzer-5088311799971840 > > Found-by: continuous fuzzing process > https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg > Signed-off-by: Michael Niedermayer > --- > libavcodec/bink.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/libavcodec/bink.c b/libavcodec/bink.c > index 8392bbeeb0..d18c0ceae4 100644 > --- a/libavcodec/bink.c > +++ b/libavcodec/bink.c > @@ -702,15 +702,15 @@ static int read_dct_coeffs(BinkContext *c, > GetBitContext *gb, int32_t block[64], > return quant_idx; > } > > -static void unquantize_dct_coeffs(int32_t block[64], const int32_t quant[64], > +static void unquantize_dct_coeffs(int32_t block[64], const uint32_t > quant[64], > int coef_count, int coef_idx[64], > const uint8_t *scan) > { > int i; > -block[0] = (block[0] * quant[0]) >> 11; > +block[0] = (int)(block[0] * quant[0]) >> 11; Huh? How do you know the multiplication result will fit in an int? IIRC casting an out-of-range value to int is undefined behaviour, or does the tool fail to check that? I might miss something, but it looks to me like just replacing one undefined behaviour with another... ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH] avcodec/videodsp_template: Fix overflow of addition
On 18.06.2019, at 16:25, Michael Niedermayer wrote: > Fixes: addition of unsigned offset to 0x7f56fc26a9b6 overflowed to > 0x7f56fc26a8be* > Fixes: > clusterfuzz-testcase-minimized-mediasource_MP4_AVC1_pipeline_integration_fuzzer-4917949056679936 > > Reported-by: Matt Wolenetz > Reviewed-by: Matt Wolenetz > Signed-off-by: Michael Niedermayer > --- > libavcodec/videodsp_template.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/libavcodec/videodsp_template.c b/libavcodec/videodsp_template.c > index 94c1b7188d..eae2f1d51b 100644 > --- a/libavcodec/videodsp_template.c > +++ b/libavcodec/videodsp_template.c > @@ -44,7 +44,7 @@ void FUNC(ff_emulated_edge_mc)(uint8_t *buf, const uint8_t > *src, > src_y = 1 - block_h; > } > if (src_x >= w) { > -src += (w - 1 - src_x) * sizeof(pixel); > +src -= (1 + src_x - w) * sizeof(pixel); This is really non-obvious and someone might be tempted to "simplify", especially since the old way matched the code a few lines below. I'd suggest adding a comment. > src_x = w - 1; > } else if (src_x <= -block_w) { > src += (1 - block_w - src_x) * sizeof(pixel); ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 3/7] avcodec/alsdec: Fix integer overflow with buffer number
On 21.06.2019, at 00:47, Michael Niedermayer wrote: > Fixes: signed integer overflow: 65313 * 65313 cannot be represented in type > 'int' > Fixes: > 15290/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ALS_fuzzer-5738074249625600 > > Found-by: continuous fuzzing process > https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg > Signed-off-by: Michael Niedermayer > --- > libavcodec/alsdec.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/libavcodec/alsdec.c b/libavcodec/alsdec.c > index 79d22b7c2b..8e0d3e5f83 100644 > --- a/libavcodec/alsdec.c > +++ b/libavcodec/alsdec.c > @@ -1990,6 +1990,8 @@ static av_cold int decode_init(AVCodecContext *avctx) > > // allocate quantized parcor coefficient buffer > num_buffers = sconf->mc_coding ? avctx->channels : 1; > +if (num_buffers * (uint64_t)num_buffers > INT_MAX) > +return AVERROR_INVALIDDATA; It would be nice if it was clear which code this check protects, i.e. some connection between the check and the code that overflows. I guess one might also ask if > 30 000 channels might not be something to catch and disallow earlier and generally... ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH v2] vf_drawtext documentation additions and correction
On 21-06-2019 10:02 AM, greg Luce wrote: Split this patch off since it just deals with documentation for features already present in the code. Hope I formatted everything correctly! Gyan and kepstin helped write the documentation Adjusted commit msg and text for grammar nits and pushed as 18dab6175bad2864c8d19a1d1476f5a3c1130599. Thanks, Gyan ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".