[FFmpeg-devel] [PATCH] Transpose filter

Michael Niedermayer michaelni
Tue Oct 12 02:28:09 CEST 2010


On Mon, Oct 11, 2010 at 03:25:54PM +0200, Stefano Sabatini wrote:
> On date Sunday 2010-10-10 12:03:11 +0200, Stefano Sabatini encoded:
> [...]
[...]
> +static void end_frame(AVFilterLink *inlink)
> +{
> +    TransContext *trans = inlink->dst->priv;
> +    AVFilterBufferRef *in  = inlink->cur_buf;
> +    AVFilterBufferRef *out = inlink->dst->outputs[0]->out_buf;
> +    AVFilterLink *outlink = inlink->dst->outputs[0];
> +    int i, j, plane;
> +
> +    for (plane = 0; plane < trans->nb_planes; plane++) {
> +        int hsub = plane == 1 || plane == 2 ? trans->hsub : 0;
> +        int vsub = plane == 1 || plane == 2 ? trans->vsub : 0;
> +        int pixstep = trans->pixsteps[plane];
> +        for (i = 0; i < out->video->h>>vsub; i++) {
> +            uint8_t *pout = out->data[plane] + i * out->linesize[plane];
> +            for (j = 0; j < out->video->w>>hsub; j++, pout += pixstep) {
> +                uint8_t *pin = in ->data[plane] + j * in ->linesize[plane] + i * pixstep;
> +                int32_t v;
> +
> +                switch (pixstep) {
> +                case 1:
> +                    *pout = *pin;
> +                    break;
> +                case 2:
> +                    *((uint16_t *)pout) = *((uint16_t *)pin);
> +                    break;
> +                case 3:
> +                    v = AV_RB24(pin);
> +                    AV_WB24(pout, v);
> +                    break;
> +                case 4:
> +                    *((uint32_t *)pout) = *((uint32_t *)pin);
> +                    break;
> +                }
> +            }

The filter in soc is much more efficient
also this code is generic enough to allow 90/180/270 degree rotations too
so that should be supported too

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

I hate to see young programmers poisoned by the kind of thinking
Ulrich Drepper puts forward since it is simply too narrow -- Roman Shaposhnik
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20101012/9a79698a/attachment.pgp>



More information about the ffmpeg-devel mailing list