Re: [FFmpeg-devel] Forward frame wall clock time from avdevice to HLS muxer

2020-08-28 Thread Moritz Barsnick
On Wed, Aug 26, 2020 at 23:52:58 -0700, Jim DeLaHunt wrote:
> Earlier this year, there were patches[3] which aimed to put linear
> timecodes in a format related to SMPTE 12M into a structure marked by a
> `AV_FRAME_DATA_S12M_TIMECODE` value. Maybe that refers to a location
> where you could store timecode values. You might want to search for that
> identifier, and for patches by that developer. I don't know if they have
> been added to the FFmpeg source yet.

They have been added to master.

Moritz

(You meant to write "[2]" above:
> [2] http://ffmpeg.org/pipermail/ffmpeg-devel/2020-July/265628.html
)
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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

Re: [FFmpeg-devel] Forward frame wall clock time from avdevice to HLS muxer

2020-08-28 Thread Jim DeLaHunt

On 2020-08-28 00:19, Moritz Barsnick wrote:


On Wed, Aug 26, 2020 at 23:52:58 -0700, Jim DeLaHunt wrote:

Earlier this year, there were patches[3] which aimed to put linear
timecodes in a format related to SMPTE 12M into a structure marked by a
`AV_FRAME_DATA_S12M_TIMECODE` value. Maybe that refers to a location
where you could store timecode values. You might want to search for that
identifier, and for patches by that developer. I don't know if they have
been added to the FFmpeg source yet.

They have been added to master.



Thank you for the information.



(You meant to write "[2]" above:

[2] http://ffmpeg.org/pipermail/ffmpeg-devel/2020-July/265628.html

)



Thank you. My footnote formatter is very unreliable. (Hint: the 
formatter is me.)


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

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

Re: [FFmpeg-devel] [PATCH 3/3] avfilter/allfilters: Don't cast const away

2020-08-28 Thread Moritz Barsnick
On Sun, Aug 23, 2020 at 23:31:45 +0800, Zhao Zhili wrote:
> >> I have a same patch long time ago.
> >>
> >> http://ffmpeg.org/pipermail/ffmpeg-devel/2019-October/252193.html 
> >>  
> >>  >> >
> >>
> > I applied your patch (as 26f81e5e83a015578c4c0c1d121a5e5f6c72bf8a).
>
> Thank you. Current review process is easy to lost track.

There was an unelaborated "breaks ABI" comment to that patch, which is
why Michael never applied, after originally announcing to do so.

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

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

Re: [FFmpeg-devel] [PATCH v3 3/4] lavfi: check the validity of formats lists.

2020-08-28 Thread Moritz Barsnick
On Mon, Aug 24, 2020 at 13:36:50 +0200, Nicolas George wrote:
> +switch (link->type) {
> +
> +case AVMEDIA_TYPE_VIDEO:
> +if ((ret = ff_formats_check_pixel_formats(log, cfg->formats)) < 
> 0)
> +return ret;
> +break;
> +
> +case AVMEDIA_TYPE_AUDIO:
> +if ((ret = ff_formats_check_sample_formats(log, cfg->formats)) < 
> 0 ||
> +(ret = ff_formats_check_sample_rates(log, cfg->samplerates)) 
> < 0 ||
> +(ret = ff_formats_check_channel_layouts(log, 
> cfg->channel_layouts)) < 0)
> +return ret;
> +break;
> +
> +default:
> +av_assert0(!"reached");
> +}

"case" indentation is too large.

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

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

Re: [FFmpeg-devel] Forward frame wall clock time from avdevice to HLS muxer

2020-08-28 Thread Marton Balint



On Thu, 27 Aug 2020, Jim DeLaHunt wrote:


On 2020-08-27 13:05, Marton Balint wrote:



On Thu, 27 Aug 2020, Nicolas George wrote:


Marton Balint (12020-08-27):
+1, this seems like the right thing. PTS is not really suitable, as 
that is
based (or at least should be based) on monotonic clock, not realtime 
clock.


PTS are based on what we decide they are based.


Realtime clock is not suitable for multimedia PTS source because it is 
affected by system time changes and leap seconds.



I don't get it, Marton. Why such a firm rejection of real-time clock as 
PTS source?  It seems to me that system time changes and leap seconds 
aren't difficult problems.


1. System time changes may just not occur. Some recordings may last 
days, and system clocks my drift over days, I get that. But some 
recordings last hours or even minutes. (My client's recordings last 
0.01-4 hours.)


2. You can program the recording system to not update its system clock 
while recording. I imagine one could build a system which can survive a 
few minutes or hours without updating their system clock.


3. You can use an accurate realtime clock. My client's application could 
draw real time from a GPS source, which should be pretty resistant to 
clock drift.


4. Leap seconds can only happen at 24:00 UTC on June 30 or December 31.  
If you don't happen to be recording then, no problem. If you happen to 
be recording then, then see #5 and #6 below.


5. You can work around any leap seconds or system time clock changes 
which do occur by generating PTS values which aren't quitte accurate, 
but which amortise the error over a few frames. For instance, if the PTS 
normally increments by 3003 ticks per frame (90 kHz clock, 30/1.001 
frames per second), and the system clock repeats the 23:59:59 second 
twice, then you have an error of 3003 ticks. Amortise that over n 
frames, and for each frame increment by 3003 - (3003/n) ticks. For n=10, 
that would be an increment of 2702.7 ticks. For some applications that 
might be an acceptable way to bury the error.


6. Another way to work around any leap seconds or system time clock 
changes which do occur is to keep track of events where the clock does 
not increment by the expected amount each frame (e.g. 3003 ticks in the 
case above). Make a log of the indicated realtime clock value for the 
frame, the indicated realtime clock value for the previous frame, the 
difference from expected, and continue to update the PTS by the expected 
number of ticks. For some applications that might be an acceptable way 
to bury the error.


What am I missing? Why, despite these workarounds, is a realtime clock 
not suitable as a PTS source?


You're suggesting workarounds for the problem. We want no workarounds or 
special considerations, we want it to just work.


Sure, if you promise you won't change system time, and you ensure a smooth 
time transition during leap seconds, then you may use it depending on 
application. But this certainly should not be the default, and certainly 
should not be used because PRFT is needed on the output.


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

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

Re: [FFmpeg-devel] [PATCH] avformat/wavdec: allow to change max size of single demuxed packet

