Re: [FFmpeg-devel] Forward frame wall clock time from avdevice to HLS muxer

2020-08-26 Thread Jim DeLaHunt

On 2020-08-26 03:29, Jesper Ek wrote:


…I have implemented a libavdevice to capture audio and video from an AJA
Kona card (similar to decklink). I'm then using the HLS muxer to encode my
stream. Now I need the HLS EXT-X-PROGRAM-DATE-TIME tag to specify exactly
when the input source was recorded, so my plan is to forward the "wall
clock time" (from the avdevice implementation) to the hls muxer, and use
that instead of using system time (av_gettime()).


I have a client that would like to have a timestamp in wall-clock time 
of precisely when each frame was recorded (to millisecond accuracy). 
What you are talking about sounds interesting to me. Maybe my client can 
use it.




…I cant use PTS, so what is the correct way to pass "wall clock time"
metadata for every frame to the HLS encoder?


It seems to me that you might be able to use Presentation Time Stamp 
(PTS). What is the obstacle to using PTS?


I believe that the type of PTS in the FFmpeg codebase is `int64_t` 
(signed 64-bit integer), and in the MPEG Transport Stream format stores 
presentation time stamps as unsigned 33-bit values counting ticks of a 
90 kHz Program Clock Reference. If you multiply 90 kHz * 60 secs/min * 
60 mins/hr * 24 hr/day, there are 7,776,000,000 PCR ticks in 24 hours. 
That fits in a 33-bit unsigned int. And it certainly fits in a signed 
64-bit int. So, it seems like your libavdevice could assign PTS values 
which correspond to the time of day when each frame was captured. There 
is a fighting chance that this value would survive recording in an MPEG 
transport stream, and processing by FFmpeg. (But, I've not actually done 
this myself, so I don't know.)




…I noticed that the decklink implementation uses
`av_packet_add_side_data(&pkt, AV_PKT_DATA_STRINGS_METADATA, ...)` to add
timecode information, is this the correct approach?



Earlier this year, there were patches[3] which aimed to put linear 
timecodes in a format related to SMPTE 12M into a structure marked by a 
`AV_FRAME_DATA_S12M_TIMECODE` value. Maybe that refers to a location 
where you could store timecode values. You might want to search for that 
identifier, and for patches by that developer. I don't know if they have 
been added to the FFmpeg source yet.


SMPTE 12M refers to a linear timecode format[3]. I understand that this 
document has been split into three, and they are now named:


ST 12-1:2014 - SMPTE Standard - Time and Control Code
ST 12-2:2014 - SMPTE Standard - Transmission of Time Code in the 
Ancillary Data Space
ST 12-3:2016 - SMPTE Standard - Time Code for High Frame Rate Signals 
and Formatting in the Ancillary Data Space


They are available for free download from the SMPTE web site[4] until 31 
Dec 2020 (extended from 21 July 2020). You might want to get them now, 
for future reference.


Please do update this list on what you do. I for one would like to take 
a look at it.


Best regards,
 —Jim DeLaHunt, software engineer, Vancouver, Canada

[1] https://en.wikipedia.org/wiki/MPEG_transport_stream#PCR
[2] http://ffmpeg.org/pipermail/ffmpeg-devel/2020-July/265628.html
[3] https://en.wikipedia.org/wiki/SMPTE_timecode
[4] https://www.smpte.org/free-standards-and-publications



___
ffmpeg-devel mailing list
ffmpeg-devel@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 v8 2/5] lavc/avs3: add AVS3 related definitions

2020-08-26 Thread hwrenx
From: hwren 

Signed-off-by: hwren 
---
 libavcodec/Makefile |  2 +
 libavcodec/avs3.c   | 95 +
 libavcodec/avs3.h   | 52 +
 3 files changed, 149 insertions(+)
 create mode 100644 libavcodec/avs3.c
 create mode 100644 libavcodec/avs3.h

diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 3431ba2dca..e1e0c4629d 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -6,6 +6,7 @@ HEADERS = ac3_parser.h  
\
   avcodec.h \
   avdct.h   \
   avfft.h   \
+  avs3.h\
   bsf.h \
   codec.h   \
   codec_desc.h  \
@@ -32,6 +33,7 @@ OBJS = ac3_parser.o   
  \
avdct.o  \
avpacket.o   \
avpicture.o  \
+   avs3.o   \
bitstream.o  \
bitstream_filter.o   \
bitstream_filters.o  \
diff --git a/libavcodec/avs3.c b/libavcodec/avs3.c
new file mode 100644
index 00..411a6c39a0
--- /dev/null
+++ b/libavcodec/avs3.c
@@ -0,0 +1,95 @@
+/*
+ * AVS3 related definitions
+ *
+ * Copyright (C) 2020 Huiwen Ren, 
+ *
+ * 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 "avs3.h"
+
+const AVRational ff_avs3_frame_rate_tab[16] = {
+{ 0, 0   }, // forbid
+{ 24000, 1001},
+{ 24   , 1   },
+{ 25   , 1   },
+{ 3, 1001},
+{ 30   , 1   },
+{ 50   , 1   },
+{ 6, 1001},
+{ 60   , 1   },
+{ 100  , 1   },
+{ 120  , 1   },
+{ 200  , 1   },
+{ 240  , 1   },
+{ 300  , 1   },
+{ 0, 0   }, // reserved
+{ 0, 0   }  // reserved
+};
+
+const int ff_avs3_color_primaries_tab[10] = {
+AVCOL_PRI_RESERVED0   ,// 0
+AVCOL_PRI_BT709   ,// 1
+AVCOL_PRI_UNSPECIFIED ,// 2
+AVCOL_PRI_RESERVED,// 3
+AVCOL_PRI_BT470M  ,// 4
+AVCOL_PRI_BT470BG ,// 5
+AVCOL_PRI_SMPTE170M   ,// 6
+AVCOL_PRI_SMPTE240M   ,// 7
+AVCOL_PRI_FILM,// 8
+AVCOL_PRI_BT2020   // 9
+};
+
+const int ff_avs3_color_transfer_tab[15] = {
+AVCOL_TRC_RESERVED0, // 0
+AVCOL_TRC_BT709, // 1
+AVCOL_TRC_UNSPECIFIED  , // 2
+AVCOL_TRC_RESERVED , // 3
+AVCOL_TRC_GAMMA22  , // 4
+AVCOL_TRC_GAMMA28  , // 5
+AVCOL_TRC_SMPTE170M, // 6
+AVCOL_TRC_SMPTE240M, // 7
+AVCOL_TRC_LINEAR   , // 8
+AVCOL_TRC_LOG  , // 9
+AVCOL_TRC_LOG_SQRT , // 10
+AVCOL_TRC_BT2020_12, // 11
+AVCOL_TRC_SMPTE2084, // 12
+AVCOL_TRC_UNSPECIFIED  , // 13
+AVCOL_TRC_ARIB_STD_B67   // 14
+};
+
+const int ff_avs3_color_matrix_tab[12] = {
+AVCOL_SPC_RESERVED , // 0
+AVCOL_SPC_BT709, // 1
+AVCOL_SPC_UNSPECIFIED  , // 2
+AVCOL_SPC_RESERVED , // 3
+AVCOL_SPC_FCC  , // 4
+AVCOL_SPC_BT470BG  , // 5
+AVCOL_SPC_SMPTE170M, // 6
+AVCOL_SPC_SMPTE240M, // 7
+AVCOL_SPC_BT2020_NCL   , // 8
+AVCOL_SPC_BT2020_CL, // 9
+AVCOL_SPC_UNSPECIFIED  , // 10
+AVCOL_SPC_UNSPECIFIED// 11
+};
+
+const enum AVPictureType ff_avs3_image_type[4] = {
+AV_PICTURE_TYPE_NONE,
+AV_PICTURE_TYPE_I,
+AV_PICTURE_TYPE_P,
+AV_PICTURE_TYPE_B
+};
diff --git a/libavcodec/avs3.h b/libavcodec/avs3.h
new file mode 100644
index 00..8653e7c476
--- /dev/null
+++ b/libavcodec/avs3.h
@@ -0,0 +1,52 @@
+/*
+ *  AVS3 related definitions
+ *
+ * Copyright (C) 2020 Huiwen Ren, 

[FFmpeg-devel] [PATCH v8 0/5] Supplement AVS3-P2/IEEE1857.10 video decoding via libuavs3d

2020-08-26 Thread hwrenx
From: hwren 

*** Latest changes ***

Pickup missing changes from previous version.


*** Historical  changes ***
=== Version1 ===
These patches are to supplement the third generation of Audio Video Coding 
Standard,
part 2: video (AVS3-P2), aka IEEE1857.10, decoding support via libuavs3d 
wrapper.

The uAVS3d decoder could be found in https://github.com/uavs3/uavs3d
AVS3 sample streams could be found in https://github.com/uavs3/avs3stream

=== Version 2 ===
Fix conflict with CAVS streams. Considering that there is no direct version 
flag in AVS.
AVS3 demuxer only supports raw streams in format <*.avs3>.

Fix API function conflict.

=== Version 3 ===
Rename parameter names that may be confused with AVS2
Reorder header files.

=== Version 4 ===
Add avs3_parser.h for some reusable definitions in AVS3
Refine avs3_parser.c and libuavs3d.c
Fix some vague definitions and potential risks

=== Version 5 ===
Fix the wrong codec order in lavc/codec_desc.c
Use additional lavc/avs3.h and lavc/avs3.c for common definitions
Remove redundant description in the long name of libuavs3d.
Update iteration information in lavf/version.h and lavc/version.h.

=== Version 6 ===
Fix incorrect code style problems.
Remove confused comments.
Add missing demuxer entry in Changelog.
Add value check in lavc/libuavs3d.c

=== Version 7 ===
Supplement information in dec_frame, including pkt_pos, pkt_size, 
coded_picture_number
and display_picture_number.

Thanks.

hwren (5):
  lavc: add AVS3 codec id and desc
  lavc/avs3: add AVS3 related definitions
  lavc/avs3_parser: add avs3 parser
  lavf/avs3dec: add raw avs3 demuxer
  lavc,doc: add libuavs3d video decoder wrapper

 Changelog|   2 +
 configure|   4 +
 doc/decoders.texi|  21 
 doc/general.texi |   8 ++
 libavcodec/Makefile  |   4 +
 libavcodec/allcodecs.c   |   1 +
 libavcodec/avs3.c|  95 ++
 libavcodec/avs3.h|  52 
 libavcodec/avs3_parser.c | 179 ++
 libavcodec/codec_desc.c  |   7 ++
 libavcodec/codec_id.h|   1 +
 libavcodec/libuavs3d.c   | 262 +++
 libavcodec/parsers.c |   1 +
 libavcodec/version.h |   2 +-
 libavformat/Makefile |   1 +
 libavformat/allformats.c |   1 +
 libavformat/avs3dec.c|  68 ++
 libavformat/version.h|   2 +-
 18 files changed, 709 insertions(+), 2 deletions(-)
 create mode 100644 libavcodec/avs3.c
 create mode 100644 libavcodec/avs3.h
 create mode 100644 libavcodec/avs3_parser.c
 create mode 100644 libavcodec/libuavs3d.c
 create mode 100644 libavformat/avs3dec.c

-- 
2.23.0.windows.1

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

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

[FFmpeg-devel] [PATCH v8 3/5] lavc/avs3_parser: add avs3 parser

2020-08-26 Thread hwrenx
From: hwren 

Signed-off-by: hbj 
Signed-off-by: hwren 
---
 libavcodec/Makefile  |   1 +
 libavcodec/avs3_parser.c | 179 +++
 libavcodec/parsers.c |   1 +
 3 files changed, 181 insertions(+)
 create mode 100644 libavcodec/avs3_parser.c

diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index e1e0c4629d..4c596515ee 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -1061,6 +1061,7 @@ OBJS-$(CONFIG_AC3_PARSER)  += ac3tab.o 
aac_ac3_parser.o
 OBJS-$(CONFIG_ADX_PARSER)  += adx_parser.o adx.o
 OBJS-$(CONFIG_AV1_PARSER)  += av1_parser.o av1_parse.o
 OBJS-$(CONFIG_AVS2_PARSER) += avs2_parser.o
+OBJS-$(CONFIG_AVS3_PARSER) += avs3_parser.o
 OBJS-$(CONFIG_BMP_PARSER)  += bmp_parser.o
 OBJS-$(CONFIG_CAVSVIDEO_PARSER)+= cavs_parser.o
 OBJS-$(CONFIG_COOK_PARSER) += cook_parser.o
diff --git a/libavcodec/avs3_parser.c b/libavcodec/avs3_parser.c
new file mode 100644
index 00..bf97f75db6
--- /dev/null
+++ b/libavcodec/avs3_parser.c
@@ -0,0 +1,179 @@
+/*
+ * AVS3-P2/IEEE1857.10 video parser.
+ * Copyright (c) 2020 Zhenyu Wang 
+ *Bingjie Han 
+ *Huiwen Ren  
+ *
+ * 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 "avs3.h"
+#include "get_bits.h"
+#include "parser.h"
+
+static int avs3_find_frame_end(ParseContext *pc, const uint8_t *buf, int 
buf_size)
+{
+int pic_found  = pc->frame_start_found;
+uint32_t state = pc->state;
+int cur = 0;
+
+if (!pic_found) {
+for (; cur < buf_size; ++cur) {
+state = (state << 8) | buf[cur];
+if (AVS3_ISPIC(buf[cur])){
+cur++;
+pic_found = 1;
+break;
+}
+}
+}
+
+if (pic_found) {
+if (!buf_size)
+return END_NOT_FOUND;
+for (; cur < buf_size; ++cur) {
+state = (state << 8) | buf[cur];
+if ((state & 0xFF00) == 0x100 && AVS3_ISUNIT(state & 0xFF)) {
+pc->frame_start_found = 0;
+pc->state = -1;
+return cur - 3;
+}
+}
+}
+
+pc->frame_start_found = pic_found;
+pc->state = state;
+
+return END_NOT_FOUND;
+}
+
+static void parse_avs3_nal_units(AVCodecParserContext *s, const uint8_t *buf,
+   int buf_size, AVCodecContext *avctx)
+{
+if (buf_size < 5) {
+return;
+}
+
+if (buf[0] == 0x0 && buf[1] == 0x0 && buf[2] == 0x1) {
+if (buf[3] == AVS3_SEQ_START_CODE) {
+GetBitContext gb;
+int profile, ratecode;
+
+init_get_bits(&gb, buf + 4, buf_size - 4);
+
+s->key_frame = 1;
+s->pict_type = AV_PICTURE_TYPE_I;
+
+profile = get_bits(&gb, 8);
+// Skip bits: level(8)
+//progressive(1)
+//field(1)
+//library(2)
+//resv(1)
+//width(14)
+//resv(1)
+//height(14)
+//chroma(2)
+//sampe_precision(3)
+skip_bits(&gb, 47);
+
+if (profile == AVS3_PROFILE_BASELINE_MAIN10) {
+int sample_precision = get_bits(&gb, 3);
+if (sample_precision == 1) {
+avctx->pix_fmt = AV_PIX_FMT_YUV420P;
+} else if (sample_precision == 2) {
+avctx->pix_fmt = AV_PIX_FMT_YUV420P10LE;
+} else {
+avctx->pix_fmt = AV_PIX_FMT_NONE;
+}
+}
+
+// Skip bits: resv(1)
+//aspect(4)
+skip_bits(&gb, 5);
+
+ratecode = get_bits(&gb, 4);
+
+// Skip bits: resv(1)
+//bitrate_low(18)
+//resv(1)
+//bitrate_high(12)
+skip_bits(&gb, 32);
+
+avctx->has_b_frames = !get_bits(&gb, 1);
+
+avctx->framerate.num = avctx->time_base.den = 
ff_avs3_frame_rate_tab[ratecode].num;
+avctx->framerate.den = 

[FFmpeg-devel] [PATCH v8 4/5] lavf/avs3dec: add raw avs3 demuxer

2020-08-26 Thread hwrenx
From: hwren 

Signed-off-by: hbj 
Signed-off-by: hwren 
---
 Changelog|  1 +
 libavformat/Makefile |  1 +
 libavformat/allformats.c |  1 +
 libavformat/avs3dec.c| 68 
 libavformat/version.h|  2 +-
 5 files changed, 72 insertions(+), 1 deletion(-)
 create mode 100644 libavformat/avs3dec.c

diff --git a/Changelog b/Changelog
index 1efc768387..f70ed4927a 100644
--- a/Changelog
+++ b/Changelog
@@ -14,6 +14,7 @@ version :
 - ADPCM Argonaut Games encoder
 - Argonaut Games ASF muxer
 - AV1 Low overhead bitstream format demuxer
+- AVS3 bitstream format demuxer
 
 
 version 4.3:
diff --git a/libavformat/Makefile b/libavformat/Makefile
index cbb33fe37c..8ddab3aee5 100644
--- a/libavformat/Makefile
+++ b/libavformat/Makefile
@@ -122,6 +122,7 @@ OBJS-$(CONFIG_AVR_DEMUXER)   += avr.o pcm.o
 OBJS-$(CONFIG_AVS_DEMUXER)   += avs.o voc_packet.o vocdec.o voc.o
 OBJS-$(CONFIG_AVS2_DEMUXER)  += davs2.o rawdec.o
 OBJS-$(CONFIG_AVS2_MUXER)+= rawenc.o
+OBJS-$(CONFIG_AVS3_DEMUXER)  += avs3dec.o rawdec.o
 OBJS-$(CONFIG_BETHSOFTVID_DEMUXER)   += bethsoftvid.o
 OBJS-$(CONFIG_BFI_DEMUXER)   += bfi.o
 OBJS-$(CONFIG_BINK_DEMUXER)  += bink.o
diff --git a/libavformat/allformats.c b/libavformat/allformats.c
index 0aa9dd7198..7f41c12d7c 100644
--- a/libavformat/allformats.c
+++ b/libavformat/allformats.c
@@ -84,6 +84,7 @@ extern AVInputFormat  ff_avr_demuxer;
 extern AVInputFormat  ff_avs_demuxer;
 extern AVInputFormat  ff_avs2_demuxer;
 extern AVOutputFormat ff_avs2_muxer;
+extern AVInputFormat  ff_avs3_demuxer;
 extern AVInputFormat  ff_bethsoftvid_demuxer;
 extern AVInputFormat  ff_bfi_demuxer;
 extern AVInputFormat  ff_bintext_demuxer;
diff --git a/libavformat/avs3dec.c b/libavformat/avs3dec.c
new file mode 100644
index 00..a85f6f6c0b
--- /dev/null
+++ b/libavformat/avs3dec.c
@@ -0,0 +1,68 @@
+/*
+ * RAW AVS3-P2/IEEE1857.10 video demuxer
+ * Copyright (c) 2020 Zhenyu Wang 
+ *Bingjie Han 
+ *Huiwen Ren  
+ *
+ * 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 "libavcodec/avs3.h"
+#include "libavcodec/internal.h"
+#include "avformat.h"
+#include "rawdec.h"
+
+static int avs3video_probe(const AVProbeData *p)
+{
+const uint8_t *ptr = p->buf, *end = p->buf + p->buf_size;
+uint32_t code = -1;
+uint8_t state = 0;
+int pic = 0, seq = 0, slice_pos = 0;
+int ret = 0;
+
+while (ptr < end) {
+ptr = avpriv_find_start_code(ptr, end, &code);
+state = code & 0xFF;
+if ((code & 0xFF00) == 0x100) {
+if (state < AVS3_SEQ_START_CODE) {
+if (code < slice_pos)
+return 0;
+slice_pos = code;
+} else {
+slice_pos = 0;
+}
+if (state == AVS3_SEQ_START_CODE) {
+seq++;
+if (*ptr != AVS3_PROFILE_BASELINE_MAIN && *ptr != 
AVS3_PROFILE_BASELINE_MAIN10)
+return 0;
+} else if (AVS3_ISPIC(state)) {
+pic++;
+} else if ((state == AVS3_UNDEF_START_CODE) ||
+   (state > AVS3_VIDEO_EDIT_CODE)) {
+return 0;
+}
+}
+}
+
+if (seq && pic && av_match_ext(p->filename, "avs3")) {
+ret = AVPROBE_SCORE_MAX;
+}
+
+return ret;
+}
+
+FF_DEF_RAWVIDEO_DEMUXER(avs3, "raw AVS3-P2/IEEE1857.10", avs3video_probe, 
"avs3", AV_CODEC_ID_AVS3)
\ No newline at end of file
diff --git a/libavformat/version.h b/libavformat/version.h
index aa309ecc77..146db09d1b 100644
--- a/libavformat/version.h
+++ b/libavformat/version.h
@@ -32,7 +32,7 @@
 // Major bumping may affect Ticket5467, 5421, 5451(compatibility with Chromium)
 // Also please add any ticket numbers that you believe might be affected here
 #define LIBAVFORMAT_VERSION_MAJOR  58
-#define LIBAVFORMAT_VERSION_MINOR  51
+#define LIBAVFORMAT_VERSION_MINOR  52
 #define LIBAVFORMAT_VERSION_MICRO 100
 
 #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
-- 
2.23.0.windows.1

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.

[FFmpeg-devel] [PATCH v8 5/5] lavc, doc: add libuavs3d video decoder wrapper

2020-08-26 Thread hwrenx
From: hwren 

Signed-off-by: hbj 
Signed-off-by: hwren 
---
 Changelog  |   1 +
 configure  |   4 +
 doc/decoders.texi  |  21 
 doc/general.texi   |   8 ++
 libavcodec/Makefile|   1 +
 libavcodec/allcodecs.c |   1 +
 libavcodec/libuavs3d.c | 262 +
 libavcodec/version.h   |   2 +-
 8 files changed, 299 insertions(+), 1 deletion(-)
 create mode 100644 libavcodec/libuavs3d.c

diff --git a/Changelog b/Changelog
index f70ed4927a..a0e171d496 100644
--- a/Changelog
+++ b/Changelog
@@ -15,6 +15,7 @@ version :
 - Argonaut Games ASF muxer
 - AV1 Low overhead bitstream format demuxer
 - AVS3 bitstream format demuxer
+- AVS3 video decoder via libuavs3d
 
 
 version 4.3:
diff --git a/configure b/configure
index 6faff9bc7b..0fde821742 100755
--- a/configure
+++ b/configure
@@ -277,6 +277,7 @@ External library support:
   --enable-libtls  enable LibreSSL (via libtls), needed for https 
support
if openssl, gnutls or mbedtls is not used [no]
   --enable-libtwolame  enable MP2 encoding via libtwolame [no]
+  --enable-libuavs3d   enable AVS3 decoding via libuavs3d [no]
   --enable-libv4l2 enable libv4l2/v4l-utils [no]
   --enable-libvidstab  enable video stabilization using vid.stab [no]
   --enable-libvmaf enable vmaf filter via libvmaf [no]
@@ -1811,6 +1812,7 @@ EXTERNAL_LIBRARY_LIST="
 libtesseract
 libtheora
 libtwolame
+libuavs3d
 libv4l2
 libvmaf
 libvorbis
@@ -3253,6 +3255,7 @@ libspeex_encoder_select="audio_frame_queue"
 libsvtav1_encoder_deps="libsvtav1"
 libtheora_encoder_deps="libtheora"
 libtwolame_encoder_deps="libtwolame"
+libuavs3d_decoder_deps="libuavs3d"
 libvo_amrwbenc_encoder_deps="libvo_amrwbenc"
 libvorbis_decoder_deps="libvorbis"
 libvorbis_encoder_deps="libvorbis libvorbisenc"
@@ -6416,6 +6419,7 @@ enabled libtls&& require_pkg_config libtls 
libtls tls.h tls_configur
 enabled libtwolame&& require libtwolame twolame.h twolame_init 
-ltwolame &&
  { check_lib libtwolame twolame.h 
twolame_encode_buffer_float32_interleaved -ltwolame ||
die "ERROR: libtwolame must be installed and 
version must be >= 0.3.10"; }
+enabled libuavs3d && require_pkg_config libuavs3d "uavs3d >= 1.1.41" 
uavs3d.h uavs3d_decode
 enabled libv4l2   && require_pkg_config libv4l2 libv4l2 libv4l2.h 
v4l2_ioctl
 enabled libvidstab&& require_pkg_config libvidstab "vidstab >= 0.98" 
vid.stab/libvidstab.h vsMotionDetectInit
 enabled libvmaf   && require_pkg_config libvmaf "libvmaf >= 1.5.2" 
libvmaf.h compute_vmaf
diff --git a/doc/decoders.texi b/doc/decoders.texi
index 9005714e3c..42b46fe153 100644
--- a/doc/decoders.texi
+++ b/doc/decoders.texi
@@ -88,6 +88,27 @@ This decoder allows libavcodec to decode AVS2 streams with 
davs2 library.
 
 @c man end VIDEO DECODERS
 
+@section libuavs3d
+
+AVS3-P2/IEEE1857.10 video decoder.
+
+libuavs3d allows libavcodec to decode AVS3 streams.
+Requires the presence of the libuavs3d headers and library during 
configuration.
+You need to explicitly configure the build with @code{--enable-libuavs3d}.
+
+@subsection Options
+
+The following option is supported by the libuavs3d wrapper.
+
+@table @option
+
+@item frame_threads
+Set amount of frame threads to use during decoding. The default value is 0 
(autodetect).
+
+@end table
+
+@c man end VIDEO DECODERS
+
 @chapter Audio Decoders
 @c man begin AUDIO DECODERS
 
diff --git a/doc/general.texi b/doc/general.texi
index fac5377504..233f69d349 100644
--- a/doc/general.texi
+++ b/doc/general.texi
@@ -125,6 +125,14 @@ Go to @url{https://github.com/pkuvcl/davs2} and follow the 
instructions for
 installing the library. Then pass @code{--enable-libdavs2} to configure to
 enable it.
 
+@section uavs3d
+
+FFmpeg can make use of the uavs3d library for AVS3-P2/IEEE1857.10 video 
decoding.
+
+Go to @url{https://github.com/uavs3/uavs3d} and follow the instructions for
+installing the library. Then pass @code{--enable-libuavs3d} to configure to
+enable it.
+
 @float NOTE
 libdavs2 is under the GNU Public License Version 2 or later
 (see @url{http://www.gnu.org/licenses/old-licenses/gpl-2.0.html} for
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 4c596515ee..5654b3 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -1034,6 +1034,7 @@ OBJS-$(CONFIG_LIBSPEEX_ENCODER)   += libspeexenc.o
 OBJS-$(CONFIG_LIBSVTAV1_ENCODER)  += libsvtav1.o
 OBJS-$(CONFIG_LIBTHEORA_ENCODER)  += libtheoraenc.o
 OBJS-$(CONFIG_LIBTWOLAME_ENCODER) += libtwolame.o
+OBJS-$(CONFIG_LIBUAVS3D_DECODER)  += libuavs3d.o
 OBJS-$(CONFIG_LIBVO_AMRWBENC_ENCODER) += libvo-amrwbenc.o
 OBJS-$(CONFIG_LIBVORBIS_DECODER)  += libvorbisdec.o
 OBJS-$(CONFIG_LIBVORBIS_ENCODER)  += libvorbisenc.o \
diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodec

[FFmpeg-devel] [PATCH v8 1/5] lavc: add AVS3 codec id and desc

2020-08-26 Thread hwrenx
From: hwren 

Signed-off-by: hbj 
Signed-off-by: hwren 
---
 libavcodec/codec_desc.c | 7 +++
 libavcodec/codec_id.h   | 1 +
 2 files changed, 8 insertions(+)

diff --git a/libavcodec/codec_desc.c b/libavcodec/codec_desc.c
index 0ae6aee63b..61473178fc 100644
--- a/libavcodec/codec_desc.c
+++ b/libavcodec/codec_desc.c
@@ -1412,6 +1412,13 @@ static const AVCodecDescriptor codec_descriptors[] = {
 .long_name = NULL_IF_CONFIG_SMALL("PGX (JPEG2000 Test Format)"),
 .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS,
 },
+{
+.id= AV_CODEC_ID_AVS3,
+.type  = AVMEDIA_TYPE_VIDEO,
+.name  = "avs3",
+.long_name = NULL_IF_CONFIG_SMALL("AVS3-P2/IEEE1857.10"),
+.props = AV_CODEC_PROP_LOSSY,
+},
 {
 .id= AV_CODEC_ID_Y41P,
 .type  = AVMEDIA_TYPE_VIDEO,
diff --git a/libavcodec/codec_id.h b/libavcodec/codec_id.h
index 896ecb0ce0..47aa0787b6 100644
--- a/libavcodec/codec_id.h
+++ b/libavcodec/codec_id.h
@@ -242,6 +242,7 @@ enum AVCodecID {
 AV_CODEC_ID_RSCC,
 AV_CODEC_ID_AVS2,
 AV_CODEC_ID_PGX,
+AV_CODEC_ID_AVS3,
 
 AV_CODEC_ID_Y41P = 0x8000,
 AV_CODEC_ID_AVRP,
-- 
2.23.0.windows.1

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

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

[FFmpeg-devel] [PATCH 1/2] dnn/openvino: add log error message

2020-08-26 Thread Ting Fu
Signed-off-by: Ting Fu 
---
 libavfilter/dnn/dnn_backend_openvino.c | 51 ++
 1 file changed, 43 insertions(+), 8 deletions(-)

diff --git a/libavfilter/dnn/dnn_backend_openvino.c 
b/libavfilter/dnn/dnn_backend_openvino.c
index 034dee1839..5d6d3ed542 100644
--- a/libavfilter/dnn/dnn_backend_openvino.c
+++ b/libavfilter/dnn/dnn_backend_openvino.c
@@ -28,7 +28,12 @@
 #include "libavutil/avassert.h"
 #include 
 
+typedef struct OVContext {
+const AVClass *class;
+} OVContext;
+
 typedef struct OVModel{
+OVContext ctx;
 ie_core_t *core;
 ie_network_t *network;
 ie_executable_network_t *exe_network;
@@ -36,6 +41,14 @@ typedef struct OVModel{
 ie_blob_t *input_blob;
 } OVModel;
 
+static const AVClass dnn_openvino_class = {
+.class_name = "dnn_openvino",
+.item_name  = av_default_item_name,
+.option = NULL,
+.version= LIBAVUTIL_VERSION_INT,
+.category   = AV_CLASS_CATEGORY_FILTER,
+};
+
 static DNNDataType precision_to_datatype(precision_e precision)
 {
 switch (precision)
@@ -51,6 +64,7 @@ static DNNDataType precision_to_datatype(precision_e 
precision)
 static DNNReturnType get_input_ov(void *model, DNNData *input, const char 
*input_name)
 {
 OVModel *ov_model = (OVModel *)model;
+OVContext *ctx = &ov_model->ctx;
 char *model_input_name = NULL;
 IEStatusCode status;
 size_t model_input_count = 0;
@@ -58,25 +72,33 @@ static DNNReturnType get_input_ov(void *model, DNNData 
*input, const char *input
 precision_e precision;
 
 status = ie_network_get_inputs_number(ov_model->network, 
&model_input_count);
-if (status != OK)
+if (status != OK) {
+av_log(ctx, AV_LOG_ERROR, "Failed to get input count\n");
 return DNN_ERROR;
+}
 
 for (size_t i = 0; i < model_input_count; i++) {
 status = ie_network_get_input_name(ov_model->network, i, 
&model_input_name);
-if (status != OK)
+if (status != OK) {
+av_log(ctx, AV_LOG_ERROR, "Failed to get No.%d input's name\n", 
(int)i);
 return DNN_ERROR;
+}
 if (strcmp(model_input_name, input_name) == 0) {
 ie_network_name_free(&model_input_name);
 status |= ie_network_get_input_dims(ov_model->network, input_name, 
&dims);
 status |= ie_network_get_input_precision(ov_model->network, 
input_name, &precision);
-if (status != OK)
+if (status != OK) {
+av_log(ctx, AV_LOG_ERROR, "Failed to get No.%d input's dims or 
precision\n", (int)i);
 return DNN_ERROR;
+}
 
 // The order of dims in the openvino is fixed and it is always 
NCHW for 4-D data.
 // while we pass NHWC data from FFmpeg to openvino
 status = ie_network_set_input_layout(ov_model->network, 
input_name, NHWC);
-if (status != OK)
+if (status != OK) {
+av_log(ctx, AV_LOG_ERROR, "Input \"%s\" does not match layout 
NHWC\n", input_name);
 return DNN_ERROR;
+}
 
 input->channels = dims.dims[1];
 input->height   = dims.dims[2];
@@ -88,12 +110,14 @@ static DNNReturnType get_input_ov(void *model, DNNData 
*input, const char *input
 ie_network_name_free(&model_input_name);
 }
 
+av_log(ctx, AV_LOG_ERROR, "Could not find \"%s\" in model\n", 
model_input_name);
 return DNN_ERROR;
 }
 
 static DNNReturnType set_input_ov(void *model, DNNData *input, const char 
*input_name)
 {
 OVModel *ov_model = (OVModel *)model;
+OVContext *ctx = &ov_model->ctx;
 IEStatusCode status;
 dimensions_t dims;
 precision_e precision;
@@ -129,6 +153,7 @@ err:
 ie_blob_free(&ov_model->input_blob);
 if (ov_model->infer_request)
 ie_infer_request_free(&ov_model->infer_request);
+av_log(ctx, AV_LOG_ERROR, "Failed to create inference instance or get 
input data/dims/precision/memory\n");
 return DNN_ERROR;
 }
 
@@ -147,6 +172,7 @@ DNNModel *ff_dnn_load_model_ov(const char *model_filename, 
const char *options)
 ov_model = av_mallocz(sizeof(OVModel));
 if (!ov_model)
 goto err;
+ov_model->ctx.class = &dnn_openvino_class;
 
 status = ie_core_create("", &ov_model->core);
 if (status != OK)
@@ -188,25 +214,34 @@ DNNReturnType ff_dnn_execute_model_ov(const DNNModel 
*model, DNNData *outputs, c
 precision_e precision;
 ie_blob_buffer_t blob_buffer;
 OVModel *ov_model = (OVModel *)model->model;
+OVContext *ctx = &ov_model->ctx;
 IEStatusCode status = ie_infer_request_infer(ov_model->infer_request);
-if (status != OK)
+if (status != OK) {
+av_log(ctx, AV_LOG_ERROR, "Failed to start synchronous model 
inference\n");
 return DNN_ERROR;
+}
 
 for (uint32_t i = 0; i < nb_output; ++i) {
 const char *output_name = output_names[i];
 ie_blob_t *output_blob = NULL;
 status = ie_infer_reque

[FFmpeg-devel] [PATCH 2/2] dnn/tensorflow: add log error message

2020-08-26 Thread Ting Fu
Signed-off-by: Ting Fu 
---
 libavfilter/dnn/dnn_backend_tf.c | 59 ++--
 1 file changed, 57 insertions(+), 2 deletions(-)

diff --git a/libavfilter/dnn/dnn_backend_tf.c b/libavfilter/dnn/dnn_backend_tf.c
index bdc90d5063..5e7f37bb12 100644
--- a/libavfilter/dnn/dnn_backend_tf.c
+++ b/libavfilter/dnn/dnn_backend_tf.c
@@ -34,7 +34,12 @@
 
 #include 
 
+typedef struct TFContext {
+const AVClass *class;
+} TFContext;
+
 typedef struct TFModel{
+TFContext ctx;
 TF_Graph *graph;
 TF_Session *session;
 TF_Status *status;
@@ -44,6 +49,14 @@ typedef struct TFModel{
 uint32_t nb_output;
 } TFModel;
 
+static const AVClass dnn_tensorflow_class = {
+.class_name = "dnn_tensorflow",
+.item_name  = av_default_item_name,
+.option = NULL,
+.version= LIBAVUTIL_VERSION_INT,
+.category   = AV_CLASS_CATEGORY_FILTER,
+};
+
 static void free_buffer(void *data, size_t length)
 {
 av_freep(&data);
@@ -107,13 +120,16 @@ static TF_Tensor *allocate_input_tensor(const DNNData 
*input)
 static DNNReturnType get_input_tf(void *model, DNNData *input, const char 
*input_name)
 {
 TFModel *tf_model = (TFModel *)model;
+TFContext *ctx = &tf_model->ctx;
 TF_Status *status;
 int64_t dims[4];
 
 TF_Output tf_output;
 tf_output.oper = TF_GraphOperationByName(tf_model->graph, input_name);
-if (!tf_output.oper)
+if (!tf_output.oper) {
+av_log(ctx, AV_LOG_ERROR, "Could not find \"%s\" in model\n", 
input_name);
 return DNN_ERROR;
+}
 
 tf_output.index = 0;
 input->dt = TF_OperationOutputType(tf_output);
@@ -122,6 +138,7 @@ static DNNReturnType get_input_tf(void *model, DNNData 
*input, const char *input
 TF_GraphGetTensorShape(tf_model->graph, tf_output, dims, 4, status);
 if (TF_GetCode(status) != TF_OK){
 TF_DeleteStatus(status);
+av_log(ctx, AV_LOG_ERROR, "Failed to get input tensor shape: number of 
dimension incorrect\n");
 return DNN_ERROR;
 }
 TF_DeleteStatus(status);
@@ -138,12 +155,14 @@ static DNNReturnType get_input_tf(void *model, DNNData 
*input, const char *input
 static DNNReturnType set_input_tf(void *model, DNNData *input, const char 
*input_name)
 {
 TFModel *tf_model = (TFModel *)model;
+TFContext *ctx = &tf_model->ctx;
 TF_SessionOptions *sess_opts;
 const TF_Operation *init_op = TF_GraphOperationByName(tf_model->graph, 
"init");
 
 // Input operation
 tf_model->input.oper = TF_GraphOperationByName(tf_model->graph, 
input_name);
 if (!tf_model->input.oper){
+av_log(ctx, AV_LOG_ERROR, "Could not find \"%s\" in model\n", 
input_name);
 return DNN_ERROR;
 }
 tf_model->input.index = 0;
@@ -152,6 +171,7 @@ static DNNReturnType set_input_tf(void *model, DNNData 
*input, const char *input
 }
 tf_model->input_tensor = allocate_input_tensor(input);
 if (!tf_model->input_tensor){
+av_log(ctx, AV_LOG_ERROR, "Failed to allocate memory for input 
tensor\n");
 return DNN_ERROR;
 }
 input->data = (float *)TF_TensorData(tf_model->input_tensor);
@@ -167,6 +187,7 @@ static DNNReturnType set_input_tf(void *model, DNNData 
*input, const char *input
 TF_DeleteSessionOptions(sess_opts);
 if (TF_GetCode(tf_model->status) != TF_OK)
 {
+av_log(ctx, AV_LOG_ERROR, "Failed to create new session with model 
graph\n");
 return DNN_ERROR;
 }
 
@@ -178,6 +199,7 @@ static DNNReturnType set_input_tf(void *model, DNNData 
*input, const char *input
   &init_op, 1, NULL, tf_model->status);
 if (TF_GetCode(tf_model->status) != TF_OK)
 {
+av_log(ctx, AV_LOG_ERROR, "Failed to run session when 
initializing\n");
 return DNN_ERROR;
 }
 }
@@ -187,11 +209,13 @@ static DNNReturnType set_input_tf(void *model, DNNData 
*input, const char *input
 
 static DNNReturnType load_tf_model(TFModel *tf_model, const char 
*model_filename)
 {
+TFContext *ctx = &tf_model->ctx;
 TF_Buffer *graph_def;
 TF_ImportGraphDefOptions *graph_opts;
 
 graph_def = read_graph(model_filename);
 if (!graph_def){
+av_log(ctx, AV_LOG_ERROR, "Failed to read model \"%s\" graph\n", 
model_filename);
 return DNN_ERROR;
 }
 tf_model->graph = TF_NewGraph();
@@ -203,6 +227,7 @@ static DNNReturnType load_tf_model(TFModel *tf_model, const 
char *model_filename
 if (TF_GetCode(tf_model->status) != TF_OK){
 TF_DeleteGraph(tf_model->graph);
 TF_DeleteStatus(tf_model->status);
+av_log(ctx, AV_LOG_ERROR, "Failed to import serialized graph to model 
graph\n");
 return DNN_ERROR;
 }
 
@@ -214,6 +239,7 @@ static DNNReturnType load_tf_model(TFModel *tf_model, const 
char *model_filename
 static DNNReturnType add_conv_layer(TFModel *tf_model, TF_Operation 
*transpose_op, TF_Operation **cur_op,
 ConvolutionalParams* params, const int 

Re: [FFmpeg-devel] [PATCH v3 2/2] libavformat: add WebP demuxer

2020-08-26 Thread Zlomek, Josef
On Wed, Aug 26, 2020 at 11:16 AM Andreas Rheinhardt <
andreas.rheinha...@gmail.com> wrote:

> Josef Zlomek:
> >  tests/ref/fate/exif-image-webp  |   8 +-
> >  tests/ref/fate/webp-rgb-lena-lossless   |   2 +-
> >  tests/ref/fate/webp-rgb-lena-lossless-rgb24 |   2 +-
> >  tests/ref/fate/webp-rgb-lossless|   2 +-
> >  tests/ref/fate/webp-rgb-lossy-q80   |   2 +-
> >  tests/ref/fate/webp-rgba-lossless   |   2 +-
> >  tests/ref/fate/webp-rgba-lossy-q80  |   2 +-
>
> Great that you also add so many tests for the new demuxer.
>

These are just adjustments of existing tests because of change of behaviour
(timing, headers passed in side data).
I did not know how to add test files so I did not add new tests yet, I will
include new tests in the next version of patches.
I have found how to do it here:
https://ffmpeg.org/fate.html#toc-Uploading-new-samples-to-the-fate-suite

>  12 files changed, 773 insertions(+), 10 deletions(-)
> >  create mode 100644 libavformat/webpdec.c
> >
> > +if (headers && headers->data) {
> > +uint8_t *side_data = av_memdup(headers->data, headers->size);
> > +if (!side_data)
> > +return AVERROR(ENOMEM);
> > +
> > +ret = av_packet_add_side_data(pkt, AV_PKT_DATA_NEW_EXTRADATA,
> > +  side_data, headers->size);
>
> It is better to use av_packet_new_side_data() here: It takes care of the
> case when the buffer could be allocated, but reallocating the side-data
> array fails; and it also adds padding to the allocated buffer. Side data
> of type AV_PKT_DATA_NEW_EXTRADATA should have it.
>

Thank you for the tip, I will change that.

Josef
___
ffmpeg-devel mailing list
ffmpeg-devel@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 v5 3/5] lavc/avs3_parser: add avs3 parser

2020-08-26 Thread hwren



















At 2020-08-26 19:51:20, "Moritz Barsnick"  wrote:
>On Thu, Aug 20, 2020 at 13:31:12 +0800, hwren wrote:
>> At 2020-08-19 22:14:04, "Moritz Barsnick"  wrote:
>> >ffmpeg prefers the "cur++" style (twice in this block, and elsewhere).
>>
>> Will be corrected. Thanks.
>
>> >Is "low_delay" part of the skipped bits? The rest already adds up to
>> >32.
>>
>> No it's not...The low_delay is added by mistake. I will remove it in the 
>> next version.
>
>> >Incorrect indentation.
>>
>> Will be corrected. Thanks.
>
>None of these changed in v7.

Looks like I used a wrong base. I will check them again. Thanks for your 
mention.

Regards,
Huiwen Ren

>
>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 mailing list
ffmpeg-devel@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/videotoolboxenc: don't wait when flushing data

2020-08-26 Thread Steven Liu
From: Tian Qi 

because there is run in thread mode, few times will block
the workflow at the wait, so check the status is flushing data,
don't wait when flushing data.

Signed-off-by: Tian Qi 
Signed-off-by: Steven Liu 
---
 libavcodec/videotoolboxenc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavcodec/videotoolboxenc.c b/libavcodec/videotoolboxenc.c
index e89cfaeed8..f9626be18f 100644
--- a/libavcodec/videotoolboxenc.c
+++ b/libavcodec/videotoolboxenc.c
@@ -292,7 +292,7 @@ static int vtenc_q_pop(VTEncContext *vtctx, bool wait, 
CMSampleBufferRef *buf, E
 return 0;
 }
 
-while (!vtctx->q_head && !vtctx->async_error && wait) {
+while (!vtctx->q_head && !vtctx->async_error && wait && !vtctx->flushing) {
 pthread_cond_wait(&vtctx->cv_sample_sent, &vtctx->lock);
 }
 
@@ -308,6 +308,7 @@ static int vtenc_q_pop(VTEncContext *vtctx, bool wait, 
CMSampleBufferRef *buf, E
 vtctx->q_tail = NULL;
 }
 
+vtctx->frame_ct_out++;
 pthread_mutex_unlock(&vtctx->lock);
 
 *buf = info->cm_buffer;
@@ -319,7 +320,6 @@ static int vtenc_q_pop(VTEncContext *vtctx, bool wait, 
CMSampleBufferRef *buf, E
 }
 av_free(info);
 
-vtctx->frame_ct_out++;
 
 return 0;
 }
-- 
2.25.0



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

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

Re: [FFmpeg-devel] [FFmpeg-cvslog] avfilter/yadif: simplify the code for better readability

2020-08-26 Thread lance . lmwang
On Wed, Aug 26, 2020 at 10:47:13PM +0200, Carl Eugen Hoyos wrote:
> Am Mi., 26. Aug. 2020 um 14:55 Uhr schrieb Limin Wang :
> >
> > ffmpeg | branch: master | Limin Wang  | Wed Aug 12 
> > 00:21:54 2020 +0800| [2a9b934675b9e2d3850b46f8a618c19b03f02551] | 
> > committer: Limin Wang
> >
> > avfilter/yadif: simplify the code for better readability
> 
> This broke compilation of yadif_cuda, please either fix
> or revert.

Sorry, just realized cuda is disabled, I'll revert first.

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

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

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

[FFmpeg-devel] [PATCH v2] avcodec/cfhd: Remove unused-but-set variable

2020-08-26 Thread Andreas Rheinhardt
Signed-off-by: Andreas Rheinhardt 
---
V2 because of 389cc142fb00c23ac1a8d2ba95a9db5d8be473cd.

 libavcodec/cfhd.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/libavcodec/cfhd.c b/libavcodec/cfhd.c
index 291d53e02e..e381a17606 100644
--- a/libavcodec/cfhd.c
+++ b/libavcodec/cfhd.c
@@ -1256,7 +1256,7 @@ finish:
 
 if (s->transform_type == 2 && s->sample_type == 1) {
 int16_t *low, *high, *dst;
-int output_stride, lowpass_height, lowpass_width, highpass_stride;
+int output_stride, lowpass_height, lowpass_width;
 ptrdiff_t dst_linesize;
 
 for (plane = 0; plane < s->planes; plane++) {
@@ -1272,7 +1272,6 @@ finish:
 lowpass_height  = s->plane[plane].band[4][1].height;
 output_stride   = s->plane[plane].band[4][1].a_width;
 lowpass_width   = s->plane[plane].band[4][1].width;
-highpass_stride = s->plane[plane].band[4][1].stride;
 
 if (s->progressive) {
 dst = (int16_t *)pic->data[act_plane];
-- 
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".

Re: [FFmpeg-devel] [FFmpeg-cvslog] avfilter/yadif: simplify the code for better readability

2020-08-26 Thread Carl Eugen Hoyos
Am Mi., 26. Aug. 2020 um 14:55 Uhr schrieb Limin Wang :
>
> ffmpeg | branch: master | Limin Wang  | Wed Aug 12 
> 00:21:54 2020 +0800| [2a9b934675b9e2d3850b46f8a618c19b03f02551] | committer: 
> Limin Wang
>
> avfilter/yadif: simplify the code for better readability

This broke compilation of yadif_cuda, please either fix
or revert.

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 v6 3/4] configure: add FLIF dependencies

2020-08-26 Thread Anamitra Ghorui
On 26/08/2020 18:57, Moritz Barsnick wrote:
> On Sun, Aug 23, 2020 at 00:09:34 +0530, Anamitra Ghorui wrote:
>> --- a/configure
>> +++ b/configure
>> @@ -3307,6 +3307,7 @@ fifo_muxer_deps="threads"
>>   flac_demuxer_select="flac_parser"
>>   flv_muxer_select="aac_adtstoasc_bsf"
>>   gxf_muxer_select="pcm_rechunk_bsf"
>> +flif_demuxer_select="zlib exif"
>>   hds_muxer_select="flv_muxer"
> 
> This needs to be in the same commit as the one which adds the demuxer,
> it's a necessity for its build.
> 
> Moritz

These are actually optional dependencies for the demuxer, and these are
only required for metadata decoding. If not enabled, metadata is
skipped. Should I actually remove this and let the user voluntarily add
in the dependencies?

I now notice that removing the line generates some unused variable
warnings in the demuxer. I will take care of them in the next patch.

Will also do the suggested in the rest of the 2 Emails.

-- 
Thanks,
Anamitra

___
ffmpeg-devel mailing list
ffmpeg-devel@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 v6 1/4] lavc: add FLIF decoding support

2020-08-26 Thread Anamitra Ghorui
Hello,
Thanks for the review. Please see replies below.

On 26/08/2020 18:44, Moritz Barsnick wrote:
> On Sun, Aug 23, 2020 at 00:09:32 +0530, Anamitra Ghorui wrote:
>> v2: Fix faulty patch
>> v3: Fix addressed errors, Add interlaced decoding support
>> v4: Fix Further cosmetics, C.Bucket Transform reading errors, Atomise patch
>> v5: Fix faulty patch
>> v6: Address pointed out errors, use av_freep everywhere, further cosmetics,
>>  redundancies.
> 
> These comments don't belong in the commit or the e-mail corresponding
> to the commit. So either in the "0/4" e-mail, or below the "---" below.
> 
>> Test files are available here: https://0x0.st/iYs_.zip
>>
>> Co-authored-by: Anamitra Ghorui 
>> Co-authored-by: Kartik K Khullar 
>>
>> Signed-off-by: Anamitra Ghorui 
>> ---
> 
> Place comments here.
>
Will do as a separate E-Mail

>> +if (plane == 1 || plane == 2){
> 
> Please fix the bracket style -> ") {"
> 
>> +if (plane != 2) {
>> +  prop_ranges[top].min = mind;
>> +  prop_ranges[top++].max = maxd;
>> +  prop_ranges[top].min = mind;
>> +  prop_ranges[top++].max = maxd;
>> +}
> 
> Incorrect indentation.
> 
>> +for(uint8_t i = 0; i < (lookback ? MAX_PLANES : num_planes); i++) {
> 
> Bracket style -> "for ("
> 
>> +/*
>> + * All constant plane pixel setting should be illegal in theory.
> 
> settings
> 
>> +static inline FLIF16ColorVal ff_flif16_pixel_get_fast(FLIF16Context *s,
>> +  FLIF16PixelData 
>> *frame,
>> +  uint8_t plane, 
>> uint32_t row,
>> +  uint32_t col)
>> +{
>> +if (s->plane_mode[plane]) {
>> +return ((FLIF16ColorVal *) frame->data[plane])[row * 
>> frame->s_r[plane] + col * frame->s_c[plane]];
>> +} else
>> +return ((FLIF16ColorVal *) frame->data[plane])[0];
>> +return 0;
> 
> Isn't this "return 0" dead code?
> 
>> +if(bytestream2_get_bytes_left(gb) < FLIF16_RAC_MAX_RANGE_BYTES)
> 
> Bracket style -> "if ("
> 

Will fix all above

>> +uint8_t ff_flif16_rac_read_bit(FLIF16RangeCoder *rc,
>> +   uint8_t *target)
>> +{
>> +return ff_flif16_rac_get(rc, rc->range >> 1, target);
>> +}
> 
> If this is called often, you may want to mark it inline.
> 

On Nicolas George's suggestion, I had dropped the inline keyword because
the number of inline functions used may put stress on the memory cache.
I think I should only inine the "higher" functions and not the "lower"
functions like ff_flif16_rac_get in this case. Should I?

>> +uint32_t ff_flif16_rac_read_chance(FLIF16RangeCoder *rc,
>> +   uint64_t b12, uint8_t *target)
>> +{
>> +uint32_t ret = ((rc->range) * b12 + 0x800) >> 12;
> 
> I don't think rc->range needs to be bracketed.
> 
>> +if(!ff_flif16_rac_renorm(rc))
> 
> Bracket style.

Will fix

>> +#define RAC_NZ_GET(rc, ctx, chance, target) 
>>\
>> +if (!ff_flif16_rac_nz_read_internal((rc), (ctx), (chance),  
>>\
>> +(uint8_t *) (target))) {
>>\
>> +goto need_more_data;
>>\
>> +}
> 
> Functions are usually defined with a do{} while(0) wrapper. See the
> style in libavutil/intreadwrite.h.
Please see the section below regarding intermittent packet resuming.

>> +return ret;
>> +
>> +}
> 
> Drop the empty line. ;-)
> 
>> +if(!ff_flif16_rac_renorm(rc))
> 
> Bracket style.
> 

Will fix

>> +while (rc->pos > 0) {
>> +rc->pos--;
>> +rc->left >>= 1;
>> +rc->minabs1 = rc->have | (1 << rc->pos);
>> +rc->maxabs0 = rc->have | rc->left;
>> +
>> +if (rc->minabs1 > rc->amax) {
>> +continue;
>> +} else if (rc->maxabs0 >= rc->amin) {
>> +case 3:
>> +RAC_NZ_GET(rc, ctx, NZ_INT_MANT(rc->pos), &temp);
>> +if (temp)
>> +rc->have = rc->minabs1;
>> +temp = 0;
>> +} else {
>> +rc->have = rc->minabs1;
>> +}
> 
> A case label in the middle of an if() (in a while() loop) is not
> readable to me. ;-)

Please see the section below regarding intermittent packet resuming.

>> +m->stack_top = 0;
>> +rc->segment2 = 0;
>> +return 0;
>> +
>> +need_more_data:
>> +return AVERROR(EAGAIN);
> 
> I believe the label needs to be left-aligned.
> 
>> +if(!m->forest[channel]->leaves)
> 
> Bracket style.
> 
>> +if(!rc->curr_leaf) {
> 
> Ditto.
> 
>> +
>> +end:
>> +rc->curr_leaf = NULL;
> 
> "goto" label left alignment
> 
>> + * probability model. The other (simpler) model and this model ane non
> 
> *are
>

Will fix

>> +#define RAC_GET(rc, ctx, val1, val2, target, type) \
>> +if (!ff_flif16_rac_process((rc), (ctx), (val1)

Re: [FFmpeg-devel] [PATCH 17/19] avfilter/vf_signature: Avoid cast from function pointer to void*

2020-08-26 Thread Paul B Mahol
On 8/25/20, Andreas Rheinhardt  wrote:
> The signature filter uses qsort, but its compare function doesn't have
> the signature required of such a function; therefore it casts the function
> pointer to void. Yet this is wrong:
> C90 only guarantees that one can convert a pointer to any incomplete
> type or object type to void* and back with the result comparing equal
> to the original which makes pointers to void generic pointers to
> incomplete or object type. Yet C90 lacks a generic function pointer
> type.
> C99 additionally guarantees that a pointer to a function of one type may
> be converted to a pointer to a function of another type with the result
> and the original comparing equal when converting back.
> This makes any function pointer type a generic function pointer type.
> Yet even this does not make pointers to void generic function pointers.
>
> Both GCC and Clang emit warnings for this when in pedantic mode.
>
> This commit fixes this by modifying the compare function to comply with
> the expected signature.
>
> Signed-off-by: Andreas Rheinhardt 
> ---
>  libavfilter/vf_signature.c | 7 ---
>  1 file changed, 4 insertions(+), 3 deletions(-)
>

LGTM

> diff --git a/libavfilter/vf_signature.c b/libavfilter/vf_signature.c
> index 80957d0047..32a6405e14 100644
> --- a/libavfilter/vf_signature.c
> +++ b/libavfilter/vf_signature.c
> @@ -132,8 +132,9 @@ static uint64_t get_block_sum(StreamContext *sc,
> uint64_t intpic[32][32], const
>  return sum;
>  }
>
> -static int cmp(const uint64_t *a, const uint64_t *b)
> +static int cmp(const void *x, const void *y)
>  {
> +const uint64_t *a = x, *b = y;
>  return *a < *b ? -1 : ( *a > *b ? 1 : 0 );
>  }
>
> @@ -291,7 +292,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame
> *picref)
>  }
>
>  /* get threshold */
> -qsort(sortsignature, elemcat->elem_count, sizeof(uint64_t), (void*)
> cmp);
> +qsort(sortsignature, elemcat->elem_count, sizeof(uint64_t), cmp);
>  th = sortsignature[(int) (elemcat->elem_count*0.333)];
>
>  /* ternarize */
> @@ -317,7 +318,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame
> *picref)
>  }
>
>  /* confidence */
> -qsort(conflist, DIFFELEM_SIZE, sizeof(uint64_t), (void*) cmp);
> +qsort(conflist, DIFFELEM_SIZE, sizeof(uint64_t), cmp);
>  fs->confidence = FFMIN(conflist[DIFFELEM_SIZE/2], 255);
>
>  /* coarsesignature */
> --
> 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 mailing list
ffmpeg-devel@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 15/19] avfilter/vf_signature: Fix leak of inpads' names

2020-08-26 Thread Paul B Mahol
On 8/25/20, Andreas Rheinhardt  wrote:
> Signed-off-by: Andreas Rheinhardt 
> ---
> It is not intended for these added lines to live very long: One can add
> flags to AVFilter.flags_internal that indicate that this filter wants
> the inpads/outpads' names be freed generically. This will allow to
> remove most of the code for freeing in/outpads. These flags can also be
> used to make ff_insert_in/outpad free the name itself upon error.
>
> Furthermore, one can make ff_insert_pad() return AVERROR(ENOMEM) if the
> name of the pad that is about to be inserted is NULL; this allows to
> remove the checks for allocation failure from the callers.
>
>  libavfilter/vf_signature.c | 2 ++
>  1 file changed, 2 insertions(+)
>

LGTM

> diff --git a/libavfilter/vf_signature.c b/libavfilter/vf_signature.c
> index 5ea55d5247..d09003746c 100644
> --- a/libavfilter/vf_signature.c
> +++ b/libavfilter/vf_signature.c
> @@ -730,6 +730,8 @@ static av_cold void uninit(AVFilterContext *ctx)
>  }
>  av_freep(&sic->streamcontexts);
>  }
> +for (unsigned i = 0; i < ctx->nb_inputs; i++)
> +av_freep(&ctx->input_pads[i].name);
>  }
>
>  static int config_output(AVFilterLink *outlink)
> --
> 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 mailing list
ffmpeg-devel@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 16/19] avfilter/vf_signature: Fix leak of string upon error

