[FFmpeg-devel] [PATCH] libavcodec/qsvenc.c fixed handling of closed gop flag

2020-04-24 Thread Elio Blanca

Hello,
this is my very first message to this list, so first of all: thank you for your 
huge work!

Now, to the issue: I made this patch for libavcodec/qsvenc.c in order to honor 
the GopOptFlag flag for hevc_qsv encodings (maybe others will be affected 
though).
In statement 513 (the third fix) a wrong value was assigned in case of 
not-closed-gop. Zero is not an allowed value, as the enum mfx.GopOptFlag refers 
to uses only 1 and 2. What the encoding engine will do when feeded with a 
non-valid value is unpredictable.
Then, in statements 148 and 150 I changed those 'if' replacing '&' with '==' 
because of the enum, which is different from a bitmask.

Apart from those, it sound to me quite suspicious having to set -flags 0 in my 
command line in order NOT to get closed gops, as the default is a closed gop (I 
see weird having this as default).
Further, I usually avoid using a signed 'int' for a flag field, which needs to 
be handled with bitmasks, so into libavcodec/avcodec.h I would change those 
'int flags;' and 'int flags2;' using unsigned instead; unless, of course, there 
are solid reasons to have them defined this way.

Elio



diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c
index 9bf8574e30..d363dae633 100644
--- a/libavcodec/qsvenc.c
+++ b/libavcodec/qsvenc.c
@@ -145,9 +145,9 @@ static void dump_video_param(AVCodecContext *avctx, 
QSVEncContext *q,
 
 av_log(avctx, AV_LOG_VERBOSE, "GopPicSize: %"PRIu16"; GopRefDist: 
%"PRIu16"; GopOptFlag: ",
info->GopPicSize, info->GopRefDist);
-if (info->GopOptFlag & MFX_GOP_CLOSED)
+if (info->GopOptFlag == MFX_GOP_CLOSED)
 av_log(avctx, AV_LOG_VERBOSE, "closed ");
-if (info->GopOptFlag & MFX_GOP_STRICT)
+if (info->GopOptFlag == MFX_GOP_STRICT)
 av_log(avctx, AV_LOG_VERBOSE, "strict ");
 av_log(avctx, AV_LOG_VERBOSE, "; IdrInterval: %"PRIu16"\n", 
info->IdrInterval);
 
@@ -510,7 +510,7 @@ static int init_video_param(AVCodecContext *avctx, 
QSVEncContext *q)
 q->param.mfx.GopPicSize = FFMAX(0, avctx->gop_size);
 q->param.mfx.GopRefDist = FFMAX(-1, avctx->max_b_frames) + 1;
 q->param.mfx.GopOptFlag = avctx->flags & AV_CODEC_FLAG_CLOSED_GOP ?
-  MFX_GOP_CLOSED : 0;
+  MFX_GOP_CLOSED : MFX_GOP_STRICT;
 q->param.mfx.IdrInterval= q->idr_interval;
 q->param.mfx.NumSlice   = avctx->slices;
 q->param.mfx.NumRefFrame= FFMAX(0, avctx->refs);

___
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] libavformat/flacdec: Workaround for truncated metadata picture size

2020-04-24 Thread Mattias Wadman
On Fri, Apr 24, 2020 at 7:29 AM Andreas Rheinhardt
 wrote:
>
> Mattias Wadman:
> > lavf flacenc could previously write truncated metadata picture size if
> > the picture data did not fit in 24 bits. Detect this by truncting the
> > size found inside the picture block and if it matches the block size
> > use it and read rest of picture data.
> >
> > Also only enable this workaround flac files and not ogg files with flac
> > METADATA_BLOCK_PICTURE comment.
> >
> > flacenc was fixed in e447a4d112bcfee10126c54eb4481fa8712957c8
> > before the fix a broken flac for reproduction could be generated with:
> > ffmpeg -f lavfi -i sine -f lavfi -i color=red:size=2400x2400 -map 0:0 -map 
> > 1:0 -c:v:0 bmp -disposition:1 attached_pic -t 1 test.flac
> >
> > Fixes ticket 6333
> > ---
> >  libavformat/flac_picture.c   | 27 ---
> >  libavformat/flac_picture.h   |  2 +-
> >  libavformat/flacdec.c|  2 +-
> >  libavformat/oggparsevorbis.c |  2 +-
> >  4 files changed, 27 insertions(+), 6 deletions(-)
> >
> > diff --git a/libavformat/flac_picture.c b/libavformat/flac_picture.c
> > index 81ddf80465..f59ec8843f 100644
> > --- a/libavformat/flac_picture.c
> > +++ b/libavformat/flac_picture.c
> > @@ -27,16 +27,17 @@
> >  #include "id3v2.h"
> >  #include "internal.h"
> >
> > -int ff_flac_parse_picture(AVFormatContext *s, uint8_t *buf, int buf_size)
> > +int ff_flac_parse_picture(AVFormatContext *s, uint8_t *buf, int buf_size, 
> > int truncate_workaround)
> >  {
> >  const CodecMime *mime = ff_id3v2_mime_tags;
> >  enum AVCodecID id = AV_CODEC_ID_NONE;
> >  AVBufferRef *data = NULL;
> > -uint8_t mimetype[64], *desc = NULL;
> > +uint8_t mimetype[64], *desc = NULL, *picturebuf = NULL;
> >  GetByteContext g;
> >  AVStream *st;
> >  int width, height, ret = 0;
> > -unsigned int len, type;
> > +unsigned int type;
> > +uint32_t len, left;
> >
> >  if (buf_size < 34) {
> >  av_log(s, AV_LOG_ERROR, "Attached picture metadata block too 
> > short\n");
> > @@ -114,6 +115,25 @@ int ff_flac_parse_picture(AVFormatContext *s, uint8_t 
> > *buf, int buf_size)
> >
> >  /* picture data */
> >  len = bytestream2_get_be32u(&g);
> > +
> > +// Workaround lavf flacenc bug that allowed writing truncated metadata 
> > picture block size if
> > +// picture size did not fit in 24 bits
> > +left = bytestream2_get_bytes_left(&g);
> > +if (truncate_workaround && len > left && (len & 0xff) == left) {
> > +uint32_t lendiff;
> > +
> > +av_log(s, AV_LOG_INFO, "Correcting truncated metadata picture size 
> > from %d to %d\n", left, len);
> > +
> > +picturebuf = av_malloc(len);
> > +if (!picturebuf)
> > +RETURN_ERROR(AVERROR(ENOMEM));
> > +lendiff = len - left;
> > +bytestream2_get_buffer(&g, picturebuf, left);
> > +if (avio_read(s->pb, picturebuf+left, lendiff) < lendiff)
> > +RETURN_ERROR(AVERROR_INVALIDDATA);
> > +bytestream2_init(&g, picturebuf, len);
> > +}
> > +
> >  if (len <= 0 || len > bytestream2_get_bytes_left(&g)) {
> >  av_log(s, AV_LOG_ERROR, "Attached picture metadata block too 
> > short\n");
> >  if (s->error_recognition & AV_EF_EXPLODE)
> > @@ -155,6 +175,7 @@ int ff_flac_parse_picture(AVFormatContext *s, uint8_t 
> > *buf, int buf_size)
> >  fail:
> >  av_buffer_unref(&data);
> >  av_freep(&desc);
> > +av_freep(&picturebuf);
>
> I don't like that you are allocating a very big buffer and read data
> into this buffer just to copy it into another buffer (that is not given
> in advance, but allocated by this function, too).

Ok thanks, yeap not so nice. Guess there are some alternatives i come up with:

1) Probe for the issue in flac_read_header and if detected realloc and
read more then call unmodified ff_flac_parse_picture
2) Make ff_flac_parse_picture able to say it needs more data
3) Make ff_flac_parse_picture able to realloc the passed buf, so
change buf arg to uint8_t **buf

-Mattias

>
> - Andreas
>
> >
> >  return ret;
> >  }
> > diff --git a/libavformat/flac_picture.h b/libavformat/flac_picture.h
> > index 4374b6f4f6..61fd0c8806 100644
> > --- a/libavformat/flac_picture.h
> > +++ b/libavformat/flac_picture.h
> > @@ -26,6 +26,6 @@
> >
> >  #define RETURN_ERROR(code) do { ret = (code); goto fail; } while (0)
> >
> > -int ff_flac_parse_picture(AVFormatContext *s, uint8_t *buf, int buf_size);
> > +int ff_flac_parse_picture(AVFormatContext *s, uint8_t *buf, int buf_size, 
> > int truncate_workaround);
> >
> >  #endif /* AVFORMAT_FLAC_PICTURE_H */
> > diff --git a/libavformat/flacdec.c b/libavformat/flacdec.c
> > index cb516fb1f3..79c05f14bf 100644
> > --- a/libavformat/flacdec.c
> > +++ b/libavformat/flacdec.c
> > @@ -146,7 +146,7 @@ static int flac_read_header(AVFormatContext *s)
> >  }
> >  av_freep(&buffer);
> >  } else if (metadata_type == FLAC_METADATA_TYPE_PICTURE) {
> >

Re: [FFmpeg-devel] [PATCH] libavformat/flacdec: Workaround for truncated metadata picture size

2020-04-24 Thread Andreas Rheinhardt
Mattias Wadman:
> On Fri, Apr 24, 2020 at 7:29 AM Andreas Rheinhardt
>  wrote:
>>
>> Mattias Wadman:
>>> lavf flacenc could previously write truncated metadata picture size if
>>> the picture data did not fit in 24 bits. Detect this by truncting the
>>> size found inside the picture block and if it matches the block size
>>> use it and read rest of picture data.
>>>
>>> Also only enable this workaround flac files and not ogg files with flac
>>> METADATA_BLOCK_PICTURE comment.
>>>
>>> flacenc was fixed in e447a4d112bcfee10126c54eb4481fa8712957c8
>>> before the fix a broken flac for reproduction could be generated with:
>>> ffmpeg -f lavfi -i sine -f lavfi -i color=red:size=2400x2400 -map 0:0 -map 
>>> 1:0 -c:v:0 bmp -disposition:1 attached_pic -t 1 test.flac
>>>
>>> Fixes ticket 6333
>>> ---
>>>  libavformat/flac_picture.c   | 27 ---
>>>  libavformat/flac_picture.h   |  2 +-
>>>  libavformat/flacdec.c|  2 +-
>>>  libavformat/oggparsevorbis.c |  2 +-
>>>  4 files changed, 27 insertions(+), 6 deletions(-)
>>>
>>> diff --git a/libavformat/flac_picture.c b/libavformat/flac_picture.c
>>> index 81ddf80465..f59ec8843f 100644
>>> --- a/libavformat/flac_picture.c
>>> +++ b/libavformat/flac_picture.c
>>> @@ -27,16 +27,17 @@
>>>  #include "id3v2.h"
>>>  #include "internal.h"
>>>
>>> -int ff_flac_parse_picture(AVFormatContext *s, uint8_t *buf, int buf_size)
>>> +int ff_flac_parse_picture(AVFormatContext *s, uint8_t *buf, int buf_size, 
>>> int truncate_workaround)
>>>  {
>>>  const CodecMime *mime = ff_id3v2_mime_tags;
>>>  enum AVCodecID id = AV_CODEC_ID_NONE;
>>>  AVBufferRef *data = NULL;
>>> -uint8_t mimetype[64], *desc = NULL;
>>> +uint8_t mimetype[64], *desc = NULL, *picturebuf = NULL;
>>>  GetByteContext g;
>>>  AVStream *st;
>>>  int width, height, ret = 0;
>>> -unsigned int len, type;
>>> +unsigned int type;
>>> +uint32_t len, left;
>>>
>>>  if (buf_size < 34) {
>>>  av_log(s, AV_LOG_ERROR, "Attached picture metadata block too 
>>> short\n");
>>> @@ -114,6 +115,25 @@ int ff_flac_parse_picture(AVFormatContext *s, uint8_t 
>>> *buf, int buf_size)
>>>
>>>  /* picture data */
>>>  len = bytestream2_get_be32u(&g);
>>> +
>>> +// Workaround lavf flacenc bug that allowed writing truncated metadata 
>>> picture block size if
>>> +// picture size did not fit in 24 bits
>>> +left = bytestream2_get_bytes_left(&g);
>>> +if (truncate_workaround && len > left && (len & 0xff) == left) {
>>> +uint32_t lendiff;
>>> +
>>> +av_log(s, AV_LOG_INFO, "Correcting truncated metadata picture size 
>>> from %d to %d\n", left, len);
>>> +
>>> +picturebuf = av_malloc(len);
>>> +if (!picturebuf)
>>> +RETURN_ERROR(AVERROR(ENOMEM));
>>> +lendiff = len - left;
>>> +bytestream2_get_buffer(&g, picturebuf, left);
>>> +if (avio_read(s->pb, picturebuf+left, lendiff) < lendiff)
>>> +RETURN_ERROR(AVERROR_INVALIDDATA);
>>> +bytestream2_init(&g, picturebuf, len);
>>> +}
>>> +
>>>  if (len <= 0 || len > bytestream2_get_bytes_left(&g)) {
>>>  av_log(s, AV_LOG_ERROR, "Attached picture metadata block too 
>>> short\n");
>>>  if (s->error_recognition & AV_EF_EXPLODE)
>>> @@ -155,6 +175,7 @@ int ff_flac_parse_picture(AVFormatContext *s, uint8_t 
>>> *buf, int buf_size)
>>>  fail:
>>>  av_buffer_unref(&data);
>>>  av_freep(&desc);
>>> +av_freep(&picturebuf);
>>
>> I don't like that you are allocating a very big buffer and read data
>> into this buffer just to copy it into another buffer (that is not given
>> in advance, but allocated by this function, too).
> 
> Ok thanks, yeap not so nice. Guess there are some alternatives i come up with:
> 
> 1) Probe for the issue in flac_read_header and if detected realloc and
> read more then call unmodified ff_flac_parse_picture
> 2) Make ff_flac_parse_picture able to say it needs more data
> 3) Make ff_flac_parse_picture able to realloc the passed buf, so
> change buf arg to uint8_t **buf
> 
This would be way to intrusive. I actually had something else in mind:
You directly allocate a buffer of the right size (with padding at the
end), copy the needed part of the data that is given to you via buf into
it and read the stuff you need to read into the new buffer (at the right
offset). This does not introduce a new allocation.

- 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] Add general_assembly_bootstrap.pl

2020-04-24 Thread Josh de Kock
This script aims to extract contributors who are eligible for the
general assembly.

Signed-off-by: Josh de Kock 
---

 Better late than never, this patch will continue to put in place the
 voting systems for FFmpeg discussed at VDD 2019 and FOSDEM 2020.
 There is probably a better way to do this, but the aim is just to
 'bootstrap' and kickstart the process and commitees.

 tools/general_assembly_bootstrap.pl | 48 +
 1 file changed, 48 insertions(+)
 create mode 100755 tools/general_assembly_bootstrap.pl

diff --git a/tools/general_assembly_bootstrap.pl 
b/tools/general_assembly_bootstrap.pl
new file mode 100755
index 00..320fe76992
--- /dev/null
+++ b/tools/general_assembly_bootstrap.pl
@@ -0,0 +1,48 @@
+#!/usr/bin/env perl
+
+use warnings;
+use strict;
+
+use Encode qw(decode);
+use List::MoreUtils qw(uniq);
+# cpan List::MoreUtils
+use JSON::MaybeXS;
+# cpan JSON::MaybeXS
+
+use Data::Dumper;
+
+sub trim { my $s = shift; $s =~ s/^\s+|\s+$//g; return $s };
+
+my @shortlog = split /\n/, decode('UTF-8', `git shortlog -sne --since="last 36 
months"`, Encode::FB_CROAK);
+
+my %assembly = ();
+
+foreach my $line (@shortlog) {
+my ($count, $name, $email) = $line =~ m/^ *(\d+) *(.*?) <(.*?)>/;
+
+if ($count < 20) {
+next;
+}
+
+# make sure name is trimmed
+$name = trim $name;
+
+# assume people with 50 commits have at least 20 source commits
+if ($count < 50) {
+my $true = 0;
+my @commits = split /(^|\n)commit [a-z0-9]{40}(\n|$)/, decode('UTF-8', 
`git log --name-only --use-mailmap --author="$email" --since="last 36 months"`, 
Encode::FB_CROAK);
+foreach my $commit (@commits) {
+if ($commit =~ /\n[\w\/]+\.(c|h|S|asm)/) {
+$true++;
+}
+}
+
+if ($true < 20) {
+next;
+}
+}
+
+$assembly{$name} = $email;
+}
+
+print encode_json(\%assembly);
-- 
2.24.1 (Apple Git-126)

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

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

Re: [FFmpeg-devel] [PATCH] Add general_assembly_bootstrap.pl

2020-04-24 Thread Nicolas George
Josh de Kock (12020-04-24):
> This script aims to extract contributors who are eligible for the
> general assembly.
> 
> Signed-off-by: Josh de Kock 
> ---
> 
>  Better late than never, this patch will continue to put in place the
>  voting systems for FFmpeg discussed at VDD 2019 and FOSDEM 2020.
>  There is probably a better way to do this, but the aim is just to
>  'bootstrap' and kickstart the process and commitees.

Since it is only useful once, is there a point in having it in the tree?

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] libavformat/flacdec: Workaround for truncated metadata picture size

2020-04-24 Thread Mattias Wadman
On Fri, Apr 24, 2020 at 11:26 AM Andreas Rheinhardt
 wrote:
>
> Mattias Wadman:
> > On Fri, Apr 24, 2020 at 7:29 AM Andreas Rheinhardt
> >  wrote:
> >>
> >> Mattias Wadman:
> >>> lavf flacenc could previously write truncated metadata picture size if
> >>> the picture data did not fit in 24 bits. Detect this by truncting the
> >>> size found inside the picture block and if it matches the block size
> >>> use it and read rest of picture data.
> >>>
> >>> Also only enable this workaround flac files and not ogg files with flac
> >>> METADATA_BLOCK_PICTURE comment.
> >>>
> >>> flacenc was fixed in e447a4d112bcfee10126c54eb4481fa8712957c8
> >>> before the fix a broken flac for reproduction could be generated with:
> >>> ffmpeg -f lavfi -i sine -f lavfi -i color=red:size=2400x2400 -map 0:0 
> >>> -map 1:0 -c:v:0 bmp -disposition:1 attached_pic -t 1 test.flac
> >>>
> >>> Fixes ticket 6333
> >>> ---
> >>>  libavformat/flac_picture.c   | 27 ---
> >>>  libavformat/flac_picture.h   |  2 +-
> >>>  libavformat/flacdec.c|  2 +-
> >>>  libavformat/oggparsevorbis.c |  2 +-
> >>>  4 files changed, 27 insertions(+), 6 deletions(-)
> >>>
> >>> diff --git a/libavformat/flac_picture.c b/libavformat/flac_picture.c
> >>> index 81ddf80465..f59ec8843f 100644
> >>> --- a/libavformat/flac_picture.c
> >>> +++ b/libavformat/flac_picture.c
> >>> @@ -27,16 +27,17 @@
> >>>  #include "id3v2.h"
> >>>  #include "internal.h"
> >>>
> >>> -int ff_flac_parse_picture(AVFormatContext *s, uint8_t *buf, int buf_size)
> >>> +int ff_flac_parse_picture(AVFormatContext *s, uint8_t *buf, int 
> >>> buf_size, int truncate_workaround)
> >>>  {
> >>>  const CodecMime *mime = ff_id3v2_mime_tags;
> >>>  enum AVCodecID id = AV_CODEC_ID_NONE;
> >>>  AVBufferRef *data = NULL;
> >>> -uint8_t mimetype[64], *desc = NULL;
> >>> +uint8_t mimetype[64], *desc = NULL, *picturebuf = NULL;
> >>>  GetByteContext g;
> >>>  AVStream *st;
> >>>  int width, height, ret = 0;
> >>> -unsigned int len, type;
> >>> +unsigned int type;
> >>> +uint32_t len, left;
> >>>
> >>>  if (buf_size < 34) {
> >>>  av_log(s, AV_LOG_ERROR, "Attached picture metadata block too 
> >>> short\n");
> >>> @@ -114,6 +115,25 @@ int ff_flac_parse_picture(AVFormatContext *s, 
> >>> uint8_t *buf, int buf_size)
> >>>
> >>>  /* picture data */
> >>>  len = bytestream2_get_be32u(&g);
> >>> +
> >>> +// Workaround lavf flacenc bug that allowed writing truncated 
> >>> metadata picture block size if
> >>> +// picture size did not fit in 24 bits
> >>> +left = bytestream2_get_bytes_left(&g);
> >>> +if (truncate_workaround && len > left && (len & 0xff) == left) {
> >>> +uint32_t lendiff;
> >>> +
> >>> +av_log(s, AV_LOG_INFO, "Correcting truncated metadata picture 
> >>> size from %d to %d\n", left, len);
> >>> +
> >>> +picturebuf = av_malloc(len);
> >>> +if (!picturebuf)
> >>> +RETURN_ERROR(AVERROR(ENOMEM));
> >>> +lendiff = len - left;
> >>> +bytestream2_get_buffer(&g, picturebuf, left);
> >>> +if (avio_read(s->pb, picturebuf+left, lendiff) < lendiff)
> >>> +RETURN_ERROR(AVERROR_INVALIDDATA);
> >>> +bytestream2_init(&g, picturebuf, len);
> >>> +}
> >>> +
> >>>  if (len <= 0 || len > bytestream2_get_bytes_left(&g)) {
> >>>  av_log(s, AV_LOG_ERROR, "Attached picture metadata block too 
> >>> short\n");
> >>>  if (s->error_recognition & AV_EF_EXPLODE)
> >>> @@ -155,6 +175,7 @@ int ff_flac_parse_picture(AVFormatContext *s, uint8_t 
> >>> *buf, int buf_size)
> >>>  fail:
> >>>  av_buffer_unref(&data);
> >>>  av_freep(&desc);
> >>> +av_freep(&picturebuf);
> >>
> >> I don't like that you are allocating a very big buffer and read data
> >> into this buffer just to copy it into another buffer (that is not given
> >> in advance, but allocated by this function, too).
> >
> > Ok thanks, yeap not so nice. Guess there are some alternatives i come up 
> > with:
> >
> > 1) Probe for the issue in flac_read_header and if detected realloc and
> > read more then call unmodified ff_flac_parse_picture
> > 2) Make ff_flac_parse_picture able to say it needs more data
> > 3) Make ff_flac_parse_picture able to realloc the passed buf, so
> > change buf arg to uint8_t **buf
> >
> This would be way to intrusive. I actually had something else in mind:
> You directly allocate a buffer of the right size (with padding at the
> end), copy the needed part of the data that is given to you via buf into
> it and read the stuff you need to read into the new buffer (at the right
> offset). This does not introduce a new allocation.

Yes, much better. Didn't see that if we don't fail on too short we would already
allocate the correct size and just need to read some more.

Patch update coming in a minute.

>
> - Andreas
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org

[FFmpeg-devel] [PATCH v2] libavformat/flacdec: Workaround for truncated metadata picture size

2020-04-24 Thread Mattias Wadman
lavf flacenc could previously write truncated metadata picture size if
the picture data did not fit in 24 bits. Detect this by truncting the
size found inside the picture block and if it matches the block size
use it and read rest of picture data.

Also only enable this workaround flac files and not ogg files with flac
METADATA_BLOCK_PICTURE comment.

flacenc was fixed in e447a4d112bcfee10126c54eb4481fa8712957c8
before the fix a broken flac for reproduction could be generated with:
ffmpeg -f lavfi -i sine -f lavfi -i color=red:size=2400x2400 -map 0:0 -map 1:0 
-c:v:0 bmp -disposition:1 attached_pic -t 1 test.flac

Fixes ticket 6333
---
 libavformat/flac_picture.c   | 31 +++
 libavformat/flac_picture.h   |  2 +-
 libavformat/flacdec.c|  2 +-
 libavformat/oggparsevorbis.c |  2 +-
 4 files changed, 26 insertions(+), 11 deletions(-)

diff --git a/libavformat/flac_picture.c b/libavformat/flac_picture.c
index 81ddf80465..64be9f833d 100644
--- a/libavformat/flac_picture.c
+++ b/libavformat/flac_picture.c
@@ -27,7 +27,7 @@
 #include "id3v2.h"
 #include "internal.h"
 
-int ff_flac_parse_picture(AVFormatContext *s, uint8_t *buf, int buf_size)
+int ff_flac_parse_picture(AVFormatContext *s, uint8_t *buf, int buf_size, int 
truncate_workaround)
 {
 const CodecMime *mime = ff_id3v2_mime_tags;
 enum AVCodecID id = AV_CODEC_ID_NONE;
@@ -36,7 +36,8 @@ int ff_flac_parse_picture(AVFormatContext *s, uint8_t *buf, 
int buf_size)
 GetByteContext g;
 AVStream *st;
 int width, height, ret = 0;
-unsigned int len, type;
+unsigned int type;
+uint32_t len, left, trunclen = 0;
 
 if (buf_size < 34) {
 av_log(s, AV_LOG_ERROR, "Attached picture metadata block too short\n");
@@ -114,16 +115,30 @@ int ff_flac_parse_picture(AVFormatContext *s, uint8_t 
*buf, int buf_size)
 
 /* picture data */
 len = bytestream2_get_be32u(&g);
-if (len <= 0 || len > bytestream2_get_bytes_left(&g)) {
-av_log(s, AV_LOG_ERROR, "Attached picture metadata block too short\n");
-if (s->error_recognition & AV_EF_EXPLODE)
-ret = AVERROR_INVALIDDATA;
-goto fail;
+
+left = bytestream2_get_bytes_left(&g);
+if (len <= 0 || len > left) {
+// Workaround lavf flacenc bug that allowed writing truncated metadata 
picture block size if
+// picture size did not fit in 24 bits
+if (truncate_workaround && len > left && (len & 0xff) == left) {
+av_log(s, AV_LOG_INFO, "Correcting truncated metadata picture size 
from %d to %d\n", left, len);
+trunclen = len - left;
+} else {
+av_log(s, AV_LOG_ERROR, "Attached picture metadata block too 
short\n");
+if (s->error_recognition & AV_EF_EXPLODE)
+ret = AVERROR_INVALIDDATA;
+goto fail;
+}
 }
 if (!(data = av_buffer_alloc(len + AV_INPUT_BUFFER_PADDING_SIZE))) {
 RETURN_ERROR(AVERROR(ENOMEM));
 }
-bytestream2_get_bufferu(&g, data->data, len);
+bytestream2_get_bufferu(&g, data->data, left);
+// If truncation was detect read bytes missing in the block size
+if (trunclen > 0) {
+if (avio_read(s->pb, data->data + len - trunclen, trunclen) < trunclen)
+RETURN_ERROR(AVERROR_INVALIDDATA);
+}
 memset(data->data + len, 0, AV_INPUT_BUFFER_PADDING_SIZE);
 
 if (AV_RB64(data->data) == PNGSIG)
diff --git a/libavformat/flac_picture.h b/libavformat/flac_picture.h
index 4374b6f4f6..61fd0c8806 100644
--- a/libavformat/flac_picture.h
+++ b/libavformat/flac_picture.h
@@ -26,6 +26,6 @@
 
 #define RETURN_ERROR(code) do { ret = (code); goto fail; } while (0)
 
-int ff_flac_parse_picture(AVFormatContext *s, uint8_t *buf, int buf_size);
+int ff_flac_parse_picture(AVFormatContext *s, uint8_t *buf, int buf_size, int 
truncate_workaround);
 
 #endif /* AVFORMAT_FLAC_PICTURE_H */
diff --git a/libavformat/flacdec.c b/libavformat/flacdec.c
index cb516fb1f3..79c05f14bf 100644
--- a/libavformat/flacdec.c
+++ b/libavformat/flacdec.c
@@ -146,7 +146,7 @@ static int flac_read_header(AVFormatContext *s)
 }
 av_freep(&buffer);
 } else if (metadata_type == FLAC_METADATA_TYPE_PICTURE) {
-ret = ff_flac_parse_picture(s, buffer, metadata_size);
+ret = ff_flac_parse_picture(s, buffer, metadata_size, 1);
 av_freep(&buffer);
 if (ret < 0) {
 av_log(s, AV_LOG_ERROR, "Error parsing attached picture.\n");
diff --git a/libavformat/oggparsevorbis.c b/libavformat/oggparsevorbis.c
index 27d2c686b6..6f15204ada 100644
--- a/libavformat/oggparsevorbis.c
+++ b/libavformat/oggparsevorbis.c
@@ -165,7 +165,7 @@ int ff_vorbis_comment(AVFormatContext *as, AVDictionary **m,
 av_freep(&tt);
 av_freep(&ct);
 if (ret > 0)
-ret = ff_flac_parse_picture(as, pict, ret);
+ret = ff_flac_parse_picture(as, pict, 

Re: [FFmpeg-devel] [PATCH] Add general_assembly_bootstrap.pl

2020-04-24 Thread Josh de Kock

On 24/04/2020 11:29, Nicolas George wrote:

Josh de Kock (12020-04-24):

This script aims to extract contributors who are eligible for the
general assembly.

Signed-off-by: Josh de Kock 
---

  Better late than never, this patch will continue to put in place the
  voting systems for FFmpeg discussed at VDD 2019 and FOSDEM 2020.
  There is probably a better way to do this, but the aim is just to
  'bootstrap' and kickstart the process and commitees.


Since it is only useful once, is there a point in having it in the tree?

There is no particular need for it to stay in the tree. Regardless, I 
wanted to send it to the mailing list to avoid any complications vs if I 
had just sent the output of the script (so that it can be reviewed and 
tested by others).


My suggestion would be to actually commit it and then remove it later 
when we have another system properly setup so that it is in git history.


--
Josh
___
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] dnn-layer-mathbinary-test: Fix tests for cases with extra intermediate precision

2020-04-24 Thread Martin Storsjö

On Thu, 23 Apr 2020, Guo, Yejun wrote:


-Original Message-
From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On Behalf Of
Martin Storsj?
Sent: Thursday, April 23, 2020 2:34 PM
To: ffmpeg-devel@ffmpeg.org
Subject: [FFmpeg-devel] [PATCH] dnn-layer-mathbinary-test: Fix tests for cases
with extra intermediate precision

This fixes tests on 32 bit x86 mingw with clang, which uses x87
fpu by default.

In this setup, while the get_expected function is declared to
return float, the compiler is (especially given the optimization
flags set) free to keep the intermediate values (in this case,
the return value from the inlined function) in higher precision.

This results in the situation where 7.28 (which actually, as
a float, ends up as 7.282098), multiplied by 100, is
728.00 when really forced into a 32 bit float, but 728.21
when kept with higher intermediate precision.

For the multiplication case, a more suitable epsilon would e.g.
be 2*FLT_EPSILON*fabs(expected_output),


thanks for the fix. LGTM.

Just want to have a talk with 2*FLT_EPSILON*fabs(expected_output),
any explanation for this? looks ULP (units of least precision) based method
is a good choice, see https://bitbashing.io/comparing-floats.html.
Anyway, let's use the hardcoded threshold for simplicity.


FLT_EPSILON corresponds to 1 ULP when the exponent is zero, i.e. in the 
range [1,2] or [-2,-1]. So by doing FLT_EPSILON*fabs(expected_output) you 
get the magnitude of 1 ULP for the value expected_output. By allowing a 
difference of 2 ULP it would be a bit more lenient - not sure if that 
aspect really is relevant or not.


This would work fine for this particular test, as you have two input 
values that should be represented the same in both implementations, and 
you do one single operation on them - so the only difference _should_ be 
how much the end result is rounded. If testing for likeness on a more 
complex function that does a series of operations, you would have to 
account for a ~1 ULP rounding error in each of the steps, and calculate 
how that rounding error could be magnified by later operations.


And especially if you have two potentially inexact numbers that are close 
each other and perform a subtraction, you'll have loss of significance, 
and the error in that result is way larger than 1 ULP for that particular 
number.


// Martin

___
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 v3] libavformat/flacdec: Workaround for truncated metadata picture size

2020-04-24 Thread Mattias Wadman
lavf flacenc could previously write truncated metadata picture size if
the picture data did not fit in 24 bits. Detect this by truncting the
size found inside the picture block and if it matches the block size
use it and read rest of picture data.

Also only enable this workaround flac files and not ogg files with flac
METADATA_BLOCK_PICTURE comment.

flacenc was fixed in e447a4d112bcfee10126c54eb4481fa8712957c8
before the fix a broken flac for reproduction could be generated with:
ffmpeg -f lavfi -i sine -f lavfi -i color=red:size=2400x2400 -map 0:0 -map 1:0 
-c:v:0 bmp -disposition:1 attached_pic -t 1 test.flac

Fixes ticket 6333
---
 libavformat/flac_picture.c   | 35 +++
 libavformat/flac_picture.h   |  2 +-
 libavformat/flacdec.c|  2 +-
 libavformat/oggparsevorbis.c |  2 +-
 4 files changed, 30 insertions(+), 11 deletions(-)

diff --git a/libavformat/flac_picture.c b/libavformat/flac_picture.c
index 81ddf80465..61277e9dee 100644
--- a/libavformat/flac_picture.c
+++ b/libavformat/flac_picture.c
@@ -27,7 +27,7 @@
 #include "id3v2.h"
 #include "internal.h"
 
-int ff_flac_parse_picture(AVFormatContext *s, uint8_t *buf, int buf_size)
+int ff_flac_parse_picture(AVFormatContext *s, uint8_t *buf, int buf_size, int 
truncate_workaround)
 {
 const CodecMime *mime = ff_id3v2_mime_tags;
 enum AVCodecID id = AV_CODEC_ID_NONE;
@@ -36,7 +36,8 @@ int ff_flac_parse_picture(AVFormatContext *s, uint8_t *buf, 
int buf_size)
 GetByteContext g;
 AVStream *st;
 int width, height, ret = 0;
-unsigned int len, type;
+unsigned int type;
+uint32_t len, left, trunclen = 0;
 
 if (buf_size < 34) {
 av_log(s, AV_LOG_ERROR, "Attached picture metadata block too short\n");
@@ -114,16 +115,34 @@ int ff_flac_parse_picture(AVFormatContext *s, uint8_t 
*buf, int buf_size)
 
 /* picture data */
 len = bytestream2_get_be32u(&g);
-if (len <= 0 || len > bytestream2_get_bytes_left(&g)) {
-av_log(s, AV_LOG_ERROR, "Attached picture metadata block too short\n");
-if (s->error_recognition & AV_EF_EXPLODE)
-ret = AVERROR_INVALIDDATA;
-goto fail;
+
+left = bytestream2_get_bytes_left(&g);
+if (len <= 0 || len > left) {
+// Workaround lavf flacenc bug that allowed writing truncated metadata 
picture block size if
+// picture size did not fit in 24 bits
+if (truncate_workaround && len > left && (len & 0xff) == left) {
+av_log(s, AV_LOG_INFO, "Correcting truncated metadata picture size 
from %d to %d\n", left, len);
+trunclen = len - left;
+} else {
+av_log(s, AV_LOG_ERROR, "Attached picture metadata block too 
short\n");
+if (s->error_recognition & AV_EF_EXPLODE)
+ret = AVERROR_INVALIDDATA;
+goto fail;
+}
 }
 if (!(data = av_buffer_alloc(len + AV_INPUT_BUFFER_PADDING_SIZE))) {
 RETURN_ERROR(AVERROR(ENOMEM));
 }
-bytestream2_get_bufferu(&g, data->data, len);
+
+if (trunclen == 0) {
+bytestream2_get_bufferu(&g, data->data, len);
+} else {
+// If truncation was detect copy all data from block and read missing 
bytes
+// not included in the block size
+bytestream2_get_bufferu(&g, data->data, left);
+if (avio_read(s->pb, data->data + len - trunclen, trunclen) < trunclen)
+RETURN_ERROR(AVERROR_INVALIDDATA);
+}
 memset(data->data + len, 0, AV_INPUT_BUFFER_PADDING_SIZE);
 
 if (AV_RB64(data->data) == PNGSIG)
diff --git a/libavformat/flac_picture.h b/libavformat/flac_picture.h
index 4374b6f4f6..61fd0c8806 100644
--- a/libavformat/flac_picture.h
+++ b/libavformat/flac_picture.h
@@ -26,6 +26,6 @@
 
 #define RETURN_ERROR(code) do { ret = (code); goto fail; } while (0)
 
-int ff_flac_parse_picture(AVFormatContext *s, uint8_t *buf, int buf_size);
+int ff_flac_parse_picture(AVFormatContext *s, uint8_t *buf, int buf_size, int 
truncate_workaround);
 
 #endif /* AVFORMAT_FLAC_PICTURE_H */
diff --git a/libavformat/flacdec.c b/libavformat/flacdec.c
index cb516fb1f3..79c05f14bf 100644
--- a/libavformat/flacdec.c
+++ b/libavformat/flacdec.c
@@ -146,7 +146,7 @@ static int flac_read_header(AVFormatContext *s)
 }
 av_freep(&buffer);
 } else if (metadata_type == FLAC_METADATA_TYPE_PICTURE) {
-ret = ff_flac_parse_picture(s, buffer, metadata_size);
+ret = ff_flac_parse_picture(s, buffer, metadata_size, 1);
 av_freep(&buffer);
 if (ret < 0) {
 av_log(s, AV_LOG_ERROR, "Error parsing attached picture.\n");
diff --git a/libavformat/oggparsevorbis.c b/libavformat/oggparsevorbis.c
index 27d2c686b6..6f15204ada 100644
--- a/libavformat/oggparsevorbis.c
+++ b/libavformat/oggparsevorbis.c
@@ -165,7 +165,7 @@ int ff_vorbis_comment(AVFormatContext *as, AVDictionary **m,
 av_freep(&tt);
 av_freep(&ct);
   

Re: [FFmpeg-devel] [PATCH v2] libavformat/flacdec: Workaround for truncated metadata picture size

2020-04-24 Thread Mattias Wadman
On Fri, Apr 24, 2020 at 12:41 PM Mattias Wadman
 wrote:
>
> lavf flacenc could previously write truncated metadata picture size if
> the picture data did not fit in 24 bits. Detect this by truncting the
> size found inside the picture block and if it matches the block size
> use it and read rest of picture data.
>
> Also only enable this workaround flac files and not ogg files with flac
> METADATA_BLOCK_PICTURE comment.
>
> flacenc was fixed in e447a4d112bcfee10126c54eb4481fa8712957c8
> before the fix a broken flac for reproduction could be generated with:
> ffmpeg -f lavfi -i sine -f lavfi -i color=red:size=2400x2400 -map 0:0 -map 
> 1:0 -c:v:0 bmp -disposition:1 attached_pic -t 1 test.flac
>
> Fixes ticket 6333
> ---
>  libavformat/flac_picture.c   | 31 +++
>  libavformat/flac_picture.h   |  2 +-
>  libavformat/flacdec.c|  2 +-
>  libavformat/oggparsevorbis.c |  2 +-
>  4 files changed, 26 insertions(+), 11 deletions(-)
>
> diff --git a/libavformat/flac_picture.c b/libavformat/flac_picture.c
> index 81ddf80465..64be9f833d 100644
> --- a/libavformat/flac_picture.c
> +++ b/libavformat/flac_picture.c
> @@ -27,7 +27,7 @@
>  #include "id3v2.h"
>  #include "internal.h"
>
> -int ff_flac_parse_picture(AVFormatContext *s, uint8_t *buf, int buf_size)
> +int ff_flac_parse_picture(AVFormatContext *s, uint8_t *buf, int buf_size, 
> int truncate_workaround)
>  {
>  const CodecMime *mime = ff_id3v2_mime_tags;
>  enum AVCodecID id = AV_CODEC_ID_NONE;
> @@ -36,7 +36,8 @@ int ff_flac_parse_picture(AVFormatContext *s, uint8_t *buf, 
> int buf_size)
>  GetByteContext g;
>  AVStream *st;
>  int width, height, ret = 0;
> -unsigned int len, type;
> +unsigned int type;
> +uint32_t len, left, trunclen = 0;
>
>  if (buf_size < 34) {
>  av_log(s, AV_LOG_ERROR, "Attached picture metadata block too 
> short\n");
> @@ -114,16 +115,30 @@ int ff_flac_parse_picture(AVFormatContext *s, uint8_t 
> *buf, int buf_size)
>
>  /* picture data */
>  len = bytestream2_get_be32u(&g);
> -if (len <= 0 || len > bytestream2_get_bytes_left(&g)) {
> -av_log(s, AV_LOG_ERROR, "Attached picture metadata block too 
> short\n");
> -if (s->error_recognition & AV_EF_EXPLODE)
> -ret = AVERROR_INVALIDDATA;
> -goto fail;
> +
> +left = bytestream2_get_bytes_left(&g);
> +if (len <= 0 || len > left) {
> +// Workaround lavf flacenc bug that allowed writing truncated 
> metadata picture block size if
> +// picture size did not fit in 24 bits
> +if (truncate_workaround && len > left && (len & 0xff) == left) {
> +av_log(s, AV_LOG_INFO, "Correcting truncated metadata picture 
> size from %d to %d\n", left, len);
> +trunclen = len - left;
> +} else {
> +av_log(s, AV_LOG_ERROR, "Attached picture metadata block too 
> short\n");
> +if (s->error_recognition & AV_EF_EXPLODE)
> +ret = AVERROR_INVALIDDATA;
> +goto fail;
> +}
>  }
>  if (!(data = av_buffer_alloc(len + AV_INPUT_BUFFER_PADDING_SIZE))) {
>  RETURN_ERROR(AVERROR(ENOMEM));
>  }
> -bytestream2_get_bufferu(&g, data->data, len);
> +bytestream2_get_bufferu(&g, data->data, left);

Maybe this should not be changed in the non-truncated case? now if for
some reason the picture
size if smaller than block size will include garbage/padding bytes at
the end of the block i think

> +// If truncation was detect read bytes missing in the block size
> +if (trunclen > 0) {
> +if (avio_read(s->pb, data->data + len - trunclen, trunclen) < 
> trunclen)
> +RETURN_ERROR(AVERROR_INVALIDDATA);
> +}
>  memset(data->data + len, 0, AV_INPUT_BUFFER_PADDING_SIZE);
>
>  if (AV_RB64(data->data) == PNGSIG)
> diff --git a/libavformat/flac_picture.h b/libavformat/flac_picture.h
> index 4374b6f4f6..61fd0c8806 100644
> --- a/libavformat/flac_picture.h
> +++ b/libavformat/flac_picture.h
> @@ -26,6 +26,6 @@
>
>  #define RETURN_ERROR(code) do { ret = (code); goto fail; } while (0)
>
> -int ff_flac_parse_picture(AVFormatContext *s, uint8_t *buf, int buf_size);
> +int ff_flac_parse_picture(AVFormatContext *s, uint8_t *buf, int buf_size, 
> int truncate_workaround);
>
>  #endif /* AVFORMAT_FLAC_PICTURE_H */
> diff --git a/libavformat/flacdec.c b/libavformat/flacdec.c
> index cb516fb1f3..79c05f14bf 100644
> --- a/libavformat/flacdec.c
> +++ b/libavformat/flacdec.c
> @@ -146,7 +146,7 @@ static int flac_read_header(AVFormatContext *s)
>  }
>  av_freep(&buffer);
>  } else if (metadata_type == FLAC_METADATA_TYPE_PICTURE) {
> -ret = ff_flac_parse_picture(s, buffer, metadata_size);
> +ret = ff_flac_parse_picture(s, buffer, metadata_size, 1);
>  av_freep(&buffer);
>  if (ret < 0) {
>  av_log(s, AV_LOG_ERROR, "Error parsing attached picture.\n");
> diff 

[FFmpeg-devel] [PATCH 0/1] avformat/http: handle SEEK_SET to filesize and fix #6885

2020-04-24 Thread vectronic
if whence == SEEK_SET and offset is filesize and is_streamable is false
we can just return the filesize to prevent an HTTP 416 error

Fixes https://trac.ffmpeg.org/ticket/6885

vectronic (1):
  avformat/http: handle SEEK_SET to filesize

 libavformat/http.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

-- 
2.24.2 (Apple Git-127)

___
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/1] avformat/http: handle SEEK_SET to filesize

2020-04-24 Thread vectronic
if whence == SEEK_SET and offset is filesize and is_streamable is false
we can just return the filesize to prevent an HTTP 416 error

Signed-off-by: vectronic 
---
 libavformat/http.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/http.c b/libavformat/http.c
index c9415578aa..1adcc6eb67 100644
--- a/libavformat/http.c
+++ b/libavformat/http.c
@@ -1719,7 +1719,7 @@ static int64_t http_seek_internal(URLContext *h, int64_t 
off, int whence, int fo
 int old_buf_size, ret;
 AVDictionary *options = NULL;
 
-if (whence == AVSEEK_SIZE)
+if ((whence == AVSEEK_SIZE) || (whence == SEEK_SET && h->is_streamed == 0 
&& off == s->filesize))
 return s->filesize;
 else if (!force_reconnect &&
  ((whence == SEEK_CUR && off == 0) ||
-- 
2.24.2 (Apple Git-127)

___
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/1] avformat/http: handle SEEK_SET to filesize

2020-04-24 Thread vectronic
> On 24 Apr 2020, at 12:09, vectronic  wrote:
> 
> if whence == SEEK_SET and offset is filesize and is_streamable is false
> we can just return the filesize to prevent an HTTP 416 error
> 
> Signed-off-by: vectronic 
> ---
> libavformat/http.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libavformat/http.c b/libavformat/http.c
> index c9415578aa..1adcc6eb67 100644
> --- a/libavformat/http.c
> +++ b/libavformat/http.c
> @@ -1719,7 +1719,7 @@ static int64_t http_seek_internal(URLContext *h, 
> int64_t off, int whence, int fo
> int old_buf_size, ret;
> AVDictionary *options = NULL;
> 
> -if (whence == AVSEEK_SIZE)
> +if ((whence == AVSEEK_SIZE) || (whence == SEEK_SET && h->is_streamed == 
> 0 && off == s->filesize))
> return s->filesize;
> else if (!force_reconnect &&
>  ((whence == SEEK_CUR && off == 0) ||
> -- 
> 2.24.2 (Apple Git-127)
> 

Apologies for confusion on this, I believe this issue has already been fixed 
this commit:

https://github.com/FFmpeg/FFmpeg/commit/69fcc093c1241b5ee7711c56c9cd558832a7e491
 


Therefore I believe the following has already been fixed and can be closed:

https://trac.ffmpeg.org/ticket/6885 

___
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] dnn-layer-mathbinary-test: Fix tests for cases with extra intermediate precision

2020-04-24 Thread Guo, Yejun


> -Original Message-
> From: ffmpeg-devel  On Behalf Of Martin
> Storsj?
> Sent: Friday, April 24, 2020 6:44 PM
> To: FFmpeg development discussions and patches 
> Subject: Re: [FFmpeg-devel] [PATCH] dnn-layer-mathbinary-test: Fix tests for
> cases with extra intermediate precision
> 
> On Thu, 23 Apr 2020, Guo, Yejun wrote:
> 
> >> -Original Message-
> >> From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On Behalf
> >> Of Martin Storsj?
> >> Sent: Thursday, April 23, 2020 2:34 PM
> >> To: ffmpeg-devel@ffmpeg.org
> >> Subject: [FFmpeg-devel] [PATCH] dnn-layer-mathbinary-test: Fix tests
> >> for cases with extra intermediate precision
> >>
> >> This fixes tests on 32 bit x86 mingw with clang, which uses x87 fpu
> >> by default.
> >>
> >> In this setup, while the get_expected function is declared to return
> >> float, the compiler is (especially given the optimization flags set)
> >> free to keep the intermediate values (in this case, the return value
> >> from the inlined function) in higher precision.
> >>
> >> This results in the situation where 7.28 (which actually, as a float,
> >> ends up as 7.282098), multiplied by 100, is
> >> 728.00 when really forced into a 32 bit float, but 728.21
> >> when kept with higher intermediate precision.
> >>
> >> For the multiplication case, a more suitable epsilon would e.g.
> >> be 2*FLT_EPSILON*fabs(expected_output),
> >
> > thanks for the fix. LGTM.
> >
> > Just want to have a talk with 2*FLT_EPSILON*fabs(expected_output),
> > any explanation for this? looks ULP (units of least precision) based
> > method is a good choice, see https://bitbashing.io/comparing-floats.html.
> > Anyway, let's use the hardcoded threshold for simplicity.
> 
> FLT_EPSILON corresponds to 1 ULP when the exponent is zero, i.e. in the range
> [1,2] or [-2,-1]. So by doing FLT_EPSILON*fabs(expected_output) you get the
> magnitude of 1 ULP for the value expected_output. By allowing a difference of 
> 2
> ULP it would be a bit more lenient - not sure if that aspect really is 
> relevant or
> not.
> 
> This would work fine for this particular test, as you have two input values 
> that
> should be represented the same in both implementations, and you do one
> single operation on them - so the only difference _should_ be how much the
> end result is rounded. If testing for likeness on a more complex function that
> does a series of operations, you would have to account for a ~1 ULP rounding
> error in each of the steps, and calculate how that rounding error could be
> magnified by later operations.
> 
> And especially if you have two potentially inexact numbers that are close each
> other and perform a subtraction, you'll have loss of significance, and the 
> error
> in that result is way larger than 1 ULP for that particular number.

Thanks a lot Martin, will push now.

> 
> // Martin
> 
> ___
> 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] avcodec/ass: explicitly set ScaledBorderAndShadow

2020-04-24 Thread Oneric
On Fri, Apr 17, 2020 at 03:35:44 +0200, one...@oneric.de wrote:
> From 74d3f6bd0189b0f4922404fccbefe95e1f01093d Mon Sep 17 00:00:00 2001
> From: Oneric 
> Date: Fri, 17 Apr 2020 00:38:53 +0200
> Subject: [PATCH] avcodec/ass: explicitly set ScaledBorderAndShadow
> 
> ---
>  libavcodec/ass.c | 1 +
>  tests/ref/fate/sub-aqtitle   | 1 +
>  tests/ref/fate/sub-cc| 1 +
>  tests/ref/fate/sub-cc-realtime   | 1 +
>  tests/ref/fate/sub-cc-scte20 | 1 +
>  tests/ref/fate/sub-charenc   | 1 +
>  tests/ref/fate/sub-jacosub   | 1 +
>  tests/ref/fate/sub-microdvd  | 1 +
>  tests/ref/fate/sub-movtext   | 1 +
>  tests/ref/fate/sub-mpl2  | 1 +
>  tests/ref/fate/sub-mpsub | 1 +
>  tests/ref/fate/sub-mpsub-frames  | 1 +
>  tests/ref/fate/sub-pjs   | 1 +
>  tests/ref/fate/sub-realtext  | 1 +
>  tests/ref/fate/sub-sami  | 1 +
>  tests/ref/fate/sub-sami2 | 1 +
>  tests/ref/fate/sub-scc   | 1 +
>  tests/ref/fate/sub-srt   | 1 +
>  tests/ref/fate/sub-srt-badsyntax | 1 +
>  tests/ref/fate/sub-stl   | 1 +
>  tests/ref/fate/sub-subviewer | 1 +
>  tests/ref/fate/sub-subviewer1| 1 +
>  tests/ref/fate/sub-vplayer   | 1 +
>  tests/ref/fate/sub-webvtt| 1 +
>  tests/ref/fate/sub-webvtt2   | 1 +
>  25 files changed, 25 insertions(+)

The updated test samples have CRLF line endings, which `git am` doesn't seem 
to like. `git apply` and `git commit` do not care about the line endings. To 
apply the patch it's possible to use `git am --keep-cr`.

Alternatively, it is possible to add these files with `eol=crlf` to 
.gitattributes, which will allow a plain `git am` to work with these files in 
the future, but this has the drawback that git will report the whole file 
as having been rewritten (the actual file doesn't change, but git's view 
of the file does).
Also, adding `eol=crlf` only works for samples that *only* use CRLF line 
endings. Should there be mixed line endings on purpose (doesn't seem to be the 
case here) adding `eol=crlf` might mess things up.
___
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 0/2] Pro Pinball Series Soundbank demuxer + decoder.

2020-04-24 Thread Zane van Iperen
On Sat, 18 Apr 2020 00:20:30 +
"Zane van Iperen"  wrote:

> 
> Adds support for the soundbank files used by the Pro Pinball series
> of games.
> 
Ping again.

Zane

___
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] dnn-layer-mathbinary-test: Fix tests for cases with extra intermediate precision

2020-04-24 Thread Martin Storsjö

On Fri, 24 Apr 2020, Guo, Yejun wrote:





-Original Message-
From: ffmpeg-devel  On Behalf Of Martin
Storsj?
Sent: Friday, April 24, 2020 6:44 PM
To: FFmpeg development discussions and patches 
Subject: Re: [FFmpeg-devel] [PATCH] dnn-layer-mathbinary-test: Fix tests for
cases with extra intermediate precision

On Thu, 23 Apr 2020, Guo, Yejun wrote:


-Original Message-
From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On Behalf
Of Martin Storsj?
Sent: Thursday, April 23, 2020 2:34 PM
To: ffmpeg-devel@ffmpeg.org
Subject: [FFmpeg-devel] [PATCH] dnn-layer-mathbinary-test: Fix tests
for cases with extra intermediate precision

This fixes tests on 32 bit x86 mingw with clang, which uses x87 fpu
by default.

In this setup, while the get_expected function is declared to return
float, the compiler is (especially given the optimization flags set)
free to keep the intermediate values (in this case, the return value
from the inlined function) in higher precision.

This results in the situation where 7.28 (which actually, as a float,
ends up as 7.282098), multiplied by 100, is
728.00 when really forced into a 32 bit float, but 728.21
when kept with higher intermediate precision.

For the multiplication case, a more suitable epsilon would e.g.
be 2*FLT_EPSILON*fabs(expected_output),


thanks for the fix. LGTM.

Just want to have a talk with 2*FLT_EPSILON*fabs(expected_output),
any explanation for this? looks ULP (units of least precision) based
method is a good choice, see https://bitbashing.io/comparing-floats.html.
Anyway, let's use the hardcoded threshold for simplicity.


FLT_EPSILON corresponds to 1 ULP when the exponent is zero, i.e. in the range
[1,2] or [-2,-1]. So by doing FLT_EPSILON*fabs(expected_output) you get the
magnitude of 1 ULP for the value expected_output. By allowing a difference of 2
ULP it would be a bit more lenient - not sure if that aspect really is relevant 
or
not.

This would work fine for this particular test, as you have two input values that
should be represented the same in both implementations, and you do one
single operation on them - so the only difference _should_ be how much the
end result is rounded. If testing for likeness on a more complex function that
does a series of operations, you would have to account for a ~1 ULP rounding
error in each of the steps, and calculate how that rounding error could be
magnified by later operations.

And especially if you have two potentially inexact numbers that are close each
other and perform a subtraction, you'll have loss of significance, and the error
in that result is way larger than 1 ULP for that particular number.


Thanks a lot Martin, will push now.


I actually already pushed it, but thanks anyway!

// Martin

___
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 v3 2/4] libavfilter/qsvvpp: enabling d3d11va support

2020-04-24 Thread artem . galin
From: Artem Galin 

Adding DX11 relevant device type checks and adjusting callback with
proper MediaSDK pair type support.

Signed-off-by: Artem Galin 
---
 libavfilter/qsvvpp.c | 35 ++-
 1 file changed, 22 insertions(+), 13 deletions(-)

diff --git a/libavfilter/qsvvpp.c b/libavfilter/qsvvpp.c
index 8d5ff2eb65..f74b504990 100644
--- a/libavfilter/qsvvpp.c
+++ b/libavfilter/qsvvpp.c
@@ -36,6 +36,7 @@
 
MFX_MEMTYPE_VIDEO_MEMORY_PROCESSOR_TARGET))
 #define IS_OPAQUE_MEMORY(mode) (mode & MFX_MEMTYPE_OPAQUE_FRAME)
 #define IS_SYSTEM_MEMORY(mode) (mode & MFX_MEMTYPE_SYSTEM_MEMORY)
+#define MFX_IMPL_VIA_MASK(impl) (0x0f00 & (impl))
 
 typedef struct QSVFrame {
 AVFrame  *frame;
@@ -68,12 +69,6 @@ struct QSVVPPContext {
 int nb_ext_buffers;
 };
 
-static const mfxHandleType handle_types[] = {
-MFX_HANDLE_VA_DISPLAY,
-MFX_HANDLE_D3D9_DEVICE_MANAGER,
-MFX_HANDLE_D3D11_DEVICE,
-};
-
 static const AVRational default_tb = { 1, 9 };
 
 /* functions for frameAlloc */
@@ -129,7 +124,17 @@ static mfxStatus frame_unlock(mfxHDL pthis, mfxMemId mid, 
mfxFrameData *ptr)
 
 static mfxStatus frame_get_hdl(mfxHDL pthis, mfxMemId mid, mfxHDL *hdl)
 {
+#if CONFIG_VAAPI
 *hdl = mid;
+#else
+mfxHDLPair *pair_dst = (mfxHDLPair*)hdl;
+mfxHDLPair *pair_src = (mfxHDLPair*)mid;
+
+pair_dst->first = pair_src->first;
+
+if (pair_src->second != (mfxMemId)MFX_INFINITE)
+pair_dst->second = pair_src->second;
+#endif
 return MFX_ERR_NONE;
 }
 
@@ -451,7 +456,7 @@ static int init_vpp_session(AVFilterContext *avctx, 
QSVVPPContext *s)
 
 s->out_mem_mode = IS_OPAQUE_MEMORY(s->in_mem_mode) ?
   MFX_MEMTYPE_OPAQUE_FRAME :
-  MFX_MEMTYPE_VIDEO_MEMORY_DECODER_TARGET;
+  MFX_MEMTYPE_VIDEO_MEMORY_DECODER_TARGET | 
MFX_MEMTYPE_FROM_VPPOUT;
 
 out_frames_ctx   = (AVHWFramesContext *)out_frames_ref->data;
 out_frames_hwctx = out_frames_ctx->hwctx;
@@ -497,14 +502,18 @@ static int init_vpp_session(AVFilterContext *avctx, 
QSVVPPContext *s)
 return AVERROR_UNKNOWN;
 }
 
-for (i = 0; i < FF_ARRAY_ELEMS(handle_types); i++) {
-ret = MFXVideoCORE_GetHandle(device_hwctx->session, handle_types[i], 
&handle);
-if (ret == MFX_ERR_NONE) {
-handle_type = handle_types[i];
-break;
-}
+if (MFX_IMPL_VIA_VAAPI == MFX_IMPL_VIA_MASK(impl)) {
+handle_type = MFX_HANDLE_VA_DISPLAY;
+} else if (MFX_IMPL_VIA_D3D11 == MFX_IMPL_VIA_MASK(impl)) {
+handle_type = MFX_HANDLE_D3D11_DEVICE;
+} else if (MFX_IMPL_VIA_D3D9 == MFX_IMPL_VIA_MASK(impl)) {
+handle_type = MFX_HANDLE_D3D9_DEVICE_MANAGER;
+} else {
+av_log(avctx, AV_LOG_ERROR, "Error unsupported handle type\n");
+return AVERROR_UNKNOWN;
 }
 
+ret = MFXVideoCORE_GetHandle(device_hwctx->session, handle_type, &handle);
 if (ret != MFX_ERR_NONE) {
 av_log(avctx, AV_LOG_ERROR, "Error getting the session handle\n");
 return AVERROR_UNKNOWN;
-- 
2.26.0

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

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

[FFmpeg-devel] [PATCH v3 4/4] libavutil/qsv: enabling d3d11va support

2020-04-24 Thread artem . galin
From: Artem Galin 

Makes selection of d3d11va device type by default and over DirectX 9,
which is still supported but requires explicit selection.
This enables usage of non-powered/headless GPU, better HDR support.
Pool of resources is allocated as one texture with array of slices.

Added d3d11va device selection by vendor id.
Example: --init_hw_device d3d11va:,vendor=0x8086

DirectX 9 usage.
Example: --init_hw_device qsv:hw,child_device_type=dxva2

Signed-off-by: Artem Galin 
---
 libavutil/hwcontext_d3d11va.c |  82 +++-
 libavutil/hwcontext_d3d11va.h |   8 +
 libavutil/hwcontext_qsv.c | 363 +++---
 3 files changed, 379 insertions(+), 74 deletions(-)

diff --git a/libavutil/hwcontext_d3d11va.c b/libavutil/hwcontext_d3d11va.c
index c8ae58f908..c5e127aadb 100644
--- a/libavutil/hwcontext_d3d11va.c
+++ b/libavutil/hwcontext_d3d11va.c
@@ -72,7 +72,7 @@ static av_cold void load_functions(void)
 }
 
 typedef struct D3D11VAFramesContext {
-int nb_surfaces_used;
+size_t nb_surfaces;
 
 DXGI_FORMAT format;
 
@@ -112,6 +112,8 @@ static void d3d11va_frames_uninit(AVHWFramesContext *ctx)
 if (s->staging_texture)
 ID3D11Texture2D_Release(s->staging_texture);
 s->staging_texture = NULL;
+
+av_freep(&frames_hwctx->texture_infos);
 }
 
 static int d3d11va_frames_get_constraints(AVHWDeviceContext *ctx,
@@ -152,8 +154,9 @@ static void free_texture(void *opaque, uint8_t *data)
 av_free(data);
 }
 
-static AVBufferRef *wrap_texture_buf(ID3D11Texture2D *tex, int index)
+static AVBufferRef *wrap_texture_buf(AVHWFramesContext *ctx, ID3D11Texture2D 
*tex, int index)
 {
+AVD3D11VAFramesContext *frames_hwctx = ctx->hwctx;
 AVBufferRef *buf;
 AVD3D11FrameDescriptor *desc = av_mallocz(sizeof(*desc));
 if (!desc) {
@@ -161,6 +164,10 @@ static AVBufferRef *wrap_texture_buf(ID3D11Texture2D *tex, 
int index)
 return NULL;
 }
 
+frames_hwctx->texture_infos[frames_hwctx->nb_surfaces_used].texture = tex;
+frames_hwctx->texture_infos[frames_hwctx->nb_surfaces_used].index = index;
+frames_hwctx->nb_surfaces_used++;
+
 desc->texture = tex;
 desc->index   = index;
 
@@ -199,13 +206,12 @@ static AVBufferRef 
*d3d11va_alloc_single(AVHWFramesContext *ctx)
 return NULL;
 }
 
-return wrap_texture_buf(tex, 0);
+return wrap_texture_buf(ctx, tex, 0);
 }
 
 static AVBufferRef *d3d11va_pool_alloc(void *opaque, int size)
 {
 AVHWFramesContext*ctx = (AVHWFramesContext*)opaque;
-D3D11VAFramesContext   *s = ctx->internal->priv;
 AVD3D11VAFramesContext *hwctx = ctx->hwctx;
 D3D11_TEXTURE2D_DESC  texDesc;
 
@@ -214,13 +220,13 @@ static AVBufferRef *d3d11va_pool_alloc(void *opaque, int 
size)
 
 ID3D11Texture2D_GetDesc(hwctx->texture, &texDesc);
 
-if (s->nb_surfaces_used >= texDesc.ArraySize) {
+if (hwctx->nb_surfaces_used >= texDesc.ArraySize) {
 av_log(ctx, AV_LOG_ERROR, "Static surface pool size exceeded.\n");
 return NULL;
 }
 
 ID3D11Texture2D_AddRef(hwctx->texture);
-return wrap_texture_buf(hwctx->texture, s->nb_surfaces_used++);
+return wrap_texture_buf(ctx, hwctx->texture, hwctx->nb_surfaces_used);
 }
 
 static int d3d11va_frames_init(AVHWFramesContext *ctx)
@@ -267,7 +273,7 @@ static int d3d11va_frames_init(AVHWFramesContext *ctx)
 av_log(ctx, AV_LOG_ERROR, "User-provided texture has mismatching 
parameters\n");
 return AVERROR(EINVAL);
 }
-} else if (texDesc.ArraySize > 0) {
+} else if (!(texDesc.BindFlags & D3D11_BIND_RENDER_TARGET) && 
texDesc.ArraySize > 0) {
 hr = ID3D11Device_CreateTexture2D(device_hwctx->device, &texDesc, 
NULL, &hwctx->texture);
 if (FAILED(hr)) {
 av_log(ctx, AV_LOG_ERROR, "Could not create the texture (%lx)\n", 
(long)hr);
@@ -275,6 +281,12 @@ static int d3d11va_frames_init(AVHWFramesContext *ctx)
 }
 }
 
+hwctx->texture_infos = av_mallocz_array(ctx->initial_pool_size, 
sizeof(*hwctx->texture_infos));
+if (!hwctx->texture_infos)
+return AVERROR(ENOMEM);
+
+s->nb_surfaces = ctx->initial_pool_size;
+
 ctx->internal->pool_internal = 
av_buffer_pool_init2(sizeof(AVD3D11FrameDescriptor),
 ctx, 
d3d11va_pool_alloc, NULL);
 if (!ctx->internal->pool_internal)
@@ -511,15 +523,55 @@ static void d3d11va_device_uninit(AVHWDeviceContext 
*hwdev)
 }
 }
 
+static int d3d11va_device_find_adapter_by_vendor_id(AVHWDeviceContext *ctx, 
UINT creationFlags, long int vendor_id)
+{
+HRESULT hr;
+IDXGIAdapter *adapter = NULL;
+int adapter_id = 0;
+IDXGIFactory2 *factory;
+hr = mCreateDXGIFactory(&IID_IDXGIFactory2, (void **)&factory);
+while (IDXGIFactory2_EnumAdapters(factory, adapter_id++, &adapter) != 
DXGI_ERROR_NOT_FOUND) {
+ID3D11Device* device = NULL;
+DXGI_ADAPTER_DESC adapter_desc;
+
+hr = mD3D11CreateDevice(adapter, 

[FFmpeg-devel] [PATCH v3 3/4] libavcodec/qsv: enabling d3d11va support, added mfxhdlpair

2020-04-24 Thread artem . galin
From: Artem Galin 

Adding DX11 relevant device type checks and adjusting callbacks with
proper MediaSDK pair type support.

Extending structure for proper MediaSDK pair type support.

Signed-off-by: Artem Galin 
---
 libavcodec/qsv.c  | 66 +++
 libavcodec/qsv_internal.h |  1 +
 2 files changed, 54 insertions(+), 13 deletions(-)

diff --git a/libavcodec/qsv.c b/libavcodec/qsv.c
index db98c75073..35e62417f6 100644
--- a/libavcodec/qsv.c
+++ b/libavcodec/qsv.c
@@ -36,6 +36,8 @@
 #include "avcodec.h"
 #include "qsv_internal.h"
 
+#define MFX_IMPL_VIA_MASK(impl) (0x0f00 & (impl))
+
 #if QSV_VERSION_ATLEAST(1, 12)
 #include "mfx/mfxvp8.h"
 #endif
@@ -221,8 +223,15 @@ int ff_qsv_find_surface_idx(QSVFramesContext *ctx, 
QSVFrame *frame)
 int i;
 for (i = 0; i < ctx->nb_mids; i++) {
 QSVMid *mid = &ctx->mids[i];
+#if CONFIG_VAAPI
 if (mid->handle == frame->surface.Data.MemId)
 return i;
+#else
+mfxHDLPair *pair = (mfxHDLPair*)frame->surface.Data.MemId;
+if ((mid->handle_pair.first == pair->first) &&
+(mid->handle_pair.second == pair->second))
+return i;
+#endif
 }
 return AVERROR_BUG;
 }
@@ -362,7 +371,11 @@ static int ff_qsv_set_display_handle(AVCodecContext 
*avctx, QSVSession *qs)
 int ff_qsv_init_internal_session(AVCodecContext *avctx, QSVSession *qs,
  const char *load_plugins, int gpu_copy)
 {
+#if CONFIG_D3D11VA
+mfxIMPL  impl = MFX_IMPL_AUTO_ANY | MFX_IMPL_VIA_D3D11;
+#else
 mfxIMPL  impl = MFX_IMPL_AUTO_ANY;
+#endif
 mfxVersionver = { { QSV_VERSION_MINOR, QSV_VERSION_MAJOR } };
 mfxInitParam init_par = { MFX_IMPL_AUTO_ANY };
 
@@ -449,11 +462,19 @@ static AVBufferRef *qsv_create_mids(AVBufferRef 
*hw_frames_ref)
 return NULL;
 }
 
+#if CONFIG_VAAPI
 for (i = 0; i < nb_surfaces; i++) {
 QSVMid *mid = &mids[i];
 mid->handle= frames_hwctx->surfaces[i].Data.MemId;
 mid->hw_frames_ref = hw_frames_ref1;
 }
+#else
+for (i = 0; i < nb_surfaces; i++) {
+QSVMid *mid = &mids[i];
+mid->handle_pair   = 
*((mfxHDLPair*)frames_hwctx->surfaces[i].Data.MemId);
+mid->hw_frames_ref = hw_frames_ref1;
+}
+#endif
 
 return mids_buf;
 }
@@ -628,7 +649,11 @@ static mfxStatus qsv_frame_lock(mfxHDL pthis, mfxMemId 
mid, mfxFrameData *ptr)
 goto fail;
 
 qsv_mid->surf.Info = hw_frames_hwctx->surfaces[0].Info;
+#if CONFIG_VAAPI
 qsv_mid->surf.Data.MemId = qsv_mid->handle;
+#else
+qsv_mid->surf.Data.MemId = &qsv_mid->handle_pair;
+#endif
 
 /* map the data to the system memory */
 ret = av_hwframe_map(qsv_mid->locked_frame, qsv_mid->hw_frame,
@@ -661,7 +686,17 @@ static mfxStatus qsv_frame_unlock(mfxHDL pthis, mfxMemId 
mid, mfxFrameData *ptr)
 static mfxStatus qsv_frame_get_hdl(mfxHDL pthis, mfxMemId mid, mfxHDL *hdl)
 {
 QSVMid *qsv_mid = (QSVMid*)mid;
+#if CONFIG_VAAPI
 *hdl = qsv_mid->handle;
+#else
+mfxHDLPair *pair_dst = (mfxHDLPair*)hdl;
+mfxHDLPair *pair_src = (mfxHDLPair*)&qsv_mid->handle_pair;
+
+pair_dst->first = pair_src->first;
+
+if (pair_src->second != (mfxMemId)MFX_INFINITE)
+pair_dst->second = pair_src->second;
+#endif
 return MFX_ERR_NONE;
 }
 
@@ -669,24 +704,19 @@ int ff_qsv_init_session_device(AVCodecContext *avctx, 
mfxSession *psession,
AVBufferRef *device_ref, const char 
*load_plugins,
int gpu_copy)
 {
-static const mfxHandleType handle_types[] = {
-MFX_HANDLE_VA_DISPLAY,
-MFX_HANDLE_D3D9_DEVICE_MANAGER,
-MFX_HANDLE_D3D11_DEVICE,
-};
 AVHWDeviceContext*device_ctx = (AVHWDeviceContext*)device_ref->data;
 AVQSVDeviceContext *device_hwctx = device_ctx->hwctx;
 mfxSessionparent_session = device_hwctx->session;
 mfxInitParaminit_par = { MFX_IMPL_AUTO_ANY };
 mfxHDLhandle = NULL;
+int  hw_handle_supported = 0;
 
 mfxSessionsession;
 mfxVersionver;
 mfxIMPL   impl;
 mfxHandleType handle_type;
 mfxStatus err;
-
-int i, ret;
+int ret;
 
 err = MFXQueryIMPL(parent_session, &impl);
 if (err == MFX_ERR_NONE)
@@ -695,13 +725,23 @@ int ff_qsv_init_session_device(AVCodecContext *avctx, 
mfxSession *psession,
 return ff_qsv_print_error(avctx, err,
   "Error querying the session attributes");
 
-for (i = 0; i < FF_ARRAY_ELEMS(handle_types); i++) {
-err = MFXVideoCORE_GetHandle(parent_session, handle_types[i], &handle);
-if (err == MFX_ERR_NONE) {
-handle_type = handle_types[i];
-break;
+if (MFX_IMPL_VIA_VAAPI == MFX_IMPL_VIA_MASK(impl)) {
+handle_type = MFX_HANDLE_VA_DISPLAY;
+hw_handle_supported = 1;
+} else if (MFX_IMPL_VIA_D3D11 == MFX_IMPL_VIA_MASK(impl))

[FFmpeg-devel] [PATCH 2/2] avformat mov fix to detect if stream position has been reset

2020-04-24 Thread vectronic
if pos has been reset, clear fragments and indexes and search for next root

Signed-off-by: vectronic 
---
 libavformat/mov.c | 36 +---
 1 file changed, 33 insertions(+), 3 deletions(-)

diff --git a/libavformat/mov.c b/libavformat/mov.c
index 3d6fef685d..8f051fb9b1 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -7796,15 +7796,15 @@ static int mov_switch_root(AVFormatContext *s, int64_t 
target, int index)
 
 if (index >= 0 && index < mov->frag_index.nb_items)
 target = mov->frag_index.item[index].moof_offset;
-if (avio_seek(s->pb, target, SEEK_SET) != target) {
+if (target >= 0 && avio_seek(s->pb, target, SEEK_SET) != target) {
 av_log(mov->fc, AV_LOG_ERROR, "root atom offset 0x%"PRIx64": partial 
file\n", target);
 return AVERROR_INVALIDDATA;
 }
 
 mov->next_root_atom = 0;
-if (index < 0 || index >= mov->frag_index.nb_items)
+if ((index < 0 && target >= 0) || index >= mov->frag_index.nb_items)
 index = search_frag_moof_offset(&mov->frag_index, target);
-if (index < mov->frag_index.nb_items &&
+if (index >= 0 && index < mov->frag_index.nb_items &&
 mov->frag_index.item[index].moof_offset == target) {
 if (index + 1 < mov->frag_index.nb_items)
 mov->next_root_atom = mov->frag_index.item[index + 1].moof_offset;
@@ -7856,8 +7856,38 @@ static int mov_read_packet(AVFormatContext *s, AVPacket 
*pkt)
 AVStream *st = NULL;
 int64_t current_index;
 int ret;
+int i;
 mov->fc = s;
  retry:
+if (s->pb->pos == 0) {
+
+// Discard current fragment index
+if (mov->frag_index.allocated_size > 0) {
+av_freep(&mov->frag_index.item);
+mov->frag_index.nb_items = 0;
+mov->frag_index.allocated_size = 0;
+mov->frag_index.current = -1;
+mov->frag_index.complete = 0;
+}
+
+for (i = 0; i < s->nb_streams; i++) {
+AVStream *avst = s->streams[i];
+MOVStreamContext *msc = avst->priv_data;
+
+// Clear current sample
+mov_current_sample_set(msc, 0);
+
+// Discard current index entries
+if (avst->index_entries_allocated_size > 0) {
+av_freep(&avst->index_entries);
+avst->index_entries_allocated_size = 0;
+avst->nb_index_entries = 0;
+}
+}
+
+if ((ret = mov_switch_root(s, -1, -1)) < 0)
+return ret;
+}
 sample = mov_find_next_sample(s, &st);
 if (!sample || (mov->next_root_atom && sample->pos > mov->next_root_atom)) 
{
 if (!mov->next_root_atom)
-- 
2.24.2 (Apple Git-127)

___
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] avformat hls fix to seek logic

2020-04-24 Thread vectronic
ensure a keyframe is returned if AVSEEK_FLAG_ANY is not specified

Signed-off-by: vectronic 
---
 libavformat/hls.c | 8 +---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/libavformat/hls.c b/libavformat/hls.c
index fc45719d1c..4e59142c99 100644
--- a/libavformat/hls.c
+++ b/libavformat/hls.c
@@ -2146,8 +2146,10 @@ static int hls_read_packet(AVFormatContext *s, AVPacket 
*pkt)
 ts_diff = av_rescale_rnd(pls->pkt.dts, AV_TIME_BASE,
 tb.den, AV_ROUND_DOWN) -
 pls->seek_timestamp;
-if (ts_diff >= 0 && (pls->seek_flags  & AVSEEK_FLAG_ANY ||
-pls->pkt.flags & AV_PKT_FLAG_KEY)) {
+/* If AVSEEK_FLAG_ANY, keep reading until ts_diff is 
greater than 0
+ * otherwise return the first keyframe encountered */
+if ((ts_diff >= 0 && (pls->seek_flags & AVSEEK_FLAG_ANY)) 
||
+(!(pls->seek_flags & AVSEEK_FLAG_ANY) && 
(pls->pkt.flags & AV_PKT_FLAG_KEY)))  {
 pls->seek_timestamp = AV_NOPTS_VALUE;
 break;
 }
@@ -2291,7 +2293,7 @@ static int hls_read_seek(AVFormatContext *s, int 
stream_index,
 pls->pb.eof_reached = 0;
 /* Clear any buffered data */
 pls->pb.buf_end = pls->pb.buf_ptr = pls->pb.buffer;
-/* Reset the pos, to let the mpegts demuxer know we've seeked. */
+/* Reset the pos, to let the mpegts/mov demuxer know we've seeked. */
 pls->pb.pos = 0;
 /* Flush the packet queue of the subdemuxer. */
 ff_read_frame_flush(pls->ctx);
-- 
2.24.2 (Apple Git-127)

___
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 0/2] fix for seeking in HLS with TS/FMP4 media

2020-04-24 Thread vectronic
I am resubmitting a patch which fixes the following two tickets:

https://trac.ffmpeg.org/ticket/7359
https://trac.ffmpeg.org/ticket/7485

The patch consists of 2 parts. The first is necessary to fix the case of HLS 
seeking when
the HLS package consists of ts files. The second fixes HLS seeking when the HLS 
package
consists of fmp4 files. Note that the first can be applied without the second, 
and HLS
seeking with fmp4 files will remain broken, but in a different manner. The 
first patch
works because it relies on correct behaviour implemented in mpegts.c, the 
second patch mirrors this
behaviour in mov.c.

The issues can be demonstrated as follows:

./ffmpeg -ss 3 -i http://vectronic.io/hls_seek_issue/ts/in.m3u8 -t 2 out.mp4
./ffmpeg -ss 3 -i http://vectronic.io/hls_seek_issue/fmp4/in.m3u8 -t 2 out.mp4

These both produce zero duration output files.

With the first patch applied, the ts example produces a 2 second output file as 
expected.
However the fmp4 example results in a conversion error.

With the second patch applied, both the ts and fmp4 examples produce 2 second 
output files as expected.

Patch 1: Change to logic in hls.c for seeking

After performing a rough seek in hls.c hls_read_seek() to the nearest segment, 
the logic for hls_read_packet() was to discard packets until a DTS after the 
accurate seek point is discovered. This was done even if AVSEEK_FLAG_ANY was 
not specified in the initial seek request. The patch changes this so that if 
AVSEEK_FLAG_ANY has not been specified, it will instead return the first 
keyframe discovered after the rough seek point.

Patch 2: Change to logic in mov.c for reading packets after an HLS seek

Within hls.c when hls_read_seek() is called it resets the stream position as 
follows:

/* Reset the pos, to let the mpegts demuxer know we've seeked. */
pls->pb.pos = 0;

There is support for this in the mpegts handle_packets() code to check if the 
position has been reset and clear out any PES packets:

if (avio_tell(s->pb) != ts->last_pos) {
  int i;
  av_log(ts->stream, AV_LOG_TRACE, "Skipping after seek\n");
  /* seek detected, flush pes buffer */

This behaviour needed to be mirrored in the mov demuxer. In mov.c it now 
detects if the pos has been reset in mov_read_packet(). It clears fragments and 
indexes and searches for the next root i.e. the next fragment via 
mov_switch_root().

vectronic (2):
  avformat hls fix to seek logic
  avformat mov fix to detect if stream position has been reset

 libavformat/hls.c |  8 +---
 libavformat/mov.c | 36 +---
 2 files changed, 38 insertions(+), 6 deletions(-)

-- 
2.24.2 (Apple Git-127)

___
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 v3 1/4] fftools/qsv: enabling d3d11va/dxva2 device selection

2020-04-24 Thread artem . galin
From: Artem Galin 

child_device_type argument is responsible for selection.

Usage examples: -init_hw_device qsv:hw,child_device_type=d3d11va
-init_hw_device qsv:hw,child_device_type=dxva2

Signed-off-by: Artem Galin 
---
 fftools/ffmpeg_opt.c | 12 +++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c
index 680f0f1dfb..de5bc51bee 100644
--- a/fftools/ffmpeg_opt.c
+++ b/fftools/ffmpeg_opt.c
@@ -565,7 +565,17 @@ static int opt_init_hw_device(void *optctx, const char 
*opt, const char *arg)
 printf("\n");
 exit_program(0);
 } else {
-return hw_device_init_from_string(arg, NULL);
+HWDevice *dev;
+int err;
+if (!arg)
+return AVERROR(ENOMEM);
+err = hw_device_init_from_string(arg, &dev);
+if (err < 0)
+return err;
+hw_device_ctx = av_buffer_ref(dev->device_ref);
+if (!hw_device_ctx)
+return AVERROR(ENOMEM);
+return 0;
 }
 }
 
-- 
2.26.0

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

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

Re: [FFmpeg-devel] [PATCH 2/3] swscale/x86/output: add AVX2 version of yuv2nv12cX

2020-04-24 Thread Michael Niedermayer
On Thu, Apr 23, 2020 at 08:13:18PM -0700, Nelson Gomez wrote:
> From: Nelson Gomez 
> 
> 256 bits is just wide enough to fit all the operands needed to vectorize
> the software implementation, but AVX2 is needed to for some instructions
> like 16-to-32 bit vector sign extension.
> 
> Output is bit-for-bit identical to C.
> 
> Signed-off-by: Nelson Gomez 
> ---
>  libswscale/x86/output.asm | 140 +-
>  libswscale/x86/swscale.c  |  24 +++
>  2 files changed, 163 insertions(+), 1 deletion(-)

Fails to build on x86_32

X86ASM  libswscale/x86/output.o
src/libswscale/x86/output.asm:562: error: invalid operands in non-64-bit mode
src/libswscale/x86/output.asm:474: ... from macro `yuv2nv12cX_avx2_fn' defined 
here
src/libswscale/x86/output.asm:562: error: invalid operands in non-64-bit mode
src/libswscale/x86/output.asm:474: ... from macro `yuv2nv12cX_avx2_fn' defined 
here
src/libswscale/x86/output.asm:562: error: invalid operands in non-64-bit mode
src/libswscale/x86/output.asm:474: ... from macro `yuv2nv12cX_avx2_fn' defined 
here
src/libswscale/x86/output.asm:562: error: invalid operands in non-64-bit mode
src/libswscale/x86/output.asm:474: ... from macro `yuv2nv12cX_avx2_fn' defined 
here
src/libswscale/x86/output.asm:562: error: invalid operands in non-64-bit mode
src/libswscale/x86/output.asm:474: ... from macro `yuv2nv12cX_avx2_fn' defined 
here
src/libswscale/x86/output.asm:562: error: invalid operands in non-64-bit mode
src/libswscale/x86/output.asm:474: ... from macro `yuv2nv12cX_avx2_fn' defined 
here
src/libswscale/x86/output.asm:562: error: invalid operands in non-64-bit mode
src/libswscale/x86/output.asm:474: ... from macro `yuv2nv12cX_avx2_fn' defined 
here
src/libswscale/x86/output.asm:562: error: invalid operands in non-64-bit mode
src/libswscale/x86/output.asm:474: ... from macro `yuv2nv12cX_avx2_fn' defined 
here
src/libswscale/x86/output.asm:562: error: invalid operands in non-64-bit mode
src/libswscale/x86/output.asm:474: ... from macro `yuv2nv12cX_avx2_fn' defined 
here
src/libswscale/x86/output.asm:562: error: invalid operands in non-64-bit mode
src/libswscale/x86/output.asm:474: ... from macro `yuv2nv12cX_avx2_fn' defined 
here
src/libswscale/x86/output.asm:562: error: invalid operands in non-64-bit mode
src/libswscale/x86/output.asm:474: ... from macro `yuv2nv12cX_avx2_fn' defined 
here
src/libswscale/x86/output.asm:562: error: invalid operands in non-64-bit mode
src/libswscale/x86/output.asm:474: ... from macro `yuv2nv12cX_avx2_fn' defined 
here
src/libswscale/x86/output.asm:562: error: invalid operands in non-64-bit mode
src/libswscale/x86/output.asm:474: ... from macro `yuv2nv12cX_avx2_fn' defined 
here
src/libswscale/x86/output.asm:562: error: invalid operands in non-64-bit mode
src/libswscale/x86/output.asm:474: ... from macro `yuv2nv12cX_avx2_fn' defined 
here
src/libswscale/x86/output.asm:562: error: invalid operands in non-64-bit mode
src/libswscale/x86/output.asm:474: ... from macro `yuv2nv12cX_avx2_fn' defined 
here
src/libswscale/x86/output.asm:562: error: invalid operands in non-64-bit mode
src/libswscale/x86/output.asm:474: ... from macro `yuv2nv12cX_avx2_fn' defined 
here
src/libswscale/x86/output.asm:562: error: invalid operands in non-64-bit mode
src/libswscale/x86/output.asm:474: ... from macro `yuv2nv12cX_avx2_fn' defined 
here
src/libswscale/x86/output.asm:562: error: invalid operands in non-64-bit mode
src/libswscale/x86/output.asm:474: ... from macro `yuv2nv12cX_avx2_fn' defined 
here
src/libswscale/x86/output.asm:562: error: invalid operands in non-64-bit mode
src/libswscale/x86/output.asm:474: ... from macro `yuv2nv12cX_avx2_fn' defined 
here
src/libswscale/x86/output.asm:562: error: invalid operands in non-64-bit mode
src/libswscale/x86/output.asm:474: ... from macro `yuv2nv12cX_avx2_fn' defined 
here
src/libswscale/x86/output.asm:562: error: invalid operands in non-64-bit mode
src/libswscale/x86/output.asm:474: ... from macro `yuv2nv12cX_avx2_fn' defined 
here
src/libswscale/x86/output.asm:562: error: invalid operands in non-64-bit mode
src/libswscale/x86/output.asm:474: ... from macro `yuv2nv12cX_avx2_fn' defined 
here
src/libswscale/x86/output.asm:562: error: invalid operands in non-64-bit mode
src/libswscale/x86/output.asm:474: ... from macro `yuv2nv12cX_avx2_fn' defined 
here
src/libswscale/x86/output.asm:562: error: invalid operands in non-64-bit mode
src/libswscale/x86/output.asm:474: ... from macro `yuv2nv12cX_avx2_fn' defined 
here
src/libswscale/x86/output.asm:562: error: invalid operands in non-64-bit mode
src/libswscale/x86/output.asm:474: ... from macro `yuv2nv12cX_avx2_fn' defined 
here
src/libswscale/x86/output.asm:562: error: invalid operands in non-64-bit mode
src/libswscale/x86/output.asm:474: ... from macro `yuv2nv12cX_avx2_fn' defined 
here
src/libswscale/x86/output.asm:562: error: invalid operands in non-64-bit mode
src/libswscale/x86/output.asm:474: ... from macro `yuv2nv12cX_avx2_fn' defined 
here
src/li

[FFmpeg-devel] [PATCH v2 2/3] swscale/x86/output: add AVX2 version of yuv2nv12cX

2020-04-24 Thread Nelson Gomez
From: Nelson Gomez 

256 bits is just wide enough to fit all the operands needed to vectorize
the software implementation, but AVX2 is needed to for a couple of
instructions like cross-lane permutation.

Output is bit-for-bit identical to C.

Signed-off-by: Nelson Gomez 
---
 libswscale/x86/output.asm | 124 +-
 libswscale/x86/swscale.c  |  24 
 2 files changed, 147 insertions(+), 1 deletion(-)

diff --git a/libswscale/x86/output.asm b/libswscale/x86/output.asm
index db3e9934f8..7478e12403 100644
--- a/libswscale/x86/output.asm
+++ b/libswscale/x86/output.asm
@@ -2,6 +2,7 @@
 ;* x86-optimized vertical line scaling functions
 ;* Copyright (c) 2011 Ronald S. Bultje 
 ;*Kieran Kunhya 
+;*   (c) 2020 Nelson Gomez 
 ;*
 ;* This file is part of FFmpeg.
 ;*
@@ -22,7 +23,7 @@
 
 %include "libavutil/x86/x86util.asm"
 
-SECTION_RODATA
+SECTION_RODATA 32
 
 minshort:  times 8 dw 0x8000
 yuv2yuvX_16_start:  times 4 dd 0x4000 - 0x4000
@@ -34,9 +35,20 @@ pd_4:  times 4 dd 4
 pd_4min0x4:times 4 dd 4 - (0x4)
 pw_16: times 8 dw 16
 pw_32: times 8 dw 32
+pd_255:times 8 dd 255
 pw_512:times 8 dw 512
 pw_1024:   times 8 dw 1024
 
+yuv2nv12_shuffle_mask: times 2 db 0,  4,  8, 12, \
+ -1, -1, -1, -1, \
+ -1, -1, -1, -1, \
+ -1, -1, -1, -1
+yuv2nv21_shuffle_mask: times 2 db 4,  0, 12,  8, \
+ -1, -1, -1, -1, \
+ -1, -1, -1, -1, \
+ -1, -1, -1, -1
+yuv2nv12_permute_mask: dd 0, 4, 1, 2, 3, 5, 6, 7
+
 SECTION .text
 
 ;-
@@ -423,3 +435,113 @@ yuv2plane1_fn  9, 5, 3
 yuv2plane1_fn 10, 5, 3
 yuv2plane1_fn 16, 5, 3
 %endif
+
+%undef movsx
+
+;-
+; AVX2 yuv2nv12cX implementation
+;
+; void ff_yuv2nv12cX_avx2(enum AVPixelFormat format, const uint8_t *dither,
+; const int16_t *filter, int filterSize,
+; const int16_t **u, const int16_t **v,
+; uint8_t *dst, int dstWidth)
+;
+; void ff_yuv2nv21cX_avx2(enum AVPixelFormat format, const uint8_t *dither,
+; const int16_t *filter, int filterSize,
+; const int16_t **u, const int16_t **v,
+; uint8_t *dst, int dstWidth)
+;-
+
+%macro yuv2nv12cX_fn 1
+cglobal %1cX, 8, 11, 13, tmp1, dither, filter, filterSize, u, v, dst, dstWidth
+
+mov tmp1q, qword [ditherq]
+movq xm0, tmp1q
+ror tmp1q, 24
+movq xm1, tmp1q
+
+pmovzxbd m0, xm0
+pslld m0, m0, 12; ditherLo
+pmovzxbd m1, xm1
+pslld m1, m1, 12; ditherHi
+
+pxor m9, m9 ; uint8_min dwords
+mova m10, [pd_255]  ; uint8_max dwords
+mova m11, [%1_shuffle_mask] ; shuffle_mask
+mova m12, [yuv2nv12_permute_mask]   ; permute mask
+
+DEFINE_ARGS tmp1, tmp2, filter, filterSize, u, v, dst, dstWidth
+
+xor r8q, r8q
+
+nv12_outer_%1:
+mova m2, m0 ; resultLo
+mova m3, m1 ; resultHi
+xor r9q, r9q
+
+nv12_inner_%1:
+movsx r10d, word [filterq + (2 * r9q)]
+movd xm4, r10d
+vpbroadcastd m4, xm4; filter
+
+mov tmp1q, [uq + (gprsize * r9q)]
+mova xm7, oword [tmp1q + 2 * r8q]
+
+mov tmp2q, [vq + (gprsize * r9q)]
+mova xm8, oword [tmp2q + 2 * r8q]
+
+punpcklwd xm5, xm7, xm8
+pmovsxwd m5, xm5; multiplicandsLo
+punpckhwd xm6, xm7, xm8
+pmovsxwd m6, xm6; multiplicandsHi
+
+pmulld m7, m5, m4   ; mulResultLo
+pmulld m8, m6, m4   ; mulResultHi
+paddd m2, m2, m7; resultLo += mulResultLo
+paddd m3, m3, m8; resultHi += mulResultHi
+
+inc r9d
+cmp r9d, filterSized
+jl nv12_inner_%1
+; end of inner loop
+
+psrad m2, m2, 19
+psrad m3, m3, 19
+
+; Vectorized av_clip_uint8
+pmaxsd m2, m2, m9
+pmaxsd m3, m3, m9
+pminsd m2, m2, m10
+pminsd m3, m3, m10
+
+; At this point we have clamped uint8s arranged in this order:
+; m2: u1  0  0  0  v1  0  0  0  [...]
+; m3: u5  0  0  0  v5  0  0  0  [...]
+;
+; First, we shuffle the bytes to make the bytes semi-contiguous.
+; AVX-2 doesn't have cross-lane shuffling, so we'll end up with:
+; m2: u1  v1  u2  v2  0  0  0  0  0  0  0  0  u3  v3  u4  v4
+; m3: u5  v5  u6  v6  0  0  0  0  0  0  0  0  u7  v7  u8  v8
+pshufb m2, m2, m11
+ps

[FFmpeg-devel] [PATCH v2 0/3] swscale: add AVX2 version of yuv2nv12cX

2020-04-24 Thread Nelson Gomez
v2:
  - Addressing comments James left on iter. 1
  - Cleaned up how dither gets read to avoid using stack space

v1: http://ffmpeg.org/pipermail/ffmpeg-devel/2020-April/261313.html

This patchset aims to optimize yuv2nv12cX_c for Intel/AMD chips by adding an
AVX2 implementation of it. To support this change, the typedef declaration for
yuv2interleavedX_fn has been changed to pass two additional parameters for
chrDither8 and dstFormat rather than passing a pointer to the entire SwsContext.
Output is bit-identical to the software implementation.

Patchset validated on an Intel Xeon W-2133, Core i7-8650U, and an AMD Ryzen
1700. Passes fate tests; this patch is exercised by
fate-filter-pixdesc-nv{12,21,24,42}.

Benchmarks measured on the W-2133. Flags used are:

  -benchmark -i /dev/shm/benchmark.mp4 -pix_fmt nv42 -f null -

Benchmark material is a yuv420p file:

  http://linux.microsoft.com/~negomez/ffmpeg/yuv420p-benchmark.mp4

Results:

  * Single-threaded conversion: +95% fps

-cpuflags -avx2 -threads 1:

frame= 9959 fps=114 q=-0.0 Lsize=N/A time=00:05:32.29 bitrate=N/A 
speed=3.79x
bench: utime=87.648s stime=0.060s rtime=87.709s
bench: maxrss=35020kB

-cpuflags all -threads 1:

frame= 9959 fps=222 q=-0.0 Lsize=N/A time=00:05:32.29 bitrate=N/A 
speed=7.39x
bench: utime=44.900s stime=0.040s rtime=44.941s
bench: maxrss=33048kB


  * Multi-threaded conversion: +197% fps

-cpuflags -avx2:

frame= 9959 fps=159 q=-0.0 Lsize=N/A time=00:05:32.29 bitrate=N/A speed=5.3x
bench: utime=90.381s stime=0.430s rtime=62.663s
bench: maxrss=77420kB

-cpuflags all:

frame= 9959 fps=473 q=-0.0 Lsize=N/A time=00:05:32.29 bitrate=N/A 
speed=15.8x
bench: utime=48.625s stime=0.459s rtime=21.058s
bench: maxrss=78500kB

---

Nelson Gomez (3):
  swscale: make yuv2interleavedX more asm-friendly
  swscale/x86/output: add AVX2 version of yuv2nv12cX
  swscale: cosmetic fixes

 libswscale/output.c   |   25 +++---
 libswscale/swscale_internal.h |8 +-
 libswscale/vscale.c   |2
 libswscale/x86/output.asm |  124 +++-
 libswscale/x86/swscale.c  |   24 ++
 5 files changed, 166 insertions(+), 17 deletions(-)
___
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/3] swscale: make yuv2interleavedX more asm-friendly

2020-04-24 Thread Nelson Gomez
From: Nelson Gomez 

Extracting information from SwsContext in assembly is difficult, and
rearranging SwsContext just for asm access didn't look good. These
functions only need a couple of fields from it anyway, so just make
them parameters in their own right.

Signed-off-by: Nelson Gomez 
---
 libswscale/output.c   | 12 +---
 libswscale/swscale_internal.h |  5 +++--
 libswscale/vscale.c   |  2 +-
 3 files changed, 9 insertions(+), 10 deletions(-)

diff --git a/libswscale/output.c b/libswscale/output.c
index 68f43ffba3..2e5d6076ab 100644
--- a/libswscale/output.c
+++ b/libswscale/output.c
@@ -180,7 +180,7 @@ yuv2planeX_16_c_template(const int16_t *filter, int 
filterSize,
 }
 }
 
-static void yuv2p016cX_c(SwsContext *c, const int16_t *chrFilter, int 
chrFilterSize,
+static void yuv2p016cX_c(enum AVPixelFormat dstFormat, const uint8_t 
*chrDither, const int16_t *chrFilter, int chrFilterSize,
  const int16_t **chrUSrc, const int16_t **chrVSrc,
  uint8_t *dest8, int chrDstW)
 {
@@ -188,7 +188,7 @@ static void yuv2p016cX_c(SwsContext *c, const int16_t 
*chrFilter, int chrFilterS
 const int32_t **uSrc = (const int32_t **)chrUSrc;
 const int32_t **vSrc = (const int32_t **)chrVSrc;
 int shift = 15;
-int big_endian = c->dstFormat == AV_PIX_FMT_P016BE;
+int big_endian = dstFormat == AV_PIX_FMT_P016BE;
 int i, j;
 
 for (i = 0; i < chrDstW; i++) {
@@ -402,12 +402,10 @@ static void yuv2plane1_8_c(const int16_t *src, uint8_t 
*dest, int dstW,
 }
 }
 
-static void yuv2nv12cX_c(SwsContext *c, const int16_t *chrFilter, int 
chrFilterSize,
+static void yuv2nv12cX_c(enum AVPixelFormat dstFormat, const uint8_t 
*chrDither, const int16_t *chrFilter, int chrFilterSize,
 const int16_t **chrUSrc, const int16_t **chrVSrc,
 uint8_t *dest, int chrDstW)
 {
-enum AVPixelFormat dstFormat = c->dstFormat;
-const uint8_t *chrDither = c->chrDither8;
 int i;
 
 if (dstFormat == AV_PIX_FMT_NV12 ||
@@ -477,13 +475,13 @@ static void yuv2p010lX_c(const int16_t *filter, int 
filterSize,
 }
 }
 
-static void yuv2p010cX_c(SwsContext *c, const int16_t *chrFilter, int 
chrFilterSize,
+static void yuv2p010cX_c(enum AVPixelFormat dstFormat, const uint8_t 
*chrDither, const int16_t *chrFilter, int chrFilterSize,
  const int16_t **chrUSrc, const int16_t **chrVSrc,
  uint8_t *dest8, int chrDstW)
 {
 uint16_t *dest = (uint16_t*)dest8;
 int shift = 17;
-int big_endian = c->dstFormat == AV_PIX_FMT_P010BE;
+int big_endian = dstFormat == AV_PIX_FMT_P010BE;
 int i, j;
 
 for (i = 0; i < chrDstW; i++) {
diff --git a/libswscale/swscale_internal.h b/libswscale/swscale_internal.h
index 9dda53eead..42fd87e887 100644
--- a/libswscale/swscale_internal.h
+++ b/libswscale/swscale_internal.h
@@ -119,7 +119,8 @@ typedef void (*yuv2planarX_fn)(const int16_t *filter, int 
filterSize,
  * Write one line of horizontally scaled chroma to interleaved output
  * with multi-point vertical scaling between input pixels.
  *
- * @param c SWS scaling context
+ * @param dstFormat destination pixel format
+ * @param chrDither ordered dither array of type uint8_t and size 8
  * @param chrFilter vertical chroma scaling coefficients, 12 bits [0,4096]
  * @param chrUSrc   scaled chroma (U) source data, 15 bits for 8-10-bit
  *  output, 19 bits for 16-bit output (in int32_t)
@@ -130,7 +131,7 @@ typedef void (*yuv2planarX_fn)(const int16_t *filter, int 
filterSize,
  *  output, this is in uint16_t
  * @param dstW  width of chroma planes
  */
-typedef void (*yuv2interleavedX_fn)(struct SwsContext *c,
+typedef void (*yuv2interleavedX_fn)(enum AVPixelFormat dstFormat, const 
uint8_t *chrDither,
 const int16_t *chrFilter,
 int chrFilterSize,
 const int16_t **chrUSrc,
diff --git a/libswscale/vscale.c b/libswscale/vscale.c
index 72352dedb3..cac85921da 100644
--- a/libswscale/vscale.c
+++ b/libswscale/vscale.c
@@ -85,7 +85,7 @@ static int chr_planar_vscale(SwsContext *c, 
SwsFilterDescriptor *desc, int slice
 uint16_t *filter = inst->filter[0] + (inst->isMMX ? 0 : chrSliceY * 
inst->filter_size);
 
 if (c->yuv2nv12cX) {
-((yuv2interleavedX_fn)inst->pfn)(c, filter, inst->filter_size, 
(const int16_t**)src1, (const int16_t**)src2, dst1[0], dstW);
+((yuv2interleavedX_fn)inst->pfn)(c->dstFormat, c->chrDither8, 
filter, inst->filter_size, (const int16_t**)src1, (const int16_t**)src2, 
dst1[0], dstW);
 } else if (inst->filter_size == 1) {
 ((yuv2planar1_fn)inst->pfn)((const int16_t*)src1[0], dst1[0], 
dstW, c->chrDither8, 0);
 ((yuv2planar1_fn)inst->pfn)((const int16_t*)src2[0], dst2[0], 
dstW, c->chrDither

[FFmpeg-devel] [PATCH v2 3/3] swscale: cosmetic fixes

2020-04-24 Thread Nelson Gomez
From: Nelson Gomez 

Signed-off-by: Nelson Gomez 
---
 libswscale/output.c   | 13 -
 libswscale/swscale_internal.h |  3 ++-
 2 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/libswscale/output.c b/libswscale/output.c
index 2e5d6076ab..bddfaf16af 100644
--- a/libswscale/output.c
+++ b/libswscale/output.c
@@ -180,7 +180,8 @@ yuv2planeX_16_c_template(const int16_t *filter, int 
filterSize,
 }
 }
 
-static void yuv2p016cX_c(enum AVPixelFormat dstFormat, const uint8_t 
*chrDither, const int16_t *chrFilter, int chrFilterSize,
+static void yuv2p016cX_c(enum AVPixelFormat dstFormat, const uint8_t 
*chrDither,
+ const int16_t *chrFilter, int chrFilterSize,
  const int16_t **chrUSrc, const int16_t **chrVSrc,
  uint8_t *dest8, int chrDstW)
 {
@@ -402,9 +403,10 @@ static void yuv2plane1_8_c(const int16_t *src, uint8_t 
*dest, int dstW,
 }
 }
 
-static void yuv2nv12cX_c(enum AVPixelFormat dstFormat, const uint8_t 
*chrDither, const int16_t *chrFilter, int chrFilterSize,
-const int16_t **chrUSrc, const int16_t **chrVSrc,
-uint8_t *dest, int chrDstW)
+static void yuv2nv12cX_c(enum AVPixelFormat dstFormat, const uint8_t 
*chrDither,
+ const int16_t *chrFilter, int chrFilterSize,
+ const int16_t **chrUSrc, const int16_t **chrVSrc,
+ uint8_t *dest, int chrDstW)
 {
 int i;
 
@@ -475,7 +477,8 @@ static void yuv2p010lX_c(const int16_t *filter, int 
filterSize,
 }
 }
 
-static void yuv2p010cX_c(enum AVPixelFormat dstFormat, const uint8_t 
*chrDither, const int16_t *chrFilter, int chrFilterSize,
+static void yuv2p010cX_c(enum AVPixelFormat dstFormat, const uint8_t 
*chrDither,
+ const int16_t *chrFilter, int chrFilterSize,
  const int16_t **chrUSrc, const int16_t **chrVSrc,
  uint8_t *dest8, int chrDstW)
 {
diff --git a/libswscale/swscale_internal.h b/libswscale/swscale_internal.h
index 42fd87e887..d87a9ad741 100644
--- a/libswscale/swscale_internal.h
+++ b/libswscale/swscale_internal.h
@@ -131,7 +131,8 @@ typedef void (*yuv2planarX_fn)(const int16_t *filter, int 
filterSize,
  *  output, this is in uint16_t
  * @param dstW  width of chroma planes
  */
-typedef void (*yuv2interleavedX_fn)(enum AVPixelFormat dstFormat, const 
uint8_t *chrDither,
+typedef void (*yuv2interleavedX_fn)(enum AVPixelFormat dstFormat,
+const uint8_t *chrDither,
 const int16_t *chrFilter,
 int chrFilterSize,
 const int16_t **chrUSrc,
-- 
2.25.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/4] fftools/qsv: enabling d3d11va/dxva2 device selection

2020-04-24 Thread Artem Galin
Hi Steve,

The updated review is available by link
https://patchwork.ffmpeg.org/project/ffmpeg/list/?series=1017

Thanks,
Artem.

On Wed, 22 Apr 2020 at 15:39, Artem Galin  wrote:

> Hi Steve,
>
> On Tue, 21 Apr 2020 at 11:25, Steve Lhomme  wrote:
>
>> Hi,
>>
>> On 2020-04-15 15:07, artem.ga...@gmail.com wrote:
>> > From: Artem Galin 
>> >
>> > child_device_type argument is responsible for selection.
>> >
>> > Usage examples: -init_hw_device qsv:hw,child_device_type=d3d11va
>> >  -init_hw_device qsv:hw,child_device_type=dxva2
>> >
>> > Signed-off-by: Artem Galin 
>> > ---
>> >   fftools/ffmpeg_opt.c | 12 +++-
>> >   1 file changed, 11 insertions(+), 1 deletion(-)
>> >
>> > diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c
>> > index 95001a963f..82232c60b3 100644
>> > --- a/fftools/ffmpeg_opt.c
>> > +++ b/fftools/ffmpeg_opt.c
>> > @@ -568,7 +568,17 @@ static int opt_init_hw_device(void *optctx, const
>> char *opt, const char *arg)
>> >   printf("\n");
>> >   exit_program(0);
>> >   } else {
>> > -return hw_device_init_from_string(arg, NULL);
>> > +HWDevice *dev;
>> > +int err;
>> > +if (!arg)
>> > +return AVERROR(ENOMEM);
>> > +err = hw_device_init_from_string(arg, &dev);
>> > +if (err < 0)
>> > +return err;
>> > +hw_device_ctx = av_buffer_ref(dev->device_ref);
>> > +if (!hw_device_ctx)
>> > +return AVERROR(ENOMEM);
>> > +return 0;
>>
>> This is very similar to what is done in opt_vaapi_device().
>>
>> Maybe you could modify the "qsv_device" handling to support this ? It
>> will be ifdef'ed out when QSV is not enabled.
>>
>> There might also be some side effects for other hardware devices.
>> Especially the hw_device_ctx reference doesn't seem to be released (but
>> it's the same in opt_vaapi_device so I might be missing something).
>>
>>
> This has been intentionally done to match VAAPI behavior and suggested by
> Mark Thompson
> Please see discussion by link below:
>
> https://patchwork.ffmpeg.org/project/ffmpeg/patch/20200123151813.31739-1-artem.ga...@gmail.com/
>
>
>> >   }
>> >   }
>> >
>> > --
>> > 2.26.0
>> >
>> > ___
>> > ffmpeg-devel mailing list
>> > ffmpeg-devel@ffmpeg.org
>> > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>> >
>> > To unsubscribe, visit link above, or email
>> > ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
>> >
>> ___
>> ffmpeg-devel mailing list
>> ffmpeg-devel@ffmpeg.org
>> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>>
>> To unsubscribe, visit link above, or email
>> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
>
>
___
ffmpeg-devel 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 0/2] ffprobe add closed caption output to stream info

2020-04-24 Thread vectronic
closed caption presence is detected with ffprobe and output as part of
av_dump_format() however it is not included in output from -show_streams
this add closed_captions=0 or 1 to the stream info output and updates
fate test results.

vectronic (2):
  tools ffprobe: add closed caption output to stream info
  fate: update test references for closed_caption output in ffprobe
stream results

 fftools/ffprobe.c | 2 ++
 tests/ref/fate/concat-demuxer-extended-lavf-mxf   | 2 +-
 tests/ref/fate/concat-demuxer-extended-lavf-mxf_d10   | 2 +-
 tests/ref/fate/concat-demuxer-simple1-lavf-mxf| 2 +-
 tests/ref/fate/concat-demuxer-simple1-lavf-mxf_d10| 2 +-
 tests/ref/fate/concat-demuxer-simple2-lavf-ts | 2 +-
 tests/ref/fate/ffprobe_compact| 4 ++--
 tests/ref/fate/ffprobe_csv| 4 ++--
 tests/ref/fate/ffprobe_default| 2 ++
 tests/ref/fate/ffprobe_flat   | 2 ++
 tests/ref/fate/ffprobe_ini| 2 ++
 tests/ref/fate/ffprobe_json   | 2 ++
 tests/ref/fate/ffprobe_xml| 4 ++--
 tests/ref/fate/hapqa-extract-nosnappy-to-hapalphaonly-mov | 1 +
 tests/ref/fate/hapqa-extract-nosnappy-to-hapq-mov | 1 +
 tests/ref/fate/mov-zombie | 2 +-
 tests/ref/fate/mxf-probe-d10  | 1 +
 tests/ref/fate/mxf-probe-dnxhd| 1 +
 tests/ref/fate/mxf-probe-dv25 | 1 +
 19 files changed, 27 insertions(+), 12 deletions(-)

-- 
2.24.2 (Apple Git-127)

___
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] tools ffprobe: add closed caption output to stream info

2020-04-24 Thread vectronic
ensure closed caption info which is visible in default stream dump is also 
available in results when -show_streams is used

Signed-off-by: vectronic 
---
 fftools/ffprobe.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c
index 840fcb71e2..f0916cbd70 100644
--- a/fftools/ffprobe.c
+++ b/fftools/ffprobe.c
@@ -2550,6 +2550,7 @@ static int show_stream(WriterContext *w, AVFormatContext 
*fmt_ctx, int stream_id
 }
 #endif
 print_int("has_b_frames", par->video_delay);
+print_int("closed_captions", !!(dec_ctx->properties & 
FF_CODEC_PROPERTY_CLOSED_CAPTIONS));
 sar = av_guess_sample_aspect_ratio(fmt_ctx, stream, NULL);
 if (sar.num) {
 print_q("sample_aspect_ratio", sar, ':');
@@ -2950,6 +2951,7 @@ static int open_input_file(InputFile *ifile, const char 
*filename,
 
 ist->dec_ctx->pkt_timebase = stream->time_base;
 ist->dec_ctx->framerate = stream->avg_frame_rate;
+ist->dec_ctx->properties = stream->codec->properties;
 #if FF_API_LAVF_AVCTX
 ist->dec_ctx->coded_width = stream->codec->coded_width;
 ist->dec_ctx->coded_height = stream->codec->coded_height;
-- 
2.24.2 (Apple Git-127)

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

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

[FFmpeg-devel] [PATCH 2/2] fate: update test references for closed_caption output in ffprobe stream results

2020-04-24 Thread vectronic
Signed-off-by: vectronic 
---
 tests/ref/fate/concat-demuxer-extended-lavf-mxf   | 2 +-
 tests/ref/fate/concat-demuxer-extended-lavf-mxf_d10   | 2 +-
 tests/ref/fate/concat-demuxer-simple1-lavf-mxf| 2 +-
 tests/ref/fate/concat-demuxer-simple1-lavf-mxf_d10| 2 +-
 tests/ref/fate/concat-demuxer-simple2-lavf-ts | 2 +-
 tests/ref/fate/ffprobe_compact| 4 ++--
 tests/ref/fate/ffprobe_csv| 4 ++--
 tests/ref/fate/ffprobe_default| 2 ++
 tests/ref/fate/ffprobe_flat   | 2 ++
 tests/ref/fate/ffprobe_ini| 2 ++
 tests/ref/fate/ffprobe_json   | 2 ++
 tests/ref/fate/ffprobe_xml| 4 ++--
 tests/ref/fate/hapqa-extract-nosnappy-to-hapalphaonly-mov | 1 +
 tests/ref/fate/hapqa-extract-nosnappy-to-hapq-mov | 1 +
 tests/ref/fate/mov-zombie | 2 +-
 tests/ref/fate/mxf-probe-d10  | 1 +
 tests/ref/fate/mxf-probe-dnxhd| 1 +
 tests/ref/fate/mxf-probe-dv25 | 1 +
 18 files changed, 25 insertions(+), 12 deletions(-)

diff --git a/tests/ref/fate/concat-demuxer-extended-lavf-mxf 
b/tests/ref/fate/concat-demuxer-extended-lavf-mxf
index 2fb5fce4b1..da4ab35b59 100644
--- a/tests/ref/fate/concat-demuxer-extended-lavf-mxf
+++ b/tests/ref/fate/concat-demuxer-extended-lavf-mxf
@@ -1 +1 @@
-a6fb9c37dc71cb43eb9664a8ae9f1c66 
*tests/data/fate/concat-demuxer-extended-lavf-mxf.ffprobe
+47f9fbf6cc419c0b3301f4b16b15cdcc 
*tests/data/fate/concat-demuxer-extended-lavf-mxf.ffprobe
diff --git a/tests/ref/fate/concat-demuxer-extended-lavf-mxf_d10 
b/tests/ref/fate/concat-demuxer-extended-lavf-mxf_d10
index 60d729b3da..463c8d3b0b 100644
--- a/tests/ref/fate/concat-demuxer-extended-lavf-mxf_d10
+++ b/tests/ref/fate/concat-demuxer-extended-lavf-mxf_d10
@@ -1 +1 @@
-cb7c8eac6f8917e39658e1fa4a250da8 
*tests/data/fate/concat-demuxer-extended-lavf-mxf_d10.ffprobe
+fe2e8c65ef7a8d4e11d09ddc26cb432a 
*tests/data/fate/concat-demuxer-extended-lavf-mxf_d10.ffprobe
diff --git a/tests/ref/fate/concat-demuxer-simple1-lavf-mxf 
b/tests/ref/fate/concat-demuxer-simple1-lavf-mxf
index d18e35b7ba..6aa7f287cb 100644
--- a/tests/ref/fate/concat-demuxer-simple1-lavf-mxf
+++ b/tests/ref/fate/concat-demuxer-simple1-lavf-mxf
@@ -120,5 +120,5 @@ 
audio|1|65280|1.36|65280|1.36|1920|0.04|N/A|N/A|3840|207872|K_|1
 Strings Metadata
 video|0|37|1.48|34|1.36|1|0.04|N/A|N/A|24786|212480|K_|1
 Strings Metadata
-0|mpeg2video|4|video|1/25|[0][0][0][0]|0x|352|288|0|0|1|1:1|11:9|yuv420p|8|tv|unknown|unknown|unknown|left|progressive|N/A|1|N/A|25/1|25/1|1/25|N/A|N/A|N/A|N/A|N/A|N/A|N/A|N/A|N/A|51|0|0|0|0|0|0|0|0|0|0|0|0|0x060A2B340101010501010D001301
+0|mpeg2video|4|video|1/25|[0][0][0][0]|0x|352|288|0|0|1|0|1:1|11:9|yuv420p|8|tv|unknown|unknown|unknown|left|progressive|N/A|1|N/A|25/1|25/1|1/25|N/A|N/A|N/A|N/A|N/A|N/A|N/A|N/A|N/A|51|0|0|0|0|0|0|0|0|0|0|0|0|0x060A2B340101010501010D001301
 
1|pcm_s16le|unknown|audio|1/48000|[0][0][0][0]|0x|s16|48000|1|unknown|16|N/A|0/0|0/0|1/48000|0|0.00|N/A|N/A|768000|N/A|N/A|N/A|N/A|50|0|0|0|0|0|0|0|0|0|0|0|0|0x060A2B340101010501010D001301
diff --git a/tests/ref/fate/concat-demuxer-simple1-lavf-mxf_d10 
b/tests/ref/fate/concat-demuxer-simple1-lavf-mxf_d10
index e83d1bf847..79ce1e2306 100644
--- a/tests/ref/fate/concat-demuxer-simple1-lavf-mxf_d10
+++ b/tests/ref/fate/concat-demuxer-simple1-lavf-mxf_d10
@@ -78,5 +78,5 @@ 
video|0|34|1.36|34|1.36|1|0.04|N/A|N/A|15|1924096|K_|1
 Strings Metadata
 audio|1|65280|1.36|65280|1.36|1920|0.04|N/A|N/A|7680|2074624|K_|1
 Strings Metadata
-0|mpeg2video|0|video|1/25|[0][0][0][0]|0x|720|608|0|0|0|1:1|45:38|yuv422p|5|tv|unknown|unknown|unknown|topleft|tt|N/A|1|N/A|25/1|25/1|1/25|0|0.00|N/A|N/A|3000|N/A|N/A|N/A|N/A|35|0|0|0|0|0|0|0|0|0|0|0|0|0x060A2B340101010501010D001301
+0|mpeg2video|0|video|1/25|[0][0][0][0]|0x|720|608|0|0|0|0|1:1|45:38|yuv422p|5|tv|unknown|unknown|unknown|topleft|tt|N/A|1|N/A|25/1|25/1|1/25|0|0.00|N/A|N/A|3000|N/A|N/A|N/A|N/A|35|0|0|0|0|0|0|0|0|0|0|0|0|0x060A2B340101010501010D001301
 
1|pcm_s16le|unknown|audio|1/48000|[0][0][0][0]|0x|s16|48000|2|unknown|16|N/A|0/0|0/0|1/48000|0|0.00|N/A|N/A|1536000|N/A|N/A|N/A|N/A|35|0|0|0|0|0|0|0|0|0|0|0|0|0x060A2B340101010501010D001301
diff --git a/tests/ref/fate/concat-demuxer-simple2-lavf-ts 
b/tests/ref/fate/concat-demuxer-simple2-lavf-ts
index 0f03d6e06b..e5de697049 100644
--- a/tests/ref/fate/concat-demuxer-simple2-lavf-ts
+++ b/tests/ref/fate/concat-demuxer-simple2-lavf-ts
@@ -212,4 +212,4 @@ 

Re: [FFmpeg-devel] [PATCH 1/2] tools ffprobe: add closed caption output to stream info

2020-04-24 Thread Nicolas George
vectronic (12020-04-24):
> ensure closed caption info which is visible in default stream dump is also 
> available in results when -show_streams is used
> 
> Signed-off-by: vectronic 
> ---
>  fftools/ffprobe.c | 2 ++
>  1 file changed, 2 insertions(+)

I think you need to update doc/ffprobe.xsd if you add a field. And the
updates to the ref files belong in the same commit.

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 v10 1/2] avcodec: add support for Cunning Developments' ADPCM

2020-04-24 Thread Michael Niedermayer
On Sat, Apr 18, 2020 at 12:20:39AM +, Zane van Iperen wrote:
> Signed-off-by: Zane van Iperen 
> ---
>  Changelog   |  1 +
>  doc/general.texi|  1 +
>  libavcodec/Makefile |  1 +
>  libavcodec/adpcm.c  | 33 +
>  libavcodec/adpcm_data.c | 13 +
>  libavcodec/adpcm_data.h |  2 ++
>  libavcodec/allcodecs.c  |  1 +
>  libavcodec/codec_desc.c |  7 +++
>  libavcodec/codec_id.h   |  1 +
>  libavcodec/version.h|  2 +-
>  10 files changed, 61 insertions(+), 1 deletion(-)

will apply

thx

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

Elect your leaders based on what they did after the last election, not
based on what they say before an election.



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 2/3] swscale/x86/output: add AVX2 version of yuv2nv12cX

2020-04-24 Thread James Almer
On 4/24/2020 1:31 PM, Nelson Gomez wrote:
> From: Nelson Gomez 
> 
> 256 bits is just wide enough to fit all the operands needed to vectorize
> the software implementation, but AVX2 is needed to for a couple of
> instructions like cross-lane permutation.
> 
> Output is bit-for-bit identical to C.
> 
> Signed-off-by: Nelson Gomez 
> ---
>  libswscale/x86/output.asm | 124 +-
>  libswscale/x86/swscale.c  |  24 
>  2 files changed, 147 insertions(+), 1 deletion(-)
> 
> diff --git a/libswscale/x86/output.asm b/libswscale/x86/output.asm
> index db3e9934f8..7478e12403 100644
> --- a/libswscale/x86/output.asm
> +++ b/libswscale/x86/output.asm
> @@ -2,6 +2,7 @@
>  ;* x86-optimized vertical line scaling functions
>  ;* Copyright (c) 2011 Ronald S. Bultje 
>  ;*Kieran Kunhya 
> +;*   (c) 2020 Nelson Gomez 
>  ;*
>  ;* This file is part of FFmpeg.
>  ;*
> @@ -22,7 +23,7 @@
>  
>  %include "libavutil/x86/x86util.asm"
>  
> -SECTION_RODATA
> +SECTION_RODATA 32
>  
>  minshort:  times 8 dw 0x8000
>  yuv2yuvX_16_start:  times 4 dd 0x4000 - 0x4000
> @@ -34,9 +35,20 @@ pd_4:  times 4 dd 4
>  pd_4min0x4:times 4 dd 4 - (0x4)
>  pw_16: times 8 dw 16
>  pw_32: times 8 dw 32
> +pd_255:times 8 dd 255
>  pw_512:times 8 dw 512
>  pw_1024:   times 8 dw 1024
>  
> +yuv2nv12_shuffle_mask: times 2 db 0,  4,  8, 12, \
> + -1, -1, -1, -1, \
> + -1, -1, -1, -1, \
> + -1, -1, -1, -1
> +yuv2nv21_shuffle_mask: times 2 db 4,  0, 12,  8, \
> + -1, -1, -1, -1, \
> + -1, -1, -1, -1, \
> + -1, -1, -1, -1
> +yuv2nv12_permute_mask: dd 0, 4, 1, 2, 3, 5, 6, 7
> +
>  SECTION .text
>  
>  
> ;-
> @@ -423,3 +435,113 @@ yuv2plane1_fn  9, 5, 3
>  yuv2plane1_fn 10, 5, 3
>  yuv2plane1_fn 16, 5, 3
>  %endif
> +
> +%undef movsx
> +
> +;-
> +; AVX2 yuv2nv12cX implementation
> +;
> +; void ff_yuv2nv12cX_avx2(enum AVPixelFormat format, const uint8_t *dither,
> +; const int16_t *filter, int filterSize,
> +; const int16_t **u, const int16_t **v,
> +; uint8_t *dst, int dstWidth)
> +;
> +; void ff_yuv2nv21cX_avx2(enum AVPixelFormat format, const uint8_t *dither,
> +; const int16_t *filter, int filterSize,
> +; const int16_t **u, const int16_t **v,
> +; uint8_t *dst, int dstWidth)
> +;-
> +
> +%macro yuv2nv12cX_fn 1
> +cglobal %1cX, 8, 11, 13, tmp1, dither, filter, filterSize, u, v, dst, 
> dstWidth
> +
> +mov tmp1q, qword [ditherq]
> +movq xm0, tmp1q
> +ror tmp1q, 24
> +movq xm1, tmp1q
> +
> +pmovzxbd m0, xm0
> +pslld m0, m0, 12; ditherLo
> +pmovzxbd m1, xm1
> +pslld m1, m1, 12; ditherHi
> +
> +pxor m9, m9 ; uint8_min dwords
> +mova m10, [pd_255]  ; uint8_max dwords
> +mova m11, [%1_shuffle_mask] ; shuffle_mask
> +mova m12, [yuv2nv12_permute_mask]   ; permute mask
> +
> +DEFINE_ARGS tmp1, tmp2, filter, filterSize, u, v, dst, dstWidth
> +
> +xor r8q, r8q
> +
> +nv12_outer_%1:
> +mova m2, m0 ; resultLo
> +mova m3, m1 ; resultHi
> +xor r9q, r9q
> +
> +nv12_inner_%1:
> +movsx r10d, word [filterq + (2 * r9q)]
> +movd xm4, r10d
> +vpbroadcastd m4, xm4; filter
> +
> +mov tmp1q, [uq + (gprsize * r9q)]
> +mova xm7, oword [tmp1q + 2 * r8q]
> +
> +mov tmp2q, [vq + (gprsize * r9q)]
> +mova xm8, oword [tmp2q + 2 * r8q]
> +
> +punpcklwd xm5, xm7, xm8
> +pmovsxwd m5, xm5; multiplicandsLo
> +punpckhwd xm6, xm7, xm8
> +pmovsxwd m6, xm6; multiplicandsHi
> +
> +pmulld m7, m5, m4   ; mulResultLo
> +pmulld m8, m6, m4   ; mulResultHi
> +paddd m2, m2, m7; resultLo += mulResultLo
> +paddd m3, m3, m8; resultHi += mulResultHi
> +
> +inc r9d
> +cmp r9d, filterSized
> +jl nv12_inner_%1
> +; end of inner loop
> +
> +psrad m2, m2, 19
> +psrad m3, m3, 19
> +
> +; Vectorized av_clip_uint8
> +pmaxsd m2, m2, m9
> +pmaxsd m3, m3, m9
> +pminsd m2, m2, m10
> +pminsd m3, m3, m10
> +
> +; At this point we have clamped uint8s arranged in this order:
> +; m2: u1  0  0  0  v1  0  0  0  [...]
> +; m3: u5  0  0  0  v5  0

[FFmpeg-devel] [PATCH V2 1/1] ensure closed caption info which is visible in default stream dump is also available in results when -show_streams is used

2020-04-24 Thread vectronic
Signed-off-by: vectronic 
---
 doc/ffprobe.xsd   | 1 +
 tests/ref/fate/concat-demuxer-extended-lavf-mxf   | 2 +-
 tests/ref/fate/concat-demuxer-extended-lavf-mxf_d10   | 2 +-
 tests/ref/fate/concat-demuxer-simple1-lavf-mxf| 2 +-
 tests/ref/fate/concat-demuxer-simple1-lavf-mxf_d10| 2 +-
 tests/ref/fate/concat-demuxer-simple2-lavf-ts | 2 +-
 tests/ref/fate/ffprobe_compact| 4 ++--
 tests/ref/fate/ffprobe_csv| 4 ++--
 tests/ref/fate/ffprobe_default| 2 ++
 tests/ref/fate/ffprobe_flat   | 2 ++
 tests/ref/fate/ffprobe_ini| 2 ++
 tests/ref/fate/ffprobe_json   | 2 ++
 tests/ref/fate/ffprobe_xml| 4 ++--
 tests/ref/fate/hapqa-extract-nosnappy-to-hapalphaonly-mov | 1 +
 tests/ref/fate/hapqa-extract-nosnappy-to-hapq-mov | 1 +
 tests/ref/fate/mov-zombie | 2 +-
 tests/ref/fate/mxf-probe-d10  | 1 +
 tests/ref/fate/mxf-probe-dnxhd| 1 +
 tests/ref/fate/mxf-probe-dv25 | 1 +
 19 files changed, 26 insertions(+), 12 deletions(-)

diff --git a/doc/ffprobe.xsd b/doc/ffprobe.xsd
index 97dc67def6..f88045232f 100644
--- a/doc/ffprobe.xsd
+++ b/doc/ffprobe.xsd
@@ -227,6 +227,7 @@
   
   
   
+  
   
   
   
diff --git a/tests/ref/fate/concat-demuxer-extended-lavf-mxf 
b/tests/ref/fate/concat-demuxer-extended-lavf-mxf
index 2fb5fce4b1..da4ab35b59 100644
--- a/tests/ref/fate/concat-demuxer-extended-lavf-mxf
+++ b/tests/ref/fate/concat-demuxer-extended-lavf-mxf
@@ -1 +1 @@
-a6fb9c37dc71cb43eb9664a8ae9f1c66 
*tests/data/fate/concat-demuxer-extended-lavf-mxf.ffprobe
+47f9fbf6cc419c0b3301f4b16b15cdcc 
*tests/data/fate/concat-demuxer-extended-lavf-mxf.ffprobe
diff --git a/tests/ref/fate/concat-demuxer-extended-lavf-mxf_d10 
b/tests/ref/fate/concat-demuxer-extended-lavf-mxf_d10
index 60d729b3da..463c8d3b0b 100644
--- a/tests/ref/fate/concat-demuxer-extended-lavf-mxf_d10
+++ b/tests/ref/fate/concat-demuxer-extended-lavf-mxf_d10
@@ -1 +1 @@
-cb7c8eac6f8917e39658e1fa4a250da8 
*tests/data/fate/concat-demuxer-extended-lavf-mxf_d10.ffprobe
+fe2e8c65ef7a8d4e11d09ddc26cb432a 
*tests/data/fate/concat-demuxer-extended-lavf-mxf_d10.ffprobe
diff --git a/tests/ref/fate/concat-demuxer-simple1-lavf-mxf 
b/tests/ref/fate/concat-demuxer-simple1-lavf-mxf
index d18e35b7ba..6aa7f287cb 100644
--- a/tests/ref/fate/concat-demuxer-simple1-lavf-mxf
+++ b/tests/ref/fate/concat-demuxer-simple1-lavf-mxf
@@ -120,5 +120,5 @@ 
audio|1|65280|1.36|65280|1.36|1920|0.04|N/A|N/A|3840|207872|K_|1
 Strings Metadata
 video|0|37|1.48|34|1.36|1|0.04|N/A|N/A|24786|212480|K_|1
 Strings Metadata
-0|mpeg2video|4|video|1/25|[0][0][0][0]|0x|352|288|0|0|1|1:1|11:9|yuv420p|8|tv|unknown|unknown|unknown|left|progressive|N/A|1|N/A|25/1|25/1|1/25|N/A|N/A|N/A|N/A|N/A|N/A|N/A|N/A|N/A|51|0|0|0|0|0|0|0|0|0|0|0|0|0x060A2B340101010501010D001301
+0|mpeg2video|4|video|1/25|[0][0][0][0]|0x|352|288|0|0|1|0|1:1|11:9|yuv420p|8|tv|unknown|unknown|unknown|left|progressive|N/A|1|N/A|25/1|25/1|1/25|N/A|N/A|N/A|N/A|N/A|N/A|N/A|N/A|N/A|51|0|0|0|0|0|0|0|0|0|0|0|0|0x060A2B340101010501010D001301
 
1|pcm_s16le|unknown|audio|1/48000|[0][0][0][0]|0x|s16|48000|1|unknown|16|N/A|0/0|0/0|1/48000|0|0.00|N/A|N/A|768000|N/A|N/A|N/A|N/A|50|0|0|0|0|0|0|0|0|0|0|0|0|0x060A2B340101010501010D001301
diff --git a/tests/ref/fate/concat-demuxer-simple1-lavf-mxf_d10 
b/tests/ref/fate/concat-demuxer-simple1-lavf-mxf_d10
index e83d1bf847..79ce1e2306 100644
--- a/tests/ref/fate/concat-demuxer-simple1-lavf-mxf_d10
+++ b/tests/ref/fate/concat-demuxer-simple1-lavf-mxf_d10
@@ -78,5 +78,5 @@ 
video|0|34|1.36|34|1.36|1|0.04|N/A|N/A|15|1924096|K_|1
 Strings Metadata
 audio|1|65280|1.36|65280|1.36|1920|0.04|N/A|N/A|7680|2074624|K_|1
 Strings Metadata
-0|mpeg2video|0|video|1/25|[0][0][0][0]|0x|720|608|0|0|0|1:1|45:38|yuv422p|5|tv|unknown|unknown|unknown|topleft|tt|N/A|1|N/A|25/1|25/1|1/25|0|0.00|N/A|N/A|3000|N/A|N/A|N/A|N/A|35|0|0|0|0|0|0|0|0|0|0|0|0|0x060A2B340101010501010D001301
+0|mpeg2video|0|video|1/25|[0][0][0][0]|0x|720|608|0|0|0|0|1:1|45:38|yuv422p|5|tv|unknown|unknown|unknown|topleft|tt|N/A|1|N/A|25/1|25/1|1/25|0|0.00|N/A|N/A|3000|N/A|N/A|N/A|N/A|35|0|0|0|0|0|0|0|0|0|0|0|0|0x060A2B340101010501010D001301
 
1|pcm_s16le|unknown|audio|1/48000|[0][0][0][0]|0x|s16|48000|2|unknown|16|N/A|0/0|0/0|1/48000|0|0.00|N/A|N/A|1536000|N/A|N/A|N/A|N/A|35|0|0|0|0|0|0|0|0|0|0|0|0|0x060A2B340101010501010D001301

[FFmpeg-devel] [PATCH V2 0/1] ffprobe add closed caption output to stream info

2020-04-24 Thread vectronic
ensure closed caption info which is visible in default stream dump is also
available in results when -show_streams is used and update test references
for closed_caption output in ffprobe stream results

vectronic (1):
  ensure closed caption info which is visible in default stream dump is
also available in results when -show_streams is used

 doc/ffprobe.xsd   | 1 +
 tests/ref/fate/concat-demuxer-extended-lavf-mxf   | 2 +-
 tests/ref/fate/concat-demuxer-extended-lavf-mxf_d10   | 2 +-
 tests/ref/fate/concat-demuxer-simple1-lavf-mxf| 2 +-
 tests/ref/fate/concat-demuxer-simple1-lavf-mxf_d10| 2 +-
 tests/ref/fate/concat-demuxer-simple2-lavf-ts | 2 +-
 tests/ref/fate/ffprobe_compact| 4 ++--
 tests/ref/fate/ffprobe_csv| 4 ++--
 tests/ref/fate/ffprobe_default| 2 ++
 tests/ref/fate/ffprobe_flat   | 2 ++
 tests/ref/fate/ffprobe_ini| 2 ++
 tests/ref/fate/ffprobe_json   | 2 ++
 tests/ref/fate/ffprobe_xml| 4 ++--
 tests/ref/fate/hapqa-extract-nosnappy-to-hapalphaonly-mov | 1 +
 tests/ref/fate/hapqa-extract-nosnappy-to-hapq-mov | 1 +
 tests/ref/fate/mov-zombie | 2 +-
 tests/ref/fate/mxf-probe-d10  | 1 +
 tests/ref/fate/mxf-probe-dnxhd| 1 +
 tests/ref/fate/mxf-probe-dv25 | 1 +
 19 files changed, 26 insertions(+), 12 deletions(-)

-- 
2.24.2 (Apple Git-127)

___
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 V3 0/1] ffprobe add closed caption output to stream info

2020-04-24 Thread vectronic
sorry, missed all the changes in the last version... trying again...

ensure closed caption info which is visible in default stream dump is also
available in results when -show_streams is used and update test references
for closed_caption output in ffprobe stream results

vectronic (1):
  ensure closed caption info which is visible in default stream dump is
also available in results when -show_streams is used

 doc/ffprobe.xsd   | 1 +
 fftools/ffprobe.c | 2 ++
 tests/ref/fate/concat-demuxer-extended-lavf-mxf   | 2 +-
 tests/ref/fate/concat-demuxer-extended-lavf-mxf_d10   | 2 +-
 tests/ref/fate/concat-demuxer-simple1-lavf-mxf| 2 +-
 tests/ref/fate/concat-demuxer-simple1-lavf-mxf_d10| 2 +-
 tests/ref/fate/concat-demuxer-simple2-lavf-ts | 2 +-
 tests/ref/fate/ffprobe_compact| 4 ++--
 tests/ref/fate/ffprobe_csv| 4 ++--
 tests/ref/fate/ffprobe_default| 2 ++
 tests/ref/fate/ffprobe_flat   | 2 ++
 tests/ref/fate/ffprobe_ini| 2 ++
 tests/ref/fate/ffprobe_json   | 2 ++
 tests/ref/fate/ffprobe_xml| 4 ++--
 tests/ref/fate/hapqa-extract-nosnappy-to-hapalphaonly-mov | 1 +
 tests/ref/fate/hapqa-extract-nosnappy-to-hapq-mov | 1 +
 tests/ref/fate/mov-zombie | 2 +-
 tests/ref/fate/mxf-probe-d10  | 1 +
 tests/ref/fate/mxf-probe-dnxhd| 1 +
 tests/ref/fate/mxf-probe-dv25 | 1 +
 20 files changed, 28 insertions(+), 12 deletions(-)

-- 
2.24.2 (Apple Git-127)

___
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 V3 1/1] ensure closed caption info which is visible in default stream dump is also available in results when -show_streams is used

2020-04-24 Thread vectronic
Signed-off-by: vectronic 
---
 doc/ffprobe.xsd   | 1 +
 fftools/ffprobe.c | 2 ++
 tests/ref/fate/concat-demuxer-extended-lavf-mxf   | 2 +-
 tests/ref/fate/concat-demuxer-extended-lavf-mxf_d10   | 2 +-
 tests/ref/fate/concat-demuxer-simple1-lavf-mxf| 2 +-
 tests/ref/fate/concat-demuxer-simple1-lavf-mxf_d10| 2 +-
 tests/ref/fate/concat-demuxer-simple2-lavf-ts | 2 +-
 tests/ref/fate/ffprobe_compact| 4 ++--
 tests/ref/fate/ffprobe_csv| 4 ++--
 tests/ref/fate/ffprobe_default| 2 ++
 tests/ref/fate/ffprobe_flat   | 2 ++
 tests/ref/fate/ffprobe_ini| 2 ++
 tests/ref/fate/ffprobe_json   | 2 ++
 tests/ref/fate/ffprobe_xml| 4 ++--
 tests/ref/fate/hapqa-extract-nosnappy-to-hapalphaonly-mov | 1 +
 tests/ref/fate/hapqa-extract-nosnappy-to-hapq-mov | 1 +
 tests/ref/fate/mov-zombie | 2 +-
 tests/ref/fate/mxf-probe-d10  | 1 +
 tests/ref/fate/mxf-probe-dnxhd| 1 +
 tests/ref/fate/mxf-probe-dv25 | 1 +
 20 files changed, 28 insertions(+), 12 deletions(-)

diff --git a/doc/ffprobe.xsd b/doc/ffprobe.xsd
index 97dc67def6..f88045232f 100644
--- a/doc/ffprobe.xsd
+++ b/doc/ffprobe.xsd
@@ -227,6 +227,7 @@
   
   
   
+  
   
   
   
diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c
index 840fcb71e2..f0916cbd70 100644
--- a/fftools/ffprobe.c
+++ b/fftools/ffprobe.c
@@ -2550,6 +2550,7 @@ static int show_stream(WriterContext *w, AVFormatContext 
*fmt_ctx, int stream_id
 }
 #endif
 print_int("has_b_frames", par->video_delay);
+print_int("closed_captions", !!(dec_ctx->properties & 
FF_CODEC_PROPERTY_CLOSED_CAPTIONS));
 sar = av_guess_sample_aspect_ratio(fmt_ctx, stream, NULL);
 if (sar.num) {
 print_q("sample_aspect_ratio", sar, ':');
@@ -2950,6 +2951,7 @@ static int open_input_file(InputFile *ifile, const char 
*filename,
 
 ist->dec_ctx->pkt_timebase = stream->time_base;
 ist->dec_ctx->framerate = stream->avg_frame_rate;
+ist->dec_ctx->properties = stream->codec->properties;
 #if FF_API_LAVF_AVCTX
 ist->dec_ctx->coded_width = stream->codec->coded_width;
 ist->dec_ctx->coded_height = stream->codec->coded_height;
diff --git a/tests/ref/fate/concat-demuxer-extended-lavf-mxf 
b/tests/ref/fate/concat-demuxer-extended-lavf-mxf
index 2fb5fce4b1..da4ab35b59 100644
--- a/tests/ref/fate/concat-demuxer-extended-lavf-mxf
+++ b/tests/ref/fate/concat-demuxer-extended-lavf-mxf
@@ -1 +1 @@
-a6fb9c37dc71cb43eb9664a8ae9f1c66 
*tests/data/fate/concat-demuxer-extended-lavf-mxf.ffprobe
+47f9fbf6cc419c0b3301f4b16b15cdcc 
*tests/data/fate/concat-demuxer-extended-lavf-mxf.ffprobe
diff --git a/tests/ref/fate/concat-demuxer-extended-lavf-mxf_d10 
b/tests/ref/fate/concat-demuxer-extended-lavf-mxf_d10
index 60d729b3da..463c8d3b0b 100644
--- a/tests/ref/fate/concat-demuxer-extended-lavf-mxf_d10
+++ b/tests/ref/fate/concat-demuxer-extended-lavf-mxf_d10
@@ -1 +1 @@
-cb7c8eac6f8917e39658e1fa4a250da8 
*tests/data/fate/concat-demuxer-extended-lavf-mxf_d10.ffprobe
+fe2e8c65ef7a8d4e11d09ddc26cb432a 
*tests/data/fate/concat-demuxer-extended-lavf-mxf_d10.ffprobe
diff --git a/tests/ref/fate/concat-demuxer-simple1-lavf-mxf 
b/tests/ref/fate/concat-demuxer-simple1-lavf-mxf
index d18e35b7ba..6aa7f287cb 100644
--- a/tests/ref/fate/concat-demuxer-simple1-lavf-mxf
+++ b/tests/ref/fate/concat-demuxer-simple1-lavf-mxf
@@ -120,5 +120,5 @@ 
audio|1|65280|1.36|65280|1.36|1920|0.04|N/A|N/A|3840|207872|K_|1
 Strings Metadata
 video|0|37|1.48|34|1.36|1|0.04|N/A|N/A|24786|212480|K_|1
 Strings Metadata
-0|mpeg2video|4|video|1/25|[0][0][0][0]|0x|352|288|0|0|1|1:1|11:9|yuv420p|8|tv|unknown|unknown|unknown|left|progressive|N/A|1|N/A|25/1|25/1|1/25|N/A|N/A|N/A|N/A|N/A|N/A|N/A|N/A|N/A|51|0|0|0|0|0|0|0|0|0|0|0|0|0x060A2B340101010501010D001301
+0|mpeg2video|4|video|1/25|[0][0][0][0]|0x|352|288|0|0|1|0|1:1|11:9|yuv420p|8|tv|unknown|unknown|unknown|left|progressive|N/A|1|N/A|25/1|25/1|1/25|N/A|N/A|N/A|N/A|N/A|N/A|N/A|N/A|N/A|51|0|0|0|0|0|0|0|0|0|0|0|0|0x060A2B340101010501010D001301
 
1|pcm_s16le|unknown|audio|1/48000|[0][0][0][0]|0x|s16|48000|1|unknown|16|N/A|0/0|0/0|1/48000|0|0.00|N/A|N/A|768000|N/A|N/A|N/A|N/A|50|0|0|0|0|0|0|0|0|0|0|0|0|0x060A2B340101010501010D001301
diff --git a/tests/ref/fate/concat-demuxer-simple1-lavf-mxf_d10 
b/tests/ref/fate/concat-demuxer-simple1-lavf-mxf_d10
index e83d1bf847..79ce1e2306 100644
--- a/tests/ref/fate/concat-demuxer-simple1-lavf-

[FFmpeg-devel] [PATCH] avcodec/dirac_vlc: Fix integer overflow in ff_dirac_golomb_read_32bit()

2020-04-24 Thread Michael Niedermayer
Fixes: left shift of 1073741824 by 1 places cannot be represented in type 
'int32_t' (aka 'int')
Fixes: 
21245/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_DIRAC_fuzzer-5683334274613248

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

diff --git a/libavcodec/dirac_vlc.c b/libavcodec/dirac_vlc.c
index fbe28017bc..6d53078fc0 100644
--- a/libavcodec/dirac_vlc.c
+++ b/libavcodec/dirac_vlc.c
@@ -1115,7 +1115,7 @@ int ff_dirac_golomb_read_32bit(const uint8_t *buf, int 
bytes,
 {
 LUTState lut = ff_dirac_golomb_lut[*buf++];
 int32_t *dst = (int32_t *)_dst, *last = dst + coeffs;
-int32_t val = 0;
+uint32_t val = 0;
 
 for (int i = 1; i < bytes; i++)
 PROCESS_VALS;
-- 
2.17.1

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

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

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

2020-04-24 Thread Lynne
Apr 24, 2020, 23:04 by mich...@niedermayer.cc:

> Fixes: left shift of 1073741824 by 1 places cannot be represented in type 
> 'int32_t' (aka 'int')
> Fixes: 
> 21245/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_DIRAC_fuzzer-5683334274613248
>
> Found-by: continuous fuzzing process 
> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer 
> ---
>  libavcodec/dirac_vlc.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/libavcodec/dirac_vlc.c b/libavcodec/dirac_vlc.c
> index fbe28017bc..6d53078fc0 100644
> --- a/libavcodec/dirac_vlc.c
> +++ b/libavcodec/dirac_vlc.c
> @@ -1115,7 +1115,7 @@ int ff_dirac_golomb_read_32bit(const uint8_t *buf, int 
> bytes,
>  {
>  LUTState lut = ff_dirac_golomb_lut[*buf++];
>  int32_t *dst = (int32_t *)_dst, *last = dst + coeffs;
> -int32_t val = 0;
> +uint32_t val = 0;
>  
>  for (int i = 1; i < bytes; i++)
>  PROCESS_VALS;
> -- 
> 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".
>

LGTM.
You should change the same variable in ff_dirac_golomb_read_16bit to a uint16_t 
too, to be safe.
___
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/2] avcodec: add support for Cunning Developments' ADPCM

2020-04-24 Thread Zane van Iperen
On Fri, 24 Apr 2020 19:41:35 +0200
"Michael Niedermayer"  wrote:

> On Sat, Apr 18, 2020 at 12:20:39AM +, Zane van Iperen wrote:
> > Signed-off-by: Zane van Iperen 
> > ---
> >  Changelog   |  1 +
> >  doc/general.texi|  1 +
> >  libavcodec/Makefile |  1 +
> >  libavcodec/adpcm.c  | 33 +
> >  libavcodec/adpcm_data.c | 13 +
> >  libavcodec/adpcm_data.h |  2 ++
> >  libavcodec/allcodecs.c  |  1 +
> >  libavcodec/codec_desc.c |  7 +++
> >  libavcodec/codec_id.h   |  1 +
> >  libavcodec/version.h|  2 +-
> >  10 files changed, 61 insertions(+), 1 deletion(-)  
> 
> will apply
> 
> thx

Thanks. Could you please apply part 2 as well? Part 1 is useless without
it.

Zane

___
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] probe mpegps pcm-alaw too long time

2020-04-24 Thread 周巍巍
/**
 * Remaining size available for raw_packet_buffer, in bytes.
 */
#define RAW_PACKET_BUFFER_SIZE 250
int raw_packet_buffer_remaining_size;


#define MAX_PROBE_PACKETS 2500
st->probe_packets = MAX_PROBE_PACKETS;

These two variables cannot be modified by parameters.


as following:

[mpeg @ 21680600] Format mpeg probed with size=2048 and score=52
[mpeg @ 21680600] Before avformat_find_stream_info() pos: 5 bytes
read:2804 seeks:0 nb_streams:0
[mpeg @ 21680600] probing stream 1 pp:2500
[mpeg @ 21680600] Probe with size=320, packets=1 detected mpegts
with score=2
[mpeg @ 21680600] probing stream 1 pp:2499
[mpeg @ 21680600] probing stream 1 pp:2498
[mpeg @ 21680600] probing stream 1 pp:2497
[mpeg @ 21680600] probing stream 1 pp:2496
[mpeg @ 21680600] probing stream 1 pp:2495
[mpeg @ 21680600] probing stream 1 pp:2494
[mpeg @ 21680600] probing stream 1 pp:2493
[mpeg @ 21680600] probing stream 1 pp:2492
[mpeg @ 21680600] probing stream 1 pp:2491
[mpeg @ 21680600] probing stream 1 pp:2490
[mpeg @ 21680600] probing stream 1 pp:2489
[mpeg @ 21680600] probing stream 1 pp:2488
[mpeg @ 21680600] probing stream 1 pp:2487
[mpeg @ 21680600] probing stream 1 pp:2486
[mpeg @ 21680600] probing stream 1 pp:2485
[mpeg @ 21680600] probing stream 1 pp:2484
[mpeg @ 21680600] probing stream 1 pp:2483
[mpeg @ 21680600] probing stream 1 pp:2482
[mpeg @ 21680600] probing stream 1 pp:2481
[mpeg @ 21680600] probing stream 1 pp:2480
[mpeg @ 21680600] probing stream 1 pp:2479
[mpeg @ 21680600] probing stream 1 pp:2478
[mpeg @ 21680600] probing stream 1 pp:2477
[mpeg @ 21680600] probing stream 1 pp:2476
[mpeg @ 21680600] probing stream 1 pp:2475
[mpeg @ 21680600] probing stream 1 pp:2474
[mpeg @ 21680600] probing stream 1 pp:2473
[mpeg @ 21680600] probing stream 1 pp:2472
[mpeg @ 21680600] probing stream 1 pp:2471
[mpeg @ 21680600] probing stream 1 pp:2470
[mpeg @ 21680600] probing stream 1 pp:2469
[mpeg @ 21680600] probing stream 1 pp:2468
[mpeg @ 21680600] probing stream 1 pp:2467
[mpeg @ 21680600] probing stream 1 pp:2466
[mpeg @ 21680600] probing stream 1 pp:2465
[mpeg @ 21680600] probing stream 1 pp:2464
[mpeg @ 21680600] probing stream 1 pp:2463
[mpeg @ 21680600] probing stream 1 pp:2462
[mpeg @ 21680600] probing stream 1 pp:2461
[mpeg @ 21680600] probing stream 1 pp:2460
[mpeg @ 21680600] probing stream 1 pp:2459
[mpeg @ 21680600] probing stream 1 pp:2458
[mpeg @ 21680600] probing stream 1 pp:2457
[mpeg @ 21680600] probing stream 1 pp:2456
[mpeg @ 21680600] probing stream 1 pp:2455
[mpeg @ 21680600] probing stream 1 pp:2454
[mpeg @ 21680600] probing stream 1 pp:2453
[mpeg @ 21680600] probing stream 1 pp:2452
[mpeg @ 21680600] probing stream 1 pp:2451
[mpeg @ 21680600] probing stream 1 pp:2450
[mpeg @ 21680600] probing stream 1 pp:2449
[mpeg @ 21680600] probing stream 1 pp:2448
[mpeg @ 21680600] probing stream 1 pp:2447
[mpeg @ 21680600] probing stream 1 pp:2446
[mpeg @ 21680600] probing stream 1 pp:2445
[mpeg @ 21680600] probing stream 1 pp:2444
[mpeg @ 21680600] probing stream 1 pp:2443
[mpeg @ 21680600] probing stream 1 pp:2442
[mpeg @ 21680600] probing stream 1 pp:2441
[mpeg @ 21680600] probing stream 1 pp:2440
[mpeg @ 21680600] probing stream 1 pp:2439
[mpeg @ 21680600] probing stream 1 pp:2438
[mpeg @ 21680600] probing stream 1 pp:2437
[mpeg @ 21680600] probing stream 1 pp:2436
[mpeg @ 21680600] probing stream 1 pp:2435
[mpeg @ 21680600] probing stream 1 pp:2434
[mpeg @ 21680600] probing stream 1 pp:2433
[mpeg @ 21680600] probing stream 1 pp:2432
[mpeg @ 21680600] probing stream 1 pp:2431
[mpeg @ 21680600] probing stream 1 pp:2430
[mpeg @ 21680600] probing stream 1 pp:2429
[mpeg @ 21680600] probing stream 1 pp:2428
[mpeg @ 21680600] probing stream 1 pp:2427
[mpeg @ 21680600] probing stream 1 pp:2426
[mpeg @ 21680600] probing stream 1 pp:2425
[mpeg @ 21680600] probing stream 1 pp:2424
[mpeg @ 21680600] probing stream 1 pp:2423
[mpeg @ 21680600] probing stream 1 pp:2422
[mpeg @ 21680600] probing stream 1 pp:2421
[mpeg @ 21680600] probing stream 1 pp:2420
[mpeg @ 21680600] probing stream 1 pp:2419
[mpeg @ 21680600] probing stream 1 pp:2418
[mpeg @ 21680600] probing stream 1 pp:2417
[mpeg @ 21680600] probing stream 1 pp:2416
[mpeg @ 21680600] probing stream 1 pp:2415
[mpeg @ 21680600] probing stream 1