Re: [FFmpeg-devel] [PATCH v4] avcodec/libvpxenc: add VP9 temporal scalability encoding option

2020-01-21 Thread James Zern
On Fri, Jan 17, 2020 at 1:50 PM Wonkap Jang
 wrote:
>
> This commit reuses the configuration options for VP8 that enables
> temporal scalability for VP9. It also adds a way to enable three
> preset temporal structures (refer to the documentation for more
> detail) that can be used in offline encoding.
> ---
>  doc/encoders.texi  |  18 ++-
>  libavcodec/libvpxenc.c | 250 +
>  2 files changed, 242 insertions(+), 26 deletions(-)
>

lgtm. this should include a patch version bump, I have that change
locally. I'll leave this open for others to have a look.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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

Re: [FFmpeg-devel] [PATCH] avformat/utils: log corrupt packets

2020-01-21 Thread Gyan



On 26-12-2019 09:03 pm, Gyan wrote:



On 26-12-2019 08:30 pm, Andreas Rheinhardt wrote:

On Thu, Dec 26, 2019 at 3:55 PM Gyan Doshi  wrote:


---
  libavformat/utils.c | 15 +--
  1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/libavformat/utils.c b/libavformat/utils.c
index b83a740500..7ac3920257 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -876,13 +876,16 @@ int ff_read_packet(AVFormatContext *s, 
AVPacket *pkt)

  if (err < 0)
  return err;

-    if ((s->flags & AVFMT_FLAG_DISCARD_CORRUPT) &&
-    (pkt->flags & AV_PKT_FLAG_CORRUPT)) {
+    if (pkt->flags & AV_PKT_FLAG_CORRUPT) {
  av_log(s, AV_LOG_WARNING,
-   "Dropped corrupted packet (stream = %d)\n",
-   pkt->stream_index);
-    av_packet_unref(pkt);
-    continue;
+   "Packet corrupt (stream = %d, dts = %s)",
+   pkt->stream_index, av_ts2str(pkt->pkt.dts));


pkt->pkt.dts? This shouldn't even compile.

Oops. Fixed and checked.


Will push tomorrow.

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

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

Re: [FFmpeg-devel] [PATCH 3/3] swscale/output: Fix several invalid shifts in yuv2rgb_full_1_c_template()

2020-01-21 Thread Andreas Rheinhardt
On Tue, Jan 21, 2020 at 11:24 PM Michael Niedermayer 
wrote:

> Fixes: Invalid shifts
> Fixes: #8320
>
> Signed-off-by: Michael Niedermayer 
> ---
>  libswscale/output.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/libswscale/output.c b/libswscale/output.c
> index d192ea854b..439de04a05 100644
> --- a/libswscale/output.c
> +++ b/libswscale/output.c
> @@ -2111,8 +2111,8 @@ yuv2rgb_full_1_c_template(SwsContext *c, const
> int16_t *buf0,
>  int A = 0; //init to silence warning
>  for (i = 0; i < dstW; i++) {
>  int Y = buf0[i] << 2;
>

buf0[i] is an int16_t. Is it certain (in the sense of: checked, not in the
sense of "negative luminance is nonsense") that it can't be negative?
LGTM apart from that.

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

Re: [FFmpeg-devel] [PATCH 2/3] swscale/swscale: Fix several invalid shifts related to vChrDrop

2020-01-21 Thread Andreas Rheinhardt
On Tue, Jan 21, 2020 at 11:24 PM Michael Niedermayer 
wrote:

> Fixes: Invalid shifts
> Fixes: #8166
>
> Signed-off-by: Michael Niedermayer 
> ---
>  libswscale/swscale.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/libswscale/swscale.c b/libswscale/swscale.c
> index 4ecfa88ff7..8436f056d4 100644
> --- a/libswscale/swscale.c
> +++ b/libswscale/swscale.c
> @@ -295,8 +295,8 @@ static int swscale(SwsContext *c, const uint8_t *src[],
>  srcStride[2] =
>  srcStride[3] = srcStride[0];
>  }
> -srcStride[1] <<= c->vChrDrop;
> -srcStride[2] <<= c->vChrDrop;
> +srcStride[1] *= 1 << c->vChrDrop;
> +srcStride[2] *= 1 << c->vChrDrop;
>
> Also fixes the filter-crop_scale_vflip FATE-test.
I presume the multiplication here can't overflow, so LGTM.

- 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 1/1] avdevice/gdigrab remove CAPTUREBLT flag

2020-01-21 Thread fgodtdev
From: FgoDt 

Remove CAPTUREBLT flag, CAPTUREBLT flag may make mouse flicker.
Discussion details 
see:https://patchwork.ffmpeg.org/project/ffmpeg/patch/hk2pr03mb4596ab273414d034c0f0d34ec6...@hk2pr03mb4596.apcprd03.prod.outlook.com/

Signed-off-by: fgodt 
---
 libavdevice/gdigrab.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavdevice/gdigrab.c b/libavdevice/gdigrab.c
index f406fa..f6075e4c6c 100644
--- a/libavdevice/gdigrab.c
+++ b/libavdevice/gdigrab.c
@@ -575,7 +575,7 @@ static int gdigrab_read_packet(AVFormatContext *s1, 
AVPacket *pkt)
 clip_rect.right - clip_rect.left,
 clip_rect.bottom - clip_rect.top,
 source_hdc,
-clip_rect.left, clip_rect.top, SRCCOPY | CAPTUREBLT)) {
+clip_rect.left, clip_rect.top, SRCCOPY )) {
 WIN32_API_ERROR("Failed to capture image");
 return AVERROR(EIO);
 }
-- 
2.23.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 v4 2/2] avformat: add demuxer for argonaut games' ASF format

2020-01-21 Thread Zane van Iperen
Adds support for the custom ASF container used by some Argonaut Games'
games, such as 'Croc! Legend of the Gobbos', and 'Croc 2'.

Can also handle the sample files in:
https://samples.ffmpeg.org/game-formats/brender/part2.zip

Signed-off-by: Zane van Iperen 
---
 Changelog|   1 +
 libavformat/Makefile |   1 +
 libavformat/allformats.c |   1 +
 libavformat/argo_asf.c   | 248 +++
 libavformat/version.h|   4 +-
 5 files changed, 253 insertions(+), 2 deletions(-)
 create mode 100644 libavformat/argo_asf.c

diff --git a/Changelog b/Changelog
index c029d73c72..65ef01c77d 100644
--- a/Changelog
+++ b/Changelog
@@ -31,6 +31,7 @@ version :
 - thistogram filter
 - freezeframes filter
 - Argonaut Games ADPCM decoder
+- Argonaut Games ASF demuxer
 
 
 version 4.2:
diff --git a/libavformat/Makefile b/libavformat/Makefile
index 52f29b1a6d..ba6ea8c4a6 100644
--- a/libavformat/Makefile
+++ b/libavformat/Makefile
@@ -99,6 +99,7 @@ OBJS-$(CONFIG_APTX_MUXER)+= rawenc.o
 OBJS-$(CONFIG_APTX_HD_DEMUXER)   += aptxdec.o rawdec.o
 OBJS-$(CONFIG_APTX_HD_MUXER) += rawenc.o
 OBJS-$(CONFIG_AQTITLE_DEMUXER)   += aqtitledec.o subtitles.o
+OBJS-$(CONFIG_ARGO_ASF_DEMUXER)  += argo_asf.o
 OBJS-$(CONFIG_ASF_DEMUXER)   += asfdec_f.o asf.o asfcrypt.o \
 avlanguage.o
 OBJS-$(CONFIG_ASF_O_DEMUXER) += asfdec_o.o asf.o asfcrypt.o \
diff --git a/libavformat/allformats.c b/libavformat/allformats.c
index ff9bdb906f..fe74a32e47 100644
--- a/libavformat/allformats.c
+++ b/libavformat/allformats.c
@@ -60,6 +60,7 @@ extern AVOutputFormat ff_aptx_muxer;
 extern AVInputFormat  ff_aptx_hd_demuxer;
 extern AVOutputFormat ff_aptx_hd_muxer;
 extern AVInputFormat  ff_aqtitle_demuxer;
+extern AVInputFormat  ff_argo_asf_demuxer;
 extern AVInputFormat  ff_asf_demuxer;
 extern AVOutputFormat ff_asf_muxer;
 extern AVInputFormat  ff_asf_o_demuxer;
diff --git a/libavformat/argo_asf.c b/libavformat/argo_asf.c
new file mode 100644
index 00..ac6726ee32
--- /dev/null
+++ b/libavformat/argo_asf.c
@@ -0,0 +1,248 @@
+/*
+ * Argonaut Games ASF demuxer
+ *
+ * Copyright (C) 2020 Zane van Iperen (z...@zanevaniperen.com)
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+#include "avformat.h"
+#include "internal.h"
+#include "libavutil/intreadwrite.h"
+#include "libavutil/avassert.h"
+
+#define ASF_TAG MKTAG('A', 'S', 'F', '\0')
+#define ASF_FILE_HEADER_SIZE24
+#define ASF_CHUNK_HEADER_SIZE   20
+
+typedef struct ArgoASFFileHeader {
+uint32_tmagic;  /*< Magic Number, {'A', 'S', 'F', '\0'} */
+uint16_tversion_major;  /*< File Major Version. */
+uint16_tversion_minor;  /*< File Minor Version. */
+uint32_tnum_chunks; /*< No. chunks in the file. */
+uint32_tchunk_offset;   /*< Offset to the first chunk from the start 
of the file. */
+int8_t  name[8];/*< Name. */
+} ArgoASFFileHeader;
+
+typedef struct ArgoASFChunkHeader {
+uint32_tnum_blocks; /*< No. blocks in the chunk. */
+uint32_tnum_samples;/*< No. samples per channel in a block. */
+uint32_tunk1;   /*< Unknown */
+uint16_tsample_rate;/*< Sample rate. */
+uint16_tunk2;   /*< Unknown. */
+uint32_tflags;  /*< Stream flags. */
+} ArgoASFChunkHeader;
+
+enum {
+ASF_CF_BITS_PER_SAMPLE  = (1 << 0), /*< 16-bit if set, 8 otherwise.  */
+ASF_CF_STEREO   = (1 << 1), /*< Stereo if set, mono otherwise.   */
+ASF_CF_ALWAYS1_1= (1 << 2), /*< Unknown, always seems to be set. */
+ASF_CF_ALWAYS1_2= (1 << 3), /*< Unknown, always seems to be set. */
+
+ASF_CF_ALWAYS1  = ASF_CF_ALWAYS1_1 | ASF_CF_ALWAYS1_2,
+ASF_CF_ALWAYS0  = ~(ASF_CF_BITS_PER_SAMPLE | ASF_CF_STEREO | 
ASF_CF_ALWAYS1)
+};
+
+typedef struct ArgoASFDemuxContext
+{
+ArgoASFFileHeader   fhdr;
+ArgoASFChunkHeader  ckhdr;
+uint32_tblocks_read;
+} ArgoASFDemuxContext;
+
+static void argo_asf_parse_file_header(ArgoASFFileHeader *hdr, const uint8_t 
*buf)
+{
+hdr->magic  = AV_RL32(buf + 0);
+hdr->version_major  = 

[FFmpeg-devel] [PATCH v4 0/2] Argonaut Games ASF and ADPCM decoding support

2020-01-21 Thread Zane van Iperen
Hi all,

This patchset adds support for the ASF container and ADPCM variant used by
some Argonaut Software games such as 'Croc! Legend of the Gobbos' and 'Croc 2'.

It has been tested against:
  - ANISOUND/*.ASFfrom Croc 1
  - music/*.asf   from Croc 2
  - FIGHT/SOUND/*.ASF from 
https://samples.ffmpeg.org/game-formats/brender/part2.zip

v4: [6]
  - simplify probe function
  - fix a compile warning

v3: [2][3][4][5]
  - ignore file extension in probe
  - reduce maximum possible probing score to 61
  - returned the stolen empty line
  - move the decoder into adpcm.c with the existing ones
  - formatting fixes

v2: [1]
  - change to use AV_RLxx() instead of relying on #pragma pack()
  - use MKTAG()
  - formatting fixes


[1]: https://ffmpeg.org/pipermail/ffmpeg-devel/2020-January/255986.html
[2]: https://ffmpeg.org/pipermail/ffmpeg-devel/2020-January/256005.html
[3]: https://ffmpeg.org/pipermail/ffmpeg-devel/2020-January/256014.html
[4]: https://ffmpeg.org/pipermail/ffmpeg-devel/2020-January/256021.html
[5]: https://ffmpeg.org/pipermail/ffmpeg-devel/2020-January/256024.html
[6]: https://ffmpeg.org/pipermail/ffmpeg-devel/2020-January/256129.html

Zane



Zane van Iperen (2):
  avcodec: add decoder for argonaut games' adpcm codec
  avformat: add demuxer for argonaut games' ASF format

 Changelog|   2 +
 doc/general.texi |   1 +
 libavcodec/Makefile  |   1 +
 libavcodec/adpcm.c   | 152 
 libavcodec/allcodecs.c   |   1 +
 libavcodec/avcodec.h |   1 +
 libavcodec/codec_desc.c  |   7 ++
 libavcodec/version.h |   2 +-
 libavformat/Makefile |   1 +
 libavformat/allformats.c |   1 +
 libavformat/argo_asf.c   | 248 +++
 libavformat/version.h|   4 +-
 12 files changed, 418 insertions(+), 3 deletions(-)
 create mode 100644 libavformat/argo_asf.c

-- 
2.17.1


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

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

[FFmpeg-devel] [PATCH v4 1/2] avcodec: add decoder for argonaut games' adpcm codec

2020-01-21 Thread Zane van Iperen
Adds support for the ADPCM variant used by some Argonaut Games' games,
such as 'Croc! Legend of the Gobbos', and 'Croc 2'.

Signed-off-by: Zane van Iperen 
---
 Changelog   |   1 +
 doc/general.texi|   1 +
 libavcodec/Makefile |   1 +
 libavcodec/adpcm.c  | 152 
 libavcodec/allcodecs.c  |   1 +
 libavcodec/avcodec.h|   1 +
 libavcodec/codec_desc.c |   7 ++
 libavcodec/version.h|   2 +-
 8 files changed, 165 insertions(+), 1 deletion(-)

diff --git a/Changelog b/Changelog
index 2ccd2645fc..c029d73c72 100644
--- a/Changelog
+++ b/Changelog
@@ -30,6 +30,7 @@ version :
 - MPEG-H 3D Audio support in mp4
 - thistogram filter
 - freezeframes filter
+- Argonaut Games ADPCM decoder
 
 
 version 4.2:
diff --git a/doc/general.texi b/doc/general.texi
index 4bd4b4f6b9..85db50462c 100644
--- a/doc/general.texi
+++ b/doc/general.texi
@@ -1079,6 +1079,7 @@ following image formats are supported:
 @item ACELP.KELVIN   @tab @tab  X
 @item ADPCM 4X Movie @tab @tab  X
 @item APDCM Yamaha AICA  @tab @tab  X
+@item ADPCM Argonaut Games   @tab @tab  X
 @item ADPCM CDROM XA @tab @tab  X
 @item ADPCM Creative Technology @tab @tab  X
 @tab 16 -> 4, 8 -> 4, 8 -> 3, 8 -> 2
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index c1f35b40d8..a2fbb910a0 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -817,6 +817,7 @@ OBJS-$(CONFIG_ADPCM_ADX_ENCODER)  += adxenc.o adx.o
 OBJS-$(CONFIG_ADPCM_AFC_DECODER)  += adpcm.o adpcm_data.o
 OBJS-$(CONFIG_ADPCM_AGM_DECODER)  += adpcm.o adpcm_data.o
 OBJS-$(CONFIG_ADPCM_AICA_DECODER) += adpcm.o adpcm_data.o
+OBJS-$(CONFIG_ADPCM_ARGO_DECODER) += adpcm.o adpcm_data.o
 OBJS-$(CONFIG_ADPCM_CT_DECODER)   += adpcm.o adpcm_data.o
 OBJS-$(CONFIG_ADPCM_DTK_DECODER)  += adpcm.o adpcm_data.o
 OBJS-$(CONFIG_ADPCM_EA_DECODER)   += adpcm.o adpcm_data.o
diff --git a/libavcodec/adpcm.c b/libavcodec/adpcm.c
index 7b5b3d9698..af9830d9ff 100644
--- a/libavcodec/adpcm.c
+++ b/libavcodec/adpcm.c
@@ -12,6 +12,7 @@
  * EA ADPCM XAS decoder by Peter Ross (pr...@xvid.org)
  * MAXIS EA ADPCM decoder by Robert Marston (rmars...@gmail.com)
  * THP ADPCM decoder by Marco Gerards (mgera...@xs4all.nl)
+ * Argonaut Games ADPCM decoder by Zane van Iperen (z...@zanevaniperen.com)
  *
  * This file is part of FFmpeg.
  *
@@ -148,6 +149,10 @@ static av_cold int adpcm_decode_init(AVCodecContext * 
avctx)
 if (avctx->extradata && avctx->extradata_size >= 2)
 c->vqa_version = AV_RL16(avctx->extradata);
 break;
+case AV_CODEC_ID_ADPCM_ARGO:
+if (avctx->bits_per_coded_sample != 4)
+return AVERROR_INVALIDDATA;
+break;
 default:
 break;
 }
@@ -546,6 +551,118 @@ static void adpcm_swf_decode(AVCodecContext *avctx, const 
uint8_t *buf, int buf_
 }
 }
 
+/*
+ * Argonaut Decoder 1: (prev0 + (s << (c + 2)))
+ */
+static int16_t *adpcm_argo_decoder_1(uint8_t c, int16_t *dst, const uint8_t 
*src,
+ const int16_t *prev_, int nsamples, int 
stride)
+{
+int16_t prev;
+int8_t s;
+
+av_assert0(stride == 0 || stride == 1);
+++stride;
+
+prev = prev_[stride];
+
+c += 2;
+for (int i = 0; i < nsamples / 2; i++, src++) {
+s = (int8_t)((*src & 0xF0u) << 0u);
+*dst = prev = ((prev * (1u << 6u)) + (s * (1u << c))) >> 6;
+dst += stride;
+
+s = (int8_t)((*src & 0x0Fu) << 4u);
+*dst = prev = ((prev * (1u << 6u)) + (s * (1u << c))) >> 6;
+dst += stride;
+}
+
+return dst;
+}
+
+/*
+ * Argonaut Decoder 2: (2 * prev0) - (1 * prev1) + (s << (c + 2))
+ */
+static int16_t *adpcm_argo_decoder_2(uint8_t c, int16_t *dst, const uint8_t 
*src,
+ const int16_t *prev_, int nsamples, int 
stride)
+{
+int16_t cprev[2];
+int8_t s;
+
+av_assert0(stride == 0 || stride == 1);
+++stride;
+
+/* [t-1, t-2] */
+cprev[0] = prev_[stride];
+cprev[1] = prev_[0];
+
+c += 2;
+for (int i = 0; i < nsamples / 2; i++, src++) {
+s = (int8_t)((*src & 0xF0u) << 0u);
+*dst = ((2 * cprev[0] * (1u << 6u)) - (cprev[1] * (1u << 6u)) + (s * 
(1u << c))) >> 6;
+cprev[1] = cprev[0];
+cprev[0] = *dst;
+dst += stride;
+
+s = (int8_t)((*src & 0x0Fu) << 4u);
+*dst = ((2 * cprev[0] * (1u << 6u)) - (cprev[1] * (1u << 6u)) + (s * 
(1u << c))) >> 6;
+cprev[1] = cprev[0];
+cprev[0] = *dst;
+dst += stride;
+}
+
+return dst;
+}
+
+/**
+ * Decode a block of Argonaut ADPCM samples.
+ *
+ * The format of each block:
+ *   uint8_t left_control;
+ *   uint4_t left_samples[];
+ *    and if stereo 
+ *   uint8_t right_control;
+ *   uint4_t right_samples[];
+ *
+ * Format of the control byte:
+ * MSB [DRRR] LSB
+ *   S = (Shift Amount - 2)
+ *   D = 

Re: [FFmpeg-devel] [PATCH v3 2/2] avformat: add demuxer for argonaut games' ASF format

2020-01-21 Thread Carl Eugen Hoyos
Am Mi., 22. Jan. 2020 um 01:41 Uhr schrieb Zane van Iperen
:
>
> 22/1/20 10:30 am, Carl Eugen Hoyos пишет:
> >
> > Am Mi., 22. Jan. 2020 um 01:13 Uhr schrieb Zane van Iperen
> > :
> >
> >> Ah, sorry I misunderstood. How's this?
> >>
> >>   >if (hdr.magic != ASF_TAG)
> >>   >return 0;
> >>   >
> >>   >if (!argo_asf_is_known_version())
> >>   >return 25;
> >>   >
> >>   >return (AVPROBE_SCORE_MAX / 2) + 1;
> >
> > I like this much better, use AVPROBE_SCORE_EXTENSION / 2 and
> > AVPROBE_SCORE_EXTENSION + 1 as it's done in other places.
> >
>
> Done. Is it worth sending a v4 for such a small change, or should
> I just send an additional patch?

Do not send patches to change patches that are not committed yet.

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

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

Re: [FFmpeg-devel] [PATCH v3 2/2] avformat: add demuxer for argonaut games' ASF format

2020-01-21 Thread Zane van Iperen
22/1/20 10:30 am, Carl Eugen Hoyos пишет:
> 
> Am Mi., 22. Jan. 2020 um 01:13 Uhr schrieb Zane van Iperen
> :
> 
>> Ah, sorry I misunderstood. How's this?
>>
>>   >if (hdr.magic != ASF_TAG)
>>   >return 0;
>>   >
>>   >if (!argo_asf_is_known_version())
>>   >return 25;
>>   >
>>   >return (AVPROBE_SCORE_MAX / 2) + 1;
> 
> I like this much better, use AVPROBE_SCORE_EXTENSION / 2 and
> AVPROBE_SCORE_EXTENSION + 1 as it's done in other places.
> 

Done. Is it worth sending a v4 for such a small change, or should
I just send an additional patch?

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

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 V1] libavcodec/aacdec: fix HE-AAC decoder dirty date (for sbr) when flush

2020-01-21 Thread Carl Eugen Hoyos
Am Mi., 1. Jan. 2020 um 06:34 Uhr schrieb Jun Zhao :
>
> From: qoroliang 
>
> aac decoder only do the window overlapping data buffer flush but
> without sbr related buffer flush, that will cause dirty data in
> the first output frame after flush.
>
> Signed-off-by: qoroliang 
> ---
>  libavcodec/aacdec_template.c |6 ++
>  1 files changed, 6 insertions(+), 0 deletions(-)
>
> diff --git a/libavcodec/aacdec_template.c b/libavcodec/aacdec_template.c
> index bb11de3..8f8dc24 100644
> --- a/libavcodec/aacdec_template.c
> +++ b/libavcodec/aacdec_template.c
> @@ -507,7 +507,13 @@ static void flush(AVCodecContext *avctx)
>  ChannelElement *che = ac->che[type][i];
>  if (che) {
>  for (j = 0; j <= 1; j++) {
> +// LTP buffer related data buffer
> +// or windowing overlapping
>  memset(che->ch[j].saved, 0, sizeof(che->ch[j].saved));
> +memset(che->ch[j].coeffs, 0, sizeof(che->ch[j].coeffs));
> +// sbr context should be reseted and function pointers 
> should be applied too
> +memset(>sbr, 0, sizeof(che->sbr));
> +AAC_RENAME(ff_aac_sbr_ctx_init)(ac, >sbr, type);

What happened with this patch?

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

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

Re: [FFmpeg-devel] [PATCH v3 2/2] avformat: add demuxer for argonaut games' ASF format

2020-01-21 Thread Carl Eugen Hoyos
Am Mi., 22. Jan. 2020 um 01:13 Uhr schrieb Zane van Iperen
:

> Ah, sorry I misunderstood. How's this?
>
>  >if (hdr.magic != ASF_TAG)
>  >return 0;
>  >
>  >if (!argo_asf_is_known_version())
>  >return 25;
>  >
>  >return (AVPROBE_SCORE_MAX / 2) + 1;

I like this much better, use AVPROBE_SCORE_EXTENSION / 2 and
AVPROBE_SCORE_EXTENSION + 1 as it's done in other places.

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

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

Re: [FFmpeg-devel] [PATCH v3 2/2] avformat: add demuxer for argonaut games' ASF format

2020-01-21 Thread Zane van Iperen
22/1/20 9:52 am, Carl Eugen Hoyos пишет:
> 
> Am Mi., 22. Jan. 2020 um 00:33 Uhr schrieb Zane van Iperen
> :
>>
>> 21/1/20 11:14 pm, Carl Eugen Hoyos пишет:
>>>
>>> Am Di., 21. Jan. 2020 um 11:09 Uhr schrieb Zane van Iperen
>>> :
>>>
 +static int argo_asf_probe(const AVProbeData *p)
 +{
 +int score;
 +ArgoASFFileHeader hdr;
 +
 +av_assert0(AVPROBE_PADDING_SIZE >= ASF_FILE_HEADER_SIZE);
 +
 +argo_asf_parse_file_header(, p->buf);
 +
 +if (hdr.magic != ASF_TAG)
 +return 0;
>>>
 +/* If this is huge, then it's very likely not an ASF file. */
 +if (hdr.chunk_offset > INT_MAX)
 +return 1;
>>>
>>> Am I correct that this tests only one bit?
>>> This makes sense for many probe functions that can easily
>>> return false positives based on weak heuristics, probe
>>> functions typically return high scores for matching first 32
>>> bits though.
>>
>> I can just get rid of that check completely if it's easier.
> 
> Please.
> 

Done.

 +score = 0;
 +if (argo_asf_is_known_version())
 +score += (AVPROBE_SCORE_MAX / 2) + 1;
>>>
>>> Unusual code style.
>>>
 +/* Have only ever seen these with 1 chunk. */
 +if (hdr.num_chunks == 1)
 +score += 10;
>>>
>>> Returns 0 for argo files with unknown version and more than
>>> one chunk and 10 for for unknown version and one chunk.
>>>
>>> Should be ~25 in both cases, feel free to return a higher
>>> score if all tests pass, I just wanted to simplify the probe
>>> function as testing 32 bit is what is usually done.
>>>
>>
>> Returning 0 on a unknown version is a bug, I want it to hit the
>> avpriv_request_sample() below.
>>
>> Would something like this (untested) be better?
>>
>>   > if (hdr.chunk_offset & 0xFF00U)
>>   > return 1;
>>   >
>>   > score = (AVPROBE_SCORE_MAX / 2) + 1;
>>   >
>>   > if (!argo_asf_is_known_version())
>>   > score -= 25;
>>   >
>>   > /* Have only ever seen these with 1 chunk. */
>>   > if (hdr.num_chunks > 1)
>>   > score -= 25;
>>   >
>>   > return score;
>>
>> That way if it fails one check it'll be 26, or 1 if it fails both.
> 
> But it should return ~25 if the first 32bit match (but the version
> is wrong) and fail later.
> 
> I mostly wanted to argue for a less complicated probe function
> for a format that starts with 32 known bits.
> 

Ah, sorry I misunderstood. How's this?

 >if (hdr.magic != ASF_TAG)
 >return 0;
 >
 >if (!argo_asf_is_known_version())
 >return 25;
 >
 >return (AVPROBE_SCORE_MAX / 2) + 1;

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

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] Vulkan hwcontext and filters

2020-01-21 Thread Mark Thompson
On 10/01/2020 21:05, Lynne wrote:
> From 1e3a50fbe4399f76c0ab0f62bf6d6c65b8565db4 Mon Sep 17 00:00:00 2001
> From: Lynne 
> Date: Sun, 27 Oct 2019 14:47:18 +
> Subject: [PATCH 7/9] lavfi: add an avgblur_vulkan filter
> 
> This commit adds a fast avgblur Vulkan filter.
> This will reset Intel GPUs on Windows due to a known, year-old driver bug.
> ---
>  configure   |   1 +
>  libavfilter/Makefile|   1 +
>  libavfilter/allfilters.c|   1 +
>  libavfilter/vf_avgblur_vulkan.c | 406 
>  4 files changed, 409 insertions(+)
>  create mode 100644 libavfilter/vf_avgblur_vulkan.c

There is something weirdly wrong with the edges of the local blocks here.

With a pure white input:

./ffmpeg_g -v 55 -y -init_hw_device vulkan:0,debug=1 -i white.png 
-filter_hw_device vulkan0 -vf 
format=yuv420p,hwupload,avgblur_vulkan,hwdownload,format=yuv420p -frames:v 1 
out.png



Looks like undefined values are leaking in to the average?

Thanks,

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

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

Re: [FFmpeg-devel] [PATCH v3 2/2] avformat: add demuxer for argonaut games' ASF format

2020-01-21 Thread Carl Eugen Hoyos
Am Mi., 22. Jan. 2020 um 00:33 Uhr schrieb Zane van Iperen
:
>
> 21/1/20 11:14 pm, Carl Eugen Hoyos пишет:
> >
> > Am Di., 21. Jan. 2020 um 11:09 Uhr schrieb Zane van Iperen
> > :
> >
> >> +static int argo_asf_probe(const AVProbeData *p)
> >> +{
> >> +int score;
> >> +ArgoASFFileHeader hdr;
> >> +
> >> +av_assert0(AVPROBE_PADDING_SIZE >= ASF_FILE_HEADER_SIZE);
> >> +
> >> +argo_asf_parse_file_header(, p->buf);
> >> +
> >> +if (hdr.magic != ASF_TAG)
> >> +return 0;
> >
> >> +/* If this is huge, then it's very likely not an ASF file. */
> >> +if (hdr.chunk_offset > INT_MAX)
> >> +return 1;
> >
> > Am I correct that this tests only one bit?
> > This makes sense for many probe functions that can easily
> > return false positives based on weak heuristics, probe
> > functions typically return high scores for matching first 32
> > bits though.
>
> I can just get rid of that check completely if it's easier.

Please.

> >> +score = 0;
> >> +if (argo_asf_is_known_version())
> >> +score += (AVPROBE_SCORE_MAX / 2) + 1;
> >
> > Unusual code style.
> >
> >> +/* Have only ever seen these with 1 chunk. */
> >> +if (hdr.num_chunks == 1)
> >> +score += 10;
> >
> > Returns 0 for argo files with unknown version and more than
> > one chunk and 10 for for unknown version and one chunk.
> >
> > Should be ~25 in both cases, feel free to return a higher
> > score if all tests pass, I just wanted to simplify the probe
> > function as testing 32 bit is what is usually done.
> >
>
> Returning 0 on a unknown version is a bug, I want it to hit the
> avpriv_request_sample() below.
>
> Would something like this (untested) be better?
>
>  > if (hdr.chunk_offset & 0xFF00U)
>  > return 1;
>  >
>  > score = (AVPROBE_SCORE_MAX / 2) + 1;
>  >
>  > if (!argo_asf_is_known_version())
>  > score -= 25;
>  >
>  > /* Have only ever seen these with 1 chunk. */
>  > if (hdr.num_chunks > 1)
>  > score -= 25;
>  >
>  > return score;
>
> That way if it fails one check it'll be 26, or 1 if it fails both.

But it should return ~25 if the first 32bit match (but the version
is wrong) and fail later.

I mostly wanted to argue for a less complicated probe function
for a format that starts with 32 known bits.

Carl Eugen
___
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] Vulkan hwcontext and filters

2020-01-21 Thread Mark Thompson
On 19/01/2020 13:11, Lynne wrote:
> Jan 18, 2020, 20:23 by s...@jkqxz.net:
> 
>> On 10/01/2020 21:05, Lynne wrote:
>>
>> The CUDA parts look like they could be split off into a separate commit?  
>> (It's already huge.)
>>
> 
> I don't really want broken commits or commits with dead code.

Shouldn't be - you've got nice #ifdef markers surrounding exactly the right 
pieces to splice out :)

>>> @@ -3639,7 +3641,7 @@ avformat_deps="avcodec avutil"
>>>  avformat_suggest="libm network zlib"
>>>  avresample_deps="avutil"
>>>  avresample_suggest="libm"
>>> -avutil_suggest="clock_gettime ffnvcodec libm libdrm libmfx opencl user32 
>>> vaapi videotoolbox corefoundation corevideo coremedia bcrypt"
>>> +avutil_suggest="clock_gettime ffnvcodec libm libdrm libmfx opencl user32 
>>> vaapi vulkan videotoolbox corefoundation corevideo coremedia bcrypt"
>>>  postproc_deps="avutil gpl"
>>>  postproc_suggest="libm"
>>>  swresample_deps="avutil"
>>> @@ -6626,6 +6628,9 @@ enabled vdpau &&
>>>  
>>>  enabled crystalhd && check_lib crystalhd "stdint.h 
>>> libcrystalhd/libcrystalhd_if.h" DtsCrystalHDVersion -lcrystalhd
>>>  
>>> +enabled vulkan &&
>>> +require_pkg_config vulkan "vulkan >= 1.1.97" "vulkan/vulkan.h" 
>>> vkCreateInstance
>>>
>>
>> Presumably you have some specific requirement in mind which wants this 
>> version - can you note it somewhere?  (Either here or in the commit message.)
>>
> 
> The DRM export/import and I think the semaphore import API.
> Its not a new version, its been out for a long time.

About a year, which probably isn't long enough to assume it's everywhere.  I 
guess it doesn't really matter, though, because it will only ever increase when 
something extra is added.

