summaryrefslogtreecommitdiff
path: root/libavfilter/defaults.c
diff options
context:
space:
mode:
authorVitor Sessak <vitor1001@gmail.com>2008-02-15 22:00:13 +0000
committerVitor Sessak <vitor1001@gmail.com>2008-02-15 22:00:13 +0000
commit790a03d70103f94d0feb1c21019af7f02aaa6dce (patch)
tree7f28af92fcc5697b1ba96b5bc2928166c2023b3f /libavfilter/defaults.c
parent4cf48782f817a9e5f0f2acbe0500eada475a295d (diff)
Force alignment of pic->linesize
Commited in SoC by Vitor Sessak on 2008-02-15 21:05:06 Originally committed as revision 12075 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavfilter/defaults.c')
-rw-r--r--libavfilter/defaults.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/libavfilter/defaults.c b/libavfilter/defaults.c
index 5cc60d539c..ab184973ad 100644
--- a/libavfilter/defaults.c
+++ b/libavfilter/defaults.c
@@ -20,14 +20,19 @@
*/
#include "avfilter.h"
+#include "imgconvert.h"
/* TODO: buffer pool. see comment for avfilter_default_get_video_buffer() */
void avfilter_default_free_video_buffer(AVFilterPic *pic)
{
- avpicture_free((AVPicture *) pic);
+ av_free(pic->data[0]);
av_free(pic);
}
+#define ALIGN(a) do{ \
+ (a) = ((a) + 15) & (~15); \
+ } while(0);
+
/* TODO: set the buffer's priv member to a context structure for the whole
* filter chain. This will allow for a buffer pool instead of the constant
* alloc & free cycle currently implemented. */
@@ -35,6 +40,8 @@ AVFilterPicRef *avfilter_default_get_video_buffer(AVFilterLink *link, int perms)
{
AVFilterPic *pic = av_mallocz(sizeof(AVFilterPic));
AVFilterPicRef *ref = av_mallocz(sizeof(AVFilterPicRef));
+ int i, tempsize;
+ char *buf;
ref->pic = pic;
ref->w = link->w;
@@ -46,9 +53,14 @@ AVFilterPicRef *avfilter_default_get_video_buffer(AVFilterLink *link, int perms)
pic->refcount = 1;
pic->format = link->format;
pic->free = avfilter_default_free_video_buffer;
- avpicture_alloc((AVPicture *)pic, pic->format,
- (ref->w + 15) & (~15), // make linesize a multiple of 16
- (ref->h + 15) & (~15));
+ ff_fill_linesize((AVPicture *)pic, pic->format, ref->w);
+
+ for (i=0; i<4;i++)
+ ALIGN(pic->linesize[i]);
+
+ tempsize = ff_fill_pointer((AVPicture *)pic, NULL, pic->format, ref->h);
+ buf = av_malloc(tempsize);
+ ff_fill_pointer((AVPicture *)pic, buf, pic->format, ref->h);
memcpy(ref->data, pic->data, sizeof(pic->data));
memcpy(ref->linesize, pic->linesize, sizeof(pic->linesize));