Re: [FFmpeg-devel] [PATCH v2 1/4] ffbuild: Refine MIPS handling

2020-06-04 Thread Shiyou Yin
For your convenience, I add the previous comments into this patch.

>-Original Message-
>From: ffmpeg-devel-boun...@ffmpeg.org [mailto:ffmpeg-devel-boun...@ffmpeg.org] 
>On Behalf Of
>Jiaxun Yang
>Sent: Tuesday, June 2, 2020 10:15 PM
>To: ffmpeg-devel@ffmpeg.org
>Cc: yinshi...@loongson.cn; Jiaxun Yang
>Subject: [FFmpeg-devel] [PATCH v2 1/4] ffbuild: Refine MIPS handling
>
>To enable runtime detection for MIPS, we need to refine ffbuild
>part to support buildding these feature together.
>
>Firstly, we fixed configure, let it probe native ability of toolchain
>to decide wether a feature can to be enabled, also clearly marked
>the conflictions between loongson2 & loongson3 and Release 6 & rest.
>
>Secondly, we compile MMI and MSA C sources with their own flags to ensure
>their flags won't pollute the whole program and generate illegal code.
>
>Signed-off-by: Jiaxun Yang 
>---
> configure| 179 +++
> ffbuild/common.mak   |  10 ++-
> libavcodec/mips/Makefile |   3 +-
> 3 files changed, 117 insertions(+), 75 deletions(-)
>
>diff --git a/configure b/configure
>index f97cad0298..8dc3874642 100755
>--- a/configure
>+++ b/configure
>@@ -1113,6 +1113,26 @@ void foo(void){ __asm__ volatile($code); }
> EOF
> }
>
>+check_extra_inline_asm_flags(){
>+log check_extra_inline_asm_flags "$@"
>+name="$1"
>+extra=$2
>+code="$3"
>+flags=''
>+shift 3
>+while [ "$1" != "" ]; do
>+  append flags $1
>+  shift
>+done;
>+disable $name
>+cat > $TMPC <+void foo(void){ __asm__ volatile($code); }
>+EOF
>+log_file $TMPC
>+test_cmd $cc $CPPFLAGS $CFLAGS $flags "$@" $CC_C $(cc_o $TMPO) $TMPC &&
>+enable $name && append $extra "$flags"
>+}
>+

You can use check_inline_asm. e.g. 
enabled msa && check_inline_asm msa '"addvi.b $w0, $w1, 1"' '-mmsa' && append 
MSAFLAGS '-mmsa'
enabled mmi && check_inline_asm mmi '"punpcklhw $f0, $f0, $f0"' 
"-mloongson-mmi" && append MMIFLAGS '-mloongson-mmi'
enabled loongson3 && check_inline_asm loongson3 '"gsldxc1 $f0, 0($2, $3)"' 
'-mloongson-ext' && append MMIFLAGS '-mloongson-ext'

> check_inline_asm_flags(){
> log check_inline_asm_flags "$@"
> name="$1"
>@@ -2551,7 +2571,7 @@ mips64r6_deps="mips"
> mipsfpu_deps="mips"
> mipsdsp_deps="mips"
> mipsdspr2_deps="mips"
>-mmi_deps="mips"
>+mmi_deps_any="loongson2 loongson3"
> msa_deps="mipsfpu"
> msa2_deps="msa"
>
>@@ -4999,29 +5019,57 @@ elif enabled bfin; then
>
> elif enabled mips; then

In this block, you only need to disable the unsupported extensions for each cpu 
case,
for all extensions in ARCH_EXT_LIST will be enabled by default.

>
>-cpuflags="-march=$cpu"
>-
> if [ "$cpu" != "generic" ]; then
>-disable mips32r2
>-disable mips32r5
>-disable mips64r2
>-disable mips32r6
>-disable mips64r6
>-disable loongson2
>-disable loongson3
>+# DSP is disabled by deafult as they can't be detected at runtime
>+disable mipsdsp
>+disable mipsdspr2
>+
>+cpuflags="-march=$cpu"
>
> case $cpu in
>-24kc|24kf*|24kec|34kc|1004kc|24kef*|34kf*|1004kf*|74kc|74kf)
>+# General ISA levels
>+mips1|mips3)
>+disable msa
>+;;
>+mips32r2)
> enable mips32r2

If you havn't disable it at the beginning of this if block, you needn’t enable 
it explicitly here.

>+;;
>+mips32r5)
>+enable mips32r5
>+;;
>+mips64r2|mips64r5)
>+enable mips64r2
>+;;
>+# Cores from MIPS(MTI)
>+24kc)
>+disable mipsfpu
>+;;
>+24kf*|24kec|34kc|74Kc|1004kc)
>+disable mmi
> disable msa
> ;;
>-p5600|i6400|p6600)
>-disable mipsdsp
>-disable mipsdspr2
>+24kef*|34kf*|1004kf*)
>+disable mmi
>+disable msa
>+enable mipsdsp
>+;;
>+p5600)
>+disable mmi
>+enable mips32r5
>+check_cflags "-mtune=p5600" && check_cflags "-msched-weight 
>-mload-store-pairs
>-funroll-loops"
>+;;
>+i6400)
>+disable mmi
>+enable mips64r6
>+check_cflags "-mtune=i6400 -mabi=64" && check_cflags 
>"-msched-weight
>-mload-store-pairs -funroll-loops" && check_ldflags "-mabi=64"
>+;;
>+p6600)
>+disable mmi
>+enable mips64r6
>+check_cflags "-mtune=p6600 -mabi=64" && check_cflags 
>"-msched-weight
>-mload-store-pairs -funroll-loops" && check_ldflags "-mabi=64"
> ;;
>+# Cores from Loongson
> loongson*)
>-enable loongson2
>-enable loongson3
> enable loca

[FFmpeg-devel] [RFC PATCH 2/2] fate/video.mak: fate test for jpeg2000 parser

2020-06-04 Thread gautamramk
From: Gautam Ramakrishnan 

This test generates a rawvideo video of jpeg2000 frames
using lavfi testsrc2 as input. The reference file as 25 frames.
---
 tests/fate-run.sh  |  4 +++-
 tests/fate/video.mak   |  3 +++
 tests/ref/fate/jpeg2000-parser | 32 
 3 files changed, 38 insertions(+), 1 deletion(-)
 create mode 100644 tests/ref/fate/jpeg2000-parser

diff --git a/tests/fate-run.sh b/tests/fate-run.sh
index 002944b010..28c74ecbc5 100755
--- a/tests/fate-run.sh
+++ b/tests/fate-run.sh
@@ -221,7 +221,9 @@ transcode(){
 ffprobe_opts=$7
 encfile="${outdir}/${test}.${enc_fmt}"
 test "$6" = -keep || cleanfiles="$cleanfiles $encfile"
-tsrcfile=$(target_path $srcfile)
+test $src_fmt = "lavfi" ||\
+tsrcfile=$(target_path $srcfile) &&\
+tsrcfile=$srcfile
 tencfile=$(target_path $encfile)
 ffmpeg -f $src_fmt $DEC_OPTS -i $tsrcfile $ENC_OPTS $enc_opt $FLAGS \
 -f $enc_fmt -y $tencfile || return
diff --git a/tests/fate/video.mak b/tests/fate/video.mak
index d2d43e518d..c8d2e66b4a 100644
--- a/tests/fate/video.mak
+++ b/tests/fate/video.mak
@@ -192,6 +192,9 @@ fate-interplay-mve-16bit: CMD = framecrc -i 
$(TARGET_SAMPLES)/interplay-mve/desc
 FATE_VIDEO-$(call DEMDEC, MXF, JPEG2000) += fate-jpeg2000-dcinema
 fate-jpeg2000-dcinema: CMD = framecrc -flags +bitexact -c:v jpeg2000 -i 
$(TARGET_SAMPLES)/jpeg2000/chiens_dcinema2K.mxf -pix_fmt xyz12le
 
+FATE_VIDEO-$(call DEMDEC, MXF, JPEG2000) += fate-jpeg2000-parser
+fate-jpeg2000-parser: CMD = transcode lavfi "testsrc2=s=640x480" rawvideo "-t 
1 -c:v jpeg2000"
+
 FATE_VIDEO-$(call DEMDEC, JV, JV) += fate-jv
 fate-jv: CMD = framecrc -i $(TARGET_SAMPLES)/jv/intro.jv -an -pix_fmt rgb24
 
diff --git a/tests/ref/fate/jpeg2000-parser b/tests/ref/fate/jpeg2000-parser
new file mode 100644
index 00..f30e27a24e
--- /dev/null
+++ b/tests/ref/fate/jpeg2000-parser
@@ -0,0 +1,32 @@
+d2ea224b9c7319e5240af18260e82c4d *tests/data/fate/jpeg2000-parser.rawvideo
+1511061 tests/data/fate/jpeg2000-parser.rawvideo
+#tb 0: 1/25
+#media_type 0: video
+#codec_id 0: rawvideo
+#dimensions 0: 640x480
+#sar 0: 0/1
+0,  0,  0,1,   460800, 0x82d0c5fe
+0,  1,  1,1,   460800, 0x1bf42314
+0,  2,  2,1,   460800, 0x2d5598d4
+0,  3,  3,1,   460800, 0x159e4c0b
+0,  4,  4,1,   460800, 0x0652826a
+0,  5,  5,1,   460800, 0x23f718f4
+0,  6,  6,1,   460800, 0xc56cb13c
+0,  7,  7,1,   460800, 0x2ba79edd
+0,  8,  8,1,   460800, 0x8b2f8adb
+0,  9,  9,1,   460800, 0x5e9d58e9
+0, 10, 10,1,   460800, 0xf655492b
+0, 11, 11,1,   460800, 0xa590743b
+0, 12, 12,1,   460800, 0xbaa67b19
+0, 13, 13,1,   460800, 0x4ca64768
+0, 14, 14,1,   460800, 0x43978755
+0, 15, 15,1,   460800, 0x173a7c5c
+0, 16, 16,1,   460800, 0x3135a88e
+0, 17, 17,1,   460800, 0x17cbea25
+0, 18, 18,1,   460800, 0x21c222ab
+0, 19, 19,1,   460800, 0x7444efcf
+0, 20, 20,1,   460800, 0x860921d2
+0, 21, 21,1,   460800, 0x9ea5a718
+0, 22, 22,1,   460800, 0xb8c1a9d7
+0, 23, 23,1,   460800, 0xe4214b2c
+0, 24, 24,1,   460800, 0x3f00181d
-- 
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 1/2] libavcodec/jpeg2000_parser: Add jpeg2000 parser

2020-06-04 Thread gautamramk
From: Gautam Ramakrishnan 

I have attempted to write a JPEG2000 Parser. Have tested
by generating a file containing 14 frames, as mentioned
by Micheal. Have also tried testing with various packet
sizes by setting -frame_size option.
---
 libavcodec/Makefile  |   1 +
 libavcodec/jpeg2000_parser.c | 190 +++
 libavcodec/parsers.c |   1 +
 3 files changed, 192 insertions(+)
 create mode 100644 libavcodec/jpeg2000_parser.c

diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 0a3bbc7128..5a6ea59715 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -1074,6 +1074,7 @@ OBJS-$(CONFIG_H261_PARSER) += h261_parser.o
 OBJS-$(CONFIG_H263_PARSER) += h263_parser.o
 OBJS-$(CONFIG_H264_PARSER) += h264_parser.o h264_sei.o h264data.o
 OBJS-$(CONFIG_HEVC_PARSER) += hevc_parser.o hevc_data.o
+OBJS-$(CONFIG_JPEG2000_PARSER) += jpeg2000_parser.o
 OBJS-$(CONFIG_MJPEG_PARSER)+= mjpeg_parser.o
 OBJS-$(CONFIG_MLP_PARSER)  += mlp_parse.o mlp_parser.o mlp.o
 OBJS-$(CONFIG_MPEG4VIDEO_PARSER)   += mpeg4video_parser.o h263.o \
diff --git a/libavcodec/jpeg2000_parser.c b/libavcodec/jpeg2000_parser.c
new file mode 100644
index 00..06571d30e3
--- /dev/null
+++ b/libavcodec/jpeg2000_parser.c
@@ -0,0 +1,190 @@
+/*
+ * JPEG2000 parser
+ * Copyright (c) 2020 Gautam Ramakrishnan
+ *
+ * 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
+ * JPEG2000 parser.
+ */
+
+#include "parser.h"
+
+/* Whether frame is jp2 file or codestream
+*/
+enum frame_type {
+jp2_file = 1,
+j2k_cstream
+};
+
+typedef struct JPEG2000ParserContext{
+ParseContext pc;
+uint64_t bytes_read;
+uint64_t fheader_state;
+uint32_t skip_bytes; // skip bytes inside codestream data
+enum frame_type ft; // 1 if file, 2 if codestream
+uint8_t fheader_read; // are we reading
+uint8_t reading_file_header;
+uint8_t skipped_codestream;
+uint8_t codestream_frame_end;
+uint8_t read_tp;
+uint8_t in_codestream;
+}JPEG2000ParserContext;
+
+static inline void reset_context(JPEG2000ParserContext *m)
+{
+ParseContext *pc = &m->pc;
+
+pc->frame_start_found= 0;
+pc->state = 0;
+m->bytes_read = 0;
+m->ft = 0;
+m->skipped_codestream = 0;
+m->fheader_read = 0;
+m->codestream_frame_end = 0;
+m->skip_bytes = 0;
+m->read_tp = 0;
+m->in_codestream = 0;
+}
+
+/* Returns 1 if marker has any data which can be skipped
+*/
+static uint8_t info_marker(uint16_t marker)
+{
+if (marker == 0xFF92 || marker == 0xFF4F ||
+marker == 0xFF90 || marker == 0xFF93 ||
+marker == 0xFFD9)
+return 0;
+else
+if (marker > 0xFF00) return 1;
+return 0;
+}
+
+/**
+ * Find the end of the current frame in the bitstream.
+ * @return the position of the first byte of the next frame, or -1
+ */
+static int find_frame_end(JPEG2000ParserContext *m, const uint8_t *buf, int 
buf_size)
+{
+ParseContext *pc= &m->pc;
+int i;
+uint32_t state;
+uint64_t state64;
+state= pc->state;
+state64 = pc->state64;
+if (buf_size == 0) {
+return 0;
+}
+
+for (i = 0; i < buf_size; i++) {
+state = state << 8 | buf[i];
+state64 = state64 << 8 | buf[i];
+m->bytes_read++;
+if (m->skip_bytes) {
+m->skip_bytes--;
+continue;
+}
+if (m->codestream_frame_end) {
+reset_context(m);
+return i;
+}
+if (m->read_tp) { // Find out how many bytes inside Tile part 
codestream to skip.
+if (m->read_tp == 1){
+m->skip_bytes = (state64 & 0x) - 10 > 0?
+(state64 & 0x) - 10 : 0;
+}
+m->read_tp--;
+}
+if (m->fheader_read) {
+if (m->fheader_read == 1) {
+if (state64 == 0x6A5020200D0A870A) { // JP2 signature box 
value.
+if (pc->frame_start_found) {
+pc->frame_start_found = 0;
+reset_context(m);
+return i - 11;
+} else {
+pc->frame_start

[FFmpeg-devel] [PATCH] avcodec/nvenc: maxBitrate is honored in CQ mode if set by user

2020-06-04 Thread Roman Arzumanyan
This fixes bug in my previous patch which was discarding maxBitrate.
CQ mode shall honor maxBitrate value if it's set by user via CLI.
How to check:

./ffmpeg.exe \
  -i big_buck_bunny_1080p_h264.mov \
  -c:v h264_nvenc \
  -cq 10 \
  -maxrate 10M \
  -y output_cq10_10M.mp4

--
BR, Roman Arzumanyan



0001-Fixing-bug-in-CQ-RC-mode.-Max-bitrate-is-honored-if-.patch
Description: 0001-Fixing-bug-in-CQ-RC-mode.-Max-bitrate-is-honored-if-.patch
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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

Re: [FFmpeg-devel] [PATCH] avformat/dashenc: use AVCodecContext timebase when computing missing bitrate

2020-06-04 Thread Przemysław Sobala
On Tue, Jun 2, 2020 at 10:19 AM Przemysław Sobala <
przemyslaw.sob...@gmail.com> wrote:

> On Mon, Jun 1, 2020 at 3:30 PM Jeyapal, Karthick 
> wrote:
>
>>
>> On 6/1/20 5:24 PM, Przemysław Sobala wrote:
>> > On Mon, Jun 1, 2020 at 10:06 AM Anton Khirnov 
>> wrote:
>> >
>> >> Quoting Przemysław Sobala (2020-05-27 17:07:22)
>> >>> ---
>> >>>  libavformat/dashenc.c | 2 +-
>> >>>  1 file changed, 1 insertion(+), 1 deletion(-)
>> >>>
>> >>> diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c
>> >>> index 0cf0df50ef..00a37b175d 100644
>> >>> --- a/libavformat/dashenc.c
>> >>> +++ b/libavformat/dashenc.c
>> >>> @@ -1959,7 +1959,7 @@ static int dash_flush(AVFormatContext *s, int
>> >> final, int stream)
>> >>>
>> >>>  if (!os->bit_rate) {
>> >>>  // calculate average bitrate of first segment
>> >>> -int64_t bitrate = (int64_t) range_length * 8 *
>> AV_TIME_BASE
>> >> / duration;
>> >>> +int64_t bitrate = (int64_t) range_length * 8 *
>> >> (c->use_timeline ? os->ctx->streams[0]->time_base.den : AV_TIME_BASE) /
>> >> duration;
>> >>
>> >> That does not look like an AVCodecContext
>> >>
>> >
>> > Of course not. time_base is AVStream's field. I don't know why I wrote
>> > AVCodecContext... Please amend that commit message if possible.
>> Amended and Pushed!
>>
>> Thanks,
>> Karthick
>>
>>
> Thanks.
> What do you think about computing an average bitrate for all segments, not
> only the first one (in case of a static - not dynamic - DASH manifest), if
> one would not want to specify bitrate while encoding using x264 CRF rate
> control? I could prepare such a patch that, if bitrate is not specified,
> it'd be computed at the end, for static manifest, for all segments. It'd be
> more accurate comparing to the first segment's bitrate.
>

Any comments about that?

--
pozdrawiam
Przemysław Sobala
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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

Re: [FFmpeg-devel] [PATCH] avcodec: remove FLAG2_FAST mode

2020-06-04 Thread Kieran Kunhya
On Thu, 4 Jun 2020 at 00:05, Michael Niedermayer 
wrote:

> On Wed, Jun 03, 2020 at 06:23:27PM +0100, Kieran Kunhya wrote:
> > $subj
>
> >  fftools/ffplay.c   |5
> >  libavcodec/avcodec.h   |4
> >  libavcodec/h264_slice.c|6
> >  libavcodec/mpeg12dec.c |  273
> -
> >  libavcodec/options_table.h |1
> >  tools/target_dec_fuzzer.c  |2
> >  6 files changed, 291 deletions(-)
> > 7edbcba8bf53b74a9621b7e641b2b4b43ab2c79e  fasterthanlight.diff
> > From bb28e7f70dd77d13ea82aca73227f422af80ec7b Mon Sep 17 00:00:00 2001
> > From: Kieran Kunhya 
> > Date: Wed, 3 Jun 2020 18:21:28 +0100
> > Subject: [PATCH] avcodec: remove FLAG2_FAST mode
>
> I would like to keep this feature. And iam maintaining it.


If you are maintaining this feature, why does the code say that it will
crash on corrupt streams?
https://github.com/FFmpeg/FFmpeg/blob/master/libavcodec/mpeg12dec.c#L224

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

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

Re: [FFmpeg-devel] [PATCH] avformat/dashenc: use AVCodecContext timebase when computing missing bitrate

2020-06-04 Thread Jeyapal, Karthick

On 6/4/20 1:29 PM, Przemysław Sobala wrote:
> On Tue, Jun 2, 2020 at 10:19 AM Przemysław Sobala <
> przemyslaw.sob...@gmail.com> wrote:
>
>> On Mon, Jun 1, 2020 at 3:30 PM Jeyapal, Karthick 
>> wrote:
>>
>>>
>>> On 6/1/20 5:24 PM, Przemysław Sobala wrote:
 On Mon, Jun 1, 2020 at 10:06 AM Anton Khirnov 
>>> wrote:

> Quoting Przemysław Sobala (2020-05-27 17:07:22)
>> ---
>>  libavformat/dashenc.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c
>> index 0cf0df50ef..00a37b175d 100644
>> --- a/libavformat/dashenc.c
>> +++ b/libavformat/dashenc.c
>> @@ -1959,7 +1959,7 @@ static int dash_flush(AVFormatContext *s, int
> final, int stream)
>>
>>  if (!os->bit_rate) {
>>  // calculate average bitrate of first segment
>> -int64_t bitrate = (int64_t) range_length * 8 *
>>> AV_TIME_BASE
> / duration;
>> +int64_t bitrate = (int64_t) range_length * 8 *
> (c->use_timeline ? os->ctx->streams[0]->time_base.den : AV_TIME_BASE) /
> duration;
>
> That does not look like an AVCodecContext
>

 Of course not. time_base is AVStream's field. I don't know why I wrote
 AVCodecContext... Please amend that commit message if possible.
>>> Amended and Pushed!
>>>
>>> Thanks,
>>> Karthick
>>>
>>>
>> Thanks.
>> What do you think about computing an average bitrate for all segments, not
>> only the first one (in case of a static - not dynamic - DASH manifest), if
>> one would not want to specify bitrate while encoding using x264 CRF rate
>> control? I could prepare such a patch that, if bitrate is not specified,
>> it'd be computed at the end, for static manifest, for all segments. It'd be
>> more accurate comparing to the first segment's bitrate.
>>
>
> Any comments about that?
Any patch that fixes/improves the current behavior is always welcome :)
>
> --
> pozdrawiam
> Przemysław Sobala
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://urldefense.proofpoint.com/v2/url?u=https-3A__ffmpeg.org_mailman_listinfo_ffmpeg-2Ddevel&d=DwIGaQ&c=96ZbZZcaMF4w0F4jpN6LZg&r=xOoesbz-6ff1GPXp5Lg4jf1ZG99yp4a1qhxVn_YOwRU&m=q7hq8J8ltTngyTvXBudpQq8HN4Ure-eQJZiCG85-TgI&s=pM0LIY83Tgww_6eGlIuJe7lzdcfZcKoqyH2rMDz396E&e=
>  
>
> 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] pthread_frame: change the way delay is set

2020-06-04 Thread Anton Khirnov
It is a constant known at codec init, so set it in
ff_frame_thread_init(). Also, only set it for video, since the meaning
of this field is not well-defined for audio with frame threading.

Fixes availability of delay in callbacks invoked from the per-thread
contexts after 1f4cf92cfbd3accbae582ac63126ed5570ddfd37.
---
 libavcodec/pthread_frame.c | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/libavcodec/pthread_frame.c b/libavcodec/pthread_frame.c
index 64121f5a9a..601f170447 100644
--- a/libavcodec/pthread_frame.c
+++ b/libavcodec/pthread_frame.c
@@ -310,7 +310,6 @@ static int update_context_from_thread(AVCodecContext *dst, 
AVCodecContext *src,
 }
 
 if (for_user) {
-dst->delay   = src->thread_count - 1;
 #if FF_API_CODED_FRAME
 FF_DISABLE_DEPRECATION_WARNINGS
 dst->coded_frame = src->coded_frame;
@@ -790,6 +789,9 @@ int ff_frame_thread_init(AVCodecContext *avctx)
 fctx->async_lock = 1;
 fctx->delaying = 1;
 
+if (codec->type == AVMEDIA_TYPE_VIDEO)
+avctx->delay = src->thread_count - 1;
+
 for (i = 0; i < thread_count; i++) {
 AVCodecContext *copy = av_malloc(sizeof(AVCodecContext));
 PerThreadContext *p  = &fctx->threads[i];
@@ -827,6 +829,8 @@ int ff_frame_thread_init(AVCodecContext *avctx)
 copy->internal->thread_ctx = p;
 copy->internal->last_pkt_props = &p->avpkt;
 
+copy->delay = avctx->delay;
+
 if (codec->priv_data_size) {
 copy->priv_data = av_mallocz(codec->priv_data_size);
 if (!copy->priv_data) {
-- 
2.26.2

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

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

Re: [FFmpeg-devel] [PATCH] lavf/tee: pass options to protocol.

2020-06-04 Thread Nicolas George
Marvin Scholz (12020-06-03):
> Oh whoops I completely overlooked that and got confused by the command line
> on the
> ticket itself.
> That indeed works fine now with your patch, thanks a lot for the fix, as
> this
> greatly simplifies sourcing different icecast mountpoints at once for
> testing.

Thanks for the confirmation.

I just pushed the patch.

I think it is a candidate for back-porting.

Regards,

-- 
  Nicolas George


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

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

Re: [FFmpeg-devel] [PATCH 11/17] avflter: switch to child_class_iterate()

2020-06-04 Thread Moritz Barsnick
On Thu, May 28, 2020 at 22:15:53 +0200, Anton Khirnov wrote:

> Subject: [PATCH 11/17] avflter: switch to child_class_iterate()

Nit: avfilter

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] avformat/dashenc: use AVCodecContext timebase when computing missing bitrate

2020-06-04 Thread Przemysław Sobala
On Thu, Jun 4, 2020 at 11:24 AM Jeyapal, Karthick 
wrote:

>
> On 6/4/20 1:29 PM, Przemysław Sobala wrote:
> > On Tue, Jun 2, 2020 at 10:19 AM Przemysław Sobala <
> > przemyslaw.sob...@gmail.com> wrote:
> >
> >> On Mon, Jun 1, 2020 at 3:30 PM Jeyapal, Karthick 
> >> wrote:
> >>
> >>>
> >>> On 6/1/20 5:24 PM, Przemysław Sobala wrote:
>  On Mon, Jun 1, 2020 at 10:06 AM Anton Khirnov 
> >>> wrote:
> 
> > Quoting Przemysław Sobala (2020-05-27 17:07:22)
> >> ---
> >>  libavformat/dashenc.c | 2 +-
> >>  1 file changed, 1 insertion(+), 1 deletion(-)
> >>
> >> diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c
> >> index 0cf0df50ef..00a37b175d 100644
> >> --- a/libavformat/dashenc.c
> >> +++ b/libavformat/dashenc.c
> >> @@ -1959,7 +1959,7 @@ static int dash_flush(AVFormatContext *s, int
> > final, int stream)
> >>
> >>  if (!os->bit_rate) {
> >>  // calculate average bitrate of first segment
> >> -int64_t bitrate = (int64_t) range_length * 8 *
> >>> AV_TIME_BASE
> > / duration;
> >> +int64_t bitrate = (int64_t) range_length * 8 *
> > (c->use_timeline ? os->ctx->streams[0]->time_base.den :
> AV_TIME_BASE) /
> > duration;
> >
> > That does not look like an AVCodecContext
> >
> 
>  Of course not. time_base is AVStream's field. I don't know why I wrote
>  AVCodecContext... Please amend that commit message if possible.
> >>> Amended and Pushed!
> >>>
> >>> Thanks,
> >>> Karthick
> >>>
> >>>
> >> Thanks.
> >> What do you think about computing an average bitrate for all segments,
> not
> >> only the first one (in case of a static - not dynamic - DASH manifest),
> if
> >> one would not want to specify bitrate while encoding using x264 CRF rate
> >> control? I could prepare such a patch that, if bitrate is not specified,
> >> it'd be computed at the end, for static manifest, for all segments.
> It'd be
> >> more accurate comparing to the first segment's bitrate.
> >>
> >
> > Any comments about that?
> Any patch that fixes/improves the current behavior is always welcome :)
>

I was thinking about something like (diff against release/4.2 branch):


$ git diff origin/release/4.2 -- libavformat/dashenc.c
diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c
index f0e45da89ad..60250b6d33a 100644
--- a/libavformat/dashenc.c
+++ b/libavformat/dashenc.c
@@ -88,6 +88,7 @@ typedef struct OutputStream {
 int64_t first_pts, start_pts, max_pts;
 int64_t last_dts, last_pts;
 int bit_rate;
+double average_bit_rate;
 SegmentType segment_type;  /* segment type selected for this
particular stream */
 const char *format_name;
 const char *extension_name;
@@ -775,6 +776,9 @@ static int write_adaptation_set(AVFormatContext *s,
AVIOContext *out, int as_ind
 if (os->bit_rate > 0)
 snprintf(bandwidth_str, sizeof(bandwidth_str), "
bandwidth=\"%d\"",
  os->bit_rate);
+else if (final)
+snprintf(bandwidth_str, sizeof(bandwidth_str), "
bandwidth=\"%d\"",
+ (int) os->average_bit_rate);

 if (as->media_type == AVMEDIA_TYPE_VIDEO) {
 AVStream *st = s->streams[i];
@@ -1618,12 +1622,10 @@ static int dash_flush(AVFormatContext *s, int
final, int stream)
 os->total_pkt_size = 0;

 if (!os->bit_rate) {
-// calculate average bitrate of first segment
-int64_t bitrate = (int64_t) range_length * 8 * AV_TIME_BASE /
av_rescale_q(os->max_pts - os->start_pts,
-
st->time_base,
-
AV_TIME_BASE_Q);
-if (bitrate >= 0)
-os->bit_rate = bitrate;
+// calculate average bitrate
+int64_t duration = av_rescale_q(os->max_pts - os->start_pts,
st->time_base, AV_TIME_BASE_Q);
+int64_t segment_bitrate = (int64_t) range_length * 8 *
AV_TIME_BASE / duration;
+os->average_bit_rate = (os->average_bit_rate *
(os->segment_index - 1) + segment_bitrate) / os->segment_index;
 }
 add_segment(os, os->filename, os->start_pts, os->max_pts -
os->start_pts, os->pos, range_length, index_length, next_exp_index);
 av_log(s, AV_LOG_VERBOSE, "Representation %d media segment %d
written to: %s\n", i, os->segment_index, os->full_path);


This patch allows to compute the average bitrate for all segments and write
it inside a static manifest.
Unfortunately, for dynamic manifest, the bitrate, if not specified by
client, is not computed at all, and I have no idea how to handle that.
Previously, bitrate for dynamic manifest, if not specified by client, was
computed only for the first segment. I could introduce another field
"first_segment_bitrate" in struct OutputStream and fill the manifest with
that value, as long as it's not a static one, to preserve that behavior.

--
regards
Przemysław Sobala
___
ffmpeg-devel mailin

[FFmpeg-devel] [PATCH 2/3] lavf/hls: Add missed side data/disposition

2020-06-04 Thread Jun Zhao
From: vacingfang 

hls demuxer get the strem info form sub-stream, but missed sida
data/disposition part, e,g, missed the DOVI sida data when the
stream is Dolby Vision streams.

Signed-off-by: vacingfang 
---
 libavformat/hls.c | 14 ++
 1 file changed, 14 insertions(+)

diff --git a/libavformat/hls.c b/libavformat/hls.c
index 3e35d15..c9b8fb7 100644
--- a/libavformat/hls.c
+++ b/libavformat/hls.c
@@ -1740,6 +1740,20 @@ static int set_stream_info_from_input_stream(AVStream 
*st, struct playlist *pls,
 else
 avpriv_set_pts_info(st, ist->pts_wrap_bits, ist->time_base.num, 
ist->time_base.den);
 
+// copy disposition
+st->disposition = ist->disposition;
+
+// copy side data
+for (int i = 0; i < ist->nb_side_data; i++) {
+const AVPacketSideData *sd_src = &ist->side_data[i];
+uint8_t *dst_data;
+
+dst_data = av_stream_new_side_data(st, sd_src->type, sd_src->size);
+if (!dst_data)
+return AVERROR(ENOMEM);
+memcpy(dst_data, sd_src->data, sd_src->size);
+}
+
 st->internal->need_context_update = 1;
 
 return 0;
-- 
2.7.4

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

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

[FFmpeg-devel] [PATCH 3/3] lavf/dashdec: Add missed side data/disposition

2020-06-04 Thread Jun Zhao
From: Jun Zhao 

dash demuxer get the strem info form sub-stream, but missed sida
data/disposition part, e,g, missed the DOVI sida data when the
stream is Dolby Vision streams

Signed-off-by: Jun Zhao 
---
 libavformat/dashdec.c | 14 ++
 1 file changed, 14 insertions(+)

diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c
index ec2aadc..694782c 100644
--- a/libavformat/dashdec.c
+++ b/libavformat/dashdec.c
@@ -2001,6 +2001,20 @@ static int open_demux_for_component(AVFormatContext *s, 
struct representation *p
 st->id = i;
 avcodec_parameters_copy(st->codecpar, ist->codecpar);
 avpriv_set_pts_info(st, ist->pts_wrap_bits, ist->time_base.num, 
ist->time_base.den);
+
+// copy disposition
+st->disposition = ist->disposition;
+
+// copy side data
+for (int i = 0; i < ist->nb_side_data; i++) {
+const AVPacketSideData *sd_src = &ist->side_data[i];
+uint8_t *dst_data;
+
+dst_data = av_stream_new_side_data(st, sd_src->type, sd_src->size);
+if (!dst_data)
+return AVERROR(ENOMEM);
+memcpy(dst_data, sd_src->data, sd_src->size);
+}
 }
 
 return 0;
-- 
2.7.4

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

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

[FFmpeg-devel] [PATCH 1/3] fftools/ffmpeg: cosmetics

2020-06-04 Thread Jun Zhao
From: Jun Zhao 

Signed-off-by: Jun Zhao 
---
 fftools/ffmpeg.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
index 2e9448e..93a86b9 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -3118,8 +3118,7 @@ static int init_output_stream_streamcopy(OutputStream 
*ost)
  (AVRational){ par_dst->height, par_dst->width });
 av_log(NULL, AV_LOG_WARNING, "Overriding aspect ratio "
"with stream copy may produce invalid files\n");
-}
-else if (ist->st->sample_aspect_ratio.num)
+} else if (ist->st->sample_aspect_ratio.num)
 sar = ist->st->sample_aspect_ratio;
 else
 sar = par_src->sample_aspect_ratio;
-- 
2.7.4

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

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

Re: [FFmpeg-devel] [PATCH] avcodec/nvenc: maxBitrate is honored in CQ mode if set by user

2020-06-04 Thread Timo Rothenpieler

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

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

Re: [FFmpeg-devel] [PATCH] avformat/utils: Find a fallback probe decoder that will also match a forced decoder's codec.

2020-06-04 Thread Michael Niedermayer
On Wed, Jun 03, 2020 at 07:15:28AM -0400, Samuel Foss wrote:
> Prevent codecpar->codec_id from getting out of sync with the codec 
> instantiated for probing.
> 
> Signed-off-by: Samuel Foss 
> ---
>  libavformat/utils.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

will apply

thx

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

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


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

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

Re: [FFmpeg-devel] [PATCH 1/3] avcodec/bitpacked: ,

2020-06-04 Thread Michael Niedermayer
On Thu, Jun 04, 2020 at 03:11:12AM +0200, James Darnley wrote:
> On 2020-06-04 01:19, Michael Niedermayer wrote:
> > Fixes: array end overread
> > Fixes: 
> > 22395/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_BITPACKED_fuzzer-5760940300828672
> > 
> > Found-by: continuous fuzzing process 
> > https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> > Signed-off-by: Michael Niedermayer 
> > ---
> >  libavcodec/bitpacked.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/libavcodec/bitpacked.c b/libavcodec/bitpacked.c
> > index be7d1e3629..952ba73a32 100644
> > --- a/libavcodec/bitpacked.c
> > +++ b/libavcodec/bitpacked.c
> > @@ -147,7 +147,7 @@ AVCodec ff_bitpacked_decoder = {
> >  .decode = bitpacked_decode,
> >  .capabilities = AV_CODEC_CAP_EXPERIMENTAL,
> >  .codec_tags = (const uint32_t []){
> > -MKTAG('U', 'Y', 'V', 'Y')
> > +MKTAG('U', 'Y', 'V', 'Y'),
> >  FF_CODEC_TAGS_END,
> >  },
> >  };
> > 
> 
> I think you should add to the commit title.  Something like "add missing
> comma to codec tags".

sure, will apply with that

thx

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

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


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

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

Re: [FFmpeg-devel] [PATCH 3/3] avcodec/wavpack: Do not allow the sample format to change between channels

2020-06-04 Thread David Bryant
On 6/3/20 4:19 PM, Michael Niedermayer wrote:
> Fixes: out of array access
> Fixes: 
> 22692/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WAVPACK_fuzzer-5678686190960640
>
> Found-by: continuous fuzzing process 
> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer 
> ---
>  libavcodec/wavpack.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/libavcodec/wavpack.c b/libavcodec/wavpack.c
> index ead57063c8..f77548e5a5 100644
> --- a/libavcodec/wavpack.c
> +++ b/libavcodec/wavpack.c
> @@ -1129,6 +1129,9 @@ static int wavpack_decode_block(AVCodecContext *avctx, 
> int block_no,
>  else
>  sample_fmt  = AV_SAMPLE_FMT_S32P;
>  
> +if (wc->ch_offset && avctx->sample_fmt != sample_fmt)
> +return AVERROR_INVALIDDATA;
> +
>  bpp= av_get_bytes_per_sample(sample_fmt);
>  orig_bpp   = ((s->frame_flags & 0x03) + 1) << 3;
>  multiblock = (s->frame_flags & WV_SINGLE_BLOCK) != WV_SINGLE_BLOCK;

Looks reasonable to me and passes my local test suite. Thanks!

-David


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

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

[FFmpeg-devel] [PATCH] libavcodec/png_parser.c: fix a use_of_uninitialized_value in target_dec_fuzzer.

2020-06-04 Thread Thierry Foucu
target_dec_fuzzer is checking for the avpkt.data pointer but if the
png parser cannot combine the frame, the poutbuf is not set and so, the
avpkt.data is not initialized.
---
 libavcodec/png_parser.c | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/libavcodec/png_parser.c b/libavcodec/png_parser.c
index 74f2964118..d1b2926154 100644
--- a/libavcodec/png_parser.c
+++ b/libavcodec/png_parser.c
@@ -99,8 +99,11 @@ static int png_parse(AVCodecParserContext *s, AVCodecContext 
*avctx,
 }
 
 flush:
-if (ff_combine_frame(&ppc->pc, next, &buf, &buf_size) < 0)
+if (ff_combine_frame(&ppc->pc, next, &buf, &buf_size) < 0) {
+*poutbuf = NULL;
+*poutbuf_size = 0;
 return buf_size;
+}
 
 ppc->chunk_pos = ppc->pc.frame_start_found = 0;
 
-- 
2.27.0.rc2.251.g90737beb825-goog

___
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/png_parser.c: fix a use_of_uninitialized_value in target_dec_fuzzer.

2020-06-04 Thread James Almer
On 6/4/2020 3:40 PM, Thierry Foucu wrote:
> target_dec_fuzzer is checking for the avpkt.data pointer but if the
> png parser cannot combine the frame, the poutbuf is not set and so, the
> avpkt.data is not initialized.
> ---
>  libavcodec/png_parser.c | 5 -
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/libavcodec/png_parser.c b/libavcodec/png_parser.c
> index 74f2964118..d1b2926154 100644
> --- a/libavcodec/png_parser.c
> +++ b/libavcodec/png_parser.c
> @@ -99,8 +99,11 @@ static int png_parse(AVCodecParserContext *s, 
> AVCodecContext *avctx,
>  }
>  
>  flush:
> -if (ff_combine_frame(&ppc->pc, next, &buf, &buf_size) < 0)
> +if (ff_combine_frame(&ppc->pc, next, &buf, &buf_size) < 0) {
> +*poutbuf = NULL;
> +*poutbuf_size = 0;

This is already set to 0 first thing in png_parse(), so i'd say we
should also set *poutbuf to NULL there instead.

And I see the BMP parser has the same issue, so it needs the same fix.

>  return buf_size;
> +}
>  
>  ppc->chunk_pos = ppc->pc.frame_start_found = 0;
>  
> 

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

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

[FFmpeg-devel] [PATCH 1/3] libavcodec/png_parser.c: fix a use_of_uninitialized_value in target_dec_fuzzer.

2020-06-04 Thread Thierry Foucu
the target_dec_fuzzer is checking for the avpkt.data pointer but if the
png parser cannot combine the frame, the poutbuf is not set.
---
 libavcodec/png_parser.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libavcodec/png_parser.c b/libavcodec/png_parser.c
index 74f2964118..9ec8551a1b 100644
--- a/libavcodec/png_parser.c
+++ b/libavcodec/png_parser.c
@@ -45,6 +45,7 @@ static int png_parse(AVCodecParserContext *s, AVCodecContext 
*avctx,
 s->pict_type = AV_PICTURE_TYPE_NONE;
 
 *poutbuf_size = 0;
+*poutbuf = NULL;
 
 if (!ppc->pc.frame_start_found) {
 uint64_t state64 = ppc->pc.state64;
-- 
2.27.0.278.ge193c7cf3a9-goog

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

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

[FFmpeg-devel] [PATCH 2/3] libavcodec/mlp_parser.c: fix a use_of_uninitialized_value in target_dec_fuzzer.

2020-06-04 Thread Thierry Foucu
the target_dec_fuzzer is checking for the avpkt.data pointer but if the
mlp parser cannot combine the frame, the poutbuf is not set.
---
 libavcodec/mlp_parser.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libavcodec/mlp_parser.c b/libavcodec/mlp_parser.c
index 5d2ddc5a70..e7162f4aa8 100644
--- a/libavcodec/mlp_parser.c
+++ b/libavcodec/mlp_parser.c
@@ -64,6 +64,7 @@ static int mlp_parse(AVCodecParserContext *s,
 s->key_frame = 0;
 
 *poutbuf_size = 0;
+*poutbuf = NULL;
 if (buf_size == 0)
 return 0;
 
-- 
2.27.0.278.ge193c7cf3a9-goog

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

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

[FFmpeg-devel] [PATCH 3/3] libavcodec/bmp_parser.c: fix a use_of_uninitialized_value in target_dec_fuzzer.

2020-06-04 Thread Thierry Foucu
the target_dec_fuzzer is checking for the avpkt.data pointer but if the
bmp parser cannot combine the frame, the poutbuf is not set.
---
 libavcodec/bmp_parser.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libavcodec/bmp_parser.c b/libavcodec/bmp_parser.c
index cd65f02a2e..700bf27af1 100644
--- a/libavcodec/bmp_parser.c
+++ b/libavcodec/bmp_parser.c
@@ -45,6 +45,7 @@ static int bmp_parse(AVCodecParserContext *s, AVCodecContext 
*avctx,
 int i = 0;
 
 *poutbuf_size = 0;
+*poutbuf = NULL;
 
 restart:
 if (bpc->pc.frame_start_found <= 2+4+4) {
-- 
2.27.0.278.ge193c7cf3a9-goog

___
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/png_parser.c: fix a use_of_uninitialized_value in target_dec_fuzzer.

2020-06-04 Thread Thierry Foucu
On Thu, Jun 4, 2020 at 11:52 AM James Almer  wrote:

> On 6/4/2020 3:40 PM, Thierry Foucu wrote:
> > target_dec_fuzzer is checking for the avpkt.data pointer but if the
> > png parser cannot combine the frame, the poutbuf is not set and so, the
> > avpkt.data is not initialized.
> > ---
> >  libavcodec/png_parser.c | 5 -
> >  1 file changed, 4 insertions(+), 1 deletion(-)
> >
> > diff --git a/libavcodec/png_parser.c b/libavcodec/png_parser.c
> > index 74f2964118..d1b2926154 100644
> > --- a/libavcodec/png_parser.c
> > +++ b/libavcodec/png_parser.c
> > @@ -99,8 +99,11 @@ static int png_parse(AVCodecParserContext *s,
> AVCodecContext *avctx,
> >  }
> >
> >  flush:
> > -if (ff_combine_frame(&ppc->pc, next, &buf, &buf_size) < 0)
> > +if (ff_combine_frame(&ppc->pc, next, &buf, &buf_size) < 0) {
> > +*poutbuf = NULL;
> > +*poutbuf_size = 0;
>
> This is already set to 0 first thing in png_parse(), so i'd say we
> should also set *poutbuf to NULL there instead.
>
> Good catch.. I will modify the patch.


> And I see the BMP parser has the same issue, so it needs the same fix.
>
> I will send a patch for BMP and also for MLP. Both have the same problem.


> >  return buf_size;
> > +}
> >
> >  ppc->chunk_pos = ppc->pc.frame_start_found = 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".



-- 

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

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

Re: [FFmpeg-devel] [PATCH 3/3] avcodec/wavpack: Do not allow the sample format to change between channels

2020-06-04 Thread Michael Niedermayer
On Thu, Jun 04, 2020 at 11:13:04AM -0700, David Bryant wrote:
> On 6/3/20 4:19 PM, Michael Niedermayer wrote:
> > Fixes: out of array access
> > Fixes: 
> > 22692/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WAVPACK_fuzzer-5678686190960640
> >
> > Found-by: continuous fuzzing process 
> > https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> > Signed-off-by: Michael Niedermayer 
> > ---
> >  libavcodec/wavpack.c | 3 +++
> >  1 file changed, 3 insertions(+)
> >
> > diff --git a/libavcodec/wavpack.c b/libavcodec/wavpack.c
> > index ead57063c8..f77548e5a5 100644
> > --- a/libavcodec/wavpack.c
> > +++ b/libavcodec/wavpack.c
> > @@ -1129,6 +1129,9 @@ static int wavpack_decode_block(AVCodecContext 
> > *avctx, int block_no,
> >  else
> >  sample_fmt  = AV_SAMPLE_FMT_S32P;
> >  
> > +if (wc->ch_offset && avctx->sample_fmt != sample_fmt)
> > +return AVERROR_INVALIDDATA;
> > +
> >  bpp= av_get_bytes_per_sample(sample_fmt);
> >  orig_bpp   = ((s->frame_flags & 0x03) + 1) << 3;
> >  multiblock = (s->frame_flags & WV_SINGLE_BLOCK) != WV_SINGLE_BLOCK;
> 
> Looks reasonable to me and passes my local test suite. Thanks!

will apply

thx

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

Any man who breaks a law that conscience tells him is unjust and willingly 
accepts the penalty by staying in jail in order to arouse the conscience of 
the community on the injustice of the law is at that moment expressing the 
very highest respect for law. - Martin Luther King Jr


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] [RFC PATCH 1/2] libavcodec/jpeg2000_parser: Add jpeg2000 parser

2020-06-04 Thread Michael Niedermayer
On Thu, Jun 04, 2020 at 01:24:42PM +0530, gautamr...@gmail.com wrote:
> From: Gautam Ramakrishnan 
> 
> I have attempted to write a JPEG2000 Parser. Have tested
> by generating a file containing 14 frames, as mentioned
> by Micheal. Have also tried testing with various packet
> sizes by setting -frame_size option.
> ---
>  libavcodec/Makefile  |   1 +
>  libavcodec/jpeg2000_parser.c | 190 +++
>  libavcodec/parsers.c |   1 +
>  3 files changed, 192 insertions(+)
>  create mode 100644 libavcodec/jpeg2000_parser.c

The code seems to work fine, is there a reason why it has a "RFC" in the
subject. That is, should this be reviewed & applied or not yet ?

thx

[...]
-- 
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 1/3] avcodec/mv30: Fix multiple integer overflows in idct_1d()

2020-06-04 Thread Michael Niedermayer
On Mon, May 25, 2020 at 12:38:41AM +0200, Michael Niedermayer wrote:
> Fixes: signed integer overflow: -4869937 * 473 cannot be represented in type 
> 'int'
> Fixes: 
> 21934/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MV30_fuzzer-5667289925156864
> 
> Found-by: continuous fuzzing process 
> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer 
> ---
>  libavcodec/mv30.c | 10 +-
>  1 file changed, 5 insertions(+), 5 deletions(-)

will apply patchset


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

The real ebay dictionary, page 2
"100% positive feedback" - "All either got their money back or didnt complain"
"Best seller ever, very honest" - "Seller refunded buyer after failed scam"


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

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

Re: [FFmpeg-devel] [PATCH] avcodec/mv30: Do not allow MVs outside the allocated image

2020-06-04 Thread Michael Niedermayer
On Wed, May 20, 2020 at 10:51:01PM +0200, Michael Niedermayer wrote:
> Fixes: out of array read
> Fixes: 
> 21804/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MV30_fuzzer-5673678898724864
> 
> Found-by: continuous fuzzing process 
> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer 
> ---
>  libavcodec/mv30.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

will apply

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

Any man who breaks a law that conscience tells him is unjust and willingly 
accepts the penalty by staying in jail in order to arouse the conscience of 
the community on the injustice of the law is at that moment expressing the 
very highest respect for law. - Martin Luther King Jr


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

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

Re: [FFmpeg-devel] [PATCH] avcodec/hq_hqa: Check info size

2020-06-04 Thread Michael Niedermayer
On Sat, May 30, 2020 at 06:31:24PM +0200, Michael Niedermayer wrote:
> On Sat, May 30, 2020 at 02:09:42AM +0200, Hendrik Leppkes wrote:
> > On Sat, May 30, 2020 at 2:01 AM Michael Niedermayer
> >  wrote:
> > >
> > > Fixes: assertion failure
> > > Fixes: 
> > > 21079/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HQ_HQA_fuzzer-5737046523248640
> > >
> > > Found-by: continuous fuzzing process 
> > > https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> > > Signed-off-by: Michael Niedermayer 
> > > ---
> > >  libavcodec/hq_hqa.c | 2 +-
> > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > >
> > > diff --git a/libavcodec/hq_hqa.c b/libavcodec/hq_hqa.c
> > > index eec2e980b3..8404e80ec8 100644
> > > --- a/libavcodec/hq_hqa.c
> > > +++ b/libavcodec/hq_hqa.c
> > > @@ -321,7 +321,7 @@ static int hq_hqa_decode_frame(AVCodecContext *avctx, 
> > > void *data,
> > >  int info_size;
> > >  bytestream2_skip(&ctx->gbc, 4);
> > >  info_size = bytestream2_get_le32(&ctx->gbc);
> > > -if (bytestream2_get_bytes_left(&ctx->gbc) < info_size) {
> > > +if (info_size < 0 || bytestream2_get_bytes_left(&ctx->gbc) < 
> > > info_size) {
> > >  av_log(avctx, AV_LOG_ERROR, "Invalid INFO size (%d).\n", 
> > > info_size);
> > >  return AVERROR_INVALIDDATA;
> > >  }
> > > --
> > 
> > bytestream2_get_le32 returns an unsigned type, wouldn't it be better
> > to make info_size unsigned and avoid the type cast and signed overflow
> > that results in this check failing?
> 
> The value is ultimatly passed into bytestream2_init()
> where its in int so it cannot be beyond the positive signed int range

will apply

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

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


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

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

Re: [FFmpeg-devel] [RFC PATCH 1/2] libavcodec/jpeg2000_parser: Add jpeg2000 parser

2020-06-04 Thread Gautam Ramakrishnan
On Fri, Jun 5, 2020 at 3:21 AM Michael Niedermayer
 wrote:
>
> On Thu, Jun 04, 2020 at 01:24:42PM +0530, gautamr...@gmail.com wrote:
> > From: Gautam Ramakrishnan 
> >
> > I have attempted to write a JPEG2000 Parser. Have tested
> > by generating a file containing 14 frames, as mentioned
> > by Micheal. Have also tried testing with various packet
> > sizes by setting -frame_size option.
> > ---
> >  libavcodec/Makefile  |   1 +
> >  libavcodec/jpeg2000_parser.c | 190 +++
> >  libavcodec/parsers.c |   1 +
> >  3 files changed, 192 insertions(+)
> >  create mode 100644 libavcodec/jpeg2000_parser.c
>
> The code seems to work fine, is there a reason why it has a "RFC" in the
> subject. That is, should this be reviewed & applied or not yet ?
I wanted to get the fate test also reviewed. If this looks fine to
everyone, this can
be applied and the FATE test can be reviewed separately.
>
> thx
>
> [...]
> --
> 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
> ___
> 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".