2020-08-26 Thread Paul B Mahol
On 8/25/20, Andreas Rheinhardt  wrote:
> If an error happens between allocating a string intended to be used as
> an inpad's name and attaching it to its input pad, the string leaks.
> Fix this by inserting the inpad directly after allocating its string.
>
> Signed-off-by: Andreas Rheinhardt 
> ---
>  libavfilter/vf_signature.c | 9 -
>  1 file changed, 4 insertions(+), 5 deletions(-)
>


LGTM

> diff --git a/libavfilter/vf_signature.c b/libavfilter/vf_signature.c
> index d09003746c..80957d0047 100644
> --- a/libavfilter/vf_signature.c
> +++ b/libavfilter/vf_signature.c
> @@ -663,6 +663,10 @@ static av_cold int init(AVFilterContext *ctx)
>
>  if (!pad.name)
>  return AVERROR(ENOMEM);
> +if ((ret = ff_insert_inpad(ctx, i, &pad)) < 0) {
> +av_freep(&pad.name);
> +return ret;
> +}
>
>  sc = &(sic->streamcontexts[i]);
>
> @@ -679,11 +683,6 @@ static av_cold int init(AVFilterContext *ctx)
>  sc->coarseend = sc->coarsesiglist;
>  sc->coarsecount = 0;
>  sc->midcoarse = 0;
> -
> -if ((ret = ff_insert_inpad(ctx, i, &pad)) < 0) {
> -av_freep(&pad.name);
> -return ret;
> -}
>  }
>
>  /* check filename */
> --
> 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 mailing list
ffmpeg-devel@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 03/19] avfilter/af_anequalizer: Don't allocate outpad names

2020-08-26 Thread Paul B Mahol
On 8/25/20, Andreas Rheinhardt  wrote:
> These names are always the same, so not using duplicates saves
> allocations, checks for the allocations as well as frees.
>
> Signed-off-by: Andreas Rheinhardt 
> ---
>  libavfilter/af_anequalizer.c | 20 
>  1 file changed, 4 insertions(+), 16 deletions(-)
>

LGTM

> diff --git a/libavfilter/af_anequalizer.c b/libavfilter/af_anequalizer.c
> index 26cf835727..8cb607b2b4 100644
> --- a/libavfilter/af_anequalizer.c
> +++ b/libavfilter/af_anequalizer.c
> @@ -192,33 +192,23 @@ static av_cold int init(AVFilterContext *ctx)
>  int ret;
>
>  pad = (AVFilterPad){
> -.name = av_strdup("out0"),
> +.name = "out0",
>  .type = AVMEDIA_TYPE_AUDIO,
>  };
>
> -if (!pad.name)
> -return AVERROR(ENOMEM);
> -
>  ret = ff_insert_outpad(ctx, 0, &pad);
> -if (ret < 0) {
> -av_freep(&pad.name);
> +if (ret < 0)
>  return ret;
> -}
>
>  if (s->draw_curves) {
>  vpad = (AVFilterPad){
> -.name = av_strdup("out1"),
> +.name = "out1",
>  .type = AVMEDIA_TYPE_VIDEO,
>  .config_props = config_video,
>  };
> -if (!vpad.name) {
> -return AVERROR(ENOMEM);
> -}
>  ret = ff_insert_outpad(ctx, 1, &vpad);
> -if (ret < 0) {
> -av_freep(&vpad.name);
> +if (ret < 0)
>  return ret;
> -}
>  }
>
>  return 0;
> @@ -267,8 +257,6 @@ static av_cold void uninit(AVFilterContext *ctx)
>  {
>  AudioNEqualizerContext *s = ctx->priv;
>
> -for (int i = 0; i < ctx->nb_outputs; i++)
> -av_freep(&ctx->output_pads[i].name);
>  av_frame_free(&s->video);
>  av_freep(&s->filters);
>  s->nb_filters = 0;
> --
> 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 mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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

Re: [FFmpeg-devel] [PATCH 02/19] avfilter/af_anequalizer: Fix memleak when inserting pad fails

2020-08-26 Thread Paul B Mahol
On 8/25/20, Andreas Rheinhardt  wrote:
> It has been forgotten to free the name of the second outpad if attaching
> the first one to the AVFilterContext fails. Fixing this is easy: Only
> prepare the second outpad after (and if) the first outpad has been
> successfully attached to the AVFilterContext.
>
> Signed-off-by: Andreas Rheinhardt 
> ---
>  libavfilter/af_anequalizer.c | 16 ++--
>  1 file changed, 6 insertions(+), 10 deletions(-)
>

LGTM

> diff --git a/libavfilter/af_anequalizer.c b/libavfilter/af_anequalizer.c
> index 177e1c7b39..26cf835727 100644
> --- a/libavfilter/af_anequalizer.c
> +++ b/libavfilter/af_anequalizer.c
> @@ -199,6 +199,12 @@ static av_cold int init(AVFilterContext *ctx)
>  if (!pad.name)
>  return AVERROR(ENOMEM);
>
> +ret = ff_insert_outpad(ctx, 0, &pad);
> +if (ret < 0) {
> +av_freep(&pad.name);
> +return ret;
> +}
> +
>  if (s->draw_curves) {
>  vpad = (AVFilterPad){
>  .name = av_strdup("out1"),
> @@ -206,18 +212,8 @@ static av_cold int init(AVFilterContext *ctx)
>  .config_props = config_video,
>  };
>  if (!vpad.name) {
> -av_freep(&pad.name);
>  return AVERROR(ENOMEM);
>  }
> -}
> -
> -ret = ff_insert_outpad(ctx, 0, &pad);
> -if (ret < 0) {
> -av_freep(&pad.name);
> -return ret;
> -}
> -
> -if (s->draw_curves) {
>  ret = ff_insert_outpad(ctx, 1, &vpad);
>  if (ret < 0) {
>  av_freep(&vpad.name);
> --
> 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 mailing list
ffmpeg-devel@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 09/19] avfilter/vf_bm3d: Don't allocate inpad names

2020-08-26 Thread Paul B Mahol
On 8/25/20, Andreas Rheinhardt  wrote:
> These names are always the same, so not using duplicates saves
> allocations, checks for the allocations as well as frees.
>
> Signed-off-by: Andreas Rheinhardt 
> ---
>  libavfilter/vf_bm3d.c | 19 ---
>  1 file changed, 4 insertions(+), 15 deletions(-)
>

LGTM

> diff --git a/libavfilter/vf_bm3d.c b/libavfilter/vf_bm3d.c
> index e5d2b8bc63..18d13b25ff 100644
> --- a/libavfilter/vf_bm3d.c
> +++ b/libavfilter/vf_bm3d.c
> @@ -942,27 +942,19 @@ static av_cold int init(AVFilterContext *ctx)
>  }
>
>  pad.type = AVMEDIA_TYPE_VIDEO;
> -pad.name = av_strdup("source");
> +pad.name = "source";
>  pad.config_props = config_input;
> -if (!pad.name)
> -return AVERROR(ENOMEM);
>
> -if ((ret = ff_insert_inpad(ctx, 0, &pad)) < 0) {
> -av_freep(&pad.name);
> +if ((ret = ff_insert_inpad(ctx, 0, &pad)) < 0)
>  return ret;
> -}
>
>  if (s->ref) {
>  pad.type = AVMEDIA_TYPE_VIDEO;
> -pad.name = av_strdup("reference");
> +pad.name = "reference";
>  pad.config_props = NULL;
> -if (!pad.name)
> -return AVERROR(ENOMEM);
>
> -if ((ret = ff_insert_inpad(ctx, 1, &pad)) < 0) {
> -av_freep(&pad.name);
> +if ((ret = ff_insert_inpad(ctx, 1, &pad)) < 0)
>  return ret;
> -}
>  }
>
>  return 0;
> @@ -1027,9 +1019,6 @@ static av_cold void uninit(AVFilterContext *ctx)
>  BM3DContext *s = ctx->priv;
>  int i;
>
> -for (i = 0; i < ctx->nb_inputs; i++)
> -av_freep(&ctx->input_pads[i].name);
> -
>  if (s->ref)
>  ff_framesync_uninit(&s->fs);
>
> --
> 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 mailing list
ffmpeg-devel@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 06/19] avfilter/vf_decimate: Don't allocate inpad names

2020-08-26 Thread Paul B Mahol
On 8/25/20, Andreas Rheinhardt  wrote:
> These names are always the same, so not using duplicates saves
> allocations, checks for the allocations as well as frees.
>
> Signed-off-by: Andreas Rheinhardt 
> ---
>  libavfilter/vf_decimate.c | 18 --
>  1 file changed, 4 insertions(+), 14 deletions(-)
>

LGTM

> diff --git a/libavfilter/vf_decimate.c b/libavfilter/vf_decimate.c
> index 88a8b38a58..549b281418 100644
> --- a/libavfilter/vf_decimate.c
> +++ b/libavfilter/vf_decimate.c
> @@ -273,29 +273,21 @@ static av_cold int decimate_init(AVFilterContext *ctx)
>  {
>  DecimateContext *dm = ctx->priv;
>  AVFilterPad pad = {
> -.name = av_strdup("main"),
> +.name = "main",
>  .type = AVMEDIA_TYPE_VIDEO,
>  .filter_frame = filter_frame,
>  .config_props = config_input,
>  };
>  int ret;
>
> -if (!pad.name)
> -return AVERROR(ENOMEM);
> -if ((ret = ff_insert_inpad(ctx, INPUT_MAIN, &pad)) < 0) {
> -av_freep(&pad.name);
> +if ((ret = ff_insert_inpad(ctx, INPUT_MAIN, &pad)) < 0)
>  return ret;
> -}
>
>  if (dm->ppsrc) {
> -pad.name = av_strdup("clean_src");
> +pad.name = "clean_src";
>  pad.config_props = NULL;
> -if (!pad.name)
> -return AVERROR(ENOMEM);
> -if ((ret = ff_insert_inpad(ctx, INPUT_CLEANSRC, &pad)) < 0) {
> -av_freep(&pad.name);
> +if ((ret = ff_insert_inpad(ctx, INPUT_CLEANSRC, &pad)) < 0)
>  return ret;
> -}
>  }
>
>  if ((dm->blockx & (dm->blockx - 1)) ||
> @@ -326,8 +318,6 @@ static av_cold void decimate_uninit(AVFilterContext
> *ctx)
>  av_frame_free(&dm->clean_src[i]);
>  }
>  av_freep(&dm->clean_src);
> -for (i = 0; i < ctx->nb_inputs; i++)
> -av_freep(&ctx->input_pads[i].name);
>  }
>
>  static int request_inlink(AVFilterContext *ctx, int lid)
> --
> 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 mailing list
ffmpeg-devel@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 08/19] avfilter/f_ebur128: Don't allocate outpad names

2020-08-26 Thread Paul B Mahol
On 8/25/20, Andreas Rheinhardt  wrote:
> These names are mostly the same, so not using duplicates saves
> allocations, checks for the allocations as well as frees.
>
> Signed-off-by: Andreas Rheinhardt 
> ---
>  libavfilter/f_ebur128.c | 18 --
>  1 file changed, 4 insertions(+), 14 deletions(-)
>

LGTM

> diff --git a/libavfilter/f_ebur128.c b/libavfilter/f_ebur128.c
> index 31b75ab097..5ae3dc25b8 100644
> --- a/libavfilter/f_ebur128.c
> +++ b/libavfilter/f_ebur128.c
> @@ -527,30 +527,22 @@ static av_cold int init(AVFilterContext *ctx)
>  /* insert output pads */
>  if (ebur128->do_video) {
>  pad = (AVFilterPad){
> -.name = av_strdup("out0"),
> +.name = "out0",
>  .type = AVMEDIA_TYPE_VIDEO,
>  .config_props = config_video_output,
>  };
> -if (!pad.name)
> -return AVERROR(ENOMEM);
>  ret = ff_insert_outpad(ctx, 0, &pad);
> -if (ret < 0) {
> -av_freep(&pad.name);
> +if (ret < 0)
>  return ret;
> -}
>  }
>  pad = (AVFilterPad){
> -.name = av_asprintf("out%d", ebur128->do_video),
> +.name = ebur128->do_video ? "out1" : "out0",
>  .type = AVMEDIA_TYPE_AUDIO,
>  .config_props = config_audio_output,
>  };
> -if (!pad.name)
> -return AVERROR(ENOMEM);
>  ret = ff_insert_outpad(ctx, ebur128->do_video, &pad);
> -if (ret < 0) {
> -av_freep(&pad.name);
> +if (ret < 0)
>  return ret;
> -}
>
>  /* summary */
>  av_log(ctx, AV_LOG_VERBOSE, "EBU +%d scale\n", ebur128->meter);
> @@ -990,8 +982,6 @@ static av_cold void uninit(AVFilterContext *ctx)
>  av_freep(&ebur128->i400.cache[i]);
>  av_freep(&ebur128->i3000.cache[i]);
>  }
> -for (i = 0; i < ctx->nb_outputs; i++)
> -av_freep(&ctx->output_pads[i].name);
>  av_frame_free(&ebur128->outpicref);
>  #if CONFIG_SWRESAMPLE
>  av_freep(&ebur128->swr_buf);
> --
> 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 mailing list
ffmpeg-devel@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 04/19] avfilter/vf_premultiply: Fix leak of names of inpads

2020-08-26 Thread Paul B Mahol
On 8/25/20, Andreas Rheinhardt  wrote:
> These names leak because freeing them in the uninit function has been
> forgotten. Instead of adding the freeing code, this commit stops
> allocating these names. They are constants anyway.
>
> Signed-off-by: Andreas Rheinhardt 
> ---
>  libavfilter/vf_premultiply.c | 16 
>  1 file changed, 4 insertions(+), 12 deletions(-)
>

LGTM

> diff --git a/libavfilter/vf_premultiply.c b/libavfilter/vf_premultiply.c
> index 1fef4777de..5d053b1f77 100644
> --- a/libavfilter/vf_premultiply.c
> +++ b/libavfilter/vf_premultiply.c
> @@ -673,27 +673,19 @@ static av_cold int init(AVFilterContext *ctx)
>  s->inverse = 1;
>
>  pad.type = AVMEDIA_TYPE_VIDEO;
> -pad.name = av_strdup("main");
> +pad.name = "main";
>  pad.config_props = config_input;
> -if (!pad.name)
> -return AVERROR(ENOMEM);
>
> -if ((ret = ff_insert_inpad(ctx, 0, &pad)) < 0) {
> -av_freep(&pad.name);
> +if ((ret = ff_insert_inpad(ctx, 0, &pad)) < 0)
>  return ret;
> -}
>
>  if (!s->inplace) {
>  pad.type = AVMEDIA_TYPE_VIDEO;
> -pad.name = av_strdup("alpha");
> +pad.name = "alpha";
>  pad.config_props = NULL;
> -if (!pad.name)
> -return AVERROR(ENOMEM);
>
> -if ((ret = ff_insert_inpad(ctx, 1, &pad)) < 0) {
> -av_freep(&pad.name);
> +if ((ret = ff_insert_inpad(ctx, 1, &pad)) < 0)
>  return ret;
> -}
>  }
>
>  return 0;
> --
> 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 mailing list
ffmpeg-devel@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 10/19] avfilter/avf_aphasemeter: Don't allocate outpad names

2020-08-26 Thread Paul B Mahol
On 8/25/20, Andreas Rheinhardt  wrote:
> These names are always the same, so not using duplicates saves
> allocations, checks for the allocations as well as frees.
>
> Signed-off-by: Andreas Rheinhardt 
> ---
>  libavfilter/avf_aphasemeter.c | 19 ---
>  1 file changed, 4 insertions(+), 15 deletions(-)
>

LGTM

> diff --git a/libavfilter/avf_aphasemeter.c b/libavfilter/avf_aphasemeter.c
> index be0b2fb70f..53d1de29d3 100644
> --- a/libavfilter/avf_aphasemeter.c
> +++ b/libavfilter/avf_aphasemeter.c
> @@ -227,11 +227,8 @@ static int filter_frame(AVFilterLink *inlink, AVFrame
> *in)
>  static av_cold void uninit(AVFilterContext *ctx)
>  {
>  AudioPhaseMeterContext *s = ctx->priv;
> -int i;
>
>  av_frame_free(&s->out);
> -for (i = 0; i < ctx->nb_outputs; i++)
> -av_freep(&ctx->output_pads[i].name);
>  }
>
>  static av_cold int init(AVFilterContext *ctx)
> @@ -241,30 +238,22 @@ static av_cold int init(AVFilterContext *ctx)
>  int ret;
>
>  pad = (AVFilterPad){
> -.name = av_strdup("out0"),
> +.name = "out0",
>  .type = AVMEDIA_TYPE_AUDIO,
>  };
> -if (!pad.name)
> -return AVERROR(ENOMEM);
>  ret = ff_insert_outpad(ctx, 0, &pad);
> -if (ret < 0) {
> -av_freep(&pad.name);
> +if (ret < 0)
>  return ret;
> -}
>
>  if (s->do_video) {
>  pad = (AVFilterPad){
> -.name = av_strdup("out1"),
> +.name = "out1",
>  .type = AVMEDIA_TYPE_VIDEO,
>  .config_props = config_video_output,
>  };
> -if (!pad.name)
> -return AVERROR(ENOMEM);
>  ret = ff_insert_outpad(ctx, 1, &pad);
> -if (ret < 0) {
> -av_freep(&pad.name);
> +if (ret < 0)
>  return ret;
> -}
>  }
>
>  return 0;
> --
> 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 mailing list
ffmpeg-devel@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 05/19] avfilter/vf_fieldmatch: Don't allocate inpad names

