[FFmpeg-devel] [PATCH] Add vf_scale.c filter

Michael Niedermayer michaelni
Fri Feb 27 16:44:46 CET 2009


On Fri, Feb 27, 2009 at 12:56:08PM +0100, Stefano Sabatini wrote:
> Hi all, 
> as in subject.

first quick question
does
crop, expand and slices work? (a single pix_fmt working is enough)

i mean can i take a 320x200 movie crop a 100x100 area out scale
that to 200x200 and add a border to make 300x200 _without_ any
memcpy() ?
just a simple test to make sure no serious bugs are in there

second question are there any features mplayers vf_scale has that lavfi
does not?

also we need support for interlaced scaling though this is better done
through some generic wraper filter
that is a filter that as arguments has another filtername and its arguments
and that then creates 2 such filters and filters the odd and even
lines seperately with them


[...]

> +        char sws_flags[256];
> +        int i = 0;
> +        p = strchr(sws_opts, '=');
> +        p++;
> +        while (*p && *p != ':' && i < sizeof(sws_flags) - 1)
> +            sws_flags[i++] = *p++;
> +        sws_flags[i] = 0;

sscanf("sws_flags=%255[^:]")

[...]
> +    av_reduce(&out->outpic->pixel_aspect.num, &out->outpic->pixel_aspect.den,
> +               out->outpic->pixel_aspect.num,  out->outpic->pixel_aspect.den,
> +         FFMAX(out->outpic->pixel_aspect.num,  out->outpic->pixel_aspect.den));

you want to use av_gcd() here i think


> +
> +    avfilter_start_frame(out, avfilter_ref_pic(out->outpic, ~0));
> +
> +    scale->sliceY = 0;
> +}
> +
> +static void draw_slice(AVFilterLink *link, int y, int h)
> +{
> +    ScaleContext *scale = link->dst->priv;
> +    int outH;
> +    int vsub, hsub;
> +    uint8_t *data[4];
> +
> +    avcodec_get_chroma_sub_sample(link->format, &hsub, &vsub);
> +
> +    data[0] = link->cur_pic->data[0] + y * link->cur_pic->linesize[0];
> +    data[3] = link->cur_pic->data[3] + y * link->cur_pic->linesize[3];
> +
> +    if (link->cur_pic->data[2]) {
> +        data[1] = link->cur_pic->data[1] + (y>>vsub)*link->cur_pic->linesize[1];
> +        data[2] = link->cur_pic->data[2] + (y>>vsub)*link->cur_pic->linesize[2];
> +    } else {
> +        // Probably a paletted format
> +        data[1] = link->cur_pic->data[1];
> +        data[2] = link->cur_pic->data[2];
> +    }

looks like its missing some special case for a palette

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

He who knows, does not speak. He who speaks, does not know. -- Lao Tsu
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090227/c87513ef/attachment.pgp>



More information about the ffmpeg-devel mailing list