2020-08-28 Thread Paul B Mahol
On 8/28/20, Andreas Rheinhardt  wrote:
> Paul B Mahol:
>> Can make demuxing much faster, expecially for files with
>> huge number of channels.
>>
>> Signed-off-by: Paul B Mahol 
>> ---
>>  libavformat/wavdec.c | 21 ++---
>>  1 file changed, 18 insertions(+), 3 deletions(-)
>>
>> diff --git a/libavformat/wavdec.c b/libavformat/wavdec.c
>> index e1b2115434..5b3c481421 100644
>> --- a/libavformat/wavdec.c
>> +++ b/libavformat/wavdec.c
>> @@ -56,6 +56,7 @@ typedef struct WAVDemuxContext {
>>  int smv_eof;
>>  int audio_eof;
>>  int ignore_length;
>> +int max_size;
>>  int spdif;
>>  int smv_cur_pt;
>>  int smv_given_first;
>> @@ -628,8 +629,6 @@ static int64_t find_guid(AVIOContext *pb, const
>> uint8_t guid1[16])
>>  return AVERROR_EOF;
>>  }
>>
>> -#define MAX_SIZE 4096
>> -
>>  static int wav_read_packet(AVFormatContext *s, AVPacket *pkt)
>>  {
>>  int ret, size;
>> @@ -706,7 +705,7 @@ smv_out:
>>  wav->data_end = avio_tell(s->pb) + left;
>>  }
>>
>> -size = MAX_SIZE;
>> +size = wav->max_size;
>>  if (st->codecpar->block_align > 1) {
>>  if (size < st->codecpar->block_align)
>>  size = st->codecpar->block_align;
>> @@ -759,6 +758,7 @@ static int wav_read_seek(AVFormatContext *s,
>>  #define DEC AV_OPT_FLAG_DECODING_PARAM
>>  static const AVOption demux_options[] = {
>>  { "ignore_length", "Ignore length", OFFSET(ignore_length),
>> AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, DEC },
>> +{ "max_size",  "max size of single packet", OFFSET(max_size),
>> AV_OPT_TYPE_INT, { .i64 = 4096 }, 1024, 1 << 22, DEC },
>>  { NULL },
>>  };
>>
>> @@ -906,6 +906,20 @@ static int w64_read_header(AVFormatContext *s)
>>  return 0;
>>  }
>>
>> +#define OFFSET(x) offsetof(WAVDemuxContext, x)
>> +#define DEC AV_OPT_FLAG_DECODING_PARAM
>> +static const AVOption w64_demux_options[] = {
>> +{ "max_size", "max size of single packet", OFFSET(max_size),
>> AV_OPT_TYPE_INT, { .i64 = 4096 }, 1024, 1 << 22, DEC },
>> +{ NULL },
>
> The ',' is unnecessary: Nothing will ever be added after the sentinel.
>
>> +};
>
> You can use &demux_options[1] instead of w64_demux_options (but add a
> comment for this).

How the comment should look like?

>
>> +
>> +static const AVClass w64_demuxer_class = {
>> +.class_name = "W64 demuxer",
>> +.item_name  = av_default_item_name,
>> +.option = w64_demux_options,
>> +.version= LIBAVUTIL_VERSION_INT,
>> +};
>> +
>>  AVInputFormat ff_w64_demuxer = {
>>  .name   = "w64",
>>  .long_name  = NULL_IF_CONFIG_SMALL("Sony Wave64"),
>> @@ -916,5 +930,6 @@ AVInputFormat ff_w64_demuxer = {
>>  .read_seek  = wav_read_seek,
>>  .flags  = AVFMT_GENERIC_INDEX,
>>  .codec_tag  = (const AVCodecTag * const []) { ff_codec_wav_tags,
>> 0 },
>> +.priv_class = &w64_demuxer_class,
>>  };
>>  #endif /* CONFIG_W64_DEMUXER */
>>
>
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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

Re: [FFmpeg-devel] [PATCH] avformat/wavdec: allow to change max size of single demuxed packet

2020-08-28 Thread Andreas Rheinhardt
Paul B Mahol:
> On 8/28/20, Andreas Rheinhardt  wrote:
>> Paul B Mahol:
>>> Can make demuxing much faster, expecially for files with
>>> huge number of channels.
>>>
>>> Signed-off-by: Paul B Mahol 
>>> ---
>>>  libavformat/wavdec.c | 21 ++---
>>>  1 file changed, 18 insertions(+), 3 deletions(-)
>>>
>>> diff --git a/libavformat/wavdec.c b/libavformat/wavdec.c
>>> index e1b2115434..5b3c481421 100644
>>> --- a/libavformat/wavdec.c
>>> +++ b/libavformat/wavdec.c
>>> @@ -56,6 +56,7 @@ typedef struct WAVDemuxContext {
>>>  int smv_eof;
>>>  int audio_eof;
>>>  int ignore_length;
>>> +int max_size;
>>>  int spdif;
>>>  int smv_cur_pt;
>>>  int smv_given_first;
>>> @@ -628,8 +629,6 @@ static int64_t find_guid(AVIOContext *pb, const
>>> uint8_t guid1[16])
>>>  return AVERROR_EOF;
>>>  }
>>>
>>> -#define MAX_SIZE 4096
>>> -
>>>  static int wav_read_packet(AVFormatContext *s, AVPacket *pkt)
>>>  {
>>>  int ret, size;
>>> @@ -706,7 +705,7 @@ smv_out:
>>>  wav->data_end = avio_tell(s->pb) + left;
>>>  }
>>>
>>> -size = MAX_SIZE;
>>> +size = wav->max_size;
>>>  if (st->codecpar->block_align > 1) {
>>>  if (size < st->codecpar->block_align)
>>>  size = st->codecpar->block_align;
>>> @@ -759,6 +758,7 @@ static int wav_read_seek(AVFormatContext *s,
>>>  #define DEC AV_OPT_FLAG_DECODING_PARAM
>>>  static const AVOption demux_options[] = {
>>>  { "ignore_length", "Ignore length", OFFSET(ignore_length),
>>> AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, DEC },
>>> +{ "max_size",  "max size of single packet", OFFSET(max_size),
>>> AV_OPT_TYPE_INT, { .i64 = 4096 }, 1024, 1 << 22, DEC },
>>>  { NULL },
>>>  };
>>>
>>> @@ -906,6 +906,20 @@ static int w64_read_header(AVFormatContext *s)
>>>  return 0;
>>>  }
>>>
>>> +#define OFFSET(x) offsetof(WAVDemuxContext, x)
>>> +#define DEC AV_OPT_FLAG_DECODING_PARAM
>>> +static const AVOption w64_demux_options[] = {
>>> +{ "max_size", "max size of single packet", OFFSET(max_size),
>>> AV_OPT_TYPE_INT, { .i64 = 4096 }, 1024, 1 << 22, DEC },
>>> +{ NULL },
>>
>> The ',' is unnecessary: Nothing will ever be added after the sentinel.
>>
>>> +};
>>
>> You can use &demux_options[1] instead of w64_demux_options (but add a
>> comment for this).
> 
> How the comment should look like?
> 

I thought of a comment for demux_options like "Hint: The options are
partially shared with the Wave64 demuxer."

>>
>>> +
>>> +static const AVClass w64_demuxer_class = {
>>> +.class_name = "W64 demuxer",
>>> +.item_name  = av_default_item_name,
>>> +.option = w64_demux_options,
>>> +.version= LIBAVUTIL_VERSION_INT,
>>> +};
>>> +
>>>  AVInputFormat ff_w64_demuxer = {
>>>  .name   = "w64",
>>>  .long_name  = NULL_IF_CONFIG_SMALL("Sony Wave64"),
>>> @@ -916,5 +930,6 @@ AVInputFormat ff_w64_demuxer = {
>>>  .read_seek  = wav_read_seek,
>>>  .flags  = AVFMT_GENERIC_INDEX,
>>>  .codec_tag  = (const AVCodecTag * const []) { ff_codec_wav_tags,
>>> 0 },
>>> +.priv_class = &w64_demuxer_class,
>>>  };
>>>  #endif /* CONFIG_W64_DEMUXER */
>>>
>>
>> ___
>> ffmpeg-devel mailing list
>> ffmpeg-devel@ffmpeg.org
>> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>>
>> To unsubscribe, visit link above, or email
>> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
> 

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

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

Re: [FFmpeg-devel] [PATCH] avformat/wavdec: allow to change max size of single demuxed packet

2020-08-28 Thread Paul B Mahol
On 8/28/20, Andreas Rheinhardt  wrote:
> Paul B Mahol:
>> On 8/28/20, Andreas Rheinhardt  wrote:
>>> Paul B Mahol:
 Can make demuxing much faster, expecially for files with
 huge number of channels.

 Signed-off-by: Paul B Mahol 
 ---
  libavformat/wavdec.c | 21 ++---
  1 file changed, 18 insertions(+), 3 deletions(-)

 diff --git a/libavformat/wavdec.c b/libavformat/wavdec.c
 index e1b2115434..5b3c481421 100644
 --- a/libavformat/wavdec.c
 +++ b/libavformat/wavdec.c
 @@ -56,6 +56,7 @@ typedef struct WAVDemuxContext {
  int smv_eof;
  int audio_eof;
  int ignore_length;
 +int max_size;
  int spdif;
  int smv_cur_pt;
  int smv_given_first;
 @@ -628,8 +629,6 @@ static int64_t find_guid(AVIOContext *pb, const
 uint8_t guid1[16])
  return AVERROR_EOF;
  }

 -#define MAX_SIZE 4096
 -
  static int wav_read_packet(AVFormatContext *s, AVPacket *pkt)
  {
  int ret, size;
 @@ -706,7 +705,7 @@ smv_out:
  wav->data_end = avio_tell(s->pb) + left;
  }

 -size = MAX_SIZE;
 +size = wav->max_size;
  if (st->codecpar->block_align > 1) {
  if (size < st->codecpar->block_align)
  size = st->codecpar->block_align;
 @@ -759,6 +758,7 @@ static int wav_read_seek(AVFormatContext *s,
  #define DEC AV_OPT_FLAG_DECODING_PARAM
  static const AVOption demux_options[] = {
  { "ignore_length", "Ignore length", OFFSET(ignore_length),
 AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, DEC },
 +{ "max_size",  "max size of single packet", OFFSET(max_size),
 AV_OPT_TYPE_INT, { .i64 = 4096 }, 1024, 1 << 22, DEC },
  { NULL },
  };

 @@ -906,6 +906,20 @@ static int w64_read_header(AVFormatContext *s)
  return 0;
  }

 +#define OFFSET(x) offsetof(WAVDemuxContext, x)
 +#define DEC AV_OPT_FLAG_DECODING_PARAM
 +static const AVOption w64_demux_options[] = {
 +{ "max_size", "max size of single packet", OFFSET(max_size),
 AV_OPT_TYPE_INT, { .i64 = 4096 }, 1024, 1 << 22, DEC },
 +{ NULL },
>>>
>>> The ',' is unnecessary: Nothing will ever be added after the sentinel.
>>>
 +};
>>>
>>> You can use &demux_options[1] instead of w64_demux_options (but add a
>>> comment for this).
>>
>> How the comment should look like?
>>
>
> I thought of a comment for demux_options like "Hint: The options are
> partially shared with the Wave64 demuxer."

More like Warning instead of Hint.
So some other developer does not add option that does not make sense for w64.

>
>>>
 +
 +static const AVClass w64_demuxer_class = {
 +.class_name = "W64 demuxer",
 +.item_name  = av_default_item_name,
 +.option = w64_demux_options,
 +.version= LIBAVUTIL_VERSION_INT,
 +};
 +
  AVInputFormat ff_w64_demuxer = {
  .name   = "w64",
  .long_name  = NULL_IF_CONFIG_SMALL("Sony Wave64"),
 @@ -916,5 +930,6 @@ AVInputFormat ff_w64_demuxer = {
  .read_seek  = wav_read_seek,
  .flags  = AVFMT_GENERIC_INDEX,
  .codec_tag  = (const AVCodecTag * const []) {
 ff_codec_wav_tags,
 0 },
 +.priv_class = &w64_demuxer_class,
  };
  #endif /* CONFIG_W64_DEMUXER */

>>>
>>> ___
>>> ffmpeg-devel mailing list
>>> ffmpeg-devel@ffmpeg.org
>>> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>>>
>>> To unsubscribe, visit link above, or email
>>> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
>> ___
>> ffmpeg-devel mailing list
>> ffmpeg-devel@ffmpeg.org
>> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>>
>> To unsubscribe, visit link above, or email
>> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
>>
>
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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

Re: [FFmpeg-devel] [PATCH] avformat/wavdec: allow to change max size of single demuxed packet

2020-08-28 Thread Paul B Mahol
On 8/28/20, Paul B Mahol  wrote:
> On 8/28/20, Andreas Rheinhardt  wrote:
>> Paul B Mahol:
>>> On 8/28/20, Andreas Rheinhardt  wrote:
 Paul B Mahol:
> Can make demuxing much faster, expecially for files with
> huge number of channels.
>
> Signed-off-by: Paul B Mahol 
> ---
>  libavformat/wavdec.c | 21 ++---
>  1 file changed, 18 insertions(+), 3 deletions(-)
>
> diff --git a/libavformat/wavdec.c b/libavformat/wavdec.c
> index e1b2115434..5b3c481421 100644
> --- a/libavformat/wavdec.c
> +++ b/libavformat/wavdec.c
> @@ -56,6 +56,7 @@ typedef struct WAVDemuxContext {
>  int smv_eof;
>  int audio_eof;
>  int ignore_length;
> +int max_size;
>  int spdif;
>  int smv_cur_pt;
>  int smv_given_first;
> @@ -628,8 +629,6 @@ static int64_t find_guid(AVIOContext *pb, const
> uint8_t guid1[16])
>  return AVERROR_EOF;
>  }
>
> -#define MAX_SIZE 4096
> -
>  static int wav_read_packet(AVFormatContext *s, AVPacket *pkt)
>  {
>  int ret, size;
> @@ -706,7 +705,7 @@ smv_out:
>  wav->data_end = avio_tell(s->pb) + left;
>  }
>
> -size = MAX_SIZE;
> +size = wav->max_size;
>  if (st->codecpar->block_align > 1) {
>  if (size < st->codecpar->block_align)
>  size = st->codecpar->block_align;
> @@ -759,6 +758,7 @@ static int wav_read_seek(AVFormatContext *s,
>  #define DEC AV_OPT_FLAG_DECODING_PARAM
>  static const AVOption demux_options[] = {
>  { "ignore_length", "Ignore length", OFFSET(ignore_length),
> AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, DEC },
> +{ "max_size",  "max size of single packet", OFFSET(max_size),
> AV_OPT_TYPE_INT, { .i64 = 4096 }, 1024, 1 << 22, DEC },
>  { NULL },
>  };
>
> @@ -906,6 +906,20 @@ static int w64_read_header(AVFormatContext *s)
>  return 0;
>  }
>
> +#define OFFSET(x) offsetof(WAVDemuxContext, x)
> +#define DEC AV_OPT_FLAG_DECODING_PARAM
> +static const AVOption w64_demux_options[] = {
> +{ "max_size", "max size of single packet", OFFSET(max_size),
> AV_OPT_TYPE_INT, { .i64 = 4096 }, 1024, 1 << 22, DEC },
> +{ NULL },

 The ',' is unnecessary: Nothing will ever be added after the sentinel.

> +};

 You can use &demux_options[1] instead of w64_demux_options (but add a
 comment for this).
>>>
>>> How the comment should look like?
>>>
>>
>> I thought of a comment for demux_options like "Hint: The options are
>> partially shared with the Wave64 demuxer."
>
> More like Warning instead of Hint.
> So some other developer does not add option that does not make sense for
> w64.

Problem is demux_options are under ifdef so can not be shared as is.
What about using macro to define max_size option or just keep it as in
this patch.

>
>>

> +
> +static const AVClass w64_demuxer_class = {
> +.class_name = "W64 demuxer",
> +.item_name  = av_default_item_name,
> +.option = w64_demux_options,
> +.version= LIBAVUTIL_VERSION_INT,
> +};
> +
>  AVInputFormat ff_w64_demuxer = {
>  .name   = "w64",
>  .long_name  = NULL_IF_CONFIG_SMALL("Sony Wave64"),
> @@ -916,5 +930,6 @@ AVInputFormat ff_w64_demuxer = {
>  .read_seek  = wav_read_seek,
>  .flags  = AVFMT_GENERIC_INDEX,
>  .codec_tag  = (const AVCodecTag * const []) {
> ff_codec_wav_tags,
> 0 },
> +.priv_class = &w64_demuxer_class,
>  };
>  #endif /* CONFIG_W64_DEMUXER */
>

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

 To unsubscribe, visit link above, or email
 ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
>>> ___
>>> ffmpeg-devel mailing list
>>> ffmpeg-devel@ffmpeg.org
>>> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>>>
>>> To unsubscribe, visit link above, or email
>>> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
>>>
>>
>> ___
>> ffmpeg-devel mailing list
>> ffmpeg-devel@ffmpeg.org
>> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>>
>> To unsubscribe, visit link above, or email
>> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
>
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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

Re: [FFmpeg-devel] [PATCH 3/3] avfilter/allfilters: Don't cast const away

2020-08-28 Thread zhilizhao


> On Aug 28, 2020, at 3:33 PM, Moritz Barsnick  wrote:
> 
> On Sun, Aug 23, 2020 at 23:31:45 +0800, Zhao Zhili wrote:
 I have a same patch long time ago.
 
 http://ffmpeg.org/pipermail/ffmpeg-devel/2019-October/252193.html 
  
 >
 
>>> I applied your patch (as 26f81e5e83a015578c4c0c1d121a5e5f6c72bf8a).
>> 
>> Thank you. Current review process is easy to lost track.
> 
> There was an unelaborated "breaks ABI" comment to that patch, which is
> why Michael never applied, after originally announcing to do so.

Yes, I understand why it’s not applied. It’s my mistake to forget the patch,
but a merge-request/pull-request tracking system is useful in this case.
Now I found out patchwork can query with submitter, which is better than
nothing.

> 
> Moritz
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

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

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

Re: [FFmpeg-devel] Forward frame wall clock time from avdevice to HLS muxer

2020-08-28 Thread Nicolas George
Marton Balint (12020-08-28):
> Sure, if you promise you won't change system time, and you ensure a smooth
> time transition during leap seconds, then you may use it depending on
> application. But this certainly should not be the default

Nobody suggested that it be the default. But it should be an option.
Remember the principle: the users know best.

Regards,

-- 
  Nicolas George


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

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

[FFmpeg-devel] Adding 0YUV support for packed 4:4:4 pixel format

2020-08-28 Thread 赵娟
Hi FFmpeg community,

I read through the previous AYUV and 0YUV discussion
https://patchwork.ffmpeg.org/project/ffmpeg/patch/1566973334-19107-1-git-send-email-linjie.fu%40intel.com/,
we already reached some conclusion that we will add 0YUV support. Why we
need this format is well discussed in the previous patch review process:
“Add support for packed 4:4:4 pixel format”.

If there are no objections, we will submit a new patch to add 0YUV support
for the further review.

(Hope you didn’t ignore my voice who doesn’t contribute code directly,
later, we will discuss 12bit support in another thread. : ) )



Thank you very much,

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

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

Re: [FFmpeg-devel] [mov] See if mfra makes up the difference for an incomplete sidx.

2020-08-28 Thread Derek Buitenhuis
On 27/08/2020 19:13, Dale Curtis wrote:
> Bump to get this applied. Thanks!

Done.

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

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

Re: [FFmpeg-devel] [PATCH] avcodec/videotoolboxenc: don't wait when flushing data

2020-08-28 Thread Rick Kern
On Wed, Aug 26, 2020 at 10:53 PM Steven Liu  wrote:

> From: Tian Qi 
>
> because there is run in thread mode, few times will block
> the workflow at the wait, so check the status is flushing data,
> don't wait when flushing data.
>
I'd like to reproduce the issue and test the fix before the patch is
applied, so if you can provide a media file that causes the issue or code
snippet, it would be helpful.

It looks like this could happen after an encoding error. Do you see any
"Error encoding frame ..." logs?

>
> Signed-off-by: Tian Qi 
> Signed-off-by: Steven Liu 
> ---
>  libavcodec/videotoolboxenc.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/libavcodec/videotoolboxenc.c b/libavcodec/videotoolboxenc.c
> index e89cfaeed8..f9626be18f 100644
> --- a/libavcodec/videotoolboxenc.c
> +++ b/libavcodec/videotoolboxenc.c
> @@ -292,7 +292,7 @@ static int vtenc_q_pop(VTEncContext *vtctx, bool wait,
> CMSampleBufferRef *buf, E
>  return 0;
>  }
>
> -while (!vtctx->q_head && !vtctx->async_error && wait) {
> +while (!vtctx->q_head && !vtctx->async_error && wait &&
> !vtctx->flushing) {
>  pthread_cond_wait(&vtctx->cv_sample_sent, &vtctx->lock);
>  }
>
> @@ -308,6 +308,7 @@ static int vtenc_q_pop(VTEncContext *vtctx, bool wait,
> CMSampleBufferRef *buf, E
>  vtctx->q_tail = NULL;
>  }
>
> +vtctx->frame_ct_out++;
>  pthread_mutex_unlock(&vtctx->lock);
>
>  *buf = info->cm_buffer;
> @@ -319,7 +320,6 @@ static int vtenc_q_pop(VTEncContext *vtctx, bool wait,
> CMSampleBufferRef *buf, E
>  }
>  av_free(info);
>
> -vtctx->frame_ct_out++;
>
>  return 0;
>  }
> --
> 2.25.0
>
>
>
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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

[FFmpeg-devel] [FFmpeg-dev] build error at libavformat/udp.o

2020-08-28 Thread Hyoung Kim


Hi,

  I am a newbie about FFmpeg.
  I just need it for using Alexa AVS 1.18.0.

  While I try to build the FFmpeg for Android, I got a build error like

  src/libavformat/udp.c:290:28: error: member reference base type 
'__be32' (aka 'unsigned int') is not a structure or union
mreqs.imr_multiaddr.s_add = ((structure sockaddr_in 
*)addr)...

  The above problem has happened for FFmpeg 4.3.1 and 4.2.1 and 4.1.6, but no 
problem for 4.0.6.

  Does anybody have any idea about this? Any help will be appreciated.

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

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

[FFmpeg-devel] Initialize `layout_map` on declaration

2020-08-28 Thread 王消寒
Resend with @chromium.org account. Sorry for the noise.
From 3f9a085802bec62c9c7d35efcd30107e348c54d4 Mon Sep 17 00:00:00 2001
From: Xiaohan Wang 
Date: Fri, 28 Aug 2020 12:51:19 -0700
Subject: [PATCH] Initialize `layout_map` on declaration

Without this change, it'll cause use-of-uninitialized-variable error.
---
 libavcodec/aacdec_template.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/aacdec_template.c b/libavcodec/aacdec_template.c
index e8af01b084..76fffedfcb 100644
--- a/libavcodec/aacdec_template.c
+++ b/libavcodec/aacdec_template.c
@@ -3312,7 +3312,7 @@ static int aac_decode_frame_int(AVCodecContext *avctx, void *data,
 break;
 
 case TYPE_PCE: {
-uint8_t layout_map[MAX_ELEM_ID*4][3];
+uint8_t layout_map[MAX_ELEM_ID*4][3] = {{0}};
 int tags;
 
 int pushed = push_output_configuration(ac);
-- 
2.28.0.402.g5ffc5be6b7-goog

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

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

Re: [FFmpeg-devel] [PATCH] avcodec/cfhd: Check transform type

2020-08-28 Thread Michael Niedermayer
On Fri, Aug 28, 2020 at 01:31:38AM +0200, Paul B Mahol wrote:
> On 8/28/20, Michael Niedermayer  wrote:
> > Fixes: out of array access
> > Fixes:
> > 24823/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_CFHD_fuzzer-4855119863349248
> >
> > Found-by: continuous fuzzing process
> > https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> > Signed-off-by: Michael Niedermayer 
> > ---
> >  libavcodec/cfhd.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> 
> It is not invalid, but unsupported.

fixed error code and message locally

Is there some specification for this ?
i was looking yesterday but google failed to point me to one

thx

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

Everything should be made as simple as possible, but not simpler.
-- Albert Einstein


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

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

Re: [FFmpeg-devel] [PATCH] avcodec/cfhd: Check transform type

2020-08-28 Thread Paul B Mahol
On 8/28/20, Michael Niedermayer  wrote:
> On Fri, Aug 28, 2020 at 01:31:38AM +0200, Paul B Mahol wrote:
>> On 8/28/20, Michael Niedermayer  wrote:
>> > Fixes: out of array access
>> > Fixes:
>> > 24823/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_CFHD_fuzzer-4855119863349248
>> >
>> > Found-by: continuous fuzzing process
>> > https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
>> > Signed-off-by: Michael Niedermayer 
>> > ---
>> >  libavcodec/cfhd.c | 2 +-
>> >  1 file changed, 1 insertion(+), 1 deletion(-)
>> >
>>
>> It is not invalid, but unsupported.
>
> fixed error code and message locally
>
> Is there some specification for this ?
> i was looking yesterday but google failed to point me to one
>

No specifications, just SDK on github.

Also I'm unsure if that is sufficient fix for the underline issue.


> thx
>
> [...]
> --
> Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> Everything should be made as simple as possible, but not simpler.
> -- Albert Einstein
>
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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

Re: [FFmpeg-devel] Initialize `layout_map` on declaration

2020-08-28 Thread Jan Ekström
On Fri, Aug 28, 2020 at 11:01 PM Xiaohan Wang (王消寒)  wrote:
>
> Resend with @chromium.org account. Sorry for the noise.

I think something like this could be the underlying issue that got hit
when the 22.2 check was too lax and set incorrect parameters earlier
in the parsing process? What this defines it as is: "TYPE_SCE, 0th of
this type, AAC_CHANNEL_OFF" I guess, which maybe is OK?

I do see quite a few definitions of this in various places in
libavcodec/aacdec_template.c, though, with `git grep -E
"layout_map\[MAX_ELEM_ID.*\*.*4\]\[3\]"`. I do wonder if those should
also be similarly initialized?

For the record, the sanity check needed to be fixed anyways, and that
also fixed the fuzzing issues reported upstream:
http://git.videolan.org/?p=ffmpeg.git;a=commit;h=d6f293353c94c7ce200f6e0975ae3de49787f91f

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

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

Re: [FFmpeg-devel] [PATCH] avcodec/cfhd: Check transform type

2020-08-28 Thread Michael Niedermayer
On Fri, Aug 28, 2020 at 10:24:04PM +0200, Paul B Mahol wrote:
> On 8/28/20, Michael Niedermayer  wrote:
> > On Fri, Aug 28, 2020 at 01:31:38AM +0200, Paul B Mahol wrote:
> >> On 8/28/20, Michael Niedermayer  wrote:
> >> > Fixes: out of array access
> >> > Fixes:
> >> > 24823/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_CFHD_fuzzer-4855119863349248
> >> >
> >> > Found-by: continuous fuzzing process
> >> > https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> >> > Signed-off-by: Michael Niedermayer 
> >> > ---
> >> >  libavcodec/cfhd.c | 2 +-
> >> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >> >
> >>
> >> It is not invalid, but unsupported.
> >
> > fixed error code and message locally
> >
> > Is there some specification for this ?
> > i was looking yesterday but google failed to point me to one
> >
> 
> No specifications, just SDK on github.
> 
> Also I'm unsure if that is sufficient fix for the underline issue.

I suspect the decoder has more issues. I was hoping that there is a
specification that i could base validity and tag ordering checks on.


Thanks

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

Many things microsoft did are stupid, but not doing something just because
microsoft did it is even more stupid. If everything ms did were stupid they
would be bankrupt already.


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

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

Re: [FFmpeg-devel] [PATCH] avcodec/cfhd: Check transform type

2020-08-28 Thread Paul B Mahol
On 8/28/20, Michael Niedermayer  wrote:
> On Fri, Aug 28, 2020 at 10:24:04PM +0200, Paul B Mahol wrote:
>> On 8/28/20, Michael Niedermayer  wrote:
>> > On Fri, Aug 28, 2020 at 01:31:38AM +0200, Paul B Mahol wrote:
>> >> On 8/28/20, Michael Niedermayer  wrote:
>> >> > Fixes: out of array access
>> >> > Fixes:
>> >> > 24823/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_CFHD_fuzzer-4855119863349248
>> >> >
>> >> > Found-by: continuous fuzzing process
>> >> > https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
>> >> > Signed-off-by: Michael Niedermayer 
>> >> > ---
>> >> >  libavcodec/cfhd.c | 2 +-
>> >> >  1 file changed, 1 insertion(+), 1 deletion(-)
>> >> >
>> >>
>> >> It is not invalid, but unsupported.
>> >
>> > fixed error code and message locally
>> >
>> > Is there some specification for this ?
>> > i was looking yesterday but google failed to point me to one
>> >
>>
>> No specifications, just SDK on github.
>>
>> Also I'm unsure if that is sufficient fix for the underline issue.
>
> I suspect the decoder has more issues. I was hoping that there is a
> specification that i could base validity and tag ordering checks on.
>

Look at encoder, it follows tag order, note that some tags are purely optional.

>
> Thanks
>
> [...]
> --
> Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> Many things microsoft did are stupid, but not doing something just because
> microsoft did it is even more stupid. If everything ms did were stupid they
> would be bankrupt already.
>
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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

[FFmpeg-devel] [PATCH 3/4] avcodec: add MobiClip video decoder

2020-08-28 Thread Paul B Mahol
Signed-off-by: Paul B Mahol 
---
 libavcodec/Makefile |1 +
 libavcodec/allcodecs.c  |1 +
 libavcodec/codec_desc.c |7 +
 libavcodec/codec_id.h   |1 +
 libavcodec/mobiclip.c   | 1306 +++
 5 files changed, 1316 insertions(+)
 create mode 100644 libavcodec/mobiclip.c

diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 6f75f26c84..97fbe6b7a9 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -453,6 +453,7 @@ OBJS-$(CONFIG_MJPEG_VAAPI_ENCODER) += 
vaapi_encode_mjpeg.o
 OBJS-$(CONFIG_MLP_DECODER) += mlpdec.o mlpdsp.o
 OBJS-$(CONFIG_MLP_ENCODER) += mlpenc.o mlp.o
 OBJS-$(CONFIG_MMVIDEO_DECODER) += mmvideo.o
+OBJS-$(CONFIG_MOBICLIP_DECODER)+= mobiclip.o
 OBJS-$(CONFIG_MOTIONPIXELS_DECODER)+= motionpixels.o
 OBJS-$(CONFIG_MOVTEXT_DECODER) += movtextdec.o ass.o
 OBJS-$(CONFIG_MOVTEXT_ENCODER) += movtextenc.o ass_split.o
diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
index 3920eb37ce..8a4b3fb178 100644
--- a/libavcodec/allcodecs.c
+++ b/libavcodec/allcodecs.c
@@ -186,6 +186,7 @@ extern AVCodec ff_mjpeg_encoder;
 extern AVCodec ff_mjpeg_decoder;
 extern AVCodec ff_mjpegb_decoder;
 extern AVCodec ff_mmvideo_decoder;
+extern AVCodec ff_mobiclip_decoder;
 extern AVCodec ff_motionpixels_decoder;
 extern AVCodec ff_mpeg1video_encoder;
 extern AVCodec ff_mpeg1video_decoder;
diff --git a/libavcodec/codec_desc.c b/libavcodec/codec_desc.c
index 9a3eaf7d98..ceef244ebf 100644
--- a/libavcodec/codec_desc.c
+++ b/libavcodec/codec_desc.c
@@ -1784,6 +1784,13 @@ static const AVCodecDescriptor codec_descriptors[] = {
 .long_name = NULL_IF_CONFIG_SMALL("PFM (Portable FloatMap) image"),
 .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS,
 },
+{
+.id= AV_CODEC_ID_MOBICLIP,
+.type  = AVMEDIA_TYPE_VIDEO,
+.name  = "mobiclip",
+.long_name = NULL_IF_CONFIG_SMALL("MobiClip Video"),
+.props = AV_CODEC_PROP_LOSSY,
+},
 
 /* various PCM "codecs" */
 {
diff --git a/libavcodec/codec_id.h b/libavcodec/codec_id.h
index aac7f63eb6..19d5014bb4 100644
--- a/libavcodec/codec_id.h
+++ b/libavcodec/codec_id.h
@@ -296,6 +296,7 @@ enum AVCodecID {
 AV_CODEC_ID_MV30,
 AV_CODEC_ID_NOTCHLC,
 AV_CODEC_ID_PFM,
+AV_CODEC_ID_MOBICLIP,
 
 /* various PCM "codecs" */
 AV_CODEC_ID_FIRST_AUDIO = 0x1, ///< A dummy id pointing at the 
start of audio codecs
diff --git a/libavcodec/mobiclip.c b/libavcodec/mobiclip.c
new file mode 100644
index 00..0d3e23a9f9
--- /dev/null
+++ b/libavcodec/mobiclip.c
@@ -0,0 +1,1306 @@
+/*
+ * MobiClip Video decoder
+ * Copyright (c) 2017 Adib Surani
+ * Copyright (c) 2020 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 
+
+#include "libavutil/avassert.h"
+
+#include "avcodec.h"
+#include "bytestream.h"
+#include "bswapdsp.h"
+#include "get_bits.h"
+#include "internal.h"
+
+static const uint8_t zigzag8x8_tab[] =
+{
+0x00, 0x01, 0x08, 0x10, 0x09, 0x02, 0x03, 0x0A, 0x11, 0x18, 0x20, 0x19,
+0x12, 0x0B, 0x04, 0x05, 0x0C, 0x13, 0x1A, 0x21, 0x28, 0x30, 0x29, 0x22,
+0x1B, 0x14, 0x0D, 0x06, 0x07, 0x0E, 0x15, 0x1C, 0x23, 0x2A, 0x31, 0x38,
+0x39, 0x32, 0x2B, 0x24, 0x1D, 0x16, 0x0F, 0x17, 0x1E, 0x25, 0x2C, 0x33,
+0x3A, 0x3B, 0x34, 0x2D, 0x26, 0x1F, 0x27, 0x2E, 0x35, 0x3C, 0x3D, 0x36,
+0x2F, 0x37, 0x3E, 0x3F
+};
+
+static const uint8_t zigzag4x4_tab[] =
+{
+0x00, 0x04, 0x01, 0x02, 0x05, 0x08, 0x0C, 0x09, 0x06, 0x03, 0x07, 0x0A,
+0x0D, 0x0E, 0x0B, 0x0F
+};
+
+static const uint8_t quant4x4_tab[][16] =
+{
+{ 10, 13, 13, 10, 16, 10, 13, 13, 13, 13, 16, 10, 16, 13, 13, 16 },
+{ 11, 14, 14, 11, 18, 11, 14, 14, 14, 14, 18, 11, 18, 14, 14, 18 },
+{ 13, 16, 16, 13, 20, 13, 16, 16, 16, 16, 20, 13, 20, 16, 16, 20 },
+{ 14, 18, 18, 14, 23, 14, 18, 18, 18, 18, 23, 14, 23, 18, 18, 23 },
+{ 16, 20, 20, 16, 25, 16, 20, 20, 20, 20, 25, 16, 25, 20, 20, 25 },
+{ 18, 23, 23, 18, 29, 18, 23, 23, 23, 23, 29, 18, 29, 23, 23, 29 },
+};
+
+static const uint8_t quant8x8_tab[][64] =
+{
+{ 20, 19, 19, 25, 18, 25, 19, 24, 24, 19, 20, 18, 32, 18, 20, 19, 19, 24, 
24, 19, 19, 25, 18, 2

[FFmpeg-devel] [PATCH 1/4] avcodec: add ADPCM IMA MOFLEX decoder

2020-08-28 Thread Paul B Mahol
Signed-off-by: Paul B Mahol 
---
 libavcodec/Makefile |  1 +
 libavcodec/adpcm.c  | 26 ++
 libavcodec/allcodecs.c  |  1 +
 libavcodec/codec_desc.c |  7 +++
 libavcodec/codec_id.h   |  1 +
 libavcodec/utils.c  |  2 ++
 6 files changed, 38 insertions(+)

diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index ca2e8a2530..191c4e0a7c 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -866,6 +866,7 @@ OBJS-$(CONFIG_ADPCM_IMA_DK4_DECODER)  += adpcm.o 
adpcm_data.o
 OBJS-$(CONFIG_ADPCM_IMA_EA_EACS_DECODER)  += adpcm.o adpcm_data.o
 OBJS-$(CONFIG_ADPCM_IMA_EA_SEAD_DECODER)  += adpcm.o adpcm_data.o
 OBJS-$(CONFIG_ADPCM_IMA_ISS_DECODER)  += adpcm.o adpcm_data.o
+OBJS-$(CONFIG_ADPCM_IMA_MOFLEX_DECODER)   += adpcm.o adpcm_data.o
 OBJS-$(CONFIG_ADPCM_IMA_MTF_DECODER)  += adpcm.o adpcm_data.o
 OBJS-$(CONFIG_ADPCM_IMA_OKI_DECODER)  += adpcm.o adpcm_data.o
 OBJS-$(CONFIG_ADPCM_IMA_QT_DECODER)   += adpcm.o adpcm_data.o
diff --git a/libavcodec/adpcm.c b/libavcodec/adpcm.c
index 1366932352..71e37efde7 100644
--- a/libavcodec/adpcm.c
+++ b/libavcodec/adpcm.c
@@ -210,6 +210,7 @@ static av_cold int adpcm_decode_init(AVCodecContext * avctx)
 case AV_CODEC_ID_ADPCM_PSX:
 case AV_CODEC_ID_ADPCM_MTAF:
 case AV_CODEC_ID_ADPCM_ARGO:
+case AV_CODEC_ID_ADPCM_IMA_MOFLEX:
 avctx->sample_fmt = AV_SAMPLE_FMT_S16P;
 break;
 case AV_CODEC_ID_ADPCM_IMA_WS:
@@ -774,6 +775,7 @@ static int get_nb_samples(AVCodecContext *avctx, 
GetByteContext *gb,
 case AV_CODEC_ID_ADPCM_4XM:
 case AV_CODEC_ID_ADPCM_AGM:
 case AV_CODEC_ID_ADPCM_IMA_DAT4:
+case AV_CODEC_ID_ADPCM_IMA_MOFLEX:
 case AV_CODEC_ID_ADPCM_IMA_ISS: header_size = 4 * ch;  break;
 case AV_CODEC_ID_ADPCM_IMA_AMV: header_size = 8;   break;
 case AV_CODEC_ID_ADPCM_IMA_SMJPEG:  header_size = 4 * ch;  break;
@@ -1298,6 +1300,29 @@ static int adpcm_decode_frame(AVCodecContext *avctx, 
void *data,
 *samples++ = adpcm_ima_expand_nibble(&c->status[st], v2, 3);
 }
 break;
+case AV_CODEC_ID_ADPCM_IMA_MOFLEX:
+for (channel = 0; channel < avctx->channels; channel++) {
+cs = &c->status[channel];
+cs->step_index = sign_extend(bytestream2_get_le16u(&gb), 16);
+cs->predictor  = sign_extend(bytestream2_get_le16u(&gb), 16);
+if (cs->step_index > 88u){
+av_log(avctx, AV_LOG_ERROR, "ERROR: step_index[%d] = %i\n",
+   channel, cs->step_index);
+return AVERROR_INVALIDDATA;
+}
+}
+
+for (int subframe = 0; subframe < nb_samples / 256; subframe++) {
+for (channel = 0; channel < avctx->channels; channel++) {
+samples = samples_p[channel] + 256 * subframe;
+for (n = 0; n < 256; n += 2) {
+int v = bytestream2_get_byteu(&gb);
+*samples++ = adpcm_ima_expand_nibble(&c->status[channel], 
v & 0x0F, 3);
+*samples++ = adpcm_ima_expand_nibble(&c->status[channel], 
v >> 4  , 3);
+}
+}
+}
+break;
 case AV_CODEC_ID_ADPCM_IMA_DAT4:
 for (channel = 0; channel < avctx->channels; channel++) {
 cs = &c->status[channel];
@@ -2107,6 +2132,7 @@ ADPCM_DECODER(AV_CODEC_ID_ADPCM_IMA_DK4, 
sample_fmts_s16,  adpcm_ima_dk4,
 ADPCM_DECODER(AV_CODEC_ID_ADPCM_IMA_EA_EACS, sample_fmts_s16,  
adpcm_ima_ea_eacs, "ADPCM IMA Electronic Arts EACS");
 ADPCM_DECODER(AV_CODEC_ID_ADPCM_IMA_EA_SEAD, sample_fmts_s16,  
adpcm_ima_ea_sead, "ADPCM IMA Electronic Arts SEAD");
 ADPCM_DECODER(AV_CODEC_ID_ADPCM_IMA_ISS, sample_fmts_s16,  adpcm_ima_iss,  
   "ADPCM IMA Funcom ISS");
+ADPCM_DECODER(AV_CODEC_ID_ADPCM_IMA_MOFLEX,  sample_fmts_s16p, 
adpcm_ima_moflex,  "ADPCM IMA MobiClip MOFLEX");
 ADPCM_DECODER(AV_CODEC_ID_ADPCM_IMA_MTF, sample_fmts_s16,  adpcm_ima_mtf,  
   "ADPCM IMA Capcom's MT Framework");
 ADPCM_DECODER(AV_CODEC_ID_ADPCM_IMA_OKI, sample_fmts_s16,  adpcm_ima_oki,  
   "ADPCM IMA Dialogic OKI");
 ADPCM_DECODER(AV_CODEC_ID_ADPCM_IMA_QT,  sample_fmts_s16p, adpcm_ima_qt,   
   "ADPCM IMA QuickTime");
diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
index 729d2fd9ad..084a289c9e 100644
--- a/libavcodec/allcodecs.c
+++ b/libavcodec/allcodecs.c
@@ -619,6 +619,7 @@ extern AVCodec ff_adpcm_ima_dk4_decoder;
 extern AVCodec ff_adpcm_ima_ea_eacs_decoder;
 extern AVCodec ff_adpcm_ima_ea_sead_decoder;
 extern AVCodec ff_adpcm_ima_iss_decoder;
+extern AVCodec ff_adpcm_ima_moflex_decoder;
 extern AVCodec ff_adpcm_ima_mtf_decoder;
 extern AVCodec ff_adpcm_ima_oki_decoder;
 extern AVCodec ff_adpcm_ima_qt_encoder;
diff --git a/libavcodec/codec_desc.c b/libavcodec/codec_desc.c
index 0ae6aee63b..b5bc5c3c71 100644
--- a/libavcodec/codec_desc.c
+++ b/libavcodec/codec_desc.c
@@ -2376,6 +2376,13 @@ static const AVCodecD

[FFmpeg-devel] [PATCH 2/4] avcodec: add FastAudio decoder

2020-08-28 Thread Paul B Mahol
Signed-off-by: Paul B Mahol 
---
 libavcodec/Makefile |   1 +
 libavcodec/allcodecs.c  |   1 +
 libavcodec/codec_desc.c |   7 ++
 libavcodec/codec_id.h   |   1 +
 libavcodec/fastaudio.c  | 200 
 libavcodec/utils.c  |   2 +
 6 files changed, 212 insertions(+)
 create mode 100644 libavcodec/fastaudio.c

diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 191c4e0a7c..6f75f26c84 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -317,6 +317,7 @@ OBJS-$(CONFIG_ESCAPE124_DECODER)   += escape124.o
 OBJS-$(CONFIG_ESCAPE130_DECODER)   += escape130.o
 OBJS-$(CONFIG_EVRC_DECODER)+= evrcdec.o acelp_vectors.o lsp.o
 OBJS-$(CONFIG_EXR_DECODER) += exr.o exrdsp.o
+OBJS-$(CONFIG_FASTAUDIO_DECODER)   += fastaudio.o
 OBJS-$(CONFIG_FFV1_DECODER)+= ffv1dec.o ffv1.o
 OBJS-$(CONFIG_FFV1_ENCODER)+= ffv1enc.o ffv1.o
 OBJS-$(CONFIG_FFWAVESYNTH_DECODER) += ffwavesynth.o
diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
index 084a289c9e..3920eb37ce 100644
--- a/libavcodec/allcodecs.c
+++ b/libavcodec/allcodecs.c
@@ -430,6 +430,7 @@ extern AVCodec ff_dst_decoder;
 extern AVCodec ff_eac3_encoder;
 extern AVCodec ff_eac3_decoder;
 extern AVCodec ff_evrc_decoder;
+extern AVCodec ff_fastaudio_decoder;
 extern AVCodec ff_ffwavesynth_decoder;
 extern AVCodec ff_flac_encoder;
 extern AVCodec ff_flac_decoder;
diff --git a/libavcodec/codec_desc.c b/libavcodec/codec_desc.c
index b5bc5c3c71..9a3eaf7d98 100644
--- a/libavcodec/codec_desc.c
+++ b/libavcodec/codec_desc.c
@@ -3130,6 +3130,13 @@ static const AVCodecDescriptor codec_descriptors[] = {
 .long_name = NULL_IF_CONFIG_SMALL("CRI HCA"),
 .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY,
 },
+{
+.id= AV_CODEC_ID_FASTAUDIO,
+.type  = AVMEDIA_TYPE_AUDIO,
+.name  = "fastaudio",
+.long_name = NULL_IF_CONFIG_SMALL("MobiClip FastAudio"),
+.props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY,
+},
 
 /* subtitle codecs */
 {
diff --git a/libavcodec/codec_id.h b/libavcodec/codec_id.h
index aac1174f28..aac7f63eb6 100644
--- a/libavcodec/codec_id.h
+++ b/libavcodec/codec_id.h
@@ -504,6 +504,7 @@ enum AVCodecID {
 AV_CODEC_ID_MPEGH_3D_AUDIO,
 AV_CODEC_ID_SIREN,
 AV_CODEC_ID_HCA,
+AV_CODEC_ID_FASTAUDIO,
 
 /* subtitle codecs */
 AV_CODEC_ID_FIRST_SUBTITLE = 0x17000,  ///< A dummy ID pointing at 
the start of subtitle codecs.
diff --git a/libavcodec/fastaudio.c b/libavcodec/fastaudio.c
new file mode 100644
index 00..354336d17e
--- /dev/null
+++ b/libavcodec/fastaudio.c
@@ -0,0 +1,200 @@
+/*
+ * MOFLEX Fast Audio decoder
+ * Copyright (c) 2020 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/intreadwrite.h"
+
+#include "avcodec.h"
+#include "bytestream.h"
+#include "internal.h"
+#include "mathops.h"
+
+typedef struct ChannelItems {
+float f[8];
+float last;
+} ChannelItems;
+
+typedef struct FastAudioContext {
+float table[8][64];
+
+ChannelItems *ch;
+} FastAudioContext;
+
+static av_cold int fastaudio_init(AVCodecContext *avctx)
+{
+FastAudioContext *s = avctx->priv_data;
+
+avctx->sample_fmt = AV_SAMPLE_FMT_FLTP;
+
+for (int i = 0; i < 8; i++)
+s->table[0][i] = (i - 159.5f) / 160.f;
+for (int i = 0; i < 11; i++)
+s->table[0][i + 8] = (i - 37.5f) / 40.f;
+for (int i = 0; i < 27; i++)
+s->table[0][i + 8 + 11] = (i - 13.f) / 20.f;
+for (int i = 0; i < 11; i++)
+s->table[0][i + 8 + 11 + 27] = (i + 27.5f) / 40.f;
+for (int i = 0; i < 7; i++)
+s->table[0][i + 8 + 11 + 27 + 11] = (i + 152.5f) / 160.f;
+
+memcpy(s->table[1], s->table[0], sizeof(s->table[0]));
+
+for (int i = 0; i < 7; i++)
+s->table[2][i] = (i - 33.5f) / 40.f;
+for (int i = 0; i < 25; i++)
+s->table[2][i + 7] = (i - 13.f) / 20.f;
+
+for (int i = 0; i < 32; i++)
+s->table[3][i] = -s->table[2][31 - i];
+
+for (int i = 0; i < 16; i++)
+s->table[4][i] = i * 0.22f / 3.f - 0.6f;
+
+for (int i = 0; i < 16; i++)
+s->table[5][i] = i * 0.20f / 3.f - 0.3f;
+
+for (int

[FFmpeg-devel] [PATCH 4/4] avformat: add moflex demuxer

2020-08-28 Thread Paul B Mahol
Signed-off-by: Paul B Mahol 
---
 libavformat/Makefile |   1 +
 libavformat/allformats.c |   1 +
 libavformat/moflex.c | 351 +++
 3 files changed, 353 insertions(+)
 create mode 100644 libavformat/moflex.c

diff --git a/libavformat/Makefile b/libavformat/Makefile
index cbb33fe37c..1e0ac317e5 100644
--- a/libavformat/Makefile
+++ b/libavformat/Makefile
@@ -319,6 +319,7 @@ OBJS-$(CONFIG_MLV_DEMUXER)   += mlvdec.o 
riffdec.o
 OBJS-$(CONFIG_MM_DEMUXER)+= mm.o
 OBJS-$(CONFIG_MMF_DEMUXER)   += mmf.o
 OBJS-$(CONFIG_MMF_MUXER) += mmf.o rawenc.o
+OBJS-$(CONFIG_MOFLEX_DEMUXER)+= moflex.o
 OBJS-$(CONFIG_MOV_DEMUXER)   += mov.o mov_chan.o mov_esds.o 
replaygain.o
 OBJS-$(CONFIG_MOV_MUXER) += movenc.o av1.o avc.o hevc.o vpcc.o 
\
 movenchint.o mov_chan.o rtp.o \
diff --git a/libavformat/allformats.c b/libavformat/allformats.c
index 0aa9dd7198..28331facb9 100644
--- a/libavformat/allformats.c
+++ b/libavformat/allformats.c
@@ -249,6 +249,7 @@ extern AVInputFormat  ff_mlv_demuxer;
 extern AVInputFormat  ff_mm_demuxer;
 extern AVInputFormat  ff_mmf_demuxer;
 extern AVOutputFormat ff_mmf_muxer;
+extern AVInputFormat  ff_moflex_demuxer;
 extern AVInputFormat  ff_mov_demuxer;
 extern AVOutputFormat ff_mov_muxer;
 extern AVOutputFormat ff_mp2_muxer;
diff --git a/libavformat/moflex.c b/libavformat/moflex.c
new file mode 100644
index 00..b9696edd4e
--- /dev/null
+++ b/libavformat/moflex.c
@@ -0,0 +1,351 @@
+/*
+ * MOFLEX demuxer
+ * Copyright (c) 2020 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 "libavcodec/bytestream.h"
+
+#include "avformat.h"
+#include "internal.h"
+
+typedef struct BitReader {
+unsigned last;
+unsigned pos;
+} BitReader;
+
+typedef struct MOFLEXDemuxContext {
+unsigned size;
+int64_t pos;
+int64_t ts;
+int flags;
+int in_block;
+
+BitReader br;
+} MOFLEXDemuxContext;
+
+static int pop(BitReader *br, AVIOContext *pb)
+{
+if (avio_feof(pb))
+return AVERROR_EOF;
+
+if ((br->pos & 7) == 0)
+br->last = (unsigned)avio_r8(pb) << 24U;
+else
+br->last <<= 1;
+
+br->pos++;
+return !!(br->last & 0x8000);
+}
+
+static int pop_int(BitReader *br, AVIOContext *pb, int n)
+{
+int value = 0;
+
+for (int i = 0; i < n; i++) {
+int ret = pop(br, pb);
+
+if (ret < 0)
+return ret;
+value = 2 * value + ret;
+}
+
+return value;
+}
+
+static int pop_length(BitReader *br, AVIOContext *pb)
+{
+int ret, n = 1;
+
+while ((ret = pop(br, pb)) == 0)
+n++;
+
+if (ret < 0)
+return ret;
+return n;
+}
+
+static int read_var_byte(AVFormatContext *s, unsigned *out)
+{
+AVIOContext *pb = s->pb;
+unsigned value = 0, data;
+
+data = avio_r8(pb);
+if (!(data & 0x80)) {
+*out = data;
+return 0;
+}
+
+value = (data & 0x7F) << 7;
+data = avio_r8(pb);
+if (!(data & 0x80)) {
+value |= data;
+*out = value;
+return 0;
+}
+
+value = ((data & 0x7F) | value) << 7;
+data = avio_r8(pb);
+if (!(data & 0x80)) {
+value |= data;
+*out = value;
+return 0;
+}
+
+value = (((data & 0x7F) | value) << 7) | avio_r8(pb);
+*out = value;
+
+return 0;
+}
+
+static int moflex_probe(const AVProbeData *p)
+{
+GetByteContext gb;
+int score = 0;
+
+bytestream2_init(&gb, p->buf, p->buf_size);
+
+if (bytestream2_get_be16(&gb) != 0x4C32)
+return 0;
+score += 10;
+
+bytestream2_skip(&gb, 10);
+if (bytestream2_get_be16(&gb) == 0)
+return 0;
+score += 5;
+
+while (bytestream2_get_bytes_left(&gb) > 0) {
+int type = bytestream2_get_byte(&gb);
+int size = bytestream2_get_byte(&gb);
+
+if (type == 0) {
+score += 5 * (size == 0);
+break;
+}
+if ((type == 1 && size == 12) ||
+(type == 2 && size ==  6) ||
+(type == 3 && size == 13) ||
+(type == 4 && size ==  2))
+score += 20;
+bytestream2_skip(&gb, size)

[FFmpeg-devel] [PATCH] hwcontext_vaapi: Don't require a render node when deriving from DRM

2020-08-28 Thread Mark Thompson

The V4L2 driver does not actually have an associated DRM device at all, so
users work around the requirement by giving libva an unrelated display-only
device instead (which is fine, because it doesn't actually do anything with
that device).  This was broken by bc9b6358fb7315c0173de322472641766f6289da
forcing a render node, because the display-only device did not have an
associated render node to use.  Fix that by just passing through the
original non-render DRM fd if we can't find a render node.

Reported-by: Paul Kocialkowski 
---
Also tested by the reporter.  I'll apply this in a few days if there are no 
comments.

- Mark


 libavutil/hwcontext_vaapi.c | 28 
 1 file changed, 16 insertions(+), 12 deletions(-)

diff --git a/libavutil/hwcontext_vaapi.c b/libavutil/hwcontext_vaapi.c
index 38bdeb7820..2227d6ed69 100644
--- a/libavutil/hwcontext_vaapi.c
+++ b/libavutil/hwcontext_vaapi.c
@@ -1677,20 +1677,24 @@ static int vaapi_device_derive(AVHWDeviceContext *ctx,
 } else {
 render_node = drmGetRenderDeviceNameFromFd(src_hwctx->fd);
 if (!render_node) {
-av_log(ctx, AV_LOG_ERROR, "Failed to find a render node "
-   "matching the DRM device.\n");
-return AVERROR(ENODEV);
-}
-fd = open(render_node, O_RDWR);
-if (fd < 0) {
-av_log(ctx, AV_LOG_ERROR, "Failed to open render node %s"
-   "matching the DRM device.\n", render_node);
+av_log(ctx, AV_LOG_VERBOSE, "Using non-render node "
+   "because the device does not have an "
+   "associated render node.\n");
+fd = src_hwctx->fd;
+} else {
+fd = open(render_node, O_RDWR);
+if (fd < 0) {
+av_log(ctx, AV_LOG_VERBOSE, "Using non-render node "
+   "because the associated render node "
+   "could not be opened.\n");
+fd = src_hwctx->fd;
+} else {
+av_log(ctx, AV_LOG_VERBOSE, "Using render node %s "
+   "in place of non-render DRM device.\n",
+   render_node);
+}
 free(render_node);
-return AVERROR(errno);
 }
-av_log(ctx, AV_LOG_VERBOSE, "Using render node %s in place "
-   "of non-render DRM device.\n", render_node);
-free(render_node);
 }
 }
 #else
--
2.28.0
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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

[FFmpeg-devel] [PATCH v7 3/6] changelog: add entries for FLIF

2020-08-28 Thread Anamitra Ghorui
Signed-off-by: Anamitra Ghorui 
---
 Changelog | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/Changelog b/Changelog
index 7467e73306..b55f322963 100644
--- a/Changelog
+++ b/Changelog
@@ -15,6 +15,8 @@ version :
 - Argonaut Games ASF muxer
 - AV1 Low overhead bitstream format demuxer
 - RPZA video encoder
+- FLIF16 decoder
+- FLIF demuxer
 
 
 version 4.3:
-- 
2.28.0


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

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

[FFmpeg-devel] [PATCH v7 0/6] Add FLIF decoding and demuxing support

2020-08-28 Thread Anamitra Ghorui
v2: Fix faulty patch
v3: Fix addressed errors, Add interlaced decoding support
v4: Fix Further cosmetics, C.Bucket Transform reading errors, Atomise patch
v5: Fix faulty patch
v6: Address pointed out errors, use av_freep everywhere, further cosmetics,
redundancies.
v7: Atttempt to fix all style errors, make only atomised rangecoder functions
inline.

Test files are available here: https://0x0.st/iYs_.zip

Co-authored-by: Anamitra Ghorui 
Co-authored-by: Kartik K Khullar 

Anamitra Ghorui (6):
  avcodec: add FLIF decoding support
  avformat: add FLIF demuxing support
  changelog: add entries for FLIF
  doc/general: add entry for FLIF
  doc/decoders: add entry for FLIF
  doc/demuxers: add entry for FLIF

 Changelog  |2 +
 configure  |1 +
 doc/decoders.texi  |8 +
 doc/demuxers.texi  |9 +
 doc/general.texi   |2 +
 libavcodec/Makefile|3 +
 libavcodec/allcodecs.c |1 +
 libavcodec/codec_desc.c|7 +
 libavcodec/codec_id.h  |1 +
 libavcodec/flif16.c|  204 +++
 libavcodec/flif16.h|  285 
 libavcodec/flif16_parser.c |  193 +++
 libavcodec/flif16_rangecoder.c |  770 +
 libavcodec/flif16_rangecoder.h |  422 +
 libavcodec/flif16_transform.c  | 2886 
 libavcodec/flif16_transform.h  |  124 ++
 libavcodec/flif16dec.c | 1762 +++
 libavcodec/parsers.c   |1 +
 libavcodec/version.h   |2 +-
 libavformat/Makefile   |1 +
 libavformat/allformats.c   |1 +
 libavformat/flifdec.c  |  445 +
 libavformat/version.h  |4 +-
 23 files changed, 7131 insertions(+), 3 deletions(-)
 create mode 100644 libavcodec/flif16.c
 create mode 100644 libavcodec/flif16.h
 create mode 100644 libavcodec/flif16_parser.c
 create mode 100644 libavcodec/flif16_rangecoder.c
 create mode 100644 libavcodec/flif16_rangecoder.h
 create mode 100644 libavcodec/flif16_transform.c
 create mode 100644 libavcodec/flif16_transform.h
 create mode 100644 libavcodec/flif16dec.c
 create mode 100644 libavformat/flifdec.c

-- 
2.28.0


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

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

[FFmpeg-devel] [PATCH v7 5/6] doc/decoders: add entry for FLIF

2020-08-28 Thread Anamitra Ghorui
Signed-off-by: Anamitra Ghorui 
---
 doc/decoders.texi | 8 
 1 file changed, 8 insertions(+)

diff --git a/doc/decoders.texi b/doc/decoders.texi
index 9005714e3c..77e93ab80a 100644
--- a/doc/decoders.texi
+++ b/doc/decoders.texi
@@ -86,6 +86,14 @@ AVS2-P2/IEEE1857.4 video decoder wrapper.
 
 This decoder allows libavcodec to decode AVS2 streams with davs2 library.
 
+@section flif16
+
+FLIF16 non-animated/animated image decoder.
+
+This decoder allows libavcodec to decode non-animated and animated FLIF images
+as per the FLIF16 Specification. Interlaced images are always decoded to the
+highest quality (zoom) level.
+
 @c man end VIDEO DECODERS
 
 @chapter Audio Decoders
-- 
2.28.0


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

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

[FFmpeg-devel] [PATCH v7 4/6] doc/general: add entry for FLIF

2020-08-28 Thread Anamitra Ghorui
Signed-off-by: Anamitra Ghorui 
---
 doc/general.texi | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/doc/general.texi b/doc/general.texi
index d618565347..e9ae535c34 100644
--- a/doc/general.texi
+++ b/doc/general.texi
@@ -904,6 +904,8 @@ following image formats are supported:
 @item Flash Screen Video v2  @tab  X  @tab  X
 @item Flash Video (FLV)  @tab  X  @tab  X
 @tab Sorenson H.263 used in Flash
+@item FLIF (Free Lossless Image Format @tab @tab  X
+@tab Precursor to JPEG XL and FUIF
 @item FM Screen Capture Codec  @tab @tab  X
 @item Forward Uncompressed   @tab @tab  X
 @item Fraps  @tab @tab  X
-- 
2.28.0


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

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

[FFmpeg-devel] [PATCH v7 2/6] avformat: add FLIF demuxing support

2020-08-28 Thread Anamitra Ghorui
Signed-off-by: Anamitra Ghorui 
---
 configure|   1 +
 libavformat/Makefile |   1 +
 libavformat/allformats.c |   1 +
 libavformat/flifdec.c| 445 +++
 libavformat/version.h|   4 +-
 5 files changed, 450 insertions(+), 2 deletions(-)
 create mode 100644 libavformat/flifdec.c

diff --git a/configure b/configure
index 564072053b..b99f8ed935 100755
--- a/configure
+++ b/configure
@@ -3307,6 +3307,7 @@ fifo_muxer_deps="threads"
 flac_demuxer_select="flac_parser"
 flv_muxer_select="aac_adtstoasc_bsf"
 gxf_muxer_select="pcm_rechunk_bsf"
+flif_demuxer_select="zlib exif"
 hds_muxer_select="flv_muxer"
 hls_muxer_select="mpegts_muxer"
 hls_muxer_suggest="gcrypt openssl"
diff --git a/libavformat/Makefile b/libavformat/Makefile
index cbb33fe37c..a105122526 100644
--- a/libavformat/Makefile
+++ b/libavformat/Makefile
@@ -192,6 +192,7 @@ OBJS-$(CONFIG_FLAC_DEMUXER)  += flacdec.o 
rawdec.o \
 OBJS-$(CONFIG_FLAC_MUXER)+= flacenc.o flacenc_header.o \
 vorbiscomment.o
 OBJS-$(CONFIG_FLIC_DEMUXER)  += flic.o
+OBJS-$(CONFIG_FLIF_DEMUXER)  += flifdec.o
 OBJS-$(CONFIG_FLV_DEMUXER)   += flvdec.o
 OBJS-$(CONFIG_LIVE_FLV_DEMUXER)  += flvdec.o
 OBJS-$(CONFIG_FLV_MUXER) += flvenc.o avc.o
diff --git a/libavformat/allformats.c b/libavformat/allformats.c
index 0aa9dd7198..d003889b6f 100644
--- a/libavformat/allformats.c
+++ b/libavformat/allformats.c
@@ -150,6 +150,7 @@ extern AVOutputFormat ff_fits_muxer;
 extern AVInputFormat  ff_flac_demuxer;
 extern AVOutputFormat ff_flac_muxer;
 extern AVInputFormat  ff_flic_demuxer;
+extern AVInputFormat  ff_flif_demuxer;
 extern AVInputFormat  ff_flv_demuxer;
 extern AVOutputFormat ff_flv_muxer;
 extern AVInputFormat  ff_live_flv_demuxer;
diff --git a/libavformat/flifdec.c b/libavformat/flifdec.c
new file mode 100644
index 00..a7272075fd
--- /dev/null
+++ b/libavformat/flifdec.c
@@ -0,0 +1,445 @@
+/*
+ * FLIF demuxer
+ * Copyright (c) 2020 Anamitra Ghorui 
+ *
+ * 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
+ */
+
+/**
+ * @file
+ * FLIF demuxer.
+ */
+
+#include "avformat.h"
+#include "libavutil/common.h"
+#include "libavutil/bprint.h"
+#include "libavutil/intreadwrite.h"
+#include "libavutil/opt.h"
+#include "internal.h"
+#include "libavcodec/exif.h"
+
+#include "libavcodec/flif16.h"
+#include "libavcodec/flif16_rangecoder.h"
+
+#include "config.h"
+
+#if CONFIG_ZLIB
+#   include 
+#endif
+
+/*
+ * FLIF's reference encoder currently encodes metadata as a raw DEFLATE stream
+ * (RFC 1951). In order to decode a raw deflate stream using Zlib, inflateInit2
+ * must be used with windowBits being between -8 .. -15.
+ */
+#define ZLIB_WINDOW_BITS -15
+#define BUF_SIZE 4096
+
+typedef struct FLIFDemuxContext {
+#if CONFIG_ZLIB
+z_stream stream;
+uint8_t active;
+#endif
+} FLIFDemuxContext;
+
+
+#if CONFIG_ZLIB
+static int flif_inflate(FLIFDemuxContext *s, uint8_t *buf, int buf_size,
+uint8_t **out_buf, int *out_buf_size)
+{
+int ret;
+z_stream *stream = &s->stream;
+
+if (!s->active) {
+s->active = 1;
+stream->zalloc   = Z_NULL;
+stream->zfree= Z_NULL;
+stream->opaque   = Z_NULL;
+stream->avail_in = 0;
+stream->next_in  = Z_NULL;
+ret = inflateInit2(stream, ZLIB_WINDOW_BITS);
+
+if (ret != Z_OK)
+return ret;
+
+*out_buf_size = buf_size;
+*out_buf = av_realloc_f(*out_buf, *out_buf_size, 1);
+if (!*out_buf)
+return AVERROR(ENOMEM);
+}
+
+stream->next_in  = buf;
+stream->avail_in = buf_size;
+
+do {
+while (stream->total_out >= (*out_buf_size - 1)) {
+*out_buf = av_realloc_f(*out_buf, (*out_buf_size) * 2, 1);
+if (!*out_buf)
+return AVERROR(ENOMEM);
+*out_buf_size *= 2;
+}
+
+stream->next_out  = *out_buf + stream->total_out;
+stream->avail_out = *out_buf_size - stream->total_out - 1;
+ 
+ret = inflate(stream, Z_PARTIAL_FLUSH);
+
+switch (ret) {
+case Z_NEED_DICT:
+case Z_DATA_ERROR:
+(void)infl

[FFmpeg-devel] [PATCH v7 6/6] doc/demuxers: add entry for FLIF

2020-08-28 Thread Anamitra Ghorui
Signed-off-by: Anamitra Ghorui 
---
 doc/demuxers.texi | 9 +
 1 file changed, 9 insertions(+)

diff --git a/doc/demuxers.texi b/doc/demuxers.texi
index 3c15ab9eee..69b2ce5025 100644
--- a/doc/demuxers.texi
+++ b/doc/demuxers.texi
@@ -243,6 +243,15 @@ which streams to actually receive.
 Each stream mirrors the @code{id} and @code{bandwidth} properties from the
 @code{} as metadata keys named "id" and "variant_bitrate" 
respectively.
 
+@section flif
+
+FLIF non-animated/animated image demuxer.
+
+This decoder allows libavformat to demux non-animated and animated FLIF images
+as per the current FLIF16 Specification.
+The entirety of the file is attempted to be read at once. No timestamps are set
+for the format due to its nature.
+
 @section flv, live_flv
 
 Adobe Flash Video Format demuxer.
-- 
2.28.0


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

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

Re: [FFmpeg-devel] [PATCH v7 0/6] Add FLIF decoding and demuxing support

2020-08-28 Thread Anamitra Ghorui
On Sat, 29 Aug 2020 00:15:25 +0530
Anamitra Ghorui  wrote:

> v2: Fix faulty patch
> v3: Fix addressed errors, Add interlaced decoding support
> v4: Fix Further cosmetics, C.Bucket Transform reading errors, Atomise patch
> v5: Fix faulty patch
> v6: Address pointed out errors, use av_freep everywhere, further cosmetics,
> redundancies.
> v7: Atttempt to fix all style errors, make only atomised rangecoder functions
> inline.
> 
> Test files are available here: https://0x0.st/iYs_.zip
> 
> Co-authored-by: Anamitra Ghorui 
> Co-authored-by: Kartik K Khullar 
> 
> Anamitra Ghorui (6):
>   avcodec: add FLIF decoding support
>   avformat: add FLIF demuxing support
>   changelog: add entries for FLIF
>   doc/general: add entry for FLIF
>   doc/decoders: add entry for FLIF
>   doc/demuxers: add entry for FLIF
> 
>  Changelog  |2 +
>  configure  |1 +
>  doc/decoders.texi  |8 +
>  doc/demuxers.texi  |9 +
>  doc/general.texi   |2 +
>  libavcodec/Makefile|3 +
>  libavcodec/allcodecs.c |1 +
>  libavcodec/codec_desc.c|7 +
>  libavcodec/codec_id.h  |1 +
>  libavcodec/flif16.c|  204 +++
>  libavcodec/flif16.h|  285 
>  libavcodec/flif16_parser.c |  193 +++
>  libavcodec/flif16_rangecoder.c |  770 +
>  libavcodec/flif16_rangecoder.h |  422 +
>  libavcodec/flif16_transform.c  | 2886 
>  libavcodec/flif16_transform.h  |  124 ++
>  libavcodec/flif16dec.c | 1762 +++
>  libavcodec/parsers.c   |1 +
>  libavcodec/version.h   |2 +-
>  libavformat/Makefile   |1 +
>  libavformat/allformats.c   |1 +
>  libavformat/flifdec.c  |  445 +
>  libavformat/version.h  |4 +-
>  23 files changed, 7131 insertions(+), 3 deletions(-)
>  create mode 100644 libavcodec/flif16.c
>  create mode 100644 libavcodec/flif16.h
>  create mode 100644 libavcodec/flif16_parser.c
>  create mode 100644 libavcodec/flif16_rangecoder.c
>  create mode 100644 libavcodec/flif16_rangecoder.h
>  create mode 100644 libavcodec/flif16_transform.c
>  create mode 100644 libavcodec/flif16_transform.h
>  create mode 100644 libavcodec/flif16dec.c
>  create mode 100644 libavformat/flifdec.c
> 

Oh, should I have added the documentation/changelog entries in the
respective decoder and demuxer commits?

-- 
Regards,
Anamitra

fingerprint: F8F044F6031D64AB3C8311E7479149645D0EC5D2


pgppIsHPVhYKb.pgp
Description: OpenPGP digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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

[FFmpeg-devel] [PATCH] doc/decoders: Clear up description of ac3's drc_scale option

2020-08-28 Thread Aman Verma
Make clear that the value to -drc_scale is an exponentiating value, not
a scaling factor. Also, document the default value.

Signed-off-by: Aman Verma 
---
 doc/decoders.texi | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/doc/decoders.texi b/doc/decoders.texi
index 9005714..4a307b4 100644
--- a/doc/decoders.texi
+++ b/doc/decoders.texi
@@ -106,8 +106,8 @@ the undocumented RealAudio 3 (a.k.a. dnet).
 @table @option
 
 @item -drc_scale @var{value}
-Dynamic Range Scale Factor. The factor to apply to dynamic range values
-from the AC-3 stream. This factor is applied exponentially.
+Dynamic Range Compression scale. The number to apply---exponentially---to
+dynamic range values from the AC-3 stream. The default value is 1.
 There are 3 notable scale factor ranges:
 @table @option
 @item drc_scale == 0
-- 
2.28.0

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

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

[FFmpeg-devel] [PATCH] x86/cfhddsp: zero extend int arguments

2020-08-28 Thread James Almer
if taken from stack, they may have garbage in the upper bits otherwise.
Also, there are only 8 arguments, so don't attempt to load 11.

Fixes SIGSEV crashes in some targets.

Signed-off-by: James Almer 
---
 libavcodec/x86/cfhddsp.asm | 16 ++--
 1 file changed, 6 insertions(+), 10 deletions(-)

diff --git a/libavcodec/x86/cfhddsp.asm b/libavcodec/x86/cfhddsp.asm
index 51848677eb..87c2df634a 100644
--- a/libavcodec/x86/cfhddsp.asm
+++ b/libavcodec/x86/cfhddsp.asm
@@ -37,29 +37,26 @@ SECTION .text
 
 %macro CFHD_HORIZ_FILTER 1
 %if %1 == 1023
-cglobal cfhd_horiz_filter_clip10, 5, 6, 8 + 4 * ARCH_X86_64, output, low, 
high, width, bpc
-DEFINE_ARGSoutput, low, high, width, x, temp
+cglobal cfhd_horiz_filter_clip10, 5, 6, 8 + 4 * ARCH_X86_64, output, low, 
high, width, x, temp
 shlwidthd, 1
 %define ostrideq widthq
 %define lwidthq  widthq
 %define hwidthq  widthq
 %elif %1 == 4095
-cglobal cfhd_horiz_filter_clip12, 5, 6, 8 + 4 * ARCH_X86_64, output, low, 
high, width, bpc
-DEFINE_ARGSoutput, low, high, width, x, temp
+cglobal cfhd_horiz_filter_clip12, 5, 6, 8 + 4 * ARCH_X86_64, output, low, 
high, width, x, temp
 shlwidthd, 1
 %define ostrideq widthq
 %define lwidthq  widthq
 %define hwidthq  widthq
 %else
 %if ARCH_X86_64
-cglobal cfhd_horiz_filter, 11, 11, 12, output, ostride, low, lwidth, high, 
hwidth, width, height
-DEFINE_ARGSoutput, ostride, low, lwidth, high, hwidth, width, height, x, 
y, temp
+cglobal cfhd_horiz_filter, 8, 11, 12, output, ostride, low, lwidth, high, 
hwidth, width, height, x, y, temp
 shl  ostrided, 1
 shl   lwidthd, 1
 shl   hwidthd, 1
 shlwidthd, 1
 
-movyq, heightq
+movyd, heightd
 negyq
 %else
 cglobal cfhd_horiz_filter, 7, 7, 8, output, x, low, y, high, temp, width, 
height
@@ -307,14 +304,13 @@ CFHD_HORIZ_FILTER 4095
 
 INIT_XMM sse2
 %if ARCH_X86_64
-cglobal cfhd_vert_filter, 11, 11, 14, output, ostride, low, lwidth, high, 
hwidth, width, height
-DEFINE_ARGSoutput, ostride, low, lwidth, high, hwidth, width, height, x, 
y, pos
+cglobal cfhd_vert_filter, 8, 11, 14, output, ostride, low, lwidth, high, 
hwidth, width, height, x, y, pos
 shlostrided, 1
 shl lwidthd, 1
 shl hwidthd, 1
 shl  widthd, 1
 
-dec   heightq
+dec   heightd
 
 mova   m8, [factor_p1_n1]
 mova   m9, [factor_n1_p1]
-- 
2.27.0

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

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

Re: [FFmpeg-devel] [PATCH 4/4] avformat: add moflex demuxer

2020-08-28 Thread Andreas Rheinhardt
Paul B Mahol:
> Signed-off-by: Paul B Mahol 
> ---
>  libavformat/Makefile |   1 +
>  libavformat/allformats.c |   1 +
>  libavformat/moflex.c | 351 +++
>  3 files changed, 353 insertions(+)
>  create mode 100644 libavformat/moflex.c
> 
> diff --git a/libavformat/Makefile b/libavformat/Makefile
> index cbb33fe37c..1e0ac317e5 100644
> --- a/libavformat/Makefile
> +++ b/libavformat/Makefile
> @@ -319,6 +319,7 @@ OBJS-$(CONFIG_MLV_DEMUXER)   += mlvdec.o 
> riffdec.o
>  OBJS-$(CONFIG_MM_DEMUXER)+= mm.o
>  OBJS-$(CONFIG_MMF_DEMUXER)   += mmf.o
>  OBJS-$(CONFIG_MMF_MUXER) += mmf.o rawenc.o
> +OBJS-$(CONFIG_MOFLEX_DEMUXER)+= moflex.o
>  OBJS-$(CONFIG_MOV_DEMUXER)   += mov.o mov_chan.o mov_esds.o 
> replaygain.o
>  OBJS-$(CONFIG_MOV_MUXER) += movenc.o av1.o avc.o hevc.o 
> vpcc.o \
>  movenchint.o mov_chan.o rtp.o \
> diff --git a/libavformat/allformats.c b/libavformat/allformats.c
> index 0aa9dd7198..28331facb9 100644
> --- a/libavformat/allformats.c
> +++ b/libavformat/allformats.c
> @@ -249,6 +249,7 @@ extern AVInputFormat  ff_mlv_demuxer;
>  extern AVInputFormat  ff_mm_demuxer;
>  extern AVInputFormat  ff_mmf_demuxer;
>  extern AVOutputFormat ff_mmf_muxer;
> +extern AVInputFormat  ff_moflex_demuxer;
>  extern AVInputFormat  ff_mov_demuxer;
>  extern AVOutputFormat ff_mov_muxer;
>  extern AVOutputFormat ff_mp2_muxer;
> diff --git a/libavformat/moflex.c b/libavformat/moflex.c
> new file mode 100644
> index 00..b9696edd4e
> --- /dev/null
> +++ b/libavformat/moflex.c
> @@ -0,0 +1,351 @@
> +/*
> + * MOFLEX demuxer
> + * Copyright (c) 2020 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 "libavcodec/bytestream.h"
> +
> +#include "avformat.h"
> +#include "internal.h"
> +
> +typedef struct BitReader {
> +unsigned last;
> +unsigned pos;
> +} BitReader;
> +
> +typedef struct MOFLEXDemuxContext {
> +unsigned size;
> +int64_t pos;
> +int64_t ts;
> +int flags;
> +int in_block;
> +
> +BitReader br;
> +} MOFLEXDemuxContext;
> +
> +static int pop(BitReader *br, AVIOContext *pb)
> +{
> +if (avio_feof(pb))
> +return AVERROR_EOF;
> +
> +if ((br->pos & 7) == 0)
> +br->last = (unsigned)avio_r8(pb) << 24U;
> +else
> +br->last <<= 1;
> +
> +br->pos++;
> +return !!(br->last & 0x8000);
> +}
> +
> +static int pop_int(BitReader *br, AVIOContext *pb, int n)
> +{
> +int value = 0;
> +
> +for (int i = 0; i < n; i++) {
> +int ret = pop(br, pb);
> +
> +if (ret < 0)
> +return ret;
> +value = 2 * value + ret;
> +}
> +
> +return value;
> +}
> +
> +static int pop_length(BitReader *br, AVIOContext *pb)
> +{
> +int ret, n = 1;
> +
> +while ((ret = pop(br, pb)) == 0)
> +n++;
> +
> +if (ret < 0)
> +return ret;
> +return n;
> +}
> +
> +static int read_var_byte(AVFormatContext *s, unsigned *out)
> +{
> +AVIOContext *pb = s->pb;
> +unsigned value = 0, data;
> +
> +data = avio_r8(pb);
> +if (!(data & 0x80)) {
> +*out = data;
> +return 0;
> +}
> +
> +value = (data & 0x7F) << 7;
> +data = avio_r8(pb);
> +if (!(data & 0x80)) {
> +value |= data;
> +*out = value;
> +return 0;
> +}
> +
> +value = ((data & 0x7F) | value) << 7;
> +data = avio_r8(pb);
> +if (!(data & 0x80)) {
> +value |= data;
> +*out = value;
> +return 0;
> +}
> +
> +value = (((data & 0x7F) | value) << 7) | avio_r8(pb);
> +*out = value;
> +
> +return 0;
> +}
> +
> +static int moflex_probe(const AVProbeData *p)
> +{
> +GetByteContext gb;
> +int score = 0;
> +
> +bytestream2_init(&gb, p->buf, p->buf_size);
> +
> +if (bytestream2_get_be16(&gb) != 0x4C32)
> +return 0;
> +score += 10;
> +
> +bytestream2_skip(&gb, 10);
> +if (bytestream2_get_be16(&gb) == 0)
> +return 0;
> +score += 5;
> +
> +while (bytestream2_get_bytes_left(&gb) > 0) {
> +int type = bytestream2_get_byte(&gb);
> + 

Re: [FFmpeg-devel] [PATCH] doc/decoders: Clear up description of ac3's drc_scale option

2020-08-28 Thread Jim DeLaHunt

On 2020-08-28 15:39, Aman Verma wrote:

Make clear that the value to -drc_scale is an exponentiating value, not
a scaling factor. Also, document the default value.

Signed-off-by: Aman Verma 
---
  doc/decoders.texi | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/doc/decoders.texi b/doc/decoders.texi
index 9005714..4a307b4 100644
--- a/doc/decoders.texi
+++ b/doc/decoders.texi
@@ -106,8 +106,8 @@ the undocumented RealAudio 3 (a.k.a. dnet).
  @table @option
  
  @item -drc_scale @var{value}

-Dynamic Range Scale Factor. The factor to apply to dynamic range values
-from the AC-3 stream. This factor is applied exponentially.
+Dynamic Range Compression scale. The number to apply---exponentially---to
+dynamic range values from the AC-3 stream. The default value is 1.
  There are 3 notable scale factor ranges:
  @table @option
  @item drc_scale == 0


Aman, thank you for working on this patch.

I don't know anything about the AC-3 format or the ac3 decoder in 
FFmpeg. However, I can read technical writing. I don't understand what 
you are trying to say differently with this change. But even more, I 
don't understand what the existing documentation is trying to say.


I like that you are adding the information that the default value of 
-drc_scale is 1. That is not presently documented. Good.


It looks like the other changes are to change "factor" to "number", and  
to convert a sentence "This factor is applied exponentially." to a 
dashed phrase "---exponentially---". I don't feel strongly that this 
makes things worth, but I also don't see how this makes things clearer.


However, both the old and the new text leave me with a lot of questions. 
No doubt some of my questions are due to my ignorance of the AC-3 format 
and of the ac3 decoder code in FFmpeg. But some are due to the text 
leaving a lot of information unstated.


What does it mean to "apply — exponentially — to" a number? What 
mathematical operation is that? This is not at all clear to me.


Does the term "dynamic range values from the AC-3 stream" refer to the 
`dynrng` and `dynrng2` values as defined in section 7.7.1 "Dynamic Range 
Control" of A/52:2012, "Digital Audio Compression (AC-3, E-AC-3)"[1]? 
Then using the names of the values as defined in the specification will 
be more precise.


The `dynrng` and `dynrng2` values each hold a 3-bit value and a 5-bit 
value. The AC-3 specification says that the decoder interprets the 3-bit 
value as gain changes from -18.06 dB to +24.08 dB, and the 5-bit value 
as linear gain changes from –0.14 dB to –6.02 dB. (Section 7.7.1.2 pp 
88-89.)


Does the ac3 decoder do a computation on the `dynrng` and `dynrng2` 
values? Does it do a computation on the gain change value derived from 
the `dynrng` and `dynrng2` values? What is this computation? Or, does it 
use the -drc_scale value in place of the `dynrng` and `dynrng2` values 
in the audio stream?


The further description of the -drc_scale value describes three 
behaviours, based on the -drc_scale value. It says, "drc_scale == 0. DRC 
disabled. Produces full range audio." Does this mean that the ac3 
decoder uses the `dynrng` and `dynrng2` values unchanged, or that it 
decodes as if those values were zero?


And, what does DRC refer to in this sentence? Does it mean the 
adjustment made by the ac3 decoder based on the -drc_scale value? Or 
does it mean Dynamic Range Compression as described in section 7.7 of 
the A/52:2012 specification?


The description continues, "0 < drc_scale <= 1. DRC enabled. Applies a 
fraction of the stream DRC value. Audio reproduction is between full 
range and full compression." What decoder behaviour does "DRC enabled" 
mean?  What does  "Applies a fraction of the stream DRC value" mean? 
What does the applying? What does it apply to?  Does it mean the ac3 
decoder does an arithmetic operation between the -drc_scale value passed 
to the decoder, and the `dynrng` and `dynrng2` values from the ac3 
stream?  What is this operation?  And what does "Audio reproduction is 
between full range and full compression." mean? Does it indicate a 
different modification which the decoder makes to the decoded audio 
signal? Or is it explaining the effect on the decoded audio signal of 
how the decoder interprets the result of the arithmetic operation?


The description continues, "drc_scale > 1. DRC enabled. Applies 
drc_scale asymmetrically. Loud sounds are fully compressed. Soft sounds 
are enhanced."  What does "Applies drc_scale asymmetrically." mean? What 
is the arithmetic operation?  What values, what range does the decoder 
treat "asymmetrically"? What is the shape of this asymmetry? What does 
"fully compressed" mean — made silent? Reduced to median loudness? 
Something else?  What does "Soft sounds are enhanced." mean?  Made 
louder?  How much louder?


[1] https://www.atsc.org/wp-content/uploads/2015/03/A52-201212-17.pdf

So, I'm not in a position to approve or reject this patch.  And fixing 
deficiencie

[FFmpeg-devel] [PATCH 1/2] avcodec/hevcdec: fix stat_coeff save/load for persistent_rice_adaptation_enabled_flag

2020-08-28 Thread Xu Guangxin
It's required by 9.3.1. following clips have this feature:

WPP_HIGH_TP_444_8BIT_RExt_Apple_2.bit
Bitdepth_A_RExt_Sony_1.bin
Bitdepth_B_RExt_Sony_1.bin
EXTPREC_HIGHTHROUGHPUT_444_16_INTRA_10BIT_RExt_Sony_1.bit
EXTPREC_HIGHTHROUGHPUT_444_16_INTRA_12BIT_RExt_Sony_1.bit
EXTPREC_HIGHTHROUGHPUT_444_16_INTRA_8BIT_RExt_Sony_1.bit
EXTPREC_MAIN_444_16_INTRA_10BIT_RExt_Sony_1.bit
EXTPREC_MAIN_444_16_INTRA_12BIT_RExt_Sony_1.bit
EXTPREC_MAIN_444_16_INTRA_8BIT_RExt_Sony_1.bit
WPP_AND_TILE_10Bit422Test_HIGH_TP_444_10BIT_RExt_Apple_2.bit
WPP_AND_TILE_AND_CABAC_BYPASS_ALIGN_0_HIGH_TP_444_14BIT_RExt_Apple_2.bit
WPP_AND_TILE_AND_CABAC_BYPASS_ALIGN_1_HIGH_TP_444_14BIT_RExt_Apple_2.bit
WPP_AND_TILE_HIGH_TP_444_8BIT_RExt_Apple_2.bit

you can download them from:
https://www.itu.int/wftp3/av-arch/jctvc-site/bitstream_exchange/draft_conformance/RExt/

Signed-off-by: Xu Guangxin 
---
 libavcodec/hevc_cabac.c | 6 ++
 libavcodec/hevcdec.h| 4 +++-
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/libavcodec/hevc_cabac.c b/libavcodec/hevc_cabac.c
index 3dc0987dad..635b4edef3 100644
--- a/libavcodec/hevc_cabac.c
+++ b/libavcodec/hevc_cabac.c
@@ -454,12 +454,18 @@ void ff_hevc_save_states(HEVCContext *s, int ctb_addr_ts)
  (s->ps.sps->ctb_width == 2 &&
   ctb_addr_ts % s->ps.sps->ctb_width == 0))) {
 memcpy(s->cabac_state, s->HEVClc->cabac_state, HEVC_CONTEXTS);
+if (s->ps.sps->persistent_rice_adaptation_enabled_flag) {
+memcpy(s->stat_coeff, s->HEVClc->stat_coeff, HEVC_STAT_COEFFS);
+}
 }
 }
 
 static void load_states(HEVCContext *s)
 {
 memcpy(s->HEVClc->cabac_state, s->cabac_state, HEVC_CONTEXTS);
+if (s->ps.sps->persistent_rice_adaptation_enabled_flag) {
+memcpy(s->HEVClc->stat_coeff, s->stat_coeff, HEVC_STAT_COEFFS);
+}
 }
 
 static int cabac_reinit(HEVCLocalContext *lc)
diff --git a/libavcodec/hevcdec.h b/libavcodec/hevcdec.h
index 39c5c7f89f..d41aed4556 100644
--- a/libavcodec/hevcdec.h
+++ b/libavcodec/hevcdec.h
@@ -53,6 +53,7 @@
 #define DEFAULT_INTRA_TC_OFFSET 2
 
 #define HEVC_CONTEXTS 199
+#define HEVC_STAT_COEFFS 4
 
 #define MRG_MAX_NUM_CANDS 5
 
@@ -424,7 +425,7 @@ typedef struct HEVCFrame {
 typedef struct HEVCLocalContext {
 uint8_t cabac_state[HEVC_CONTEXTS];
 
-uint8_t stat_coeff[4];
+uint8_t stat_coeff[HEVC_STAT_COEFFS];
 
 uint8_t first_qp_group;
 
@@ -480,6 +481,7 @@ typedef struct HEVCContext {
 int height;
 
 uint8_t *cabac_state;
+uint8_t stat_coeff[HEVC_STAT_COEFFS];
 
 /** 1 if the independent slice segment header was successfully parsed */
 uint8_t slice_initialized;
-- 
2.17.1

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

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

[FFmpeg-devel] [PATCH 2/2] fate/hevc-conformance: add clip for persistent_rice_adaptation_enabled_flag

2020-08-28 Thread Xu Guangxin
you can download it from:
https://www.itu.int/wftp3/av-arch/jctvc-site/bitstream_exchange/draft_conformance/RExt/WPP_HIGH_TP_444_8BIT_RExt_Apple_2.bit

Signed-off-by: Xu Guangxin 
---
 tests/fate/hevc.mak   | 1 +
 .../hevc-conformance-WPP_HIGH_TP_444_8BIT_RExt_Apple_2| 8 
 2 files changed, 9 insertions(+)
 create mode 100644 
tests/ref/fate/hevc-conformance-WPP_HIGH_TP_444_8BIT_RExt_Apple_2

diff --git a/tests/fate/hevc.mak b/tests/fate/hevc.mak
index 65c5a262e9..f81a065e80 100644
--- a/tests/fate/hevc.mak
+++ b/tests/fate/hevc.mak
@@ -141,6 +141,7 @@ HEVC_SAMPLES =  \
 WPP_D_ericsson_MAIN_2   \
 WPP_E_ericsson_MAIN_2   \
 WPP_F_ericsson_MAIN_2   \
+WPP_HIGH_TP_444_8BIT_RExt_Apple_2 \
 
 HEVC_SAMPLES_10BIT =\
 DBLK_A_MAIN10_VIXS_3\
diff --git a/tests/ref/fate/hevc-conformance-WPP_HIGH_TP_444_8BIT_RExt_Apple_2 
b/tests/ref/fate/hevc-conformance-WPP_HIGH_TP_444_8BIT_RExt_Apple_2
new file mode 100644
index 00..fcb1d2894a
--- /dev/null
+++ b/tests/ref/fate/hevc-conformance-WPP_HIGH_TP_444_8BIT_RExt_Apple_2
@@ -0,0 +1,8 @@
+#tb 0: 1/25
+#media_type 0: video
+#codec_id 0: rawvideo
+#dimensions 0: 1024x768
+#sar 0: 0/1
+0,  0,  0,1,  1179648, 0x78e55a69
+0,  1,  1,1,  1179648, 0x5babb3cb
+0,  2,  2,1,  1179648, 0x65935648
-- 
2.17.1

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

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

Re: [FFmpeg-devel] [PATCH] avcodec/cfhd: Check transform type

2020-08-28 Thread Reto Kromer
Paul B Mahol wrote:

>On 8/28/20, Michael Niedermayer  wrote:

Is there some specification for this ?
i was looking yesterday but google failed to point me to one

>>>
>>> No specifications, just SDK on github.
>>>
>>> Also I'm unsure if that is sufficient fix for the underline
>>>issue.
>>
>>I suspect the decoder has more issues. I was hoping that there
>>is a specification that i could base validity and tag ordering
>>checks on.
>
>Look at encoder, it follows tag order, note that some tags are
>purely optional.

Behind their paywall there are:

  - SMPTE ST 2073-1:2014
  - SMPTE RP 2073-2:2014

which do not include all the relevant information.

The official SDK code by GoPro on GitHub is hard to read, at
least for me. Emeric Grange did a cleanup and published an
alternate code on his own repo.

Best regards, Reto

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

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