[FFmpeg-soc] expand filter (alternative to pad syntax)
Vitor Sessak
vitor1001 at gmail.com
Sun May 11 21:55:18 CEST 2008
Michael Niedermayer wrote:
> On Sun, May 11, 2008 at 12:47:20PM +0100, vmrsss wrote:
>> Hi Michael,
>>
>> Sorry, I need some clarification.
>>
>> On 11 May 2008, at 12:15, Michael Niedermayer wrote:
>>>> double a; // required aspect
>>> remove all aspect related code, you dont know what you are doing.
>>> read about pixel vs display aspect ratio
>> I am happy to remove aspect related code, I agree it is not
>> particularly useful. The idea is taken from mplayer and is to expand
>> the frame to fit a specific ratio instead of giving size. Upon
>
> hmm, i think i misunderstood the code, maybe it is useful to keep,
> have you tested it?
>
>
>> reflection, I agree with your remark (because I do understand pixel vs
>> aspect ratio very well :-)
>>
>>>> /* copy slice (y, y+h) from the original frame */
>>>> for(plane = 0; plane < 3; plane++) {
>>>>
>>>> if( plane == 0 ){
>>>> vsub = hsub = 0;
>>>> }else{
>>>> vsub = pad->vsub; hsub = pad->hsub;
>>>> }
>>>>
>>>> j1 = ((pad->y + y) >>vsub) * out->linesize[plane];
>>>> j2 = (y >>vsub) * in->linesize[plane];
>>>>
>>>> for(i = 0; i < (h >>vsub); i++){
>>>>
>>>> memset(out->data[plane] + j1, padcolor[plane], pad->x >>hsub);
>>>> memcpy(out->data[plane] + j1 + (pad->x >>hsub),
>>>> in->data[plane] + j2, in->w >>hsub);
>>>> memset(out->data[plane] + j1 + ((pad->x + in->w) >>hsub),
>>>> padcolor[plane], k >>hsub);
>>>>
>>>> j1 += out->linesize[plane];
>>>> j2 += in->linesize[plane];
>>>> }
>>>> }
>>> unconditional copying is unacceptable
>> help explain: Why unconditional? I am copying in->data between y and y
>> +h, which I assume is what draw_slice(...,y,h) entitles to do. Anyway,
>> more fittingly: how would you want that copying to be coded?
>
> There should be no copy.
> The source filter should directly draw into the larger buffer of the
> destination filter.
How should it be done then? Something like:
static void end_frame(AVFilterLink *link)
{
AVFilterLink* output = link->dst->outputs[0];
avfilter_resize_video_buffer(link->currpic, pad->w, pad->h); // not
yet existent function!
draw_borders(link->currpic);
for (i=0; i<4; i++)
link->currpic->data[i] += the quantity needed to pad top/left
avfilter_draw_slice(output, 0, pad->h);
avfilter_end_frame(output);
}
and avfilter_resize_video_buffer() implemented using av_realloc()?
-Vitor
More information about the FFmpeg-soc
mailing list