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

2019-07-13 Thread Peter Ross
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.

-- Peter
(A907 E02F A6E5 0CD2 34CD 20D2 6760 79C5 AC40 DD6B)


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] avformat/rawenc: avoid divide by 0 when writing adx trailer

2019-07-13 Thread Andriy Gelman
On Sat, 13. Jul 23:10, Andriy Gelman wrote:
> On Sun, 14. Jul 00:40, Carl Eugen Hoyos wrote:
> > 
> > > Am 13.07.2019 um 22:50 schrieb Andriy Gelman :
> > > 
> > > From: Andriy Gelman 
> > > 
> > > Fixes #7985
> > 
> > Did you check the patch mentioned there?
> 
> Sorry, I missed that you sent a patch. 
> 
> I applied it, but get a divide by 0 exception in libavformat/rawenc.c:60
> because par->channels = 0 with the example in #7985 

ok, I think a different patch you sent for #7979 will also solve
the above problem
https://patchwork.ffmpeg.org/patch/13780/

Andriy



___
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] avformat/rawenc: avoid divide by 0 when writing adx trailer

2019-07-13 Thread Andriy Gelman
On Sun, 14. Jul 00:40, Carl Eugen Hoyos wrote:
> 
> > Am 13.07.2019 um 22:50 schrieb Andriy Gelman :
> > 
> > From: Andriy Gelman 
> > 
> > Fixes #7985
> 
> Did you check the patch mentioned there?

Sorry, I missed that you sent a patch. 

I applied it, but get a divide by 0 exception in libavformat/rawenc.c:60
because par->channels = 0 with the example in #7985 

Andriy
___
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 2/3] lavc/libdavs2.c: change decoder info level

2019-07-13 Thread hwren









At 2019-07-13 21:34:30, "Li, Zhong"  wrote:
>> From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On Behalf
>> Of hwrenx
>> Sent: Friday, July 12, 2019 11:22 PM
>> To: ffmpeg-devel@ffmpeg.org
>> Subject: [FFmpeg-devel] [PATCH v3 2/3] lavc/libdavs2.c: change decoder info
>> level
>> 
>> Signed-off-by: hwrenx 
>> ---
>>  libavcodec/libdavs2.c | 4 +++-
>>  1 file changed, 3 insertions(+), 1 deletion(-)
>> 
>> diff --git a/libavcodec/libdavs2.c b/libavcodec/libdavs2.c index
>> 218f3ec..1b274a3 100644
>> --- a/libavcodec/libdavs2.c
>> +++ b/libavcodec/libdavs2.c
>> @@ -44,7 +44,9 @@ static av_cold int davs2_init(AVCodecContext *avctx)
>> 
>>  /* init the decoder */
>>  cad->param.threads  = avctx->thread_count;
>> -cad->param.info_level   = 0;
>> +cad->param.info_level   = av_log_get_level() > AV_LOG_INFO
>> + ?
>> DAVS2_LOG_DEBUG
>> + :
>> DAVS2_LOG_WARNING;
>
>How about exactly map AV_LOG_XXX to DAVS2_LOG_XXX?

Exactly, a map would be better. Two levels are enough now, and I will update if 
there are new versions of these patches.

Thanks : )
Huiwen REN

>___
>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".

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

2019-07-13 Thread Steven Liu
Marton Balint  于2019年7月14日周日 上午2:02写道:
>
>
>
> On Sat, 13 Jul 2019, 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..e24605b7d6 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 
> > -use_localtime 1 -hls_list_size 0 \
> > + -hls_time 1 -hls_segment_filename 
> > "$(TARGET_PATH)/tests/data/%Y-%m-%d_%H-%M-%S.m4s" \
> > + $(TARGET_PATH)/tests/data/hls_fmp4.m3u8 2>aa.txt
>
> 2>a ?
>
> Also using date/time in the filename does not seem too wise in a fate
> test, something should clean this up eventually, right?

new patch submited: https://patchwork.ffmpeg.org/patch/13938/
___
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-13 Thread Limin Wang
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.

> 
> >
> >-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.

> 
> >+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. 

> 
> >+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 detected as frozen. Also
> note that not always consecutive frames are compared, so involving
> MAFD change seems even more bogus to me.
Isn't possible to add one standard sampel into fate, it's useful to
test the function. We can choose different noise setting to get the same
result, so it's difficult to say whether it's covered.


> 
> Regards,
> Marton
> ___
> ffmpeg-de

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

2019-07-13 Thread Steven Liu
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
+
diff --git a/tests/ref/fate/hls-fmp4 b/tests/ref/fate/hls-fmp4
new file mode 100644
index 00..98b037fc8f
--- /dev/null
+++ b/tests/ref/fate/hls-fmp4
@@ -0,0 +1,198 @@
+#tb 0: 1/44100
+#media_type 0: audio
+#codec_id 0: pcm_s16le
+#sample_rate 0: 44100
+#channel_layout 0: 4
+#channel_layout_name 0: mono
+0,  0,  0, 1152, 2304, 0x907cb7fa
+0,   1152,   1152, 1152, 2304, 0xb8dc7525
+0,   2304,   2304, 1152, 2304, 0x3e7d6905
+0,   3456,   3456, 1152, 2304, 0xef47877b
+0,   4608,   4608, 1152, 2304, 0xfe916b7e
+0,   5760,   5760, 1152, 2304, 0xe3d08cde
+0,   6912,   6912, 1152, 2304, 0xff7f86cf
+0,   8064,   8064, 1152, 2304, 0x843e6f95
+0,   9216,   9216, 1152, 2304, 0x81577c26
+0,  10368,  10368, 1152, 2304, 0x04a085d5
+0,  11520,  11520, 1152, 2304, 0x1c5a76f5
+0,  12672,  12672, 1152, 2304, 0x4ee78623
+0,  13824,  13824, 1152, 2304, 0x8ec861dc
+0,  14976,  14976, 1152, 2304, 0x0ca179d8
+0,  16128,  16128, 1152, 2304, 0xc6da750f
+0,  17280,  17280, 1152, 2304, 0xf6bf79b5
+0,  18432,  18432, 1152, 2304, 0x97b88a43
+0,  19584,  19584, 1152, 2304, 0xf13c7b9c
+0,  20736,  20736, 1152, 2304, 0xdfba83af
+0,  21888,  21888, 1152, 2304, 0xc9467d4b
+0,  23040,  23040, 1152, 2304, 0xbbb58e2b
+0,  24192,  24192, 1152, 2304, 0x3a1078ea
+0,  25344,  25344, 1152, 2304, 0xe9587a5c
+0,  26496,  26496, 1152, 2304, 0xef5a8039
+0,  27648,  27648, 1152, 2304, 0x9d5f782f
+0,  28800,  28800, 1152, 2304, 0x1a548291
+0,  29952,  29952, 1152, 2304, 0x07517701
+0,  31104,  31104, 1152, 2304, 0x78127d6e
+0,  32256,  32256, 1152, 2304, 0x62e2788a
+0,  33408,  33408, 1152, 2304, 0x29397ad9
+0,  34560,  34560, 1152, 2304, 0x45da82d6
+0,  35712,  35712, 1152, 2304, 0x8ed66e51
+0,  36864,  36864, 1152, 2304, 0x660775cd
+0,  38016,  38016, 1152, 2304, 0x802c767a
+0,  39168,  39168, 1152, 2304, 0xcc055840
+0,  40320,  40320, 1152, 2304, 0x701b7eaf
+0,  41472,  41472, 1152, 2304, 0x8290749f
+0,  42624,  42624, 1152, 2304, 0x2c7b7d30
+0,  43776,  43776, 1152, 2304, 0xe4f17743
+0,  44928,  44928, 1152, 2304, 0x0e747d6e
+0,  46080,  46080, 1152, 2304, 0xbe7775a0
+0,  47232,  47232, 1152, 2304, 0xcf797673
+0,  48384,  48384, 1152, 2304, 0x29cb7800
+0,  49536,  49536, 1152, 2304, 0xfc947890
+0,  50688,  50688, 1152, 2304, 0x62757fc6
+0,  51840,  51840, 1152, 2304, 0x098876d0
+0,  52992,  52992, 1152, 2304, 0xa9567ee2
+0,  54144,  54144, 1152, 2304, 0xe3bb9173
+0,  55296,  55296, 1152, 2304, 0xcc2d6dee
+0,  56448,  56448, 1152, 2304, 0xe94591ab
+0,  57600,  57600, 1152, 2304, 0x5c7588de
+0,  58752,  58752, 1152, 2304, 0xfd83643c
+0,  59904,  59904, 1152, 2304, 0x528177f1
+0,  61056,  61056, 1152, 2304, 0x65d08474
+0,  62208,  62208, 1152,   

