diff options
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/avi/intern/avi_rgb.c | 11 | ||||
-rw-r--r-- | source/blender/avi/intern/avi_rgb32.c | 2 |
2 files changed, 6 insertions, 7 deletions
diff --git a/source/blender/avi/intern/avi_rgb.c b/source/blender/avi/intern/avi_rgb.c index c6a78eccce2..632ecad61a6 100644 --- a/source/blender/avi/intern/avi_rgb.c +++ b/source/blender/avi/intern/avi_rgb.c @@ -123,13 +123,12 @@ void *avi_converter_to_avi_rgb(AviMovie *movie, int stream, unsigned char *buffe (void)stream; /* unused */ - *size = movie->header->Height * movie->header->Width * 3; - if (movie->header->Width % 2) *size += movie->header->Height; - - buf = MEM_mallocN(*size, "toavirgbbuf"); - rowstride = movie->header->Width * 3; - if (movie->header->Width % 2) rowstride++; + /* AVI files has uncompressed lines 4-byte aligned */ + rowstride = (rowstride + 3) & ~3; + + *size = movie->header->Height * rowstride; + buf = MEM_mallocN(*size, "toavirgbbuf"); for (y = 0; y < movie->header->Height; y++) { memcpy(&buf[y * rowstride], &buffer[((movie->header->Height - 1) - y) * movie->header->Width * 3], movie->header->Width * 3); diff --git a/source/blender/avi/intern/avi_rgb32.c b/source/blender/avi/intern/avi_rgb32.c index 5c7a4889d97..c9cbcb05bb8 100644 --- a/source/blender/avi/intern/avi_rgb32.c +++ b/source/blender/avi/intern/avi_rgb32.c @@ -74,8 +74,8 @@ void *avi_converter_to_rgb32(AviMovie *movie, int stream, unsigned char *buffer, (void)stream; /* unused */ - buf = MEM_mallocN(movie->header->Height * movie->header->Width * 4, "torgb32buf"); *size = movie->header->Height * movie->header->Width * 4; + buf = MEM_mallocN(*size, "torgb32buf"); memset(buf, 255, *size); |