Re: [FFmpeg-devel] [PATCH 3/5] [mov] Check if DTS is AV_NOPTS_VALUE in mov_find_next_sample().

2020-06-11 Thread Dale Curtis
Bump again. Thanks.

- dale

On Fri, Jun 5, 2020 at 11:48 AM Dale Curtis  wrote:

> Bump for this one again. Thanks in advance.
>
> - dale
>
> On Thu, May 28, 2020 at 12:37 PM Dale Curtis 
> wrote:
>
>>   Bump now that the saturated math operations have landed. Thanks!
>>
>> - dale
>>
>> On Thu, May 14, 2020 at 3:31 PM Dale Curtis 
>> wrote:
>>
>>>
>>> Signed-off-by: Dale Curtis 
>>> ---
>>>  libavformat/mov.c | 2 +-
>>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>
___
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/5] fftools/ffmpeg: flush and recreate encoder instance if resolution changes

2020-06-11 Thread Fu, Linjie
> From: ffmpeg-devel  On Behalf Of
> Nicolas George
> Sent: Friday, June 12, 2020 01:52
> To: FFmpeg development discussions and patches  de...@ffmpeg.org>
> Subject: Re: [FFmpeg-devel] [PATCH 4/5] fftools/ffmpeg: flush and recreate
> encoder instance if resolution changes
> 
> Fu, Linjie (12020-06-11):
> > If rawvideo here means .h264, attached the output file produced by libx264:
> 
> Now, rawvideo means rawvideo.
> 
For Raw YUV video, it is not able to notify player/user about the resolution 
changing
since it only contains data information.

The usage for raw video is discussed previously. For now we'd like to use 
rawvideo encoder
To do some bit-exact compare to make sure the result of decoder is good without 
scaling. 
(matches the output of other media decoder component like gstreamer)

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

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

Re: [FFmpeg-devel] [PATCH v2 4/5] fftools/ffmpeg: flush and recreate encoder instance if resolution changes

2020-06-11 Thread Fu, Linjie
> From: Nicolas George 
> Sent: Friday, June 12, 2020 00:49
> To: FFmpeg development discussions and patches  de...@ffmpeg.org>
> Cc: Fu, Linjie 
> Subject: Re: [FFmpeg-devel] [PATCH v2 4/5] fftools/ffmpeg: flush and
> recreate encoder instance if resolution changes
> 
> Linjie Fu (12020-06-11):
> > Add recreate_encoder_instance() function.
> >
> > If resolution changing is allowed, discard
> AV_CODEC_FLAG_GLOBAL_HEADER
> > even if the avformat/container declares AVFMT_GLOBALHEADER flag.
> Place
> > header information in every keyframe instead of single global header.
> 
> Why? How is it valid? If the codec requires global header, we cannot
> just ignore them. 

IIRC, the global header in extra data is optional in codec level. By storing the
parameter set in global header, it allows reusing of the shared information
and hence is bitrate efficient. Also it's loss robust since it allows parameter
set content to be carried in a more reliable way.(or repeated frequently)

Hence IMHO fallback to store the sequence header in key frame may lose
the advantage of bitrate efficient and loss robust, but it seems to be correct
since it's more fundamental. (And the test result shows it works)

(Please correct if my understanding is not correct)

> And if the codec can change resolution, there is no  point in recreating it.

Agree with this, for these codecs I'd prefer to implement corresponding method
In specific encoder (like libvpx-vp9):
https://patchwork.ffmpeg.org/project/ffmpeg/patch/1565688544-9043-1-git-send-email-linjie...@intel.com/

- Linjie


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

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

Re: [FFmpeg-devel] [PATCH] OS/2:Support linking against libcx

2020-06-11 Thread Dave Yeo

On 06/11/20 10:26 AM, Michael Niedermayer wrote:

On Wed, Jun 10, 2020 at 09:24:51PM -0700, Dave Yeo wrote:

On 06/10/20 02:09 PM, Michael Niedermayer wrote:

On Tue, Jun 09, 2020 at 11:11:48PM -0700, Dave Yeo wrote:

Hi, could I get this pushed to trunk and the 4.3 branch? Fixes a build break
in libavformat/ip.c (implicit declaration of function 'getaddrinfo') and
also need the prototype.
Thanks,
Dave

it seems this breaks build on linux


Sorry about that, I'll test on Linux in the future.
Here's a better patch as it doesn't touch configure.
Thanks,
Dave


I can confirm this does not break build anymore, but iam not OS/2
maintainer nor do i have such box so ill leave review / application
to someone better suited for this

thx
[...]


Fair enough, I'll CC KOMH
Dave

___
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 v13 2/3] avfilter/vf_showinfo: display H.26[45] user data unregistered sei message

2020-06-11 Thread lance . lmwang
From: Limin Wang 

Signed-off-by: Limin Wang 
---
 libavfilter/vf_showinfo.c | 30 ++
 1 file changed, 30 insertions(+)

diff --git a/libavfilter/vf_showinfo.c b/libavfilter/vf_showinfo.c
index 5d4aee4..5315f8f 100644
--- a/libavfilter/vf_showinfo.c
+++ b/libavfilter/vf_showinfo.c
@@ -190,6 +190,33 @@ static void dump_video_enc_params(AVFilterContext *ctx, 
AVFrameSideData *sd)
 av_log(ctx, AV_LOG_INFO, "%u blocks; ", par->nb_blocks);
 }
 
+static void dump_sei_unregistered_metadata(AVFilterContext *ctx, 
AVFrameSideData *sd)
+{
+const int uuid_size = 16;
+uint8_t *user_data = sd->data;
+int i;
+
+if (sd->size < uuid_size) {
+av_log(ctx, AV_LOG_ERROR, "invalid data(%d < UUID(%d-bytes))", 
sd->size, uuid_size);
+return;
+}
+
+av_log(ctx, AV_LOG_INFO, "User Data Unregistered:\n");
+av_log(ctx, AV_LOG_INFO, "UUID=");
+for (i = 0; i < uuid_size; i++) {
+av_log(ctx, AV_LOG_INFO, "%02x", user_data[i]);
+if (i == 3 || i == 5 || i == 7 || i == 9)
+av_log(ctx, AV_LOG_INFO, "-");
+}
+av_log(ctx, AV_LOG_INFO, "\n");
+
+av_log(ctx, AV_LOG_INFO, "User Data=");
+for (; i < sd->size; i++) {
+av_log(ctx, AV_LOG_INFO, "%02x", user_data[i]);
+}
+av_log(ctx, AV_LOG_INFO, "\n");
+}
+
 static void dump_color_property(AVFilterContext *ctx, AVFrame *frame)
 {
 const char *color_range_str = av_color_range_name(frame->color_range);
@@ -375,6 +402,9 @@ static int filter_frame(AVFilterLink *inlink, AVFrame 
*frame)
 case AV_FRAME_DATA_VIDEO_ENC_PARAMS:
 dump_video_enc_params(ctx, sd);
 break;
+case AV_FRAME_DATA_SEI_UNREGISTERED:
+dump_sei_unregistered_metadata(ctx, sd);
+break;
 default:
 av_log(ctx, AV_LOG_WARNING, "unknown side data type %d (%d bytes)",
sd->type, sd->size);
-- 
1.8.3.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] avformat/isom: enable extended language for mov

2020-06-11 Thread Yongle Lin
Allow extended language codes using ISO designation for text tracks in mov 
format when strictness is set to experimental
---
This patch includes a support for mov format to extend language codes using ISO 
designation for text 
tracks(https://developer.apple.com/library/archive/documentation/QuickTime/QTFF/QTFFChap4/qtff4.html#//apple_ref/doc/uid/TP4939-CH206-27005)
 and a FATE test associates with it.

 libavformat/isom.c   | 9 +++--
 libavformat/isom.h   | 2 +-
 libavformat/movenc.c | 6 +++---
 tests/fate/mov.mak   | 3 +++
 tests/ref/fate/mov-extended-lang | 4 
 5 files changed, 18 insertions(+), 6 deletions(-)
 create mode 100644 tests/ref/fate/mov-extended-lang

diff --git a/libavformat/isom.c b/libavformat/isom.c
index 44c7b13038..e59d085d16 100644
--- a/libavformat/isom.c
+++ b/libavformat/isom.c
@@ -416,7 +416,7 @@ static const char mov_mdhd_language_map[][4] = {
 "cat", "lat", "que", "grn", "aym", "tat", "uig", "dzo", "jav"
 };
 
-int ff_mov_iso639_to_lang(const char lang[4], int mp4)
+int ff_mov_iso639_to_lang(const char lang[4], int mp4, int 
strict_std_compliance)
 {
 int i, code = 0;
 
@@ -426,8 +426,13 @@ int ff_mov_iso639_to_lang(const char lang[4], int mp4)
 return i;
 }
 /* XXX:can we do that in mov too? */
-if (!mp4)
+if (!mp4 && (strict_std_compliance != FF_COMPLIANCE_EXPERIMENTAL || 
!strcmp(lang, "und"))) {
+if (strcmp(lang, "und"))
+av_log(NULL, AV_LOG_WARNING, "Non macintosh language is discarded 
for mov\n");
 return -1;
+}
+if (!mp4)
+av_log(NULL, AV_LOG_WARNING, "Experimental behavior: enable extended 
language in mov\n");
 /* handle undefined as such */
 if (lang[0] == '\0')
 lang = "und";
diff --git a/libavformat/isom.h b/libavformat/isom.h
index 41a9c64c11..9d018ebf1f 100644
--- a/libavformat/isom.h
+++ b/libavformat/isom.h
@@ -43,7 +43,7 @@ extern const AVCodecTag ff_codec_movaudio_tags[];
 extern const AVCodecTag ff_codec_movsubtitle_tags[];
 extern const AVCodecTag ff_codec_movdata_tags[];
 
-int ff_mov_iso639_to_lang(const char lang[4], int mp4);
+int ff_mov_iso639_to_lang(const char lang[4], int mp4, int 
strict_std_compliance);
 int ff_mov_lang_to_iso639(unsigned code, char to[4]);
 
 struct AVAESCTR;
diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index 5d8dc4fd5d..d833eba056 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -3429,7 +3429,7 @@ static int mov_write_string_data_tag(AVIOContext *pb, 
const char *data, int lang
 return size;
 } else {
 if (!lang)
-lang = ff_mov_iso639_to_lang("und", 1);
+lang = ff_mov_iso639_to_lang("und", 1, FF_COMPLIANCE_NORMAL);
 avio_wb16(pb, strlen(data)); /* string length */
 avio_wb16(pb, lang);
 avio_write(pb, data, strlen(data));
@@ -3468,7 +3468,7 @@ static AVDictionaryEntry 
*get_metadata_lang(AVFormatContext *s,
 while ((t2 = av_dict_get(s->metadata, tag2, t2, AV_DICT_IGNORE_SUFFIX))) {
 len2 = strlen(t2->key);
 if (len2 == len + 4 && !strcmp(t->value, t2->value)
-&& (l = ff_mov_iso639_to_lang(&t2->key[len2 - 3], 1)) >= 0) {
+&& (l = ff_mov_iso639_to_lang(&t2->key[len2 - 3], 1, 
s->strict_std_compliance)) >= 0) {
 *lang = l;
 return t;
 }
@@ -6429,7 +6429,7 @@ static int mov_init(AVFormatContext *s)
 
 track->st  = st;
 track->par = st->codecpar;
-track->language = ff_mov_iso639_to_lang(lang?lang->value:"und", 
mov->mode!=MODE_MOV);
+track->language = ff_mov_iso639_to_lang(lang?lang->value:"und", 
mov->mode!=MODE_MOV, s->strict_std_compliance);
 if (track->language < 0)
 track->language = 32767;  // Unspecified Macintosh language code
 track->mode = mov->mode;
diff --git a/tests/fate/mov.mak b/tests/fate/mov.mak
index 7a721d7c95..522011b172 100644
--- a/tests/fate/mov.mak
+++ b/tests/fate/mov.mak
@@ -29,6 +29,7 @@ FATE_MOV_FFPROBE = fate-mov-neg-firstpts-discard \
fate-mov-guess-delay-2 \
fate-mov-guess-delay-3 \
fate-mov-mp4-with-mov-in24-ver \
+   fate-mov-extended-lang \
 
 FATE_MOV_FASTSTART = fate-mov-faststart-4gb-overflow \
 
@@ -124,3 +125,5 @@ fate-mov-faststart-4gb-overflow: CMP = oneline
 fate-mov-faststart-4gb-overflow: REF = bc875921f151871e787c4b4023269b29
 
 fate-mov-mp4-with-mov-in24-ver: CMD = run ffprobe$(PROGSSUF)$(EXESUF) 
-show_entries stream=codec_name -select_streams 1 
$(TARGET_SAMPLES)/mov/mp4-with-mov-in24-ver.mp4
+
+fate-mov-extended-lang: CMD = ffmpeg$(PROGSSUF)$(EXESUF) -f lavfi -i 
sine=frequency=1000:duration=15 -strict experimental -metadata:s:a:0 
language=deu -y $(TARGET_PATH)/metadata.mov; run ffprobe -show_entries 
stream=index:stream_tags=language $(TARGET_PATH)/metadata.mov; rm metadata.mov
diff --git a/tests/ref/fate/mov-extended-lang b/test

Re: [FFmpeg-devel] [PATCH v12 3/4] avfilter/vf_showinfo: display H.26[45] user data unregistered sei message

2020-06-11 Thread lance . lmwang
On Thu, Jun 11, 2020 at 06:35:15PM +0200, Andreas Rheinhardt wrote:
> lance.lmw...@gmail.com:
> > From: Limin Wang 
> > 
> > Signed-off-by: Limin Wang 
> > ---
> >  libavfilter/vf_showinfo.c | 37 +
> >  1 file changed, 37 insertions(+)
> > 
> > diff --git a/libavfilter/vf_showinfo.c b/libavfilter/vf_showinfo.c
> > index 5d4aee4..3658234 100644
> > --- a/libavfilter/vf_showinfo.c
> > +++ b/libavfilter/vf_showinfo.c
> > @@ -37,6 +37,7 @@
> >  #include "libavutil/timecode.h"
> >  #include "libavutil/mastering_display_metadata.h"
> >  #include "libavutil/video_enc_params.h"
> > +#include "libavutil/avstring.h"
> >  
> >  #include "avfilter.h"
> >  #include "internal.h"
> > @@ -190,6 +191,39 @@ static void dump_video_enc_params(AVFilterContext 
> > *ctx, AVFrameSideData *sd)
> >  av_log(ctx, AV_LOG_INFO, "%u blocks; ", par->nb_blocks);
> >  }
> >  
> > +static int string_is_print(const uint8_t *str)
> > +{
> > +while (*str && *str >= 0x20 && *str <= 0x7e ) str++;
> > +return !*str;
> > +}
> > +
> > +static void dump_sei_unregistered_metadata(AVFilterContext *ctx, 
> > AVFrameSideData *sd)
> > +{
> > +const int uuid_size = 16;
> > +uint8_t *user_data = sd->data;
> > +
> > +if (sd->size < uuid_size) {
> > +av_log(ctx, AV_LOG_ERROR, "invalid data(%d < UUID(%d-bytes))", 
> > sd->size, uuid_size);
> > +return;
> > +}
> > +
> > +av_log(ctx, AV_LOG_INFO, "User Data Unregistered:\n");
> > +av_log(ctx, AV_LOG_INFO, "UUID=");
> > +for (int i = 0; i < uuid_size; i++) {
> > +av_log(ctx, AV_LOG_INFO, "%02x", user_data[i]);
> > +if (i == 3 || i == 5 || i == 7 || i == 9)
> > +av_log(ctx, AV_LOG_INFO, "-");
> > +}
> > +av_log(ctx, AV_LOG_INFO, "\n");
> > +
> > +user_data += uuid_size;
> > +/* Only print the user data details if it's string or partial string*/
> > +if (string_is_print(user_data)) {
> > +av_log(ctx, AV_LOG_INFO, "User Data=");
> > +av_log(ctx, AV_LOG_INFO, "%s", user_data);
> > +}
> > +}
> > +
> >  static void dump_color_property(AVFilterContext *ctx, AVFrame *frame)
> >  {
> >  const char *color_range_str = 
> > av_color_range_name(frame->color_range);
> > @@ -375,6 +409,9 @@ static int filter_frame(AVFilterLink *inlink, AVFrame 
> > *frame)
> >  case AV_FRAME_DATA_VIDEO_ENC_PARAMS:
> >  dump_video_enc_params(ctx, sd);
> >  break;
> > +case AV_FRAME_DATA_SEI_UNREGISTERED:
> > +dump_sei_unregistered_metadata(ctx, sd);
> > +break;
> >  default:
> >  av_log(ctx, AV_LOG_WARNING, "unknown side data type %d (%d 
> > bytes)",
> > sd->type, sd->size);
> > 
> This new version has the same issues as the old one plus one more: It
> adds a new header that is now unnecessary.

I haven no idea how to reproduce your issues yet, for safety, I'll change to 
dump 
hex. It's easy to convert hex to ascii by online or local tools.

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

-- 
Thanks,
Limin Wang
___
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 7/7] avfilter: add afwtdn filter

2020-06-11 Thread Nicolas George
Paul B Mahol (12020-06-12):
> FFmpeg is not math encyclopedia.

You did not type these numbers, you took them from somewhere. Include it
in the source code, where it belongs.

-- 
  Nicolas George


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

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

Re: [FFmpeg-devel] [PATCH 7/7] avfilter: add afwtdn filter

2020-06-11 Thread Paul B Mahol
On 6/12/20, Nicolas George  wrote:
> Paul B Mahol (12020-06-12):
>> This is part of basic math,
>
> Then add the formula in a comment. But no, it is not just basic math:
> there was a program that did the computations.

FFmpeg is not math encyclopedia.

>
>> you seems to lack basic math knowledge.
>
> Rude again.

Your reviews are rude.

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

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

Re: [FFmpeg-devel] [PATCH 2/7] avfilter: add ff_inlink_peek_samples and ff_inlink_skip samples

2020-06-11 Thread Paul B Mahol
On 6/12/20, Nicolas George  wrote:
> Paul B Mahol (12020-06-12):
>> This is needed also by showspectrumpic filter and it needs random number
>> of
>> samples to skip and peek.
>
> I looked at the code for showspectrumpic before making my comment: the
> second part of your statement does not seem accurate.

How so? Its purely random.

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

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

Re: [FFmpeg-devel] [PATCH 2/7] avfilter: add ff_inlink_peek_samples and ff_inlink_skip samples

2020-06-11 Thread Nicolas George
Paul B Mahol (12020-06-12):
> This is needed also by showspectrumpic filter and it needs random number of
> samples to skip and peek.

I looked at the code for showspectrumpic before making my comment: the
second part of your statement does not seem accurate.

-- 
  Nicolas George


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

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

Re: [FFmpeg-devel] [PATCH 7/7] avfilter: add afwtdn filter

2020-06-11 Thread Nicolas George
Paul B Mahol (12020-06-12):
> This is part of basic math,

Then add the formula in a comment. But no, it is not just basic math:
there was a program that did the computations.

> you seems to lack basic math knowledge.

Rude again.

-- 
  Nicolas George


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

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

Re: [FFmpeg-devel] [PATCH 7/7] avfilter: add afwtdn filter

2020-06-11 Thread Paul B Mahol
On 6/11/20, Nicolas George  wrote:
> Paul B Mahol (12020-06-11):
>> Signed-off-by: Paul B Mahol 
>> ---
>>  doc/filters.texi |   60 ++
>>  libavfilter/Makefile |1 +
>>  libavfilter/af_afwtdn.c  | 1345 ++
>>  libavfilter/allfilters.c |1 +
>>  4 files changed, 1407 insertions(+)
>>  create mode 100644 libavfilter/af_afwtdn.c
>
> I still oppose to this filter on the basis of the name.
>
>>
>> diff --git a/doc/filters.texi b/doc/filters.texi
>> index c2960e33c7..d89ebc5122 100644
>> --- a/doc/filters.texi
>> +++ b/doc/filters.texi
>> @@ -1314,6 +1314,66 @@ Force the output to either unsigned 8-bit or signed
>> 16-bit stereo
>>  aformat=sample_fmts=u8|s16:channel_layouts=stereo
>>  @end example
>>
>
>> +@section afwtdn
>> +Reduce broadband noise from input samples using Wavelets.
>
> Please document in user-oriented terms and not in developer-oriented the
> benefits of this filter for the user. You need to explain WHAT it does
> different from the n other denoisers, not HOW it does it.
>
>> +
>> +A description of the accepted options follows.
>> +
>> +@table @option
>> +@item sigma
>> +Set the noise sigma, allowed range is from 0 to 1.
>> +Default value is 0.
>> +This option controls strength of denoising applied to input samples.
>> +Most useful way to set this option is via decibels, eg. -45dB.
>> +
>> +@item levels
>> +Set the number of wavelet levels of decomposition.
>> +Allowed range is from 1 to 12.
>> +Default value is 10.
>> +Setting this too low make denoising performance very poor.
>> +
>> +@item wavet
>> +Set wavelet type for decomposition of input frame.
>> +They are sorted by number of coefficients, from lowest to highest.
>> +More coefficients means worse filtering speed, but overall better
>> quality.
>> +Available wavelets are:
>> +
>> +@table @samp
>> +@item sym2
>> +@item sym4
>> +@item rbior68
>> +@item deb10
>> +@item sym10
>> +@item coif5
>> +@item bl3
>> +@end table
>> +
>> +@item percent
>> +Set percent of full denoising. Allowed range is from 0 to 100 percent.
>> +Default value is 85 percent or partial denoising.
>> +
>> +@item profile
>> +If enabled, first input frame will be used as noise profile.
>> +If first frame samples contain non-noise performance will be very poor.
>> +
>> +@item adaptive
>> +If enabled, input frames are analyzed for presence of noise.
>> +If noise is detected with high possibility then input frame profile will
>> be
>> +used for processing following frames, until new noise frame is detected.
>> +
>> +@item samples
>> +Set size of single frame in number of samples. Allowed range is from 512
>> to
>> +65536. Default frame size is 8192 samples.
>> +
>> +@item softness
>> +Set softness applied inside thresholding function. Allowed range is from
>> 0 to
>> +10. Default softness is 1.
>> +@end table
>> +
>> +@subsection Commands
>> +
>> +This filter supports subset of its options as @ref{commands}.
>> +
>>  @section agate
>>
>>  A gate is mainly used to reduce lower parts of a signal. This kind of
>> signal
>> diff --git a/libavfilter/Makefile b/libavfilter/Makefile
>> index 5123540653..191826a622 100644
>> --- a/libavfilter/Makefile
>> +++ b/libavfilter/Makefile
>> @@ -50,6 +50,7 @@ OBJS-$(CONFIG_AFFTDN_FILTER) +=
>> af_afftdn.o
>>  OBJS-$(CONFIG_AFFTFILT_FILTER)   += af_afftfilt.o
>>  OBJS-$(CONFIG_AFIR_FILTER)   += af_afir.o
>>  OBJS-$(CONFIG_AFORMAT_FILTER)+= af_aformat.o
>> +OBJS-$(CONFIG_AFWTDN_FILTER) += af_afwtdn.o
>>  OBJS-$(CONFIG_AGATE_FILTER)  += af_agate.o
>>  OBJS-$(CONFIG_AIIR_FILTER)   += af_aiir.o
>>  OBJS-$(CONFIG_AINTEGRAL_FILTER)  += af_aderivative.o
>> diff --git a/libavfilter/af_afwtdn.c b/libavfilter/af_afwtdn.c
>> new file mode 100644
>> index 00..d2793d4d92
>> --- /dev/null
>> +++ b/libavfilter/af_afwtdn.c
>> @@ -0,0 +1,1345 @@
>> +/*
>> + * 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 "libavutil/avstring.h"
>> +#include "libavutil/opt.h"
>> +#include "avfilter.h"
>> +#include "audio.

Re: [FFmpeg-devel] [PATCH 2/7] avfilter: add ff_inlink_peek_samples and ff_inlink_skip samples

2020-06-11 Thread Paul B Mahol
On 6/11/20, Nicolas George  wrote:
> Paul B Mahol (12020-06-11):
>> Signed-off-by: Paul B Mahol 
>> ---
>>  libavfilter/avfilter.c | 61 +-
>>  libavfilter/filters.h  | 17 
>>  2 files changed, 72 insertions(+), 6 deletions(-)
>
> Still no. It makes a very important function much more complex, it would
> be simpler implemented in the filters directly since they are not using
> the full features of the queue.

Can I get another objective opinion?

This is needed also by showspectrumpic filter and it needs random number of
samples to skip and peek.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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

Re: [FFmpeg-devel] [PATCH] avfilter/vf_chromakey: The chromakey filter preserves non-opaque alpha transparency.

2020-06-11 Thread Gavin Smith


On 11/06/2020 22:03, Timo Rothenpieler wrote:

On 11.06.2020 22:27, Gavin Smith wrote:
This is to address trac ticket #8724.  The filter did not preserve 
alpha transparency. Items that were transparent in the input would 
appear black on the output or pixels that were semi-tranparent would 
appear opaque.




What is the performance impact for inputs without an alpha channel?


Firstly, I'm new to this world of filters.  Now my patch only applies to 
chromakey and not chromahold. On that note, is it not the case that the 
chromakey mandates that all its inputs surfaces contain alpha (as per 
query_formats function)? Would any AVPixelFormat that does not match 
query_formats get converted to a format containing alpha transparency?




Generally looks fine to me, but might need hidden behind an option, as 
to not break existing setups that rely on this filter 
discarding/ignoring the input alpha channel.


Yes. No problem. "preserve_transparency" and default to the equivalent 
of 'false'?



___
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/5] lavc/h264dec: loosen new-extradata check

2020-06-11 Thread Ridley Combs


> On Jun 11, 2020, at 07:53, James Almer  wrote:
> 
> On 6/11/2020 1:43 AM, rcombs wrote:
>> ---
>> libavcodec/h264dec.c | 13 ++---
>> 1 file changed, 6 insertions(+), 7 deletions(-)
>> 
>> diff --git a/libavcodec/h264dec.c b/libavcodec/h264dec.c
>> index 6270ea80df..0d7492cfad 100644
>> --- a/libavcodec/h264dec.c
>> +++ b/libavcodec/h264dec.c
>> @@ -988,6 +988,8 @@ static int h264_decode_frame(AVCodecContext *avctx, void 
>> *data,
>> AVFrame *pict  = data;
>> int buf_index;
>> int ret;
>> +const uint8_t *new_extra;
>> +int new_extra_size;
>> 
>> h->flags = avctx->flags;
>> h->setup_finished = 0;
>> @@ -999,13 +1001,10 @@ static int h264_decode_frame(AVCodecContext *avctx, 
>> void *data,
>> if (buf_size == 0)
>> return send_next_delayed_frame(h, pict, got_frame, 0);
>> 
>> -if (h->is_avc && av_packet_get_side_data(avpkt, 
>> AV_PKT_DATA_NEW_EXTRADATA, NULL)) {
>> -int side_size;
>> -uint8_t *side = av_packet_get_side_data(avpkt, 
>> AV_PKT_DATA_NEW_EXTRADATA, &side_size);
>> -if (is_extra(side, side_size))
>> -ff_h264_decode_extradata(side, side_size,
>> - &h->ps, &h->is_avc, 
>> &h->nal_length_size,
>> - avctx->err_recognition, avctx);
>> +if ((new_extra = av_packet_get_side_data(avpkt, 
>> AV_PKT_DATA_NEW_EXTRADATA, &new_extra_size))) {
>> +ff_h264_decode_extradata(new_extra, new_extra_size,
>> + &h->ps, &h->is_avc, &h->nal_length_size,
>> + avctx->err_recognition, avctx);
>> }
>> if (h->is_avc && buf_size >= 9 && buf[0]==1 && buf[2]==0 && 
>> (buf[4]&0xFC)==0xFC) {
>> if (is_extra(buf, buf_size))
> 
> This looks similar to
> https://patchwork.ffmpeg.org/project/ffmpeg/patch/20200508020929.68603-1-ollywood...@gmail.com/

Heh, yeah it's ultimately functionally the same, but has an entirely different 
purpose. The streams I'm working with _are_ avcC-formatted, but don't have 
extradata yet at init-time, so the is_avc flag isn't set when this code runs. 
The is_extra check was failing because some files have stub avcC extradata that 
doesn't contain any SPS/PPS arrays (they're sent inline instead).
Sounds like this change is a win/win, then?

> ___
> 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 4/5] lavf/dashdec: improve memory handling

2020-06-11 Thread Ridley Combs


> On Jun 11, 2020, at 10:19, Andreas Rheinhardt  
> wrote:
> 
> rcombs:
>> - Fixes a couple leaks
>> - Adds an av_freep equivalent for libxml buffers
>> - Avoids some redundant copying
>> ---
>> libavformat/dashdec.c | 44 +++
>> 1 file changed, 24 insertions(+), 20 deletions(-)
>> 
>> diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c
>> index c94ce2caca..378c892b87 100644
>> --- a/libavformat/dashdec.c
>> +++ b/libavformat/dashdec.c
>> @@ -147,9 +147,6 @@ typedef struct DASHContext {
>> uint64_t period_duration;
>> uint64_t period_start;
>> 
>> -/* AdaptationSet Attribute */
>> -char *adaptationset_lang;
>> -
>> int is_live;
>> AVIOInterruptCB *interrupt_callback;
>> char *allowed_extensions;
>> @@ -162,6 +159,15 @@ typedef struct DASHContext {
>> 
>> } DASHContext;
>> 
>> +static void xml_freep(void* arg)
>> +{
>> +void *val;
>> +
>> +memcpy(&val, arg, sizeof(val));
>> +memcpy(arg, &(void *){ NULL }, sizeof(val));
>> +xmlFree(val);
>> +}
>> +
> 
> libxml2 allows to use custom memory allocation functions. Have you tried
> to just use our allocation functions which would allow to use av_freep
> directly?

This would work in theory, but it's not library-safe: if any other library (or 
the main application) also overrode the libxml2 allocation functions, then this 
could fail (and if some other code relied on that functionality, we could break 
that). I'd rather not rely on global state in a dependency lib like that if not 
absolutely necessary.

> 
>> static int ishttp(char *url)
>> {
>> const char *proto_name = avio_find_protocol_name(url);
>> @@ -362,6 +368,8 @@ static void free_representation(struct representation 
>> *pls)
>> avformat_close_input(&pls->ctx);
>> }
>> 
>> +xml_freep(&pls->lang);
>> +
>> av_freep(&pls->url_template);
>> av_freep(&pls);
>> }
>> @@ -878,15 +886,9 @@ static int 
>> parse_manifest_representation(AVFormatContext *s, const char *url,
>> ret = AVERROR(ENOMEM);
>> goto end;
>> }
>> -if (c->adaptationset_lang) {
>> -rep->lang = av_strdup(c->adaptationset_lang);
>> -if (!rep->lang) {
>> -av_log(s, AV_LOG_ERROR, "alloc language memory failure\n");
>> -av_freep(&rep);
>> -ret = AVERROR(ENOMEM);
>> -goto end;
>> -}
>> -}
>> +
>> +rep->lang = xmlGetProp(adaptationset_node, "lang");
>> +
>> rep->parent = s;
>> representation_segmenttemplate_node = 
>> find_child_node_by_name(representation_node, "SegmentTemplate");
>> representation_baseurl_node = 
>> find_child_node_by_name(representation_node, "BaseURL");
>> @@ -965,7 +967,8 @@ static int parse_manifest_representation(AVFormatContext 
>> *s, const char *url,
>> xmlFree(startnumber_val);
>> }
>> if (adaptationset_supplementalproperty_node) {
>> -if 
>> (!av_strcasecmp(xmlGetProp(adaptationset_supplementalproperty_node,"schemeIdUri"),
>>  "http://dashif.org/guidelines/last-segment-number";)) {
>> +char *schemeIdUri = 
>> xmlGetProp(adaptationset_supplementalproperty_node, "schemeIdUri");
>> +if (!av_strcasecmp(schemeIdUri, 
>> "http://dashif.org/guidelines/last-segment-number";)) {
>> val = 
>> xmlGetProp(adaptationset_supplementalproperty_node,"value");
>> if (!val) {
>> av_log(s, AV_LOG_ERROR, "Missing value attribute in 
>> adaptationset_supplementalproperty_node\n");
>> @@ -974,6 +977,7 @@ static int parse_manifest_representation(AVFormatContext 
>> *s, const char *url,
>> xmlFree(val);
>> }
>> }
>> +xmlFree(schemeIdUri);
>> }
>> 
>> fragment_timeline_node = 
>> find_child_node_by_name(representation_segmenttemplate_node, 
>> "SegmentTimeline");
>> @@ -1120,13 +1124,10 @@ end:
>> 
>> static int parse_manifest_adaptationset_attr(AVFormatContext *s, xmlNodePtr 
>> adaptationset_node)
>> {
>> -DASHContext *c = s->priv_data;
>> -
>> if (!adaptationset_node) {
>> av_log(s, AV_LOG_WARNING, "Cannot get AdaptationSet\n");
>> return AVERROR(EINVAL);
>> }
>> -c->adaptationset_lang = xmlGetProp(adaptationset_node, "lang");
>> 
>> return 0;
>> }
>> @@ -1139,7 +1140,6 @@ static int 
>> parse_manifest_adaptationset(AVFormatContext *s, const char *url,
>> xmlNodePtr period_segmentlist_node)
>> {
>> int ret = 0;
>> -DASHContext *c = s->priv_data;
>> xmlNodePtr fragment_template_node = NULL;
>> xmlNodePtr content_component_node = NULL;
>> xmlNodePtr adaptationset_baseurl_node = NULL;
>> @@ -1182,7 +1182,6 @@ static int 
>> parse_manifest_adaptationset(AVFormatContext *s, const char *url,
>> }
>> 
>> err:
>> -

[FFmpeg-devel] [PATCH 2/2] avcodec/jpeg2000dec: Fix/check for multiple integer overflows

2020-06-11 Thread Michael Niedermayer
Fixes: shift exponent 35 is too large for 32-bit type 'int'
Fixes: 
22857/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_JPEG2000_fuzzer-5202709358837760

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer 
---
 libavcodec/jpeg2000dec.c | 19 +--
 1 file changed, 13 insertions(+), 6 deletions(-)

diff --git a/libavcodec/jpeg2000dec.c b/libavcodec/jpeg2000dec.c
index b7766459c4..ab36009a2d 100644
--- a/libavcodec/jpeg2000dec.c
+++ b/libavcodec/jpeg2000dec.c
@@ -612,12 +612,19 @@ static int get_rgn(Jpeg2000DecoderContext *s, int n)
 // Currently compno cannot be greater than 4.
 // However, future implementation should support compno up to 65536
 if (compno < s->ncomponents) {
-if (s->curtileno == -1)
-s->roi_shift[compno] = bytestream2_get_byte(&s->g);
-else {
+int v;
+if (s->curtileno == -1) {
+v =  bytestream2_get_byte(&s->g);
+if (v > 30)
+return AVERROR_PATCHWELCOME;
+s->roi_shift[compno] = v;
+} else {
 if (s->tile[s->curtileno].tp_idx != 0)
 return AVERROR_INVALIDDATA; // marker occurs only in first 
tile part of tile
-s->tile[s->curtileno].comp[compno].roi_shift = 
bytestream2_get_byte(&s->g);
+v = bytestream2_get_byte(&s->g);
+if (v > 30)
+return AVERROR_PATCHWELCOME;
+s->tile[s->curtileno].comp[compno].roi_shift = v;
 }
 return 0;
 }
@@ -1669,8 +1676,8 @@ static int decode_cblk(Jpeg2000DecoderContext *s, 
Jpeg2000CodingStyle *codsty,
 ff_mqc_initdec(&t1->mqc, cblk->data, 0, 1);
 
 while (passno--) {
-if (bpno < 0) {
-av_log(s->avctx, AV_LOG_ERROR, "bpno became negative\n");
+if (bpno < 0 || bpno > 29) {
+av_log(s->avctx, AV_LOG_ERROR, "bpno became invalid\n");
 return AVERROR_INVALIDDATA;
 }
 switch(pass_t) {
-- 
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 1/2] avcodec/mpeg4videodec: Fix 2 integer overflows in get_amv()

2020-06-11 Thread Michael Niedermayer
Fixes: signed integer overflow: -144876608 * 16 cannot be represented in type 
'int'
Fixes: 
22782/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MPEG4_fuzzer-6039584977977344

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

diff --git a/libavcodec/mpeg4videodec.c b/libavcodec/mpeg4videodec.c
index 7e52bbef1b..0824bbee6d 100644
--- a/libavcodec/mpeg4videodec.c
+++ b/libavcodec/mpeg4videodec.c
@@ -610,7 +610,7 @@ static inline int get_amv(Mpeg4DecContext *ctx, int n)
 dy -= 1 << (shift + a + 1);
 else
 dx -= 1 << (shift + a + 1);
-mb_v = s->sprite_offset[0][n] + dx * s->mb_x * 16 + dy * s->mb_y * 16;
+mb_v = s->sprite_offset[0][n] + dx * s->mb_x * 16U + dy * s->mb_y * 
16U;
 
 sum = 0;
 for (y = 0; y < 16; y++) {
-- 
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] avfilter/vf_chromakey: The chromakey filter preserves non-opaque alpha transparency.

2020-06-11 Thread Timo Rothenpieler

On 11.06.2020 22:27, Gavin Smith wrote:

This is to address trac ticket #8724.  The filter did not preserve alpha 
transparency. Items that were transparent in the input would appear black on 
the output or pixels that were semi-tranparent would appear opaque.



What is the performance impact for inputs without an alpha channel?

Generally looks fine to me, but might need hidden behind an option, as 
to not break existing setups that rely on this filter 
discarding/ignoring the input alpha channel.

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

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

[FFmpeg-devel] [PATCH] avfilter/vf_chromakey: The chromakey filter preserves non-opaque alpha transparency.

2020-06-11 Thread Gavin Smith
This is to address trac ticket #8724.  The filter did not preserve alpha 
transparency. Items that were transparent in the input would appear black on 
the output or pixels that were semi-tranparent would appear opaque.
---
 libavfilter/vf_chromakey.c | 43 ++
 1 file changed, 25 insertions(+), 18 deletions(-)

diff --git a/libavfilter/vf_chromakey.c b/libavfilter/vf_chromakey.c
index 4b1669d084..7206f1 100644
--- a/libavfilter/vf_chromakey.c
+++ b/libavfilter/vf_chromakey.c
@@ -47,7 +47,7 @@ typedef struct ChromakeyContext {
 int jobnr, int nb_jobs);
 } ChromakeyContext;
 
-static uint8_t do_chromakey_pixel(ChromakeyContext *ctx, uint8_t u[9], uint8_t 
v[9])
+static uint8_t do_chromakey_pixel(ChromakeyContext *ctx, uint8_t a, uint8_t 
u[9], uint8_t v[9])
 {
 double diff = 0.0;
 int du, dv, i;
@@ -62,13 +62,13 @@ static uint8_t do_chromakey_pixel(ChromakeyContext *ctx, 
uint8_t u[9], uint8_t v
 diff /= 9.0;
 
 if (ctx->blend > 0.0001) {
-return av_clipd((diff - ctx->similarity) / ctx->blend, 0.0, 1.0) * 
255.0;
+return av_clipd((diff - ctx->similarity) / ctx->blend, 0.0, 1.0) * 
(float)a;
 } else {
-return (diff > ctx->similarity) ? 255 : 0;
+return (diff > ctx->similarity) ? a : 0;
 }
 }
 
-static uint16_t do_chromakey_pixel16(ChromakeyContext *ctx, uint16_t u[9], 
uint16_t v[9])
+static uint16_t do_chromakey_pixel16(ChromakeyContext *ctx, uint16_t a, 
uint16_t u[9], uint16_t v[9])
 {
 double max = ctx->max;
 double diff = 0.0;
@@ -84,9 +84,9 @@ static uint16_t do_chromakey_pixel16(ChromakeyContext *ctx, 
uint16_t u[9], uint1
 diff /= 9.0;
 
 if (ctx->blend > 0.0001) {
-return av_clipd((diff - ctx->similarity) / ctx->blend, 0.0, 1.0) * max;
+return av_clipd((diff - ctx->similarity) / ctx->blend, 0.0, 1.0) * 
(float)a;
 } else {
-return (diff > ctx->similarity) ? max : 0;
+return (diff > ctx->similarity) ? a : 0;
 }
 }
 
@@ -131,13 +131,17 @@ static int do_chromakey_slice(AVFilterContext *avctx, 
void *arg, int jobnr, int
 
 for (y = slice_start; y < slice_end; ++y) {
 for (x = 0; x < frame->width; ++x) {
-for (yo = 0; yo < 3; ++yo) {
-for (xo = 0; xo < 3; ++xo) {
-get_pixel_uv(frame, ctx->hsub_log2, ctx->vsub_log2, x + xo 
- 1, y + yo - 1, &u[yo * 3 + xo], &v[yo * 3 + xo]);
+uint8_t *a = frame->data[3] + frame->linesize[3] * y;
+const uint8_t ao = a[x];
+
+if (ao != 0) {
+for (yo = 0; yo < 3; ++yo) {
+for (xo = 0; xo < 3; ++xo) {
+get_pixel_uv(frame, ctx->hsub_log2, ctx->vsub_log2, x 
+ xo - 1, y + yo - 1, &u[yo * 3 + xo], &v[yo * 3 + xo]);
+}
 }
+a[x] = do_chromakey_pixel(ctx, ao, u, v);
 }
-
-frame->data[3][frame->linesize[3] * y + x] = 
do_chromakey_pixel(ctx, u, v);
 }
 }
 
@@ -163,15 +167,18 @@ static int do_chromakey16_slice(AVFilterContext *avctx, 
void *arg, int jobnr, in
 
 for (y = slice_start; y < slice_end; ++y) {
 for (x = 0; x < frame->width; ++x) {
-uint16_t *dst = (uint16_t *)(frame->data[3] + frame->linesize[3] * 
y);
-
-for (yo = 0; yo < 3; ++yo) {
-for (xo = 0; xo < 3; ++xo) {
-get_pixel16_uv(frame, ctx->hsub_log2, ctx->vsub_log2, x + 
xo - 1, y + yo - 1, &u[yo * 3 + xo], &v[yo * 3 + xo]);
+uint16_t *a = (uint16_t *)(frame->data[3] + frame->linesize[3] * 
y);
+const uint16_t ao = a[x];
+
+if (ao != 0) {
+for (yo = 0; yo < 3; ++yo) {
+for (xo = 0; xo < 3; ++xo) {
+get_pixel16_uv(frame, ctx->hsub_log2, ctx->vsub_log2, 
x + xo - 1, y + yo - 1, &u[yo * 3 + xo], &v[yo * 3 + xo]);
+}
 }
-}
 
-dst[x] = do_chromakey_pixel16(ctx, u, v);
+a[x] = do_chromakey_pixel16(ctx, ao, u, v);
+}
 }
 }
 
-- 
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 v2 1/3] lavu/pix_fmt: add new pixel format x2rgb10

2020-06-11 Thread Lynne
Jun 2, 2020, 08:30 by fei.w.w...@intel.com:

>
>
>> -Original Message-
>> From: ffmpeg-devel  On Behalf Of Wang,
>> Fei W
>> Sent: Friday, May 15, 2020 2:58 PM
>> To: FFmpeg development discussions and patches 
>> Subject: Re: [FFmpeg-devel] [PATCH v2 1/3] lavu/pix_fmt: add new pixel
>> format x2rgb10
>>
>>
>> > -Original Message-
>> > From: ffmpeg-devel  On Behalf Of
>> > Lynne
>> > Sent: Wednesday, May 13, 2020 7:19 AM
>> > To: FFmpeg development discussions and patches > > de...@ffmpeg.org>
>> > Subject: Re: [FFmpeg-devel] [PATCH v2 1/3] lavu/pix_fmt: add new pixel
>> > format x2rgb10
>> >
>> > May 12, 2020, 23:42 by s...@jkqxz.net:
>> >
>> > > On 12/05/2020 22:42, Lynne wrote:
>> > >
>> > >> Apr 22, 2020, 06:28 by fei.w.w...@intel.com:
>> > >>
>> >  -Original Message-
>> >  From: Wang, Fei W 
>> >  Sent: Wednesday, April 22, 2020 1:23 PM
>> >  To: ffmpeg-devel@ffmpeg.org
>> >  Cc: Wang, Fei W 
>> >  Subject: [PATCH v2 1/3] lavu/pix_fmt: add new pixel format
>> >  x2rgb10
>> > 
>> >  The format is packed RGB with each channel 10 bits available and
>> >  include 2 bits unused.
>> > 
>> >  Signed-off-by: Fei Wang 
>> > 
>> > >>
>> > >> Ping on this patch? I kind of need it to support 10 bit Vulkan 
>> > >> sw_formats.
>> > >> I'm happy with the name as-is.
>> > >>
>> > >
>> > > Yes, but we probably need to reach a consensus on whether we are
>> > accepting the addition of these V210-like packed formats first - there
>> > were voices against it last time this was raised.
>> > >
>> > > I am in favour of allowing it because it is a common buffer format
>> > > used in
>> > both graphics and display hardware, and appears in pretty much all
>> > related APIs (OpenGL, OpenCL, Vulkan, KMS, D3D).
>> > >
>> >
>> > Same. With it, we would be able to support kmsgrab from 10bit
>> > displays, which are becoming more and more popular.
>> Glad to know this format can be used for Vulkan 10bit display. Sounds like 
>> this
>> format can bring more benefit to ffmpeg. Ping for other comments.
>>
> Hi Kindly ping, is there any other concern of this format? Tks.
>

Planning to push this tomorrow so I can start working on supporting it in 
Vulkan.

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

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

Re: [FFmpeg-devel] [PATCH 2/7] avfilter: add ff_inlink_peek_samples and ff_inlink_skip samples

2020-06-11 Thread Nicolas George
Paul B Mahol (12020-06-11):
> Signed-off-by: Paul B Mahol 
> ---
>  libavfilter/avfilter.c | 61 +-
>  libavfilter/filters.h  | 17 
>  2 files changed, 72 insertions(+), 6 deletions(-)

Still no. It makes a very important function much more complex, it would
be simpler implemented in the filters directly since they are not using
the full features of the queue.

-- 
  Nicolas George


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

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

Re: [FFmpeg-devel] [PATCH 7/7] avfilter: add afwtdn filter

2020-06-11 Thread Nicolas George
Paul B Mahol (12020-06-11):
> Signed-off-by: Paul B Mahol 
> ---
>  doc/filters.texi |   60 ++
>  libavfilter/Makefile |1 +
>  libavfilter/af_afwtdn.c  | 1345 ++
>  libavfilter/allfilters.c |1 +
>  4 files changed, 1407 insertions(+)
>  create mode 100644 libavfilter/af_afwtdn.c

I still oppose to this filter on the basis of the name.

> 
> diff --git a/doc/filters.texi b/doc/filters.texi
> index c2960e33c7..d89ebc5122 100644
> --- a/doc/filters.texi
> +++ b/doc/filters.texi
> @@ -1314,6 +1314,66 @@ Force the output to either unsigned 8-bit or signed 
> 16-bit stereo
>  aformat=sample_fmts=u8|s16:channel_layouts=stereo
>  @end example
>  

> +@section afwtdn
> +Reduce broadband noise from input samples using Wavelets.

Please document in user-oriented terms and not in developer-oriented the
benefits of this filter for the user. You need to explain WHAT it does
different from the n other denoisers, not HOW it does it.

> +
> +A description of the accepted options follows.
> +
> +@table @option
> +@item sigma
> +Set the noise sigma, allowed range is from 0 to 1.
> +Default value is 0.
> +This option controls strength of denoising applied to input samples.
> +Most useful way to set this option is via decibels, eg. -45dB.
> +
> +@item levels
> +Set the number of wavelet levels of decomposition.
> +Allowed range is from 1 to 12.
> +Default value is 10.
> +Setting this too low make denoising performance very poor.
> +
> +@item wavet
> +Set wavelet type for decomposition of input frame.
> +They are sorted by number of coefficients, from lowest to highest.
> +More coefficients means worse filtering speed, but overall better quality.
> +Available wavelets are:
> +
> +@table @samp
> +@item sym2
> +@item sym4
> +@item rbior68
> +@item deb10
> +@item sym10
> +@item coif5
> +@item bl3
> +@end table
> +
> +@item percent
> +Set percent of full denoising. Allowed range is from 0 to 100 percent.
> +Default value is 85 percent or partial denoising.
> +
> +@item profile
> +If enabled, first input frame will be used as noise profile.
> +If first frame samples contain non-noise performance will be very poor.
> +
> +@item adaptive
> +If enabled, input frames are analyzed for presence of noise.
> +If noise is detected with high possibility then input frame profile will be
> +used for processing following frames, until new noise frame is detected.
> +
> +@item samples
> +Set size of single frame in number of samples. Allowed range is from 512 to
> +65536. Default frame size is 8192 samples.
> +
> +@item softness
> +Set softness applied inside thresholding function. Allowed range is from 0 to
> +10. Default softness is 1.
> +@end table
> +
> +@subsection Commands
> +
> +This filter supports subset of its options as @ref{commands}.
> +
>  @section agate
>  
>  A gate is mainly used to reduce lower parts of a signal. This kind of signal
> diff --git a/libavfilter/Makefile b/libavfilter/Makefile
> index 5123540653..191826a622 100644
> --- a/libavfilter/Makefile
> +++ b/libavfilter/Makefile
> @@ -50,6 +50,7 @@ OBJS-$(CONFIG_AFFTDN_FILTER) += af_afftdn.o
>  OBJS-$(CONFIG_AFFTFILT_FILTER)   += af_afftfilt.o
>  OBJS-$(CONFIG_AFIR_FILTER)   += af_afir.o
>  OBJS-$(CONFIG_AFORMAT_FILTER)+= af_aformat.o
> +OBJS-$(CONFIG_AFWTDN_FILTER) += af_afwtdn.o
>  OBJS-$(CONFIG_AGATE_FILTER)  += af_agate.o
>  OBJS-$(CONFIG_AIIR_FILTER)   += af_aiir.o
>  OBJS-$(CONFIG_AINTEGRAL_FILTER)  += af_aderivative.o
> diff --git a/libavfilter/af_afwtdn.c b/libavfilter/af_afwtdn.c
> new file mode 100644
> index 00..d2793d4d92
> --- /dev/null
> +++ b/libavfilter/af_afwtdn.c
> @@ -0,0 +1,1345 @@
> +/*
> + * 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 "libavutil/avstring.h"
> +#include "libavutil/opt.h"
> +#include "avfilter.h"
> +#include "audio.h"
> +#include "filters.h"
> +#include "formats.h"
> +
> +enum WaveletTypes {
> +SYM2,
> +SYM4,
> +RBIOR68,
> +DEB10,
> +SYM10,
> +COIF5,
> +BL3,
> +NB_WAVE

Re: [FFmpeg-devel] [PATCH 4/5] fftools/ffmpeg: flush and recreate encoder instance if resolution changes

2020-06-11 Thread Nicolas George
Fu, Linjie (12020-06-11):
> If rawvideo here means .h264, attached the output file produced by libx264:

Now, rawvideo means rawvideo.

Regards,

-- 
  Nicolas George


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

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

Re: [FFmpeg-devel] [PATCH] OS/2:Support linking against libcx

2020-06-11 Thread Michael Niedermayer
On Wed, Jun 10, 2020 at 09:24:51PM -0700, Dave Yeo wrote:
> On 06/10/20 02:09 PM, Michael Niedermayer wrote:
> > On Tue, Jun 09, 2020 at 11:11:48PM -0700, Dave Yeo wrote:
> > > Hi, could I get this pushed to trunk and the 4.3 branch? Fixes a build 
> > > break
> > > in libavformat/ip.c (implicit declaration of function 'getaddrinfo') and
> > > also need the prototype.
> > > Thanks,
> > > Dave
> > it seems this breaks build on linux
> 
> Sorry about that, I'll test on Linux in the future.
> Here's a better patch as it doesn't touch configure.
> Thanks,
> Dave

I can confirm this does not break build anymore, but iam not OS/2
maintainer nor do i have such box so ill leave review / application
to someone better suited for this

thx
[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

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


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
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/5] fftools/ffmpeg: flush and recreate encoder instance if resolution changes

2020-06-11 Thread Nicolas George
Fu, Linjie (12020-06-11):
> Indeed, tested with .mp4 and .h264 for encoder libx264, the results are 
> playable.
> (discarding global header if resolution changing is allowed, then we can keep 
> the
> Sequence header in each Key frame and make the resolution changing noticeable)
> 
> Please help to comment, thx.
> https://patchwork.ffmpeg.org/project/ffmpeg/list/?series=1470

Did it produce a rawvideo stream that can be decoded? I doubt it.

Regards,

-- 
  Nicolas George


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

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

Re: [FFmpeg-devel] [PATCH v2 4/5] fftools/ffmpeg: flush and recreate encoder instance if resolution changes

2020-06-11 Thread Nicolas George
Linjie Fu (12020-06-11):
> Add recreate_encoder_instance() function.
> 
> If resolution changing is allowed, discard AV_CODEC_FLAG_GLOBAL_HEADER
> even if the avformat/container declares AVFMT_GLOBALHEADER flag. Place
> header information in every keyframe instead of single global header.

Why? How is it valid? If the codec requires global header, we cannot
just ignore them. And if the codec can change resolution, there is no
point in recreating it.

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] [PATCH 1/7] avfilter/af_biquads: switch to activate()

2020-06-11 Thread Paul B Mahol
Needed by following commits.

Signed-off-by: Paul B Mahol 
---
 libavfilter/af_biquads.c | 33 +
 1 file changed, 29 insertions(+), 4 deletions(-)

diff --git a/libavfilter/af_biquads.c b/libavfilter/af_biquads.c
index 81cdb0c10e..ef28db741a 100644
--- a/libavfilter/af_biquads.c
+++ b/libavfilter/af_biquads.c
@@ -67,6 +67,7 @@
 #include "libavutil/opt.h"
 #include "audio.h"
 #include "avfilter.h"
+#include "filters.h"
 #include "internal.h"
 
 enum FilterType {
@@ -523,6 +524,30 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *buf)
 return ff_filter_frame(outlink, out_buf);
 }
 
+static int activate(AVFilterContext *ctx)
+{
+AVFilterLink *inlink = ctx->inputs[0];
+AVFilterLink *outlink = ctx->outputs[0];
+AVFrame *in = NULL;
+int ret;
+
+FF_FILTER_FORWARD_STATUS_BACK(outlink, inlink);
+
+ret = ff_inlink_consume_frame(inlink, &in);
+if (ret < 0)
+return ret;
+if (ret > 0) {
+ret = filter_frame(inlink, in);
+if (ret < 0)
+return ret;
+}
+
+FF_FILTER_FORWARD_STATUS(inlink, outlink);
+FF_FILTER_FORWARD_WANTED(outlink, inlink);
+
+return FFERROR_NOT_READY;
+}
+
 static int process_command(AVFilterContext *ctx, const char *cmd, const char 
*args,
char *res, int res_len, int flags)
 {
@@ -547,7 +572,6 @@ static const AVFilterPad inputs[] = {
 {
 .name = "default",
 .type = AVMEDIA_TYPE_AUDIO,
-.filter_frame = filter_frame,
 },
 { NULL }
 };
@@ -567,19 +591,20 @@ static const AVFilterPad outputs[] = {
 
 #define DEFINE_BIQUAD_FILTER(name_, description_)   \
 AVFILTER_DEFINE_CLASS(name_);   \
-static av_cold int name_##_init(AVFilterContext *ctx) \
+static av_cold int name_##_init(AVFilterContext *ctx)   \
 {   \
 BiquadsContext *s = ctx->priv;  \
 s->class = &name_##_class;  \
 s->filter_type = name_; \
-return init(ctx); \
+return init(ctx);   \
 }   \
  \
-AVFilter ff_af_##name_ = { \
+AVFilter ff_af_##name_ = {   \
 .name  = #name_, \
 .description   = NULL_IF_CONFIG_SMALL(description_), \
 .priv_size = sizeof(BiquadsContext), \
 .init  = name_##_init,   \
+.activate  = activate,   \
 .uninit= uninit, \
 .query_formats = query_formats,  \
 .inputs= inputs, \
-- 
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/7] avfilter: add ff_inlink_peek_samples and ff_inlink_skip samples

2020-06-11 Thread Paul B Mahol
Signed-off-by: Paul B Mahol 
---
 libavfilter/avfilter.c | 61 +-
 libavfilter/filters.h  | 17 
 2 files changed, 72 insertions(+), 6 deletions(-)

diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c
index dd8074e462..b1db92de4b 100644
--- a/libavfilter/avfilter.c
+++ b/libavfilter/avfilter.c
@@ -1147,6 +1147,7 @@ static int samples_ready(AVFilterLink *link, unsigned min)
 }
 
 static int take_samples(AVFilterLink *link, unsigned min, unsigned max,
+unsigned peek_samples,
 AVFrame **rframe)
 {
 AVFrame *frame0, *frame, *buf;
@@ -1158,7 +1159,10 @@ static int take_samples(AVFilterLink *link, unsigned 
min, unsigned max,
 av_assert1(samples_ready(link, link->min_samples));
 frame0 = frame = ff_framequeue_peek(&link->fifo, 0);
 if (!link->fifo.samples_skipped && frame->nb_samples >= min && 
frame->nb_samples <= max) {
-*rframe = ff_framequeue_take(&link->fifo);
+if (peek_samples)
+*rframe = av_frame_clone(frame);
+else
+*rframe = ff_framequeue_take(&link->fifo);
 return 0;
 }
 nb_frames = 0;
@@ -1188,18 +1192,20 @@ static int take_samples(AVFilterLink *link, unsigned 
min, unsigned max,
 
 p = 0;
 for (i = 0; i < nb_frames; i++) {
-frame = ff_framequeue_take(&link->fifo);
+frame = peek_samples ? ff_framequeue_peek(&link->fifo, i) : 
ff_framequeue_take(&link->fifo);
 av_samples_copy(buf->extended_data, frame->extended_data, p, 0,
 frame->nb_samples, link->channels, link->format);
 p += frame->nb_samples;
-av_frame_free(&frame);
+if (!peek_samples)
+av_frame_free(&frame);
 }
 if (p < nb_samples) {
 unsigned n = nb_samples - p;
-frame = ff_framequeue_peek(&link->fifo, 0);
+frame = ff_framequeue_peek(&link->fifo, peek_samples ? i : 0);
 av_samples_copy(buf->extended_data, frame->extended_data, p, 0, n,
 link->channels, link->format);
-ff_framequeue_skip_samples(&link->fifo, n, link->time_base);
+if (!peek_samples)
+ff_framequeue_skip_samples(&link->fifo, n, link->time_base);
 }
 
 *rframe = buf;
@@ -1520,7 +1526,7 @@ int ff_inlink_consume_samples(AVFilterLink *link, 
unsigned min, unsigned max,
 return 0;
 if (link->status_in)
 min = FFMIN(min, ff_framequeue_queued_samples(&link->fifo));
-ret = take_samples(link, min, max, &frame);
+ret = take_samples(link, min, max, 0, &frame);
 if (ret < 0)
 return ret;
 consume_update(link, frame);
@@ -1528,6 +1534,49 @@ int ff_inlink_consume_samples(AVFilterLink *link, 
unsigned min, unsigned max,
 return 1;
 }
 
+int ff_inlink_peek_samples(AVFilterLink *link, unsigned nb_samples,
+   AVFrame **rframe)
+{
+AVFrame *frame;
+int ret;
+
+av_assert1(nb_samples);
+*rframe = NULL;
+if (!ff_inlink_check_available_samples(link, nb_samples))
+return 0;
+if (link->status_in)
+nb_samples = FFMIN(nb_samples, 
ff_framequeue_queued_samples(&link->fifo));
+ret = take_samples(link, nb_samples, nb_samples, 1, &frame);
+if (ret < 0)
+return ret;
+*rframe = frame;
+return !!frame;
+}
+
+void ff_inlink_skip_samples(AVFilterLink *link, unsigned skip_samples)
+{
+skip_samples = FFMIN(skip_samples, 
ff_framequeue_queued_samples(&link->fifo));
+
+while (skip_samples > 0) {
+AVFrame *frame = ff_inlink_peek_frame(link, 0);
+if (skip_samples >= frame->nb_samples) {
+frame = ff_framequeue_take(&link->fifo);
+skip_samples -= frame->nb_samples;
+av_frame_free(&frame);
+} else {
+break;
+}
+}
+
+if (skip_samples)
+ff_framequeue_skip_samples(&link->fifo, skip_samples, link->time_base);
+
+if (ff_inlink_queued_frames(link)) {
+AVFrame *frame = ff_inlink_peek_frame(link, 0);
+consume_update(link, frame);
+}
+}
+
 AVFrame *ff_inlink_peek_frame(AVFilterLink *link, size_t idx)
 {
 return ff_framequeue_peek(&link->fifo, idx);
diff --git a/libavfilter/filters.h b/libavfilter/filters.h
index 1157755403..7dc0b35981 100644
--- a/libavfilter/filters.h
+++ b/libavfilter/filters.h
@@ -115,6 +115,23 @@ int ff_inlink_consume_frame(AVFilterLink *link, AVFrame 
**rframe);
 int ff_inlink_consume_samples(AVFilterLink *link, unsigned min, unsigned max,
 AVFrame **rframe);
 
+/**
+ * Peek samples from the link's FIFO.
+ *
+ * @return  >0 if a samples are available,
+ *  0 and set rframe to NULL if no samples are available,
+ *  or AVERROR code
+ */
+int ff_inlink_peek_samples(AVFilterLink *link, unsigned nb_samples,
+   AVFrame **rframe);
+
+/**
+ * Skip samples from the link's FIFO.
+ *
+ * @note  May trigger process_command

[FFmpeg-devel] [PATCH 4/7] avfilter/af_biquads: add different transform types

2020-06-11 Thread Paul B Mahol
Signed-off-by: Paul B Mahol 
---
 libavfilter/af_biquads.c | 351 +--
 1 file changed, 336 insertions(+), 15 deletions(-)

diff --git a/libavfilter/af_biquads.c b/libavfilter/af_biquads.c
index 5e2d74f8f9..f3ef3660cc 100644
--- a/libavfilter/af_biquads.c
+++ b/libavfilter/af_biquads.c
@@ -94,6 +94,13 @@ enum WidthType {
 NB_WTYPE,
 };
 
+enum TransformType {
+DI,
+DII,
+TDII,
+NB_TTYPE,
+};
+
 typedef struct ChanCache {
 double i1, i2;
 double o1, o2;
@@ -110,6 +117,7 @@ typedef struct BiquadsContext {
 int poles;
 int csg;
 int reverse;
+int transform_type;
 
 double gain;
 double frequency;
@@ -363,6 +371,216 @@ BIQUAD_FILTER_REVERSE(s32, int32_t, INT32_MIN, INT32_MAX, 
1)
 BIQUAD_FILTER_REVERSE(flt, float,   -1., 1., 0)
 BIQUAD_FILTER_REVERSE(dbl, double,  -1., 1., 0)
 
+#define BIQUAD_DII_FILTER(name, type, min, max, need_clipping)\
+static void biquad_dii_## name (BiquadsContext *s,\
+const void *input, void *output, int len, \
+double *z1, double *z2,   \
+double *unused1, double *unused2, \
+double b0, double b1, double b2,  \
+double a1, double a2, int *clippings, \
+int disabled) \
+{ \
+const type *ibuf = input; \
+type *obuf = output;  \
+double w1 = *z1;  \
+double w2 = *z2;  \
+double wet = s->mix;  \
+double dry = 1. - wet;\
+double in, out, w0;   \
+  \
+a1 = -a1; \
+a2 = -a2; \
+  \
+for (int i = 0; i < len; i++) {   \
+in = ibuf[i]; \
+w0 = in + a1 * w1 + a2 * w2;  \
+out = b0 * w0 + b1 * w1 + b2 * w2;\
+w2 = w1;  \
+w1 = w0;  \
+out = out * wet + in * dry;   \
+if (disabled) {   \
+obuf[i] = in; \
+} else if (need_clipping && out < min) {  \
+(*clippings)++;   \
+obuf[i] = min;\
+} else if (need_clipping && out > max) {  \
+(*clippings)++;   \
+obuf[i] = max;\
+} else {  \
+obuf[i] = out;\
+} \
+} \
+*z1 = w1; \
+*z2 = w2; \
+}
+
+BIQUAD_DII_FILTER(s16, int16_t, INT16_MIN, INT16_MAX, 1)
+BIQUAD_DII_FILTER(s32, int32_t, INT32_MIN, INT32_MAX, 1)
+BIQUAD_DII_FILTER(flt, float,   -1., 1., 0)
+BIQUAD_DII_FILTER(dbl, double,  -1., 1., 0)
+
+#define BIQUAD_REVERSE_DII_FILTER(name, type, min, max, need_clipping)\
+static void biquad_reverse_dii_## name (BiquadsContext *s,\
+const void *input, void *output, void *dst,   \
+int len,  \
+double *z1, double *z2,   \
+double *unused1, double *unused2, \
+double b0, double b1, double b2,  \
+  

Re: [FFmpeg-devel] [PATCH v12 3/4] avfilter/vf_showinfo: display H.26[45] user data unregistered sei message

2020-06-11 Thread Andreas Rheinhardt
lance.lmw...@gmail.com:
> From: Limin Wang 
> 
> Signed-off-by: Limin Wang 
> ---
>  libavfilter/vf_showinfo.c | 37 +
>  1 file changed, 37 insertions(+)
> 
> diff --git a/libavfilter/vf_showinfo.c b/libavfilter/vf_showinfo.c
> index 5d4aee4..3658234 100644
> --- a/libavfilter/vf_showinfo.c
> +++ b/libavfilter/vf_showinfo.c
> @@ -37,6 +37,7 @@
>  #include "libavutil/timecode.h"
>  #include "libavutil/mastering_display_metadata.h"
>  #include "libavutil/video_enc_params.h"
> +#include "libavutil/avstring.h"
>  
>  #include "avfilter.h"
>  #include "internal.h"
> @@ -190,6 +191,39 @@ static void dump_video_enc_params(AVFilterContext *ctx, 
> AVFrameSideData *sd)
>  av_log(ctx, AV_LOG_INFO, "%u blocks; ", par->nb_blocks);
>  }
>  
> +static int string_is_print(const uint8_t *str)
> +{
> +while (*str && *str >= 0x20 && *str <= 0x7e ) str++;
> +return !*str;
> +}
> +
> +static void dump_sei_unregistered_metadata(AVFilterContext *ctx, 
> AVFrameSideData *sd)
> +{
> +const int uuid_size = 16;
> +uint8_t *user_data = sd->data;
> +
> +if (sd->size < uuid_size) {
> +av_log(ctx, AV_LOG_ERROR, "invalid data(%d < UUID(%d-bytes))", 
> sd->size, uuid_size);
> +return;
> +}
> +
> +av_log(ctx, AV_LOG_INFO, "User Data Unregistered:\n");
> +av_log(ctx, AV_LOG_INFO, "UUID=");
> +for (int i = 0; i < uuid_size; i++) {
> +av_log(ctx, AV_LOG_INFO, "%02x", user_data[i]);
> +if (i == 3 || i == 5 || i == 7 || i == 9)
> +av_log(ctx, AV_LOG_INFO, "-");
> +}
> +av_log(ctx, AV_LOG_INFO, "\n");
> +
> +user_data += uuid_size;
> +/* Only print the user data details if it's string or partial string*/
> +if (string_is_print(user_data)) {
> +av_log(ctx, AV_LOG_INFO, "User Data=");
> +av_log(ctx, AV_LOG_INFO, "%s", user_data);
> +}
> +}
> +
>  static void dump_color_property(AVFilterContext *ctx, AVFrame *frame)
>  {
>  const char *color_range_str = 
> av_color_range_name(frame->color_range);
> @@ -375,6 +409,9 @@ static int filter_frame(AVFilterLink *inlink, AVFrame 
> *frame)
>  case AV_FRAME_DATA_VIDEO_ENC_PARAMS:
>  dump_video_enc_params(ctx, sd);
>  break;
> +case AV_FRAME_DATA_SEI_UNREGISTERED:
> +dump_sei_unregistered_metadata(ctx, sd);
> +break;
>  default:
>  av_log(ctx, AV_LOG_WARNING, "unknown side data type %d (%d 
> bytes)",
> sd->type, sd->size);
> 
This new version has the same issues as the old one plus one more: It
adds a new header that is now unnecessary.

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

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

[FFmpeg-devel] [PATCH 6/7] avfilter/avf_showspectrumpic: switch to internal queue

2020-06-11 Thread Paul B Mahol
Fixes filtering audio with more than 1.5h length.

Signed-off-by: Paul B Mahol 
---
 libavfilter/avf_showspectrum.c | 119 -
 1 file changed, 59 insertions(+), 60 deletions(-)

diff --git a/libavfilter/avf_showspectrum.c b/libavfilter/avf_showspectrum.c
index e99f377fb0..ead57aadac 100644
--- a/libavfilter/avf_showspectrum.c
+++ b/libavfilter/avf_showspectrum.c
@@ -1610,91 +1610,90 @@ static const AVOption showspectrumpic_options[] = {
 
 AVFILTER_DEFINE_CLASS(showspectrumpic);
 
-static int showspectrumpic_request_frame(AVFilterLink *outlink)
+static int showspectrumpic_request_frame(AVFilterLink *outlink, int64_t 
samples)
 {
 AVFilterContext *ctx = outlink->src;
 ShowSpectrumContext *s = ctx->priv;
 AVFilterLink *inlink = ctx->inputs[0];
-int ret, samples;
+int consumed = 0;
+int x = 0, sz = s->orientation == VERTICAL ? s->w : s->h;
+int ret, ch, spf, spb;
+AVFrame *fin = NULL;
 
-ret = ff_request_frame(inlink);
-samples = av_audio_fifo_size(s->fifo);
-if (ret == AVERROR_EOF && s->outpicref && samples > 0) {
-int consumed = 0;
-int x = 0, sz = s->orientation == VERTICAL ? s->w : s->h;
-int ch, spf, spb;
-AVFrame *fin;
+spf = s->win_size * (samples / ((s->win_size * sz) * ceil(samples / 
(float)(s->win_size * sz;
+spf = FFMAX(1, spf);
 
-spf = s->win_size * (samples / ((s->win_size * sz) * ceil(samples / 
(float)(s->win_size * sz;
-spf = FFMAX(1, spf);
+spb = (samples / (spf * sz)) * spf;
 
-spb = (samples / (spf * sz)) * spf;
-
-fin = ff_get_audio_buffer(inlink, s->win_size);
-if (!fin)
-return AVERROR(ENOMEM);
-
-while (x < sz) {
-ret = av_audio_fifo_peek(s->fifo, (void **)fin->extended_data, 
s->win_size);
-if (ret < 0) {
-av_frame_free(&fin);
-return ret;
-}
-
-av_audio_fifo_drain(s->fifo, spf);
-
-if (ret < s->win_size) {
-for (ch = 0; ch < s->nb_display_channels; ch++) {
-memset(fin->extended_data[ch] + ret * sizeof(float), 0,
-   (s->win_size - ret) * sizeof(float));
-}
-}
-
-ctx->internal->execute(ctx, run_channel_fft, fin, NULL, 
s->nb_display_channels);
-acalc_magnitudes(s);
-
-consumed += spf;
-if (consumed >= spb) {
-int h = s->orientation == VERTICAL ? s->h : s->w;
+while (x < sz) {
+ret = ff_inlink_peek_samples(inlink, s->win_size, &fin);
+if (ret < 0)
+return ret;
+if (ret == 0)
+break;
 
-scale_magnitudes(s, 1.f / (consumed / spf));
-plot_spectrum_column(inlink, fin);
-consumed = 0;
-x++;
-for (ch = 0; ch < s->nb_display_channels; ch++)
-memset(s->magnitudes[ch], 0, h * sizeof(float));
-}
+ctx->internal->execute(ctx, run_channel_fft, fin, NULL, 
s->nb_display_channels);
+acalc_magnitudes(s);
+
+consumed += spf;
+if (consumed >= spb) {
+int h = s->orientation == VERTICAL ? s->h : s->w;
+
+scale_magnitudes(s, 1.f / (consumed / spf));
+plot_spectrum_column(inlink, fin);
+consumed = 0;
+x++;
+for (ch = 0; ch < s->nb_display_channels; ch++)
+memset(s->magnitudes[ch], 0, h * sizeof(float));
 }
-
 av_frame_free(&fin);
-s->outpicref->pts = 0;
+ff_inlink_skip_samples(inlink, spf);
+}
 
-if (s->legend)
-draw_legend(ctx, samples);
+s->outpicref->pts = 0;
 
-ret = ff_filter_frame(outlink, s->outpicref);
-s->outpicref = NULL;
-}
+if (s->legend)
+draw_legend(ctx, samples);
+
+ret = ff_filter_frame(outlink, s->outpicref);
+s->outpicref = NULL;
 
 return ret;
 }
 
-static int showspectrumpic_filter_frame(AVFilterLink *inlink, AVFrame 
*insamples)
+static int showspectrumpic_activate(AVFilterContext *ctx)
 {
-AVFilterContext *ctx = inlink->dst;
+AVFilterLink *inlink = ctx->inputs[0];
+AVFilterLink *outlink = ctx->outputs[0];
 ShowSpectrumContext *s = ctx->priv;
 int ret;
 
-ret = av_audio_fifo_write(s->fifo, (void **)insamples->extended_data, 
insamples->nb_samples);
-av_frame_free(&insamples);
-return ret;
+FF_FILTER_FORWARD_STATUS_BACK(outlink, inlink);
+
+if (ff_outlink_get_status(inlink) == AVERROR_EOF &&
+s->outpicref) {
+int64_t samples = 0;
+
+for (int i = 0; i < ff_inlink_queued_frames(inlink); i++) {
+AVFrame *frame = ff_inlink_peek_frame(inlink, i);
+
+samples += frame->nb_samples;
+}
+
+ret = showspectrumpic_request_frame(outlink, samples);
+ff_outlink_set_status(outlink, AVERROR_E

[FFmpeg-devel] [PATCH 5/7] avfilter/af_biquads: refactor code

2020-06-11 Thread Paul B Mahol
Signed-off-by: Paul B Mahol 
---
 libavfilter/af_biquads.c | 279 ++-
 1 file changed, 68 insertions(+), 211 deletions(-)

diff --git a/libavfilter/af_biquads.c b/libavfilter/af_biquads.c
index f3ef3660cc..c998f3e982 100644
--- a/libavfilter/af_biquads.c
+++ b/libavfilter/af_biquads.c
@@ -138,13 +138,14 @@ typedef struct BiquadsContext {
 int hop_size;
 double *window_func_lut;
 
-void (*filter)(struct BiquadsContext *s, const void *ibuf, void *obuf, int 
len,
+void (*filter)(struct BiquadsContext *s, const void *ibuf, void *obuf, 
void *dst, int len,
double *i1, double *i2, double *o1, double *o2,
double b0, double b1, double b2, double a1, double a2, int 
*clippings,
int disabled);
 void (*reverse_filter)(struct BiquadsContext *s, const void *ibuf, void 
*obuf, void *dst,
int len, double *i1, double *i2, double *o1, double *o2,
-   double b0, double b1, double b2, double a1, double a2, int 
*clippings);
+   double b0, double b1, double b2, double a1, double a2, int 
*clippings,
+   int disabled);
 } BiquadsContext;
 
 static av_cold int init(AVFilterContext *ctx)
@@ -195,97 +196,15 @@ static int query_formats(AVFilterContext *ctx)
 return ff_set_common_samplerates(ctx, formats);
 }
 
-#define BIQUAD_FILTER(name, type, min, max, need_clipping)\
+#define BIQUAD_FILTER(name, type, min, max, need_clipping, reverse)   \
 static void biquad_## name (BiquadsContext *s,\
-const void *input, void *output, int len, \
-double *in1, double *in2, \
-double *out1, double *out2,   \
-double b0, double b1, double b2,  \
-double a1, double a2, int *clippings, \
-int disabled) \
-{ \
-const type *ibuf = input; \
-type *obuf = output;  \
-double i1 = *in1; \
-double i2 = *in2; \
-double o1 = *out1;\
-double o2 = *out2;\
-double wet = s->mix;  \
-double dry = 1. - wet;\
-double out;   \
-int i;\
-a1 = -a1; \
-a2 = -a2; \
-  \
-for (i = 0; i+1 < len; i++) { \
-o2 = i2 * b2 + i1 * b1 + ibuf[i] * b0 + o2 * a2 + o1 * a1;\
-i2 = ibuf[i]; \
-out = o2 * wet + i2 * dry;\
-if (disabled) {   \
-obuf[i] = i2; \
-} else if (need_clipping && out < min) {  \
-(*clippings)++;   \
-obuf[i] = min;\
-} else if (need_clipping && out > max) {  \
-(*clippings)++;   \
-obuf[i] = max;\
-} else {  \
-obuf[i] = out;\
-} \
-i++;  \
-o1 = i1 * b2 + i2 * b1 + ibuf[i] * b0 + o1 * a2 + o2 * a1;\
-i1 = ibuf[i]; \
-out = o1 * wet + i1 * dry;\
-if (disabled) {   \
-obuf[i] = i1; \
-} else if (need_clipping && out < 

[FFmpeg-devel] [PATCH 3/7] avfilter/af_biquads: add reverse filtering support

2020-06-11 Thread Paul B Mahol
Add it to all filters, except allpass as it does not make sense
to use it in such case.

Signed-off-by: Paul B Mahol 
---
 doc/filters.texi |  72 +++
 libavfilter/af_biquads.c | 271 +--
 2 files changed, 333 insertions(+), 10 deletions(-)

diff --git a/doc/filters.texi b/doc/filters.texi
index 84567dec16..c2960e33c7 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -2693,6 +2693,15 @@ Specify which channels to filter, by default all 
available are filtered.
 @item normalize, n
 Normalize biquad coefficients, by default is disabled.
 Enabling it will normalize magnitude response at DC to 0dB.
+
+@item reverse, r
+Enable reverse filter processing. Makes filter's phase response
+linear at cost of introduced latency.
+
+@item size, s
+Set size of window for reverse filter processing.
+Allowed range is from 256 to 32768.
+Default value is 2048.
 @end table
 
 @subsection Commands
@@ -2756,6 +2765,15 @@ Specify which channels to filter, by default all 
available are filtered.
 @item normalize, n
 Normalize biquad coefficients, by default is disabled.
 Enabling it will normalize magnitude response at DC to 0dB.
+
+@item reverse, r
+Enable reverse filter processing. Makes filter's phase response
+linear at cost of introduced latency.
+
+@item size, s
+Set size of window for reverse filter processing.
+Allowed range is from 256 to 32768.
+Default value is 2048.
 @end table
 
 @subsection Commands
@@ -2826,6 +2844,15 @@ Specify which channels to filter, by default all 
available are filtered.
 @item normalize, n
 Normalize biquad coefficients, by default is disabled.
 Enabling it will normalize magnitude response at DC to 0dB.
+
+@item reverse, r
+Enable reverse filter processing. Makes filter's phase response
+linear at cost of introduced latency.
+
+@item size, s
+Set size of window for reverse filter processing.
+Allowed range is from 256 to 32768.
+Default value is 2048.
 @end table
 
 @subsection Commands
@@ -2884,6 +2911,15 @@ Specify which channels to filter, by default all 
available are filtered.
 @item normalize, n
 Normalize biquad coefficients, by default is disabled.
 Enabling it will normalize magnitude response at DC to 0dB.
+
+@item reverse, r
+Enable reverse filter processing. Makes filter's phase response
+linear at cost of introduced latency.
+
+@item size, s
+Set size of window for reverse filter processing.
+Allowed range is from 256 to 32768.
+Default value is 2048.
 @end table
 
 @section bs2b
@@ -3607,6 +3643,15 @@ Specify which channels to filter, by default all 
available are filtered.
 @item normalize, n
 Normalize biquad coefficients, by default is disabled.
 Enabling it will normalize magnitude response at DC to 0dB.
+
+@item reverse, r
+Enable reverse filter processing. Makes filter's phase response
+linear at cost of introduced latency.
+
+@item size, s
+Set size of window for reverse filter processing.
+Allowed range is from 256 to 32768.
+Default value is 2048.
 @end table
 
 @subsection Examples
@@ -4084,6 +4129,15 @@ Specify which channels to filter, by default all 
available are filtered.
 @item normalize, n
 Normalize biquad coefficients, by default is disabled.
 Enabling it will normalize magnitude response at DC to 0dB.
+
+@item reverse, r
+Enable reverse filter processing. Makes filter's phase response
+linear at cost of introduced latency.
+
+@item size, s
+Set size of window for reverse filter processing.
+Allowed range is from 256 to 32768.
+Default value is 2048.
 @end table
 
 @subsection Commands
@@ -4407,6 +4461,15 @@ Specify which channels to filter, by default all 
available are filtered.
 @item normalize, n
 Normalize biquad coefficients, by default is disabled.
 Enabling it will normalize magnitude response at DC to 0dB.
+
+@item reverse, r
+Enable reverse filter processing. Makes filter's phase response
+linear at cost of introduced latency.
+
+@item size, s
+Set size of window for reverse filter processing.
+Allowed range is from 256 to 32768.
+Default value is 2048.
 @end table
 
 @subsection Examples
@@ -5527,6 +5590,15 @@ Specify which channels to filter, by default all 
available are filtered.
 @item normalize, n
 Normalize biquad coefficients, by default is disabled.
 Enabling it will normalize magnitude response at DC to 0dB.
+
+@item reverse, r
+Enable reverse filter processing. Makes filter's phase response
+linear at cost of introduced latency.
+
+@item size, s
+Set size of window for reverse filter processing.
+Allowed range is from 256 to 32768.
+Default value is 2048.
 @end table
 
 @subsection Commands
diff --git a/libavfilter/af_biquads.c b/libavfilter/af_biquads.c
index ef28db741a..5e2d74f8f9 100644
--- a/libavfilter/af_biquads.c
+++ b/libavfilter/af_biquads.c
@@ -97,6 +97,8 @@ enum WidthType {
 typedef struct ChanCache {
 double i1, i2;
 double o1, o2;
+double ri1, ri2;
+double ro1, ro2;
 int clippings;
 } ChanCache;
 
@@ -107,6 +109,7 @@ typedef struct BiquadsContext {
 

[FFmpeg-devel] [PATCH 3/3] avcodec/cbs_av1: abort when the written inferred value is not the expected one

2020-06-11 Thread James Almer
If this happens, it's a sign of parsing issues earlier in the process, or
misuse by the calling module.

Prevents creating invalid bitstreams.

Signed-off-by: James Almer 
---
 libavcodec/cbs_av1.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libavcodec/cbs_av1.c b/libavcodec/cbs_av1.c
index fc228086c2..456bd9b1d5 100644
--- a/libavcodec/cbs_av1.c
+++ b/libavcodec/cbs_av1.c
@@ -711,10 +711,11 @@ static size_t 
cbs_av1_get_payload_bytes_left(GetBitContext *gbc)
 
 #define infer(name, value) do { \
 if (current->name != (value)) { \
-av_log(ctx->log_ctx, AV_LOG_WARNING, "Warning: " \
+av_log(ctx->log_ctx, AV_LOG_ERROR, \
"%s does not match inferred value: " \
"%"PRId64", but should be %"PRId64".\n", \
#name, (int64_t)current->name, (int64_t)(value)); \
+return AVERROR_BUG; \
 } \
 } while (0)
 
-- 
2.26.2

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

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

[FFmpeg-devel] [PATCH 2/3] avcodec/cbs_h2645: abort when the written inferred value is not the expected one

2020-06-11 Thread James Almer
If this happens, it's a sign of parsing issues earlier in the process, or
misuse by the calling module.

Prevents creating invalid bitstreams.

Signed-off-by: James Almer 
---
 libavcodec/cbs_h2645.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libavcodec/cbs_h2645.c b/libavcodec/cbs_h2645.c
index 69ed890c63..f239d52271 100644
--- a/libavcodec/cbs_h2645.c
+++ b/libavcodec/cbs_h2645.c
@@ -408,10 +408,11 @@ static int cbs_h2645_read_more_rbsp_data(GetBitContext 
*gbc)
 
 #define infer(name, value) do { \
 if (current->name != (value)) { \
-av_log(ctx->log_ctx, AV_LOG_WARNING, "Warning: " \
+av_log(ctx->log_ctx, AV_LOG_ERROR, \
"%s does not match inferred value: " \
"%"PRId64", but should be %"PRId64".\n", \
#name, (int64_t)current->name, (int64_t)(value)); \
+return AVERROR_BUG; \
 } \
 } while (0)
 
-- 
2.26.2

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

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

[FFmpeg-devel] [PATCH 7/7] avfilter: add afwtdn filter

2020-06-11 Thread Paul B Mahol
Signed-off-by: Paul B Mahol 
---
 doc/filters.texi |   60 ++
 libavfilter/Makefile |1 +
 libavfilter/af_afwtdn.c  | 1345 ++
 libavfilter/allfilters.c |1 +
 4 files changed, 1407 insertions(+)
 create mode 100644 libavfilter/af_afwtdn.c

diff --git a/doc/filters.texi b/doc/filters.texi
index c2960e33c7..d89ebc5122 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -1314,6 +1314,66 @@ Force the output to either unsigned 8-bit or signed 
16-bit stereo
 aformat=sample_fmts=u8|s16:channel_layouts=stereo
 @end example
 
+@section afwtdn
+Reduce broadband noise from input samples using Wavelets.
+
+A description of the accepted options follows.
+
+@table @option
+@item sigma
+Set the noise sigma, allowed range is from 0 to 1.
+Default value is 0.
+This option controls strength of denoising applied to input samples.
+Most useful way to set this option is via decibels, eg. -45dB.
+
+@item levels
+Set the number of wavelet levels of decomposition.
+Allowed range is from 1 to 12.
+Default value is 10.
+Setting this too low make denoising performance very poor.
+
+@item wavet
+Set wavelet type for decomposition of input frame.
+They are sorted by number of coefficients, from lowest to highest.
+More coefficients means worse filtering speed, but overall better quality.
+Available wavelets are:
+
+@table @samp
+@item sym2
+@item sym4
+@item rbior68
+@item deb10
+@item sym10
+@item coif5
+@item bl3
+@end table
+
+@item percent
+Set percent of full denoising. Allowed range is from 0 to 100 percent.
+Default value is 85 percent or partial denoising.
+
+@item profile
+If enabled, first input frame will be used as noise profile.
+If first frame samples contain non-noise performance will be very poor.
+
+@item adaptive
+If enabled, input frames are analyzed for presence of noise.
+If noise is detected with high possibility then input frame profile will be
+used for processing following frames, until new noise frame is detected.
+
+@item samples
+Set size of single frame in number of samples. Allowed range is from 512 to
+65536. Default frame size is 8192 samples.
+
+@item softness
+Set softness applied inside thresholding function. Allowed range is from 0 to
+10. Default softness is 1.
+@end table
+
+@subsection Commands
+
+This filter supports subset of its options as @ref{commands}.
+
 @section agate
 
 A gate is mainly used to reduce lower parts of a signal. This kind of signal
diff --git a/libavfilter/Makefile b/libavfilter/Makefile
index 5123540653..191826a622 100644
--- a/libavfilter/Makefile
+++ b/libavfilter/Makefile
@@ -50,6 +50,7 @@ OBJS-$(CONFIG_AFFTDN_FILTER) += af_afftdn.o
 OBJS-$(CONFIG_AFFTFILT_FILTER)   += af_afftfilt.o
 OBJS-$(CONFIG_AFIR_FILTER)   += af_afir.o
 OBJS-$(CONFIG_AFORMAT_FILTER)+= af_aformat.o
+OBJS-$(CONFIG_AFWTDN_FILTER) += af_afwtdn.o
 OBJS-$(CONFIG_AGATE_FILTER)  += af_agate.o
 OBJS-$(CONFIG_AIIR_FILTER)   += af_aiir.o
 OBJS-$(CONFIG_AINTEGRAL_FILTER)  += af_aderivative.o
diff --git a/libavfilter/af_afwtdn.c b/libavfilter/af_afwtdn.c
new file mode 100644
index 00..d2793d4d92
--- /dev/null
+++ b/libavfilter/af_afwtdn.c
@@ -0,0 +1,1345 @@
+/*
+ * 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 "libavutil/avstring.h"
+#include "libavutil/opt.h"
+#include "avfilter.h"
+#include "audio.h"
+#include "filters.h"
+#include "formats.h"
+
+enum WaveletTypes {
+SYM2,
+SYM4,
+RBIOR68,
+DEB10,
+SYM10,
+COIF5,
+BL3,
+NB_WAVELET_TYPES,
+};
+
+static const double bl3_lp[42] = {
+0.000146098, -0.000232304, -0.000285414, 0.000462093, 0.000559952,
+-0.000927187, -0.001103748, 0.00188212, 0.002186714, -0.003882426,
+-0.00435384, 0.008201477, 0.008685294, -0.017982291, -0.017176331,
+0.042068328, 0.032080869, -0.110036987, -0.050201753, 0.433923147,
+0.766130398, 0.433923147, -0.050201753, -0.110036987, 0.032080869,
+0.042068328, -0.017176331, -0.017982291, 0.008685294, 0.008201477,
+-0.00435384, -0.003882426, 0.002186714, 0.00188212, -0.001103748,
+-0.000927

Re: [FFmpeg-devel] [PATCH v10 1/4] avutil: add AV_FRAME_DATA_SEI_UNREGISTERED side data type

2020-06-11 Thread lance . lmwang
On Thu, Jun 11, 2020 at 12:51:44PM -0300, James Almer wrote:
> On 6/11/2020 12:39 PM, Andreas Rheinhardt wrote:
> > lance.lmw...@gmail.com:
> >> On Wed, Jun 10, 2020 at 07:43:11AM +0800, lance.lmw...@gmail.com wrote:
> >>> From: Limin Wang 
> >>>
> >>> Signed-off-by: Limin Wang 
> >>> ---
> >>> rebase with master only, I'll apply the patchset in two days if no 
> >>> objection.
> >>>
> >>>  doc/APIchanges  | 3 +++
> >>>  libavutil/frame.c   | 1 +
> >>>  libavutil/frame.h   | 8 
> >>>  libavutil/version.h | 2 +-
> >>>  4 files changed, 13 insertions(+), 1 deletion(-)
> >>>
> >>> diff --git a/doc/APIchanges b/doc/APIchanges
> >>> index 70579df..08cdbda 100644
> >>> --- a/doc/APIchanges
> >>> +++ b/doc/APIchanges
> >>> @@ -15,6 +15,9 @@ libavutil: 2017-10-21
> >>>  
> >>>  API changes, most recent first:
> >>>  
> >>> +2020-06-xx - xx - lavu 56.53.100 - frame.h
> >>> +  Add AV_FRAME_DATA_SEI_UNREGISTERED.
> >>> +
> >>>  2020-06-05 - ec39c2276a - lavu 56.50.100 - buffer.h
> >>>Passing NULL as alloc argument to av_buffer_pool_init2() is now 
> >>> allowed.
> >>>  
> >>> diff --git a/libavutil/frame.c b/libavutil/frame.c
> >>> index 2e952ed..9884eae 100644
> >>> --- a/libavutil/frame.c
> >>> +++ b/libavutil/frame.c
> >>> @@ -851,6 +851,7 @@ const char *av_frame_side_data_name(enum 
> >>> AVFrameSideDataType type)
> >>>  case AV_FRAME_DATA_DYNAMIC_HDR_PLUS: return "HDR Dynamic Metadata 
> >>> SMPTE2094-40 (HDR10+)";
> >>>  case AV_FRAME_DATA_REGIONS_OF_INTEREST: return "Regions Of Interest";
> >>>  case AV_FRAME_DATA_VIDEO_ENC_PARAMS:return "Video 
> >>> encoding parameters";
> >>> +case AV_FRAME_DATA_SEI_UNREGISTERED:return "H.26[45] 
> >>> User Data Unregistered SEI message";
> >>>  }
> >>>  return NULL;
> >>>  }
> >>> diff --git a/libavutil/frame.h b/libavutil/frame.h
> >>> index fc67db0..3fb8c56 100644
> >>> --- a/libavutil/frame.h
> >>> +++ b/libavutil/frame.h
> >>> @@ -184,6 +184,14 @@ enum AVFrameSideDataType {
> >>>   * Encoding parameters for a video frame, as described by 
> >>> AVVideoEncParams.
> >>>   */
> >>>  AV_FRAME_DATA_VIDEO_ENC_PARAMS,
> >>> +
> >>> +/**
> >>> + * User data unregistered metadata associated with a video frame.
> >>> + * This is the H.26[45] UDU SEI message, and shouldn't be used for 
> >>> any other purpose
> >>> + * The data is stored as uint8_t in AVFrameSideData.data which is 16 
> >>> bytes of
> >>> + * uuid_iso_iec_11578 followed by AVFrameSideData.size - 16 bytes of 
> >>> user_data_payload_byte.
> >>> + */
> >>> +AV_FRAME_DATA_SEI_UNREGISTERED,
> >>>  };
> >>>  
> >>>  enum AVActiveFormatDescription {
> >>> diff --git a/libavutil/version.h b/libavutil/version.h
> >>> index 652e1e9..e75e625 100644
> >>> --- a/libavutil/version.h
> >>> +++ b/libavutil/version.h
> >>> @@ -79,7 +79,7 @@
> >>>   */
> >>>  
> >>>  #define LIBAVUTIL_VERSION_MAJOR  56
> >>> -#define LIBAVUTIL_VERSION_MINOR  52
> >>> +#define LIBAVUTIL_VERSION_MINOR  53
> >>>  #define LIBAVUTIL_VERSION_MICRO 100
> >>
> >> will apply this patch to avoid conflict every time.
> >>
> > You should not have done so given that the other patches are not
> > finished yet and given that you yourself suggested zero-terminating the
> > buffer (which the pushed version does not demand).
> > 
> > And avoiding merge conflicts is a bad rationale for pushing early anyway
> 
> > (a better solution would be to only add the changes to APIchanges and
> > version.h directly before you push).
> 
> That is the correct solution, not just a better one.
> 
> If this design is not finished, it shouldn't have been pushed at all.
> Fortunately it was done after 4.3 was branched, so not much of an issue
> if changed as required in a timely manner, but please refrain from
> pushing API changes before they are accepted.

Thanks for the solution and comments, sorry I didn't think enough yet, good
lesson to learn.

> 
> > 
> >>
> >>>  
> >>>  #define LIBAVUTIL_VERSION_INT   AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
> >>> -- 
> >>> 1.8.3.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 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".

-- 
Thanks,
Limin Wang
___
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] [RFC PATCH] libavcodec/libopenjpeg: pix fmt selection change

2020-06-11 Thread Michael Bradshaw
On Thu, Jun 11, 2020 at 9:42 AM Gautam Ramakrishnan 
wrote:

> Got it. In that case we can safely ignore the patch to fix libopenjpeg.
> However, p1_03.j2k is one of the 2 files to have ppm marker. How could I
> validate a patch to add ppm marker? I need something to cross validate.
> Any suggestions for that?


Does the other file with a ppm marker have a sane pixel format? If not the
only the only way I can think of to test this is to hack ffmpeg to remap
the planes in libopenjpegdec.c (e.g., remap them to yuva format). You can
use that for initial validation but it'll have to be reverted when
committing/pushing.

Long-term I'm not sure how one would regression test this without having a
different file with a sane pixel format. I'm not sure how feasible it is to
hack p1_03.j2k to remove a plane while retaining the ppm marker or perhaps
hacking opj_compress to add a ppm marker to a new test file.
___
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 v11 3/4] avfilter/vf_showinfo: display H.26[45] user data unregistered sei message

2020-06-11 Thread lance . lmwang
On Thu, Jun 11, 2020 at 05:44:45PM +0200, Andreas Rheinhardt wrote:
> lance.lmw...@gmail.com:
> > On Wed, Jun 10, 2020 at 08:13:59PM +0200, Andreas Rheinhardt wrote:
> >> lance.lmw...@gmail.com:
> >>> From: Limin Wang 
> >>>
> >>> Signed-off-by: Limin Wang 
> >>> ---
> >>>  libavfilter/vf_showinfo.c | 37 +
> >>>  1 file changed, 37 insertions(+)
> >>>
> >>> diff --git a/libavfilter/vf_showinfo.c b/libavfilter/vf_showinfo.c
> >>> index 5d4aee4..2511da5 100644
> >>> --- a/libavfilter/vf_showinfo.c
> >>> +++ b/libavfilter/vf_showinfo.c
> >>> @@ -37,6 +37,7 @@
> >>>  #include "libavutil/timecode.h"
> >>>  #include "libavutil/mastering_display_metadata.h"
> >>>  #include "libavutil/video_enc_params.h"
> >>> +#include "libavutil/avstring.h"
> >>>  
> >>>  #include "avfilter.h"
> >>>  #include "internal.h"
> >>> @@ -190,6 +191,39 @@ static void dump_video_enc_params(AVFilterContext 
> >>> *ctx, AVFrameSideData *sd)
> >>>  av_log(ctx, AV_LOG_INFO, "%u blocks; ", par->nb_blocks);
> >>>  }
> >>>  
> >>> +static int string_is_print(const uint8_t *str)
> >>> +{
> >>> +while (av_isgraph(*str)) str++;
> >>> +return !*str;
> >>
> >> This is dangerous: The SEI message needn't be zero-terminated, so this
> >> may segfault. Furthermore, it is also wrong: If the user data payload
> >> happens to contain a binary zero preceded by printable ASCII characters,
> >> it will be considered a string, even if there are unprintable characters
> >> after the binary zero (which may really happen if the payload is
> >> actually binary).
> > 
> > Give below test example, if a binary zero preceded by "hello", the %s will 
> > print
> > out "hello" and ignore the other unprintable characters. I think it's 
> > expected.
> > We only dump the printable result if it is string or parial string.
> > 
> >  unsigned char test[10];
> > 
> >  test[0] = 'h';
> >  test[1] = 'e';
> >  test[2] = 'l';
> >  test[3] = 'l';
> >  test[4] = 'o';
> >  test[5] = 0;
> >  test[6] = 133;
> >  test[7] = 144;
> > 
> >  printf( "test: %s \n", test);
> > 
> > So I thbink it's safety after add one padding zero bytes for the user data
> > buffer.
> > 
> 
> And who says that what is before the first binary zero is actually a
> string and not some actually binary data that just happens to be in the
> printable ASCII range and will be gibberish when printed?

Sorry, it seems that I misunderstand your comments at first, I have change to 
check
whether *str is 0, please help to check whether my update patch solve your 
question.

> 
> >>
> >>> +}
> >>> +
> >>> +static void dump_sei_unregistered_metadata(AVFilterContext *ctx, 
> >>> AVFrameSideData *sd)
> >>> +{
> >>> +const int uuid_size = 16;
> >>> +uint8_t *user_data = sd->data;
> >>> +
> >>> +if (sd->size < uuid_size) {
> >>> +av_log(ctx, AV_LOG_ERROR, "invalid data(%d < UUID(%d-bytes))", 
> >>> sd->size, uuid_size);
> >>> +return;
> >>> +}
> >>> +
> >>> +av_log(ctx, AV_LOG_INFO, "User Data Unregistered:\n");
> >>> +av_log(ctx, AV_LOG_INFO, "UUID=");
> >>> +for (int i = 0; i < uuid_size; i++) {
> >>> +av_log(ctx, AV_LOG_INFO, "%02x", user_data[i]);
> >>> +if (i == 3 || i == 5 || i == 7 || i == 9)
> >>> +av_log(ctx, AV_LOG_INFO, "-");
> >>> +}
> >>> +av_log(ctx, AV_LOG_INFO, "\n");
> >>> +
> >>> +user_data += uuid_size;
> >>> +/* Only print the user data details if it's string */
> >>> +if (string_is_print(user_data)) {
> >>> +av_log(ctx, AV_LOG_INFO, "User Data=");
> >>> +av_log(ctx, AV_LOG_INFO, "%s", user_data);
> >>
> >> Given that the user_data needn't be zero-terminated, you must specify
> >> the precision (i.e. the number of bytes to write) here.
> >>
> >>> +}
> >>> +}
> >>> +
> >>>  static void dump_color_property(AVFilterContext *ctx, AVFrame *frame)
> >>>  {
> >>>  const char *color_range_str = 
> >>> av_color_range_name(frame->color_range);
> >>> @@ -375,6 +409,9 @@ static int filter_frame(AVFilterLink *inlink, AVFrame 
> >>> *frame)
> >>>  case AV_FRAME_DATA_VIDEO_ENC_PARAMS:
> >>>  dump_video_enc_params(ctx, sd);
> >>>  break;
> >>> +case AV_FRAME_DATA_SEI_UNREGISTERED:
> >>> +dump_sei_unregistered_metadata(ctx, sd);
> >>> +break;
> >>>  default:
> >>>  av_log(ctx, AV_LOG_WARNING, "unknown side data type %d (%d 
> >>> bytes)",
> >>> sd->type, sd->size);
> >>>
> >>
> >> ___
> >> 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-de

Re: [FFmpeg-devel] [PATCH 4/5] fftools/ffmpeg: flush and recreate encoder instance if resolution changes

2020-06-11 Thread Fu, Linjie
> From: Nicolas George 
> Sent: Wednesday, June 10, 2020 19:54
> To: FFmpeg development discussions and patches  de...@ffmpeg.org>
> Cc: Fu, Linjie 
> Subject: Re: [FFmpeg-devel] [PATCH 4/5] fftools/ffmpeg: flush and recreate
> encoder instance if resolution changes
> 
> Linjie Fu (12020-06-09):
> > Signed-off-by: Linjie Fu 
> > ---
> > Should be squashed with:
> > https://patchwork.ffmpeg.org/project/ffmpeg/list/?series=1434
> 
> Apart from the issue of accessing non-public fields, this needs to be
> intensively tested. If it allows to create unplayable files, then it is
> not acceptable. It should be tested with codecs that use extradata (x264
> for example) and also with rawvideo.
> 
Indeed, tested with .mp4 and .h264 for encoder libx264, the results are 
playable.
(discarding global header if resolution changing is allowed, then we can keep 
the
Sequence header in each Key frame and make the resolution changing noticeable)

Please help to comment, thx.
https://patchwork.ffmpeg.org/project/ffmpeg/list/?series=1470

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

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

Re: [FFmpeg-devel] [PATCH 4/5] fftools/ffmpeg: flush and recreate encoder instance if resolution changes

2020-06-11 Thread Fu, Linjie
> From: ffmpeg-devel  On Behalf Of
> Anton Khirnov
> Sent: Wednesday, June 10, 2020 16:31
> To: FFmpeg development discussions and patches  de...@ffmpeg.org>
> Subject: Re: [FFmpeg-devel] [PATCH 4/5] fftools/ffmpeg: flush and recreate
> encoder instance if resolution changes
> 
> Quoting Linjie Fu (2020-06-09 10:48:46)
> > Signed-off-by: Linjie Fu 
> > ---
> > Should be squashed with:
> > https://patchwork.ffmpeg.org/project/ffmpeg/list/?series=1434
> >
> >  fftools/ffmpeg.c | 11 +++
> >  1 file changed, 11 insertions(+)
> >
> > diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
> > index 5859781..8cdd532 100644
> > --- a/fftools/ffmpeg.c
> > +++ b/fftools/ffmpeg.c
> > @@ -130,6 +130,7 @@ static void do_video_stats(OutputStream *ost, int
> frame_size);
> >  static BenchmarkTimeStamps get_benchmark_time_stamps(void);
> >  static int64_t getmaxrss(void);
> >  static int ifilter_has_all_input_formats(FilterGraph *fg);
> > +static void flush_encoders(void);
> >
> >  static int run_as_daemon  = 0;
> >  static int nb_frames_dup = 0;
> > @@ -1058,11 +1059,21 @@ static void do_video_out(OutputFile *of,
> >
> >  if (next_picture && (enc->width != next_picture->width ||
> >   enc->height != next_picture->height)) {
> > +flush_encoders();
> > +avcodec_flush_buffers(enc);
> >  if (!(enc->codec->capabilities &
> AV_CODEC_CAP_VARIABLE_DIMENSIONS)) {
> >  av_log(NULL, AV_LOG_ERROR, "Variable dimension encoding "
> >  "is not supported by %s.\n", enc->codec->name);
> >  goto error;
> >  }
> > +
> > +enc->width  = next_picture->width;
> > +enc->height = next_picture->height;
> > +
> > +if (enc->codec->close(enc) < 0)
> > +goto error;
> > +if (enc->codec->init(enc) < 0)
> > +goto error;
> 
> Absolutely not.
> Those are private fields, they must not be accessed by libavcodec
> callers.
> 
> What I meant was freeing the encoder and creating a completely new
> encoder instance.

Got it and updated, please help to comment, thx.
https://patchwork.ffmpeg.org/project/ffmpeg/list/?series=1470

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

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

Re: [FFmpeg-devel] [PATCH v10 1/4] avutil: add AV_FRAME_DATA_SEI_UNREGISTERED side data type

2020-06-11 Thread James Almer
On 6/11/2020 12:39 PM, Andreas Rheinhardt wrote:
> lance.lmw...@gmail.com:
>> On Wed, Jun 10, 2020 at 07:43:11AM +0800, lance.lmw...@gmail.com wrote:
>>> From: Limin Wang 
>>>
>>> Signed-off-by: Limin Wang 
>>> ---
>>> rebase with master only, I'll apply the patchset in two days if no 
>>> objection.
>>>
>>>  doc/APIchanges  | 3 +++
>>>  libavutil/frame.c   | 1 +
>>>  libavutil/frame.h   | 8 
>>>  libavutil/version.h | 2 +-
>>>  4 files changed, 13 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/doc/APIchanges b/doc/APIchanges
>>> index 70579df..08cdbda 100644
>>> --- a/doc/APIchanges
>>> +++ b/doc/APIchanges
>>> @@ -15,6 +15,9 @@ libavutil: 2017-10-21
>>>  
>>>  API changes, most recent first:
>>>  
>>> +2020-06-xx - xx - lavu 56.53.100 - frame.h
>>> +  Add AV_FRAME_DATA_SEI_UNREGISTERED.
>>> +
>>>  2020-06-05 - ec39c2276a - lavu 56.50.100 - buffer.h
>>>Passing NULL as alloc argument to av_buffer_pool_init2() is now allowed.
>>>  
>>> diff --git a/libavutil/frame.c b/libavutil/frame.c
>>> index 2e952ed..9884eae 100644
>>> --- a/libavutil/frame.c
>>> +++ b/libavutil/frame.c
>>> @@ -851,6 +851,7 @@ const char *av_frame_side_data_name(enum 
>>> AVFrameSideDataType type)
>>>  case AV_FRAME_DATA_DYNAMIC_HDR_PLUS: return "HDR Dynamic Metadata 
>>> SMPTE2094-40 (HDR10+)";
>>>  case AV_FRAME_DATA_REGIONS_OF_INTEREST: return "Regions Of Interest";
>>>  case AV_FRAME_DATA_VIDEO_ENC_PARAMS:return "Video encoding 
>>> parameters";
>>> +case AV_FRAME_DATA_SEI_UNREGISTERED:return "H.26[45] User 
>>> Data Unregistered SEI message";
>>>  }
>>>  return NULL;
>>>  }
>>> diff --git a/libavutil/frame.h b/libavutil/frame.h
>>> index fc67db0..3fb8c56 100644
>>> --- a/libavutil/frame.h
>>> +++ b/libavutil/frame.h
>>> @@ -184,6 +184,14 @@ enum AVFrameSideDataType {
>>>   * Encoding parameters for a video frame, as described by 
>>> AVVideoEncParams.
>>>   */
>>>  AV_FRAME_DATA_VIDEO_ENC_PARAMS,
>>> +
>>> +/**
>>> + * User data unregistered metadata associated with a video frame.
>>> + * This is the H.26[45] UDU SEI message, and shouldn't be used for any 
>>> other purpose
>>> + * The data is stored as uint8_t in AVFrameSideData.data which is 16 
>>> bytes of
>>> + * uuid_iso_iec_11578 followed by AVFrameSideData.size - 16 bytes of 
>>> user_data_payload_byte.
>>> + */
>>> +AV_FRAME_DATA_SEI_UNREGISTERED,
>>>  };
>>>  
>>>  enum AVActiveFormatDescription {
>>> diff --git a/libavutil/version.h b/libavutil/version.h
>>> index 652e1e9..e75e625 100644
>>> --- a/libavutil/version.h
>>> +++ b/libavutil/version.h
>>> @@ -79,7 +79,7 @@
>>>   */
>>>  
>>>  #define LIBAVUTIL_VERSION_MAJOR  56
>>> -#define LIBAVUTIL_VERSION_MINOR  52
>>> +#define LIBAVUTIL_VERSION_MINOR  53
>>>  #define LIBAVUTIL_VERSION_MICRO 100
>>
>> will apply this patch to avoid conflict every time.
>>
> You should not have done so given that the other patches are not
> finished yet and given that you yourself suggested zero-terminating the
> buffer (which the pushed version does not demand).
> 
> And avoiding merge conflicts is a bad rationale for pushing early anyway

> (a better solution would be to only add the changes to APIchanges and
> version.h directly before you push).

That is the correct solution, not just a better one.

If this design is not finished, it shouldn't have been pushed at all.
Fortunately it was done after 4.3 was branched, so not much of an issue
if changed as required in a timely manner, but please refrain from
pushing API changes before they are accepted.

> 
>>
>>>  
>>>  #define LIBAVUTIL_VERSION_INT   AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
>>> -- 
>>> 1.8.3.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 mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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

[FFmpeg-devel] [PATCH v2 5/5] lavc/encoder: declare caps for encoding with variable dimension

2020-06-11 Thread Linjie Fu
Signed-off-by: Linjie Fu 
---
Tested following encoders with container muxer(like mp4 muxer for
x264, which previously use extradata to store a global header)
and raw video muxer, results are good.

 libavcodec/libopenh264enc.c  | 4 +++-
 libavcodec/libvpxenc.c   | 4 +++-
 libavcodec/libx264.c | 4 +++-
 libavcodec/libx265.c | 4 +++-
 libavcodec/rawenc.c  | 3 ++-
 libavcodec/wrapped_avframe.c | 3 ++-
 6 files changed, 16 insertions(+), 6 deletions(-)

diff --git a/libavcodec/libopenh264enc.c b/libavcodec/libopenh264enc.c
index f63aa52..b86041b 100644
--- a/libavcodec/libopenh264enc.c
+++ b/libavcodec/libopenh264enc.c
@@ -438,7 +438,9 @@ AVCodec ff_libopenh264_encoder = {
 .init   = svc_encode_init,
 .encode2= svc_encode_frame,
 .close  = svc_encode_close,
-.capabilities   = AV_CODEC_CAP_AUTO_THREADS,
+.capabilities   = AV_CODEC_CAP_AUTO_THREADS |
+  AV_CODEC_CAP_VARIABLE_DIMENSIONS |
+  AV_CODEC_CAP_ENCODER_FLUSH,
 .caps_internal  = FF_CODEC_CAP_INIT_THREADSAFE | FF_CODEC_CAP_INIT_CLEANUP,
 .pix_fmts   = (const enum AVPixelFormat[]){ AV_PIX_FMT_YUV420P,
 AV_PIX_FMT_NONE },
diff --git a/libavcodec/libvpxenc.c b/libavcodec/libvpxenc.c
index 8e0ea42..9faec48 100644
--- a/libavcodec/libvpxenc.c
+++ b/libavcodec/libvpxenc.c
@@ -1789,7 +1789,9 @@ AVCodec ff_libvpx_vp9_encoder = {
 .init   = vp9_init,
 .encode2= vpx_encode,
 .close  = vpx_free,
-.capabilities   = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_AUTO_THREADS,
+.capabilities   = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_AUTO_THREADS |
+  AV_CODEC_CAP_VARIABLE_DIMENSIONS |
+  AV_CODEC_CAP_ENCODER_FLUSH,
 .profiles   = NULL_IF_CONFIG_SMALL(ff_vp9_profiles),
 .priv_class = &class_vp9,
 .defaults   = defaults,
diff --git a/libavcodec/libx264.c b/libavcodec/libx264.c
index d4b1fd0..016c53c 100644
--- a/libavcodec/libx264.c
+++ b/libavcodec/libx264.c
@@ -1177,7 +1177,9 @@ AVCodec ff_libx264_encoder = {
 .encode2  = X264_frame,
 .close= X264_close,
 .capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_AUTO_THREADS |
-AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE,
+AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE |
+AV_CODEC_CAP_VARIABLE_DIMENSIONS |
+AV_CODEC_CAP_ENCODER_FLUSH,
 .priv_class   = &x264_class,
 .defaults = x264_defaults,
 .init_static_data = X264_init_static,
diff --git a/libavcodec/libx265.c b/libavcodec/libx265.c
index f560d7f..2a9ec4e 100644
--- a/libavcodec/libx265.c
+++ b/libavcodec/libx265.c
@@ -701,6 +701,8 @@ AVCodec ff_libx265_encoder = {
 .priv_class   = &class,
 .defaults = x265_defaults,
 .capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_AUTO_THREADS |
-AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE,
+AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE |
+AV_CODEC_CAP_VARIABLE_DIMENSIONS |
+AV_CODEC_CAP_ENCODER_FLUSH,
 .wrapper_name = "libx265",
 };
diff --git a/libavcodec/rawenc.c b/libavcodec/rawenc.c
index 486c0d7..85298dc 100644
--- a/libavcodec/rawenc.c
+++ b/libavcodec/rawenc.c
@@ -92,5 +92,6 @@ AVCodec ff_rawvideo_encoder = {
 .id = AV_CODEC_ID_RAWVIDEO,
 .init   = raw_encode_init,
 .encode2= raw_encode,
-.capabilities   = AV_CODEC_CAP_VARIABLE_DIMENSIONS,
+.capabilities   = AV_CODEC_CAP_VARIABLE_DIMENSIONS |
+  AV_CODEC_CAP_ENCODER_FLUSH,
 };
diff --git a/libavcodec/wrapped_avframe.c b/libavcodec/wrapped_avframe.c
index ae29328..9af3193 100644
--- a/libavcodec/wrapped_avframe.c
+++ b/libavcodec/wrapped_avframe.c
@@ -116,7 +116,8 @@ AVCodec ff_wrapped_avframe_encoder = {
 .id = AV_CODEC_ID_WRAPPED_AVFRAME,
 .encode2= wrapped_avframe_encode,
 .caps_internal  = FF_CODEC_CAP_INIT_THREADSAFE,
-.capabilities   = AV_CODEC_CAP_VARIABLE_DIMENSIONS,
+.capabilities   = AV_CODEC_CAP_VARIABLE_DIMENSIONS |
+  AV_CODEC_CAP_ENCODER_FLUSH,
 };
 
 AVCodec ff_wrapped_avframe_decoder = {
-- 
2.7.4

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

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

[FFmpeg-devel] [PATCH v2 4/5] fftools/ffmpeg: flush and recreate encoder instance if resolution changes

2020-06-11 Thread Linjie Fu
Add recreate_encoder_instance() function.

If resolution changing is allowed, discard AV_CODEC_FLAG_GLOBAL_HEADER
even if the avformat/container declares AVFMT_GLOBALHEADER flag. Place
header information in every keyframe instead of single global header.

Signed-off-by: Linjie Fu 
---
Should be squashed with:
https://patchwork.ffmpeg.org/project/ffmpeg/list/?series=1434

 fftools/ffmpeg.c | 40 
 fftools/ffmpeg_opt.c |  2 +-
 2 files changed, 41 insertions(+), 1 deletion(-)

diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
index 5859781..86562c9 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -130,6 +130,7 @@ static void do_video_stats(OutputStream *ost, int 
frame_size);
 static BenchmarkTimeStamps get_benchmark_time_stamps(void);
 static int64_t getmaxrss(void);
 static int ifilter_has_all_input_formats(FilterGraph *fg);
+static void flush_encoders(void);
 
 static int run_as_daemon  = 0;
 static int nb_frames_dup = 0;
@@ -1039,6 +1040,37 @@ static void do_subtitle_out(OutputFile *of,
 }
 }
 
+static int recreate_encoder_instance(OutputStream *ost,
+ int width, int height)
+{
+AVCodec *encoder = ost->enc_ctx->codec;
+AVRational time_base = ost->enc_ctx->time_base;
+int ret;
+
+avcodec_free_context(&ost->enc_ctx);
+
+ost->enc_ctx = avcodec_alloc_context3(encoder);
+if (!ost->enc_ctx)
+return AVERROR(ENOMEM);
+
+ost->st->codecpar->width  = width;
+ost->st->codecpar->height = height;
+
+if (ret = avcodec_parameters_to_context(ost->enc_ctx, ost->st->codecpar) < 
0)
+return ret;
+
+ost->enc_ctx->time_base = time_base;
+
+if (ret = avcodec_open2(ost->enc_ctx, encoder, &ost->encoder_opts) < 0) {
+av_log(NULL, AV_LOG_ERROR, "Error while re-opening encoder for output 
stream #%d:%d - "
+   "maybe incorrect parameters such as bit_rate, rate, width or 
height.\n",
+   ost->file_index, ost->index);
+return ret;
+}
+
+return 0;
+}
+
 static void do_video_out(OutputFile *of,
  OutputStream *ost,
  AVFrame *next_picture,
@@ -1058,11 +1090,19 @@ static void do_video_out(OutputFile *of,
 
 if (next_picture && (enc->width != next_picture->width ||
  enc->height != next_picture->height)) {
+flush_encoders();
+avcodec_flush_buffers(enc);
+
 if (!(enc->codec->capabilities & AV_CODEC_CAP_VARIABLE_DIMENSIONS)) {
 av_log(NULL, AV_LOG_ERROR, "Variable dimension encoding "
 "is not supported by %s.\n", enc->codec->name);
 goto error;
 }
+
+if (recreate_encoder_instance(ost, next_picture->width, 
next_picture->height) < 0)
+goto error;
+
+enc = ost->enc_ctx;
 }
 
 if (ost->source_index >= 0)
diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c
index 9d1489c..334c6ec 100644
--- a/fftools/ffmpeg_opt.c
+++ b/fftools/ffmpeg_opt.c
@@ -1562,7 +1562,7 @@ static OutputStream *new_output_stream(OptionsContext *o, 
AVFormatContext *oc, e
 MATCH_PER_STREAM_OPT(max_muxing_queue_size, i, ost->max_muxing_queue_size, 
oc, st);
 ost->max_muxing_queue_size *= sizeof(AVPacket);
 
-if (oc->oformat->flags & AVFMT_GLOBALHEADER)
+if (oc->oformat->flags & AVFMT_GLOBALHEADER && ost->autoscale)
 ost->enc_ctx->flags |= AV_CODEC_FLAG_GLOBAL_HEADER;
 
 av_dict_copy(&ost->sws_dict, o->g->sws_dict, 0);
-- 
2.7.4

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

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

Re: [FFmpeg-devel] [PATCH v11 3/4] avfilter/vf_showinfo: display H.26[45] user data unregistered sei message

2020-06-11 Thread Andreas Rheinhardt
lance.lmw...@gmail.com:
> On Wed, Jun 10, 2020 at 08:13:59PM +0200, Andreas Rheinhardt wrote:
>> lance.lmw...@gmail.com:
>>> From: Limin Wang 
>>>
>>> Signed-off-by: Limin Wang 
>>> ---
>>>  libavfilter/vf_showinfo.c | 37 +
>>>  1 file changed, 37 insertions(+)
>>>
>>> diff --git a/libavfilter/vf_showinfo.c b/libavfilter/vf_showinfo.c
>>> index 5d4aee4..2511da5 100644
>>> --- a/libavfilter/vf_showinfo.c
>>> +++ b/libavfilter/vf_showinfo.c
>>> @@ -37,6 +37,7 @@
>>>  #include "libavutil/timecode.h"
>>>  #include "libavutil/mastering_display_metadata.h"
>>>  #include "libavutil/video_enc_params.h"
>>> +#include "libavutil/avstring.h"
>>>  
>>>  #include "avfilter.h"
>>>  #include "internal.h"
>>> @@ -190,6 +191,39 @@ static void dump_video_enc_params(AVFilterContext 
>>> *ctx, AVFrameSideData *sd)
>>>  av_log(ctx, AV_LOG_INFO, "%u blocks; ", par->nb_blocks);
>>>  }
>>>  
>>> +static int string_is_print(const uint8_t *str)
>>> +{
>>> +while (av_isgraph(*str)) str++;
>>> +return !*str;
>>
>> This is dangerous: The SEI message needn't be zero-terminated, so this
>> may segfault. Furthermore, it is also wrong: If the user data payload
>> happens to contain a binary zero preceded by printable ASCII characters,
>> it will be considered a string, even if there are unprintable characters
>> after the binary zero (which may really happen if the payload is
>> actually binary).
> 
> Give below test example, if a binary zero preceded by "hello", the %s will 
> print
> out "hello" and ignore the other unprintable characters. I think it's 
> expected.
> We only dump the printable result if it is string or parial string.
> 
>  unsigned char test[10];
> 
>  test[0] = 'h';
>  test[1] = 'e';
>  test[2] = 'l';
>  test[3] = 'l';
>  test[4] = 'o';
>  test[5] = 0;
>  test[6] = 133;
>  test[7] = 144;
> 
>  printf( "test: %s \n", test);
> 
> So I thbink it's safety after add one padding zero bytes for the user data
> buffer.
> 

And who says that what is before the first binary zero is actually a
string and not some actually binary data that just happens to be in the
printable ASCII range and will be gibberish when printed?

>>
>>> +}
>>> +
>>> +static void dump_sei_unregistered_metadata(AVFilterContext *ctx, 
>>> AVFrameSideData *sd)
>>> +{
>>> +const int uuid_size = 16;
>>> +uint8_t *user_data = sd->data;
>>> +
>>> +if (sd->size < uuid_size) {
>>> +av_log(ctx, AV_LOG_ERROR, "invalid data(%d < UUID(%d-bytes))", 
>>> sd->size, uuid_size);
>>> +return;
>>> +}
>>> +
>>> +av_log(ctx, AV_LOG_INFO, "User Data Unregistered:\n");
>>> +av_log(ctx, AV_LOG_INFO, "UUID=");
>>> +for (int i = 0; i < uuid_size; i++) {
>>> +av_log(ctx, AV_LOG_INFO, "%02x", user_data[i]);
>>> +if (i == 3 || i == 5 || i == 7 || i == 9)
>>> +av_log(ctx, AV_LOG_INFO, "-");
>>> +}
>>> +av_log(ctx, AV_LOG_INFO, "\n");
>>> +
>>> +user_data += uuid_size;
>>> +/* Only print the user data details if it's string */
>>> +if (string_is_print(user_data)) {
>>> +av_log(ctx, AV_LOG_INFO, "User Data=");
>>> +av_log(ctx, AV_LOG_INFO, "%s", user_data);
>>
>> Given that the user_data needn't be zero-terminated, you must specify
>> the precision (i.e. the number of bytes to write) here.
>>
>>> +}
>>> +}
>>> +
>>>  static void dump_color_property(AVFilterContext *ctx, AVFrame *frame)
>>>  {
>>>  const char *color_range_str = 
>>> av_color_range_name(frame->color_range);
>>> @@ -375,6 +409,9 @@ static int filter_frame(AVFilterLink *inlink, AVFrame 
>>> *frame)
>>>  case AV_FRAME_DATA_VIDEO_ENC_PARAMS:
>>>  dump_video_enc_params(ctx, sd);
>>>  break;
>>> +case AV_FRAME_DATA_SEI_UNREGISTERED:
>>> +dump_sei_unregistered_metadata(ctx, sd);
>>> +break;
>>>  default:
>>>  av_log(ctx, AV_LOG_WARNING, "unknown side data type %d (%d 
>>> bytes)",
>>> sd->type, sd->size);
>>>
>>
>> ___
>> 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 5/7] avcodec/sonic: Fix several integer state overflows

2020-06-11 Thread Paul B Mahol
On 6/11/20, Michael Niedermayer  wrote:
> On Wed, May 20, 2020 at 08:59:20PM +0200, Michael Niedermayer wrote:
>> On Mon, May 11, 2020 at 01:07:54AM +0200, Paul B Mahol wrote:
>> > NAK
>> >
>> > please remove this code fully.
>>
>> Id like to apply this and backport to the releases branches because
>> sonic is in the releases
>> are you ok with that ?
>
> will apply soon unless i hear objections
>

NO, I'm not ok with that. I told you what to do with this code already.

> [...]
>
> --
> Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> In fact, the RIAA has been known to suggest that students drop out
> of college or go to community college in order to be able to afford
> settlements. -- The RIAA
>
___
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] [RFC PATCH] libavcodec/libopenjpeg: pix fmt selection change

2020-06-11 Thread Gautam Ramakrishnan
On Thu, Jun 11, 2020 at 11:42 AM Michael Bradshaw  wrote:
>
> On Wed, Jun 10, 2020 at 9:35 PM Gautam Ramakrishnan 
> wrote:
>
> > The reference file has 4 components, Whereas all the Bayer formats
> > have 3 components. Are we missing any Bayer pixel format in ffmpeg?
> > Also, any other ideas on what has to be done for the 2 reference files
> > mentioned? If this seems like a good idea, I could go through
> > opj_decompress
> > and try to replicate what it does.
>
>
> I don't think this is a real image. I think it's probably just a synthetic
> image for the purposes of conformance testing. p1_03.j2k and p0_05.j2k (and
> others) are too weird.
>
> I decoded p1_03.j2k's components into different files (opj_decompress -i
> p1_03.j2k -split-pnm -o /tmp/p1_03.pgm) and inspected each one.
> Additionally, I cat'd the raw gray8 pixel values to construct raw yuv420p
> frames. I created 4 raw yuv420p frames using every valid combination
> of p1_03.j2k's four planes. All of them looked like garbage.
>
> That's not too surprising. Each plane has dark near-zero pixel values in
> the sky region. A bright region like the sky should have high pixel values
> for the Y-plane.
>
> I highly suspect this j2k file is synthetic and just tests whether or not a
> decoder can decode the planes, but that doesn't test whether or not they
> can be sensibly displayed (and I'd argue they can't be sensibly displayed).
Got it. In that case we can safely ignore the patch to fix libopenjpeg.
However, p1_03.j2k is one of the 2 files to have ppm marker. How could I
validate a patch to add ppm marker? I need something to cross validate.
Any suggestions for that?
> ___
> 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".



-- 
-
Gautam |
___
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 v10 1/4] avutil: add AV_FRAME_DATA_SEI_UNREGISTERED side data type

2020-06-11 Thread Andreas Rheinhardt
lance.lmw...@gmail.com:
> On Wed, Jun 10, 2020 at 07:43:11AM +0800, lance.lmw...@gmail.com wrote:
>> From: Limin Wang 
>>
>> Signed-off-by: Limin Wang 
>> ---
>> rebase with master only, I'll apply the patchset in two days if no objection.
>>
>>  doc/APIchanges  | 3 +++
>>  libavutil/frame.c   | 1 +
>>  libavutil/frame.h   | 8 
>>  libavutil/version.h | 2 +-
>>  4 files changed, 13 insertions(+), 1 deletion(-)
>>
>> diff --git a/doc/APIchanges b/doc/APIchanges
>> index 70579df..08cdbda 100644
>> --- a/doc/APIchanges
>> +++ b/doc/APIchanges
>> @@ -15,6 +15,9 @@ libavutil: 2017-10-21
>>  
>>  API changes, most recent first:
>>  
>> +2020-06-xx - xx - lavu 56.53.100 - frame.h
>> +  Add AV_FRAME_DATA_SEI_UNREGISTERED.
>> +
>>  2020-06-05 - ec39c2276a - lavu 56.50.100 - buffer.h
>>Passing NULL as alloc argument to av_buffer_pool_init2() is now allowed.
>>  
>> diff --git a/libavutil/frame.c b/libavutil/frame.c
>> index 2e952ed..9884eae 100644
>> --- a/libavutil/frame.c
>> +++ b/libavutil/frame.c
>> @@ -851,6 +851,7 @@ const char *av_frame_side_data_name(enum 
>> AVFrameSideDataType type)
>>  case AV_FRAME_DATA_DYNAMIC_HDR_PLUS: return "HDR Dynamic Metadata 
>> SMPTE2094-40 (HDR10+)";
>>  case AV_FRAME_DATA_REGIONS_OF_INTEREST: return "Regions Of Interest";
>>  case AV_FRAME_DATA_VIDEO_ENC_PARAMS:return "Video encoding 
>> parameters";
>> +case AV_FRAME_DATA_SEI_UNREGISTERED:return "H.26[45] User 
>> Data Unregistered SEI message";
>>  }
>>  return NULL;
>>  }
>> diff --git a/libavutil/frame.h b/libavutil/frame.h
>> index fc67db0..3fb8c56 100644
>> --- a/libavutil/frame.h
>> +++ b/libavutil/frame.h
>> @@ -184,6 +184,14 @@ enum AVFrameSideDataType {
>>   * Encoding parameters for a video frame, as described by 
>> AVVideoEncParams.
>>   */
>>  AV_FRAME_DATA_VIDEO_ENC_PARAMS,
>> +
>> +/**
>> + * User data unregistered metadata associated with a video frame.
>> + * This is the H.26[45] UDU SEI message, and shouldn't be used for any 
>> other purpose
>> + * The data is stored as uint8_t in AVFrameSideData.data which is 16 
>> bytes of
>> + * uuid_iso_iec_11578 followed by AVFrameSideData.size - 16 bytes of 
>> user_data_payload_byte.
>> + */
>> +AV_FRAME_DATA_SEI_UNREGISTERED,
>>  };
>>  
>>  enum AVActiveFormatDescription {
>> diff --git a/libavutil/version.h b/libavutil/version.h
>> index 652e1e9..e75e625 100644
>> --- a/libavutil/version.h
>> +++ b/libavutil/version.h
>> @@ -79,7 +79,7 @@
>>   */
>>  
>>  #define LIBAVUTIL_VERSION_MAJOR  56
>> -#define LIBAVUTIL_VERSION_MINOR  52
>> +#define LIBAVUTIL_VERSION_MINOR  53
>>  #define LIBAVUTIL_VERSION_MICRO 100
> 
> will apply this patch to avoid conflict every time.
> 
You should not have done so given that the other patches are not
finished yet and given that you yourself suggested zero-terminating the
buffer (which the pushed version does not demand).

And avoiding merge conflicts is a bad rationale for pushing early anyway
(a better solution would be to only add the changes to APIchanges and
version.h directly before you push).

> 
>>  
>>  #define LIBAVUTIL_VERSION_INT   AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
>> -- 
>> 1.8.3.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 4/5] lavf/dashdec: improve memory handling

2020-06-11 Thread Andreas Rheinhardt
rcombs:
> - Fixes a couple leaks
> - Adds an av_freep equivalent for libxml buffers
> - Avoids some redundant copying
> ---
>  libavformat/dashdec.c | 44 +++
>  1 file changed, 24 insertions(+), 20 deletions(-)
> 
> diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c
> index c94ce2caca..378c892b87 100644
> --- a/libavformat/dashdec.c
> +++ b/libavformat/dashdec.c
> @@ -147,9 +147,6 @@ typedef struct DASHContext {
>  uint64_t period_duration;
>  uint64_t period_start;
>  
> -/* AdaptationSet Attribute */
> -char *adaptationset_lang;
> -
>  int is_live;
>  AVIOInterruptCB *interrupt_callback;
>  char *allowed_extensions;
> @@ -162,6 +159,15 @@ typedef struct DASHContext {
>  
>  } DASHContext;
>  
> +static void xml_freep(void* arg)
> +{
> +void *val;
> +
> +memcpy(&val, arg, sizeof(val));
> +memcpy(arg, &(void *){ NULL }, sizeof(val));
> +xmlFree(val);
> +}
> +

libxml2 allows to use custom memory allocation functions. Have you tried
to just use our allocation functions which would allow to use av_freep
directly?

>  static int ishttp(char *url)
>  {
>  const char *proto_name = avio_find_protocol_name(url);
> @@ -362,6 +368,8 @@ static void free_representation(struct representation 
> *pls)
>  avformat_close_input(&pls->ctx);
>  }
>  
> +xml_freep(&pls->lang);
> +
>  av_freep(&pls->url_template);
>  av_freep(&pls);
>  }
> @@ -878,15 +886,9 @@ static int parse_manifest_representation(AVFormatContext 
> *s, const char *url,
>  ret = AVERROR(ENOMEM);
>  goto end;
>  }
> -if (c->adaptationset_lang) {
> -rep->lang = av_strdup(c->adaptationset_lang);
> -if (!rep->lang) {
> -av_log(s, AV_LOG_ERROR, "alloc language memory failure\n");
> -av_freep(&rep);
> -ret = AVERROR(ENOMEM);
> -goto end;
> -}
> -}
> +
> +rep->lang = xmlGetProp(adaptationset_node, "lang");
> +
>  rep->parent = s;
>  representation_segmenttemplate_node = 
> find_child_node_by_name(representation_node, "SegmentTemplate");
>  representation_baseurl_node = 
> find_child_node_by_name(representation_node, "BaseURL");
> @@ -965,7 +967,8 @@ static int parse_manifest_representation(AVFormatContext 
> *s, const char *url,
>  xmlFree(startnumber_val);
>  }
>  if (adaptationset_supplementalproperty_node) {
> -if 
> (!av_strcasecmp(xmlGetProp(adaptationset_supplementalproperty_node,"schemeIdUri"),
>  "http://dashif.org/guidelines/last-segment-number";)) {
> +char *schemeIdUri = 
> xmlGetProp(adaptationset_supplementalproperty_node, "schemeIdUri");
> +if (!av_strcasecmp(schemeIdUri, 
> "http://dashif.org/guidelines/last-segment-number";)) {
>  val = 
> xmlGetProp(adaptationset_supplementalproperty_node,"value");
>  if (!val) {
>  av_log(s, AV_LOG_ERROR, "Missing value attribute in 
> adaptationset_supplementalproperty_node\n");
> @@ -974,6 +977,7 @@ static int parse_manifest_representation(AVFormatContext 
> *s, const char *url,
>  xmlFree(val);
>  }
>  }
> +xmlFree(schemeIdUri);
>  }
>  
>  fragment_timeline_node = 
> find_child_node_by_name(representation_segmenttemplate_node, 
> "SegmentTimeline");
> @@ -1120,13 +1124,10 @@ end:
>  
>  static int parse_manifest_adaptationset_attr(AVFormatContext *s, xmlNodePtr 
> adaptationset_node)
>  {
> -DASHContext *c = s->priv_data;
> -
>  if (!adaptationset_node) {
>  av_log(s, AV_LOG_WARNING, "Cannot get AdaptationSet\n");
>  return AVERROR(EINVAL);
>  }
> -c->adaptationset_lang = xmlGetProp(adaptationset_node, "lang");
>  
>  return 0;
>  }
> @@ -1139,7 +1140,6 @@ static int parse_manifest_adaptationset(AVFormatContext 
> *s, const char *url,
>  xmlNodePtr period_segmentlist_node)
>  {
>  int ret = 0;
> -DASHContext *c = s->priv_data;
>  xmlNodePtr fragment_template_node = NULL;
>  xmlNodePtr content_component_node = NULL;
>  xmlNodePtr adaptationset_baseurl_node = NULL;
> @@ -1182,7 +1182,6 @@ static int parse_manifest_adaptationset(AVFormatContext 
> *s, const char *url,
>  }
>  
>  err:
> -av_freep(&c->adaptationset_lang);
>  return ret;
>  }
>  
> @@ -2157,6 +2156,10 @@ static int dash_read_header(AVFormatContext *s)
>  av_dict_set_int(&rep->assoc_stream->metadata, 
> "variant_bitrate", rep->bandwidth, 0);
>  if (rep->id[0])
>  av_dict_set(&rep->assoc_stream->metadata, "id", rep->id, 0);
> +if (rep->lang) {
> +av_dict_set(&rep->assoc_stream->metadata, "language", 
> rep->lang, 0);
> +  

Re: [FFmpeg-devel] [PATCH v4 24/24] avutil/internal: remove FF_ALLOCx{_ARRAY}_OR_GOTO macros

2020-06-11 Thread lance . lmwang
On Thu, Jun 11, 2020 at 12:53:01PM +0200, Nicolas George wrote:
> lance.lmw...@gmail.com (12020-06-11):
> > I'll apply the patch set in next two days if no further comments still. 
> > Please help to
> > review if you think it's necessary.
> 
> Please do not include my name in the commit message.

Sure, I have removed below line from the commit message in local:
"Nicolas George comments for the macros:" 

> 
> Regards,
> 
> -- 
>   Nicolas George



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


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

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

[FFmpeg-devel] [PATCH V2 2/2] vf_dnn_processing.c: add dnn backend openvino

2020-06-11 Thread Guo, Yejun
We can try with the srcnn model from sr filter.
1) get srcnn.pb model file, see filter sr
2) convert srcnn.pb into openvino model with command:
python mo_tf.py --input_model srcnn.pb --data_type=FP32 --input_shape 
[1,960,1440,1] --keep_shape_ops

See the script at 
https://github.com/openvinotoolkit/openvino/tree/master/model-optimizer
We'll see srcnn.xml and srcnn.bin at current path, copy them to the
directory where ffmpeg is.

I have also uploaded the model files at 
https://github.com/guoyejun/dnn_processing/tree/master/models

3) run with openvino backend:
ffmpeg -i input.jpg -vf 
format=yuv420p,scale=w=iw*2:h=ih*2,dnn_processing=dnn_backend=openvino:model=srcnn.xml:input=x:output=srcnn/Maximum
 -y srcnn.ov.jpg
(The input.jpg resolution is 720*480)

Signed-off-by: Guo, Yejun 
---
 doc/filters.texi| 10 +-
 libavfilter/vf_dnn_processing.c |  5 -
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/doc/filters.texi b/doc/filters.texi
index 84567de..d197d33 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -9288,13 +9288,21 @@ TensorFlow backend. To enable this backend you
 need to install the TensorFlow for C library (see
 @url{https://www.tensorflow.org/install/install_c}) and configure FFmpeg with
 @code{--enable-libtensorflow}
+
+@item openvino
+OpenVINO backend. To enable this backend you
+need to build and install the OpenVINO for C library (see
+@url{https://github.com/openvinotoolkit/openvino/blob/master/build-instruction.md})
 and configure FFmpeg with
+@code{--enable-libopenvino} (--extra-cflags=-I... --extra-ldflags=-L... might
+be needed if the header files and libraries are not installed into system path)
+
 @end table
 
 Default value is @samp{native}.
 
 @item model
 Set path to model file specifying network architecture and its parameters.
-Note that different backends use different file formats. TensorFlow and native
+Note that different backends use different file formats. TensorFlow, OpenVINO 
and native
 backend can load files for only its format.
 
 Native model file (.model) can be generated from TensorFlow model file (.pb) 
by using tools/python/convert.py
diff --git a/libavfilter/vf_dnn_processing.c b/libavfilter/vf_dnn_processing.c
index cf589ac..4b31808 100644
--- a/libavfilter/vf_dnn_processing.c
+++ b/libavfilter/vf_dnn_processing.c
@@ -58,11 +58,14 @@ typedef struct DnnProcessingContext {
 #define OFFSET(x) offsetof(DnnProcessingContext, x)
 #define FLAGS AV_OPT_FLAG_FILTERING_PARAM | AV_OPT_FLAG_VIDEO_PARAM
 static const AVOption dnn_processing_options[] = {
-{ "dnn_backend", "DNN backend",OFFSET(backend_type), 
AV_OPT_TYPE_INT,   { .i64 = 0 },0, 1, FLAGS, "backend" },
+{ "dnn_backend", "DNN backend",OFFSET(backend_type), 
AV_OPT_TYPE_INT,   { .i64 = 0 },INT_MIN, INT_MAX, FLAGS, "backend" },
 { "native",  "native backend flag",0,
AV_OPT_TYPE_CONST, { .i64 = 0 },0, 0, FLAGS, "backend" },
 #if (CONFIG_LIBTENSORFLOW == 1)
 { "tensorflow",  "tensorflow backend flag",0,
AV_OPT_TYPE_CONST, { .i64 = 1 },0, 0, FLAGS, "backend" },
 #endif
+#if (CONFIG_LIBOPENVINO == 1)
+{ "openvino","openvino backend flag",  0,
AV_OPT_TYPE_CONST, { .i64 = 2 },0, 0, FLAGS, "backend" },
+#endif
 { "model",   "path to model file", OFFSET(model_filename),   
AV_OPT_TYPE_STRING,{ .str = NULL }, 0, 0, FLAGS },
 { "input",   "input name of the model",OFFSET(model_inputname),  
AV_OPT_TYPE_STRING,{ .str = NULL }, 0, 0, FLAGS },
 { "output",  "output name of the model",   OFFSET(model_outputname), 
AV_OPT_TYPE_STRING,{ .str = NULL }, 0, 0, FLAGS },
-- 
2.7.4

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

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

[FFmpeg-devel] [PATCH V2 1/2] dnn: add openvino as one of dnn backend

2020-06-11 Thread Guo, Yejun
OpenVINO is a Deep Learning Deployment Toolkit at
https://github.com/openvinotoolkit/openvino, it supports CPU, GPU
and heterogeneous plugins to accelerate deep learning inferencing.

Please refer to 
https://github.com/openvinotoolkit/openvino/blob/master/build-instruction.md
to build openvino (c library is built at the same time). Please add
option -DENABLE_MKL_DNN=ON for cmake to enable CPU path. The header
files and libraries are installed to 
/usr/local/deployment_tools/inference_engine/
with default options on my system.

To build FFmpeg with openvion, take my system as an example, run with:
$ export 
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/deployment_tools/inference_engine/lib/intel64/:/usr/local/deployment_tools/inference_engine/external/tbb/lib/
$ ../ffmpeg/configure --enable-libopenvino 
--extra-cflags=-I/usr/local/deployment_tools/inference_engine/include/ 
--extra-ldflags=-L/usr/local/deployment_tools/inference_engine/lib/intel64
$ make

Here are the features provided by OpenVINO inference engine:
- support more DNN model formats
It supports TensorFlow, Caffe, ONNX, MXNet and Kaldi by converting them
into OpenVINO format with a python script. And torth model
can be first converted into ONNX and then to OpenVINO format.

see the script at 
https://github.com/openvinotoolkit/openvino/tree/master/model-optimizer/mo.py
which also does some optimization at model level.

- optimize at inference stage
It optimizes for X86 CPUs with SSE, AVX etc.

It also optimizes based on OpenCL for Intel GPUs.
(only Intel GPU supported becuase Intel OpenCL extension is used for 
optimization)

Signed-off-by: Guo, Yejun 
---
 configure  |   6 +-
 libavfilter/dnn/Makefile   |   1 +
 libavfilter/dnn/dnn_backend_openvino.c | 261 +
 libavfilter/dnn/dnn_backend_openvino.h |  38 +
 libavfilter/dnn/dnn_interface.c|  11 ++
 libavfilter/dnn_interface.h|   2 +-
 6 files changed, 317 insertions(+), 2 deletions(-)
 create mode 100644 libavfilter/dnn/dnn_backend_openvino.c
 create mode 100644 libavfilter/dnn/dnn_backend_openvino.h

diff --git a/configure b/configure
index 8569a60..46fc2bb 100755
--- a/configure
+++ b/configure
@@ -253,6 +253,8 @@ External library support:
   --enable-libopenh264 enable H.264 encoding via OpenH264 [no]
   --enable-libopenjpeg enable JPEG 2000 de/encoding via OpenJPEG [no]
   --enable-libopenmpt  enable decoding tracked files via libopenmpt [no]
+  --enable-libopenvino enable OpenVINO as a DNN module backend
+   for DNN based filters like dnn_processing [no]
   --enable-libopus enable Opus de/encoding via libopus [no]
   --enable-libpulseenable Pulseaudio input via libpulse [no]
   --enable-librabbitmq enable RabbitMQ library [no]
@@ -1790,6 +1792,7 @@ EXTERNAL_LIBRARY_LIST="
 libopenh264
 libopenjpeg
 libopenmpt
+libopenvino
 libopus
 libpulse
 librabbitmq
@@ -2620,7 +2623,7 @@ cbs_mpeg2_select="cbs"
 cbs_vp9_select="cbs"
 dct_select="rdft"
 dirac_parse_select="golomb"
-dnn_suggest="libtensorflow"
+dnn_suggest="libtensorflow libopenvino"
 error_resilience_select="me_cmp"
 faandct_deps="faan"
 faandct_select="fdctdsp"
@@ -6347,6 +6350,7 @@ enabled libopenh264   && require_pkg_config 
libopenh264 openh264 wels/codec_
 enabled libopenjpeg   && { check_pkg_config libopenjpeg "libopenjp2 >= 
2.1.0" openjpeg.h opj_version ||
{ require_pkg_config libopenjpeg "libopenjp2 >= 
2.1.0" openjpeg.h opj_version -DOPJ_STATIC && add_cppflags -DOPJ_STATIC; } }
 enabled libopenmpt&& require_pkg_config libopenmpt "libopenmpt >= 
0.2.6557" libopenmpt/libopenmpt.h openmpt_module_create -lstdc++ && append 
libopenmpt_extralibs "-lstdc++"
+enabled libopenvino   && require libopenvino c_api/ie_c_api.h 
ie_c_api_version -linference_engine_c_api
 enabled libopus   && {
 enabled libopus_decoder && {
 require_pkg_config libopus opus opus_multistream.h 
opus_multistream_decoder_create
diff --git a/libavfilter/dnn/Makefile b/libavfilter/dnn/Makefile
index bb37298..d90137e 100644
--- a/libavfilter/dnn/Makefile
+++ b/libavfilter/dnn/Makefile
@@ -9,5 +9,6 @@ OBJS-$(CONFIG_DNN)   += 
dnn/dnn_backend_native_layer_mat
 OBJS-$(CONFIG_DNN)   += 
dnn/dnn_backend_native_layer_mathunary.o
 
 DNN-OBJS-$(CONFIG_LIBTENSORFLOW) += dnn/dnn_backend_tf.o
+DNN-OBJS-$(CONFIG_LIBOPENVINO)   += dnn/dnn_backend_openvino.o
 
 OBJS-$(CONFIG_DNN)   += $(DNN-OBJS-yes)
diff --git a/libavfilter/dnn/dnn_backend_openvino.c 
b/libavfilter/dnn/dnn_backend_openvino.c
new file mode 100644
index 000..f048bc2
--- /dev/null
+++ b/libavfilter/dnn/dnn_backend_openvino.c
@@ -0,0 +1,261 @@
+/*
+ * Copyright (c) 2020
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or

Re: [FFmpeg-devel] [PATCH 3/5] lavc/h264dec: loosen new-extradata check

2020-06-11 Thread James Almer
On 6/11/2020 1:43 AM, rcombs wrote:
> ---
>  libavcodec/h264dec.c | 13 ++---
>  1 file changed, 6 insertions(+), 7 deletions(-)
> 
> diff --git a/libavcodec/h264dec.c b/libavcodec/h264dec.c
> index 6270ea80df..0d7492cfad 100644
> --- a/libavcodec/h264dec.c
> +++ b/libavcodec/h264dec.c
> @@ -988,6 +988,8 @@ static int h264_decode_frame(AVCodecContext *avctx, void 
> *data,
>  AVFrame *pict  = data;
>  int buf_index;
>  int ret;
> +const uint8_t *new_extra;
> +int new_extra_size;
>  
>  h->flags = avctx->flags;
>  h->setup_finished = 0;
> @@ -999,13 +1001,10 @@ static int h264_decode_frame(AVCodecContext *avctx, 
> void *data,
>  if (buf_size == 0)
>  return send_next_delayed_frame(h, pict, got_frame, 0);
>  
> -if (h->is_avc && av_packet_get_side_data(avpkt, 
> AV_PKT_DATA_NEW_EXTRADATA, NULL)) {
> -int side_size;
> -uint8_t *side = av_packet_get_side_data(avpkt, 
> AV_PKT_DATA_NEW_EXTRADATA, &side_size);
> -if (is_extra(side, side_size))
> -ff_h264_decode_extradata(side, side_size,
> - &h->ps, &h->is_avc, &h->nal_length_size,
> - avctx->err_recognition, avctx);
> +if ((new_extra = av_packet_get_side_data(avpkt, 
> AV_PKT_DATA_NEW_EXTRADATA, &new_extra_size))) {
> +ff_h264_decode_extradata(new_extra, new_extra_size,
> + &h->ps, &h->is_avc, &h->nal_length_size,
> + avctx->err_recognition, avctx);
>  }
>  if (h->is_avc && buf_size >= 9 && buf[0]==1 && buf[2]==0 && 
> (buf[4]&0xFC)==0xFC) {
>  if (is_extra(buf, buf_size))

This looks similar to
https://patchwork.ffmpeg.org/project/ffmpeg/patch/20200508020929.68603-1-ollywood...@gmail.com/
___
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/7] avcodec/sonic: Fix several integer overflows

2020-06-11 Thread Michael Niedermayer
On Sun, May 10, 2020 at 09:20:16PM +0200, Michael Niedermayer wrote:
> Fixes: signed integer overflow: 2129689466 + 2129689466 cannot be represented 
> in type 'int'
> Fixes: 
> 20715/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SONIC_fuzzer-5155263109922816
> 
> Found-by: continuous fuzzing process 
> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer 
> ---
>  libavcodec/sonic.c | 7 ---
>  1 file changed, 4 insertions(+), 3 deletions(-)

will apply soon unless i hear objections

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

If the United States is serious about tackling the national security threats 
related to an insecure 5G network, it needs to rethink the extent to which it
values corporate profits and government espionage over security.-Bruce Schneier


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

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

Re: [FFmpeg-devel] [PATCH 5/7] avcodec/sonic: Fix several integer state overflows

2020-06-11 Thread Michael Niedermayer
On Wed, May 20, 2020 at 08:59:20PM +0200, Michael Niedermayer wrote:
> On Mon, May 11, 2020 at 01:07:54AM +0200, Paul B Mahol wrote:
> > NAK
> > 
> > please remove this code fully.
> 
> Id like to apply this and backport to the releases branches because
> sonic is in the releases
> are you ok with that ?

will apply soon unless i hear objections

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

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


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
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] tools/target_dem_fuzzer: Use file extensions listed in input formats

2020-06-11 Thread Michael Niedermayer
On Mon, Jun 08, 2020 at 12:14:51PM +0200, Michael Niedermayer wrote:
> This should make it easier for the fuzzer to fuzz formats being detected only 
> by
> file extension and thus increase coverage
> 
> Signed-off-by: Michael Niedermayer 
> ---
>  tools/target_dem_fuzzer.c | 27 ++-
>  1 file changed, 26 insertions(+), 1 deletion(-)

will apply

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

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


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

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

Re: [FFmpeg-devel] [PATCH 2/5] lavc: add avpriv_h264_get_profile

2020-06-11 Thread James Almer
On 6/11/2020 1:43 AM, rcombs wrote:
> ---
>  libavcodec/h264_parse.c | 21 +
>  libavcodec/h264_parse.h |  2 ++
>  libavcodec/version.h|  2 +-
>  3 files changed, 20 insertions(+), 5 deletions(-)
> 
> diff --git a/libavcodec/h264_parse.c b/libavcodec/h264_parse.c
> index 352ffea948..3069579926 100644
> --- a/libavcodec/h264_parse.c
> +++ b/libavcodec/h264_parse.c
> @@ -528,18 +528,31 @@ int ff_h264_decode_extradata(const uint8_t *data, int 
> size, H264ParamSets *ps,
>   */
>  int ff_h264_get_profile(const SPS *sps)
>  {
> -int profile = sps->profile_idc;
> +return avpriv_h264_get_profile(sps->profile_idc, 
> sps->constraint_set_flags);
> +}
> +
> +/**
> + * Compute profile from profile_idc and constraint_set?_flags.
> + *
> + * @param profile_idc profile_idc field from SPS
> + * @param constraint_set_flags constraint_set_flags field from SPS
> + *
> + * @return profile as defined by FF_PROFILE_H264_*
> + */
> +int avpriv_h264_get_profile(int profile_idc, int constraint_set_flags)
> +{
> +int profile = profile_idc;
>  
> -switch (sps->profile_idc) {
> +switch (profile_idc) {
>  case FF_PROFILE_H264_BASELINE:
>  // constraint_set1_flag set to 1
> -profile |= (sps->constraint_set_flags & 1 << 1) ? 
> FF_PROFILE_H264_CONSTRAINED : 0;
> +profile |= (constraint_set_flags & 1 << 1) ? 
> FF_PROFILE_H264_CONSTRAINED : 0;
>  break;
>  case FF_PROFILE_H264_HIGH_10:
>  case FF_PROFILE_H264_HIGH_422:
>  case FF_PROFILE_H264_HIGH_444_PREDICTIVE:
>  // constraint_set3_flag set to 1
> -profile |= (sps->constraint_set_flags & 1 << 3) ? 
> FF_PROFILE_H264_INTRA : 0;
> +profile |= (constraint_set_flags & 1 << 3) ? FF_PROFILE_H264_INTRA : 
> 0;
>  break;
>  }
>  
> diff --git a/libavcodec/h264_parse.h b/libavcodec/h264_parse.h
> index 4d01620125..a1462ad8fd 100644
> --- a/libavcodec/h264_parse.h
> +++ b/libavcodec/h264_parse.h
> @@ -90,4 +90,6 @@ int ff_h264_decode_extradata(const uint8_t *data, int size, 
> H264ParamSets *ps,
>   */
>  int ff_h264_get_profile(const SPS *sps);
>  
> +int avpriv_h264_get_profile(int profile_idc, int constraint_set_flags);
> +
>  #endif /* AVCODEC_H264_PARSE_H */
> diff --git a/libavcodec/version.h b/libavcodec/version.h
> index 60c0f2460d..03593026b3 100644
> --- a/libavcodec/version.h
> +++ b/libavcodec/version.h
> @@ -28,7 +28,7 @@
>  #include "libavutil/version.h"
>  
>  #define LIBAVCODEC_VERSION_MAJOR  58
> -#define LIBAVCODEC_VERSION_MINOR  92
> +#define LIBAVCODEC_VERSION_MINOR  93

avpriv functions are not public, so this is not needed.

>  #define LIBAVCODEC_VERSION_MICRO 100
>  
>  #define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
> 

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

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

Re: [FFmpeg-devel] [PATCH 1/2] avcodec/movtextdec: Fix shift overflows in mov_text_init()

2020-06-11 Thread Michael Niedermayer
On Fri, Jun 05, 2020 at 10:41:58PM +0200, Michael Niedermayer wrote:
> Fixes: left shift of 243 by 24 places cannot be represented in type 'int'
> Fixes: 
> 22716/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MOVTEXT_fuzzer-5704263425851392
> 
> Found-by: continuous fuzzing process 
> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer 
> ---
>  libavcodec/movtextdec.c | 8 
>  1 file changed, 4 insertions(+), 4 deletions(-)

will apply

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

No human being will ever know the Truth, for even if they happen to say it
by chance, they would not even known they had done so. -- Xenophanes


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

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

Re: [FFmpeg-devel] [PATCH 2/3] avcodec/snowdec: Avoid integer overflow with huge qlog

2020-06-11 Thread Michael Niedermayer
On Sat, Jun 06, 2020 at 06:03:46PM +0200, Michael Niedermayer wrote:
> Fixes: integer overflow
> Fixes: 
> 22285/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SNOW_fuzzer-5682428762128384
> 
> Found-by: continuous fuzzing process 
> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer 
> ---
>  libavcodec/snowdec.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

will apply

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

Dictatorship: All citizens are under surveillance, all their steps and
actions recorded, for the politicians to enforce control.
Democracy: All politicians are under surveillance, all their steps and
actions recorded, for the citizens to enforce control.


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 3/3] avcodec/mpeg12dec: remove outdated comments

2020-06-11 Thread Michael Niedermayer
On Sat, Jun 06, 2020 at 08:08:15PM +0200, Michael Niedermayer wrote:
> Found-by: Kieran
> Signed-off-by: Michael Niedermayer 
> ---
>  libavcodec/mpeg12dec.c | 3 ---
>  1 file changed, 3 deletions(-)

will apply

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

Nations do behave wisely once they have exhausted all other alternatives. 
-- Abba Eban


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

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

Re: [FFmpeg-devel] [PATCH 2/3] tools/target_dec_fuzzer: Adjust threshold for lagarith

2020-06-11 Thread Michael Niedermayer
On Sun, Jun 07, 2020 at 09:35:44PM +0200, Michael Niedermayer wrote:
> Fixes: Timeout (3minute 49 sec -> 3sec)
> Fixes: 
> 22020/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_LAGARITH_fuzzer-5708544679870464
> 
> Found-by: continuous fuzzing process 
> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer 
> ---
>  tools/target_dec_fuzzer.c | 1 +
>  1 file changed, 1 insertion(+)

will aply

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

The greatest way to live with honor in this world is to be what we pretend
to be. -- Socrates


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 v4 24/24] avutil/internal: remove FF_ALLOCx{_ARRAY}_OR_GOTO macros

2020-06-11 Thread Nicolas George
lance.lmw...@gmail.com (12020-06-11):
> I'll apply the patch set in next two days if no further comments still. 
> Please help to
> review if you think it's necessary.

Please do not include my name in the commit message.

Regards,

-- 
  Nicolas George


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

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

Re: [FFmpeg-devel] [PATCH v4 24/24] avutil/internal: remove FF_ALLOCx{_ARRAY}_OR_GOTO macros

2020-06-11 Thread lance . lmwang
On Tue, Jun 02, 2020 at 11:26:58PM +0800, lance.lmw...@gmail.com wrote:
> From: Limin Wang 
> 
> Nicolas George comments for the macros:
> These functions have a terrible design, let us fix them before extending
> them.
> First design mistake: no error code. A helper function for testing
> memory allocation failure where AVERROR(ENOMEM) does not appear is
> absurd.
> 
> Second design mistake: printing a message. Return the error code, let
> the caller print the error message.
> 
> Third design mistake: hard-coded use of goto.
> 
> http://ffmpeg.org/pipermail/ffmpeg-devel/2020-May/262544.html
> 
> Signed-off-by: Limin Wang 
> ---
>  libavutil/internal.h | 36 
>  1 file changed, 36 deletions(-)
> 
> diff --git a/libavutil/internal.h b/libavutil/internal.h
> index 00f1a57..b87cc6d 100644
> --- a/libavutil/internal.h
> +++ b/libavutil/internal.h
> @@ -140,42 +140,6 @@
>  #define FF_ALLOC_TYPED_ARRAY(p, nelem)  (p = av_malloc_array(nelem, 
> sizeof(*p)))
>  #define FF_ALLOCZ_TYPED_ARRAY(p, nelem) (p = av_mallocz_array(nelem, 
> sizeof(*p)))
>  
> -#define FF_ALLOC_OR_GOTO(ctx, p, size, label)\
> -{\
> -p = av_malloc(size);\
> -if (!(p) && (size) != 0) {\
> -av_log(ctx, AV_LOG_ERROR, "Cannot allocate memory.\n");\
> -goto label;\
> -}\
> -}
> -
> -#define FF_ALLOCZ_OR_GOTO(ctx, p, size, label)\
> -{\
> -p = av_mallocz(size);\
> -if (!(p) && (size) != 0) {\
> -av_log(ctx, AV_LOG_ERROR, "Cannot allocate memory.\n");\
> -goto label;\
> -}\
> -}
> -
> -#define FF_ALLOC_ARRAY_OR_GOTO(ctx, p, nelem, elsize, label)\
> -{\
> -p = av_malloc_array(nelem, elsize);\
> -if (!p) {\
> -av_log(ctx, AV_LOG_ERROR, "Cannot allocate memory.\n");\
> -goto label;\
> -}\
> -}
> -
> -#define FF_ALLOCZ_ARRAY_OR_GOTO(ctx, p, nelem, elsize, label)\
> -{\
> -p = av_mallocz_array(nelem, elsize);\
> -if (!p) {\
> -av_log(ctx, AV_LOG_ERROR, "Cannot allocate memory.\n");\
> -goto label;\
> -}\
> -}
> -
>  #include "libm.h"
>  
>  /**
> -- 
> 1.8.3.1
> 

I'll apply the patch set in next two days if no further comments still. Please 
help to
review if you think it's necessary.


-- 
Thanks,
Limin Wang
___
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 v12 4/4] avcodec/h264: create user data unregistered SEI side data for H.264

2020-06-11 Thread lance . lmwang
From: Limin Wang 

Signed-off-by: Limin Wang 
---
 libavcodec/h264_sei.c |  19 -
 libavcodec/h264_sei.h |   2 +
 libavcodec/h264_slice.c   |  14 
 tests/ref/fate/mov-zombie | 195 ++
 4 files changed, 162 insertions(+), 68 deletions(-)

diff --git a/libavcodec/h264_sei.c b/libavcodec/h264_sei.c
index 870dd90..7b8e6bd 100644
--- a/libavcodec/h264_sei.c
+++ b/libavcodec/h264_sei.c
@@ -52,6 +52,10 @@ void ff_h264_sei_uninit(H264SEIContext *h)
 h->afd.present =  0;
 
 av_buffer_unref(&h->a53_caption.buf_ref);
+for (int i = 0; i < h->unregistered.nb_buf_ref; i++)
+av_buffer_unref(&h->unregistered.buf_ref[i]);
+h->unregistered.nb_buf_ref = 0;
+av_freep(&h->unregistered.buf_ref);
 }
 
 int ff_h264_sei_process_picture_timing(H264SEIPictureTiming *h, const SPS *sps,
@@ -260,25 +264,34 @@ static int 
decode_unregistered_user_data(H264SEIUnregistered *h, GetBitContext *
 {
 uint8_t *user_data;
 int e, build, i;
+AVBufferRef *buf_ref, **tmp;
 
 if (size < 16 || size >= INT_MAX - 1)
 return AVERROR_INVALIDDATA;
 
-user_data = av_malloc(size + 1);
-if (!user_data)
+tmp = av_realloc_array(h->buf_ref, h->nb_buf_ref + 1, sizeof(*h->buf_ref));
+if (!tmp)
 return AVERROR(ENOMEM);
+h->buf_ref = tmp;
+
+buf_ref = av_buffer_alloc(size + 1);
+if (!buf_ref)
+return AVERROR(ENOMEM);
+user_data = buf_ref->data;
 
 for (i = 0; i < size; i++)
 user_data[i] = get_bits(gb, 8);
 
 user_data[i] = 0;
+buf_ref->size = size;
+h->buf_ref[h->nb_buf_ref++] = buf_ref;
+
 e = sscanf(user_data + 16, "x264 - core %d", &build);
 if (e == 1 && build > 0)
 h->x264_build = build;
 if (e == 1 && build == 1 && !strncmp(user_data+16, "x264 - core ", 16))
 h->x264_build = 67;
 
-av_free(user_data);
 return 0;
 }
 
diff --git a/libavcodec/h264_sei.h b/libavcodec/h264_sei.h
index f07a505..4fdcf4e 100644
--- a/libavcodec/h264_sei.h
+++ b/libavcodec/h264_sei.h
@@ -126,6 +126,8 @@ typedef struct H264SEIA53Caption {
 
 typedef struct H264SEIUnregistered {
 int x264_build;
+AVBufferRef **buf_ref;
+int nb_buf_ref;
 } H264SEIUnregistered;
 
 typedef struct H264SEIRecoveryPoint {
diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c
index 7139537..47f3917 100644
--- a/libavcodec/h264_slice.c
+++ b/libavcodec/h264_slice.c
@@ -1289,6 +1289,20 @@ static int h264_export_frame_props(H264Context *h)
 h->avctx->properties |= FF_CODEC_PROPERTY_CLOSED_CAPTIONS;
 }
 
+for (int i = 0; i < h->sei.unregistered.nb_buf_ref; i++) {
+H264SEIUnregistered *unreg = &h->sei.unregistered;
+
+if (unreg->buf_ref[i]) {
+AVFrameSideData *sd = av_frame_new_side_data_from_buf(cur->f,
+AV_FRAME_DATA_SEI_UNREGISTERED,
+unreg->buf_ref[i]);
+if (!sd)
+av_buffer_unref(&unreg->buf_ref[i]);
+unreg->buf_ref[i] = NULL;
+}
+}
+h->sei.unregistered.nb_buf_ref = 0;
+
 if (h->sei.picture_timing.timecode_cnt > 0) {
 uint32_t tc = 0;
 uint32_t *tc_sd;
diff --git a/tests/ref/fate/mov-zombie b/tests/ref/fate/mov-zombie
index 445f921..1a6625b 100644
--- a/tests/ref/fate/mov-zombie
+++ b/tests/ref/fate/mov-zombie
@@ -1,133 +1,198 @@
 
packet|codec_type=video|stream_index=0|pts=0|pts_time=0.00|dts=-3004|dts_time=-0.033378|duration=3003|duration_time=0.033367|convergence_duration=N/A|convergence_duration_time=N/A|size=4133|pos=11309|flags=K_
 
packet|codec_type=video|stream_index=0|pts=5440|pts_time=0.060444|dts=-567|dts_time=-0.006300|duration=3003|duration_time=0.033367|convergence_duration=N/A|convergence_duration_time=N/A|size=1077|pos=15442|flags=__
-frame|media_type=video|stream_index=0|key_frame=1|pkt_pts=0|pkt_pts_time=0.00|pkt_dts=-567|pkt_dts_time=-0.006300|best_effort_timestamp=0|best_effort_timestamp_time=0.00|pkt_duration=3003|pkt_duration_time=0.033367|pkt_pos=11309|pkt_size=4133|width=160|height=240|pix_fmt=yuv420p|sample_aspect_ratio=2:1|pict_type=I|coded_picture_number=0|display_picture_number=0|interlaced_frame=0|top_field_first=0|repeat_pict=0|color_range=tv|color_space=smpte170m|color_primaries=smpte170m|color_transfer=bt709|chroma_location=topleft
+frame|media_type=video|stream_index=0|key_frame=1|pkt_pts=0|pkt_pts_time=0.00|pkt_dts=-567|pkt_dts_time=-0.006300|best_effort_timestamp=0|best_effort_timestamp_time=0.00|pkt_duration=3003|pkt_duration_time=0.033367|pkt_pos=11309|pkt_size=4133|width=160|height=240|pix_fmt=yuv420p|sample_aspect_ratio=2:1|pict_type=I|coded_picture_number=0|display_picture_number=0|interlaced_frame=0|top_field_first=0|repeat_pict=0|color_range=tv|color_space=smpte170m|color_primaries=smpte170m|color_transfer=bt709|chroma_location=topleftside_data|side_data_type=H.26[45]
 User Data Unregistered SEI message
+
 
packet|codec_type=video|strea

[FFmpeg-devel] [PATCH v12 3/4] avfilter/vf_showinfo: display H.26[45] user data unregistered sei message

2020-06-11 Thread lance . lmwang
From: Limin Wang 

Signed-off-by: Limin Wang 
---
 libavfilter/vf_showinfo.c | 37 +
 1 file changed, 37 insertions(+)

diff --git a/libavfilter/vf_showinfo.c b/libavfilter/vf_showinfo.c
index 5d4aee4..3658234 100644
--- a/libavfilter/vf_showinfo.c
+++ b/libavfilter/vf_showinfo.c
@@ -37,6 +37,7 @@
 #include "libavutil/timecode.h"
 #include "libavutil/mastering_display_metadata.h"
 #include "libavutil/video_enc_params.h"
+#include "libavutil/avstring.h"
 
 #include "avfilter.h"
 #include "internal.h"
@@ -190,6 +191,39 @@ static void dump_video_enc_params(AVFilterContext *ctx, 
AVFrameSideData *sd)
 av_log(ctx, AV_LOG_INFO, "%u blocks; ", par->nb_blocks);
 }
 
+static int string_is_print(const uint8_t *str)
+{
+while (*str && *str >= 0x20 && *str <= 0x7e ) str++;
+return !*str;
+}
+
+static void dump_sei_unregistered_metadata(AVFilterContext *ctx, 
AVFrameSideData *sd)
+{
+const int uuid_size = 16;
+uint8_t *user_data = sd->data;
+
+if (sd->size < uuid_size) {
+av_log(ctx, AV_LOG_ERROR, "invalid data(%d < UUID(%d-bytes))", 
sd->size, uuid_size);
+return;
+}
+
+av_log(ctx, AV_LOG_INFO, "User Data Unregistered:\n");
+av_log(ctx, AV_LOG_INFO, "UUID=");
+for (int i = 0; i < uuid_size; i++) {
+av_log(ctx, AV_LOG_INFO, "%02x", user_data[i]);
+if (i == 3 || i == 5 || i == 7 || i == 9)
+av_log(ctx, AV_LOG_INFO, "-");
+}
+av_log(ctx, AV_LOG_INFO, "\n");
+
+user_data += uuid_size;
+/* Only print the user data details if it's string or partial string*/
+if (string_is_print(user_data)) {
+av_log(ctx, AV_LOG_INFO, "User Data=");
+av_log(ctx, AV_LOG_INFO, "%s", user_data);
+}
+}
+
 static void dump_color_property(AVFilterContext *ctx, AVFrame *frame)
 {
 const char *color_range_str = av_color_range_name(frame->color_range);
@@ -375,6 +409,9 @@ static int filter_frame(AVFilterLink *inlink, AVFrame 
*frame)
 case AV_FRAME_DATA_VIDEO_ENC_PARAMS:
 dump_video_enc_params(ctx, sd);
 break;
+case AV_FRAME_DATA_SEI_UNREGISTERED:
+dump_sei_unregistered_metadata(ctx, sd);
+break;
 default:
 av_log(ctx, AV_LOG_WARNING, "unknown side data type %d (%d bytes)",
sd->type, sd->size);
-- 
1.8.3.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 v12 2/4] avcodec/hevc_sei: add support for user data unregistered SEI message

2020-06-11 Thread lance . lmwang
From: Limin Wang 

Signed-off-by: Limin Wang 
---
 libavcodec/hevc_sei.c   | 33 +
 libavcodec/hevc_sei.h   |  6 ++
 libavcodec/hevcdec.c| 14 ++
 tests/ref/fate/hevc-monochrome-crop |  3 +++
 4 files changed, 56 insertions(+)

diff --git a/libavcodec/hevc_sei.c b/libavcodec/hevc_sei.c
index 6057069..1736891 100644
--- a/libavcodec/hevc_sei.c
+++ b/libavcodec/hevc_sei.c
@@ -213,6 +213,32 @@ static int 
decode_registered_user_data_closed_caption(HEVCSEIA53Caption *s, GetB
 return 0;
 }
 
+static int decode_nal_sei_user_data_unregistered(HEVCSEIUnregistered *s, 
GetBitContext *gb,
+  int size)
+{
+AVBufferRef *buf_ref, **tmp;
+
+if (size < 16 || size >= INT_MAX - 1)
+   return AVERROR_INVALIDDATA;
+
+tmp = av_realloc_array(s->buf_ref, s->nb_buf_ref + 1, sizeof(*s->buf_ref));
+if (!tmp)
+return AVERROR(ENOMEM);
+s->buf_ref = tmp;
+
+buf_ref = av_buffer_alloc(size + 1);
+if (!buf_ref)
+return AVERROR(ENOMEM);
+
+for (int i = 0; i < size; i++)
+buf_ref->data[i] = get_bits(gb, 8);
+buf_ref->data[size] = 0;
+buf_ref->size = size;
+s->buf_ref[s->nb_buf_ref++] = buf_ref;
+
+return 0;
+}
+
 static int decode_nal_sei_user_data_registered_itu_t_t35(HEVCSEI *s, 
GetBitContext *gb,
  int size)
 {
@@ -300,6 +326,8 @@ static int decode_nal_sei_prefix(GetBitContext *gb, void 
*logctx, HEVCSEI *s,
 return decode_nal_sei_active_parameter_sets(s, gb, logctx);
 case HEVC_SEI_TYPE_USER_DATA_REGISTERED_ITU_T_T35:
 return decode_nal_sei_user_data_registered_itu_t_t35(s, gb, size);
+case HEVC_SEI_TYPE_USER_DATA_UNREGISTERED:
+return decode_nal_sei_user_data_unregistered(&s->unregistered, gb, 
size);
 case HEVC_SEI_TYPE_ALTERNATIVE_TRANSFER_CHARACTERISTICS:
 return decode_nal_sei_alternative_transfer(&s->alternative_transfer, 
gb);
 default:
@@ -371,4 +399,9 @@ int ff_hevc_decode_nal_sei(GetBitContext *gb, void *logctx, 
HEVCSEI *s,
 void ff_hevc_reset_sei(HEVCSEI *s)
 {
 av_buffer_unref(&s->a53_caption.buf_ref);
+
+for (int i = 0; i < s->unregistered.nb_buf_ref; i++)
+av_buffer_unref(&s->unregistered.buf_ref[i]);
+s->unregistered.nb_buf_ref = 0;
+av_freep(&s->unregistered.buf_ref);
 }
diff --git a/libavcodec/hevc_sei.h b/libavcodec/hevc_sei.h
index a44ccca..3618d16 100644
--- a/libavcodec/hevc_sei.h
+++ b/libavcodec/hevc_sei.h
@@ -91,6 +91,11 @@ typedef struct HEVCSEIA53Caption {
 AVBufferRef *buf_ref;
 } HEVCSEIA53Caption;
 
+typedef struct HEVCSEIUnregistered {
+AVBufferRef **buf_ref;
+int nb_buf_ref;
+} HEVCSEIUnregistered;
+
 typedef struct HEVCSEIMasteringDisplay {
 int present;
 uint16_t display_primaries[3][2];
@@ -116,6 +121,7 @@ typedef struct HEVCSEI {
 HEVCSEIDisplayOrientation display_orientation;
 HEVCSEIPictureTiming picture_timing;
 HEVCSEIA53Caption a53_caption;
+HEVCSEIUnregistered unregistered;
 HEVCSEIMasteringDisplay mastering_display;
 HEVCSEIContentLight content_light;
 int active_seq_parameter_set_id;
diff --git a/libavcodec/hevcdec.c b/libavcodec/hevcdec.c
index 0772608..c9e28f5 100644
--- a/libavcodec/hevcdec.c
+++ b/libavcodec/hevcdec.c
@@ -2794,6 +2794,20 @@ static int set_side_data(HEVCContext *s)
 s->avctx->properties |= FF_CODEC_PROPERTY_CLOSED_CAPTIONS;
 }
 
+for (int i = 0; i < s->sei.unregistered.nb_buf_ref; i++) {
+HEVCSEIUnregistered *unreg = &s->sei.unregistered;
+
+if (unreg->buf_ref[i]) {
+AVFrameSideData *sd = av_frame_new_side_data_from_buf(out,
+AV_FRAME_DATA_SEI_UNREGISTERED,
+unreg->buf_ref[i]);
+if (!sd)
+av_buffer_unref(&unreg->buf_ref[i]);
+unreg->buf_ref[i] = NULL;
+}
+}
+s->sei.unregistered.nb_buf_ref = 0;
+
 return 0;
 }
 
diff --git a/tests/ref/fate/hevc-monochrome-crop 
b/tests/ref/fate/hevc-monochrome-crop
index 4e45412..384404d 100644
--- a/tests/ref/fate/hevc-monochrome-crop
+++ b/tests/ref/fate/hevc-monochrome-crop
@@ -1,6 +1,9 @@
 [FRAME]
 width=384
 height=240
+[SIDE_DATA]
+side_data_type=H.26[45] User Data Unregistered SEI message
+[/SIDE_DATA]
 [/FRAME]
 [STREAM]
 width=384
-- 
1.8.3.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/5] lavc: add avpriv_h264_get_profile

2020-06-11 Thread rcombs
---
 libavcodec/h264_parse.c | 21 +
 libavcodec/h264_parse.h |  2 ++
 libavcodec/version.h|  2 +-
 3 files changed, 20 insertions(+), 5 deletions(-)

diff --git a/libavcodec/h264_parse.c b/libavcodec/h264_parse.c
index 352ffea948..3069579926 100644
--- a/libavcodec/h264_parse.c
+++ b/libavcodec/h264_parse.c
@@ -528,18 +528,31 @@ int ff_h264_decode_extradata(const uint8_t *data, int 
size, H264ParamSets *ps,
  */
 int ff_h264_get_profile(const SPS *sps)
 {
-int profile = sps->profile_idc;
+return avpriv_h264_get_profile(sps->profile_idc, 
sps->constraint_set_flags);
+}
+
+/**
+ * Compute profile from profile_idc and constraint_set?_flags.
+ *
+ * @param profile_idc profile_idc field from SPS
+ * @param constraint_set_flags constraint_set_flags field from SPS
+ *
+ * @return profile as defined by FF_PROFILE_H264_*
+ */
+int avpriv_h264_get_profile(int profile_idc, int constraint_set_flags)
+{
+int profile = profile_idc;
 
-switch (sps->profile_idc) {
+switch (profile_idc) {
 case FF_PROFILE_H264_BASELINE:
 // constraint_set1_flag set to 1
-profile |= (sps->constraint_set_flags & 1 << 1) ? 
FF_PROFILE_H264_CONSTRAINED : 0;
+profile |= (constraint_set_flags & 1 << 1) ? 
FF_PROFILE_H264_CONSTRAINED : 0;
 break;
 case FF_PROFILE_H264_HIGH_10:
 case FF_PROFILE_H264_HIGH_422:
 case FF_PROFILE_H264_HIGH_444_PREDICTIVE:
 // constraint_set3_flag set to 1
-profile |= (sps->constraint_set_flags & 1 << 3) ? 
FF_PROFILE_H264_INTRA : 0;
+profile |= (constraint_set_flags & 1 << 3) ? FF_PROFILE_H264_INTRA : 0;
 break;
 }
 
diff --git a/libavcodec/h264_parse.h b/libavcodec/h264_parse.h
index 4d01620125..a1462ad8fd 100644
--- a/libavcodec/h264_parse.h
+++ b/libavcodec/h264_parse.h
@@ -90,4 +90,6 @@ int ff_h264_decode_extradata(const uint8_t *data, int size, 
H264ParamSets *ps,
  */
 int ff_h264_get_profile(const SPS *sps);
 
+int avpriv_h264_get_profile(int profile_idc, int constraint_set_flags);
+
 #endif /* AVCODEC_H264_PARSE_H */
diff --git a/libavcodec/version.h b/libavcodec/version.h
index 60c0f2460d..03593026b3 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -28,7 +28,7 @@
 #include "libavutil/version.h"
 
 #define LIBAVCODEC_VERSION_MAJOR  58
-#define LIBAVCODEC_VERSION_MINOR  92
+#define LIBAVCODEC_VERSION_MINOR  93
 #define LIBAVCODEC_VERSION_MICRO 100
 
 #define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
-- 
2.26.2

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

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

[FFmpeg-devel] [PATCH 5/5] lavf/dashdec: don't require opening all playlists during read_header

2020-06-11 Thread rcombs
This improves startup performance massively when the consumer doesn't make
a call to avformat_find_stream_info().
Also makes the requirement that each rendition only have 1 stream more clear
(this is required by DASH), and generally improves error handling.
---
 libavformat/dashdec.c | 283 +++---
 libavformat/version.h |   2 +-
 2 files changed, 265 insertions(+), 20 deletions(-)

diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c
index 378c892b87..b04a2596a9 100644
--- a/libavformat/dashdec.c
+++ b/libavformat/dashdec.c
@@ -27,6 +27,11 @@
 #include "internal.h"
 #include "avio_internal.h"
 #include "dash.h"
+#include "isom.h"
+
+#if CONFIG_H264PARSE
+#include "libavcodec/h264_parse.h"
+#endif
 
 #define INITIAL_BUFFER_SIZE 32768
 #define MAX_MANIFEST_SIZE 50 * 1024
@@ -112,6 +117,14 @@ struct representation {
 int64_t cur_seg_size;
 struct fragment *cur_seg;
 
+/* Media parameters */
+char *mimeType;
+char *codecs;
+char *audioSamplingRate;
+char *sar;
+char *width;
+char *height;
+
 /* Currently active Media Initialization Section */
 struct fragment *init_section;
 uint8_t *init_sec_buf;
@@ -120,6 +133,12 @@ struct representation {
 uint32_t init_sec_buf_read_offset;
 int64_t cur_timestamp;
 int is_restart_needed;
+
+int streams_initialized;
+int open_failed;
+
+char *new_extradata;
+int new_extradata_size;
 };
 
 typedef struct DASHContext {
@@ -152,6 +171,7 @@ typedef struct DASHContext {
 char *allowed_extensions;
 AVDictionary *avio_opts;
 int max_url_size;
+int open_all;
 
 /* Flags for init section*/
 int is_init_section_common_video;
@@ -369,6 +389,11 @@ static void free_representation(struct representation *pls)
 }
 
 xml_freep(&pls->lang);
+xml_freep(&pls->mimeType);
+xml_freep(&pls->codecs);
+xml_freep(&pls->audioSamplingRate);
+xml_freep(&pls->width);
+xml_freep(&pls->height);
 
 av_freep(&pls->url_template);
 av_freep(&pls);
@@ -888,6 +913,16 @@ static int parse_manifest_representation(AVFormatContext 
*s, const char *url,
 }
 
 rep->lang = xmlGetProp(adaptationset_node, "lang");
+#define GET_VALUE(name) \
+if (!(rep->name = xmlGetProp(node, #name))) \
+rep->name = xmlGetProp(adaptationset_node, #name)
+
+GET_VALUE(mimeType);
+GET_VALUE(codecs);
+GET_VALUE(audioSamplingRate);
+GET_VALUE(sar);
+GET_VALUE(width);
+GET_VALUE(height);
 
 rep->parent = s;
 representation_segmenttemplate_node = 
find_child_node_by_name(representation_node, "SegmentTemplate");
@@ -1905,7 +1940,7 @@ static int reopen_demux_for_component(AVFormatContext *s, 
struct representation
 ff_const59 AVInputFormat *in_fmt = NULL;
 AVDictionary  *in_fmt_opts = NULL;
 uint8_t *avio_ctx_buffer  = NULL;
-int ret = 0, i;
+int ret = 0;
 
 if (pls->ctx) {
 close_demux_for_component(pls);
@@ -1969,12 +2004,14 @@ static int reopen_demux_for_component(AVFormatContext 
*s, struct representation
 av_dict_free(&in_fmt_opts);
 if (ret < 0)
 goto fail;
+if (pls->ctx->nb_streams < 1) {
+ret = AVERROR_INVALIDDATA;
+goto fail;
+}
 if (pls->n_fragments) {
 #if FF_API_R_FRAME_RATE
-if (pls->framerate.den) {
-for (i = 0; i < pls->ctx->nb_streams; i++)
-pls->ctx->streams[i]->r_frame_rate = pls->framerate;
-}
+if (pls->framerate.den)
+pls->ctx->streams[0]->r_frame_rate = pls->framerate;
 #endif
 ret = avformat_find_stream_info(pls->ctx, NULL);
 if (ret < 0)
@@ -1985,10 +2022,157 @@ fail:
 return ret;
 }
 
+static int parse_codecs(AVFormatContext *s, AVCodecParameters *params, const 
struct representation *pls)
+{
+if (pls->mimeType && !strcmp(pls->mimeType, "text/vtt")) {
+params->codec_id = AV_CODEC_ID_WEBVTT;
+return 1;
+} else if (pls->mimeType && !strcmp(pls->mimeType, 
"application/ttml+xml")) {
+params->codec_id = AV_CODEC_ID_TTML;
+return 1;
+} else if (!pls->codecs) {
+return 0;
+} else if (!strncmp(pls->codecs, "avc1.", 5) ||
+   !strncmp(pls->codecs, "avc3.", 5)) {
+int len = strlen(pls->codecs);
+
+params->codec_id = AV_CODEC_ID_H264;
+
+if (len >= 11) {
+char buf[3] = {0};
+char *end = NULL;
+int profile_idc, level_idc;
+
+memcpy(buf, pls->codecs + 5, 2);
+profile_idc = strtoul(buf, &end, 16);
+if (end == &buf[2]) {
+#if CONFIG_H264PARSE
+int constraint_set_flags;
+memcpy(buf, pls->codecs + 7, 2);
+constraint_set_flags = strtoul(buf, &end, 16);
+if (end != &buf[2]) // If this isn't a hex byte, assume no 
constraints
+constraint_set_flags = 0;
+
+

[FFmpeg-devel] [PATCH 4/5] lavf/dashdec: improve memory handling

2020-06-11 Thread rcombs
- Fixes a couple leaks
- Adds an av_freep equivalent for libxml buffers
- Avoids some redundant copying
---
 libavformat/dashdec.c | 44 +++
 1 file changed, 24 insertions(+), 20 deletions(-)

diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c
index c94ce2caca..378c892b87 100644
--- a/libavformat/dashdec.c
+++ b/libavformat/dashdec.c
@@ -147,9 +147,6 @@ typedef struct DASHContext {
 uint64_t period_duration;
 uint64_t period_start;
 
-/* AdaptationSet Attribute */
-char *adaptationset_lang;
-
 int is_live;
 AVIOInterruptCB *interrupt_callback;
 char *allowed_extensions;
@@ -162,6 +159,15 @@ typedef struct DASHContext {
 
 } DASHContext;
 
+static void xml_freep(void* arg)
+{
+void *val;
+
+memcpy(&val, arg, sizeof(val));
+memcpy(arg, &(void *){ NULL }, sizeof(val));
+xmlFree(val);
+}
+
 static int ishttp(char *url)
 {
 const char *proto_name = avio_find_protocol_name(url);
@@ -362,6 +368,8 @@ static void free_representation(struct representation *pls)
 avformat_close_input(&pls->ctx);
 }
 
+xml_freep(&pls->lang);
+
 av_freep(&pls->url_template);
 av_freep(&pls);
 }
@@ -878,15 +886,9 @@ static int parse_manifest_representation(AVFormatContext 
*s, const char *url,
 ret = AVERROR(ENOMEM);
 goto end;
 }
-if (c->adaptationset_lang) {
-rep->lang = av_strdup(c->adaptationset_lang);
-if (!rep->lang) {
-av_log(s, AV_LOG_ERROR, "alloc language memory failure\n");
-av_freep(&rep);
-ret = AVERROR(ENOMEM);
-goto end;
-}
-}
+
+rep->lang = xmlGetProp(adaptationset_node, "lang");
+
 rep->parent = s;
 representation_segmenttemplate_node = 
find_child_node_by_name(representation_node, "SegmentTemplate");
 representation_baseurl_node = 
find_child_node_by_name(representation_node, "BaseURL");
@@ -965,7 +967,8 @@ static int parse_manifest_representation(AVFormatContext 
*s, const char *url,
 xmlFree(startnumber_val);
 }
 if (adaptationset_supplementalproperty_node) {
-if 
(!av_strcasecmp(xmlGetProp(adaptationset_supplementalproperty_node,"schemeIdUri"),
 "http://dashif.org/guidelines/last-segment-number";)) {
+char *schemeIdUri = 
xmlGetProp(adaptationset_supplementalproperty_node, "schemeIdUri");
+if (!av_strcasecmp(schemeIdUri, 
"http://dashif.org/guidelines/last-segment-number";)) {
 val = 
xmlGetProp(adaptationset_supplementalproperty_node,"value");
 if (!val) {
 av_log(s, AV_LOG_ERROR, "Missing value attribute in 
adaptationset_supplementalproperty_node\n");
@@ -974,6 +977,7 @@ static int parse_manifest_representation(AVFormatContext 
*s, const char *url,
 xmlFree(val);
 }
 }
+xmlFree(schemeIdUri);
 }
 
 fragment_timeline_node = 
find_child_node_by_name(representation_segmenttemplate_node, "SegmentTimeline");
@@ -1120,13 +1124,10 @@ end:
 
 static int parse_manifest_adaptationset_attr(AVFormatContext *s, xmlNodePtr 
adaptationset_node)
 {
-DASHContext *c = s->priv_data;
-
 if (!adaptationset_node) {
 av_log(s, AV_LOG_WARNING, "Cannot get AdaptationSet\n");
 return AVERROR(EINVAL);
 }
-c->adaptationset_lang = xmlGetProp(adaptationset_node, "lang");
 
 return 0;
 }
@@ -1139,7 +1140,6 @@ static int parse_manifest_adaptationset(AVFormatContext 
*s, const char *url,
 xmlNodePtr period_segmentlist_node)
 {
 int ret = 0;
-DASHContext *c = s->priv_data;
 xmlNodePtr fragment_template_node = NULL;
 xmlNodePtr content_component_node = NULL;
 xmlNodePtr adaptationset_baseurl_node = NULL;
@@ -1182,7 +1182,6 @@ static int parse_manifest_adaptationset(AVFormatContext 
*s, const char *url,
 }
 
 err:
-av_freep(&c->adaptationset_lang);
 return ret;
 }
 
@@ -2157,6 +2156,10 @@ static int dash_read_header(AVFormatContext *s)
 av_dict_set_int(&rep->assoc_stream->metadata, 
"variant_bitrate", rep->bandwidth, 0);
 if (rep->id[0])
 av_dict_set(&rep->assoc_stream->metadata, "id", rep->id, 0);
+if (rep->lang) {
+av_dict_set(&rep->assoc_stream->metadata, "language", 
rep->lang, 0);
+xml_freep(&rep->lang);
+}
 }
 for (i = 0; i < c->n_audios; i++) {
 rep = c->audios[i];
@@ -2168,7 +2171,7 @@ static int dash_read_header(AVFormatContext *s)
 av_dict_set(&rep->assoc_stream->metadata, "id", rep->id, 0);
 if (rep->lang) {
 av_dict_set(&rep->assoc_stream->metadata, "language", 
rep->lang, 0);
-av_freep(&rep->lang);
+  

[FFmpeg-devel] [PATCH 1/5] lavf/dashdec: fix 'adaption' typo

2020-06-11 Thread rcombs
---
 libavformat/dashdec.c | 96 +--
 1 file changed, 48 insertions(+), 48 deletions(-)

diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c
index 1bd070c7cb..c94ce2caca 100644
--- a/libavformat/dashdec.c
+++ b/libavformat/dashdec.c
@@ -148,7 +148,7 @@ typedef struct DASHContext {
 uint64_t period_start;
 
 /* AdaptationSet Attribute */
-char *adaptionset_lang;
+char *adaptationset_lang;
 
 int is_live;
 AVIOInterruptCB *interrupt_callback;
@@ -822,16 +822,16 @@ end:
 
 static int parse_manifest_representation(AVFormatContext *s, const char *url,
  xmlNodePtr node,
- xmlNodePtr adaptionset_node,
+ xmlNodePtr adaptationset_node,
  xmlNodePtr mpd_baseurl_node,
  xmlNodePtr period_baseurl_node,
  xmlNodePtr 
period_segmenttemplate_node,
  xmlNodePtr period_segmentlist_node,
  xmlNodePtr fragment_template_node,
  xmlNodePtr content_component_node,
- xmlNodePtr adaptionset_baseurl_node,
- xmlNodePtr 
adaptionset_segmentlist_node,
- xmlNodePtr 
adaptionset_supplementalproperty_node)
+ xmlNodePtr adaptationset_baseurl_node,
+ xmlNodePtr 
adaptationset_segmentlist_node,
+ xmlNodePtr 
adaptationset_supplementalproperty_node)
 {
 int32_t ret = 0;
 int32_t subtitle_rep_idx = 0;
@@ -866,9 +866,9 @@ static int parse_manifest_representation(AVFormatContext 
*s, const char *url,
 // try get information from contentComponen
 if (type == AVMEDIA_TYPE_UNKNOWN)
 type = get_content_type(content_component_node);
-// try get information from adaption set
+// try get information from adaptation set
 if (type == AVMEDIA_TYPE_UNKNOWN)
-type = get_content_type(adaptionset_node);
+type = get_content_type(adaptationset_node);
 if (type == AVMEDIA_TYPE_UNKNOWN) {
 av_log(s, AV_LOG_VERBOSE, "Parsing '%s' - skipp not supported 
representation type\n", url);
 } else if (type == AVMEDIA_TYPE_VIDEO || type == AVMEDIA_TYPE_AUDIO || 
type == AVMEDIA_TYPE_SUBTITLE) {
@@ -878,8 +878,8 @@ static int parse_manifest_representation(AVFormatContext 
*s, const char *url,
 ret = AVERROR(ENOMEM);
 goto end;
 }
-if (c->adaptionset_lang) {
-rep->lang = av_strdup(c->adaptionset_lang);
+if (c->adaptationset_lang) {
+rep->lang = av_strdup(c->adaptationset_lang);
 if (!rep->lang) {
 av_log(s, AV_LOG_ERROR, "alloc language memory failure\n");
 av_freep(&rep);
@@ -894,7 +894,7 @@ static int parse_manifest_representation(AVFormatContext 
*s, const char *url,
 
 baseurl_nodes[0] = mpd_baseurl_node;
 baseurl_nodes[1] = period_baseurl_node;
-baseurl_nodes[2] = adaptionset_baseurl_node;
+baseurl_nodes[2] = adaptationset_baseurl_node;
 baseurl_nodes[3] = representation_baseurl_node;
 
 ret = resolve_content_path(s, url, &c->max_url_size, baseurl_nodes, 4);
@@ -907,7 +907,7 @@ static int parse_manifest_representation(AVFormatContext 
*s, const char *url,
 if (representation_segmenttemplate_node || fragment_template_node || 
period_segmenttemplate_node) {
 fragment_timeline_node = NULL;
 fragment_templates_tab[0] = representation_segmenttemplate_node;
-fragment_templates_tab[1] = adaptionset_segmentlist_node;
+fragment_templates_tab[1] = adaptationset_segmentlist_node;
 fragment_templates_tab[2] = fragment_template_node;
 fragment_templates_tab[3] = period_segmenttemplate_node;
 fragment_templates_tab[4] = period_segmentlist_node;
@@ -964,11 +964,11 @@ static int parse_manifest_representation(AVFormatContext 
*s, const char *url,
 av_log(s, AV_LOG_TRACE, "rep->first_seq_no = [%"PRId64"]\n", 
rep->first_seq_no);
 xmlFree(startnumber_val);
 }
-if (adaptionset_supplementalproperty_node) {
-if 
(!av_strcasecmp(xmlGetProp(adaptionset_supplementalproperty_node,"schemeIdUri"),
 "http://dashif.org/guidelines/last-segment-number";)) {
-val = 
xmlGetProp(adaptionset_supplementalproperty_node,"value");
+if (adaptationset_supplementalproperty_node) {
+if 
(!av_strcasecmp(xmlGetProp(adaptationset_supplementalproperty_node,"schemeIdUri"),
 "http://dashif.org/guidelines/last-segment-number

[FFmpeg-devel] [PATCH 3/5] lavc/h264dec: loosen new-extradata check

2020-06-11 Thread rcombs
---
 libavcodec/h264dec.c | 13 ++---
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/libavcodec/h264dec.c b/libavcodec/h264dec.c
index 6270ea80df..0d7492cfad 100644
--- a/libavcodec/h264dec.c
+++ b/libavcodec/h264dec.c
@@ -988,6 +988,8 @@ static int h264_decode_frame(AVCodecContext *avctx, void 
*data,
 AVFrame *pict  = data;
 int buf_index;
 int ret;
+const uint8_t *new_extra;
+int new_extra_size;
 
 h->flags = avctx->flags;
 h->setup_finished = 0;
@@ -999,13 +1001,10 @@ static int h264_decode_frame(AVCodecContext *avctx, void 
*data,
 if (buf_size == 0)
 return send_next_delayed_frame(h, pict, got_frame, 0);
 
-if (h->is_avc && av_packet_get_side_data(avpkt, AV_PKT_DATA_NEW_EXTRADATA, 
NULL)) {
-int side_size;
-uint8_t *side = av_packet_get_side_data(avpkt, 
AV_PKT_DATA_NEW_EXTRADATA, &side_size);
-if (is_extra(side, side_size))
-ff_h264_decode_extradata(side, side_size,
- &h->ps, &h->is_avc, &h->nal_length_size,
- avctx->err_recognition, avctx);
+if ((new_extra = av_packet_get_side_data(avpkt, AV_PKT_DATA_NEW_EXTRADATA, 
&new_extra_size))) {
+ff_h264_decode_extradata(new_extra, new_extra_size,
+ &h->ps, &h->is_avc, &h->nal_length_size,
+ avctx->err_recognition, avctx);
 }
 if (h->is_avc && buf_size >= 9 && buf[0]==1 && buf[2]==0 && 
(buf[4]&0xFC)==0xFC) {
 if (is_extra(buf, buf_size))
-- 
2.26.2

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

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