Re: [FFmpeg-devel] [PATCH] avcodec/h264_ps: use the AVBufferPool API to allocate parameter set buffers

2018-01-21 Thread wm4
On Sun, 21 Jan 2018 03:33:08 +0100
Michael Niedermayer  wrote:

> also a memcmp on the data might be worth looking into to avoid re-parsing of
> unchanged PS
> (theres already a memcmp in libavcodec/h264_ps.c)

That sounds like it'd help much more than a buffer pool.

Anyway, did anyone run benchmarks on this?
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] v4l2_m2m: Fix integer overflow in timestamp handling

2018-01-21 Thread wm4
On Sun, 21 Jan 2018 00:52:18 +
Mark Thompson  wrote:

> ---
> struct timeval elements are not big enough in a 32-bit ABI.
> 
> 
>  libavcodec/v4l2_buffers.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/libavcodec/v4l2_buffers.c b/libavcodec/v4l2_buffers.c
> index 8e4d4d1..aef911f 100644
> --- a/libavcodec/v4l2_buffers.c
> +++ b/libavcodec/v4l2_buffers.c
> @@ -69,7 +69,8 @@ static inline uint64_t v4l2_get_pts(V4L2Buffer *avbuf)
>  int64_t v4l2_pts;
>  
>  /* convert pts back to encoder timebase */
> -v4l2_pts = avbuf->buf.timestamp.tv_sec * USEC_PER_SEC + 
> avbuf->buf.timestamp.tv_usec;
> +v4l2_pts = (int64_t)avbuf->buf.timestamp.tv_sec * USEC_PER_SEC +
> +avbuf->buf.timestamp.tv_usec;
>  
>  return av_rescale_q(v4l2_pts, v4l2_timebase, s->avctx->time_base);
>  }

LGTM.

(By god, did they really have to use struct timeval for video
timestamps...)
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 1/3] avutil: add staticpool

2018-01-21 Thread wm4
On Sun, 21 Jan 2018 10:24:21 +0700
Muhammad Faiz  wrote:

> >  I don't trust the atomics use
> > either, I'm don't want to have to debug that ever.  
> 
> Of course, using atomics is more complicated that using mutex (with
> benefits that it will be faster when properly used).
> But it is not a valid reason to avoid using atomic because it is more
> complicated.

Sure, but it also means it should be really be confined to cases where
it _really_ helps with performance.

Where is this a bottleneck at all?

I also think that this really belongs into a malloc implementation
instead. You might also want to try "alternative" malloc
implementations like jemalloc.

Another bad point is that this will make interaction with memory
debuggers worse. (They can't track whether the memory is considered
allocated or free.)
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] configure: Fix checking external non-free libraries

2018-01-21 Thread Thilo Borgmann
Hi,

fixes rejection of non-free libraries if "--enable-nonfree" is omitted for me.

Git blame says this line is older than 10 months... is it for some reason the 
expected behaviour?

-Thilo
From 6fcb95d0094341149e865982b00cb763f99a92a3 Mon Sep 17 00:00:00 2001
From: Thilo Borgmann 
Date: Sun, 21 Jan 2018 13:22:53 +0100
Subject: [PATCH] configure: Fix checking external non-free libraries

---
 configure | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/configure b/configure
index 5d53362..8532c25 100755
--- a/configure
+++ b/configure
@@ -3773,7 +3773,7 @@ map "die_license_disabled gpl"  
$EXTERNAL_LIBRARY_GPL_LIST $EXTERNAL_LIBRARY
 map "die_license_disabled version3" $EXTERNAL_LIBRARY_VERSION3_LIST 
$EXTERNAL_LIBRARY_GPLV3_LIST
 
 enabled gpl && map "die_license_disabled_gpl nonfree" 
$EXTERNAL_LIBRARY_NONFREE_LIST
-map "die_license_disabled nonfree" $HWACCEL_LIBRARY_NONFREE_LIST
+map "die_license_disabled nonfree" $HWACCEL_LIBRARY_NONFREE_LIST 
$EXTERNAL_LIBRARY_NONFREE_LIST
 
 enabled version3 && { enabled gpl && enable gplv3 || enable lgplv3; }
 
-- 
2.9.3

___
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-21 Thread Kieran Kunhya
On Mon, Jan 1, 2018 at 7:01 PM, Michael Niedermayer 
wrote:

> Hi


Patch updated.
Some of the review comments I decided not to implement in order to keep
closer to the spec.

Regards,
Kieran Kunhya


0001-mpeg4video-Add-support-for-MPEG-4-Simple-Studio-Prof.patch
Description: Binary data
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] configure: Fix checking external non-free libraries

2018-01-21 Thread Gyan Doshi

On 1/21/2018 6:01 PM, Thilo Borgmann wrote:

Hi,

fixes rejection of non-free libraries if "--enable-nonfree" is omitted for me.

Git blame says this line is older than 10 months... is it for some reason the 
expected behaviour?

-Thilo



LICENSE.md says

"The Fraunhofer FDK AAC and OpenSSL libraries are under licenses which 
are incompatible with the GPLv2 and v3. To the best of our knowledge, 
they are compatible with the LGPL."


Both those libraries are in EXTERNAL_LIBRARY_NONFREE_LIST but at 
present, when configuring with license LPGL, they can be included (I've 
only checked configure with FDK AAC enabled).


With this patch, looks like that won't be possible. Maybe these two libs 
can be moved to a separate list, say, "EXTERNAL_LIBRARY_LGPL_ONLY_LIST" 
and /configure adapted.


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


Re: [FFmpeg-devel] [PATCH] configure: Fix checking external non-free libraries

2018-01-21 Thread Carl Eugen Hoyos
2018-01-21 13:31 GMT+01:00 Thilo Borgmann :

> fixes rejection of non-free libraries if "--enable-nonfree" is omitted for me.

The LGPL allows you to link against a non-compatible library and
distribute the resulting binary.

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-21 Thread Carl Eugen Hoyos
2018-01-21 13:37 GMT+01:00 Kieran Kunhya :
> On Mon, Jan 1, 2018 at 7:01 PM, Michael Niedermayer wrote:
>
>> Hi
>
> Patch updated.

If you choose to ignore more than half of the comments made,
please at least answer the review to explain why you
believe the comments were not helpful.

> Some of the review comments I decided not to implement
> in order to keep closer to the spec.

We have agreed in the past (on trac) that specifications
are not necessarily written with the intention to allow
writing good implementations, so I am not convinced
this is a sufficient argumentation.

The patch does not apply (and is not trivial to fix), Carl Eugen
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] configure: Fix checking external non-free libraries

2018-01-21 Thread Thilo Borgmann
Am 21.01.18 um 13:43 schrieb Carl Eugen Hoyos:
> 2018-01-21 13:31 GMT+01:00 Thilo Borgmann :
> 
>> fixes rejection of non-free libraries if "--enable-nonfree" is omitted for 
>> me.
> 
> The LGPL allows you to link against a non-compatible library and
> distribute the resulting binary.

So if the current behavior is indeed intended, please ignore that patch.

-Thilo
___
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-21 Thread Kieran Kunhya
On Sun, Jan 21, 2018 at 12:53 PM, Carl Eugen Hoyos 
wrote:

> 2018-01-21 13:37 GMT+01:00 Kieran Kunhya :
> > On Mon, Jan 1, 2018 at 7:01 PM, Michael Niedermayer wrote:
> >
> >> Hi
> >
> > Patch updated.
>
> If you choose to ignore more than half of the comments made,
> please at least answer the review to explain why you
> believe the comments were not helpful.
>
> > Some of the review comments I decided not to implement
> > in order to keep closer to the spec.
>
> We have agreed in the past (on trac) that specifications
> are not necessarily written with the intention to allow
> writing good implementations, so I am not convinced
> this is a sufficient argumentation.
>

Ok, well I only did not implement a couple.
The startcode one conflates studio start codes with mpeg4 start codes.
The show_bits one I'd rather keep it as per the spec.
The n&1 comment the compiler should be able to deal with and not speed
critical.

The patch does not apply (and is not trivial to fix), Carl Eugen
>

Patch depends on
[PATCH] simple_idct: Template functions to support an input bitdepth
parameter

Kieran
___
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-21 Thread Carl Eugen Hoyos
2018-01-21 14:03 GMT+01:00 Kieran Kunhya :
> On Sun, Jan 21, 2018 at 12:53 PM, Carl Eugen Hoyos 
> wrote:
>
>> 2018-01-21 13:37 GMT+01:00 Kieran Kunhya :
>> > On Mon, Jan 1, 2018 at 7:01 PM, Michael Niedermayer wrote:
>> >
>> >> Hi
>> >
>> > Patch updated.
>>
>> If you choose to ignore more than half of the comments made,
>> please at least answer the review to explain why you
>> believe the comments were not helpful.
>>
>> > Some of the review comments I decided not to implement
>> > in order to keep closer to the spec.
>>
>> We have agreed in the past (on trac) that specifications
>> are not necessarily written with the intention to allow
>> writing good implementations, so I am not convinced
>> this is a sufficient argumentation.
>>
> Ok, well I only did not implement a couple.

> The startcode one conflates studio start codes with mpeg4 start codes.

(Looking up "conflate" did not help me here...)

> The show_bits one I'd rather keep it as per the spec.

You don't agree that the code gets more readable if
you can reduce the number of commands by reordering?

> The n&1 comment the compiler should be able to deal with

Wishful thinking?

> and not speed critical.

I thought this is about readability...

>> The patch does not apply (and is not trivial to fix), Carl Eugen
>>
> Patch depends on
> [PATCH] simple_idct: Template functions to support an input bitdepth
> parameter

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-21 Thread Kieran Kunhya
On Sun, Jan 21, 2018 at 1:08 PM, Carl Eugen Hoyos 
wrote:

> 2018-01-21 14:03 GMT+01:00 Kieran Kunhya :
> > On Sun, Jan 21, 2018 at 12:53 PM, Carl Eugen Hoyos 
> > wrote:
> >
> >> 2018-01-21 13:37 GMT+01:00 Kieran Kunhya :
> >> > On Mon, Jan 1, 2018 at 7:01 PM, Michael Niedermayer wrote:
> >> >
> >> >> Hi
> >> >
> >> > Patch updated.
> >>
> >> If you choose to ignore more than half of the comments made,
> >> please at least answer the review to explain why you
> >> believe the comments were not helpful.
> >>
> >> > Some of the review comments I decided not to implement
> >> > in order to keep closer to the spec.
> >>
> >> We have agreed in the past (on trac) that specifications
> >> are not necessarily written with the intention to allow
> >> writing good implementations, so I am not convinced
> >> this is a sufficient argumentation.
> >>
> > Ok, well I only did not implement a couple.
>
> > The startcode one conflates studio start codes with mpeg4 start codes.
>
> (Looking up "conflate" did not help me here...)
>

They are not the same start codes and the spec specifically says search for
new start codes (i.e there can be padding data of some sort).

>
> > The show_bits one I'd rather keep it as per the spec.
>
> You don't agree that the code gets more readable if
> you can reduce the number of commands by reordering?
>

I personally would like to see the code and spec be understandable together.

> The n&1 comment the compiler should be able to deal with


I will be committing this patch soon.

Kieran
___
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-21 Thread Carl Eugen Hoyos
2018-01-21 14:22 GMT+01:00 Kieran Kunhya :

> I will be committing this patch soon.

?

Can you reproduce the following issue that I see here?
When testing with ffplay, in ~50% of tries, videos look fine,
in other cases, I get a monochrome unchanging image
and the following repeated error message:
[mpeg4 @ 0x7fbba8076200] concealing 8159 DC, 8159 AC, 8159 MV errors in I frame
(race condition?)

Additionally, for the SR422 sample, I get the following warning:
DPCM encoded block is not implemented

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-21 Thread Kieran Kunhya
On Sun, Jan 21, 2018 at 1:30 PM, Carl Eugen Hoyos 
wrote:

> 2018-01-21 14:22 GMT+01:00 Kieran Kunhya :
>
> Can you reproduce the following issue that I see here?
> When testing with ffplay, in ~50% of tries, videos look fine,
> in other cases, I get a monochrome unchanging image
> and the following repeated error message:
> [mpeg4 @ 0x7fbba8076200] concealing 8159 DC, 8159 AC, 8159 MV errors in I
> frame
> (race condition?)
>

I cannot reproduce this. Please provide full uncut console output provided
by ffmpeg.


> Additionally, for the SR422 sample, I get the following warning:
> DPCM encoded block is not implemented


That is intentional, I intend to submit a separate patch for DPCM model
___
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-21 Thread Carl Eugen Hoyos
2018-01-21 14:33 GMT+01:00 Kieran Kunhya :
> On Sun, Jan 21, 2018 at 1:30 PM, Carl Eugen Hoyos 
> wrote:
>
>> 2018-01-21 14:22 GMT+01:00 Kieran Kunhya :
>>
>> Can you reproduce the following issue that I see here?
>> When testing with ffplay, in ~50% of tries, videos look fine,
>> in other cases, I get a monochrome unchanging image
>> and the following repeated error message:
>> [mpeg4 @ 0x7fbba8076200] concealing 8159 DC, 8159 AC, 8159 MV errors in I
>> frame
>> (race condition?)
>>
> I cannot reproduce this. Please provide full uncut console output provided
> by ffmpeg.

Only reproducible with ffplay:

$ ffplay A004C001_SR_444_HD_23.98p.mxf -autoexit
ffplay version N-89861-g78e884f Copyright (c) 2003-2018 the FFmpeg developers
  built with gcc 4.7 (SUSE Linux)
  configuration:
  libavutil  56.  7.100 / 56.  7.100
  libavcodec 58.  9.100 / 58.  9.100
  libavformat58.  5.100 / 58.  5.100
  libavdevice58.  0.101 / 58.  0.101
  libavfilter 7. 11.101 /  7. 11.101
  libswscale  5.  0.101 /  5.  0.101
  libswresample   3.  0.101 /  3.  0.101
Input #0, mxf, from 'A004C001_SR_444_HD_23.98p.mxf':
  Metadata:
product_uid : cede1104-8280-11de-8a39-08004678031c
uid : e36c4e4a-94e8-4aaa-800b-05cf0ab47eba
generation_uid  : e97e70fa-3cfa-4fd9-b2cb-0a8785530d32
company_name: Sony
product_name: Mem
product_version : 1.0
application_platform: Sony MXF Development Kit (MacOS X)
modification_date: 2013-10-26T19:07:38.00Z
material_package_umid:
0x060A2B340101010501010D4313002D9906CC916505D908004602026A87CD
timecode: 00:05:07:16
  Duration: 00:00:08.17, start: 0.00, bitrate: 371542 kb/s
Stream #0:0: Video: mpeg4 (Simple Studio Profile),
gbrp10le(progressive), 1920x1088 [SAR 1:1 DAR 30:17], SAR 136:135 DAR
16:9, 23.98 fps, 23.98 tbr, 23.98 tbn, 23.98 tbc
Metadata:
  file_package_umid:
0x060A2B340101010501010D4313002E9906CC916505D908004602026A87CD
  file_package_name:/
Stream #0:1: Audio: pcm_s24le, 48000 Hz, 1 channels, s32 (24 bit), 1152 kb/s
Metadata:
  file_package_umid:
0x060A2B340101010501010D4313002E9906CC916505D908004602026A87CD
  file_package_name:/
Stream #0:2: Audio: pcm_s24le, 48000 Hz, 1 channels, s32 (24 bit), 1152 kb/s
Metadata:
  file_package_umid:
0x060A2B340101010501010D4313002E9906CC916505D908004602026A87CD
  file_package_name:/
Stream #0:3: Audio: pcm_s24le, 48000 Hz, 1 channels, s32 (24 bit), 1152 kb/s
Metadata:
  file_package_umid:
0x060A2B340101010501010D4313002E9906CC916505D908004602026A87CD
  file_package_name:/
Stream #0:4: Audio: pcm_s24le, 48000 Hz, 1 channels, s32 (24 bit), 1152 kb/s
Metadata:
  file_package_umid:
0x060A2B340101010501010D4313002E9906CC916505D908004602026A87CD
  file_package_name:/
Stream #0:5: Audio: pcm_s24le, 48000 Hz, 1 channels, s32 (24 bit), 1152 kb/s
Metadata:
  file_package_umid:
0x060A2B340101010501010D4313002E9906CC916505D908004602026A87CD
  file_package_name:/
Stream #0:6: Audio: pcm_s24le, 48000 Hz, 1 channels, s32 (24 bit), 1152 kb/s
Metadata:
  file_package_umid:
0x060A2B340101010501010D4313002E9906CC916505D908004602026A87CD
  file_package_name:/
Stream #0:7: Audio: pcm_s24le, 48000 Hz, 1 channels, s32 (24 bit), 1152 kb/s
Metadata:
  file_package_umid:
0x060A2B340101010501010D4313002E9906CC916505D908004602026A87CD
  file_package_name:/
Stream #0:8: Audio: pcm_s24le, 48000 Hz, 1 channels, s32 (24 bit), 1152 kb/s
Metadata:
  file_package_umid:
0x060A2B340101010501010D4313002E9906CC916505D908004602026A87CD
  file_package_name:/
Stream #0:9: Data: none
Metadata:
  file_package_umid:
0x060A2B340101010501010D4313002E9906CC916505D908004602026A87CD
  file_package_name:/
  data_type   : vbi_vanc_smpte_436M
[mpeg4 @ 0x7f8ec0076480] concealing 8159 DC, 8159 AC, 8159 MV errors in I frame
[mpeg4 @ 0x7f8ec00846c0] concealing 8159 DC, 8159 AC, 8159 MV errors in I frame
[mpeg4 @ 0x7f8ec0088840] concealing 8159 DC, 8159 AC, 8159 MV errors in I frame
[mpeg4 @ 0x7f8ec008c9c0] concealing 8159 DC, 8159 AC, 8159 MV errors in I frame
[mpeg4 @ 0x7f8ec0090b40] concealing 8159 DC, 8159 AC, 8159 MV errors in I frame
[mpeg4 @ 0x7f8ec0094cc0] concealing 8159 DC, 8159 AC, 8159 MV errors in I frame
[mpeg4 @ 0x7f8ec0098e40] concealing 8159 DC, 8159 AC, 8159 MV errors in I frame
[mpeg4 @ 0x7f8ec009cfc0] concealing 8159 DC, 8159 AC, 8159 MV errors in I frame
[mpeg4 @ 0x7f8ec00a1140] concealing 8159 DC, 8159 AC, 8159 MV errors in I frame
[mpeg4 @ 0x7f8ec0076480] concealing 8159 DC, 8159 AC, 8159 MV errors in I frame
[mpeg4 @ 0x7f8ec00846c0] concealing 8159 DC, 8159 AC, 8159 MV errors in I frame
[mpeg4 @ 0x7f8ec0088840] concealing 8159 DC, 8159 AC, 8159 MV errors in I frame
[mpeg4 @ 0x7f8ec008c9c0] concealing 8159 DC,

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

2018-01-21 Thread Kieran Kunhya
On Sun, Jan 21, 2018 at 1:42 PM, Carl Eugen Hoyos 
wrote:

> 2018-01-21 14:33 GMT+01:00 Kieran Kunhya :
> > On Sun, Jan 21, 2018 at 1:30 PM, Carl Eugen Hoyos 
> > wrote:
> >
> >> 2018-01-21 14:22 GMT+01:00 Kieran Kunhya :
> >>
> >> Can you reproduce the following issue that I see here?
> >> When testing with ffplay, in ~50% of tries, videos look fine,
> >> in other cases, I get a monochrome unchanging image
> >> and the following repeated error message:
> >> [mpeg4 @ 0x7fbba8076200] concealing 8159 DC, 8159 AC, 8159 MV errors in
> I
> >> frame
> >> (race condition?)
> >>
> > I cannot reproduce this. Please provide full uncut console output
> provided
> > by ffmpeg.
>
> Only reproducible with ffplay:


What makes you think this is not an ffplay bug?

Kieran
___
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-21 Thread Carl Eugen Hoyos
2018-01-21 14:57 GMT+01:00 Kieran Kunhya :
> On Sun, Jan 21, 2018 at 1:42 PM, Carl Eugen Hoyos 
> wrote:
>
>> 2018-01-21 14:33 GMT+01:00 Kieran Kunhya :
>> > On Sun, Jan 21, 2018 at 1:30 PM, Carl Eugen Hoyos 
>> > wrote:
>> >
>> >> 2018-01-21 14:22 GMT+01:00 Kieran Kunhya :
>> >>
>> >> Can you reproduce the following issue that I see here?
>> >> When testing with ffplay, in ~50% of tries, videos look fine,
>> >> in other cases, I get a monochrome unchanging image
>> >> and the following repeated error message:
>> >> [mpeg4 @ 0x7fbba8076200] concealing 8159 DC, 8159 AC, 8159 MV
>> >> errors in I frame
>> >> (race condition?)
>> >>
>> > I cannot reproduce this. Please provide full uncut console output
>> > provided by ffmpeg.
>>
>> Only reproducible with ffplay:
>
> What makes you think this is not an ffplay bug?

Only that I can not reproduce without your patch (and that I have
never seen this issue before).

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-21 Thread Kieran Kunhya
>
> Only that I can not reproduce without your patch (and that I have
> never seen this issue before).
>
> Carl Eugen
>

I cannot reproduce this issue with ffplay on Ubuntu Linux.
I would recommend running "make distclean" and recompiling.

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


Re: [FFmpeg-devel] [PATCH] avcodec/h264_ps: use the AVBufferPool API to allocate parameter set buffers

2018-01-21 Thread James Almer
On 1/21/2018 9:12 AM, wm4 wrote:
> On Sun, 21 Jan 2018 03:33:08 +0100
> Michael Niedermayer  wrote:
> 
>> also a memcmp on the data might be worth looking into to avoid re-parsing of
>> unchanged PS
>> (theres already a memcmp in libavcodec/h264_ps.c)
> 
> That sounds like it'd help much more than a buffer pool.
> 
> Anyway, did anyone run benchmarks on this?

Do you have a raw h264/hevc stream with preferably more than one pps
before every keyframe? Otherwise i don't think there will be much of a
difference in performance.
___
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-21 Thread Carl Eugen Hoyos
2018-01-21 15:34 GMT+01:00 Kieran Kunhya :
>>
>> Only that I can not reproduce without your patch (and that I have
>> never seen this issue before).
>>
>> Carl Eugen
>>
> I cannot reproduce this issue with ffplay on Ubuntu Linux.
> I would recommend running "make distclean" and recompiling.

My last test was done with "make distclean".

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


Re: [FFmpeg-devel] [PATCH]lavc/svq3: Do not write into const memory

2018-01-21 Thread Tomas Härdin
fre 2018-01-19 klockan 19:19 +0100 skrev Carl Eugen Hoyos:
> 2018-01-19 16:54 GMT+01:00 Tomas Härdin :
> > On 2018-01-18 23:34, Carl Eugen Hoyos wrote:
> > > 
> > > Hi!
> > > 
> > > Attached patch fixes a warning, I suspect it makes the code more
> > > correct.
> > > 
> > > Please comment, Carl Eugen
> > > 
> > > --- a/libavcodec/svq3.c
> > > +++ b/libavcodec/svq3.c
> > > @@ -1048,12 +1048,12 @@ static int
> > > svq3_decode_slice_header(AVCodecContext
> > > *avctx)
> > >   }
> > >   memcpy(s->slice_buf, s->gb.buffer + s->gb.index / 8,
> > > slice_bytes);
> > >   -init_get_bits(&s->gb_slice, s->slice_buf, slice_bits);
> > 
> > Unrelated change?
> 
> No, it is an intended move.
> 
> > >   if (s->watermark_key) {
> > > -uint32_t header = AV_RL32(&s->gb_slice.buffer[1]);
> > > -AV_WL32(&s->gb_slice.buffer[1], header ^ s-
> > > >watermark_key);
> > 
> > Strange that this didn't manage to break anything, or that the
> > compiler
> > let it through
> 
> A compiler's warning that gets fixed is the reason for this patch but
> I apparently misunderstand your comment.
> 
> > > +uint32_t header = AV_RL32(&s->slice_buf[1]);
> > > +AV_WL32(&s->slice_buf[1], header ^ s-
> > > >watermark_key);
> > 
> > Considering the memcpy() above, either this or the old code must be
> > wrong.
> 
> Why do you think so?
> (I do consider the old code "wrong", that is why I sent this patch.)
> 
> > My guess is the old code must have been wrong, since to fiddle
> > the same bits this AV_WL32() would need to set
> > &s->slice_buf[1 - s->gb.index / 8]...
> 
> I was hoping that the same bits get fiddled given that I call the
> same macro / function...

No I was confusing myself. Your patch looks fine. With these changes
slice_buf is twiddled into the right state *before* init_get_bits(),
which makes sense.

/Tomas

signature.asc
Description: This is a digitally signed message part
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH 0/7] add AVFormatContext->url to replace the length limited filename field

2018-01-21 Thread Marton Balint
Here is a rebased version of the patch series on top of the current git master,
if I get no further comments, I will apply this in a week.

The conversion was mostly straightforward, but there were some cases where it
needed additional work, so I'd really appriciate if someone could test at least
the HLS changes.

The patch series does not remove all fixed-length buffers used for filenames
all around the codebase, that is for later.

Marton Balint (7):
  avformat/hlsenc: use av_bprintf without buffer limit in
replace_int_data_in_filename
  avformat: add url field to AVFormatContext
  fftools, tools, examples: migrate to AVFormatContext->url
  avdevice: migrate to AVFormatContext->url
  avformat/hls: migrate to AVFormatContext->url
  avformat: migrate to AVFormatContext->url
  avformat: deprecate AVFormatContext filename field

 doc/APIchanges   |   7 ++
 doc/examples/transcode_aac.c |   7 +-
 fftools/ffmpeg.c |  16 +--
 fftools/ffmpeg_opt.c |   8 +-
 fftools/ffplay.c |   6 +-
 fftools/ffprobe.c|   2 +-
 libavdevice/alsa.c   |   4 +-
 libavdevice/avfoundation.m   |   2 +-
 libavdevice/bktr.c   |   2 +-
 libavdevice/caca.c   |   2 +-
 libavdevice/decklink_common.cpp  |   2 +-
 libavdevice/decklink_dec.cpp |   4 +-
 libavdevice/decklink_enc.cpp |   4 +-
 libavdevice/dshow.c  |   2 +-
 libavdevice/fbdev_dec.c  |   4 +-
 libavdevice/fbdev_enc.c  |   4 +-
 libavdevice/gdigrab.c|   2 +-
 libavdevice/iec61883.c   |   8 +-
 libavdevice/jack.c   |   6 +-
 libavdevice/lavfi.c  |   2 +-
 libavdevice/libcdio.c|   6 +-
 libavdevice/libndi_newtek_dec.c  |   2 +-
 libavdevice/libndi_newtek_enc.c  |   4 +-
 libavdevice/openal-dec.c |   2 +-
 libavdevice/opengl_enc.c |   2 +-
 libavdevice/oss_dec.c|   2 +-
 libavdevice/oss_enc.c|   2 +-
 libavdevice/pulse_audio_dec.c|   4 +-
 libavdevice/pulse_audio_enc.c|   4 +-
 libavdevice/sdl2.c   |   2 +-
 libavdevice/sndio_dec.c  |   2 +-
 libavdevice/sndio_enc.c  |   2 +-
 libavdevice/v4l2.c   |  16 +--
 libavdevice/v4l2enc.c|   4 +-
 libavdevice/vfwcap.c |   4 +-
 libavdevice/xcbgrab.c|   8 +-
 libavdevice/xv.c |   2 +-
 libavformat/avformat.h   |  20 
 libavformat/concatdec.c  |   4 +-
 libavformat/dashenc.c|  16 +--
 libavformat/fifo.c   |   8 +-
 libavformat/flvenc.c |   4 +-
 libavformat/gxfenc.c |   4 +-
 libavformat/hdsenc.c |  24 ++--
 libavformat/hls.c|   4 +-
 libavformat/hlsenc.c | 245 +--
 libavformat/img2dec.c|   4 +-
 libavformat/img2enc.c|   4 +-
 libavformat/internal.h   |   7 ++
 libavformat/matroskadec.c|   4 +-
 libavformat/mlvdec.c |   4 +-
 libavformat/mov.c|   2 +-
 libavformat/movenc.c |  10 +-
 libavformat/mpeg.c   |   4 +-
 libavformat/mpegtsenc.c  |   2 +-
 libavformat/mux.c|  21 +++-
 libavformat/options.c|   2 +-
 libavformat/rtsp.c   |  18 ++-
 libavformat/rtspdec.c|   4 +-
 libavformat/rtspenc.c|   4 +-
 libavformat/sapdec.c |   2 +-
 libavformat/sapenc.c |  10 +-
 libavformat/sdp.c|   4 +-
 libavformat/segment.c|  36 +++---
 libavformat/smoothstreamingenc.c |  12 +-
 libavformat/tee.c|   4 +-
 libavformat/utils.c  |  24 +++-
 libavformat/version.h|   5 +-
 libavformat/webm_chunk.c |  10 +-
 tools/uncoded_frame.c|   2 +-
 70 files changed, 409 insertions(+), 281 deletions(-)

-- 
2.13.6

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


[FFmpeg-devel] [PATCH 1/7] avformat/hlsenc: use av_bprintf without buffer limit in replace_int_data_in_filename

2018-01-21 Thread Marton Balint
In preparation for the deprecation of AVFormatContext->filename.

Signed-off-by: Marton Balint 
---
 libavformat/hlsenc.c | 113 ++-
 1 file changed, 58 insertions(+), 55 deletions(-)

diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index 42e437f5d1..e581eda5bf 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -342,14 +342,17 @@ fail:
 return;
 }
 
-static int replace_int_data_in_filename(char *buf, int buf_size, const char 
*filename, char placeholder, int64_t number)
+static int replace_int_data_in_filename(char **s, const char *filename, char 
placeholder, int64_t number)
 {
 const char *p;
-char *q, buf1[20], c;
-int nd, len, addchar_count;
+char *new_filename;
+char c;
+int nd, addchar_count;
 int found_count = 0;
+AVBPrint buf;
+
+av_bprint_init(&buf, 0, AV_BPRINT_SIZE_UNLIMITED);
 
-q = buf;
 p = filename;
 for (;;) {
 c = *p;
@@ -366,13 +369,7 @@ static int replace_int_data_in_filename(char *buf, int 
buf_size, const char *fil
 }
 
 if (*(p + addchar_count) == placeholder) {
-len = snprintf(buf1, sizeof(buf1), "%0*"PRId64, (number < 0) ? 
nd : nd++, number);
-if (len < 1)  // returned error or empty buf1
-goto fail;
-if ((q - buf + len) > buf_size - 1)
-goto fail;
-memcpy(q, buf1, len);
-q += len;
+av_bprintf(&buf, "%0*"PRId64, (number < 0) ? nd : nd++, 
number);
 p += (addchar_count + 1);
 addchar_count = 0;
 found_count++;
@@ -381,17 +378,17 @@ static int replace_int_data_in_filename(char *buf, int 
buf_size, const char *fil
 } else
 addchar_count = 1;
 
-while (addchar_count--)
-if ((q - buf) < buf_size - 1)
-*q++ = *p++;
-else
-goto fail;
+av_bprint_append_data(&buf, p, addchar_count);
+p += addchar_count;
 }
-*q = '\0';
+if (!av_bprint_is_complete(&buf)) {
+av_bprint_finalize(&buf, NULL);
+return -1;
+}
+if (av_bprint_finalize(&buf, &new_filename) < 0 || !new_filename)
+return -1;
+*s = new_filename;
 return found_count;
-fail:
-*q = '\0';
-return -1;
 }
 
 static void write_styp(AVIOContext *pb)
@@ -803,13 +800,8 @@ static int sls_flags_filename_process(struct 
AVFormatContext *s, HLSContext *hls
 strlen(vs->current_segment_final_filename_fmt)) {
 av_strlcpy(vs->avf->filename, vs->current_segment_final_filename_fmt, 
sizeof(vs->avf->filename));
 if (hls->flags & HLS_SECOND_LEVEL_SEGMENT_SIZE) {
-char * filename = av_strdup(vs->avf->filename);  // %%s will be %s 
after strftime
-if (!filename) {
-av_free(en);
-return AVERROR(ENOMEM);
-}
-if (replace_int_data_in_filename(vs->avf->filename, 
sizeof(vs->avf->filename),
-filename, 's', pos + size) < 1) {
+char *filename = NULL;
+if (replace_int_data_in_filename(&filename, vs->avf->filename, 
's', pos + size) < 1) {
 av_log(hls, AV_LOG_ERROR,
"Invalid second level segment filename template '%s', "
 "you can try to remove second_level_segment_size 
flag\n",
@@ -818,16 +810,13 @@ static int sls_flags_filename_process(struct 
AVFormatContext *s, HLSContext *hls
 av_free(en);
 return AVERROR(EINVAL);
 }
+av_strlcpy(vs->avf->filename, filename, sizeof(vs->avf->filename));
 av_free(filename);
 }
 if (hls->flags & HLS_SECOND_LEVEL_SEGMENT_DURATION) {
-char * filename = av_strdup(vs->avf->filename);  // %%t will be %t 
after strftime
-if (!filename) {
-av_free(en);
-return AVERROR(ENOMEM);
-}
-if (replace_int_data_in_filename(vs->avf->filename, 
sizeof(vs->avf->filename),
-filename, 't',  (int64_t)round(duration * 
HLS_MICROSECOND_UNIT)) < 1) {
+char *filename = NULL;
+if (replace_int_data_in_filename(&filename, vs->avf->filename,
+'t',  (int64_t)round(duration * HLS_MICROSECOND_UNIT)) < 1) {
 av_log(hls, AV_LOG_ERROR,
"Invalid second level segment filename template '%s', "
 "you can try to remove second_level_segment_time 
flag\n",
@@ -836,6 +825,7 @@ static int sls_flags_filename_process(struct 
AVFormatContext *s, HLSContext *hls
 av_free(en);
 return AVERROR(EINVAL);
 }
+av_strlcpy(vs->avf->filename, filename, sizeof(vs->avf->filename));
 av_free(filename);
 }
 }
@@ -895,14 +885,12 @@ static void sls_fl

[FFmpeg-devel] [PATCH 3/7] fftools, tools, examples: migrate to AVFormatContext->url

2018-01-21 Thread Marton Balint
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(-)

diff --git a/doc/examples/transcode_aac.c b/doc/examples/transcode_aac.c
index 9fd5c00d60..3c7688cd33 100644
--- a/doc/examples/transcode_aac.c
+++ b/doc/examples/transcode_aac.c
@@ -171,8 +171,11 @@ static int open_output_file(const char *filename,
 goto cleanup;
 }
 
-av_strlcpy((*output_format_context)->filename, filename,
-   sizeof((*output_format_context)->filename));
+if (!((*output_format_context)->url = av_strdup(filename))) {
+fprintf(stderr, "Could not allocate url.\n");
+error = AVERROR(ENOMEM);
+goto cleanup;
+}
 
 /* Find the encoder to be used by its name. */
 if (!(output_codec = avcodec_find_encoder(AV_CODEC_ID_AAC))) {
diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
index 528849a2c6..cded5afebb 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -1560,7 +1560,7 @@ static void print_final_stats(int64_t total_size)
 uint64_t total_packets = 0, total_size = 0;
 
 av_log(NULL, AV_LOG_VERBOSE, "Input file #%d (%s):\n",
-   i, f->ctx->filename);
+   i, f->ctx->url);
 
 for (j = 0; j < f->nb_streams; j++) {
 InputStream *ist = input_streams[f->ist_index + j];
@@ -1594,7 +1594,7 @@ static void print_final_stats(int64_t total_size)
 uint64_t total_packets = 0, total_size = 0;
 
 av_log(NULL, AV_LOG_VERBOSE, "Output file #%d (%s):\n",
-   i, of->ctx->filename);
+   i, of->ctx->url);
 
 for (j = 0; j < of->ctx->nb_streams; j++) {
 OutputStream *ost = output_streams[of->ost_index + j];
@@ -2102,7 +2102,7 @@ static void check_decode_result(InputStream *ist, int 
*got_output, int ret)
 
 if (exit_on_error && *got_output && ist) {
 if (ist->decoded_frame->decode_error_flags || 
(ist->decoded_frame->flags & AV_FRAME_FLAG_CORRUPT)) {
-av_log(NULL, AV_LOG_FATAL, "%s: corrupt decoded frame in stream 
%d\n", input_files[ist->file_index]->ctx->filename, ist->st->index);
+av_log(NULL, AV_LOG_FATAL, "%s: corrupt decoded frame in stream 
%d\n", input_files[ist->file_index]->ctx->url, ist->st->index);
 exit_program(1);
 }
 }
@@ -2986,7 +2986,7 @@ static int check_init_output_file(OutputFile *of, int 
file_index)
 //assert_avoptions(of->opts);
 of->header_written = 1;
 
-av_dump_format(of->ctx, file_index, of->ctx->filename, 1);
+av_dump_format(of->ctx, file_index, of->ctx->url, 1);
 
 if (sdp_filename || want_sdp)
 print_sdp();
@@ -4249,7 +4249,7 @@ static int process_input(int file_index)
 }
 if (ret < 0) {
 if (ret != AVERROR_EOF) {
-print_error(is->filename, ret);
+print_error(is->url, ret);
 if (exit_on_error)
 exit_program(1);
 }
@@ -4298,7 +4298,7 @@ static int process_input(int file_index)
 goto discard_packet;
 
 if (exit_on_error && (pkt.flags & AV_PKT_FLAG_CORRUPT)) {
-av_log(NULL, AV_LOG_FATAL, "%s: corrupt input packet in stream %d\n", 
is->filename, pkt.stream_index);
+av_log(NULL, AV_LOG_FATAL, "%s: corrupt input packet in stream %d\n", 
is->url, pkt.stream_index);
 exit_program(1);
 }
 
@@ -4665,11 +4665,11 @@ static int transcode(void)
 av_log(NULL, AV_LOG_ERROR,
"Nothing was written into output file %d (%s), because "
"at least one of its streams received no packets.\n",
-   i, os->filename);
+   i, os->url);
 continue;
 }
 if ((ret = av_write_trailer(os)) < 0) {
-av_log(NULL, AV_LOG_ERROR, "Error writing trailer of %s: %s\n", 
os->filename, av_err2str(ret));
+av_log(NULL, AV_LOG_ERROR, "Error writing trailer of %s: %s\n", 
os->url, av_err2str(ret));
 if (exit_on_error)
 exit_program(1);
 }
diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c
index 92199b3ac2..997d538381 100644
--- a/fftools/ffmpeg_opt.c
+++ b/fftools/ffmpeg_opt.c
@@ -1271,7 +1271,7 @@ static int choose_encoder(OptionsContext *o, 
AVFormatContext *s, OutputStream *o
 if (type == AVMEDIA_TYPE_VIDEO || type == AVMEDIA_TYPE_AUDIO || type == 
AVMEDIA_TYPE_SUBTITLE) {
 MATCH_PER_STREAM_OPT(codec_names, str, codec_name, s, ost->st);
 if (!codec_name) {
-ost->st->codecpar->codec_id = av_guess_codec(s->oformat, NULL, 
s->filename,
+ost->st->codecpar->codec_id = av_guess_codec(s->oformat, NULL, 
s->url,
  NULL, 
ost->st->codecpar->codec_type

[FFmpeg-devel] [PATCH 4/7] avdevice: migrate to AVFormatContext->url

2018-01-21 Thread Marton Balint
Signed-off-by: Marton Balint 
---
 libavdevice/alsa.c  |  4 ++--
 libavdevice/avfoundation.m  |  2 +-
 libavdevice/bktr.c  |  2 +-
 libavdevice/caca.c  |  2 +-
 libavdevice/decklink_common.cpp |  2 +-
 libavdevice/decklink_dec.cpp|  4 ++--
 libavdevice/decklink_enc.cpp|  4 ++--
 libavdevice/dshow.c |  2 +-
 libavdevice/fbdev_dec.c |  4 ++--
 libavdevice/fbdev_enc.c |  4 ++--
 libavdevice/gdigrab.c   |  2 +-
 libavdevice/iec61883.c  |  8 
 libavdevice/jack.c  |  6 +++---
 libavdevice/lavfi.c |  2 +-
 libavdevice/libcdio.c   |  6 +++---
 libavdevice/libndi_newtek_dec.c |  2 +-
 libavdevice/libndi_newtek_enc.c |  4 ++--
 libavdevice/openal-dec.c|  2 +-
 libavdevice/opengl_enc.c|  2 +-
 libavdevice/oss_dec.c   |  2 +-
 libavdevice/oss_enc.c   |  2 +-
 libavdevice/pulse_audio_dec.c   |  4 ++--
 libavdevice/pulse_audio_enc.c   |  4 ++--
 libavdevice/sdl2.c  |  2 +-
 libavdevice/sndio_dec.c |  2 +-
 libavdevice/sndio_enc.c |  2 +-
 libavdevice/v4l2.c  | 16 +---
 libavdevice/v4l2enc.c   |  4 ++--
 libavdevice/vfwcap.c|  4 ++--
 libavdevice/xcbgrab.c   |  8 
 libavdevice/xv.c|  2 +-
 31 files changed, 59 insertions(+), 57 deletions(-)

diff --git a/libavdevice/alsa.c b/libavdevice/alsa.c
index 1bbff30d5c..1b21beb6d5 100644
--- a/libavdevice/alsa.c
+++ b/libavdevice/alsa.c
@@ -177,8 +177,8 @@ av_cold int ff_alsa_open(AVFormatContext *ctx, 
snd_pcm_stream_t mode,
 snd_pcm_uframes_t buffer_size, period_size;
 uint64_t layout = ctx->streams[0]->codecpar->channel_layout;
 
-if (ctx->filename[0] == 0) audio_device = "default";
-else   audio_device = ctx->filename;
+if (ctx->url[0] == 0) audio_device = "default";
+else  audio_device = ctx->url;
 
 if (*codec_id == AV_CODEC_ID_NONE)
 *codec_id = DEFAULT_CODEC_ID;
diff --git a/libavdevice/avfoundation.m b/libavdevice/avfoundation.m
index e2ddf47dbe..a540f6a079 100644
--- a/libavdevice/avfoundation.m
+++ b/libavdevice/avfoundation.m
@@ -259,7 +259,7 @@ static void destroy_context(AVFContext* ctx)
 static void parse_device_name(AVFormatContext *s)
 {
 AVFContext *ctx = (AVFContext*)s->priv_data;
-char *tmp = av_strdup(s->filename);
+char *tmp = av_strdup(s->url);
 char *save;
 
 if (tmp[0] != ':') {
diff --git a/libavdevice/bktr.c b/libavdevice/bktr.c
index 418247dc4e..993cc19ac7 100644
--- a/libavdevice/bktr.c
+++ b/libavdevice/bktr.c
@@ -294,7 +294,7 @@ static int grab_read_header(AVFormatContext *s1)
 st->codecpar->height = s->height;
 st->avg_frame_rate = framerate;
 
-if (bktr_init(s1->filename, s->width, s->height, s->standard,
+if (bktr_init(s1->url, s->width, s->height, s->standard,
   &s->video_fd, &s->tuner_fd, -1, 0.0) < 0) {
 ret = AVERROR(EIO);
 goto out;
diff --git a/libavdevice/caca.c b/libavdevice/caca.c
index 93cc0ffd25..47de8247dc 100644
--- a/libavdevice/caca.c
+++ b/libavdevice/caca.c
@@ -178,7 +178,7 @@ static int caca_write_header(AVFormatContext *s)
 }
 
 if (!c->window_title)
-c->window_title = av_strdup(s->filename);
+c->window_title = av_strdup(s->url);
 caca_set_display_title(c->display, c->window_title);
 caca_set_display_time(c->display, av_rescale_q(1, st->codec->time_base, 
AV_TIME_BASE_Q));
 
diff --git a/libavdevice/decklink_common.cpp b/libavdevice/decklink_common.cpp
index d1576b8553..da414ed5f8 100644
--- a/libavdevice/decklink_common.cpp
+++ b/libavdevice/decklink_common.cpp
@@ -404,7 +404,7 @@ int ff_decklink_list_formats(AVFormatContext *avctx, 
decklink_direction_t direct
 }
 
 av_log(avctx, AV_LOG_INFO, "Supported formats for 
'%s':\n\tformat_code\tdescription",
-   avctx->filename);
+   avctx->url);
 while (itermode->Next(&mode) == S_OK) {
 BMDTimeValue tb_num, tb_den;
 mode->GetFrameRate(&tb_num, &tb_den);
diff --git a/libavdevice/decklink_dec.cpp b/libavdevice/decklink_dec.cpp
index a69e28680b..5c116f2d13 100644
--- a/libavdevice/decklink_dec.cpp
+++ b/libavdevice/decklink_dec.cpp
@@ -951,7 +951,7 @@ av_cold int ff_decklink_read_header(AVFormatContext *avctx)
 cctx->raw_format = MKBETAG('v','2','1','0');
 }
 
-strcpy (fname, avctx->filename);
+av_strlcpy(fname, avctx->url, sizeof(fname));
 tmp=strchr (fname, '@');
 if (tmp != NULL) {
 av_log(avctx, AV_LOG_WARNING, "The @mode syntax is deprecated and will 
be removed. Please use the -format_code option.\n");
@@ -966,7 +966,7 @@ av_cold int ff_decklink_read_header(AVFormatContext *avctx)
 /* Get input device. */
 if (ctx->dl->QueryInterface(IID_IDeckLinkInput, (void **) &ctx->dli) != 
S_OK) {
 av_log(avctx, AV_LOG_ERROR, "Could not open input device f

[FFmpeg-devel] [PATCH 2/7] avformat: add url field to AVFormatContext

2018-01-21 Thread Marton Balint
This will replace the 1024 character limited filename field. Compatiblity for
output contexts are provided by copying filename field to URL if URL is unset
and by providing an internal function for muxers to set both url and filename
at once.

Signed-off-by: Marton Balint 
---
 doc/APIchanges |  3 +++
 libavformat/avformat.h | 15 +++
 libavformat/internal.h |  7 +++
 libavformat/mux.c  | 11 ++-
 libavformat/utils.c| 14 ++
 libavformat/version.h  |  2 +-
 6 files changed, 50 insertions(+), 2 deletions(-)

diff --git a/doc/APIchanges b/doc/APIchanges
index 7699365879..490f57bb2f 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -15,6 +15,9 @@ libavutil: 2017-10-21
 
 API changes, most recent first:
 
+2018-xx-xx - xxx - lavf 58.6.100 - avformat.h
+  Add url field to AVFormatContext and add ff_format_set_url helper function.
+
 2018-01-xx - xxx - lavf 58.5.100 - avformat.h
   Explicitly make avformat_network_init() and avformat_network_deinit() 
optional.
   If these are not called, network initialization and deinitialization is
diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index e5740be2b4..81ac7e58e8 100644
--- a/libavformat/avformat.h
+++ b/libavformat/avformat.h
@@ -1398,6 +1398,21 @@ typedef struct AVFormatContext {
 char filename[1024];
 
 /**
+ * input or output URL. Unlike the old filename field, this field has no
+ * length restriction.
+ *
+ * - demuxing: set by avformat_open_input(), initialized to an empty
+ * string if url parameter was NULL in avformat_open_input().
+ * - muxing: may be set by the caller before calling 
avformat_write_header()
+ *   (or avformat_init_output() if that is called first) to a 
string
+ *   which is freeable by av_free(). Set to an empty string if it
+ *   was NULL in avformat_init_output().
+ *
+ * Freed by libavformat in avformat_free_context().
+ */
+char *url;
+
+/**
  * Position of the first frame of the component, in
  * AV_TIME_BASE fractional seconds. NEVER set this value directly:
  * It is deduced from the AVStream values.
diff --git a/libavformat/internal.h b/libavformat/internal.h
index 0cd0556dc7..1e2a3e05a1 100644
--- a/libavformat/internal.h
+++ b/libavformat/internal.h
@@ -696,4 +696,11 @@ int ff_interleaved_peek(AVFormatContext *s, int stream,
 int ff_lock_avformat(void);
 int ff_unlock_avformat(void);
 
+/**
+ * Set AVFormatContext url field to the provided pointer. The pointer must
+ * point to a valid string. The existing url field is freed if necessary. Also
+ * set the legacy filename field to the same string which was provided in url.
+ */
+void ff_format_set_url(AVFormatContext *s, char *url);
+
 #endif /* AVFORMAT_INTERNAL_H */
diff --git a/libavformat/mux.c b/libavformat/mux.c
index ea9f13fdf5..de63f2ca25 100644
--- a/libavformat/mux.c
+++ b/libavformat/mux.c
@@ -186,8 +186,12 @@ int avformat_alloc_output_context2(AVFormatContext 
**avctx, AVOutputFormat *ofor
 } else
 s->priv_data = NULL;
 
-if (filename)
+if (filename) {
 av_strlcpy(s->filename, filename, sizeof(s->filename));
+if (!(s->url = av_strdup(filename)))
+goto nomem;
+
+}
 *avctx = s;
 return 0;
 nomem:
@@ -251,6 +255,11 @@ static int init_muxer(AVFormatContext *s, AVDictionary 
**options)
 (ret = av_opt_set_dict2(s->priv_data, &tmp, AV_OPT_SEARCH_CHILDREN)) < 
0)
 goto fail;
 
+if (!s->url && !(s->url = av_strdup(s->filename))) {
+ret = AVERROR(ENOMEM);
+goto fail;
+}
+
 #if FF_API_LAVF_AVCTX
 FF_DISABLE_DEPRECATION_WARNINGS
 if (s->nb_streams && s->streams[0]->codec->flags & AV_CODEC_FLAG_BITEXACT) 
{
diff --git a/libavformat/utils.c b/libavformat/utils.c
index 3d733417e1..8bf27c3b35 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -555,6 +555,11 @@ int avformat_open_input(AVFormatContext **ps, const char 
*filename,
 if ((ret = av_opt_set_dict(s, &tmp)) < 0)
 goto fail;
 
+if (!(s->url = av_strdup(filename ? filename : ""))) {
+ret = AVERROR(ENOMEM);
+goto fail;
+}
+
 av_strlcpy(s->filename, filename ? filename : "", sizeof(s->filename));
 if ((ret = init_input(s, filename, &tmp)) < 0)
 goto fail;
@@ -4369,6 +4374,7 @@ void avformat_free_context(AVFormatContext *s)
 av_freep(&s->streams);
 flush_packet_queue(s);
 av_freep(&s->internal);
+av_freep(&s->url);
 av_free(s);
 }
 
@@ -5634,3 +5640,11 @@ FF_ENABLE_DEPRECATION_WARNINGS
 return st->internal->avctx->time_base;
 #endif
 }
+
+void ff_format_set_url(AVFormatContext *s, char *url)
+{
+av_assert0(url);
+av_freep(&s->url);
+s->url = url;
+av_strlcpy(s->filename, url, sizeof(s->filename));
+}
diff --git a/libavformat/version.h b/libavformat/version.h
index 87758b027c..5ff8a89ae0 100644
--- a/libavformat/version.h
+++ b/libavformat/ve

[FFmpeg-devel] [PATCH 6/7] avformat: migrate to AVFormatContext->url

2018-01-21 Thread Marton Balint
Signed-off-by: Marton Balint 
---
 libavformat/concatdec.c  |  4 ++--
 libavformat/dashenc.c| 16 
 libavformat/fifo.c   |  8 
 libavformat/flvenc.c |  4 ++--
 libavformat/gxfenc.c |  4 ++--
 libavformat/hdsenc.c | 24 
 libavformat/img2dec.c|  4 ++--
 libavformat/img2enc.c|  4 ++--
 libavformat/matroskadec.c|  4 ++--
 libavformat/mlvdec.c |  4 ++--
 libavformat/mov.c|  2 +-
 libavformat/movenc.c | 10 +-
 libavformat/mpeg.c   |  4 ++--
 libavformat/mpegtsenc.c  |  2 +-
 libavformat/options.c|  2 +-
 libavformat/rtsp.c   | 18 --
 libavformat/rtspdec.c|  4 ++--
 libavformat/rtspenc.c|  4 +++-
 libavformat/sapdec.c |  2 +-
 libavformat/sapenc.c | 10 --
 libavformat/sdp.c|  4 ++--
 libavformat/segment.c| 36 +---
 libavformat/smoothstreamingenc.c | 12 ++--
 libavformat/tee.c|  4 ++--
 libavformat/utils.c  |  2 +-
 libavformat/webm_chunk.c | 10 +-
 26 files changed, 111 insertions(+), 91 deletions(-)

diff --git a/libavformat/concatdec.c b/libavformat/concatdec.c
index bd5174ada2..178fac86cb 100644
--- a/libavformat/concatdec.c
+++ b/libavformat/concatdec.c
@@ -126,10 +126,10 @@ static int add_file(AVFormatContext *avf, char *filename, 
ConcatFile **rfile,
 url = filename;
 filename = NULL;
 } else {
-url_len = strlen(avf->filename) + strlen(filename) + 16;
+url_len = strlen(avf->url) + strlen(filename) + 16;
 if (!(url = av_malloc(url_len)))
 FAIL(AVERROR(ENOMEM));
-ff_make_absolute_url(url, url_len, avf->filename, filename);
+ff_make_absolute_url(url, url_len, avf->url, filename);
 av_freep(&filename);
 }
 
diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c
index 39d0afe350..b6b170c29f 100644
--- a/libavformat/dashenc.c
+++ b/libavformat/dashenc.c
@@ -685,7 +685,7 @@ static int write_manifest(AVFormatContext *s, int final)
 AVIOContext *out;
 char temp_filename[1024];
 int ret, i;
-const char *proto = avio_find_protocol_name(s->filename);
+const char *proto = avio_find_protocol_name(s->url);
 int use_rename = proto && !strcmp(proto, "file");
 static unsigned int warned_non_file = 0;
 AVDictionaryEntry *title = av_dict_get(s->metadata, "title", NULL, 0);
@@ -694,7 +694,7 @@ static int write_manifest(AVFormatContext *s, int final)
 if (!use_rename && !warned_non_file++)
 av_log(s, AV_LOG_ERROR, "Cannot use rename on non file protocol, this 
may lead to races and temporary partial files\n");
 
-snprintf(temp_filename, sizeof(temp_filename), use_rename ? "%s.tmp" : 
"%s", s->filename);
+snprintf(temp_filename, sizeof(temp_filename), use_rename ? "%s.tmp" : 
"%s", s->url);
 set_http_options(&opts, c);
 ret = dashenc_io_open(s, &c->mpd_out, temp_filename, &opts);
 if (ret < 0) {
@@ -771,7 +771,7 @@ static int write_manifest(AVFormatContext *s, int final)
 dashenc_io_close(s, &c->mpd_out, temp_filename);
 
 if (use_rename) {
-if ((ret = avpriv_io_move(temp_filename, s->filename)) < 0)
+if ((ret = avpriv_io_move(temp_filename, s->url)) < 0)
 return ret;
 }
 
@@ -852,14 +852,14 @@ static int dash_init(AVFormatContext *s)
 if (c->single_file)
 c->use_template = 0;
 
-av_strlcpy(c->dirname, s->filename, sizeof(c->dirname));
+av_strlcpy(c->dirname, s->url, sizeof(c->dirname));
 ptr = strrchr(c->dirname, '/');
 if (ptr) {
 av_strlcpy(basename, &ptr[1], sizeof(basename));
 ptr[1] = '\0';
 } else {
 c->dirname[0] = '\0';
-av_strlcpy(basename, s->filename, sizeof(basename));
+av_strlcpy(basename, s->url, sizeof(basename));
 }
 
 ptr = strrchr(basename, '.');
@@ -1018,7 +1018,7 @@ static int dash_write_header(AVFormatContext *s)
 }
 ret = write_manifest(s, 0);
 if (!ret)
-av_log(s, AV_LOG_VERBOSE, "Manifest written to: %s\n", s->filename);
+av_log(s, AV_LOG_VERBOSE, "Manifest written to: %s\n", s->url);
 return ret;
 }
 
@@ -1117,7 +1117,7 @@ static int dash_flush(AVFormatContext *s, int final, int 
stream)
 DASHContext *c = s->priv_data;
 int i, ret = 0;
 
-const char *proto = avio_find_protocol_name(s->filename);
+const char *proto = avio_find_protocol_name(s->url);
 int use_rename = proto && !strcmp(proto, "file");
 
 int cur_flush_segment_index = 0;
@@ -1325,7 +1325,7 @@ static int dash_write_trailer(AVFormatContext *s)
 snprintf(filename, sizeof(filename), "%s%s", c->dirname, 
os->initfile);
 unlink(filename);
 }
-unlink(s->filename);
+   

[FFmpeg-devel] [PATCH 5/7] avformat/hls: migrate to AVFormatContext->url

2018-01-21 Thread Marton Balint
Signed-off-by: Marton Balint 
---
 libavformat/hls.c|   4 +-
 libavformat/hlsenc.c | 166 +--
 2 files changed, 96 insertions(+), 74 deletions(-)

diff --git a/libavformat/hls.c b/libavformat/hls.c
index 950cc4c3bd..559b8c3391 100644
--- a/libavformat/hls.c
+++ b/libavformat/hls.c
@@ -1676,7 +1676,7 @@ static int nested_io_open(AVFormatContext *s, AVIOContext 
**pb, const char *url,
 av_log(s, AV_LOG_ERROR,
"A HLS playlist item '%s' referred to an external file '%s'. "
"Opening this file was forbidden for security reasons\n",
-   s->filename, url);
+   s->url, url);
 return AVERROR(EPERM);
 }
 
@@ -1814,7 +1814,7 @@ static int hls_read_header(AVFormatContext *s)
 update_options(&c->http_proxy, "http_proxy", u);
 }
 
-if ((ret = parse_playlist(c, s->filename, NULL, s->pb)) < 0)
+if ((ret = parse_playlist(c, s->url, NULL, s->pb)) < 0)
 goto fail;
 
 if ((ret = save_avio_options(s)) < 0)
diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index e581eda5bf..e228247e09 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -282,7 +282,7 @@ static void hlsenc_io_close(AVFormatContext *s, AVIOContext 
**pb, char *filename
 
 static void set_http_options(AVFormatContext *s, AVDictionary **options, 
HLSContext *c)
 {
-int http_base_proto = ff_is_http_proto(s->filename);
+int http_base_proto = ff_is_http_proto(s->url);
 
 if (c->method) {
 av_dict_set(options, "method", c->method, 0);
@@ -457,7 +457,7 @@ static int hls_delete_old_segments(AVFormatContext *s, 
HLSContext *hls,
 if (hls->segment_filename) {
 dirname = av_strdup(hls->segment_filename);
 } else {
-dirname = av_strdup(vs->avf->filename);
+dirname = av_strdup(vs->avf->url);
 }
 if (!dirname) {
 ret = AVERROR(ENOMEM);
@@ -484,7 +484,7 @@ static int hls_delete_old_segments(AVFormatContext *s, 
HLSContext *hls,
 av_strlcat(path, segment->filename, path_size);
 }
 
-proto = avio_find_protocol_name(s->filename);
+proto = avio_find_protocol_name(s->url);
 if (hls->method || (proto && !av_strcasecmp(proto, "http"))) {
 av_dict_set(&options, "method", "DELETE", 0);
 if ((ret = vs->avf->io_open(vs->avf, &out, path, AVIO_FLAG_WRITE, 
&options)) < 0)
@@ -554,12 +554,12 @@ static int do_encrypt(AVFormatContext *s, VariantStream 
*vs)
 AVIOContext *pb;
 uint8_t key[KEYSIZE];
 
-len = strlen(s->filename) + 4 + 1;
+len = strlen(s->url) + 4 + 1;
 hls->key_basename = av_mallocz(len);
 if (!hls->key_basename)
 return AVERROR(ENOMEM);
 
-av_strlcpy(hls->key_basename, s->filename, len);
+av_strlcpy(hls->key_basename, s->url, len);
 av_strlcat(hls->key_basename, ".key", len);
 
 if (hls->key_url) {
@@ -689,7 +689,10 @@ static int hls_mux_init(AVFormatContext *s, VariantStream 
*vs)
 return ret;
 oc = vs->avf;
 
-oc->filename[0]= '\0';
+oc->url= av_strdup("");
+if (!oc->url)
+return AVERROR(ENOMEM);
+
 oc->oformat= vs->oformat;
 oc->interrupt_callback = s->interrupt_callback;
 oc->max_delay  = s->max_delay;
@@ -798,35 +801,38 @@ static int sls_flags_filename_process(struct 
AVFormatContext *s, HLSContext *hls
 {
 if ((hls->flags & (HLS_SECOND_LEVEL_SEGMENT_SIZE | 
HLS_SECOND_LEVEL_SEGMENT_DURATION)) &&
 strlen(vs->current_segment_final_filename_fmt)) {
-av_strlcpy(vs->avf->filename, vs->current_segment_final_filename_fmt, 
sizeof(vs->avf->filename));
+char * new_url = av_strdup(vs->current_segment_final_filename_fmt);
+if (!new_url) {
+av_free(en);
+return AVERROR(ENOMEM);
+}
+ff_format_set_url(vs->avf, new_url);
 if (hls->flags & HLS_SECOND_LEVEL_SEGMENT_SIZE) {
 char *filename = NULL;
-if (replace_int_data_in_filename(&filename, vs->avf->filename, 
's', pos + size) < 1) {
+if (replace_int_data_in_filename(&filename, vs->avf->url, 's', pos 
+ size) < 1) {
 av_log(hls, AV_LOG_ERROR,
"Invalid second level segment filename template '%s', "
 "you can try to remove second_level_segment_size 
flag\n",
-   filename);
+   vs->avf->url);
 av_free(filename);
 av_free(en);
 return AVERROR(EINVAL);
 }
-av_strlcpy(vs->avf->filename, filename, sizeof(vs->avf->filename));
-av_free(filename);
+ff_format_set_url(vs->avf, filename);
 }
 if (hls->flags & HLS_SECOND_LEVEL_SEGMENT_DURATION) {
 char *filename = NULL;
-if (replace_int_data_in_filename(&filename, vs->avf->filename,
+if (replace

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

2018-01-21 Thread Marton Balint
Signed-off-by: Marton Balint 
---
 doc/APIchanges |  4 
 libavformat/avformat.h |  5 +
 libavformat/mux.c  | 10 ++
 libavformat/utils.c|  8 
 libavformat/version.h  |  3 +++
 5 files changed, 30 insertions(+)

diff --git a/doc/APIchanges b/doc/APIchanges
index 490f57bb2f..f4b95d8987 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -16,6 +16,10 @@ libavutil: 2017-10-21
 API changes, most recent first:
 
 2018-xx-xx - xxx - lavf 58.6.100 - avformat.h
+  Deprecate AVFormatContext filename field which had limited length, use the
+  new dynamically allocated url field instead.
+
+2018-xx-xx - xxx - lavf 58.6.100 - avformat.h
   Add url field to AVFormatContext and add ff_format_set_url helper function.
 
 2018-01-xx - xxx - lavf 58.5.100 - avformat.h
diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index 81ac7e58e8..4c4986ad0e 100644
--- a/libavformat/avformat.h
+++ b/libavformat/avformat.h
@@ -1389,13 +1389,18 @@ typedef struct AVFormatContext {
  */
 AVStream **streams;
 
+#if FF_API_FORMAT_FILENAME
 /**
  * input or output filename
  *
  * - demuxing: set by avformat_open_input()
  * - muxing: may be set by the caller before avformat_write_header()
+ *
+ * @deprecated Use url instead.
  */
+attribute_deprecated
 char filename[1024];
+#endif
 
 /**
  * input or output URL. Unlike the old filename field, this field has no
diff --git a/libavformat/mux.c b/libavformat/mux.c
index de63f2ca25..a13f0e3a1b 100644
--- a/libavformat/mux.c
+++ b/libavformat/mux.c
@@ -187,7 +187,11 @@ int avformat_alloc_output_context2(AVFormatContext 
**avctx, AVOutputFormat *ofor
 s->priv_data = NULL;
 
 if (filename) {
+#if FF_API_FORMAT_FILENAME
+FF_DISABLE_DEPRECATION_WARNINGS
 av_strlcpy(s->filename, filename, sizeof(s->filename));
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
 if (!(s->url = av_strdup(filename)))
 goto nomem;
 
@@ -255,7 +259,13 @@ static int init_muxer(AVFormatContext *s, AVDictionary 
**options)
 (ret = av_opt_set_dict2(s->priv_data, &tmp, AV_OPT_SEARCH_CHILDREN)) < 
0)
 goto fail;
 
+#if FF_API_FORMAT_FILENAME
+FF_DISABLE_DEPRECATION_WARNINGS
 if (!s->url && !(s->url = av_strdup(s->filename))) {
+FF_ENABLE_DEPRECATION_WARNINGS
+#else
+if (!s->url && !(s->url = av_strdup(""))) {
+#endif
 ret = AVERROR(ENOMEM);
 goto fail;
 }
diff --git a/libavformat/utils.c b/libavformat/utils.c
index 0b777186e1..b4d00ad368 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -560,7 +560,11 @@ int avformat_open_input(AVFormatContext **ps, const char 
*filename,
 goto fail;
 }
 
+#if FF_API_FORMAT_FILENAME
+FF_DISABLE_DEPRECATION_WARNINGS
 av_strlcpy(s->filename, filename ? filename : "", sizeof(s->filename));
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
 if ((ret = init_input(s, filename, &tmp)) < 0)
 goto fail;
 s->probe_score = ret;
@@ -5646,5 +5650,9 @@ void ff_format_set_url(AVFormatContext *s, char *url)
 av_assert0(url);
 av_freep(&s->url);
 s->url = url;
+#if FF_API_FORMAT_FILENAME
+FF_DISABLE_DEPRECATION_WARNINGS
 av_strlcpy(s->filename, url, sizeof(s->filename));
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
 }
diff --git a/libavformat/version.h b/libavformat/version.h
index 5ff8a89ae0..2cd1bf438e 100644
--- a/libavformat/version.h
+++ b/libavformat/version.h
@@ -85,6 +85,9 @@
 #ifndef FF_API_LAVF_FFSERVER
 #define FF_API_LAVF_FFSERVER(LIBAVFORMAT_VERSION_MAJOR < 59)
 #endif
+#ifndef FF_API_FORMAT_FILENAME
+#define FF_API_FORMAT_FILENAME  (LIBAVFORMAT_VERSION_MAJOR < 59)
+#endif
 
 
 #ifndef FF_API_R_FRAME_RATE
-- 
2.13.6

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


Re: [FFmpeg-devel] [PATCH] MAINTAINERS: add myself for avcodec/v4l2_

2018-01-21 Thread Michael Niedermayer
On Fri, Jan 19, 2018 at 05:52:32PM +0100, Jorge Ramirez-Ortiz wrote:
> ---
>  MAINTAINERS | 1 +
>  1 file changed, 1 insertion(+)

applied

thanks

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

Awnsering whenever a program halts or runs forever is
On a turing machine, in general impossible (turings halting problem).
On any real computer, always possible as a real computer has a finite number
of states N, and will either halt in less than N cycles or never halt.


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


Re: [FFmpeg-devel] [PATCH] avcodec/truemotion2: Fix integer overflow in TM2_RECALC_BLOCK()

2018-01-21 Thread Michael Niedermayer
On Sat, Jan 20, 2018 at 04:50:29AM +0100, Michael Niedermayer wrote:
> Fixes: signed integer overflow: 1477974040 - -1877995504 cannot be 
> represented in type 'int'
> Fixes: 4861/clusterfuzz-testcase-minimized-4570316383715328
> 
> Found-by: continuous fuzzing process 
> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer 
> ---
>  libavcodec/truemotion2.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

applied

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

Republics decline into democracies and democracies degenerate into
despotisms. -- Aristotle


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/svq3: Do not write into const memory

2018-01-21 Thread Carl Eugen Hoyos
2018-01-21 16:10 GMT+01:00 Tomas Härdin :
> fre 2018-01-19 klockan 19:19 +0100 skrev Carl Eugen Hoyos:
>> 2018-01-19 16:54 GMT+01:00 Tomas Härdin :
>> > On 2018-01-18 23:34, Carl Eugen Hoyos wrote:
>> > >
>> > > Hi!
>> > >
>> > > Attached patch fixes a warning, I suspect it makes the code more
>> > > correct.
>> > >
>> > > Please comment, Carl Eugen
>> > >
>> > > --- a/libavcodec/svq3.c
>> > > +++ b/libavcodec/svq3.c
>> > > @@ -1048,12 +1048,12 @@ static int
>> > > svq3_decode_slice_header(AVCodecContext
>> > > *avctx)
>> > >   }
>> > >   memcpy(s->slice_buf, s->gb.buffer + s->gb.index / 8,
>> > > slice_bytes);
>> > >   -init_get_bits(&s->gb_slice, s->slice_buf, slice_bits);
>> >
>> > Unrelated change?
>>
>> No, it is an intended move.
>>
>> > >   if (s->watermark_key) {
>> > > -uint32_t header = AV_RL32(&s->gb_slice.buffer[1]);
>> > > -AV_WL32(&s->gb_slice.buffer[1], header ^ s-
>> > > >watermark_key);
>> >
>> > Strange that this didn't manage to break anything, or that the
>> > compiler
>> > let it through
>>
>> A compiler's warning that gets fixed is the reason for this patch but
>> I apparently misunderstand your comment.
>>
>> > > +uint32_t header = AV_RL32(&s->slice_buf[1]);
>> > > +AV_WL32(&s->slice_buf[1], header ^ s-
>> > > >watermark_key);
>> >
>> > Considering the memcpy() above, either this or the old code must be
>> > wrong.
>>
>> Why do you think so?
>> (I do consider the old code "wrong", that is why I sent this patch.)
>>
>> > My guess is the old code must have been wrong, since to fiddle
>> > the same bits this AV_WL32() would need to set
>> > &s->slice_buf[1 - s->gb.index / 8]...
>>
>> I was hoping that the same bits get fiddled given that I call the
>> same macro / function...
>
> No I was confusing myself. Your patch looks fine. With these changes
> slice_buf is twiddled into the right state *before* init_get_bits(),
> which makes sense.

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-21 Thread Kieran Kunhya
On Sun, Jan 21, 2018 at 2:42 PM, Carl Eugen Hoyos 
wrote:

> 2018-01-21 15:34 GMT+01:00 Kieran Kunhya :
> >>
> >> Only that I can not reproduce without your patch (and that I have
> >> never seen this issue before).
> >>
> >> Carl Eugen
> >>
> > I cannot reproduce this issue with ffplay on Ubuntu Linux.
> > I would recommend running "make distclean" and recompiling.
>
> My last test was done with "make distclean".
>
> Carl Eugen
>

Does this happen in single threaded mode?
Are you able to run ffplay under tsan?

Regards,
Kieran Kunhya
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avcodec/h264_ps: use the AVBufferPool API to allocate parameter set buffers

2018-01-21 Thread Michael Niedermayer
On Sat, Jan 20, 2018 at 11:53:25PM -0300, James Almer wrote:
> On 1/20/2018 11:33 PM, Michael Niedermayer wrote:
> > On Sat, Jan 20, 2018 at 06:49:29PM -0300, James Almer wrote:
> >> Signed-off-by: James Almer 
> >> ---
> >> Similar rationale as hevc. With up to 32 sps and 256 pps, this may
> >> come in handy when parsing raw streams.
> >>
> >>  libavcodec/h264_parser.c   |  3 ++-
> >>  libavcodec/h264_ps.c   | 22 --
> >>  libavcodec/h264_ps.h   |  5 +
> >>  libavcodec/h264dec.c   |  3 +++
> >>  libavcodec/mediacodecdec.c |  4 
> >>  5 files changed, 34 insertions(+), 3 deletions(-)
> >>
> >> diff --git a/libavcodec/h264_parser.c b/libavcodec/h264_parser.c
> >> index 65d9d44b50..fa6777fc05 100644
> >> --- a/libavcodec/h264_parser.c
> >> +++ b/libavcodec/h264_parser.c
> >> @@ -697,7 +697,8 @@ static av_cold int init(AVCodecParserContext *s)
> >>  p->reference_dts = AV_NOPTS_VALUE;
> >>  p->last_frame_num = INT_MAX;
> >>  ff_h264dsp_init(&p->h264dsp, 8, 1);
> >> -return 0;
> >> +
> >> +return ff_h264_ps_init(&p->ps);
> >>  }
> >>  
> >>  AVCodecParser ff_h264_parser = {
> >> diff --git a/libavcodec/h264_ps.c b/libavcodec/h264_ps.c
> >> index 8d1ef831fa..50dbabdb8b 100644
> >> --- a/libavcodec/h264_ps.c
> >> +++ b/libavcodec/h264_ps.c
> >> @@ -314,6 +314,21 @@ static int decode_scaling_matrices(GetBitContext *gb, 
> >> const SPS *sps,
> >>  return ret;
> >>  }
> >>  
> >> +int ff_h264_ps_init(H264ParamSets *ps)
> >> +{
> >> +ps->sps_pool = av_buffer_pool_init(sizeof(*ps->sps), 
> >> av_buffer_allocz);
> >> +ps->pps_pool = av_buffer_pool_init(sizeof(*ps->pps), 
> >> av_buffer_allocz);
> >> +
> >> +if (!ps->sps_pool || !ps->pps_pool) {
> >> +av_buffer_pool_uninit(&ps->sps_pool);
> >> +av_buffer_pool_uninit(&ps->pps_pool);
> >> +
> >> +return AVERROR(ENOMEM);
> >> +}
> >> +
> >> +return 0;
> >> +}
> >> +
> >>  void ff_h264_ps_uninit(H264ParamSets *ps)
> >>  {
> >>  int i;
> >> @@ -327,6 +342,9 @@ void ff_h264_ps_uninit(H264ParamSets *ps)
> >>  av_buffer_unref(&ps->sps_ref);
> >>  av_buffer_unref(&ps->pps_ref);
> >>  
> >> +av_buffer_pool_uninit(&ps->sps_pool);
> >> +av_buffer_pool_uninit(&ps->pps_pool);
> >> +
> >>  ps->pps = NULL;
> >>  ps->sps = NULL;
> >>  }
> >> @@ -341,7 +359,7 @@ int ff_h264_decode_seq_parameter_set(GetBitContext 
> >> *gb, AVCodecContext *avctx,
> >>  SPS *sps;
> >>  int ret;
> >>  
> >> -sps_buf = av_buffer_allocz(sizeof(*sps));
> >> +sps_buf = av_buffer_pool_get(ps->sps_pool);
> >>  if (!sps_buf)
> >>  return AVERROR(ENOMEM);
> >>  sps = (SPS*)sps_buf->data;
> >> @@ -738,7 +756,7 @@ int ff_h264_decode_picture_parameter_set(GetBitContext 
> >> *gb, AVCodecContext *avct
> >>  return AVERROR_INVALIDDATA;
> >>  }
> >>  
> >> -pps_buf = av_buffer_allocz(sizeof(*pps));
> >> +pps_buf = av_buffer_pool_get(ps->pps_pool);
> > 
> > this seems to remove the memset(0) unless iam missing something
> 
> Isn't it enough using av_buffer_allocz() as the alloc function when
> initializing the pool?
> If the buffers are not cleared when returned to the pool to be reused
> then I could change the alloc function to av_buffer_alloc() and call
> memset(0) here.

Iam not sure but i dont see what would clear them


> 
> > is this intended?
> 
> Not really. My intention is to still get a zeroed buffer as it always did.
> 

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

There will always be a question for which you do not know the correct answer.


signature.asc
Description: PGP signature
___
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-21 Thread Carl Eugen Hoyos
2018-01-21 22:45 GMT+01:00 Kieran Kunhya :
> On Sun, Jan 21, 2018 at 2:42 PM, Carl Eugen Hoyos 
> wrote:
>
>> 2018-01-21 15:34 GMT+01:00 Kieran Kunhya :
>> >>
>> >> Only that I can not reproduce without your patch (and that I have
>> >> never seen this issue before).
>> >>
>> >> Carl Eugen
>> >>
>> > I cannot reproduce this issue with ffplay on Ubuntu Linux.
>> > I would recommend running "make distclean" and recompiling.
>>
>> My last test was done with "make distclean".
>
> Does this happen in single threaded mode?

Also happens with "ffplay -threads 1"

> Are you able to run ffplay under tsan?

ffplay does not like tsan here (segfaults), ffmpeg shows
many thousand lines (!) of tsan output for the ssp files we
have (first frame only): Do you want me to send them?

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-21 Thread Carl Eugen Hoyos
2018-01-21 23:06 GMT+01:00 Carl Eugen Hoyos :
> 2018-01-21 22:45 GMT+01:00 Kieran Kunhya :

>> Does this happen in single threaded mode?
>
> Also happens with "ffplay -threads 1"

Also reproducible (sometimes) with --disable-pthreads.

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


Re: [FFmpeg-devel] [PATCH] avcodec/h264_ps: use the AVBufferPool API to allocate parameter set buffers

2018-01-21 Thread James Almer
On 1/21/2018 7:06 PM, Michael Niedermayer wrote:
> On Sat, Jan 20, 2018 at 11:53:25PM -0300, James Almer wrote:
>> On 1/20/2018 11:33 PM, Michael Niedermayer wrote:
>>> On Sat, Jan 20, 2018 at 06:49:29PM -0300, James Almer wrote:
 Signed-off-by: James Almer 
 ---
 Similar rationale as hevc. With up to 32 sps and 256 pps, this may
 come in handy when parsing raw streams.

  libavcodec/h264_parser.c   |  3 ++-
  libavcodec/h264_ps.c   | 22 --
  libavcodec/h264_ps.h   |  5 +
  libavcodec/h264dec.c   |  3 +++
  libavcodec/mediacodecdec.c |  4 
  5 files changed, 34 insertions(+), 3 deletions(-)

 diff --git a/libavcodec/h264_parser.c b/libavcodec/h264_parser.c
 index 65d9d44b50..fa6777fc05 100644
 --- a/libavcodec/h264_parser.c
 +++ b/libavcodec/h264_parser.c
 @@ -697,7 +697,8 @@ static av_cold int init(AVCodecParserContext *s)
  p->reference_dts = AV_NOPTS_VALUE;
  p->last_frame_num = INT_MAX;
  ff_h264dsp_init(&p->h264dsp, 8, 1);
 -return 0;
 +
 +return ff_h264_ps_init(&p->ps);
  }
  
  AVCodecParser ff_h264_parser = {
 diff --git a/libavcodec/h264_ps.c b/libavcodec/h264_ps.c
 index 8d1ef831fa..50dbabdb8b 100644
 --- a/libavcodec/h264_ps.c
 +++ b/libavcodec/h264_ps.c
 @@ -314,6 +314,21 @@ static int decode_scaling_matrices(GetBitContext *gb, 
 const SPS *sps,
  return ret;
  }
  
 +int ff_h264_ps_init(H264ParamSets *ps)
 +{
 +ps->sps_pool = av_buffer_pool_init(sizeof(*ps->sps), 
 av_buffer_allocz);
 +ps->pps_pool = av_buffer_pool_init(sizeof(*ps->pps), 
 av_buffer_allocz);
 +
 +if (!ps->sps_pool || !ps->pps_pool) {
 +av_buffer_pool_uninit(&ps->sps_pool);
 +av_buffer_pool_uninit(&ps->pps_pool);
 +
 +return AVERROR(ENOMEM);
 +}
 +
 +return 0;
 +}
 +
  void ff_h264_ps_uninit(H264ParamSets *ps)
  {
  int i;
 @@ -327,6 +342,9 @@ void ff_h264_ps_uninit(H264ParamSets *ps)
  av_buffer_unref(&ps->sps_ref);
  av_buffer_unref(&ps->pps_ref);
  
 +av_buffer_pool_uninit(&ps->sps_pool);
 +av_buffer_pool_uninit(&ps->pps_pool);
 +
  ps->pps = NULL;
  ps->sps = NULL;
  }
 @@ -341,7 +359,7 @@ int ff_h264_decode_seq_parameter_set(GetBitContext 
 *gb, AVCodecContext *avctx,
  SPS *sps;
  int ret;
  
 -sps_buf = av_buffer_allocz(sizeof(*sps));
 +sps_buf = av_buffer_pool_get(ps->sps_pool);
  if (!sps_buf)
  return AVERROR(ENOMEM);
  sps = (SPS*)sps_buf->data;
 @@ -738,7 +756,7 @@ int ff_h264_decode_picture_parameter_set(GetBitContext 
 *gb, AVCodecContext *avct
  return AVERROR_INVALIDDATA;
  }
  
 -pps_buf = av_buffer_allocz(sizeof(*pps));
 +pps_buf = av_buffer_pool_get(ps->pps_pool);
>>>
>>> this seems to remove the memset(0) unless iam missing something
>>
>> Isn't it enough using av_buffer_allocz() as the alloc function when
>> initializing the pool?
>> If the buffers are not cleared when returned to the pool to be reused
>> then I could change the alloc function to av_buffer_alloc() and call
>> memset(0) here.
> 
> Iam not sure but i dont see what would clear them

Apparently it will fill it with garbage if you configure with memory
poisoning, but aside from that it will not touch its contents. That
kinda makes passing av_buffer_allocz() to av_buffer_pool_init()
absolutely pointless beyond the first time a buffer is returned.

Anyway, just benched it a bit and this was not faster in my tests.
A file with one sps and three pps every keyframe and performance was
within the error margin. Sometimes even slower.
It was a fun exercise with the buffer pool API, but I'll probably drop
this and the h264 patch unless someone has favorable benchmarks for both.
___
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-21 Thread Kieran Kunhya
On Sun, Jan 21, 2018 at 10:06 PM, Carl Eugen Hoyos 
wrote:

> 2018-01-21 22:45 GMT+01:00 Kieran Kunhya :
> > On Sun, Jan 21, 2018 at 2:42 PM, Carl Eugen Hoyos 
> > wrote:
> >
> >> 2018-01-21 15:34 GMT+01:00 Kieran Kunhya :
> >> >>
> >> >> Only that I can not reproduce without your patch (and that I have
> >> >> never seen this issue before).
> >> >>
> >> >> Carl Eugen
> >> >>
> >> > I cannot reproduce this issue with ffplay on Ubuntu Linux.
> >> > I would recommend running "make distclean" and recompiling.
> >>
> >> My last test was done with "make distclean".
> >
> > Does this happen in single threaded mode?
>
> Also happens with "ffplay -threads 1"
>
> > Are you able to run ffplay under tsan?
>
> ffplay does not like tsan here (segfaults), ffmpeg shows
> many thousand lines (!) of tsan output for the ssp files we
> have (first frame only): Do you want me to send them?


I can only conclude this is an ffplay problem.
Please provide more information.

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


Re: [FFmpeg-devel] [PATCH V4 1/7] lavfi: VAAPI VPP common infrastructure.

2018-01-21 Thread Mark Thompson
On 20/01/18 12:47, Jun Zhao wrote:
> V4: - Fix the wrong ctx lead to scale_vaapi filter crash issue.
> - Follow Mark's suggestion use VAAPIVPPContext as the first field in 
> FooVAAPICOntext.
> - Add "ff_" prefix to common VPP function.
> - Add range map to procamp_vaapi filter.
> - Split misc_vaapi as denoise_vaapi/sharpness_vaapi.
> V3: - Fix the error handle in vaapi_vpp.
>     - Fix the build issue and remove the duplicated header file
> - Add a entry to Changelog for procamp_vaapi filter.
>  
> V2: - Fix the resource leak in procamp/misc VPP filter.
>     - Re-work the common VAAPIVPPContext and specific VPP context part
>   like VAAPIVPPContext+ScaleVAAPIContext, borrowing the idea from
>   vaapi_encode.
>     - misc vpp part need to refactoring, and I don't have good idea
>   about the file name for vf_misc_vaapi.c, sadly.
> 

LGTM and tested.  I made some minor fixups (remove vestigial reference to 
misc_vaapi filter in 5/7, merge the trivial 6 and 7 into 4 and 5 respectively, 
some cosmetics) and applied.

One slightly weird effect I observed in testing is that if you run the procamp 
filter without any arguments (that is, with no nondefault h/s/c/b options) on 
the i965 driver then the output is green (YUV zeroes).  The code looks kindof 
ok in that case (it provides a buffer containing zero filters), but maybe 
that's not allowed?

Thanks,

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


Re: [FFmpeg-devel] [PATCH v1 1/3] avcodec: v4l2_m2m: fix races around freeing data on close

2018-01-21 Thread Mark Thompson
On 19/01/18 16:40, Jorge Ramirez-Ortiz wrote:
> On 01/19/2018 12:30 AM, Michael Niedermayer wrote:
>> On Thu, Jan 18, 2018 at 09:24:20AM +0100, Jorge Ramirez-Ortiz wrote:
>>> On 01/09/2018 11:56 PM, Jorge Ramirez-Ortiz wrote:
 From: Mark Thompson 

 Refcount all of the context information. This also fixes a potential
 segmentation fault when accessing freed memory  (buffer returned after
 the codec has been closed).
>>> just a follow up on the patchset (patches 1 to 3)
>>> any feedback? shall I resend?
>> Who is the maintainer of this code ?
>> noone is listed for it MAINTAINERS
>>
>> if someone volunteers to maintain it and there are no objections
>> then that person would get git write access and could push patches
>> and then bugfixes wont be stuck so long ...
>>
>> If someone wants to volunteer in that sense, then please send a patch
>> for the MAINTAINER file
> 
> sure I can send such a patch ( unless Mark Thompson has an interest in 
> maintaining it -since he did most of the reviews of the whole patchset IIRC- 
> Baylibre will give me time to maintain this code)

I only have peripheral interest in the v4l2 stuff and only one board to test 
on, so I don't really feel up to maintaining it - if you're happy to be 
responsible for it then please go ahead.  (I'm still available to look at 
patches and test stuff as I do now if that's helpful.)

Thanks,

- Mark
___
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-21 Thread Carl Eugen Hoyos
2018-01-21 23:48 GMT+01:00 Kieran Kunhya :
> On Sun, Jan 21, 2018 at 10:06 PM, Carl Eugen Hoyos 
> wrote:
>
>> 2018-01-21 22:45 GMT+01:00 Kieran Kunhya :
>> > On Sun, Jan 21, 2018 at 2:42 PM, Carl Eugen Hoyos 
>> > wrote:
>> >
>> >> 2018-01-21 15:34 GMT+01:00 Kieran Kunhya :
>> >> >>
>> >> >> Only that I can not reproduce without your patch (and that I have
>> >> >> never seen this issue before).
>> >> >>
>> >> >> Carl Eugen
>> >> >>
>> >> > I cannot reproduce this issue with ffplay on Ubuntu Linux.
>> >> > I would recommend running "make distclean" and recompiling.
>> >>
>> >> My last test was done with "make distclean".
>> >
>> > Does this happen in single threaded mode?
>>
>> Also happens with "ffplay -threads 1"
>>
>> > Are you able to run ffplay under tsan?

Does ffplay work for you at all under tsan?

>> ffplay does not like tsan here (segfaults), ffmpeg shows
>> many thousand lines (!) of tsan output for the ssp files we
>> have (first frame only): Do you want me to send them?
>
> I can only conclude this is an ffplay problem.

Then please give Marton (and Michael) a few days to
comment.

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


Re: [FFmpeg-devel] [PATCH 1/3] avutil: add staticpool

2018-01-21 Thread Muhammad Faiz
On Sun, Jan 21, 2018 at 7:11 PM, wm4  wrote:
> On Sun, 21 Jan 2018 10:24:21 +0700
> Muhammad Faiz  wrote:
>
>> >  I don't trust the atomics use
>> > either, I'm don't want to have to debug that ever.
>>
>> Of course, using atomics is more complicated that using mutex (with
>> benefits that it will be faster when properly used).
>> But it is not a valid reason to avoid using atomic because it is more
>> complicated.
>
> Sure, but it also means it should be really be confined to cases where
> it _really_ helps with performance.
>
> Where is this a bottleneck at all?

Performance difference is noticeable with audio-only stuff.
Because audio processing is typically fast, malloc-free cycle of
AVFrame, AVBuffer, etc becomes bottlenecks.


>
> I also think that this really belongs into a malloc implementation
> instead. You might also want to try "alternative" malloc
> implementations like jemalloc.

jemalloc nicely is fast. The performance is on par with staticpool and
even faster on high contending situation. I hope that new glibc-malloc
is also fast. So I drop the patch.

With this malloc performance, usage of AVBufferPool on audio frame
becomes questionable.

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


Re: [FFmpeg-devel] [PATCH V4 1/7] lavfi: VAAPI VPP common infrastructure.

2018-01-21 Thread Jun Zhao


On 2018/1/22 7:14, Mark Thompson wrote:
> On 20/01/18 12:47, Jun Zhao wrote:
>> V4: - Fix the wrong ctx lead to scale_vaapi filter crash issue.
>> - Follow Mark's suggestion use VAAPIVPPContext as the first field in 
>> FooVAAPICOntext.
>> - Add "ff_" prefix to common VPP function.
>> - Add range map to procamp_vaapi filter.
>> - Split misc_vaapi as denoise_vaapi/sharpness_vaapi.
>> V3: - Fix the error handle in vaapi_vpp.
>>     - Fix the build issue and remove the duplicated header file
>> - Add a entry to Changelog for procamp_vaapi filter.
>>  
>> V2: - Fix the resource leak in procamp/misc VPP filter.
>>     - Re-work the common VAAPIVPPContext and specific VPP context part
>>   like VAAPIVPPContext+ScaleVAAPIContext, borrowing the idea from
>>   vaapi_encode.
>>     - misc vpp part need to refactoring, and I don't have good idea
>>   about the file name for vf_misc_vaapi.c, sadly.
>>
> LGTM and tested.  I made some minor fixups (remove vestigial reference to 
> misc_vaapi filter in 5/7, merge the trivial 6 and 7 into 4 and 5 
> respectively, some cosmetics) and applied.
>
> One slightly weird effect I observed in testing is that if you run the 
> procamp filter without any arguments (that is, with no nondefault h/s/c/b 
> options) on the i965 driver then the output is green (YUV zeroes).  The code 
> looks kindof ok in that case (it provides a buffer containing zero filters), 
> but maybe that's not allowed?
>
> Thanks,
Thanks the hard work (fixup/merge/cosmetics/quick response in sunday...
:) ) and great review first, Mark.
I have thought the case (procamp filter without any arguments) in last
night before bedtime, but didn't have time to try, today I will
double-check this part. Tks.
>
> - Mark
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


Re: [FFmpeg-devel] [PATCH 1/2] lavc: Add coded_w/h to AVCodecParameters

2018-01-21 Thread Li, Zhong
> 
> As mentioned in the thread for that patch already, writing new code using
> deprecated API should really be avoided.
> 
> The way I see it, if someone really needs to know coded w/h (which is
> typically an internal technical detail of no relevance to users), they should
> decode a frame and get it from the decoder.

James posted some comments on https://patchwork.ffmpeg.org/patch/7342/ , please 
let me know if you have any other comment. 
Such code was added to remove printing coded_w/h once the API is removed:
#if FF_API_LAVF_AVCTX
  if (dec_ctx) {
  print_int("coded_width",  dec_ctx->coded_width);
  print_int("coded_height", dec_ctx->coded_height);
  }
+#endif
___
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-21 Thread Michael Niedermayer
On Sun, Jan 21, 2018 at 12:37:21PM +, Kieran Kunhya wrote:
> On Mon, Jan 1, 2018 at 7:01 PM, Michael Niedermayer 
> wrote:
> 
> > Hi
> 
> 

> Patch updated.
> Some of the review comments I decided not to implement in order to keep
> closer to the spec.

honestly, this reasoning makes no sense to me.
that spec does IIRC not even fully describe some parts in DPCM

also all existing mpeg&h26x code we have was designed for speed
basically ignoring if its close to some spec implementation style or not

I would prefer we try to make our code as good as we can and not try to
be similar to some specification or reference implementation.
except for maybe some niche codecs where performance totally doesnt matter


> 
> Regards,
> Kieran Kunhya

>  h263dec.c  |   10 +
>  idctdsp.c  |7 
>  ituh263dec.c   |9 
>  mpeg4data.h|  116 
>  mpeg4video.h   |   17 +
>  mpeg4videodec.c|  510 
> -
>  mpegvideo.c|   45 +++-
>  mpegvideo.h|   17 +
>  x86/idctdsp_init.c |1 
>  9 files changed, 714 insertions(+), 18 deletions(-)
> fb84575d9ef8a76bfe0144f7e2ec4fac2606dae0  
> 0001-mpeg4video-Add-support-for-MPEG-4-Simple-Studio-Prof.patch
> From d9161c56787cc9b258eed6ef00b52232a648ece8 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  |  10 +
>  libavcodec/idctdsp.c  |   7 +-
>  libavcodec/ituh263dec.c   |   9 +-
>  libavcodec/mpeg4data.h| 116 ++
>  libavcodec/mpeg4video.h   |  17 ++
>  libavcodec/mpeg4videodec.c| 510 
> +-
>  libavcodec/mpegvideo.c|  45 +++-
>  libavcodec/mpegvideo.h|  17 +-
>  libavcodec/x86/idctdsp_init.c |   1 +
>  9 files changed, 714 insertions(+), 18 deletions(-)
> 
> diff --git a/libavcodec/h263dec.c b/libavcodec/h263dec.c
> index 5608b63..39ab577 100644
> --- a/libavcodec/h263dec.c
> +++ b/libavcodec/h263dec.c
> @@ -47,6 +47,12 @@
>  
>  static enum AVPixelFormat h263_get_format(AVCodecContext *avctx)
>  {
> +/* MPEG-4 Studio Profile only, not supported by hardware */
> +if (avctx->bits_per_raw_sample > 8) {
> +av_assert1(avctx->profile == FF_PROFILE_MPEG4_SIMPLE_STUDIO);
> +return avctx->pix_fmt;
> +}
> +
>  if (avctx->codec->id == AV_CODEC_ID_MSS2)
>  return AV_PIX_FMT_YUV420P;
>  

> @@ -197,6 +203,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);

ignores return code



> +}
> +
>  if (s->avctx->hwaccel) {
>  const uint8_t *start = s->gb.buffer + get_bits_count(&s->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 1de372d..f289785 100644
> --- a/libavcodec/idctdsp.c
> +++ b/libavcodec/idctdsp.c
> @@ -256,7 +256,12 @@ 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;
> +/* 10-bit MPEG-4 Simple Studio Profile requires a higher 
> precision IDCT
> +   However, it only uses idct_put */
> +if (avctx->codec_id == AV_CODEC_ID_MPEG4 && avctx->profile == 
> FF_PROFILE_MPEG4_SIMPLE_STUDIO)
> +c->idct_put  = ff_simple_idct_put_int32_10bit;
> +else
> +c->idct_put  = ff_simple_idct_put_int16_10bit;

in int32 mode the functions which are not implemented should not be set.


[...]
> +/**
> + * Decode the next video packet.
> + * @return <0 if something went wrong
> + */
> +int ff_mpeg4_decode_studio_slice_header(Mpeg4DecContext *ctx)
> +{
> +MpegEncContext *s = &ctx->m;
> +GetBitContext *gb = &s->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;

missing validity checks


[...]
> +static int mpeg4_decode_studio_block(MpegEncContext *s, int32_t block[64], 
> int n)
> +{
> +Mpeg4DecContext *ctx = (Mpeg4DecContext *)s;

iam not sure but this could be an aliassing violation
also easy to avoid and would be cleaner too even if this is not


> +
> +int cc, dct_dc_size, dct_diff, code, j, idx = 1, group = 0, run = 0,
> + 

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

2018-01-21 Thread Marton Balint



On Mon, 22 Jan 2018, Carl Eugen Hoyos wrote:


2018-01-21 23:48 GMT+01:00 Kieran Kunhya :

On Sun, Jan 21, 2018 at 10:06 PM, Carl Eugen Hoyos 
wrote:


2018-01-21 22:45 GMT+01:00 Kieran Kunhya :
> On Sun, Jan 21, 2018 at 2:42 PM, Carl Eugen Hoyos 
> wrote:
>
>> 2018-01-21 15:34 GMT+01:00 Kieran Kunhya :
>> >>
>> >> Only that I can not reproduce without your patch (and that I have
>> >> never seen this issue before).
>> >>
>> >> Carl Eugen
>> >>
>> > I cannot reproduce this issue with ffplay on Ubuntu Linux.
>> > I would recommend running "make distclean" and recompiling.
>>
>> My last test was done with "make distclean".
>
> Does this happen in single threaded mode?

Also happens with "ffplay -threads 1"

> Are you able to run ffplay under tsan?


Does ffplay work for you at all under tsan?


ffplay does not like tsan here (segfaults), ffmpeg shows
many thousand lines (!) of tsan output for the ssp files we
have (first frame only): Do you want me to send them?


I can only conclude this is an ffplay problem.


Then please give Marton (and Michael) a few days to
comment.


I cannot reproduce this (I am on openSuSE 42.3, x86_64, gcc 4.8.5, 
SDL-2.0.3).


FFplay works here with tsan, it reports some data races, but frames are 
being shown slowly but surely if ffplay is run with -noframedrop.


Are you sure you applied the newest version of this patch and the 
simple_idct template patch?


Regards,
Marton
___
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-21 Thread Carl Eugen Hoyos
2018-01-22 3:35 GMT+01:00 Marton Balint :
>
>
> On Mon, 22 Jan 2018, Carl Eugen Hoyos wrote:
>
>> 2018-01-21 23:48 GMT+01:00 Kieran Kunhya :
>>>
>>> On Sun, Jan 21, 2018 at 10:06 PM, Carl Eugen Hoyos 
>>> wrote:
>>>
 2018-01-21 22:45 GMT+01:00 Kieran Kunhya :
 > On Sun, Jan 21, 2018 at 2:42 PM, Carl Eugen Hoyos 
 > wrote:
 >
 >> 2018-01-21 15:34 GMT+01:00 Kieran Kunhya :
 >> >>
 >> >> Only that I can not reproduce without your patch (and that I have
 >> >> never seen this issue before).
 >> >>
 >> >> Carl Eugen
 >> >>
 >> > I cannot reproduce this issue with ffplay on Ubuntu Linux.
 >> > I would recommend running "make distclean" and recompiling.
 >>
 >> My last test was done with "make distclean".
 >
 > Does this happen in single threaded mode?

 Also happens with "ffplay -threads 1"

 > Are you able to run ffplay under tsan?
>>
>>
>> Does ffplay work for you at all under tsan?
>>
 ffplay does not like tsan here (segfaults), ffmpeg shows
 many thousand lines (!) of tsan output for the ssp files we
 have (first frame only): Do you want me to send them?
>>>
>>>
>>> I can only conclude this is an ffplay problem.
>>
>>
>> Then please give Marton (and Michael) a few days to
>> comment.
>
>
> I cannot reproduce this (I am on openSuSE 42.3, x86_64, gcc 4.8.5,
> SDL-2.0.3).

Then it may be my system.

> FFplay works here with tsan, it reports some data races, but frames are
> being shown slowly but surely if ffplay is run with -noframedrop.

As said, it works sometimes here.

> Are you sure you applied the newest version of this patch and the
> simple_idct template patch?

Yes, and I also use SDL-2.0.3.

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


Re: [FFmpeg-devel] [PATCH] ffprobe: Initialize coded_width/height

2018-01-21 Thread Li, Zhong
> From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On Behalf
> Of Hendrik Leppkes
> Sent: Friday, January 19, 2018 6:10 PM
> To: FFmpeg development discussions and patches
> 
> Subject: Re: [FFmpeg-devel] [PATCH] ffprobe: Initialize coded_width/height
> 
> On Fri, Jan 19, 2018 at 6:05 AM, Zhong Li  wrote:
> > coded_width/height are unnitialized and will be overwritten by
> > dec_ctx->width/height in avcodec_open2()
> >
> > This fixes tiket #6958.
> >
> > Signed-off-by: Zhong Li 
> > ---
> >  fftools/ffprobe.c | 6 ++
> >  1 file changed, 6 insertions(+)
> >
> > diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c index
> > 0e7a771..233760d 100644
> > --- a/fftools/ffprobe.c
> > +++ b/fftools/ffprobe.c
> > @@ -2512,10 +2512,12 @@ static int show_stream(WriterContext *w,
> AVFormatContext *fmt_ctx, int stream_id
> >  case AVMEDIA_TYPE_VIDEO:
> >  print_int("width",par->width);
> >  print_int("height",   par->height);
> > +#if FF_API_LAVF_AVCTX
> >  if (dec_ctx) {
> >  print_int("coded_width",  dec_ctx->coded_width);
> >  print_int("coded_height", dec_ctx->coded_height);
> >  }
> > +#endif
> >  print_int("has_b_frames", par->video_delay);
> >  sar = av_guess_sample_aspect_ratio(fmt_ctx, stream, NULL);
> >  if (sar.den) {
> > @@ -2912,6 +2914,10 @@ static int open_input_file(InputFile *ifile,
> > const char *filename)
> >
> >  ist->dec_ctx->pkt_timebase = stream->time_base;
> >  ist->dec_ctx->framerate = stream->avg_frame_rate;
> > +#if FF_API_LAVF_AVCTX
> > +ist->dec_ctx->coded_width =
> stream->codec->coded_width;
> > +ist->dec_ctx->coded_height =
> stream->codec->coded_height;
> > +#endif
> >
> >  if (avcodec_open2(ist->dec_ctx, codec, &opts) < 0) {
> >  av_log(NULL, AV_LOG_WARNING, "Could not open
> codec
> > for input stream %d\n",
> 
> Lets not write new code based on deprecated API.
> 
> - Hendrik

Refer the discussion on https://patchwork.ffmpeg.org/patch/7342/ 
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel