Re: [FFmpeg-devel] avcodec: add a WavPack DSD decoder

2019-07-21 Thread Paul B Mahol
On 7/22/19, David Bryant  wrote:
> Hi,
>
> As I promised late last year, here is a patch to add a WavPack DSD decoder.
>
> Thanks!
>
> -David Bryant
>
>

Please correct me if I'm wrong, but why this uses new codec id?
Apparently is also copies some logic from other files.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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

Re: [FFmpeg-devel] [PATCH 4/4] avcodec/hqx: Check the input data against the image size

2019-07-21 Thread Paul B Mahol
On 7/21/19, Michael Niedermayer  wrote:
> On Sun, Jul 21, 2019 at 10:48:26AM +0200, Paul B Mahol wrote:
>> On 7/21/19, Michael Niedermayer  wrote:
>> > Fixes: Timeout (22 -> 7 sec)
>> > Fixes:
>> > 15173/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HQX_fuzzer-5662556846292992
>> >
>> > Found-by: continuous fuzzing process
>> > https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
>> > Signed-off-by: Michael Niedermayer 
>> > ---
>> >  libavcodec/hqx.c | 4 
>> >  1 file changed, 4 insertions(+)
>> >
>> > diff --git a/libavcodec/hqx.c b/libavcodec/hqx.c
>> > index bc24ba91d1..8639d77a41 100644
>> > --- a/libavcodec/hqx.c
>> > +++ b/libavcodec/hqx.c
>> > @@ -471,6 +471,10 @@ static int hqx_decode_frame(AVCodecContext *avctx,
>> > void
>> > *data,
>> >  avctx->height  = ctx->height;
>> >  avctx->bits_per_raw_sample = 10;
>> >
>> > +if (avctx->coded_width / 16 * (avctx->coded_height / 16) *
>> > +(100 - avctx->discard_damaged_percentage) / 100 > 8LL *
>> > avpkt->size)
>> > +return AVERROR_INVALIDDATA;
>>
>> Why just this change and not something better?
>
> What would you prefer exactly ?

Something that works with pure black video.

>
> Thanks
>
> [...]
> --
> Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> Modern terrorism, a quick summary: Need oil, start war with country that
> has oil, kill hundread thousand in war. Let country fall into chaos,
> be surprised about raise of fundamantalists. Drop more bombs, kill more
> people, be surprised about them taking revenge and drop even more bombs
> and strip your own citizens of their rights and freedoms. to be continued
>
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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

Re: [FFmpeg-devel] [PATCH 2/2] avcodec/vp3: Check that theora is theora

2019-07-21 Thread Reimar Döffinger


On 22.07.2019, at 01:25, Michael Niedermayer  wrote:

> Fixes: Timeout (2min -> 100ms)
> Fixes: 
> 15366/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_THEORA_fuzzer-5737849938247680
> 
> Found-by: continuous fuzzing process 
> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer 
> ---
> libavcodec/vp3.c | 2 ++
> 1 file changed, 2 insertions(+)
> 
> diff --git a/libavcodec/vp3.c b/libavcodec/vp3.c
> index a6f759ebf5..8a165c1275 100644
> --- a/libavcodec/vp3.c
> +++ b/libavcodec/vp3.c
> @@ -2957,6 +2957,8 @@ static int theora_decode_header(AVCodecContext *avctx, 
> GetBitContext *gb)
> s->theora_header = 0;
> s->theora = get_bits_long(gb, 24);
> av_log(avctx, AV_LOG_DEBUG, "Theora bitstream version %X\n", s->theora);
> +if (!s->theora)
> +return AVERROR_INVALIDDATA;

That seems rather strict, a 1-bit error in this field and we don't even try?
Maybe set to 1 instead with a request for sample?
___
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 v4 2/3] lavc/libdavs2.c: fix decoder info level setting

2019-07-21 Thread Reimar Döffinger
On 22.07.2019, at 06:23, hwrenx  wrote:

> Mapping log level from av_log_level to davs3_log_level_e:
> 
> [AV_LOG_QUIET, AV_LOG_ERROR]   => DAVS2_LOG_ERROR
> [AV_LOG_WARNING]   => DAVS2_LOG_WARNING
> [AV_LOG_INFO]  => DAVS2_LOG_INFO
> [AV_LOG_VERBOSE, AV_LOG_TRACE] => DAVS2_LOG_DEBUG
> 
> in values:
> 
> [-8, 16] => 3
> [17, 24] => 2
> [25, 32] => 1
> [33, 56] => 0
> 
> After clip into [AV_LOG_FATAL + 1, AV_LOG_VERBOSE]([9, 40]), davs2 log
> level can be expressed as (4-(((av_log_level)-1)>>3)).

The AV_LOG_... values might change at some point.
I'd suggest using a couple of ifs instead of trying something "clever" like 
this.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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

[FFmpeg-devel] [PATCH v4 3/3] lavc/libdavs2.c: reduce memcpy

2019-07-21 Thread hwrenx
Can effectivly improved decoding speed when memcpy becomes a limitation
for proccessing high resolution source.
Tested under i7-8700k with `ffmpeg -i 7680x4320.avs2 -vsync 0 -f null -`
got performance 23fps => 42fps

Signed-off-by: hwrenx 
---
 libavcodec/libdavs2.c | 52 ---
 1 file changed, 29 insertions(+), 23 deletions(-)

diff --git a/libavcodec/libdavs2.c b/libavcodec/libdavs2.c
index 79b3e4f..ca5b307 100644
--- a/libavcodec/libdavs2.c
+++ b/libavcodec/libdavs2.c
@@ -65,13 +65,22 @@ static av_cold int davs2_init(AVCodecContext *avctx)
 return 0;
 }
 
+static void davs2_frame_unref(void *opaque, uint8_t *data) {
+DAVS2Context*cad = (DAVS2Context *)opaque;
+davs2_picture_t  pic;
+
+pic.magic = (davs2_picture_t *)data;
+
+if (cad->decoder) {
+davs2_decoder_frame_unref(cad->decoder, &pic);
+}
+}
+
 static int davs2_dump_frames(AVCodecContext *avctx, davs2_picture_t *pic, int 
*got_frame,
  davs2_seq_info_t *headerset, int ret_type, 
AVFrame *frame)
 {
 DAVS2Context *cad= avctx->priv_data;
-int bytes_per_sample = pic->bytes_per_sample;
-int plane = 0;
-int line  = 0;
+int plane;
 
 if (!headerset) {
 *got_frame = 0;
@@ -109,29 +118,28 @@ static int davs2_dump_frames(AVCodecContext *avctx, 
davs2_picture_t *pic, int *g
 return AVERROR_EXTERNAL;
 }
 
-for (plane = 0; plane < 3; ++plane) {
-int size_line = pic->widths[plane] * bytes_per_sample;
-frame->buf[plane]  = av_buffer_alloc(size_line * pic->lines[plane]);
-
-if (!frame->buf[plane]){
-av_log(avctx, AV_LOG_ERROR, "Decoder error: allocation failure, 
can't dump frames.\n");
-return AVERROR(ENOMEM);
-}
-
-frame->data[plane] = frame->buf[plane]->data;
-frame->linesize[plane] = size_line;
-
-for (line = 0; line < pic->lines[plane]; ++line)
-memcpy(frame->data[plane] + line * size_line,
-   pic->planes[plane] + line * pic->strides[plane],
-   pic->widths[plane] * bytes_per_sample);
-}
-
 frame->width = cad->headerset.width;
 frame->height= cad->headerset.height;
 frame->pts   = cad->out_frame.pts;
 frame->format= avctx->pix_fmt;
 
+/* handle the actual picture in magic */
+frame->buf[0]= av_buffer_create((uint8_t *)pic->magic,
+sizeof(davs2_picture_t *),
+davs2_frame_unref,
+(void *)cad,
+AV_BUFFER_FLAG_READONLY);
+if (!frame->buf[0]) {
+av_log(avctx, AV_LOG_ERROR,
+"Decoder error: allocation failure, can't dump frames.\n");
+return AVERROR(ENOMEM);
+}
+
+for (plane = 0; plane < 3; ++plane) {
+frame->linesize[plane] = pic->strides[plane];
+frame->data[plane] = pic->planes[plane];
+}
+
 *got_frame = 1;
 return 0;
 }
@@ -163,7 +171,6 @@ static int send_delayed_frame(AVCodecContext *avctx, 
AVFrame *frame, int *got_fr
 }
 if (ret == DAVS2_GOT_FRAME) {
 ret = davs2_dump_frames(avctx, &cad->out_frame, got_frame, 
&cad->headerset, ret, frame);
-davs2_decoder_frame_unref(cad->decoder, &cad->out_frame);
 }
 return ret;
 }
@@ -212,7 +219,6 @@ static int davs2_decode_frame(AVCodecContext *avctx, void 
*data,
 
 if (ret != DAVS2_DEFAULT) {
 ret = davs2_dump_frames(avctx, &cad->out_frame, got_frame, 
&cad->headerset, ret, frame);
-davs2_decoder_frame_unref(cad->decoder, &cad->out_frame);
 }
 
 return ret == 0 ? buf_size : ret;
-- 
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 v4 0/3] optimize frame dumping and fix missing start codes

2019-07-21 Thread hwrenx
Version 4:
1. Change info level setting.
2. Remove `Decoder not found` condition.


The previous version 2 patches were deprecated for using
pointer to itself can be unsafe when release frames.

This patch set is mainly about avoiding using memcpy when fetching
frame data, and fixed missing start codes which may cause error
packetization sometime. Default info level of libdavs2 was changed
because we found debug info is useless in most of the time.

hwrenx (3):
  lavc/avs2_parser.c: fix missing start code
  lavc/libdavs2.c: fix decoder info level setting
  lavc/libdavs2.c: reduce memcpy

 libavcodec/avs2_parser.c |  4 +++-
 libavcodec/libdavs2.c| 61 +---
 2 files changed, 40 insertions(+), 25 deletions(-)

The performance comparison is like following:

[Platform]
  Intel® Core™ i7-8700k CPU @ 3.70GHz × 6 / 16GiB
[Command]
  ffmpeg -i test.avs2 -vsync 0 -f null -
[Stream]
  7680x4320 yuv420p Random Access
[Original version]
  frame= 2669 fps= 23 q=-0.0 Lsize=N/A time=00:00:53.44 bitrate=N/A speed=0.465x
[Optimized version]
  frame= 2669 fps= 42 q=-0.0 Lsize=N/A time=00:00:53.44 bitrate=N/A speed=0.836x

-- 
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 v4 2/3] lavc/libdavs2.c: fix decoder info level setting

2019-07-21 Thread hwrenx
Mapping log level from av_log_level to davs3_log_level_e:

[AV_LOG_QUIET, AV_LOG_ERROR]   => DAVS2_LOG_ERROR
[AV_LOG_WARNING]   => DAVS2_LOG_WARNING
[AV_LOG_INFO]  => DAVS2_LOG_INFO
[AV_LOG_VERBOSE, AV_LOG_TRACE] => DAVS2_LOG_DEBUG

in values:

[-8, 16] => 3
[17, 24] => 2
[25, 32] => 1
[33, 56] => 0

After clip into [AV_LOG_FATAL + 1, AV_LOG_VERBOSE]([9, 40]), davs2 log
level can be expressed as (4-(((av_log_level)-1)>>3)).

Signed-off-by: hwrenx 
---
 libavcodec/libdavs2.c | 9 -
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/libavcodec/libdavs2.c b/libavcodec/libdavs2.c
index 218f3ec..79b3e4f 100644
--- a/libavcodec/libdavs2.c
+++ b/libavcodec/libdavs2.c
@@ -25,6 +25,9 @@
 #include "avcodec.h"
 #include "davs2.h"
 
+/* map log_level from 16/24/32/40 to 3/2/1/0 */
+#define DAVS2_GET_LEVEL(x) (4-(((x)-1)>>3))
+
 typedef struct DAVS2Context {
 void *decoder;
 
@@ -41,10 +44,14 @@ static av_cold int davs2_init(AVCodecContext *avctx)
 {
 DAVS2Context *cad = avctx->priv_data;
 int cpu_flags = av_get_cpu_flags();
+int log_level = av_log_get_level();
+
+/* fix for davs2 level range */
+log_level = av_clip(log_level, AV_LOG_FATAL + 1, AV_LOG_VERBOSE);
 
 /* init the decoder */
 cad->param.threads  = avctx->thread_count;
-cad->param.info_level   = 0;
+cad->param.info_level   = DAVS2_GET_LEVEL(log_level);
 cad->param.disable_avx  = !(cpu_flags & AV_CPU_FLAG_AVX &&
 cpu_flags & AV_CPU_FLAG_AVX2);
 cad->decoder= davs2_decoder_open(&cad->param);
-- 
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 v4 1/3] lavc/avs2_parser.c: fix missing start code

2019-07-21 Thread hwrenx
Signed-off-by: hwrenx 
---
 libavcodec/avs2_parser.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/libavcodec/avs2_parser.c b/libavcodec/avs2_parser.c
index 1c9b342..dc2fa16 100644
--- a/libavcodec/avs2_parser.c
+++ b/libavcodec/avs2_parser.c
@@ -23,8 +23,10 @@
 
 #define SLICE_MAX_START_CODE0x01af
 
+#define ISSQH(x)  ((x) == 0xB0 )
+#define ISEND(x)  ((x) == 0xB1 )
 #define ISPIC(x)  ((x) == 0xB3 || (x) == 0xB6)
-#define ISUNIT(x) ((x) == 0xB0 || (x) == 0xB1 || (x) == 0xB2 || ISPIC(x))
+#define ISUNIT(x) ( ISSQH(x) || ISEND(x) || (x) == 0xB2 || ISPIC(x) || (x) == 
0xB5 || (x) == 0xB7 )
 
 static int avs2_find_frame_end(ParseContext *pc, const uint8_t *buf, int 
buf_size)
 {
-- 
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 2/4] h264_mp4toannexb_bsf: Improve extradata overread checks

2019-07-21 Thread Andreas Rheinhardt
1. Currently during parsing the extradata, h264_mp4toannexb checks for
overreads by adding the size of the current unit to the current position
pointer and comparing this to the end position of the extradata. But
pointer comparisons and pointer arithmetic is only defined if it does not
exceed the object it is used on (one past the last element of an array
is allowed, too). In practice, this might lead to overflows. Therefore
the check has been changed.
2. The minimal size of an AVCDecoderConfigurationRecord is actually 7:
Four bytes containing version, profile and level, one byte for length
size and one byte each for the numbers of SPS and PPS. This has been
changed. The byte for the number of PPS has been forgotten.
3. The earlier code also did not detect an error if the extradata ended
directly after the last SPS in the SPS array (if any) although the
number of PPS has to come afterwards. A check for this has been
integrated into the general overread check.
4. The earlier code also might overread when reading the size of the
next unit. Given that this overread is not dangerous (the extradata is
supposed to be padded), only a comment for it has been added; the error
itself will be detected as part of the normal check for overreads.

Signed-off-by: Andreas Rheinhardt 
---
 libavcodec/h264_mp4toannexb_bsf.c | 16 +---
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/libavcodec/h264_mp4toannexb_bsf.c 
b/libavcodec/h264_mp4toannexb_bsf.c
index 8b2899f300..076dfa31a7 100644
--- a/libavcodec/h264_mp4toannexb_bsf.c
+++ b/libavcodec/h264_mp4toannexb_bsf.c
@@ -71,7 +71,8 @@ static int h264_extradata_to_annexb(AVBSFContext *ctx, const 
int padding)
 int total_size  = 0;
 uint8_t *out= NULL, unit_nb, sps_done = 0,
  sps_seen   = 0, pps_seen = 0;
-const uint8_t *extradata= ctx->par_in->extradata + 4;
+const uint8_t *extradata= ctx->par_in->extradata + 4,
+  *extradata_end= ctx->par_in->extradata + 
ctx->par_in->extradata_size;
 static const uint8_t nalu_header[4] = { 0, 0, 0, 1 };
 int length_size = (*extradata++ & 0x3) + 1; // retrieve length coded size
 
