3
* This is external code. Converts between rgb32 and avi.
5
* ***** BEGIN GPL LICENSE BLOCK *****
7
* This program is free software; you can redistribute it and/or
8
* modify it under the terms of the GNU General Public License
9
* as published by the Free Software Foundation; either version 2
10
* of the License, or (at your option) any later version.
12
* This program is distributed in the hope that it will be useful,
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
* GNU General Public License for more details.
17
* You should have received a copy of the GNU General Public License
18
* along with this program; if not, write to the Free Software Foundation,
19
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
22
* All rights reserved.
24
* The Original Code is: all of this file.
26
* Contributor(s): none yet.
28
* ***** END GPL LICENSE BLOCK *****
32
/** \file blender/avi/intern/rgb32.c
40
#include "MEM_guardedalloc.h"
43
void *avi_converter_from_rgb32 (AviMovie *movie, int stream, unsigned char *buffer, int *size)
45
int y, x, rowstridea, rowstrideb;
48
(void)stream; /* unused */
50
buf = MEM_mallocN (movie->header->Height * movie->header->Width * 3, "fromrgb32buf");
51
*size = movie->header->Height * movie->header->Width * 3;
53
rowstridea = movie->header->Width*3;
54
rowstrideb = movie->header->Width*4;
56
for (y=0; y < movie->header->Height; y++) {
57
for (x=0; x < movie->header->Width; x++) {
58
buf[y*rowstridea + x*3 + 0] = buffer[y*rowstrideb + x*4 + 3];
59
buf[y*rowstridea + x*3 + 1] = buffer[y*rowstrideb + x*4 + 2];
60
buf[y*rowstridea + x*3 + 2] = buffer[y*rowstrideb + x*4 + 1];
69
void *avi_converter_to_rgb32 (AviMovie *movie, int stream, unsigned char *buffer, int *size)
73
unsigned char *to, *from;
75
(void)stream; /* unused */
77
buf= MEM_mallocN (movie->header->Height * movie->header->Width * 4, "torgb32buf");
78
*size= movie->header->Height * movie->header->Width * 4;
80
memset(buf, 255, *size);
82
to= buf; from= buffer;
83
i=movie->header->Height*movie->header->Width;