summaryrefslogtreecommitdiff
path: root/libavfilter
diff options
context:
space:
mode:
authorStefano Sabatini <stefano.sabatini-lala@poste.it>2010-12-04 12:56:16 +0000
committerStefano Sabatini <stefano.sabatini-lala@poste.it>2010-12-04 12:56:16 +0000
commit4da12e3b13d362e0218956a78dd2b8f7a1260265 (patch)
tree685818343659dd00f74d638d375497651e01bf03 /libavfilter
parentbf799f686fcee666e6bbb20ceffd838f341ec9b2 (diff)
Implement av_image_alloc() and use it in
avfilter_default_get_video_buffer(). Originally committed as revision 25878 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavfilter')
-rw-r--r--libavfilter/avfilter.h2
-rw-r--r--libavfilter/defaults.c16
2 files changed, 5 insertions, 13 deletions
diff --git a/libavfilter/avfilter.h b/libavfilter/avfilter.h
index 4dea65310c..aa83a5245a 100644
--- a/libavfilter/avfilter.h
+++ b/libavfilter/avfilter.h
@@ -26,7 +26,7 @@
#define LIBAVFILTER_VERSION_MAJOR 1
#define LIBAVFILTER_VERSION_MINOR 67
-#define LIBAVFILTER_VERSION_MICRO 0
+#define LIBAVFILTER_VERSION_MICRO 1
#define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \
LIBAVFILTER_VERSION_MINOR, \
diff --git a/libavfilter/defaults.c b/libavfilter/defaults.c
index 4a48a3aff1..aa3739cca6 100644
--- a/libavfilter/defaults.c
+++ b/libavfilter/defaults.c
@@ -37,26 +37,18 @@ void ff_avfilter_default_free_buffer(AVFilterBuffer *ptr)
* alloc & free cycle currently implemented. */
AVFilterBufferRef *avfilter_default_get_video_buffer(AVFilterLink *link, int perms, int w, int h)
{
- char *buf = NULL;
- int linesize[4], i, tempsize;
+ int linesize[4];
uint8_t *data[4];
AVFilterBufferRef *picref = NULL;
- av_image_fill_linesizes(linesize, link->format, w);
- for (i = 0; i < 4; i++)
- linesize[i] = FFALIGN(linesize[i], 16);
- tempsize = av_image_fill_pointers(data, link->format, h, NULL, linesize);
- buf = av_malloc(tempsize + 16); // +2 is needed for swscaler, +16 to be
- // SIMD-friendly
- if (!buf)
+ // +2 is needed for swscaler, +16 to be SIMD-friendly
+ if (av_image_alloc(data, linesize, w, h, link->format, 16) < 0)
return NULL;
- av_image_fill_pointers(data, link->format, h, buf, linesize);
-
picref = avfilter_get_video_buffer_ref_from_arrays(data, linesize,
perms, w, h, link->format);
if (!picref) {
- av_free(buf);
+ av_free(data[0]);
return NULL;
}