Re: [FFmpeg-devel] [PATCH] avformat/rawenc: avoid divide by 0 when writing adx trailer

2019-07-13 Thread Carl Eugen Hoyos

> Am 13.07.2019 um 22:50 schrieb Andriy Gelman :
> 
> From: Andriy Gelman 
> 
> Fixes #7985

Did you check the patch mentioned there?

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".

[FFmpeg-devel] [PATCH] avformat/rawenc: avoid divide by 0 when writing adx trailer

2019-07-13 Thread Andriy Gelman
From: Andriy Gelman 

Fixes #7985
This patch checks that the number of audio channels is not zero when
writing the total sample count in adx header.
---
 libavformat/rawenc.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/libavformat/rawenc.c b/libavformat/rawenc.c
index 993d232b70..bf8537fffb 100644
--- a/libavformat/rawenc.c
+++ b/libavformat/rawenc.c
@@ -65,6 +65,9 @@ static int adx_write_trailer(AVFormatContext *s)
 AVIOContext *pb = s->pb;
 AVCodecParameters *par = s->streams[0]->codecpar;
 
+if (par->channels == 0)
+  return AVERROR_INVALIDDATA;
+
 if (pb->seekable & AVIO_SEEKABLE_NORMAL) {
 int64_t file_size = avio_tell(pb);
 uint64_t sample_count = (file_size - 36) / par->channels / 18 * 32;
-- 
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 6/6] avcodec/clearvideo: fix invalid shift in tile size check

2019-07-13 Thread Michael Niedermayer
Fixes: left shift of 1 by 31 places cannot be represented in type 'int'
Fixes: 
15631/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_CLEARVIDEO_fuzzer-5690110605000704

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

diff --git a/libavcodec/clearvideo.c b/libavcodec/clearvideo.c
index 82df8f3752..26cdfb2731 100644
--- a/libavcodec/clearvideo.c
+++ b/libavcodec/clearvideo.c
@@ -665,7 +665,7 @@ static av_cold int clv_decode_init(AVCodecContext *avctx)
 }
 
 c->tile_shift = av_log2(c->tile_size);
-if (1 << c->tile_shift != c->tile_size) {
+if (1U << c->tile_shift != c->tile_size) {
 av_log(avctx, AV_LOG_ERROR, "Tile size: %d, is not power of 2.\n", 
c->tile_size);
 return AVERROR_INVALIDDATA;
 }
-- 
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 5/6] avformat/xmv: Make bitrate 64bit

2019-07-13 Thread Michael Niedermayer
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] [PATCH 3/6] avformat/vividas: Check buffer size before allocation

2019-07-13 Thread Michael Niedermayer
Fixes: out of array access
Fixes: 
15365/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5716153105645568

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer 
---
 libavformat/vividas.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/libavformat/vividas.c b/libavformat/vividas.c
index 830e318645..2564a163cb 100644
--- a/libavformat/vividas.c
+++ b/libavformat/vividas.c
@@ -251,6 +251,9 @@ static uint8_t *read_sb_block(AVIOContext *src, unsigned 
*size,
 *key = tmpkey;
 }
 
+if (n < 8)
+return NULL;
+
 buf = av_malloc(n);
 if (!buf)
 return NULL;
-- 
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/6] avcodec/iff: Add "else" to make code look prettier

2019-07-13 Thread Michael Niedermayer
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

___
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 4/6] avformat/vividas: Check if extradata was read successfully

2019-07-13 Thread Michael Niedermayer
Fixes: OOM
Fixes: 
15575/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5654666781655040

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer 
---
 libavformat/vividas.c | 7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/libavformat/vividas.c b/libavformat/vividas.c
index 2564a163cb..184d24f374 100644
--- a/libavformat/vividas.c
+++ b/libavformat/vividas.c
@@ -389,7 +389,12 @@ static void track_header(VividasDemuxContext *viv, 
AVFormatContext *s,  uint8_t
 offset += av_xiphlacing(&p[offset], data_len[j]);
 
 for (j = 0; j < num_data; j++) {
-avio_read(pb, &p[offset], data_len[j]);
+int ret = avio_read(pb, &p[offset], data_len[j]);
+if (ret < data_len[j]) {
+st->codecpar->extradata_size = 0;
+av_freep(&st->codecpar->extradata);
+break;
+}
 offset += data_len[j];
 }
 
-- 
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/6] avformat/vividas: Fixes overflow in shift in recover_key()

2019-07-13 Thread Michael Niedermayer
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)
-- 
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] Add support for Display Definition Segment to DVB Subtitle encoder

2019-07-13 Thread Marton Balint



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


From: Jernej Fijacko 

Current version of dvbsub encoder doesn't support HD DVB subtitles. The high
resolution bitmaps are muxed into the stream but without the DDS (display 
definition
segment) the players asume that the DVB subtitles are in SD (720x576) resolution
which causes them to either render the subtitles too large and misplaced or 
don't
render them at all. By including the DDS as defined in section 7.7.1 of ETSI EN 
300
743 (V1.3.1) this problem is fixed.

