Revision 790a03d7

View differences:

libavfilter/defaults.c
20 20
 */
21 21

  
22 22
#include "avfilter.h"
23
#include "imgconvert.h"
23 24

  
24 25
/* TODO: buffer pool.  see comment for avfilter_default_get_video_buffer() */
25 26
void avfilter_default_free_video_buffer(AVFilterPic *pic)
26 27
{
27
    avpicture_free((AVPicture *) pic);
28
    av_free(pic->data[0]);
28 29
    av_free(pic);
29 30
}
30 31

  
32
#define ALIGN(a) do{ \
33
                     (a) = ((a) + 15) & (~15); \
34
                 } while(0);
35

  
31 36
/* TODO: set the buffer's priv member to a context structure for the whole
32 37
 * filter chain.  This will allow for a buffer pool instead of the constant
33 38
 * alloc & free cycle currently implemented. */
......
35 40
{
36 41
    AVFilterPic *pic = av_mallocz(sizeof(AVFilterPic));
37 42
    AVFilterPicRef *ref = av_mallocz(sizeof(AVFilterPicRef));
43
    int i, tempsize;
44
    char *buf;
38 45

  
39 46
    ref->pic   = pic;
40 47
    ref->w     = link->w;
......
46 53
    pic->refcount = 1;
47 54
    pic->format   = link->format;
48 55
    pic->free     = avfilter_default_free_video_buffer;
49
    avpicture_alloc((AVPicture *)pic, pic->format,
50
                    (ref->w + 15) & (~15), // make linesize a multiple of 16
51
                    (ref->h + 15) & (~15));
56
    ff_fill_linesize((AVPicture *)pic, pic->format, ref->w);
57

  
58
    for (i=0; i<4;i++)
59
        ALIGN(pic->linesize[i]);
60

  
61
    tempsize = ff_fill_pointer((AVPicture *)pic, NULL, pic->format, ref->h);
62
    buf = av_malloc(tempsize);
63
    ff_fill_pointer((AVPicture *)pic, buf, pic->format, ref->h);
52 64

  
53 65
    memcpy(ref->data,     pic->data,     sizeof(pic->data));
54 66
    memcpy(ref->linesize, pic->linesize, sizeof(pic->linesize));

Also available in: Unified diff