[vlc-devel] [PATCH 1/2] Anti-flicker filter initial version

Laurent Aimar fenrir at elivagar.org
Sun May 8 21:21:30 CEST 2011


Hi,

On Mon, May 09, 2011 at 12:37:17AM +0530, dharani prabhu wrote:
> Attached the changes ...
> +    /******* Temporal softening phase. Adapted from code by Steven Don ******/ 
> +    uint8_t *src1, *src2;
> +    int ofs = (i_num_lines * i_out_pitch + i_num_cols);
> +    int pitch = i_out_pitch;
> +    src1 = p_outpic->p[Y_PLANE].p_pixels;
> +    src2 = p_filter->p_sys->p_old_data;
> +
> +    do
> +    {
> +        int diff = abs(*src1 - *src2);
> +        if (diff < i_softening)
> +        {
> +            if (diff > (i_softening >> 1))
> +            {
> +                *src2 = (*src1 + *src1 + *src2 )/ 3;
> +            }
> +        }
> +        else
> +        {
> +            *src2 = *src1;
> +        }
> +        *src1 = *src2;
> +        src1++; src2++;
> +        if( --pitch == 0 )
> +        {
> +          src2 += (p_filter->fmt_in.video.i_width - i_out_pitch );
> +          pitch = i_out_pitch;
> +        }
> +    } while (--ofs);
This cannot work, as p_filter->fmt_in.video.i_width will usually be lower than i_out_pitch.
Why not simply doing a double loops like:
for( int i_line = 0 ; i_line < i_num_lines ; i_line++ )
{
    for( int i_col = 0; i_col < i_num_cols  ; i_col++ )
    {
    }
}
as you did in your code (a bit above)?

-- 
fenrir




More information about the vlc-devel mailing list