Re: [FFmpeg-devel] [PATCH] avfilter: add audio pulsator filter
On Sat, Nov 28, 2015 at 6:21 PM, Ganesh Ajjanagadde wrote: > On Sat, Nov 28, 2015 at 5:26 PM, Paul B Mahol wrote: >> Signed-off-by: Paul B Mahol > [...] > >> +case SQUARE: >> +val = (phs < 0.5) ? -1 : +1; > > Something I missed: consider using e.g FFSIGN(phs - 0.5) or FFSIGN(0.5 > - phase), can't recall. This I still suggest for readability. > This is actually important because if one > feeds in 0.5 exactly (which is exactly representable), val becomes > unitialized and hence garbage. Sorry, this was complete garbage and should be ignored. What you choose to do at the discontinuity is practically irrelevant. The "purest" thing to do is take the midpoint of the jump, i.e 0 per Fourier theory, but I don't think it is good due to an extra bench for essentially zero gain. > > [...] ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avfilter: add audio pulsator filter
On Sat, Nov 28, 2015 at 5:26 PM, Paul B Mahol wrote: > Signed-off-by: Paul B Mahol [...] > +case SQUARE: > +val = (phs < 0.5) ? -1 : +1; Something I missed: consider using e.g FFSIGN(phs - 0.5) or FFSIGN(0.5 - phase), can't recall. This is actually important because if one feeds in 0.5 exactly (which is exactly representable), val becomes unitialized and hence garbage. [...] ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avfilter: add audio pulsator filter
On Sat, Nov 28, 2015 at 5:26 PM, Paul B Mahol wrote: > Signed-off-by: Paul B Mahol > --- > doc/filters.texi | 57 ++ > libavfilter/Makefile | 1 + > libavfilter/af_apulsator.c | 270 > + > libavfilter/allfilters.c | 1 + > 4 files changed, 329 insertions(+) > create mode 100644 libavfilter/af_apulsator.c > > diff --git a/doc/filters.texi b/doc/filters.texi > index c8471e5..6d10a05 100644 > --- a/doc/filters.texi > +++ b/doc/filters.texi > @@ -1027,6 +1027,63 @@ It accepts the following values: > @end table > @end table > > +@section apulsator > + > +Audio pulsator is something between an autopanner and a tremolo. > +But it can produce funny stereo effects as well. Pulsator changes the volume > +of left and right channel based on a LFO (low frequency oscillator) with "left and right" -> "the left and right" > +different waveforms and shifted phases. > +This filter have ability to define an offset between left and right channel. "have ability" -> "has the ability", "left and right" -> "the left and right" > +An offset of 0 means that both LFO shapes match each other. Left and right > +channel are altered equally - a conventional tremolo. An offset of 50% means "Left and right channel" -> "The left and right channels" > +that the shape of the right channel is exactly shifted in phase (or moved > +backwards about half of the frequency) - Pulsator acts as an autopanner. "Pulsator" -> "pulsator" > +At 1 both curves match again. Every setting inbetween moves the phaseshift "inbetween" -> "in between" "phaseshift" -> "phase shift" or "phase-shift", prefer 1st > +gapless between all stages and produces some "bypassing" sounds with sine and > +triangle waveform. The more you set the offset near 1 (starting from the "sine and triangle waveform" -> "sine and triangle waveforms", or perhaps based on code "sine, triangle, square, sawup, or sawdown waveforms". Up to you. > +0.5) the faster the signal passes from left to right speaker. "the 0.5" -> "0.5" "left to right speaker" -> "the left to the right speaker". > + > +The filter accepts the following options: > + > +@table @option > +@item level_in > +Set input gain. By default it is 1. Range is between 0.015625 and 64. > + > +@item level_out > +Set output gain. By default it is 1. Range is between 0.015625 and 64. nit: 0.01625 and 64 inclusive or exclusive (i.e open or closed interval) should be clarified since they are exactly representable doubles. > + > +@item mode > +Set waveform shape the LFO will use. Can be one of: sine, triangle, square, > +sawup or sawdown. Default is sine. > + > +@item amount > +Set modulation. Define how much of original signal is affected by the LFO. > + > +@item offset_l > +Set left channel offset. Default is 0. Allowed range is from 0 to 1. > + > +@item offset_r > +Set right channel offset. Default is 0.5. Allowed range is from 0 to 1. Again, inclusive or exclusive. > + > +@item width > +Set pulse width. > + > +@item timing > +Set possible timing mode. Can be one of: bpm, ms or hz. Default is hz. > + > +@item bpm > +Set bpm. Default is 120. Allowed range is from 30 to 300. Only used if timing > +is set to bpm. > + > +@item ms > +Set ms. Default is 500. Allowed range is from 10 to 2000. Only used if timing > +is set to ms Same as above. > + > +@item hz > +Set frequency in Hz. Default is 2. Allowed range is from 0.01 to 100. Only > used > +if timing is set to hz. > +@end table > + > @anchor{aresample} > @section aresample > > diff --git a/libavfilter/Makefile b/libavfilter/Makefile > index e31bdaa..b6c0d7b 100644 > --- a/libavfilter/Makefile > +++ b/libavfilter/Makefile > @@ -40,6 +40,7 @@ OBJS-$(CONFIG_ANULL_FILTER) += af_anull.o > OBJS-$(CONFIG_APAD_FILTER) += af_apad.o > OBJS-$(CONFIG_APERMS_FILTER) += f_perms.o > OBJS-$(CONFIG_APHASER_FILTER)+= af_aphaser.o > generate_wave_table.o > +OBJS-$(CONFIG_APULSATOR_FILTER) += af_apulsator.o > OBJS-$(CONFIG_AREALTIME_FILTER) += f_realtime.o > OBJS-$(CONFIG_ARESAMPLE_FILTER) += af_aresample.o > OBJS-$(CONFIG_AREVERSE_FILTER) += f_reverse.o > diff --git a/libavfilter/af_apulsator.c b/libavfilter/af_apulsator.c > new file mode 100644 > index 000..c3579f4 > --- /dev/null > +++ b/libavfilter/af_apulsator.c > @@ -0,0 +1,270 @@ > +/* > + * Copyright (c) 2001-2010 Krzysztof Foltman, Markus Schmidt, Thor Harald > Johansen and others > + * > + * 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 warrant
[FFmpeg-devel] [PATCH] developer.texi: Call out K&R coding style.
K&R coding style is implied but not listed in 'Coding Rules'. Signed-off-by: Rick Kern --- doc/developer.texi | 3 +++ 1 file changed, 3 insertions(+) diff --git a/doc/developer.texi b/doc/developer.texi index cad1c29..9a901d8 100644 --- a/doc/developer.texi +++ b/doc/developer.texi @@ -65,6 +65,9 @@ rejected by the git repository. @item You should try to limit your code lines to 80 characters; however, do so if and only if this improves readability. + +@item +K&R coding style is used. @end itemize The presentation is one inspired by 'indent -i4 -kr -nut'. -- 2.4.9 (Apple Git-60) ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] avfilter: add audio pulsator filter
Signed-off-by: Paul B Mahol --- doc/filters.texi | 57 ++ libavfilter/Makefile | 1 + libavfilter/af_apulsator.c | 270 + libavfilter/allfilters.c | 1 + 4 files changed, 329 insertions(+) create mode 100644 libavfilter/af_apulsator.c diff --git a/doc/filters.texi b/doc/filters.texi index c8471e5..6d10a05 100644 --- a/doc/filters.texi +++ b/doc/filters.texi @@ -1027,6 +1027,63 @@ It accepts the following values: @end table @end table +@section apulsator + +Audio pulsator is something between an autopanner and a tremolo. +But it can produce funny stereo effects as well. Pulsator changes the volume +of left and right channel based on a LFO (low frequency oscillator) with +different waveforms and shifted phases. +This filter have ability to define an offset between left and right channel. +An offset of 0 means that both LFO shapes match each other. Left and right +channel are altered equally - a conventional tremolo. An offset of 50% means +that the shape of the right channel is exactly shifted in phase (or moved +backwards about half of the frequency) - Pulsator acts as an autopanner. +At 1 both curves match again. Every setting inbetween moves the phaseshift +gapless between all stages and produces some "bypassing" sounds with sine and +triangle waveform. The more you set the offset near 1 (starting from the +0.5) the faster the signal passes from left to right speaker. + +The filter accepts the following options: + +@table @option +@item level_in +Set input gain. By default it is 1. Range is between 0.015625 and 64. + +@item level_out +Set output gain. By default it is 1. Range is between 0.015625 and 64. + +@item mode +Set waveform shape the LFO will use. Can be one of: sine, triangle, square, +sawup or sawdown. Default is sine. + +@item amount +Set modulation. Define how much of original signal is affected by the LFO. + +@item offset_l +Set left channel offset. Default is 0. Allowed range is from 0 to 1. + +@item offset_r +Set right channel offset. Default is 0.5. Allowed range is from 0 to 1. + +@item width +Set pulse width. + +@item timing +Set possible timing mode. Can be one of: bpm, ms or hz. Default is hz. + +@item bpm +Set bpm. Default is 120. Allowed range is from 30 to 300. Only used if timing +is set to bpm. + +@item ms +Set ms. Default is 500. Allowed range is from 10 to 2000. Only used if timing +is set to ms + +@item hz +Set frequency in Hz. Default is 2. Allowed range is from 0.01 to 100. Only used +if timing is set to hz. +@end table + @anchor{aresample} @section aresample diff --git a/libavfilter/Makefile b/libavfilter/Makefile index e31bdaa..b6c0d7b 100644 --- a/libavfilter/Makefile +++ b/libavfilter/Makefile @@ -40,6 +40,7 @@ OBJS-$(CONFIG_ANULL_FILTER) += af_anull.o OBJS-$(CONFIG_APAD_FILTER) += af_apad.o OBJS-$(CONFIG_APERMS_FILTER) += f_perms.o OBJS-$(CONFIG_APHASER_FILTER)+= af_aphaser.o generate_wave_table.o +OBJS-$(CONFIG_APULSATOR_FILTER) += af_apulsator.o OBJS-$(CONFIG_AREALTIME_FILTER) += f_realtime.o OBJS-$(CONFIG_ARESAMPLE_FILTER) += af_aresample.o OBJS-$(CONFIG_AREVERSE_FILTER) += f_reverse.o diff --git a/libavfilter/af_apulsator.c b/libavfilter/af_apulsator.c new file mode 100644 index 000..c3579f4 --- /dev/null +++ b/libavfilter/af_apulsator.c @@ -0,0 +1,270 @@ +/* + * Copyright (c) 2001-2010 Krzysztof Foltman, Markus Schmidt, Thor Harald Johansen and others + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "libavutil/opt.h" +#include "avfilter.h" +#include "internal.h" +#include "audio.h" + +enum PulsatorModes { SINE, TRIANGLE, SQUARE, SAWUP, SAWDOWN, NB_MODES }; +enum PulsatorTimings { UNIT_BPM, UNIT_MS, UNIT_HZ, NB_TIMINGS }; + +typedef struct SimpleLFO { +double phase; +double freq; +double offset; +double amount; +double pwidth; +int mode; +int srate; +} SimpleLFO; + +typedef struct AudioPulsatorContext { +const AVClass *class; +int mode; +double level_in; +double level_out; +double amount; +double offset_l; +double offset_r; +double pwidth; +double bpm; +dou
Re: [FFmpeg-devel] [PATCH v4] Added VideoToolbox H.264 encoder.
On Nov 28, 2015, at 5:07 PM, Timothy Gu wrote: > > On Sat, Nov 28, 2015 at 02:06:07PM -0500, Rick Kern wrote: >> vtenc.c was updated to match the coding style of the project. >> >> I used several other files to get a feel for the project's coding >> style. Is there documentation for this? > > Yes: https://ffmpeg.org/developer.html#Coding-Rules-1 > > Timothy > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel Got it - I didn’t realize ‘indent’ was a source code formatter. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH v4] Added VideoToolbox H.264 encoder.
On Sat, Nov 28, 2015 at 02:06:07PM -0500, Rick Kern wrote: > vtenc.c was updated to match the coding style of the project. > > I used several other files to get a feel for the project's coding > style. Is there documentation for this? Yes: https://ffmpeg.org/developer.html#Coding-Rules-1 Timothy ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 3/4] avcodec/mpegaudio_tablegen: more dynamic table creation speedups
On Sat, Nov 28, 2015 at 4:35 PM, Derek Buitenhuis wrote: > On 11/28/2015 9:26 PM, Derek Buitenhuis wrote: >> Changing all of them sounds fine to me. > > [21:31] <@ubitux> re: i%4 vs i&3; you should ask him to make sure the > compiler is smart enough regarding the signess of i No idea, actually GCC even to this day has issues with signed vs unsigned. Trivial example (unrelated), https://gcc.gnu.org/bugzilla/show_bug.cgi?id=48052 which is still open. Lesson for FFmpeg - make sure looping is done with int i instead of unsigned i. I have not done an extensive audit, but FFmpeg seems mostly good in this respect. So I will follow Derek's suggestion and use i & 3 uniformly here; I lack the energy to investigate and will err on the safe side wrt performance. > > - Derek > ___ > 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 3/4] avcodec/mpegaudio_tablegen: more dynamic table creation speedups
On 11/28/2015 9:26 PM, Derek Buitenhuis wrote: > Changing all of them sounds fine to me. [21:31] <@ubitux> re: i%4 vs i&3; you should ask him to make sure the compiler is smart enough regarding the signess of i - Derek ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 3/4] avcodec/mpegaudio_tablegen: more dynamic table creation speedups
On 11/28/2015 9:19 PM, Ganesh Ajjanagadde wrote: > I actually prefer keeping all at i % 4, since that conveys intent > better IMHO, and would change uniformly to that. It takes a reader a > couple of seconds extra to register what i & 3 is doing for no gain in > C code. No compiler I know of in 2015 has issues with such > trivialities. Changing all of them sounds fine to me. - Derek ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 1/4] avutil/tablegen: add tablegen libm compatibility shims
On Sat, Nov 28, 2015 at 3:19 PM, Derek Buitenhuis wrote: > On 11/28/2015 7:51 PM, Ganesh Ajjanagadde wrote: >> In principle of course, e.g with more ifdefry, configure, or something >> of that sort. I do not believe this is what he meant. > > I will await his reply to clarify, then. Perhaps do not write so > matter-of-factly. > >> In any case, the point is moot - the implementations are not broken - >> if they are, avutil/libm needs fixing as well. > > Now, yes. It would certainly be nice if this was noted somewhere in the patch > notes > (not necessarily in the commit messages). There are quite a few threads on > the list > from you now regarding tablegen, and it can be a pain in the butt / tedious > to figure > out how the current version differs from the N others. I assumed from the cover letter that this supersedes all such prior stuff. Anyway, will attempt but can't guarantee improvements in future. > >>> Anyway, shouldn't this patce dropped, since >>> 79abf2d0ded860acf505de22c4f7a750e5e98446 >>> removed hardcoded tables anyway? >> >> No, if you actually read even the first line of the commit message, >> you can see it was only for aac, not for this patch series. > > Indeed, I misread, and missed the 'aac_'. You could certainly be less of > an ass about it, though. Sorry about that. Please do continue to call me out on such things; I do not like unpleasantness on ffmpeg-devel. > > - Derek > ___ > 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 3/4] avcodec/mpegaudio_tablegen: more dynamic table creation speedups
On Sat, Nov 28, 2015 at 3:29 PM, Derek Buitenhuis wrote: > On 11/28/2015 5:03 PM, Ganesh Ajjanagadde wrote: >> +if (i % 4 == 0) > > I doubt it particularly matters in this case, but you can > avoid a modulo operator here with i & 3, like elsewhere > in the file. I doubt the compiler is that dumb, though. > Same for other occurrences. I actually prefer keeping all at i % 4, since that conveys intent better IMHO, and would change uniformly to that. It takes a reader a couple of seconds extra to register what i & 3 is doing for no gain in C code. No compiler I know of in 2015 has issues with such trivialities. > > - Derek > ___ > 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 3/4] avcodec/mpegaudio_tablegen: more dynamic table creation speedups
On 11/28/2015 5:03 PM, Ganesh Ajjanagadde wrote: > +if (i % 4 == 0) I doubt it particularly matters in this case, but you can avoid a modulo operator here with i & 3, like elsewhere in the file. I doubt the compiler is that dumb, though. Same for other occurrences. - Derek ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 1/4] avutil/tablegen: add tablegen libm compatibility shims
On 11/28/2015 7:51 PM, Ganesh Ajjanagadde wrote: > In principle of course, e.g with more ifdefry, configure, or something > of that sort. I do not believe this is what he meant. I will await his reply to clarify, then. Perhaps do not write so matter-of-factly. > In any case, the point is moot - the implementations are not broken - > if they are, avutil/libm needs fixing as well. Now, yes. It would certainly be nice if this was noted somewhere in the patch notes (not necessarily in the commit messages). There are quite a few threads on the list from you now regarding tablegen, and it can be a pain in the butt / tedious to figure out how the current version differs from the N others. >> Anyway, shouldn't this patce dropped, since >> 79abf2d0ded860acf505de22c4f7a750e5e98446 >> removed hardcoded tables anyway? > > No, if you actually read even the first line of the commit message, > you can see it was only for aac, not for this patch series. Indeed, I misread, and missed the 'aac_'. You could certainly be less of an ass about it, though. - Derek ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 1/4] avutil/tablegen: add tablegen libm compatibility shims
On Sat, Nov 28, 2015 at 2:45 PM, Derek Buitenhuis wrote: > On 11/28/2015 7:33 PM, Ganesh Ajjanagadde wrote: >> 2. Clement's idea AFAIK does not work, since the names must be >> identical to the standard C names for the build to work with/without >> hardcoded tables. > > ... yes it can. It doesn't work without more work, but it it sure can > work. In principle of course, e.g with more ifdefry, configure, or something of that sort. I do not believe this is what he meant. In any case, the point is moot - the implementations are not broken - if they are, avutil/libm needs fixing as well. > > Anyway, shouldn't this patce dropped, since > 79abf2d0ded860acf505de22c4f7a750e5e98446 > removed hardcoded tables anyway? No, if you actually read even the first line of the commit message, you can see it was only for aac, not for this patch series. > > - Derek > ___ > 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 1/4] avutil/tablegen: add tablegen libm compatibility shims
On 11/28/2015 7:33 PM, Ganesh Ajjanagadde wrote: > 2. Clement's idea AFAIK does not work, since the names must be > identical to the standard C names for the build to work with/without > hardcoded tables. ... yes it can. It doesn't work without more work, but it it sure can work. Anyway, shouldn't this patce dropped, since 79abf2d0ded860acf505de22c4f7a750e5e98446 removed hardcoded tables anyway? - Derek ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 1/4] avutil/tablegen: add tablegen libm compatibility shims
On Sat, Nov 28, 2015 at 1:31 PM, Derek Buitenhuis wrote: > On 11/28/2015 5:03 PM, Ganesh Ajjanagadde wrote: >> +static inline double ff_cbrt(double x) >> +{ >> +return x < 0 ? -pow(-x, 1.0 / 3.0) : pow(x, 1.0 / 3.0); >> +} >> +#define cbrt ff_cbrt > > Didn't Clément say to not pollute the global namespace like this? There are 2 answers to this. For reference, here is the quote by Clement: "it's pretty fine with me to use a simple hack like this, but then i'd argue it's better if the global c namespace is not polluted with openly broken implementations: just name the macro differently (ffrint, simplerint, or whatever) to make sure someone doesn't end up using it in a different context where negative values matter (and where the issue won't get detected quickly)" 1. These implementations are not openly broken, since I actually copied stuff from avutil/libm here, based on this review. Thus, that aspect does not apply. 2. Clement's idea AFAIK does not work, since the names must be identical to the standard C names for the build to work with/without hardcoded tables. BTW, this was also pointed out by me in a reply to that quote. > > - Derek > ___ > 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 v4] Added VideoToolbox H.264 encoder.
Enable with configure --enable-vtenc and encode using -codec:v vtenc_h264. Signed-off-by: Rick Kern --- MAINTAINERS|1 + configure |4 + libavcodec/Makefile|1 + libavcodec/allcodecs.c |1 + libavcodec/vtenc.c | 1269 5 files changed, 1276 insertions(+) create mode 100644 libavcodec/vtenc.c diff --git a/MAINTAINERS b/MAINTAINERS index 3735742..28782d2 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -286,6 +286,7 @@ Codecs: vp8 David Conrad, Jason Garrett-Glaser, Ronald Bultje vp9 Ronald Bultje, Clément Bœsch vqavideo.cMike Melanson + vtenc.c Rick Kern wavpack.c Kostya Shishkov wmaprodec.c Sascha Sommer wmavoice.cRonald S. Bultje diff --git a/configure b/configure index 0198b75..0322b3f 100755 --- a/configure +++ b/configure @@ -286,6 +286,7 @@ External library support: --disable-sdldisable sdl [autodetect] --disable-securetransport disable Secure Transport, needed for TLS support on OSX if openssl and gnutls are not used [autodetect] + --enable-vtenc enable VideoToolbox encoding support [no] --enable-x11grab enable X11 grabbing (legacy) [no] --disable-xlib disable xlib [autodetect] --disable-zlib disable zlib [autodetect] @@ -1473,6 +1474,7 @@ EXTERNAL_LIBRARY_LIST=" schannel sdl securetransport +vtenc x11grab xlib zlib @@ -2610,6 +2612,7 @@ libzvbi_teletext_decoder_deps="libzvbi" nvenc_encoder_deps="nvenc" nvenc_h264_encoder_deps="nvenc" nvenc_hevc_encoder_deps="nvenc" +vtenc_h264_encoder_deps="vtenc" # demuxers / muxers ac3_demuxer_select="ac3_parser" @@ -5473,6 +5476,7 @@ enabled openssl && { check_lib openssl/ssl.h SSL_library_init -lssl -l check_lib openssl/ssl.h SSL_library_init -lssl32 -leay32 || check_lib openssl/ssl.h SSL_library_init -lssl -lcrypto -lws2_32 -lgdi32 || die "ERROR: openssl not found"; } +enabled vtenc && require VideoToolbox VideoToolbox/VTCompressionSession.h VTCompressionSessionPrepareToEncodeFrames -framework VideoToolbox enabled qtkit_indev && { check_header_oc QTKit/QTKit.h || disable qtkit_indev; } if enabled gnutls; then diff --git a/libavcodec/Makefile b/libavcodec/Makefile index d85215d..9e95737 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -116,6 +116,7 @@ OBJS-$(CONFIG_TEXTUREDSP) += texturedsp.o OBJS-$(CONFIG_TEXTUREDSPENC) += texturedspenc.o OBJS-$(CONFIG_TPELDSP) += tpeldsp.o OBJS-$(CONFIG_VIDEODSP)+= videodsp.o +OBJS-$(CONFIG_VTENC) += vtenc.o OBJS-$(CONFIG_VP3DSP) += vp3dsp.o OBJS-$(CONFIG_VP56DSP) += vp56dsp.o OBJS-$(CONFIG_VP8DSP) += vp8dsp.o diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c index 9f60d7c..6465df0 100644 --- a/libavcodec/allcodecs.c +++ b/libavcodec/allcodecs.c @@ -605,6 +605,7 @@ void avcodec_register_all(void) REGISTER_ENCODER(HEVC_QSV, hevc_qsv); REGISTER_ENCODER(LIBKVAZAAR,libkvazaar); REGISTER_ENCODER(MPEG2_QSV, mpeg2_qsv); +REGISTER_ENCODER(VTENC_H264,vtenc_h264); /* parsers */ REGISTER_PARSER(AAC,aac); diff --git a/libavcodec/vtenc.c b/libavcodec/vtenc.c new file mode 100644 index 000..6f35930 --- /dev/null +++ b/libavcodec/vtenc.c @@ -0,0 +1,1269 @@ +/* + * copyright (c) 2015 Rick Kern + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include +#include +#include +#include +#include +#include "avcodec.h" +#include "libavutil/opt.h" +#include "libavutil/avassert.h" +#include "libavutil/atomic.h" +#include "libavutil/avstring.h" +#include "libavcodec/avcodec.h" +#include "internal.h" +#include + + +static const uint8_t start_code[] = { 0, 0, 0, 1 }; + +typedef struct BufNode { +CMSampleBuff
[FFmpeg-devel] [PATCH v4] Added VideoToolbox H.264 encoder.
vtenc.c was updated to match the coding style of the project. I used several other files to get a feel for the project's coding style. Is there documentation for this? Rick Kern (1): Added VideoToolbox H.264 encoder. MAINTAINERS|1 + configure |4 + libavcodec/Makefile|1 + libavcodec/allcodecs.c |1 + libavcodec/vtenc.c | 1269 5 files changed, 1276 insertions(+) create mode 100644 libavcodec/vtenc.c -- 2.4.9 (Apple Git-60) ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH v2] mpegencts: Fix overflow in cbr mode period calculations
ts->mux_rate is int (signed 32-bit) type. The period calculations will start to overflow when mux_rate > 5mbps. This fixes overflows by converting first to 64-bit type. Fixes #5044. Signed-off-by: Timo Teräs --- Seems av_rescale() was a bit overkill, and specifying the rounding mode made the code uglier.. So I just added an explicit cast now. libavformat/mpegtsenc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c index 468bad4..8591e8c 100644 --- a/libavformat/mpegtsenc.c +++ b/libavformat/mpegtsenc.c @@ -852,11 +852,11 @@ static int mpegts_write_header(AVFormatContext *s) ts_st = pcr_st->priv_data; if (ts->mux_rate > 1) { -service->pcr_packet_period = (ts->mux_rate * ts->pcr_period) / +service->pcr_packet_period = (int64_t)ts->mux_rate * ts->pcr_period / (TS_PACKET_SIZE * 8 * 1000); -ts->sdt_packet_period = (ts->mux_rate * SDT_RETRANS_TIME) / +ts->sdt_packet_period = (int64_t)ts->mux_rate * SDT_RETRANS_TIME / (TS_PACKET_SIZE * 8 * 1000); -ts->pat_packet_period = (ts->mux_rate * PAT_RETRANS_TIME) / +ts->pat_packet_period = (int64_t)ts->mux_rate * PAT_RETRANS_TIME / (TS_PACKET_SIZE * 8 * 1000); if (ts->copyts < 1) -- 2.6.3 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 1/4] avutil/tablegen: add tablegen libm compatibility shims
On 11/28/2015 5:03 PM, Ganesh Ajjanagadde wrote: > +static inline double ff_cbrt(double x) > +{ > +return x < 0 ? -pow(-x, 1.0 / 3.0) : pow(x, 1.0 / 3.0); > +} > +#define cbrt ff_cbrt Didn't Clément say to not pollute the global namespace like this? - Derek ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 4/4] avcodec/cbrt_tablegen: speed up dynamic table creation
On systems having cbrt, there is no reason to use the slow pow function. Sample benchmark (x86-64, Haswell, GNU/Linux): new: 5124920 decicycles in cbrt_tableinit, 1 runs, 0 skips old: 12321680 decicycles in cbrt_tableinit, 1 runs, 0 skips Reviewed-by: Ronald S. Bultje Signed-off-by: Ganesh Ajjanagadde --- libavcodec/cbrt_tablegen.h | 5 ++--- libavcodec/cbrt_tablegen_template.c | 1 + 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/libavcodec/cbrt_tablegen.h b/libavcodec/cbrt_tablegen.h index 27a3e3a..59b5a1d 100644 --- a/libavcodec/cbrt_tablegen.h +++ b/libavcodec/cbrt_tablegen.h @@ -29,7 +29,7 @@ #include "libavcodec/aac_defines.h" #if USE_FIXED -#define CBRT(x) (int)floor((x).f * 8192 + 0.5) +#define CBRT(x) lrint((x).f * 8192) #else #define CBRT(x) x.i #endif @@ -49,13 +49,12 @@ static av_cold void AAC_RENAME(cbrt_tableinit)(void) { if (!cbrt_tab[(1<<13) - 1]) { int i; -/* cbrtf() isn't available on all systems, so we use powf(). */ for (i = 0; i < 1<<13; i++) { union { float f; uint32_t i; } f; -f.f = pow(i, 1.0 / 3.0) * i; +f.f = cbrt(i) * i; cbrt_tab[i] = CBRT(f); } } diff --git a/libavcodec/cbrt_tablegen_template.c b/libavcodec/cbrt_tablegen_template.c index 9dd2cf5..1d71d34 100644 --- a/libavcodec/cbrt_tablegen_template.c +++ b/libavcodec/cbrt_tablegen_template.c @@ -23,6 +23,7 @@ #include #define CONFIG_HARDCODED_TABLES 0 #include "cbrt_tablegen.h" +#include "libavutil/tablegen.h" #include "tableprint.h" int main(void) -- 2.6.2 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 3/4] avcodec/mpegaudio_tablegen: more dynamic table creation speedups
This further speeds up runtime initialization, with identical generated tables. Sample benchmark (x86-64, Haswell, GNU/Linux): old: 34441423 decicycles in mpegaudio_tableinit,8192 runs, 0 skips new: 10776291 decicycles in mpegaudio_tableinit,8192 runs, 0 skips Most low hanging fruit is taken care of here. For some idea, note that 83,064 array elements totalling 233,722 bytes need to be initialized. Thus, with this patch, we average ~ 12.9 cycles per element or ~ 4.6 cycles per byte. Signed-off-by: Ganesh Ajjanagadde --- libavcodec/mpegaudio_tablegen.h | 22 +++--- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/libavcodec/mpegaudio_tablegen.h b/libavcodec/mpegaudio_tablegen.h index dd67a09..91b29cb 100644 --- a/libavcodec/mpegaudio_tablegen.h +++ b/libavcodec/mpegaudio_tablegen.h @@ -45,23 +45,28 @@ static float expval_table_float[512][16]; static av_cold void mpegaudio_tableinit(void) { int i, value, exponent; -double exp2_lut[4] = { +static const double exp2_lut[4] = { 1., /* 2 ^ (0 * 0.25) */ 1.18920711500272106672, /* 2 ^ (1 * 0.25) */ M_SQRT2 , /* 2 ^ (2 * 0.25) */ 1.68179283050742908606, /* 2 ^ (3 * 0.25) */ }; -double cbrt_lut[16]; +static double pow43_lut[16]; +double exp2_base = 2.11758236813575084767080625169910490512847900390625e-22; // 2^(-72) +double exp2_val; +double pow43_val = 0; for (i = 0; i < 16; ++i) -cbrt_lut[i] = cbrt(i); +pow43_lut[i] = i * cbrt(i); for (i = 1; i < TABLE_4_3_SIZE; i++) { -double value = i / 4; double f, fm; int e, m; -f = value / IMDCT_SCALAR * cbrt(value) * exp2_lut[i & 3]; +double value = i / 4; +if (i % 4 == 0) +pow43_val = value / IMDCT_SCALAR * cbrt(value); +f = pow43_val * exp2_lut[i & 3]; fm = frexp(f, &e); -m = (uint32_t)(fm * (1LL << 31) + 0.5); +m = llrint(fm * (1LL << 31)); e += FRAC_BITS - 31 + 5 - 100; /* normalized to FRAC_BITS */ @@ -69,8 +74,11 @@ static av_cold void mpegaudio_tableinit(void) table_4_3_exp[i] = -e; } for (exponent = 0; exponent < 512; exponent++) { +if (exponent && exponent % 4 == 0) +exp2_base *= 2; +exp2_val = exp2_base * exp2_lut[exponent % 4] / IMDCT_SCALAR; for (value = 0; value < 16; value++) { -double f = value * cbrt_lut[value] * pow(2, (exponent - 400) * 0.25 + FRAC_BITS + 5) / IMDCT_SCALAR; +double f = pow43_lut[value] * exp2_val; expval_table_fixed[exponent][value] = (f < 0x ? llrint(f) : 0x); expval_table_float[exponent][value] = f; } -- 2.6.2 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 2/4] avcodec/mpegaudio_tablegen: speed up dynamic table creation
This does some miscellaneous stuff mainly avoiding the usage of pow to achieve significant speedups. This is not speed critical, but is unnecessary latency and cycles wasted for a user. All tables tested and are identical to the old ones (bit-exact even in floating point case). Sample benchmark (x86-64, Haswell, GNU/Linux): old: 102329530 decicycles in mpegaudio_tableinit, 1 runs, 0 skips new: 34111900 decicycles in mpegaudio_tableinit, 1 runs, 0 skips Reviewed-by: Ronald S. Bultje Signed-off-by: Ganesh Ajjanagadde --- libavcodec/mpegaudio_tablegen.c | 1 + libavcodec/mpegaudio_tablegen.h | 19 +-- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/libavcodec/mpegaudio_tablegen.c b/libavcodec/mpegaudio_tablegen.c index 90c9de4..9a9bb4d 100644 --- a/libavcodec/mpegaudio_tablegen.c +++ b/libavcodec/mpegaudio_tablegen.c @@ -23,6 +23,7 @@ #include #define CONFIG_HARDCODED_TABLES 0 #include "mpegaudio_tablegen.h" +#include "libavutil/tablegen.h" #include "tableprint.h" int main(void) diff --git a/libavcodec/mpegaudio_tablegen.h b/libavcodec/mpegaudio_tablegen.h index 86b2cd3..dd67a09 100644 --- a/libavcodec/mpegaudio_tablegen.h +++ b/libavcodec/mpegaudio_tablegen.h @@ -45,12 +45,21 @@ static float expval_table_float[512][16]; static av_cold void mpegaudio_tableinit(void) { int i, value, exponent; +double exp2_lut[4] = { +1., /* 2 ^ (0 * 0.25) */ +1.18920711500272106672, /* 2 ^ (1 * 0.25) */ +M_SQRT2 , /* 2 ^ (2 * 0.25) */ +1.68179283050742908606, /* 2 ^ (3 * 0.25) */ +}; +double cbrt_lut[16]; +for (i = 0; i < 16; ++i) +cbrt_lut[i] = cbrt(i); + for (i = 1; i < TABLE_4_3_SIZE; i++) { double value = i / 4; double f, fm; int e, m; -/* cbrtf() isn't available on all systems, so we use powf(). */ -f = value / IMDCT_SCALAR * pow(value, 1.0 / 3.0) * pow(2, (i & 3) * 0.25); +f = value / IMDCT_SCALAR * cbrt(value) * exp2_lut[i & 3]; fm = frexp(f, &e); m = (uint32_t)(fm * (1LL << 31) + 0.5); e += FRAC_BITS - 31 + 5 - 100; @@ -61,10 +70,8 @@ static av_cold void mpegaudio_tableinit(void) } for (exponent = 0; exponent < 512; exponent++) { for (value = 0; value < 16; value++) { -/* cbrtf() isn't available on all systems, so we use powf(). */ -double f = (double)value * pow(value, 1.0 / 3.0) * pow(2, (exponent - 400) * 0.25 + FRAC_BITS + 5) / IMDCT_SCALAR; -/* llrint() isn't always available, so round and cast manually. */ -expval_table_fixed[exponent][value] = (long long int) (f < 0x ? floor(f + 0.5) : 0x); +double f = value * cbrt_lut[value] * pow(2, (exponent - 400) * 0.25 + FRAC_BITS + 5) / IMDCT_SCALAR; +expval_table_fixed[exponent][value] = (f < 0x ? llrint(f) : 0x); expval_table_float[exponent][value] = f; } exp_table_fixed[exponent] = expval_table_fixed[exponent][1]; -- 2.6.2 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 1/4] avutil/tablegen: add tablegen libm compatibility shims
This is useful for build-time table generation (--enable-hardcoded-tables), by providing compat shims for hosts that have broken libms. This file is deliberately kept minimal; functions can always be added on an as-needed basis. Reviewed-by: Clément Bœsch Reviewed-by: Ronald S. Bultje Signed-off-by: Ganesh Ajjanagadde --- libavutil/tablegen.h | 53 1 file changed, 53 insertions(+) create mode 100644 libavutil/tablegen.h diff --git a/libavutil/tablegen.h b/libavutil/tablegen.h new file mode 100644 index 000..f81b46b --- /dev/null +++ b/libavutil/tablegen.h @@ -0,0 +1,53 @@ +/* + * 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 + * Compatibility libm for table generation files + */ + +#ifndef AVUTIL_TABLEGEN_H +#define AVUTIL_TABLEGEN_H + +// we lack some functions on all host platforms, and we don't care about +// performance and/or strict ISO C semantics as it's performed at build time +static inline double ff_cbrt(double x) +{ +return x < 0 ? -pow(-x, 1.0 / 3.0) : pow(x, 1.0 / 3.0); +} +#define cbrt ff_cbrt + +static inline double ff_rint(double x) +{ +return x >= 0 ? floor(x + 0.5) : ceil(x - 0.5); +} +#define rint ff_rint + +static inline long long ff_llrint(double x) +{ +return rint(x); +} +#define llrint ff_llrint + +static inline long ff_lrint(double x) +{ +return rint(x); +} +#define lrint ff_lrint + +#endif /* AVUTIL_TABLEGEN_H */ -- 2.6.2 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 0/4] dynamic table generation improvements
This is a patch set that significantly speeds up dynamic table initialization (the default) on all platforms. The degree of speedup may vary; best results are obtained on a fully C99 compliant libm. In particular, benchmarks refer to the GNU/Linux platform. Patches tested with FATE with and without --enable-hardcoded-tables. The topic of deciding whether to: 1. Always use dynamic init 2. Always use static init 3. Leave as is for each of these two (cbrt_tablegen, mpegaudio_tablegen) is outside the scope of this patchset, as it is a far more subjective issue. Here, the benefits go to all users and packagers who do not use --enable-hardcoded-tables (the default configure line). Such users include among many others vlc, mpv, chromium, and the Arch Linux distribution. Ganesh Ajjanagadde (4): avutil/tablegen: add tablegen libm compatibility shims avcodec/mpegaudio_tablegen: speed up dynamic table creation avcodec/mpegaudio_tablegen: more dynamic table creation speedups avcodec/cbrt_tablegen: speed up dynamic table creation libavcodec/cbrt_tablegen.h | 5 ++- libavcodec/cbrt_tablegen_template.c| 1 + libavcodec/mpegaudio_tablegen.c| 1 + libavcodec/mpegaudio_tablegen.h| 31 +++- .../tablegen.h | 42 +++--- 5 files changed, 56 insertions(+), 24 deletions(-) copy libavcodec/cbrt_tablegen_template.c => libavutil/tablegen.h (51%) -- 2.6.2 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCHv2] avcodec/aac_tablegen: get rid of hardcoded tables entirely
On Sat, Nov 28, 2015 at 10:21 AM, Ganesh Ajjanagadde wrote: > On Sat, Nov 28, 2015 at 10:06 AM, Rostislav Pehlivanov > wrote: >> On Sat, 2015-11-28 at 09:45 -0500, Ganesh Ajjanagadde wrote: >>> >>> Removed the av_cold, did not find a way to cleanly get rid of the >>> inline. I do suggest giving it some thought; it is needless >>> executable >>> bloat since the inline does not help perf. Pushed, thanks. >>> >> Hardly a blot as it's really only used twice in the entire code and the >> function isn't a particularly big one. > > I was concerned since the generated tables are not huge; we do not > want to bloat the binary size with redundant code, else one may be > better off with hardcoded tables. > >> Moreover even if it was a big >> function used in a few more places GCC can and will magically uninline >> it > > Did not know that. I am somewhat skeptical - aacdec, aacenc (the two > usages) are compiled separately, so the compiler may lack this > information. At link time, in principle while stitching things > together, the duplication can be removed. But this will likely happen > on LTO only builds. LTO is currently very buggy - if > auto-vectorization itself is problematic in general for FFmpeg, LTO > should not be touched by any means for release builds. > > If both usages were in the same file, I agree with you. I read up some stuff and am fine with it now. Basically, some thought made me realize that C++ would have terrible bloat issues if stuff like this was not handled well by the toolchain - think of templates and multiple instantiations across translation units, a very common occurence that people (who know C++) don't complain about since they no it is a non issue for the final executable, though they still rightly complain about the build times. If interested, see https://stackoverflow.com/questions/2174657/when-are-header-only-libraries-acceptable, http://blog2.emptycrate.com/content/nobody-understands-c-part-5-template-code-bloat. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCHv2] avcodec/aac_tablegen: get rid of hardcoded tables entirely
On Sat, Nov 28, 2015 at 10:06 AM, Rostislav Pehlivanov wrote: > On Sat, 2015-11-28 at 09:45 -0500, Ganesh Ajjanagadde wrote: >> >> Removed the av_cold, did not find a way to cleanly get rid of the >> inline. I do suggest giving it some thought; it is needless >> executable >> bloat since the inline does not help perf. Pushed, thanks. >> > Hardly a blot as it's really only used twice in the entire code and the > function isn't a particularly big one. I was concerned since the generated tables are not huge; we do not want to bloat the binary size with redundant code, else one may be better off with hardcoded tables. > Moreover even if it was a big > function used in a few more places GCC can and will magically uninline > it Did not know that. I am somewhat skeptical - aacdec, aacenc (the two usages) are compiled separately, so the compiler may lack this information. At link time, in principle while stitching things together, the duplication can be removed. But this will likely happen on LTO only builds. LTO is currently very buggy - if auto-vectorization itself is problematic in general for FFmpeg, LTO should not be touched by any means for release builds. If both usages were in the same file, I agree with you. > (which is why I'm not really a fan of using av_always_inline for > every single function which has to be inlined, better to let the > compiler figure it out and if it can't it'll just inline it anyway). Agreed. > But I digress, the whole point of inlining this particlar function was > so it could be put inside the header and not inside aactab.c (which > contains no executable code at all). yes, this is why there is no clean solution, including aactab.h in aactab.c causes failures. > ___ > 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] [PATCHv2] avcodec/aac_tablegen: get rid of hardcoded tables entirely
On Sat, 2015-11-28 at 09:45 -0500, Ganesh Ajjanagadde wrote: > > Removed the av_cold, did not find a way to cleanly get rid of the > inline. I do suggest giving it some thought; it is needless > executable > bloat since the inline does not help perf. Pushed, thanks. > Hardly a blot as it's really only used twice in the entire code and the function isn't a particularly big one. Moreover even if it was a big function used in a few more places GCC can and will magically uninline it (which is why I'm not really a fan of using av_always_inline for every single function which has to be inlined, better to let the compiler figure it out and if it can't it'll just inline it anyway). But I digress, the whole point of inlining this particlar function was so it could be put inside the header and not inside aactab.c (which contains no executable code at all). ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH v3] Added VideoToolbox H.264 encoder.
On 11/28/15, Rick Kern wrote: > Enable with configure --enable-vtenc and encode using -codec:v vtenc_h264. > > Signed-off-by: Rick Kern > --- > MAINTAINERS|1 + > configure |4 + > libavcodec/Makefile|1 + > libavcodec/allcodecs.c |1 + > libavcodec/vtenc.c | 1212 > > 5 files changed, 1219 insertions(+) > create mode 100644 libavcodec/vtenc.c > please follow coding style, expecially spaces between =+- .. {}[] ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH v3] Added VideoToolbox H.264 encoder.
Fixed code review issues. Rick Kern (1): Added VideoToolbox H.264 encoder. MAINTAINERS|1 + configure |4 + libavcodec/Makefile|1 + libavcodec/allcodecs.c |1 + libavcodec/vtenc.c | 1212 5 files changed, 1219 insertions(+) create mode 100644 libavcodec/vtenc.c -- 2.4.9 (Apple Git-60) ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH v3] Added VideoToolbox H.264 encoder.
Enable with configure --enable-vtenc and encode using -codec:v vtenc_h264. Signed-off-by: Rick Kern --- MAINTAINERS|1 + configure |4 + libavcodec/Makefile|1 + libavcodec/allcodecs.c |1 + libavcodec/vtenc.c | 1212 5 files changed, 1219 insertions(+) create mode 100644 libavcodec/vtenc.c diff --git a/MAINTAINERS b/MAINTAINERS index 3735742..28782d2 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -286,6 +286,7 @@ Codecs: vp8 David Conrad, Jason Garrett-Glaser, Ronald Bultje vp9 Ronald Bultje, Clément Bœsch vqavideo.cMike Melanson + vtenc.c Rick Kern wavpack.c Kostya Shishkov wmaprodec.c Sascha Sommer wmavoice.cRonald S. Bultje diff --git a/configure b/configure index 0198b75..0322b3f 100755 --- a/configure +++ b/configure @@ -286,6 +286,7 @@ External library support: --disable-sdldisable sdl [autodetect] --disable-securetransport disable Secure Transport, needed for TLS support on OSX if openssl and gnutls are not used [autodetect] + --enable-vtenc enable VideoToolbox encoding support [no] --enable-x11grab enable X11 grabbing (legacy) [no] --disable-xlib disable xlib [autodetect] --disable-zlib disable zlib [autodetect] @@ -1473,6 +1474,7 @@ EXTERNAL_LIBRARY_LIST=" schannel sdl securetransport +vtenc x11grab xlib zlib @@ -2610,6 +2612,7 @@ libzvbi_teletext_decoder_deps="libzvbi" nvenc_encoder_deps="nvenc" nvenc_h264_encoder_deps="nvenc" nvenc_hevc_encoder_deps="nvenc" +vtenc_h264_encoder_deps="vtenc" # demuxers / muxers ac3_demuxer_select="ac3_parser" @@ -5473,6 +5476,7 @@ enabled openssl && { check_lib openssl/ssl.h SSL_library_init -lssl -l check_lib openssl/ssl.h SSL_library_init -lssl32 -leay32 || check_lib openssl/ssl.h SSL_library_init -lssl -lcrypto -lws2_32 -lgdi32 || die "ERROR: openssl not found"; } +enabled vtenc && require VideoToolbox VideoToolbox/VTCompressionSession.h VTCompressionSessionPrepareToEncodeFrames -framework VideoToolbox enabled qtkit_indev && { check_header_oc QTKit/QTKit.h || disable qtkit_indev; } if enabled gnutls; then diff --git a/libavcodec/Makefile b/libavcodec/Makefile index 68a573f..afb38e4 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -116,6 +116,7 @@ OBJS-$(CONFIG_TEXTUREDSP) += texturedsp.o OBJS-$(CONFIG_TEXTUREDSPENC) += texturedspenc.o OBJS-$(CONFIG_TPELDSP) += tpeldsp.o OBJS-$(CONFIG_VIDEODSP)+= videodsp.o +OBJS-$(CONFIG_VTENC) += vtenc.o OBJS-$(CONFIG_VP3DSP) += vp3dsp.o OBJS-$(CONFIG_VP56DSP) += vp56dsp.o OBJS-$(CONFIG_VP8DSP) += vp8dsp.o diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c index 9f60d7c..6465df0 100644 --- a/libavcodec/allcodecs.c +++ b/libavcodec/allcodecs.c @@ -605,6 +605,7 @@ void avcodec_register_all(void) REGISTER_ENCODER(HEVC_QSV, hevc_qsv); REGISTER_ENCODER(LIBKVAZAAR,libkvazaar); REGISTER_ENCODER(MPEG2_QSV, mpeg2_qsv); +REGISTER_ENCODER(VTENC_H264,vtenc_h264); /* parsers */ REGISTER_PARSER(AAC,aac); diff --git a/libavcodec/vtenc.c b/libavcodec/vtenc.c new file mode 100644 index 000..b8b35a9 --- /dev/null +++ b/libavcodec/vtenc.c @@ -0,0 +1,1212 @@ +/* + * copyright (c) 2015 Rick Kern + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include +#include +#include +#include +#include +#include "avcodec.h" +#include "libavutil/opt.h" +#include "libavutil/avassert.h" +#include "libavutil/atomic.h" +#include "libavutil/avstring.h" +#include "libavcodec/avcodec.h" +#include "internal.h" +#include + + +static const uint8_t start_code[] = {0, 0, 0, 1}; + +typedef struct BufNode{ +CMSampleBufferR
Re: [FFmpeg-devel] [PATCH 1/5] lavf: add FFERROR_REDO to let demuxer return no packet.
On Sat, Nov 28, 2015 at 09:08:52AM +0100, Nicolas George wrote: > Le septidi 7 frimaire, an CCXXIV, Clement Boesch a écrit : > > "returned internally by demuxers" maybe > > That sounds to me like an oxymoron. IMHO, being in internal.h and named > FFERROR instead of AVERROR should be enough (even separately). > ok > > nit: space issue > > Locally fixed. > > > when they data? > > Locally amended to: > > /* Some demuxer return FFERROR_REDO when they consume >data and discard it (ignored streams, junk, extradata). >We must re-call the demuxer to get the real packet. */ > > And locally changed "demuxers" to plural in the commit message. > but not in the beginning of the sentence above? -- Clément B. signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCHv2] avcodec/aac_tablegen: get rid of hardcoded tables entirely
On Sat, Nov 28, 2015 at 7:50 AM, Ganesh Ajjanagadde wrote: > On Sat, Nov 28, 2015 at 3:38 AM, Rostislav Pehlivanov > wrote: >> On Fri, 2015-11-27 at 19:35 -0500, Ganesh Ajjanagadde wrote: >>> >>> @@ -40,6 +39,57 @@ >>> * Tables in this file are shared by the AAC decoders and encoder >>> */ >>> >>> +#define POW_SF2_ZERO200///< ff_aac_pow2sf_tab index >>> corresponding to pow(2, 0); >> >> Move POW_SF2_ZERO to aac.h, which is already included by aactab.h and >> by everything else which uses it, so it'll be fine. Just put it like >> this: >> >> aac.h: >>> 152 #define SCALE_DIFF_ZERO 60 // >>> 153 + >>> 154 + #define POW_SF2_ZERO200 // >>> 155 >>> 156 #define NOISE_PRE 256 // > > ok, done. > >> >> >>> + >>> +extern float ff_aac_pow2sf_tab[428]; >>> +extern float ff_aac_pow34sf_tab[428]; >>> + >>> +static av_cold inline void ff_aac_tableinit(void) >>> +{ >> >> The av_cold attribute seems pointless here. Since the function is >> inlined and always executed on the already av_cold decoder and encoder >> table init functions there shouldn't be a branch making it pointless. > > Personally, I don't want this inlined, but could not do so in a way > that keeps the compiler and linker happy after some attempts (see the > caveat I posted). I want to try this again, unless you know what to do > here. Removed the av_cold, did not find a way to cleanly get rid of the inline. I do suggest giving it some thought; it is needless executable bloat since the inline does not help perf. Pushed, thanks. [...] ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avcodec/mpegaudio_tablegen: more dynamic initialization speedups
On Sat, Nov 28, 2015 at 8:48 AM, Ronald S. Bultje wrote: > Hi, > > On Sat, Nov 28, 2015 at 12:46 AM, Ganesh Ajjanagadde > wrote: >> >> I personally consider this net ~ 10x and overall perf numbers sufficient >> for using dynamic initialization all the time here, especially since the >> tables are large. > > > This is a logical fallacy. By this logic, I could post some really shitty > code, speed it up 10x and then say "I made it better so it should be > default", regardless of what the actual quality of the current code is. > > If you want to argue for dynamic vs. static table default choice, you should > compare only these two currents (dynamic vs static), not the improvement of > an old dynamic vs current dynamic table generation. What is the "logical fallacy here"? My point was that previously the code was much slower, now it is much faster, and is fast enough for my own personal tastes to be made the default. Static vs dynamic is mostly a speed vs size tradeoff. I have increased the speed, and have essentially made it a Pareto optimal point on the speed vs size tradeoff as far as I can tell - at this level of space usage, there is not really anything that can be done. If you don't feel that way, please tell me and I will improve it further. Whether that is sufficient to make it the default is of course subjective. [...] ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avcodec/mpegaudio_tablegen: more dynamic initialization speedups
Hi, On Sat, Nov 28, 2015 at 12:46 AM, Ganesh Ajjanagadde wrote: > I personally consider this net ~ 10x and overall perf numbers sufficient > for using dynamic initialization all the time here, especially since the > tables are large. This is a logical fallacy. By this logic, I could post some really shitty code, speed it up 10x and then say "I made it better so it should be default", regardless of what the actual quality of the current code is. If you want to argue for dynamic vs. static table default choice, you should compare only these two currents (dynamic vs static), not the improvement of an old dynamic vs current dynamic table generation. (I have no opinion on which default should be chosen, although >1M post-patch cycles seems like enough of a reason for me to say that static tables serves a real use case, particularly on slower devices.) Ronald ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCHv2] avcodec/aac_tablegen: get rid of hardcoded tables entirely
On Sat, Nov 28, 2015 at 3:38 AM, Rostislav Pehlivanov wrote: > On Fri, 2015-11-27 at 19:35 -0500, Ganesh Ajjanagadde wrote: >> >> @@ -40,6 +39,57 @@ >> * Tables in this file are shared by the AAC decoders and encoder >> */ >> >> +#define POW_SF2_ZERO200///< ff_aac_pow2sf_tab index >> corresponding to pow(2, 0); > > Move POW_SF2_ZERO to aac.h, which is already included by aactab.h and > by everything else which uses it, so it'll be fine. Just put it like > this: > > aac.h: >> 152 #define SCALE_DIFF_ZERO 60 // >> 153 + >> 154 + #define POW_SF2_ZERO200 // >> 155 >> 156 #define NOISE_PRE 256 // ok, done. > > >> + >> +extern float ff_aac_pow2sf_tab[428]; >> +extern float ff_aac_pow34sf_tab[428]; >> + >> +static av_cold inline void ff_aac_tableinit(void) >> +{ > > The av_cold attribute seems pointless here. Since the function is > inlined and always executed on the already av_cold decoder and encoder > table init functions there shouldn't be a branch making it pointless. Personally, I don't want this inlined, but could not do so in a way that keeps the compiler and linker happy after some attempts (see the caveat I posted). I want to try this again, unless you know what to do here. > > Other than those 2 remarks, looks good to me. > ___ > 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] avcodec/mpegaudio_tablegen: more dynamic initialization speedups
On Sat, Nov 28, 2015 at 7:27 AM, Ganesh Ajjanagadde wrote: > On Sat, Nov 28, 2015 at 4:41 AM, Michael Niedermayer wrote: >> On Sat, Nov 28, 2015 at 12:46:31AM -0500, Ganesh Ajjanagadde wrote: >>> This further speeds up runtime initialization, with identical generated >>> tables. >>> >>> Sample benchmark (x86-64, Haswell, GNU/Linux): >>> >>> old: >>> 34441423 decicycles in mpegaudio_tableinit,8192 runs, 0 skips >>> >>> new: >>> 10776291 decicycles in mpegaudio_tableinit,8192 runs, 0 skips >>> >>> Most low hanging fruit is taken care of here. For some idea, note that >>> 83,064 array elements totalling 233,722 bytes need to be initialized. >>> Thus, with this patch, we average ~ 12.9 cycles per element or ~ 4.6 >>> cycles per byte. >>> >>> I personally consider this net ~ 10x and overall perf numbers sufficient >>> for using dynamic initialization all the time here, especially since the >>> tables are large. >>> >>> Signed-off-by: Ganesh Ajjanagadde >>> --- >>> The reason this is being posted before pushing in the other one is that if >>> people agree to do dynamic initialization here, the introduction of >>> avutil/tablegen >>> can be deferred to a future date. >>> >>> Note that if one had a ~8000 element static lut for the pow_43 values, >>> one can bring down the cost slightly, to ~ 8-10 cycles per element but not >>> more, >>> so definitely not an order of improvement like the current patches. >>> I personally do not like this "middle path" as I find it too complex for a >>> slight >>> speed gain, while still having a large ~ 64,000 byte size cost. >>> --- >>> libavcodec/mpegaudio_tablegen.h | 22 +++--- >>> 1 file changed, 15 insertions(+), 7 deletions(-) >>> >>> diff --git a/libavcodec/mpegaudio_tablegen.h >>> b/libavcodec/mpegaudio_tablegen.h >>> index dd67a09..91b29cb 100644 >>> --- a/libavcodec/mpegaudio_tablegen.h >>> +++ b/libavcodec/mpegaudio_tablegen.h >> >> seems this doesnt apply > > It was not meant to be directly applied, but only after the other > mpegaudio_tablegen.h patch: > https://ffmpeg.org/pipermail/ffmpeg-devel/2015-November/183914.html > has been applied with the first speedup. Even that may not apply cleanly, since there was some minor renaming done based on comments by Ronald. Basically, I request an answer to the 3 alternatives I posted before moving forward, creating a clean patchset, etc. Or if you really want to verify this yourself before answering the 3 alternatives, I can create a clean 2 patch set now itself, with the caveat that they can't be applied to master yet (which requires an answer to the 3 alternatives). [...] ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avcodec/mpegaudio_tablegen: more dynamic initialization speedups
On Sat, Nov 28, 2015 at 4:41 AM, Michael Niedermayer wrote: > On Sat, Nov 28, 2015 at 12:46:31AM -0500, Ganesh Ajjanagadde wrote: >> This further speeds up runtime initialization, with identical generated >> tables. >> >> Sample benchmark (x86-64, Haswell, GNU/Linux): >> >> old: >> 34441423 decicycles in mpegaudio_tableinit,8192 runs, 0 skips >> >> new: >> 10776291 decicycles in mpegaudio_tableinit,8192 runs, 0 skips >> >> Most low hanging fruit is taken care of here. For some idea, note that >> 83,064 array elements totalling 233,722 bytes need to be initialized. >> Thus, with this patch, we average ~ 12.9 cycles per element or ~ 4.6 >> cycles per byte. >> >> I personally consider this net ~ 10x and overall perf numbers sufficient >> for using dynamic initialization all the time here, especially since the >> tables are large. >> >> Signed-off-by: Ganesh Ajjanagadde >> --- >> The reason this is being posted before pushing in the other one is that if >> people agree to do dynamic initialization here, the introduction of >> avutil/tablegen >> can be deferred to a future date. >> >> Note that if one had a ~8000 element static lut for the pow_43 values, >> one can bring down the cost slightly, to ~ 8-10 cycles per element but not >> more, >> so definitely not an order of improvement like the current patches. >> I personally do not like this "middle path" as I find it too complex for a >> slight >> speed gain, while still having a large ~ 64,000 byte size cost. >> --- >> libavcodec/mpegaudio_tablegen.h | 22 +++--- >> 1 file changed, 15 insertions(+), 7 deletions(-) >> >> diff --git a/libavcodec/mpegaudio_tablegen.h >> b/libavcodec/mpegaudio_tablegen.h >> index dd67a09..91b29cb 100644 >> --- a/libavcodec/mpegaudio_tablegen.h >> +++ b/libavcodec/mpegaudio_tablegen.h > > seems this doesnt apply It was not meant to be directly applied, but only after the other mpegaudio_tablegen.h patch: https://ffmpeg.org/pipermail/ffmpeg-devel/2015-November/183914.html has been applied with the first speedup. There might also be an issue with my comments placed in //comment ; I don't know if that is the right way of adding such things. The comment was added simply to clarify - because if we go forward and decide to do this dynamically, I will create another patch for getting rid of hard-coded tables ifdefry here (and make it into a nice 3 patch series). In such a case, I don't want to bother with avutil/tablegen yet as it has greater scope for regressions. And if we don't want to do it dynamically, then there is no point at all to these patches. Lastly, the third option of retaining the hardcoded tables ifdefry here to me seems pointless - I really like wm4's idea of deciding cleanly which ones to do dynamically and which ones to do at build time. This is one (as the comment suggests) where I personally feel like doing it at runtime. This file lacks a MAINTAINERS entry, but it seems like you maintain other mpeg stuff. Thus, in the end and in absence of other comments, I think it is your call. Here are the options, in decreasing order of my personal preference: 1. Do this always at run time - this patch and the previous one are worthy, but should be combined with removal of the ifdefry to get a 3 patch series. 2. Do this always at build time - then this patch and the previous one in the link are useless and may be dropped. 3. Continue to be on the fence - this patch and the previous one are worthy, since most clients do not do --enable-hardcoded-tables (vlc, mpv, chromium?). But it needs to be combined with the avutil/tablegen stuff, which has not been pushed/fully reviewed yet. This one I strongly dislike, and agree with wm4 on this note. [...] ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] configure: Add user options to enable gcrypt/gmp for rtmp(t)e support.
On 22 November 2015 at 04:20, Matt Oliver wrote: > On 22 November 2015 at 03:48, Ricardo Constantino > wrote: > >> >+ --enable-gcrypt enable gmp, needed for rtmp(t)e support >> >+ if openssl, librtmp or gmp is not used [no] >> >> Probably meant "enable gcrypt" there? >> >> > Damn, cant believe I missed that one, will update that tomorrow. > Just realised I replied with the updated patch to a different thread. Anyway since there havnt been any objections ill apply this patch in the next day or so (assuming noone objects between now and then). 0001-configure-Add-user-options-to-enable-gcrypt-gmp-for-.patch Description: Binary data ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avcodec/mpegaudio_tablegen: more dynamic initialization speedups
On Sat, Nov 28, 2015 at 12:46:31AM -0500, Ganesh Ajjanagadde wrote: > This further speeds up runtime initialization, with identical generated > tables. > > Sample benchmark (x86-64, Haswell, GNU/Linux): > > old: > 34441423 decicycles in mpegaudio_tableinit,8192 runs, 0 skips > > new: > 10776291 decicycles in mpegaudio_tableinit,8192 runs, 0 skips > > Most low hanging fruit is taken care of here. For some idea, note that > 83,064 array elements totalling 233,722 bytes need to be initialized. > Thus, with this patch, we average ~ 12.9 cycles per element or ~ 4.6 > cycles per byte. > > I personally consider this net ~ 10x and overall perf numbers sufficient > for using dynamic initialization all the time here, especially since the > tables are large. > > Signed-off-by: Ganesh Ajjanagadde > --- > The reason this is being posted before pushing in the other one is that if > people agree to do dynamic initialization here, the introduction of > avutil/tablegen > can be deferred to a future date. > > Note that if one had a ~8000 element static lut for the pow_43 values, > one can bring down the cost slightly, to ~ 8-10 cycles per element but not > more, > so definitely not an order of improvement like the current patches. > I personally do not like this "middle path" as I find it too complex for a > slight > speed gain, while still having a large ~ 64,000 byte size cost. > --- > libavcodec/mpegaudio_tablegen.h | 22 +++--- > 1 file changed, 15 insertions(+), 7 deletions(-) > > diff --git a/libavcodec/mpegaudio_tablegen.h b/libavcodec/mpegaudio_tablegen.h > index dd67a09..91b29cb 100644 > --- a/libavcodec/mpegaudio_tablegen.h > +++ b/libavcodec/mpegaudio_tablegen.h seems this doesnt apply Applying: avcodec/mpegaudio_tablegen: more dynamic initialization speedups Using index info to reconstruct a base tree... error: patch failed: libavcodec/mpegaudio_tablegen.h:45 error: libavcodec/mpegaudio_tablegen.h: patch does not apply Did you hand edit your patch? It does not apply to blobs recorded in its index. Cannot fall back to three-way merge. Patch failed at 0001 avcodec/mpegaudio_tablegen: more dynamic initialization speedups When you have resolved this problem run "git am --resolved". If you would prefer to skip this patch, instead run "git am --skip". To restore the original branch and stop patching run "git am --abort". [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB it is not once nor twice but times without number that the same ideas make their appearance in the world. -- Aristotle signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCHv2] avcodec/aac_tablegen: get rid of hardcoded tables entirely
On Fri, 2015-11-27 at 19:35 -0500, Ganesh Ajjanagadde wrote: > > @@ -40,6 +39,57 @@ > * Tables in this file are shared by the AAC decoders and encoder > */ > > +#define POW_SF2_ZERO200///< ff_aac_pow2sf_tab index > corresponding to pow(2, 0); Move POW_SF2_ZERO to aac.h, which is already included by aactab.h and by everything else which uses it, so it'll be fine. Just put it like this: aac.h: > 152 #define SCALE_DIFF_ZERO 60 // > 153 + > 154 + #define POW_SF2_ZERO200 // > 155 > 156 #define NOISE_PRE 256 // > + > +extern float ff_aac_pow2sf_tab[428]; > +extern float ff_aac_pow34sf_tab[428]; > + > +static av_cold inline void ff_aac_tableinit(void) > +{ The av_cold attribute seems pointless here. Since the function is inlined and always executed on the already av_cold decoder and encoder table init functions there shouldn't be a branch making it pointless. Other than those 2 remarks, looks good to me. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 1/5] lavf: add FFERROR_REDO to let demuxer return no packet.
Le septidi 7 frimaire, an CCXXIV, Clement Boesch a écrit : > "returned internally by demuxers" maybe That sounds to me like an oxymoron. IMHO, being in internal.h and named FFERROR instead of AVERROR should be enough (even separately). > nit: space issue Locally fixed. > when they data? Locally amended to: /* Some demuxer return FFERROR_REDO when they consume data and discard it (ignored streams, junk, extradata). We must re-call the demuxer to get the real packet. */ And locally changed "demuxers" to plural in the commit message. Regards, -- Nicolas George signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel