Re: [FFmpeg-devel] [PATCH] ffmpeg: correct units for raw pts in -progress report

2018-08-25 Thread Gyan Doshi

On 09-08-2018 10:09 AM, Gyan Doshi wrote:



On 08-08-2018 12:47 AM, Nicolas George wrote:

Gyan Doshi (2018-08-08):

That will just defer the breaking change.


That will leave people time to notice the change and allow old and new
scripts to work during the transition.


Will do it this way.


Revised patch attached.

Gyan
From 397591ae236cd19f2c50772ea8f7288b80705c89 Mon Sep 17 00:00:00 2001
From: Gyan Doshi 
Date: Sun, 5 Aug 2018 12:34:21 +0530
Subject: [PATCH] ffmpeg: add correct field for raw pts in -progress report

PTS is in microseconds, so correct field name is out_time_us.

Old field out_time_ms kept for now - will be removed after a suitable transition
period.

Fixes #7345
---
 fftools/ffmpeg.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
index 2459374f08..934dc71a74 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -1794,9 +1794,11 @@ static void print_report(int is_last_report, int64_t 
timer_start, int64_t cur_ti
 if (total_size < 0) av_bprintf(&buf_script, "total_size=N/A\n");
 elseav_bprintf(&buf_script, "total_size=%"PRId64"\n", 
total_size);
 if (pts == AV_NOPTS_VALUE) {
+av_bprintf(&buf_script, "out_time_us=N/A\n");
 av_bprintf(&buf_script, "out_time_ms=N/A\n");
 av_bprintf(&buf_script, "out_time=N/A\n");
 } else {
+av_bprintf(&buf_script, "out_time_us=%"PRId64"\n", pts);
 av_bprintf(&buf_script, "out_time_ms=%"PRId64"\n", pts);
 av_bprintf(&buf_script, "out_time=%s%02d:%02d:%02d.%06d\n",
hours_sign, hours, mins, secs, us);
-- 
2.18.0___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH 1/2] avcodec/indeo4: Check dimensions in decode_pic_hdr()

2018-08-25 Thread Michael Niedermayer
Fixes: Timeout
Fixes: 
9654/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_INDEO4_fuzzer-6289863463665664

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

diff --git a/libavcodec/indeo4.c b/libavcodec/indeo4.c
index 15ad6f8afc..4bfc6cdd74 100644
--- a/libavcodec/indeo4.c
+++ b/libavcodec/indeo4.c
@@ -30,6 +30,7 @@
 #define BITSTREAM_READER_LE
 #include "avcodec.h"
 #include "get_bits.h"
+#include "libavutil/imgutils.h"
 #include "indeo4data.h"
 #include "internal.h"
 #include "ivi.h"
@@ -178,6 +179,13 @@ static int decode_pic_hdr(IVI45DecContext *ctx, 
AVCodecContext *avctx)
 pic_conf.chroma_bands = 0;
 if (pic_conf.luma_bands)
 pic_conf.chroma_bands = decode_plane_subdivision(&ctx->gb);
+
+if (av_image_check_size2(pic_conf.pic_width, pic_conf.pic_height, 
avctx->max_pixels, AV_PIX_FMT_YUV410P, 0, avctx) < 0) {
+av_log(avctx, AV_LOG_ERROR, "picture dimensions %d %d cannot be 
decoded\n",
+   pic_conf.pic_width, pic_conf.pic_height);
+return AVERROR_INVALIDDATA;
+}
+
 ctx->is_scalable = pic_conf.luma_bands != 1 || pic_conf.chroma_bands != 1;
 if (ctx->is_scalable && (pic_conf.luma_bands != 4 || pic_conf.chroma_bands 
!= 1)) {
 av_log(avctx, AV_LOG_ERROR, "Scalability: unsupported subdivision! 
Luma bands: %d, chroma bands: %d\n",
-- 
2.18.0

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


[FFmpeg-devel] [PATCH 2/2] avcodec/ra144: Fix undefined integer overflow in add_wav()

2018-08-25 Thread Michael Niedermayer
Fixes: signed integer overflow: -26884 * 91439 cannot be represented in type 
'int'
Fixes: 
9687/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_RA_144_fuzzer-4995588121690112

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

diff --git a/libavcodec/ra144.c b/libavcodec/ra144.c
index cf8127c236..573703d70b 100644
--- a/libavcodec/ra144.c
+++ b/libavcodec/ra144.c
@@ -1516,7 +1516,7 @@ static void add_wav(int16_t *dest, int n, int skip_first, 
int *m,
 
 if (v[0]) {
 for (i=0; i < BLOCKSIZE; i++)
-dest[i] = (s1[i]*v[0] + s2[i]*v[1] + s3[i]*v[2]) >> 12;
+dest[i] = ((int)(s1[i]*(unsigned)v[0]) + s2[i]*v[1] + s3[i]*v[2]) 
>> 12;
 } else {
 for (i=0; i < BLOCKSIZE; i++)
 dest[i] = ( s2[i]*v[1] + s3[i]*v[2]) >> 12;
-- 
2.18.0

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


[FFmpeg-devel] [PATCH] ffplay: do not drain existing filters when seeking

2018-08-25 Thread Marton Balint
After a seek we drop all frames from the filter anyway. Audio filters already
had a similar approach.

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

diff --git a/fftools/ffplay.c b/fftools/ffplay.c
index 368e262123..5d9121e5b7 100644
--- a/fftools/ffplay.c
+++ b/fftools/ffplay.c
@@ -2211,6 +2211,8 @@ static int video_thread(void *arg)
 ret = queue_picture(is, frame, pts, duration, frame->pkt_pos, 
is->viddec.pkt_serial);
 av_frame_unref(frame);
 #if CONFIG_AVFILTER
+if (is->videoq.serial != is->viddec.pkt_serial)
+break;
 }
 #endif
 
-- 
2.16.4

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


[FFmpeg-devel] [PATCH] lavd/v4l2: skip buffers not matching frame_size

2018-08-25 Thread Stephan Hilb
By adopting the same behaviour as if there was corrupted data in the
buffer (see the check for V4L2_BUF_FLAG_ERROR) the resulting rawvideo
now at least contains valid data (the previous frame being duplicated).
Fixes video capturing for some stk1160 devices.
---
 libavdevice/v4l2.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/libavdevice/v4l2.c b/libavdevice/v4l2.c
index 10a0ff0dd6..ab903bbcee 100644
--- a/libavdevice/v4l2.c
+++ b/libavdevice/v4l2.c
@@ -534,11 +534,10 @@ static int mmap_read_frame(AVFormatContext *ctx, AVPacket 
*pkt)
 s->frame_size = buf.bytesused;
 
 if (s->frame_size > 0 && buf.bytesused != s->frame_size) {
-av_log(ctx, AV_LOG_ERROR,
+av_log(ctx, AV_LOG_WARNING,
"Dequeued v4l2 buffer contains %d bytes, but %d were 
expected. Flags: 0x%08X.\n",
buf.bytesused, s->frame_size, buf.flags);
-enqueue_buffer(s, &buf);
-return AVERROR_INVALIDDATA;
+buf.bytesused = 0;
 }
 }
 
-- 
2.18.0

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


Re: [FFmpeg-devel] [PATCH 3/3] configure: speedup x2-x8

2018-08-25 Thread Michael Niedermayer
On Sat, Aug 25, 2018 at 06:11:10PM +, avih wrote:
> For overview see:
> http://ffmpeg.org/pipermail/ffmpeg-devel/2018-August/233665.html
> 
> Attached is patch 3/3 which was at "main.patch" of that message.
> 
> After the previous speedups, configure spent 20-60% of its runtime
> at check_deps(). It's particularly slow with bash. After some local
> optimizations - mainly avoid pushvar/popvar and abort early in one
> notable case (empty deps), it's now x4-x25 faster.
> 

patches 1-3 work here fine on linux x86-64 / 32, arm, mips, wine+mingw32/64

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

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


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


Re: [FFmpeg-devel] [PATCH 1/3 v2] configure: speedup x2-x8

2018-08-25 Thread Michael Niedermayer
On Sat, Aug 25, 2018 at 06:42:48PM +, avih wrote:
> It turns out the the output order of "unique()" was important, andfailing to 
> keep the original order (where it keeps the last instanceof recurring items) 
> caused some linkage failures.
> 
> This Patch 1/3 v2 squashes opt1-reorder-unique.patch onto the originalpatch 
> 1/3, and updates the commit message accordingly.
> It fixes the linkage failures mentioned 
> at:http://ffmpeg.org/pipermail/ffmpeg-devel/2018-August/233674.html

confirmed, thanks for the quick fix

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

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


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


Re: [FFmpeg-devel] [PATCH] avfilter/f_cue: add cue and acue filters

2018-08-25 Thread Marton Balint



On Sat, 25 Aug 2018, Nicolas George wrote:


Marton Balint (2018-08-25):

+FFFrameQueue queue;


There is already a frame queue in the link, it would be much better to
use it rather than having a second one. For that, you need to use a
"activate" callback instead of filter_frame, the working is mostly the
same for simple filters like that.


I am already using activate. I have no idea how to access the inlink fifo 
to get the timestamp of the first and last frame in it.


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


[FFmpeg-devel] [PATCH 2/2] avcodec: add WinCAM Motion Video decoder

2018-08-25 Thread Paul B Mahol
Signed-off-by: Paul B Mahol 
---
 configure   |   1 +
 libavcodec/Makefile |   1 +
 libavcodec/allcodecs.c  |   1 +
 libavcodec/avcodec.h|   1 +
 libavcodec/codec_desc.c |   7 ++
 libavcodec/wcmv.c   | 247 
 libavformat/riff.c  |   1 +
 7 files changed, 259 insertions(+)
 create mode 100644 libavcodec/wcmv.c

diff --git a/configure b/configure
index 0c1f6a79a7..469797935e 100755
--- a/configure
+++ b/configure
@@ -2750,6 +2750,7 @@ vp6f_decoder_select="vp6_decoder"
 vp7_decoder_select="h264pred videodsp vp8dsp"
 vp8_decoder_select="h264pred videodsp vp8dsp"
 vp9_decoder_select="videodsp vp9_parser vp9_superframe_split_bsf"
+wcmv_decoder_deps="zlib"
 webp_decoder_select="vp8_decoder exif"
 wmalossless_decoder_select="llauddsp"
 wmapro_decoder_select="mdct sinewin wma_freqs"
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index aee4f5431a..f8673f0121 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -677,6 +677,7 @@ OBJS-$(CONFIG_VP9_V4L2M2M_DECODER) += v4l2_m2m_dec.o
 OBJS-$(CONFIG_VQA_DECODER) += vqavideo.o
 OBJS-$(CONFIG_WAVPACK_DECODER) += wavpack.o
 OBJS-$(CONFIG_WAVPACK_ENCODER) += wavpackenc.o
+OBJS-$(CONFIG_WCMV_DECODER)+= wcmv.o
 OBJS-$(CONFIG_WEBP_DECODER)+= webp.o
 OBJS-$(CONFIG_WEBVTT_DECODER)  += webvttdec.o ass.o
 OBJS-$(CONFIG_WEBVTT_ENCODER)  += webvttenc.o ass_split.o
diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
index d41868c591..42d98f9b0a 100644
--- a/libavcodec/allcodecs.c
+++ b/libavcodec/allcodecs.c
@@ -338,6 +338,7 @@ extern AVCodec ff_vp9_v4l2m2m_decoder;
 extern AVCodec ff_vqa_decoder;
 extern AVCodec ff_bitpacked_decoder;
 extern AVCodec ff_webp_decoder;
+extern AVCodec ff_wcmv_decoder;
 extern AVCodec ff_wrapped_avframe_encoder;
 extern AVCodec ff_wrapped_avframe_decoder;
 extern AVCodec ff_wmv1_encoder;
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index be41b8cf0e..b6688b7af3 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -450,6 +450,7 @@ enum AVCodecID {
 AV_CODEC_ID_IMM4,
 AV_CODEC_ID_PROSUMER,
 AV_CODEC_ID_MWSC,
+AV_CODEC_ID_WCMV,
 
 /* various PCM "codecs" */
 AV_CODEC_ID_FIRST_AUDIO = 0x1, ///< A dummy id pointing at the 
start of audio codecs
diff --git a/libavcodec/codec_desc.c b/libavcodec/codec_desc.c
index 129d0f1aac..46dfe3f5e5 100644
--- a/libavcodec/codec_desc.c
+++ b/libavcodec/codec_desc.c
@@ -1675,6 +1675,13 @@ static const AVCodecDescriptor codec_descriptors[] = {
 .long_name = NULL_IF_CONFIG_SMALL("MatchWare Screen Capture Codec"),
 .props = AV_CODEC_PROP_LOSSLESS,
 },
+{
+.id= AV_CODEC_ID_WCMV,
+.type  = AVMEDIA_TYPE_VIDEO,
+.name  = "wcmv",
+.long_name = NULL_IF_CONFIG_SMALL("WinCAM Motion Video"),
+.props = AV_CODEC_PROP_LOSSLESS,
+},
 
 /* various PCM "codecs" */
 {
diff --git a/libavcodec/wcmv.c b/libavcodec/wcmv.c
new file mode 100644
index 00..74cb1166bb
--- /dev/null
+++ b/libavcodec/wcmv.c
@@ -0,0 +1,247 @@
+/*
+ * WinCAM Motion Video decoder
+ *
+ * Copyright (c) 2018 Paul B Mahol
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include 
+#include 
+#include 
+
+#include "avcodec.h"
+#include "bytestream.h"
+#include "internal.h"
+
+#include 
+
+typedef struct WCMVContext {
+z_streamzstream;
+AVFrame*prev_frame;
+uint8_t block_data[65536*8];
+} WCMVContext;
+
+static int decode_frame(AVCodecContext *avctx,
+void *data, int *got_frame,
+AVPacket *avpkt)
+{
+WCMVContext *s = avctx->priv_data;
+AVFrame *frame = data;
+int skip, blocks, zret, ret, intra = 0;
+GetByteContext gb;
+uint8_t *dst;
+
+ret = inflateReset(&s->zstream);
+if (ret != Z_OK) {
+av_log(avctx, AV_LOG_ERROR, "Inflate reset error: %d\n", ret);
+return AVERROR_EXTERNAL;
+}
+
+bytestream2_init(&gb, avpkt->data, avpkt->size);
+
+if ((ret = ff_get_buffer(avctx, frame, AV_GET_BUFFER_FLAG_REF)) < 0)
+return ret;
+
+if (s->prev_frame->data[0]) {
+ret = av_frame_copy(frame, s->prev_frame);
+

[FFmpeg-devel] [PATCH 1/2] avcodec: add MatchWare Screen Capture Codec

2018-08-25 Thread Paul B Mahol
Signed-off-by: Paul B Mahol 
---
 configure   |   1 +
 libavcodec/Makefile |   1 +
 libavcodec/allcodecs.c  |   1 +
 libavcodec/avcodec.h|   1 +
 libavcodec/codec_desc.c |   7 ++
 libavcodec/mwsc.c   | 192 
 libavformat/riff.c  |   1 +
 7 files changed, 204 insertions(+)
 create mode 100644 libavcodec/mwsc.c

diff --git a/configure b/configure
index b9c9d0b307..0c1f6a79a7 100755
--- a/configure
+++ b/configure
@@ -2679,6 +2679,7 @@ msmpeg4v3_decoder_select="h263_decoder"
 msmpeg4v3_encoder_select="h263_encoder"
 mss2_decoder_select="mpegvideo qpeldsp vc1_decoder"
 mts2_decoder_select="mss34dsp"
+mwsc_decoder_deps="zlib"
 mxpeg_decoder_select="mjpeg_decoder"
 nellymoser_decoder_select="mdct sinewin"
 nellymoser_encoder_select="audio_frame_queue mdct sinewin"
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 9a309c348e..aee4f5431a 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -482,6 +482,7 @@ OBJS-$(CONFIG_MSZH_DECODER)+= lcldec.o
 OBJS-$(CONFIG_MTS2_DECODER)+= mss4.o
 OBJS-$(CONFIG_MVC1_DECODER)+= mvcdec.o
 OBJS-$(CONFIG_MVC2_DECODER)+= mvcdec.o
+OBJS-$(CONFIG_MWSC_DECODER)+= mwsc.o
 OBJS-$(CONFIG_MXPEG_DECODER)   += mxpegdec.o
 OBJS-$(CONFIG_NELLYMOSER_DECODER)  += nellymoserdec.o nellymoser.o
 OBJS-$(CONFIG_NELLYMOSER_ENCODER)  += nellymoserenc.o nellymoser.o
diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
index b1d1ef26c0..d41868c591 100644
--- a/libavcodec/allcodecs.c
+++ b/libavcodec/allcodecs.c
@@ -212,6 +212,7 @@ extern AVCodec ff_mszh_decoder;
 extern AVCodec ff_mts2_decoder;
 extern AVCodec ff_mvc1_decoder;
 extern AVCodec ff_mvc2_decoder;
+extern AVCodec ff_mwsc_decoder;
 extern AVCodec ff_mxpeg_decoder;
 extern AVCodec ff_nuv_decoder;
 extern AVCodec ff_paf_video_decoder;
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 86a658a233..be41b8cf0e 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -449,6 +449,7 @@ enum AVCodecID {
 AV_CODEC_ID_FITS,
 AV_CODEC_ID_IMM4,
 AV_CODEC_ID_PROSUMER,
+AV_CODEC_ID_MWSC,
 
 /* various PCM "codecs" */
 AV_CODEC_ID_FIRST_AUDIO = 0x1, ///< A dummy id pointing at the 
start of audio codecs
diff --git a/libavcodec/codec_desc.c b/libavcodec/codec_desc.c
index e611183599..129d0f1aac 100644
--- a/libavcodec/codec_desc.c
+++ b/libavcodec/codec_desc.c
@@ -1668,6 +1668,13 @@ static const AVCodecDescriptor codec_descriptors[] = {
 .long_name = NULL_IF_CONFIG_SMALL("Brooktree ProSumer Video"),
 .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY,
 },
+{
+.id= AV_CODEC_ID_MWSC,
+.type  = AVMEDIA_TYPE_VIDEO,
+.name  = "mwsc",
+.long_name = NULL_IF_CONFIG_SMALL("MatchWare Screen Capture Codec"),
+.props = AV_CODEC_PROP_LOSSLESS,
+},
 
 /* various PCM "codecs" */
 {
diff --git a/libavcodec/mwsc.c b/libavcodec/mwsc.c
new file mode 100644
index 00..c1a5aca3c0
--- /dev/null
+++ b/libavcodec/mwsc.c
@@ -0,0 +1,192 @@
+/*
+ * MatchWare Screen Capture Codec decoder
+ *
+ * Copyright (c) 2018 Paul B Mahol
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include 
+#include 
+#include 
+
+#include "avcodec.h"
+#include "bytestream.h"
+#include "internal.h"
+
+#include 
+
+typedef struct MWSCContext {
+unsigned int  decomp_size;
+uint8_t  *decomp_buf;
+z_stream  zstream;
+AVFrame  *prev_frame;
+} MWSCContext;
+
+static int rle_uncompress(GetByteContext *gb, PutByteContext *pb, 
GetByteContext *gbp,
+  int width, int height, int stride, int pb_linesize, 
int gbp_linesize)
+{
+int intra = 1, w = 0;
+
+bytestream2_seek_p(pb, (height - 1) * pb_linesize, SEEK_SET);
+
+while (bytestream2_get_bytes_left(gb) > 0) {
+uint32_t fill = bytestream2_get_le24(gb);
+unsigned run = bytestream2_get_byte(gb);
+
+if (run == 0) {
+run = bytestream2_get_le32(gb);
+for (int j = 0; j < run; j++, w++) {
+if (w == width) {
+w = 0;
+bytestream2_seek_p(pb, -(pb_linesiz

Re: [FFmpeg-devel] [PATCH] avfilter/f_cue: add cue and acue filters

2018-08-25 Thread Nicolas George
Marton Balint (2018-08-25):
> +FFFrameQueue queue;

There is already a frame queue in the link, it would be much better to
use it rather than having a second one. For that, you need to use a
"activate" callback instead of filter_frame, the working is mostly the
same for simple filters like that.

No time to look at the patch in more details now.

Regards,

-- 
  Nicolas George


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


Re: [FFmpeg-devel] [PATCH 1/3] avformat/mpegts: add missing null pointer checks in ff_parse_mpeg2_descriptor()

2018-08-25 Thread Michael Niedermayer
On Thu, Aug 16, 2018 at 03:36:27PM +0200, Michael Niedermayer wrote:
> Fixes: null pointer dereference
> Fixes: wtv-crash-75fa58662ded1c1d349f3d1df89394fd690cf92f
> 
> Found-by: Paul Ch 
> Signed-off-by: Michael Niedermayer 
> ---
>  libavformat/mpegts.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

will apply

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

Complexity theory is the science of finding the exact solution to an
approximation. Benchmarking OTOH is finding an approximation of the exact


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


Re: [FFmpeg-devel] [PATCH 1/3] avcodec/snowdec: Fix integer overflow with motion vector residual

2018-08-25 Thread Michael Niedermayer
On Mon, Aug 20, 2018 at 11:28:59PM +0200, Michael Niedermayer wrote:
> Fixes: signed integer overflow: -19818 + -2147483648 cannot be represented in 
> type 'int'
> Fixes: 
> 9545/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SNOW_fuzzer-4928769537081344
> 
> Found-by: continuous fuzzing process 
> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer 
> ---
>  libavcodec/snowdec.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

will apply patchset

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

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


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


Re: [FFmpeg-devel] [PATCH 1/3 v2] configure: speedup x2-x8

2018-08-25 Thread avih
It turns out the the output order of "unique()" was important, andfailing to 
keep the original order (where it keeps the last instanceof recurring items) 
caused some linkage failures.

This Patch 1/3 v2 squashes opt1-reorder-unique.patch onto the originalpatch 
1/3, and updates the commit message accordingly.
It fixes the linkage failures mentioned 
at:http://ffmpeg.org/pipermail/ffmpeg-devel/2018-August/233674.html
 

On Saturday, August 25, 2018 9:09 PM, avih 
 wrote:
 

 For overview see:
http://ffmpeg.org/pipermail/ffmpeg-devel/2018-August/233665.html

Attached is patch 1/3 which was at "main.patch" of that message.

About 50-70% of configure runtime was being spent inside one
function: flatten_extralibs() and callees resolve() and unique().
It manipulates strings and invoked nearly 20K (2) subshells.
It was rewritten to avoid subshells, and ended up x50-x250 faster.

unique() now outputs a different order:
it was keeping the last instance of recurring items, now it
keeps the first. It affects libs order at ffbuild/config.{mak,sh} -
but I don't think it matters. If it does, "opt1-reorder-unique.patch"
restores the original order. Let me know if/why it matters and I'll
squash it and update the commit message accordingly if required.
 

    On Saturday, August 25, 2018 7:55 PM, Timo Rothenpieler 
 wrote:
 

 Please use git send-email to send your patches, or at least send each 
patch, created by git format-patch, as individual attachment. Your files 
seem to contain multiple patches one after another, which makes them 
very hard to follow.

But nice work! Let's hope this does not cause any regressions.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


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


   From 17b42195afb8e3cdd1fd03c5b14634c64c78a1bc Mon Sep 17 00:00:00 2001
From: "Avi Halachmi (:avih)" 
Date: Mon, 30 Jul 2018 22:39:15 +0300
Subject: [PATCH] configure: flatten_extralibs_wrapper(): speedup x50 - x200

Currently configure spends 50-70% of its runtime inside a single
function: flatten_extralibs[_wrapper] - which does string processing.

During its run, nearly 20K command substitutions (subshells) are used,
including its callees unique() and resolve(), which is the reason
for its lengthy run.

This commit avoids all subshells during its execution, speeding it up
by about two orders of magnitude, and reducing the overall configure
runtime by 50-70% .

resolve() is rewritten to avoid subshells, and in unique() and
flatten_extralibs() we "inline" the filter[_out] functionality.

Note that logically, "unique" functionality has more than one possible
output (depending on which of the recurring items is kept). As it
turns out, other parts expect the last recurring item to be kept
(which was the original behavior of uniqie()). This patch preservs
its output order.
---
 configure | 46 +-
 1 file changed, 33 insertions(+), 13 deletions(-)

diff --git a/configure b/configure
index b9c9d0b3..95a38cf2 100755
--- a/configure
+++ b/configure
@@ -844,22 +844,37 @@ prepend(){
 eval "$var=\"$* \$$var\""
 }
 
+reverse () {
+eval '
+reverse_out=
+for v in $'$1'; do
+reverse_out="$v $reverse_out"
+done
+'$1'=$reverse_out
+'
+}
+
+# keeps the last occurence of each non-unique item
 unique(){
-var=$1
-uniq_list=""
-for tok in $(eval echo \$$var); do
-uniq_list="$(filter_out $tok $uniq_list) $tok"
+unique_out=
+eval unique_in=\$$1
+reverse unique_in
+for v in $unique_in; do
+# " $unique_out" +space such that every item is surrounded with spaces
+case " $unique_out" in *" $v "*) continue; esac  # already in list
+unique_out="$unique_out$v "
 done
-eval "$var=\"${uniq_list}\""
+reverse unique_out
+eval $1=\$unique_out
 }
 
 resolve(){
-var=$1
-tmpvar=
-for entry in $(eval echo \$$var); do
-tmpvar="$tmpvar $(eval echo \$${entry})"
+resolve_out=
+eval resolve_in=\$$1
+for v in $resolve_in; do
+eval 'resolve_out="$resolve_out$'$v' "'
 done
-eval "$var=\"${tmpvar}\""
+eval $1=\$resolve_out
 }
 
 add_cppflags(){
@@ -6734,14 +6749,19 @@ if test $target_os = "haiku"; then
 fi
 
 flatten_extralibs(){
-unset nested_entries
+nested_entries=
 list_name=$1
 eval list=\$${1}
 for entry in $list; do
 entry_copy=$entry
 resolve entry_copy
-append nested_entries $(filter '*_extralibs' $entry_copy)
-flat_entries=$(filter_out '*_extralibs' $entry_copy)
+flat_entries=
+for e in $entry_copy; do
+case $e in
+*_extralibs) nested_entries="$nested_entries$e ";;
+  *) flat_entries="$flat_entries$e

Re: [FFmpeg-devel] [PATCH 2/3] configure: speedup x2-x8

2018-08-25 Thread avih
For overview see:
http://ffmpeg.org/pipermail/ffmpeg-devel/2018-August/233665.html

Attached is patch 2/3 which was at "main.patch" of that message.

print_enabled_components() was invoking sed about 350 times on one
file. This is never instant but takes many seconds where fork is
slow (Windows). Invoke sed only once instead = x4-x10 speedup.
 

On Saturday, August 25, 2018 7:55 PM, Timo Rothenpieler 
 wrote:
 

 Please use git send-email to send your patches, or at least send each 
patch, created by git format-patch, as individual attachment. Your files 
seem to contain multiple patches one after another, which makes them 
very hard to follow.

But nice work! Let's hope this does not cause any regressions.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


   From d1cf17fdb518b3a456bbac61e306599d0a4a7400 Mon Sep 17 00:00:00 2001
From: "Avi Halachmi (:avih)" 
Date: Mon, 30 Jul 2018 22:48:04 +0300
Subject: [PATCH] configure: print_enabled_components(): speedup x4 - x10

Inside print_enabled components, the filter_list case invokes sed
about 350 times to parse the same source file and extract different
info for each arg. This is never instant, and on systems where fork is
slow (notably MSYS2/Cygwin on windows) it takes many seconds.

Change it to use sed once on the source file and set env vars with the
parse results, then use these results inside the loop.

Additionally, the cases of indev_list and outdev_list are very
infrequent, but nevertheless they're faster, and arguably cleaner, with
shell parameter substitutions than with command substitutions.
---
 configure | 13 +++--
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/configure b/configure
index 465d808d..b74c44e7 100755
--- a/configure
+++ b/configure
@@ -7224,9 +7224,10 @@ echo "#endif /* AVUTIL_AVCONFIG_H */" >> $TMPH
 
 cp_if_changed $TMPH libavutil/avconfig.h
 
-full_filter_name(){
-sed -n "s/^extern AVFilter ff_\([avfsinkrc]\{2,5\}\)_$1;/\1_$1/p" $source_path/libavfilter/allfilters.c
-}
+# full_filter_name_foo=vf_foo
+# full_filter_name_bar=asrc_bar
+# ...
+eval "$(sed -n "s/^extern AVFilter ff_\([avfsinkrc]\{2,5\}\)_\(.*\);/full_filter_name_\2=\1_\2/p" $source_path/libavfilter/allfilters.c)"
 
 # generate the lists of enabled components
 print_enabled_components(){
@@ -7239,13 +7240,13 @@ print_enabled_components(){
 if enabled $c; then
 case $name in
 filter_list)
-c=$(full_filter_name $(remove_suffix _filter $c))
+eval c=\$full_filter_name_${c%_filter}
 ;;
 indev_list)
-c=$(add_suffix _demuxer $(remove_suffix _indev $c))
+c=${c%_indev}_demuxer
 ;;
 outdev_list)
-c=$(add_suffix _muxer $(remove_suffix _outdev $c))
+c=${c%_outdev}_muxer
 ;;
 esac
 printf "&ff_%s,\n" $c >> $TMPH
-- 
2.17.1

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


Re: [FFmpeg-devel] [PATCH 1/1] libavformat/mxfenc: add missing dnxhr mxf container essence ULs

2018-08-25 Thread Baptiste Coudurier
On Sat, Aug 25, 2018 at 5:02 AM, Tomas Härdin  wrote:

> lör 2018-08-25 klockan 02:00 -0700 skrev j...@wizardofthenet.com:
> > > From: Jason Stevens 
> >
> > ---
> >  libavformat/mxfenc.c | 47 
> >  1 file changed, 47 insertions(+)
> >
> > diff --git a/libavformat/mxfenc.c b/libavformat/mxfenc.c
> > index 7f629dbe53..cf58c8b834 100644
> > --- a/libavformat/mxfenc.c
> > +++ b/libavformat/mxfenc.c
> > @@ -146,6 +146,11 @@ enum ULIndex {
> >  INDEX_DNXHD_720p_8bit_HIGH,
> >  INDEX_DNXHD_720p_8bit_MEDIUM,
> >  INDEX_DNXHD_720p_8bit_LOW,
> > +INDEX_DNXHR_LB,
> > +INDEX_DNXHR_SQ,
> > +INDEX_DNXHR_HQ,
> > +INDEX_DNXHR_HQX,
> > +INDEX_DNXHR_444,
> >  INDEX_JPEG2000,
> >  INDEX_H264,
> >  };
> > @@ -345,6 +350,31 @@ static const MXFContainerEssenceEntry
> mxf_essence_container_uls[] = {
> >{ 
> > 0x06,0x0e,0x2b,0x34,0x01,0x02,0x01,0x01,0x0d,0x01,0x03,0x01,0x15,0x01,0x05,0x00
> },
> >{ 
> > 0x06,0x0e,0x2b,0x34,0x04,0x01,0x01,0x0A,0x04,0x01,0x02,0x02,0x71,0x13,0x00,0x00
> },
> >mxf_write_cdci_desc },
> > +// DNxHR LB - CID 1274
> > +{ { 
> > 0x06,0x0e,0x2b,0x34,0x04,0x01,0x01,0x01,0x0d,0x01,0x03,0x01,0x02,0x11,0x01,0x00
> },
> > +  { 
> > 0x06,0x0e,0x2b,0x34,0x01,0x02,0x01,0x01,0x0d,0x01,0x03,0x01,0x15,0x01,0x05,0x00
> },
> > +  { 
> > 0x06,0x0e,0x2b,0x34,0x04,0x01,0x01,0x0A,0x04,0x01,0x02,0x02,0x71,0x28,0x00,0x00
> },
> > +  mxf_write_cdci_desc },
> > +// DNxHR SQ - CID 1273
> > +{ { 
> > 0x06,0x0e,0x2b,0x34,0x04,0x01,0x01,0x01,0x0d,0x01,0x03,0x01,0x02,0x11,0x01,0x00
> },
> > +  { 
> > 0x06,0x0e,0x2b,0x34,0x01,0x02,0x01,0x01,0x0d,0x01,0x03,0x01,0x15,0x01,0x05,0x00
> },
> > +  { 
> > 0x06,0x0e,0x2b,0x34,0x04,0x01,0x01,0x0A,0x04,0x01,0x02,0x02,0x71,0x27,0x00,0x00
> },
> > +  mxf_write_cdci_desc },
> > +// DNxHR HQ - CID 1272
> > +{ { 
> > 0x06,0x0e,0x2b,0x34,0x04,0x01,0x01,0x01,0x0d,0x01,0x03,0x01,0x02,0x11,0x01,0x00
> },
> > +  { 
> > 0x06,0x0e,0x2b,0x34,0x01,0x02,0x01,0x01,0x0d,0x01,0x03,0x01,0x15,0x01,0x05,0x00
> },
> > +  { 
> > 0x06,0x0e,0x2b,0x34,0x04,0x01,0x01,0x0A,0x04,0x01,0x02,0x02,0x71,0x26,0x00,0x00
> },
> > +  mxf_write_cdci_desc },
> > +// DNxHR HQX - CID 1271
> > +{ { 
> > 0x06,0x0e,0x2b,0x34,0x04,0x01,0x01,0x01,0x0d,0x01,0x03,0x01,0x02,0x11,0x01,0x00
> },
> > +  { 
> > 0x06,0x0e,0x2b,0x34,0x01,0x02,0x01,0x01,0x0d,0x01,0x03,0x01,0x15,0x01,0x05,0x00
> },
> > +  { 
> > 0x06,0x0e,0x2b,0x34,0x04,0x01,0x01,0x0A,0x04,0x01,0x02,0x02,0x71,0x25,0x00,0x00
> },
> > +  mxf_write_cdci_desc },
> > +// DNxHR 444 - CID 1270
> > +{ { 
> > 0x06,0x0e,0x2b,0x34,0x04,0x01,0x01,0x01,0x0d,0x01,0x03,0x01,0x02,0x11,0x01,0x00
> },
> > +  { 
> > 0x06,0x0e,0x2b,0x34,0x01,0x02,0x01,0x01,0x0d,0x01,0x03,0x01,0x15,0x01,0x05,0x00
> },
> > +  { 
> > 0x06,0x0e,0x2b,0x34,0x04,0x01,0x01,0x0A,0x04,0x01,0x02,0x02,0x71,0x24,0x00,0x00
> },
> > +  mxf_write_cdci_desc },
> >  // JPEG2000
> >  { { 
> > 0x06,0x0e,0x2b,0x34,0x04,0x01,0x01,0x07,0x0d,0x01,0x03,0x01,0x02,0x0c,0x01,0x00
> },
> >{ 
> > 0x06,0x0e,0x2b,0x34,0x01,0x02,0x01,0x01,0x0d,0x01,0x03,0x01,0x15,0x01,0x08,0x00
> },
> > @@ -1998,6 +2028,23 @@ AVPacket *pkt)
> >  case 1253:
> >  sc->index = INDEX_DNXHD_720p_8bit_LOW;
> >  break;
> > +case 1274:
> > +sc->index = INDEX_DNXHR_LB;
> > +break;
> > +case 1273:
> > +sc->index = INDEX_DNXHR_SQ;
> > +break;
> > +case 1272:
> > +sc->index = INDEX_DNXHR_HQ;
> > +break;
> > +case 1271:
> > +sc->index = INDEX_DNXHR_HQX;
> > +sc->component_depth = 10;
> > +break;
> > +case 1270:
> > +sc->index = INDEX_DNXHR_444;
> > +sc->component_depth = 10;
> > +break;
> >  default:
> >  return -1;
> >  }
>
> Don't have any idea about DNxHR, else the code looks OK enough.


I think DNxHR is variable frame size, and in the code frame_size will be 0
and that will cause issues in the index table later,
creating broken files.

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


[FFmpeg-devel] [PATCH] avfilter/f_cue: add cue and acue filters

2018-08-25 Thread Marton Balint
To delay filtering until a given wallclock timestamp.

Signed-off-by: Marton Balint 
---
 doc/filters.texi |  36 ++
 libavfilter/Makefile |   2 +
 libavfilter/allfilters.c |   2 +
 libavfilter/f_cue.c  | 182 +++
 libavfilter/version.h|   2 +-
 5 files changed, 223 insertions(+), 1 deletion(-)
 create mode 100644 libavfilter/f_cue.c

diff --git a/doc/filters.texi b/doc/filters.texi
index 32c95b591c..79eec0c808 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -551,6 +551,11 @@ Set LFO range.
 Set LFO rate.
 @end table
 
+@section acue
+
+Delay audio filtering until a given wallclock timestamp. See the @ref{cue}
+filter.
+
 @section adeclick
 Remove impulsive noise from input audio.
 
@@ -6987,6 +6992,37 @@ indicates 'never reset', and returns the largest area 
encountered during
 playback.
 @end table
 
+@anchor{cue}
+@section cue
+
+Delay video filtering until a given wallclock timestamp. The filter first
+passes on @option{preroll} amount of frames, then it buffers at most
+@option{buffer} amount of frames and waits for the cue. After reaching the cue
+it forwards the buffered frames and also any subsequent frames coming in its
+input.
+
+The filter can be used synchronize the output of multiple ffmpeg processes for
+realtime output devices like decklink. By putting the delay in the filtering
+chain and pre-buffering frames the process can pass on data to output almost
+immediately after the target wallclock timestamp is reached.
+
+Perfect frame accuracy cannot be guaranteed, but the result is good enough for
+some use cases.
+
+@table @option
+
+@item cue
+The cue timestamp expressed in a UNIX timestamp in microseconds. Default is 0.
+
+@item preroll
+The duration of content to pass on as preroll expressed in seconds. Default is 
0.
+
+@item buffer
+The maximum duration of content to buffer before waiting for the cue expressed
+in seconds. Default is 0.
+
+@end table
+
 @anchor{curves}
 @section curves
 
diff --git a/libavfilter/Makefile b/libavfilter/Makefile
index e5d3a57af7..37a06e0ec0 100644
--- a/libavfilter/Makefile
+++ b/libavfilter/Makefile
@@ -36,6 +36,7 @@ OBJS-$(CONFIG_ACONTRAST_FILTER)  += af_acontrast.o
 OBJS-$(CONFIG_ACOPY_FILTER)  += af_acopy.o
 OBJS-$(CONFIG_ACROSSFADE_FILTER) += af_afade.o
 OBJS-$(CONFIG_ACRUSHER_FILTER)   += af_acrusher.o
+OBJS-$(CONFIG_ACUE_FILTER)   += f_cue.o
 OBJS-$(CONFIG_ADECLICK_FILTER)   += af_adeclick.o
 OBJS-$(CONFIG_ADECLIP_FILTER)+= af_adeclick.o
 OBJS-$(CONFIG_ADELAY_FILTER) += af_adelay.o
@@ -178,6 +179,7 @@ OBJS-$(CONFIG_COREIMAGE_FILTER)  += 
vf_coreimage.o
 OBJS-$(CONFIG_COVER_RECT_FILTER) += vf_cover_rect.o lavfutils.o
 OBJS-$(CONFIG_CROP_FILTER)   += vf_crop.o
 OBJS-$(CONFIG_CROPDETECT_FILTER) += vf_cropdetect.o
+OBJS-$(CONFIG_CUE_FILTER)+= f_cue.o
 OBJS-$(CONFIG_CURVES_FILTER) += vf_curves.o
 OBJS-$(CONFIG_DATASCOPE_FILTER)  += vf_datascope.o
 OBJS-$(CONFIG_DCTDNOIZ_FILTER)   += vf_dctdnoiz.o
diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c
index 9732ae5345..6c6d0f43f0 100644
--- a/libavfilter/allfilters.c
+++ b/libavfilter/allfilters.c
@@ -27,6 +27,7 @@ extern AVFilter ff_af_abench;
 extern AVFilter ff_af_acompressor;
 extern AVFilter ff_af_acontrast;
 extern AVFilter ff_af_acopy;
+extern AVFilter ff_af_acue;
 extern AVFilter ff_af_acrossfade;
 extern AVFilter ff_af_acrusher;
 extern AVFilter ff_af_adeclick;
@@ -167,6 +168,7 @@ extern AVFilter ff_vf_coreimage;
 extern AVFilter ff_vf_cover_rect;
 extern AVFilter ff_vf_crop;
 extern AVFilter ff_vf_cropdetect;
+extern AVFilter ff_vf_cue;
 extern AVFilter ff_vf_curves;
 extern AVFilter ff_vf_datascope;
 extern AVFilter ff_vf_dctdnoiz;
diff --git a/libavfilter/f_cue.c b/libavfilter/f_cue.c
new file mode 100644
index 00..732b5e218a
--- /dev/null
+++ b/libavfilter/f_cue.c
@@ -0,0 +1,182 @@
+/*
+ * Copyright (c) 2018 Marton Balint
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with FFmpeg; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "libavutil/opt.h"
+#include "libavutil/time.h"
+#include "avfilter.h"
+#include 

Re: [FFmpeg-devel] [PATCH 3/3] configure: speedup x2-x8

2018-08-25 Thread avih
For overview see:
http://ffmpeg.org/pipermail/ffmpeg-devel/2018-August/233665.html

Attached is patch 3/3 which was at "main.patch" of that message.

After the previous speedups, configure spent 20-60% of its runtime
at check_deps(). It's particularly slow with bash. After some local
optimizations - mainly avoid pushvar/popvar and abort early in one
notable case (empty deps), it's now x4-x25 faster.

After this patch, pushvar() and popvar() are not used but
I was hesitant to remove them (nice to have). If you think it should
be removed, the patch "opt2-remove-pushvar.patch" removes them.
 

On Saturday, August 25, 2018 7:55 PM, Timo Rothenpieler 
 wrote:
 

 Please use git send-email to send your patches, or at least send each 
patch, created by git format-patch, as individual attachment. Your files 
seem to contain multiple patches one after another, which makes them 
very hard to follow.

But nice work! Let's hope this does not cause any regressions.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


   From a068913d2c4c460ef0a256cb3676bd1227f59667 Mon Sep 17 00:00:00 2001
From: "Avi Halachmi (:avih)" 
Date: Sun, 5 Aug 2018 06:16:44 +0300
Subject: [PATCH] configure: check_deps(): x4 - x25 speedup

check_deps() recursively enables/disables components, and its loop is
iterated nearly 6000 times. It's particularly slow in bash - currently
consuming more than 50% of configure runtime, and about 20% with other
shells.

This commit applies few local optimizations, most effective first:
- Use $1 $2 ... instead of pushvar/popvar, and same at enable_deep*
- Abort early in one notable case - empty deps, to avoid costly no-op.
- Smaller changes which do add up:
  - Handle ${cfg}_checking locally instead of via enable[d]/disable
  - ${cfg}_checking: test done before inprogress - x2 faster in 50%+
  - one eval instead of several at the empty-deps early abort path.

- The "actual work" part is unmodified - just its surroundings.

Biggest speedups (relative and absolute) are observed with bash.
---
 configure | 86 +--
 1 file changed, 46 insertions(+), 40 deletions(-)

diff --git a/configure b/configure
index b74c44e7..e9cb7703 100755
--- a/configure
+++ b/configure
@@ -676,13 +676,10 @@ disable_sanitized(){
 do_enable_deep(){
 for var; do
 enabled $var && continue
-eval sel="\$${var}_select"
-eval sgs="\$${var}_suggest"
-pushvar var sgs
-enable_deep $sel
-popvar sgs
-enable_deep_weak $sgs
-popvar var
+set -- $var
+eval enable_deep \$${var}_select
+var=$1
+eval enable_deep_weak \$${var}_suggest
 done
 }
 
@@ -694,9 +691,9 @@ enable_deep(){
 enable_deep_weak(){
 for var; do
 disabled $var && continue
-pushvar var
+set -- $var
 do_enable_deep $var
-popvar var
+var=$1
 enable_weak $var
 done
 }
@@ -756,40 +753,49 @@ is_in(){
 return 1
 }
 
+# The cfg loop is very hot (several thousands iterations), and in bash also
+# potentialy quite slow. Try to abort the iterations early, preferably without
+# calling functions. 70%+ of the time cfg is already done or without deps.
 check_deps(){
 for cfg; do
-enabled ${cfg}_checking && die "Circular dependency for $cfg."
-disabled ${cfg}_checking && continue
-enable ${cfg}_checking
-
-eval dep_all="\$${cfg}_deps"
-eval dep_any="\$${cfg}_deps_any"
-eval dep_con="\$${cfg}_conflict"
-eval dep_sel="\$${cfg}_select"
-eval dep_sgs="\$${cfg}_suggest"
-eval dep_ifa="\$${cfg}_if"
-eval dep_ifn="\$${cfg}_if_any"
-
-pushvar cfg dep_all dep_any dep_con dep_sel dep_sgs dep_ifa dep_ifn
-check_deps $dep_all $dep_any $dep_con $dep_sel $dep_sgs $dep_ifa $dep_ifn
-popvar cfg dep_all dep_any dep_con dep_sel dep_sgs dep_ifa dep_ifn
-
-[ -n "$dep_ifa" ] && { enabled_all $dep_ifa && enable_weak $cfg; }
-[ -n "$dep_ifn" ] && { enabled_any $dep_ifn && enable_weak $cfg; }
-enabled_all  $dep_all || { disable $cfg && requested $cfg && die "ERROR: $cfg requested, but not all dependencies are satisfied: $dep_all"; }
-enabled_any  $dep_any || { disable $cfg && requested $cfg && die "ERROR: $cfg requested, but not any dependency is satisfied: $dep_any"; }
-disabled_all $dep_con || { disable $cfg && requested $cfg && die "ERROR: $cfg requested, but some conflicting dependencies are unsatisfied: $dep_con"; }
-disabled_any $dep_sel && { disable $cfg && requested $cfg && die "ERROR: $cfg requested, but some selected dependency is unsatisfied: $dep_sel"; }
-
-enabled $cfg && enable_deep_weak $dep_sel $dep_sgs
-
-for dep in $dep_all $dep_any $dep_sel $dep_sgs; do
-# filter out library deps, these do not belong in extralib

Re: [FFmpeg-devel] [PATCH 1/3] configure: speedup x2-x8

2018-08-25 Thread avih
For overview see:
http://ffmpeg.org/pipermail/ffmpeg-devel/2018-August/233665.html

Attached is patch 1/3 which was at "main.patch" of that message.

About 50-70% of configure runtime was being spent inside one
function: flatten_extralibs() and callees resolve() and unique().
It manipulates strings and invoked nearly 20K (2) subshells.
It was rewritten to avoid subshells, and ended up x50-x250 faster.

unique() now outputs a different order:
it was keeping the last instance of recurring items, now it
keeps the first. It affects libs order at ffbuild/config.{mak,sh} -
but I don't think it matters. If it does, "opt1-reorder-unique.patch"
restores the original order. Let me know if/why it matters and I'll
squash it and update the commit message accordingly if required.
 

On Saturday, August 25, 2018 7:55 PM, Timo Rothenpieler 
 wrote:
 

 Please use git send-email to send your patches, or at least send each 
patch, created by git format-patch, as individual attachment. Your files 
seem to contain multiple patches one after another, which makes them 
very hard to follow.

But nice work! Let's hope this does not cause any regressions.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


   From 7593d9f6580afd8a1066df1e1910a817d7c2fff1 Mon Sep 17 00:00:00 2001
From: "Avi Halachmi (:avih)" 
Date: Mon, 30 Jul 2018 22:39:15 +0300
Subject: [PATCH] configure: flatten_extralibs_wrapper(): speedup x50 - x200

Currently configure spends 50-70% of its runtime inside a single
function: flatten_extralibs[_wrapper] - which does string processing.

During its run, nearly 20K command substitutions (subshells) are used,
including its callees unique() and resolve(), which is the reason
for its lengthy run.

This commit avoids all subshells during its execution, speeding it up
by about two orders of magnitude, and reducing the overall configure
runtime by 50-70% .

resolve() is rewritten to avoid subshells, and in unique() and
flatten_extralibs() we "inline" the filter[_out] functionality.

Note that unique() now produces different output order than before.
Previously it kept the last occurence of re-occuring items, and now
it keeps the first. However, this shouldn't make a difference as it's
used for unique library dependencies where the order doesn't matter.
---
 configure | 33 -
 1 file changed, 20 insertions(+), 13 deletions(-)

diff --git a/configure b/configure
index b9c9d0b3..465d808d 100755
--- a/configure
+++ b/configure
@@ -845,21 +845,23 @@ prepend(){
 }
 
 unique(){
-var=$1
-uniq_list=""
-for tok in $(eval echo \$$var); do
-uniq_list="$(filter_out $tok $uniq_list) $tok"
+unique_out=
+eval unique_in=\$$1
+for v in $unique_in; do
+# " $unique_out" +space such that every item is surrounded with spaces
+case " $unique_out" in *" $v "*) continue; esac  # already in list
+unique_out="$unique_out$v "
 done
-eval "$var=\"${uniq_list}\""
+eval $1=\$unique_out
 }
 
 resolve(){
-var=$1
-tmpvar=
-for entry in $(eval echo \$$var); do
-tmpvar="$tmpvar $(eval echo \$${entry})"
+resolve_out=
+eval resolve_in=\$$1
+for v in $resolve_in; do
+eval 'resolve_out="$resolve_out$'$v' "'
 done
-eval "$var=\"${tmpvar}\""
+eval $1=\$resolve_out
 }
 
 add_cppflags(){
@@ -6734,14 +6736,19 @@ if test $target_os = "haiku"; then
 fi
 
 flatten_extralibs(){
-unset nested_entries
+nested_entries=
 list_name=$1
 eval list=\$${1}
 for entry in $list; do
 entry_copy=$entry
 resolve entry_copy
-append nested_entries $(filter '*_extralibs' $entry_copy)
-flat_entries=$(filter_out '*_extralibs' $entry_copy)
+flat_entries=
+for e in $entry_copy; do
+case $e in
+*_extralibs) nested_entries="$nested_entries$e ";;
+  *) flat_entries="$flat_entries$e ";;
+esac
+done
 eval $entry="\$flat_entries"
 done
 append $list_name "$nested_entries"
-- 
2.17.1

From 94b80da14fbca1296ac744a53581b817ae56d370 Mon Sep 17 00:00:00 2001
From: "Avi Halachmi (:avih)" 
Date: Wed, 1 Aug 2018 09:06:36 +0300
Subject: [PATCH] configure: unique(): fixup to restore original output order

Originally unique() was keeping the last occurence of each non-unique
item, but commit XXX changed it to keep the first.

This commit restores the original order due to *TBD*.
---
 configure | 13 +
 1 file changed, 13 insertions(+)

diff --git a/configure b/configure
index e9cb7703..ba123ead 100755
--- a/configure
+++ b/configure
@@ -850,14 +850,27 @@ prepend(){
 eval "$var=\"$* \$$var\""
 }
 
+reverse () {
+eval '
+reverse_out=
+for v in $'$1'; do
+reverse_out="$v $reverse_out"
+done
+'$1'=$reverse_out
+'
+}
+
+# keeps the last occur

Re: [FFmpeg-devel] [PATCH] configure: speedup x2-x8

2018-08-25 Thread avih
Thanks.
 I'll post the 3 parts of main.patch unmodified as individualemails like Timo 
requested, and then I'll look at the failures.
 

On Saturday, August 25, 2018 9:00 PM, Michael Niedermayer 
 wrote:
 

 On Sat, Aug 25, 2018 at 02:33:03PM +, avih wrote:
> Hi,
> 
> I noticed that configure can be a bit slow - few minutes on my macOS
> system, 1:30m on linux/bash, 30s on linux/dash, and even if
> pathological, still a too-long 10 minutes on Windows (MSYS2) (same
> duration as a full build with make -j4 after configure).
> 
> I added some timing information printouts for various parts in
> configure, and eventually identified few culprits.
> 
> The attachment "config-timing.patch" adds these printouts and sorted
> summary. It's attached for reference and not intended to be merged.
> It applies cleanly before or after the main patch.
> 
> 
> The attached "main.patch" addresses three areas I identified as slow:
> 
> 1. About 50-70% of configure runtime was being spent inside one
>    function: flatten_extralibs() and callees resolve() and unique().
>    It manipulates strings and invoked nearly 20K (2) subshells.
>    It was rewritten to avoid subshells, and ended up x50-x250 faster.
> 
> 2. print_enabled_components() was invoking sed about 350 times on one
>    file. This is never instant but takes many seconds where fork is
>    slow (Windows). Invoke sed only once instead = x4-x10 speedup.
> 
> 3. After the previous speedups, configure spent 20-60% of its runtime
>    at check_deps(). It's particularly slow with bash. After some local
>    optimizations - mainly avoid pushvar/popvar and abort early in one
>    notable case (empty deps), it's now x4-x25 faster.
> 
> 
> Some resulting speedups (more details at "before-after.txt"):
> 
> - macOS/bash:  total: 98s -> 22s    flatten_extralibs:  53s -> 0.7s
> - Linux/bash:  total: 87s -> 11s    flatten_extralibs:  59s -> 0.9s
> - Linux/dash:  total: 27s ->  8s    flatten_extralibs:  17s -> 0.2s
> - FreeBSD/sh:  total: 34s ->  9s    flatten_extralibs:  23s -> 0.2s
> - MSYS2/bash:  total: 10m -> 2:30m  flatten_extralibs: 400s -> 1.5s (!)
> 
> 
> Notes:
> 
> - unique() is modified with flatten_extralibs. It now outputs different
>   order: it was keeping the last instance of recurring items, now it
>   keeps the first. It affects libs order at ffbuild/config.{mak,sh} -
>   but I don't think it matters. If it does, "opt1-reorder-unique.patch"
>   restores the original order. Let me know if/why it matters and I'll
>   squash it and update the commit message accordingly if required.
> 
> - After the check_deps() patch, pushvar() and popvar() are not used but
>   I was hesitant to remove them (nice to have). If you think it should
>   be removed, the patch "opt2-remove-pushvar.patch" removes them.
> 
> - The patches assume POSIX shell and don't use anything "tricky".
>   It was tested with dash, bash, busybox-ash, freebsd-sh, ksh93u, mksh.
> 
> - Thanks to tmm1 and atomnuker for their help with testing.
> 
> 
> This is my first mail to this list, and I wasn't sure how to split the
> patches. After asking a veteran, it was suggested to me that I should
> put all of them in one email. Just let me know if you prefer something
> else (dev mailing lists are not my forte...).

with the main patch
make distclean ; dash ./configure  --enable-gpl && make -j12 testprogs
fails:

LD    libavfilter/tests/filtfmts
libavformat/libavformat.a(utils.o): In function `av_apply_bitstream_filters':
ffmpeg/libavformat/utils.c:5577: undefined reference to 
`av_bitstream_filter_filter'
libavformat/libavformat.a(codec2.o): In function `codec2_read_header_common':
ffmpeg/libavformat/codec2.c:74: undefined reference to 
`avpriv_codec2_mode_bit_rate'
ffmpeg/libavformat/codec2.c:75: undefined reference to 
`avpriv_codec2_mode_frame_size'
ffmpeg/libavformat/codec2.c:76: undefined reference to 
`avpriv_codec2_mode_block_align'
ffmpeg/libavformat/codec2.c:74: undefined reference to 
`avpriv_codec2_mode_bit_rate'
ffmpeg/libavformat/codec2.c:75: undefined reference to 
`avpriv_codec2_mode_frame_size'
ffmpeg/libavformat/codec2.c:76: undefined reference to 
`avpriv_codec2_mode_block_align'
libavformat/libavformat.a(spdifdec.o): In function `spdif_get_offset_and_codec':
ffmpeg/libavformat/spdifdec.c:63: undefined reference to `av_adts_header_parse'
ffmpeg/libavformat/spdifdec.c:63: undefined reference to `av_adts_header_parse'
libavformat/libavformat.a(spdifenc.o): In function `spdif_header_aac':
ffmpeg/libavformat/spdifenc.c:357: undefined reference to `av_adts_header_parse'
collect2: error: ld returned 1 exit status
make: *** [libavfilter/tests/filtfmts] Error 1

[...]

-- 
Michael    GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Freedom in capitalist society always remains about the same as it was in
ancient Greek republics: Freedom for slave owners. -- Vladimir 
Lenin___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmp

Re: [FFmpeg-devel] [PATCH] configure: speedup x2-x8

2018-08-25 Thread Michael Niedermayer
On Sat, Aug 25, 2018 at 02:33:03PM +, avih wrote:
> Hi,
> 
> I noticed that configure can be a bit slow - few minutes on my macOS
> system, 1:30m on linux/bash, 30s on linux/dash, and even if
> pathological, still a too-long 10 minutes on Windows (MSYS2) (same
> duration as a full build with make -j4 after configure).
> 
> I added some timing information printouts for various parts in
> configure, and eventually identified few culprits.
> 
> The attachment "config-timing.patch" adds these printouts and sorted
> summary. It's attached for reference and not intended to be merged.
> It applies cleanly before or after the main patch.
> 
> 
> The attached "main.patch" addresses three areas I identified as slow:
> 
> 1. About 50-70% of configure runtime was being spent inside one
>    function: flatten_extralibs() and callees resolve() and unique().
>    It manipulates strings and invoked nearly 20K (2) subshells.
>    It was rewritten to avoid subshells, and ended up x50-x250 faster.
> 
> 2. print_enabled_components() was invoking sed about 350 times on one
>    file. This is never instant but takes many seconds where fork is
>    slow (Windows). Invoke sed only once instead = x4-x10 speedup.
> 
> 3. After the previous speedups, configure spent 20-60% of its runtime
>    at check_deps(). It's particularly slow with bash. After some local
>    optimizations - mainly avoid pushvar/popvar and abort early in one
>    notable case (empty deps), it's now x4-x25 faster.
> 
> 
> Some resulting speedups (more details at "before-after.txt"):
> 
> - macOS/bash:  total: 98s -> 22s    flatten_extralibs:  53s -> 0.7s
> - Linux/bash:  total: 87s -> 11s    flatten_extralibs:  59s -> 0.9s
> - Linux/dash:  total: 27s ->  8s    flatten_extralibs:  17s -> 0.2s
> - FreeBSD/sh:  total: 34s ->  9s    flatten_extralibs:  23s -> 0.2s
> - MSYS2/bash:  total: 10m -> 2:30m  flatten_extralibs: 400s -> 1.5s (!)
> 
> 
> Notes:
> 
> - unique() is modified with flatten_extralibs. It now outputs different
>   order: it was keeping the last instance of recurring items, now it
>   keeps the first. It affects libs order at ffbuild/config.{mak,sh} -
>   but I don't think it matters. If it does, "opt1-reorder-unique.patch"
>   restores the original order. Let me know if/why it matters and I'll
>   squash it and update the commit message accordingly if required.
> 
> - After the check_deps() patch, pushvar() and popvar() are not used but
>   I was hesitant to remove them (nice to have). If you think it should
>   be removed, the patch "opt2-remove-pushvar.patch" removes them.
> 
> - The patches assume POSIX shell and don't use anything "tricky".
>   It was tested with dash, bash, busybox-ash, freebsd-sh, ksh93u, mksh.
> 
> - Thanks to tmm1 and atomnuker for their help with testing.
> 
> 
> This is my first mail to this list, and I wasn't sure how to split the
> patches. After asking a veteran, it was suggested to me that I should
> put all of them in one email. Just let me know if you prefer something
> else (dev mailing lists are not my forte...).

with the main patch
make distclean ; dash ./configure  --enable-gpl && make -j12 testprogs
fails:

LD  libavfilter/tests/filtfmts
libavformat/libavformat.a(utils.o): In function `av_apply_bitstream_filters':
ffmpeg/libavformat/utils.c:5577: undefined reference to 
`av_bitstream_filter_filter'
libavformat/libavformat.a(codec2.o): In function `codec2_read_header_common':
ffmpeg/libavformat/codec2.c:74: undefined reference to 
`avpriv_codec2_mode_bit_rate'
ffmpeg/libavformat/codec2.c:75: undefined reference to 
`avpriv_codec2_mode_frame_size'
ffmpeg/libavformat/codec2.c:76: undefined reference to 
`avpriv_codec2_mode_block_align'
ffmpeg/libavformat/codec2.c:74: undefined reference to 
`avpriv_codec2_mode_bit_rate'
ffmpeg/libavformat/codec2.c:75: undefined reference to 
`avpriv_codec2_mode_frame_size'
ffmpeg/libavformat/codec2.c:76: undefined reference to 
`avpriv_codec2_mode_block_align'
libavformat/libavformat.a(spdifdec.o): In function `spdif_get_offset_and_codec':
ffmpeg/libavformat/spdifdec.c:63: undefined reference to `av_adts_header_parse'
ffmpeg/libavformat/spdifdec.c:63: undefined reference to `av_adts_header_parse'
libavformat/libavformat.a(spdifenc.o): In function `spdif_header_aac':
ffmpeg/libavformat/spdifenc.c:357: undefined reference to `av_adts_header_parse'
collect2: error: ld returned 1 exit status
make: *** [libavfilter/tests/filtfmts] Error 1

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Freedom in capitalist society always remains about the same as it was in
ancient Greek republics: Freedom for slave owners. -- Vladimir Lenin


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


Re: [FFmpeg-devel] [PATCH] configure: speedup x2-x8

2018-08-25 Thread Timo Rothenpieler
Please use git send-email to send your patches, or at least send each 
patch, created by git format-patch, as individual attachment. Your files 
seem to contain multiple patches one after another, which makes them 
very hard to follow.


But nice work! Let's hope this does not cause any regressions.



smime.p7s
Description: S/MIME Cryptographic Signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avcodec/mpeg4videodec: Fix slice end detection in mpeg4_decode_studio_mb()

2018-08-25 Thread Michael Niedermayer
On Sun, Aug 19, 2018 at 12:01:04PM +0200, Michael Niedermayer wrote:
> Signed-off-by: Michael Niedermayer 
> ---
>  libavcodec/mpeg4videodec.c | 8 
>  1 file changed, 8 insertions(+)

applied

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

Freedom in capitalist society always remains about the same as it was in
ancient Greek republics: Freedom for slave owners. -- Vladimir Lenin


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


Re: [FFmpeg-devel] [PATCH] avcodec/utils: document allocation requirement of extradata

2018-08-25 Thread Timo Rothenpieler

On 8/25/2018 5:15 PM, Michael Niedermayer wrote:

On Fri, Aug 24, 2018 at 08:53:29PM +0200, Timo Rothenpieler wrote:

---
  libavcodec/avcodec.h | 1 +
  1 file changed, 1 insertion(+)

diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 31e50d5a94..2c5e78c88d 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -1616,6 +1616,7 @@ typedef struct AVCodecContext {
   * The allocated memory should be AV_INPUT_BUFFER_PADDING_SIZE bytes 
larger
   * than extradata_size to avoid problems if it is read with the bitstream 
reader.
   * The bytewise contents of extradata must not depend on the architecture 
or CPU endianness.
+ * Must be allocated with the av_malloc() family of functions.
   * - encoding: Set/allocated/freed by libavcodec.
   * - decoding: Set/allocated/freed by user.
   */


LGTM

thx



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


Re: [FFmpeg-devel] [PATCH] Support 64-bit integers for av_get_frame_filename2()

2018-08-25 Thread Michael Niedermayer
On Sat, Aug 25, 2018 at 03:30:48PM +0200, Marton Balint wrote:
> 
> 
> On Sat, 25 Aug 2018, Michael Niedermayer wrote:
> 
> >On Fri, Aug 24, 2018 at 04:33:18PM -0300, James Almer wrote:
> >>On 8/24/2018 3:56 PM, Devin Heitmueller wrote:
> >>>Create a new av_get_frame_filename3() API which is just like the
> >>>previous version but accepts a 64-bit integer for the "number"
> >>>argument.  This is useful in cases where you want to put the
> >>>original PTS into the filename (which can be larger than 32-bits).
> >>>
> >>>Tested with:
> >>>
> >>>./ffmpeg -copyts -vsync 0 -i foo.ts -frame_pts 1 -enc_time_base -1 
> >>>foo_%d.png
> >>>
> >>>Signed-off-by: Devin Heitmueller 
> >>>---
> >>> libavformat/avformat.h | 2 ++
> >>> libavformat/img2enc.c  | 2 +-
> >>> libavformat/utils.c| 9 +++--
> >>> 3 files changed, 10 insertions(+), 3 deletions(-)
> >>
> >>Missing APIChanges entry and libavformat minor version bump.
> >>
> >>>
> >>>diff --git a/libavformat/avformat.h b/libavformat/avformat.h
> >>>index fdaffa5bf4..c358a9a71e 100644
> >>>--- a/libavformat/avformat.h
> >>>+++ b/libavformat/avformat.h
> >>>@@ -2896,6 +2896,8 @@ void av_dump_format(AVFormatContext *ic,
> >>>  * @param flags AV_FRAME_FILENAME_FLAGS_*
> >>>  * @return 0 if OK, -1 on format error
> >>>  */
> >>>+int av_get_frame_filename3(char *buf, int buf_size,
> >>>+  const char *path, int64_t number, int flags);
> >>
> >>Make buf_size of size_t type while at it.
> >>
> >>> int av_get_frame_filename2(char *buf, int buf_size,
> >>>   const char *path, int number, int flags);
> >>>
> >>>diff --git a/libavformat/img2enc.c b/libavformat/img2enc.c
> >>>index a09cc8ec50..414eb827e2 100644
> >>>--- a/libavformat/img2enc.c
> >>>+++ b/libavformat/img2enc.c
> >>>@@ -101,7 +101,7 @@ static int write_packet(AVFormatContext *s, AVPacket 
> >>>*pkt)
> >>> return AVERROR(EINVAL);
> >>> }
> >>> } else if (img->frame_pts) {
> >>>-if (av_get_frame_filename2(filename, sizeof(filename), 
> >>>img->path, pkt->pts, AV_FRAME_FILENAME_FLAGS_MULTIPLE) < 0) {
> >>>+if (av_get_frame_filename3(filename, sizeof(filename), 
> >>>img->path, pkt->pts, AV_FRAME_FILENAME_FLAGS_MULTIPLE) < 0) {
> >>> av_log(s, AV_LOG_ERROR, "Cannot write filename by pts of 
> >>> the frames.");
> >>> return AVERROR(EINVAL);
> >>> }
> >>>diff --git a/libavformat/utils.c b/libavformat/utils.c
> >>>index b0b5e164a6..d9d4d38a44 100644
> >>>--- a/libavformat/utils.c
> >>>+++ b/libavformat/utils.c
> >>>@@ -4666,7 +4666,7 @@ uint64_t ff_get_formatted_ntp_time(uint64_t 
> >>>ntp_time_us)
> >>> return ntp_ts;
> >>> }
> >>>
> >>>-int av_get_frame_filename2(char *buf, int buf_size, const char *path, int 
> >>>number, int flags)
> >>>+int av_get_frame_filename3(char *buf, int buf_size, const char *path, 
> >>>int64_t number, int flags)
> >>> {
> >>> const char *p;
> >>> char *q, buf1[20], c;
> >>>@@ -4696,7 +4696,7 @@ int av_get_frame_filename2(char *buf, int buf_size, 
> >>>const char *path, int number
> >>> percentd_found = 1;
> >>> if (number < 0)
> >>> nd += 1;
> >>>-snprintf(buf1, sizeof(buf1), "%0*d", nd, number);
> >>>+snprintf(buf1, sizeof(buf1), "%0*" PRId64, nd, number);
> >>
> >>SCNd64.
> >>
> >>> len = strlen(buf1);
> >>> if ((q - buf + len) > buf_size - 1)
> >>> goto fail;
> >>>@@ -4721,6 +4721,11 @@ fail:
> >>> return -1;
> >>> }
> >>>
> >>>+int av_get_frame_filename2(char *buf, int buf_size, const char *path, int 
> >>>number, int flags)
> >>>+{
> >>>+return av_get_frame_filename3(buf, buf_size, path, number, flags);
> >>>+}
> >>>+
> >>> int av_get_frame_filename(char *buf, int buf_size, const char *path, int 
> >>> number)
> >>> {
> >>> return av_get_frame_filename2(buf, buf_size, path, number, 0);
> >>>
> >>
> >>No opinion on the addition, so wait for someone else to review as well.
> >
> >i think it makes sense
> >
> >also the old function should be deprecated. I think theres no reason to
> >use the old one if the 64bit one is added. We could refrain from removing
> >the old though for longer as it has no risk of breaking. But deprecation
> >would notify users that we have something newer/better to replace it
> 
> Well, actually av_get_frame_filename3 should be deprecated too soon, because
> users should not use these functions because they limit the file path to a
> fixed length. An AVBPrintf based replacement should be used instead in the
> long run.

If people prefer AVBPrintf over PATH_MAX or strlen(input) + X, then sure



[...]

-- 
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
__

Re: [FFmpeg-devel] swscale : add bitexact conv for grayf32 and gray16 to f32 conv

2018-08-25 Thread Michael Niedermayer
On Thu, Aug 23, 2018 at 08:13:13PM +0200, Martin Vignali wrote:
[...]
>  swscale_internal.h |2 -
>  utils.c|   70 
> ++---
>  2 files changed, 68 insertions(+), 4 deletions(-)
> 911c6d681b09ab719e2c8abe337887732c28b65e  
> 0003-swscale-add-bit_exact-lut-creation-for-8bit-to-float.patch
> From e7b78d6416189a72695dac0680782a987c84b274 Mon Sep 17 00:00:00 2001
> From: Martin Vignali 
> Date: Thu, 23 Aug 2018 18:40:54 +0200
> Subject: [PATCH 3/4] swscale : add bit_exact lut creation for 8bit to float
> 
> ---
>  libswscale/swscale_internal.h |  2 +-
>  libswscale/utils.c| 70 
> +--
>  2 files changed, 68 insertions(+), 4 deletions(-)
> 
> diff --git a/libswscale/swscale_internal.h b/libswscale/swscale_internal.h
> index 3b6b682d5f..a9cd7bc8d7 100644
> --- a/libswscale/swscale_internal.h
> +++ b/libswscale/swscale_internal.h
> @@ -336,7 +336,7 @@ typedef struct SwsContext {
>  uint32_t pal_yuv[256];
>  uint32_t pal_rgb[256];
>  
> -float uint2float_lut[256];
> +float *uint2float_lut; /*! store uint8 to float or uint16 to float */
>  
>  /**
>   * @name Scaled horizontal lines ring buffer.
> diff --git a/libswscale/utils.c b/libswscale/utils.c
> index 5e56371180..ce65467c35 100644
> --- a/libswscale/utils.c
> +++ b/libswscale/utils.c
> @@ -1098,6 +1098,69 @@ static uint16_t * alloc_gamma_tbl(double e)
>  return tbl;
>  }
>  
> +static void inline fill_uint_to_float_lut(SwsContext *c, int bitdepth) {
> +static const float float_mult8 = 1.0f / 255.0f;
> +int i;
> +
> +if (bitdepth == 8) { /*! fill uint8 to float lut */
> +for (i = 0; i < 256; ++i){
> +c->uint2float_lut[i] = (float)i * float_mult8;
> +}
> +} else { /*! unsupported bitdepth */
> +av_assert0(0);
> +}
> +}
> +
> +#define SIGN_EXP_MANT_TO_UINT32(sign, exp, mant) sign << 31 | exp << 23 | 
> mant
> +
> +static void inline fill_uint_to_float_lut_bitexact(SwsContext *c, int 
> bitdepth) {
> +int i, j, exp, mant, div;
> +uint32_t off_coeff_mant;
> +uint32_t coeff_mant;
> +uint32_t *lut = (uint32_t *)c->uint2float_lut;
> +int min_loop = 1;
> +int max_loop = 2;
> +
> +if (bitdepth == 8) { /*! fill uint8 to float lut */
> +lut[0] = 0;
> +lut[1] = SIGN_EXP_MANT_TO_UINT32(0, 119, 32897);
> +
> +exp = 119; /*! initial exp */
> +off_coeff_mant = coeff_mant = 4210752;
> +
> +for (j = 0; j < 7; ++j) {
> +exp++;
> +min_loop *= 2;
> +max_loop *= 2;
> +div = (max_loop - 1 - min_loop);
> +
> +for (i = min_loop; i < max_loop; ++i) {
> +mant = (i - min_loop) * coeff_mant / div + 32897;
> +lut[i] = SIGN_EXP_MANT_TO_UINT32(0, exp, mant);
> +}
> +
> +if (j < 6) {
> +off_coeff_mant >>= 1;
> +coeff_mant |= off_coeff_mant;
> +}
> +}
> +lut[255] = SIGN_EXP_MANT_TO_UINT32(0, 127, 0);
> +} else { /*! unsupported bitdepth */
> +av_assert0(0);
> +}
> +}
> +

> +static void alloc_uint_to_float_lut(SwsContext *c, int bitdepth) {
> +c->uint2float_lut = (float*)av_malloc(sizeof(float) * 1 << bitdepth);
> +if (!c->uint2float_lut)
> +return;
> +if (c->flags & SWS_BITEXACT) {
> +fill_uint_to_float_lut_bitexact(c, bitdepth);
> +} else {
> +fill_uint_to_float_lut(c, bitdepth);
> +}

is this complexity really needed ?

does the LUT generation code produce different results on platforms ?
if so i would suggest to try to use double and to add a small offset if needed

a 8bit table has 256 entries, a 16bit table 65536
a difference would occur if a source value from 64bit floats gets rounded
differently to 32bit floats. If this occurs a small offset could be added
so that none of the 65536 cases end up close to being between 2 32bit floats

This would avoid teh rather complex code if it works

thx

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

Democracy is the form of government in which you can choose your dictator


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


[FFmpeg-devel] [PATCH] lavf/movenc: Fail when codec tag is invalid for format

2018-08-25 Thread John Stebbins
Fixes ticket #6897
---
 libavformat/movenc.c | 40 +---
 1 file changed, 29 insertions(+), 11 deletions(-)

diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index 72a6e12d52..93bb50ce86 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -1589,6 +1589,26 @@ static const AVCodecTag codec_cover_image_tags[] = {
 { AV_CODEC_ID_NONE, 0 },
 };
 
+static int validate_codec_tag(const AVCodecTag *const *tags,
+  unsigned int tag, int codec_id)
+{
+int i;
+
+/**
+ * Check that tag + id is in the table
+ */
+for (i = 0; tags && tags[i]; i++) {
+const AVCodecTag *codec_tags = tags[i];
+while (codec_tags->id != AV_CODEC_ID_NONE) {
+if (codec_tags->tag == tag && codec_tags->id == codec_id) {
+return 1;
+}
+codec_tags++;
+}
+}
+return 0;
+}
+
 static int mov_find_codec_tag(AVFormatContext *s, MOVTrack *track)
 {
 int tag;
@@ -1596,23 +1616,21 @@ static int mov_find_codec_tag(AVFormatContext *s, 
MOVTrack *track)
 if (is_cover_image(track->st))
 return ff_codec_get_tag(codec_cover_image_tags, track->par->codec_id);
 
-if (track->mode == MODE_MP4 || track->mode == MODE_PSP)
-tag = track->par->codec_tag;
-else if (track->mode == MODE_ISM)
-tag = track->par->codec_tag;
-else if (track->mode == MODE_IPOD) {
+if (track->mode == MODE_IPOD)
 if (!av_match_ext(s->url, "m4a") &&
 !av_match_ext(s->url, "m4v") &&
 !av_match_ext(s->url, "m4b"))
 av_log(s, AV_LOG_WARNING, "Warning, extension is not .m4a nor .m4v 
"
"Quicktime/Ipod might not play the file\n");
-tag = track->par->codec_tag;
-} else if (track->mode & MODE_3GP)
-tag = track->par->codec_tag;
-else if (track->mode == MODE_F4V)
-tag = track->par->codec_tag;
-else
+
+if (track->mode == MODE_MOV)
 tag = mov_get_codec_tag(s, track);
+else
+if (!validate_codec_tag(s->oformat->codec_tag, track->par->codec_tag,
+track->par->codec_id))
+tag = 0;
+else
+tag = track->par->codec_tag;
 
 return tag;
 }
-- 
2.17.1

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


Re: [FFmpeg-devel] [PATCHv2] mpeg4video: Add Studio DPCM support

2018-08-25 Thread Michael Niedermayer
On Fri, Aug 24, 2018 at 01:14:43AM +0100, Kieran Kunhya wrote:
> 

>  mpeg4videodec.c |   91 
> ++--
>  mpegvideo.c |   73 ++--
>  mpegvideo.h |2 +
>  3 files changed, 146 insertions(+), 20 deletions(-)
> 1d61d9c27d4dd8e53d120189099704c0295ab5ba  
> 0001-mpeg4video-Add-Studio-DPCM-support.patch
> From 0f82f5dccc6a93fb091450b6bd866539ef067423 Mon Sep 17 00:00:00 2001
> From: Kieran Kunhya 
> Date: Sun, 19 Aug 2018 02:31:42 +0100
> Subject: [PATCH] mpeg4video: Add Studio DPCM support

LGTM

thx


[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

In a rich man's house there is no place to spit but his face.
-- Diogenes of Sinope


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


Re: [FFmpeg-devel] [PATCH] avcodec/utils: document allocation requirement of extradata

2018-08-25 Thread Michael Niedermayer
On Fri, Aug 24, 2018 at 08:53:29PM +0200, Timo Rothenpieler wrote:
> ---
>  libavcodec/avcodec.h | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
> index 31e50d5a94..2c5e78c88d 100644
> --- a/libavcodec/avcodec.h
> +++ b/libavcodec/avcodec.h
> @@ -1616,6 +1616,7 @@ typedef struct AVCodecContext {
>   * The allocated memory should be AV_INPUT_BUFFER_PADDING_SIZE bytes 
> larger
>   * than extradata_size to avoid problems if it is read with the 
> bitstream reader.
>   * The bytewise contents of extradata must not depend on the 
> architecture or CPU endianness.
> + * Must be allocated with the av_malloc() family of functions.
>   * - encoding: Set/allocated/freed by libavcodec.
>   * - decoding: Set/allocated/freed by user.
>   */

LGTM

thx

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

Dictatorship naturally arises out of democracy, and the most aggravated
form of tyranny and slavery out of the most extreme liberty. -- Plato


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


[FFmpeg-devel] [PATCH] configure: speedup x2-x8

2018-08-25 Thread avih
Hi,

I noticed that configure can be a bit slow - few minutes on my macOS
system, 1:30m on linux/bash, 30s on linux/dash, and even if
pathological, still a too-long 10 minutes on Windows (MSYS2) (same
duration as a full build with make -j4 after configure).

I added some timing information printouts for various parts in
configure, and eventually identified few culprits.

The attachment "config-timing.patch" adds these printouts and sorted
summary. It's attached for reference and not intended to be merged.
It applies cleanly before or after the main patch.


The attached "main.patch" addresses three areas I identified as slow:

1. About 50-70% of configure runtime was being spent inside one
   function: flatten_extralibs() and callees resolve() and unique().
   It manipulates strings and invoked nearly 20K (2) subshells.
   It was rewritten to avoid subshells, and ended up x50-x250 faster.

2. print_enabled_components() was invoking sed about 350 times on one
   file. This is never instant but takes many seconds where fork is
   slow (Windows). Invoke sed only once instead = x4-x10 speedup.

3. After the previous speedups, configure spent 20-60% of its runtime
   at check_deps(). It's particularly slow with bash. After some local
   optimizations - mainly avoid pushvar/popvar and abort early in one
   notable case (empty deps), it's now x4-x25 faster.


Some resulting speedups (more details at "before-after.txt"):

- macOS/bash:  total: 98s -> 22s    flatten_extralibs:  53s -> 0.7s
- Linux/bash:  total: 87s -> 11s    flatten_extralibs:  59s -> 0.9s
- Linux/dash:  total: 27s ->  8s    flatten_extralibs:  17s -> 0.2s
- FreeBSD/sh:  total: 34s ->  9s    flatten_extralibs:  23s -> 0.2s
- MSYS2/bash:  total: 10m -> 2:30m  flatten_extralibs: 400s -> 1.5s (!)


Notes:

- unique() is modified with flatten_extralibs. It now outputs different
  order: it was keeping the last instance of recurring items, now it
  keeps the first. It affects libs order at ffbuild/config.{mak,sh} -
  but I don't think it matters. If it does, "opt1-reorder-unique.patch"
  restores the original order. Let me know if/why it matters and I'll
  squash it and update the commit message accordingly if required.

- After the check_deps() patch, pushvar() and popvar() are not used but
  I was hesitant to remove them (nice to have). If you think it should
  be removed, the patch "opt2-remove-pushvar.patch" removes them.

- The patches assume POSIX shell and don't use anything "tricky".
  It was tested with dash, bash, busybox-ash, freebsd-sh, ksh93u, mksh.

- Thanks to tmm1 and atomnuker for their help with testing.


This is my first mail to this list, and I wasn't sure how to split the
patches. After asking a veteran, it was suggested to me that I should
put all of them in one email. Just let me know if you prefer something
else (dev mailing lists are not my forte...).

For convinience, the patches are also available at:
https://gist.github.com/avih/f51008225d4a20a0981daed1faca4bc2

Regards,
AviFrom 4d0654798f50bcf1c68a07927511bde17ab723be Mon Sep 17 00:00:00 2001
From: "Avi Halachmi (:avih)" 
Date: Tue, 31 Jul 2018 03:22:52 +0300
Subject: [PATCH] configure: print timing information

Add the file tools/time.sh, and use it from configure to print timing
information and sorted summary, while isolating prominent sections.

The chosen sections/names are (in runtime order):
- Init
- Options review
- Compilation tests
- check_deps()
- Prepare deps
- flatten_extralibs_wrapper()
- Writing config
- print_enabled_components()
- Finalize

Where the foo_bar() names are execution solely of the function foo_bar, and
the rest are descriptive-ish.
---
 configure | 21 
 tools/time.sh | 94 +++
 2 files changed, 115 insertions(+)
 create mode 100644 tools/time.sh

diff --git a/configure b/configure
index b9c9d0b3..07398852 100755
--- a/configure
+++ b/configure
@@ -11,6 +11,9 @@
 LC_ALL=C
 export LC_ALL
 
+. "$(dirname "$0")"/tools/time.sh
+time_switch_to Init
+
 # make sure we are running under a compatible shell
 # try to make this part work with most shells
 
@@ -3633,6 +3636,8 @@ host_ldflags_filter=echo
 
 target_path='$(CURDIR)'
 
+time_switch_to "Options review"
+
 # since the object filename is not given with the -MM flag, the compiler
 # is only able to print the basename, and we must add the path ourselves
 DEPCMD='$(DEP$(1)) $(DEP$(1)FLAGS) $($(1)DEP_FLAGS) $< 2>/dev/null | sed -e "/^\#.*/d" -e "s,^[[:space:]]*$(@F),$(@D)/$(@F)," > $(@:.o=.d)'
@@ -4116,6 +4121,8 @@ exesuf() {
 EXESUF=$(exesuf $target_os)
 HOSTEXESUF=$(exesuf $host_os)
 
+time_switch_to "Compilation tests"
+
 # set temporary file name
 : ${TMPDIR:=$TEMPDIR}
 : ${TMPDIR:=$TMP}
@@ -6720,11 +6727,15 @@ enable frame_thread_encoder
 
 enabled asm || { arch=c; disable $ARCH_LIST $ARCH_EXT_LIST; }
 
+time_switch_to "check_deps()"
+
 check_deps $CONFIG_LIST   \
$CONFIG_EXTRA  \
$HAVE_LIST 

Re: [FFmpeg-devel] [PATCH] Support 64-bit integers for av_get_frame_filename2()

2018-08-25 Thread James Almer
On 8/25/2018 10:30 AM, Marton Balint wrote:
> 
> 
> On Sat, 25 Aug 2018, Michael Niedermayer wrote:
> 
>> On Fri, Aug 24, 2018 at 04:33:18PM -0300, James Almer wrote:
>>> On 8/24/2018 3:56 PM, Devin Heitmueller wrote:
 Create a new av_get_frame_filename3() API which is just like the
 previous version but accepts a 64-bit integer for the "number"
 argument.  This is useful in cases where you want to put the
 original PTS into the filename (which can be larger than 32-bits).

 Tested with:

 ./ffmpeg -copyts -vsync 0 -i foo.ts -frame_pts 1 -enc_time_base -1
 foo_%d.png

 Signed-off-by: Devin Heitmueller 
 ---
  libavformat/avformat.h | 2 ++
  libavformat/img2enc.c  | 2 +-
  libavformat/utils.c    | 9 +++--
  3 files changed, 10 insertions(+), 3 deletions(-)
>>>
>>> Missing APIChanges entry and libavformat minor version bump.
>>>

 diff --git a/libavformat/avformat.h b/libavformat/avformat.h
 index fdaffa5bf4..c358a9a71e 100644
 --- a/libavformat/avformat.h
 +++ b/libavformat/avformat.h
 @@ -2896,6 +2896,8 @@ void av_dump_format(AVFormatContext *ic,
   * @param flags AV_FRAME_FILENAME_FLAGS_*
   * @return 0 if OK, -1 on format error
   */
 +int av_get_frame_filename3(char *buf, int buf_size,
 +  const char *path, int64_t number, int
 flags);
>>>
>>> Make buf_size of size_t type while at it.
>>>
  int av_get_frame_filename2(char *buf, int buf_size,
    const char *path, int number, int flags);

 diff --git a/libavformat/img2enc.c b/libavformat/img2enc.c
 index a09cc8ec50..414eb827e2 100644
 --- a/libavformat/img2enc.c
 +++ b/libavformat/img2enc.c
 @@ -101,7 +101,7 @@ static int write_packet(AVFormatContext *s,
 AVPacket *pkt)
  return AVERROR(EINVAL);
  }
  } else if (img->frame_pts) {
 -    if (av_get_frame_filename2(filename, sizeof(filename),
 img->path, pkt->pts, AV_FRAME_FILENAME_FLAGS_MULTIPLE) < 0) {
 +    if (av_get_frame_filename3(filename, sizeof(filename),
 img->path, pkt->pts, AV_FRAME_FILENAME_FLAGS_MULTIPLE) < 0) {
  av_log(s, AV_LOG_ERROR, "Cannot write filename by
 pts of the frames.");
  return AVERROR(EINVAL);
  }
 diff --git a/libavformat/utils.c b/libavformat/utils.c
 index b0b5e164a6..d9d4d38a44 100644
 --- a/libavformat/utils.c
 +++ b/libavformat/utils.c
 @@ -4666,7 +4666,7 @@ uint64_t ff_get_formatted_ntp_time(uint64_t
 ntp_time_us)
  return ntp_ts;
  }

 -int av_get_frame_filename2(char *buf, int buf_size, const char
 *path, int number, int flags)
 +int av_get_frame_filename3(char *buf, int buf_size, const char
 *path, int64_t number, int flags)
  {
  const char *p;
  char *q, buf1[20], c;
 @@ -4696,7 +4696,7 @@ int av_get_frame_filename2(char *buf, int
 buf_size, const char *path, int number
  percentd_found = 1;
  if (number < 0)
  nd += 1;
 -    snprintf(buf1, sizeof(buf1), "%0*d", nd, number);
 +    snprintf(buf1, sizeof(buf1), "%0*" PRId64, nd,
 number);
>>>
>>> SCNd64.
>>>
  len = strlen(buf1);
  if ((q - buf + len) > buf_size - 1)
  goto fail;
 @@ -4721,6 +4721,11 @@ fail:
  return -1;
  }

 +int av_get_frame_filename2(char *buf, int buf_size, const char
 *path, int number, int flags)
 +{
 +    return av_get_frame_filename3(buf, buf_size, path, number, flags);
 +}
 +
  int av_get_frame_filename(char *buf, int buf_size, const char
 *path, int number)
  {
  return av_get_frame_filename2(buf, buf_size, path, number, 0);

>>>
>>> No opinion on the addition, so wait for someone else to review as well.
>>
>> i think it makes sense
>>
>> also the old function should be deprecated. I think theres no reason to
>> use the old one if the 64bit one is added. We could refrain from removing
>> the old though for longer as it has no risk of breaking. But deprecation
>> would notify users that we have something newer/better to replace it
> 
> Well, actually av_get_frame_filename3 should be deprecated too soon,
> because users should not use these functions because they limit the file
> path to a fixed length. An AVBPrintf based replacement should be used
> instead in the long run.
> 
> On the other hand that is a bit more work, so I am fine with the patch
> as is.

No, adding a function that will be obsolete from day 1 is not a good
idea. Adding API is simple, but removing it takes years. So lets instead
add one using AVBPrintf that will be definite.

Also not called whatever3 while at it, if possible.

> 
> Thanks,
> Marton

__

Re: [FFmpeg-devel] [PATCH] Support 64-bit integers for av_get_frame_filename2()

2018-08-25 Thread Marton Balint



On Sat, 25 Aug 2018, Michael Niedermayer wrote:


On Fri, Aug 24, 2018 at 04:33:18PM -0300, James Almer wrote:

On 8/24/2018 3:56 PM, Devin Heitmueller wrote:

Create a new av_get_frame_filename3() API which is just like the
previous version but accepts a 64-bit integer for the "number"
argument.  This is useful in cases where you want to put the
original PTS into the filename (which can be larger than 32-bits).

Tested with:

./ffmpeg -copyts -vsync 0 -i foo.ts -frame_pts 1 -enc_time_base -1 foo_%d.png

Signed-off-by: Devin Heitmueller 
---
 libavformat/avformat.h | 2 ++
 libavformat/img2enc.c  | 2 +-
 libavformat/utils.c| 9 +++--
 3 files changed, 10 insertions(+), 3 deletions(-)


Missing APIChanges entry and libavformat minor version bump.



diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index fdaffa5bf4..c358a9a71e 100644
--- a/libavformat/avformat.h
+++ b/libavformat/avformat.h
@@ -2896,6 +2896,8 @@ void av_dump_format(AVFormatContext *ic,
  * @param flags AV_FRAME_FILENAME_FLAGS_*
  * @return 0 if OK, -1 on format error
  */
+int av_get_frame_filename3(char *buf, int buf_size,
+  const char *path, int64_t number, int flags);


Make buf_size of size_t type while at it.


 int av_get_frame_filename2(char *buf, int buf_size,
   const char *path, int number, int flags);

diff --git a/libavformat/img2enc.c b/libavformat/img2enc.c
index a09cc8ec50..414eb827e2 100644
--- a/libavformat/img2enc.c
+++ b/libavformat/img2enc.c
@@ -101,7 +101,7 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt)
 return AVERROR(EINVAL);
 }
 } else if (img->frame_pts) {
-if (av_get_frame_filename2(filename, sizeof(filename), img->path, 
pkt->pts, AV_FRAME_FILENAME_FLAGS_MULTIPLE) < 0) {
+if (av_get_frame_filename3(filename, sizeof(filename), img->path, 
pkt->pts, AV_FRAME_FILENAME_FLAGS_MULTIPLE) < 0) {
 av_log(s, AV_LOG_ERROR, "Cannot write filename by pts of the 
frames.");
 return AVERROR(EINVAL);
 }
diff --git a/libavformat/utils.c b/libavformat/utils.c
index b0b5e164a6..d9d4d38a44 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -4666,7 +4666,7 @@ uint64_t ff_get_formatted_ntp_time(uint64_t ntp_time_us)
 return ntp_ts;
 }

-int av_get_frame_filename2(char *buf, int buf_size, const char *path, int 
number, int flags)
+int av_get_frame_filename3(char *buf, int buf_size, const char *path, int64_t 
number, int flags)
 {
 const char *p;
 char *q, buf1[20], c;
@@ -4696,7 +4696,7 @@ int av_get_frame_filename2(char *buf, int buf_size, const 
char *path, int number
 percentd_found = 1;
 if (number < 0)
 nd += 1;
-snprintf(buf1, sizeof(buf1), "%0*d", nd, number);
+snprintf(buf1, sizeof(buf1), "%0*" PRId64, nd, number);


SCNd64.


 len = strlen(buf1);
 if ((q - buf + len) > buf_size - 1)
 goto fail;
@@ -4721,6 +4721,11 @@ fail:
 return -1;
 }

+int av_get_frame_filename2(char *buf, int buf_size, const char *path, int 
number, int flags)
+{
+return av_get_frame_filename3(buf, buf_size, path, number, flags);
+}
+
 int av_get_frame_filename(char *buf, int buf_size, const char *path, int 
number)
 {
 return av_get_frame_filename2(buf, buf_size, path, number, 0);



No opinion on the addition, so wait for someone else to review as well.


i think it makes sense

also the old function should be deprecated. I think theres no reason to
use the old one if the 64bit one is added. We could refrain from removing
the old though for longer as it has no risk of breaking. But deprecation
would notify users that we have something newer/better to replace it


Well, actually av_get_frame_filename3 should be deprecated too soon, 
because users should not use these functions because they limit the file 
path to a fixed length. An AVBPrintf based replacement should be used 
instead in the long run.


On the other hand that is a bit more work, so I am fine with the patch as 
is.


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


Re: [FFmpeg-devel] [PATCH] Support 64-bit integers for av_get_frame_filename2()

2018-08-25 Thread Michael Niedermayer
On Fri, Aug 24, 2018 at 04:33:18PM -0300, James Almer wrote:
> On 8/24/2018 3:56 PM, Devin Heitmueller wrote:
> > Create a new av_get_frame_filename3() API which is just like the
> > previous version but accepts a 64-bit integer for the "number"
> > argument.  This is useful in cases where you want to put the
> > original PTS into the filename (which can be larger than 32-bits).
> > 
> > Tested with:
> > 
> > ./ffmpeg -copyts -vsync 0 -i foo.ts -frame_pts 1 -enc_time_base -1 
> > foo_%d.png
> > 
> > Signed-off-by: Devin Heitmueller 
> > ---
> >  libavformat/avformat.h | 2 ++
> >  libavformat/img2enc.c  | 2 +-
> >  libavformat/utils.c| 9 +++--
> >  3 files changed, 10 insertions(+), 3 deletions(-)
> 
> Missing APIChanges entry and libavformat minor version bump.
> 
> > 
> > diff --git a/libavformat/avformat.h b/libavformat/avformat.h
> > index fdaffa5bf4..c358a9a71e 100644
> > --- a/libavformat/avformat.h
> > +++ b/libavformat/avformat.h
> > @@ -2896,6 +2896,8 @@ void av_dump_format(AVFormatContext *ic,
> >   * @param flags AV_FRAME_FILENAME_FLAGS_*
> >   * @return 0 if OK, -1 on format error
> >   */
> > +int av_get_frame_filename3(char *buf, int buf_size,
> > +  const char *path, int64_t number, int flags);
> 
> Make buf_size of size_t type while at it.
> 
> >  int av_get_frame_filename2(char *buf, int buf_size,
> >const char *path, int number, int flags);
> >  
> > diff --git a/libavformat/img2enc.c b/libavformat/img2enc.c
> > index a09cc8ec50..414eb827e2 100644
> > --- a/libavformat/img2enc.c
> > +++ b/libavformat/img2enc.c
> > @@ -101,7 +101,7 @@ static int write_packet(AVFormatContext *s, AVPacket 
> > *pkt)
> >  return AVERROR(EINVAL);
> >  }
> >  } else if (img->frame_pts) {
> > -if (av_get_frame_filename2(filename, sizeof(filename), 
> > img->path, pkt->pts, AV_FRAME_FILENAME_FLAGS_MULTIPLE) < 0) {
> > +if (av_get_frame_filename3(filename, sizeof(filename), 
> > img->path, pkt->pts, AV_FRAME_FILENAME_FLAGS_MULTIPLE) < 0) {
> >  av_log(s, AV_LOG_ERROR, "Cannot write filename by pts of 
> > the frames.");
> >  return AVERROR(EINVAL);
> >  }
> > diff --git a/libavformat/utils.c b/libavformat/utils.c
> > index b0b5e164a6..d9d4d38a44 100644
> > --- a/libavformat/utils.c
> > +++ b/libavformat/utils.c
> > @@ -4666,7 +4666,7 @@ uint64_t ff_get_formatted_ntp_time(uint64_t 
> > ntp_time_us)
> >  return ntp_ts;
> >  }
> >  
> > -int av_get_frame_filename2(char *buf, int buf_size, const char *path, int 
> > number, int flags)
> > +int av_get_frame_filename3(char *buf, int buf_size, const char *path, 
> > int64_t number, int flags)
> >  {
> >  const char *p;
> >  char *q, buf1[20], c;
> > @@ -4696,7 +4696,7 @@ int av_get_frame_filename2(char *buf, int buf_size, 
> > const char *path, int number
> >  percentd_found = 1;
> >  if (number < 0)
> >  nd += 1;
> > -snprintf(buf1, sizeof(buf1), "%0*d", nd, number);
> > +snprintf(buf1, sizeof(buf1), "%0*" PRId64, nd, number);
> 
> SCNd64.
> 
> >  len = strlen(buf1);
> >  if ((q - buf + len) > buf_size - 1)
> >  goto fail;
> > @@ -4721,6 +4721,11 @@ fail:
> >  return -1;
> >  }
> >  
> > +int av_get_frame_filename2(char *buf, int buf_size, const char *path, int 
> > number, int flags)
> > +{
> > +return av_get_frame_filename3(buf, buf_size, path, number, flags);
> > +}
> > +
> >  int av_get_frame_filename(char *buf, int buf_size, const char *path, int 
> > number)
> >  {
> >  return av_get_frame_filename2(buf, buf_size, path, number, 0);
> > 
> 
> No opinion on the addition, so wait for someone else to review as well.

i think it makes sense

also the old function should be deprecated. I think theres no reason to
use the old one if the 64bit one is added. We could refrain from removing
the old though for longer as it has no risk of breaking. But deprecation
would notify users that we have something newer/better to replace it

thx

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

Those who are best at talking, realize last or never when they are wrong.


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


Re: [FFmpeg-devel] make work (live) libsrt

2018-08-25 Thread Tudor Suciu
Hello Marton,

The new version takes into account your remarks, modifications.

Regards,
From 11cd8cf4bedecc88700424f1a0782beafe70c9f1 Mon Sep 17 00:00:00 2001
From: Tudor Suciu 
Date: Sat, 25 Aug 2018 14:06:57 +0200
Subject: [PATCH] add pkt_length to libsrt

---
 doc/protocols.texi   | 7 +++
 libavformat/libsrt.c | 8 
 2 files changed, 15 insertions(+)

diff --git a/doc/protocols.texi b/doc/protocols.texi
index e9091e068c..076ec5bc14 100644
--- a/doc/protocols.texi
+++ b/doc/protocols.texi
@@ -1263,6 +1263,13 @@ Not required on receiver (set to 0),
 key size obtained from sender in HaiCrypt handshake.
 Default value is 0.
 
+@item pkt_size=@var{bytes}
+Set maximum send pkt_size size, expressed in bytes.
+Libsrt expects by default payloads of 1316 bytes.
+Libsrt could be configured up to maximum usefull payload
+size in ethernet packets of 1456. The libsrt documents it
+as MTU(1500) - UDP.hdr(28) - SRT.hdr(16).
+
 @item recv_buffer_size=@var{bytes}
 Set receive buffer size, expressed in bytes.
 
diff --git a/libavformat/libsrt.c b/libavformat/libsrt.c
index 0f9529d263..ca6989f316 100644
--- a/libavformat/libsrt.c
+++ b/libavformat/libsrt.c
@@ -48,6 +48,7 @@ typedef struct SRTContext {
 int64_t listen_timeout;
 int recv_buffer_size;
 int send_buffer_size;
+int pkt_size;
 
 int64_t maxbw;
 int pbkeylen;
@@ -73,6 +74,7 @@ static const AVOption libsrt_options[] = {
 { "listen_timeout", "Connection awaiting timeout",  OFFSET(listen_timeout),   AV_OPT_TYPE_INT64, { .i64 = -1 }, -1, INT64_MAX, .flags = D|E },
 { "send_buffer_size", "Socket send buffer size (in bytes)", OFFSET(send_buffer_size), AV_OPT_TYPE_INT,  { .i64 = -1 }, -1, INT_MAX,   .flags = D|E },
 { "recv_buffer_size", "Socket receive buffer size (in bytes)",  OFFSET(recv_buffer_size), AV_OPT_TYPE_INT,  { .i64 = -1 }, -1, INT_MAX,   .flags = D|E },
+{ "pkt_size",   "Maximum SRT packet size",  OFFSET(pkt_size), AV_OPT_TYPE_INT,  { .i64 = 1316 }, 1, INT_MAX,  .flags = D|E },
 { "maxbw",  "Maximum bandwidth (bytes per second) that the connection can use", OFFSET(maxbw),AV_OPT_TYPE_INT64,{ .i64 = -1 }, -1, INT64_MAX, .flags = D|E },
 { "pbkeylen",   "Crypto key len in bytes {16,24,32} Default: 16 (128-bit)", OFFSET(pbkeylen), AV_OPT_TYPE_INT,  { .i64 = -1 }, -1, 32,.flags = D|E },
 { "passphrase", "Crypto PBKDF2 Passphrase size[0,10..64] 0:disable crypto", OFFSET(passphrase),   AV_OPT_TYPE_STRING,   { .str = NULL },  .flags = D|E },
@@ -442,6 +444,9 @@ static int libsrt_open(URLContext *h, const char *uri, int flags)
 if (av_find_info_tag(buf, sizeof(buf), "oheadbw", p)) {
 s->oheadbw = strtoll(buf, NULL, 10);
 }
+if (av_find_info_tag(buf, sizeof(buf), "pkt_size", p)) {
+s->pkt_size = strtol(buf, NULL, 10);
+}
 if (av_find_info_tag(buf, sizeof(buf), "tsbpddelay", p)) {
 s->tsbpddelay = strtol(buf, NULL, 10);
 }
@@ -466,6 +471,9 @@ static int libsrt_open(URLContext *h, const char *uri, int flags)
 }
 }
 }
+if (flags & AVIO_FLAG_WRITE) {
+h->max_packet_size = s->pkt_size > 0 ? s->pkt_size : 1316;
+}
 return libsrt_setup(h, uri, flags);
 }
 
-- 
2.11.0

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


Re: [FFmpeg-devel] [PATCH 1/1] libavformat/mxfenc: add missing dnxhr mxf container essence ULs

2018-08-25 Thread Tomas Härdin
lör 2018-08-25 klockan 02:00 -0700 skrev j...@wizardofthenet.com:
> > From: Jason Stevens 
> 
> ---
>  libavformat/mxfenc.c | 47 
>  1 file changed, 47 insertions(+)
> 
> diff --git a/libavformat/mxfenc.c b/libavformat/mxfenc.c
> index 7f629dbe53..cf58c8b834 100644
> --- a/libavformat/mxfenc.c
> +++ b/libavformat/mxfenc.c
> @@ -146,6 +146,11 @@ enum ULIndex {
>  INDEX_DNXHD_720p_8bit_HIGH,
>  INDEX_DNXHD_720p_8bit_MEDIUM,
>  INDEX_DNXHD_720p_8bit_LOW,
> +INDEX_DNXHR_LB,
> +INDEX_DNXHR_SQ,
> +INDEX_DNXHR_HQ,
> +INDEX_DNXHR_HQX,
> +INDEX_DNXHR_444,
>  INDEX_JPEG2000,
>  INDEX_H264,
>  };
> @@ -345,6 +350,31 @@ static const MXFContainerEssenceEntry 
> mxf_essence_container_uls[] = {
>    { 
> 0x06,0x0e,0x2b,0x34,0x01,0x02,0x01,0x01,0x0d,0x01,0x03,0x01,0x15,0x01,0x05,0x00
>  },
>    { 
> 0x06,0x0e,0x2b,0x34,0x04,0x01,0x01,0x0A,0x04,0x01,0x02,0x02,0x71,0x13,0x00,0x00
>  },
>    mxf_write_cdci_desc },
> +// DNxHR LB - CID 1274
> +{ { 
> 0x06,0x0e,0x2b,0x34,0x04,0x01,0x01,0x01,0x0d,0x01,0x03,0x01,0x02,0x11,0x01,0x00
>  },
> +  { 
> 0x06,0x0e,0x2b,0x34,0x01,0x02,0x01,0x01,0x0d,0x01,0x03,0x01,0x15,0x01,0x05,0x00
>  },
> +  { 
> 0x06,0x0e,0x2b,0x34,0x04,0x01,0x01,0x0A,0x04,0x01,0x02,0x02,0x71,0x28,0x00,0x00
>  },
> +  mxf_write_cdci_desc },
> +// DNxHR SQ - CID 1273
> +{ { 
> 0x06,0x0e,0x2b,0x34,0x04,0x01,0x01,0x01,0x0d,0x01,0x03,0x01,0x02,0x11,0x01,0x00
>  },
> +  { 
> 0x06,0x0e,0x2b,0x34,0x01,0x02,0x01,0x01,0x0d,0x01,0x03,0x01,0x15,0x01,0x05,0x00
>  },
> +  { 
> 0x06,0x0e,0x2b,0x34,0x04,0x01,0x01,0x0A,0x04,0x01,0x02,0x02,0x71,0x27,0x00,0x00
>  },
> +  mxf_write_cdci_desc },
> +// DNxHR HQ - CID 1272
> +{ { 
> 0x06,0x0e,0x2b,0x34,0x04,0x01,0x01,0x01,0x0d,0x01,0x03,0x01,0x02,0x11,0x01,0x00
>  },
> +  { 
> 0x06,0x0e,0x2b,0x34,0x01,0x02,0x01,0x01,0x0d,0x01,0x03,0x01,0x15,0x01,0x05,0x00
>  },
> +  { 
> 0x06,0x0e,0x2b,0x34,0x04,0x01,0x01,0x0A,0x04,0x01,0x02,0x02,0x71,0x26,0x00,0x00
>  },
> +  mxf_write_cdci_desc },
> +// DNxHR HQX - CID 1271
> +{ { 
> 0x06,0x0e,0x2b,0x34,0x04,0x01,0x01,0x01,0x0d,0x01,0x03,0x01,0x02,0x11,0x01,0x00
>  },
> +  { 
> 0x06,0x0e,0x2b,0x34,0x01,0x02,0x01,0x01,0x0d,0x01,0x03,0x01,0x15,0x01,0x05,0x00
>  },
> +  { 
> 0x06,0x0e,0x2b,0x34,0x04,0x01,0x01,0x0A,0x04,0x01,0x02,0x02,0x71,0x25,0x00,0x00
>  },
> +  mxf_write_cdci_desc },
> +// DNxHR 444 - CID 1270
> +{ { 
> 0x06,0x0e,0x2b,0x34,0x04,0x01,0x01,0x01,0x0d,0x01,0x03,0x01,0x02,0x11,0x01,0x00
>  },
> +  { 
> 0x06,0x0e,0x2b,0x34,0x01,0x02,0x01,0x01,0x0d,0x01,0x03,0x01,0x15,0x01,0x05,0x00
>  },
> +  { 
> 0x06,0x0e,0x2b,0x34,0x04,0x01,0x01,0x0A,0x04,0x01,0x02,0x02,0x71,0x24,0x00,0x00
>  },
> +  mxf_write_cdci_desc },
>  // JPEG2000
>  { { 
> 0x06,0x0e,0x2b,0x34,0x04,0x01,0x01,0x07,0x0d,0x01,0x03,0x01,0x02,0x0c,0x01,0x00
>  },
>    { 
> 0x06,0x0e,0x2b,0x34,0x01,0x02,0x01,0x01,0x0d,0x01,0x03,0x01,0x15,0x01,0x08,0x00
>  },
> @@ -1998,6 +2028,23 @@ AVPacket *pkt)
>  case 1253:
>  sc->index = INDEX_DNXHD_720p_8bit_LOW;
>  break;
> +case 1274:
> +sc->index = INDEX_DNXHR_LB;
> +break;
> +case 1273:
> +sc->index = INDEX_DNXHR_SQ;
> +break;
> +case 1272:
> +sc->index = INDEX_DNXHR_HQ;
> +break;
> +case 1271:
> +sc->index = INDEX_DNXHR_HQX;
> +sc->component_depth = 10;
> +break;
> +case 1270:
> +sc->index = INDEX_DNXHR_444;
> +sc->component_depth = 10;
> +break;
>  default:
>  return -1;
>  }

Don't have any idea about DNxHR, else the code looks OK enough.

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


[FFmpeg-devel] [PATCH] avcodec: add HYMT decoder

2018-08-25 Thread Paul B Mahol
Signed-off-by: Paul B Mahol 
---
 libavcodec/Makefile |   1 +
 libavcodec/allcodecs.c  |   1 +
 libavcodec/avcodec.h|   1 +
 libavcodec/codec_desc.c |   7 ++
 libavcodec/huffyuvdec.c | 174 +++-
 libavformat/riff.c  |   1 +
 6 files changed, 128 insertions(+), 57 deletions(-)

diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 9a309c348e..c9335f39fa 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -381,6 +381,7 @@ OBJS-$(CONFIG_HQ_HQA_DECODER)  += hq_hqa.o 
hq_hqadata.o hq_hqadsp.o \
 OBJS-$(CONFIG_HQX_DECODER) += hqx.o hqxvlc.o hqxdsp.o canopus.o
 OBJS-$(CONFIG_HUFFYUV_DECODER) += huffyuv.o huffyuvdec.o
 OBJS-$(CONFIG_HUFFYUV_ENCODER) += huffyuv.o huffyuvenc.o
+OBJS-$(CONFIG_HYMT_DECODER)+= huffyuv.o huffyuvdec.o
 OBJS-$(CONFIG_IDCIN_DECODER)   += idcinvideo.o
 OBJS-$(CONFIG_IDF_DECODER) += bintext.o cga_data.o
 OBJS-$(CONFIG_IFF_ILBM_DECODER)+= iff.o
diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
index b1d1ef26c0..53ab6e0025 100644
--- a/libavcodec/allcodecs.c
+++ b/libavcodec/allcodecs.c
@@ -151,6 +151,7 @@ extern AVCodec ff_hq_hqa_decoder;
 extern AVCodec ff_hqx_decoder;
 extern AVCodec ff_huffyuv_encoder;
 extern AVCodec ff_huffyuv_decoder;
+extern AVCodec ff_hymt_decoder;
 extern AVCodec ff_idcin_decoder;
 extern AVCodec ff_iff_ilbm_decoder;
 extern AVCodec ff_imm4_decoder;
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 2a4be2ca4f..d428be4741 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -449,6 +449,7 @@ enum AVCodecID {
 AV_CODEC_ID_FITS,
 AV_CODEC_ID_IMM4,
 AV_CODEC_ID_PROSUMER,
+AV_CODEC_ID_HYMT,
 
 /* various PCM "codecs" */
 AV_CODEC_ID_FIRST_AUDIO = 0x1, ///< A dummy id pointing at the 
start of audio codecs
diff --git a/libavcodec/codec_desc.c b/libavcodec/codec_desc.c
index e611183599..362dc253c2 100644
--- a/libavcodec/codec_desc.c
+++ b/libavcodec/codec_desc.c
@@ -1668,6 +1668,13 @@ static const AVCodecDescriptor codec_descriptors[] = {
 .long_name = NULL_IF_CONFIG_SMALL("Brooktree ProSumer Video"),
 .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY,
 },
+{
+.id= AV_CODEC_ID_HYMT,
+.type  = AVMEDIA_TYPE_VIDEO,
+.name  = "hymt",
+.long_name = NULL_IF_CONFIG_SMALL("HuffYUV MT"),
+.props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS,
+},
 
 /* various PCM "codecs" */
 {
diff --git a/libavcodec/huffyuvdec.c b/libavcodec/huffyuvdec.c
index 66357bfb40..4e00692631 100644
--- a/libavcodec/huffyuvdec.c
+++ b/libavcodec/huffyuvdec.c
@@ -905,54 +905,23 @@ static void add_median_prediction(HYuvContext *s, uint8_t 
*dst, const uint8_t *s
 s->hdsp.add_hfyu_median_pred_int16((uint16_t *)dst, (const uint16_t 
*)src, (const uint16_t *)diff, s->n-1, w, left, left_top);
 }
 }
-static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
-AVPacket *avpkt)
+
+static int decode_slice(AVCodecContext *avctx, AVFrame *p, int height,
+int buf_size, int y_offset, int table_size)
 {
-const uint8_t *buf = avpkt->data;
-int buf_size   = avpkt->size;
 HYuvContext *s = avctx->priv_data;
+int fake_ystride, fake_ustride, fake_vstride;
 const int width  = s->width;
 const int width2 = s->width >> 1;
-const int height = s->height;
-int fake_ystride, fake_ustride, fake_vstride;
-ThreadFrame frame = { .f = data };
-AVFrame *const p = data;
-int table_size = 0, ret;
-
-if (buf_size < (width * height + 7)/8)
-return AVERROR_INVALIDDATA;
-
-av_fast_padded_malloc(&s->bitstream_buffer,
-   &s->bitstream_buffer_size,
-   buf_size);
-if (!s->bitstream_buffer)
-return AVERROR(ENOMEM);
-
-s->bdsp.bswap_buf((uint32_t *) s->bitstream_buffer,
-  (const uint32_t *) buf, buf_size / 4);
-
-if ((ret = ff_thread_get_buffer(avctx, &frame, 0)) < 0)
-return ret;
-
-if (s->context) {
-table_size = read_huffman_tables(s, s->bitstream_buffer, buf_size);
-if (table_size < 0)
-return table_size;
-}
-
-if ((unsigned) (buf_size - table_size) >= INT_MAX / 8)
-return AVERROR_INVALIDDATA;
+int ret;
 
-if ((ret = init_get_bits(&s->gb, s->bitstream_buffer + table_size,
- (buf_size - table_size) * 8)) < 0)
+if ((ret = init_get_bits8(&s->gb, s->bitstream_buffer + table_size, 
buf_size - table_size)) < 0)
 return ret;
 
 fake_ystride = s->interlaced ? p->linesize[0] * 2 : p->linesize[0];
 fake_ustride = s->interlaced ? p->linesize[1] * 2 : p->linesize[1];
 fake_vstride = s->interlaced ? p->linesize[2] * 2 : p->linesize[2];
 
-s->last_slice_end = 0;
-
 if (s->version > 2) {
 int plane;
 f

Re: [FFmpeg-devel] make work (live) libsrt

2018-08-25 Thread Marton Balint



On Sat, 25 Aug 2018, Marton Balint wrote:




On Sat, 25 Aug 2018, Tudor Suciu wrote:


Hello,

Is this patch in a better shape for inclusion?


The code seems OK, please resend the patch with a docs/protocols.texi 
update for the new option.


On the second look, there are some strange things:



@@ -73,6 +74,7 @@ static const AVOption libsrt_options[] = {
 { "listen_timeout", "Connection awaiting timeout", 
 OFFSET(listen_timeout),   AV_OPT_TYPE_INT64, { .i64 = -1 }, -1, INT64_MAX, .flags 
= D|E },
 { "send_buffer_size", "Socket send buffer size (in bytes)",
 OFFSET(send_buffer_size), AV_OPT_TYPE_INT,  { .i64 = -1 }, -1, INT_MAX,   
.flags = D|E },
 { "recv_buffer_size", "Socket receive buffer size (in bytes)", 
 OFFSET(recv_buffer_size), AV_OPT_TYPE_INT,  { .i64 = -1 }, -1, INT_MAX,   
.flags = D|E },
+{ "pkt_size",   "Maximum SRT packet size", 
 OFFSET(pkt_size), AV_OPT_TYPE_INT,  { .i64 = 1316 },  -1, INT_MAX,   
.flags = D|E },


minimum value is 1, not -1.


+if (flags & AVIO_FLAG_WRITE) {
+h->max_packet_size = 1316;
+}
+


See below.


@@ -466,6 +475,9 @@ static int libsrt_open(URLContext *h, const char *uri, int 
flags)
 }
 }
 }
+if (flags & AVIO_FLAG_WRITE && s->pkt_size > 0) {
+h->max_packet_size = s->pkt_size;
+}


You can simplify this to:

if (flags & AVIO_FLAG_WRITE)
   h->max_packet_size = s->pkt_size > 0 ? s->pkt_size : 1316;

This way the chunk before this one is not needed.

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


Re: [FFmpeg-devel] make work (live) libsrt

2018-08-25 Thread Marton Balint



On Sat, 25 Aug 2018, Tudor Suciu wrote:


Hello,

Is this patch in a better shape for inclusion?


The code seems OK, please resend the patch with a docs/protocols.texi 
update for the new option.


Thanks,
Marton




Regards,

On Fri, Aug 24, 2018 at 2:46 AM myp...@gmail.com  wrote:


On Fri, Aug 24, 2018 at 2:55 AM Marton Balint  wrote:




On Thu, 23 Aug 2018, myp...@gmail.com wrote:


On Wed, Aug 22, 2018 at 4:30 AM Tudor Suciu 

wrote:


Hello,

I get errors when I try to send a live srt stream that the first

packet is

too big:
21:30:39.896626/ffmpeg*E: SRT.c: LiveSmoother: payload size: 1504

exceeds

maximum allowed 1316

Here are example commands for server and client:
ffmpeg -re -i ~/Downloads/ToS-4k-1920.mov -vcodec libx264 -g 50 -refs

1 -s

640x360 -b:v 1000k -acodec aac -b:a 64k -flush_packets 0 -f mpegts

"srt://

127.0.0.1:?mode=listener"
ffplay srt://127.0.0.1:

A patch that fully solves the issue is:
diff --git a/libavformat/libsrt.c b/libavformat/libsrt.c
index 0f9529d263..156a4776e2 100644
--- a/libavformat/libsrt.c
+++ b/libavformat/libsrt.c
@@ -412,6 +412,8 @@ static int libsrt_open(URLContext *h, const char

*uri,

int flags)
 return AVERROR_UNKNOWN;
 }

+h->max_packet_size = 1316;
+
 /* SRT options (srt/srt.h) */
 p = strchr(uri, '?');
 if (p) {

How would you like this option to be made work in a way that can be
accepted in ffmpeg?
Is there a way to change the max packet size without this patch?


In your case, I don't think hard coding max packet size == 1316 is not
a good idea in loopback device, and after deep in the srt
library(https://github.com/Haivision/srt) source code, I think srt
library need to fix the hardcode about packet size limition.


I can't think of a scenario where limiting the packet size actually

causes

problems, but if you insist on not limiting it in general, then the max
packet size should be settable using an option, same way it is for UDP.
(pkt_size option). I'd suggest using 1316 as default, because that
is the more common (and currently the only working) use case...

Thanks,
Marton

I agree with you, giving an option like pkt_size and using 1316 as the
default in this case is a better way to fix this issue.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel




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


Re: [FFmpeg-devel] [PATCH] avcodec: add HYMT decoder

2018-08-25 Thread Michael Niedermayer
On Thu, Aug 23, 2018 at 12:13:15AM +0200, Paul B Mahol wrote:
> Signed-off-by: Paul B Mahol 
> ---
>  libavcodec/Makefile |   1 +
>  libavcodec/allcodecs.c  |   1 +
>  libavcodec/avcodec.h|   1 +
>  libavcodec/codec_desc.c |   7 ++
>  libavcodec/huffyuvdec.c | 174 +++-
>  libavformat/riff.c  |   1 +
>  6 files changed, 128 insertions(+), 57 deletions(-)

This breaks:
./ffmpeg -i matrixbench_mpeg2.mpg -an -vcodec ffvhuff -strict -2 -t 1  -pred 
median -context 1 test.avi
./ffplay test.avi


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

During times of universal deceit, telling the truth becomes a
revolutionary act. -- George Orwell


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


Re: [FFmpeg-devel] make work (live) libsrt

2018-08-25 Thread Tudor Suciu
Hello,

Is this patch in a better shape for inclusion?

Regards,

On Fri, Aug 24, 2018 at 2:46 AM myp...@gmail.com  wrote:

> On Fri, Aug 24, 2018 at 2:55 AM Marton Balint  wrote:
> >
> >
> >
> > On Thu, 23 Aug 2018, myp...@gmail.com wrote:
> >
> > > On Wed, Aug 22, 2018 at 4:30 AM Tudor Suciu 
> wrote:
> > >>
> > >> Hello,
> > >>
> > >> I get errors when I try to send a live srt stream that the first
> packet is
> > >> too big:
> > >> 21:30:39.896626/ffmpeg*E: SRT.c: LiveSmoother: payload size: 1504
> exceeds
> > >> maximum allowed 1316
> > >>
> > >> Here are example commands for server and client:
> > >> ffmpeg -re -i ~/Downloads/ToS-4k-1920.mov -vcodec libx264 -g 50 -refs
> 1 -s
> > >> 640x360 -b:v 1000k -acodec aac -b:a 64k -flush_packets 0 -f mpegts
> "srt://
> > >> 127.0.0.1:?mode=listener"
> > >> ffplay srt://127.0.0.1:
> > >>
> > >> A patch that fully solves the issue is:
> > >> diff --git a/libavformat/libsrt.c b/libavformat/libsrt.c
> > >> index 0f9529d263..156a4776e2 100644
> > >> --- a/libavformat/libsrt.c
> > >> +++ b/libavformat/libsrt.c
> > >> @@ -412,6 +412,8 @@ static int libsrt_open(URLContext *h, const char
> *uri,
> > >> int flags)
> > >>  return AVERROR_UNKNOWN;
> > >>  }
> > >>
> > >> +h->max_packet_size = 1316;
> > >> +
> > >>  /* SRT options (srt/srt.h) */
> > >>  p = strchr(uri, '?');
> > >>  if (p) {
> > >>
> > >> How would you like this option to be made work in a way that can be
> > >> accepted in ffmpeg?
> > >> Is there a way to change the max packet size without this patch?
> > >>
> > > In your case, I don't think hard coding max packet size == 1316 is not
> > > a good idea in loopback device, and after deep in the srt
> > > library(https://github.com/Haivision/srt) source code, I think srt
> > > library need to fix the hardcode about packet size limition.
> >
> > I can't think of a scenario where limiting the packet size actually
> causes
> > problems, but if you insist on not limiting it in general, then the max
> > packet size should be settable using an option, same way it is for UDP.
> > (pkt_size option). I'd suggest using 1316 as default, because that
> > is the more common (and currently the only working) use case...
> >
> > Thanks,
> > Marton
> I agree with you, giving an option like pkt_size and using 1316 as the
> default in this case is a better way to fix this issue.
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
From 5fa19ee0d27eab5181cec57a858f086fecc0615e Mon Sep 17 00:00:00 2001
From: Tudor Suciu 
Date: Sat, 25 Aug 2018 11:50:07 +0200
Subject: [PATCH] add pkt_length to libsrt

---
 libavformat/libsrt.c | 12 
 1 file changed, 12 insertions(+)

diff --git a/libavformat/libsrt.c b/libavformat/libsrt.c
index 0f9529d263..6c147d39e4 100644
--- a/libavformat/libsrt.c
+++ b/libavformat/libsrt.c
@@ -48,6 +48,7 @@ typedef struct SRTContext {
 int64_t listen_timeout;
 int recv_buffer_size;
 int send_buffer_size;
+int pkt_size;
 
 int64_t maxbw;
 int pbkeylen;
@@ -73,6 +74,7 @@ static const AVOption libsrt_options[] = {
 { "listen_timeout", "Connection awaiting timeout",  OFFSET(listen_timeout),   AV_OPT_TYPE_INT64, { .i64 = -1 }, -1, INT64_MAX, .flags = D|E },
 { "send_buffer_size", "Socket send buffer size (in bytes)", OFFSET(send_buffer_size), AV_OPT_TYPE_INT,  { .i64 = -1 }, -1, INT_MAX,   .flags = D|E },
 { "recv_buffer_size", "Socket receive buffer size (in bytes)",  OFFSET(recv_buffer_size), AV_OPT_TYPE_INT,  { .i64 = -1 }, -1, INT_MAX,   .flags = D|E },
+{ "pkt_size",   "Maximum SRT packet size",  OFFSET(pkt_size), AV_OPT_TYPE_INT,  { .i64 = 1316 },  -1, INT_MAX,   .flags = D|E },
 { "maxbw",  "Maximum bandwidth (bytes per second) that the connection can use", OFFSET(maxbw),AV_OPT_TYPE_INT64,{ .i64 = -1 }, -1, INT64_MAX, .flags = D|E },
 { "pbkeylen",   "Crypto key len in bytes {16,24,32} Default: 16 (128-bit)", OFFSET(pbkeylen), AV_OPT_TYPE_INT,  { .i64 = -1 }, -1, 32,.flags = D|E },
 { "passphrase", "Crypto PBKDF2 Passphrase size[0,10..64] 0:disable crypto", OFFSET(passphrase),   AV_OPT_TYPE_STRING,   { .str = NULL },  .flags = D|E },
@@ -412,6 +414,10 @@ static int libsrt_open(URLContext *h, const char *uri, int flags)
 return AVERROR_UNKNOWN;
 }
 
+if (flags & AVIO_FLAG_WRITE) {
+h->max_packet_size = 1316;
+}
+
 /* SRT options (srt/srt.h) */
 p = strchr(uri, '?');
 if (p) {
@@ -442,6 +448,9 @@ static int libsrt_open(URLContext *h, const char *uri, int flags)
 if (av_find_info_tag(buf, sizeof(buf), "oheadbw", p)) {
 s->oheadbw = strtoll(b

[FFmpeg-devel] [PATCH] avcodec: add MatchWare Screen Capture Codec

2018-08-25 Thread Paul B Mahol
Signed-off-by: Paul B Mahol 
---
 configure   |   1 +
 libavcodec/Makefile |   1 +
 libavcodec/allcodecs.c  |   1 +
 libavcodec/avcodec.h|   1 +
 libavcodec/codec_desc.c |   7 ++
 libavcodec/mwsc.c   | 191 
 libavformat/riff.c  |   1 +
 7 files changed, 203 insertions(+)
 create mode 100644 libavcodec/mwsc.c

diff --git a/configure b/configure
index b9c9d0b307..0c1f6a79a7 100755
--- a/configure
+++ b/configure
@@ -2679,6 +2679,7 @@ msmpeg4v3_decoder_select="h263_decoder"
 msmpeg4v3_encoder_select="h263_encoder"
 mss2_decoder_select="mpegvideo qpeldsp vc1_decoder"
 mts2_decoder_select="mss34dsp"
+mwsc_decoder_deps="zlib"
 mxpeg_decoder_select="mjpeg_decoder"
 nellymoser_decoder_select="mdct sinewin"
 nellymoser_encoder_select="audio_frame_queue mdct sinewin"
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 9a309c348e..aee4f5431a 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -482,6 +482,7 @@ OBJS-$(CONFIG_MSZH_DECODER)+= lcldec.o
 OBJS-$(CONFIG_MTS2_DECODER)+= mss4.o
 OBJS-$(CONFIG_MVC1_DECODER)+= mvcdec.o
 OBJS-$(CONFIG_MVC2_DECODER)+= mvcdec.o
+OBJS-$(CONFIG_MWSC_DECODER)+= mwsc.o
 OBJS-$(CONFIG_MXPEG_DECODER)   += mxpegdec.o
 OBJS-$(CONFIG_NELLYMOSER_DECODER)  += nellymoserdec.o nellymoser.o
 OBJS-$(CONFIG_NELLYMOSER_ENCODER)  += nellymoserenc.o nellymoser.o
diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
index b1d1ef26c0..d41868c591 100644
--- a/libavcodec/allcodecs.c
+++ b/libavcodec/allcodecs.c
@@ -212,6 +212,7 @@ extern AVCodec ff_mszh_decoder;
 extern AVCodec ff_mts2_decoder;
 extern AVCodec ff_mvc1_decoder;
 extern AVCodec ff_mvc2_decoder;
+extern AVCodec ff_mwsc_decoder;
 extern AVCodec ff_mxpeg_decoder;
 extern AVCodec ff_nuv_decoder;
 extern AVCodec ff_paf_video_decoder;
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 2a4be2ca4f..b327284449 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -449,6 +449,7 @@ enum AVCodecID {
 AV_CODEC_ID_FITS,
 AV_CODEC_ID_IMM4,
 AV_CODEC_ID_PROSUMER,
+AV_CODEC_ID_MWSC,
 
 /* various PCM "codecs" */
 AV_CODEC_ID_FIRST_AUDIO = 0x1, ///< A dummy id pointing at the 
start of audio codecs
diff --git a/libavcodec/codec_desc.c b/libavcodec/codec_desc.c
index e611183599..129d0f1aac 100644
--- a/libavcodec/codec_desc.c
+++ b/libavcodec/codec_desc.c
@@ -1668,6 +1668,13 @@ static const AVCodecDescriptor codec_descriptors[] = {
 .long_name = NULL_IF_CONFIG_SMALL("Brooktree ProSumer Video"),
 .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY,
 },
+{
+.id= AV_CODEC_ID_MWSC,
+.type  = AVMEDIA_TYPE_VIDEO,
+.name  = "mwsc",
+.long_name = NULL_IF_CONFIG_SMALL("MatchWare Screen Capture Codec"),
+.props = AV_CODEC_PROP_LOSSLESS,
+},
 
 /* various PCM "codecs" */
 {
diff --git a/libavcodec/mwsc.c b/libavcodec/mwsc.c
new file mode 100644
index 00..75ab08e6df
--- /dev/null
+++ b/libavcodec/mwsc.c
@@ -0,0 +1,191 @@
+/*
+ * MatchWare Screen Capture Codec decoder
+ *
+ * Copyright (c) 2018 Paul B Mahol
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include 
+#include 
+#include 
+
+#include "avcodec.h"
+#include "bytestream.h"
+#include "internal.h"
+
+#include 
+
+typedef struct MWSCContext {
+unsigned int  decomp_size;
+uint8_t  *decomp_buf;
+z_stream  zstream;
+AVFrame  *prev_frame;
+} MWSCContext;
+
+static int rle_uncompress(GetByteContext *gb, PutByteContext *pb, 
GetByteContext *gbp,
+  int width, int height, int stride, int pb_linesize, 
int gbp_linesize)
+{
+int intra = 1, w = 0;
+
+bytestream2_seek_p(pb, (height - 1) * pb_linesize, SEEK_SET);
+
+while (bytestream2_get_bytes_left(gb) > 0) {
+uint32_t fill = bytestream2_get_le24(gb);
+unsigned run = bytestream2_get_byte(gb);
+
+if (run == 0) {
+run = bytestream2_get_le32(gb);
+for (int j = 0; j < run; j++, w++) {
+if (w == width) {
+w = 0;
+bytestream2_seek_p(pb, -(pb_linesiz

[FFmpeg-devel] [PATCH 1/1] libavformat/mxfenc: add missing dnxhr mxf container essence ULs

2018-08-25 Thread jay
From: Jason Stevens 

---
 libavformat/mxfenc.c | 47 
 1 file changed, 47 insertions(+)

diff --git a/libavformat/mxfenc.c b/libavformat/mxfenc.c
index 7f629dbe53..cf58c8b834 100644
--- a/libavformat/mxfenc.c
+++ b/libavformat/mxfenc.c
@@ -146,6 +146,11 @@ enum ULIndex {
 INDEX_DNXHD_720p_8bit_HIGH,
 INDEX_DNXHD_720p_8bit_MEDIUM,
 INDEX_DNXHD_720p_8bit_LOW,
+INDEX_DNXHR_LB,
+INDEX_DNXHR_SQ,
+INDEX_DNXHR_HQ,
+INDEX_DNXHR_HQX,
+INDEX_DNXHR_444,
 INDEX_JPEG2000,
 INDEX_H264,
 };
@@ -345,6 +350,31 @@ static const MXFContainerEssenceEntry 
mxf_essence_container_uls[] = {
   { 
0x06,0x0e,0x2b,0x34,0x01,0x02,0x01,0x01,0x0d,0x01,0x03,0x01,0x15,0x01,0x05,0x00 
},
   { 
0x06,0x0e,0x2b,0x34,0x04,0x01,0x01,0x0A,0x04,0x01,0x02,0x02,0x71,0x13,0x00,0x00 
},
   mxf_write_cdci_desc },
+// DNxHR LB - CID 1274
+{ { 
0x06,0x0e,0x2b,0x34,0x04,0x01,0x01,0x01,0x0d,0x01,0x03,0x01,0x02,0x11,0x01,0x00 
},
+  { 
0x06,0x0e,0x2b,0x34,0x01,0x02,0x01,0x01,0x0d,0x01,0x03,0x01,0x15,0x01,0x05,0x00 
},
+  { 
0x06,0x0e,0x2b,0x34,0x04,0x01,0x01,0x0A,0x04,0x01,0x02,0x02,0x71,0x28,0x00,0x00 
},
+  mxf_write_cdci_desc },
+// DNxHR SQ - CID 1273
+{ { 
0x06,0x0e,0x2b,0x34,0x04,0x01,0x01,0x01,0x0d,0x01,0x03,0x01,0x02,0x11,0x01,0x00 
},
+  { 
0x06,0x0e,0x2b,0x34,0x01,0x02,0x01,0x01,0x0d,0x01,0x03,0x01,0x15,0x01,0x05,0x00 
},
+  { 
0x06,0x0e,0x2b,0x34,0x04,0x01,0x01,0x0A,0x04,0x01,0x02,0x02,0x71,0x27,0x00,0x00 
},
+  mxf_write_cdci_desc },
+// DNxHR HQ - CID 1272
+{ { 
0x06,0x0e,0x2b,0x34,0x04,0x01,0x01,0x01,0x0d,0x01,0x03,0x01,0x02,0x11,0x01,0x00 
},
+  { 
0x06,0x0e,0x2b,0x34,0x01,0x02,0x01,0x01,0x0d,0x01,0x03,0x01,0x15,0x01,0x05,0x00 
},
+  { 
0x06,0x0e,0x2b,0x34,0x04,0x01,0x01,0x0A,0x04,0x01,0x02,0x02,0x71,0x26,0x00,0x00 
},
+  mxf_write_cdci_desc },
+// DNxHR HQX - CID 1271
+{ { 
0x06,0x0e,0x2b,0x34,0x04,0x01,0x01,0x01,0x0d,0x01,0x03,0x01,0x02,0x11,0x01,0x00 
},
+  { 
0x06,0x0e,0x2b,0x34,0x01,0x02,0x01,0x01,0x0d,0x01,0x03,0x01,0x15,0x01,0x05,0x00 
},
+  { 
0x06,0x0e,0x2b,0x34,0x04,0x01,0x01,0x0A,0x04,0x01,0x02,0x02,0x71,0x25,0x00,0x00 
},
+  mxf_write_cdci_desc },
+// DNxHR 444 - CID 1270
+{ { 
0x06,0x0e,0x2b,0x34,0x04,0x01,0x01,0x01,0x0d,0x01,0x03,0x01,0x02,0x11,0x01,0x00 
},
+  { 
0x06,0x0e,0x2b,0x34,0x01,0x02,0x01,0x01,0x0d,0x01,0x03,0x01,0x15,0x01,0x05,0x00 
},
+  { 
0x06,0x0e,0x2b,0x34,0x04,0x01,0x01,0x0A,0x04,0x01,0x02,0x02,0x71,0x24,0x00,0x00 
},
+  mxf_write_cdci_desc },
 // JPEG2000
 { { 
0x06,0x0e,0x2b,0x34,0x04,0x01,0x01,0x07,0x0d,0x01,0x03,0x01,0x02,0x0c,0x01,0x00 
},
   { 
0x06,0x0e,0x2b,0x34,0x01,0x02,0x01,0x01,0x0d,0x01,0x03,0x01,0x15,0x01,0x08,0x00 
},
@@ -1998,6 +2028,23 @@ AVPacket *pkt)
 case 1253:
 sc->index = INDEX_DNXHD_720p_8bit_LOW;
 break;
+case 1274:
+sc->index = INDEX_DNXHR_LB;
+break;
+case 1273:
+sc->index = INDEX_DNXHR_SQ;
+break;
+case 1272:
+sc->index = INDEX_DNXHR_HQ;
+break;
+case 1271:
+sc->index = INDEX_DNXHR_HQX;
+sc->component_depth = 10;
+break;
+case 1270:
+sc->index = INDEX_DNXHR_444;
+sc->component_depth = 10;
+break;
 default:
 return -1;
 }
-- 
2.18.0.windows.1

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


[FFmpeg-devel] [PATCH 0/1] add missing dnxhr mxf container essence ULs

2018-08-25 Thread jay
From: Jason Stevens 

Hi,
This patch adds missing dnxhr mxf container essense ULs to the mxf encoder.
This fixes dnxhr mxf files being quarantined by Avid Media Composer.

Jason Stevens (1):
  libavformat/mxfenc: add missing dnxhr mxf container essence ULs

 libavformat/mxfenc.c | 47 
 1 file changed, 47 insertions(+)

-- 
2.18.0.windows.1

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