[FFmpeg-devel] [PATCH 2/2] lavfi/sendcmd: correct the option flags dump

2020-09-12 Thread Jun Zhao
From: Jun Zhao 

correct the option flags dump for sendcmd/asendcmd.

Signed-off-by: Jun Zhao 
---
 libavfilter/f_sendcmd.c | 26 --
 1 file changed, 16 insertions(+), 10 deletions(-)

diff --git a/libavfilter/f_sendcmd.c b/libavfilter/f_sendcmd.c
index 6b02669..5e4c891 100644
--- a/libavfilter/f_sendcmd.c
+++ b/libavfilter/f_sendcmd.c
@@ -103,14 +103,6 @@ typedef struct SendCmdContext {
 } SendCmdContext;
 
 #define OFFSET(x) offsetof(SendCmdContext, x)
-#define FLAGS AV_OPT_FLAG_FILTERING_PARAM | AV_OPT_FLAG_AUDIO_PARAM | 
AV_OPT_FLAG_VIDEO_PARAM
-static const AVOption options[] = {
-{ "commands", "set commands", OFFSET(commands_str), AV_OPT_TYPE_STRING, 
{.str = NULL}, 0, 0, FLAGS },
-{ "c","set commands", OFFSET(commands_str), AV_OPT_TYPE_STRING, 
{.str = NULL}, 0, 0, FLAGS },
-{ "filename", "set commands file",  OFFSET(commands_filename), 
AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, FLAGS },
-{ "f","set commands file",  OFFSET(commands_filename), 
AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, FLAGS },
-{ NULL }
-};
 
 #define SPACES " \f\t\n\r"
 
@@ -574,7 +566,14 @@ end:
 
 #if CONFIG_SENDCMD_FILTER
 
-#define sendcmd_options options
+#define VFLAGS AV_OPT_FLAG_FILTERING_PARAM | AV_OPT_FLAG_VIDEO_PARAM
+static const AVOption sendcmd_options[] = {
+{ "commands", "set commands", OFFSET(commands_str), AV_OPT_TYPE_STRING, 
{.str = NULL}, 0, 0, VFLAGS },
+{ "c","set commands", OFFSET(commands_str), AV_OPT_TYPE_STRING, 
{.str = NULL}, 0, 0, VFLAGS },
+{ "filename", "set commands file",  OFFSET(commands_filename), 
AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, VFLAGS },
+{ "f","set commands file",  OFFSET(commands_filename), 
AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, VFLAGS },
+{ NULL }
+};
 AVFILTER_DEFINE_CLASS(sendcmd);
 
 static const AVFilterPad sendcmd_inputs[] = {
@@ -609,7 +608,14 @@ AVFilter ff_vf_sendcmd = {
 
 #if CONFIG_ASENDCMD_FILTER
 
-#define asendcmd_options options
+#define AFLAGS AV_OPT_FLAG_FILTERING_PARAM | AV_OPT_FLAG_AUDIO_PARAM
+static const AVOption asendcmd_options[] = {
+{ "commands", "set commands", OFFSET(commands_str), AV_OPT_TYPE_STRING, 
{.str = NULL}, 0, 0, AFLAGS },
+{ "c","set commands", OFFSET(commands_str), AV_OPT_TYPE_STRING, 
{.str = NULL}, 0, 0, AFLAGS },
+{ "filename", "set commands file",  OFFSET(commands_filename), 
AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, AFLAGS },
+{ "f","set commands file",  OFFSET(commands_filename), 
AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, AFLAGS },
+{ NULL }
+};
 AVFILTER_DEFINE_CLASS(asendcmd);
 
 static const AVFilterPad asendcmd_inputs[] = {
-- 
2.7.4

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

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

[FFmpeg-devel] [PATCH 1/2] lavfi/drawtext: Add reinit to debug message

2020-09-12 Thread Jun Zhao
From: Jun Zhao 

Add reinit flag to debug message, it's help to debug sending commands
to drawtext.

Signed-off-by: Jun Zhao 
---
 libavfilter/vf_drawtext.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavfilter/vf_drawtext.c b/libavfilter/vf_drawtext.c
index abe1ca6..19e73b7 100644
--- a/libavfilter/vf_drawtext.c
+++ b/libavfilter/vf_drawtext.c
@@ -1536,10 +1536,10 @@ static int filter_frame(AVFilterLink *inlink, AVFrame 
*frame)
 
 draw_text(ctx, frame, frame->width, frame->height);
 
-av_log(ctx, AV_LOG_DEBUG, "n:%d t:%f text_w:%d text_h:%d x:%d y:%d\n",
+av_log(ctx, AV_LOG_DEBUG, "n:%d t:%f text_w:%d text_h:%d x:%d y:%d 
reinit:%d\n",
(int)s->var_values[VAR_N], s->var_values[VAR_T],
(int)s->var_values[VAR_TEXT_W], (int)s->var_values[VAR_TEXT_H],
-   s->x, s->y);
+   s->x, s->y, s->reinit);
 
 return ff_filter_frame(outlink, frame);
 }
-- 
2.7.4

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

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

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

2020-09-12 Thread Zlomek, Josef
Dne so 12. 9. 2020 22:35 uživatel Carl Eugen Hoyos 
napsal:

> Am Fr., 11. Sept. 2020 um 08:36 Uhr schrieb Josef Zlomek :
>
> This is not the requested review, I am just curious about the
> behaviour:
>
> > +static int webp_probe(const AVProbeData *p)
> > +{
> > +const uint8_t *b = p->buf;
> > +
> > +if (AV_RB32(b) == MKBETAG('R', 'I', 'F', 'F') &&
> > +AV_RB32(b + 8) == MKBETAG('W', 'E', 'B', 'P'))
> > +return AVPROBE_SCORE_MAX;
>
> What happens if you pipe several (not animated) webp images
> through your new demuxer?
> Does it behave like the existing pipe demuxer?
>

Piping several WebP images (may be non-animated or animated) is supported.
webp_probe checks if the first one is WebP so the WebP demuxer should be
used.

> +static int resync(AVFormatContext *s, int seek_to_start)
> > +{
> > +WebPDemuxContext *wdc = s->priv_data;
> > +AVIOContext  *pb  = s->pb;
> > +int ret;
> > +int i;
> > +uint64_t state = 0;
> > +
> > +// ensure seek back for the file header and the first chunk header
> > +if ((ret = ensure_seekback(s, 12 + 8)) < 0)
> > +return ret;
> > +
> > +for (i = 0; i < 12; i++) {
> > +state = (state << 8) | avio_r8(pb);
>
> > +if (i == 11) {
> > +if ((uint32_t) state == MKBETAG('W', 'E', 'B', 'P'))
>
> The cast looks really ugly: Why is it necessary?
>

The signature of the WebP file is the following 12 bytes: "RIFF"  "WEBP".
The state is uint64_t. At this point, the state should contain bytes 4-11
of the signature (size and "WEBP") so the code checks that the lower 32
bits are "WEBP".
Alternatively there may be "state & 0x". I used the typecast as I
have seen it somewhere else (original WebP parser).

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

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

[FFmpeg-devel] [PATCH 16/16] avcodec/vble: Don't free buffer known to be NULL

2020-09-12 Thread Andreas Rheinhardt
Freeing a buffer allocated in the VBLE decoder's init function
is the only thing the decoder's close function does and this implies
that it is unnecessary to call it in case said allocation fails. Yet
this is what has been done.

Signed-off-by: Andreas Rheinhardt 
---
 libavcodec/vble.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/libavcodec/vble.c b/libavcodec/vble.c
index c48c13127a..2cddd550b1 100644
--- a/libavcodec/vble.c
+++ b/libavcodec/vble.c
@@ -197,7 +197,6 @@ static av_cold int vble_decode_init(AVCodecContext *avctx)
 
 if (!ctx->val) {
 av_log(avctx, AV_LOG_ERROR, "Could not allocate values buffer.\n");
-vble_decode_close(avctx);
 return AVERROR(ENOMEM);
 }
 
-- 
2.25.1

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

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

[FFmpeg-devel] [PATCH 15/16] avcodec/vb: Cleanup generically after init failure

2020-09-12 Thread Andreas Rheinhardt
In other words: Set the FF_CODEC_CAP_INIT_CLEANUP flag.

Signed-off-by: Andreas Rheinhardt 
---
 libavcodec/vb.c | 6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/libavcodec/vb.c b/libavcodec/vb.c
index d9c6b93a73..fe419c7663 100644
--- a/libavcodec/vb.c
+++ b/libavcodec/vb.c
@@ -262,11 +262,8 @@ static av_cold int decode_init(AVCodecContext *avctx)
 c->frame  = av_mallocz(avctx->width * avctx->height);
 c->prev_frame = av_mallocz(avctx->width * avctx->height);
 
-if (!c->frame || !c->prev_frame) {
-av_freep(>frame);
-av_freep(>prev_frame);
+if (!c->frame || !c->prev_frame)
 return AVERROR(ENOMEM);
-}
 
 return 0;
 }
@@ -291,4 +288,5 @@ AVCodec ff_vb_decoder = {
 .close  = decode_end,
 .decode = decode_frame,
 .capabilities   = AV_CODEC_CAP_DR1,
+.caps_internal  = FF_CODEC_CAP_INIT_CLEANUP,
 };
-- 
2.25.1

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

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

[FFmpeg-devel] [PATCH 14/16] avcodec/tscc2: Cleanup generically after init failure

2020-09-12 Thread Andreas Rheinhardt
Do this by setting the FF_CODEC_CAP_INIT_CLEANUP flag.

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

diff --git a/libavcodec/tscc2.c b/libavcodec/tscc2.c
index 65fbb010f6..6aadb51ad4 100644
--- a/libavcodec/tscc2.c
+++ b/libavcodec/tscc2.c
@@ -74,18 +74,14 @@ static av_cold int init_vlcs(TSCC2Context *c)
  tscc2_nc_vlc_bits[i],  1, 1,
  tscc2_nc_vlc_codes[i], 2, 2,
  tscc2_nc_vlc_syms, 1, 1, INIT_VLC_LE);
-if (ret) {
-free_vlcs(c);
+if (ret)
 return ret;
-}
 ret = ff_init_vlc_sparse(c->ac_vlc + i, 9, tscc2_ac_vlc_sizes[i],
  tscc2_ac_vlc_bits[i],  1, 1,
  tscc2_ac_vlc_codes[i], 2, 2,
  tscc2_ac_vlc_syms[i],  2, 2, INIT_VLC_LE);
-if (ret) {
-free_vlcs(c);
+if (ret)
 return ret;
-}
 }
 
 return 0;
@@ -360,15 +356,12 @@ static av_cold int tscc2_decode_init(AVCodecContext 
*avctx)
 c->slice_quants = av_malloc(c->mb_width * c->mb_height);
 if (!c->slice_quants) {
 av_log(avctx, AV_LOG_ERROR, "Cannot allocate slice information\n");
-free_vlcs(c);
 return AVERROR(ENOMEM);
 }
 
 c->pic = av_frame_alloc();
-if (!c->pic) {
-tscc2_decode_end(avctx);
+if (!c->pic)
 return AVERROR(ENOMEM);
-}
 
 return 0;
 }
@@ -383,4 +376,5 @@ AVCodec ff_tscc2_decoder = {
 .close  = tscc2_decode_end,
 .decode = tscc2_decode_frame,
 .capabilities   = AV_CODEC_CAP_DR1,
+.caps_internal  = FF_CODEC_CAP_INIT_CLEANUP,
 };
-- 
2.25.1

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

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

[FFmpeg-devel] [PATCH 07/16] avcodec/pcm: Avoid indirection when calling float dsp function

2020-09-12 Thread Andreas Rheinhardt
Do this by only keeping the only function pointer from the
AVFloatDSPContext that is needed lateron. This also allows to remove the
decoders' close function.

Signed-off-by: Andreas Rheinhardt 
---
 libavcodec/pcm.c | 26 ++
 1 file changed, 10 insertions(+), 16 deletions(-)

diff --git a/libavcodec/pcm.c b/libavcodec/pcm.c
index 96a68f7fe8..12d1b3a2c3 100644
--- a/libavcodec/pcm.c
+++ b/libavcodec/pcm.c
@@ -235,13 +235,15 @@ static int pcm_encode_frame(AVCodecContext *avctx, 
AVPacket *avpkt,
 
 typedef struct PCMDecode {
 short   table[256];
-AVFloatDSPContext *fdsp;
+void (*vector_fmul_scalar)(float *dst, const float *src, float mul,
+   int len);
 float   scale;
 } PCMDecode;
 
 static av_cold int pcm_decode_init(AVCodecContext *avctx)
 {
 PCMDecode *s = avctx->priv_data;
+AVFloatDSPContext *fdsp;
 int i;
 
 if (avctx->channels <= 0) {
@@ -268,9 +270,11 @@ static av_cold int pcm_decode_init(AVCodecContext *avctx)
 return AVERROR_INVALIDDATA;
 
 s->scale = 1. / (1 << (avctx->bits_per_coded_sample - 1));
-s->fdsp = avpriv_float_dsp_alloc(0);
-if (!s->fdsp)
+fdsp = avpriv_float_dsp_alloc(0);
+if (!fdsp)
 return AVERROR(ENOMEM);
+s->vector_fmul_scalar = fdsp->vector_fmul_scalar;
+av_free(fdsp);
 break;
 default:
 break;
@@ -284,15 +288,6 @@ static av_cold int pcm_decode_init(AVCodecContext *avctx)
 return 0;
 }
 
-static av_cold int pcm_decode_close(AVCodecContext *avctx)
-{
-PCMDecode *s = avctx->priv_data;
-
-av_freep(>fdsp);
-
-return 0;
-}
-
 /**
  * Read PCM samples macro
  * @param size   Data size of native machine format
@@ -529,9 +524,9 @@ static int pcm_decode_frame(AVCodecContext *avctx, void 
*data,
 
 if (avctx->codec_id == AV_CODEC_ID_PCM_F16LE ||
 avctx->codec_id == AV_CODEC_ID_PCM_F24LE) {
-s->fdsp->vector_fmul_scalar((float *)frame->extended_data[0],
-(const float *)frame->extended_data[0],
-s->scale, FFALIGN(frame->nb_samples * 
avctx->channels, 4));
+s->vector_fmul_scalar((float *)frame->extended_data[0],
+  (const float *)frame->extended_data[0],
+  s->scale, FFALIGN(frame->nb_samples * 
avctx->channels, 4));
 emms_c();
 }
 
@@ -570,7 +565,6 @@ AVCodec ff_ ## name_ ## _decoder = {
\
 .id = AV_CODEC_ID_ ## id_,  \
 .priv_data_size = sizeof(PCMDecode),\
 .init   = pcm_decode_init,  \
-.close  = pcm_decode_close, \
 .decode = pcm_decode_frame, \
 .capabilities   = AV_CODEC_CAP_DR1, \
 .sample_fmts= (const enum AVSampleFormat[]){ sample_fmt_,   \
-- 
2.25.1

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

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

[FFmpeg-devel] [PATCH 13/16] avcodec/svq3: Avoid overhead of AVBuffer API

2020-09-12 Thread Andreas Rheinhardt
Up until now, the SVQ3 decoder allocated several refcounted buffers,
despite no sharing/refcounting happening at all: Their refcount never
exceeds one and they are treated like ordinary buffers (with the
exception that the pointer used to access them is in the middle of the
allocated buffer, but this does not warrant using the AVBuffer API at
all). Given that using the AVBuffer API incurs overhead, it is no longer
used at all.

Signed-off-by: Andreas Rheinhardt 
---
 libavcodec/svq3.c | 17 -
 1 file changed, 8 insertions(+), 9 deletions(-)

diff --git a/libavcodec/svq3.c b/libavcodec/svq3.c
index 0ac81364bd..fb7b992496 100644
--- a/libavcodec/svq3.c
+++ b/libavcodec/svq3.c
@@ -70,11 +70,10 @@
 typedef struct SVQ3Frame {
 AVFrame *f;
 
-AVBufferRef *motion_val_buf[2];
+int16_t (*motion_val_buf[2])[2];
 int16_t (*motion_val[2])[2];
 
-AVBufferRef *mb_type_buf;
-uint32_t *mb_type;
+uint32_t *mb_type_buf, *mb_type;
 } SVQ3Frame;
 
 typedef struct SVQ3Context {
@@ -1325,9 +1324,9 @@ static void free_picture(AVCodecContext *avctx, SVQ3Frame 
*pic)
 {
 int i;
 for (i = 0; i < 2; i++) {
-av_buffer_unref(>motion_val_buf[i]);
+av_freep(>motion_val_buf[i]);
 }
-av_buffer_unref(>mb_type_buf);
+av_freep(>mb_type_buf);
 
 av_frame_unref(pic->f);
 }
@@ -1343,19 +1342,19 @@ static int get_buffer(AVCodecContext *avctx, SVQ3Frame 
*pic)
 if (!pic->motion_val_buf[0]) {
 int i;
 
-pic->mb_type_buf = av_buffer_allocz((big_mb_num + s->mb_stride) * 
sizeof(uint32_t));
+pic->mb_type_buf = av_calloc(big_mb_num + s->mb_stride, 
sizeof(uint32_t));
 if (!pic->mb_type_buf)
 return AVERROR(ENOMEM);
-pic->mb_type = (uint32_t*)pic->mb_type_buf->data + 2 * s->mb_stride + 
1;
+pic->mb_type = pic->mb_type_buf + 2 * s->mb_stride + 1;
 
 for (i = 0; i < 2; i++) {
-pic->motion_val_buf[i] = av_buffer_allocz(2 * (b4_array_size + 4) 
* sizeof(int16_t));
+pic->motion_val_buf[i] = av_calloc(b4_array_size + 4, 2 * 
sizeof(int16_t));
 if (!pic->motion_val_buf[i]) {
 ret = AVERROR(ENOMEM);
 goto fail;
 }
 
-pic->motion_val[i] = (int16_t (*)[2])pic->motion_val_buf[i]->data 
+ 4;
+pic->motion_val[i] = pic->motion_val_buf[i] + 4;
 }
 }
 
-- 
2.25.1

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

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

[FFmpeg-devel] [PATCH 05/16] avcodec/ra144enc: Don't free unnecessarily

2020-09-12 Thread Andreas Rheinhardt
The init function of the real_144 encoder calls its own close function
if a call to ff_lpc_init() fails; yet nothing has been allocated before
that point and ff_lpc_init() can be expected to clean up after itself on
error (the documentation does not say anything to the contrary and the
current implementation can only fail if the only allocation fails, so
there is nothing to clean up on error anyway), so this is unnecessary.

Signed-off-by: Andreas Rheinhardt 
---
 libavcodec/ra144enc.c | 5 +
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/libavcodec/ra144enc.c b/libavcodec/ra144enc.c
index 059f582334..c6965c5c47 100644
--- a/libavcodec/ra144enc.c
+++ b/libavcodec/ra144enc.c
@@ -65,14 +65,11 @@ static av_cold int ra144_encode_init(AVCodecContext * avctx)
 ret = ff_lpc_init(>lpc_ctx, avctx->frame_size, LPC_ORDER,
   FF_LPC_TYPE_LEVINSON);
 if (ret < 0)
-goto error;
+return ret;
 
 ff_af_queue_init(avctx, >afq);
 
 return 0;
-error:
-ra144_encode_close(avctx);
-return ret;
 }
 
 
-- 
2.25.1

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

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

[FFmpeg-devel] [PATCH 11/16] avcodec/svq3: Fix memleaks upon allocation error

2020-09-12 Thread Andreas Rheinhardt
Commit b2361cfb94738298a6c4037cc348fe5015efb841e made all of the
error paths in svq3_decode_init() call svq3_decode_end(); yet several
new error paths that were added later (in merges from Libav) returned
directly without cleaning up properly. This commit fixes the resulting
potential memleaks by setting the FF_CODEC_CAP_INIT_CLEANUP flag. This
also allows to simplify freeing by returning directly.

Signed-off-by: Andreas Rheinhardt 
---
 libavcodec/svq3.c | 39 +--
 1 file changed, 13 insertions(+), 26 deletions(-)

diff --git a/libavcodec/svq3.c b/libavcodec/svq3.c
index 8a67836827..41a9bf2daa 100644
--- a/libavcodec/svq3.c
+++ b/libavcodec/svq3.c
@@ -222,8 +222,6 @@ static const uint32_t svq3_dequant_coeff[32] = {
 61694, 68745, 77615, 89113, 100253, 109366, 126635, 141533
 };
 
-static int svq3_decode_end(AVCodecContext *avctx);
-
 static void svq3_luma_dc_dequant_idct_c(int16_t *output, int16_t *input, int 
qp)
 {
 const unsigned qmul = svq3_dequant_coeff[qp];
@@ -1185,10 +1183,8 @@ static av_cold int svq3_decode_init(AVCodecContext 
*avctx)
 int w,h;
 
 size = AV_RB32([4]);
-if (size > extradata_end - extradata - 8) {
-ret = AVERROR_INVALIDDATA;
-goto fail;
-}
+if (size > extradata_end - extradata - 8)
+return AVERROR_INVALIDDATA;
 init_get_bits(, extradata + 8, size * 8);
 
 /* 'frame size code' and optional 'width, height' */
@@ -1229,7 +1225,7 @@ static av_cold int svq3_decode_init(AVCodecContext *avctx)
 }
 ret = ff_set_dimensions(avctx, w, h);
 if (ret < 0)
-goto fail;
+return ret;
 
 s->halfpel_flag  = get_bits1();
 s->thirdpel_flag = get_bits1();
@@ -1248,10 +1244,8 @@ static av_cold int svq3_decode_init(AVCodecContext 
*avctx)
 av_log(avctx, AV_LOG_DEBUG, "Unknown fields %d %d %d %d %d\n",
unk0, unk1, unk2, unk3, unk4);
 
-if (skip_1stop_8data_bits() < 0) {
-ret = AVERROR_INVALIDDATA;
-goto fail;
-}
+if (skip_1stop_8data_bits() < 0)
+return AVERROR_INVALIDDATA;
 
 s->has_watermark  = get_bits1();
 avctx->has_b_frames = !s->low_delay;
@@ -1269,16 +1263,13 @@ static av_cold int svq3_decode_init(AVCodecContext 
*avctx)
 uint8_t *buf;
 
 if (watermark_height <= 0 ||
-(uint64_t)watermark_width * 4 > UINT_MAX / watermark_height) {
-ret = -1;
-goto fail;
-}
+(uint64_t)watermark_width * 4 > UINT_MAX / watermark_height)
+return AVERROR_INVALIDDATA;
 
 buf = av_malloc(buf_len);
-if (!buf) {
-ret = AVERROR(ENOMEM);
-goto fail;
-}
+if (!buf)
+return AVERROR(ENOMEM);
+
 av_log(avctx, AV_LOG_DEBUG, "watermark size: %ux%u\n",
watermark_width, watermark_height);
 av_log(avctx, AV_LOG_DEBUG,
@@ -1289,8 +1280,7 @@ static av_cold int svq3_decode_init(AVCodecContext *avctx)
 av_log(avctx, AV_LOG_ERROR,
"could not uncompress watermark logo\n");
 av_free(buf);
-ret = -1;
-goto fail;
+return -1;
 }
 s->watermark_key = 
av_bswap16(av_crc(av_crc_get_table(AV_CRC_16_CCITT), 0, buf, buf_len));
 
@@ -1301,8 +1291,7 @@ static av_cold int svq3_decode_init(AVCodecContext *avctx)
 #else
 av_log(avctx, AV_LOG_ERROR,
"this svq3 file contains watermark which need zlib support 
compiled in\n");
-ret = -1;
-goto fail;
+return AVERROR(ENOSYS);
 #endif
 }
 }
@@ -1334,9 +1323,6 @@ static av_cold int svq3_decode_init(AVCodecContext *avctx)
 init_dequant4_coeff_table(s);
 
 return 0;
-fail:
-svq3_decode_end(avctx);
-return ret;
 }
 
 static void free_picture(AVCodecContext *avctx, SVQ3Frame *pic)
@@ -1654,4 +1640,5 @@ AVCodec ff_svq3_decoder = {
   AV_CODEC_CAP_DELAY,
 .pix_fmts   = (const enum AVPixelFormat[]) { AV_PIX_FMT_YUVJ420P,
  AV_PIX_FMT_NONE},
+.caps_internal  = FF_CODEC_CAP_INIT_CLEANUP,
 };
-- 
2.25.1

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

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

[FFmpeg-devel] [PATCH 12/16] avcodec/svq3: Remove unused buffer

2020-09-12 Thread Andreas Rheinhardt
Signed-off-by: Andreas Rheinhardt 
---
 libavcodec/svq3.c | 10 +-
 1 file changed, 1 insertion(+), 9 deletions(-)

diff --git a/libavcodec/svq3.c b/libavcodec/svq3.c
index 41a9bf2daa..0ac81364bd 100644
--- a/libavcodec/svq3.c
+++ b/libavcodec/svq3.c
@@ -75,10 +75,6 @@ typedef struct SVQ3Frame {
 
 AVBufferRef *mb_type_buf;
 uint32_t *mb_type;
-
-
-AVBufferRef *ref_index_buf[2];
-int8_t *ref_index[2];
 } SVQ3Frame;
 
 typedef struct SVQ3Context {
@@ -1330,7 +1326,6 @@ static void free_picture(AVCodecContext *avctx, SVQ3Frame 
*pic)
 int i;
 for (i = 0; i < 2; i++) {
 av_buffer_unref(>motion_val_buf[i]);
-av_buffer_unref(>ref_index_buf[i]);
 }
 av_buffer_unref(>mb_type_buf);
 
@@ -1341,7 +1336,6 @@ static int get_buffer(AVCodecContext *avctx, SVQ3Frame 
*pic)
 {
 SVQ3Context *s = avctx->priv_data;
 const int big_mb_num= s->mb_stride * (s->mb_height + 1) + 1;
-const int mb_array_size = s->mb_stride * s->mb_height;
 const int b4_stride = s->mb_width * 4 + 1;
 const int b4_array_size = b4_stride * s->mb_height * 4;
 int ret;
@@ -1356,14 +1350,12 @@ static int get_buffer(AVCodecContext *avctx, SVQ3Frame 
*pic)
 
 for (i = 0; i < 2; i++) {
 pic->motion_val_buf[i] = av_buffer_allocz(2 * (b4_array_size + 4) 
* sizeof(int16_t));
-pic->ref_index_buf[i]  = av_buffer_allocz(4 * mb_array_size);
-if (!pic->motion_val_buf[i] || !pic->ref_index_buf[i]) {
+if (!pic->motion_val_buf[i]) {
 ret = AVERROR(ENOMEM);
 goto fail;
 }
 
 pic->motion_val[i] = (int16_t (*)[2])pic->motion_val_buf[i]->data 
+ 4;
-pic->ref_index[i]  = pic->ref_index_buf[i]->data;
 }
 }
 
-- 
2.25.1

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

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

[FFmpeg-devel] [PATCH 06/16] avcodec/ra288: Avoid indirection when calling float dsp function

2020-09-12 Thread Andreas Rheinhardt
Do this by only keeping the only function pointer from the
AVFloatDSPContext that is needed lateron. This also allows to remove the
decoder's close function.

Signed-off-by: Andreas Rheinhardt 
---
 libavcodec/ra288.c | 24 +---
 1 file changed, 9 insertions(+), 15 deletions(-)

diff --git a/libavcodec/ra288.c b/libavcodec/ra288.c
index aa4bd5d90f..8df17891b1 100644
--- a/libavcodec/ra288.c
+++ b/libavcodec/ra288.c
@@ -39,7 +39,8 @@
 #define RA288_BLOCKS_PER_FRAME 32
 
 typedef struct RA288Context {
-AVFloatDSPContext *fdsp;
+void (*vector_fmul)(float *dst, const float *src0, const float *src1,
+int len);
 DECLARE_ALIGNED(32, float,   sp_lpc)[FFALIGN(36, 16)];   ///< LPC 
coefficients for speech data (spec: A)
 DECLARE_ALIGNED(32, float, gain_lpc)[FFALIGN(10, 16)];   ///< LPC 
coefficients for gain(spec: GB)
 
@@ -60,18 +61,10 @@ typedef struct RA288Context {
 float gain_rec[11];
 } RA288Context;
 
-static av_cold int ra288_decode_close(AVCodecContext *avctx)
-{
-RA288Context *ractx = avctx->priv_data;
-
-av_freep(>fdsp);
-
-return 0;
-}
-
 static av_cold int ra288_decode_init(AVCodecContext *avctx)
 {
 RA288Context *ractx = avctx->priv_data;
+AVFloatDSPContext *fdsp;
 
 avctx->channels   = 1;
 avctx->channel_layout = AV_CH_LAYOUT_MONO;
@@ -82,9 +75,11 @@ static av_cold int ra288_decode_init(AVCodecContext *avctx)
 return AVERROR_PATCHWELCOME;
 }
 
-ractx->fdsp = avpriv_float_dsp_alloc(avctx->flags & 
AV_CODEC_FLAG_BITEXACT);
-if (!ractx->fdsp)
+fdsp = avpriv_float_dsp_alloc(avctx->flags & AV_CODEC_FLAG_BITEXACT);
+if (!fdsp)
 return AVERROR(ENOMEM);
+ractx->vector_fmul = fdsp->vector_fmul;
+av_free(fdsp);
 
 return 0;
 }
@@ -158,7 +153,7 @@ static void do_hybrid_window(RA288Context *ractx,
 
 av_assert2(order>=0);
 
-ractx->fdsp->vector_fmul(work, window, hist, FFALIGN(order + n + non_rec, 
16));
+ractx->vector_fmul(work, window, hist, FFALIGN(order + n + non_rec, 16));
 
 convolve(buffer1, work + order, n  , order);
 convolve(buffer2, work + order + n, non_rec, order);
@@ -185,7 +180,7 @@ static void backward_filter(RA288Context *ractx,
 do_hybrid_window(ractx, order, n, non_rec, temp, hist, rec, window);
 
 if (!compute_lpc_coefs(temp, order, lpc, 0, 1, 1))
-ractx->fdsp->vector_fmul(lpc, lpc, tab, FFALIGN(order, 16));
+ractx->vector_fmul(lpc, lpc, tab, FFALIGN(order, 16));
 
 memmove(hist, hist + n, move_size*sizeof(*hist));
 }
@@ -249,6 +244,5 @@ AVCodec ff_ra_288_decoder = {
 .priv_data_size = sizeof(RA288Context),
 .init   = ra288_decode_init,
 .decode = ra288_decode_frame,
-.close  = ra288_decode_close,
 .capabilities   = AV_CODEC_CAP_DR1,
 };
-- 
2.25.1

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

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

[FFmpeg-devel] [PATCH 10/16] avcodec/svq3: Avoid allocations for SVQ3Frames

2020-09-12 Thread Andreas Rheinhardt
These frames can be made part of the SVQ3Context; notice that the pointers
to the frames have been retained in order to allow to just swap them as
the code already does.

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

diff --git a/libavcodec/svq3.c b/libavcodec/svq3.c
index c8db08a32f..8a67836827 100644
--- a/libavcodec/svq3.c
+++ b/libavcodec/svq3.c
@@ -147,6 +147,7 @@ typedef struct SVQ3Context {
 DECLARE_ALIGNED(8, uint8_t, non_zero_count_cache)[15 * 8];
 uint32_t dequant4_coeff[QP_MAX_NUM + 1][16];
 int block_offset[2 * (16 * 3)];
+SVQ3Frame frames[3];
 } SVQ3Context;
 
 #define FULLPEL_MODE  1
@@ -1135,13 +1136,9 @@ static av_cold int svq3_decode_init(AVCodecContext 
*avctx)
 int marker_found = 0;
 int ret;
 
-s->cur_pic  = av_mallocz(sizeof(*s->cur_pic));
-s->last_pic = av_mallocz(sizeof(*s->last_pic));
-s->next_pic = av_mallocz(sizeof(*s->next_pic));
-if (!s->next_pic || !s->last_pic || !s->cur_pic) {
-ret = AVERROR(ENOMEM);
-goto fail;
-}
+s->cur_pic  = >frames[0];
+s->last_pic = >frames[1];
+s->next_pic = >frames[2];
 
 s->cur_pic->f  = av_frame_alloc();
 s->last_pic->f = av_frame_alloc();
@@ -1631,9 +1628,6 @@ static av_cold int svq3_decode_end(AVCodecContext *avctx)
 av_frame_free(>cur_pic->f);
 av_frame_free(>next_pic->f);
 av_frame_free(>last_pic->f);
-av_freep(>cur_pic);
-av_freep(>next_pic);
-av_freep(>last_pic);
 av_freep(>slice_buf);
 av_freep(>intra4x4_pred_mode);
 av_freep(>edge_emu_buffer);
-- 
2.25.1

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

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

[FFmpeg-devel] [PATCH 03/16] avcodec/pcm-dvdenc: Remove empty function

2020-09-12 Thread Andreas Rheinhardt
Signed-off-by: Andreas Rheinhardt 
---
 libavcodec/pcm-dvdenc.c | 6 --
 1 file changed, 6 deletions(-)

diff --git a/libavcodec/pcm-dvdenc.c b/libavcodec/pcm-dvdenc.c
index d26eaf071c..63f6e5d81b 100644
--- a/libavcodec/pcm-dvdenc.c
+++ b/libavcodec/pcm-dvdenc.c
@@ -170,11 +170,6 @@ static int pcm_dvd_encode_frame(AVCodecContext *avctx, 
AVPacket *avpkt,
 return 0;
 }
 
-static av_cold int pcm_dvd_encode_close(AVCodecContext *avctx)
-{
-return 0;
-}
-
 AVCodec ff_pcm_dvd_encoder = {
 .name   = "pcm_dvd",
 .long_name  = NULL_IF_CONFIG_SMALL("PCM signed 16|20|24-bit big-endian 
for DVD media"),
@@ -182,7 +177,6 @@ AVCodec ff_pcm_dvd_encoder = {
 .id = AV_CODEC_ID_PCM_DVD,
 .priv_data_size = sizeof(PCMDVDContext),
 .init   = pcm_dvd_encode_init,
-.close  = pcm_dvd_encode_close,
 .encode2= pcm_dvd_encode_frame,
 .capabilities   = AV_CODEC_CAP_SMALL_LAST_FRAME,
 .supported_samplerates = (const int[]) { 48000, 96000, 0},
-- 
2.25.1

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

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

[FFmpeg-devel] [PATCH 09/16] avcodec/sonic: Fix leaks upon allocation errors

2020-09-12 Thread Andreas Rheinhardt
The Sonic decoder and encoders allocate several buffers in their init
function and return immediately if one of these allocations fails; this
will lead to leaks if there was an earlier successfull allocation. Fix
this by setting the FF_CODEC_CAP_INIT_CLEANUP flag.

Signed-off-by: Andreas Rheinhardt 
---
 libavcodec/sonic.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/libavcodec/sonic.c b/libavcodec/sonic.c
index ea6ef10c9e..fa4ecc3a7a 100644
--- a/libavcodec/sonic.c
+++ b/libavcodec/sonic.c
@@ -1095,6 +1095,7 @@ AVCodec ff_sonic_decoder = {
 .close  = sonic_decode_close,
 .decode = sonic_decode_frame,
 .capabilities   = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_EXPERIMENTAL,
+.caps_internal  = FF_CODEC_CAP_INIT_CLEANUP,
 };
 #endif /* CONFIG_SONIC_DECODER */
 
@@ -1109,6 +1110,7 @@ AVCodec ff_sonic_encoder = {
 .encode2= sonic_encode_frame,
 .sample_fmts= (const enum AVSampleFormat[]){ AV_SAMPLE_FMT_S16, 
AV_SAMPLE_FMT_NONE },
 .capabilities   = AV_CODEC_CAP_EXPERIMENTAL,
+.caps_internal  = FF_CODEC_CAP_INIT_CLEANUP,
 .close  = sonic_encode_close,
 };
 #endif
@@ -1124,6 +1126,7 @@ AVCodec ff_sonic_ls_encoder = {
 .encode2= sonic_encode_frame,
 .sample_fmts= (const enum AVSampleFormat[]){ AV_SAMPLE_FMT_S16, 
AV_SAMPLE_FMT_NONE },
 .capabilities   = AV_CODEC_CAP_EXPERIMENTAL,
+.caps_internal  = FF_CODEC_CAP_INIT_CLEANUP,
 .close  = sonic_encode_close,
 };
 #endif
-- 
2.25.1

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

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

[FFmpeg-devel] [PATCH 04/16] avcodec/qtrleenc: Fix memleak upon allocation failure

2020-09-12 Thread Andreas Rheinhardt
The qtrle encoder allocates several buffers and an AVFrame in its init
function. If one of these allocations fails, but others succeed, the
successfully allocated objects leak. This is fixed by setting the
FF_CODEC_CAP_INIT_CLEANUP flag.

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

diff --git a/libavcodec/qtrleenc.c b/libavcodec/qtrleenc.c
index 6669c1302f..8b0edf7b3d 100644
--- a/libavcodec/qtrleenc.c
+++ b/libavcodec/qtrleenc.c
@@ -413,4 +413,5 @@ AVCodec ff_qtrle_encoder = {
 .pix_fmts   = (const enum AVPixelFormat[]){
 AV_PIX_FMT_RGB24, AV_PIX_FMT_RGB555BE, AV_PIX_FMT_ARGB, 
AV_PIX_FMT_GRAY8, AV_PIX_FMT_NONE
 },
+.caps_internal  = FF_CODEC_CAP_INIT_CLEANUP,
 };
-- 
2.25.1

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

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

[FFmpeg-devel] [PATCH 02/16] avcodec/pcm-dvd: Avoid allocation of buffer

2020-09-12 Thread Andreas Rheinhardt
In this case, it also allows to remove the decoder's close function.

Signed-off-by: Andreas Rheinhardt 
---
 libavcodec/pcm-dvd.c | 16 ++--
 1 file changed, 2 insertions(+), 14 deletions(-)

diff --git a/libavcodec/pcm-dvd.c b/libavcodec/pcm-dvd.c
index 0a751a8191..725c2f5b29 100644
--- a/libavcodec/pcm-dvd.c
+++ b/libavcodec/pcm-dvd.c
@@ -34,8 +34,9 @@ typedef struct PCMDVDContext {
 int last_block_size; // Size of the last block of samples in bytes
 int samples_per_block;   // Number of samples per channel per block
 int groups_per_block;// Number of 20/24-bit sample groups per block
-uint8_t *extra_samples;  // Pointer to leftover samples from a frame
 int extra_sample_count;  // Number of leftover samples in the buffer
+uint8_t extra_samples[8 * 3 * 4];  // Space for leftover samples from a 
frame
+   // (8 channels, 3B/sample, 4 
samples/block)
 } PCMDVDContext;
 
 static av_cold int pcm_dvd_decode_init(AVCodecContext *avctx)
@@ -44,18 +45,6 @@ static av_cold int pcm_dvd_decode_init(AVCodecContext *avctx)
 
 /* Invalid header to force parsing of the first header */
 s->last_header = -1;
-/* reserve space for 8 channels, 3 bytes/sample, 4 samples/block */
-if (!(s->extra_samples = av_malloc(8 * 3 * 4)))
-return AVERROR(ENOMEM);
-
-return 0;
-}
-
-static av_cold int pcm_dvd_decode_uninit(AVCodecContext *avctx)
-{
-PCMDVDContext *s = avctx->priv_data;
-
-av_freep(>extra_samples);
 
 return 0;
 }
@@ -310,7 +299,6 @@ AVCodec ff_pcm_dvd_decoder = {
 .priv_data_size = sizeof(PCMDVDContext),
 .init   = pcm_dvd_decode_init,
 .decode = pcm_dvd_decode_frame,
-.close  = pcm_dvd_decode_uninit,
 .capabilities   = AV_CODEC_CAP_DR1,
 .sample_fmts= (const enum AVSampleFormat[]) {
 AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_NONE
-- 
2.25.1

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

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

[FFmpeg-devel] [PATCH 08/16] avcodec/roqaudioenc: Avoid redundant free of unallocated buffer

2020-09-12 Thread Andreas Rheinhardt
If allocating a buffer in RoQ DPCM encoder's init function failed,
the close function would be called manually; all this function does is
freeing said buffer, but given that it has not been allocated at all,
this is unnecessary.

Signed-off-by: Andreas Rheinhardt 
---
 libavcodec/roqaudioenc.c | 10 ++
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/libavcodec/roqaudioenc.c b/libavcodec/roqaudioenc.c
index 5154604be8..c09212d3d1 100644
--- a/libavcodec/roqaudioenc.c
+++ b/libavcodec/roqaudioenc.c
@@ -53,7 +53,6 @@ static av_cold int roq_dpcm_encode_close(AVCodecContext 
*avctx)
 static av_cold int roq_dpcm_encode_init(AVCodecContext *avctx)
 {
 ROQDPCMContext *context = avctx->priv_data;
-int ret;
 
 if (avctx->channels > 2) {
 av_log(avctx, AV_LOG_ERROR, "Audio must be mono or stereo\n");
@@ -70,17 +69,12 @@ static av_cold int roq_dpcm_encode_init(AVCodecContext 
*avctx)
 
 context->frame_buffer = av_malloc(8 * ROQ_FRAME_SIZE * avctx->channels *
   sizeof(*context->frame_buffer));
-if (!context->frame_buffer) {
-ret = AVERROR(ENOMEM);
-goto error;
-}
+if (!context->frame_buffer)
+return AVERROR(ENOMEM);
 
 context->lastSample[0] = context->lastSample[1] = 0;
 
 return 0;
-error:
-roq_dpcm_encode_close(avctx);
-return ret;
 }
 
 static unsigned char dpcm_predict(short *previous, short current)
-- 
2.25.1

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

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

[FFmpeg-devel] [PATCH 01/16] avcodec/snowdec: Use ff_snow_common_init() directly

2020-09-12 Thread Andreas Rheinhardt
Signed-off-by: Andreas Rheinhardt 
---
 libavcodec/snowdec.c | 13 +
 1 file changed, 1 insertion(+), 12 deletions(-)

diff --git a/libavcodec/snowdec.c b/libavcodec/snowdec.c
index 5e69f39022..68afe0df26 100644
--- a/libavcodec/snowdec.c
+++ b/libavcodec/snowdec.c
@@ -422,17 +422,6 @@ static int decode_header(SnowContext *s){
 return 0;
 }
 
-static av_cold int decode_init(AVCodecContext *avctx)
-{
-int ret;
-
-if ((ret = ff_snow_common_init(avctx)) < 0) {
-return ret;
-}
-
-return 0;
-}
-
 static int decode_blocks(SnowContext *s){
 int x, y;
 int w= s->b_width;
@@ -665,7 +654,7 @@ AVCodec ff_snow_decoder = {
 .type   = AVMEDIA_TYPE_VIDEO,
 .id = AV_CODEC_ID_SNOW,
 .priv_data_size = sizeof(SnowContext),
-.init   = decode_init,
+.init   = ff_snow_common_init,
 .close  = decode_end,
 .decode = decode_frame,
 .capabilities   = AV_CODEC_CAP_DR1 /*| AV_CODEC_CAP_DRAW_HORIZ_BAND*/,
-- 
2.25.1

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

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

Re: [FFmpeg-devel] [PATCH] avformat: add CRI AAX demuxer

2020-09-12 Thread Andreas Rheinhardt
Paul B Mahol:
> Signed-off-by: Paul B Mahol 
> ---
>  libavcodec/adxdec.c  |  16 ++
>  libavformat/Makefile |   1 +
>  libavformat/aaxdec.c | 340 +++
>  libavformat/allformats.c |   1 +
>  4 files changed, 358 insertions(+)
>  create mode 100644 libavformat/aaxdec.c
> 
> diff --git a/libavcodec/adxdec.c b/libavcodec/adxdec.c
> index 40ed8e5ba7..81ffc8b296 100644
> --- a/libavcodec/adxdec.c
> +++ b/libavcodec/adxdec.c
> @@ -103,6 +103,22 @@ static int adx_decode_frame(AVCodecContext *avctx, void 
> *data,
>  const uint8_t *buf  = avpkt->data;
>  const uint8_t *buf_end = buf + avpkt->size;
>  int num_blocks, ch, ret;
> +int new_extradata_size;
> +uint8_t *new_extradata;
> +
> +new_extradata = av_packet_get_side_data(avpkt, AV_PKT_DATA_NEW_EXTRADATA,
> +_extradata_size);
> +if (new_extradata && new_extradata_size > 0) {
> +int header_size;
> +if ((ret = ff_adx_decode_header(avctx, new_extradata,
> +new_extradata_size, _size,
> +c->coeff)) < 0) {
> +av_log(avctx, AV_LOG_ERROR, "error parsing new ADX extradata\n");
> +return AVERROR_INVALIDDATA;
> +}
> +
> +c->eof = 0;
> +}
>  
>  if (c->eof) {
>  *got_frame_ptr = 0;
> diff --git a/libavformat/Makefile b/libavformat/Makefile
> index b4cc467268..883326770f 100644
> --- a/libavformat/Makefile
> +++ b/libavformat/Makefile
> @@ -68,6 +68,7 @@ OBJS-$(CONFIG_SRTP)  += srtp.o
>  OBJS-$(CONFIG_A64_MUXER) += a64.o rawenc.o
>  OBJS-$(CONFIG_AA_DEMUXER)+= aadec.o
>  OBJS-$(CONFIG_AAC_DEMUXER)   += aacdec.o apetag.o img2.o rawdec.o
> +OBJS-$(CONFIG_AAX_DEMUXER)   += aaxdec.o
>  OBJS-$(CONFIG_AC3_DEMUXER)   += ac3dec.o rawdec.o
>  OBJS-$(CONFIG_AC3_MUXER) += rawenc.o
>  OBJS-$(CONFIG_ACM_DEMUXER)   += acm.o rawdec.o
> diff --git a/libavformat/aaxdec.c b/libavformat/aaxdec.c
> new file mode 100644
> index 00..0ffbd32cd0
> --- /dev/null
> +++ b/libavformat/aaxdec.c
> @@ -0,0 +1,340 @@
> +/*
> + * AAX demuxer
> + * Copyright (c) 2020 Paul B Mahol
> + *
> + * This file is part of FFmpeg.
> + *
> + * FFmpeg is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU Lesser General Public
> + * License as published by the Free Software Foundation; either
> + * version 2.1 of the License, or (at your option) any later version.
> + *
> + * FFmpeg is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> + * Lesser General Public License for more details.
> + *
> + * You should have received a copy of the GNU Lesser General Public
> + * License along with FFmpeg; if not, write to the Free Software
> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 
> USA
> + */
> +
> +#include "libavutil/intreadwrite.h"
> +#include "avformat.h"
> +#include "internal.h"
> +
> +typedef struct AAXColumn {
> +uint8_t flag;
> +uint8_t type;
> +const char *name;
> +uint32_t offset;
> +int size;
> +} AAXColumn;
> +
> +typedef struct AAXSegment {
> +int64_t offset;
> +uint32_t size;
> +} AAXSegment;
> +
> +typedef struct AAXContext {
> +int64_t table_size;
> +uint16_t version;
> +int64_t rows_offset;
> +int64_t strings_offset;
> +int64_t data_offset;
> +int64_t name_offset;
> +uint16_t columns;
> +uint16_t row_width;
> +uint32_t nb_segments;
> +int64_t schema_offset;
> +int64_t strings_size;
> +char *string_table;
> +
> +int64_t prev_pts;
> +int64_t last_segment_pts;
> +int current_segment;
> +
> +AAXColumn *xcolumns;
> +AAXSegment *segments;
> +} AAXContext;
> +
> +static int aax_probe(const AVProbeData *p)
> +{
> +if (AV_RB32(p->buf) != MKBETAG('@','U','T','F'))
> +return 0;
> +if (AV_RB16(p->buf + 4) <= 1U)
> +return 0;
> +
> +return AVPROBE_SCORE_MAX;
> +}
> +
> +enum ColumnFlag {
> +COLUMN_FLAG_NAME= 0x1,
> +COLUMN_FLAG_DEFAULT = 0x2,
> +COLUMN_FLAG_ROW = 0x4,
> +COLUMN_FLAG_UNDEFINED   = 0x8 /* shouldn't exist */
> +};
> +
> +enum ColumnType {
> +COLUMN_TYPE_UINT8   = 0x00,
> +COLUMN_TYPE_SINT8   = 0x01,
> +COLUMN_TYPE_UINT16  = 0x02,
> +COLUMN_TYPE_SINT16  = 0x03,
> +COLUMN_TYPE_UINT32  = 0x04,
> +COLUMN_TYPE_SINT32  = 0x05,
> +COLUMN_TYPE_UINT64  = 0x06,
> +COLUMN_TYPE_SINT64  = 0x07,
> +COLUMN_TYPE_FLOAT   = 0x08,
> +COLUMN_TYPE_DOUBLE  = 0x09,
> +COLUMN_TYPE_STRING  = 0x0a,
> +COLUMN_TYPE_VLDATA  = 

Re: [FFmpeg-devel] [PATCH] avformat: add CRI AAX demuxer

2020-09-12 Thread Andreas Rheinhardt
Paul B Mahol:
> Signed-off-by: Paul B Mahol 
> ---
>  libavcodec/adxdec.c  |  16 ++

Why are you sending the encoder patch in the same patch?

>  libavformat/Makefile |   1 +
>  libavformat/aaxdec.c | 340 +++
>  libavformat/allformats.c |   1 +
>  4 files changed, 358 insertions(+)
>  create mode 100644 libavformat/aaxdec.c
> 
> diff --git a/libavcodec/adxdec.c b/libavcodec/adxdec.c
> index 40ed8e5ba7..81ffc8b296 100644
> --- a/libavcodec/adxdec.c
> +++ b/libavcodec/adxdec.c
> @@ -103,6 +103,22 @@ static int adx_decode_frame(AVCodecContext *avctx, void 
> *data,
>  const uint8_t *buf  = avpkt->data;
>  const uint8_t *buf_end = buf + avpkt->size;
>  int num_blocks, ch, ret;
> +int new_extradata_size;
> +uint8_t *new_extradata;

Can be const.

> +
> +new_extradata = av_packet_get_side_data(avpkt, AV_PKT_DATA_NEW_EXTRADATA,
> +_extradata_size);
> +if (new_extradata && new_extradata_size > 0) {
> +int header_size;
> +if ((ret = ff_adx_decode_header(avctx, new_extradata,
> +new_extradata_size, _size,
> +c->coeff)) < 0) {
> +av_log(avctx, AV_LOG_ERROR, "error parsing new ADX extradata\n");
> +return AVERROR_INVALIDDATA;

Any particular reason you are not using the return value directly?

> +}
> +
> +c->eof = 0;
> +}
>  
>  if (c->eof) {
>  *got_frame_ptr = 0;
> diff --git a/libavformat/Makefile b/libavformat/Makefile
> index b4cc467268..883326770f 100644
> --- a/libavformat/Makefile
> +++ b/libavformat/Makefile
> @@ -68,6 +68,7 @@ OBJS-$(CONFIG_SRTP)  += srtp.o
>  OBJS-$(CONFIG_A64_MUXER) += a64.o rawenc.o
>  OBJS-$(CONFIG_AA_DEMUXER)+= aadec.o
>  OBJS-$(CONFIG_AAC_DEMUXER)   += aacdec.o apetag.o img2.o rawdec.o
> +OBJS-$(CONFIG_AAX_DEMUXER)   += aaxdec.o
>  OBJS-$(CONFIG_AC3_DEMUXER)   += ac3dec.o rawdec.o
>  OBJS-$(CONFIG_AC3_MUXER) += rawenc.o
>  OBJS-$(CONFIG_ACM_DEMUXER)   += acm.o rawdec.o
> diff --git a/libavformat/aaxdec.c b/libavformat/aaxdec.c
> new file mode 100644
> index 00..0ffbd32cd0
> --- /dev/null
> +++ b/libavformat/aaxdec.c
> @@ -0,0 +1,340 @@
> +/*
> + * AAX demuxer
> + * Copyright (c) 2020 Paul B Mahol
> + *
> + * This file is part of FFmpeg.
> + *
> + * FFmpeg is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU Lesser General Public
> + * License as published by the Free Software Foundation; either
> + * version 2.1 of the License, or (at your option) any later version.
> + *
> + * FFmpeg is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> + * Lesser General Public License for more details.
> + *
> + * You should have received a copy of the GNU Lesser General Public
> + * License along with FFmpeg; if not, write to the Free Software
> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 
> USA
> + */
> +
> +#include "libavutil/intreadwrite.h"
> +#include "avformat.h"
> +#include "internal.h"
> +
> +typedef struct AAXColumn {
> +uint8_t flag;
> +uint8_t type;
> +const char *name;
> +uint32_t offset;
> +int size;
> +} AAXColumn;
> +
> +typedef struct AAXSegment {
> +int64_t offset;
> +uint32_t size;
> +} AAXSegment;
> +
> +typedef struct AAXContext {
> +int64_t table_size;
> +uint16_t version;
> +int64_t rows_offset;
> +int64_t strings_offset;
> +int64_t data_offset;
> +int64_t name_offset;
> +uint16_t columns;
> +uint16_t row_width;
> +uint32_t nb_segments;
> +int64_t schema_offset;
> +int64_t strings_size;
> +char *string_table;
> +
> +int64_t prev_pts;
> +int64_t last_segment_pts;
> +int current_segment;
> +
> +AAXColumn *xcolumns;
> +AAXSegment *segments;
> +} AAXContext;
> +
> +static int aax_probe(const AVProbeData *p)
> +{
> +if (AV_RB32(p->buf) != MKBETAG('@','U','T','F'))
> +return 0;
> +if (AV_RB16(p->buf + 4) <= 1U)
> +return 0;
> +
> +return AVPROBE_SCORE_MAX;
> +}
> +
> +enum ColumnFlag {
> +COLUMN_FLAG_NAME= 0x1,
> +COLUMN_FLAG_DEFAULT = 0x2,
> +COLUMN_FLAG_ROW = 0x4,
> +COLUMN_FLAG_UNDEFINED   = 0x8 /* shouldn't exist */
> +};
> +
> +enum ColumnType {
> +COLUMN_TYPE_UINT8   = 0x00,
> +COLUMN_TYPE_SINT8   = 0x01,
> +COLUMN_TYPE_UINT16  = 0x02,
> +COLUMN_TYPE_SINT16  = 0x03,
> +COLUMN_TYPE_UINT32  = 0x04,
> +COLUMN_TYPE_SINT32  = 0x05,
> +COLUMN_TYPE_UINT64  = 0x06,
> +COLUMN_TYPE_SINT64  = 0x07,
> +COLUMN_TYPE_FLOAT  

Re: [FFmpeg-devel] [PATCH] avformat: add CRI AAX demuxer

2020-09-12 Thread James Almer
On 9/12/2020 8:13 PM, Paul B Mahol wrote:
> Signed-off-by: Paul B Mahol 
> ---
>  libavcodec/adxdec.c  |  16 ++
>  libavformat/Makefile |   1 +
>  libavformat/aaxdec.c | 340 +++
>  libavformat/allformats.c |   1 +
>  4 files changed, 358 insertions(+)
>  create mode 100644 libavformat/aaxdec.c
> 
> diff --git a/libavcodec/adxdec.c b/libavcodec/adxdec.c
> index 40ed8e5ba7..81ffc8b296 100644
> --- a/libavcodec/adxdec.c
> +++ b/libavcodec/adxdec.c
> @@ -103,6 +103,22 @@ static int adx_decode_frame(AVCodecContext *avctx, void 
> *data,
>  const uint8_t *buf  = avpkt->data;
>  const uint8_t *buf_end = buf + avpkt->size;
>  int num_blocks, ch, ret;
> +int new_extradata_size;
> +uint8_t *new_extradata;
> +
> +new_extradata = av_packet_get_side_data(avpkt, AV_PKT_DATA_NEW_EXTRADATA,
> +_extradata_size);
> +if (new_extradata && new_extradata_size > 0) {
> +int header_size;
> +if ((ret = ff_adx_decode_header(avctx, new_extradata,
> +new_extradata_size, _size,
> +c->coeff)) < 0) {
> +av_log(avctx, AV_LOG_ERROR, "error parsing new ADX extradata\n");
> +return AVERROR_INVALIDDATA;
> +}
> +
> +c->eof = 0;
> +}
>  
>  if (c->eof) {
>  *got_frame_ptr = 0;
> diff --git a/libavformat/Makefile b/libavformat/Makefile
> index b4cc467268..883326770f 100644
> --- a/libavformat/Makefile
> +++ b/libavformat/Makefile
> @@ -68,6 +68,7 @@ OBJS-$(CONFIG_SRTP)  += srtp.o
>  OBJS-$(CONFIG_A64_MUXER) += a64.o rawenc.o
>  OBJS-$(CONFIG_AA_DEMUXER)+= aadec.o
>  OBJS-$(CONFIG_AAC_DEMUXER)   += aacdec.o apetag.o img2.o rawdec.o
> +OBJS-$(CONFIG_AAX_DEMUXER)   += aaxdec.o
>  OBJS-$(CONFIG_AC3_DEMUXER)   += ac3dec.o rawdec.o
>  OBJS-$(CONFIG_AC3_MUXER) += rawenc.o
>  OBJS-$(CONFIG_ACM_DEMUXER)   += acm.o rawdec.o
> diff --git a/libavformat/aaxdec.c b/libavformat/aaxdec.c
> new file mode 100644
> index 00..0ffbd32cd0
> --- /dev/null
> +++ b/libavformat/aaxdec.c
> @@ -0,0 +1,340 @@
> +/*
> + * AAX demuxer
> + * Copyright (c) 2020 Paul B Mahol
> + *
> + * This file is part of FFmpeg.
> + *
> + * FFmpeg is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU Lesser General Public
> + * License as published by the Free Software Foundation; either
> + * version 2.1 of the License, or (at your option) any later version.
> + *
> + * FFmpeg is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> + * Lesser General Public License for more details.
> + *
> + * You should have received a copy of the GNU Lesser General Public
> + * License along with FFmpeg; if not, write to the Free Software
> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 
> USA
> + */
> +
> +#include "libavutil/intreadwrite.h"
> +#include "avformat.h"
> +#include "internal.h"
> +
> +typedef struct AAXColumn {
> +uint8_t flag;
> +uint8_t type;
> +const char *name;
> +uint32_t offset;
> +int size;
> +} AAXColumn;
> +
> +typedef struct AAXSegment {
> +int64_t offset;
> +uint32_t size;
> +} AAXSegment;
> +
> +typedef struct AAXContext {
> +int64_t table_size;
> +uint16_t version;
> +int64_t rows_offset;
> +int64_t strings_offset;
> +int64_t data_offset;
> +int64_t name_offset;
> +uint16_t columns;
> +uint16_t row_width;
> +uint32_t nb_segments;
> +int64_t schema_offset;
> +int64_t strings_size;
> +char *string_table;
> +
> +int64_t prev_pts;
> +int64_t last_segment_pts;
> +int current_segment;
> +
> +AAXColumn *xcolumns;
> +AAXSegment *segments;
> +} AAXContext;
> +
> +static int aax_probe(const AVProbeData *p)
> +{
> +if (AV_RB32(p->buf) != MKBETAG('@','U','T','F'))
> +return 0;
> +if (AV_RB16(p->buf + 4) <= 1U)
> +return 0;
> +
> +return AVPROBE_SCORE_MAX;
> +}
> +
> +enum ColumnFlag {
> +COLUMN_FLAG_NAME= 0x1,
> +COLUMN_FLAG_DEFAULT = 0x2,
> +COLUMN_FLAG_ROW = 0x4,
> +COLUMN_FLAG_UNDEFINED   = 0x8 /* shouldn't exist */
> +};
> +
> +enum ColumnType {
> +COLUMN_TYPE_UINT8   = 0x00,
> +COLUMN_TYPE_SINT8   = 0x01,
> +COLUMN_TYPE_UINT16  = 0x02,
> +COLUMN_TYPE_SINT16  = 0x03,
> +COLUMN_TYPE_UINT32  = 0x04,
> +COLUMN_TYPE_SINT32  = 0x05,
> +COLUMN_TYPE_UINT64  = 0x06,
> +COLUMN_TYPE_SINT64  = 0x07,
> +COLUMN_TYPE_FLOAT   = 0x08,
> +COLUMN_TYPE_DOUBLE  = 0x09,
> +COLUMN_TYPE_STRING  = 0x0a,
> +

[FFmpeg-devel] [PATCH] avformat: add CRI AAX demuxer

2020-09-12 Thread Paul B Mahol
Signed-off-by: Paul B Mahol 
---
 libavcodec/adxdec.c  |  16 ++
 libavformat/Makefile |   1 +
 libavformat/aaxdec.c | 340 +++
 libavformat/allformats.c |   1 +
 4 files changed, 358 insertions(+)
 create mode 100644 libavformat/aaxdec.c

diff --git a/libavcodec/adxdec.c b/libavcodec/adxdec.c
index 40ed8e5ba7..81ffc8b296 100644
--- a/libavcodec/adxdec.c
+++ b/libavcodec/adxdec.c
@@ -103,6 +103,22 @@ static int adx_decode_frame(AVCodecContext *avctx, void 
*data,
 const uint8_t *buf  = avpkt->data;
 const uint8_t *buf_end = buf + avpkt->size;
 int num_blocks, ch, ret;
+int new_extradata_size;
+uint8_t *new_extradata;
+
+new_extradata = av_packet_get_side_data(avpkt, AV_PKT_DATA_NEW_EXTRADATA,
+_extradata_size);
+if (new_extradata && new_extradata_size > 0) {
+int header_size;
+if ((ret = ff_adx_decode_header(avctx, new_extradata,
+new_extradata_size, _size,
+c->coeff)) < 0) {
+av_log(avctx, AV_LOG_ERROR, "error parsing new ADX extradata\n");
+return AVERROR_INVALIDDATA;
+}
+
+c->eof = 0;
+}
 
 if (c->eof) {
 *got_frame_ptr = 0;
diff --git a/libavformat/Makefile b/libavformat/Makefile
index b4cc467268..883326770f 100644
--- a/libavformat/Makefile
+++ b/libavformat/Makefile
@@ -68,6 +68,7 @@ OBJS-$(CONFIG_SRTP)  += srtp.o
 OBJS-$(CONFIG_A64_MUXER) += a64.o rawenc.o
 OBJS-$(CONFIG_AA_DEMUXER)+= aadec.o
 OBJS-$(CONFIG_AAC_DEMUXER)   += aacdec.o apetag.o img2.o rawdec.o
+OBJS-$(CONFIG_AAX_DEMUXER)   += aaxdec.o
 OBJS-$(CONFIG_AC3_DEMUXER)   += ac3dec.o rawdec.o
 OBJS-$(CONFIG_AC3_MUXER) += rawenc.o
 OBJS-$(CONFIG_ACM_DEMUXER)   += acm.o rawdec.o
diff --git a/libavformat/aaxdec.c b/libavformat/aaxdec.c
new file mode 100644
index 00..0ffbd32cd0
--- /dev/null
+++ b/libavformat/aaxdec.c
@@ -0,0 +1,340 @@
+/*
+ * AAX demuxer
+ * Copyright (c) 2020 Paul B Mahol
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "libavutil/intreadwrite.h"
+#include "avformat.h"
+#include "internal.h"
+
+typedef struct AAXColumn {
+uint8_t flag;
+uint8_t type;
+const char *name;
+uint32_t offset;
+int size;
+} AAXColumn;
+
+typedef struct AAXSegment {
+int64_t offset;
+uint32_t size;
+} AAXSegment;
+
+typedef struct AAXContext {
+int64_t table_size;
+uint16_t version;
+int64_t rows_offset;
+int64_t strings_offset;
+int64_t data_offset;
+int64_t name_offset;
+uint16_t columns;
+uint16_t row_width;
+uint32_t nb_segments;
+int64_t schema_offset;
+int64_t strings_size;
+char *string_table;
+
+int64_t prev_pts;
+int64_t last_segment_pts;
+int current_segment;
+
+AAXColumn *xcolumns;
+AAXSegment *segments;
+} AAXContext;
+
+static int aax_probe(const AVProbeData *p)
+{
+if (AV_RB32(p->buf) != MKBETAG('@','U','T','F'))
+return 0;
+if (AV_RB16(p->buf + 4) <= 1U)
+return 0;
+
+return AVPROBE_SCORE_MAX;
+}
+
+enum ColumnFlag {
+COLUMN_FLAG_NAME= 0x1,
+COLUMN_FLAG_DEFAULT = 0x2,
+COLUMN_FLAG_ROW = 0x4,
+COLUMN_FLAG_UNDEFINED   = 0x8 /* shouldn't exist */
+};
+
+enum ColumnType {
+COLUMN_TYPE_UINT8   = 0x00,
+COLUMN_TYPE_SINT8   = 0x01,
+COLUMN_TYPE_UINT16  = 0x02,
+COLUMN_TYPE_SINT16  = 0x03,
+COLUMN_TYPE_UINT32  = 0x04,
+COLUMN_TYPE_SINT32  = 0x05,
+COLUMN_TYPE_UINT64  = 0x06,
+COLUMN_TYPE_SINT64  = 0x07,
+COLUMN_TYPE_FLOAT   = 0x08,
+COLUMN_TYPE_DOUBLE  = 0x09,
+COLUMN_TYPE_STRING  = 0x0a,
+COLUMN_TYPE_VLDATA  = 0x0b,
+COLUMN_TYPE_UINT128 = 0x0c, /* for GUIDs */
+COLUMN_TYPE_UNDEFINED   = -1
+};
+
+static int aax_read_header(AVFormatContext *s)
+{
+AAXContext *a = s->priv_data;
+AVIOContext *pb = s->pb;
+AVCodecParameters *par;
+AVStream *st;
+int64_t column_offset = 0;
+

Re: [FFmpeg-devel] [PATCH 6/6] tools:target_dem_fuzzer: Split into a fuzzer fuzzing at the protocol level and one fuzzing a fixed demuxer input

2020-09-12 Thread Michael Niedermayer
On Sun, Jul 19, 2020 at 07:42:18PM +0200, Michael Niedermayer wrote:
> This should improve coverage and should improve the efficiency of seed files
> 
> Signed-off-by: Michael Niedermayer 
> ---
>  Makefile  | 3 +++
>  tools/Makefile| 5 -
>  tools/target_dem_fuzzer.c | 9 -
>  3 files changed, 15 insertions(+), 2 deletions(-)

will apply


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

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


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

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

Re: [FFmpeg-devel] [PATCH 4/6] avformat/cdg: Fix integer overflow in duration computation

2020-09-12 Thread Michael Niedermayer
On Sun, Jul 19, 2020 at 07:42:16PM +0200, Michael Niedermayer wrote:
> Fixes: signed integer overflow: 8398407 * 300 cannot be represented in type 
> 'int'
> Fixes: 
> 23914/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-4702539290509312
> 
> Found-by: continuous fuzzing process 
> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer 
> ---
>  libavformat/cdg.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

will apply

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

If the United States is serious about tackling the national security threats 
related to an insecure 5G network, it needs to rethink the extent to which it
values corporate profits and government espionage over security.-Bruce Schneier


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/2] avformat: add CRI AAX demuxer

2020-09-12 Thread Andreas Rheinhardt
Paul B Mahol:
> Signed-off-by: Paul B Mahol 
> ---
>  libavformat/Makefile |   1 +
>  libavformat/aaxdec.c | 324 +++
>  libavformat/allformats.c |   1 +
>  3 files changed, 326 insertions(+)
>  create mode 100644 libavformat/aaxdec.c
> 
> diff --git a/libavformat/Makefile b/libavformat/Makefile
> index b4cc467268..883326770f 100644
> --- a/libavformat/Makefile
> +++ b/libavformat/Makefile
> @@ -68,6 +68,7 @@ OBJS-$(CONFIG_SRTP)  += srtp.o
>  OBJS-$(CONFIG_A64_MUXER) += a64.o rawenc.o
>  OBJS-$(CONFIG_AA_DEMUXER)+= aadec.o
>  OBJS-$(CONFIG_AAC_DEMUXER)   += aacdec.o apetag.o img2.o rawdec.o
> +OBJS-$(CONFIG_AAX_DEMUXER)   += aaxdec.o
>  OBJS-$(CONFIG_AC3_DEMUXER)   += ac3dec.o rawdec.o
>  OBJS-$(CONFIG_AC3_MUXER) += rawenc.o
>  OBJS-$(CONFIG_ACM_DEMUXER)   += acm.o rawdec.o
> diff --git a/libavformat/aaxdec.c b/libavformat/aaxdec.c
> new file mode 100644
> index 00..419fad9cc8
> --- /dev/null
> +++ b/libavformat/aaxdec.c
> @@ -0,0 +1,324 @@
> +/*
> + * AAX demuxer
> + * Copyright (c) 2020 Paul B Mahol
> + *
> + * This file is part of FFmpeg.
> + *
> + * FFmpeg is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU Lesser General Public
> + * License as published by the Free Software Foundation; either
> + * version 2.1 of the License, or (at your option) any later version.
> + *
> + * FFmpeg is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> + * Lesser General Public License for more details.
> + *
> + * You should have received a copy of the GNU Lesser General Public
> + * License along with FFmpeg; if not, write to the Free Software
> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 
> USA
> + */
> +
> +#include "libavutil/intreadwrite.h"
> +#include "avformat.h"
> +#include "internal.h"
> +
> +typedef struct AAXColumn {
> +uint8_t flag;
> +uint8_t type;
> +const char *name;
> +uint32_t offset;
> +int size;
> +} AAXColumn;
> +
> +typedef struct AAXSegment {
> +int64_t offset;
> +uint32_t size;
> +} AAXSegment;
> +
> +typedef struct AAXContext {
> +int64_t table_size;
> +uint16_t version;
> +int64_t rows_offset;
> +int64_t strings_offset;
> +int64_t data_offset;
> +int64_t name_offset;
> +uint16_t columns;
> +uint16_t row_width;
> +uint32_t nb_segments;
> +int64_t schema_offset;
> +int64_t strings_size;
> +char *string_table;
> +
> +int64_t prev_pts;
> +int64_t last_segment_pts;
> +int current_segment;
> +
> +AAXColumn *xcolumns;
> +AAXSegment *segments;
> +} AAXContext;
> +
> +static int aax_probe(const AVProbeData *p)
> +{
> +if (AV_RB32(p->buf) != MKBETAG('@','U','T','F'))
> +return 0;
> +if (AV_RB16(p->buf + 4) <= 1U)
> +return 0;
> +
> +return AVPROBE_SCORE_MAX;
> +}
> +
> +enum ColumnFlag {
> +COLUMN_FLAG_NAME= 0x1,
> +COLUMN_FLAG_DEFAULT = 0x2,
> +COLUMN_FLAG_ROW = 0x4,
> +COLUMN_FLAG_UNDEFINED   = 0x8 /* shouldn't exist */
> +};
> +
> +enum ColumnType {
> +COLUMN_TYPE_UINT8   = 0x00,
> +COLUMN_TYPE_SINT8   = 0x01,
> +COLUMN_TYPE_UINT16  = 0x02,
> +COLUMN_TYPE_SINT16  = 0x03,
> +COLUMN_TYPE_UINT32  = 0x04,
> +COLUMN_TYPE_SINT32  = 0x05,
> +COLUMN_TYPE_UINT64  = 0x06,
> +COLUMN_TYPE_SINT64  = 0x07,
> +COLUMN_TYPE_FLOAT   = 0x08,
> +COLUMN_TYPE_DOUBLE  = 0x09,
> +COLUMN_TYPE_STRING  = 0x0a,
> +COLUMN_TYPE_VLDATA  = 0x0b,
> +COLUMN_TYPE_UINT128 = 0x0c, /* for GUIDs */
> +COLUMN_TYPE_UNDEFINED   = -1
> +};
> +
> +static int aax_read_header(AVFormatContext *s)
> +{
> +AAXContext *a = s->priv_data;
> +AVIOContext *pb = s->pb;
> +AVCodecParameters *par;
> +AVStream *st;
> +int64_t column_offset = 0;
> +char *codec;
> +int ret, extradata_size;
> +
> +avio_skip(pb, 4);
> +a->table_size  = avio_rb32(pb) + 8LL;
> +a->version = avio_rb16(pb);
> +a->rows_offset = avio_rb16(pb) + 8LL;
> +a->strings_offset  = avio_rb32(pb) + 8LL;
> +a->data_offset = avio_rb32(pb) + 8LL;
> +a->name_offset = avio_rb32(pb);
> +a->columns = avio_rb16(pb);
> +a->row_width   = avio_rb16(pb);
> +a->nb_segments = avio_rb32(pb);
> +
> +a->schema_offset   = 0x20;
> +a->strings_size= a->data_offset - a->strings_offset;
> +
> +if (a->rows_offset > a->table_size ||
> +a->strings_offset > a->table_size ||
> +a->data_offset > a->table_size)
> +return AVERROR_INVALIDDATA;
> +if (a->strings_size 

Re: [FFmpeg-devel] [PATCH 1/2] avcodec/arbc: Assume that at least one segment has a tile

2020-09-12 Thread Paul B Mahol
On Sat, Sep 12, 2020 at 08:18:54PM +0200, Michael Niedermayer wrote:
> If no segment has a tile, the segment count really should be 0
> Fixes: Timeout (61sec -> 2sec)
> Fixes: 
> 25445/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ARBC_fuzzer-5657711222718464
> 
> Found-by: continuous fuzzing process 
> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer 
> ---
>  libavcodec/arbc.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libavcodec/arbc.c b/libavcodec/arbc.c
> index 06970f140b..9d8284df2b 100644
> --- a/libavcodec/arbc.c
> +++ b/libavcodec/arbc.c
> @@ -133,7 +133,7 @@ static int decode_frame(AVCodecContext *avctx, void *data,
>  if (nb_segments == 0)
>  return avpkt->size;
>  
> -if (7 * nb_segments > bytestream2_get_bytes_left(>gb))
> +if (7 * nb_segments + 6 > bytestream2_get_bytes_left(>gb))
>  return AVERROR_INVALIDDATA;
>  
>  if ((ret = ff_get_buffer(avctx, frame, AV_GET_BUFFER_FLAG_REF)) < 0)
> -- 
> 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".

Again fix for timeouts that may break valid 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 1/2] avformat: add CRI AAX demuxer

2020-09-12 Thread James Almer
On 9/12/2020 7:33 PM, Paul B Mahol wrote:
> +static int aax_read_packet(AVFormatContext *s, AVPacket *pkt)
> +{
> +AAXContext *a = s->priv_data;
> +AVCodecParameters *par = s->streams[0]->codecpar;
> +AVIOContext *pb = s->pb;
> +const int size = 18 * par->channels;
> +int ret, extradata_size = 0;
> +uint8_t *dst = NULL;
> +
> +if (avio_feof(pb))
> +return AVERROR_EOF;
> +
> +if (avio_tell(pb) >= a->segments[a->current_segment].offset +
> + a->segments[a->current_segment].size) {
> +if (a->current_segment + 1 == a->nb_segments)
> +return AVERROR_EOF;
> +a->last_segment_pts = a->prev_pts;
> +a->current_segment++;
> +avio_seek(pb, a->segments[a->current_segment].offset, SEEK_SET);
> +if (avio_rb16(pb) != 0x8000)
> +return AVERROR_INVALIDDATA;
> +extradata_size = avio_rb16(pb) + 4;
> +avio_seek(pb, -4, SEEK_CUR);
> +if (extradata_size < 12)
> +return AVERROR_INVALIDDATA;
> +dst = av_packet_new_side_data(pkt, AV_PKT_DATA_NEW_EXTRADATA, 
> extradata_size);
> +if (!dst)
> +return AVERROR(ENOMEM);
> +avio_read(pb, dst, extradata_size);
> +}
> +
> +pkt->pos = avio_tell(pb);
> +ret = av_get_packet(pb, pkt, size);

This will call av_init_packet() internally, meaning the side data you
allocated above will be lost...

> +pkt->duration = 1;
> +pkt->stream_index = 0;
> +pkt->pts = a->last_segment_pts + ((pkt->pos - 
> a->segments[a->current_segment].offset) / size);
> +a->prev_pts = pkt->pts;
> +
> +if (dst) {
> +ret = av_packet_add_side_data(pkt, AV_PKT_DATA_NEW_EXTRADATA, dst, 
> extradata_size);

...and then readded by this.

Just replace the av_packet_new_side_data() call above with an
av_mallocz() one.

> +if (ret < 0)
> +return ret;
> +}
> +
> +return ret;
> +}
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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

Re: [FFmpeg-devel] [PATCH] avcodec/notchlc: Check available space for luma block code

2020-09-12 Thread Paul B Mahol
On Sat, Sep 12, 2020 at 06:43:30PM +0200, Michael Niedermayer wrote:
> Fixes: Timeout (too long -> 2sec)
> Fixes: 
> 25439/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_NOTCHLC_fuzzer-5688211127664640
> 
> Found-by: continuous fuzzing process 
> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer 
> ---
>  libavcodec/notchlc.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/libavcodec/notchlc.c b/libavcodec/notchlc.c
> index 3f7079da70..e7e69b0c21 100644
> --- a/libavcodec/notchlc.c
> +++ b/libavcodec/notchlc.c
> @@ -229,6 +229,9 @@ static int decode_blocks(AVCodecContext *avctx, AVFrame 
> *p, ThreadFrame *frame,
>  bytestream2_seek(, s->y_data_row_offsets, SEEK_SET);
>  bytestream2_seek(gb, s->y_control_data_offset, SEEK_SET);
>  
> +if ((avctx->height + 3) / 4 * ((avctx->width + 3) / 4) * 4 > 
> bytestream2_get_bytes_left(gb))
> +return AVERROR_INVALIDDATA;
> +
>  dsty = (uint16_t *)p->data[0];
>  dsta = (uint16_t *)p->data[3];
>  ylinesize = p->linesize[0] / 2;
> -- 
> 2.17.1

Is this correct at all?

If you do not like timeouts than get smaller samples or reduce dimensions of 
accepted 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".

[FFmpeg-devel] [PATCH 1/2] avformat: add CRI AAX demuxer

2020-09-12 Thread Paul B Mahol
Signed-off-by: Paul B Mahol 
---
 libavformat/Makefile |   1 +
 libavformat/aaxdec.c | 324 +++
 libavformat/allformats.c |   1 +
 3 files changed, 326 insertions(+)
 create mode 100644 libavformat/aaxdec.c

diff --git a/libavformat/Makefile b/libavformat/Makefile
index b4cc467268..883326770f 100644
--- a/libavformat/Makefile
+++ b/libavformat/Makefile
@@ -68,6 +68,7 @@ OBJS-$(CONFIG_SRTP)  += srtp.o
 OBJS-$(CONFIG_A64_MUXER) += a64.o rawenc.o
 OBJS-$(CONFIG_AA_DEMUXER)+= aadec.o
 OBJS-$(CONFIG_AAC_DEMUXER)   += aacdec.o apetag.o img2.o rawdec.o
+OBJS-$(CONFIG_AAX_DEMUXER)   += aaxdec.o
 OBJS-$(CONFIG_AC3_DEMUXER)   += ac3dec.o rawdec.o
 OBJS-$(CONFIG_AC3_MUXER) += rawenc.o
 OBJS-$(CONFIG_ACM_DEMUXER)   += acm.o rawdec.o
diff --git a/libavformat/aaxdec.c b/libavformat/aaxdec.c
new file mode 100644
index 00..419fad9cc8
--- /dev/null
+++ b/libavformat/aaxdec.c
@@ -0,0 +1,324 @@
+/*
+ * AAX demuxer
+ * Copyright (c) 2020 Paul B Mahol
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "libavutil/intreadwrite.h"
+#include "avformat.h"
+#include "internal.h"
+
+typedef struct AAXColumn {
+uint8_t flag;
+uint8_t type;
+const char *name;
+uint32_t offset;
+int size;
+} AAXColumn;
+
+typedef struct AAXSegment {
+int64_t offset;
+uint32_t size;
+} AAXSegment;
+
+typedef struct AAXContext {
+int64_t table_size;
+uint16_t version;
+int64_t rows_offset;
+int64_t strings_offset;
+int64_t data_offset;
+int64_t name_offset;
+uint16_t columns;
+uint16_t row_width;
+uint32_t nb_segments;
+int64_t schema_offset;
+int64_t strings_size;
+char *string_table;
+
+int64_t prev_pts;
+int64_t last_segment_pts;
+int current_segment;
+
+AAXColumn *xcolumns;
+AAXSegment *segments;
+} AAXContext;
+
+static int aax_probe(const AVProbeData *p)
+{
+if (AV_RB32(p->buf) != MKBETAG('@','U','T','F'))
+return 0;
+if (AV_RB16(p->buf + 4) <= 1U)
+return 0;
+
+return AVPROBE_SCORE_MAX;
+}
+
+enum ColumnFlag {
+COLUMN_FLAG_NAME= 0x1,
+COLUMN_FLAG_DEFAULT = 0x2,
+COLUMN_FLAG_ROW = 0x4,
+COLUMN_FLAG_UNDEFINED   = 0x8 /* shouldn't exist */
+};
+
+enum ColumnType {
+COLUMN_TYPE_UINT8   = 0x00,
+COLUMN_TYPE_SINT8   = 0x01,
+COLUMN_TYPE_UINT16  = 0x02,
+COLUMN_TYPE_SINT16  = 0x03,
+COLUMN_TYPE_UINT32  = 0x04,
+COLUMN_TYPE_SINT32  = 0x05,
+COLUMN_TYPE_UINT64  = 0x06,
+COLUMN_TYPE_SINT64  = 0x07,
+COLUMN_TYPE_FLOAT   = 0x08,
+COLUMN_TYPE_DOUBLE  = 0x09,
+COLUMN_TYPE_STRING  = 0x0a,
+COLUMN_TYPE_VLDATA  = 0x0b,
+COLUMN_TYPE_UINT128 = 0x0c, /* for GUIDs */
+COLUMN_TYPE_UNDEFINED   = -1
+};
+
+static int aax_read_header(AVFormatContext *s)
+{
+AAXContext *a = s->priv_data;
+AVIOContext *pb = s->pb;
+AVCodecParameters *par;
+AVStream *st;
+int64_t column_offset = 0;
+char *codec;
+int ret, extradata_size;
+
+avio_skip(pb, 4);
+a->table_size  = avio_rb32(pb) + 8LL;
+a->version = avio_rb16(pb);
+a->rows_offset = avio_rb16(pb) + 8LL;
+a->strings_offset  = avio_rb32(pb) + 8LL;
+a->data_offset = avio_rb32(pb) + 8LL;
+a->name_offset = avio_rb32(pb);
+a->columns = avio_rb16(pb);
+a->row_width   = avio_rb16(pb);
+a->nb_segments = avio_rb32(pb);
+
+a->schema_offset   = 0x20;
+a->strings_size= a->data_offset - a->strings_offset;
+
+if (a->rows_offset > a->table_size ||
+a->strings_offset > a->table_size ||
+a->data_offset > a->table_size)
+return AVERROR_INVALIDDATA;
+if (a->strings_size <= 0 || a->name_offset > a->strings_size ||
+a->strings_size > UINT16_MAX)
+return AVERROR_INVALIDDATA;
+if (a->columns <= 0)
+return AVERROR_INVALIDDATA;
+
+av_freep(>segments);
+a->segments = av_calloc(a->nb_segments, sizeof(*a->segments));
+if (!a->segments)
+

[FFmpeg-devel] [PATCH 2/2] avcodec/adxdec: add support for new extradata in packet sidedata

2020-09-12 Thread Paul B Mahol
Signed-off-by: Paul B Mahol 
---
 libavcodec/adxdec.c | 16 
 1 file changed, 16 insertions(+)

diff --git a/libavcodec/adxdec.c b/libavcodec/adxdec.c
index 40ed8e5ba7..81ffc8b296 100644
--- a/libavcodec/adxdec.c
+++ b/libavcodec/adxdec.c
@@ -103,6 +103,22 @@ static int adx_decode_frame(AVCodecContext *avctx, void 
*data,
 const uint8_t *buf  = avpkt->data;
 const uint8_t *buf_end = buf + avpkt->size;
 int num_blocks, ch, ret;
+int new_extradata_size;
+uint8_t *new_extradata;
+
+new_extradata = av_packet_get_side_data(avpkt, AV_PKT_DATA_NEW_EXTRADATA,
+_extradata_size);
+if (new_extradata && new_extradata_size > 0) {
+int header_size;
+if ((ret = ff_adx_decode_header(avctx, new_extradata,
+new_extradata_size, _size,
+c->coeff)) < 0) {
+av_log(avctx, AV_LOG_ERROR, "error parsing new ADX extradata\n");
+return AVERROR_INVALIDDATA;
+}
+
+c->eof = 0;
+}
 
 if (c->eof) {
 *got_frame_ptr = 0;
-- 
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 1/8] avutil/timecode: fix av_timecode_get_smpte_from_framenum with 50/60 fps

2020-09-12 Thread Marton Balint



On Sat, 5 Sep 2020, Marton Balint wrote:


SMPTE 12M timecode can only count frames up to 39, because the tens-of-frames
value is stored in 2 bit. In order to resolve this 50/60 fps SMPTE timecode is
using the field bit (which is the same bit as the phase correction bit) to
signal the least significant bit of a 50/60 fps timecode. See SMPTE ST
12-1:2014 section 12.1.

Therefore we slightly change the format of the return value of
av_timecode_get_smpte_from_framenum and AV_FRAME_DATA_S12M_TIMECODE and start
using the previously unused Phase Correction bit as Field bit. (As the SMPTE
standard suggests)

We add 50/60 fps support to av_timecode_get_smpte_from_framenum by calling the
recently added av_timecode_get_smpte function in it which already handles this
properly.

This change affects the decklink indev and the DV and MXF muxers. MXF has no
fate test for 50/60fps content, DV does, therefore the changes.

MediaInfo (a recent version) confirms that half-frame timecode must be inserted
to DV. MXFInspect confirms valid timecode insertion to the System Item of MXF
files. For MXF, also see EBU R122.

Note that for DV the field flag is not used because in the HDV specs (SMPTE
370M) it is still defined as biphase mark polarity correction flag. So it
should not matter that the DV muxer overrides the field bit.


Will apply the series soon.

Thanks,
Marton



Signed-off-by: Marton Balint 
---
libavutil/timecode.c   | 15 +--
libavutil/timecode.h   |  7 +++
tests/ref/vsynth/vsynth1-dv-hd |  2 +-
tests/ref/vsynth/vsynth2-dv-hd |  2 +-
tests/ref/vsynth/vsynth3-dv-hd |  2 +-
tests/ref/vsynth/vsynth_lena-dv-hd |  2 +-
6 files changed, 8 insertions(+), 22 deletions(-)

diff --git a/libavutil/timecode.c b/libavutil/timecode.c
index cca53d73c4..cb916970ef 100644
--- a/libavutil/timecode.c
+++ b/libavutil/timecode.c
@@ -65,20 +65,7 @@ uint32_t av_timecode_get_smpte_from_framenum(const 
AVTimecode *tc, int framenum)
ss = framenum / fps  % 60;
mm = framenum / (fps*60) % 60;
hh = framenum / (fps*3600) % 24;
-return 0 << 31 | // color frame flag (0: unsync mode, 1: sync mode)
-   drop  << 30 | // drop  frame flag (0: non drop,1: drop)
-   (ff / 10) << 28 | // tens  of frames
-   (ff % 10) << 24 | // units of frames
-   0 << 23 | // PC (NTSC) or BGF0 (PAL)
-   (ss / 10) << 20 | // tens  of seconds
-   (ss % 10) << 16 | // units of seconds
-   0 << 15 | // BGF0 (NTSC) or BGF2 (PAL)
-   (mm / 10) << 12 | // tens  of minutes
-   (mm % 10) <<  8 | // units of minutes
-   0 <<  7 | // BGF2 (NTSC) or PC (PAL)
-   0 <<  6 | // BGF1
-   (hh / 10) <<  4 | // tens  of hours
-   (hh % 10);// units of hours
+return av_timecode_get_smpte(tc->rate, drop, hh, mm, ss, ff);
}

uint32_t av_timecode_get_smpte(AVRational rate, int drop, int hh, int mm, int 
ss, int ff)
diff --git a/libavutil/timecode.h b/libavutil/timecode.h
index 5801330921..e54b116e93 100644
--- a/libavutil/timecode.h
+++ b/libavutil/timecode.h
@@ -66,11 +66,11 @@ int av_timecode_adjust_ntsc_framenum2(int framenum, int 
fps);
 * the format description as follows:
 * bits 0-5:   hours, in BCD(6bits)
 * bits 6: BGF1
- * bits 7: BGF2 (NTSC) or PC (PAL)
+ * bits 7: BGF2 (NTSC) or FIELD (PAL)
 * bits 8-14:  minutes, in BCD(7bits)
 * bits 15:BGF0 (NTSC) or BGF2 (PAL)
 * bits 16-22: seconds, in BCD(7bits)
- * bits 23:PC (NTSC) or BGF0 (PAL)
+ * bits 23:FIELD (NTSC) or BGF0 (PAL)
 * bits 24-29: frames, in BCD(6bits)
 * bits 30:drop  frame flag (0: non drop,1: drop)
 * bits 31:color frame flag (0: unsync mode, 1: sync mode)
@@ -78,8 +78,7 @@ int av_timecode_adjust_ntsc_framenum2(int framenum, int fps);
 * @note Frame number adjustment is automatically done in case of drop timecode,
 *   you do NOT have to call av_timecode_adjust_ntsc_framenum2().
 * @note The frame number is relative to tc->start.
- * @note Color frame (CF), binary group flags (BGF) and biphase mark polarity
- *   correction (PC) bits are set to zero.
+ * @note Color frame (CF) and binary group flags (BGF) bits are set to zero.
 */
uint32_t av_timecode_get_smpte_from_framenum(const AVTimecode *tc, int 
framenum);

diff --git a/tests/ref/vsynth/vsynth1-dv-hd b/tests/ref/vsynth/vsynth1-dv-hd
index 6b6d6e8159..3f2f9cc843 100644
--- a/tests/ref/vsynth/vsynth1-dv-hd
+++ b/tests/ref/vsynth/vsynth1-dv-hd
@@ -1,4 +1,4 @@
-22d1d62a834fe8416fe79c51760012c1 *tests/data/fate/vsynth1-dv-hd.dv
+b2bcafc74dec5f9ca516cb25dd07459b *tests/data/fate/vsynth1-dv-hd.dv
1440 tests/data/fate/vsynth1-dv-hd.dv
34b78cf725346c7f819c9d6209b8299a *tests/data/fate/vsynth1-dv-hd.out.rawvideo
stddev:4.30 PSNR: 35.45 MAXDIFF:   74 bytes:  7603200/  7603200
diff --git a/tests/ref/vsynth/vsynth2-dv-hd b/tests/ref/vsynth/vsynth2-dv-hd
index c6dcb5a953..0a5046e4ec 100644

Re: [FFmpeg-devel] [PATCH] avcodec/libaomenc: Extract extradata directly if available

2020-09-12 Thread Andriy Gelman
On Sat, 12. Sep 14:00, James Almer wrote:
> On 9/12/2020 1:32 PM, Derek Buitenhuis wrote:
> > On 12/09/2020 16:48, James Almer wrote:
> >> No, see https://bugs.chromium.org/p/aomedia/issues/detail?id=2208
> >>
> >> aom_codec_get_global_headers() has a bug that hasn't been fixed. That's
> >> why i haven't implemented it yet in our wrapper.
> > 
> > Even if fixed, shouldn't be still use the BSF anyway, since it could
> > also add in other useful config OBUs like HDR metadata OBUs?
> 
> I'd expect aom_codec_get_global_headers() to return all OBUs that apply
> to the entire coded stream, hence the name, so that should include
> Metadata OBUs like HDR (but not frame specific ones like ITU-T 35).
> 
> But if it doesn't then yeah, we wouldn't be able to remove the extract
> extradata bsf here.
> 

They only write the sequence header OBU at the moment.

-- 
Andriy
___
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/arbc: Assume that at least one segment has a tile

2020-09-12 Thread Michael Niedermayer
If no segment has a tile, the segment count really should be 0
Fixes: Timeout (61sec -> 2sec)
Fixes: 
25445/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ARBC_fuzzer-5657711222718464

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

diff --git a/libavcodec/arbc.c b/libavcodec/arbc.c
index 06970f140b..9d8284df2b 100644
--- a/libavcodec/arbc.c
+++ b/libavcodec/arbc.c
@@ -133,7 +133,7 @@ static int decode_frame(AVCodecContext *avctx, void *data,
 if (nb_segments == 0)
 return avpkt->size;
 
-if (7 * nb_segments > bytestream2_get_bytes_left(>gb))
+if (7 * nb_segments + 6 > bytestream2_get_bytes_left(>gb))
 return AVERROR_INVALIDDATA;
 
 if ((ret = ff_get_buffer(avctx, frame, AV_GET_BUFFER_FLAG_REF)) < 0)
-- 
2.17.1

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

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

[FFmpeg-devel] [PATCH 2/2] avformat/asfdec_f: Change order or operations slightly

2020-09-12 Thread Michael Niedermayer
Fixes: signed integer overflow: 20 * 5184056935931942919 cannot be represented 
in type 'long'
Fixes: 
25466/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-4798660247552000

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

diff --git a/libavformat/asfdec_f.c b/libavformat/asfdec_f.c
index e9ddca7151..103155e9e7 100644
--- a/libavformat/asfdec_f.c
+++ b/libavformat/asfdec_f.c
@@ -424,7 +424,7 @@ static int asf_read_stream_properties(AVFormatContext *s, 
int64_t size)
 if (!(asf->hdr.flags & 0x01)) { // if we aren't streaming...
 int64_t fsize = avio_size(pb);
 if (fsize <= 0 || (int64_t)asf->hdr.file_size <= 0 ||
-20*FFABS(fsize - (int64_t)asf->hdr.file_size) < FFMIN(fsize, 
asf->hdr.file_size))
+FFABS(fsize - (int64_t)asf->hdr.file_size) < FFMIN(fsize, 
asf->hdr.file_size)/20)
 st->duration = asf->hdr.play_time /
(1000 / 1000) - start_time;
 }
-- 
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 v5 2/2] libavformat/webp: add WebP demuxer

2020-09-12 Thread Carl Eugen Hoyos
Am Fr., 11. Sept. 2020 um 08:36 Uhr schrieb Josef Zlomek :

This is not the requested review, I am just curious about the
behaviour:

> +static int webp_probe(const AVProbeData *p)
> +{
> +const uint8_t *b = p->buf;
> +
> +if (AV_RB32(b) == MKBETAG('R', 'I', 'F', 'F') &&
> +AV_RB32(b + 8) == MKBETAG('W', 'E', 'B', 'P'))
> +return AVPROBE_SCORE_MAX;

What happens if you pipe several (not animated) webp images
through your new demuxer?
Does it behave like the existing pipe demuxer?

> +static int ensure_seekback(AVFormatContext *s, int64_t bytes)
> +{
> +WebPDemuxContext *wdc = s->priv_data;
> +AVIOContext  *pb  = s->pb;
> +int ret;
> +
> +int64_t pos = avio_tell(pb);
> +if (pos < 0)
> +return pos;
> +
> +if (pos + bytes <= wdc->seekback_buffer_end)
> +return 0;
> +
> +if ((ret = ffio_ensure_seekback(pb, bytes)) < 0)
> +return ret;
> +
> +wdc->seekback_buffer_end = pos + bytes;
> +return 0;
> +}
> +
> +static int resync(AVFormatContext *s, int seek_to_start)
> +{
> +WebPDemuxContext *wdc = s->priv_data;
> +AVIOContext  *pb  = s->pb;
> +int ret;
> +int i;
> +uint64_t state = 0;
> +
> +// ensure seek back for the file header and the first chunk header
> +if ((ret = ensure_seekback(s, 12 + 8)) < 0)
> +return ret;
> +
> +for (i = 0; i < 12; i++) {
> +state = (state << 8) | avio_r8(pb);

> +if (i == 11) {
> +if ((uint32_t) state == MKBETAG('W', 'E', 'B', 'P'))

The cast looks really ugly: Why is it necessary?

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

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

Re: [FFmpeg-devel] [PATCH V3 1/2] avcodec: add av1 hardware acceleration decoder

2020-09-12 Thread James Almer
On 9/9/2020 10:23 PM, Wang, Fei W wrote:
> 
>> On 9/9/2020 12:39 AM, Fei Wang wrote:
>>> This av1 decoder is now only used for av1 hardware acceleration
>>> decoder. Consider it can be extend to a local decoder like hevc or vp9
>>> in the future, so define its name as "av1" and put it into external
>>> libraries codec list.
>>>
>>> Signed-off-by: Fei Wang 
>>> ---
>>> update:
>>> 1. reuse buffer for tile_group_info.
>>> 2. set avctx/frame props from sequence and frame header.
>>> 3. refine ref/unref for s->seq_ref/s->header_ref.
>>> 4. refine av1_decode_frame to reduce duplicated code.
>>>
>>>  Changelog  |   1 +
>>>  configure  |   1 +
>>>  libavcodec/Makefile|   1 +
>>>  libavcodec/allcodecs.c |   1 +
>>>  libavcodec/av1dec.c| 860
>> +
>>>  libavcodec/av1dec.h|  70 
>>>  libavcodec/version.h   |   2 +-
>>>  7 files changed, 935 insertions(+), 1 deletion(-)  create mode 100644
>>> libavcodec/av1dec.c  create mode 100644 libavcodec/av1dec.h
>>
>> It's mostly good now. A few issues like a pointer leak on failure if
>> av_realloc_array() fails, but i can fix those before pushing.
>>
>> I'll let Mark review the vaapi patch and apply this one soon, since 
>> apparently
>> there are other hwaccels implementations waiting for this to land.
> 
> That's great! Thanks all for reviewing my patch to improve it!

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

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

Re: [FFmpeg-devel] [PATCH] avcodec/libaomenc: Extract extradata directly if available

2020-09-12 Thread James Almer
On 9/12/2020 1:32 PM, Derek Buitenhuis wrote:
> On 12/09/2020 16:48, James Almer wrote:
>> No, see https://bugs.chromium.org/p/aomedia/issues/detail?id=2208
>>
>> aom_codec_get_global_headers() has a bug that hasn't been fixed. That's
>> why i haven't implemented it yet in our wrapper.
> 
> Even if fixed, shouldn't be still use the BSF anyway, since it could
> also add in other useful config OBUs like HDR metadata OBUs?

I'd expect aom_codec_get_global_headers() to return all OBUs that apply
to the entire coded stream, hence the name, so that should include
Metadata OBUs like HDR (but not frame specific ones like ITU-T 35).

But if it doesn't then yeah, we wouldn't be able to remove the extract
extradata bsf here.

> 
> - Derek
> ___
> 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] avcodec/libaomenc: Extract extradata directly if available

2020-09-12 Thread Derek Buitenhuis
On 12/09/2020 16:48, James Almer wrote:
> No, see https://bugs.chromium.org/p/aomedia/issues/detail?id=2208
> 
> aom_codec_get_global_headers() has a bug that hasn't been fixed. That's
> why i haven't implemented it yet in our wrapper.

Even if fixed, shouldn't be still use the BSF anyway, since it could
also add in other useful config OBUs like HDR metadata OBUs?

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

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

[FFmpeg-devel] [PATCH] avcodec/notchlc: Check available space for luma block code

2020-09-12 Thread Michael Niedermayer
Fixes: Timeout (too long -> 2sec)
Fixes: 
25439/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_NOTCHLC_fuzzer-5688211127664640

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

diff --git a/libavcodec/notchlc.c b/libavcodec/notchlc.c
index 3f7079da70..e7e69b0c21 100644
--- a/libavcodec/notchlc.c
+++ b/libavcodec/notchlc.c
@@ -229,6 +229,9 @@ static int decode_blocks(AVCodecContext *avctx, AVFrame *p, 
ThreadFrame *frame,
 bytestream2_seek(, s->y_data_row_offsets, SEEK_SET);
 bytestream2_seek(gb, s->y_control_data_offset, SEEK_SET);
 
+if ((avctx->height + 3) / 4 * ((avctx->width + 3) / 4) * 4 > 
bytestream2_get_bytes_left(gb))
+return AVERROR_INVALIDDATA;
+
 dsty = (uint16_t *)p->data[0];
 dsta = (uint16_t *)p->data[3];
 ylinesize = p->linesize[0] / 2;
-- 
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] avcodec/libaomenc: Extract extradata directly if available

2020-09-12 Thread James Almer
On 9/12/2020 11:39 AM, Andriy Gelman wrote:
> From: Andriy Gelman 
> 
> Currently a bsf is inserted to extract OBU headers which are propagated
> as packet side data. The side data is used in matroska to insert out of
> band extradata.
> 
> Support to fetch extradata directly from av1 was added in commit
> f8d6a1653476662a7b00a1564afe37516adeba1a in libaom. So there is no need
> to insert a bsf if extradata can be fetched.

No, see https://bugs.chromium.org/p/aomedia/issues/detail?id=2208

aom_codec_get_global_headers() has a bug that hasn't been fixed. That's
why i haven't implemented it yet in our wrapper.

> 
> Signed-off-by: Andriy Gelman 
> ---
>  libavcodec/libaomenc.c | 14 +-
>  1 file changed, 13 insertions(+), 1 deletion(-)
> 
> diff --git a/libavcodec/libaomenc.c b/libavcodec/libaomenc.c
> index 2b0581b15a..27ee630382 100644
> --- a/libavcodec/libaomenc.c
> +++ b/libavcodec/libaomenc.c
> @@ -879,6 +879,18 @@ static av_cold int aom_init(AVCodecContext *avctx,
>  return AVERROR(ENOMEM);
>  
>  if (avctx->flags & AV_CODEC_FLAG_GLOBAL_HEADER) {
> +aom_fixed_buf_t *aom_buf;
> +aom_buf = aom_codec_get_global_headers(>encoder);
> +if (aom_buf) {
> +avctx->extradata = av_mallocz(aom_buf->sz + 
> AV_INPUT_BUFFER_PADDING_SIZE);
> +memcpy(avctx->extradata, aom_buf->buf, aom_buf->sz);
> +avctx->extradata_size = aom_buf->sz;
> +av_free(aom_buf->buf);
> +av_freep(_buf);
> +}
> +}
> +
> +if (!avctx->extradata && avctx->flags & AV_CODEC_FLAG_GLOBAL_HEADER) {
>  const AVBitStreamFilter *filter = 
> av_bsf_get_by_name("extract_extradata");
>  int ret;
>  
> @@ -976,7 +988,7 @@ static int storeframe(AVCodecContext *avctx, struct 
> FrameListData *cx_frame,
>  #endif
>  }
>  
> -if (avctx->flags & AV_CODEC_FLAG_GLOBAL_HEADER) {
> +if (ctx->bsf) {
>  ret = av_bsf_send_packet(ctx->bsf, pkt);
>  if (ret < 0) {
>  av_log(avctx, AV_LOG_ERROR, "extract_extradata filter "
> 

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

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

[FFmpeg-devel] [PATCH] avcodec/libaomenc: Extract extradata directly if available

2020-09-12 Thread Andriy Gelman
From: Andriy Gelman 

Currently a bsf is inserted to extract OBU headers which are propagated
as packet side data. The side data is used in matroska to insert out of
band extradata.

Support to fetch extradata directly from av1 was added in commit
f8d6a1653476662a7b00a1564afe37516adeba1a in libaom. So there is no need
to insert a bsf if extradata can be fetched.

Signed-off-by: Andriy Gelman 
---
 libavcodec/libaomenc.c | 14 +-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/libavcodec/libaomenc.c b/libavcodec/libaomenc.c
index 2b0581b15a..27ee630382 100644
--- a/libavcodec/libaomenc.c
+++ b/libavcodec/libaomenc.c
@@ -879,6 +879,18 @@ static av_cold int aom_init(AVCodecContext *avctx,
 return AVERROR(ENOMEM);
 
 if (avctx->flags & AV_CODEC_FLAG_GLOBAL_HEADER) {
+aom_fixed_buf_t *aom_buf;
+aom_buf = aom_codec_get_global_headers(>encoder);
+if (aom_buf) {
+avctx->extradata = av_mallocz(aom_buf->sz + 
AV_INPUT_BUFFER_PADDING_SIZE);
+memcpy(avctx->extradata, aom_buf->buf, aom_buf->sz);
+avctx->extradata_size = aom_buf->sz;
+av_free(aom_buf->buf);
+av_freep(_buf);
+}
+}
+
+if (!avctx->extradata && avctx->flags & AV_CODEC_FLAG_GLOBAL_HEADER) {
 const AVBitStreamFilter *filter = 
av_bsf_get_by_name("extract_extradata");
 int ret;
 
@@ -976,7 +988,7 @@ static int storeframe(AVCodecContext *avctx, struct 
FrameListData *cx_frame,
 #endif
 }
 
-if (avctx->flags & AV_CODEC_FLAG_GLOBAL_HEADER) {
+if (ctx->bsf) {
 ret = av_bsf_send_packet(ctx->bsf, pkt);
 if (ret < 0) {
 av_log(avctx, AV_LOG_ERROR, "extract_extradata filter "
-- 
2.27.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 2/2] avcodec/mobiclip: set the bitstream size to the input

2020-09-12 Thread Paul B Mahol
On Sat, Sep 12, 2020 at 04:35:55PM +0200, Michael Niedermayer wrote:
> Fixes: out of array read
> Fixes: 
> 25453/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MOBICLIP_fuzzer-5163575973511168
> 
> Found-by: continuous fuzzing process 
> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer 
> ---
>  libavcodec/mobiclip.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libavcodec/mobiclip.c b/libavcodec/mobiclip.c
> index 3ede370bef..08a35218cc 100644
> --- a/libavcodec/mobiclip.c
> +++ b/libavcodec/mobiclip.c
> @@ -1306,7 +1306,7 @@ static int mobiclip_decode(AVCodecContext *avctx, void 
> *data,
>  (uint16_t *)pkt->data,
>  (pkt->size + 1) >> 1);
>  
> -ret = init_get_bits8(gb, s->bitstream, s->bitstream_size);
> +ret = init_get_bits8(gb, s->bitstream, FFALIGN(pkt->size, 2));
>  if (ret < 0)
>  return ret;

ok.

>  
> -- 
> 2.17.1
> 
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
___
ffmpeg-devel 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/2] avcodec/mobiclip: check for pmode=2 ax/ay=0

2020-09-12 Thread Paul B Mahol
On Sat, Sep 12, 2020 at 04:35:54PM +0200, Michael Niedermayer wrote:
> Fixes: out of array access
> Fixes: 
> 25452/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MOBICLIP_fuzzer-5081657055641600
> 
> Found-by: continuous fuzzing process 
> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer 
> ---
>  libavcodec/mobiclip.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/libavcodec/mobiclip.c b/libavcodec/mobiclip.c
> index 13f0edc89d..3ede370bef 100644
> --- a/libavcodec/mobiclip.c
> +++ b/libavcodec/mobiclip.c
> @@ -914,6 +914,9 @@ static int predict_intra(AVCodecContext *avctx, AVFrame 
> *frame, int ax, int ay,
>  int shift = adjust(size, size) == 8 ? 3 : 2;
>  uint8_t *block;
>  
> +if (ax == 0 && ay == 0)
> +return -1;
> +

Please clip it instead, FFMAX(ax - 1, 0) above.

I forgot to do it.

>  for (int x = 0; x < size; x++) {
>  int val = top[x];
>  arr1[x] = adjust(((bottommost - val) * (1 << shift)) + r6 * 
> (x + 1), size);
> -- 
> 2.17.1
> 
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
___
ffmpeg-devel 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/mobiclip: check for pmode=2 ax/ay=0

2020-09-12 Thread Michael Niedermayer
Fixes: out of array access
Fixes: 
25452/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MOBICLIP_fuzzer-5081657055641600

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

diff --git a/libavcodec/mobiclip.c b/libavcodec/mobiclip.c
index 13f0edc89d..3ede370bef 100644
--- a/libavcodec/mobiclip.c
+++ b/libavcodec/mobiclip.c
@@ -914,6 +914,9 @@ static int predict_intra(AVCodecContext *avctx, AVFrame 
*frame, int ax, int ay,
 int shift = adjust(size, size) == 8 ? 3 : 2;
 uint8_t *block;
 
+if (ax == 0 && ay == 0)
+return -1;
+
 for (int x = 0; x < size; x++) {
 int val = top[x];
 arr1[x] = adjust(((bottommost - val) * (1 << shift)) + r6 * (x 
+ 1), size);
-- 
2.17.1

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

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

[FFmpeg-devel] [PATCH 2/2] avcodec/mobiclip: set the bitstream size to the input

2020-09-12 Thread Michael Niedermayer
Fixes: out of array read
Fixes: 
25453/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MOBICLIP_fuzzer-5163575973511168

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

diff --git a/libavcodec/mobiclip.c b/libavcodec/mobiclip.c
index 3ede370bef..08a35218cc 100644
--- a/libavcodec/mobiclip.c
+++ b/libavcodec/mobiclip.c
@@ -1306,7 +1306,7 @@ static int mobiclip_decode(AVCodecContext *avctx, void 
*data,
 (uint16_t *)pkt->data,
 (pkt->size + 1) >> 1);
 
-ret = init_get_bits8(gb, s->bitstream, s->bitstream_size);
+ret = init_get_bits8(gb, s->bitstream, FFALIGN(pkt->size, 2));
 if (ret < 0)
 return ret;
 
-- 
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 4/4] avcodec/mpc: Fix multiple numerical overflows in ff_mpc_dequantize_and_synth()

2020-09-12 Thread Michael Niedermayer
On Tue, Jun 30, 2020 at 10:28:32PM +0200, Michael Niedermayer wrote:
> Fixes: -2.4187e+09 is outside the range of representable values of type 'int'
> Fixes: signed integer overflow: -14512205 + -2147483648 cannot be represented 
> in type 'int'
> Fixes: 
> 20492/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MPC7_fuzzer-5747263166480384
> Fixes: 
> 23528/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MPC7_fuzzer-5747263166480384
> 
> Found-by: continuous fuzzing process 
> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer 
> ---
>  libavcodec/mpc.c | 8 
>  1 file changed, 4 insertions(+), 4 deletions(-)

will apply


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

Let us carefully observe those good qualities wherein our enemies excel us
and endeavor to excel them, by avoiding what is faulty, and imitating what
is excellent in them. -- Plutarch


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 v5 2/2] libavformat/webp: add WebP demuxer

2020-09-12 Thread Lynne
On 11/09/2020 08:36, Josef Zlomek wrote:
> Adds the demuxer of animated WebP files.
> It supports non-animated, animated, truncated, and concatenated files.
> Reading from a pipe (and other non-seekable inputs) is also supported.
> 
> The WebP demuxer splits the input stream into packets containing one frame.
> It also marks the key frames properly.
> The loop count is ignored by default (same behaviour as animated PNG and GIF),
> it may be enabled by the option '-ignore_loop 0'.
> 
> The frame rate is set according to the frame delay in the ANMF chunk.
> If the delay is too low, or the image is not animated, the default frame rate
> is set to 10 fps, similarly to other WebP libraries and browsers.
> The fate suite was updated accordingly.
> 
> Signed-off-by: Josef Zlomek 
Can someone take a look at the demuxer? I'd rather not apply the decoder
without the demuxer, and lavf isn't my specialty.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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

Re: [FFmpeg-devel] [PATCH] avcodec/adpcm: take into account block_align when decoding ADPCM_PSX

2020-09-12 Thread Zane van Iperen
On Fri, 11 Sep 2020 15:27:42 +0200
"Paul B Mahol"  wrote:

> get_nb_samples() gives number of samples in single packet depending on its 
> size.
> We here uses blocks and block_align to decode mutliple frames at once.
> 
> Imagine decoding stereo int16 pcm so that you pick only 4 bytes each time.
> This would give so big overhead that it would be not usable at all.
> Some ADPCM codecs just do this, and thus in player give excessive CPU usage.
> Also when decoding with ffmpeg -i input -f null -, realtime speed is nowhere
> near optimum value. In my case with this patch and modified demuxer to return
> mutliple frames it changes from 50x to >1000x speed.

I just applied the same changes to the argo decoder and demuxer and saw a
similar speedup. It's insane how much of a difference it makes. (I'll 
send a patch for it after I've dealt with the BRP demuxer).

Also, this LGTM.


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

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

Re: [FFmpeg-devel] [PATCH] avcodec/mobiclip: Check quantizer before table setup

2020-09-12 Thread Michael Niedermayer
On Fri, Sep 11, 2020 at 10:00:02PM +0200, Paul B Mahol wrote:
> On Fri, Sep 11, 2020 at 08:09:48PM +0200, Michael Niedermayer wrote:
> > On Fri, Sep 11, 2020 at 11:12:33AM +0200, Paul B Mahol wrote:
> > > On Fri, Sep 11, 2020 at 01:19:59AM +0200, Michael Niedermayer wrote:
> > > > Fixes: index -1 out of bounds for type 'const uint8_t [6][16]'
> > > > Fixes: out of array read
> > > > Fixes: shift exponent -21 is negative
> > > > Fixes: 
> > > > 25422/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MOBICLIP_fuzzer-5748258226569216
> > > > Fixes: shift exponent 8039082 is too large for 32-bit type 'int'
> > > > Fixes: 
> > > > 25430/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MOBICLIP_fuzzer-5698567770210304
> > > > 
> > > > Found-by: continuous fuzzing process 
> > > > https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> > > > Signed-off-by: Michael Niedermayer 
> > > > ---
> > > >  libavcodec/mobiclip.c | 6 +-
> > > >  1 file changed, 5 insertions(+), 1 deletion(-)
> > > > 
> > > > diff --git a/libavcodec/mobiclip.c b/libavcodec/mobiclip.c
> > > > index d147eddbae..13f0edc89d 100644
> > > > --- a/libavcodec/mobiclip.c
> > > > +++ b/libavcodec/mobiclip.c
> > > > @@ -1323,6 +1323,10 @@ static int mobiclip_decode(AVCodecContext 
> > > > *avctx, void *data,
> > > >  }
> > > >  } else {
> > > >  MotionXY *motion = s->motion;
> > > > +int quantizer = s->quantizer + get_se_golomb(gb);
> > > > +
> > > > +if (quantizer < 12 || quantizer > 161)
> > > 
> > > From where this numbers come?
> > 
> > It comes from the implementation
> > qtab is int and will overflow beyond 161
> 
> ok then.

will apply

thx

[...]
-- 
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] avfilter/f_graphmonitor: add tiny output mode

2020-09-12 Thread Paul B Mahol
On Wed, Sep 09, 2020 at 09:46:32PM +0200, Paul B Mahol wrote:
> Signed-off-by: Paul B Mahol 
> ---
>  doc/filters.texi |   2 +-
>  libavfilter/f_graphmonitor.c | 119 +++
>  2 files changed, 109 insertions(+), 12 deletions(-)
> 

Gonna apply.
___
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/2] fate: use correct uint32 layer

2020-09-12 Thread Paul B Mahol
On Sat, Sep 12, 2020 at 02:07:13AM -0700, mindm...@gmail.com wrote:
> From: Mark Reid 
> 
> ---
>  tests/fate/image.mak   | 2 +-
>  tests/ref/fate/exr-rgb-scanline-pxr24-half-uint32-13x9 | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)

Gonna apply.

> 
> diff --git a/tests/fate/image.mak b/tests/fate/image.mak
> index 756d01c667..69b4ea5431 100644
> --- a/tests/fate/image.mak
> +++ b/tests/fate/image.mak
> @@ -221,7 +221,7 @@ FATE_EXR += fate-exr-rgb-scanline-pxr24-float-half-l2
>  fate-exr-rgb-scanline-pxr24-float-half-l2: CMD = framecrc -layer 
> "VRaySamplerInfo" -i $(TARGET_SAMPLES)/exr/rgb_scanline_pxr24_float_half.exr 
> -pix_fmt gbrapf32le
>  
>  FATE_EXR += fate-exr-rgb-scanline-pxr24-half-uint32-13x9
> -fate-exr-rgb-scanline-pxr24-half-uint32-13x9: CMD = framecrc -i 
> $(TARGET_SAMPLES)/exr/rgb_scanline_pxr24_half_uint32_13x9.exr -pix_fmt 
> rgb48le -vf scale
> +fate-exr-rgb-scanline-pxr24-half-uint32-13x9: CMD = framecrc -layer 
> "VRaySamplerInfo" -i 
> $(TARGET_SAMPLES)/exr/rgb_scanline_pxr24_half_uint32_13x9.exr -pix_fmt 
> rgb48le -vf scale
>  
>  FATE_EXR += fate-exr-rgb-scanline-zip-half-float-l1
>  fate-exr-rgb-scanline-zip-half-float-l1: CMD = framecrc -i 
> $(TARGET_SAMPLES)/exr/rgb_scanline_zip_half_float.exr -pix_fmt gbrpf32le
> diff --git a/tests/ref/fate/exr-rgb-scanline-pxr24-half-uint32-13x9 
> b/tests/ref/fate/exr-rgb-scanline-pxr24-half-uint32-13x9
> index 523ed9c88b..2d209d8a63 100644
> --- a/tests/ref/fate/exr-rgb-scanline-pxr24-half-uint32-13x9
> +++ b/tests/ref/fate/exr-rgb-scanline-pxr24-half-uint32-13x9
> @@ -3,4 +3,4 @@
>  #codec_id 0: rawvideo
>  #dimensions 0: 13x9
>  #sar 0: 9/10
> -0,  0,  0,1,  702, 0x68c1450d
> +0,  0,  0,1,  702, 0x86132f10
> -- 
> 2.27.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".

[FFmpeg-devel] [PATCH] avformat: add DAT CCTV demuxer

2020-09-12 Thread Paul B Mahol
Signed-off-by: Paul B Mahol 
---
 libavformat/Makefile |   1 +
 libavformat/allformats.c |   1 +
 libavformat/luodatdec.c  | 129 +++
 3 files changed, 131 insertions(+)
 create mode 100644 libavformat/luodatdec.c

diff --git a/libavformat/Makefile b/libavformat/Makefile
index 5ce1e6464d..b4cc467268 100644
--- a/libavformat/Makefile
+++ b/libavformat/Makefile
@@ -292,6 +292,7 @@ OBJS-$(CONFIG_KVAG_MUXER)+= kvag.o rawenc.o
 OBJS-$(CONFIG_LATM_MUXER)+= latmenc.o rawenc.o
 OBJS-$(CONFIG_LMLM4_DEMUXER) += lmlm4.o
 OBJS-$(CONFIG_LOAS_DEMUXER)  += loasdec.o rawdec.o
+OBJS-$(CONFIG_LUODAT_DEMUXER)+= luodatdec.o
 OBJS-$(CONFIG_LRC_DEMUXER)   += lrcdec.o lrc.o subtitles.o
 OBJS-$(CONFIG_LRC_MUXER) += lrcenc.o lrc.o
 OBJS-$(CONFIG_LVF_DEMUXER)   += lvfdec.o
diff --git a/libavformat/allformats.c b/libavformat/allformats.c
index 82838e3c53..a23eb9e7fa 100644
--- a/libavformat/allformats.c
+++ b/libavformat/allformats.c
@@ -226,6 +226,7 @@ extern AVOutputFormat ff_kvag_muxer;
 extern AVOutputFormat ff_latm_muxer;
 extern AVInputFormat  ff_lmlm4_demuxer;
 extern AVInputFormat  ff_loas_demuxer;
+extern AVInputFormat  ff_luodat_demuxer;
 extern AVInputFormat  ff_lrc_demuxer;
 extern AVOutputFormat ff_lrc_muxer;
 extern AVInputFormat  ff_lvf_demuxer;
diff --git a/libavformat/luodatdec.c b/libavformat/luodatdec.c
new file mode 100644
index 00..939c7f63b5
--- /dev/null
+++ b/libavformat/luodatdec.c
@@ -0,0 +1,129 @@
+/*
+ * CCTV DAT demuxer
+ *
+ * Copyright (c) 2020 Paul B Mahol
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "libavutil/intreadwrite.h"
+#include "avio_internal.h"
+#include "avformat.h"
+#include "internal.h"
+
+static int dat_probe(const AVProbeData *p)
+{
+if (p->buf_size < 0x2080)
+return 0;
+
+if (memcmp(p->buf, "luo ", 4))
+return 0;
+
+if (memcmp(p->buf + 0x1ffc, " oul", 4))
+return 0;
+
+if (memcmp(p->buf + 0x2000, "liu ", 4))
+return 0;
+
+if (!AV_RL32(p->buf + 0x2004))
+return 0;
+
+if (memcmp(p->buf + 0x207c, " uil", 4))
+return 0;
+
+return AVPROBE_SCORE_MAX;
+}
+
+static int dat_read_header(AVFormatContext *s)
+{
+s->ctx_flags |= AVFMTCTX_NOHEADER;
+
+avio_seek(s->pb, 0x2000, SEEK_SET);
+
+return 0;
+}
+
+static int dat_read_packet(AVFormatContext *s, AVPacket *pkt)
+{
+AVIOContext *pb = s->pb;
+int index, ret, key, stream_id, stream_index, width, height, fps, pkt_size;
+int64_t pts, pos = avio_tell(pb);
+
+if (avio_feof(pb))
+return AVERROR_EOF;
+
+if (avio_rb32(pb) != MKBETAG('l', 'i', 'u', ' '))
+return AVERROR_INVALIDDATA;
+stream_id = avio_rl32(pb);
+width = avio_rl32(pb);
+height= avio_rl32(pb);
+fps   = avio_rl32(pb);
+avio_skip(pb, 16);
+key   = avio_rl32(pb) == 1;
+avio_skip(pb, 4);
+index = avio_rl32(pb);
+avio_skip(pb, 4);
+pts   = avio_rl64(pb);
+pkt_size  = avio_rl32(pb);
+avio_skip(pb, 64);
+
+if (pkt_size == 0)
+return AVERROR_EOF;
+
+for (stream_index = 0; stream_index < s->nb_streams; stream_index++) {
+if (s->streams[stream_index]->id == stream_id)
+break;
+}
+
+if (stream_index == s->nb_streams) {
+AVStream *st = avformat_new_stream(s, NULL);
+
+if (!st)
+return AVERROR(ENOMEM);
+
+st->id = stream_id;
+st->codecpar->codec_type = AVMEDIA_TYPE_VIDEO;
+st->codecpar->codec_id   = AV_CODEC_ID_H264;
+st->codecpar->width  = width;
+st->codecpar->height = height;
+avpriv_set_pts_info(st, 64, 1, fps);
+}
+
+if (index >= s->nb_streams)
+av_log(s, AV_LOG_WARNING, "Stream index out of range.\n");
+
+ret = av_get_packet(pb, pkt, pkt_size);
+if (ret < 0)
+return ret;
+pkt->pos = pos;
+pkt->pts = pts;
+pkt->stream_index = stream_index;
+if (key)
+pkt->flags |= AV_PKT_FLAG_KEY;
+
+return ret;
+}
+
+AVInputFormat ff_luodat_demuxer = {
+.name   = "luodat",
+.long_name  = NULL_IF_CONFIG_SMALL("Video DAT"),
+

[FFmpeg-devel] [PATCH 0/2] libswcale/input: fix incorrect rgbf32 yuv conversions

2020-09-12 Thread mindmark
From: Mark Reid 

Hi,
I'm not sure how I didn't notice this before but the f32 to yuv conversion
is slightly off. the folowinng 2 patches fix it.

In doing this I found that one of the exr tests probably wasn't testing the 
right 
layer, so I fixed that before.

Mark Reid (2):
  fate: use correct uint32 layer
  libswcale/input: fix incorrect rgbf32 yuv conversions

 libswscale/input.c   | 12 +---
 tests/fate/image.mak |  2 +-
 .../ref/fate/exr-rgb-scanline-pxr24-half-uint32-13x9 |  2 +-
 tests/ref/fate/filter-pixfmts-scale  |  8 
 4 files changed, 11 insertions(+), 13 deletions(-)

-- 
2.27.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/2] libswcale/input: fix incorrect rgbf32 yuv conversions

2020-09-12 Thread mindmark
From: Mark Reid 

---
 libswscale/input.c  | 12 +---
 tests/ref/fate/filter-pixfmts-scale |  8 
 2 files changed, 9 insertions(+), 11 deletions(-)

diff --git a/libswscale/input.c b/libswscale/input.c
index 064ed5902f..67a85b0418 100644
--- a/libswscale/input.c
+++ b/libswscale/input.c
@@ -984,15 +984,14 @@ static av_always_inline void planar_rgbf32_to_uv(uint8_t 
*_dstU, uint8_t *_dstV,
 uint16_t *dstV   = (uint16_t *)_dstV;
 int32_t ru = rgb2yuv[RU_IDX], gu = rgb2yuv[GU_IDX], bu = rgb2yuv[BU_IDX];
 int32_t rv = rgb2yuv[RV_IDX], gv = rgb2yuv[GV_IDX], bv = rgb2yuv[BV_IDX];
-int bpc = 16;
-int shift = 14;
+
 for (i = 0; i < width; i++) {
 int g = av_clip_uint16(lrintf(65535.0f * rdpx(src[0] + i)));
 int b = av_clip_uint16(lrintf(65535.0f * rdpx(src[1] + i)));
 int r = av_clip_uint16(lrintf(65535.0f * rdpx(src[2] + i)));
 
-dstU[i] = (ru*r + gu*g + bu*b + (257 << (RGB2YUV_SHIFT + bpc - 9))) >> 
(RGB2YUV_SHIFT + shift - 14);
-dstV[i] = (rv*r + gv*g + bv*b + (257 << (RGB2YUV_SHIFT + bpc - 9))) >> 
(RGB2YUV_SHIFT + shift - 14);
+dstU[i] = (ru*r + gu*g + bu*b + (0x10001 << (RGB2YUV_SHIFT - 1))) >> 
RGB2YUV_SHIFT;
+dstV[i] = (rv*r + gv*g + bv*b + (0x10001 << (RGB2YUV_SHIFT - 1))) >> 
RGB2YUV_SHIFT;
 }
 }
 
@@ -1003,14 +1002,13 @@ static av_always_inline void planar_rgbf32_to_y(uint8_t 
*_dst, const uint8_t *_s
 uint16_t *dst= (uint16_t *)_dst;
 
 int32_t ry = rgb2yuv[RY_IDX], gy = rgb2yuv[GY_IDX], by = rgb2yuv[BY_IDX];
-int bpc = 16;
-int shift = 14;
+
 for (i = 0; i < width; i++) {
 int g = av_clip_uint16(lrintf(65535.0f * rdpx(src[0] + i)));
 int b = av_clip_uint16(lrintf(65535.0f * rdpx(src[1] + i)));
 int r = av_clip_uint16(lrintf(65535.0f * rdpx(src[2] + i)));
 
-dst[i] = ((ry*r + gy*g + by*b + (33 << (RGB2YUV_SHIFT + bpc - 9))) >> 
(RGB2YUV_SHIFT + shift - 14));
+dst[i] = (ry*r + gy*g + by*b + (0x2001 << (RGB2YUV_SHIFT - 1))) >> 
RGB2YUV_SHIFT;
 }
 }
 
diff --git a/tests/ref/fate/filter-pixfmts-scale 
b/tests/ref/fate/filter-pixfmts-scale
index d7020ad2c3..30e7cd5b06 100644
--- a/tests/ref/fate/filter-pixfmts-scale
+++ b/tests/ref/fate/filter-pixfmts-scale
@@ -25,8 +25,8 @@ gbrap12be   1d9b57766ba9c2192403f43967cb9af0
 gbrap12le   bb1ba1c157717db3dd612a76d38a018e
 gbrap16be   c72b935a6e57a8e1c37bff08c2db55b1
 gbrap16le   13eb0e62b1ac9c1c86c81521eaefab5f
-gbrapf32be  42e53d9edccbd9e09c4cd78780ba92f3
-gbrapf32le  eebf3973ef94c841f0a1ceb1ed61621d
+gbrapf32be  366b804d5697276e8c481c4bdf05a00b
+gbrapf32le  558a268e6d6b907449d1056afab78f29
 gbrpdc3387f925f972c61aae7eb23cdc19f0
 gbrp10be0277d4c3a8498d75e2783fb81379e481
 gbrp10lef3d70f8ab845c3c9b8f7452e4a6e285a
@@ -38,8 +38,8 @@ gbrp16be5fc826cfabebfc1442cb793c4b6303e2
 gbrp16le1b3e0b63d47a3e1b6b20931316883bf2
 gbrp9be d9c88968001e1452ff31fbc8d16b18a0
 gbrp9le 2ccfed0816bf6bd4bb3a5b7591d9603a
-gbrpf32be   4614d32e4417f80e0adcc1bdcf6cde42
-gbrpf32le   1366ee77e5559672260bbe51040e28b2
+gbrpf32be   f3d0cefdf11c861001880772d817aac8
+gbrpf32le   290468205c1c18a0667edfca45061aee
 gray221201cc7cfc4964eacd8b3e426fd276
 gray10be9452756d0b37f4f5c7cae7635e22d747
 gray10le37fd2e1ec6b66410212d39a342e864df
-- 
2.27.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] fate: use correct uint32 layer

2020-09-12 Thread mindmark
From: Mark Reid 

---
 tests/fate/image.mak   | 2 +-
 tests/ref/fate/exr-rgb-scanline-pxr24-half-uint32-13x9 | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/tests/fate/image.mak b/tests/fate/image.mak
index 756d01c667..69b4ea5431 100644
--- a/tests/fate/image.mak
+++ b/tests/fate/image.mak
@@ -221,7 +221,7 @@ FATE_EXR += fate-exr-rgb-scanline-pxr24-float-half-l2
 fate-exr-rgb-scanline-pxr24-float-half-l2: CMD = framecrc -layer 
"VRaySamplerInfo" -i $(TARGET_SAMPLES)/exr/rgb_scanline_pxr24_float_half.exr 
-pix_fmt gbrapf32le
 
 FATE_EXR += fate-exr-rgb-scanline-pxr24-half-uint32-13x9
-fate-exr-rgb-scanline-pxr24-half-uint32-13x9: CMD = framecrc -i 
$(TARGET_SAMPLES)/exr/rgb_scanline_pxr24_half_uint32_13x9.exr -pix_fmt rgb48le 
-vf scale
+fate-exr-rgb-scanline-pxr24-half-uint32-13x9: CMD = framecrc -layer 
"VRaySamplerInfo" -i 
$(TARGET_SAMPLES)/exr/rgb_scanline_pxr24_half_uint32_13x9.exr -pix_fmt rgb48le 
-vf scale
 
 FATE_EXR += fate-exr-rgb-scanline-zip-half-float-l1
 fate-exr-rgb-scanline-zip-half-float-l1: CMD = framecrc -i 
$(TARGET_SAMPLES)/exr/rgb_scanline_zip_half_float.exr -pix_fmt gbrpf32le
diff --git a/tests/ref/fate/exr-rgb-scanline-pxr24-half-uint32-13x9 
b/tests/ref/fate/exr-rgb-scanline-pxr24-half-uint32-13x9
index 523ed9c88b..2d209d8a63 100644
--- a/tests/ref/fate/exr-rgb-scanline-pxr24-half-uint32-13x9
+++ b/tests/ref/fate/exr-rgb-scanline-pxr24-half-uint32-13x9
@@ -3,4 +3,4 @@
 #codec_id 0: rawvideo
 #dimensions 0: 13x9
 #sar 0: 9/10
-0,  0,  0,1,  702, 0x68c1450d
+0,  0,  0,1,  702, 0x86132f10
-- 
2.27.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 2/2] dnn/openvino: add input/output name info

2020-09-12 Thread Guo, Yejun


> -Original Message-
> From: ffmpeg-devel  On Behalf Of Ting Fu
> Sent: 2020年9月9日 9:52
> To: ffmpeg-devel@ffmpeg.org
> Subject: [FFmpeg-devel] [PATCH 2/2] dnn/openvino: add input/output name info
> 
> show all input/output names when the input or output name not correct
> 
> Signed-off-by: Ting Fu 
> ---
>  libavfilter/dnn/dnn_backend_openvino.c | 18 +-
>  1 file changed, 17 insertions(+), 1 deletion(-)
> 
> diff --git a/libavfilter/dnn/dnn_backend_openvino.c
> b/libavfilter/dnn/dnn_backend_openvino.c
> index 2f0998046a..e5842906d1 100644

LGTM, will push soon, thanks.

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

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

Re: [FFmpeg-devel] [FFmpeg-cvslog] fate: disable automatic conversions on many tests.

2020-09-12 Thread Michael Niedermayer
On Thu, Sep 10, 2020 at 07:09:50PM -0300, James Almer wrote:
> On 9/10/2020 3:47 PM, Michael Niedermayer wrote:
> > On Thu, Sep 10, 2020 at 07:35:12PM +0200, Nicolas George wrote:
> >> Michael Niedermayer (12020-09-10):
> >>> this breaks several tests on big endian as that needs converts at 
> >>> diffferent
> >>> places.
> >>>
> >>> heres a list of failures
> >>
> >> Thanks for pointing it. I do not see these archs on fate.ffmpeg.org. Is
> >> there a way to get the error output?
> > 
> > the mips qemu fate box run out of diskspace, ive cleared it up so it
> > might reappear in the next day or 2, if not then it needs checking what else
> > is stuck
> > 
> > Iam not sure why a out of diskspace resulted in the entry to disappear 
> > entirely
> > off fate.ffmpeg.org. But that is something that probably should be looked 
> > into and fixed too as it makes it very easy to miss that a box is broken
> 

> Entries disappear after an specific amount of days without sending a new
> report,

It would be useful if the developer running the client would get a mail at 
some point ... something like "your fate client foobar broke"


> so the only thing i can think could have happened is that the
> runs on those boxes errored out at a point before they could even
> attempt to send a report back to fate, or failed while trying to do it.
> 
> > 
> > thx
> > 
> > [...]
> > 
> > 
> > ___
> > 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".

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

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



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

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