[FFmpeg-cvslog] avfilter: update filter timeline state only on main link
ffmpeg | branch: master | Gyan Doshi | Fri Mar 1 19:21:52 2024 +0530| [3d1860ec8db7f9785bf1338e826138c0218dfb59] | committer: Gyan Doshi avfilter: update filter timeline state only on main link At present, consume_update evaluates timeline state on all links for a multi-input filter. This can lead to the filter being incorrectly en/dis-abled when evaluation on a frame on a secondary link leads to a different result than the frame on the current main link next in line for processing. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=3d1860ec8db7f9785bf1338e826138c0218dfb59 --- libavfilter/avfilter.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c index c323ebb4b8..831871de90 100644 --- a/libavfilter/avfilter.c +++ b/libavfilter/avfilter.c @@ -1436,7 +1436,8 @@ static void consume_update(FilterLinkInternal *li, const AVFrame *frame) AVFilterLink *const link = &li->l; update_link_current_pts(li, frame->pts); ff_inlink_process_commands(link, frame); -link->dst->is_disabled = !ff_inlink_evaluate_timeline_at_frame(link, frame); +if (link == link->dst->inputs[0]) +link->dst->is_disabled = !ff_inlink_evaluate_timeline_at_frame(link, frame); link->frame_count_out++; link->sample_count_out += frame->nb_samples; } ___ 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/libdav1d: parse DV profile 10 T.35 OBU
ffmpeg | branch: master | Niklas Haas | Fri Feb 23 21:16:58 2024 +0100| [a5d1e69b3bd0ff6fea2086ba2bfb67f5c4184b49] | committer: Niklas Haas avcodec/libdav1d: parse DV profile 10 T.35 OBU This is thankfully passed through verbatim by libdav1d, so we can parse it in our own code. In theory, taking the DV profile from the packet-level configuration struct is redundant since there is currently only one possible DV level for AV1 (and all others would fail parsing), but this marginally future-proofs it against possible new AV1-specific profiles being added in the future. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a5d1e69b3bd0ff6fea2086ba2bfb67f5c4184b49 --- libavcodec/libdav1d.c | 25 + 1 file changed, 25 insertions(+) diff --git a/libavcodec/libdav1d.c b/libavcodec/libdav1d.c index 5c4c643696..1aa2d1f343 100644 --- a/libavcodec/libdav1d.c +++ b/libavcodec/libdav1d.c @@ -35,6 +35,7 @@ #include "bytestream.h" #include "codec_internal.h" #include "decode.h" +#include "dovi_rpu.h" #include "internal.h" #define FF_DAV1D_VERSION_AT_LEAST(x,y) \ @@ -44,6 +45,7 @@ typedef struct Libdav1dContext { AVClass *class; Dav1dContext *c; AVBufferPool *pool; +DOVIContext dovi; int pool_size; Dav1dData data; @@ -213,6 +215,7 @@ static av_cold int libdav1d_init(AVCodecContext *c) #else int threads = (c->thread_count ? c->thread_count : av_cpu_count()) * 3 / 2; #endif +const AVPacketSideData *sd; int res; av_log(c, AV_LOG_VERBOSE, "libdav1d %s\n", dav1d_version()); @@ -285,6 +288,11 @@ static av_cold int libdav1d_init(AVCodecContext *c) c->delay = res > 1 ? res : 0; #endif +dav1d->dovi.logctx = c; +dav1d->dovi.dv_profile = 10; // default for AV1 +sd = ff_get_coded_side_data(c, AV_PKT_DATA_DOVI_CONF); +if (sd && sd->size > 0) +ff_dovi_update_cfg(&dav1d->dovi, (AVDOVIDecoderConfigurationRecord *) sd->data); return 0; } @@ -579,6 +587,22 @@ static int libdav1d_receive_frame(AVCodecContext *c, AVFrame *frame) goto fail; break; } +case 0x3B: { // dolby_provider_code +int provider_oriented_code = bytestream2_get_be32(&gb); +if (itut_t35->country_code != 0xB5 || provider_oriented_code != 0x800) +break; + +res = ff_dovi_rpu_parse(&dav1d->dovi, gb.buffer, gb.buffer_end - gb.buffer); +if (res < 0) { +av_log(c, AV_LOG_WARNING, "Error parsing DOVI OBU.\n"); +break; // ignore +} + +res = ff_dovi_attach_side_data(&dav1d->dovi, frame); +if (res < 0) +goto fail; +break; +} default: // ignore unsupported provider codes break; } @@ -638,6 +662,7 @@ static av_cold int libdav1d_close(AVCodecContext *c) Libdav1dContext *dav1d = c->priv_data; av_buffer_pool_uninit(&dav1d->pool); +ff_dovi_ctx_unref(&dav1d->dovi); dav1d_data_unref(&dav1d->data); dav1d_close(&dav1d->c); ___ 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/dovi_rpu: implement support for profile 10
ffmpeg | branch: master | Niklas Haas | Fri Feb 23 21:06:20 2024 +0100| [9aecd717ab9fb45bf57329c5afeaf5e80d2a3004] | committer: Niklas Haas avcodec/dovi_rpu: implement support for profile 10 Instead of the nal_prefix, this profile inside wraps the RPU inside an EMDF container, as specified in ETSI TS 102 366. However, this DV-specific EMDF container is restricted (by the specification) to a fixed set of hard-coded parameters, which we can effecitvely treat as a magic byte sequence. Validated and tested using official Dolby sample files, which I unfortunately cannot share. However, there are public sample files available at the merge request link below. Relevant links: - https://www.etsi.org/deliver/etsi_ts/102300_102399/102366/01.04.01_60/ts_102366v010401p.pdf - https://patentimages.storage.googleapis.com/8a/0b/da/28294acaed2182/EP3588964A1.pdf - https://www.etsi.org/deliver/etsi_ts/103500_103599/103572/01.03.01_60/ts_103572v010301p.pdf - https://gitlab.com/mbunkus/mkvtoolnix/-/merge_requests/2254 > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=9aecd717ab9fb45bf57329c5afeaf5e80d2a3004 --- libavcodec/dovi_rpu.c | 45 ++--- 1 file changed, 42 insertions(+), 3 deletions(-) diff --git a/libavcodec/dovi_rpu.c b/libavcodec/dovi_rpu.c index a6b23f4dd1..529062be30 100644 --- a/libavcodec/dovi_rpu.c +++ b/libavcodec/dovi_rpu.c @@ -174,6 +174,18 @@ static inline int64_t get_se_coef(GetBitContext *gb, const AVDOVIRpuDataHeader * return 0; /* unreachable */ } +static inline unsigned get_variable_bits(GetBitContext *gb, int n) +{ +unsigned int value = get_bits(gb, n); +int read_more = get_bits1(gb); +while (read_more) { +value = (value + 1) << n; +value |= get_bits(gb, n); +read_more = get_bits1(gb); +} +return value; +} + #define VALIDATE(VAR, MIN, MAX) \ do { \ if (VAR < MIN || VAR > MAX) { \ @@ -200,9 +212,36 @@ int ff_dovi_rpu_parse(DOVIContext *s, const uint8_t *rpu, size_t rpu_size) if ((ret = init_get_bits8(gb, rpu, rpu_size)) < 0) return ret; -/* RPU header, common values */ -nal_prefix = get_bits(gb, 8); -VALIDATE(nal_prefix, 25, 25); +/* Container header */ +if (s->dv_profile == 10 /* dav1.10 */) { +/* DV inside AV1 re-uses an EMDF container skeleton, but with fixed + * values - so we can effectively treat this as a magic byte sequence. + * + * The exact fields are, as follows: + * emdf_version: f(2) = 0 + * key_id : f(3) = 6 + * emdf_payload_id : f(5) = 31 + * emdf_payload_id_ext : var(5) = 225 + * smploffste : f(1) = 0 + * duratione : f(1) = 0 + * groupide: f(1) = 0 + * codecdatae : f(1) = 0 + * discard_unknown_payload : f(1) = 1 + */ +const unsigned header_magic = 0x01be6841u; +unsigned header, emdf_payload_size; +header = get_bits_long(gb, 27); +VALIDATE(header, header_magic, header_magic); +emdf_payload_size = get_variable_bits(gb, 8); +VALIDATE(emdf_payload_size, 6, 512); +if (emdf_payload_size * 8 > get_bits_left(gb)) +return AVERROR_INVALIDDATA; +} else { +nal_prefix = get_bits(gb, 8); +VALIDATE(nal_prefix, 25, 25); +} + +/* RPU header */ rpu_type = get_bits(gb, 6); if (rpu_type != 2) { av_log(s->logctx, AV_LOG_WARNING, "Unrecognized RPU type " ___ 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/av1dec: parse DV profile 10 T.35 OBU
ffmpeg | branch: master | Niklas Haas | Fri Feb 23 21:24:32 2024 +0100| [da39a19aadcaa07553554e74309feb0528339c73] | committer: Niklas Haas avcodec/av1dec: parse DV profile 10 T.35 OBU See previous commit. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=da39a19aadcaa07553554e74309feb0528339c73 --- libavcodec/av1dec.c | 25 + libavcodec/av1dec.h | 2 ++ 2 files changed, 27 insertions(+) diff --git a/libavcodec/av1dec.c b/libavcodec/av1dec.c index bbb5634773..e6346b51db 100644 --- a/libavcodec/av1dec.c +++ b/libavcodec/av1dec.c @@ -734,6 +734,7 @@ static av_cold int av1_decode_free(AVCodecContext *avctx) ff_cbs_fragment_free(&s->current_obu); ff_cbs_close(&s->cbc); +ff_dovi_ctx_unref(&s->dovi); return 0; } @@ -828,6 +829,7 @@ static av_cold int av1_decode_init(AVCodecContext *avctx) { AV1DecContext *s = avctx->priv_data; AV1RawSequenceHeader *seq; +const AVPacketSideData *sd; int ret; s->avctx = avctx; @@ -883,6 +885,12 @@ static av_cold int av1_decode_init(AVCodecContext *avctx) ff_cbs_fragment_reset(&s->current_obu); } +s->dovi.logctx = avctx; +s->dovi.dv_profile = 10; // default for AV1 +sd = ff_get_coded_side_data(avctx, AV_PKT_DATA_DOVI_CONF); +if (sd && sd->size > 0) +ff_dovi_update_cfg(&s->dovi, (AVDOVIDecoderConfigurationRecord *) sd->data); + return ret; } @@ -936,6 +944,7 @@ static int export_itut_t35(AVCodecContext *avctx, AVFrame *frame, const AV1RawMetadataITUTT35 *itut_t35) { GetByteContext gb; +AV1DecContext *s = avctx->priv_data; int ret, provider_code; bytestream2_init(&gb, itut_t35->payload, itut_t35->payload_size); @@ -985,6 +994,22 @@ static int export_itut_t35(AVCodecContext *avctx, AVFrame *frame, return ret; break; } +case 0x3B: { // dolby_provider_code +int provider_oriented_code = bytestream2_get_be32(&gb); +if (itut_t35->itu_t_t35_country_code != 0xB5 || provider_oriented_code != 0x800) +break; + +ret = ff_dovi_rpu_parse(&s->dovi, gb.buffer, gb.buffer_end - gb.buffer); +if (ret < 0) { +av_log(avctx, AV_LOG_WARNING, "Error parsing DOVI OBU.\n"); +break; // ignore +} + +ret = ff_dovi_attach_side_data(&s->dovi, frame); +if (ret < 0) +return ret; +break; +} default: // ignore unsupported provider codes break; } diff --git a/libavcodec/av1dec.h b/libavcodec/av1dec.h index a6ad80c12a..336eb61359 100644 --- a/libavcodec/av1dec.h +++ b/libavcodec/av1dec.h @@ -31,6 +31,7 @@ #include "packet.h" #include "cbs.h" #include "cbs_av1.h" +#include "dovi_rpu.h" typedef struct AV1Frame { AVFrame *f; @@ -81,6 +82,7 @@ typedef struct AV1DecContext { AV1RawMetadataHDRCLL *cll; AV1RawOBU *mdcv_ref; ///< RefStruct reference backing mdcv AV1RawMetadataHDRMDCV *mdcv; +DOVIContext dovi; AVFifo *itut_t35_fifo; uint16_t tile_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] fftools/opt_common: show if muxer is device
ffmpeg | branch: master | Stefano Sabatini | Sun Jan 7 16:07:54 2024 +0100| [58a1386eaf770ba4969771bf0f433bc976199083] | committer: Stefano Sabatini fftools/opt_common: show if muxer is device > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=58a1386eaf770ba4969771bf0f433bc976199083 --- fftools/opt_common.c | 26 +++--- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/fftools/opt_common.c b/fftools/opt_common.c index 02d7048c42..947a226d8d 100644 --- a/fftools/opt_common.c +++ b/fftools/opt_common.c @@ -852,15 +852,22 @@ static int show_formats_devices(void *optctx, const char *opt, const char *arg, const AVOutputFormat *ofmt = NULL; const char *last_name; int is_dev; +const char *is_device_placeholder = device_only ? "" : "."; + +printf("%s:\n" + " D.%s = Demuxing supported\n" + " .E%s = Muxing supported\n" + "%s" + " ---\n", + device_only ? "Devices" : "Formats", + is_device_placeholder, is_device_placeholder, + device_only ? "": " ..d = Is a device\n"); -printf("%s\n" - " D. = Demuxing supported\n" - " .E = Muxing supported\n" - " --\n", device_only ? "Devices:" : "File formats:"); last_name = "000"; for (;;) { int decode = 0; int encode = 0; +int device = 0; const char *name = NULL; const char *long_name = NULL; @@ -875,6 +882,7 @@ static int show_formats_devices(void *optctx, const char *opt, const char *arg, name = ofmt->name; long_name = ofmt->long_name; encode= 1; +device= is_dev; } } } @@ -889,20 +897,24 @@ static int show_formats_devices(void *optctx, const char *opt, const char *arg, name = ifmt->name; long_name = ifmt->long_name; encode= 0; +device= is_dev; } -if (name && strcmp(ifmt->name, name) == 0) +if (name && strcmp(ifmt->name, name) == 0) { decode = 1; +device = is_dev; +} } } if (!name) break; last_name = name; -printf(" %c%c %-15s %s\n", +printf(" %c%c%s %-15s %s\n", decode ? 'D' : ' ', encode ? 'E' : ' ', + device_only ? "" : (device ? "d" : " "), name, -long_name ? long_name:" "); +long_name ? long_name : " "); } 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] lavf/dvenc: improve error messaging
ffmpeg | branch: master | Stefano Sabatini | Sat Jan 20 16:17:59 2024 +0100| [bce9234f1065848dcd2bf70a2c2f34258db9b774] | committer: Stefano Sabatini lavf/dvenc: improve error messaging Provide useful information about the failure in the error message, do not let the user guess. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=bce9234f1065848dcd2bf70a2c2f34258db9b774 --- libavformat/dvenc.c | 116 1 file changed, 80 insertions(+), 36 deletions(-) diff --git a/libavformat/dvenc.c b/libavformat/dvenc.c index 29d2dc47ac..0e9a6cfbb1 100644 --- a/libavformat/dvenc.c +++ b/libavformat/dvenc.c @@ -39,6 +39,7 @@ #include "libavutil/fifo.h" #include "libavutil/mathematics.h" #include "libavutil/intreadwrite.h" +#include "libavutil/pixdesc.h" #include "libavutil/timecode.h" #define MAX_AUDIO_FRAME_SIZE 192000 // 1 second of 48khz 32-bit audio @@ -308,62 +309,107 @@ static int dv_assemble_frame(AVFormatContext *s, return 0; } -static DVMuxContext* dv_init_mux(AVFormatContext* s) +static int dv_init_mux(AVFormatContext* s) { DVMuxContext *c = s->priv_data; AVStream *vst = NULL; int i; -/* we support at most 1 video and 2 audio streams */ -if (s->nb_streams > 5) -return NULL; +if (s->nb_streams > 5) { +av_log(s, AV_LOG_ERROR, + "Invalid number of streams %d, the muxer supports at most 1 video channel and 4 audio channels.\n", + s->nb_streams); +return AVERROR_INVALIDDATA; +} /* We have to sort out where audio and where video stream is */ for (i=0; inb_streams; i++) { AVStream *st = s->streams[i]; switch (st->codecpar->codec_type) { case AVMEDIA_TYPE_VIDEO: -if (vst) return NULL; -if (st->codecpar->codec_id != AV_CODEC_ID_DVVIDEO) -goto bail_out; +if (vst) { +av_log(s, AV_LOG_ERROR, + "More than one video stream found, only one is accepted.\n"); +return AVERROR_INVALIDDATA; +} +if (st->codecpar->codec_id != AV_CODEC_ID_DVVIDEO) { +av_log(s, AV_LOG_ERROR, + "Invalid codec for video stream, only DVVIDEO is supported.\n"); +return AVERROR_INVALIDDATA; +} vst = st; break; case AVMEDIA_TYPE_AUDIO: -if (c->n_ast > 1) return NULL; +if (c->n_ast > 1) { +av_log(s, AV_LOG_ERROR, + "More than two audio streams found, at most 2 are accepted.\n"); +return AVERROR_INVALIDDATA; +} /* Some checks -- DV format is very picky about its incoming streams */ -if(st->codecpar->codec_id!= AV_CODEC_ID_PCM_S16LE || - st->codecpar->ch_layout.nb_channels!= 2) -goto bail_out; +if (st->codecpar->codec_id != AV_CODEC_ID_PCM_S16LE) { +av_log(s, AV_LOG_ERROR, + "Invalid codec for stream %d, only PCM_S16LE is supported\n.", i); +return AVERROR_INVALIDDATA; +} +if (st->codecpar->ch_layout.nb_channels != 2) { +av_log(s, AV_LOG_ERROR, + "Invalid number of audio channels %d for stream %d, only 2 channels are supported\n.", + st->codecpar->ch_layout.nb_channels, i); +return AVERROR_INVALIDDATA; +} if (st->codecpar->sample_rate != 48000 && st->codecpar->sample_rate != 44100 && -st->codecpar->sample_rate != 32000) -goto bail_out; +st->codecpar->sample_rate != 32000) { +av_log(s, AV_LOG_ERROR, + "Invalid audio sample rate %d for stream %d, only 32000, 44100, and 48000 are supported.\n", + st->codecpar->sample_rate, i); +return AVERROR_INVALIDDATA; +} c->ast[c->n_ast++] = st; break; default: -goto bail_out; +av_log(s, AV_LOG_ERROR, + "Invalid media type for stream %d, only audio and video are supported.\n", i); +return AVERROR_INVALIDDATA; } } -if (!vst) -goto bail_out; +if (!vst) { +av_log(s, AV_LOG_ERROR, + "Missing video stream, must be present\n"); +return AVERROR_INVALIDDATA; +} c->sys = av_dv_codec_profile2(vst->codecpar->width, vst->codecpar->height, vst->codecpar->format, vst->time_base); -if (!c->sys) -goto bail_out; +if (!c->sys) { +av_log(s, AV_LOG_ERROR, + "Could not find a valid video profile for size:%dx%d format:%s tb:%d%d\n", + vst->codecpar->width, vst->codecpar->h
[FFmpeg-cvslog] lavf/fifo: fix typo
ffmpeg | branch: master | Stefano Sabatini | Sun Jan 28 01:21:14 2024 +0100| [53a952a7313f2c78d93a4f6805abe570fe35f96b] | committer: Stefano Sabatini lavf/fifo: fix typo > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=53a952a7313f2c78d93a4f6805abe570fe35f96b --- libavformat/fifo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/fifo.c b/libavformat/fifo.c index 94502129c6..074a46485c 100644 --- a/libavformat/fifo.c +++ b/libavformat/fifo.c @@ -90,7 +90,7 @@ typedef struct FifoThreadContext { /* Timestamp of last failure. * This is either pts in case stream time is used, - * or microseconds as returned by av_getttime_relative() */ + * or microseconds as returned by av_gettime_relative() */ int64_t last_recovery_ts; /* Number of current recovery process ___ 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".