@@ -89,10 +90,11 @@ static int h264_extradata_to_annexb(AVBSFContext *ctx, 
const int padding)
 while (unit_nb--) {
 int err;
 
-unit_size   = AV_RB16(extradata);
+unit_size   = AV_RB16(extradata); /* possible overread ok due to 
padding */
+extradata  += 2;
 total_size += unit_size + 4;
-if (extradata + 2 + unit_size > ctx->par_in->extradata + 
ctx->par_in->extradata_size) {
-av_log(ctx, AV_LOG_ERROR, "Packet header is not contained in 
global extradata, "
+if (extradata_end - extradata < unit_size + !sps_done) {
+av_log(ctx, AV_LOG_ERROR, "Global extradata truncated, "
"corrupted stream or invalid MP4/AVCC bitstream\n");
 av_free(out);
 return AVERROR(EINVAL);
@@ -100,8 +102,8 @@ static int h264_extradata_to_annexb(AVBSFContext *ctx, 
const int padding)
 if ((err = av_reallocp(&out, total_size + padding)) < 0)
 return err;
 memcpy(out + total_size - unit_size - 4, nalu_header, 4);
-memcpy(out + total_size - unit_size, extradata + 2, unit_size);
-extradata += 2 + unit_size;
+memcpy(out + total_size - unit_size, extradata, unit_size);
+extradata += unit_size;
 pps:
 if (!unit_nb && !sps_done++) {
 unit_nb = *extradata++; /* number of pps unit(s) */
@@ -144,7 +146,7 @@ static int h264_mp4toannexb_init(AVBSFContext *ctx)
 (extra_size >= 4 && AV_RB32(ctx->par_in->extradata) == 1)) {
 av_log(ctx, AV_LOG_VERBOSE,
"The input looks like it is Annex B already\n");
-} else if (extra_size >= 6) {
+} else if (extra_size >= 7) {
 ret = h264_extradata_to_annexb(ctx, AV_INPUT_BUFFER_PADDING_SIZE);
 if (ret < 0)
 return ret;
-- 
2.21.0

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

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

[FFmpeg-devel] [PATCH 3/4] h264_mp4toannexb: Improve overread checks II

2019-07-21 Thread Andreas Rheinhardt
1. Left shifts of negative values are undefined as soon as the sign bit
is involved. Therefore make nal_size an uint32_t and drop the check for
whether it is < 0.
2. The two checks for overreads (whether the length field is contained
in the packet and whether the actual unit is contained in the packet)
can be combined into one because the packet is padded, i.e. a potential
overread caused by reading the length field without checking whether
said length field is actually part of the packet's buffer is allowed
as one always stays within the padding. But one has to be aware of
a pitfall: The comparison must be performed in (at least) int64_t as
otherwise buf_end - buf might be promoted to uint32_t in which case
an already occured overread would appear as a very large number.
A comment explaining this has been added, too.

Signed-off-by: Andreas Rheinhardt 
---
 libavcodec/h264_mp4toannexb_bsf.c | 14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/libavcodec/h264_mp4toannexb_bsf.c 
b/libavcodec/h264_mp4toannexb_bsf.c
index 076dfa31a7..ef0ccacf29 100644
--- a/libavcodec/h264_mp4toannexb_bsf.c
+++ b/libavcodec/h264_mp4toannexb_bsf.c
@@ -170,8 +170,7 @@ static int h264_mp4toannexb_filter(AVBSFContext *ctx, 
AVPacket *out)
 
 AVPacket *in;
 uint8_t unit_type;
-int32_t nal_size;
-uint32_t cumul_size= 0;
+uint32_t cumul_size = 0, nal_size;
 const uint8_t *buf;
 const uint8_t *buf_end;
 intbuf_size;
@@ -193,18 +192,19 @@ static int h264_mp4toannexb_filter(AVBSFContext *ctx, 
AVPacket *out)
 buf_end  = in->data + in->size;
 
 do {
-ret= AVERROR(EINVAL);
-if (buf + s->length_size > buf_end)
-goto fail;
-
+/* possible overread ok due to padding */
 for (nal_size = 0, i = 0; ilength_size; i++)
 nal_size = (nal_size << 8) | buf[i];
 
 buf += s->length_size;
 unit_type = *buf & 0x1f;
 
-if (nal_size > buf_end - buf || nal_size < 0)
+/* This check requires the cast as the right side might
+ * otherwise be promoted to an unsigned value. */
+if ((int64_t)nal_size > buf_end - buf) {
+ret = AVERROR(EINVAL);
 goto fail;
+}
 
 if (unit_type == H264_NAL_SPS)
 s->idr_sps_seen = s->new_idr = 1;
-- 
2.21.0

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

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

[FFmpeg-devel] [PATCH 4/4] h264_mp4toannexb_bsf: Try to avoid four byte startcodes

2019-07-21 Thread Andreas Rheinhardt
According to the H.264 specifications, the only NAL units that need to
have four byte startcodes in H.264 Annex B format are SPS/PPS units and
units that start a new access unit. Before af7e953a, the first of these
conditions wasn't upheld as already existing in-band parameter sets
would not automatically be written with a four byte startcode, but only
when they already were at the beginning of their input packets. But it
made four byte startcodes be used too often as every unit that is written
together with a parameter set that is inserted from extradata received a
four byte startcode although a three byte start code would suffice
unless the unit itself were a parameter set.

FATE has been updated to reflect the changes. Although the patch leaves
the extradata unchanged, the size of the extradata according to the FATE
reports changes. This is due to a quirk in ff_h2645_packet_split which
is used by extract_extradata: If the input is Annex B, the first zero of
a four byte startcode is considered a part of the last unit (if any).

Signed-off-by: Andreas Rheinhardt 
---
 libavcodec/h264_mp4toannexb_bsf.c|  6 +++---
 tests/ref/fate/h264-bsf-mp4toannexb  |  2 +-
 tests/ref/fate/h264_mp4toannexb_ticket2991   | 22 ++--
 tests/ref/fate/h264_mp4toannexb_ticket5927   | 10 -
 tests/ref/fate/h264_mp4toannexb_ticket5927_2 | 10 -
 tests/ref/fate/segment-mp4-to-ts |  4 ++--
 6 files changed, 27 insertions(+), 27 deletions(-)

diff --git a/libavcodec/h264_mp4toannexb_bsf.c 
b/libavcodec/h264_mp4toannexb_bsf.c
index ef0ccacf29..904c4bc609 100644
--- a/libavcodec/h264_mp4toannexb_bsf.c
+++ b/libavcodec/h264_mp4toannexb_bsf.c
@@ -43,7 +43,7 @@ static int alloc_and_copy(AVPacket *out,
   const uint8_t *in, uint32_t in_size, int ps)
 {
 uint32_t offset = out->size;
-uint8_t start_code_size = offset == 0 || ps ? 4 : 3;
+uint8_t start_code_size = offset == 0 && sps_pps_size == 0 || ps ? 4 : 3;
 int err;
 
 err = av_grow_packet(out, sps_pps_size + in_size + start_code_size);
@@ -236,7 +236,7 @@ static int h264_mp4toannexb_filter(AVBSFContext *ctx, 
AVPacket *out)
 if (s->new_idr && unit_type == H264_NAL_IDR_SLICE && !s->idr_sps_seen 
&& !s->idr_pps_seen) {
 if ((ret=alloc_and_copy(out,
ctx->par_out->extradata, 
ctx->par_out->extradata_size,
-   buf, nal_size, 1)) < 0)
+   buf, nal_size, 0)) < 0)
 goto fail;
 s->new_idr = 0;
 /* if only SPS has been seen, also insert PPS */
@@ -247,7 +247,7 @@ static int h264_mp4toannexb_filter(AVBSFContext *ctx, 
AVPacket *out)
 goto fail;
 } else if ((ret = alloc_and_copy(out,
 ctx->par_out->extradata + 
s->pps_offset, ctx->par_out->extradata_size - s->pps_offset,
-buf, nal_size, 1)) < 0)
+buf, nal_size, 0)) < 0)
 goto fail;
 } else {
 if ((ret=alloc_and_copy(out, NULL, 0, buf, nal_size, unit_type == 
H264_NAL_SPS || unit_type == H264_NAL_PPS)) < 0)
diff --git a/tests/ref/fate/h264-bsf-mp4toannexb 
b/tests/ref/fate/h264-bsf-mp4toannexb
index 7cd086a268..2049f39701 100644
--- a/tests/ref/fate/h264-bsf-mp4toannexb
+++ b/tests/ref/fate/h264-bsf-mp4toannexb
@@ -1 +1 @@
-f340e7ca9a46d437af4e96f6c8de221c
+5f04c27cc6ee8625fe2405fb0f7da9a3
diff --git a/tests/ref/fate/h264_mp4toannexb_ticket2991 
b/tests/ref/fate/h264_mp4toannexb_ticket2991
index 3245ef442c..76bdf3cae7 100644
--- a/tests/ref/fate/h264_mp4toannexb_ticket2991
+++ b/tests/ref/fate/h264_mp4toannexb_ticket2991
@@ -1,12 +1,12 @@
-dba672c154b41414cf26aae967c27eef 
*tests/data/fate/h264_mp4toannexb_ticket2991.h264
-1985823 tests/data/fate/h264_mp4toannexb_ticket2991.h264
-#extradata 0:   48, 0x47ae0d55
+05d66e60ab22ee004720e0051af0fe74 
*tests/data/fate/h264_mp4toannexb_ticket2991.h264
+1985815 tests/data/fate/h264_mp4toannexb_ticket2991.h264
+#extradata 0:   47, 0x3a590d55
 #tb 0: 1/120
 #media_type 0: video
 #codec_id 0: h264
 #dimensions 0: 1280x720
 #sar 0: 3/4
-0,  0,  0,48000,37127, 0xc125184c
+0,  0,  0,48000,37126, 0xb020184c
 0,  48000,  48000,40040, 6920, 0x8512361a, F=0x0
 0,  88040,  88040,40040, 7550, 0x1bc56ed4, F=0x0
 0, 128081, 128081,40040, 8752, 0xb8c6f0a1, F=0x0
@@ -21,7 +21,7 @@ dba672c154b41414cf26aae967c27eef 
*tests/data/fate/h264_mp4toannexb_ticket2991.h2
 0, 488444, 488444,40040,11234, 0x83cbd9fd, F=0x0
 0, 528485, 528485,40040,17616, 0xfdf95104, F=0x0
 0, 568525, 568525,40040,10689, 0x9633d32b, F=0x0
-0, 608566, 608566,40040,45292, 0x66dd2cf6
+0, 608566, 608566,40040,45291, 0x543c2cf6
 0, 64

[FFmpeg-devel] [PATCH 1/4] h264_mp4toannexb: Remove unnecessary check

2019-07-21 Thread Andreas Rheinhardt
There can be at most 31 SPS and 255 PPS in the mp4/Matroska extradata.
Given that each has a size of at most 2^16-1, the length of the output
derived from these parameter sets can never overflow an ordinary 32 bit
integer. So use a simple int instead of uint64_t and remove the
unnecessary check.

Signed-off-by: Andreas Rheinhardt 
---
 libavcodec/h264_mp4toannexb_bsf.c | 8 +---
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/libavcodec/h264_mp4toannexb_bsf.c 
b/libavcodec/h264_mp4toannexb_bsf.c
index fb3f24ea40..8b2899f300 100644
--- a/libavcodec/h264_mp4toannexb_bsf.c
+++ b/libavcodec/h264_mp4toannexb_bsf.c
@@ -68,7 +68,7 @@ static int h264_extradata_to_annexb(AVBSFContext *ctx, const 
int padding)
 {
 H264BSFContext *s = ctx->priv_data;
 uint16_t unit_size;
-uint64_t total_size = 0;
+int total_size  = 0;
 uint8_t *out= NULL, unit_nb, sps_done = 0,
  sps_seen   = 0, pps_seen = 0;
 const uint8_t *extradata= ctx->par_in->extradata + 4;
@@ -91,12 +91,6 @@ static int h264_extradata_to_annexb(AVBSFContext *ctx, const 
int padding)
 
 unit_size   = AV_RB16(extradata);
 total_size += unit_size + 4;
-if (total_size > INT_MAX - padding) {
-av_log(ctx, AV_LOG_ERROR,
-   "Too big extradata size, corrupted stream or invalid 
MP4/AVCC bitstream\n");
-av_free(out);
-return AVERROR(EINVAL);
-}
 if (extradata + 2 + unit_size > ctx->par_in->extradata + 
ctx->par_in->extradata_size) {
 av_log(ctx, AV_LOG_ERROR, "Packet header is not contained in 
global extradata, "
"corrupted stream or invalid MP4/AVCC bitstream\n");
-- 
2.21.0

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

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

Re: [FFmpeg-devel] dash: add descriptor which is useful to the scheme defined by ISO/IEC 23009-1:2014/Amd.2:2015.

2019-07-21 Thread Jeyapal, Karthick

On 7/19/19 1:13 PM, leozhang wrote:
> Signed-off-by: leozhang 
> ---
> Removed remarks which are not part of commit message. Thanks reminder
>
>  doc/muxers.texi   |  4 
>  libavformat/dashenc.c | 27 +++
>  2 files changed, 27 insertions(+), 4 deletions(-)
>
> diff --git a/doc/muxers.texi b/doc/muxers.texi
> index b109297..bc38cf6 100644
> --- a/doc/muxers.texi
> +++ b/doc/muxers.texi
> @@ -275,6 +275,10 @@ of the adaptation sets and a,b,c,d and e are the indices 
> of the mapped streams.
>  To map all video (or audio) streams to an AdaptationSet, "v" (or "a") can be 
> used as stream identifier instead of IDs.
>  
>  When no assignment is defined, this defaults to an AdaptationSet for each 
> stream.
> +
> +Optional syntax is "id=x,descriptor=descriptor_string,streams=a,b,c 
> id=y,streams=d,e" and so on, descriptor is useful to the scheme defined by 
> ISO/IEC 23009-1:2014/Amd.2:2015.
> +For example, -adaptation_sets "id=0,descriptor= schemeIdUri=\"urn:mpeg:dash:srd:2014\" value=\"0,0,0,1,1,2,2\"/>,streams=v".
> +Please note that descriptor string should be a self-closing xml tag.
>  @item timeout @var{timeout}
>  Set timeout for socket I/O operations. Applicable only for HTTP output.
>  @item index_correction @var{index_correction}
> diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c
> index b25afb4..24f8d4d 100644
> --- a/libavformat/dashenc.c
> +++ b/libavformat/dashenc.c
> @@ -68,6 +68,7 @@ typedef struct Segment {
>  
>  typedef struct AdaptationSet {
>  char id[10];
> +char *descriptor;
>  enum AVMediaType media_type;
>  AVDictionary *metadata;
>  AVRational min_frame_rate, max_frame_rate;
> @@ -552,8 +553,10 @@ static void dash_free(AVFormatContext *s)
>  int i, j;
>  
>  if (c->as) {
> -for (i = 0; i < c->nb_as; i++)
> +for (i = 0; i < c->nb_as; i++) {
>  av_dict_free(&c->as[i].metadata);
> +av_freep(&c->as[i].descriptor);
> +}
>  av_freep(&c->as);
>  c->nb_as = 0;
>  }
> @@ -748,7 +751,8 @@ static int write_adaptation_set(AVFormatContext *s, 
> AVIOContext *out, int as_ind
>  role = av_dict_get(as->metadata, "role", NULL, 0);
>  if (role)
>  avio_printf(out, "\t\t\t schemeIdUri=\"urn:mpeg:dash:role:2011\" value=\"%s\"/>\n", role->value);
> -
> +if (as->descriptor)
> +avio_printf(out, "\t\t\t%s\n", as->descriptor);
>  for (i = 0; i < s->nb_streams; i++) {
>  OutputStream *os = &c->streams[i];
>  char bandwidth_str[64] = {'\0'};
> @@ -820,7 +824,7 @@ static int parse_adaptation_sets(AVFormatContext *s)
>  {
>  DASHContext *c = s->priv_data;
>  const char *p = c->adaptation_sets;
> -enum { new_set, parse_id, parsing_streams } state;
> +enum { new_set, parse_id, parsing_streams, parse_descriptor } state;
>  AdaptationSet *as;
>  int i, n, ret;
>  
> @@ -837,6 +841,9 @@ static int parse_adaptation_sets(AVFormatContext *s)
>  }
>  
>  // syntax id=0,streams=0,1,2 id=1,streams=3,4 and so on
> +// option id=0,descriptor=descriptor_str,streams=0,1,2 and so on
> +// descriptor is useful to the scheme defined by ISO/IEC 
> 23009-1:2014/Amd.2:2015
> +// descriptor_str should be a self-closing xml tag.
>  state = new_set;
>  while (*p) {
>  if (*p == ' ') {
> @@ -854,7 +861,19 @@ static int parse_adaptation_sets(AVFormatContext *s)
>  if (*p)
>  p++;
>  state = parse_id;
> -} else if (state == parse_id && av_strstart(p, "streams=", &p)) {
> +} else if (state == parse_id && av_strstart(p, "descriptor=", &p)) {
> +n = strcspn(p, ">") + 1; //followed by one comma, so plus 1
> +if (n < strlen(p)) {
> +as->descriptor = av_strndup(p, n);
> +} else {
> +av_log(s, AV_LOG_ERROR, "Parse error, descriptor string 
> should be a self-closing xml tag\n");
> +return AVERROR(EINVAL);
> +}
> +p += n;
> +if (*p)
> +p++;
> +state = parse_descriptor;
> +} else if ((state == parse_id || state == parse_descriptor) && 
> av_strstart(p, "streams=", &p)) { //descriptor is optional 
>  state = parsing_streams;
>  } else if (state == parsing_streams) {
>  AdaptationSet *as = &c->as[c->nb_as - 1];

Pushed, with minor change to commit message and removing a trailing space.

Regards,
Karthick

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

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

Re: [FFmpeg-devel] how to create sub project / git repo under FFMPEG

2019-07-21 Thread Guo, Yejun


> -Original Message-
> From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On Behalf Of
> Jean-Baptiste Kempf
> Sent: Thursday, July 18, 2019 5:07 PM
> To: Nicolas George ; ffmpeg-devel
> 
> Subject: Re: [FFmpeg-devel] how to create sub project / git repo under FFMPEG
> 
> On Thu, Jul 18, 2019, at 11:05, Nicolas George wrote:
> > Guo, Yejun (12019-07-18):
> > > I personally prefer github to host the repo, the repo name might be
> > > ffmpeg_dnn_material or ffmpeg_dnn_data, or something others. I'm open
> > > to the name, just up to you.
> > >
> > > My plan is to first ask authors of filter vf_sr and vf_derain to move
> > > their dnn material to this new repo from their personal repos. (see
> > > personal repo at
> > >
> https://git.ffmpeg.org/gitweb/ffmpeg.git/blob/HEAD:/doc/filters.texi#l8370
> > > and
> https://git.ffmpeg.org/gitweb/ffmpeg.git/blob/HEAD:/doc/filters.texi#l16718)
> > >
> > > So, once there is a need to update these dnn material, FFMPEG
> > > community can accept the pull request, instead of waiting for the
> > > authors who might ignore it for a long time.
> >
> > When you say "FFMPEG community can accept the pull request", you mean
> > into the official repository?

I do not mean the official repository https://git.ffmpeg.org/ffmpeg.git, I mean 
another
new repo and ffmpeg community has the right to assign/remove someone to have 
the write access.

> >
> > If so, then I strongly oppose anything like that: relying on GitHub or
> > any commercial / proprietary Git infrastructure, and depending on
> > web-based features.
> 
> Gitlab on videolan is the open source version, since we only rely on open 
> source
> software for the whole infrastructure,
> and you can use gitlab in CLI, and/or disable MR if you want (basically using 
> it
> like a dumb git repo, if you want).

thanks, I think we can create a git repo at 
code.videolan.org/ffmpeg/dnn_material.

> 
> --
> Jean-Baptiste Kempf - President
> +33 672 704 734
> 
> 
> ___
> 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] avcodec: add a WavPack DSD decoder

2019-07-21 Thread Andreas Rheinhardt
Lynne:
> Jul 22, 2019, 12:03 AM by da...@wavpack.com:
>> +    for (p0 = 0; p0 < history_bins; ++p0) {
>> +    int32_t sum_values;
>> +    unsigned char *vp;
>> +
>> +    for (sum_values = i = 0; i < 256; ++i)
>> +    s->summed_probabilities [p0] [i] = sum_values += 
>> s->probabilities [p0] [i];
> 
> sum_values is uninitialized. Does you compiler not warn about this?
> 
You apparently overlooked "sum_values = i = 0;"

- 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] avcodec: add a WavPack DSD decoder

2019-07-21 Thread Lynne
Jul 22, 2019, 12:03 AM by da...@wavpack.com:

> Hi,
>
> As I promised late last year, here is a patch to add a WavPack DSD decoder.
>
> Thanks!
>
> -David Bryant
>

> +    unsigned char probabilities [MAX_HISTORY_BINS] [256];
> +    unsigned char *value_lookup [MAX_HISTORY_BINS];

Use uint8_t throughout the patch.
Also don't add spaces between array declarations or lookups.


> +static void init_ptable (int *table, int rate_i, int rate_s)
> +{
> +    int value = 0x808000, rate = rate_i << 8, c, i;
> +
> +    for (c = (rate + 128) >> 8; c--;)
> +    value += (DOWN - value) >> DECAY;
> +
> +    for (i = 0; i < PTABLE_BINS/2; ++i) {

What's up with the random increment position in loops? It changes to before and 
after the variable throughout. Make it consistent and after the variable.
Also we support declarative for (int loops. Can save lines.


> +    DSDfilters filters [2], *sp = filters;

Same, spaces after variables for arrays, all throughout the file.


> +    if (code > max_probability) {
> +    int zcount = code - max_probability;
> +
> +    while (outptr < outend && zcount--)
> +    *outptr++ = 0;
> +    }
> +    else if (code)
> +    *outptr++ = code;
> +    else
> +    break;

We don't put else on a new line, and prefer to have each branch wrapped in 
bracket unless all branches are single lines.


> +    for (p0 = 0; p0 < history_bins; ++p0) {
> +    int32_t sum_values;
> +    unsigned char *vp;
> +
> +    for (sum_values = i = 0; i < 256; ++i)
> +    s->summed_probabilities [p0] [i] = sum_values += 
> s->probabilities [p0] [i];

sum_values is uninitialized. Does you compiler not warn about this?


> +    if (sum_values) {
> +    total_summed_probabilities += sum_values;
> +    vp = s->value_lookup [p0] = av_malloc (sum_values);

I don't like the per-frame alloc. The maximum sum_values can be is 255*255 = 
UINT16_MAX.
 60k of memory isn't much at all, just define value_lookup[255*255] in the 
context and you'll probably plug a few out of bounds accesses too.


> +mult = high / s->summed_probabilities [p0] [255];
s->summed_probabilities [p0] [255]; can be zero, you already check if its zero 
when allocating currently. You should probably check for divide by zero unless 
you're very sure it can't happen.


> +    crc += (crc << 1) + code;

Don't NIH CRCs, we have av_crc in lavu. See below how to use it.


> +static int wv_unpack_dsd_copy(WavpackFrameContext *s, void *dst_l, void 
> *dst_r)
> +{
> +    uint8_t *dsd_l  = dst_l;
> +    uint8_t *dsd_r  = dst_r;

You're shadowing arguments. Your compiler doesn't warn on this either?
You're calling the function with uint8_ts anyway, just change the type.


> +    while (total_samples--) {
> +    crc += (crc << 1) + (*dsd_l = bytestream2_get_byte(&s->gb));
> +    dsd_l += 4;
> +
> +    if (dst_r) {
> +    crc += (crc << 1) + (*dsd_r = bytestream2_get_byte(&s->gb));
> +    dsd_r += 4;
> +    }
> +    }

av_crc(av_crc_get_table(AV_CRC_32_IEEE/LE), UINT32_MAX, dsd_start_r/l, dsd_r/l 
- dsd_start_r/l) should work and be faster.


> +    s->fdec_num = 0;

Private codec context is always zeroed already.


> +    int chan = 0, chmask = 0, sample_rate = 0, rate_x = 1, dsd_mode = 0;
> +    chmask = avctx->channel_layout;
>  uint32_t chmask, flags;

frame->channel_layout is uint64_t.


> +    samples_l = frame->extended_data[wc->ch_offset];
> +    if (s->stereo)
> +    samples_r = frame->extended_data[wc->ch_offset + 1];
> +
> +    wc->ch_offset += 1 + s->stereo;

Have you checked non-stereo decodes fine and the channels are correctly ordered?


> +    if (id & WP_IDF_LONG) {
> +    size |= (bytestream2_get_byte(&gb)) << 8;
> +    size |= (bytestream2_get_byte(&gb)) << 16;
> +    }

Could use bytestream2_get_le16u/be16u to save 2 lines.


> +    if (!got_dsd) {
> +    av_log(avctx, AV_LOG_ERROR, "Packed samples not found\n");
> +    return AVERROR_INVALIDDATA;
> +    }

I think you should check avctx is completely configured before this, after 
parsing all WP_IDs, in case something is corrupt.


> +    frame->nb_samples = s->samples + 1;
> +    if ((ret = ff_get_buffer(avctx, frame, 0)) < 0)
> +    return ret;
> +    frame->nb_samples = s->samples;

?. Is the extra sample used as temporary buffer or something?


> +AVCodec ff_wavpack_dsd_decoder = {
> +    .name   = "wavpack_dsd",
> +    .long_name  = NULL_IF_CONFIG_SMALL("WavPack DSD"),
> +    .type   = AVMEDIA_TYPE_AUDIO,
> +    .id = AV_CODEC_ID_WAVPACK_DSD,
> +    .priv_data_size = sizeof(WavpackContext),
> +    .init   = wavpack_decode_init,
> +    .close  = wavpack_decode_end,
> +    .decode = wavpack_decode_frame,
> +    .capabilities   = AV_CODEC_CAP_DR1,
> +};

Seeking is p

Re: [FFmpeg-devel] [PATCH] libavfilter: Update derain filter doc.

2019-07-21 Thread Guo, Yejun


> -Original Message-
> From: Steven Liu [mailto:l...@chinaffmpeg.org]
> Sent: Sunday, July 21, 2019 8:10 PM
> To: FFmpeg development discussions and patches 
> Cc: Steven Liu ; Guo, Yejun 
> Subject: Re: [FFmpeg-devel] [PATCH] libavfilter: Update derain filter doc.
> 
> 
> 
> > 在 2019年7月21日,19:27,Xuewei Meng  写
> 道:
> >
> > Add the usage of tensorflow model in derain filter. Training scripts
> > as well as scripts for tf/native model generation are provided in the
> > repository at https://github.com/XueweiMeng/derain_filter.git.
> >
> > Signed-off-by: Xuewei Meng 
> > ---
> > doc/filters.texi | 18 +++---
> > 1 file changed, 11 insertions(+), 7 deletions(-)
> >
> > diff --git a/doc/filters.texi b/doc/filters.texi
> > index 604e44d569..0d442e0a82 100644
> > --- a/doc/filters.texi
> > +++ b/doc/filters.texi
> > @@ -8362,11 +8362,11 @@ convolutional neural networks. Supported
> models:
> >
> > @itemize
> > @item
> > -Recurrent Squeeze-and-Excitation Context Aggregation Net (RESCAN).
> > -See @url{
> >
> http://openaccess.thecvf.com/content_ECCV_2018/papers/Xia_Li_Recurrent_
> Squeeze-and-Excitation_Context_ECCV_2018_paper.pdf
> > }.
> > +Recurrent Squeeze-and-Excitation Context Aggregation Net (RESCAN). See
> > +@url{
> >
> http://openaccess.thecvf.com/content_ECCV_2018/papers/Xia_Li_Recurrent_
> Squeeze-and-Excitation_Context_ECCV_2018_paper.pdf
> > }.
> This should not modify if it have no change context.
> > @end itemize
> >
> > -Training scripts as well as scripts for model generation are provided in
> > +Training as well as model generation scripts are provided in
> > the repository at @url{https://github.com/XueweiMeng/derain_filter.git}.
> >
> > The filter accepts the following options:
> > @@ -8379,14 +8379,18 @@ the following values:
> > @table @samp
> > @item native
> > Native implementation of DNN loading and execution.
> > +
> > +@item tensorflow
> > +TensorFlow backend. To enable this backend you
> > +need to install the TensorFlow for C library (see
> > +@url{https://www.tensorflow.org/install/install_c}) and configure FFmpeg
> > with
> > +@code{--enable-libtensorflow}
> > @end table
> > -Default value is @samp{native}.
> >
> > @item model
> > Set path to model file specifying network architecture and its parameters.
> > -Note that different backends use different file formats. TensorFlow backend
> > -can load files for both formats, while native backend can load files for
> > only
> > -its format.
> > +Note that different backends use different file formats. TensorFlow and
> > native
> > +backend can load files for only its format.
> > @end table
> >
> > @section deshake
> > --
> > 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”.
> Other part look good to me,
> 
> Yejun
> 
> I think maybe Xuewei Meng can move the repo to one public repo zone of
> FFmpeg.
> Please continue push that work to create a public zone for this kind of 
> repo
> (eg. derain_filter.git).

sure.

> 
> Thanks
> Steven
> 
> 
> 
> 

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

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

[FFmpeg-devel] [PATCH 2/2] avcodec/vp3: Check that theora is theora

2019-07-21 Thread Michael Niedermayer
Fixes: Timeout (2min -> 100ms)
Fixes: 
15366/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_THEORA_fuzzer-5737849938247680

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

diff --git a/libavcodec/vp3.c b/libavcodec/vp3.c
index a6f759ebf5..8a165c1275 100644
--- a/libavcodec/vp3.c
+++ b/libavcodec/vp3.c
@@ -2957,6 +2957,8 @@ static int theora_decode_header(AVCodecContext *avctx, 
GetBitContext *gb)
 s->theora_header = 0;
 s->theora = get_bits_long(gb, 24);
 av_log(avctx, AV_LOG_DEBUG, "Theora bitstream version %X\n", s->theora);
+if (!s->theora)
+return AVERROR_INVALIDDATA;
 
 /* 3.2.0 aka alpha3 has the same frame orientation as original vp3
  * but previous versions have the image flipped relative to vp3 */
-- 
2.22.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/2] avcodec/pngdec: consider chunk size in minimal size check

2019-07-21 Thread Michael Niedermayer
assuming each block contains an empty chunk there has to be at least 8 bytes 
extra.

Fixes: 
15327/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_LSCR_fuzzer-5676669303521280
Fixes: Timeout (11->5sec)

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

diff --git a/libavcodec/pngdec.c b/libavcodec/pngdec.c
index bf5a5191cc..cad5796545 100644
--- a/libavcodec/pngdec.c
+++ b/libavcodec/pngdec.c
@@ -1547,7 +1547,7 @@ static int decode_frame_lscr(AVCodecContext *avctx,
 return ret;
 
 nb_blocks = bytestream2_get_le16(gb);
-if (bytestream2_get_bytes_left(gb) < 2 + nb_blocks * 12)
+if (bytestream2_get_bytes_left(gb) < 2 + nb_blocks * (12 + 8))
 return AVERROR_INVALIDDATA;
 
 if (s->last_picture.f->data[0]) {
-- 
2.22.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] avcodec: add a WavPack DSD decoder

2019-07-21 Thread David Bryant
Hi,

As I promised late last year, here is a patch to add a WavPack DSD decoder.

Thanks!

-David Bryant

From d80f4fb59e4afec1e2c539391a7b4484f5ae8436 Mon Sep 17 00:00:00 2001
From: David Bryant 
Date: Sun, 21 Jul 2019 15:43:25 -0700
Subject: [PATCH] avcodec: add a WavPack DSD decoder

Signed-off-by: David Bryant 
---
 libavcodec/Makefile  |   1 +
 libavcodec/allcodecs.c   |   1 +
 libavcodec/avcodec.h |   1 +
 libavcodec/codec_desc.c  |   7 +
 libavcodec/wavpack.h |   2 +
 libavcodec/wavpack_dsd.c | 792 +++
 libavformat/wvdec.c  |  32 +-
 7 files changed, 824 insertions(+), 12 deletions(-)
 create mode 100644 libavcodec/wavpack_dsd.c

diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 3cd73fb..b94327e 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -686,6 +686,7 @@ OBJS-$(CONFIG_VPLAYER_DECODER) += textdec.o ass.o
 OBJS-$(CONFIG_VP9_V4L2M2M_DECODER) += v4l2_m2m_dec.o
 OBJS-$(CONFIG_VQA_DECODER) += vqavideo.o
 OBJS-$(CONFIG_WAVPACK_DECODER) += wavpack.o
+OBJS-$(CONFIG_WAVPACK_DSD_DECODER) += wavpack_dsd.o dsd.o
 OBJS-$(CONFIG_WAVPACK_ENCODER) += wavpackenc.o
 OBJS-$(CONFIG_WCMV_DECODER)+= wcmv.o
 OBJS-$(CONFIG_WEBP_DECODER)+= webp.o
diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
index d2f9a39..a2f414b 100644
--- a/libavcodec/allcodecs.c
+++ b/libavcodec/allcodecs.c
@@ -485,6 +485,7 @@ extern AVCodec ff_vorbis_encoder;
 extern AVCodec ff_vorbis_decoder;
 extern AVCodec ff_wavpack_encoder;
 extern AVCodec ff_wavpack_decoder;
+extern AVCodec ff_wavpack_dsd_decoder;
 extern AVCodec ff_wmalossless_decoder;
 extern AVCodec ff_wmapro_decoder;
 extern AVCodec ff_wmav1_encoder;
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index d234271..8d3a551 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -652,6 +652,7 @@ enum AVCodecID {
 AV_CODEC_ID_SBC,
 AV_CODEC_ID_ATRAC9,
 AV_CODEC_ID_HCOM,
+AV_CODEC_ID_WAVPACK_DSD,
 
 /* subtitle codecs */
 AV_CODEC_ID_FIRST_SUBTITLE = 0x17000,  ///< A dummy ID pointing at 
the start of subtitle codecs.
diff --git a/libavcodec/codec_desc.c b/libavcodec/codec_desc.c
index 4d033c2..bee88b8 100644
--- a/libavcodec/codec_desc.c
+++ b/libavcodec/codec_desc.c
@@ -2985,6 +2985,13 @@ static const AVCodecDescriptor codec_descriptors[] = {
 .long_name = NULL_IF_CONFIG_SMALL("HCOM Audio"),
 .props = AV_CODEC_PROP_LOSSY,
 },
+{
+.id= AV_CODEC_ID_WAVPACK_DSD,
+.type  = AVMEDIA_TYPE_AUDIO,
+.name  = "wavpack_dsd",
+.long_name = NULL_IF_CONFIG_SMALL("WavPack DSD"),
+.props = AV_CODEC_PROP_LOSSLESS,
+},
 
 /* subtitle codecs */
 {
diff --git a/libavcodec/wavpack.h b/libavcodec/wavpack.h
index 6caad03..43aaac8 100644
--- a/libavcodec/wavpack.h
+++ b/libavcodec/wavpack.h
@@ -35,6 +35,7 @@
 #define WV_FLOAT_DATA 0x0080
 #define WV_INT32_DATA 0x0100
 #define WV_FALSE_STEREO   0x4000
+#define WV_DSD_DATA   0x8000
 
 #define WV_HYBRID_MODE0x0008
 #define WV_HYBRID_SHAPE   0x0008
@@ -77,6 +78,7 @@ enum WP_ID {
 WP_ID_CORR,
 WP_ID_EXTRABITS,
 WP_ID_CHANINFO,
+WP_ID_DSD_DATA,
 WP_ID_SAMPLE_RATE = 0x27,
 };
 
diff --git a/libavcodec/wavpack_dsd.c b/libavcodec/wavpack_dsd.c
new file mode 100644
index 000..0754314
--- /dev/null
+++ b/libavcodec/wavpack_dsd.c
@@ -0,0 +1,792 @@
+/*
+ * WavPack lossless DSD audio decoder
+ * Copyright (c) 2006,2011 Konstantin Shishkov
+ * Copyright (c) 2019 David Bryant
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "libavutil/channel_layout.h"
+
+#include "avcodec.h"
+#include "bytestream.h"
+#include "internal.h"
+#include "wavpack.h"
+#include "dsd.h"
+
+/**
+ * @file
+ * WavPack lossless DSD audio decoder
+ */
+
+#define DSD_BYTE_READY(low,high) (!(((low) ^ (high)) & 0xff00))
+
+#define PTABLE_BITS 8
+#define PTABLE_BINS (1avctx, AV_LOG_ERROR, "CRC error\n");
+return AVERROR_INVALIDDATA;
+}
+
+return 0;
+}
+
+static void init_ptable (int *table, int rate_i, int rate_s)
+{
+int value = 0x808000, rate = rate_i << 8, c, i

Re: [FFmpeg-devel] FFmpeg 4.2

2019-07-21 Thread Michael Niedermayer
On Mon, May 20, 2019 at 08:39:45PM +0200, Michael Niedermayer wrote:
> Hi
> 
> Its quite some time since 4.1 so its probably getting time to branch
> 4.2.
> 
> If there are any bugs you want fixed in 4.2 its probably a good idea to
> fix them soon.
> 
> Are there any suggestions for a name ?
> If not ill pick something from unused past suggestions.
> 
> If there are no objections i will likely make that release in the next weeks

4.2 branch made
i intend to make the 4.2 release from HEAD of release/4.2 in the next 1-2 weeks
please backport any relevant bugfixes to it.

If anyone wants any fancy announcements or other for it, write and post them
before the release!

Thanks

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

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


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

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

[FFmpeg-devel] [PATCH V1 1/3] lavf/hls: remove redundancy reset_packet() after av_packet_unref()

2019-07-21 Thread Jun Zhao
From: Jun Zhao 

av_packet_unref have reseted the AVPacket, so don't need to call
reset_packet after that.

Signed-off-by: Jun Zhao 
---
 libavformat/hls.c |4 
 1 files changed, 0 insertions(+), 4 deletions(-)

diff --git a/libavformat/hls.c b/libavformat/hls.c
index 8c12fce..238ebd0 100644
--- a/libavformat/hls.c
+++ b/libavformat/hls.c
@@ -2120,7 +2120,6 @@ static int hls_read_packet(AVFormatContext *s, AVPacket 
*pkt)
 }
 }
 av_packet_unref(&pls->pkt);
-reset_packet(&pls->pkt);
 }
 }
 /* Check if this stream has the packet with the lowest dts */
@@ -2149,7 +2148,6 @@ static int hls_read_packet(AVFormatContext *s, AVPacket 
*pkt)
 ret = update_streams_from_subdemuxer(s, pls);
 if (ret < 0) {
 av_packet_unref(&pls->pkt);
-reset_packet(&pls->pkt);
 return ret;
 }
 
@@ -2174,7 +2172,6 @@ static int hls_read_packet(AVFormatContext *s, AVPacket 
*pkt)
 av_log(s, AV_LOG_ERROR, "stream index inconsistency: index %d, %d 
main streams, %d subdemuxer streams\n",
pls->pkt.stream_index, pls->n_main_streams, 
pls->ctx->nb_streams);
 av_packet_unref(&pls->pkt);
-reset_packet(&pls->pkt);
 return AVERROR_BUG;
 }
 
@@ -2262,7 +2259,6 @@ static int hls_read_seek(AVFormatContext *s, int 
stream_index,
 ff_format_io_close(pls->parent, &pls->input_next);
 pls->input_next_requested = 0;
 av_packet_unref(&pls->pkt);
-reset_packet(&pls->pkt);
 pls->pb.eof_reached = 0;
 /* Clear any buffered data */
 pls->pb.buf_end = pls->pb.buf_ptr = pls->pb.buffer;
-- 
1.7.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 V1 3/3] lavf/hls: replace the same code logic with ensure_playlist()

2019-07-21 Thread Jun Zhao
From: vacingfang 

Replace the same code logic with ensure_playlist(), it's will
help reusable blocks of code.

Reviewed-by: Jun Zhao 
Signed-off-by: vacingfang 
---
 libavformat/hls.c |   10 +++---
 1 files changed, 3 insertions(+), 7 deletions(-)

diff --git a/libavformat/hls.c b/libavformat/hls.c
index 238ebd0..0522445 100644
--- a/libavformat/hls.c
+++ b/libavformat/hls.c
@@ -861,13 +861,9 @@ static int parse_playlist(HLSContext *c, const char *url,
 }
 if (is_segment) {
 struct segment *seg;
-if (!pls) {
-if (!new_variant(c, 0, url, NULL)) {
-ret = AVERROR(ENOMEM);
-goto fail;
-}
-pls = c->playlists[c->n_playlists - 1];
-}
+ret = ensure_playlist(c, &pls, url);
+if (ret < 0)
+goto fail;
 seg = av_malloc(sizeof(struct segment));
 if (!seg) {
 ret = AVERROR(ENOMEM);
-- 
1.7.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 V1 2/3] doc/ffmpeg: Document dts_error_threshold option

2019-07-21 Thread Jun Zhao
From: Jun Zhao 

Document dts_error_threshold option.

Signed-off-by: Jun Zhao 
---
 doc/ffmpeg.texi |2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/doc/ffmpeg.texi b/doc/ffmpeg.texi
index cd35eb4..2152e62 100644
--- a/doc/ffmpeg.texi
+++ b/doc/ffmpeg.texi
@@ -1515,6 +1515,8 @@ Enable bitexact mode for (de)muxer and (de/en)coder
 Finish encoding when the shortest input stream ends.
 @item -dts_delta_threshold
 Timestamp discontinuity delta threshold.
+@item -dts_error_threshold
+Timestamp error delta threshold.
 @item -muxdelay @var{seconds} (@emph{output})
 Set the maximum demux-decode delay.
 @item -muxpreload @var{seconds} (@emph{output})
-- 
1.7.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] libavfilter: Update derain filter doc.

2019-07-21 Thread Steven Liu


> 在 2019年7月21日,19:27,Xuewei Meng  写道:
> 
> Add the usage of tensorflow model in derain filter. Training scripts
> as well as scripts for tf/native model generation are provided in the
> repository at https://github.com/XueweiMeng/derain_filter.git.
> 
> Signed-off-by: Xuewei Meng 
> ---
> doc/filters.texi | 18 +++---
> 1 file changed, 11 insertions(+), 7 deletions(-)
> 
> diff --git a/doc/filters.texi b/doc/filters.texi
> index 604e44d569..0d442e0a82 100644
> --- a/doc/filters.texi
> +++ b/doc/filters.texi
> @@ -8362,11 +8362,11 @@ convolutional neural networks. Supported models:
> 
> @itemize
> @item
> -Recurrent Squeeze-and-Excitation Context Aggregation Net (RESCAN).
> -See @url{
> http://openaccess.thecvf.com/content_ECCV_2018/papers/Xia_Li_Recurrent_Squeeze-and-Excitation_Context_ECCV_2018_paper.pdf
> }.
> +Recurrent Squeeze-and-Excitation Context Aggregation Net (RESCAN). See
> +@url{
> http://openaccess.thecvf.com/content_ECCV_2018/papers/Xia_Li_Recurrent_Squeeze-and-Excitation_Context_ECCV_2018_paper.pdf
> }.
This should not modify if it have no change context.
> @end itemize
> 
> -Training scripts as well as scripts for model generation are provided in
> +Training as well as model generation scripts are provided in
> the repository at @url{https://github.com/XueweiMeng/derain_filter.git}.
> 
> The filter accepts the following options:
> @@ -8379,14 +8379,18 @@ the following values:
> @table @samp
> @item native
> Native implementation of DNN loading and execution.
> +
> +@item tensorflow
> +TensorFlow backend. To enable this backend you
> +need to install the TensorFlow for C library (see
> +@url{https://www.tensorflow.org/install/install_c}) and configure FFmpeg
> with
> +@code{--enable-libtensorflow}
> @end table
> -Default value is @samp{native}.
> 
> @item model
> Set path to model file specifying network architecture and its parameters.
> -Note that different backends use different file formats. TensorFlow backend
> -can load files for both formats, while native backend can load files for
> only
> -its format.
> +Note that different backends use different file formats. TensorFlow and
> native
> +backend can load files for only its format.
> @end table
> 
> @section deshake
> -- 
> 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”.
Other part look good to me,

Yejun

I think maybe Xuewei Meng can move the repo to one public repo zone of 
FFmpeg.
Please continue push that work to create a public zone for this kind of 
repo (eg. derain_filter.git).

Thanks
Steven





___
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] avformat/aacdec: factorize the adts frame resync code

2019-07-21 Thread Reimar Döffinger
On 21.07.2019, at 02:51, James Almer  wrote:

> ffmpeg | branch: master | James Almer  | Sat Jul 20 
> 10:13:08 2019 -0300| [a38eab8b7501440f872ff1af8a0c5482b7b3e532] | committer: 
> James Almer
> 
> avformat/aacdec: factorize the adts frame resync code
> 
> Signed-off-by: James Almer 
> 
>> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a38eab8b7501440f872ff1af8a0c5482b7b3e532
> ---
> 
> libavformat/aacdec.c | 37 +
> 1 file changed, 25 insertions(+), 12 deletions(-)
> 
> diff --git a/libavformat/aacdec.c b/libavformat/aacdec.c
> index 8a5450880b..262614fdd9 100644
> --- a/libavformat/aacdec.c
> +++ b/libavformat/aacdec.c
> @@ -80,10 +80,31 @@ static int adts_aac_probe(const AVProbeData *p)
> return 0;
> }
> 
> +static int adts_aac_resync(AVFormatContext *s)
> +{
> +uint16_t state;
> +
> +// skip data until an ADTS frame is found
> +state = avio_r8(s->pb);

Nit: could have merged declaration an initialization here.
___
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/4] avcodec/utils: Check close before calling it

2019-07-21 Thread Michael Niedermayer
On Sun, Jul 21, 2019 at 10:50:17AM +0200, Paul B Mahol wrote:
> LGTM

will apply

thanks

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

No snowflake in an avalanche ever feels responsible. -- Voltaire


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

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

Re: [FFmpeg-devel] [PATCH 6/6] avcodec/flicvideo: More strictly check chunk size for FLI_COPY

2019-07-21 Thread Reimar Döffinger
On 19.07.2019, at 21:46, Michael Niedermayer  wrote:

> On Fri, Jul 19, 2019 at 03:54:19PM +0200, Paul B Mahol wrote:
>> On 7/19/19, Michael Niedermayer  wrote:
>>> On Sat, Jun 22, 2019 at 01:29:36AM +0200, Michael Niedermayer wrote:
 Fixes: Timeout (40sec -> 13sec)
 Fixes:
 15417/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FLIC_fuzzer-5679812615602176
 
 Found-by: continuous fuzzing process
 https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
 Signed-off-by: Michael Niedermayer 
 ---
 libavcodec/flicvideo.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
>>> 
>>> will apply
>>> 
>> 
>> Why? This actually is breaking old code.
>> Can you please stop committing such kind of patches?
> 
> This patch was on the mailing list since a month, why do you point
> out a problem with it only once i say that i intend to apply it ?

You are sending an awful lot of these patches.
For my part it is purely random whether and when I manage to look at one even 
for code I somewhat know.
I imagine a lot of other people are struggling to keep up as well.
If you want better reviews you might want to think about better ways to 
categorise them to reduce review burden - e.g. by risk level.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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

Re: [FFmpeg-devel] [PATCH 4/4] avcodec/hqx: Check the input data against the image size

2019-07-21 Thread Reimar Döffinger
On 21.07.2019, at 00:36, Lynne  wrote:

> Jul 20, 2019, 11:08 PM by mich...@niedermayer.cc:
> 
>> Fixes: Timeout (22 -> 7 sec)
>> Fixes: 
>> 15173/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HQX_fuzzer-5662556846292992
>> 
>> Found-by: continuous fuzzing process 
>> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
>> Signed-off-by: Michael Niedermayer 
>> ---
>> libavcodec/hqx.c | 4 
>> 1 file changed, 4 insertions(+)
>> 
>> diff --git a/libavcodec/hqx.c b/libavcodec/hqx.c
>> index bc24ba91d1..8639d77a41 100644
>> --- a/libavcodec/hqx.c
>> +++ b/libavcodec/hqx.c
>> @@ -471,6 +471,10 @@ static int hqx_decode_frame(AVCodecContext *avctx, void 
>> *data,
>> avctx->height  = ctx->height;
>> avctx->bits_per_raw_sample = 10;
>> 
>> +if (avctx->coded_width / 16 * (avctx->coded_height / 16) *
>> +(100 - avctx->discard_damaged_percentage) / 100 > 8LL * avpkt->size)
>> +return AVERROR_INVALIDDATA;
>> + 
>> 
> 
> Not only are you ignoring my and others opinion, not only you still continue 
> sending these awful patches,
> you've just submitted by far the worst one I've ever seen thinking its okay.
> Patches like these motivate developers to not even bother including test 
> samples for new decoders, or even write them. Myself included. Doing exactly 
> the opposite of what this system's meant to help.
> Sure, you sent this for review, but how can you even consider this utterly 
> ridiculous hack for a problem that doesn't exist even worthy for review in 
> the first place? Just what the fuck?

I kind of understand your point of view, and the fuzzer complaining should not 
be an excuse to skip writing a commit message with some motivation for example, 
but I think you are a bit over the top.
There is already a discard_damaged_percentage and there is a point that maybe 
if a packet is obviously too broken to discard it with minimal overhead.
Those do not seem like utterly ridiculous ideas as your reply makes them out to 
me.
Nor is the idea of having some hardening against all too easy DoS attacks in 
some use-cases.
Also some value in just having the fuzzer run efficiently (it also discovers 
quite some real issues).
I agree it's hackish, I don't know the code enough to know it's correct, it 
needs to be properly documented (Michael, please, if you add such non-obvious, 
and especially heuristic checks, there needs to be some comment telling people 
the idea behind it and how to easily verify its correctness etc.).
With that in mind, can you maybe see why I do think that discussing such patch 
proposals does have merit?
Can we maybe come up with some compromise without being mad at each other?
Maybe some of these likely to be more controversial could be submitted as RFC 
instead of patch first?

Best regards,
Reimar
___
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] libavfilter: Update derain filter doc.

2019-07-21 Thread Xuewei Meng
Add the usage of tensorflow model in derain filter. Training scripts
as well as scripts for tf/native model generation are provided in the
repository at https://github.com/XueweiMeng/derain_filter.git.

Signed-off-by: Xuewei Meng 
---
 doc/filters.texi | 18 +++---
 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/doc/filters.texi b/doc/filters.texi
index 604e44d569..0d442e0a82 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -8362,11 +8362,11 @@ convolutional neural networks. Supported models:

 @itemize
 @item
-Recurrent Squeeze-and-Excitation Context Aggregation Net (RESCAN).
-See @url{
http://openaccess.thecvf.com/content_ECCV_2018/papers/Xia_Li_Recurrent_Squeeze-and-Excitation_Context_ECCV_2018_paper.pdf
}.
+Recurrent Squeeze-and-Excitation Context Aggregation Net (RESCAN). See
+@url{
http://openaccess.thecvf.com/content_ECCV_2018/papers/Xia_Li_Recurrent_Squeeze-and-Excitation_Context_ECCV_2018_paper.pdf
}.
 @end itemize

-Training scripts as well as scripts for model generation are provided in
+Training as well as model generation scripts are provided in
 the repository at @url{https://github.com/XueweiMeng/derain_filter.git}.

 The filter accepts the following options:
@@ -8379,14 +8379,18 @@ the following values:
 @table @samp
 @item native
 Native implementation of DNN loading and execution.
+
+@item tensorflow
+TensorFlow backend. To enable this backend you
+need to install the TensorFlow for C library (see
+@url{https://www.tensorflow.org/install/install_c}) and configure FFmpeg
with
+@code{--enable-libtensorflow}
 @end table
-Default value is @samp{native}.

 @item model
 Set path to model file specifying network architecture and its parameters.
-Note that different backends use different file formats. TensorFlow backend
-can load files for both formats, while native backend can load files for
only
-its format.
+Note that different backends use different file formats. TensorFlow and
native
+backend can load files for only its format.
 @end table

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

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

Re: [FFmpeg-devel] [PATCH] hevc_mp4toannexb: Do not duplicate parameter sets

2019-07-21 Thread Andreas Rheinhardt
Andriy Gelman:
> From: Andriy Gelman 
> 
> Fixes #7799
> 
> Currently, the mp4toannexb filter always inserts extradata at the start
> of each IRAP unit. This can lead to duplication of parameter sets if the
> demuxed packet from mdat atom already contains a version of the
> parameters.
> 
> As in ticket #7799 this can also lead to decoding errors when the
> parameter sets of the IRAP frames are different from the ones stored in
> extradata.
> 
> This commit avoids duplicating the parameter sets if they are already
> present in the demuxed packet.
> 
> This commit also makes an update to the hevc-bsf-mp4toannexb fate
> test since the result before this patch contained duplicate vps/sps/pps
> nal units.
> ---
>  libavcodec/hevc_mp4toannexb_bsf.c | 9 -
>  tests/fate/hevc.mak   | 2 +-
>  2 files changed, 9 insertions(+), 2 deletions(-)
> 
> diff --git a/libavcodec/hevc_mp4toannexb_bsf.c 
> b/libavcodec/hevc_mp4toannexb_bsf.c
> index 09bce5b34c..5c27306b09 100644
> --- a/libavcodec/hevc_mp4toannexb_bsf.c
> +++ b/libavcodec/hevc_mp4toannexb_bsf.c
> @@ -123,6 +123,7 @@ static int hevc_mp4toannexb_filter(AVBSFContext *ctx, 
> AVPacket *out)
>  
>  int got_irap = 0;
>  int i, ret = 0;
> +int vps_detected, sps_detected, pps_detected = 0;
>  
You are only initiallizing pps_detected.

>  ret = ff_bsf_get_packet(ctx, &in);
>  if (ret < 0)
> @@ -146,9 +147,15 @@ static int hevc_mp4toannexb_filter(AVBSFContext *ctx, 
> AVPacket *out)
>  
>  nalu_type = (bytestream2_peek_byte(&gb) >> 1) & 0x3f;
>  
> +switch (nalu_type) {
> +  case HEVC_NAL_VPS: vps_detected = 1; break;
> +  case HEVC_NAL_SPS: sps_detected = 1; break;
> +  case HEVC_NAL_PPS: pps_detected = 1; break;
> +}
> +
>  /* prepend extradata to IRAP frames */
>  is_irap   = nalu_type >= 16 && nalu_type <= 23;
> -add_extradata = is_irap && !got_irap;
> +add_extradata = is_irap && !got_irap && !(vps_detected && 
> sps_detected && pps_detected);
>  extra_size= add_extradata * ctx->par_out->extradata_size;
>  got_irap |= is_irap;
>  
There are two things that I don't like about this approach:
1. Image an input file like this: VPS, SPS and PPS in extradata and
then after a few GOPs there is an inband PPS as part of a VPS, SPS and
PPS combination where the PPS differs from the PPS in the extradata.
After this change in parameter sets there are no further inband
parameter sets. With your proposal, the extradata would again be
inserted into access units with IRAP frames after the change in
extradata and it would be the old, outdated extradata, thereby
breaking decoding (the original mp4 file would probably not be able
fully seekable in this case, but that would be another story).
2. If the sample in #7799 contained only the parameter set that
actually changed inband, your proposal would still add a whole
VPS+SPS+PPS combination and therefore still make the sample unplayable.

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

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

Re: [FFmpeg-devel] [PATCH 4/4] avcodec/hqx: Check the input data against the image size

2019-07-21 Thread Michael Niedermayer
On Sun, Jul 21, 2019 at 10:48:26AM +0200, Paul B Mahol wrote:
> On 7/21/19, Michael Niedermayer  wrote:
> > Fixes: Timeout (22 -> 7 sec)
> > Fixes:
> > 15173/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HQX_fuzzer-5662556846292992
> >
> > Found-by: continuous fuzzing process
> > https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> > Signed-off-by: Michael Niedermayer 
> > ---
> >  libavcodec/hqx.c | 4 
> >  1 file changed, 4 insertions(+)
> >
> > diff --git a/libavcodec/hqx.c b/libavcodec/hqx.c
> > index bc24ba91d1..8639d77a41 100644
> > --- a/libavcodec/hqx.c
> > +++ b/libavcodec/hqx.c
> > @@ -471,6 +471,10 @@ static int hqx_decode_frame(AVCodecContext *avctx, void
> > *data,
> >  avctx->height  = ctx->height;
> >  avctx->bits_per_raw_sample = 10;
> >
> > +if (avctx->coded_width / 16 * (avctx->coded_height / 16) *
> > +(100 - avctx->discard_damaged_percentage) / 100 > 8LL *
> > avpkt->size)
> > +return AVERROR_INVALIDDATA;
> 
> Why just this change and not something better?

What would you prefer exactly ?

Thanks

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

Modern terrorism, a quick summary: Need oil, start war with country that
has oil, kill hundread thousand in war. Let country fall into chaos,
be surprised about raise of fundamantalists. Drop more bombs, kill more
people, be surprised about them taking revenge and drop even more bombs
and strip your own citizens of their rights and freedoms. to be continued


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/4] avcodec/vorbisdec: Check vlc for floor0 dec vector offset

2019-07-21 Thread Michael Niedermayer
On Sun, Jul 21, 2019 at 11:27:44AM +0200, Paul B Mahol wrote:
> On 7/21/19, Michael Niedermayer  wrote:
> > On Mon, Jul 08, 2019 at 01:18:04AM +0200, Michael Niedermayer wrote:
> >> Fixes: out of array access
> >> Fixes:
> >> 15649/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VORBIS_fuzzer-5729191309344768
> >>
> >> Found-by: continuous fuzzing process
> >> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> >> Signed-off-by: Michael Niedermayer 
> >> ---
> >>  libavcodec/vorbisdec.c | 6 --
> >>  1 file changed, 4 insertions(+), 2 deletions(-)
> >
> > will apply
> 
> Are you sure returning that value is correct approach?
> 
> Correct value to return is usually INVALIDDATA.

the only call of this function i see does not use the value if it is
negative and uses INVALIDDATA instead.

ret = floor->decode(vc, &floor->data, floor_ptr[i]);

if (ret < 0) {
av_log(vc->avctx, AV_LOG_ERROR, "Invalid codebook in 
vorbis_floor_decode.\n");
return AVERROR_INVALIDDATA;
}

but ill replace the code in this patch by an explicit AVERROR_INVALIDDATA
before pushing

Thanks

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

it is not once nor twice but times without number that the same ideas make
their appearance in the world. -- Aristotle


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

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

Re: [FFmpeg-devel] [PATCH] avformat/mov: fix return code for trun box with no sample entries

2019-07-21 Thread Gyan



On 21-07-2019 02:21 PM, Paul B Mahol wrote:

On 7/20/19, Gyan  wrote:

Affected files can now be demuxed. Verified with John Stebbins. FATE
passes.

Gyan


You removed negative check, so not ok.


entries is unsigned (in the code as well as in the standard). So the 
value read from file will be >= 0. Even after adjustment for index size 
overflow, it cannot become negative.


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

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

Re: [FFmpeg-devel] [PATCH 3/4] avcodec/vorbisdec: Check vlc for floor0 dec vector offset

2019-07-21 Thread Paul B Mahol
On 7/21/19, Michael Niedermayer  wrote:
> On Mon, Jul 08, 2019 at 01:18:04AM +0200, Michael Niedermayer wrote:
>> Fixes: out of array access
>> Fixes:
>> 15649/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VORBIS_fuzzer-5729191309344768
>>
>> Found-by: continuous fuzzing process
>> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
>> Signed-off-by: Michael Niedermayer 
>> ---
>>  libavcodec/vorbisdec.c | 6 --
>>  1 file changed, 4 insertions(+), 2 deletions(-)
>
> will apply

Are you sure returning that value is correct approach?

Correct value to return is usually INVALIDDATA.

>
> [...]
> --
> Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> The educated differ from the uneducated as much as the living from the
> dead. -- Aristotle
>
___
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] tools/target_dec_fuzzer: Free parser in case of avcodec_open2() failure

2019-07-21 Thread Michael Niedermayer
On Mon, Jul 08, 2019 at 01:18:02AM +0200, Michael Niedermayer wrote:
> Fixes: memleak
> Fixes: part of 
> 15529/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_LIBVPX_VP8_fuzzer-5140143700180992
> 
> Found-by: continuous fuzzing process 
> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer 
> ---
>  tools/target_dec_fuzzer.c | 1 +
>  1 file changed, 1 insertion(+)

will apply

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

Does the universe only have a finite lifespan? No, its going to go on
forever, its just that you wont like living in it. -- Hiranya Peiri


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/4] avcodec/vorbisdec: Check vlc for floor0 dec vector offset

2019-07-21 Thread Michael Niedermayer
On Mon, Jul 08, 2019 at 01:18:04AM +0200, Michael Niedermayer wrote:
> Fixes: out of array access
> Fixes: 
> 15649/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VORBIS_fuzzer-5729191309344768
> 
> Found-by: continuous fuzzing process 
> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer 
> ---
>  libavcodec/vorbisdec.c | 6 --
>  1 file changed, 4 insertions(+), 2 deletions(-)

will apply

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

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


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

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

Re: [FFmpeg-devel] [PATCH 2/4] avcodec/vorbisdec: amplitude bits can be more than 25 bits

2019-07-21 Thread Michael Niedermayer
On Mon, Jul 08, 2019 at 01:18:03AM +0200, Michael Niedermayer wrote:
> Fixes: assertion failure, invalid shift
> Fixes: 
> 15583/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VORBIS_fuzzer-5640157484548096
> 
> Found-by: continuous fuzzing process 
> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer 
> ---
>  libavcodec/vorbisdec.c | 7 ---
>  1 file changed, 4 insertions(+), 3 deletions(-)

will apply

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

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


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
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 5/5] avutil/softfloat_ieee754: Fix odd bit position for exponent and sign in av_bits2sf_ieee754()

2019-07-21 Thread Michael Niedermayer
On Sun, Jul 07, 2019 at 03:18:14PM +0200, Michael Niedermayer wrote:
> Signed-off-by: Michael Niedermayer 
> ---
>  libavutil/softfloat_ieee754.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

will apply

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

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


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

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

Re: [FFmpeg-devel] [PATCH 2/5] avcodec/alsdec: fix undefined shift in multiply()

2019-07-21 Thread Michael Niedermayer
On Sun, Jul 07, 2019 at 03:18:11PM +0200, Michael Niedermayer wrote:
> Fixes: left shift of negative value -6
> Fixes: 
> 15564/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ALS_fuzzer-5701655938465792
> 
> Found-by: continuous fuzzing process 
> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer 
> ---
>  libavcodec/alsdec.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

will apply

[...]
-- 
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 6/6] avcodec/flicvideo: More strictly check chunk size for FLI_COPY

2019-07-21 Thread Paul B Mahol
On 7/19/19, Michael Niedermayer  wrote:
> On Fri, Jul 19, 2019 at 03:54:19PM +0200, Paul B Mahol wrote:
>> On 7/19/19, Michael Niedermayer  wrote:
>> > On Sat, Jun 22, 2019 at 01:29:36AM +0200, Michael Niedermayer wrote:
>> >> Fixes: Timeout (40sec -> 13sec)
>> >> Fixes:
>> >> 15417/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FLIC_fuzzer-5679812615602176
>> >>
>> >> Found-by: continuous fuzzing process
>> >> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
>> >> Signed-off-by: Michael Niedermayer 
>> >> ---
>> >>  libavcodec/flicvideo.c | 4 ++--
>> >>  1 file changed, 2 insertions(+), 2 deletions(-)
>> >
>> > will apply
>> >
>>
>> Why? This actually is breaking old code.
>> Can you please stop committing such kind of patches?
>
> This patch was on the mailing list since a month, why do you point
> out a problem with it only once i say that i intend to apply it ?
>
> either way, ill of course not apply it now that you point to a
> problem. But please provide a testcase that this patch breaks

Apparently decoder have padding of some kind for this stuff.
So check FLIC video files with different resolutions (the one that are
not same as padded values).

>
> Thanks
>
>
> [...]
> --
> Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> "Nothing to hide" only works if the folks in power share the values of
> you and everyone you know entirely and always will -- Tom Scott
>
>
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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

Re: [FFmpeg-devel] [PATCH 1/5] avcodec/alsdec: Fix 2 integer overflows

2019-07-21 Thread Michael Niedermayer
On Sun, Jul 07, 2019 at 03:18:10PM +0200, Michael Niedermayer wrote:
> Fixes: signed integer overflow: 1270564968 + 904828220 cannot be represented 
> in type 'int'
> Fixes: 
> 15402/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ALS_fuzzer-5755426823471104
> 
> Found-by: continuous fuzzing process 
> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer 
> ---
>  libavcodec/alsdec.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

will apply

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

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


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

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

[FFmpeg-devel] [PATCH 1/3] avcodec/apedec: Fix multiple integer overflows and undefined behaviorin filter_3800()

2019-07-21 Thread Michael Niedermayer
Fixes: left shift of negative value -4
Fixes: signed integer overflow: -15091694 * 167 cannot be represented in type 
'int'
Fixes: signed integer overflow: 1898547155 + 453967445 cannot be represented in 
type 'int'
Fixes: 
15258/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_APE_fuzzer-5759095564402688
Fixes: signed integer overflow: 962196438 * 31 cannot be represented in type 
'int'
Fixes: 
15364/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_APE_fuzzer-5718799845687296

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

diff --git a/libavcodec/apedec.c b/libavcodec/apedec.c
index 7cf99a00b1..27425b17e6 100644
--- a/libavcodec/apedec.c
+++ b/libavcodec/apedec.c
@@ -859,9 +859,9 @@ static av_always_inline int filter_3800(APEPredictor *p,
 return predictionA;
 }
 d2 =  p->buf[delayA];
-d1 = (p->buf[delayA] - p->buf[delayA - 1]) << 1;
-d0 =  p->buf[delayA] + ((p->buf[delayA - 2] - p->buf[delayA - 1]) << 3);
-d3 =  p->buf[delayB] * 2 - p->buf[delayB - 1];
+d1 = (p->buf[delayA] - p->buf[delayA - 1]) * 2U;
+d0 =  p->buf[delayA] + ((p->buf[delayA - 2] - p->buf[delayA - 1]) * 8U);
+d3 =  p->buf[delayB] * 2U - p->buf[delayB - 1];
 d4 =  p->buf[delayB];
 
 predictionA = d0 * p->coeffsA[filter][0] +
@@ -881,7 +881,7 @@ static av_always_inline int filter_3800(APEPredictor *p,
 p->coeffsB[filter][1] -= (((d4 >> 30) & 2) - 1) * sign;
 
 p->filterB[filter] = p->lastA[filter] + (predictionB >> shift);
-p->filterA[filter] = p->filterB[filter] + ((p->filterA[filter] * 31) >> 5);
+p->filterA[filter] = p->filterB[filter] + ((int)(p->filterA[filter] * 31U) 
>> 5);
 
 return p->filterA[filter];
 }
@@ -902,7 +902,7 @@ static void long_filter_high_3800(int32_t *buffer, int 
order, int shift, int len
 dotprod = 0;
 sign = APESIGN(buffer[i]);
 for (j = 0; j < order; j++) {
-dotprod += delay[j] * coeffs[j];
+dotprod += delay[j] * (unsigned)coeffs[j];
 coeffs[j] += ((delay[j] >> 31) | 1) * sign;
 }
 buffer[i] -= dotprod >> shift;
-- 
2.22.0

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

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

[FFmpeg-devel] [PATCH 3/3] avcodec/apedec: Make coeffsA/B uint32_t, this avoids several cases of undefined behavior

2019-07-21 Thread Michael Niedermayer
Changing the type to an unsigned one to avoid many casts was suggested
This may be inadequate for fixing the UB on ILP64

Fixes: signed integer overflow: -1418162611 * 383 cannot be represented in type 
'int'
Fixes: 
15547/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_APE_fuzzer-5691384901664768

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

diff --git a/libavcodec/apedec.c b/libavcodec/apedec.c
index 7a7097e7a4..e9ffdfdcdf 100644
--- a/libavcodec/apedec.c
+++ b/libavcodec/apedec.c
@@ -125,8 +125,8 @@ typedef struct APEPredictor {
 int32_t filterA[2];
 int32_t filterB[2];
 
-int32_t coeffsA[2][4];  ///< adaption coefficients
-int32_t coeffsB[2][5];  ///< adaption coefficients
+uint32_t coeffsA[2][4];  ///< adaption coefficients
+uint32_t coeffsB[2][5];  ///< adaption coefficients
 int32_t historybuffer[HISTORY_SIZE + PREDICTOR_SIZE];
 
 unsigned int sample_pos;
@@ -829,7 +829,7 @@ static av_always_inline int filter_fast_3320(APEPredictor 
*p,
 }
 
 predictionA = p->buf[delayA] * 2 - p->buf[delayA - 1];
-p->lastA[filter] = decoded + (predictionA  * p->coeffsA[filter][0] >> 9);
+p->lastA[filter] = decoded + ((int32_t)(predictionA  * 
p->coeffsA[filter][0]) >> 9);
 
 if ((decoded ^ predictionA) > 0)
 p->coeffsA[filter][0]++;
-- 
2.22.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 2/3] avcodec/apedec: make left/right unsigned to avoid undefined behavior

2019-07-21 Thread Michael Niedermayer
Fixes: signed integer overflow: 755176387 + 1515360583 cannot be represented in 
type 'int'
Fixes: 
15506/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_APE_fuzzer-5706859232624640

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

diff --git a/libavcodec/apedec.c b/libavcodec/apedec.c
index 27425b17e6..7a7097e7a4 100644
--- a/libavcodec/apedec.c
+++ b/libavcodec/apedec.c
@@ -1376,7 +1376,7 @@ static void ape_unpack_mono(APEContext *ctx, int count)
 
 static void ape_unpack_stereo(APEContext *ctx, int count)
 {
-int32_t left, right;
+unsigned left, right;
 int32_t *decoded0 = ctx->decoded[0];
 int32_t *decoded1 = ctx->decoded[1];
 
@@ -1393,7 +1393,7 @@ static void ape_unpack_stereo(APEContext *ctx, int count)
 
 /* Decorrelate and scale to output depth */
 while (count--) {
-left = *decoded1 - (*decoded0 / 2);
+left = *decoded1 - (unsigned)(*decoded0 / 2);
 right = left + *decoded0;
 
 *(decoded0++) = left;
-- 
2.22.0

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

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

Re: [FFmpeg-devel] [PATCH v1] filter select - avoid 2 times rounding

2019-07-21 Thread Paul B Mahol
On 7/20/19, Ulf Zibis  wrote:
>
> Am 20.07.19 um 00:37 schrieb Hendrik Leppkes:
>>> $1 The captain is always right.
>>>
>>> $2 If the captain fails, see $1.
>>>
>>> 0 against 327 fails in 2500 frames is a "slightly more favorable
>>> result". See my last post from 22:23 CEST.
>>>
>> The entire point is that your change is not a fix, its a bandaid at best.
> I never have talked about a fix. What is the drawback of implementing
> such a bandaid?
>
>> The behavior will still depend on many outside factors, like the
>> platform, if SSE or x87 FP math is being used, if fast or precise FP
>> mode is used by the compiler, and who knows what - because you are
>> expecting an equals comparison on a floating point value stemming from
>> a division to be true, which will just fail sometimes if one doesn't
>> round intentionally to get rid of the inaccuracy introduced by the
>> calculation itself.
> This is all correct. (the part about intentional rounding I don't
> understand, may please give an example)
>
> But keep in mind, that both calculations, the parsing from a string to a
> double floating point and the transform oft an integer pts to a double
> floating point value happen on the same machine with the same SSE and
> x87 FP math and binaries from the same build with the same compiler
> mode, so equality of both results is very very likely when doing only
> exactly 1 approximation step on both sides.
>
> The point is, that with e.g "10.2" the user is seeing a fixed point
> value (= 10,200 ms) which is equivalent to an exact rational value, and
> moreover FFmpeg claims to calculate with exact rationals where even
> possible. So how should a user come to the idea, that "10.2" becomes
> internally corrupted by "stupid" floating point
> representation/conversion, and additionally in light of an exact time
> base rational representation as e.g. 1/12800 s.
> From my point of view it was a half-baked or "lousy" idea to internally
> base all values of the select filter on a common double float array
> instead on a multityped struct, so honouring that, my patch is indeed a
> bandaid, but IMHO really helpful.
>
> If FFmpeg engineers still want to persevere on the "just always
> inaccurate" FP representation, why don't they provide a convenient
> like(x, y) expression besides eq(x, y)?

That is good idea, also provide same function but with 3rd parameter
which will set likeness amount. This is rather trivial to code.

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

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

Re: [FFmpeg-devel] [PATCH 4/4] avcodec/hqx: Check the input data against the image size

2019-07-21 Thread Paul B Mahol
On 7/21/19, Michael Niedermayer  wrote:
> Fixes: Timeout (22 -> 7 sec)
> Fixes:
> 15173/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HQX_fuzzer-5662556846292992
>
> Found-by: continuous fuzzing process
> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer 
> ---
>  libavcodec/hqx.c | 4 
>  1 file changed, 4 insertions(+)
>
> diff --git a/libavcodec/hqx.c b/libavcodec/hqx.c
> index bc24ba91d1..8639d77a41 100644
> --- a/libavcodec/hqx.c
> +++ b/libavcodec/hqx.c
> @@ -471,6 +471,10 @@ static int hqx_decode_frame(AVCodecContext *avctx, void
> *data,
>  avctx->height  = ctx->height;
>  avctx->bits_per_raw_sample = 10;
>
> +if (avctx->coded_width / 16 * (avctx->coded_height / 16) *
> +(100 - avctx->discard_damaged_percentage) / 100 > 8LL *
> avpkt->size)
> +return AVERROR_INVALIDDATA;

Why just this change and not something better?

> +
>  switch (ctx->format) {
>  case HQX_422:
>  avctx->pix_fmt = AV_PIX_FMT_YUV422P16;
> --
> 2.22.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 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/4] avcodec/apedec: Fix various integer overflows

2019-07-21 Thread Michael Niedermayer
On Sun, Jun 16, 2019 at 11:57:00AM +0200, Michael Niedermayer wrote:
> Fixes: signed integer overflow: -538976267 * 31 cannot be represented in type 
> 'int'
> Fixes: left shift of 65312 by 16 places cannot be represented in type 'int'
> Fixes: 
> 15255/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_APE_fuzzer-5718831688843264
> 
> Found-by: continuous fuzzing process 
> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer 
> ---
>  libavcodec/apedec.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)

will apply

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

"I am not trying to be anyone's saviour, I'm trying to think about the
 future and not be sad" - Elon Musk



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/4] avcodec/apedec: Fix multiple integer overflows in predictor_update_filter()

2019-07-21 Thread Michael Niedermayer
On Sun, Jun 16, 2019 at 11:56:58AM +0200, Michael Niedermayer wrote:
> Fixes: signed integer overflow: -829262115 + -1410750414 cannot be 
> represented in type 'int'
> Fixes: 
> 15251/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_APE_fuzzer-5651742252859392
> 
> Found-by: continuous fuzzing process 
> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer 
> ---
>  libavcodec/apedec.c | 20 ++--
>  1 file changed, 10 insertions(+), 10 deletions(-)

will apply

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

Those who are too smart to engage in politics are punished by being
governed by those who are dumber. -- 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] avformat/mov: fix return code for trun box with no sample entries

2019-07-21 Thread Paul B Mahol
On 7/20/19, Gyan  wrote:
>
> Affected files can now be demuxed. Verified with John Stebbins. FATE
> passes.
>
> Gyan
>

You removed negative check, so not ok.
___
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/4] avcodec/utils: Check close before calling it

2019-07-21 Thread Paul B Mahol
LGTM

On 7/21/19, Michael Niedermayer  wrote:
> Fixes: NULL pointer dereference
> Fixes:
> 15733/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_IDF_fuzzer-5658616977162240
>
> Found-by: continuous fuzzing process
> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer 
> ---
>  libavcodec/utils.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/libavcodec/utils.c b/libavcodec/utils.c
> index 9ff9628f7f..66c68d1cf5 100644
> --- a/libavcodec/utils.c
> +++ b/libavcodec/utils.c
> @@ -1024,7 +1024,7 @@ end:
>
>  return ret;
>  free_and_end:
> -if (avctx->codec &&
> +if (avctx->codec && avctx->codec->close &&
>  (codec_init_ok ||
>   (avctx->codec->caps_internal & FF_CODEC_CAP_INIT_CLEANUP)))
>  avctx->codec->close(avctx);
> --
> 2.22.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 mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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

Re: [FFmpeg-devel] [PATCH 4/6] avcodec/flicvideo: Make line_packets int

2019-07-21 Thread Michael Niedermayer
On Mon, Jul 08, 2019 at 09:04:34AM +0200, Paul B Mahol wrote:
> On 7/8/19, Michael Niedermayer  wrote:
> > On Sat, Jun 22, 2019 at 04:58:37PM +0200, Paul B Mahol wrote:
> >> On 6/22/19, Michael Niedermayer  wrote:
> >> > Fixes: signed integer overflow: -32768 * 196032 cannot be represented
> >> > in
> >> > type 'int'
> >> > Fixes:
> >> > 15300/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FLIC_fuzzer-5733319519502336
> >> >
> >> > Found-by: continuous fuzzing process
> >> > https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> >> > Signed-off-by: Michael Niedermayer 
> >> > ---
> >> >  libavcodec/flicvideo.c | 14 +++---
> >> >  1 file changed, 7 insertions(+), 7 deletions(-)
> >> >
> >> > diff --git a/libavcodec/flicvideo.c b/libavcodec/flicvideo.c
> >> > index ba5bda48c4..cd9cd089af 100644
> >> > --- a/libavcodec/flicvideo.c
> >> > +++ b/libavcodec/flicvideo.c
> >> > @@ -175,7 +175,7 @@ static int flic_decode_frame_8BPP(AVCodecContext
> >> > *avctx,
> >> >  int lines;
> >> >  int compressed_lines;
> >> >  int starting_line;
> >> > -signed short line_packets;
> >> > +int line_packets;
> >> >  int y_ptr;
> >> >  int byte_run;
> >> >  int pixel_skip;
> >> > @@ -274,7 +274,7 @@ static int flic_decode_frame_8BPP(AVCodecContext
> >> > *avctx,
> >> >  break;
> >> >  if (y_ptr > pixel_limit)
> >> >  return AVERROR_INVALIDDATA;
> >> > -line_packets = bytestream2_get_le16(&g2);
> >> > +line_packets = (int16_t)bytestream2_get_le16(&g2);
> >> >  if ((line_packets & 0xC000) == 0xC000) {
> >> >  // line skip opcode
> >> >  line_packets = -line_packets;
> >> > @@ -340,7 +340,7 @@ static int flic_decode_frame_8BPP(AVCodecContext
> >> > *avctx,
> >> >  pixel_countdown = s->avctx->width;
> >> >  if (bytestream2_tell(&g2) + 1 >
> >> > stream_ptr_after_chunk)
> >> >  break;
> >> > -line_packets = bytestream2_get_byte(&g2);
> >> > +line_packets = (int16_t)bytestream2_get_byte(&g2);
> >> >  if (line_packets > 0) {
> >> >  for (i = 0; i < line_packets; i++) {
> >> >  /* account for the skip bytes */
> >> > @@ -508,7 +508,7 @@ static int
> >> > flic_decode_frame_15_16BPP(AVCodecContext
> >> > *avctx,
> >> >
> >> >  int lines;
> >> >  int compressed_lines;
> >> > -signed short line_packets;
> >> > +int line_packets;
> >> >  int y_ptr;
> >> >  int byte_run;
> >> >  int pixel_skip;
> >> > @@ -572,7 +572,7 @@ static int
> >> > flic_decode_frame_15_16BPP(AVCodecContext
> >> > *avctx,
> >> >  break;
> >> >  if (y_ptr > pixel_limit)
> >> >  return AVERROR_INVALIDDATA;
> >> > -line_packets = bytestream2_get_le16(&g2);
> >> > +line_packets = (int16_t)bytestream2_get_le16(&g2);
> >> >  if (line_packets < 0) {
> >> >  line_packets = -line_packets;
> >> >  if (line_packets > s->avctx->height)
> >> > @@ -806,7 +806,7 @@ static int flic_decode_frame_24BPP(AVCodecContext
> >> > *avctx,
> >> >
> >> >  int lines;
> >> >  int compressed_lines;
> >> > -signed short line_packets;
> >> > +int line_packets;
> >> >  int y_ptr;
> >> >  int byte_run;
> >> >  int pixel_skip;
> >> > @@ -870,7 +870,7 @@ static int flic_decode_frame_24BPP(AVCodecContext
> >> > *avctx,
> >> >  break;
> >> >  if (y_ptr > pixel_limit)
> >> >  return AVERROR_INVALIDDATA;
> >> > -line_packets = bytestream2_get_le16(&g2);
> >> > +line_packets = (int16_t)bytestream2_get_le16(&g2);
> >> >  if (line_packets < 0) {
> >> >  line_packets = -line_packets;
> >> >  if (line_packets > s->avctx->height)
> >> > --
> >> > 2.22.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".
> >>
> >> In some cases casting in not needed.
> >
> > unneeded one dropped
> >
> >
> >> Also cant you use sign_extend ?
> >
> > certainly but that might be slower.
> > Do you prefer if i use sign_extend ?
> 
> Not if it is slower.

tested, no speedloss, will apply with sign_extend()

thanks

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

When you are offended at any man's fault, turn to yourself and study your
own failings. Then you will forget your anger. -- Epictetus


signature.asc
Description: PGP signature
___