Re: [FFmpeg-devel] [PATCH, v3] lavf/vf_vpp_qsv: add support for QSV transpose filter

2019-07-14 Thread Fu, Linjie
> -Original Message-
> From: Li, Zhong
> Sent: Sunday, July 14, 2019 19:33
> To: FFmpeg development discussions and patches  de...@ffmpeg.org>
> Cc: Fu, Linjie 
> Subject: RE: [FFmpeg-devel] [PATCH, v3] lavf/vf_vpp_qsv: add support for
> QSV transpose filter
> 
> > From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On
> Behalf
> > Of Linjie Fu
> > Sent: Thursday, July 11, 2019 1:58 AM
> > To: ffmpeg-devel@ffmpeg.org
> > Cc: Fu, Linjie 
> > Subject: [FFmpeg-devel] [PATCH, v3] lavf/vf_vpp_qsv: add support for
> QSV
> > transpose filter
> >
> > Add transpose support for qsv_vpp with rotate and hflip:
> > - rotate: [0, 3] support clockwise rotation of 0, 90, 180, 270;
> > - hflip:  [0, 1] support horizontal flip;
> >
> > Configure with:
> > {"cclock_hflip","clock","cclock","clock_hflip","reversal","hflip","vflip"}
> >
> > Limitation:
> > If pipeline contains resize, mirroring and other, VPP skips other 
> > filters in
> > MSDK when IOPattern equals d3d->d3d. So "cclock_hflip, clock_hflip, vflip"
> > will not work in d3d->d3d condition.
> >
> > This pr is fixing this:
> > https://github.com/Intel-Media-SDK/MediaSDK/pull/1491
> >
> > CMD:
> > ffmpeg -hwaccel qsv -c:v h264_qsv -i input.h264
> > -vf 'format=qsv,vpp_qsv=transpose=clock' -c:v h264_qsv output.h264
> 
> Tested:
> ffmpeg -hwaccel qsv -c:v h264_qsv -i
> ~/bbb_sunflower_1080p_30fps_normal.mp4 -vframes 100 -vf
> 'format=qsv,vpp_qsv=transpose=cclock_hflip' -c:v h264_qsv ch.mp4
> Both Skylake and KBL failed:
> 
> [Parsed_vpp_qsv_1 @ 0x5581aaf16080] Failed to create a qsvvpp, ret = -15.
> [Parsed_vpp_qsv_1 @ 0x5581aaf16080] Failed to configure output pad on
> Parsed_vpp_qsv_1
> Error reinitializing filters!
> Failed to inject frame into filter network: Block device required
> Error while processing the decoded data for stream #0:0

It is due to the limitation in MSDK mentioned in commit message:
If pipeline contains resize, mirroring and other, VPP skips other filters in 
MSDK.

And specially for resize (also width/height swap caused  by rotate), 
MFXVideoVPP_Init
would fail directly, not simply skip the resize/rotate:
https://github.com/Intel-Media-SDK/MediaSDK/blob/master/_studio/mfx_lib/vpp/src/mfx_vpp_hw.cpp#L5546

This PR could handle this properly as suggested:
https://github.com/Intel-Media-SDK/MediaSDK/pull/1491

- linjie
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH] lavf/vf_freezedetect: improve for the freeze frame detection

