static void copy_picture_field(InterlaceContext *s,

                               AVFrame *src_frame, AVFrame *dst_frame,

                               AVFilterLink *inlink, enum FieldType field_type,

                               int lowpass)

{

    const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(inlink->format);

    int hsub = desc->log2_chroma_w;

    int vsub = desc->log2_chroma_h;

    int plane, j;



    for (plane = 0; plane < desc->nb_components; plane++) {

        int cols  = (plane == 1 || plane == 2) ? -(-inlink->w) >> hsub : inlink->w;

        int lines = (plane == 1 || plane == 2) ? -(-inlink->h) >> vsub : inlink->h;

        uint8_t *dstp = dst_frame->data[plane];

        const uint8_t *srcp = src_frame->data[plane];



        av_assert0(cols >= 0 || lines >= 0);



        lines = (lines + (field_type == FIELD_UPPER)) / 2;

        if (field_type == FIELD_LOWER)

            srcp += src_frame->linesize[plane];

        if (field_type == FIELD_LOWER)

            dstp += dst_frame->linesize[plane];

        if (lowpass) {

            int srcp_linesize = src_frame->linesize[plane] * 2;

            int dstp_linesize = dst_frame->linesize[plane] * 2;

            for (j = lines; j > 0; j--) {

                const uint8_t *srcp_above = srcp - src_frame->linesize[plane];

                const uint8_t *srcp_below = srcp + src_frame->linesize[plane];

                if (j == lines)

                    srcp_above = srcp; // there is no line above

                if (j == 1)

                    srcp_below = srcp; // there is no line below

                s->lowpass_line(dstp, cols, srcp, srcp_above, srcp_below);

                dstp += dstp_linesize;

                srcp += srcp_linesize;

            }

        } else {

            av_image_copy_plane(dstp, dst_frame->linesize[plane] * 2,

                                srcp, src_frame->linesize[plane] * 2,

                                cols, lines);

        }

    }

}

static void copy_picture_field(InterlaceContext *s,

                               AVFrame *src_frame, AVFrame *dst_frame,

                               AVFilterLink *inlink, enum FieldType field_type,

                               int lowpass)

{

    const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(inlink->format);

    int hsub = desc->log2_chroma_w;

    int vsub = desc->log2_chroma_h;

    int plane, j;



    for (plane = 0; plane < desc->nb_components; plane++) {

        int cols  = (plane == 1 || plane == 2) ? -(-inlink->w) >> hsub : inlink->w;

        int lines = (plane == 1 || plane == 2) ? -(-inlink->h) >> vsub : inlink->h;

        uint8_t *dstp = dst_frame->data[plane];

        const uint8_t *srcp = src_frame->data[plane];



        av_assert0(cols >= 0 || lines >= 0);



        lines = (lines + (field_type == FIELD_UPPER)) / 2;

        if (field_type == FIELD_LOWER)

            srcp += src_frame->linesize[plane];

        if (field_type == FIELD_LOWER)

            dstp += dst_frame->linesize[plane];

        if (lowpass) {

            int srcp_linesize = src_frame->linesize[plane] * 2;

            int dstp_linesize = dst_frame->linesize[plane] * 2;

            for (j = lines; j > 0; j--) {

                const uint8_t *srcp_above = srcp - src_frame->linesize[plane];

                const uint8_t *srcp_below = srcp + src_frame->linesize[plane];

                if (j == lines)

                    srcp_above = srcp; 

                if (j == 1)

                    srcp_below = srcp; 

                s->lowpass_line(dstp, cols, srcp, srcp_above, srcp_below);

                dstp += dstp_linesize;

                srcp += srcp_linesize;

            }

        } else {

            av_image_copy_plane(dstp, dst_frame->linesize[plane] * 2,

                                srcp, src_frame->linesize[plane] * 2,

                                cols, lines);

        }

    }

}

static void FUNC_0(InterlaceContext *VAR_0,

                               AVFrame *VAR_1, AVFrame *VAR_2,

                               AVFilterLink *VAR_3, enum FieldType VAR_4,

                               int VAR_5)

{

    const AVPixFmtDescriptor *VAR_6 = av_pix_fmt_desc_get(VAR_3->format);

    int VAR_7 = VAR_6->log2_chroma_w;

    int VAR_8 = VAR_6->log2_chroma_h;

    int VAR_9, VAR_10;



    for (VAR_9 = 0; VAR_9 < VAR_6->nb_components; VAR_9++) {

        int cols  = (VAR_9 == 1 || VAR_9 == 2) ? -(-VAR_3->w) >> VAR_7 : VAR_3->w;

        int lines = (VAR_9 == 1 || VAR_9 == 2) ? -(-VAR_3->h) >> VAR_8 : VAR_3->h;

        uint8_t *dstp = VAR_2->data[VAR_9];

        const uint8_t *srcp = VAR_1->data[VAR_9];



        av_assert0(cols >= 0 || lines >= 0);



        lines = (lines + (VAR_4 == FIELD_UPPER)) / 2;

        if (VAR_4 == FIELD_LOWER)

            srcp += VAR_1->linesize[VAR_9];

        if (VAR_4 == FIELD_LOWER)

            dstp += VAR_2->linesize[VAR_9];

        if (VAR_5) {

            int srcp_linesize = VAR_1->linesize[VAR_9] * 2;

            int dstp_linesize = VAR_2->linesize[VAR_9] * 2;

            for (VAR_10 = lines; VAR_10 > 0; VAR_10--) {

                const uint8_t *srcp_above = srcp - VAR_1->linesize[VAR_9];

                const uint8_t *srcp_below = srcp + VAR_1->linesize[VAR_9];

                if (VAR_10 == lines)

                    srcp_above = srcp; 

                if (VAR_10 == 1)

                    srcp_below = srcp; 

                VAR_0->lowpass_line(dstp, cols, srcp, srcp_above, srcp_below);

                dstp += dstp_linesize;

                srcp += srcp_linesize;

            }

        } else {

            av_image_copy_plane(dstp, VAR_2->linesize[VAR_9] * 2,

                                srcp, VAR_1->linesize[VAR_9] * 2,

                                cols, lines);

        }

    }

}

static void FUNC_0(InterlaceContext *VAR_0,
AVFrame *VAR_1, AVFrame *VAR_2,
AVFilterLink *VAR_3, enum FieldType VAR_4,
int VAR_5)
{ const AVPixFmtDescriptor *VAR_6 = av_pix_fmt_desc_get(VAR_3->format); int VAR_7 = VAR_6->log2_chroma_w; int VAR_8 = VAR_6->log2_chroma_h; int VAR_9, VAR_10; for (VAR_9 = 0; VAR_9 < VAR_6->nb_components; VAR_9++) { int cols  = (VAR_9 == 1 || VAR_9 == 2) ? -(-VAR_3->w) >> VAR_7 : VAR_3->w; int lines = (VAR_9 == 1 || VAR_9 == 2) ? -(-VAR_3->h) >> VAR_8 : VAR_3->h; uint8_t *dstp = VAR_2->data[VAR_9]; const uint8_t *srcp = VAR_1->data[VAR_9]; av_assert0(cols >= 0 || lines >= 0); lines = (lines + (VAR_4 == FIELD_UPPER)) / 2; if (VAR_4 == FIELD_LOWER)
srcp += VAR_1->linesize[VAR_9]; if (VAR_4 == FIELD_LOWER)
dstp += VAR_2->linesize[VAR_9]; if (VAR_5) { int srcp_linesize = VAR_1->linesize[VAR_9] * 2; int dstp_linesize = VAR_2->linesize[VAR_9] * 2; for (VAR_10 = lines; VAR_10 > 0; VAR_10--) { const uint8_t *srcp_above = srcp - VAR_1->linesize[VAR_9]; const uint8_t *srcp_below = srcp + VAR_1->linesize[VAR_9]; if (VAR_10 == lines)
srcp_above = srcp; if (VAR_10 == 1)
srcp_below = srcp; VAR_0->lowpass_line(dstp, cols, srcp, srcp_above, srcp_below); dstp += dstp_linesize; srcp += srcp_linesize; } } else { av_image_copy_plane(dstp, VAR_2->linesize[VAR_9] * 2,
srcp, VAR_1->linesize[VAR_9] * 2,
cols, lines); } } }