Re: [FFmpeg-devel] [PATCH v3 1/2] lavf/isom: support for demuxing MPEG-H 3D Audio in MP4
Hi Jan, Thank you for the comment. > All of the samples I've seen in the wild (well, on the DASH-IF test > vector list, which is the only place I've seen both AC-4 and MPEG-H > Audio at until now) seem to utilize mha1, such as > https://dash.akamaized.net/dash264/TestCasesMCA/fraunhofer/MPEGH_714_lc_mha1/1/Sintel/Sintel.2010_1080p_incl_Credits_new_cicp19_16bit-eng-893s-12-mpegh-256000bps_seg.mp4 > Thus my initial question is if there is any reason why 'mha1' is not > added as well? Was that removed from the MP4 container specification > afterwards? 'mha1' is still documented on ISO, but the latest DASH-IOP specifies to use only mhm1 (https://dashif.org/docs/DASH-IF-IOP-v4.3.pdf) from v4.3. So it seems likely that mhm1 will become majority in MPEG-H 3D Audio in MP4. This is why this patch supports mhm1 as priority. > Additionally, are there any MPEG-H Audio specific > configuration/etc boxes required to be read/written for valid decoding > or to create a valid mux according to the spec which should be > handled? In mha1 case, it is required to handle 'mhaC' box which contains configuration for decoding. In mhm1 case (this patch), MHAS bitstream in mdat has the configuration, so the 'mhaC' is not required to handle. Regards. Yuki Tsuchiya ___ 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] avcodec/snowenc: Fix 2 undefined shifts
On Tue, Oct 15, 2019 at 01:48:38AM +0200, Michael Niedermayer wrote: > Fixes: Ticket7990 > > Signed-off-by: Michael Niedermayer > --- > libavcodec/snowenc.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) will apply patchset [...] -- 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 01/12] avcodec/wmaprodec: get frame during frame decode
On Thu, Sep 26, 2019 at 09:50:15AM +0200, Paul B Mahol wrote: > bettter add init cleanup? Thats not the problem, init does not fail with the testcase also the cleanup is called for every case init is called The problem is that ff_get_buffer() during init is not fully supported Also API says "This callback is called at the beginning of each frame to get data" so i think the change done by the patch is correct We could fix the code to make ff_get_buffer() during init work but i couldnt find another decoder that does this so it seems thats not worth it Thanks [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Those who are too smart to engage in politics are punished by being governed by those who are dumber. -- Plato 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 5/6] avcodec/hqx: Check the input data against the image size
On Sat, Oct 05, 2019 at 11:41:06PM +0200, Michael Niedermayer wrote: > Fixes: Timeout (22 -> 100 ms) > Fixes: > 15173/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HQX_fuzzer-5662556846292992 > Fixes: > 17896/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HQX_fuzzer-5679312077848576 > > Found-by: continuous fuzzing process > https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg > Signed-off-by: Michael Niedermayer > --- > libavcodec/hqx.c | 8 > 1 file changed, 8 insertions(+) will apply [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Asymptotically faster algorithms should always be preferred if you have asymptotical amounts of data 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 4/5] tools/target_dec_fuzzer: Adjust threshold for smacker
On Fri, Oct 11, 2019 at 12:40:10AM +0200, Michael Niedermayer wrote: > Fixes: Timeout (65sec -> 0.5sec) > Fixes: > 18072/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SMACKER_fuzzer-5722709366931456 > > 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 Concerning the gods, I have no means of knowing whether they exist or not or of what sort they may be, because of the obscurity of the subject, and the brevity of human life -- Protagoras 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/5] avcodec/vc1_block: Check for end of bitstream at the top of vc1_decode_i_blocks_adv()
On Sun, Sep 29, 2019 at 01:53:42AM +0200, Michael Niedermayer wrote: > Fixes: Timeout (147sec -> 2sec) > Fixes: > 17704/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VC1IMAGE_fuzzer-5723851098423296 > > Found-by: continuous fuzzing process > https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg > Signed-off-by: Michael Niedermayer > --- > libavcodec/vc1_block.c | 8 ++-- > 1 file changed, 6 insertions(+), 2 deletions(-) will apply [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Dictatorship naturally arises out of democracy, and the most aggravated form of tyranny and slavery out of the most extreme liberty. -- Plato 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] avcodec/vc1_block: Check input in the block decode loops
On Sat, Oct 12, 2019 at 09:35:43PM +0200, Michael Niedermayer wrote: > Fixes: Timeout (196sec -> 2sec) > Fixes: > 18026/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VC1_fuzzer-5640941108461568 > > Found-by: continuous fuzzing process > https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg > Signed-off-by: Michael Niedermayer > --- > libavcodec/vc1_block.c | 17 + > 1 file changed, 17 insertions(+) will apply [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB It is dangerous to be right in matters on which the established authorities are wrong. -- Voltaire 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] avutil/eval: add function to track variable use
On 05-11-2019 06:35 pm, Gyan wrote: On 05-11-2019 03:55 pm, Michael Niedermayer wrote: On Tue, Nov 05, 2019 at 10:13:52AM +0530, Gyan wrote: On 05-11-2019 04:35 am, Michael Niedermayer wrote: On Sun, Nov 03, 2019 at 11:14:25AM +0530, Gyan wrote: Helps better identification of expr eval failures. Gyan eval.c | 21 + eval.h | 10 ++ version.h | 4 ++-- 3 files changed, 33 insertions(+), 2 deletions(-) 3dd142baa0144fd324eb9da8a9932cfd7ab2cd98 0001-avutil-eval-add-function-to-track-variable-use.patch From 19bce329464676f071707b99575f80e5abe1cd4c Mon Sep 17 00:00:00 2001 From: Gyan Doshi Date: Sat, 2 Nov 2019 20:16:42 +0530 Subject: [PATCH] avutil/eval: add function to track variable use Helps avoid multiple evals of cross-referenced expressions and catch the use of non-applicable variables with respect to eval or special mode in filters Maybe you should provide more details of the use case of this, maybe with an example. Because it seems not completely obvious An example of a cross-referenced expression would be 'y=x+rand(10)'. Normally in filters, X would be evaluated first, then Y, then X again. The 2nd eval of X will overwrite the first and can generate a different value. With this func, we can avoid the 2nd eval. I'm in the process of modifying the scale filter to allow 'n', 't', 'pos' variables in frame eval mode (it already supports dynamic output based on incoming frame changes) and I would like to catch their presence in init mode, since av_expr_eval will fail. Now, it can also fail due to circularly referenced expressions e.g. 'x=y+10' and 'y=x+10' and there's no way to detect whether it's this case or if inapplicable variables have been used. please add this (or similar information) to the commit message Done. Ping. 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".
Re: [FFmpeg-devel] [PATCH 5/5] avcodec/dstdec: Use get_ur_golomb_jpegls()
On Tue, Oct 08, 2019 at 05:44:55PM +0200, Paul B Mahol wrote: > How are you sure this is still correctly decoding samples? get_ur_golomb() implements a optimized ur golomb reader for short limits with escape codes. get_ur_golomb_jpegls() supports longer codes but is slower, it differs in how it handles escape codes DST uses no limit and no escape coding it thus cannot use get_ur_golomb() the apparent schoolbook form of ur codes used in DST should produce the same value with both functions where they support it. Do you still think there is a problem ? if so please explain, i do not see one but iam human i can certainly miss issues. Thanks > > On 10/1/19, Michael Niedermayer wrote: > > Fixes: shift exponent -4 is negative > > Fixes: > > 17793/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_DST_fuzzer-5766088435957760 > > > > Found-by: continuous fuzzing process > > https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg > > Signed-off-by: Michael Niedermayer > > --- > > libavcodec/dstdec.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/libavcodec/dstdec.c b/libavcodec/dstdec.c > > index 8a1bc6a738..b2dea4a177 100644 > > --- a/libavcodec/dstdec.c > > +++ b/libavcodec/dstdec.c > > @@ -120,7 +120,7 @@ static int read_map(GetBitContext *gb, Table *t, > > unsigned int map[DST_MAX_CHANNE > > > > static av_always_inline int get_sr_golomb_dst(GetBitContext *gb, unsigned > > int k) > > { > > -int v = get_ur_golomb(gb, k, get_bits_left(gb), 0); > > +int v = get_ur_golomb_jpegls(gb, k, get_bits_left(gb), 0); > > if (v && get_bits1(gb)) > > v = -v; > > return v; > > -- > > 2.23.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 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". -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB It is dangerous to be right in matters on which the established authorities are wrong. -- Voltaire 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/2] avcodec/dstdec: Check read_table() for failure
On Wed, Oct 16, 2019 at 01:05:44AM +0200, Michael Niedermayer wrote: > Fixes: Timeout (too long -> 42sec) > Fixes: > 18181/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_DST_fuzzer-5736646250594304 > > Found-by: continuous fuzzing process > https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg > Signed-off-by: Michael Niedermayer > --- > libavcodec/dstdec.c | 8 ++-- > 1 file changed, 6 insertions(+), 2 deletions(-) will apply patchset [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Republics decline into democracies and democracies degenerate into despotisms. -- Aristotle 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/flvenc: Check pts for mpeg4/h264 (which need the value)
On Wed, Oct 16, 2019 at 01:07:13AM +0200, Michael Niedermayer wrote: > Fixes: Ticket8152 > > Signed-off-by: Michael Niedermayer > --- > libavformat/flvenc.c | 6 ++ > 1 file changed, 6 insertions(+) will apply [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB The smallest minority on earth is the individual. Those who deny individual rights cannot claim to be defenders of minorities. - Ayn Rand 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/4] avcodec/ffv1: Implementation of the CRC proposal for v4
On Fri, Oct 18, 2019 at 08:24:21PM +0200, Michael Niedermayer wrote: > On Fri, Oct 18, 2019 at 03:09:48AM +0200, Lynne wrote: > > Oct 17, 2019, 23:25 by mich...@niedermayer.cc: > > Signed-off-by: Michael Niedermayer > > --- > > libavcodec/ffv1.h| 1 + > > libavcodec/ffv1dec.c | 10 +++--- > > libavcodec/ffv1enc.c | 10 +++--- > > 3 files changed, 15 insertions(+), 6 deletions(-) > > > > Why 0x4964AF46 instead of 0x? > > CRC32 of 0x4964AF46 is 0x > > its effect is just to apply a 0x flip where its needed on the decoder > side > > This is the result of building a block [data] + [32bit checksum] which as a > whole has a CRC of 0. > So the code can be made simpler on the decoder side, the checksum no longer > represents a special case and if you want to apply error correction also > the checksum is not a special case > > If theres a more beautifull way to achive the same then iam certainly > interrested in that will apply all patches of this set except this. I intend to apply this one when the specification is updated thx [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Dictatorship: All citizens are under surveillance, all their steps and actions recorded, for the politicians to enforce control. Democracy: All politicians are under surveillance, all their steps and actions recorded, for the citizens to enforce control. 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/4] avcodec/decode: Also consider channels in max_samples check
On Sat, Oct 19, 2019 at 12:19:22AM +0200, Michael Niedermayer wrote: > Fixes: Timeout (109sec -> 0.6sec) > Fixes: > 18309/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_INTERPLAY_ACM_fuzzer-6226598168100864 > > Found-by: continuous fuzzing process > https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg > Signed-off-by: Michael Niedermayer > --- > libavcodec/decode.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) will apply [...] -- 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] avutil/lfg: Document the AVLFG struct
On Sun, Oct 20, 2019 at 12:13:29PM +0200, Michael Niedermayer wrote: > Signed-off-by: Michael Niedermayer > --- > libavutil/lfg.h | 6 ++ > 1 file changed, 6 insertions(+) will apply [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB The real ebay dictionary, page 2 "100% positive feedback" - "All either got their money back or didnt complain" "Best seller ever, very honest" - "Seller refunded buyer after failed scam" 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/5] avcodec/atrac9dec: Check precision_fine/coarse
On Sun, Oct 20, 2019 at 02:15:11AM +0200, Lynne wrote: > Oct 19, 2019, 21:39 by mich...@niedermayer.cc: > I do not know if this or some clipping or other is the best course of action. > I have only a fuzzed file which triggers this and neither reference code nor > specification which would document what to do. > If someone has some reference please reply > > Clip it. > Source: don't give up decoding imperfect files. will post a patch that clips thanks [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB The worst form of inequality is to try to make unequal things equal. -- Aristotle 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/atrac9dec: Check precision_fine/coarse
Clipping is done as it was preferred in review See: [FFmpeg-devel] [PATCH 1/5] avcodec/atrac9dec: Check precision_fine/coarse Fixes: out of array access Fixes: 18330/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ATRAC9_fuzzer-5641113058148352 Signed-off-by: Michael Niedermayer --- libavcodec/atrac9dec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/atrac9dec.c b/libavcodec/atrac9dec.c index b0f659d118..e3e4f2f14e 100644 --- a/libavcodec/atrac9dec.c +++ b/libavcodec/atrac9dec.c @@ -187,7 +187,7 @@ static inline void calc_precision(ATRAC9Context *s, ATRAC9BlockData *b, for (int i = 0; i < b->q_unit_cnt; i++) { c->precision_fine[i] = 0; if (c->precision_coarse[i] > 15) { -c->precision_fine[i] = c->precision_coarse[i] - 15; +c->precision_fine[i] = FFMIN(c->precision_coarse[i], 30) - 15; c->precision_coarse[i] = 15; } } -- 2.23.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 01/12] avcodec/wmaprodec: get frame during frame decode
ok On 11/9/19, Michael Niedermayer wrote: > On Thu, Sep 26, 2019 at 09:50:15AM +0200, Paul B Mahol wrote: >> bettter add init cleanup? > > Thats not the problem, init does not fail with the testcase > also the cleanup is called for every case init is called > > The problem is that ff_get_buffer() during init is not fully supported > > Also API says "This callback is called at the beginning of each frame to get > data" > so i think the change done by the patch is correct > > We could fix the code to make ff_get_buffer() during init work but > i couldnt find another decoder that does this so it seems thats > not worth it > > Thanks > > [...] > -- > Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB > > Those who are too smart to engage in politics are punished by being > governed by those who are dumber. -- Plato > ___ 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] avutil/eval: add function to track variable use
On Tue, Nov 05, 2019 at 06:35:54PM +0530, Gyan wrote: > > > On 05-11-2019 03:55 pm, Michael Niedermayer wrote: > >On Tue, Nov 05, 2019 at 10:13:52AM +0530, Gyan wrote: > >> > >>On 05-11-2019 04:35 am, Michael Niedermayer wrote: > >>>On Sun, Nov 03, 2019 at 11:14:25AM +0530, Gyan wrote: > Helps better identification of expr eval failures. > > Gyan > eval.c| 21 + > eval.h| 10 ++ > version.h |4 ++-- > 3 files changed, 33 insertions(+), 2 deletions(-) > 3dd142baa0144fd324eb9da8a9932cfd7ab2cd98 > 0001-avutil-eval-add-function-to-track-variable-use.patch > From 19bce329464676f071707b99575f80e5abe1cd4c Mon Sep 17 00:00:00 2001 > From: Gyan Doshi > Date: Sat, 2 Nov 2019 20:16:42 +0530 > Subject: [PATCH] avutil/eval: add function to track variable use > > Helps avoid multiple evals of cross-referenced expressions > and catch the use of non-applicable variables with respect > to eval or special mode in filters > >>>Maybe you should provide more details of the use case of this, maybe > >>>with an example. Because it seems not completely obvious > >>An example of a cross-referenced expression would be 'y=x+rand(10)'. > >>Normally in filters, X would be evaluated first, then Y, then X again. The > >>2nd eval of X will overwrite the first and can generate a different value. > >>With this func, we can avoid the 2nd eval. > >> > >>I'm in the process of modifying the scale filter to allow 'n', 't', 'pos' > >>variables in frame eval mode (it already supports dynamic output based on > >>incoming frame changes) and I would like to catch their presence in init > >>mode, since av_expr_eval will fail. Now, it can also fail due to circularly > >>referenced expressions e.g. 'x=y+10' and 'y=x+10' and there's no way to > >>detect whether it's this case or if inapplicable variables have been used. > >please add this (or similar information) to the commit message > > Done. > > Thanks, > Gyan > eval.c| 21 + > eval.h| 10 ++ > version.h |4 ++-- > 3 files changed, 33 insertions(+), 2 deletions(-) > 740f6166ddb4b1a581aee7c34edd05d328265df1 > v2-0001-avutil-eval-add-function-to-track-variable-use.patch > From 2931fa96b8e7f80581ded280907655753e54def0 Mon Sep 17 00:00:00 2001 > From: Gyan Doshi > Date: Sat, 2 Nov 2019 20:16:42 +0530 > Subject: [PATCH v2 1/2] avutil/eval: add function to track variable use i think the patch is ok but i think nicolas wants to wait with pushing this until there is a 2nd patch which uses the new function Thanks [...] -- 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".
Re: [FFmpeg-devel] [PATCH] avutil/eval: add function to track variable use
On 09-11-2019 09:39 pm, Michael Niedermayer wrote: On Tue, Nov 05, 2019 at 06:35:54PM +0530, Gyan wrote: On 05-11-2019 03:55 pm, Michael Niedermayer wrote: On Tue, Nov 05, 2019 at 10:13:52AM +0530, Gyan wrote: On 05-11-2019 04:35 am, Michael Niedermayer wrote: On Sun, Nov 03, 2019 at 11:14:25AM +0530, Gyan wrote: Helps better identification of expr eval failures. Gyan eval.c| 21 + eval.h| 10 ++ version.h |4 ++-- 3 files changed, 33 insertions(+), 2 deletions(-) 3dd142baa0144fd324eb9da8a9932cfd7ab2cd98 0001-avutil-eval-add-function-to-track-variable-use.patch From 19bce329464676f071707b99575f80e5abe1cd4c Mon Sep 17 00:00:00 2001 From: Gyan Doshi Date: Sat, 2 Nov 2019 20:16:42 +0530 Subject: [PATCH] avutil/eval: add function to track variable use Helps avoid multiple evals of cross-referenced expressions and catch the use of non-applicable variables with respect to eval or special mode in filters Maybe you should provide more details of the use case of this, maybe with an example. Because it seems not completely obvious An example of a cross-referenced expression would be 'y=x+rand(10)'. Normally in filters, X would be evaluated first, then Y, then X again. The 2nd eval of X will overwrite the first and can generate a different value. With this func, we can avoid the 2nd eval. I'm in the process of modifying the scale filter to allow 'n', 't', 'pos' variables in frame eval mode (it already supports dynamic output based on incoming frame changes) and I would like to catch their presence in init mode, since av_expr_eval will fail. Now, it can also fail due to circularly referenced expressions e.g. 'x=y+10' and 'y=x+10' and there's no way to detect whether it's this case or if inapplicable variables have been used. please add this (or similar information) to the commit message Done. Thanks, Gyan eval.c| 21 + eval.h| 10 ++ version.h |4 ++-- 3 files changed, 33 insertions(+), 2 deletions(-) 740f6166ddb4b1a581aee7c34edd05d328265df1 v2-0001-avutil-eval-add-function-to-track-variable-use.patch From 2931fa96b8e7f80581ded280907655753e54def0 Mon Sep 17 00:00:00 2001 From: Gyan Doshi Date: Sat, 2 Nov 2019 20:16:42 +0530 Subject: [PATCH v2 1/2] avutil/eval: add function to track variable use i think the patch is ok but i think nicolas wants to wait with pushing this until there is a 2nd patch which uses the new function OK, my scale patch is ready; will submit that in a couple of days, after some more testing. Thanks, 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".
Re: [FFmpeg-devel] [PATCH 3/5] avcodec/atrac3plusdec: add FF_CODEC_CAP_INIT_CLEANUP
On Sat, Oct 19, 2019 at 10:39:48PM +0200, Michael Niedermayer wrote: > Fixes: memleaks > Fixes: > 18332/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ATRAC3P_fuzzer-5655654374572032 > > Found-by: continuous fuzzing process > https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg > Signed-off-by: Michael Niedermayer > --- > libavcodec/atrac3plusdec.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) will apply [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Asymptotically faster algorithms should always be preferred if you have asymptotical amounts of data 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 4/4] avcodec/apedec: Fix integer overflow in filter_3800()
On Mon, Oct 21, 2019 at 01:20:59AM +0200, Michael Niedermayer wrote: > Fixes: signed integer overflow: 2117181180 + 60483298 cannot be represented > in type 'int' > Fixes: > 18344/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_APE_fuzzer-5685327791915008 > > Found-by: continuous fuzzing process > https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg > Signed-off-by: Michael Niedermayer > --- > libavcodec/apedec.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) will apply [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Frequently ignored answer#1 FFmpeg bugs should be sent to our bugtracker. User questions about the command line tools should be sent to the ffmpeg-user ML. And questions about how to use libav* should be sent to the libav-user ML. 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] avcodec/xsubdec: fix overflow in alpha handling
On Thu, Oct 24, 2019 at 12:54:25AM +0200, Michael Niedermayer wrote: > Fixes: left shift of 255 by 24 places cannot be represented in type 'int' > Fixes: > 18368/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_XSUB_fuzzer-5702665442426880 > > Found-by: continuous fuzzing process > https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg > Signed-off-by: Michael Niedermayer > --- > libavcodec/xsubdec.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) will apply patchset [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Dictatorship: All citizens are under surveillance, all their steps and actions recorded, for the politicians to enforce control. Democracy: All politicians are under surveillance, all their steps and actions recorded, for the citizens to enforce control. 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 4/4] avcodec/cook: Enlarge gain table
On Wed, Oct 23, 2019 at 08:57:14PM +0200, Michael Niedermayer wrote: > Fixes: index 25 out of bounds for type 'float [23]' > Fixes: > 18355/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_COOK_fuzzer-5641398941908992 > > Found-by: continuous fuzzing process > https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg > Signed-off-by: Michael Niedermayer > --- > libavcodec/cook.c | 8 > 1 file changed, 4 insertions(+), 4 deletions(-) will apply [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB You can kill me, but you cannot change the truth. 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/4] avcodec/cook: Check samples_per_channel earlier
On Wed, Oct 23, 2019 at 08:57:13PM +0200, Michael Niedermayer wrote: > Fixes: division by zero > Fixes: > 18362/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_COOK_fuzzer-5653727679086592 > > Found-by: continuous fuzzing process > https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg > Signed-off-by: Michael Niedermayer > --- > libavcodec/cook.c | 17 + > 1 file changed, 9 insertions(+), 8 deletions(-) will apply [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Opposition brings concord. Out of discord comes the fairest harmony. -- Heraclitus 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/4] avcodec/atrac3plus: Check split point in fill mode 3
On Wed, Oct 23, 2019 at 08:57:11PM +0200, Michael Niedermayer wrote: > Fixes: index 32 out of bounds for type 'int [32]' > Fixes: > 18350/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ATRAC3P_fuzzer-5643794862571520 > > Found-by: continuous fuzzing process > https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg > Signed-off-by: Michael Niedermayer > --- > libavcodec/atrac3plus.c | 4 > 1 file changed, 4 insertions(+) will apply [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB The real ebay dictionary, page 1 "Used only once"- "Some unspecified defect prevented a second use" "In good condition" - "Can be repaird by experienced expert" "As is" - "You wouldnt want it even if you were payed for it, if you knew ..." 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 4/4] avcodec/twinvq: Check block_align
On Tue, Oct 22, 2019 at 04:27:04PM +0200, Michael Niedermayer wrote: > Fixes: signed integer overflow: 538976288 * 8 cannot be represented in type > 'int' > Fixes: > 18348/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_METASOUND_fuzzer-6681325716635648 > > Found-by: continuous fuzzing process > https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg > Signed-off-by: Michael Niedermayer > --- > libavcodec/twinvq.c | 17 ++--- > 1 file changed, 10 insertions(+), 7 deletions(-) will apply [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB If a bugfix only changes things apparently unrelated to the bug with no further explanation, that is a good sign that the bugfix is wrong. 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/4] avcodec/sbcdec: Fix integer overflows in sbc_synthesize_four()
On Tue, Oct 22, 2019 at 04:27:03PM +0200, Michael Niedermayer wrote: > Fixes: signed integer overflow: 1494495519 + 1494495519 cannot be represented > in type 'int' > Fixes: > 18347/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SBC_fuzzer-5711714661695488 > > Found-by: continuous fuzzing process > https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg > Signed-off-by: Michael Niedermayer > --- > libavcodec/sbcdec.c | 28 ++-- > 1 file changed, 14 insertions(+), 14 deletions(-) will apply [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB it is not once nor twice but times without number that the same ideas make their appearance in the world. -- Aristotle 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] avcodec/cook: Move up and extend block_align check
On Fri, Oct 25, 2019 at 03:02:16PM +0200, Michael Niedermayer wrote: > Fixes: signed integer overflow: 2046820356 * 8 cannot be represented in type > 'int' > Fixes: > 18391/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_COOK_fuzzer-5631674666188800 > > Found-by: continuous fuzzing process > https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg > Signed-off-by: Michael Niedermayer > --- > libavcodec/cook.c | 7 +++ > 1 file changed, 3 insertions(+), 4 deletions(-) will apply without the " < 0" as that has become unneeded [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB "Nothing to hide" only works if the folks in power share the values of you and everyone you know entirely and always will -- Tom Scott 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] avcodec/interplayacm: Fix overflow of last unused value
On Fri, Oct 25, 2019 at 03:02:18PM +0200, Michael Niedermayer wrote: > Fixes: signed integer overflow: -2147450880 - 65535 cannot be represented in > type 'int' > Fixes: > 18393/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_INTERPLAY_ACM_fuzzer-5667520110919680 > > Found-by: continuous fuzzing process > https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg > Signed-off-by: Michael Niedermayer > --- > libavcodec/interplayacm.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) will apply [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Good people do not need laws to tell them to act responsibly, while bad people will find a way around the laws. -- Plato 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] avcodec/adpcm: Fix undefined behavior with negative predictions in IMA OKI
On Fri, Oct 25, 2019 at 03:02:17PM +0200, Michael Niedermayer wrote: > Fixes: left shift of negative value -30 > Fixes: > 18392/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ADPCM_IMA_OKI_fuzzer-5631771831435264 > > Found-by: continuous fuzzing process > https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg > Signed-off-by: Michael Niedermayer > --- > libavcodec/adpcm.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) will apply [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB No snowflake in an avalanche ever feels responsible. -- Voltaire 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 v5] avcodec: Add librav1e encoder
Port to the new send/receive API by: James Almer . Signed-off-by: Derek Buitenhuis --- rav1e now has a release, and is committed to proper semver for its soname: https://github.com/xiph/rav1e/releases/tag/0.1.0 * All problems and nits form v4 have been addressed. * Default mode is now QP 100 to match its CLI. --- configure | 5 + doc/encoders.texi | 37 +++ doc/general.texi | 7 + libavcodec/Makefile| 1 + libavcodec/allcodecs.c | 1 + libavcodec/librav1e.c | 597 + 6 files changed, 648 insertions(+) create mode 100644 libavcodec/librav1e.c diff --git a/configure b/configure index 48e1426013..1de90e93fd 100755 --- a/configure +++ b/configure @@ -254,6 +254,7 @@ External library support: --enable-libopenmpt enable decoding tracked files via libopenmpt [no] --enable-libopus enable Opus de/encoding via libopus [no] --enable-libpulseenable Pulseaudio input via libpulse [no] + --enable-librav1eenable AV1 encoding via rav1e [no] --enable-librsvg enable SVG rasterization via librsvg [no] --enable-librubberband enable rubberband needed for rubberband filter [no] --enable-librtmp enable RTMP[E] support via librtmp [no] @@ -1784,6 +1785,7 @@ EXTERNAL_LIBRARY_LIST=" libopenmpt libopus libpulse +librav1e librsvg librtmp libshine @@ -3203,6 +3205,8 @@ libopenmpt_demuxer_deps="libopenmpt" libopus_decoder_deps="libopus" libopus_encoder_deps="libopus" libopus_encoder_select="audio_frame_queue" +librav1e_encoder_deps="librav1e" +librav1e_encoder_select="extract_extradata_bsf" librsvg_decoder_deps="librsvg" libshine_encoder_deps="libshine" libshine_encoder_select="audio_frame_queue" @@ -6287,6 +6291,7 @@ enabled libopus && { } } enabled libpulse && require_pkg_config libpulse libpulse pulse/pulseaudio.h pa_context_new +enabled librav1e && require_pkg_config librav1e "rav1e >= 0.1.0" rav1e.h rav1e_context_new enabled librsvg && require_pkg_config librsvg librsvg-2.0 librsvg-2.0/librsvg/rsvg.h rsvg_handle_render_cairo enabled librtmp && require_pkg_config librtmp librtmp librtmp/rtmp.h RTMP_Socket enabled librubberband && require_pkg_config librubberband "rubberband >= 1.8.1" rubberband/rubberband-c.h rubberband_new -lstdc++ && append librubberband_extralibs "-lstdc++" diff --git a/doc/encoders.texi b/doc/encoders.texi index eefd124751..922f54df5f 100644 --- a/doc/encoders.texi +++ b/doc/encoders.texi @@ -1378,6 +1378,43 @@ makes it possible to store non-rgb pix_fmts. @end table +@section librav1e + +rav1e AV1 encoder wrapper. + +Requires the presence of the rav1e headers and library during configuration. +You need to explicitly configure the build with @code{--enable-librav1e}. + +@subsection Options + +@table @option +@item qmax +Sets the maximum quantizer to use when using bitrate mode. + +@item qmin +Sets the minimum quantizer to use when using bitrate mode. + +@item qp +Uses quantizer mode to encode at the given quantizer. + +@item speed +Selects the speed preset (0-10) to encode with. + +@item tiles +Selects how many tiles to encode with. + +@item rav1e-params +Set rav1e options using a list of @var{key}=@var{value} pairs separated +by ":". See @command{rav1e --help} for a list of options. + +For example to specify librav1e encoding options with @option{-rav1e-params}: + +@example +ffmpeg -i input -c:v librav1e -b:v 500K -rav1e-params speed=5:low_latency=true output.mp4 +@end example + +@end table + @section libaom-av1 libaom AV1 encoder wrapper. diff --git a/doc/general.texi b/doc/general.texi index 79a23e1718..a5b77e0de1 100644 --- a/doc/general.texi +++ b/doc/general.texi @@ -253,6 +253,13 @@ FFmpeg can use the OpenJPEG libraries for decoding/encoding J2K videos. Go to instructions. To enable using OpenJPEG in FFmpeg, pass @code{--enable-libopenjpeg} to @file{./configure}. +@section rav1e + +FFmpeg can make use of rav1e (Rust AV1 Encoder) via its C bindings to encode videos. +Go to @url{https://github.com/xiph/rav1e/} and follow the instructions to build +the C library. To enable using rav1e in FFmpeg, pass @code{--enable-librav1e} +to @file{./configure}. + @section TwoLAME FFmpeg can make use of the TwoLAME library for MP2 encoding. diff --git a/libavcodec/Makefile b/libavcodec/Makefile index eee1e505f9..b990c6ba87 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -993,6 +993,7 @@ OBJS-$(CONFIG_LIBOPUS_DECODER)+= libopusdec.o libopus.o \ vorbis_data.o OBJS-$(CONFIG_LIBOPUS_ENCODER)+= libopusenc.o libopus.o \ vorbis_data.o +OBJS-$(CONFIG_LIBRAV1E_ENCODER) += librav1e.o OBJS-$(CONFIG_LIBSHINE_ENCODER) += libshine.o OBJS-$(CONFIG_LIBSPEEX_DECODER) += libspeexdec.o OBJS-$(
Re: [FFmpeg-devel] [PATCH 3/4] avformat/flvenc: Use array instead of linked list for index
On Sat, Oct 26, 2019 at 05:04:20AM +0200, Andreas Rheinhardt wrote: > On Fri, Oct 25, 2019 at 10:44 PM Michael Niedermayer > wrote: > > > On Fri, Oct 25, 2019 at 11:11:46AM +0200, Andreas Rheinhardt wrote: > > > Using a linked list had very much overhead (the pointer to the next > > > entry increased the size of the index entry struct from 16 to 24 bytes, > > > not to mention the overhead of having separate allocations), so it is > > > better to (re)allocate a continuous array for the index. > > > > > > Signed-off-by: Andreas Rheinhardt > > > --- > > > libavformat/flvenc.c | 58 +++- > > > 1 file changed, 19 insertions(+), 39 deletions(-) > > > > > > diff --git a/libavformat/flvenc.c b/libavformat/flvenc.c > > > index 0e6c66a5ff..a2bd791c59 100644 > > > --- a/libavformat/flvenc.c > > > +++ b/libavformat/flvenc.c > > > @@ -74,7 +74,6 @@ typedef enum { > > > typedef struct FLVFileposition { > > > int64_t keyframe_position; > > > double keyframe_timestamp; > > > -struct FLVFileposition *next; > > > } FLVFileposition; > > > > > > typedef struct FLVContext { > > > @@ -108,9 +107,9 @@ typedef struct FLVContext { > > > int acurframeindex; > > > int64_t keyframes_info_offset; > > > > > > -int64_t filepositions_count; > > > FLVFileposition *filepositions; > > > -FLVFileposition *head_filepositions; > > > +size_t filepositions_allocated; > > > +int64_t filepositions_count; > > > > > > AVCodecParameters *audio_par; > > > AVCodecParameters *video_par; > > > @@ -549,27 +548,19 @@ static void > > flv_write_codec_header(AVFormatContext* s, AVCodecParameters* par, i > > > > > > static int flv_append_keyframe_info(AVFormatContext *s, FLVContext > > *flv, double ts, int64_t pos) > > > { > > > -FLVFileposition *position = av_malloc(sizeof(FLVFileposition)); > > > - > > > -if (!position) { > > > -av_log(s, AV_LOG_WARNING, "no mem for add keyframe index!\n"); > > > -return AVERROR(ENOMEM); > > > -} > > > - > > > -position->keyframe_timestamp = ts; > > > -position->keyframe_position = pos; > > > - > > > -if (!flv->filepositions_count) { > > > -flv->filepositions = position; > > > -flv->head_filepositions = flv->filepositions; > > > -position->next = NULL; > > > -} else { > > > -flv->filepositions->next = position; > > > -position->next = NULL; > > > -flv->filepositions = flv->filepositions->next; > > > +if (flv->filepositions_count >= flv->filepositions_allocated) { > > > +void *pos = av_realloc_array(flv->filepositions, > > > + 2 * flv->filepositions_allocated + > > 1, > > > + sizeof(*flv->filepositions)); > > > > can the 2* overflow ? > > av_fast_realloc() would check for that > > i wonder if a av_fast_realloc_array() would make sense > > > > > av_realloc_array checks that the multiplication doesn't overflow (it > actually checks that > the product fits in an int). Given that sizeof(*flv->filepositions) is > bigger than 2, no overflow > can happen in 2 * flv->filepositions_allocated + 1. Iam unsure if that check by the type used in av_realloc_array() is a good idea but if you think its ok then please add a comment in the code explaining this. Thanks [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB "Nothing to hide" only works if the folks in power share the values of you and everyone you know entirely and always will -- Tom Scott 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 01/12] avcodec/wmaprodec: get frame during frame decode
On Sat, Nov 09, 2019 at 04:11:13PM +0100, Paul B Mahol wrote: > ok will apply thanks [...] -- 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".
Re: [FFmpeg-devel] [PATCH v5] avcodec: Add librav1e encoder
On 11/9/2019 2:06 PM, Derek Buitenhuis wrote: > Port to the new send/receive API by: James Almer . > > Signed-off-by: Derek Buitenhuis > --- > rav1e now has a release, and is committed to proper semver for its soname: > https://github.com/xiph/rav1e/releases/tag/0.1.0 > > * All problems and nits form v4 have been addressed. > * Default mode is now QP 100 to match its CLI. > --- > configure | 5 + > doc/encoders.texi | 37 +++ > doc/general.texi | 7 + > libavcodec/Makefile| 1 + > libavcodec/allcodecs.c | 1 + > libavcodec/librav1e.c | 597 + > 6 files changed, 648 insertions(+) > create mode 100644 libavcodec/librav1e.c > > diff --git a/configure b/configure > index 48e1426013..1de90e93fd 100755 > --- a/configure > +++ b/configure > @@ -254,6 +254,7 @@ External library support: >--enable-libopenmpt enable decoding tracked files via libopenmpt [no] >--enable-libopus enable Opus de/encoding via libopus [no] >--enable-libpulseenable Pulseaudio input via libpulse [no] > + --enable-librav1eenable AV1 encoding via rav1e [no] >--enable-librsvg enable SVG rasterization via librsvg [no] >--enable-librubberband enable rubberband needed for rubberband filter > [no] >--enable-librtmp enable RTMP[E] support via librtmp [no] > @@ -1784,6 +1785,7 @@ EXTERNAL_LIBRARY_LIST=" > libopenmpt > libopus > libpulse > +librav1e > librsvg > librtmp > libshine > @@ -3203,6 +3205,8 @@ libopenmpt_demuxer_deps="libopenmpt" > libopus_decoder_deps="libopus" > libopus_encoder_deps="libopus" > libopus_encoder_select="audio_frame_queue" > +librav1e_encoder_deps="librav1e" > +librav1e_encoder_select="extract_extradata_bsf" > librsvg_decoder_deps="librsvg" > libshine_encoder_deps="libshine" > libshine_encoder_select="audio_frame_queue" > @@ -6287,6 +6291,7 @@ enabled libopus && { > } > } > enabled libpulse && require_pkg_config libpulse libpulse > pulse/pulseaudio.h pa_context_new > +enabled librav1e && require_pkg_config librav1e "rav1e >= 0.1.0" > rav1e.h rav1e_context_new > enabled librsvg && require_pkg_config librsvg librsvg-2.0 > librsvg-2.0/librsvg/rsvg.h rsvg_handle_render_cairo > enabled librtmp && require_pkg_config librtmp librtmp > librtmp/rtmp.h RTMP_Socket > enabled librubberband && require_pkg_config librubberband "rubberband >= > 1.8.1" rubberband/rubberband-c.h rubberband_new -lstdc++ && append > librubberband_extralibs "-lstdc++" > diff --git a/doc/encoders.texi b/doc/encoders.texi > index eefd124751..922f54df5f 100644 > --- a/doc/encoders.texi > +++ b/doc/encoders.texi > @@ -1378,6 +1378,43 @@ makes it possible to store non-rgb pix_fmts. > > @end table > > +@section librav1e > + > +rav1e AV1 encoder wrapper. > + > +Requires the presence of the rav1e headers and library during configuration. > +You need to explicitly configure the build with @code{--enable-librav1e}. > + > +@subsection Options > + > +@table @option > +@item qmax > +Sets the maximum quantizer to use when using bitrate mode. > + > +@item qmin > +Sets the minimum quantizer to use when using bitrate mode. > + > +@item qp > +Uses quantizer mode to encode at the given quantizer. > + > +@item speed > +Selects the speed preset (0-10) to encode with. > + > +@item tiles > +Selects how many tiles to encode with. > + > +@item rav1e-params > +Set rav1e options using a list of @var{key}=@var{value} pairs separated > +by ":". See @command{rav1e --help} for a list of options. > + > +For example to specify librav1e encoding options with @option{-rav1e-params}: > + > +@example > +ffmpeg -i input -c:v librav1e -b:v 500K -rav1e-params > speed=5:low_latency=true output.mp4 > +@end example > + > +@end table > + > @section libaom-av1 > > libaom AV1 encoder wrapper. > diff --git a/doc/general.texi b/doc/general.texi > index 79a23e1718..a5b77e0de1 100644 > --- a/doc/general.texi > +++ b/doc/general.texi > @@ -253,6 +253,13 @@ FFmpeg can use the OpenJPEG libraries for > decoding/encoding J2K videos. Go to > instructions. To enable using OpenJPEG in FFmpeg, pass > @code{--enable-libopenjpeg} to > @file{./configure}. > > +@section rav1e > + > +FFmpeg can make use of rav1e (Rust AV1 Encoder) via its C bindings to encode > videos. > +Go to @url{https://github.com/xiph/rav1e/} and follow the instructions to > build > +the C library. To enable using rav1e in FFmpeg, pass @code{--enable-librav1e} > +to @file{./configure}. > + > @section TwoLAME > > FFmpeg can make use of the TwoLAME library for MP2 encoding. > diff --git a/libavcodec/Makefile b/libavcodec/Makefile > index eee1e505f9..b990c6ba87 100644 > --- a/libavcodec/Makefile > +++ b/libavcodec/Makefile > @@ -993,6 +993,7 @@ OBJS-$(CONFIG_LIBOPUS_DECODER)+= libopusdec.o > libopus.o \ > v
Re: [FFmpeg-devel] [PATCH v5] avcodec: Add librav1e encoder
On 09/11/2019 18:03, James Almer wrote: >> +if (ctx->tile_rows >= 0) { > > Since these are no longer log2 values, does rav1e change 0 to 1 internally? > It may be a better idea to make 0 the default, and only call > rav1e_config_parse_int() if it's > 0. Yes. Changed to match this. >> +if (ctx->tile_cols >= 0) { > > Ditto. Fixed. > >> +rret = rav1e_config_parse_int(cfg, "tile_cols_log2", >> ctx->tile_cols); > > Should be "tile_cols". Fixed. >> +rret = rav1e_config_parse_int(cfg, "bitrate", avctx->bit_rate); >> +if (rret < 0) { >> +av_log(avctx, AV_LOG_ERROR, "Could not set bitrate.\n"); >> +ret = AVERROR_INVALIDDATA; >> +goto end; >> +} >> +} else if (ctx->quantizer >= 0) { > > Bitrate will be ignored if set. Maybe the doxy could mention it, or a > log message printed here to let the user know about it. I've added a warning if both are set. >> +switch (ret) { >> +case RA_ENCODER_STATUS_SUCCESS: >> +break; >> +case RA_ENCODER_STATUS_ENOUGH_DATA: >> +return AVERROR(EAGAIN); >> +case RA_ENCODER_STATUS_FAILURE: >> +av_log(avctx, AV_LOG_ERROR, "Could not send frame.\n"); >> +return AVERROR_EXTERNAL; >> +default: >> +av_log(avctx, AV_LOG_ERROR, "Unknown return code %d from >> rav1e_send_frame.\n", ret); >> +return AVERROR_UNKNOWN; >> +} > > You could use rav1e_status_to_str() to get the error string and print it > for the STATUS_FAILURE and default cases. Done, but I've kept it inside the switch. > Ditto here. Only the custom NEED_MORE_DATA message printed while in > draining mode is worth keeping. Done. >> + >> +pkt->buf = av_buffer_create((uint8_t *) rpkt->data, rpkt->len, >> librav1e_packet_unref, >> +rpkt, AV_BUFFER_FLAG_READONLY); > > When i came up with this zero-copy method i didn't realize that rav1e > may not be padding the buffer in question. If the padding is not at > least AV_INPUT_BUFFER_PADDING_SIZE big, then it's technically breaking > the AVPacket API, and we may have to use av_new_packet() and copy the > buffer instead. I don't think we can guarantee AV_INPUT_BUFFER_PADDING_SIZE in rav1e's API for packet data. I also assume you meant ff_alloc_packet2(), and not av_new_packet(). I've converted it to that. >> +{ "tile-rows", "number of tiles rows to encode with", >> OFFSET(tile_rows), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT64_MAX, VE }, >> +{ "tile-columns", "number of tiles columns to encode with", >> OFFSET(tile_cols), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT64_MAX, VE }, > > These two are not documented. Fixed. Thanks for the review! New patch sent. - Derek ___ 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 v6] avcodec: Add librav1e encoder
Port to the new send/receive API by: James Almer . Signed-off-by: Derek Buitenhuis --- All previous requests applied/fixed. --- configure | 5 + doc/encoders.texi | 43 +++ doc/general.texi | 7 + libavcodec/Makefile| 1 + libavcodec/allcodecs.c | 1 + libavcodec/librav1e.c | 594 + 6 files changed, 651 insertions(+) create mode 100644 libavcodec/librav1e.c diff --git a/configure b/configure index 48e1426013..1de90e93fd 100755 --- a/configure +++ b/configure @@ -254,6 +254,7 @@ External library support: --enable-libopenmpt enable decoding tracked files via libopenmpt [no] --enable-libopus enable Opus de/encoding via libopus [no] --enable-libpulseenable Pulseaudio input via libpulse [no] + --enable-librav1eenable AV1 encoding via rav1e [no] --enable-librsvg enable SVG rasterization via librsvg [no] --enable-librubberband enable rubberband needed for rubberband filter [no] --enable-librtmp enable RTMP[E] support via librtmp [no] @@ -1784,6 +1785,7 @@ EXTERNAL_LIBRARY_LIST=" libopenmpt libopus libpulse +librav1e librsvg librtmp libshine @@ -3203,6 +3205,8 @@ libopenmpt_demuxer_deps="libopenmpt" libopus_decoder_deps="libopus" libopus_encoder_deps="libopus" libopus_encoder_select="audio_frame_queue" +librav1e_encoder_deps="librav1e" +librav1e_encoder_select="extract_extradata_bsf" librsvg_decoder_deps="librsvg" libshine_encoder_deps="libshine" libshine_encoder_select="audio_frame_queue" @@ -6287,6 +6291,7 @@ enabled libopus && { } } enabled libpulse && require_pkg_config libpulse libpulse pulse/pulseaudio.h pa_context_new +enabled librav1e && require_pkg_config librav1e "rav1e >= 0.1.0" rav1e.h rav1e_context_new enabled librsvg && require_pkg_config librsvg librsvg-2.0 librsvg-2.0/librsvg/rsvg.h rsvg_handle_render_cairo enabled librtmp && require_pkg_config librtmp librtmp librtmp/rtmp.h RTMP_Socket enabled librubberband && require_pkg_config librubberband "rubberband >= 1.8.1" rubberband/rubberband-c.h rubberband_new -lstdc++ && append librubberband_extralibs "-lstdc++" diff --git a/doc/encoders.texi b/doc/encoders.texi index eefd124751..6cf3a74093 100644 --- a/doc/encoders.texi +++ b/doc/encoders.texi @@ -1378,6 +1378,49 @@ makes it possible to store non-rgb pix_fmts. @end table +@section librav1e + +rav1e AV1 encoder wrapper. + +Requires the presence of the rav1e headers and library during configuration. +You need to explicitly configure the build with @code{--enable-librav1e}. + +@subsection Options + +@table @option +@item qmax +Sets the maximum quantizer to use when using bitrate mode. + +@item qmin +Sets the minimum quantizer to use when using bitrate mode. + +@item qp +Uses quantizer mode to encode at the given quantizer. + +@item speed +Selects the speed preset (0-10) to encode with. + +@item tiles +Selects how many tiles to encode with. + +@item tile-rows +Selects how many rows of tiles to encode with. + +@item tile-columns +Selects how many columns of tiles to encode with. + +@item rav1e-params +Set rav1e options using a list of @var{key}=@var{value} pairs separated +by ":". See @command{rav1e --help} for a list of options. + +For example to specify librav1e encoding options with @option{-rav1e-params}: + +@example +ffmpeg -i input -c:v librav1e -b:v 500K -rav1e-params speed=5:low_latency=true output.mp4 +@end example + +@end table + @section libaom-av1 libaom AV1 encoder wrapper. diff --git a/doc/general.texi b/doc/general.texi index 79a23e1718..a5b77e0de1 100644 --- a/doc/general.texi +++ b/doc/general.texi @@ -253,6 +253,13 @@ FFmpeg can use the OpenJPEG libraries for decoding/encoding J2K videos. Go to instructions. To enable using OpenJPEG in FFmpeg, pass @code{--enable-libopenjpeg} to @file{./configure}. +@section rav1e + +FFmpeg can make use of rav1e (Rust AV1 Encoder) via its C bindings to encode videos. +Go to @url{https://github.com/xiph/rav1e/} and follow the instructions to build +the C library. To enable using rav1e in FFmpeg, pass @code{--enable-librav1e} +to @file{./configure}. + @section TwoLAME FFmpeg can make use of the TwoLAME library for MP2 encoding. diff --git a/libavcodec/Makefile b/libavcodec/Makefile index eee1e505f9..b990c6ba87 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -993,6 +993,7 @@ OBJS-$(CONFIG_LIBOPUS_DECODER)+= libopusdec.o libopus.o \ vorbis_data.o OBJS-$(CONFIG_LIBOPUS_ENCODER)+= libopusenc.o libopus.o \ vorbis_data.o +OBJS-$(CONFIG_LIBRAV1E_ENCODER) += librav1e.o OBJS-$(CONFIG_LIBSHINE_ENCODER) += libshine.o OBJS-$(CONFIG_LIBSPEEX_DECODER) += libspeexdec.o OBJS-$(CONFIG_LIBSPEEX_ENCODER) += libspeexenc.o
Re: [FFmpeg-devel] [PATCH v5] avcodec: Add librav1e encoder
On 11/9/2019 6:15 PM, Derek Buitenhuis wrote: > On 09/11/2019 18:03, James Almer wrote: >>> +if (ctx->tile_rows >= 0) { >> >> Since these are no longer log2 values, does rav1e change 0 to 1 internally? >> It may be a better idea to make 0 the default, and only call >> rav1e_config_parse_int() if it's > 0. > > Yes. > > Changed to match this. > >>> +if (ctx->tile_cols >= 0) { >> >> Ditto. > > Fixed. > >> >>> +rret = rav1e_config_parse_int(cfg, "tile_cols_log2", >>> ctx->tile_cols); >> >> Should be "tile_cols". > > Fixed. > >>> +rret = rav1e_config_parse_int(cfg, "bitrate", avctx->bit_rate); >>> +if (rret < 0) { >>> +av_log(avctx, AV_LOG_ERROR, "Could not set bitrate.\n"); >>> +ret = AVERROR_INVALIDDATA; >>> +goto end; >>> +} >>> +} else if (ctx->quantizer >= 0) { >> >> Bitrate will be ignored if set. Maybe the doxy could mention it, or a >> log message printed here to let the user know about it. > > I've added a warning if both are set. > >>> +switch (ret) { >>> +case RA_ENCODER_STATUS_SUCCESS: >>> +break; >>> +case RA_ENCODER_STATUS_ENOUGH_DATA: >>> +return AVERROR(EAGAIN); >>> +case RA_ENCODER_STATUS_FAILURE: >>> +av_log(avctx, AV_LOG_ERROR, "Could not send frame.\n"); >>> +return AVERROR_EXTERNAL; >>> +default: >>> +av_log(avctx, AV_LOG_ERROR, "Unknown return code %d from >>> rav1e_send_frame.\n", ret); >>> +return AVERROR_UNKNOWN; >>> +} >> >> You could use rav1e_status_to_str() to get the error string and print it >> for the STATUS_FAILURE and default cases. > > Done, but I've kept it inside the switch. > >> Ditto here. Only the custom NEED_MORE_DATA message printed while in >> draining mode is worth keeping. > > Done. > >>> + >>> +pkt->buf = av_buffer_create((uint8_t *) rpkt->data, rpkt->len, >>> librav1e_packet_unref, >>> +rpkt, AV_BUFFER_FLAG_READONLY); >> >> When i came up with this zero-copy method i didn't realize that rav1e >> may not be padding the buffer in question. If the padding is not at >> least AV_INPUT_BUFFER_PADDING_SIZE big, then it's technically breaking >> the AVPacket API, and we may have to use av_new_packet() and copy the >> buffer instead. > > I don't think we can guarantee AV_INPUT_BUFFER_PADDING_SIZE in rav1e's > API for packet data. > > I also assume you meant ff_alloc_packet2(), and not av_new_packet(). No, this encoder doesn't have an AVCodec->encode2() implementation, so it can't be used with the avcodec_encode_video2() API, only with the avcodec_send_frame()/avcodec_receive_packet() one, so no need to take user provided packets into consideration since those are not an option. If you use ff_alloc_packet2(), you'll be first copying the RaPacket to some internal buffer, which will then be copied into a ref counted buffer before being returned to the user. You can safely use av_new_packet() to allocate the packet buffer, as the AVPacket passed to AVCodec->receive_packet() will be freshly initialized and empty. > > I've converted it to that. > >>> +{ "tile-rows", "number of tiles rows to encode with", >>> OFFSET(tile_rows), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT64_MAX, VE }, >>> +{ "tile-columns", "number of tiles columns to encode with", >>> OFFSET(tile_cols), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT64_MAX, VE }, >> >> These two are not documented. > > Fixed. > > Thanks for the review! New patch sent. > > - Derek > ___ > 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 v6.1] avcodec: Add librav1e encoder
Port to the new send/receive API by: James Almer . Signed-off-by: Derek Buitenhuis --- Only difference to v6 is the call to av_new_packet(). --- configure | 5 + doc/encoders.texi | 43 +++ doc/general.texi | 7 + libavcodec/Makefile| 1 + libavcodec/allcodecs.c | 1 + libavcodec/librav1e.c | 594 + 6 files changed, 651 insertions(+) create mode 100644 libavcodec/librav1e.c diff --git a/configure b/configure index 48e1426013..1de90e93fd 100755 --- a/configure +++ b/configure @@ -254,6 +254,7 @@ External library support: --enable-libopenmpt enable decoding tracked files via libopenmpt [no] --enable-libopus enable Opus de/encoding via libopus [no] --enable-libpulseenable Pulseaudio input via libpulse [no] + --enable-librav1eenable AV1 encoding via rav1e [no] --enable-librsvg enable SVG rasterization via librsvg [no] --enable-librubberband enable rubberband needed for rubberband filter [no] --enable-librtmp enable RTMP[E] support via librtmp [no] @@ -1784,6 +1785,7 @@ EXTERNAL_LIBRARY_LIST=" libopenmpt libopus libpulse +librav1e librsvg librtmp libshine @@ -3203,6 +3205,8 @@ libopenmpt_demuxer_deps="libopenmpt" libopus_decoder_deps="libopus" libopus_encoder_deps="libopus" libopus_encoder_select="audio_frame_queue" +librav1e_encoder_deps="librav1e" +librav1e_encoder_select="extract_extradata_bsf" librsvg_decoder_deps="librsvg" libshine_encoder_deps="libshine" libshine_encoder_select="audio_frame_queue" @@ -6287,6 +6291,7 @@ enabled libopus && { } } enabled libpulse && require_pkg_config libpulse libpulse pulse/pulseaudio.h pa_context_new +enabled librav1e && require_pkg_config librav1e "rav1e >= 0.1.0" rav1e.h rav1e_context_new enabled librsvg && require_pkg_config librsvg librsvg-2.0 librsvg-2.0/librsvg/rsvg.h rsvg_handle_render_cairo enabled librtmp && require_pkg_config librtmp librtmp librtmp/rtmp.h RTMP_Socket enabled librubberband && require_pkg_config librubberband "rubberband >= 1.8.1" rubberband/rubberband-c.h rubberband_new -lstdc++ && append librubberband_extralibs "-lstdc++" diff --git a/doc/encoders.texi b/doc/encoders.texi index eefd124751..6cf3a74093 100644 --- a/doc/encoders.texi +++ b/doc/encoders.texi @@ -1378,6 +1378,49 @@ makes it possible to store non-rgb pix_fmts. @end table +@section librav1e + +rav1e AV1 encoder wrapper. + +Requires the presence of the rav1e headers and library during configuration. +You need to explicitly configure the build with @code{--enable-librav1e}. + +@subsection Options + +@table @option +@item qmax +Sets the maximum quantizer to use when using bitrate mode. + +@item qmin +Sets the minimum quantizer to use when using bitrate mode. + +@item qp +Uses quantizer mode to encode at the given quantizer. + +@item speed +Selects the speed preset (0-10) to encode with. + +@item tiles +Selects how many tiles to encode with. + +@item tile-rows +Selects how many rows of tiles to encode with. + +@item tile-columns +Selects how many columns of tiles to encode with. + +@item rav1e-params +Set rav1e options using a list of @var{key}=@var{value} pairs separated +by ":". See @command{rav1e --help} for a list of options. + +For example to specify librav1e encoding options with @option{-rav1e-params}: + +@example +ffmpeg -i input -c:v librav1e -b:v 500K -rav1e-params speed=5:low_latency=true output.mp4 +@end example + +@end table + @section libaom-av1 libaom AV1 encoder wrapper. diff --git a/doc/general.texi b/doc/general.texi index 79a23e1718..a5b77e0de1 100644 --- a/doc/general.texi +++ b/doc/general.texi @@ -253,6 +253,13 @@ FFmpeg can use the OpenJPEG libraries for decoding/encoding J2K videos. Go to instructions. To enable using OpenJPEG in FFmpeg, pass @code{--enable-libopenjpeg} to @file{./configure}. +@section rav1e + +FFmpeg can make use of rav1e (Rust AV1 Encoder) via its C bindings to encode videos. +Go to @url{https://github.com/xiph/rav1e/} and follow the instructions to build +the C library. To enable using rav1e in FFmpeg, pass @code{--enable-librav1e} +to @file{./configure}. + @section TwoLAME FFmpeg can make use of the TwoLAME library for MP2 encoding. diff --git a/libavcodec/Makefile b/libavcodec/Makefile index eee1e505f9..b990c6ba87 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -993,6 +993,7 @@ OBJS-$(CONFIG_LIBOPUS_DECODER)+= libopusdec.o libopus.o \ vorbis_data.o OBJS-$(CONFIG_LIBOPUS_ENCODER)+= libopusenc.o libopus.o \ vorbis_data.o +OBJS-$(CONFIG_LIBRAV1E_ENCODER) += librav1e.o OBJS-$(CONFIG_LIBSHINE_ENCODER) += libshine.o OBJS-$(CONFIG_LIBSPEEX_DECODER) += libspeexdec.o OBJS-$(CONFIG_LIBSPEEX_ENCODER)
Re: [FFmpeg-devel] [PATCH v5] avcodec: Add librav1e encoder
On 09/11/2019 21:47, James Almer wrote: > No, this encoder doesn't have an AVCodec->encode2() implementation, so > it can't be used with the avcodec_encode_video2() API, only with the > avcodec_send_frame()/avcodec_receive_packet() one, so no need to take > user provided packets into consideration since those are not an option. > If you use ff_alloc_packet2(), you'll be first copying the RaPacket to > some internal buffer, which will then be copied into a ref counted > buffer before being returned to the user. > > You can safely use av_new_packet() to allocate the packet buffer, as the > AVPacket passed to AVCodec->receive_packet() will be freshly initialized > and empty. How "obvious"... Anyway, simple fix. Update sent. - Derek ___ 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] avcodec: Add librav1e encoder
On 11/9/2019 7:00 PM, Derek Buitenhuis wrote: > Port to the new send/receive API by: James Almer . > > Signed-off-by: Derek Buitenhuis > --- > Only difference to v6 is the call to av_new_packet(). > --- > configure | 5 + > doc/encoders.texi | 43 +++ > doc/general.texi | 7 + > libavcodec/Makefile| 1 + > libavcodec/allcodecs.c | 1 + > libavcodec/librav1e.c | 594 + > 6 files changed, 651 insertions(+) > create mode 100644 libavcodec/librav1e.c LGTM. Don't forget to add a line to Changelog and bump lavc minor before pushing. Thanks. ___ 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/7] avcodec/g729dec: Check for KELVIN && 6k4
This combination would assume different block sizes throughout the code so its better to error out. No testcase Signed-off-by: Michael Niedermayer --- libavcodec/g729dec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/g729dec.c b/libavcodec/g729dec.c index 67054b71df..ffccbc431b 100644 --- a/libavcodec/g729dec.c +++ b/libavcodec/g729dec.c @@ -431,7 +431,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame_ptr, ctx->onset = 0; ctx->voice_decision = DECISION_VOICE; av_log(avctx, AV_LOG_DEBUG, "Packet type: %s\n", "G.729 @ 8kbit/s"); -} else if (buf_size == G729D_6K4_BLOCK_SIZE * avctx->channels) { +} else if (buf_size == G729D_6K4_BLOCK_SIZE * avctx->channels && avctx->codec_id != AV_CODEC_ID_ACELP_KELVIN) { packet_type = FORMAT_G729D_6K4; format = &format_g729d_6k4; av_log(avctx, AV_LOG_DEBUG, "Packet type: %s\n", "G.729D @ 6.4kbit/s"); -- 2.23.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 6/7] avcodec/alsdec: Avoid 1 layer of pointer dereferences in INTERLEAVE_OUTPUT()
This optimizes the code slightly (116 -> 80sec) Testcase: 18668/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ALS_fuzzer-5710836719157248 Signed-off-by: Michael Niedermayer --- libavcodec/alsdec.c | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/libavcodec/alsdec.c b/libavcodec/alsdec.c index 4bc0e2bd84..babe30bdc7 100644 --- a/libavcodec/alsdec.c +++ b/libavcodec/alsdec.c @@ -1819,16 +1819,17 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame_ptr, { \ int##bps##_t *dest = (int##bps##_t*)frame->data[0]; \ int channels = avctx->channels; \ -int32_t **raw_samples = ctx->raw_samples; \ +int32_t *raw_samples = ctx->raw_samples[0]; \ +int raw_step = channels > 1 ? ctx->raw_samples[1] - raw_samples : 1; \ shift = bps - ctx->avctx->bits_per_raw_sample; \ if (!ctx->cs_switch) { \ for (sample = 0; sample < ctx->cur_frame_length; sample++) \ for (c = 0; c < channels; c++) \ -*dest++ = raw_samples[c][sample] * (1U << shift); \ +*dest++ = raw_samples[c*raw_step + sample] * (1U << shift); \ } else { \ for (sample = 0; sample < ctx->cur_frame_length; sample++) \ for (c = 0; c < channels; c++) \ -*dest++ = raw_samples[sconf->chan_pos[c]][sample] * (1U << shift);\ +*dest++ = raw_samples[sconf->chan_pos[c]*raw_step + sample] * (1U << shift);\ } \ } -- 2.23.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 3/7] avcodec/g729dec: Factor block_size out
This will be used in the next commit Signed-off-by: Michael Niedermayer --- libavcodec/g729dec.c | 7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/libavcodec/g729dec.c b/libavcodec/g729dec.c index d728b388b4..300fac1c04 100644 --- a/libavcodec/g729dec.c +++ b/libavcodec/g729dec.c @@ -97,6 +97,7 @@ typedef struct { uint8_t gc_2nd_index_bits; ///< gain codebook (second stage) index (size in bits) uint8_t fc_signs_bits; ///< number of pulses in fixed-codebook vector uint8_t fc_indexes_bits;///< size (in bits) of fixed-codebook index entry +uint8_t block_size; } G729FormatDescription; typedef struct { @@ -165,6 +166,7 @@ static const G729FormatDescription format_g729_8k = { .gc_2nd_index_bits = GC_2ND_IDX_BITS_8K, .fc_signs_bits = 4, .fc_indexes_bits = 13, +.block_size= G729_8K_BLOCK_SIZE, }; static const G729FormatDescription format_g729d_6k4 = { @@ -174,6 +176,7 @@ static const G729FormatDescription format_g729d_6k4 = { .gc_2nd_index_bits = GC_2ND_IDX_BITS_6K4, .fc_signs_bits = 2, .fc_indexes_bits = 9, +.block_size= G729D_6K4_BLOCK_SIZE, }; /** @@ -728,12 +731,12 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame_ptr, /* Save signal for use in next frame. */ memmove(ctx->exc_base, ctx->exc_base + 2 * SUBFRAME_SIZE, (PITCH_DELAY_MAX+INTERPOL_LEN)*sizeof(int16_t)); -buf += packet_type == FORMAT_G729_8K ? G729_8K_BLOCK_SIZE : G729D_6K4_BLOCK_SIZE; +buf += format->block_size; ctx++; } *got_frame_ptr = 1; -return packet_type == FORMAT_G729_8K ? (G729_8K_BLOCK_SIZE + (avctx->codec_id == AV_CODEC_ID_ACELP_KELVIN)) * avctx->channels : G729D_6K4_BLOCK_SIZE * avctx->channels; +return (format->block_size + (avctx->codec_id == AV_CODEC_ID_ACELP_KELVIN)) * avctx->channels; } static av_cold int decode_close(AVCodecContext *avctx) -- 2.23.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 4/7] avcodec/g729dec: Avoid using buf_size
buf_size is not updated as buf is advanced so it is wrong after the first iteration Fixes: Timeout (160sec -> 27sec) Fixes: 18658/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_G729_fuzzer-5729784269373440 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavcodec/g729dec.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/g729dec.c b/libavcodec/g729dec.c index 300fac1c04..4d70cb6eba 100644 --- a/libavcodec/g729dec.c +++ b/libavcodec/g729dec.c @@ -454,11 +454,11 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame_ptr, buf++; } -for (i = 0; i < buf_size; i++) +for (i = 0; i < format->block_size; i++) frame_erasure |= buf[i]; frame_erasure = !frame_erasure; -init_get_bits(&gb, buf, 8*buf_size); +init_get_bits(&gb, buf, 8*format->block_size); ma_predictor = get_bits(&gb, 1); quantizer_1st= get_bits(&gb, VQ_1ST_BITS); -- 2.23.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 7/7] avcodec/alsdec: Discard frames for which no channel could be decoded
Fixes: Timeout (80sec -> 33sec) Fixes: 18668/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ALS_fuzzer-5710836719157248 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavcodec/alsdec.c | 8 1 file changed, 8 insertions(+) diff --git a/libavcodec/alsdec.c b/libavcodec/alsdec.c index babe30bdc7..62c6036037 100644 --- a/libavcodec/alsdec.c +++ b/libavcodec/alsdec.c @@ -236,6 +236,7 @@ typedef struct ALSDecContext { int **raw_mantissa; ///< decoded mantissa bits of the difference signal unsigned char *larray; ///< buffer to store the output of masked lz decompression int *nbits; ///< contains the number of bits to read for masked lz decompression for all samples +int highest_decoded_channel; } ALSDecContext; @@ -1678,6 +1679,7 @@ static int read_frame_data(ALSDecContext *ctx, unsigned int ra_frame) memmove(ctx->raw_samples[c] - sconf->max_order, ctx->raw_samples[c] - sconf->max_order + sconf->frame_length, sizeof(*ctx->raw_samples[c]) * sconf->max_order); +ctx->highest_decoded_channel = c; } } else { // multi-channel coding ALSBlockData bd = { 0 }; @@ -1746,6 +1748,8 @@ static int read_frame_data(ALSDecContext *ctx, unsigned int ra_frame) if ((ret = decode_block(ctx, &bd)) < 0) return ret; + +ctx->highest_decoded_channel = FFMAX(ctx->highest_decoded_channel, c); } memset(reverted_channels, 0, avctx->channels * sizeof(*reverted_channels)); @@ -1802,11 +1806,15 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame_ptr, else ctx->cur_frame_length = sconf->frame_length; +ctx->highest_decoded_channel = 0; // decode the frame data if ((invalid_frame = read_frame_data(ctx, ra_frame)) < 0) av_log(ctx->avctx, AV_LOG_WARNING, "Reading frame data failed. Skipping RA unit.\n"); +if (ctx->highest_decoded_channel == 0) +return AVERROR_INVALIDDATA; + ctx->frame_id++; /* get output buffer */ -- 2.23.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/7] avcodec/g729dec: require buf_size to be non 0
The 0 case was added with the support for multiple packets. It appears unintended and causes extra complexity and out of array accesses (though within padding) No testcase Signed-off-by: Michael Niedermayer --- libavcodec/g729dec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/g729dec.c b/libavcodec/g729dec.c index ffccbc431b..d728b388b4 100644 --- a/libavcodec/g729dec.c +++ b/libavcodec/g729dec.c @@ -424,7 +424,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame_ptr, if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) return ret; -if (buf_size % ((G729_8K_BLOCK_SIZE + (avctx->codec_id == AV_CODEC_ID_ACELP_KELVIN)) * avctx->channels) == 0) { +if (buf_size && buf_size % ((G729_8K_BLOCK_SIZE + (avctx->codec_id == AV_CODEC_ID_ACELP_KELVIN)) * avctx->channels) == 0) { packet_type = FORMAT_G729_8K; format = &format_g729_8k; //Reset voice decision -- 2.23.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 5/7] avcodec/g729dec: Avoid one multiply by using init_get_bits8()
Signed-off-by: Michael Niedermayer --- libavcodec/g729dec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/g729dec.c b/libavcodec/g729dec.c index 4d70cb6eba..75e422814c 100644 --- a/libavcodec/g729dec.c +++ b/libavcodec/g729dec.c @@ -458,7 +458,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame_ptr, frame_erasure |= buf[i]; frame_erasure = !frame_erasure; -init_get_bits(&gb, buf, 8*format->block_size); +init_get_bits8(&gb, buf, format->block_size); ma_predictor = get_bits(&gb, 1); quantizer_1st= get_bits(&gb, VQ_1ST_BITS); -- 2.23.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] avcodec/encode: add missing assert to avcodec_receive_packet()
Encoders must return reference counted packets. This was checked only for encoders using the encode2 AVCodec API, while blindly accepting whatever encoders using the receive_packet AVCodec API were returning. Signed-off-by: James Almer --- libavcodec/encode.c | 8 +++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/libavcodec/encode.c b/libavcodec/encode.c index d81b32b983..9ed2cf0f59 100644 --- a/libavcodec/encode.c +++ b/libavcodec/encode.c @@ -428,9 +428,15 @@ int attribute_align_arg avcodec_receive_packet(AVCodecContext *avctx, AVPacket * return AVERROR(EINVAL); if (avctx->codec->receive_packet) { +int ret; if (avctx->internal->draining && !(avctx->codec->capabilities & AV_CODEC_CAP_DELAY)) return AVERROR_EOF; -return avctx->codec->receive_packet(avctx, avpkt); +ret = avctx->codec->receive_packet(avctx, avpkt); +if (!ret) +// Encoders must always return ref-counted buffers. +// Side-data only packets have no data and can be not ref-counted. +av_assert0(!avpkt->data || avpkt->buf); +return ret; } // Emulation via old API. -- 2.23.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 v5] avcodec: Add librav1e encoder
On 11/9/2019 7:01 PM, Derek Buitenhuis wrote: > On 09/11/2019 21:47, James Almer wrote: >> No, this encoder doesn't have an AVCodec->encode2() implementation, so >> it can't be used with the avcodec_encode_video2() API, only with the >> avcodec_send_frame()/avcodec_receive_packet() one, so no need to take >> user provided packets into consideration since those are not an option. >> If you use ff_alloc_packet2(), you'll be first copying the RaPacket to >> some internal buffer, which will then be copied into a ref counted >> buffer before being returned to the user. >> >> You can safely use av_new_packet() to allocate the packet buffer, as the >> AVPacket passed to AVCodec->receive_packet() will be freshly initialized >> and empty. > > How "obvious"... Actually, i'm partly wrong, avcodec_receive_packet() is not ensuring the packet returned by the encoder is reference counted. So for this version it would give the user the output of ff_alloc_packet2() as is... Lovely. Guess an av_assert0() is in order. > > Anyway, simple fix. Update sent. > > - Derek > ___ > 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] avformat/mxfenc: simplify d-10 ul handling
--- libavformat/mxfenc.c | 110 --- 1 file changed, 41 insertions(+), 69 deletions(-) diff --git a/libavformat/mxfenc.c b/libavformat/mxfenc.c index 122d336fc3..b7ae5cc637 100644 --- a/libavformat/mxfenc.c +++ b/libavformat/mxfenc.c @@ -123,18 +123,8 @@ enum ULIndex { INDEX_MPEG2 = 0, INDEX_AES3, INDEX_WAV, -INDEX_D10_625_50_50_VIDEO, -INDEX_D10_625_50_50_AUDIO, -INDEX_D10_525_60_50_VIDEO, -INDEX_D10_525_60_50_AUDIO, -INDEX_D10_625_50_40_VIDEO, -INDEX_D10_625_50_40_AUDIO, -INDEX_D10_525_60_40_VIDEO, -INDEX_D10_525_60_40_AUDIO, -INDEX_D10_625_50_30_VIDEO, -INDEX_D10_625_50_30_AUDIO, -INDEX_D10_525_60_30_VIDEO, -INDEX_D10_525_60_30_AUDIO, +INDEX_D10_VIDEO, +INDEX_D10_AUDIO, INDEX_DV, INDEX_DNXHD, INDEX_JPEG2000, @@ -179,60 +169,16 @@ static const MXFContainerEssenceEntry mxf_essence_container_uls[] = { { 0x06,0x0E,0x2B,0x34,0x01,0x02,0x01,0x01,0x0D,0x01,0x03,0x01,0x16,0x01,0x01,0x00 }, { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x04,0x02,0x02,0x01,0x00,0x00,0x00,0x00 }, mxf_write_wav_desc }, -// D-10 625/50 PAL 50mb/s +// D-10 Video { { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x0D,0x01,0x03,0x01,0x02,0x01,0x01,0x01 }, { 0x06,0x0E,0x2B,0x34,0x01,0x02,0x01,0x01,0x0D,0x01,0x03,0x01,0x05,0x01,0x01,0x00 }, { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x04,0x01,0x02,0x02,0x01,0x02,0x01,0x01 }, mxf_write_cdci_desc }, +// D-10 Audio { { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x0D,0x01,0x03,0x01,0x02,0x01,0x01,0x01 }, { 0x06,0x0E,0x2B,0x34,0x01,0x02,0x01,0x01,0x0D,0x01,0x03,0x01,0x06,0x01,0x10,0x00 }, { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x04,0x02,0x02,0x01,0x00,0x00,0x00,0x00 }, mxf_write_generic_sound_desc }, -// D-10 525/60 NTSC 50mb/s -{ { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x0D,0x01,0x03,0x01,0x02,0x01,0x02,0x01 }, - { 0x06,0x0E,0x2B,0x34,0x01,0x02,0x01,0x01,0x0D,0x01,0x03,0x01,0x05,0x01,0x01,0x00 }, - { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x04,0x01,0x02,0x02,0x01,0x02,0x01,0x02 }, - mxf_write_cdci_desc }, -{ { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x0D,0x01,0x03,0x01,0x02,0x01,0x02,0x01 }, - { 0x06,0x0E,0x2B,0x34,0x01,0x02,0x01,0x01,0x0D,0x01,0x03,0x01,0x06,0x01,0x10,0x00 }, - { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x04,0x02,0x02,0x01,0x00,0x00,0x00,0x00 }, - mxf_write_generic_sound_desc }, -// D-10 625/50 PAL 40mb/s -{ { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x0D,0x01,0x03,0x01,0x02,0x01,0x03,0x01 }, - { 0x06,0x0E,0x2B,0x34,0x01,0x02,0x01,0x01,0x0D,0x01,0x03,0x01,0x05,0x01,0x01,0x00 }, - { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x04,0x01,0x02,0x02,0x01,0x02,0x01,0x03 }, - mxf_write_cdci_desc }, -{ { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x0D,0x01,0x03,0x01,0x02,0x01,0x03,0x01 }, - { 0x06,0x0E,0x2B,0x34,0x01,0x02,0x01,0x01,0x0D,0x01,0x03,0x01,0x06,0x01,0x10,0x00 }, - { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x04,0x02,0x02,0x01,0x00,0x00,0x00,0x00 }, - mxf_write_generic_sound_desc }, -// D-10 525/60 NTSC 40mb/s -{ { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x0D,0x01,0x03,0x01,0x02,0x01,0x04,0x01 }, - { 0x06,0x0E,0x2B,0x34,0x01,0x02,0x01,0x01,0x0D,0x01,0x03,0x01,0x05,0x01,0x01,0x00 }, - { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x04,0x01,0x02,0x02,0x01,0x02,0x01,0x04 }, - mxf_write_cdci_desc }, -{ { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x0D,0x01,0x03,0x01,0x02,0x01,0x04,0x01 }, - { 0x06,0x0E,0x2B,0x34,0x01,0x02,0x01,0x01,0x0D,0x01,0x03,0x01,0x06,0x01,0x10,0x00 }, - { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x04,0x02,0x02,0x01,0x00,0x00,0x00,0x00 }, - mxf_write_generic_sound_desc }, -// D-10 625/50 PAL 30mb/s -{ { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x0D,0x01,0x03,0x01,0x02,0x01,0x05,0x01 }, - { 0x06,0x0E,0x2B,0x34,0x01,0x02,0x01,0x01,0x0D,0x01,0x03,0x01,0x05,0x01,0x01,0x00 }, - { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x04,0x01,0x02,0x02,0x01,0x02,0x01,0x05 }, - mxf_write_cdci_desc }, -{ { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x0D,0x01,0x03,0x01,0x02,0x01,0x05,0x01 }, - { 0x06,0x0E,0x2B,0x34,0x01,0x02,0x01,0x01,0x0D,0x01,0x03,0x01,0x06,0x01,0x10,0x00 }, - { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x04,0x02,0x02,0x01,0x00,0x00,0x00,0x00 }, - mxf_write_generic_sound_desc }, -// D-10 525/60 NTSC 30mb/s -{ { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x0D,0x01,0x03,0x01,0x02,0x01,0x06,0x01 }, - { 0x06,0x0E,0x2B,0x34,0x01,0x02,0x01,0x01,0x0D,0x01,0x03,0x01,0x05,0x01,0x01,0x00 }, - { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x04,0x01,0x02,0x02,0x01,0x02,0x01,0x06 }, - mxf_write_cdci_desc }, -{ { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x0D,0x01,0x03,0x01,0x02,0x01,0x06,0x01 }, - { 0x06,0x0E,0x2B,0x34,0x01,0x02,0x0
[FFmpeg-devel] [PATCH] avformat/mxfenc: simplify dv ul handling
--- libavformat/mxfenc.c | 126 --- 1 file changed, 45 insertions(+), 81 deletions(-) diff --git a/libavformat/mxfenc.c b/libavformat/mxfenc.c index aa23ee3947..122d336fc3 100644 --- a/libavformat/mxfenc.c +++ b/libavformat/mxfenc.c @@ -83,6 +83,7 @@ typedef struct MXFStreamContext { UID track_essence_element_key; int index; ///< index in mxf_essence_container_uls table const UID *codec_ul; +const UID *container_ul; int order; ///< interleaving order if dts are equal int interlaced; ///< whether picture is interlaced int field_dominance; ///< tff=1, bff=2 @@ -135,16 +136,6 @@ enum ULIndex { INDEX_D10_525_60_30_VIDEO, INDEX_D10_525_60_30_AUDIO, INDEX_DV, -INDEX_DV25_525_60, -INDEX_DV25_625_50, -INDEX_DV25_525_60_IEC, -INDEX_DV25_625_50_IEC, -INDEX_DV50_525_60, -INDEX_DV50_625_50, -INDEX_DV100_1080_60, -INDEX_DV100_1080_50, -INDEX_DV100_720_60, -INDEX_DV100_720_50, INDEX_DNXHD, INDEX_JPEG2000, INDEX_H264, @@ -242,64 +233,11 @@ static const MXFContainerEssenceEntry mxf_essence_container_uls[] = { { 0x06,0x0E,0x2B,0x34,0x01,0x02,0x01,0x01,0x0D,0x01,0x03,0x01,0x06,0x01,0x10,0x00 }, { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x04,0x02,0x02,0x01,0x00,0x00,0x00,0x00 }, mxf_write_generic_sound_desc }, -// DV Unknown +// DV { { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x0D,0x01,0x03,0x01,0x02,0x02,0x7F,0x01 }, { 0x06,0x0E,0x2B,0x34,0x01,0x02,0x01,0x01,0x0D,0x01,0x03,0x01,0x18,0x01,0x01,0x00 }, { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x04,0x01,0x02,0x02,0x02,0x00,0x00,0x00 }, mxf_write_cdci_desc }, - -// DV25 525/60 -{ { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x0D,0x01,0x03,0x01,0x02,0x02,0x40,0x01 }, - { 0x06,0x0E,0x2B,0x34,0x01,0x02,0x01,0x01,0x0D,0x01,0x03,0x01,0x18,0x01,0x01,0x00 }, - { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x04,0x01,0x02,0x02,0x02,0x02,0x01,0x00 }, - mxf_write_cdci_desc }, -// DV25 625/50 -{ { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x0D,0x01,0x03,0x01,0x02,0x02,0x41,0x01 }, - { 0x06,0x0E,0x2B,0x34,0x01,0x02,0x01,0x01,0x0D,0x01,0x03,0x01,0x18,0x01,0x01,0x00 }, - { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x04,0x01,0x02,0x02,0x02,0x02,0x02,0x00 }, - mxf_write_cdci_desc }, - -// IEC DV25 525/60 -{ { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x0D,0x01,0x03,0x01,0x02,0x02,0x01,0x01 }, - { 0x06,0x0E,0x2B,0x34,0x01,0x02,0x01,0x01,0x0D,0x01,0x03,0x01,0x18,0x01,0x01,0x00 }, - { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x04,0x01,0x02,0x02,0x02,0x02,0x01,0x00 }, - mxf_write_cdci_desc }, -// IEC DV25 625/50 -{ { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x0D,0x01,0x03,0x01,0x02,0x02,0x02,0x01 }, - { 0x06,0x0E,0x2B,0x34,0x01,0x02,0x01,0x01,0x0D,0x01,0x03,0x01,0x18,0x01,0x01,0x00 }, - { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x04,0x01,0x02,0x02,0x02,0x01,0x02,0x00 }, - mxf_write_cdci_desc }, - - // DV50 525/60 -{ { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x0D,0x01,0x03,0x01,0x02,0x02,0x50,0x01 }, - { 0x06,0x0E,0x2B,0x34,0x01,0x02,0x01,0x01,0x0D,0x01,0x03,0x01,0x18,0x01,0x01,0x00 }, - { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x04,0x01,0x02,0x02,0x02,0x02,0x03,0x00 }, - mxf_write_cdci_desc }, -// DV50 625/50 -{ { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x0D,0x01,0x03,0x01,0x02,0x02,0x51,0x01 }, - { 0x06,0x0E,0x2B,0x34,0x01,0x02,0x01,0x01,0x0D,0x01,0x03,0x01,0x18,0x01,0x01,0x00 }, - { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x04,0x01,0x02,0x02,0x02,0x02,0x04,0x00 }, - mxf_write_cdci_desc }, -// DV100 1080/60 -{ { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x0D,0x01,0x03,0x01,0x02,0x02,0x60,0x01 }, - { 0x06,0x0E,0x2B,0x34,0x01,0x02,0x01,0x01,0x0D,0x01,0x03,0x01,0x18,0x01,0x01,0x00 }, - { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x04,0x01,0x02,0x02,0x02,0x02,0x05,0x00 }, - mxf_write_cdci_desc }, -// DV100 1080/50 -{ { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x0D,0x01,0x03,0x01,0x02,0x02,0x61,0x01 }, - { 0x06,0x0E,0x2B,0x34,0x01,0x02,0x01,0x01,0x0D,0x01,0x03,0x01,0x18,0x01,0x01,0x00 }, - { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x04,0x01,0x02,0x02,0x02,0x02,0x06,0x00 }, - mxf_write_cdci_desc }, -// DV100 720/60 -{ { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x0D,0x01,0x03,0x01,0x02,0x02,0x62,0x01 }, - { 0x06,0x0E,0x2B,0x34,0x01,0x02,0x01,0x01,0x0D,0x01,0x03,0x01,0x18,0x01,0x01,0x00 }, - { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x04,0x01,0x02,0x02,0x02,0x02,0x07,0x00 }, - mxf_write_cdci_desc }, -// DV100 720/50 -{ { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x0D,0x01,0x03,0x01,0x02,0x02,0x63,0x01 }, - { 0x06,0x0E,0x2B,0x34,0x01,0x02,0x01,0x01,0x0D,0x01,0x03,0x01,0x18,0x01,0x01,0x00 }, - { 0x06,
[FFmpeg-devel] [PATCH] avformat/mxfenc: correctly set width values for dvcprohd
--- libavformat/mxfenc.c | 15 --- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/libavformat/mxfenc.c b/libavformat/mxfenc.c index b7ae5cc637..f7df9c3daf 100644 --- a/libavformat/mxfenc.c +++ b/libavformat/mxfenc.c @@ -1092,7 +1092,7 @@ static int64_t mxf_write_cdci_common(AVFormatContext *s, AVStream *st, const UID { MXFStreamContext *sc = st->priv_data; AVIOContext *pb = s->pb; -int stored_width = (st->codecpar->width +15)/16*16; +int stored_width = 0; int stored_height = (st->codecpar->height+15)/16*16; int display_height; int f1, f2; @@ -1101,6 +1101,15 @@ static int64_t mxf_write_cdci_common(AVFormatContext *s, AVStream *st, const UID get_trc(transfer_ul, st->codecpar->color_trc); +if (st->codecpar->codec_id == AV_CODEC_ID_DVVIDEO) { +if (st->codecpar->height == 1080) +stored_width = 1920; +else if (st->codecpar->height == 720) +stored_width = 1280; +} +if (!stored_width) +stored_width = (st->codecpar->width+15)/16*16; + mxf_write_local_tag(pb, 4, 0x3203); avio_wb32(pb, stored_width); @@ -1123,7 +1132,7 @@ static int64_t mxf_write_cdci_common(AVFormatContext *s, AVStream *st, const UID //Sampled width mxf_write_local_tag(pb, 4, 0x3205); -avio_wb32(pb, st->codecpar->width); +avio_wb32(pb, stored_width); //Samples height mxf_write_local_tag(pb, 4, 0x3204); @@ -1138,7 +1147,7 @@ static int64_t mxf_write_cdci_common(AVFormatContext *s, AVStream *st, const UID avio_wb32(pb, 0); mxf_write_local_tag(pb, 4, 0x3209); -avio_wb32(pb, st->codecpar->width); +avio_wb32(pb, stored_width); if (st->codecpar->height == 608) // PAL + VBI display_height = 576; -- 2.21.0 (Apple Git-122) ___ 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/dvenc: support encoding dvcprohd
--- libavcodec/dv.h | 1 + libavcodec/dvenc.c | 561 tests/fate/vcodec.mak | 14 +- tests/ref/vsynth/vsynth1-dv-fhd | 4 + tests/ref/vsynth/vsynth1-dv-hd | 4 + tests/ref/vsynth/vsynth2-dv-fhd | 4 + tests/ref/vsynth/vsynth2-dv-hd | 4 + tests/ref/vsynth/vsynth3-dv-fhd | 4 + tests/ref/vsynth/vsynth3-dv-hd | 4 + 9 files changed, 541 insertions(+), 59 deletions(-) create mode 100644 tests/ref/vsynth/vsynth1-dv-fhd create mode 100644 tests/ref/vsynth/vsynth1-dv-hd create mode 100644 tests/ref/vsynth/vsynth2-dv-fhd create mode 100644 tests/ref/vsynth/vsynth2-dv-hd create mode 100644 tests/ref/vsynth/vsynth3-dv-fhd create mode 100644 tests/ref/vsynth/vsynth3-dv-hd diff --git a/libavcodec/dv.h b/libavcodec/dv.h index 7ef5b7c552..0205d72347 100644 --- a/libavcodec/dv.h +++ b/libavcodec/dv.h @@ -83,6 +83,7 @@ enum dv_pack_type { #define DV_PROFILE_IS_HD(p) ((p)->video_stype & 0x10) #define DV_PROFILE_IS_1080i50(p) (((p)->video_stype == 0x14) && ((p)->dsf == 1)) +#define DV_PROFILE_IS_1080i60(p) (((p)->video_stype == 0x14) && ((p)->dsf == 0)) #define DV_PROFILE_IS_720p50(p) (((p)->video_stype == 0x18) && ((p)->dsf == 1)) /** diff --git a/libavcodec/dvenc.c b/libavcodec/dvenc.c index ce2fc75daa..dca57feb4f 100644 --- a/libavcodec/dvenc.c +++ b/libavcodec/dvenc.c @@ -60,10 +60,7 @@ static av_cold int dvvideo_encode_init(AVCodecContext *avctx) ff_dv_print_profiles(avctx, AV_LOG_ERROR); return AVERROR(EINVAL); } -if (avctx->height > 576) { -av_log(avctx, AV_LOG_ERROR, "DVCPRO HD encoding is not supported.\n"); -return AVERROR_PATCHWELCOME; -} + ret = ff_dv_init_dynamic_tables(s, s->sys); if (ret < 0) { av_log(avctx, AV_LOG_ERROR, "Error initializing work tables.\n"); @@ -90,6 +87,7 @@ static av_cold int dvvideo_encode_init(AVCodecContext *avctx) } /* bit budget for AC only in 5 MBs */ +static const int vs_total_ac_bits_hd = (68 * 6 + 52*2) * 5; static const int vs_total_ac_bits = (100 * 4 + 68 * 2) * 5; static const int mb_area_start[5] = { 1, 6, 21, 43, 64 }; @@ -158,6 +156,11 @@ typedef struct EncBlockInfo { uint8_t sign[64]; uint8_t partial_bit_count; uint32_t partial_bit_buffer; /* we can't use uint16_t here */ +/* used by DV100 only: a copy of the weighted and classified but + not-yet-quantized AC coefficients. This is necessary for + re-quantizing at different steps. */ +int16_t save[64]; +int min_qlevel; /* DV100 only: minimum qlevel (for AC coefficients >255) */ } EncBlockInfo; static av_always_inline PutBitContext *dv_encode_ac(EncBlockInfo *bi, @@ -243,13 +246,123 @@ static const int dv_weight_248[64] = { 170627, 170627, 153560, 153560, 165371, 165371, 144651, 144651, }; -static av_always_inline int dv_init_enc_block(EncBlockInfo *bi, uint8_t *data, - ptrdiff_t linesize, - DVVideoContext *s, int bias) +/* setting this to 1 results in a faster codec but + * somewhat lower image quality */ +#define DV100_SACRIFICE_QUALITY_FOR_SPEED 1 +#define DV100_ENABLE_FINER 1 + +/* pack combination of QNO and CNO into a single 8-bit value */ +#define DV100_MAKE_QLEVEL(qno,cno) ((qno<<2) | (cno)) +#define DV100_QLEVEL_QNO(qlevel) (qlevel>>2) +#define DV100_QLEVEL_CNO(qlevel) (qlevel&0x3) + +#define DV100_NUM_QLEVELS 31 + +/* The quantization step is determined by a combination of QNO and + CNO. We refer to these combinations as "qlevels" (this term is our + own, it's not mentioned in the spec). We use CNO, a multiplier on + the quantization step, to "fill in the gaps" between quantization + steps associated with successive values of QNO. e.g. there is no + QNO for a quantization step of 10, but we can use QNO=5 CNO=1 to + get the same result. The table below encodes combinations of QNO + and CNO in order of increasing quantization coarseness. */ +static const uint8_t dv100_qlevels[DV100_NUM_QLEVELS] = { +DV100_MAKE_QLEVEL( 1,0), // 1*1= 1 +DV100_MAKE_QLEVEL( 1,0), // 1*1= 1 +DV100_MAKE_QLEVEL( 2,0), // 2*1= 2 +DV100_MAKE_QLEVEL( 3,0), // 3*1= 3 +DV100_MAKE_QLEVEL( 4,0), // 4*1= 4 +DV100_MAKE_QLEVEL( 5,0), // 5*1= 5 +DV100_MAKE_QLEVEL( 6,0), // 6*1= 6 +DV100_MAKE_QLEVEL( 7,0), // 7*1= 7 +DV100_MAKE_QLEVEL( 8,0), // 8*1= 8 +DV100_MAKE_QLEVEL( 5,1), // 5*2=10 +DV100_MAKE_QLEVEL( 6,1), // 6*2=12 +DV100_MAKE_QLEVEL( 7,1), // 7*2=14 +DV100_MAKE_QLEVEL( 9,0), // 16*1=16 +DV100_MAKE_QLEVEL(10,0), // 18*1=18 +DV100_MAKE_QLEVEL(11,0), // 20*1=20 +DV100_MAKE_QLEVEL(12,0), // 22*1=22 +DV100_MAKE_QLEVEL(13,0), // 24*1=24 +DV100_MAKE_QLEVEL(14,0), // 28*1=28 +DV100_MAKE_QLEVEL( 9,1), // 16*2=32 +DV100_MAKE_QLEVEL(10,1), // 18*2=36 +DV100_MAKE_QLEVEL(11,1), // 20*2=40 +DV100_MAKE_QLEVEL(12,1), // 2
Re: [FFmpeg-devel] [PATCH] avcodec/dvenc: support encoding dvcprohd
Hi Michael, > On Nov 6, 2019, at 11:02 AM, Michael Niedermayer > wrote: > > On Wed, Nov 06, 2019 at 08:54:50AM -0800, Baptiste Coudurier wrote: >> Hey Michael, >> >>> On Nov 4, 2019, at 12:43 PM, Michael Niedermayer >>> wrote: >>> >>> On Sat, Nov 02, 2019 at 12:06:19PM -0700, Baptiste Coudurier wrote: --- libavcodec/dv.h | 1 + libavcodec/dvenc.c| 555 +- >>> tests/fate/vcodec.mak | 14 +- >>> >>> here are the corresponding ref files i get: >>> they are the same on x86-64/32, mingw 32/64 arm & mips (qemu) >>> >>> new file mode 100644 >>> index 00..b81141f340 >>> --- /dev/null >>> +++ b/tests/ref/vsynth/vsynth1-dv-fhd >>> @@ -0,0 +1,4 @@ >>> +74315a8678d12c7f592c02990dc8952d *tests/data/fate/vsynth1-dv-fhd.dv >>> +2880 tests/data/fate/vsynth1-dv-fhd.dv >>> +c95b309bc128b162e5c8241374eb66a9 >>> *tests/data/fate/vsynth1-dv-fhd.out.rawvideo >>> +stddev:2.53 PSNR: 40.03 MAXDIFF: 35 bytes: 7603200/ 7603200 >>> diff --git a/tests/ref/vsynth/vsynth1-dv-hd b/tests/ref/vsynth/vsynth1-dv-hd >>> new file mode 100644 >>> index 00..c964b083b3 >>> --- /dev/null >>> +++ b/tests/ref/vsynth/vsynth1-dv-hd >>> @@ -0,0 +1,4 @@ >>> +12c07ee20aa824dc0ed589336647b195 *tests/data/fate/vsynth1-dv-hd.dv >>> +1440 tests/data/fate/vsynth1-dv-hd.dv >>> +dbeb55cfe3ed47d25cbe4e0b45d9bb00 >>> *tests/data/fate/vsynth1-dv-hd.out.rawvideo >>> +stddev: 53.33 PSNR: 13.59 MAXDIFF: 238 bytes: 7603200/ 7603200 >>> diff --git a/tests/ref/vsynth/vsynth2-dv-fhd >>> b/tests/ref/vsynth/vsynth2-dv-fhd >>> new file mode 100644 >>> index 00..948bf2269f >>> --- /dev/null >>> +++ b/tests/ref/vsynth/vsynth2-dv-fhd >>> @@ -0,0 +1,4 @@ >>> +1f96ce7c1a5f09ec9d30c51c7271cf77 *tests/data/fate/vsynth2-dv-fhd.dv >>> +2880 tests/data/fate/vsynth2-dv-fhd.dv >>> +cff30e2430730522bf67c6d94cf1352e >>> *tests/data/fate/vsynth2-dv-fhd.out.rawvideo >>> +stddev:1.16 PSNR: 46.82 MAXDIFF: 21 bytes: 7603200/ 7603200 >>> diff --git a/tests/ref/vsynth/vsynth2-dv-hd b/tests/ref/vsynth/vsynth2-dv-hd >>> new file mode 100644 >>> index 00..2dce36b94b >>> --- /dev/null >>> +++ b/tests/ref/vsynth/vsynth2-dv-hd >>> @@ -0,0 +1,4 @@ >>> +095db978dd76f36d5706c96f6dac65bd *tests/data/fate/vsynth2-dv-hd.dv >>> +1440 tests/data/fate/vsynth2-dv-hd.dv >>> +a1c690626f90e0c79b1247ee560540ef >>> *tests/data/fate/vsynth2-dv-hd.out.rawvideo >>> +stddev: 79.63 PSNR: 10.11 MAXDIFF: 240 bytes: 7603200/ 7603200 >>> diff --git a/tests/ref/vsynth/vsynth3-dv-fhd >>> b/tests/ref/vsynth/vsynth3-dv-fhd >>> new file mode 100644 >>> index 00..08ca9ef889 >>> --- /dev/null >>> +++ b/tests/ref/vsynth/vsynth3-dv-fhd >>> @@ -0,0 +1,4 @@ >>> +5b8b7f1dc31d7076af891e94c2e88c06 *tests/data/fate/vsynth3-dv-fhd.dv >>> +2880 tests/data/fate/vsynth3-dv-fhd.dv >>> +a038ad7c3c09f776304ef7accdea9c74 >>> *tests/data/fate/vsynth3-dv-fhd.out.rawvideo >>> +stddev:0.00 PSNR:999.99 MAXDIFF:0 bytes:86700/86700 >>> diff --git a/tests/ref/vsynth/vsynth3-dv-hd b/tests/ref/vsynth/vsynth3-dv-hd >>> new file mode 100644 >>> index 00..a42f4b4bb3 >>> --- /dev/null >>> +++ b/tests/ref/vsynth/vsynth3-dv-hd >>> @@ -0,0 +1,4 @@ >>> +c05f2a66f9a5090e016d24373c657fd2 *tests/data/fate/vsynth3-dv-hd.dv >>> +1440 tests/data/fate/vsynth3-dv-hd.dv >>> +938db8c6ca3bc2d2a64d0f481960efd3 >>> *tests/data/fate/vsynth3-dv-hd.out.rawvideo >>> +stddev: 62.24 PSNR: 12.25 MAXDIFF: 218 bytes:86700/86700 >>> diff --git a/tests/ref/vsynth/vsynth_lena-dv-fhd >>> b/tests/ref/vsynth/vsynth_lena-dv-fhd >>> new file mode 100644 >>> index 00..51a4505011 >>> --- /dev/null >>> +++ b/tests/ref/vsynth/vsynth_lena-dv-fhd >>> @@ -0,0 +1,4 @@ >>> +3a33e512f8b3f4213477c98d4e7e2559 *tests/data/fate/vsynth_lena-dv-fhd.dv >>> +2880 tests/data/fate/vsynth_lena-dv-fhd.dv >>> +b97e0a057202359ef93f2ec0b9fdfec4 >>> *tests/data/fate/vsynth_lena-dv-fhd.out.rawvideo >>> +stddev:1.03 PSNR: 47.80 MAXDIFF: 14 bytes: 7603200/ 7603200 >>> diff --git a/tests/ref/vsynth/vsynth_lena-dv-hd >>> b/tests/ref/vsynth/vsynth_lena-dv-hd >>> new file mode 100644 >>> index 00..c682c9eb2c >>> --- /dev/null >>> +++ b/tests/ref/vsynth/vsynth_lena-dv-hd >>> @@ -0,0 +1,4 @@ >>> +4f289998e497e473a1522006bc6b3b74 *tests/data/fate/vsynth_lena-dv-hd.dv >>> +1440 tests/data/fate/vsynth_lena-dv-hd.dv >>> +96e4669d6941c4366e6f599d77061d97 >>> *tests/data/fate/vsynth_lena-dv-hd.out.rawvideo >>> +stddev: 54.07 PSNR: 13.47 MAXDIFF: 199 bytes: 7603200/ 7603200 >> > >> Thanks! I actually merged the muxer change in the same patch so that we >> don’t create bad .dv files with HD. >> Let me know if that’s fine. > > as libavformat and libavcodec are seperate entities with their own version > numbers (and also are packaged seperatly in some distributions) > it is possible that libavcodec is updated without libavformat > (libavformat couldnt be as it would have a dependancy
[FFmpeg-devel] [PATCH] avcodec/dvdec: Don't use restrict directly to fix build on MSVC
004ebd4b added a function with a parameter that was declared as restrict and not av_restrict. This is not supported by MSVC as several FATE-boxes that now fail to build show. So use av_restrict. Signed-off-by: Andreas Rheinhardt --- Here is one of many logs of a failing build with MSVC: http://fate.ffmpeg.org/log.cgi?slot=x86_64-msvc15-windows-native&log=compile&time=20191110013536 I don't have an MSVC setup and can therefore only attest that this patch doesn't affect either GCC or Clang (as expected). libavcodec/dvdec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/dvdec.c b/libavcodec/dvdec.c index cfa0fb9905..578d7f505f 100644 --- a/libavcodec/dvdec.c +++ b/libavcodec/dvdec.c @@ -269,7 +269,7 @@ static inline void bit_copy(PutBitContext *pb, GetBitContext *gb) put_bits(pb, bits_left, get_bits(gb, bits_left)); } -static av_always_inline void put_block_8x4(int16_t *block, uint8_t *restrict p, int stride) +static av_always_inline void put_block_8x4(int16_t *block, uint8_t *av_restrict p, int stride) { int i, j; const uint8_t *cm = ff_crop_tab + MAX_NEG_CROP; -- 2.20.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/7] avformat/dss: Use AV_DICT_DONT_STRDUP_VAL to save a malloc+memcpy
Signed-off-by: Andreas Rheinhardt --- libavformat/dss.c | 10 +++--- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/libavformat/dss.c b/libavformat/dss.c index d7f9cafe47..8bc6af134e 100644 --- a/libavformat/dss.c +++ b/libavformat/dss.c @@ -103,15 +103,11 @@ static int dss_read_metadata_string(AVFormatContext *s, unsigned int offset, ret = avio_read(s->pb, value, size); if (ret < size) { -ret = ret < 0 ? ret : AVERROR_EOF; -goto exit; +av_free(value); +return ret < 0 ? ret : AVERROR_EOF; } -ret = av_dict_set(&s->metadata, key, value, 0); - -exit: -av_free(value); -return ret; +return av_dict_set(&s->metadata, key, value, AV_DICT_DONT_STRDUP_VAL); } static int dss_read_header(AVFormatContext *s) -- 2.20.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 7/7] avformat/mov: Use AV_DICT_DONT_STRDUP_VAL to avoid av_strdup
This will likely also fix CID 1452574 and 1452565, false positives resulting from Coverity thinking that av_dict_set() automatically frees its key and value parameters (even without the AV_DICT_DONT_STRDUP_* flags). Signed-off-by: Andreas Rheinhardt --- libavformat/mov.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libavformat/mov.c b/libavformat/mov.c index d5c67fbc68..df010c68ac 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -1129,8 +1129,8 @@ static int mov_read_ftyp(MOVContext *c, AVIOContext *pb, MOVAtom atom) return ret; } comp_brands_str[comp_brand_size] = 0; -av_dict_set(&c->fc->metadata, "compatible_brands", comp_brands_str, 0); -av_freep(&comp_brands_str); +av_dict_set(&c->fc->metadata, "compatible_brands", +comp_brands_str, AV_DICT_DONT_STRDUP_VAL); return 0; } @@ -5801,8 +5801,8 @@ static int mov_read_uuid(MOVContext *c, AVIOContext *pb, MOVAtom atom) return AVERROR_INVALIDDATA; } buffer[len] = '\0'; -av_dict_set(&c->fc->metadata, "xmp", buffer, 0); -av_free(buffer); +av_dict_set(&c->fc->metadata, "xmp", +buffer, AV_DICT_DONT_STRDUP_VAL); } else { // skip all uuid atom, which makes it fast for long uuid-xmp file ret = avio_skip(pb, len); -- 2.20.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 5/7] avformat/matroskadec: Use AV_DICT_DONT_STRDUP_VAL to save av_strdup
This will likely also fix CID 1452562, a false positive resulting from Coverity thinking that av_dict_set() automatically frees its key and value parameters (even without the AV_DICT_DONT_STRDUP_* flags). Signed-off-by: Andreas Rheinhardt --- libavformat/matroskadec.c | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c index c224c3447a..56863eb08e 100644 --- a/libavformat/matroskadec.c +++ b/libavformat/matroskadec.c @@ -2413,8 +2413,8 @@ static int matroska_parse_tracks(AVFormatContext *s) if (key_id_base64) { /* export encryption key id as base64 metadata tag */ -av_dict_set(&st->metadata, "enc_key_id", key_id_base64, 0); -av_freep(&key_id_base64); +av_dict_set(&st->metadata, "enc_key_id", key_id_base64, +AV_DICT_DONT_STRDUP_VAL); } if (!strcmp(track->codec_id, "V_MS/VFW/FOURCC") && @@ -4142,8 +4142,8 @@ static int webm_dash_manifest_cues(AVFormatContext *s, int64_t init_range) } end += ret; } -av_dict_set(&s->streams[0]->metadata, CUE_TIMESTAMPS, buf, 0); -av_free(buf); +av_dict_set(&s->streams[0]->metadata, CUE_TIMESTAMPS, +buf, AV_DICT_DONT_STRDUP_VAL); return 0; } @@ -4168,8 +4168,8 @@ static int webm_dash_manifest_read_header(AVFormatContext *s) if (!matroska->is_live) { buf = av_asprintf("%g", matroska->duration); if (!buf) return AVERROR(ENOMEM); -av_dict_set(&s->streams[0]->metadata, DURATION, buf, 0); -av_free(buf); +av_dict_set(&s->streams[0]->metadata, DURATION, +buf, AV_DICT_DONT_STRDUP_VAL); // initialization range // 5 is the offset of Cluster ID. -- 2.20.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/7] avformat/id3v2: Fix double-free on error
ff_id3v2_parse_priv_dict() uses av_dict_set() with the flags AV_DICT_DONT_STRDUP_KEY and AV_DICT_DONT_STRDUP_VAL. In this case both key and value are freed on error (and owned by the destination dictionary on success), so that freeing them again on error is a double-free and therefore forbidden. But it nevertheless happened. Fixes CID 1452489 and 1452421. Signed-off-by: Andreas Rheinhardt --- libavformat/id3v2.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/libavformat/id3v2.c b/libavformat/id3v2.c index b43ab1745f..e9843eef9a 100644 --- a/libavformat/id3v2.c +++ b/libavformat/id3v2.c @@ -1263,8 +1263,6 @@ int ff_id3v2_parse_priv_dict(AVDictionary **metadata, ID3v2ExtraMeta **extra_met } if ((ret = av_dict_set(metadata, key, escaped, dict_flags)) < 0) { -av_free(key); -av_free(escaped); return ret; } } -- 2.20.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 6/7] avformat/wtvdec: Use AV_DICT_DONT_STRDUP_VAL to avoid av_strdup
This will likely also fix CID 1452571, a false positive resulting from Coverity thinking that av_dict_set() automatically frees its key and value parameters (even without the AV_DICT_DONT_STRDUP_* flags). Signed-off-by: Andreas Rheinhardt --- libavformat/wtvdec.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/libavformat/wtvdec.c b/libavformat/wtvdec.c index 706e8ca38d..3960e6ae2f 100644 --- a/libavformat/wtvdec.c +++ b/libavformat/wtvdec.c @@ -525,8 +525,7 @@ static void get_tag(AVFormatContext *s, AVIOContext *pb, const char *key, int ty return; } -av_dict_set(&s->metadata, key, buf, 0); -av_freep(&buf); +av_dict_set(&s->metadata, key, buf, AV_DICT_DONT_STRDUP_VAL); } /** -- 2.20.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 4/7] avformat/icecast: Use AV_DICT_DONT_STRDUP_VAL to save an av_strdup
This will probably also fix CID 1452559, a false positive where Coverity claims a double-free occurs, because it thinks that av_dict_set() frees its key and value arguments even when the AV_DICT_DONT_STRDUP_* flags aren't used. Signed-off-by: Andreas Rheinhardt --- libavformat/icecast.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/libavformat/icecast.c b/libavformat/icecast.c index 052cd37f3e..7d8f92fe73 100644 --- a/libavformat/icecast.c +++ b/libavformat/icecast.c @@ -114,7 +114,7 @@ static int icecast_open(URLContext *h, const char *uri, int flags) // Set options av_dict_set(&opt_dict, "method", s->legacy_icecast ? "SOURCE" : "PUT", 0); av_dict_set(&opt_dict, "auth_type", "basic", 0); -av_dict_set(&opt_dict, "headers", headers, 0); +av_dict_set(&opt_dict, "headers", headers, AV_DICT_DONT_STRDUP_VAL); av_dict_set(&opt_dict, "chunked_post", "0", 0); av_dict_set(&opt_dict, "send_expect_100", s->legacy_icecast ? "-1" : "1", 0); if (NOT_EMPTY(s->content_type)) @@ -170,7 +170,6 @@ static int icecast_open(URLContext *h, const char *uri, int flags) cleanup: av_freep(&user); -av_freep(&headers); av_dict_free(&opt_dict); return ret; -- 2.20.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 3/7] avformat/icecast: Free the right buffer on error
In case an AVBPrint was not complete, icecast_open() would free some buffers that have not been allocated yet instead of freeing the data of the AVBPrint (if they have been allocated). Because this error does not trigger a jump to the general cleanup section any more, one can moreover remove a (now unnecessary) initialization of a pointer. Furthermore, finalizing an AVBPrint can fail (namely when the string inside the AVBPrint has not been allocated yet) and so this needs to be checked. Signed-off-by: Andreas Rheinhardt --- libavformat/icecast.c | 9 + 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/libavformat/icecast.c b/libavformat/icecast.c index d2198b78ec..052cd37f3e 100644 --- a/libavformat/icecast.c +++ b/libavformat/icecast.c @@ -89,7 +89,7 @@ static int icecast_open(URLContext *h, const char *uri, int flags) // URI part variables char h_url[1024], host[1024], auth[1024], path[1024]; -char *headers = NULL, *user = NULL; +char *headers, *user = NULL; int port, ret; AVBPrint bp; @@ -105,10 +105,11 @@ static int icecast_open(URLContext *h, const char *uri, int flags) cat_header(&bp, "Ice-Genre", s->genre); cat_header(&bp, "Ice-Public", s->public ? "1" : "0"); if (!av_bprint_is_complete(&bp)) { -ret = AVERROR(ENOMEM); -goto cleanup; +av_bprint_finalize(&bp, NULL); +return AVERROR(ENOMEM); } -av_bprint_finalize(&bp, &headers); +if ((ret = av_bprint_finalize(&bp, &headers)) < 0) +return ret; // Set options av_dict_set(&opt_dict, "method", s->legacy_icecast ? "SOURCE" : "PUT", 0); -- 2.20.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".