7.2.1 Display definition segment The display definition for a subtitle service 
may
be defined by the display definition segment if present in the stream. Absence 
of a
DDS implies that the stream is coded in accordance with EN 300 743 (V1.2.1) [5] 
and
that a display width of 720 pixels and a display height of 576 lines may be 
assumed.

https://www.etsi.org/deliver/etsi_en/300700_300799/300743/01.03.01_60/en_300743v010301p.pdf


Thanks, applied.

Regards,
Marton
___
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] [PATCHv4] avcodec: Add librav1e encoder

2019-07-13 Thread Nicolas George
James Almer (12019-07-13):
> > +uint8_t *tmp = av_fast_realloc(ctx->pass_data, &ctx->pass_size,
> > +  ctx->pass_pos + buf_size);
> Just use av_reallocp(). Each call will make the buffer bigger, so you're
> not really making use the no-op benefits from av_fast_realloc(), which
> only trigger if newsize <= size.

av_fast_realloc() also allocates 17/16 of the requested memory, which
makes the incremental building of a buffer linear instead of quadratic.

Regards,

-- 
  Nicolas George


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] [PATCHv4] avcodec: Add librav1e encoder

2019-07-13 Thread James Almer
On 7/9/2019 3:34 PM, Derek Buitenhuis wrote:
> Port to the new send/receive API by: James Almer .
> 
> Signed-off-by: Derek Buitenhuis 
> ---
> Lots of stuff happened since v3!
> 
> * The C API / library is now in rav1e's main repo, and officially supported.
> * rav1e will bump the soname and pkg-config version on any breaking changes.
> * C API is now as fast as the Rust API.
> * Added two pass support.
> * Added min quantizer support.
> * Added tiles / speed to AVOptions.
> * Mapped min/max keyint.
> * Applied all the fixes requested in the last round.
> ---
>  configure  |   4 +
>  doc/encoders.texi  |  37 +++
>  doc/general.texi   |   7 +
>  libavcodec/Makefile|   1 +
>  libavcodec/allcodecs.c |   1 +
>  libavcodec/librav1e.c  | 578 +
>  6 files changed, 628 insertions(+)
>  create mode 100644 libavcodec/librav1e.c

> +static int get_stats(AVCodecContext *avctx, int eos)
> +{
> +librav1eContext *ctx = avctx->priv_data;
> +uint8_t *buf;
> +size_t buf_size = 0;
> +
> +buf = rav1e_twopass_out(ctx->ctx, &buf_size);
> +if (!buf)
> +return 0;
> +
> +if (!eos) {
> +uint8_t *tmp = av_fast_realloc(ctx->pass_data, &ctx->pass_size,
> +  ctx->pass_pos + buf_size);

Just use av_reallocp(). Each call will make the buffer bigger, so you're
not really making use the no-op benefits from av_fast_realloc(), which
only trigger if newsize <= size.

> +static av_cold int librav1e_encode_init(AVCodecContext *avctx)
> +{
> +librav1eContext *ctx = avctx->priv_data;
> +const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(avctx->pix_fmt);
> +RaConfig *cfg = NULL;
> +int rret;
> +int ret = 0;
> +
> +cfg = rav1e_config_default();
> +if (!cfg) {
> +av_log(avctx, AV_LOG_ERROR, "Could not allocate rav1e config.\n");
> +return AVERROR_EXTERNAL;
> +}
> +
> +rav1e_config_set_time_base(cfg, (RaRational) {
> +   avctx->time_base.num * avctx->ticks_per_frame,
> +   avctx->time_base.den
> +   });
> +
> +if (avctx->flags & AV_CODEC_FLAG_PASS2) {
> +if (!avctx->stats_in) {
> +av_log(avctx, AV_LOG_ERROR, "No stats file provided for second 
> pass.\n");
> +ret = AVERROR(EINVAL);
> +goto end;
> +}
> +
> +ctx->pass_size = (strlen(avctx->stats_in) * 3) / 4;

AV_BASE64_DECODE_SIZE(strlen(avctx->stats_in));
___
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 hls fmp4 segment type test case

2019-07-13 Thread Marton Balint



On Sat, 13 Jul 2019, 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..e24605b7d6 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 -use_localtime 
1 -hls_list_size 0 \
+   -hls_time 1 -hls_segment_filename 
"$(TARGET_PATH)/tests/data/%Y-%m-%d_%H-%M-%S.m4s" \
+   $(TARGET_PATH)/tests/data/hls_fmp4.m3u8 2>aa.txt


2>a ?

Also using date/time in the filename does not seem too wise in a fate 
test, something should clean this up eventually, right?


Regards,
Marton


+
+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
+
diff --git a/tests/ref/fate/hls-fmp4 b/tests/ref/fate/hls-fmp4
new file mode 100644
index 00..98b037fc8f
--- /dev/null
+++ b/tests/ref/fate/hls-fmp4
@@ -0,0 +1,198 @@
+#tb 0: 1/44100
+#media_type 0: audio
+#codec_id 0: pcm_s16le
+#sample_rate 0: 44100
+#channel_layout 0: 4
+#channel_layout_name 0: mono
+0,  0,  0, 1152, 2304, 0x907cb7fa
+0,   1152,   1152, 1152, 2304, 0xb8dc7525
+0,   2304,   2304, 1152, 2304, 0x3e7d6905
+0,   3456,   3456, 1152, 2304, 0xef47877b
+0,   4608,   4608, 1152, 2304, 0xfe916b7e
+0,   5760,   5760, 1152, 2304, 0xe3d08cde
+0,   6912,   6912, 1152, 2304, 0xff7f86cf
+0,   8064,   8064, 1152, 2304, 0x843e6f95
+0,   9216,   9216, 1152, 2304, 0x81577c26
+0,  10368,  10368, 1152, 2304, 0x04a085d5
+0,  11520,  11520, 1152, 2304, 0x1c5a76f5
+0,  12672,  12672, 1152, 2304, 0x4ee78623
+0,  13824,  13824, 1152, 2304, 0x8ec861dc
+0,  14976,  14976, 1152, 2304, 0x0ca179d8
+0,  16128,  16128, 1152, 2304, 0xc6da750f
+0,  17280,  17280, 1152, 2304, 0xf6bf79b5
+0,  18432,  18432, 1152, 2304, 0x97b88a43
+0,  19584,  19584, 1152, 2304, 0xf13c7b9c
+0,  20736,  20736, 1152, 2304, 0xdfba83af
+0,  21888,  21888, 1152, 2304, 0xc9467d4b
+0,  23040,  23040, 1152, 2304, 0xbbb58e2b
+0,  24192,  24192, 1152, 2304, 0x3a1078ea
+0,  25344,  25344, 1152, 2304, 0xe9587a5c
+0,  26496,  26496, 1152, 2304, 0xef5a8039
+0,  27648,  27648, 1152, 2304, 0x9d5f782f
+0,  28800,  28800, 1152, 2304, 0x1a548291
+0,  29952,  29952, 1152, 2304, 0x07517701
+0,  31104,  31104, 1152, 2304, 0x78127d6e
+0,  32256,  32256, 1152, 2304, 0x62e2788a
+0,  33408,  33408, 1152, 2304, 0x29397ad9
+0,  34560,  34560, 1152, 2304, 0x45da82d6
+0,  35712,  35712, 1152, 2304, 0x8ed66e51
+0,  36864,  36864, 1152, 2304, 0x660775cd
+0,  38016,  38016, 1152, 2304, 0x802c767a
+0,  39168,  39168, 1152, 2304, 0xcc055840
+0,  40320,  40320, 1152, 2304, 0x701b7eaf
+0,  41472,  41472, 1152, 2304, 0x8290749f
+0,  42624,  42624, 1152, 2304, 0x2c7b7d30
+0,  43776,  43776, 1152, 2304, 0xe4f17743
+0,  44928,  44928, 1152, 2304, 0x0e747d6e
+0,  46080,  46080, 1152, 2304, 0xbe7775a0
+0,  47232,  47232, 1152, 2304, 0xcf797673
+0,  48384,  48384, 1152, 2304, 0x29cb7800
+0,  49536,  49536, 1152, 2304, 0xfc947890
+0,  50688,  50688, 1152, 2304, 0x62757fc6
+0,  51840,  51840, 1152, 2304, 0x098876d0
+0,  52992,  52992, 1152, 2304, 0xa9567ee2
+0,  54144,  54144, 1152, 2304, 0xe3bb9173
+0,  55296,  55296, 1152, 2304, 0xcc2d6dee
+0,  56448,  56448, 1152, 2304, 0xe94591ab
+0,  57600,  57600, 1152, 2304, 0x5c758

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

2019-07-13 Thread Michael Niedermayer
On Sat, Jun 29, 2019 at 05:44:21AM +0200, Reimar Döffinger wrote:
> 
> 
> On 28.06.2019, at 22:53, 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
> > Signed-off-by: Michael Niedermayer 
> > ---
> > libavformat/vividas.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/libavformat/vividas.c b/libavformat/vividas.c
> > index 753328245d..ed2eaea633 100644
> > --- a/libavformat/vividas.c
> > +++ b/libavformat/vividas.c
> > @@ -118,7 +118,7 @@ static unsigned recover_key(unsigned char sample[4], 
> > unsigned expected_size)
> > return (sample[0]^plaintext[0])|
> > ((sample[1]^plaintext[1])<<8)|
> > ((sample[2]^plaintext[2])<<16)|
> > -((sample[3]^plaintext[3])<<24);
> > +((unsigned)(sample[3]^plaintext[3])<<24);
> 
> Shouldn't this just be
> return AV_RL32(sample) ^ AV_RL32(plaintext);
> ?

yes, will change it to this

thx


> If so, the code might be worthy of review for more needless 
> overcomplication...
> ___
> 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".

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The smallest minority on earth is the individual. Those who deny 
individual rights cannot claim to be defenders of minorities. - Ayn Rand


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] lavf/vf_freezedetect: improve for the freeze frame detection

2019-07-13 Thread Marton Balint



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.




-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.



+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].


+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 detected as frozen. Also note that not 
always consecutive frames are compared, so involving MAFD change seems 
even more bogus to me.


Regards,
Marton
___
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] avformat: Don't suggest deprecated function

2019-07-13 Thread James Almer
On 7/13/2019 1:48 PM, Andreas Rheinhardt wrote:
> Signed-off-by: Andreas Rheinhardt 
> ---
>  libavformat/avformat.h | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/libavformat/avformat.h b/libavformat/avformat.h
> index 734ae54cac..6eb329f13f 100644
> --- a/libavformat/avformat.h
> +++ b/libavformat/avformat.h
> @@ -175,8 +175,8 @@
>   * Otherwise, if AVPacket.buf is NULL, the packet data is backed by a
>   * static storage somewhere inside the demuxer and the packet is only valid
>   * until the next av_read_frame() call or closing the file. If the caller
> - * requires a longer lifetime, av_dup_packet() will make an av_malloc()ed 
> copy
> - * of it.
> + * requires a longer lifetime, av_packet_make_refcounted() will ensure that
> + * the data is reference counted, copying the data if necessary.
>   * In both cases, the packet must be freed with av_packet_unref() when it is 
> no
>   * longer needed.
>   *

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] avformat: Don't suggest deprecated function

2019-07-13 Thread Andreas Rheinhardt
Signed-off-by: Andreas Rheinhardt 
---
 libavformat/avformat.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index 734ae54cac..6eb329f13f 100644
--- a/libavformat/avformat.h
+++ b/libavformat/avformat.h
@@ -175,8 +175,8 @@
  * Otherwise, if AVPacket.buf is NULL, the packet data is backed by a
  * static storage somewhere inside the demuxer and the packet is only valid
  * until the next av_read_frame() call or closing the file. If the caller
- * requires a longer lifetime, av_dup_packet() will make an av_malloc()ed copy
- * of it.
+ * requires a longer lifetime, av_packet_make_refcounted() will ensure that
+ * the data is reference counted, copying the data if necessary.
  * In both cases, the packet must be freed with av_packet_unref() when it is no
  * longer needed.
  *
-- 
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] lavf/vf_freezedetect: improve for the freeze frame detection

2019-07-13 Thread lance . lmwang
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.

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);
 
-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;
+s->height[plane] = plane == 1 || plane == 2 ? 
AV_CEIL_RSHIFT(inlink->h, vsub) : inlink->h;
 }
 
 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++) {
 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));
+diff = fabs(mafd - s->prev_mafd);
+cmp  = av_clipf(FFMIN(mafd, diff) / 100., 0, 1);
+s->prev_mafd = mafd;
+
+return (cmp <= s->noise);
 }
 
 static int set_meta(FreezeDetectContext *s, AVFrame *frame, const char *key, 
const char *value)
-- 
2.6.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".

[FFmpeg-devel] [PATCH v2] libavformat/avio: Fix for the unexpected file close which will cause fd 0 is closed

2019-07-13 Thread lance . lmwang
From: Limin Wang 

By the code, is_connected is used to check file open or not, so after open_dir
is done, we should not set is_connected to 1, it'll cause the function 
ffurl_closep 
will invoke the url_close and cause unexpected file close.

Signed-off-by: Limin Wang 
---
 libavformat/avio.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/libavformat/avio.c b/libavformat/avio.c
index 663789e..8b52aa3 100644
--- a/libavformat/avio.c
+++ b/libavformat/avio.c
@@ -560,7 +560,6 @@ int avio_open_dir(AVIODirContext **s, const char *url, 
AVDictionary **options)
 if (ret < 0)
 goto fail;
 
-h->is_connected = 1;
 ctx->url_context = h;
 *s = ctx;
 return 0;
-- 
2.6.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".

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

2019-07-13 Thread Steven Liu
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..e24605b7d6 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 -use_localtime 
1 -hls_list_size 0 \
+   -hls_time 1 -hls_segment_filename 
"$(TARGET_PATH)/tests/data/%Y-%m-%d_%H-%M-%S.m4s" \
+   $(TARGET_PATH)/tests/data/hls_fmp4.m3u8 2>aa.txt
+
+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
+
diff --git a/tests/ref/fate/hls-fmp4 b/tests/ref/fate/hls-fmp4
new file mode 100644
index 00..98b037fc8f
--- /dev/null
+++ b/tests/ref/fate/hls-fmp4
@@ -0,0 +1,198 @@
+#tb 0: 1/44100
+#media_type 0: audio
+#codec_id 0: pcm_s16le
+#sample_rate 0: 44100
+#channel_layout 0: 4
+#channel_layout_name 0: mono
+0,  0,  0, 1152, 2304, 0x907cb7fa
+0,   1152,   1152, 1152, 2304, 0xb8dc7525
+0,   2304,   2304, 1152, 2304, 0x3e7d6905
+0,   3456,   3456, 1152, 2304, 0xef47877b
+0,   4608,   4608, 1152, 2304, 0xfe916b7e
+0,   5760,   5760, 1152, 2304, 0xe3d08cde
+0,   6912,   6912, 1152, 2304, 0xff7f86cf
+0,   8064,   8064, 1152, 2304, 0x843e6f95
+0,   9216,   9216, 1152, 2304, 0x81577c26
+0,  10368,  10368, 1152, 2304, 0x04a085d5
+0,  11520,  11520, 1152, 2304, 0x1c5a76f5
+0,  12672,  12672, 1152, 2304, 0x4ee78623
+0,  13824,  13824, 1152, 2304, 0x8ec861dc
+0,  14976,  14976, 1152, 2304, 0x0ca179d8
+0,  16128,  16128, 1152, 2304, 0xc6da750f
+0,  17280,  17280, 1152, 2304, 0xf6bf79b5
+0,  18432,  18432, 1152, 2304, 0x97b88a43
+0,  19584,  19584, 1152, 2304, 0xf13c7b9c
+0,  20736,  20736, 1152, 2304, 0xdfba83af
+0,  21888,  21888, 1152, 2304, 0xc9467d4b
+0,  23040,  23040, 1152, 2304, 0xbbb58e2b
+0,  24192,  24192, 1152, 2304, 0x3a1078ea
+0,  25344,  25344, 1152, 2304, 0xe9587a5c
+0,  26496,  26496, 1152, 2304, 0xef5a8039
+0,  27648,  27648, 1152, 2304, 0x9d5f782f
+0,  28800,  28800, 1152, 2304, 0x1a548291
+0,  29952,  29952, 1152, 2304, 0x07517701
+0,  31104,  31104, 1152, 2304, 0x78127d6e
+0,  32256,  32256, 1152, 2304, 0x62e2788a
+0,  33408,  33408, 1152, 2304, 0x29397ad9
+0,  34560,  34560, 1152, 2304, 0x45da82d6
+0,  35712,  35712, 1152, 2304, 0x8ed66e51
+0,  36864,  36864, 1152, 2304, 0x660775cd
+0,  38016,  38016, 1152, 2304, 0x802c767a
+0,  39168,  39168, 1152, 2304, 0xcc055840
+0,  40320,  40320, 1152, 2304, 0x701b7eaf
+0,  41472,  41472, 1152, 2304, 0x8290749f
+0,  42624,  42624, 1152, 2304, 0x2c7b7d30
+0,  43776,  43776, 1152, 2304, 0xe4f17743
+0,  44928,  44928, 1152, 2304, 0x0e747d6e
+0,  46080,  46080, 1152, 2304, 0xbe7775a0
+0,  47232,  47232, 1152, 2304, 0xcf797673
+0,  48384,  48384, 1152, 2304, 0x29cb7800
+0,  49536,  49536, 1152, 2304, 0xfc947890
+0,  50688,  50688, 1152, 2304, 0x62757fc6
+0,  51840,  51840, 1152, 2304, 0x098876d0
+0,  52992,  52992, 1152, 2304, 0xa9567ee2
+0,  54144,  54144, 1152, 2304, 0xe3bb9173
+0,  55296,  55296, 1152, 2304, 0xcc2d6dee
+0,  56448,  56448, 1152, 2304, 0xe94591ab
+0,  57600,  57600, 1152, 2304, 0x5c7588de
+0,  58752,  58752, 1152, 2304, 0xfd83643c
+0,  59904,  59904, 1152, 2304, 0x528177f1
+0,  61056,  61056, 1152, 2304, 0x65d08474
+0,  62208, 

Re: [FFmpeg-devel] [PATCH v3 2/3] lavc/libdavs2.c: change decoder info level

2019-07-13 Thread Li, Zhong
> From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On Behalf
> Of hwrenx
> Sent: Friday, July 12, 2019 11:22 PM
> To: ffmpeg-devel@ffmpeg.org
> Subject: [FFmpeg-devel] [PATCH v3 2/3] lavc/libdavs2.c: change decoder info
> level
> 
> Signed-off-by: hwrenx 
> ---
>  libavcodec/libdavs2.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/libavcodec/libdavs2.c b/libavcodec/libdavs2.c index
> 218f3ec..1b274a3 100644
> --- a/libavcodec/libdavs2.c
> +++ b/libavcodec/libdavs2.c
> @@ -44,7 +44,9 @@ static av_cold int davs2_init(AVCodecContext *avctx)
> 
>  /* init the decoder */
>  cad->param.threads  = avctx->thread_count;
> -cad->param.info_level   = 0;
> +cad->param.info_level   = av_log_get_level() > AV_LOG_INFO
> + ?
> DAVS2_LOG_DEBUG
> + :
> DAVS2_LOG_WARNING;

How about exactly map AV_LOG_XXX to DAVS2_LOG_XXX?
___
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] Add support for Display Definition Segment to DVB Subtitle

2019-07-13 Thread Jernej
Thanks for the explanation. I sent a new patch with the original commit
message (and additional line break). I hope that everything is fine now.

Regards,
Jernej

On Sat, Jul 13, 2019 at 12:45 AM Moritz Barsnick  wrote:

> On Sat, Jul 13, 2019 at 00:24:29 +0200, mikroh...@gmail.com wrote:
> > From: Jernej 
>
> I think you had your full name in here originally. Note that whatever
> you provide here will be in the repo forever.
>
> >
> > Patch with requested changes.
>
> Your original commit text should be in here, not your message to the
> mailing list. Is this really the commit message you provided when
> committing locally? Your original text "Current version of dvbsub
> encoder doesn't support HD DVB subtitles. ..." was fine, except that it
> was missing some line breaks.
>
> >
> > ---
> [...]
>
> Moritz
> ___
> 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] Add support for Display Definition Segment to DVB Subtitle encoder

2019-07-13 Thread mikrohard
From: Jernej Fijacko 

Current version of dvbsub encoder doesn't support HD DVB subtitles. The high
resolution bitmaps are muxed into the stream but without the DDS (display 
definition
segment) the players asume that the DVB subtitles are in SD (720x576) resolution
which causes them to either render the subtitles too large and misplaced or 
don't
render them at all. By including the DDS as defined in section 7.7.1 of ETSI EN 
300
743 (V1.3.1) this problem is fixed.

7.2.1 Display definition segment The display definition for a subtitle service 
may
be defined by the display definition segment if present in the stream. Absence 
of a
DDS implies that the stream is coded in accordance with EN 300 743 (V1.2.1) [5] 
and
that a display width of 720 pixels and a display height of 576 lines may be 
assumed.

https://www.etsi.org/deliver/etsi_en/300700_300799/300743/01.03.01_60/en_300743v010301p.pdf

Signed-off-by: Jernej Fijacko 
---
 libavcodec/dvbsub.c | 19 ---
 1 file changed, 16 insertions(+), 3 deletions(-)

diff --git a/libavcodec/dvbsub.c b/libavcodec/dvbsub.c
index 8cce702..a8d43d8 100644
--- a/libavcodec/dvbsub.c
+++ b/libavcodec/dvbsub.c
@@ -247,9 +247,10 @@ static void dvb_encode_rle8(uint8_t **pq,
 *pq = q;
 }
 
-static int encode_dvb_subtitles(DVBSubtitleContext *s,
+static int encode_dvb_subtitles(AVCodecContext *avctx,
 uint8_t *outbuf, const AVSubtitle *h)
 {
+DVBSubtitleContext *s = avctx->priv_data;
 uint8_t *q, *pseg_len;
 int page_id, region_id, clut_id, object_id, i, bpp_index, page_state;
 
@@ -261,6 +262,19 @@ static int encode_dvb_subtitles(DVBSubtitleContext *s,
 if (h->num_rects && !h->rects)
 return -1;
 
+if (avctx->width > 0 && avctx->height > 0) {
+/* display definition segment */
+*q++ = 0x0f; /* sync_byte */
+*q++ = 0x14; /* segment_type */
+bytestream_put_be16(&q, page_id);
+pseg_len = q;
+q += 2; /* segment length */
+*q++ = 0x00; /* dds version number & display window flag */
+bytestream_put_be16(&q, avctx->width - 1); /* display width */
+bytestream_put_be16(&q, avctx->height - 1); /* display height */
+bytestream_put_be16(&pseg_len, q - pseg_len - 2);
+}
+
 /* page composition segment */
 
 *q++ = 0x0f; /* sync_byte */
@@ -446,10 +460,9 @@ static int dvbsub_encode(AVCodecContext *avctx,
  unsigned char *buf, int buf_size,
  const AVSubtitle *sub)
 {
-DVBSubtitleContext *s = avctx->priv_data;
 int ret;
 
-ret = encode_dvb_subtitles(s, buf, sub);
+ret = encode_dvb_subtitles(avctx, buf, sub);
 return ret;
 }
 
-- 
2.10.2

___
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/3] tools/target_dec_fuzzer: fix memleak of extradata

2019-07-13 Thread Michael Niedermayer
On Thu, Jul 11, 2019 at 11:34:10AM -0300, James Almer wrote:
> On 7/11/2019 9:29 AM, Michael Niedermayer wrote:
> > Fixes: memleak
> > Fixes: 
> > 15535/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SMACKER_fuzzer-5692162424963072
> > 
> > Found-by: continuous fuzzing process 
> > https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> > Signed-off-by: Michael Niedermayer 
> > ---
> >  tools/target_dec_fuzzer.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/tools/target_dec_fuzzer.c b/tools/target_dec_fuzzer.c
> > index f456db0e7b..a2ef94139b 100644
> > --- a/tools/target_dec_fuzzer.c
> > +++ b/tools/target_dec_fuzzer.c
> > @@ -201,7 +201,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t 
> > size) {
> >  
> >  int res = avcodec_open2(ctx, c, NULL);
> >  if (res < 0) {
> > -av_free(ctx);
> > +avcodec_free_context(&ctx);
> 
> Wasn't this fixed by b1febda061?

no, this still occurs without the patch here

==24989==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 183 byte(s) in 1 object(s) allocated from:

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The bravest are surely those who have the clearest vision
of what is before them, glory and danger alike, and yet
notwithstanding go out to meet it. -- Thucydides


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/4] avcodec/mpc8: Fixes invalid shift in mpc8_decode_frame()

2019-07-13 Thread Michael Niedermayer
On Thu, Jul 11, 2019 at 07:37:15PM -0300, James Almer wrote:
> On 7/11/2019 6:49 PM, Michael Niedermayer wrote:
> > Fixes: left shift of negative value -456
> > Fixes: 
> > 15561/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MPC8_fuzzer-5758130404720640
> > 
> > Found-by: continuous fuzzing process 
> > https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> > Signed-off-by: Michael Niedermayer 
> > ---
> >  libavcodec/mpc8.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/libavcodec/mpc8.c b/libavcodec/mpc8.c
> > index 3be2f79a5a..75943064da 100644
> > --- a/libavcodec/mpc8.c
> > +++ b/libavcodec/mpc8.c
> > @@ -364,7 +364,7 @@ static int mpc8_decode_frame(AVCodecContext * avctx, 
> > void *data,
> >  for(j = 0; j < SAMPLES_PER_BAND; j += SAMPLES_PER_BAND / 
> > 2){
> >  cnt = get_vlc2(gb, q1_vlc.table, MPC8_Q1_BITS, 2);
> >  t = mpc8_get_mask(gb, 18, cnt);
> > -for(k = 0; k < SAMPLES_PER_BAND / 2; k++, t <<= 1)
> > +for(k = 0; k < SAMPLES_PER_BAND / 2; k++, t += 
> > (unsigned)t)
> 
> How about something like this instead (Untested)
> 
> for(k = 0; k < SAMPLES_PER_BAND / 2; k++)
> c->Q[ch][off + j + k] = t & (1 << (SAMPLES_PER_BAND / 2 - k - 1))
> ? (get_bits1(gb) << 1) - 1 : 0;

tested, works, will apply with this

Thanks

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

Whats the most studid thing your enemy could do ? Blow himself up
Whats the most studid thing you could do ? Give up your rights and
freedom because your enemy blew himself up.



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".

[FFmpeg-devel] [PATCH] avformat/hlsenc: use old way for fragment mp4 in HLS PUT method

2019-07-13 Thread Steven Liu
fix ticket: 8015

Reported-by: Jun Zhao
Signed-off-by: Steven Liu 
---
 libavformat/hlsenc.c | 26 +++---
 1 file changed, 15 insertions(+), 11 deletions(-)

diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index 4abc728a89..2ade6723f9 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -816,6 +816,10 @@ static int hls_mux_init(AVFormatContext *s, VariantStream 
*vs)
 vs->new_start = 1;
 
 if (hls->segment_type == SEGMENT_TYPE_FMP4) {
+if (hls->http_persistent > 0) {
+//TODO: Support fragment fmp4 for http persistent in HLS muxer.
+av_log(s, AV_LOG_WARNING, "http persistent mode is currently 
unsupported for fragment mp4 in the HLS muxer.\n");
+}
 if (hls->max_seg_size > 0) {
 av_log(s, AV_LOG_WARNING, "Multi-file byterange mode is currently 
unsupported in the HLS muxer.\n");
 return AVERROR_PATCHWELCOME;
@@ -1467,7 +1471,7 @@ static int hls_window(AVFormatContext *s, int last, 
VariantStream *vs)
 
 set_http_options(s, &options, hls);
 snprintf(temp_filename, sizeof(temp_filename), use_temp_file ? "%s.tmp" : 
"%s", vs->m3u8_name);
-if ((ret = hlsenc_io_open(s, byterange_mode ? &hls->m3u8_out : &oc->pb, 
temp_filename, &options)) < 0) {
+if ((ret = hlsenc_io_open(s, (byterange_mode || hls->segment_type == 
SEGMENT_TYPE_FMP4) ? &hls->m3u8_out : &oc->pb, temp_filename, &options)) < 0) {
 if (hls->ignore_io_errors)
 ret = 0;
 goto fail;
@@ -1479,33 +1483,33 @@ static int hls_window(AVFormatContext *s, int last, 
VariantStream *vs)
 }
 
 vs->discontinuity_set = 0;
-ff_hls_write_playlist_header(byterange_mode ? hls->m3u8_out : oc->pb, 
hls->version, hls->allowcache,
+ff_hls_write_playlist_header((byterange_mode || hls->segment_type == 
SEGMENT_TYPE_FMP4) ? hls->m3u8_out : oc->pb, hls->version, hls->allowcache,
  target_duration, sequence, hls->pl_type, 
hls->flags & HLS_I_FRAMES_ONLY);
 
 if((hls->flags & HLS_DISCONT_START) && sequence==hls->start_sequence && 
vs->discontinuity_set==0 ){
-avio_printf(byterange_mode ? hls->m3u8_out : oc->pb, 
"#EXT-X-DISCONTINUITY\n");
+avio_printf((byterange_mode || hls->segment_type == SEGMENT_TYPE_FMP4) 
? hls->m3u8_out : oc->pb, "#EXT-X-DISCONTINUITY\n");
 vs->discontinuity_set = 1;
 }
 if (vs->has_video && (hls->flags & HLS_INDEPENDENT_SEGMENTS)) {
-avio_printf(byterange_mode ? hls->m3u8_out : oc->pb, 
"#EXT-X-INDEPENDENT-SEGMENTS\n");
+avio_printf((byterange_mode || hls->segment_type == SEGMENT_TYPE_FMP4) 
? hls->m3u8_out : oc->pb, "#EXT-X-INDEPENDENT-SEGMENTS\n");
 }
 for (en = vs->segments; en; en = en->next) {
 if ((hls->encrypt || hls->key_info_file) && (!key_uri || 
strcmp(en->key_uri, key_uri) ||
 av_strcasecmp(en->iv_string, iv_string))) {
-avio_printf(byterange_mode ? hls->m3u8_out : oc->pb, 
"#EXT-X-KEY:METHOD=AES-128,URI=\"%s\"", en->key_uri);
+avio_printf((byterange_mode || hls->segment_type == 
SEGMENT_TYPE_FMP4) ? hls->m3u8_out : oc->pb, 
"#EXT-X-KEY:METHOD=AES-128,URI=\"%s\"", en->key_uri);
 if (*en->iv_string)
-avio_printf(byterange_mode ? hls->m3u8_out : oc->pb, 
",IV=0x%s", en->iv_string);
-avio_printf(byterange_mode ? hls->m3u8_out : oc->pb, "\n");
+avio_printf((byterange_mode || hls->segment_type == 
SEGMENT_TYPE_FMP4) ? hls->m3u8_out : oc->pb, ",IV=0x%s", en->iv_string);
+avio_printf((byterange_mode || hls->segment_type == 
SEGMENT_TYPE_FMP4) ? hls->m3u8_out : oc->pb, "\n");
 key_uri = en->key_uri;
 iv_string = en->iv_string;
 }
 
 if ((hls->segment_type == SEGMENT_TYPE_FMP4) && (en == vs->segments)) {
-ff_hls_write_init_file(byterange_mode ? hls->m3u8_out : oc->pb, 
(hls->flags & HLS_SINGLE_FILE) ? en->filename : vs->fmp4_init_filename,
+ff_hls_write_init_file((byterange_mode || hls->segment_type == 
SEGMENT_TYPE_FMP4) ? hls->m3u8_out : oc->pb, (hls->flags & HLS_SINGLE_FILE) ? 
en->filename : vs->fmp4_init_filename,
hls->flags & HLS_SINGLE_FILE, 
vs->init_range_length, 0);
 }
 
-ret = ff_hls_write_file_entry(byterange_mode ? hls->m3u8_out : oc->pb, 
en->discont, byterange_mode,
+ret = ff_hls_write_file_entry((byterange_mode || hls->segment_type == 
SEGMENT_TYPE_FMP4) ? hls->m3u8_out : oc->pb, en->discont, byterange_mode,
   en->duration, hls->flags & 
HLS_ROUND_DURATIONS,
   en->size, en->pos, vs->baseurl,
   en->filename, prog_date_time_p, 
en->keyframe_size, en->keyframe_pos, hls->flags & HLS_I_FRAMES_ONLY);
@@ -1515,7 +1519,7 @@ static int hls_window(AVFormatContext *s, int last, 
VariantStream *vs)
 }
 
 if (last

Re: [FFmpeg-devel] [PATCH] libavfilter: add photosensitivity filter

2019-07-13 Thread Paul B Mahol
On 7/13/19, Michael Niedermayer  wrote:
> On Sat, Jul 13, 2019 at 09:32:38AM +0200, Paul B Mahol wrote:
>> On 7/13/19, Michael Niedermayer  wrote:
>> > On Fri, Jul 12, 2019 at 11:26:34AM +0200, Paul B Mahol wrote:
>> >> From: Vladimir Panteleev 
>> >>
>> >> Signed-off-by: Paul B Mahol 
>> >> ---
>> >>  doc/filters.texi  |  20 ++
>> >>  libavfilter/Makefile  |   1 +
>> >>  libavfilter/allfilters.c  |   1 +
>> >>  libavfilter/vf_photosensitivity.c | 336
>> >> ++
>> >>  4 files changed, 358 insertions(+)
>> >>  create mode 100644 libavfilter/vf_photosensitivity.c
>> >
>> > I support this filter or some variant of it to be applied
>> >
>> > some area of work is that it seems to work less well at higher
>> > framerates
>> > for example:
>> > -vf  fps=120,photosensitivity Denno.ogg
>> > or 240fps
>> >
>>
>> Please refrain from commenting for stuff you know very little or nothing.
>> Thanks.
>>
>> Your comments are not valuable at all.
>
> i normally just ignore your insults but here i think i should not
>
> if the same video at 120fps fails to be filtered as well as it is at 30fps
> there is a problem. Because again its the same data, its not played faster
> it just internally has more frames.
> A viewer seeing a frame for 33ms cannot know if thats 1 frame at 30fps
> or 4 times the same frame at 120fps.
> So if one is filtered stronger than the other they cannot both be optimal
>
> About understanding, i looked at the paper referenced by compn, and the
> code
> of the filter. That is not much indeed, but i doubt the other people here
> have
> better knowledge about the subject. If some expert is around here who knows
> this stuff. His/her oppinion and input would no doubt be very valuable

I'm expert to this very subject.

I'm stating that filter is good at reducing/removing abrupt changes in
color/brightness for typical videos.

On another hand, you are pointing to irrelevant corner cases.
Besides user can increase number of frames used in calculation of changes.

What I will not ever tolerate is your belittling other peoples work.
___
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 3/4] tools/target_dec_fuzzer: Remove redundant av_free()

2019-07-13 Thread Michael Niedermayer
On Thu, Jul 11, 2019 at 11:49:39PM +0200, Michael Niedermayer wrote:
> Signed-off-by: Michael Niedermayer 
> ---
>  tools/target_dec_fuzzer.c | 2 --
>  1 file changed, 2 deletions(-)

will apply

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

What does censorship reveal? It reveals fear. -- Julian Assange


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] libavfilter: add photosensitivity filter

2019-07-13 Thread Michael Niedermayer
On Sat, Jul 13, 2019 at 09:32:38AM +0200, Paul B Mahol wrote:
> On 7/13/19, Michael Niedermayer  wrote:
> > On Fri, Jul 12, 2019 at 11:26:34AM +0200, Paul B Mahol wrote:
> >> From: Vladimir Panteleev 
> >>
> >> Signed-off-by: Paul B Mahol 
> >> ---
> >>  doc/filters.texi  |  20 ++
> >>  libavfilter/Makefile  |   1 +
> >>  libavfilter/allfilters.c  |   1 +
> >>  libavfilter/vf_photosensitivity.c | 336 ++
> >>  4 files changed, 358 insertions(+)
> >>  create mode 100644 libavfilter/vf_photosensitivity.c
> >
> > I support this filter or some variant of it to be applied
> >
> > some area of work is that it seems to work less well at higher
> > framerates
> > for example:
> > -vf  fps=120,photosensitivity Denno.ogg
> > or 240fps
> >
> 
> Please refrain from commenting for stuff you know very little or nothing.
> Thanks.
> 
> Your comments are not valuable at all.

i normally just ignore your insults but here i think i should not

if the same video at 120fps fails to be filtered as well as it is at 30fps
there is a problem. Because again its the same data, its not played faster
it just internally has more frames.
A viewer seeing a frame for 33ms cannot know if thats 1 frame at 30fps
or 4 times the same frame at 120fps. 
So if one is filtered stronger than the other they cannot both be optimal

About understanding, i looked at the paper referenced by compn, and the code
of the filter. That is not much indeed, but i doubt the other people here have
better knowledge about the subject. If some expert is around here who knows
this stuff. His/her oppinion and input would no doubt be very valuable

Thanks

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

The bravest are surely those who have the clearest vision
of what is before them, glory and danger alike, and yet
notwithstanding go out to meet it. -- Thucydides


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".

[FFmpeg-devel] [PATCH V1] lavf/hlsenc: fix hls muxer time drifts from the actual clock time

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

fix hls muxer time drifts from the actual clock time, based on
Pavel Pilar's fix.

fix: Ticket7986

Signed-off-by: Pavel Pilar 
Signed-off-by: Jun Zhao 
---
 libavformat/hlsenc.c |9 -
 1 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index 4abc728..110d114 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -42,6 +42,7 @@
 #include "libavutil/opt.h"
 #include "libavutil/log.h"
 #include "libavutil/time_internal.h"
+#include "libavutil/time.h"
 
 #include "avformat.h"
 #include "avio_internal.h"
@@ -2741,11 +2742,9 @@ static int hls_init(AVFormatContext *s)
"Disabling 'independent_segments' flag\n");
 }
 
-if (hls->flags & HLS_PROGRAM_DATE_TIME) {
-time_t now0;
-time(&now0);
-vs->initial_prog_date_time = now0;
-}
+if (hls->flags & HLS_PROGRAM_DATE_TIME)
+vs->initial_prog_date_time = av_gettime() * 0.01; // 
microseconds to seconds
+
 if (hls->format_options_str) {
 ret = av_dict_parse_string(&hls->format_options, 
hls->format_options_str, "=", ":", 0);
 if (ret < 0) {
-- 
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] libavfilter: add photosensitivity filter

2019-07-13 Thread Paul B Mahol
On 7/13/19, Michael Niedermayer  wrote:
> On Fri, Jul 12, 2019 at 11:26:34AM +0200, Paul B Mahol wrote:
>> From: Vladimir Panteleev 
>>
>> Signed-off-by: Paul B Mahol 
>> ---
>>  doc/filters.texi  |  20 ++
>>  libavfilter/Makefile  |   1 +
>>  libavfilter/allfilters.c  |   1 +
>>  libavfilter/vf_photosensitivity.c | 336 ++
>>  4 files changed, 358 insertions(+)
>>  create mode 100644 libavfilter/vf_photosensitivity.c
>
> I support this filter or some variant of it to be applied
>
> some area of work is that it seems to work less well at higher
> framerates
> for example:
> -vf  fps=120,photosensitivity Denno.ogg
> or 240fps
>

Please refrain from commenting for stuff you know very little or nothing.
Thanks.

Your comments are not valuable at all.
___
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".