2019-07-14 Thread Limin Wang
On Sun, Jul 14, 2019 at 11:51:27AM +0200, Marton Balint wrote:
> 
> 
> On Sun, 14 Jul 2019, Limin Wang wrote:
> 
> >On Sat, Jul 13, 2019 at 07:24:59PM +0200, Marton Balint wrote:
> >>
> >>
> >>On Sat, 13 Jul 2019, lance.lmw...@gmail.com wrote:
> >>
> >>>From: Limin Wang 
> >>>
> >>>I have samples failed to detect the freeze frame with the default -60dB
> >>>noise(-40dB is OK to detect),
> >>>after apply the patch, it's ok to detect.
> >>>
> >>>I run the testing with fate-suite sample for your testing:
> >>>old: no freeze frame detect.
> >>>
> >>>with the patch:
> >>>./ffmpeg -i fate-suite/svq3/Vertical400kbit.sorenson3.mov -vf
> >>>freezedetect=n=-60dB -an -f null -
> >>>[freezedetect @ 0x7fe18a604900] lavfi.freezedetect.freeze_start: 38.7667
> >>>[freezedetect @ 0x7fe18a604900] lavfi.freezedetect.freeze_duration: 2.5
> >>>[freezedetect @ 0x7fe18a604900] lavfi.freezedetect.freeze_end: 41.2667
> >>>[freezedetect @ 0x7fe18a604900] lavfi.freezedetect.freeze_start: 41.2667
> >>>
> >>>Have run make fate testing although haven't find any freezedetect checking 
> >>>for
> >>>the fate.
> >>
> >>You are changing the way the score is calculated and not describing
> >>why. Of course you will get different results.
> >>
> >>>
> >>>Signed-off-by: Limin Wang 
> >>>---
> >>>libavfilter/vf_freezedetect.c | 22 --
> >>>1 file changed, 16 insertions(+), 6 deletions(-)
> >>>
> >>>diff --git a/libavfilter/vf_freezedetect.c b/libavfilter/vf_freezedetect.c
> >>>index cc086af..0288fb0 100644
> >>>--- a/libavfilter/vf_freezedetect.c
> >>>+++ b/libavfilter/vf_freezedetect.c
> >>>@@ -38,7 +38,9 @@ typedef struct FreezeDetectContext {
> >>>ptrdiff_t height[4];
> >>>ff_scene_sad_fn sad;
> >>>int bitdepth;
> >>>+int nb_planes;
> >>>AVFrame *reference_frame;
> >>>+double prev_mafd;
> >>>int64_t n;
> >>>int64_t reference_n;
> >>>int frozen;
> >>>@@ -102,13 +104,15 @@ static int config_input(AVFilterLink *inlink)
> >>>AVFilterContext *ctx = inlink->dst;
> >>>FreezeDetectContext *s = ctx->priv;
> >>>const AVPixFmtDescriptor *pix_desc = 
> >>> av_pix_fmt_desc_get(inlink->format);
> >>>+int vsub = pix_desc->log2_chroma_h;
> >>>
> >>>s->bitdepth = pix_desc->comp[0].depth;
> >>>+s->nb_planes = av_pix_fmt_count_planes(inlink->format);
> >>
> >>This is not needed, for invalid planes we simply get 0 for linesize
> >>and width.
> >
> >It's more general to get nb_planes instead of checking the linesize
> >result. If have one plane, it's unneed to check 4 times.
> 
> Still looks a purely cosmetic change to me.
> 
> >
> >>
> >>>
> >>>-for (int plane = 0; plane < 4; plane++) {
> >>>+for (int plane = 0; plane < s->nb_planes; plane++) {
> >>>ptrdiff_t line_size = av_image_get_linesize(inlink->format, 
> >>> inlink->w, plane);
> >>>-s->width[plane] = line_size >> (s->bitdepth > 8);
> >>>-s->height[plane] = inlink->h >> ((plane == 1 || plane == 2) ? 
> >>>pix_desc->log2_chroma_h : 0);
> >>>+s->width[plane] = line_size;
> >>
> >>Why? Width is the width of the plane in pixels, simply setting
> >>linesize does not seem right.
> >
> >the sad init function have set the bitdepth, so I think it's OK to set
> >the width in bytes. Maybe it's my misunderstand for the code.
> 
> Later on width*height is used to determine the number of pixels for
> which we have counted the sum of differences.
> 
> >
> >>
> >>>+s->height[plane] = plane == 1 || plane == 2 ? 
> >>>AV_CEIL_RSHIFT(inlink->h, vsub) : inlink->h;
> >>
> >>Mix of a cosmetic and functional change. This should do the same
> >>with existing code and variables:
> >>s->height[plane] = AV_CEIL_RSHIFT(inlink->h, ((plane == 1 || plane == 2) ? 
> >>pix_desc->log2_chroma_h : 0)
> >>
> >>>}
> >>>
> >>>s->sad = ff_scene_sad_get_fn(s->bitdepth == 8 ? 8 : 16);
> >>>@@ -129,7 +133,9 @@ static int is_frozen(FreezeDetectContext *s, AVFrame 
> >>>*reference, AVFrame *frame)
> >>>uint64_t sad = 0;
> >>>uint64_t count = 0;
> >>>double mafd;
> >>>-for (int plane = 0; plane < 4; plane++) {
> >>>+double diff, cmp;
> >>>+
> >>>+for (int plane = 0; plane < s->nb_planes; plane++) {
> >>
> >>Unneeded.
> >>
> >>>if (s->width[plane]) {
> >>>uint64_t plane_sad;
> >>>s->sad(frame->data[plane], frame->linesize[plane],
> >>>@@ -140,8 +146,12 @@ static int is_frozen(FreezeDetectContext *s, AVFrame 
> >>>*reference, AVFrame *frame)
> >>>}
> >>>}
> >>>emms_c();
> >>>-mafd = (double)sad / count / (1ULL << s->bitdepth);
> >>>-return (mafd <= s->noise);
> >>>+mafd = (double)sad /(count >> (s->bitdepth > 8));
> >>
> >>Why? MAFD should be the mean difference normalized to [0..1].
> >if the bitdeth is 16, it'll divide by 1UL << 16, it'll cause the mafd is
> >very small. So I choose the scenecut way in the below.
> 
> The metric supposed to be indepentent of the bit depth. If you get
> different mafd for the same source expressed in 

Re: [FFmpeg-devel] [PATCH] lavc: Add libsvt-av1 encoder wrapper

2019-07-14 Thread Sun, Jing A
-Original Message-
From: Li, Zhong 
Sent: Saturday, July 13, 2019 1:23 AM
To: Sun, Jing A ; ffmpeg-devel@ffmpeg.org
Cc: Daryl Seah ; Tang, Zhizhen 
Subject: RE: [PATCH] lavc: Add libsvt-av1 encoder wrapper

> I prefer to contribute on FFmpeg mainline instead of a forked branch. 
> However, once get aligned in the community, of course I can contribute to the 
> branch as well.
> (Many SVT core library and API patches hold on my hand will also be sent out 
> after my leave of next 2~3 weeks)
> And let me provide more detail about the purposes:
> 1. SVT encoders (01.org/svt ) show very impressive performance benefit and 
> get much attention . 
  Let's collect some feedback as early as possible, this patch is not call for 
merge bug call for feedback, comments. Not only collect feedback of SVT FFmpeg 
wrapper, but also feedback of SVT core libraries and APIs.

SVT AV1 GitHub is not a forked branch, but a project every SVT developer is 
working together on. When you have any changes you would like to make to its 
FFmpeg plugin, you'd better submit those to the SVT AV1 Github first, so that 
the SVT maintainers and other plugin authors could review them before making 
them public.

>  e.g : SVT-AV1 reused libaom. If you enable both libsvt-av1 and libaom as 
> static link, then will have name conflict. 
>  Such issue is not easily found if you keep wrapper patch on 
> https://github.com/OpenVisualCloud/SVT-AV1/tree/master/ffmpeg_plugin ,
> But will easily found if works on FFmpeg mainline. 

That's a known issue: https://github.com/OpenVisualCloud/SVT-AV1/issues/119, 
which was submitted by me at Feb. Please look into it.

> 2. Many review comments from community (including mine) haven't been well 
> addressed in SVT-HEVC wrapper patch. 
  This patch is just to address them, probably it can be a reference of 
SVT-HEVC wrapper too. 

Which one is not addressed?

> 3. As mentioned in the patch annotation, this wrapper patch is a response of 
> ticket #7914, though it is not quite mature.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH] avfilter/vf_convolution: add x86 SIMD for filter_3x3()

2019-07-14 Thread Song, Ruiling
> -Original Message-
> From: Song, Ruiling
> Sent: Tuesday, July 9, 2019 9:15 AM
> To: ffmpeg-devel@ffmpeg.org
> Cc: Song, Ruiling 
> Subject: [PATCH] avfilter/vf_convolution: add x86 SIMD for filter_3x3()
> 
> Tested using a simple command (apply edge enhance):
> ./ffmpeg_g -i ~/Downloads/bbb_sunflower_1080p_30fps_normal.mp4 \
>  -vf convolution="0 0 0 -1 1 0 0 0 0:0 0 0 -1 1 0 0 0 0:0 0 0 -1 1 0 0 0 0:0 
> 0 0 -1 1 0 0
> 0 0:5:1:1:1:0:128:128:128" \
>  -an -vframes 1000 -f null /dev/null
> 
> The fps increase from 151 to 270 on my local machine.
> 
> Signed-off-by: Ruiling Song 
Ping?

> ---
>  libavfilter/convolution.h |  64 +++
>  libavfilter/vf_convolution.c  |  41 +--
>  libavfilter/x86/Makefile  |   2 +
>  libavfilter/x86/vf_convolution.asm| 158 ++
>  libavfilter/x86/vf_convolution_init.c |  46 
>  5 files changed, 273 insertions(+), 38 deletions(-)
>  create mode 100644 libavfilter/convolution.h
>  create mode 100644 libavfilter/x86/vf_convolution.asm
>  create mode 100644 libavfilter/x86/vf_convolution_init.c
> 
> diff --git a/libavfilter/convolution.h b/libavfilter/convolution.h
> new file mode 100644
> index 00..fc6aad58fd
> --- /dev/null
> +++ b/libavfilter/convolution.h
> @@ -0,0 +1,64 @@
> +/*
> + * Copyright (c) 2012-2013 Oka Motofumi (chikuzen.mo at gmail dot com)
> + * Copyright (c) 2015 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
> + */
> +#ifndef AVFILTER_CONVOLUTION_H
> +#define AVFILTER_CONVOLUTION_H
> +#include "avfilter.h"
> +
> +enum MatrixMode {
> +MATRIX_SQUARE,
> +MATRIX_ROW,
> +MATRIX_COLUMN,
> +MATRIX_NBMODES,
> +};
> +
> +typedef struct ConvolutionContext {
> +const AVClass *class;
> +
> +char *matrix_str[4];
> +float rdiv[4];
> +float bias[4];
> +int mode[4];
> +float scale;
> +float delta;
> +int planes;
> +
> +int size[4];
> +int depth;
> +int max;
> +int bpc;
> +int nb_planes;
> +int nb_threads;
> +int planewidth[4];
> +int planeheight[4];
> +int matrix[4][49];
> +int matrix_length[4];
> +int copy[4];
> +
> +void (*setup[4])(int radius, const uint8_t *c[], const uint8_t *src, int 
> stride,
> + int x, int width, int y, int height, int bpc);
> +void (*filter[4])(uint8_t *dst, int width,
> +  float rdiv, float bias, const int *const matrix,
> +  const uint8_t *c[], int peak, int radius,
> +  int dstride, int stride);
> +} ConvolutionContext;
> +
> +void ff_convolution_init_x86(ConvolutionContext *s);
> +#endif
> diff --git a/libavfilter/vf_convolution.c b/libavfilter/vf_convolution.c
> index 1305569c88..e3bf1df79f 100644
> --- a/libavfilter/vf_convolution.c
> +++ b/libavfilter/vf_convolution.c
> @@ -25,48 +25,11 @@
>  #include "libavutil/opt.h"
>  #include "libavutil/pixdesc.h"
>  #include "avfilter.h"
> +#include "convolution.h"
>  #include "formats.h"
>  #include "internal.h"
>  #include "video.h"
> 
> -enum MatrixMode {
> -MATRIX_SQUARE,
> -MATRIX_ROW,
> -MATRIX_COLUMN,
> -MATRIX_NBMODES,
> -};
> -
> -typedef struct ConvolutionContext {
> -const AVClass *class;
> -
> -char *matrix_str[4];
> -float rdiv[4];
> -float bias[4];
> -int mode[4];
> -float scale;
> -float delta;
> -int planes;
> -
> -int size[4];
> -int depth;
> -int max;
> -int bpc;
> -int nb_planes;
> -int nb_threads;
> -int planewidth[4];
> -int planeheight[4];
> -int matrix[4][49];
> -int matrix_length[4];
> -int copy[4];
> -
> -void (*setup[4])(int radius, const uint8_t *c[], const uint8_t *src, int 
> stride,
> - int x, int width, int y, int height, int bpc);
> -void (*filter[4])(uint8_t *dst, int width,
> -  float rdiv, float bias, const int *const matrix,
> -  const uint8_t *c[], int peak, int radius,
> -  int dstride, int stride);
> -} ConvolutionContext;
> -
>  #define OFFSET(x) offsetof(ConvolutionContext, x)
>  #define FLAGS
> AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
> 
> @@ 

Re: [FFmpeg-devel] [PATCH V1] doc/codecs: Add missing documentation for nointra

2019-07-14 Thread myp...@gmail.com
On Mon, Jul 15, 2019 at 2:58 AM Michael Niedermayer
 wrote:
>
> On Sun, Jul 14, 2019 at 03:32:59PM +0800, Jun Zhao wrote:
> > From: Jun Zhao 
> >
> > Add missing documentation for nointra.
>
> LGTM
>
> thx
Applied, Thanks
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH] avcodec/decode: Fix missing PTS/DTS for decoders like wmapro

2019-07-14 Thread fumoboy007
From: fumoboy007 

Added back comment (deleted in 061a0c14bb5767bca72e3a7227ca400de439ba09) 
explaining that some audio decoders like wmapro may consume partial data 
without returning a frame.

For these cases, `decode_simple_internal` will be called several times before 
the frame is complete. Due to a bug that this commit fixes, the PTS/DTS that 
was set on the first call would be reset to AV_NOPTS_VALUE on the subsequent 
calls.
---
 libavcodec/decode.c | 23 ++-
 1 file changed, 18 insertions(+), 5 deletions(-)

diff --git a/libavcodec/decode.c b/libavcodec/decode.c
index 6c31166ec2..c4722fa09b 100644
--- a/libavcodec/decode.c
+++ b/libavcodec/decode.c
@@ -603,16 +603,25 @@ FF_ENABLE_DEPRECATION_WARNINGS
 
 if (ret >= pkt->size || ret < 0) {
 av_packet_unref(pkt);
+avci->last_pkt_props->pts = AV_NOPTS_VALUE;
+avci->last_pkt_props->dts = AV_NOPTS_VALUE;
 } else {
 int consumed = ret;
-
 pkt->data+= consumed;
 pkt->size-= consumed;
 avci->last_pkt_props->size -= consumed; // See extract_packet_props() 
comment.
-pkt->pts  = AV_NOPTS_VALUE;
-pkt->dts  = AV_NOPTS_VALUE;
-avci->last_pkt_props->pts = AV_NOPTS_VALUE;
-avci->last_pkt_props->dts = AV_NOPTS_VALUE;
+
+if (got_frame) {
+// TODO: Do the same for video and subtitles before introducing 
decoders of those types
+// that have AV_CODEC_CAP_SUBFRAMES set. (We need a robust way to 
get the duration of a
+// video or subtitle frame before we can do this.)
+if (avctx->codec->type == AVMEDIA_TYPE_AUDIO) {
+int64_t frame_duration = av_rescale_q(frame->nb_samples,
+  (AVRational){1, 
avctx->sample_rate},
+  avctx->pkt_timebase);
+avci->last_pkt_props->pts += frame_duration;
+}
+}
 }
 
 if (got_frame)
@@ -625,6 +634,10 @@ static int decode_simple_receive_frame(AVCodecContext 
*avctx, AVFrame *frame)
 {
 int ret;
 
+// Some audio decoders may consume partial data without returning
+// a frame (e.g. wmapro). There is no way to make the caller call
+// avcodec_receive_frame() again without returning a frame, so try
+// to decode more in these cases.
 while (!frame->buf[0]) {
 ret = decode_simple_internal(avctx, frame);
 if (ret < 0)
-- 
2.21.0

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH 3/3] avcodec/ffwavesynth: Check if there is enough extradata before allocation

2019-07-14 Thread Michael Niedermayer
Fixes: OOM
Fixes: 
15750/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FFWAVESYNTH_fuzzer-5702090367696896

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer 
---
 libavcodec/ffwavesynth.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/ffwavesynth.c b/libavcodec/ffwavesynth.c
index 94a843e3ca..b319b3341a 100644
--- a/libavcodec/ffwavesynth.c
+++ b/libavcodec/ffwavesynth.c
@@ -247,7 +247,7 @@ static int wavesynth_parse_extradata(AVCodecContext *avc)
 edata_end = edata + avc->extradata_size;
 ws->nb_inter = AV_RL32(edata);
 edata += 4;
-if (ws->nb_inter < 0)
+if (ws->nb_inter < 0 || (edata_end - edata) / 24 < ws->nb_inter)
 return AVERROR(EINVAL);
 ws->inter = av_calloc(ws->nb_inter, sizeof(*ws->inter));
 if (!ws->inter)
-- 
2.22.0

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH 2/3] avcodec/ffwavesynth: More correct cast in wavesynth_seek()

2019-07-14 Thread Michael Niedermayer
Fixes: signed integer overflow: 553590816 - -9223372036315799520 cannot be 
represented in type 'long'
Fixes: 
15743/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FFWAVESYNTH_fuzzer-5705835377852416

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer 
---
 libavcodec/ffwavesynth.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/ffwavesynth.c b/libavcodec/ffwavesynth.c
index 1dbfaa5847..94a843e3ca 100644
--- a/libavcodec/ffwavesynth.c
+++ b/libavcodec/ffwavesynth.c
@@ -215,7 +215,7 @@ static void wavesynth_seek(struct wavesynth_context *ws, 
int64_t ts)
 ws->next_inter = i;
 ws->next_ts = i < ws->nb_inter ? ws->inter[i].ts_start : INF_TS;
 *last = -1;
-lcg_seek(>dither_state, (uint32_t)ts - ws->cur_ts);
+lcg_seek(>dither_state, (uint32_t)ts - (uint32_t)ws->cur_ts);
 if (ws->pink_need) {
 int64_t pink_ts_cur  = (ws->cur_ts + PINK_UNIT - 1) & ~(PINK_UNIT - 1);
 int64_t pink_ts_next = ts & ~(PINK_UNIT - 1);
-- 
2.22.0

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH 1/3] avcodec/ffwavesynth: Check sample rate before use

2019-07-14 Thread Michael Niedermayer
Fixes: division by zero
Fixes: 
15725/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FFWAVESYNTH_fuzzer-5641231956180992

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer 
---
 libavcodec/ffwavesynth.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/ffwavesynth.c b/libavcodec/ffwavesynth.c
index 793eada7a5..1dbfaa5847 100644
--- a/libavcodec/ffwavesynth.c
+++ b/libavcodec/ffwavesynth.c
@@ -270,7 +270,7 @@ static int wavesynth_parse_extradata(AVCodecContext *avc)
 dt = in->ts_end - in->ts_start;
 switch (in->type) {
 case WS_SINE:
-if (edata_end - edata < 20)
+if (edata_end - edata < 20 || avc->sample_rate <= 0)
 return AVERROR(EINVAL);
 f1  = AV_RL32(edata +  0);
 f2  = AV_RL32(edata +  4);
-- 
2.22.0

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH] dump_extra: Don't add extradata if it already exists

2019-07-14 Thread Michael Niedermayer
On Sat, Jul 13, 2019 at 04:55:50AM +0200, Andreas Rheinhardt wrote:
> The dump_extra bitstream filter currently simply adds the extradata to
> the packets indicated by the user without checking whether said
> extradata already exists in the packets. Besides wasting space
> duplicated extradata in the same packet/access unit is also forbidden
> for some codecs, e.g. MPEG-2.
> 
> This check has been added to be able to use the mpeg2_qsv encoder (which
> only adds the sequence headers to the first packet) in broadcast
> scenarios where repeating sequence headers are required.
> 
> The check used here is not perfect: E.g. dump_extra would add the
> extradata to a H.264 access unit consisting of an access unit delimiter,
> SPS, PPS and slices.
> 
> Fixes #8007.
> 
> Signed-off-by: Andreas Rheinhardt 
> ---
>  doc/bitstream_filters.texi  | 4 +++-
>  libavcodec/dump_extradata_bsf.c | 4 +++-
>  2 files changed, 6 insertions(+), 2 deletions(-)

will apply

thanks

[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Into a blind darkness they enter who follow after the Ignorance,
they as if into a greater darkness enter who devote themselves
to the Knowledge alone. -- Isha Upanishad


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH v2] fate: add hls fmp4 segment type test case

2019-07-14 Thread Michael Niedermayer
On Sun, Jul 14, 2019 at 06:41:28AM +0800, Steven Liu wrote:
> Signed-off-by: Steven Liu 
> ---
>  tests/fate/hlsenc.mak   |  12 +++
>  tests/ref/fate/hls-fmp4 | 198 
> 
>  2 files changed, 210 insertions(+)
>  create mode 100644 tests/ref/fate/hls-fmp4
> 
> diff --git a/tests/fate/hlsenc.mak b/tests/fate/hlsenc.mak
> index 2a125cda3c..98d67f96df 100644
> --- a/tests/fate/hlsenc.mak
> +++ b/tests/fate/hlsenc.mak
> @@ -74,3 +74,15 @@ FATE_AFILTER-$(call ALLYES, HLS_DEMUXER MPEGTS_MUXER 
> MPEGTS_DEMUXER AEVALSRC_FIL
>  fate-hls-list-size: tests/data/hls_list_size.m3u8
>  fate-hls-list-size: CMD = framecrc -flags +bitexact -i 
> $(TARGET_PATH)/tests/data/hls_list_size.m3u8 -vf setpts=N*23
>  
> +tests/data/hls_segment_type_fmp4.m3u8: TAG = GEN
> +tests/data/hls_segment_type_fmp4.m3u8: ffmpeg$(PROGSSUF)$(EXESUF) | 
> tests/data
> + $(M)$(TARGET_EXEC) $(TARGET_PATH)/$< \
> + -f lavfi -re -i "aevalsrc=cos(2*PI*t)*sin(2*PI*(440+4*t)*t):d=5" -map 0 
> -codec:a mp2fixed \
> + -hls_segment_type mpegts -hls_fmp4_init_filename now.mp4 -hls_list_size 
> 0 \
> + -hls_time 1 -hls_segment_filename 
> "$(TARGET_PATH)/tests/data/hls_fmp4_%d.m4s" \
> + $(TARGET_PATH)/tests/data/hls_fmp4.m3u8 2>/dev/null
> +
> +FATE_AFILTER-$(call ALLYES, HLS_DEMUXER MPEGTS_MUXER MPEGTS_DEMUXER 
> AEVALSRC_FILTER LAVFI_INDEV MP2FIXED_ENCODER) += fate-hls-fmp4
> +fate-hls-fmp4: tests/data/hls_segment_type_fmp4.m3u8

> +fate-hls-fmp4: CMD = framecrc -flags +bitexact -i 
> $(TARGET_PATH)/tests/data/hls_fmp4.m3u8 -vf setpts=N*23

tested on linux32/64 x86, mingw32/64 , linux arm and mips qemu

[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

During times of universal deceit, telling the truth becomes a
revolutionary act. -- George Orwell


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH V1] doc/codecs: Add missing documentation for nointra

2019-07-14 Thread Michael Niedermayer
On Sun, Jul 14, 2019 at 03:32:59PM +0800, Jun Zhao wrote:
> From: Jun Zhao 
> 
> Add missing documentation for nointra.

LGTM

thx

[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

If you fake or manipulate statistics in a paper in physics you will never
get a job again.
If you fake or manipulate statistics in a paper in medicin you will get
a job for life at the pharma industry.


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH] fate: add a case for ticket #3229

2019-07-14 Thread Michael Niedermayer
On Sun, Jul 14, 2019 at 06:16:19PM +0800, Zhong Li wrote:
> Signed-off-by: Zhong Li 
> ---
> https://patchwork.ffmpeg.org/patch/13725/ introduces a regression but not 
> found by fate, so add it.
> Test clip produced by:
> ffmpeg -i tickets/3229/bad.avi -vframes 20 -c:v copy 
> /fate-suite/mjpeg/mjpeg_field_order.avi

do we need 20 frames for this ?
the file is over 4mb large, which is why i ask

thx

[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

"You are 36 times more likely to die in a bathtub than at the hands of a
terrorist. Also, you are 2.5 times more likely to become a president and
2 times more likely to become an astronaut, than to die in a terrorist
attack." -- Thoughty2



signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH 4/4] avcodec/mediacodec_wrapper: remove unused local variables in ff_AMediaCodec_getCodecNameByType()

2019-07-14 Thread Matthieu Bouron
On Thu, Jul 04, 2019 at 03:43:48PM +0200, Matthieu Bouron wrote:
> ---
>  libavcodec/mediacodec_wrapper.c | 10 --
>  1 file changed, 10 deletions(-)
> 
> diff --git a/libavcodec/mediacodec_wrapper.c b/libavcodec/mediacodec_wrapper.c
> index 70e1e7cae1..5213cf640a 100644
> --- a/libavcodec/mediacodec_wrapper.c
> +++ b/libavcodec/mediacodec_wrapper.c
> @@ -392,8 +392,6 @@ char *ff_AMediaCodecList_getCodecNameByType(const char 
> *mime, int profile, int e
>  struct JNIAMediaCodecListFields jfields = { 0 };
>  struct JNIAMediaFormatFields mediaformat_jfields = { 0 };
>  
> -jobject format = NULL;
> -jobject codec = NULL;
>  jobject codec_name = NULL;
>  
>  jobject info = NULL;
> @@ -571,14 +569,6 @@ done_with_info:
>  }
>  
>  done:
> -if (format) {
> -(*env)->DeleteLocalRef(env, format);
> -}
> -
> -if (codec) {
> -(*env)->DeleteLocalRef(env, codec);
> -}
> -
>  if (codec_name) {
>  (*env)->DeleteLocalRef(env, codec_name);
>  }
> -- 
> 2.22.0
> 

Ping for the patch set.

-- 
Matthieu B.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] dash: add descriptor which is useful to the scheme defined by ISO/IEC 23009-1:2014/Amd.2:2015.

2019-07-14 Thread Carl Eugen Hoyos
Am Fr., 12. Juli 2019 um 10:31 Uhr schrieb leozhang :
>
>  Reference ISO/IEC 23009-1:2014/Amd.2:2015, a spatial relationship descriptor 
> is defined as a spatial part of a content component (e.g. a region of 
> interest, or a tile)
>  and represented by either an Adaptation Set or a Sub-Representation.
>
> Signed-off-by: leozhang 
> ---
>  doc/muxers.texi   |  3 +++
>  libavformat/dashenc.c | 36 +---
>  2 files changed, 36 insertions(+), 3 deletions(-)
>
> diff --git a/doc/muxers.texi b/doc/muxers.texi
> index b109297..ac06ad2 100644
> --- a/doc/muxers.texi
> +++ b/doc/muxers.texi
> @@ -275,6 +275,9 @@ of the adaptation sets and a,b,c,d and e are the indices 
> of the mapped streams.
>  To map all video (or audio) streams to an AdaptationSet, "v" (or "a") can be 
> used as stream identifier instead of IDs.
>
>  When no assignment is defined, this defaults to an AdaptationSet for each 
> stream.

> +Optional syntax is "id=x,descriptor=descriptor_str,streams=a,b,c 
> id=y,streams=d,e" and so
> on, descriptor is useful to the scheme defined by ISO/IEC 
> 23009-1:2014/Amd.2:2015.
> +And descriptor_str must be a properly formatted XML element, which is 
> encoded by base64.

I wonder how helpful these two sentences are, perhaps somebody who uses
dash can comment?

>  @item timeout @var{timeout}
>  Set timeout for socket I/O operations. Applicable only for HTTP output.
>  @item index_correction @var{index_correction}
> diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c
> index b25afb4..f7ebb1f 100644
> --- a/libavformat/dashenc.c
> +++ b/libavformat/dashenc.c
> @@ -34,6 +34,7 @@
>  #include "libavutil/rational.h"
>  #include "libavutil/time.h"
>  #include "libavutil/time_internal.h"
> +#include "libavutil/base64.h"
>
>  #include "avc.h"
>  #include "avformat.h"
> @@ -68,6 +69,7 @@ typedef struct Segment {
>
>  typedef struct AdaptationSet {
>  char id[10];
> +char descriptor[1024];
>  enum AVMediaType media_type;
>  AVDictionary *metadata;
>  AVRational min_frame_rate, max_frame_rate;
> @@ -748,7 +750,8 @@ static int write_adaptation_set(AVFormatContext *s, 
> AVIOContext *out, int as_ind
>  role = av_dict_get(as->metadata, "role", NULL, 0);
>  if (role)
>  avio_printf(out, "\t\t\t schemeIdUri=\"urn:mpeg:dash:role:2011\" value=\"%s\"/>\n", role->value);
> -
> +if (strlen(as->descriptor))
> +avio_printf(out, "\t\t\t%s\n", as->descriptor);
>  for (i = 0; i < s->nb_streams; i++) {
>  OutputStream *os = >streams[i];
>  char bandwidth_str[64] = {'\0'};
> @@ -820,7 +823,7 @@ static int parse_adaptation_sets(AVFormatContext *s)
>  {
>  DASHContext *c = s->priv_data;
>  const char *p = c->adaptation_sets;
> -enum { new_set, parse_id, parsing_streams } state;
> +enum { new_set, parse_id, parsing_streams, parse_descriptor } state;
>  AdaptationSet *as;
>  int i, n, ret;
>
> @@ -837,6 +840,9 @@ static int parse_adaptation_sets(AVFormatContext *s)
>  }
>
>  // syntax id=0,streams=0,1,2 id=1,streams=3,4 and so on
> +// option id=0,descriptor=descriptor_str,streams=0,1,2 and so on
> +// descriptor is useful to the scheme defined by ISO/IEC 
> 23009-1:2014/Amd.2:2015
> +// descriptor_str must be a properly formatted XML element, encoded by 
> base64.
>  state = new_set;
>  while (*p) {
>  if (*p == ' ') {
> @@ -854,7 +860,31 @@ static int parse_adaptation_sets(AVFormatContext *s)
>  if (*p)
>  p++;
>  state = parse_id;
> -} else if (state == parse_id && av_strstart(p, "streams=", )) {
> +} else if (state == parse_id && av_strstart(p, "descriptor=", )) {
> +char *encode_str;
> +uint8_t *decode_str;
> +int decode_size, ret;
> +
> +n = strcspn(p, ",");
> +encode_str = av_strndup(p, n);
> +decode_size = AV_BASE64_DECODE_SIZE(n);

> +decode_str = (uint8_t *)av_mallocz(decode_size);

Why is this (ugly) cast necessary?

> +if (decode_str) {
> +ret = av_base64_decode(decode_str, encode_str, decode_size);
> +if (ret >= 0)
> +snprintf(as->descriptor, sizeof(as->descriptor), "%.*s", 
> decode_size, decode_str);
> +else
> +av_log(s, AV_LOG_WARNING, "descriptor string is invalid 
> base64 encode\n");
> +} else
> +av_log(s, AV_LOG_WARNING, "av_mallocz failed, will not parse 
> descriptor\n");

Please add some braces.

Carl Eugen
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] dash: add descriptor which is useful to the scheme defined by ISO/IEC 23009-1:2014/Amd.2:2015.

2019-07-14 Thread Tao Zhang
ping?

leozhang  于2019年7月12日周五 下午4:31写道:
>
>  Reference ISO/IEC 23009-1:2014/Amd.2:2015, a spatial relationship descriptor 
> is defined as a spatial part of a content component (e.g. a region of 
> interest, or a tile)
>  and represented by either an Adaptation Set or a Sub-Representation.
>
> Signed-off-by: leozhang 
> ---
>  doc/muxers.texi   |  3 +++
>  libavformat/dashenc.c | 36 +---
>  2 files changed, 36 insertions(+), 3 deletions(-)
>
> diff --git a/doc/muxers.texi b/doc/muxers.texi
> index b109297..ac06ad2 100644
> --- a/doc/muxers.texi
> +++ b/doc/muxers.texi
> @@ -275,6 +275,9 @@ of the adaptation sets and a,b,c,d and e are the indices 
> of the mapped streams.
>  To map all video (or audio) streams to an AdaptationSet, "v" (or "a") can be 
> used as stream identifier instead of IDs.
>
>  When no assignment is defined, this defaults to an AdaptationSet for each 
> stream.
> +
> +Optional syntax is "id=x,descriptor=descriptor_str,streams=a,b,c 
> id=y,streams=d,e" and so on, descriptor is useful to the scheme defined by 
> ISO/IEC 23009-1:2014/Amd.2:2015.
> +And descriptor_str must be a properly formatted XML element, which is 
> encoded by base64.
>  @item timeout @var{timeout}
>  Set timeout for socket I/O operations. Applicable only for HTTP output.
>  @item index_correction @var{index_correction}
> diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c
> index b25afb4..f7ebb1f 100644
> --- a/libavformat/dashenc.c
> +++ b/libavformat/dashenc.c
> @@ -34,6 +34,7 @@
>  #include "libavutil/rational.h"
>  #include "libavutil/time.h"
>  #include "libavutil/time_internal.h"
> +#include "libavutil/base64.h"
>
>  #include "avc.h"
>  #include "avformat.h"
> @@ -68,6 +69,7 @@ typedef struct Segment {
>
>  typedef struct AdaptationSet {
>  char id[10];
> +char descriptor[1024];
>  enum AVMediaType media_type;
>  AVDictionary *metadata;
>  AVRational min_frame_rate, max_frame_rate;
> @@ -748,7 +750,8 @@ static int write_adaptation_set(AVFormatContext *s, 
> AVIOContext *out, int as_ind
>  role = av_dict_get(as->metadata, "role", NULL, 0);
>  if (role)
>  avio_printf(out, "\t\t\t schemeIdUri=\"urn:mpeg:dash:role:2011\" value=\"%s\"/>\n", role->value);
> -
> +if (strlen(as->descriptor))
> +avio_printf(out, "\t\t\t%s\n", as->descriptor);
>  for (i = 0; i < s->nb_streams; i++) {
>  OutputStream *os = >streams[i];
>  char bandwidth_str[64] = {'\0'};
> @@ -820,7 +823,7 @@ static int parse_adaptation_sets(AVFormatContext *s)
>  {
>  DASHContext *c = s->priv_data;
>  const char *p = c->adaptation_sets;
> -enum { new_set, parse_id, parsing_streams } state;
> +enum { new_set, parse_id, parsing_streams, parse_descriptor } state;
>  AdaptationSet *as;
>  int i, n, ret;
>
> @@ -837,6 +840,9 @@ static int parse_adaptation_sets(AVFormatContext *s)
>  }
>
>  // syntax id=0,streams=0,1,2 id=1,streams=3,4 and so on
> +// option id=0,descriptor=descriptor_str,streams=0,1,2 and so on
> +// descriptor is useful to the scheme defined by ISO/IEC 
> 23009-1:2014/Amd.2:2015
> +// descriptor_str must be a properly formatted XML element, encoded by 
> base64.
>  state = new_set;
>  while (*p) {
>  if (*p == ' ') {
> @@ -854,7 +860,31 @@ static int parse_adaptation_sets(AVFormatContext *s)
>  if (*p)
>  p++;
>  state = parse_id;
> -} else if (state == parse_id && av_strstart(p, "streams=", )) {
> +} else if (state == parse_id && av_strstart(p, "descriptor=", )) {
> +char *encode_str;
> +uint8_t *decode_str;
> +int decode_size, ret;
> +
> +n = strcspn(p, ",");
> +encode_str = av_strndup(p, n);
> +decode_size = AV_BASE64_DECODE_SIZE(n);
> +decode_str = (uint8_t *)av_mallocz(decode_size);
> +if (decode_str) {
> +ret = av_base64_decode(decode_str, encode_str, decode_size);
> +if (ret >= 0)
> +snprintf(as->descriptor, sizeof(as->descriptor), "%.*s", 
> decode_size, decode_str);
> +else
> +av_log(s, AV_LOG_WARNING, "descriptor string is invalid 
> base64 encode\n");
> +} else
> +av_log(s, AV_LOG_WARNING, "av_mallocz failed, will not parse 
> descriptor\n");
> +
> +p += n;
> +if (*p)
> +p++;
> +state = parse_descriptor;
> +av_freep(_str);
> +av_freep(_str);
> +} else if ((state == parse_id || state == parse_descriptor) && 
> av_strstart(p, "streams=", )) { //descriptor is optional
>  state = parsing_streams;
>  } else if (state == parsing_streams) {
>  AdaptationSet *as = >as[c->nb_as - 1];
> --
> 1.8.3.1
>
> ___
> ffmpeg-devel mailing list
> 

Re: [FFmpeg-devel] [PATCH v1 2/2] libavformat/file: initilize the fd to -1 instead of 0(valid fd) in case unexpected file close

2019-07-14 Thread Michael Niedermayer
On Sat, Jul 13, 2019 at 06:36:28AM +0800, Limin Wang wrote:
> On Fri, Jul 12, 2019 at 10:44:48PM +0200, Michael Niedermayer wrote:
> > On Tue, Jun 18, 2019 at 06:45:13PM +0800, lance.lmw...@gmail.com wrote:
> > > From: Limin Wang 
> > > 
> > > Signed-off-by: Limin Wang 
> > > ---
> > >  libavformat/file.c | 1 +
> > >  1 file changed, 1 insertion(+)
> > > 
> > > diff --git a/libavformat/file.c b/libavformat/file.c
> > > index 08c7f8e6dd..40ae9ad2a8 100644
> > > --- a/libavformat/file.c
> > > +++ b/libavformat/file.c
> > > @@ -274,6 +274,7 @@ static int file_open_dir(URLContext *h)
> > >  #if HAVE_LSTAT
> > >  FileContext *c = h->priv_data;
> > >  
> > > +c->fd = -1;
> > >  c->dir = opendir(h->filename);
> > >  if (!c->dir)
> > >  return AVERROR(errno);
> > 
> > Is it more robust to set fd=-1 after successfully opening the directory ?
> > 
> > considering that this could be already opened as a file ...
> > (such combinations seem to be what the patch is about IIUC)
> > and that on failure we could prefer to leave the state close to the
> > original before the call
> I'm using open the directory operation without any file combiations, if
> the context need to support both dir and file combined, then I need do more
> testing for the condition.

It doesnt need no, but people do mix it as it seems. So the behvior
in that case should be "usefull" like erroring our or failing an assert
while in this case i think it would just leak the open file and continue
that may be harder to debug for the user

thx
[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The educated differ from the uneducated as much as the living from the
dead. -- Aristotle 


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH 2/6] avformat/vividas: Fixes overflow in shift in recover_key()

2019-07-14 Thread Michael Niedermayer
On Sun, Jul 14, 2019 at 09:28:01AM +0200, Reimar Döffinger wrote:
> On 13 July 2019 22:25:02 CEST, Michael Niedermayer  
> wrote:
> >Fixes: left shift of 133 by 24 places cannot be represented in type
> >'int'
> >Fixes:
> >15365/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5716153105645568
> >
> >Found-by: continuous fuzzing process
> >https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> >Suggested-by: Reimar Döffinger 
> >Signed-off-by: Michael Niedermayer 
> >---
> > libavformat/vividas.c | 5 +
> > 1 file changed, 1 insertion(+), 4 deletions(-)
> >
> >diff --git a/libavformat/vividas.c b/libavformat/vividas.c
> >index 350c7aa70a..830e318645 100644
> >--- a/libavformat/vividas.c
> >+++ b/libavformat/vividas.c
> >@@ -115,10 +115,7 @@ static unsigned recover_key(unsigned char
> >sample[4], unsigned expected_size)
> > 
> > put_v(plaintext+2, expected_size);
> > 
> >-return (sample[0]^plaintext[0])|
> >-((sample[1]^plaintext[1])<<8)|
> >-((sample[2]^plaintext[2])<<16)|
> >-((sample[3]^plaintext[3])<<24);
> >+return AV_RL32(sample) ^ AV_RL32(plaintext);
> > }
> > 
> >static void xor_block(void *p1, void *p2, unsigned size, int key,
> >unsigned *key_ptr)
> 
> Looks good to me.

will apply

thx

[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Complexity theory is the science of finding the exact solution to an
approximation. Benchmarking OTOH is finding an approximation of the exact


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH 5/6] avformat/xmv: Make bitrate 64bit

2019-07-14 Thread Michael Niedermayer
On Sun, Jul 14, 2019 at 10:02:32AM +0200, Paul B Mahol wrote:
> LGTM

will apply

thx

[..]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

it is not once nor twice but times without number that the same ideas make
their appearance in the world. -- Aristotle


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH 1/6] avcodec/iff: Add "else" to make code look prettier

2019-07-14 Thread Michael Niedermayer
On Sun, Jul 14, 2019 at 03:55:54PM +1000, Peter Ross wrote:
> On Sat, Jul 13, 2019 at 10:25:01PM +0200, Michael Niedermayer wrote:
> > Signed-off-by: Michael Niedermayer 
> > ---
> >  libavcodec/iff.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/libavcodec/iff.c b/libavcodec/iff.c
> > index c6e2359b00..7f1c589d7c 100644
> > --- a/libavcodec/iff.c
> > +++ b/libavcodec/iff.c
> > @@ -284,7 +284,7 @@ static int extract_header(AVCodecContext *const avctx,
> >  if (s->bpp > 8) {
> >  av_log(avctx, AV_LOG_ERROR, "Invalid number of hold bits 
> > for HAM: %u\n", s->ham);
> >  return AVERROR_INVALIDDATA;
> > -} if (s->ham != (s->bpp > 6 ? 6 : 4)) {
> > +} else if (s->ham != (s->bpp > 6 ? 6 : 4)) {
> >  av_log(avctx, AV_LOG_ERROR, "Invalid number of hold bits 
> > for HAM: %u, BPP: %u\n", s->ham, s->bpp);
> >  return AVERROR_INVALIDDATA;
> >  }
> > -- 
> > 2.22.0
> 
> well spotted. please push.

will do

thanks

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Never trust a computer, one day, it may think you are the virus. -- Compn


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH, v3] lavf/vf_vpp_qsv: add support for QSV transpose filter

2019-07-14 Thread Li, Zhong
> From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On Behalf
> Of Linjie Fu
> Sent: Thursday, July 11, 2019 1:58 AM
> To: ffmpeg-devel@ffmpeg.org
> Cc: Fu, Linjie 
> Subject: [FFmpeg-devel] [PATCH, v3] lavf/vf_vpp_qsv: add support for QSV
> transpose filter
> 
> Add transpose support for qsv_vpp with rotate and hflip:
> - rotate: [0, 3] support clockwise rotation of 0, 90, 180, 270;
> - hflip:  [0, 1] support horizontal flip;
> 
> Configure with:
> {"cclock_hflip","clock","cclock","clock_hflip","reversal","hflip","vflip"}
> 
> Limitation:
> If pipeline contains resize, mirroring and other, VPP skips other filters 
> in
> MSDK when IOPattern equals d3d->d3d. So "cclock_hflip, clock_hflip, vflip"
> will not work in d3d->d3d condition.
> 
> This pr is fixing this:
> https://github.com/Intel-Media-SDK/MediaSDK/pull/1491
> 
> CMD:
> ffmpeg -hwaccel qsv -c:v h264_qsv -i input.h264
> -vf 'format=qsv,vpp_qsv=transpose=clock' -c:v h264_qsv output.h264

Tested:
ffmpeg -hwaccel qsv -c:v h264_qsv -i ~/bbb_sunflower_1080p_30fps_normal.mp4 
-vframes 100 -vf 'format=qsv,vpp_qsv=transpose=cclock_hflip' -c:v h264_qsv 
ch.mp4
Both Skylake and KBL failed:

[Parsed_vpp_qsv_1 @ 0x5581aaf16080] Failed to create a qsvvpp, ret = -15.
[Parsed_vpp_qsv_1 @ 0x5581aaf16080] Failed to configure output pad on 
Parsed_vpp_qsv_1
Error reinitializing filters!
Failed to inject frame into filter network: Block device required
Error while processing the decoded data for stream #0:0

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH] avfilter: add square audio source filter

2019-07-14 Thread Paul B Mahol
Signed-off-by: Paul B Mahol 
---
 doc/filters.texi | 44 
 libavfilter/Makefile |  1 +
 libavfilter/allfilters.c |  1 +
 libavfilter/asrc_sine.c  | 86 ++--
 4 files changed, 119 insertions(+), 13 deletions(-)

diff --git a/doc/filters.texi b/doc/filters.texi
index 3108ad349e..b94eddefe5 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -5895,6 +5895,50 @@ sine=1000:samples_per_frame='st(0,mod(n,5)); 
1602-not(not(eq(ld(0),1)+eq(ld(0),3
 @end example
 @end itemize
 
+@section square
+
+Generate an audio signal made of a square wave with custom amplitude.
+
+The audio signal is bit-exact.
+
+The filter accepts the following options:
+
+@table @option
+@item amplitude, a
+Set the carrier amplitude, Default is 0.2.
+
+@item frequency, f
+Set the carrier frequency. Default is 440 Hz.
+
+@item sample_rate, r
+Specify the sample rate, default is 44100.
+
+@item duration, d
+Specify the duration of the generated audio stream.
+
+@item samples_per_frame
+Set the number of samples per output frame.
+
+The expression can contain the following constants:
+
+@table @option
+@item n
+The (sequential) number of the output audio frame, starting from 0.
+
+@item pts
+The PTS (Presentation TimeStamp) of the output audio frame,
+expressed in @var{TB} units.
+
+@item t
+The PTS of the output audio frame, expressed in seconds.
+
+@item TB
+The timebase of the output audio frames.
+@end table
+
+Default is @code{1024}.
+@end table
+
 @c man end AUDIO SOURCES
 
 @chapter Audio Sinks
diff --git a/libavfilter/Makefile b/libavfilter/Makefile
index 455c809b15..b958450a80 100644
--- a/libavfilter/Makefile
+++ b/libavfilter/Makefile
@@ -148,6 +148,7 @@ OBJS-$(CONFIG_FLITE_FILTER)  += asrc_flite.o
 OBJS-$(CONFIG_HILBERT_FILTER)+= asrc_hilbert.o
 OBJS-$(CONFIG_SINC_FILTER)   += asrc_sinc.o
 OBJS-$(CONFIG_SINE_FILTER)   += asrc_sine.o
+OBJS-$(CONFIG_SQUARE_FILTER) += asrc_sine.o
 
 OBJS-$(CONFIG_ANULLSINK_FILTER)  += asink_anullsink.o
 
diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c
index 04a3df7d56..510e0d65dd 100644
--- a/libavfilter/allfilters.c
+++ b/libavfilter/allfilters.c
@@ -140,6 +140,7 @@ extern AVFilter ff_asrc_flite;
 extern AVFilter ff_asrc_hilbert;
 extern AVFilter ff_asrc_sinc;
 extern AVFilter ff_asrc_sine;
+extern AVFilter ff_asrc_square;
 
 extern AVFilter ff_asink_anullsink;
 
diff --git a/libavfilter/asrc_sine.c b/libavfilter/asrc_sine.c
index 3a87210b4b..e3153f03e4 100644
--- a/libavfilter/asrc_sine.c
+++ b/libavfilter/asrc_sine.c
@@ -30,6 +30,7 @@
 
 typedef struct SineContext {
 const AVClass *class;
+double amplitude;
 double frequency;
 double beep_factor;
 char *samples_per_frame;
@@ -38,6 +39,7 @@ typedef struct SineContext {
 int64_t duration;
 int16_t *sin;
 int64_t pts;
+int square_amplitude;
 uint32_t phi;  ///< current phase of the sine (2pi = 1<<32)
 uint32_t dphi; ///< phase increment between two samples
 unsigned beep_period;
@@ -45,6 +47,8 @@ typedef struct SineContext {
 unsigned beep_length;
 uint32_t phi_beep;  ///< current phase of the beep
 uint32_t dphi_beep; ///< phase increment of the beep
+
+void (*generate)(struct SineContext *sine, AVFrame *frame);
 } SineContext;
 
 #define CONTEXT SineContext
@@ -141,11 +145,51 @@ enum {
 VAR_VARS_NB
 };
 
+static void generate_sine(SineContext *sine, AVFrame *frame)
+{
+int16_t *samples = (int16_t *)frame->data[0];
+
+for (int i = 0; i < frame->nb_samples; i++) {
+samples[i] = sine->sin[sine->phi >> (32 - LOG_PERIOD)];
+sine->phi += sine->dphi;
+if (sine->beep_index < sine->beep_length) {
+samples[i] += sine->sin[sine->phi_beep >> (32 - LOG_PERIOD)] << 1;
+sine->phi_beep += sine->dphi_beep;
+}
+if (++sine->beep_index == sine->beep_period)
+sine->beep_index = 0;
+}
+}
+
+static void generate_square(SineContext *sine, AVFrame *frame)
+{
+int16_t *samples = (int16_t *)frame->data[0];
+
+for (int i = 0; i < frame->nb_samples; i++) {
+int16_t sample = sine->sin[sine->phi >> (32 - LOG_PERIOD)];
+
+if (sample >= 0)
+sample = sine->square_amplitude;
+else
+sample = -sine->square_amplitude;
+
+samples[i] = sample;
+sine->phi += sine->dphi;
+}
+}
+
 static av_cold int init(AVFilterContext *ctx)
 {
 int ret;
 SineContext *sine = ctx->priv;
 
+if (!strcmp(ctx->filter->name, "square")) {
+sine->square_amplitude = -sine->amplitude * INT16_MIN;
+sine->generate = generate_square;
+} else {
+sine->generate = generate_sine;
+}
+
 if (!(sine->sin = av_malloc(sizeof(*sine->sin) << LOG_PERIOD)))
 return AVERROR(ENOMEM);
 sine->dphi = ldexp(sine->frequency, 32) / sine->sample_rate + 0.5;
@@ -224,8 +268,7 @@ 

[FFmpeg-devel] [PATCH] fate: add a case for ticket #3229

2019-07-14 Thread Zhong Li
Signed-off-by: Zhong Li 
---
https://patchwork.ffmpeg.org/patch/13725/ introduces a regression but not found 
by fate, so add it.
Test clip produced by:
ffmpeg -i tickets/3229/bad.avi -vframes 20 -c:v copy 
/fate-suite/mjpeg/mjpeg_field_order.avi

tests/fate/video.mak|  3 +++
 tests/ref/fate/mjpeg-ticket3229 | 25 +
 2 files changed, 28 insertions(+)
 create mode 100644 tests/ref/fate/mjpeg-ticket3229

diff --git a/tests/fate/video.mak b/tests/fate/video.mak
index be1458c..d2d43e5 100644
--- a/tests/fate/video.mak
+++ b/tests/fate/video.mak
@@ -232,6 +232,9 @@ fate-mimic: CMD = framecrc -idct simple -i 
$(TARGET_SAMPLES)/mimic/mimic2-womanl
 FATE_VIDEO-$(call DEMDEC, MOV, MJPEGB) += fate-mjpegb
 fate-mjpegb: CMD = framecrc -idct simple -fflags +bitexact -i 
$(TARGET_SAMPLES)/mjpegb/mjpegb_part.mov -an
 
+FATE_VIDEO-$(call DEMDEC, AVI, MJPEG) += fate-mjpeg-ticket3229
+fate-mjpeg-ticket3229: CMD = framecrc -idct simple -fflags +bitexact -i 
$(TARGET_SAMPLES)/mjpeg/mjpeg_field_order.avi -an
+
 FATE_VIDEO-$(call DEMDEC, MVI, MOTIONPIXELS) += fate-motionpixels
 fate-motionpixels: CMD = framecrc -i 
$(TARGET_SAMPLES)/motion-pixels/INTRO-partial.MVI -an -pix_fmt rgb24 -frames:v 
111
 
diff --git a/tests/ref/fate/mjpeg-ticket3229 b/tests/ref/fate/mjpeg-ticket3229
new file mode 100644
index 000..859e3c5
--- /dev/null
+++ b/tests/ref/fate/mjpeg-ticket3229
@@ -0,0 +1,25 @@
+#tb 0: 1/30
+#media_type 0: video
+#codec_id 0: rawvideo
+#dimensions 0: 468x312
+#sar 0: 0/1
+0,  0,  0,1,   292032, 0x3af3a5f7
+0,  6,  6,1,   292032, 0xe97fb504
+0,  8,  8,1,   292032, 0xd448db04
+0,  9,  9,1,   292032, 0xd448db04
+0, 10, 10,1,   292032, 0xd448db04
+0, 11, 11,1,   292032, 0xd448db04
+0, 13, 13,1,   292032, 0xd448db04
+0, 14, 14,1,   292032, 0xd448db04
+0, 15, 15,1,   292032, 0xd448db04
+0, 16, 16,1,   292032, 0xd448db04
+0, 17, 17,1,   292032, 0x42e8d61c
+0, 19, 19,1,   292032, 0x944dc70f
+0, 21, 21,1,   292032, 0x944dc70f
+0, 22, 22,1,   292032, 0x944dc70f
+0, 23, 23,1,   292032, 0xd363db9a
+0, 25, 25,1,   292032, 0xd363db9a
+0, 26, 26,1,   292032, 0xd363db9a
+0, 27, 27,1,   292032, 0xd363db9a
+0, 28, 28,1,   292032, 0xd363db9a
+0, 29, 29,1,   292032, 0x81feeaa7
-- 
2.7.4

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH] lavf/vf_freezedetect: improve for the freeze frame detection

2019-07-14 Thread Marton Balint



On Sun, 14 Jul 2019, Limin Wang wrote:


On Sat, Jul 13, 2019 at 07:24:59PM +0200, Marton Balint wrote:



On Sat, 13 Jul 2019, lance.lmw...@gmail.com wrote:

>From: Limin Wang 
>
>I have samples failed to detect the freeze frame with the default -60dB
>noise(-40dB is OK to detect),
>after apply the patch, it's ok to detect.
>
>I run the testing with fate-suite sample for your testing:
>old: no freeze frame detect.
>
>with the patch:
>./ffmpeg -i fate-suite/svq3/Vertical400kbit.sorenson3.mov -vf
>freezedetect=n=-60dB -an -f null -
>[freezedetect @ 0x7fe18a604900] lavfi.freezedetect.freeze_start: 38.7667
>[freezedetect @ 0x7fe18a604900] lavfi.freezedetect.freeze_duration: 2.5
>[freezedetect @ 0x7fe18a604900] lavfi.freezedetect.freeze_end: 41.2667
>[freezedetect @ 0x7fe18a604900] lavfi.freezedetect.freeze_start: 41.2667
>
>Have run make fate testing although haven't find any freezedetect checking for
>the fate.

You are changing the way the score is calculated and not describing
why. Of course you will get different results.

>
>Signed-off-by: Limin Wang 
>---
>libavfilter/vf_freezedetect.c | 22 --
>1 file changed, 16 insertions(+), 6 deletions(-)
>
>diff --git a/libavfilter/vf_freezedetect.c b/libavfilter/vf_freezedetect.c
>index cc086af..0288fb0 100644
>--- a/libavfilter/vf_freezedetect.c
>+++ b/libavfilter/vf_freezedetect.c
>@@ -38,7 +38,9 @@ typedef struct FreezeDetectContext {
>ptrdiff_t height[4];
>ff_scene_sad_fn sad;
>int bitdepth;
>+int nb_planes;
>AVFrame *reference_frame;
>+double prev_mafd;
>int64_t n;
>int64_t reference_n;
>int frozen;
>@@ -102,13 +104,15 @@ static int config_input(AVFilterLink *inlink)
>AVFilterContext *ctx = inlink->dst;
>FreezeDetectContext *s = ctx->priv;
>const AVPixFmtDescriptor *pix_desc = av_pix_fmt_desc_get(inlink->format);
>+int vsub = pix_desc->log2_chroma_h;
>
>s->bitdepth = pix_desc->comp[0].depth;
>+s->nb_planes = av_pix_fmt_count_planes(inlink->format);

This is not needed, for invalid planes we simply get 0 for linesize
and width.


It's more general to get nb_planes instead of checking the linesize
result. If have one plane, it's unneed to check 4 times.


Still looks a purely cosmetic change to me.





>
>-for (int plane = 0; plane < 4; plane++) {
>+for (int plane = 0; plane < s->nb_planes; plane++) {
>ptrdiff_t line_size = av_image_get_linesize(inlink->format, inlink->w, 
plane);
>-s->width[plane] = line_size >> (s->bitdepth > 8);
>-s->height[plane] = inlink->h >> ((plane == 1 || plane == 2) ? 
pix_desc->log2_chroma_h : 0);
>+s->width[plane] = line_size;

Why? Width is the width of the plane in pixels, simply setting
linesize does not seem right.


the sad init function have set the bitdepth, so I think it's OK to set
the width in bytes. Maybe it's my misunderstand for the code.


Later on width*height is used to determine the number of pixels for which 
we have counted the sum of differences.






>+s->height[plane] = plane == 1 || plane == 2 ? AV_CEIL_RSHIFT(inlink->h, 
vsub) : inlink->h;

Mix of a cosmetic and functional change. This should do the same
with existing code and variables:
s->height[plane] = AV_CEIL_RSHIFT(inlink->h, ((plane == 1 || plane == 2) ? 
pix_desc->log2_chroma_h : 0)

>}
>
>s->sad = ff_scene_sad_get_fn(s->bitdepth == 8 ? 8 : 16);
>@@ -129,7 +133,9 @@ static int is_frozen(FreezeDetectContext *s, AVFrame 
*reference, AVFrame *frame)
>uint64_t sad = 0;
>uint64_t count = 0;
>double mafd;
>-for (int plane = 0; plane < 4; plane++) {
>+double diff, cmp;
>+
>+for (int plane = 0; plane < s->nb_planes; plane++) {

Unneeded.

>if (s->width[plane]) {
>uint64_t plane_sad;
>s->sad(frame->data[plane], frame->linesize[plane],
>@@ -140,8 +146,12 @@ static int is_frozen(FreezeDetectContext *s, AVFrame 
*reference, AVFrame *frame)
>}
>}
>emms_c();
>-mafd = (double)sad / count / (1ULL << s->bitdepth);
>-return (mafd <= s->noise);
>+mafd = (double)sad /(count >> (s->bitdepth > 8));

Why? MAFD should be the mean difference normalized to [0..1].

if the bitdeth is 16, it'll divide by 1UL << 16, it'll cause the mafd is
very small. So I choose the scenecut way in the below.


The metric supposed to be indepentent of the bit depth. If you get 
different mafd for the same source expressed in 8bit, 10bit or 16bit pixel 
format (provided that you use the same subsampling), then you are doing 
something wrong.


And you can't reinvent MAFD according to your needs. It is the mean 
absolute difference of the whole image normalized to 0..1 in this case. If 
you are not calculating that, then it is not MAFD.






>+diff = fabs(mafd - s->prev_mafd);
>+cmp  = av_clipf(FFMIN(mafd, diff) / 100., 0, 1);
>+s->prev_mafd = mafd;

Why? This is not scene change detection, MAFD change is not useful
for us. E.g. two frames alternating will be 

Re: [FFmpeg-devel] [PATCH 5/6] avformat/xmv: Make bitrate 64bit

2019-07-14 Thread Paul B Mahol
LGTM

On 7/13/19, Michael Niedermayer  wrote:
> Fixes: signed integer overflow: 32 * 538976288 cannot be represented in type
> 'int'
> Fixes:
> 15633/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5752273981931520
>
> Found-by: continuous fuzzing process
> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer 
> ---
>  libavformat/xmv.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/libavformat/xmv.c b/libavformat/xmv.c
> index 29a32f2547..7f12956458 100644
> --- a/libavformat/xmv.c
> +++ b/libavformat/xmv.c
> @@ -79,7 +79,7 @@ typedef struct XMVAudioPacket {
>  uint16_t channels;///< Number of channels.
>  int32_t sample_rate;  ///< Sampling rate.
>  uint16_t bits_per_sample; ///< Bits per compressed sample.
> -uint32_t bit_rate;///< Bits of compressed data per second.
> +uint64_t bit_rate;///< Bits of compressed data per second.
>  uint16_t flags;   ///< Flags
>  unsigned block_align; ///< Bytes per compressed block.
>  uint16_t block_samples;   ///< Decompressed samples per compressed
> block.
> @@ -191,7 +191,7 @@ static int xmv_read_header(AVFormatContext *s)
>  packet->bits_per_sample = avio_rl16(pb);
>  packet->flags   = avio_rl16(pb);
>
> -packet->bit_rate  = packet->bits_per_sample *
> +packet->bit_rate  = (uint64_t)packet->bits_per_sample *
>  packet->sample_rate *
>  packet->channels;
>  packet->block_align   = XMV_BLOCK_ALIGN_SIZE * packet->channels;
> --
> 2.22.0
>
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH V1] doc/codecs: Add missing documentation for nointra

2019-07-14 Thread Jun Zhao
From: Jun Zhao 

Add missing documentation for nointra.

Signed-off-by: Jun Zhao 
---
 doc/codecs.texi |3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/doc/codecs.texi b/doc/codecs.texi
index 6b72760..0d0de94 100644
--- a/doc/codecs.texi
+++ b/doc/codecs.texi
@@ -963,6 +963,9 @@ Discard all bidirectional frames.
 @item nokey
 Discard all frames excepts keyframes.
 
+@item nointra
+Discard all frames except I frames.
+
 @item all
 Discard all frames.
 @end table
-- 
1.7.1

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH 2/6] avformat/vividas: Fixes overflow in shift in recover_key()

2019-07-14 Thread Reimar Döffinger
On 13 July 2019 22:25:02 CEST, Michael Niedermayer  
wrote:
>Fixes: left shift of 133 by 24 places cannot be represented in type
>'int'
>Fixes:
>15365/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5716153105645568
>
>Found-by: continuous fuzzing process
>https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
>Suggested-by: Reimar Döffinger 
>Signed-off-by: Michael Niedermayer 
>---
> libavformat/vividas.c | 5 +
> 1 file changed, 1 insertion(+), 4 deletions(-)
>
>diff --git a/libavformat/vividas.c b/libavformat/vividas.c
>index 350c7aa70a..830e318645 100644
>--- a/libavformat/vividas.c
>+++ b/libavformat/vividas.c
>@@ -115,10 +115,7 @@ static unsigned recover_key(unsigned char
>sample[4], unsigned expected_size)
> 
> put_v(plaintext+2, expected_size);
> 
>-return (sample[0]^plaintext[0])|
>-((sample[1]^plaintext[1])<<8)|
>-((sample[2]^plaintext[2])<<16)|
>-((sample[3]^plaintext[3])<<24);
>+return AV_RL32(sample) ^ AV_RL32(plaintext);
> }
> 
>static void xor_block(void *p1, void *p2, unsigned size, int key,
>unsigned *key_ptr)

Looks good to me.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".