2020-08-26 Thread Paul B Mahol
On 8/25/20, Andreas Rheinhardt  wrote:
> These names are always the same, so not using duplicates saves
> allocations, checks for the allocations as well as frees.
>
> Signed-off-by: Andreas Rheinhardt 
> ---
>  libavfilter/vf_fieldmatch.c | 19 ---
>  1 file changed, 4 insertions(+), 15 deletions(-)
>

LGTM

> diff --git a/libavfilter/vf_fieldmatch.c b/libavfilter/vf_fieldmatch.c
> index fa4aa8239c..7fcad18caf 100644
> --- a/libavfilter/vf_fieldmatch.c
> +++ b/libavfilter/vf_fieldmatch.c
> @@ -964,28 +964,20 @@ static av_cold int fieldmatch_init(AVFilterContext
> *ctx)
>  {
>  const FieldMatchContext *fm = ctx->priv;
>  AVFilterPad pad = {
> -.name = av_strdup("main"),
> +.name = "main",
>  .type = AVMEDIA_TYPE_VIDEO,
>  .config_props = config_input,
>  };
>  int ret;
>
> -if (!pad.name)
> -return AVERROR(ENOMEM);
> -if ((ret = ff_insert_inpad(ctx, INPUT_MAIN, &pad)) < 0) {
> -av_freep(&pad.name);
> +if ((ret = ff_insert_inpad(ctx, INPUT_MAIN, &pad)) < 0)
>  return ret;
> -}
>
>  if (fm->ppsrc) {
> -pad.name = av_strdup("clean_src");
> +pad.name = "clean_src";
>  pad.config_props = NULL;
> -if (!pad.name)
> -return AVERROR(ENOMEM);
> -if ((ret = ff_insert_inpad(ctx, INPUT_CLEANSRC, &pad)) < 0) {
> -av_freep(&pad.name);
> +if ((ret = ff_insert_inpad(ctx, INPUT_CLEANSRC, &pad)) < 0)
>  return ret;
> -}
>  }
>
>  if ((fm->blockx & (fm->blockx - 1)) ||
> @@ -1004,7 +996,6 @@ static av_cold int fieldmatch_init(AVFilterContext
> *ctx)
>
>  static av_cold void fieldmatch_uninit(AVFilterContext *ctx)
>  {
> -int i;
>  FieldMatchContext *fm = ctx->priv;
>
>  if (fm->prv != fm->src)
> @@ -1021,8 +1012,6 @@ static av_cold void fieldmatch_uninit(AVFilterContext
> *ctx)
>  av_freep(&fm->cmask_data[0]);
>  av_freep(&fm->tbuffer);
>  av_freep(&fm->c_array);
> -for (i = 0; i < ctx->nb_inputs; i++)
> -av_freep(&ctx->input_pads[i].name);
>  }
>
>  static int config_output(AVFilterLink *outlink)
> --
> 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 mailing list
ffmpeg-devel@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 12/19] avfilter/af_afir: Avoid allocating AVFilterPad names

2020-08-26 Thread Paul B Mahol
On 8/25/20, Andreas Rheinhardt  wrote:
> If the names are always the same, they need not be duplicated; doing so
> saves allocations, checks for the allocations as well as frees.
>
> Signed-off-by: Andreas Rheinhardt 
> ---
>  libavfilter/af_afir.c | 30 +++---
>  1 file changed, 7 insertions(+), 23 deletions(-)
>

LGTM

> diff --git a/libavfilter/af_afir.c b/libavfilter/af_afir.c
> index 4e76bda4a3..d128f4bce7 100644
> --- a/libavfilter/af_afir.c
> +++ b/libavfilter/af_afir.c
> @@ -800,11 +800,9 @@ static av_cold void uninit(AVFilterContext *ctx)
>  av_frame_free(&s->ir[i]);
>  }
>
> -for (int i = 0; i < ctx->nb_inputs; i++)
> +for (unsigned i = 1; i < ctx->nb_inputs; i++)
>  av_freep(&ctx->input_pads[i].name);
>
> -for (int i = 0; i < ctx->nb_outputs; i++)
> -av_freep(&ctx->output_pads[i].name);
>  av_frame_free(&s->video);
>  }
>
> @@ -842,18 +840,13 @@ static av_cold int init(AVFilterContext *ctx)
>  int ret;
>
>  pad = (AVFilterPad) {
> -.name = av_strdup("main"),
> +.name = "main",
>  .type = AVMEDIA_TYPE_AUDIO,
>  };
>
> -if (!pad.name)
> -return AVERROR(ENOMEM);
> -
>  ret = ff_insert_inpad(ctx, 0, &pad);
> -if (ret < 0) {
> -av_freep(&pad.name);
> +if (ret < 0)
>  return ret;
> -}
>
>  for (int n = 0; n < s->nb_irs; n++) {
>  pad = (AVFilterPad) {
> @@ -872,34 +865,25 @@ static av_cold int init(AVFilterContext *ctx)
>  }
>
>  pad = (AVFilterPad) {
> -.name  = av_strdup("default"),
> +.name  = "default",
>  .type  = AVMEDIA_TYPE_AUDIO,
>  .config_props  = config_output,
>  };
>
> -if (!pad.name)
> -return AVERROR(ENOMEM);
> -
>  ret = ff_insert_outpad(ctx, 0, &pad);
> -if (ret < 0) {
> -av_freep(&pad.name);
> +if (ret < 0)
>  return ret;
> -}
>
>  if (s->response) {
>  vpad = (AVFilterPad){
> -.name = av_strdup("filter_response"),
> +.name = "filter_response",
>  .type = AVMEDIA_TYPE_VIDEO,
>  .config_props = config_video,
>  };
> -if (!vpad.name)
> -return AVERROR(ENOMEM);
>
>  ret = ff_insert_outpad(ctx, 1, &vpad);
> -if (ret < 0) {
> -av_freep(&vpad.name);
> +if (ret < 0)
>  return ret;
> -}
>  }
>
>  s->fdsp = avpriv_float_dsp_alloc(0);
> --
> 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 mailing list
ffmpeg-devel@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 19/19] avfilter/af_headphone: Fix segfault upon allocation failure

2020-08-26 Thread Paul B Mahol
On 8/25/20, Andreas Rheinhardt  wrote:
> The headphone filter uses a variable number of inpads and allocates them
> in its init function; if all goes well, the number of inpads coincides
> with a number stored in the filter's private context. Yet if allocating a
> subsequent inpad fails, the uninit function nevertheless uses the number
> stored in the private context to determine the number of inpads to free
> and not the AVFilterContext's nb_inputs. This will lead to an access
> beyond the end of the allocated AVFilterContext.input_pads array and
> an invalid free.
>
> Signed-off-by: Andreas Rheinhardt 
> ---
> This is not the only thing wrong in this filter. Will send a separate
> patchset for it.
>
>  libavfilter/af_headphone.c | 7 ++-
>  1 file changed, 2 insertions(+), 5 deletions(-)
>

LGTM

> diff --git a/libavfilter/af_headphone.c b/libavfilter/af_headphone.c
> index 552ad84837..751f4ab53d 100644
> --- a/libavfilter/af_headphone.c
> +++ b/libavfilter/af_headphone.c
> @@ -812,7 +812,6 @@ static int config_output(AVFilterLink *outlink)
>  static av_cold void uninit(AVFilterContext *ctx)
>  {
>  HeadphoneContext *s = ctx->priv;
> -int i;
>
>  av_fft_end(s->ifft[0]);
>  av_fft_end(s->ifft[1]);
> @@ -834,11 +833,9 @@ static av_cold void uninit(AVFilterContext *ctx)
>  av_freep(&s->data_hrtf[1]);
>  av_freep(&s->fdsp);
>
> -for (i = 0; i < s->nb_inputs; i++) {
> -if (ctx->input_pads && i)
> -av_freep(&ctx->input_pads[i].name);
> -}
>  av_freep(&s->in);
> +for (unsigned i = 1; i < ctx->nb_inputs; i++)
> +av_freep(&ctx->input_pads[i].name);
>  }
>
>  #define OFFSET(x) offsetof(HeadphoneContext, x)
> --
> 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 mailing list
ffmpeg-devel@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 20/20] avfilter/af_headphone: Fix leak of channel layouts list on error

2020-08-26 Thread Paul B Mahol
On 8/25/20, Andreas Rheinhardt  wrote:
> In case the multichannel HRIR mode was enabled, an error could happen
> between allocating a channel layouts list and attaching it to its target
> destination. If an error happened, the list would leak. This is fixed by
> attaching the list to its target directly after its allocation.
>
> Signed-off-by: Andreas Rheinhardt 
> ---


LGTM

> Forgot this one. Btw: Should one factor out common operations like
> ff_make_formats_list()+ff_formats_ref()?
>
>  libavfilter/af_headphone.c | 7 +++
>  1 file changed, 3 insertions(+), 4 deletions(-)
>
> diff --git a/libavfilter/af_headphone.c b/libavfilter/af_headphone.c
> index 751f4ab53d..da5acdce30 100644
> --- a/libavfilter/af_headphone.c
> +++ b/libavfilter/af_headphone.c
> @@ -703,6 +703,9 @@ static int query_formats(AVFilterContext *ctx)
>  return ret;
>
>  ret = ff_add_channel_layout(&stereo_layout, AV_CH_LAYOUT_STEREO);
> +if (ret)
> +return ret;
> +ret = ff_channel_layouts_ref(stereo_layout,
> &ctx->outputs[0]->in_channel_layouts);
>  if (ret)
>  return ret;
>
> @@ -721,10 +724,6 @@ static int query_formats(AVFilterContext *ctx)
>  }
>  }
>
> -ret = ff_channel_layouts_ref(stereo_layout,
> &ctx->outputs[0]->in_channel_layouts);
> -if (ret)
> -return ret;
> -
>  formats = ff_all_samplerates();
>  if (!formats)
>  return AVERROR(ENOMEM);
> --
> 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 mailing list
ffmpeg-devel@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 11/19] avfilter/af_aiir: Fix segfault and leak upon allocation failure

2020-08-26 Thread Paul B Mahol
On 8/25/20, Andreas Rheinhardt  wrote:
> The aiir filter adds output pads in its init function. Each of these
> output pads had a name which was allocated and to be freed in the uninit
> function. Given that the aiir filter has between one and two outputs,
> one output pad's name was freed unconditionally and a second was freed
> conditionally.
>
> Yet if adding output pads fails, there are no output pads at all and
> trying to free a nonexistent pad's name will lead to a segfault.
>
> Furthermore, if the name could be successfully allocated, yet adding the
> new pad fails, the name would leak.
>
> This commit fixes this by not allocating the pads' names at all any
> more: They are constant anyway. This allows to remove the code to free
> them and hence fixes the aforementioned bugs.
>
> Signed-off-by: Andreas Rheinhardt 
> ---
>  libavfilter/af_aiir.c | 12 ++--
>  1 file changed, 2 insertions(+), 10 deletions(-)
>

LGTM

> diff --git a/libavfilter/af_aiir.c b/libavfilter/af_aiir.c
> index bc31e5141e..3df25b4d9b 100644
> --- a/libavfilter/af_aiir.c
> +++ b/libavfilter/af_aiir.c
> @@ -1159,26 +1159,21 @@ static av_cold int init(AVFilterContext *ctx)
>  }
>
>  pad = (AVFilterPad){
> -.name = av_strdup("default"),
> +.name = "default",
>  .type = AVMEDIA_TYPE_AUDIO,
>  .config_props = config_output,
>  };
>
> -if (!pad.name)
> -return AVERROR(ENOMEM);
> -
>  ret = ff_insert_outpad(ctx, 0, &pad);
>  if (ret < 0)
>  return ret;
>
>  if (s->response) {
>  vpad = (AVFilterPad){
> -.name = av_strdup("filter_response"),
> +.name = "filter_response",
>  .type = AVMEDIA_TYPE_VIDEO,
>  .config_props = config_video,
>  };
> -if (!vpad.name)
> -return AVERROR(ENOMEM);
>
>  ret = ff_insert_outpad(ctx, 1, &vpad);
>  if (ret < 0)
> @@ -1205,9 +1200,6 @@ static av_cold void uninit(AVFilterContext *ctx)
>  }
>  av_freep(&s->iir);
>
> -av_freep(&ctx->output_pads[0].name);
> -if (s->response)
> -av_freep(&ctx->output_pads[1].name);
>  av_frame_free(&s->video);
>  }
>
> --
> 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 mailing list
ffmpeg-devel@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/4] avcodec/tiff: Check the linearization table size

2020-08-26 Thread Michael Niedermayer
On Thu, Aug 20, 2020 at 10:50:43AM +0200, Michael Niedermayer wrote:
> Fixes: out of array access
> Fixes: 
> 24604/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TIFF_fuzzer-4843529818603520
> 
> Found-by: continuous fuzzing process 
> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer 
> ---
>  libavcodec/tiff.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)

will apply patchset

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

Good people do not need laws to tell them to act responsibly, while bad
people will find a way around the laws. -- Plato


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] libavcodec/vp9: export block structure when segmentation isn't enable

2020-08-26 Thread Yongle Lin
On Mon, Jul 13, 2020 at 2:57 PM Yongle Lin  wrote:

>
> On Thu, Jul 9, 2020 at 2:23 PM Yongle Lin  wrote:
>
>>
>>
>> On Mon, Jul 6, 2020 at 11:31 AM Yongle Lin 
>> wrote:
>>
>>> it makes sense to export block structure like src_x, src_y, width and
>>> height when segmentation isn't enable so we could visualize and see the
>>> structure of the block.
>>> ---
>>>  libavcodec/vp9.c | 8 +++-
>>>  1 file changed, 3 insertions(+), 5 deletions(-)
>>>
>>> diff --git a/libavcodec/vp9.c b/libavcodec/vp9.c
>>> index fd0bab14a2..e700def70e 100644
>>> --- a/libavcodec/vp9.c
>>> +++ b/libavcodec/vp9.c
>>> @@ -1501,10 +1501,8 @@ static int vp9_export_enc_params(VP9Context *s,
>>> VP9Frame *frame)
>>>  AVVideoEncParams *par;
>>>  unsigned int tile, nb_blocks = 0;
>>>
>>> -if (s->s.h.segmentation.enabled) {
>>> -for (tile = 0; tile < s->active_tile_cols; tile++)
>>> -nb_blocks += s->td[tile].nb_block_structure;
>>> -}
>>> +for (tile = 0; tile < s->active_tile_cols; tile++)
>>> +nb_blocks += s->td[tile].nb_block_structure;
>>>
>>>  par = av_video_enc_params_create_side_data(frame->tf.f,
>>>  AV_VIDEO_ENC_PARAMS_VP9, nb_blocks);
>>> @@ -1536,7 +1534,7 @@ static int vp9_export_enc_params(VP9Context *s,
>>> VP9Frame *frame)
>>>  b->w = 1 << (3 +
>>> td->block_structure[block_tile].block_size_idx_x);
>>>  b->h = 1 << (3 +
>>> td->block_structure[block_tile].block_size_idx_y);
>>>
>>> -if (s->s.h.segmentation.feat[seg_id].q_enabled) {
>>> +if (s->s.h.segmentation.enabled &&
>>> s->s.h.segmentation.feat[seg_id].q_enabled) {
>>>  b->delta_qp =
>>> s->s.h.segmentation.feat[seg_id].q_val;
>>>  if (s->s.h.segmentation.absolute_vals)
>>>  b->delta_qp -= par->qp;
>>> --
>>> 2.27.0.383.g050319c2ae-goog
>>>
>>>
>> Dear FFmpeg Developers,
>>
>> Currently ffmpeg doesn't export the block data for VP9 if there is no
>> segmentation. Because it's only used to export QP value. I think it makes
>> more sense to export the block information without segmentation so we could
>> visualize the block structure for VP9 video.
>>
>> Could you please review and merge this patch? Thanks.
>>
>> Best,
>> Yongle
>>
>
> Dear FFmpeg Developers,
>
> Currently ffmpeg doesn't export the block data for VP9 if there is no
> segmentation. Because it's only used to export QP value. I think it makes
> more sense to export the block information without segmentation so we could
> visualize the block structure for VP9 video.
>
> Could you please review and merge this patch? Thanks.
>
> Best,
> Yongle
>

Hi FFmpeg Developers,

I noticed that this patch hasn't been reviewed yet.  Could someone help me
review it and merge this patch? Thanks.

Best,
Yongle
___
ffmpeg-devel mailing list
ffmpeg-devel@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] ffplay: fix autoexit doesn't work in the case of pb->error

2020-08-26 Thread Zhao Zhili
---
Goto fail will make ffplay exit immediately. I'm not sure
it is the expected behavior. How about just remove the
check on pb->error so decoders can drain normally?

 fftools/ffplay.c | 8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/fftools/ffplay.c b/fftools/ffplay.c
index 6c9c041e9a..9ff0425163 100644
--- a/fftools/ffplay.c
+++ b/fftools/ffplay.c
@@ -3028,8 +3028,12 @@ static int read_thread(void *arg)
 packet_queue_put_nullpacket(&is->subtitleq, 
is->subtitle_stream);
 is->eof = 1;
 }
-if (ic->pb && ic->pb->error)
-break;
+if (ic->pb && ic->pb->error) {
+if (autoexit)
+goto fail;
+else
+break;
+}
 SDL_LockMutex(wait_mutex);
 SDL_CondWaitTimeout(is->continue_read_thread, wait_mutex, 10);
 SDL_UnlockMutex(wait_mutex);
-- 
2.25.1

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

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

[FFmpeg-devel] [RFC PATCH v6 1/4] libavcodec/jpeg2000: Make tag tree functions non static

2020-08-26 Thread gautamramk
From: Gautam Ramakrishnan 

This patch makes the tag_tree_zero() and tag_tree_size()
functions non static and callable from other files.
---
 libavcodec/jpeg2000.c | 12 ++--
 libavcodec/jpeg2000.h |  3 +++
 2 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/libavcodec/jpeg2000.c b/libavcodec/jpeg2000.c
index 1aca31ffa4..26e09fbe38 100644
--- a/libavcodec/jpeg2000.c
+++ b/libavcodec/jpeg2000.c
@@ -39,7 +39,7 @@
 /* tag tree routines */
 
 /* allocate the memory for tag tree */
-static int32_t tag_tree_size(int w, int h)
+int32_t ff_tag_tree_size(int w, int h)
 {
 int64_t res = 0;
 while (w > 1 || h > 1) {
@@ -57,7 +57,7 @@ static Jpeg2000TgtNode *ff_jpeg2000_tag_tree_init(int w, int 
h)
 Jpeg2000TgtNode *res, *t, *t2;
 int32_t tt_size;
 
-tt_size = tag_tree_size(w, h);
+tt_size = ff_tag_tree_size(w, h);
 
 t = res = av_mallocz_array(tt_size, sizeof(*t));
 if (!res)
@@ -82,9 +82,9 @@ static Jpeg2000TgtNode *ff_jpeg2000_tag_tree_init(int w, int 
h)
 return res;
 }
 
-static void tag_tree_zero(Jpeg2000TgtNode *t, int w, int h)
+void ff_tag_tree_zero(Jpeg2000TgtNode *t, int w, int h)
 {
-int i, siz = tag_tree_size(w, h);
+int i, siz = ff_tag_tree_size(w, h);
 
 for (i = 0; i < siz; i++) {
 t[i].val = 0;
@@ -567,8 +567,8 @@ void ff_jpeg2000_reinit(Jpeg2000Component *comp, 
Jpeg2000CodingStyle *codsty)
 Jpeg2000Band *band = rlevel->band + bandno;
 for(precno = 0; precno < rlevel->num_precincts_x * 
rlevel->num_precincts_y; precno++) {
 Jpeg2000Prec *prec = band->prec + precno;
-tag_tree_zero(prec->zerobits, prec->nb_codeblocks_width, 
prec->nb_codeblocks_height);
-tag_tree_zero(prec->cblkincl, prec->nb_codeblocks_width, 
prec->nb_codeblocks_height);
+ff_tag_tree_zero(prec->zerobits, prec->nb_codeblocks_width, 
prec->nb_codeblocks_height);
+ff_tag_tree_zero(prec->cblkincl, prec->nb_codeblocks_width, 
prec->nb_codeblocks_height);
 for (cblkno = 0; cblkno < prec->nb_codeblocks_width * 
prec->nb_codeblocks_height; cblkno++) {
 Jpeg2000Cblk *cblk = prec->cblk + cblkno;
 cblk->length = 0;
diff --git a/libavcodec/jpeg2000.h b/libavcodec/jpeg2000.h
index 5b0627c3dc..c3437b02fe 100644
--- a/libavcodec/jpeg2000.h
+++ b/libavcodec/jpeg2000.h
@@ -290,4 +290,7 @@ static inline int needs_termination(int style, int passno) {
 return 0;
 }
 
+int32_t ff_tag_tree_size(int w, int h);
+void ff_tag_tree_zero(Jpeg2000TgtNode *t, int w, int h);
+
 #endif /* AVCODEC_JPEG2000_H */
-- 
2.17.1

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

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

[FFmpeg-devel] [RFC PATCH v6 4/4] libavcodec/jpeg2000: fix tag tree reset

2020-08-26 Thread gautamramk
From: Gautam Ramakrishnan 

The implementation of the tag tree did not
set the correct reset value for the encoder.
This lead to inefficent tag tree being encoded.
This patch fixes the implementation of the
ff_tag_tree_zero() function.
---
 libavcodec/j2kenc.c  | 4 ++--
 libavcodec/jpeg2000.c| 8 
 libavcodec/jpeg2000.h| 2 +-
 tests/ref/vsynth/vsynth1-jpeg2000| 4 ++--
 tests/ref/vsynth/vsynth1-jpeg2000-97 | 4 ++--
 tests/ref/vsynth/vsynth2-jpeg2000| 4 ++--
 tests/ref/vsynth/vsynth2-jpeg2000-97 | 4 ++--
 tests/ref/vsynth/vsynth3-jpeg2000| 4 ++--
 tests/ref/vsynth/vsynth3-jpeg2000-97 | 4 ++--
 tests/ref/vsynth/vsynth_lena-jpeg2000| 4 ++--
 tests/ref/vsynth/vsynth_lena-jpeg2000-97 | 4 ++--
 11 files changed, 23 insertions(+), 23 deletions(-)

diff --git a/libavcodec/j2kenc.c b/libavcodec/j2kenc.c
index 8dab18cdd6..ed3ad73c8e 100644
--- a/libavcodec/j2kenc.c
+++ b/libavcodec/j2kenc.c
@@ -801,8 +801,8 @@ static int encode_packet(Jpeg2000EncoderContext *s, 
Jpeg2000ResLevel *rlevel, in
 Jpeg2000Prec *prec = band->prec + precno;
 int nb_cblks = prec->nb_codeblocks_height * 
prec->nb_codeblocks_width;
 int pos;
-ff_tag_tree_zero(prec->zerobits, prec->nb_codeblocks_width, 
prec->nb_codeblocks_height);
-ff_tag_tree_zero(prec->cblkincl, prec->nb_codeblocks_width, 
prec->nb_codeblocks_height);
+ff_tag_tree_zero(prec->zerobits, prec->nb_codeblocks_width, 
prec->nb_codeblocks_height, 99);
+ff_tag_tree_zero(prec->cblkincl, prec->nb_codeblocks_width, 
prec->nb_codeblocks_height, 99);
 for (pos = 0; pos < nb_cblks; pos++) {
 Jpeg2000Cblk *cblk = &prec->cblk[pos];
 prec->zerobits[pos].val = expn[bandno] + numgbits - 1 - 
cblk->nonzerobits;
diff --git a/libavcodec/jpeg2000.c b/libavcodec/jpeg2000.c
index 6501de0d04..56d98c8a89 100644
--- a/libavcodec/jpeg2000.c
+++ b/libavcodec/jpeg2000.c
@@ -82,12 +82,12 @@ static Jpeg2000TgtNode *ff_jpeg2000_tag_tree_init(int w, 
int h)
 return res;
 }
 
-void ff_tag_tree_zero(Jpeg2000TgtNode *t, int w, int h)
+void ff_tag_tree_zero(Jpeg2000TgtNode *t, int w, int h, int val)
 {
 int i, siz = ff_tag_tree_size(w, h);
 
 for (i = 0; i < siz; i++) {
-t[i].val = 0;
+t[i].val = val;
 t[i].temp_val = 0;
 t[i].vis = 0;
 }
@@ -575,8 +575,8 @@ void ff_jpeg2000_reinit(Jpeg2000Component *comp, 
Jpeg2000CodingStyle *codsty)
 Jpeg2000Band *band = rlevel->band + bandno;
 for(precno = 0; precno < rlevel->num_precincts_x * 
rlevel->num_precincts_y; precno++) {
 Jpeg2000Prec *prec = band->prec + precno;
-ff_tag_tree_zero(prec->zerobits, prec->nb_codeblocks_width, 
prec->nb_codeblocks_height);
-ff_tag_tree_zero(prec->cblkincl, prec->nb_codeblocks_width, 
prec->nb_codeblocks_height);
+ff_tag_tree_zero(prec->zerobits, prec->nb_codeblocks_width, 
prec->nb_codeblocks_height, 0);
+ff_tag_tree_zero(prec->cblkincl, prec->nb_codeblocks_width, 
prec->nb_codeblocks_height, 0);
 for (cblkno = 0; cblkno < prec->nb_codeblocks_width * 
prec->nb_codeblocks_height; cblkno++) {
 Jpeg2000Cblk *cblk = prec->cblk + cblkno;
 cblk->length = 0;
diff --git a/libavcodec/jpeg2000.h b/libavcodec/jpeg2000.h
index a7ba8aa7f3..612832c872 100644
--- a/libavcodec/jpeg2000.h
+++ b/libavcodec/jpeg2000.h
@@ -302,6 +302,6 @@ static inline int needs_termination(int style, int passno) {
 }
 
 int32_t ff_tag_tree_size(int w, int h);
-void ff_tag_tree_zero(Jpeg2000TgtNode *t, int w, int h);
+void ff_tag_tree_zero(Jpeg2000TgtNode *t, int w, int h, int val);
 
 #endif /* AVCODEC_JPEG2000_H */
diff --git a/tests/ref/vsynth/vsynth1-jpeg2000 
b/tests/ref/vsynth/vsynth1-jpeg2000
index 5081507459..f8e987f95d 100644
--- a/tests/ref/vsynth/vsynth1-jpeg2000
+++ b/tests/ref/vsynth/vsynth1-jpeg2000
@@ -1,4 +1,4 @@
-dd66b25f2ebc965eae4c29cfacdd960f *tests/data/fate/vsynth1-jpeg2000.avi
-2274950 tests/data/fate/vsynth1-jpeg2000.avi
+95add005faf68fcf8f16e86eab079ca2 *tests/data/fate/vsynth1-jpeg2000.avi
+2263192 tests/data/fate/vsynth1-jpeg2000.avi
 b7f48a8965f78011c76483277befc6fc *tests/data/fate/vsynth1-jpeg2000.out.rawvideo
 stddev:5.35 PSNR: 33.56 MAXDIFF:   59 bytes:  7603200/  7603200
diff --git a/tests/ref/vsynth/vsynth1-jpeg2000-97 
b/tests/ref/vsynth/vsynth1-jpeg2000-97
index 7e18f20e25..6ab5aa4237 100644
--- a/tests/ref/vsynth/vsynth1-jpeg2000-97
+++ b/tests/ref/vsynth/vsynth1-jpeg2000-97
@@ -1,4 +1,4 @@
-f22ad99de77f8f4382c6cf10d5af42b5 *tests/data/fate/vsynth1-jpeg2000-97.avi
-3661422 tests/data/fate/vsynth1-jpeg2000-97.avi
+e4d03b2e3c03e56c7f831b1e662c4031 *tests/data/fate/vsynth1-jpeg2000-97.avi
+3643928 tests/data/fate/vsynth1-jpeg2000-97.avi
 a2262f1da2f49bc196b780a6b

[FFmpeg-devel] [RFC PATCH v6 2/4] libavcodec/j2kenc: Fix tag tree coding

2020-08-26 Thread gautamramk
From: Gautam Ramakrishnan 

The implementation of tag tree encoding was incorrect.
However, this error was not visible as the current j2k
encoder encodes only 1 layer.
This patch fixes tag tree coding for JPEG2000 such tag
tree coding would work for multi layer encoding.
---
 libavcodec/j2kenc.c   | 41 +
 libavcodec/jpeg2000.c |  1 +
 libavcodec/jpeg2000.h |  1 +
 3 files changed, 27 insertions(+), 16 deletions(-)

diff --git a/libavcodec/j2kenc.c b/libavcodec/j2kenc.c
index 16863f8e8c..87acd2d5c9 100644
--- a/libavcodec/j2kenc.c
+++ b/libavcodec/j2kenc.c
@@ -242,27 +242,36 @@ static void j2k_flush(Jpeg2000EncoderContext *s)
 static void tag_tree_code(Jpeg2000EncoderContext *s, Jpeg2000TgtNode *node, 
int threshold)
 {
 Jpeg2000TgtNode *stack[30];
-int sp = 1, curval = 0;
-stack[0] = node;
+int sp = -1, curval = 0;
 
-node = node->parent;
-while(node){
-if (node->vis){
-curval = node->val;
-break;
-}
-node->vis++;
-stack[sp++] = node;
+while(node->parent){
+stack[++sp] = node;
 node = node->parent;
 }
-while(--sp >= 0){
-if (stack[sp]->val >= threshold){
+
+while (1) {
+if (curval > node->temp_val)
+node->temp_val = curval;
+else {
+curval = node->temp_val;
+}
+
+if (node->val >= threshold) {
 put_bits(s, 0, threshold - curval);
-break;
+curval = threshold;
+} else {
+put_bits(s, 0, node->val - curval);
+curval = node->val;
+if (!node->vis) {
+put_bits(s, 1, 1);
+node->vis = 1;
+}
 }
-put_bits(s, 0, stack[sp]->val - curval);
-put_bits(s, 1, 1);
-curval = stack[sp]->val;
+
+node->temp_val = curval;
+if (sp < 0)
+break;
+node = stack[sp--];
 }
 }
 
diff --git a/libavcodec/jpeg2000.c b/libavcodec/jpeg2000.c
index 26e09fbe38..3d3e7ec313 100644
--- a/libavcodec/jpeg2000.c
+++ b/libavcodec/jpeg2000.c
@@ -88,6 +88,7 @@ void ff_tag_tree_zero(Jpeg2000TgtNode *t, int w, int h)
 
 for (i = 0; i < siz; i++) {
 t[i].val = 0;
+t[i].temp_val = 0;
 t[i].vis = 0;
 }
 }
diff --git a/libavcodec/jpeg2000.h b/libavcodec/jpeg2000.h
index c3437b02fe..ad58b1ae88 100644
--- a/libavcodec/jpeg2000.h
+++ b/libavcodec/jpeg2000.h
@@ -127,6 +127,7 @@ typedef struct Jpeg2000T1Context {
 
 typedef struct Jpeg2000TgtNode {
 uint8_t val;
+uint8_t temp_val;
 uint8_t vis;
 struct Jpeg2000TgtNode *parent;
 } Jpeg2000TgtNode;
-- 
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] [RFC PATCH v6 3/4] libavcodec/j2kenc: Support for multiple layers

2020-08-26 Thread gautamramk
From: Gautam Ramakrishnan 

This patch allows setting a compression ratio and to
set multiple layers. The user has to input a compression
ratio for each layer.
The per layer compression ration can be set as follows:
-layer_rates "r1,r2,...rn"
for to create 'n' layers.
---
 doc/encoders.texi|  16 +
 libavcodec/j2kenc.c  | 492 +++
 libavcodec/jpeg2000.c|  12 +-
 libavcodec/jpeg2000.h|  10 +
 tests/ref/vsynth/vsynth1-jpeg2000|   8 +-
 tests/ref/vsynth/vsynth1-jpeg2000-97 |   6 +-
 tests/ref/vsynth/vsynth2-jpeg2000|   8 +-
 tests/ref/vsynth/vsynth2-jpeg2000-97 |   8 +-
 tests/ref/vsynth/vsynth3-jpeg2000|   8 +-
 tests/ref/vsynth/vsynth3-jpeg2000-97 |   8 +-
 tests/ref/vsynth/vsynth_lena-jpeg2000|   8 +-
 tests/ref/vsynth/vsynth_lena-jpeg2000-97 |   8 +-
 12 files changed, 490 insertions(+), 102 deletions(-)

diff --git a/doc/encoders.texi b/doc/encoders.texi
index fd9235a05a..481ad2fb3d 100644
--- a/doc/encoders.texi
+++ b/doc/encoders.texi
@@ -1401,6 +1401,22 @@ Possible values are:
 @end table
 Set to @code{lrcp} by default.
 
+@item layer_rates @var{string}
+By default, compression is done using the quality metric. This option allows 
for
+compression using compression ratio. The compression ratio for each level could
+be specified. The compression ratio of a layer @code{l} species the what ratio 
of
+total file size is contained in the first @code{l} layers.
+
+Example usage:
+
+@example
+ffmpeg -i input.bmp -c:v jpeg2000 -layer_rates "100,10,1" output.j2k
+@end example
+
+This would compress the image to contain 3 layers, where the data contained in 
the
+first layer would be compressed by 1000 times, compressed by 100 in the first 
two layers,
+and shall contain all data while using all 3 layers.
+
 @end table
 
 @section librav1e
diff --git a/libavcodec/j2kenc.c b/libavcodec/j2kenc.c
index 87acd2d5c9..8dab18cdd6 100644
--- a/libavcodec/j2kenc.c
+++ b/libavcodec/j2kenc.c
@@ -32,6 +32,7 @@
  * Copyright (c) 2003-2007, Francois-Olivier Devaux and Antonin Descampe
  * Copyright (c) 2005, Herve Drolon, FreeImage Team
  * Copyright (c) 2007, Callum Lerwick 
+ * Copyright (c) 2020, Gautam Ramakrishnan 
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -100,6 +101,7 @@ static const int dwt_norms[2][4][10] = { // 
[dwt_type][band][rlevel] (multiplied
 
 typedef struct {
Jpeg2000Component *comp;
+   double *layer_rates;
 } Jpeg2000Tile;
 
 typedef struct {
@@ -126,12 +128,16 @@ typedef struct {
 Jpeg2000QuantStyle  qntsty;
 
 Jpeg2000Tile *tile;
+int layer_rates[100];
+uint8_t compression_rate_enc; ///< Is compression done using compression 
ratio?
 
 int format;
 int pred;
 int sop;
 int eph;
 int prog;
+int nlayers;
+char *lr_str;
 } Jpeg2000EncoderContext;
 
 
@@ -334,7 +340,7 @@ static int put_cod(Jpeg2000EncoderContext *s)
 bytestream_put_byte(&s->buf, scod);  // Scod
 // SGcod
 bytestream_put_byte(&s->buf, s->prog); // progression level
-bytestream_put_be16(&s->buf, 1); // num of layers
+bytestream_put_be16(&s->buf, s->nlayers); // num of layers
 if(s->avctx->pix_fmt == AV_PIX_FMT_YUV444P){
 bytestream_put_byte(&s->buf, 0); // unspecified
 }else{
@@ -413,6 +419,31 @@ static uint8_t *put_sot(Jpeg2000EncoderContext *s, int 
tileno)
 return psotptr;
 }
 
+static void compute_rates(Jpeg2000EncoderContext* s)
+{
+int i, j;
+int layno, compno;
+for (i = 0; i < s->numYtiles; i++) {
+for (j = 0; j < s->numXtiles; j++) {
+Jpeg2000Tile *tile = &s->tile[s->numXtiles * i + j];
+for (compno = 0; compno < s->ncomponents; compno++) {
+int tilew = tile->comp[compno].coord[0][1] - 
tile->comp[compno].coord[0][0];
+int tileh = tile->comp[compno].coord[1][1] - 
tile->comp[compno].coord[1][0];
+int scale = (compno?1 << s->chroma_shift[0]:1) * (compno?1 << 
s->chroma_shift[1]:1);
+for (layno = 0; layno < s->nlayers; layno++) {
+if (s->layer_rates[layno] > 0) {
+tile->layer_rates[layno] += (double)(tilew * tileh) * 
s->ncomponents * s->cbps[compno] /
+
(double)(s->layer_rates[layno] * 8 * scale);
+} else {
+tile->layer_rates[layno] = 0.0;
+}
+}
+}
+}
+}
+
+}
+
 /**
  * compute the sizes of tiles, resolution levels, bands, etc.
  * allocate memory for them
@@ -437,6 +468,11 @@ static int init_tiles(Jpeg2000EncoderContext *s)
 tile->comp = av_mallocz_array(s->ncomponents, 
sizeof(Jpeg2000Component));
 if (!tile->comp)
 return AVERROR(ENOMEM);
+
+tile->layer_rates = av_mallocz_array(s->nlayers, 
siz

Re: [FFmpeg-devel] [PATCH] fftools: Accept more negative prefixes

2020-08-26 Thread Moritz Barsnick
On Sat, Aug 22, 2020 at 21:55:21 +0100, Mark Thompson wrote:
> > Without checking in more detail: Wouldn't this break the
> > "-noise_reduction", "-non_deterministic" and "-non_linear_quant"
> > options?
>
> The intent is to extend what already happens - given an argument like
> "-nougat", it first looks for the option of any kind called "nougat",
> then only if that is not found looks for a boolean option called
> "ugat". In your example, the "noise_reduction" option is found, so
> "ise_reduction" is never searched for.

Okay, I failed to check that. Thanks for the explanation, perfect.

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

Re: [FFmpeg-devel] [PATCH v6 1/4] lavc: add FLIF decoding support

2020-08-26 Thread Moritz Barsnick
On Sun, Aug 23, 2020 at 00:09:32 +0530, Anamitra Ghorui wrote:
> v2: Fix faulty patch
> v3: Fix addressed errors, Add interlaced decoding support
> v4: Fix Further cosmetics, C.Bucket Transform reading errors, Atomise patch
> v5: Fix faulty patch
> v6: Address pointed out errors, use av_freep everywhere, further cosmetics,
> redundancies.

These comments don't belong in the commit or the e-mail corresponding
to the commit. So either in the "0/4" e-mail, or below the "---" below.

> Test files are available here: https://0x0.st/iYs_.zip
>
> Co-authored-by: Anamitra Ghorui 
> Co-authored-by: Kartik K Khullar 
>
> Signed-off-by: Anamitra Ghorui 
> ---

Place comments here.

> +if (plane == 1 || plane == 2){

Please fix the bracket style -> ") {"

> +if (plane != 2) {
> +  prop_ranges[top].min = mind;
> +  prop_ranges[top++].max = maxd;
> +  prop_ranges[top].min = mind;
> +  prop_ranges[top++].max = maxd;
> +}

Incorrect indentation.

> +for(uint8_t i = 0; i < (lookback ? MAX_PLANES : num_planes); i++) {

Bracket style -> "for ("

> +/*
> + * All constant plane pixel setting should be illegal in theory.

settings

> +static inline FLIF16ColorVal ff_flif16_pixel_get_fast(FLIF16Context *s,
> +  FLIF16PixelData *frame,
> +  uint8_t plane, 
> uint32_t row,
> +  uint32_t col)
> +{
> +if (s->plane_mode[plane]) {
> +return ((FLIF16ColorVal *) frame->data[plane])[row * 
> frame->s_r[plane] + col * frame->s_c[plane]];
> +} else
> +return ((FLIF16ColorVal *) frame->data[plane])[0];
> +return 0;

Isn't this "return 0" dead code?

> +if(bytestream2_get_bytes_left(gb) < FLIF16_RAC_MAX_RANGE_BYTES)

Bracket style -> "if ("

> +uint8_t ff_flif16_rac_read_bit(FLIF16RangeCoder *rc,
> +   uint8_t *target)
> +{
> +return ff_flif16_rac_get(rc, rc->range >> 1, target);
> +}

If this is called often, you may want to mark it inline.

> +uint32_t ff_flif16_rac_read_chance(FLIF16RangeCoder *rc,
> +   uint64_t b12, uint8_t *target)
> +{
> +uint32_t ret = ((rc->range) * b12 + 0x800) >> 12;

I don't think rc->range needs to be bracketed.

> +if(!ff_flif16_rac_renorm(rc))

Bracket style.

> +#define RAC_NZ_GET(rc, ctx, chance, target)  
>   \
> +if (!ff_flif16_rac_nz_read_internal((rc), (ctx), (chance),   
>   \
> +(uint8_t *) (target))) { 
>   \
> +goto need_more_data; 
>   \
> +}

Functions are usually defined with a do{} while(0) wrapper. See the
style in libavutil/intreadwrite.h.

> +return ret;
> +
> +}

Drop the empty line. ;-)

> +if(!ff_flif16_rac_renorm(rc))

Bracket style.

> +while (rc->pos > 0) {
> +rc->pos--;
> +rc->left >>= 1;
> +rc->minabs1 = rc->have | (1 << rc->pos);
> +rc->maxabs0 = rc->have | rc->left;
> +
> +if (rc->minabs1 > rc->amax) {
> +continue;
> +} else if (rc->maxabs0 >= rc->amin) {
> +case 3:
> +RAC_NZ_GET(rc, ctx, NZ_INT_MANT(rc->pos), &temp);
> +if (temp)
> +rc->have = rc->minabs1;
> +temp = 0;
> +} else {
> +rc->have = rc->minabs1;
> +}

A case label in the middle of an if() (in a while() loop) is not
readable to me. ;-)

> +m->stack_top = 0;
> +rc->segment2 = 0;
> +return 0;
> +
> +need_more_data:
> +return AVERROR(EAGAIN);

I believe the label needs to be left-aligned.

> +if(!m->forest[channel]->leaves)

Bracket style.

> +if(!rc->curr_leaf) {

Ditto.

> +
> +end:
> +rc->curr_leaf = NULL;

"goto" label left alignment

> + * probability model. The other (simpler) model and this model ane non

*are

> +#define RAC_GET(rc, ctx, val1, val2, target, type) \
> +if (!ff_flif16_rac_process((rc), (ctx), (val1), (val2), (target), 
> (type))) { \
> +goto need_more_data; \
> +}

do{} while(0)

> +#define MANIAC_GET(rc, m, prop, channel, min, max, target) \
> +{ \
> +int ret = ff_flif16_maniac_read_int((rc), (m), (prop), (channel), 
> (min), (max), (target)); \
> +if (ret < 0) { \
> +return ret; \
> +} else if (!ret) { \
> +goto need_more_data; \
> +} \
> +}

Ditto.



I give up here. There are further 4000+ lines to review. What an
impressive patch.

Just this:

> +static void transform_palette_reverse(FLIF16Context *ctx,
> + FLIF16TransformContext *t_ctx,
> + FLIF16PixelData *frame,
> + uint32_t stride_row,
> +  

Re: [FFmpeg-devel] [PATCH v6 4/4] doc: add documentation entries for FLIF

2020-08-26 Thread Moritz Barsnick
On Sun, Aug 23, 2020 at 00:09:35 +0530, Anamitra Ghorui wrote:
>  - RPZA video encoder
> -
> +- FLIF16 decoder
> +- FLIF16 demuxer

This should be part of the corresponding commits. And don't drop the
empty line.

>  @tab Sorenson H.263 used in Flash
> +@item FLIF (Free Lossless Image Format @tab @tab  X
> +@tab Precursor to JPEG XL and FUIF
>  @item FM Screen Capture Codec  @tab @tab  X

This can also go into its commit.

The decoder and demuxer also deserve documentation entries in the
respective sections, even if there are no options to document.

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

Re: [FFmpeg-devel] [PATCH v6 3/4] configure: add FLIF dependencies

2020-08-26 Thread Moritz Barsnick
On Sun, Aug 23, 2020 at 00:09:34 +0530, Anamitra Ghorui wrote:
> --- a/configure
> +++ b/configure
> @@ -3307,6 +3307,7 @@ fifo_muxer_deps="threads"
>  flac_demuxer_select="flac_parser"
>  flv_muxer_select="aac_adtstoasc_bsf"
>  gxf_muxer_select="pcm_rechunk_bsf"
> +flif_demuxer_select="zlib exif"
>  hds_muxer_select="flv_muxer"

This needs to be in the same commit as the one which adds the demuxer,
it's a necessity for its build.

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

Re: [FFmpeg-devel] [PATCH v6 2/4] lavfmt: add FLIF demuxing support

2020-08-26 Thread Moritz Barsnick
On Sun, Aug 23, 2020 at 00:09:33 +0530, Anamitra Ghorui wrote:

> Subject: Re: [FFmpeg-devel] [PATCH v6 2/4] lavfmt: add FLIF demuxing support

ffmpeg usually uses "lavf" (or "avformat").

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

Re: [FFmpeg-devel] [RFC PATCH v5 2/3] libavcodec/j2kenc: Fix tag tree coding

2020-08-26 Thread Michael Niedermayer
On Wed, Aug 26, 2020 at 03:04:57PM +0530, Gautam Ramakrishnan wrote:
> On Wed, Aug 26, 2020 at 12:44 PM Michael Niedermayer
>  wrote:
> >
> > On Wed, Aug 26, 2020 at 08:38:30AM +0530, Gautam Ramakrishnan wrote:
> > > On Wed, Aug 26, 2020 at 4:04 AM Michael Niedermayer
> > >  wrote:
> > > >
> > > > On Tue, Aug 25, 2020 at 07:25:44PM +0530, gautamr...@gmail.com wrote:
> > > > > From: Gautam Ramakrishnan 
> > > > >
> > > > > The implementation of tag tree encoding was incorrect.
> > > > > However, this error was not visible as the current j2k
> > > > > encoder encodes only 1 layer.
> > > > > This patch fixes tag tree coding for JPEG2000 such tag
> > > > > tree coding would work for multi layer encoding.
> > > >
> > > > [...]
> > > >
> > > > > diff --git a/libavcodec/jpeg2000.c b/libavcodec/jpeg2000.c
> > > > > index 26e09fbe38..2e26bc5b00 100644
> > > > > --- a/libavcodec/jpeg2000.c
> > > > > +++ b/libavcodec/jpeg2000.c
> > > > > @@ -82,12 +82,13 @@ static Jpeg2000TgtNode 
> > > > > *ff_jpeg2000_tag_tree_init(int w, int h)
> > > > >  return res;
> > > > >  }
> > > > >
> > > > > -void ff_tag_tree_zero(Jpeg2000TgtNode *t, int w, int h)
> > > > > +void ff_tag_tree_zero(Jpeg2000TgtNode *t, int w, int h, int val)
> > > > >  {
> > > > >  int i, siz = ff_tag_tree_size(w, h);
> > > > >
> > > > >  for (i = 0; i < siz; i++) {
> > > > > -t[i].val = 0;
> > > > > +t[i].val = val;
> > > > > +t[i].temp_val = 0;
> > > > >  t[i].vis = 0;
> > > > >  }
> > > > >  }
> > > > > @@ -567,8 +568,8 @@ void ff_jpeg2000_reinit(Jpeg2000Component *comp, 
> > > > > Jpeg2000CodingStyle *codsty)
> > > > >  Jpeg2000Band *band = rlevel->band + bandno;
> > > > >  for(precno = 0; precno < rlevel->num_precincts_x * 
> > > > > rlevel->num_precincts_y; precno++) {
> > > > >  Jpeg2000Prec *prec = band->prec + precno;
> > > > > -ff_tag_tree_zero(prec->zerobits, 
> > > > > prec->nb_codeblocks_width, prec->nb_codeblocks_height);
> > > > > -ff_tag_tree_zero(prec->cblkincl, 
> > > > > prec->nb_codeblocks_width, prec->nb_codeblocks_height);
> > > > > +ff_tag_tree_zero(prec->zerobits, 
> > > > > prec->nb_codeblocks_width, prec->nb_codeblocks_height, 0);
> > > > > +ff_tag_tree_zero(prec->cblkincl, 
> > > > > prec->nb_codeblocks_width, prec->nb_codeblocks_height, 0);
> > > >
> > > > this looks a bit like a somewhat unlrelated bugfix thats spread over 
> > > > this and
> > > > the next patch
> > > > if so, that should be moved into a seperate patch
> > > > the patches are already complex without an additional bugfix in them
> > > >
> > > This portion is a fix for what you pointed out yesterday saying that
> > > the parent of a the
> > > nodes are not getting set. I thought this would be an appropriate
> > > patch to fix this. Do you
> > > feel its better that this part is made separate though?
> >
> > > In my opinion, only this patch provides the bug fix and the next patch
> > > just uses the fix.
> > > Do correct me if I am wrong.
> >
> > IIUC the problem is that the tag trees are inefficient, so a bugfix would
> > change the output files and make them bit smaller.
> > the 1/3 & 2/3 patches do not change the output of any fate tests so they
> > do not seem to fix this on their own. The 3/3 patch adds multi layer stuff
> > so the bugfix seemed intermingled with that, which is what i thought was
> > not optimal. Its not the end of the world if these are mixed but it should
> > be for a very good reason then. For example if seperating the fix would be
> > a unreasonable amount of work and make the changes alot more complex ...
> > But in 99% of the cases bugfixes really should be seperate it makes
> > understanding chnages, testing changes and also things like future 
> > regression
> > testing easier.
> 
> So in that case, do I make this part a 4th patch in the series which fixes 
> this
> inefficiency?

if thats easier then yes, otherwise i would do the bugfixes before new 
features

thx

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

If you think the mosad wants you dead since a long time then you are either
wrong or dead since a long time.


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

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

[FFmpeg-devel] [PATCH] avcodec/nvenc_hevc: add ff_nvenc_encode_flush() for .flush

2020-08-26 Thread lance . lmwang
From: Limin Wang 

for the .capabilities have AV_CODEC_CAP_ENCODER_FLUSH, so it's better to add it.

Signed-off-by: Limin Wang 
---
 libavcodec/nvenc_hevc.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libavcodec/nvenc_hevc.c b/libavcodec/nvenc_hevc.c
index 074975f..a1e2463 100644
--- a/libavcodec/nvenc_hevc.c
+++ b/libavcodec/nvenc_hevc.c
@@ -202,6 +202,7 @@ AVCodec ff_nvenc_hevc_encoder = {
 .init   = nvenc_old_init,
 .receive_packet = ff_nvenc_receive_packet,
 .close  = ff_nvenc_encode_close,
+.flush  = ff_nvenc_encode_flush,
 .priv_data_size = sizeof(NvencContext),
 .priv_class = &nvenc_hevc_class,
 .defaults   = defaults,
-- 
1.8.3.1

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

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

Re: [FFmpeg-devel] [PATCH v5 3/5] lavc/avs3_parser: add avs3 parser

2020-08-26 Thread Moritz Barsnick
On Thu, Aug 20, 2020 at 13:31:12 +0800, hwren wrote:
> At 2020-08-19 22:14:04, "Moritz Barsnick"  wrote:
> >ffmpeg prefers the "cur++" style (twice in this block, and elsewhere).
>
> Will be corrected. Thanks.

> >Is "low_delay" part of the skipped bits? The rest already adds up to
> >32.
>
> No it's not...The low_delay is added by mistake. I will remove it in the next 
> version.

> >Incorrect indentation.
>
> Will be corrected. Thanks.

None of these changed in v7.

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

Re: [FFmpeg-devel] [PATCH v5 2/5] lavc/avs3: add AVS3 related definitions

2020-08-26 Thread Moritz Barsnick
On Thu, Aug 20, 2020 at 13:24:44 +0800, hwren wrote:
> At 2020-08-19 22:18:52, "Moritz Barsnick"  wrote:
> >On Wed, Aug 19, 2020 at 14:25:53 +0800, hwr...@126.com wrote:
> >> + * AVS3 related definition
> >
> >definitions?
> >> +};
> >> \ No newline at end of file
> >
> >Please amend a carriage return to the last line.
> >
> >> + *  AVS3 related definition
> >
> >definitions?
> >
> >Moritz
>
> Will be corrected. Thanks for pointing out.

This didn't change in v7.

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

Re: [FFmpeg-devel] Forward frame wall clock time from avdevice to HLS muxer

2020-08-26 Thread Andreas Rheinhardt
Jesper Ek:
> Hi,
> 
> I have implemented a libavdevice to capture audio and video from an AJA
> Kona card (similar to decklink). I'm then using the HLS muxer to encode my
> stream. Now I need the HLS EXT-X-PROGRAM-DATE-TIME tag to specify exactly
> when the input source was recorded, so my plan is to forward the "wall
> clock time" (from the avdevice implementation) to the hls muxer, and use
> that instead of using system time (av_gettime()).
> 
> I cant use PTS, so what is the correct way to pass "wall clock time"
> metadata for every frame to the HLS encoder?
> 
> I noticed that the decklink implementation uses
> `av_packet_add_side_data(&pkt, AV_PKT_DATA_STRINGS_METADATA, ...)` to add
> timecode information, is this the correct approach?
> 

AV_PKT_DATA_PRFT side data might be the right tool for you.

> I hope this mailing list is appropriate for my question, otherwise please
> forgive me.

It is only appropriate for this mailing list if you want to improve
FFmpeg itself (i.e. by making the hls muxer use AV_PKT_DATA_PRFT; the
dash muxer already seems to use it). If not, the user mailing list is
the right place.

- 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] Forward frame wall clock time from avdevice to HLS muxer

2020-08-26 Thread Nicolas George
Jesper Ek (12020-08-26):
> I cant use PTS, so what is the correct way to pass "wall clock time"
> metadata for every frame to the HLS encoder?

PTS would be the correct way. Why can you not use it?

Regards,

-- 
  Nicolas George


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

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

[FFmpeg-devel] Forward frame wall clock time from avdevice to HLS muxer

2020-08-26 Thread Jesper Ek
Hi,

I have implemented a libavdevice to capture audio and video from an AJA
Kona card (similar to decklink). I'm then using the HLS muxer to encode my
stream. Now I need the HLS EXT-X-PROGRAM-DATE-TIME tag to specify exactly
when the input source was recorded, so my plan is to forward the "wall
clock time" (from the avdevice implementation) to the hls muxer, and use
that instead of using system time (av_gettime()).

I cant use PTS, so what is the correct way to pass "wall clock time"
metadata for every frame to the HLS encoder?

I noticed that the decklink implementation uses
`av_packet_add_side_data(&pkt, AV_PKT_DATA_STRINGS_METADATA, ...)` to add
timecode information, is this the correct approach?

I hope this mailing list is appropriate for my question, otherwise please
forgive me.

Best regards,
Jesper Ek
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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

Re: [FFmpeg-devel] [RFC PATCH v5 2/3] libavcodec/j2kenc: Fix tag tree coding

2020-08-26 Thread Gautam Ramakrishnan
On Wed, Aug 26, 2020 at 12:44 PM Michael Niedermayer
 wrote:
>
> On Wed, Aug 26, 2020 at 08:38:30AM +0530, Gautam Ramakrishnan wrote:
> > On Wed, Aug 26, 2020 at 4:04 AM Michael Niedermayer
> >  wrote:
> > >
> > > On Tue, Aug 25, 2020 at 07:25:44PM +0530, gautamr...@gmail.com wrote:
> > > > From: Gautam Ramakrishnan 
> > > >
> > > > The implementation of tag tree encoding was incorrect.
> > > > However, this error was not visible as the current j2k
> > > > encoder encodes only 1 layer.
> > > > This patch fixes tag tree coding for JPEG2000 such tag
> > > > tree coding would work for multi layer encoding.
> > >
> > > [...]
> > >
> > > > diff --git a/libavcodec/jpeg2000.c b/libavcodec/jpeg2000.c
> > > > index 26e09fbe38..2e26bc5b00 100644
> > > > --- a/libavcodec/jpeg2000.c
> > > > +++ b/libavcodec/jpeg2000.c
> > > > @@ -82,12 +82,13 @@ static Jpeg2000TgtNode 
> > > > *ff_jpeg2000_tag_tree_init(int w, int h)
> > > >  return res;
> > > >  }
> > > >
> > > > -void ff_tag_tree_zero(Jpeg2000TgtNode *t, int w, int h)
> > > > +void ff_tag_tree_zero(Jpeg2000TgtNode *t, int w, int h, int val)
> > > >  {
> > > >  int i, siz = ff_tag_tree_size(w, h);
> > > >
> > > >  for (i = 0; i < siz; i++) {
> > > > -t[i].val = 0;
> > > > +t[i].val = val;
> > > > +t[i].temp_val = 0;
> > > >  t[i].vis = 0;
> > > >  }
> > > >  }
> > > > @@ -567,8 +568,8 @@ void ff_jpeg2000_reinit(Jpeg2000Component *comp, 
> > > > Jpeg2000CodingStyle *codsty)
> > > >  Jpeg2000Band *band = rlevel->band + bandno;
> > > >  for(precno = 0; precno < rlevel->num_precincts_x * 
> > > > rlevel->num_precincts_y; precno++) {
> > > >  Jpeg2000Prec *prec = band->prec + precno;
> > > > -ff_tag_tree_zero(prec->zerobits, 
> > > > prec->nb_codeblocks_width, prec->nb_codeblocks_height);
> > > > -ff_tag_tree_zero(prec->cblkincl, 
> > > > prec->nb_codeblocks_width, prec->nb_codeblocks_height);
> > > > +ff_tag_tree_zero(prec->zerobits, 
> > > > prec->nb_codeblocks_width, prec->nb_codeblocks_height, 0);
> > > > +ff_tag_tree_zero(prec->cblkincl, 
> > > > prec->nb_codeblocks_width, prec->nb_codeblocks_height, 0);
> > >
> > > this looks a bit like a somewhat unlrelated bugfix thats spread over this 
> > > and
> > > the next patch
> > > if so, that should be moved into a seperate patch
> > > the patches are already complex without an additional bugfix in them
> > >
> > This portion is a fix for what you pointed out yesterday saying that
> > the parent of a the
> > nodes are not getting set. I thought this would be an appropriate
> > patch to fix this. Do you
> > feel its better that this part is made separate though?
>
> > In my opinion, only this patch provides the bug fix and the next patch
> > just uses the fix.
> > Do correct me if I am wrong.
>
> IIUC the problem is that the tag trees are inefficient, so a bugfix would
> change the output files and make them bit smaller.
> the 1/3 & 2/3 patches do not change the output of any fate tests so they
> do not seem to fix this on their own. The 3/3 patch adds multi layer stuff
> so the bugfix seemed intermingled with that, which is what i thought was
> not optimal. Its not the end of the world if these are mixed but it should
> be for a very good reason then. For example if seperating the fix would be
> a unreasonable amount of work and make the changes alot more complex ...
> But in 99% of the cases bugfixes really should be seperate it makes
> understanding chnages, testing changes and also things like future regression
> testing easier.

So in that case, do I make this part a 4th patch in the series which fixes this
inefficiency?
>
> Thanks
>
> [...]
> --
> Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> No human being will ever know the Truth, for even if they happen to say it
> by chance, they would not even known they had done so. -- Xenophanes
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".



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

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

Re: [FFmpeg-devel] [PATCH v3 2/2] libavformat: add WebP demuxer

2020-08-26 Thread Andreas Rheinhardt
Josef Zlomek:
> Adds the demuxer of animated WebP files.
> It supports non-animated, animated, truncated, and concatenated files.
> Reading from a pipe (and other non-seekable inputs) is also supported.
> 
> The WebP demuxer splits the input stream into packets containing one frame.
> It also sets the timing information and marks the key frames properly.
> The loop count is ignored by default (same behaviour as animated PNG and GIF),
> it may be enabled by the option '-ignore_loop 0'.
> 
> Signed-off-by: Josef Zlomek 
> ---
>  Changelog   |   1 +
>  doc/demuxers.texi   |  28 +
>  libavformat/Makefile|   1 +
>  libavformat/allformats.c|   1 +
>  libavformat/webpdec.c   | 732 
>  tests/ref/fate/exif-image-webp  |   8 +-
>  tests/ref/fate/webp-rgb-lena-lossless   |   2 +-
>  tests/ref/fate/webp-rgb-lena-lossless-rgb24 |   2 +-
>  tests/ref/fate/webp-rgb-lossless|   2 +-
>  tests/ref/fate/webp-rgb-lossy-q80   |   2 +-
>  tests/ref/fate/webp-rgba-lossless   |   2 +-
>  tests/ref/fate/webp-rgba-lossy-q80  |   2 +-

Great that you also add so many tests for the new demuxer.

>  12 files changed, 773 insertions(+), 10 deletions(-)
>  create mode 100644 libavformat/webpdec.c
> 
> +if (headers && headers->data) {
> +uint8_t *side_data = av_memdup(headers->data, headers->size);
> +if (!side_data)
> +return AVERROR(ENOMEM);
> +
> +ret = av_packet_add_side_data(pkt, AV_PKT_DATA_NEW_EXTRADATA,
> +  side_data, headers->size);

It is better to use av_packet_new_side_data() here: It takes care of the
case when the buffer could be allocated, but reallocating the side-data
array fails; and it also adds padding to the allocated buffer. Side data
of type AV_PKT_DATA_NEW_EXTRADATA should have it.

> +if (ret < 0) {
> +av_free(side_data);
> +return ret;
> +}
> +
> +s->streams[0]->internal->need_context_update = 1;
> +s->streams[0]->codecpar->width  = headers->canvas_width;
> +s->streams[0]->codecpar->height = headers->canvas_height;
> +
> +// copy the fields needed for the key frame detection
> +wdc->canvas_width  = headers->canvas_width;
> +wdc->canvas_height = headers->canvas_height;
> +}
> +
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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

[FFmpeg-devel] [PATCH v3 1/2] libavcodec: add support for animated WebP decoding

2020-08-26 Thread Josef Zlomek
Fixes: 4907

Adds support for decoding of animated WebP.

The WebP parser now splits the input stream into packets containing one frame.

The WebP decoder adds the animation related features according to the specs:
https://developers.google.com/speed/webp/docs/riff_container#animation
The frames of the animation may be smaller than the image canvas.
Therefore, the frame is decoded to a temporary frame,
then it is blended into the canvas, the canvas is copied to the output frame,
and finally the frame is disposed from the canvas.

The output to AV_PIX_FMT_YUVA420P/AV_PIX_FMT_YUV420P is still supported.
The background color is specified only as BGRA in the WebP file
so it is converted to YUVA if YUV formats are output.

Signed-off-by: Josef Zlomek 
---
 Changelog|   1 +
 libavcodec/codec_desc.c  |   3 +-
 libavcodec/webp.c| 710 +++
 libavcodec/webp.h|  44 +++
 libavcodec/webp_parser.c | 132 +---
 5 files changed, 784 insertions(+), 106 deletions(-)
 create mode 100644 libavcodec/webp.h

diff --git a/Changelog b/Changelog
index 7467e73306..d2c36a524e 100644
--- a/Changelog
+++ b/Changelog
@@ -15,6 +15,7 @@ version :
 - Argonaut Games ASF muxer
 - AV1 Low overhead bitstream format demuxer
 - RPZA video encoder
+- animated WebP parser/decoder
 
 
 version 4.3:
diff --git a/libavcodec/codec_desc.c b/libavcodec/codec_desc.c
index 0ae6aee63b..410af59ce1 100644
--- a/libavcodec/codec_desc.c
+++ b/libavcodec/codec_desc.c
@@ -1251,8 +1251,7 @@ static const AVCodecDescriptor codec_descriptors[] = {
 .type  = AVMEDIA_TYPE_VIDEO,
 .name  = "webp",
 .long_name = NULL_IF_CONFIG_SMALL("WebP"),
-.props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY |
- AV_CODEC_PROP_LOSSLESS,
+.props = AV_CODEC_PROP_LOSSY | AV_CODEC_PROP_LOSSLESS,
 .mime_types= MT("image/webp"),
 },
 {
diff --git a/libavcodec/webp.c b/libavcodec/webp.c
index c6d0206846..015d14e297 100644
--- a/libavcodec/webp.c
+++ b/libavcodec/webp.c
@@ -35,12 +35,15 @@
  * Exif metadata
  * ICC profile
  *
+ * @author Josef Zlomek, Pexeso Inc. 
+ * Animation
+ *
  * Unimplemented:
- *   - Animation
  *   - XMP metadata
  */
 
 #include "libavutil/imgutils.h"
+#include "libavutil/colorspace.h"
 
 #define BITSTREAM_READER_LE
 #include "avcodec.h"
@@ -50,12 +53,7 @@
 #include "internal.h"
 #include "thread.h"
 #include "vp8.h"
-
-#define VP8X_FLAG_ANIMATION 0x02
-#define VP8X_FLAG_XMP_METADATA  0x04
-#define VP8X_FLAG_EXIF_METADATA 0x08
-#define VP8X_FLAG_ALPHA 0x10
-#define VP8X_FLAG_ICC   0x20
+#include "webp.h"
 
 #define MAX_PALETTE_SIZE256
 #define MAX_CACHE_BITS  11
@@ -188,6 +186,8 @@ typedef struct ImageContext {
 typedef struct WebPContext {
 VP8Context v;   /* VP8 Context used for lossy decoding 
*/
 GetBitContext gb;   /* bitstream reader for main image 
chunk */
+ThreadFrame canvas_frame;   /* ThreadFrame for canvas */
+AVFrame *frame; /* AVFrame for decoded frame */
 AVFrame *alpha_frame;   /* AVFrame for alpha data decompressed 
from VP8L */
 AVCodecContext *avctx;  /* parent AVCodecContext */
 int initialized;/* set once the VP8 context is 
initialized */
@@ -198,9 +198,24 @@ typedef struct WebPContext {
 int alpha_data_size;/* alpha chunk data size */
 int has_exif;   /* set after an EXIF chunk has been 
processed */
 int has_iccp;   /* set after an ICCP chunk has been 
processed */
-int width;  /* image width */
-int height; /* image height */
-int lossless;   /* indicates lossless or lossy */
+int vp8x_flags; /* global flags from VP8X chunk */
+int canvas_width;   /* canvas width */
+int canvas_height;  /* canvas height */
+int anmf_flags; /* frame flags from ANMF chunk */
+int width;  /* frame width */
+int height; /* frame height */
+int pos_x;  /* frame position X */
+int pos_y;  /* frame position Y */
+int prev_anmf_flags;/* previous frame flags from ANMF 
chunk */
+int prev_width; /* previous frame width */
+int prev_height;/* previous frame height */
+int prev_pos_x; /* previous frame position X */
+int prev_pos_y; /* previous frame position Y */
+int await_progress; /* value of progress to wait for */
+uint8_t background_argb[4]; /* background color in ARGB format */
+uint8

[FFmpeg-devel] [PATCH v3 2/2] libavformat: add WebP demuxer

2020-08-26 Thread Josef Zlomek
Adds the demuxer of animated WebP files.
It supports non-animated, animated, truncated, and concatenated files.
Reading from a pipe (and other non-seekable inputs) is also supported.

The WebP demuxer splits the input stream into packets containing one frame.
It also sets the timing information and marks the key frames properly.
The loop count is ignored by default (same behaviour as animated PNG and GIF),
it may be enabled by the option '-ignore_loop 0'.

Signed-off-by: Josef Zlomek 
---
 Changelog   |   1 +
 doc/demuxers.texi   |  28 +
 libavformat/Makefile|   1 +
 libavformat/allformats.c|   1 +
 libavformat/webpdec.c   | 732 
 tests/ref/fate/exif-image-webp  |   8 +-
 tests/ref/fate/webp-rgb-lena-lossless   |   2 +-
 tests/ref/fate/webp-rgb-lena-lossless-rgb24 |   2 +-
 tests/ref/fate/webp-rgb-lossless|   2 +-
 tests/ref/fate/webp-rgb-lossy-q80   |   2 +-
 tests/ref/fate/webp-rgba-lossless   |   2 +-
 tests/ref/fate/webp-rgba-lossy-q80  |   2 +-
 12 files changed, 773 insertions(+), 10 deletions(-)
 create mode 100644 libavformat/webpdec.c

diff --git a/Changelog b/Changelog
index d2c36a524e..cf46e74744 100644
--- a/Changelog
+++ b/Changelog
@@ -16,6 +16,7 @@ version :
 - AV1 Low overhead bitstream format demuxer
 - RPZA video encoder
 - animated WebP parser/decoder
+- animated WebP demuxer
 
 
 version 4.3:
diff --git a/doc/demuxers.texi b/doc/demuxers.texi
index 3c15ab9eee..f935c49b48 100644
--- a/doc/demuxers.texi
+++ b/doc/demuxers.texi
@@ -832,4 +832,32 @@ which in turn, acts as a ceiling for the size of scripts 
that can be read.
 Default is 1 MiB.
 @end table
 
+@section webp
+
+Animated WebP demuxer.
+
+It accepts the following options:
+
+@table @option
+@item -min_delay @var{int}
+Set the minimum valid delay between frames in milliseconds.
+Range is 0 to 6. Default value is 10.
+
+@item -max_webp_delay @var{int}
+Set the maximum valid delay between frames in milliseconds.
+Range is 0 to 16777215. Default value is 16777215 (over four hours),
+the maximum value allowed by the specification.
+
+@item -default_delay @var{int}
+Set the default delay between frames in milliseconds.
+Range is 0 to 6. Default value is 100.
+
+@item -ignore_loop @var{bool}
+WebP files can contain information to loop a certain number of times
+(or infinitely). If @option{ignore_loop} is set to true, then the loop
+setting from the input will be ignored and looping will not occur.
+If set to false, then looping will occur and will cycle the number
+of times according to the WebP. Default value is true.
+@end table
+
 @c man end DEMUXERS
diff --git a/libavformat/Makefile b/libavformat/Makefile
index cbb33fe37c..ce9a6a7b54 100644
--- a/libavformat/Makefile
+++ b/libavformat/Makefile
@@ -560,6 +560,7 @@ OBJS-$(CONFIG_WEBM_MUXER)+= matroskaenc.o 
matroska.o \
 wv.o vorbiscomment.o
 OBJS-$(CONFIG_WEBM_DASH_MANIFEST_MUXER)  += webmdashenc.o
 OBJS-$(CONFIG_WEBM_CHUNK_MUXER)  += webm_chunk.o
+OBJS-$(CONFIG_WEBP_DEMUXER)  += webpdec.o
 OBJS-$(CONFIG_WEBP_MUXER)+= webpenc.o
 OBJS-$(CONFIG_WEBVTT_DEMUXER)+= webvttdec.o subtitles.o
 OBJS-$(CONFIG_WEBVTT_MUXER)  += webvttenc.o
diff --git a/libavformat/allformats.c b/libavformat/allformats.c
index 0aa9dd7198..bc40fd 100644
--- a/libavformat/allformats.c
+++ b/libavformat/allformats.c
@@ -458,6 +458,7 @@ extern AVOutputFormat ff_webm_muxer;
 extern AVInputFormat  ff_webm_dash_manifest_demuxer;
 extern AVOutputFormat ff_webm_dash_manifest_muxer;
 extern AVOutputFormat ff_webm_chunk_muxer;
+extern AVInputFormat  ff_webp_demuxer;
 extern AVOutputFormat ff_webp_muxer;
 extern AVInputFormat  ff_webvtt_demuxer;
 extern AVOutputFormat ff_webvtt_muxer;
diff --git a/libavformat/webpdec.c b/libavformat/webpdec.c
new file mode 100644
index 00..0ad925ffd0
--- /dev/null
+++ b/libavformat/webpdec.c
@@ -0,0 +1,732 @@
+/*
+ * WebP demuxer
+ * Copyright (c) 2020 Pexeso Inc.
+ *
+ * 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
+ */
+
+/**
+ * @file
+ * WebP demuxer.
+ 

Re: [FFmpeg-devel] [RFC PATCH v5 2/3] libavcodec/j2kenc: Fix tag tree coding

2020-08-26 Thread Michael Niedermayer
On Wed, Aug 26, 2020 at 08:38:30AM +0530, Gautam Ramakrishnan wrote:
> On Wed, Aug 26, 2020 at 4:04 AM Michael Niedermayer
>  wrote:
> >
> > On Tue, Aug 25, 2020 at 07:25:44PM +0530, gautamr...@gmail.com wrote:
> > > From: Gautam Ramakrishnan 
> > >
> > > The implementation of tag tree encoding was incorrect.
> > > However, this error was not visible as the current j2k
> > > encoder encodes only 1 layer.
> > > This patch fixes tag tree coding for JPEG2000 such tag
> > > tree coding would work for multi layer encoding.
> >
> > [...]
> >
> > > diff --git a/libavcodec/jpeg2000.c b/libavcodec/jpeg2000.c
> > > index 26e09fbe38..2e26bc5b00 100644
> > > --- a/libavcodec/jpeg2000.c
> > > +++ b/libavcodec/jpeg2000.c
> > > @@ -82,12 +82,13 @@ static Jpeg2000TgtNode *ff_jpeg2000_tag_tree_init(int 
> > > w, int h)
> > >  return res;
> > >  }
> > >
> > > -void ff_tag_tree_zero(Jpeg2000TgtNode *t, int w, int h)
> > > +void ff_tag_tree_zero(Jpeg2000TgtNode *t, int w, int h, int val)
> > >  {
> > >  int i, siz = ff_tag_tree_size(w, h);
> > >
> > >  for (i = 0; i < siz; i++) {
> > > -t[i].val = 0;
> > > +t[i].val = val;
> > > +t[i].temp_val = 0;
> > >  t[i].vis = 0;
> > >  }
> > >  }
> > > @@ -567,8 +568,8 @@ void ff_jpeg2000_reinit(Jpeg2000Component *comp, 
> > > Jpeg2000CodingStyle *codsty)
> > >  Jpeg2000Band *band = rlevel->band + bandno;
> > >  for(precno = 0; precno < rlevel->num_precincts_x * 
> > > rlevel->num_precincts_y; precno++) {
> > >  Jpeg2000Prec *prec = band->prec + precno;
> > > -ff_tag_tree_zero(prec->zerobits, 
> > > prec->nb_codeblocks_width, prec->nb_codeblocks_height);
> > > -ff_tag_tree_zero(prec->cblkincl, 
> > > prec->nb_codeblocks_width, prec->nb_codeblocks_height);
> > > +ff_tag_tree_zero(prec->zerobits, 
> > > prec->nb_codeblocks_width, prec->nb_codeblocks_height, 0);
> > > +ff_tag_tree_zero(prec->cblkincl, 
> > > prec->nb_codeblocks_width, prec->nb_codeblocks_height, 0);
> >
> > this looks a bit like a somewhat unlrelated bugfix thats spread over this 
> > and
> > the next patch
> > if so, that should be moved into a seperate patch
> > the patches are already complex without an additional bugfix in them
> >
> This portion is a fix for what you pointed out yesterday saying that
> the parent of a the
> nodes are not getting set. I thought this would be an appropriate
> patch to fix this. Do you
> feel its better that this part is made separate though?

> In my opinion, only this patch provides the bug fix and the next patch
> just uses the fix.
> Do correct me if I am wrong.

IIUC the problem is that the tag trees are inefficient, so a bugfix would
change the output files and make them bit smaller.
the 1/3 & 2/3 patches do not change the output of any fate tests so they
do not seem to fix this on their own. The 3/3 patch adds multi layer stuff
so the bugfix seemed intermingled with that, which is what i thought was
not optimal. Its not the end of the world if these are mixed but it should
be for a very good reason then. For example if seperating the fix would be
a unreasonable amount of work and make the changes alot more complex ...
But in 99% of the cases bugfixes really should be seperate it makes
understanding chnages, testing changes and also things like future regression
testing easier.

Thanks

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

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


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

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