Re: [FFmpeg-devel] [PATCH v3] avcodec: add AV_CODEC_FLAG_DROPCHANGED to flags

2019-04-19 Thread Gyan



On 19-04-2019 08:41 PM, Gyan wrote:



On 16-04-2019 01:12 PM, Gyan wrote:
Patch revised as per 
http://www.ffmpeg.org/pipermail/ffmpeg-devel/2019-April/242591.html


If no more changes, plan to push tomorrow morning.


Pushed as 3153a6502a28b20a0da822daf32bcd8f7c90d721

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

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

[FFmpeg-devel] [PATCH 2/2] aarch64/mdct15: implement a WIP fft15 NEON implementation

2019-04-19 Thread Lynne
NEON:
5225 UNITS in fft15,   65536 runs,  0 skips

C:
7889 UNITS in fft15,   65535 runs,  1 skips

Posting this to maybe get some advice, its too slow for any noticeable
decoding speed increase.

>From 534dd20b4961c2f0c4131fbbadac5f1940bad3a0 Mon Sep 17 00:00:00 2001
From: Lynne 
Date: Sat, 20 Apr 2019 02:05:23 +0100
Subject: [PATCH 2/2] aarch64/mdct15: implement a WIP fft15 NEON implementation

NEON:
5225 UNITS in fft15,   65536 runs,  0 skips

C:
7889 UNITS in fft15,   65535 runs,  1 skips

Posting this to maybe get some advice, its too slow for any noticeable
decoding speed increase.
---
 libavcodec/aarch64/Makefile  |   2 +
 libavcodec/aarch64/mdct15_init.c |  86 +++
 libavcodec/aarch64/mdct15_neon.S | 136 +++
 libavcodec/mdct15.c  |   3 +
 libavcodec/mdct15.h  |   1 +
 5 files changed, 228 insertions(+)
 create mode 100644 libavcodec/aarch64/mdct15_init.c
 create mode 100644 libavcodec/aarch64/mdct15_neon.S

diff --git a/libavcodec/aarch64/Makefile b/libavcodec/aarch64/Makefile
index 00f93bf59f..8093fc17cb 100644
--- a/libavcodec/aarch64/Makefile
+++ b/libavcodec/aarch64/Makefile
@@ -6,6 +6,7 @@ OBJS-$(CONFIG_H264DSP)  += aarch64/h264dsp_init_aarch64.o
 OBJS-$(CONFIG_H264PRED) += aarch64/h264pred_init.o
 OBJS-$(CONFIG_H264QPEL) += aarch64/h264qpel_init_aarch64.o
 OBJS-$(CONFIG_HPELDSP)  += aarch64/hpeldsp_init_aarch64.o
+OBJS-$(CONFIG_MDCT15)   += aarch64/mdct15_init.o
 OBJS-$(CONFIG_MPEGAUDIODSP) += aarch64/mpegaudiodsp_init.o
 OBJS-$(CONFIG_NEON_CLOBBER_TEST)+= aarch64/neontest.o
 OBJS-$(CONFIG_VIDEODSP) += aarch64/videodsp_init.o
@@ -43,6 +44,7 @@ NEON-OBJS-$(CONFIG_H264QPEL)+= aarch64/h264qpel_neon.o \
 NEON-OBJS-$(CONFIG_HPELDSP) += aarch64/hpeldsp_neon.o
 NEON-OBJS-$(CONFIG_IDCTDSP) += aarch64/idctdsp_init_aarch64.o  \
aarch64/simple_idct_neon.o
+NEON-OBJS-$(CONFIG_MDCT15)  += aarch64/mdct15_neon.o
 NEON-OBJS-$(CONFIG_MDCT)+= aarch64/mdct_neon.o
 NEON-OBJS-$(CONFIG_MPEGAUDIODSP)+= aarch64/mpegaudiodsp_neon.o
 NEON-OBJS-$(CONFIG_VP8DSP)  += aarch64/vp8dsp_neon.o
