[FFmpeg-soc] expand filter (alternative to pad syntax)

Ryo Hirafuji psi at science.mi.to
Thu May 15 04:30:15 CEST 2008


Here is a newer source.

> i suggest you use a single sscanf()
I would use "sscanf" for args,but it doen't work well...

sscanf(arg,"%d:%d:%d:%d:%s:%s:%d",&a,&b,&c,&d,e,f,&g);

and input:
640:480:10:10:false:16/9:10

Results are:
a=640
b=480
c=10
d=10
e="false:16/9:10"
f,g -> not inputed.

so I used strok_r for args.

2008/5/11 Michael Niedermayer <michaelni at gmx.at>:
>> +    if (expand->w == -1){
>> +        expand->w=width;
>> +    } else if (expand->w < -1){
>> +        expand->w=width - expand->w;
>> +    } else if (expand->w < width){
>> +        expand->w=width;
>> +    }
>> +
>> +    if (expand->h == -1){
>> +        expand->h=height;
>> +    } else if (expand->h < -1){
>> +        expand->h=height - expand->h;
>> +    } else if (expand->h < height){
>> +        expand->h=height;
>> +    }
>
> duplicate
>> +    if(expand->x < 0 || (expand->x+width) > expand->w){
>> +        expand->x = (expand->w - width)>>1;
>> +    }
>> +    if(expand->y < 0 || (expand->y+height) > expand->h){
>> +        expand->y = (expand->h - height)>>1;
>> +    }
>
> duplicate

Yes, they're duplicate,but it is more simple than they are merged, I think.

> Iam pretty sure theres a generic way to find the byte per pixel which
> does not require a long switch-case. pix_fmt_info after all does contain
> the information.
Oh, really?
I think there are no way to access "pix_fmt_info".
It is because "pix_fmt_info" is visible in only "libavcodec/imgconvert.c".
So, for example,"vf_crop" filter is also finding the bytes per pixel
with switch-case.

> as with vmrsss, unconditional copying is not ok
Other filters are also drawing images in the same way, aren't they?
(For example,vf_drawbox.)
And the way to resize width/height is the same with "vf_scale".

-- 
Ryo Hirafuji
blog http://ledyba.ddo.jp/
dojin http://ledyba.ddo.jp/Pegasus/
web http://ledyba.hp.infoseek.co.jp/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: vf_expand.c
Type: application/octet-stream
Size: 11845 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-soc/attachments/20080515/d0d4057c/attachment.obj>


More information about the FFmpeg-soc mailing list