[FFmpeg-devel] [PATCH] lavfi: port mcdeint filter from libmpcodecs

Stefano Sabatini stefasab at gmail.com
Sat Jun 1 22:39:40 CEST 2013


On date Friday 2013-05-31 18:47:32 +0200, Stefano Sabatini encoded:
> On date Thursday 2013-05-30 15:36:08 +0200, Stefano Sabatini encoded:
> [...]
> > Updated mcdeint patch. I tracked the inconsistent output to
> > uninitialiazed buffer reading which happens in the CHECK(j) macro:
> > 
> > #define CHECK(j)\
> >     {   int score = FFABS(srcp[-srcs-1+(j)] - srcp[+srcs-1-(j)]) +\
> >                     FFABS(srcp[-srcs  +(j)] - srcp[+srcs  -(j)]) +\
> >                     FFABS(srcp[-srcs+1+(j)] - srcp[+srcs+1-(j)]);\
> >         if (score < spatial_score) {\
> >             spatial_score = score;\
> >             diff0 = filp[-fils+(j)] - srcp[-srcs+(j)];\
> >             diff1 = filp[+fils-(j)] - srcp[+srcs-(j)];
> > 
> > which is reading padded data if x<2 && x>=w-2, and out-of-buffer data
> > in case x=2 and y=1 or x=w-3 and y=h-1.
> > 
> > A possible way to fix it would be to change:
> > -                    if((x-2)+(y-1)*w>=0 && (x+2)+(y+1)*w<w*h){ //FIXME either alloc larger images or optimize this
> > +                    if(y>0 && y<h-1 && x>2 && x<w-3){
> > 
> > but Michael suggested to adopt the same logic used in yadif. I suspend
> > my port of mcdeint until the problem is fixed in libmpcodecs.
> > 
> > Note: CHECK(j) macro restored to initial form for consistency with
> > yadif code.
> 
> Patch update mirroring the same fix in the mp/mcdeint patch. Now
> mcdeint and mp=mcdeint are bit-exact equivalent, and native mcdeint
> performs faster.
> 
> I'll push the port and drop the wrapper at the same time as the
> mcdeint fix is approved&committed.
> -- 
> FFmpeg = Freak & Fast Multipurpose Perfectionist Elected Gadget

> From 395dd7e43510d1c958b688b97372ecca854f45cb Mon Sep 17 00:00:00 2001
> From: Stefano Sabatini <stefasab at gmail.com>
> Date: Tue, 28 May 2013 13:40:39 +0200
> Subject: [PATCH] lavfi: port mcdeint filter from libmpcodecs
> 
> TODO: bump minor, update changelog
> ---
>  LICENSE                  |    1 +
>  configure                |    1 +
>  doc/filters.texi         |   44 +++++++
>  libavfilter/Makefile     |    2 +
>  libavfilter/allfilters.c |    1 +
>  libavfilter/vf_mcdeint.c |  313 ++++++++++++++++++++++++++++++++++++++++++++++
>  6 files changed, 362 insertions(+)
>  create mode 100644 libavfilter/vf_mcdeint.c

Pushed.
-- 
FFmpeg = Fabulous Fundamentalist MultiPurpose Ecletic Genius


More information about the ffmpeg-devel mailing list