Re: [FFmpeg-devel] [PATCH 2/2] lavu/tests/opts: add tests for filepath options
On 5 Mar 2022, at 20:16, Michael Niedermayer wrote: > On Fri, Mar 04, 2022 at 04:03:07PM +0100, Niklas Haas wrote: >> From: Niklas Haas >> >> Using the venerable HEADER.txt as a small file to load. >> --- >> libavutil/tests/opt.c| 38 +- >> tests/fate/libavutil.mak | 2 +- >> tests/ref/fate/opt | 4 >> 3 files changed, 42 insertions(+), 2 deletions(-) > > Please add tests which tries to load > id_rsa > ~/.ssh/id_rsa > shadow > /etc/shadow > .bash_history > ... > > The idea here is of course that such attempts fail There is absolutely no way we can or should try to implement a path based blacklist. Untrusted inputs should be sanitised externally by whichever script is being used to call ffmpeg. > Also document the security implications of this feature in > doc/APIchanges / release notes if there is a security implication > > Adjusting the parameters of most components could previously > not read arbitrary files so a application could previously > pass a string from a untrusted user to it. > If this changes it needs to be justfied and documented > If it doesnt change and its still safe that should be documented. > If it depends on whitelists and callbacks that should be actually implemented > in ffmpeg and the relevant examples > > And i do like this feature, if it can be done without security issues There aren't any extra security implications here, if a user is allowed to specify filter arguments themselves then they can already use the movie/amovie filter etc. This new option is just a way to unify the way in which filters which already (and will) require to load files can do so. -- J. Dekker ___ 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 v7 3/3] libavformat: Added DFPWM WAV container support
This commit adds support for storing DFPWM audio in a WAV container. It uses the WAVEFORMATEXTENSIBLE structure, following these conventions: https://gist.github.com/MCJack123/90c24b64c8e626c7f130b57e9800962c The implementation is very simple: it just adds the GUID to the list of WAV GUIDs, and modifies the WAV muxer to always use WAVEFORMATEXTENSIBLE format with that GUID. This creates a standard container format for DFPWM besides raw data. It will allow users to transfer DFPWM audio in a standard container format, with the sample rate and channel count contained in the file as opposed to being an external parameter as in the raw format. This format is already supported in my AUKit library, which is the CC analog to libav (albeit much smaller). Support in other applications is TBD. Signed-off-by: Jack Bruienne --- libavformat/riff.c| 3 +++ libavformat/riffenc.c | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/libavformat/riff.c b/libavformat/riff.c index 0c19d3f..f098c1d 100644 --- a/libavformat/riff.c +++ b/libavformat/riff.c @@ -587,6 +587,8 @@ const AVCodecTag ff_codec_wav_tags[] = { { AV_CODEC_ID_AAC, 0xA106 }, { AV_CODEC_ID_SPEEX, 0xA109 }, { AV_CODEC_ID_FLAC,0xF1AC }, +/* DFPWM does not have an assigned format tag; it uses a GUID in WAVEFORMATEX instead */ +{ AV_CODEC_ID_DFPWM, 0xFFFE }, { AV_CODEC_ID_ADPCM_SWF, ('S' << 8) + 'F' }, /* HACK/FIXME: Does Vorbis in WAV/AVI have an (in)official ID? */ { AV_CODEC_ID_VORBIS, ('V' << 8) + 'o' }, @@ -637,5 +639,6 @@ const AVCodecGuid ff_codec_wav_guids[] = { { AV_CODEC_ID_EAC3, { 0xAF, 0x87, 0xFB, 0xA7, 0x02, 0x2D, 0xFB, 0x42, 0xA4, 0xD4, 0x05, 0xCD, 0x93, 0x84, 0x3B, 0xDD } }, { AV_CODEC_ID_MP2, { 0x2B, 0x80, 0x6D, 0xE0, 0x46, 0xDB, 0xCF, 0x11, 0xB4, 0xD1, 0x00, 0x80, 0x5F, 0x6C, 0xBB, 0xEA } }, { AV_CODEC_ID_ADPCM_AGM,{ 0x82, 0xEC, 0x1F, 0x6A, 0xCA, 0xDB, 0x19, 0x45, 0xBD, 0xE7, 0x56, 0xD3, 0xB3, 0xEF, 0x98, 0x1D } }, +{ AV_CODEC_ID_DFPWM,{ 0x3A, 0xC1, 0xFA, 0x38, 0x81, 0x1D, 0x43, 0x61, 0xA4, 0x0D, 0xCE, 0x53, 0xCA, 0x60, 0x7C, 0xD1 } }, { AV_CODEC_ID_NONE } }; diff --git a/libavformat/riffenc.c b/libavformat/riffenc.c index ffccfa3..96750e7 100644 --- a/libavformat/riffenc.c +++ b/libavformat/riffenc.c @@ -81,7 +81,7 @@ int ff_put_wav_header(AVFormatContext *s, AVIOContext *pb, par->channels == 1 && par->channel_layout && par->channel_layout != AV_CH_LAYOUT_MONO || par->channels == 2 && par->channel_layout && par->channel_layout != AV_CH_LAYOUT_STEREO || par->sample_rate > 48000 || - par->codec_id == AV_CODEC_ID_EAC3 || + par->codec_id == AV_CODEC_ID_EAC3 || par->codec_id == AV_CODEC_ID_DFPWM || av_get_bits_per_sample(par->codec_id) > 16; if (waveformatextensible) @@ -188,7 +188,7 @@ int ff_put_wav_header(AVFormatContext *s, AVIOContext *pb, /* dwChannelMask */ avio_wl32(pb, write_channel_mask ? par->channel_layout : 0); /* GUID + next 3 */ -if (par->codec_id == AV_CODEC_ID_EAC3) { +if (par->codec_id == AV_CODEC_ID_EAC3 || par->codec_id == AV_CODEC_ID_DFPWM) { ff_put_guid(pb, ff_get_codec_guid(par->codec_id, ff_codec_wav_guids)); } else { avio_wl32(pb, par->codec_tag); ___ 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 v7 2/3] libavformat: Add DFPWM raw format
This patch builds on my previous DFPWM codec patch, adding a raw audio format to be able to read/write the raw files that are most commonly used (as no other container format supports it yet). The muxers are mostly copied from the PCM demuxer and the raw muxers, as DFPWM is typically stored as raw data. Please see the previous patch for more information on DFPWM. Changes since v4: Fixed descriptions of formats. Changes since v2/v3: Removed unused MIME parsing code, and added channels option. Signed-off-by: Jack Bruienne --- Changelog | 2 +- MAINTAINERS | 1 + doc/general_contents.texi | 1 + libavformat/Makefile | 2 + libavformat/allformats.c | 2 + libavformat/dfpwmdec.c| 82 +++ libavformat/rawenc.c | 13 +++ libavformat/version.h | 4 +- 8 files changed, 104 insertions(+), 3 deletions(-) create mode 100644 libavformat/dfpwmdec.c diff --git a/Changelog b/Changelog index f3249fe..ac614f8 100644 --- a/Changelog +++ b/Changelog @@ -5,7 +5,7 @@ version 5.1: - dialogue enhance audio filter - dropped obsolete XvMC hwaccel - pcm-bluray encoder -- DFPWM audio encoder/decoder +- DFPWM audio encoder/decoder and raw muxer/demuxer version 5.0: diff --git a/MAINTAINERS b/MAINTAINERS index 57b6f33..931cf4b 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -416,6 +416,7 @@ Muxers/Demuxers: dashdec.c Steven Liu dashenc.c Karthick Jeyapal daud.cReimar Doeffinger + dfpwmdec.cJack Bruienne dss.c Oleksij Rempel dtsdec.c foo86 dtshddec.cPaul B Mahol diff --git a/doc/general_contents.texi b/doc/general_contents.texi index 14aeaed..fcd9da1 100644 --- a/doc/general_contents.texi +++ b/doc/general_contents.texi @@ -578,6 +578,7 @@ library: @item raw aptX @tab X @tab X @item raw aptX HD @tab X @tab X @item raw Chinese AVS video @tab X @tab X +@item raw DFPWM @tab X @tab X @item raw Dirac @tab X @tab X @item raw DNxHD @tab X @tab X @item raw DTS @tab X @tab X diff --git a/libavformat/Makefile b/libavformat/Makefile index 16d019d..322c8e7 100644 --- a/libavformat/Makefile +++ b/libavformat/Makefile @@ -166,6 +166,8 @@ OBJS-$(CONFIG_DAUD_MUXER)+= daudenc.o OBJS-$(CONFIG_DCSTR_DEMUXER) += dcstr.o OBJS-$(CONFIG_DERF_DEMUXER) += derf.o pcm.o OBJS-$(CONFIG_DFA_DEMUXER) += dfa.o +OBJS-$(CONFIG_DFPWM_DEMUXER) += dfpwmdec.o pcm.o +OBJS-$(CONFIG_DFPWM_MUXER) += rawenc.o OBJS-$(CONFIG_DHAV_DEMUXER) += dhav.o OBJS-$(CONFIG_DIRAC_DEMUXER) += diracdec.o rawdec.o OBJS-$(CONFIG_DIRAC_MUXER) += rawenc.o diff --git a/libavformat/allformats.c b/libavformat/allformats.c index d066a77..587ad59 100644 --- a/libavformat/allformats.c +++ b/libavformat/allformats.c @@ -124,6 +124,8 @@ extern const AVOutputFormat ff_daud_muxer; extern const AVInputFormat ff_dcstr_demuxer; extern const AVInputFormat ff_derf_demuxer; extern const AVInputFormat ff_dfa_demuxer; +extern const AVInputFormat ff_dfpwm_demuxer; +extern const AVOutputFormat ff_dfpwm_muxer; extern const AVInputFormat ff_dhav_demuxer; extern const AVInputFormat ff_dirac_demuxer; extern const AVOutputFormat ff_dirac_muxer; diff --git a/libavformat/dfpwmdec.c b/libavformat/dfpwmdec.c new file mode 100644 index 000..85d9b61 --- /dev/null +++ b/libavformat/dfpwmdec.c @@ -0,0 +1,82 @@ +/* + * RAW PCM demuxers + * Copyright (c) 2002 Fabrice Bellard + * Copyright (c) 2022 Jack Bruienne + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "libavutil/avstring.h" +#include "avformat.h" +#include "internal.h" +#include "pcm.h" +#include "libavutil/log.h" +#include "libavutil/opt.h" +#include "libavutil/avassert.h" + +typedef struct DFPWMAudioDemuxerContext { +AVClass *class; +int sample_rate; +int channels; +} DFPWMAudioDemuxerContext; + +static int dfpwm_read_header(AVFormatContext *s) +{ +DFPWMAu
[FFmpeg-devel] [PATCH v7 1/3] libavcodec: Added DFPWM1a codec
From the wiki page (https://wiki.vexatos.com/dfpwm): DFPWM (Dynamic Filter Pulse Width Modulation) is an audio codec created by Ben “GreaseMonkey” Russell in 2012, originally to be used as a voice codec for asiekierka's pixmess, a C remake of 64pixels. It is a 1-bit-per-sample codec which uses a dynamic-strength one-pole low-pass filter as a predictor. Due to the fact that a raw DPFWM decoding creates a high-pitched whine, it is often followed by some post-processing filters to make the stream more listenable. It has recently gained popularity through the ComputerCraft mod for Minecraft, which added support for audio through this codec, as well as the Computronics expansion which preceeded the official support. These both implement the slightly adjusted 1a version of the codec, which is the version I have chosen for this patch. This patch adds a new codec (with encoding and decoding) for DFPWM1a. The codec sources are pretty simple: they use the reference codec with a basic wrapper to connect it to the FFmpeg AVCodec system. To clarify, the codec does not have a specific sample rate - it is provided by the container (or user), which is typically 48000, but has also been known to be 32768. The codec does not specify channel info either, and it's pretty much always used with one mono channel. However, since it appears that libavcodec expects both sample rate and channel count to be handled by either the codec or container, I have made the decision to allow multiple channels interleaved, which as far as I know has never been used, but it works fine here nevertheless. The accompanying raw format has a channels option to set this. (I expect most users of this will not use multiple channels, but it remains an option just in case.) This patch will be highly useful to ComputerCraft developers who are working with audio, as it is the standard format for audio, and there are few user-friendly encoders out there, and even fewer decoders. It will streamline the process for importing and listening to audio, replacing the need to write code or use tools that require very specific input formats. You may use the CraftOS-PC program (https://www.craftos-pc.cc) to test out DFPWM playback. To use it, run the program and type this command: "attach left speaker" Then run "speaker play " for each file. The app runs in a sandbox, so files have to be transferred in first; the easiest way to do this is to simply drag the file on the window. (Or copy files to the folder at https://www.craftos-pc.cc/docs/saves.) Sample DFPWM files can be generated with an online tool at https://music.madefor.cc. This is the current best way to encode DFPWM files. Simply drag an audio file onto the page, and it will encode it, giving a download link on the page. I've made sure to update all of the docs as per Developer§7, and I've tested it as per section 8. Test files encoded to DFPWM play correctly in ComputerCraft, and other files that work in CC are correctly decoded. I have also verified that corrupt files do not crash the decoder - this should theoretically not be an issue as the result size is constant with respect to the input size. Changes since v5: Moved channel check to init, and added sample size check in decoder. Changes since v4: Fixed missing channel check in decoder. Changes since v3: Added support for multiple interleaved channels, and cleaned up the code a bunch. Changes since v2: I've found that the reference encoder has a few errors, and sounds worse than the Java-based implementation that is used most often. I got in contact with someone who knows DFPWM much better than I do, and I worked with them to make a few adjustments that should improve the audio quality. I also made sure that the output matches the Java codec exactly, so it should have the exact same quality as other codecs. Signed-off-by: Jack Bruienne --- Changelog | 1 + MAINTAINERS | 1 + doc/general_contents.texi | 1 + libavcodec/Makefile | 2 + libavcodec/allcodecs.c| 2 + libavcodec/codec_desc.c | 7 ++ libavcodec/codec_id.h | 1 + libavcodec/dfpwmdec.c | 134 ++ libavcodec/dfpwmenc.c | 121 ++ libavcodec/utils.c| 2 + 10 files changed, 272 insertions(+) create mode 100644 libavcodec/dfpwmdec.c create mode 100644 libavcodec/dfpwmenc.c diff --git a/Changelog b/Changelog index 3af8aa0..f3249fe 100644 --- a/Changelog +++ b/Changelog @@ -5,6 +5,7 @@ version 5.1: - dialogue enhance audio filter - dropped obsolete XvMC hwaccel - pcm-bluray encoder +- DFPWM audio encoder/decoder version 5.0: diff --git a/MAINTAINERS b/MAINTAINERS index f33ccbd..57b6f33 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -161,6 +161,7 @@ Codecs: cscd.cReimar Doeffinger cuviddec.cTimo Rothenpieler dca* foo86 + dfpwm*
Re: [FFmpeg-devel] [PATCH v6 1/2] libavcodec: Added DFPWM1a codec
On 3/7/22 06:03, Tomas Härdin wrote: tor 2022-03-03 klockan 10:44 -0500 skrev Jack Bruienne: From the wiki page (https://wiki.vexatos.com/dfpwm): DFPWM (Dynamic Filter Pulse Width Modulation) is an audio codec created by Ben “GreaseMonkey” Russell in 2012, originally to be used as a voice codec for asiekierka's pixmess, a C remake of 64pixels. It is a 1-bit-per-sample codec which uses a dynamic-strength one- pole low-pass filter as a predictor. Due to the fact that a raw DPFWM decoding creates a high-pitched whine, it is often followed by some post- processing filters to make the stream more listenable. This sounds similar to something I wrote for the Atari 2600 a number of years ago (https://www.pouet.net/prod.php?which=59283 ) I found an encoder online for DFPWM, and it seems to suffer from the same "beeping" that my debeeping hack fixes (suppressing 0xAA and 0x55 bytes). Perhaps a similar hack could be useful in dfpwmenc.c I'm curious how this works. Do you just cut out those bytes from the encoder output, or is it modified in some way? Wouldn't removing the data entirely eventually cause much of the audio to be lost? It has recently gained popularity through the ComputerCraft mod for Minecraft, which added support for audio through this codec, as well as the Computronics expansion which preceeded the official support. These both implement the slightly adjusted 1a version of the codec, which is the version I have chosen for this patch. This patch adds a new codec (with encoding and decoding) for DFPWM1a. The codec sources are pretty simple: they use the reference codec with a basic wrapper to connect it to the FFmpeg AVCodec system. To clarify, the codec does not have a specific sample rate - it is provided by the container (or user), which is typically 48000, but has also been known to be 32768. The codec does not specify channel info either, and it's pretty much always used with one mono channel. However, since it appears that libavcodec expects both sample rate and channel count to be handled by either the codec or container, I have made the decision to allow multiple channels interleaved, which as far as I know has never been used, but it works fine here nevertheless. From experience it's usually better to be strict when it comes to stuff like this. The ComputerCraft people should work out a standard for this, preferably a container. We've had a similar problem in FreeDV where which codec was being used was implicit most of the time, which has been resolved with the .c2 format. I think the best standardized container for DFPWM will be WAV. I'll have to figure out the best place to properly standardize this, but one first step may be to implement this in CC directly. Unfortunately, ComputerCraft is currently without a maintainer - the previous one stepped down in December, and no changes are being made outside of critical bugfixes. I do hope to pick up development in the future, and I already run a reimplementation of the mod outside Minecraft, but as it stands today, getting this to be picked up by users will be quite difficult. However, I do also maintain my own audio processing library AUKit, which now includes support for DFPWM in WAV. Since CC only has a basic raw DFPWM player built-in (which strictly requires 48kHz mono audio), many users turn to it to play more complex formats like WAV with a different sample rate, FLAC, etc. This may be a decent start, but it's far from having full support built-in. I'll see if I can get in contact with the owner of the DFPWM wiki page. This will be especially important if this patch gets merged, as people likely won't see that you can use FFmpeg on those pages. I am able to submit pull requests to the ComputerCraft documentation site, however, so I'm able to get changes made there much easier. In the meantime, I've made a sort-of RFC for the format:https://gist.github.com/MCJack123/90c24b64c8e626c7f130b57e9800962c --- Changelog | 1 + MAINTAINERS | 1 + doc/general_contents.texi | 1 + libavcodec/Makefile | 2 + libavcodec/allcodecs.c | 2 + libavcodec/codec_desc.c | 7 ++ libavcodec/codec_id.h | 1 + libavcodec/dfpwmdec.c | 134 ++ libavcodec/dfpwmenc.c | 121 ++ libavcodec/utils.c | 2 + libavcodec/version.h | 4 +- 11 files changed, 274 insertions(+), 2 deletions(-) create mode 100644 libavcodec/dfpwmdec.c create mode 100644 libavcodec/dfpwmenc.c Patch doesn't apply on current master (e645a1d) I'll update the patch to apply to the current master, but I feel like by the time this next gets reviewed master may break again. Should I just keep updating the patch to master and resubmitting whenever I notice a new commit breaks it? /Tomas ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.
Re: [FFmpeg-devel] [PATCH] avcodec/argo: Check packet size
On Sun, Feb 27, 2022 at 11:26:06AM +0100, Michael Niedermayer wrote: > Fixes: Timeout > Fixes: > 45052/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ARGO_fuzzer-6033489206575104 > > Found-by: continuous fuzzing process > https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg > Signed-off-by: Michael Niedermayer > --- > libavcodec/argo.c | 3 +++ > 1 file changed, 3 insertions(+) will apply [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB "I am not trying to be anyone's saviour, I'm trying to think about the future and not be sad" - Elon Musk 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] avcodec/g729_parser: Check channels
On Sun, Feb 27, 2022 at 03:02:46PM +0100, Paul B Mahol wrote: > On Sun, Feb 27, 2022 at 2:51 PM Michael Niedermayer > wrote: > > > Fixes: signed integer overflow: 10 * 808464428 cannot be represented in > > type 'int' > > Fixes: assertion failure > > Fixes: ticket9651 > > > > > LGTM will apply > > Is it possible for parser get 0 channels as input, so it could > theoretically loop forever? there is a check for block_size == 0 a few lines later thx [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Democracy is the form of government in which you can choose your dictator signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH] avformat/avidec: Check height
On Mon, Feb 28, 2022 at 01:00:52AM +0100, Michael Niedermayer wrote: > Fixes: negation of -2147483648 cannot be represented in type 'int'; cast to > an unsigned type to negate this value to itself > Fixes: Ticket8486 > > Signed-off-by: Michael Niedermayer > --- > libavformat/avidec.c | 2 ++ > 1 file changed, 2 insertions(+) will apply [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Awnsering whenever a program halts or runs forever is On a turing machine, in general impossible (turings halting problem). On any real computer, always possible as a real computer has a finite number of states N, and will either halt in less than N cycles or never halt. signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 3/3] avformat/rmdec: Better duplicate tags check
On Thu, Feb 24, 2022 at 12:50:57AM +0100, Michael Niedermayer wrote: > Fixes: memleaks > Fixes: > 44810/clusterfuzz-testcase-minimized-ffmpeg_dem_IVR_fuzzer-5619494647627776 > > Found-by: continuous fuzzing process > https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg > Signed-off-by: Michael Niedermayer > --- > libavformat/rmdec.c | 9 + > 1 file changed, 5 insertions(+), 4 deletions(-) will apply [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Avoid a single point of failure, be that a person or equipment. signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 2/3] tools/target_dec_fuzzer: Adjust threshold for targa
On Thu, Feb 24, 2022 at 12:50:56AM +0100, Michael Niedermayer wrote: > Fixes: Timeout > Fixes: > 44877/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TARGA_fuzzer-4870505251864576 > > Found-by: continuous fuzzing process > https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg > Signed-off-by: Michael Niedermayer > --- > tools/target_dec_fuzzer.c | 1 + > 1 file changed, 1 insertion(+) will apply [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB It is what and why we do it that matters, not just one of them. 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] avcodec: Add dv marker bsf
Signed-off-by: Michael Niedermayer --- doc/bitstream_filters.texi | 15 libavcodec/Makefile | 1 + libavcodec/bitstream_filters.c | 1 + libavcodec/dv_error_marker_bsf.c | 117 +++ 4 files changed, 134 insertions(+) create mode 100644 libavcodec/dv_error_marker_bsf.c diff --git a/doc/bitstream_filters.texi b/doc/bitstream_filters.texi index a0092878c8..6a882ade97 100644 --- a/doc/bitstream_filters.texi +++ b/doc/bitstream_filters.texi @@ -132,6 +132,21 @@ the header stored in extradata to the key packets: ffmpeg -i INPUT -map 0 -flags:v +global_header -c:v libx264 -bsf:v dump_extra out.ts @end example +@section dv_error_marker + +Blocks in DV which are marked as damaged are replaced by blocks of the specified color. + +@table @option +@item color +The color to replace damaged blocks by +@item sta +The error status to replace. If -1 then the stamask is used. -1 is the default. +@item stamask +A 16 bit mask which specifies which of the 16 possible error status values are +to be replaced by colored blocks. 0xFFFE is the default which replaces all non 0 +error status values. +@end table + @section eac3_core Extract the core from a E-AC-3 stream, dropping extra channels. diff --git a/libavcodec/Makefile b/libavcodec/Makefile index bfc31bacd4..c5ed46f121 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -1161,6 +1161,7 @@ OBJS-$(CONFIG_AV1_FRAME_SPLIT_BSF)+= av1_frame_split_bsf.o OBJS-$(CONFIG_CHOMP_BSF) += chomp_bsf.o OBJS-$(CONFIG_DUMP_EXTRADATA_BSF) += dump_extradata_bsf.o OBJS-$(CONFIG_DCA_CORE_BSF) += dca_core_bsf.o +OBJS-$(CONFIG_DV_ERROR_MARKER_BSF)+= dv_error_marker_bsf.o OBJS-$(CONFIG_EAC3_CORE_BSF) += eac3_core_bsf.o OBJS-$(CONFIG_EXTRACT_EXTRADATA_BSF) += extract_extradata_bsf.o\ av1_parse.o h2645_parse.o diff --git a/libavcodec/bitstream_filters.c b/libavcodec/bitstream_filters.c index d565286397..ab27972a88 100644 --- a/libavcodec/bitstream_filters.c +++ b/libavcodec/bitstream_filters.c @@ -31,6 +31,7 @@ extern const AVBitStreamFilter ff_av1_metadata_bsf; extern const AVBitStreamFilter ff_chomp_bsf; extern const AVBitStreamFilter ff_dump_extradata_bsf; extern const AVBitStreamFilter ff_dca_core_bsf; +extern const AVBitStreamFilter ff_dv_error_marker_bsf; extern const AVBitStreamFilter ff_eac3_core_bsf; extern const AVBitStreamFilter ff_extract_extradata_bsf; extern const AVBitStreamFilter ff_filter_units_bsf; diff --git a/libavcodec/dv_error_marker_bsf.c b/libavcodec/dv_error_marker_bsf.c new file mode 100644 index 00..31c0fb8da6 --- /dev/null +++ b/libavcodec/dv_error_marker_bsf.c @@ -0,0 +1,117 @@ +/* + * Copyright (c) 2022 Michael Niedermayer + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "bsf.h" +#include "bsf_internal.h" +#include "libavutil/colorspace.h" +#include "libavutil/intreadwrite.h" +#include "libavutil/opt.h" + +typedef struct DVErrorMarkerContext { +const AVClass *class; +uint8_t color_rgba[4]; +int sta; +int stamask; +uint8_t marked_block[76]; +} DVErrorMarkerContext; + +static int dv_error_marker_init(AVBSFContext *ctx) +{ +DVErrorMarkerContext *s = ctx->priv_data; +int i; + +memset(s->marked_block, -1, 76); +for (i=0; i<4; i++) { +s->marked_block[14*i ] = RGB_TO_Y_JPEG(s->color_rgba[0], s->color_rgba[1],s->color_rgba[2]) + 128; +s->marked_block[14*i+1] = 0x06; +} +s->marked_block[4*14 + 10*0 ] = RGB_TO_V_JPEG(s->color_rgba[0], s->color_rgba[1],s->color_rgba[2]) - 128; +s->marked_block[4*14 + 10*0+1] = 0x16; +s->marked_block[4*14 + 10*1 ] = RGB_TO_U_JPEG(s->color_rgba[0], s->color_rgba[1],s->color_rgba[2]) - 128; +s->marked_block[4*14 + 10*1+1] = 0x16; + +return 0; +} + +static int dv_error_marker_filter(AVBSFContext *ctx, AVPacket *pkt) +{ +DVErrorMarkerContext *s = ctx->priv_data; +int ret = ff_bsf_get_packet_ref(ctx, pkt); +uint8_t *p; +int writable = 0; +int stamask; +int match_count = 0; + +if (ret < 0) +return ret; + +if (s->sta >= 0) { +stamask = 1 << s->sta; +} else +stamask = s->
Re: [FFmpeg-devel] [PATCH v2 4/7] avutil/mathematics: add av_rescale_interval() function
On Fri, Mar 4, 2022 at 12:40 PM Pierre-Anthony Lemieux wrote: > > On Fri, Mar 4, 2022 at 12:13 PM Andreas Rheinhardt > wrote: > > > > p...@sandflow.com: > > > From: Pierre-Anthony Lemieux > > > > > > Refactors a function used by avformat/concat and avformat/imf. > > > > > > --- > > > libavutil/mathematics.c | 10 ++ > > > libavutil/mathematics.h | 21 + > > > 2 files changed, 31 insertions(+) > > > > > > diff --git a/libavutil/mathematics.c b/libavutil/mathematics.c > > > index f4e541fa24..2c7f57b950 100644 > > > --- a/libavutil/mathematics.c > > > +++ b/libavutil/mathematics.c > > > @@ -212,3 +212,13 @@ int64_t av_add_stable(AVRational ts_tb, int64_t ts, > > > AVRational inc_tb, int64_t i > > > return av_sat_add64(av_rescale_q(old + 1, inc_tb, ts_tb), ts - > > > old_ts); > > > } > > > } > > > + > > > +void av_rescale_interval(AVRational tb_in, AVRational tb_out, > > > + int64_t *min_ts, int64_t *ts, int64_t *max_ts) > > > +{ > > > +*ts = av_rescale_q(*ts, tb_in, tb_out); > > > +*min_ts = av_rescale_q_rnd(*min_ts, tb_in, tb_out, > > > + AV_ROUND_UP | AV_ROUND_PASS_MINMAX); > > > +*max_ts = av_rescale_q_rnd(*max_ts, tb_in, tb_out, > > > + AV_ROUND_DOWN | AV_ROUND_PASS_MINMAX); > > > +} > > > diff --git a/libavutil/mathematics.h b/libavutil/mathematics.h > > > index 64d4137a60..eb8a3f4002 100644 > > > --- a/libavutil/mathematics.h > > > +++ b/libavutil/mathematics.h > > > @@ -161,6 +161,27 @@ int64_t av_rescale_q(int64_t a, AVRational bq, > > > AVRational cq) av_const; > > > int64_t av_rescale_q_rnd(int64_t a, AVRational bq, AVRational cq, > > > enum AVRounding rnd) av_const; > > > > > > +/** > > > + * Rescales a timestamp and the endpoints of an interval to which the > > > temstamp > > > + * belongs, from a timebase `tb_in` to a timebase `tb_out`. > > > + * > > > + * The upper (lower) bound of the output interval is rounded up (down) > > > such that > > > + * the output interval always falls within the intput interval. The > > > timestamp is > > > + * rounded to the nearest integer and halfway cases away from zero, and > > > can > > > + * therefore fall outside of the output interval. > > > + * > > > + * Useful to simplify the rescaling of the arguments of > > > AVInputFormat::read_seek2() > > > + * > > > + * @param[in] tb_in Timebase of the input `min_ts`, `ts` and > > > `max_ts` > > > + * @param[in] tb_out Timebase of the ouput `min_ts`, `ts` and > > > `max_ts` > > > + * @param[in,out] min_ts Lower bound of the interval > > > + * @param[in,out] ts Timestamp > > > + * @param[in,out] max_ts Upper bound of the interval > > > + */ > > > +void av_rescale_interval(AVRational tb_in, AVRational tb_out, > > > + int64_t *min_ts, int64_t *ts, int64_t *max_ts); > > > + > > > + > > > /** > > > * Compare two timestamps each in its own time base. > > > * > > > > I don't see why this function should be public at all. It seems very > > specific to a usecase in lavf. > > Ok. Unless someone objects/has a better idea, I cam move it to seek.c > as ff_rescale_interval() since it is primarily useful (today) with > seek_file(). Addressed by v3 at http://ffmpeg.org/pipermail/ffmpeg-devel/2022-March/293795.html > > > > > - Andreas > > ___ > > ffmpeg-devel mailing list > > ffmpeg-devel@ffmpeg.org > > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > > > To unsubscribe, visit link above, or email > > ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe". ___ 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 v3 7/7] avformat/concat: refactor to use ff_rescale_interval()
From: Pierre-Anthony Lemieux --- libavformat/concatdec.c | 18 -- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/libavformat/concatdec.c b/libavformat/concatdec.c index 0603c6e254..cfe1329105 100644 --- a/libavformat/concatdec.c +++ b/libavformat/concatdec.c @@ -816,16 +816,6 @@ static int concat_read_packet(AVFormatContext *avf, AVPacket *pkt) return 0; } -static void rescale_interval(AVRational tb_in, AVRational tb_out, - int64_t *min_ts, int64_t *ts, int64_t *max_ts) -{ -*ts = av_rescale_q(*ts, tb_in, tb_out); -*min_ts = av_rescale_q_rnd(*min_ts, tb_in, tb_out, - AV_ROUND_UP | AV_ROUND_PASS_MINMAX); -*max_ts = av_rescale_q_rnd(*max_ts, tb_in, tb_out, - AV_ROUND_DOWN | AV_ROUND_PASS_MINMAX); -} - static int try_seek(AVFormatContext *avf, int stream, int64_t min_ts, int64_t ts, int64_t max_ts, int flags) { @@ -838,8 +828,8 @@ static int try_seek(AVFormatContext *avf, int stream, if (stream >= 0) { if (stream >= cat->avf->nb_streams) return AVERROR(EIO); -rescale_interval(AV_TIME_BASE_Q, cat->avf->streams[stream]->time_base, - &min_ts, &ts, &max_ts); +ff_rescale_interval(AV_TIME_BASE_Q, cat->avf->streams[stream]->time_base, +&min_ts, &ts, &max_ts); } return avformat_seek_file(cat->avf, stream, min_ts, ts, max_ts, flags); } @@ -853,8 +843,8 @@ static int real_seek(AVFormatContext *avf, int stream, if (stream >= 0) { if (stream >= avf->nb_streams) return AVERROR(EINVAL); -rescale_interval(avf->streams[stream]->time_base, AV_TIME_BASE_Q, - &min_ts, &ts, &max_ts); +ff_rescale_interval(avf->streams[stream]->time_base, AV_TIME_BASE_Q, +&min_ts, &ts, &max_ts); } left = 0; -- 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 v3 6/7] avformat/imf: refactor to use ff_rescale_interval()
From: Pierre-Anthony Lemieux --- libavformat/imfdec.c | 20 ++-- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/libavformat/imfdec.c b/libavformat/imfdec.c index ac212b05e1..a19e431df3 100644 --- a/libavformat/imfdec.c +++ b/libavformat/imfdec.c @@ -904,14 +904,6 @@ static int imf_probe(const AVProbeData *p) return AVPROBE_SCORE_MAX; } -static void rescale_interval(AVRational tb_in, AVRational tb_out, - int64_t *min_ts, int64_t *ts, int64_t *max_ts) -{ -*ts = av_rescale_q(*ts, tb_in, tb_out); -*min_ts = av_rescale_q_rnd(*min_ts, tb_in, tb_out, AV_ROUND_UP | AV_ROUND_PASS_MINMAX); -*max_ts = av_rescale_q_rnd(*max_ts, tb_in, tb_out, AV_ROUND_DOWN | AV_ROUND_PASS_MINMAX); -} - static int coherent_ts(int64_t ts, AVRational in_tb, AVRational out_tb) { int dst_num; @@ -937,13 +929,13 @@ static int imf_seek(AVFormatContext *s, int stream_index, int64_t min_ts, /* rescale timestamps to Composition edit units */ if (stream_index < 0) -rescale_interval(AV_TIME_BASE_Q, - av_make_q(c->cpl->edit_rate.den, c->cpl->edit_rate.num), - &min_ts, &ts, &max_ts); +ff_rescale_interval(AV_TIME_BASE_Q, +av_make_q(c->cpl->edit_rate.den, c->cpl->edit_rate.num), +&min_ts, &ts, &max_ts); else -rescale_interval(s->streams[stream_index]->time_base, - av_make_q(c->cpl->edit_rate.den, c->cpl->edit_rate.num), - &min_ts, &ts, &max_ts); +ff_rescale_interval(s->streams[stream_index]->time_base, +av_make_q(c->cpl->edit_rate.den, c->cpl->edit_rate.num), +&min_ts, &ts, &max_ts); /* requested timestamp bounds are too close */ if (max_ts < min_ts) -- 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 v3 5/7] avformat/tests: add test for ff_rescale_interval()
From: Pierre-Anthony Lemieux --- libavformat/Makefile | 1 + libavformat/tests/.gitignore | 1 + libavformat/tests/seek_utils.c | 57 ++ tests/fate/libavformat.mak | 5 +++ 4 files changed, 64 insertions(+) create mode 100644 libavformat/tests/seek_utils.c diff --git a/libavformat/Makefile b/libavformat/Makefile index 6566e40cac..3acc939551 100644 --- a/libavformat/Makefile +++ b/libavformat/Makefile @@ -707,6 +707,7 @@ SKIPHEADERS-$(CONFIG_NETWORK)+= network.h rtsp.h TESTPROGS = seek\ url \ +seek_utils # async \ FIFO-MUXER-TESTPROGS-$(CONFIG_NETWORK) += fifo_muxer diff --git a/libavformat/tests/.gitignore b/libavformat/tests/.gitignore index aabf76345e..cdd0cce061 100644 --- a/libavformat/tests/.gitignore +++ b/libavformat/tests/.gitignore @@ -6,3 +6,4 @@ /seek /srtp /url +/seek_utils diff --git a/libavformat/tests/seek_utils.c b/libavformat/tests/seek_utils.c new file mode 100644 index 00..f368578fc4 --- /dev/null +++ b/libavformat/tests/seek_utils.c @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2022 Pierre-Anthony Lemieux + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "libavformat/avio_internal.h" + +int main(void) +{ + int64_t ts_min; + int64_t ts; + int64_t ts_max; + + ts_min = 10; + ts = 20; + ts_max = 30; + + ff_rescale_interval(av_make_q(1, 1), av_make_q(10, 1), &ts_min, &ts, &ts_max); + + if (ts_min != 1 || ts != 2 || ts_max != 3) +return 1; + + ts_min = 10; + ts = 32; + ts_max = 32; + + ff_rescale_interval(av_make_q(1, 1), av_make_q(3, 1), &ts_min, &ts, &ts_max); + + if (ts_min != 4 || ts != 11 || ts_max != 10) +return 1; + + ts_min = 10; + ts = 10; + ts_max = 32; + + ff_rescale_interval(av_make_q(1, 1), av_make_q(3, 1), &ts_min, &ts, &ts_max); + + if (ts_min != 4 || ts != 3 || ts_max != 10) +return 1; + + return 0; +} diff --git a/tests/fate/libavformat.mak b/tests/fate/libavformat.mak index 59ff0ebc8d..d2acb4c9e0 100644 --- a/tests/fate/libavformat.mak +++ b/tests/fate/libavformat.mak @@ -26,6 +26,11 @@ FATE_LIBAVFORMAT-$(CONFIG_IMF_DEMUXER) += fate-imf fate-imf: libavformat/tests/imf$(EXESUF) fate-imf: CMD = run libavformat/tests/imf$(EXESUF) +FATE_LIBAVFORMAT += fate-seek_utils +fate-seek_utils: libavformat/tests/seek_utils$(EXESUF) +fate-seek_utils: CMD = run libavformat/tests/seek_utils$(EXESUF) +fate-seek_utils: CMP = null + FATE_LIBAVFORMAT += $(FATE_LIBAVFORMAT-yes) FATE-$(CONFIG_AVFORMAT) += $(FATE_LIBAVFORMAT) fate-libavformat: $(FATE_LIBAVFORMAT) -- 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 v3 4/7] avformat/seek: add ff_rescale_interval() function
From: Pierre-Anthony Lemieux Refactors a function used by avformat/concat and avformat/imf. --- libavformat/avio_internal.h | 21 + libavformat/seek.c | 10 ++ 2 files changed, 31 insertions(+) diff --git a/libavformat/avio_internal.h b/libavformat/avio_internal.h index 1f5e3d474b..ef2ec7864f 100644 --- a/libavformat/avio_internal.h +++ b/libavformat/avio_internal.h @@ -23,6 +23,7 @@ #include "url.h" #include "libavutil/log.h" +#include "libavutil/rational.h" extern const AVClass ff_avio_class; @@ -281,4 +282,24 @@ int64_t ff_read_line_to_bprint_overwrite(AVIOContext *s, struct AVBPrint *bp); int64_t ff_read_string_to_bprint_overwrite(AVIOContext *s, struct AVBPrint *bp, int64_t max_len); +/** + * Rescales a timestamp and the endpoints of an interval to which the temstamp + * belongs, from a timebase `tb_in` to a timebase `tb_out`. + * + * The upper (lower) bound of the output interval is rounded up (down) such that + * the output interval always falls within the intput interval. The timestamp is + * rounded to the nearest integer and halfway cases away from zero, and can + * therefore fall outside of the output interval. + * + * Useful to simplify the rescaling of the arguments of AVInputFormat::read_seek2() + * + * @param[in] tb_in Timebase of the input `min_ts`, `ts` and `max_ts` + * @param[in] tb_out Timebase of the ouput `min_ts`, `ts` and `max_ts` + * @param[in,out] min_ts Lower bound of the interval + * @param[in,out] ts Timestamp + * @param[in,out] max_ts Upper bound of the interval + */ +void ff_rescale_interval(AVRational tb_in, AVRational tb_out, + int64_t *min_ts, int64_t *ts, int64_t *max_ts); + #endif /* AVFORMAT_AVIO_INTERNAL_H */ diff --git a/libavformat/seek.c b/libavformat/seek.c index 405ca316b3..890aea7f8a 100644 --- a/libavformat/seek.c +++ b/libavformat/seek.c @@ -751,3 +751,13 @@ int avformat_flush(AVFormatContext *s) ff_read_frame_flush(s); return 0; } + +void ff_rescale_interval(AVRational tb_in, AVRational tb_out, + int64_t *min_ts, int64_t *ts, int64_t *max_ts) +{ +*ts = av_rescale_q(*ts, tb_in, tb_out); +*min_ts = av_rescale_q_rnd(*min_ts, tb_in, tb_out, + AV_ROUND_UP | AV_ROUND_PASS_MINMAX); +*max_ts = av_rescale_q_rnd(*max_ts, tb_in, tb_out, + AV_ROUND_DOWN | AV_ROUND_PASS_MINMAX); +} -- 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 v3 3/7] avformat/imf: clean-up and reduce logging
From: Pierre-Anthony Lemieux --- libavformat/imfdec.c | 93 ++-- 1 file changed, 29 insertions(+), 64 deletions(-) diff --git a/libavformat/imfdec.c b/libavformat/imfdec.c index f208b262c3..ac212b05e1 100644 --- a/libavformat/imfdec.c +++ b/libavformat/imfdec.c @@ -203,11 +203,8 @@ static int parse_imf_asset_map_from_xml_dom(AVFormatContext *s, } if (asset_map_element->type != XML_ELEMENT_NODE || av_strcasecmp(asset_map_element->name, "AssetMap")) { -av_log(s, - AV_LOG_ERROR, - "Unable to parse asset map XML - wrong root node name[%s] type[%d]\n", - asset_map_element->name, - (int)asset_map_element->type); +av_log(s, AV_LOG_ERROR, "Unable to parse asset map XML - wrong root node name[%s] type[%d]\n", + asset_map_element->name, (int)asset_map_element->type); return AVERROR_INVALIDDATA; } @@ -333,11 +330,8 @@ static int parse_assetmap(AVFormatContext *s, const char *url) ret = parse_imf_asset_map_from_xml_dom(s, doc, &c->asset_locator_map, base_url); if (!ret) -av_log(s, - AV_LOG_DEBUG, - "Found %d assets from %s\n", - c->asset_locator_map.asset_count, - url); +av_log(s, AV_LOG_DEBUG, "Found %d assets from %s\n", + c->asset_locator_map.asset_count, url); xmlFreeDoc(doc); @@ -370,9 +364,7 @@ static int open_track_resource_context(AVFormatContext *s, IMFVirtualTrackResourcePlaybackCtx *track_resource = track->resources + resource_index; if (track_resource->ctx) { -av_log(s, - AV_LOG_DEBUG, - "Input context already opened for %s.\n", +av_log(s, AV_LOG_DEBUG, "Input context already opened for %s.\n", track_resource->locator->absolute_uri); return 0; } @@ -400,11 +392,8 @@ static int open_track_resource_context(AVFormatContext *s, NULL, &opts); if (ret < 0) { -av_log(s, - AV_LOG_ERROR, - "Could not open %s input context: %s\n", - track_resource->locator->absolute_uri, - av_err2str(ret)); +av_log(s, AV_LOG_ERROR, "Could not open %s input context: %s\n", + track_resource->locator->absolute_uri, av_err2str(ret)); goto cleanup; } av_dict_free(&opts); @@ -427,8 +416,7 @@ static int open_track_resource_context(AVFormatContext *s, st->time_base)) av_log(s, AV_LOG_WARNING, "Incoherent stream timebase " AVRATIONAL_FORMAT "and composition timeline position: " AVRATIONAL_FORMAT "\n", - st->time_base.num, st->time_base.den, - track->current_timestamp.den, track->current_timestamp.num); + AVRATIONAL_ARG(st->time_base), AVRATIONAL_ARG(track->current_timestamp)); if (seek_offset) { av_log(s, AV_LOG_DEBUG, "Seek at resource %s entry point: %" PRIi64 "\n", @@ -465,9 +453,7 @@ static int open_track_file_resource(AVFormatContext *s, asset_locator = find_asset_map_locator(&c->asset_locator_map, track_file_resource->track_file_uuid); if (!asset_locator) { -av_log(s, - AV_LOG_ERROR, - "Could not find asset locator for UUID: " FF_IMF_UUID_FORMAT "\n", +av_log(s, AV_LOG_ERROR, "Could not find asset locator for UUID: " FF_IMF_UUID_FORMAT "\n", UID_ARG(track_file_resource->track_file_uuid)); return AVERROR_INVALIDDATA; } @@ -618,9 +604,7 @@ static int open_cpl_tracks(AVFormatContext *s) if (c->cpl->main_image_2d_track) { if ((ret = open_virtual_track(s, c->cpl->main_image_2d_track, track_index++)) != 0) { -av_log(s, - AV_LOG_ERROR, - "Could not open image track " FF_IMF_UUID_FORMAT "\n", +av_log(s, AV_LOG_ERROR, "Could not open image track " FF_IMF_UUID_FORMAT "\n", UID_ARG(c->cpl->main_image_2d_track->base.id_uuid)); return ret; } @@ -628,9 +612,7 @@ static int open_cpl_tracks(AVFormatContext *s) for (uint32_t i = 0; i < c->cpl->main_audio_track_count; i++) { if ((ret = open_virtual_track(s, &c->cpl->main_audio_tracks[i], track_index++)) != 0) { -av_log(s, - AV_LOG_ERROR, - "Could not open audio track " FF_IMF_UUID_FORMAT "\n", +av_log(s, AV_LOG_ERROR, "Could not open audio track " FF_IMF_UUID_FORMAT "\n", UID_ARG(c->cpl->main_audio_tracks[i].base.id_uuid)); return ret; } @@ -706,13 +688,9 @@ static IMFVirtualTrackPlaybackCtx *get_next_track_with_minimum_timestamp(AVForma AVRational minimum_timestamp = av_make_q(INT32_MAX, 1); for (uint32_t i = c->track_count; i > 0; i--) {
[FFmpeg-devel] [PATCH v3 2/7] avformat/imf: add support for input seeking
From: Pierre-Anthony Lemieux The IMF demuxer did not implement AVInputFormat::read_seek2(), resulting in inefficient input seeking. Addresses https://trac.ffmpeg.org/ticket/9648 Byte- and frame-seeking are not supported. --- libavformat/imfdec.c | 129 ++- 1 file changed, 102 insertions(+), 27 deletions(-) diff --git a/libavformat/imfdec.c b/libavformat/imfdec.c index b98af020d2..f208b262c3 100644 --- a/libavformat/imfdec.c +++ b/libavformat/imfdec.c @@ -359,13 +359,15 @@ static IMFAssetLocator *find_asset_map_locator(IMFAssetLocatorMap *asset_map, FF } static int open_track_resource_context(AVFormatContext *s, - IMFVirtualTrackResourcePlaybackCtx *track_resource) + IMFVirtualTrackPlaybackCtx *track, + int32_t resource_index) { IMFContext *c = s->priv_data; int ret = 0; -int64_t entry_point; +int64_t seek_offset = 0; AVDictionary *opts = NULL; AVStream *st; +IMFVirtualTrackResourcePlaybackCtx *track_resource = track->resources + resource_index; if (track_resource->ctx) { av_log(s, @@ -416,32 +418,27 @@ static int open_track_resource_context(AVFormatContext *s, st = track_resource->ctx->streams[0]; -/* Warn if the resource time base does not match the file time base */ -if (av_cmp_q(st->time_base, av_inv_q(track_resource->resource->base.edit_rate))) -av_log(s, - AV_LOG_WARNING, - "Incoherent source stream timebase " AVRATIONAL_FORMAT - "regarding resource edit rate: " AVRATIONAL_FORMAT, - st->time_base.num, - st->time_base.den, - track_resource->resource->base.edit_rate.den, - track_resource->resource->base.edit_rate.num); - -entry_point = av_rescale_q(track_resource->resource->base.entry_point, st->time_base, - av_inv_q(track_resource->resource->base.edit_rate)); - -if (entry_point) { -av_log(s, - AV_LOG_DEBUG, - "Seek at resource %s entry point: %" PRIu32 "\n", - track_resource->locator->absolute_uri, - track_resource->resource->base.entry_point); -ret = avformat_seek_file(track_resource->ctx, 0, entry_point, entry_point, entry_point, 0); +/* Determine the seek offset into the Track File, taking into account: + * - the current timestamp within the virtual track + * - the entry point of the resource + */ +if (imf_time_to_ts(&seek_offset, + av_sub_q(track->current_timestamp, track_resource->ts_offset), + st->time_base)) +av_log(s, AV_LOG_WARNING, "Incoherent stream timebase " AVRATIONAL_FORMAT + "and composition timeline position: " AVRATIONAL_FORMAT "\n", + st->time_base.num, st->time_base.den, + track->current_timestamp.den, track->current_timestamp.num); + +if (seek_offset) { +av_log(s, AV_LOG_DEBUG, "Seek at resource %s entry point: %" PRIi64 "\n", + track_resource->locator->absolute_uri, seek_offset); +ret = avformat_seek_file(track_resource->ctx, 0, seek_offset, seek_offset, seek_offset, 0); if (ret < 0) { av_log(s, AV_LOG_ERROR, "Could not seek at %" PRId64 "on %s: %s\n", - entry_point, + seek_offset, track_resource->locator->absolute_uri, av_err2str(ret)); avformat_close_input(&track_resource->ctx); @@ -584,7 +581,7 @@ static int set_context_streams_from_tracks(AVFormatContext *s) AVStream *first_resource_stream; /* Open the first resource of the track to get stream information */ -ret = open_track_resource_context(s, &c->tracks[i]->resources[0]); +ret = open_track_resource_context(s, c->tracks[i], 0); if (ret) return ret; first_resource_stream = c->tracks[i]->resources[0].ctx->streams[0]; @@ -774,7 +771,7 @@ static int get_resource_context_for_timestamp(AVFormatContext *s, IMFVirtualTrac "Switch resource on track %d: re-open context\n", track->index); -ret = open_track_resource_context(s, track->resources + i); +ret = open_track_resource_context(s, track, i); if (ret != 0) return ret; if (track->current_resource_index > 0) @@ -942,6 +939,83 @@ static int imf_probe(const AVProbeData *p) return AVPROBE_SCORE_MAX; } +static void rescale_interval(AVRational tb_in, AVRational tb_out, + int64_t *min_ts, int64_t *ts, int64_t *max_ts) +{ +*ts = av_rescale_q(*ts, tb_in, tb_out); +*min_ts = av_rescale_q_rnd(*min_ts, tb_i
[FFmpeg-devel] [PATCH v3 1/7] avformat/imf: relocate static function imf_time_to_ts()
From: Pierre-Anthony Lemieux --- libavformat/imfdec.c | 38 +++--- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/libavformat/imfdec.c b/libavformat/imfdec.c index 3ce850b75a..b98af020d2 100644 --- a/libavformat/imfdec.c +++ b/libavformat/imfdec.c @@ -154,6 +154,25 @@ static int imf_uri_is_dos_abs_path(const char *string) return 0; } +static int imf_time_to_ts(int64_t *ts, AVRational t, AVRational time_base) +{ +int dst_num; +int dst_den; +AVRational r; + +r = av_div_q(t, time_base); + +if ((av_reduce(&dst_num, &dst_den, r.num, r.den, INT64_MAX) != 1)) +return 1; + +if (dst_den != 1) +return 1; + +*ts = dst_num; + +return 0; +} + /** * Parse a ASSETMAP XML file to extract the UUID-URI mapping of assets. * @param s the current format context, if any (can be NULL). @@ -772,25 +791,6 @@ static int get_resource_context_for_timestamp(AVFormatContext *s, IMFVirtualTrac return AVERROR_STREAM_NOT_FOUND; } -static int imf_time_to_ts(int64_t *ts, AVRational t, AVRational time_base) -{ -int dst_num; -int dst_den; -AVRational r; - -r = av_div_q(t, time_base); - -if ((av_reduce(&dst_num, &dst_den, r.num, r.den, INT64_MAX) != 1)) -return 1; - -if (dst_den != 1) -return 1; - -*ts = dst_num; - -return 0; -} - static int imf_read_packet(AVFormatContext *s, AVPacket *pkt) { IMFVirtualTrackResourcePlaybackCtx *resource = NULL; -- 2.17.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH] mlp_parser: fetch a new timestamp when major sync is found
On Mon, Mar 7, 2022 at 7:10 PM Michael Niedermayer wrote: > > On Mon, Mar 07, 2022 at 12:32:59AM +0200, Jan Ekström wrote: > > From: Hendrik Leppkes > > > > Decoding can only start on a major sync > > > and the parser discards > > any data received until that point. > > Thats a bug and its inconsistant > For example video codec parsers do not drop frames until a keyframe > And droping that in a video codec would if someone suggested it > lead to people opposing as that would drop actual data > that can partly be decoded. Its better to drop it in the decoder > if its unwanted. > So why is this considered to be "ok" in audio codecs? > Because we dont visually see that data is lost ? > For the record, I am not advocating for this behavior in this parser, nor is this patch adding the dropping. The dropping is and has already been there. Rather this is just the result of the following steps: 1. I improve certain parser calling code in an API client (mpv) to actually utilize the returned timestamps due to certain formats such as E-AC-3 having buffering/delay. 2. Some of the samples I have at hand were badly cut matroska files from early 2010s where the muxer expected all packets to be random access points. 3. I notice that while the E-AC-3 samples' timestamps are now correct, the TrueHD samples' timestamps are now such that you get a jump between the first returned data, and the rest of the returned data. 4. After staring at the matroska packets' sizes and timestamps on the container level, I figure out that the parser is just dropping packets until the first random access point packet is found, and then failing to update the returned timestamp. 5. Thus I open https://trac.ffmpeg.org/ticket/9428 . 6. nev is nice enough to figure out how to make the parser actually update the returned timestamp. 7. After the copyinkf stuff gets applied to master, I write a test for it and reword the commit message, send the fix to the mailing list. I do not have experience with the parser, but at least this fixes an existing bug that I noticed when properly utilizing the parsing API :) . > So let me show it vissually :) > i deleted frame 1, we have 3 decoder outputs > 1. complete data > 2. no frame 1 but instead frame 17 duplicated in frame 1s place > 3. no frame 1 > > The decoder produces a few errors in case 2 but there seems more > data coming out which seems resembling the data that is droped > its not 1:1 identical but it looks like there is recoverable data > see attached screenshoot from audacity > Maybe its a coincidence > > but i dont think we should just build on top of this droping > logic without some argumentation why this droped data can really > not be used ever in any way (it may become harder to fix it the > more is build on top) > > thx > I'm OK with the parser being changed in stead, but unfortunately I do not have the brain power/time to start looking into it myself. For now I was happy enough to get a fix for the returned timestamps posted on the mailing list, and have written a test for it. Jan ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH] mlp_parser: fetch a new timestamp when major sync is found
On Mon, Mar 7, 2022 at 6:10 PM Michael Niedermayer wrote: > So why is this considered to be "ok" in audio codecs? > Because we dont visually see that data is lost ? This patch is not trying to argue that its "ok" to drop data, nor does it introduce this behavior. Someone else did that years ago. > > but i dont think we should just build on top of this droping > logic without some argumentation why this droped data can really > not be used ever in any way (it may become harder to fix it the > more is build on top) > There is no question that dropping the data inside a parser is not the appropriate and documented behavior, but it is what it does, and what it has done for ages. Leaving an actual bug because some theoretical better fix might be available is not rather productive, especially when the fix is one short line - unless you actually provide said better fix in a reasonable timeframe. It is not adding the dropping behavior, that already existed afterall, its just fixing the timestamp - in a rather trivial manner, too. If you, or anyone else, wants to change the parsers logic to not drop data, this patch does not hinder that in any way. It immediately fixes the bug that was brought to my attention a while ago, that this case breaks timestamps. Dropping of data in front of a keyframe is another bug, even if they are practically undecodable without some manual hackery, a parser should not do that - but this patch does not even touch on that behavior, other then mentioning it in the message. - Hendrik ___ 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] GSoC 2022
Hi all FFmpeg has been accepted for GSoC this year again! Thanks to everyone who wants to mentor and proposed a project! https://summerofcode.withgoogle.com/programs/2022/organizations/ffmpeg https://trac.ffmpeg.org/wiki/SponsoringPrograms/GSoC/2022 thx -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Any man who breaks a law that conscience tells him is unjust and willingly accepts the penalty by staying in jail in order to arouse the conscience of the community on the injustice of the law is at that moment expressing the very highest respect for law. - Martin Luther King Jr 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] avcodec/pngdec: support alpha blending for palette apng
will apply soon! ___ 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] avfilter: Added siti filter
On 3/7/22, Thilo Borgmann wrote: > Am 06.03.22 um 22:25 schrieb Paul B Mahol: >> On 3/6/22, Thilo Borgmann wrote: >>> Am 22.02.22 um 12:30 schrieb Thilo Borgmann: Am 18.02.22 um 17:08 schrieb Paul B Mahol: > On Sat, Feb 12, 2022 at 11:55 AM Thilo Borgmann > > wrote: > >> Am 31.01.22 um 12:55 schrieb James Almer: >>> >>> >>> On 1/31/2022 8:53 AM, Anton Khirnov wrote: Quoting Thilo Borgmann (2022-01-18 14:58:07) >>> Violations of code style. > > Enhanced. Not enough. There are still many remaining, e.g. * opening brace of a function definition should be on its own line * the context should generally be the first argument * unsigned char* should be uint8_t* * mixed declarations and code (the compiler should warn about that) >>> >>> I think someone said that clang (or some versions) is apparently not >> warning about this, hence why so many of these end up being missed in >> reviews or even by the patch author. >> >> This and all of Anton's comments in v3. Also removed some more >> obviously >> useless doubles. >> > > Why it uses doubles in so many places? > Is there any real benefit in that, except extra slowdown? I guess because it's originating in some c&p Matlab code. I did %s#double#float#g for v4, loosing some precision we can ignore IMHO. v3: Total frames: 2 Spatial Information: Average: 165.451985 Max: 165.817542 Min: 165.086427 Temporal Information: Average: 1.007263 Max: 2.014525 Min: 0.00 v4: Total frames: 2 Spatial Information: Average: 164.385895 Max: 164.742325 Min: 164.029480 Temporal Information: Average: 1.007241 Max: 2.014483 Min: 0.00 >>> >>> Ping. >> >> Into wrong section of changelog added entry. >> >> Useless cast of allocation results. >> >> Does filter changes pixels? If not, add metadata flag to appropriate >> place. > > All addressed in v5, thx! > Changelog entry is still in wrong, 5.0, section. > Also added a FATE test for it. > > -Thilo ___ 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 v3 0/8] rewrite avpriv_find_start_code() for clarity
On 2/8/22 22:28, Scott Theisen wrote: I have removed most of my added comments. Rebased to account for Andreas Rheinhardt moving the prototype to startcode.h. Per his suggestion, the function signature is now unmodified. (ff_)mpeg1_find_frame_end() now has a wrapper function preserving the original behavior allowing start codes across buffer boundaries. -Scott Andreas, Have you had a chance to look at v3? Thanks, Scott ___ 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] mlp_parser: fetch a new timestamp when major sync is found
On Mon, Mar 07, 2022 at 12:32:59AM +0200, Jan Ekström wrote: > From: Hendrik Leppkes > > Decoding can only start on a major sync > and the parser discards > any data received until that point. Thats a bug and its inconsistant For example video codec parsers do not drop frames until a keyframe And droping that in a video codec would if someone suggested it lead to people opposing as that would drop actual data that can partly be decoded. Its better to drop it in the decoder if its unwanted. So why is this considered to be "ok" in audio codecs? Because we dont visually see that data is lost ? So let me show it vissually :) i deleted frame 1, we have 3 decoder outputs 1. complete data 2. no frame 1 but instead frame 17 duplicated in frame 1s place 3. no frame 1 The decoder produces a few errors in case 2 but there seems more data coming out which seems resembling the data that is droped its not 1:1 identical but it looks like there is recoverable data see attached screenshoot from audacity Maybe its a coincidence but i dont think we should just build on top of this droping logic without some argumentation why this droped data can really not be used ever in any way (it may become harder to fix it the more is build on top) 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] avfilter: Added siti filter
Am 06.03.22 um 22:25 schrieb Paul B Mahol: On 3/6/22, Thilo Borgmann wrote: Am 22.02.22 um 12:30 schrieb Thilo Borgmann: Am 18.02.22 um 17:08 schrieb Paul B Mahol: On Sat, Feb 12, 2022 at 11:55 AM Thilo Borgmann wrote: Am 31.01.22 um 12:55 schrieb James Almer: On 1/31/2022 8:53 AM, Anton Khirnov wrote: Quoting Thilo Borgmann (2022-01-18 14:58:07) Violations of code style. Enhanced. Not enough. There are still many remaining, e.g. * opening brace of a function definition should be on its own line * the context should generally be the first argument * unsigned char* should be uint8_t* * mixed declarations and code (the compiler should warn about that) I think someone said that clang (or some versions) is apparently not warning about this, hence why so many of these end up being missed in reviews or even by the patch author. This and all of Anton's comments in v3. Also removed some more obviously useless doubles. Why it uses doubles in so many places? Is there any real benefit in that, except extra slowdown? I guess because it's originating in some c&p Matlab code. I did %s#double#float#g for v4, loosing some precision we can ignore IMHO. v3: Total frames: 2 Spatial Information: Average: 165.451985 Max: 165.817542 Min: 165.086427 Temporal Information: Average: 1.007263 Max: 2.014525 Min: 0.00 v4: Total frames: 2 Spatial Information: Average: 164.385895 Max: 164.742325 Min: 164.029480 Temporal Information: Average: 1.007241 Max: 2.014483 Min: 0.00 Ping. Into wrong section of changelog added entry. Useless cast of allocation results. Does filter changes pixels? If not, add metadata flag to appropriate place. All addressed in v5, thx! Also added a FATE test for it. -ThiloFrom efe6b29718761492c7b32242404dd078588137ee Mon Sep 17 00:00:00 2001 From: Thilo Borgmann Date: Mon, 7 Mar 2022 17:35:15 +0100 Subject: [PATCH v5] lavfilter: Add SITI filter Calculate Spatial Info (SI) and Temporal Info (TI) scores for a video, as defined in ITU-T P.910: Subjective video quality assessment methods for multimedia applications. --- Changelog | 1 + doc/filters.texi | 23 ++ libavfilter/Makefile | 1 + libavfilter/allfilters.c | 1 + libavfilter/version.h | 2 +- libavfilter/vf_siti.c | 349 ++ tests/fate-run.sh | 9 + tests/fate/filter-video.mak | 3 + tests/ref/fate/filter-refcmp-siti-yuv | 15 ++ 9 files changed, 403 insertions(+), 1 deletion(-) create mode 100644 libavfilter/vf_siti.c create mode 100644 tests/ref/fate/filter-refcmp-siti-yuv diff --git a/Changelog b/Changelog index 3dde3326be..ffe320be9d 100644 --- a/Changelog +++ b/Changelog @@ -48,6 +48,7 @@ version 5.0: - VideoToolbox ProRes encoder - anlmf audio filter - IMF demuxer (experimental) +- SITI filter version 4.4: diff --git a/doc/filters.texi b/doc/filters.texi index 05d4b1a56e..f8a8a2cb72 100644 --- a/doc/filters.texi +++ b/doc/filters.texi @@ -19875,6 +19875,29 @@ ffmpeg -i input1.mkv -i input2.mkv -filter_complex "[0:v][1:v] signature=nb_inpu @end itemize +@anchor{siti} +@section siti + +Calculate Spatial Info (SI) and Temporal Info (TI) scores for a video, as defined +in ITU-T P.910: Subjective video quality assessment methods for multimedia +applications. Available PDF at @url{https://www.itu.int/rec/T-REC-P.910-199909-S/en }. + +It accepts the following option: + +@table @option +@item print_summary +If set to 1, Summary statistics will be printed to the console. Default 0. +@end table + +@subsection Examples +@itemize +@item +To calculate SI/TI metrics and print summary: +@example +ffmpeg -i input.mp4 -vf siti=print_summary=1 -f null - +@end example +@end itemize + @anchor{smartblur} @section smartblur diff --git a/libavfilter/Makefile b/libavfilter/Makefile index 1adbea75bd..3261d05311 100644 --- a/libavfilter/Makefile +++ b/libavfilter/Makefile @@ -454,6 +454,7 @@ OBJS-$(CONFIG_SMARTBLUR_FILTER) += vf_smartblur.o OBJS-$(CONFIG_SOBEL_FILTER) += vf_convolution.o OBJS-$(CONFIG_SOBEL_OPENCL_FILTER) += vf_convolution_opencl.o opencl.o \ opencl/convolution.o +OBJS-$(CONFIG_SITI_FILTER) += vf_siti.o OBJS-$(CONFIG_SPLIT_FILTER) += split.o OBJS-$(CONFIG_SPP_FILTER)+= vf_spp.o qp_table.o OBJS-$(CONFIG_SR_FILTER) += vf_sr.o diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c index 4325a3e557..808c172b28 100644 --- a/libavfilter/allfilters.c +++ b/libavfilter/allfilters.c @@ -430,6 +430,7 @@ extern const AVFilter ff_vf_shuffleplanes; extern const AVFilter ff_vf_sidedata; extern const AVFilter ff_vf_signalstats; extern const AVFilter ff_vf_signature; +extern const AVFilter ff_vf_siti; extern const AVFilter ff_vf_smartblur
Re: [FFmpeg-devel] [PATCH v2 3/5] libswscale: Avx2 hscale can process inputs of any size.
Hi Michael, Thanks for reviewing the first two parts of this patchset. Is there anybody interested in reviewing this part? Thanks, Alan On Thu, Feb 17, 2022 at 5:21 PM Michael Niedermayer wrote: > On Thu, Feb 17, 2022 at 11:04:04AM +0100, Alan Kelly wrote: > > The main loop processes blocks of 16 pixels. The tail processes blocks > > of size 4. > > --- > > libswscale/x86/scale_avx2.asm | 48 +-- > > 1 file changed, 46 insertions(+), 2 deletions(-) > > ill wait a few days on this, there are people here who know avx2 better > than i do > its a while since i wrote x86 SIMD. > but if noone else reviews this then ill do > > thx > > > [...] > -- > Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB > > "You are 36 times more likely to die in a bathtub than at the hands of a > terrorist. Also, you are 2.5 times more likely to become a president and > 2 times more likely to become an astronaut, than to die in a terrorist > attack." -- Thoughty2 > > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > To unsubscribe, visit link above, or email > ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe". > ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH RESEND] configure: move ranlib -D test after setting defaults
In Gentoo and ChromeOS we want to allow pure LLVM builds without using GNU tools, so we block any unwanted mixed GNU/LLVM usages (GNU tools are still kept around in our chroots for projects like glibc which cannot yet be built otherwise). The default ${cross_prefix}${ranlib_default} points to GNU and fails, so move the test a bit later - after the defaults are set and the proper values get overriden - such that ffmpeg configure calls the llvm-ranlib we desire. [1] [1] https://gitweb.gentoo.org/repo/gentoo.git/tree/media-video/ffmpeg/ffmpeg-4.4.1-r1.ebuild?id=7a34377e3277a6a0e2eedd40e90452a44c55f1e6#n477 Signed-off-by: Adrian Ratiu --- configure | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/configure b/configure index 650b52fcc5..98e29b49f9 100755 --- a/configure +++ b/configure @@ -4400,11 +4400,7 @@ cc_default="${cross_prefix}${cc_default}" cxx_default="${cross_prefix}${cxx_default}" nm_default="${cross_prefix}${nm_default}" pkg_config_default="${cross_prefix}${pkg_config_default}" -if ${cross_prefix}${ranlib_default} 2>&1 | grep -q "\-D "; then -ranlib_default="${cross_prefix}${ranlib_default} -D" -else -ranlib_default="${cross_prefix}${ranlib_default}" -fi +ranlib_default="${cross_prefix}${ranlib_default}" strip_default="${cross_prefix}${strip_default}" windres_default="${cross_prefix}${windres_default}" @@ -4437,6 +4433,10 @@ set_default arch cc cxx doxygen pkg_config ranlib strip sysinclude \ enabled cross_compile || host_cc_default=$cc set_default host_cc +if ${ranlib} 2>&1 | grep -q "\-D "; then +ranlib="${ranlib} -D" +fi + pkg_config_fail_message="" if ! $pkg_config --version >/dev/null 2>&1; then warn "$pkg_config not found, library detection may fail." -- 2.35.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 v6 1/2] libavcodec: Added DFPWM1a codec
tor 2022-03-03 klockan 10:44 -0500 skrev Jack Bruienne: > > From the wiki page (https://wiki.vexatos.com/dfpwm): > > DFPWM (Dynamic Filter Pulse Width Modulation) is an audio codec > > created by Ben “GreaseMonkey” Russell in 2012, originally to be > > used > > as a voice codec for asiekierka's pixmess, a C remake of 64pixels. > > It is a 1-bit-per-sample codec which uses a dynamic-strength one- > > pole > > low-pass filter as a predictor. Due to the fact that a raw DPFWM > > decoding > > creates a high-pitched whine, it is often followed by some post- > > processing > > filters to make the stream more listenable. This sounds similar to something I wrote for the Atari 2600 a number of years ago ( https://www.pouet.net/prod.php?which=59283 ) I found an encoder online for DFPWM, and it seems to suffer from the same "beeping" that my debeeping hack fixes (suppressing 0xAA and 0x55 bytes). Perhaps a similar hack could be useful in dfpwmenc.c > > It has recently gained popularity through the ComputerCraft mod for > Minecraft, which added support for audio through this codec, as well > as > the Computronics expansion which preceeded the official support. > These > both implement the slightly adjusted 1a version of the codec, which > is > the version I have chosen for this patch. > > This patch adds a new codec (with encoding and decoding) for DFPWM1a. > The codec sources are pretty simple: they use the reference codec > with > a basic wrapper to connect it to the FFmpeg AVCodec system. > > To clarify, the codec does not have a specific sample rate - it is > provided by the container (or user), which is typically 48000, but > has > also been known to be 32768. The codec does not specify channel info > either, and it's pretty much always used with one mono channel. > However, since it appears that libavcodec expects both sample rate > and > channel count to be handled by either the codec or container, I have > made the decision to allow multiple channels interleaved, which as > far > as I know has never been used, but it works fine here nevertheless. From experience it's usually better to be strict when it comes to stuff like this. The ComputerCraft people should work out a standard for this, preferably a container. We've had a similar problem in FreeDV where which codec was being used was implicit most of the time, which has been resolved with the .c2 format. > --- > Changelog | 1 + > MAINTAINERS | 1 + > doc/general_contents.texi | 1 + > libavcodec/Makefile | 2 + > libavcodec/allcodecs.c | 2 + > libavcodec/codec_desc.c | 7 ++ > libavcodec/codec_id.h | 1 + > libavcodec/dfpwmdec.c | 134 > ++ > libavcodec/dfpwmenc.c | 121 ++ > libavcodec/utils.c | 2 + > libavcodec/version.h | 4 +- > 11 files changed, 274 insertions(+), 2 deletions(-) > create mode 100644 libavcodec/dfpwmdec.c > create mode 100644 libavcodec/dfpwmenc.c Patch doesn't apply on current master (e645a1d) /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".
Re: [FFmpeg-devel] [PATCH 269/281] wavpack: convert to new channel layout API
Quoting James Almer (2022-01-13 03:07:13) > From: Anton Khirnov > > Signed-off-by: Vittorio Giovara > Signed-off-by: James Almer > --- > libavcodec/wavpack.c| 51 ++--- > libavcodec/wavpackenc.c | 29 --- > 2 files changed, 37 insertions(+), 43 deletions(-) > > diff --git a/libavcodec/wavpack.c b/libavcodec/wavpack.c > index 6b2ec19bf1..e0350ce732 100644 > --- a/libavcodec/wavpack.c > +++ b/libavcodec/wavpack.c > @@ -1512,36 +1509,32 @@ static int wavpack_decode_block(AVCodecContext > *avctx, int block_no, > new_samplerate *= rate_x; > > if (multiblock) { > -if (chan) > -new_channels = chan; > -if (chmask) > -new_chmask = chmask; > +if (chmask) { > +av_channel_layout_from_mask(&new_ch_layout, chmask); > +if (chan && new_ch_layout.nb_channels != chan) { > +av_log(avctx, AV_LOG_ERROR, "Channel mask does not match > the channel count\n"); > +return AVERROR_INVALIDDATA; > +} > +} else > +av_channel_layout_copy(&new_ch_layout, &avctx->ch_layout); user-supplied layout can be custom, so you should probably check this and the second copy below -- 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 270/281] wma: convert to new channel layout API
Quoting James Almer (2022-01-13 03:09:02) > From: Anton Khirnov > > Signed-off-by: James Almer > --- > libavcodec/wma.c| 11 ++- > libavcodec/wmadec.c | 29 +++-- > libavcodec/wmaenc.c | 27 ++- > libavcodec/wmalosslessdec.c | 13 +++-- > libavcodec/wmaprodec.c | 30 -- > libavcodec/wmavoice.c | 4 ++-- > 6 files changed, 64 insertions(+), 50 deletions(-) > > diff --git a/libavcodec/wmaprodec.c b/libavcodec/wmaprodec.c > index ba7bddc51c..5c1d38eca5 100644 > --- a/libavcodec/wmaprodec.c > +++ b/libavcodec/wmaprodec.c > @@ -384,7 +384,7 @@ static av_cold int decode_init(WMAProDecodeCtx *s, > AVCodecContext *avctx, int nu > s->decode_flags= 0x10d6; > s->bits_per_sample = 16; > channel_mask = 0; //AV_RL32(edata_ptr+2); /* not always in > expected order */ > -if ((num_stream+1) * XMA_MAX_CHANNELS_STREAM > avctx->channels) /* > stream config is 2ch + 2ch + ... + 1/2ch */ > +if ((num_stream+1) * XMA_MAX_CHANNELS_STREAM > > avctx->ch_layout.nb_channels) /* stream config is 2ch + 2ch + ... + 1/2ch */ > s->nb_channels = 1; > else > s->nb_channels = 2; > @@ -402,7 +402,7 @@ static av_cold int decode_init(WMAProDecodeCtx *s, > AVCodecContext *avctx, int nu > s->decode_flags= AV_RL16(edata_ptr+14); > channel_mask = AV_RL32(edata_ptr+2); > s->bits_per_sample = AV_RL16(edata_ptr); > -s->nb_channels = avctx->channels; > +s->nb_channels = avctx->ch_layout.nb_channels; > > if (s->bits_per_sample > 32 || s->bits_per_sample < 1) { > avpriv_request_sample(avctx, "bits per sample is %d", > s->bits_per_sample); > @@ -474,7 +474,7 @@ static av_cold int decode_init(WMAProDecodeCtx *s, > AVCodecContext *avctx, int nu > av_log(avctx, AV_LOG_ERROR, "invalid number of channels per XMA > stream %d\n", > s->nb_channels); > return AVERROR_INVALIDDATA; > -} else if (s->nb_channels > WMAPRO_MAX_CHANNELS || s->nb_channels > > avctx->channels) { > +} else if (s->nb_channels > WMAPRO_MAX_CHANNELS || s->nb_channels > > avctx->ch_layout.nb_channels) { > avpriv_request_sample(avctx, >"More than %d channels", WMAPRO_MAX_CHANNELS); > return AVERROR_PATCHWELCOME; > @@ -575,8 +575,13 @@ static av_cold int decode_init(WMAProDecodeCtx *s, > AVCodecContext *avctx, int nu > if (avctx->debug & FF_DEBUG_BITSTREAM) > dump_context(s); > > -if (avctx->codec_id == AV_CODEC_ID_WMAPRO) > -avctx->channel_layout = channel_mask; > +if (avctx->codec_id == AV_CODEC_ID_WMAPRO) { > +if (channel_mask) { > +av_channel_layout_uninit(&avctx->ch_layout); > +av_channel_layout_from_mask(&avctx->ch_layout, channel_mask); > +} else > +avctx->ch_layout.order = AV_CHANNEL_ORDER_UNSPEC; > +} > > ff_thread_once(&init_static_once, decode_init_static); > > @@ -1775,7 +1780,7 @@ static int decode_packet(AVCodecContext *avctx, > WMAProDecodeCtx *s, > AVFrame *frame = data; > > if (s->trim_start < frame->nb_samples) { > -for (int ch = 0; ch < frame->channels; ch++) > +for (int ch = 0; ch < frame->ch_layout.nb_channels; ch++) > frame->extended_data[ch] += s->trim_start * 4; > > frame->nb_samples -= s->trim_start; > @@ -1952,13 +1957,18 @@ static av_cold int xma_decode_init(AVCodecContext > *avctx) > XMADecodeCtx *s = avctx->priv_data; > int i, ret, start_channels = 0; > > -if (avctx->channels <= 0 || avctx->extradata_size == 0) > +if (avctx->ch_layout.nb_channels <= 0 || avctx->extradata_size == 0) > return AVERROR_INVALIDDATA; > > /* get stream config */ > if (avctx->codec_id == AV_CODEC_ID_XMA2 && avctx->extradata_size == 34) > { /* XMA2WAVEFORMATEX */ > +unsigned int channel_mask = AV_RL32(avctx->extradata + 2); > +if (channel_mask) { > +av_channel_layout_uninit(&avctx->ch_layout); > +av_channel_layout_from_mask(&avctx->ch_layout, channel_mask); > +} else > +avctx->ch_layout.order = AV_CHANNEL_ORDER_UNSPEC; This function doesn't seem to validate that the channel_mask is consistent with s->nb_channels - should probably be done -- 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".