Re: [FFmpeg-devel] [PATCH] Allow mpjpeg demuxer to process MIME parts which do not include Content-Length header.
Le nonidi 9 frimaire, an CCXXIV, Alexander Agranovsky a écrit : > Please see the updated patches attached. The trimming loop that was subject > of the discussion had been rewritten to use indices rather than pointer > arithmetics. This kind of drastic change was not necessary, you can do the same with pointers. IMHO, the best way of dealing with that situation is this: when dealing with the end of the string, have the pointer point AFTER the end of the string, i.e.: char *p = string + strlen(string); // not -1 if (p > string && av_isspace(p[-1])) *(--p) = 0; > +char* boundary; Here and in all new code, please use "char *var" instead of "char* var" for consistency. There is a good reason for that: "char* a, b" means that a is a pointer and b is not, grouping the pointer mark with the type is misleading. > +"Expected boundary '%s' not found, instead found a line of > %lu bytes\n", > +expected_boundary, > +strlen(line)); "%lu" is not correct for size_t. The correct type would be %zu, but it is possible that we have to use another construct to avoid bugs from microsoft libraries, see other instances in the code for examples. > -size = parse_content_length(value); > -if (size < 0) > -return size; > +*size = parse_content_length(value); Did you remove the check on purpose? > +if (!av_strncasecmp(start, "boundary=", 9)) { > +start += 9; It has already be pointed out: av_stristart() to avoid the duplicated magic number. Can not comment on the functional aspect, sorry. Regards, -- Nicolas George signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] avcodec/aacsbr_tablegen: always initialize tables at runtime
This gets rid of virtually useless hardcoded tables hackery. The reason it is useless is that a 320 element lut is anyway placed regardless of --enable-hardcoded-tables, from which all necessary tables are trivially derived at runtime at very low cost: sample benchmark (x86-64, Haswell, GNU/Linux, single run is really what is relevant here since looping drastically changes the bench). Fluctuations are on the order of 10% for the single run test: 39400 decicycles in aacsbr_tableinit, 1 runs, 0 skips 25325 decicycles in aacsbr_tableinit, 2 runs, 0 skips 18475 decicycles in aacsbr_tableinit, 4 runs, 0 skips 15008 decicycles in aacsbr_tableinit, 8 runs, 0 skips 13016 decicycles in aacsbr_tableinit, 16 runs, 0 skips 12005 decicycles in aacsbr_tableinit, 32 runs, 0 skips 11546 decicycles in aacsbr_tableinit, 64 runs, 0 skips 11506 decicycles in aacsbr_tableinit, 128 runs, 0 skips 11500 decicycles in aacsbr_tableinit, 256 runs, 0 skips 11183 decicycles in aacsbr_tableinit, 509 runs, 3 skips Tested with FATE with/without --enable-hardcoded-tables. Signed-off-by: Ganesh Ajjanagadde --- libavcodec/Makefile | 8 ++- libavcodec/aacsbr_fixed_tablegen.c | 42 - libavcodec/aacsbr_fixed_tablegen.h | 4 libavcodec/aacsbr_tablegen.c| 42 - libavcodec/aacsbr_tablegen.h| 4 libavcodec/aacsbr_tablegen_common.h | 4 6 files changed, 2 insertions(+), 102 deletions(-) delete mode 100644 libavcodec/aacsbr_fixed_tablegen.c delete mode 100644 libavcodec/aacsbr_tablegen.c diff --git a/libavcodec/Makefile b/libavcodec/Makefile index d85215d..a4c35b9 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -965,8 +965,6 @@ TOOLS = fourcc2pixfmt HOSTPROGS = aacps_tablegen \ aacps_fixed_tablegen\ -aacsbr_tablegen \ -aacsbr_fixed_tablegen \ cbrt_tablegen \ cbrt_fixed_tablegen \ cos_tablegen\ @@ -996,8 +994,8 @@ else $(SUBDIR)%_tablegen$(HOSTEXESUF): HOSTCFLAGS += -DCONFIG_SMALL=0 endif -GEN_HEADERS = cbrt_tables.h cbrt_fixed_tables.h aacps_tables.h aacps_fixed_tables.h aacsbr_tables.h \ - aacsbr_fixed_tables.h dsd_tables.h dv_tables.h \ +GEN_HEADERS = cbrt_tables.h cbrt_fixed_tables.h aacps_tables.h aacps_fixed_tables.h \ + dsd_tables.h dv_tables.h \ sinewin_tables.h sinewin_fixed_tables.h mpegaudio_tables.h motionpixels_tables.h \ pcm_tables.h qdm2_tables.h GEN_HEADERS := $(addprefix $(SUBDIR), $(GEN_HEADERS)) @@ -1010,8 +1008,6 @@ $(SUBDIR)aacdec.o: $(SUBDIR)cbrt_tables.h $(SUBDIR)aacdec_fixed.o: $(SUBDIR)cbrt_fixed_tables.h $(SUBDIR)aacps_float.o: $(SUBDIR)aacps_tables.h $(SUBDIR)aacps_fixed.o: $(SUBDIR)aacps_fixed_tables.h -$(SUBDIR)aacsbr.o: $(SUBDIR)aacsbr_tables.h -$(SUBDIR)aacsbr_fixed.o: $(SUBDIR)aacsbr_fixed_tables.h $(SUBDIR)aactab_fixed.o: $(SUBDIR)aac_fixed_tables.h $(SUBDIR)dsddec.o: $(SUBDIR)dsd_tables.h $(SUBDIR)dvenc.o: $(SUBDIR)dv_tables.h diff --git a/libavcodec/aacsbr_fixed_tablegen.c b/libavcodec/aacsbr_fixed_tablegen.c deleted file mode 100644 index b896d75..000 --- a/libavcodec/aacsbr_fixed_tablegen.c +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Header file for hardcoded AAC SBR windows - * - * Copyright (c) 2014 Reimar Döffinger - * - * 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 "libavutil/internal.h" -#include "libavutil/common.h" -#undef CONFIG_HARDCODED_TABLES -#define CONFIG_HARDCODED_TABLES 0 -#define USE_FIXED 1 -#include "aacsbr_fixed_tablegen.h" -#include "tableprint.h" - -int main(void) -{ -aacsbr_tableinit(); - -write_fileheader(); - -WRITE_ARRAY_ALIGNED("static const", 32, int32_t, sbr_qmf_window_ds); -WRITE_ARRAY_ALIGNED("static const", 32, int32_t, sbr_qmf_windo
Re: [FFmpeg-devel] [PATCH] avutil/crc: avoid needless space wastage of hardcoded crc table
On 11/30/2015 12:02 AM, Ganesh Ajjanagadde wrote: > On Sun, Nov 29, 2015 at 9:58 PM, James Almer wrote: >> On 11/29/2015 11:45 PM, Ronald S. Bultje wrote: >>> Hi, >>> >>> On Sun, Nov 29, 2015 at 9:41 PM, Ganesh Ajjanagadde >>> wrote: >>> There was no reason AFAIK for making AV_CRC_24_IEEE 12. This simply resulted in wasted space under --enable-hardcoded-tables: dynamic: 1318672 libavutil/libavutil.so.55 old: 1330680 libavutil/libavutil.so.55 new: 1326488 libavutil/libavutil.so.55 Minor version number is bumped. Signed-off-by: Ganesh Ajjanagadde --- libavutil/crc.h | 2 +- libavutil/version.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libavutil/crc.h b/libavutil/crc.h index e86bf1d..61592df 100644 --- a/libavutil/crc.h +++ b/libavutil/crc.h @@ -40,7 +40,7 @@ typedef enum { AV_CRC_32_IEEE, AV_CRC_32_IEEE_LE, /*< reversed bitorder version of AV_CRC_32_IEEE */ AV_CRC_16_ANSI_LE, /*< reversed bitorder version of AV_CRC_16_ANSI */ -AV_CRC_24_IEEE = 12, +AV_CRC_24_IEEE, AV_CRC_MAX, /*< Not part of public API! Do not use outside libavutil. */ }AVCRCId; >>> >>> >>> I support the idea, but this breaks ABI. You need to do this under a >>> version bump, see libavutil/version.h for templates. >> >> One could argue no releases have been made since the last major bump, so >> breakages >> like this are unlikely to affect anyone. But then again, it's been months >> since said >> major bump. >> What's been chosen in previous bumps as the drawing line for ABI breakages? >> Some >> arbitrary amount of time after the last bump (like the month mentioned in >> APIChanges), >> or first release post bump? > > Can one include version.h in crc.h, test if version >= , version < , > etc using the preprocessor, and accordingly define the enum? Yes. As Ronald said, check version.h for templates about how to schedule ABI changes and API deprecations. See the FF_API defines and grep the tree to see how they are used. That aside, your patch may be able to go in without having to litter the code with unnecessary FF_API or similar ifdeffery depending on what others say about my question above. > >> >>> >>> Ronald >>> ___ >>> 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 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] avutil/crc: avoid needless space wastage of hardcoded crc table
On Sun, Nov 29, 2015 at 9:58 PM, James Almer wrote: > On 11/29/2015 11:45 PM, Ronald S. Bultje wrote: >> Hi, >> >> On Sun, Nov 29, 2015 at 9:41 PM, Ganesh Ajjanagadde >> wrote: >> >>> There was no reason AFAIK for making AV_CRC_24_IEEE 12. This simply >>> resulted in wasted space under --enable-hardcoded-tables: >>> dynamic: 1318672 libavutil/libavutil.so.55 >>> old: 1330680 libavutil/libavutil.so.55 >>> new: 1326488 libavutil/libavutil.so.55 >>> >>> Minor version number is bumped. >>> >>> Signed-off-by: Ganesh Ajjanagadde >>> --- >>> libavutil/crc.h | 2 +- >>> libavutil/version.h | 2 +- >>> 2 files changed, 2 insertions(+), 2 deletions(-) >>> >>> diff --git a/libavutil/crc.h b/libavutil/crc.h >>> index e86bf1d..61592df 100644 >>> --- a/libavutil/crc.h >>> +++ b/libavutil/crc.h >>> @@ -40,7 +40,7 @@ typedef enum { >>> AV_CRC_32_IEEE, >>> AV_CRC_32_IEEE_LE, /*< reversed bitorder version of AV_CRC_32_IEEE */ >>> AV_CRC_16_ANSI_LE, /*< reversed bitorder version of AV_CRC_16_ANSI */ >>> -AV_CRC_24_IEEE = 12, >>> +AV_CRC_24_IEEE, >>> AV_CRC_MAX, /*< Not part of public API! Do not use outside >>> libavutil. */ >>> }AVCRCId; >> >> >> I support the idea, but this breaks ABI. You need to do this under a >> version bump, see libavutil/version.h for templates. > > One could argue no releases have been made since the last major bump, so > breakages > like this are unlikely to affect anyone. But then again, it's been months > since said > major bump. > What's been chosen in previous bumps as the drawing line for ABI breakages? > Some > arbitrary amount of time after the last bump (like the month mentioned in > APIChanges), > or first release post bump? Can one include version.h in crc.h, test if version >= , version < , etc using the preprocessor, and accordingly define the enum? > >> >> Ronald >> ___ >> 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 mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avutil/crc: avoid needless space wastage of hardcoded crc table
On 11/29/2015 11:45 PM, Ronald S. Bultje wrote: > Hi, > > On Sun, Nov 29, 2015 at 9:41 PM, Ganesh Ajjanagadde > wrote: > >> There was no reason AFAIK for making AV_CRC_24_IEEE 12. This simply >> resulted in wasted space under --enable-hardcoded-tables: >> dynamic: 1318672 libavutil/libavutil.so.55 >> old: 1330680 libavutil/libavutil.so.55 >> new: 1326488 libavutil/libavutil.so.55 >> >> Minor version number is bumped. >> >> Signed-off-by: Ganesh Ajjanagadde >> --- >> libavutil/crc.h | 2 +- >> libavutil/version.h | 2 +- >> 2 files changed, 2 insertions(+), 2 deletions(-) >> >> diff --git a/libavutil/crc.h b/libavutil/crc.h >> index e86bf1d..61592df 100644 >> --- a/libavutil/crc.h >> +++ b/libavutil/crc.h >> @@ -40,7 +40,7 @@ typedef enum { >> AV_CRC_32_IEEE, >> AV_CRC_32_IEEE_LE, /*< reversed bitorder version of AV_CRC_32_IEEE */ >> AV_CRC_16_ANSI_LE, /*< reversed bitorder version of AV_CRC_16_ANSI */ >> -AV_CRC_24_IEEE = 12, >> +AV_CRC_24_IEEE, >> AV_CRC_MAX, /*< Not part of public API! Do not use outside >> libavutil. */ >> }AVCRCId; > > > I support the idea, but this breaks ABI. You need to do this under a > version bump, see libavutil/version.h for templates. One could argue no releases have been made since the last major bump, so breakages like this are unlikely to affect anyone. But then again, it's been months since said major bump. What's been chosen in previous bumps as the drawing line for ABI breakages? Some arbitrary amount of time after the last bump (like the month mentioned in APIChanges), or first release post bump? > > Ronald > ___ > 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] avutil/crc: avoid needless space wastage of hardcoded crc table
On 11/29/2015 11:50 PM, Ganesh Ajjanagadde wrote: > On Sun, Nov 29, 2015 at 9:45 PM, Ronald S. Bultje wrote: >> Hi, >> >> On Sun, Nov 29, 2015 at 9:41 PM, Ganesh Ajjanagadde >> wrote: >>> >>> There was no reason AFAIK for making AV_CRC_24_IEEE 12. This simply >>> resulted in wasted space under --enable-hardcoded-tables: >>> dynamic: 1318672 libavutil/libavutil.so.55 >>> old: 1330680 libavutil/libavutil.so.55 >>> new: 1326488 libavutil/libavutil.so.55 >>> >>> Minor version number is bumped. >>> >>> Signed-off-by: Ganesh Ajjanagadde >>> --- >>> libavutil/crc.h | 2 +- >>> libavutil/version.h | 2 +- >>> 2 files changed, 2 insertions(+), 2 deletions(-) >>> >>> diff --git a/libavutil/crc.h b/libavutil/crc.h >>> index e86bf1d..61592df 100644 >>> --- a/libavutil/crc.h >>> +++ b/libavutil/crc.h >>> @@ -40,7 +40,7 @@ typedef enum { >>> AV_CRC_32_IEEE, >>> AV_CRC_32_IEEE_LE, /*< reversed bitorder version of AV_CRC_32_IEEE >>> */ >>> AV_CRC_16_ANSI_LE, /*< reversed bitorder version of AV_CRC_16_ANSI >>> */ >>> -AV_CRC_24_IEEE = 12, >>> +AV_CRC_24_IEEE, >>> AV_CRC_MAX, /*< Not part of public API! Do not use outside >>> libavutil. */ >>> }AVCRCId; >> >> >> I support the idea, but this breaks ABI. You need to do this under a version >> bump, see libavutil/version.h for templates. > > Sorry, can you be a little more explicit: I bump the minor version > number here of avutil. Do you mean to use AV_VERSION_INT and friends > to check and accordingly place ifdefy? Changing an enum value in a public header breaks ABI. Software already compiled that links to libavutil.so.55 expects AV_CRC_24_IEEE to be 12, not 6 as it would be after this commit. > >> >> Ronald > ___ > 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] avutil/crc: avoid needless space wastage of hardcoded crc table
On Sun, Nov 29, 2015 at 9:45 PM, Ronald S. Bultje wrote: > Hi, > > On Sun, Nov 29, 2015 at 9:41 PM, Ganesh Ajjanagadde > wrote: >> >> There was no reason AFAIK for making AV_CRC_24_IEEE 12. This simply >> resulted in wasted space under --enable-hardcoded-tables: >> dynamic: 1318672 libavutil/libavutil.so.55 >> old: 1330680 libavutil/libavutil.so.55 >> new: 1326488 libavutil/libavutil.so.55 >> >> Minor version number is bumped. >> >> Signed-off-by: Ganesh Ajjanagadde >> --- >> libavutil/crc.h | 2 +- >> libavutil/version.h | 2 +- >> 2 files changed, 2 insertions(+), 2 deletions(-) >> >> diff --git a/libavutil/crc.h b/libavutil/crc.h >> index e86bf1d..61592df 100644 >> --- a/libavutil/crc.h >> +++ b/libavutil/crc.h >> @@ -40,7 +40,7 @@ typedef enum { >> AV_CRC_32_IEEE, >> AV_CRC_32_IEEE_LE, /*< reversed bitorder version of AV_CRC_32_IEEE >> */ >> AV_CRC_16_ANSI_LE, /*< reversed bitorder version of AV_CRC_16_ANSI >> */ >> -AV_CRC_24_IEEE = 12, >> +AV_CRC_24_IEEE, >> AV_CRC_MAX, /*< Not part of public API! Do not use outside >> libavutil. */ >> }AVCRCId; > > > I support the idea, but this breaks ABI. You need to do this under a version > bump, see libavutil/version.h for templates. Sorry, can you be a little more explicit: I bump the minor version number here of avutil. Do you mean to use AV_VERSION_INT and friends to check and accordingly place ifdefy? > > Ronald ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avutil/crc: avoid needless space wastage of hardcoded crc table
Hi, On Sun, Nov 29, 2015 at 9:41 PM, Ganesh Ajjanagadde wrote: > There was no reason AFAIK for making AV_CRC_24_IEEE 12. This simply > resulted in wasted space under --enable-hardcoded-tables: > dynamic: 1318672 libavutil/libavutil.so.55 > old: 1330680 libavutil/libavutil.so.55 > new: 1326488 libavutil/libavutil.so.55 > > Minor version number is bumped. > > Signed-off-by: Ganesh Ajjanagadde > --- > libavutil/crc.h | 2 +- > libavutil/version.h | 2 +- > 2 files changed, 2 insertions(+), 2 deletions(-) > > diff --git a/libavutil/crc.h b/libavutil/crc.h > index e86bf1d..61592df 100644 > --- a/libavutil/crc.h > +++ b/libavutil/crc.h > @@ -40,7 +40,7 @@ typedef enum { > AV_CRC_32_IEEE, > AV_CRC_32_IEEE_LE, /*< reversed bitorder version of AV_CRC_32_IEEE */ > AV_CRC_16_ANSI_LE, /*< reversed bitorder version of AV_CRC_16_ANSI */ > -AV_CRC_24_IEEE = 12, > +AV_CRC_24_IEEE, > AV_CRC_MAX, /*< Not part of public API! Do not use outside > libavutil. */ > }AVCRCId; I support the idea, but this breaks ABI. You need to do this under a version bump, see libavutil/version.h for templates. Ronald ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] avutil/crc: avoid needless space wastage of hardcoded crc table
There was no reason AFAIK for making AV_CRC_24_IEEE 12. This simply resulted in wasted space under --enable-hardcoded-tables: dynamic: 1318672 libavutil/libavutil.so.55 old: 1330680 libavutil/libavutil.so.55 new: 1326488 libavutil/libavutil.so.55 Minor version number is bumped. Signed-off-by: Ganesh Ajjanagadde --- libavutil/crc.h | 2 +- libavutil/version.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libavutil/crc.h b/libavutil/crc.h index e86bf1d..61592df 100644 --- a/libavutil/crc.h +++ b/libavutil/crc.h @@ -40,7 +40,7 @@ typedef enum { AV_CRC_32_IEEE, AV_CRC_32_IEEE_LE, /*< reversed bitorder version of AV_CRC_32_IEEE */ AV_CRC_16_ANSI_LE, /*< reversed bitorder version of AV_CRC_16_ANSI */ -AV_CRC_24_IEEE = 12, +AV_CRC_24_IEEE, AV_CRC_MAX, /*< Not part of public API! Do not use outside libavutil. */ }AVCRCId; diff --git a/libavutil/version.h b/libavutil/version.h index e0ddfd2..6b0d60b 100644 --- a/libavutil/version.h +++ b/libavutil/version.h @@ -56,7 +56,7 @@ */ #define LIBAVUTIL_VERSION_MAJOR 55 -#define LIBAVUTIL_VERSION_MINOR 9 +#define LIBAVUTIL_VERSION_MINOR 10 #define LIBAVUTIL_VERSION_MICRO 100 #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \ -- 2.6.2 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] avcodec/ac3: always use hardcoded tables
The table in question is a 253 byte one. In fact, it turns out that dynamic generation of the table results in an increased binary size. Code compiled with GCC 5.2.0, x86-64 (size in bytes), before and after patch: old: 62321064 libavcodec/libavcodec.so.57 new: 62320536 libavcodec/libavcodec.so.57 Thus, it always make sense to statically allocate this. Signed-off-by: Ganesh Ajjanagadde --- libavcodec/ac3.c| 24 libavcodec/ac3dec.c | 1 - libavcodec/ac3enc.c | 2 -- libavcodec/ac3tab.h | 8 +--- 4 files changed, 1 insertion(+), 34 deletions(-) diff --git a/libavcodec/ac3.c b/libavcodec/ac3.c index b54315d..1d4eaa5 100644 --- a/libavcodec/ac3.c +++ b/libavcodec/ac3.c @@ -39,8 +39,6 @@ const uint8_t ff_ac3_band_start_tab[AC3_CRITICAL_BANDS+1] = { 79, 85, 97, 109, 121, 133, 157, 181, 205, 229, 253 }; -#if CONFIG_HARDCODED_TABLES - /** * Map each frequency coefficient bin to the critical band that contains it. */ @@ -69,10 +67,6 @@ const uint8_t ff_ac3_bin_to_band_tab[253] = { 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49 }; -#else /* CONFIG_HARDCODED_TABLES */ -uint8_t ff_ac3_bin_to_band_tab[253]; -#endif - static inline int calc_lowcomp1(int a, int b0, int b1, int c) { if ((b0 + 256) == b1) { @@ -214,21 +208,3 @@ int ff_ac3_bit_alloc_calc_mask(AC3BitAllocParameters *s, int16_t *band_psd, } return 0; } - -/** - * Initialize some tables. - * note: This function must remain thread safe because it is called by the - * AVParser init code. - */ -av_cold void ff_ac3_common_init(void) -{ -#if !CONFIG_HARDCODED_TABLES -/* compute ff_ac3_bin_to_band_tab from ff_ac3_band_start_tab */ -int bin = 0, band; -for (band = 0; band < AC3_CRITICAL_BANDS; band++) { -int band_end = ff_ac3_band_start_tab[band+1]; -while (bin < band_end) -ff_ac3_bin_to_band_tab[bin++] = band; -} -#endif /* !CONFIG_HARDCODED_TABLES */ -} diff --git a/libavcodec/ac3dec.c b/libavcodec/ac3dec.c index ad91405..efc58e5 100644 --- a/libavcodec/ac3dec.c +++ b/libavcodec/ac3dec.c @@ -185,7 +185,6 @@ static av_cold int ac3_decode_init(AVCodecContext *avctx) s->avctx = avctx; -ff_ac3_common_init(); ac3_tables_init(); ff_mdct_init(&s->imdct_256, 8, 1, 1.0); ff_mdct_init(&s->imdct_512, 9, 1, 1.0); diff --git a/libavcodec/ac3enc.c b/libavcodec/ac3enc.c index c8a0caa..636ca72 100644 --- a/libavcodec/ac3enc.c +++ b/libavcodec/ac3enc.c @@ -2431,8 +2431,6 @@ av_cold int ff_ac3_encode_init(AVCodecContext *avctx) s->eac3 = avctx->codec_id == AV_CODEC_ID_EAC3; -ff_ac3_common_init(); - ret = validate_options(s); if (ret) return ret; diff --git a/libavcodec/ac3tab.h b/libavcodec/ac3tab.h index 74cbd9e..f529fc8 100644 --- a/libavcodec/ac3tab.h +++ b/libavcodec/ac3tab.h @@ -27,12 +27,6 @@ #include "libavutil/internal.h" #include "ac3.h" -#if CONFIG_HARDCODED_TABLES -# define HCONST const -#else -# define HCONST -#endif - extern const uint16_t ff_ac3_frame_size_tab[38][3]; extern const uint8_t ff_ac3_channels_tab[8]; extern av_export const uint16_t avpriv_ac3_channel_layout_tab[8]; @@ -54,7 +48,7 @@ extern const int16_t ff_ac3_floor_tab[8]; extern const uint16_t ff_ac3_fast_gain_tab[8]; extern const uint16_t ff_eac3_default_chmap[8]; extern const uint8_t ff_ac3_band_start_tab[AC3_CRITICAL_BANDS+1]; -extern HCONST uint8_t ff_ac3_bin_to_band_tab[253]; +extern const uint8_t ff_ac3_bin_to_band_tab[253]; /** Custom channel map locations bitmask * Other channels described in documentation: -- 2.6.2 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] Allow mpjpeg demuxer to process MIME parts which do not include Content-Length header.
On 11/29/15 1:16 PM, Nicolas George wrote: Le nonidi 9 frimaire, an CCXXIV, Ganesh Ajjanagadde a écrit : end = p + strlen(p) - 1; Don't know what you are referring to here, but dereferencing is clearly invalid. However, in order to allow common loop idioms, pointer arithmetic one element beyond a array (memory) range is valid: Of course. But one element BEFORE the beginning of an array is invalid. In other words p + sizeof(p) is valid (assuming p is char[]), but p - 1 is not. In this instance, if p is a 0-terminated string, p + strlen(p) is always valid, even without the provision you mention, because the 0 is part of the object. But p + strlen(p) - 1 is not, if strlen(p) can be 0. Note that dereferencing or not is not relevant: some architectures have special registers for pointers that would cause traps just loading an invalid pointer (think: p at offset 0 of segment S, p-1 at offset max of segment S-1 -> load segment descriptor). FFmpeg probably does not run on any such architecture, though. But still, this is bad style. Regards, ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel Ended up reworking these few lines to operate on indices, rather than doing pointer airthmetics. Should be the same thing, functionally. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH]lavf/rtpenc_jpeg: Fix huffman table test
On Saturday 28 November 2015 02:32:37 am Carl Eugen Hoyos wrote: > Hi! > > Jpeg over rtp requires standard huffman tables, but the test I implemented > was too strict. Attached patch tries to improve this, related to ticket > #3823. New patch attached. Please review, Carl Eugen diff --git a/libavformat/rtpenc_jpeg.c b/libavformat/rtpenc_jpeg.c index a6f2b32..83f728f 100644 --- a/libavformat/rtpenc_jpeg.c +++ b/libavformat/rtpenc_jpeg.c @@ -36,6 +36,7 @@ void ff_rtp_send_jpeg(AVFormatContext *s1, const uint8_t *buf, int size) int off = 0; /* fragment offset of the current JPEG frame */ int len; int i; +int default_huffman_tables = 0; s->buf_ptr = s->buf; s->timestamp = s->cur_timestamp; @@ -90,23 +91,66 @@ void ff_rtp_send_jpeg(AVFormatContext *s1, const uint8_t *buf, int size) return; } } else if (buf[i + 1] == DHT) { -if ( AV_RB16(&buf[i + 2]) < 418 -|| i + 420 >= size -|| buf[i + 4] != 0x00 -|| buf[i + 33] != 0x01 -|| buf[i + 62] != 0x10 -|| buf[i + 241] != 0x11 -|| memcmp(buf + i + 5, avpriv_mjpeg_bits_dc_luminance + 1, 16) -|| memcmp(buf + i + 21, avpriv_mjpeg_val_dc, 12) -|| memcmp(buf + i + 34, avpriv_mjpeg_bits_dc_chrominance + 1, 16) -|| memcmp(buf + i + 50, avpriv_mjpeg_val_dc, 12) -|| memcmp(buf + i + 63, avpriv_mjpeg_bits_ac_luminance + 1, 16) -|| memcmp(buf + i + 79, avpriv_mjpeg_val_ac_luminance, 162) -|| memcmp(buf + i + 242, avpriv_mjpeg_bits_ac_chrominance + 1, 16) -|| memcmp(buf + i + 258, avpriv_mjpeg_val_ac_chrominance, 162)) { -av_log(s1, AV_LOG_ERROR, - "RFC 2435 requires standard Huffman tables for jpeg\n"); -return; +int dht_size = AV_RB16(&buf[i + 2]); +default_huffman_tables |= 1 << 4; +i += 3; +dht_size -= 3; +if (i + dht_size > size) +continue; +while (dht_size > 0) +switch (buf[i + 1]) { +case 0x00: +if ( dht_size >= 28 +&& !memcmp(buf + i + 2, avpriv_mjpeg_bits_dc_luminance + 1, 16) +&& !memcmp(buf + i + 18, avpriv_mjpeg_val_dc, 12)) { +default_huffman_tables |= 1; +i += 29; +dht_size -= 28; +} else { +i += dht_size + 1; +dht_size = 0; +} +break; +case 0x01: +if ( dht_size >= 28 +&& !memcmp(buf + i + 2, avpriv_mjpeg_bits_dc_chrominance + 1, 16) +&& !memcmp(buf + i + 18, avpriv_mjpeg_val_dc, 12)) { +default_huffman_tables |= 1 << 1; +i += 29; +dht_size -= 28; +} else { +i += dht_size + 1; +dht_size = 0; +} +break; +case 0x10: +if ( dht_size >= 178 +&& !memcmp(buf + i + 2, avpriv_mjpeg_bits_ac_luminance + 1, 16) +&& !memcmp(buf + i + 18, avpriv_mjpeg_val_ac_luminance, 162)) { +default_huffman_tables |= 1 << 2; +i += 179; +dht_size -= 178; +} else { +i += dht_size + 1; +dht_size = 0; +} +break; +case 0x11: +if ( dht_size >= 178 +&& !memcmp(buf + i + 2, avpriv_mjpeg_bits_ac_chrominance + 1, 16) +&& !memcmp(buf + i + 18, avpriv_mjpeg_val_ac_chrominance, 162)) { +default_huffman_tables |= 1 << 3; +i += 179; +dht_size -= 178; +} else { +i += dht_size + 1; +dht_size = 0; +} +break; +default: +i += dht_size + 1; +dht_size = 0; +continue; } } else if (buf[i + 1] == SOS) { /* SOS is last marker in the header */ @@ -119,6 +163,11 @@ void ff_rtp_send_jpeg(AVFormatContext *s1, const uint8_t *buf, int size) break; } } +if (default_huffman_tables && default_huffman_tables != 31) { +av_log(s1, AV_LOG_ERROR, + "RFC 2435 requires standard Huffman tables for jpeg\n"); +return; +} if (nb_qtables &&
Re: [FFmpeg-devel] [PATCH] Allow mpjpeg demuxer to process MIME parts which do not include Content-Length header.
On 11/29/15 1:00 PM, wm4 wrote: On Wed, 25 Nov 2015 10:35:31 -0500 Alex Agranovsky wrote: From 4797590e11267993c3883e5037619625e1f1dadf Mon Sep 17 00:00:00 2001 From: Alex Agranovsky Date: Tue, 24 Nov 2015 00:07:34 -0500 Subject: [PATCH 2/2] If available, use the actual boundary in HTTP response's Content-Type header, to separate MIME parts in mpjpeg stream This code is disabled by default so not to regress endpoints sending invalid MIME, but can be enabled via AVOption 'strict_mime_boundary' Signed-off-by: Alex Agranovsky --- libavformat/mpjpegdec.c | 76 +++-- 1 file changed, 73 insertions(+), 3 deletions(-) diff --git a/libavformat/mpjpegdec.c b/libavformat/mpjpegdec.c index b9093ea..c0f011d 100644 --- a/libavformat/mpjpegdec.c +++ b/libavformat/mpjpegdec.c @@ -20,6 +20,7 @@ */ #include "libavutil/avstring.h" +#include "libavutil/opt.h" #include "avformat.h" #include "internal.h" @@ -28,9 +29,11 @@ typedef struct MPJPEGDemuxContext { +const AVClass *class; char* boundary; char* searchstr; int searchstr_len; +int strict_mime_boundary; } MPJPEGDemuxContext; @@ -245,6 +248,43 @@ static int parse_multipart_header(AVIOContext *pb, } +static char* mpjpeg_get_boundary(AVIOContext* pb) +{ +uint8_t *mime_type = NULL; +uint8_t *start; +uint8_t *end; +uint8_t *res = NULL; +int len; + +/* get MIME type, and skip to the first parameter */ +av_opt_get(pb, "mime_type", AV_OPT_SEARCH_CHILDREN, &mime_type); +start = mime_type; +while (start != NULL && *start != '\0') { +start = strchr(start, ';'); +if (start) +start = start+1; + +while (av_isspace(*start)) +start++; + +if (!av_strncasecmp(start, "boundary=", 9)) { +start += 9; (Probably could use av_strstart() here, but you don't need to change it if you don't want to.) + +end = strchr(start, ';'); +if (end) +len = end - start - 1; +else +len = strlen(start); +res = av_strndup(start, len); +break; +} +} + +av_freep(&mime_type); +return res; +} + + static int mpjpeg_read_packet(AVFormatContext *s, AVPacket *pkt) { int size; @@ -252,8 +292,19 @@ static int mpjpeg_read_packet(AVFormatContext *s, AVPacket *pkt) MPJPEGDemuxContext *mpjpeg = s->priv_data; if (mpjpeg->boundary == NULL) { -mpjpeg->boundary = av_strdup("--"); -mpjpeg->searchstr = av_strdup("\r\n--"); +uint8_t* boundary = NULL; +if (mpjpeg->strict_mime_boundary) { +boundary = mpjpeg_get_boundary(s->pb); +} +if (boundary != NULL) { +size_t bufsize = 4+strlen(boundary)+1; +mpjpeg->boundary = boundary; +mpjpeg->searchstr = av_malloc(bufsize); +snprintf( mpjpeg->searchstr, bufsize, "\r\n%s\r\n", boundary ); av_asprintf() would be much more convenient. +} else { +mpjpeg->boundary = av_strdup("--"); +mpjpeg->searchstr = av_strdup("\r\n--"); +} mpjpeg->searchstr_len = strlen(mpjpeg->searchstr); if (!mpjpeg->boundary || !mpjpeg->searchstr) { av_freep(&mpjpeg->boundary); @@ -315,6 +366,22 @@ static int mpjpeg_read_packet(AVFormatContext *s, AVPacket *pkt) return ret; } +#define OFFSET(x) offsetof(MPJPEGDemuxContext, x) + +#define DEC AV_OPT_FLAG_DECODING_PARAM +const AVOption mpjpeg_options[] = { +{ "strict_mime_boundary", "require MIME boundaries match", OFFSET(strict_mime_boundary), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 1, DEC }, Not sure, but maybe it'd be good to have a better explanation for this option in doc/demuxers.texi. +{ NULL } +}; + + +static const AVClass mpjpeg_demuxer_class = { +.class_name = "MPJPEG demuxer", +.item_name = av_default_item_name, +.option = mpjpeg_options, +.version= LIBAVUTIL_VERSION_INT, +}; + AVInputFormat ff_mpjpeg_demuxer = { .name = "mpjpeg", .long_name = NULL_IF_CONFIG_SMALL("MIME multipart JPEG"), @@ -324,5 +391,8 @@ AVInputFormat ff_mpjpeg_demuxer = { .read_probe= mpjpeg_read_probe, .read_header = mpjpeg_read_header, .read_packet = mpjpeg_read_packet, -.read_close= mpjpeg_read_close +.read_close= mpjpeg_read_close, +.priv_class= &mpjpeg_demuxer_class }; + + Rest looks good to me. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel Please see the updated patches attached. The trimming loop that was subject of the discussion had been rewritten to use indices rather than pointer arithmetics. Best, - Alex From 7d9fdaee79f1cd671aa62799b
Re: [FFmpeg-devel] [PATCH] avcodec/libdcadec: require first public release
On 11/29/2015 5:32 AM, Hendrik Leppkes wrote: > On Fri, Nov 27, 2015 at 7:11 PM, James Almer wrote: >> Signed-off-by: James Almer >> --- >> configure | 4 +--- >> libavcodec/libdcadec.c | 6 +++--- >> 2 files changed, 4 insertions(+), 6 deletions(-) >> >> diff --git a/configure b/configure >> index 0198b75..5583358 100755 >> --- a/configure >> +++ b/configure >> @@ -1877,7 +1877,6 @@ TYPES_LIST=" >> CONDITION_VARIABLE_Ptr >> socklen_t >> struct_addrinfo >> -struct_dcadec_exss_info_matrix_encoding >> struct_group_source_req >> struct_ip_mreq_source >> struct_ipv6_mreq >> @@ -5338,8 +5337,7 @@ enabled libcelt && require libcelt >> celt/celt.h celt_decode -lcelt0 && >> { check_lib celt/celt.h >> celt_decoder_create_custom -lcelt0 || >> die "ERROR: libcelt must be installed and >> version must be >= 0.11.0."; } >> enabled libcaca && require_pkg_config caca caca.h >> caca_create_canvas >> -enabled libdcadec && require_pkg_config dcadec >> libdcadec/dca_context.h dcadec_context_create && >> - check_struct libdcadec/dca_context.h "struct >> dcadec_exss_info" matrix_encoding >> +enabled libdcadec && require_pkg_config "dcadec >= 0.1.0" >> libdcadec/dca_context.h dcadec_context_create >> enabled libfaac && require2 libfaac "stdint.h faac.h" >> faacEncGetVersion -lfaac >> enabled libfdk_aac&& { use_pkg_config fdk-aac >> "fdk-aac/aacenc_lib.h" aacEncOpen || >> { require libfdk_aac fdk-aac/aacenc_lib.h >> aacEncOpen -lfdk-aac && >> diff --git a/libavcodec/libdcadec.c b/libavcodec/libdcadec.c >> index a0e34f9..e802076 100644 >> --- a/libavcodec/libdcadec.c >> +++ b/libavcodec/libdcadec.c >> @@ -42,7 +42,7 @@ static int dcadec_decode_frame(AVCodecContext *avctx, void >> *data, >> { >> DCADecContext *s = avctx->priv_data; >> AVFrame *frame = data; >> -av_unused struct dcadec_exss_info *exss; >> +struct dcadec_exss_info *exss; >> int ret, i, k; >> int **samples, nsamples, channel_mask, sample_rate, bits_per_sample, >> profile; >> uint32_t mrk; >> @@ -78,6 +78,8 @@ static int dcadec_decode_frame(AVCodecContext *avctx, void >> *data, >> &sample_rate, &bits_per_sample, >> &profile)) < 0) { >> av_log(avctx, AV_LOG_ERROR, "dcadec_context_filter() failed: %d >> (%s)\n", -ret, dcadec_strerror(ret)); >> return AVERROR_EXTERNAL; >> +} else if (ret > 0) { >> +av_log(avctx, AV_LOG_WARNING, "dcadec_context_filter() warning: %d >> (%s)\n", ret, dcadec_strerror(ret)); >> } >> >> avctx->channels = av_get_channel_layout_nb_channels(channel_mask); >> @@ -129,7 +131,6 @@ static int dcadec_decode_frame(AVCodecContext *avctx, >> void *data, >> } else >> avctx->bit_rate = 0; >> >> -#if HAVE_STRUCT_DCADEC_EXSS_INFO_MATRIX_ENCODING >> if (exss = dcadec_context_get_exss_info(s->ctx)) { >> enum AVMatrixEncoding matrix_encoding = AV_MATRIX_ENCODING_NONE; >> >> @@ -158,7 +159,6 @@ static int dcadec_decode_frame(AVCodecContext *avctx, >> void *data, >> (ret = ff_side_data_update_matrix_encoding(frame, >> matrix_encoding)) < 0) >> return ret; >> } >> -#endif >> >> frame->nb_samples = nsamples; >> if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) >> -- >> 2.6.3 >> > > > LGTM. Pushed earlier today. Thanks. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 2/2] avfilter: add sidechaingate filter
Signed-off-by: Paul B Mahol --- doc/filters.texi | 61 + libavfilter/Makefile | 1 + libavfilter/af_agate.c | 170 ++- libavfilter/allfilters.c | 1 + 4 files changed, 230 insertions(+), 3 deletions(-) diff --git a/doc/filters.texi b/doc/filters.texi index 0395c7a..ed4a376 100644 --- a/doc/filters.texi +++ b/doc/filters.texi @@ -2531,6 +2531,67 @@ ffmpeg -i main.flac -i sidechain.flac -filter_complex "[1:a]asplit=2[sc][mix];[0 @end example @end itemize +@section sidechaingate + +A sidechain gate acts like a normal (wideband) gate but has the ability to +filter the detected signal before sending it to the gain reduction stage. +Normally a gate uses the full range signal to detect a level above the +threshold. +For example: If you cut all lower frequencies from your sidechain signal +the gate will decrease the volume of your track only if not enough highs +appear. With this technique you are able to reduce the resonation of a +natural drum or remove "rumbling" of muted strokes from a heavily distorted +guitar. +It needs two input streams and returns one output stream. +First input stream will be processed depending on second stream signal. + +The filter accepts the following options: + +@table @option +@item level_in +Set input level before filtering. +Default is 1. Allowed range is from 0.015625 to 64. + +@item range +Set the level of gain reduction when the signal is below the threshold. +Default is 0.06125. Allowed range is from 0 to 1. + +@item threshold +If a signal rises above this level the gain reduction is released. +Default is 0.125. Allowed range is from 0 to 1. + +@item ratio +Set a ratio about which the signal is reduced. +Default is 2. Allowed range is from 1 to 9000. + +@item attack +Amount of milliseconds the signal has to rise above the threshold before gain +reduction stops. +Default is 20 milliseconds. Allowed range is from 0.01 to 9000. + +@item release +Amount of milliseconds the signal has to fall below the threshold before the +reduction is increased again. Default is 250 milliseconds. +Allowed range is from 0.01 to 9000. + +@item makeup +Set amount of amplification of signal after processing. +Default is 1. Allowed range is from 1 to 64. + +@item knee +Curve the sharp knee around the threshold to enter gain reduction more softly. +Default is 2.828427125. Allowed range is from 1 to 8. + +@item detection +Choose if exact signal should be taken for detection or an RMS like one. +Default is peak. Can be peak or rms. + +@item link +Choose if the average level between all channels or the louder channel affects +the reduction. +Default is average. Can be average or maximum. +@end table + @section silencedetect Detect silence in an audio stream. diff --git a/libavfilter/Makefile b/libavfilter/Makefile index e31bdaa..582fd0e 100644 --- a/libavfilter/Makefile +++ b/libavfilter/Makefile @@ -82,6 +82,7 @@ OBJS-$(CONFIG_REPLAYGAIN_FILTER) += af_replaygain.o OBJS-$(CONFIG_RESAMPLE_FILTER) += af_resample.o OBJS-$(CONFIG_RUBBERBAND_FILTER) += af_rubberband.o OBJS-$(CONFIG_SIDECHAINCOMPRESS_FILTER) += af_sidechaincompress.o +OBJS-$(CONFIG_SIDECHAINGATE_FILTER) += af_agate.o OBJS-$(CONFIG_SILENCEDETECT_FILTER) += af_silencedetect.o OBJS-$(CONFIG_SILENCEREMOVE_FILTER) += af_silenceremove.o OBJS-$(CONFIG_STEREOTOOLS_FILTER)+= af_stereotools.o diff --git a/libavfilter/af_agate.c b/libavfilter/af_agate.c index d3f74fb..23e45c6 100644 --- a/libavfilter/af_agate.c +++ b/libavfilter/af_agate.c @@ -18,6 +18,12 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +/** + * @file + * Audio (Sidechain) Gate filter + */ + +#include "libavutil/avassert.h" #include "libavutil/channel_layout.h" #include "libavutil/opt.h" #include "avfilter.h" @@ -46,12 +52,14 @@ typedef struct AudioGateContext { double lin_slope; double attack_coeff; double release_coeff; + +AVFrame *input_frame[2]; } AudioGateContext; #define OFFSET(x) offsetof(AudioGateContext, x) #define A AV_OPT_FLAG_AUDIO_PARAM|AV_OPT_FLAG_FILTERING_PARAM -static const AVOption agate_options[] = { +static const AVOption options[] = { { "level_in", "set input level",OFFSET(level_in), AV_OPT_TYPE_DOUBLE, {.dbl=1}, 0.015625, 64, A }, { "range", "set max gain reduction", OFFSET(range), AV_OPT_TYPE_DOUBLE, {.dbl=0.06125}, 0, 1, A }, { "threshold", "set threshold", OFFSET(threshold), AV_OPT_TYPE_DOUBLE, {.dbl=0.125}, 0, 1, A }, @@ -69,6 +77,7 @@ static const AVOption agate_options[] = { { NULL } }; +#define agate_options options AVFILTER_DEFINE_CLASS(agate); static int query_formats(AVFilterContext *ctx) @@ -97,7 +106,7 @@ static int query_formats(AVFilterContext *ctx) return ff_set_common_samplerates(ctx, formats); } -static int config_inpu
[FFmpeg-devel] [PATCH 1/2] avfilter/af_agate: prepare for adding sidechain version
Signed-off-by: Paul B Mahol --- libavfilter/af_agate.c | 59 -- 1 file changed, 33 insertions(+), 26 deletions(-) diff --git a/libavfilter/af_agate.c b/libavfilter/af_agate.c index b56f32e..d3f74fb 100644 --- a/libavfilter/af_agate.c +++ b/libavfilter/af_agate.c @@ -149,46 +149,29 @@ static double output_gain(double lin_slope, double ratio, double thres, return 1.; } -static int filter_frame(AVFilterLink *inlink, AVFrame *in) +static void gate(AudioGateContext *s, const double *src, double *dst, const double *scsrc, + int nb_samples, AVFilterLink *inlink, AVFilterLink *sclink) { -AVFilterContext *ctx = inlink->dst; -AVFilterLink *outlink = ctx->outputs[0]; -AudioGateContext *s = ctx->priv; -const double *src = (const double *)in->data[0]; const double makeup = s->makeup; const double attack_coeff = s->attack_coeff; const double release_coeff = s->release_coeff; const double level_in = s->level_in; -AVFrame *out; -double *dst; int n, c; -if (av_frame_is_writable(in)) { -out = in; -} else { -out = ff_get_audio_buffer(inlink, in->nb_samples); -if (!out) { -av_frame_free(&in); -return AVERROR(ENOMEM); -} -av_frame_copy_props(out, in); -} -dst = (double *)out->data[0]; - -for (n = 0; n < in->nb_samples; n++, src += inlink->channels, dst += inlink->channels) { -double abs_sample = fabs(src[0]), gain = 1.0; +for (n = 0; n < nb_samples; n++, src += inlink->channels, dst += inlink->channels, scsrc += sclink->channels) { +double abs_sample = fabs(scsrc[0]), gain = 1.0; for (c = 0; c < inlink->channels; c++) dst[c] = src[c] * level_in; if (s->link == 1) { -for (c = 1; c < inlink->channels; c++) -abs_sample = FFMAX(fabs(src[c]), abs_sample); +for (c = 1; c < sclink->channels; c++) +abs_sample = FFMAX(fabs(scsrc[c]), abs_sample); } else { -for (c = 1; c < inlink->channels; c++) -abs_sample += fabs(src[c]); +for (c = 1; c < sclink->channels; c++) +abs_sample += fabs(scsrc[c]); -abs_sample /= inlink->channels; +abs_sample /= sclink->channels; } if (s->detection) @@ -203,6 +186,30 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) for (c = 0; c < inlink->channels; c++) dst[c] *= gain * makeup; } +} + +static int filter_frame(AVFilterLink *inlink, AVFrame *in) +{ +const double *src = (const double *)in->data[0]; +AVFilterContext *ctx = inlink->dst; +AVFilterLink *outlink = ctx->outputs[0]; +AudioGateContext *s = ctx->priv; +AVFrame *out; +double *dst; + +if (av_frame_is_writable(in)) { +out = in; +} else { +out = ff_get_audio_buffer(inlink, in->nb_samples); +if (!out) { +av_frame_free(&in); +return AVERROR(ENOMEM); +} +av_frame_copy_props(out, in); +} +dst = (double *)out->data[0]; + +gate(s, src, dst, src, in->nb_samples, inlink, inlink); if (out != in) av_frame_free(&in); -- 1.9.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH]lavf/mxfdec: Set width to actual coded_width for AVCI50
On Friday 27 November 2015 09:46:48 pm Tomas Härdin wrote: > > Ok to apply? > > Sure, we can take the renaming separately. I applied the patch. Thank you, Carl Eugen ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] AAC encoder: improve SF range utilization
Attached Before pushing this, I'd like some feedback, especially about the implementation of point 3. I'm not sure the AAC encoder setting the cutoff in the encoder context like this is legal or desirable. It does work quite well, and all attempts to do it otherwise were either very invasive or repeated lots of complex code, so I opted for this approach. But perhaps someone more familiar with the interfaces and the contracts behind them could comment on this. This patch does 4 things, all of which interact and thus it woudln't be possible to commit them separately without causing either quality regressions or assertion failures. Fate comparison targets don't all reflect improvements in quality, yet listening tests show substantially improved quality and stability. 1. Increase SF range utilization. The spec requires SF delta values to be constrained within the range -60..60. The previous code was applying that range to the whole SF array and not only the deltas of consecutive values, because doing so requires smarter code: zeroing or otherwise skipping a band may invalidate lots of SF choices. This patch implements that logic to allow the coders to utilize the full dynamic range of scalefactors, increasing quality quite considerably, and fixing delta-SF-related assertion failures, since now the limitation is enforced rather than asserted. 2. PNS tweaks The previous modification makes big improvements in twoloop's efficiency, and every time that happens PNS logic needs to be tweaked accordingly to avoid it from stepping all over twoloop's decisions. This patch includes modifications of the sort. 3. Account for lowpass cutoff during PSY analysis The closer PSY's allocation is to final allocation the better the quality is, and given these modifications, twoloop is now very efficient at avoiding holes. Thus, to compute accurate thresholds, PSY needs to account for the lowpass applied implicitly during twoloop (by zeroing high bands). This patch makes twoloop set the cutoff in the encoder context the first time it runs, and makes PSY account for it during threshold computation, making PE and threshold computations closer to the final allocation and thus achieving better subjective quality. 4. Tweaks to RC lambda tracking loop in relation to PNS Without this tweak some corner cases cause quality regressions. Basically, lambda needs to react faster to overall bitrate efficiency changes since now PNS can be quite successful in enforcing maximum bitrates, when PSY allocates too many bits to the lower bands, suppressing the signals RC logic uses to lower lambda in those cases and causing aggressive PNS. This tweak makes PNS much less aggressive, though it can still use some further tweaks. From e236ab0021eb28012ed05f46e7e520b5cbec413e Mon Sep 17 00:00:00 2001 From: Claudio Freire Date: Sun, 29 Nov 2015 16:33:31 -0300 Subject: [PATCH] AAC encoder: improve SF range utilization This patch does 4 things, all of which interact and thus it woudln't be possible to commit them separately without causing either quality regressions or assertion failures. Fate comparison targets don't all reflect improvements in quality, yet listening tests show substantially improved quality and stability. 1. Increase SF range utilization. The spec requires SF delta values to be constrained within the range -60..60. The previous code was applying that range to the whole SF array and not only the deltas of consecutive values, because doing so requires smarter code: zeroing or otherwise skipping a band may invalidate lots of SF choices. This patch implements that logic to allow the coders to utilize the full dynamic range of scalefactors, increasing quality quite considerably, and fixing delta-SF-related assertion failures, since now the limitation is enforced rather than asserted. 2. PNS tweaks The previous modification makes big improvements in twoloop's efficiency, and every time that happens PNS logic needs to be tweaked accordingly to avoid it from stepping all over twoloop's decisions. This patch includes modifications of the sort. 3. Account for lowpass cutoff during PSY analysis The closer PSY's allocation is to final allocation the better the quality is, and given these modifications, twoloop is now very efficient at avoiding holes. Thus, to compute accurate thresholds, PSY needs to account for the lowpass applied implicitly during twoloop (by zeroing high bands). This patch makes twoloop set the cutoff in the encoder context the first time it runs, and makes PSY account for it during threshold computation, making PE and threshold computations closer to the final allocation and thus achieving better subjective quality. 4. Tweaks to RC lambda tracking loop in relation to PNS Without this tweak some corner cases cause quality regressions. Basically, lambda needs to react faster to overall bitrate efficiency changes since now PNS can be quite successful in enforcing maximum bitrates, when PSY allocates too many b
Re: [FFmpeg-devel] [PATCH] avfilter: add audio pulsator filter
Le nonidi 9 frimaire, an CCXXIV, Ganesh Ajjanagadde a écrit : > I agree with this. There is another comment I would like to make on > this note, related to a patch I have shelved for the moment: > https://ffmpeg.org/pipermail/ffmpeg-devel/2015-November/182802.html - > it would be quite annoying to add a comment regarding acceptance of M, > G, etc suffixes to each and every filter. Interesting point. After some thought, I think the matter of internal links would need to be considered very carefully, but I think that, if done carefully, a documentation system directly connected to the options system would take care of this and much more: basically, any option would automatically have a link to the description of the syntax for its type. Regards, -- Nicolas George signature.asc Description: Digital signature ___ 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 Sun, Nov 29, 2015 at 1:21 PM, Nicolas George wrote: > Le nonidi 9 frimaire, an CCXXIV, Clement Boesch a écrit : >> I'd love to have most of the current documentation generated from this doc >> though. The current redundancy is annoying/problematic. > > I second that. We should make all the documentation introspectable, and > therefore usable by GUI applications directly. > > That would require careful design and quite a bit of work, though. But > support for it could be included in the new options system that want to > suggest. I agree with this. There is another comment I would like to make on this note, related to a patch I have shelved for the moment: https://ffmpeg.org/pipermail/ffmpeg-devel/2015-November/182802.html - it would be quite annoying to add a comment regarding acceptance of M, G, etc suffixes to each and every filter. > > 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
Re: [FFmpeg-devel] [PATCH] avfilter: add audio pulsator filter
Le nonidi 9 frimaire, an CCXXIV, Clement Boesch a écrit : > I'd love to have most of the current documentation generated from this doc > though. The current redundancy is annoying/problematic. I second that. We should make all the documentation introspectable, and therefore usable by GUI applications directly. That would require careful design and quite a bit of work, though. But support for it could be included in the new options system that want to suggest. Regards, -- Nicolas George signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] Allow mpjpeg demuxer to process MIME parts which do not include Content-Length header.
Le nonidi 9 frimaire, an CCXXIV, Ganesh Ajjanagadde a écrit : > >> end = p + strlen(p) - 1; > Don't know what you are referring to here, but dereferencing is > clearly invalid. However, in order to allow common loop idioms, > pointer arithmetic one element beyond a array (memory) range is valid: Of course. But one element BEFORE the beginning of an array is invalid. In other words p + sizeof(p) is valid (assuming p is char[]), but p - 1 is not. In this instance, if p is a 0-terminated string, p + strlen(p) is always valid, even without the provision you mention, because the 0 is part of the object. But p + strlen(p) - 1 is not, if strlen(p) can be 0. Note that dereferencing or not is not relevant: some architectures have special registers for pointers that would cause traps just loading an invalid pointer (think: p at offset 0 of segment S, p-1 at offset max of segment S-1 -> load segment descriptor). FFmpeg probably does not run on any such architecture, though. But still, this is bad style. Regards, -- Nicolas George signature.asc Description: Digital signature ___ 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 Sun, Nov 29, 2015 at 01:11:07PM -0500, Ganesh Ajjanagadde wrote: > On Sun, Nov 29, 2015 at 12:45 PM, Clément Bœsch wrote: > > On Sun, Nov 29, 2015 at 06:39:02PM +0100, Moritz Barsnick wrote: > >> Hi, > >> > >> On Sat, Nov 28, 2015 at 23:26:44 +0100, Paul B Mahol wrote: > >> > >> In addition to Ganesh's comments: > >> > >> > +@item amount > >> > +Set modulation. Define how much of original signal is affected by the > >> > LFO. > >> [...] > >> > +@item width > >> > +Set pulse width. > >> > >> I would appreciate ranges for both od these. I would guess them being > >> [0..1] (and I coould read the code), but who knows. > >> > > > > or do ffmpeg -h filter=apulsator > > I thought the common idiom was to document these ranges twice, i.e in > both the docs and implicitly in the code via the options table? > yes, i was just suggesting a simpler way than reading the code. I'd love to have most of the current documentation generated from this doc though. The current redundancy is annoying/problematic. -- 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] [PATCH] avfilter: add audio pulsator filter
On Sun, Nov 29, 2015 at 12:45 PM, Clément Bœsch wrote: > On Sun, Nov 29, 2015 at 06:39:02PM +0100, Moritz Barsnick wrote: >> Hi, >> >> On Sat, Nov 28, 2015 at 23:26:44 +0100, Paul B Mahol wrote: >> >> In addition to Ganesh's comments: >> >> > +@item amount >> > +Set modulation. Define how much of original signal is affected by the LFO. >> [...] >> > +@item width >> > +Set pulse width. >> >> I would appreciate ranges for both od these. I would guess them being >> [0..1] (and I coould read the code), but who knows. >> > > or do ffmpeg -h filter=apulsator I thought the common idiom was to document these ranges twice, i.e in both the docs and implicitly in the code via the options table? > > -- > Clément B. > > ___ > 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] Allow mpjpeg demuxer to process MIME parts which do not include Content-Length header.
On Sun, Nov 29, 2015 at 1:00 PM, wm4 wrote: > On Wed, 25 Nov 2015 10:35:31 -0500 > Alex Agranovsky wrote: > >> From 70a6e1b0f3d47698bf49c3c766d5472646bff71a Mon Sep 17 00:00:00 2001 >> From: Alex Agranovsky >> Date: Tue, 24 Nov 2015 00:06:14 -0500 >> Subject: [PATCH 1/2] Allow mpjpeg demuxer to process MIME parts which do not >> include Content-Length header. > > Commit messages should start with a prefix (like "avformat/mpjpeg: "), > and then maybe up to 60 characters of summary. If more text is needed, > it should be part of the commit body (i.e. the part after the subject > line). > > (Same for the second patch.) > >> >> Fixes ticket 5023 >> >> Signed-off-by: Alex Agranovsky >> --- >> libavformat/mpjpegdec.c | 164 >> +--- >> 1 file changed, 126 insertions(+), 38 deletions(-) >> >> diff --git a/libavformat/mpjpegdec.c b/libavformat/mpjpegdec.c >> index 2749a48..b9093ea 100644 >> --- a/libavformat/mpjpegdec.c >> +++ b/libavformat/mpjpegdec.c >> @@ -23,22 +23,15 @@ >> >> #include "avformat.h" >> #include "internal.h" >> +#include "avio_internal.h" >> >> -static int get_line(AVIOContext *pb, char *line, int line_size) >> -{ >> -int i = ff_get_line(pb, line, line_size); >> >> -if (i > 1 && line[i - 2] == '\r') >> -line[i - 2] = '\0'; >> - >> -if (pb->error) >> -return pb->error; >> - >> -if (pb->eof_reached) >> -return AVERROR_EOF; >> >> -return 0; >> -} >> +typedef struct MPJPEGDemuxContext { >> +char* boundary; >> +char* searchstr; >> +int searchstr_len; >> +} MPJPEGDemuxContext; >> >> >> static void trim_right(char* p) >> @@ -47,12 +40,28 @@ static void trim_right(char* p) >> if (!p || !*p) >> return; >> end = p + strlen(p) - 1; >> -while (end != p && av_isspace(*end)) { >> +while (end >= p && av_isspace(*end)) { > > I still think that this change is theoretically unclean and invalid, > because end will point before the memory location at one point. Maybe > someone else can give a second opinion whether it's invalid or allowed > by the C standard, and whether it's ok to ignore it. (Besides writing a > valid trim shouldn't be hard.) Don't know what you are referring to here, but dereferencing is clearly invalid. However, in order to allow common loop idioms, pointer arithmetic one element beyond a array (memory) range is valid: https://stackoverflow.com/questions/8133804/negative-array-index-in-c. [...] ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] Allow mpjpeg demuxer to process MIME parts which do not include Content-Length header.
On Wed, 25 Nov 2015 10:35:31 -0500 Alex Agranovsky wrote: > From 4797590e11267993c3883e5037619625e1f1dadf Mon Sep 17 00:00:00 2001 > From: Alex Agranovsky > Date: Tue, 24 Nov 2015 00:07:34 -0500 > Subject: [PATCH 2/2] If available, use the actual boundary in HTTP response's > Content-Type header, to separate MIME parts in mpjpeg stream > > This code is disabled by default so not to regress endpoints sending invalid > MIME, but can be enabled via AVOption 'strict_mime_boundary' > > Signed-off-by: Alex Agranovsky > --- > libavformat/mpjpegdec.c | 76 > +++-- > 1 file changed, 73 insertions(+), 3 deletions(-) > > diff --git a/libavformat/mpjpegdec.c b/libavformat/mpjpegdec.c > index b9093ea..c0f011d 100644 > --- a/libavformat/mpjpegdec.c > +++ b/libavformat/mpjpegdec.c > @@ -20,6 +20,7 @@ > */ > > #include "libavutil/avstring.h" > +#include "libavutil/opt.h" > > #include "avformat.h" > #include "internal.h" > @@ -28,9 +29,11 @@ > > > typedef struct MPJPEGDemuxContext { > +const AVClass *class; > char* boundary; > char* searchstr; > int searchstr_len; > +int strict_mime_boundary; > } MPJPEGDemuxContext; > > > @@ -245,6 +248,43 @@ static int parse_multipart_header(AVIOContext *pb, > } > > > +static char* mpjpeg_get_boundary(AVIOContext* pb) > +{ > +uint8_t *mime_type = NULL; > +uint8_t *start; > +uint8_t *end; > +uint8_t *res = NULL; > +int len; > + > +/* get MIME type, and skip to the first parameter */ > +av_opt_get(pb, "mime_type", AV_OPT_SEARCH_CHILDREN, &mime_type); > +start = mime_type; > +while (start != NULL && *start != '\0') { > +start = strchr(start, ';'); > +if (start) > +start = start+1; > + > +while (av_isspace(*start)) > +start++; > + > +if (!av_strncasecmp(start, "boundary=", 9)) { > +start += 9; (Probably could use av_strstart() here, but you don't need to change it if you don't want to.) > + > +end = strchr(start, ';'); > +if (end) > +len = end - start - 1; > +else > +len = strlen(start); > +res = av_strndup(start, len); > +break; > +} > +} > + > +av_freep(&mime_type); > +return res; > +} > + > + > static int mpjpeg_read_packet(AVFormatContext *s, AVPacket *pkt) > { > int size; > @@ -252,8 +292,19 @@ static int mpjpeg_read_packet(AVFormatContext *s, > AVPacket *pkt) > > MPJPEGDemuxContext *mpjpeg = s->priv_data; > if (mpjpeg->boundary == NULL) { > -mpjpeg->boundary = av_strdup("--"); > -mpjpeg->searchstr = av_strdup("\r\n--"); > +uint8_t* boundary = NULL; > +if (mpjpeg->strict_mime_boundary) { > +boundary = mpjpeg_get_boundary(s->pb); > +} > +if (boundary != NULL) { > +size_t bufsize = 4+strlen(boundary)+1; > +mpjpeg->boundary = boundary; > +mpjpeg->searchstr = av_malloc(bufsize); > +snprintf( mpjpeg->searchstr, bufsize, "\r\n%s\r\n", boundary ); av_asprintf() would be much more convenient. > +} else { > +mpjpeg->boundary = av_strdup("--"); > +mpjpeg->searchstr = av_strdup("\r\n--"); > +} > mpjpeg->searchstr_len = strlen(mpjpeg->searchstr); > if (!mpjpeg->boundary || !mpjpeg->searchstr) { > av_freep(&mpjpeg->boundary); > @@ -315,6 +366,22 @@ static int mpjpeg_read_packet(AVFormatContext *s, > AVPacket *pkt) > return ret; > } > > +#define OFFSET(x) offsetof(MPJPEGDemuxContext, x) > + > +#define DEC AV_OPT_FLAG_DECODING_PARAM > +const AVOption mpjpeg_options[] = { > +{ "strict_mime_boundary", "require MIME boundaries match", > OFFSET(strict_mime_boundary), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 1, DEC }, Not sure, but maybe it'd be good to have a better explanation for this option in doc/demuxers.texi. > +{ NULL } > +}; > + > + > +static const AVClass mpjpeg_demuxer_class = { > +.class_name = "MPJPEG demuxer", > +.item_name = av_default_item_name, > +.option = mpjpeg_options, > +.version= LIBAVUTIL_VERSION_INT, > +}; > + > AVInputFormat ff_mpjpeg_demuxer = { > .name = "mpjpeg", > .long_name = NULL_IF_CONFIG_SMALL("MIME multipart JPEG"), > @@ -324,5 +391,8 @@ AVInputFormat ff_mpjpeg_demuxer = { > .read_probe= mpjpeg_read_probe, > .read_header = mpjpeg_read_header, > .read_packet = mpjpeg_read_packet, > -.read_close= mpjpeg_read_close > +.read_close= mpjpeg_read_close, > +.priv_class= &mpjpeg_demuxer_class > }; > + > + Rest looks good to me. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] Allow mpjpeg demuxer to process MIME parts which do not include Content-Length header.
On Wed, 25 Nov 2015 10:35:31 -0500 Alex Agranovsky wrote: > From 70a6e1b0f3d47698bf49c3c766d5472646bff71a Mon Sep 17 00:00:00 2001 > From: Alex Agranovsky > Date: Tue, 24 Nov 2015 00:06:14 -0500 > Subject: [PATCH 1/2] Allow mpjpeg demuxer to process MIME parts which do not > include Content-Length header. Commit messages should start with a prefix (like "avformat/mpjpeg: "), and then maybe up to 60 characters of summary. If more text is needed, it should be part of the commit body (i.e. the part after the subject line). (Same for the second patch.) > > Fixes ticket 5023 > > Signed-off-by: Alex Agranovsky > --- > libavformat/mpjpegdec.c | 164 > +--- > 1 file changed, 126 insertions(+), 38 deletions(-) > > diff --git a/libavformat/mpjpegdec.c b/libavformat/mpjpegdec.c > index 2749a48..b9093ea 100644 > --- a/libavformat/mpjpegdec.c > +++ b/libavformat/mpjpegdec.c > @@ -23,22 +23,15 @@ > > #include "avformat.h" > #include "internal.h" > +#include "avio_internal.h" > > -static int get_line(AVIOContext *pb, char *line, int line_size) > -{ > -int i = ff_get_line(pb, line, line_size); > > -if (i > 1 && line[i - 2] == '\r') > -line[i - 2] = '\0'; > - > -if (pb->error) > -return pb->error; > - > -if (pb->eof_reached) > -return AVERROR_EOF; > > -return 0; > -} > +typedef struct MPJPEGDemuxContext { > +char* boundary; > +char* searchstr; > +int searchstr_len; > +} MPJPEGDemuxContext; > > > static void trim_right(char* p) > @@ -47,12 +40,28 @@ static void trim_right(char* p) > if (!p || !*p) > return; > end = p + strlen(p) - 1; > -while (end != p && av_isspace(*end)) { > +while (end >= p && av_isspace(*end)) { I still think that this change is theoretically unclean and invalid, because end will point before the memory location at one point. Maybe someone else can give a second opinion whether it's invalid or allowed by the C standard, and whether it's ok to ignore it. (Besides writing a valid trim shouldn't be hard.) > *end = '\0'; > end--; > } > } > > +static int get_line(AVIOContext *pb, char *line, int line_size) > +{ > +ff_get_line(pb, line, line_size); > + > +if (pb->error) > +return pb->error; > + > +if (pb->eof_reached) > +return AVERROR_EOF; > + > +trim_right(line); > +return 0; > +} > + > + > + > static int split_tag_value(char **tag, char **value, char *line) > { > char *p = line; > @@ -86,12 +95,24 @@ static int split_tag_value(char **tag, char **value, char > *line) > return 0; > } > > -static int parse_multipart_header(AVIOContext *pb, void *log_ctx); > +static int parse_multipart_header(AVIOContext *pb, > +int* size, > +const char* expected_boundary, > +void *log_ctx); > + > +static int mpjpeg_read_close(AVFormatContext *s) > +{ > +MPJPEGDemuxContext *mpjpeg = s->priv_data; > +av_freep(&mpjpeg->boundary); > +av_freep(&mpjpeg->searchstr); > +return 0; > +} > > static int mpjpeg_read_probe(AVProbeData *p) > { > AVIOContext *pb; > int ret = 0; > +int size = 0; > > if (p->buf_size < 2 || p->buf[0] != '-' || p->buf[1] != '-') > return 0; > @@ -100,7 +121,7 @@ static int mpjpeg_read_probe(AVProbeData *p) > if (!pb) > return 0; > > -ret = (parse_multipart_header(pb, NULL)>0)?AVPROBE_SCORE_MAX:0; > +ret = (parse_multipart_header(pb, &size, "--", NULL) > 0) ? > AVPROBE_SCORE_MAX : 0; > > av_free(pb); > > @@ -110,14 +131,15 @@ static int mpjpeg_read_probe(AVProbeData *p) > static int mpjpeg_read_header(AVFormatContext *s) > { > AVStream *st; > -char boundary[70 + 2 + 1]; > +char boundary[70 + 2 + 1] = {0}; > int64_t pos = avio_tell(s->pb); > int ret; > > - > -ret = get_line(s->pb, boundary, sizeof(boundary)); > -if (ret < 0) > -return ret; > +do { > +ret = get_line(s->pb, boundary, sizeof(boundary)); > +if (ret < 0) > +return ret; > +} while (!boundary[0]); > > if (strncmp(boundary, "--", 2)) > return AVERROR_INVALIDDATA; > @@ -147,11 +169,16 @@ static int parse_content_length(const char *value) > return val; > } > > -static int parse_multipart_header(AVIOContext *pb, void *log_ctx) > +static int parse_multipart_header(AVIOContext *pb, > +int* size, > +const char* expected_boundary, > +void *log_ctx) > { > char line[128]; > int found_content_type = 0; > -int ret, size = -1; > +int ret; > + > +*size = -1; > > // get the CRLF as empty string > ret = get_line(pb, line, sizeof(line)); > @@ -161,14 +188,23 @@ static int parse_multipart_header(AVIOContext *pb, voi
Re: [FFmpeg-devel] [PATCH] avfilter: add audio pulsator filter
On Sun, Nov 29, 2015 at 06:39:02PM +0100, Moritz Barsnick wrote: > Hi, > > On Sat, Nov 28, 2015 at 23:26:44 +0100, Paul B Mahol wrote: > > In addition to Ganesh's comments: > > > +@item amount > > +Set modulation. Define how much of original signal is affected by the LFO. > [...] > > +@item width > > +Set pulse width. > > I would appreciate ranges for both od these. I would guess them being > [0..1] (and I coould read the code), but who knows. > or do ffmpeg -h filter=apulsator -- 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] [PATCH] avfilter: add audio pulsator filter
Hi, On Sat, Nov 28, 2015 at 23:26:44 +0100, Paul B Mahol wrote: In addition to Ganesh's comments: > +@item amount > +Set modulation. Define how much of original signal is affected by the LFO. [...] > +@item width > +Set pulse width. I would appreciate ranges for both od these. I would guess them being [0..1] (and I coould read the code), but who knows. Moritz ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 04/10] avfilter/af_compand: use hypot()
2015-11-22 12:05 GMT-05:00 Ganesh Ajjanagadde : > Signed-off-by: Ganesh Ajjanagadde > --- > libavfilter/af_compand.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/libavfilter/af_compand.c b/libavfilter/af_compand.c > index 3848d67..a64778e 100644 > --- a/libavfilter/af_compand.c > +++ b/libavfilter/af_compand.c > @@ -467,13 +467,13 @@ static int config_output(AVFilterLink *outlink) > L(2).b = (L(0).y - L(2).y) / (L(0).x - L(2).x); > > theta = atan2(L(2).y - L(4).y, L(2).x - L(4).x); > -len = sqrt(pow(L(2).x - L(4).x, 2.) + pow(L(2).y - L(4).y, 2.)); > +len = hypot(L(2).x - L(4).x, L(2).y - L(4).y); > r = FFMIN(radius, len); > L(3).x = L(2).x - r * cos(theta); > L(3).y = L(2).y - r * sin(theta); > > theta = atan2(L(0).y - L(2).y, L(0).x - L(2).x); > -len = sqrt(pow(L(0).x - L(2).x, 2.) + pow(L(0).y - L(2).y, 2.)); > +len = hypot(L(0).x - L(2).x, L(0).y - L(2).y); > r = FFMIN(radius, len / 2); > x = L(2).x + r * cos(theta); > y = L(2).y + r * sin(theta); > -- > 2.6.2 > ping, this one is more important than the other hypot stuff, simply because pow(x, 2.0) is wasteful. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 5/5] lavfi: make request_frame() non-recursive.
Instead of calling the input filter request_frame() method, ff_request_frame() now marks the link and returns immediately. bufferskin is changed to activate the marked filters until a frame is obtained. Signed-off-by: Nicolas George --- libavfilter/avfilter.c | 20 +++- libavfilter/avfilter.h | 14 +++ libavfilter/avfiltergraph.c | 58 + libavfilter/buffersink.c| 5 libavfilter/internal.h | 7 ++ 5 files changed, 99 insertions(+), 5 deletions(-) diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c index 9c7b462..e413546 100644 --- a/libavfilter/avfilter.c +++ b/libavfilter/avfilter.c @@ -185,6 +185,7 @@ void ff_avfilter_link_set_in_status(AVFilterLink *link, int status, int64_t pts) void ff_avfilter_link_set_out_status(AVFilterLink *link, int status, int64_t pts) { link->status = status; +link->frame_wanted_in = link->frame_wanted_out = 0; ff_update_link_current_pts(link, pts); } @@ -353,11 +354,21 @@ void ff_tlog_link(void *ctx, AVFilterLink *link, int end) int ff_request_frame(AVFilterLink *link) { -int ret = -1; FF_TPRINTF_START(NULL, request_frame); ff_tlog_link(NULL, link, 1); if (link->status) return link->status; +link->frame_wanted_in = 1; +link->frame_wanted_out = 1; +return 0; +} + +int ff_request_frame_to_filter(AVFilterLink *link) +{ +int ret = -1; + +FF_TPRINTF_START(NULL, request_frame_to_filter); ff_tlog_link(NULL, link, 1); +link->frame_wanted_in = 0; if (link->srcpad->request_frame) ret = link->srcpad->request_frame(link); else if (link->src->inputs[0]) @@ -366,6 +377,9 @@ int ff_request_frame(AVFilterLink *link) AVFrame *pbuf = link->partial_buf; link->partial_buf = NULL; ret = ff_filter_frame_framed(link, pbuf); +ff_avfilter_link_set_in_status(link, AVERROR_EOF, AV_NOPTS_VALUE); +link->frame_wanted_out = 0; +return ret; } if (ret < 0) { if (ret != AVERROR(EAGAIN) && ret != link->status) @@ -1135,6 +1149,9 @@ static int ff_filter_frame_needs_framing(AVFilterLink *link, AVFrame *frame) if (pbuf->nb_samples >= link->min_samples) { ret = ff_filter_frame_framed(link, pbuf); pbuf = NULL; +} else { +if (link->frame_wanted_out) +link->frame_wanted_in = 1; } } av_frame_free(&frame); @@ -1176,6 +1193,7 @@ int ff_filter_frame(AVFilterLink *link, AVFrame *frame) } } +link->frame_wanted_out = 0; /* Go directly to actual filtering if possible */ if (link->type == AVMEDIA_TYPE_AUDIO && link->min_samples && diff --git a/libavfilter/avfilter.h b/libavfilter/avfilter.h index f3a0f2d..801f29d 100644 --- a/libavfilter/avfilter.h +++ b/libavfilter/avfilter.h @@ -515,6 +515,20 @@ struct AVFilterLink { * Number of past frames sent through the link. */ int64_t frame_count; + +/** + * True if a frame is currently wanted on the input of this filter. + * Set when ff_request_frame() is called by the output, + * cleared when the request is handled or forwarded. + */ +unsigned frame_wanted_in; + +/** + * True if a frame is currently wanted on the output of this filter. + * Set when ff_request_frame() is called by the output, + * cleared when a frame is filtered. + */ +unsigned frame_wanted_out; }; /** diff --git a/libavfilter/avfiltergraph.c b/libavfilter/avfiltergraph.c index ec2245f..9f50b41 100644 --- a/libavfilter/avfiltergraph.c +++ b/libavfilter/avfiltergraph.c @@ -1367,11 +1367,14 @@ void ff_avfilter_graph_update_heap(AVFilterGraph *graph, AVFilterLink *link) int avfilter_graph_request_oldest(AVFilterGraph *graph) { +AVFilterLink *oldest = graph->sink_links[0]; +int r; + while (graph->sink_links_count) { -AVFilterLink *oldest = graph->sink_links[0]; -int r = ff_request_frame(oldest); +oldest = graph->sink_links[0]; +r = ff_request_frame(oldest); if (r != AVERROR_EOF) -return r; +break; av_log(oldest->dst, AV_LOG_DEBUG, "EOF on sink link %s:%s.\n", oldest->dst ? oldest->dst->name : "unknown", oldest->dstpad ? oldest->dstpad->name : "unknown"); @@ -1381,5 +1384,52 @@ int avfilter_graph_request_oldest(AVFilterGraph *graph) oldest->age_index); oldest->age_index = -1; } -return AVERROR_EOF; +if (!graph->sink_links_count) +return AVERROR_EOF; +av_assert1(oldest->age_index >= 0); +while (oldest->frame_wanted_out) { +r = ff_filter_graph_run_once(graph); +if (r < 0) +return r; +} +return 0; +} + +static AVFilterLink *graph_run_once_find_filter(AVFilterGraph *graph) +{ +unsigned i, j; +AVFilterContext *f; + +/* TODO: replace
[FFmpeg-devel] [PATCH 4/5] lavfi: replace link.closed by link.status.
The status field can carry any error code instead of just EOF. Also only update it through a wrapper function and provide a timestamp. Update the few filters that used it directly. Signed-off-by: Nicolas George --- libavfilter/avfilter.c | 25 ++--- libavfilter/avfilter.h | 12 ++-- libavfilter/buffersink.c | 4 ++-- libavfilter/f_interleave.c | 4 ++-- libavfilter/internal.h | 12 libavfilter/split.c| 2 +- libavfilter/trim.c | 6 -- libavfilter/vf_extractplanes.c | 2 +- 8 files changed, 46 insertions(+), 21 deletions(-) diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c index 06a8239..9c7b462 100644 --- a/libavfilter/avfilter.c +++ b/libavfilter/avfilter.c @@ -177,9 +177,20 @@ int avfilter_link_get_channels(AVFilterLink *link) return link->channels; } +void ff_avfilter_link_set_in_status(AVFilterLink *link, int status, int64_t pts) +{ +ff_avfilter_link_set_out_status(link, status, pts); +} + +void ff_avfilter_link_set_out_status(AVFilterLink *link, int status, int64_t pts) +{ +link->status = status; +ff_update_link_current_pts(link, pts); +} + void avfilter_link_set_closed(AVFilterLink *link, int closed) { -link->closed = closed; +ff_avfilter_link_set_out_status(link, closed ? AVERROR_EOF : 0, AV_NOPTS_VALUE); } int avfilter_insert_filter(AVFilterLink *link, AVFilterContext *filt, @@ -345,8 +356,8 @@ int ff_request_frame(AVFilterLink *link) int ret = -1; FF_TPRINTF_START(NULL, request_frame); ff_tlog_link(NULL, link, 1); -if (link->closed) -return AVERROR_EOF; +if (link->status) +return link->status; if (link->srcpad->request_frame) ret = link->srcpad->request_frame(link); else if (link->src->inputs[0]) @@ -357,8 +368,8 @@ int ff_request_frame(AVFilterLink *link) ret = ff_filter_frame_framed(link, pbuf); } if (ret < 0) { -if (ret == AVERROR_EOF) -link->closed = 1; +if (ret != AVERROR(EAGAIN) && ret != link->status) +ff_avfilter_link_set_in_status(link, ret, AV_NOPTS_VALUE); } return ret; } @@ -1004,9 +1015,9 @@ static int ff_filter_frame_framed(AVFilterLink *link, AVFrame *frame) AVFilterCommand *cmd= link->dst->command_queue; int64_t pts; -if (link->closed) { +if (link->status) { av_frame_free(&frame); -return AVERROR_EOF; +return link->status; } if (!(filter_frame = dst->filter_frame)) diff --git a/libavfilter/avfilter.h b/libavfilter/avfilter.h index 58a0cbd..f3a0f2d 100644 --- a/libavfilter/avfilter.h +++ b/libavfilter/avfilter.h @@ -490,16 +490,16 @@ struct AVFilterLink { int max_samples; /** - * True if the link is closed. - * If set, all attempts of start_frame, filter_frame or request_frame - * will fail with AVERROR_EOF, and if necessary the reference will be - * destroyed. - * If request_frame returns AVERROR_EOF, this flag is set on the + * Link status. + * If not zero, all attempts of start_frame, filter_frame or request_frame + * will fail with the corresponding code, and if necessary the reference + * will be destroyed. + * If request_frame returns an error, the status is set on the * corresponding link. * It can be set also be set by either the source or the destination * filter. */ -int closed; +int status; /** * Number of channels. diff --git a/libavfilter/buffersink.c b/libavfilter/buffersink.c index 5db86abd..7a19df2 100644 --- a/libavfilter/buffersink.c +++ b/libavfilter/buffersink.c @@ -134,8 +134,8 @@ int attribute_align_arg av_buffersink_get_frame_flags(AVFilterContext *ctx, AVFr /* no picref available, fetch it from the filterchain */ while (!av_fifo_size(buf->fifo)) { -if (inlink->closed) -return AVERROR_EOF; +if (inlink->status) +return inlink->status; if (flags & AV_BUFFERSINK_FLAG_NO_REQUEST) return AVERROR(EAGAIN); if ((ret = ff_request_frame(inlink)) < 0) diff --git a/libavfilter/f_interleave.c b/libavfilter/f_interleave.c index e0915b5..422f2bf 100644 --- a/libavfilter/f_interleave.c +++ b/libavfilter/f_interleave.c @@ -59,7 +59,7 @@ inline static int push_frame(AVFilterContext *ctx) for (i = 0; i < ctx->nb_inputs; i++) { struct FFBufQueue *q = &s->queues[i]; -if (!q->available && !ctx->inputs[i]->closed) +if (!q->available && !ctx->inputs[i]->status) return 0; if (q->available) { frame = ff_bufqueue_peek(q, 0); @@ -190,7 +190,7 @@ static int request_frame(AVFilterLink *outlink) int i, ret; for (i = 0; i < ctx->nb_inputs; i++) { -if (!s->queues[i].available && !ctx->inputs[i]->closed) { +if (!s->queues[i].available && !ctx->inputs[i]->status) { ret = ff_
[FFmpeg-devel] [PATCH 3/5] lavfi: deprecate avfilter_link_set_closed().
Applications are not supposed to mess with links, they should close the sinks. Furthermore, this function does not distinguish what end of the link caused the close and does not have a timestamp. Signed-off-by: Nicolas George --- libavfilter/avfilter.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libavfilter/avfilter.h b/libavfilter/avfilter.h index a6aa919..58a0cbd 100644 --- a/libavfilter/avfilter.h +++ b/libavfilter/avfilter.h @@ -541,7 +541,10 @@ int avfilter_link_get_channels(AVFilterLink *link); /** * Set the closed field of a link. + * @deprecated applications are not supposed to mess with links, they should + * close the sinks. */ +attribute_deprecated void avfilter_link_set_closed(AVFilterLink *link, int closed); /** -- 2.6.2 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 2/5] lavfi: add link.current_pts field.
Signed-off-by: Nicolas George --- libavfilter/avfilter.c | 2 ++ libavfilter/avfilter.h | 6 ++ 2 files changed, 8 insertions(+) diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c index e583ec0..06a8239 100644 --- a/libavfilter/avfilter.c +++ b/libavfilter/avfilter.c @@ -237,6 +237,7 @@ int avfilter_config_links(AVFilterContext *filter) } inlink = link->src->nb_inputs ? link->src->inputs[0] : NULL; +link->current_pts = link->current_pts_us = AV_NOPTS_VALUE; switch (link->init_state) { @@ -442,6 +443,7 @@ void ff_update_link_current_pts(AVFilterLink *link, int64_t pts) { if (pts == AV_NOPTS_VALUE) return; +link->current_pts = pts; link->current_pts_us = av_rescale_q(pts, link->time_base, AV_TIME_BASE_Q); /* TODO use duration */ if (link->graph && link->age_index >= 0) diff --git a/libavfilter/avfilter.h b/libavfilter/avfilter.h index b756f56..a6aa919 100644 --- a/libavfilter/avfilter.h +++ b/libavfilter/avfilter.h @@ -435,6 +435,12 @@ struct AVFilterLink { /** * Current timestamp of the link, as defined by the most recent + * frame(s), in link time_base units. + */ +int64_t current_pts; + +/** + * Current timestamp of the link, as defined by the most recent * frame(s), in AV_TIME_BASE units. */ int64_t current_pts_us; -- 2.6.2 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 1/5] lavfi: rename link.current_pts to current_pts_us.
This field is used for fast comparison between link ages, it is in AV_TIME_BASE units, in other words microseconds, µs =~ us. Renaming it allows a second field in link time base units. Signed-off-by: Nicolas George --- libavfilter/avfilter.c | 4 ++-- libavfilter/avfilter.h | 2 +- libavfilter/avfiltergraph.c | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) FATE passes after each patch in this series. Note: this patch and the next could have been merged, but having two separate patches allows to test the intermediate state and check that no use of current_pts was forgotten. diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c index c5c3044..e583ec0 100644 --- a/libavfilter/avfilter.c +++ b/libavfilter/avfilter.c @@ -237,7 +237,7 @@ int avfilter_config_links(AVFilterContext *filter) } inlink = link->src->nb_inputs ? link->src->inputs[0] : NULL; -link->current_pts = AV_NOPTS_VALUE; +link->current_pts_us = AV_NOPTS_VALUE; switch (link->init_state) { case AVLINK_INIT: @@ -442,7 +442,7 @@ void ff_update_link_current_pts(AVFilterLink *link, int64_t pts) { if (pts == AV_NOPTS_VALUE) return; -link->current_pts = av_rescale_q(pts, link->time_base, AV_TIME_BASE_Q); +link->current_pts_us = av_rescale_q(pts, link->time_base, AV_TIME_BASE_Q); /* TODO use duration */ if (link->graph && link->age_index >= 0) ff_avfilter_graph_update_heap(link->graph, link); diff --git a/libavfilter/avfilter.h b/libavfilter/avfilter.h index 7aac3cf..b756f56 100644 --- a/libavfilter/avfilter.h +++ b/libavfilter/avfilter.h @@ -437,7 +437,7 @@ struct AVFilterLink { * Current timestamp of the link, as defined by the most recent * frame(s), in AV_TIME_BASE units. */ -int64_t current_pts; +int64_t current_pts_us; /** * Index in the age array. diff --git a/libavfilter/avfiltergraph.c b/libavfilter/avfiltergraph.c index d749250..ec2245f 100644 --- a/libavfilter/avfiltergraph.c +++ b/libavfilter/avfiltergraph.c @@ -1324,7 +1324,7 @@ static void heap_bubble_up(AVFilterGraph *graph, while (index) { int parent = (index - 1) >> 1; -if (links[parent]->current_pts >= link->current_pts) +if (links[parent]->current_pts_us >= link->current_pts_us) break; links[index] = links[parent]; links[index]->age_index = index; @@ -1346,9 +1346,9 @@ static void heap_bubble_down(AVFilterGraph *graph, if (child >= graph->sink_links_count) break; if (child + 1 < graph->sink_links_count && -links[child + 1]->current_pts < links[child]->current_pts) +links[child + 1]->current_pts_us < links[child]->current_pts_us) child++; -if (link->current_pts < links[child]->current_pts) +if (link->current_pts_us < links[child]->current_pts_us) break; links[index] = links[child]; links[index]->age_index = index; -- 2.6.2 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] ffserver: add NULL context to ff_rtsp_parse_line().
Le nonidi 9 frimaire, an CCXXIV, Michael Niedermayer a écrit : > LGTM Pushed. Regards, -- Nicolas George signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] ffserver: add NULL context to ff_rtsp_parse_line().
On Sun, Nov 29, 2015 at 05:01:52PM +0100, Nicolas George wrote: > Needed after f62fe53/2c17fb6. > > Signed-off-by: Nicolas George > --- > ffserver.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) LGTM thanks [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB When the tyrant has disposed of foreign enemies by conquest or treaty, and there is nothing more to fear from them, then he is always stirring up some war or other, in order that the people may require a leader. -- Plato signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] ffserver: add NULL context to ff_rtsp_parse_line().
Needed after f62fe53/2c17fb6. Signed-off-by: Nicolas George --- ffserver.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) Fix build failure. I am not sure if we can find a relevant context. diff --git a/ffserver.c b/ffserver.c index 7e4f620..65ae431 100644 --- a/ffserver.c +++ b/ffserver.c @@ -2837,7 +2837,7 @@ static int rtsp_parse_request(HTTPContext *c) len = sizeof(line) - 1; memcpy(line, p, len); line[len] = '\0'; -ff_rtsp_parse_line(header, line, NULL, NULL); +ff_rtsp_parse_line(NULL, header, line, NULL, NULL); p = p1 + 1; } -- 2.6.2 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] qsvenc: Add adaptive_i and adaptive_b toggles
On Thu, Nov 26, 2015 at 9:07 PM, Michael Niedermayer wrote: > On Thu, Nov 12, 2015 at 05:10:33PM -0600, Will Kelleher wrote: >> > Scene change detection ? >> > and >> > Content dependant B frame insertion >> > >> > And if people agree then please someone submit a patch with it >> > ill apply it >> > >> >> New patch. >> > >> qsvenc.c |2 ++ >> qsvenc.h |2 ++ >> qsvenc_h264.c |2 ++ >> 3 files changed, 6 insertions(+) >> 9d1c2a0da13b358f77fbb84a3c5ac723d563d46a >> 0001-qsvenc-Add-adaptive_i-and-adaptive_b-toggles.patch >> From 983fb04e74c133de350da41bd5961f8c840ff327 Mon Sep 17 00:00:00 2001 >> From: Will Kelleher >> Date: Tue, 10 Nov 2015 14:30:21 -0600 >> Subject: [PATCH] qsvenc: Add adaptive_i and adaptive_b toggles > > as with the other patch, this too doesnt apply cleanly anymore > can you update it ? > These options were added in a merge from Libav, no further action seems to be required. - Hendrik ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] ffmpeg: When streamcopying, only add the input seek position when copying timestamps.
On 15-11-22 at 15:03, Simon Thelen wrote: > Using -ss as an input option shifts timestamps down by the seek, so it > doesn't have to be added to the recording time when checking whether to > stop. > > Fixes #977 > > Signed-off-by: Simon Thelen > --- > ffmpeg.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/ffmpeg.c b/ffmpeg.c > index bf5e983..6658fb2 100644 > --- a/ffmpeg.c > +++ b/ffmpeg.c > @@ -1831,7 +1831,7 @@ static void do_streamcopy(InputStream *ist, > OutputStream *ost, const AVPacket *p > > if (f->recording_time != INT64_MAX) { > start_time = f->ctx->start_time; > -if (f->start_time != AV_NOPTS_VALUE) > +if (f->start_time != AV_NOPTS_VALUE && copy_ts) > start_time += f->start_time; > if (ist->pts >= f->recording_time + start_time) { > close_output_stream(ost); > -- > 2.6.3 > > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel ping -- Simon Thelen ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] doc/developer: remove warning regarding long long
On Sun, Nov 29, 2015 at 10:14 AM, Nicolas George wrote: > Le nonidi 9 frimaire, an CCXXIV, Ganesh Ajjanagadde a écrit : >> long long is already being used in quite a few places in FFmpeg. There >> is no reason to list it as something to avoid. > > IMHO, most of these places should be replaced by more adapted types. With > modern C, having long, long long or short in the code is usually sign that > something is wrong because their size is not guaranteed at all and, > especially long, varies a lot. Fine, don't really mind since for the foreseeable future, all long long instances may be replaced by int64_t. Just did not see a reason to single it out as being so important in the surrounding context. Patch dropped. > > 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
Re: [FFmpeg-devel] [PATCH] doc/developer: remove warning regarding long long
Le nonidi 9 frimaire, an CCXXIV, Ganesh Ajjanagadde a écrit : > long long is already being used in quite a few places in FFmpeg. There > is no reason to list it as something to avoid. IMHO, most of these places should be replaced by more adapted types. With modern C, having long, long long or short in the code is usually sign that something is wrong because their size is not guaranteed at all and, especially long, varies a lot. Regards, -- Nicolas George signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] doc/developer: remove warning regarding long long
long long is already being used in quite a few places in FFmpeg. There is no reason to list it as something to avoid. Or put in other words, it is definitely out of place in the surrounding context. Signed-off-by: Ganesh Ajjanagadde --- doc/developer.texi | 3 --- 1 file changed, 3 deletions(-) diff --git a/doc/developer.texi b/doc/developer.texi index 455b120..afc707a 100644 --- a/doc/developer.texi +++ b/doc/developer.texi @@ -146,9 +146,6 @@ additional C99 features or GCC extensions. Especially watch out for: mixing statements and declarations; @item -@samp{long long} (use @samp{int64_t} instead); - -@item @samp{__attribute__} not protected by @samp{#ifdef __GNUC__} or similar; @item -- 2.6.2 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] developer.texi: Call out K&R coding style.
On Sat, Nov 28, 2015 at 05:48:57PM -0500, Rick Kern wrote: > 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(+) LGTM as well. Applied, thanks! Timothy ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] developer.texi: Call out K&R coding style.
On Sat, 28 Nov 2015 17:48:57 -0500 Rick Kern wrote: > 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'. > +1 ___ 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 Sun, Nov 29, 2015 at 7:45 AM, Paul B Mahol wrote: > On 11/29/15, Ganesh Ajjanagadde wrote: >> 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. > > Both produce differend md5 output. May have to do with underflow, i.e numbers near 0.5. Anyway, if you care about branchless code here, it may be worthwhile to test since it is just the sign bit of the result. But it should not be worth it for the first patch, especially since you seem to care about bit-exact output with some reference point. [...] ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] lavfi/vf_mpdecimate: remove request_frame().
On Sun, Nov 29, 2015 at 7:36 AM, Nicolas George wrote: > It is no longer needed since looping is not necessary. > > Signed-off-by: Nicolas George > --- > libavfilter/vf_mpdecimate.c | 14 -- > 1 file changed, 14 deletions(-) > > > Passes the FATE test (the one that is broken for windows). > > This is the last filter that needed updatint. Trivial comment: updatint -> updating. Can't give a technical review. [...] ___ 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 11/29/15, Ganesh Ajjanagadde wrote: > 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. Both produce differend md5 output. > >> 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 > ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] lavfi/vf_mpdecimate: remove request_frame().
It is no longer needed since looping is not necessary. Signed-off-by: Nicolas George --- libavfilter/vf_mpdecimate.c | 14 -- 1 file changed, 14 deletions(-) Passes the FATE test (the one that is broken for windows). This is the last filter that needed updatint. diff --git a/libavfilter/vf_mpdecimate.c b/libavfilter/vf_mpdecimate.c index 25efacf..e0d75e0 100644 --- a/libavfilter/vf_mpdecimate.c +++ b/libavfilter/vf_mpdecimate.c @@ -221,19 +221,6 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *cur) return 0; } -static int request_frame(AVFilterLink *outlink) -{ -DecimateContext *decimate = outlink->src->priv; -AVFilterLink *inlink = outlink->src->inputs[0]; -int ret; - -do { -ret = ff_request_frame(inlink); -} while (decimate->drop_count > 0 && ret >= 0); - -return ret; -} - static const AVFilterPad mpdecimate_inputs[] = { { .name = "default", @@ -248,7 +235,6 @@ static const AVFilterPad mpdecimate_outputs[] = { { .name = "default", .type = AVMEDIA_TYPE_VIDEO, -.request_frame = request_frame, }, { NULL } }; -- 2.6.2 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avformat/mlpdec: consider all valid mlp access units when probing
On Tue, Nov 17, 2015 at 5:05 PM, Michael Niedermayer wrote: > On Tue, Nov 17, 2015 at 12:28:58AM +0100, Hendrik Leppkes wrote: >> Fixes probing of truehd/mlp files with a lot of frames in between the >> major sync frames. The spec allows a distance of up to 128 frames in >> between major sync frames, which leads to the probing code not reaching >> the desired score. >> --- >> libavformat/mlpdec.c | 5 - >> 1 file changed, 4 insertions(+), 1 deletion(-) > > should be ok Applied. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avcodec/libdcadec: require first public release
On Fri, Nov 27, 2015 at 7:11 PM, James Almer wrote: > Signed-off-by: James Almer > --- > configure | 4 +--- > libavcodec/libdcadec.c | 6 +++--- > 2 files changed, 4 insertions(+), 6 deletions(-) > > diff --git a/configure b/configure > index 0198b75..5583358 100755 > --- a/configure > +++ b/configure > @@ -1877,7 +1877,6 @@ TYPES_LIST=" > CONDITION_VARIABLE_Ptr > socklen_t > struct_addrinfo > -struct_dcadec_exss_info_matrix_encoding > struct_group_source_req > struct_ip_mreq_source > struct_ipv6_mreq > @@ -5338,8 +5337,7 @@ enabled libcelt && require libcelt > celt/celt.h celt_decode -lcelt0 && > { check_lib celt/celt.h > celt_decoder_create_custom -lcelt0 || > die "ERROR: libcelt must be installed and > version must be >= 0.11.0."; } > enabled libcaca && require_pkg_config caca caca.h > caca_create_canvas > -enabled libdcadec && require_pkg_config dcadec > libdcadec/dca_context.h dcadec_context_create && > - check_struct libdcadec/dca_context.h "struct > dcadec_exss_info" matrix_encoding > +enabled libdcadec && require_pkg_config "dcadec >= 0.1.0" > libdcadec/dca_context.h dcadec_context_create > enabled libfaac && require2 libfaac "stdint.h faac.h" > faacEncGetVersion -lfaac > enabled libfdk_aac&& { use_pkg_config fdk-aac "fdk-aac/aacenc_lib.h" > aacEncOpen || > { require libfdk_aac fdk-aac/aacenc_lib.h > aacEncOpen -lfdk-aac && > diff --git a/libavcodec/libdcadec.c b/libavcodec/libdcadec.c > index a0e34f9..e802076 100644 > --- a/libavcodec/libdcadec.c > +++ b/libavcodec/libdcadec.c > @@ -42,7 +42,7 @@ static int dcadec_decode_frame(AVCodecContext *avctx, void > *data, > { > DCADecContext *s = avctx->priv_data; > AVFrame *frame = data; > -av_unused struct dcadec_exss_info *exss; > +struct dcadec_exss_info *exss; > int ret, i, k; > int **samples, nsamples, channel_mask, sample_rate, bits_per_sample, > profile; > uint32_t mrk; > @@ -78,6 +78,8 @@ static int dcadec_decode_frame(AVCodecContext *avctx, void > *data, > &sample_rate, &bits_per_sample, > &profile)) < 0) { > av_log(avctx, AV_LOG_ERROR, "dcadec_context_filter() failed: %d > (%s)\n", -ret, dcadec_strerror(ret)); > return AVERROR_EXTERNAL; > +} else if (ret > 0) { > +av_log(avctx, AV_LOG_WARNING, "dcadec_context_filter() warning: %d > (%s)\n", ret, dcadec_strerror(ret)); > } > > avctx->channels = av_get_channel_layout_nb_channels(channel_mask); > @@ -129,7 +131,6 @@ static int dcadec_decode_frame(AVCodecContext *avctx, > void *data, > } else > avctx->bit_rate = 0; > > -#if HAVE_STRUCT_DCADEC_EXSS_INFO_MATRIX_ENCODING > if (exss = dcadec_context_get_exss_info(s->ctx)) { > enum AVMatrixEncoding matrix_encoding = AV_MATRIX_ENCODING_NONE; > > @@ -158,7 +159,6 @@ static int dcadec_decode_frame(AVCodecContext *avctx, > void *data, > (ret = ff_side_data_update_matrix_encoding(frame, > matrix_encoding)) < 0) > return ret; > } > -#endif > > frame->nb_samples = nsamples; > if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) > -- > 2.6.3 > LGTM. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel