Re: [FFmpeg-devel] libavcodec : add psd image file decoder
On 12/14/16, Michael Niedermayerwrote: > On Tue, Dec 13, 2016 at 10:23:48PM +0100, Martin Vignali wrote: >> 2016-11-24 21:35 GMT+01:00 Martin Vignali : >> >> > Hello >> > >> > New patchs in attach >> > >> > I changed the dimensions check, the check is now : >> > >> > if ((s->height > 3) && (s->avctx->strict_std_compliance > >> > FF_COMPLIANCE_EXPERIMENTAL)) { >> > av_log(s->avctx, AV_LOG_ERROR, >> >"Height > 3 is experimental, add " >> >"'-strict %d' if you want to try to decode the >> > picture.\n", >> >FF_COMPLIANCE_EXPERIMENTAL); >> > return AVERROR_EXPERIMENTAL; >> > } >> > >> > s->width = bytestream2_get_be32(>gb); >> > if ((s->width > 3) && (s->avctx->strict_std_compliance > >> > FF_COMPLIANCE_EXPERIMENTAL)) { >> > av_log(s->avctx, AV_LOG_ERROR, >> >"Width > 3 is experimental, add " >> >"'-strict %d' if you want to try to decode the >> > picture.\n", >> >FF_COMPLIANCE_EXPERIMENTAL); >> > return AVERROR_EXPERIMENTAL; >> > } >> > >> > >> > and change the line_size variable (in PSD Context) to uint_64 (because >> > now, width can be > 3 if -strict set to experimental) >> > >> > I will send a patch for fate test in another discussion. >> > >> > Martin >> > >> >> Ping > > applied Without minor bumps. > > thx > > [...] > -- > Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB > > Republics decline into democracies and democracies degenerate into > despotisms. -- Aristotle > ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 1/3] omadec: fix overflows during bit rate calculation
On 12/14/16, Andreas Cadhalpunwrote: > On 13.12.2016 08:11, Paul B Mahol wrote: >> On 12/13/16, Andreas Cadhalpun wrote: >>> Signed-off-by: Andreas Cadhalpun >>> --- >>> libavformat/omadec.c | 4 ++-- >>> 1 file changed, 2 insertions(+), 2 deletions(-) >>> >>> diff --git a/libavformat/omadec.c b/libavformat/omadec.c >>> index 6e476db..e7751d0 100644 >>> --- a/libavformat/omadec.c >>> +++ b/libavformat/omadec.c >>> @@ -365,7 +365,7 @@ static int oma_read_header(AVFormatContext *s) >>> st->codecpar->channels= 2; >>> st->codecpar->channel_layout = AV_CH_LAYOUT_STEREO; >>> st->codecpar->sample_rate = samplerate; >>> -st->codecpar->bit_rate= st->codecpar->sample_rate * >>> framesize * >>> 8 / 1024; >>> +st->codecpar->bit_rate= st->codecpar->sample_rate * >>> framesize / >>> 128; >>> >>> /* fake the ATRAC3 extradata >>> * (wav format, makes stream copy to wav work) */ >>> @@ -398,7 +398,7 @@ static int oma_read_header(AVFormatContext *s) >>> return AVERROR_INVALIDDATA; >>> } >>> st->codecpar->sample_rate = samplerate; >>> -st->codecpar->bit_rate= samplerate * framesize * 8 / 2048; >>> +st->codecpar->bit_rate= samplerate * framesize / 256; >>> avpriv_set_pts_info(st, 64, 1, samplerate); >>> break; >>> case OMA_CODECID_MP3: >> >> Shouldn't using 8LL or similar be more future-proof? > > Why multiply with 8 when dividing by a multiple of 8 directly afterwards? > That's just a waste of computational resources. > If sample_rate and/or framesize get larger in the future, a cast can be > added. > > Best regards, > Andreas > > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel > ok ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 3/3] mov: prevent overflow during bit rate calculation
On Wed, Dec 14, 2016 at 01:58:35AM +0100, Andreas Cadhalpun wrote: > Signed-off-by: Andreas Cadhalpun> --- > libavformat/mov.c | 15 ++- > 1 file changed, 14 insertions(+), 1 deletion(-) > > diff --git a/libavformat/mov.c b/libavformat/mov.c > index 6c8affc..fc0b25c 100644 > --- a/libavformat/mov.c > +++ b/libavformat/mov.c > @@ -5887,8 +5887,15 @@ static int mov_read_header(AVFormatContext *s) > for (i = 0; i < s->nb_streams; i++) { > AVStream *st = s->streams[i]; > MOVStreamContext *sc = st->priv_data; > -if (st->duration > 0) > +if (st->duration > 0) { > +if (sc->data_size > INT64_MAX / sc->time_scale / 8) { > +av_log(s, AV_LOG_ERROR, "Overflow during bit rate > calculation %"PRId64" * 8 * %d\n", > + sc->data_size, sc->time_scale); > +mov_read_close(s); > +return AVERROR_INVALIDDATA; > +} > st->codecpar->bit_rate = sc->data_size * 8 * sc->time_scale > / st->duration; > +} > } > } > > @@ -5897,6 +5904,12 @@ static int mov_read_header(AVFormatContext *s) > AVStream *st = s->streams[i]; > MOVStreamContext *sc = st->priv_data; > if (sc->duration_for_fps > 0) { > +if (sc->data_size > INT64_MAX / sc->time_scale / 8) { > +av_log(s, AV_LOG_ERROR, "Overflow during bit rate > calculation %"PRId64" * 8 * %d\n", > + sc->data_size, sc->time_scale); > +mov_read_close(s); > +return AVERROR_INVALIDDATA; > +} > st->codecpar->bit_rate = sc->data_size * 8 * sc->time_scale / > sc->duration_for_fps; maybe this can be factored somehow but either way probably ok thx [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB it is not once nor twice but times without number that the same ideas make their appearance in the world. -- Aristotle signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 1/3] 4xm: prevent overflow during bit rate calculation
On Wed, Dec 14, 2016 at 01:57:54AM +0100, Andreas Cadhalpun wrote: > Signed-off-by: Andreas Cadhalpun> --- > libavformat/4xm.c | 8 +++- > 1 file changed, 7 insertions(+), 1 deletion(-) LGTM thx [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Many things microsoft did are stupid, but not doing something just because microsoft did it is even more stupid. If everything ms did were stupid they would be bankrupt already. signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] libavcodec : add psd image file decoder
On Tue, Dec 13, 2016 at 10:23:48PM +0100, Martin Vignali wrote: > 2016-11-24 21:35 GMT+01:00 Martin Vignali: > > > Hello > > > > New patchs in attach > > > > I changed the dimensions check, the check is now : > > > > if ((s->height > 3) && (s->avctx->strict_std_compliance > > > FF_COMPLIANCE_EXPERIMENTAL)) { > > av_log(s->avctx, AV_LOG_ERROR, > >"Height > 3 is experimental, add " > >"'-strict %d' if you want to try to decode the picture.\n", > >FF_COMPLIANCE_EXPERIMENTAL); > > return AVERROR_EXPERIMENTAL; > > } > > > > s->width = bytestream2_get_be32(>gb); > > if ((s->width > 3) && (s->avctx->strict_std_compliance > > > FF_COMPLIANCE_EXPERIMENTAL)) { > > av_log(s->avctx, AV_LOG_ERROR, > >"Width > 3 is experimental, add " > >"'-strict %d' if you want to try to decode the picture.\n", > >FF_COMPLIANCE_EXPERIMENTAL); > > return AVERROR_EXPERIMENTAL; > > } > > > > > > and change the line_size variable (in PSD Context) to uint_64 (because > > now, width can be > 3 if -strict set to experimental) > > > > I will send a patch for fate test in another discussion. > > > > Martin > > > > Ping applied thx [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Republics decline into democracies and democracies degenerate into despotisms. -- Aristotle signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] lavc/vaapi_encode_h264: add option to indicate the h264 encode profile
From 03030392ec2458679cdfb14802b80cbb196eae40 Mon Sep 17 00:00:00 2001 From: Yi A WangDate: Tue, 13 Dec 2016 10:50:54 +0800 Subject: [PATCH] lavc/vaapi_encode_h264: add option to indicate the h264 encode profile add h264 encode profile option and update the docs, for avc constrained baseline, disable B frames base on H.264 spec Annex A.2.1 Signed-off-by: Jun Zhao Signed-off-by: Yi A Wang --- doc/codecs.texi| 8 libavcodec/options_table.h | 5 - libavcodec/vaapi_encode_h264.c | 5 + 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/doc/codecs.texi b/doc/codecs.texi index 9a3a56d..9ee9061 100644 --- a/doc/codecs.texi +++ b/doc/codecs.texi @@ -893,6 +893,14 @@ Possible values: @item dts_hd_ma +@item hevc_main10 + +@item h264_constrained_baseline + +@item h264_main + +@item h264_high + @end table @item level @var{integer} (@emph{encoding,audio,video}) diff --git a/libavcodec/options_table.h b/libavcodec/options_table.h index 3fe7925..94b2d9b 100644 --- a/libavcodec/options_table.h +++ b/libavcodec/options_table.h @@ -395,7 +395,10 @@ static const AVOption avcodec_options[] = { {"mpeg4_core", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_PROFILE_MPEG4_CORE }, INT_MIN, INT_MAX, V|E, "profile"}, {"mpeg4_main", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_PROFILE_MPEG4_MAIN }, INT_MIN, INT_MAX, V|E, "profile"}, {"mpeg4_asp", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_PROFILE_MPEG4_ADVANCED_SIMPLE }, INT_MIN, INT_MAX, V|E, "profile"}, -{"main10", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_PROFILE_HEVC_MAIN_10 }, INT_MIN, INT_MAX, V|E, "profile"}, +{"hevc_main10", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_PROFILE_HEVC_MAIN_10 }, INT_MIN, INT_MAX, V|E, "profile"}, +{"h264_constrained_baseline", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_PROFILE_H264_CONSTRAINED_BASELINE}, INT_MIN, INT_MAX, V|E, "profile"}, +{"h264_main", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_PROFILE_H264_MAIN}, INT_MIN, INT_MAX, V|E, "profile"}, +{"h264_high", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_PROFILE_H264_HIGH}, INT_MIN, INT_MAX, V|E, "profile"}, {"level", NULL, OFFSET(level), AV_OPT_TYPE_INT, {.i64 = FF_LEVEL_UNKNOWN }, INT_MIN, INT_MAX, V|A|E, "level"}, {"unknown", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_LEVEL_UNKNOWN }, INT_MIN, INT_MAX, V|A|E, "level"}, {"lowres", "decode at 1= 1/2, 2=1/4, 3=1/8 resolutions", OFFSET(lowres), AV_OPT_TYPE_INT, {.i64 = 0 }, 0, INT_MAX, V|A|D}, diff --git a/libavcodec/vaapi_encode_h264.c b/libavcodec/vaapi_encode_h264.c index 69cc483..5f37770 100644 --- a/libavcodec/vaapi_encode_h264.c +++ b/libavcodec/vaapi_encode_h264.c @@ -1190,6 +1190,11 @@ static av_cold int vaapi_encode_h264_init(AVCodecContext *avctx) switch (avctx->profile) { case FF_PROFILE_H264_CONSTRAINED_BASELINE: ctx->va_profile = VAProfileH264ConstrainedBaseline; +if (avctx->max_b_frames != 0) { +avctx->max_b_frames = 0; +av_log(avctx, AV_LOG_WARNING, "H.264 constrained baseline " + "profile don't support encode B frame.\n"); +} break; case FF_PROFILE_H264_BASELINE: ctx->va_profile = VAProfileH264Baseline; -- 2.9.3 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 1/3] 4xm: prevent overflow during bit rate calculation
Hi, On Tue, Dec 13, 2016 at 8:21 PM, Andreas Cadhalpun < andreas.cadhal...@googlemail.com> wrote: > On 14.12.2016 02:01, Ronald S. Bultje wrote: > > Hi, > > > > On Tue, Dec 13, 2016 at 7:57 PM, Andreas Cadhalpun < > > andreas.cadhal...@googlemail.com> wrote: > > > >> Signed-off-by: Andreas Cadhalpun> >> --- > >> libavformat/4xm.c | 8 +++- > >> 1 file changed, 7 insertions(+), 1 deletion(-) > >> > >> diff --git a/libavformat/4xm.c b/libavformat/4xm.c > >> index 8a50778..2758b69 100644 > >> --- a/libavformat/4xm.c > >> +++ b/libavformat/4xm.c > >> @@ -163,6 +163,12 @@ static int parse_strk(AVFormatContext *s, > >> return AVERROR_INVALIDDATA; > >> } > >> > >> +if (fourxm->tracks[track].sample_rate > INT64_MAX / > >> fourxm->tracks[track].bits / fourxm->tracks[track].channels) { > >> +av_log(s, AV_LOG_ERROR, "Overflow during bit rate calculation > %d > >> * %d * %d\n", > >> + fourxm->tracks[track].sample_rate, > >> fourxm->tracks[track].bits, fourxm->tracks[track].channels); > >> +return AVERROR_INVALIDDATA; > >> +} > > > > > > What is the functional effect of the overflow? > > It is undefined behavior. > > > Does it crash? Or is there some other security issue? > > The most likely behavior is that bit_rate will contain a negative value, > which might cause problems later on, but I'm not aware of specific > security issues caused by this. Not wanting to discourage you, but I wonder if there's really a point to this...? I don't see how the user experience changes. This isn't specifically intended at this patch, but rather at the sort of rabbit hole this change might lead to, which would cause the code to be uber-full of such checks, none of which really have any significance. But maybe others disagree... Ronald ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 1/3] 4xm: prevent overflow during bit rate calculation
On 14.12.2016 02:01, Ronald S. Bultje wrote: > Hi, > > On Tue, Dec 13, 2016 at 7:57 PM, Andreas Cadhalpun < > andreas.cadhal...@googlemail.com> wrote: > >> Signed-off-by: Andreas Cadhalpun>> --- >> libavformat/4xm.c | 8 +++- >> 1 file changed, 7 insertions(+), 1 deletion(-) >> >> diff --git a/libavformat/4xm.c b/libavformat/4xm.c >> index 8a50778..2758b69 100644 >> --- a/libavformat/4xm.c >> +++ b/libavformat/4xm.c >> @@ -163,6 +163,12 @@ static int parse_strk(AVFormatContext *s, >> return AVERROR_INVALIDDATA; >> } >> >> +if (fourxm->tracks[track].sample_rate > INT64_MAX / >> fourxm->tracks[track].bits / fourxm->tracks[track].channels) { >> +av_log(s, AV_LOG_ERROR, "Overflow during bit rate calculation %d >> * %d * %d\n", >> + fourxm->tracks[track].sample_rate, >> fourxm->tracks[track].bits, fourxm->tracks[track].channels); >> +return AVERROR_INVALIDDATA; >> +} > > > What is the functional effect of the overflow? It is undefined behavior. > Does it crash? Or is there some other security issue? The most likely behavior is that bit_rate will contain a negative value, which might cause problems later on, but I'm not aware of specific security issues caused by this. Best regards, Andreas ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 1/3] 4xm: prevent overflow during bit rate calculation
Hi, On Tue, Dec 13, 2016 at 7:57 PM, Andreas Cadhalpun < andreas.cadhal...@googlemail.com> wrote: > Signed-off-by: Andreas Cadhalpun> --- > libavformat/4xm.c | 8 +++- > 1 file changed, 7 insertions(+), 1 deletion(-) > > diff --git a/libavformat/4xm.c b/libavformat/4xm.c > index 8a50778..2758b69 100644 > --- a/libavformat/4xm.c > +++ b/libavformat/4xm.c > @@ -163,6 +163,12 @@ static int parse_strk(AVFormatContext *s, > return AVERROR_INVALIDDATA; > } > > +if (fourxm->tracks[track].sample_rate > INT64_MAX / > fourxm->tracks[track].bits / fourxm->tracks[track].channels) { > +av_log(s, AV_LOG_ERROR, "Overflow during bit rate calculation %d > * %d * %d\n", > + fourxm->tracks[track].sample_rate, > fourxm->tracks[track].bits, fourxm->tracks[track].channels); > +return AVERROR_INVALIDDATA; > +} What is the functional effect of the overflow? Does it crash? Or is there some other security issue? Ronald ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 2/3] cafdec: prevent overflow during bit rate calculation
Signed-off-by: Andreas Cadhalpun--- libavformat/cafdec.c | 9 +++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/libavformat/cafdec.c b/libavformat/cafdec.c index 1c4ca40..0e6179a 100644 --- a/libavformat/cafdec.c +++ b/libavformat/cafdec.c @@ -323,8 +323,13 @@ static int read_header(AVFormatContext *s) if (caf->data_size > 0) st->nb_frames = (caf->data_size / caf->bytes_per_packet) * caf->frames_per_packet; } else if (st->nb_index_entries && st->duration > 0) { -st->codecpar->bit_rate = st->codecpar->sample_rate * caf->data_size * 8 / - st->duration; +if (st->codecpar->sample_rate && caf->data_size / st->duration > INT64_MAX / st->codecpar->sample_rate / 8) { +av_log(s, AV_LOG_ERROR, "Overflow during bit rate calculation %d * 8 * %"PRId64"\n", + st->codecpar->sample_rate, caf->data_size / st->duration); +return AVERROR_INVALIDDATA; +} +st->codecpar->bit_rate = st->codecpar->sample_rate * 8LL * + (caf->data_size / st->duration); } else { av_log(s, AV_LOG_ERROR, "Missing packet table. It is required when " "block size or frame size are variable.\n"); -- 2.10.2 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 3/3] mov: prevent overflow during bit rate calculation
Signed-off-by: Andreas Cadhalpun--- libavformat/mov.c | 15 ++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/libavformat/mov.c b/libavformat/mov.c index 6c8affc..fc0b25c 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -5887,8 +5887,15 @@ static int mov_read_header(AVFormatContext *s) for (i = 0; i < s->nb_streams; i++) { AVStream *st = s->streams[i]; MOVStreamContext *sc = st->priv_data; -if (st->duration > 0) +if (st->duration > 0) { +if (sc->data_size > INT64_MAX / sc->time_scale / 8) { +av_log(s, AV_LOG_ERROR, "Overflow during bit rate calculation %"PRId64" * 8 * %d\n", + sc->data_size, sc->time_scale); +mov_read_close(s); +return AVERROR_INVALIDDATA; +} st->codecpar->bit_rate = sc->data_size * 8 * sc->time_scale / st->duration; +} } } @@ -5897,6 +5904,12 @@ static int mov_read_header(AVFormatContext *s) AVStream *st = s->streams[i]; MOVStreamContext *sc = st->priv_data; if (sc->duration_for_fps > 0) { +if (sc->data_size > INT64_MAX / sc->time_scale / 8) { +av_log(s, AV_LOG_ERROR, "Overflow during bit rate calculation %"PRId64" * 8 * %d\n", + sc->data_size, sc->time_scale); +mov_read_close(s); +return AVERROR_INVALIDDATA; +} st->codecpar->bit_rate = sc->data_size * 8 * sc->time_scale / sc->duration_for_fps; } -- 2.10.2 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 1/3] 4xm: prevent overflow during bit rate calculation
Signed-off-by: Andreas Cadhalpun--- libavformat/4xm.c | 8 +++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/libavformat/4xm.c b/libavformat/4xm.c index 8a50778..2758b69 100644 --- a/libavformat/4xm.c +++ b/libavformat/4xm.c @@ -163,6 +163,12 @@ static int parse_strk(AVFormatContext *s, return AVERROR_INVALIDDATA; } +if (fourxm->tracks[track].sample_rate > INT64_MAX / fourxm->tracks[track].bits / fourxm->tracks[track].channels) { +av_log(s, AV_LOG_ERROR, "Overflow during bit rate calculation %d * %d * %d\n", + fourxm->tracks[track].sample_rate, fourxm->tracks[track].bits, fourxm->tracks[track].channels); +return AVERROR_INVALIDDATA; +} + /* allocate a new AVStream */ st = avformat_new_stream(s, NULL); if (!st) @@ -178,7 +184,7 @@ static int parse_strk(AVFormatContext *s, st->codecpar->channels = fourxm->tracks[track].channels; st->codecpar->sample_rate = fourxm->tracks[track].sample_rate; st->codecpar->bits_per_coded_sample = fourxm->tracks[track].bits; -st->codecpar->bit_rate = st->codecpar->channels * +st->codecpar->bit_rate = (int64_t)st->codecpar->channels * st->codecpar->sample_rate * st->codecpar->bits_per_coded_sample; st->codecpar->block_align = st->codecpar->channels * -- 2.10.2 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 1/3] Revert "avcodec: Add max_pixels options"
On 13.12.2016 16:41, Michael Niedermayer wrote: > On Sun, Dec 11, 2016 at 10:38:44PM -0500, compn wrote: >> On Sun, 11 Dec 2016 17:39:58 +0100 >> Nicolas Georgewrote: >> >>> This reverts commit 2f07830e69bd14eaba348eb739b9503e7eb7cd4b. >> >> would you rather the people doing the fuzzing use this feature as a >> separate patch so it does not contaminate master? > > If people want fuzzing (and consequently bug fixes i do) to be done on > a different branch than master this may be possible. > It sounds a bit strange to me but it should at least technically be > possible. I don't think that's a good idea, as it would make fuzzing ffmpeg efficiently harder, while it should be made easier, so that more people do it. Best regards, Andreas ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 2/3] avformat: fix overflows during bit rate calculation
On 13.12.2016 08:14, Paul B Mahol wrote: > On 12/13/16, Andreas Cadhalpunwrote: >> The bit_rate field has type int64_t since commit >> 7404f3bdb90e6a5dcb59bc0a091e2c5c038e557d. >> >> Signed-off-by: Andreas Cadhalpun >> --- >> libavformat/adxdec.c | 2 +- >> libavformat/aiffdec.c| 4 ++-- >> libavformat/apc.c| 2 +- >> libavformat/bfi.c| 2 +- >> libavformat/electronicarts.c | 2 +- >> libavformat/iff.c| 2 +- >> libavformat/soxdec.c | 2 +- >> libavformat/voc_packet.c | 2 +- >> libavformat/vqf.c| 2 +- >> libavformat/wsddec.c | 2 +- >> 10 files changed, 11 insertions(+), 11 deletions(-) >> > > probably ok Pushed. > Maybe my C sucks, but isn't this already covered when 8LL is used for > some cases? No. The multiplications are done from left to right, so unless the 8LL is part of the first multiplication, that operation is still dealing with int32_t and can thus overflow. Best regards, Andreas ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 1/3] omadec: fix overflows during bit rate calculation
On 13.12.2016 08:11, Paul B Mahol wrote: > On 12/13/16, Andreas Cadhalpunwrote: >> Signed-off-by: Andreas Cadhalpun >> --- >> libavformat/omadec.c | 4 ++-- >> 1 file changed, 2 insertions(+), 2 deletions(-) >> >> diff --git a/libavformat/omadec.c b/libavformat/omadec.c >> index 6e476db..e7751d0 100644 >> --- a/libavformat/omadec.c >> +++ b/libavformat/omadec.c >> @@ -365,7 +365,7 @@ static int oma_read_header(AVFormatContext *s) >> st->codecpar->channels= 2; >> st->codecpar->channel_layout = AV_CH_LAYOUT_STEREO; >> st->codecpar->sample_rate = samplerate; >> -st->codecpar->bit_rate= st->codecpar->sample_rate * framesize * >> 8 / 1024; >> +st->codecpar->bit_rate= st->codecpar->sample_rate * framesize / >> 128; >> >> /* fake the ATRAC3 extradata >> * (wav format, makes stream copy to wav work) */ >> @@ -398,7 +398,7 @@ static int oma_read_header(AVFormatContext *s) >> return AVERROR_INVALIDDATA; >> } >> st->codecpar->sample_rate = samplerate; >> -st->codecpar->bit_rate= samplerate * framesize * 8 / 2048; >> +st->codecpar->bit_rate= samplerate * framesize / 256; >> avpriv_set_pts_info(st, 64, 1, samplerate); >> break; >> case OMA_CODECID_MP3: > > Shouldn't using 8LL or similar be more future-proof? Why multiply with 8 when dividing by a multiple of 8 directly afterwards? That's just a waste of computational resources. If sample_rate and/or framesize get larger in the future, a cast can be added. Best regards, Andreas ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] swresample/resample: remove swri_resample function
On 12/14/16, Michael Niedermayerwrote: > On Wed, Dec 14, 2016 at 01:36:51AM +0700, Muhammad Faiz wrote: >> integrate it inside multiple_resample >> allow some calculations to be performed outside loop >> >> Suggested-By: Michael Niedermayer >> Signed-off-by: Muhammad Faiz >> --- >> libswresample/resample.c | 79 >> +--- >> 1 file changed, 35 insertions(+), 44 deletions(-) > > should be ok > > thx Applied Thank's ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 3/3] tiff: fix overflows when calling av_readuce
On 13.12.2016 01:32, Michael Niedermayer wrote: > On Tue, Dec 13, 2016 at 12:50:19AM +0100, Andreas Cadhalpun wrote: >> The arguments of av_reduce are signed, so the cast to uint64_t is misleading. >> >> Signed-off-by: Andreas Cadhalpun>> --- >> libavcodec/tiff.c | 11 +-- >> 1 file changed, 9 insertions(+), 2 deletions(-) >> >> diff --git a/libavcodec/tiff.c b/libavcodec/tiff.c >> index 4721e94..12ef419 100644 >> --- a/libavcodec/tiff.c >> +++ b/libavcodec/tiff.c >> @@ -772,9 +772,16 @@ static void set_sar(TiffContext *s, unsigned tag, >> unsigned num, unsigned den) >> int offset = tag == TIFF_YRES ? 2 : 0; >> s->res[offset++] = num; >> s->res[offset] = den; >> -if (s->res[0] && s->res[1] && s->res[2] && s->res[3]) >> +if (s->res[0] && s->res[1] && s->res[2] && s->res[3]) { >> +uint64_t num = s->res[2] * (uint64_t)s->res[1]; >> +uint64_t den = s->res[0] * (uint64_t)s->res[3]; >> +if (num > INT64_MAX || den > INT64_MAX) { >> +num = num >> 1; >> +den = den >> 1; >> +} > > this can make one of them 0, in fact i think even if they arent 0 > the sample_aspect_ratio can be after reduce > should they be checked after all that instead of before ? I've added a check for !s->avctx->sample_aspect_ratio.den after av_reduce. The check before is still necessary to prevent sample_aspect_ratio from becoming negative. Best regards, Andreas >From 3cd8cb663d762bc15694e285ea48cdb8e9abfd4b Mon Sep 17 00:00:00 2001 From: Andreas Cadhalpun Date: Tue, 13 Dec 2016 00:43:21 +0100 Subject: [PATCH] tiff: fix overflows when calling av_reduce The arguments of av_reduce are signed, so the cast to uint64_t is misleading. Signed-off-by: Andreas Cadhalpun --- libavcodec/tiff.c | 13 +++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/libavcodec/tiff.c b/libavcodec/tiff.c index 4721e94..7ccda51 100644 --- a/libavcodec/tiff.c +++ b/libavcodec/tiff.c @@ -772,9 +772,18 @@ static void set_sar(TiffContext *s, unsigned tag, unsigned num, unsigned den) int offset = tag == TIFF_YRES ? 2 : 0; s->res[offset++] = num; s->res[offset] = den; -if (s->res[0] && s->res[1] && s->res[2] && s->res[3]) +if (s->res[0] && s->res[1] && s->res[2] && s->res[3]) { +uint64_t num = s->res[2] * (uint64_t)s->res[1]; +uint64_t den = s->res[0] * (uint64_t)s->res[3]; +if (num > INT64_MAX || den > INT64_MAX) { +num = num >> 1; +den = den >> 1; +} av_reduce(>avctx->sample_aspect_ratio.num, >avctx->sample_aspect_ratio.den, - s->res[2] * (uint64_t)s->res[1], s->res[0] * (uint64_t)s->res[3], INT32_MAX); + num, den, INT32_MAX); +if (!s->avctx->sample_aspect_ratio.den) +s->avctx->sample_aspect_ratio = (AVRational) {0, 1}; +} } static int tiff_decode_tag(TiffContext *s, AVFrame *frame) -- 2.10.2 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] swresample/resample: remove swri_resample function
On Wed, Dec 14, 2016 at 01:36:51AM +0700, Muhammad Faiz wrote: > integrate it inside multiple_resample > allow some calculations to be performed outside loop > > Suggested-By: Michael Niedermayer> Signed-off-by: Muhammad Faiz > --- > libswresample/resample.c | 79 > +--- > 1 file changed, 35 insertions(+), 44 deletions(-) should be ok thx [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Complexity theory is the science of finding the exact solution to an approximation. Benchmarking OTOH is finding an approximation of the exact signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] libavcodec : add psd image file decoder
2016-11-24 21:35 GMT+01:00 Martin Vignali: > Hello > > New patchs in attach > > I changed the dimensions check, the check is now : > > if ((s->height > 3) && (s->avctx->strict_std_compliance > > FF_COMPLIANCE_EXPERIMENTAL)) { > av_log(s->avctx, AV_LOG_ERROR, >"Height > 3 is experimental, add " >"'-strict %d' if you want to try to decode the picture.\n", >FF_COMPLIANCE_EXPERIMENTAL); > return AVERROR_EXPERIMENTAL; > } > > s->width = bytestream2_get_be32(>gb); > if ((s->width > 3) && (s->avctx->strict_std_compliance > > FF_COMPLIANCE_EXPERIMENTAL)) { > av_log(s->avctx, AV_LOG_ERROR, >"Width > 3 is experimental, add " >"'-strict %d' if you want to try to decode the picture.\n", >FF_COMPLIANCE_EXPERIMENTAL); > return AVERROR_EXPERIMENTAL; > } > > > and change the line_size variable (in PSD Context) to uint_64 (because > now, width can be > 3 if -strict set to experimental) > > I will send a patch for fate test in another discussion. > > Martin > Ping Martin ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH v3] avformat/rtsp: introduce get_sa_len() function
On Fri, Nov 25, 2016 at 03:17:22PM +0800, Kevin Lo wrote: > Since the Linux implementation of sockaddr doesn't have sa_len as a member, > but the FreeBSD version does, introduce a get_sa_len() function that > determines the size based on the address family. > > Signed-off-by: Kevin Lo> --- > > v3: Check for the right feature when using a sockaddr_in6. > Some systems, such as OS/2, define AF_INET6 without a full implementation. > > diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c > index c6292c5..ff0e221 100644 > --- a/libavformat/rtsp.c > +++ b/libavformat/rtsp.c It seems nicolas disagrees about this patch in v2, this v3 is still using the same design and you did not reply to nicolas so ill mark this in patchwork as "changes requested" [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB The real ebay dictionary, page 2 "100% positive feedback" - "All either got their money back or didnt complain" "Best seller ever, very honest" - "Seller refunded buyer after failed scam" signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] ARM fate
Am 12.12.16 um 22:18 schrieb Michael Niedermayer: > Hi all > > The panda arm board iam using as fate client for fate.ffmpeg.org seems > not really able to handle the load. > Iam not sure why, but increasing number of fate tests, branches it > tests and compiler/option cases probably are the primary reason. > I already dropped half the branches it tests but it still needs > apparently on the order of a week for a single pass. > > It would make alot of sense if more people could help here and run > some arm fate clients so that stuff gets tested more regularly and > with less latency I'm currently setting up another FATE on a dragonboard (Cortex-A53). (And maintaining all my other clients) -Thilo ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] Save FFmpeg colorspace info in openh264 video files.
On Fri, Dec 09, 2016 at 01:15:14PM -0500, Gregory J. Wolfe wrote: > As of version 1.6, libopenh264 saves (in the output video file) > information about the color primaries, transfer characteristics, > and color matrix used when the video pixel data was created. > This patch sets the required libopenh264 data structures using > the FFmpeg colorspace information so that video players will > know how to properly decode video files created using FFmpeg > and libopenh264. > > Signed-off-by: Gregory J. Wolfe> --- > libavcodec/libopenh264enc.c | 61 > + > 1 file changed, 61 insertions(+) as with the other patch the commit message should start with a summary line that starts with the part that is changed [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Its not that you shouldnt use gotos but rather that you should write readable code and code with gotos often but not always is less readable signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] Allow client to enable/disable openh264 load balancing.
On Thu, Dec 01, 2016 at 03:52:55PM -0500, Gregory J. Wolfe wrote: > The libopenh264 library allows the client to enable or disable > load balancing when running multi-threaded. When enabled, the > slice sizes are dynamically adjusted in order to use the > multiple threads more efficiently. However, this can also lead > to valid but slightly different results from run to run. > Disabling load balancing prevents dynamic slice adjustment and > yields repeatable results when running multi-threaded, which can > be important when running test cases. > > Signed-off-by: Gregory J. Wolfe> --- > libavcodec/libopenh264enc.c | 8 > 1 file changed, 8 insertions(+) Commit messages should start with the part that is changes like libavcodec/libopenh264enc: ... please see the developer docs, if you havent read them thx [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB If you fake or manipulate statistics in a paper in physics you will never get a job again. If you fake or manipulate statistics in a paper in medicin you will get a job for life at the pharma industry. signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] libvpxenc: Don't spam level errors for VP8 encodes
On Mon, Dec 12, 2016 at 2:41 PM, James Zernwrote: > On Mon, Dec 12, 2016 at 12:12 PM, Alex Converse > wrote: >> Fixes "Failed to set VP9E_GET_LEVEL codec control: Codec does not >> implement requested capability" log messages on VP8 encodes. >> --- >> libavcodec/libvpxenc.c | 3 ++- >> 1 file changed, 2 insertions(+), 1 deletion(-) > > lgtm Pushed ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] swresample/resample: remove swri_resample function
integrate it inside multiple_resample allow some calculations to be performed outside loop Suggested-By: Michael NiedermayerSigned-off-by: Muhammad Faiz --- libswresample/resample.c | 79 +--- 1 file changed, 35 insertions(+), 44 deletions(-) diff --git a/libswresample/resample.c b/libswresample/resample.c index ce6a82f..8e2f769 100644 --- a/libswresample/resample.c +++ b/libswresample/resample.c @@ -467,70 +467,61 @@ static int set_compensation(ResampleContext *c, int sample_delta, int compensati return 0; } -static int swri_resample(ResampleContext *c, - uint8_t *dst, const uint8_t *src, int *consumed, - int src_size, int dst_size, int update_ctx) -{ +static int multiple_resample(ResampleContext *c, AudioData *dst, int dst_size, AudioData *src, int src_size, int *consumed){ +int i; +int av_unused mm_flags = av_get_cpu_flags(); +int need_emms = c->format == AV_SAMPLE_FMT_S16P && ARCH_X86_32 && +(mm_flags & (AV_CPU_FLAG_MMX2 | AV_CPU_FLAG_SSE2)) == AV_CPU_FLAG_MMX2; +int64_t max_src_size = (INT64_MAX/2 / c->phase_count) / c->src_incr; + +if (c->compensation_distance) +dst_size = FFMIN(dst_size, c->compensation_distance); +src_size = FFMIN(src_size, max_src_size); + +*consumed = 0; + if (c->filter_length == 1 && c->phase_count == 1) { -int index= c->index; -int frac= c->frac; -int64_t index2= (1LL<<32)*c->frac/c->src_incr + (1LL<<32)*index; +int64_t index2= (1LL<<32)*c->frac/c->src_incr + (1LL<<32)*c->index; int64_t incr= (1LL<<32) * c->dst_incr / c->src_incr; -int new_size = (src_size * (int64_t)c->src_incr - frac + c->dst_incr - 1) / c->dst_incr; +int new_size = (src_size * (int64_t)c->src_incr - c->frac + c->dst_incr - 1) / c->dst_incr; dst_size = FFMAX(FFMIN(dst_size, new_size), 0); -if (dst_size > 0) -c->dsp.resample_one(dst, src, dst_size, index2, incr); - -index += dst_size * c->dst_incr_div; -index += (frac + dst_size * (int64_t)c->dst_incr_mod) / c->src_incr; -av_assert2(index >= 0); -*consumed= index; -if (update_ctx) { -c->frac = (frac + dst_size * (int64_t)c->dst_incr_mod) % c->src_incr; -c->index = 0; +if (dst_size > 0) { +for (i = 0; i < dst->ch_count; i++) { +c->dsp.resample_one(dst->ch[i], src->ch[i], dst_size, index2, incr); +if (i+1 == dst->ch_count) { +c->index += dst_size * c->dst_incr_div; +c->index += (c->frac + dst_size * (int64_t)c->dst_incr_mod) / c->src_incr; +av_assert2(c->index >= 0); +*consumed = c->index; +c->frac = (c->frac + dst_size * (int64_t)c->dst_incr_mod) % c->src_incr; +c->index = 0; +} +} } } else { int64_t end_index = (1LL + src_size - c->filter_length) * c->phase_count; int64_t delta_frac = (end_index - c->index) * c->src_incr - c->frac; int delta_n = (delta_frac + c->dst_incr - 1) / c->dst_incr; +int (*resample_func)(struct ResampleContext *c, void *dst, + const void *src, int n, int update_ctx); dst_size = FFMAX(FFMIN(dst_size, delta_n), 0); if (dst_size > 0) { /* resample_linear and resample_common should have same behavior * when frac and dst_incr_mod are zero */ -if (c->linear && (c->frac || c->dst_incr_mod)) -*consumed = c->dsp.resample_linear(c, dst, src, dst_size, update_ctx); -else -*consumed = c->dsp.resample_common(c, dst, src, dst_size, update_ctx); -} else { -*consumed = 0; +resample_func = (c->linear && (c->frac || c->dst_incr_mod)) ? +c->dsp.resample_linear : c->dsp.resample_common; +for (i = 0; i < dst->ch_count; i++) +*consumed = resample_func(c, dst->ch[i], src->ch[i], dst_size, i+1 == dst->ch_count); } } -return dst_size; -} - -static int multiple_resample(ResampleContext *c, AudioData *dst, int dst_size, AudioData *src, int src_size, int *consumed){ -int i, ret= -1; -int av_unused mm_flags = av_get_cpu_flags(); -int need_emms = c->format == AV_SAMPLE_FMT_S16P && ARCH_X86_32 && -(mm_flags & (AV_CPU_FLAG_MMX2 | AV_CPU_FLAG_SSE2)) == AV_CPU_FLAG_MMX2; -int64_t max_src_size = (INT64_MAX/2 / c->phase_count) / c->src_incr; - -if (c->compensation_distance) -dst_size = FFMIN(dst_size, c->compensation_distance); -src_size = FFMIN(src_size, max_src_size); - -for(i=0; ich_count; i++){ -ret= swri_resample(c, dst->ch[i], src->ch[i], -
Re: [FFmpeg-devel] [PATCH] swresample/resample: do not allow negative dst_size return value
On 12/14/16, Michael Niedermayerwrote: > On Tue, Dec 13, 2016 at 11:15:30PM +0700, Muhammad Faiz wrote: >> On 12/13/16, Michael Niedermayer wrote: >> > On Tue, Dec 13, 2016 at 02:16:03PM +0700, Muhammad Faiz wrote: >> >> This should fix Ticket6012 >> >> >> >> Signed-off-by: Muhammad Faiz >> >> --- >> >> libswresample/resample.c | 7 --- >> >> 1 file changed, 4 insertions(+), 3 deletions(-) >> >> >> >> diff --git a/libswresample/resample.c b/libswresample/resample.c >> >> index 71dffb9..ce6a82f 100644 >> >> --- a/libswresample/resample.c >> >> +++ b/libswresample/resample.c >> >> @@ -478,8 +478,9 @@ static int swri_resample(ResampleContext *c, >> >> int64_t incr= (1LL<<32) * c->dst_incr / c->src_incr; >> >> int new_size = (src_size * (int64_t)c->src_incr - frac + >> >> c->dst_incr - 1) / c->dst_incr; >> >> >> >> -dst_size= FFMIN(dst_size, new_size); >> >> -c->dsp.resample_one(dst, src, dst_size, index2, incr); >> >> +dst_size = FFMAX(FFMIN(dst_size, new_size), 0); >> >> +if (dst_size > 0) >> >> +c->dsp.resample_one(dst, src, dst_size, index2, incr); >> >> >> >> index += dst_size * c->dst_incr_div; >> >> index += (frac + dst_size * (int64_t)c->dst_incr_mod) / >> >> c->src_incr; >> >> @@ -494,7 +495,7 @@ static int swri_resample(ResampleContext *c, >> >> int64_t delta_frac = (end_index - c->index) * c->src_incr - >> >> c->frac; >> >> int delta_n = (delta_frac + c->dst_incr - 1) / c->dst_incr; >> >> >> >> -dst_size = FFMIN(dst_size, delta_n); >> >> +dst_size = FFMAX(FFMIN(dst_size, delta_n), 0); >> > >> > Shouldnt this and other things be done outside the loop that >> > calls swri_resample() ? >> >> For performance reason probably yes, even swri_resample should be >> integrated >> to multiple_resample to avoid redundant calculations. >> >> But this is bugfix patch, and swri_resample should return proper >> dst_size. >> I just follow current code flow. >> >> Patch that improve performance is outside the scope of this patch. >> Probably >> I will post that if this patch is accepted. > > LGTM > > thx Applied Thank's ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] swresample/resample: do not allow negative dst_size return value
On Tue, Dec 13, 2016 at 11:15:30PM +0700, Muhammad Faiz wrote: > On 12/13/16, Michael Niedermayerwrote: > > On Tue, Dec 13, 2016 at 02:16:03PM +0700, Muhammad Faiz wrote: > >> This should fix Ticket6012 > >> > >> Signed-off-by: Muhammad Faiz > >> --- > >> libswresample/resample.c | 7 --- > >> 1 file changed, 4 insertions(+), 3 deletions(-) > >> > >> diff --git a/libswresample/resample.c b/libswresample/resample.c > >> index 71dffb9..ce6a82f 100644 > >> --- a/libswresample/resample.c > >> +++ b/libswresample/resample.c > >> @@ -478,8 +478,9 @@ static int swri_resample(ResampleContext *c, > >> int64_t incr= (1LL<<32) * c->dst_incr / c->src_incr; > >> int new_size = (src_size * (int64_t)c->src_incr - frac + > >> c->dst_incr - 1) / c->dst_incr; > >> > >> -dst_size= FFMIN(dst_size, new_size); > >> -c->dsp.resample_one(dst, src, dst_size, index2, incr); > >> +dst_size = FFMAX(FFMIN(dst_size, new_size), 0); > >> +if (dst_size > 0) > >> +c->dsp.resample_one(dst, src, dst_size, index2, incr); > >> > >> index += dst_size * c->dst_incr_div; > >> index += (frac + dst_size * (int64_t)c->dst_incr_mod) / > >> c->src_incr; > >> @@ -494,7 +495,7 @@ static int swri_resample(ResampleContext *c, > >> int64_t delta_frac = (end_index - c->index) * c->src_incr - > >> c->frac; > >> int delta_n = (delta_frac + c->dst_incr - 1) / c->dst_incr; > >> > >> -dst_size = FFMIN(dst_size, delta_n); > >> +dst_size = FFMAX(FFMIN(dst_size, delta_n), 0); > > > > Shouldnt this and other things be done outside the loop that > > calls swri_resample() ? > > For performance reason probably yes, even swri_resample should be integrated > to multiple_resample to avoid redundant calculations. > > But this is bugfix patch, and swri_resample should return proper dst_size. > I just follow current code flow. > > Patch that improve performance is outside the scope of this patch. Probably > I will post that if this patch is accepted. LGTM 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: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] swresample/resample: do not allow negative dst_size return value
On 12/13/16, Michael Niedermayerwrote: > On Tue, Dec 13, 2016 at 02:16:03PM +0700, Muhammad Faiz wrote: >> This should fix Ticket6012 >> >> Signed-off-by: Muhammad Faiz >> --- >> libswresample/resample.c | 7 --- >> 1 file changed, 4 insertions(+), 3 deletions(-) >> >> diff --git a/libswresample/resample.c b/libswresample/resample.c >> index 71dffb9..ce6a82f 100644 >> --- a/libswresample/resample.c >> +++ b/libswresample/resample.c >> @@ -478,8 +478,9 @@ static int swri_resample(ResampleContext *c, >> int64_t incr= (1LL<<32) * c->dst_incr / c->src_incr; >> int new_size = (src_size * (int64_t)c->src_incr - frac + >> c->dst_incr - 1) / c->dst_incr; >> >> -dst_size= FFMIN(dst_size, new_size); >> -c->dsp.resample_one(dst, src, dst_size, index2, incr); >> +dst_size = FFMAX(FFMIN(dst_size, new_size), 0); >> +if (dst_size > 0) >> +c->dsp.resample_one(dst, src, dst_size, index2, incr); >> >> index += dst_size * c->dst_incr_div; >> index += (frac + dst_size * (int64_t)c->dst_incr_mod) / >> c->src_incr; >> @@ -494,7 +495,7 @@ static int swri_resample(ResampleContext *c, >> int64_t delta_frac = (end_index - c->index) * c->src_incr - >> c->frac; >> int delta_n = (delta_frac + c->dst_incr - 1) / c->dst_incr; >> >> -dst_size = FFMIN(dst_size, delta_n); >> +dst_size = FFMAX(FFMIN(dst_size, delta_n), 0); > > Shouldnt this and other things be done outside the loop that > calls swri_resample() ? For performance reason probably yes, even swri_resample should be integrated to multiple_resample to avoid redundant calculations. But this is bugfix patch, and swri_resample should return proper dst_size. I just follow current code flow. Patch that improve performance is outside the scope of this patch. Probably I will post that if this patch is accepted. Thank's ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 1/3] Revert "avcodec: Add max_pixels options"
On Sun, Dec 11, 2016 at 10:38:44PM -0500, compn wrote: > On Sun, 11 Dec 2016 17:39:58 +0100 > Nicolas Georgewrote: > > > This reverts commit 2f07830e69bd14eaba348eb739b9503e7eb7cd4b. > > would you rather the people doing the fuzzing use this feature as a > separate patch so it does not contaminate master? If people want fuzzing (and consequently bug fixes i do) to be done on a different branch than master this may be possible. It sounds a bit strange to me but it should at least technically be possible. [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB The bravest are surely those who have the clearest vision of what is before them, glory and danger alike, and yet notwithstanding go out to meet it. -- Thucydides signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 1/2] avformat/options_table: Set the default maximum number of streams to 1000
On Tue, Dec 13, 2016 at 12:33:09AM +0100, Andreas Cadhalpun wrote: > On 10.12.2016 20:15, Michael Niedermayer wrote: > > Fixes CVE-2016-9561 > > I think the commit message should mention that the security relevance of > this is disputed, as running out of memory can happen with valid files. changed > > > Suggested-by: Andreas Cadhalpun> > Signed-off-by: Michael Niedermayer > > --- > > libavformat/options_table.h | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/libavformat/options_table.h b/libavformat/options_table.h > > index d5448e503f..a537dda95e 100644 > > --- a/libavformat/options_table.h > > +++ b/libavformat/options_table.h > > @@ -105,7 +105,7 @@ static const AVOption avformat_options[] = { > > {"format_whitelist", "List of demuxers that are allowed to be used", > > OFFSET(format_whitelist), AV_OPT_TYPE_STRING, { .str = NULL }, CHAR_MIN, > > CHAR_MAX, D }, > > {"protocol_whitelist", "List of protocols that are allowed to be used", > > OFFSET(protocol_whitelist), AV_OPT_TYPE_STRING, { .str = NULL }, CHAR_MIN, > > CHAR_MAX, D }, > > {"protocol_blacklist", "List of protocols that are not allowed to be > > used", OFFSET(protocol_blacklist), AV_OPT_TYPE_STRING, { .str = NULL }, > > CHAR_MIN, CHAR_MAX, D }, > > -{"max_streams", "maximum number of streams", OFFSET(max_streams), > > AV_OPT_TYPE_INT, { .i64 = INT_MAX }, 0, INT_MAX, D }, > > +{"max_streams", "maximum number of streams", OFFSET(max_streams), > > AV_OPT_TYPE_INT, { .i64 = 1000 }, 0, INT_MAX, D }, > > {NULL}, > > }; > > The change itself looks good to me. applied thanks [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB It is dangerous to be right in matters on which the established authorities are wrong. -- Voltaire signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] swresample/resample: do not allow negative dst_size return value
On Tue, Dec 13, 2016 at 02:16:03PM +0700, Muhammad Faiz wrote: > This should fix Ticket6012 > > Signed-off-by: Muhammad Faiz> --- > libswresample/resample.c | 7 --- > 1 file changed, 4 insertions(+), 3 deletions(-) > > diff --git a/libswresample/resample.c b/libswresample/resample.c > index 71dffb9..ce6a82f 100644 > --- a/libswresample/resample.c > +++ b/libswresample/resample.c > @@ -478,8 +478,9 @@ static int swri_resample(ResampleContext *c, > int64_t incr= (1LL<<32) * c->dst_incr / c->src_incr; > int new_size = (src_size * (int64_t)c->src_incr - frac + c->dst_incr > - 1) / c->dst_incr; > > -dst_size= FFMIN(dst_size, new_size); > -c->dsp.resample_one(dst, src, dst_size, index2, incr); > +dst_size = FFMAX(FFMIN(dst_size, new_size), 0); > +if (dst_size > 0) > +c->dsp.resample_one(dst, src, dst_size, index2, incr); > > index += dst_size * c->dst_incr_div; > index += (frac + dst_size * (int64_t)c->dst_incr_mod) / c->src_incr; > @@ -494,7 +495,7 @@ static int swri_resample(ResampleContext *c, > int64_t delta_frac = (end_index - c->index) * c->src_incr - c->frac; > int delta_n = (delta_frac + c->dst_incr - 1) / c->dst_incr; > > -dst_size = FFMIN(dst_size, delta_n); > +dst_size = FFMAX(FFMIN(dst_size, delta_n), 0); Shouldnt this and other things be done outside the loop that calls swri_resample() ? [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB The real ebay dictionary, page 1 "Used only once"- "Some unspecified defect prevented a second use" "In good condition" - "Can be repaird by experienced expert" "As is" - "You wouldnt want it even if you were payed for it, if you knew ..." signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] ffmpeg: add ffmpeg_d3d11va
On Tue, 13 Dec 2016 14:19:35 +0100 Steve Lhommewrote: > From: Steve Lhomme > > The code is similar to ffmpeg_dxva2. The decoded output needs to be copied > into > a staging texture that can be accessed by the CPU as the decoder texture can't > be accessed by the CPU. > --- > Makefile | 1 + > configure | 14 ++ > ffmpeg.h | 2 + > ffmpeg_d3d11va.c | 416 +++ > ffmpeg_opt.c | 3 + > libavutil/Makefile | 3 + > libavutil/hwcontext.c | 3 + > libavutil/hwcontext.h | 1 + > libavutil/hwcontext_d3d11va.c | 436 > + > libavutil/hwcontext_d3d11va.h | 74 +++ > libavutil/hwcontext_internal.h | 1 + > libavutil/version.h| 2 +- > 12 files changed, 955 insertions(+), 1 deletion(-) > create mode 100644 ffmpeg_d3d11va.c > create mode 100644 libavutil/hwcontext_d3d11va.c > create mode 100644 libavutil/hwcontext_d3d11va.h > > diff --git a/Makefile b/Makefile > index 8aa72fd..a48d471 100644 > --- a/Makefile > +++ b/Makefile > @@ -38,6 +38,7 @@ OBJS-ffmpeg-$(CONFIG_VDA) += ffmpeg_videotoolbox.o > endif > OBJS-ffmpeg-$(CONFIG_CUVID) += ffmpeg_cuvid.o > OBJS-ffmpeg-$(HAVE_DXVA2_LIB) += ffmpeg_dxva2.o > +OBJS-ffmpeg-$(HAVE_D3D11VA_LIB) += ffmpeg_d3d11va.o > OBJS-ffmpeg-$(HAVE_VDPAU_X11) += ffmpeg_vdpau.o > OBJS-ffserver += ffserver_config.o > > diff --git a/configure b/configure > index 9dfd006..dea8339 100755 > --- a/configure > +++ b/configure > @@ -2050,6 +2050,8 @@ HAVE_LIST=" > $TYPES_LIST > atomics_native > dos_paths > +d3d11va_lib > +d3d11vaapi_cobj > dxva2_lib > dxva2api_cobj > libc_msvcrt > @@ -6037,6 +6039,15 @@ enabled dxva2api_h && > int main(void) { IDirectXVideoDecoder *o = NULL; > IDirectXVideoDecoder_Release(o); return 0; } > EOF > > +enabled d3d11_h && > +check_cc < +#define _WIN32_WINNT 0x0600 > +#define COBJMACROS > +#include > +#include > +int main(void) { ID3D11VideoDevice *o = NULL; ID3D11VideoDevice_Release(o); > return 0; } > +EOF > + > enabled vaapi && > check_lib va/va.h vaInitialize -lva || > disable vaapi > @@ -6368,6 +6379,9 @@ if test $target_os = "haiku"; then > disable posix_memalign > fi > > +enabled_all d3d11va d3d11vaapi_cobj && > +enable d3d11va_lib > + > enabled_all dxva2 dxva2api_cobj CoTaskMemFree && > prepend ffmpeg_libs $($ldflags_filter "-lole32") && > enable dxva2_lib > diff --git a/ffmpeg.h b/ffmpeg.h > index ebe5bf0..a12701e 100644 > --- a/ffmpeg.h > +++ b/ffmpeg.h > @@ -61,6 +61,7 @@ enum HWAccelID { > HWACCEL_NONE = 0, > HWACCEL_AUTO, > HWACCEL_VDPAU, > +HWACCEL_D3D11VA, > HWACCEL_DXVA2, > HWACCEL_VDA, > HWACCEL_VIDEOTOOLBOX, > @@ -633,6 +634,7 @@ int ifilter_parameters_from_decoder(InputFilter *ifilter, > const AVCodecContext * > int ffmpeg_parse_options(int argc, char **argv); > > int vdpau_init(AVCodecContext *s); > +int d3d11va_init(AVCodecContext *s); > int dxva2_init(AVCodecContext *s); > int vda_init(AVCodecContext *s); > int videotoolbox_init(AVCodecContext *s); > diff --git a/ffmpeg_d3d11va.c b/ffmpeg_d3d11va.c > new file mode 100644 > index 000..f6f8186 > --- /dev/null > +++ b/ffmpeg_d3d11va.c > @@ -0,0 +1,416 @@ > +/* > + * 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 > + > +#if !defined(_WIN32_WINNT) || _WIN32_WINNT < 0x0600 > +#undef _WIN32_WINNT > +#define _WIN32_WINNT 0x0600 > +#endif > +#define COBJMACROS > + > +#include > + > +#include > + > +#include "ffmpeg.h" > + > +#include "libavcodec/d3d11va.h" > + > +#include "libavutil/avassert.h" > +#include "libavutil/buffer.h" > +#include "libavutil/frame.h" > +#include "libavutil/imgutils.h" > +#include "libavutil/pixfmt.h" > + > +#include "libavutil/hwcontext.h" > +#include "libavutil/hwcontext_d3d11va.h" > + > +/* define all the GUIDs used directly here, > + to avoid problems with inconsistent dxva2api.h versions in mingw-w64 and > different MSVC version */ > +#include > +DEFINE_GUID(DXVA2_ModeMPEG2_VLD,
[FFmpeg-devel] [PATCH] ffmpeg: add ffmpeg_d3d11va
From: Steve LhommeThe code is similar to ffmpeg_dxva2. The decoded output needs to be copied into a staging texture that can be accessed by the CPU as the decoder texture can't be accessed by the CPU. --- Makefile | 1 + configure | 14 ++ ffmpeg.h | 2 + ffmpeg_d3d11va.c | 416 +++ ffmpeg_opt.c | 3 + libavutil/Makefile | 3 + libavutil/hwcontext.c | 3 + libavutil/hwcontext.h | 1 + libavutil/hwcontext_d3d11va.c | 436 + libavutil/hwcontext_d3d11va.h | 74 +++ libavutil/hwcontext_internal.h | 1 + libavutil/version.h| 2 +- 12 files changed, 955 insertions(+), 1 deletion(-) create mode 100644 ffmpeg_d3d11va.c create mode 100644 libavutil/hwcontext_d3d11va.c create mode 100644 libavutil/hwcontext_d3d11va.h diff --git a/Makefile b/Makefile index 8aa72fd..a48d471 100644 --- a/Makefile +++ b/Makefile @@ -38,6 +38,7 @@ OBJS-ffmpeg-$(CONFIG_VDA) += ffmpeg_videotoolbox.o endif OBJS-ffmpeg-$(CONFIG_CUVID) += ffmpeg_cuvid.o OBJS-ffmpeg-$(HAVE_DXVA2_LIB) += ffmpeg_dxva2.o +OBJS-ffmpeg-$(HAVE_D3D11VA_LIB) += ffmpeg_d3d11va.o OBJS-ffmpeg-$(HAVE_VDPAU_X11) += ffmpeg_vdpau.o OBJS-ffserver += ffserver_config.o diff --git a/configure b/configure index 9dfd006..dea8339 100755 --- a/configure +++ b/configure @@ -2050,6 +2050,8 @@ HAVE_LIST=" $TYPES_LIST atomics_native dos_paths +d3d11va_lib +d3d11vaapi_cobj dxva2_lib dxva2api_cobj libc_msvcrt @@ -6037,6 +6039,15 @@ enabled dxva2api_h && int main(void) { IDirectXVideoDecoder *o = NULL; IDirectXVideoDecoder_Release(o); return 0; } EOF +enabled d3d11_h && +check_cc < +#include +int main(void) { ID3D11VideoDevice *o = NULL; ID3D11VideoDevice_Release(o); return 0; } +EOF + enabled vaapi && check_lib va/va.h vaInitialize -lva || disable vaapi @@ -6368,6 +6379,9 @@ if test $target_os = "haiku"; then disable posix_memalign fi +enabled_all d3d11va d3d11vaapi_cobj && +enable d3d11va_lib + enabled_all dxva2 dxva2api_cobj CoTaskMemFree && prepend ffmpeg_libs $($ldflags_filter "-lole32") && enable dxva2_lib diff --git a/ffmpeg.h b/ffmpeg.h index ebe5bf0..a12701e 100644 --- a/ffmpeg.h +++ b/ffmpeg.h @@ -61,6 +61,7 @@ enum HWAccelID { HWACCEL_NONE = 0, HWACCEL_AUTO, HWACCEL_VDPAU, +HWACCEL_D3D11VA, HWACCEL_DXVA2, HWACCEL_VDA, HWACCEL_VIDEOTOOLBOX, @@ -633,6 +634,7 @@ int ifilter_parameters_from_decoder(InputFilter *ifilter, const AVCodecContext * int ffmpeg_parse_options(int argc, char **argv); int vdpau_init(AVCodecContext *s); +int d3d11va_init(AVCodecContext *s); int dxva2_init(AVCodecContext *s); int vda_init(AVCodecContext *s); int videotoolbox_init(AVCodecContext *s); diff --git a/ffmpeg_d3d11va.c b/ffmpeg_d3d11va.c new file mode 100644 index 000..f6f8186 --- /dev/null +++ b/ffmpeg_d3d11va.c @@ -0,0 +1,416 @@ +/* + * 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 + +#if !defined(_WIN32_WINNT) || _WIN32_WINNT < 0x0600 +#undef _WIN32_WINNT +#define _WIN32_WINNT 0x0600 +#endif +#define COBJMACROS + +#include + +#include + +#include "ffmpeg.h" + +#include "libavcodec/d3d11va.h" + +#include "libavutil/avassert.h" +#include "libavutil/buffer.h" +#include "libavutil/frame.h" +#include "libavutil/imgutils.h" +#include "libavutil/pixfmt.h" + +#include "libavutil/hwcontext.h" +#include "libavutil/hwcontext_d3d11va.h" + +/* define all the GUIDs used directly here, + to avoid problems with inconsistent dxva2api.h versions in mingw-w64 and different MSVC version */ +#include +DEFINE_GUID(DXVA2_ModeMPEG2_VLD, 0xee27417f, 0x5e28,0x4e65,0xbe,0xea,0x1d,0x26,0xb5,0x08,0xad,0xc9); +DEFINE_GUID(DXVA2_ModeMPEG2and1_VLD, 0x86695f12, 0x340e,0x4f04,0x9f,0xd3,0x92,0x53,0xdd,0x32,0x74,0x60); +DEFINE_GUID(DXVA2_ModeH264_E, 0x1b81be68, 0xa0c7,0x11d3,0xb9,0x84,0x00,0xc0,0x4f,0x2e,0x73,0xc5); +DEFINE_GUID(DXVA2_ModeH264_F, 0x1b81be69, 0xa0c7,0x11d3,0xb9,0x84,0x00,0xc0,0x4f,0x2e,0x73,0xc5); +DEFINE_GUID(DXVADDI_Intel_ModeH264_E,
[FFmpeg-devel] [PATCH] configure: use -O1 with MSVC by default
From: Steve LhommeOtherwise some ARM and other unsupported CPU is linked with -O0 --- configure | 1 + 1 file changed, 1 insertion(+) diff --git a/configure b/configure index 9dfd006..d623ced 100755 --- a/configure +++ b/configure @@ -4087,6 +4087,7 @@ probe_cc(){ _DEPFLAGS='$(CPPFLAGS) $(CFLAGS) -showIncludes -Zs' _cflags_speed="-O2" _cflags_size="-O1" +_cflags_noopt="-O1" if $_cc -nologo- 2>&1 | grep -q Linker; then _ld_o='-out:$@' else -- 2.10.2 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] ffmpeg: add ffmpeg_d3d11va
From: Steve LhommeThe code is similar to ffmpeg_dxva2. The decoded output needs to be copied into a staging texture that can be accessed by the CPU as the decoder texture can't be accessed by the CPU. --- Makefile | 1 + configure | 14 ++ ffmpeg.h | 2 + ffmpeg_d3d11va.c | 416 +++ ffmpeg_opt.c | 3 + libavutil/Makefile | 3 + libavutil/hwcontext.c | 3 + libavutil/hwcontext.h | 1 + libavutil/hwcontext_d3d11va.c | 436 + libavutil/hwcontext_d3d11va.h | 74 +++ libavutil/hwcontext_internal.h | 1 + libavutil/version.h| 2 +- 12 files changed, 955 insertions(+), 1 deletion(-) create mode 100644 ffmpeg_d3d11va.c create mode 100644 libavutil/hwcontext_d3d11va.c create mode 100644 libavutil/hwcontext_d3d11va.h diff --git a/Makefile b/Makefile index 8aa72fd..a48d471 100644 --- a/Makefile +++ b/Makefile @@ -38,6 +38,7 @@ OBJS-ffmpeg-$(CONFIG_VDA) += ffmpeg_videotoolbox.o endif OBJS-ffmpeg-$(CONFIG_CUVID) += ffmpeg_cuvid.o OBJS-ffmpeg-$(HAVE_DXVA2_LIB) += ffmpeg_dxva2.o +OBJS-ffmpeg-$(HAVE_D3D11VA_LIB) += ffmpeg_d3d11va.o OBJS-ffmpeg-$(HAVE_VDPAU_X11) += ffmpeg_vdpau.o OBJS-ffserver += ffserver_config.o diff --git a/configure b/configure index 9dfd006..dea8339 100755 --- a/configure +++ b/configure @@ -2050,6 +2050,8 @@ HAVE_LIST=" $TYPES_LIST atomics_native dos_paths +d3d11va_lib +d3d11vaapi_cobj dxva2_lib dxva2api_cobj libc_msvcrt @@ -6037,6 +6039,15 @@ enabled dxva2api_h && int main(void) { IDirectXVideoDecoder *o = NULL; IDirectXVideoDecoder_Release(o); return 0; } EOF +enabled d3d11_h && +check_cc < +#include +int main(void) { ID3D11VideoDevice *o = NULL; ID3D11VideoDevice_Release(o); return 0; } +EOF + enabled vaapi && check_lib va/va.h vaInitialize -lva || disable vaapi @@ -6368,6 +6379,9 @@ if test $target_os = "haiku"; then disable posix_memalign fi +enabled_all d3d11va d3d11vaapi_cobj && +enable d3d11va_lib + enabled_all dxva2 dxva2api_cobj CoTaskMemFree && prepend ffmpeg_libs $($ldflags_filter "-lole32") && enable dxva2_lib diff --git a/ffmpeg.h b/ffmpeg.h index ebe5bf0..a12701e 100644 --- a/ffmpeg.h +++ b/ffmpeg.h @@ -61,6 +61,7 @@ enum HWAccelID { HWACCEL_NONE = 0, HWACCEL_AUTO, HWACCEL_VDPAU, +HWACCEL_D3D11VA, HWACCEL_DXVA2, HWACCEL_VDA, HWACCEL_VIDEOTOOLBOX, @@ -633,6 +634,7 @@ int ifilter_parameters_from_decoder(InputFilter *ifilter, const AVCodecContext * int ffmpeg_parse_options(int argc, char **argv); int vdpau_init(AVCodecContext *s); +int d3d11va_init(AVCodecContext *s); int dxva2_init(AVCodecContext *s); int vda_init(AVCodecContext *s); int videotoolbox_init(AVCodecContext *s); diff --git a/ffmpeg_d3d11va.c b/ffmpeg_d3d11va.c new file mode 100644 index 000..f6f8186 --- /dev/null +++ b/ffmpeg_d3d11va.c @@ -0,0 +1,416 @@ +/* + * 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 + +#if !defined(_WIN32_WINNT) || _WIN32_WINNT < 0x0600 +#undef _WIN32_WINNT +#define _WIN32_WINNT 0x0600 +#endif +#define COBJMACROS + +#include + +#include + +#include "ffmpeg.h" + +#include "libavcodec/d3d11va.h" + +#include "libavutil/avassert.h" +#include "libavutil/buffer.h" +#include "libavutil/frame.h" +#include "libavutil/imgutils.h" +#include "libavutil/pixfmt.h" + +#include "libavutil/hwcontext.h" +#include "libavutil/hwcontext_d3d11va.h" + +/* define all the GUIDs used directly here, + to avoid problems with inconsistent dxva2api.h versions in mingw-w64 and different MSVC version */ +#include +DEFINE_GUID(DXVA2_ModeMPEG2_VLD, 0xee27417f, 0x5e28,0x4e65,0xbe,0xea,0x1d,0x26,0xb5,0x08,0xad,0xc9); +DEFINE_GUID(DXVA2_ModeMPEG2and1_VLD, 0x86695f12, 0x340e,0x4f04,0x9f,0xd3,0x92,0x53,0xdd,0x32,0x74,0x60); +DEFINE_GUID(DXVA2_ModeH264_E, 0x1b81be68, 0xa0c7,0x11d3,0xb9,0x84,0x00,0xc0,0x4f,0x2e,0x73,0xc5); +DEFINE_GUID(DXVA2_ModeH264_F, 0x1b81be69, 0xa0c7,0x11d3,0xb9,0x84,0x00,0xc0,0x4f,0x2e,0x73,0xc5); +DEFINE_GUID(DXVADDI_Intel_ModeH264_E,
Re: [FFmpeg-devel] ffmpeg: Error resizing AVI file
2016-12-13 5:21 GMT+01:00 Albert: > Greetings. On Ubuntu 17.04 I have encountered an error while running ffmpeg > 3.2.2 Thank you for the sample, I opened ticket #6019. Carl Eugen ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] lavf/mov.c: Set skip_samples according to first edit list, when -ignore_editlist is set.
On Fri, 11 Nov 2016 22:02:28 -0800 Sasi Inguvawrote: > Signed-off-by: Sasi Inguva > --- > libavformat/isom.h | 2 ++ > libavformat/mov.c | 22 +- > 2 files changed, 23 insertions(+), 1 deletion(-) > > diff --git a/libavformat/isom.h b/libavformat/isom.h > index d684502..6a8a4e3 100644 > --- a/libavformat/isom.h > +++ b/libavformat/isom.h > @@ -164,6 +164,8 @@ typedef struct MOVStreamContext { > uint32_t tmcd_flags; ///< tmcd track flags > int64_t track_end;///< used for dts generation in fragmented movie > files > int start_pad;///< amount of samples to skip due to enc-dec delay > +int first_elist_start_time; ///< first edit list start time. > +int num_non_empty_elst; ///< number of non empty edit lists. > unsigned int rap_group_count; > MOVSbgp *rap_group; > > diff --git a/libavformat/mov.c b/libavformat/mov.c > index 9ec7d03..676694e 100644 > --- a/libavformat/mov.c > +++ b/libavformat/mov.c > @@ -3245,6 +3245,12 @@ static void mov_build_index(MOVContext *mov, AVStream > *st) > } > } > > +/* Adjust skip_samples correctly when ignore_editlist is set, to support > gapless playback */ > +if (mov->ignore_editlist && sc->num_non_empty_elst <= 1 && > +st->codecpar->codec_id == AV_CODEC_ID_AAC && > sc->first_elist_start_time > 0) { > +sc->start_pad = sc->first_elist_start_time; > +} > + > /* only use old uncompressed audio chunk demuxing when stts specifies it > */ > if (!(st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO && >sc->stts_count == 1 && sc->stts_data[0].duration == 1)) { > @@ -4424,9 +4430,11 @@ static int mov_read_elst(MOVContext *c, AVIOContext > *pb, MOVAtom atom) > MOVStreamContext *sc; > int i, edit_count, version; > > -if (c->fc->nb_streams < 1 || c->ignore_editlist) > +if (c->fc->nb_streams < 1) > return 0; > sc = c->fc->streams[c->fc->nb_streams-1]->priv_data; > +sc->first_elist_start_time = 0; > +sc->num_non_empty_elst = 0; > > version = avio_r8(pb); /* version */ > avio_rb24(pb); /* flags */ > @@ -4463,9 +4471,21 @@ static int mov_read_elst(MOVContext *c, AVIOContext > *pb, MOVAtom atom) > c->fc->nb_streams-1, i, e->time); > return AVERROR_INVALIDDATA; > } > + > +if (!sc->first_elist_start_time && e->time > 0) { > +sc->first_elist_start_time = e->time; > +} > + > +if (e->time >= 0) { > +sc->num_non_empty_elst++; > +} > } > sc->elst_count = i; > > +if (c->ignore_editlist) { > +av_freep(>elst_data); > +sc->elst_count = 0; > +} > return 0; > } > Why only AAC? ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avfilter/avfilter: fix filtering frames with unknown channel layouts for filters needing writable frames
On Tue, 13 Dec 2016, Paul B Mahol wrote: On 12/12/16, Marton Balintwrote: Signed-off-by: Marton Balint --- libavfilter/avfilter.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) lgtm Thanks, pushed. Regards, Marton ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel