Re: [FFmpeg-devel] [PATCH] avformat/movenc: Explicitly address potential division by zero.
On Wed, Apr 19, 2017 at 12:49:38AM +0200, Hendrik Leppkes wrote: > On Wed, Apr 19, 2017 at 12:34 AM, Lucas Cooper > wrote: > > find_fps attempts to infer framerate from AVCodec's timebase. When this > > results in a frame rate that isn't explicitly marked as supported in > > av_timecode_check_frame_rate, find_fps returns the AVStream's > > avg_frame_rate, which, per avformat.h, _may_ be set (or not). > > > > mov_get_mpeg2_xdcam_codec_tag, mov_get_h264_codec_tag and > > find_compressor attempt to call av_q2d on the return value of find_fps, > > which in the above case, may result in division by zero. > > Floating point division by zero is not an error (as av_q2d performs), > and in these cases the wrong return value is likely harmless. > > What is the actual error you are trying to fix? from looking at the code, i guess its the cast to int of a non finite double [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB The real ebay dictionary, page 2 "100% positive feedback" - "All either got their money back or didnt complain" "Best seller ever, very honest" - "Seller refunded buyer after failed scam" signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] movenc/isom: update vpcC box to the latest draft specification
On Tue, Apr 18, 2017 at 04:58:29PM +0200, Hendrik Leppkes wrote: > On Tue, Apr 18, 2017 at 4:47 PM, Michael Niedermayer > wrote: > > On Tue, Apr 18, 2017 at 04:30:12PM +0200, Hendrik Leppkes wrote: > >> This brings our generation of the vpcC box up to date to the latest > >> draft version of the VP Codec ISO Media File Format Binding. > >> > >> Specifically, color/transfer properties are now written with values > >> based on ISO/IEC 23001-8, which is the same reference specification the > >> AVColor* enumerations are based on. > >> --- > >> libavformat/vpcc.c | 53 > >> - > >> 1 file changed, 4 insertions(+), 49 deletions(-) > > > > fails to build here: > > > > libavformat/vpcc.c: In function ‘ff_isom_write_vpcc’: > > libavformat/vpcc.c:81:26: error: ‘vpx_color_space’ undeclared (first use in > > this function) > > libavformat/vpcc.c:81:26: note: each undeclared identifier is reported only > > once for each function it appears in > > > > i assume iam missing some change ? > > > > I failed to add a hunk to the patch, new one coming up. confirmed, that fixes it thx [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Democracy is the form of government in which you can choose your dictator signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] Fwd: [PATCH] added expr evaluation to drawtext - fontsize
On Tue, Apr 18, 2017 at 06:20:51PM -0700, Brett Harrison wrote: > On Mon, Apr 17, 2017 at 5:48 PM, Michael Niedermayer > wrote: > > > On Sun, Apr 16, 2017 at 10:01:01PM -0700, Brett Harrison wrote: > > > Any comments on this patch? > > > > > > -- Forwarded message -- > > > From: Brett Harrison > > > Date: Tue, Apr 11, 2017 at 1:37 PM > > > Subject: Re: [FFmpeg-devel] [PATCH] added expr evaluation to drawtext - > > > fontsize > > > To: FFmpeg development discussions and patches > > > > > > > > > Pinging for comments / review... > > > > > > On Tue, Apr 4, 2017 at 3:45 PM, Brett Harrison < > > brett.harri...@zyamusic.com> > > > wrote: > > > > > > > Resurrecting this patch. > > > > > > > > On Thu, Sep 15, 2016 at 3:20 AM, Michael Niedermayer < > > > > mich...@niedermayer.cc> wrote: > > > > > > > >> On Fri, Sep 09, 2016 at 05:26:03PM -0700, Brett Harrison wrote: > > > >> > Here are the changes requested > > > >> [...] > > > >> > +static av_cold int parse_fontsize(AVFilterContext *ctx) > > > >> > +{ > > > >> > +DrawTextContext *s = ctx->priv; > > > >> > +int err; > > > >> > + > > > >> > +if (s->fontsize_expr == NULL) > > > >> > +return AVERROR(EINVAL); > > > >> > + > > > >> > +av_expr_free(s->fontsize_pexpr); > > > >> > +s->fontsize_pexpr = NULL; > > > >> > + > > > >> > +if ((err = av_expr_parse(&s->fontsize_pexpr, s->fontsize_expr, > > > >> var_names, > > > >> > + NULL, NULL, fun2_names, fun2, 0, > > ctx)) < > > > >> 0) > > > >> > +return err; > > > >> > + > > > >> > +return 0; > > > >> > +} > > > >> > > > >> why is av_expr_parse() not executed where the other av_expr_parse() > > > >> are ? > > > >> > > > > > > > > I needed to perform av_expr_parse() during init() to resolve the > > default > > > > fontsize. init() is called before config_input() where the other > > > > av_expr_parse() calls are. > > > > > > > > > > > > > vf_drawtext.c | 125 ++ > > > > > 1 file changed, 108 insertions(+), 17 deletions(-) > > > 085506596906b7f89f46edf6d21d34374e92d994 0001-added-expr-evaluation-to- > > drawtext-fontsize.patch > > > From 8647e01f8ac2cd622e0ff5c1257773cfffa01ed9 Mon Sep 17 00:00:00 2001 > > > From: Brett Harrison > > > Date: Tue, 4 Apr 2017 15:39:06 -0700 > > > Subject: [PATCH] added expr evaluation to drawtext - fontsize > > > > > > --- > > > libavfilter/vf_drawtext.c | 125 ++ > > +--- > > > 1 file changed, 108 insertions(+), 17 deletions(-) > > > > > > diff --git a/libavfilter/vf_drawtext.c b/libavfilter/vf_drawtext.c > > > index 8b24f50..77209f3 100644 > > > --- a/libavfilter/vf_drawtext.c > > > +++ b/libavfilter/vf_drawtext.c > > > @@ -156,7 +156,10 @@ typedef struct DrawTextContext { > > > int max_glyph_h;///< max glyph height > > > int shadowx, shadowy; > > > int borderw;///< border width > > > +char *fontsize_expr;///< expression for fontsize > > > +AVExpr *fontsize_pexpr; ///< parsed expressions for fontsize > > > unsigned int fontsize; ///< font size to use > > > +unsigned int default_fontsize; ///< default font size to use > > > > > > int line_spacing; ///< lines spacing in pixels > > > short int draw_box; ///< draw box around text - true or > > false > > > @@ -211,7 +214,7 @@ static const AVOption drawtext_options[]= { > > > {"box", "set box", OFFSET(draw_box), > > AV_OPT_TYPE_BOOL, {.i64=0}, 0,1 , FLAGS}, > > > {"boxborderw", "set box border width", OFFSET(boxborderw), > > AV_OPT_TYPE_INT,{.i64=0}, INT_MIN, INT_MAX , FLAGS}, > > > {"line_spacing", "set line spacing in pixels", > > OFFSET(line_spacing), AV_OPT_TYPE_INT,{.i64=0}, INT_MIN, > > INT_MAX,FLAGS}, > > > -{"fontsize","set font size",OFFSET(fontsize), > > AV_OPT_TYPE_INT,{.i64=0}, 0,INT_MAX , FLAGS}, > > > +{"fontsize","set font size",OFFSET(fontsize_expr), > > AV_OPT_TYPE_STRING, {.str=NULL}, CHAR_MIN, CHAR_MAX , FLAGS}, > > > {"x", "set x expression", OFFSET(x_expr), > > AV_OPT_TYPE_STRING, {.str="0"}, CHAR_MIN, CHAR_MAX, FLAGS}, > > > {"y", "set y expression", OFFSET(y_expr), > > AV_OPT_TYPE_STRING, {.str="0"}, CHAR_MIN, CHAR_MAX, FLAGS}, > > > {"shadowx", "set shadow x offset", OFFSET(shadowx), > > AV_OPT_TYPE_INT,{.i64=0}, INT_MIN, INT_MAX , FLAGS}, > > > @@ -281,6 +284,7 @@ typedef struct Glyph { > > > FT_Glyph glyph; > > > FT_Glyph border_glyph; > > > uint32_t code; > > > +unsigned int fontsize; > > > FT_Bitmap bitmap; ///< array holding bitmaps of font > > > FT_Bitmap border_bitmap; ///< array holding bitmaps of font border > > > FT_BBox bbox; > > > @@ -293,7 +297,11 @@ static int glyph_cmp(
Re: [FFmpeg-devel] [PATCH] avformat/movenc: Explicitly address potential division by zero.
Michael's right. The problem is that NaN is casted to an int, resulting in rate having undefined value. Not sure how I neglected to add that part. On 19 Apr. 2017 2:32 am, "Michael Niedermayer" wrote: > On Wed, Apr 19, 2017 at 12:49:38AM +0200, Hendrik Leppkes wrote: > > On Wed, Apr 19, 2017 at 12:34 AM, Lucas Cooper > > wrote: > > > find_fps attempts to infer framerate from AVCodec's timebase. When this > > > results in a frame rate that isn't explicitly marked as supported in > > > av_timecode_check_frame_rate, find_fps returns the AVStream's > > > avg_frame_rate, which, per avformat.h, _may_ be set (or not). > > > > > > mov_get_mpeg2_xdcam_codec_tag, mov_get_h264_codec_tag and > > > find_compressor attempt to call av_q2d on the return value of find_fps, > > > which in the above case, may result in division by zero. > > > > Floating point division by zero is not an error (as av_q2d performs), > > and in these cases the wrong return value is likely harmless. > > > > What is the actual error you are trying to fix? > > from looking at the code, i guess its the cast to int of a non finite > double > > [...] > > -- > Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB > > The real ebay dictionary, page 2 > "100% positive feedback" - "All either got their money back or didnt > complain" > "Best seller ever, very honest" - "Seller refunded buyer after failed scam" > > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 3/3] tests/fate-run.sh: Show packet flags for fate gapless tests.
On Mon, Sep 26, 2016 at 11:42:52AM -0700, Sasi Inguva wrote: > Signed-off-by: Sasi Inguva > --- > tests/fate-run.sh| 2 +- > tests/ref/fate/gaplessenc-itunes-to-ipod-aac | 32 > ++-- > tests/ref/fate/gaplessenc-pcm-to-mov-aac | 32 > ++-- > tests/ref/fate/gaplessinfo-itunes1 | 32 > ++-- > tests/ref/fate/gaplessinfo-itunes2 | 32 > ++-- > 5 files changed, 65 insertions(+), 65 deletions(-) applied [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Opposition brings concord. Out of discord comes the fairest harmony. -- Heraclitus signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] Added require fallback for libmfx in the case that pkg-config cannot find libmfx
On 4/14/2017 6:51 PM, Aaron Levinson wrote: From e0c73c054add0137901d0bf7a7893e42e7e566c8 Mon Sep 17 00:00:00 2001 From: Aaron Levinson Date: Fri, 14 Apr 2017 18:38:37 -0700 Subject: [PATCH] Added require fallback for libmfx in the case that pkg-config cannot find libmfx Purpose: Added require fallback for libmfx in the case that pkg-config cannot find libmfx. On Linux, most people likely get libmfx via https://github.com/lu-zero/mfx_dispatch , but on Windows, the most well-known way to get libmfx is via the Intel Media SDK, which provides a static build of libmfx.lib and also provides the source code for building libmfx yourself. If built this way, there are no pkg-config files to be found. The changes utilize a similar approach to that already done for libx264 in configure. Comments: -- configure: Altered enabled libmfx step to use use_pkg_config() instead of require_pkg_config(), and, if use_pkg_config() fails, it falls back to require(). Note that the reason that require() is passed -llibmfx as the last argument, instead of -lmfx, is the file name for the library produced from the Intel Media SDK starts with "libmfx". Apparently, the filename for the library produced via https://github.com/lu-zero/mfx_dispatch starts with "mfx". --- configure | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/configure b/configure index 3bea057..b20a0b4 100755 --- a/configure +++ b/configure @@ -5819,7 +5819,8 @@ enabled libgsm&& { for gsm_hdr in "gsm.h" "gsm/gsm.h"; do done || die "ERROR: libgsm not found"; } enabled libilbc && require libilbc ilbc.h WebRtcIlbcfix_InitDecode -lilbc enabled libkvazaar&& require_pkg_config "kvazaar >= 0.8.1" kvazaar.h kvz_api_get -enabled libmfx&& require_pkg_config libmfx "mfx/mfxvideo.h" MFXInit +enabled libmfx&& { use_pkg_config libmfx "mfx/mfxvideo.h" MFXInit || + { require libmfx "mfx/mfxvideo.h" MFXInit -llibmfx && warn "using libmfx without pkg-config"; } } enabled libmodplug&& require_pkg_config libmodplug libmodplug/modplug.h ModPlug_Load enabled libmp3lame&& require "libmp3lame >= 3.98.3" lame/lame.h lame_set_VBR_quality -lmp3lame enabled libnut&& require libnut libnut.h nut_demuxer_init -lnut Pinging this patch submission again. Thanks, Aaron Levinson ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] this is the gsos qualification task which use psychoacoustic system to detect transients in vorbis encoder.
On Sun, Apr 16, 2017 at 10:23:05PM -0400, 汲如意 wrote: > Hi, I am sorry for my mistakes. I have fixed them. And attachment is the > patch which fix error in first one. Thanks. this segfaults make fate-vorbis-encode ffmpeg -i fate-suite//audio-reference/luckynight_2ch_44kHz_s16.wav -c:a vorbis -strict experimental -f ogg -y vorbis-encode.ogg also please send complete patches and not a patch + a bugfix on top of it ==30596== Conditional jump or move depends on uninitialised value(s) ==30596==at 0xF3736B: ff_psy_init (psymodel.c:59) ==30596==by 0xBBAFFD: vorbis_encode_init (vorbisenc.c:1250) ==30596==by 0xB61BC5: avcodec_open2 (utils.c:1001) ==30596==by 0x43695D: init_output_stream (ffmpeg.c:3427) ==30596==by 0x42E562: reap_filters (ffmpeg.c:1441) ==30596==by 0x43ACAA: transcode_step (ffmpeg.c:4511) ==30596==by 0x43AD8E: transcode (ffmpeg.c:4555) ==30596==by 0x43B563: main (ffmpeg.c:4760) ==30596== ==30596== Invalid write of size 8 ==30596==at 0xF3732A: ff_psy_init (psymodel.c:60) ==30596==by 0xBBAFFD: vorbis_encode_init (vorbisenc.c:1250) ==30596==by 0xB61BC5: avcodec_open2 (utils.c:1001) ==30596==by 0x43695D: init_output_stream (ffmpeg.c:3427) ==30596==by 0x42E562: reap_filters (ffmpeg.c:1441) ==30596==by 0x43ACAA: transcode_step (ffmpeg.c:4511) ==30596==by 0x43AD8E: transcode (ffmpeg.c:4555) ==30596==by 0x43B563: main (ffmpeg.c:4760) ==30596== Address 0x108c1508 is 0 bytes after a block of size 296 alloc'd ==30596==at 0x4C2A6C5: memalign (vg_replace_malloc.c:727) ==30596==by 0x4C2A760: posix_memalign (vg_replace_malloc.c:876) ==30596==by 0x10C17CB: av_malloc (mem.c:87) ==30596==by 0x10C1A73: av_mallocz (mem.c:224) ==30596==by 0xF3713B: av_mallocz_array (mem.h:233) ==30596==by 0xF371A3: ff_psy_init (psymodel.c:39) ==30596==by 0xBBAFFD: vorbis_encode_init (vorbisenc.c:1250) ==30596==by 0xB61BC5: avcodec_open2 (utils.c:1001) ==30596==by 0x43695D: init_output_stream (ffmpeg.c:3427) ==30596==by 0x42E562: reap_filters (ffmpeg.c:1441) ==30596==by 0x43ACAA: transcode_step (ffmpeg.c:4511) ==30596==by 0x43AD8E: transcode (ffmpeg.c:4555) ==30596== --30596-- VALGRIND INTERNAL ERROR: Valgrind received a signal 11 (SIGSEGV) - exiting --30596-- si_code=1; Faulting address: 0x211ADB50; sp: 0x4046efd50 [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB He who knows, does not speak. He who speaks, does not know. -- Lao Tsu signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [Patch] NVENC Surface Allocation Reduction
Hi, This patch aims to reduce the number of input/output surfaces NVENC allocates per session. Previous default sets allocated surfaces to 32 (unless there is user specified param or lookahead involved). Having large number of surfaces consumes extra video memory (esp for higher resolution encoding), and perf return saturates at a certain point. The patch changes the surfaces calculation for default, B-frames, lookahead scenario respectively. The other change involves surface selection. Previously, if a session allocates x surfaces, only x-1 surfaces are used (due to combination of output delay and lock toggle logic). To prevent unused surfaces, changing surface rotation to using predefined fifo. Testing done: -Ensure the above changes have no perf impact and does not change bitstream Thanks, Ben --- This email message is for the sole use of the intended recipient(s) and may contain confidential information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message. --- NVENC_surface_allocation_reduction.patch Description: NVENC_surface_allocation_reduction.patch ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] ffmpeg; check return code of avcodec_send_frame when flushing encoders
On Tue, 18 Apr 2017, Michael Niedermayer wrote: On Tue, Apr 18, 2017 at 08:46:24PM +0200, Marton Balint wrote: On Tue, 18 Apr 2017, Michael Niedermayer wrote: On Tue, Apr 18, 2017 at 07:09:30AM +0200, Nicolas George wrote: Le nonidi 29 germinal, an CCXXV, Michael Niedermayer a écrit : +while ((ret = avcodec_receive_packet(enc, &pkt)) == AVERROR(EAGAIN)) { +ret = avcodec_send_frame(enc, NULL); The doc says: # The functions will not return AVERROR(EAGAIN), unless you forgot to # enter draining mode. The full paragraph in the docs which you qoted from says this: * - Call avcodec_receive_frame() (decoding) or avcodec_receive_packet() * (encoding) in a loop until AVERROR_EOF is returned. The functions will * not return AVERROR(EAGAIN), unless you forgot to enter draining mode. the patch adds a check to avcodec_send_frame() can the code be changed to not require this ? I would say the code does not require this as is. For decoding theres an explicit "Sending the first flush packet will return success." As far as I see this sentence is only true if there was no decoding error in the legacy API during a flush. So this should probably be changed to something like "The first flush packet will not return AVERROR_EOF, if it returns success then any subsequent flush packets will return AVERROR_EOF." By the way we also guarantee this at libavcodec level, so it is harder to write a codec with the new API which violates this. I cannot find similar for encoding, which is the case the patch changes and what i think should be fixed if possible as it would be simpler, making the patch unneeded. Its quite possible iam missing something that makes it uneeded though The same is true for send_frame, based on the code involving the legacy API. We can of course decide to change the code involving the legacy API and enforce that flushing always succeed, but I'd rather keep it as is, even if that means a bit more error checking. It would be ugly API-wise that you sometimes have to check the return value of a function, sometimes you don't. iam happy with any solution or the patch as is Unless there are no further comments I will apply this as is and backport it to 3.3 as well. Regards, Marton ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] avfilter: add deflicker filter
Signed-off-by: Paul B Mahol --- doc/filters.texi | 38 libavfilter/Makefile | 1 + libavfilter/allfilters.c | 1 + libavfilter/vf_deflicker.c | 455 + 4 files changed, 495 insertions(+) create mode 100644 libavfilter/vf_deflicker.c diff --git a/doc/filters.texi b/doc/filters.texi index e002f25..83b8111 100644 --- a/doc/filters.texi +++ b/doc/filters.texi @@ -6253,6 +6253,44 @@ Limit the maximum change for each plane, default is 65535. If 0, plane will remain unchanged. @end table +@section deflicker + +Remove temporal frame luminance variations. + +It accepts the following options: + +@table @option +@item size, s +Set moving-average filter size. Default is 5. Allowed range is 2 - 129. + +@item mode, m +Set averaging mode to smooth temporal luminance variations. + +Available values are: +@table @samp +@item am +Arithmetic mean + +@item gm +Geometric mean + +@item hm +Harmonic mean + +@item qm +Quadratic mean + +@item cm +Cubic mean + +@item pm +Power mean + +@item median +Median +@end table +@end table + @section dejudder Remove judder produced by partially interlaced telecined content. diff --git a/libavfilter/Makefile b/libavfilter/Makefile index d6daa7a..6de7cc0 100644 --- a/libavfilter/Makefile +++ b/libavfilter/Makefile @@ -155,6 +155,7 @@ OBJS-$(CONFIG_DCTDNOIZ_FILTER) += vf_dctdnoiz.o OBJS-$(CONFIG_DEBAND_FILTER) += vf_deband.o OBJS-$(CONFIG_DECIMATE_FILTER) += vf_decimate.o OBJS-$(CONFIG_DEFLATE_FILTER)+= vf_neighbor.o +OBJS-$(CONFIG_DEFLICKER_FILTER) += vf_deflicker.o OBJS-$(CONFIG_DEINTERLACE_QSV_FILTER)+= vf_deinterlace_qsv.o OBJS-$(CONFIG_DEINTERLACE_VAAPI_FILTER) += vf_deinterlace_vaapi.o OBJS-$(CONFIG_DEJUDDER_FILTER) += vf_dejudder.o diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c index ec6ec04..0e69f99 100644 --- a/libavfilter/allfilters.c +++ b/libavfilter/allfilters.c @@ -166,6 +166,7 @@ static void register_all(void) REGISTER_FILTER(DEBAND, deband, vf); REGISTER_FILTER(DECIMATE, decimate, vf); REGISTER_FILTER(DEFLATE,deflate,vf); +REGISTER_FILTER(DEFLICKER, deflicker, vf); REGISTER_FILTER(DEINTERLACE_QSV,deinterlace_qsv,vf); REGISTER_FILTER(DEINTERLACE_VAAPI, deinterlace_vaapi, vf); REGISTER_FILTER(DEJUDDER, dejudder, vf); diff --git a/libavfilter/vf_deflicker.c b/libavfilter/vf_deflicker.c new file mode 100644 index 000..bf0c847 --- /dev/null +++ b/libavfilter/vf_deflicker.c @@ -0,0 +1,455 @@ +/* + * Copyright (c) 2017 Paul B Mahol + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "libavutil/imgutils.h" +#include "libavutil/opt.h" +#include "libavutil/pixdesc.h" +#include "libavutil/qsort.h" +#include "avfilter.h" + +#define FF_BUFQUEUE_SIZE 129 +#include "bufferqueue.h" + +#include "formats.h" +#include "internal.h" +#include "video.h" + +#define SIZE FF_BUFQUEUE_SIZE + +enum smooth_mode { +ARITHMETIC_MEAN, +GEOMETRIC_MEAN, +HARMONIC_MEAN, +QUADRATIC_MEAN, +CUBIC_MEAN, +POWER_MEAN, +MEDIAN, +NB_SMOOTH_MODE, +}; + +typedef struct DeflickerContext { +const AVClass *class; + +int size; +int mode; + +int eof; +int depth; +int nb_planes; +int planewidth[4]; +int planeheight[4]; + +uint64_t *histogram; +float luminance[SIZE]; +float sorted[SIZE]; + +struct FFBufQueue q; +int available; + +void (*get_factor)(AVFilterContext *ctx, float *f); +float (*calc_avgy)(AVFilterContext *ctx, AVFrame *in); +int (*deflicker)(AVFilterContext *ctx, AVFrame *in, AVFrame *out, float f); +} DeflickerContext; + +#define OFFSET(x) offsetof(DeflickerContext, x) +#define FLAGS AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM + +static const AVOption deflicker_options[] = { +{ "size", "set how many frames to use", OFFSET(size), AV_OPT_TYPE_INT, {.i64=5}, 2, SIZE, FLAGS }, +{ "s", "set how many frames to use", OFFSET(size), AV_OPT_TYPE_INT, {.i64=5}, 2, SIZE, FLAGS }, +{ "mode", "set how to smooth luminance", OFFSET(mode), AV_OPT_TYPE_INT, {.i64=0}, 0, 1, FLAGS,
Re: [FFmpeg-devel] libavutil/thread.h: Fixed g++ build error when ASSERT_LEVEL is greater than 1
On Mon, 17 Apr 2017, James Almer wrote: On 4/17/2017 5:39 AM, Clément Bœsch wrote: On Sun, Apr 16, 2017 at 05:20:02PM -0700, Aaron Levinson wrote: From 9e6a9e2b8d58f17c661a3f455e03c95587ec7b18 Mon Sep 17 00:00:00 2001 From: Aaron Levinson Date: Sun, 16 Apr 2017 17:13:31 -0700 Subject: [PATCH] libavutil/thread.h: Fixed g++ build error when ASSERT_LEVEL is greater than 1 Purpose: libavutil/thread.h: Fixed g++ build error when ASSERT_LEVEL is greater than 1. This is only relevant when thread.h is included by C++ files. In this case, the relevant code is only defined if HAVE_PTHREADS is defined as 1. Use configure --assert-level=2 to do so. Note: Issue discovered as a result of Coverity build failure. Cause of build failure pinpointed by Hendrik Leppkes. Comments: -- libavutil/thread.h: Altered ASSERT_PTHREAD_NORET definition such that it uses av_make_error_string instead of av_err2str(). av_err2str() uses a "parenthesized type followed by an initializer list", which is apparently not valid C++. This issue started occurring because thread.h is now included by the DeckLink C++ files. The alteration does the equivalent of what av_err2str() does, but instead declares the character buffer as a local variable. --- libavutil/thread.h | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libavutil/thread.h b/libavutil/thread.h index 6e57447..f108e20 100644 --- a/libavutil/thread.h +++ b/libavutil/thread.h @@ -36,8 +36,11 @@ #define ASSERT_PTHREAD_NORET(func, ...) do {\ int ret = func(__VA_ARGS__);\ if (ret) { \ +char errbuf[AV_ERROR_MAX_STRING_SIZE] = ""; \ av_log(NULL, AV_LOG_FATAL, AV_STRINGIFY(func) \ - " failed with error: %s\n", av_err2str(AVERROR(ret))); \ + " failed with error: %s\n", \ + av_make_error_string(errbuf, AV_ERROR_MAX_STRING_SIZE, \ +AVERROR(ret))); \ abort();\ } \ } while (0) I don't like limiting ourselves in the common C code of the project because C++ is a bad and limited language. Can't you solve this by bumping the minimal requirement of C++ version? We're already using C++11 when available because of atomics on mediacodec. Also, just tried and it seems to fail even with C++14, so it just doesn't work with C++. We could instead just make these strict assert wrappers work only on C code by for example checking for defined(__cplusplus). I'd say let's apply the patch as is, that is the simplest solution. Regards, Marton ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH]lavf/mov: Only copy extradata if it exists.
2017-04-18 16:33 GMT+02:00 Michael Niedermayer : > On Tue, Apr 18, 2017 at 10:59:31AM +0200, Carl Eugen Hoyos wrote: >> Hi! >> >> Attached patch fixes an ubsan warning like the following here: >> libavformat/mov.c:2332:13: runtime error: null pointer passed as argument 2, >> which is declared to never be null >> >> Please comment, Carl Eugen > >> mov.c |2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> 6e412b49316b5c6529c476233d54723c24b1d740 >> 0001-lavf-mov-Only-copy-extradata-if-it-exists.patch >> From b117fdd2adf3271fcaf8f9388866aaf115284f74 Mon Sep 17 00:00:00 2001 >> From: Carl Eugen Hoyos >> Date: Tue, 18 Apr 2017 10:56:31 +0200 >> Subject: [PATCH] lavf/mov: Only copy extradata if it exists. >> >> Avoids undefined call of memcpy(ptr, NULL, 0); >> --- >> libavformat/mov.c |2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) > > LGTM Patch applied. Thank you, Carl Eugen ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH]lavc/motion_est: Fix undefined negative left shifts
2017-04-18 16:28 GMT+02:00 Michael Niedermayer : > On Tue, Apr 18, 2017 at 11:04:34AM +0200, Carl Eugen Hoyos wrote: >> Hi! >> >> Attached patch fixes the following ubsan errors: >> libavcodec/motion_est.c:959:42: runtime error: left shift of negative >> value -16 >> libavcodec/motion_est.c:960:42: runtime error: left shift of negative >> value -16 >> >> I do not have a testcase for lines 961f. >> >> Please comment, Carl Eugen > >> motion_est.c |8 >> 1 file changed, 4 insertions(+), 4 deletions(-) >> 835e20f48e7c0b1df3bdba09f3723e21a4cfd155 >> 0001-lavc-motion_est-Fix-undefined-negative-left-shifts.patch >> From 4dd1b8d61c5dd2e77b7c855a1d2acf7d90277daf Mon Sep 17 00:00:00 2001 >> From: Carl Eugen Hoyos >> Date: Tue, 18 Apr 2017 11:02:30 +0200 >> Subject: [PATCH] lavc/motion_est: Fix undefined negative left shifts. > > LGTM Patch applied. Thank you, Carl Eugen ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avfilter: add deflicker filter
On 4/19/2017 6:04 PM, Paul B Mahol wrote: Signed-off-by: Paul B Mahol --- doc/filters.texi | 38 libavfilter/Makefile | 1 + libavfilter/allfilters.c | 1 + libavfilter/vf_deflicker.c | 455 + 4 files changed, 495 insertions(+) create mode 100644 libavfilter/vf_deflicker.c diff --git a/doc/filters.texi b/doc/filters.texi index e002f25..83b8111 100644 --- a/doc/filters.texi +++ b/doc/filters.texi @@ -6253,6 +6253,44 @@ Limit the maximum change for each plane, default is 65535. If 0, plane will remain unchanged. @end table +@section deflicker + +Remove temporal frame luminance variations. + +It accepts the following options: + +@table @option +@item size, s +Set moving-average filter size. Default is 5. Allowed range is 2 - 129. + +@item mode, m +Set averaging mode to smooth temporal luminance variations. + +Available values are: +@table @samp +@item am +Arithmetic mean + +@item gm +Geometric mean + +@item hm +Harmonic mean + +@item qm +Quadratic mean + +@item cm +Cubic mean + +@item pm +Power mean + +@item median +Median +@end table +@end table + @section dejudder Remove judder produced by partially interlaced telecined content. diff --git a/libavfilter/Makefile b/libavfilter/Makefile index d6daa7a..6de7cc0 100644 --- a/libavfilter/Makefile +++ b/libavfilter/Makefile @@ -155,6 +155,7 @@ OBJS-$(CONFIG_DCTDNOIZ_FILTER) += vf_dctdnoiz.o OBJS-$(CONFIG_DEBAND_FILTER) += vf_deband.o OBJS-$(CONFIG_DECIMATE_FILTER) += vf_decimate.o OBJS-$(CONFIG_DEFLATE_FILTER)+= vf_neighbor.o +OBJS-$(CONFIG_DEFLICKER_FILTER) += vf_deflicker.o OBJS-$(CONFIG_DEINTERLACE_QSV_FILTER)+= vf_deinterlace_qsv.o OBJS-$(CONFIG_DEINTERLACE_VAAPI_FILTER) += vf_deinterlace_vaapi.o OBJS-$(CONFIG_DEJUDDER_FILTER) += vf_dejudder.o diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c index ec6ec04..0e69f99 100644 --- a/libavfilter/allfilters.c +++ b/libavfilter/allfilters.c @@ -166,6 +166,7 @@ static void register_all(void) REGISTER_FILTER(DEBAND, deband, vf); REGISTER_FILTER(DECIMATE, decimate, vf); REGISTER_FILTER(DEFLATE,deflate,vf); +REGISTER_FILTER(DEFLICKER, deflicker, vf); REGISTER_FILTER(DEINTERLACE_QSV,deinterlace_qsv,vf); REGISTER_FILTER(DEINTERLACE_VAAPI, deinterlace_vaapi, vf); REGISTER_FILTER(DEJUDDER, dejudder, vf); diff --git a/libavfilter/vf_deflicker.c b/libavfilter/vf_deflicker.c new file mode 100644 index 000..bf0c847 --- /dev/null +++ b/libavfilter/vf_deflicker.c @@ -0,0 +1,455 @@ +/* + * Copyright (c) 2017 Paul B Mahol + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "libavutil/imgutils.h" +#include "libavutil/opt.h" +#include "libavutil/pixdesc.h" +#include "libavutil/qsort.h" +#include "avfilter.h" + +#define FF_BUFQUEUE_SIZE 129 +#include "bufferqueue.h" + +#include "formats.h" +#include "internal.h" +#include "video.h" + +#define SIZE FF_BUFQUEUE_SIZE + +enum smooth_mode { +ARITHMETIC_MEAN, +GEOMETRIC_MEAN, +HARMONIC_MEAN, +QUADRATIC_MEAN, +CUBIC_MEAN, +POWER_MEAN, +MEDIAN, +NB_SMOOTH_MODE, +}; + +typedef struct DeflickerContext { +const AVClass *class; + +int size; +int mode; + +int eof; +int depth; +int nb_planes; +int planewidth[4]; +int planeheight[4]; + +uint64_t *histogram; +float luminance[SIZE]; +float sorted[SIZE]; + +struct FFBufQueue q; +int available; + +void (*get_factor)(AVFilterContext *ctx, float *f); +float (*calc_avgy)(AVFilterContext *ctx, AVFrame *in); +int (*deflicker)(AVFilterContext *ctx, AVFrame *in, AVFrame *out, float f); +} DeflickerContext; + +#define OFFSET(x) offsetof(DeflickerContext, x) +#define FLAGS AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM + +static const AVOption deflicker_options[] = { +{ "size", "set how many frames to use", OFFSET(size), AV_OPT_TYPE_INT, {.i64=5}, 2, SIZE, FLAGS }, +{ "s", "set how many frames to use", OFFSET(size), AV_OPT_TYPE_INT, {.i64=5}, 2, SIZE, FLAGS }, +{ "mode", "set how to smoo
Re: [FFmpeg-devel] [PATCH] avcodec/aac_adtstoasc: fix ASC passthrough on small frames
On 4/17/2017 8:59 PM, Michael Niedermayer wrote: On Wed, Apr 12, 2017 at 09:52:41PM -0300, James Almer wrote: ASC frames smaller than AAC_ADTS_HEADER_SIZE were being discarded. Signed-off-by: James Almer --- libavcodec/aac_adtstoasc_bsf.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) LGTM thx Pushed. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH v2] libavformat/tcp: fix return code for tcp_accept
On 17-04-08 at 14:21, Simon Thelen wrote: > ff_accept can return AVERROR(ETIMEDOUT) and errno will be 0 (or > undefined), return ret instead and return ff_neterror() in > ff_poll_interrupt instead of AVERROR(errno) to parse WSAGetLastError on > Windows. > --- > v2 rewords the commit message to better elucidate the issue. > > libavformat/network.c | 2 +- > libavformat/tcp.c | 2 +- > 2 files changed, 2 insertions(+), 2 deletions(-) > > diff --git a/libavformat/network.c b/libavformat/network.c > index 2fb1c8b02a..b3987a4d11 100644 > --- a/libavformat/network.c > +++ b/libavformat/network.c > @@ -159,7 +159,7 @@ static int ff_poll_interrupt(struct pollfd *p, nfds_t > nfds, int timeout, > if (!ret) > return AVERROR(ETIMEDOUT); > if (ret < 0) > -return AVERROR(errno); > +return ff_neterrno(); > return ret; > } > > diff --git a/libavformat/tcp.c b/libavformat/tcp.c > index 3055e48015..07b4ed9fa3 100644 > --- a/libavformat/tcp.c > +++ b/libavformat/tcp.c > @@ -204,7 +204,7 @@ static int tcp_accept(URLContext *s, URLContext **c) > cc = (*c)->priv_data; > ret = ff_accept(sc->fd, sc->listen_timeout, s); > if (ret < 0) > -return ff_neterrno(); > +return ret; > cc->fd = ret; > return 0; > } > -- > 2.12.2 > > ___ > 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