>>> ...
>>> +static int cuda_device_derive(AVHWDeviceContext *device_ctx,
>>> +  AVHWDeviceContext *src_ctx,
>>> +  int flags) {
>>> +AVCUDADeviceContext *hwctx = device_ctx->hwctx;
>>> +CudaFunctions *cu;
>>> +const char *src_uuid = NULL;
>>> +CUcontext dummy;
>>> +int ret, i, device_count, dev_active = 0;
>>> +unsigned int dev_flags = 0;
>>> +
>>> +const unsigned int desired_flags = CU_CTX_SCHED_BLOCKING_SYNC;
>>> +
>>> +switch (src_ctx->type) {
>>> +#if CONFIG_VULKAN
>>> +case AV_HWDEVICE_TYPE_VULKAN: {
>>> +AVVulkanDeviceContext *vkctx = src_ctx->hwctx;
>>> +src_uuid = vkctx->device_uuid;
>>> +break;
>>> +}
>>> +#endif
>>> +default:
>>> +return AVERROR(ENOSYS);
>>> +}
>>> +
>>> +if (!src_uuid) {
>>> +av_log(device_ctx, AV_LOG_ERROR,
>>> +   "Failed to get UUID of source device.\n");
>>> +goto error;
>>> +}
>>> +
>>> +if (cuda_device_init(device_ctx) < 0)
>>> +goto error;
>>> +
>>> +cu = hwctx->internal->cuda_dl;
>>> +
>>> +ret = CHECK_CU(cu->cuInit(0));
>>> +if (ret < 0)
>>> +goto error;
>>> +
>>> +ret = CHECK_CU(cu->cuDeviceGetCount(_count));
>>> +if (ret < 0)
>>> +goto error;
>>> +
>>> +hwctx->internal->cuda_device = -1;
>>> +for (i = 0; i < device_count; i++) {
>>> +CUdevice dev;
>>> +CUuuid uuid;
>>> +
>>> +ret = CHECK_CU(cu->cuDeviceGet(, i));
>>> +if (ret < 0)
>>> +goto error;
>>> +
>>> +ret = CHECK_CU(cu->cuDeviceGetUuid(, dev));
>>> +if (ret < 0)
>>> +goto error;
>>> +
>>> +if (memcmp(src_uuid, uuid.bytes, sizeof (uuid.bytes)) == 0) {
>>> +hwctx->internal->cuda_device = dev;
>>> +break;
>>> +}
>>> +}
>>> +
>>> +if (hwctx->internal->cuda_device == -1) {
>>> +av_log(device_ctx, AV_LOG_ERROR, "Could not derive CUDA 
>>> device.\n");
>>>
>>
>> This error is maybe more like "Can't find the matching CUDA device to the 
>> supplied Vulkan device".
>>
> 
> Let's keep it that way, its not meant to be vulkan specific, though its only 
> used by vulkan currently.

Good point!  Fair enough.

>>> +goto error;
>>> +}
>>> +
>>> +hwctx->internal->flags = flags;
>>> +
>>> +if (flags & AV_CUDA_USE_PRIMARY_CONTEXT) {
>>> +ret = 
>>> CHECK_CU(cu->cuDevicePrimaryCtxGetState(hwctx->internal->cuda_device, 
>>> _flags, _active));
>>> +if (ret < 0)
>>> +goto error;
>>> +
>>> +if (dev_active && dev_flags != desired_flags) {
>>> +av_log(device_ctx, AV_LOG_ERROR, "Primary context already 
>>> active with incompatible flags.\n");
>>> +goto error;
>>> +} else if (dev_flags != desired_flags) {
>>> +ret = 
>>> CHECK_CU(cu->cuDevicePrimaryCtxSetFlags(hwctx->internal->cuda_device, 
>>> desired_flags));
>>> +if (ret < 0)
>>> +goto error;
>>> +}
>>> +
>>> +ret = CHECK_CU(cu->cuDevicePrimaryCtxRetain(>cuda_ctx, 
>>> hwctx->internal->cuda_device));
>>> +if (ret < 0)
>>> +goto error;
>>> +} else {
>>> +ret = 

Re: [FFmpeg-devel] [PATCH v3 2/2] avformat: add demuxer for argonaut games' ASF format

2020-01-21 Thread Zane van Iperen
21/1/20 11:14 pm, Carl Eugen Hoyos пишет:
> 
> Am Di., 21. Jan. 2020 um 11:09 Uhr schrieb Zane van Iperen
> :
> 
>> +static int argo_asf_probe(const AVProbeData *p)
>> +{
>> +int score;
>> +ArgoASFFileHeader hdr;
>> +
>> +av_assert0(AVPROBE_PADDING_SIZE >= ASF_FILE_HEADER_SIZE);
>> +
>> +argo_asf_parse_file_header(, p->buf);
>> +
>> +if (hdr.magic != ASF_TAG)
>> +return 0;
> 
>> +/* If this is huge, then it's very likely not an ASF file. */
>> +if (hdr.chunk_offset > INT_MAX)
>> +return 1;
> 
> Am I correct that this tests only one bit?
> This makes sense for many probe functions that can easily
> return false positives based on weak heuristics, probe
> functions typically return high scores for matching first 32
> bits though.
> 

I can just get rid of that check completely if it's easier.

>> +score = 0;
>> +if (argo_asf_is_known_version())
>> +score += (AVPROBE_SCORE_MAX / 2) + 1;
> 
> Unusual code style.
> 
>> +/* Have only ever seen these with 1 chunk. */
>> +if (hdr.num_chunks == 1)
>> +score += 10;
> 
> Returns 0 for argo files with unknown version and more than
> one chunk and 10 for for unknown version and one chunk.
> 
> Should be ~25 in both cases, feel free to return a higher
> score if all tests pass, I just wanted to simplify the probe
> function as testing 32 bit is what is usually done.
> 

Returning 0 on a unknown version is a bug, I want it to hit the
avpriv_request_sample() below.

Would something like this (untested) be better?

 > if (hdr.chunk_offset & 0xFF00U)
 > return 1;
 >
 > score = (AVPROBE_SCORE_MAX / 2) + 1;
 >
 > if (!argo_asf_is_known_version())
 > score -= 25;
 >
 > /* Have only ever seen these with 1 chunk. */
 > if (hdr.num_chunks > 1)
 > score -= 25;
 >
 > return score;

That way if it fails one check it'll be 26, or 1 if it fails both.

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

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] Vulkan hwcontext and filters

2020-01-21 Thread Mark Thompson
On 19/01/2020 16:41, Philip Langdale wrote:
> On Sat, 18 Jan 2020 20:27:12 +
> Mark Thompson  wrote:
> 
>> On 10/01/2020 21:05, Lynne wrote:
>>> This is modelled as a transfer, as we have today, but where both
>>> the src and the dst are hardware frames with hw contexts. We need
>>> to be careful to ensure the contexts are compatible - particularly,
>>> we cannot do transfers where one of the frames has been mapped via
>>> a derived frames context - we can only do transfers for frames that
>>> were directly allocated by the specified context.  
>>
>> Why?  A derived frames context should be mostly treatable as a normal
>> frames context in the mapped-to device, so I'm not seeing where this
>> restriction is coming from.
>>
>> (Is there some particular case which doesn't work that this helps to
>> avoid?)
> 
> My experience was that when dealing with a mapped frame, it would chain
> back to the original context to handle transfers, which let to broken
> functionality in my testing. But also keep in mind that, in practice,
> we don't have scenarios today where this is even interesting. In the
> case of Intel/AMD and vaapi+vulkan, we can use mapping all the way
> through, while on nvidia and cuda+vulkan, we use copies all the way
> through.

I'm curious what the specific case where it goes wrong actually is

> If we actually come across a scenario where mixed mapping and copying
> is useful, we can try and reason about it and see what needs to change.

Yeah, fair enough.

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

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

[FFmpeg-devel] [PATCH] avformat/hlsenc: fix hls_ts_options with mpegts

2020-01-21 Thread Marton Balint
Was broken since cdbf8847ea97a985dfd55432e1384bb7fe5d2d3b.

Signed-off-by: Marton Balint 
---
 libavformat/hlsenc.c | 36 +---
 1 file changed, 17 insertions(+), 19 deletions(-)

diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index 2b3d3742d9..87b861d437 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -764,6 +764,7 @@ static int hls_mux_init(AVFormatContext *s, VariantStream 
*vs)
 AVFormatContext *oc;
 AVFormatContext *vtt_oc = NULL;
 int byterange_mode = (hls->flags & HLS_SINGLE_FILE) || (hls->max_seg_size 
> 0);
+int remaining_options;
 int i, ret;
 
 ret = avformat_alloc_output_context2(>avf, vs->oformat, NULL, NULL);
@@ -852,21 +853,25 @@ static int hls_mux_init(AVFormatContext *s, VariantStream 
*vs)
 return ret;
 }
 
+av_dict_copy(, hls->format_options, 0);
 if (hls->segment_type == SEGMENT_TYPE_FMP4) {
-int remaining_options;
-
-av_dict_copy(, hls->format_options, 0);
 av_dict_set(, "fflags", "-autobsf", 0);
 av_dict_set(, "movflags", "+frag_custom+dash+delay_moov", 
AV_DICT_APPEND);
-ret = avformat_init_output(oc, );
-remaining_options = av_dict_count(options);
-av_dict_free();
-if (ret < 0)
-return ret;
-if (remaining_options) {
-av_log(s, AV_LOG_ERROR, "Some of the provided format options are 
not recognized\n");
-return AVERROR(EINVAL);
-}
+} else {
+/* We only require one PAT/PMT per segment. */
+char period[21];
+snprintf(period, sizeof(period), "%d", (INT_MAX / 2) - 1);
+av_dict_set(, "sdt_period", period, 0);
+av_dict_set(, "pat_period", period, 0);
+}
+ret = avformat_init_output(oc, );
+remaining_options = av_dict_count(options);
+av_dict_free();
+if (ret < 0)
+return ret;
+if (remaining_options) {
+av_log(s, AV_LOG_ERROR, "Some of the provided format options are not 
recognized\n");
+return AVERROR(EINVAL);
 }
 avio_flush(oc->pb);
 return 0;
@@ -1683,15 +1688,8 @@ static int hls_start(AVFormatContext *s, VariantStream 
*vs)
 }
 }
 if (c->segment_type != SEGMENT_TYPE_FMP4) {
-/* We only require one PAT/PMT per segment. */
 if (oc->oformat->priv_class && oc->priv_data) {
-char period[21];
-
-snprintf(period, sizeof(period), "%d", (INT_MAX / 2) - 1);
-
 av_opt_set(oc->priv_data, "mpegts_flags", "resend_headers", 0);
-av_opt_set(oc->priv_data, "sdt_period", period, 0);
-av_opt_set(oc->priv_data, "pat_period", period, 0);
 }
 if (c->flags & HLS_SINGLE_FILE) {
 set_http_options(s, , c);
-- 
2.16.4

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

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

Re: [FFmpeg-devel] [PATCH] Vulkan hwcontext and filters

2020-01-21 Thread Mark Thompson
On 10/01/2020 21:05, Lynne wrote:
> From 04c1836f89d89dcdc892cef66ee82afbcfda9f2d Mon Sep 17 00:00:00 2001
> From: Lynne 
> Date: Sun, 27 Oct 2019 14:44:00 +
> Subject: [PATCH 4/9] lavfi: add Vulkan filtering framework
> 
> This commit adds a Vulkan filtering infrastructure for libavfilter.
> It attempts to abstract as much as possible of the Vulkan API from filters.
> 
> The way the hwcontext and the framework are designed permits for parallel,
> non-CPU-blocking filtering throughout, with the exception of up/downloading
> and mapping.
> ---
>  configure   |3 +
>  libavfilter/Makefile|2 +
>  libavfilter/glslang.cpp |  215 +++
>  libavfilter/glslang.h   |   49 ++
>  libavfilter/vulkan.c| 1221 +++
>  libavfilter/vulkan.h|  323 +++
>  6 files changed, 1813 insertions(+)
>  create mode 100644 libavfilter/glslang.cpp
>  create mode 100644 libavfilter/glslang.h
>  create mode 100644 libavfilter/vulkan.c
>  create mode 100644 libavfilter/vulkan.h
> 
> diff --git a/configure b/configure
> index 3113ebfdd8..fc075f2a15 100755
> --- a/configure
> +++ b/configure
> ...
> @@ -6258,6 +6260,7 @@ enabled fontconfig&& enable libfontconfig
>  enabled libfontconfig && require_pkg_config libfontconfig fontconfig 
> "fontconfig/fontconfig.h" FcInit
>  enabled libfreetype   && require_pkg_config libfreetype freetype2 
> "ft2build.h FT_FREETYPE_H" FT_Init_FreeType
>  enabled libfribidi&& require_pkg_config libfribidi fribidi fribidi.h 
> fribidi_version_info
> +enabled libglslang&& require_cpp libglslang 
> glslang/SPIRV/GlslangToSpv.h "glslang::TIntermediate*" -lglslang 
> -lOSDependent -lHLSL -lOGLCompiler -lSPVRemapper -lSPIRV -lSPIRV-Tools 
> -lSPIRV-Tools-opt -lpthread -lstdc++

Using Debian-packaged glslang, the headers seem to be in slightly different 
places: SPIRV headers in their own directory under include, so it is just 
SPIRV/GlslangToSpv.h.  With the paths edited, the version in testing works.

I don't whether there is a single official way which we should support, but 
this looks like it could be an evil source of confusion.

>  enabled libgme&& { check_pkg_config libgme libgme gme/gme.h 
> gme_new_emu ||
> require libgme gme/gme.h gme_new_emu -lgme 
> -lstdc++; }
>  enabled libgsm&& { for gsm_hdr in "gsm.h" "gsm/gsm.h"; do
> ...
> diff --git a/libavfilter/glslang.cpp b/libavfilter/glslang.cpp
> new file mode 100644
> index 00..cf534d8ac5
> --- /dev/null
> +++ b/libavfilter/glslang.cpp
> @@ -0,0 +1,215 @@
> +/*
> + * This file is part of FFmpeg.
> + *
> + * FFmpeg is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU Lesser General Public
> + * License as published by the Free Software Foundation; either
> + * version 2.1 of the License, or (at your option) any later version.
> + *
> + * FFmpeg is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> + * Lesser General Public License for more details.
> + *
> + * You should have received a copy of the GNU Lesser General Public
> + * License along with FFmpeg; if not, write to the Free Software
> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 
> USA
> + */
> +
> +#include 
> +#include 
> +
> +extern "C" {
> +#include "libavutil/mem.h"
> +}
> +
> +#include 
> +#include 
> +#include 
> +#include 

(This path too.)

> +
> +#include "glslang.h"
> +
> +using namespace glslang;
> +
> +static pthread_mutex_t glslang_mutex = PTHREAD_MUTEX_INITIALIZER;
> +static int glslang_refcount;
> +
> +int glslang_init(void)
> +{
> +int ret = 1;
> +
> +pthread_mutex_lock(_mutex);
> +if (glslang_refcount++ == 0)
> +ret = InitializeProcess();
> +pthread_mutex_unlock(_mutex);
> +
> +return ret;

Inverting the normal sense of success is weird.

> +}
> +
> +void glslang_uninit(void)
> +{
> +pthread_mutex_lock(_mutex);
> +if (--glslang_refcount == 0)
> +FinalizeProcess();
> +if (glslang_refcount < 0)

Assert?  This looks like a "something has gone horribly wrong" case.

> +glslang_refcount = 0;
> +pthread_mutex_unlock(_mutex);
> +}
> +
> +#define GLSL_VERSION EShTargetVulkan_1_0
> +#define SPIRV_VERSION EShTargetSpv_1_0
> +
> +extern const TBuiltInResource DefaultTBuiltInResource;
> +
> +GLSlangResult *glslang_compile(const char *glsl, enum GLSlangStage stage)
> +{
> +GLSlangResult *res = (GLSlangResult *)av_mallocz(sizeof(*res));
> +
> +static const EShLanguage lang[] = {
> +[GLSLANG_VERTEX]   = EShLangVertex,
> +[GLSLANG_FRAGMENT] = EShLangFragment,
> +[GLSLANG_COMPUTE]  = EShLangCompute,
> +};
> +
> +assert(glslang_refcount);
> +TShader *shader = new TShader(lang[stage]);

Missing check?

> +

Re: [FFmpeg-devel] [PATCH] Vulkan hwcontext and filters

2020-01-21 Thread Mark Thompson
On 19/01/2020 16:51, Philip Langdale wrote:
> On Sat, 18 Jan 2020 20:23:00 +
> Mark Thompson  wrote:
> 
>>>  typedef struct AVHWDeviceInternal AVHWDeviceInternal;
>>> diff --git a/libavutil/hwcontext_cuda.c b/libavutil/hwcontext_cuda.c
>>> index 30611b1912..18abb87bbd 100644
>>> --- a/libavutil/hwcontext_cuda.c
>>> +++ b/libavutil/hwcontext_cuda.c
>>> @@ -21,6 +21,9 @@
>>>  #include "hwcontext.h"
>>>  #include "hwcontext_internal.h"
>>>  #include "hwcontext_cuda_internal.h"
>>> +#if CONFIG_VULKAN
>>> +#include "hwcontext_vulkan.h"
>>> +#endif
>>>  #include "cuda_check.h"
>>>  #include "mem.h"
>>>  #include "pixdesc.h"
>>> @@ -42,6 +45,9 @@ static const enum AVPixelFormat
>>> supported_formats[] = { AV_PIX_FMT_YUV444P16,
>>>  AV_PIX_FMT_0RGB32,
>>>  AV_PIX_FMT_0BGR32,
>>> +#if CONFIG_VULKAN
>>> +AV_PIX_FMT_VULKAN,
>>> +#endif  
>>
>> Do all devices we can do CUDA on also support Vulkan?  If not, this
>> should probably filter it out in get_constraints() to avoid exposing
>> something which can't possibly work.
> 
> I don't have any hardware to test with, but I guess that in theory, we
> do - sufficiently old hardware, with legacy driver branches will
> support cuda and not vulkan, but it's unclear what we could do beyond
> what we already have to handle that. If there's no vulkan support, then
> we will not a vulkan device with a matching UUID and things will error
> out at that stage. At the moment, the only mechanism I can think of to
> detect lack of support is to do the UUID check, but somehow try and do
> it early enough to affect the supported formats, which seems dubious to
> me. So, it'll error out later than you really want, and possibly with a
> slightly unclear message but it'll not do anything wrong.

Fair enough - I agree there isn't much value to adding a lot more code to check 
it earlier.

Thanks,

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

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

[FFmpeg-devel] [PATCH 2/3] swscale/swscale: Fix several invalid shifts related to vChrDrop

2020-01-21 Thread Michael Niedermayer
Fixes: Invalid shifts
Fixes: #8166

Signed-off-by: Michael Niedermayer 
---
 libswscale/swscale.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libswscale/swscale.c b/libswscale/swscale.c
index 4ecfa88ff7..8436f056d4 100644
--- a/libswscale/swscale.c
+++ b/libswscale/swscale.c
@@ -295,8 +295,8 @@ static int swscale(SwsContext *c, const uint8_t *src[],
 srcStride[2] =
 srcStride[3] = srcStride[0];
 }
-srcStride[1] <<= c->vChrDrop;
-srcStride[2] <<= c->vChrDrop;
+srcStride[1] *= 1 << c->vChrDrop;
+srcStride[2] *= 1 << c->vChrDrop;
 
 DEBUG_BUFFERS("swscale() %p[%d] %p[%d] %p[%d] %p[%d] -> %p[%d] %p[%d] 
%p[%d] %p[%d]\n",
   src[0], srcStride[0], src[1], srcStride[1],
-- 
2.25.0

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

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

[FFmpeg-devel] [PATCH 3/3] swscale/output: Fix several invalid shifts in yuv2rgb_full_1_c_template()

2020-01-21 Thread Michael Niedermayer
Fixes: Invalid shifts
Fixes: #8320

Signed-off-by: Michael Niedermayer 
---
 libswscale/output.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libswscale/output.c b/libswscale/output.c
index d192ea854b..439de04a05 100644
--- a/libswscale/output.c
+++ b/libswscale/output.c
@@ -2111,8 +2111,8 @@ yuv2rgb_full_1_c_template(SwsContext *c, const int16_t 
*buf0,
 int A = 0; //init to silence warning
 for (i = 0; i < dstW; i++) {
 int Y = buf0[i] << 2;
-int U = (ubuf0[i] + ubuf1[i] - (128<<8)) << 1;
-int V = (vbuf0[i] + vbuf1[i] - (128<<8)) << 1;
+int U = (ubuf0[i] + ubuf1[i] - (128<<8)) * 2;
+int V = (vbuf0[i] + vbuf1[i] - (128<<8)) * 2;
 
 if (hasAlpha) {
 A = (abuf0[i] + 64) >> 7;
-- 
2.25.0

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

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

[FFmpeg-devel] [PATCH 1/3] swscale/input: Fix several invalid shifts related to rgb2yuv constants

2020-01-21 Thread Michael Niedermayer
Fixes: Invalid shifts
Fixes: #8140
Fixes: #8146

Signed-off-by: Michael Niedermayer 
---
 libswscale/input.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/libswscale/input.c b/libswscale/input.c
index 064f8da314..159f70307d 100644
--- a/libswscale/input.c
+++ b/libswscale/input.c
@@ -286,8 +286,8 @@ static av_always_inline void 
rgb16_32ToUV_c_template(int16_t *dstU,
  int gsh, int bsh, int S,
  int32_t *rgb2yuv)
 {
-const int ru   = rgb2yuv[RU_IDX] << rsh, gu = rgb2yuv[GU_IDX] << gsh, 
bu = rgb2yuv[BU_IDX] << bsh,
-  rv   = rgb2yuv[RV_IDX] << rsh, gv = rgb2yuv[GV_IDX] << gsh, 
bv = rgb2yuv[BV_IDX] << bsh;
+const int ru   = rgb2yuv[RU_IDX] * (1 << rsh), gu = rgb2yuv[GU_IDX] * 
(1 << gsh), bu = rgb2yuv[BU_IDX] * (1 << bsh),
+  rv   = rgb2yuv[RV_IDX] * (1 << rsh), gv = rgb2yuv[GV_IDX] * 
(1 << gsh), bv = rgb2yuv[BV_IDX] * (1 << bsh);
 const unsigned rnd = (256u<<((S)-1)) + (1<<(S-7));
 int i;
 
@@ -314,8 +314,8 @@ static av_always_inline void 
rgb16_32ToUV_half_c_template(int16_t *dstU,
   int gsh, int bsh, 
int S,
   int32_t *rgb2yuv)
 {
-const int ru   = rgb2yuv[RU_IDX] << rsh, gu = rgb2yuv[GU_IDX] << gsh, 
bu = rgb2yuv[BU_IDX] << bsh,
-  rv   = rgb2yuv[RV_IDX] << rsh, gv = rgb2yuv[GV_IDX] << gsh, 
bv = rgb2yuv[BV_IDX] << bsh,
+const int ru   = rgb2yuv[RU_IDX] * (1 << rsh), gu = rgb2yuv[GU_IDX] * 
(1 << gsh), bu = rgb2yuv[BU_IDX] * (1 << bsh),
+  rv   = rgb2yuv[RV_IDX] * (1 << rsh), gv = rgb2yuv[GV_IDX] * 
(1 << gsh), bv = rgb2yuv[BV_IDX] * (1 << bsh),
   maskgx   = ~(maskr | maskb);
 const unsigned rnd = (256U<<(S)) + (1<<(S-6));
 int i;
-- 
2.25.0

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

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

Re: [FFmpeg-devel] [PATCH 4/4] avformat/udp: do not use thread cancellation when receiving data

2020-01-21 Thread Carl Eugen Hoyos
Am Di., 21. Jan. 2020 um 22:56 Uhr schrieb Marton Balint :
>
>
>
> On Fri, 17 Jan 2020, Michael Niedermayer wrote:
>
> > On Thu, Jan 16, 2020 at 01:20:16AM +0100, Marton Balint wrote:
> >> It is not supported by every threading implementation, and the only thing 
> >> we
> >> gain with it is an immediate shutdown of receiving packets on close and
> >> avoiding the poll call before reading the data.
> >>
> >> I don't think it is a big issue if it takes 0.1 sec of delay to close an 
> >> udp
> >> stream. Back when this was introduced the delay was 1 sec, which was indeed
> >> noticable.
> >>
> >> And anybody who needs performance sensitive UDP should not use the fifo 
> >> buffer
> >> in the first place, because the kernel can buffer the data much more
> >> effectively.
>
> This patch also fixes ticket #5717 by the way.

Please mention the ticket number in the commit message.

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

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

[FFmpeg-devel] [PATCH] avformat/libsrt: add missing SRT_VERSION_VALUE check

2020-01-21 Thread Marton Balint
This was missed in d7e2a2bb35e394287b3e3dc27744830bf0b7ca99.

Signed-off-by: Marton Balint 
---
 libavformat/libsrt.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavformat/libsrt.c b/libavformat/libsrt.c
index 443df5bee8..d7faa603f5 100644
--- a/libavformat/libsrt.c
+++ b/libavformat/libsrt.c
@@ -525,6 +525,7 @@ static int libsrt_open(URLContext *h, const char *uri, int 
flags)
 av_freep(>passphrase);
 s->passphrase = av_strndup(buf, strlen(buf));
 }
+#if SRT_VERSION_VALUE >= 0x010302
 if (av_find_info_tag(buf, sizeof(buf), "enforced_encryption", p)) {
 s->enforced_encryption = strtol(buf, NULL, 10);
 }
@@ -534,6 +535,7 @@ static int libsrt_open(URLContext *h, const char *uri, int 
flags)
 if (av_find_info_tag(buf, sizeof(buf), "kmpreannounce", p)) {
 s->kmpreannounce = strtol(buf, NULL, 10);
 }
+#endif
 if (av_find_info_tag(buf, sizeof(buf), "mss", p)) {
 s->mss = strtol(buf, NULL, 10);
 }
-- 
2.16.4

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

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

Re: [FFmpeg-devel] [PATCH 4/4] avformat/udp: do not use thread cancellation when receiving data

2020-01-21 Thread Marton Balint



On Fri, 17 Jan 2020, Michael Niedermayer wrote:


On Thu, Jan 16, 2020 at 01:20:16AM +0100, Marton Balint wrote:

It is not supported by every threading implementation, and the only thing we
gain with it is an immediate shutdown of receiving packets on close and
avoiding the poll call before reading the data.

I don't think it is a big issue if it takes 0.1 sec of delay to close an udp
stream. Back when this was introduced the delay was 1 sec, which was indeed
noticable.

And anybody who needs performance sensitive UDP should not use the fifo buffer
in the first place, because the kernel can buffer the data much more
effectively.


This patch also fixes ticket #5717 by the way.



Signed-off-by: Marton Balint 
---
 libavformat/udp.c | 57 +--
 1 file changed, 26 insertions(+), 31 deletions(-)


this breaks build on mingw64

src/libavformat/udp.c: In function ‘udp_read’:
src/libavformat/udp.c:980:17: error: implicit declaration of function 
‘pthread_cond_timedwait’ [-Werror=implicit-function-declaration]
int err = pthread_cond_timedwait(>cond, >mutex, );
^
cc1: some warnings being treated as errors
make: *** [libavformat/udp.o] Error 1
make: *** Waiting for unfinished jobs


With the pthread_cond_timedwait compat patch applied, this should no 
longer be an issue.


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

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

Re: [FFmpeg-devel] [PATCHv2] avutil/thread: Add pthread_cond_timedwait function

2020-01-21 Thread Marton Balint



On Mon, 20 Jan 2020, Matt Oliver wrote:


On Mon, 20 Jan 2020 at 11:14, Marton Balint  wrote:


From: Matt Oliver 

v2: fix calculating milisecond times and use SleepConditionVariableSRW.

Signed-off-by: Matt Oliver 
---
 compat/os2threads.h  | 25 +
 compat/w32pthreads.h | 18 ++
 libavutil/thread.h   |  7 +++
 3 files changed, 50 insertions(+)

diff --git a/compat/os2threads.h b/compat/os2threads.h
index 2177a033ec..eec6f40ae7 100644
--- a/compat/os2threads.h
+++ b/compat/os2threads.h
@@ -31,11 +31,14 @@

 #undef __STRICT_ANSI__  /* for _beginthread() */
 #include 
+#include 

 #include 
 #include 

 #include "libavutil/attributes.h"
+#include "libavutil/common.h"
+#include "libavutil/time.h"

 typedef struct {
 TID tid;
@@ -163,6 +166,28 @@ static av_always_inline int
pthread_cond_broadcast(pthread_cond_t *cond)
 return 0;
 }

+static av_always_inline int pthread_cond_timedwait(pthread_cond_t *cond,
+   pthread_mutex_t *mutex,
+   const struct timespec
*abstime)
+{
+int64_t abs_milli = abstime->tv_sec * 1000LL + abstime->tv_nsec /
100;
+ULONG t = av_clip64(abs_milli - av_gettime() / 1000, 0, ULONG_MAX);
+
+__atomic_increment(>wait_count);
+
+pthread_mutex_unlock(mutex);
+
+APIRET ret = DosWaitEventSem(cond->event_sem, t);
+
+__atomic_decrement(>wait_count);
+
+DosPostEventSem(cond->ack_sem);
+
+pthread_mutex_lock(mutex);
+
+return (ret == ERROR_TIMEOUT) ? ETIMEDOUT : 0;
+}
+
 static av_always_inline int pthread_cond_wait(pthread_cond_t *cond,
   pthread_mutex_t *mutex)
 {
diff --git a/compat/w32pthreads.h b/compat/w32pthreads.h
index 21acfd2ba1..7df33b7da4 100644
--- a/compat/w32pthreads.h
+++ b/compat/w32pthreads.h
@@ -38,11 +38,13 @@
 #define WIN32_LEAN_AND_MEAN
 #include 
 #include 
+#include 

 #include "libavutil/attributes.h"
 #include "libavutil/common.h"
 #include "libavutil/internal.h"
 #include "libavutil/mem.h"
+#include "libavutil/time.h"

 typedef struct pthread_t {
 void *handle;
@@ -156,6 +158,22 @@ static inline int pthread_cond_wait(pthread_cond_t
*cond, pthread_mutex_t *mutex
 return 0;
 }

+static inline int pthread_cond_timedwait(pthread_cond_t *cond,
pthread_mutex_t *mutex,
+ const struct timespec *abstime)
+{
+int64_t abs_milli = abstime->tv_sec * 1000LL + abstime->tv_nsec /
100;
+DWORD t = av_clip64(abs_milli - av_gettime() / 1000, 0, UINT32_MAX);
+
+if (!SleepConditionVariableSRW(cond, mutex, t, 0)) {
+DWORD err = GetLastError();
+if (err == ERROR_TIMEOUT)
+return ETIMEDOUT;
+else
+return EINVAL;
+}
+return 0;
+}
+
 static inline int pthread_cond_signal(pthread_cond_t *cond)
 {
 WakeConditionVariable(cond);
diff --git a/libavutil/thread.h b/libavutil/thread.h
index cc5272d379..65b97ef303 100644
--- a/libavutil/thread.h
+++ b/libavutil/thread.h
@@ -109,6 +109,12 @@ static inline int
strict_pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t
 ASSERT_PTHREAD(pthread_cond_wait, cond, mutex);
 }

+static inline int strict_pthread_cond_timedwait(pthread_cond_t *cond,
pthread_mutex_t *mutex,
+const struct timespec
*abstime)
+{
+ASSERT_PTHREAD(pthread_cond_timedwait, cond, mutex, abstime);
+}
+
 static inline int strict_pthread_once(pthread_once_t *once_control, void
(*init_routine)(void))
 {
 ASSERT_PTHREAD(pthread_once, once_control, init_routine);
@@ -124,6 +130,7 @@ static inline int strict_pthread_once(pthread_once_t
*once_control, void (*init_
 #define pthread_cond_signalstrict_pthread_cond_signal
 #define pthread_cond_broadcast strict_pthread_cond_broadcast
 #define pthread_cond_wait  strict_pthread_cond_wait
+#define pthread_cond_timedwait strict_pthread_cond_timedwait
 #define pthread_once   strict_pthread_once
 #endif

--
2.16.4



lgtm


Thanks, applied.

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

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

Re: [FFmpeg-devel] [PATCH 02/11] avformat: Remove unnecessary av_packet_unref()

2020-01-21 Thread Andreas Rheinhardt
On Mon, Jan 13, 2020 at 4:45 PM Andreas Rheinhardt <
andreas.rheinha...@gmail.com> wrote:

> On Tue, Jan 7, 2020 at 2:56 PM Andreas Rheinhardt <
> andreas.rheinha...@gmail.com> wrote:
>
>> Since bae8844e the packet will always be unreferenced when a demuxer
>> returns an error, so that a lot of calls to av_packet_unref() in lots of
>> demuxers are now redundant and can be removed.
>>
>> Signed-off-by: Andreas Rheinhardt 
>> ---
>>  libavformat/aacdec.c |  6 --
>>  libavformat/adp.c|  1 -
>>  libavformat/adxdec.c |  2 --
>>  libavformat/amr.c|  1 -
>>  libavformat/ape.c|  1 -
>>  libavformat/avs.c|  1 -
>>  libavformat/brstm.c  |  3 +--
>>  libavformat/c93.c| 13 +++--
>>  libavformat/cdxl.c   |  1 -
>>  libavformat/concatdec.c  |  4 +---
>>  libavformat/dfa.c|  3 ---
>>  libavformat/dsicin.c |  1 -
>>  libavformat/dss.c|  6 +-
>>  libavformat/dxa.c|  1 -
>>  libavformat/electronicarts.c |  3 ---
>>  libavformat/fitsdec.c|  2 --
>>  libavformat/flic.c   |  3 +--
>>  libavformat/g723_1.c |  1 -
>>  libavformat/gdv.c|  1 -
>>  libavformat/gsmdec.c |  1 -
>>  libavformat/hls.c|  1 -
>>  libavformat/icodec.c |  1 -
>>  libavformat/idcin.c  |  2 --
>>  libavformat/idroqdec.c   |  3 +--
>>  libavformat/ilbc.c   |  1 -
>>  libavformat/img2dec.c|  1 -
>>  libavformat/iv8.c|  1 -
>>  libavformat/libmodplug.c |  1 -
>>  libavformat/lxfdec.c |  1 -
>>  libavformat/mov.c|  1 -
>>  libavformat/mpc.c|  1 -
>>  libavformat/mpegts.c |  1 -
>>  libavformat/mpjpegdec.c  |  2 --
>>  libavformat/ncdec.c  |  1 -
>>  libavformat/nuv.c|  1 -
>>  libavformat/oggdec.c |  7 ++-
>>  libavformat/redspark.c   |  1 -
>>  libavformat/rl2.c|  1 -
>>  libavformat/rpl.c|  2 --
>>  libavformat/s337m.c  |  2 --
>>  libavformat/sapdec.c |  1 -
>>  libavformat/sdr2.c   |  1 -
>>  libavformat/sierravmd.c  |  1 -
>>  libavformat/siff.c   |  1 -
>>  libavformat/spdifdec.c   |  5 +
>>  libavformat/swfdec.c |  3 ---
>>  libavformat/thp.c|  2 --
>>  libavformat/vivo.c   | 14 +-
>>  libavformat/vpk.c|  4 +---
>>  libavformat/vqf.c|  1 -
>>  libavformat/wvdec.c  |  4 
>>  libavformat/yuv4mpegdec.c|  1 -
>>  52 files changed, 17 insertions(+), 108 deletions(-)
>>
>>
> Ping for this and the other open patches (namely #1, #2, #5 and #9) of
> this patchset. If it is deemed to help reviewing I can split this patch
> per-file.
>
> - Andreas
>
> Another ping. As has been said, I am open to splitting this per-file.

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

Re: [FFmpeg-devel] [PATCH] Vulkan hwcontext and filters

2020-01-21 Thread Lynne
Jan 21, 2020, 18:22 by an...@khirnov.net:

> Quoting Lynne (2020-01-21 18:51:22)
>
>> Jan 21, 2020, 12:08 by an...@khirnov.net:
>>
>> > Quoting Lynne (2020-01-10 22:05:21)
>> >
>> >>  /**
>> >>  * Activated physical device
>> >>  */
>> >>  VkDevice act_dev;
>> >>
>> >
>> > Where is this 'activated' terminology from? From what I can see, the
>> > spec calls this a 'logical' device. Would be nice to be consistent with
>> > it.
>> >
>>
>> Its just the current active device. Not really wanting to change it,
>> its pretty clear what it is from the type.
>>
>
> Can't really force you, but I'd prefer you did change it. At least drop
> 'physical' from the doxy, since the spec makes a distinction between
> 'physical' and 'logical' devices and this is not a physical device.
>

Done.



>> Its size too? Didn't know that.
>> I do think its a good idea to be able to append fields to it, so I've
>> added a av_vk_frame_alloc() function. I've followed what
>> av_frame_alloc is called, though I'm not sure if its too close to that
>> one's name.
>>
>
> My original intent with this API was that calles are allowed to provide
> their own pools. Not sure if that's still allowed or works though. But
> if it is, the caller needs to be able to allocate/free AVkFrame.
>

They are of course. The first wip of the cuda interop exploited that IIRC.
But I think the issue is that in order for API users to make their own pools 
they need to
know the size in bytes of AVVkFrame since that's what av_buffer_create() 
accepts.
I could make a function to return that, but I'm wondering if its somewhat too 
big of a mess already.
I could instead reserve some memory in the struct, a few hundred bytes would be 
enough since every Vulkan object has to be allocated on heap.
___
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/3] avcodec/avcodec: Add codec_tags array to AVCodec

2020-01-21 Thread James Almer
On 1/21/2020 5:39 PM, Michael Niedermayer wrote:
> On Tue, Jan 21, 2020 at 04:39:10PM -0300, James Almer wrote:
>> On 1/21/2020 4:30 PM, Michael Niedermayer wrote:
>>> On Tue, Jan 21, 2020 at 07:48:38PM +0100, Anton Khirnov wrote:
 Quoting Michael Niedermayer (2019-12-30 00:38:17)
> This allows the fuzzer to target meaningfull codec tags instead
> of hunting the 4gb space, which it seems to have problems with.
>
> Suggested-by: James
> Signed-off-by: Michael Niedermayer 
> ---
>  libavcodec/avcodec.h | 6 ++
>  1 file changed, 6 insertions(+)
>
> diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
> index 119b32dc1f..b0c6a8f2e3 100644
> --- a/libavcodec/avcodec.h
> +++ b/libavcodec/avcodec.h
> @@ -3634,6 +3634,12 @@ typedef struct AVCodec {
>   * The user can only access this field via avcodec_get_hw_config().
>   */
>  const struct AVCodecHWConfigInternal **hw_configs;
> +
> +/**
> + * List of supported codec_tags, terminated by CODEC_TAGS_END.
> + */
> +const uint32_t *codec_tags;
> +#define CODEC_TAGS_END -1

 Is this supposed to be public or for fuzzer use only?
 If the latter, then CODEC_TAGS_END doesn't need to live in a public
 header.
>>>
>>> the codec_tag field is public. So eventually the list of valid codec tags
>>> should become too.
>>
>> It's at the end of AVCodec, which is where the fields that must not be
>> used or accessed from outside of lavc reside. They are documented as
>> "can be removed at any time without warning and without bumping
>> version". So basically, it's not public.
> 
> yes, it could either be moved up or a public function to access it
> added when its decided to make it public
> 
> 
>>
>> Since you are accessing them directly from the fuzzer anyway, might as
>> well just assume the -1 termination and not bother adding a public
>> define for it. If we ever want this public then it can be added, perhaps
>> after a better design is found.
> 
> replacing a named constant by a litteral repeated -1 is making the code
> worse. (maintaince and understanding wise)
> 
> So from the smell of this thread i dont think we will agree on a public
> API and that also wasnt suggested nor is it needed ATM.
> 
> Thus i suggest we keep the codec_tags as in the original patch in the
> private part and put the CODEC_TAGS_END  with a FF prefix in 
> internal.h
> 
> That way it can be used in the fuzzer and we can in the future decide
> if this or a different API could/should become public.
> 
> is that ok with everyone?

Ok with me.

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

___
ffmpeg-devel 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/3] avcodec/avcodec: Add codec_tags array to AVCodec

2020-01-21 Thread Michael Niedermayer
On Tue, Jan 21, 2020 at 04:39:10PM -0300, James Almer wrote:
> On 1/21/2020 4:30 PM, Michael Niedermayer wrote:
> > On Tue, Jan 21, 2020 at 07:48:38PM +0100, Anton Khirnov wrote:
> >> Quoting Michael Niedermayer (2019-12-30 00:38:17)
> >>> This allows the fuzzer to target meaningfull codec tags instead
> >>> of hunting the 4gb space, which it seems to have problems with.
> >>>
> >>> Suggested-by: James
> >>> Signed-off-by: Michael Niedermayer 
> >>> ---
> >>>  libavcodec/avcodec.h | 6 ++
> >>>  1 file changed, 6 insertions(+)
> >>>
> >>> diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
> >>> index 119b32dc1f..b0c6a8f2e3 100644
> >>> --- a/libavcodec/avcodec.h
> >>> +++ b/libavcodec/avcodec.h
> >>> @@ -3634,6 +3634,12 @@ typedef struct AVCodec {
> >>>   * The user can only access this field via avcodec_get_hw_config().
> >>>   */
> >>>  const struct AVCodecHWConfigInternal **hw_configs;
> >>> +
> >>> +/**
> >>> + * List of supported codec_tags, terminated by CODEC_TAGS_END.
> >>> + */
> >>> +const uint32_t *codec_tags;
> >>> +#define CODEC_TAGS_END -1
> >>
> >> Is this supposed to be public or for fuzzer use only?
> >> If the latter, then CODEC_TAGS_END doesn't need to live in a public
> >> header.
> > 
> > the codec_tag field is public. So eventually the list of valid codec tags
> > should become too.
> 
> It's at the end of AVCodec, which is where the fields that must not be
> used or accessed from outside of lavc reside. They are documented as
> "can be removed at any time without warning and without bumping
> version". So basically, it's not public.

yes, it could either be moved up or a public function to access it
added when its decided to make it public


> 
> Since you are accessing them directly from the fuzzer anyway, might as
> well just assume the -1 termination and not bother adding a public
> define for it. If we ever want this public then it can be added, perhaps
> after a better design is found.

replacing a named constant by a litteral repeated -1 is making the code
worse. (maintaince and understanding wise)

So from the smell of this thread i dont think we will agree on a public
API and that also wasnt suggested nor is it needed ATM.

Thus i suggest we keep the codec_tags as in the original patch in the
private part and put the CODEC_TAGS_END  with a FF prefix in 
internal.h

That way it can be used in the fuzzer and we can in the future decide
if this or a different API could/should become public.

is that ok with everyone?

Thanks


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

Frequently ignored answer#1 FFmpeg bugs should be sent to our bugtracker. User
questions about the command line tools should be sent to the ffmpeg-user ML.
And questions about how to use libav* should be sent to the libav-user ML.


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

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

[FFmpeg-devel] [PATCH 2/2] libavutil: x86: Include stdlib.h before using _byteswap_ulong

2020-01-21 Thread Martin Storsjö
When clang works in MSVC mode, it does have the _byteswap_ulong
builtin, but one has to include stdlib.h before using it.
---
 libavutil/x86/bswap.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libavutil/x86/bswap.h b/libavutil/x86/bswap.h
index ffa59e4c82..b2f18b6c93 100644
--- a/libavutil/x86/bswap.h
+++ b/libavutil/x86/bswap.h
@@ -26,6 +26,7 @@
 
 #include 
 #if defined(_MSC_VER)
+#include 
 #include 
 #endif
 #include "config.h"
-- 
2.17.1

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

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

[FFmpeg-devel] [PATCH 1/2] configure: Check for GetStdHandle in addition to SetConsoleTextAttribute

2020-01-21 Thread Martin Storsjö
SetConsoleTextAttribute used to be unavailable for Windows Store apps,
but is available to them now. But GetStdHandle still is unavailable,
thus make sure to check for both functions before using code that
requires both.
---
Alternatively we could check for just GetStdHandle instead of
SetConsoleTextAttribute.
---
 configure   | 2 ++
 libavutil/log.c | 6 +++---
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/configure b/configure
index 1f3d0fdd4b..c02dbcc8b2 100755
--- a/configure
+++ b/configure
@@ -2201,6 +2201,7 @@ SYSTEM_FUNCS="
 GetProcessMemoryInfo
 GetProcessTimes
 getrusage
+GetStdHandle
 GetSystemTimeAsFileTime
 gettimeofday
 glob
@@ -6040,6 +6041,7 @@ check_func_headers sys/stat.h lstat
 check_func_headers windows.h GetModuleHandle
 check_func_headers windows.h GetProcessAffinityMask
 check_func_headers windows.h GetProcessTimes
+check_func_headers windows.h GetStdHandle
 check_func_headers windows.h GetSystemTimeAsFileTime
 check_func_headers windows.h LoadLibrary
 check_func_headers windows.h MapViewOfFile
diff --git a/libavutil/log.c b/libavutil/log.c
index e8a0db7716..16197f4081 100644
--- a/libavutil/log.c
+++ b/libavutil/log.c
@@ -55,7 +55,7 @@ static int av_log_level = AV_LOG_INFO;
 static int flags;
 
 #define NB_LEVELS 8
-#if defined(_WIN32) && HAVE_SETCONSOLETEXTATTRIBUTE
+#if defined(_WIN32) && HAVE_SETCONSOLETEXTATTRIBUTE && HAVE_GETSTDHANDLE
 #include 
 static const uint8_t color[16 + AV_CLASS_CATEGORY_NB] = {
 [AV_LOG_PANIC  /8] = 12,
@@ -122,7 +122,7 @@ static int use_color = -1;
 
 static void check_color_terminal(void)
 {
-#if defined(_WIN32) && HAVE_SETCONSOLETEXTATTRIBUTE
+#if defined(_WIN32) && HAVE_SETCONSOLETEXTATTRIBUTE && HAVE_GETSTDHANDLE
 CONSOLE_SCREEN_BUFFER_INFO con_info;
 con = GetStdHandle(STD_ERROR_HANDLE);
 use_color = (con != INVALID_HANDLE_VALUE) && !getenv("NO_COLOR") &&
@@ -157,7 +157,7 @@ static void colored_fputs(int level, int tint, const char 
*str)
 if (level == AV_LOG_INFO/8) local_use_color = 0;
 elselocal_use_color = use_color;
 
-#if defined(_WIN32) && HAVE_SETCONSOLETEXTATTRIBUTE
+#if defined(_WIN32) && HAVE_SETCONSOLETEXTATTRIBUTE && HAVE_GETSTDHANDLE
 if (local_use_color)
 SetConsoleTextAttribute(con, background | color[level]);
 fputs(str, stderr);
-- 
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 1/3] avcodec/avcodec: Add codec_tags array to AVCodec

2020-01-21 Thread James Almer
On 1/21/2020 4:30 PM, Michael Niedermayer wrote:
> On Tue, Jan 21, 2020 at 07:48:38PM +0100, Anton Khirnov wrote:
>> Quoting Michael Niedermayer (2019-12-30 00:38:17)
>>> This allows the fuzzer to target meaningfull codec tags instead
>>> of hunting the 4gb space, which it seems to have problems with.
>>>
>>> Suggested-by: James
>>> Signed-off-by: Michael Niedermayer 
>>> ---
>>>  libavcodec/avcodec.h | 6 ++
>>>  1 file changed, 6 insertions(+)
>>>
>>> diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
>>> index 119b32dc1f..b0c6a8f2e3 100644
>>> --- a/libavcodec/avcodec.h
>>> +++ b/libavcodec/avcodec.h
>>> @@ -3634,6 +3634,12 @@ typedef struct AVCodec {
>>>   * The user can only access this field via avcodec_get_hw_config().
>>>   */
>>>  const struct AVCodecHWConfigInternal **hw_configs;
>>> +
>>> +/**
>>> + * List of supported codec_tags, terminated by CODEC_TAGS_END.
>>> + */
>>> +const uint32_t *codec_tags;
>>> +#define CODEC_TAGS_END -1
>>
>> Is this supposed to be public or for fuzzer use only?
>> If the latter, then CODEC_TAGS_END doesn't need to live in a public
>> header.
> 
> the codec_tag field is public. So eventually the list of valid codec tags
> should become too.

It's at the end of AVCodec, which is where the fields that must not be
used or accessed from outside of lavc reside. They are documented as
"can be removed at any time without warning and without bumping
version". So basically, it's not public.

Since you are accessing them directly from the fuzzer anyway, might as
well just assume the -1 termination and not bother adding a public
define for it. If we ever want this public then it can be added, perhaps
after a better design is found.

> In this initial patch codec_tags was not really intended to be public
> and i can certainly move CODEC_TAGS_END to a internal header if preferred.
> but this is a change that we will likely undo in the future ...
> 
> Thanks
> 
> [...]
> 
> 
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
> 

___
ffmpeg-devel 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/3] avcodec/avcodec: Add codec_tags array to AVCodec

2020-01-21 Thread Michael Niedermayer
On Tue, Jan 21, 2020 at 07:48:38PM +0100, Anton Khirnov wrote:
> Quoting Michael Niedermayer (2019-12-30 00:38:17)
> > This allows the fuzzer to target meaningfull codec tags instead
> > of hunting the 4gb space, which it seems to have problems with.
> > 
> > Suggested-by: James
> > Signed-off-by: Michael Niedermayer 
> > ---
> >  libavcodec/avcodec.h | 6 ++
> >  1 file changed, 6 insertions(+)
> > 
> > diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
> > index 119b32dc1f..b0c6a8f2e3 100644
> > --- a/libavcodec/avcodec.h
> > +++ b/libavcodec/avcodec.h
> > @@ -3634,6 +3634,12 @@ typedef struct AVCodec {
> >   * The user can only access this field via avcodec_get_hw_config().
> >   */
> >  const struct AVCodecHWConfigInternal **hw_configs;
> > +
> > +/**
> > + * List of supported codec_tags, terminated by CODEC_TAGS_END.
> > + */
> > +const uint32_t *codec_tags;
> > +#define CODEC_TAGS_END -1
> 
> Is this supposed to be public or for fuzzer use only?
> If the latter, then CODEC_TAGS_END doesn't need to live in a public
> header.

the codec_tag field is public. So eventually the list of valid codec tags
should become too.
In this initial patch codec_tags was not really intended to be public
and i can certainly move CODEC_TAGS_END to a internal header if preferred.
but this is a change that we will likely undo in the future ...

Thanks

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

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


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

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

Re: [FFmpeg-devel] [PATCH 1/3] avcodec/avcodec: Add codec_tags array to AVCodec

2020-01-21 Thread Anton Khirnov
Quoting Michael Niedermayer (2019-12-30 00:38:17)
> This allows the fuzzer to target meaningfull codec tags instead
> of hunting the 4gb space, which it seems to have problems with.
> 
> Suggested-by: James
> Signed-off-by: Michael Niedermayer 
> ---
>  libavcodec/avcodec.h | 6 ++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
> index 119b32dc1f..b0c6a8f2e3 100644
> --- a/libavcodec/avcodec.h
> +++ b/libavcodec/avcodec.h
> @@ -3634,6 +3634,12 @@ typedef struct AVCodec {
>   * The user can only access this field via avcodec_get_hw_config().
>   */
>  const struct AVCodecHWConfigInternal **hw_configs;
> +
> +/**
> + * List of supported codec_tags, terminated by CODEC_TAGS_END.
> + */
> +const uint32_t *codec_tags;
> +#define CODEC_TAGS_END -1

Is this supposed to be public or for fuzzer use only?
If the latter, then CODEC_TAGS_END doesn't need to live in a public
header.

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

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

Re: [FFmpeg-devel] [PATCH 3/5] tools/target_dec_fuzzer: Fuzz private options of AC3/E-AC3

2020-01-21 Thread Michael Niedermayer
On Sun, Dec 29, 2019 at 08:23:37PM +0100, Michael Niedermayer wrote:
> This should improve AC-3 coverage
> 
> Signed-off-by: Michael Niedermayer 
> ---
>  tools/target_dec_fuzzer.c | 19 +--
>  1 file changed, 17 insertions(+), 2 deletions(-)

will apply

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

Many that live deserve death. And some that die deserve life. Can you give
it to them? Then do not be too eager to deal out death in judgement. For
even the very wise cannot see all ends. -- Gandalf


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 1/5] tools/target_dec_fuzzer: Fuzz idct_algo value

2020-01-21 Thread Michael Niedermayer
On Sun, Dec 29, 2019 at 08:23:35PM +0100, Michael Niedermayer wrote:
> This should improve coverage
> 
> Signed-off-by: Michael Niedermayer 
> ---
>  tools/target_dec_fuzzer.c | 2 ++
>  1 file changed, 2 insertions(+)

will apply


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

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


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

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

Re: [FFmpeg-devel] [PATCH 1/2] avutil/log: Add av_log_once() for printing a message just once per instance

2020-01-21 Thread Anton Khirnov
Quoting Michael Niedermayer (2020-01-21 15:43:48)
> On Tue, Jan 21, 2020 at 12:24:50PM +0100, Anton Khirnov wrote:
> > Quoting Michael Niedermayer (2020-01-16 17:51:28)
> > > Compared to ad-hoc if(printed) ... code this allows the user to disable
> > > it with a flag and see all repeated messages, it is also simpler
> > 
> > That flag is global state - it should be deprecated and removed, not
> > embedded further into the API.
> 
> When the flag is replaced by a non global solution every of its uses
> would be replaced too.
> 
> Until such a non global API exists, this is the only way the user can
> indicate her choice of which log messages to print.
> Code should honor the existing API and user preferrance.

The problem is that right now, flags is only used by the default log
callback. The behaviour of the default log callback is not specified by
the API, so it can be changed later without much trouble. With this
patch, the function of flags is hardcoded into the API, making its
future removal significantly harder.

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

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

Re: [FFmpeg-devel] [PATCH 4/5] tools/target_dec_fuzzer: Also Fuzz with CPU optimizations disabled

2020-01-21 Thread Michael Niedermayer
On Sun, Dec 29, 2019 at 08:23:38PM +0100, Michael Niedermayer wrote:
> This should improve coverage of *_c()
> 
> Signed-off-by: Michael Niedermayer 
> ---
>  tools/target_dec_fuzzer.c | 2 ++
>  1 file changed, 2 insertions(+)

will apply

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

If you drop bombs on a foreign country and kill a hundred thousand
innocent people, expect your government to call the consequence
"unprovoked inhuman terrorist attacks" and use it to justify dropping
more bombs and killing more people. The technology changed, the idea is old.


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 1/3] avcodec/avcodec: Add codec_tags array to AVCodec

2020-01-21 Thread Michael Niedermayer
On Mon, Dec 30, 2019 at 10:38:11AM +0100, Nicolas George wrote:
> Michael Niedermayer (12019-12-30):
> > This allows the fuzzer to target meaningfull codec tags instead
> > of hunting the 4gb space, which it seems to have problems with.
> > 
> > Suggested-by: James
> > Signed-off-by: Michael Niedermayer 
> > ---
> >  libavcodec/avcodec.h | 6 ++
> >  1 file changed, 6 insertions(+)
> > 
> > diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
> > index 119b32dc1f..b0c6a8f2e3 100644
> > --- a/libavcodec/avcodec.h
> > +++ b/libavcodec/avcodec.h
> > @@ -3634,6 +3634,12 @@ typedef struct AVCodec {
> >   * The user can only access this field via avcodec_get_hw_config().
> >   */
> >  const struct AVCodecHWConfigInternal **hw_configs;
> > +
> > +/**
> > + * List of supported codec_tags, terminated by CODEC_TAGS_END.
> > + */
> > +const uint32_t *codec_tags;
> 
> > +#define CODEC_TAGS_END -1
> 
> AV_ prefix please.

will apply with that change

thanks

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Concerning the gods, I have no means of knowing whether they exist or not
or of what sort they may be, because of the obscurity of the subject, and
the brevity of human life -- Protagoras


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] Vulkan hwcontext and filters

2020-01-21 Thread Anton Khirnov
Quoting Lynne (2020-01-21 18:51:22)
> Jan 21, 2020, 12:08 by an...@khirnov.net:
> 
> > Quoting Lynne (2020-01-10 22:05:21)
> >
> >>  /**
> >>  * Activated physical device
> >>  */
> >>  VkDevice act_dev;
> >>
> >
> > Where is this 'activated' terminology from? From what I can see, the
> > spec calls this a 'logical' device. Would be nice to be consistent with
> > it.
> >
> 
> Its just the current active device. Not really wanting to change it,
> its pretty clear what it is from the type.

Can't really force you, but I'd prefer you did change it. At least drop
'physical' from the doxy, since the spec makes a distinction between
'physical' and 'logical' devices and this is not a physical device.

> 
> >> /**
> >>  * Queue family index for graphics
> >>  */
> >>  int queue_family_index;
> >>
> >
> > What is this for? I don't see it used anywhere.
> >
> 
> Its required to do anything graphics-related (like non-compute
> shaders, which lavfi will support in a future patch). You need to know
> it at init time and at runtime, and there's nothing you can call to
> know what its been initialized as.

At init time of what? The filter or the hwdevice? I'm wondering if you
can have a situation where you want to use different queue families for
different filters (on a single device).

> 
> 
> >> /**
> >>  * Queue family index for transfer ops only. By default, the priority order
> >>  * is dedicated transfer > dedicated compute > graphics.
> >>  */
> >>
> >
> > IIUC the second sentence talks about how the internal device
> > creation/derivation code works, but that isn't made very clear. Maybe
> > make it a
> > @note the av_hwdevice_create() will set those fields like this...
> >
> 
> Done.
> 
> 
> 
> >> int queue_family_tx_index;
> >>  /**
> >>  * Queue family index for compute ops. Will be equal to the graphics
> >>  * one unless a dedicated transfer queue is found.
> >>  */
> >>  int queue_family_comp_index;
> >>
> >
> > Same comment as above.
> >
> 
> Fixed.
> 
> 
> 
> >> /**
> >>  * The UUID of the selected physical device.
> >>  */
> >>  uint8_t device_uuid[VK_UUID_SIZE];
> >>
> >
> > Do we really need to export this here? It can be queried from phys_dev,
> > no?
> >
> 
> Actually no, so removed it and changed hwcontext_cuda to use 
> vkGetPhysicalDeviceProperties2.
> 
> 
> 
> >> } AVVulkanDeviceContext;
> >>
> >> /**
> >>  * Allocated as AVHWFramesContext.hwctx, used to set pool-specific options
> >>  */
> >> typedef struct AVVulkanFramesContext {
> >>  /**
> >>  * Controls the tiling of output frames.
> >>  */
> >>  VkImageTiling tiling;
> >>  /**
> >>  * Defines extra usage of output frames. This is bitwise OR'd with the
> >>  * standard usage flags (SAMPLED, STORAGE, TRANSFER_SRC and TRANSFER_DST).
> >>  */
> >>  VkImageUsageFlagBits usage;
> >>  /**
> >>  * Extension data for image creation. By default, if the extension is
> >>  * available, this will be chained to a VkImageFormatListCreateInfoKHR.
> >>  */
> >>  void *create_pnext;
> >>  /**
> >>  * Extension data for memory allocation. Must have as many entries as
> >>  * the number of planes of the sw_format.
> >>  * This will be chained to VkExportMemoryAllocateInfo, which is used
> >>  * to make all pool images exportable to other APIs.
> >>  */
> >>  void *alloc_pnext[AV_NUM_DATA_POINTERS];
> >> } AVVulkanFramesContext;
> >>
> >> /*
> >>  * Frame structure, the VkFormat of the image will always match
> >>  * the pool's sw_format.
> >>  * All frames, imported or allocated, will be created with the
> >>  * VK_IMAGE_CREATE_ALIAS_BIT flag set, so the memory may be aliased if 
> >> needed.
> >>  */
> >> typedef struct AVVkFrame {
> >>  /**
> >>  * Vulkan images to which the memory is bound to.
> >>  */
> >>  VkImage img[AV_NUM_DATA_POINTERS];
> >>
> >>  /**
> >>  * Same tiling must be used for all images.
> >>  */
> >>  VkImageTiling tiling;
> >>
> >>  /**
> >>  * Memory backing the images. Could be less than the amount of images
> >>  * if importing from a DRM or VAAPI frame.
> >>  */
> >>  VkDeviceMemory mem[AV_NUM_DATA_POINTERS];
> >>  size_t size[AV_NUM_DATA_POINTERS];
> >>
> >>  /**
> >>  * OR'd flags for all memory allocated
> >>  */
> >>  VkMemoryPropertyFlagBits flags;
> >>
> >>  /**
> >>  * Updated after every barrier
> >>  */
> >>  VkAccessFlagBits access[AV_NUM_DATA_POINTERS];
> >>  VkImageLayout layout[AV_NUM_DATA_POINTERS];
> >>
> >>  /**
> >>  * Per-image semaphores. Must not be freed manually. Must be waited on
> >>  * and signalled at every queue submission.
> >>  */
> >>  VkSemaphore sem[AV_NUM_DATA_POINTERS];
> >>
> >>  /**
> >>  * Internal data.
> >>  */
> >>  struct AVVkFrameInternal *internal;
> >> } AVVkFrame;
> >>
> >
> > This is a pretty big and complicated struct and its size has to be
> > hardcoded in the ABI IIUC. Do we want a constructor for it?
> >
> 
> Its size too? Didn't know that.
> I do think its a good idea to be able to append fields to it, so I've
> added a av_vk_frame_alloc() function. I've followed what
> 

Re: [FFmpeg-devel] [PATCH v2] HEVC: Export motion vectors to frame side data.

2020-01-21 Thread Lynne
Jan 20, 2020, 08:42 by kavea...@gmail.com:

> Ping
>

https://ffmpeg.org/pipermail/ffmpeg-devel/2019-August/248836.html


I've okayed it, its just not been pushed yet.
You'll need to add the vectors to the block struct. int16_t [2] will do.
___
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] Vulkan hwcontext and filters

2020-01-21 Thread Lynne
Jan 21, 2020, 12:08 by an...@khirnov.net:

> Quoting Lynne (2020-01-10 22:05:21)
>
>>  /**
>>  * Activated physical device
>>  */
>>  VkDevice act_dev;
>>
>
> Where is this 'activated' terminology from? From what I can see, the
> spec calls this a 'logical' device. Would be nice to be consistent with
> it.
>

Its just the current active device. Not really wanting to change it, its pretty 
clear what it is from the type.



>> /**
>>  * Queue family index for graphics
>>  */
>>  int queue_family_index;
>>
>
> What is this for? I don't see it used anywhere.
>

Its required to do anything graphics-related (like non-compute shaders, which 
lavfi will support in a future patch). You need to know it at init time and at 
runtime, and there's nothing you can call to know what its been initialized as.


>> /**
>>  * Queue family index for transfer ops only. By default, the priority order
>>  * is dedicated transfer > dedicated compute > graphics.
>>  */
>>
>
> IIUC the second sentence talks about how the internal device
> creation/derivation code works, but that isn't made very clear. Maybe
> make it a
> @note the av_hwdevice_create() will set those fields like this...
>

Done.



>> int queue_family_tx_index;
>>  /**
>>  * Queue family index for compute ops. Will be equal to the graphics
>>  * one unless a dedicated transfer queue is found.
>>  */
>>  int queue_family_comp_index;
>>
>
> Same comment as above.
>

Fixed.



>> /**
>>  * The UUID of the selected physical device.
>>  */
>>  uint8_t device_uuid[VK_UUID_SIZE];
>>
>
> Do we really need to export this here? It can be queried from phys_dev,
> no?
>

Actually no, so removed it and changed hwcontext_cuda to use 
vkGetPhysicalDeviceProperties2.



>> } AVVulkanDeviceContext;
>>
>> /**
>>  * Allocated as AVHWFramesContext.hwctx, used to set pool-specific options
>>  */
>> typedef struct AVVulkanFramesContext {
>>  /**
>>  * Controls the tiling of output frames.
>>  */
>>  VkImageTiling tiling;
>>  /**
>>  * Defines extra usage of output frames. This is bitwise OR'd with the
>>  * standard usage flags (SAMPLED, STORAGE, TRANSFER_SRC and TRANSFER_DST).
>>  */
>>  VkImageUsageFlagBits usage;
>>  /**
>>  * Extension data for image creation. By default, if the extension is
>>  * available, this will be chained to a VkImageFormatListCreateInfoKHR.
>>  */
>>  void *create_pnext;
>>  /**
>>  * Extension data for memory allocation. Must have as many entries as
>>  * the number of planes of the sw_format.
>>  * This will be chained to VkExportMemoryAllocateInfo, which is used
>>  * to make all pool images exportable to other APIs.
>>  */
>>  void *alloc_pnext[AV_NUM_DATA_POINTERS];
>> } AVVulkanFramesContext;
>>
>> /*
>>  * Frame structure, the VkFormat of the image will always match
>>  * the pool's sw_format.
>>  * All frames, imported or allocated, will be created with the
>>  * VK_IMAGE_CREATE_ALIAS_BIT flag set, so the memory may be aliased if 
>> needed.
>>  */
>> typedef struct AVVkFrame {
>>  /**
>>  * Vulkan images to which the memory is bound to.
>>  */
>>  VkImage img[AV_NUM_DATA_POINTERS];
>>
>>  /**
>>  * Same tiling must be used for all images.
>>  */
>>  VkImageTiling tiling;
>>
>>  /**
>>  * Memory backing the images. Could be less than the amount of images
>>  * if importing from a DRM or VAAPI frame.
>>  */
>>  VkDeviceMemory mem[AV_NUM_DATA_POINTERS];
>>  size_t size[AV_NUM_DATA_POINTERS];
>>
>>  /**
>>  * OR'd flags for all memory allocated
>>  */
>>  VkMemoryPropertyFlagBits flags;
>>
>>  /**
>>  * Updated after every barrier
>>  */
>>  VkAccessFlagBits access[AV_NUM_DATA_POINTERS];
>>  VkImageLayout layout[AV_NUM_DATA_POINTERS];
>>
>>  /**
>>  * Per-image semaphores. Must not be freed manually. Must be waited on
>>  * and signalled at every queue submission.
>>  */
>>  VkSemaphore sem[AV_NUM_DATA_POINTERS];
>>
>>  /**
>>  * Internal data.
>>  */
>>  struct AVVkFrameInternal *internal;
>> } AVVkFrame;
>>
>
> This is a pretty big and complicated struct and its size has to be
> hardcoded in the ABI IIUC. Do we want a constructor for it?
>

Its size too? Didn't know that.
I do think its a good idea to be able to append fields to it, so I've added a 
av_vk_frame_alloc() function. I've followed what av_frame_alloc is called, 
though I'm not sure if its too close to that one's name.

Changes are in git.
___
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] headers for gapless playback

2020-01-21 Thread Kaplan, John
> > As far as control, I'll need to add a config switch to control adding 
gapless data or not.
> Why wouldn't it always be added?
If that's the consensus, then sure. But other tools I've seen have gapless 
metadata output controlled by a switch and not put in by default.

> Please avoid top-posting here, Carl Eugen
Sorry wasn't aware of that preference.


___
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] avutil/log: Move log_level_offset_offset code from av_log() to v_log()

2020-01-21 Thread Michael Niedermayer
Suggested-by: Anton
Signed-off-by: Michael Niedermayer 
---
 libavutil/log.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/libavutil/log.c b/libavutil/log.c
index e8a0db7716..c3e65f0470 100644
--- a/libavutil/log.c
+++ b/libavutil/log.c
@@ -362,19 +362,19 @@ static void (*av_log_callback)(void*, int, const char*, 
va_list) =
 
 void av_log(void* avcl, int level, const char *fmt, ...)
 {
-AVClass* avc = avcl ? *(AVClass **) avcl : NULL;
 va_list vl;
 va_start(vl, fmt);
-if (avc && avc->version >= (50 << 16 | 15 << 8 | 2) &&
-avc->log_level_offset_offset && level >= AV_LOG_FATAL)
-level += *(int *) (((uint8_t *) avcl) + avc->log_level_offset_offset);
 av_vlog(avcl, level, fmt, vl);
 va_end(vl);
 }
 
 void av_vlog(void* avcl, int level, const char *fmt, va_list vl)
 {
+AVClass* avc = avcl ? *(AVClass **) avcl : NULL;
 void (*log_callback)(void*, int, const char*, va_list) = av_log_callback;
+if (avc && avc->version >= (50 << 16 | 15 << 8 | 2) &&
+avc->log_level_offset_offset && level >= AV_LOG_FATAL)
+level += *(int *) (((uint8_t *) avcl) + avc->log_level_offset_offset);
 if (log_callback)
 log_callback(avcl, level, fmt, vl);
 }
-- 
2.25.0

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

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

Re: [FFmpeg-devel] [PATCH 1/2] avutil/log: Add av_log_once() for printing a message just once per instance

2020-01-21 Thread Michael Niedermayer
On Tue, Jan 21, 2020 at 12:24:50PM +0100, Anton Khirnov wrote:
> Quoting Michael Niedermayer (2020-01-16 17:51:28)
> > Compared to ad-hoc if(printed) ... code this allows the user to disable
> > it with a flag and see all repeated messages, it is also simpler
> 
> That flag is global state - it should be deprecated and removed, not
> embedded further into the API.

When the flag is replaced by a non global solution every of its uses
would be replaced too.

Until such a non global API exists, this is the only way the user can
indicate her choice of which log messages to print.
Code should honor the existing API and user preferrance.


> 
> > 
> > TODO: APIChanges & version bump
> > 
> > Signed-off-by: Michael Niedermayer 
> > ---
> >  libavutil/log.c | 15 +++
> >  libavutil/log.h | 19 +++
> >  2 files changed, 34 insertions(+)
> > 
> > diff --git a/libavutil/log.c b/libavutil/log.c
> > index e8a0db7716..7646e18cfa 100644
> > --- a/libavutil/log.c
> > +++ b/libavutil/log.c
> > @@ -372,6 +372,21 @@ void av_log(void* avcl, int level, const char *fmt, 
> > ...)
> >  va_end(vl);
> >  }
> >  
> > +void av_log_once(void* avcl, int level, int *state, const char *fmt, ...)
> > +{
> > +if (!((flags & AV_LOG_SKIP_REPEATED) && *state)) {
> > +AVClass* avc = avcl ? *(AVClass **) avcl : NULL;
> > +va_list vl;
> > +va_start(vl, fmt);
> > +if (avc && avc->version >= (50 << 16 | 15 << 8 | 2) &&
> > +avc->log_level_offset_offset && level >= AV_LOG_FATAL)
> > +level += *(int *) (((uint8_t *) avcl) + 
> > avc->log_level_offset_offset);
> 
> This logic is duplicated with av_log(). 

> Why is this not done in av_vlog
> anyway?

I am not aware of a reason, ill post a patch to move it over


> 
> > +av_vlog(avcl, level, fmt, vl);
> > +va_end(vl);
> > +*state = 1;
> > +}
> > +}
> > +
> >  void av_vlog(void* avcl, int level, const char *fmt, va_list vl)
> >  {
> >  void (*log_callback)(void*, int, const char*, va_list) = 
> > av_log_callback;
> > diff --git a/libavutil/log.h b/libavutil/log.h
> > index d9554e609d..618d0d1817 100644
> > --- a/libavutil/log.h
> > +++ b/libavutil/log.h
> > @@ -233,6 +233,25 @@ typedef struct AVClass {
> >   */
> >  void av_log(void *avcl, int level, const char *fmt, ...) 
> > av_printf_format(3, 4);
> >  
> > +/**
> > + * Send the specified message to the log once if the level is less than or 
> > equal
> > + * to the current av_log_level. By default, all logging messages are sent 
> > to
> > + * stderr. This behavior can be altered by setting a different logging 
> > callback
> > + * function.
> > + * If AV_LOG_SKIP_REPEATED is set each message (each unique state) will 
> > only be
> > + * printed once. If its not set then this behaves live av_log()
> > + * @see av_log
> > + *
> > + * @param avcl A pointer to an arbitrary struct of which the first field 
> > is a
> > + *pointer to an AVClass struct or NULL if general log.
> > + * @param level The importance level of the message expressed using a @ref
> > + *lavu_log_constants "Logging Constant".
> > + * @param fmt The format string (printf-compatible) that specifies how
> > + *subsequent arguments are converted to output.
> > + * @param state a variable to keep trak of if a message has already been 
> > printed
> > + *this must be initialized to 0 before the first use.
> 
> We should either demand that the caller ensures this does not get called
> simultaneously with the same state, or make the above check-and-set
> atomic.

I had a variant with atomic locally but it felt a bit messy considering that
probably none of the callers would need it to be atomic.
(messy being that the atomic stuff needs the state explicitly inited)

ill document that each state should not be accessed by 2 threads simultaneously

Thanks

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

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


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

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

Re: [FFmpeg-devel] [PATCH 2/2] avformat/libzmq: Replace fail statements with goto

2020-01-21 Thread Michael Niedermayer
On Mon, Jan 20, 2020 at 09:24:30PM +0100, Paul B Mahol wrote:
> LGTM

will apply

thx

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

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


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

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

Re: [FFmpeg-devel] [PATCH 1/2] avcodec/j2kenc: Fix undefined shifts of negative numbers

2020-01-21 Thread Michael Niedermayer
On Tue, Jan 21, 2020 at 01:23:47AM +0100, Andreas Rheinhardt wrote:
> Also add parentheses to some lines to make the operator precedence
> clearer.
> 
> This affected the FATE-tests vsynth*-jpeg2000 and vsynth*-jpeg2000-97
> (where * ranges over { 1, 2, 3, _lena }) as well as ticket #7983.
> 
> Signed-off-by: Andreas Rheinhardt 
> ---
> Supersedes
> https://ffmpeg.org/pipermail/ffmpeg-devel/2019-September/250683.html
> 
>  libavcodec/j2kenc.c | 10 +-
>  1 file changed, 5 insertions(+), 5 deletions(-)

will apply

thx

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

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


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

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

Re: [FFmpeg-devel] [PATCH]lavc/mpegvideo_enc: Do not write an extra RST tag after final jpeg slice

2020-01-21 Thread Carl Eugen Hoyos
Am Di., 21. Jan. 2020 um 14:19 Uhr schrieb Michael Niedermayer
:

> >  mjpegenc_common.c |2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 5c76a5298352eb275764526ebe2d7312c98d1c26  
> > 0001-lavc-mjpegenc-Fix-not-writing-RST-tag-after-final-sl.patch
> > From f50caafa55f54a4987a73cccb2b954e3e137781e Mon Sep 17 00:00:00 2001
> > From: Carl Eugen Hoyos 
> > Date: Mon, 20 Jan 2020 23:57:38 +0100
> > Subject: [PATCH] lavc/mjpegenc: Fix not writing RST tag after final slice.
> >
> > Fixes ticket #8412.
> > ---
> >  libavcodec/mjpegenc_common.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/libavcodec/mjpegenc_common.c b/libavcodec/mjpegenc_common.c
> > index 31868c9bed..3038ebde6e 100644
> > --- a/libavcodec/mjpegenc_common.c
> > +++ b/libavcodec/mjpegenc_common.c
> > @@ -573,7 +573,7 @@ int ff_mjpeg_encode_stuffing(MpegEncContext *s)
> >
> >  ff_mjpeg_escape_FF(pbc, s->esc_pos);
> >
> > -if((s->avctx->active_thread_type & FF_THREAD_SLICE) && mb_y < 
> > s->mb_height)
> > +if((s->avctx->active_thread_type & FF_THREAD_SLICE) && mb_y < 
> > s->mb_height - 1)
> >  put_marker(pbc, RST0 + (mb_y&7));
> >  s->esc_pos = put_bits_count(pbc) >> 3;
> >  fail:
>
> LGTM

Patch applied.

Thank you, Carl Eugen
___
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]lavc/mpegvideo_enc: Do not write an extra RST tag after final jpeg slice

2020-01-21 Thread Michael Niedermayer
On Mon, Jan 20, 2020 at 11:59:18PM +0100, Carl Eugen Hoyos wrote:
> Am Mo., 20. Jan. 2020 um 23:34 Uhr schrieb Michael Niedermayer
> :
> >
> > On Mon, Jan 20, 2020 at 11:15:31PM +0100, Carl Eugen Hoyos wrote:
> > > Am Mo., 20. Jan. 2020 um 22:51 Uhr schrieb Michael Niedermayer
> > > :
> > > >
> > > > On Mon, Jan 20, 2020 at 12:54:21AM +0100, Carl Eugen Hoyos wrote:
> > > > > Hi!
> > > > >
> > > > > Attached patch fixes ticket #8412.
> > > > >
> > > > > Please comment, Carl Eugen
> > > >
> > > > >  mpegvideo_enc.c |7 ---
> > > > >  1 file changed, 4 insertions(+), 3 deletions(-)
> > > > > 73d8636d0dba4f02cf1697b622c97945d738f06f  
> > > > > 0001-lavc-mpegvideo_enc-Do-not-write-an-extra-RST-tag-aft.patch
> > > > > From 7f62ffa46f9264c1fc7854def8467816e0173883 Mon Sep 17 00:00:00 2001
> > > > > From: Carl Eugen Hoyos 
> > > > > Date: Mon, 20 Jan 2020 00:51:33 +0100
> > > > > Subject: [PATCH] lavc/mpegvideo_enc: Do not write an extra RST tag 
> > > > > after final
> > > > >  jpeg slice.
> > > > >
> > > > > Fixes ticket #8412.
> > > > > ---
> > > > >  libavcodec/mpegvideo_enc.c | 7 ---
> > > > >  1 file changed, 4 insertions(+), 3 deletions(-)
> > > > >
> > > > > diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c
> > > > > index 96f5b4a666..fc1c46fee7 100644
> > > > > --- a/libavcodec/mpegvideo_enc.c
> > > > > +++ b/libavcodec/mpegvideo_enc.c
> > > > > @@ -3566,8 +3566,9 @@ static void 
> > > > > merge_context_after_me(MpegEncContext *dst, MpegEncContext *src){
> > > > >  MERGE(me.mb_var_sum_temp);
> > > > >  }
> > > > >
> > > > > -static void merge_context_after_encode(MpegEncContext *dst, 
> > > > > MpegEncContext *src){
> > > > > +static void merge_context_after_encode(MpegEncContext *dst, 
> > > > > MpegEncContext *src, int last){
> > > > >  int i;
> > > > > +int put_bits = put_bits_count(>pb) - (src->out_format == 
> > > > > FMT_MJPEG && src->avctx->active_thread_type & FF_THREAD_SLICE && last 
> > > > > ? 32 : 0);
> > > > >
> > > > >  MERGE(dct_count[0]); //note, the other dct vars are not part of 
> > > > > the context
> > > > >  MERGE(dct_count[1]);
> > > > > @@ -3594,7 +3595,7 @@ static void 
> > > > > merge_context_after_encode(MpegEncContext *dst, MpegEncContext *src)
> > > > >
> > > > >  av_assert1(put_bits_count(>pb) % 8 ==0);
> > > > >  av_assert1(put_bits_count(>pb) % 8 ==0);
> > > > > -avpriv_copy_bits(>pb, src->pb.buf, 
> > > > > put_bits_count(>pb));
> > > > > +avpriv_copy_bits(>pb, src->pb.buf, put_bits);
> > > > >  flush_put_bits(>pb);
> > > > >  }
> > > > >
> > > > > @@ -3919,7 +3920,7 @@ static int encode_picture(MpegEncContext *s, 
> > > > > int picture_number)
> > > > >  for(i=1; i > > > >  if (s->pb.buf_end == s->thread_context[i]->pb.buf)
> > > > >  set_put_bits_buffer_size(>pb, 
> > > > > FFMIN(s->thread_context[i]->pb.buf_end - s->pb.buf, INT_MAX/8-32));
> > > > > -merge_context_after_encode(s, s->thread_context[i]);
> > > > > +merge_context_after_encode(s, s->thread_context[i], i == 
> > > > > context_count - 1);
> > > > >  }
> > > > >  emms_c();
> > > > >  return 0;
> > > > > --
> > > > > 2.23.0
> > > >
> > > > this looks a bit unexpected
> > > > is there a reason why the code that writes the RST is not skipped ?
> > >
> > > Sorry if I misunderstand but how would one thread know that it is
> > > the last one and no RST should be written?
> >
> > the thread encoding the last (as in bottom right) MB should be the last
> > slice thread
> 
> New patch attached, I failed to understand the code yesterday.
> 
> Please comment, Carl Eugen

>  mjpegenc_common.c |2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 5c76a5298352eb275764526ebe2d7312c98d1c26  
> 0001-lavc-mjpegenc-Fix-not-writing-RST-tag-after-final-sl.patch
> From f50caafa55f54a4987a73cccb2b954e3e137781e Mon Sep 17 00:00:00 2001
> From: Carl Eugen Hoyos 
> Date: Mon, 20 Jan 2020 23:57:38 +0100
> Subject: [PATCH] lavc/mjpegenc: Fix not writing RST tag after final slice.
> 
> Fixes ticket #8412.
> ---
>  libavcodec/mjpegenc_common.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libavcodec/mjpegenc_common.c b/libavcodec/mjpegenc_common.c
> index 31868c9bed..3038ebde6e 100644
> --- a/libavcodec/mjpegenc_common.c
> +++ b/libavcodec/mjpegenc_common.c
> @@ -573,7 +573,7 @@ int ff_mjpeg_encode_stuffing(MpegEncContext *s)
>  
>  ff_mjpeg_escape_FF(pbc, s->esc_pos);
>  
> -if((s->avctx->active_thread_type & FF_THREAD_SLICE) && mb_y < 
> s->mb_height)
> +if((s->avctx->active_thread_type & FF_THREAD_SLICE) && mb_y < 
> s->mb_height - 1)
>  put_marker(pbc, RST0 + (mb_y&7));
>  s->esc_pos = put_bits_count(pbc) >> 3;
>  fail:

LGTM

thx

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

When the tyrant has disposed of foreign enemies by conquest or treaty, and
there is nothing more to fear from them, then he is always stirring up

Re: [FFmpeg-devel] [PATCH v3 2/2] avformat: add demuxer for argonaut games' ASF format

2020-01-21 Thread Carl Eugen Hoyos
Am Di., 21. Jan. 2020 um 11:09 Uhr schrieb Zane van Iperen
:

> +static int argo_asf_probe(const AVProbeData *p)
> +{
> +int score;
> +ArgoASFFileHeader hdr;
> +
> +av_assert0(AVPROBE_PADDING_SIZE >= ASF_FILE_HEADER_SIZE);
> +
> +argo_asf_parse_file_header(, p->buf);
> +
> +if (hdr.magic != ASF_TAG)
> +return 0;

> +/* If this is huge, then it's very likely not an ASF file. */
> +if (hdr.chunk_offset > INT_MAX)
> +return 1;

Am I correct that this tests only one bit?
This makes sense for many probe functions that can easily
return false positives based on weak heuristics, probe
functions typically return high scores for matching first 32
bits though.

> +score = 0;
> +if (argo_asf_is_known_version())
> +score += (AVPROBE_SCORE_MAX / 2) + 1;

Unusual code style.

> +/* Have only ever seen these with 1 chunk. */
> +if (hdr.num_chunks == 1)
> +score += 10;

Returns 0 for argo files with unknown version and more than
one chunk and 10 for for unknown version and one chunk.

Should be ~25 in both cases, feel free to return a higher
score if all tests pass, I just wanted to simplify the probe
function as testing 32 bit is what is usually done.

Carl Eugen
___
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] libavcodec/qsvenc.c: Set height and width alignment when encoding with mjpeg_qsv

2020-01-21 Thread Jon Cook
From: JonCookCubic 

Currently width_align and height_align are zero when encoding with mjpeg_qsv 
which causes "Error submitting the frame for encoding". This patch sets the 
alignments.

There is a little bit more about the problem here 
http://ffmpeg.org/pipermail/ffmpeg-user/2019-November/046143.html

The following command line shows the problem (output is without the patch 
applied). Input video is not important, any video will do.

$ ./ffmpeg.exe -loglevel debug -y -i C:/Users/jcook/Desktop/sample.avi -c:v  
mjpeg_qsv output.mp4
ffmpeg version N-95883-ga2fbdc6898 Copyright (c) 2000-2019 the FFmpeg developers
  built with Microsoft (R) C/C++ Optimizing Compiler Version 19.16.27031.1 for 
x64
  configuration: --toolchain=msvc --target-os=win64 --arch=x86_64 
--prefix=/ffmpeg --enable-shared --disable-static --enable-yasm --enable-asm 
--enable-libmfx --enable-nonfree
  libavutil  56. 36.101 / 56. 36.101
  libavcodec 58. 62.100 / 58. 62.100
  libavformat58. 35.100 / 58. 35.100
  libavdevice58.  9.101 / 58.  9.101
  libavfilter 7. 67.100 /  7. 67.100
  libswscale  5.  6.100 /  5.  6.100
  libswresample   3.  6.100 /  3.  6.100
Splitting the commandline.
Reading option '-loglevel' ... matched as option 'loglevel' (set logging level) 
with argument 'debug'.
Reading option '-y' ... matched as option 'y' (overwrite output files) with 
argument '1'.
Reading option '-i' ... matched as input url with argument 
'C:/Users/jcook/Desktop/sample.avi'.
Reading option '-c:v' ... matched as option 'c' (codec name) with argument 
'mjpeg_qsv'.
Reading option 'output.mp4' ... matched as output url.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option loglevel (set logging level) with argument debug.
Applying option y (overwrite output files) with argument 1.
Successfully parsed a group of options.
Parsing a group of options: input url C:/Users/jcook/Desktop/sample.avi.
Successfully parsed a group of options.
Opening an input file: C:/Users/jcook/Desktop/sample.avi.
[NULL @ 01E0699F8540] Opening 'C:/Users/jcook/Desktop/sample.avi' for 
reading
[file @ 01E0699D8280] Setting default whitelist 'file,crypto'
[avi @ 01E0699F8540] Format avi probed with size=2048 and score=100
[avi @ 01E0699D86C0] use odml:1
st:1 removing common factor 36 from timebase
[avi @ 01E0699F8540] Before avformat_find_stream_info() pos: 4108 bytes 
read:142280 seeks:5 nb_streams:2
[mpeg4 @ 01E069A0AE00] Format yuv420p chosen by get_format().
[avi @ 01E0699F8540] All info found
[avi @ 01E0699F8540] After avformat_find_stream_info() pos: 16409 bytes 
read:142280 seeks:5 frames:21
Input #0, avi, from 'C:/Users/jcook/Desktop/sample.avi':
  Metadata:
encoder : MEncoder SVN-r33148-4.0.1
  Duration: 00:00:05.56, start: 0.00, bitrate: 540 kb/s
Stream #0:0, 1, 1/25: Video: mpeg4 (Simple Profile), 1 reference frame 
(XVID / 0x44495658), yuv420p(left), 320x240 [SAR 1:1 DAR 4:3], 0/1, 425 kb/s, 
25 fps, 25 tbr, 25 tbn, 25 tbc
Stream #0:1, 20, 32/1225: Audio: mp3 (U[0][0][0] / 0x0055), 44100 Hz, 
stereo, fltp, 100 kb/s
Successfully opened the file.
Parsing a group of options: output url output.mp4.
Applying option c:v (codec name) with argument mjpeg_qsv.
Successfully parsed a group of options.
Opening an output file: output.mp4.
[file @ 01E06B51B9C0] Setting default whitelist 'file,crypto'
Successfully opened the file.
detected 12 logical cores
Stream mapping:
  Stream #0:0 -> #0:0 (mpeg4 (native) -> mjpeg (mjpeg_qsv))
  Stream #0:1 -> #0:1 (mp3 (mp3float) -> aac (native))
Press [q] to stop, [?] for help
cur_dts is invalid st:0 (0) [init:0 i_done:0 finish:0] (this is harmless if it 
occurs once at the start per stream)
[graph_1_in_0_1 @ 01E069A12A40] Setting 'time_base' to value '1/44100'
[graph_1_in_0_1 @ 01E069A12A40] Setting 'sample_rate' to value '44100'
[graph_1_in_0_1 @ 01E069A12A40] Setting 'sample_fmt' to value 'fltp'
[graph_1_in_0_1 @ 01E069A12A40] Setting 'channel_layout' to value '0x3'
[graph_1_in_0_1 @ 01E069A12A40] tb:1/44100 samplefmt:fltp samplerate:44100 
chlayout:0x3
[format_out_0_1 @ 01E069A2F800] Setting 'sample_fmts' to value 'fltp'
[format_out_0_1 @ 01E069A2F800] Setting 'sample_rates' to value 
'96000|88200|64000|48000|44100|32000|24000|22050|16000|12000|11025|8000|7350'
[AVFilterGraph @ 01E069AA7100] query_formats: 4 queried, 9 merged, 0 
already done, 0 delayed
cur_dts is invalid st:0 (0) [init:0 i_done:0 finish:0] (this is harmless if it 
occurs once at the start per stream)
Last message repeated 20 times
[mpeg4 @ 01E069A2EE00] Format yuv420p chosen by get_format().
cur_dts is invalid st:0 (0) [init:0 i_done:0 finish:0] (this is harmless if it 
occurs once at the start per stream)
Last message repeated 28 times
[graph 0 input from stream 0:0 @ 01E069A31640] Setting 'video_size' to 
value '320x240'
[graph 0 input from stream 0:0 @ 01E069A31640] Setting 'pix_fmt' to value 

Re: [FFmpeg-devel] [PATCH] libavcodec/qsvenc.c: Set height and width alignment when using mjpeg_qsv

2020-01-21 Thread Jon Cook
Giving up on how to update the patch. Going to delete this ticket and
create a new one!

Jon

On Tue, 21 Jan 2020 at 12:30, Jon Cook  wrote:

> Updated patch with FrameInfo.Width and Height set as per review comments
>
> Jon
>
> On Tue, 21 Jan 2020 at 11:47, Jon Cook  wrote:
>
>> Hi Zhong,
>>
>> Thanks for your reply.
>>
>> > IMHO If you set the aligned value, FrameInfo.Width/Height shoule
>> > be changed to be:
>> >
>> >q->param.mfx.FrameInfo.Width  = FFALIGN(avctx->width,
>> q->width_align);
>> >q->param.mfx.FrameInfo.Height = FFALIGN(avctx->height,
>> q->height_align);
>>
>> Makes sense. I'll update the patch. This is my first time making changes
>> to the code so forgive any mistakes as I find my way around.
>>
>> > Could you help to provide detail steps (CLI and input video) to
>> > reproduce the issue?
>>
>> The command line I'm using is below along with the output without the
>> changes applied. Input video is not important, any video will do. There is
>> a little bit more about the problem here
>> http://ffmpeg.org/pipermail/ffmpeg-user/2019-November/046143.html
>>
>> Regards,
>> Jon
>>
>> $ ./ffmpeg.exe -loglevel debug -y -i C:/Users/jcook/Desktop/sample.avi
>> -c:v  mjpeg_qsv output.mp4
>> ffmpeg version N-95883-ga2fbdc6898 Copyright (c) 2000-2019 the FFmpeg
>> developers
>>   built with Microsoft (R) C/C++ Optimizing Compiler Version
>> 19.16.27031.1 for x64
>>   configuration: --toolchain=msvc --target-os=win64 --arch=x86_64
>> --prefix=/ffmpeg --enable-shared --disable-static --enable-yasm
>> --enable-asm --enable-libmfx --enable-nonfree
>>   libavutil  56. 36.101 / 56. 36.101
>>   libavcodec 58. 62.100 / 58. 62.100
>>   libavformat58. 35.100 / 58. 35.100
>>   libavdevice58.  9.101 / 58.  9.101
>>   libavfilter 7. 67.100 /  7. 67.100
>>   libswscale  5.  6.100 /  5.  6.100
>>   libswresample   3.  6.100 /  3.  6.100
>> Splitting the commandline.
>> Reading option '-loglevel' ... matched as option 'loglevel' (set logging
>> level) with argument 'debug'.
>> Reading option '-y' ... matched as option 'y' (overwrite output files)
>> with argument '1'.
>> Reading option '-i' ... matched as input url with argument
>> 'C:/Users/jcook/Desktop/sample.avi'.
>> Reading option '-c:v' ... matched as option 'c' (codec name) with
>> argument 'mjpeg_qsv'.
>> Reading option 'output.mp4' ... matched as output url.
>> Finished splitting the commandline.
>> Parsing a group of options: global .
>> Applying option loglevel (set logging level) with argument debug.
>> Applying option y (overwrite output files) with argument 1.
>> Successfully parsed a group of options.
>> Parsing a group of options: input url C:/Users/jcook/Desktop/sample.avi.
>> Successfully parsed a group of options.
>> Opening an input file: C:/Users/jcook/Desktop/sample.avi.
>> [NULL @ 01E0699F8540] Opening 'C:/Users/jcook/Desktop/sample.avi' for
>> reading
>> [file @ 01E0699D8280] Setting default whitelist 'file,crypto'
>> [avi @ 01E0699F8540] Format avi probed with size=2048 and score=100
>> [avi @ 01E0699D86C0] use odml:1
>> st:1 removing common factor 36 from timebase
>> [avi @ 01E0699F8540] Before avformat_find_stream_info() pos: 4108
>> bytes read:142280 seeks:5 nb_streams:2
>> [mpeg4 @ 01E069A0AE00] Format yuv420p chosen by get_format().
>> [avi @ 01E0699F8540] All info found
>> [avi @ 01E0699F8540] After avformat_find_stream_info() pos: 16409
>> bytes read:142280 seeks:5 frames:21
>> Input #0, avi, from 'C:/Users/jcook/Desktop/sample.avi':
>>   Metadata:
>> encoder : MEncoder SVN-r33148-4.0.1
>>   Duration: 00:00:05.56, start: 0.00, bitrate: 540 kb/s
>> Stream #0:0, 1, 1/25: Video: mpeg4 (Simple Profile), 1 reference
>> frame (XVID / 0x44495658), yuv420p(left), 320x240 [SAR 1:1 DAR 4:3], 0/1,
>> 425 kb/s, 25 fps, 25 tbr, 25 tbn, 25 tbc
>> Stream #0:1, 20, 32/1225: Audio: mp3 (U[0][0][0] / 0x0055), 44100 Hz,
>> stereo, fltp, 100 kb/s
>> Successfully opened the file.
>> Parsing a group of options: output url output.mp4.
>> Applying option c:v (codec name) with argument mjpeg_qsv.
>> Successfully parsed a group of options.
>> Opening an output file: output.mp4.
>> [file @ 01E06B51B9C0] Setting default whitelist 'file,crypto'
>> Successfully opened the file.
>> detected 12 logical cores
>> Stream mapping:
>>   Stream #0:0 -> #0:0 (mpeg4 (native) -> mjpeg (mjpeg_qsv))
>>   Stream #0:1 -> #0:1 (mp3 (mp3float) -> aac (native))
>> Press [q] to stop, [?] for help
>> cur_dts is invalid st:0 (0) [init:0 i_done:0 finish:0] (this is harmless
>> if it occurs once at the start per stream)
>> [graph_1_in_0_1 @ 01E069A12A40] Setting 'time_base' to value '1/44100'
>> [graph_1_in_0_1 @ 01E069A12A40] Setting 'sample_rate' to value '44100'
>> [graph_1_in_0_1 @ 01E069A12A40] Setting 'sample_fmt' to value 'fltp'
>> [graph_1_in_0_1 @ 01E069A12A40] Setting 'channel_layout' to value
>> '0x3'
>> [graph_1_in_0_1 @ 01E069A12A40] tb:1/44100 samplefmt:fltp
>> 

Re: [FFmpeg-devel] [PATCH] libavcodec/qsvenc.c: Set height and width alignment when using mjpeg_qsv

2020-01-21 Thread Jon Cook
Updated patch with FrameInfo.Width and Height set as per review comments

Jon

On Tue, 21 Jan 2020 at 11:47, Jon Cook  wrote:

> Hi Zhong,
>
> Thanks for your reply.
>
> > IMHO If you set the aligned value, FrameInfo.Width/Height shoule
> > be changed to be:
> >
> >q->param.mfx.FrameInfo.Width  = FFALIGN(avctx->width, q->width_align);
> >q->param.mfx.FrameInfo.Height = FFALIGN(avctx->height,
> q->height_align);
>
> Makes sense. I'll update the patch. This is my first time making changes
> to the code so forgive any mistakes as I find my way around.
>
> > Could you help to provide detail steps (CLI and input video) to
> > reproduce the issue?
>
> The command line I'm using is below along with the output without the
> changes applied. Input video is not important, any video will do. There is
> a little bit more about the problem here
> http://ffmpeg.org/pipermail/ffmpeg-user/2019-November/046143.html
>
> Regards,
> Jon
>
> $ ./ffmpeg.exe -loglevel debug -y -i C:/Users/jcook/Desktop/sample.avi
> -c:v  mjpeg_qsv output.mp4
> ffmpeg version N-95883-ga2fbdc6898 Copyright (c) 2000-2019 the FFmpeg
> developers
>   built with Microsoft (R) C/C++ Optimizing Compiler Version 19.16.27031.1
> for x64
>   configuration: --toolchain=msvc --target-os=win64 --arch=x86_64
> --prefix=/ffmpeg --enable-shared --disable-static --enable-yasm
> --enable-asm --enable-libmfx --enable-nonfree
>   libavutil  56. 36.101 / 56. 36.101
>   libavcodec 58. 62.100 / 58. 62.100
>   libavformat58. 35.100 / 58. 35.100
>   libavdevice58.  9.101 / 58.  9.101
>   libavfilter 7. 67.100 /  7. 67.100
>   libswscale  5.  6.100 /  5.  6.100
>   libswresample   3.  6.100 /  3.  6.100
> Splitting the commandline.
> Reading option '-loglevel' ... matched as option 'loglevel' (set logging
> level) with argument 'debug'.
> Reading option '-y' ... matched as option 'y' (overwrite output files)
> with argument '1'.
> Reading option '-i' ... matched as input url with argument
> 'C:/Users/jcook/Desktop/sample.avi'.
> Reading option '-c:v' ... matched as option 'c' (codec name) with argument
> 'mjpeg_qsv'.
> Reading option 'output.mp4' ... matched as output url.
> Finished splitting the commandline.
> Parsing a group of options: global .
> Applying option loglevel (set logging level) with argument debug.
> Applying option y (overwrite output files) with argument 1.
> Successfully parsed a group of options.
> Parsing a group of options: input url C:/Users/jcook/Desktop/sample.avi.
> Successfully parsed a group of options.
> Opening an input file: C:/Users/jcook/Desktop/sample.avi.
> [NULL @ 01E0699F8540] Opening 'C:/Users/jcook/Desktop/sample.avi' for
> reading
> [file @ 01E0699D8280] Setting default whitelist 'file,crypto'
> [avi @ 01E0699F8540] Format avi probed with size=2048 and score=100
> [avi @ 01E0699D86C0] use odml:1
> st:1 removing common factor 36 from timebase
> [avi @ 01E0699F8540] Before avformat_find_stream_info() pos: 4108
> bytes read:142280 seeks:5 nb_streams:2
> [mpeg4 @ 01E069A0AE00] Format yuv420p chosen by get_format().
> [avi @ 01E0699F8540] All info found
> [avi @ 01E0699F8540] After avformat_find_stream_info() pos: 16409
> bytes read:142280 seeks:5 frames:21
> Input #0, avi, from 'C:/Users/jcook/Desktop/sample.avi':
>   Metadata:
> encoder : MEncoder SVN-r33148-4.0.1
>   Duration: 00:00:05.56, start: 0.00, bitrate: 540 kb/s
> Stream #0:0, 1, 1/25: Video: mpeg4 (Simple Profile), 1 reference frame
> (XVID / 0x44495658), yuv420p(left), 320x240 [SAR 1:1 DAR 4:3], 0/1, 425
> kb/s, 25 fps, 25 tbr, 25 tbn, 25 tbc
> Stream #0:1, 20, 32/1225: Audio: mp3 (U[0][0][0] / 0x0055), 44100 Hz,
> stereo, fltp, 100 kb/s
> Successfully opened the file.
> Parsing a group of options: output url output.mp4.
> Applying option c:v (codec name) with argument mjpeg_qsv.
> Successfully parsed a group of options.
> Opening an output file: output.mp4.
> [file @ 01E06B51B9C0] Setting default whitelist 'file,crypto'
> Successfully opened the file.
> detected 12 logical cores
> Stream mapping:
>   Stream #0:0 -> #0:0 (mpeg4 (native) -> mjpeg (mjpeg_qsv))
>   Stream #0:1 -> #0:1 (mp3 (mp3float) -> aac (native))
> Press [q] to stop, [?] for help
> cur_dts is invalid st:0 (0) [init:0 i_done:0 finish:0] (this is harmless
> if it occurs once at the start per stream)
> [graph_1_in_0_1 @ 01E069A12A40] Setting 'time_base' to value '1/44100'
> [graph_1_in_0_1 @ 01E069A12A40] Setting 'sample_rate' to value '44100'
> [graph_1_in_0_1 @ 01E069A12A40] Setting 'sample_fmt' to value 'fltp'
> [graph_1_in_0_1 @ 01E069A12A40] Setting 'channel_layout' to value '0x3'
> [graph_1_in_0_1 @ 01E069A12A40] tb:1/44100 samplefmt:fltp
> samplerate:44100 chlayout:0x3
> [format_out_0_1 @ 01E069A2F800] Setting 'sample_fmts' to value 'fltp'
> [format_out_0_1 @ 01E069A2F800] Setting 'sample_rates' to value
> '96000|88200|64000|48000|44100|32000|24000|22050|16000|12000|11025|8000|7350'

[FFmpeg-devel] [PATCH] libavcodec/qsvenc.c: Set height and width alignment when using mjpeg_qsv

2020-01-21 Thread Jon Cook
From: JonCookCubic 

Setting FrameInfo.Width and Height as per review comments

Signed-off-by: JonCookCubic 
---
 libavcodec/qsvenc.c | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c
index 9e416500e9..40904af388 100644
--- a/libavcodec/qsvenc.c
+++ b/libavcodec/qsvenc.c
@@ -470,6 +470,12 @@ static int init_video_param_jpeg(AVCodecContext *avctx, 
QSVEncContext *q)
 q->param.mfx.Quality  = av_clip(avctx->global_quality, 1, 100);
 q->param.mfx.RestartInterval  = 0;
 
+q->width_align = 16;
+q->height_align = 16;
+
+q->param.mfx.FrameInfo.Width = FFALIGN(avctx->width, q->width_align);
+q->param.mfx.FrameInfo.Height = FFALIGN(avctx->height, q->height_align);
+
 return 0;
 }
 
-- 
2.20.1.windows.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] Vulkan hwcontext and filters

2020-01-21 Thread Anton Khirnov
Quoting Lynne (2020-01-10 22:05:21)
> commit d5f1bbc61fab452803443511b1241931169359b7
> Author: Lynne 
> Date:   Wed Aug 28 21:58:10 2019 +0100
> 
>     lavu: add Vulkan hwcontext code
>    
>     This commit adds the necessary code to initialize and use a Vulkan device
>     within the hwcontext libavutil framework.
>     Currently direct mapping to VAAPI and DRM frames is functional, and
>     transfers to CUDA and native frames are supported.
>    
>     Lets hope the future Vulkan video decode extension fits well within this
>     framework.
> 
> /*
>  * This file is part of FFmpeg.
>  *
>  * FFmpeg is free software; you can redistribute it and/or
>  * modify it under the terms of the GNU Lesser General Public
>  * License as published by the Free Software Foundation; either
>  * version 2.1 of the License, or (at your option) any later version.
>  *
>  * FFmpeg is distributed in the hope that it will be useful,
>  * but WITHOUT ANY WARRANTY; without even the implied warranty of
>  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
>  * Lesser General Public License for more details.
>  *
>  * You should have received a copy of the GNU Lesser General Public
>  * License along with FFmpeg; if not, write to the Free Software
>  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 
> USA
>  */
> 
> #ifndef AVUTIL_HWCONTEXT_VULKAN_H
> #define AVUTIL_HWCONTEXT_VULKAN_H
> 
> #include 
> 
> /**
>  * @file
>  * API-specific header for AV_HWDEVICE_TYPE_VULKAN.
>  *
>  * For user-allocated pools, AVHWFramesContext.pool must return AVBufferRefs
>  * with the data pointer set to an AVVkFrame.
>  */
> 
> /**
>  * Main Vulkan context, allocated as AVHWDeviceContext.hwctx.
>  * All of these can be set before init to change what the context uses
>  */
> typedef struct AVVulkanDeviceContext {
> /**
>  * Custom memory allocator, else NULL
>  */
> const VkAllocationCallbacks *alloc;
> /**
>  * Instance
>  */
> VkInstance inst;
> /**
>  * Physical device
>  */
> VkPhysicalDevice phys_dev;
> /**
>  * Activated physical device
>  */
> VkDevice act_dev;

Where is this 'activated' terminology from? From what I can see, the
spec calls this a 'logical' device. Would be nice to be consistent with
it.

> /**
>  * Queue family index for graphics
>  */
> int queue_family_index;

What is this for? I don't see it used anywhere.

> /**
>  * Queue family index for transfer ops only. By default, the priority 
> order
>  * is dedicated transfer > dedicated compute > graphics.
>  */

IIUC the second sentence talks about how the internal device
creation/derivation code works, but that isn't made very clear. Maybe
make it a
@note the av_hwdevice_create() will set those fields like this...

> int queue_family_tx_index;
> /**
>  * Queue family index for compute ops. Will be equal to the graphics
>  * one unless a dedicated transfer queue is found.
>  */
> int queue_family_comp_index;

Same comment as above.

> /**
>  * The UUID of the selected physical device.
>  */
> uint8_t device_uuid[VK_UUID_SIZE];

Do we really need to export this here? It can be queried from phys_dev,
no?

> } AVVulkanDeviceContext;
> 
> /**
>  * Allocated as AVHWFramesContext.hwctx, used to set pool-specific options
>  */
> typedef struct AVVulkanFramesContext {
> /**
>  * Controls the tiling of output frames.
>  */
> VkImageTiling tiling;
> /**
>  * Defines extra usage of output frames. This is bitwise OR'd with the
>  * standard usage flags (SAMPLED, STORAGE, TRANSFER_SRC and TRANSFER_DST).
>  */
> VkImageUsageFlagBits usage;
> /**
>  * Extension data for image creation. By default, if the extension is
>  * available, this will be chained to a VkImageFormatListCreateInfoKHR.
>  */
> void *create_pnext;
> /**
>  * Extension data for memory allocation. Must have as many entries as
>  * the number of planes of the sw_format.
>  * This will be chained to VkExportMemoryAllocateInfo, which is used
>  * to make all pool images exportable to other APIs.
>  */
> void *alloc_pnext[AV_NUM_DATA_POINTERS];
> } AVVulkanFramesContext;
> 
> /*
>  * Frame structure, the VkFormat of the image will always match
>  * the pool's sw_format.
>  * All frames, imported or allocated, will be created with the
>  * VK_IMAGE_CREATE_ALIAS_BIT flag set, so the memory may be aliased if needed.
>  */
> typedef struct AVVkFrame {
> /**
>  * Vulkan images to which the memory is bound to.
>  */
> VkImage img[AV_NUM_DATA_POINTERS];
> 
> /**
>  * Same tiling must be used for all images.
>  */
> VkImageTiling tiling;
> 
> /**
>  * Memory backing the images. Could be less than the amount of images
>  * if importing from a DRM or VAAPI frame.
>  */
> VkDeviceMemory mem[AV_NUM_DATA_POINTERS];
> 

Re: [FFmpeg-devel] [PATCH] libavcodec/qsvenc.c: Set height and width alignment when using mjpeg_qsv

2020-01-21 Thread Jon Cook
Hi Zhong,

Thanks for your reply.

> IMHO If you set the aligned value, FrameInfo.Width/Height shoule
> be changed to be:
>
>q->param.mfx.FrameInfo.Width  = FFALIGN(avctx->width, q->width_align);
>q->param.mfx.FrameInfo.Height = FFALIGN(avctx->height,
q->height_align);

Makes sense. I'll update the patch. This is my first time making changes to
the code so forgive any mistakes as I find my way around.

> Could you help to provide detail steps (CLI and input video) to
> reproduce the issue?

The command line I'm using is below along with the output without the
changes applied. Input video is not important, any video will do. There is
a little bit more about the problem here
http://ffmpeg.org/pipermail/ffmpeg-user/2019-November/046143.html

Regards,
Jon

$ ./ffmpeg.exe -loglevel debug -y -i C:/Users/jcook/Desktop/sample.avi -c:v
 mjpeg_qsv output.mp4
ffmpeg version N-95883-ga2fbdc6898 Copyright (c) 2000-2019 the FFmpeg
developers
  built with Microsoft (R) C/C++ Optimizing Compiler Version 19.16.27031.1
for x64
  configuration: --toolchain=msvc --target-os=win64 --arch=x86_64
--prefix=/ffmpeg --enable-shared --disable-static --enable-yasm
--enable-asm --enable-libmfx --enable-nonfree
  libavutil  56. 36.101 / 56. 36.101
  libavcodec 58. 62.100 / 58. 62.100
  libavformat58. 35.100 / 58. 35.100
  libavdevice58.  9.101 / 58.  9.101
  libavfilter 7. 67.100 /  7. 67.100
  libswscale  5.  6.100 /  5.  6.100
  libswresample   3.  6.100 /  3.  6.100
Splitting the commandline.
Reading option '-loglevel' ... matched as option 'loglevel' (set logging
level) with argument 'debug'.
Reading option '-y' ... matched as option 'y' (overwrite output files) with
argument '1'.
Reading option '-i' ... matched as input url with argument
'C:/Users/jcook/Desktop/sample.avi'.
Reading option '-c:v' ... matched as option 'c' (codec name) with argument '
mjpeg_qsv'.
Reading option 'output.mp4' ... matched as output url.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option loglevel (set logging level) with argument debug.
Applying option y (overwrite output files) with argument 1.
Successfully parsed a group of options.
Parsing a group of options: input url C:/Users/jcook/Desktop/sample.avi.
Successfully parsed a group of options.
Opening an input file: C:/Users/jcook/Desktop/sample.avi.
[NULL @ 01E0699F8540] Opening 'C:/Users/jcook/Desktop/sample.avi' for
reading
[file @ 01E0699D8280] Setting default whitelist 'file,crypto'
[avi @ 01E0699F8540] Format avi probed with size=2048 and score=100
[avi @ 01E0699D86C0] use odml:1
st:1 removing common factor 36 from timebase
[avi @ 01E0699F8540] Before avformat_find_stream_info() pos: 4108 bytes
read:142280 seeks:5 nb_streams:2
[mpeg4 @ 01E069A0AE00] Format yuv420p chosen by get_format().
[avi @ 01E0699F8540] All info found
[avi @ 01E0699F8540] After avformat_find_stream_info() pos: 16409 bytes
read:142280 seeks:5 frames:21
Input #0, avi, from 'C:/Users/jcook/Desktop/sample.avi':
  Metadata:
encoder : MEncoder SVN-r33148-4.0.1
  Duration: 00:00:05.56, start: 0.00, bitrate: 540 kb/s
Stream #0:0, 1, 1/25: Video: mpeg4 (Simple Profile), 1 reference frame
(XVID / 0x44495658), yuv420p(left), 320x240 [SAR 1:1 DAR 4:3], 0/1, 425
kb/s, 25 fps, 25 tbr, 25 tbn, 25 tbc
Stream #0:1, 20, 32/1225: Audio: mp3 (U[0][0][0] / 0x0055), 44100 Hz,
stereo, fltp, 100 kb/s
Successfully opened the file.
Parsing a group of options: output url output.mp4.
Applying option c:v (codec name) with argument mjpeg_qsv.
Successfully parsed a group of options.
Opening an output file: output.mp4.
[file @ 01E06B51B9C0] Setting default whitelist 'file,crypto'
Successfully opened the file.
detected 12 logical cores
Stream mapping:
  Stream #0:0 -> #0:0 (mpeg4 (native) -> mjpeg (mjpeg_qsv))
  Stream #0:1 -> #0:1 (mp3 (mp3float) -> aac (native))
Press [q] to stop, [?] for help
cur_dts is invalid st:0 (0) [init:0 i_done:0 finish:0] (this is harmless if
it occurs once at the start per stream)
[graph_1_in_0_1 @ 01E069A12A40] Setting 'time_base' to value '1/44100'
[graph_1_in_0_1 @ 01E069A12A40] Setting 'sample_rate' to value '44100'
[graph_1_in_0_1 @ 01E069A12A40] Setting 'sample_fmt' to value 'fltp'
[graph_1_in_0_1 @ 01E069A12A40] Setting 'channel_layout' to value '0x3'
[graph_1_in_0_1 @ 01E069A12A40] tb:1/44100 samplefmt:fltp
samplerate:44100 chlayout:0x3
[format_out_0_1 @ 01E069A2F800] Setting 'sample_fmts' to value 'fltp'
[format_out_0_1 @ 01E069A2F800] Setting 'sample_rates' to value
'96000|88200|64000|48000|44100|32000|24000|22050|16000|12000|11025|8000|7350'
[AVFilterGraph @ 01E069AA7100] query_formats: 4 queried, 9 merged, 0
already done, 0 delayed
cur_dts is invalid st:0 (0) [init:0 i_done:0 finish:0] (this is harmless if
it occurs once at the start per stream)
Last message repeated 20 times
[mpeg4 @ 01E069A2EE00] Format yuv420p chosen by get_format().
cur_dts is 

Re: [FFmpeg-devel] [PATCH 1/2] avutil/log: Add av_log_once() for printing a message just once per instance

2020-01-21 Thread Anton Khirnov
Quoting Michael Niedermayer (2020-01-16 17:51:28)
> Compared to ad-hoc if(printed) ... code this allows the user to disable
> it with a flag and see all repeated messages, it is also simpler

That flag is global state - it should be deprecated and removed, not
embedded further into the API.

> 
> TODO: APIChanges & version bump
> 
> Signed-off-by: Michael Niedermayer 
> ---
>  libavutil/log.c | 15 +++
>  libavutil/log.h | 19 +++
>  2 files changed, 34 insertions(+)
> 
> diff --git a/libavutil/log.c b/libavutil/log.c
> index e8a0db7716..7646e18cfa 100644
> --- a/libavutil/log.c
> +++ b/libavutil/log.c
> @@ -372,6 +372,21 @@ void av_log(void* avcl, int level, const char *fmt, ...)
>  va_end(vl);
>  }
>  
> +void av_log_once(void* avcl, int level, int *state, const char *fmt, ...)
> +{
> +if (!((flags & AV_LOG_SKIP_REPEATED) && *state)) {
> +AVClass* avc = avcl ? *(AVClass **) avcl : NULL;
> +va_list vl;
> +va_start(vl, fmt);
> +if (avc && avc->version >= (50 << 16 | 15 << 8 | 2) &&
> +avc->log_level_offset_offset && level >= AV_LOG_FATAL)
> +level += *(int *) (((uint8_t *) avcl) + 
> avc->log_level_offset_offset);

This logic is duplicated with av_log(). Why is this not done in av_vlog
anyway?

> +av_vlog(avcl, level, fmt, vl);
> +va_end(vl);
> +*state = 1;
> +}
> +}
> +
>  void av_vlog(void* avcl, int level, const char *fmt, va_list vl)
>  {
>  void (*log_callback)(void*, int, const char*, va_list) = av_log_callback;
> diff --git a/libavutil/log.h b/libavutil/log.h
> index d9554e609d..618d0d1817 100644
> --- a/libavutil/log.h
> +++ b/libavutil/log.h
> @@ -233,6 +233,25 @@ typedef struct AVClass {
>   */
>  void av_log(void *avcl, int level, const char *fmt, ...) av_printf_format(3, 
> 4);
>  
> +/**
> + * Send the specified message to the log once if the level is less than or 
> equal
> + * to the current av_log_level. By default, all logging messages are sent to
> + * stderr. This behavior can be altered by setting a different logging 
> callback
> + * function.
> + * If AV_LOG_SKIP_REPEATED is set each message (each unique state) will only 
> be
> + * printed once. If its not set then this behaves live av_log()
> + * @see av_log
> + *
> + * @param avcl A pointer to an arbitrary struct of which the first field is a
> + *pointer to an AVClass struct or NULL if general log.
> + * @param level The importance level of the message expressed using a @ref
> + *lavu_log_constants "Logging Constant".
> + * @param fmt The format string (printf-compatible) that specifies how
> + *subsequent arguments are converted to output.
> + * @param state a variable to keep trak of if a message has already been 
> printed
> + *this must be initialized to 0 before the first use.

We should either demand that the caller ensures this does not get called
simultaneously with the same state, or make the above check-and-set
atomic.

-- 
Anton Khirnov
___
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] lavfi/vf_scale_qsv: fix the class_name in help for scale_qsv

2020-01-21 Thread myp...@gmail.com
On Tue, Jan 21, 2020 at 4:51 PM Linjie Fu  wrote:
>
> Class name is used in show_help_children(avfilter_get_class(),...)
> to prompt the available filters.
>
> $ ffmpeg -h full
>
> Before:
> qsvscale AVOptions:
>
> After:
> scale_qsv AVOptions:
>
> Signed-off-by: Linjie Fu 
> ---
>  libavfilter/vf_scale_qsv.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/libavfilter/vf_scale_qsv.c b/libavfilter/vf_scale_qsv.c
> index 1cf5367..d1fa942 100644
> --- a/libavfilter/vf_scale_qsv.c
> +++ b/libavfilter/vf_scale_qsv.c
> @@ -629,7 +629,7 @@ static const AVOption options[] = {
>  };
>
>  static const AVClass qsvscale_class = {
> -.class_name = "qsvscale",
> +.class_name = "scale_qsv",
>  .item_name  = av_default_item_name,
>  .option = options,
>  .version= LIBAVUTIL_VERSION_INT,
> --
> 2.7.4
>
LGTM
___
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] [PATCHv2] Include slot owner in summary hash

2020-01-21 Thread Martin Storsjö

On Tue, 21 Jan 2020, Michael Niedermayer wrote:


On Tue, Jan 21, 2020 at 12:13:42PM +0200, Martin Storsjö wrote:

From: Mans Rullgard 

Signed-off-by: Martin Storsjö 
---
Does this look ok? I removed the [fateserver] disambiguation tag
and added my own Signed-off-by to it.


yes, applied


Thanks!

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

Re: [FFmpeg-devel] [PATCHv2] Include slot owner in summary hash

2020-01-21 Thread Michael Niedermayer
On Tue, Jan 21, 2020 at 12:13:42PM +0200, Martin Storsjö wrote:
> From: Mans Rullgard 
> 
> Signed-off-by: Martin Storsjö 
> ---
> Does this look ok? I removed the [fateserver] disambiguation tag
> and added my own Signed-off-by to it.

yes, applied

thx

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

I know you won't believe me, but the highest form of Human Excellence is
to question oneself and others. -- Socrates


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

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

[FFmpeg-devel] [PATCHv2] Include slot owner in summary hash

2020-01-21 Thread Martin Storsjö
From: Mans Rullgard 

Signed-off-by: Martin Storsjö 
---
Does this look ok? I removed the [fateserver] disambiguation tag
and added my own Signed-off-by to it.
---
 FATE.pm| 14 +-
 report.cgi |  8 +---
 2 files changed, 14 insertions(+), 8 deletions(-)

diff --git a/FATE.pm b/FATE.pm
index 86ffe07..50b5c69 100644
--- a/FATE.pm
+++ b/FATE.pm
@@ -99,6 +99,18 @@ sub split_rec {
 };
 }
 
+sub owner {
+my ($slot) = @_;
+my $owner;
+
+if (open O, "$fatedir/$slot/owner") {
+chomp($owner = );
+close O;
+}
+
+return $owner;
+}
+
 sub load_summary {
 my ($slot, $date) = @_;
 my $repdir = "$fatedir/$slot/$date";
@@ -109,7 +121,7 @@ sub load_summary {
 my $conf = split_config scalar  or return;
 my $st   = split_stats  scalar  or return;
 close S;
-return { %$hdr, %$conf, %$st };
+return { %$hdr, %$conf, %$st, owner => owner $slot };
 }
 
 return if not -f "$repdir/report.xz";
diff --git a/report.cgi b/report.cgi
index 9ae42fd..a980617 100755
--- a/report.cgi
+++ b/report.cgi
@@ -52,12 +52,6 @@ my $ntest = $npass + $nfail;
 my $rep = load_summary $req_slot, $req_time;
 my $lastpass = load_lastpass $req_slot;
 
-my $owner;
-if (open O, "$slotdir/owner") {
-chomp($owner = );
-close O;
-}
-
 # main text
 
 print "Content-type: text/html\r\n";
@@ -100,7 +94,7 @@ trow 'Architecture',  $$conf{arch};
 trow 'Variant',   $$conf{subarch};
 trow 'CPU',   $$conf{cpu};
 trow 'OS',$$conf{os};
-trow 'Owner', $owner if $owner;
+trow 'Owner', $$rep{owner};
 trow 'Compiler',  $$conf{cc};
 trow 'Configuration', '' . $$conf{config} . '';
 trow 'Comment',   $$hdr{comment};
-- 
2.17.1

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

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

[FFmpeg-devel] [PATCH v3 2/2] avformat: add demuxer for argonaut games' ASF format

2020-01-21 Thread Zane van Iperen
Adds support for the custom ASF container used by some Argonaut Games'
games, such as 'Croc! Legend of the Gobbos', and 'Croc 2'.

Can also handle the sample files in:
https://samples.ffmpeg.org/game-formats/brender/part2.zip

Signed-off-by: Zane van Iperen 
---
 Changelog|   1 +
 libavformat/Makefile |   1 +
 libavformat/allformats.c |   1 +
 libavformat/argo_asf.c   | 262 +++
 libavformat/version.h|   4 +-
 5 files changed, 267 insertions(+), 2 deletions(-)
 create mode 100644 libavformat/argo_asf.c

diff --git a/Changelog b/Changelog
index c029d73c72..65ef01c77d 100644
--- a/Changelog
+++ b/Changelog
@@ -31,6 +31,7 @@ version :
 - thistogram filter
 - freezeframes filter
 - Argonaut Games ADPCM decoder
+- Argonaut Games ASF demuxer
 
 
 version 4.2:
diff --git a/libavformat/Makefile b/libavformat/Makefile
index 52f29b1a6d..ba6ea8c4a6 100644
--- a/libavformat/Makefile
+++ b/libavformat/Makefile
@@ -99,6 +99,7 @@ OBJS-$(CONFIG_APTX_MUXER)+= rawenc.o
 OBJS-$(CONFIG_APTX_HD_DEMUXER)   += aptxdec.o rawdec.o
 OBJS-$(CONFIG_APTX_HD_MUXER) += rawenc.o
 OBJS-$(CONFIG_AQTITLE_DEMUXER)   += aqtitledec.o subtitles.o
+OBJS-$(CONFIG_ARGO_ASF_DEMUXER)  += argo_asf.o
 OBJS-$(CONFIG_ASF_DEMUXER)   += asfdec_f.o asf.o asfcrypt.o \
 avlanguage.o
 OBJS-$(CONFIG_ASF_O_DEMUXER) += asfdec_o.o asf.o asfcrypt.o \
diff --git a/libavformat/allformats.c b/libavformat/allformats.c
index ff9bdb906f..fe74a32e47 100644
--- a/libavformat/allformats.c
+++ b/libavformat/allformats.c
@@ -60,6 +60,7 @@ extern AVOutputFormat ff_aptx_muxer;
 extern AVInputFormat  ff_aptx_hd_demuxer;
 extern AVOutputFormat ff_aptx_hd_muxer;
 extern AVInputFormat  ff_aqtitle_demuxer;
+extern AVInputFormat  ff_argo_asf_demuxer;
 extern AVInputFormat  ff_asf_demuxer;
 extern AVOutputFormat ff_asf_muxer;
 extern AVInputFormat  ff_asf_o_demuxer;
diff --git a/libavformat/argo_asf.c b/libavformat/argo_asf.c
new file mode 100644
index 00..fc4845f19e
--- /dev/null
+++ b/libavformat/argo_asf.c
@@ -0,0 +1,262 @@
+/*
+ * Argonaut Games ASF demuxer
+ *
+ * Copyright (C) 2020 Zane van Iperen (z...@zanevaniperen.com)
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+#include "avformat.h"
+#include "internal.h"
+#include "libavutil/intreadwrite.h"
+#include "libavutil/avassert.h"
+
+#define ASF_TAG MKTAG('A', 'S', 'F', '\0')
+#define ASF_FILE_HEADER_SIZE24
+#define ASF_CHUNK_HEADER_SIZE   20
+
+typedef struct ArgoASFFileHeader {
+uint32_tmagic;  /*< Magic Number, {'A', 'S', 'F', '\0'} */
+uint16_tversion_major;  /*< File Major Version. */
+uint16_tversion_minor;  /*< File Minor Version. */
+uint32_tnum_chunks; /*< No. chunks in the file. */
+uint32_tchunk_offset;   /*< Offset to the first chunk from the start 
of the file. */
+int8_t  name[8];/*< Name. */
+} ArgoASFFileHeader;
+
+typedef struct ArgoASFChunkHeader {
+uint32_tnum_blocks; /*< No. blocks in the chunk. */
+uint32_tnum_samples;/*< No. samples per channel in a block. */
+uint32_tunk1;   /*< Unknown */
+uint16_tsample_rate;/*< Sample rate. */
+uint16_tunk2;   /*< Unknown. */
+uint32_tflags;  /*< Stream flags. */
+} ArgoASFChunkHeader;
+
+enum {
+ASF_CF_BITS_PER_SAMPLE  = (1 << 0), /*< 16-bit if set, 8 otherwise.  */
+ASF_CF_STEREO   = (1 << 1), /*< Stereo if set, mono otherwise.   */
+ASF_CF_ALWAYS1_1= (1 << 2), /*< Unknown, always seems to be set. */
+ASF_CF_ALWAYS1_2= (1 << 3), /*< Unknown, always seems to be set. */
+
+ASF_CF_ALWAYS1  = ASF_CF_ALWAYS1_1 | ASF_CF_ALWAYS1_2,
+ASF_CF_ALWAYS0  = ~(ASF_CF_BITS_PER_SAMPLE | ASF_CF_STEREO | 
ASF_CF_ALWAYS1)
+};
+
+typedef struct ArgoASFDemuxContext
+{
+ArgoASFFileHeader   fhdr;
+ArgoASFChunkHeader  ckhdr;
+uint32_tblocks_read;
+} ArgoASFDemuxContext;
+
+static void argo_asf_parse_file_header(ArgoASFFileHeader *hdr, const uint8_t 
*buf)
+{
+hdr->magic  = AV_RL32(buf + 0);
+hdr->version_major  = 

[FFmpeg-devel] [PATCH v3 0/2] Argonaut Games ASF and ADPCM decoding support

2020-01-21 Thread Zane van Iperen
Hi all,

This patchset adds support for the ASF container and ADPCM variant used by
some Argonaut Software games such as 'Croc! Legend of the Gobbos' and 'Croc 2'.

It has been tested against:
  - ANISOUND/*.ASFfrom Croc 1
  - music/*.asf   from Croc 2
  - FIGHT/SOUND/*.ASF from 
https://samples.ffmpeg.org/game-formats/brender/part2.zip

v3: [2][3][4][5]
  - ignore file extension in probe
  - reduce maximum possible probing score to 61
  - returned the stolen empty line
  - move the decoder into adpcm.c with the existing ones
  - formatting fixes

v2: [1]
  - change to use AV_RLxx() instead of relying on #pragma pack()
  - use MKTAG()
  - formatting fixes


[1]: https://ffmpeg.org/pipermail/ffmpeg-devel/2020-January/255986.html
[2]: https://ffmpeg.org/pipermail/ffmpeg-devel/2020-January/256005.html
[3]: https://ffmpeg.org/pipermail/ffmpeg-devel/2020-January/256014.html
[4]: https://ffmpeg.org/pipermail/ffmpeg-devel/2020-January/256021.html
[5]: https://ffmpeg.org/pipermail/ffmpeg-devel/2020-January/256024.html

Zane

Zane van Iperen (2):
  avcodec: add decoder for argonaut games' adpcm codec
  avformat: add demuxer for argonaut games' ASF format

 Changelog|   2 +
 doc/general.texi |   1 +
 libavcodec/Makefile  |   1 +
 libavcodec/adpcm.c   | 152 +++
 libavcodec/allcodecs.c   |   1 +
 libavcodec/avcodec.h |   1 +
 libavcodec/codec_desc.c  |   7 ++
 libavcodec/version.h |   2 +-
 libavformat/Makefile |   1 +
 libavformat/allformats.c |   1 +
 libavformat/argo_asf.c   | 262 +++
 libavformat/version.h|   4 +-
 12 files changed, 432 insertions(+), 3 deletions(-)
 create mode 100644 libavformat/argo_asf.c

-- 
2.17.1


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

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

[FFmpeg-devel] [PATCH v3 1/2] avcodec: add decoder for argonaut games' adpcm codec

2020-01-21 Thread Zane van Iperen
Adds support for the ADPCM variant used by some Argonaut Games' games,
such as 'Croc! Legend of the Gobbos', and 'Croc 2'.

Signed-off-by: Zane van Iperen 
---
 Changelog   |   1 +
 doc/general.texi|   1 +
 libavcodec/Makefile |   1 +
 libavcodec/adpcm.c  | 152 
 libavcodec/allcodecs.c  |   1 +
 libavcodec/avcodec.h|   1 +
 libavcodec/codec_desc.c |   7 ++
 libavcodec/version.h|   2 +-
 8 files changed, 165 insertions(+), 1 deletion(-)

diff --git a/Changelog b/Changelog
index 2ccd2645fc..c029d73c72 100644
--- a/Changelog
+++ b/Changelog
@@ -30,6 +30,7 @@ version :
 - MPEG-H 3D Audio support in mp4
 - thistogram filter
 - freezeframes filter
+- Argonaut Games ADPCM decoder
 
 
 version 4.2:
diff --git a/doc/general.texi b/doc/general.texi
index 4bd4b4f6b9..85db50462c 100644
--- a/doc/general.texi
+++ b/doc/general.texi
@@ -1079,6 +1079,7 @@ following image formats are supported:
 @item ACELP.KELVIN   @tab @tab  X
 @item ADPCM 4X Movie @tab @tab  X
 @item APDCM Yamaha AICA  @tab @tab  X
+@item ADPCM Argonaut Games   @tab @tab  X
 @item ADPCM CDROM XA @tab @tab  X
 @item ADPCM Creative Technology @tab @tab  X
 @tab 16 -> 4, 8 -> 4, 8 -> 3, 8 -> 2
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index c1f35b40d8..a2fbb910a0 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -817,6 +817,7 @@ OBJS-$(CONFIG_ADPCM_ADX_ENCODER)  += adxenc.o adx.o
 OBJS-$(CONFIG_ADPCM_AFC_DECODER)  += adpcm.o adpcm_data.o
 OBJS-$(CONFIG_ADPCM_AGM_DECODER)  += adpcm.o adpcm_data.o
 OBJS-$(CONFIG_ADPCM_AICA_DECODER) += adpcm.o adpcm_data.o
+OBJS-$(CONFIG_ADPCM_ARGO_DECODER) += adpcm.o adpcm_data.o
 OBJS-$(CONFIG_ADPCM_CT_DECODER)   += adpcm.o adpcm_data.o
 OBJS-$(CONFIG_ADPCM_DTK_DECODER)  += adpcm.o adpcm_data.o
 OBJS-$(CONFIG_ADPCM_EA_DECODER)   += adpcm.o adpcm_data.o
diff --git a/libavcodec/adpcm.c b/libavcodec/adpcm.c
index 7b5b3d9698..af9830d9ff 100644
--- a/libavcodec/adpcm.c
+++ b/libavcodec/adpcm.c
@@ -12,6 +12,7 @@
  * EA ADPCM XAS decoder by Peter Ross (pr...@xvid.org)
  * MAXIS EA ADPCM decoder by Robert Marston (rmars...@gmail.com)
  * THP ADPCM decoder by Marco Gerards (mgera...@xs4all.nl)
+ * Argonaut Games ADPCM decoder by Zane van Iperen (z...@zanevaniperen.com)
  *
  * This file is part of FFmpeg.
  *
@@ -148,6 +149,10 @@ static av_cold int adpcm_decode_init(AVCodecContext * 
avctx)
 if (avctx->extradata && avctx->extradata_size >= 2)
 c->vqa_version = AV_RL16(avctx->extradata);
 break;
+case AV_CODEC_ID_ADPCM_ARGO:
+if (avctx->bits_per_coded_sample != 4)
+return AVERROR_INVALIDDATA;
+break;
 default:
 break;
 }
@@ -546,6 +551,118 @@ static void adpcm_swf_decode(AVCodecContext *avctx, const 
uint8_t *buf, int buf_
 }
 }
 
+/*
+ * Argonaut Decoder 1: (prev0 + (s << (c + 2)))
+ */
+static int16_t *adpcm_argo_decoder_1(uint8_t c, int16_t *dst, const uint8_t 
*src,
+ const int16_t *prev_, int nsamples, int 
stride)
+{
+int16_t prev;
+int8_t s;
+
+av_assert0(stride == 0 || stride == 1);
+++stride;
+
+prev = prev_[stride];
+
+c += 2;
+for (int i = 0; i < nsamples / 2; i++, src++) {
+s = (int8_t)((*src & 0xF0u) << 0u);
+*dst = prev = ((prev * (1u << 6u)) + (s * (1u << c))) >> 6;
+dst += stride;
+
+s = (int8_t)((*src & 0x0Fu) << 4u);
+*dst = prev = ((prev * (1u << 6u)) + (s * (1u << c))) >> 6;
+dst += stride;
+}
+
+return dst;
+}
+
+/*
+ * Argonaut Decoder 2: (2 * prev0) - (1 * prev1) + (s << (c + 2))
+ */
+static int16_t *adpcm_argo_decoder_2(uint8_t c, int16_t *dst, const uint8_t 
*src,
+ const int16_t *prev_, int nsamples, int 
stride)
+{
+int16_t cprev[2];
+int8_t s;
+
+av_assert0(stride == 0 || stride == 1);
+++stride;
+
+/* [t-1, t-2] */
+cprev[0] = prev_[stride];
+cprev[1] = prev_[0];
+
+c += 2;
+for (int i = 0; i < nsamples / 2; i++, src++) {
+s = (int8_t)((*src & 0xF0u) << 0u);
+*dst = ((2 * cprev[0] * (1u << 6u)) - (cprev[1] * (1u << 6u)) + (s * 
(1u << c))) >> 6;
+cprev[1] = cprev[0];
+cprev[0] = *dst;
+dst += stride;
+
+s = (int8_t)((*src & 0x0Fu) << 4u);
+*dst = ((2 * cprev[0] * (1u << 6u)) - (cprev[1] * (1u << 6u)) + (s * 
(1u << c))) >> 6;
+cprev[1] = cprev[0];
+cprev[0] = *dst;
+dst += stride;
+}
+
+return dst;
+}
+
+/**
+ * Decode a block of Argonaut ADPCM samples.
+ *
+ * The format of each block:
+ *   uint8_t left_control;
+ *   uint4_t left_samples[];
+ *    and if stereo 
+ *   uint8_t right_control;
+ *   uint4_t right_samples[];
+ *
+ * Format of the control byte:
+ * MSB [DRRR] LSB
+ *   S = (Shift Amount - 2)
+ *   D = 

Re: [FFmpeg-devel] [PATCH] [fateserver] Include slot owner in summary hash

2020-01-21 Thread Michael Niedermayer
On Mon, Jan 20, 2020 at 09:46:16PM +0200, Martin Storsjo wrote:
> From: Mans Rullgard 
> 
> ---
> I think this should allow filtering on the owner by doing
> /index.cgi?query=owner:, but as I don't have access to the
> actual fate server, I'd appreciate if someone could try it out.
> ---
>  FATE.pm| 14 +-
>  report.cgi |  8 +---
>  2 files changed, 14 insertions(+), 8 deletions(-)

seems working
can you provide a patch with proper commit message and a 
sign-off / reviewed-by or something like that ? (iam no perl programmer
so i would not trust myself in reviewing this if i can avoid it)
with that ill push to https://git.ffmpeg.org/fateserver

Thanks


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

The educated differ from the uneducated as much as the living from the
dead. -- Aristotle 


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] lavc/pthread_frame: Update user context in ff_frame_thread_free

2020-01-21 Thread Fu, Linjie
Hi,
> -Original Message-
> From: ffmpeg-devel  On Behalf Of Fu,
> Linjie
> Sent: Monday, January 6, 2020 17:24
> To: FFmpeg development discussions and patches  de...@ffmpeg.org>
> Subject: Re: [FFmpeg-devel] [PATCH] lavc/pthread_frame: Update user
> context in ff_frame_thread_free
> 
> Hi,
> 
> > -Original Message-
> > From: ffmpeg-devel  On Behalf Of
> Fu,
> > Linjie
> > Sent: Monday, December 30, 2019 09:45
> > To: ffmpeg-devel@ffmpeg.org
> > Subject: Re: [FFmpeg-devel] [PATCH] lavc/pthread_frame: Update user
> > context in ff_frame_thread_free
> >
> > Hi,
> >
> > > -Original Message-
> > > From: Fu, Linjie 
> > > Sent: Friday, December 27, 2019 16:48
> > > To: ffmpeg-devel@ffmpeg.org
> > > Cc: Fu, Linjie 
> > > Subject: [PATCH] lavc/pthread_frame: Update user context in
> > > ff_frame_thread_free
> > >
> > > Resolution/format changes lead to re-initialization of hardware
> > > accelerations(vaapi/dxva2/..) with new hwaccel_priv_data in
> > > the worker-thread. But hwaccel_priv_data in user context won't
> > > be updated until the resolution changing frame is output.
> > >
> > > A termination with "-vframes" just after the reinit will lead to:
> > > 1. memory leak in worker-thread.
> > > 2. double free in user-thread.
> > >
> > > Update user context in ff_frame_thread_free with the last thread
> > > submit_packet() was called on.
> > >
> > > To reproduce:
> > > ffmpeg -hwaccel vaapi(dxva2) -v verbose -i
> > > fate-suite/h264/reinit-large_420_8-to-small_420_8.h264 -pix_fmt nv12
> > > -f rawvideo -vsync passthrough -vframes 47 -y out.yuv
> > >
> > > Signed-off-by: Linjie Fu 
> > > ---
> > >  libavcodec/pthread_frame.c | 7 +++
> > >  1 file changed, 7 insertions(+)
> > >
> > > diff --git a/libavcodec/pthread_frame.c b/libavcodec/pthread_frame.c
> > > index 36ac0ac..8bdd735 100644
> > > --- a/libavcodec/pthread_frame.c
> > > +++ b/libavcodec/pthread_frame.c
> > > @@ -657,6 +657,13 @@ void ff_frame_thread_free(AVCodecContext
> > *avctx,
> > > int thread_count)
> > >
> > >  park_frame_worker_threads(fctx, thread_count);
> > >
> > > +if (fctx->prev_thread && avctx->internal->hwaccel_priv_data !=
> > > + 
> > > fctx->prev_thread->avctx->internal->hwaccel_priv_data)
> {
> > > +if (update_context_from_thread(avctx, fctx->prev_thread->avctx,
> 1)
> > <
> > > 0) {
> > > +av_log(avctx, AV_LOG_ERROR, "Failed to update user 
> > > thread.\n");
> > > +}
> > > +}
> > > +
> > >  if (fctx->prev_thread && fctx->prev_thread != fctx->threads)
> > >  if (update_context_from_thread(fctx->threads->avctx, fctx-
> > > >prev_thread->avctx, 0) < 0) {
> > >  av_log(avctx, AV_LOG_ERROR, "Final thread update failed\n");
> > > --
> > > 2.7.4
> >
> > Ping.
> > This patch helps to fix the decoding crashes.
> >
> 
> Ping.
> 
Ping.
___
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 V8 1/2] libswscale/x86/yuv2rgb: Change inline assembly into nasm code

2020-01-21 Thread Michael Niedermayer
On Sun, Jan 19, 2020 at 11:51:03AM +0800, Ting Fu wrote:
> The original inline assembly and nasm code have the same fps when called by 
> command.
> NASM code almost has no impact on the perfromance.
> 
> Signed-off-by: Ting Fu 
> ---
> V8:
> Remove all reindention to make review easier.
> Fix some improper indention.
> Reserve the "inline" for next patch.
> 
>  libswscale/x86/Makefile   |   1 +
>  libswscale/x86/swscale.c  |  16 +-
>  libswscale/x86/yuv2rgb.c  |  26 +-
>  libswscale/x86/yuv2rgb_template.c | 392 +-
>  libswscale/x86/yuv_2_rgb.asm  | 270 
>  5 files changed, 351 insertions(+), 354 deletions(-)
>  create mode 100644 libswscale/x86/yuv_2_rgb.asm

Seems to work, i intend to apply this in a few days

thx

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

I do not agree with what you have to say, but I'll defend to the death your
right to say it. -- Voltaire


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 v3] avcodec/adpcm: Fix undefined left shifts of negative numbers

2020-01-21 Thread Michael Niedermayer
On Mon, Jan 20, 2020 at 04:56:55PM +0100, Andreas Rheinhardt wrote:
> Affected the adpcm-afc, adpcm-ea-1, adpcm-ea-2, adpcm-ea-maxis-xa,
> adpcm-thp and ea-cdata FATE-tests. Also fixes ticket #8487.
> 
> Signed-off-by: Andreas Rheinhardt 
> ---
>  libavcodec/adpcm.c | 16 
>  1 file changed, 8 insertions(+), 8 deletions(-)

will apply

thx

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

I do not agree with what you have to say, but I'll defend to the death your
right to say it. -- Voltaire


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 1/2] avcodec/adxenc: Avoid undefined left shift of negative numbers

2020-01-21 Thread Michael Niedermayer
On Mon, Jan 20, 2020 at 08:20:42PM +0100, Andreas Rheinhardt wrote:
> Replace "((a << shift) + b) >> shift" by "a + (b >> shift)". This avoids
> a left shift which also happens to trigger undefined behaviour in case "a"
> is negative. This affected the FATE-tests acodec-adpcm-adx and
> acodec-adpcm-adx-trellis; it also fixes ticket #8008.
> 
> Signed-off-by: Andreas Rheinhardt 
> ---
> The equivalence of the old code and the new code in the first two
> changes is clear from the type of wav[i] (int16_t) and the fact that
> COEFF_BITS is 12 (i.e. no high bits are lost when left shifting); for
> the last change the equivalence depends upon scale being representable
> in an uint16_t. I don't know whether this is indeed so (the direct
> estimate gives an upper bound of (2^19 + 2^15 + 1) / 7), but it better
> should be so because scale is written via AV_WB16. Maybe it should be
> clipped if it is outside of this range?
> 
>  libavcodec/adxenc.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)

will apply patchset

thx

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

The misfortune of the wise is better than the prosperity of the fool.
-- Epicurus


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

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

[FFmpeg-devel] [PATCH] lavfi/vf_scale_qsv: fix the class_name in help for scale_qsv

2020-01-21 Thread Linjie Fu
Class name is used in show_help_children(avfilter_get_class(),...)
to prompt the available filters.

$ ffmpeg -h full

Before:
qsvscale AVOptions:

After:
scale_qsv AVOptions:

Signed-off-by: Linjie Fu 
---
 libavfilter/vf_scale_qsv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavfilter/vf_scale_qsv.c b/libavfilter/vf_scale_qsv.c
index 1cf5367..d1fa942 100644
--- a/libavfilter/vf_scale_qsv.c
+++ b/libavfilter/vf_scale_qsv.c
@@ -629,7 +629,7 @@ static const AVOption options[] = {
 };
 
 static const AVClass qsvscale_class = {
-.class_name = "qsvscale",
+.class_name = "scale_qsv",
 .item_name  = av_default_item_name,
 .option = options,
 .version= LIBAVUTIL_VERSION_INT,
-- 
2.7.4

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

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

[FFmpeg-devel] [PATCH] lavfi/qsvvpp: check return value for av_frame_copy_props

2020-01-21 Thread Linjie Fu
Signed-off-by: Linjie Fu 
---
 libavfilter/qsvvpp.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/libavfilter/qsvvpp.c b/libavfilter/qsvvpp.c
index 8d5ff2e..0006f48 100644
--- a/libavfilter/qsvvpp.c
+++ b/libavfilter/qsvvpp.c
@@ -311,12 +311,11 @@ static QSVFrame *submit_frame(QSVVPPContext *s, 
AVFilterLink *inlink, AVFrame *p
 qsv_frame->frame->width   = picref->width;
 qsv_frame->frame->height  = picref->height;
 
-if (av_frame_copy(qsv_frame->frame, picref) < 0) {
+if (av_frame_copy(qsv_frame->frame, picref) < 0 ||
+av_frame_copy_props(qsv_frame->frame, picref) < 0) {
 av_frame_free(_frame->frame);
 return NULL;
 }
-
-av_frame_copy_props(qsv_frame->frame, picref);
 } else
 qsv_frame->frame = av_frame_clone(picref);
 
-- 
2.7.4

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

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

[FFmpeg-devel] [PATCH] lavc/qsv: refine return value check for MFXQueryIMPL

2020-01-21 Thread Linjie Fu
Signed-off-by: Linjie Fu 
---
 libavcodec/qsv.c | 7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/libavcodec/qsv.c b/libavcodec/qsv.c
index db98c75..563b780 100644
--- a/libavcodec/qsv.c
+++ b/libavcodec/qsv.c
@@ -391,7 +391,10 @@ int ff_qsv_init_internal_session(AVCodecContext *avctx, 
QSVSession *qs,
 return ret;
 }
 
-MFXQueryIMPL(qs->session, );
+ret = MFXQueryIMPL(qs->session, );
+if (ret < 0)
+return ff_qsv_print_error(avctx, ret,
+  "Error querying the session attributes");
 
 switch (MFX_IMPL_BASETYPE(impl)) {
 case MFX_IMPL_SOFTWARE:
@@ -691,7 +694,7 @@ int ff_qsv_init_session_device(AVCodecContext *avctx, 
mfxSession *psession,
 err = MFXQueryIMPL(parent_session, );
 if (err == MFX_ERR_NONE)
 err = MFXQueryVersion(parent_session, );
-if (err != MFX_ERR_NONE)
+else
 return ff_qsv_print_error(avctx, err,
   "Error querying the session attributes");
 
-- 
2.7.4

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

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

[FFmpeg-devel] [PATCH] lavc/qsvenc: add NULL pointer check for frame before use

2020-01-21 Thread Linjie Fu
Null Frame would be sent to MSDK to flush the encoder, hence add
a NULL check before using frame->interlaced_frame to prevent the
potential crash, regardless of the return value of
MFXVideoENCODE_EncodeFrameAsync().

Signed-off-by: Linjie Fu 
---
 libavcodec/qsvenc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c
index 9e41650..2dfe107 100644
--- a/libavcodec/qsvenc.c
+++ b/libavcodec/qsvenc.c
@@ -1481,7 +1481,7 @@ static int encode_frame(AVCodecContext *avctx, 
QSVEncContext *q,
0 : ff_qsv_print_error(avctx, ret, "Error during encoding");
 }
 
-if (ret == MFX_WRN_INCOMPATIBLE_VIDEO_PARAM && frame->interlaced_frame)
+if (ret == MFX_WRN_INCOMPATIBLE_VIDEO_PARAM && frame && 
frame->interlaced_frame)
 print_interlace_msg(avctx, q);
 
 if (*sync) {
-- 
2.7.4

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

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

[FFmpeg-devel] [PATCH] lavfi/vf_scale_qsv: add extra_hw_frames support

2020-01-21 Thread Linjie Fu
While using scale_qsv together with lookahead, extra_hw_frames is
required to allocate enough memory.

Fix #8379.

Signed-off-by: Linjie Fu 
---
 libavfilter/vf_scale_qsv.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavfilter/vf_scale_qsv.c b/libavfilter/vf_scale_qsv.c
index 1cf5367..784414a 100644
--- a/libavfilter/vf_scale_qsv.c
+++ b/libavfilter/vf_scale_qsv.c
@@ -205,6 +205,8 @@ static int init_out_pool(AVFilterContext *ctx,
 out_frames_ctx->height= FFALIGN(out_height, 16);
 out_frames_ctx->sw_format = out_format;
 out_frames_ctx->initial_pool_size = 4;
+if (ctx->extra_hw_frames > 0)
+out_frames_ctx->initial_pool_size += ctx->extra_hw_frames;
 
 out_frames_hwctx->frame_type = in_frames_hwctx->frame_type;
 
-- 
2.7.4

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

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