[FFmpeg-devel] [PATCH] [3/??] [1/1] Libavfilter - Sws_scale filter
Michael Niedermayer
michaelni
Sun Feb 17 03:08:33 CET 2008
On Sat, Feb 16, 2008 at 12:47:43PM +0100, Vitor Sessak wrote:
> Hi
>
> This filter is needed for the filter graph infrastructure to compile.
>
> -Vitor
[...]
> static int config_props(AVFilterLink *link)
> {
> ScaleContext *scale = link->src->priv;
> int w, h;
>
> if(scale->sws)
> sws_freeContext(scale->sws);
>
> w = scale->w;
> h = scale->h;
> if(!w) w = link->src->inputs[0]->w;
> if(!h) h = link->src->inputs[0]->h;
> if(w == -1) w = scale->h*link->src->inputs[0]->w/link->src->inputs[0]->h;
> if(h == -1) h = scale->w*link->src->inputs[0]->h/link->src->inputs[0]->w;
w/h should be set depending in the chroma plane resolution so for example
YUV420 should end with even width&height
Id also check that the final w/h are not negative, as above can
overflow.
[...]
> static void start_frame(AVFilterLink *link, AVFilterPicRef *picref)
> {
> AVFilterLink *out = link->dst->outputs[0];
>
> out->outpic = avfilter_get_video_buffer(out, AV_PERM_WRITE);
> out->outpic->pts = picref->pts;
>
> out->outpic->pixel_aspect.num = picref->pixel_aspect.num * out->h * link->w;
> out->outpic->pixel_aspect.den = picref->pixel_aspect.den * out->w * link->h;
> 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));
This doesnt make any sense, the FFMAX will cause this to do exactly nothing.
>
> avfilter_start_frame(out, avfilter_ref_pic(out->outpic, ~0));
> }
>
>
> /* TODO: figure out the swscale API well enough to scale slice at a time */
Where is the problem with slices? I think they should be implemented soon
as they would help detecting slice related bugs in the filter system early.
Though that can be after this is applied ...
> static void end_frame(AVFilterLink *link)
> {
> ScaleContext *scale = link->dst->priv;
>
> sws_scale(scale->sws, link->cur_pic->data, link->cur_pic->linesize, 0,
> link->cur_pic->h, link->dst->outputs[0]->outpic->data,
> link->dst->outputs[0]->outpic->linesize);
> avfilter_draw_slice(link->dst->outputs[0], 0, link->dst->outputs[0]->h);
> avfilter_end_frame(link->dst->outputs[0]);
>
> avfilter_unref_pic(link->cur_pic);
> avfilter_unref_pic(link->dst->outputs[0]->outpic);
> }
This misses handling of interlaced frames. That is
running sws_scale twice once on even and once on odd lines. Also i think a
top field first / bottom field first / progressive variable is missing in
the filter system.
Note, yes this needs 2 sws contexts.
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
If you really think that XML is the answer, then you definitly missunderstood
the question -- Attila Kinali
-------------- 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/20080217/cd2d7e6a/attachment.pgp>
More information about the ffmpeg-devel
mailing list