diff --git a/src/image.c b/src/image.c index 7a678f9..07906cd 100644 --- a/src/image.c +++ b/src/image.c @@ -29,6 +29,7 @@ #include "buffer.h" #include +#include #include "tiled_yuv.h" @@ -40,14 +41,18 @@ VAStatus SunxiCedrusCreateImage(VADriverContextP context, VAImageFormat *format, struct object_image *image_object; VABufferID buffer_id; VAImageID id; + VAStatus status; int sizeY, sizeUV; + sizeY = width * height; + sizeUV = (width * (height + 1) / 2); + id = object_heap_allocate(&driver_data->image_heap); image_object = IMAGE(id); if (image_object == NULL) return VA_STATUS_ERROR_ALLOCATION_FAILED; - status = SunxiCedrusCreateBuffer(context, 0, VAImageBufferType, size, 1, NULL, &buffer_id); + status = SunxiCedrusCreateBuffer(context, 0, VAImageBufferType, sizeY + sizeUV, 1, NULL, &buffer_id); if (status != VA_STATUS_SUCCESS) { object_heap_free(&driver_data->image_heap, (struct object_base *) image_object); return status; @@ -55,9 +60,6 @@ VAStatus SunxiCedrusCreateImage(VADriverContextP context, VAImageFormat *format, image_object->buffer_id = buffer_id; - sizeY = width * height; - sizeUV = (width * (height + 1) / 2); - memset(image, 0, sizeof(*image)); image->format = *format; @@ -86,7 +88,7 @@ VAStatus SunxiCedrusDestroyImage(VADriverContextP context, VAImageID image_id) if (image_object == NULL) return VA_STATUS_ERROR_INVALID_IMAGE; - status = DumpDestroyBuffer(context, image_object->buffer_id); + status = SunxiCedrusDestroyBuffer(context, image_object->buffer_id); if (status != VA_STATUS_SUCCESS) return status;