[FFmpeg-cvslog] avformat/gopher: Add default_whitelist to ff_gopher_protocol
ffmpeg | branch: master | parazyd | Sun Feb 28 23:47:03 2021 +0100| [ed4c2e183bc61414abb421b2bf19ac44e436da06] | committer: Marton Balint avformat/gopher: Add default_whitelist to ff_gopher_protocol Signed-off-by: parazyd Signed-off-by: Marton Balint > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=ed4c2e183bc61414abb421b2bf19ac44e436da06 --- configure| 2 +- libavformat/gopher.c | 16 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/configure b/configure index d11942fced..1c0888ffa6 100755 --- a/configure +++ b/configure @@ -3449,7 +3449,7 @@ ffrtmpcrypt_protocol_select="tcp_protocol" ffrtmphttp_protocol_conflict="librtmp_protocol" ffrtmphttp_protocol_select="http_protocol" ftp_protocol_select="tcp_protocol" -gopher_protocol_select="network" +gopher_protocol_select="tcp_protocol" http_protocol_select="tcp_protocol" http_protocol_suggest="zlib" httpproxy_protocol_select="tcp_protocol" diff --git a/libavformat/gopher.c b/libavformat/gopher.c index 8b6d14a1f7..7c88ab01a8 100644 --- a/libavformat/gopher.c +++ b/libavformat/gopher.c @@ -110,13 +110,13 @@ static int gopher_read(URLContext *h, uint8_t *buf, int size) return len; } - const URLProtocol ff_gopher_protocol = { -.name = "gopher", -.url_open = gopher_open, -.url_read = gopher_read, -.url_write = gopher_write, -.url_close = gopher_close, -.priv_data_size = sizeof(GopherContext), -.flags = URL_PROTOCOL_FLAG_NETWORK, +.name = "gopher", +.url_open = gopher_open, +.url_read = gopher_read, +.url_write = gopher_write, +.url_close = gopher_close, +.priv_data_size= sizeof(GopherContext), +.flags = URL_PROTOCOL_FLAG_NETWORK, +.default_whitelist = "gopher,tcp" }; ___ 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] avformat/gopher: Add support for Gopher over TLS
ffmpeg | branch: master | parazyd | Sun Feb 28 23:47:05 2021 +0100| [51367267c8a9f1a840f5e810f8c788e6e03712a5] | committer: Marton Balint avformat/gopher: Add support for Gopher over TLS This commit adds a "gophers" handler to the gopher protocol. gophers is a community-adopted protocol that acts the same way like normal gopher with the added TLS encapsulation. The gophers protocol is supported by gopher servers like geomydae(8), and clients like curl(1), clic(1), and hurl(1). This commit also adds compilation guards to both gopher and gophers, since now there are two protocols in the file it makes sense to have this addition. Signed-off-by: parazyd Signed-off-by: Marton Balint > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=51367267c8a9f1a840f5e810f8c788e6e03712a5 --- Changelog | 1 + configure | 1 + doc/general_contents.texi | 1 + doc/protocols.texi| 6 ++ libavformat/Makefile | 1 + libavformat/gopher.c | 30 ++ libavformat/protocols.c | 1 + libavformat/version.h | 2 +- 8 files changed, 38 insertions(+), 5 deletions(-) diff --git a/Changelog b/Changelog index b28a8c59f1..73deaf6b0f 100644 --- a/Changelog +++ b/Changelog @@ -81,6 +81,7 @@ version : - TTML subtitle encoder and muxer - identity video filter - msad video filter +- gophers protocol version 4.3: diff --git a/configure b/configure index 1c0888ffa6..13f8e0580b 100755 --- a/configure +++ b/configure @@ -3450,6 +3450,7 @@ ffrtmphttp_protocol_conflict="librtmp_protocol" ffrtmphttp_protocol_select="http_protocol" ftp_protocol_select="tcp_protocol" gopher_protocol_select="tcp_protocol" +gophers_protocol_select="tls_protocol" http_protocol_select="tcp_protocol" http_protocol_suggest="zlib" httpproxy_protocol_select="tcp_protocol" diff --git a/doc/general_contents.texi b/doc/general_contents.texi index 58c9bcf747..33ece6e884 100644 --- a/doc/general_contents.texi +++ b/doc/general_contents.texi @@ -1371,6 +1371,7 @@ performance on systems without hardware floating point support). @item file @tab X @item FTP @tab X @item Gopher @tab X +@item Gophers @tab X @item HLS @tab X @item HTTP @tab X @item HTTPS@tab X diff --git a/doc/protocols.texi b/doc/protocols.texi index c0b511b7a4..2b2fab8752 100644 --- a/doc/protocols.texi +++ b/doc/protocols.texi @@ -341,6 +341,12 @@ operation. ff* tools may produce incomplete content due to server limitations. Gopher protocol. +@section gophers + +Gophers protocol. + +The Gopher protocol with TLS encapsulation. + @section hls Read Apple HTTP Live Streaming compliant segmented stream as diff --git a/libavformat/Makefile b/libavformat/Makefile index 0504f47f88..8ce53d5a8c 100644 --- a/libavformat/Makefile +++ b/libavformat/Makefile @@ -621,6 +621,7 @@ OBJS-$(CONFIG_FFRTMPHTTP_PROTOCOL) += rtmphttp.o OBJS-$(CONFIG_FILE_PROTOCOL) += file.o OBJS-$(CONFIG_FTP_PROTOCOL) += ftp.o urldecode.o OBJS-$(CONFIG_GOPHER_PROTOCOL) += gopher.o +OBJS-$(CONFIG_GOPHERS_PROTOCOL) += gopher.o OBJS-$(CONFIG_HLS_PROTOCOL) += hlsproto.o OBJS-$(CONFIG_HTTP_PROTOCOL) += http.o httpauth.o urldecode.o OBJS-$(CONFIG_HTTPPROXY_PROTOCOL)+= http.o httpauth.o urldecode.o diff --git a/libavformat/gopher.c b/libavformat/gopher.c index 7c88ab01a8..9bbe171640 100644 --- a/libavformat/gopher.c +++ b/libavformat/gopher.c @@ -2,6 +2,7 @@ * Gopher protocol * * Copyright (c) 2009 Toshimitsu Kimura + * Copyright (c) 2021 parazyd * * based on libavformat/http.c, Copyright (c) 2000, 2001 Fabrice Bellard * @@ -22,6 +23,8 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +#include "config.h" + #include "libavutil/avstring.h" #include "avformat.h" #include "internal.h" @@ -75,19 +78,23 @@ static int gopher_close(URLContext *h) static int gopher_open(URLContext *h, const char *uri, int flags) { GopherContext *s = h->priv_data; -char hostname[1024], auth[1024], path[1024], buf[1024]; +char proto[10], hostname[1024], auth[1024], path[1024], buf[1024]; int port, err; +const char *lower_proto = "tcp"; h->is_streamed = 1; /* needed in any case to build the host string */ -av_url_split(NULL, 0, auth, sizeof(auth), hostname, sizeof(hostname), , - path, sizeof(path), uri); +av_url_split(proto, sizeof(proto), auth, sizeof(auth), + hostname, sizeof(hostname), , path, sizeof(path), uri); if (port < 0) port = 70; -ff_url_join(buf, sizeof(buf), "tcp", NULL, hostname, port, NULL); +if (!strcmp(proto, "gophers")) +lower_proto = "tls"; + +ff_url_join(buf, sizeof(buf), lower_proto, NULL, hostname, port, NULL); s->hd = NULL; err = ffurl_open_whitelist(>hd, buf, AVIO_FLAG_READ_WRITE, @@ -110,6 +117,7 @@ static int
[FFmpeg-cvslog] avcodec/gifenc: Actually use the shrunk palette
ffmpeg | branch: master | Derek Buitenhuis | Wed Mar 10 15:18:41 2021 +| [e690aa6a8dfa9a04c260af0eacc4c2978ad1a5fc] | committer: Derek Buitenhuis avcodec/gifenc: Actually use the shrunk palette I have no idea how nobody, including myself, noticed this. Signed-off-by: Derek Buitenhuis > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e690aa6a8dfa9a04c260af0eacc4c2978ad1a5fc --- libavcodec/gif.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/libavcodec/gif.c b/libavcodec/gif.c index 938bc0e928..cafd93e190 100644 --- a/libavcodec/gif.c +++ b/libavcodec/gif.c @@ -383,13 +383,12 @@ static int gif_image_write_image(AVCodecContext *avctx, bytestream_put_le16(bytestream, height); if (palette || !s->use_global_palette) { -const uint32_t *pal = palette ? palette : s->palette; unsigned pow2_count = av_log2(shrunk_palette_count - 1); unsigned i; bytestream_put_byte(bytestream, 1<<7 | pow2_count); /* flags */ for (i = 0; i < 1 << (pow2_count + 1); i++) { -const uint32_t v = pal[i]; +const uint32_t v = shrunk_palette[i]; bytestream_put_be24(bytestream, v); } } else { ___ 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/h264_slice: don't copy frame data during error concealment
ffmpeg | branch: master | James Almer | Mon Mar 8 23:10:10 2021 -0300| [99042c2bf6cc79006036502a6abbec5e51f73673] | committer: James Almer avcodec/h264_slice: don't copy frame data during error concealment In addition to the fact that av_image_copy() cannot handle hardware pixel formats, h->short_ref[0]->f may not be writable at this point. Based on a patch by Hendrik Leppkes. Signed-off-by: James Almer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=99042c2bf6cc79006036502a6abbec5e51f73673 --- libavcodec/h264_slice.c | 15 --- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c index fa7a639053..14b945756b 100644 --- a/libavcodec/h264_slice.c +++ b/libavcodec/h264_slice.c @@ -1599,14 +1599,15 @@ static int h264_field_start(H264Context *h, const H264SliceContext *sl, ff_thread_await_progress(>tf, INT_MAX, 0); if (prev->field_picture) ff_thread_await_progress(>tf, INT_MAX, 1); -av_image_copy(h->short_ref[0]->f->data, - h->short_ref[0]->f->linesize, - (const uint8_t **)prev->f->data, - prev->f->linesize, - prev->f->format, - prev->f->width, - prev->f->height); +ff_thread_release_buffer(h->avctx, >short_ref[0]->tf); +h->short_ref[0]->tf.f = h->short_ref[0]->f; +ret = ff_thread_ref_frame(>short_ref[0]->tf, >tf); +if (ret < 0) +return ret; h->short_ref[0]->poc = prev->poc + 2U; +ff_thread_report_progress(>short_ref[0]->tf, INT_MAX, 0); +if (h->short_ref[0]->field_picture) +ff_thread_report_progress(>short_ref[0]->tf, INT_MAX, 1); } else if (!h->frame_recovered && !h->avctx->hwaccel) ff_color_frame(h->short_ref[0]->f, c); h->short_ref[0]->frame_num = h->poc.prev_frame_num; ___ 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] avdevice/decklink: add missing include for buffer_size_t
ffmpeg | branch: master | James Almer | Thu Mar 11 13:39:36 2021 -0300| [9e2e6f935bed329a7c2eabae7de02cccd88e2f26] | committer: James Almer avdevice/decklink: add missing include for buffer_size_t Should fix compilation broken in f7abb53cb427515faac582f114ab97cbbd590280. Reviewed-by: Marton Balint Signed-off-by: James Almer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=9e2e6f935bed329a7c2eabae7de02cccd88e2f26 --- libavdevice/decklink_dec.cpp | 1 + libavdevice/decklink_enc.cpp | 1 + 2 files changed, 2 insertions(+) diff --git a/libavdevice/decklink_dec.cpp b/libavdevice/decklink_dec.cpp index 6c0a338fca..0262b2f16a 100644 --- a/libavdevice/decklink_dec.cpp +++ b/libavdevice/decklink_dec.cpp @@ -39,6 +39,7 @@ extern "C" { #include "libavutil/avassert.h" #include "libavutil/avutil.h" #include "libavutil/common.h" +#include "libavutil/internal.h" #include "libavutil/imgutils.h" #include "libavutil/intreadwrite.h" #include "libavutil/time.h" diff --git a/libavdevice/decklink_enc.cpp b/libavdevice/decklink_enc.cpp index df901b0d68..114c3e1a8c 100644 --- a/libavdevice/decklink_enc.cpp +++ b/libavdevice/decklink_enc.cpp @@ -32,6 +32,7 @@ extern "C" { extern "C" { #include "libavformat/avformat.h" +#include "libavutil/internal.h" #include "libavutil/imgutils.h" #include "avdevice.h" } ___ 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] avisynth: fix audio on big endian
ffmpeg | branch: master | Stephen Hutchinson | Sun Jan 3 17:58:36 2021 -0500| [16e8ea0dde6c0de9bb94d1634e0ed0ad85fd642e] | committer: Stephen Hutchinson avisynth: fix audio on big endian AviSynth+ outputs audio in the same format as the OS, so assuming little endian formats as input on big endian OSes results in nothing but static. Signed-off-by: Stephen Hutchinson > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=16e8ea0dde6c0de9bb94d1634e0ed0ad85fd642e --- libavformat/avisynth.c | 15 +++ 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/libavformat/avisynth.c b/libavformat/avisynth.c index 64fb6cc98f..21ae8c183a 100644 --- a/libavformat/avisynth.c +++ b/libavformat/avisynth.c @@ -42,6 +42,13 @@ #define AVISYNTH_LIB AVISYNTH_NAME SLIBSUF #endif +/* Endianness guards for audio */ +#if HAVE_BIGENDIAN +#define PCM(format) (AV_CODEC_ID_PCM_ ## format ## BE) +#else +#define PCM(format) (AV_CODEC_ID_PCM_ ## format ## LE) +#endif + #include typedef struct AviSynthLibrary { @@ -513,16 +520,16 @@ static int avisynth_create_stream_audio(AVFormatContext *s, AVStream *st) st->codecpar->codec_id = AV_CODEC_ID_PCM_U8; break; case AVS_SAMPLE_INT16: -st->codecpar->codec_id = AV_CODEC_ID_PCM_S16LE; +st->codecpar->codec_id = PCM(S16); break; case AVS_SAMPLE_INT24: -st->codecpar->codec_id = AV_CODEC_ID_PCM_S24LE; +st->codecpar->codec_id = PCM(S24); break; case AVS_SAMPLE_INT32: -st->codecpar->codec_id = AV_CODEC_ID_PCM_S32LE; +st->codecpar->codec_id = PCM(S32); break; case AVS_SAMPLE_FLOAT: -st->codecpar->codec_id = AV_CODEC_ID_PCM_F32LE; +st->codecpar->codec_id = PCM(F32); break; default: av_log(s, 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] avisynth: populate field order
ffmpeg | branch: master | emcodem | Thu Jan 21 18:59:45 2021 +0100| [8b74458d9303454fcbe9869a00df0c08461dfd4c] | committer: Stephen Hutchinson avisynth: populate field order Fixes Trac ticket #8757 Signed-off-by: Stephen Hutchinson > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=8b74458d9303454fcbe9869a00df0c08461dfd4c --- libavformat/avisynth.c | 17 + 1 file changed, 17 insertions(+) diff --git a/libavformat/avisynth.c b/libavformat/avisynth.c index 5756aea0b6..64fb6cc98f 100644 --- a/libavformat/avisynth.c +++ b/libavformat/avisynth.c @@ -243,6 +243,23 @@ static int avisynth_create_stream_video(AVFormatContext *s, AVStream *st) st->nb_frames = avs->vi->num_frames; avpriv_set_pts_info(st, 32, avs->vi->fps_denominator, avs->vi->fps_numerator); +av_log(s, AV_LOG_TRACE, "avs_is_field_based: %d\n", avs_is_field_based(avs->vi)); +av_log(s, AV_LOG_TRACE, "avs_is_parity_known: %d\n", avs_is_parity_known(avs->vi)); + +/* The following typically only works when assumetff (-bff) and + * assumefieldbased is used in-script. Additional + * logic using GetParity() could deliver more accurate results + * but also decodes a frame which we want to avoid. */ +st->codecpar->field_order = AV_FIELD_UNKNOWN; +if (avs_is_field_based(avs->vi)) { +if (avs_is_tff(avs->vi)) { +st->codecpar->field_order = AV_FIELD_TT; +} +else if (avs_is_bff(avs->vi)) { +st->codecpar->field_order = AV_FIELD_BB; +} +} + switch (avs->vi->pixel_type) { /* 10~16-bit YUV pix_fmts (AviSynth+) */ case AVS_CS_YUV444P10: ___ 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] avisynth: more intelligent RGB flipping
ffmpeg | branch: master | Stephen Hutchinson | Tue Apr 7 19:47:43 2020 -0400| [4c40686ee25f2aae29a121fe9e52c5db41007b36] | committer: Stephen Hutchinson avisynth: more intelligent RGB flipping avs_is_color_space provides a generic way of checking whether the video is RGB, and has been available through AVSC_API since 2.6. This means that GetProcAddress doesn't have to run on every frame. Signed-off-by: Stephen Hutchinson > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=4c40686ee25f2aae29a121fe9e52c5db41007b36 --- libavformat/avisynth.c | 27 +-- 1 file changed, 5 insertions(+), 22 deletions(-) diff --git a/libavformat/avisynth.c b/libavformat/avisynth.c index 2c08ace8db..5756aea0b6 100644 --- a/libavformat/avisynth.c +++ b/libavformat/avisynth.c @@ -57,6 +57,7 @@ typedef struct AviSynthLibrary { AVSC_DECLARE_FUNC(avs_get_version); AVSC_DECLARE_FUNC(avs_get_video_info); AVSC_DECLARE_FUNC(avs_invoke); +AVSC_DECLARE_FUNC(avs_is_color_space); AVSC_DECLARE_FUNC(avs_release_clip); AVSC_DECLARE_FUNC(avs_release_value); AVSC_DECLARE_FUNC(avs_release_video_frame); @@ -133,6 +134,7 @@ static av_cold int avisynth_load_library(void) LOAD_AVS_FUNC(avs_get_version, 0); LOAD_AVS_FUNC(avs_get_video_info, 0); LOAD_AVS_FUNC(avs_invoke, 0); +LOAD_AVS_FUNC(avs_is_color_space, 1); LOAD_AVS_FUNC(avs_release_clip, 0); LOAD_AVS_FUNC(avs_release_value, 0); LOAD_AVS_FUNC(avs_release_video_frame, 0); @@ -628,7 +630,6 @@ static int avisynth_read_packet_video(AVFormatContext *s, AVPacket *pkt, const unsigned char *src_p; int n, i, plane, rowsize, planeheight, pitch, bits, ret; const char *error; -int avsplus av_unused; if (avs->curr_frame >= avs->vi->num_frames) return AVERROR_EOF; @@ -638,19 +639,6 @@ static int avisynth_read_packet_video(AVFormatContext *s, AVPacket *pkt, if (discard) return 0; -#ifdef _WIN32 -/* Detect whether we're using AviSynth 2.6 or AviSynth+ by - * looking for whether avs_is_planar_rgb exists. */ -if (GetProcAddress(avs_library.library, "avs_is_planar_rgb") == NULL) -avsplus = 0; -else -avsplus = 1; -#else -/* AviSynth+ is now the only variant of AviSynth we support - * on Linux and macOS. */ -avsplus = 1; -#endif - bits = avs_library.avs_bits_per_pixel(avs->vi); /* Without the cast to int64_t, calculation overflows at about 9k x 9k @@ -687,14 +675,9 @@ static int avisynth_read_packet_video(AVFormatContext *s, AVPacket *pkt, planeheight = avs_library.avs_get_height_p(frame, plane); /* Flip RGB video. */ -if (avs_is_rgb24(avs->vi) || avs_is_rgb(avs->vi)) { -src_p = src_p + (planeheight - 1) * pitch; -pitch = -pitch; -} - -/* Flip Planar RGB video */ -if (avsplus && (avs_library.avs_is_planar_rgb(avs->vi) || -avs_library.avs_is_planar_rgba(avs->vi))) { +if (avs_library.avs_is_color_space(avs->vi, AVS_CS_BGR) || +avs_library.avs_is_color_space(avs->vi, AVS_CS_BGR48) || +avs_library.avs_is_color_space(avs->vi, AVS_CS_BGR64)) { src_p = src_p + (planeheight - 1) * pitch; pitch = -pitch; } ___ 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] avformat/rawenc: Use init instead of write_header function
ffmpeg | branch: master | Andreas Rheinhardt | Mon Mar 8 16:16:09 2021 +0100| [9f1b808bded79b005874c1bb0e526e000d3ae8b2] | committer: Andreas Rheinhardt avformat/rawenc: Use init instead of write_header function force_one_stream() does not write anything. Signed-off-by: Andreas Rheinhardt > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=9f1b808bded79b005874c1bb0e526e000d3ae8b2 --- libavformat/rawenc.c | 60 ++-- 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/libavformat/rawenc.c b/libavformat/rawenc.c index 32704f9bfd..caec297f4a 100644 --- a/libavformat/rawenc.c +++ b/libavformat/rawenc.c @@ -64,7 +64,7 @@ AVOutputFormat ff_ac3_muxer = { .extensions= "ac3", .audio_codec = AV_CODEC_ID_AC3, .video_codec = AV_CODEC_ID_NONE, -.write_header = force_one_stream, +.init = force_one_stream, .write_packet = ff_raw_write_packet, .flags = AVFMT_NOTIMESTAMPS, }; @@ -96,7 +96,7 @@ AVOutputFormat ff_adx_muxer = { .extensions= "adx", .audio_codec = AV_CODEC_ID_ADPCM_ADX, .video_codec = AV_CODEC_ID_NONE, -.write_header = force_one_stream, +.init = force_one_stream, .write_packet = ff_raw_write_packet, .write_trailer = adx_write_trailer, .flags = AVFMT_NOTIMESTAMPS, @@ -110,7 +110,7 @@ AVOutputFormat ff_aptx_muxer = { .extensions= "aptx", .audio_codec = AV_CODEC_ID_APTX, .video_codec = AV_CODEC_ID_NONE, -.write_header = force_one_stream, +.init = force_one_stream, .write_packet = ff_raw_write_packet, .flags = AVFMT_NOTIMESTAMPS, }; @@ -123,7 +123,7 @@ AVOutputFormat ff_aptx_hd_muxer = { .extensions= "aptxhd", .audio_codec = AV_CODEC_ID_APTX_HD, .video_codec = AV_CODEC_ID_NONE, -.write_header = force_one_stream, +.init = force_one_stream, .write_packet = ff_raw_write_packet, .flags = AVFMT_NOTIMESTAMPS, }; @@ -136,7 +136,7 @@ AVOutputFormat ff_avs2_muxer = { .extensions= "avs,avs2", .audio_codec = AV_CODEC_ID_NONE, .video_codec = AV_CODEC_ID_AVS2, -.write_header = force_one_stream, +.init = force_one_stream, .write_packet = ff_raw_write_packet, .flags = AVFMT_NOTIMESTAMPS, }; @@ -149,7 +149,7 @@ AVOutputFormat ff_cavsvideo_muxer = { .extensions= "cavs", .audio_codec = AV_CODEC_ID_NONE, .video_codec = AV_CODEC_ID_CAVS, -.write_header = force_one_stream, +.init = force_one_stream, .write_packet = ff_raw_write_packet, .flags = AVFMT_NOTIMESTAMPS, }; @@ -161,7 +161,7 @@ AVOutputFormat ff_codec2raw_muxer = { .long_name = NULL_IF_CONFIG_SMALL("raw codec2 muxer"), .audio_codec = AV_CODEC_ID_CODEC2, .video_codec = AV_CODEC_ID_NONE, -.write_header = force_one_stream, +.init = force_one_stream, .write_packet = ff_raw_write_packet, .flags = AVFMT_NOTIMESTAMPS, }; @@ -172,7 +172,7 @@ AVOutputFormat ff_codec2raw_muxer = { AVOutputFormat ff_data_muxer = { .name = "data", .long_name = NULL_IF_CONFIG_SMALL("raw data"), -.write_header = force_one_stream, +.init = force_one_stream, .write_packet = ff_raw_write_packet, .flags = AVFMT_NOTIMESTAMPS, }; @@ -185,7 +185,7 @@ AVOutputFormat ff_dirac_muxer = { .extensions= "drc,vc2", .audio_codec = AV_CODEC_ID_NONE, .video_codec = AV_CODEC_ID_DIRAC, -.write_header = force_one_stream, +.init = force_one_stream, .write_packet = ff_raw_write_packet, .flags = AVFMT_NOTIMESTAMPS, }; @@ -198,7 +198,7 @@ AVOutputFormat ff_dnxhd_muxer = { .extensions= "dnxhd,dnxhr", .audio_codec = AV_CODEC_ID_NONE, .video_codec = AV_CODEC_ID_DNXHD, -.write_header = force_one_stream, +.init = force_one_stream, .write_packet = ff_raw_write_packet, .flags = AVFMT_NOTIMESTAMPS, }; @@ -212,7 +212,7 @@ AVOutputFormat ff_dts_muxer = { .extensions= "dts", .audio_codec = AV_CODEC_ID_DTS, .video_codec = AV_CODEC_ID_NONE, -.write_header = force_one_stream, +.init = force_one_stream, .write_packet = ff_raw_write_packet, .flags = AVFMT_NOTIMESTAMPS, }; @@ -226,7 +226,7 @@ AVOutputFormat ff_eac3_muxer = { .extensions= "eac3", .audio_codec = AV_CODEC_ID_EAC3, .video_codec = AV_CODEC_ID_NONE, -.write_header = force_one_stream, +.init
[FFmpeg-cvslog] avcodec/4xm: Check pre_gb in decode_i_block()
ffmpeg | branch: master | Michael Niedermayer | Tue Mar 9 21:39:30 2021 +0100| [b87781649e2862d07fcb8d322289d89b47a530b6] | committer: Michael Niedermayer avcodec/4xm: Check pre_gb in decode_i_block() Fixes: Timeout Fixes: 31257/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FOURXM_fuzzer-5150866229297152 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=b87781649e2862d07fcb8d322289d89b47a530b6 --- libavcodec/4xm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/4xm.c b/libavcodec/4xm.c index 4d58b093f7..cbd8637763 100644 --- a/libavcodec/4xm.c +++ b/libavcodec/4xm.c @@ -499,8 +499,8 @@ static int decode_i_block(FourXContext *f, int16_t *block) { int code, i, j, level, val; -if (get_bits_left(>gb) < 2){ -av_log(f->avctx, AV_LOG_ERROR, "%d bits left before decode_i_block()\n", get_bits_left(>gb)); +if (get_bits_left(>pre_gb) < 2) { +av_log(f->avctx, AV_LOG_ERROR, "%d bits left before decode_i_block()\n", get_bits_left(>pre_gb)); return AVERROR_INVALIDDATA; } ___ 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] avutil/buffer_internal: Include internal for buffer_size_t
ffmpeg | branch: master | Andreas Rheinhardt | Thu Mar 11 11:39:58 2021 +0100| [1ad628d2c22664e3c16448029556d52b78fd3c88] | committer: Andreas Rheinhardt avutil/buffer_internal: Include internal for buffer_size_t Fixes checkheaders. Reviewed-by: James Almer Signed-off-by: Andreas Rheinhardt > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=1ad628d2c22664e3c16448029556d52b78fd3c88 --- libavutil/buffer_internal.h | 1 + 1 file changed, 1 insertion(+) diff --git a/libavutil/buffer_internal.h b/libavutil/buffer_internal.h index 0b549e3a53..d902772ed3 100644 --- a/libavutil/buffer_internal.h +++ b/libavutil/buffer_internal.h @@ -22,6 +22,7 @@ #include #include +#include "internal.h" #include "buffer.h" #include "thread.h" ___ 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] dnn/dnn_backend_native_layer_mathbinary: Fix leak upon error
ffmpeg | branch: master | Andreas Rheinhardt | Wed Mar 10 18:45:07 2021 +0100| [2f056def652e15eea7fed8b32ed32c9e2fc8bf70] | committer: Andreas Rheinhardt dnn/dnn_backend_native_layer_mathbinary: Fix leak upon error Fixes Coverity issue #1473568. Reviewed-by: Guo, Yejun Signed-off-by: Andreas Rheinhardt > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=2f056def652e15eea7fed8b32ed32c9e2fc8bf70 --- .../dnn/dnn_backend_native_layer_mathbinary.c | 23 +++--- 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/libavfilter/dnn/dnn_backend_native_layer_mathbinary.c b/libavfilter/dnn/dnn_backend_native_layer_mathbinary.c index c116188bab..1c33b4633d 100644 --- a/libavfilter/dnn/dnn_backend_native_layer_mathbinary.c +++ b/libavfilter/dnn/dnn_backend_native_layer_mathbinary.c @@ -100,20 +100,17 @@ static void math_binary_not_commutative(FunType pfun, const DnnLayerMathBinaryPa } int ff_dnn_load_layer_math_binary(Layer *layer, AVIOContext *model_file_context, int file_size, int operands_num) { -DnnLayerMathBinaryParams *params; +DnnLayerMathBinaryParams params = { 0 }; int dnn_size = 0; int input_index = 0; -params = av_malloc(sizeof(*params)); -if (!params) -return 0; -params->bin_op = (int32_t)avio_rl32(model_file_context); +params.bin_op = (int32_t)avio_rl32(model_file_context); dnn_size += 4; -params->input0_broadcast = (int32_t)avio_rl32(model_file_context); +params.input0_broadcast = (int32_t)avio_rl32(model_file_context); dnn_size += 4; -if (params->input0_broadcast) { -params->v = av_int2float(avio_rl32(model_file_context)); +if (params.input0_broadcast) { +params.v = av_int2float(avio_rl32(model_file_context)); } else { layer->input_operand_indexes[input_index] = (int32_t)avio_rl32(model_file_context); if (layer->input_operand_indexes[input_index] >= operands_num) { @@ -123,10 +120,10 @@ int ff_dnn_load_layer_math_binary(Layer *layer, AVIOContext *model_file_context, } dnn_size += 4; -params->input1_broadcast = (int32_t)avio_rl32(model_file_context); +params.input1_broadcast = (int32_t)avio_rl32(model_file_context); dnn_size += 4; -if (params->input1_broadcast) { -params->v = av_int2float(avio_rl32(model_file_context)); +if (params.input1_broadcast) { +params.v = av_int2float(avio_rl32(model_file_context)); } else { layer->input_operand_indexes[input_index] = (int32_t)avio_rl32(model_file_context); if (layer->input_operand_indexes[input_index] >= operands_num) { @@ -138,11 +135,13 @@ int ff_dnn_load_layer_math_binary(Layer *layer, AVIOContext *model_file_context, layer->output_operand_index = (int32_t)avio_rl32(model_file_context); dnn_size += 4; -layer->params = params; if (layer->output_operand_index >= operands_num) { return 0; } +layer->params = av_memdup(, sizeof(params)); +if (!layer->params) +return 0; return dnn_size; } ___ 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] dnn/dnn_backend_native_layer_conv2d: Don't pretend convolution can fail
ffmpeg | branch: master | Andreas Rheinhardt | Wed Mar 10 21:58:15 2021 +0100| [723ebf029a94fc23f239dd319c7f1d5921a72cd7] | committer: Andreas Rheinhardt dnn/dnn_backend_native_layer_conv2d: Don't pretend convolution can fail It can't; these are just remnants of commit 3c7cad69f233252e5178f7732baa0da950d74bbd which let the worker threads do the reallocation. Reviewed-by: Guo, Yejun Signed-off-by: Andreas Rheinhardt > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=723ebf029a94fc23f239dd319c7f1d5921a72cd7 --- libavfilter/dnn/dnn_backend_native_layer_conv2d.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/libavfilter/dnn/dnn_backend_native_layer_conv2d.c b/libavfilter/dnn/dnn_backend_native_layer_conv2d.c index 614e300046..7a60aa6a4b 100644 --- a/libavfilter/dnn/dnn_backend_native_layer_conv2d.c +++ b/libavfilter/dnn/dnn_backend_native_layer_conv2d.c @@ -180,7 +180,7 @@ static void * dnn_execute_layer_conv2d_thread(void *threadarg) output += conv_params->output_num; } } -return (void *)DNN_SUCCESS; +return NULL; } @@ -244,7 +244,6 @@ int ff_dnn_execute_layer_conv2d(DnnOperand *operands, const int32_t *input_opera } } -//join threads, res gets function return for (int i = 0; i < thread_num; i++){ pthread_join(thread_param[i].thread, NULL); } ___ 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] dnn/dnn_backend_native_layer_conv2d: Check thread creation for errors
ffmpeg | branch: master | Andreas Rheinhardt | Wed Mar 10 18:08:10 2021 +0100| [9da96d8b6908dbec55bd9657f7edc8a4f16a90ee] | committer: Andreas Rheinhardt dnn/dnn_backend_native_layer_conv2d: Check thread creation for errors Fixes Coverity issue #1473533. Reviewed-by: Guo, Yejun Signed-off-by: Andreas Rheinhardt > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=9da96d8b6908dbec55bd9657f7edc8a4f16a90ee --- libavfilter/dnn/dnn_backend_native_layer_conv2d.c | 13 ++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/libavfilter/dnn/dnn_backend_native_layer_conv2d.c b/libavfilter/dnn/dnn_backend_native_layer_conv2d.c index f3e9ce3fd9..614e300046 100644 --- a/libavfilter/dnn/dnn_backend_native_layer_conv2d.c +++ b/libavfilter/dnn/dnn_backend_native_layer_conv2d.c @@ -190,7 +190,7 @@ int ff_dnn_execute_layer_conv2d(DnnOperand *operands, const int32_t *input_opera #if HAVE_PTHREAD_CANCEL int thread_num = (ctx->options.conv2d_threads <= 0 || ctx->options.conv2d_threads > av_cpu_count()) ? (av_cpu_count() + 1) : (ctx->options.conv2d_threads); -int thread_stride; +int ret = DNN_SUCCESS, thread_stride; ThreadParam *thread_param; #else ThreadParam thread_param = { 0 }; @@ -236,7 +236,12 @@ int ff_dnn_execute_layer_conv2d(DnnOperand *operands, const int32_t *input_opera thread_param[i].thread_common_param = _common_param; thread_param[i].thread_start = thread_stride * i + pad_size; thread_param[i].thread_end = (i == thread_num - 1) ? (height - pad_size) : (thread_param[i].thread_start + thread_stride); -pthread_create(_param[i].thread, NULL, dnn_execute_layer_conv2d_thread, _param[i]); +if (pthread_create(_param[i].thread, NULL, + dnn_execute_layer_conv2d_thread, _param[i])) { +thread_num = i; +ret = DNN_ERROR; +break; +} } //join threads, res gets function return @@ -246,12 +251,14 @@ int ff_dnn_execute_layer_conv2d(DnnOperand *operands, const int32_t *input_opera //release memory av_freep(_param); + +return ret; #else thread_param.thread_common_param = _common_param; thread_param.thread_start = pad_size; thread_param.thread_end = height - pad_size; dnn_execute_layer_conv2d_thread(_param); -#endif return DNN_SUCCESS; +#endif } ___ 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] dnn/dnn_backend_native_layer_conv2d: Fix memleak on error
ffmpeg | branch: master | Andreas Rheinhardt | Wed Mar 10 17:22:29 2021 +0100| [508d7005a00ea0d047834d661109c57a1bacef53] | committer: Andreas Rheinhardt dnn/dnn_backend_native_layer_conv2d: Fix memleak on error If an error happens when preparing the output data buffer, an already allocated array would leak. Fix this by postponing its allocation. Fixes Coverity issue #1473531. Reviewed-by: Guo, Yejun Signed-off-by: Andreas Rheinhardt > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=508d7005a00ea0d047834d661109c57a1bacef53 --- libavfilter/dnn/dnn_backend_native_layer_conv2d.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libavfilter/dnn/dnn_backend_native_layer_conv2d.c b/libavfilter/dnn/dnn_backend_native_layer_conv2d.c index 61e5628843..1306ae42fc 100644 --- a/libavfilter/dnn/dnn_backend_native_layer_conv2d.c +++ b/libavfilter/dnn/dnn_backend_native_layer_conv2d.c @@ -191,7 +191,7 @@ int ff_dnn_execute_layer_conv2d(DnnOperand *operands, const int32_t *input_opera int thread_num = (ctx->options.conv2d_threads <= 0 || ctx->options.conv2d_threads > av_cpu_count()) ? (av_cpu_count() + 1) : (ctx->options.conv2d_threads); int thread_stride; -ThreadParam **thread_param = av_malloc_array(thread_num, sizeof(*thread_param)); +ThreadParam **thread_param; #else ThreadParam thread_param = { 0 }; #endif @@ -227,6 +227,7 @@ int ff_dnn_execute_layer_conv2d(DnnOperand *operands, const int32_t *input_opera thread_common_param.ctx = ctx; #if HAVE_PTHREAD_CANCEL +thread_param = av_malloc_array(thread_num, sizeof(*thread_param)); thread_stride = (height - pad_size * 2) / thread_num; //create threads for (int i = 0; i < thread_num; 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] dnn/dnn_backend_native_layer_conv2d: Check allocation
ffmpeg | branch: master | Andreas Rheinhardt | Wed Mar 10 17:42:43 2021 +0100| [c2fef8f16cf35c6eb58565d9e4bf25389637d850] | committer: Andreas Rheinhardt dnn/dnn_backend_native_layer_conv2d: Check allocation Reviewed-by: Guo, Yejun Signed-off-by: Andreas Rheinhardt > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c2fef8f16cf35c6eb58565d9e4bf25389637d850 --- libavfilter/dnn/dnn_backend_native_layer_conv2d.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavfilter/dnn/dnn_backend_native_layer_conv2d.c b/libavfilter/dnn/dnn_backend_native_layer_conv2d.c index 37834d09f4..f3e9ce3fd9 100644 --- a/libavfilter/dnn/dnn_backend_native_layer_conv2d.c +++ b/libavfilter/dnn/dnn_backend_native_layer_conv2d.c @@ -228,6 +228,8 @@ int ff_dnn_execute_layer_conv2d(DnnOperand *operands, const int32_t *input_opera #if HAVE_PTHREAD_CANCEL thread_param = av_malloc_array(thread_num, sizeof(*thread_param)); +if (!thread_param) +return DNN_ERROR; thread_stride = (height - pad_size * 2) / thread_num; //create threads for (int i = 0; i < thread_num; 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] dnn/dnn_backend_native_layer_conv2d: Avoid allocation when single-threaded
ffmpeg | branch: master | Andreas Rheinhardt | Wed Mar 10 17:03:01 2021 +0100| [16e36d5c0cb9573b10cbbc5c40aaec58d4a340e7] | committer: Andreas Rheinhardt dnn/dnn_backend_native_layer_conv2d: Avoid allocation when single-threaded Also fixes a memleak in single-threaded mode when an error happens in preparing the output data buffer; and also removes an unchecked allocation. Reviewed-by: Guo, Yejun Signed-off-by: Andreas Rheinhardt > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=16e36d5c0cb9573b10cbbc5c40aaec58d4a340e7 --- libavfilter/dnn/dnn_backend_native_layer_conv2d.c | 18 +- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/libavfilter/dnn/dnn_backend_native_layer_conv2d.c b/libavfilter/dnn/dnn_backend_native_layer_conv2d.c index 2e5aacdc2b..61e5628843 100644 --- a/libavfilter/dnn/dnn_backend_native_layer_conv2d.c +++ b/libavfilter/dnn/dnn_backend_native_layer_conv2d.c @@ -187,12 +187,14 @@ static void * dnn_execute_layer_conv2d_thread(void *threadarg) int ff_dnn_execute_layer_conv2d(DnnOperand *operands, const int32_t *input_operand_indexes, int32_t output_operand_index, const void *parameters, NativeContext *ctx) { +#if HAVE_PTHREAD_CANCEL int thread_num = (ctx->options.conv2d_threads <= 0 || ctx->options.conv2d_threads > av_cpu_count()) ? (av_cpu_count() + 1) : (ctx->options.conv2d_threads); -#if HAVE_PTHREAD_CANCEL int thread_stride; -#endif ThreadParam **thread_param = av_malloc_array(thread_num, sizeof(*thread_param)); +#else +ThreadParam thread_param = { 0 }; +#endif ThreadCommonParam thread_common_param; const ConvolutionalParams *conv_params = parameters; int height = operands[input_operand_indexes[0]].dims[1]; @@ -244,15 +246,13 @@ int ff_dnn_execute_layer_conv2d(DnnOperand *operands, const int32_t *input_opera for (int i = 0; i < thread_num; i++){ av_freep(_param[i]); } +av_freep(_param); #else -thread_param[0] = av_malloc(sizeof(*thread_param[0])); -thread_param[0]->thread_common_param = _common_param; -thread_param[0]->thread_start = pad_size; -thread_param[0]->thread_end = height - pad_size; -dnn_execute_layer_conv2d_thread((void *)thread_param[0]); -av_freep(_param[0]); +thread_param.thread_common_param = _common_param; +thread_param.thread_start = pad_size; +thread_param.thread_end = height - pad_size; +dnn_execute_layer_conv2d_thread(_param); #endif -av_freep(_param); return DNN_SUCCESS; } ___ 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] dnn/dnn_backend_native_layer_conv2d: Avoid separate, unchecked allocations
ffmpeg | branch: master | Andreas Rheinhardt | Wed Mar 10 17:38:36 2021 +0100| [d14ae74064a841d8a24aec78e9143fba01ce7003] | committer: Andreas Rheinhardt dnn/dnn_backend_native_layer_conv2d: Avoid separate, unchecked allocations Reviewed-by: Guo, Yejun Signed-off-by: Andreas Rheinhardt > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d14ae74064a841d8a24aec78e9143fba01ce7003 --- libavfilter/dnn/dnn_backend_native_layer_conv2d.c | 16 ++-- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/libavfilter/dnn/dnn_backend_native_layer_conv2d.c b/libavfilter/dnn/dnn_backend_native_layer_conv2d.c index 1306ae42fc..37834d09f4 100644 --- a/libavfilter/dnn/dnn_backend_native_layer_conv2d.c +++ b/libavfilter/dnn/dnn_backend_native_layer_conv2d.c @@ -191,7 +191,7 @@ int ff_dnn_execute_layer_conv2d(DnnOperand *operands, const int32_t *input_opera int thread_num = (ctx->options.conv2d_threads <= 0 || ctx->options.conv2d_threads > av_cpu_count()) ? (av_cpu_count() + 1) : (ctx->options.conv2d_threads); int thread_stride; -ThreadParam **thread_param; +ThreadParam *thread_param; #else ThreadParam thread_param = { 0 }; #endif @@ -231,22 +231,18 @@ int ff_dnn_execute_layer_conv2d(DnnOperand *operands, const int32_t *input_opera thread_stride = (height - pad_size * 2) / thread_num; //create threads for (int i = 0; i < thread_num; i++){ -thread_param[i] = av_malloc(sizeof(*thread_param[0])); -thread_param[i]->thread_common_param = _common_param; -thread_param[i]->thread_start = thread_stride * i + pad_size; -thread_param[i]->thread_end = (i == thread_num - 1) ? (height - pad_size) : (thread_param[i]->thread_start + thread_stride); -pthread_create(_param[i]->thread, NULL, dnn_execute_layer_conv2d_thread, (void *)thread_param[i]); +thread_param[i].thread_common_param = _common_param; +thread_param[i].thread_start = thread_stride * i + pad_size; +thread_param[i].thread_end = (i == thread_num - 1) ? (height - pad_size) : (thread_param[i].thread_start + thread_stride); +pthread_create(_param[i].thread, NULL, dnn_execute_layer_conv2d_thread, _param[i]); } //join threads, res gets function return for (int i = 0; i < thread_num; i++){ -pthread_join(thread_param[i]->thread, NULL); +pthread_join(thread_param[i].thread, NULL); } //release memory -for (int i = 0; i < thread_num; i++){ -av_freep(_param[i]); -} av_freep(_param); #else thread_param.thread_common_param = _common_param; ___ 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] dnn/dnn_backend_native_layer_conv2d: Join two arrays, avoid allocation
ffmpeg | branch: master | Andreas Rheinhardt | Wed Mar 10 16:21:13 2021 +0100| [639b3bbbc7a3736db9255ad6da2e513a529fb4d3] | committer: Andreas Rheinhardt dnn/dnn_backend_native_layer_conv2d: Join two arrays, avoid allocation Fixes Coverity issue #1473507. Reviewed-by: Guo, Yejun Signed-off-by: Andreas Rheinhardt > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=639b3bbbc7a3736db9255ad6da2e513a529fb4d3 --- libavfilter/dnn/dnn_backend_native_layer_conv2d.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/libavfilter/dnn/dnn_backend_native_layer_conv2d.c b/libavfilter/dnn/dnn_backend_native_layer_conv2d.c index 2b83896da9..2e5aacdc2b 100644 --- a/libavfilter/dnn/dnn_backend_native_layer_conv2d.c +++ b/libavfilter/dnn/dnn_backend_native_layer_conv2d.c @@ -38,6 +38,9 @@ typedef struct ThreadCommonParam{ typedef struct ThreadParam{ ThreadCommonParam *thread_common_param; int thread_start, thread_end; +#if HAVE_PTHREAD_CANCEL +pthread_t thread; +#endif } ThreadParam; int ff_dnn_load_layer_conv2d(Layer *layer, AVIOContext *model_file_context, int file_size, int operands_num) @@ -187,7 +190,6 @@ int ff_dnn_execute_layer_conv2d(DnnOperand *operands, const int32_t *input_opera int thread_num = (ctx->options.conv2d_threads <= 0 || ctx->options.conv2d_threads > av_cpu_count()) ? (av_cpu_count() + 1) : (ctx->options.conv2d_threads); #if HAVE_PTHREAD_CANCEL -pthread_t *thread_id = av_malloc_array(thread_num, sizeof(*thread_id)); int thread_stride; #endif ThreadParam **thread_param = av_malloc_array(thread_num, sizeof(*thread_param)); @@ -230,17 +232,15 @@ int ff_dnn_execute_layer_conv2d(DnnOperand *operands, const int32_t *input_opera thread_param[i]->thread_common_param = _common_param; thread_param[i]->thread_start = thread_stride * i + pad_size; thread_param[i]->thread_end = (i == thread_num - 1) ? (height - pad_size) : (thread_param[i]->thread_start + thread_stride); -pthread_create(_id[i], NULL, dnn_execute_layer_conv2d_thread, (void *)thread_param[i]); +pthread_create(_param[i]->thread, NULL, dnn_execute_layer_conv2d_thread, (void *)thread_param[i]); } //join threads, res gets function return for (int i = 0; i < thread_num; i++){ -pthread_join(thread_id[i], NULL); +pthread_join(thread_param[i]->thread, NULL); } //release memory -av_freep(_id); - for (int i = 0; i < thread_num; i++){ av_freep(_param[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] dnn/dnn_backend_native_layer_conv2d: Fix memleak on realloc failure
ffmpeg | branch: master | Andreas Rheinhardt | Wed Mar 10 15:40:36 2021 +0100| [d915c1dd7ade0f2baaf9686c668183a770bac44c] | committer: Andreas Rheinhardt dnn/dnn_backend_native_layer_conv2d: Fix memleak on realloc failure Reviewed-by: Guo, Yejun Signed-off-by: Andreas Rheinhardt > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d915c1dd7ade0f2baaf9686c668183a770bac44c --- libavfilter/dnn/dnn_backend_native_layer_conv2d.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libavfilter/dnn/dnn_backend_native_layer_conv2d.c b/libavfilter/dnn/dnn_backend_native_layer_conv2d.c index b5c2c394ef..2b83896da9 100644 --- a/libavfilter/dnn/dnn_backend_native_layer_conv2d.c +++ b/libavfilter/dnn/dnn_backend_native_layer_conv2d.c @@ -197,6 +197,7 @@ int ff_dnn_execute_layer_conv2d(DnnOperand *operands, const int32_t *input_opera int width = operands[input_operand_indexes[0]].dims[2]; int pad_size = (conv_params->padding_method == VALID) ? (conv_params->kernel_size - 1) / 2 * conv_params->dilation : 0; DnnOperand *output_operand = [output_operand_index]; +void *tmp; output_operand->dims[0] = operands[input_operand_indexes[0]].dims[0]; output_operand->dims[1] = height - pad_size * 2; @@ -208,11 +209,12 @@ int ff_dnn_execute_layer_conv2d(DnnOperand *operands, const int32_t *input_opera av_log(ctx, AV_LOG_ERROR, "The output data length overflow\n"); return DNN_ERROR; } -output_operand->data = av_realloc(output_operand->data, output_operand->length); -if (!output_operand->data) { +tmp = av_realloc(output_operand->data, output_operand->length); +if (!tmp) { av_log(ctx, AV_LOG_ERROR, "Failed to reallocate memory for output\n"); return DNN_ERROR; } +output_operand->data = tmp; thread_common_param.output_data = output_operand->data; thread_common_param.operands = operands; thread_common_param.input_operand_indexes = input_operand_indexes; ___ 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] dnn/dnn_backend_native: Fix typo in log message
ffmpeg | branch: master | Andreas Rheinhardt | Wed Mar 10 15:27:52 2021 +0100| [f51f13902bbd2bb4dfb736cec830a830ba71fcc0] | committer: Andreas Rheinhardt dnn/dnn_backend_native: Fix typo in log message Reviewed-by: Guo, Yejun Signed-off-by: Andreas Rheinhardt > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f51f13902bbd2bb4dfb736cec830a830ba71fcc0 --- libavfilter/dnn/dnn_backend_native.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavfilter/dnn/dnn_backend_native.c b/libavfilter/dnn/dnn_backend_native.c index c7a2ad223a..d8ae36c52d 100644 --- a/libavfilter/dnn/dnn_backend_native.c +++ b/libavfilter/dnn/dnn_backend_native.c @@ -331,7 +331,7 @@ static DNNReturnType execute_model_native(const DNNModel *model, const char *inp native_model->layers[layer].output_operand_index, native_model->layers[layer].params, _model->ctx) == DNN_ERROR) { -av_log(ctx, AV_LOG_ERROR, "Failed to execuet model\n"); +av_log(ctx, AV_LOG_ERROR, "Failed to execute model\n"); return DNN_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] dnn/dnn_backend_native: Don't use asserts for checks
ffmpeg | branch: master | Andreas Rheinhardt | Wed Mar 10 14:00:26 2021 +0100| [1e47ef600d7fb7c763f4ba1aef104fcf3f59cfd8] | committer: Andreas Rheinhardt dnn/dnn_backend_native: Don't use asserts for checks asserts should not be used instead of ordinary input checks. Yet the native DNN backend did it: get_input_native() asserted that the first dimension was one, despite this value coming directly from the input file without having been sanitized. Reviewed-by: Guo, Yejun Signed-off-by: Andreas Rheinhardt > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=1e47ef600d7fb7c763f4ba1aef104fcf3f59cfd8 --- libavfilter/dnn/dnn_backend_native.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavfilter/dnn/dnn_backend_native.c b/libavfilter/dnn/dnn_backend_native.c index 828dcf8b37..c7a2ad223a 100644 --- a/libavfilter/dnn/dnn_backend_native.c +++ b/libavfilter/dnn/dnn_backend_native.c @@ -232,6 +232,8 @@ DNNModel *ff_dnn_load_model_native(const char *model_filename, DNNFunctionType f oprd->dims[dim] = (int32_t)avio_rl32(model_file_context); dnn_size += 4; } +if (oprd->type == DOT_INPUT && oprd->dims[0] != 1) +goto fail; oprd->isNHWC = 1; } ___ 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] dnn/dnn_backend_native: Avoid allocation for checking file magic
ffmpeg | branch: master | Andreas Rheinhardt | Wed Mar 10 02:34:14 2021 +0100| [2e2ed39dac9578862fb37d74e44cf4cf92c9b4bd] | committer: Andreas Rheinhardt dnn/dnn_backend_native: Avoid allocation for checking file magic Reviewed-by: Guo, Yejun Signed-off-by: Andreas Rheinhardt > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=2e2ed39dac9578862fb37d74e44cf4cf92c9b4bd --- libavfilter/dnn/dnn_backend_native.c | 22 ++ 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/libavfilter/dnn/dnn_backend_native.c b/libavfilter/dnn/dnn_backend_native.c index 3bc253c1ad..93fa6c6bcf 100644 --- a/libavfilter/dnn/dnn_backend_native.c +++ b/libavfilter/dnn/dnn_backend_native.c @@ -114,10 +114,10 @@ static DNNReturnType get_output_native(void *model, const char *input_name, int // For DEPTH_TO_SPACE layer: block_size DNNModel *ff_dnn_load_model_native(const char *model_filename, DNNFunctionType func_type, const char *options, AVFilterContext *filter_ctx) { +#define DNN_NATIVE_MAGIC "FFMPEGDNNNATIVE" DNNModel *model = NULL; -char header_expected[] = "FFMPEGDNNNATIVE"; -char *buf; -size_t size; +// sizeof - 1 to skip the terminating '\0' which is not written in the file +char buf[sizeof(DNN_NATIVE_MAGIC) - 1]; int version, header_size, major_version_expected = 1; NativeModel *native_model = NULL; AVIOContext *model_file_context; @@ -138,20 +138,10 @@ DNNModel *ff_dnn_load_model_native(const char *model_filename, DNNFunctionType f /** * check file header with string and version */ -size = sizeof(header_expected); -buf = av_malloc(size); -if (!buf) { +if (avio_read(model_file_context, buf, sizeof(buf)) != sizeof(buf) || +memcmp(buf, DNN_NATIVE_MAGIC, sizeof(buf))) goto fail; -} - -// size - 1 to skip the ending '\0' which is not saved in file -avio_get_str(model_file_context, size - 1, buf, size); -dnn_size = size - 1; -if (strncmp(buf, header_expected, size) != 0) { -av_freep(); -goto fail; -} -av_freep(); +dnn_size = sizeof(buf); version = (int32_t)avio_rl32(model_file_context); dnn_size += 4; ___ 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] Doc: Tech Resolution Process
ffmpeg | branch: master | Jean-Baptiste Kempf | Wed Mar 10 21:40:22 2021 +0100| [b7bf631f9131b78fc6535c7ecc5ad0c76f532d70] | committer: Anton Khirnov Doc: Tech Resolution Process > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b7bf631f9131b78fc6535c7ecc5ad0c76f532d70 --- doc/dev_community/community.md | 2 +- doc/dev_community/resolution_process.md | 91 + 2 files changed, 92 insertions(+), 1 deletion(-) diff --git a/doc/dev_community/community.md b/doc/dev_community/community.md index 49d7f899aa..21e08e20e3 100644 --- a/doc/dev_community/community.md +++ b/doc/dev_community/community.md @@ -53,7 +53,7 @@ can trigger a new election of the TC. The members of the TC can be elected from outside of the GA. Candidates for election can either be suggested or self-nominated. -The conflict resolution process is detailed in the [resolution process] document. +The conflict resolution process is detailed in the [resolution process](resolution_process.md) document. ## Community committee diff --git a/doc/dev_community/resolution_process.md b/doc/dev_community/resolution_process.md new file mode 100644 index 00..4ed0b63c43 --- /dev/null +++ b/doc/dev_community/resolution_process.md @@ -0,0 +1,91 @@ +# Technical Committee + +_This document only makes sense with the rules from [the community document](community)_. + +The Technical Committee (**TC**) is here to arbitrate and make decisions when +technical conflicts occur in the project. + +The TC main role is to resolve technical conflicts. +It is therefore not a technical steering committee, but it is understood that +some decisions might impact the future of the project. + +# Process + +## Seizing + +The TC can take possession of any technical matter that it sees fit. + +To involve the TC in a matter, email tc@ or CC them on an ongoing discussion. + +As members of TC are developers, they also can email tc@ to raise an issue. + +## Announcement + +The TC, once seized, must announce itself on the main mailing list, with a _[TC]_ tag. + +The TC has 2 modes of operation: a RFC one and an internal one. + +If the TC thinks it needs the input from the larger community, the TC can call +for a RFC. Else, it can decide by itself. + +If the disagreement involves a member of the TC, that member should recuse +themselves from the decision. + +The decision to use a RFC process or an internal discussion is a discretionary +decision of the TC. + +The TC can also reject a seizure for a few reasons such as: +the matter was not discussed enough previously; it lacks expertise to reach a +beneficial decision on the matter; or the matter is too trivial. + +### RFC call + +In the RFC mode, one person from the TC posts on the mailing list the +technical question and will request input from the community. + +The mail will have the following specification: +* a precise title +* a specific tag [TC RFC] +* a top-level email +* contain a precise question that does not exceed 100 words and that is answerable by developers +* may have an extra description, or a link to a previous discussion, if deemed necessary, +* contain a precise end date for the answers. + +The answers from the community must be on the main mailing list and must have +the following specification: +* keep the tag and the title unchanged +* limited to 400 words +* a first-level, answering directly to the main email +* answering to the question. + +Further replies to answers are permitted, as long as they conform to the +community standards of politeness, they are limited to 100 words, and are not +nested more than once. (max-depth=2) + +After the end-date, mails on the thread will be ignored. + +Violations of those rules will be escalated through the Community Committee. + +After all the emails are in, the TC has 96 hours to give its final decision. +Exceptionally, the TC can request an extra delay, that will be notified on the +mailing list. + +### Within TC + +In the internal case, the TC has 96 hours to give its final decision. +Exceptionally, the TC can request an extra delay. + + +## Decisions + +The decisions from the TC will be sent on the mailing list, with the _[TC]_ tag. + +Internally, the TC should take decisions with a majority, or using +ranked-choice voting. + +The decision from the TC should be published with a summary of the reasons that +lead to this decision. + +The decisions from the TC are final, until the matters are reopened after +no less than one year. + ___ 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".