Re: [FFmpeg-devel] FFmpeg 3.5 / 4.0
On 2/19/18, James Almer wrote: > On 2/18/2018 10:50 PM, Michael Niedermayer wrote: >> Hi >> >> Its 4 months since 3.4 was branched so its time for a new major release >> >> Is 4.0 or 3.5 preferred ? > > Definitely 4.0. With the major bump, the removal of ffprobe and WinXP ffprobe is removed? I'm making the fork. > support, catching up with the merge queue, plus a bunch of new API > introductions, using 3.5 for this release doesn't transmits the correct > message to downstream users. > >> Any name suggestions ? >> >> If there are no objections i will likely make that release in the next >> weeks > > The iterate() API for lavfi should be confirmed working and committed > before this release is made, as the rest are already in. But aside from > that i think the path is clear. > >> >> thx >> >> >> >> ___ >> ffmpeg-devel mailing list >> ffmpeg-devel@ffmpeg.org >> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel >> > > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel > ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] FFmpeg 3.5 / 4.0
On Mon, 19 Feb 2018 09:54:57 +0100 Paul B Mahol wrote: > On 2/19/18, James Almer wrote: > > On 2/18/2018 10:50 PM, Michael Niedermayer wrote: > >> Hi > >> > >> Its 4 months since 3.4 was branched so its time for a new major release > >> > >> Is 4.0 or 3.5 preferred ? > > > > Definitely 4.0. With the major bump, the removal of ffprobe and WinXP > > ffprobe is removed? I'm making the fork. He means ffserver of course. Do you still want to work? > > > > support, catching up with the merge queue, plus a bunch of new API > > introductions, using 3.5 for this release doesn't transmits the correct > > message to downstream users. > > > >> Any name suggestions ? I suggest "Green-yellow striped bikeshed". ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 2/2] libavfilter/vf_fps: Rewrite using activate callback
On 16.02.2018 21:09, calvin.wal...@kepstin.ca wrote: Oops, I forgot to remove this bit from the changelog: On Fri, 2018-02-16 at 15:02 -0500, Calvin Walton wrote: TODO: This is still a work in progress. It may have different behaviour in some cases from the old fps filter. I have not yet implemented the "eof_action" option, since I haven't figured out what it's supposed to do. At this point I'm fairly confident that the behaviour matches the existing filter, and that I've gotten the eof_action behaviour correct as well. I have run this patch against some private test files with filter options "fps=1:round=near:eof_action=pass" and found no regressions. So eof_action seems to work fine, indeed. Regards, Tobias ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] lavfi/silence_detect: V3 (updated commit messages)
I have updated all the commit messages, and the typo in patch 6/8 is now clean up - there was no other comment so far. Please review Nicolas Gaullier ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH v3 1/8] lavfi/silencedetect: Add mono mode
In mono mode, silence is detected in any single channel instead of all of them simultaneously --- libavfilter/af_silencedetect.c | 78 +++--- 1 file changed, 51 insertions(+), 27 deletions(-) diff --git a/libavfilter/af_silencedetect.c b/libavfilter/af_silencedetect.c index b048d63738..c53b9d9218 100644 --- a/libavfilter/af_silencedetect.c +++ b/libavfilter/af_silencedetect.c @@ -36,8 +36,10 @@ typedef struct SilenceDetectContext { const AVClass *class; double noise; ///< noise amplitude ratio double duration;///< minimum duration of silence until notification -int64_t nb_null_samples;///< current number of continuous zero samples -int64_t start; ///< if silence is detected, this value contains the time of the first zero sample +int mono; ///< mono mode : check each channel separately (default = check when ALL channels are silent) +int independant_channels; ///< number of entries in following arrays (always 1 in mono mode) +int64_t *nb_null_samples; ///< (array) current number of continuous zero samples +int64_t *start; ///< (array) if silence is detected, this value contains the time of the first zero sample int last_sample_rate; ///< last sample rate to check for sample rate changes void (*silencedetect)(struct SilenceDetectContext *s, AVFrame *insamples, @@ -52,44 +54,55 @@ static const AVOption silencedetect_options[] = { { "noise", "set noise tolerance", OFFSET(noise), AV_OPT_TYPE_DOUBLE, {.dbl=0.001}, 0, DBL_MAX, FLAGS }, { "d", "set minimum duration in seconds", OFFSET(duration), AV_OPT_TYPE_DOUBLE, {.dbl=2.}, 0, 24*60*60, FLAGS }, { "duration", "set minimum duration in seconds", OFFSET(duration), AV_OPT_TYPE_DOUBLE, {.dbl=2.}, 0, 24*60*60, FLAGS }, +{ "mono", "check each channel separately",OFFSET(mono), AV_OPT_TYPE_BOOL, {.i64=0.}, 0, 1, FLAGS }, { NULL } }; AVFILTER_DEFINE_CLASS(silencedetect); -static char *get_metadata_val(AVFrame *insamples, const char *key) +static void set_meta(AVFrame *insamples, int channel, const char *key, char *value) { -AVDictionaryEntry *e = av_dict_get(insamples->metadata, key, NULL, 0); -return e && e->value ? e->value : NULL; -} +char key2[128]; +if (channel) +snprintf(key2, sizeof(key2), "lavfi.%s.%d", key, channel); +else +snprintf(key2, sizeof(key2), "lavfi.%s", key); +av_dict_set(&insamples->metadata, key2, value, 0); +} static av_always_inline void update(SilenceDetectContext *s, AVFrame *insamples, -int is_silence, int64_t nb_samples_notify, +int is_silence, int current_sample, int64_t nb_samples_notify, AVRational time_base) { +int channel = current_sample % s->independant_channels; if (is_silence) { -if (!s->start) { -s->nb_null_samples++; -if (s->nb_null_samples >= nb_samples_notify) { -s->start = insamples->pts - (int64_t)(s->duration / av_q2d(time_base) + .5); -av_dict_set(&insamples->metadata, "lavfi.silence_start", -av_ts2timestr(s->start, &time_base), 0); +if (!s->start[channel]) { +s->nb_null_samples[channel]++; +if (s->nb_null_samples[channel] >= nb_samples_notify) { +s->start[channel] = insamples->pts - (int64_t)(s->duration / av_q2d(time_base) + .5); +set_meta(insamples, s->mono ? channel + 1 : 0, "silence_start", +av_ts2timestr(s->start[channel], &time_base)); +if (s->mono) +av_log(s, AV_LOG_INFO, "channel: %d | ", channel); av_log(s, AV_LOG_INFO, "silence_start: %s\n", - get_metadata_val(insamples, "lavfi.silence_start")); +av_ts2timestr(s->start[channel], &time_base)); } } } else { -if (s->start) { -av_dict_set(&insamples->metadata, "lavfi.silence_end", -av_ts2timestr(insamples->pts, &time_base), 0); -av_dict_set(&insamples->metadata, "lavfi.silence_duration", -av_ts2timestr(insamples->pts - s->start, &time_base), 0); -av_log(s, AV_LOG_INFO, - "silence_end: %s | silence_duration: %s\n", - get_metadata_val(insamples, "lavfi.silence_end"), - get_metadata_val(insamples, "lavfi.silence_duration")); +if (s->start[channel]) { +int64_t end_pts = insamples->pts; +int64_t duration_ts = end_pts - s->start[channel]; +set_meta(insamples, s->mono ? channel + 1 : 0, "silence_end", +a
[FFmpeg-devel] [PATCH v3 2/8] lavfi/silencedetect: Fix when silence_start=0
0 is a valid value for silence_start --- libavfilter/af_silencedetect.c | 14 +- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/libavfilter/af_silencedetect.c b/libavfilter/af_silencedetect.c index c53b9d9218..b4184c2486 100644 --- a/libavfilter/af_silencedetect.c +++ b/libavfilter/af_silencedetect.c @@ -39,7 +39,7 @@ typedef struct SilenceDetectContext { int mono; ///< mono mode : check each channel separately (default = check when ALL channels are silent) int independant_channels; ///< number of entries in following arrays (always 1 in mono mode) int64_t *nb_null_samples; ///< (array) current number of continuous zero samples -int64_t *start; ///< (array) if silence is detected, this value contains the time of the first zero sample +int64_t *start; ///< (array) if silence is detected, this value contains the time of the first zero sample (default/unset = INT64_MIN) int last_sample_rate; ///< last sample rate to check for sample rate changes void (*silencedetect)(struct SilenceDetectContext *s, AVFrame *insamples, @@ -76,7 +76,7 @@ static av_always_inline void update(SilenceDetectContext *s, AVFrame *insamples, { int channel = current_sample % s->independant_channels; if (is_silence) { -if (!s->start[channel]) { +if (s->start[channel] == INT64_MIN) { s->nb_null_samples[channel]++; if (s->nb_null_samples[channel] >= nb_samples_notify) { s->start[channel] = insamples->pts - (int64_t)(s->duration / av_q2d(time_base) + .5); @@ -89,7 +89,7 @@ static av_always_inline void update(SilenceDetectContext *s, AVFrame *insamples, } } } else { -if (s->start[channel]) { +if (s->start[channel] > INT64_MIN) { int64_t end_pts = insamples->pts; int64_t duration_ts = end_pts - s->start[channel]; set_meta(insamples, s->mono ? channel + 1 : 0, "silence_end", @@ -102,7 +102,8 @@ static av_always_inline void update(SilenceDetectContext *s, AVFrame *insamples, av_ts2timestr(end_pts, &time_base), av_ts2timestr(duration_ts, &time_base)); } -s->nb_null_samples[channel] = s->start[channel] = 0; +s->nb_null_samples[channel] = 0; +s->start[channel] = INT64_MIN; } } @@ -129,14 +130,17 @@ static int config_input(AVFilterLink *inlink) { AVFilterContext *ctx = inlink->dst; SilenceDetectContext *s = ctx->priv; +int c; s->independant_channels = s->mono ? inlink->channels : 1; s->nb_null_samples = av_mallocz_array(sizeof(*s->nb_null_samples), s->independant_channels); if (!s->nb_null_samples) return AVERROR(ENOMEM); -s->start = av_mallocz_array(sizeof(*s->start), s->independant_channels); +s->start = av_malloc_array(sizeof(*s->start), s->independant_channels); if (!s->start) return AVERROR(ENOMEM); +for (c = 0; c < s->independant_channels; c++) +s->start[c] = INT64_MIN; switch (inlink->format) { case AV_SAMPLE_FMT_DBL: s->silencedetect = silencedetect_dbl; break; -- 2.15.0 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH v3 3/8] lavfi/silencedetect: Update test parameters
Set relevant filter parameters such that the result can easily be checked with a waveform editor. In particular, it makes it clear the silence_start is not accurate in the current code. --- tests/fate/filter-video.mak | 3 +- tests/ref/fate/filter-metadata-silencedetect | 54 ++-- 2 files changed, 29 insertions(+), 28 deletions(-) diff --git a/tests/fate/filter-video.mak b/tests/fate/filter-video.mak index 221ae81fdc..0575fc6767 100644 --- a/tests/fate/filter-video.mak +++ b/tests/fate/filter-video.mak @@ -720,7 +720,8 @@ fate-filter-metadata-cropdetect: CMD = run $(FILTER_METADATA_COMMAND) "sws_flags SILENCEDETECT_DEPS = FFPROBE AVDEVICE LAVFI_INDEV AMOVIE_FILTER AMR_DEMUXER AMRWB_DECODER SILENCEDETECT_FILTER FATE_METADATA_FILTER-$(call ALLYES, $(SILENCEDETECT_DEPS)) += fate-filter-metadata-silencedetect fate-filter-metadata-silencedetect: SRC = $(TARGET_SAMPLES)/amrwb/seed-12k65.awb -fate-filter-metadata-silencedetect: CMD = run $(FILTER_METADATA_COMMAND) "amovie='$(SRC)',silencedetect=d=-20dB" +fate-filter-metadata-silencedetect: CMD = run $(FILTER_METADATA_COMMAND) "amovie='$(SRC)',silencedetect=n=-42dB:d=.3" + EBUR128_METADATA_DEPS = FFPROBE AVDEVICE LAVFI_INDEV AMOVIE_FILTER FLAC_DEMUXER FLAC_DECODER EBUR128_FILTER FATE_METADATA_FILTER-$(call ALLYES, $(EBUR128_METADATA_DEPS)) += fate-filter-metadata-ebur128 diff --git a/tests/ref/fate/filter-metadata-silencedetect b/tests/ref/fate/filter-metadata-silencedetect index 4161287e6c..d1d6f67dc0 100644 --- a/tests/ref/fate/filter-metadata-silencedetect +++ b/tests/ref/fate/filter-metadata-silencedetect @@ -4,20 +4,20 @@ pkt_pts=640 pkt_pts=960 pkt_pts=1280 pkt_pts=1600 -pkt_pts=1920|tag:lavfi.silence_start=0.02 +pkt_pts=1920 pkt_pts=2240 -pkt_pts=2560|tag:lavfi.silence_end=0.16|tag:lavfi.silence_duration=0.14 +pkt_pts=2560 pkt_pts=2880 pkt_pts=3200 pkt_pts=3520 pkt_pts=3840 pkt_pts=4160 -pkt_pts=4480 +pkt_pts=4480|tag:lavfi.silence_start=-0.02 pkt_pts=4800 pkt_pts=5120 pkt_pts=5440 -pkt_pts=5760|tag:lavfi.silence_start=0.26|tag:lavfi.silence_end=0.36|tag:lavfi.silence_duration=0.1 -pkt_pts=6080 +pkt_pts=5760 +pkt_pts=6080|tag:lavfi.silence_end=0.38|tag:lavfi.silence_duration=0.4 pkt_pts=6400 pkt_pts=6720 pkt_pts=7040 @@ -67,12 +67,12 @@ pkt_pts=20800 pkt_pts=21120 pkt_pts=21440 pkt_pts=21760 -pkt_pts=22080|tag:lavfi.silence_start=1.28 +pkt_pts=22080 pkt_pts=22400 pkt_pts=22720 pkt_pts=23040 pkt_pts=23360 -pkt_pts=23680 +pkt_pts=23680|tag:lavfi.silence_start=1.18 pkt_pts=24000 pkt_pts=24320 pkt_pts=24640 @@ -97,7 +97,7 @@ pkt_pts=30400 pkt_pts=30720 pkt_pts=31040 pkt_pts=31360 -pkt_pts=31680|tag:lavfi.silence_end=1.98|tag:lavfi.silence_duration=0.7 +pkt_pts=31680|tag:lavfi.silence_end=1.98|tag:lavfi.silence_duration=0.8 pkt_pts=32000 pkt_pts=32320 pkt_pts=32640 @@ -160,10 +160,10 @@ pkt_pts=50560 pkt_pts=50880 pkt_pts=51200 pkt_pts=51520 -pkt_pts=51840 +pkt_pts=51840|tag:lavfi.silence_start=2.94 pkt_pts=52160 pkt_pts=52480 -pkt_pts=52800|tag:lavfi.silence_start=3.2 +pkt_pts=52800 pkt_pts=53120 pkt_pts=53440 pkt_pts=53760 @@ -193,10 +193,10 @@ pkt_pts=61120 pkt_pts=61440 pkt_pts=61760 pkt_pts=62080 -pkt_pts=62400|tag:lavfi.silence_end=3.9|tag:lavfi.silence_duration=0.7 +pkt_pts=62400 pkt_pts=62720 pkt_pts=63040 -pkt_pts=63360 +pkt_pts=63360|tag:lavfi.silence_end=3.96|tag:lavfi.silence_duration=1.02 pkt_pts=63680 pkt_pts=64000 pkt_pts=64320 @@ -248,9 +248,9 @@ pkt_pts=78720 pkt_pts=79040 pkt_pts=79360 pkt_pts=79680 -pkt_pts=8|tag:lavfi.silence_start=4.9 +pkt_pts=8 pkt_pts=80320 -pkt_pts=80640 +pkt_pts=80640|tag:lavfi.silence_start=4.74 pkt_pts=80960 pkt_pts=81280 pkt_pts=81600 @@ -270,7 +270,7 @@ pkt_pts=85760 pkt_pts=86080 pkt_pts=86400 pkt_pts=86720 -pkt_pts=87040|tag:lavfi.silence_end=5.44|tag:lavfi.silence_duration=0.54 +pkt_pts=87040|tag:lavfi.silence_end=5.44|tag:lavfi.silence_duration=0.7 pkt_pts=87360 pkt_pts=87680 pkt_pts=88000 @@ -325,8 +325,8 @@ pkt_pts=103360 pkt_pts=103680 pkt_pts=104000 pkt_pts=104320 -pkt_pts=104640|tag:lavfi.silence_start=6.44 -pkt_pts=104960 +pkt_pts=104640 +pkt_pts=104960|tag:lavfi.silence_start=6.26 pkt_pts=105280 pkt_pts=105600 pkt_pts=105920 @@ -361,8 +361,8 @@ pkt_pts=114880 pkt_pts=115200 pkt_pts=115520 pkt_pts=115840 -pkt_pts=116160|tag:lavfi.silence_end=7.26|tag:lavfi.silence_duration=0.82 -pkt_pts=116480 +pkt_pts=116160 +pkt_pts=116480|tag:lavfi.silence_end=7.28|tag:lavfi.silence_duration=1.02 pkt_pts=116800 pkt_pts=117120 pkt_pts=117440 @@ -425,19 +425,19 @@ pkt_pts=135360 pkt_pts=135680 pkt_pts=136000 pkt_pts=136320 -pkt_pts=136640 +pkt_pts=136640|tag:lavfi.silence_start=8.24 pkt_pts=136960 pkt_pts=137280 -pkt_pts=137600|tag:lavfi.silence_start=8.5 +pkt_pts=137600 pkt_pts=137920 pkt_pts=138240 pkt_pts=138560 -pkt_pts=138880|tag:lavfi.silence_end=8.68|tag:lavfi.silence_duration=0.18 +pkt_pts=138880 pkt_pts=139200 pkt_pts=139520 pkt_pts=139840 pkt_pts=140160 -pkt_pts=1
[FFmpeg-devel] [PATCH v3 5/8] lavfi/silencedetect: Fix silence_end accuracy
--- libavfilter/af_silencedetect.c | 3 ++- tests/ref/fate/filter-metadata-silencedetect | 12 ++-- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/libavfilter/af_silencedetect.c b/libavfilter/af_silencedetect.c index 749c3fbcb7..8973049fe5 100644 --- a/libavfilter/af_silencedetect.c +++ b/libavfilter/af_silencedetect.c @@ -92,7 +92,8 @@ static av_always_inline void update(SilenceDetectContext *s, AVFrame *insamples, } } else { if (s->start[channel] > INT64_MIN) { -int64_t end_pts = insamples->pts; +int64_t end_pts = insamples->pts + av_rescale_q(current_sample / s->channels, +(AVRational){ 1, s->last_sample_rate }, time_base); int64_t duration_ts = end_pts - s->start[channel]; set_meta(insamples, s->mono ? channel + 1 : 0, "silence_end", av_ts2timestr(end_pts, &time_base)); diff --git a/tests/ref/fate/filter-metadata-silencedetect b/tests/ref/fate/filter-metadata-silencedetect index 917b836250..e4be2ffac7 100644 --- a/tests/ref/fate/filter-metadata-silencedetect +++ b/tests/ref/fate/filter-metadata-silencedetect @@ -17,7 +17,7 @@ pkt_pts=4800 pkt_pts=5120 pkt_pts=5440 pkt_pts=5760 -pkt_pts=6080|tag:lavfi.silence_end=0.38|tag:lavfi.silence_duration=0.38 +pkt_pts=6080|tag:lavfi.silence_end=0.384813|tag:lavfi.silence_duration=0.384813 pkt_pts=6400 pkt_pts=6720 pkt_pts=7040 @@ -97,7 +97,7 @@ pkt_pts=30400 pkt_pts=30720 pkt_pts=31040 pkt_pts=31360 -pkt_pts=31680|tag:lavfi.silence_end=1.98|tag:lavfi.silence_duration=0.792438 +pkt_pts=31680|tag:lavfi.silence_end=1.99538|tag:lavfi.silence_duration=0.807813 pkt_pts=32000 pkt_pts=32320 pkt_pts=32640 @@ -196,7 +196,7 @@ pkt_pts=62080 pkt_pts=62400 pkt_pts=62720 pkt_pts=63040 -pkt_pts=63360|tag:lavfi.silence_end=3.96|tag:lavfi.silence_duration=1.015 +pkt_pts=63360|tag:lavfi.silence_end=3.97138|tag:lavfi.silence_duration=1.02638 pkt_pts=63680 pkt_pts=64000 pkt_pts=64320 @@ -270,7 +270,7 @@ pkt_pts=85760 pkt_pts=86080 pkt_pts=86400 pkt_pts=86720 -pkt_pts=87040|tag:lavfi.silence_end=5.44|tag:lavfi.silence_duration=0.683375 +pkt_pts=87040|tag:lavfi.silence_end=5.45|tag:lavfi.silence_duration=0.693375 pkt_pts=87360 pkt_pts=87680 pkt_pts=88000 @@ -362,7 +362,7 @@ pkt_pts=115200 pkt_pts=115520 pkt_pts=115840 pkt_pts=116160 -pkt_pts=116480|tag:lavfi.silence_end=7.28|tag:lavfi.silence_duration=1.00681 +pkt_pts=116480|tag:lavfi.silence_end=7.28569|tag:lavfi.silence_duration=1.0125 pkt_pts=116800 pkt_pts=117120 pkt_pts=117440 @@ -452,7 +452,7 @@ pkt_pts=144000 pkt_pts=144320 pkt_pts=144640 pkt_pts=144960 -pkt_pts=145280|tag:lavfi.silence_end=9.08|tag:lavfi.silence_duration=0.828937 +pkt_pts=145280|tag:lavfi.silence_end=9.08156|tag:lavfi.silence_duration=0.8305 pkt_pts=145600 pkt_pts=145920 pkt_pts=146240 -- 2.15.0 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH v3 6/8] lavfi/silencedetect: Fix missing log at eos
Fixes ticket #6968 --- libavfilter/af_silencedetect.c | 33 +++-- 1 file changed, 27 insertions(+), 6 deletions(-) diff --git a/libavfilter/af_silencedetect.c b/libavfilter/af_silencedetect.c index 8973049fe5..6e321a5d97 100644 --- a/libavfilter/af_silencedetect.c +++ b/libavfilter/af_silencedetect.c @@ -41,7 +41,9 @@ typedef struct SilenceDetectContext { int independant_channels; ///< number of entries in following arrays (always 1 in mono mode) int64_t *nb_null_samples; ///< (array) current number of continuous zero samples int64_t *start; ///< (array) if silence is detected, this value contains the time of the first zero sample (default/unset = INT64_MIN) +int64_t frame_end; ///< pts of the end of the current frame (used to compute duration of silence at EOS) int last_sample_rate; ///< last sample rate to check for sample rate changes +AVRational time_base; ///< time_base void (*silencedetect)(struct SilenceDetectContext *s, AVFrame *insamples, int nb_samples, int64_t nb_samples_notify, @@ -92,13 +94,16 @@ static av_always_inline void update(SilenceDetectContext *s, AVFrame *insamples, } } else { if (s->start[channel] > INT64_MIN) { -int64_t end_pts = insamples->pts + av_rescale_q(current_sample / s->channels, -(AVRational){ 1, s->last_sample_rate }, time_base); +int64_t end_pts = insamples ? insamples->pts + av_rescale_q(current_sample / s->channels, +(AVRational){ 1, s->last_sample_rate }, time_base) +: s->frame_end; int64_t duration_ts = end_pts - s->start[channel]; -set_meta(insamples, s->mono ? channel + 1 : 0, "silence_end", -av_ts2timestr(end_pts, &time_base)); -set_meta(insamples, s->mono ? channel + 1 : 0, "silence_duration", -av_ts2timestr(duration_ts, &time_base)); +if (insamples) { +set_meta(insamples, s->mono ? channel + 1 : 0, "silence_end", +av_ts2timestr(end_pts, &time_base)); +set_meta(insamples, s->mono ? channel + 1 : 0, "silence_duration", +av_ts2timestr(duration_ts, &time_base)); +} if (s->mono) av_log(s, AV_LOG_INFO, "channel: %d | ", channel); av_log(s, AV_LOG_INFO, "silence_end: %s | silence_duration: %s\n", @@ -177,6 +182,9 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *insamples) s->nb_null_samples[c] = srate * s->nb_null_samples[c] / s->last_sample_rate; } s->last_sample_rate = srate; +s->time_base = inlink->time_base; +s->frame_end = insamples->pts + av_rescale_q(insamples->nb_samples, +(AVRational){ 1, s->last_sample_rate }, inlink->time_base); // TODO: document metadata s->silencedetect(s, insamples, nb_samples, nb_samples_notify, @@ -218,6 +226,18 @@ static int query_formats(AVFilterContext *ctx) return ff_set_common_samplerates(ctx, formats); } +static av_cold void uninit(AVFilterContext *ctx) +{ +SilenceDetectContext *s = ctx->priv; +int c; + +for (c = 0; c < s->independant_channels; c++) +if (s->start[c] > INT64_MIN) +update(s, NULL, 0, c, 0, s->time_base); +av_freep(&s->nb_null_samples); +av_freep(&s->start); +} + static const AVFilterPad silencedetect_inputs[] = { { .name = "default", @@ -241,6 +261,7 @@ AVFilter ff_af_silencedetect = { .description = NULL_IF_CONFIG_SMALL("Detect silence."), .priv_size = sizeof(SilenceDetectContext), .query_formats = query_formats, +.uninit= uninit, .inputs= silencedetect_inputs, .outputs = silencedetect_outputs, .priv_class= &silencedetect_class, -- 2.15.0 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH v3 4/8] lavfi/silencedetect: Fix silence_start accuracy
--- libavfilter/af_silencedetect.c | 7 +-- tests/ref/fate/filter-metadata-silencedetect | 26 +- 2 files changed, 18 insertions(+), 15 deletions(-) diff --git a/libavfilter/af_silencedetect.c b/libavfilter/af_silencedetect.c index b4184c2486..749c3fbcb7 100644 --- a/libavfilter/af_silencedetect.c +++ b/libavfilter/af_silencedetect.c @@ -37,6 +37,7 @@ typedef struct SilenceDetectContext { double noise; ///< noise amplitude ratio double duration;///< minimum duration of silence until notification int mono; ///< mono mode : check each channel separately (default = check when ALL channels are silent) +int channels; ///< number of channels int independant_channels; ///< number of entries in following arrays (always 1 in mono mode) int64_t *nb_null_samples; ///< (array) current number of continuous zero samples int64_t *start; ///< (array) if silence is detected, this value contains the time of the first zero sample (default/unset = INT64_MIN) @@ -79,7 +80,8 @@ static av_always_inline void update(SilenceDetectContext *s, AVFrame *insamples, if (s->start[channel] == INT64_MIN) { s->nb_null_samples[channel]++; if (s->nb_null_samples[channel] >= nb_samples_notify) { -s->start[channel] = insamples->pts - (int64_t)(s->duration / av_q2d(time_base) + .5); +s->start[channel] = insamples->pts + av_rescale_q(current_sample / s->channels + 1 - nb_samples_notify * s->independant_channels / s->channels, +(AVRational){ 1, s->last_sample_rate }, time_base); set_meta(insamples, s->mono ? channel + 1 : 0, "silence_start", av_ts2timestr(s->start[channel], &time_base)); if (s->mono) @@ -132,7 +134,8 @@ static int config_input(AVFilterLink *inlink) SilenceDetectContext *s = ctx->priv; int c; -s->independant_channels = s->mono ? inlink->channels : 1; +s->channels = inlink->channels; +s->independant_channels = s->mono ? s->channels : 1; s->nb_null_samples = av_mallocz_array(sizeof(*s->nb_null_samples), s->independant_channels); if (!s->nb_null_samples) return AVERROR(ENOMEM); diff --git a/tests/ref/fate/filter-metadata-silencedetect b/tests/ref/fate/filter-metadata-silencedetect index d1d6f67dc0..917b836250 100644 --- a/tests/ref/fate/filter-metadata-silencedetect +++ b/tests/ref/fate/filter-metadata-silencedetect @@ -12,12 +12,12 @@ pkt_pts=3200 pkt_pts=3520 pkt_pts=3840 pkt_pts=4160 -pkt_pts=4480|tag:lavfi.silence_start=-0.02 +pkt_pts=4480|tag:lavfi.silence_start=0 pkt_pts=4800 pkt_pts=5120 pkt_pts=5440 pkt_pts=5760 -pkt_pts=6080|tag:lavfi.silence_end=0.38|tag:lavfi.silence_duration=0.4 +pkt_pts=6080|tag:lavfi.silence_end=0.38|tag:lavfi.silence_duration=0.38 pkt_pts=6400 pkt_pts=6720 pkt_pts=7040 @@ -72,7 +72,7 @@ pkt_pts=22400 pkt_pts=22720 pkt_pts=23040 pkt_pts=23360 -pkt_pts=23680|tag:lavfi.silence_start=1.18 +pkt_pts=23680|tag:lavfi.silence_start=1.18756 pkt_pts=24000 pkt_pts=24320 pkt_pts=24640 @@ -97,7 +97,7 @@ pkt_pts=30400 pkt_pts=30720 pkt_pts=31040 pkt_pts=31360 -pkt_pts=31680|tag:lavfi.silence_end=1.98|tag:lavfi.silence_duration=0.8 +pkt_pts=31680|tag:lavfi.silence_end=1.98|tag:lavfi.silence_duration=0.792438 pkt_pts=32000 pkt_pts=32320 pkt_pts=32640 @@ -160,7 +160,7 @@ pkt_pts=50560 pkt_pts=50880 pkt_pts=51200 pkt_pts=51520 -pkt_pts=51840|tag:lavfi.silence_start=2.94 +pkt_pts=51840|tag:lavfi.silence_start=2.945 pkt_pts=52160 pkt_pts=52480 pkt_pts=52800 @@ -196,7 +196,7 @@ pkt_pts=62080 pkt_pts=62400 pkt_pts=62720 pkt_pts=63040 -pkt_pts=63360|tag:lavfi.silence_end=3.96|tag:lavfi.silence_duration=1.02 +pkt_pts=63360|tag:lavfi.silence_end=3.96|tag:lavfi.silence_duration=1.015 pkt_pts=63680 pkt_pts=64000 pkt_pts=64320 @@ -250,7 +250,7 @@ pkt_pts=79360 pkt_pts=79680 pkt_pts=8 pkt_pts=80320 -pkt_pts=80640|tag:lavfi.silence_start=4.74 +pkt_pts=80640|tag:lavfi.silence_start=4.75662 pkt_pts=80960 pkt_pts=81280 pkt_pts=81600 @@ -270,7 +270,7 @@ pkt_pts=85760 pkt_pts=86080 pkt_pts=86400 pkt_pts=86720 -pkt_pts=87040|tag:lavfi.silence_end=5.44|tag:lavfi.silence_duration=0.7 +pkt_pts=87040|tag:lavfi.silence_end=5.44|tag:lavfi.silence_duration=0.683375 pkt_pts=87360 pkt_pts=87680 pkt_pts=88000 @@ -326,7 +326,7 @@ pkt_pts=103680 pkt_pts=104000 pkt_pts=104320 pkt_pts=104640 -pkt_pts=104960|tag:lavfi.silence_start=6.26 +pkt_pts=104960|tag:lavfi.silence_start=6.27319 pkt_pts=105280 pkt_pts=105600 pkt_pts=105920 @@ -362,7 +362,7 @@ pkt_pts=115200 pkt_pts=115520 pkt_pts=115840 pkt_pts=116160 -pkt_pts=116480|tag:lavfi.silence_end=7.28|tag:lavfi.silence_duration=1.02 +pkt_pts=116480|tag:lavfi.silence_end=7.28|tag:lavfi.silence_duration=1.00681 pkt_pts=116800 pkt_pts=117120 pkt_pts=117440 @@ -425,7 +425,7 @@ pkt_pts=135360 pkt_pts
[FFmpeg-devel] [PATCH v3 7/8] fate: run command and get logs
rungetavlogs() allows to get avlog messages (instead of stdout) --- tests/fate-run.sh | 14 ++ 1 file changed, 14 insertions(+) diff --git a/tests/fate-run.sh b/tests/fate-run.sh index 05f4ca5e20..0f28af5858 100755 --- a/tests/fate-run.sh +++ b/tests/fate-run.sh @@ -84,6 +84,20 @@ runecho(){ $target_exec $target_path/"$@" >&3 } +# $1=regex $2..$n=command +# catch av_log messages +rungetavlogs(){ +test "${V:-0}" -gt 0 && echo "$target_exec" $target_path/"${@:2}" >&3 +$target_exec $target_path/"${@:2}" 3>&2 2>&1 1>&3|awk -F' ' "{ +if (/${@:1:1}/) { +for(i=4; i<=NF; ++i) +printf \$i FS +print \"\" +} else { +print > \"/dev/stderr\"} +}" +} + probefmt(){ run ffprobe${PROGSUF} -show_entries format=format_name -print_format default=nw=1:nk=1 -v 0 "$@" } -- 2.15.0 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH v3 8/8] lavfi/silencedetect: New test for mono mode+logs
Includes test log of silence_end at eos --- tests/fate/filter-video.mak | 3 +++ tests/ref/fate/filter-metadata-silencedetect2 | 4 2 files changed, 7 insertions(+) create mode 100644 tests/ref/fate/filter-metadata-silencedetect2 diff --git a/tests/fate/filter-video.mak b/tests/fate/filter-video.mak index 0575fc6767..c69db2a680 100644 --- a/tests/fate/filter-video.mak +++ b/tests/fate/filter-video.mak @@ -722,6 +722,9 @@ FATE_METADATA_FILTER-$(call ALLYES, $(SILENCEDETECT_DEPS)) += fate-filter-metada fate-filter-metadata-silencedetect: SRC = $(TARGET_SAMPLES)/amrwb/seed-12k65.awb fate-filter-metadata-silencedetect: CMD = run $(FILTER_METADATA_COMMAND) "amovie='$(SRC)',silencedetect=n=-42dB:d=.3" +FATE_METADATA_FILTER-$(call ALLYES, $(SILENCEDETECT_DEPS)) += fate-filter-metadata-silencedetect2 +fate-filter-metadata-silencedetect2: SRC = $(TARGET_SAMPLES)/ac3/millers_crossing_4.0.ac3 +fate-filter-metadata-silencedetect2: CMD = rungetavlogs "\[silencedetect.*\].*silence_(start|end)" $(FILTER_METADATA_COMMAND) "amovie='$(SRC)',silencedetect=n=0.02:d=.15:mono=1" EBUR128_METADATA_DEPS = FFPROBE AVDEVICE LAVFI_INDEV AMOVIE_FILTER FLAC_DEMUXER FLAC_DECODER EBUR128_FILTER FATE_METADATA_FILTER-$(call ALLYES, $(EBUR128_METADATA_DEPS)) += fate-filter-metadata-ebur128 diff --git a/tests/ref/fate/filter-metadata-silencedetect2 b/tests/ref/fate/filter-metadata-silencedetect2 new file mode 100644 index 00..674bb34199 --- /dev/null +++ b/tests/ref/fate/filter-metadata-silencedetect2 @@ -0,0 +1,4 @@ +channel: 3 | silence_start: 0 +channel: 2 | silence_start: 1.52054 +channel: 2 | silence_end: 1.90594 | silence_duration: 0.385396 +channel: 3 | silence_end: 1.984 | silence_duration: 1.984 -- 2.15.0 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avformat/matroskadec: ignore CodecPrivate if the stream is VP9
On 2/16/2018 11:35 PM, James Almer wrote: > Defined in a recent revision of https://www.webmproject.org/docs/container/ > > Signed-off-by: James Almer > --- > libavformat/matroskadec.c | 4 > 1 file changed, 4 insertions(+) > > diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c > index cda8df2213..edc4f5d476 100644 > --- a/libavformat/matroskadec.c > +++ b/libavformat/matroskadec.c > @@ -2397,6 +2397,10 @@ static int matroska_parse_tracks(AVFormatContext *s) > return ret; > } else if (codec_id == AV_CODEC_ID_PRORES && track->codec_priv.size > == 4) { > fourcc = AV_RL32(track->codec_priv.data); > +} else if (codec_id == AV_CODEC_ID_VP9 && track->codec_priv.size) { > +/* we don't need any value stored in CodecPrivate. > + make sure that it's not exported as extradata. */ > +track->codec_priv.size = 0; > } > track->codec_priv.size -= extradata_offset; Ping. Will apply soon. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avcodec/mediacodecdec: refactor to take advantage of new decoding api
On Fri, Feb 16, 2018 at 05:40:03PM +, Aman Gupta wrote: > On Fri, Feb 16, 2018 at 4:01 AM Matthieu Bouron > wrote: > > > On Thu, Feb 15, 2018 at 07:52:14PM -0800, Aman Gupta wrote: > > > From: Aman Gupta > > > > Hi, > > > > > > > > This refactor splits up the main mediacodec decode loop into two > > > send/receive helpers, which are then used to rewrite the receive_frame > > > callback and take full advantage of the new decoding api. Since we > > > can now request packets on demand with ff_decode_get_packet(), the > > > fifo buffer is no longer necessary and has been removed. > > > > > > This change was motivated by behavior observed on certain Android TV > > > devices, featuring hardware mpeg2/h264 decoders which also deinterlace > > > content (to produce multiple frames per field). Previously, this code > > > caused buffering issues because queueInputBuffer() was always invoked > > > before each dequeueOutputBuffer(), even though twice as many output > > > buffers were being generated. > > > > > > With this patch, the decoder will always attempt to drain new frames > > > first before sending more data into the underlying codec. > > > --- > > > libavcodec/mediacodecdec.c| 107 > > ++ > > > libavcodec/mediacodecdec_common.c | 50 -- > > > libavcodec/mediacodecdec_common.h | 14 +++-- > > > 3 files changed, 80 insertions(+), 91 deletions(-) > > > > > > diff --git a/libavcodec/mediacodecdec.c b/libavcodec/mediacodecdec.c > > > index cb1151a195..0c29a1113d 100644 > > > --- a/libavcodec/mediacodecdec.c > > > +++ b/libavcodec/mediacodecdec.c > > > @@ -25,7 +25,6 @@ > > > > > > #include "libavutil/avassert.h" > > > #include "libavutil/common.h" > > > -#include "libavutil/fifo.h" > > > #include "libavutil/opt.h" > > > #include "libavutil/intreadwrite.h" > > > #include "libavutil/pixfmt.h" > > > @@ -43,8 +42,6 @@ typedef struct MediaCodecH264DecContext { > > > > > > MediaCodecDecContext *ctx; > > > > > > -AVFifoBuffer *fifo; > > > - > > > AVPacket buffered_pkt; > > > > > > } MediaCodecH264DecContext; > > > @@ -56,8 +53,6 @@ static av_cold int > > mediacodec_decode_close(AVCodecContext *avctx) > > > ff_mediacodec_dec_close(avctx, s->ctx); > > > s->ctx = NULL; > > > > > > -av_fifo_free(s->fifo); > > > - > > > av_packet_unref(&s->buffered_pkt); > > > > > > return 0; > > > @@ -400,12 +395,6 @@ static av_cold int > > mediacodec_decode_init(AVCodecContext *avctx) > > > > > > av_log(avctx, AV_LOG_INFO, "MediaCodec started successfully, ret = > > %d\n", ret); > > > > > > -s->fifo = av_fifo_alloc(sizeof(AVPacket)); > > > -if (!s->fifo) { > > > -ret = AVERROR(ENOMEM); > > > -goto done; > > > -} > > > - > > > done: > > > if (format) { > > > ff_AMediaFormat_delete(format); > > > @@ -418,13 +407,33 @@ done: > > > return ret; > > > } > > > > > > +static int mediacodec_send_receive(AVCodecContext *avctx, > > > + MediaCodecH264DecContext *s, > > > + AVFrame *frame, bool wait) > > > +{ > > > +int ret; > > > + > > > +/* send any pending data from buffered packet */ > > > +while (s->buffered_pkt.size) { > > > +ret = ff_mediacodec_dec_send(avctx, s->ctx, &s->buffered_pkt); > > > +if (ret == AVERROR(EAGAIN)) > > > +break; > > > +if (ret < 0) > > > +return ret; > > > > Maybe else if (ret < 0) > > > Sure, that's probably better. > > > > > > > +s->buffered_pkt.size -= ret; > > > +s->buffered_pkt.data += ret; > > > +if (s->buffered_pkt.size <= 0) > > > +av_packet_unref(&s->buffered_pkt); > > > +} > > > + > > > +/* check for new frame */ > > > +return ff_mediacodec_dec_receive(avctx, s->ctx, frame, wait); > > > +} > > > + > > > static int mediacodec_receive_frame(AVCodecContext *avctx, AVFrame > > *frame) > > > { > > > MediaCodecH264DecContext *s = avctx->priv_data; > > > int ret; > > > -int got_frame = 0; > > > -int is_eof = 0; > > > -AVPacket pkt = { 0 }; > > > > > > /* > > > * MediaCodec.flush() discards both input and output buffers, thus > > we > > > @@ -452,74 +461,34 @@ static int mediacodec_receive_frame(AVCodecContext > > *avctx, AVFrame *frame) > > > } > > > } > > > > > > -ret = ff_decode_get_packet(avctx, &pkt); > > > -if (ret == AVERROR_EOF) > > > -is_eof = 1; > > > -else if (ret == AVERROR(EAGAIN)) > > > -; /* no input packet, but fallthrough to check for pending > > frames */ > > > -else if (ret < 0) > > > +/* flush buffered packet and check for new frame */ > > > +ret = mediacodec_send_receive(avctx, s, frame, false); > > > +if (ret != AVERROR(EAGAIN)) > > > return ret; > > > > > > -/* buffer the input packet */ > > > -if (pkt.size) { > > > -if (av_fifo_space(s->fifo)
Re: [FFmpeg-devel] [PATCH] avformat/matroskadec: ignore CodecPrivate if the stream is VP9
2018-02-17 3:35 GMT+01:00 James Almer : > Defined in a recent revision of https://www.webmproject.org/docs/container/ > > Signed-off-by: James Almer > --- > libavformat/matroskadec.c | 4 > 1 file changed, 4 insertions(+) > > diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c > index cda8df2213..edc4f5d476 100644 > --- a/libavformat/matroskadec.c > +++ b/libavformat/matroskadec.c > @@ -2397,6 +2397,10 @@ static int matroska_parse_tracks(AVFormatContext *s) > return ret; > } else if (codec_id == AV_CODEC_ID_PRORES && track->codec_priv.size > == 4) { > fourcc = AV_RL32(track->codec_priv.data); > +} else if (codec_id == AV_CODEC_ID_VP9 && track->codec_priv.size) { > +/* we don't need any value stored in CodecPrivate. > + make sure that it's not exported as extradata. */ > +track->codec_priv.size = 0; You could add information about what this patch fixes to the commit message. Carl Eugen ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] FFmpeg 3.5 / 4.0
On 2/19/18, wm4 wrote: > On Mon, 19 Feb 2018 09:54:57 +0100 > Paul B Mahol wrote: > >> On 2/19/18, James Almer wrote: >> > On 2/18/2018 10:50 PM, Michael Niedermayer wrote: >> >> Hi >> >> >> >> Its 4 months since 3.4 was branched so its time for a new major release >> >> >> >> Is 4.0 or 3.5 preferred ? >> > >> > Definitely 4.0. With the major bump, the removal of ffprobe and WinXP >> >> ffprobe is removed? I'm making the fork. > > He means ffserver of course. Do you still want to work? fork or work? > >> >> >> > support, catching up with the merge queue, plus a bunch of new API >> > introductions, using 3.5 for this release doesn't transmits the correct >> > message to downstream users. >> > >> >> Any name suggestions ? > > I suggest "Green-yellow striped bikeshed". Better name of somebody famous instead? ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] FFmpeg 3.5 / 4.0
On 2/19/2018 5:54 AM, Paul B Mahol wrote: > On 2/19/18, James Almer wrote: >> On 2/18/2018 10:50 PM, Michael Niedermayer wrote: >>> Hi >>> >>> Its 4 months since 3.4 was branched so its time for a new major release >>> >>> Is 4.0 or 3.5 preferred ? >> >> Definitely 4.0. With the major bump, the removal of ffprobe and WinXP > > ffprobe is removed? I'm making the fork. Err, no, i meant to say ffserver. My bad. > > >> support, catching up with the merge queue, plus a bunch of new API >> introductions, using 3.5 for this release doesn't transmits the correct >> message to downstream users. >> >>> Any name suggestions ? How about Mellin? >>> >>> If there are no objections i will likely make that release in the next >>> weeks >> >> The iterate() API for lavfi should be confirmed working and committed >> before this release is made, as the rest are already in. But aside from >> that i think the path is clear. >> >>> >>> thx >>> >>> >>> >>> ___ >>> ffmpeg-devel mailing list >>> ffmpeg-devel@ffmpeg.org >>> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel >>> >> >> ___ >> ffmpeg-devel mailing list >> ffmpeg-devel@ffmpeg.org >> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel >> > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel > ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avformat/matroskadec: ignore CodecPrivate if the stream is VP9
On 2/19/2018 11:37 AM, Carl Eugen Hoyos wrote: > 2018-02-17 3:35 GMT+01:00 James Almer : >> Defined in a recent revision of https://www.webmproject.org/docs/container/ >> >> Signed-off-by: James Almer >> --- >> libavformat/matroskadec.c | 4 >> 1 file changed, 4 insertions(+) >> >> diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c >> index cda8df2213..edc4f5d476 100644 >> --- a/libavformat/matroskadec.c >> +++ b/libavformat/matroskadec.c >> @@ -2397,6 +2397,10 @@ static int matroska_parse_tracks(AVFormatContext *s) >> return ret; >> } else if (codec_id == AV_CODEC_ID_PRORES && track->codec_priv.size >> == 4) { >> fourcc = AV_RL32(track->codec_priv.data); >> +} else if (codec_id == AV_CODEC_ID_VP9 && track->codec_priv.size) { >> +/* we don't need any value stored in CodecPrivate. >> + make sure that it's not exported as extradata. */ >> +track->codec_priv.size = 0; > > You could add information about what this patch fixes to > the commit message. > > Carl Eugen It prevents loading the contents of CodecPrivate into extradata for a codec that doesn't need nor expect any. It will among other things prevent said matroska specific binary data from being dumped onto other formats during remuxing. I'll add a line explaining the above to the commit message before pushing. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] FFmpeg 3.5 / 4.0
On Mon, 19 Feb 2018 at 16:06 James Almer wrote: > On 2/19/2018 5:54 AM, Paul B Mahol wrote: > > On 2/19/18, James Almer wrote: > >> On 2/18/2018 10:50 PM, Michael Niedermayer wrote: > >>> Hi > >>> > >>> Its 4 months since 3.4 was branched so its time for a new major release > >>> > >>> Is 4.0 or 3.5 preferred ? > >> > >> Definitely 4.0. With the major bump, the removal of ffprobe and WinXP > > > > ffprobe is removed? I'm making the fork. > > Err, no, i meant to say ffserver. My bad. > > > > > > >> support, catching up with the merge queue, plus a bunch of new API > >> introductions, using 3.5 for this release doesn't transmits the correct > >> message to downstream users. > >> > >>> Any name suggestions ? > > How about Mellin? > What about Chien-Shiung Wu, who was denied the Nobel Prize for her work on Parity violation. Kieran ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] FFmpeg 3.5 / 4.0
On 2/19/2018 1:31 PM, Kieran Kunhya wrote: > On Mon, 19 Feb 2018 at 16:06 James Almer wrote: > >> On 2/19/2018 5:54 AM, Paul B Mahol wrote: >>> On 2/19/18, James Almer wrote: On 2/18/2018 10:50 PM, Michael Niedermayer wrote: > Hi > > Its 4 months since 3.4 was branched so its time for a new major release > > Is 4.0 or 3.5 preferred ? Definitely 4.0. With the major bump, the removal of ffprobe and WinXP >>> >>> ffprobe is removed? I'm making the fork. >> >> Err, no, i meant to say ffserver. My bad. >> >>> >>> support, catching up with the merge queue, plus a bunch of new API introductions, using 3.5 for this release doesn't transmits the correct message to downstream users. > Any name suggestions ? >> >> How about Mellin? >> > > What about Chien-Shiung Wu, who was denied the Nobel Prize for her work on > Parity violation. > > Kieran Her surname is Wu, which is kinda short, but fine by me if that's preferred. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] FFmpeg 3.5 / 4.0
Michael Niedermayer wrote: >Is 4.0 or 3.5 preferred ? I would prefer 4.0 for the reasons already mentioned by others. I suggest as well to move the 2.8 branch from the Releases to the Old Releases. >Any name suggestions ? >I do not agree with what you have to say, but I'll defend to >the death your right to say it. -- Voltaire Voltaire (some Voltaire is useful those days). Best regards, Reto ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] Add -vf scale example for making pixels square
From 9605df7c8402fb8d5fdbb55ae05639338a1ae0a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomas=20H=C3=A4rdin?= Date: Mon, 19 Feb 2018 18:42:25 +0100 Subject: [PATCH] Add -vf scale example for making pixels square This is a common use case. --- doc/filters.texi | 13 + 1 file changed, 13 insertions(+) diff --git a/doc/filters.texi b/doc/filters.texi index bd93e0ab84..8a9b78d778 100644 --- a/doc/filters.texi +++ b/doc/filters.texi @@ -13721,6 +13721,19 @@ keeping the same aspect ratio as the input: @example scale=w='min(500\, iw*3/2):h=-1' @end example + +@item +Make pixels square by combining scale and setsar: +@example +scale='trunc(ih*dar):ih',setsar=1/1 +@end example + +@item +Make pixels square by combining scale and setsar, +making sure the resulting resolution is even (required by some codecs): +@example +scale='trunc(ih*dar/2)*2:trunc(ih/2)*2',setsar=1/1 +@end example @end itemize @subsection Commands -- 2.11.0 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 4/4] fftools/ffmpeg: Support passing colour range from decoder to encoder
This is relatively straightforward; we set the colour range from the encoder context into the buffersrc parameters and then set the range on the decoder from the buffersink. I did not touch ifilter as part of this change, as I'm not sure whether it is relevant. ifilter initialisation seems to be done from an AVFrame, and it seems conceptually undesirable to set the link colour range on that basis. The one possible reason to handle this is if if the input is not a decoder and so the color range would come from codecpar. If so, it could be handled as a separate change. Signed-off-by: Philip Langdale --- fftools/ffmpeg.c| 2 ++ fftools/ffmpeg_filter.c | 1 + 2 files changed, 3 insertions(+) diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c index a37de2ff98..ff824b864f 100644 --- a/fftools/ffmpeg.c +++ b/fftools/ffmpeg.c @@ -3385,6 +3385,8 @@ static int init_output_stream_encode(OutputStream *ost) av_mul_q(ost->frame_aspect_ratio, (AVRational){ enc_ctx->height, enc_ctx->width }) : av_buffersink_get_sample_aspect_ratio(ost->filter->filter); +enc_ctx->color_range = av_buffersink_get_color_range(ost->filter->filter); + enc_ctx->pix_fmt = av_buffersink_get_format(ost->filter->filter); if (dec_ctx) enc_ctx->bits_per_raw_sample = FFMIN(dec_ctx->bits_per_raw_sample, diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c index 877fd670e6..30cb0bc378 100644 --- a/fftools/ffmpeg_filter.c +++ b/fftools/ffmpeg_filter.c @@ -755,6 +755,7 @@ static int configure_input_video_filter(FilterGraph *fg, InputFilter *ifilter, return AVERROR(ENOMEM); memset(par, 0, sizeof(*par)); par->format = AV_PIX_FMT_NONE; +par->color_range = ist->dec_ctx->color_range; if (ist->dec_ctx->codec_type == AVMEDIA_TYPE_AUDIO) { av_log(NULL, AV_LOG_ERROR, "Cannot connect video filter to audio input\n"); -- 2.14.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 2/4] avfilter: Add support for colour range as a link parameter
As part of achieving our YUVJ-free future, it needs to be possible to pass the colour range property from a decoder context to an encoder context. In the absence of filters, this is obviously trivial, but as soon as filters are introduced, there needs to be a way to pass and preserve the property (or modify it, as some filters will do). Based on existing properties of this type, this change adds a link property and ways to set it from a buffer source and get it from a buffer sink. Signed-off-by: Philip Langdale --- libavfilter/avfilter.c | 2 ++ libavfilter/avfilter.h | 1 + libavfilter/buffersink.c | 1 + libavfilter/buffersink.h | 1 + libavfilter/buffersrc.c | 10 -- libavfilter/buffersrc.h | 5 + 6 files changed, 18 insertions(+), 2 deletions(-) diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c index 7553f7c36a..9b93e8177e 100644 --- a/libavfilter/avfilter.c +++ b/libavfilter/avfilter.c @@ -338,6 +338,8 @@ int avfilter_config_links(AVFilterContext *filter) link->w = inlink->w; if (!link->h) link->h = inlink->h; +if (link->color_range == AVCOL_RANGE_UNSPECIFIED) +link->color_range = inlink->color_range; } else if (!link->w || !link->h) { av_log(link->src, AV_LOG_ERROR, "Video source filters must set their output link's " diff --git a/libavfilter/avfilter.h b/libavfilter/avfilter.h index 2d1195eeeb..49261ccef8 100644 --- a/libavfilter/avfilter.h +++ b/libavfilter/avfilter.h @@ -449,6 +449,7 @@ struct AVFilterLink { int w; ///< agreed upon image width int h; ///< agreed upon image height AVRational sample_aspect_ratio; ///< agreed upon sample aspect ratio +enum AVColorRange color_range; ///< agreed upon image color range /* These parameters apply only to audio */ uint64_t channel_layout;///< channel layout of current buffer (see libavutil/channel_layout.h) int sample_rate;///< samples per second diff --git a/libavfilter/buffersink.c b/libavfilter/buffersink.c index 0f87b5439a..897396cac4 100644 --- a/libavfilter/buffersink.c +++ b/libavfilter/buffersink.c @@ -194,6 +194,7 @@ MAKE_AVFILTERLINK_ACCESSOR(AVRational , frame_rate ) MAKE_AVFILTERLINK_ACCESSOR(int , w ) MAKE_AVFILTERLINK_ACCESSOR(int , h ) MAKE_AVFILTERLINK_ACCESSOR(AVRational , sample_aspect_ratio) +MAKE_AVFILTERLINK_ACCESSOR(enum AVColorRange, color_range) MAKE_AVFILTERLINK_ACCESSOR(int , channels ) MAKE_AVFILTERLINK_ACCESSOR(uint64_t , channel_layout ) diff --git a/libavfilter/buffersink.h b/libavfilter/buffersink.h index 21d6bb505b..d91e3fe448 100644 --- a/libavfilter/buffersink.h +++ b/libavfilter/buffersink.h @@ -114,6 +114,7 @@ AVRational av_buffersink_get_frame_rate (const AVFilterContext *c int av_buffersink_get_w (const AVFilterContext *ctx); int av_buffersink_get_h (const AVFilterContext *ctx); AVRational av_buffersink_get_sample_aspect_ratio (const AVFilterContext *ctx); +enum AVColorRange av_buffersink_get_color_range (const AVFilterContext *ctx); int av_buffersink_get_channels(const AVFilterContext *ctx); uint64_t av_buffersink_get_channel_layout (const AVFilterContext *ctx); diff --git a/libavfilter/buffersrc.c b/libavfilter/buffersrc.c index cd56f8ca45..19239c4268 100644 --- a/libavfilter/buffersrc.c +++ b/libavfilter/buffersrc.c @@ -53,6 +53,7 @@ typedef struct BufferSourceContext { enum AVPixelFormat pix_fmt; AVRationalpixel_aspect; char *sws_param; +enum AVColorRange color_range; AVBufferRef *hw_frames_ctx; @@ -111,6 +112,8 @@ int av_buffersrc_parameters_set(AVFilterContext *ctx, AVBufferSrcParameters *par s->pixel_aspect = param->sample_aspect_ratio; if (param->frame_rate.num > 0 && param->frame_rate.den > 0) s->frame_rate = param->frame_rate; +if (param->color_range != AVCOL_RANGE_UNSPECIFIED) +s->color_range = param->color_range; if (param->hw_frames_ctx) { av_buffer_unref(&s->hw_frames_ctx); s->hw_frames_ctx = av_buffer_ref(param->hw_frames_ctx); @@ -282,10 +285,11 @@ static av_cold int init_video(AVFilterContext *ctx) if (!(c->fifo = av_fifo_alloc(sizeof(AVFrame* return AVERROR(ENOMEM); -av_log(ctx, AV_LOG_VERBOSE, "w:%d h:%d pixfmt:%s tb:%d/%d fr:%d/%d sar:%d/%d sws_param:%s\n", +av_log(ctx, AV_LOG_VERBOSE, "w:%d h:%d pixfmt:%s tb:%d/%d fr:%d/%d sar:%d/%d sws_param:%s\n color_range:%s\n", c->w, c->h, av_get_pix_fmt_name(c->pix_fmt), c->time_base.num, c-
[FFmpeg-devel] [PATCH 1/4] avutil/opt: Add option type for Colour Range
In preparation for introducing Colour Range as a buffersrc parameter, we need an option type to pass it. This probably seems like overkill for an enum with two valid values, but even then you need to do string parsing so you might as well get it right. Signed-off-by: Philip Langdale --- libavutil/opt.c | 41 - libavutil/opt.h | 3 +++ 2 files changed, 43 insertions(+), 1 deletion(-) diff --git a/libavutil/opt.c b/libavutil/opt.c index df88663e3f..0bfd0ca952 100644 --- a/libavutil/opt.c +++ b/libavutil/opt.c @@ -67,6 +67,9 @@ static int read_number(const AVOption *o, const void *dst, double *num, int *den case AV_OPT_TYPE_SAMPLE_FMT: *intnum = *(enum AVSampleFormat *)dst; return 0; +case AV_OPT_TYPE_COLOR_RANGE: +*intnum = *(enum AVColorRange *)dst; +return 0; case AV_OPT_TYPE_BOOL: case AV_OPT_TYPE_INT: *intnum = *(int *)dst; @@ -120,6 +123,9 @@ static int write_number(void *obj, const AVOption *o, void *dst, double num, int case AV_OPT_TYPE_SAMPLE_FMT: *(enum AVSampleFormat *)dst = llrint(num / den) * intnum; break; +case AV_OPT_TYPE_COLOR_RANGE: +*(enum AVColorRange *)dst = llrint(num / den) * intnum; +break; case AV_OPT_TYPE_BOOL: case AV_OPT_TYPE_FLAGS: case AV_OPT_TYPE_INT: @@ -446,6 +452,12 @@ static int set_string_sample_fmt(void *obj, const AVOption *o, const char *val, AV_SAMPLE_FMT_NB, av_get_sample_fmt, "sample format"); } +static int set_string_color_range(void *obj, const AVOption *o, const char *val, uint8_t *dst) +{ +return set_string_fmt(obj, o, val, dst, + AVCOL_RANGE_NB, av_color_range_from_name, "color range"); +} + int av_opt_set(void *obj, const char *name, const char *val, int search_flags) { int ret = 0; @@ -457,7 +469,8 @@ int av_opt_set(void *obj, const char *name, const char *val, int search_flags) o->type != AV_OPT_TYPE_PIXEL_FMT && o->type != AV_OPT_TYPE_SAMPLE_FMT && o->type != AV_OPT_TYPE_IMAGE_SIZE && o->type != AV_OPT_TYPE_VIDEO_RATE && o->type != AV_OPT_TYPE_DURATION && o->type != AV_OPT_TYPE_COLOR && - o->type != AV_OPT_TYPE_CHANNEL_LAYOUT && o->type != AV_OPT_TYPE_BOOL)) + o->type != AV_OPT_TYPE_CHANNEL_LAYOUT && o->type != AV_OPT_TYPE_BOOL && + o->type != AV_OPT_TYPE_COLOR_RANGE)) return AVERROR(EINVAL); if (o->flags & AV_OPT_FLAG_READONLY) @@ -492,6 +505,8 @@ int av_opt_set(void *obj, const char *name, const char *val, int search_flags) return set_string_pixel_fmt(obj, o, val, dst); case AV_OPT_TYPE_SAMPLE_FMT: return set_string_sample_fmt(obj, o, val, dst); +case AV_OPT_TYPE_COLOR_RANGE: +return set_string_color_range(obj, o, val, dst); case AV_OPT_TYPE_DURATION: if (!val) { *(int64_t *)dst = 0; @@ -678,6 +693,11 @@ int av_opt_set_sample_fmt(void *obj, const char *name, enum AVSampleFormat fmt, return set_format(obj, name, fmt, search_flags, AV_OPT_TYPE_SAMPLE_FMT, "sample", AV_SAMPLE_FMT_NB); } +int av_opt_set_color_range(void *obj, const char *name, enum AVColorRange range, int search_flags) +{ +return set_format(obj, name, range, search_flags, AV_OPT_TYPE_COLOR_RANGE, "range", AVCOL_RANGE_NB); +} + int av_opt_set_channel_layout(void *obj, const char *name, int64_t cl, int search_flags) { void *target_obj; @@ -828,6 +848,9 @@ int av_opt_get(void *obj, const char *name, int search_flags, uint8_t **out_val) case AV_OPT_TYPE_SAMPLE_FMT: ret = snprintf(buf, sizeof(buf), "%s", (char *)av_x_if_null(av_get_sample_fmt_name(*(enum AVSampleFormat *)dst), "none")); break; +case AV_OPT_TYPE_COLOR_RANGE: +ret = snprintf(buf, sizeof(buf), "%s", (char *)av_x_if_null(av_color_range_name(*(enum AVColorRange *)dst), "none")); +break; case AV_OPT_TYPE_DURATION: i64 = *(int64_t *)dst; format_duration(buf, sizeof(buf), i64); @@ -974,6 +997,11 @@ int av_opt_get_sample_fmt(void *obj, const char *name, int search_flags, enum AV return get_format(obj, name, search_flags, out_fmt, AV_OPT_TYPE_SAMPLE_FMT, "sample"); } +int av_opt_get_color_range(void *obj, const char *name, int search_flags, enum AVColorRange *out_range) +{ +return get_format(obj, name, search_flags, (int *)out_range, AV_OPT_TYPE_COLOR_RANGE, "range"); +} + int av_opt_get_channel_layout(void *obj, const char *name, int search_flags, int64_t *cl) { void *dst, *target_obj; @@ -1156,6 +1184,9 @@ static void opt_list(void *obj, void *av_log_obj, const char *unit, case AV_OPT_TYPE_SAMPLE_FMT: av_log(av_log_obj, AV_LOG_INFO, "%-12s ", ""); break; +case AV_OPT_TYPE_COLOR_RANGE: +av_log(av_log_obj, AV_LOG_INFO, "%-12s ", ""); +
[FFmpeg-devel] [PATCH 0/4] Pass colour range from source to sink
Today, we have a colour range property on decoders and encoders. The decoder sets the property on itself to reflect what it is decoding, and the user sets it on the encoder to reflect what is being encoded. However, we don't support a way to pass it through filter chains and 'ffmpeg' does not make any attempt to set it on the encoder. This set of changes introduces a way to do this, by defining a new filter link property, and allowing it to be set on a buffersrc and read back from a buffersink. We then extend the various relevant filters to set the property when they manipulate the colour range, and finally, we get 'ffmpeg' to get and set the range appropriately. After this change, it is now possible to, for example. transcode full range mjpeg to h.264, correctly, either by retaining the range, or by compressing the range using a filter. Philip Langdale (4): avutil/opt: Add option type for Colour Range avfilter: Add support for colour range as a link parameter avfilter: Set output link colour range where appropriate fftools/ffmpeg: Support passing colour range from decoder to encoder fftools/ffmpeg.c | 2 ++ fftools/ffmpeg_filter.c| 1 + libavfilter/avf_showcqt.c | 1 + libavfilter/avf_showspectrum.c | 1 + libavfilter/avfilter.c | 2 ++ libavfilter/avfilter.h | 1 + libavfilter/buffersink.c | 1 + libavfilter/buffersink.h | 1 + libavfilter/buffersrc.c| 10 -- libavfilter/buffersrc.h| 5 + libavfilter/vf_colorspace.c| 4 libavfilter/vf_scale.c | 8 +++- libavfilter/vf_setparams.c | 11 +++ libavfilter/vf_waveform.c | 1 + libavfilter/vf_zscale.c| 21 +++-- libavutil/opt.c| 41 - libavutil/opt.h| 3 +++ 17 files changed, 108 insertions(+), 6 deletions(-) -- 2.14.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 3/4] avfilter: Set output link colour range where appropriate
Certain filters set or modify the output colour range. Today, they do that per-frame, but now that we have a link property, they need to set that as well. Signed-off-by: Philip Langdale --- libavfilter/avf_showcqt.c | 1 + libavfilter/avf_showspectrum.c | 1 + libavfilter/vf_colorspace.c| 4 libavfilter/vf_scale.c | 8 +++- libavfilter/vf_setparams.c | 11 +++ libavfilter/vf_waveform.c | 1 + libavfilter/vf_zscale.c| 21 +++-- 7 files changed, 44 insertions(+), 3 deletions(-) diff --git a/libavfilter/avf_showcqt.c b/libavfilter/avf_showcqt.c index 875ba48cee..ee6654358a 100644 --- a/libavfilter/avf_showcqt.c +++ b/libavfilter/avf_showcqt.c @@ -1363,6 +1363,7 @@ static int config_output(AVFilterLink *outlink) outlink->h = s->height; s->format = outlink->format; outlink->sample_aspect_ratio = av_make_q(1, 1); +outlink->color_range = AVCOL_RANGE_JPEG; outlink->frame_rate = s->rate; outlink->time_base = av_mul_q(av_inv_q(s->rate), av_make_q(1, PTS_STEP)); av_log(ctx, AV_LOG_INFO, "video: %dx%d %s %d/%d fps, bar_h = %d, axis_h = %d, sono_h = %d.\n", diff --git a/libavfilter/avf_showspectrum.c b/libavfilter/avf_showspectrum.c index 956f62f3ad..52fa018317 100644 --- a/libavfilter/avf_showspectrum.c +++ b/libavfilter/avf_showspectrum.c @@ -307,6 +307,7 @@ static int config_output(AVFilterLink *outlink) outlink->w = s->w; outlink->h = s->h; outlink->sample_aspect_ratio = (AVRational){1,1}; +outlink->color_range = AVCOL_RANGE_JPEG; if (s->legend) { s->start_x = log10(inlink->sample_rate) * 25; diff --git a/libavfilter/vf_colorspace.c b/libavfilter/vf_colorspace.c index 71ea08a20f..5455648710 100644 --- a/libavfilter/vf_colorspace.c +++ b/libavfilter/vf_colorspace.c @@ -1048,6 +1048,7 @@ static int config_props(AVFilterLink *outlink) { AVFilterContext *ctx = outlink->dst; AVFilterLink *inlink = outlink->src->inputs[0]; +ColorSpaceContext *s = ctx->priv; if (inlink->w % 2 || inlink->h % 2) { av_log(ctx, AV_LOG_ERROR, "Invalid odd size (%dx%d)\n", @@ -1060,6 +1061,9 @@ static int config_props(AVFilterLink *outlink) outlink->sample_aspect_ratio = inlink->sample_aspect_ratio; outlink->time_base = inlink->time_base; +if (s->user_rng != AVCOL_RANGE_UNSPECIFIED) +outlink->color_range = s->user_rng; + return 0; } diff --git a/libavfilter/vf_scale.c b/libavfilter/vf_scale.c index 9f45032e85..21ae709d6b 100644 --- a/libavfilter/vf_scale.c +++ b/libavfilter/vf_scale.c @@ -342,11 +342,16 @@ static int config_props(AVFilterLink *outlink) } else outlink->sample_aspect_ratio = inlink0->sample_aspect_ratio; -av_log(ctx, AV_LOG_VERBOSE, "w:%d h:%d fmt:%s sar:%d/%d -> w:%d h:%d fmt:%s sar:%d/%d flags:0x%0x\n", +if (scale->out_range != AVCOL_RANGE_UNSPECIFIED) +outlink->color_range = scale->out_range; + +av_log(ctx, AV_LOG_VERBOSE, "w:%d h:%d fmt:%s sar:%d/%d range:%d -> w:%d h:%d fmt:%s sar:%d/%d range:%d flags:0x%0x\n", inlink ->w, inlink ->h, av_get_pix_fmt_name( inlink->format), inlink->sample_aspect_ratio.num, inlink->sample_aspect_ratio.den, + inlink->color_range, outlink->w, outlink->h, av_get_pix_fmt_name(outlink->format), outlink->sample_aspect_ratio.num, outlink->sample_aspect_ratio.den, + outlink->color_range, scale->flags); return 0; @@ -363,6 +368,7 @@ static int config_props_ref(AVFilterLink *outlink) outlink->sample_aspect_ratio = inlink->sample_aspect_ratio; outlink->time_base = inlink->time_base; outlink->frame_rate = inlink->frame_rate; +outlink->color_range = inlink->color_range; return 0; } diff --git a/libavfilter/vf_setparams.c b/libavfilter/vf_setparams.c index 8427f98ba8..2b47e2d20b 100644 --- a/libavfilter/vf_setparams.c +++ b/libavfilter/vf_setparams.c @@ -56,6 +56,16 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame) return ff_filter_frame(ctx->outputs[0], frame); } +static int config_output(AVFilterLink *outlink) +{ +AVFilterContext *ctx = outlink->src; +SetParamsContext *s = ctx->priv; + +if (s->color_range >= 0) +outlink->color_range = s->color_range; +return 0; +} + static const AVFilterPad inputs[] = { { .name = "default", @@ -69,6 +79,7 @@ static const AVFilterPad outputs[] = { { .name = "default", .type = AVMEDIA_TYPE_VIDEO, +.config_props = config_output, }, { NULL } }; diff --git a/libavfilter/vf_waveform.c b/libavfilter/vf_waveform.c index 02a7046f33..b610336ea2 100644 --- a/libavfilter/vf_waveform.c +++ b/libavfilter/vf_waveform.c @@ -2744,6 +2744,7 @@ static int config_output(AVFilterLink *outlink) } outlink->sample_aspect_ratio = (AVRational){1,1}; +outlink->color_range = AVCOL_RANGE_JPEG; return 0; } diff --g
Re: [FFmpeg-devel] [PATCH 0/3] Finish new iteration APIs
On Sun, Feb 18, 2018 at 05:58:16PM +, Josh de Kock wrote: > This should be the last of the major API changes. I'm not entirely > sure if I missed anything. Moving from a register based system where a user app can register any subset to a system which registers all via an array will increase the size of statically linked binaries for users only using a subset. An example of this effect for codecs is tools/target_dec_fuzzer.c This effect results because when the linker collects all objects of all static libs with a user application it can remove all symbols which are not referenced. If there is a single array that references all codecs, filters, formats and this array is referenced by a function which must be used then nothing can be removed at the link stage OTOH with a register function a register all which refernces all a user application can simply not use the reference all code and register the specific subset it needs with individual register calls. In this case the linker can ommit the register all and all codecs, formats and filters teh user application does not explicitly refer too. In the case where this applies this results in significantly smaller files I also expect they link faster and load faster but i forgot to benchmark this when i realized this issue exists and tested ... I am thus in favor of a system that does not unconditionally reference every codec/format/filter There can also be an advantage security wise if unneeded parts are never "registered" [...] -- 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: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] Add android_capture indev
On Mon, Feb 19, 2018 at 08:39:56AM +0100, Felix Matouschek wrote: > Hello Michael, > > do you think the patch could be merged in its current state? > It is functional, maybe I can do the cosmetic changes later. > I was a bit busy the last weeks. > > Would be nice if it could get into the 3.5 / 4.0 release. not sure if there are issues remaining but it doesnt apply anymore Applying: avdevice: add android_camera indev Using index info to reconstruct a base tree... M Changelog M MAINTAINERS M configure M doc/indevs.texi M libavdevice/alldevices.c M libavdevice/version.h Falling back to patching base and 3-way merge... Auto-merging libavdevice/alldevices.c CONFLICT (content): Merge conflict in libavdevice/alldevices.c Auto-merging doc/indevs.texi Auto-merging configure Auto-merging MAINTAINERS Auto-merging Changelog CONFLICT (content): Merge conflict in Changelog error: Failed to merge in the changes. Patch failed at 0001 avdevice: add android_camera indev The copy of the patch that failed is found in: .git/rebase-apply/patch When you have resolved this problem, run "git am --continue". If you prefer to skip this patch, run "git am --skip" instead. To restore the original branch and stop patching, run "git am --abort". [...] -- 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 http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] hlsenc: Fixing HLS_TEMP_FILE usage with, HLS_SECOND_LEVEL_SEGMENT_... flags
Dear All, Currently using HLS_TEMP together with HLS_SECOND_LEVEL_SEGMENT_DURATION and/or HLS_SECOND_LEVEL_SEGMENT_SIZE gives error at end of each segment writing and the final segment file names do not contain the desired data. This patch fixes this bug by delaying the initilization of original segment filename until end of actual temp file renaming. This will skip the interfering. Please review this bug fix. Thank you in advance. best regards, Bela Bodecs >From 10c4e5f193a6f9b35d50f1af5a6e8ae7ea114eca Mon Sep 17 00:00:00 2001 From: Bela Bodecs Date: Mon, 19 Feb 2018 21:36:25 +0100 Subject: [PATCH] hlsenc: Fixing HLS_TEMP_FILE usage with HLS_SECOND_LEVEL_SEGMENT_... Currently using HLS_TEMP together with HLS_SECOND_LEVEL_SEGMENT_DURATION or HLS_SECOND_LEVEL_SEGMENT_SIZE gives error at end of each segment writing and the final segment file names do not contain the desired data. This patch fixes this bug by delaying the initilization of original segment filename after actual temp file renaming will skip the interfering. Signed-off-by: Bela Bodecs --- libavformat/hlsenc.c | 20 +--- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c index cc13c94..ff06473 100644 --- a/libavformat/hlsenc.c +++ b/libavformat/hlsenc.c @@ -2168,13 +2168,9 @@ static int hls_write_packet(AVFormatContext *s, AVPacket *pkt) if (vs->packets_written && can_split && av_compare_ts(pkt->pts - vs->start_pts, st->time_base, end_pts, AV_TIME_BASE_Q) >= 0) { int64_t new_start_pos; -char *old_filename = av_strdup(vs->avf->url); +char *old_filename = NULL; int byterange_mode = (hls->flags & HLS_SINGLE_FILE) || (hls->max_seg_size > 0); -if (!old_filename) { -return AVERROR(ENOMEM); -} - av_write_frame(vs->avf, NULL); /* Flush any buffered data */ new_start_pos = avio_tell(vs->avf->pb); @@ -2215,17 +2211,21 @@ static int hls_write_packet(AVFormatContext *s, AVPacket *pkt) if (ret < 0) { av_log(NULL, AV_LOG_ERROR, "Failed to open file '%s'\n", vs->avf->url); -av_free(old_filename); return ret; } write_styp(vs->out); ret = flush_dynbuf(vs, &range_length); if (ret < 0) { -av_free(old_filename); return ret; } ff_format_io_close(s, &vs->out); } + +old_filename = av_strdup(vs->avf->url); +if (!old_filename) { +return AVERROR(ENOMEM); +} + ret = hls_append_segment(s, hls, vs, vs->duration, vs->start_pos, vs->size); vs->start_pos = new_start_pos; if (ret < 0) { @@ -2316,6 +2316,12 @@ failed: if ((hls->flags & HLS_TEMP_FILE) && oc->url[0]) { hls_rename_temp_file(s, oc); +av_free(old_filename); +old_filename = av_strdup(vs->avf->url); + +if (!old_filename) { +return AVERROR(ENOMEM); +} } /* after av_write_trailer, then duration + 1 duration per packet */ -- 2.5.3.windows.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 2/2] libavfilter/vf_fps: Rewrite using activate callback
Hi Nicolas, On Sun, 2018-02-18 at 19:01 +0100, Nicolas George wrote: > > Thanks for the patch. It was something I had in my TODO list for a > long > time. The code looks very good. Here are a few comments below. Of > course > open to discussion. Thanks for the review. I'm going to spend some time going over it now. I've noticed in my testing that I completely forgot to hook up the 'start_time' option, so expect a patch respin fixing that and addressing your comments as well. (I'll look at writing some tests for the start_time option too.) -- Calvin Walton ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 0/3] Finish new iteration APIs
On Mon, Feb 19, 2018 at 8:30 PM, Michael Niedermayer wrote: > On Sun, Feb 18, 2018 at 05:58:16PM +, Josh de Kock wrote: >> This should be the last of the major API changes. I'm not entirely >> sure if I missed anything. > > Moving from a register based system where a user app can register > any subset to a system which registers all via an array will > increase the size of statically linked binaries for users only > using a subset. > User apps did not have the ability to register a subset. How would they do that? They can't access the internals (ie. the ff_ references to those components) That was only something some internal tools used, and you can probably find different options for dealing with those. - Hendrik ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] avcodec/hapqa_extract_bsf : add bsf filter for haqqa (to hapq or hapalpha only) conversion
Hi Martin From 0002-avcodec-hapqa_extract_bsf-add-new-bsf-filter: > if (ctx->texture == 1) { > ... The ordering of sections in a Hap frame is not specified, so you can’t assume the first is the colour and the second alpha - you will have to query the section types for both sections and choose the appropriate one. > bytestream2_seek(&gbc, start_section_size, SEEK_SET);//On va au debut de la > texture 1 Comments in English are more helpful for those like me with terrible French. > { "texture", "texture to keep", OFFSET(texture), AV_OPT_TYPE_INT, {.i64 = 0 > }, 0, 1, }, Could there be named options to follow this (eg, “color”, “alpha”)? Cheers - Tom On 18 Feb 2018, 19:05 +, Martin Vignali , wrote: > Hello, > > Like no comment have been made for the WIP version (November 2017), > ready to apply patchs in attach > pass fate on osx (x86_64) > > > Update : > - Add doc for new bsf filter > > The goal is to convert HAPQA file to HAPQ (removing alpha) > or HAPAlphaOnly (remove rgb) > > HAPQA data, is separate in two part, one for RGB data and one for alpha data > so we can make the conversion without losses, by copying the right part. > > > Martin > > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] build: restore using dlltool/lib.exe for creating Win32 .lib files
On Sat, Feb 17, 2018 at 9:57 AM, Hendrik Leppkes wrote: > On Fri, Feb 16, 2018 at 10:21 PM, Hendrik Leppkes wrote: >> The GCC generated import libraries don't work properly when being imported >> by MSVC, resulting in missing symbols at runtime. >> >> This reverts 5b5365fe9 and partially reverts changes from 98a9b1f0d > > For the record, Martin Storsjö, the original author of the change this > is reverting, could reproduce the failure and also send a revert to > Libav. > So unless someone objects, I'll push this in a day or so, since > without it using mingw-build libraries with MSVC is impossible right > now (without manual steps to re-generate the .lib file, anyway) And applied. - Hendrik ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 2/2] libavfilter/vf_fps: Rewrite using activate callback
Just a few comments on your review: On Sun, 2018-02-18 at 19:01 +0100, Nicolas George wrote: > > @@ -91,31 +94,46 @@ static av_cold int init(AVFilterContext *ctx) > > { > > FPSContext *s = ctx->priv; > > > > -if (!(s->fifo = av_fifo_alloc_array(2, sizeof(AVFrame* > > -return AVERROR(ENOMEM); > > +/* Pass INT64_MIN/MAX through unchanged to avoid special cases > > for AV_NOPTS_VALUE */ > > +s->rounding = s->rounding | AV_ROUND_PASS_MINMAX; > > Since rounding is exposed as an option with explicit bounds, it would > probably be better to keep AV_ROUND_PASS_MINMAX out of the field and > only include it when actually calling av_rescale_q_rnd(). Makes sense, easy change. > > @@ -128,194 +146,238 @@ static int config_props(AVFilterLink* link) > > > > link->time_base = av_inv_q(s->framerate); > > link->frame_rate= s->framerate; > > -link->w = link->src->inputs[0]->w; > > -link->h = link->src->inputs[0]->h; > > Looks unrelated. I can split this into a separate cleanup patch, then. > > + > > +/* Convert the start time option to output timebase and save > > it */ > > +if (s->start_time != DBL_MAX && s->start_time != > > AV_NOPTS_VALUE) { > > +double first_pts = s->start_time * AV_TIME_BASE; > > +first_pts = FFMIN(FFMAX(first_pts, INT64_MIN), INT64_MAX); > > It would probably better to issue an error when the value is out of > representable range. I'll make this a fatal error. I considered adjusting the range of accepted values on the AVOption, but it would be tricky to get right, with rounding issues and whatnot (and I'm not sure that using DBL_MAX as an invalid/default value would still work). > > > +s->start_pts = av_rescale_q_rnd(first_pts, AV_TIME_BASE_Q, > > +link->time_base, s->rounding); > > Nit: indentation. Do you prefer the style of matching the indentation level of wrapped parameters to the ( of the function? I can do that, I'll try to make it consistent in the file. > > -return ret; > > -} > > +ret = ff_inlink_consume_frame(inlink, &frame); > > +/* Caller must have run ff_inlink_check_available_frame first > > */ > > +av_assert1(ret); > > Negative error codes must still be checked. Ah, took me a moment looking at this function's return values again to understand why this was needed. I'll add the error handling code. > > + > > +ret = ff_filter_frame(outlink, frame); > > +if (ret >= 0) { > > +s->frames_out++; > > +s->dup += dup; > > +} > > Minor nit: I would rather have "if (ret < 0) return ret;" and make > the > incrementation unconditional. Making the incrementation unconditional simplifies the flow quite a bit, I'll make that change. > > [static int void write_frame_eof()] > This whole function seems to implement the very same logic as > write_frame() with just s->status_pts instead of s->frames[1]->pts. It > should be factored. I thought about doing this, but it'll make the conditionals quite a bit more complicated. I'll spend some time trying to figure out a better way to handle this. > > +static void update_eof_pts(AVFilterContext *ctx, FPSContext *s, > > AVFilterLink *inlink, AVFilterLink *outlink) > > +{ > > +/* Convert status_pts to outlink timebase */ > > +int eof_rounding = (s->eof_action == EOF_ACTION_PASS) ? AV_ROUND_UP : > > s->rounding; > > +s->status_pts = av_rescale_q_rnd(s->status_pts, inlink->time_base, > > +outlink->time_base, eof_rounding); > > Nit: indentation. Also, I do not like the fact that s->status_pts can be > in different time bases depending on the part of the code. I would > prefer if ff_inlink_acknowledge_status() is used with a temp variable, > passed as argument to update_eof_pts(), and only the s->status_pts is > set. This is something that was bugging me a bit as well, I'll make the change. > > > > -s->frames_out++; > > +/* Buffered frames are available, so generate an output frame */ > > +if (s->frames_count == 2 && ff_outlink_frame_wanted(outlink) >= 0) > > { > > Do not check ff_outlink_frame_wanted() here: if the filter is activated > and can produce a frame, produce it. Alright. > > > +ret = write_frame(ctx, s, outlink); > > +/* Couldn't generate a frame: e.g. a frame was dropped */ > > +if (ret == AVERROR(EAGAIN)) { > > +/* Schedule us to perform another step */ > > +ff_filter_set_ready(ctx, 100); > > +return 0; > > +} > > I do not like the use of EAGAIN for this. It may conflict with strange > error codes returned by other filters. It should not happen, but it > could. I would advice to define a specific error code for this file > only, like FFERROR_REDO in libavformat/internal.h. Or, even better, add > "int *again" as an extra argument to write_frame() and return the > condition like that. I like the solution w
Re: [FFmpeg-devel] avcodec/hapqa_extract_bsf : add bsf filter for haqqa (to hapq or hapalpha only) conversion
Hi Tom, > > if (ctx->texture == 1) { > > ... > > The ordering of sections in a Hap frame is not specified, so you can’t > assume the first is the colour and the second alpha - you will have to > query the section types for both sections and choose the appropriate one. > Ok > > > bytestream2_seek(&gbc, start_section_size, SEEK_SET);//On va au debut de > la texture 1 > > Comments in English are more helpful for those like me with terrible > French. > Sorry forget to translate this one (and the previous one) ! > > { "texture", "texture to keep", OFFSET(texture), AV_OPT_TYPE_INT, {.i64 > = 0 }, 0, 1, }, > > Could there be named options to follow this (eg, “color”, “alpha”)? > Yes, probably more user friendly. I will send a new patch. Martin ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] FFmpeg 3.5 / 4.0
On Mon, 19 Feb 2018, Michael Niedermayer wrote: Hi Its 4 months since 3.4 was branched so its time for a new major release Is 4.0 or 3.5 preferred ? 4.0 Any name suggestions ? If there are no objections i will likely make that release in the next weeks Removal of the nvenc headers was also planned, I suggest we go through with it before the release. Regards, Marton ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH v2] lavf/mpegts: add supplementary audio descriptor
On Fri, Feb 16, 2018 at 11:22 AM, Stefan Pöschel wrote: > The supplementary audio descriptor is defined in ETSI EN 300 468 and > provides more details regarding accessibility audio tracks, especially > the normative annex J contains a detailed description of its use. > > Its language code (if present) overrides the language code of an also > present ISO 639 language descriptor. > > Note that this also changes the priority of multiple descriptors with > language from "the last descriptor with language within the ES loop" to > "specific descriptor over general ISO 639 descriptor". > --- > libavformat/mpegts.c | 37 - > 1 file changed, 36 insertions(+), 1 deletion(-) > > diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c > index 0a3ad05..c3b522b 100644 > --- a/libavformat/mpegts.c > +++ b/libavformat/mpegts.c > @@ -1840,7 +1840,9 @@ int ff_parse_mpeg2_descriptor(AVFormatContext *fc, > AVStream *st, int stream_type > } > if (i && language[0]) { > language[i - 1] = 0; > -av_dict_set(&st->metadata, "language", language, 0); > +/* don't overwrite language, as it may already have been set > by > + * another, more specific descriptor (e.g. supplementary > audio) */ > +av_dict_set(&st->metadata, "language", language, > AV_DICT_DONT_OVERWRITE); > } > break; > case 0x05: /* registration descriptor */ > @@ -1895,6 +1897,39 @@ int ff_parse_mpeg2_descriptor(AVFormatContext *fc, > AVStream *st, int stream_type > st->internal->need_context_update = 1; > } > } > +if (ext_desc_tag == 0x06) { /* supplementary audio descriptor */ > +char flags; > + > +if (desc_len < 1) > +return AVERROR_INVALIDDATA; > +flags = get8(pp, desc_end); > + > +switch ((flags >> 2) & 0x1F) { /* editorial_classification */ > +case 0x01: > +st->disposition |= AV_DISPOSITION_VISUAL_IMPAIRED; > +break; > +case 0x02: > +st->disposition |= AV_DISPOSITION_HEARING_IMPAIRED; > +break; > +case 0x03: > +st->disposition |= AV_DISPOSITION_VISUAL_IMPAIRED; > +break; > +} > + > +if (flags & 0x01) { /* language_code_present */ > +if (desc_len < 4) > +return AVERROR_INVALIDDATA; > +language[0] = get8(pp, desc_end); > +language[1] = get8(pp, desc_end); > +language[2] = get8(pp, desc_end); > +language[3] = 0; > + > +/* This language always has to override a possible > + * ISO 639 language descriptor language */ > +if (language[0]) > +av_dict_set(&st->metadata, "language", language, 0); > +} > +} > break; > default: > break; > LGTM. Will commit in a couple days along with my AV_DISPOSITION_DEPENDENT if no one objects. Aman > -- > 2.7.4 > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel > ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH v2] lavf/mpegts: add supplementary audio descriptor
On Mon, 19 Feb 2018, Aman Gupta wrote: On Fri, Feb 16, 2018 at 11:22 AM, Stefan Pöschel wrote: The supplementary audio descriptor is defined in ETSI EN 300 468 and provides more details regarding accessibility audio tracks, especially the normative annex J contains a detailed description of its use. Its language code (if present) overrides the language code of an also present ISO 639 language descriptor. Note that this also changes the priority of multiple descriptors with language from "the last descriptor with language within the ES loop" to "specific descriptor over general ISO 639 descriptor". --- libavformat/mpegts.c | 37 - 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c index 0a3ad05..c3b522b 100644 --- a/libavformat/mpegts.c +++ b/libavformat/mpegts.c @@ -1840,7 +1840,9 @@ int ff_parse_mpeg2_descriptor(AVFormatContext *fc, AVStream *st, int stream_type } if (i && language[0]) { language[i - 1] = 0; -av_dict_set(&st->metadata, "language", language, 0); +/* don't overwrite language, as it may already have been set by + * another, more specific descriptor (e.g. supplementary audio) */ +av_dict_set(&st->metadata, "language", language, AV_DICT_DONT_OVERWRITE); } break; case 0x05: /* registration descriptor */ @@ -1895,6 +1897,39 @@ int ff_parse_mpeg2_descriptor(AVFormatContext *fc, AVStream *st, int stream_type st->internal->need_context_update = 1; } } +if (ext_desc_tag == 0x06) { /* supplementary audio descriptor */ +char flags; Change this to int, I see no reason why this is a char. + +if (desc_len < 1) +return AVERROR_INVALIDDATA; +flags = get8(pp, desc_end); + +switch ((flags >> 2) & 0x1F) { /* editorial_classification */ +case 0x01: +st->disposition |= AV_DISPOSITION_VISUAL_IMPAIRED; +break; +case 0x02: +st->disposition |= AV_DISPOSITION_HEARING_IMPAIRED; +break; +case 0x03: +st->disposition |= AV_DISPOSITION_VISUAL_IMPAIRED; +break; +} + +if (flags & 0x01) { /* language_code_present */ +if (desc_len < 4) +return AVERROR_INVALIDDATA; +language[0] = get8(pp, desc_end); +language[1] = get8(pp, desc_end); +language[2] = get8(pp, desc_end); +language[3] = 0; + +/* This language always has to override a possible + * ISO 639 language descriptor language */ +if (language[0]) +av_dict_set(&st->metadata, "language", language, 0); +} +} break; default: break; LGTM. Will commit in a couple days along with my AV_DISPOSITION_DEPENDENT if no one objects. LGTM too otherwise. Thanks, Marton ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 1/7] lavc/mjpeg: Add profiles for MJPEG using SOF marker codes
This is needed by later hwaccel code to tell which encoding process was used for a particular frame, because hardware decoders may only support a subset of possible methods. --- libavcodec/avcodec.h | 6 ++ libavcodec/mjpegdec.c| 7 +++ tests/ref/fate/api-mjpeg-codec-param | 4 ++-- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index bc0eacd66b..74c7b9dadd 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -2918,6 +2918,12 @@ typedef struct AVCodecContext { #define FF_PROFILE_HEVC_MAIN_STILL_PICTURE 3 #define FF_PROFILE_HEVC_REXT4 +#define FF_PROFILE_MJPEG_HUFFMAN_BASELINE_DCT0xc0 +#define FF_PROFILE_MJPEG_HUFFMAN_EXTENDED_SEQUENTIAL_DCT 0xc1 +#define FF_PROFILE_MJPEG_HUFFMAN_PROGRESSIVE_DCT 0xc2 +#define FF_PROFILE_MJPEG_HUFFMAN_LOSSLESS0xc3 +#define FF_PROFILE_MJPEG_JPEG_LS 0xf7 + /** * level * - encoding: Set by user. diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c index 5055ee2826..29f99373cc 100644 --- a/libavcodec/mjpegdec.c +++ b/libavcodec/mjpegdec.c @@ -2288,6 +2288,10 @@ int ff_mjpeg_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, break; case SOF0: case SOF1: +if (start_code == SOF0) +s->avctx->profile = FF_PROFILE_MJPEG_HUFFMAN_BASELINE_DCT; +else +s->avctx->profile = FF_PROFILE_MJPEG_HUFFMAN_EXTENDED_SEQUENTIAL_DCT; s->lossless= 0; s->ls = 0; s->progressive = 0; @@ -2295,6 +2299,7 @@ int ff_mjpeg_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, goto fail; break; case SOF2: +s->avctx->profile = FF_PROFILE_MJPEG_HUFFMAN_PROGRESSIVE_DCT; s->lossless= 0; s->ls = 0; s->progressive = 1; @@ -2302,6 +2307,7 @@ int ff_mjpeg_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, goto fail; break; case SOF3: +s->avctx->profile = FF_PROFILE_MJPEG_HUFFMAN_LOSSLESS; s->avctx->properties |= FF_CODEC_PROPERTY_LOSSLESS; s->lossless= 1; s->ls = 0; @@ -2310,6 +2316,7 @@ int ff_mjpeg_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, goto fail; break; case SOF48: +s->avctx->profile = FF_PROFILE_MJPEG_JPEG_LS; s->avctx->properties |= FF_CODEC_PROPERTY_LOSSLESS; s->lossless= 1; s->ls = 1; diff --git a/tests/ref/fate/api-mjpeg-codec-param b/tests/ref/fate/api-mjpeg-codec-param index e5ad2b7656..290f941ff3 100644 --- a/tests/ref/fate/api-mjpeg-codec-param +++ b/tests/ref/fate/api-mjpeg-codec-param @@ -81,7 +81,7 @@ stream=0, decode=0 nssew=8 skip_top=0 skip_bottom=0 -profile=-99 +profile=192 level=-99 lowres=0 skip_threshold=0 @@ -221,7 +221,7 @@ stream=0, decode=1 nssew=8 skip_top=0 skip_bottom=0 -profile=-99 +profile=192 level=-99 lowres=0 skip_threshold=0 -- 2.15.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 7/7] avcodec/nvdec: Implement mjpeg nvdec hwaccel
From: Philip Langdale --- Changelog| 2 +- configure| 2 ++ libavcodec/Makefile | 1 + libavcodec/hwaccels.h| 1 + libavcodec/mjpegdec.c| 6 libavcodec/nvdec.c | 1 + libavcodec/nvdec_mjpeg.c | 86 7 files changed, 98 insertions(+), 1 deletion(-) create mode 100644 libavcodec/nvdec_mjpeg.c diff --git a/Changelog b/Changelog index 32e39b8344..a46edb318c 100644 --- a/Changelog +++ b/Changelog @@ -13,7 +13,7 @@ version : - PCE support for extended channel layouts in the AAC encoder - native aptX and aptX HD encoder and decoder - Raw aptX and aptX HD muxer and demuxer -- NVIDIA NVDEC-accelerated H.264, HEVC, MPEG-1/2/4, VC1, VP8/9 hwaccel decoding +- NVIDIA NVDEC-accelerated H.264, HEVC, MJPEG, MPEG-1/2/4, VC1, VP8/9 hwaccel decoding - Intel QSV-accelerated overlay filter - mcompand audio filter - acontrast audio filter diff --git a/configure b/configure index 4839d35747..eab9976bf7 100755 --- a/configure +++ b/configure @@ -2714,6 +2714,8 @@ hevc_vdpau_hwaccel_deps="vdpau VdpPictureInfoHEVC" hevc_vdpau_hwaccel_select="hevc_decoder" hevc_videotoolbox_hwaccel_deps="videotoolbox" hevc_videotoolbox_hwaccel_select="hevc_decoder" +mjpeg_nvdec_hwaccel_deps="nvdec" +mjpeg_nvdec_hwaccel_select="mjpeg_decoder" mjpeg_vaapi_hwaccel_deps="vaapi" mjpeg_vaapi_hwaccel_select="mjpeg_decoder" mpeg_xvmc_hwaccel_deps="xvmc" diff --git a/libavcodec/Makefile b/libavcodec/Makefile index de52bc2094..c7a5692421 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -854,6 +854,7 @@ OBJS-$(CONFIG_HEVC_NVDEC_HWACCEL) += nvdec_hevc.o OBJS-$(CONFIG_HEVC_QSV_HWACCEL) += qsvdec_h2645.o OBJS-$(CONFIG_HEVC_VAAPI_HWACCEL) += vaapi_hevc.o OBJS-$(CONFIG_HEVC_VDPAU_HWACCEL) += vdpau_hevc.o +OBJS-$(CONFIG_MJPEG_NVDEC_HWACCEL)+= nvdec_mjpeg.o OBJS-$(CONFIG_MJPEG_VAAPI_HWACCEL)+= vaapi_mjpeg.o OBJS-$(CONFIG_MPEG1_NVDEC_HWACCEL)+= nvdec_mpeg12.o OBJS-$(CONFIG_MPEG1_VDPAU_HWACCEL)+= vdpau_mpeg12.o diff --git a/libavcodec/hwaccels.h b/libavcodec/hwaccels.h index 420e2feeea..7d73da8676 100644 --- a/libavcodec/hwaccels.h +++ b/libavcodec/hwaccels.h @@ -37,6 +37,7 @@ extern const AVHWAccel ff_hevc_nvdec_hwaccel; extern const AVHWAccel ff_hevc_vaapi_hwaccel; extern const AVHWAccel ff_hevc_vdpau_hwaccel; extern const AVHWAccel ff_hevc_videotoolbox_hwaccel; +extern const AVHWAccel ff_mjpeg_nvdec_hwaccel; extern const AVHWAccel ff_mjpeg_vaapi_hwaccel; extern const AVHWAccel ff_mpeg1_nvdec_hwaccel; extern const AVHWAccel ff_mpeg1_vdpau_hwaccel; diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c index 939f2849d0..beef174618 100644 --- a/libavcodec/mjpegdec.c +++ b/libavcodec/mjpegdec.c @@ -650,6 +650,9 @@ unk_pixfmt: s->avctx->pix_fmt = s->hwaccel_pix_fmt; } else { enum AVPixelFormat pix_fmts[] = { +#if CONFIG_MJPEG_NVDEC_HWACCEL +AV_PIX_FMT_CUDA, +#endif #if CONFIG_MJPEG_VAAPI_HWACCEL AV_PIX_FMT_VAAPI, #endif @@ -2780,6 +2783,9 @@ AVCodec ff_mjpeg_decoder = { .caps_internal = FF_CODEC_CAP_INIT_THREADSAFE | FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM, .hw_configs = (const AVCodecHWConfigInternal*[]) { +#if CONFIG_MJPEG_NVDEC_HWACCEL +HWACCEL_NVDEC(mjpeg), +#endif #if CONFIG_MJPEG_VAAPI_HWACCEL HWACCEL_VAAPI(mjpeg), #endif diff --git a/libavcodec/nvdec.c b/libavcodec/nvdec.c index e9e6ea0f8b..ab3cb88b27 100644 --- a/libavcodec/nvdec.c +++ b/libavcodec/nvdec.c @@ -54,6 +54,7 @@ static int map_avcodec_id(enum AVCodecID id) switch (id) { case AV_CODEC_ID_H264: return cudaVideoCodec_H264; case AV_CODEC_ID_HEVC: return cudaVideoCodec_HEVC; +case AV_CODEC_ID_MJPEG: return cudaVideoCodec_JPEG; case AV_CODEC_ID_MPEG1VIDEO: return cudaVideoCodec_MPEG1; case AV_CODEC_ID_MPEG2VIDEO: return cudaVideoCodec_MPEG2; case AV_CODEC_ID_MPEG4: return cudaVideoCodec_MPEG4; diff --git a/libavcodec/nvdec_mjpeg.c b/libavcodec/nvdec_mjpeg.c new file mode 100644 index 00..7e404246ce --- /dev/null +++ b/libavcodec/nvdec_mjpeg.c @@ -0,0 +1,86 @@ +/* + * MJPEG HW decode acceleration through NVDEC + * + * Copyright (c) 2017 Philip Langdale + * + * 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 FFmp
[FFmpeg-devel] [PATCH 6/7] vaapi: Add MJPEG decode hwaccel
--- Tested on both Intel and AMD. Some issues on both, but they all seem to be on the driver side. Changelog | 2 +- configure | 2 + libavcodec/Makefile | 1 + libavcodec/hwaccels.h | 1 + libavcodec/mjpegdec.c | 6 ++ libavcodec/vaapi_decode.c | 2 + libavcodec/vaapi_mjpeg.c | 159 ++ 7 files changed, 172 insertions(+), 1 deletion(-) create mode 100644 libavcodec/vaapi_mjpeg.c diff --git a/Changelog b/Changelog index 2acdbbea30..32e39b8344 100644 --- a/Changelog +++ b/Changelog @@ -21,7 +21,7 @@ version : - video mix filter - video normalize filter - audio lv2 wrapper filter -- VAAPI VP8 decoding +- VAAPI MJPEG and VP8 decoding - AMD AMF H.264 and HEVC encoders - video fillborders filter - video setrange filter diff --git a/configure b/configure index 99c53d482a..4839d35747 100755 --- a/configure +++ b/configure @@ -2714,6 +2714,8 @@ hevc_vdpau_hwaccel_deps="vdpau VdpPictureInfoHEVC" hevc_vdpau_hwaccel_select="hevc_decoder" hevc_videotoolbox_hwaccel_deps="videotoolbox" hevc_videotoolbox_hwaccel_select="hevc_decoder" +mjpeg_vaapi_hwaccel_deps="vaapi" +mjpeg_vaapi_hwaccel_select="mjpeg_decoder" mpeg_xvmc_hwaccel_deps="xvmc" mpeg_xvmc_hwaccel_select="mpeg2video_decoder" mpeg1_nvdec_hwaccel_deps="nvdec" diff --git a/libavcodec/Makefile b/libavcodec/Makefile index 3d4b738e0b..de52bc2094 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -854,6 +854,7 @@ OBJS-$(CONFIG_HEVC_NVDEC_HWACCEL) += nvdec_hevc.o OBJS-$(CONFIG_HEVC_QSV_HWACCEL) += qsvdec_h2645.o OBJS-$(CONFIG_HEVC_VAAPI_HWACCEL) += vaapi_hevc.o OBJS-$(CONFIG_HEVC_VDPAU_HWACCEL) += vdpau_hevc.o +OBJS-$(CONFIG_MJPEG_VAAPI_HWACCEL)+= vaapi_mjpeg.o OBJS-$(CONFIG_MPEG1_NVDEC_HWACCEL)+= nvdec_mpeg12.o OBJS-$(CONFIG_MPEG1_VDPAU_HWACCEL)+= vdpau_mpeg12.o OBJS-$(CONFIG_MPEG1_VIDEOTOOLBOX_HWACCEL) += videotoolbox.o diff --git a/libavcodec/hwaccels.h b/libavcodec/hwaccels.h index fcfe4e088e..420e2feeea 100644 --- a/libavcodec/hwaccels.h +++ b/libavcodec/hwaccels.h @@ -37,6 +37,7 @@ extern const AVHWAccel ff_hevc_nvdec_hwaccel; extern const AVHWAccel ff_hevc_vaapi_hwaccel; extern const AVHWAccel ff_hevc_vdpau_hwaccel; extern const AVHWAccel ff_hevc_videotoolbox_hwaccel; +extern const AVHWAccel ff_mjpeg_vaapi_hwaccel; extern const AVHWAccel ff_mpeg1_nvdec_hwaccel; extern const AVHWAccel ff_mpeg1_vdpau_hwaccel; extern const AVHWAccel ff_mpeg1_videotoolbox_hwaccel; diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c index 6141f06367..939f2849d0 100644 --- a/libavcodec/mjpegdec.c +++ b/libavcodec/mjpegdec.c @@ -650,6 +650,9 @@ unk_pixfmt: s->avctx->pix_fmt = s->hwaccel_pix_fmt; } else { enum AVPixelFormat pix_fmts[] = { +#if CONFIG_MJPEG_VAAPI_HWACCEL +AV_PIX_FMT_VAAPI, +#endif s->avctx->pix_fmt, AV_PIX_FMT_NONE, }; @@ -2777,6 +2780,9 @@ AVCodec ff_mjpeg_decoder = { .caps_internal = FF_CODEC_CAP_INIT_THREADSAFE | FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM, .hw_configs = (const AVCodecHWConfigInternal*[]) { +#if CONFIG_MJPEG_VAAPI_HWACCEL +HWACCEL_VAAPI(mjpeg), +#endif NULL }, }; diff --git a/libavcodec/vaapi_decode.c b/libavcodec/vaapi_decode.c index 28c6eeb801..d0a6b5817d 100644 --- a/libavcodec/vaapi_decode.c +++ b/libavcodec/vaapi_decode.c @@ -379,6 +379,8 @@ static const struct { MAP(HEVC,HEVC_MAIN, HEVCMain), MAP(HEVC,HEVC_MAIN_10,HEVCMain10 ), #endif +MAP(MJPEG, MJPEG_HUFFMAN_BASELINE_DCT, + JPEGBaseline), MAP(WMV3,VC1_SIMPLE, VC1Simple ), MAP(WMV3,VC1_MAIN,VC1Main ), MAP(WMV3,VC1_COMPLEX, VC1Advanced ), diff --git a/libavcodec/vaapi_mjpeg.c b/libavcodec/vaapi_mjpeg.c new file mode 100644 index 00..14e0206ae1 --- /dev/null +++ b/libavcodec/vaapi_mjpeg.c @@ -0,0 +1,159 @@ +/* + * 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 +#include + +#include "hwaccel.h" +#include "vaapi_decode.h" +#include "mjpegdec.h" +
[FFmpeg-devel] [PATCH 5/7] vaapi_decode: Make the frames context format selection more general
Examine the supported fourcc list manually and make the best choice, then use the external attribute on the frames context to force that fourcc. --- libavcodec/vaapi_decode.c | 152 +++--- libavcodec/vaapi_decode.h | 2 + 2 files changed, 132 insertions(+), 22 deletions(-) diff --git a/libavcodec/vaapi_decode.c b/libavcodec/vaapi_decode.c index 572b3a40ac..28c6eeb801 100644 --- a/libavcodec/vaapi_decode.c +++ b/libavcodec/vaapi_decode.c @@ -232,6 +232,132 @@ int ff_vaapi_decode_cancel(AVCodecContext *avctx, return 0; } +static const struct { +uint32_t fourcc; +enum AVPixelFormat pix_fmt; +} vaapi_format_map[] = { +#define MAP(va, av) { VA_FOURCC_ ## va, AV_PIX_FMT_ ## av } +// 4:0:0 +MAP(Y800, GRAY8), +// 4:2:0 +MAP(NV12, NV12), +MAP(YV12, YUV420P), +MAP(IYUV, YUV420P), +#ifdef VA_FOURCC_I420 +MAP(I420, YUV420P), +#endif +MAP(IMC3, YUV420P), +// 4:1:1 +MAP(411P, YUV411P), +// 4:2:2 +MAP(422H, YUV422P), +#ifdef VA_FOURCC_YV16 +MAP(YV16, YUV422P), +#endif +// 4:4:0 +MAP(422V, YUV440P), +// 4:4:4 +MAP(444P, YUV444P), +// 4:2:0 10-bit +#ifdef VA_FOURCC_P010 +MAP(P010, P010), +#endif +#ifdef VA_FOURCC_I010 +MAP(I010, YUV420P10), +#endif +#undef MAP +}; + +static int vaapi_decode_find_best_format(AVCodecContext *avctx, + AVHWDeviceContext *device, + VAConfigID config_id, + AVHWFramesContext *frames) +{ +AVVAAPIDeviceContext *hwctx = device->hwctx; +VAStatus vas; +VASurfaceAttrib *attr; +enum AVPixelFormat source_format, best_format, format; +uint32_t best_fourcc, fourcc; +int i, j, nb_attr; + +source_format = avctx->sw_pix_fmt; +av_assert0(source_format != AV_PIX_FMT_NONE); + +vas = vaQuerySurfaceAttributes(hwctx->display, config_id, + NULL, &nb_attr); +if (vas != VA_STATUS_SUCCESS) { +av_log(avctx, AV_LOG_ERROR, "Failed to query surface attributes: " + "%d (%s).\n", vas, vaErrorStr(vas)); +return AVERROR(ENOSYS); +} + +attr = av_malloc_array(nb_attr, sizeof(*attr)); +if (!attr) +return AVERROR(ENOMEM); + +vas = vaQuerySurfaceAttributes(hwctx->display, config_id, + attr, &nb_attr); +if (vas != VA_STATUS_SUCCESS) { +av_log(avctx, AV_LOG_ERROR, "Failed to query surface attributes: " + "%d (%s).\n", vas, vaErrorStr(vas)); +av_freep(&attr); +return AVERROR(ENOSYS); +} + +best_format = AV_PIX_FMT_NONE; + +for (i = 0; i < nb_attr; i++) { +if (attr[i].type != VASurfaceAttribPixelFormat) +continue; + +fourcc = attr[i].value.value.i; +for (j = 0; j < FF_ARRAY_ELEMS(vaapi_format_map); j++) { +if (fourcc == vaapi_format_map[j].fourcc) +break; +} +if (j >= FF_ARRAY_ELEMS(vaapi_format_map)) { +av_log(avctx, AV_LOG_DEBUG, "Ignoring unknown format %#x.\n", + fourcc); +continue; +} +format = vaapi_format_map[j].pix_fmt; +av_log(avctx, AV_LOG_DEBUG, "Considering format %#x -> %s.\n", + fourcc, av_get_pix_fmt_name(format)); + +best_format = av_find_best_pix_fmt_of_2(format, best_format, +source_format, 0, NULL); +if (format == best_format) +best_fourcc = fourcc; +} + +av_freep(&attr); + +if (best_format == AV_PIX_FMT_NONE) { +av_log(avctx, AV_LOG_ERROR, "No usable formats for decoding!\n"); +return AVERROR(EINVAL); +} + +av_log(avctx, AV_LOG_DEBUG, "Picked %s (%#x) as best match for %s.\n", + av_get_pix_fmt_name(best_format), best_fourcc, + av_get_pix_fmt_name(source_format)); + +frames->sw_format = best_format; +if (avctx->internal->hwaccel_priv_data) { +VAAPIDecodeContext*ctx = avctx->internal->hwaccel_priv_data; +AVVAAPIFramesContext *avfc = frames->hwctx; + +ctx->pixel_format_attribute = (VASurfaceAttrib) { +.type = VASurfaceAttribPixelFormat, +.value.value.i = best_fourcc, +}; + +avfc->attributes= &ctx->pixel_format_attribute; +avfc->nb_attributes = 1; +} + +return 0; +} + static const struct { enum AVCodecID codec_id; int codec_profile; @@ -289,7 +415,6 @@ static int vaapi_decode_make_config(AVCodecContext *avctx, const AVCodecDescriptor *codec_desc; VAProfile *profile_list = NULL, matched_va_profile; int profile_count, exact_match, matched_ff_profile; -const AVPixFmtDescriptor *sw_desc, *desc; AVHWDeviceContext*device = (AVHWDeviceContext*)device_ref->data; AVVAAPIDeviceContext *hwctx = device->hwctx; @@ -417,27 +542,10 @
[FFmpeg-devel] [PATCH 2/7] mjpegdec: Add hwaccel hooks
Also adds some extra fields to the main context structure that may be needed by a hwaccel decoder. --- YUVJ hacks are removed, they will be handled in API-specific code. libavcodec/mjpegdec.c | 74 --- libavcodec/mjpegdec.h | 13 + 2 files changed, 83 insertions(+), 4 deletions(-) diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c index 29f99373cc..6141f06367 100644 --- a/libavcodec/mjpegdec.c +++ b/libavcodec/mjpegdec.c @@ -36,6 +36,7 @@ #include "avcodec.h" #include "blockdsp.h" #include "copy_block.h" +#include "hwaccel.h" #include "idctdsp.h" #include "internal.h" #include "jpegtables.h" @@ -147,6 +148,7 @@ av_cold int ff_mjpeg_decode_init(AVCodecContext *avctx) s->org_height= avctx->coded_height; avctx->chroma_sample_location = AVCHROMA_LOC_CENTER; avctx->colorspace = AVCOL_SPC_BT470BG; +s->hwaccel_pix_fmt = s->hwaccel_sw_pix_fmt = AV_PIX_FMT_NONE; if ((ret = build_basic_mjpeg_vlc(s)) < 0) return ret; @@ -279,13 +281,18 @@ int ff_mjpeg_decode_dht(MJpegDecodeContext *s) code_max + 1, 0, 0)) < 0) return ret; } + +for (i = 0; i < 16; i++) +s->raw_huffman_lengths[class][index][i] = bits_table[i + 1]; +for (i = 0; i < 256; i++) +s->raw_huffman_values[class][index][i] = val_table[i]; } return 0; } int ff_mjpeg_decode_sof(MJpegDecodeContext *s) { -int len, nb_components, i, width, height, bits, ret; +int len, nb_components, i, width, height, bits, ret, size_change; unsigned pix_fmt_id; int h_count[MAX_COMPONENTS] = { 0 }; int v_count[MAX_COMPONENTS] = { 0 }; @@ -392,6 +399,7 @@ int ff_mjpeg_decode_sof(MJpegDecodeContext *s) if (width != s->width || height != s->height || bits != s->bits || memcmp(s->h_count, h_count, sizeof(h_count))|| memcmp(s->v_count, v_count, sizeof(v_count))) { +size_change = 1; s->width = width; s->height = height; @@ -418,6 +426,8 @@ int ff_mjpeg_decode_sof(MJpegDecodeContext *s) return ret; s->first_picture = 0; +} else { +size_change = 0; } if (s->got_picture && s->interlaced && (s->bottom_field == !s->interlace_polarity)) { @@ -636,6 +646,21 @@ unk_pixfmt: return AVERROR_BUG; } +if (s->avctx->pix_fmt == s->hwaccel_sw_pix_fmt && !size_change) { +s->avctx->pix_fmt = s->hwaccel_pix_fmt; +} else { +enum AVPixelFormat pix_fmts[] = { +s->avctx->pix_fmt, +AV_PIX_FMT_NONE, +}; +s->hwaccel_pix_fmt = ff_get_format(s->avctx, pix_fmts); +if (s->hwaccel_pix_fmt < 0) +return AVERROR(EINVAL); + +s->hwaccel_sw_pix_fmt = s->avctx->pix_fmt; +s->avctx->pix_fmt = s->hwaccel_pix_fmt; +} + if (s->avctx->skip_frame == AVDISCARD_ALL) { s->picture_ptr->pict_type = AV_PICTURE_TYPE_I; s->picture_ptr->key_frame = 1; @@ -683,6 +708,19 @@ unk_pixfmt: } memset(s->coefs_finished, 0, sizeof(s->coefs_finished)); } + +if (s->avctx->hwaccel) { +s->hwaccel_picture_private = +av_mallocz(s->avctx->hwaccel->frame_priv_data_size); +if (!s->hwaccel_picture_private) +return AVERROR(ENOMEM); + +ret = s->avctx->hwaccel->start_frame(s->avctx, s->raw_image_buffer, + s->raw_image_buffer_size); +if (ret < 0) +return ret; +} + return 0; } @@ -1510,7 +1548,6 @@ int ff_mjpeg_decode_sos(MJpegDecodeContext *s, const uint8_t *mb_bitmask, } } -av_assert0(s->picture_ptr->data[0]); /* XXX: verify len field validity */ len = get_bits(&s->gb, 16); nb_components = get_bits(&s->gb, 8); @@ -1600,7 +1637,18 @@ next_field: for (i = 0; i < nb_components; i++) s->last_dc[i] = (4 << s->bits); -if (s->lossless) { +if (s->avctx->hwaccel) { +int bytes_to_start = get_bits_count(&s->gb) / 8; +av_assert0(bytes_to_start >= 0 && + s->raw_scan_buffer_size >= bytes_to_start); + +ret = s->avctx->hwaccel->decode_slice(s->avctx, + s->raw_scan_buffer + bytes_to_start, + s->raw_scan_buffer_size - bytes_to_start); +if (ret < 0) +return ret; + +} else if (s->lossless) { av_assert0(s->picture_ptr == s->picture); if (CONFIG_JPEGLS_DECODER && s->ls) { //for () { @@ -2278,6 +2326,8 @@ int ff_mjpeg_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, case SOI: s->restart_interval = 0; s->restart_count= 0; +s->raw_image_buffer = buf_ptr; +s->raw_image_buffer_size = buf_end - buf_ptr
[FFmpeg-devel] [PATCH 3/7] hwcontext_vaapi: Add more surface formats
Adds YUV 4:1:1, 4:4:0 and 4:4:4 - these will be needed for JPEG decoding. --- libavutil/hwcontext_vaapi.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libavutil/hwcontext_vaapi.c b/libavutil/hwcontext_vaapi.c index 29698d1b27..68f88ecd6b 100644 --- a/libavutil/hwcontext_vaapi.c +++ b/libavutil/hwcontext_vaapi.c @@ -110,6 +110,9 @@ static const struct { MAP(422H, YUV422, YUV422P), MAP(UYVY, YUV422, UYVY422), MAP(YUY2, YUV422, YUYV422), +MAP(411P, YUV411, YUV411P), +MAP(422V, YUV422, YUV440P), +MAP(444P, YUV444, YUV444P), MAP(Y800, YUV400, GRAY8), #ifdef VA_FOURCC_P010 MAP(P010, YUV420_10BPP, P010), -- 2.15.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 4/7] hwcontext_vaapi: Fix frames context creation with external attributes
--- libavutil/hwcontext_vaapi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavutil/hwcontext_vaapi.c b/libavutil/hwcontext_vaapi.c index 68f88ecd6b..af9a136ef0 100644 --- a/libavutil/hwcontext_vaapi.c +++ b/libavutil/hwcontext_vaapi.c @@ -475,9 +475,9 @@ static int vaapi_frames_init(AVHWFramesContext *hwfc) int need_memory_type = !(hwctx->driver_quirks & AV_VAAPI_DRIVER_QUIRK_ATTRIB_MEMTYPE); int need_pixel_format = 1; for (i = 0; i < avfc->nb_attributes; i++) { -if (ctx->attributes[i].type == VASurfaceAttribMemoryType) +if (avfc->attributes[i].type == VASurfaceAttribMemoryType) need_memory_type = 0; -if (ctx->attributes[i].type == VASurfaceAttribPixelFormat) +if (avfc->attributes[i].type == VASurfaceAttribPixelFormat) need_pixel_format = 0; } ctx->nb_attributes = -- 2.15.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avformat/mpegts: set AV_DISPOSITION_DEPENDENT for mix_type=0 supplementary audio
On Fri, Feb 16, 2018 at 11:06 AM, Aman Gupta wrote: > From: Aman Gupta > > --- > fftools/ffmpeg.c | 1 + > libavformat/avformat.h | 1 + > libavformat/dump.c | 2 ++ > libavformat/mpegts.c | 3 +++ > 4 files changed, 7 insertions(+) > > diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c > index a37de2ff98..bea922b0aa 100644 > --- a/fftools/ffmpeg.c > +++ b/fftools/ffmpeg.c > @@ -3592,6 +3592,7 @@ static int init_output_stream(OutputStream *ost, > char *error, int error_len) > { "clean_effects" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 > = AV_DISPOSITION_CLEAN_EFFECTS },.unit = "flags" }, > { "captions", NULL, 0, AV_OPT_TYPE_CONST, { .i64 > = AV_DISPOSITION_CAPTIONS },.unit = "flags" }, > { "descriptions", NULL, 0, AV_OPT_TYPE_CONST, { .i64 > = AV_DISPOSITION_DESCRIPTIONS },.unit = "flags" }, > +{ "dependent" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 > = AV_DISPOSITION_DEPENDENT },.unit = "flags" }, > { "metadata", NULL, 0, AV_OPT_TYPE_CONST, { .i64 > = AV_DISPOSITION_METADATA },.unit = "flags" }, > { NULL }, > }; > diff --git a/libavformat/avformat.h b/libavformat/avformat.h > index 4ea1b5ab72..78e87be8fb 100644 > --- a/libavformat/avformat.h > +++ b/libavformat/avformat.h > @@ -845,6 +845,7 @@ typedef struct AVStreamInternal AVStreamInternal; > #define AV_DISPOSITION_CAPTIONS 0x1 > #define AV_DISPOSITION_DESCRIPTIONS 0x2 > #define AV_DISPOSITION_METADATA 0x4 > +#define AV_DISPOSITION_DEPENDENT0x8 > I know there's a limited number of bits available for flags, but I think this one makes sense to add and doesn't overlap with any of the existing options. Any objections? Aman > > /** > * Options for behavior on timestamp wrap detection. > diff --git a/libavformat/dump.c b/libavformat/dump.c > index ef143fd4e2..3a1379c356 100644 > --- a/libavformat/dump.c > +++ b/libavformat/dump.c > @@ -547,6 +547,8 @@ static void dump_stream_format(AVFormatContext *ic, > int i, > av_log(NULL, AV_LOG_INFO, " (visual impaired)"); > if (st->disposition & AV_DISPOSITION_CLEAN_EFFECTS) > av_log(NULL, AV_LOG_INFO, " (clean effects)"); > +if (st->disposition & AV_DISPOSITION_DEPENDENT) > +av_log(NULL, AV_LOG_INFO, " (dependent)"); > av_log(NULL, AV_LOG_INFO, "\n"); > > dump_metadata(NULL, st->metadata, ""); > diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c > index e5d0e1eefb..5f547b591b 100644 > --- a/libavformat/mpegts.c > +++ b/libavformat/mpegts.c > @@ -1904,6 +1904,9 @@ int ff_parse_mpeg2_descriptor(AVFormatContext *fc, > AVStream *st, int stream_type > return AVERROR_INVALIDDATA; > flags = get8(pp, desc_end); > > +if ((flags & 0x80) == 0) /* mix_type */ > +st->disposition |= AV_DISPOSITION_DEPENDENT; > + > switch ((flags >> 2) & 0x1F) { > case 0x01: > st->disposition |= AV_DISPOSITION_VISUAL_IMPAIRED; > -- > 2.14.2 > > ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] docs/codecs: remove dead codec debug options
On Sat, Feb 17, 2018, at 10:56 AM, Lou Logan wrote: > LGTM. Sorry for the delay. I'll push by Monday unless someone else wants > to do so earlier. Pushed/applied. Thanks. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 1/7] lavc/mjpeg: Add profiles for MJPEG using SOF marker codes
On Mon, 19 Feb 2018 23:28:43 + Mark Thompson wrote: > This is needed by later hwaccel code to tell which encoding process > was used for a particular frame, because hardware decoders may only > support a subset of possible methods. > --- > libavcodec/avcodec.h | 6 ++ > libavcodec/mjpegdec.c| 7 +++ > tests/ref/fate/api-mjpeg-codec-param | 4 ++-- > 3 files changed, 15 insertions(+), 2 deletions(-) > > diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h > index bc0eacd66b..74c7b9dadd 100644 > --- a/libavcodec/avcodec.h > +++ b/libavcodec/avcodec.h > @@ -2918,6 +2918,12 @@ typedef struct AVCodecContext { > #define FF_PROFILE_HEVC_MAIN_STILL_PICTURE 3 > #define FF_PROFILE_HEVC_REXT4 > > +#define FF_PROFILE_MJPEG_HUFFMAN_BASELINE_DCT0xc0 > +#define FF_PROFILE_MJPEG_HUFFMAN_EXTENDED_SEQUENTIAL_DCT 0xc1 > +#define FF_PROFILE_MJPEG_HUFFMAN_PROGRESSIVE_DCT 0xc2 > +#define FF_PROFILE_MJPEG_HUFFMAN_LOSSLESS0xc3 > +#define FF_PROFILE_MJPEG_JPEG_LS 0xf7 > + > /** > * level > * - encoding: Set by user. > diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c > index 5055ee2826..29f99373cc 100644 > --- a/libavcodec/mjpegdec.c > +++ b/libavcodec/mjpegdec.c > @@ -2288,6 +2288,10 @@ int ff_mjpeg_decode_frame(AVCodecContext > *avctx, void *data, int *got_frame, break; > case SOF0: > case SOF1: > +if (start_code == SOF0) > +s->avctx->profile = > FF_PROFILE_MJPEG_HUFFMAN_BASELINE_DCT; > +else > +s->avctx->profile = > FF_PROFILE_MJPEG_HUFFMAN_EXTENDED_SEQUENTIAL_DCT; s->lossless= 0; > s->ls = 0; > s->progressive = 0; > @@ -2295,6 +2299,7 @@ int ff_mjpeg_decode_frame(AVCodecContext > *avctx, void *data, int *got_frame, goto fail; > break; > case SOF2: > +s->avctx->profile = > FF_PROFILE_MJPEG_HUFFMAN_PROGRESSIVE_DCT; s->lossless= 0; > s->ls = 0; > s->progressive = 1; > @@ -2302,6 +2307,7 @@ int ff_mjpeg_decode_frame(AVCodecContext > *avctx, void *data, int *got_frame, goto fail; > break; > case SOF3: > +s->avctx->profile = > FF_PROFILE_MJPEG_HUFFMAN_LOSSLESS; s->avctx->properties |= > FF_CODEC_PROPERTY_LOSSLESS; s->lossless= 1; > s->ls = 0; > @@ -2310,6 +2316,7 @@ int ff_mjpeg_decode_frame(AVCodecContext > *avctx, void *data, int *got_frame, goto fail; > break; > case SOF48: > +s->avctx->profile = FF_PROFILE_MJPEG_JPEG_LS; > s->avctx->properties |= FF_CODEC_PROPERTY_LOSSLESS; > s->lossless= 1; > s->ls = 1; > diff --git a/tests/ref/fate/api-mjpeg-codec-param > b/tests/ref/fate/api-mjpeg-codec-param index e5ad2b7656..290f941ff3 > 100644 --- a/tests/ref/fate/api-mjpeg-codec-param > +++ b/tests/ref/fate/api-mjpeg-codec-param > @@ -81,7 +81,7 @@ stream=0, decode=0 > nssew=8 > skip_top=0 > skip_bottom=0 > -profile=-99 > +profile=192 > level=-99 > lowres=0 > skip_threshold=0 > @@ -221,7 +221,7 @@ stream=0, decode=1 > nssew=8 > skip_top=0 > skip_bottom=0 > -profile=-99 > +profile=192 > level=-99 > lowres=0 > skip_threshold=0 LGTM --phil ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 2/7] mjpegdec: Add hwaccel hooks
On Mon, 19 Feb 2018 23:28:44 + Mark Thompson wrote: > Also adds some extra fields to the main context structure that may > be needed by a hwaccel decoder. > --- > YUVJ hacks are removed, they will be handled in API-specific code. > > > libavcodec/mjpegdec.c | 74 > --- > libavcodec/mjpegdec.h | 13 + 2 files changed, 83 > insertions(+), 4 deletions(-) > > diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c > index 29f99373cc..6141f06367 100644 > --- a/libavcodec/mjpegdec.c > +++ b/libavcodec/mjpegdec.c > @@ -36,6 +36,7 @@ > #include "avcodec.h" > #include "blockdsp.h" > #include "copy_block.h" > +#include "hwaccel.h" > #include "idctdsp.h" > #include "internal.h" > #include "jpegtables.h" > @@ -147,6 +148,7 @@ av_cold int ff_mjpeg_decode_init(AVCodecContext > *avctx) s->org_height= avctx->coded_height; > avctx->chroma_sample_location = AVCHROMA_LOC_CENTER; > avctx->colorspace = AVCOL_SPC_BT470BG; > +s->hwaccel_pix_fmt = s->hwaccel_sw_pix_fmt = AV_PIX_FMT_NONE; > > if ((ret = build_basic_mjpeg_vlc(s)) < 0) > return ret; > @@ -279,13 +281,18 @@ int ff_mjpeg_decode_dht(MJpegDecodeContext *s) > code_max + 1, 0, 0)) < 0) > return ret; > } > + > +for (i = 0; i < 16; i++) > +s->raw_huffman_lengths[class][index][i] = bits_table[i + > 1]; > +for (i = 0; i < 256; i++) > +s->raw_huffman_values[class][index][i] = val_table[i]; > } > return 0; > } > > int ff_mjpeg_decode_sof(MJpegDecodeContext *s) > { > -int len, nb_components, i, width, height, bits, ret; > +int len, nb_components, i, width, height, bits, ret, size_change; > unsigned pix_fmt_id; > int h_count[MAX_COMPONENTS] = { 0 }; > int v_count[MAX_COMPONENTS] = { 0 }; > @@ -392,6 +399,7 @@ int ff_mjpeg_decode_sof(MJpegDecodeContext *s) > if (width != s->width || height != s->height || bits != s->bits > || memcmp(s->h_count, h_count, sizeof(h_count))|| > memcmp(s->v_count, v_count, sizeof(v_count))) { > +size_change = 1; > > s->width = width; > s->height = height; > @@ -418,6 +426,8 @@ int ff_mjpeg_decode_sof(MJpegDecodeContext *s) > return ret; > > s->first_picture = 0; > +} else { > +size_change = 0; > } > > if (s->got_picture && s->interlaced && (s->bottom_field > == !s->interlace_polarity)) { @@ -636,6 +646,21 @@ unk_pixfmt: > return AVERROR_BUG; > } > > +if (s->avctx->pix_fmt == s->hwaccel_sw_pix_fmt && !size_change) { > +s->avctx->pix_fmt = s->hwaccel_pix_fmt; > +} else { > +enum AVPixelFormat pix_fmts[] = { > +s->avctx->pix_fmt, > +AV_PIX_FMT_NONE, > +}; > +s->hwaccel_pix_fmt = ff_get_format(s->avctx, pix_fmts); > +if (s->hwaccel_pix_fmt < 0) > +return AVERROR(EINVAL); > + > +s->hwaccel_sw_pix_fmt = s->avctx->pix_fmt; > +s->avctx->pix_fmt = s->hwaccel_pix_fmt; > +} > + > if (s->avctx->skip_frame == AVDISCARD_ALL) { > s->picture_ptr->pict_type = AV_PICTURE_TYPE_I; > s->picture_ptr->key_frame = 1; > @@ -683,6 +708,19 @@ unk_pixfmt: > } > memset(s->coefs_finished, 0, sizeof(s->coefs_finished)); > } > + > +if (s->avctx->hwaccel) { > +s->hwaccel_picture_private = > +av_mallocz(s->avctx->hwaccel->frame_priv_data_size); > +if (!s->hwaccel_picture_private) > +return AVERROR(ENOMEM); > + > +ret = s->avctx->hwaccel->start_frame(s->avctx, > s->raw_image_buffer, > + > s->raw_image_buffer_size); > +if (ret < 0) > +return ret; > +} > + > return 0; > } > > @@ -1510,7 +1548,6 @@ int ff_mjpeg_decode_sos(MJpegDecodeContext *s, > const uint8_t *mb_bitmask, } > } > > -av_assert0(s->picture_ptr->data[0]); > /* XXX: verify len field validity */ > len = get_bits(&s->gb, 16); > nb_components = get_bits(&s->gb, 8); > @@ -1600,7 +1637,18 @@ next_field: > for (i = 0; i < nb_components; i++) > s->last_dc[i] = (4 << s->bits); > > -if (s->lossless) { > +if (s->avctx->hwaccel) { > +int bytes_to_start = get_bits_count(&s->gb) / 8; > +av_assert0(bytes_to_start >= 0 && > + s->raw_scan_buffer_size >= bytes_to_start); > + > +ret = s->avctx->hwaccel->decode_slice(s->avctx, > + > s->raw_scan_buffer + bytes_to_start, > + > s->raw_scan_buffer_size - bytes_to_start); > +if (ret < 0) > +return ret; > + > +} else if (s->lossless) { > av_assert0(s->picture_ptr == s->picture); > if (CONFIG_JPEGLS_DECODER && s->ls) { > //for () { > @@ -2278,6 +2326,8 @@ int ff_mjpeg_decode_frame(AVCodecContext > *avctx, void *data, int *got_frame, case SOI: >
Re: [FFmpeg-devel] [PATCH 7/7] avcodec/nvdec: Implement mjpeg nvdec hwaccel
On Mon, 19 Feb 2018 23:28:49 + Mark Thompson wrote: > From: Philip Langdale > > --- > Changelog| 2 +- > configure| 2 ++ > libavcodec/Makefile | 1 + > libavcodec/hwaccels.h| 1 + > libavcodec/mjpegdec.c| 6 > libavcodec/nvdec.c | 1 + > libavcodec/nvdec_mjpeg.c | 86 > 7 files changed, 98 > insertions(+), 1 deletion(-) create mode 100644 > libavcodec/nvdec_mjpeg.c > > diff --git a/Changelog b/Changelog > index 32e39b8344..a46edb318c 100644 > --- a/Changelog > +++ b/Changelog > @@ -13,7 +13,7 @@ version : > - PCE support for extended channel layouts in the AAC encoder > - native aptX and aptX HD encoder and decoder > - Raw aptX and aptX HD muxer and demuxer > -- NVIDIA NVDEC-accelerated H.264, HEVC, MPEG-1/2/4, VC1, VP8/9 > hwaccel decoding +- NVIDIA NVDEC-accelerated H.264, HEVC, MJPEG, > MPEG-1/2/4, VC1, VP8/9 hwaccel decoding > - Intel QSV-accelerated overlay filter > - mcompand audio filter > - acontrast audio filter > diff --git a/configure b/configure > index 4839d35747..eab9976bf7 100755 > --- a/configure > +++ b/configure > @@ -2714,6 +2714,8 @@ hevc_vdpau_hwaccel_deps="vdpau > VdpPictureInfoHEVC" hevc_vdpau_hwaccel_select="hevc_decoder" > hevc_videotoolbox_hwaccel_deps="videotoolbox" > hevc_videotoolbox_hwaccel_select="hevc_decoder" > +mjpeg_nvdec_hwaccel_deps="nvdec" > +mjpeg_nvdec_hwaccel_select="mjpeg_decoder" > mjpeg_vaapi_hwaccel_deps="vaapi" > mjpeg_vaapi_hwaccel_select="mjpeg_decoder" > mpeg_xvmc_hwaccel_deps="xvmc" > diff --git a/libavcodec/Makefile b/libavcodec/Makefile > index de52bc2094..c7a5692421 100644 > --- a/libavcodec/Makefile > +++ b/libavcodec/Makefile > @@ -854,6 +854,7 @@ OBJS-$(CONFIG_HEVC_NVDEC_HWACCEL) += > nvdec_hevc.o OBJS-$(CONFIG_HEVC_QSV_HWACCEL) += > qsvdec_h2645.o OBJS-$(CONFIG_HEVC_VAAPI_HWACCEL) += > vaapi_hevc.o OBJS-$(CONFIG_HEVC_VDPAU_HWACCEL) += vdpau_hevc.o > +OBJS-$(CONFIG_MJPEG_NVDEC_HWACCEL)+= nvdec_mjpeg.o > OBJS-$(CONFIG_MJPEG_VAAPI_HWACCEL)+= vaapi_mjpeg.o > OBJS-$(CONFIG_MPEG1_NVDEC_HWACCEL)+= nvdec_mpeg12.o > OBJS-$(CONFIG_MPEG1_VDPAU_HWACCEL)+= vdpau_mpeg12.o > diff --git a/libavcodec/hwaccels.h b/libavcodec/hwaccels.h > index 420e2feeea..7d73da8676 100644 > --- a/libavcodec/hwaccels.h > +++ b/libavcodec/hwaccels.h > @@ -37,6 +37,7 @@ extern const AVHWAccel ff_hevc_nvdec_hwaccel; > extern const AVHWAccel ff_hevc_vaapi_hwaccel; > extern const AVHWAccel ff_hevc_vdpau_hwaccel; > extern const AVHWAccel ff_hevc_videotoolbox_hwaccel; > +extern const AVHWAccel ff_mjpeg_nvdec_hwaccel; > extern const AVHWAccel ff_mjpeg_vaapi_hwaccel; > extern const AVHWAccel ff_mpeg1_nvdec_hwaccel; > extern const AVHWAccel ff_mpeg1_vdpau_hwaccel; > diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c > index 939f2849d0..beef174618 100644 > --- a/libavcodec/mjpegdec.c > +++ b/libavcodec/mjpegdec.c > @@ -650,6 +650,9 @@ unk_pixfmt: > s->avctx->pix_fmt = s->hwaccel_pix_fmt; > } else { > enum AVPixelFormat pix_fmts[] = { > +#if CONFIG_MJPEG_NVDEC_HWACCEL > +AV_PIX_FMT_CUDA, > +#endif > #if CONFIG_MJPEG_VAAPI_HWACCEL > AV_PIX_FMT_VAAPI, > #endif > @@ -2780,6 +2783,9 @@ AVCodec ff_mjpeg_decoder = { > .caps_internal = FF_CODEC_CAP_INIT_THREADSAFE | >FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM, > .hw_configs = (const AVCodecHWConfigInternal*[]) { > +#if CONFIG_MJPEG_NVDEC_HWACCEL > +HWACCEL_NVDEC(mjpeg), > +#endif > #if CONFIG_MJPEG_VAAPI_HWACCEL > HWACCEL_VAAPI(mjpeg), > #endif > diff --git a/libavcodec/nvdec.c b/libavcodec/nvdec.c > index e9e6ea0f8b..ab3cb88b27 100644 > --- a/libavcodec/nvdec.c > +++ b/libavcodec/nvdec.c > @@ -54,6 +54,7 @@ static int map_avcodec_id(enum AVCodecID id) > switch (id) { > case AV_CODEC_ID_H264: return cudaVideoCodec_H264; > case AV_CODEC_ID_HEVC: return cudaVideoCodec_HEVC; > +case AV_CODEC_ID_MJPEG: return cudaVideoCodec_JPEG; > case AV_CODEC_ID_MPEG1VIDEO: return cudaVideoCodec_MPEG1; > case AV_CODEC_ID_MPEG2VIDEO: return cudaVideoCodec_MPEG2; > case AV_CODEC_ID_MPEG4: return cudaVideoCodec_MPEG4; > diff --git a/libavcodec/nvdec_mjpeg.c b/libavcodec/nvdec_mjpeg.c > new file mode 100644 > index 00..7e404246ce > --- /dev/null > +++ b/libavcodec/nvdec_mjpeg.c > @@ -0,0 +1,86 @@ > +/* > + * MJPEG HW decode acceleration through NVDEC > + * > + * Copyright (c) 2017 Philip Langdale > + * > + * 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
Re: [FFmpeg-devel] [PATCH 3/7] hwcontext_vaapi: Add more surface formats
On Mon, 19 Feb 2018 23:28:45 + Mark Thompson wrote: > Adds YUV 4:1:1, 4:4:0 and 4:4:4 - these will be needed for JPEG > decoding. --- > libavutil/hwcontext_vaapi.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/libavutil/hwcontext_vaapi.c b/libavutil/hwcontext_vaapi.c > index 29698d1b27..68f88ecd6b 100644 > --- a/libavutil/hwcontext_vaapi.c > +++ b/libavutil/hwcontext_vaapi.c > @@ -110,6 +110,9 @@ static const struct { > MAP(422H, YUV422, YUV422P), > MAP(UYVY, YUV422, UYVY422), > MAP(YUY2, YUV422, YUYV422), > +MAP(411P, YUV411, YUV411P), > +MAP(422V, YUV422, YUV440P), > +MAP(444P, YUV444, YUV444P), > MAP(Y800, YUV400, GRAY8), > #ifdef VA_FOURCC_P010 > MAP(P010, YUV420_10BPP, P010), LGTM --phil ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 4/7] hwcontext_vaapi: Fix frames context creation with external attributes
On Mon, 19 Feb 2018 23:28:46 + Mark Thompson wrote: > --- > libavutil/hwcontext_vaapi.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/libavutil/hwcontext_vaapi.c b/libavutil/hwcontext_vaapi.c > index 68f88ecd6b..af9a136ef0 100644 > --- a/libavutil/hwcontext_vaapi.c > +++ b/libavutil/hwcontext_vaapi.c > @@ -475,9 +475,9 @@ static int vaapi_frames_init(AVHWFramesContext > *hwfc) int need_memory_type = !(hwctx->driver_quirks & > AV_VAAPI_DRIVER_QUIRK_ATTRIB_MEMTYPE); int need_pixel_format = 1; > for (i = 0; i < avfc->nb_attributes; i++) { > -if (ctx->attributes[i].type == > VASurfaceAttribMemoryType) > +if (avfc->attributes[i].type == > VASurfaceAttribMemoryType) need_memory_type = 0; > -if (ctx->attributes[i].type == > VASurfaceAttribPixelFormat) > +if (avfc->attributes[i].type == > VASurfaceAttribPixelFormat) need_pixel_format = 0; > } > ctx->nb_attributes = LGTM --phil ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH v2 2/3] libavfilter/vf_fps: Rewrite using activate callback
The old version of the filter had a problem where it would queue up all of the duplicate frames required to fill a timestamp gap in a single call to filter_frame. In problematic files - I've hit this in webcam streams with large gaps due to network issues - this will queue up a potentially huge number of frames. (I've seen it trigger the Linux OOM-killer on particularly large pts gaps.) This revised version of the filter using the activate callback will generate at most 1 frame each time it is called. --- libavfilter/vf_fps.c | 383 ++- 1 file changed, 199 insertions(+), 184 deletions(-) diff --git a/libavfilter/vf_fps.c b/libavfilter/vf_fps.c index dbafd2c35a..74500f59c9 100644 --- a/libavfilter/vf_fps.c +++ b/libavfilter/vf_fps.c @@ -2,6 +2,7 @@ * Copyright 2007 Bobby Bingham * Copyright 2012 Robert Nagy * Copyright 2012 Anton Khirnov + * Copyright 2018 Calvin Walton * * This file is part of FFmpeg. * @@ -28,17 +29,12 @@ #include #include -#include "libavutil/common.h" -#include "libavutil/fifo.h" +#include "libavutil/avassert.h" #include "libavutil/mathematics.h" #include "libavutil/opt.h" -#include "libavutil/parseutils.h" - -#define FF_INTERNAL_FIELDS 1 -#include "framequeue.h" #include "avfilter.h" +#include "filters.h" #include "internal.h" -#include "video.h" enum EOFAction { EOF_ACTION_ROUND, @@ -49,17 +45,25 @@ enum EOFAction { typedef struct FPSContext { const AVClass *class; -AVFifoBuffer *fifo; ///< store frames until we get two successive timestamps - -/* timestamps in input timebase */ -int64_t first_pts; ///< pts of the first frame that arrived on this filter - double start_time; ///< pts, in seconds, of the expected first frame AVRational framerate; ///< target framerate int rounding; ///< AVRounding method for timestamps int eof_action; ///< action performed for last frame in FIFO +/* Set during outlink configuration */ +int64_t in_pts_off;///< input frame pts offset for start_time handling +int64_t out_pts_off; ///< output frame pts offset for start_time handling + +/* Runtime state */ +int status;///< buffered input status +int64_t status_pts;///< buffered input status timestamp + +AVFrame *frames[2]; ///< buffered frames +int frames_count; ///< number of buffered frames + +int64_t next_pts; ///< pts of the next frame to output + /* statistics */ int frames_in; ///< number of frames on input int frames_out;///< number of frames on output @@ -91,31 +95,42 @@ static av_cold int init(AVFilterContext *ctx) { FPSContext *s = ctx->priv; -if (!(s->fifo = av_fifo_alloc_array(2, sizeof(AVFrame* -return AVERROR(ENOMEM); - -s->first_pts= AV_NOPTS_VALUE; +s->status_pts = AV_NOPTS_VALUE; +s->next_pts = AV_NOPTS_VALUE; av_log(ctx, AV_LOG_VERBOSE, "fps=%d/%d\n", s->framerate.num, s->framerate.den); return 0; } -static void flush_fifo(AVFifoBuffer *fifo) +/* Remove the first frame from the buffer, returning it */ +static AVFrame *shift_frame(FPSContext *s) { -while (av_fifo_size(fifo)) { -AVFrame *tmp; -av_fifo_generic_read(fifo, &tmp, sizeof(tmp), NULL); -av_frame_free(&tmp); -} +AVFrame *frame; + +/* Must only be called when there are frames in the buffer */ +av_assert1(s->frames_count > 0); + +frame = s->frames[0]; +s->frames[0] = s->frames[1]; +s->frames[1] = NULL; +s->frames_count--; + +return frame; } static av_cold void uninit(AVFilterContext *ctx) { FPSContext *s = ctx->priv; -if (s->fifo) { -s->drop += av_fifo_size(s->fifo) / sizeof(AVFrame*); -flush_fifo(s->fifo); -av_fifo_freep(&s->fifo); + +AVFrame *frame; + +/* Free any remaining buffered frames. This only happens if a downstream + * filter has asked us to stop, so don't count them as dropped. */ +av_log(ctx, AV_LOG_DEBUG, "Discarding %d buffered frame(s) at exit.\n", +s->frames_count); +while (s->frames_count > 0) { +frame = shift_frame(s); +av_frame_free(&frame); } av_log(ctx, AV_LOG_VERBOSE, "%d frames in, %d frames out; %d frames dropped, " @@ -124,198 +139,198 @@ static av_cold void uninit(AVFilterContext *ctx) static int config_props(AVFilterLink* link) { -FPSContext *s = link->src->priv; +AVFilterContext *ctx = link->src; +AVFilterLink *inlink = ctx->inputs[0]; +FPSContext *s = ctx->priv; link->time_base = av_inv_q(s->framerate); link->frame_rate= s->framerate; link->w = link->src->inputs[0]->w; link->h = link->src->inputs[0]->h; -return 0; -} - -static int request_frame(AVFilterLink *outlink) -{ -AVFilterContext *ctx = outlink->src; -FPSContext*s
[FFmpeg-devel] [PATCH v2 0/3] libavfilter/vf_fps: Rewrite using activate callback
Second revision of the patch set, incorporating feedback from Nicolas George. This also fixes the start_time option, which didn't work at all in the v1 patch set. I've added some tests based on the behaviour of the old version of the filter, and adapted the new version to pass them. The third patch just has some formatting fixes to make the config_props function easier to read. Calvin Walton (3): libavfilter/vf_fps: Add tests for start_time option libavfilter/vf_fps: Rewrite using activate callback libavfilter/vf_fps: Minor cleanups libavfilter/vf_fps.c | 391 ++- tests/fate/filter-video.mak | 4 +- tests/ref/fate/filter-fps-start-drop | 11 + tests/ref/fate/filter-fps-start-fill | 11 + 4 files changed, 227 insertions(+), 190 deletions(-) create mode 100644 tests/ref/fate/filter-fps-start-drop create mode 100644 tests/ref/fate/filter-fps-start-fill -- 2.16.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH v2 1/3] libavfilter/vf_fps: Add tests for start_time option
--- tests/fate/filter-video.mak | 4 +++- tests/ref/fate/filter-fps-start-drop | 11 +++ tests/ref/fate/filter-fps-start-fill | 11 +++ 3 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 tests/ref/fate/filter-fps-start-drop create mode 100644 tests/ref/fate/filter-fps-start-fill diff --git a/tests/fate/filter-video.mak b/tests/fate/filter-video.mak index e3e128cf67..07572143a8 100644 --- a/tests/fate/filter-video.mak +++ b/tests/fate/filter-video.mak @@ -425,7 +425,7 @@ fate-filter-concat: CMD = framecrc -filter_complex_script $(TARGET_PATH)/tests/d FATE_FILTER-$(call ALLYES, TESTSRC2_FILTER FPS_FILTER MPDECIMATE_FILTER) += fate-filter-mpdecimate fate-filter-mpdecimate: CMD = framecrc -lavfi testsrc2=r=2:d=10,fps=3,mpdecimate -r 3 -pix_fmt yuv420p -FATE_FILTER-$(call ALLYES, FPS_FILTER TESTSRC2_FILTER) += fate-filter-fps-up fate-filter-fps-up-round-down fate-filter-fps-up-round-up fate-filter-fps-down fate-filter-fps-down-round-down fate-filter-fps-down-round-up fate-filter-fps-down-eof-pass +FATE_FILTER-$(call ALLYES, FPS_FILTER TESTSRC2_FILTER) += fate-filter-fps-up fate-filter-fps-up-round-down fate-filter-fps-up-round-up fate-filter-fps-down fate-filter-fps-down-round-down fate-filter-fps-down-round-up fate-filter-fps-down-eof-pass fate-filter-fps-start-drop fate-filter-fps-start-fill fate-filter-fps-up: CMD = framecrc -lavfi testsrc2=r=3:d=2,fps=7 fate-filter-fps-up-round-down: CMD = framecrc -lavfi testsrc2=r=3:d=2,fps=7:round=down fate-filter-fps-up-round-up: CMD = framecrc -lavfi testsrc2=r=3:d=2,fps=7:round=up @@ -433,6 +433,8 @@ fate-filter-fps-down: CMD = framecrc -lavfi testsrc2=r=7:d=3.5,fps=3 fate-filter-fps-down-round-down: CMD = framecrc -lavfi testsrc2=r=7:d=3.5,fps=3:round=down fate-filter-fps-down-round-up: CMD = framecrc -lavfi testsrc2=r=7:d=3.5,fps=3:round=up fate-filter-fps-down-eof-pass: CMD = framecrc -lavfi testsrc2=r=7:d=3.5,fps=3:eof_action=pass +fate-filter-fps-start-drop: CMD = framecrc -lavfi testsrc2=r=7:d=3.5,fps=3:start_time=1.5 +fate-filter-fps-start-fill: CMD = framecrc -lavfi testsrc2=r=7:d=1.5,setpts=PTS+14,fps=3:start_time=1.5 FATE_FILTER_SAMPLES-$(call ALLYES, MOV_DEMUXER FPS_FILTER QTRLE_DECODER) += fate-filter-fps-cfr fate-filter-fps fate-filter-fps-r fate-filter-fps-cfr: CMD = framecrc -i $(TARGET_SAMPLES)/qtrle/apple-animation-variable-fps-bug.mov -r 30 -vsync cfr -pix_fmt yuv420p diff --git a/tests/ref/fate/filter-fps-start-drop b/tests/ref/fate/filter-fps-start-drop new file mode 100644 index 00..cfa1c40997 --- /dev/null +++ b/tests/ref/fate/filter-fps-start-drop @@ -0,0 +1,11 @@ +#tb 0: 1/3 +#media_type 0: video +#codec_id 0: rawvideo +#dimensions 0: 320x240 +#sar 0: 1/1 +0, 5, 5,1, 115200, 0x2d0ba5a4 +0, 6, 6,1, 115200, 0xc95a675e +0, 7, 7,1, 115200, 0xf040bf35 +0, 8, 8,1, 115200, 0x5635daa5 +0, 9, 9,1, 115200, 0x0caf7172 +0, 10, 10,1, 115200, 0xc8ce7fb1 diff --git a/tests/ref/fate/filter-fps-start-fill b/tests/ref/fate/filter-fps-start-fill new file mode 100644 index 00..c5efb42a8f --- /dev/null +++ b/tests/ref/fate/filter-fps-start-fill @@ -0,0 +1,11 @@ +#tb 0: 1/3 +#media_type 0: video +#codec_id 0: rawvideo +#dimensions 0: 320x240 +#sar 0: 1/1 +0, 5, 5,1, 115200, 0x3744b3ed +0, 6, 6,1, 115200, 0x3744b3ed +0, 7, 7,1, 115200, 0x201b9db1 +0, 8, 8,1, 115200, 0x75e1a17b +0, 9, 9,1, 115200, 0xb73857e2 +0, 10, 10,1, 115200, 0x02b6ab21 -- 2.16.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH v2 3/3] libavfilter/vf_fps: Minor cleanups
Since the config_props function now references both the input and output links, rename the 'link' variable to 'outlink'. Fix up some mismatching indentation. Don't bother setting the width and height on the outlink; the filter framework does that for us. --- libavfilter/vf_fps.c | 16 +++- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/libavfilter/vf_fps.c b/libavfilter/vf_fps.c index 74500f59c9..0ca4f8563f 100644 --- a/libavfilter/vf_fps.c +++ b/libavfilter/vf_fps.c @@ -137,16 +137,14 @@ static av_cold void uninit(AVFilterContext *ctx) "%d frames duplicated.\n", s->frames_in, s->frames_out, s->drop, s->dup); } -static int config_props(AVFilterLink* link) +static int config_props(AVFilterLink* outlink) { -AVFilterContext *ctx = link->src; -AVFilterLink *inlink = ctx->inputs[0]; -FPSContext *s = ctx->priv; +AVFilterContext *ctx= outlink->src; +AVFilterLink*inlink = ctx->inputs[0]; +FPSContext *s = ctx->priv; -link->time_base = av_inv_q(s->framerate); -link->frame_rate= s->framerate; -link->w = link->src->inputs[0]->w; -link->h = link->src->inputs[0]->h; +outlink->time_base = av_inv_q(s->framerate); +outlink->frame_rate = s->framerate; /* Calculate the input and output pts offsets for start_time */ if (s->start_time != DBL_MAX && s->start_time != AV_NOPTS_VALUE) { @@ -158,7 +156,7 @@ static int config_props(AVFilterLink* link) } s->in_pts_off = av_rescale_q_rnd(first_pts, AV_TIME_BASE_Q, inlink->time_base, s->rounding | AV_ROUND_PASS_MINMAX); -s->out_pts_off = av_rescale_q_rnd(first_pts, AV_TIME_BASE_Q, link->time_base, +s->out_pts_off = av_rescale_q_rnd(first_pts, AV_TIME_BASE_Q, outlink->time_base, s->rounding | AV_ROUND_PASS_MINMAX); s->next_pts = s->out_pts_off; av_log(ctx, AV_LOG_VERBOSE, "Set first pts to (in:%"PRId64" out:%"PRId64") from start time %f\n", -- 2.16.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 5/7] vaapi_decode: Make the frames context format selection more general
On Mon, 19 Feb 2018 23:28:47 + Mark Thompson wrote: > Examine the supported fourcc list manually and make the best choice, > then use the external attribute on the frames context to force that > fourcc. --- > libavcodec/vaapi_decode.c | 152 > +++--- > libavcodec/vaapi_decode.h | 2 + 2 files changed, 132 insertions(+), > 22 deletions(-) > > diff --git a/libavcodec/vaapi_decode.c b/libavcodec/vaapi_decode.c > index 572b3a40ac..28c6eeb801 100644 > --- a/libavcodec/vaapi_decode.c > +++ b/libavcodec/vaapi_decode.c > @@ -232,6 +232,132 @@ int ff_vaapi_decode_cancel(AVCodecContext > *avctx, return 0; > } > > +static const struct { > +uint32_t fourcc; > +enum AVPixelFormat pix_fmt; > +} vaapi_format_map[] = { > +#define MAP(va, av) { VA_FOURCC_ ## va, AV_PIX_FMT_ ## av } > +// 4:0:0 > +MAP(Y800, GRAY8), > +// 4:2:0 > +MAP(NV12, NV12), > +MAP(YV12, YUV420P), > +MAP(IYUV, YUV420P), > +#ifdef VA_FOURCC_I420 > +MAP(I420, YUV420P), > +#endif > +MAP(IMC3, YUV420P), > +// 4:1:1 > +MAP(411P, YUV411P), > +// 4:2:2 > +MAP(422H, YUV422P), > +#ifdef VA_FOURCC_YV16 > +MAP(YV16, YUV422P), > +#endif > +// 4:4:0 > +MAP(422V, YUV440P), > +// 4:4:4 > +MAP(444P, YUV444P), > +// 4:2:0 10-bit > +#ifdef VA_FOURCC_P010 > +MAP(P010, P010), > +#endif > +#ifdef VA_FOURCC_I010 > +MAP(I010, YUV420P10), > +#endif > +#undef MAP > +}; > + > +static int vaapi_decode_find_best_format(AVCodecContext *avctx, > + AVHWDeviceContext *device, > + VAConfigID config_id, > + AVHWFramesContext *frames) > +{ > +AVVAAPIDeviceContext *hwctx = device->hwctx; > +VAStatus vas; > +VASurfaceAttrib *attr; > +enum AVPixelFormat source_format, best_format, format; > +uint32_t best_fourcc, fourcc; > +int i, j, nb_attr; > + > +source_format = avctx->sw_pix_fmt; > +av_assert0(source_format != AV_PIX_FMT_NONE); > + > +vas = vaQuerySurfaceAttributes(hwctx->display, config_id, > + NULL, &nb_attr); > +if (vas != VA_STATUS_SUCCESS) { > +av_log(avctx, AV_LOG_ERROR, "Failed to query surface > attributes: " > + "%d (%s).\n", vas, vaErrorStr(vas)); > +return AVERROR(ENOSYS); > +} > + > +attr = av_malloc_array(nb_attr, sizeof(*attr)); > +if (!attr) > +return AVERROR(ENOMEM); > + > +vas = vaQuerySurfaceAttributes(hwctx->display, config_id, > + attr, &nb_attr); > +if (vas != VA_STATUS_SUCCESS) { > +av_log(avctx, AV_LOG_ERROR, "Failed to query surface > attributes: " > + "%d (%s).\n", vas, vaErrorStr(vas)); > +av_freep(&attr); > +return AVERROR(ENOSYS); > +} > + > +best_format = AV_PIX_FMT_NONE; > + > +for (i = 0; i < nb_attr; i++) { > +if (attr[i].type != VASurfaceAttribPixelFormat) > +continue; > + > +fourcc = attr[i].value.value.i; > +for (j = 0; j < FF_ARRAY_ELEMS(vaapi_format_map); j++) { > +if (fourcc == vaapi_format_map[j].fourcc) > +break; > +} > +if (j >= FF_ARRAY_ELEMS(vaapi_format_map)) { > +av_log(avctx, AV_LOG_DEBUG, "Ignoring unknown format > %#x.\n", > + fourcc); > +continue; > +} > +format = vaapi_format_map[j].pix_fmt; > +av_log(avctx, AV_LOG_DEBUG, "Considering format %#x -> > %s.\n", > + fourcc, av_get_pix_fmt_name(format)); > + > +best_format = av_find_best_pix_fmt_of_2(format, best_format, > +source_format, 0, > NULL); > +if (format == best_format) > +best_fourcc = fourcc; > +} > + > +av_freep(&attr); > + > +if (best_format == AV_PIX_FMT_NONE) { > +av_log(avctx, AV_LOG_ERROR, "No usable formats for > decoding!\n"); > +return AVERROR(EINVAL); > +} > + > +av_log(avctx, AV_LOG_DEBUG, "Picked %s (%#x) as best match for > %s.\n", > + av_get_pix_fmt_name(best_format), best_fourcc, > + av_get_pix_fmt_name(source_format)); > + > +frames->sw_format = best_format; > +if (avctx->internal->hwaccel_priv_data) { > +VAAPIDecodeContext*ctx = > avctx->internal->hwaccel_priv_data; > +AVVAAPIFramesContext *avfc = frames->hwctx; > + > +ctx->pixel_format_attribute = (VASurfaceAttrib) { > +.type = VASurfaceAttribPixelFormat, > +.value.value.i = best_fourcc, > +}; > + > +avfc->attributes= &ctx->pixel_format_attribute; > +avfc->nb_attributes = 1; > +} > + > +return 0; > +} > + > static const struct { > enum AVCodecID codec_id; > int codec_profile; > @@ -289,7 +415,6 @@ static int > vaapi_decode_make_config(AVCodecCont
Re: [FFmpeg-devel] [PATCH] avformat/matroskadec: ignore CodecPrivate if the stream is VP9
On 2/19/2018 1:09 PM, James Almer wrote: > On 2/19/2018 11:37 AM, Carl Eugen Hoyos wrote: >> 2018-02-17 3:35 GMT+01:00 James Almer : >>> Defined in a recent revision of https://www.webmproject.org/docs/container/ >>> >>> Signed-off-by: James Almer >>> --- >>> libavformat/matroskadec.c | 4 >>> 1 file changed, 4 insertions(+) >>> >>> diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c >>> index cda8df2213..edc4f5d476 100644 >>> --- a/libavformat/matroskadec.c >>> +++ b/libavformat/matroskadec.c >>> @@ -2397,6 +2397,10 @@ static int matroska_parse_tracks(AVFormatContext *s) >>> return ret; >>> } else if (codec_id == AV_CODEC_ID_PRORES && >>> track->codec_priv.size == 4) { >>> fourcc = AV_RL32(track->codec_priv.data); >>> +} else if (codec_id == AV_CODEC_ID_VP9 && track->codec_priv.size) { >>> +/* we don't need any value stored in CodecPrivate. >>> + make sure that it's not exported as extradata. */ >>> +track->codec_priv.size = 0; >> >> You could add information about what this patch fixes to >> the commit message. >> >> Carl Eugen > > It prevents loading the contents of CodecPrivate into extradata for a > codec that doesn't need nor expect any. It will among other things > prevent said matroska specific binary data from being dumped onto other > formats during remuxing. > I'll add a line explaining the above to the commit message before pushing. Added and pushed. Thanks. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 3/4] avfilter: Set output link colour range where appropriate
On Mon, Feb 19, 2018 at 10:48:24AM -0800, Philip Langdale wrote: [...] > diff --git a/libavfilter/vf_scale.c b/libavfilter/vf_scale.c > index 9f45032e85..21ae709d6b 100644 > --- a/libavfilter/vf_scale.c > +++ b/libavfilter/vf_scale.c > @@ -342,11 +342,16 @@ static int config_props(AVFilterLink *outlink) > } else > outlink->sample_aspect_ratio = inlink0->sample_aspect_ratio; > > -av_log(ctx, AV_LOG_VERBOSE, "w:%d h:%d fmt:%s sar:%d/%d -> w:%d h:%d > fmt:%s sar:%d/%d flags:0x%0x\n", > +if (scale->out_range != AVCOL_RANGE_UNSPECIFIED) > +outlink->color_range = scale->out_range; > + > +av_log(ctx, AV_LOG_VERBOSE, "w:%d h:%d fmt:%s sar:%d/%d range:%d -> w:%d > h:%d fmt:%s sar:%d/%d range:%d flags:0x%0x\n", > inlink ->w, inlink ->h, av_get_pix_fmt_name( inlink->format), > inlink->sample_aspect_ratio.num, inlink->sample_aspect_ratio.den, > + inlink->color_range, > outlink->w, outlink->h, av_get_pix_fmt_name(outlink->format), > outlink->sample_aspect_ratio.num, > outlink->sample_aspect_ratio.den, > + outlink->color_range, > scale->flags); > return 0; > > @@ -363,6 +368,7 @@ static int config_props_ref(AVFilterLink *outlink) > outlink->sample_aspect_ratio = inlink->sample_aspect_ratio; > outlink->time_base = inlink->time_base; > outlink->frame_rate = inlink->frame_rate; > +outlink->color_range = inlink->color_range; > > return 0; > } this should be ok, iam not maintainer of the rest thx [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Observe your enemies, for they first find out your faults. -- Antisthenes signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 1/4] avutil/opt: Add option type for Colour Range
On Mon, Feb 19, 2018 at 10:48:22AM -0800, Philip Langdale wrote: > In preparation for introducing Colour Range as a buffersrc parameter, > we need an option type to pass it. This probably seems like overkill > for an enum with two valid values, but even then you need to do > string parsing so you might as well get it right. There are many cases of parameters with named constants in AVOptions What is the advantage of this compared to using AV_OPT_TYPE_CONST ? [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB If you think the mosad wants you dead since a long time then you are either wrong or dead since a long time. signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] Add -vf scale example for making pixels square
On Mon, Feb 19, 2018 at 06:45:11PM +0100, Tomas Härdin wrote: > > filters.texi | 13 + > 1 file changed, 13 insertions(+) > af8d1d10b307cc4123fda3f8a0d5cd3c9e86b7d7 > 0001-Add-vf-scale-example-for-making-pixels-square.patch > From 9605df7c8402fb8d5fdbb55ae05639338a1ae0a1 Mon Sep 17 00:00:00 2001 > From: =?UTF-8?q?Tomas=20H=C3=A4rdin?= > Date: Mon, 19 Feb 2018 18:42:25 +0100 > Subject: [PATCH] Add -vf scale example for making pixels square > > This is a common use case. > --- > doc/filters.texi | 13 + > 1 file changed, 13 insertions(+) should be ok thx [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Does the universe only have a finite lifespan? No, its going to go on forever, its just that you wont like living in it. -- Hiranya Peiri signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 0/3] Finish new iteration APIs
On Mon, Feb 19, 2018 at 09:57:35PM +0100, Hendrik Leppkes wrote: > On Mon, Feb 19, 2018 at 8:30 PM, Michael Niedermayer > wrote: > > On Sun, Feb 18, 2018 at 05:58:16PM +, Josh de Kock wrote: > >> This should be the last of the major API changes. I'm not entirely > >> sure if I missed anything. > > > > Moving from a register based system where a user app can register > > any subset to a system which registers all via an array will > > increase the size of statically linked binaries for users only > > using a subset. > > > > User apps did not have the ability to register a subset. How would > they do that? They can't access the internals (ie. the ff_ references > to those components) I think you are mistaken here. What you are thinking of here, i think is, that ff_* symbols are not accessable to user apps. This is true with shared libs but the issue above is primarely an issue with static linking. There the ff_* symbols are available. But much more important, we are designing a new API here, it doesnt matter all that much what was possible, what matters is that it IS possible and its IMHO not a obscure use case to want to only "register" parts that are actually needed. Every security concious application that deals with some standarized input from the net, like a browser, would IMHO want to limit the parts that are enabled by as many and as hard ways as possible. > That was only something some internal tools used, and you can probably > find different options for dealing with those. I can imagine some ways to hack around it, for the fuzzer yes, but a clean way though proper public API (no ff_*, no #ifdefs around the array) would seem better So, yeah, i would prefer if a new API would allow registering subsets. Without this and if the fuzzer runs out of diskspace someone will probably need to hack around the new API so the arrays with all the pointers to every part arent linked in. I may be missing some solution but this sounds like a bunch of ugly code ... [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB It is what and why we do it that matters, not just one of them. signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 0/3] Finish new iteration APIs
On 2/19/2018 11:16 PM, Michael Niedermayer wrote: > On Mon, Feb 19, 2018 at 09:57:35PM +0100, Hendrik Leppkes wrote: >> On Mon, Feb 19, 2018 at 8:30 PM, Michael Niedermayer >> wrote: >>> On Sun, Feb 18, 2018 at 05:58:16PM +, Josh de Kock wrote: This should be the last of the major API changes. I'm not entirely sure if I missed anything. >>> >>> Moving from a register based system where a user app can register >>> any subset to a system which registers all via an array will >>> increase the size of statically linked binaries for users only >>> using a subset. >>> >> >> User apps did not have the ability to register a subset. How would >> they do that? They can't access the internals (ie. the ff_ references >> to those components) > > I think you are mistaken here. > > What you are thinking of here, i think is, that ff_* symbols are not > accessable to user apps. This is true with shared libs but the issue > above is primarely an issue with static linking. There the ff_* symbols > are available. > > But much more important, we are designing a new API here, it doesnt matter > all that much what was possible, what matters is that it IS possible > and its IMHO not a obscure use case to want to only "register" parts that are > actually needed. Every security concious application that deals with > some standarized input from the net, like a browser, would IMHO want to > limit the parts that are enabled by as many and as hard ways as possible. > > >> That was only something some internal tools used, and you can probably >> find different options for dealing with those. > > I can imagine some ways to hack around it, for the fuzzer yes, but a > clean way though proper public API (no ff_*, no #ifdefs around the array) > would seem better > > So, yeah, i would prefer if a new API would allow registering subsets. > > Without this and if the fuzzer runs out of diskspace someone will probably > need to hack around the new API so the arrays with all the pointers to > every part arent linked in. I may be missing some solution but this > sounds like a bunch of ugly code ... Afaik, the objective of this new API was to make the modules const and not mutable during init/registration by the requirement of setting the *next pointer. Admittedly, by keeping the init_static feature that can also set fields like pix_fmt or change reported capabilities, the benefits from this new API are more or less nullified. So i agree with you that, seeing the drawbacks this new API introduced without having actually achieved its objective, a different, better one that allows "registration", the modules to be const while setting at least some subset of capabilities based on the runtime environment (things like enabled pix_fmts, codec capabilities and such) should be written instead. Whatever is done, in any case, should be decided fast. The current new API is in the tree and should be removed without delay if we decide to not use it in the end, even if a proper replacement is not written in the short term. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 0/3] Finish new iteration APIs
On Mon, 19 Feb 2018 23:30:24 -0300 James Almer wrote: > On 2/19/2018 11:16 PM, Michael Niedermayer wrote: > > On Mon, Feb 19, 2018 at 09:57:35PM +0100, Hendrik Leppkes wrote: > >> On Mon, Feb 19, 2018 at 8:30 PM, Michael Niedermayer > >> wrote: > >>> On Sun, Feb 18, 2018 at 05:58:16PM +, Josh de Kock wrote: > This should be the last of the major API changes. I'm not entirely > sure if I missed anything. > >>> > >>> Moving from a register based system where a user app can register > >>> any subset to a system which registers all via an array will > >>> increase the size of statically linked binaries for users only > >>> using a subset. > >>> > >> > >> User apps did not have the ability to register a subset. How would > >> they do that? They can't access the internals (ie. the ff_ references > >> to those components) > > > > I think you are mistaken here. > > > > What you are thinking of here, i think is, that ff_* symbols are not > > accessable to user apps. This is true with shared libs but the issue > > above is primarely an issue with static linking. There the ff_* symbols > > are available. > > > > But much more important, we are designing a new API here, it doesnt matter > > all that much what was possible, what matters is that it IS possible > > and its IMHO not a obscure use case to want to only "register" parts that > > are > > actually needed. Every security concious application that deals with > > some standarized input from the net, like a browser, would IMHO want to > > limit the parts that are enabled by as many and as hard ways as possible. > > > > > >> That was only something some internal tools used, and you can probably > >> find different options for dealing with those. > > > > I can imagine some ways to hack around it, for the fuzzer yes, but a > > clean way though proper public API (no ff_*, no #ifdefs around the array) > > would seem better > > > > So, yeah, i would prefer if a new API would allow registering subsets. > > > > Without this and if the fuzzer runs out of diskspace someone will probably > > need to hack around the new API so the arrays with all the pointers to > > every part arent linked in. I may be missing some solution but this > > sounds like a bunch of ugly code ... > > Afaik, the objective of this new API was to make the modules const and > not mutable during init/registration by the requirement of setting the > *next pointer. > Admittedly, by keeping the init_static feature that can also set fields > like pix_fmt or change reported capabilities, the benefits from this new > API are more or less nullified. That doesn't even affect filters. The pix_fmt thing affects only less than 5 codecs. > So i agree with you that, seeing the drawbacks this new API introduced > without having actually achieved its objective, a different, better one > that allows "registration", the modules to be const while setting at > least some subset of capabilities based on the runtime environment > (things like enabled pix_fmts, codec capabilities and such) should be > written instead. It has fully achieved its objectives. There's no more visible global mutable state, and the actual global mutable state has been reduced to less than 5 codec entries. Why are we discussing this _again_? > Whatever is done, in any case, should be decided fast. The current new > API is in the tree and should be removed without delay if we decide to > not use it in the end, even if a proper replacement is not written in > the short term. What needs to be done is testing and applying these patches. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel