[FFmpeg-devel] [PATCH] lavc/audiotoolboxenc: fix noise in encoded audio

2018-01-01 Thread zhangjiejun1992
From: Jiejun Zhang 

This fixes #6940
---
 libavcodec/audiotoolboxenc.c | 20 +++-
 1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/libavcodec/audiotoolboxenc.c b/libavcodec/audiotoolboxenc.c
index 71885d1530..b70375a692 100644
--- a/libavcodec/audiotoolboxenc.c
+++ b/libavcodec/audiotoolboxenc.c
@@ -48,6 +48,9 @@ typedef struct ATDecodeContext {
 AudioFrameQueue afq;
 int eof;
 int frame_size;
+
+uint8_t* audio_data_buf;
+uint32_t audio_data_buf_size;
 } ATDecodeContext;
 
 static UInt32 ffat_get_format_id(enum AVCodecID codec, int profile)
@@ -442,6 +445,9 @@ static av_cold int ffat_init_encoder(AVCodecContext *avctx)
 
 ff_af_queue_init(avctx, >afq);
 
+at->audio_data_buf_size = 0;
+at->audio_data_buf = NULL;
+
 return 0;
 }
 
@@ -471,7 +477,15 @@ static OSStatus ffat_encode_callback(AudioConverterRef 
converter, UInt32 *nb_pac
 data->mBuffers[0].mDataByteSize   = frame->nb_samples *
 
av_get_bytes_per_sample(avctx->sample_fmt) *
 avctx->channels;
-data->mBuffers[0].mData   = frame->data[0];
+if (at->audio_data_buf_size < data->mBuffers[0].mDataByteSize) {
+av_log(avctx, AV_LOG_INFO, "Increasing audio data buffer size to %u",
+   data->mBuffers[0].mDataByteSize);
+av_free(at->audio_data_buf);
+at->audio_data_buf_size = data->mBuffers[0].mDataByteSize;
+at->audio_data_buf = av_malloc(at->audio_data_buf_size);
+}
+memcpy(at->audio_data_buf, frame->data[0], 
data->mBuffers[0].mDataByteSize);
+data->mBuffers[0].mData   = at->audio_data_buf;
 if (*nb_packets > frame->nb_samples)
 *nb_packets = frame->nb_samples;
 
@@ -565,6 +579,10 @@ static av_cold int ffat_close_encoder(AVCodecContext 
*avctx)
 ff_bufqueue_discard_all(>frame_queue);
 ff_bufqueue_discard_all(>used_frame_queue);
 ff_af_queue_close(>afq);
+if (at->audio_data_buf_size > 0) {
+at->audio_data_buf_size = 0;
+av_free(at->audio_data_buf);
+}
 return 0;
 }
 
-- 
2.14.3 (Apple Git-98)

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


[FFmpeg-devel] [PATCH 2/2] avformat/dashenc: Signal http end of chunk(http_shutdown) explicitly

2018-01-01 Thread Karthick J
From: Karthick Jeyapal 

Currently http end of chunk is signalled implicitly in dashenc_io_open().
This mean playlists http writes would have to wait upto a segment duration to 
signal end of chunk causing delays.
This patch will fix that problem and improve performance.
---
 libavformat/dashenc.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c
index c4c112b..c328db2 100644
--- a/libavformat/dashenc.c
+++ b/libavformat/dashenc.c
@@ -149,7 +149,10 @@ static void dashenc_io_close(AVFormatContext *s, 
AVIOContext **pb, char *filenam
 ff_format_io_close(s, pb);
 #if CONFIG_HTTP_PROTOCOL
 } else {
+URLContext *http_url_context = ffio_geturlcontext(*pb);
+av_assert0(http_url_context);
 avio_flush(*pb);
+ffurl_shutdown(http_url_context, AVIO_FLAG_WRITE);
 #endif
 }
 }
-- 
1.9.1

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


[FFmpeg-devel] [PATCH 1/2] avformat/dashenc: Fix a resource leak when http persistent in enabled

2018-01-01 Thread Karthick J
From: Karthick Jeyapal 

---
 libavformat/dashenc.c | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c
index 3345b89..c4c112b 100644
--- a/libavformat/dashenc.c
+++ b/libavformat/dashenc.c
@@ -1,6 +1,7 @@
 /*
  * MPEG-DASH ISO BMFF segmenter
  * Copyright (c) 2014 Martin Storsjo
+ * Copyright (c) 2018 Akamai Technologies, Inc.
  *
  * This file is part of FFmpeg.
  *
@@ -1317,6 +1318,16 @@ static int dash_write_trailer(AVFormatContext *s)
 }
 dash_flush(s, 1, -1);
 
+if (c->http_persistent) {
+int i;
+for (i = 0; i < s->nb_streams; i++) {
+OutputStream *os = >streams[i];
+ff_format_io_close(s, >out);
+}
+ff_format_io_close(s, >mpd_out);
+ff_format_io_close(s, >m3u8_out);
+}
+
 if (c->remove_at_exit) {
 char filename[1024];
 int i;
-- 
1.9.1

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


[FFmpeg-devel] [PATCH] doc/codecs: Add missing documentation for hwaccel_flags.

2018-01-01 Thread Jun Zhao

From e030510864c28d4b17c8d1eb09ab00f274bf5dcc Mon Sep 17 00:00:00 2001
From: Jun Zhao 
Date: Tue, 2 Jan 2018 13:55:29 +0800
Subject: [PATCH] doc/codecs: Add missing documentation for hwaccel_flags.

document the hwaccel_flags option for decoding.

Signed-off-by: Jun Zhao 
---
 doc/codecs.texi | 27 +++
 1 file changed, 27 insertions(+)

diff --git a/doc/codecs.texi b/doc/codecs.texi
index 7e20374334..190f03b293 100644
--- a/doc/codecs.texi
+++ b/doc/codecs.texi
@@ -1254,6 +1254,33 @@ ffprobe -dump_separator "
 Maximum number of pixels per image. This value can be used to avoid out of
 memory failures due to large images.
 
+@item hwaccel_flags @var{flags} (@emph{decoding,video})
+Set hardware accelerated decoding flags. (if active)
+
+Possible values:
+@table @samp
+@item ignore_level
+Ignore level, should be used for decoding even if the codec level used is 
unknown
+or higher than the maximum supported level reported by the hardware driver.
+
+It's generally a good idea to pass this flag unless you have a specific
+reason not to, as hardware tends to under-report supported levels.
+@item allow_high_depth
+Allow to output YUV pixel formats with a different chroma sampling than 4:2:0
+and/or other than 8 bits per component
+@item allow_profile_mismatch
+Attempt to decode anyway if hardware accelerated decoder's supported profiles 
do not
+exactly match the stream.
+
+For example, this can be used to try to decode baseline profile H.264
+streams in hardware - it will often succeed, because many streams marked
+as baseline profile actually conform to constrained baseline profile.
+
+Warning: If the stream is actually not supported then the behaviour is
+undefined, and may include returning entirely incorrect output
+while indicating success.
+@end table
+
 @item apply_cropping @var{bool} (@emph{decoding,video})
 Enable cropping if cropping parameters are multiples of the required
 alignment for the left and top parameters. If the alignment is not met the
-- 
2.14.1

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


Re: [FFmpeg-devel] [PATCH v3 3/3] avformat/hlsenc: creation of variant streams in subdirectories

2018-01-01 Thread Vishwanath Dixit



On 1/2/18 8:34 AM, Steven Liu wrote:

2017-12-29 18:20 GMT+08:00 Steven Liu :

2017-12-26 19:17 GMT+08:00  :

From: Vishwanath Dixit 

---
  doc/muxers.texi  | 33 -
  libavformat/hlsenc.c | 68 +---
  2 files changed, 92 insertions(+), 9 deletions(-)

diff --git a/doc/muxers.texi b/doc/muxers.texi
index 6af970d..2951262 100644
--- a/doc/muxers.texi
+++ b/doc/muxers.texi
@@ -587,6 +587,20 @@ This example will produce the playlists segment file sets:
  @file{file_0_000.ts}, @file{file_0_001.ts}, @file{file_0_002.ts}, etc. and
  @file{file_1_000.ts}, @file{file_1_001.ts}, @file{file_1_002.ts}, etc.

+The string "%v" may be present in the filename or in the last directory name
+containing the file. If the string is present in the directory name, then
+sub-directories are created after expanding the directory name pattern. This
+enables creation of segments corresponding to different variant streams in
+subdirectories.
+@example
+ffmpeg -i in.ts -b:v:0 1000k -b:v:1 256k -b:a:0 64k -b:a:1 32k \
+  -map 0:v -map 0:a -map 0:v -map 0:a -f hls -var_stream_map "v:0,a:0 v:1,a:1" 
\
+  -hls_segment_filename 'vs%v/file_%03d.ts' vs%v/out.m3u8
+@end example
+This example will produce the playlists segment file sets:
+@file{vs0/file_000.ts}, @file{vs0/file_001.ts}, @file{vs0/file_002.ts}, etc. 
and
+@file{vs1/file_000.ts}, @file{vs1/file_001.ts}, @file{vs1/file_002.ts}, etc.
+
  @item use_localtime
  Use strftime() on @var{filename} to expand the segment filename with 
localtime.
  The segment number is also available in this mode, but to use it, you need to 
specify second_level_segment_index
@@ -715,6 +729,11 @@ set filename to the fragment files header file, default 
filename is @file{init.m
  When @code{var_stream_map} is set with two or more variant streams, the
  @var{filename} pattern must contain the string "%v", this string specifies
  the position of variant stream index in the generated init file names.
+The string "%v" may be present in the filename or in the last directory name
+containing the file. If the string is present in the directory name, then
+sub-directories are created after expanding the directory name pattern. This
+enables creation of init files corresponding to different variant streams in
+subdirectories.

  @item hls_flags @var{flags}
  Possible values:
@@ -831,7 +850,11 @@ Allowed values are 0 to 9 (limited just based on practical 
usage).

  When there are two or more variant streams, the output filename pattern must
  contain the string "%v", this string specifies the position of variant stream
-index in the output media playlist filenames.
+index in the output media playlist filenames. The string "%v" may be present in
+the filename or in the last directory name containing the file. If the string 
is
+present in the directory name, then sub-directories are created after expanding
+the directory name pattern. This enables creation of variant streams in
+subdirectories.

  @example
  ffmpeg -re -i in.ts -b:v:0 1000k -b:v:1 256k -b:a:0 64k -b:a:1 32k \
@@ -854,6 +877,14 @@ be an audio only stream with bitrate 64k and the third 
variant stream will be a
  video only stream with bitrate 256k. Here, three media playlist with file 
names
  out_0.m3u8, out_1.m3u8 and out_2.m3u8 will be created.
  @example
+ffmpeg -re -i in.ts -b:v:0 1000k -b:v:1 256k -b:a:0 64k -b:a:1 32k \
+  -map 0:v -map 0:a -map 0:v -map 0:a -f hls -var_stream_map "v:0,a:0 v:1,a:1" 
\
+  http://example.com/live/vs_%v/out.m3u8
+@end example
+This example creates the variant streams in subdirectories. Here, the first
+media playlist is created at @file{http://example.com/live/vs_0/out.m3u8} and
+the second one at @file{http://example.com/live/vs_1/out.m3u8}.
+@example
  ffmpeg -re -i in.ts -b:a:0 32k -b:a:1 64k -b:v:0 1000k -b:v:1 3000k  \
-map 0:a -map 0:a -map 0:v -map 0:v -f hls \
-var_stream_map "a:0,agroup:aud_low a:1,agroup:aud_high v:0,agroup:aud_low 
v:1,agroup:aud_high" \
diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index 198c9d3..b25bfc9 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -1557,7 +1557,8 @@ static int append_postfix(char *name, int name_buf_len, 
int i)

  static int validate_name(int nb_vs, const char *fn)
  {
-const char *filename;
+const char *filename, *subdir_name;
+char *fn_dup = NULL;
  int ret = 0;

  if (!fn) {
@@ -1565,22 +1566,38 @@ static int validate_name(int nb_vs, const char *fn)
  goto fail;
  }

+fn_dup = av_strdup(fn);
+if (!fn_dup) {
+ret = AVERROR(ENOMEM);
+goto fail;
+}
+
  filename = av_basename(fn);
+subdir_name = av_dirname(fn_dup);

-if (nb_vs > 1 && !av_stristr(filename, "%v")) {
+if (nb_vs > 1 && !av_stristr(filename, "%v") && !av_stristr(subdir_name, 
"%v")) {
  av_log(NULL, AV_LOG_ERROR, "More than 1 variant streams are 

Re: [FFmpeg-devel] [FFmpeg-cvslog] w32pthreads: always use Vista+ API, drop XP support

2018-01-01 Thread Michael Niedermayer
On Tue, Jan 02, 2018 at 03:58:14AM +0100, Michael Niedermayer wrote:
> On Tue, Jan 02, 2018 at 03:55:18AM +0100, Michael Niedermayer wrote:
> > On Tue, Dec 26, 2017 at 01:50:08AM +, wm4 wrote:
> > > ffmpeg | branch: master | wm4  | Thu Dec 21 
> > > 20:23:14 2017 +0100| [9b121dfc32810250938021952aab4172a988cb56] | 
> > > committer: wm4
> > > 
> > > w32pthreads: always use Vista+ API, drop XP support
> > > 
> > > This removes the XP compatibility code, and switches entirely to SWR
> > > locks, which are available starting at Windows Vista.
> > > 
> > > This removes CRITICAL_SECTION use, which allows us to add
> > > PTHREAD_MUTEX_INITIALIZER, which will be useful later.
> > > 
> > > Windows XP is hereby not a supported build target anymore. It was
> > > decided in a project vote that this is OK.
> > > 
> > > > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=9b121dfc32810250938021952aab4172a988cb56
> > > ---
> > > 
> > >  Changelog  |   2 +
> > >  compat/w32pthreads.h   | 266 
> > > ++---
> > >  configure  |  13 ++-
> > >  libavcodec/pthread_frame.c |   4 -
> > >  libavcodec/pthread_slice.c |   4 -
> > >  libavfilter/pthread.c  |   4 -
> > >  libavutil/slicethread.c|   4 -
> > >  7 files changed, 19 insertions(+), 278 deletions(-)
> > 
> > This breaks mingw32 / wine support on ubuntu 14.04
> > the code simply crashes at runtime
> 
> Heres what wine provides as debug info:
> 
> Unhandled exception: unimplemented function 
> KERNEL32.dll.InitializeConditionVariable called in 32-bit code (0x7bc4e590).

and thats mingw64:
Unhandled exception: unimplemented function 
KERNEL32.dll.InitializeConditionVariable called in 64-bit code 
(0x2ae6eb445e38).
Register dump:
 rip:2ae6eb445e38 rsp:0032e150 rbp:00099840 eflags:0206 
(   - --  I   - -P- )
 rax:2ae6eb445df0 rbx:0032e170 rcx:0032e170 
rdx:000140c31e80
 rsi:00014199182c rdi:000141992788  r8:000f  
r9: r10:2ae6eb6dfd6f
 r11:2ae6eb1ae510 r12: r13:000b4580 
r14:7b8883b0 r15:0033
Stack dump:
0x0032e150:  0032e170 7b888429
0x0032e160:  416e6f6974706972 4474654770616300
0x0032e170:  00018100 
0x0032e180:  2ae6eb445e38 0002
0x0032e190:  000141992788 00014199182c
0x0032e1a0:   
0x0032e1b0:   
0x0032e1c0:   
0x0032e1d0:   
0x0032e1e0:   
0x0032e1f0:   
0x0032e200:  000b44c0 000b44c0
Backtrace:
=>0 0x2ae6eb445e38 in ntdll (+0x35e38) (0x00099840)
  1 0x000140c31e80 in ffmpeg (+0xc31e7f) (0x00099840)
  2 0x00014003e6dd in ffmpeg (+0x3e6dc) (0x00099840)
  3 0x0001400364ba in ffmpeg (+0x364b9) (0x00099840)
  4 0x00014002f8b3 in ffmpeg (+0x2f8b2) (0x00099840)
  5 0x000140030355 in ffmpeg (+0x30354) (0x0032e4b0)
  6 0x00014000d478 in ffmpeg (+0xd477) (0x0001)

[...]
-- 
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
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH v3 3/3] avformat/hlsenc: creation of variant streams in subdirectories

2018-01-01 Thread Steven Liu
2017-12-29 18:20 GMT+08:00 Steven Liu :
> 2017-12-26 19:17 GMT+08:00  :
>> From: Vishwanath Dixit 
>>
>> ---
>>  doc/muxers.texi  | 33 -
>>  libavformat/hlsenc.c | 68 
>> +---
>>  2 files changed, 92 insertions(+), 9 deletions(-)
>>
>> diff --git a/doc/muxers.texi b/doc/muxers.texi
>> index 6af970d..2951262 100644
>> --- a/doc/muxers.texi
>> +++ b/doc/muxers.texi
>> @@ -587,6 +587,20 @@ This example will produce the playlists segment file 
>> sets:
>>  @file{file_0_000.ts}, @file{file_0_001.ts}, @file{file_0_002.ts}, etc. and
>>  @file{file_1_000.ts}, @file{file_1_001.ts}, @file{file_1_002.ts}, etc.
>>
>> +The string "%v" may be present in the filename or in the last directory name
>> +containing the file. If the string is present in the directory name, then
>> +sub-directories are created after expanding the directory name pattern. This
>> +enables creation of segments corresponding to different variant streams in
>> +subdirectories.
>> +@example
>> +ffmpeg -i in.ts -b:v:0 1000k -b:v:1 256k -b:a:0 64k -b:a:1 32k \
>> +  -map 0:v -map 0:a -map 0:v -map 0:a -f hls -var_stream_map "v:0,a:0 
>> v:1,a:1" \
>> +  -hls_segment_filename 'vs%v/file_%03d.ts' vs%v/out.m3u8
>> +@end example
>> +This example will produce the playlists segment file sets:
>> +@file{vs0/file_000.ts}, @file{vs0/file_001.ts}, @file{vs0/file_002.ts}, 
>> etc. and
>> +@file{vs1/file_000.ts}, @file{vs1/file_001.ts}, @file{vs1/file_002.ts}, etc.
>> +
>>  @item use_localtime
>>  Use strftime() on @var{filename} to expand the segment filename with 
>> localtime.
>>  The segment number is also available in this mode, but to use it, you need 
>> to specify second_level_segment_index
>> @@ -715,6 +729,11 @@ set filename to the fragment files header file, default 
>> filename is @file{init.m
>>  When @code{var_stream_map} is set with two or more variant streams, the
>>  @var{filename} pattern must contain the string "%v", this string specifies
>>  the position of variant stream index in the generated init file names.
>> +The string "%v" may be present in the filename or in the last directory name
>> +containing the file. If the string is present in the directory name, then
>> +sub-directories are created after expanding the directory name pattern. This
>> +enables creation of init files corresponding to different variant streams in
>> +subdirectories.
>>
>>  @item hls_flags @var{flags}
>>  Possible values:
>> @@ -831,7 +850,11 @@ Allowed values are 0 to 9 (limited just based on 
>> practical usage).
>>
>>  When there are two or more variant streams, the output filename pattern must
>>  contain the string "%v", this string specifies the position of variant 
>> stream
>> -index in the output media playlist filenames.
>> +index in the output media playlist filenames. The string "%v" may be 
>> present in
>> +the filename or in the last directory name containing the file. If the 
>> string is
>> +present in the directory name, then sub-directories are created after 
>> expanding
>> +the directory name pattern. This enables creation of variant streams in
>> +subdirectories.
>>
>>  @example
>>  ffmpeg -re -i in.ts -b:v:0 1000k -b:v:1 256k -b:a:0 64k -b:a:1 32k \
>> @@ -854,6 +877,14 @@ be an audio only stream with bitrate 64k and the third 
>> variant stream will be a
>>  video only stream with bitrate 256k. Here, three media playlist with file 
>> names
>>  out_0.m3u8, out_1.m3u8 and out_2.m3u8 will be created.
>>  @example
>> +ffmpeg -re -i in.ts -b:v:0 1000k -b:v:1 256k -b:a:0 64k -b:a:1 32k \
>> +  -map 0:v -map 0:a -map 0:v -map 0:a -f hls -var_stream_map "v:0,a:0 
>> v:1,a:1" \
>> +  http://example.com/live/vs_%v/out.m3u8
>> +@end example
>> +This example creates the variant streams in subdirectories. Here, the first
>> +media playlist is created at @file{http://example.com/live/vs_0/out.m3u8} 
>> and
>> +the second one at @file{http://example.com/live/vs_1/out.m3u8}.
>> +@example
>>  ffmpeg -re -i in.ts -b:a:0 32k -b:a:1 64k -b:v:0 1000k -b:v:1 3000k  \
>>-map 0:a -map 0:a -map 0:v -map 0:v -f hls \
>>-var_stream_map "a:0,agroup:aud_low a:1,agroup:aud_high 
>> v:0,agroup:aud_low v:1,agroup:aud_high" \
>> diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
>> index 198c9d3..b25bfc9 100644
>> --- a/libavformat/hlsenc.c
>> +++ b/libavformat/hlsenc.c
>> @@ -1557,7 +1557,8 @@ static int append_postfix(char *name, int 
>> name_buf_len, int i)
>>
>>  static int validate_name(int nb_vs, const char *fn)
>>  {
>> -const char *filename;
>> +const char *filename, *subdir_name;
>> +char *fn_dup = NULL;
>>  int ret = 0;
>>
>>  if (!fn) {
>> @@ -1565,22 +1566,38 @@ static int validate_name(int nb_vs, const char *fn)
>>  goto fail;
>>  }
>>
>> +fn_dup = av_strdup(fn);
>> +if (!fn_dup) {
>> +ret = AVERROR(ENOMEM);
>> +goto fail;
>> +}
>> +
>>  filename 

Re: [FFmpeg-devel] [FFmpeg-cvslog] w32pthreads: always use Vista+ API, drop XP support

2018-01-01 Thread James Almer
On 1/1/2018 11:58 PM, Michael Niedermayer wrote:
> On Tue, Jan 02, 2018 at 03:55:18AM +0100, Michael Niedermayer wrote:
>> On Tue, Dec 26, 2017 at 01:50:08AM +, wm4 wrote:
>>> ffmpeg | branch: master | wm4  | Thu Dec 21 20:23:14 
>>> 2017 +0100| [9b121dfc32810250938021952aab4172a988cb56] | committer: wm4
>>>
>>> w32pthreads: always use Vista+ API, drop XP support
>>>
>>> This removes the XP compatibility code, and switches entirely to SWR
>>> locks, which are available starting at Windows Vista.
>>>
>>> This removes CRITICAL_SECTION use, which allows us to add
>>> PTHREAD_MUTEX_INITIALIZER, which will be useful later.
>>>
>>> Windows XP is hereby not a supported build target anymore. It was
>>> decided in a project vote that this is OK.
>>>
 http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=9b121dfc32810250938021952aab4172a988cb56
>>> ---
>>>
>>>  Changelog  |   2 +
>>>  compat/w32pthreads.h   | 266 
>>> ++---
>>>  configure  |  13 ++-
>>>  libavcodec/pthread_frame.c |   4 -
>>>  libavcodec/pthread_slice.c |   4 -
>>>  libavfilter/pthread.c  |   4 -
>>>  libavutil/slicethread.c|   4 -
>>>  7 files changed, 19 insertions(+), 278 deletions(-)
>>
>> This breaks mingw32 / wine support on ubuntu 14.04
>> the code simply crashes at runtime
> 
> Heres what wine provides as debug info:
> 
> Unhandled exception: unimplemented function 
> KERNEL32.dll.InitializeConditionVariable called in 32-bit code (0x7bc4e590).

Guess this means Wine doesn't support Vista+ API? At least not the one
in Ubuntu 14.04.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [FFmpeg-cvslog] w32pthreads: always use Vista+ API, drop XP support

2018-01-01 Thread Michael Niedermayer
On Tue, Jan 02, 2018 at 03:55:18AM +0100, Michael Niedermayer wrote:
> On Tue, Dec 26, 2017 at 01:50:08AM +, wm4 wrote:
> > ffmpeg | branch: master | wm4  | Thu Dec 21 20:23:14 
> > 2017 +0100| [9b121dfc32810250938021952aab4172a988cb56] | committer: wm4
> > 
> > w32pthreads: always use Vista+ API, drop XP support
> > 
> > This removes the XP compatibility code, and switches entirely to SWR
> > locks, which are available starting at Windows Vista.
> > 
> > This removes CRITICAL_SECTION use, which allows us to add
> > PTHREAD_MUTEX_INITIALIZER, which will be useful later.
> > 
> > Windows XP is hereby not a supported build target anymore. It was
> > decided in a project vote that this is OK.
> > 
> > > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=9b121dfc32810250938021952aab4172a988cb56
> > ---
> > 
> >  Changelog  |   2 +
> >  compat/w32pthreads.h   | 266 
> > ++---
> >  configure  |  13 ++-
> >  libavcodec/pthread_frame.c |   4 -
> >  libavcodec/pthread_slice.c |   4 -
> >  libavfilter/pthread.c  |   4 -
> >  libavutil/slicethread.c|   4 -
> >  7 files changed, 19 insertions(+), 278 deletions(-)
> 
> This breaks mingw32 / wine support on ubuntu 14.04
> the code simply crashes at runtime

Heres what wine provides as debug info:

Unhandled exception: unimplemented function 
KERNEL32.dll.InitializeConditionVariable called in 32-bit code (0x7bc4e590).
Register dump:
 CS:0023 SS:002b DS:002b ES:002b FS:0063 GS:006b
 EIP:7bc4e590 ESP:06f1e598 EBP:06f1e5fc EFLAGS:0206(   - --  I   - -P- )
 EAX:01c9be44 EBX:7bcbf000 ECX: EDX:7bcda388
 ESI:06f1e5a4 EDI:0019b2c0
Stack dump:
0x06f1e598:  06f1e5d8 f75abfbc  8100
0x06f1e5a8:  0001  7bc4e590 0002
0x06f1e5b8:  01c9cd04 01c9be44 0019b340 
0x06f1e5c8:  f75abf7b 7b8b5000 004422b0 0019b2c0
0x06f1e5d8:  06f1e608 7b8788ff  7ba5a648
0x06f1e5e8:  7b893f6b 7b8878ac 0019b2d8 0019b240
Backtrace:
=>0 0x7bc4e590 call_dll_entry_point+0x480() in ntdll (0x06f1e5fc)
  1 0x0023000f (0x06f1e658)
  2 0x00442393 in ffmpeg_g (+0x42392) (0x0019b200)
  3 0x0043a148 in ffmpeg_g (+0x3a147) (0x0019b200)
  4 0x004334d0 in ffmpeg_g (+0x334cf) (0x0019b200)
  5 0x00433ed6 in ffmpeg_g (+0x33ed5) (0x0019b080)
  6 0x0040e644 in ffmpeg_g (+0xe643) (0x00191300)
  7 0x00420e15 in ffmpeg_g (+0x20e14) (0x0001)
  8 0x0042121c in ffmpeg_g (+0x2121b) (0x0400)
  9 0x0042490b in ffmpeg_g (+0x2490a) (0x)
  10 0x00426fc7 in ffmpeg_g (+0x26fc6) (0x)
  11 0x0104d5bb in ffmpeg_g (+0xc4d5ba) (0x06f1fd98)
  12 0x004013e0 in ffmpeg_g (+0x13df) (0x06f1fe60)
  13 0x7b85e5cc call_process_entry+0xb() in kernel32 (0x06f1fe78)
  14 0x7b85f653 in kernel32 (+0x4f652) (0x06f1feb8)
  15 0x7bc799b0 call_thread_func_wrapper+0xb() in ntdll (0x06f1fed8)
  16 0x7bc7c93d call_thread_func+0x7c() in ntdll (0x06f1ffa8)
  17 0x7bc7998e RtlRaiseException+0x21() in ntdll (0x06f1ffc8)
  18 0x7bc4e8fe call_dll_entry_point+0x7ed() in ntdll (0x06f1ffe8)
  19 0xf75b050d wine_call_on_stack+0x1c() in libwine.so.1 (0x)
  20 0xf75b05cb wine_switch_to_stack+0x2a() in libwine.so.1 (0xff8dbd58)
  21 0x7bc541e2 LdrInitializeThunk+0x3a1() in ntdll (0xff8dbdb8)
  22 0x7b865bdd __wine_kernel_init+0xa0c() in kernel32 (0xff8dced8)
  23 0x7bc547a3 __wine_process_init+0x192() in ntdll (0xff8dcf68)
  24 0xf75adc70 wine_init+0x30f() in libwine.so.1 (0xff8dcfc8)
  25 0x7bf00fdc main+0xfb() in  (0xff8dd418)
  26 0xf73adaf3 __libc_start_main+0xf2() in libc.so.6 (0x)

  [...]


-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

In fact, the RIAA has been known to suggest that students drop out
of college or go to community college in order to be able to afford
settlements. -- The RIAA


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


Re: [FFmpeg-devel] [FFmpeg-cvslog] w32pthreads: always use Vista+ API, drop XP support

2018-01-01 Thread Michael Niedermayer
On Tue, Dec 26, 2017 at 01:50:08AM +, wm4 wrote:
> ffmpeg | branch: master | wm4  | Thu Dec 21 20:23:14 
> 2017 +0100| [9b121dfc32810250938021952aab4172a988cb56] | committer: wm4
> 
> w32pthreads: always use Vista+ API, drop XP support
> 
> This removes the XP compatibility code, and switches entirely to SWR
> locks, which are available starting at Windows Vista.
> 
> This removes CRITICAL_SECTION use, which allows us to add
> PTHREAD_MUTEX_INITIALIZER, which will be useful later.
> 
> Windows XP is hereby not a supported build target anymore. It was
> decided in a project vote that this is OK.
> 
> > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=9b121dfc32810250938021952aab4172a988cb56
> ---
> 
>  Changelog  |   2 +
>  compat/w32pthreads.h   | 266 
> ++---
>  configure  |  13 ++-
>  libavcodec/pthread_frame.c |   4 -
>  libavcodec/pthread_slice.c |   4 -
>  libavfilter/pthread.c  |   4 -
>  libavutil/slicethread.c|   4 -
>  7 files changed, 19 insertions(+), 278 deletions(-)

This breaks mingw32 / wine support on ubuntu 14.04
the code simply crashes at runtime

[...]
-- 
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
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 3/7] avfilter/vf_framerate: factorize blend_frames

2018-01-01 Thread Michael Niedermayer
On Sun, Dec 10, 2017 at 11:11:18PM +0100, Marton Balint wrote:
> Signed-off-by: Marton Balint 
> ---
>  libavfilter/vf_framerate.c | 54 
> ++
>  1 file changed, 7 insertions(+), 47 deletions(-)

This broke fate-filter-framerate-up on x86-32 (gcc 4.8 (Ubuntu 
4.8.5-2ubuntu1~14.04.1))

--- tests/ref/fate/filter-framerate-up  2017-12-31 19:27:30.039451874 +0100
+++ tests/data/fate/filter-framerate-up 2018-01-02 02:12:56.151674862 +0100
@@ -4,12 +4,12 @@
 #dimensions 0: 320x240
 #sar 0: 1/1
 0,  0,  0,1,   115200, 0x3744b3ed
-0,  1,  1,1,   115200, 0xc44bdc65
-0,  2,  2,1,   115200, 0xa17f0d74
-0,  3,  3,1,   115200, 0xb0c83274
-0,  4,  4,1,   115200, 0x232d6368
+0,  1,  1,1,   115200, 0x3744b3ed
+0,  2,  2,1,   115200, 0x3744b3ed
+0,  3,  3,1,   115200, 0x3744b3ed
+0,  4,  4,1,   115200, 0x6e318ba0
 0,  5,  5,1,   115200, 0x6e318ba0
-0,  6,  6,1,   115200, 0x247e846e
-0,  7,  7,1,   115200, 0x89e27599
-0,  8,  8,1,   115200, 0x31c5704e
-0,  9,  9,1,   115200, 0x97e45fec
+0,  6,  6,1,   115200, 0x6e318ba0
+0,  7,  7,1,   115200, 0x6e318ba0
+0,  8,  8,1,   115200, 0x6e318ba0
+0,  9,  9,1,   115200, 0x48d65876
Test filter-framerate-up failed. Look at 
tests/data/fate/filter-framerate-up.err for details.
make: *** [fate-filter-framerate-up] Error 1

in master the diff now looks like this:
--- tests/ref/fate/filter-framerate-up  2017-12-31 19:27:30.039451874 +0100
+++ tests/data/fate/filter-framerate-up 2018-01-02 02:42:46.103712572 +0100
@@ -4,12 +4,12 @@
 #dimensions 0: 320x240
 #sar 0: 1/1
 0,  0,  0,1,   115200, 0x3744b3ed
-0,  1,  1,1,   115200, 0xc44bdc65
+0,  1,  1,1,   115200, 0x3744b3ed
 0,  2,  2,1,   115200, 0xa17f0d74
 0,  3,  3,1,   115200, 0xb0c83274
 0,  4,  4,1,   115200, 0x232d6368
 0,  5,  5,1,   115200, 0x6e318ba0
-0,  6,  6,1,   115200, 0x247e846e
+0,  6,  6,1,   115200, 0x6e318ba0
 0,  7,  7,1,   115200, 0x89e27599
 0,  8,  8,1,   115200, 0x31c5704e
 0,  9,  9,1,   115200, 0x97e45fec
Test filter-framerate-up failed. Look at 
tests/data/fate/filter-framerate-up.err for details.
make: *** [fate-filter-framerate-up] Error 1


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

Observe your enemies, for they first find out your faults. -- Antisthenes


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


Re: [FFmpeg-devel] [PATCH][RFC]lavu/mem: Allow allocations close to max_alloc_size with av_fast_realloc()

2018-01-01 Thread Carl Eugen Hoyos
2018-01-02 1:14 GMT+01:00 Michael Niedermayer :
> On Mon, Jan 01, 2018 at 11:10:57PM +0100, Carl Eugen Hoyos wrote:
>> Hi!
>>
>> Similar reason as last mem.c patch: av_fast_realloc() can currently
>> fail in situations where the allocation is possible and allowed.
>> The patch does not change behaviour for the failure case, if this is
>> wanted, it should be done separately.
>>
>> Please comment, Carl Eugen
>
>>  mem.c |5 -
>>  1 file changed, 4 insertions(+), 1 deletion(-)
>> 7529e1d584c62ece463f4461279ea6e3973162c9  
>> 0001-lavu-mem-Allow-allocations-close-to-max_alloc_size-w.patch
>> From ac69f4e8402f7c7ee6df09c0450354e2bb900e5a Mon Sep 17 00:00:00 2001
>> From: Carl Eugen Hoyos 
>> Date: Mon, 1 Jan 2018 23:04:58 +0100
>> Subject: [PATCH] lavu/mem: Allow allocations close to max_alloc_size with
>>  av_fast_realloc().
>>
>> ---
>>  libavutil/mem.c |5 -
>>  1 file changed, 4 insertions(+), 1 deletion(-)
>>
>> diff --git a/libavutil/mem.c b/libavutil/mem.c
>> index 0729e1d..934987f 100644
>> --- a/libavutil/mem.c
>> +++ b/libavutil/mem.c
>> @@ -466,7 +466,10 @@ void *av_fast_realloc(void *ptr, unsigned int *size, 
>> size_t min_size)
>>  if (min_size <= *size)
>>  return ptr;
>>
>> -min_size = FFMAX(min_size + min_size / 16 + 32, min_size);
>> +if (min_size > (max_alloc_size - 32))
>> +return NULL;
>
> This failure mode differs from the existing in what it does with *size

New patch attached.

Thank you, Carl Eugen
From 9586fb78e4b304923569a09fb275ece0531726e0 Mon Sep 17 00:00:00 2001
From: Carl Eugen Hoyos 
Date: Tue, 2 Jan 2018 01:58:35 +0100
Subject: [PATCH] lavu/mem: Allow allocations close to max_alloc_size with
 av_fast_realloc().

---
 libavutil/mem.c |7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/libavutil/mem.c b/libavutil/mem.c
index 0729e1d..6149755 100644
--- a/libavutil/mem.c
+++ b/libavutil/mem.c
@@ -466,7 +466,12 @@ void *av_fast_realloc(void *ptr, unsigned int *size, size_t min_size)
 if (min_size <= *size)
 return ptr;
 
-min_size = FFMAX(min_size + min_size / 16 + 32, min_size);
+if (min_size > max_alloc_size - 32) {
+*size = 0;
+return NULL;
+}
+
+min_size = FFMIN(max_alloc_size - 32, FFMAX(min_size + min_size / 16 + 32, min_size));
 
 ptr = av_realloc(ptr, min_size);
 /* we could set this to the unmodified min_size but this is safer
-- 
1.7.10.4

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


Re: [FFmpeg-devel] [PATCH 1/3] lavc/options: Remove unneeded header

2018-01-01 Thread Michael Niedermayer
On Mon, Jan 01, 2018 at 04:21:40PM +, Derek Buitenhuis wrote:
> Signed-off-by: Derek Buitenhuis 
> ---
>  libavcodec/options.c | 1 -
>  1 file changed, 1 deletion(-)

probably ok

thx

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

He who knows, does not speak. He who speaks, does not know. -- Lao Tsu


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


Re: [FFmpeg-devel] [PATCH][RFC]lavu/mem: Allow allocations close to max_alloc_size with av_fast_realloc()

2018-01-01 Thread Michael Niedermayer
On Mon, Jan 01, 2018 at 11:10:57PM +0100, Carl Eugen Hoyos wrote:
> Hi!
> 
> Similar reason as last mem.c patch: av_fast_realloc() can currently
> fail in situations where the allocation is possible and allowed.
> The patch does not change behaviour for the failure case, if this is
> wanted, it should be done separately.
> 
> Please comment, Carl Eugen

>  mem.c |5 -
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 7529e1d584c62ece463f4461279ea6e3973162c9  
> 0001-lavu-mem-Allow-allocations-close-to-max_alloc_size-w.patch
> From ac69f4e8402f7c7ee6df09c0450354e2bb900e5a Mon Sep 17 00:00:00 2001
> From: Carl Eugen Hoyos 
> Date: Mon, 1 Jan 2018 23:04:58 +0100
> Subject: [PATCH] lavu/mem: Allow allocations close to max_alloc_size with
>  av_fast_realloc().
> 
> ---
>  libavutil/mem.c |5 -
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/libavutil/mem.c b/libavutil/mem.c
> index 0729e1d..934987f 100644
> --- a/libavutil/mem.c
> +++ b/libavutil/mem.c
> @@ -466,7 +466,10 @@ void *av_fast_realloc(void *ptr, unsigned int *size, 
> size_t min_size)
>  if (min_size <= *size)
>  return ptr;
>  
> -min_size = FFMAX(min_size + min_size / 16 + 32, min_size);
> +if (min_size > (max_alloc_size - 32))
> +return NULL;

This failure mode differs from the existing in what it does with *size

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

It is dangerous to be right in matters on which the established authorities
are wrong. -- Voltaire


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


Re: [FFmpeg-devel] [PATCH] lavc/qsvdec: hw device should be set

2018-01-01 Thread Mark Thompson
On 29/12/17 07:06, Zhong Li wrote:
> Add the flag "AV_CODEC_HW_CONFIG_METHOD_HW_DEVICE_CTX" to indicate
> AVCodecContext.hw_device_ctx should be set before calling
> avcodec_open2() for qsv decoding.
> It is consistent with examples/qsvdec.c.
> 
> It also can make function "hw_device_match_by_codec()" can find qsv
> device successfully.
> 
> Signed-off-by: Zhong Li 
> ---
>  libavcodec/qsvdec.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/libavcodec/qsvdec.c b/libavcodec/qsvdec.c
> index 55fe59b..ff1dcf1 100644
> --- a/libavcodec/qsvdec.c
> +++ b/libavcodec/qsvdec.c
> @@ -45,7 +45,8 @@ const AVCodecHWConfigInternal *ff_qsv_hw_configs[] = {
>  &(const AVCodecHWConfigInternal) {
>  .public = {
>  .pix_fmt = AV_PIX_FMT_QSV,
> -.methods = AV_CODEC_HW_CONFIG_METHOD_HW_FRAMES_CTX |
> +.methods = AV_CODEC_HW_CONFIG_METHOD_HW_DEVICE_CTX |
> +   AV_CODEC_HW_CONFIG_METHOD_HW_FRAMES_CTX |
> AV_CODEC_HW_CONFIG_METHOD_AD_HOC,
>  .device_type = AV_HWDEVICE_TYPE_QSV,
>  },
> 

Did you omit a patch implementing this?  The change here is only to the 
metadata, and it's not currently implemented.

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


Re: [FFmpeg-devel] [PATCH] avcodec/utvideoenc: switch to planar RGB formats

2018-01-01 Thread Carl Eugen Hoyos
2017-12-31 18:45 GMT+01:00 Derek Buitenhuis :
> On 12/31/2017 2:04 PM, Carl Eugen Hoyos wrote:
>> This is not helpful;-(
>> Is it so unlikely that the patch has small gain for gbr
>> (theoretically compensated by existing fast conversion
>> from gbr to rgb) but large impact for rgb (with slow
>> conversion from rgb into gbr)?
>
> I went and tested the speed difference with and without this
> patch, with rgb24 input. You'll be happy to know it came out
> to be pretty much exactly the same speed after averaging 100
> runs of each.

(Why?)

Thank you for the testing!

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


[FFmpeg-devel] [PATCH][RFC]lavu/mem: Allow allocations close to max_alloc_size with av_fast_realloc()

2018-01-01 Thread Carl Eugen Hoyos
Hi!

Similar reason as last mem.c patch: av_fast_realloc() can currently
fail in situations where the allocation is possible and allowed.
The patch does not change behaviour for the failure case, if this is
wanted, it should be done separately.

Please comment, Carl Eugen
From ac69f4e8402f7c7ee6df09c0450354e2bb900e5a Mon Sep 17 00:00:00 2001
From: Carl Eugen Hoyos 
Date: Mon, 1 Jan 2018 23:04:58 +0100
Subject: [PATCH] lavu/mem: Allow allocations close to max_alloc_size with
 av_fast_realloc().

---
 libavutil/mem.c |5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/libavutil/mem.c b/libavutil/mem.c
index 0729e1d..934987f 100644
--- a/libavutil/mem.c
+++ b/libavutil/mem.c
@@ -466,7 +466,10 @@ void *av_fast_realloc(void *ptr, unsigned int *size, size_t min_size)
 if (min_size <= *size)
 return ptr;
 
-min_size = FFMAX(min_size + min_size / 16 + 32, min_size);
+if (min_size > (max_alloc_size - 32))
+return NULL;
+
+min_size = FFMIN(max_alloc_size - 32, FFMAX(min_size + min_size / 16 + 32, min_size));
 
 ptr = av_realloc(ptr, min_size);
 /* we could set this to the unmodified min_size but this is safer
-- 
1.7.10.4

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


Re: [FFmpeg-devel] [PATCH][RFC]lavu/mem: Do not realloc in av_fast_alloc() if size == min_size

2018-01-01 Thread Carl Eugen Hoyos
2018-01-01 18:47 GMT+01:00 Paul B Mahol :
> On 12/30/17, Carl Eugen Hoyos  wrote:
>> 2017-12-30 17:24 GMT+01:00 Derek Buitenhuis :
>>> On 12/30/2017 1:44 PM, Carl Eugen Hoyos wrote:
 FFmpeg has an arbitrary allocation limit (2G iirc), av_fast_realloc()
 increases the allocation even if the requested is equal the already
 allocated size. I believe this can lead to unnecessary OOM (no
 testcase) if the requested (and already allocated) size is close to
 our limit.
 Additionally, this avoids an over-allocation for the mov stts patch I
 just sent.
 Attached patch changes the behaviour introduced 15 years ago.
>>
>>> I'm not aware of such a limit within the libraries (there is no allocation
>>> tracking)?
>>
>> I just confirmed the ("arbitrary") limit defaults to INT_MAX which at least
>> on some systems is 2G as claimed above.
>
> Will you apply this or not?

The patch makes no difference for the committed version of the stts
patch but it may still be a good idea, therefore applied.

Thank you, Carl Eugen
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH]lavf/mov: Do not blindly allocate stts entries

2018-01-01 Thread Carl Eugen Hoyos
2018-01-01 16:17 GMT+01:00 Michael Niedermayer :
> On Sun, Dec 31, 2017 at 10:35:28PM +0100, Carl Eugen Hoyos wrote:
>> 2017-12-31 22:26 GMT+01:00 Carl Eugen Hoyos :
>> > 2017-12-31 22:17 GMT+01:00 Michael Niedermayer :
>> >> On Sat, Dec 30, 2017 at 02:36:39PM +0100, Carl Eugen Hoyos wrote:
>> >>> 2017-12-29 23:37 GMT+01:00 Carl Eugen Hoyos :
>> >>> > 2017-11-28 21:32 GMT+01:00 Michael Niedermayer 
>> >>> > :
>> >>> >> On Mon, Nov 27, 2017 at 05:24:14AM +0100, Carl Eugen Hoyos wrote:
>> >>> >
>> >>> >>>  for (i = 0; i < entries && !pb->eof_reached; i++) {
>> >>> >>> -int sample_duration;
>> >>> >>> +int sample_duration, ret;
>> >>> >>>  unsigned int sample_count;
>> >>> >>> +if (i > sc->stts_count) {
>> >>> >>> +ret = av_reallocp_array(>stts_data,
>> >>> >>> +FFMIN(sc->stts_count * 2LL, 
>> >>> >>> entries),
>> >>> >>> +sizeof(*sc->stts_data));
>> >>> >>
>> >>> >> this should use a variant of av_fast_realloc
>> >>> >
>> >>> > Do you prefer the new patch?
>> >>> > The old variant here looks slightly saner to me.
>> >>>
>> >>> Attached is what you possibly had in mind.
>> >>>
>> >>> Please review, Carl Eugen
>> >>
>> >>>  mov.c |   13 +++--
>> >>>  1 file changed, 11 insertions(+), 2 deletions(-)
>> >>> cc7986179fe0ddc394457e8543d9ae907b49373c  
>> >>> 0001-lavf-mov-Use-av_fast_realloc-in-mov_read_stts.patch
>> >>> From f5fcd9ed1e5ce604c358a3787f1977277005ebb5 Mon Sep 17 00:00:00 2001
>> >>> From: Carl Eugen Hoyos 
>> >>> Date: Sat, 30 Dec 2017 14:34:41 +0100
>> >>> Subject: [PATCH] lavf/mov: Use av_fast_realloc() in mov_read_stts().
>> >>>
>> >>> Avoids large allocations for short files with invalid stts entry.
>> >>> Fixes bugzilla 1102.
>> >>> ---
>> >>>  libavformat/mov.c |   13 +++--
>> >>>  1 file changed, 11 insertions(+), 2 deletions(-)
>> >>>
>> >>> diff --git a/libavformat/mov.c b/libavformat/mov.c
>> >>> index 2064473..1e97652 100644
>> >>> --- a/libavformat/mov.c
>> >>> +++ b/libavformat/mov.c
>> >>> @@ -2850,13 +2850,22 @@ static int mov_read_stts(MOVContext *c, 
>> >>> AVIOContext *pb, MOVAtom atom)
>> >>>  av_log(c->fc, AV_LOG_WARNING, "Duplicated STTS atom\n");
>> >>>  av_free(sc->stts_data);
>> >>>  sc->stts_count = 0;
>> >>> -sc->stts_data = av_malloc_array(entries, sizeof(*sc->stts_data));
>> >>> -if (!sc->stts_data)
>> >>> +if (entries >= INT_MAX / sizeof(*sc->stts_data))
>> >>>  return AVERROR(ENOMEM);
>> >>
>> >> this leaves a stale pointer on error in sc->stts_data
>> >
>> > New patch attached.
>>
>> Which would not have worked as intended, new variant attached.
>>
>> Carl Eugen
>
>>  mov.c |   17 +
>>  1 file changed, 13 insertions(+), 4 deletions(-)
>> c6ced82c5a98fbdf831ff4cd4809e4a02d6823c0  
>> 0001-lavf-mov-Use-av_fast_realloc-in-mov_read_stts.patch
>> From 9eaf0b56245820194e8e1bee0e3730f3c7362158 Mon Sep 17 00:00:00 2001
>> From: Carl Eugen Hoyos 
>> Date: Sun, 31 Dec 2017 22:30:57 +0100
>> Subject: [PATCH] lavf/mov: Use av_fast_realloc() in mov_read_stts().
>>
>> Avoids large allocations for short files with invalid stts entry.
>> Fixes bugzilla 1102.
>> ---
>>  libavformat/mov.c |   17 +
>>  1 file changed, 13 insertions(+), 4 deletions(-)
>
> should be ok

Patch applied.

Thank you, Carl Eugen
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] mpeg4video: Add support for MPEG-4 Simple Studio Profile.

2018-01-01 Thread Michael Niedermayer
Hi

On Fri, Dec 29, 2017 at 03:46:41PM +, Kieran Kunhya wrote:
> $subj
> 
> I'm not to happy about the s->block2 stuff, there are many ways of trying
> to resolve this (e.g union), so review welcome.
> 
> I will add DPCM support in a later (currently unfinished) patch.
> 
> Kieran

sorry for the delay, i was and am a bit busy ...


>  h263dec.c  |8 
>  idctdsp.c  |2 
>  ituh263dec.c   |9 
>  mpeg4data.h|  116 +++
>  mpeg4video.h   |   17 +
>  mpeg4videodec.c|  513 
> -
>  mpegvideo.c|   21 +-
>  mpegvideo.h|   17 +
>  x86/idctdsp_init.c |1 
>  9 files changed, 687 insertions(+), 17 deletions(-)
> 039f599da00adef33163ed09587d3bae69b41c33  
> 0001-mpeg4video-Add-support-for-MPEG-4-Simple-Studio-Prof.patch
> From 1f11d8a412271aa4e7aca0dd90c2a41d9d4dd5c7 Mon Sep 17 00:00:00 2001
> From: Kieran Kunhya 
> Date: Fri, 29 Dec 2017 15:42:14 +
> Subject: [PATCH] mpeg4video: Add support for MPEG-4 Simple Studio Profile.
> 
> This is a profile supporting > 8-bit video and has a higher quality DCT
> ---
>  libavcodec/h263dec.c  |   8 +
>  libavcodec/idctdsp.c  |   2 +-
>  libavcodec/ituh263dec.c   |   9 +-
>  libavcodec/mpeg4data.h| 116 ++
>  libavcodec/mpeg4video.h   |  17 ++
>  libavcodec/mpeg4videodec.c| 513 
> +-
>  libavcodec/mpegvideo.c|  21 +-
>  libavcodec/mpegvideo.h|  17 +-
>  libavcodec/x86/idctdsp_init.c |   1 +
>  9 files changed, 687 insertions(+), 17 deletions(-)
> 
> diff --git a/libavcodec/h263dec.c b/libavcodec/h263dec.c
> index 5608b63245..647ff0239b 100644
> --- a/libavcodec/h263dec.c
> +++ b/libavcodec/h263dec.c

> @@ -47,6 +47,10 @@
>  
>  static enum AVPixelFormat h263_get_format(AVCodecContext *avctx)
>  {
> +/* MPEG-4 Studio Profile only, not supported by hardware */
> +if (avctx->bits_per_raw_sample > 8)
> +return avctx->pix_fmt;

If its just for studio profile, that should be checked for or assert()ed
If it ever can be true for some other case this commnet is easy to overlook


> +
>  if (avctx->codec->id == AV_CODEC_ID_MSS2)
>  return AV_PIX_FMT_YUV420P;
>  
> @@ -197,6 +201,10 @@ static int decode_slice(MpegEncContext *s)
>  
>  ff_set_qscale(s, s->qscale);
>  
> +if (s->studio_profile) {
> +ff_mpeg4_decode_studio_slice_header(s->avctx->priv_data);
> +}
> +
>  if (s->avctx->hwaccel) {
>  const uint8_t *start = s->gb.buffer + get_bits_count(>gb) / 8;
>  ret = s->avctx->hwaccel->decode_slice(s->avctx, start, 
> s->gb.buffer_end - start);
> diff --git a/libavcodec/idctdsp.c b/libavcodec/idctdsp.c
> index 1de372d2b9..e5b0be3cb7 100644
> --- a/libavcodec/idctdsp.c
> +++ b/libavcodec/idctdsp.c
> @@ -256,7 +256,7 @@ av_cold void ff_idctdsp_init(IDCTDSPContext *c, 
> AVCodecContext *avctx)
>  c->perm_type = FF_IDCT_PERM_NONE;
>  } else {
>  if (avctx->bits_per_raw_sample == 10 || avctx->bits_per_raw_sample 
> == 9) {
> -c->idct_put  = ff_simple_idct_put_int16_10bit;

> +c->idct_put  = ff_simple_idct_put_int32_10bit;
>  c->idct_add  = ff_simple_idct_add_int16_10bit;

This doesnt look right, is this intended ?
put is 32bit, add is 16bit

[...]
> +/**
> + * Decode the next video packet.
> + * @return <0 if something went wrong
> + */
> +int ff_mpeg4_decode_studio_slice_header(Mpeg4DecContext *ctx)
> +{
> +MpegEncContext *s = >m;
> +GetBitContext *gb = >gb;
> +unsigned vlc_len;
> +uint16_t mb_num;
> +
> +if (get_bits_long(gb, 32) == SLICE_START_CODE) {
> +vlc_len = av_log2(((s->width + 15) / 16) * ((s->height + 15) / 16)) 
> + 1;
> +mb_num = get_bits(gb, vlc_len);
> +
> +s->mb_x = mb_num % s->mb_width;
> +s->mb_y = mb_num / s->mb_width;
> +
> +if (ctx->shape != BIN_ONLY_SHAPE)
> +s->qscale = get_qscale(s);
> +

> +if (show_bits1(gb)) {
> +skip_bits1(gb);   /* slice_extension_flag */
> +skip_bits1(gb);   /* intra_slice */
> +skip_bits1(gb);   /* slice_VOP_id_enable */
> +skip_bits(gb, 6); /* slice_VOP_id */
> +while (show_bits1(gb)) {
> +skip_bits1(gb);   /* extra_bit_slice */
> +skip_bits(gb, 8); /* slice_VOP_id */
> +}
> +}
> +skip_bits1(gb); /* extra_bit_slice */

you can replace the show_bits1 by get_bits1 above and drop the corresponding 
skip_bits1


> +
> +reset_studio_dc_predictors(s);
> +}
> +
> +return 0;
> +}
> +
>  /**
>   * Get the average motion vector for a GMC MB.
>   * @param n either 0 for the x component or 1 for y

> @@ -1718,6 +1775,186 @@ end:
>  return SLICE_OK;
>  }
>  
> +static void next_start_code_studio(GetBitContext *gb)
> +{
> +align_get_bits(gb);

Re: [FFmpeg-devel] [PATCH] avfilter: add hilbert source FIR filter

2018-01-01 Thread Moritz Barsnick
On Mon, Jan 01, 2018 at 17:02:13 +0100, Paul B Mahol wrote:
> +Generate an odd-tap Hilbert transform FIR coefficients.

"an" is singular, "coefficients" is plural.

> +The resulted stream can be used with @ref{afir} filter for phase-shifting
   ^ resulting

> +@item win_func, w
> +Set window function to be used when generating FIR coefficients.
> +@end table

Usually it would be good listing them, but considering how many there
are... I'm short of opinions here.

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


Re: [FFmpeg-devel] [PATCH][RFC]lavu/mem: Do not realloc in av_fast_alloc() if size == min_size

2018-01-01 Thread Paul B Mahol
On 12/30/17, Carl Eugen Hoyos  wrote:
> 2017-12-30 17:24 GMT+01:00 Derek Buitenhuis :
>> On 12/30/2017 1:44 PM, Carl Eugen Hoyos wrote:
>>> FFmpeg has an arbitrary allocation limit (2G iirc), av_fast_realloc()
>>> increases the allocation even if the requested is equal the already
>>> allocated size. I believe this can lead to unnecessary OOM (no
>>> testcase) if the requested (and already allocated) size is close to
>>> our limit.
>>> Additionally, this avoids an over-allocation for the mov stts patch I
>>> just sent.
>>> Attached patch changes the behaviour introduced 15 years ago.
>
>> I'm not aware of such a limit within the libraries (there is no allocation
>> tracking)?
>
> I just confirmed the ("arbitrary") limit defaults to INT_MAX which at least
> on some systems is 2G as claimed above.
>

Will you apply this or not?
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH 2/2] vf_paletteuse: Don't free the second frame from ff_framesync_dualinput_get_writable on error

2018-01-01 Thread Derek Buitenhuis
This fixes a double free in he error case.

Signed-off-by: Derek Buitenhuis 
---
This does fix the double free, but I am unsure if it is the correct free
to removed to fix it. Comments welcome.
---
 libavfilter/vf_paletteuse.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/libavfilter/vf_paletteuse.c b/libavfilter/vf_paletteuse.c
index ede2e2e..c2d0c6b 100644
--- a/libavfilter/vf_paletteuse.c
+++ b/libavfilter/vf_paletteuse.c
@@ -1037,7 +1037,6 @@ static int load_apply_palette(FFFrameSync *fs)
 
 error:
 av_frame_free();
-av_frame_free();
 return ret;
 }
 
-- 
1.8.3.1

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


[FFmpeg-devel] [PATCH 1/3] lavc/options: Remove unneeded header

2018-01-01 Thread Derek Buitenhuis
Signed-off-by: Derek Buitenhuis 
---
 libavcodec/options.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/libavcodec/options.c b/libavcodec/options.c
index 82e1217..41b6052 100644
--- a/libavcodec/options.c
+++ b/libavcodec/options.c
@@ -30,7 +30,6 @@
 #include "libavutil/internal.h"
 #include "libavutil/mem.h"
 #include "libavutil/opt.h"
-#include   /* FLT_MIN, FLT_MAX */
 #include 
 
 FF_DISABLE_DEPRECATION_WARNINGS
-- 
1.8.3.1

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


[FFmpeg-devel] [PATCH 1/2] vf_paletteuse: Add error checking to apply_palette

2018-01-01 Thread Derek Buitenhuis
This fixes a segfault caused by passing NULL to ff_filter_frame
when an error occurs.

Signed-off-by: Derek Buitenhuis 
---
 libavfilter/vf_paletteuse.c | 25 -
 1 file changed, 16 insertions(+), 9 deletions(-)

diff --git a/libavfilter/vf_paletteuse.c b/libavfilter/vf_paletteuse.c
index 1980907..ede2e2e 100644
--- a/libavfilter/vf_paletteuse.c
+++ b/libavfilter/vf_paletteuse.c
@@ -894,9 +894,9 @@ static void set_processing_window(enum diff_mode diff_mode,
 *hp = height;
 }
 
-static AVFrame *apply_palette(AVFilterLink *inlink, AVFrame *in)
+static int apply_palette(AVFilterLink *inlink, AVFrame *in, AVFrame **outf)
 {
-int x, y, w, h;
+int x, y, w, h, ret;
 AVFilterContext *ctx = inlink->dst;
 PaletteUseContext *s = ctx->priv;
 AVFilterLink *outlink = inlink->dst->outputs[0];
@@ -904,7 +904,8 @@ static AVFrame *apply_palette(AVFilterLink *inlink, AVFrame 
*in)
 AVFrame *out = ff_get_video_buffer(outlink, outlink->w, outlink->h);
 if (!out) {
 av_frame_free();
-return NULL;
+*outf = NULL;
+return AVERROR(EINVAL);
 }
 av_frame_copy_props(out, in);
 
@@ -918,21 +919,25 @@ static AVFrame *apply_palette(AVFilterLink *inlink, 
AVFrame *in)
 av_frame_make_writable(s->last_in) < 0) {
 av_frame_free();
 av_frame_free();
-return NULL;
+*outf = NULL;
+return AVERROR(EINVAL);
 }
 
 ff_dlog(ctx, "%dx%d rect: (%d;%d) -> (%d,%d) [area:%dx%d]\n",
 w, h, x, y, x+w, y+h, in->width, in->height);
 
-if (s->set_frame(s, out, in, x, y, w, h) < 0) {
+ret = s->set_frame(s, out, in, x, y, w, h);
+if (ret < 0) {
 av_frame_free();
-return NULL;
+*outf = NULL;
+return ret;
 }
 memcpy(out->data[1], s->palette, AVPALETTE_SIZE);
 if (s->calc_mean_err)
 debug_mean_error(s, in, out, inlink->frame_count_out);
 av_frame_free();
-return out;
+*outf = out;
+return 0;
 }
 
 static int config_output(AVFilterLink *outlink)
@@ -1011,7 +1016,7 @@ static int load_apply_palette(FFFrameSync *fs)
 AVFilterContext *ctx = fs->parent;
 AVFilterLink *inlink = ctx->inputs[0];
 PaletteUseContext *s = ctx->priv;
-AVFrame *master, *second, *out;
+AVFrame *master, *second, *out = NULL;
 int ret;
 
 // writable for error diffusal dithering
@@ -1025,7 +1030,9 @@ static int load_apply_palette(FFFrameSync *fs)
 if (!s->palette_loaded) {
 load_palette(s, second);
 }
-out = apply_palette(inlink, master);
+ret = apply_palette(inlink, master, );
+if (ret < 0)
+goto error;
 return ff_filter_frame(ctx->outputs[0], out);
 
 error:
-- 
1.8.3.1

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


[FFmpeg-devel] [PATCH 0/2] Smll vf_paletteuse error branch fixes

2018-01-01 Thread Derek Buitenhuis
Found via nullfuzer. Repro'd via:

FUZZ_SEED=1514396029 /home/daemon404/ffmpeg/ffmpeg -nostdin -nostats -cpuflags 
all -hwaccel none \
-threads 1 -thread_type frame+slice -i /home/daemon404/FATE/filter/anim.mkv 
-hwaccel none -threads 1 \
-thread_type frame+slice -i /home/daemon404/FATE/filter/anim-palette.png 
-lavfi paletteuse=bayer \
-pix_fmt bgra -bitexact -f framecrc -

Derek Buitenhuis (2):
  vf_paletteuse: Add error checking to apply_palette
  vf_paletteuse: Don't free the second frame from
ff_framesync_dualinput_get_writable on error

 libavfilter/vf_paletteuse.c | 26 --
 1 file changed, 16 insertions(+), 10 deletions(-)

-- 
1.8.3.1

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


Re: [FFmpeg-devel] [PATCH] avfilter: add hilbert source FIR filter

2018-01-01 Thread Paul B Mahol
On 1/1/18, Carl Eugen Hoyos  wrote:
> 2018-01-01 17:02 GMT+01:00 Paul B Mahol :
>
>> +float *dst;
>
> Write-only variable.
>

Removed locally.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avfilter: add hilbert source FIR filter

2018-01-01 Thread Carl Eugen Hoyos
2018-01-01 17:02 GMT+01:00 Paul B Mahol :

> +float *dst;

Write-only variable.

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


[FFmpeg-devel] [PATCH] avfilter: add hilbert source FIR filter

2018-01-01 Thread Paul B Mahol
Signed-off-by: Paul B Mahol 
---
 doc/filters.texi   |  28 +++
 libavfilter/Makefile   |   1 +
 libavfilter/allfilters.c   |   1 +
 libavfilter/asrc_hilbert.c | 201 +
 4 files changed, 231 insertions(+)
 create mode 100644 libavfilter/asrc_hilbert.c

diff --git a/doc/filters.texi b/doc/filters.texi
index f651f1234d..f42f4c9190 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -926,6 +926,7 @@ afftfilt="1-clip((b/nb)*b,0,1)"
 @end example
 @end itemize
 
+@anchor{afir}
 @section afir
 
 Apply an arbitrary Frequency Impulse Response filter.
@@ -4873,6 +4874,33 @@ anoisesrc=d=60:c=pink:r=44100:a=0.5
 @end example
 @end itemize
 
+@section hilbert
+
+Generate an odd-tap Hilbert transform FIR coefficients.
+
+The resulted stream can be used with @ref{afir} filter for phase-shifting
+the signal by 90 degrees.
+
+This is used in many matrix coding schemes and for analytic signal generation.
+The process is often written as a multiplication by i (or j), the imaginary 
unit.
+
+The filter accepts the following options:
+
+@table @option
+
+@item sample_rate, s
+Set sample rate, default is 44100.
+
+@item taps, t
+Set length of FIR filter, default is 22051.
+
+@item nb_samples, n
+Set number of samples per each frame.
+
+@item win_func, w
+Set window function to be used when generating FIR coefficients.
+@end table
+
 @section sine
 
 Generate an audio signal made of a sine wave with amplitude 1/8.
diff --git a/libavfilter/Makefile b/libavfilter/Makefile
index 8bde542163..5eb331c961 100644
--- a/libavfilter/Makefile
+++ b/libavfilter/Makefile
@@ -126,6 +126,7 @@ OBJS-$(CONFIG_AEVALSRC_FILTER)   += aeval.o
 OBJS-$(CONFIG_ANOISESRC_FILTER)  += asrc_anoisesrc.o
 OBJS-$(CONFIG_ANULLSRC_FILTER)   += asrc_anullsrc.o
 OBJS-$(CONFIG_FLITE_FILTER)  += asrc_flite.o
+OBJS-$(CONFIG_HILBERT_FILTER)+= asrc_hilbert.o
 OBJS-$(CONFIG_SINE_FILTER)   += asrc_sine.o
 
 OBJS-$(CONFIG_ANULLSINK_FILTER)  += asink_anullsink.o
diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c
index 67c073091f..7d5129d929 100644
--- a/libavfilter/allfilters.c
+++ b/libavfilter/allfilters.c
@@ -137,6 +137,7 @@ static void register_all(void)
 REGISTER_FILTER(ANOISESRC,  anoisesrc,  asrc);
 REGISTER_FILTER(ANULLSRC,   anullsrc,   asrc);
 REGISTER_FILTER(FLITE,  flite,  asrc);
+REGISTER_FILTER(HILBERT,hilbert,asrc);
 REGISTER_FILTER(SINE,   sine,   asrc);
 
 REGISTER_FILTER(ANULLSINK,  anullsink,  asink);
diff --git a/libavfilter/asrc_hilbert.c b/libavfilter/asrc_hilbert.c
new file mode 100644
index 00..1270a6b9f1
--- /dev/null
+++ b/libavfilter/asrc_hilbert.c
@@ -0,0 +1,201 @@
+/*
+ * Copyright (c) 2018 Paul B Mahol
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with FFmpeg; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "libavutil/opt.h"
+#include "audio.h"
+#include "avfilter.h"
+#include "internal.h"
+#include "window_func.h"
+
+typedef struct HilbertContext {
+const AVClass *class;
+
+int sample_rate;
+int nb_taps;
+int nb_samples;
+int win_func;
+
+float *taps;
+int64_t pts;
+} HilbertContext;
+
+#define OFFSET(x) offsetof(HilbertContext, x)
+#define FLAGS AV_OPT_FLAG_AUDIO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
+
+static const AVOption hilbert_options[] = {
+{ "sample_rate", "set sample rate",OFFSET(sample_rate), 
AV_OPT_TYPE_INT, {.i64=44100},  1, INT_MAX,FLAGS },
+{ "r",   "set sample rate",OFFSET(sample_rate), 
AV_OPT_TYPE_INT, {.i64=44100},  1, INT_MAX,FLAGS },
+{ "taps","set number of taps", OFFSET(nb_taps), 
AV_OPT_TYPE_INT, {.i64=22051}, 11, UINT16_MAX, FLAGS },
+{ "t",   "set number of taps", OFFSET(nb_taps), 
AV_OPT_TYPE_INT, {.i64=22051}, 11, UINT16_MAX, FLAGS },
+{ "nb_samples",  "set the number of samples per requested frame", 
OFFSET(nb_samples), AV_OPT_TYPE_INT, {.i64 = 1024}, 1, INT_MAX, FLAGS },
+{ "n",   "set the number of samples per requested frame", 
OFFSET(nb_samples), AV_OPT_TYPE_INT, {.i64 = 1024}, 1, INT_MAX, FLAGS },
+{ "win_func", "set window function", 

Re: [FFmpeg-devel] [PATCH 2/6] fftools, tools, examples: migrate to AVFormatContext->url

2018-01-01 Thread Michael Niedermayer
On Sat, Dec 30, 2017 at 10:16:02PM +0100, Marton Balint wrote:
> Signed-off-by: Marton Balint 
> ---
>  doc/examples/transcode_aac.c |  7 +--
>  fftools/ffmpeg.c | 16 
>  fftools/ffmpeg_opt.c |  8 
>  fftools/ffplay.c |  6 +++---
>  fftools/ffprobe.c|  2 +-
>  tools/uncoded_frame.c|  2 +-
>  6 files changed, 22 insertions(+), 19 deletions(-)

should be ok

thx

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

Asymptotically faster algorithms should always be preferred if you have
asymptotical amounts of data


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


Re: [FFmpeg-devel] [PATCH 6/6] avformat: deprecate AVFormatContext filename field

2018-01-01 Thread Michael Niedermayer
On Sat, Dec 30, 2017 at 10:16:06PM +0100, Marton Balint wrote:
> Signed-off-by: Marton Balint 
> ---
>  doc/APIchanges |  4 
>  libavformat/avformat.h |  5 +
>  libavformat/mux.c  | 10 ++
>  libavformat/utils.c|  8 
>  libavformat/version.h  |  5 -
>  5 files changed, 31 insertions(+), 1 deletion(-)

should be ok with or without the version change

thx

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

Its not that you shouldnt use gotos but rather that you should write
readable code and code with gotos often but not always is less readable


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


Re: [FFmpeg-devel] [PATCH]lavf/mov: Do not blindly allocate stts entries

2018-01-01 Thread Michael Niedermayer
On Sun, Dec 31, 2017 at 10:35:28PM +0100, Carl Eugen Hoyos wrote:
> 2017-12-31 22:26 GMT+01:00 Carl Eugen Hoyos :
> > 2017-12-31 22:17 GMT+01:00 Michael Niedermayer :
> >> On Sat, Dec 30, 2017 at 02:36:39PM +0100, Carl Eugen Hoyos wrote:
> >>> 2017-12-29 23:37 GMT+01:00 Carl Eugen Hoyos :
> >>> > 2017-11-28 21:32 GMT+01:00 Michael Niedermayer :
> >>> >> On Mon, Nov 27, 2017 at 05:24:14AM +0100, Carl Eugen Hoyos wrote:
> >>> >
> >>> >>>  for (i = 0; i < entries && !pb->eof_reached; i++) {
> >>> >>> -int sample_duration;
> >>> >>> +int sample_duration, ret;
> >>> >>>  unsigned int sample_count;
> >>> >>> +if (i > sc->stts_count) {
> >>> >>> +ret = av_reallocp_array(>stts_data,
> >>> >>> +FFMIN(sc->stts_count * 2LL, 
> >>> >>> entries),
> >>> >>> +sizeof(*sc->stts_data));
> >>> >>
> >>> >> this should use a variant of av_fast_realloc
> >>> >
> >>> > Do you prefer the new patch?
> >>> > The old variant here looks slightly saner to me.
> >>>
> >>> Attached is what you possibly had in mind.
> >>>
> >>> Please review, Carl Eugen
> >>
> >>>  mov.c |   13 +++--
> >>>  1 file changed, 11 insertions(+), 2 deletions(-)
> >>> cc7986179fe0ddc394457e8543d9ae907b49373c  
> >>> 0001-lavf-mov-Use-av_fast_realloc-in-mov_read_stts.patch
> >>> From f5fcd9ed1e5ce604c358a3787f1977277005ebb5 Mon Sep 17 00:00:00 2001
> >>> From: Carl Eugen Hoyos 
> >>> Date: Sat, 30 Dec 2017 14:34:41 +0100
> >>> Subject: [PATCH] lavf/mov: Use av_fast_realloc() in mov_read_stts().
> >>>
> >>> Avoids large allocations for short files with invalid stts entry.
> >>> Fixes bugzilla 1102.
> >>> ---
> >>>  libavformat/mov.c |   13 +++--
> >>>  1 file changed, 11 insertions(+), 2 deletions(-)
> >>>
> >>> diff --git a/libavformat/mov.c b/libavformat/mov.c
> >>> index 2064473..1e97652 100644
> >>> --- a/libavformat/mov.c
> >>> +++ b/libavformat/mov.c
> >>> @@ -2850,13 +2850,22 @@ static int mov_read_stts(MOVContext *c, 
> >>> AVIOContext *pb, MOVAtom atom)
> >>>  av_log(c->fc, AV_LOG_WARNING, "Duplicated STTS atom\n");
> >>>  av_free(sc->stts_data);
> >>>  sc->stts_count = 0;
> >>> -sc->stts_data = av_malloc_array(entries, sizeof(*sc->stts_data));
> >>> -if (!sc->stts_data)
> >>> +if (entries >= INT_MAX / sizeof(*sc->stts_data))
> >>>  return AVERROR(ENOMEM);
> >>
> >> this leaves a stale pointer on error in sc->stts_data
> >
> > New patch attached.
> 
> Which would not have worked as intended, new variant attached.
> 
> Carl Eugen

>  mov.c |   17 +
>  1 file changed, 13 insertions(+), 4 deletions(-)
> c6ced82c5a98fbdf831ff4cd4809e4a02d6823c0  
> 0001-lavf-mov-Use-av_fast_realloc-in-mov_read_stts.patch
> From 9eaf0b56245820194e8e1bee0e3730f3c7362158 Mon Sep 17 00:00:00 2001
> From: Carl Eugen Hoyos 
> Date: Sun, 31 Dec 2017 22:30:57 +0100
> Subject: [PATCH] lavf/mov: Use av_fast_realloc() in mov_read_stts().
> 
> Avoids large allocations for short files with invalid stts entry.
> Fixes bugzilla 1102.
> ---
>  libavformat/mov.c |   17 +
>  1 file changed, 13 insertions(+), 4 deletions(-)

should be ok

thx

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

In a rich man's house there is no place to spit but his face.
-- Diogenes of Sinope


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


Re: [FFmpeg-devel] [PATCH] configure: check SDL2 function with a header

2018-01-01 Thread KO Myung-Hun
Hi/2.

Derek Buitenhuis wrote:
> On 12/29/2017 6:36 AM, KO Myung-Hun wrote:
>> Sorry about that.
>>
>> SDL2 uses SDLCALL to specify a calling convention. On OS/2, it's defined
>> to `_System' which is similar to `_cdecl' but does not prepend '_'.
>>
>> After all, without a header, a function is used without `_System'. And
>> linker will try to `_func' but fail because the function is `func' not
>> `_func'.
> 
> Thanks for the explanation. Patch LGTM with this added to the commit message.
> 

Updated.

-- 
KO Myung-Hun

Using Mozilla SeaMonkey 2.7.2
Under OS/2 Warp 4 for Korean with FixPak #15
In VirtualBox v4.1.32 on Intel Core i7-3615QM 2.30GHz with 8GB RAM

Korean OS/2 User Community : http://www.os2.kr/

From 7703c6f9cd8d4982f406f473ea57b092a19c92ee Mon Sep 17 00:00:00 2001
From: KO Myung-Hun 
Date: Thu, 28 Dec 2017 23:41:30 +0900
Subject: [PATCH] configure: check SDL2 function with a header

SDL2 uses SDLCALL to specify a calling convention. On OS/2, it's defined
to `_System' which is similar to `_cdecl' but does not prepend '_'.

After all, without a header, a function is used without `_System'. And
linker will try to `_func' but fail because the function is `func' not
`_func'.
---
 configure | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/configure b/configure
index 70de780f82..f937ddf2be 100755
--- a/configure
+++ b/configure
@@ -6019,14 +6019,14 @@ fi
 if enabled sdl2; then
 SDL2_CONFIG="${cross_prefix}sdl2-config"
 if test_pkg_config sdl2 "sdl2 >= 2.0.1 sdl2 < 2.1.0" SDL_events.h SDL_PollEvent; then
-check_func SDL_Init $sdl2_extralibs $sdl2_cflags ||
+check_func_headers SDL.h SDL_Init $sdl2_extralibs $sdl2_cflags ||
 disable sdl2
 elif "${SDL2_CONFIG}" --version > /dev/null 2>&1; then
 sdl2_cflags=$("${SDL2_CONFIG}" --cflags)
 sdl2_extralibs=$("${SDL2_CONFIG}" --libs)
 check_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 | SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) >= 0x020001" $sdl2_cflags &&
 check_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 | SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) < 0x020100" $sdl2_cflags &&
-check_func SDL_Init $sdl2_extralibs $sdl2_cflags &&
+check_func_headers SDL.h SDL_Init $sdl2_extralibs $sdl2_cflags &&
 enable sdl2
 fi
 if test $target_os = "mingw32"; then
-- 
2.13.3

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


[FFmpeg-devel] [PATCH] doc/fate: Document how to upload samples to the fate suite

2018-01-01 Thread Michael Niedermayer
Suggested-by: Compn

Signed-off-by: Michael Niedermayer 
---
 doc/fate.texi | 20 
 1 file changed, 20 insertions(+)

diff --git a/doc/fate.texi b/doc/fate.texi
index 7a96c25..c9c0d3a 100644
--- a/doc/fate.texi
+++ b/doc/fate.texi
@@ -147,6 +147,26 @@ process.
 The only thing left is to automate the execution of the fate.sh script and
 the synchronisation of the samples directory.
 
+@chapter Uploading new samples to the fate suite
+
+This is for developers who have an account on the fate suite server.
+If you upload new samples, please make sure they are as small as possible,
+space on each client, network bandwidth and so on benefit from smaller test 
cases.
+Also keep in mind older checkouts use existing sample files, that means in
+practice generally do not replace, remove or overwrite files as it likely would
+break older checkouts or releases.
+
+@example
+#First update your local samples copy:
+rsync -vauL --chmod=Dg+s,Duo+x,ug+rw,o+r,o-w,+X 
fate-suite.ffmpeg.org:/home/samples/fate-suite/ ~/fate-suite
+
+#Then do a dry run checking what would be uploaded:
+rsync -vanL --no-g --chmod=Dg+s,Duo+x,ug+rw,o+r,o-w,+X ~/fate-suite/ 
fate-suite.ffmpeg.org:/home/samples/fate-suite
+
+#Upload the files:
+rsync -vaL  --no-g --chmod=Dg+s,Duo+x,ug+rw,o+r,o-w,+X ~/fate-suite/ 
fate-suite.ffmpeg.org:/home/samples/fate-suite
+@end example
+
 
 @chapter FATE makefile targets and variables
 
-- 
2.7.4

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


[FFmpeg-devel] [PATCH 0/1] mpeg: add experimental support for PSMF audio.

2018-01-01 Thread misty
From: Misty De Meo 

Fixed by adjusting the type of `bytes_remain` to `uint16_t`, since
that's the type returned by the `AV_RB16` macro that it's assigned from.

Maxim Poliakovski (1):
  mpeg: add experimental support for PSMF audio.

 libavcodec/Makefile|   1 +
 libavcodec/allcodecs.c |   1 +
 libavcodec/atrac3plus_parser.c | 170 +
 libavformat/mpeg.c |  27 ++-
 4 files changed, 198 insertions(+), 1 deletion(-)
 create mode 100644 libavcodec/atrac3plus_parser.c

-- 
2.15.1

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


[FFmpeg-devel] [PATCH 1/1] mpeg: add experimental support for PSMF audio.

2018-01-01 Thread misty
From: Maxim Poliakovski 

Changes by Misty De Meo :

atrac3plus_parser: remove return statements for invalid data

atrac3plus_parser: use libavcodec's oma

atrac3plus_parser: pass along unexpected data unaltered

atrac3plus_parser: adjust bytes_remain type

Change by Michael "Bazz" Bazzinotti :

atrac3plus_parser: don't always fail video for "2nd frame portion found"

Signed-off-by: Misty De Meo 

wip parser
---
 libavcodec/Makefile|   1 +
 libavcodec/allcodecs.c |   1 +
 libavcodec/atrac3plus_parser.c | 170 +
 libavformat/mpeg.c |  27 ++-
 4 files changed, 198 insertions(+), 1 deletion(-)
 create mode 100644 libavcodec/atrac3plus_parser.c

diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index ca72138c02..e0e3f1ebac 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -977,6 +977,7 @@ OBJS-$(CONFIG_AAC_PARSER)  += aac_parser.o 
aac_ac3_parser.o \
   mpeg4audio.o
 OBJS-$(CONFIG_AC3_PARSER)  += ac3tab.o aac_ac3_parser.o
 OBJS-$(CONFIG_ADX_PARSER)  += adx_parser.o adx.o
+OBJS-$(CONFIG_ATRAC3P_PARSER)  += atrac3plus_parser.o
 OBJS-$(CONFIG_BMP_PARSER)  += bmp_parser.o
 OBJS-$(CONFIG_CAVSVIDEO_PARSER)+= cavs_parser.o
 OBJS-$(CONFIG_COOK_PARSER) += cook_parser.o
diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
index ed1e7ab06e..81d5d2814a 100644
--- a/libavcodec/allcodecs.c
+++ b/libavcodec/allcodecs.c
@@ -623,6 +623,7 @@ static void register_all(void)
 REGISTER_PARSER(AAC_LATM,   aac_latm);
 REGISTER_PARSER(AC3,ac3);
 REGISTER_PARSER(ADX,adx);
+REGISTER_PARSER(ATRAC3P,atrac3p);
 REGISTER_PARSER(BMP,bmp);
 REGISTER_PARSER(CAVSVIDEO,  cavsvideo);
 REGISTER_PARSER(COOK,   cook);
diff --git a/libavcodec/atrac3plus_parser.c b/libavcodec/atrac3plus_parser.c
new file mode 100644
index 00..5aebdd5fbc
--- /dev/null
+++ b/libavcodec/atrac3plus_parser.c
@@ -0,0 +1,170 @@
+/*
+ * Copyright (C) 2016 Michael "Bazz" Bazzinotti 
+ * Copyright (C) 2014 Maxim Poliakovski
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "parser.h"
+#include "get_bits.h"
+#include "oma.h"
+
+typedef struct Atrac3PlusParseContext {
+ParseContext pc;
+uint8_t hdr[8];
+int hdr_bytes_needed;
+int sample_rate, channel_id, frame_size;
+uint8_t got_bytes;
+} Atrac3PlusParseContext;
+
+static int parse_sound_frame_header(Atrac3PlusParseContext *c,
+const uint8_t *buf)
+{
+uint16_t atrac_config;
+
+if (AV_RB16(buf) != 0x0FD0)
+return AVERROR_INVALIDDATA;
+
+atrac_config = AV_RB16([2]);
+c->sample_rate = oma_srate_tab[(atrac_config >> 13) & 7] * 100;
+c->channel_id  = (atrac_config >> 10) & 7;
+c->frame_size  = ((atrac_config & 0x3FF) * 8) + 8;
+
+if (!c->channel_id || !c->sample_rate || !c->frame_size)
+return AVERROR_INVALIDDATA;
+
+return 0;
+}
+
+static int ff_atrac3p_parse(AVCodecParserContext *s,
+ AVCodecContext *avctx,
+ const uint8_t **poutbuf, int *poutbuf_size,
+ const uint8_t *buf, int buf_size)
+{
+Atrac3PlusParseContext *ctx = s->priv_data;
+const uint8_t *hdr_buf = buf;
+uint16_t bytes_remain;
+int frame_size, hdr_bytes = 8;
+int next = 0;
+int second_portion_found = 0;
+
+if (s->flags & PARSER_FLAG_COMPLETE_FRAMES || !buf_size) {
+next = buf_size;
+} else {
+if (buf_size >= 2) {
+bytes_remain = AV_RB16(buf);
+
+if (bytes_remain != 0xFD0) {
+second_portion_found = bytes_remain && !ctx->pc.index && 
!ctx->hdr_bytes_needed;
+/* Got something unexpected; either this means we got
+   the second part of a frame and not the first part,
+   or more likely these aren't ATRAC3+ packets in the
+   format we're expecting. For example, it might mean
+   

[FFmpeg-devel] [PATCH 1/1] psmf: add FATE tests

2018-01-01 Thread misty
From: Misty De Meo 

---
 tests/Makefile  |  1 +
 tests/fate/psmf.mak | 23 +++
 2 files changed, 24 insertions(+)
 create mode 100644 tests/fate/psmf.mak

diff --git a/tests/Makefile b/tests/Makefile
index fd3713fe81..c569091fcb 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -165,6 +165,7 @@ include $(SRC_PATH)/tests/fate/pcm.mak
 include $(SRC_PATH)/tests/fate/pixlet.mak
 include $(SRC_PATH)/tests/fate/probe.mak
 include $(SRC_PATH)/tests/fate/prores.mak
+include $(SRC_PATH)/tests/fate/psmf.mak
 include $(SRC_PATH)/tests/fate/qt.mak
 include $(SRC_PATH)/tests/fate/qtrle.mak
 include $(SRC_PATH)/tests/fate/real.mak
diff --git a/tests/fate/psmf.mak b/tests/fate/psmf.mak
new file mode 100644
index 00..d1378c8ac7
--- /dev/null
+++ b/tests/fate/psmf.mak
@@ -0,0 +1,23 @@
+#
+# Test detecting ATRAC-3 audio in Sony MPEG files
+#
+
+PSMF_PROBE_COMMAND = \
+   ffprobe$(PROGSSUF)$(EXESUF) -show_entries stream=codec_name \
+   -select_streams a -print_format default=noprint_wrappers=1 -bitexact -v 0
+
+FATE_PSMF_FFPROBE = fate-psmf-probe-6 \
+   fate-psmf-probe-EV01_01_0500D
+
+fate-psmf-probe-6: SRC = $(TARGET_SAMPLES)/psmf/6.MPS
+fate-psmf-probe-6: CMD = run $(PSMF_PROBE_COMMAND) -i "$(SRC)"
+fate-psmf-probe-6: CMP = oneline
+fate-psmf-probe-6: REF = codec_name=atrac3p
+fate-psmf-probe-EV01_01_0500D: SRC = $(TARGET_SAMPLES)/psmf/EV01_01_0500D.PMF
+fate-psmf-probe-EV01_01_0500D: CMD = run $(PSMF_PROBE_COMMAND) -i "$(SRC)"
+fate-psmf-probe-EV01_01_0500D: CMP = oneline
+fate-psmf-probe-EV01_01_0500D: REF = codec_name=atrac3p
+
+FATE_SAMPLES_FFPROBE += $(FATE_PSMF_FFPROBE)
+
+fate-psmf: $(FATE_PSMF_FFPROBE)
-- 
2.15.1

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


[FFmpeg-devel] [PATCH 0/1] psmf: add FATE tests

2018-01-01 Thread misty
From: Misty De Meo 

Haha, that shows me for copy/pasting from the other tests! Adjusted the
name to something PSMF-specific so it doesn't collide; confirmed both
sets of tests pass now. Updated patch included.

Misty De Meo (1):
  psmf: add FATE tests

 tests/Makefile  |  1 +
 tests/fate/psmf.mak | 23 +++
 2 files changed, 24 insertions(+)
 create mode 100644 tests/fate/psmf.mak

-- 
2.15.1

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