[FFmpeg-devel] [PATCH] avcodec/bsf: switch to av_get_token to parse bsf list string
The recently added setts bsf makes use of the eval API whose expressions can contain commas. The existing parsing in av_bsf_list_parse_str() uses av_strtok to naively split the string at commas, thus preventing the use of setts filter with expressions containing commas. --- libavcodec/bsf.c | 13 +++-- 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/libavcodec/bsf.c b/libavcodec/bsf.c index 9d67ea5395..726911785d 100644 --- a/libavcodec/bsf.c +++ b/libavcodec/bsf.c @@ -520,7 +520,8 @@ static int bsf_parse_single(char *str, AVBSFList *bsf_lst) int av_bsf_list_parse_str(const char *str, AVBSFContext **bsf_lst) { AVBSFList *lst; -char *bsf_str, *buf, *dup, *saveptr; +char *bsf_str, *dup; +const char *buf; int ret; if (!str) @@ -530,18 +531,18 @@ int av_bsf_list_parse_str(const char *str, AVBSFContext **bsf_lst) if (!lst) return AVERROR(ENOMEM); -if (!(dup = buf = av_strdup(str))) { +if (!(buf = dup = av_strdup(str))) { ret = AVERROR(ENOMEM); goto end; } -while (bsf_str = av_strtok(buf, ",", &saveptr)) { +do { +bsf_str = av_get_token(&buf, ","); ret = bsf_parse_single(bsf_str, lst); +av_free(bsf_str); if (ret < 0) goto end; - -buf = NULL; -} +} while (*buf == ',' && buf++); ret = av_bsf_list_finalize(&lst, bsf_lst); end: -- 2.32.0 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] Fwd: Re: [PATCH] mxfdec.c: prefer metadata from Footer
Am 2021-06-28 21:58, schrieb emco...@ffastrans.com: Am 2021-06-28 03:00, schrieb Marton Balint: On Sun, 27 Jun 2021, emco...@ffastrans.com wrote: Am 2021-06-27 20:12, schrieb Marton Balint: Why? I though it is enough if you store the partition number in the metadata set, that way you should be able to compare if the existing metadata set is better than the current one when adding a new metadata set. Or am I missing something? OK, i just had a try on this but honestly i don't know how this could work without a very deep change of the whole mxfdec.c. The problem is that i cannot just add a field to the struct MXFMetadataSet as this points to raw data which has been read from the mxf file. I could add a field but if i initialize the value, i will automatically destroy the original raw data which was read from the mxf file. See the attached patch, that is what I had in mind. Or is it overkill? Can you test it with your dataset and see if it makes any difference? Thanks, Marton ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe". Tested your patch pleasure, thanks for the support! The "score approach" seems to work in practice exactly as my previous patch, the only thing i fear about is that it is a little harder now to foresee which metadata source is taken from a users perspective but i also think it is now more compliant than it was before. Using my test fileset which contains 4.476 mxf files (not all unique, maybe half is duplicates and most focus on xdcamhd and D10), we have 90 differences between ffprobe before your patch and after your patch. All of the differences are only in files that have openincomplete header. Most of the differences just changes the duration from a guessed one to the analyzed one: All STREAMS (NEW - OLD): "duration_ts": 3000, "duration_ts": 3099, "duration": "120.00", "duration": "123.96", FORMAT (NEW - OLD): "duration": "120.00", "duration": "123.969813", "bit_rate": "61178142", "bit_rate": "59219070", Exception one Op1b self contained file, where the "old" version did not spit out a "duration" value at all, so it was not even calculated from bitrate, it was just missing in the format section and set to 0 in the stream section. Exception two, there were 4 files (3 were samples from IRT and 1 a real world file from old omneon version) where the startc OLD was 0 and the new one was the MP starttimecode from MP, so perfect. So the conclusion is that of course your version had the same effect on my testfileset than my patch version, so thats nice. Also, the FATE samples i shared will still work and can be used for this patch. Attached a patch for adding only the fate samples. Note that these Fate tests of course fail when the patch for mxfdec.c is not applied. https://we.tl/t-MVmyG2mZHq Thanks a lot! -emcodem ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe". Unfortunately the wetransfer link for the fate samples expired, so i thought it might be a good idea to resend it as link to gdrive: https://drive.google.com/file/d/1yXTdS9RfOsduzg49vBLEshdmIzdaVQfd/view?usp=sharing Also attached the 2 patches: 1 from cus for mxfdec.c and one from myself for the corresponding fate samples. After applying the mxfdec.c patch, fate will pass with the currently existing tests but the files in the zip must be uploaded to the fate suite before applying my corresponding patch of course (otherwise the files don't exist). It would be cool if someone found the time and wants to apply this. Thanks! -emcodemFrom 499a41f0db6cfda746fd8751d4e55e910f495687 Mon Sep 17 00:00:00 2001 From: emcodem Date: Mon, 28 Jun 2021 21:54:54 +0200 Subject: [PATCH 1/1] mxf Fate tests for openincomplete and truncated --- tests/fate/mxf.mak| 10 + tests/ref/fate/mxf-probe-xdcamhd-oit | 442 ++ tests/ref/fate/mxf-probe-xdcamhd-tcfooter | 442 ++ 3 files changed, 894 insertions(+) create mode 100644 tests/ref/fate/mxf-probe-xdcamhd-oit create mode 100644 tests/ref/fate/mxf-probe-xdcamhd-tcfooter diff --git a/tests/fate/mxf.mak b/tests/fate/mxf.mak index 3a1096176f..1b7be46c64 100644 --- a/tests/fate/mxf.mak +++ b/tests/fate/mxf.mak @@ -37,6 +37,16 @@ FATE_MXF_PROBE-$(call ENCDEC2, PRORES, PCM_S24LE, MXF) += fate-mxf-probe-applehd fate-mxf-probe-applehdr10: SRC = $(TARGET_SAMPLES)/mxf/Meridian-Apple_ProResProxy-HDR10.mxf fate-mxf-probe-applehdr10: CMD = run $(PROBE_FORMAT_STREAMS_COMMAND) -i "$(SRC)" | sed -e "s/yuv422p10../yuv422p10/" +# openincom
Re: [FFmpeg-devel] [PATCH 24/24] lavfi/vf_scale: implement slice threading
Quoting Michael Niedermayer (2021-06-01 11:35:13) > On Mon, May 31, 2021 at 09:55:15AM +0200, Anton Khirnov wrote: > > --- > > libavfilter/vf_scale.c | 182 +++-- > > 1 file changed, 141 insertions(+), 41 deletions(-) > > breaks: (lower 50% is bright green) > ./ffplay -i mm-short.mpg -an -vf "tinterlace,scale=720:576:interl=1" Fixed locally, but I'm wondering why is interlaced scaling not done by default for interlaced videos. -- Anton Khirnov ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] request to remove certain mention of e-book on trac wiki page
On Thu, Jul 1, 2021 at 4:34 PM Gyan Doshi wrote: > > > On 2021-07-01 17:04, Andreas Rheinhardt wrote: > > Paul B Mahol: > >> I here hereby request that certain e-book is removed from wiki page of > >> FFmpeg. > >> > >> Reason is it uses derogatory text to criticize some FFmpeg components. > > Details please: What ebook? What derogatory text? > > We shouldn't entertain this. It is a petty reason to censor a useful > resource. > > Thank you for already picking the side. > But see > > https://trac.ffmpeg.org/wiki/BooksAndOtherExternalResources?confirm_email=&email_confirm=&action=diff&version=4&old_version=3# > > I see places in the book where the author mentions he thinks filter > usage is confusing or the docs aren't detailed enough. Although, I > suspect the complaint by Paul is more personal. > You completely ignored the fact that some filters are called useless. But just keep living in your bubble of ignorance. > > > Regards, > Gyan > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > To unsubscribe, visit link above, or email > ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe". > ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 01/24] sws: remove unnecessary braces
Pushed the non-controversial parts of the thread. Will rework and resend the rest later. -- Anton Khirnov ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH] avcodec/bsf: switch to av_get_token to parse bsf list string
On 7/3/2021 8:42 AM, Gyan Doshi wrote: The recently added setts bsf makes use of the eval API whose expressions can contain commas. The existing parsing in av_bsf_list_parse_str() uses av_strtok to naively split the string at commas, thus preventing the use of setts filter with expressions containing commas. --- libavcodec/bsf.c | 13 +++-- 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/libavcodec/bsf.c b/libavcodec/bsf.c index 9d67ea5395..726911785d 100644 --- a/libavcodec/bsf.c +++ b/libavcodec/bsf.c @@ -520,7 +520,8 @@ static int bsf_parse_single(char *str, AVBSFList *bsf_lst) int av_bsf_list_parse_str(const char *str, AVBSFContext **bsf_lst) { AVBSFList *lst; -char *bsf_str, *buf, *dup, *saveptr; +char *bsf_str, *dup; +const char *buf; int ret; if (!str) @@ -530,18 +531,18 @@ int av_bsf_list_parse_str(const char *str, AVBSFContext **bsf_lst) if (!lst) return AVERROR(ENOMEM); -if (!(dup = buf = av_strdup(str))) { +if (!(buf = dup = av_strdup(str))) { Is this av_strdup() even necessary? You could let av_get_token() update str just fine and remove both buf and dup. Or maybe just use a copy of the pointer in buf. ret = AVERROR(ENOMEM); goto end; } -while (bsf_str = av_strtok(buf, ",", &saveptr)) { +do { +bsf_str = av_get_token(&buf, ","); You can reduce the scope of bsf_str now, so declare it here. ret = bsf_parse_single(bsf_str, lst); +av_free(bsf_str); if (ret < 0) goto end; - -buf = NULL; -} +} while (*buf == ',' && buf++); You can simplify this into while (*++buf) or (*++str) if you remove the av_strdup(). It will also preserve the existing behavior of discarding the last comma in the string if it's the last character, instead of aborting with EINVAL. ret = av_bsf_list_finalize(&lst, bsf_lst); end: ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] request to remove certain mention of e-book on trac wiki page
On 7/3/2021 9:29 AM, Paul B Mahol wrote: On Thu, Jul 1, 2021 at 4:34 PM Gyan Doshi wrote: On 2021-07-01 17:04, Andreas Rheinhardt wrote: Paul B Mahol: I here hereby request that certain e-book is removed from wiki page of FFmpeg. Reason is it uses derogatory text to criticize some FFmpeg components. Details please: What ebook? What derogatory text? We shouldn't entertain this. It is a petty reason to censor a useful resource. Thank you for already picking the side. But see https://trac.ffmpeg.org/wiki/BooksAndOtherExternalResources?confirm_email=&email_confirm=&action=diff&version=4&old_version=3# I see places in the book where the author mentions he thinks filter usage is confusing or the docs aren't detailed enough. Although, I suspect the complaint by Paul is more personal. You completely ignored the fact that some filters are called useless. But just keep living in your bubble of ignorance. Does it explain why they consider them useless? Or is it just defamatory without further elaboration? Regards, Gyan ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe". ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe". ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH] avcodec/bsf: switch to av_get_token to parse bsf list string
On 2021-07-03 19:47, James Almer wrote: On 7/3/2021 8:42 AM, Gyan Doshi wrote: The recently added setts bsf makes use of the eval API whose expressions can contain commas. The existing parsing in av_bsf_list_parse_str() uses av_strtok to naively split the string at commas, thus preventing the use of setts filter with expressions containing commas. --- libavcodec/bsf.c | 13 +++-- 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/libavcodec/bsf.c b/libavcodec/bsf.c index 9d67ea5395..726911785d 100644 --- a/libavcodec/bsf.c +++ b/libavcodec/bsf.c @@ -520,7 +520,8 @@ static int bsf_parse_single(char *str, AVBSFList *bsf_lst) int av_bsf_list_parse_str(const char *str, AVBSFContext **bsf_lst) { AVBSFList *lst; - char *bsf_str, *buf, *dup, *saveptr; + char *bsf_str, *dup; + const char *buf; int ret; if (!str) @@ -530,18 +531,18 @@ int av_bsf_list_parse_str(const char *str, AVBSFContext **bsf_lst) if (!lst) return AVERROR(ENOMEM); - if (!(dup = buf = av_strdup(str))) { + if (!(buf = dup = av_strdup(str))) { Is this av_strdup() even necessary? You could let av_get_token() update str just fine and remove both buf and dup. Or maybe just use a copy of the pointer in buf. ret = AVERROR(ENOMEM); goto end; } - while (bsf_str = av_strtok(buf, ",", &saveptr)) { + do { + bsf_str = av_get_token(&buf, ","); You can reduce the scope of bsf_str now, so declare it here. ret = bsf_parse_single(bsf_str, lst); + av_free(bsf_str); if (ret < 0) goto end; - - buf = NULL; - } + } while (*buf == ',' && buf++); You can simplify this into while (*++buf) or (*++str) if you remove the av_strdup(). Won't this go out of bounds at the end? It will also preserve the existing behavior of discarding the last comma in the string if it's the last character, instead of aborting with EINVAL. ret = av_bsf_list_finalize(&lst, bsf_lst); end: ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe". ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH] avcodec/bsf: switch to av_get_token to parse bsf list string
On 7/3/2021 12:48 PM, Gyan Doshi wrote: On 2021-07-03 19:47, James Almer wrote: On 7/3/2021 8:42 AM, Gyan Doshi wrote: The recently added setts bsf makes use of the eval API whose expressions can contain commas. The existing parsing in av_bsf_list_parse_str() uses av_strtok to naively split the string at commas, thus preventing the use of setts filter with expressions containing commas. --- libavcodec/bsf.c | 13 +++-- 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/libavcodec/bsf.c b/libavcodec/bsf.c index 9d67ea5395..726911785d 100644 --- a/libavcodec/bsf.c +++ b/libavcodec/bsf.c @@ -520,7 +520,8 @@ static int bsf_parse_single(char *str, AVBSFList *bsf_lst) int av_bsf_list_parse_str(const char *str, AVBSFContext **bsf_lst) { AVBSFList *lst; - char *bsf_str, *buf, *dup, *saveptr; + char *bsf_str, *dup; + const char *buf; int ret; if (!str) @@ -530,18 +531,18 @@ int av_bsf_list_parse_str(const char *str, AVBSFContext **bsf_lst) if (!lst) return AVERROR(ENOMEM); - if (!(dup = buf = av_strdup(str))) { + if (!(buf = dup = av_strdup(str))) { Is this av_strdup() even necessary? You could let av_get_token() update str just fine and remove both buf and dup. Or maybe just use a copy of the pointer in buf. ret = AVERROR(ENOMEM); goto end; } - while (bsf_str = av_strtok(buf, ",", &saveptr)) { + do { + bsf_str = av_get_token(&buf, ","); You can reduce the scope of bsf_str now, so declare it here. ret = bsf_parse_single(bsf_str, lst); + av_free(bsf_str); if (ret < 0) goto end; - - buf = NULL; - } + } while (*buf == ',' && buf++); You can simplify this into while (*++buf) or (*++str) if you remove the av_strdup(). Won't this go out of bounds at the end? Yeah, good catch. Change it to while (*buf && *++buf) then, which will also preserve the existing behavior. It will also preserve the existing behavior of discarding the last comma in the string if it's the last character, instead of aborting with EINVAL. ret = av_bsf_list_finalize(&lst, bsf_lst); end: ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe". ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe". ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH v2] avformat/rtsp: fix timeout option
On Sun, 30. May 16:24, Andriy Gelman wrote: > From: Andriy Gelman > > 92c40ef882be115e72d2aa02f9032b7ce88f8537 added a listen_timeout option > for sdp. This allowed a user to set variable timeout in sdp which was > originally hard coded to 10 seconds. > > The commit used the initial_timeout variable to store the value. > However, in rtsp this variable is also used to infer a "listen" mode. Thus, > the timeout value could not be set when connecting to an rtsp server. > The default value of -1 would also result in a 100ms total timeout. > > This was attempted to be fixed in c8101aabee654f6d147a4d89f77fa73e18908610, > which changed the meaning of initial_timeout = -1 to be an infinite > timeout in rtsp. However, it did not address the issue that the timeout could > still not be set. Being able to set the timeout is useful because it > allows to automatically reconfigure from a udp to tcp connection in the > lower transport. > > In this commit, this is fixed by using the stimeout variable/option to > set the timeout in rtsp. > > Signed-off-by: Andriy Gelman > --- > > Patch didn't apply cleanly anymore. Rebased to master > > libavformat/rtsp.c | 12 ++-- > libavformat/rtsp.h | 2 +- > 2 files changed, 7 insertions(+), 7 deletions(-) > > diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c > index 9f509a229f..d4ab8f28bf 100644 > --- a/libavformat/rtsp.c > +++ b/libavformat/rtsp.c > @@ -94,7 +94,7 @@ const AVOption ff_rtsp_options[] = { > { "min_port", "set minimum local UDP port", OFFSET(rtp_port_min), > AV_OPT_TYPE_INT, {.i64 = RTSP_RTP_PORT_MIN}, 0, 65535, DEC|ENC }, > { "max_port", "set maximum local UDP port", OFFSET(rtp_port_max), > AV_OPT_TYPE_INT, {.i64 = RTSP_RTP_PORT_MAX}, 0, 65535, DEC|ENC }, > { "listen_timeout", "set maximum timeout (in seconds) to wait for > incoming connections (-1 is infinite, imply flag listen)", > OFFSET(initial_timeout), AV_OPT_TYPE_INT, {.i64 = -1}, INT_MIN, INT_MAX, DEC > }, > -{ "timeout", "set timeout (in microseconds) of socket TCP I/O > operations", OFFSET(stimeout), AV_OPT_TYPE_INT, {.i64 = 0}, INT_MIN, INT_MAX, > DEC }, > +{ "timeout", "set timeout (in microseconds) of socket I/O operations", > OFFSET(stimeout), AV_OPT_TYPE_INT64, {.i64 = 0}, INT_MIN, INT64_MAX, DEC }, > COMMON_OPTS(), > { "user_agent", "override User-Agent header", OFFSET(user_agent), > AV_OPT_TYPE_STRING, {.str = LIBAVFORMAT_IDENT}, 0, 0, DEC }, > { NULL }, > @@ -104,7 +104,7 @@ static const AVOption sdp_options[] = { > RTSP_FLAG_OPTS("sdp_flags", "SDP flags"), > { "custom_io", "use custom I/O", 0, AV_OPT_TYPE_CONST, {.i64 = > RTSP_FLAG_CUSTOM_IO}, 0, 0, DEC, "rtsp_flags" }, > { "rtcp_to_source", "send RTCP packets to the source address of received > packets", 0, AV_OPT_TYPE_CONST, {.i64 = RTSP_FLAG_RTCP_TO_SOURCE}, 0, 0, DEC, > "rtsp_flags" }, > -{ "listen_timeout", "set maximum timeout (in seconds) to wait for > incoming connections", OFFSET(initial_timeout), AV_OPT_TYPE_INT, {.i64 = > READ_PACKET_TIMEOUT_S}, INT_MIN, INT_MAX, DEC }, > +{ "listen_timeout", "set maximum timeout (in seconds) to wait for > incoming connections", OFFSET(stimeout), AV_OPT_TYPE_DURATION, {.i64 = > READ_PACKET_TIMEOUT_S*100}, INT_MIN, INT64_MAX, DEC }, > RTSP_MEDIATYPE_OPTS("allowed_media_types", "set media types to accept > from the server"), > COMMON_OPTS(), > { NULL }, > @@ -112,7 +112,7 @@ static const AVOption sdp_options[] = { > > static const AVOption rtp_options[] = { > RTSP_FLAG_OPTS("rtp_flags", "set RTP flags"), > -{ "listen_timeout", "set maximum timeout (in seconds) to wait for > incoming connections", OFFSET(initial_timeout), AV_OPT_TYPE_INT, {.i64 = > READ_PACKET_TIMEOUT_S}, INT_MIN, INT_MAX, DEC }, > +{ "listen_timeout", "set maximum timeout (in seconds) to wait for > incoming connections", OFFSET(stimeout), AV_OPT_TYPE_DURATION, {.i64 = > READ_PACKET_TIMEOUT_S*100}, INT_MIN, INT64_MAX, DEC }, > RTSP_MEDIATYPE_OPTS("allowed_media_types", "set media types to accept > from the server"), > COMMON_OPTS(), > { NULL }, > @@ -1874,7 +1874,7 @@ redirect: > /* open the tcp connection */ > ff_url_join(tcpname, sizeof(tcpname), lower_rtsp_proto, NULL, > host, port, > -"?timeout=%d", rt->stimeout); > +"?timeout=%"PRId64, rt->stimeout); > if ((ret = ffurl_open_whitelist(&rt->rtsp_hd, tcpname, > AVIO_FLAG_READ_WRITE, > &s->interrupt_callback, NULL, s->protocol_whitelist, > s->protocol_blacklist, NULL)) < 0) { > err = ret; > @@ -2027,7 +2027,7 @@ static int udp_read_packet(AVFormatContext *s, > RTSPStream **prtsp_st, > int n, i, ret; > struct pollfd *p = rt->p; > int *fds = NULL, fdsnum, fdsidx; > -int runs = rt->initial_timeout * 1000LL / POLLING_TIME; > +int64_t runs = rt->stimeout / POLLING_TIME / 1000; > > if
Re: [FFmpeg-devel] [PATCH 24/24] lavfi/vf_scale: implement slice threading
On Sat, Jul 03, 2021 at 03:27:36PM +0200, Anton Khirnov wrote: > Quoting Michael Niedermayer (2021-06-01 11:35:13) > > On Mon, May 31, 2021 at 09:55:15AM +0200, Anton Khirnov wrote: > > > --- > > > libavfilter/vf_scale.c | 182 +++-- > > > 1 file changed, 141 insertions(+), 41 deletions(-) > > > > breaks: (lower 50% is bright green) > > ./ffplay -i mm-short.mpg -an -vf "tinterlace,scale=720:576:interl=1" > > Fixed locally, but I'm wondering why is interlaced scaling not done by > default for interlaced videos. IIRC the flags where quite unreliable. If we have reliable knowledge about interlacing it certainly should be used automatically thx [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Does the universe only have a finite lifespan? No, its going to go on forever, its just that you wont like living in it. -- Hiranya Peiri signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 1/3] avformat/matroskadec: Reset state also on failure in matroska_reset_status()
On Fri, Jul 02, 2021 at 06:17:58PM +0200, Andreas Rheinhardt wrote: > Michael Niedermayer: > > The calling code does not handle failures and will fail with assertion > > failures later. > > Seeking can always fail even when the position was previously read. > > > > Fixes: Assertion failure > > Fixes: > > 35253/clusterfuzz-testcase-minimized-ffmpeg_dem_MATROSKA_fuzzer-4693059982983168 > > > > Found-by: continuous fuzzing process > > https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg > > Signed-off-by: Michael Niedermayer > > --- > > libavformat/matroskadec.c | 19 --- > > 1 file changed, 12 insertions(+), 7 deletions(-) > > > > diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c > > index 356a02339c..a0e6e0cf8b 100644 > > --- a/libavformat/matroskadec.c > > +++ b/libavformat/matroskadec.c > > @@ -804,20 +804,22 @@ static int matroska_read_close(AVFormatContext *s); > > static int matroska_reset_status(MatroskaDemuxContext *matroska, > > uint32_t id, int64_t position) > > { > > +int64_t err = 0; > > if (position >= 0) { > > -int64_t err = avio_seek(matroska->ctx->pb, position, SEEK_SET); > > -if (err < 0) > > -return err; > > -} > > +err = avio_seek(matroska->ctx->pb, position, SEEK_SET); > > +if (err > 0) > > +err = 0; > > +} else > > +position = avio_tell(matroska->ctx->pb); > > > > matroska->current_id= id; > > matroska->num_levels= 1; > > matroska->unknown_count = 0; > > -matroska->resync_pos = avio_tell(matroska->ctx->pb); > > +matroska->resync_pos= position; > > if (id) > > matroska->resync_pos -= (av_log2(id) + 7) / 8; > > > > -return 0; > > +return err; > > The changes here will make the demuxer update its internal state as if > it had seeked to its target level-1-element, even though it didn't. Is > this really good? I dont know. Ive not seen this issue happen in reality just in a fuzzer environment. [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB In fact, the RIAA has been known to suggest that students drop out of college or go to community college in order to be able to afford settlements. -- The RIAA signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v2] avcodec/bsf: switch to av_get_token to parse bsf list string
The recently added setts bsf makes use of the eval API whose expressions can contain commas. The existing parsing in av_bsf_list_parse_str() uses av_strtok to naively split the string at commas, thus preventing the use of setts filter with expressions containing commas. av_get_token can work with escaped commas, allowing full use of setts. --- libavcodec/bsf.c | 15 --- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/libavcodec/bsf.c b/libavcodec/bsf.c index 9d67ea5395..0305244f8d 100644 --- a/libavcodec/bsf.c +++ b/libavcodec/bsf.c @@ -520,7 +520,6 @@ static int bsf_parse_single(char *str, AVBSFList *bsf_lst) int av_bsf_list_parse_str(const char *str, AVBSFContext **bsf_lst) { AVBSFList *lst; -char *bsf_str, *buf, *dup, *saveptr; int ret; if (!str) @@ -530,24 +529,18 @@ int av_bsf_list_parse_str(const char *str, AVBSFContext **bsf_lst) if (!lst) return AVERROR(ENOMEM); -if (!(dup = buf = av_strdup(str))) { -ret = AVERROR(ENOMEM); -goto end; -} - -while (bsf_str = av_strtok(buf, ",", &saveptr)) { +do { +char *bsf_str = av_get_token(&str, ","); ret = bsf_parse_single(bsf_str, lst); +av_free(bsf_str); if (ret < 0) goto end; - -buf = NULL; -} +} while (*str && *++str); ret = av_bsf_list_finalize(&lst, bsf_lst); end: if (ret < 0) av_bsf_list_free(&lst); -av_free(dup); return ret; } -- 2.32.0 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 1/3] avformat/rtsp: Fix floating point exception for low min/max port range
On Sun, 04. Apr 11:36, Andriy Gelman wrote: > From: Andriy Gelman > > Fixed by setting port offset to zero when it cannot be computed. > > To reproduce: > $ ffmpeg -min_port 32000 -max_port 32001 -i > rtsp://wowzaec2demo.streamlock.net/vod/mp4:BigBuckBunny_115k.mov -f null - > [1]303871 floating point exception (core dumped) > > Signed-off-by: Andriy Gelman > --- > libavformat/rtsp.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c > index 25bdf475b3..76efbf42cd 100644 > --- a/libavformat/rtsp.c > +++ b/libavformat/rtsp.c > @@ -1446,7 +1446,7 @@ int ff_rtsp_make_setup_request(AVFormatContext *s, > const char *host, int port, >int lower_transport, const char > *real_challenge) > { > RTSPState *rt = s->priv_data; > -int rtx = 0, j, i, err, interleave = 0, port_off; > +int rtx = 0, j, i, err, interleave = 0, port_off = 0; > RTSPStream *rtsp_st; > RTSPMessageHeader reply1, *reply = &reply1; > char cmd[MAX_URL_SIZE]; > @@ -1465,9 +1465,11 @@ int ff_rtsp_make_setup_request(AVFormatContext *s, > const char *host, int port, > /* Choose a random starting offset within the first half of the > * port range, to allow for a number of ports to try even if the offset > * happens to be at the end of the random range. */ > +if (rt->rtp_port_max - rt->rtp_port_min > 1) { > port_off = av_get_random_seed() % ((rt->rtp_port_max - > rt->rtp_port_min)/2); > /* even random offset */ > port_off -= port_off & 0x01; > +} > > for (j = rt->rtp_port_min + port_off, i = 0; i < rt->nb_rtsp_streams; > ++i) { > char transport[MAX_URL_SIZE]; > -- > 2.31.0 > ping for the set -- Andriy ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH] avcodec/mjpegdec: Try to continue decoding on zero quant matrix value
From: Andriy Gelman A zero value in the quantization matrix is invalid but in practice will just set the transform coefficient to zero after inverse quantization. Try to continue decoding if the AV_EF_EXPLODE flag is not set. Fixes ticket #9287. Signed-off-by: Andriy Gelman --- The last frame in the sample of the ticket does not decode because the input file appears truncated. Something like the following patch would still be needed to output the final frame: https://patchwork.ffmpeg.org/project/ffmpeg/patch/20210627135307.14008-1-mich...@niedermayer.cc/ libavcodec/mjpegdec.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c index 02a987fd0c..8172dca513 100644 --- a/libavcodec/mjpegdec.c +++ b/libavcodec/mjpegdec.c @@ -217,8 +217,10 @@ int ff_mjpeg_decode_dqt(MJpegDecodeContext *s) for (i = 0; i < 64; i++) { s->quant_matrixes[index][i] = get_bits(&s->gb, pr ? 16 : 8); if (s->quant_matrixes[index][i] == 0) { -av_log(s->avctx, AV_LOG_ERROR, "dqt: 0 quant value\n"); -return AVERROR_INVALIDDATA; +int log_level = s->avctx->err_recognition & AV_EF_EXPLODE ? AV_LOG_ERROR : AV_LOG_WARNING; +av_log(s->avctx, log_level, "dqt: 0 quant value\n"); +if (s->avctx->err_recognition & AV_EF_EXPLODE) +return AVERROR_INVALIDDATA; } } -- 2.32.0 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH v2] avcodec/bsf: switch to av_get_token to parse bsf list string
On 7/3/2021 1:54 PM, Gyan Doshi wrote: The recently added setts bsf makes use of the eval API whose expressions can contain commas. The existing parsing in av_bsf_list_parse_str() uses av_strtok to naively split the string at commas, thus preventing the use of setts filter with expressions containing commas. av_get_token can work with escaped commas, allowing full use of setts. --- libavcodec/bsf.c | 15 --- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/libavcodec/bsf.c b/libavcodec/bsf.c index 9d67ea5395..0305244f8d 100644 --- a/libavcodec/bsf.c +++ b/libavcodec/bsf.c @@ -520,7 +520,6 @@ static int bsf_parse_single(char *str, AVBSFList *bsf_lst) int av_bsf_list_parse_str(const char *str, AVBSFContext **bsf_lst) { AVBSFList *lst; -char *bsf_str, *buf, *dup, *saveptr; int ret; if (!str) @@ -530,24 +529,18 @@ int av_bsf_list_parse_str(const char *str, AVBSFContext **bsf_lst) if (!lst) return AVERROR(ENOMEM); -if (!(dup = buf = av_strdup(str))) { -ret = AVERROR(ENOMEM); -goto end; -} - -while (bsf_str = av_strtok(buf, ",", &saveptr)) { +do { +char *bsf_str = av_get_token(&str, ","); ret = bsf_parse_single(bsf_str, lst); +av_free(bsf_str); if (ret < 0) goto end; - -buf = NULL; -} +} while (*str && *++str); ret = av_bsf_list_finalize(&lst, bsf_lst); end: if (ret < 0) av_bsf_list_free(&lst); -av_free(dup); return ret; } Should be ok. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] request to remove certain mention of e-book on trac wiki page
On Sat, Jul 3, 2021 at 4:50 PM James Almer wrote: > On 7/3/2021 9:29 AM, Paul B Mahol wrote: > > On Thu, Jul 1, 2021 at 4:34 PM Gyan Doshi wrote: > > > >> > >> > >> On 2021-07-01 17:04, Andreas Rheinhardt wrote: > >>> Paul B Mahol: > I here hereby request that certain e-book is removed from wiki page of > FFmpeg. > > Reason is it uses derogatory text to criticize some FFmpeg components. > >>> Details please: What ebook? What derogatory text? > >> > >> We shouldn't entertain this. It is a petty reason to censor a useful > >> resource. > >> > >> > > Thank you for already picking the side. > > > > > >> But see > >> > >> > https://trac.ffmpeg.org/wiki/BooksAndOtherExternalResources?confirm_email=&email_confirm=&action=diff&version=4&old_version=3# > >> > >> I see places in the book where the author mentions he thinks filter > >> usage is confusing or the docs aren't detailed enough. Although, I > >> suspect the complaint by Paul is more personal. > >> > > > > You completely ignored the fact that some filters are called useless. > > > > But just keep living in your bubble of ignorance. > > Does it explain why they consider them useless? Or is it just defamatory > without further elaboration? > No matter what explanation is, it is expressing wrong stuff. > > > > > > > > >> > >> > >> Regards, > >> Gyan > >> ___ > >> ffmpeg-devel mailing list > >> ffmpeg-devel@ffmpeg.org > >> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > >> > >> To unsubscribe, visit link above, or email > >> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe". > >> > > ___ > > ffmpeg-devel mailing list > > ffmpeg-devel@ffmpeg.org > > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > > > To unsubscribe, visit link above, or email > > ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe". > > > > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > To unsubscribe, visit link above, or email > ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe". > ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] request to remove certain mention of e-book on trac wiki page
You completely ignored the fact that some filters are called useless. But just keep living in your bubble of ignorance. Does it explain why they consider them useless? Or is it just defamatory without further elaboration? I'm the author of the book. You can download the PDF here: http://www.astro-electronic.de/FFmpeg_Book.pdf The book contains more than 300 pages about FFmpeg. If you search for "useless", you find three instances. Please decide yourself if these three words justify to remove the whole book from the wiki page. Michael ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 1/2] avcodec/setts_bsf: actually store the current packet's timestamps to be usable by the next
Before this change, the PREV_OUTPTS and PREV_OUTDTS constants always evaluated to AV_NOPTS_VALUE. Signed-off-by: James Almer --- libavcodec/setts_bsf.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libavcodec/setts_bsf.c b/libavcodec/setts_bsf.c index 2558e38f51..1e43036ee1 100644 --- a/libavcodec/setts_bsf.c +++ b/libavcodec/setts_bsf.c @@ -171,10 +171,10 @@ static int setts_filter(AVBSFContext *ctx, AVPacket *pkt) new_dts = new_ts; } -s->var_values[VAR_PREV_INPTS] = pkt->pts; -s->var_values[VAR_PREV_INDTS] = pkt->dts; -s->var_values[VAR_PREV_OUTPTS] = new_pts; -s->var_values[VAR_PREV_OUTDTS] = new_dts; +s->prev_inpts = pkt->pts; +s->prev_indts = pkt->dts; +s->prev_outpts = new_pts; +s->prev_outdts = new_dts; pkt->pts = new_pts; pkt->dts = new_dts; -- 2.32.0 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 2/2] avcodec/setts_bsf: add a NOPTS constant
Signed-off-by: James Almer --- libavcodec/setts_bsf.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libavcodec/setts_bsf.c b/libavcodec/setts_bsf.c index 1e43036ee1..d7d13d2652 100644 --- a/libavcodec/setts_bsf.c +++ b/libavcodec/setts_bsf.c @@ -44,6 +44,7 @@ static const char *const var_names[] = { "STARTDTS",///< DTS at start of movie "TB", ///< timebase of the stream "SR", ///< sample rate of the stream +"NOPTS", ///< The AV_NOPTS_VALUE constant NULL }; @@ -61,6 +62,7 @@ enum var_name { VAR_STARTDTS, VAR_TB, VAR_SR, +VAR_NOPTS, VAR_VARS_NB }; @@ -121,6 +123,7 @@ static int setts_init(AVBSFContext *ctx) s->prev_indts = AV_NOPTS_VALUE; s->prev_outpts = AV_NOPTS_VALUE; s->prev_outdts = AV_NOPTS_VALUE; +s->var_values[VAR_NOPTS] = AV_NOPTS_VALUE; return 0; } -- 2.32.0 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] Fwd: Re: [PATCH] mxfdec.c: prefer metadata from Footer
lör 2021-07-03 klockan 15:13 +0200 skrev emco...@ffastrans.com: > > Unfortunately the wetransfer link for the fate samples expired, so i > thought it might be a good idea to resend it as link to gdrive: > https://drive.google.com/file/d/1yXTdS9RfOsduzg49vBLEshdmIzdaVQfd/view?usp=sharing > > Also attached the 2 patches: 1 from cus for mxfdec.c and one from myself > for the corresponding fate samples. > After applying the mxfdec.c patch, fate will pass with the currently > existing tests but the files in the zip must be uploaded to the fate > suite before applying my corresponding patch of course (otherwise the > files don't exist). > > It would be cool if someone found the time and wants to apply this. The patch works (except for the samples not being in FATE) > +// Index Table is special because it might be added manually without > +// partition and we iterate thorugh all instances of them. Also some > files > +// use the same Instance UID for different index tables... > +if (type != IndexTableSegment) { > +for (int i = 0; i < mxf->metadata_sets_count; i++) { > +if (!memcmp((*metadata_set)->uid, mxf->metadata_sets[i]->uid, > 16) && type == mxf->metadata_sets[i]->type) { > +MXFPartition *old_p = mxf->metadata_sets[i]->partition; > +int old_s = partition_score(old_p); > +int new_s = partition_score(new_p); > +if (old_s > new_s || old_s == new_s && old_p->this_partition > > new_p->this_partition) { > + mxf_free_metadataset(metadata_set, 1); > + return 0; This seems asymmetric. Shouldn't this also delete metadata sets that metadata_set scores higher than? /Tomas ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH] avformat/utils: Ignore negative duration in codec_info_duration computation
Fixes: signed integer overflow: -5994697211974418462 + -325530713450286 cannot be represented in type 'long' Fixes: 35332/clusterfuzz-testcase-minimized-ffmpeg_dem_MATROSKA_fuzzer-5868035117285376 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavformat/utils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/utils.c b/libavformat/utils.c index 0df14682a4..2974f3739e 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -3842,7 +3842,7 @@ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options) av_packet_unref(pkt1); break; } -if (pkt->duration) { +if (pkt->duration > 0) { if (avctx->codec_type == AVMEDIA_TYPE_SUBTITLE && pkt->pts != AV_NOPTS_VALUE && st->start_time != AV_NOPTS_VALUE && pkt->pts >= st->start_time && (uint64_t)pkt->pts - st->start_time < INT64_MAX ) { -- 2.17.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 2/3] doc/encoders: Add svtav1-params option for svtav1
From: Jun Zhao Signed-off-by: Jun Zhao --- doc/encoders.texi | 4 1 file changed, 4 insertions(+) diff --git a/doc/encoders.texi b/doc/encoders.texi index 4c38996372..4df6066304 100644 --- a/doc/encoders.texi +++ b/doc/encoders.texi @@ -1798,6 +1798,10 @@ Set log2 of the number of rows of tiles to use (0-6). @item tile_columns Set log2 of the number of columns of tiles to use (0-4). +@item svtav1-params +Set SVT-AV1 options using a list of @var{key}=@var{value} couples separated +by ":". See @command{SvtAv1EncApp --help} for a list of options. + @end table @section libkvazaar -- 2.17.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 1/3] lavc/libsvtav1: Enable svtav1-params like x264-params in libx264
From: Jun Zhao Enabled the svtav1-params, then we can set all the params Signed-off-by: Jun Zhao --- libavcodec/libsvtav1.c | 337 + 1 file changed, 337 insertions(+) diff --git a/libavcodec/libsvtav1.c b/libavcodec/libsvtav1.c index fabc4e6428..9d72a35f6c 100644 --- a/libavcodec/libsvtav1.c +++ b/libavcodec/libsvtav1.c @@ -71,6 +71,8 @@ typedef struct SvtContext { int tile_columns; int tile_rows; + +AVDictionary *svt_av1_params; } SvtContext; static const struct { @@ -146,11 +148,334 @@ static int alloc_buffer(EbSvtAv1EncConfiguration *config, SvtContext *svt_enc) } +static void set_asm_type(EbSvtAv1EncConfiguration *p, const char *value) +{ +const struct { +const char *name; +CPU_FLAGS flags; +} param_maps[] = { +{"c", 0}, +{"0", 0}, + +{"mmx", (CPU_FLAGS_MMX << 1) - 1}, +{"1", (CPU_FLAGS_MMX << 1) - 1}, + +{"sse", (CPU_FLAGS_SSE << 1) - 1}, +{"2", (CPU_FLAGS_SSE << 1) - 1}, + +{"sse2", (CPU_FLAGS_SSE2 << 1) - 1}, +{"3",(CPU_FLAGS_SSE2 << 1) - 1}, + +{"sse3", (CPU_FLAGS_SSE3 << 1) - 1}, +{"4",(CPU_FLAGS_SSE3 << 1) - 1}, + +{"ssse3", (CPU_FLAGS_SSSE3 << 1) - 1}, +{"5", (CPU_FLAGS_SSSE3 << 1) - 1}, + +{"sse4_1", (CPU_FLAGS_SSE4_1 << 1) - 1}, +{"6", (CPU_FLAGS_SSE4_1 << 1) - 1}, + +{"sse4_2", (CPU_FLAGS_SSE4_2 << 1) - 1}, +{"7", (CPU_FLAGS_SSE4_2 << 1) - 1}, + +{"avx", (CPU_FLAGS_AVX << 1) - 1}, +{"8", (CPU_FLAGS_AVX << 1) - 1}, + +{"avx2", (CPU_FLAGS_AVX2 << 1) - 1}, +{"9",(CPU_FLAGS_AVX2 << 1) - 1}, + +{"avx512", (CPU_FLAGS_AVX512VL << 1) - 1}, +{"10", (CPU_FLAGS_AVX512VL << 1) - 1}, + +{"max", CPU_FLAGS_ALL}, +{"11", CPU_FLAGS_ALL}, +}; +const uint32_t para_map_size = FF_ARRAY_ELEMS(param_maps); +uint32_t i; + +for (i = 0; i < para_map_size; ++i) { +if (strcmp(value, param_maps[i].name) == 0) { +p->use_cpu_flags = param_maps[i].flags; +return; +} +} + +p->use_cpu_flags = CPU_FLAGS_INVALID; +}; + +static void set_level(EbSvtAv1EncConfiguration *p, const char *value) +{ +if (strtoul(value, NULL, 0) != 0 || strcmp(value, "0") == 0) +p->level = (uint32_t)(10 * strtod(value, NULL)); +else +p->level = 999; +}; + +static void set_cfg_crf(EbSvtAv1EncConfiguration *p, const char *value) +{ +p->qp = strtoul(value, NULL, 0); +p->rate_control_mode = 0; +p->enable_tpl_la = 1; +} + +#define SVT_PARAM_BAD_NAME (-1) +#define SVT_PARAM_BAD_VALUE(-2) +#define SVT_PARAM_ALLOC_FAILED (-3) +static int svt_param_parse(EbSvtAv1EncConfiguration *p, const char *name, const char *value ) +{ +char *name_buf = NULL; +int b_error = 0; +int errortype = SVT_PARAM_BAD_VALUE; +int name_was_bool; +int value_was_null = !value; + +if (!name) +return SVT_PARAM_BAD_NAME; +if (!value) +value = "true"; + +if (value[0] == '=') +value++; + +if (strchr(name, '_')) { // s/_/-/g +char *c; +name_buf = av_strdup(name); +if (!name_buf) +return SVT_PARAM_ALLOC_FAILED; +while ((c = strchr(name_buf, '_'))) +*c = '-'; +name = name_buf; +} + +name_was_bool = 0; + +#define OPT(STR) else if (!strcmp(name, STR)) +#define OPT2(STR0, STR1) else if (!strcmp(name, STR0) || !strcmp(name, STR1)) +if (0) +; +OPT2("preset", "enc-mode") +p->enc_mode = (uint8_t)strtoul(value, NULL, 0); + +/* + * Encoder Global Options + */ +OPT("pred-struct") +p->pred_structure = (uint8_t)strtol(value, NULL, 0); + +OPT("profile") +p->profile = strtol(value, NULL, 0); +OPT("tier") +p->tier = strtol(value, NULL, 0); +OPT("level") +set_level(p, value); + +OPT("fps") { +p->frame_rate = strtoul(value, NULL, 0); +if (p->frame_rate <= 1000) { +p->frame_rate = p->frame_rate << 16; +} +} +OPT("fps-num") +p->frame_rate_numerator = strtoul(value, NULL, 0); +OPT("fps-denom") +p->frame_rate_denominator = strtoul(value, NULL, 0); + +OPT("hierarchical-levels") +p->hierarchical_levels = strtol(value, NULL, 0); + +OPT("asm") +set_asm_type(p, value); +OPT("lp") +p->logical_processors = (uint32_t)strtoul(value, NULL, 0); +OPT("unpin") +p->unpin = (uint32_t)strtoul(value, NULL, 0); +OPT("ss") +p->target_socket = (int32_t)strtol(value, NULL, 0); + +/* + * Rate Control Options + */ +OPT("rc") +p->rate_control_mode = strtoul(value, NULL, 0); +OPT("crf") +set_cfg_crf(p, value); +OPT("max-qp") +p->max_qp_allowed = strtoul(value, NULL, 0); +OPT("min-qp") +p->min_qp_allowed = strtoul(
[FFmpeg-devel] [PATCH 3/3] lavc:libsvtav1: Update SVT-AV1 new repo
From: Jun Zhao SVT-AV1 moved the repo from github to gitlab. Signed-off-by: Jun Zhao --- doc/general_contents.texi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/general_contents.texi b/doc/general_contents.texi index 354899ad17..f3f4feab70 100644 --- a/doc/general_contents.texi +++ b/doc/general_contents.texi @@ -263,7 +263,7 @@ to @file{./configure}. FFmpeg can make use of the Scalable Video Technology for AV1 library for AV1 encoding. -Go to @url{https://github.com/OpenVisualCloud/SVT-AV1/} and follow the instructions +Go to @url{https://gitlab.com/AOMediaCodec/SVT-AV1/} and follow the instructions for installing the library. Then pass @code{--enable-libsvtav1} to configure to enable it. -- 2.17.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH] fftools/ffmpeg: accelerate seeking while reading input at native frame rate
From: Linjie Fu Skip the logic of frame rate emulation until the input reaches the specified start time. Test CMD: $ffmpeg -re -ss 30 -i input.mp4 -pix_fmt yuv420p -f sdl2 - Before the patch: first time to got frame, it takes 257305 us After this patch: first time to got frame, it takes 48879 us Signed-off-by: Linjie Fu --- fftools/ffmpeg.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c index e97d879cb3..851f23ffdb 100644 --- a/fftools/ffmpeg.c +++ b/fftools/ffmpeg.c @@ -4223,6 +4223,8 @@ static int get_input_packet(InputFile *f, AVPacket **pkt) int i; for (i = 0; i < f->nb_streams; i++) { InputStream *ist = input_streams[f->ist_index + i]; +if (!ist->got_output) +continue; int64_t pts = av_rescale(ist->dts, 100, AV_TIME_BASE); int64_t now = av_gettime_relative() - ist->start; if (pts > now) -- 2.31.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH v2] avcodec/bsf: switch to av_get_token to parse bsf list string
On 2021-07-03 23:05, James Almer wrote: On 7/3/2021 1:54 PM, Gyan Doshi wrote: The recently added setts bsf makes use of the eval API whose expressions can contain commas. The existing parsing in av_bsf_list_parse_str() uses av_strtok to naively split the string at commas, thus preventing the use of setts filter with expressions containing commas. av_get_token can work with escaped commas, allowing full use of setts. --- libavcodec/bsf.c | 15 --- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/libavcodec/bsf.c b/libavcodec/bsf.c index 9d67ea5395..0305244f8d 100644 --- a/libavcodec/bsf.c +++ b/libavcodec/bsf.c @@ -520,7 +520,6 @@ static int bsf_parse_single(char *str, AVBSFList *bsf_lst) int av_bsf_list_parse_str(const char *str, AVBSFContext **bsf_lst) { AVBSFList *lst; - char *bsf_str, *buf, *dup, *saveptr; int ret; if (!str) @@ -530,24 +529,18 @@ int av_bsf_list_parse_str(const char *str, AVBSFContext **bsf_lst) if (!lst) return AVERROR(ENOMEM); - if (!(dup = buf = av_strdup(str))) { - ret = AVERROR(ENOMEM); - goto end; - } - - while (bsf_str = av_strtok(buf, ",", &saveptr)) { + do { + char *bsf_str = av_get_token(&str, ","); ret = bsf_parse_single(bsf_str, lst); + av_free(bsf_str); if (ret < 0) goto end; - - buf = NULL; - } + } while (*str && *++str); ret = av_bsf_list_finalize(&lst, bsf_lst); end: if (ret < 0) av_bsf_list_free(&lst); - av_free(dup); return ret; } Should be ok. Thanks. Pushed as 301d275301d72387732ccdc526babaf984ddafe5 Gyan ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".