Re: [FFmpeg-devel] [PATCH 2/2] avcodec/zmbv: Check that the raw input is large enough to contain MVs or an intra frame
On 9/16/18, Michael Niedermayer wrote: > Fixes: Timeout > Fixes: > 10182/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ZMBV_fuzzer-6245951174344704 > > Found-by: continuous fuzzing process > https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg > Signed-off-by: Michael Niedermayer > --- > libavcodec/zmbv.c | 11 ++- > 1 file changed, 10 insertions(+), 1 deletion(-) > > diff --git a/libavcodec/zmbv.c b/libavcodec/zmbv.c > index 9e27a2caad..1133bdf7ba 100644 > --- a/libavcodec/zmbv.c > +++ b/libavcodec/zmbv.c > @@ -409,6 +409,7 @@ static int decode_frame(AVCodecContext *avctx, void > *data, int *got_frame, AVPac > int zret = Z_OK; // Zlib return code > int len = buf_size; > int hi_ver, lo_ver, ret; > +int min_size; > > /* parse header */ > if (len < 1) > @@ -510,7 +511,11 @@ static int decode_frame(AVCodecContext *avctx, void > *data, int *got_frame, AVPac > memset(c->prev, 0, avctx->width * avctx->height * (c->bpp / 8)); > c->decode_intra= decode_intra; > } > - > +if (c->flags & ZMBV_KEYFRAME) { > +min_size = avctx->width * avctx->height * (c->bpp / 8); This is pure guessing? > +} else { > +min_size = (c->bx * c->by * 2 + 3) & ~3; > +} > if (!c->decode_intra) { > av_log(avctx, AV_LOG_ERROR, "Error! Got no format or no > keyframe!\n"); > return AVERROR_INVALIDDATA; > @@ -524,6 +529,10 @@ static int decode_frame(AVCodecContext *avctx, void > *data, int *got_frame, AVPac > av_log(avctx, AV_LOG_ERROR, "Buffer too small\n"); > return AVERROR_INVALIDDATA; > } > +if (min_size > len) { > +av_log(avctx, AV_LOG_ERROR, "input too small\n"); > +return AVERROR_INVALIDDATA; > +} > memcpy(c->decomp_buf, buf, len); > } else { // ZLIB-compressed data > c->zstream.total_in = c->zstream.total_out = 0; > -- > 2.18.0 > > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel > ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avfilter: add crossover filter
On 5/31/18, Paul B Mahol wrote: > Signed-off-by: Paul B Mahol > --- > doc/filters.texi | 17 +++ > libavfilter/Makefile | 1 + > libavfilter/af_crossover.c | 343 > + > libavfilter/allfilters.c | 1 + > 4 files changed, 362 insertions(+) > create mode 100644 libavfilter/af_crossover.c > Will apply. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] http connect: retry five times before reporting about error
Signed-off-by: Artjom Vejsel --- Hello. I've faced an error while playing when downloading just stopped. It can be even few times at one film. After digging into source I've finished with knowledge that HTTP connection made only once and if it was not successfull, HTTP interface just report with an error. I tried to change this behaviour to try few times and that solve my problem. libavformat/http.c | 14 +++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/libavformat/http.c b/libavformat/http.c index 4fdb2f13f2..9afa885423 100644 --- a/libavformat/http.c +++ b/libavformat/http.c @@ -259,11 +259,19 @@ redo: cur_auth_type = s->auth_state.auth_type; cur_proxy_auth_type = s->auth_state.auth_type; +attempts++; + location_changed = http_open_cnx_internal(h, options); -if (location_changed < 0) -goto fail; +if (location_changed < 0) { +if (attempts < 5) { +av_log(h, AV_LOG_ERROR, "Couldn't get HTTP resource, retrying...\n"); +if (s->hd) +ffurl_closep(&s->hd); +goto redo; +} else +goto fail; +} -attempts++; if (s->http_code == 401) { if ((cur_auth_type == HTTP_AUTH_NONE || s->auth_state.stale) && s->auth_state.auth_type != HTTP_AUTH_NONE && attempts < 4) { -- 2.18.0 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] http connect: retry five times before reporting about error
2018-09-16 17:41 GMT+02:00, Artjom Vejsel : > Signed-off-by: Artjom Vejsel > --- > > Hello. > > I've faced an error while playing when downloading just stopped. It can be > even few times at one film. > After digging into source I've finished with knowledge that HTTP connection > made only once and if it was not successfull, HTTP interface just report > with an error. > I tried to change this behaviour to try few times and that solve my problem. > > libavformat/http.c | 14 +++--- > 1 file changed, 11 insertions(+), 3 deletions(-) > > diff --git a/libavformat/http.c b/libavformat/http.c > index 4fdb2f13f2..9afa885423 100644 > --- a/libavformat/http.c > +++ b/libavformat/http.c > @@ -259,11 +259,19 @@ redo: > cur_auth_type = s->auth_state.auth_type; > cur_proxy_auth_type = s->auth_state.auth_type; > > +attempts++; Maybe this is just me but I believe the code gets clearer if you move this into the if() below. > + > location_changed = http_open_cnx_internal(h, options); > -if (location_changed < 0) > -goto fail; > +if (location_changed < 0) { > +if (attempts < 5) { > +av_log(h, AV_LOG_ERROR, "Couldn't get HTTP resource, > retrying...\n"); Should be a warning imo. > +if (s->hd) > +ffurl_closep(&s->hd); > +goto redo; > +} else > +goto fail; > +} > > -attempts++; Carl Eugen ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] h264 ,miss header
2018-09-15 18:56 GMT+02:00, wenbo : > 264 ,miss header > > > use cmd : ffplay 18_264297_1.264 > > > data file link : > http://lsjixie.oss-cn-shanghai.aliyuncs.com/18_264297_1.264 Is there software that decodes this sample? Carl Eugen ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] libavfilter: Removes stored DNN models. Adds support for native backend model file format in tf backend. Removes scaling and conversion with libswscale and replaces input fo
On 9/10/18, Pedro Arthur wrote: > 2018-09-06 8:44 GMT-03:00 Sergey Lavrushkin : > >> Here is the patch with reverted changes on sws removal. I didn't split the >> patch into two patches, because code, that supports native model file >> format in >> tf, is partially from code of default model construction, which is removed >> with default >> models and stored data. >> > Ok. > > > > The scale_factor option is not necessary, it should be stored in the model > file. As the weights are trained for a specific factor, using anything > different from that will give bad results. > It seems the native depth to space conversion is buggy a few lines in the > top of output image are duplicated, tf backend is ok. BTW this bug was not > introduced by this patch. > > Other than that LGTM, the above fixes can be done in separated patches. > I may push it by Friday. When this will be pushed? ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 1/2] avcodec/libaomenc: support setting chroma sample location
Signed-off-by: James Almer --- libavcodec/libaomenc.c | 18 ++ 1 file changed, 18 insertions(+) diff --git a/libavcodec/libaomenc.c b/libavcodec/libaomenc.c index 6a79d9b873..55d50ded28 100644 --- a/libavcodec/libaomenc.c +++ b/libavcodec/libaomenc.c @@ -76,6 +76,7 @@ static const char *const ctlidstr[] = { [AOME_SET_ENABLEAUTOALTREF] = "AOME_SET_ENABLEAUTOALTREF", [AOME_SET_STATIC_THRESHOLD] = "AOME_SET_STATIC_THRESHOLD", [AV1E_SET_COLOR_RANGE] = "AV1E_SET_COLOR_RANGE", +[AV1E_SET_CHROMA_SAMPLE_POSITION] = "AV1E_SET_CHROMA_SAMPLE_POSITION", [AV1E_SET_COLOR_PRIMARIES] = "AV1E_SET_COLOR_PRIMARIES", [AV1E_SET_MATRIX_COEFFICIENTS] = "AV1E_SET_MATRIX_COEFFICIENTS", [AV1E_SET_TRANSFER_CHARACTERISTICS] = "AV1E_SET_TRANSFER_CHARACTERISTICS", @@ -284,6 +285,22 @@ static void set_color_range(AVCodecContext *avctx) codecctl_int(avctx, AV1E_SET_COLOR_RANGE, aom_cr); } +static void set_chroma_location(AVCodecContext *avctx) +{ +enum aom_chroma_sample_position aom_cps; +switch (avctx->chroma_sample_location) { +case AVCHROMA_LOC_UNSPECIFIED: aom_cps = AOM_CSP_UNKNOWN; break; +case AVCHROMA_LOC_LEFT:aom_cps = AOM_CSP_VERTICAL; break; +case AVCHROMA_LOC_TOPLEFT: aom_cps = AOM_CSP_COLOCATED; break; +default: +av_log(avctx, AV_LOG_WARNING, "Unsupported chroma sample location (%d)\n", + avctx->chroma_sample_location); +return; +} + +codecctl_int(avctx, AV1E_SET_CHROMA_SAMPLE_POSITION, aom_cps); +} + static av_cold int aom_init(AVCodecContext *avctx, const struct aom_codec_iface *iface) { @@ -452,6 +469,7 @@ static av_cold int aom_init(AVCodecContext *avctx, codecctl_int(avctx, AV1E_SET_COLOR_PRIMARIES, avctx->color_primaries); codecctl_int(avctx, AV1E_SET_MATRIX_COEFFICIENTS, avctx->colorspace); codecctl_int(avctx, AV1E_SET_TRANSFER_CHARACTERISTICS, avctx->color_trc); +set_chroma_location(avctx); set_color_range(avctx); // provide dummy value to initialize wrapper, values will be updated each _encode() -- 2.19.0 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 2/2] avcodec/libaomdec: export chroma sample location
Signed-off-by: James Almer --- libavcodec/libaomdec.c | 4 1 file changed, 4 insertions(+) diff --git a/libavcodec/libaomdec.c b/libavcodec/libaomdec.c index 2530c9f76b..a21cace164 100644 --- a/libavcodec/libaomdec.c +++ b/libavcodec/libaomdec.c @@ -89,7 +89,11 @@ static int set_pix_fmt(AVCodecContext *avctx, struct aom_image *img) static const enum AVColorRange color_ranges[] = { AVCOL_RANGE_MPEG, AVCOL_RANGE_JPEG }; +static const enum AVColorRange chroma_locations[] = { +AVCHROMA_LOC_UNSPECIFIED, AVCHROMA_LOC_LEFT, AVCHROMA_LOC_TOPLEFT, AVCHROMA_LOC_UNSPECIFIED +}; avctx->color_range = color_ranges[img->range]; +avctx->chroma_sample_location = chroma_locations[img->csp]; avctx->color_primaries = img->cp; avctx->colorspace = img->mc; avctx->color_trc = img->tc; -- 2.19.0 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] libavfilter: Removes stored DNN models. Adds support for native backend model file format in tf backend. Removes scaling and conversion with libswscale and replaces input fo
2018-09-16 15:20 GMT-03:00 Paul B Mahol : > > When this will be pushed? > Yes, I did not had time to push it friday. I'll do it monday or you could push it if you don't mind. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] swscale : add bitexact conv for grayf32 and gray16 to f32 conv
> you can just use something like (possibly with more or less 0 or a > magnitude > related value) > #define assert_stable_int(x) av_assert(llrintf(x+0.0001) == > llrintf(x-0.0001)) > #define assert_stable_float(x) av_assert((float)(x+0.0001) == > (float)(x-0.0001)) > > and then place this where rounding happens, then you can see easily if > any test gets close to problematic values. No need for special HW > > Hello, Do you mean something like that ? (which raise the assert for 8b and 16 bits) #define assert_stable_float(x) av_assert0((float)(x+0.0001) == (float)(x-0.0001)) static void inline fill_uint_to_float_lut(SwsContext *c, int bitdepth) { static const double float_mult8 = 1.0 / 255.0; static const double float_mult16 = 1.0 / 65535.0; int i; double tmp; if (bitdepth == 8) { /*! fill uint8 to float lut */ for (i = 0; i < 256; ++i){ tmp = (double) i * float_mult8; assert_stable_float(tmp); c->uint2float_lut[i] = (float)tmp; } } else if (bitdepth == 16) { /*! fill uint16 to float lut */ for (i = 0; i < 65536; ++i){ tmp = (double) i * float_mult16; assert_stable_float(tmp); c->uint2float_lut[i] = (float)tmp; } } else { /*! unsupported bitdepth */ av_assert0(0); } } Martin ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] swscale : add bitexact conv for grayf32 and gray16 to f32 conv
On Sun, Sep 16, 2018 at 09:25:14PM +0200, Martin Vignali wrote: > > you can just use something like (possibly with more or less 0 or a > > magnitude > > related value) > > #define assert_stable_int(x) av_assert(llrintf(x+0.0001) == > > llrintf(x-0.0001)) > > #define assert_stable_float(x) av_assert((float)(x+0.0001) == > > (float)(x-0.0001)) > > > > and then place this where rounding happens, then you can see easily if > > any test gets close to problematic values. No need for special HW > > > > Hello, > > Do you mean something like that ? (which raise the assert for 8b and 16 > bits) > > #define assert_stable_float(x) > av_assert0((float)(x+0.0001) == > (float)(x-0.0001)) > > static void inline fill_uint_to_float_lut(SwsContext *c, int bitdepth) { > static const double float_mult8 = 1.0 / 255.0; > static const double float_mult16 = 1.0 / 65535.0; > int i; > double tmp; > > if (bitdepth == 8) { /*! fill uint8 to float lut */ > for (i = 0; i < 256; ++i){ > tmp = (double) i * float_mult8; > assert_stable_float(tmp); > c->uint2float_lut[i] = (float)tmp; > } > } else if (bitdepth == 16) { /*! fill uint16 to float lut */ > for (i = 0; i < 65536; ++i){ > tmp = (double) i * float_mult16; > assert_stable_float(tmp); > c->uint2float_lut[i] = (float)tmp; > } > } else { /*! unsupported bitdepth */ > av_assert0(0); > } > } yes, for which values exactly does it fail ? also, have you tried adding a small constant to tmp ? i would expect that this or a similar operation would allow moving away from all "unstable" points without really changing the output in a relevant way. thanks [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Many things microsoft did are stupid, but not doing something just because microsoft did it is even more stupid. If everything ms did were stupid they would be bankrupt already. signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 2/2] avcodec/zmbv: Check that the raw input is large enough to contain MVs or an intra frame
On Sun, Sep 16, 2018 at 10:16:05AM +0200, Paul B Mahol wrote: > On 9/16/18, Michael Niedermayer wrote: > > Fixes: Timeout > > Fixes: > > 10182/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ZMBV_fuzzer-6245951174344704 > > > > Found-by: continuous fuzzing process > > https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg > > Signed-off-by: Michael Niedermayer > > --- > > libavcodec/zmbv.c | 11 ++- > > 1 file changed, 10 insertions(+), 1 deletion(-) > > > > diff --git a/libavcodec/zmbv.c b/libavcodec/zmbv.c > > index 9e27a2caad..1133bdf7ba 100644 > > --- a/libavcodec/zmbv.c > > +++ b/libavcodec/zmbv.c > > @@ -409,6 +409,7 @@ static int decode_frame(AVCodecContext *avctx, void > > *data, int *got_frame, AVPac > > int zret = Z_OK; // Zlib return code > > int len = buf_size; > > int hi_ver, lo_ver, ret; > > +int min_size; > > > > /* parse header */ > > if (len < 1) > > @@ -510,7 +511,11 @@ static int decode_frame(AVCodecContext *avctx, void > > *data, int *got_frame, AVPac > > memset(c->prev, 0, avctx->width * avctx->height * (c->bpp / 8)); > > c->decode_intra= decode_intra; > > } > > - > > +if (c->flags & ZMBV_KEYFRAME) { > > +min_size = avctx->width * avctx->height * (c->bpp / 8); > > This is pure guessing? theres a bit of logic behind it but ultimatly yes, its guessing The logic If the input is smaller for a raw keyframe the buffer would not be fully updated. If the buffer is not fully updated then this should be a inter frame not a keyframe. The 2nd part, is that all files i found (http://samples.mplayerhq.hu/V-codecs/ZMBV/) follow that assumtation The 3rd is that the source code for zmbv i could fine (dosbox) seems to never write uncompressed keyframes. The 4th is that the multimedia wiki doesnt seem to say anything about the uncompressed keyframe size so i thought its better to use this as the minimal size and avoid the issue the fuzzer found. Its quite possible that i have missed something. Also we could ask for a sample in the failure case or do something else if you have some other suggestion ? [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB If a bugfix only changes things apparently unrelated to the bug with no further explanation, that is a good sign that the bugfix is wrong. signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avfilter/vf_sr: fix read out of bounds
Ping for review. On 2018年09月13日 15:58, Zhao Zhili wrote: --- libavfilter/vf_sr.c | 9 ++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/libavfilter/vf_sr.c b/libavfilter/vf_sr.c index 5ad1baa..bc9d186 100644 --- a/libavfilter/vf_sr.c +++ b/libavfilter/vf_sr.c @@ -239,7 +239,8 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) 0, sr_context->sws_slice_h, out->data, out->linesize); sws_scale(sr_context->sws_contexts[1], (const uint8_t **)out->data, out->linesize, - 0, out->height, (uint8_t * const*)(&sr_context->input.data), &sr_context->sws_input_linesize); + 0, out->height, (uint8_t * const*)(&sr_context->input.data), + (const int [4]){sr_context->sws_input_linesize, 0, 0, 0}); break; case ESPCN: if (sr_context->sws_contexts[0]){ @@ -250,7 +251,8 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) } sws_scale(sr_context->sws_contexts[1], (const uint8_t **)in->data, in->linesize, - 0, in->height, (uint8_t * const*)(&sr_context->input.data), &sr_context->sws_input_linesize); + 0, in->height, (uint8_t * const*)(&sr_context->input.data), + (const int [4]){sr_context->sws_input_linesize, 0, 0, 0}); } av_frame_free(&in); @@ -260,7 +262,8 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) return AVERROR(EIO); } -sws_scale(sr_context->sws_contexts[2], (const uint8_t **)(&sr_context->output.data), &sr_context->sws_output_linesize, +sws_scale(sr_context->sws_contexts[2], (const uint8_t **)(&sr_context->output.data), + (const int [4]){sr_context->sws_output_linesize, 0, 0, 0}, 0, out->height, (uint8_t * const*)out->data, out->linesize); return ff_filter_frame(outlink, out); ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 3/5] Renamed reinterlace to tinterlace
Hello, Thank you Thomas for the reviews and support! The proposed actions, by Nicolas George in https://ffmpeg.org/pipermail/ffmpeg-devel/2017-December/223072.html, were taken. >* Can one simply change the tinterlace from GPL to LGPL? * Of course not. There are two non-simple courses of action to achieve it: - Get the approval of all copyright holders. It has been done in the past for other filters. - Remove the GPL tinterlace and at the same time add a new LGPL filter that does the same thing and is also called tinterlace. Only two contributors approved until now, Thomas Mundt and Stefano Sebatini, while Baptiste Coudurier and Michael Zucchi could not be reached. Also, the new implementation supports all the features from the old tinterlace and conditionally (at compile time) the same ASM optimizations are used, but only if CONFIG_GPL is defined. Is there any way we can proceed with this patch? Best regards. On Fri, Aug 17, 2018 at 5:24 PM, Thomas Mundt wrote: > Hi, > > 2018-08-16 13:56 GMT+02:00 Vasile Toncu : > > > Hi, > > > > Thank you for the additional testing effort. > > Fixed the issue. > > > > > thanks, the patch looks good to me as far as I can judge. > It´s up to more experienced developers now to permit the license change. > Can anybody please have a look at this. > > Regards, > Thomas > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel > ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel