diff mbox series

[FFmpeg-devel,1/2] Revert avfilter/vf_minterpolate: if metadata lavfi.scd.mafd exists, we'll use it first

Message ID 20200514210349.12825-1-cus@passwd.hu
State Accepted
Commit 7f3a9462161aa5ad6cb498cc3a191960e4e77f51
Headers show
Series [FFmpeg-devel,1/2] Revert "avfilter/vf_minterpolate: if metadata lavfi.scd.mafd exists, we'll use it first" | expand

Checks

Context Check Description
andriy/default pending
andriy/make success Make finished
andriy/make_fate success Make fate finished

Commit Message

Marton Balint May 14, 2020, 9:03 p.m. UTC
This reverts commit d88e1c9838dbcfe29d7835f2705ffc9ee6a36bf3.

Fixes null pointer dereference.

Signed-off-by: Marton Balint <cus@passwd.hu>
---
 libavfilter/vf_minterpolate.c | 16 ++++------------
 1 file changed, 4 insertions(+), 12 deletions(-)

Comments

Paul B Mahol May 15, 2020, 4:42 p.m. UTC | #1
Why was this applied without review?

Please revert ASAP!

On 5/14/20, Marton Balint <cus@passwd.hu> wrote:
> This reverts commit d88e1c9838dbcfe29d7835f2705ffc9ee6a36bf3.
>
> Fixes null pointer dereference.
>
> Signed-off-by: Marton Balint <cus@passwd.hu>
> ---
>  libavfilter/vf_minterpolate.c | 16 ++++------------
>  1 file changed, 4 insertions(+), 12 deletions(-)
>
> diff --git a/libavfilter/vf_minterpolate.c b/libavfilter/vf_minterpolate.c
> index ef47140946..c9ce80420d 100644
> --- a/libavfilter/vf_minterpolate.c
> +++ b/libavfilter/vf_minterpolate.c
> @@ -834,19 +834,11 @@ static int detect_scene_change(MIContext *mi_ctx)
>      ptrdiff_t linesize2 = mi_ctx->frames[2].avf->linesize[0];
>
>      if (mi_ctx->scd_method == SCD_METHOD_FDIFF) {
> -        double ret = 0, mafd = HUGE_VAL, diff;
> +        double ret = 0, mafd, diff;
>          uint64_t sad;
> -        AVDictionaryEntry *e_mafd = NULL;
> -        char *tail = NULL;
> -
> -        e_mafd = av_dict_get(mi_ctx->frames[2].avf->metadata,
> "lavfi.scd.mafd", NULL, AV_DICT_MATCH_CASE);
> -        if (e_mafd)
> -            mafd = strtod(e_mafd->value, &tail);
> -        if (*tail || mafd == HUGE_VAL) {
> -            mi_ctx->sad(p1, linesize1, p2, linesize2, me_ctx->width,
> me_ctx->height, &sad);
> -            emms_c();
> -            mafd = (double) sad * 100.0 / (me_ctx->height * me_ctx->width)
> / (1 << mi_ctx->bitdepth);
> -        }
> +        mi_ctx->sad(p1, linesize1, p2, linesize2, me_ctx->width,
> me_ctx->height, &sad);
> +        emms_c();
> +        mafd = (double) sad * 100.0 / (me_ctx->height * me_ctx->width) / (1
> << mi_ctx->bitdepth);
>          diff = fabs(mafd - mi_ctx->prev_mafd);
>          ret  = av_clipf(FFMIN(mafd, diff), 0, 100.0);
>          mi_ctx->prev_mafd = mafd;
> --
> 2.16.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-request@ffmpeg.org with subject "unsubscribe".
diff mbox series

Patch

diff --git a/libavfilter/vf_minterpolate.c b/libavfilter/vf_minterpolate.c
index ef47140946..c9ce80420d 100644
--- a/libavfilter/vf_minterpolate.c
+++ b/libavfilter/vf_minterpolate.c
@@ -834,19 +834,11 @@  static int detect_scene_change(MIContext *mi_ctx)
     ptrdiff_t linesize2 = mi_ctx->frames[2].avf->linesize[0];
 
     if (mi_ctx->scd_method == SCD_METHOD_FDIFF) {
-        double ret = 0, mafd = HUGE_VAL, diff;
+        double ret = 0, mafd, diff;
         uint64_t sad;
-        AVDictionaryEntry *e_mafd = NULL;
-        char *tail = NULL;
-
-        e_mafd = av_dict_get(mi_ctx->frames[2].avf->metadata, "lavfi.scd.mafd", NULL, AV_DICT_MATCH_CASE);
-        if (e_mafd)
-            mafd = strtod(e_mafd->value, &tail);
-        if (*tail || mafd == HUGE_VAL) {
-            mi_ctx->sad(p1, linesize1, p2, linesize2, me_ctx->width, me_ctx->height, &sad);
-            emms_c();
-            mafd = (double) sad * 100.0 / (me_ctx->height * me_ctx->width) / (1 << mi_ctx->bitdepth);
-        }
+        mi_ctx->sad(p1, linesize1, p2, linesize2, me_ctx->width, me_ctx->height, &sad);
+        emms_c();
+        mafd = (double) sad * 100.0 / (me_ctx->height * me_ctx->width) / (1 << mi_ctx->bitdepth);
         diff = fabs(mafd - mi_ctx->prev_mafd);
         ret  = av_clipf(FFMIN(mafd, diff), 0, 100.0);
         mi_ctx->prev_mafd = mafd;