[FFmpeg-cvslog] fftools/ffmpeg_filter: move FilterGraph.graph to FilterGraphThread
ffmpeg | branch: master | Anton Khirnov | Wed Dec 13 18:26:21 2023 +0100| [84201d8af6255ddfbeffa38afd51f0ecf742390b] | committer: Anton Khirnov fftools/ffmpeg_filter: move FilterGraph.graph to FilterGraphThread The AVFilterGraph is fully owned by the filtering thread and should never be accessed outside of it. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=84201d8af6255ddfbeffa38afd51f0ecf742390b --- fftools/ffmpeg.h| 2 - fftools/ffmpeg_filter.c | 120 ++-- 2 files changed, 64 insertions(+), 58 deletions(-) diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h index 7f84f3266d..de79bb1cbe 100644 --- a/fftools/ffmpeg.h +++ b/fftools/ffmpeg.h @@ -327,8 +327,6 @@ typedef struct FilterGraph { const AVClass *class; intindex; -AVFilterGraph *graph; - InputFilter **inputs; int nb_inputs; OutputFilter **outputs; diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c index 21f823be12..002bdb143d 100644 --- a/fftools/ffmpeg_filter.c +++ b/fftools/ffmpeg_filter.c @@ -81,6 +81,8 @@ static const FilterGraphPriv *cfgp_from_cfg(const FilterGraph *fg) // data that is local to the filter thread and not visible outside of it typedef struct FilterGraphThread { +AVFilterGraph *graph; + AVFrame *frame; // Temporary buffer for output frames, since on filtergraph reset @@ -851,7 +853,6 @@ void fg_free(FilterGraph **pfg) return; fgp = fgp_from_fg(fg); -avfilter_graph_free(&fg->graph); for (int j = 0; j < fg->nb_inputs; j++) { InputFilter *ifilter = fg->inputs[j]; InputFilterPriv *ifp = ifp_from_ifilter(ifilter); @@ -1214,7 +1215,8 @@ static int insert_filter(AVFilterContext **last_filter, int *pad_idx, return 0; } -static int configure_output_video_filter(FilterGraph *fg, OutputFilter *ofilter, AVFilterInOut *out) +static int configure_output_video_filter(FilterGraph *fg, AVFilterGraph *graph, + OutputFilter *ofilter, AVFilterInOut *out) { OutputFilterPriv *ofp = ofp_from_ofilter(ofilter); OutputStream *ost = ofilter->ost; @@ -1229,7 +1231,7 @@ static int configure_output_video_filter(FilterGraph *fg, OutputFilter *ofilter, snprintf(name, sizeof(name), "out_%d_%d", ost->file_index, ost->index); ret = avfilter_graph_create_filter(&ofp->filter, avfilter_get_by_name("buffersink"), - name, NULL, NULL, fg->graph); + name, NULL, NULL, graph); if (ret < 0) return ret; @@ -1249,7 +1251,7 @@ static int configure_output_video_filter(FilterGraph *fg, OutputFilter *ofilter, snprintf(name, sizeof(name), "scaler_out_%d_%d", ost->file_index, ost->index); if ((ret = avfilter_graph_create_filter(&filter, avfilter_get_by_name("scale"), -name, args, NULL, fg->graph)) < 0) +name, args, NULL, graph)) < 0) return ret; if ((ret = avfilter_link(last_filter, pad_idx, filter, 0)) < 0) return ret; @@ -1268,7 +1270,7 @@ static int configure_output_video_filter(FilterGraph *fg, OutputFilter *ofilter, ret = avfilter_graph_create_filter(&filter, avfilter_get_by_name("format"), - "format", pix_fmts, NULL, fg->graph); + "format", pix_fmts, NULL, graph); av_bprint_finalize(&bprint, NULL); if (ret < 0) return ret; @@ -1293,7 +1295,8 @@ static int configure_output_video_filter(FilterGraph *fg, OutputFilter *ofilter, return 0; } -static int configure_output_audio_filter(FilterGraph *fg, OutputFilter *ofilter, AVFilterInOut *out) +static int configure_output_audio_filter(FilterGraph *fg, AVFilterGraph *graph, + OutputFilter *ofilter, AVFilterInOut *out) { OutputFilterPriv *ofp = ofp_from_ofilter(ofilter); OutputStream *ost = ofilter->ost; @@ -1307,7 +1310,7 @@ static int configure_output_audio_filter(FilterGraph *fg, OutputFilter *ofilter, snprintf(name, sizeof(name), "out_%d_%d", ost->file_index, ost->index); ret = avfilter_graph_create_filter(&ofp->filter, avfilter_get_by_name("abuffersink"), - name, NULL, NULL, fg->graph); + name, NULL, NULL, graph); if (ret < 0) return ret; if ((ret = av_opt_set_int(ofp->filter, "all_channel_counts", 1, AV_OPT_SEARCH_CHILDREN)) < 0) @@ -1321,7 +1324,7 @@ static int configure_output_audio_filter(FilterGraph *fg, OutputFilter *ofilter,
[FFmpeg-cvslog] fftools/ffmpeg: replace InputStream.file_index by a pointer
ffmpeg | branch: master | Anton Khirnov | Wed Dec 13 18:39:02 2023 +0100| [0fcea80b2a328f6fd8fc7403e46b18a6e37d6c86] | committer: Anton Khirnov fftools/ffmpeg: replace InputStream.file_index by a pointer Reduces the need to use the input_files global array. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=0fcea80b2a328f6fd8fc7403e46b18a6e37d6c86 --- fftools/ffmpeg.c | 6 +++--- fftools/ffmpeg.h | 4 +++- fftools/ffmpeg_dec.c | 10 +- fftools/ffmpeg_demux.c| 9 - fftools/ffmpeg_filter.c | 14 +++--- fftools/ffmpeg_mux_init.c | 10 +- 6 files changed, 27 insertions(+), 26 deletions(-) diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c index 42e675dcb9..567afbadad 100644 --- a/fftools/ffmpeg.c +++ b/fftools/ffmpeg.c @@ -390,7 +390,7 @@ OutputStream *ost_iter(OutputStream *prev) InputStream *ist_iter(InputStream *prev) { -int if_idx = prev ? prev->file_index : 0; +int if_idx = prev ? prev->file->index : 0; int ist_idx = prev ? prev->index + 1 : 0; for (; if_idx < nb_input_files; if_idx++) { @@ -767,7 +767,7 @@ static void print_stream_maps(void) for (int j = 0; j < ist->nb_filters; j++) { if (!filtergraph_is_simple(ist->filters[j]->graph)) { av_log(NULL, AV_LOG_INFO, " Stream #%d:%d (%s) -> %s", - ist->file_index, ist->index, ist->dec ? ist->dec->name : "?", + ist->file->index, ist->index, ist->dec ? ist->dec->name : "?", ist->filters[j]->name); if (nb_filtergraphs > 1) av_log(NULL, AV_LOG_INFO, " (graph %d)", ist->filters[j]->graph->index); @@ -796,7 +796,7 @@ static void print_stream_maps(void) } av_log(NULL, AV_LOG_INFO, " Stream #%d:%d -> #%d:%d", - ost->ist->file_index, + ost->ist->file->index, ost->ist->index, ost->file_index, ost->index); diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h index de79bb1cbe..2c9ca5f538 100644 --- a/fftools/ffmpeg.h +++ b/fftools/ffmpeg.h @@ -338,7 +338,9 @@ typedef struct Decoder Decoder; typedef struct InputStream { const AVClass *class; -int file_index; +/* parent source */ +struct InputFile *file; + int index; AVStream *st; diff --git a/fftools/ffmpeg_dec.c b/fftools/ffmpeg_dec.c index ce5aa33f73..5d4ef7909c 100644 --- a/fftools/ffmpeg_dec.c +++ b/fftools/ffmpeg_dec.c @@ -194,7 +194,7 @@ static void audio_ts_process(void *logctx, Decoder *d, AVFrame *frame) static int64_t video_duration_estimate(const InputStream *ist, const AVFrame *frame) { const Decoder *d = ist->decoder; -const InputFile *ifile = input_files[ist->file_index]; +const InputFile *ifile = ist->file; int64_t codec_duration = 0; // XXX lavf currently makes up frame durations when they are not provided by @@ -456,7 +456,7 @@ static int transcode_subtitles(InputStream *ist, const AVPacket *pkt, static int packet_decode(InputStream *ist, AVPacket *pkt, AVFrame *frame) { -const InputFile *ifile = input_files[ist->file_index]; +const InputFile *ifile = ist->file; Decoder *d = ist->decoder; AVCodecContext *dec = ist->dec_ctx; const char *type_desc = av_get_media_type_string(dec->codec_type); @@ -512,7 +512,7 @@ static int packet_decode(InputStream *ist, AVPacket *pkt, AVFrame *frame) update_benchmark(NULL); ret = avcodec_receive_frame(dec, frame); update_benchmark("decode_%s %d.%d", type_desc, - ist->file_index, ist->index); + ifile->index, ist->index); if (ret == AVERROR(EAGAIN)) { av_assert0(pkt); // should never happen during flushing @@ -558,7 +558,7 @@ static int packet_decode(InputStream *ist, AVPacket *pkt, AVFrame *frame) ret = video_frame_process(ist, frame); if (ret < 0) { av_log(NULL, AV_LOG_FATAL, "Error while processing the decoded " - "data for stream #%d:%d\n", ist->file_index, ist->index); + "data for stream #%d:%d\n", ifile->index, ist->index); return ret; } } @@ -576,7 +576,7 @@ static int packet_decode(InputStream *ist, AVPacket *pkt, AVFrame *frame) static void dec_thread_set_name(const InputStream *ist) { char name[16]; -snprintf(name, sizeof(name), "dec%d:%d:%s", ist->file_index, ist->index, +snprintf(name, sizeof(name), "dec%d:%d:%s", ist->file->index, ist->index, ist->dec_ctx->codec->name); ff_thread_setname(name); } diff --git a/fftools/ffmpeg_demux.c b/fftools/ffmpeg_demux.c index d2466e885d..7625c09674 100644 --- a/fftools/ffmpeg_demux.c +++ b/fftools/ffmpeg_demux.c @@ -460,8 +460,7 @@ static int input_packet_process(Demuxer *d, AVPacket *pkt, unsigned *send_flags)
[FFmpeg-cvslog] fftools/ffmpeg_sched: actually initialize/destroy schedule_lock
ffmpeg | branch: master | Anton Khirnov | Thu Dec 14 09:42:59 2023 +0100| [06d5dc11db257786dd18d13f39dd063ef8c1fa7d] | committer: Anton Khirnov fftools/ffmpeg_sched: actually initialize/destroy schedule_lock > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=06d5dc11db257786dd18d13f39dd063ef8c1fa7d --- fftools/ffmpeg_sched.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/fftools/ffmpeg_sched.c b/fftools/ffmpeg_sched.c index 96eaaae072..20063fe47e 100644 --- a/fftools/ffmpeg_sched.c +++ b/fftools/ffmpeg_sched.c @@ -565,6 +565,8 @@ void sch_free(Scheduler **psch) av_freep(&sch->sdp_filename); +pthread_mutex_destroy(&sch->schedule_lock); + pthread_mutex_destroy(&sch->mux_ready_lock); pthread_mutex_destroy(&sch->mux_done_lock); @@ -590,6 +592,10 @@ Scheduler *sch_alloc(void) sch->class= &scheduler_class; sch->sdp_auto = 1; +ret = pthread_mutex_init(&sch->schedule_lock, NULL); +if (ret) +goto fail; + ret = pthread_mutex_init(&sch->mux_ready_lock, NULL); if (ret) goto fail; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] fftools/ffmpeg: replace OutputStream.file_index by a pointer
ffmpeg | branch: master | Anton Khirnov | Wed Dec 13 18:39:02 2023 +0100| [4224895a87dc4bccaa210d3a554fd8acb7a28fed] | committer: Anton Khirnov fftools/ffmpeg: replace OutputStream.file_index by a pointer Reduces the need to use the output_files global array. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=4224895a87dc4bccaa210d3a554fd8acb7a28fed --- fftools/ffmpeg.c | 12 ++-- fftools/ffmpeg.h | 4 +++- fftools/ffmpeg_enc.c | 21 +++-- fftools/ffmpeg_filter.c | 22 +++--- fftools/ffmpeg_mux.c | 11 +-- fftools/ffmpeg_mux_init.c | 12 ++-- 6 files changed, 42 insertions(+), 40 deletions(-) diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c index 567afbadad..1b2a15750b 100644 --- a/fftools/ffmpeg.c +++ b/fftools/ffmpeg.c @@ -374,7 +374,7 @@ static void ffmpeg_cleanup(int ret) OutputStream *ost_iter(OutputStream *prev) { -int of_idx = prev ? prev->file_index : 0; +int of_idx = prev ? prev->file->index : 0; int ost_idx = prev ? prev->index + 1 : 0; for (; of_idx < nb_output_files; of_idx++) { @@ -530,7 +530,7 @@ static void print_report(int is_last_report, int64_t timer_start, int64_t cur_ti if (vid && ost->type == AVMEDIA_TYPE_VIDEO) { av_bprintf(&buf, "q=%2.1f ", q); av_bprintf(&buf_script, "stream_%d_%d_q=%.1f\n", - ost->file_index, ost->index, q); + ost->file->index, ost->index, q); } if (!vid && ost->type == AVMEDIA_TYPE_VIDEO && ost->filter) { float fps; @@ -542,7 +542,7 @@ static void print_report(int is_last_report, int64_t timer_start, int64_t cur_ti av_bprintf(&buf_script, "frame=%"PRId64"\n", frame_number); av_bprintf(&buf_script, "fps=%.2f\n", fps); av_bprintf(&buf_script, "stream_%d_%d_q=%.1f\n", - ost->file_index, ost->index, q); + ost->file->index, ost->index, q); if (is_last_report) av_bprintf(&buf, "L"); @@ -780,7 +780,7 @@ static void print_stream_maps(void) if (ost->attachment_filename) { /* an attached file */ av_log(NULL, AV_LOG_INFO, " File %s -> Stream #%d:%d\n", - ost->attachment_filename, ost->file_index, ost->index); + ost->attachment_filename, ost->file->index, ost->index); continue; } @@ -790,7 +790,7 @@ static void print_stream_maps(void) if (nb_filtergraphs > 1) av_log(NULL, AV_LOG_INFO, " (graph %d)", ost->filter->graph->index); -av_log(NULL, AV_LOG_INFO, " -> Stream #%d:%d (%s)\n", ost->file_index, +av_log(NULL, AV_LOG_INFO, " -> Stream #%d:%d (%s)\n", ost->file->index, ost->index, ost->enc_ctx->codec->name); continue; } @@ -798,7 +798,7 @@ static void print_stream_maps(void) av_log(NULL, AV_LOG_INFO, " Stream #%d:%d -> #%d:%d", ost->ist->file->index, ost->ist->index, - ost->file_index, + ost->file->index, ost->index); if (ost->enc_ctx) { const AVCodec *in_codec= ost->ist->dec; diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h index 2c9ca5f538..15e65021d7 100644 --- a/fftools/ffmpeg.h +++ b/fftools/ffmpeg.h @@ -519,7 +519,9 @@ typedef struct OutputStream { enum AVMediaType type; -int file_index; /* file index */ +/* parent muxer */ +struct OutputFile *file; + int index; /* stream index in the output file */ /** diff --git a/fftools/ffmpeg_enc.c b/fftools/ffmpeg_enc.c index 43e8b077eb..9141dab6a4 100644 --- a/fftools/ffmpeg_enc.c +++ b/fftools/ffmpeg_enc.c @@ -173,7 +173,7 @@ int enc_open(void *opaque, const AVFrame *frame) AVCodecContext *enc_ctx = ost->enc_ctx; AVCodecContext *dec_ctx = NULL; const AVCodec *enc = enc_ctx->codec; -OutputFile *of = output_files[ost->file_index]; +OutputFile *of = ost->file; FrameData *fd; int frame_samples = 0; int ret; @@ -189,7 +189,7 @@ int enc_open(void *opaque, const AVFrame *frame) fd = (FrameData*)frame->opaque_ref->data; } -ret = set_encoder_id(output_files[ost->file_index], ost); +ret = set_encoder_id(of, ost); if (ret < 0) return ret; @@ -375,7 +375,7 @@ int enc_open(void *opaque, const AVFrame *frame) static int check_recording_time(OutputStream *ost, int64_t ts, AVRational tb) { -OutputFile *of = output_files[ost->file_index]; +OutputFile *of = ost->file; if (of->recording_time != INT64_MAX && av_compare_ts(ts, tb, of->recording_time, AV_TIME_BASE_Q) >= 0) { @@ -414,8 +414,8 @@ static int do_subtitle_out(OutputFile *of, OutputStream *ost, const AVSubtitle * /* shift timestamp to honor -ss and
[FFmpeg-cvslog] fftools/ffmpeg: move InputStream.discard to private data
ffmpeg | branch: master | Anton Khirnov | Wed Dec 13 19:15:11 2023 +0100| [9afe3f527449ddef68ae526e52e2480eaa57cd3a] | committer: Anton Khirnov fftools/ffmpeg: move InputStream.discard to private data It is not used outside of ffmpeg_demux. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=9afe3f527449ddef68ae526e52e2480eaa57cd3a --- fftools/ffmpeg.h | 1 - fftools/ffmpeg_demux.c | 23 +++ 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h index 15e65021d7..4f7a386d41 100644 --- a/fftools/ffmpeg.h +++ b/fftools/ffmpeg.h @@ -344,7 +344,6 @@ typedef struct InputStream { int index; AVStream *st; -int discard; /* true if stream data should be discarded */ int user_set_discard; int decoding_needed; /* non zero if the packets must be decoded in 'raw_fifo', see DECODING_FOR_* */ #define DECODING_FOR_OST1 diff --git a/fftools/ffmpeg_demux.c b/fftools/ffmpeg_demux.c index 7625c09674..03c8bb44e6 100644 --- a/fftools/ffmpeg_demux.c +++ b/fftools/ffmpeg_demux.c @@ -63,6 +63,9 @@ typedef struct DemuxStream { double ts_scale; +/* true if stream data should be discarded */ +int discard; + // scheduler returned EOF for this stream int finished; @@ -136,7 +139,8 @@ static Demuxer *demuxer_from_ifile(InputFile *f) InputStream *ist_find_unused(enum AVMediaType type) { for (InputStream *ist = ist_iter(NULL); ist; ist = ist_iter(ist)) { -if (ist->par->codec_type == type && ist->discard && +DemuxStream *ds = ds_from_ist(ist); +if (ist->par->codec_type == type && ds->discard && ist->user_set_discard != AVDISCARD_ALL) return ist; } @@ -553,11 +557,14 @@ static void discard_unused_programs(InputFile *ifile) AVProgram *p = ifile->ctx->programs[j]; int discard = AVDISCARD_ALL; -for (int k = 0; k < p->nb_stream_indexes; k++) -if (!ifile->streams[p->stream_index[k]]->discard) { +for (int k = 0; k < p->nb_stream_indexes; k++) { +DemuxStream *ds = ds_from_ist(ifile->streams[p->stream_index[k]]); + +if (!ds->discard) { discard = AVDISCARD_DEFAULT; break; } +} p->discard = discard; } } @@ -634,7 +641,7 @@ static void *input_thread(void *arg) dynamically in stream : we ignore them */ ds = pkt->stream_index < f->nb_streams ? ds_from_ist(f->streams[pkt->stream_index]) : NULL; -if (!ds || ds->ist.discard || ds->finished) { +if (!ds || ds->discard || ds->finished) { report_new_stream(d, pkt); av_packet_unref(pkt); continue; @@ -686,7 +693,7 @@ static void demux_final_stats(Demuxer *d) DemuxStream *ds = ds_from_ist(ist); enum AVMediaType type = ist->par->codec_type; -if (ist->discard || type == AVMEDIA_TYPE_ATTACHMENT) +if (ds->discard || type == AVMEDIA_TYPE_ATTACHMENT) continue; total_size+= ds->data_size; @@ -774,8 +781,8 @@ static int ist_use(InputStream *ist, int decoding_needed) ds->sch_idx_stream = ret; } -if (ist->discard) { -ist->discard = 0; +if (ds->discard) { +ds->discard = 0; d->nb_streams_used++; } @@ -1021,7 +1028,7 @@ static int ist_add(const OptionsContext *o, Demuxer *d, AVStream *st) ist = &ds->ist; -ist->discard = 1; +ds->discard = 1; st->discard = AVDISCARD_ALL; ds->first_dts = AV_NOPTS_VALUE; ds->next_dts= AV_NOPTS_VALUE; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] fftools/ffmpeg: move InputStream.codec_desc to private data
ffmpeg | branch: master | Anton Khirnov | Wed Dec 13 19:15:11 2023 +0100| [882bc8049dea90bf8c9091c02b06c2309892111e] | committer: Anton Khirnov fftools/ffmpeg: move InputStream.codec_desc to private data It is not used outside of ffmpeg_demux. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=882bc8049dea90bf8c9091c02b06c2309892111e --- fftools/ffmpeg.h | 1 - fftools/ffmpeg_demux.c | 8 +--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h index 4f7a386d41..b10a2f2c0d 100644 --- a/fftools/ffmpeg.h +++ b/fftools/ffmpeg.h @@ -358,7 +358,6 @@ typedef struct InputStream { Decoder *decoder; AVCodecContext *dec_ctx; const AVCodec *dec; -const AVCodecDescriptor *codec_desc; AVRational framerate_guessed; diff --git a/fftools/ffmpeg_demux.c b/fftools/ffmpeg_demux.c index 03c8bb44e6..87f84fdccf 100644 --- a/fftools/ffmpeg_demux.c +++ b/fftools/ffmpeg_demux.c @@ -83,6 +83,8 @@ typedef struct DemuxStream { ///< dts of the last packet read for this stream (in AV_TIME_BASE units) int64_t dts; +const AVCodecDescriptor *codec_desc; + /* number of packets successfully read for this stream */ uint64_t nb_packets; // combined size of all the packets read @@ -320,8 +322,8 @@ static int ist_dts_update(DemuxStream *ds, AVPacket *pkt, FrameData *fd) (AVRational){ 2, 1 }); int fields = 2; -if (ist->codec_desc && -(ist->codec_desc->props & AV_CODEC_PROP_FIELDS) && +if (ds->codec_desc && +(ds->codec_desc->props & AV_CODEC_PROP_FIELDS) && av_stream_get_parser(ist->st)) fields = 1 + av_stream_get_parser(ist->st)->repeat_pict; @@ -1249,7 +1251,7 @@ static int ist_add(const OptionsContext *o, Demuxer *d, AVStream *st) return ret; } -ist->codec_desc = avcodec_descriptor_get(ist->par->codec_id); +ds->codec_desc = avcodec_descriptor_get(ist->par->codec_id); return 0; } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] fftools/ffmpeg_mux: move OutputStream.sq_idx_mux to private data
ffmpeg | branch: master | Anton Khirnov | Wed Dec 13 19:33:27 2023 +0100| [0d01e61807b3da3113aa29bf79c4769988f1f41c] | committer: Anton Khirnov fftools/ffmpeg_mux: move OutputStream.sq_idx_mux to private data It should not be accessed outside of ffmpeg_mux* > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=0d01e61807b3da3113aa29bf79c4769988f1f41c --- fftools/ffmpeg.h | 2 -- fftools/ffmpeg_mux.c | 12 ++-- fftools/ffmpeg_mux.h | 2 ++ fftools/ffmpeg_mux_init.c | 12 ++-- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h index c992396316..9d4be4f4ff 100644 --- a/fftools/ffmpeg.h +++ b/fftools/ffmpeg.h @@ -591,8 +591,6 @@ typedef struct OutputStream { /* packet quality factor */ atomic_int quality; -int sq_idx_mux; - EncStats enc_stats_pre; EncStats enc_stats_post; diff --git a/fftools/ffmpeg_mux.c b/fftools/ffmpeg_mux.c index c7d5530cba..09e4056371 100644 --- a/fftools/ffmpeg_mux.c +++ b/fftools/ffmpeg_mux.c @@ -236,12 +236,12 @@ fail: return ret; } -static int sync_queue_process(Muxer *mux, OutputStream *ost, AVPacket *pkt, int *stream_eof) +static int sync_queue_process(Muxer *mux, MuxStream *ms, AVPacket *pkt, int *stream_eof) { OutputFile *of = &mux->of; -if (ost->sq_idx_mux >= 0) { -int ret = sq_send(mux->sq_mux, ost->sq_idx_mux, SQPKT(pkt)); +if (ms->sq_idx_mux >= 0) { +int ret = sq_send(mux->sq_mux, ms->sq_idx_mux, SQPKT(pkt)); if (ret < 0) { if (ret == AVERROR_EOF) *stream_eof = 1; @@ -266,7 +266,7 @@ static int sync_queue_process(Muxer *mux, OutputStream *ost, AVPacket *pkt, int return ret; } } else if (pkt) -return write_packet(mux, ost, pkt); +return write_packet(mux, &ms->ost, pkt); return 0; } @@ -336,14 +336,14 @@ static int mux_packet_filter(Muxer *mux, MuxThreadContext *mt, if (!bsf_eof) ms->bsf_pkt->time_base = ms->bsf_ctx->time_base_out; -ret = sync_queue_process(mux, ost, bsf_eof ? NULL : ms->bsf_pkt, stream_eof); +ret = sync_queue_process(mux, ms, bsf_eof ? NULL : ms->bsf_pkt, stream_eof); if (ret < 0) goto mux_fail; } *stream_eof = 1; return AVERROR_EOF; } else { -ret = sync_queue_process(mux, ost, pkt, stream_eof); +ret = sync_queue_process(mux, ms, pkt, stream_eof); if (ret < 0) goto mux_fail; } diff --git a/fftools/ffmpeg_mux.h b/fftools/ffmpeg_mux.h index 5d7cf3fa76..d0be8a51ea 100644 --- a/fftools/ffmpeg_mux.h +++ b/fftools/ffmpeg_mux.h @@ -50,6 +50,8 @@ typedef struct MuxStream { int sch_idx_enc; int sch_idx_src; +int sq_idx_mux; + int64_t max_frames; // timestamp from which the streamcopied streams should start, diff --git a/fftools/ffmpeg_mux_init.c b/fftools/ffmpeg_mux_init.c index 455876d456..f527a083db 100644 --- a/fftools/ffmpeg_mux_init.c +++ b/fftools/ffmpeg_mux_init.c @@ -1923,7 +1923,7 @@ static int setup_sync_queues(Muxer *mux, AVFormatContext *oc, int64_t buf_size_u MuxStream *ms = ms_from_ost(ost); enum AVMediaType type = ost->type; -ost->sq_idx_mux= -1; +ms->sq_idx_mux = -1; nb_interleaved += IS_INTERLEAVED(type); nb_av_enc += IS_AV_ENC(ost, type); @@ -1992,13 +1992,13 @@ static int setup_sync_queues(Muxer *mux, AVFormatContext *oc, int64_t buf_size_u if (!IS_INTERLEAVED(type)) continue; -ost->sq_idx_mux = sq_add_stream(mux->sq_mux, -of->shortest || ms->max_frames < INT64_MAX); -if (ost->sq_idx_mux < 0) -return ost->sq_idx_mux; +ms->sq_idx_mux = sq_add_stream(mux->sq_mux, + of->shortest || ms->max_frames < INT64_MAX); +if (ms->sq_idx_mux < 0) +return ms->sq_idx_mux; if (ms->max_frames != INT64_MAX) -sq_limit_frames(mux->sq_mux, ost->sq_idx_mux, ms->max_frames); +sq_limit_frames(mux->sq_mux, ms->sq_idx_mux, ms->max_frames); } } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] fftools/ffmpeg_demux: move InputFile.readrate to private data
ffmpeg | branch: master | Anton Khirnov | Wed Dec 13 19:27:52 2023 +0100| [2c540976143b35435efe44d3f972214e456edf7a] | committer: Anton Khirnov fftools/ffmpeg_demux: move InputFile.readrate to private data It is not used outside of ffmpeg_demux. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=2c540976143b35435efe44d3f972214e456edf7a --- fftools/ffmpeg.h | 1 - fftools/ffmpeg_demux.c | 19 ++- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h index 03599cdad8..c992396316 100644 --- a/fftools/ffmpeg.h +++ b/fftools/ffmpeg.h @@ -428,7 +428,6 @@ typedef struct InputFile { InputStream **streams; intnb_streams; -float readrate; int accurate_seek; } InputFile; diff --git a/fftools/ffmpeg_demux.c b/fftools/ffmpeg_demux.c index 87f84fdccf..eca3de709c 100644 --- a/fftools/ffmpeg_demux.c +++ b/fftools/ffmpeg_demux.c @@ -117,6 +117,7 @@ typedef struct Demuxer { /* number of streams that the user was warned of */ int nb_streams_warn; +float readrate; double readrate_initial_burst; Scheduler*sch; @@ -488,7 +489,7 @@ static void readrate_sleep(Demuxer *d) int64_t stream_ts_offset, pts, now; stream_ts_offset = FFMAX(ds->first_dts != AV_NOPTS_VALUE ? ds->first_dts : 0, file_start); pts = av_rescale(ds->dts, 100, AV_TIME_BASE); -now = (av_gettime_relative() - d->wallclock_start) * f->readrate + stream_ts_offset; +now = (av_gettime_relative() - d->wallclock_start) * d->readrate + stream_ts_offset; if (pts - burst_until > now) av_usleep(pts - burst_until - now); } @@ -664,7 +665,7 @@ static void *input_thread(void *arg) if (ret < 0) break; -if (f->readrate) +if (d->readrate) readrate_sleep(d); ret = demux_send(d, ds, pkt, send_flags); @@ -1579,19 +1580,19 @@ int ifile_open(const OptionsContext *o, const char *filename, Scheduler *sch) f->format_nots = !!(ic->iformat->flags & AVFMT_NOTIMESTAMPS); -f->readrate = o->readrate ? o->readrate : 0.0; -if (f->readrate < 0.0f) { -av_log(d, AV_LOG_ERROR, "Option -readrate is %0.3f; it must be non-negative.\n", f->readrate); +d->readrate = o->readrate ? o->readrate : 0.0; +if (d->readrate < 0.0f) { +av_log(d, AV_LOG_ERROR, "Option -readrate is %0.3f; it must be non-negative.\n", d->readrate); return AVERROR(EINVAL); } if (o->rate_emu) { -if (f->readrate) { -av_log(d, AV_LOG_WARNING, "Both -readrate and -re set. Using -readrate %0.3f.\n", f->readrate); +if (d->readrate) { +av_log(d, AV_LOG_WARNING, "Both -readrate and -re set. Using -readrate %0.3f.\n", d->readrate); } else -f->readrate = 1.0f; +d->readrate = 1.0f; } -if (f->readrate) { +if (d->readrate) { d->readrate_initial_burst = o->readrate_initial_burst ? o->readrate_initial_burst : 0.5; if (d->readrate_initial_burst < 0.0) { av_log(d, AV_LOG_ERROR, ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] fftools/ffmpeg_sched: move trailing_dts() higher up
ffmpeg | branch: master | Anton Khirnov | Wed Dec 13 20:07:13 2023 +0100| [98d706b8185432294617ca5b1024ea73bc248607] | committer: Anton Khirnov fftools/ffmpeg_sched: move trailing_dts() higher up Will be useful in following commit. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=98d706b8185432294617ca5b1024ea73bc248607 --- fftools/ffmpeg_sched.c | 44 ++-- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/fftools/ffmpeg_sched.c b/fftools/ffmpeg_sched.c index 20063fe47e..f17d5768c3 100644 --- a/fftools/ffmpeg_sched.c +++ b/fftools/ffmpeg_sched.c @@ -423,6 +423,28 @@ static void task_init(Scheduler *sch, SchTask *task, enum SchedulerNodeType type task->func_arg = func_arg; } +static int64_t trailing_dts(const Scheduler *sch) +{ +int64_t min_dts = INT64_MAX; + +for (unsigned i = 0; i < sch->nb_mux; i++) { +const SchMux *mux = &sch->mux[i]; + +for (unsigned j = 0; j < mux->nb_streams; j++) { +const SchMuxStream *ms = &mux->streams[j]; + +if (ms->source_finished) +continue; +if (ms->last_dts == AV_NOPTS_VALUE) +return AV_NOPTS_VALUE; + +min_dts = FFMIN(min_dts, ms->last_dts); +} +} + +return min_dts == INT64_MAX ? AV_NOPTS_VALUE : min_dts; +} + int sch_stop(Scheduler *sch) { int ret = 0, err; @@ -1168,28 +1190,6 @@ int sch_mux_sub_heartbeat_add(Scheduler *sch, unsigned mux_idx, unsigned stream_ return 0; } -static int64_t trailing_dts(const Scheduler *sch) -{ -int64_t min_dts = INT64_MAX; - -for (unsigned i = 0; i < sch->nb_mux; i++) { -const SchMux *mux = &sch->mux[i]; - -for (unsigned j = 0; j < mux->nb_streams; j++) { -const SchMuxStream *ms = &mux->streams[j]; - -if (ms->source_finished) -continue; -if (ms->last_dts == AV_NOPTS_VALUE) -return AV_NOPTS_VALUE; - -min_dts = FFMIN(min_dts, ms->last_dts); -} -} - -return min_dts == INT64_MAX ? AV_NOPTS_VALUE : min_dts; -} - static void schedule_update_locked(Scheduler *sch) { int64_t dts; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] fftools/ffmpeg: drop unused InputFile.eof_reached
ffmpeg | branch: master | Anton Khirnov | Wed Dec 13 19:25:46 2023 +0100| [116bc5a9f3d1cddf3e9b6ec1bd70b7451817bb72] | committer: Anton Khirnov fftools/ffmpeg: drop unused InputFile.eof_reached > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=116bc5a9f3d1cddf3e9b6ec1bd70b7451817bb72 --- fftools/ffmpeg.h | 1 - 1 file changed, 1 deletion(-) diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h index b10a2f2c0d..03599cdad8 100644 --- a/fftools/ffmpeg.h +++ b/fftools/ffmpeg.h @@ -412,7 +412,6 @@ typedef struct InputFile { int format_nots; AVFormatContext *ctx; -int eof_reached; /* true if eof reached */ int64_t input_ts_offset; int input_sync_ref; /** ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] fftools/ffmpeg: drop OutputFile.sq_encode
ffmpeg | branch: master | Anton Khirnov | Wed Dec 13 19:36:29 2023 +0100| [4549f202227bf9bd8c5db1153d16e7098f1d44fa] | committer: Anton Khirnov fftools/ffmpeg: drop OutputFile.sq_encode It is unused since d119ae2fd82a494d9430ff4d4fc262961a68c598 > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=4549f202227bf9bd8c5db1153d16e7098f1d44fa --- fftools/ffmpeg.h | 2 -- fftools/ffmpeg_mux.c | 1 - 2 files changed, 3 deletions(-) diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h index 9d4be4f4ff..affa80856a 100644 --- a/fftools/ffmpeg.h +++ b/fftools/ffmpeg.h @@ -612,8 +612,6 @@ typedef struct OutputFile { OutputStream **streams; int nb_streams; -SyncQueue *sq_encode; - int64_t recording_time; ///< desired length of the resulting file in microseconds == AV_TIME_BASE units int64_t start_time; ///< start time in microseconds == AV_TIME_BASE units diff --git a/fftools/ffmpeg_mux.c b/fftools/ffmpeg_mux.c index 09e4056371..8e523dd49d 100644 --- a/fftools/ffmpeg_mux.c +++ b/fftools/ffmpeg_mux.c @@ -845,7 +845,6 @@ void of_free(OutputFile **pof) return; mux = mux_from_of(of); -sq_free(&of->sq_encode); sq_free(&mux->sq_mux); for (int i = 0; i < of->nb_streams; i++) ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] fftools/ffmpeg: update the reported timestamp at the end
ffmpeg | branch: master | Anton Khirnov | Wed Dec 13 20:10:38 2023 +0100| [2305091a3a7b3b48a044b975880a6375de4baecc] | committer: Anton Khirnov fftools/ffmpeg: update the reported timestamp at the end Reported-by: microchip > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=2305091a3a7b3b48a044b975880a6375de4baecc --- fftools/ffmpeg.c | 2 +- fftools/ffmpeg_sched.c | 13 - fftools/ffmpeg_sched.h | 2 +- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c index 1b2a15750b..53df200d1a 100644 --- a/fftools/ffmpeg.c +++ b/fftools/ffmpeg.c @@ -941,7 +941,7 @@ static int transcode(Scheduler *sch) print_report(0, timer_start, cur_time, transcode_ts); } -ret = sch_stop(sch); +ret = sch_stop(sch, &transcode_ts); /* write the trailer if needed */ for (i = 0; i < nb_output_files; i++) { diff --git a/fftools/ffmpeg_sched.c b/fftools/ffmpeg_sched.c index f17d5768c3..ca440035e2 100644 --- a/fftools/ffmpeg_sched.c +++ b/fftools/ffmpeg_sched.c @@ -423,7 +423,7 @@ static void task_init(Scheduler *sch, SchTask *task, enum SchedulerNodeType type task->func_arg = func_arg; } -static int64_t trailing_dts(const Scheduler *sch) +static int64_t trailing_dts(const Scheduler *sch, int count_finished) { int64_t min_dts = INT64_MAX; @@ -433,7 +433,7 @@ static int64_t trailing_dts(const Scheduler *sch) for (unsigned j = 0; j < mux->nb_streams; j++) { const SchMuxStream *ms = &mux->streams[j]; -if (ms->source_finished) +if (ms->source_finished && !count_finished) continue; if (ms->last_dts == AV_NOPTS_VALUE) return AV_NOPTS_VALUE; @@ -445,7 +445,7 @@ static int64_t trailing_dts(const Scheduler *sch) return min_dts == INT64_MAX ? AV_NOPTS_VALUE : min_dts; } -int sch_stop(Scheduler *sch) +int sch_stop(Scheduler *sch, int64_t *finish_ts) { int ret = 0, err; @@ -492,6 +492,9 @@ int sch_stop(Scheduler *sch) ret = err_merge(ret, err); } +if (finish_ts) +*finish_ts = trailing_dts(sch, 1); + return ret; } @@ -502,7 +505,7 @@ void sch_free(Scheduler **psch) if (!sch) return; -sch_stop(sch); +sch_stop(sch, NULL); for (unsigned i = 0; i < sch->nb_demux; i++) { SchDemux *d = &sch->demux[i]; @@ -1200,7 +1203,7 @@ static void schedule_update_locked(Scheduler *sch) if (atomic_load(&sch->terminate)) return; -dts = trailing_dts(sch); +dts = trailing_dts(sch, 0); atomic_store(&sch->last_dts, dts); diff --git a/fftools/ffmpeg_sched.h b/fftools/ffmpeg_sched.h index 94bbd30e98..b167d8d158 100644 --- a/fftools/ffmpeg_sched.h +++ b/fftools/ffmpeg_sched.h @@ -127,7 +127,7 @@ Scheduler *sch_alloc(void); void sch_free(Scheduler **sch); int sch_start(Scheduler *sch); -int sch_stop(Scheduler *sch); +int sch_stop(Scheduler *sch, int64_t *finish_ts); /** * Wait until transcoding terminates or the specified timeout elapses. ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] fftools/ffmpeg_sched: track dts+duration as last_dts
ffmpeg | branch: master | Anton Khirnov | Wed Dec 13 20:22:00 2023 +0100| [5c5140ded2c1bb74c79bed68f2c8d1b091d3e39b] | committer: Anton Khirnov fftools/ffmpeg_sched: track dts+duration as last_dts This should be slightly (probably negligibly) more accurate for scheduling, but mainly it improves the final reported time. Reported-by: Paul B Mahol > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=5c5140ded2c1bb74c79bed68f2c8d1b091d3e39b --- fftools/ffmpeg_sched.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/fftools/ffmpeg_sched.c b/fftools/ffmpeg_sched.c index ca440035e2..4fc5a33941 100644 --- a/fftools/ffmpeg_sched.c +++ b/fftools/ffmpeg_sched.c @@ -192,7 +192,7 @@ typedef struct SchMuxStream { // The following are protected by Scheduler.schedule_lock // -/* dts of the last packet sent to this stream +/* dts+duration of the last packet sent to this stream in AV_TIME_BASE_Q */ int64_t last_dts; // this stream no longer accepts input @@ -1625,8 +1625,8 @@ static int send_to_mux(Scheduler *sch, SchMux *mux, unsigned stream_idx, AVPacket *pkt) { SchMuxStream *ms = &mux->streams[stream_idx]; -int64_t dts = (pkt && pkt->dts != AV_NOPTS_VALUE)? - av_rescale_q(pkt->dts, pkt->time_base, AV_TIME_BASE_Q) : +int64_t dts = (pkt && pkt->dts != AV_NOPTS_VALUE) ? + av_rescale_q(pkt->dts + pkt->duration, pkt->time_base, AV_TIME_BASE_Q) : AV_NOPTS_VALUE; // queue the packet if the muxer cannot be started yet ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] tests/fate: add pixelize filter tests
ffmpeg | branch: master | Paul B Mahol | Wed Dec 6 11:18:35 2023 +0100| [bc45a9c6de523d964858e3101f33902e8423a361] | committer: Michael Niedermayer tests/fate: add pixelize filter tests Signed-off-by: Paul B Mahol Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=bc45a9c6de523d964858e3101f33902e8423a361 --- tests/fate/filter-video.mak| 9 + tests/ref/fate/filter-pixelize-avg | 1 + tests/ref/fate/filter-pixelize-max | 1 + tests/ref/fate/filter-pixelize-min | 1 + 4 files changed, 12 insertions(+) diff --git a/tests/fate/filter-video.mak b/tests/fate/filter-video.mak index 95b199a106..b57ef88c9b 100644 --- a/tests/fate/filter-video.mak +++ b/tests/fate/filter-video.mak @@ -535,6 +535,15 @@ fate-filter-thumbnail: CMD = video_filter "scale,thumbnail=10" FATE_FILTER_VSYNTH_VIDEO_FILTER-$(CONFIG_TILE_FILTER) += fate-filter-tile fate-filter-tile: CMD = video_filter "tile=3x3:nb_frames=5:padding=7:margin=2" +FATE_FILTER_VSYNTH_VIDEO_FILTER-$(CONFIG_PIXELIZE_FILTER) += fate-filter-pixelize-avg +fate-filter-pixelize-avg: CMD = video_filter "pixelize=mode=avg" + +FATE_FILTER_VSYNTH_VIDEO_FILTER-$(CONFIG_PIXELIZE_FILTER) += fate-filter-pixelize-min +fate-filter-pixelize-min: CMD = video_filter "pixelize=mode=min" + +FATE_FILTER_VSYNTH_VIDEO_FILTER-$(CONFIG_PIXELIZE_FILTER) += fate-filter-pixelize-max +fate-filter-pixelize-max: CMD = video_filter "pixelize=mode=max" + tests/pixfmts.mak: TAG = GEN tests/pixfmts.mak: ffmpeg$(PROGSSUF)$(EXESUF) | tests diff --git a/tests/ref/fate/filter-pixelize-avg b/tests/ref/fate/filter-pixelize-avg new file mode 100644 index 00..42bbbf9cd0 --- /dev/null +++ b/tests/ref/fate/filter-pixelize-avg @@ -0,0 +1 @@ +pixelize-avgdf03e58c3756dd4ecef6b6f50709c23e diff --git a/tests/ref/fate/filter-pixelize-max b/tests/ref/fate/filter-pixelize-max new file mode 100644 index 00..6746114802 --- /dev/null +++ b/tests/ref/fate/filter-pixelize-max @@ -0,0 +1 @@ +pixelize-maxdb60eb984b9aec61f3ee16ed798eca34 diff --git a/tests/ref/fate/filter-pixelize-min b/tests/ref/fate/filter-pixelize-min new file mode 100644 index 00..1014ac8a46 --- /dev/null +++ b/tests/ref/fate/filter-pixelize-min @@ -0,0 +1 @@ +pixelize-min3eacb4349fb19d11f4f96c19a1bdbbfa ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] tools/target_dec_fuzzer: Adjust threshold for VMIX
ffmpeg | branch: master | Michael Niedermayer | Sat Sep 23 01:27:14 2023 +0200| [aa1e7681203694c6e2b38e2a627ff90eb3524d37] | committer: Michael Niedermayer tools/target_dec_fuzzer: Adjust threshold for VMIX Fixes: Timeout Fixes: 62286/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VMIX_fuzzer-5155237134204928 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=aa1e7681203694c6e2b38e2a627ff90eb3524d37 --- tools/target_dec_fuzzer.c | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/target_dec_fuzzer.c b/tools/target_dec_fuzzer.c index 27e7398089..62085cf080 100644 --- a/tools/target_dec_fuzzer.c +++ b/tools/target_dec_fuzzer.c @@ -298,6 +298,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { case AV_CODEC_ID_VC1IMAGE:maxpixels /= 8192; break; case AV_CODEC_ID_VMNC:maxpixels /= 8192; break; case AV_CODEC_ID_VMDVIDEO:maxpixels /= 1024; break; +case AV_CODEC_ID_VMIX:maxpixels /= 8192; break; case AV_CODEC_ID_VP3: maxpixels /= 4096; break; case AV_CODEC_ID_VP4: maxpixels /= 4096; break; case AV_CODEC_ID_VP5: maxpixels /= 256; break; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] tests/fate: add median filter test
ffmpeg | branch: master | Paul B Mahol | Wed Dec 6 12:17:54 2023 +0100| [41ee95dc521350cec978024becd8564b6de86975] | committer: Michael Niedermayer tests/fate: add median filter test Signed-off-by: Paul B Mahol Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=41ee95dc521350cec978024becd8564b6de86975 --- tests/fate/filter-video.mak | 3 +++ tests/ref/fate/filter-median | 1 + 2 files changed, 4 insertions(+) diff --git a/tests/fate/filter-video.mak b/tests/fate/filter-video.mak index e4bdf59db9..95b199a106 100644 --- a/tests/fate/filter-video.mak +++ b/tests/fate/filter-video.mak @@ -456,6 +456,9 @@ FATE_FILTER_VSYNTH_VIDEO_FILTER-$(call ALLYES, SCALE_FILTER FORMAT_FILTER PERMS_ fate-filter-edgedetect: CMD = video_filter "scale,format=gray,perms=random,edgedetect" -frames:v 20 fate-filter-edgedetect-colormix: CMD = video_filter "scale,format=gbrp,perms=random,edgedetect=mode=colormix" -frames:v 20 +FATE_FILTER_VSYNTH_VIDEO_FILTER-$(CONFIG_MEDIAN_FILTER) += fate-filter-median +fate-filter-median: CMD = video_filter "median=radius=5" + FATE_FILTER_VSYNTH_VIDEO_FILTER-$(call ALLYES, PERMS_FILTER HUE_FILTER) += fate-filter-hue1 fate-filter-hue2 fate-filter-hue3 fate-filter-hue1: CMD = video_filter "perms=random,hue=s=sin(2*PI*t)+1" -frames:v 20 fate-filter-hue2: CMD = video_filter "perms=random,hue=h=18*n" -frames:v 20 diff --git a/tests/ref/fate/filter-median b/tests/ref/fate/filter-median new file mode 100644 index 00..22dfaba576 --- /dev/null +++ b/tests/ref/fate/filter-median @@ -0,0 +1 @@ +median 8754a3715917ff8b20ff520c4bb4370c ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avcodec/jpeg2000htdec: check if block decoding will exceed internal precision
ffmpeg | branch: master | Pierre-Anthony Lemieux | Sat Aug 12 13:31:16 2023 -0700| [a1384b4e869483cf69230f02ca31c892729bca08] | committer: Michael Niedermayer avcodec/jpeg2000htdec: check if block decoding will exceed internal precision Intended to replace https://patchwork.ffmpeg.org/project/ffmpeg/patch/20230802000135.26482-3-mich...@niedermayer.cc/ with a more accurate block decoding magnitude bound. Fixes: 62433/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_JPEG2000_fuzzer-5828618092937216 Fixes: 58299/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_JPEG2000_fuzzer-5828618092937216 Previous-version-reviewed-by: Tomas Härdin Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a1384b4e869483cf69230f02ca31c892729bca08 --- libavcodec/jpeg2000htdec.c | 42 -- 1 file changed, 36 insertions(+), 6 deletions(-) diff --git a/libavcodec/jpeg2000htdec.c b/libavcodec/jpeg2000htdec.c index 2c4cea5dd9..6b9898d3ff 100644 --- a/libavcodec/jpeg2000htdec.c +++ b/libavcodec/jpeg2000htdec.c @@ -567,11 +567,19 @@ static int jpeg2000_decode_ht_cleanup_segment(const Jpeg2000DecoderContext *s, uint64_t c; -uint8_t *sigma; -uint32_t *mu; +uint8_t *sigma, *sigma_n, *E; +uint32_t *mu, *mu_n; const uint8_t *vlc_buf = Dcup + Pcup; +/* + * Bound on the precision needed to process the codeblock. The number of + * decoded bit planes is equal to at most cblk->zbp + 2 since S_blk = P if + * there are no placeholder passes or HT Sets and P = cblk->zbp. See Rec. + * ITU-T T.814, 7.6. + */ +int maxbp = cblk->zbp + 2; + /* convert to raster-scan */ const uint16_t is_border_x = width % 2; const uint16_t is_border_y = height % 2; @@ -581,9 +589,13 @@ static int jpeg2000_decode_ht_cleanup_segment(const Jpeg2000DecoderContext *s, size_t buf_size = 4 * quad_width * quad_height; -uint8_t *sigma_n = av_calloc(buf_size, sizeof(uint8_t)); -uint8_t *E = av_calloc(buf_size, sizeof(uint8_t)); -uint32_t *mu_n = av_calloc(buf_size, sizeof(uint32_t)); +/* do we have enough precision, assuming a 32-bit decoding path */ +if (maxbp >= 32) +return AVERROR_INVALIDDATA; + +sigma_n = av_calloc(buf_size, sizeof(uint8_t)); +E = av_calloc(buf_size, sizeof(uint8_t)); +mu_n= av_calloc(buf_size, sizeof(uint32_t)); if (!sigma_n || !E || !mu_n) { ret = AVERROR(ENOMEM); @@ -676,6 +688,10 @@ static int jpeg2000_decode_ht_cleanup_segment(const Jpeg2000DecoderContext *s, } U[J2K_Q1] = kappa[J2K_Q1] + u[J2K_Q1]; U[J2K_Q2] = kappa[J2K_Q2] + u[J2K_Q2]; +if (U[J2K_Q1] > maxbp || U[J2K_Q2] > maxbp) { +ret = AVERROR_INVALIDDATA; +goto free; +} for (int i = 0; i < 4; i++) { m[J2K_Q1][i] = sigma_n[4 * q1 + i] * U[J2K_Q1] - ((emb_pat_k[J2K_Q1] >> i) & 1); @@ -713,6 +729,10 @@ static int jpeg2000_decode_ht_cleanup_segment(const Jpeg2000DecoderContext *s, } U[J2K_Q1] = kappa[J2K_Q1] + u[J2K_Q1]; +if (U[J2K_Q1] > maxbp) { +ret = AVERROR_INVALIDDATA; +goto free; +} for (int i = 0; i < 4; i++) m[J2K_Q1][i] = sigma_n[4 * q1 + i] * U[J2K_Q1] - ((emb_pat_k[J2K_Q1] >> i) & 1); @@ -842,6 +862,10 @@ static int jpeg2000_decode_ht_cleanup_segment(const Jpeg2000DecoderContext *s, U[J2K_Q1] = kappa[J2K_Q1] + u[J2K_Q1]; U[J2K_Q2] = kappa[J2K_Q2] + u[J2K_Q2]; +if (U[J2K_Q1] > maxbp || U[J2K_Q2] > maxbp) { +ret = AVERROR_INVALIDDATA; +goto free; +} for (int i = 0; i < 4; i++) { m[J2K_Q1][i] = sigma_n[4 * q1 + i] * U[J2K_Q1] - ((emb_pat_k[J2K_Q1] >> i) & 1); @@ -910,6 +934,10 @@ static int jpeg2000_decode_ht_cleanup_segment(const Jpeg2000DecoderContext *s, kappa[J2K_Q1] = FFMAX(1, gamma[J2K_Q1] * (max_e[J2K_Q1] - 1)); U[J2K_Q1] = kappa[J2K_Q1] + u[J2K_Q1]; +if (U[J2K_Q1] > maxbp) { +ret = AVERROR_INVALIDDATA; +goto free; +} for (int i = 0; i < 4; i++) m[J2K_Q1][i] = sigma_n[4 * q1 + i] * U[J2K_Q1] - ((emb_pat_k[J2K_Q1] >> i) & 1); @@ -1238,8 +1266,10 @@ ff_jpeg2000_decode_htj2k(const Jpeg2000DecoderContext *s, Jpeg2000CodingStyle *c } if ((ret = jpeg2000_decode_ht_cleanup_segment(s, cblk, t1, &mel_state, &mel, &vlc, &mag_sgn, Dcup, Lcup, Pcup, pLSB, width, - height, sample_buf, block_states)) < 0) + height, sample_buf, block_states)) < 0) { +av_log(s->avctx, AV_LOG_ERROR, "Bad HT cleanup segment\n"); goto free; +} if (cblk->npasses > 1) jpeg2000_decode_sigprop
[FFmpeg-cvslog] avcodec/cbs_h266: more restrictive check on pps_tile_idx_delta_val
ffmpeg | branch: master | Nuo Mi | Sun Oct 22 11:04:35 2023 +0800| [ce0c178a408d43e71085c28a47d50dc939b60196] | committer: Michael Niedermayer avcodec/cbs_h266: more restrictive check on pps_tile_idx_delta_val Fixes: out of array access Fixes: 62603/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5837632490569728 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=ce0c178a408d43e71085c28a47d50dc939b60196 --- libavcodec/cbs_h266_syntax_template.c | 7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/libavcodec/cbs_h266_syntax_template.c b/libavcodec/cbs_h266_syntax_template.c index dd884ad449..549d021211 100644 --- a/libavcodec/cbs_h266_syntax_template.c +++ b/libavcodec/cbs_h266_syntax_template.c @@ -2043,9 +2043,12 @@ static int FUNC(pps) (CodedBitstreamContext *ctx, RWContext *rw, } if (i < current->pps_num_slices_in_pic_minus1) { if (current->pps_tile_idx_delta_present_flag) { +// Two conditions must be met: +// 1. −NumTilesInPic + 1 <= pps_tile_idx_delta_val[i] <= NumTilesInPic − 1 +// 2. 0 <= tile_idx + pps_tile_idx_delta_val[i] <= NumTilesInPic − 1 +// Combining these conditions yields: -tile_idx <= pps_tile_idx_delta_val[i] <= NumTilesInPic - 1 - tile_idx ses(pps_tile_idx_delta_val[i], --current->num_tiles_in_pic + 1, -current->num_tiles_in_pic - 1, 1, i); +-tile_idx, current->num_tiles_in_pic - 1 - tile_idx, 1, i); if (current->pps_tile_idx_delta_val[i] == 0) { av_log(ctx->log_ctx, AV_LOG_ERROR, "pps_tile_idx_delta_val[i] shall not be equal to 0.\n"); ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".