Re: [FFmpeg-devel] [PATCH] GSoC: Support fast guided filter.
> 2021年5月10日 下午9:42,Xuewei Meng <928826...@qq.com> 写道: > > From: Xuewei Meng > > Two modes are supported in guided filter, basic mode and fast mode. > Basic mode is the initial pushed guided filter without optimization. > Fast mode is implemented based on the basic one by sub-sampling method. > The sub-sampling ratio which can be defined by users controls the > algorithm complexity. The larger the sub-sampling ratio, the lower > the algorithm complexity. > > Signed-off-by: Xuewei Meng > --- > doc/filters.texi| 20 +++--- > libavfilter/vf_guided.c | 104 > 2 files changed, 85 insertions(+), 39 deletions(-) > > diff --git a/doc/filters.texi b/doc/filters.texi > index 03ca9ae..eb747cb 100644 > --- a/doc/filters.texi > +++ b/doc/filters.texi > @@ -12963,12 +12963,22 @@ Apply guided filter for edge-preserving smoothing, > dehazing and so on. > The filter accepts the following options: > @table @option > @item radius > -Set the radius in pixels. > +Set the box radius in pixels. > Allowed range is 1 to 20. Default is 3. > > @item eps > -Set regularization parameter. > -Allowed range is 0 to 1. Default is 0.1. > +Set regularization parameter (with square). > +Allowed range is 0 to 1. Default is 0.01. > + > +@item mode > +Set filter mode. Can be @code{basic} or @code{fast}. > +Default is @code{basic}. > + > +@item sub > +Set subsampling ratio. > +Allowed range is 1 to 64. > +Default is always 1 for @code{basic} value of @var{mode} option, > +and 4 for @code{fast} value of @var{mode} option. > > @item planes > Set planes to filter. Default is first only. > @@ -12987,8 +12997,8 @@ ffmpeg -i in.png -i in.png -filter_complex guided > out.png > > @item > Dehazing, structure-transferring filtering, detail enhancement with guided > filter. > -For the generation of guidance image, > -see @url{http://kaiminghe.com/publications/pami12guidedfilter.pdf}. > +For the generation of guidance image, refer to paper "Guided Image > Filtering". > +See: @url{http://kaiminghe.com/publications/pami12guidedfilter.pdf}. > @example > ffmpeg -i in.png -i guidance.png -filter_complex guided out.png > @end example > diff --git a/libavfilter/vf_guided.c b/libavfilter/vf_guided.c > index 86c0db5..230fb7b 100644 > --- a/libavfilter/vf_guided.c > +++ b/libavfilter/vf_guided.c > @@ -27,12 +27,20 @@ > #include "internal.h" > #include "video.h" > > +enum FilterModes { > +BASIC, > +FAST, > +NB_MODES, > +}; > + > typedef struct GuidedContext { > const AVClass *class; > FFFrameSync fs; > > int radius; > float eps; > +int mode; > +int sub; > > int planes; > > @@ -51,9 +59,13 @@ typedef struct GuidedContext { > #define FLAGS > AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_RUNTIME_PARAM > > static const AVOption guided_options[] = { > -{ "radius", "set the box radius", OFFSET(radius), > AV_OPT_TYPE_INT, {.i64=3}, 1, 20, FLAGS }, > -{ "eps","set the regularization parameter (with square)", > OFFSET(eps),AV_OPT_TYPE_FLOAT, {.dbl=0.01 }, 0.0, 1, FLAGS }, > -{ "planes", "set planes to filter", OFFSET(planes), AV_OPT_TYPE_INT, > {.i64=1}, 0, 0xF, FLAGS }, > +{ "radius", "set the box radius", > OFFSET(radius), AV_OPT_TYPE_INT, {.i64 = 3}, 1, 20, FLAGS }, > +{ "eps","set the regularization parameter (with square)", > OFFSET(eps),AV_OPT_TYPE_FLOAT, {.dbl = 0.01 }, 0.0,1, FLAGS }, > +{ "mode", "set filtering mode (0: basic mode; 1: fast mode)", > OFFSET(mode), AV_OPT_TYPE_INT, {.i64 = BASIC}, 0, NB_MODES - 1, FLAGS, > "mode" }, > +{ "basic", "basic guided filter", 0, >AV_OPT_TYPE_CONST, {.i64 = BASIC}, 0,0, FLAGS, "mode" }, > +{ "fast", "fast guided filter", 0, >AV_OPT_TYPE_CONST, {.i64 = FAST }, 0,0, FLAGS, "mode" }, > +{ "sub","subsampling ratio", > OFFSET(sub),AV_OPT_TYPE_INT, {.i64 = 1}, 1, 64, FLAGS }, > +{ "planes", "set planes to filter", > OFFSET(planes), AV_OPT_TYPE_INT, {.i64=1 }, 0, 0xF, FLAGS }, > { NULL } > }; > > @@ -147,6 +159,26 @@ static int config_input(AVFilterLink *inlink) > return AVERROR(EINVAL); > } > > +if (s->mode == BASIC) { > +if (s->sub != 1) { > +av_log(ctx, AV_LOG_WARNING, "Subsampling ratio is 1 in basic > mode.\n"); > +s->sub = 1; > +} > +} > +else if (s->mode == FAST) { > +if (s->sub == 1) { > +av_log(ctx, AV_LOG_WARNING, "Subsampling ratio is larger than 1 > in fast mode.\n"); > +s->sub = 4; > +} > +if (s->radius >= s->sub) > +s->radius = s->radius / s->sub; > +
Re: [FFmpeg-devel] [PATCH] fftools/ffmpeg: Restore DTS correction for VP9 copies
> Shouldn't google not produce invalid files? Also, can you link one of > these videos to test this issue? While I agree that Google should fix the issue, I think it would be beneficial for ffmpeg to correct these classes of errors, in-line with what ffmpeg already does for every other format other than VP9. The correction code currently emits a warning to notify the user of the invalid file. Here are the steps to reproduction: ffmpeg -y -loglevel 'repeat+info' -i 'file:LIGHTSKINJOHN - only-MakTbhIZ5zo.f302.webm' -i 'file:LIGHTSKINJOHN - only-MakTbhIZ5zo.f251.webm' -c copy -map '0:v:0' -map '1:a:0' 'file:LIGHTSKINJOHN - only-MakTbhIZ5zo.temp.webm' To get the source video files, the easiest way is to run the following ffmpeg step: youtube-dl -v -f '(bestvideo[vcodec=vp9])+(bestaudio[acodec=opus])' https://youtu.be/MakTbhIZ5zo The error is: [webm @ 0x55978716c740] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 5355 >= 5339 WIth the proposed patch, this gets corrected and a warning is emitted: [webm @ 0x563ed2eb5540] Non-monotonous DTS in output stream 0:0; previous: 5355, current: 5339; changing to 5355. This may result in incorrect timestamps in the output file. > Your mail client mangled the patch. My apologies. Hope the below works. I am successfully able to git apply this, but in case it's still corrupt, please try https://pastebin.com/raw/GWkrCu5w >From 0eb57f3746008dc04d86690d97caa1b579d3e215 Mon Sep 17 00:00:00 2001 From: Danny Wu Date: Wed, 12 May 2021 08:51:13 -0400 Subject: [PATCH] fftools/ffmpeg: Restore DTS correction for VP9 copies Fixes ticket 9086. Since early 2021, some of YouTube's VP9 encodes have non-monotonous DTS. This makes ffmpeg fatally fail when trying to copy or encode the V9 video. ffmpeg already includes functionality to correct this, however it was disabled without explanation for VP9 stream copies in 2e6636aa87303d37b112e79f093ca39500f92364 This patch restores the DTS correction logic, and allows ffmpeg to correctly encode (invalid) videos produced by youtube.com. I have verified that frames are NOT being cut (so it does not re-introduce 4313). --- fftools/ffmpeg.c | 1 - 1 file changed, 1 deletion(-) diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c index 3ad11452da..67deb7762f 100644 --- a/fftools/ffmpeg.c +++ b/fftools/ffmpeg.c @@ -823,7 +823,6 @@ static void write_packet(OutputFile *of, AVPacket *pkt, OutputStream *ost, int u } if ((st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO || st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO || st->codecpar->codec_type == AVMEDIA_TYPE_SUBTITLE) && pkt->dts != AV_NOPTS_VALUE && -!(st->codecpar->codec_id == AV_CODEC_ID_VP9 && ost->stream_copy) && ost->last_mux_dts != AV_NOPTS_VALUE) { int64_t max = ost->last_mux_dts + !(s->oformat->flags & AVFMT_TS_NONSTRICT); if (pkt->dts < max) { -- 2.17.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 3/5 v2] lavfi/dnn_backend_native_layer_dense.h: Documentation
> -Original Message- > From: ffmpeg-devel On Behalf Of > Shubhanshu Saxena > Sent: 2021年5月13日 2:45 > To: ffmpeg-devel@ffmpeg.org > Cc: Shubhanshu Saxena > Subject: [FFmpeg-devel] [PATCH 3/5 v2] > lavfi/dnn_backend_native_layer_dense.h: Documentation > > Add documentation for Dense Layer > > Signed-off-by: Shubhanshu Saxena > --- > .../dnn/dnn_backend_native_layer_dense.h | 28 > +++ > 1 file changed, 28 insertions(+) > > diff --git a/libavfilter/dnn/dnn_backend_native_layer_dense.h > b/libavfilter/dnn/dnn_backend_native_layer_dense.h > index 86248856ae..83fcb18831 100644 > --- a/libavfilter/dnn/dnn_backend_native_layer_dense.h > +++ b/libavfilter/dnn/dnn_backend_native_layer_dense.h > @@ -31,7 +31,35 @@ typedef struct DenseParams{ > float *biases; > } DenseParams; > > +/** > + * @brief Load the Densely-Connnected Layer. Connnected -> Connected > + * > + * It assigns the layer parameters to the hyperparameters > + * like activation, bias, and kernel size after parsing > + * from the model file context. dense layer does not has parameter kernel size, it is derived from layer's input number and output number. it is a time consuming work to list all the correct parameters here, so we might simplify the doc like below for all the patches. It assigns the densely-connected layer with DenseParams after parsing from the model file context. > + * > + * @param layer pointer to the DNN layer instance > + * @param model_file_context pointer to model file context > + * @param file_size model file size to check if data is read > + * correctly from the model file > + * @param operands_num operand count of the whole model to > + * check if data is read correctly from the model file > + * @return number of bytes read from the model file > + * @retval 0 if out of memory or an error occurs > + */ > int ff_dnn_load_layer_dense(Layer *layer, AVIOContext *model_file_context, > int file_size, int operands_num); > + > +/** > + * @brief Execute the Densely-Connnected Layer. typo: Connnected ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 6/9] avcodec/adpcm: Set vqa_version before use in init
On 13/5/21 10:50 am, Andreas Rheinhardt wrote: Michael Niedermayer: Fixes: null pointer dereference Fixes: 33172/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ADPCM_IMA_WS_fuzzer-5200164273913856 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavcodec/adpcm.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavcodec/adpcm.c b/libavcodec/adpcm.c index be14607eac..2deefeb651 100644 --- a/libavcodec/adpcm.c +++ b/libavcodec/adpcm.c @@ -191,6 +191,8 @@ static av_cold int adpcm_decode_init(AVCodecContext * avctx) avctx->sample_fmt = AV_SAMPLE_FMT_S16P; break; case AV_CODEC_ID_ADPCM_IMA_WS: +if (avctx->extradata && avctx->extradata_size >= 2) +c->vqa_version = AV_RL16(avctx->extradata); avctx->sample_fmt = c->vqa_version == 3 ? AV_SAMPLE_FMT_S16P : AV_SAMPLE_FMT_S16; break; I think this was unnecessary, as it has already been fixed in ff946633a30e15415974c3f0ec7751c04eb91701. Yep, this was fixed by ff946633a30e15415974c3f0ec7751c04eb91701, and added to FATE in ab38a48c485d2167e1b53eb5fb684862cf35d47c. Shall I send a revert? ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 6/9] avcodec/adpcm: Set vqa_version before use in init
Michael Niedermayer: > Fixes: null pointer dereference > Fixes: > 33172/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ADPCM_IMA_WS_fuzzer-5200164273913856 > > Found-by: continuous fuzzing process > https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg > Signed-off-by: Michael Niedermayer > --- > libavcodec/adpcm.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/libavcodec/adpcm.c b/libavcodec/adpcm.c > index be14607eac..2deefeb651 100644 > --- a/libavcodec/adpcm.c > +++ b/libavcodec/adpcm.c > @@ -191,6 +191,8 @@ static av_cold int adpcm_decode_init(AVCodecContext * > avctx) > avctx->sample_fmt = AV_SAMPLE_FMT_S16P; > break; > case AV_CODEC_ID_ADPCM_IMA_WS: > +if (avctx->extradata && avctx->extradata_size >= 2) > +c->vqa_version = AV_RL16(avctx->extradata); > avctx->sample_fmt = c->vqa_version == 3 ? AV_SAMPLE_FMT_S16P : >AV_SAMPLE_FMT_S16; > break; > I think this was unnecessary, as it has already been fixed in ff946633a30e15415974c3f0ec7751c04eb91701. - Andreas ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 5/5] tools/target_dec_fuzzer: Adjust threshold for jpeg2000
On Tue, Apr 13, 2021 at 05:45:39PM +0200, Michael Niedermayer wrote: > Fixes: Timeout (25->4sec) > Fixes: > 32780/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_JPEG2000_fuzzer-6017852583837696 > > Found-by: continuous fuzzing process > https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg > Signed-off-by: Michael Niedermayer > --- > tools/target_dec_fuzzer.c | 1 + > 1 file changed, 1 insertion(+) will apply [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB The misfortune of the wise is better than the prosperity of the fool. -- Epicurus signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 4/5] avformat/utils: Use 64bit earlier in r_frame_rate check
On Tue, Apr 13, 2021 at 05:45:38PM +0200, Michael Niedermayer wrote: > Fixes: signed integer overflow: 1406796319 * 2 cannot be represented in type > 'int' > Fixes: > 32777/clusterfuzz-testcase-minimized-ffmpeg_IO_DEMUXER_fuzzer-5632576913014784 > > Found-by: continuous fuzzing process > https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg > Signed-off-by: Michael Niedermayer > --- > libavformat/utils.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) will apply [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Never trust a computer, one day, it may think you are the virus. -- Compn signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 9/9] avcodec/clearvideo: Check for 0 tile_shift
On Mon, Apr 19, 2021 at 08:23:46PM +0200, Michael Niedermayer wrote: > Fixes: shift exponent -1 is negative > Fixes: > 33401/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_CLEARVIDEO_fuzzer-5908683596890112 > > Found-by: continuous fuzzing process > https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg > Signed-off-by: Michael Niedermayer > --- > libavcodec/clearvideo.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) will apply [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Democracy is the form of government in which you can choose your dictator signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 8/9] tools/target_dec_fuzzer: Adjust threshold for TAK
On Mon, Apr 19, 2021 at 08:23:45PM +0200, Michael Niedermayer wrote: > Fixes: Timeout > Fixes: > 33346/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TAK_fuzzer-4715352157192192 > > Found-by: continuous fuzzing process > https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg > Signed-off-by: Michael Niedermayer > --- > tools/target_dec_fuzzer.c | 1 + > 1 file changed, 1 insertion(+) will apply [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB it is not once nor twice but times without number that the same ideas make their appearance in the world. -- Aristotle signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 6/9] avcodec/adpcm: Set vqa_version before use in init
On Mon, Apr 19, 2021 at 08:23:43PM +0200, Michael Niedermayer wrote: > Fixes: null pointer dereference > Fixes: > 33172/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ADPCM_IMA_WS_fuzzer-5200164273913856 > > Found-by: continuous fuzzing process > https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg > Signed-off-by: Michael Niedermayer > --- > libavcodec/adpcm.c | 2 ++ > 1 file changed, 2 insertions(+) will apply [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB When the tyrant has disposed of foreign enemies by conquest or treaty, and there is nothing more to fear from them, then he is always stirring up some war or other, in order that the people may require a leader. -- Plato signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 5/9] avcodec/vc1: Check remaining bits in ff_vc1_parse_frame_header()
On Mon, Apr 19, 2021 at 08:23:42PM +0200, Michael Niedermayer wrote: > Fixes: Timeout > Fixes: > 33156/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WMV3_fuzzer-6259655027326976 > > Found-by: continuous fuzzing process > https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg > Signed-off-by: Michael Niedermayer > --- > libavcodec/vc1.c | 5 + > 1 file changed, 5 insertions(+) will apply [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Complexity theory is the science of finding the exact solution to an approximation. Benchmarking OTOH is finding an approximation of the exact signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 3/9] avformat/mov: Ignore duplicate CoLL
On Mon, Apr 19, 2021 at 08:23:40PM +0200, Michael Niedermayer wrote: > Fixes: memleak > Fixes: > 32146/clusterfuzz-testcase-minimized-ffmpeg_dem_MOV_fuzzer-5377612845285376 > > Found-by: continuous fuzzing process > https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg > Signed-off-by: Michael Niedermayer > --- > libavformat/mov.c | 5 + > 1 file changed, 5 insertions(+) will apply [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB If you fake or manipulate statistics in a paper in physics you will never get a job again. If you fake or manipulate statistics in a paper in medicin you will get a job for life at the pharma industry. signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 2/9] avformat/mov: Limit nb_chapter_tracks to input size
On Mon, Apr 19, 2021 at 08:23:39PM +0200, Michael Niedermayer wrote: > Fixes: Timeout (15k loop iterations instead of 400m) > Fixes: > 31368/clusterfuzz-testcase-minimized-ffmpeg_dem_MOV_fuzzer-6601583174483968 > > Found-by: continuous fuzzing process > https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg > Signed-off-by: Michael Niedermayer > --- > libavformat/mov.c | 2 ++ > 1 file changed, 2 insertions(+) will apply [...] -- 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 https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH] avutil/imgutils: don't add offsets to NULL pointers
On 5/4/2021 5:50 PM, James Almer wrote: On 5/4/2021 5:13 PM, Andreas Rheinhardt wrote: James Almer: Signed-off-by: James Almer --- libavutil/imgutils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavutil/imgutils.c b/libavutil/imgutils.c index 53faad889a..aaee0dfb7a 100644 --- a/libavutil/imgutils.c +++ b/libavutil/imgutils.c @@ -166,7 +166,7 @@ int av_image_fill_pointers(uint8_t *data[4], enum AVPixelFormat pix_fmt, int hei } data[0] = ptr; - for (i = 1; i < 4 && sizes[i]; i++) + for (i = 1; i < 4 && data[i - 1] && sizes[i]; i++) data[i] = data[i - 1] + sizes[i - 1]; return ret; I see two ways to make this a NULL + offset: First, if ptr == NULL; and second if data[i - 1] + sizes[i - 1] no longer fits into the allocated buffer and happens to yield NULL (very unlikely, but possible) in which case data[i] + sizes[i] would be NULL + offset. In the second case, the first addition is already undefined behaviour against which we cannot guard at all: We don't know the size of the buffer. The only thing we can guard against is ptr being NULL; we can even error out in this scenario, but I don't know how disruptive that would be. That'd be an undesirable breakage, yes. Aside from filling data[], the function also returns the size of the buffer that should be allocated, so that functionality should remain even when ptr == NULL. Notice that in C the result of pointer + offset can never be NULL, so a compiler could optimize the check for data[i - 1] to just a check for ptr. If you say there's no warranty that an scenario where data[i-1] + size[i-1] == NULL will break the for loop in the next iteration, and no way to guard against it at all, then we can just return right before attempting to set data[] when ptr == NULL, and at least simplify that scenario. Made that change and pushed. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v2] avfilter/src_movie: Expose open options
Add a dict-typed option to movie/amovie called options that gets forwarded to avformat_open_input. This now allows complex filtergraph setups that require options on their movie sources (for example, setting the pixel format of a webcam). Signed-off-by: Ignacio Losiggio --- doc/filters.texi| 5 + libavfilter/src_movie.c | 4 +++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/doc/filters.texi b/doc/filters.texi index 22d02c38f7..060ecfc093 100644 --- a/doc/filters.texi +++ b/doc/filters.texi @@ -27350,6 +27350,11 @@ changed, so it will generate non monotonically increasing timestamps. Specifies the time difference between frames above which the point is considered a timestamp discontinuity which is removed by adjusting the later timestamps. + +@item options +Specifies the options passed to the movie. Special care needs to be taken when +passing multiple options, because ":" is an special token it needs to be +escaped even inside "'" delimiters. @end table It allows overlaying a second video on top of the main input of diff --git a/libavfilter/src_movie.c b/libavfilter/src_movie.c index 54f6738f9a..52cc6c6ca5 100644 --- a/libavfilter/src_movie.c +++ b/libavfilter/src_movie.c @@ -61,6 +61,7 @@ typedef struct MovieContext { int64_t seek_point; ///< seekpoint in microseconds double seek_point_d; char *format_name; +AVDictionary *options; char *file_name; char *stream_specs; /**< user-provided list of streams, separated by + */ int stream_index; /**< for compatibility */ @@ -90,6 +91,7 @@ static const AVOption movie_options[]= { { "s","set streams", OFFSET(stream_specs), AV_OPT_TYPE_STRING, {.str = 0}, 0, 0, FLAGS }, { "loop", "set loop count", OFFSET(loop_count), AV_OPT_TYPE_INT,{.i64 = 1}, 0,INT_MAX, FLAGS }, { "discontinuity", "set discontinuity threshold", OFFSET(discontinuity_threshold), AV_OPT_TYPE_DURATION, {.i64 = 0}, 0, INT64_MAX, FLAGS }, +{ "options", "set format options", OFFSET(options), AV_OPT_TYPE_DICT, .flags = FLAGS }, { NULL }, }; @@ -239,7 +241,7 @@ static av_cold int movie_common_init(AVFilterContext *ctx) iformat = movie->format_name ? av_find_input_format(movie->format_name) : NULL; movie->format_ctx = NULL; -if ((ret = avformat_open_input(>format_ctx, movie->file_name, iformat, NULL)) < 0) { +if ((ret = avformat_open_input(>format_ctx, movie->file_name, iformat, >options)) < 0) { av_log(ctx, AV_LOG_ERROR, "Failed to avformat_open_input '%s'\n", movie->file_name); return ret; -- 2.31.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH] avfilter/src_movie: Expose open options
Add a dict-typed option to movie/amovie called options that gets forwarded to avformat_open_input. This now allows complex filtergraph setups that require options on their movie sources (for example, setting the pixel format of a webcam). Signed-off-by: Ignacio Losiggio --- doc/filters.texi| 5 + libavfilter/src_movie.c | 4 +++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/doc/filters.texi b/doc/filters.texi index b405cc5dfb..51bc824795 100644 --- a/doc/filters.texi +++ b/doc/filters.texi @@ -27312,6 +27312,11 @@ changed, so it will generate non monotonically increasing timestamps. Specifies the time difference between frames above which the point is considered a timestamp discontinuity which is removed by adjusting the later timestamps. + +@item options +Specifies the options passed to the movie. Special care needs to be taken when +passing multiple options, because ":" is an special token it needs to be +escaped even inside "'" delimiters. @end table It allows overlaying a second video on top of the main input of diff --git a/libavfilter/src_movie.c b/libavfilter/src_movie.c index 54f6738f9a..52cc6c6ca5 100644 --- a/libavfilter/src_movie.c +++ b/libavfilter/src_movie.c @@ -61,6 +61,7 @@ typedef struct MovieContext { int64_t seek_point; ///< seekpoint in microseconds double seek_point_d; char *format_name; +AVDictionary *options; char *file_name; char *stream_specs; /**< user-provided list of streams, separated by + */ int stream_index; /**< for compatibility */ @@ -90,6 +91,7 @@ static const AVOption movie_options[]= { { "s","set streams", OFFSET(stream_specs), AV_OPT_TYPE_STRING, {.str = 0}, 0, 0, FLAGS }, { "loop", "set loop count", OFFSET(loop_count), AV_OPT_TYPE_INT,{.i64 = 1}, 0,INT_MAX, FLAGS }, { "discontinuity", "set discontinuity threshold", OFFSET(discontinuity_threshold), AV_OPT_TYPE_DURATION, {.i64 = 0}, 0, INT64_MAX, FLAGS }, +{ "options", "set format options", OFFSET(options), AV_OPT_TYPE_DICT, .flags = FLAGS }, { NULL }, }; @@ -239,7 +241,7 @@ static av_cold int movie_common_init(AVFilterContext *ctx) iformat = movie->format_name ? av_find_input_format(movie->format_name) : NULL; movie->format_ctx = NULL; -if ((ret = avformat_open_input(>format_ctx, movie->file_name, iformat, NULL)) < 0) { +if ((ret = avformat_open_input(>format_ctx, movie->file_name, iformat, >options)) < 0) { av_log(ctx, AV_LOG_ERROR, "Failed to avformat_open_input '%s'\n", movie->file_name); return ret; -- 2.31.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH] avformat/flvdec: enhance parsing timestamps
On Wed, 12 May 2021, James Almer wrote: On 5/12/2021 3:55 PM, Marton Balint wrote: Take into account timezone. Use millisecond precision. Maybe we could also use nanosecond, but there were some float rounding concerns. Alexander Strasser wrote an alternative approach to using timezone in https://lists.ffmpeg.org/pipermail/ffmpeg-devel/2021-May/280179.html yesterday. Yeah, I saw it, I just think it is better to not duplicate the timestamp generator code but use the already available function for this purpose. Regards, Marton Signed-off-by: Marton Balint --- libavformat/flvdec.c | 13 ++--- tests/ref/fate/flv-demux | 2 +- 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/libavformat/flvdec.c b/libavformat/flvdec.c index ddaceaafe4..3791687072 100644 --- a/libavformat/flvdec.c +++ b/libavformat/flvdec.c @@ -28,6 +28,7 @@ #include "libavutil/channel_layout.h" #include "libavutil/dict.h" #include "libavutil/opt.h" +#include "libavutil/internal.h" #include "libavutil/intfloat.h" #include "libavutil/mathematics.h" #include "libavutil/time_internal.h" @@ -682,17 +683,7 @@ static int amf_parse_object(AVFormatContext *s, AVStream *astream, } else if (amf_type == AMF_DATA_TYPE_STRING) { av_dict_set(>metadata, key, str_val, 0); } else if (amf_type == AMF_DATA_TYPE_DATE) { -time_t time; -struct tm t; -char datestr[128]; -time = date.milliseconds / 1000; // to seconds -gmtime_r(, ); - -// timezone is ignored, since there is no easy way to offset the UTC -// timestamp into the specified timezone -strftime(datestr, sizeof(datestr), "%Y-%m-%dT%H:%M:%SZ", ); - -av_dict_set(>metadata, key, datestr, 0); +avpriv_dict_set_timestamp(>metadata, key, -date.timezone * 6000LL + 1000 * (int64_t)date.milliseconds); } } diff --git a/tests/ref/fate/flv-demux b/tests/ref/fate/flv-demux index 827b56ea09..3eede6eb00 100644 --- a/tests/ref/fate/flv-demux +++ b/tests/ref/fate/flv-demux @@ -605,4 +605,4 @@ packet|codec_type=audio|stream_index=1|pts=11656|pts_time=11.656000|dts=11656|dt packet|codec_type=video|stream_index=0|pts=11678|pts_time=11.678000|dts=11678|dts_time=11.678000|duration=33|duration_time=0.033000|size=1190|pos=510794|flags=__|data_hash=CRC32:a0206c90 stream|index=0|codec_name=h264|profile=77|codec_type=video|codec_tag_string=[0][0][0][0]|codec_tag=0x|width=426|height=240|coded_width=426|coded_height=240|closed_captions=0|has_b_frames=1|sample_aspect_ratio=1:1|display_aspect_ratio=71:40|pix_fmt=yuv420p|level=21|color_range=unknown|color_space=unknown|color_transfer=unknown|color_primaries=unknown|chroma_location=left|field_order=progressive|refs=1|is_avc=true|nal_length_size=4|id=N/A|r_frame_rate=3/1001|avg_frame_rate=30/1|time_base=1/1000|start_pts=0|start_time=0.00|duration_ts=N/A|duration=N/A|bit_rate=393929|max_bit_rate=N/A|bits_per_raw_sample=8|nb_frames=N/A|nb_read_frames=N/A|nb_read_packets=351|extradata_hash=CRC32:07b85ca9|disposition:default=0|disposition:dub=0|disposition:original=0|disposition:comment=0|disposition:lyrics=0|disposition:karaoke=0|disposition:forced=0|disposition:hearing_impaired=0|disposition:visual_impaired=0|disposition:clean_effects=0|disposition:attached_pic=0|disposition:tim ed_thumbn ail s=0|disposition:captions=0|disposition:descriptions=0|disposition:metadata=0|disposition:dependent=0|disposition:still_image=0 stream|index=1|codec_name=aac|profile=1|codec_type=audio|codec_tag_string=[0][0][0][0]|codec_tag=0x|sample_fmt=fltp|sample_rate=22050|channels=2|channel_layout=stereo|bits_per_sample=0|id=N/A|r_frame_rate=0/0|avg_frame_rate=0/0|time_base=1/1000|start_pts=0|start_time=0.00|duration_ts=N/A|duration=N/A|bit_rate=67874|max_bit_rate=N/A|bits_per_raw_sample=N/A|nb_frames=N/A|nb_read_frames=N/A|nb_read_packets=252|extradata_hash=CRC32:d039c029|disposition:default=0|disposition:dub=0|disposition:original=0|disposition:comment=0|disposition:lyrics=0|disposition:karaoke=0|disposition:forced=0|disposition:hearing_impaired=0|disposition:visual_impaired=0|disposition:clean_effects=0|disposition:attached_pic=0|disposition:timed_thumbnails=0|disposition:captions=0|disposition:descriptions=0|disposition:metadata=0|disposition:dependent=0|disposition:still_image=0 -format|filename=Enigma_Principles_of_Lust-part.flv|nb_streams=2|nb_programs=0|format_name=flv|start_time=0.00|duration=210.20|size=512000|bit_rate=19485|probe_score=100|tag:hasKeyframes=true|tag:hasMetadata=true|tag:datasize=11970544|tag:hasVideo=true|tag:canSeekToEnd=false|tag:lasttimestamp=210|tag:lastkeyframetimestamp=210|tag:audiosize=1791332|tag:hasAudio=true|tag:audiodelay=0|tag:videosize=10176110|tag:metadatadate=2011-02-27T11:00:33Z|tag:metadatacreator=inlet media FLVTool2 v1.0.6 - http://www.inlet-media.de/flvtool2|tag:hasCuePoints=false
[FFmpeg-devel] [PATCH 3/5 v2] lavfi/dnn_backend_native_layer_dense.h: Documentation
Add documentation for Dense Layer Signed-off-by: Shubhanshu Saxena --- .../dnn/dnn_backend_native_layer_dense.h | 28 +++ 1 file changed, 28 insertions(+) diff --git a/libavfilter/dnn/dnn_backend_native_layer_dense.h b/libavfilter/dnn/dnn_backend_native_layer_dense.h index 86248856ae..83fcb18831 100644 --- a/libavfilter/dnn/dnn_backend_native_layer_dense.h +++ b/libavfilter/dnn/dnn_backend_native_layer_dense.h @@ -31,7 +31,35 @@ typedef struct DenseParams{ float *biases; } DenseParams; +/** + * @brief Load the Densely-Connnected Layer. + * + * It assigns the layer parameters to the hyperparameters + * like activation, bias, and kernel size after parsing + * from the model file context. + * + * @param layer pointer to the DNN layer instance + * @param model_file_context pointer to model file context + * @param file_size model file size to check if data is read + * correctly from the model file + * @param operands_num operand count of the whole model to + * check if data is read correctly from the model file + * @return number of bytes read from the model file + * @retval 0 if out of memory or an error occurs + */ int ff_dnn_load_layer_dense(Layer *layer, AVIOContext *model_file_context, int file_size, int operands_num); + +/** + * @brief Execute the Densely-Connnected Layer. + * + * @param operands all operands for the model + * @param input_operand_indexes input operand indexes for this layer + * @param output_operand_index output operand index for this layer + * @param parameters average pooling parameters + * @param ctx pointer to Native model context for logging + * @retval 0 if the execution succeeds + * @retval DNN_ERROR if the execution fails + */ int ff_dnn_execute_layer_dense(DnnOperand *operands, const int32_t *input_operand_indexes, int32_t output_operand_index, const void *parameters, NativeContext *ctx); #endif -- 2.27.0 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 2/5 v2] lavfi/dnn_backend_native_layer_conv2d.h: Documentation
Add documentation for 2D Convolution Layer Signed-off-by: Shubhanshu Saxena --- .../dnn/dnn_backend_native_layer_conv2d.h | 28 +++ 1 file changed, 28 insertions(+) diff --git a/libavfilter/dnn/dnn_backend_native_layer_conv2d.h b/libavfilter/dnn/dnn_backend_native_layer_conv2d.h index 03ca795c61..1c2d68b595 100644 --- a/libavfilter/dnn/dnn_backend_native_layer_conv2d.h +++ b/libavfilter/dnn/dnn_backend_native_layer_conv2d.h @@ -34,7 +34,35 @@ typedef struct ConvolutionalParams{ float *biases; } ConvolutionalParams; +/** + * @brief Load the 2D Convolution Layer. + * + * It assigns the layer parameters to the hyperparameters + * like dilation, padding method, activation, bias, and + * kernel size after parsing from the model file context. + * + * @param layer pointer to the DNN layer instance + * @param model_file_context pointer to model file context + * @param file_size model file size to check if data is read + * correctly from the model file + * @param operands_num operand count of the whole model to + * check if data is read correctly from the model file + * @return number of bytes read from the model file + * @retval 0 if an error occurs or out of memory + */ int ff_dnn_load_layer_conv2d(Layer *layer, AVIOContext *model_file_context, int file_size, int operands_num); + +/** + * @brief Execute the 2D Convolution Layer. + * + * @param operands all operands for the model + * @param input_operand_indexes input operand indexes for this layer + * @param output_operand_index output operand index for this layer + * @param parameters average pooling parameters + * @param ctx pointer to Native model context for logging + * @retval 0 if the execution succeeds + * @retval DNN_ERROR if the execution fails + */ int ff_dnn_execute_layer_conv2d(DnnOperand *operands, const int32_t *input_operand_indexes, int32_t output_operand_index, const void *parameters, NativeContext *ctx); #endif -- 2.27.0 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH] avformat/flvdec: enhance parsing timestamps
On 5/12/2021 3:55 PM, Marton Balint wrote: Take into account timezone. Use millisecond precision. Maybe we could also use nanosecond, but there were some float rounding concerns. Alexander Strasser wrote an alternative approach to using timezone in https://lists.ffmpeg.org/pipermail/ffmpeg-devel/2021-May/280179.html yesterday. And regarding the rounding concerns, we could maybe check for the bitexact flag in avctx->flags and use it to either print milli/nanoseconds or leave it as seconds. Signed-off-by: Marton Balint --- libavformat/flvdec.c | 13 ++--- tests/ref/fate/flv-demux | 2 +- 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/libavformat/flvdec.c b/libavformat/flvdec.c index ddaceaafe4..3791687072 100644 --- a/libavformat/flvdec.c +++ b/libavformat/flvdec.c @@ -28,6 +28,7 @@ #include "libavutil/channel_layout.h" #include "libavutil/dict.h" #include "libavutil/opt.h" +#include "libavutil/internal.h" #include "libavutil/intfloat.h" #include "libavutil/mathematics.h" #include "libavutil/time_internal.h" @@ -682,17 +683,7 @@ static int amf_parse_object(AVFormatContext *s, AVStream *astream, } else if (amf_type == AMF_DATA_TYPE_STRING) { av_dict_set(>metadata, key, str_val, 0); } else if (amf_type == AMF_DATA_TYPE_DATE) { -time_t time; -struct tm t; -char datestr[128]; -time = date.milliseconds / 1000; // to seconds -gmtime_r(, ); - -// timezone is ignored, since there is no easy way to offset the UTC -// timestamp into the specified timezone -strftime(datestr, sizeof(datestr), "%Y-%m-%dT%H:%M:%SZ", ); - -av_dict_set(>metadata, key, datestr, 0); +avpriv_dict_set_timestamp(>metadata, key, -date.timezone * 6000LL + 1000 * (int64_t)date.milliseconds); } } diff --git a/tests/ref/fate/flv-demux b/tests/ref/fate/flv-demux index 827b56ea09..3eede6eb00 100644 --- a/tests/ref/fate/flv-demux +++ b/tests/ref/fate/flv-demux @@ -605,4 +605,4 @@ packet|codec_type=audio|stream_index=1|pts=11656|pts_time=11.656000|dts=11656|dt packet|codec_type=video|stream_index=0|pts=11678|pts_time=11.678000|dts=11678|dts_time=11.678000|duration=33|duration_time=0.033000|size=1190|pos=510794|flags=__|data_hash=CRC32:a0206c90 stream|index=0|codec_name=h264|profile=77|codec_type=video|codec_tag_string=[0][0][0][0]|codec_tag=0x|width=426|height=240|coded_width=426|coded_height=240|closed_captions=0|has_b_frames=1|sample_aspect_ratio=1:1|display_aspect_ratio=71:40|pix_fmt=yuv420p|level=21|color_range=unknown|color_space=unknown|color_transfer=unknown|color_primaries=unknown|chroma_location=left|field_order=progressive|refs=1|is_avc=true|nal_length_size=4|id=N/A|r_frame_rate=3/1001|avg_frame_rate=30/1|time_base=1/1000|start_pts=0|start_time=0.00|duration_ts=N/A|duration=N/A|bit_rate=393929|max_bit_rate=N/A|bits_per_raw_sample=8|nb_frames=N/A|nb_read_frames=N/A|nb_read_packets=351|extradata_hash=CRC32:07b85ca9|disposition:default=0|disposition:dub=0|disposition:original=0|disposition:comment=0|disposition:lyrics=0|disposition:karaoke=0|disposition:forced=0|disposition:hearing_impaired=0|disposition:visual_impaired=0|disposition:clean_effects=0|disposition:attached_pic=0|disposition:timed_thumbn ail s=0|disposition:captions=0|disposition:descriptions=0|disposition:metadata=0|disposition:dependent=0|disposition:still_image=0 stream|index=1|codec_name=aac|profile=1|codec_type=audio|codec_tag_string=[0][0][0][0]|codec_tag=0x|sample_fmt=fltp|sample_rate=22050|channels=2|channel_layout=stereo|bits_per_sample=0|id=N/A|r_frame_rate=0/0|avg_frame_rate=0/0|time_base=1/1000|start_pts=0|start_time=0.00|duration_ts=N/A|duration=N/A|bit_rate=67874|max_bit_rate=N/A|bits_per_raw_sample=N/A|nb_frames=N/A|nb_read_frames=N/A|nb_read_packets=252|extradata_hash=CRC32:d039c029|disposition:default=0|disposition:dub=0|disposition:original=0|disposition:comment=0|disposition:lyrics=0|disposition:karaoke=0|disposition:forced=0|disposition:hearing_impaired=0|disposition:visual_impaired=0|disposition:clean_effects=0|disposition:attached_pic=0|disposition:timed_thumbnails=0|disposition:captions=0|disposition:descriptions=0|disposition:metadata=0|disposition:dependent=0|disposition:still_image=0 -format|filename=Enigma_Principles_of_Lust-part.flv|nb_streams=2|nb_programs=0|format_name=flv|start_time=0.00|duration=210.20|size=512000|bit_rate=19485|probe_score=100|tag:hasKeyframes=true|tag:hasMetadata=true|tag:datasize=11970544|tag:hasVideo=true|tag:canSeekToEnd=false|tag:lasttimestamp=210|tag:lastkeyframetimestamp=210|tag:audiosize=1791332|tag:hasAudio=true|tag:audiodelay=0|tag:videosize=10176110|tag:metadatadate=2011-02-27T11:00:33Z|tag:metadatacreator=inlet media FLVTool2 v1.0.6 - http://www.inlet-media.de/flvtool2|tag:hasCuePoints=false
Re: [FFmpeg-devel] [PATCH] avformat/flvdec: enhance parsing timestamps
On 5/12/2021 4:04 PM, James Almer wrote: On 5/12/2021 3:55 PM, Marton Balint wrote: Take into account timezone. Use millisecond precision. Maybe we could also use nanosecond, but there were some float rounding concerns. Alexander Strasser wrote an alternative approach to using timezone in https://lists.ffmpeg.org/pipermail/ffmpeg-devel/2021-May/280179.html yesterday. And regarding the rounding concerns, we could maybe check for the bitexact flag in avctx->flags and use it to either print milli/nanoseconds or leave it as seconds. Nevermind this part, this is lavf not lavc, and AVFormatContext bitexact flag is not meant for demuxers, only muxers. Signed-off-by: Marton Balint --- libavformat/flvdec.c | 13 ++--- tests/ref/fate/flv-demux | 2 +- 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/libavformat/flvdec.c b/libavformat/flvdec.c index ddaceaafe4..3791687072 100644 --- a/libavformat/flvdec.c +++ b/libavformat/flvdec.c @@ -28,6 +28,7 @@ #include "libavutil/channel_layout.h" #include "libavutil/dict.h" #include "libavutil/opt.h" +#include "libavutil/internal.h" #include "libavutil/intfloat.h" #include "libavutil/mathematics.h" #include "libavutil/time_internal.h" @@ -682,17 +683,7 @@ static int amf_parse_object(AVFormatContext *s, AVStream *astream, } else if (amf_type == AMF_DATA_TYPE_STRING) { av_dict_set(>metadata, key, str_val, 0); } else if (amf_type == AMF_DATA_TYPE_DATE) { - time_t time; - struct tm t; - char datestr[128]; - time = date.milliseconds / 1000; // to seconds - gmtime_r(, ); - - // timezone is ignored, since there is no easy way to offset the UTC - // timestamp into the specified timezone - strftime(datestr, sizeof(datestr), "%Y-%m-%dT%H:%M:%SZ", ); - - av_dict_set(>metadata, key, datestr, 0); + avpriv_dict_set_timestamp(>metadata, key, -date.timezone * 6000LL + 1000 * (int64_t)date.milliseconds); } } diff --git a/tests/ref/fate/flv-demux b/tests/ref/fate/flv-demux index 827b56ea09..3eede6eb00 100644 --- a/tests/ref/fate/flv-demux +++ b/tests/ref/fate/flv-demux @@ -605,4 +605,4 @@ packet|codec_type=audio|stream_index=1|pts=11656|pts_time=11.656000|dts=11656|dt packet|codec_type=video|stream_index=0|pts=11678|pts_time=11.678000|dts=11678|dts_time=11.678000|duration=33|duration_time=0.033000|size=1190|pos=510794|flags=__|data_hash=CRC32:a0206c90 stream|index=0|codec_name=h264|profile=77|codec_type=video|codec_tag_string=[0][0][0][0]|codec_tag=0x|width=426|height=240|coded_width=426|coded_height=240|closed_captions=0|has_b_frames=1|sample_aspect_ratio=1:1|display_aspect_ratio=71:40|pix_fmt=yuv420p|level=21|color_range=unknown|color_space=unknown|color_transfer=unknown|color_primaries=unknown|chroma_location=left|field_order=progressive|refs=1|is_avc=true|nal_length_size=4|id=N/A|r_frame_rate=3/1001|avg_frame_rate=30/1|time_base=1/1000|start_pts=0|start_time=0.00|duration_ts=N/A|duration=N/A|bit_rate=393929|max_bit_rate=N/A|bits_per_raw_sample=8|nb_frames=N/A|nb_read_frames=N/A|nb_read_packets=351|extradata_hash=CRC32:07b85ca9|disposition:default=0|disposition:dub=0|disposition:original=0|disposition:comment=0|disposition:lyrics=0|disposition:karaoke=0|disposition:forced=0|disposition:hearing_impaired=0|disposition:visual_impaired=0|disposition:clean_effects=0|disposition:attached_pic=0|disposition:timed_thumbnail s=0|disposition:captions=0|disposition:descriptions=0|disposition:metadata=0|disposition:dependent=0|disposition:still_image=0 stream|index=1|codec_name=aac|profile=1|codec_type=audio|codec_tag_string=[0][0][0][0]|codec_tag=0x|sample_fmt=fltp|sample_rate=22050|channels=2|channel_layout=stereo|bits_per_sample=0|id=N/A|r_frame_rate=0/0|avg_frame_rate=0/0|time_base=1/1000|start_pts=0|start_time=0.00|duration_ts=N/A|duration=N/A|bit_rate=67874|max_bit_rate=N/A|bits_per_raw_sample=N/A|nb_frames=N/A|nb_read_frames=N/A|nb_read_packets=252|extradata_hash=CRC32:d039c029|disposition:default=0|disposition:dub=0|disposition:original=0|disposition:comment=0|disposition:lyrics=0|disposition:karaoke=0|disposition:forced=0|disposition:hearing_impaired=0|disposition:visual_impaired=0|disposition:clean_effects=0|disposition:attached_pic=0|disposition:timed_thumbnails=0|disposition:captions=0|disposition:descriptions=0|disposition:metadata=0|disposition:dependent=0|disposition:still_image=0
[FFmpeg-devel] [PATCH] avformat/flvdec: enhance parsing timestamps
Take into account timezone. Use millisecond precision. Maybe we could also use nanosecond, but there were some float rounding concerns. Signed-off-by: Marton Balint --- libavformat/flvdec.c | 13 ++--- tests/ref/fate/flv-demux | 2 +- 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/libavformat/flvdec.c b/libavformat/flvdec.c index ddaceaafe4..3791687072 100644 --- a/libavformat/flvdec.c +++ b/libavformat/flvdec.c @@ -28,6 +28,7 @@ #include "libavutil/channel_layout.h" #include "libavutil/dict.h" #include "libavutil/opt.h" +#include "libavutil/internal.h" #include "libavutil/intfloat.h" #include "libavutil/mathematics.h" #include "libavutil/time_internal.h" @@ -682,17 +683,7 @@ static int amf_parse_object(AVFormatContext *s, AVStream *astream, } else if (amf_type == AMF_DATA_TYPE_STRING) { av_dict_set(>metadata, key, str_val, 0); } else if (amf_type == AMF_DATA_TYPE_DATE) { -time_t time; -struct tm t; -char datestr[128]; -time = date.milliseconds / 1000; // to seconds -gmtime_r(, ); - -// timezone is ignored, since there is no easy way to offset the UTC -// timestamp into the specified timezone -strftime(datestr, sizeof(datestr), "%Y-%m-%dT%H:%M:%SZ", ); - -av_dict_set(>metadata, key, datestr, 0); +avpriv_dict_set_timestamp(>metadata, key, -date.timezone * 6000LL + 1000 * (int64_t)date.milliseconds); } } diff --git a/tests/ref/fate/flv-demux b/tests/ref/fate/flv-demux index 827b56ea09..3eede6eb00 100644 --- a/tests/ref/fate/flv-demux +++ b/tests/ref/fate/flv-demux @@ -605,4 +605,4 @@ packet|codec_type=audio|stream_index=1|pts=11656|pts_time=11.656000|dts=11656|dt packet|codec_type=video|stream_index=0|pts=11678|pts_time=11.678000|dts=11678|dts_time=11.678000|duration=33|duration_time=0.033000|size=1190|pos=510794|flags=__|data_hash=CRC32:a0206c90 stream|index=0|codec_name=h264|profile=77|codec_type=video|codec_tag_string=[0][0][0][0]|codec_tag=0x|width=426|height=240|coded_width=426|coded_height=240|closed_captions=0|has_b_frames=1|sample_aspect_ratio=1:1|display_aspect_ratio=71:40|pix_fmt=yuv420p|level=21|color_range=unknown|color_space=unknown|color_transfer=unknown|color_primaries=unknown|chroma_location=left|field_order=progressive|refs=1|is_avc=true|nal_length_size=4|id=N/A|r_frame_rate=3/1001|avg_frame_rate=30/1|time_base=1/1000|start_pts=0|start_time=0.00|duration_ts=N/A|duration=N/A|bit_rate=393929|max_bit_rate=N/A|bits_per_raw_sample=8|nb_frames=N/A|nb_read_frames=N/A|nb_read_packets=351|extradata_hash=CRC32:07b85ca9|disposition:default=0|disposition:dub=0|disposition:original=0|disposition:comment=0|disposition:lyrics=0|disposition:karaoke=0|disposition:forced=0|disposition:hearing_impaired=0|disposition:visual_impaired=0|disposition:clean_effects=0|disposition:attached_pic=0|disposition:timed_thumbnail s=0|disposition:captions=0|disposition:descriptions=0|disposition:metadata=0|disposition:dependent=0|disposition:still_image=0 stream|index=1|codec_name=aac|profile=1|codec_type=audio|codec_tag_string=[0][0][0][0]|codec_tag=0x|sample_fmt=fltp|sample_rate=22050|channels=2|channel_layout=stereo|bits_per_sample=0|id=N/A|r_frame_rate=0/0|avg_frame_rate=0/0|time_base=1/1000|start_pts=0|start_time=0.00|duration_ts=N/A|duration=N/A|bit_rate=67874|max_bit_rate=N/A|bits_per_raw_sample=N/A|nb_frames=N/A|nb_read_frames=N/A|nb_read_packets=252|extradata_hash=CRC32:d039c029|disposition:default=0|disposition:dub=0|disposition:original=0|disposition:comment=0|disposition:lyrics=0|disposition:karaoke=0|disposition:forced=0|disposition:hearing_impaired=0|disposition:visual_impaired=0|disposition:clean_effects=0|disposition:attached_pic=0|disposition:timed_thumbnails=0|disposition:captions=0|disposition:descriptions=0|disposition:metadata=0|disposition:dependent=0|disposition:still_image=0 -format|filename=Enigma_Principles_of_Lust-part.flv|nb_streams=2|nb_programs=0|format_name=flv|start_time=0.00|duration=210.20|size=512000|bit_rate=19485|probe_score=100|tag:hasKeyframes=true|tag:hasMetadata=true|tag:datasize=11970544|tag:hasVideo=true|tag:canSeekToEnd=false|tag:lasttimestamp=210|tag:lastkeyframetimestamp=210|tag:audiosize=1791332|tag:hasAudio=true|tag:audiodelay=0|tag:videosize=10176110|tag:metadatadate=2011-02-27T11:00:33Z|tag:metadatacreator=inlet media FLVTool2 v1.0.6 - http://www.inlet-media.de/flvtool2|tag:hasCuePoints=false
[FFmpeg-devel] [PATCH 4/5 v2] lavfi/dnn_backend_native_layer_depth2space.h: Documentation
Add documentation for Depth to Space Layer Signed-off-by: Shubhanshu Saxena --- .../dnn_backend_native_layer_depth2space.h| 30 +++ 1 file changed, 30 insertions(+) diff --git a/libavfilter/dnn/dnn_backend_native_layer_depth2space.h b/libavfilter/dnn/dnn_backend_native_layer_depth2space.h index ef59394443..664b386197 100644 --- a/libavfilter/dnn/dnn_backend_native_layer_depth2space.h +++ b/libavfilter/dnn/dnn_backend_native_layer_depth2space.h @@ -34,7 +34,37 @@ typedef struct DepthToSpaceParams{ int block_size; } DepthToSpaceParams; +/** + * @brief Load the Depth to Space Layer. + * + * It assigns the layer parameters to the block size + * hyperparameter from the model file context. + * + * @param layer pointer to the DNN layer instance + * @param model_file_context pointer to model file context + * @param file_size model file size to check if data is read + * correctly from the model file + * @param operands_num operand count of the whole model to + * check if data is read correctly from the model file + * @return number of bytes read from the model file + * @retval 0 if an error occurs or out of memory + */ int ff_dnn_load_layer_depth2space(Layer *layer, AVIOContext *model_file_context, int file_size, int operands_num); + +/** + * @brief Execute the Depth to Space Layer. + * + * It rearranges the input data from depth into spatial + * form by applying Depth to Space transformation. + * + * @param operands all operands for the model + * @param input_operand_indexes input operand indexes for this layer + * @param output_operand_index output operand index for this layer + * @param parameters average pooling parameters + * @param ctx pointer to Native model context for logging + * @retval 0 if the execution succeeds + * @retval DNN_ERROR if the execution fails + */ int ff_dnn_execute_layer_depth2space(DnnOperand *operands, const int32_t *input_operand_indexes, int32_t output_operand_index, const void *parameters, NativeContext *ctx); -- 2.27.0 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 1/5] lavfi/dnn_backend_native_layer_avgpool.h: Documentation
On Wed, May 12, 2021 at 8:31 PM Guo, Yejun wrote: > > > > -Original Message- > > From: ffmpeg-devel On Behalf Of > > Shubhanshu Saxena > > Sent: Wednesday, May 12, 2021 5:02 PM > > To: FFmpeg development discussions and patches > de...@ffmpeg.org> > > Subject: Re: [FFmpeg-devel] [PATCH 1/5] > > lavfi/dnn_backend_native_layer_avgpool.h: Documentation > > > > On Wed, May 12, 2021 at 7:52 AM Guo, Yejun wrote: > > > > > > > > > > > > -Original Message- > > > > From: ffmpeg-devel On Behalf Of > > > > Shubhanshu Saxena > > > > Sent: 2021年5月8日 20:10 > > > > To: ffmpeg-devel@ffmpeg.org > > > > Cc: Shubhanshu Saxena > > > > Subject: [FFmpeg-devel] [PATCH 1/5] > > > > > > > Okay, I'll remove the spaces and correct these lines. Thank you. > > > > Also, since the parameters for loading and execution functions are the > same > > in other layers, I need to correct them as well. Right? > > Yes, right. > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > To unsubscribe, visit link above, or email > ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe". I have sent the newer versions of the patches. Thanks ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 08/12] fate/demux: convert flv-demux to ffprobe
TYVM Anton! I will test it and close the Trac ticket if success on my end. > -Original Message- > From: ffmpeg-devel On Behalf Of Anton > Khirnov > Sent: Wednesday, May 12, 2021 11:22 AM > To: FFmpeg development discussions and patches > Subject: Re: [FFmpeg-devel] [PATCH 08/12] fate/demux: convert flv-demux to > ffprobe > > Hey, > Quoting Eoff, Ullysses A (2021-05-12 19:16:09) > > *bump* > > > > Is anyone actively fixing this? Anton? Please. > > Sorry about the delay, the patch was on the ML since Monday, but people > had comments. > > Just pushed it, the rest can be resolved later. > > -- > Anton Khirnov > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > To unsubscribe, visit link above, or email > ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe". ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 5/5 v3] lavfi/dnn_backend_native_layer_mathunary.h: Documentation
Add documentation for Unary Math Layer Signed-off-by: Shubhanshu Saxena --- .../dnn/dnn_backend_native_layer_mathunary.h | 30 +++ 1 file changed, 30 insertions(+) diff --git a/libavfilter/dnn/dnn_backend_native_layer_mathunary.h b/libavfilter/dnn/dnn_backend_native_layer_mathunary.h index 151a73200a..72b6953d40 100644 --- a/libavfilter/dnn/dnn_backend_native_layer_mathunary.h +++ b/libavfilter/dnn/dnn_backend_native_layer_mathunary.h @@ -54,7 +54,37 @@ typedef struct DnnLayerMathUnaryParams{ DNNMathUnaryOperation un_op; } DnnLayerMathUnaryParams; +/** + * @brief Load the Unary Math Layer. + * + * It assigns the layer parameters to the unary operator + * hyperparameter from the model file context. + * + * @param layer pointer to the DNN layer instance + * @param model_file_context pointer to model file context + * @param file_size model file size to check if data is read + * correctly from the model file + * @param operands_num operand count of the whole model to + * check if data is read correctly from the model file + * @return number of bytes read from the model file + * @retval 0 if out of memory or an error occurs + */ int ff_dnn_load_layer_math_unary(Layer *layer, AVIOContext *model_file_context, int file_size, int operands_num); + +/** + * @brief Execute the Unary Math Layer. + * + * It applies the unary operator parsed while + * loading to the given input operands. + * + * @param operands all operands for the model + * @param input_operand_indexes input operand indexes for this layer + * @param output_operand_index output operand index for this layer + * @param parameters average pooling parameters + * @param ctx pointer to Native model context for logging + * @retval 0 if the execution succeeds + * @retval DNN_ERROR if the execution fails + */ int ff_dnn_execute_layer_math_unary(DnnOperand *operands, const int32_t *input_operand_indexes, int32_t output_operand_index, const void *parameters, NativeContext *ctx); -- 2.27.0 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 1/5 v2] lavfi/dnn_backend_native_layer_avgpool.h: Documentation
Add documentation for Average Pool Layer Signed-off-by: Shubhanshu Saxena --- .../dnn/dnn_backend_native_layer_avgpool.h| 29 +++ 1 file changed, 29 insertions(+) diff --git a/libavfilter/dnn/dnn_backend_native_layer_avgpool.h b/libavfilter/dnn/dnn_backend_native_layer_avgpool.h index 75d9eb187b..ae55940366 100644 --- a/libavfilter/dnn/dnn_backend_native_layer_avgpool.h +++ b/libavfilter/dnn/dnn_backend_native_layer_avgpool.h @@ -33,7 +33,36 @@ typedef struct AvgPoolParams{ DNNPaddingParam padding_method; } AvgPoolParams; +/** + * @brief Load Average Pooling Layer. + * + * It assigns the layer parameters to the hyperparameters + * like strides, padding method, and kernel size after + * parsing from the model file context. + * + * @param layer pointer to the DNN layer instance + * @param model_file_context pointer to model file context + * @param file_size model file size to check if data is read + * correctly from the model file + * @param operands_num operand count of the whole model to + * check if data is read correctly from the model file + * @return number of bytes read from the model file + * @retval 0 if out of memory or an error occurs + */ int ff_dnn_load_layer_avg_pool(Layer *layer, AVIOContext *model_file_context, int file_size, int operands_num); + +/** + * @brief Execute the Average Pooling Layer. + * Padding in channel dimensions is currently not supported. + * + * @param operands all operands for the model + * @param input_operand_indexes input operand indexes for this layer + * @param output_operand_index output operand index for this layer + * @param parameters average pooling parameters + * @param ctx pointer to Native model context for logging + * @retval 0 if the execution succeeds + * @retval DNN_ERROR if the execution fails + */ int ff_dnn_execute_layer_avg_pool(DnnOperand *operands, const int32_t *input_operand_indexes, int32_t output_operand_index, const void *parameters, NativeContext *ctx); -- 2.27.0 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 08/12] fate/demux: convert flv-demux to ffprobe
Hey, Quoting Eoff, Ullysses A (2021-05-12 19:16:09) > *bump* > > Is anyone actively fixing this? Anton? Please. Sorry about the delay, the patch was on the ML since Monday, but people had comments. Just pushed it, the rest can be resolved later. -- Anton Khirnov ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH] lavf/flvdec: normalize exporting date metadata
pushed the patch as is, since it fixes FATE Further comments can be applied on top of it later. -- Anton Khirnov ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH] Add optional NIT table generation
On Wed, 12 May 2021, Ubaldo Porcheddu wrote: Hi Marton, +} + +//private data +desc_len += 6 + 2; +*q++ = 0x5F; +*q++ = 4; +*q++ = 0x00; +*q++ = 0x00; +put16(, 40); What are these? I didn't find any official document about it but this seems to be the way many national (FR,IT,UK) broadcasters are writing the virtual channel private data header and the one recognized by many popular tv on the market. But this looks like a separate descriptor from the virtual channels (logical_channel_descriptor). logical_channel_descriptor() is documented for example here: https://forums.mediaspy.org/uploads/short-url/2wA2rGhOkh2yjlbcWMtcQizBv8L.pdf So you should use the terminology that is used in the document above. +ts->nit_period = av_rescale(ts->nit_period_us, PCR_TIME_BASE, AV_TIME_BASE); if (ts->mux_rate == 1) av_log(s, AV_LOG_VERBOSE, "muxrate VBR, "); @@ -1154,12 +1237,14 @@ static int mpegts_init(AVFormatContext *s) "sdt every %"PRId64" ms, pat/pmt every %"PRId64" ms\n", av_rescale(ts->sdt_period, 1000, PCR_TIME_BASE), av_rescale(ts->pat_period, 1000, PCR_TIME_BASE)); +if (ts->nit_enable > 0) +av_log(s, AV_LOG_VERBOSE, "nit every %"PRId64" ms\n", av_rescale(ts->nit_period, 1000, PCR_TIME_BASE)); Maybe you should continue the last log line which already describes the interval of various tables, and not start a new line. The idea is to have the NIT emission optional so I don't know if is a good idea to stat its periodical transmission on the same line, when disabled? I meant something like: av_log(s, AV_LOG_VERBOSE, "sdt every %"PRId64" ms, pat/pmt every %"PRId64" ms", av_rescale(ts->sdt_period, 1000, PCR_TIME_BASE), av_rescale(ts->pat_period, 1000, PCR_TIME_BASE)); if (nit_enabled) av_log(s, AV_LOG_VERBOSE, ", nit every %"PRId64" ms") av_log(s, AV_LOG_VERBOSE, "\n") +{ "nit_enable", "Enable NIT transmission", + OFFSET(nit_enable), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, ENC }, As I wrote earlier, instead of a separate option, you should introduce a new flag in mpegts_flags. ok almost ready also with this Also docs/muxers.texi update is missing for the new feature. is there any guide on what an how to add it? :) No guide, but should be straightforward based on the existing documentation of the mpegts muxer. Regards, Marton ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 08/12] fate/demux: convert flv-demux to ffprobe
*bump* Is anyone actively fixing this? Anton? Please. > -Original Message- > From: ffmpeg-devel On Behalf Of Eoff, > Ullysses A > Sent: Tuesday, May 11, 2021 8:44 AM > To: FFmpeg development discussions and patches > Subject: Re: [FFmpeg-devel] [PATCH 08/12] fate/demux: convert flv-demux to > ffprobe > > > -Original Message- > > From: ffmpeg-devel On Behalf Of Anton > > Khirnov > > Sent: Sunday, April 25, 2021 12:03 AM > > To: ffmpeg-devel@ffmpeg.org > > Subject: [FFmpeg-devel] [PATCH 08/12] fate/demux: convert flv-demux to > > ffprobe > > > > It can handle side data cleanly. > > --- > > This patch breaks FATE (http://trac.ffmpeg.org/ticket/9235). > Please fix. > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > To unsubscribe, visit link above, or email > ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe". ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 1/5] lavfi/dnn_backend_native_layer_avgpool.h: Documentation
> -Original Message- > From: ffmpeg-devel On Behalf Of > Shubhanshu Saxena > Sent: Wednesday, May 12, 2021 5:02 PM > To: FFmpeg development discussions and patches de...@ffmpeg.org> > Subject: Re: [FFmpeg-devel] [PATCH 1/5] > lavfi/dnn_backend_native_layer_avgpool.h: Documentation > > On Wed, May 12, 2021 at 7:52 AM Guo, Yejun wrote: > > > > > > > > -Original Message- > > > From: ffmpeg-devel On Behalf Of > > > Shubhanshu Saxena > > > Sent: 2021年5月8日 20:10 > > > To: ffmpeg-devel@ffmpeg.org > > > Cc: Shubhanshu Saxena > > > Subject: [FFmpeg-devel] [PATCH 1/5] > > > > Okay, I'll remove the spaces and correct these lines. Thank you. > > Also, since the parameters for loading and execution functions are the same > in other layers, I need to correct them as well. Right? Yes, right. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH] lavc/pngdec: actually use SIMD version for bpp<=2
On Wed, May 12, 2021 at 07:07:27AM +0200, Nicolas Frattaroli wrote: > The SIMD version was only used by the bpp > 2 case. This patch > uses the SIMD version for both code paths. > > Change has been tested to still work with a 1-bpp image that uses > paeth, to generate one: change breaks fate --- ./tests/ref/fate/lscr 2021-05-07 19:20:39.256076206 +0200 +++ tests/data/fate/lscr2021-05-12 15:43:28.128017958 +0200 @@ -4,18 +4,18 @@ #dimensions 0: 320x240 #sar 0: 0/1 0, 0, 0,1, 230400, 0x07c93bd9 -0, 1, 1,1, 230400, 0xdcacc274 -0, 2, 2,1, 230400, 0x6115dc34 -0, 3, 3,1, 230400, 0x7317f35c -0, 4, 4,1, 230400, 0xca18d9a6 -0, 5, 5,1, 230400, 0x0c104d49 -0, 6, 6,1, 230400, 0xc4c415cf -0, 7, 7,1, 230400, 0xd1e4149f -0, 8, 8,1, 230400, 0x5973ae25 -0, 9, 9,1, 230400, 0xd77893e6 -0, 10, 10,1, 230400, 0x7f9cac97 -0, 11, 11,1, 230400, 0xc8f81940 -0, 12, 12,1, 230400, 0xa2b6f5d4 -0, 13, 13,1, 230400, 0x620c3222 -0, 14, 14,1, 230400, 0x60d097a0 -0, 15, 15,1, 230400, 0x47201c65 +0, 1, 1,1, 230400, 0x5af5c26e +0, 2, 2,1, 230400, 0x115fdbbf +0, 3, 3,1, 230400, 0x5f290ac6 +0, 4, 4,1, 230400, 0x93030c28 +0, 5, 5,1, 230400, 0x37a8c4f0 +0, 6, 6,1, 230400, 0xbaff9eb5 +0, 7, 7,1, 230400, 0x89c4c6e9 +0, 8, 8,1, 230400, 0x48dd646a +0, 9, 9,1, 230400, 0x31c944ac +0, 10, 10,1, 230400, 0x88ad9fd3 +0, 11, 11,1, 230400, 0x0b1fb7b1 +0, 12, 12,1, 230400, 0xe6abfaf6 +0, 13, 13,1, 230400, 0xea3c3e53 +0, 14, 14,1, 230400, 0xe8e443d3 +0, 15, 15,1, 230400, 0x4c069712 Test lscr failed. Look at tests/data/fate/lscr.err for details. tests/Makefile:254: recipe for target 'fate-lscr' failed make: *** [fate-lscr] Error 1 [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Everything should be made as simple as possible, but not simpler. -- Albert Einstein signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] ffprobe as library rather than CLI
On 12.05.2021 15:19, Samuel Marks wrote: Started hacking around to make it work. So I changed the `main` to a: extern int ffprobe(int argc, char **argv); Then I added a header with a prototype of the same, and started messing with vcpkg + CMake to try and get it to build correctly. That's not going to work. The whole thing is not designed to be called more than once, and you can be close to certain that it's going to fail miserably and in unexpected ways. Use the libraries if you want to integrate ffmpeg functionality into your own application. smime.p7s Description: S/MIME Cryptographic Signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH] fftools/ffmpeg: Restore DTS correction for VP9 copies
On 5/12/2021 10:02 AM, Danny Wu wrote: Fixes ticket 9086. Since early 2021, some of YouTube's VP9 encodes have non-monotonous DTS. This makes ffmpeg fatally fail when trying to copy or encode the V9 video. ffmpeg already includes functionality to correct this, however it was disabled without explanation for VP9 stream copies in 2e6636aa87303d37b112e79f093ca39500f92364 The reason is that a bitstream filter that merges frames into superframes (1 visible + up to 7 invisible) was implemented. This patch restores the DTS correction logic, and allows ffmpeg to correctly encode (invalid) videos produced by youtube.com. I have verified that frames are NOT being cut (so it does not re-introduce 4313). Shouldn't google not produce invalid files? Also, can you link one of these videos to test this issue? --- fftools/ffmpeg.c | 1 - 1 file changed, 1 deletion(-) diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c index 3ad11452da..67deb7762f 100644 --- a/fftools/ffmpeg.c +++ b/fftools/ffmpeg.c @@ -823,7 +823,6 @@ static void write_packet(OutputFile *of, AVPacket *pkt, OutputStream *ost, int u } if ((st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO || st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO || st->codecpar->codec_type == AVMEDIA_TYPE_SUBTITLE) && pkt->dts != AV_NOPTS_VALUE && -!(st->codecpar->codec_id == AV_CODEC_ID_VP9 && ost->stream_copy) && ost->last_mux_dts != AV_NOPTS_VALUE) { int64_t max = ost->last_mux_dts + !(s->oformat->flags & AVFMT_TS_NONSTRICT); if (pkt->dts < max) { Your mail client mangled the patch. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH] fftools/ffmpeg: Restore DTS correction for VP9 copies
Fixes ticket 9086. Since early 2021, some of YouTube's VP9 encodes have non-monotonous DTS. This makes ffmpeg fatally fail when trying to copy or encode the V9 video. ffmpeg already includes functionality to correct this, however it was disabled without explanation for VP9 stream copies in 2e6636aa87303d37b112e79f093ca39500f92364 This patch restores the DTS correction logic, and allows ffmpeg to correctly encode (invalid) videos produced by youtube.com. I have verified that frames are NOT being cut (so it does not re-introduce 4313). --- fftools/ffmpeg.c | 1 - 1 file changed, 1 deletion(-) diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c index 3ad11452da..67deb7762f 100644 --- a/fftools/ffmpeg.c +++ b/fftools/ffmpeg.c @@ -823,7 +823,6 @@ static void write_packet(OutputFile *of, AVPacket *pkt, OutputStream *ost, int u } if ((st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO || st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO || st->codecpar->codec_type == AVMEDIA_TYPE_SUBTITLE) && pkt->dts != AV_NOPTS_VALUE && -!(st->codecpar->codec_id == AV_CODEC_ID_VP9 && ost->stream_copy) && ost->last_mux_dts != AV_NOPTS_VALUE) { int64_t max = ost->last_mux_dts + !(s->oformat->flags & AVFMT_TS_NONSTRICT); if (pkt->dts < max) { -- 2.17.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH] avcodec: remove leftover references to AVCodecContext.refcounted_frames
Signed-off-by: James Almer --- libavcodec/avcodec.h | 10 +++--- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index 3cf131d0a5..51c29ec54e 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -2737,8 +2737,7 @@ int avcodec_receive_frame(AVCodecContext *avctx, AVFrame *frame); * the call will not fail with EAGAIN). * AVERROR_EOF: the encoder has been flushed, and no new frames can * be sent to it - * AVERROR(EINVAL): codec not opened, refcounted_frames not set, it is a - * decoder, or requires flush + * AVERROR(EINVAL): codec not opened, it is a decoder, or requires flush * AVERROR(ENOMEM): failed to add packet to internal queue, or similar * other errors: legitimate encoding errors */ @@ -3230,11 +3229,8 @@ int avcodec_fill_audio_frame(AVFrame *frame, int nb_channels, * Reset the internal codec state / flush internal buffers. Should be called * e.g. when seeking or when switching to a different stream. * - * @note for decoders, when refcounted frames are not used - * (i.e. avctx->refcounted_frames is 0), this invalidates the frames previously - * returned from the decoder. When refcounted frames are used, the decoder just - * releases any references it might keep internally, but the caller's reference - * remains valid. + * @note for decoders, this function just releases any references the decoder + * might keep internally, but the caller's references remain valid. * * @note for encoders, this function will only do something if the encoder * declares support for AV_CODEC_CAP_ENCODER_FLUSH. When called, the encoder -- 2.31.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] ffprobe as library rather than CLI
Started hacking around to make it work. So I changed the `main` to a: extern int ffprobe(int argc, char **argv); Then I added a header with a prototype of the same, and started messing with vcpkg + CMake to try and get it to build correctly. Is there any appetite amongst you FFMPEG developers for an actually workable API to be built; as a C SDK? PS: Would welcome ideas on how best to build this ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH] fftools/ffmpeg: fix -t inaccurate recording time
Is there objection? will push it tomorrow. On Thu, 6 May 2021, Shiwang.Xie wrote: if input start time is not 0 -t is inaccurate doing stream copy, will record extra duration according to input start time. it should base on following cases: input video start time from 60s, duration is 300s, 1. stream copy: ffmpeg -ss 40 -t 60 -i in.mp4 -c copy -y out.mp4 open_input_file() will seek to 100 and set ts_offset to -100, process_input() will offset pkt->pts with ts_offset to make it 0, so when do_streamcopy() with -t, exits when ist->pts >= recording_time. 2. stream copy with -copyts: ffmpeg -ss 40 -t 60 -copyts -i in.mp4 -c copy -y out.mp4 open_input_file() will seek to 100 and set ts_offset to 0, process_input() will keep raw pkt->pts as ts_offset is 0, so when do_streamcopy() with -t, exits when ist->pts >= (recording_time+f->start_time+f->ctx->start_time). 3. stream copy with -copyts -start_at_zero: ffmpeg -ss 40 -t 60 -copyts -start_at_zero -i in.mp4 -c copy -y out.mp4 open_input_file() will seek to 120 and set ts_offset to -60 as start_to_zero option, process_input() will offset pkt->pts with input file start time, so when do_streamcopy() with -t, exits when ist->pts >= (recording_time+f->start_time). 0 60 40 60 360 |___|_|___|___| start -ss -t This fixes ticket #9141. Signed-off-by: Shiwang.Xie --- fftools/ffmpeg.c | 8 +--- 1 file changed, 5 insertions(+), 3 deletions(-) ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH] Add optional NIT table generation
Hi Marton, +} + +//private data +desc_len += 6 + 2; +*q++ = 0x5F; +*q++ = 4; +*q++ = 0x00; +*q++ = 0x00; +put16(, 40); What are these? I didn't find any official document about it but this seems to be the way many national (FR,IT,UK) broadcasters are writing the virtual channel private data header and the one recognized by many popular tv on the market. +ts->nit_period = av_rescale(ts->nit_period_us, PCR_TIME_BASE, AV_TIME_BASE); if (ts->mux_rate == 1) av_log(s, AV_LOG_VERBOSE, "muxrate VBR, "); @@ -1154,12 +1237,14 @@ static int mpegts_init(AVFormatContext *s) "sdt every %"PRId64" ms, pat/pmt every %"PRId64" ms\n", av_rescale(ts->sdt_period, 1000, PCR_TIME_BASE), av_rescale(ts->pat_period, 1000, PCR_TIME_BASE)); +if (ts->nit_enable > 0) +av_log(s, AV_LOG_VERBOSE, "nit every %"PRId64" ms\n", av_rescale(ts->nit_period, 1000, PCR_TIME_BASE)); Maybe you should continue the last log line which already describes the interval of various tables, and not start a new line. The idea is to have the NIT emission optional so I don't know if is a good idea to stat its periodical transmission on the same line, when disabled? +{ "nit_enable", "Enable NIT transmission", + OFFSET(nit_enable), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, ENC }, As I wrote earlier, instead of a separate option, you should introduce a new flag in mpegts_flags. ok almost ready also with this Also docs/muxers.texi update is missing for the new feature. is there any guide on what an how to add it? :) ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 1/5] lavfi/dnn_backend_native_layer_avgpool.h: Documentation
On Wed, May 12, 2021 at 7:52 AM Guo, Yejun wrote: > > > > -Original Message- > > From: ffmpeg-devel On Behalf Of > > Shubhanshu Saxena > > Sent: 2021年5月8日 20:10 > > To: ffmpeg-devel@ffmpeg.org > > Cc: Shubhanshu Saxena > > Subject: [FFmpeg-devel] [PATCH 1/5] > > lavfi/dnn_backend_native_layer_avgpool.h: Documentation > > > > Add documentation for Average Pool Layer > > > > Signed-off-by: Shubhanshu Saxena > > --- > > .../dnn/dnn_backend_native_layer_avgpool.h| 27 > > +++ > > 1 file changed, 27 insertions(+) > > > > diff --git a/libavfilter/dnn/dnn_backend_native_layer_avgpool.h > > b/libavfilter/dnn/dnn_backend_native_layer_avgpool.h > > index 75d9eb187b..0f629b9165 100644 > > --- a/libavfilter/dnn/dnn_backend_native_layer_avgpool.h > > +++ b/libavfilter/dnn/dnn_backend_native_layer_avgpool.h > > @@ -33,7 +33,34 @@ typedef struct AvgPoolParams{ > > DNNPaddingParam padding_method; > > } AvgPoolParams; > > > > +/** > > + * @brief Load Average Pooling Layer. > > + * > > + * It assigns the layer parameters to the hyperparameters > > + * like strides, padding method, and kernel size after > > + * parsing from the model file context. > > + * > > please run 'git show' for every patch to make sure there's no > tailing spaces in the change. > > > + * @param layer pointer to the DNN layer instance > > + * @param model_file_context pointer to model file context > > + * @param file_size model file size > > + * @param operands_num number of operands for the layer > > operands_num is the operand count of the whole model, > it is used to check the data read from model file is correct, > just like the usage of file_size. > > > + * @return Size of DNN Layer > Size -> size. > return the number of bytes read from model file. > > > + * @retval 0 if model file context contains invalid hyperparameters. > return 0 for error. > > there's another case to return 0 for out of memory. > > > + */ > > int ff_dnn_load_layer_avg_pool(Layer *layer, AVIOContext > > *model_file_context, int file_size, int operands_num); > > + > > +/** > > + * @brief Execute the Average Pooling Layer. > > + * Padding in channel dimensions is currently not supported. > > + * > > + * @param operands input operands > > operands contain all the operands of the model > > > + * @param input_operand_indexes input operand indexes > > input operand indexes for this layer. > > > + * @param output_operand_index output operand index > > output operand index for this layer. > > > + * @param parameters average pooling parameters > > + * @param ctx pointer to Native model context > > and its usage is for logging only. > > > + * @retval 0 if the execution succeeds > > + * @retval DNN_ERROR if the execution fails > > + */ > > int ff_dnn_execute_layer_avg_pool(DnnOperand *operands, const int32_t > > *input_operand_indexes, > >int32_t output_operand_index, > > const void *parameters, NativeContext *ctx); > > > > -- > > 2.27.0 > > > > ___ > > ffmpeg-devel mailing list > > ffmpeg-devel@ffmpeg.org > > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > > > To unsubscribe, visit link above, or email > > ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe". > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > To unsubscribe, visit link above, or email > ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe". > Okay, I'll remove the spaces and correct these lines. Thank you. Also, since the parameters for loading and execution functions are the same in other layers, I need to correct them as well. Right? ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH] ffmpeg: return no chosen output if an uninitialized stream is unavailable
On Fri, May 7, 2021 at 12:22 AM Jan Ekström wrote: > > Otherwise the rate emulation logic in `transcode_step` never gets > hit, and the unavailability flag never gets reset, leading to an > eternal loop. > > Fixes #9160 > --- I will be double-checking after $dayjob whether there is another area where the fix for this issue would be more applicable, but if I cannot come up with a better way of dealing with this - as at least one user has confirmed that this fixes all of his issues with relation to -re and -ss (among other things) - I will be applying this to master and release/4.4, both of which are affected. Jan ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".