diff options
Diffstat (limited to 'source/blender/avi/intern/rgb32.c')
-rw-r--r-- | source/blender/avi/intern/rgb32.c | 39 |
1 files changed, 19 insertions, 20 deletions
diff --git a/source/blender/avi/intern/rgb32.c b/source/blender/avi/intern/rgb32.c index c6830d9666a..84630f09fe5 100644 --- a/source/blender/avi/intern/rgb32.c +++ b/source/blender/avi/intern/rgb32.c @@ -1,7 +1,4 @@ /* - * - * This is external code. Converts between rgb32 and avi. - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or @@ -31,6 +28,8 @@ /** \file blender/avi/intern/rgb32.c * \ingroup avi + * + * This is external code. Converts between rgb32 and avi. */ @@ -40,33 +39,33 @@ #include "MEM_guardedalloc.h" #include "rgb32.h" -void *avi_converter_from_rgb32 (AviMovie *movie, int stream, unsigned char *buffer, int *size) +void *avi_converter_from_rgb32(AviMovie *movie, int stream, unsigned char *buffer, int *size) { int y, x, rowstridea, rowstrideb; unsigned char *buf; (void)stream; /* unused */ - buf = MEM_mallocN (movie->header->Height * movie->header->Width * 3, "fromrgb32buf"); + buf = MEM_mallocN(movie->header->Height * movie->header->Width * 3, "fromrgb32buf"); *size = movie->header->Height * movie->header->Width * 3; - rowstridea = movie->header->Width*3; - rowstrideb = movie->header->Width*4; + rowstridea = movie->header->Width * 3; + rowstrideb = movie->header->Width * 4; - for (y=0; y < movie->header->Height; y++) { - for (x=0; x < movie->header->Width; x++) { - buf[y*rowstridea + x*3 + 0] = buffer[y*rowstrideb + x*4 + 3]; - buf[y*rowstridea + x*3 + 1] = buffer[y*rowstrideb + x*4 + 2]; - buf[y*rowstridea + x*3 + 2] = buffer[y*rowstrideb + x*4 + 1]; + for (y = 0; y < movie->header->Height; y++) { + for (x = 0; x < movie->header->Width; x++) { + buf[y * rowstridea + x * 3 + 0] = buffer[y * rowstrideb + x * 4 + 3]; + buf[y * rowstridea + x * 3 + 1] = buffer[y * rowstrideb + x * 4 + 2]; + buf[y * rowstridea + x * 3 + 2] = buffer[y * rowstrideb + x * 4 + 1]; } } - MEM_freeN (buffer); + MEM_freeN(buffer); return buf; } -void *avi_converter_to_rgb32 (AviMovie *movie, int stream, unsigned char *buffer, int *size) +void *avi_converter_to_rgb32(AviMovie *movie, int stream, unsigned char *buffer, int *size) { int i; unsigned char *buf; @@ -74,20 +73,20 @@ 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(movie->header->Height * movie->header->Width * 4, "torgb32buf"); + *size = movie->header->Height * movie->header->Width * 4; memset(buf, 255, *size); - to= buf; from= buffer; - i=movie->header->Height*movie->header->Width; + to = buf; from = buffer; + i = movie->header->Height * movie->header->Width; while (i--) { memcpy(to, from, 3); - to+=4; from+=3; + to += 4; from += 3; } - MEM_freeN (buffer); + MEM_freeN(buffer); return buf; } |