forked from bartvdbraak/blender
Fix T4201: AVI Broken when width not multiple of 4
This commit is contained in:
parent
c0e3540898
commit
0e7d4a828a
@ -123,13 +123,12 @@ void *avi_converter_to_avi_rgb(AviMovie *movie, int stream, unsigned char *buffe
|
|||||||
|
|
||||||
(void)stream; /* unused */
|
(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;
|
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++) {
|
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);
|
memcpy(&buf[y * rowstride], &buffer[((movie->header->Height - 1) - y) * movie->header->Width * 3], movie->header->Width * 3);
|
||||||
|
@ -74,8 +74,8 @@ void *avi_converter_to_rgb32(AviMovie *movie, int stream, unsigned char *buffer,
|
|||||||
|
|
||||||
(void)stream; /* unused */
|
(void)stream; /* unused */
|
||||||
|
|
||||||
buf = MEM_mallocN(movie->header->Height * movie->header->Width * 4, "torgb32buf");
|
|
||||||
*size = movie->header->Height * movie->header->Width * 4;
|
*size = movie->header->Height * movie->header->Width * 4;
|
||||||
|
buf = MEM_mallocN(*size, "torgb32buf");
|
||||||
|
|
||||||
memset(buf, 255, *size);
|
memset(buf, 255, *size);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user