diff --git a/libavcodec/aarch64/mdct15_init.c b/libavcodec/aarch64/mdct15_init.c
new file mode 100644
index 00..a4e24c9c13
--- /dev/null
+++ b/libavcodec/aarch64/mdct15_init.c
@@ -0,0 +1,86 @@
+/*
+ * 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 "config.h"
+
+#include "libavutil/aarch64/cpu.h"
+#include "libavcodec/mdct15.h"
+
+void ff_fft15_neon(FFTComplex *out, FFTComplex *in, FFTComplex *exptab, ptrdiff_t stride);
+
+static void perm_twiddles(MDCT15Context *s)
+{
+int k;
+FFTComplex tmp[30];
+
+/* 5-point FFT twiddles */
+s->exptab[60].re =  s->exptab[19].re;
+s->exptab[60].im =  s->exptab[19].im;
+s->exptab[61].re = -s->exptab[20].re;
+s->exptab[61].im =  s->exptab[20].im;
+s->exptab[62].re =  s->exptab[20].im;
+s->exptab[62].im =  s->exptab[20].im;
+s->exptab[63].re = -s->exptab[20].im;
+s->exptab[63].im = -s->exptab[20].im;
+
+/* 15-point FFT twiddles */
+for (k = 0; k < 5; k++) {
+tmp[6*k + 0] = s->exptab[k +  0];
+tmp[6*k + 2] = s->exptab[k +  5];
+tmp[6*k + 4] = s->exptab[k + 10];
+
+tmp[6*k + 1] = s->exptab[2 * (k + 0)];
+tmp[6*k + 3] = s->exptab[2 * (k + 5)];
+tmp[6*k + 5] = s->exptab[2 *  k + 5 ];
+}
+
+for (k = 0; k < 6; k++) {
+FFTComplex ac_exp[] = {
+{  tmp[6*1 + k].re, tmp[6*1 + k].im },
+{  tmp[6*2 + k].re, tmp[6*2 + k].im },
+{ -tmp[6*1 + k].im, tmp[6*1 + k].re },
+{ -tmp[6*2 + k].im, tmp[6*2 + k].re },
+{  tmp[6*3 + k].re, tmp[6*3 + k].im },
+{  tmp[6*4 + k].re, tmp[6*4 + k].im },
+{ -tmp[6*3 + k].im, tmp[6*3 + k].re },
+{ -tmp[6*4 + k].im, tmp[6*4 + k].re },
+};
+memcpy(s->exptab + 8*k, ac_exp, 8*sizeof(FFTComplex));
+}
+
+/* Specialcase when k = 0 */
+for (k = 0; k < 3; k++) {
+FFTComplex dc_exp[] = 

[FFmpeg-devel] [PATCH 1/2] arch64/asm-offsets: remove old CELT offsets

2019-04-19 Thread Lynne
They're not used and they're incorrect.

>From 91a284e48b6fca5595e75ec2b5d5fc5eae6b71f9 Mon Sep 17 00:00:00 2001
From: Lynne 
Date: Sat, 20 Apr 2019 02:04:51 +0100
Subject: [PATCH 1/2] arch64/asm-offsets: remove old CELT offsets

They're not used and they're incorrect.
---
 libavcodec/aarch64/asm-offsets.h | 8 
 1 file changed, 8 deletions(-)

diff --git a/libavcodec/aarch64/asm-offsets.h b/libavcodec/aarch64/asm-offsets.h
index e05c5ad2e4..fc38eed298 100644
--- a/libavcodec/aarch64/asm-offsets.h
+++ b/libavcodec/aarch64/asm-offsets.h
@@ -19,14 +19,6 @@
 #ifndef AVCODEC_AARCH64_ASM_OFFSETS_H
 #define AVCODEC_AARCH64_ASM_OFFSETS_H
 
-/* CeltIMDCTContext */
-#define CELT_EXPTAB 0x20
-#define CELT_FFT_N  0x00
-#define CELT_LEN2   0x04
-#define CELT_LEN4   (CELT_LEN2 + 0x4)   // loaded as pair
-#define CELT_TMP0x10
-#define CELT_TWIDDLE(CELT_TMP + 0x8)// loaded as pair
-
 /* FFTContext */
 #define IMDCT_HALF  0x48
 
-- 
2.20.1

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

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

[FFmpeg-devel] [PATCH] avcodec/truemotion2: Fix 2 integer overflows in tm2_update_block()

2019-04-19 Thread Michael Niedermayer
Fixes: signed integer overflow: -2147483648 + -1 cannot be represented in type 
'int'
Fixes: 
14107/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TRUEMOTION2_fuzzer-5694078680825856

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

diff --git a/libavcodec/truemotion2.c b/libavcodec/truemotion2.c
index 100880c257..03c516cc86 100644
--- a/libavcodec/truemotion2.c
+++ b/libavcodec/truemotion2.c
@@ -687,8 +687,8 @@ static inline void tm2_update_block(TM2Context *ctx, 
AVFrame *pic, int bx, int b
 /* update chroma */
 for (j = 0; j < 2; j++) {
 for (i = 0; i < 2; i++) {
-U[i] = Uo[i] + GET_TOK(ctx, TM2_UPD);
-V[i] = Vo[i] + GET_TOK(ctx, TM2_UPD);
+U[i] = Uo[i] + (unsigned)GET_TOK(ctx, TM2_UPD);
+V[i] = Vo[i] + (unsigned)GET_TOK(ctx, TM2_UPD);
 }
 U  += Ustride;
 V  += Vstride;
-- 
2.21.0

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

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

[FFmpeg-devel] [PATCH] avformat/ifv: added support for ifv cctv files

2019-04-19 Thread Swaraj Hota
Fixes ticket #2956.

Signed-off-by: Swaraj Hota 
---
I have tested it on all the samples provided in the ticket and
it works for all of them.

Please comment.
---
 Changelog|   1 +
 libavformat/Makefile |   1 +
 libavformat/allformats.c |   1 +
 libavformat/ifv.c| 332 +++
 libavformat/version.h|   4 +-
 5 files changed, 337 insertions(+), 2 deletions(-)
 create mode 100644 libavformat/ifv.c

diff --git a/Changelog b/Changelog
index 5b2b1e5af4..2a48c6b284 100644
--- a/Changelog
+++ b/Changelog
@@ -24,6 +24,7 @@ version :
 - KUX demuxer
 - AV1 frame split bitstream filter
 - lscr decoder
+- IFV demuxer


 version 4.1:
diff --git a/libavformat/Makefile b/libavformat/Makefile
index 99be60d184..f68d41e4a5 100644
--- a/libavformat/Makefile
+++ b/libavformat/Makefile
@@ -231,6 +231,7 @@ OBJS-$(CONFIG_ICO_MUXER) += icoenc.o
 OBJS-$(CONFIG_IDCIN_DEMUXER) += idcin.o
 OBJS-$(CONFIG_IDF_DEMUXER)   += bintext.o sauce.o
 OBJS-$(CONFIG_IFF_DEMUXER)   += iff.o
+OBJS-$(CONFIG_IFV_DEMUXER)   += ifv.o
 OBJS-$(CONFIG_ILBC_DEMUXER)  += ilbc.o
 OBJS-$(CONFIG_ILBC_MUXER)+= ilbc.o
 OBJS-$(CONFIG_IMAGE2_DEMUXER)+= img2dec.o img2.o
diff --git a/libavformat/allformats.c b/libavformat/allformats.c
index d316a0529a..cd00834807 100644
--- a/libavformat/allformats.c
+++ b/libavformat/allformats.c
@@ -188,6 +188,7 @@ extern AVOutputFormat ff_ico_muxer;
 extern AVInputFormat  ff_idcin_demuxer;
 extern AVInputFormat  ff_idf_demuxer;
 extern AVInputFormat  ff_iff_demuxer;
+extern AVInputFormat  ff_ifv_demuxer;
 extern AVInputFormat  ff_ilbc_demuxer;
 extern AVOutputFormat ff_ilbc_muxer;
 extern AVInputFormat  ff_image2_demuxer;
diff --git a/libavformat/ifv.c b/libavformat/ifv.c
new file mode 100644
index 00..dc871c5b44
--- /dev/null
+++ b/libavformat/ifv.c
@@ -0,0 +1,332 @@
+/*
+ * IFV demuxer
+ *
+ * Copyright (c) 2018 Swaraj Hota
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "avformat.h"
+#include "internal.h"
+#include "avio_internal.h"
+
+#define IFV_MAGIC "\x11\xd2\xd3\xab\xba\xa9\xcf\x11\
+\x8e\xe6\x00\xc0\x0c\x20\x53\x65\x44"
+
+typedef struct IFVIndexEntry {
+uint32_t frame_offset;
+uint32_t frame_size;
+enum AVMediaType frame_type;
+} IFVIndexEntry;
+
+typedef struct IFVContext {
+IFVIndexEntry *vid_index;
+IFVIndexEntry *aud_index;
+uint32_t index_pos;
+uint32_t total_vframes;
+uint32_t total_aframes;
+
+int frame_rate;
+int is_audio_present;
+int sample_rate;
+
+int video_stream_index;
+int audio_stream_index;
+} IFVContext;
+
+static int ifv_probe(const AVProbeData *p)
+{
+if (!memcmp(p->buf, IFV_MAGIC, 17))
+return AVPROBE_SCORE_MAX;
+return 0;
+}
+
+static int read_next_index_entry(AVFormatContext *s, enum AVMediaType 
frame_type)
+{
+IFVContext *ifv = s->priv_data;
+IFVIndexEntry *e;
+
+if (frame_type == AVMEDIA_TYPE_VIDEO) {
+if (ifv->index_pos >= ifv->total_vframes)
+return 0;
+
+e = &ifv->vid_index[ifv->index_pos++];
+
+e->frame_offset = avio_rl32(s->pb);
+e->frame_size = avio_rl32(s->pb);
+e->frame_type = frame_type;
+
+avio_skip(s->pb, 20);
+
+} else if (frame_type == AVMEDIA_TYPE_AUDIO) {
+if (ifv->index_pos >= ifv->total_aframes)
+return 0;
+
+e = &ifv->aud_index[ifv->index_pos++];
+
+e->frame_offset = avio_rl32(s->pb);
+e->frame_size = avio_rl32(s->pb);
+e->frame_type = frame_type;
+
+avio_skip(s->pb, 16);
+}
+
+return 1;
+}
+
+static int read_index(AVFormatContext *s, enum AVMediaType frame_type)
+{
+IFVContext *ifv = s->priv_data;
+int ret;
+
+if (frame_type == AVMEDIA_TYPE_VIDEO) {
+ret = av_reallocp_array(&ifv->vid_index, ifv->total_vframes, 
sizeof(IFVIndexEntry));
+if (ret < 0)
+return ret;
+
+} else if (frame_type == AVMEDIA_TYPE_AUDIO) {
+ret = av_reallocp_array(&ifv->aud_index, ifv->total_aframes, 
sizeof(IFVIndexEntry));
+if (ret < 0)
+return ret;
+}
+
+while (read_next_index_entry(s, frame_type))
+;
+
+  

[FFmpeg-devel] [PATCH 13/15] avformat/matroskaenc: Don't waste bytes writing level 1 elements

2019-04-19 Thread Andreas Rheinhardt
Up until now, the length field of most level 1 elements has been written
using eight bytes, although it is known in advance how much space the
content of said elements will take up so that it would be possible to
determine the minimal amount of bytes for the length field. This
commit changes this.

Signed-off-by: Andreas Rheinhardt 
---
 libavformat/matroskaenc.c| 29 +-
 tests/fate/matroska.mak  |  2 +-
 tests/fate/wavpack.mak   |  4 +--
 tests/ref/fate/aac-autobsf-adtstoasc |  4 +--
 tests/ref/fate/binsub-mksenc |  2 +-
 tests/ref/fate/rgb24-mkv |  4 +--
 tests/ref/lavf/mka   |  4 +--
 tests/ref/lavf/mkv   |  4 +--
 tests/ref/lavf/mkv_attachment|  4 +--
 tests/ref/seek/lavf-mkv  | 44 ++--
 10 files changed, 50 insertions(+), 51 deletions(-)

diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
index 15164bd87c..441315e2d5 100644
--- a/libavformat/matroskaenc.c
+++ b/libavformat/matroskaenc.c
@@ -60,7 +60,7 @@
 typedef struct ebml_master {
 int64_t pos;///< absolute offset in the containing 
AVIOContext where the size field starts
 ///< for level 1 elements or else 
where the master's elements start
-int sizebytes;  ///< how many bytes were 
reserved/shall be used for the size
+int sizebytes;  ///< how many bytes were reserved for 
the size
 } ebml_master;
 
 typedef struct mkv_seekhead_entry {
@@ -334,15 +334,15 @@ static void end_ebml_master(AVIOContext *pb, ebml_master 
master)
 }
 
 static int start_ebml_master_crc32(AVIOContext *pb, AVIOContext **dyn_cp, 
MatroskaMuxContext *mkv,
-   ebml_master *master, uint32_t elementid, 
uint64_t expectedsize)
+   ebml_master *master, uint32_t elementid)
 {
-int ret, bytes = expectedsize ? ebml_num_size(expectedsize) : 8;
+int ret;
 
 if ((ret = avio_open_dyn_buf(dyn_cp)) < 0)
 return ret;
 
 put_ebml_id(pb, elementid);
-*master = (ebml_master) { avio_tell(pb), bytes };
+*master = (ebml_master) { avio_tell(pb), 0 };
 if (mkv->write_crc)
 put_ebml_void(*dyn_cp, 6); /* Reserve space for CRC32 so position/size 
calculations using avio_tell() take it into account */
 
@@ -356,7 +356,7 @@ static void end_ebml_master_crc32(AVIOContext *pb, 
AVIOContext **dyn_cp, Matrosk
 int size, skip = 0;
 
 size = avio_close_dyn_buf(*dyn_cp, &buf);
-put_ebml_num(pb, size, master.sizebytes);
+put_ebml_num(pb, size, 0);
 if (mkv->write_crc) {
 skip = 6; /* Skip reserved 6-byte long void element from the dynamic 
buffer. */
 AV_WL32(crc, av_crc(av_crc_get_table(AV_CRC_32_IEEE_LE), UINT32_MAX, 
buf + skip, size - skip) ^ UINT32_MAX);
@@ -377,7 +377,7 @@ static void end_ebml_master_crc32_preliminary(AVIOContext 
*pb, AVIOContext **dyn
 uint8_t *buf;
 int size = avio_get_dyn_buf(*dyn_cp, &buf);
 
-put_ebml_num(pb, size, master.sizebytes);
+put_ebml_num(pb, size, 0);
 avio_write(pb, buf, size);
 }
 
@@ -502,8 +502,7 @@ static int64_t mkv_write_seekhead(AVIOContext *pb, 
MatroskaMuxContext *mkv)
 }
 }
 
-if (start_ebml_master_crc32(pb, &dyn_cp, mkv, &metaseek, 
MATROSKA_ID_SEEKHEAD,
-seekhead->reserved_size) < 0) {
+if (start_ebml_master_crc32(pb, &dyn_cp, mkv, &metaseek, 
MATROSKA_ID_SEEKHEAD) < 0) {
 currentpos = -1;
 goto fail;
 }
@@ -578,7 +577,7 @@ static int64_t mkv_write_cues(AVFormatContext *s, mkv_cues 
*cues, mkv_track *tra
 int i, j, ret;
 
 currentpos = avio_tell(pb);
-ret = start_ebml_master_crc32(pb, &dyn_cp, mkv, &cues_element, 
MATROSKA_ID_CUES, 0);
+ret = start_ebml_master_crc32(pb, &dyn_cp, mkv, &cues_element, 
MATROSKA_ID_CUES);
 if (ret < 0)
 return ret;
 
@@ -1454,7 +1453,7 @@ static int mkv_write_tracks(AVFormatContext *s)
 if (ret < 0)
 return ret;
 
-ret = start_ebml_master_crc32(pb, &mkv->tracks_bc, mkv, 
&mkv->tracks_master, MATROSKA_ID_TRACKS, 0);
+ret = start_ebml_master_crc32(pb, &mkv->tracks_bc, mkv, 
&mkv->tracks_master, MATROSKA_ID_TRACKS);
 if (ret < 0)
 return ret;
 
@@ -1490,7 +1489,7 @@ static int mkv_write_chapters(AVFormatContext *s)
 ret = mkv_add_seekhead_entry(mkv->seekhead, MATROSKA_ID_CHAPTERS, 
avio_tell(pb));
 if (ret < 0) return ret;
 
-ret = start_ebml_master_crc32(pb, &dyn_cp, mkv, &chapters, 
MATROSKA_ID_CHAPTERS, 0);
+ret = start_ebml_master_crc32(pb, &dyn_cp, mkv, &chapters, 
MATROSKA_ID_CHAPTERS);
 if (ret < 0) return ret;
 
 editionentry = start_ebml_master(dyn_cp, MATROSKA_ID_EDITIONENTRY, 0);
@@ -1581,7 +1580,7 @@ static int mkv_write_tag_targets(AVFormatContext *s, 
uint32_t elementid,
 ret = mkv_add_seekhead_entry(mkv->seekhead, MATROSKA_ID_

[FFmpeg-devel] [PATCH 14/15] avformat/matroskaenc: Improve log messages for blocks

2019-04-19 Thread Andreas Rheinhardt
Up until now, a block's relative offset has been reported as the offset
in the log messages output when writing blocks; given that it is
impossible to know the real offset from the beginning of the file at
this point due to the fact that it is not yet known how many bytes will
be used for the containing cluster's length field both the relative
offset in the cluster as well as the offset of the containing cluster
will be reported from now on.

Also, the log message for writing vtt blocks has been brought in line
with the message for normal blocks.

Signed-off-by: Andreas Rheinhardt 
---
 libavformat/matroskaenc.c | 15 ---
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
index 441315e2d5..fc0e95440e 100644
--- a/libavformat/matroskaenc.c
+++ b/libavformat/matroskaenc.c
@@ -2124,10 +2124,10 @@ static void mkv_write_block(AVFormatContext *s, 
AVIOContext *pb,
 
 ts += mkv->tracks[pkt->stream_index].ts_offset;
 
-av_log(s, AV_LOG_DEBUG, "Writing block at offset %" PRIu64 ", size %d, "
-   "pts %" PRId64 ", dts %" PRId64 ", duration %" PRId64 ", keyframe 
%d\n",
-   avio_tell(pb), pkt->size, pkt->pts, pkt->dts, pkt->duration,
-   keyframe != 0);
+av_log(s, AV_LOG_DEBUG, "Writing block at relative offset %" PRId64 " in "
+   "cluster at offset %" PRId64 "; size %d, pts %" PRId64 ", dts %" 
PRId64
+   ", duration %" PRId64 ", keyframe %d\n", avio_tell(pb), 
mkv->cluster_pos,
+   pkt->size, pkt->pts, pkt->dts, pkt->duration, keyframe != 0);
 if (par->codec_id == AV_CODEC_ID_H264 && par->extradata_size > 0 &&
 (AV_RB24(par->extradata) == 1 || AV_RB32(par->extradata) == 1))
 ff_avc_parse_nal_units_buf(pkt->data, &data, &size);
@@ -2231,9 +2231,10 @@ static int mkv_write_vtt_blocks(AVFormatContext *s, 
AVIOContext *pb, AVPacket *p
 
 size = id_size + 1 + settings_size + 1 + pkt->size;
 
-av_log(s, AV_LOG_DEBUG, "Writing block at offset %" PRIu64 ", size %d, "
-   "pts %" PRId64 ", dts %" PRId64 ", duration %" PRId64 ", flags 
%d\n",
-   avio_tell(pb), size, pkt->pts, pkt->dts, pkt->duration, flags);
+av_log(s, AV_LOG_DEBUG, "Writing block at relative offset %" PRId64 " in "
+   "cluster at offset %" PRId64 "; size %d, pts %" PRId64 ", dts %" 
PRId64
+   ", duration %" PRId64 ", keyframe %d\n", avio_tell(pb), 
mkv->cluster_pos,
+   size, pkt->pts, pkt->dts, pkt->duration, 1);
 
 blockgroup = start_ebml_master(pb, MATROSKA_ID_BLOCKGROUP, 
mkv_blockgroup_size(size));
 
-- 
2.21.0

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

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

[FFmpeg-devel] [PATCH 12/15] avformat/matroskaenc: Cosmetics and typo

2019-04-19 Thread Andreas Rheinhardt
Fixes intendation, whitespace, a typo and renames a variable
(dyn_bc->cluster_bc) to make its meaning clearer and to bring
it more in line with the naming of similar variables.

Signed-off-by: Andreas Rheinhardt 
---
 libavformat/matroskaenc.c | 103 +++---
 1 file changed, 51 insertions(+), 52 deletions(-)

diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
index d9a7ca9ad1..15164bd87c 100644
--- a/libavformat/matroskaenc.c
+++ b/libavformat/matroskaenc.c
@@ -119,9 +119,8 @@ typedef struct mkv_attachments {
 #define MAX_TRACKS 126
 
 typedef struct MatroskaMuxContext {
-const AVClass  *class;
+const AVClass   *class;
 int mode;
-AVIOContext   *dyn_bc;
 AVIOContext *tags_bc;
 ebml_master tags;
 AVIOContext *info_bc;
@@ -130,6 +129,7 @@ typedef struct MatroskaMuxContext {
 ebml_master tracks_master;
 ebml_master segment;
 int64_t segment_offset;
+AVIOContext *cluster_bc;
 ebml_master cluster;
 int64_t cluster_pos;///< file offset of the current cluster
 int64_t cluster_pts;
@@ -159,8 +159,8 @@ typedef struct MatroskaMuxContext {
 
 int64_t last_track_timestamp[MAX_TRACKS];
 
-int64_t* stream_durations;
-int64_t* stream_duration_offsets;
+int64_t *stream_durations;
+int64_t *stream_duration_offsets;
 
 int allow_raw_vfw;
 } MatroskaMuxContext;
@@ -320,7 +320,7 @@ static ebml_master start_ebml_master(AVIOContext *pb, 
uint32_t elementid,
 
 put_ebml_id(pb, elementid);
 put_ebml_size_unknown(pb, bytes);
-return (ebml_master) {avio_tell(pb), bytes };
+return (ebml_master) { avio_tell(pb), bytes };
 }
 
 static void end_ebml_master(AVIOContext *pb, ebml_master master)
@@ -341,10 +341,10 @@ static int start_ebml_master_crc32(AVIOContext *pb, 
AVIOContext **dyn_cp, Matros
 if ((ret = avio_open_dyn_buf(dyn_cp)) < 0)
 return ret;
 
-put_ebml_id(pb, elementid);
-*master = (ebml_master) { avio_tell(pb), bytes };
-if (mkv->write_crc)
-put_ebml_void(*dyn_cp, 6); /* Reserve space for CRC32 so 
position/size calculations using avio_tell() take it into account */
+put_ebml_id(pb, elementid);
+*master = (ebml_master) { avio_tell(pb), bytes };
+if (mkv->write_crc)
+put_ebml_void(*dyn_cp, 6); /* Reserve space for CRC32 so position/size 
calculations using avio_tell() take it into account */
 
 return 0;
 }
@@ -355,31 +355,30 @@ static void end_ebml_master_crc32(AVIOContext *pb, 
AVIOContext **dyn_cp, Matrosk
 uint8_t *buf, crc[4];
 int size, skip = 0;
 
-size = avio_close_dyn_buf(*dyn_cp, &buf);
-put_ebml_num(pb, size, master.sizebytes);
-if (mkv->write_crc) {
-skip = 6; /* Skip reserved 6-byte long void element from the 
dynamic buffer. */
-AV_WL32(crc, av_crc(av_crc_get_table(AV_CRC_32_IEEE_LE), 
UINT32_MAX, buf + skip, size - skip) ^ UINT32_MAX);
-put_ebml_binary(pb, EBML_ID_CRC32, crc, sizeof(crc));
-}
-avio_write(pb, buf + skip, size - skip);
+size = avio_close_dyn_buf(*dyn_cp, &buf);
+put_ebml_num(pb, size, master.sizebytes);
+if (mkv->write_crc) {
+skip = 6; /* Skip reserved 6-byte long void element from the dynamic 
buffer. */
+AV_WL32(crc, av_crc(av_crc_get_table(AV_CRC_32_IEEE_LE), UINT32_MAX, 
buf + skip, size - skip) ^ UINT32_MAX);
+put_ebml_binary(pb, EBML_ID_CRC32, crc, sizeof(crc));
+}
+avio_write(pb, buf + skip, size - skip);
 
 av_free(buf);
 *dyn_cp = NULL;
 }
 
 /**
-* Complete ebml master whithout destroying the buffer, allowing for later 
updates
+* Complete ebml master without destroying the buffer, allowing for later 
updates
 */
 static void end_ebml_master_crc32_preliminary(AVIOContext *pb, AVIOContext 
**dyn_cp, MatroskaMuxContext *mkv,
-ebml_master master)
+  ebml_master master)
 {
-
-uint8_t *buf;
-int size = avio_get_dyn_buf(*dyn_cp, &buf);
+uint8_t *buf;
+int size = avio_get_dyn_buf(*dyn_cp, &buf);
 
 put_ebml_num(pb, size, master.sizebytes);
-avio_write(pb, buf, size);
+avio_write(pb, buf, size);
 }
 
 static void put_xiph_size(AVIOContext *pb, int size)
@@ -393,8 +392,8 @@ static void put_xiph_size(AVIOContext *pb, int size)
  */
 static void mkv_free(MatroskaMuxContext *mkv) {
 uint8_t* buf;
-if (mkv->dyn_bc) {
-avio_close_dyn_buf(mkv->dyn_bc, &buf);
+if (mkv->cluster_bc) {
+avio_close_dyn_buf(mkv->cluster_bc, &buf);
 av_free(buf);
 }
 if (mkv->info_bc) {
@@ -1569,9 +1568,9 @@ static int mkv_write_simpletag(AVIOContext *pb, 
AVDictionaryEntry *t)
 return 0;
 }
 
-static int mkv_write_tag_targets(AVFormatContext *s,
- uint32_t elementid, unsigned int uid,
- ebml_master *tags, ebml_ma

[FFmpeg-devel] [PATCH 15/15] avformat/matroskaenc: Reduce usage of ebml_master

2019-04-19 Thread Andreas Rheinhardt
After the last few commits, the functions for writing master elements
with CRC-32 elements didn't really make use of the ebml_master
structure any more, so remove these parameters from the functions.

The only things that still need to be kept are the positions of the
level 1 elements that are written preliminarily and updated later.
These positions are stored in the MatroskaMuxContext and
replace the corresponding ebml_master structures.

Signed-off-by: Andreas Rheinhardt 
---
 libavformat/matroskaenc.c | 103 ++
 1 file changed, 49 insertions(+), 54 deletions(-)

diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
index fc0e95440e..537fcd8eac 100644
--- a/libavformat/matroskaenc.c
+++ b/libavformat/matroskaenc.c
@@ -58,8 +58,7 @@
 #include "libavcodec/internal.h"
 
 typedef struct ebml_master {
-int64_t pos;///< absolute offset in the containing 
AVIOContext where the size field starts
-///< for level 1 elements or else 
where the master's elements start
+int64_t pos;///< absolute offset in the containing 
AVIOContext where the master's elements start
 int sizebytes;  ///< how many bytes were reserved for 
the size
 } ebml_master;
 
@@ -122,15 +121,14 @@ typedef struct MatroskaMuxContext {
 const AVClass   *class;
 int mode;
 AVIOContext *tags_bc;
-ebml_master tags;
+int64_t tags_pos;
 AVIOContext *info_bc;
-ebml_master info;
+int64_t info_pos;
 AVIOContext *tracks_bc;
-ebml_master tracks_master;
+int64_t tracks_pos;
 ebml_master segment;
 int64_t segment_offset;
 AVIOContext *cluster_bc;
-ebml_master cluster;
 int64_t cluster_pos;///< file offset of the current cluster
 int64_t cluster_pts;
 int64_t duration_offset;
@@ -334,7 +332,7 @@ static void end_ebml_master(AVIOContext *pb, ebml_master 
master)
 }
 
 static int start_ebml_master_crc32(AVIOContext *pb, AVIOContext **dyn_cp, 
MatroskaMuxContext *mkv,
-   ebml_master *master, uint32_t elementid)
+   uint32_t elementid)
 {
 int ret;
 
@@ -342,15 +340,13 @@ static int start_ebml_master_crc32(AVIOContext *pb, 
AVIOContext **dyn_cp, Matros
 return ret;
 
 put_ebml_id(pb, elementid);
-*master = (ebml_master) { avio_tell(pb), 0 };
 if (mkv->write_crc)
 put_ebml_void(*dyn_cp, 6); /* Reserve space for CRC32 so position/size 
calculations using avio_tell() take it into account */
 
 return 0;
 }
 
-static void end_ebml_master_crc32(AVIOContext *pb, AVIOContext **dyn_cp, 
MatroskaMuxContext *mkv,
-  ebml_master master)
+static void end_ebml_master_crc32(AVIOContext *pb, AVIOContext **dyn_cp, 
MatroskaMuxContext *mkv)
 {
 uint8_t *buf, crc[4];
 int size, skip = 0;
@@ -372,11 +368,13 @@ static void end_ebml_master_crc32(AVIOContext *pb, 
AVIOContext **dyn_cp, Matrosk
 * Complete ebml master without destroying the buffer, allowing for later 
updates
 */
 static void end_ebml_master_crc32_preliminary(AVIOContext *pb, AVIOContext 
**dyn_cp, MatroskaMuxContext *mkv,
-  ebml_master master)
+  int64_t *pos)
 {
 uint8_t *buf;
 int size = avio_get_dyn_buf(*dyn_cp, &buf);
 
+*pos = avio_tell(pb);
+
 put_ebml_num(pb, size, 0);
 avio_write(pb, buf, size);
 }
@@ -489,7 +487,7 @@ static int64_t mkv_write_seekhead(AVIOContext *pb, 
MatroskaMuxContext *mkv)
 {
 AVIOContext *dyn_cp;
 mkv_seekhead *seekhead = mkv->seekhead;
-ebml_master metaseek, seekentry;
+ebml_master seekentry;
 int64_t currentpos;
 int i;
 
@@ -502,7 +500,7 @@ static int64_t mkv_write_seekhead(AVIOContext *pb, 
MatroskaMuxContext *mkv)
 }
 }
 
-if (start_ebml_master_crc32(pb, &dyn_cp, mkv, &metaseek, 
MATROSKA_ID_SEEKHEAD) < 0) {
+if (start_ebml_master_crc32(pb, &dyn_cp, mkv, MATROSKA_ID_SEEKHEAD) < 0) {
 currentpos = -1;
 goto fail;
 }
@@ -519,7 +517,7 @@ static int64_t mkv_write_seekhead(AVIOContext *pb, 
MatroskaMuxContext *mkv)
 put_ebml_uint(dyn_cp, MATROSKA_ID_SEEKPOSITION, entry->segmentpos);
 end_ebml_master(dyn_cp, seekentry);
 }
-end_ebml_master_crc32(pb, &dyn_cp, mkv, metaseek);
+end_ebml_master_crc32(pb, &dyn_cp, mkv);
 
 if (seekhead->reserved_size > 0) {
 uint64_t remaining = seekhead->filepos + seekhead->reserved_size - 
avio_tell(pb);
@@ -572,12 +570,11 @@ static int64_t mkv_write_cues(AVFormatContext *s, 
mkv_cues *cues, mkv_track *tra
 {
 MatroskaMuxContext *mkv = s->priv_data;
 AVIOContext *dyn_cp, *pb = s->pb;
-ebml_master cues_element;
 int64_t currentpos;
 int i, j, ret;
 
 

[FFmpeg-devel] [PATCH 11/15] avformat/matroskaenc: Write CRC-32 in non-seekable mode

2019-04-19 Thread Andreas Rheinhardt
Given that in both the seekable as well as the non-seekable mode dynamic
buffers are used to write level 1 elements and that now no seeks are
used in the seekable case any more, the two modes can be combined; as a
consequence, the non-seekable mode automatically inherits the ability to
write CRC-32 elements.

There are no differences in case the output is seekable; when it is not
and writing CRC-32 elements is disabled, there can still be minor
differences because before this commit, the EBML ID and length field
were counted towards the cluster size limit; now they no longer are.

Signed-off-by: Andreas Rheinhardt 
---
 libavformat/matroskaenc.c| 14 ++
 tests/fate/matroska.mak  |  2 +-
 tests/fate/wavpack.mak   |  4 ++--
 tests/ref/fate/binsub-mksenc |  2 +-
 4 files changed, 6 insertions(+), 16 deletions(-)

diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
index 2875552469..d9a7ca9ad1 100644
--- a/libavformat/matroskaenc.c
+++ b/libavformat/matroskaenc.c
@@ -336,20 +336,15 @@ static void end_ebml_master(AVIOContext *pb, ebml_master 
master)
 static int start_ebml_master_crc32(AVIOContext *pb, AVIOContext **dyn_cp, 
MatroskaMuxContext *mkv,
ebml_master *master, uint32_t elementid, 
uint64_t expectedsize)
 {
-int ret;
+int ret, bytes = expectedsize ? ebml_num_size(expectedsize) : 8;
 
 if ((ret = avio_open_dyn_buf(dyn_cp)) < 0)
 return ret;
 
-if (pb->seekable & AVIO_SEEKABLE_NORMAL) {
-int bytes = expectedsize ? ebml_num_size(expectedsize) : 8;
-
 put_ebml_id(pb, elementid);
 *master = (ebml_master) { avio_tell(pb), bytes };
 if (mkv->write_crc)
 put_ebml_void(*dyn_cp, 6); /* Reserve space for CRC32 so 
position/size calculations using avio_tell() take it into account */
-} else
-*master = start_ebml_master(*dyn_cp, elementid, expectedsize);
 
 return 0;
 }
@@ -360,7 +355,6 @@ static void end_ebml_master_crc32(AVIOContext *pb, 
AVIOContext **dyn_cp, Matrosk
 uint8_t *buf, crc[4];
 int size, skip = 0;
 
-if (pb->seekable & AVIO_SEEKABLE_NORMAL) {
 size = avio_close_dyn_buf(*dyn_cp, &buf);
 put_ebml_num(pb, size, master.sizebytes);
 if (mkv->write_crc) {
@@ -369,11 +363,7 @@ static void end_ebml_master_crc32(AVIOContext *pb, 
AVIOContext **dyn_cp, Matrosk
 put_ebml_binary(pb, EBML_ID_CRC32, crc, sizeof(crc));
 }
 avio_write(pb, buf + skip, size - skip);
-} else {
-end_ebml_master(*dyn_cp, master);
-size = avio_close_dyn_buf(*dyn_cp, &buf);
-avio_write(pb, buf, size);
-}
+
 av_free(buf);
 *dyn_cp = NULL;
 }
diff --git a/tests/fate/matroska.mak b/tests/fate/matroska.mak
index 6bcd2b08d6..d1500a1aae 100644
--- a/tests/fate/matroska.mak
+++ b/tests/fate/matroska.mak
@@ -4,7 +4,7 @@
 FATE_MATROSKA-$(call DEMMUX, MATROSKA, MATROSKA) += fate-matroska-remux
 fate-matroska-remux: CMD = md5pipe -i 
$(TARGET_SAMPLES)/vp9-test-vectors/vp90-2-2pass-akiyo.webm -color_trc 4 -c:v 
copy -fflags +bitexact -strict -2 -f matroska
 fate-matroska-remux: CMP = oneline
-fate-matroska-remux: REF = 768af2b49132a0de5e0502926ab9ca4f
+fate-matroska-remux: REF = 82a5beaf7a0fb5bb2970d9bba9028086
 
 FATE_MATROSKA_FFPROBE-$(call ALLYES, MATROSKA_DEMUXER) += 
fate-matroska-spherical-mono
 fate-matroska-spherical-mono: CMD = run ffprobe$(PROGSSUF)$(EXESUF) 
-show_entries stream_side_data_list -select_streams v -v 0 
$(TARGET_SAMPLES)/mkv/spherical.mkv
diff --git a/tests/fate/wavpack.mak b/tests/fate/wavpack.mak
index a4095a9771..7358d50d82 100644
--- a/tests/fate/wavpack.mak
+++ b/tests/fate/wavpack.mak
@@ -91,12 +91,12 @@ fate-wavpack-matroskamode: CMD = md5 -i 
$(TARGET_SAMPLES)/wavpack/special/matros
 FATE_WAVPACK-$(call DEMMUX, WV, MATROSKA) += fate-wavpack-matroska_mux-mono
 fate-wavpack-matroska_mux-mono: CMD = md5pipe -i 
$(TARGET_SAMPLES)/wavpack/num_channels/mono_16bit_int.wv -c copy -fflags 
+bitexact -f matroska
 fate-wavpack-matroska_mux-mono: CMP = oneline
-fate-wavpack-matroska_mux-mono: REF = 646c726a80857b74a55ba16a6d83aeed
+fate-wavpack-matroska_mux-mono: REF = 942af4e88c4045e822508400545c47fd
 
 FATE_WAVPACK-$(call DEMMUX, WV, MATROSKA) += fate-wavpack-matroska_mux-61
 fate-wavpack-matroska_mux-61: CMD = md5pipe -i 
$(TARGET_SAMPLES)/wavpack/num_channels/eva_2.22_6.1_16bit-partial.wv -c copy 
-fflags +bitexact -f matroska
 fate-wavpack-matroska_mux-61: CMP = oneline
-fate-wavpack-matroska_mux-61: REF = 35b033bc75a0e18bbaabbaef38914837
+fate-wavpack-matroska_mux-61: REF = c874587c6172feb74df52230197396de
 
 FATE_SAMPLES_AVCONV += $(FATE_WAVPACK-yes)
 fate-wavpack: $(FATE_WAVPACK-yes)
diff --git a/tests/ref/fate/binsub-mksenc b/tests/ref/fate/binsub-mksenc
index 2f7022442f..cd958a80bc 100644
--- a/tests/ref/fate/binsub-mksenc
+++ b/tests/ref/fate/binsub-mksenc
@@ -1 +1 @@
-5d6f6f595b38d33424c186484f1c39ee
+1d0977e91873b77b4c78b61f4f3cdec5
-- 
2.21.0

___

[FFmpeg-devel] [PATCH 10/15] avformat/matroskaenc: Avoid seeking when writing level 1 elements

2019-04-19 Thread Andreas Rheinhardt
Up until now, the writing process for level 1 elements (those elements
for which CRC-32 elements are written by default) was this in case the
output was seekable: Write the EBML ID, write an "unkown length" EBML
number of the desired length, then write the element into a dynamic
buffer, then write the dynamic buffer (after possible calculation and
writing of the CRC-element), then seek back to the size element and
overwrite the unknown-size element with the real size. The seeking and
overwriting part has been eliminated by not writing the size initially.

Signed-off-by: Andreas Rheinhardt 
---
 libavformat/matroskaenc.c | 15 ++-
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
index 0be33419eb..2875552469 100644
--- a/libavformat/matroskaenc.c
+++ b/libavformat/matroskaenc.c
@@ -58,8 +58,9 @@
 #include "libavcodec/internal.h"
 
 typedef struct ebml_master {
-int64_t pos;///< absolute offset in the file where 
the master's elements start
-int sizebytes;  ///< how many bytes were reserved for 
the size
+int64_t pos;///< absolute offset in the containing 
AVIOContext where the size field starts
+///< for level 1 elements or else 
where the master's elements start
+int sizebytes;  ///< how many bytes were 
reserved/shall be used for the size
 } ebml_master;
 
 typedef struct mkv_seekhead_entry {
@@ -316,6 +317,7 @@ static ebml_master start_ebml_master(AVIOContext *pb, 
uint32_t elementid,
  uint64_t expectedsize)
 {
 int bytes = expectedsize ? ebml_num_size(expectedsize) : 8;
+
 put_ebml_id(pb, elementid);
 put_ebml_size_unknown(pb, bytes);
 return (ebml_master) {avio_tell(pb), bytes };
@@ -340,7 +342,10 @@ static int start_ebml_master_crc32(AVIOContext *pb, 
AVIOContext **dyn_cp, Matros
 return ret;
 
 if (pb->seekable & AVIO_SEEKABLE_NORMAL) {
-*master = start_ebml_master(pb, elementid, expectedsize);
+int bytes = expectedsize ? ebml_num_size(expectedsize) : 8;
+
+put_ebml_id(pb, elementid);
+*master = (ebml_master) { avio_tell(pb), bytes };
 if (mkv->write_crc)
 put_ebml_void(*dyn_cp, 6); /* Reserve space for CRC32 so 
position/size calculations using avio_tell() take it into account */
 } else
@@ -357,13 +362,13 @@ static void end_ebml_master_crc32(AVIOContext *pb, 
AVIOContext **dyn_cp, Matrosk
 
 if (pb->seekable & AVIO_SEEKABLE_NORMAL) {
 size = avio_close_dyn_buf(*dyn_cp, &buf);
+put_ebml_num(pb, size, master.sizebytes);
 if (mkv->write_crc) {
 skip = 6; /* Skip reserved 6-byte long void element from the 
dynamic buffer. */
 AV_WL32(crc, av_crc(av_crc_get_table(AV_CRC_32_IEEE_LE), 
UINT32_MAX, buf + skip, size - skip) ^ UINT32_MAX);
 put_ebml_binary(pb, EBML_ID_CRC32, crc, sizeof(crc));
 }
 avio_write(pb, buf + skip, size - skip);
-end_ebml_master(pb, master);
 } else {
 end_ebml_master(*dyn_cp, master);
 size = avio_close_dyn_buf(*dyn_cp, &buf);
@@ -383,8 +388,8 @@ static void end_ebml_master_crc32_preliminary(AVIOContext 
*pb, AVIOContext **dyn
 uint8_t *buf;
 int size = avio_get_dyn_buf(*dyn_cp, &buf);
 
+put_ebml_num(pb, size, master.sizebytes);
 avio_write(pb, buf, size);
-end_ebml_master(pb, master);
 }
 
 static void put_xiph_size(AVIOContext *pb, int size)
-- 
2.21.0

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

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

[FFmpeg-devel] [PATCH 08/15] avformat/matroskaenc: Remove redundant check

2019-04-19 Thread Andreas Rheinhardt
All places where end_ebml_master_crc32_preliminary are used already
check for whether the output is seekable, so the check in the function
is redundant.

Signed-off-by: Andreas Rheinhardt 
---
 libavformat/matroskaenc.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
index b300b23938..316a632805 100644
--- a/libavformat/matroskaenc.c
+++ b/libavformat/matroskaenc.c
@@ -379,14 +379,12 @@ static void end_ebml_master_crc32(AVIOContext *pb, 
AVIOContext **dyn_cp, Matrosk
 static void end_ebml_master_crc32_preliminary(AVIOContext *pb, AVIOContext 
**dyn_cp, MatroskaMuxContext *mkv,
 ebml_master master)
 {
-if (pb->seekable & AVIO_SEEKABLE_NORMAL) {
 
 uint8_t *buf;
 int size = avio_get_dyn_buf(*dyn_cp, &buf);
 
 avio_write(pb, buf, size);
 end_ebml_master(pb, master);
-}
 }
 
 static void put_xiph_size(AVIOContext *pb, int size)
-- 
2.21.0

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

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

[FFmpeg-devel] [PATCH 09/15] avformat/matroskaenc: Change variable types

2019-04-19 Thread Andreas Rheinhardt
A Matroska EBML ID can only be maximally four bytes long, so make the
variables denoting EBML IDs uint32_t instead of unsigned int to
better reflect this.

Signed-off-by: Andreas Rheinhardt 
---
 libavformat/matroskaenc.c | 32 
 1 file changed, 16 insertions(+), 16 deletions(-)

diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
index 316a632805..0be33419eb 100644
--- a/libavformat/matroskaenc.c
+++ b/libavformat/matroskaenc.c
@@ -63,7 +63,7 @@ typedef struct ebml_master {
 } ebml_master;
 
 typedef struct mkv_seekhead_entry {
-unsigned intelementid;
+uint32_telementid;
 uint64_tsegmentpos;
 } mkv_seekhead_entry;
 
@@ -182,12 +182,12 @@ typedef struct MatroskaMuxContext {
 /** Seek preroll value for opus */
 #define OPUS_SEEK_PREROLL 8000
 
-static int ebml_id_size(unsigned int id)
+static int ebml_id_size(uint32_t id)
 {
 return (av_log2(id + 1) - 1) / 7 + 1;
 }
 
-static void put_ebml_id(AVIOContext *pb, unsigned int id)
+static void put_ebml_id(AVIOContext *pb, uint32_t id)
 {
 int i = ebml_id_size(id);
 while (i--)
@@ -242,7 +242,7 @@ static void put_ebml_num(AVIOContext *pb, uint64_t num, int 
bytes)
 avio_w8(pb, (uint8_t)(num >> i * 8));
 }
 
-static void put_ebml_uint(AVIOContext *pb, unsigned int elementid, uint64_t 
val)
+static void put_ebml_uint(AVIOContext *pb, uint32_t elementid, uint64_t val)
 {
 int i, bytes = 1;
 uint64_t tmp = val;
@@ -255,7 +255,7 @@ static void put_ebml_uint(AVIOContext *pb, unsigned int 
elementid, uint64_t val)
 avio_w8(pb, (uint8_t)(val >> i * 8));
 }
 
-static void put_ebml_sint(AVIOContext *pb, unsigned int elementid, int64_t val)
+static void put_ebml_sint(AVIOContext *pb, uint32_t elementid, int64_t val)
 {
 int i, bytes = 1;
 uint64_t tmp = 2*(val < 0 ? val^-1 : val);
@@ -268,14 +268,14 @@ static void put_ebml_sint(AVIOContext *pb, unsigned int 
elementid, int64_t val)
 avio_w8(pb, (uint8_t)(val >> i * 8));
 }
 
-static void put_ebml_float(AVIOContext *pb, unsigned int elementid, double val)
+static void put_ebml_float(AVIOContext *pb, uint32_t elementid, double val)
 {
 put_ebml_id(pb, elementid);
 put_ebml_num(pb, 8, 0);
 avio_wb64(pb, av_double2int(val));
 }
 
-static void put_ebml_binary(AVIOContext *pb, unsigned int elementid,
+static void put_ebml_binary(AVIOContext *pb, uint32_t elementid,
 const void *buf, int size)
 {
 put_ebml_id(pb, elementid);
@@ -283,7 +283,7 @@ static void put_ebml_binary(AVIOContext *pb, unsigned int 
elementid,
 avio_write(pb, buf, size);
 }
 
-static void put_ebml_string(AVIOContext *pb, unsigned int elementid,
+static void put_ebml_string(AVIOContext *pb, uint32_t elementid,
 const char *str)
 {
 put_ebml_binary(pb, elementid, str, strlen(str));
@@ -312,7 +312,7 @@ static void put_ebml_void(AVIOContext *pb, uint64_t size)
 ffio_fill(pb, 0, currentpos + size - avio_tell(pb));
 }
 
-static ebml_master start_ebml_master(AVIOContext *pb, unsigned int elementid,
+static ebml_master start_ebml_master(AVIOContext *pb, uint32_t elementid,
  uint64_t expectedsize)
 {
 int bytes = expectedsize ? ebml_num_size(expectedsize) : 8;
@@ -332,7 +332,7 @@ static void end_ebml_master(AVIOContext *pb, ebml_master 
master)
 }
 
 static int start_ebml_master_crc32(AVIOContext *pb, AVIOContext **dyn_cp, 
MatroskaMuxContext *mkv,
-   ebml_master *master, unsigned int 
elementid, uint64_t expectedsize)
+   ebml_master *master, uint32_t elementid, 
uint64_t expectedsize)
 {
 int ret;
 
@@ -463,7 +463,7 @@ static mkv_seekhead *mkv_start_seekhead(AVIOContext *pb, 
int64_t segment_offset,
 return new_seekhead;
 }
 
-static int mkv_add_seekhead_entry(mkv_seekhead *seekhead, unsigned int 
elementid, uint64_t filepos)
+static int mkv_add_seekhead_entry(mkv_seekhead *seekhead, uint32_t elementid, 
uint64_t filepos)
 {
 mkv_seekhead_entry *entries = seekhead->entries;
 
@@ -1575,7 +1575,7 @@ static int mkv_write_simpletag(AVIOContext *pb, 
AVDictionaryEntry *t)
 }
 
 static int mkv_write_tag_targets(AVFormatContext *s,
- unsigned int elementid, unsigned int uid,
+ uint32_t elementid, unsigned int uid,
  ebml_master *tags, ebml_master* tag)
 {
 AVIOContext *pb;
@@ -1599,7 +1599,7 @@ static int mkv_write_tag_targets(AVFormatContext *s,
 return 0;
 }
 
-static int mkv_check_tag_name(const char *name, unsigned int elementid)
+static int mkv_check_tag_name(const char *name, uint32_t elementid)
 {
 return av_strcasecmp(name, "title") &&
av_strcasecmp(name, "stereo_mode") &&
@@ -1613,7 +1613,7 @@ static int mkv_check_tag_name(const char *name, unsigned 
int elementid)
  av_strcasecmp(name, "mimetype")));
 }
 

[FFmpeg-devel] [PATCH 06/15] avformat/matroskaenc: Simplify check for writing CRCs

2019-04-19 Thread Andreas Rheinhardt
Up until now, the check for whether to write CRC32 elements was always
mkv->write_crc && mkv->mode != MODE_WEBM. This is equivalent to simply
set write_crc to zero in WebM-mode. And this is what this commit does.

Signed-off-by: Andreas Rheinhardt 
---
 libavformat/matroskaenc.c | 11 ++-
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
index 75863659bc..e62346963e 100644
--- a/libavformat/matroskaenc.c
+++ b/libavformat/matroskaenc.c
@@ -341,7 +341,7 @@ static int start_ebml_master_crc32(AVIOContext *pb, 
AVIOContext **dyn_cp, Matros
 
 if (pb->seekable & AVIO_SEEKABLE_NORMAL) {
 *master = start_ebml_master(pb, elementid, expectedsize);
-if (mkv->write_crc && mkv->mode != MODE_WEBM)
+if (mkv->write_crc)
 put_ebml_void(*dyn_cp, 6); /* Reserve space for CRC32 so 
position/size calculations using avio_tell() take it into account */
 } else
 *master = start_ebml_master(*dyn_cp, elementid, expectedsize);
@@ -357,7 +357,7 @@ static void end_ebml_master_crc32(AVIOContext *pb, 
AVIOContext **dyn_cp, Matrosk
 
 if (pb->seekable & AVIO_SEEKABLE_NORMAL) {
 size = avio_close_dyn_buf(*dyn_cp, &buf);
-if (mkv->write_crc && mkv->mode != MODE_WEBM) {
+if (mkv->write_crc) {
 skip = 6; /* Skip reserved 6-byte long void element from the 
dynamic buffer. */
 AV_WL32(crc, av_crc(av_crc_get_table(AV_CRC_32_IEEE_LE), 
UINT32_MAX, buf + skip, size - skip) ^ UINT32_MAX);
 put_ebml_binary(pb, EBML_ID_CRC32, crc, sizeof(crc));
@@ -1867,9 +1867,10 @@ static int mkv_write_header(AVFormatContext *s)
 int ret, i, version = 2;
 int64_t creation_time;
 
-if (!strcmp(s->oformat->name, "webm"))
-mkv->mode = MODE_WEBM;
-else
+if (!strcmp(s->oformat->name, "webm")) {
+mkv->mode  = MODE_WEBM;
+mkv->write_crc = 0;
+} else
 mkv->mode = MODE_MATROSKAv2;
 
 if (mkv->mode != MODE_WEBM ||
-- 
2.21.0

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

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

[FFmpeg-devel] [PATCH 07/15] avformat/matroskaenc: Improve log message

2019-04-19 Thread Andreas Rheinhardt
Since 4e3bdf729a80f868b014ceb02901d87198b545a5 there is no reason any
more to treat the seekable and non-seekable cases separate with regards
to the log message for a new cluster. This effectively reverts
d41aeea8a64bab5d7aacd602f7214f95baad109f.

Also improved the log message: "pts 80dts 0" -> "pts 80, dts 0".

Signed-off-by: Andreas Rheinhardt 
---
 libavformat/matroskaenc.c | 10 +-
 1 file changed, 1 insertion(+), 9 deletions(-)

diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
index e62346963e..b300b23938 100644
--- a/libavformat/matroskaenc.c
+++ b/libavformat/matroskaenc.c
@@ -2265,15 +2265,10 @@ static void mkv_start_new_cluster(AVFormatContext *s, 
AVPacket *pkt)
 
 end_ebml_master_crc32(s->pb, &mkv->dyn_bc, mkv, mkv->cluster);
 mkv->cluster_pos = -1;
-if (s->pb->seekable & AVIO_SEEKABLE_NORMAL)
 av_log(s, AV_LOG_DEBUG,
"Starting new cluster at offset %" PRIu64 " bytes, "
-   "pts %" PRIu64 "dts %" PRIu64 "\n",
+   "pts %" PRIu64 ", dts %" PRIu64 "\n",
avio_tell(s->pb), pkt->pts, pkt->dts);
-else
-av_log(s, AV_LOG_DEBUG, "Starting new cluster, "
-   "pts %" PRIu64 "dts %" PRIu64 "\n",
-   pkt->pts, pkt->dts);
 avio_flush(s->pb);
 }
 
@@ -2551,12 +2546,9 @@ static int mkv_write_flush_packet(AVFormatContext *s, 
AVPacket *pkt)
 if (mkv->cluster_pos != -1) {
 end_ebml_master_crc32(s->pb, &mkv->dyn_bc, mkv, mkv->cluster);
 mkv->cluster_pos = -1;
-if (s->pb->seekable & AVIO_SEEKABLE_NORMAL)
 av_log(s, AV_LOG_DEBUG,
"Flushing cluster at offset %" PRIu64 " bytes\n",
avio_tell(s->pb));
-else
-av_log(s, AV_LOG_DEBUG, "Flushing cluster\n");
 avio_flush(s->pb);
 }
 return 1;
-- 
2.21.0

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

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

[FFmpeg-devel] [PATCH 02/15] avformat/matroskaenc: Fix BlockGroup size calculation

2019-04-19 Thread Andreas Rheinhardt
The earlier code included the size of the BlockGroup's length field and
the EBML ID in the calculation of the size for the payload and ignored
the size of the  duration's length field. This meant that Blockgroups
corresponding to packets with size 2^(7n) - 17 - n - i, i = 0,..., n - 1,
n = 1,..., 8 (i.e. 110, 16364, 16365, 2097130..2097132, ...) were written
with length fields that are unnecessarily long.

Signed-off-by: Andreas Rheinhardt 
---
 libavformat/matroskaenc.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
index c006cbf35c..1849ae 100644
--- a/libavformat/matroskaenc.c
+++ b/libavformat/matroskaenc.c
@@ -2059,9 +2059,7 @@ static int mkv_blockgroup_size(int pkt_size)
 int size = pkt_size + 4;
 size += ebml_num_size(size);
 size += 2;  // EBML ID for block and block duration
-size += 8;  // max size of block duration
-size += ebml_num_size(size);
-size += 1;  // blockgroup EBML ID
+size += 9;  // max size of block duration incl. length field
 return size;
 }
 
-- 
2.21.0

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

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

[FFmpeg-devel] [PATCH 05/15] avformat/matroskaenc: Remove traces of secondary seek head

2019-04-19 Thread Andreas Rheinhardt
Up until e7ddafd515dc9826915b739d0b977a63c21e96af the Matroska muxer
wrote a secondary seek head referencing all the clusters. When this
was changed, a (now completely wrong) comment remained and the unique
remaining seek head was still called main_seekhead. This has been
changed.

Signed-off-by: Andreas Rheinhardt 
---
 libavformat/matroskaenc.c | 38 ++
 1 file changed, 18 insertions(+), 20 deletions(-)

diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
index 5e2127de7e..75863659bc 100644
--- a/libavformat/matroskaenc.c
+++ b/libavformat/matroskaenc.c
@@ -134,7 +134,7 @@ typedef struct MatroskaMuxContext {
 int64_t cluster_pts;
 int64_t duration_offset;
 int64_t duration;
-mkv_seekhead*main_seekhead;
+mkv_seekhead*seekhead;
 mkv_cues*cues;
 mkv_track   *tracks;
 mkv_attachments *attachments;
@@ -416,9 +416,9 @@ static void mkv_free(MatroskaMuxContext *mkv) {
 avio_close_dyn_buf(mkv->tags_bc, &buf);
 av_free(buf);
 }
-if (mkv->main_seekhead) {
-av_freep(&mkv->main_seekhead->entries);
-av_freep(&mkv->main_seekhead);
+if (mkv->seekhead) {
+av_freep(&mkv->seekhead->entries);
+av_freep(&mkv->seekhead);
 }
 if (mkv->cues) {
 av_freep(&mkv->cues->entries);
@@ -496,7 +496,7 @@ static int mkv_add_seekhead_entry(mkv_seekhead *seekhead, 
unsigned int elementid
 static int64_t mkv_write_seekhead(AVIOContext *pb, MatroskaMuxContext *mkv)
 {
 AVIOContext *dyn_cp;
-mkv_seekhead *seekhead = mkv->main_seekhead;
+mkv_seekhead *seekhead = mkv->seekhead;
 ebml_master metaseek, seekentry;
 int64_t currentpos;
 int i;
@@ -538,8 +538,8 @@ static int64_t mkv_write_seekhead(AVIOContext *pb, 
MatroskaMuxContext *mkv)
 currentpos = seekhead->filepos;
 }
 fail:
-av_freep(&mkv->main_seekhead->entries);
-av_freep(&mkv->main_seekhead);
+av_freep(&mkv->seekhead->entries);
+av_freep(&mkv->seekhead);
 
 return currentpos;
 }
@@ -1458,7 +1458,7 @@ static int mkv_write_tracks(AVFormatContext *s)
 AVIOContext *pb = s->pb;
 int i, ret, default_stream_exists = 0;
 
-ret = mkv_add_seekhead_entry(mkv->main_seekhead, MATROSKA_ID_TRACKS, 
avio_tell(pb));
+ret = mkv_add_seekhead_entry(mkv->seekhead, MATROSKA_ID_TRACKS, 
avio_tell(pb));
 if (ret < 0)
 return ret;
 
@@ -1495,7 +1495,7 @@ static int mkv_write_chapters(AVFormatContext *s)
 if (!s->nb_chapters || mkv->wrote_chapters)
 return 0;
 
-ret = mkv_add_seekhead_entry(mkv->main_seekhead, MATROSKA_ID_CHAPTERS, 
avio_tell(pb));
+ret = mkv_add_seekhead_entry(mkv->seekhead, MATROSKA_ID_CHAPTERS, 
avio_tell(pb));
 if (ret < 0) return ret;
 
 ret = start_ebml_master_crc32(pb, &dyn_cp, mkv, &chapters, 
MATROSKA_ID_CHAPTERS, 0);
@@ -1586,7 +1586,7 @@ static int mkv_write_tag_targets(AVFormatContext *s,
 int ret;
 
 if (!tags->pos) {
-ret = mkv_add_seekhead_entry(mkv->main_seekhead, MATROSKA_ID_TAGS, 
avio_tell(s->pb));
+ret = mkv_add_seekhead_entry(mkv->seekhead, MATROSKA_ID_TAGS, 
avio_tell(s->pb));
 if (ret < 0) return ret;
 
 start_ebml_master_crc32(s->pb, &mkv->tags_bc, mkv, tags, 
MATROSKA_ID_TAGS, 0);
@@ -1753,7 +1753,7 @@ static int mkv_write_attachments(AVFormatContext *s)
 
 av_lfg_init(&c, av_get_random_seed());
 
-ret = mkv_add_seekhead_entry(mkv->main_seekhead, MATROSKA_ID_ATTACHMENTS, 
avio_tell(pb));
+ret = mkv_add_seekhead_entry(mkv->seekhead, MATROSKA_ID_ATTACHMENTS, 
avio_tell(pb));
 if (ret < 0) return ret;
 
 ret = start_ebml_master_crc32(pb, &dyn_cp, mkv, &attachments, 
MATROSKA_ID_ATTACHMENTS, 0);
@@ -1902,18 +1902,16 @@ static int mkv_write_header(AVFormatContext *s)
 mkv->segment = start_ebml_master(pb, MATROSKA_ID_SEGMENT, 0);
 mkv->segment_offset = avio_tell(pb);
 
-// we write 2 seek heads - one at the end of the file to point to each
-// cluster, and one at the beginning to point to all other level one
-// elements (including the seek head at the end of the file), which
-// isn't more than 10 elements if we only write one of each other
-// currently defined level 1 element
-mkv->main_seekhead= mkv_start_seekhead(pb, mkv->segment_offset, 10);
-if (!mkv->main_seekhead) {
+// we write a seek head at the beginning to point to all other level
+// one elements, which aren't more than 10 elements as we write only one
+// of every other currently defined level 1 element
+mkv->seekhead = mkv_start_seekhead(pb, mkv->segment_offset, 10);
+if (!mkv->seekhead) {
 ret = AVERROR(ENOMEM);
 goto fail;
 }
 
-ret = mkv_add_seekhead_entry(mkv->main_seekhead, MATROSKA_ID_INFO, 
avio_tell(pb));
+ret = mkv_add_seekhead_entry(mkv->seekhead, MATROSKA_ID_INFO, 
avio_tell(pb));
 if (ret < 0) goto fail;
 
 ret = start_ebml_master_crc32(pb, 

[FFmpeg-devel] [PATCH 04/15] avformat/matroskaenc: Don't waste bytes in EBML Header

2019-04-19 Thread Andreas Rheinhardt
Up until now the EBML Header length field has been written with eight
bytes, although the EBML Header is always so small that only one byte
is needed for it. This patch saves seven bytes for every Matroska/Webm
file.

Signed-off-by: Andreas Rheinhardt 
---
 libavformat/matroskaenc.c|  5 +++-
 tests/fate/matroska.mak  |  2 +-
 tests/fate/wavpack.mak   |  4 +--
 tests/ref/fate/aac-autobsf-adtstoasc |  4 +--
 tests/ref/fate/binsub-mksenc |  2 +-
 tests/ref/fate/rgb24-mkv |  4 +--
 tests/ref/lavf/mka   |  4 +--
 tests/ref/lavf/mkv   |  4 +--
 tests/ref/lavf/mkv_attachment|  4 +--
 tests/ref/seek/lavf-mkv  | 44 ++--
 10 files changed, 40 insertions(+), 37 deletions(-)

diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
index 0448253a77..5e2127de7e 100644
--- a/libavformat/matroskaenc.c
+++ b/libavformat/matroskaenc.c
@@ -164,6 +164,9 @@ typedef struct MatroskaMuxContext {
 int allow_raw_vfw;
 } MatroskaMuxContext;
 
+/** 2 bytes * 7 for EBML IDs, 7 1-byte EBML lengths, 6 1-byte uint,
+ * 8 byte for "matroska" doctype string */
+#define MAX_EBML_HEADER_SIZE 35
 
 /** 2 bytes * 3 for EBML IDs, 3 1-byte EBML lengths, 8 bytes for 64 bit
  * offset, 4 bytes for target EBML ID */
@@ -1886,7 +1889,7 @@ static int mkv_write_header(AVFormatContext *s)
 ret = AVERROR(ENOMEM);
 goto fail;
 }
-ebml_header = start_ebml_master(pb, EBML_ID_HEADER, 0);
+ebml_header = start_ebml_master(pb, EBML_ID_HEADER, MAX_EBML_HEADER_SIZE);
 put_ebml_uint   (pb, EBML_ID_EBMLVERSION,   1);
 put_ebml_uint   (pb, EBML_ID_EBMLREADVERSION,   1);
 put_ebml_uint   (pb, EBML_ID_EBMLMAXIDLENGTH,   4);
diff --git a/tests/fate/matroska.mak b/tests/fate/matroska.mak
index 2747496e1e..6bcd2b08d6 100644
--- a/tests/fate/matroska.mak
+++ b/tests/fate/matroska.mak
@@ -4,7 +4,7 @@
 FATE_MATROSKA-$(call DEMMUX, MATROSKA, MATROSKA) += fate-matroska-remux
 fate-matroska-remux: CMD = md5pipe -i 
$(TARGET_SAMPLES)/vp9-test-vectors/vp90-2-2pass-akiyo.webm -color_trc 4 -c:v 
copy -fflags +bitexact -strict -2 -f matroska
 fate-matroska-remux: CMP = oneline
-fate-matroska-remux: REF = 1ed49a4f2b6790357fac268938357353
+fate-matroska-remux: REF = 768af2b49132a0de5e0502926ab9ca4f
 
 FATE_MATROSKA_FFPROBE-$(call ALLYES, MATROSKA_DEMUXER) += 
fate-matroska-spherical-mono
 fate-matroska-spherical-mono: CMD = run ffprobe$(PROGSSUF)$(EXESUF) 
-show_entries stream_side_data_list -select_streams v -v 0 
$(TARGET_SAMPLES)/mkv/spherical.mkv
diff --git a/tests/fate/wavpack.mak b/tests/fate/wavpack.mak
index e4e8d47128..a4095a9771 100644
--- a/tests/fate/wavpack.mak
+++ b/tests/fate/wavpack.mak
@@ -91,12 +91,12 @@ fate-wavpack-matroskamode: CMD = md5 -i 
$(TARGET_SAMPLES)/wavpack/special/matros
 FATE_WAVPACK-$(call DEMMUX, WV, MATROSKA) += fate-wavpack-matroska_mux-mono
 fate-wavpack-matroska_mux-mono: CMD = md5pipe -i 
$(TARGET_SAMPLES)/wavpack/num_channels/mono_16bit_int.wv -c copy -fflags 
+bitexact -f matroska
 fate-wavpack-matroska_mux-mono: CMP = oneline
-fate-wavpack-matroska_mux-mono: REF = 11773e2a518edc788475f3880d849230
+fate-wavpack-matroska_mux-mono: REF = 646c726a80857b74a55ba16a6d83aeed
 
 FATE_WAVPACK-$(call DEMMUX, WV, MATROSKA) += fate-wavpack-matroska_mux-61
 fate-wavpack-matroska_mux-61: CMD = md5pipe -i 
$(TARGET_SAMPLES)/wavpack/num_channels/eva_2.22_6.1_16bit-partial.wv -c copy 
-fflags +bitexact -f matroska
 fate-wavpack-matroska_mux-61: CMP = oneline
-fate-wavpack-matroska_mux-61: REF = 9641abdf596c10c2e21bd9b026d4bade
+fate-wavpack-matroska_mux-61: REF = 35b033bc75a0e18bbaabbaef38914837
 
 FATE_SAMPLES_AVCONV += $(FATE_WAVPACK-yes)
 fate-wavpack: $(FATE_WAVPACK-yes)
diff --git a/tests/ref/fate/aac-autobsf-adtstoasc 
b/tests/ref/fate/aac-autobsf-adtstoasc
index 9ca8e7ed9e..3537e82a30 100644
--- a/tests/ref/fate/aac-autobsf-adtstoasc
+++ b/tests/ref/fate/aac-autobsf-adtstoasc
@@ -1,5 +1,5 @@
-b0375ba00bcbd55023a176255b8d4ba2 
*tests/data/fate/aac-autobsf-adtstoasc.matroska
-6728 tests/data/fate/aac-autobsf-adtstoasc.matroska
+63292d538da403964777e17eb65deae7 
*tests/data/fate/aac-autobsf-adtstoasc.matroska
+6721 tests/data/fate/aac-autobsf-adtstoasc.matroska
 #extradata 0:2, 0x0030001c
 #tb 0: 1/1000
 #media_type 0: audio
diff --git a/tests/ref/fate/binsub-mksenc b/tests/ref/fate/binsub-mksenc
index f247d9d22d..2f7022442f 100644
--- a/tests/ref/fate/binsub-mksenc
+++ b/tests/ref/fate/binsub-mksenc
@@ -1 +1 @@
-f80f42e646fce972e73aa6d99dcfa470
+5d6f6f595b38d33424c186484f1c39ee
diff --git a/tests/ref/fate/rgb24-mkv b/tests/ref/fate/rgb24-mkv
index 9f0064b08d..4e91e6c0e3 100644
--- a/tests/ref/fate/rgb24-mkv
+++ b/tests/ref/fate/rgb24-mkv
@@ -1,5 +1,5 @@
-d84d5a83971be9c2caa2f4c37bbbfefd *tests/data/fate/rgb24-mkv.matroska
-58343 tests/data/fate/rgb24-mkv.matroska
+a00bb0c1bc614872d2267ce9059ae3c7 *tests/data/fate/rgb24-mkv

[FFmpeg-devel] [PATCH 03/15] avformat/matroskaenc: Slightly improve size bounds for cues

2019-04-19 Thread Andreas Rheinhardt
The upper bounds currently used for determining the size of a CuePoint's
length field can be improved somewhat; as a result, a CuePoint
containing three CueTrackPositions will now only need a size field
with one byte length.

Signed-off-by: Andreas Rheinhardt 
---
 libavformat/matroskaenc.c | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
index 1849ae..0448253a77 100644
--- a/libavformat/matroskaenc.c
+++ b/libavformat/matroskaenc.c
@@ -169,12 +169,12 @@ typedef struct MatroskaMuxContext {
  * offset, 4 bytes for target EBML ID */
 #define MAX_SEEKENTRY_SIZE 21
 
-/** per-cuepoint-track - 5 1-byte EBML IDs, 5 1-byte EBML sizes, 4
- * 8-byte uint max */
-#define MAX_CUETRACKPOS_SIZE 42
+/** per-cuepoint-track - 5 1-byte EBML IDs, 5 1-byte EBML sizes, 3 8-byte uint 
max
+ * and one 1-byte uint for the track number (this assumes MAX_TRACKS to be <= 
255) */
+#define MAX_CUETRACKPOS_SIZE 35
 
-/** per-cuepoint - 2 1-byte EBML IDs, 2 1-byte EBML sizes, 8-byte uint max */
-#define MAX_CUEPOINT_SIZE(num_tracks) 12 + MAX_CUETRACKPOS_SIZE * num_tracks
+/** per-cuepoint - 1 1-byte EBML ID, 1 1-byte EBML size, 8-byte uint max */
+#define MAX_CUEPOINT_CONTENT_SIZE(num_tracks) 10 + MAX_CUETRACKPOS_SIZE * 
num_tracks
 
 /** Seek preroll value for opus */
 #define OPUS_SEEK_PREROLL 8000
@@ -605,7 +605,7 @@ static int64_t mkv_write_cues(AVFormatContext *s, mkv_cues 
*cues, mkv_track *tra
 ctp_nb ++;
 }
 
-cuepoint = start_ebml_master(dyn_cp, MATROSKA_ID_POINTENTRY, 
MAX_CUEPOINT_SIZE(ctp_nb));
+cuepoint = start_ebml_master(dyn_cp, MATROSKA_ID_POINTENTRY, 
MAX_CUEPOINT_CONTENT_SIZE(ctp_nb));
 put_ebml_uint(dyn_cp, MATROSKA_ID_CUETIME, pts);
 
 // put all the entries from different tracks that have the exact same
-- 
2.21.0

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

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

[FFmpeg-devel] [PATCH 01/15] avformat/matroskaenc: Fix relative timestamp check

2019-04-19 Thread Andreas Rheinhardt
At this point, ts already includes the ts_offset so that the relative
time written with the cluster is already given by ts - mkv->cluster_pts.
It is this number that needs to fit into an int16_t.

Signed-off-by: Andreas Rheinhardt 
---
The only difference between this version and the earlier version is the
authorship information. My earlier emails were munged and in order to
make the committer's life easier, I'll resend the whole patchset.
I would appreciate reviews and comments.
 libavformat/matroskaenc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
index 1c98c0dceb..c006cbf35c 100644
--- a/libavformat/matroskaenc.c
+++ b/libavformat/matroskaenc.c
@@ -2404,7 +2404,7 @@ static int mkv_write_packet_internal(AVFormatContext *s, 
AVPacket *pkt, int add_
 ts += mkv->tracks[pkt->stream_index].ts_offset;
 
 if (mkv->cluster_pos != -1) {
-int64_t cluster_time = ts - mkv->cluster_pts + 
mkv->tracks[pkt->stream_index].ts_offset;
+int64_t cluster_time = ts - mkv->cluster_pts;
 if ((int16_t)cluster_time != cluster_time) {
 av_log(s, AV_LOG_WARNING, "Starting new cluster due to 
timestamp\n");
 mkv_start_new_cluster(s, pkt);
-- 
2.21.0

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

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

Re: [FFmpeg-devel] Patchwork attribution

2019-04-19 Thread Lou Logan
On Fri, Apr 19, 2019, at 2:15 PM, Hendrik Leppkes wrote:
>
> The first mail like that arrived, and handling of it  of course
> depends on the mail client in question. But at least Patchwork doesn't
> seem to like it much, it  quite simply still attributes it to the
> "shared" mail.
> Not sure if there  is some way to get Patchwork to improve in that regard.

I changed ffmpeg-devel back to the original "accept" setting. Trades one
issue for another.

I left the other mailing lists as "munge".
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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

Re: [FFmpeg-devel] [PATCH]lavfi/fspp: Add a cast to silence a clang warning

2019-04-19 Thread Carl Eugen Hoyos
2019-04-18 14:07 GMT+02:00, Carl Eugen Hoyos :
> 2019-04-18 12:16 GMT+02:00, Michael Niedermayer :

>>> Silences a warning with clang:
>>> warning: implicit conversion from 'int' to 'int16_t' (aka 'short')
>>> changes
>>> value from 44130 to -21406
>>> ---
>>>  libavfilter/vf_fspp.h |2 +-
>>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/libavfilter/vf_fspp.h b/libavfilter/vf_fspp.h
>>> index 802db14..bdafe8e 100644
>>> --- a/libavfilter/vf_fspp.h
>>> +++ b/libavfilter/vf_fspp.h
>>> @@ -31,7 +31,7 @@
>>>  #define DCTSIZE 8
>>>  #define DCTSIZE_S "8"
>>>
>>> -#define FIX(x,s)  ((int) ((x) * (1 << s) + 0.5) & 0x)
>>> +#define FIX(x,s)  ((int16_t)((x) * (1 << s) + 0.5))
>>
>> does it need the cast at all to avoid the warning ?
>
> Attached patch also avoids the warning.

Patch applied.

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

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

Re: [FFmpeg-devel] [PATCH]configure: Add .exe suffix to some Windows executable names

2019-04-19 Thread Carl Eugen Hoyos
2019-04-19 16:18 GMT+02:00, Carl Eugen Hoyos :

> Attached patch is necessary for msvc compilation on wsl.

Patch applied, in-tree msvc compilation with wsl works for
all targets.

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

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

Re: [FFmpeg-devel] Patchwork attribution

2019-04-19 Thread Hendrik Leppkes
On Fri, Apr 19, 2019 at 8:23 PM Lou Logan  wrote:
>
> On Thu, 18 Apr 2019 18:01:27 -0400
> "Lou Logan"  wrote:
> >
> > But we can certainly give it a try if you like. I'm not sure how patchwork 
> > will handle it.
>
> (Didn't realize my webmail client wasn't actually wrapping my text
> although it was doing it in the window at the expected lengths.)
>
> I just changed it from "munge" to "wrap" (only on ffmpeg-devel for
> now). If it doesn't work out then I'll just go back to the original
> setting of "accept" until if/when we find a better solution. We will
> lose some subscribers but the current patch author mangling is not
> worth the trouble in my opinion.

The first mail like that arrived, and handling of it  of course
depends on the mail client in question. But at least Patchwork doesn't
seem to like it much, it  quite simply still attributes it to the
"shared" mail.
Not sure if there  is some way to get Patchwork to improve in that regard.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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

[FFmpeg-devel] [PATCH 2/3] lavf/webm_chunk: Fix NULL dereference

2019-04-19 Thread Andreas Rheinhardt
The earlier version of the webm_chunk muxer had several bugs:

1. If the first packet of an audio stream didn't have a PTS of zero,
then no chunk will be started before a packet is delivered to the
underlying Matroska/WebM muxer, i.e. the AVFormatContext used to write
these packets had a NULL as AVIOContext for output. This is behind the
crash in ticket #5752.

2. If an error happens during writing a packet, the underlyimg
Matroska/WebM muxer context is freed. This leads to a use-after-free
coupled with a double-free in webm_chunk_write_trailer (which supposes
that the underlying AVFormatContext is still valid).

3. Even when no error occurs at all, webm_chunk_write_trailer is still
buggy: After the underlying Matroska/WebM muxer has written its trailer,
ending the chunk implicitly flushes it again which is illegal at this
point.

These bugs have been fixed.

Fixes #5752.

Signed-off-by: Andreas Rheinhardt 
---
 libavformat/webm_chunk.c | 44 +---
 1 file changed, 23 insertions(+), 21 deletions(-)

diff --git a/libavformat/webm_chunk.c b/libavformat/webm_chunk.c
index 2c99753b5b..391fee721a 100644
--- a/libavformat/webm_chunk.c
+++ b/libavformat/webm_chunk.c
@@ -168,7 +168,7 @@ static int chunk_start(AVFormatContext *s)
 return 0;
 }
 
-static int chunk_end(AVFormatContext *s)
+static int chunk_end(AVFormatContext *s, int flush)
 {
 WebMChunkContext *wc = s->priv_data;
 AVFormatContext *oc = wc->avf;
@@ -179,11 +179,14 @@ static int chunk_end(AVFormatContext *s)
 char filename[MAX_FILENAME_SIZE];
 AVDictionary *options = NULL;
 
-if (wc->chunk_start_index == wc->chunk_index)
+if (!oc->pb)
 return 0;
-// Flush the cluster in WebM muxer.
-oc->oformat->write_packet(oc, NULL);
+
+if (flush)
+// Flush the cluster in WebM muxer.
+oc->oformat->write_packet(oc, NULL);
 buffer_size = avio_close_dyn_buf(oc->pb, &buffer);
+oc->pb = NULL;
 ret = get_chunk_filename(s, 0, filename);
 if (ret < 0)
 goto fail;
@@ -194,7 +197,6 @@ static int chunk_end(AVFormatContext *s)
 goto fail;
 avio_write(pb, buffer, buffer_size);
 ff_format_io_close(s, &pb);
-oc->pb = NULL;
 fail:
 av_dict_free(&options);
 av_free(buffer);
@@ -216,27 +218,19 @@ static int webm_chunk_write_packet(AVFormatContext *s, 
AVPacket *pkt)
 }
 
 // For video, a new chunk is started only on key frames. For audio, a new
-// chunk is started based on chunk_duration.
-if ((st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO &&
+// chunk is started based on chunk_duration. Also, a new chunk is started
+// unconditionally if there is no currently open chunk.
+if (!oc->pb || (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO &&
  (pkt->flags & AV_PKT_FLAG_KEY)) ||
 (st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO &&
- (pkt->pts == 0 || wc->duration_written >= wc->chunk_duration))) {
+ wc->duration_written >= wc->chunk_duration)) {
 wc->duration_written = 0;
-if ((ret = chunk_end(s)) < 0 || (ret = chunk_start(s)) < 0) {
-goto fail;
+if ((ret = chunk_end(s, 1)) < 0 || (ret = chunk_start(s)) < 0) {
+return ret;
 }
 }
 
 ret = oc->oformat->write_packet(oc, pkt);
-if (ret < 0)
-goto fail;
-
-fail:
-if (ret < 0) {
-oc->streams = NULL;
-oc->nb_streams = 0;
-avformat_free_context(oc);
-}
 
 return ret;
 }
@@ -245,12 +239,20 @@ static int webm_chunk_write_trailer(AVFormatContext *s)
 {
 WebMChunkContext *wc = s->priv_data;
 AVFormatContext *oc = wc->avf;
+int ret;
+
+if (!oc->pb) {
+ret = chunk_start(s);
+if (ret < 0)
+goto fail;
+}
 oc->oformat->write_trailer(oc);
-chunk_end(s);
+ret = chunk_end(s, 0);
+fail:
 oc->streams = NULL;
 oc->nb_streams = 0;
 avformat_free_context(oc);
-return 0;
+return ret;
 }
 
 #define OFFSET(x) offsetof(WebMChunkContext, x)
-- 
2.21.0

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

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

[FFmpeg-devel] [PATCH 3/3] lavf/webm_chunk: Correct duration if start time > 0

2019-04-19 Thread Andreas Rheinhardt
Up until now, it was simply presumed that the first packet had a pts of
zero; otherwise the duration of the first chunk was wrong.

Signed-off-by: Andreas Rheinhardt 
---
 libavformat/webm_chunk.c | 10 ++
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/libavformat/webm_chunk.c b/libavformat/webm_chunk.c
index 391fee721a..d45ebfb1e5 100644
--- a/libavformat/webm_chunk.c
+++ b/libavformat/webm_chunk.c
@@ -52,7 +52,7 @@ typedef struct WebMChunkContext {
 int chunk_index;
 char *http_method;
 uint64_t duration_written;
-int prev_pts;
+int64_t prev_pts;
 ff_const59 AVOutputFormat *oformat;
 AVFormatContext *avf;
 } WebMChunkContext;
@@ -124,6 +124,7 @@ static int webm_chunk_write_header(AVFormatContext *s)
 wc->oformat = av_guess_format("webm", s->url, "video/webm");
 if (!wc->oformat)
 return AVERROR_MUXER_NOT_FOUND;
+wc->prev_pts = AV_NOPTS_VALUE;
 
 ret = chunk_mux_init(s);
 if (ret < 0)
@@ -211,9 +212,10 @@ static int webm_chunk_write_packet(AVFormatContext *s, 
AVPacket *pkt)
 int ret;
 
 if (st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO) {
-wc->duration_written += av_rescale_q(pkt->pts - wc->prev_pts,
- st->time_base,
- (AVRational) {1, 1000});
+if (wc->prev_pts != AV_NOPTS_VALUE)
+wc->duration_written += av_rescale_q(pkt->pts - wc->prev_pts,
+ st->time_base,
+ (AVRational) {1, 1000});
 wc->prev_pts = pkt->pts;
 }
 
-- 
2.21.0

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

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

[FFmpeg-devel] [PATCH 1/3] lavf/webm_chunk: Respect buffer size

2019-04-19 Thread Andreas Rheinhardt
The last argument of av_strlcpy is supposed to contain the size of the
destination buffer, but it was filled with the size of the source
string, effectively negating its very purpose.

Signed-off-by: Andreas Rheinhardt 
---
As the author information in my previous patchset has been munged, I
resend this to make the committer's job easier.
 libavformat/webm_chunk.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/webm_chunk.c b/libavformat/webm_chunk.c
index ec1ec4bf91..2c99753b5b 100644
--- a/libavformat/webm_chunk.c
+++ b/libavformat/webm_chunk.c
@@ -96,7 +96,7 @@ static int get_chunk_filename(AVFormatContext *s, int 
is_header, char *filename)
 av_log(oc, AV_LOG_ERROR, "No header filename provided\n");
 return AVERROR(EINVAL);
 }
-av_strlcpy(filename, wc->header_filename, strlen(wc->header_filename) 
+ 1);
+av_strlcpy(filename, wc->header_filename, MAX_FILENAME_SIZE);
 } else {
 if (av_get_frame_filename(filename, MAX_FILENAME_SIZE,
   s->url, wc->chunk_index - 1) < 0) {
-- 
2.21.0

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

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

[FFmpeg-devel] [PATCH] libavformat/mov: limit nb_frames_for_fps to INT_MAX

2019-04-19 Thread Dan Sanders via ffmpeg-devel
--- Begin Message ---
Fixes: UBSan runtime error
Found-by: Clusterfuzz
---
 libavformat/mov.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/mov.c b/libavformat/mov.c
index d5ce077e63..7e7de5962d 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -2940,7 +2940,7 @@ static int mov_read_stts(MOVContext *c,
AVIOContext *pb, MOVAtom atom)

 if (duration > 0 &&
 duration <= INT64_MAX - sc->duration_for_fps &&
-total_sample_count <= INT64_MAX - sc->nb_frames_for_fps
+total_sample_count <= INT_MAX - sc->nb_frames_for_fps
 ) {
 sc->duration_for_fps  += duration;
 sc->nb_frames_for_fps += total_sample_count;
-- 
2.21.0.593.g511ec345e18-goog
--- End Message ---
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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

Re: [FFmpeg-devel] [PATCH 2/3] avfilter: add audio upsample filter

2019-04-19 Thread Paul B Mahol
On 4/19/19, Nicolas George  wrote:
> Paul B Mahol (12019-04-19):
>> I'm really sorry for insulting you, and I will try to not repeat it.
>
> Accepted, although I have a feeling that "try" is weak.
>
> Now, you have complained about what you call my "one liners". I do not
> know if you realize, but I have adopted the policy of not wasting lines
> to write to you because it is exactly the way you express yourself to me
> and others most of the time. If you do not like when it comes to you, do
> not send it to other people.
>
> Now that this is clear, please explain in details why you think these
> filters are necessary and not redundant with the generic resampling and
> automatic format negotiation, and I will either stop my objections or
> explain why I think you are mistaken.

Generic resampling via aresample is completely another filtering that have
nothing to do with this filters, for more info read:

https://www.oblique-audio.com/technique/oversampling

>
> Note that the effort you will take in making this discussion civil and
> constructive will be taken as an indication on whether your excuses were
> sincere or just a way of getting what you want. If in doubt, explain
> more, not less.
>
> Regards,
>
> --
>   Nicolas George
>
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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

Re: [FFmpeg-devel] [PATCH] Add RTMFP support with librtmfp library

2019-04-19 Thread Moritz Barsnick
On Fri, Apr 19, 2019 at 19:20:50 +0200, Thomas Jammet wrote:
> @@ -6189,6 +6192,7 @@ enabled libopus   && {
>  enabled libpulse  && require_pkg_config libpulse libpulse
> pulse/pulseaudio.h pa_context_new
>  enabled librsvg   && require_pkg_config librsvg librsvg-2.0
> librsvg-2.0/librsvg/rsvg.h rsvg_handle_render_cairo

It looks like your mail client automatically wrapped the lines of the
patch, which will not allow it to be applied. You need to reconfigure
your mailer, or attach the patch (or use git send-email).

> +@item rtmfp_socketReceiveSize

CamelCase options aren't accepted by the project, AFAIU.

> +(Only with @code{rtmfp_negtroup}) Try to play an RTMFP unicast stream url
^
You nicely misspelled this option reference six times (thanks to
copy/paste, likely). ;-)

> +(Only with @code{rtmfp_negtroup}) Specifies the maximum number (-1) of
> +peers to which we will send push fragments.

Does -1 mean no maximum? Or what does it mean here?

>  OBJS-$(CONFIG_LIBRTMPTE_PROTOCOL)+= librtmp.o
> +OBJS-$(CONFIG_LIBRTMFP_PROTOCOL) += librtmfp.o
>  OBJS-$(CONFIG_LIBSMBCLIENT_PROTOCOL) += libsmbclient.o

This is not quite the correct alphabetical order.

> +typedef struct LibRTMFPContext {
> +const AVClass*  class;
> +RTMFPConfig rtmfp;
> +unsigned intid;
> +int audioUnbuffered;
> +int videoUnbuffered;
> +int p2pPublishing;
> +char*   peerId;
> +char*   publication;
> +unsigned short  streamId;
> +const char* swfUrl;
> +const char* app;
> +const char* pageUrl;
> +const char* flashVer;
> +const char* host;
> +const char* hostIPv6;

The asterisks attach to the variable, not the type.

And ffmpeg doesn't use CamelCase for regular variables.

> +static void onStatusEvent(const char* code, const char* description) {
> +  av_log(NULL, AV_LOG_INFO, "onStatusEvent : %s - %s\n", code, description);
> +}

This should get a log context.

> +int res = 0;
> +
> +res = RTMFP_Write(ctx->id, buf, size);

The first assignment is redundant.

> +int res = 0;
> +
> +res = RTMFP_Read(ctx->streamId, ctx->id, buf, size);

Same here.

> +return (res < 0)? AVERROR_UNKNOWN : res;

Can you not find a better error code?

> +{"audioUnbuffered", "Unbuffered audio mode (default to false)",
> OFFSET(audioUnbuffered), AV_OPT_TYPE_BOOL, {.i64 = 0 }, 0, 1,
> DEC|ENC},
> +{"videoUnbuffered", "Unbuffered video mode (default to false)",
> OFFSET(videoUnbuffered), AV_OPT_TYPE_BOOL, {.i64 = 0 }, 0, 1,
> DEC|ENC},

These defaults usually don't need to be documented here (ffmpeg -h does
that for you).

> +{"netgroup", "Publish/Play the stream into a NetGroup
> (multicast)", OFFSET(netgroup), AV_OPT_TYPE_STRING, {.str = NULL }, 0,
> 0, DEC|ENC},

The description makes it sound like a boolean. What does this parameter
actually expect?

> +{"pushLimit", "Specifies the maximum number (-1) of peers to
> which we will send push fragments", OFFSET(pushLimit),
> AV_OPT_TYPE_INT, {.i64 = 4 }, 0, 255, DEC|ENC},

I still don't understand the "-1". And try to avoid the "we". (Yes, I
know passive form is sometimes considered weird in English.)

> +{"updatePeriod", "Specifies the interval in milliseconds between
> messages sent to peers informating them that the local node has new
> p2p multicast media fragments available",

I believe the description should be shorter. (You can additionally save
some by dropping the "specifies", as each parameter specifies something
by nature.)

This was likely not complete, and no technical review though, sorry.

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

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

[FFmpeg-devel] [PATCH] avdevice/alsa: fix indefinite stop on closing PCM capture

2019-04-19 Thread Lou Logan
Attached patch resolves the issue mentioned within.
>From 10800493523b9274e7cc8784b65cc183a94b7281 Mon Sep 17 00:00:00 2001
From: Takayuki 'January June' Suwa 
Date: Thu, 18 Apr 2019 10:56:40 +0900
Subject: [PATCH] avdevice/alsa: fix indefinite stop on closing PCM capture

Sorry, I forgot to take recording into account...

Fixes:  https://bugs.archlinux.org/task/58619

Found-by: Elias (Bleuzen) https://bugs.archlinux.org/user/26956
---
 libavdevice/alsa.c | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/libavdevice/alsa.c b/libavdevice/alsa.c
index 1b21beb6d5..117b2ea144 100644
--- a/libavdevice/alsa.c
+++ b/libavdevice/alsa.c
@@ -300,8 +300,10 @@ av_cold int ff_alsa_close(AVFormatContext *s1)
 {
 AlsaData *s = s1->priv_data;
 
-snd_pcm_nonblock(s->h, 0);
-snd_pcm_drain(s->h);
+if (snd_pcm_stream(s->h) == SND_PCM_STREAM_PLAYBACK) {
+snd_pcm_nonblock(s->h, 0);
+snd_pcm_drain(s->h);
+}
 av_freep(&s->reorder_buf);
 if (CONFIG_ALSA_INDEV)
 ff_timefilter_destroy(s->timefilter);
-- 
2.11.0

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

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

Re: [FFmpeg-devel] Patchwork attribution

2019-04-19 Thread Lou Logan
On Thu, 18 Apr 2019 18:01:27 -0400
"Lou Logan"  wrote:
>
> But we can certainly give it a try if you like. I'm not sure how patchwork 
> will handle it.

(Didn't realize my webmail client wasn't actually wrapping my text
although it was doing it in the window at the expected lengths.)

I just changed it from "munge" to "wrap" (only on ffmpeg-devel for
now). If it doesn't work out then I'll just go back to the original
setting of "accept" until if/when we find a better solution. We will
lose some subscribers but the current patch author mangling is not
worth the trouble in my opinion.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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

Re: [FFmpeg-devel] [PATCH 2/3] avfilter: add audio upsample filter

2019-04-19 Thread Nicolas George
Paul B Mahol (12019-04-19):
> I'm really sorry for insulting you, and I will try to not repeat it.

Accepted, although I have a feeling that "try" is weak.

Now, you have complained about what you call my "one liners". I do not
know if you realize, but I have adopted the policy of not wasting lines
to write to you because it is exactly the way you express yourself to me
and others most of the time. If you do not like when it comes to you, do
not send it to other people.

Now that this is clear, please explain in details why you think these
filters are necessary and not redundant with the generic resampling and
automatic format negotiation, and I will either stop my objections or
explain why I think you are mistaken.

Note that the effort you will take in making this discussion civil and
constructive will be taken as an indication on whether your excuses were
sincere or just a way of getting what you want. If in doubt, explain
more, not less.

Regards,

-- 
  Nicolas George


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

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

Re: [FFmpeg-devel] [PATCH 1/3] avcodec/wmv2dec: Check that the P frame secondary header fit in the input

2019-04-19 Thread Michael Niedermayer
On Sat, Apr 13, 2019 at 01:36:45AM +0200, Michael Niedermayer wrote:
> Fixes: Timeout (64sec ->2 sec)
> Fixes: 
> 14131/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WMV2_fuzzer-5719879556005888
> 
> Found-by: continuous fuzzing process 
> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer 
> ---
>  libavcodec/wmv2dec.c | 3 +++
>  1 file changed, 3 insertions(+)

will apply patchset

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

Republics decline into democracies and democracies degenerate into
despotisms. -- Aristotle


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

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

Re: [FFmpeg-devel] [PATCH 2/3] avfilter: add audio upsample filter

2019-04-19 Thread Paul B Mahol
On 4/19/19, Nicolas George  wrote:
> Paul B Mahol (12019-04-19):
>> I'm really sorry.
>
> For what, and what do you intend to do about it?

I'm really sorry for insulting you, and I will try to not repeat it.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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

Re: [FFmpeg-devel] [PATCH] avcodec/ivi: Move buffer/block end check to caller of ivi_dc_transform()

2019-04-19 Thread Michael Niedermayer
On Fri, Apr 12, 2019 at 12:58:27AM +0200, Michael Niedermayer wrote:
> Fixes: assertion failure
> Fixes: 
> 14078/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_INDEO5_fuzzer-5760571284127744
> 
> Found-by: continuous fuzzing process 
> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer 
> ---
>  libavcodec/ivi.c | 11 +--
>  1 file changed, 5 insertions(+), 6 deletions(-)

will apply

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

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



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

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

Re: [FFmpeg-devel] Patchwork attribution

2019-04-19 Thread Lou Logan
On Fri, 19 Apr 2019 00:05:00 +
Andreas Rheinhardt  wrote:

> But now I am unsure whether I should resend my patchsets?

At this point I suggest resending as it will allow the commiter to
avoid having to adjust the author and will help avoid mistakes.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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

Re: [FFmpeg-devel] [PATCH] avcodec/diracdec: Use 64bit in intermediate of global motion vector field generation

2019-04-19 Thread Michael Niedermayer
On Sun, Apr 07, 2019 at 05:32:36PM +0200, Michael Niedermayer wrote:
> It seems the specification does not limit the value to 32bit
> 
> Fixes: signed integer overflow: -109611143 * 24 cannot be represented in type 
> 'int'
> Fixes: 
> 13477/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_DIRAC_fuzzer-5648337460527104
> 
> Signed-off-by: Michael Niedermayer 
> ---
>  libavcodec/diracdec.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

will apply


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

"You are 36 times more likely to die in a bathtub than at the hands of a
terrorist. Also, you are 2.5 times more likely to become a president and
2 times more likely to become an astronaut, than to die in a terrorist
attack." -- Thoughty2



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

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

Re: [FFmpeg-devel] [PATCH] avcodec/dvdec: add frame threads

2019-04-19 Thread Paul B Mahol
On 4/18/19, Tobias Rapp  wrote:
> On 18.04.2019 11:40, Michael Niedermayer wrote:
>> On Thu, Apr 18, 2019 at 10:30:49AM +0200, Paul B Mahol wrote:
>>> On 4/18/19, Michael Niedermayer  wrote:
 On Thu, Apr 18, 2019 at 01:19:58AM +0200, Michael Niedermayer wrote:
> On Wed, Apr 17, 2019 at 06:16:39PM +0200, Paul B Mahol wrote:
>> Signed-off-by: Paul B Mahol 
>> ---
>>   libavcodec/dvdec.c | 19 ++-
>>   1 file changed, 10 insertions(+), 9 deletions(-)
>
> Is this intended to be 100% same output ?
>
> I have a few cases that produce differences. Dont have a good testcase
> though
> ./ffmpeg -i ~/tickets/1589/A1590.dv avi-b.avi
> produces different output.
> oddly -f framecrc produces the same output
> not sure this is a problem or not the input file may have issues

 heres another testcase:
 ./ffmpeg -i ~/tickets/2390/dv_cut.dv aviavi2.avi

 [...]
>>>
>>> This is because audio is muxed differently.
>>> This bug have nothing to do with this patch.
>>
>> iam not sure thats the case. Looking at this again now in the morning
>> VPRP is different and the muxer receives a different par->field_order
>> (0 vs. 5). I dont think audio should afect the video field_order
>
> That might be caused by frame-threading in general and not explicitly by
> the dv decoder. Have experienced field_order information not being
> reliably forwarded to the muxer in ffmpeg before. Seems sometimes the
> encoder settings are updated too late to be picked up by the muxer when
> writing header information.

Yes, I agree, will push patch soon.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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

Re: [FFmpeg-devel] [PATCH 2/3] avfilter: add audio upsample filter

2019-04-19 Thread Nicolas George
Paul B Mahol (12019-04-19):
> I'm really sorry.

For what, and what do you intend to do about it?
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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

Re: [FFmpeg-devel] [PATCH 2/3] avfilter: add audio upsample filter

2019-04-19 Thread Paul B Mahol
On 4/19/19, Nicolas George  wrote:
> Paul B Mahol (12019-04-19):
>> I'm really sorry if that hurt you.
>
> That's not excuses for the insult.

I'm really sorry.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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

Re: [FFmpeg-devel] [PATCH v2] avformat/utils: Use av_packet_move_ref for packet ownership transfer

2019-04-19 Thread Andriy Gelman
On Mon, 08. Apr 14:03, Andriy Gelman wrote:
> From: Andriy Gelman 
> 
> This commit replaces packet assignment operator with av_packet_move_ref
> when there is a packet ownership transfer.
> ---
> Michael, the update patch now has correct behavior for ticket 4221.
> 
>  libavformat/utils.c | 30 --
>  1 file changed, 16 insertions(+), 14 deletions(-)
> 
> diff --git a/libavformat/utils.c b/libavformat/utils.c
> index 9b3f0d28e6..9653ebb4f4 100644
> --- a/libavformat/utils.c
> +++ b/libavformat/utils.c
> @@ -460,10 +460,7 @@ int ff_packet_list_put(AVPacketList **packet_buffer,
>  return ret;
>  }
>  } else {
> -// TODO: Adapt callers in this file so the line below can use
> -//   av_packet_move_ref() to effectively move the reference
> -//   to the list.
> -pktl->pkt = *pkt;
> +av_packet_move_ref(&pktl->pkt, pkt);
>  }
>  
>  if (*packet_buffer)
> @@ -832,19 +829,21 @@ int ff_read_packet(AVFormatContext *s, AVPacket *pkt)
>  {
>  int ret, i, err;
>  AVStream *st;
> +AVPacket *buffer_pkt; /*view packet contents only. does not take 
> ownership*/
>  
>  for (;;) {
>  AVPacketList *pktl = s->internal->raw_packet_buffer;
>  
>  if (pktl) {
> -*pkt = pktl->pkt;
> -st   = s->streams[pkt->stream_index];
> +buffer_pkt = &pktl->pkt;
> +st   = s->streams[buffer_pkt->stream_index];
>  if (s->internal->raw_packet_buffer_remaining_size <= 0)
>  if ((err = probe_codec(s, st, NULL)) < 0)
>  return err;
>  if (st->request_probe <= 0) {
>  s->internal->raw_packet_buffer = pktl->next;
> -s->internal->raw_packet_buffer_remaining_size += pkt->size;
> +s->internal->raw_packet_buffer_remaining_size += 
> buffer_pkt->size;
> +av_packet_move_ref(pkt, &pktl->pkt);
>  av_free(pktl);
>  return 0;
>  }
> @@ -914,14 +913,17 @@ int ff_read_packet(AVFormatContext *s, AVPacket *pkt)
>  if (!pktl && st->request_probe <= 0)
>  return ret;
>  
> +/*transfer pkt ownership to list*/
>  err = ff_packet_list_put(&s->internal->raw_packet_buffer,
>   &s->internal->raw_packet_buffer_end,
>   pkt, 0);
>  if (err)
>  return err;
> -s->internal->raw_packet_buffer_remaining_size -= pkt->size;
>  
> -if ((err = probe_codec(s, st, pkt)) < 0)
> +buffer_pkt = &s->internal->raw_packet_buffer_end->pkt;
> +s->internal->raw_packet_buffer_remaining_size -= buffer_pkt->size;
> +
> +if ((err = probe_codec(s, st, buffer_pkt)) < 0)
>  return err;
>  }
>  }
> @@ -1662,7 +1664,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
>  
>  if (!st->need_parsing || !st->parser) {
>  /* no parsing needed: we just output the packet as is */
> -*pkt = cur_pkt;
> +av_packet_move_ref(pkt, &cur_pkt);
>  compute_pkt_fields(s, st, NULL, pkt, AV_NOPTS_VALUE, 
> AV_NOPTS_VALUE);
>  if ((s->iformat->flags & AVFMT_GENERIC_INDEX) &&
>  (pkt->flags & AV_PKT_FLAG_KEY) && pkt->dts != 
> AV_NOPTS_VALUE) {
> @@ -3779,15 +3781,15 @@ FF_ENABLE_DEPRECATION_WARNINGS
>  break;
>  }
>  
> -pkt = &pkt1;
> -
>  if (!(ic->flags & AVFMT_FLAG_NOBUFFER)) {
>  ret = ff_packet_list_put(&ic->internal->packet_buffer,
>   &ic->internal->packet_buffer_end,
> - pkt, 0);
> + &pkt1, 0);
>  if (ret < 0)
>  goto find_stream_info_err;
> -}
> +pkt = &ic->internal->packet_buffer_end->pkt;
> +} else
> +pkt = &pkt1;
>  
>  st = ic->streams[pkt->stream_index];
>  if (!(st->disposition & AV_DISPOSITION_ATTACHED_PIC))
> -- 
> 2.21.0

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

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

[FFmpeg-devel] [PATCH 2/2] avfilter/vf_lut3d: add cineSpace 3D lut support

2019-04-19 Thread Paul B Mahol
Signed-off-by: Paul B Mahol 
---
 doc/filters.texi   |  2 +
 libavfilter/vf_lut3d.c | 91 ++
 2 files changed, 93 insertions(+)

diff --git a/doc/filters.texi b/doc/filters.texi
index 606d682e84..aaa9163d89 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -11683,6 +11683,8 @@ Iridas
 DaVinci
 @item m3d
 Pandora
+@item csp
+cineSpace
 @end table
 @item interp
 Select interpolation mode.
diff --git a/libavfilter/vf_lut3d.c b/libavfilter/vf_lut3d.c
index 1b6a191b3b..50ea5a8545 100644
--- a/libavfilter/vf_lut3d.c
+++ b/libavfilter/vf_lut3d.c
@@ -523,6 +523,95 @@ static int parse_m3d(AVFilterContext *ctx, FILE *f)
 return 0;
 }
 
+static int parse_cinespace(AVFilterContext *ctx, FILE *f)
+{
+LUT3DContext *lut3d = ctx->priv;
+char line[MAX_LINE_SIZE];
+float in_min[3]  = {0.0, 0.0, 0.0};
+float in_max[3]  = {1.0, 1.0, 1.0};
+float out_min[3] = {0.0, 0.0, 0.0};
+float out_max[3] = {1.0, 1.0, 1.0};
+int inside_metadata = 0, size;
+
+NEXT_LINE(skip_line(line));
+if (strncmp(line, "CSPLUTV100", 10)) {
+av_log(ctx, AV_LOG_ERROR, "Not cineSpace LUT format\n");
+return AVERROR(EINVAL);
+}
+
+NEXT_LINE(skip_line(line));
+if (strncmp(line, "3D", 2)) {
+av_log(ctx, AV_LOG_ERROR, "Not 3D LUT format\n");
+return AVERROR(EINVAL);
+}
+
+while (1) {
+NEXT_LINE(skip_line(line));
+
+if (!strncmp(line, "BEGIN METADATA", 14)) {
+inside_metadata = 1;
+continue;
+}
+if (!strncmp(line, "END METADATA", 12)) {
+inside_metadata = 0;
+continue;
+}
+if (inside_metadata == 0) {
+int size_r, size_g, size_b;
+
+for (int i = 0; i < 3; i++) {
+int npoints = strtol(line, NULL, 0);
+
+if (npoints != 2) {
+av_log(ctx, AV_LOG_ERROR, "Unsupported number of pre-lut 
points.\n");
+return AVERROR_PATCHWELCOME;
+}
+
+NEXT_LINE(skip_line(line));
+if (av_sscanf(line, "%f %f", &in_min[i], &in_max[i]) != 2)
+return AVERROR_INVALIDDATA;
+NEXT_LINE(skip_line(line));
+if (av_sscanf(line, "%f %f", &out_min[i], &out_max[i]) != 2)
+return AVERROR_INVALIDDATA;
+NEXT_LINE(skip_line(line));
+}
+
+if (av_sscanf(line, "%d %d %d", &size_r, &size_g, &size_b) != 3)
+return AVERROR(EINVAL);
+if (size_r != size_g || size_r != size_b) {
+av_log(ctx, AV_LOG_ERROR, "Unsupported size combination: 
%dx%dx%d.\n", size_r, size_g, size_b);
+return AVERROR_PATCHWELCOME;
+}
+
+size = size_r;
+if (size < 2 || size > MAX_LEVEL) {
+av_log(ctx, AV_LOG_ERROR, "Too large or invalid 3D LUT 
size\n");
+return AVERROR(EINVAL);
+}
+
+lut3d->lutsize = size;
+
+for (int k = 0; k < size; k++) {
+for (int j = 0; j < size; j++) {
+for (int i = 0; i < size; i++) {
+struct rgbvec *vec = &lut3d->lut[i][j][k];
+if (k != 0 || j != 0 || i != 0)
+NEXT_LINE(skip_line(line));
+if (av_sscanf(line, "%f %f %f", &vec->r, &vec->g, 
&vec->b) != 3)
+return AVERROR_INVALIDDATA;
+vec->r *= out_max[0] - out_min[0];
+vec->g *= out_max[1] - out_min[1];
+vec->b *= out_max[2] - out_min[2];
+}
+}
+}
+
+break;
+}
+}
+return 0;
+}
+
 static void set_identity_matrix(LUT3DContext *lut3d, int size)
 {
 int i, j, k;
@@ -704,6 +793,8 @@ static av_cold int lut3d_init(AVFilterContext *ctx)
 ret = parse_cube(ctx, f);
 } else if (!av_strcasecmp(ext, "m3d")) {
 ret = parse_m3d(ctx, f);
+} else if (!av_strcasecmp(ext, "csp")) {
+ret = parse_cinespace(ctx, f);
 } else {
 av_log(ctx, AV_LOG_ERROR, "Unrecognized '.%s' file type\n", ext);
 ret = AVERROR(EINVAL);
-- 
2.17.1

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

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

[FFmpeg-devel] [PATCH 1/2] avfilter/vf_lut3d: add cineSpace 1D lut parsing

2019-04-19 Thread Paul B Mahol
Signed-off-by: Paul B Mahol 
---
 doc/filters.texi   |  2 ++
 libavfilter/vf_lut3d.c | 77 ++
 2 files changed, 79 insertions(+)

diff --git a/doc/filters.texi b/doc/filters.texi
index 4dd1a5de85..606d682e84 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -11639,6 +11639,8 @@ Currently supported formats:
 @table @samp
 @item cube
 Iridas
+@item csp
+cineSpace
 @end table
 
 @item interp
diff --git a/libavfilter/vf_lut3d.c b/libavfilter/vf_lut3d.c
index 93053ed263..1b6a191b3b 100644
--- a/libavfilter/vf_lut3d.c
+++ b/libavfilter/vf_lut3d.c
@@ -1019,6 +1019,81 @@ static void set_identity_matrix_1d(LUT1DContext *lut1d, 
int size)
 }
 }
 
+static int parse_cinespace_1d(AVFilterContext *ctx, FILE *f)
+{
+LUT1DContext *lut1d = ctx->priv;
+char line[MAX_LINE_SIZE];
+float in_min[3]  = {0.0, 0.0, 0.0};
+float in_max[3]  = {1.0, 1.0, 1.0};
+float out_min[3] = {0.0, 0.0, 0.0};
+float out_max[3] = {1.0, 1.0, 1.0};
+int inside_metadata = 0, size;
+
+NEXT_LINE(skip_line(line));
+if (strncmp(line, "CSPLUTV100", 10)) {
+av_log(ctx, AV_LOG_ERROR, "Not cineSpace LUT format\n");
+return AVERROR(EINVAL);
+}
+
+NEXT_LINE(skip_line(line));
+if (strncmp(line, "1D", 2)) {
+av_log(ctx, AV_LOG_ERROR, "Not 1D LUT format\n");
+return AVERROR(EINVAL);
+}
+
+while (1) {
+NEXT_LINE(skip_line(line));
+
+if (!strncmp(line, "BEGIN METADATA", 14)) {
+inside_metadata = 1;
+continue;
+}
+if (!strncmp(line, "END METADATA", 12)) {
+inside_metadata = 0;
+continue;
+}
+if (inside_metadata == 0) {
+for (int i = 0; i < 3; i++) {
+int npoints = strtol(line, NULL, 0);
+
+if (npoints != 2) {
+av_log(ctx, AV_LOG_ERROR, "Unsupported number of pre-lut 
points.\n");
+return AVERROR_PATCHWELCOME;
+}
+
+NEXT_LINE(skip_line(line));
+if (av_sscanf(line, "%f %f", &in_min[i], &in_max[i]) != 2)
+return AVERROR_INVALIDDATA;
+NEXT_LINE(skip_line(line));
+if (av_sscanf(line, "%f %f", &out_min[i], &out_max[i]) != 2)
+return AVERROR_INVALIDDATA;
+NEXT_LINE(skip_line(line));
+}
+
+size = strtol(line, NULL, 0);
+
+if (size < 2 || size > MAX_1D_LEVEL) {
+av_log(ctx, AV_LOG_ERROR, "Too large or invalid 1D LUT 
size\n");
+return AVERROR(EINVAL);
+}
+
+lut1d->lutsize = size;
+
+for (int i = 0; i < size; i++) {
+NEXT_LINE(skip_line(line));
+if (av_sscanf(line, "%f %f %f", &lut1d->lut[0][i], 
&lut1d->lut[1][i], &lut1d->lut[2][i]) != 3)
+return AVERROR_INVALIDDATA;
+lut1d->lut[0][i] *= out_max[0] - out_min[0];
+lut1d->lut[1][i] *= out_max[1] - out_min[1];
+lut1d->lut[2][i] *= out_max[2] - out_min[2];
+}
+
+break;
+}
+}
+return 0;
+}
+
 static int parse_cube_1d(AVFilterContext *ctx, FILE *f)
 {
 LUT1DContext *lut1d = ctx->priv;
@@ -1400,6 +1475,8 @@ static av_cold int lut1d_init(AVFilterContext *ctx)
 
 if (!av_strcasecmp(ext, "cube") || !av_strcasecmp(ext, "1dlut")) {
 ret = parse_cube_1d(ctx, f);
+} else if (!av_strcasecmp(ext, "csp")) {
+ret = parse_cinespace_1d(ctx, f);
 } else {
 av_log(ctx, AV_LOG_ERROR, "Unrecognized '.%s' file type\n", ext);
 ret = AVERROR(EINVAL);
-- 
2.17.1

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

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

[FFmpeg-devel] [PATCH] Add RTMFP support with librtmfp library

2019-04-19 Thread Thomas Jammet
Here is the updated version of the patch.

Thomas Jammet

---
 configure   |   4 +
 doc/protocols.texi  | 120 +++
 libavformat/Makefile|   1 +
 libavformat/librtmfp.c  | 247 
 libavformat/protocols.c |   1 +
 5 files changed, 373 insertions(+)
 create mode 100644 libavformat/librtmfp.c

diff --git a/configure b/configure
index e10e2c2c46..1ba9c08621 100755
--- a/configure
+++ b/configure
@@ -257,6 +257,7 @@ External library support:
   --enable-librsvg enable SVG rasterization via librsvg [no]
   --enable-librubberband   enable rubberband needed for rubberband filter [no]
   --enable-librtmp enable RTMP[E] support via librtmp [no]
+  --enable-librtmfpenable RTMFP support via librtmfp [no]
   --enable-libshineenable fixed-point MP3 encoding via libshine [no]
   --enable-libsmbclientenable Samba protocol via libsmbclient [no]
   --enable-libsnappy   enable Snappy compression, needed for hap
encoding [no]
@@ -1775,6 +1776,7 @@ EXTERNAL_LIBRARY_LIST="
 libpulse
 librsvg
 librtmp
+librtmfp
 libshine
 libsmbclient
 libsnappy
@@ -3386,6 +3388,7 @@ librtmpe_protocol_deps="librtmp"
 librtmps_protocol_deps="librtmp"
 librtmpt_protocol_deps="librtmp"
 librtmpte_protocol_deps="librtmp"
+librtmfp_protocol_deps="librtmfp"
 libsmbclient_protocol_deps="libsmbclient gplv3"
 libsrt_protocol_deps="libsrt"
 libsrt_protocol_select="network"
@@ -6189,6 +6192,7 @@ enabled libopus   && {
 enabled libpulse  && require_pkg_config libpulse libpulse
pulse/pulseaudio.h pa_context_new
 enabled librsvg   && require_pkg_config librsvg librsvg-2.0
librsvg-2.0/librsvg/rsvg.h rsvg_handle_render_cairo
 enabled librtmp   && require_pkg_config librtmp librtmp
librtmp/rtmp.h RTMP_Socket
+enabled librtmfp  && require_pkg_config librtmfp librtmfp
librtmfp/librtmfp.h RTMFP_Connect
 enabled librubberband && require_pkg_config librubberband
"rubberband >= 1.8.1" rubberband/rubberband-c.h rubberband_new
-lstdc++ && append librubberband_extralibs "-lstdc++"
 enabled libshine  && require_pkg_config libshine shine
shine/layer3.h shine_encode_buffer
 enabled libsmbclient  && { check_pkg_config libsmbclient
smbclient libsmbclient.h smbc_init ||
diff --git a/doc/protocols.texi b/doc/protocols.texi
index 3e4e7af3d4..61852d4d48 100644
--- a/doc/protocols.texi
+++ b/doc/protocols.texi
@@ -842,6 +842,126 @@ To play the same stream using @command{ffplay}:
 ffplay "rtmp://myserver/live/mystream live=1"
 @end example

+@section librtmfp
+
+Real-Time Media Flow Protocol.
+
+Requires the presence of the librtmfp headers and library during
+configuration. You need to explicitly configure the build with
+"--enable-librtmfp".
+
+This protocol provides most functionalities of the UDP protocol RTMFP :
+unicast, direct p2p and multicast (via NetGroup).
+
+The required syntax for an RTMFP URL is:
+@example
+rtmfp://@var{hostname}[:@var{port}][/@var{app}][/@var{playpath}]
+@end example
+
+The accepted parameters are:
+@table @option
+
+@item hostname
+The address of the RTMFP server.
+
+@item port
+The number of the UDP port to use (by default is 1935).
+
+@item app
+It is the name of the application to access. It usually corresponds to the
+path where the application is installed on the RTMFP server (e.g.
+/ondemand/,/flash/live/, etc.).
+
+@item playpath
+It is the path or name of the resource to play with reference to the
+application specified in app.
+@end table
+
+Additionally, the following parameters can be set via command line options
+(or in code via @code{AVOption}s):
+@table @option
+
+@item rtmfp_socketReceiveSize
+Socket receive buffer size.
+
+@item rtmfp_socketSendSize
+Socket send buffer size.
+
+@item rtmfp_audioUnbuffered
+Unbuffered audio mode (default to false).
+
+@item rtmfp_videoUnbuffered
+Unbuffered video mode (default to false).
+
+@item rtmfp_peerId
+Connect to a peer for playing.
+
+@item rtmfp_p2pPublishing
+Publish the stream in p2p mode (default to false).
+
+@item rtmfp_netgroup
+Publish/Play the stream into a NetGroup (multicast).
+
+@item rtmfp_fallbackUrl
+(Only with @code{rtmfp_negtroup}) Try to play an RTMFP unicast stream url
+until the NetGroup connection is not ready. Can produce undefined behavior
+if the stream codecs are different.
+
+@item rtmfp_fallbackTimeout
+(Only with @code{rtmfp_negtroup}) Set the timeout in milliseconds to start
+fallback to unicast.
+
+@item rtmfp_disableRateControl
+(Only with @code{rtmfp_negtroup}) Disable the P2P connection rate control
+to avoid unwanted disconnection.
+
+@item rtmfp_pushLimit
+(Only with @code{rtmfp_negtroup}) Specifies the maximum number (-1) of
+peers to which we will send push fragments.
+
+@item rtmfp_updatePeriod
+(Only with @code{rtmfp_negtroup}) Specifies the interval in milliseconds
+between messages sent to peers informating them that the local node has
+new p2p multicast media

Re: [FFmpeg-devel] [PATCH 2/3] avfilter: add audio upsample filter

2019-04-19 Thread Nicolas George
Paul B Mahol (12019-04-19):
> I'm really sorry if that hurt you.

That's not excuses for the insult.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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

Re: [FFmpeg-devel] [PATCH] avformat/apetag: tag values are unsigned

2019-04-19 Thread James Almer
On 4/18/2019 9:56 PM, Dan Sanders via ffmpeg-devel wrote:
>>> +#define APE_TAG_FLAG_CONTAINS_HEADER  (1U << 31)
>>
>> Isn't it enough with this one only?
> 
> Yes, only APE_TAG_FLAG_CONTAINS_HEADER is problematic. I changed all
> of them because the tags are only used in unsigned contexts anyway.

Applied your patch changing only the above define, as the others are
unnecessary. Better for git blame as well.

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

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

Re: [FFmpeg-devel] [PATCH 2/3] avfilter: add audio upsample filter

2019-04-19 Thread Paul B Mahol
On 4/19/19, Nicolas George  wrote:
> Paul B Mahol (12019-04-19):
>> I'm very civil here.
>
> https://ffmpeg.org/pipermail/ffmpeg-devel/2019-April/242839.html

I'm really sorry if that hurt you.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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

Re: [FFmpeg-devel] [PATCH]tests/run-sh: Add execsuf to some calls of local tools

2019-04-19 Thread Carl Eugen Hoyos
2019-04-19 16:12 GMT+02:00, Carl Eugen Hoyos :
> 2019-04-19 13:11 GMT+02:00, Carl Eugen Hoyos :
>
>> Attached patch is needed here for fate on wsl with msvc, not
>> sure why I didn't need this with mingw-gcc.
>
> Better tested and correct variant attached.

And a third attempt.
No idea why the others initially worked...

Carl Eugen
From f9efc98e031738016464d2443474bc78776d0a7c Mon Sep 17 00:00:00 2001
From: Carl Eugen Hoyos 
Date: Fri, 19 Apr 2019 18:04:33 +0200
Subject: [PATCH] tests/fate-run: New variable hostexecsuf for local fate
 tools.

Allows running fate on wsl with msvc.
---
 tests/Makefile|1 +
 tests/fate-run.sh |8 
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/tests/Makefile b/tests/Makefile
index 50408c2..624292d 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -232,6 +232,7 @@ FATE += $(FATE_HW-yes)
 
 $(FATE) $(FATE_TESTS-no): export PROGSUF = $(PROGSSUF)
 $(FATE) $(FATE_TESTS-no): export EXECSUF = $(EXESUF)
+$(FATE) $(FATE_TESTS-no): export HOSTEXECSUF = $(HOSTEXESUF)
 $(FATE) $(FATE_TESTS-no): $(FATE_UTILS:%=tests/%$(HOSTEXESUF)) | $(FATE_OUTDIRS)
 	@echo "TEST$(@:fate-%=%)"
 	$(Q)$(SRC_PATH)/tests/fate-run.sh $@ "$(TARGET_SAMPLES)" "$(TARGET_EXEC)" "$(TARGET_PATH)" '$(CMD)' '$(CMP)' '$(REF)' '$(FUZZ)' '$(THREADS)' '$(THREAD_TYPE)' '$(CPUFLAGS)' '$(CMP_SHIFT)' '$(CMP_TARGET)' '$(SIZE_TOLERANCE)' '$(CMP_UNIT)' '$(GEN)' '$(HWACCEL)' '$(REPORT)' '$(KEEP)'
diff --git a/tests/fate-run.sh b/tests/fate-run.sh
index 56c4efb..2f1991d 100755
--- a/tests/fate-run.sh
+++ b/tests/fate-run.sh
@@ -5,7 +5,7 @@ export LC_ALL=C
 base=$(dirname $0)
 . "${base}/md5.sh"
 
-base64=tests/base64
+base64=tests/base64${HOSTEXECSUF}
 
 test="${1#fate-}"
 target_samples=$2
@@ -45,7 +45,7 @@ compare(){
 }
 
 do_tiny_psnr(){
-psnr=$(tests/tiny_psnr "$1" "$2" $cmp_unit $cmp_shift 0) || return 1
+psnr=$(tests/tiny_psnr${HOSTEXECSUF} "$1" "$2" $cmp_unit $cmp_shift 0) || return 1
 val=$(expr "$psnr" : ".*$3: *\([0-9.]*\)")
 size1=$(expr "$psnr" : '.*bytes: *\([0-9]*\)')
 size2=$(expr "$psnr" : '.*bytes:[ 0-9]*/ *\([0-9]*\)')
@@ -206,7 +206,7 @@ enc_dec(){
 ffmpeg $8 $DEC_OPTS -i $tencfile $ENC_OPTS $dec_opt $FLAGS \
 -f $dec_fmt -y $tdecfile || return
 do_md5sum $decfile
-tests/tiny_psnr $srcfile $decfile $cmp_unit $cmp_shift
+tests/tiny_psnr${HOSTEXECSUF} $srcfile $decfile $cmp_unit $cmp_shift
 }
 
 transcode(){
@@ -455,7 +455,7 @@ audio_match(){
 cleanfiles="$cleanfiles $decfile"
 
 ffmpeg -i "$sample" -bitexact $extra_args -y $decfile
-tests/audiomatch $decfile $trefile
+tests/audiomatch${HOSTEXECSUF} $decfile $trefile
 }
 
 concat(){
-- 
1.7.10.4

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

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

Re: [FFmpeg-devel] [PATCH 2/3] avfilter: add audio upsample filter

2019-04-19 Thread Nicolas George
Paul B Mahol (12019-04-19):
> I'm very civil here.

https://ffmpeg.org/pipermail/ffmpeg-devel/2019-April/242839.html
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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

Re: [FFmpeg-devel] [PATCH 2/3] avfilter: add audio upsample filter

2019-04-19 Thread Paul B Mahol
On 4/19/19, Nicolas George  wrote:
> Paul B Mahol (12019-04-19):
>> What you actually want?
>
> I demand, that you behave in a civil manner.

I'm very civil here.
If I'm not polite than that is because of your snarky comments.

You already blocked several my patches for no apparent
good reason.

In the long run that hurts mostly users.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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

Re: [FFmpeg-devel] [PATCH 2/3] avfilter: add audio upsample filter

2019-04-19 Thread Nicolas George
Paul B Mahol (12019-04-19):
> What you actually want?

I demand, that you behave in a civil manner.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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

Re: [FFmpeg-devel] [PATCH 2/3] avfilter: add audio upsample filter

2019-04-19 Thread Paul B Mahol
On 4/19/19, Nicolas George  wrote:
> Michael Niedermayer (12019-04-19):
>> As i have been asked to look into this
>
> Not to look into this: to take action.
>
>> Everyone, the subject of discussions should be FFmpeg and the
>> technologies
>> sorounding it. Insults, "Ad hominem" argumentation/attacks, and so on
>> lead
>> to a hostile climate that helps noone not even the one winning the
>> argument
>> eventually.
>
> Indeed. I will have a technical discussion about these patches, but not
> with somebody who insults me. Until I have reviewed and approved the
> patches, which cannot happen until the insults are gone for good,
> patches on lavfi are rejected.

What you actually want?
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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

Re: [FFmpeg-devel] [PATCH 2/3] avfilter: add audio upsample filter

2019-04-19 Thread Nicolas George
Michael Niedermayer (12019-04-19):
> As i have been asked to look into this

Not to look into this: to take action.

> Everyone, the subject of discussions should be FFmpeg and the technologies
> sorounding it. Insults, "Ad hominem" argumentation/attacks, and so on lead
> to a hostile climate that helps noone not even the one winning the argument
> eventually.

Indeed. I will have a technical discussion about these patches, but not
with somebody who insults me. Until I have reviewed and approved the
patches, which cannot happen until the insults are gone for good,
patches on lavfi are rejected.

Regards,

-- 
  Nicolas George


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

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

Re: [FFmpeg-devel] native mode in FFmpeg DNN module

2019-04-19 Thread Guo, Yejun


> -Original Message-
> From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On Behalf Of
> Pedro Arthur
> Sent: Friday, April 19, 2019 10:43 PM
> To: FFmpeg development discussions and patches 
> Subject: Re: [FFmpeg-devel] native mode in FFmpeg DNN module
> 
> Hi,
> 
> Em sex, 19 de abr de 2019 às 05:41, Guo, Yejun 
> escreveu:
> >
> > Option 2)
> > Write c code in FFmpeg to convert tensorflow file format (format 1) directly
> into memory representation (format 3), and so we controls everything in
> ffmpeg community. And the conversion can be extended to import more file
> formats such as torch, darknet, etc. One example is that OpenCV uses this
> method.
> >
> > The in memory representation (format 3) can still be current.
> >
> 
> Option 2 would be ideal, as it does not introduce any dependency for
> using the native backend.
> Yet I'm not sure  how complex implementing the tf model reader can be,
> If I remember correctly the student said it was not trivial at the
> time.

yes, it is not easy, but I think it is worthy to do it. Here is a reference 
example for the complexity, see 
https://github.com/opencv/opencv/blob/master/modules/dnn/src/tensorflow/tf_importer.cpp.
 

> 
> Is the tf model file stable? if not it will be a maintenance burden to
> keep it working whenever tf releases a new version. This point makes
> me think having control over our file format is good.

imho, this issue is always there, no matter which method used, unless our 
format could be exported by tensorflow (it has little possibility).

Whenever tf releases a new version with a new file format, we still have to 
change the python script in phase 1 (convert tf file model to our format) which 
is even an external dependency at https://github.com/HighVoltageRocknRoll/sr, 

As from effort perspective, the current implementation is better since python 
script is simpler. But I think we are still worth implementing option 2 as the 
ideal technical direction.

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

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

Re: [FFmpeg-devel] [PATCH] libavformat: improve logs with cur_dts

2019-04-19 Thread Michael Niedermayer
On Fri, Apr 19, 2019 at 08:09:28AM +, Andreas Håkon via ffmpeg-devel wrote:
> 
> ‐‐‐ Original Message ‐‐‐
> On Thursday, 18 de April de 2019 22:13, Michael Niedermayer 
>  wrote:
> 
> > On Thu, Apr 18, 2019 at 07:46:43AM +, Andreas Håkon via ffmpeg-devel 
> > wrote:
> >
> > > Hi,
> > > This is the second part of my previous patch:
> > > https://patchwork.ffmpeg.org/patch/12783/
> > > It improves the logs when the message "cur_dts is invalid" appears.
> > > If helps to identify which stream generates the trouble,
> > > and the status of the stream.
> > > A lot of users suffers with the message, and the origin varies.
> > > The improved message can help to discover the cause.
> > > Regards.
> > > A.H.
> >
> >
> > "git am" doesnt accept this patch
> >
> > Applying: libavformat: input init fix mpegts filters
> > Using index info to reconstruct a base tree...
> > error: patch failed: libavformat/utils.c:1402
> > error: libavformat/utils.c: patch does not apply
> > error: Did you hand edit your patch?
> > It does not apply to blobs recorded in its index.
> > Patch failed at 0001 libavformat: input init fix mpegts filters
> > hint: Use 'git am --show-current-patch' to see the failed patch
> > When you have resolved this problem, run "git am --continue".
> > If you prefer to skip this patch, run "git am --skip" instead.
> > To restore the original branch and stop patching, run "git am --abort".
> >
> 
> Sorry Michael!
> 
> I re-created the patch with a clean copy.
> Here it is.
> 
> Regards.
> A.H.
> 
> 
> ---
> 

> From 88dd030ddcde04b425bf1896ea6c1a2f263dc2ac Mon Sep 17 00:00:00 2001
> From: Andreas Hakon 
> Date: Fri, 19 Apr 2019 08:58:37 +0100
> Subject: [PATCH] libavformat: improve logs with cur_dts v2
> 
> This patch improves the logs when the message "cur_dts is invalid" appears.
> If helps to identify which stream generates the trouble,
> and the status of the stream.
> A lot of users suffers with the message, and the origin varies.
> The improved message can help to discover the cause.
> 
> Signed-off-by: Andreas Hakon 
> ---
>  fftools/ffmpeg.c|4 +++-
>  libavformat/utils.c |4 ++--
>  2 files changed, 5 insertions(+), 3 deletions(-)

will apply

thanks

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

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


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

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

Re: [FFmpeg-devel] [PATCH] avformat/apetag: tag values are unsigned

2019-04-19 Thread Michael Niedermayer
On Thu, Apr 18, 2019 at 05:12:14PM -0700, Dan Sanders via ffmpeg-devel wrote:
> Fixes: UBSan runtime error
> Found-by: Clusterfuzz
> ---
>  libavformat/apetag.c | 8 
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/libavformat/apetag.c b/libavformat/apetag.c
> index cdc602e1a9..2991f57d5d 100644
> --- a/libavformat/apetag.c
> +++ b/libavformat/apetag.c
> @@ -29,10 +29,10 @@
>  #include "apetag.h"
>  #include "internal.h"
> 
> -#define APE_TAG_FLAG_CONTAINS_HEADER  (1 << 31)
> -#define APE_TAG_FLAG_LACKS_FOOTER (1 << 30)
> -#define APE_TAG_FLAG_IS_HEADER(1 << 29)
> -#define APE_TAG_FLAG_IS_BINARY(1 << 1)
> +#define APE_TAG_FLAG_CONTAINS_HEADER  (1U << 31)
> +#define APE_TAG_FLAG_LACKS_FOOTER (1U << 30)
> +#define APE_TAG_FLAG_IS_HEADER(1U << 29)
> +#define APE_TAG_FLAG_IS_BINARY(1U << 1)

LGTM (both with all changed as in the patch or just one changed)

whoever pushes please fix the Author/FROM
(not pushing myself as theres a discussion about changing only 1 #define)

thx

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

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


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

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

Re: [FFmpeg-devel] [PATCH v3] avcodec: add AV_CODEC_FLAG_DROPCHANGED to flags

2019-04-19 Thread Gyan



On 16-04-2019 01:12 PM, Gyan wrote:
Patch revised as per 
http://www.ffmpeg.org/pipermail/ffmpeg-devel/2019-April/242591.html


If no more changes, plan to push tomorrow morning.

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

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

Re: [FFmpeg-devel] [PATCH] libavformat: fix inputs initialization in mpegts muxer with filters

2019-04-19 Thread Michael Niedermayer
On Fri, Apr 19, 2019 at 08:23:35AM +, Andreas Håkon via ffmpeg-devel wrote:
> 
> ‐‐‐ Original Message ‐‐‐
> On Thursday, 18 de April de 2019 22:07, Michael Niedermayer 
>  wrote:
> 
> >
> > fails to apply cleanly
> >
> > Applying: libavformat: fix inputs initialization in mpegts muxer with 
> > filters
> > Using index info to reconstruct a base tree...
> > error: patch failed: fftools/ffmpeg.c:4613
> > error: fftools/ffmpeg.c: patch does not apply
> > error: Did you hand edit your patch?
> > It does not apply to blobs recorded in its index.
> > Patch failed at 0001 libavformat: fix inputs initialization in mpegts muxer 
> > with filters
> >
> 
> Sorry Michael another time!
> 
> Here a new version from a clean copy.
> 
> Regards.
> A.H.
> 
> 
> ---

> From 936740731c17a9757aa093bdb35d9772df1e64a8 Mon Sep 17 00:00:00 2001
> From: Andreas Hakon 
> Date: Fri, 19 Apr 2019 09:17:32 +0100
> Subject: [PATCH] libavformat: input init mpegts with filters v2
> 
> This patch solves the initialization of the inputs when using filters 
> (a graph filter) with the mpegts muxer.
> 
> This bug seems to be generated by a simple forgetting to copy. The same code 
> is
> repeated two times, but only in one case the variable inputs_done is 
> initialized.
> 

> Testcase:
>  $ ffmpeg -f mpegts -i mpeg.ts \ 
>-filter_complex "[i:100]fps=fps=25[out]" \
>-map "[out]" -c:v libx264 -f mpegts out.ts

i see no difference in the output (same md5)
with what input file does this show a difference?

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

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


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

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

Re: [FFmpeg-devel] [PATCH 00/15] Matroska muxer patches

2019-04-19 Thread Andreas Rheinhardt
Andreas Rheinhardt:
> Hello,
> 
> this patchset is mostly concerned with reducing the unnecessary overhead
> of the Matroska muxer; this overhead mostly comes from not using the
> minimal amount of bytes when writing the length field of master
> elements. The length fields of most level 1 elements are currently
> written on eight bytes; after this patchset, they are always written
> with the minimal amount of bytes.
> 
> Currently, writing level 1 elements always uses dynamic buffers
> (regardless of whether one is in seekable or non-seekable mode), but
> strangely, there are nevertheless two different codepaths for writing
> for the seekable and the non-seekable modes. These have been unified; as
> a consequence, CRC-32 elements are now also written in
> non-seekable/live-mode.
> 
> Given that this patchset changes the output, I had to update some fate
> tests. This is the first time I did this, so I hope I did everything
> right. But doublechecking wouldn't hurt.
> 
> - Andreas
> 
> Andreas Rheinhardt (15):
>   avformat/matroskaenc: Fix relative timestamp check
>   avformat/matroskaenc: Fix BlockGroup size calculation
>   avformat/matroskaenc: Slightly improve size bounds for cues
>   avformat/matroskaenc: Don't waste bytes in EBML Header
>   avformat/matroskaenc: Remove traces of secondary seek head
>   avformat/matroskaenc: Simplify check for writing CRCs
>   avformat/matroskaenc: Improve log message
>   avformat/matroskaenc: Remove redundant check
>   avformat/matroskaenc: Change variable types
>   avformat/matroskaenc: Avoid seeking when writing level 1 elements
>   avformat/matroskaenc: Write CRC-32 in non-seekable mode
>   avformat/matroskaenc: Cosmetics and typo
>   avformat/matroskaenc: Don't waste bytes writing level 1 elements
>   avformat/matroskaenc: Improve log messages for blocks
>   avformat/matroskaenc: Reduce usage of ebml_master
> 
>  libavformat/matroskaenc.c| 319 +--
>  tests/fate/matroska.mak  |   2 +-
>  tests/fate/wavpack.mak   |   4 +-
>  tests/ref/fate/aac-autobsf-adtstoasc |   4 +-
>  tests/ref/fate/binsub-mksenc |   2 +-
>  tests/ref/fate/rgb24-mkv |   4 +-
>  tests/ref/lavf/mka   |   4 +-
>  tests/ref/lavf/mkv   |   4 +-
>  tests/ref/lavf/mkv_attachment|   4 +-
>  tests/ref/seek/lavf-mkv  |  44 ++--
>  10 files changed, 185 insertions(+), 206 deletions(-)
> 

I'd like to ping this patchset. And given that my original submissions
was munged (the sender was changed to "Andreas Rheinhardt via
ffmpeg-devel") I want to know if it's appropriate to resend this whole
patchset or not.

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

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

Re: [FFmpeg-devel] native mode in FFmpeg DNN module

2019-04-19 Thread Pedro Arthur
Hi,

Em sex, 19 de abr de 2019 às 05:41, Guo, Yejun  escreveu:
>
> Option 2)
> Write c code in FFmpeg to convert tensorflow file format (format 1) directly 
> into memory representation (format 3), and so we controls everything in 
> ffmpeg community. And the conversion can be extended to import more file 
> formats such as torch, darknet, etc. One example is that OpenCV uses this 
> method.
>
> The in memory representation (format 3) can still be current.
>

Option 2 would be ideal, as it does not introduce any dependency for
using the native backend.
Yet I'm not sure  how complex implementing the tf model reader can be,
If I remember correctly the student said it was not trivial at the
time.

Is the tf model file stable? if not it will be a maintenance burden to
keep it working whenever tf releases a new version. This point makes
me think having control over our file format is good.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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

Re: [FFmpeg-devel] [PATCH] tests: don't include TARGET_PATH in the sample path needlessly

2019-04-19 Thread Hendrik Leppkes
On Fri, Apr 5, 2019 at 12:06 AM James Almer  wrote:
>
> On 4/3/2019 7:17 PM, Hendrik Leppkes wrote:
> > The transcode() helper function will already prepend the TARGET_PATH to
> > the sample path, if its a relative path. This avoids an issue on
> > Windows, where the relative path check could fail.
> > ---
> >  tests/fate/ffmpeg.mak | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/tests/fate/ffmpeg.mak b/tests/fate/ffmpeg.mak
> > index af7282f9ab..71ab2f1f63 100644
> > --- a/tests/fate/ffmpeg.mak
> > +++ b/tests/fate/ffmpeg.mak
> > @@ -95,7 +95,7 @@ fate-copy-trac2211-avi: CMD = transcode "h264 -r 14" 
> > $(TARGET_SAMPLES)/h264/bbc2
> >
> >  FATE_STREAMCOPY-$(call ENCDEC, APNG, APNG) += fate-copy-apng
> >  fate-copy-apng: fate-lavf-apng
> > -fate-copy-apng: CMD = transcode apng 
> > "$(TARGET_PATH)/tests/data/lavf/lavf.apng" apng "-c:v copy"
> > +fate-copy-apng: CMD = transcode apng tests/data/lavf/lavf.apng apng "-c:v 
> > copy"
>
> Should be ok, thanks.
>

Applied.

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

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

[FFmpeg-devel] [PATCH]configure: Add .exe suffix to some Windows executable names

2019-04-19 Thread Carl Eugen Hoyos
Hi!

Attached patch is necessary for msvc compilation on wsl.

Please comment, Carl Eugen
From 1a6921f6b1f4655a59263ba22aa9e3210143c49b Mon Sep 17 00:00:00 2001
From: Carl Eugen Hoyos 
Date: Fri, 19 Apr 2019 16:16:19 +0200
Subject: [PATCH] configure: Add .exe suffix to some Windows executable names.

Allows msvc compilation from wsl.
---
 compat/windows/mslink |2 +-
 configure |8 
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/compat/windows/mslink b/compat/windows/mslink
index 07b2b3e..6cab090 100755
--- a/compat/windows/mslink
+++ b/compat/windows/mslink
@@ -4,6 +4,6 @@ LINK_EXE_PATH=$(dirname "$(command -v cl)")/link
 if [ -x "$LINK_EXE_PATH" ]; then
 "$LINK_EXE_PATH" $@
 else
-link $@
+link.exe $@
 fi
 exit $?
diff --git a/configure b/configure
index e10e2c2..55f92c6 100755
--- a/configure
+++ b/configure
@@ -4114,14 +4114,14 @@ case "$toolchain" in
 # versions that require the converter (MSVC 2010 and 2012).
 cl_major_ver=$(cl 2>&1 | sed -n 's/.*Version \([[:digit:]]\{1,\}\)\..*/\1/p')
 if [ -z "$cl_major_ver" ] || [ $cl_major_ver -ge 18 ]; then
-cc_default="cl"
-cxx_default="cl"
+cc_default="cl.exe"
+cxx_default="cl.exe"
 else
 die "Unsupported MSVC version (2013 or newer required)"
 fi
 ld_default="$source_path/compat/windows/mslink"
-nm_default="dumpbin -symbols"
-ar_default="lib"
+nm_default="dumpbin.exe -symbols"
+ar_default="lib.exe"
 case "$arch" in
 aarch64|arm64)
 as_default="armasm64"
-- 
1.7.10.4

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

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

Re: [FFmpeg-devel] [PATCH]tests/run-sh: Add execsuf to some calls of local tools

2019-04-19 Thread Carl Eugen Hoyos
2019-04-19 13:11 GMT+02:00, Carl Eugen Hoyos :

> Attached patch is needed here for fate on wsl with msvc, not
> sure why I didn't need this with mingw-gcc.

Better tested and correct variant attached.

Please comment, Carl Eugen
From ef2c43835568dc541b2d88e393768d5457845daa Mon Sep 17 00:00:00 2001
From: Carl Eugen Hoyos 
Date: Fri, 19 Apr 2019 16:11:54 +0200
Subject: [PATCH] tests/fate-run: Add hostexesuf to some calls of local tools.

Allows running fate on wsl with msvc.
---
 tests/fate-run.sh |8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/tests/fate-run.sh b/tests/fate-run.sh
index 56c4efb..2af8612 100755
--- a/tests/fate-run.sh
+++ b/tests/fate-run.sh
@@ -5,7 +5,7 @@ export LC_ALL=C
 base=$(dirname $0)
 . "${base}/md5.sh"
 
-base64=tests/base64
+base64=tests/base64${HOSTEXESUF}
 
 test="${1#fate-}"
 target_samples=$2
@@ -45,7 +45,7 @@ compare(){
 }
 
 do_tiny_psnr(){
-psnr=$(tests/tiny_psnr "$1" "$2" $cmp_unit $cmp_shift 0) || return 1
+psnr=$(tests/tiny_psnr${HOSTEXESUF} "$1" "$2" $cmp_unit $cmp_shift 0) || return 1
 val=$(expr "$psnr" : ".*$3: *\([0-9.]*\)")
 size1=$(expr "$psnr" : '.*bytes: *\([0-9]*\)')
 size2=$(expr "$psnr" : '.*bytes:[ 0-9]*/ *\([0-9]*\)')
@@ -206,7 +206,7 @@ enc_dec(){
 ffmpeg $8 $DEC_OPTS -i $tencfile $ENC_OPTS $dec_opt $FLAGS \
 -f $dec_fmt -y $tdecfile || return
 do_md5sum $decfile
-tests/tiny_psnr $srcfile $decfile $cmp_unit $cmp_shift
+tests/tiny_psnr${HOSTEXESUF} $srcfile $decfile $cmp_unit $cmp_shift
 }
 
 transcode(){
@@ -455,7 +455,7 @@ audio_match(){
 cleanfiles="$cleanfiles $decfile"
 
 ffmpeg -i "$sample" -bitexact $extra_args -y $decfile
-tests/audiomatch $decfile $trefile
+tests/audiomatch${HOSTEXESUF} $decfile $trefile
 }
 
 concat(){
-- 
1.7.10.4

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

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

Re: [FFmpeg-devel] How to correctly use init and uninit

2019-04-19 Thread Carl Eugen Hoyos
2019-04-19 14:25 GMT+02:00, Ulf Zibis :
>
> Am 19.04.19 um 13:38 schrieb Paul B Mahol:
>>
>> Use either av_freep(&s->filler) or av_free(s->filler).
>
> It works fine without 'p'.

Please use av_freep() for context variables.

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

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

Re: [FFmpeg-devel] [PATCH 2/2] avfilter: add audio sampling filter

2019-04-19 Thread Paul B Mahol
On 4/19/19, Nicolas George  wrote:
> Still rejected.

As ML administrator previously wrote you need to provide technical reasons
for rejection to make rejection valid.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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

Re: [FFmpeg-devel] [PATCH 2/2] avfilter: add audio sampling filter

2019-04-19 Thread Nicolas George
Still rejected.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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

[FFmpeg-devel] [PATCH 2/2] avfilter: add audio sampling filter

2019-04-19 Thread Paul B Mahol
Signed-off-by: Paul B Mahol 
---
Now with 2 filters merged into one and more sample formats.
---
 doc/filters.texi   |  18 +++
 libavfilter/Makefile   |   1 +
 libavfilter/af_asampling.c | 280 +
 libavfilter/allfilters.c   |   1 +
 4 files changed, 300 insertions(+)
 create mode 100644 libavfilter/af_asampling.c

diff --git a/doc/filters.texi b/doc/filters.texi
index 465eeb4732..34aa5cc173 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -2018,6 +2018,24 @@ atrim=end=5,areverse
 @end example
 @end itemize
 
+@section asampling
+Downsample or upsample audio by integer factor.
+
+For downsampling only the first out of each factor samples is retained,
+the others are discarded
+For upsampling, factor-1 zero-value samples are inserted between each pair of 
input samples.
+As a result, the original spectrum is replicated into the new frequency space 
and attenuated.
+
+A description of the accepted parameters follows.
+
+@table @option
+@item mode
+Can be either @code{down} or @code{up}. Default is @code{up}.
+
+@item factor
+Set factor of downsampling/upsampling. Default is @code{1}.
+@end table
+
 @section asetnsamples
 
 Set the number of samples per each output audio frame.
diff --git a/libavfilter/Makefile b/libavfilter/Makefile
index 682df45ef5..f814ad2c04 100644
--- a/libavfilter/Makefile
+++ b/libavfilter/Makefile
@@ -72,6 +72,7 @@ OBJS-$(CONFIG_APULSATOR_FILTER)  += af_apulsator.o
 OBJS-$(CONFIG_AREALTIME_FILTER)  += f_realtime.o
 OBJS-$(CONFIG_ARESAMPLE_FILTER)  += af_aresample.o
 OBJS-$(CONFIG_AREVERSE_FILTER)   += f_reverse.o
+OBJS-$(CONFIG_ASAMPLING_FILTER)  += af_asampling.o
 OBJS-$(CONFIG_ASELECT_FILTER)+= f_select.o
 OBJS-$(CONFIG_ASENDCMD_FILTER)   += f_sendcmd.o
 OBJS-$(CONFIG_ASETNSAMPLES_FILTER)   += af_asetnsamples.o
diff --git a/libavfilter/af_asampling.c b/libavfilter/af_asampling.c
new file mode 100644
index 00..9c12bb02ab
--- /dev/null
+++ b/libavfilter/af_asampling.c
@@ -0,0 +1,280 @@
+/*
+ * Copyright (c) 2019 Paul B Mahol
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "libavutil/opt.h"
+#include "libavutil/samplefmt.h"
+#include "avfilter.h"
+#include "audio.h"
+#include "filters.h"
+#include "internal.h"
+
+typedef struct AudioSamplingContext {
+const AVClass *class;
+
+int mode;
+int factor;
+
+int min_in_samples;
+int64_t next_pts;
+
+void (*filter)(AVFrame *out, AVFrame *in, int mode, int factor);
+} AudioSamplingContext;
+
+#define OFFSET(x) offsetof(AudioSamplingContext, x)
+#define A AV_OPT_FLAG_AUDIO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
+
+static const AVOption asampling_options[] = {
+{ "mode",   "set sampling mode",   OFFSET(mode),   AV_OPT_TYPE_INT,   
{.i64=1}, 0, 1, A, "mode" },
+{   "down", 0, 0,  AV_OPT_TYPE_CONST, 
{.i64=0}, 0, 0, A, "mode" },
+{   "up",   0, 0,  AV_OPT_TYPE_CONST, 
{.i64=1}, 0, 0, A, "mode" },
+{ "factor", "set downsampling factor", OFFSET(factor), AV_OPT_TYPE_INT,   
{.i64=1}, 1, 64, A },
+{ NULL }
+};
+
+AVFILTER_DEFINE_CLASS(asampling);
+
+static int query_formats(AVFilterContext *ctx)
+{
+AudioSamplingContext *s = ctx->priv;
+AVFilterChannelLayouts *layouts;
+AVFilterFormats *formats;
+int sample_rates[] = { 44100, -1 };
+static const enum AVSampleFormat sample_fmts[] = {
+AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_FLTP,
+AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_DBLP,
+AV_SAMPLE_FMT_NONE
+};
+AVFilterFormats *avff;
+int ret;
+
+if (!ctx->inputs[0]->in_samplerates ||
+!ctx->inputs[0]->in_samplerates->nb_formats) {
+return AVERROR(EAGAIN);
+}
+
+layouts = ff_all_channel_counts();
+if (!layouts)
+return AVERROR(ENOMEM);
+ret = ff_set_common_channel_layouts(ctx, layouts);
+if (ret < 0)
+return ret;
+
+formats = ff_make_format_list(sample_fmts);
+if (!formats)
+return AVERROR(ENOMEM);
+ret = ff_set_common_formats(ctx, formats);
+if (ret < 0)
+return ret;
+
+avff = ctx->inputs[0]->in_samplerates;
+sample_rates[0] = avff

[FFmpeg-devel] [PATCH 1/2] avfilter: add audio soft clip filter

2019-04-19 Thread Paul B Mahol
Signed-off-by: Paul B Mahol 
---
With more sample formats support.
---
 doc/filters.texi   |  27 
 libavfilter/Makefile   |   1 +
 libavfilter/af_asoftclip.c | 289 +
 libavfilter/allfilters.c   |   1 +
 4 files changed, 318 insertions(+)
 create mode 100644 libavfilter/af_asoftclip.c

diff --git a/doc/filters.texi b/doc/filters.texi
index 4dd1a5de85..465eeb4732 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -2104,6 +2104,33 @@ audio, the data is treated as if all the planes were 
concatenated.
 A list of Adler-32 checksums for each data plane.
 @end table
 
+@section asoftclip
+Apply audio soft clipping.
+
+Soft clipping is a type of distortion effect where the amplitude of a signal 
is saturated
+along a smooth curve, rather than the abrupt shape of hard-clipping.
+
+This filter accepts the following options:
+
+@table @option
+@item type
+Set type of soft-clipping.
+
+It accepts the following values:
+@table @option
+@item tanh
+@item atan
+@item cubic
+@item exp
+@item alg
+@item quintic
+@item sin
+@end table
+
+@item param
+Set additional parameter which controls sigmoid function.
+@end table
+
 @anchor{astats}
 @section astats
 
diff --git a/libavfilter/Makefile b/libavfilter/Makefile
index fef6ec5c55..682df45ef5 100644
--- a/libavfilter/Makefile
+++ b/libavfilter/Makefile
@@ -80,6 +80,7 @@ OBJS-$(CONFIG_ASETRATE_FILTER)   += af_asetrate.o
 OBJS-$(CONFIG_ASETTB_FILTER) += settb.o
 OBJS-$(CONFIG_ASHOWINFO_FILTER)  += af_ashowinfo.o
 OBJS-$(CONFIG_ASIDEDATA_FILTER)  += f_sidedata.o
+OBJS-$(CONFIG_ASOFTCLIP_FILTER)  += af_asoftclip.o
 OBJS-$(CONFIG_ASPLIT_FILTER) += split.o
 OBJS-$(CONFIG_ASTATS_FILTER) += af_astats.o
 OBJS-$(CONFIG_ASTREAMSELECT_FILTER)  += f_streamselect.o framesync.o
diff --git a/libavfilter/af_asoftclip.c b/libavfilter/af_asoftclip.c
new file mode 100644
index 00..1966613092
--- /dev/null
+++ b/libavfilter/af_asoftclip.c
@@ -0,0 +1,289 @@
+/*
+ * Copyright (c) 2019 The FFmpeg Project
+ *
+ * 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/channel_layout.h"
+#include "libavutil/opt.h"
+#include "avfilter.h"
+#include "audio.h"
+#include "formats.h"
+
+enum ASoftClipTypes {
+ASC_TANH,
+ASC_ATAN,
+ASC_CUBIC,
+ASC_EXP,
+ASC_ALG,
+ASC_QUINTIC,
+ASC_SIN,
+NB_TYPES,
+};
+
+typedef struct ASoftClipContext {
+const AVClass *class;
+
+int type;
+double param;
+
+void (*filter)(struct ASoftClipContext *s, void **dst, const void **src,
+   int nb_samples, int channels);
+} ASoftClipContext;
+
+#define OFFSET(x) offsetof(ASoftClipContext, x)
+#define A AV_OPT_FLAG_AUDIO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
+
+static const AVOption asoftclip_options[] = {
+{ "type", "set softclip type", OFFSET(type), AV_OPT_TYPE_INT,{.i64=0}, 
 0, NB_TYPES-1, A, "types" },
+{ "tanh",NULL,0, AV_OPT_TYPE_CONST,  
{.i64=ASC_TANH},   0,  0, A, "types" },
+{ "atan",NULL,0, AV_OPT_TYPE_CONST,  
{.i64=ASC_ATAN},   0,  0, A, "types" },
+{ "cubic",   NULL,0, AV_OPT_TYPE_CONST,  
{.i64=ASC_CUBIC},  0,  0, A, "types" },
+{ "exp", NULL,0, AV_OPT_TYPE_CONST,  
{.i64=ASC_EXP},0,  0, A, "types" },
+{ "alg", NULL,0, AV_OPT_TYPE_CONST,  
{.i64=ASC_ALG},0,  0, A, "types" },
+{ "quintic", NULL,0, AV_OPT_TYPE_CONST,  
{.i64=ASC_QUINTIC},0,  0, A, "types" },
+{ "sin", NULL,0, AV_OPT_TYPE_CONST,  
{.i64=ASC_SIN},0,  0, A, "types" },
+{ "param", "set softclip parameter", OFFSET(param), AV_OPT_TYPE_DOUBLE, 
{.dbl=1}, 0.01,3, A },
+{ NULL }
+};
+
+AVFILTER_DEFINE_CLASS(asoftclip);
+
+static int query_formats(AVFilterContext *ctx)
+{
+AVFilterFormats *formats = NULL;
+AVFilterChannelLayouts *layouts = NULL;
+static const enum AVSampleFormat sample_fmts[] = {
+AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_FLTP,
+AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_DBLP,
+ 

Re: [FFmpeg-devel] [PATCH 2/3] avfilter: add audio upsample filter

2019-04-19 Thread Michael Niedermayer
On Fri, Apr 19, 2019 at 11:34:04AM +0200, Paul B Mahol wrote:
> On 4/19/19, Nicolas George  wrote:
> > Paul B Mahol (12019-04-19):
> >> This is not about sample rate negotiation.
> >
> > Yes it is.
> 
> Give proof.
> 
> No, you need to argue better your pathetic behavior.
> 
> >
> >> Bad argumentation.
> >
> > Then argue better.
> >
> > Patches rejected for now.
> 
> Look, you  are full of shit. And know nothing about audio processing.

As i have been asked to look into this (and as we dont have many other
ML admins currently)

This is a technical mailing list, arguing about how much you love each
other does not belong here.

As a remainder
Everyone, the subject of discussions should be FFmpeg and the technologies
sorounding it. Insults, "Ad hominem" argumentation/attacks, and so on lead
to a hostile climate that helps noone not even the one winning the argument
eventually.
If theres a disagreement on a patch (one wanting it in one not wanting it in
and after technical discussion its not resolved), we can if everything else
fails do a vote on the patch. A technical solution with technical arguments
is better though than a vote.

Thanks

[...]
-- 
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
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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

Re: [FFmpeg-devel] How to correctly use init and uninit

2019-04-19 Thread Paul B Mahol
On 4/19/19, Ulf Zibis  wrote:
>
> Am 19.04.19 um 14:35 schrieb Paul B Mahol:
>>> Do I really need the init function, as it has to do nothing in my case?
>> If it does nothing, you can safely remove it.
>
> Thanks!
>
>>> For performance testing I use the like:
>>> -f rawvideo -pix_fmt gray16 -s 400x600 -i /dev/zero
>>>
>>> Are there doubts if that is good either?
>> Use ffmpeg -f lavfi -i color=color=black:size=400x600 ...
>>
>> Thing about /dev/zero and -f rawvideo is that it will decode zeroes
>> over and over again and thus use more CPU for that.
> Thanks again for the hint. For my tests I use different formats:
> test[i++]="3-plane 8-bit  YUV-420:   -pix_fmt yuv420p"
> test[i++]="3-plane 16-bit YUV-420:   -pix_fmt yuv420p16"
> test[i++]="3-plane 16-bit YUV-444:   -pix_fmt yuv444p16"
> test[i++]="1-plane 8-bit  Y-400: -pix_fmt gray"
> test[i++]="1-plane 16-bit Y-400: -pix_fmt gray16"
>
> test[i++]="4-plane 16-bit RGBA-444:  -pix_fmt rgba64"
>
> What could be the expressions with "-f lavfi"?

ffmpeg -f lavfi -i color=...,format=rgba64/gray/gray16...

This would use scale filter to convert every frame, but your case
is not depending on it.
You could also use bench filter.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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

[FFmpeg-devel] [PATCH v3] Fix sdp size check on fmtp integer parameters

2019-04-19 Thread Olivier Maignial
RFC-4566 do not give any limit of size on interger parameters given in fmtp 
line.
By reading some more RFCs it is possible to find examples where some integers 
parameters are greater than 32 (see RFC-6416, 7.4)

Instead I propose to check just check the eventual integer overflow.
Using INT_MIN and INT_MAX ensure that it will work whatever the size of int 
given by compiler

Signed-off-by: Olivier Maignial 
---

Changes v2 -> v3:
Fix over/underflow checking in case of sizeof(int) == sizeof(long)

If MAX/MIN_INT == MAX/MIN_LONG overflow would not be detected by just checking 
value is in range [MAX_INT,MIN_INT].

In case of over/underflow strtol return MAX/MIN_LONG and set errno to ERANGE.
As MAX/MIN_LONG are valid values, the only way to detect over/underflow is to 
check errno.

 libavformat/rtpdec_mpeg4.c | 28 +++-
 1 file changed, 23 insertions(+), 5 deletions(-)

diff --git a/libavformat/rtpdec_mpeg4.c b/libavformat/rtpdec_mpeg4.c
index 4f70599..d40cb5a 100644
--- a/libavformat/rtpdec_mpeg4.c
+++ b/libavformat/rtpdec_mpeg4.c
@@ -289,15 +289,33 @@ static int parse_fmtp(AVFormatContext *s,
 for (i = 0; attr_names[i].str; ++i) {
 if (!av_strcasecmp(attr, attr_names[i].str)) {
 if (attr_names[i].type == ATTR_NAME_TYPE_INT) {
-int val = atoi(value);
-if (val > 32) {
+char *end_ptr = NULL;
+errno = 0;
+long int val = strtol(value, &end_ptr, 10);
+if (value[0] == '\n' || end_ptr[0] != '\0') {
 av_log(s, AV_LOG_ERROR,
-   "The %s field size is invalid (%d)\n",
-   attr, val);
+   "The %s field value is not a number (%s)\n",
+   attr, value);
 return AVERROR_INVALIDDATA;
 }
+if ((val == LONG_MAX && errno == ERANGE) ||
+val > INT_MAX) {
+av_log(s, AV_LOG_ERROR,
+   "Value of field %s overflow maximum integer 
value.\n",
+   attr);
+return AVERROR_INVALIDDATA;
+}
+if ((val == LONG_MIN && errno == ERANGE) ||
+val < INT_MIN)
+{
+av_log(s, AV_LOG_ERROR,
+   "Value of field %s underflow minimum integer 
value.\n",
+   attr);
+return AVERROR_INVALIDDATA;
+}
+
 *(int *)((char *)data+
-attr_names[i].offset) = val;
+attr_names[i].offset) = (int) val;
 } else if (attr_names[i].type == ATTR_NAME_TYPE_STR) {
 char *val = av_strdup(value);
 if (!val)
-- 
2.7.4

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

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

Re: [FFmpeg-devel] [PATCH] mpeg12enc: Use all Closed Captions side data

2019-04-19 Thread Mathieu Duponchelle
Hello ? :)

On 4/10/19 1:26 PM, Mathieu Duponchelle wrote:
> No problem, note that the added indentation is because a loop
> was added :)
>
> On 4/10/19 1:14 AM, Carl Eugen Hoyos wrote:
>> 2019-03-23 0:22 GMT+01:00, Mathieu Duponchelle :
>>> It is perfectly valid to have multiple CC Picture User Data
>>> for the same frame. Instead of using the first side_data
>>> potentially present with the A53_CC type, iterate over all
>>> side_data.
>> Please separate the functional changes in your patch from
>> the cosmetics, ie do not re-indent in the same patch to make
>> reviews easier.
>>
>> Sorry for the late reply, Carl Eugen
>> ___
>> ffmpeg-devel mailing list
>> ffmpeg-devel@ffmpeg.org
>> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>>
>> To unsubscribe, visit link above, or email
>> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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

Re: [FFmpeg-devel] How to correctly use init and uninit

2019-04-19 Thread Ulf Zibis

Am 19.04.19 um 14:35 schrieb Paul B Mahol:
>> Do I really need the init function, as it has to do nothing in my case?
> If it does nothing, you can safely remove it.

Thanks!

>> For performance testing I use the like:
>> -f rawvideo -pix_fmt gray16 -s 400x600 -i /dev/zero
>>
>> Are there doubts if that is good either?
> Use ffmpeg -f lavfi -i color=color=black:size=400x600 ...
>
> Thing about /dev/zero and -f rawvideo is that it will decode zeroes
> over and over again and thus use more CPU for that.
Thanks again for the hint. For my tests I use different formats:
test[i++]="3-plane 8-bit  YUV-420:   -pix_fmt yuv420p"
test[i++]="3-plane 16-bit YUV-420:   -pix_fmt yuv420p16"
test[i++]="3-plane 16-bit YUV-444:   -pix_fmt yuv444p16"
test[i++]="1-plane 8-bit  Y-400: -pix_fmt gray"
test[i++]="1-plane 16-bit Y-400: -pix_fmt gray16"

test[i++]="4-plane 16-bit RGBA-444:  -pix_fmt rgba64"

What could be the expressions with "-f lavfi"?

-Ulf

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

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

Re: [FFmpeg-devel] How to correctly use init and uninit

2019-04-19 Thread Paul B Mahol
On 4/19/19, Ulf Zibis  wrote:
>
> Am 19.04.19 um 13:38 schrieb Paul B Mahol:
>>
>> Use either av_freep(&s->filler) or av_free(s->filler).
>
> It works fine without 'p'. Thanks!
>
> Do I really need the init function, as it has to do nothing in my case?

If it does nothing, you can safely remove it.

>
> static av_cold int init(AVFilterContext *ctx)
> {
> FillBordersContext *s = ctx->priv;
> return 0;
> }
>
>
>> You do not need to use loop filter on single png.
> I need real pictures to prove the correctness of my hacking. The
> smptebars is not appopriate to see errors in the output e.g. from mirroring.
>
>> Use something like this:
>>
>> ffmpeg -f lavfi -i smptebars=size=hd720 -vf fillborders=... -f null -
> For performance testing I use the like:
> -f rawvideo -pix_fmt gray16 -s 400x600 -i /dev/zero
>
> Are there doubts if that is good either?

Use ffmpeg -f lavfi -i color=color=black:size=400x600 ...

Thing about /dev/zero and -f rawvideo is that it will decode zeroes
over and over again and thus use more CPU for that.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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

Re: [FFmpeg-devel] How to correctly use init and uninit

2019-04-19 Thread Ulf Zibis

Am 19.04.19 um 13:38 schrieb Paul B Mahol:
>
> Use either av_freep(&s->filler) or av_free(s->filler).

It works fine without 'p'. Thanks!

Do I really need the init function, as it has to do nothing in my case?

static av_cold int init(AVFilterContext *ctx)
{
FillBordersContext *s = ctx->priv;
return 0;
}
 

> You do not need to use loop filter on single png.
I need real pictures to prove the correctness of my hacking. The
smptebars is not appopriate to see errors in the output e.g. from mirroring.

> Use something like this:
>
> ffmpeg -f lavfi -i smptebars=size=hd720 -vf fillborders=... -f null -
For performance testing I use the like:
-f rawvideo -pix_fmt gray16 -s 400x600 -i /dev/zero

Are there doubts if that is good either?

-Ulf

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

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

Re: [FFmpeg-devel] [PATCH]lavu/hwcontext_d3d: Cast a pointer calling av_image_copy()

2019-04-19 Thread Carl Eugen Hoyos
2019-04-18 13:58 GMT+02:00, Carl Eugen Hoyos :

> Attached patch silences several warnings when compiling for win32.

Patch applied.

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

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

Re: [FFmpeg-devel] [PATCH]lavf/vc1dec: Reduce probe score for streams with invalid frames

2019-04-19 Thread Carl Eugen Hoyos
2019-04-18 0:53 GMT+02:00, Carl Eugen Hoyos :

> Attached patch fixes ticket #7853.

Patch applied.

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

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

Re: [FFmpeg-devel] [PATCH]lavc/alac: Make a variable unsigned

2019-04-19 Thread Carl Eugen Hoyos
2019-04-18 13:53 GMT+02:00, Carl Eugen Hoyos :

> Attached patch silences a warning that is shown with some gcc versions.

Patch applied.

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

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

Re: [FFmpeg-devel] [PATCH]lavf/utils: Allow url credentials to contain a slash

2019-04-19 Thread Carl Eugen Hoyos
2019-03-28 19:35 GMT+01:00, Carl Eugen Hoyos :

> Attached patch fixes ticket #7816 for me.

Patch applied.

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

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

Re: [FFmpeg-devel] [PATCH] avutil/colorspace: add macros for RGB->YUV BT.709

2019-04-19 Thread Gyan



On 19-04-2019 09:57 AM, Gyan wrote:



On 19-04-2019 01:04 AM, Gyan wrote:



On 17-04-2019 11:30 PM, Gyan wrote:



On 17-04-2019 11:11 PM, Vittorio Giovara wrote:

On Wed, Apr 17, 2019 at 12:26 AM Gyan  wrote:



On 13-04-2019 05:23 PM, Gyan wrote:

Will be helpful for correct result in filters that paint like
fillborders/drawbox or those using drawutils.

Ping.


these seem to only work for 8 bit content, is that their only intended
usecase?
if so, could there be at least a comment mentioning that please?
Yes, the existing macros use Rec.601 co-efficients, but most data is 
709 now.

Will add a note.


With note.


Will apply soon.


Pushed as 3bef1dab6e881bf593037f831e66ed87c6167e3c

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

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

Re: [FFmpeg-devel] How to correctly use init and uninit

2019-04-19 Thread Paul B Mahol
On 4/19/19, Ulf Zibis  wrote:
> Hi,
>
> to libavfilter/vf_fillborders.c I've added the following:
> ===
> typedef struct FillBordersContext {
> [.]
> uint16_t *filler;
>
> void (*fillborders)(struct FillBordersContext *s, AVFrame *frame);
> } FillBordersContext;
>
> // following must be moved up to compile correctly with
> STOP_TIMER(testcase)
>
> #define OFFSET(x) offsetof(FillBordersContext, x)
> #define FLAGS AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
>
> static const AVOption fillborders_options[] = {
> [.]
> };
>
> AVFILTER_DEFINE_CLASS(fillborders);
>
> [.]
>
> static char testcase[128];
>
> static av_cold int init(AVFilterContext *ctx)
> {
> FillBordersContext *s = ctx->priv;
> return 0;
> }
>
> static int config_init(AVFilterLink *inlink)
> {
> [.]
> int fill_sz = FFMAX3(s->left, s->right, s->top != 0 || inlink->h -
> s->bottom != 0 ? inlink->w : 0);
> printf("fill_sz: %d\n", fill_sz);
> s->filler = av_malloc(fill_sz * sizeof(uint16_t));
> /*
> for (int i = 0; i < fill_sz; i++)
> s->filler[i] = s->fill[p] << (s->depth - 8);
> */
>
> sprintf(testcase, "fillborders=%d:%d:%d:%d:%s %dp-%dbit-%dx%d",
> s->left, s->right, s->top, s->bottom, fillborders_options[5
> + s->mode].name,
> s->nb_planes, s->depth, desc->log2_chroma_w,
> desc->log2_chroma_h);
>
> return 0;
> }
>
> static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
> {
> FillBordersContext *s = inlink->dst->priv;
>
> START_TIMER
>
> s->fillborders(s, frame);
>
> STOP_TIMER(testcase)
>
> return ff_filter_frame(inlink->dst->outputs[0], frame);
> }
>
> static av_cold void uninit(AVFilterContext *ctx)
> {
> FillBordersContext *s = ctx->priv;
> av_freep(s->filler);
> }
>
> [.]
>
> AVFilter ff_vf_fillborders = {
> [.]
> .init  = init,
> .uninit= uninit,
> [.]
> };
> ===
>
> When running the filter with (1-plane 16-bit GRAY) I get "free():
> invalid pointer" :
>
> $ ./ffmpeg -y -i debug/16.jpg -vf
> loop=1:1:0:start=0,fillborders=25:25:0:0:fixed:green -update 1
> debug/16_fixed_25-25-0-0.jpg
> ffmpeg version N-93468-g6e6f598ae2 Copyright (c) 2000-2019 the FFmpeg
> developers
>   built with gcc 7 (Ubuntu 7.3.0-27ubuntu1~18.04)
>   configuration:
>   libavutil  56. 26.100 / 56. 26.100
>   libavcodec 58. 47.105 / 58. 47.105
>   libavformat58. 26.101 / 58. 26.101
>   libavdevice58.  7.100 / 58.  7.100
>   libavfilter 7. 48.100 /  7. 48.100
>   libswscale  5.  4.100 /  5.  4.100
>   libswresample   3.  4.100 /  3.  4.100
> Input #0, image2, from 'debug/16.jpg':
>   Duration: 00:00:00.04, start: 0.00, bitrate: 103852 kb/s
> Stream #0:0: Video: mjpeg (Lossless),
> gray16le(bt470bg/unknown/unknown), 640x480 [SAR 96:96 DAR 4:3],
> lossless, 25 tbr, 25 tbn, 25 tbc
> Stream mapping:
>   Stream #0:0 -> #0:0 (mjpeg (native) -> mjpeg (native))
> Press [q] to stop, [?] for help
> fill_sz: 640
> [swscaler @ 0x55e255ec6980] deprecated pixel format used, make sure you
> did set range correctly
>  481140 decicycles in fillborders=25:25:0:0:fixed 1p-16bit-0x0,   1
> runs,  0 skips
> Output #0, image2, to 'debug/16_fixed_25-25-0-0.jpg':
>   Metadata:
> encoder : Lavf58.26.101
> Stream #0:0: Video: mjpeg, yuvj444p(pc), 640x480 [SAR 1:1 DAR 4:3],
> q=2-31, 200 kb/s, 25 fps, 25 tbn, 25 tbc
> Metadata:
>   encoder : Lavc58.47.105 mjpeg
> Side data:
>   cpb: bitrate max/min/avg: 0/0/20 buffer size: 0 vbv_delay: -1
>  480645 decicycles in fillborders=25:25:0:0:fixed 1p-16bit-0x0,   2
> runs,  0 skips
> frame=2 fps=0.0 q=3.9 Lsize=N/A time=00:00:00.08 bitrate=N/A
> speed=1.56x
> video:75kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB
> muxing overhead: unknown
> free(): invalid pointer
> Abgebrochen (Speicherabzug geschrieben)
> ===
>
> When running the filter with "-v error" AND (1-plane 8-bit GRAY) I don't
> get the error, but again with 16-bit, weird :
>
> $ ./ffmpeg -y -v error -i debug/8.jpg -vf
> loop=1:1:0:start=0,fillborders=25:25:0:0:fixed:green -update 1
> debug/8_fixed_25-25-0-0.jpg
> fill_sz: 640
>  227340 decicycles in fillborders=25:25:0:0:fixed 1p-8bit-0x0,   1
> runs,  0 skips
>  226575 decicycles in fillborders=25:25:0:0:fixed 1p-8bit-0x0,   2
> runs,  0 skips
> $ ./ffmpeg -y -v error -i debug/16.jpg -vf
> loop=1:1:0:start=0,fillborders=25:25:0:0:fixed:green -update 1
> debug/16_fixed_25-25-0-0.jpg
> fill_sz: 640
>  447750 decicycles in fillborders=25:25:0:0:fixed 1p-16bit-0x0,   1
> runs,  0 skips
>  449775 decicycles in fillborders=25:25:0:0:fixed 1p-16bit-0x0,   2
> runs,  0 skips
> free(): invalid pointer
> Abgebrochen (Speicherabzug geschrieben)
> ===

[FFmpeg-devel] [PATCH] web/security: Add CVE-2019-11338, CVE-2019-11339

2019-04-19 Thread Michael Niedermayer
---
 src/security | 12 
 1 file changed, 12 insertions(+)

diff --git a/src/security b/src/security
index 9175aba..bdcce15 100644
--- a/src/security
+++ b/src/security
@@ -3,6 +3,14 @@
 
 FFmpeg 4.1
 
+4.1.3
+
+Fixes following vulnerabilities:
+
+
+CVE-2019-11338, f1ecebcdb72b5928b585ec8f07c3847927b4bf1d / 
54655623a82632e7624714d7b2a3e039dc5faa7e
+
+
 4.1.2
 
 Fixes following vulnerabilities:
@@ -10,6 +18,8 @@ Fixes following vulnerabilities:
 
 CVE-2019-9718, cc5361ed18ab0f69cfbead7afc88fb81ed4b36ae / 
1f00c97bc3475c477f3c468cf2d924d5761d0982
 CVE-2019-9721, f7f3937494f6734d27fc3d0081c9c7a9a19614a8 / 
894995c41e0795c7a44f81adc4838dedc3932e65
+CVE-2019-11339, 1e50a327c649c8a00741996b9f6db83fdc00285a / 
d227ed5d598340e719eff7156b1aa0a4469e9a6a
+CVE-2019-11339, 8066cb3556e77570b72b28ccef9613ea0887d5ac / 
1f686d023b95219db933394a7704ad9aa5f01cbb
 
 
 4.1.1
@@ -54,6 +64,8 @@ Fixes following vulnerabilities:
 
 CVE-2019-9718, 381fa4a29d38e4ddef2a83876fb8f76e96f45a5d / 
1f00c97bc3475c477f3c468cf2d924d5761d0982
 CVE-2019-9721, 7dc5c930354c4339ce36a6cc4f2113c9cfd294f5 / 
894995c41e0795c7a44f81adc4838dedc3932e65
+CVE-2019-11339, 8183623ca38cbeb5bceddc874f218fec66bd802b / 
1f686d023b95219db933394a7704ad9aa5f01cbb
+CVE-2019-11339, aadce82c585181168f3b7cdf260c3d461d4baa1b / 
d227ed5d598340e719eff7156b1aa0a4469e9a6a
 
 
 4.0.3
-- 
2.21.0

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

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

[FFmpeg-devel] How to correctly use init and uninit

2019-04-19 Thread Ulf Zibis
Hi,

to libavfilter/vf_fillborders.c I've added the following:
===
typedef struct FillBordersContext {
    [.]
    uint16_t *filler;

    void (*fillborders)(struct FillBordersContext *s, AVFrame *frame);
} FillBordersContext;

// following must be moved up to compile correctly with STOP_TIMER(testcase)

#define OFFSET(x) offsetof(FillBordersContext, x)
#define FLAGS AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM

static const AVOption fillborders_options[] = {
    [.]
};

AVFILTER_DEFINE_CLASS(fillborders);

[.]

static char testcase[128];

static av_cold int init(AVFilterContext *ctx)
{
    FillBordersContext *s = ctx->priv;
    return 0;
}

static int config_init(AVFilterLink *inlink)
{
    [.]
    int fill_sz = FFMAX3(s->left, s->right, s->top != 0 || inlink->h -
s->bottom != 0 ? inlink->w : 0);
    printf("fill_sz: %d\n", fill_sz);
    s->filler = av_malloc(fill_sz * sizeof(uint16_t));
/*
    for (int i = 0; i < fill_sz; i++)
    s->filler[i] = s->fill[p] << (s->depth - 8);
*/

    sprintf(testcase, "fillborders=%d:%d:%d:%d:%s %dp-%dbit-%dx%d",
    s->left, s->right, s->top, s->bottom, fillborders_options[5
+ s->mode].name,
    s->nb_planes, s->depth, desc->log2_chroma_w,
desc->log2_chroma_h);

    return 0;
}

static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
{
    FillBordersContext *s = inlink->dst->priv;

    START_TIMER

    s->fillborders(s, frame);

    STOP_TIMER(testcase)

    return ff_filter_frame(inlink->dst->outputs[0], frame);
}

static av_cold void uninit(AVFilterContext *ctx)
{
    FillBordersContext *s = ctx->priv;
    av_freep(s->filler);
}

[.]

AVFilter ff_vf_fillborders = {
    [.]
    .init  = init,
    .uninit    = uninit,
    [.]
};
===

When running the filter with (1-plane 16-bit GRAY) I get "free():
invalid pointer" :

$ ./ffmpeg -y -i debug/16.jpg -vf
loop=1:1:0:start=0,fillborders=25:25:0:0:fixed:green -update 1
debug/16_fixed_25-25-0-0.jpg
ffmpeg version N-93468-g6e6f598ae2 Copyright (c) 2000-2019 the FFmpeg
developers
  built with gcc 7 (Ubuntu 7.3.0-27ubuntu1~18.04)
  configuration:
  libavutil  56. 26.100 / 56. 26.100
  libavcodec 58. 47.105 / 58. 47.105
  libavformat    58. 26.101 / 58. 26.101
  libavdevice    58.  7.100 / 58.  7.100
  libavfilter 7. 48.100 /  7. 48.100
  libswscale  5.  4.100 /  5.  4.100
  libswresample   3.  4.100 /  3.  4.100
Input #0, image2, from 'debug/16.jpg':
  Duration: 00:00:00.04, start: 0.00, bitrate: 103852 kb/s
    Stream #0:0: Video: mjpeg (Lossless),
gray16le(bt470bg/unknown/unknown), 640x480 [SAR 96:96 DAR 4:3],
lossless, 25 tbr, 25 tbn, 25 tbc
Stream mapping:
  Stream #0:0 -> #0:0 (mjpeg (native) -> mjpeg (native))
Press [q] to stop, [?] for help
fill_sz: 640
[swscaler @ 0x55e255ec6980] deprecated pixel format used, make sure you
did set range correctly
 481140 decicycles in fillborders=25:25:0:0:fixed 1p-16bit-0x0,   1
runs,  0 skips
Output #0, image2, to 'debug/16_fixed_25-25-0-0.jpg':
  Metadata:
    encoder : Lavf58.26.101
    Stream #0:0: Video: mjpeg, yuvj444p(pc), 640x480 [SAR 1:1 DAR 4:3],
q=2-31, 200 kb/s, 25 fps, 25 tbn, 25 tbc
    Metadata:
  encoder : Lavc58.47.105 mjpeg
    Side data:
  cpb: bitrate max/min/avg: 0/0/20 buffer size: 0 vbv_delay: -1
 480645 decicycles in fillborders=25:25:0:0:fixed 1p-16bit-0x0,   2
runs,  0 skips
frame=    2 fps=0.0 q=3.9 Lsize=N/A time=00:00:00.08 bitrate=N/A
speed=1.56x    
video:75kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB
muxing overhead: unknown
free(): invalid pointer
Abgebrochen (Speicherabzug geschrieben)
===

When running the filter with "-v error" AND (1-plane 8-bit GRAY) I don't
get the error, but again with 16-bit, weird :

$ ./ffmpeg -y -v error -i debug/8.jpg -vf
loop=1:1:0:start=0,fillborders=25:25:0:0:fixed:green -update 1
debug/8_fixed_25-25-0-0.jpg
fill_sz: 640
 227340 decicycles in fillborders=25:25:0:0:fixed 1p-8bit-0x0,   1
runs,  0 skips
 226575 decicycles in fillborders=25:25:0:0:fixed 1p-8bit-0x0,   2
runs,  0 skips
$ ./ffmpeg -y -v error -i debug/16.jpg -vf
loop=1:1:0:start=0,fillborders=25:25:0:0:fixed:green -update 1
debug/16_fixed_25-25-0-0.jpg
fill_sz: 640
 447750 decicycles in fillborders=25:25:0:0:fixed 1p-16bit-0x0,   1
runs,  0 skips
 449775 decicycles in fillborders=25:25:0:0:fixed 1p-16bit-0x0,   2
runs,  0 skips
free(): invalid pointer
Abgebrochen (Speicherabzug geschrieben)
===

The complete file is in the attachment.

Does one have any hints for me?

-Ulf

/*
 * Copyright (c) 2017 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

[FFmpeg-devel] [PATCH]tests/run-sh: Add execsuf to some calls of local tools

2019-04-19 Thread Carl Eugen Hoyos
Hi!

Attached patch is needed here for fate on wsl with msvc, not
sure why I didn't need this with mingw-gcc.

Please comment, Carl Eugen
From 35400d93f9d0a16d275be4c60b8d4ef04cac82f8 Mon Sep 17 00:00:00 2001
From: Carl Eugen Hoyos 
Date: Fri, 19 Apr 2019 13:08:21 +0200
Subject: [PATCH] tests/fate-run: Add execsuf to some calls of local tools.

Allows running fate on wsl with msvc.
---
 tests/fate-run.sh |8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/tests/fate-run.sh b/tests/fate-run.sh
index 56c4efb..73e1c02 100755
--- a/tests/fate-run.sh
+++ b/tests/fate-run.sh
@@ -5,7 +5,7 @@ export LC_ALL=C
 base=$(dirname $0)
 . "${base}/md5.sh"
 
-base64=tests/base64
+base64=tests/base64${EXECSUF}
 
 test="${1#fate-}"
 target_samples=$2
@@ -45,7 +45,7 @@ compare(){
 }
 
 do_tiny_psnr(){
-psnr=$(tests/tiny_psnr "$1" "$2" $cmp_unit $cmp_shift 0) || return 1
+psnr=$(tests/tiny_psnr${EXECSUF} "$1" "$2" $cmp_unit $cmp_shift 0) || return 1
 val=$(expr "$psnr" : ".*$3: *\([0-9.]*\)")
 size1=$(expr "$psnr" : '.*bytes: *\([0-9]*\)')
 size2=$(expr "$psnr" : '.*bytes:[ 0-9]*/ *\([0-9]*\)')
@@ -206,7 +206,7 @@ enc_dec(){
 ffmpeg $8 $DEC_OPTS -i $tencfile $ENC_OPTS $dec_opt $FLAGS \
 -f $dec_fmt -y $tdecfile || return
 do_md5sum $decfile
-tests/tiny_psnr $srcfile $decfile $cmp_unit $cmp_shift
+tests/tiny_psnr${EXECSUF} $srcfile $decfile $cmp_unit $cmp_shift
 }
 
 transcode(){
@@ -455,7 +455,7 @@ audio_match(){
 cleanfiles="$cleanfiles $decfile"
 
 ffmpeg -i "$sample" -bitexact $extra_args -y $decfile
-tests/audiomatch $decfile $trefile
+tests/audiomatch${EXECSUF} $decfile $trefile
 }
 
 concat(){
-- 
1.7.10.4

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

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

Re: [FFmpeg-devel] [PATCH 2/3] avfilter: add audio upsample filter

2019-04-19 Thread Paul B Mahol
On 4/19/19, Gyan  wrote:
>
>
> On 19-04-2019 02:43 PM, Nicolas George wrote:
>> Paul B Mahol (12019-04-19):
>>> Users that know what they are doing will do:
>>>
>>> upsample=4,some additional filtering,alimiter=parameters,some
>>> additional filtering,downsample=4
>> Bad design. We have sample rate negotiation.
>
> How about a filter that can store link and/or frame props as metadata?
> This filter can be inserted before 'processing' filters.
>
> Then Paul's filters, inserted afterwards, can read those meta keys to
> obtain pre-process props.

There are numerous ways how oversampling/undersampling can be done.
This two filters are fundamental blocks of oversampling/undersampling.
The "some additional filtering" can be IIR or FIR lowpass, or FFT where
anything above certain range is set to 0. All mentioned solutions have
same good and bad points.
Implementing this as part of existing filter is not flexible enough
and will limit
us to only some solutions also it needs more lines of code.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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

Re: [FFmpeg-devel] [PATCH 2/3] avfilter: add audio upsample filter

2019-04-19 Thread Gyan



On 19-04-2019 02:43 PM, Nicolas George wrote:

Paul B Mahol (12019-04-19):

Users that know what they are doing will do:

upsample=4,some additional filtering,alimiter=parameters,some
additional filtering,downsample=4

Bad design. We have sample rate negotiation.


How about a filter that can store link and/or frame props as metadata? 
This filter can be inserted before 'processing' filters.


Then Paul's filters, inserted afterwards, can read those meta keys to 
obtain pre-process props.


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

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

Re: [FFmpeg-devel] [PATCH 2/3] avfilter: add audio upsample filter

2019-04-19 Thread Paul B Mahol
On 4/19/19, Nicolas George  wrote:
> Paul B Mahol (12019-04-19):
>> Look, you  are full of shit.
>
> Unacceptable. Excuses expected.

I will ignore your one liners, snarky replies.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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

Re: [FFmpeg-devel] [PATCH 2/3] avfilter: add audio upsample filter

2019-04-19 Thread Nicolas George
Paul B Mahol (12019-04-19):
> Look, you  are full of shit.

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

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

Re: [FFmpeg-devel] [PATCH] avfilter: add lagfun filter

2019-04-19 Thread Paul B Mahol
Hi,

On 4/15/19, Paul B Mahol  wrote:
> Signed-off-by: Paul B Mahol 
> ---
>  doc/filters.texi |  15 +++
>  libavfilter/Makefile |   1 +
>  libavfilter/allfilters.c |   1 +
>  libavfilter/vf_lagfun.c  | 252 +++
>  4 files changed, 269 insertions(+)
>  create mode 100644 libavfilter/vf_lagfun.c

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

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

Re: [FFmpeg-devel] [PATCH 2/3] avfilter: add audio upsample filter

2019-04-19 Thread Paul B Mahol
On 4/19/19, Nicolas George  wrote:
> Paul B Mahol (12019-04-19):
>> This is not about sample rate negotiation.
>
> Yes it is.

Give proof.

No, you need to argue better your pathetic behavior.

>
>> Bad argumentation.
>
> Then argue better.
>
> Patches rejected for now.

Look, you  are full of shit. And know nothing about audio processing.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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

Re: [FFmpeg-devel] [PATCH 2/3] avfilter: add audio upsample filter

2019-04-19 Thread Nicolas George
Paul B Mahol (12019-04-19):
> This is not about sample rate negotiation.

Yes it is.

> Bad argumentation.

Then argue better.

Patches rejected for now.

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

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

Re: [FFmpeg-devel] [PATCH 2/3] avfilter: add audio upsample filter

2019-04-19 Thread Paul B Mahol
On 4/19/19, Nicolas George  wrote:
> Paul B Mahol (12019-04-19):
>> Users that know what they are doing will do:
>>
>> upsample=4,some additional filtering,alimiter=parameters,some
>> additional filtering,downsample=4
>
> Bad design. We have sample rate negotiation.

This is not about sample rate negotiation.

>
>> This is already done by SoX.
>
> We are not SoX.

Bad argumentation.

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

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

Re: [FFmpeg-devel] [PATCH 2/3] avfilter: add audio upsample filter

2019-04-19 Thread Nicolas George
Paul B Mahol (12019-04-19):
> Users that know what they are doing will do:
> 
> upsample=4,some additional filtering,alimiter=parameters,some
> additional filtering,downsample=4

Bad design. We have sample rate negotiation.

> This is already done by SoX.

We are not SoX.

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

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

Re: [FFmpeg-devel] [PATCH 2/3] avfilter: add audio upsample filter

2019-04-19 Thread Paul B Mahol
On 4/19/19, Nicolas George  wrote:
> Paul B Mahol (12019-04-19):
>> This is used as part of other filtering. Namely when filter needs to
>> oversample
>> audio when processing - it then upsample audio before processing and
>> downsample
>> it by same factor after processing it.
>
> How do you intend to implement that? Filters cannot call other filters.

Users that know what they are doing will do:

upsample=4,some additional filtering,alimiter=parameters,some
additional filtering,downsample=4

This is already done by SoX.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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

Re: [FFmpeg-devel] [PATCH 2/3] avfilter: add audio upsample filter

2019-04-19 Thread Nicolas George
Paul B Mahol (12019-04-19):
> This is used as part of other filtering. Namely when filter needs to 
> oversample
> audio when processing - it then upsample audio before processing and 
> downsample
> it by same factor after processing it.

How do you intend to implement that? Filters cannot call other filters.

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

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

Re: [FFmpeg-devel] [PATCH] libavformat: fix copyts and muxrate in mpegts muxer

2019-04-19 Thread Andreas Håkon via ffmpeg-devel
‐‐‐ Original Message ‐‐‐
On Thursday, 18 de April de 2019 11:01, Andreas Håkon via ffmpeg-devel 
 wrote:

> Hi,
>
> This patch resolves one very specific use case:
>
> -   When you use the mpegts muxer;
> -   And use the global parameter “-copyts”;
> -   And use the parameter “-muxrate” for the mpegts muxer;
> -   And use too the parameter “-mpegts_copyts”.
>
> The problem is created because the member “first_pcr” of the MpegTSWrite 
> struct isn’t initialized with a correct timestamp (so when copying the 
> timestamps the initial value is 0). And in this case an infinite loop is 
> created because the code never writes PES packets when the “mux_rate” isn’t 
> VBR (equals to 1). See the block that creates the loop here (note the 
> "continue" command at end):
> 
> https://github.com/FFmpeg/FFmpeg/blob/a0559fcd81f42f446c93357a943699f9d44eeb79/libavformat/mpegtsenc.c#L1211
>
> So, this patch fixes the problem initializing the “first_pcr” with the 
> first DTS value that comes when using the incoming timestamps.
>
> Regards.
> A.H.
>

Hi,

Here a new version of the patch.

The "fist_pcr" value is now derived from DTS in a more consistent way.

Regards,
A.H.


---

From c59569ca9426fef455edabfa648cb2ff678c1640 Mon Sep 17 00:00:00 2001
From: Andreas Hakon 
Date: Fri, 19 Apr 2019 09:32:33 +0100
Subject: [PATCH] libavformat: fix copyts and muxrate in mpegts muxer v2

When using "-copyts" and "-muxrate" with the mpegts muxer the muxing fails
because the member "first_pcr" of the MpegTSWrite struct isn't initialized
with a correct timestamp.

The behaviour of the error is an infinite loop created in the function
mpegts_write_pes() because the code never writes PES packets.

This patch resolves the problem initializing the "first_pcr" with a value
derived from the first DTS value seen.

Signed-off-by: Andreas Hakon 
---
 libavformat/mpegtsenc.c |   10 +-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c
index fc0ea22..858b0d7 100644
--- a/libavformat/mpegtsenc.c
+++ b/libavformat/mpegtsenc.c
@@ -971,6 +971,9 @@ static int mpegts_init(AVFormatContext *s)
 
 if (ts->copyts < 1)
 ts->first_pcr = av_rescale(s->max_delay, PCR_TIME_BASE, 
AV_TIME_BASE);
+else
+ts->first_pcr = AV_NOPTS_VALUE;
+
 } else {
 /* Arbitrary values, PAT/PMT will also be written on video key frames 
*/
 ts->sdt_packet_period = 200;
@@ -1186,12 +1189,16 @@ static void mpegts_write_pes(AVFormatContext *s, 
AVStream *st,
 int64_t pcr = -1; /* avoid warning */
 int64_t delay = av_rescale(s->max_delay, 9, AV_TIME_BASE);
 int force_pat = st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO && key && 
!ts_st->prev_payload_key;
+int last_payload_size = 0;
 
 av_assert0(ts_st->payload != buf || st->codecpar->codec_type != 
AVMEDIA_TYPE_VIDEO);
 if (ts->flags & MPEGTS_FLAG_PAT_PMT_AT_FRAMES && st->codecpar->codec_type 
== AVMEDIA_TYPE_VIDEO) {
 force_pat = 1;
 }
 
+if (ts->mux_rate > 1 && dts != AV_NOPTS_VALUE && ts->first_pcr == 
AV_NOPTS_VALUE)
+ts->first_pcr = (dts * 300) - av_rescale(s->max_delay, PCR_TIME_BASE, 
AV_TIME_BASE);
+
 is_start = 1;
 while (payload_size > 0) {
 retransmit_si_info(s, force_pat, dts);
@@ -1209,12 +1216,13 @@ static void mpegts_write_pes(AVFormatContext *s, 
AVStream *st,
 }
 
 if (ts->mux_rate > 1 && dts != AV_NOPTS_VALUE &&
-(dts - get_pcr(ts, s->pb) / 300) > delay) {
+last_payload_size != payload_size && (dts - get_pcr(ts, s->pb) / 
300) > delay) {
 /* pcr insert gets priority over null packet insert */
 if (write_pcr)
 mpegts_insert_pcr_only(s, st);
 else
 mpegts_insert_null_packet(s);
+last_payload_size = payload_size;
 /* recalculate write_pcr and possibly retransmit si_info */
 continue;
 }
-- 
1.7.10.4

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

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

[FFmpeg-devel] native mode in FFmpeg DNN module

2019-04-19 Thread Guo, Yejun
Hi,

The DNN module currently supports two backends, tensorflow (dnn_backend_tf.c) 
and native(dnn_backend_native.c). The native mode has external dependency, imho 
it's not good and need a change. I think it is still a proper timing for the 
change, for the limited functionality and performance of current native mode.

With current implementation, the native mode involves 3 formats and 3 phases, 
see below.

"Tensorflow model file format (format 1)"  ->convert model (phase 1)->  
 "native model file format (format 2) "   ->load model file into memory 
(phase 2)->   "in memory representation (format 3)"   ->inference the 
model (phase 3)->

We created format 2 and format 3, we write c code for phase 2 and phase 3 
within ffmpeg. The phase 1 is written in python to convert from tensorflow 
model file to native mode file, it is an external dependency at 
https://github.com/HighVoltageRocknRoll/sr. Once we add anything new in the 
model, for example, add a new layer, or even just add the padding option for 
the current Conv layer, we always need to change the external dependency. There 
will be many many times for such change.


I have two options to improve it.
Option 1) 
Use ONNX (https://github.com/onnx/onnx) to replace phase 1, format 2 and format 
3.
Open Neural Network Exchange (ONNX) provides an open source format for AI 
models, and the model files are protobuf pb files

The advantage is that we don't need to worry about phase 1, format 2 and format 
3, but to load the protobuf file into memory (phase 2), google just provides 
C++ support (without c support), while only C is allowed in FFmpeg, we have to 
write our c code in ffmpeg to parse/load the protobuf file.


Option 2)
Write c code in FFmpeg to convert tensorflow file format (format 1) directly 
into memory representation (format 3), and so we controls everything in ffmpeg 
community. And the conversion can be extended to import more file formats such 
as torch, darknet, etc. One example is that OpenCV uses this method.

The in memory representation (format 3) can still be current.


I personally prefer option 2. Anyway, will be glad to see any better options. I 
can continue the contribute on this area once the community decides the 
technical direction.


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

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

Re: [FFmpeg-devel] [PATCH] libavformat: fix inputs initialization in mpegts muxer with filters

2019-04-19 Thread Andreas Håkon via ffmpeg-devel

‐‐‐ Original Message ‐‐‐
On Thursday, 18 de April de 2019 22:07, Michael Niedermayer 
 wrote:

>
> fails to apply cleanly
>
> Applying: libavformat: fix inputs initialization in mpegts muxer with filters
> Using index info to reconstruct a base tree...
> error: patch failed: fftools/ffmpeg.c:4613
> error: fftools/ffmpeg.c: patch does not apply
> error: Did you hand edit your patch?
> It does not apply to blobs recorded in its index.
> Patch failed at 0001 libavformat: fix inputs initialization in mpegts muxer 
> with filters
>

Sorry Michael another time!

Here a new version from a clean copy.

Regards.
A.H.


---
From 936740731c17a9757aa093bdb35d9772df1e64a8 Mon Sep 17 00:00:00 2001
From: Andreas Hakon 
Date: Fri, 19 Apr 2019 09:17:32 +0100
Subject: [PATCH] libavformat: input init mpegts with filters v2

This patch solves the initialization of the inputs when using filters 
(a graph filter) with the mpegts muxer.

This bug seems to be generated by a simple forgetting to copy. The same code is
repeated two times, but only in one case the variable inputs_done is 
initialized.

Testcase:
 $ ffmpeg -f mpegts -i mpeg.ts \ 
   -filter_complex "[i:100]fps=fps=25[out]" \
   -map "[out]" -c:v libx264 -f mpegts out.ts

Signed-off-by: Andreas Hakon 
---
 fftools/ffmpeg.c |4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
index 0f157d6..7399a19 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -4613,8 +4613,10 @@ static int transcode_step(void)
 }
 if ((ret = transcode_from_filter(ost->filter->graph, &ist)) < 0)
 return ret;
-if (!ist)
+if (!ist) {
+ost->inputs_done = 1;
 return 0;
+}
 } else if (ost->filter) {
 int i;
 for (i = 0; i < ost->filter->graph->nb_inputs; i++) {
-- 
1.7.10.4

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

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

Re: [FFmpeg-devel] [PATCH] libavformat: improve logs with cur_dts

2019-04-19 Thread Andreas Håkon via ffmpeg-devel

‐‐‐ Original Message ‐‐‐
On Thursday, 18 de April de 2019 22:13, Michael Niedermayer 
 wrote:

> On Thu, Apr 18, 2019 at 07:46:43AM +, Andreas Håkon via ffmpeg-devel 
> wrote:
>
> > Hi,
> > This is the second part of my previous patch:
> > https://patchwork.ffmpeg.org/patch/12783/
> > It improves the logs when the message "cur_dts is invalid" appears.
> > If helps to identify which stream generates the trouble,
> > and the status of the stream.
> > A lot of users suffers with the message, and the origin varies.
> > The improved message can help to discover the cause.
> > Regards.
> > A.H.
>
>
> "git am" doesnt accept this patch
>
> Applying: libavformat: input init fix mpegts filters
> Using index info to reconstruct a base tree...
> error: patch failed: libavformat/utils.c:1402
> error: libavformat/utils.c: patch does not apply
> error: Did you hand edit your patch?
> It does not apply to blobs recorded in its index.
> Patch failed at 0001 libavformat: input init fix mpegts filters
> hint: Use 'git am --show-current-patch' to see the failed patch
> When you have resolved this problem, run "git am --continue".
> If you prefer to skip this patch, run "git am --skip" instead.
> To restore the original branch and stop patching, run "git am --abort".
>

Sorry Michael!

I re-created the patch with a clean copy.
Here it is.

Regards.
A.H.


---

From 88dd030ddcde04b425bf1896ea6c1a2f263dc2ac Mon Sep 17 00:00:00 2001
From: Andreas Hakon 
Date: Fri, 19 Apr 2019 08:58:37 +0100
Subject: [PATCH] libavformat: improve logs with cur_dts v2

This patch improves the logs when the message "cur_dts is invalid" appears.
If helps to identify which stream generates the trouble,
and the status of the stream.
A lot of users suffers with the message, and the origin varies.
The improved message can help to discover the cause.

Signed-off-by: Andreas Hakon 
---
 fftools/ffmpeg.c|4 +++-
 libavformat/utils.c |4 ++--
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
index 0f157d6..01f0410 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -3875,7 +3875,9 @@ static OutputStream *choose_output(void)
av_rescale_q(ost->st->cur_dts, ost->st->time_base,
 AV_TIME_BASE_Q);
 if (ost->st->cur_dts == AV_NOPTS_VALUE)
-av_log(NULL, AV_LOG_DEBUG, "cur_dts is invalid (this is harmless 
if it occurs once at the start per stream)\n");
+av_log(NULL, AV_LOG_DEBUG,
+"cur_dts is invalid st:%d (%d) [init:%d i_done:%d finish:%d] 
(this is harmless if it occurs once at the start per stream)\n",
+ost->st->index, ost->st->id, ost->initialized, 
ost->inputs_done, ost->finished);
 
 if (!ost->initialized && !ost->inputs_done)
 return ost;
diff --git a/libavformat/utils.c b/libavformat/utils.c
index 9b3f0d2..6ef9423 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -1402,8 +1402,8 @@ static void compute_pkt_fields(AVFormatContext *s, 
AVStream *st,
 st->cur_dts = pkt->dts;
 
 if (s->debug & FF_FDEBUG_TS)
-av_log(s, AV_LOG_DEBUG, "OUTdelayed:%d/%d pts:%s, dts:%s cur_dts:%s\n",
-presentation_delayed, delay, av_ts2str(pkt->pts), 
av_ts2str(pkt->dts), av_ts2str(st->cur_dts));
+av_log(s, AV_LOG_DEBUG, "OUTdelayed:%d/%d pts:%s, dts:%s cur_dts:%s 
st:%d (%d)\n",
+presentation_delayed, delay, av_ts2str(pkt->pts), 
av_ts2str(pkt->dts), av_ts2str(st->cur_dts), st->index, st->id);
 
 /* update flags */
 if (st->codecpar->codec_type == AVMEDIA_TYPE_DATA || 
is_intra_only(st->codecpar->codec_id))
-- 
1.7.10.4

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

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

  1   2   >