[FFmpeg-devel] [PATCH 3/5] Renamed reinterlace to tinterlace

Thomas Mundt tmundt75 at gmail.com
Tue Aug 14 23:25:45 EEST 2018


Hi,

2018-08-14 18:53 GMT+02:00 Vasile Toncu <vasile.toncu at tremend.com>:

> Hi Thomas,
>
> I added the log messages.
>
> Thanks for the review.
>

I found some more time for testing this evening. Unfortunately there are
still issues.
I get half green pictures with some modes at high bit depth.
But the fix is easy.
The bytewidth in all av_image_copy_plane functions need to be adapted for
high bit depths.

{....}
>     const AVPixFmtDescriptor *fmt_desc = av_pix_fmt_desc_get(out->format);
>     int mult = (fmt_desc->comp[0].depth > 8 ? 2 : 1);
>

You used the calculated "mult" in the av_image_copy_plane functions of
MODE_MERGE and MODE_PAD only.
And forgot the others:


> {....}
>
+    case MODE_INTERLEAVE_BOTTOM:
> +    case MODE_INTERLEAVE_TOP:
> +        y = y * 2;
> +
> +        if (tinterlace->flags & FLAG_VLPF || tinterlace->flags &
> FLAG_CVLPF) {
> +            int clip_max = (1 << fmt_desc->comp[plane].depth) - 1;
> +
> +            interleave_filter_frame(tinterlace, first, out, plane,
> !!(tinterlace->flags & FLAG_CVLPF), tinterlace_mode == MODE_INTERLEAVE_TOP,
> x, y, clip_max);
> +            interleave_filter_frame(tinterlace, second, out, plane,
> !!(tinterlace->flags & FLAG_CVLPF), tinterlace_mode ==
> MODE_INTERLEAVE_BOTTOM, x, y, clip_max);
>          } else {
> -            if (tinterlace->csp->comp[plane].depth > 8)
> -                cols *= 2;
> -            av_image_copy_plane(dstp, dstp_linesize, srcp, srcp_linesize,
> cols, lines);
> +            offset1 = (tinterlace_mode == MODE_INTERLEAVE_TOP) ? 0 :
> out->linesize[plane];
> +            offset2 = (tinterlace_mode == MODE_INTERLEAVE_TOP) ? 0 :
> first->linesize[plane];
> +            offset3 = (tinterlace_mode == MODE_INTERLEAVE_TOP) ?
> out->linesize[plane]    : 0;
> +            offset4 = (tinterlace_mode == MODE_INTERLEAVE_TOP) ?
> second->linesize[plane] : 0;
> +
> +            av_image_copy_plane(out->data[plane] + offset1, 2 *
> out->linesize[plane],
> +                first->data[plane] + offset2, 2 * first->linesize[plane],
> +                first->width / x, first->height / y);
> +            av_image_copy_plane(out->data[plane] + offset3, 2 *
> out->linesize[plane],
> +                second->data[plane] + offset4, 2 *
> second->linesize[plane],
> +                second->width / x, second->height / y);
>

Here

         }
> +        break;
> +
> +    case MODE_INTERLACE_X2:
> +        y = y * 2;
> +
> +        offset1 = 0; offset2 = 0;
> +        offset3 = out->linesize[plane];
> +        offset4 = second->linesize[plane];
> +
> +        if (second->interlaced_frame && second->top_field_first) {
> +            offset1 = out->linesize[plane];
> +            offset2 = first->linesize[plane];
> +            offset3 = 0; offset4 = 0;
> +        }
> +
> +        av_image_copy_plane(out->data[plane] + offset1, 2 *
> out->linesize[plane],
> +            first->data[plane] + offset2, 2 * first->linesize[plane],
> +            first->width / x, first->height / y);
> +        av_image_copy_plane(out->data[plane] + offset3, 2 *
> out->linesize[plane],
> +            second->data[plane] + offset4, 2 * second->linesize[plane],
> +            second->width / x, second->height / y);
>

 Here

+        break;
> +
> +    case MODE_MERGE_X2:
> +        if (IS_ODD(tinterlace->current_frame_index - 1)) {
> +            av_image_copy_plane(out->data[plane], 2 *
> out->linesize[plane],
> +                second->data[plane], second->linesize[plane],
> second->width / x, second->height / y);
> +            av_image_copy_plane(out->data[plane] + out->linesize[plane],
> 2 * out->linesize[plane],
> +                first->data[plane], first->linesize[plane], first->width
> / x, first->height / y);
> +        } else {
> +            av_image_copy_plane(out->data[plane], 2 *
> out->linesize[plane],
> +                first->data[plane], first->linesize[plane], first->width
> / x, first->height / y);
> +            av_image_copy_plane(out->data[plane] + out->linesize[plane],
> 2 * out->linesize[plane],
> +                second->data[plane], second->linesize[plane],
> second->width / x, second->height / y);
>

Here.

Sorry for the piecemeal.

Regards,
Thomas


More information about the ffmpeg-devel mailing list