[FFmpeg-devel] [PATCH] lavc/cfhd: deinterlacing introduced in cfhd

Kieran Kunhya kieran618 at googlemail.com
Mon May 21 23:36:29 EEST 2018


Not really "deinterlacing", it would be "add interlaced file support" or
similar.


On Mon, 21 May 2018 at 20:17 Gagandeep Singh <deepgagan231197 at gmail.com>
wrote:

> +static inline void peak_table(int16_t *band, Peak *peak, int length)
> +{
> +    int i;
> +    for (i = 0; i < length; i++)
> +        if (abs(band[i]) > peak->level)
> +            band[i] = *(++peak->base);
>  }
>

Pretty sure you need to start from the first base entry, not the sencond
so, peak->base++;

 static inline void process_alpha(int16_t *alpha, int width)
> @@ -154,6 +194,26 @@ static inline void filter(int16_t *output, ptrdiff_t
> out_stride,
>      }
>  }
>
> +static inline void interlaced_vertical_filter(int16_t *output, int16_t
> *low, int16_t *high,
> +                         int width, int linesize, int plane)
> +{
> +    int i;
> +    int16_t even, odd;
> +    for (i = 0; i < width; i++) {
> +      even = (*low - *high)/2;
> +      odd  = (*low + *high)/2;
> +
> +      even = FFMIN(1023, even);
> +      even = FFMAX(0, even);
> +      odd  = FFMIN(1023, odd);
> +      odd  = FFMAX(0, odd);
>

av_clip functions to do this.


> +      output[i] = even;
> +      output[i + linesize] = odd;
> +      low++;
> +      high++;
> +    }
> +}
>

Probably need to validate you haven't overread buffer with peak detection.

Kieran


More information about the ffmpeg-devel mailing list