Re: [FFmpeg-devel] bprint.h can't be included in C++ code
On Fri, 21 Nov 2014 21:42:35 +0100 Nicolas George wrote: > Le primidi 1er frimaire, an CCXXIII, Vadim Kalinsky a écrit : > > bprint.h can't be included in C++ code > > C++ does not support anonymous struct. > > Thanks for the patch. > > Basically, bprint.h is not meant to be included in c++ code. > > > From a45cc83a807e7eabf158ddff52751171e80874f8 Mon Sep 17 00:00:00 2001 > > From: Vadim Kalinsky > > Date: Fri, 21 Nov 2014 13:39:07 -0500 > > Subject: [PATCH] C++ compatible AVBPrint definition. > > > > --- > > libavutil/bprint.h | 16 +--- > > 1 file changed, 9 insertions(+), 7 deletions(-) > > > > diff --git a/libavutil/bprint.h b/libavutil/bprint.h > > index d1682fc..10e96d7 100644 > > --- a/libavutil/bprint.h > > +++ b/libavutil/bprint.h > > @@ -30,9 +30,12 @@ > > * Define a structure with extra padding to a fixed size > > * This helps ensuring binary compatibility with future versions. > > */ > > -#define FF_PAD_STRUCTURE(size, ...) \ > > -__VA_ARGS__ \ > > -char reserved_padding[size - sizeof(struct { __VA_ARGS__ })]; > > > +#define FF_PAD_STRUCTURE(name,size, ...) \ > > +typedef struct __pad_structure_helper_##name { __VA_ARGS__ } > > __pad_structure_helper_##name; \ > > +typedef struct name { \ > > +__VA_ARGS__ \ > > +char reserved_padding[size - sizeof(__pad_structure_helper_##name)]; \ > > +} name; > > Apart from the fact that it makes the macro hackery vastly less readable > (maybe some indentation would help), identifiers starting with a double > underscode are reserved for the implementation, and therefore can not be > used. The macro hackery doesn't even have any reason to exist, and even seems to trigger UB - reserved_internal_buffer is only 1 byte long, and the code is designed to write past it (and into the reserved member), which is UB. Flexible array members were invented to rectify and simplify this, but you could just do without any of this. > > > > /** > > * Buffer to print data progressively > > @@ -74,15 +77,14 @@ > > * internal buffer is large enough to hold a reasonable paragraph of text, > > * such as the current paragraph. > > */ > > -typedef struct AVBPrint { > > -FF_PAD_STRUCTURE(1024, > > + > > +FF_PAD_STRUCTURE(AVBPrint, 1024, > > char *str; /**< string so far */ > > unsigned len; /**< length so far */ > > unsigned size; /**< allocated memory */ > > unsigned size_max; /**< maximum allocated memory */ > > char reserved_internal_buffer[1]; > > -) > > -} AVBPrint; > > +) > > > > /** > > * Convenience macros for special values for av_bprint_init() size_max > > Regards, > ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] bprint.h can't be included in C++ code
On Fri, 21 Nov 2014 21:42:35 +0100 Nicolas George wrote: > Le primidi 1er frimaire, an CCXXIII, Vadim Kalinsky a écrit : > > bprint.h can't be included in C++ code > > C++ does not support anonymous struct. > > Thanks for the patch. > > Basically, bprint.h is not meant to be included in c++ code. > > > From a45cc83a807e7eabf158ddff52751171e80874f8 Mon Sep 17 00:00:00 2001 > > From: Vadim Kalinsky > > Date: Fri, 21 Nov 2014 13:39:07 -0500 > > Subject: [PATCH] C++ compatible AVBPrint definition. > > > > --- > > libavutil/bprint.h | 16 +--- > > 1 file changed, 9 insertions(+), 7 deletions(-) > > > > diff --git a/libavutil/bprint.h b/libavutil/bprint.h > > index d1682fc..10e96d7 100644 > > --- a/libavutil/bprint.h > > +++ b/libavutil/bprint.h > > @@ -30,9 +30,12 @@ > > * Define a structure with extra padding to a fixed size > > * This helps ensuring binary compatibility with future versions. > > */ > > -#define FF_PAD_STRUCTURE(size, ...) \ > > -__VA_ARGS__ \ > > -char reserved_padding[size - sizeof(struct { __VA_ARGS__ })]; > > > +#define FF_PAD_STRUCTURE(name,size, ...) \ > > +typedef struct __pad_structure_helper_##name { __VA_ARGS__ } > > __pad_structure_helper_##name; \ > > +typedef struct name { \ > > +__VA_ARGS__ \ > > +char reserved_padding[size - sizeof(__pad_structure_helper_##name)]; \ > > +} name; > > Apart from the fact that it makes the macro hackery vastly less readable > (maybe some indentation would help), identifiers starting with a double > underscode are reserved for the implementation, and therefore can not be > used. Oh, seeing that this struct is to be allocated on the stack, my suggestion of using flexible array members is not very helpful; but that makes this macro-hackery look even more questionable. All you need is a plain old static array. > > > > /** > > * Buffer to print data progressively > > @@ -74,15 +77,14 @@ > > * internal buffer is large enough to hold a reasonable paragraph of text, > > * such as the current paragraph. > > */ > > -typedef struct AVBPrint { > > -FF_PAD_STRUCTURE(1024, > > + > > +FF_PAD_STRUCTURE(AVBPrint, 1024, > > char *str; /**< string so far */ > > unsigned len; /**< length so far */ > > unsigned size; /**< allocated memory */ > > unsigned size_max; /**< maximum allocated memory */ > > char reserved_internal_buffer[1]; > > -) > > -} AVBPrint; > > +) > > > > /** > > * Convenience macros for special values for av_bprint_init() size_max > > Regards, > ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 1/2] lavf/apngdec: properly skip currently unsupported in-stream tags
On Sat, Nov 22, 2014 at 08:16:50AM +0100, Benoit Fouet wrote: > Hi, > > On November 21, 2014 11:09:33 PM GMT+01:00, James Almer > wrote: > >Signed-off-by: James Almer > >--- > > libavformat/apngdec.c | 1 + > > 1 file changed, 1 insertion(+) > > > >diff --git a/libavformat/apngdec.c b/libavformat/apngdec.c > >index 54fbd29..2af87ad 100644 > >--- a/libavformat/apngdec.c > >+++ b/libavformat/apngdec.c > >@@ -373,6 +373,7 @@ static int apng_read_packet(AVFormatContext *s, > >AVPacket *pkt) > > return 0; > > default: > >avpriv_request_sample(s, "In-stream tag=%#08X len=%"PRId64"", tag, > >avio_tell(pb)); > >+avio_skip(pb, len + 4); > > } > > > > /* Handle the unsupported yet cases */ > > OK, of course (I have this one in my tree but I forgot to send an update for > the demuxer when I sent the decoder one...), thanks. applied thx [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Asymptotically faster algorithms should always be preferred if you have asymptotical amounts of data signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] lavf: fix apngdec under msvc.
On Sat, Nov 22, 2014 at 06:31:25PM +1100, Matt Oliver wrote: > The recently added apngdec code does not compile under msvc. > > See: > http://fate.ffmpeg.org/report.cgi?time=20141122053145&slot=x86_32-msvc12-windows-native > > Attached is a patch to fix it. > apngdec.c |2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > 30aad9f83ccc78dcd97fa74af034578e3a33b40c > 0001-lavf-fix-apngdec-under-msvc.patch > From 4d1b8b7c88159c5ece46756cdeba2b205eec737e Mon Sep 17 00:00:00 2001 > From: Matthew Oliver > Date: Sat, 22 Nov 2014 18:27:46 +1100 > Subject: [PATCH] lavf: fix apngdec under msvc. applied thx [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB The educated differ from the uneducated as much as the living from the dead. -- Aristotle signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] h264_mb: Use smaller data type for refs in await_references.
On Sun, Nov 16, 2014 at 09:54:14PM +0100, Michael Niedermayer wrote: > On Sat, Nov 15, 2014 at 07:02:44PM +0100, Reimar Döffinger wrote: > > As far as I can tell the value can never go outside > > the int16_t type. > > And especially the cost of the initialization is > > reduced quite a bit by making it smaller. > > Overall decoding speedup not measurable though. > > > > Signed-off-by: Reimar Döffinger > > should be ok if you think its faster Various profiling tools said so, in particular reduced cache usage. So pushed. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] h264_i386: Optimize decode_significance_8x8_x86 for 64 bit.
On Mon, Nov 17, 2014 at 01:41:13PM +0100, Michael Niedermayer wrote: > On Mon, Nov 17, 2014 at 08:19:32AM +0100, Reimar Döffinger wrote: > > On 17.11.2014, at 02:37, Michael Niedermayer wrote: > > > On Sat, Nov 15, 2014 at 06:16:03PM +0100, Reimar Döffinger wrote: > > >> 11674 -> 10877 decicycles on my Phenom II. > > >> Overall speedup was unfortunately within measurement error. > > > > > > here its 10153 ->10135 > > > > I suspect it also depends a bit on the compiler and how it changes the > > surrounding code. > > Note that I also tested with PIC actually. > > > > > but ive a slightly odd feeling about the chnages to the asm code, > > > iam not sure if all assemblers will be happy about the changed > > > code > > > > Do you mean particularly the movzbl change? > > yes and the k stuff > > > > I am also unsure about that, I think there was a reason for that %k6 mess... > > But this as well as movzx seemed to work for me... > > it works here too i just have the feeling it might fail on some odd > assembler or platform. Thats not meant to keep you from pushing this > just that it might require to be reverted or fixed if such > problems actually occor I pushed it. If anyone sees issues please tell me and I'll look into it! ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 1/1] ffv1dec: Avoid unnecessarily large stack usage and copies.
Ideally the compiler could figure this out on its own, but it seems it can't. An alternative that would avoid the messy explicit memcpy would be to use a sub-struct for the parts that should be preserved, which can then simply be assigned. Signed-off-by: Reimar Döffinger --- libavcodec/ffv1dec.c | 15 ++- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/libavcodec/ffv1dec.c b/libavcodec/ffv1dec.c index c408f16..5fbe51c 100644 --- a/libavcodec/ffv1dec.c +++ b/libavcodec/ffv1dec.c @@ -1051,12 +1051,17 @@ static int update_thread_context(AVCodecContext *dst, const AVCodecContext *src) return 0; { -FFV1Context bak = *fdst; +ThreadFrame picture = fdst->picture, last_picture = fdst->last_picture; +uint8_t (*initial_states[MAX_QUANT_TABLES])[32]; +struct FFV1Context *slice_context[MAX_SLICES]; +memcpy(initial_states, fdst->initial_states, sizeof(fdst->initial_states)); +memcpy(slice_context, fdst->slice_context , sizeof(fdst->slice_context)); + memcpy(fdst, fsrc, sizeof(*fdst)); -memcpy(fdst->initial_states, bak.initial_states, sizeof(fdst->initial_states)); -memcpy(fdst->slice_context, bak.slice_context , sizeof(fdst->slice_context)); -fdst->picture = bak.picture; -fdst->last_picture = bak.last_picture; +memcpy(fdst->initial_states, initial_states, sizeof(fdst->initial_states)); +memcpy(fdst->slice_context, slice_context , sizeof(fdst->slice_context)); +fdst->picture = picture; +fdst->last_picture = last_picture; for (i = 0; inum_h_slices * fdst->num_v_slices; i++) { FFV1Context *fssrc = fsrc->slice_context[i]; FFV1Context *fsdst = fdst->slice_context[i]; -- 2.1.3 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] qdm2: Allow hard-coding VLC tables.
On Sun, Sep 07, 2014 at 02:12:34PM +0200, Reimar Döffinger wrote: > Also adds a lot of infrastructure necessary for it. > Some of it is a bit ugly though. > Increases binary size for hardcoded tables by about 12 kB, > which is about 15 kB from qdm2_table minus data and code > saved that was only used for creating it. Are there any opinions on this? The reason I want to have VLC support for hardcoded tables is that it is one of the few big steps to avoid the need for global mutable codec state. So people who are afraid of our constructs there could just switch to hardcoded tables and have much less to worry about. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 1/1] ffv1dec: Avoid unnecessarily large stack usage and copies.
On Sat, Nov 22, 2014 at 02:14:13PM +0100, Reimar Döffinger wrote: > Ideally the compiler could figure this out on its own, > but it seems it can't. > An alternative that would avoid the messy explicit memcpy > would be to use a sub-struct for the parts that should > be preserved, which can then simply be assigned. > > Signed-off-by: Reimar Döffinger > --- > libavcodec/ffv1dec.c | 15 ++- > 1 file changed, 10 insertions(+), 5 deletions(-) LGTM [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB I have never wished to cater to the crowd; for what I know they do not approve, and what they approve I do not know. -- Epicurus signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] ffplay: fix mem leak when opening input or parsing options fail.
On Fri, 21 Nov 2014, Benoit Fouet wrote: --- ffplay.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ffplay.c b/ffplay.c index f79161d..1914a66 100644 --- a/ffplay.c +++ b/ffplay.c @@ -3169,8 +3169,9 @@ static int read_thread(void *arg) stream_component_close(is, is->video_stream); if (is->subtitle_stream >= 0) stream_component_close(is, is->subtitle_stream); -if (is->ic) { -avformat_close_input(&is->ic); +if (ic) { +avformat_close_input(&ic); +is->ic = NULL; } if (ret != 0) { -- 2.2.0.rc2.23.gca0107e LGTM, altough if avformat_open_input fails, it frees the context according to docs, so I guess this is only really needed for the option parsing failure. Regards, Marton ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 1/2] lavfi/ebur128: add support for smaller video sizes
On Fri, 21 Nov 2014, Clément Bœsch wrote: (sorry for the delay) On Sun, Nov 16, 2014 at 10:53:15PM +0100, Marton Balint wrote: Signed-off-by: Marton Balint --- doc/filters.texi| 4 ++-- libavfilter/f_ebur128.c | 11 --- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/doc/filters.texi b/doc/filters.texi index 53f4cb2..713989c 100644 --- a/doc/filters.texi +++ b/doc/filters.texi @@ -10146,8 +10146,8 @@ activated. Default is @code{0}. @item size Set the video size. This option is for video only. For the syntax of this -option, check the "Video size" section in the ffmpeg-utils manual. Default -and minimum resolution is @code{640x480}. +option, check the "Video size" section in the ffmpeg-utils manual. The default +resolution is @code{640x480}, the minimum is @code{480x102}. Quoting the EBU 3341: An ‘EBU Mode’ meter shall offer two scales, for when a scale is shown, selectable by the user: 1. range -18.0 LU to +9.0 LU (-41.0 LUFS to -14.0 LUFS), named ‘EBU +9 scale’ 2. range -36.0 LU to +18.0 LU (-59.0 LUFS to -5.0 LUFS), named ‘EBU +18 scale’ When you go down to 480x102, the printed range becomes [-16;+8] LU for +9 scale and [-32;+16] LU for +18 scale (see meter option). I think these range boundaries should be preserved in the output. The proper range is still shown in the graph, only the legend lacks the value for the up and the bottom of the graph. If you insist on showing the values for the top and the bottom of the graph, then in order for the lines to remain simmetrical, you will have to start showing rounded or non-whole values. Or if you insist on whole values, you may will not be able to show the lines with the same distance from each other. What would be the approach you prefer in order to be able to show smaller graphs? Thanks, Marton___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] ffplay: fix mem leak when opening input or parsing options fail.
On Sat, Nov 22, 2014 at 02:58:01PM +0100, Marton Balint wrote: > > > On Fri, 21 Nov 2014, Benoit Fouet wrote: > > >--- > >ffplay.c | 5 +++-- > >1 file changed, 3 insertions(+), 2 deletions(-) > > > >diff --git a/ffplay.c b/ffplay.c > >index f79161d..1914a66 100644 > >--- a/ffplay.c > >+++ b/ffplay.c > >@@ -3169,8 +3169,9 @@ static int read_thread(void *arg) > >stream_component_close(is, is->video_stream); > >if (is->subtitle_stream >= 0) > >stream_component_close(is, is->subtitle_stream); > >-if (is->ic) { > >-avformat_close_input(&is->ic); > >+if (ic) { > >+avformat_close_input(&ic); > >+is->ic = NULL; > >} > > > >if (ret != 0) { > >-- > >2.2.0.rc2.23.gca0107e > > LGTM, altough if avformat_open_input fails, it frees the context > according to docs, so I guess this is only really needed for the > option parsing failure. applied thx [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Avoid a single point of failure, be that a person or equipment. signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] qdm2: Allow hard-coding VLC tables.
On Sat, 22 Nov 2014 14:17:09 +0100 Reimar Döffinger wrote: > On Sun, Sep 07, 2014 at 02:12:34PM +0200, Reimar Döffinger wrote: > > Also adds a lot of infrastructure necessary for it. > > Some of it is a bit ugly though. > > Increases binary size for hardcoded tables by about 12 kB, > > which is about 15 kB from qdm2_table minus data and code > > saved that was only used for creating it. > > Are there any opinions on this? > The reason I want to have VLC support for hardcoded tables > is that it is one of the few big steps to avoid the need > for global mutable codec state. > So people who are afraid of our constructs there could just > switch to hardcoded tables and have much less to worry about. Whatever the patch is, this sounds like a good idea to me. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] lavf/apngdec: print currently unsupported in-stream tags in a more readable form
Also use length and not stream position Signed-off-by: James Almer --- libavformat/apngdec.c | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/libavformat/apngdec.c b/libavformat/apngdec.c index db501ec..1e0f1c7 100644 --- a/libavformat/apngdec.c +++ b/libavformat/apngdec.c @@ -372,8 +372,13 @@ static int apng_read_packet(AVFormatContext *s, AVPacket *pkt) return ret; return 0; default: -avpriv_request_sample(s, "In-stream tag=%#08X len=%"PRId64"", tag, avio_tell(pb)); +{ +char tag_buf[5]; + +av_get_codec_tag_string(tag_buf, sizeof(tag_buf), tag); +avpriv_request_sample(s, "In-stream tag=%s (0x%08X) len=%"PRIu32, tag_buf, tag, len); avio_skip(pb, len + 4); +} } /* Handle the unsupported yet cases */ -- 2.1.3 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] qdm2: Allow hard-coding VLC tables.
On Sat, 22 Nov 2014 14:17:09 +0100 Reimar Döffinger wrote: > On Sun, Sep 07, 2014 at 02:12:34PM +0200, Reimar Döffinger wrote: > > Also adds a lot of infrastructure necessary for it. > > Some of it is a bit ugly though. > > Increases binary size for hardcoded tables by about 12 kB, > > which is about 15 kB from qdm2_table minus data and code > > saved that was only used for creating it. > > Are there any opinions on this? > The reason I want to have VLC support for hardcoded tables > is that it is one of the few big steps to avoid the need > for global mutable codec state. > So people who are afraid of our constructs there could just > switch to hardcoded tables and have much less to worry about. i remember lots of complaints about globals before, although i have no clue if patch good or not. done any speed benchmarks on it ? -compn ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] qdm2: Allow hard-coding VLC tables.
On Sat, Nov 22, 2014 at 11:59:39AM -0500, compn wrote: > On Sat, 22 Nov 2014 14:17:09 +0100 > Reimar Döffinger wrote: > > > On Sun, Sep 07, 2014 at 02:12:34PM +0200, Reimar Döffinger wrote: > > > Also adds a lot of infrastructure necessary for it. > > > Some of it is a bit ugly though. > > > Increases binary size for hardcoded tables by about 12 kB, > > > which is about 15 kB from qdm2_table minus data and code > > > saved that was only used for creating it. > > > > Are there any opinions on this? > > The reason I want to have VLC support for hardcoded tables > > is that it is one of the few big steps to avoid the need > > for global mutable codec state. > > So people who are afraid of our constructs there could just > > switch to hardcoded tables and have much less to worry about. > > i remember lots of complaints about globals before, although i have no > clue if patch good or not. > > done any speed benchmarks on it ? No, without --hardcoded-tables I don't expect the generated code to change (at least not significantly) and even with that option I expect no speed difference. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 1/1] ffv1dec: Avoid unnecessarily large stack usage and copies.
On Sat, Nov 22, 2014 at 02:42:25PM +0100, Michael Niedermayer wrote: > On Sat, Nov 22, 2014 at 02:14:13PM +0100, Reimar Döffinger wrote: > > Ideally the compiler could figure this out on its own, > > but it seems it can't. > > An alternative that would avoid the messy explicit memcpy > > would be to use a sub-struct for the parts that should > > be preserved, which can then simply be assigned. > > > > Signed-off-by: Reimar Döffinger > > --- > > libavcodec/ffv1dec.c | 15 ++- > > 1 file changed, 10 insertions(+), 5 deletions(-) > > LGTM Thanks, pushed. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] libavcodec/tiff: Fix static linking of lzma with msvc.
This fixes an error when using static lzma libs with msvc compiler. Without it the lzma.h header defaults to forcing dll (shared) linkage which breaks when using static libs. The fix requires adding a simple define before the header is included that only affects lzma.h on win32 and only with msvc/icl. This patch is the same as previously submitted and applied patches for identical issues with some of the other external libs. I wrote a rather long and detailed explanation of why this type of thing is needed and why it works on one of the previously accepted patches if anyone is curious. 0001-libavcodec-tiff-Fix-static-linking-of-lzma-with-msvc.patch Description: Binary data ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] svq1enc: reduce stack usage of recursively-called function.
--- libavcodec/svq1enc.c | 2 +- libavcodec/svq1enc.h | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/libavcodec/svq1enc.c b/libavcodec/svq1enc.c index 288da1f..2a0d780 100644 --- a/libavcodec/svq1enc.c +++ b/libavcodec/svq1enc.c @@ -96,7 +96,7 @@ static int encode_block(SVQ1EncContext *s, uint8_t *src, uint8_t *ref, int w= 2 << (level + 2 >> 1); int h= 2 << (level + 1 >> 1); int size = w * h; -DECLARE_ALIGNED(16, int16_t, block)[7][256]; +int16_t (*block)[256] = s->encoded_block_levels[level]; const int8_t *codebook_sum, *codebook; const uint16_t(*mean_vlc)[2]; const uint8_t(*multistage_vlc)[2]; diff --git a/libavcodec/svq1enc.h b/libavcodec/svq1enc.h index 740d2ff..8e74885 100644 --- a/libavcodec/svq1enc.h +++ b/libavcodec/svq1enc.h @@ -59,6 +59,8 @@ typedef struct SVQ1EncContext { int c_block_width; int c_block_height; +DECLARE_ALIGNED(16, int16_t, encoded_block_levels)[6][7][256]; + uint16_t *mb_type; uint32_t *dummy; int16_t (*motion_val8[3])[2]; -- 2.1.3 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] flacenc: calculate lower sum levels in-place.
Should improve cache usage and reduces stack usage. Also reduces number of copies in case many levels have the same number of bits. --- libavcodec/flacenc.c | 34 +++--- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/libavcodec/flacenc.c b/libavcodec/flacenc.c index e66ef3d..9786782 100644 --- a/libavcodec/flacenc.c +++ b/libavcodec/flacenc.c @@ -609,10 +609,10 @@ static uint64_t calc_optimal_rice_params(RiceContext *rc, int porder, } -static void calc_sums(int pmin, int pmax, uint32_t *data, int n, int pred_order, - uint64_t sums[][MAX_PARTITIONS]) +static void calc_sum_top(int pmax, uint32_t *data, int n, int pred_order, + uint64_t sums[MAX_PARTITIONS]) { -int i, j; +int i; int parts; uint32_t *res, *res_end; @@ -624,17 +624,18 @@ static void calc_sums(int pmin, int pmax, uint32_t *data, int n, int pred_order, uint64_t sum = 0; while (res < res_end) sum += *(res++); -sums[pmax][i] = sum; +sums[i] = sum; res_end += n >> pmax; } -/* sums for lower levels */ -for (i = pmax - 1; i >= pmin; i--) { -parts = (1 << i); -for (j = 0; j < parts; j++) -sums[i][j] = sums[i+1][2*j] + sums[i+1][2*j+1]; -} } +static void calc_sum_next(int level, uint64_t sums[MAX_PARTITIONS]) +{ +int i; +int parts = (1 << level); +for (i = 0; i < parts; i++) +sums[i] = sums[2*i] + sums[2*i+1]; +} static uint64_t calc_rice_params(RiceContext *rc, int pmin, int pmax, int32_t *data, int n, int pred_order) @@ -644,7 +645,7 @@ static uint64_t calc_rice_params(RiceContext *rc, int pmin, int pmax, int opt_porder; RiceContext tmp_rc; uint32_t *udata; -uint64_t sums[MAX_PARTITION_ORDER+1][MAX_PARTITIONS]; +uint64_t sums[MAX_PARTITIONS]; av_assert1(pmin >= 0 && pmin <= MAX_PARTITION_ORDER); av_assert1(pmax >= 0 && pmax <= MAX_PARTITION_ORDER); @@ -656,16 +657,19 @@ static uint64_t calc_rice_params(RiceContext *rc, int pmin, int pmax, for (i = 0; i < n; i++) udata[i] = (2*data[i]) ^ (data[i]>>31); -calc_sums(pmin, pmax, udata, n, pred_order, sums); +calc_sum_top(pmax, udata, n, pred_order, sums); opt_porder = pmin; bits[pmin] = UINT32_MAX; -for (i = pmin; i <= pmax; i++) { -bits[i] = calc_optimal_rice_params(&tmp_rc, i, sums[i], n, pred_order); -if (bits[i] <= bits[opt_porder]) { +for (i = pmax; ; ) { +bits[i] = calc_optimal_rice_params(&tmp_rc, i, sums, n, pred_order); +if (bits[i] < bits[opt_porder]) { opt_porder = i; *rc = tmp_rc; } +if (i == pmin) +break; +calc_sum_next(--i, sums); } av_freep(&udata); -- 2.1.3 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] v210dec: Fix width calculation
--- libavcodec/v210dec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/v210dec.c b/libavcodec/v210dec.c index ae03952..978dffe 100644 --- a/libavcodec/v210dec.c +++ b/libavcodec/v210dec.c @@ -117,7 +117,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, const uint32_t *src = (const uint32_t*)psrc; uint32_t val; -w = (avctx->width / 6) * 6; +w = ((avctx->width - 5) / 6) * 6; s->unpack_frame(src, y, u, v, w); y += w; -- 1.9.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] Dshow Crossbar support
On Wed, Nov 19, 2014 at 3:03 PM, Zach Swena wrote: > Hi, > > Can anyone elaborate on why direct show devices that use crossbar are not > supported by FFmpeg? Also, what is keeping someone from taking the > crossbar support found in VLC and porting it to FFmpeg, assuming the said > port complied with the FFmpeg code conventions? The current work around > seems to be to use a second piece of software to t > > Only time talent and hardware (though I might have hardware for testing). I keep meaning to try and pay Ramiro Polla to do it but haven't gotten around to it yet. Patch welcome, funding welcome. -roger- > Zach > > > > > Note: If there is somewhere else this discussion should take place, please > let me know and I will move it over there. > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel > ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] v210dec: Fix width calculation
On Sat, Nov 22, 2014 at 07:11:57PM +, Kieran Kunhya wrote: > --- > libavcodec/v210dec.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/libavcodec/v210dec.c b/libavcodec/v210dec.c > index ae03952..978dffe 100644 > --- a/libavcodec/v210dec.c > +++ b/libavcodec/v210dec.c > @@ -117,7 +117,7 @@ static int decode_frame(AVCodecContext *avctx, void > *data, int *got_frame, > const uint32_t *src = (const uint32_t*)psrc; > uint32_t val; > > -w = (avctx->width / 6) * 6; > +w = ((avctx->width - 5) / 6) * 6; Why? The original code is correct for v210_planar_unpack_c. The x86 asm code unfortunately doesn't document its assumptions, but I doubt that even for those this would be exactly right. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] v210dec: Fix width calculation
On 22 November 2014 at 19:32, Reimar Döffinger wrote: > On Sat, Nov 22, 2014 at 07:11:57PM +, Kieran Kunhya wrote: >> --- >> libavcodec/v210dec.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/libavcodec/v210dec.c b/libavcodec/v210dec.c >> index ae03952..978dffe 100644 >> --- a/libavcodec/v210dec.c >> +++ b/libavcodec/v210dec.c >> @@ -117,7 +117,7 @@ static int decode_frame(AVCodecContext *avctx, void >> *data, int *got_frame, >> const uint32_t *src = (const uint32_t*)psrc; >> uint32_t val; >> >> -w = (avctx->width / 6) * 6; >> +w = ((avctx->width - 5) / 6) * 6; > > Why? > The original code is correct for v210_planar_unpack_c. > The x86 asm code unfortunately doesn't document its assumptions, > but I doubt that even for those this would be exactly right. Please ignore this patch. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] lpc: Remove stack usage by allocating LLSModel in context.
Signed-off-by: Reimar Döffinger --- libavcodec/lpc.c | 2 +- libavcodec/lpc.h | 4 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/libavcodec/lpc.c b/libavcodec/lpc.c index f54f6f8..deb02e7 100644 --- a/libavcodec/lpc.c +++ b/libavcodec/lpc.c @@ -208,7 +208,7 @@ int ff_lpc_calc_coefs(LPCContext *s, } if (lpc_type == FF_LPC_TYPE_CHOLESKY) { -LLSModel m[2]; +LLSModel *m = s->lls_models; LOCAL_ALIGNED(32, double, var, [FFALIGN(MAX_LPC_ORDER+1,4)]); double av_uninit(weight); memset(var, 0, FFALIGN(MAX_LPC_ORDER+1,4)*sizeof(*var)); diff --git a/libavcodec/lpc.h b/libavcodec/lpc.h index 9e0b056..96acb37 100644 --- a/libavcodec/lpc.h +++ b/libavcodec/lpc.h @@ -24,6 +24,7 @@ #include #include "libavutil/avassert.h" +#include "libavutil/lls.h" #define ORDER_METHOD_EST 0 #define ORDER_METHOD_2LEVEL 1 @@ -79,6 +80,9 @@ typedef struct LPCContext { */ void (*lpc_compute_autocorr)(const double *data, int len, int lag, double *autoc); + +// TODO: these should be allocated to reduce ABI compatibility issues +LLSModel lls_models[2]; } LPCContext; -- 2.1.3 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] lpc: Remove stack usage by allocating LLSModel in context.
On Sat, Nov 22, 2014 at 08:49:45PM +0100, Reimar Döffinger wrote: > Signed-off-by: Reimar Döffinger Was of course meant to be "reduce stack usage" in subject, fixed locally. I thought about adding a alloc function for LLSModel while at it, but the code changes would have needed to be a bit larger for that, so I decided not to for the moment. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] Modified force_key_frames option to accept frame numbers
I am sorry for the spam, but as I have not published any changes to ffmpeg before, I thought I should double-check. Nicolas, you replied earlier that you would not oppose the feature described below. Does that mean I can go ahead and submit my change? Can I consider my change reviewed or am I supposed to wait for further reviews? Regards, Sylwester Zaluga Date: Mon, 10 Nov 2014 14:18:25 +0100 From: geo...@nsup.org To: ffmpeg-devel@ffmpeg.org CC: sylwek...@outlook.com Subject: Re: [FFmpeg-devel] Modified force_key_frames option to accept frame numbers Le nonidi 19 brumaire, an CCXXIII, Sylvester Zaluga a écrit : > ***Sending again, this time with diff*** Better use git format-patch (or git send-email), so that you have authorship and date information. > Attached a patch which allows for passing in frame numbers > at which key frames should be forced. > > The current modes in which force_key_frames operate are: > > * force_key_frames 1,2,3,4,5 - parameter is interpreted as timestamps > * force_key_frames expr:gte(t,n_forced) - parameter is an expression > > The patch adds support for third mode: > * force_key_frames n:0,25,50,75,100 - interpret parameter as frame numbers > > I find this useful for avoiding float precision-related > issues that surface when key frames are forced at specified timestamps. I will not actually oppose the feature, but every time people insist on working with frame numbers instead of timestamp, I feel they are doing something incorrectly. In this particular case, you can easily work around the floating point rounding issues, since the rounding behaviour of -force_key_frames is specified: "more precisely at the first frames after each specified time". You just have to make sure your timestamps are rounded down. For example, with 24000/1001 FPS: 4.21 4.25 4.30* 4.34 4.38, you need to write 4.29, not 4.30, but you can also write any value between 4.25425 and the actual 4.295958333. (4.25+4.30)/2 = 4.275 should always work. > My use case is as follows: > * generate output video with settings for HD video > * extract key frame numbers from HD video > * generate SD video with key frames at identical positions > * In my application, do video LODing by switching HD/SD video > depending on bandwith What happens if, in order to lower even more the SD bitrate, you decide to add the decimate filter? Frame numbers are jumbled, while timestamps are preserved. Working with frame numbers is fragile. (Also, note that with some codecs, forcing a lot of keyframes will have a dramatic effect on the efficiency of the encoding.) Regards, -- Nicolas George ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] v210enc: Add x86 SIMD
--- libavcodec/v210enc.c| 78 ++--- libavcodec/v210enc.h| 31 libavcodec/x86/Makefile | 2 ++ 3 files changed, 88 insertions(+), 23 deletions(-) create mode 100644 libavcodec/v210enc.h diff --git a/libavcodec/v210enc.c b/libavcodec/v210enc.c index ef0d6ab..4a6bdfc 100644 --- a/libavcodec/v210enc.c +++ b/libavcodec/v210enc.c @@ -24,9 +24,37 @@ #include "avcodec.h" #include "bytestream.h" #include "internal.h" +#include "v210enc.h" + +#define CLIP(v) av_clip(v, 4, 1019) + +#define WRITE_PIXELS(a, b, c) \ +do {\ +val = CLIP(*a++); \ +val |= (CLIP(*b++) << 10) | \ + (CLIP(*c++) << 20); \ +AV_WL32(dst, val); \ +dst += 4; \ +} while (0) + +static void v210_planar_pack_c(const uint16_t *y, const uint16_t *u, + const uint16_t *v, uint8_t *dst, ptrdiff_t width) +{ +uint32_t val; +int i; + +for( i = 0; i < width-5; i += 6 ){ +WRITE_PIXELS(u, y, v); +WRITE_PIXELS(y, u, y); +WRITE_PIXELS(v, y, u); +WRITE_PIXELS(y, v, y); +} +} static av_cold int encode_init(AVCodecContext *avctx) { +V210EncContext *s = avctx->priv_data; + if (avctx->width & 1) { av_log(avctx, AV_LOG_ERROR, "v210 needs even width\n"); return AVERROR(EINVAL); @@ -42,12 +70,19 @@ static av_cold int encode_init(AVCodecContext *avctx) avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I; +s->pack_line= v210_planar_pack_c; + +if (HAVE_MMX) +v210enc_x86_init(s); + return 0; } static int encode_frame(AVCodecContext *avctx, AVPacket *pkt, const AVFrame *pic, int *got_packet) { +V210EncContext *s = avctx->priv_data; + int aligned_width = ((avctx->width + 47) / 48) * 48; int stride = aligned_width * 8 / 3; int line_padding = stride - ((avctx->width * 8 + 11) / 12) * 4; @@ -55,49 +90,45 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt, const uint16_t *y = (const uint16_t*)pic->data[0]; const uint16_t *u = (const uint16_t*)pic->data[1]; const uint16_t *v = (const uint16_t*)pic->data[2]; -PutByteContext p; +uint8_t *dst; if ((ret = ff_alloc_packet(pkt, avctx->height * stride)) < 0) { av_log(avctx, AV_LOG_ERROR, "Error getting output packet.\n"); return ret; } -bytestream2_init_writer(&p, pkt->data, pkt->size); - -#define CLIP(v) av_clip(v, 4, 1019) - -#define WRITE_PIXELS(a, b, c) \ -do {\ -val = CLIP(*a++); \ -val |= (CLIP(*b++) << 10) | \ - (CLIP(*c++) << 20); \ -bytestream2_put_le32u(&p, val); \ -} while (0) +dst = pkt->data; for (h = 0; h < avctx->height; h++) { uint32_t val; -for (w = 0; w < avctx->width - 5; w += 6) { -WRITE_PIXELS(u, y, v); -WRITE_PIXELS(y, u, y); -WRITE_PIXELS(v, y, u); -WRITE_PIXELS(y, v, y); -} +w = (avctx->width / 6) * 6; +s->pack_line(y, u, v, dst, w); + +y += w; +u += w >> 1; +v += w >> 1; +dst += (w / 6) * 16; if (w < avctx->width - 1) { WRITE_PIXELS(u, y, v); val = CLIP(*y++); -if (w == avctx->width - 2) -bytestream2_put_le32u(&p, val); +if (w == avctx->width - 2) { +AV_WL32(dst, val); +dst += 4; +} } if (w < avctx->width - 3) { val |= (CLIP(*u++) << 10) | (CLIP(*y++) << 20); -bytestream2_put_le32u(&p, val); +AV_WL32(dst, val); +dst += 4; val = CLIP(*v++) | (CLIP(*y++) << 10); -bytestream2_put_le32u(&p, val); +AV_WL32(dst, val); +dst += 4; } -bytestream2_set_buffer(&p, 0, line_padding); +memset(dst, 0, line_padding); +dst += line_padding; y += pic->linesize[0] / 2 - avctx->width; u += pic->linesize[1] / 2 - avctx->width / 2; @@ -121,6 +152,7 @@ AVCodec ff_v210_encoder = { .long_name = NULL_IF_CONFIG_SMALL("Uncompressed 4:2:2 10-bit"), .type = AVMEDIA_TYPE_VIDEO, .id = AV_CODEC_ID_V210, +.priv_data_size = sizeof(V210EncContext), .init = encode_init, .encode2= encode_frame, .close = encode_close, diff --git a/libavcodec/v210enc.h b/libavcodec/v210enc.h new file mode 100644 index 000..b8b6143 --- /dev/null +++ b/libavcodec/v210enc.h @@ -0,0 +1,31 @@ +/* + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as
[FFmpeg-devel] [PATCH] v210enc: Add x86 SIMD
--- libavcodec/v210enc.c | 78 ++- libavcodec/v210enc.h | 31 + libavcodec/x86/Makefile | 2 ++ libavcodec/x86/v210enc.asm| 76 + libavcodec/x86/v210enc_init.c | 31 + 5 files changed, 195 insertions(+), 23 deletions(-) create mode 100644 libavcodec/v210enc.h create mode 100644 libavcodec/x86/v210enc.asm create mode 100644 libavcodec/x86/v210enc_init.c diff --git a/libavcodec/v210enc.c b/libavcodec/v210enc.c index ef0d6ab..4a6bdfc 100644 --- a/libavcodec/v210enc.c +++ b/libavcodec/v210enc.c @@ -24,9 +24,37 @@ #include "avcodec.h" #include "bytestream.h" #include "internal.h" +#include "v210enc.h" + +#define CLIP(v) av_clip(v, 4, 1019) + +#define WRITE_PIXELS(a, b, c) \ +do {\ +val = CLIP(*a++); \ +val |= (CLIP(*b++) << 10) | \ + (CLIP(*c++) << 20); \ +AV_WL32(dst, val); \ +dst += 4; \ +} while (0) + +static void v210_planar_pack_c(const uint16_t *y, const uint16_t *u, + const uint16_t *v, uint8_t *dst, ptrdiff_t width) +{ +uint32_t val; +int i; + +for( i = 0; i < width-5; i += 6 ){ +WRITE_PIXELS(u, y, v); +WRITE_PIXELS(y, u, y); +WRITE_PIXELS(v, y, u); +WRITE_PIXELS(y, v, y); +} +} static av_cold int encode_init(AVCodecContext *avctx) { +V210EncContext *s = avctx->priv_data; + if (avctx->width & 1) { av_log(avctx, AV_LOG_ERROR, "v210 needs even width\n"); return AVERROR(EINVAL); @@ -42,12 +70,19 @@ static av_cold int encode_init(AVCodecContext *avctx) avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I; +s->pack_line= v210_planar_pack_c; + +if (HAVE_MMX) +v210enc_x86_init(s); + return 0; } static int encode_frame(AVCodecContext *avctx, AVPacket *pkt, const AVFrame *pic, int *got_packet) { +V210EncContext *s = avctx->priv_data; + int aligned_width = ((avctx->width + 47) / 48) * 48; int stride = aligned_width * 8 / 3; int line_padding = stride - ((avctx->width * 8 + 11) / 12) * 4; @@ -55,49 +90,45 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt, const uint16_t *y = (const uint16_t*)pic->data[0]; const uint16_t *u = (const uint16_t*)pic->data[1]; const uint16_t *v = (const uint16_t*)pic->data[2]; -PutByteContext p; +uint8_t *dst; if ((ret = ff_alloc_packet(pkt, avctx->height * stride)) < 0) { av_log(avctx, AV_LOG_ERROR, "Error getting output packet.\n"); return ret; } -bytestream2_init_writer(&p, pkt->data, pkt->size); - -#define CLIP(v) av_clip(v, 4, 1019) - -#define WRITE_PIXELS(a, b, c) \ -do {\ -val = CLIP(*a++); \ -val |= (CLIP(*b++) << 10) | \ - (CLIP(*c++) << 20); \ -bytestream2_put_le32u(&p, val); \ -} while (0) +dst = pkt->data; for (h = 0; h < avctx->height; h++) { uint32_t val; -for (w = 0; w < avctx->width - 5; w += 6) { -WRITE_PIXELS(u, y, v); -WRITE_PIXELS(y, u, y); -WRITE_PIXELS(v, y, u); -WRITE_PIXELS(y, v, y); -} +w = (avctx->width / 6) * 6; +s->pack_line(y, u, v, dst, w); + +y += w; +u += w >> 1; +v += w >> 1; +dst += (w / 6) * 16; if (w < avctx->width - 1) { WRITE_PIXELS(u, y, v); val = CLIP(*y++); -if (w == avctx->width - 2) -bytestream2_put_le32u(&p, val); +if (w == avctx->width - 2) { +AV_WL32(dst, val); +dst += 4; +} } if (w < avctx->width - 3) { val |= (CLIP(*u++) << 10) | (CLIP(*y++) << 20); -bytestream2_put_le32u(&p, val); +AV_WL32(dst, val); +dst += 4; val = CLIP(*v++) | (CLIP(*y++) << 10); -bytestream2_put_le32u(&p, val); +AV_WL32(dst, val); +dst += 4; } -bytestream2_set_buffer(&p, 0, line_padding); +memset(dst, 0, line_padding); +dst += line_padding; y += pic->linesize[0] / 2 - avctx->width; u += pic->linesize[1] / 2 - avctx->width / 2; @@ -121,6 +152,7 @@ AVCodec ff_v210_encoder = { .long_name = NULL_IF_CONFIG_SMALL("Uncompressed 4:2:2 10-bit"), .type = AVMEDIA_TYPE_VIDEO, .id = AV_CODEC_ID_V210, +.priv_data_size = sizeof(V210EncContext), .init = encode_init, .encode2= encode_frame, .close = encode_close, diff --git a/libavcodec/v210enc.h b/libavcodec/v210enc.h new file mode 100644 index 000..b8b
Re: [FFmpeg-devel] [PATCH] v210enc: Add x86 SIMD
Kieran Kunhya obe.tv> writes: > --- a/libavcodec/x86/Makefile > +++ b/libavcodec/x86/Makefile > -47,6 +47,7 >x86/rv40dsp_init.o > OBJS-$(CONFIG_SVQ1_ENCODER)+= x86/svq1enc.o > OBJS-$(CONFIG_TRUEHD_DECODER) += x86/mlpdsp.o > +OBJS-$(CONFIG_V210_ENCODER)+= x86/v210enc_init.o This does not apply here, please update to current git head. Carl Eugen ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] lavc/anm: fix mem leak in case of init failure
Signed-off-by: Lukasz Marek --- libavcodec/anm.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libavcodec/anm.c b/libavcodec/anm.c index 79a87dd..3727534 100644 --- a/libavcodec/anm.c +++ b/libavcodec/anm.c @@ -47,8 +47,10 @@ static av_cold int decode_init(AVCodecContext *avctx) return AVERROR(ENOMEM); bytestream2_init(&s->gb, avctx->extradata, avctx->extradata_size); -if (bytestream2_get_bytes_left(&s->gb) < 16 * 8 + 4 * 256) +if (bytestream2_get_bytes_left(&s->gb) < 16 * 8 + 4 * 256) { +av_frame_free(&s->frame); return AVERROR_INVALIDDATA; +} bytestream2_skipu(&s->gb, 16 * 8); for (i = 0; i < 256; i++) -- 1.9.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 1/2] lavc/libvorbisdec: fix mem leak in case of init failure
Signed-off-by: Lukasz Marek --- libavcodec/libvorbisdec.c | 22 +++--- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/libavcodec/libvorbisdec.c b/libavcodec/libvorbisdec.c index b703b65..f2c5046 100644 --- a/libavcodec/libvorbisdec.c +++ b/libavcodec/libvorbisdec.c @@ -35,17 +35,17 @@ typedef struct OggVorbisDecContext { static int oggvorbis_decode_init(AVCodecContext *avccontext) { OggVorbisDecContext *context = avccontext->priv_data ; uint8_t *p= avccontext->extradata; -int i, hsizes[3]; +int i, hsizes[3], ret; unsigned char *headers[3], *extradata = avccontext->extradata; -vorbis_info_init(&context->vi) ; -vorbis_comment_init(&context->vc) ; - if(! avccontext->extradata_size || ! p) { av_log(avccontext, AV_LOG_ERROR, "vorbis extradata absent\n"); return -1; } +vorbis_info_init(&context->vi) ; +vorbis_comment_init(&context->vc) ; + if(p[0] == 0 && p[1] == 30) { for(i = 0; i < 3; i++){ hsizes[i] = bytestream_get_be16((const uint8_t **)&p); @@ -65,7 +65,8 @@ static int oggvorbis_decode_init(AVCodecContext *avccontext) { if(offset >= avccontext->extradata_size - 1) { av_log(avccontext, AV_LOG_ERROR, "vorbis header sizes damaged\n"); -return -1; +ret = -1; +goto error; } hsizes[i] += *p; offset++; @@ -83,7 +84,8 @@ static int oggvorbis_decode_init(AVCodecContext *avccontext) { } else { av_log(avccontext, AV_LOG_ERROR, "vorbis initial header len is wrong: %d\n", *p); -return -1; +ret = -1; +goto error; } for(i=0; i<3; i++){ @@ -92,7 +94,8 @@ static int oggvorbis_decode_init(AVCodecContext *avccontext) { context->op.packet = headers[i]; if(vorbis_synthesis_headerin(&context->vi, &context->vc, &context->op)<0){ av_log(avccontext, AV_LOG_ERROR, "%d. vorbis header damaged\n", i+1); -return -1; +ret = -1; +goto error; } } @@ -105,6 +108,11 @@ static int oggvorbis_decode_init(AVCodecContext *avccontext) { vorbis_block_init(&context->vd, &context->vb); return 0 ; + + error: +vorbis_info_clear(&context->vi); +vorbis_comment_clear(&context->vc) ; +return ret; } -- 1.9.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] lavc/smacker: fix mem leak in case of init failure
Signed-off-by: Lukasz Marek --- libavcodec/smacker.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libavcodec/smacker.c b/libavcodec/smacker.c index 518bdad..b5538c7 100644 --- a/libavcodec/smacker.c +++ b/libavcodec/smacker.c @@ -589,6 +589,7 @@ static av_cold int decode_init(AVCodecContext *avctx) /* decode huffman trees from extradata */ if(avctx->extradata_size < 16){ av_log(avctx, AV_LOG_ERROR, "Extradata missing!\n"); +decode_end(avctx); return AVERROR(EINVAL); } -- 1.9.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 2/2] lavc/libvorbisdec: use better error codes
Signed-off-by: Lukasz Marek --- libavcodec/libvorbisdec.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libavcodec/libvorbisdec.c b/libavcodec/libvorbisdec.c index f2c5046..db00572 100644 --- a/libavcodec/libvorbisdec.c +++ b/libavcodec/libvorbisdec.c @@ -40,7 +40,7 @@ static int oggvorbis_decode_init(AVCodecContext *avccontext) { if(! avccontext->extradata_size || ! p) { av_log(avccontext, AV_LOG_ERROR, "vorbis extradata absent\n"); -return -1; +return AVERROR(EINVAL); } vorbis_info_init(&context->vi) ; @@ -65,7 +65,7 @@ static int oggvorbis_decode_init(AVCodecContext *avccontext) { if(offset >= avccontext->extradata_size - 1) { av_log(avccontext, AV_LOG_ERROR, "vorbis header sizes damaged\n"); -ret = -1; +ret = AVERROR_INVALIDDATA; goto error; } hsizes[i] += *p; @@ -84,7 +84,7 @@ static int oggvorbis_decode_init(AVCodecContext *avccontext) { } else { av_log(avccontext, AV_LOG_ERROR, "vorbis initial header len is wrong: %d\n", *p); -ret = -1; +ret = AVERROR_INVALIDDATA; goto error; } @@ -94,7 +94,7 @@ static int oggvorbis_decode_init(AVCodecContext *avccontext) { context->op.packet = headers[i]; if(vorbis_synthesis_headerin(&context->vi, &context->vc, &context->op)<0){ av_log(avccontext, AV_LOG_ERROR, "%d. vorbis header damaged\n", i+1); -ret = -1; +ret = AVERROR_INVALIDDATA; goto error; } } -- 1.9.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] lavc/mss1: fix mem leak in case of init failure
Signed-off-by: Lukasz Marek --- libavcodec/mss1.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavcodec/mss1.c b/libavcodec/mss1.c index 6bb524b..2eb67df 100644 --- a/libavcodec/mss1.c +++ b/libavcodec/mss1.c @@ -197,6 +197,8 @@ static av_cold int mss1_decode_init(AVCodecContext *avctx) return AVERROR(ENOMEM); ret = ff_mss12_decode_init(&c->ctx, 0, &c->sc, NULL); +if (ret < 0) +av_frame_free(&c->pic); avctx->pix_fmt = AV_PIX_FMT_PAL8; -- 1.9.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [libav-devel] [PATCH] v210enc: Add x86 SIMD
On 22/11/14 5:58 PM, Kieran Kunhya wrote: > diff --git a/libavcodec/v210enc.h b/libavcodec/v210enc.h > new file mode 100644 > index 000..b8b6143 > --- /dev/null > +++ b/libavcodec/v210enc.h > @@ -0,0 +1,31 @@ > +/* > + * This file is part of Libav. It shouldn't take long to make a patch that can be applied to the ffmpeg tree in a conflict free way... > + * > + * Libav is free software; you can redistribute it and/or > + * modify it under the terms of the GNU Lesser General Public > + * License as published by the Free Software Foundation; either > + * version 2.1 of the License, or (at your option) any later version. > + * > + * Libav is distributed in the hope that it will be useful, > + * but WITHOUT ANY WARRANTY; without even the implied warranty of > + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU > + * Lesser General Public License for more details. > + * > + * You should have received a copy of the GNU Lesser General Public > + * License along with Libav; if not, write to the Free Software > + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 > USA > + */ > + > +#ifndef AVCOENC_V210ENC_H > +#define AVCOENC_V210ENC_H > + > +#include "libavutil/log.h" > +#include "libavutil/opt.h" > + > +typedef struct { > +void (*pack_line)(const uint16_t *y, const uint16_t *u, const uint16_t > *v, uint8_t *dst, ptrdiff_t width); > +} V210EncContext; > + > +void v210enc_x86_init(V210EncContext *s); ff_v210enc_init_x86 [...] > diff --git a/libavcodec/x86/v210enc.asm b/libavcodec/x86/v210enc.asm > new file mode 100644 > index 000..ca3edf4 > --- /dev/null > +++ b/libavcodec/x86/v210enc.asm > @@ -0,0 +1,76 @@ > +;** > +;* V210 SIMD pack > +;* Copyright (c) 2014 Kieran Kunhya > +;* > +;* This file is part of Libav. > +;* > +;* Libav is free software; you can redistribute it and/or > +;* modify it under the terms of the GNU Lesser General Public > +;* License as published by the Free Software Foundation; either > +;* version 2.1 of the License, or (at your option) any later version. > +;* > +;* Libav is distributed in the hope that it will be useful, > +;* but WITHOUT ANY WARRANTY; without even the implied warranty of > +;* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU > +;* Lesser General Public License for more details. > +;* > +;* You should have received a copy of the GNU Lesser General Public > +;* License along with Libav; if not, write to the Free Software > +;* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 > USA > +;** > + > +%include "libavutil/x86/x86util.asm" > + > +SECTION_RODATA > + > +v210_enc_min: times 8 dw 0x4 > +v210_enc_max: times 8 dw 0x3fb > + > +v210_enc_luma_mult: dw 4,1,16,4,1,16,0,0 > +v210_enc_luma_shuf: db -1,0,1,-1,2,3,4,5,-1,6,7,-1,8,9,10,11 > + > +v210_enc_chroma_mult: dw 1,4,16,0,16,1,4,0 > +v210_enc_chroma_shuf: db 0,1,8,9,-1,2,3,-1,10,11,4,5,-1,12,13,-1 > + > +SECTION .text > + > +%macro v210_planar_pack 0 > + > +; v210_planar_pack(const uint16_t *y, const uint16_t *u, const uint16_t *v, > uint8_t *dst, ptrdiff_t width) > +cglobal v210_planar_pack, 5, 5, 4, y, u, v, dst, width > +lea r0, [r0+2*widthq] > +add uq, widthq > +add vq, widthq > +neg widthq > + > +movum2, [v210_enc_min] > +movum3, [v210_enc_max] mova, they are aligned and declared on this same file. You may be able to use mova below as well, but I don't know if AVFrame->data and AVPacket->data are aligned here. It's probably worth a try. > + > +.loop > +movum0, [yq+2*widthq] > +CLIPW m0, m2, m3 > + > +movqm1, [uq+widthq] > +movhps m1, [vq+widthq] > +CLIPW m1, m2, m3 > + > +pmullw m0, [v210_enc_luma_mult] > +pshufb m0, [v210_enc_luma_shuf] > + > +pmullw m1, [v210_enc_chroma_mult] > +pshufb m1, [v210_enc_chroma_shuf] > + > +por m0, m1 > + > +movu[dstq], m0 > + > +add dstq, mmsize > +add widthq, 6 > +jl .loop > + > +REP_RET This is an SSSE3 function, so RET can be used instead (REP_RET is only really needed for SSE3 and below). > +%endmacro > + > +INIT_XMM ssse3 > +v210_planar_pack > + > diff --git a/libavcodec/x86/v210enc_init.c b/libavcodec/x86/v210enc_init.c > new file mode 100644 > index 000..524ec7a > --- /dev/null > +++ b/libavcodec/x86/v210enc_init.c > @@ -0,0 +1,31 @@ > +/* > + * This file is part of Libav. > + * > + * Libav is free software; you can redistribute it and/or > + * modify it under the terms of the GNU Lesser General Public > + * License as published by the Free Software Foundation; either > + * version 2.1 of the License, or (at your option) any later version. > + * > + * Libav is distributed in the hope that it will be useful, > + * but WITHOUT ANY WARRANTY; without even the implied warranty of > +
[FFmpeg-devel] [PATCH]Print a warning if vp6 is muxed into flv
Hi! FFmpeg should print a warning when the non-flipped version of vp6 is muxed into flv: The feature was requested and is used. Related to ticket #4132. Please comment, Carl Eugen diff --git a/libavformat/flvenc.c b/libavformat/flvenc.c index a8cd994..5468c4d 100644 --- a/libavformat/flvenc.c +++ b/libavformat/flvenc.c @@ -355,6 +355,9 @@ static int flv_write_header(AVFormatContext *s) "use vstrict=-1 / -strict -1 to use it anyway.\n"); return AVERROR(EINVAL); } +} else if (enc->codec_id == AV_CODEC_ID_VP6) { +av_log(s, AV_LOG_WARNING, + "Muxing VP6 in flv will produce flipped video on playback.\n"); } break; case AVMEDIA_TYPE_AUDIO: ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] libavcodec/rv30: fix mem leak in case of init failure
Also replaced return -1 with return AVERROR(EINVAL) Signed-off-by: Lukasz Marek --- libavcodec/rv30.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libavcodec/rv30.c b/libavcodec/rv30.c index fd8fd4f..1483107 100644 --- a/libavcodec/rv30.c +++ b/libavcodec/rv30.c @@ -259,13 +259,13 @@ static av_cold int rv30_decode_init(AVCodecContext *avctx) RV34DecContext *r = avctx->priv_data; int ret; +if (avctx->extradata_size < 2) { +av_log(avctx, AV_LOG_ERROR, "Extradata is too small.\n"); +return AVERROR(EINVAL); +} r->rv30 = 1; if ((ret = ff_rv34_decode_init(avctx)) < 0) return ret; -if(avctx->extradata_size < 2){ -av_log(avctx, AV_LOG_ERROR, "Extradata is too small.\n"); -return -1; -} r->max_rpr = avctx->extradata[1] & 7; if(avctx->extradata_size < 2*r->max_rpr + 8){ -- 1.9.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] xface: Fix encoder crashes due to too small on-stack array.
Also add a FATE test. Signed-off-by: Reimar Döffinger --- libavcodec/xface.h | 9 + libavcodec/xfaceenc.c | 3 +++ libavformat/nut.c | 1 + tests/fate/vcodec.mak | 5 + tests/ref/vsynth/vsynth1-xface | 4 tests/ref/vsynth/vsynth2-xface | 4 tests/ref/vsynth/vsynth3-xface | 4 7 files changed, 26 insertions(+), 4 deletions(-) create mode 100644 tests/ref/vsynth/vsynth1-xface create mode 100644 tests/ref/vsynth/vsynth2-xface create mode 100644 tests/ref/vsynth/vsynth3-xface diff --git a/libavcodec/xface.h b/libavcodec/xface.h index cd59ba0..6fbe908 100644 --- a/libavcodec/xface.h +++ b/libavcodec/xface.h @@ -40,11 +40,12 @@ /* * Image is encoded as a big integer, using characters from '~' to - * '!', for a total of 92 symbols. In order to express 48x48=2304 - * bits, we need a total of 354 digits, as given by: - * ceil(lg_92(2^2304)) = 354 + * '!', for a total of 94 symbols. In order to express + * 48x48*2=8*XFACE_MAX_WORDS=4608 + * bits, we need a total of 704 digits, as given by: + * ceil(lg_94(2^4608)) = 704 */ -#define XFACE_MAX_DIGITS 354 +#define XFACE_MAX_DIGITS 704 #define XFACE_BITSPERWORD 8 #define XFACE_WORDCARRY (1 << XFACE_BITSPERWORD) diff --git a/libavcodec/xfaceenc.c b/libavcodec/xfaceenc.c index e213c9d..0ade302 100644 --- a/libavcodec/xfaceenc.c +++ b/libavcodec/xfaceenc.c @@ -27,6 +27,7 @@ #include "xface.h" #include "avcodec.h" #include "internal.h" +#include "libavutil/avassert.h" typedef struct XFaceContext { AVClass *class; @@ -196,9 +197,11 @@ static int xface_encode_frame(AVCodecContext *avctx, AVPacket *pkt, /* write the inverted big integer in b to intbuf */ i = 0; +av_assert0(b.nb_words < XFACE_MAX_WORDS); while (b.nb_words) { uint8_t r; ff_big_div(&b, XFACE_PRINTS, &r); +av_assert0(i < sizeof(intbuf)); intbuf[i++] = r + XFACE_FIRST_PRINT; } diff --git a/libavformat/nut.c b/libavformat/nut.c index 9224a96..86a0301 100644 --- a/libavformat/nut.c +++ b/libavformat/nut.c @@ -40,6 +40,7 @@ const AVCodecTag ff_nut_data_tags[] = { }; const AVCodecTag ff_nut_video_tags[] = { +{ AV_CODEC_ID_XFACE,MKTAG('X', 'F', 'A', 'C') }, { AV_CODEC_ID_VP9, MKTAG('V', 'P', '9', '0') }, { AV_CODEC_ID_RAWVIDEO, MKTAG('R', 'G', 'B', 15 ) }, { AV_CODEC_ID_RAWVIDEO, MKTAG('B', 'G', 'R', 15 ) }, diff --git a/tests/fate/vcodec.mak b/tests/fate/vcodec.mak index c715071..803edec 100644 --- a/tests/fate/vcodec.mak +++ b/tests/fate/vcodec.mak @@ -294,6 +294,11 @@ fate-vsynth%-wmv2: ENCOPTS = -qscale 10 FATE_VCODEC-$(call ENCDEC, RAWVIDEO, AVI) += yuv fate-vsynth%-yuv:CODEC = rawvideo +FATE_VCODEC-$(call ENCDEC, XFACE, NUT) += xface +fate-vsynth%-xface: ENCOPTS = -s 48x48 -sws_flags neighbor+bitexact +fate-vsynth%-xface: DECOPTS = -sws_flags neighbor+bitexact +fate-vsynth%-xface: FMT = nut + FATE_VCODEC-$(call ENCDEC, YUV4, AVI) += yuv4 FATE_VCODEC-$(call ENCDEC, Y41P, AVI) += y41p diff --git a/tests/ref/vsynth/vsynth1-xface b/tests/ref/vsynth/vsynth1-xface new file mode 100644 index 000..3b916c6 --- /dev/null +++ b/tests/ref/vsynth/vsynth1-xface @@ -0,0 +1,4 @@ +487c3e53249f7b9f16e04257295998de *tests/data/fate/vsynth1-xface.nut +19746 tests/data/fate/vsynth1-xface.nut +42d8261bb538b8789840ac085f7fc4d2 *tests/data/fate/vsynth1-xface.out.rawvideo +stddev: 103.88 PSNR: 7.80 MAXDIFF: 254 bytes: 7603200/ 7603200 diff --git a/tests/ref/vsynth/vsynth2-xface b/tests/ref/vsynth/vsynth2-xface new file mode 100644 index 000..5f60d66 --- /dev/null +++ b/tests/ref/vsynth/vsynth2-xface @@ -0,0 +1,4 @@ +6a1a7b467eeab2795510e7dd1ca528ff *tests/data/fate/vsynth2-xface.nut +17504 tests/data/fate/vsynth2-xface.nut +6d87881d630439d02c7a97f468d67a1c *tests/data/fate/vsynth2-xface.out.rawvideo +stddev: 99.01 PSNR: 8.22 MAXDIFF: 238 bytes: 7603200/ 7603200 diff --git a/tests/ref/vsynth/vsynth3-xface b/tests/ref/vsynth/vsynth3-xface new file mode 100644 index 000..f98a5c5 --- /dev/null +++ b/tests/ref/vsynth/vsynth3-xface @@ -0,0 +1,4 @@ +f399a6b312d0a2d873b8a3bc761c5eba *tests/data/fate/vsynth3-xface.nut +15696 tests/data/fate/vsynth3-xface.nut +eafdc027c9c36f96e71e91a5682a0d2e *tests/data/fate/vsynth3-xface.out.rawvideo +stddev: 97.22 PSNR: 8.37 MAXDIFF: 236 bytes:86700/86700 -- 2.1.3 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] libavcodec/tiff: Fix static linking of lzma with msvc.
On Sun, Nov 23, 2014 at 05:25:25AM +1100, Matt Oliver wrote: > This fixes an error when using static lzma libs with msvc compiler. Without > it the lzma.h header defaults to forcing dll (shared) linkage which breaks > when using static libs. The fix requires adding a simple define before the > header is included that only affects lzma.h on win32 and only with msvc/icl. > > This patch is the same as previously submitted and applied patches for > identical issues with some of the other external libs. I wrote a rather > long and detailed explanation of why this type of thing is needed and why > it works on one of the previously accepted patches if anyone is curious. > tiff.c |1 + > 1 file changed, 1 insertion(+) > 7ab4f4b2fc04ee21ed17f5cd43ed14cf9db28cd2 > 0001-libavcodec-tiff-Fix-static-linking-of-lzma-with-msvc.patch > From 5b07f8961b3c777e5a6c9ba759883c15ef2c3ec5 Mon Sep 17 00:00:00 2001 > From: Matthew Oliver > Date: Sun, 23 Nov 2014 03:43:19 +1100 > Subject: [PATCH] libavcodec/tiff: Fix static linking of lzma with msvc. applied thx [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Old school: Use the lowest level language in which you can solve the problem conveniently. New school: Use the highest level language in which the latest supercomputer can solve the problem without the user falling asleep waiting. signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] lavc/smvjpegdec: fix mem leak in case of init failure
Signed-off-by: Lukasz Marek --- libavcodec/smvjpegdec.c | 9 - 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/libavcodec/smvjpegdec.c b/libavcodec/smvjpegdec.c index 69327cd..261a441 100644 --- a/libavcodec/smvjpegdec.c +++ b/libavcodec/smvjpegdec.c @@ -89,8 +89,10 @@ static av_cold int smvjpeg_decode_init(AVCodecContext *avctx) return AVERROR(ENOMEM); s->picture[1] = av_frame_alloc(); -if (!s->picture[1]) +if (!s->picture[1]) { +av_frame_free(&s->picture[0]); return AVERROR(ENOMEM); +} s->jpg.picture_ptr = s->picture[0]; @@ -120,6 +122,11 @@ static av_cold int smvjpeg_decode_init(AVCodecContext *avctx) } av_dict_free(&thread_opt); +if (ret < 0) { +av_frame_free(&s->picture[0]); +av_frame_free(&s->picture[1]); +avcodec_free_context(&s->avctx); +} return ret; } -- 1.9.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] lpc: Remove stack usage by allocating LLSModel in context.
On Sat, Nov 22, 2014 at 08:49:45PM +0100, Reimar Döffinger wrote: > Signed-off-by: Reimar Döffinger > --- > libavcodec/lpc.c | 2 +- > libavcodec/lpc.h | 4 > 2 files changed, 5 insertions(+), 1 deletion(-) LGTM [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB It is what and why we do it that matters, not just one of them. signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 1/2] xface: reduce table sizes.
Signed-off-by: Reimar Döffinger --- libavcodec/xface.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/xface.h b/libavcodec/xface.h index 6fbe908..63df5d3 100644 --- a/libavcodec/xface.h +++ b/libavcodec/xface.h @@ -85,8 +85,8 @@ enum XFaceColor { XFACE_COLOR_BLACK = 0, XFACE_COLOR_GREY, XFACE_COLOR_WHITE }; * The probability of the data determines the range of possible encodings. * Offset gives the first possible encoding of the range. */ typedef struct { -int range; -int offset; +uint8_t range; +uint8_t offset; } ProbRange; extern const ProbRange ff_xface_probranges_per_level[4][3]; -- 2.1.3 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 2/2] xface: reduce stack usage by directly storing 2 bytes data instead of pointers.
Signed-off-by: Reimar Döffinger --- libavcodec/xfaceenc.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libavcodec/xfaceenc.c b/libavcodec/xfaceenc.c index 0ade302..7edef1e 100644 --- a/libavcodec/xfaceenc.c +++ b/libavcodec/xfaceenc.c @@ -74,7 +74,7 @@ static int all_white(char *bitmap, int w, int h) } typedef struct { -const ProbRange *prob_ranges[XFACE_PIXELS*2]; +ProbRange prob_ranges[XFACE_PIXELS*2]; int prob_ranges_idx; } ProbRangesQueue; @@ -82,7 +82,7 @@ static inline int pq_push(ProbRangesQueue *pq, const ProbRange *p) { if (pq->prob_ranges_idx >= XFACE_PIXELS * 2 - 1) return -1; -pq->prob_ranges[pq->prob_ranges_idx++] = p; +pq->prob_ranges[pq->prob_ranges_idx++] = *p; return 0; } @@ -147,7 +147,7 @@ static int xface_encode_frame(AVCodecContext *avctx, AVPacket *pkt, const AVFrame *frame, int *got_packet) { XFaceContext *xface = avctx->priv_data; -ProbRangesQueue pq = {{ 0 }, 0}; +ProbRangesQueue pq = {{{ 0 }}, 0}; uint8_t bitmap_copy[XFACE_PIXELS]; BigInt b = {0}; int i, j, k, ret = 0; @@ -193,7 +193,7 @@ static int xface_encode_frame(AVCodecContext *avctx, AVPacket *pkt, encode_block(xface->bitmap + XFACE_WIDTH * 32 + 32, 16, 16, 0, &pq); while (pq.prob_ranges_idx > 0) -push_integer(&b, pq.prob_ranges[--pq.prob_ranges_idx]); +push_integer(&b, &pq.prob_ranges[--pq.prob_ranges_idx]); /* write the inverted big integer in b to intbuf */ i = 0; -- 2.1.3 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] lavc/anm: fix mem leak in case of init failure
On Sat, Nov 22, 2014 at 10:46:02PM +0100, Lukasz Marek wrote: > Signed-off-by: Lukasz Marek > --- > libavcodec/anm.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) LGTM thx [...] -- 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: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] lavfi: add tdiff filter
TODO: bump minor --- Changelog| 1 + doc/filters.texi | 4 ++ libavfilter/Makefile | 1 + libavfilter/allfilters.c | 1 + libavfilter/vf_tdiff.c | 131 +++ 5 files changed, 138 insertions(+) create mode 100644 libavfilter/vf_tdiff.c diff --git a/Changelog b/Changelog index 5f38aea..41fdf18 100644 --- a/Changelog +++ b/Changelog @@ -15,6 +15,7 @@ version : - ffserver supports codec private options - creating DASH compatible fragmented MP4, MPEG-DASH segmenting muxer - WebP muxer with animated WebP support +- tdiff filter version 2.4: diff --git a/doc/filters.texi b/doc/filters.texi index 8c16c7a..9882da7 100644 --- a/doc/filters.texi +++ b/doc/filters.texi @@ -8394,6 +8394,10 @@ Useful for enlarging pixel art images without reducing sharpness. @section swapuv Swap U & V plane. +@section tdiff + +Show difference between consecutive frames. + @section telecine Apply telecine process to the video. diff --git a/libavfilter/Makefile b/libavfilter/Makefile index 2c56e38..3217c99 100644 --- a/libavfilter/Makefile +++ b/libavfilter/Makefile @@ -97,6 +97,7 @@ OBJS-$(CONFIG_BLACKDETECT_FILTER)+= vf_blackdetect.o OBJS-$(CONFIG_BLACKFRAME_FILTER) += vf_blackframe.o OBJS-$(CONFIG_BLEND_FILTER) += vf_blend.o dualinput.o framesync.o OBJS-$(CONFIG_BOXBLUR_FILTER)+= vf_boxblur.o +OBJS-$(CONFIG_CDIFF_FILTER) += vf_cdiff.o OBJS-$(CONFIG_CODECVIEW_FILTER) += vf_codecview.o OBJS-$(CONFIG_COLORBALANCE_FILTER) += vf_colorbalance.o OBJS-$(CONFIG_COLORCHANNELMIXER_FILTER) += vf_colorchannelmixer.o diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c index 2352d44..4d065a9 100644 --- a/libavfilter/allfilters.c +++ b/libavfilter/allfilters.c @@ -201,6 +201,7 @@ void avfilter_register_all(void) REGISTER_FILTER(SUBTITLES, subtitles, vf); REGISTER_FILTER(SUPER2XSAI, super2xsai, vf); REGISTER_FILTER(SWAPUV, swapuv, vf); +REGISTER_FILTER(TDIFF, tdiff, vf); REGISTER_FILTER(TELECINE, telecine, vf); REGISTER_FILTER(THUMBNAIL, thumbnail, vf); REGISTER_FILTER(TILE, tile, vf); diff --git a/libavfilter/vf_tdiff.c b/libavfilter/vf_tdiff.c new file mode 100644 index 000..82dceef --- /dev/null +++ b/libavfilter/vf_tdiff.c @@ -0,0 +1,131 @@ +/* + * Copyright (c) 2014 Stefano Sabatini + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file + * Consecutive frames diff filter. + */ + +#include "libavutil/colorspace.h" +#include "libavutil/common.h" +#include "libavutil/opt.h" +#include "libavutil/eval.h" +#include "libavutil/pixdesc.h" +#include "libavutil/parseutils.h" +#include "avfilter.h" +#include "formats.h" +#include "internal.h" +#include "video.h" + +typedef struct { +const AVClass *class; +AVFrame *prev_frame; +} TDiffContext; + +static int query_formats(AVFilterContext *ctx) +{ +static const enum AVPixelFormat pix_fmts[] = { +AV_PIX_FMT_GRAY8, AV_PIX_FMT_NONE +}; + +ff_set_common_formats(ctx, ff_make_format_list(pix_fmts)); +return 0; +} + +static int config_output(AVFilterLink *outlink) +{ +outlink->flags |= FF_LINK_FLAG_REQUEST_LOOP; +return 0; +} + +static int filter_frame(AVFilterLink *inlink, AVFrame *frame) +{ +TDiffContext *tdiff = inlink->dst->priv; +AVFilterLink *outlink = inlink->dst->outputs[0]; + +if (tdiff->prev_frame) { +int i, j; + +AVFrame *diff = ff_get_video_buffer(outlink, outlink->w, outlink->h); +av_frame_copy_props(frame, diff); +if (!diff) { +av_frame_free(&frame); +return AVERROR(ENOMEM); +} + +/* compute difference with previous frame */ +for (i = 0; i < frame->height; i++) { +uint8_t *pdiff = diff ->data[0] + i * diff ->linesize[0]; +uint8_t *pprev = tdiff->prev_frame->data[0] + i * tdiff->prev_frame->linesize[0]; +uint8_t *pthis = frame->data[0] + i * frame ->linesize[0]; +for (j = 0; j < frame->width; j++) { +
Re: [FFmpeg-devel] [PATCH] lavc/smacker: fix mem leak in case of init failure
On Sat, Nov 22, 2014 at 10:46:24PM +0100, Lukasz Marek wrote: > Signed-off-by: Lukasz Marek > --- > libavcodec/smacker.c | 1 + > 1 file changed, 1 insertion(+) LGTM thanks [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Into a blind darkness they enter who follow after the Ignorance, they as if into a greater darkness enter who devote themselves to the Knowledge alone. -- Isha Upanishad signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 1/2] lavc/libvorbisdec: fix mem leak in case of init failure
On Sat, Nov 22, 2014 at 10:46:40PM +0100, Lukasz Marek wrote: > Signed-off-by: Lukasz Marek > --- > libavcodec/libvorbisdec.c | 22 +++--- > 1 file changed, 15 insertions(+), 7 deletions(-) LGTM [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Complexity theory is the science of finding the exact solution to an approximation. Benchmarking OTOH is finding an approximation of the exact signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 2/2] lavc/libvorbisdec: use better error codes
On Sat, Nov 22, 2014 at 10:46:41PM +0100, Lukasz Marek wrote: > Signed-off-by: Lukasz Marek > --- > libavcodec/libvorbisdec.c | 8 > 1 file changed, 4 insertions(+), 4 deletions(-) LGTM [...] -- 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: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 1/2] xface: reduce table sizes.
On date Saturday 2014-11-22 23:31:58 +0100, Reimar Döffinger encoded: > Signed-off-by: Reimar Döffinger > --- > libavcodec/xface.h | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/libavcodec/xface.h b/libavcodec/xface.h > index 6fbe908..63df5d3 100644 > --- a/libavcodec/xface.h > +++ b/libavcodec/xface.h > @@ -85,8 +85,8 @@ enum XFaceColor { XFACE_COLOR_BLACK = 0, XFACE_COLOR_GREY, > XFACE_COLOR_WHITE }; > * The probability of the data determines the range of possible encodings. > * Offset gives the first possible encoding of the range. */ > typedef struct { > -int range; > -int offset; > +uint8_t range; > +uint8_t offset; > } ProbRange; LGTM. -- FFmpeg = Fiendish & Fast Mere Philosofic Everlasting Gadget ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 2/2] xface: reduce stack usage by directly storing 2 bytes data instead of pointers.
On date Saturday 2014-11-22 23:31:59 +0100, Reimar Döffinger encoded: > Signed-off-by: Reimar Döffinger > --- > libavcodec/xfaceenc.c | 8 > 1 file changed, 4 insertions(+), 4 deletions(-) > > diff --git a/libavcodec/xfaceenc.c b/libavcodec/xfaceenc.c > index 0ade302..7edef1e 100644 > --- a/libavcodec/xfaceenc.c > +++ b/libavcodec/xfaceenc.c > @@ -74,7 +74,7 @@ static int all_white(char *bitmap, int w, int h) > } > > typedef struct { > -const ProbRange *prob_ranges[XFACE_PIXELS*2]; > +ProbRange prob_ranges[XFACE_PIXELS*2]; > int prob_ranges_idx; > } ProbRangesQueue; > > @@ -82,7 +82,7 @@ static inline int pq_push(ProbRangesQueue *pq, const > ProbRange *p) > { > if (pq->prob_ranges_idx >= XFACE_PIXELS * 2 - 1) > return -1; > -pq->prob_ranges[pq->prob_ranges_idx++] = p; > +pq->prob_ranges[pq->prob_ranges_idx++] = *p; > return 0; > } > > @@ -147,7 +147,7 @@ static int xface_encode_frame(AVCodecContext *avctx, > AVPacket *pkt, >const AVFrame *frame, int *got_packet) > { > XFaceContext *xface = avctx->priv_data; > -ProbRangesQueue pq = {{ 0 }, 0}; > +ProbRangesQueue pq = {{{ 0 }}, 0}; > uint8_t bitmap_copy[XFACE_PIXELS]; > BigInt b = {0}; > int i, j, k, ret = 0; > @@ -193,7 +193,7 @@ static int xface_encode_frame(AVCodecContext *avctx, > AVPacket *pkt, > encode_block(xface->bitmap + XFACE_WIDTH * 32 + 32, 16, 16, 0, &pq); > > while (pq.prob_ranges_idx > 0) > -push_integer(&b, pq.prob_ranges[--pq.prob_ranges_idx]); > +push_integer(&b, &pq.prob_ranges[--pq.prob_ranges_idx]); > > /* write the inverted big integer in b to intbuf */ > i = 0; LGTM. -- FFmpeg = Fiendish Fundamentalist Mastodontic Practical Exuberant Gospel ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] lavc/mss1: fix mem leak in case of init failure
On Sat, Nov 22, 2014 at 10:57:05PM +0100, Lukasz Marek wrote: > Signed-off-by: Lukasz Marek > --- > libavcodec/mss1.c | 2 ++ > 1 file changed, 2 insertions(+) LGTM thx [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB I have often repented speaking, but never of holding my tongue. -- Xenocrates signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 01/10] avfilter/signalstats: fix different buffers for out frame if burn is enabled
This was the original intend. --- libavfilter/vf_signalstats.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libavfilter/vf_signalstats.c b/libavfilter/vf_signalstats.c index 47545aa..8c6a2d6 100644 --- a/libavfilter/vf_signalstats.c +++ b/libavfilter/vf_signalstats.c @@ -294,8 +294,10 @@ static int filter_frame(AVFilterLink *link, AVFrame *in) prev = s->frame_prev; -if (s->outfilter != FILTER_NONE) +if (s->outfilter != FILTER_NONE) { out = av_frame_clone(in); +av_frame_make_writable(out); +} for (fil = 0; fil < FILT_NUMB; fil ++) if ((s->filters & 1
[FFmpeg-devel] [PATCH 02/10] avfilter/signalstats: remove pointless sub filter init system
--- libavfilter/vf_signalstats.c | 57 1 file changed, 15 insertions(+), 42 deletions(-) diff --git a/libavfilter/vf_signalstats.c b/libavfilter/vf_signalstats.c index 8c6a2d6..b5b45b8 100644 --- a/libavfilter/vf_signalstats.c +++ b/libavfilter/vf_signalstats.c @@ -43,7 +43,6 @@ typedef struct { enum FilterMode outfilter; int filters; AVFrame *frame_prev; -char *vrep_line; uint8_t rgba_color[4]; int yuv_color[3]; } SignalstatsContext; @@ -88,7 +87,6 @@ static av_cold void uninit(AVFilterContext *ctx) { SignalstatsContext *s = ctx->priv; av_frame_free(&s->frame_prev); -av_freep(&s->vrep_line); } static int query_formats(AVFilterContext *ctx) @@ -124,12 +122,6 @@ static int config_props(AVFilterLink *outlink) s->fs = inlink->w * inlink->h; s->cfs = s->chromaw * s->chromah; -if (s->filters & 1h * sizeof(*s->vrep_line)); -if (!s->vrep_line) -return AVERROR(ENOMEM); -} - return 0; } @@ -209,49 +201,34 @@ filter_tout_outlier(p[(y-j) * lw + x + i], \ #define VREP_START 4 -static void filter_init_vrep(SignalstatsContext *s, const AVFrame *p, int w, int h) -{ -int i, y; -int lw = p->linesize[0]; - -for (y = VREP_START; y < h; y++) { -int totdiff = 0; -int y2lw = (y - VREP_START) * lw; -int ylw = y * lw; - -for (i = 0; i < w; i++) -totdiff += abs(p->data[0][y2lw + i] - p->data[0][ylw + i]); - -/* this value should be definable */ -s->vrep_line[y] = totdiff < w; -} -} - static int filter_vrep(SignalstatsContext *s, const AVFrame *in, AVFrame *out, int y, int w, int h) { -int x, score = 0; +const uint8_t *p = in->data[0]; +const int lw = in->linesize[0]; +int x, score, totdiff = 0; +const int y2lw = (y - VREP_START) * lw; +const int ylw = y * lw; if (y < VREP_START) return 0; -for (x = 0; x < w; x++) { -if (s->vrep_line[y]) { -score++; -if (out) -burn_frame(s, out, x, y); -} -} +for (x = 0; x < w; x++) +totdiff += abs(p[y2lw + x] - p[ylw + x]); + +score = (totdiff < w) * w; +if (score && out) +for (x = 0; x < w; x++) +burn_frame(s, out, x, y); return score; } static const struct { const char *name; -void (*init)(SignalstatsContext *s, const AVFrame *p, int w, int h); int (*process)(SignalstatsContext *s, const AVFrame *in, AVFrame *out, int y, int w, int h); } filters_def[] = { -{"TOUT", NULL, filter_tout}, -{"VREP", filter_init_vrep, filter_vrep}, -{"BRNG", NULL, filter_brng}, +{"TOUT", filter_tout}, +{"VREP", filter_vrep}, +{"BRNG", filter_brng}, {NULL} }; @@ -299,10 +276,6 @@ static int filter_frame(AVFilterLink *link, AVFrame *in) av_frame_make_writable(out); } -for (fil = 0; fil < FILT_NUMB; fil ++) -if ((s->filters & 1 h); - // Calculate luma histogram and difference with previous frame or field. for (j = 0; j < link->h; j++) { for (i = 0; i < link->w; i++) { -- 2.1.3 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 03/10] avfilter/signalstats: integrate height loop into subfilters
--- libavfilter/vf_signalstats.c | 40 +++- 1 file changed, 23 insertions(+), 17 deletions(-) diff --git a/libavfilter/vf_signalstats.c b/libavfilter/vf_signalstats.c index b5b45b8..e0ee3ee 100644 --- a/libavfilter/vf_signalstats.c +++ b/libavfilter/vf_signalstats.c @@ -134,9 +134,11 @@ static void burn_frame(SignalstatsContext *s, AVFrame *f, int x, int y) f->data[2][chromay * f->linesize[2] + chromax] = s->yuv_color[2]; } -static int filter_brng(SignalstatsContext *s, const AVFrame *in, AVFrame *out, int y, int w, int h) +static int filter_brng(SignalstatsContext *s, const AVFrame *in, AVFrame *out, int w, int h) { -int x, score = 0; +int x, y, score = 0; + +for (y = 0; y < h; y++) { const int yc = y >> s->vsub; const uint8_t *pluma= &in->data[0][y * in->linesize[0]]; const uint8_t *pchromau = &in->data[1][yc * in->linesize[1]]; @@ -154,6 +156,7 @@ static int filter_brng(SignalstatsContext *s, const AVFrame *in, AVFrame *out, i if (out && filt) burn_frame(s, out, x, y); } +} return score; } @@ -162,14 +165,16 @@ static int filter_tout_outlier(uint8_t x, uint8_t y, uint8_t z) return ((abs(x - y) + abs (z - y)) / 2) - abs(z - x) > 4; // make 4 configurable? } -static int filter_tout(SignalstatsContext *s, const AVFrame *in, AVFrame *out, int y, int w, int h) +static int filter_tout(SignalstatsContext *s, const AVFrame *in, AVFrame *out, int w, int h) { const uint8_t *p = in->data[0]; int lw = in->linesize[0]; -int x, score = 0, filt; +int x, y, score = 0, filt; + +for (y = 0; y < h; y++) { if (y - 1 < 0 || y + 1 >= h) -return 0; +continue; // detect two pixels above and below (to eliminate interlace artefacts) // should check that video format is infact interlaced. @@ -196,35 +201,38 @@ filter_tout_outlier(p[(y-j) * lw + x + i], \ burn_frame(s, out, x, y); } } +} return score; } #define VREP_START 4 -static int filter_vrep(SignalstatsContext *s, const AVFrame *in, AVFrame *out, int y, int w, int h) +static int filter_vrep(SignalstatsContext *s, const AVFrame *in, AVFrame *out, int w, int h) { const uint8_t *p = in->data[0]; const int lw = in->linesize[0]; -int x, score, totdiff = 0; +int x, y, score = 0; + +for (y = VREP_START; y < h; y++) { const int y2lw = (y - VREP_START) * lw; const int ylw = y * lw; - -if (y < VREP_START) -return 0; +int filt, totdiff = 0; for (x = 0; x < w; x++) totdiff += abs(p[y2lw + x] - p[ylw + x]); +filt = totdiff < w; -score = (totdiff < w) * w; -if (score && out) +score += filt; +if (filt && out) for (x = 0; x < w; x++) burn_frame(s, out, x, y); -return score; +} +return score * w; } static const struct { const char *name; -int (*process)(SignalstatsContext *s, const AVFrame *in, AVFrame *out, int y, int w, int h); +int (*process)(SignalstatsContext *s, const AVFrame *in, AVFrame *out, int w, int h); } filters_def[] = { {"TOUT", filter_tout}, {"VREP", filter_vrep}, @@ -309,14 +317,12 @@ static int filter_frame(AVFilterLink *link, AVFrame *in) cpw += prev->linesize[1]; } -for (j = 0; j < link->h; j++) { for (fil = 0; fil < FILT_NUMB; fil ++) { if (s->filters & 1w, link->h); +filtot[fil] = filters_def[fil].process(s, in, dbg, link->w, link->h); } } -} // find low / high based on histogram percentile // these only need to be calculated once. -- 2.1.3 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 06/10] avfilter/signalstats: add slice threading for subfilters
--- libavfilter/vf_signalstats.c | 72 1 file changed, 60 insertions(+), 12 deletions(-) diff --git a/libavfilter/vf_signalstats.c b/libavfilter/vf_signalstats.c index 5983e61..960e98a 100644 --- a/libavfilter/vf_signalstats.c +++ b/libavfilter/vf_signalstats.c @@ -45,8 +45,15 @@ typedef struct { AVFrame *frame_prev; uint8_t rgba_color[4]; int yuv_color[3]; +int nb_jobs; +int *jobs_rets; } SignalstatsContext; +typedef struct ThreadData { +const AVFrame *in; +AVFrame *out; +} ThreadData; + #define OFFSET(x) offsetof(SignalstatsContext, x) #define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM @@ -87,6 +94,7 @@ static av_cold void uninit(AVFilterContext *ctx) { SignalstatsContext *s = ctx->priv; av_frame_free(&s->frame_prev); +av_freep(&s->jobs_rets); } static int query_formats(AVFilterContext *ctx) @@ -122,10 +130,14 @@ static int config_props(AVFilterLink *outlink) s->fs = inlink->w * inlink->h; s->cfs = s->chromaw * s->chromah; +s->nb_jobs = FFMAX(1, FFMIN(inlink->h, ctx->graph->nb_threads)); +s->jobs_rets = av_malloc_array(s->nb_jobs, sizeof(*s->jobs_rets)); +if (!s->jobs_rets) +return AVERROR(ENOMEM); return 0; } -static void burn_frame(SignalstatsContext *s, AVFrame *f, int x, int y) +static void burn_frame(const SignalstatsContext *s, AVFrame *f, int x, int y) { const int chromax = x >> s->hsub; const int chromay = y >> s->vsub; @@ -134,11 +146,19 @@ static void burn_frame(SignalstatsContext *s, AVFrame *f, int x, int y) f->data[2][chromay * f->linesize[2] + chromax] = s->yuv_color[2]; } -static int filter_brng(SignalstatsContext *s, const AVFrame *in, AVFrame *out, int w, int h) +static int filter_brng(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs) { +ThreadData *td = arg; +const SignalstatsContext *s = ctx->priv; +const AVFrame *in = td->in; +AVFrame *out = td->out; +const int w = in->width; +const int h = in->height; +const int slice_start = (h * jobnr ) / nb_jobs; +const int slice_end = (h * (jobnr+1)) / nb_jobs; int x, y, score = 0; -for (y = 0; y < h; y++) { +for (y = slice_start; y < slice_end; y++) { const int yc = y >> s->vsub; const uint8_t *pluma= &in->data[0][y * in->linesize[0]]; const uint8_t *pchromau = &in->data[1][yc * in->linesize[1]]; @@ -165,13 +185,21 @@ static int filter_tout_outlier(uint8_t x, uint8_t y, uint8_t z) return ((abs(x - y) + abs (z - y)) / 2) - abs(z - x) > 4; // make 4 configurable? } -static int filter_tout(SignalstatsContext *s, const AVFrame *in, AVFrame *out, int w, int h) +static int filter_tout(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs) { +ThreadData *td = arg; +const SignalstatsContext *s = ctx->priv; +const AVFrame *in = td->in; +AVFrame *out = td->out; +const int w = in->width; +const int h = in->height; +const int slice_start = (h * jobnr ) / nb_jobs; +const int slice_end = (h * (jobnr+1)) / nb_jobs; const uint8_t *p = in->data[0]; int lw = in->linesize[0]; int x, y, score = 0, filt; -for (y = 0; y < h; y++) { +for (y = slice_start; y < slice_end; y++) { if (y - 1 < 0 || y + 1 >= h) continue; @@ -207,17 +235,28 @@ static int filter_tout(SignalstatsContext *s, const AVFrame *in, AVFrame *out, i #define VREP_START 4 -static int filter_vrep(SignalstatsContext *s, const AVFrame *in, AVFrame *out, int w, int h) +static int filter_vrep(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs) { +ThreadData *td = arg; +const SignalstatsContext *s = ctx->priv; +const AVFrame *in = td->in; +AVFrame *out = td->out; +const int w = in->width; +const int h = in->height; +const int slice_start = (h * jobnr ) / nb_jobs; +const int slice_end = (h * (jobnr+1)) / nb_jobs; const uint8_t *p = in->data[0]; const int lw = in->linesize[0]; int x, y, score = 0; -for (y = VREP_START; y < h; y++) { +for (y = slice_start; y < slice_end; y++) { const int y2lw = (y - VREP_START) * lw; const int ylw = y * lw; int filt, totdiff = 0; +if (y < VREP_START) +continue; + for (x = 0; x < w; x++) totdiff += abs(p[y2lw + x] - p[ylw + x]); filt = totdiff < w; @@ -232,7 +271,7 @@ static int filter_vrep(SignalstatsContext *s, const AVFrame *in, AVFrame *out, i static const struct { const char *name; -int (*process)(SignalstatsContext *s, const AVFrame *in, AVFrame *out, int w, int h); +int (*process)(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs); } filters_def[] = { {"TOUT", filter_tout}, {"VREP", filter_vrep}, @@ -244,8 +283,9 @@ static const struct { static int filter_frame(AVFilterLink *link, AVFrame *in) { -
[FFmpeg-devel] [PATCH 04/10] avfilter/signalstats: reindent after previous commit
--- libavfilter/vf_signalstats.c | 106 +-- 1 file changed, 53 insertions(+), 53 deletions(-) diff --git a/libavfilter/vf_signalstats.c b/libavfilter/vf_signalstats.c index e0ee3ee..d6d9c3e 100644 --- a/libavfilter/vf_signalstats.c +++ b/libavfilter/vf_signalstats.c @@ -139,23 +139,23 @@ static int filter_brng(SignalstatsContext *s, const AVFrame *in, AVFrame *out, i int x, y, score = 0; for (y = 0; y < h; y++) { -const int yc = y >> s->vsub; -const uint8_t *pluma= &in->data[0][y * in->linesize[0]]; -const uint8_t *pchromau = &in->data[1][yc * in->linesize[1]]; -const uint8_t *pchromav = &in->data[2][yc * in->linesize[2]]; - -for (x = 0; x < w; x++) { -const int xc = x >> s->hsub; -const int luma= pluma[x]; -const int chromau = pchromau[xc]; -const int chromav = pchromav[xc]; -const int filt = luma< 16 || luma> 235 || - chromau < 16 || chromau > 240 || - chromav < 16 || chromav > 240; -score += filt; -if (out && filt) -burn_frame(s, out, x, y); -} +const int yc = y >> s->vsub; +const uint8_t *pluma= &in->data[0][y * in->linesize[0]]; +const uint8_t *pchromau = &in->data[1][yc * in->linesize[1]]; +const uint8_t *pchromav = &in->data[2][yc * in->linesize[2]]; + +for (x = 0; x < w; x++) { +const int xc = x >> s->hsub; +const int luma= pluma[x]; +const int chromau = pchromau[xc]; +const int chromav = pchromav[xc]; +const int filt = luma< 16 || luma> 235 || +chromau < 16 || chromau > 240 || +chromav < 16 || chromav > 240; +score += filt; +if (out && filt) +burn_frame(s, out, x, y); +} } return score; } @@ -173,35 +173,35 @@ static int filter_tout(SignalstatsContext *s, const AVFrame *in, AVFrame *out, i for (y = 0; y < h; y++) { -if (y - 1 < 0 || y + 1 >= h) -continue; +if (y - 1 < 0 || y + 1 >= h) +continue; -// detect two pixels above and below (to eliminate interlace artefacts) -// should check that video format is infact interlaced. +// detect two pixels above and below (to eliminate interlace artefacts) +// should check that video format is infact interlaced. #define FILTER(i, j) \ -filter_tout_outlier(p[(y-j) * lw + x + i], \ -p[y * lw + x + i], \ -p[(y+j) * lw + x + i]) +filter_tout_outlier(p[(y-j) * lw + x + i], \ +p[y * lw + x + i], \ +p[(y+j) * lw + x + i]) #define FILTER3(j) (FILTER(-1, j) && FILTER(0, j) && FILTER(1, j)) -if (y - 2 >= 0 && y + 2 < h) { -for (x = 1; x < w - 1; x++) { -filt = FILTER3(2) && FILTER3(1); -score += filt; -if (filt && out) -burn_frame(s, out, x, y); -} -} else { -for (x = 1; x < w - 1; x++) { -filt = FILTER3(1); -score += filt; -if (filt && out) -burn_frame(s, out, x, y); +if (y - 2 >= 0 && y + 2 < h) { +for (x = 1; x < w - 1; x++) { +filt = FILTER3(2) && FILTER3(1); +score += filt; +if (filt && out) +burn_frame(s, out, x, y); +} +} else { +for (x = 1; x < w - 1; x++) { +filt = FILTER3(1); +score += filt; +if (filt && out) +burn_frame(s, out, x, y); +} } } -} return score; } @@ -214,18 +214,18 @@ static int filter_vrep(SignalstatsContext *s, const AVFrame *in, AVFrame *out, i int x, y, score = 0; for (y = VREP_START; y < h; y++) { -const int y2lw = (y - VREP_START) * lw; -const int ylw = y * lw; -int filt, totdiff = 0; - -for (x = 0; x < w; x++) -totdiff += abs(p[y2lw + x] - p[ylw + x]); -filt = totdiff < w; +const int y2lw = (y - VREP_START) * lw; +const int ylw = y * lw; +int filt, totdiff = 0; -score += filt; -if (filt && out) for (x = 0; x < w; x++) -burn_frame(s, out, x, y); +totdiff += abs(p[y2lw + x] - p[ylw + x]); +filt = totdiff < w; + +score += filt; +if (filt && out) +for (x = 0; x < w; x++) +burn_frame(s, out, x, y); } return score * w; } @@ -317,12 +317,12 @@ static int filter_frame(AVFilterLink *link, AVFrame *in) cpw += prev->linesize[1]; } -for (fil = 0; fil < FILT_NUMB; fil ++) { -if (s->filters & 1
[FFmpeg-devel] [PATCH 07/10] avfilter/signalstats: isolate sat hue computation metrics in a function
This will be useful for the following commit --- libavfilter/vf_signalstats.c | 77 1 file changed, 70 insertions(+), 7 deletions(-) diff --git a/libavfilter/vf_signalstats.c b/libavfilter/vf_signalstats.c index 960e98a..0403a6d 100644 --- a/libavfilter/vf_signalstats.c +++ b/libavfilter/vf_signalstats.c @@ -47,6 +47,9 @@ typedef struct { int yuv_color[3]; int nb_jobs; int *jobs_rets; + +AVFrame *frame_sat; +AVFrame *frame_hue; } SignalstatsContext; typedef struct ThreadData { @@ -94,6 +97,8 @@ static av_cold void uninit(AVFilterContext *ctx) { SignalstatsContext *s = ctx->priv; av_frame_free(&s->frame_prev); +av_frame_free(&s->frame_sat); +av_frame_free(&s->frame_hue); av_freep(&s->jobs_rets); } @@ -112,6 +117,22 @@ static int query_formats(AVFilterContext *ctx) return 0; } +static AVFrame *alloc_frame(enum AVPixelFormat pixfmt, int w, int h) +{ +AVFrame *frame = av_frame_alloc(); +if (!frame) +return NULL; + +frame->format = pixfmt; +frame->width = w; +frame->height = h; + +if (av_frame_get_buffer(frame, 32) < 0) +return NULL; + +return frame; +} + static int config_props(AVFilterLink *outlink) { AVFilterContext *ctx = outlink->src; @@ -134,6 +155,12 @@ static int config_props(AVFilterLink *outlink) s->jobs_rets = av_malloc_array(s->nb_jobs, sizeof(*s->jobs_rets)); if (!s->jobs_rets) return AVERROR(ENOMEM); + +s->frame_sat = alloc_frame(AV_PIX_FMT_GRAY8, inlink->w, inlink->h); +s->frame_hue = alloc_frame(AV_PIX_FMT_GRAY16, inlink->w, inlink->h); +if (!s->frame_sat || !s->frame_hue) +return AVERROR(ENOMEM); + return 0; } @@ -281,6 +308,36 @@ static const struct { #define DEPTH 256 +static void compute_sat_hue_metrics(const SignalstatsContext *s, +const AVFrame *src, +AVFrame *dst_sat, AVFrame *dst_hue) +{ +int i, j; + +const uint8_t *p_u = src->data[1]; +const uint8_t *p_v = src->data[2]; +const int lsz_u = src->linesize[1]; +const int lsz_v = src->linesize[2]; + +uint8_t *p_sat = dst_sat->data[0]; +uint8_t *p_hue = dst_hue->data[0]; +const int lsz_sat = dst_sat->linesize[0]; +const int lsz_hue = dst_hue->linesize[0]; + +for (j = 0; j < s->chromah; j++) { +for (i = 0; i < s->chromaw; i++) { +const int yuvu = p_u[i]; +const int yuvv = p_v[i]; +p_sat[i] = hypot(yuvu - 128, yuvv - 128); // int or round? +((int16_t*)p_hue)[i] = floor((180 / M_PI) * atan2f(yuvu-128, yuvv-128) + 180); +} +p_u += lsz_u; +p_v += lsz_v; +p_sat += lsz_sat; +p_hue += lsz_hue; +} +} + static int filter_frame(AVFilterLink *link, AVFrame *in) { AVFilterContext *ctx = link->dst; @@ -314,6 +371,13 @@ static int filter_frame(AVFilterLink *link, AVFrame *in) int filtot[FILT_NUMB] = {0}; AVFrame *prev; +AVFrame *sat = s->frame_sat; +AVFrame *hue = s->frame_hue; +const uint8_t *p_sat = sat->data[0]; +const uint8_t *p_hue = hue->data[0]; +const int lsz_sat = sat->linesize[0]; +const int lsz_hue = hue->linesize[0]; + if (!s->frame_prev) s->frame_prev = av_frame_clone(in); @@ -324,6 +388,8 @@ static int filter_frame(AVFilterLink *link, AVFrame *in) av_frame_make_writable(out); } +compute_sat_hue_metrics(s, in, sat, hue); + // Calculate luma histogram and difference with previous frame or field. for (j = 0; j < link->h; j++) { for (i = 0; i < link->w; i++) { @@ -338,8 +404,6 @@ static int filter_frame(AVFilterLink *link, AVFrame *in) // Calculate chroma histogram and difference with previous frame or field. for (j = 0; j < s->chromah; j++) { for (i = 0; i < s->chromaw; i++) { -int sat, hue; - yuvu = in->data[1][cw+i]; yuvv = in->data[2][cw+i]; histu[yuvu]++; @@ -347,14 +411,13 @@ static int filter_frame(AVFilterLink *link, AVFrame *in) histv[yuvv]++; difv += abs(in->data[2][cw+i] - prev->data[2][cpw+i]); -// int or round? -sat = hypot(yuvu - 128, yuvv - 128); -histsat[sat]++; -hue = floor((180 / M_PI) * atan2f(yuvu-128, yuvv-128) + 180); -histhue[hue]++; +histsat[p_sat[i]]++; +histhue[((int16_t*)p_hue)[i]]++; } cw += in->linesize[1]; cpw += prev->linesize[1]; +p_sat += lsz_sat; +p_hue += lsz_hue; } for (fil = 0; fil < FILT_NUMB; fil ++) { -- 2.1.3 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 08/10] avfilter/signalstats: add threading in compute_sat_hue_metrics
--- libavfilter/vf_signalstats.c | 37 - 1 file changed, 28 insertions(+), 9 deletions(-) diff --git a/libavfilter/vf_signalstats.c b/libavfilter/vf_signalstats.c index 0403a6d..014b87d 100644 --- a/libavfilter/vf_signalstats.c +++ b/libavfilter/vf_signalstats.c @@ -57,6 +57,11 @@ typedef struct ThreadData { AVFrame *out; } ThreadData; +typedef struct ThreadDataHueSatMetrics { +const AVFrame *src; +AVFrame *dst_sat, *dst_hue; +} ThreadDataHueSatMetrics; + #define OFFSET(x) offsetof(SignalstatsContext, x) #define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM @@ -308,23 +313,29 @@ static const struct { #define DEPTH 256 -static void compute_sat_hue_metrics(const SignalstatsContext *s, -const AVFrame *src, -AVFrame *dst_sat, AVFrame *dst_hue) +static int compute_sat_hue_metrics(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs) { int i, j; +ThreadDataHueSatMetrics *td = arg; +const SignalstatsContext *s = ctx->priv; +const AVFrame *src = td->src; +AVFrame *dst_sat = td->dst_sat; +AVFrame *dst_hue = td->dst_hue; + +const int slice_start = (s->chromah * jobnr ) / nb_jobs; +const int slice_end = (s->chromah * (jobnr+1)) / nb_jobs; -const uint8_t *p_u = src->data[1]; -const uint8_t *p_v = src->data[2]; const int lsz_u = src->linesize[1]; const int lsz_v = src->linesize[2]; +const uint8_t *p_u = src->data[1] + slice_start * lsz_u; +const uint8_t *p_v = src->data[2] + slice_start * lsz_v; -uint8_t *p_sat = dst_sat->data[0]; -uint8_t *p_hue = dst_hue->data[0]; const int lsz_sat = dst_sat->linesize[0]; const int lsz_hue = dst_hue->linesize[0]; +uint8_t *p_sat = dst_sat->data[0] + slice_start * lsz_sat; +uint8_t *p_hue = dst_hue->data[0] + slice_start * lsz_hue; -for (j = 0; j < s->chromah; j++) { +for (j = slice_start; j < slice_end; j++) { for (i = 0; i < s->chromaw; i++) { const int yuvu = p_u[i]; const int yuvv = p_v[i]; @@ -336,6 +347,8 @@ static void compute_sat_hue_metrics(const SignalstatsContext *s, p_sat += lsz_sat; p_hue += lsz_hue; } + +return 0; } static int filter_frame(AVFilterLink *link, AVFrame *in) @@ -377,6 +390,11 @@ static int filter_frame(AVFilterLink *link, AVFrame *in) const uint8_t *p_hue = hue->data[0]; const int lsz_sat = sat->linesize[0]; const int lsz_hue = hue->linesize[0]; +ThreadDataHueSatMetrics td_huesat = { +.src = in, +.dst_sat = sat, +.dst_hue = hue, +}; if (!s->frame_prev) s->frame_prev = av_frame_clone(in); @@ -388,7 +406,8 @@ static int filter_frame(AVFilterLink *link, AVFrame *in) av_frame_make_writable(out); } -compute_sat_hue_metrics(s, in, sat, hue); +ctx->internal->execute(ctx, compute_sat_hue_metrics, &td_huesat, + NULL, FFMIN(s->chromah, ctx->graph->nb_threads)); // Calculate luma histogram and difference with previous frame or field. for (j = 0; j < link->h; j++) { -- 2.1.3 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 05/10] avfilter/signalstats: fix repitition/repetition typo
--- libavfilter/vf_signalstats.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavfilter/vf_signalstats.c b/libavfilter/vf_signalstats.c index d6d9c3e..5983e61 100644 --- a/libavfilter/vf_signalstats.c +++ b/libavfilter/vf_signalstats.c @@ -53,11 +53,11 @@ typedef struct { static const AVOption signalstats_options[] = { {"stat", "set statistics filters", OFFSET(filters), AV_OPT_TYPE_FLAGS, {.i64=0}, 0, INT_MAX, FLAGS, "filters"}, {"tout", "analyze pixels for temporal outliers",0, AV_OPT_TYPE_CONST, {.i64=1
[FFmpeg-devel] [PATCH 09/10] avfilter/signalstats: localize a few variables
--- libavfilter/vf_signalstats.c | 7 +++ 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/libavfilter/vf_signalstats.c b/libavfilter/vf_signalstats.c index 014b87d..3ef689f 100644 --- a/libavfilter/vf_signalstats.c +++ b/libavfilter/vf_signalstats.c @@ -360,7 +360,6 @@ static int filter_frame(AVFilterLink *link, AVFrame *in) int i, j; int w = 0, cw = 0, // in pw = 0, cpw = 0; // prev -int yuv, yuvu, yuvv; int fil; char metabuf[128]; unsigned int histy[DEPTH] = {0}, @@ -412,7 +411,7 @@ static int filter_frame(AVFilterLink *link, AVFrame *in) // Calculate luma histogram and difference with previous frame or field. for (j = 0; j < link->h; j++) { for (i = 0; i < link->w; i++) { -yuv = in->data[0][w + i]; +const int yuv = in->data[0][w + i]; histy[yuv]++; dify += abs(in->data[0][w + i] - prev->data[0][pw + i]); } @@ -423,8 +422,8 @@ static int filter_frame(AVFilterLink *link, AVFrame *in) // Calculate chroma histogram and difference with previous frame or field. for (j = 0; j < s->chromah; j++) { for (i = 0; i < s->chromaw; i++) { -yuvu = in->data[1][cw+i]; -yuvv = in->data[2][cw+i]; +const int yuvu = in->data[1][cw+i]; +const int yuvv = in->data[2][cw+i]; histu[yuvu]++; difu += abs(in->data[1][cw+i] - prev->data[1][cpw+i]); histv[yuvv]++; -- 2.1.3 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 10/10] avfilter/signalstats: re-use yuv/yuvu/yuvv vars in diff
--- libavfilter/vf_signalstats.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libavfilter/vf_signalstats.c b/libavfilter/vf_signalstats.c index 3ef689f..4b2792f 100644 --- a/libavfilter/vf_signalstats.c +++ b/libavfilter/vf_signalstats.c @@ -413,7 +413,7 @@ static int filter_frame(AVFilterLink *link, AVFrame *in) for (i = 0; i < link->w; i++) { const int yuv = in->data[0][w + i]; histy[yuv]++; -dify += abs(in->data[0][w + i] - prev->data[0][pw + i]); +dify += abs(yuv - prev->data[0][pw + i]); } w += in->linesize[0]; pw += prev->linesize[0]; @@ -425,9 +425,9 @@ static int filter_frame(AVFilterLink *link, AVFrame *in) const int yuvu = in->data[1][cw+i]; const int yuvv = in->data[2][cw+i]; histu[yuvu]++; -difu += abs(in->data[1][cw+i] - prev->data[1][cpw+i]); +difu += abs(yuvu - prev->data[1][cpw+i]); histv[yuvv]++; -difv += abs(in->data[2][cw+i] - prev->data[2][cpw+i]); +difv += abs(yuvv - prev->data[2][cpw+i]); histsat[p_sat[i]]++; histhue[((int16_t*)p_hue)[i]]++; -- 2.1.3 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] xface: Fix encoder crashes due to too small on-stack array.
On date Saturday 2014-11-22 23:14:45 +0100, Reimar Döffinger encoded: > Also add a FATE test. > > Signed-off-by: Reimar Döffinger > --- > libavcodec/xface.h | 9 + > libavcodec/xfaceenc.c | 3 +++ > libavformat/nut.c | 1 + > tests/fate/vcodec.mak | 5 + > tests/ref/vsynth/vsynth1-xface | 4 > tests/ref/vsynth/vsynth2-xface | 4 > tests/ref/vsynth/vsynth3-xface | 4 > 7 files changed, 26 insertions(+), 4 deletions(-) > create mode 100644 tests/ref/vsynth/vsynth1-xface > create mode 100644 tests/ref/vsynth/vsynth2-xface > create mode 100644 tests/ref/vsynth/vsynth3-xface > > diff --git a/libavcodec/xface.h b/libavcodec/xface.h > index cd59ba0..6fbe908 100644 > --- a/libavcodec/xface.h > +++ b/libavcodec/xface.h > @@ -40,11 +40,12 @@ > > /* > * Image is encoded as a big integer, using characters from '~' to > - * '!', for a total of 92 symbols. In order to express 48x48=2304 > - * bits, we need a total of 354 digits, as given by: > - * ceil(lg_92(2^2304)) = 354 > + * '!', for a total of 94 symbols. In order to express > + * 48x48*2=8*XFACE_MAX_WORDS=4608 > + * bits, we need a total of 704 digits, as given by: > + * ceil(lg_94(2^4608)) = 704 > */ > -#define XFACE_MAX_DIGITS 354 > +#define XFACE_MAX_DIGITS 704 > > #define XFACE_BITSPERWORD 8 > #define XFACE_WORDCARRY (1 << XFACE_BITSPERWORD) > diff --git a/libavcodec/xfaceenc.c b/libavcodec/xfaceenc.c > index e213c9d..0ade302 100644 > --- a/libavcodec/xfaceenc.c > +++ b/libavcodec/xfaceenc.c > @@ -27,6 +27,7 @@ > #include "xface.h" > #include "avcodec.h" > #include "internal.h" > +#include "libavutil/avassert.h" > > typedef struct XFaceContext { > AVClass *class; > @@ -196,9 +197,11 @@ static int xface_encode_frame(AVCodecContext *avctx, > AVPacket *pkt, > > /* write the inverted big integer in b to intbuf */ > i = 0; > +av_assert0(b.nb_words < XFACE_MAX_WORDS); > while (b.nb_words) { > uint8_t r; > ff_big_div(&b, XFACE_PRINTS, &r); > +av_assert0(i < sizeof(intbuf)); > intbuf[i++] = r + XFACE_FIRST_PRINT; > } > > diff --git a/libavformat/nut.c b/libavformat/nut.c > index 9224a96..86a0301 100644 > --- a/libavformat/nut.c > +++ b/libavformat/nut.c > @@ -40,6 +40,7 @@ const AVCodecTag ff_nut_data_tags[] = { > }; > > const AVCodecTag ff_nut_video_tags[] = { > +{ AV_CODEC_ID_XFACE,MKTAG('X', 'F', 'A', 'C') }, > { AV_CODEC_ID_VP9, MKTAG('V', 'P', '9', '0') }, > { AV_CODEC_ID_RAWVIDEO, MKTAG('R', 'G', 'B', 15 ) }, > { AV_CODEC_ID_RAWVIDEO, MKTAG('B', 'G', 'R', 15 ) }, > diff --git a/tests/fate/vcodec.mak b/tests/fate/vcodec.mak > index c715071..803edec 100644 > --- a/tests/fate/vcodec.mak > +++ b/tests/fate/vcodec.mak > @@ -294,6 +294,11 @@ fate-vsynth%-wmv2: ENCOPTS = -qscale 10 > FATE_VCODEC-$(call ENCDEC, RAWVIDEO, AVI) += yuv > fate-vsynth%-yuv:CODEC = rawvideo > > +FATE_VCODEC-$(call ENCDEC, XFACE, NUT) += xface > +fate-vsynth%-xface: ENCOPTS = -s 48x48 -sws_flags > neighbor+bitexact > +fate-vsynth%-xface: DECOPTS = -sws_flags neighbor+bitexact > +fate-vsynth%-xface: FMT = nut > + > FATE_VCODEC-$(call ENCDEC, YUV4, AVI) += yuv4 > > FATE_VCODEC-$(call ENCDEC, Y41P, AVI) += y41p > diff --git a/tests/ref/vsynth/vsynth1-xface b/tests/ref/vsynth/vsynth1-xface > new file mode 100644 > index 000..3b916c6 > --- /dev/null > +++ b/tests/ref/vsynth/vsynth1-xface > @@ -0,0 +1,4 @@ > +487c3e53249f7b9f16e04257295998de *tests/data/fate/vsynth1-xface.nut > +19746 tests/data/fate/vsynth1-xface.nut > +42d8261bb538b8789840ac085f7fc4d2 *tests/data/fate/vsynth1-xface.out.rawvideo > +stddev: 103.88 PSNR: 7.80 MAXDIFF: 254 bytes: 7603200/ 7603200 > diff --git a/tests/ref/vsynth/vsynth2-xface b/tests/ref/vsynth/vsynth2-xface > new file mode 100644 > index 000..5f60d66 > --- /dev/null > +++ b/tests/ref/vsynth/vsynth2-xface > @@ -0,0 +1,4 @@ > +6a1a7b467eeab2795510e7dd1ca528ff *tests/data/fate/vsynth2-xface.nut > +17504 tests/data/fate/vsynth2-xface.nut > +6d87881d630439d02c7a97f468d67a1c *tests/data/fate/vsynth2-xface.out.rawvideo > +stddev: 99.01 PSNR: 8.22 MAXDIFF: 238 bytes: 7603200/ 7603200 > diff --git a/tests/ref/vsynth/vsynth3-xface b/tests/ref/vsynth/vsynth3-xface > new file mode 100644 > index 000..f98a5c5 > --- /dev/null > +++ b/tests/ref/vsynth/vsynth3-xface > @@ -0,0 +1,4 @@ > +f399a6b312d0a2d873b8a3bc761c5eba *tests/data/fate/vsynth3-xface.nut > +15696 tests/data/fate/vsynth3-xface.nut > +eafdc027c9c36f96e71e91a5682a0d2e *tests/data/fate/vsynth3-xface.out.rawvideo > +stddev: 97.22 PSNR: 8.37 MAXDIFF: 236 bytes:86700/86700 LGTM, thanks. -- FFmpeg = Fiendish & Frenzy Minimal Picky Enhancing Generator ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-deve
Re: [FFmpeg-devel] [PATCH] libavcodec/rv30: fix mem leak in case of init failure
On Sat, Nov 22, 2014 at 11:12:53PM +0100, Lukasz Marek wrote: > Also replaced return -1 with return AVERROR(EINVAL) > > Signed-off-by: Lukasz Marek > --- > libavcodec/rv30.c | 8 > 1 file changed, 4 insertions(+), 4 deletions(-) LGTM thx [...] -- 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: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 1/2] lavu/opt: handle NULL obj in av_opt_next
It indirectly also fixes av_opt_free for NULL objs. Signed-off-by: Lukasz Marek --- libavutil/opt.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavutil/opt.c b/libavutil/opt.c index 47b1f0c..85330c9 100644 --- a/libavutil/opt.c +++ b/libavutil/opt.c @@ -50,6 +50,8 @@ const AVOption *av_next_option(void *obj, const AVOption *last) const AVOption *av_opt_next(void *obj, const AVOption *last) { +if (!obj) +return NULL; AVClass *class = *(AVClass**)obj; if (!last && class && class->option && class->option[0].name) return class->option; -- 1.9.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] lavu/opt: add const to av_opt_copy arg
Signed-off-by: Lukasz Marek --- libavutil/opt.c | 2 +- libavutil/opt.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libavutil/opt.c b/libavutil/opt.c index 0546a37..47b1f0c 100644 --- a/libavutil/opt.c +++ b/libavutil/opt.c @@ -1570,7 +1570,7 @@ static int opt_size(enum AVOptionType type) return 0; } -int av_opt_copy(void *dst, void *src) +int av_opt_copy(void *dst, FF_CONST_AVUTIL53 void *src) { const AVOption *o = NULL; const AVClass *c; diff --git a/libavutil/opt.h b/libavutil/opt.h index 7338e78..6b6c996 100644 --- a/libavutil/opt.h +++ b/libavutil/opt.h @@ -825,7 +825,7 @@ int av_opt_query_ranges(AVOptionRanges **, void *obj, const char *key, int flags * @param src Object to copy into * @return 0 on success, negative on error */ -int av_opt_copy(void *dest, void *src); +int av_opt_copy(void *dest, FF_CONST_AVUTIL53 void *src); /** * Get a default list of allowed ranges for the given option. -- 1.9.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] lavc/huffyuvdec: fix mem leak in case of init failure
Signed-off-by: Lukasz Marek --- libavcodec/huffyuvdec.c | 24 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/libavcodec/huffyuvdec.c b/libavcodec/huffyuvdec.c index 3b2b0f7..5535323 100644 --- a/libavcodec/huffyuvdec.c +++ b/libavcodec/huffyuvdec.c @@ -275,7 +275,7 @@ static int read_old_huffman_tables(HYuvContext *s) static av_cold int decode_init(AVCodecContext *avctx) { HYuvContext *s = avctx->priv_data; -int ret; +int ret, i; ff_huffyuvdsp_init(&s->hdsp); memset(s->vlc, 0, 4 * sizeof(VLC)); @@ -327,7 +327,7 @@ static av_cold int decode_init(AVCodecContext *avctx) if ((ret = read_huffman_tables(s, avctx->extradata + 4, avctx->extradata_size - 4)) < 0) -return ret; +goto error; } else { switch (avctx->bits_per_coded_sample & 7) { case 1: @@ -355,7 +355,7 @@ static av_cold int decode_init(AVCodecContext *avctx) s->context = 0; if ((ret = read_old_huffman_tables(s)) < 0) -return ret; +goto error; } if (s->version <= 2) { @@ -383,7 +383,8 @@ static av_cold int decode_init(AVCodecContext *avctx) s->alpha = 1; break; default: -return AVERROR_INVALIDDATA; +ret = AVERROR_INVALIDDATA; +goto error; } av_pix_fmt_get_chroma_sub_sample(avctx->pix_fmt, &s->chroma_h_shift, @@ -520,7 +521,8 @@ static av_cold int decode_init(AVCodecContext *avctx) avctx->pix_fmt = AV_PIX_FMT_YUVA420P16; break; default: -return AVERROR_INVALIDDATA; +ret = AVERROR_INVALIDDATA; +goto error; } } @@ -528,21 +530,27 @@ static av_cold int decode_init(AVCodecContext *avctx) if ((avctx->pix_fmt == AV_PIX_FMT_YUV422P || avctx->pix_fmt == AV_PIX_FMT_YUV420P) && avctx->width & 1) { av_log(avctx, AV_LOG_ERROR, "width must be even for this colorspace\n"); -return AVERROR_INVALIDDATA; +ret = AVERROR_INVALIDDATA; +goto error; } if (s->predictor == MEDIAN && avctx->pix_fmt == AV_PIX_FMT_YUV422P && avctx->width % 4) { av_log(avctx, AV_LOG_ERROR, "width must be a multiple of 4 " "for this combination of colorspace and predictor type.\n"); -return AVERROR_INVALIDDATA; +ret = AVERROR_INVALIDDATA; +goto error; } if ((ret = ff_huffyuv_alloc_temp(s)) < 0) { ff_huffyuv_common_end(s); -return ret; +goto error; } return 0; + error: +for (i = 0; i < 8; i++) +ff_free_vlc(&s->vlc[i]); +return ret; } static av_cold int decode_init_thread_copy(AVCodecContext *avctx) -- 1.9.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 2/2] lavc/utils: free private options on avcodec_open2 fail
It protects leaking string/binary/dict options from priv context. Signed-off-by: Lukasz Marek --- libavcodec/utils.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavcodec/utils.c b/libavcodec/utils.c index bf2a5b9..7e37b82 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -1690,6 +1690,8 @@ end: return ret; free_and_end: av_dict_free(&tmp); +if (codec->priv_class && codec->priv_data_size) +av_opt_free(avctx->priv_data); av_freep(&avctx->priv_data); if (avctx->internal) { av_frame_free(&avctx->internal->to_free); -- 1.9.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 1/2] lavu/opt: handle NULL obj in av_opt_next
On Sun, Nov 23, 2014 at 12:58:06AM +0100, Lukasz Marek wrote: > It indirectly also fixes av_opt_free for NULL objs. > > Signed-off-by: Lukasz Marek > --- > libavutil/opt.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/libavutil/opt.c b/libavutil/opt.c > index 47b1f0c..85330c9 100644 > --- a/libavutil/opt.c > +++ b/libavutil/opt.c > @@ -50,6 +50,8 @@ const AVOption *av_next_option(void *obj, const AVOption > *last) > > const AVOption *av_opt_next(void *obj, const AVOption *last) > { > +if (!obj) > +return NULL; > AVClass *class = *(AVClass**)obj; AVClass *class must be declared above > if (!last && class && class->option && class->option[0].name) > return class->option; > -- > 1.9.1 > -- Clément B. pgpMKwpOMr5Qc.pgp Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] lavu/opt: add const to av_opt_copy arg
On 23.11.2014 00:58, Lukasz Marek wrote: Signed-off-by: Lukasz Marek --- libavutil/opt.c | 2 +- libavutil/opt.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libavutil/opt.c b/libavutil/opt.c index 0546a37..47b1f0c 100644 --- a/libavutil/opt.c +++ b/libavutil/opt.c @@ -1570,7 +1570,7 @@ static int opt_size(enum AVOptionType type) return 0; } -int av_opt_copy(void *dst, void *src) +int av_opt_copy(void *dst, FF_CONST_AVUTIL53 void *src) { const AVOption *o = NULL; const AVClass *c; diff --git a/libavutil/opt.h b/libavutil/opt.h index 7338e78..6b6c996 100644 --- a/libavutil/opt.h +++ b/libavutil/opt.h @@ -825,7 +825,7 @@ int av_opt_query_ranges(AVOptionRanges **, void *obj, const char *key, int flags * @param src Object to copy into * @return 0 on success, negative on error */ -int av_opt_copy(void *dest, void *src); +int av_opt_copy(void *dest, FF_CONST_AVUTIL53 void *src); /** * Get a default list of allowed ranges for the given option. I added FF_CONST_AVUTILS53 macro, but is this really needed? Cannot be just const? I'm asking because I think it doesn't fix anything. I guess is it API/ABI thing, but why? ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] lavfi: add tdiff filter
On Sat, Nov 22, 2014 at 11:44:29PM +0100, Stefano Sabatini wrote: > TODO: bump minor > --- > Changelog| 1 + > doc/filters.texi | 4 ++ > libavfilter/Makefile | 1 + > libavfilter/allfilters.c | 1 + > libavfilter/vf_tdiff.c | 131 > +++ > 5 files changed, 138 insertions(+) > create mode 100644 libavfilter/vf_tdiff.c > > diff --git a/Changelog b/Changelog > index 5f38aea..41fdf18 100644 > --- a/Changelog > +++ b/Changelog > @@ -15,6 +15,7 @@ version : > - ffserver supports codec private options > - creating DASH compatible fragmented MP4, MPEG-DASH segmenting muxer > - WebP muxer with animated WebP support > +- tdiff filter > > > version 2.4: > diff --git a/doc/filters.texi b/doc/filters.texi > index 8c16c7a..9882da7 100644 > --- a/doc/filters.texi > +++ b/doc/filters.texi > @@ -8394,6 +8394,10 @@ Useful for enlarging pixel art images without reducing > sharpness. > @section swapuv > Swap U & V plane. > > +@section tdiff > + > +Show difference between consecutive frames. > + > @section telecine > > Apply telecine process to the video. > diff --git a/libavfilter/Makefile b/libavfilter/Makefile > index 2c56e38..3217c99 100644 > --- a/libavfilter/Makefile > +++ b/libavfilter/Makefile > @@ -97,6 +97,7 @@ OBJS-$(CONFIG_BLACKDETECT_FILTER)+= > vf_blackdetect.o > OBJS-$(CONFIG_BLACKFRAME_FILTER) += vf_blackframe.o > OBJS-$(CONFIG_BLEND_FILTER) += vf_blend.o dualinput.o > framesync.o > OBJS-$(CONFIG_BOXBLUR_FILTER)+= vf_boxblur.o > +OBJS-$(CONFIG_CDIFF_FILTER) += vf_cdiff.o [...] > --- /dev/null > +++ b/libavfilter/vf_tdiff.c the name doesnt match [...] > + > +static int filter_frame(AVFilterLink *inlink, AVFrame *frame) > +{ > +TDiffContext *tdiff = inlink->dst->priv; > +AVFilterLink *outlink = inlink->dst->outputs[0]; > + > +if (tdiff->prev_frame) { > +int i, j; > + > +AVFrame *diff = ff_get_video_buffer(outlink, outlink->w, outlink->h); > +av_frame_copy_props(frame, diff); > +if (!diff) { > +av_frame_free(&frame); > +return AVERROR(ENOMEM); > +} > + > +/* compute difference with previous frame */ > +for (i = 0; i < frame->height; i++) { > +uint8_t *pdiff = diff ->data[0] + i * diff > ->linesize[0]; > +uint8_t *pprev = tdiff->prev_frame->data[0] + i * > tdiff->prev_frame->linesize[0]; > +uint8_t *pthis = frame->data[0] + i * frame > ->linesize[0]; > +for (j = 0; j < frame->width; j++) { > +*pdiff++ = abs(*pthis++ - *pprev++); a difference that leaves the sign intact might be interresting too like 128 + *pthis++ - *pprev++ or something like that [...] -- 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: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 1/2] lavu/opt: handle NULL obj in av_opt_next
On 23.11.2014 00:59, Clément Bœsch wrote: On Sun, Nov 23, 2014 at 12:58:06AM +0100, Lukasz Marek wrote: It indirectly also fixes av_opt_free for NULL objs. Signed-off-by: Lukasz Marek --- libavutil/opt.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavutil/opt.c b/libavutil/opt.c index 47b1f0c..85330c9 100644 --- a/libavutil/opt.c +++ b/libavutil/opt.c @@ -50,6 +50,8 @@ const AVOption *av_next_option(void *obj, const AVOption *last) const AVOption *av_opt_next(void *obj, const AVOption *last) { +if (!obj) +return NULL; AVClass *class = *(AVClass**)obj; AVClass *class must be declared above Thx for notice, updated patch is attached. >From 01f6964251ae9805c62794f3dca17be0cd2255c1 Mon Sep 17 00:00:00 2001 From: Lukasz Marek Date: Sun, 23 Nov 2014 00:48:17 +0100 Subject: [PATCH] lavu/opt: handle NULL obj in av_opt_next It indirectly also fixes av_opt_free for NULL objs. Signed-off-by: Lukasz Marek --- libavutil/opt.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libavutil/opt.c b/libavutil/opt.c index 47b1f0c..c94d0f7 100644 --- a/libavutil/opt.c +++ b/libavutil/opt.c @@ -50,7 +50,10 @@ const AVOption *av_next_option(void *obj, const AVOption *last) const AVOption *av_opt_next(void *obj, const AVOption *last) { -AVClass *class = *(AVClass**)obj; +const AVClass *class; +if (!obj) +return NULL; +class = *(const AVClass**)obj; if (!last && class && class->option && class->option[0].name) return class->option; if (last && last[1].name) -- 1.9.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] lavfi: add tdiff filter
On Sat, Nov 22, 2014 at 11:44:29PM +0100, Stefano Sabatini wrote: > TODO: bump minor > --- > Changelog| 1 + > doc/filters.texi | 4 ++ > libavfilter/Makefile | 1 + > libavfilter/allfilters.c | 1 + > libavfilter/vf_tdiff.c | 131 > +++ > 5 files changed, 138 insertions(+) > create mode 100644 libavfilter/vf_tdiff.c > What about adding a tblend in vf_blend.c instead? [...] -- Clément B. pgpNOOMPylKEK.pgp Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] v210enc: Add x86 SIMD
From: Kieran Kunhya Signed-off-by: Michael Niedermayer --- libavcodec/v210enc.c | 78 + libavcodec/v210enc.h | 31 libavcodec/x86/Makefile |2 ++ libavcodec/x86/v210enc.asm| 75 +++ libavcodec/x86/v210enc_init.c | 31 5 files changed, 194 insertions(+), 23 deletions(-) create mode 100644 libavcodec/v210enc.h create mode 100644 libavcodec/x86/v210enc.asm create mode 100644 libavcodec/x86/v210enc_init.c diff --git a/libavcodec/v210enc.c b/libavcodec/v210enc.c index 1e53bdb..f4fc1fe 100644 --- a/libavcodec/v210enc.c +++ b/libavcodec/v210enc.c @@ -24,9 +24,37 @@ #include "avcodec.h" #include "bytestream.h" #include "internal.h" +#include "v210enc.h" + +#define CLIP(v) av_clip(v, 4, 1019) + +#define WRITE_PIXELS(a, b, c) \ +do {\ +val = CLIP(*a++); \ +val |= (CLIP(*b++) << 10) | \ + (CLIP(*c++) << 20); \ +AV_WL32(dst, val); \ +dst += 4; \ +} while (0) + +static void v210_planar_pack_c(const uint16_t *y, const uint16_t *u, + const uint16_t *v, uint8_t *dst, ptrdiff_t width) +{ +uint32_t val; +int i; + +for( i = 0; i < width-5; i += 6 ){ +WRITE_PIXELS(u, y, v); +WRITE_PIXELS(y, u, y); +WRITE_PIXELS(v, y, u); +WRITE_PIXELS(y, v, y); +} +} static av_cold int encode_init(AVCodecContext *avctx) { +V210EncContext *s = avctx->priv_data; + if (avctx->width & 1) { av_log(avctx, AV_LOG_ERROR, "v210 needs even width\n"); return AVERROR(EINVAL); @@ -42,12 +70,19 @@ static av_cold int encode_init(AVCodecContext *avctx) avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I; +s->pack_line= v210_planar_pack_c; + +if (HAVE_MMX) +v210enc_x86_init(s); + return 0; } static int encode_frame(AVCodecContext *avctx, AVPacket *pkt, const AVFrame *pic, int *got_packet) { +V210EncContext *s = avctx->priv_data; + int aligned_width = ((avctx->width + 47) / 48) * 48; int stride = aligned_width * 8 / 3; int line_padding = stride - ((avctx->width * 8 + 11) / 12) * 4; @@ -55,47 +90,43 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt, const uint16_t *y = (const uint16_t*)pic->data[0]; const uint16_t *u = (const uint16_t*)pic->data[1]; const uint16_t *v = (const uint16_t*)pic->data[2]; -PutByteContext p; +uint8_t *dst; if ((ret = ff_alloc_packet2(avctx, pkt, avctx->height * stride)) < 0) return ret; -bytestream2_init_writer(&p, pkt->data, pkt->size); - -#define CLIP(v) av_clip(v, 4, 1019) - -#define WRITE_PIXELS(a, b, c) \ -do {\ -val = CLIP(*a++); \ -val |= (CLIP(*b++) << 10) | \ - (CLIP(*c++) << 20); \ -bytestream2_put_le32u(&p, val); \ -} while (0) +dst = pkt->data; for (h = 0; h < avctx->height; h++) { uint32_t val; -for (w = 0; w < avctx->width - 5; w += 6) { -WRITE_PIXELS(u, y, v); -WRITE_PIXELS(y, u, y); -WRITE_PIXELS(v, y, u); -WRITE_PIXELS(y, v, y); -} +w = (avctx->width / 6) * 6; +s->pack_line(y, u, v, dst, w); + +y += w; +u += w >> 1; +v += w >> 1; +dst += (w / 6) * 16; if (w < avctx->width - 1) { WRITE_PIXELS(u, y, v); val = CLIP(*y++); -if (w == avctx->width - 2) -bytestream2_put_le32u(&p, val); +if (w == avctx->width - 2) { +AV_WL32(dst, val); +dst += 4; +} if (w < avctx->width - 3) { val |= (CLIP(*u++) << 10) | (CLIP(*y++) << 20); -bytestream2_put_le32u(&p, val); +AV_WL32(dst, val); +dst += 4; val = CLIP(*v++) | (CLIP(*y++) << 10); -bytestream2_put_le32u(&p, val); +AV_WL32(dst, val); +dst += 4; } } -bytestream2_set_buffer(&p, 0, line_padding); +memset(dst, 0, line_padding); +dst += line_padding; y += pic->linesize[0] / 2 - avctx->width; u += pic->linesize[1] / 2 - avctx->width / 2; @@ -119,6 +150,7 @@ AVCodec ff_v210_encoder = { .long_name = NULL_IF_CONFIG_SMALL("Uncompressed 4:2:2 10-bit"), .type = AVMEDIA_TYPE_VIDEO, .id = AV_CODEC_ID_V210, +.priv_data_size = sizeof(V210EncContext), .init = encode_init, .encode2= encode_frame, .close = encode_close, diff --git a/libavcodec/v210enc.h b/libavcodec/v210enc.h new file m
Re: [FFmpeg-devel] [libav-devel] [PATCH] v210enc: Add x86 SIMD
On Sat, Nov 22, 2014 at 07:10:04PM -0300, James Almer wrote: > On 22/11/14 5:58 PM, Kieran Kunhya wrote: > > diff --git a/libavcodec/v210enc.h b/libavcodec/v210enc.h > > new file mode 100644 > > index 000..b8b6143 > > --- /dev/null > > +++ b/libavcodec/v210enc.h > > @@ -0,0 +1,31 @@ > > +/* > > + * This file is part of Libav. > > It shouldn't take long to make a patch that can be applied to the ffmpeg tree > in a conflict free way... posted a version that applies, i made no other changes to it though so the comments from here will still apply [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB It is dangerous to be right in matters on which the established authorities are wrong. -- Voltaire signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] lavu/opt: add const to av_opt_copy arg
On Sun, Nov 23, 2014 at 01:01:19AM +0100, Lukasz Marek wrote: > On 23.11.2014 00:58, Lukasz Marek wrote: > >Signed-off-by: Lukasz Marek > >--- > > libavutil/opt.c | 2 +- > > libavutil/opt.h | 2 +- > > 2 files changed, 2 insertions(+), 2 deletions(-) > > > >diff --git a/libavutil/opt.c b/libavutil/opt.c > >index 0546a37..47b1f0c 100644 > >--- a/libavutil/opt.c > >+++ b/libavutil/opt.c > >@@ -1570,7 +1570,7 @@ static int opt_size(enum AVOptionType type) > > return 0; > > } > > > >-int av_opt_copy(void *dst, void *src) > >+int av_opt_copy(void *dst, FF_CONST_AVUTIL53 void *src) > > { > > const AVOption *o = NULL; > > const AVClass *c; > >diff --git a/libavutil/opt.h b/libavutil/opt.h > >index 7338e78..6b6c996 100644 > >--- a/libavutil/opt.h > >+++ b/libavutil/opt.h > >@@ -825,7 +825,7 @@ int av_opt_query_ranges(AVOptionRanges **, void *obj, > >const char *key, int flags > > * @param src Object to copy into > > * @return 0 on success, negative on error > > */ > >-int av_opt_copy(void *dest, void *src); > >+int av_opt_copy(void *dest, FF_CONST_AVUTIL53 void *src); > > > > /** > > * Get a default list of allowed ranges for the given option. > > > > I added FF_CONST_AVUTILS53 macro, but is this really needed? Cannot > be just const? > I'm asking because I think it doesn't fix anything. > I guess is it API/ABI thing, but why? a user application could have a function pointer like all_ffmpeg_functions->opt_copy = av_opt_copy; and if we add const the prototype changes and this can fail to build with some compiler flags or C++ or whatever and yes i have seen an application that had function pointers to ffmpeg functions [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB You can kill me, but you cannot change the truth. signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] lavc/anm: fix mem leak in case of init failure
On 22.11.2014 23:38, Michael Niedermayer wrote: On Sat, Nov 22, 2014 at 10:46:02PM +0100, Lukasz Marek wrote: Signed-off-by: Lukasz Marek --- libavcodec/anm.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) LGTM pushed ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] lavc/smacker: fix mem leak in case of init failure
On 22.11.2014 23:44, Michael Niedermayer wrote: On Sat, Nov 22, 2014 at 10:46:24PM +0100, Lukasz Marek wrote: Signed-off-by: Lukasz Marek --- libavcodec/smacker.c | 1 + 1 file changed, 1 insertion(+) LGTM pushed ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 2/2] lavc/libvorbisdec: use better error codes
On 23.11.2014 00:02, Michael Niedermayer wrote: On Sat, Nov 22, 2014 at 10:46:41PM +0100, Lukasz Marek wrote: Signed-off-by: Lukasz Marek --- libavcodec/libvorbisdec.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) LGTM pushed both ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH]Print a warning if vp6 is muxed into flv
On Sat, Nov 22, 2014 at 11:10:20PM +0100, Carl Eugen Hoyos wrote: > Hi! > > FFmpeg should print a warning when the non-flipped version of vp6 is muxed > into flv: The feature was requested and is used. > Related to ticket #4132. > > Please comment, Carl Eugen > flvenc.c |3 +++ > 1 file changed, 3 insertions(+) > 245c512dcb48e8b0ccaa4c34dbfd5a6cdb0dba12 patchflvvp6.diff LGTM [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Into a blind darkness they enter who follow after the Ignorance, they as if into a greater darkness enter who devote themselves to the Knowledge alone. -- Isha Upanishad signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] svq1enc: reduce stack usage of recursively-called function.
On Sat, Nov 22, 2014 at 07:50:59PM +0100, Reimar Döffinger wrote: > --- > libavcodec/svq1enc.c | 2 +- > libavcodec/svq1enc.h | 2 ++ > 2 files changed, 3 insertions(+), 1 deletion(-) LGTM [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Into a blind darkness they enter who follow after the Ignorance, they as if into a greater darkness enter who devote themselves to the Knowledge alone. -- Isha Upanishad signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] xface: Fix encoder crashes due to too small on-stack array.
On Sat, Nov 22, 2014 at 11:14:45PM +0100, Reimar Döffinger wrote: > Also add a FATE test. > > Signed-off-by: Reimar Döffinger > --- > libavcodec/xface.h | 9 + > libavcodec/xfaceenc.c | 3 +++ > libavformat/nut.c | 1 + I forgot this part: > const AVCodecTag ff_nut_video_tags[] = { > +{ AV_CODEC_ID_XFACE,MKTAG('X', 'F', 'A', 'C') }, Is that ok to just do? ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 1/2] xface: reduce table sizes.
On Sun, Nov 23, 2014 at 12:20:00AM +0100, Stefano Sabatini wrote: > On date Saturday 2014-11-22 23:31:58 +0100, Reimar Döffinger encoded: > > Signed-off-by: Reimar Döffinger > > --- > > libavcodec/xface.h | 4 ++-- > > 1 file changed, 2 insertions(+), 2 deletions(-) > > > > diff --git a/libavcodec/xface.h b/libavcodec/xface.h > > index 6fbe908..63df5d3 100644 > > --- a/libavcodec/xface.h > > +++ b/libavcodec/xface.h > > @@ -85,8 +85,8 @@ enum XFaceColor { XFACE_COLOR_BLACK = 0, > > XFACE_COLOR_GREY, XFACE_COLOR_WHITE }; > > * The probability of the data determines the range of possible encodings. > > * Offset gives the first possible encoding of the range. */ > > typedef struct { > > -int range; > > -int offset; > > +uint8_t range; > > +uint8_t offset; > > } ProbRange; > > LGTM. Both pushed, thanks. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] lpc: Remove stack usage by allocating LLSModel in context.
On Sat, Nov 22, 2014 at 11:26:56PM +0100, Michael Niedermayer wrote: > On Sat, Nov 22, 2014 at 08:49:45PM +0100, Reimar Döffinger wrote: > > Signed-off-by: Reimar Döffinger > > --- > > libavcodec/lpc.c | 2 +- > > libavcodec/lpc.h | 4 > > 2 files changed, 5 insertions(+), 1 deletion(-) > > LGTM Pushed, thanks. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] svq1enc: reduce stack usage of recursively-called function.
On Sun, Nov 23, 2014 at 03:57:47AM +0100, Michael Niedermayer wrote: > On Sat, Nov 22, 2014 at 07:50:59PM +0100, Reimar Döffinger wrote: > > --- > > libavcodec/svq1enc.c | 2 +- > > libavcodec/svq1enc.h | 2 ++ > > 2 files changed, 3 insertions(+), 1 deletion(-) > > LGTM Pushed, thanks. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 1/4] web/style: Only add bottom border when requested to 's in
When the is a row heading, the border looks as ugly as heck. Add a special case for in as a long heading. Signed-off-by: Timothy Gu --- This does not have any difference in the website right now, but there will be in the new fateserver. --- src/download| 2 +- src/less/style.less | 17 + 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/download b/src/download index 86560fb..d4b433b 100644 --- a/src/download +++ b/src/download @@ -213,7 +213,7 @@ - http://fate.ffmpeg.org";>fate.ffmpeg.org server software repository - + Mirrors diff --git a/src/less/style.less b/src/less/style.less index 433a78f..83212a4 100644 --- a/src/less/style.less +++ b/src/less/style.less @@ -270,11 +270,28 @@ code { } > th { background-color: @Cmainlightlight; +} +} +} +// Table headings +> thead { +> tr { +> th { // Bottom align for column headings border-bottom: 2px solid @Cmainlightlightl; } } } +> tbody { +> tr.table-heading { +// These special rules are useful for long headings in +// Headings in or row headings are handled already. +> th { +border-bottom: 2px solid @Cmainlightlightl; +background-color: @Cmainlightlight; +} +} +} // Account for multiple tbody instances > tbody + tbody { border-top: 2px solid @Cmaindarkdark; -- 1.9.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 2/4] web/style: Remove ugly white border around tables on mobile devices
Signed-off-by: Timothy Gu --- See http://imgur.com/qsnnjAi --- src/less/style.less | 4 1 file changed, 4 insertions(+) diff --git a/src/less/style.less b/src/less/style.less index 83212a4..378a972 100644 --- a/src/less/style.less +++ b/src/less/style.less @@ -327,6 +327,10 @@ code { } */ +.table-responsive { +border: none; +} + // * // // Menu side bar nav -- 1.9.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 3/4] web/download: Make "snapshot" and "browse" buttons
Signed-off-by: Timothy Gu --- See end results at http://imgur.com/GtLoaFe,PF2DeNy (both desktop and mobile) --- src/download | 57 ++--- 1 file changed, 38 insertions(+), 19 deletions(-) diff --git a/src/download b/src/download index d4b433b..4af35a5 100644 --- a/src/download +++ b/src/download @@ -189,49 +189,68 @@ Clone URL - Browse - Snapshot Description - git://source.ffmpeg.org/ffmpeg.git - http://git.videolan.org/?p=ffmpeg.git";>Browse - http://git.videolan.org/?p=ffmpeg.git;a=snapshot;h=HEAD;sf=tgz";>Snapshot + +git://source.ffmpeg.org/ffmpeg.git + + http://git.videolan.org/?p=ffmpeg.git";>Browse + http://git.videolan.org/?p=ffmpeg.git;a=snapshot;h=HEAD;sf=tgz";>Snapshot + + Main FFmpeg Git repository git://ffmpeg.org/ffmpeg-web - - - - Main ffmpeg.org website repository git://git.ffmpeg.org/fateserver -- -- http://fate.ffmpeg.org";>fate.ffmpeg.org server software repository - Mirrors + Mirrors -https://github.com/FFmpeg/FFmpeg";>https://github.com/FFmpeg/FFmpeg git://github.com/FFmpeg/FFmpeg.git -https://github.com/FFmpeg/FFmpeg";>Browse -https://github.com/FFmpeg/FFmpeg/tarball/master";>Snapshot + + +https://github.com/FFmpeg/FFmpeg";>https://github.com/FFmpeg/FFmpeg +git://github.com/FFmpeg/FFmpeg.git + + +https://github.com/FFmpeg/FFmpeg";>Browse +https://github.com/FFmpeg/FFmpeg/tarball/master";>Snapshot + + Mirror of the main repository -https://github.com/FFmpeg/web";>https://github.com/FFmpeg/web git://github.com/FFmpeg/web.git -https://github.com/FFmpeg/web";>Browse -https://github.com/FFmpeg/web/tarball/master";>Snapshot + + +https://github.com/FFmpeg/web";>https://github.com/FFmpeg/web +git://github.com/FFmpeg/web.git + + +https://github.com/FFmpeg/web";>Browse +https://github.com/FFmpeg/web/tarball/master";>Snapshot + + Mirror of the website repository -https://github.com/FFmpeg/fateserver";>https://github.com/FFmpeg/fateserver git://github.com/FFmpeg/fateserver.git -https://github.com/FFmpeg/fateserver";>Browse -https://github.com/FFmpeg/fateserver/tarball/master";>Snapshot + + +https://github.com/FFmpeg/fateserver";>https://github.com/FFmpeg/fateserver +git://github.com/FFmpeg/fateserver.git + + +https://github.com/FFmpeg/fateserver";>Browse +https://github.com/FFmpeg/fateserver/tarball/master";>Snapshot + + Mirror of the FATE server repository -- 1.9.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 4/4] web/download: Fix indentation
Signed-off-by: Timothy Gu --- src/download | 86 ++-- 1 file changed, 43 insertions(+), 43 deletions(-) diff --git a/src/download b/src/download index 4af35a5..f3f9ce3 100644 --- a/src/download +++ b/src/download @@ -207,52 +207,52 @@ git://ffmpeg.org/ffmpeg-web Main ffmpeg.org website repository - -git://git.ffmpeg.org/fateserver -http://fate.ffmpeg.org";>fate.ffmpeg.org server software repository - + + git://git.ffmpeg.org/fateserver + http://fate.ffmpeg.org";>fate.ffmpeg.org server software repository + Mirrors - - - -https://github.com/FFmpeg/FFmpeg";>https://github.com/FFmpeg/FFmpeg -git://github.com/FFmpeg/FFmpeg.git - - -https://github.com/FFmpeg/FFmpeg";>Browse -https://github.com/FFmpeg/FFmpeg/tarball/master";>Snapshot - - -Mirror of the main repository - - - - -https://github.com/FFmpeg/web";>https://github.com/FFmpeg/web -git://github.com/FFmpeg/web.git - - -https://github.com/FFmpeg/web";>Browse -https://github.com/FFmpeg/web/tarball/master";>Snapshot - - -Mirror of the website repository - - - - -https://github.com/FFmpeg/fateserver";>https://github.com/FFmpeg/fateserver -git://github.com/FFmpeg/fateserver.git - - -https://github.com/FFmpeg/fateserver";>Browse -https://github.com/FFmpeg/fateserver/tarball/master";>Snapshot - - -Mirror of the FATE server repository - + + + + https://github.com/FFmpeg/FFmpeg";>https://github.com/FFmpeg/FFmpeg + git://github.com/FFmpeg/FFmpeg.git + + + https://github.com/FFmpeg/FFmpeg";>Browse + https://github.com/FFmpeg/FFmpeg/tarball/master";>Snapshot + + + Mirror of the main repository + + + + + https://github.com/FFmpeg/web";>https://github.com/FFmpeg/web + git://github.com/FFmpeg/web.git + + + https://github.com/FFmpeg/web";>Browse + https://github.com/FFmpeg/web/tarball/master";>Snapshot + + + Mirror of the website repository + + + + + https://github.com/FFmpeg/fateserver";>https://github.com/FFmpeg/fateserver + git://github.com/FFmpeg/fateserver.git + + + https://github.com/FFmpeg/fateserver";>Browse + https://github.com/FFmpeg/fateserver/tarball/master";>Snapshot + + + Mirror of the FATE server repository + -- 1.9.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel