2011-02-23 11:52:22 +01:00
|
|
|
/*
|
2008-04-17 00:40:48 +02:00
|
|
|
* ***** BEGIN GPL LICENSE BLOCK *****
|
2002-10-12 13:37:38 +02:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
2008-04-17 00:40:48 +02:00
|
|
|
* of the License, or (at your option) any later version.
|
2002-10-12 13:37:38 +02:00
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software Foundation,
|
2010-02-12 14:34:04 +01:00
|
|
|
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2002-10-12 13:37:38 +02:00
|
|
|
*
|
|
|
|
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* The Original Code is: all of this file.
|
|
|
|
*
|
|
|
|
* Contributor(s): none yet.
|
|
|
|
*
|
2008-04-17 00:40:48 +02:00
|
|
|
* ***** END GPL LICENSE BLOCK *****
|
2002-10-12 13:37:38 +02:00
|
|
|
* allocimbuf.c
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2011-02-27 21:23:21 +01:00
|
|
|
/** \file blender/imbuf/intern/scaling.c
|
|
|
|
* \ingroup imbuf
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
2011-03-17 11:37:48 +01:00
|
|
|
#include "BLI_utildefines.h"
|
2010-08-16 07:46:10 +02:00
|
|
|
#include "MEM_guardedalloc.h"
|
2002-10-12 13:37:38 +02:00
|
|
|
|
|
|
|
#include "imbuf.h"
|
|
|
|
#include "IMB_imbuf_types.h"
|
|
|
|
#include "IMB_imbuf.h"
|
|
|
|
|
|
|
|
#include "IMB_allocimbuf.h"
|
|
|
|
#include "IMB_filter.h"
|
|
|
|
|
2008-08-17 19:22:10 +02:00
|
|
|
#include "BLO_sys_types.h" // for intptr_t support
|
|
|
|
|
2002-10-12 13:37:38 +02:00
|
|
|
/************************************************************************/
|
|
|
|
/* SCALING */
|
|
|
|
/************************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
struct ImBuf *IMB_half_x(struct ImBuf *ibuf1)
|
|
|
|
{
|
|
|
|
struct ImBuf *ibuf2;
|
2012-04-29 17:47:02 +02:00
|
|
|
uchar *p1, *_p1, *dest;
|
|
|
|
short a, r, g, b;
|
|
|
|
int x, y;
|
|
|
|
float af, rf, gf, bf, *p1f, *_p1f, *destf;
|
2006-09-14 14:21:18 +02:00
|
|
|
int do_rect, do_float;
|
2002-10-12 13:37:38 +02:00
|
|
|
|
2012-05-16 11:26:37 +02:00
|
|
|
if (ibuf1 == NULL) return (NULL);
|
|
|
|
if (ibuf1->rect == NULL && ibuf1->rect_float == NULL) return (NULL);
|
2006-09-14 14:21:18 +02:00
|
|
|
|
2012-05-16 11:26:37 +02:00
|
|
|
do_rect = (ibuf1->rect != NULL);
|
|
|
|
do_float = (ibuf1->rect_float != NULL);
|
2002-10-12 13:37:38 +02:00
|
|
|
|
|
|
|
if (ibuf1->x <= 1) return(IMB_dupImBuf(ibuf1));
|
|
|
|
|
2012-05-16 11:26:37 +02:00
|
|
|
ibuf2 = IMB_allocImBuf((ibuf1->x) / 2, ibuf1->y, ibuf1->planes, ibuf1->flags);
|
|
|
|
if (ibuf2 == NULL) return (NULL);
|
2002-10-12 13:37:38 +02:00
|
|
|
|
|
|
|
_p1 = (uchar *) ibuf1->rect;
|
2012-05-16 11:26:37 +02:00
|
|
|
dest = (uchar *) ibuf2->rect;
|
2011-04-21 15:11:51 +02:00
|
|
|
|
Orange branch: OpenEXR finally in Blender!
Credits go to Gernot Ziegler, who originally coded EXR support, and to
Austin Benesh for bringing it further. Kent Mein provided a lot of code
for integrating float buffers in Blender imbuf and ImBuf API cleanup,
and provided Make and Scons and static linking.
At this moment; the EXR libraries are a *dependency*, so you cannot get
the Orange branch compiled without having OpenEXR installed. Get the
(precompiled or sources) stuff from www.openexr.com. Current default is
that the headers and lib resides in /user/local/
Several changes/additions/fixes were added:
- EXR code only supported 'half' format (16 bits per channel). I've added
float writing, but for reading it I need tomorrow. :)
- Quite some clumsy copying of data happened in EXR code.
- cleaned up the api calls already a bit, preparing for more advanced
support
- Zbuffers were saved 16 bits, now 32 bits
- automatic adding of .exr extensions went wrong
Imbuf:
- added proper imbuf->flags and imbuf->mall support for float buffers, it
was created for *each* imbuf. :)
- found bugs for float buffers in scaling and flipping. Code there will
need more checks still
- imbuf also needs to be verified to behave properly when no 32 bits
rect exists (for saving for example)
TODO:
- support internal float images for textures, backbuf, AO probes, and
display in Image window
Hope this commit won't screwup syncing with bf-blender... :/
2006-01-09 01:40:35 +01:00
|
|
|
_p1f = ibuf1->rect_float;
|
2012-05-16 11:26:37 +02:00
|
|
|
destf = ibuf2->rect_float;
|
2002-10-12 13:37:38 +02:00
|
|
|
|
2012-05-16 11:26:37 +02:00
|
|
|
for (y = ibuf2->y; y > 0; y--) {
|
2002-10-12 13:37:38 +02:00
|
|
|
p1 = _p1;
|
Orange branch: OpenEXR finally in Blender!
Credits go to Gernot Ziegler, who originally coded EXR support, and to
Austin Benesh for bringing it further. Kent Mein provided a lot of code
for integrating float buffers in Blender imbuf and ImBuf API cleanup,
and provided Make and Scons and static linking.
At this moment; the EXR libraries are a *dependency*, so you cannot get
the Orange branch compiled without having OpenEXR installed. Get the
(precompiled or sources) stuff from www.openexr.com. Current default is
that the headers and lib resides in /user/local/
Several changes/additions/fixes were added:
- EXR code only supported 'half' format (16 bits per channel). I've added
float writing, but for reading it I need tomorrow. :)
- Quite some clumsy copying of data happened in EXR code.
- cleaned up the api calls already a bit, preparing for more advanced
support
- Zbuffers were saved 16 bits, now 32 bits
- automatic adding of .exr extensions went wrong
Imbuf:
- added proper imbuf->flags and imbuf->mall support for float buffers, it
was created for *each* imbuf. :)
- found bugs for float buffers in scaling and flipping. Code there will
need more checks still
- imbuf also needs to be verified to behave properly when no 32 bits
rect exists (for saving for example)
TODO:
- support internal float images for textures, backbuf, AO probes, and
display in Image window
Hope this commit won't screwup syncing with bf-blender... :/
2006-01-09 01:40:35 +01:00
|
|
|
p1f = _p1f;
|
2012-05-16 11:26:37 +02:00
|
|
|
for (x = ibuf2->x; x > 0; x--) {
|
2006-09-14 14:21:18 +02:00
|
|
|
if (do_rect) {
|
2012-02-27 11:35:39 +01:00
|
|
|
a = *(p1++);
|
|
|
|
b = *(p1++);
|
|
|
|
g = *(p1++);
|
2006-09-14 14:21:18 +02:00
|
|
|
r = *(p1++);
|
2012-02-27 11:35:39 +01:00
|
|
|
a += *(p1++);
|
|
|
|
b += *(p1++);
|
|
|
|
g += *(p1++);
|
2006-09-14 14:21:18 +02:00
|
|
|
r += *(p1++);
|
|
|
|
*(dest++) = a >> 1;
|
|
|
|
*(dest++) = b >> 1;
|
|
|
|
*(dest++) = g >> 1;
|
|
|
|
*(dest++) = r >> 1;
|
|
|
|
}
|
Orange branch: OpenEXR finally in Blender!
Credits go to Gernot Ziegler, who originally coded EXR support, and to
Austin Benesh for bringing it further. Kent Mein provided a lot of code
for integrating float buffers in Blender imbuf and ImBuf API cleanup,
and provided Make and Scons and static linking.
At this moment; the EXR libraries are a *dependency*, so you cannot get
the Orange branch compiled without having OpenEXR installed. Get the
(precompiled or sources) stuff from www.openexr.com. Current default is
that the headers and lib resides in /user/local/
Several changes/additions/fixes were added:
- EXR code only supported 'half' format (16 bits per channel). I've added
float writing, but for reading it I need tomorrow. :)
- Quite some clumsy copying of data happened in EXR code.
- cleaned up the api calls already a bit, preparing for more advanced
support
- Zbuffers were saved 16 bits, now 32 bits
- automatic adding of .exr extensions went wrong
Imbuf:
- added proper imbuf->flags and imbuf->mall support for float buffers, it
was created for *each* imbuf. :)
- found bugs for float buffers in scaling and flipping. Code there will
need more checks still
- imbuf also needs to be verified to behave properly when no 32 bits
rect exists (for saving for example)
TODO:
- support internal float images for textures, backbuf, AO probes, and
display in Image window
Hope this commit won't screwup syncing with bf-blender... :/
2006-01-09 01:40:35 +01:00
|
|
|
if (do_float) {
|
|
|
|
af = *(p1f++);
|
|
|
|
bf = *(p1f++);
|
|
|
|
gf = *(p1f++);
|
|
|
|
rf = *(p1f++);
|
|
|
|
af += *(p1f++);
|
|
|
|
bf += *(p1f++);
|
|
|
|
gf += *(p1f++);
|
|
|
|
rf += *(p1f++);
|
2012-05-16 11:26:37 +02:00
|
|
|
*(destf++) = 0.5f * af;
|
|
|
|
*(destf++) = 0.5f * bf;
|
|
|
|
*(destf++) = 0.5f * gf;
|
|
|
|
*(destf++) = 0.5f * rf;
|
Orange branch: OpenEXR finally in Blender!
Credits go to Gernot Ziegler, who originally coded EXR support, and to
Austin Benesh for bringing it further. Kent Mein provided a lot of code
for integrating float buffers in Blender imbuf and ImBuf API cleanup,
and provided Make and Scons and static linking.
At this moment; the EXR libraries are a *dependency*, so you cannot get
the Orange branch compiled without having OpenEXR installed. Get the
(precompiled or sources) stuff from www.openexr.com. Current default is
that the headers and lib resides in /user/local/
Several changes/additions/fixes were added:
- EXR code only supported 'half' format (16 bits per channel). I've added
float writing, but for reading it I need tomorrow. :)
- Quite some clumsy copying of data happened in EXR code.
- cleaned up the api calls already a bit, preparing for more advanced
support
- Zbuffers were saved 16 bits, now 32 bits
- automatic adding of .exr extensions went wrong
Imbuf:
- added proper imbuf->flags and imbuf->mall support for float buffers, it
was created for *each* imbuf. :)
- found bugs for float buffers in scaling and flipping. Code there will
need more checks still
- imbuf also needs to be verified to behave properly when no 32 bits
rect exists (for saving for example)
TODO:
- support internal float images for textures, backbuf, AO probes, and
display in Image window
Hope this commit won't screwup syncing with bf-blender... :/
2006-01-09 01:40:35 +01:00
|
|
|
}
|
2002-10-12 13:37:38 +02:00
|
|
|
}
|
2006-09-14 14:21:18 +02:00
|
|
|
if (do_rect) _p1 += (ibuf1->x << 2);
|
Orange branch: OpenEXR finally in Blender!
Credits go to Gernot Ziegler, who originally coded EXR support, and to
Austin Benesh for bringing it further. Kent Mein provided a lot of code
for integrating float buffers in Blender imbuf and ImBuf API cleanup,
and provided Make and Scons and static linking.
At this moment; the EXR libraries are a *dependency*, so you cannot get
the Orange branch compiled without having OpenEXR installed. Get the
(precompiled or sources) stuff from www.openexr.com. Current default is
that the headers and lib resides in /user/local/
Several changes/additions/fixes were added:
- EXR code only supported 'half' format (16 bits per channel). I've added
float writing, but for reading it I need tomorrow. :)
- Quite some clumsy copying of data happened in EXR code.
- cleaned up the api calls already a bit, preparing for more advanced
support
- Zbuffers were saved 16 bits, now 32 bits
- automatic adding of .exr extensions went wrong
Imbuf:
- added proper imbuf->flags and imbuf->mall support for float buffers, it
was created for *each* imbuf. :)
- found bugs for float buffers in scaling and flipping. Code there will
need more checks still
- imbuf also needs to be verified to behave properly when no 32 bits
rect exists (for saving for example)
TODO:
- support internal float images for textures, backbuf, AO probes, and
display in Image window
Hope this commit won't screwup syncing with bf-blender... :/
2006-01-09 01:40:35 +01:00
|
|
|
if (do_float) _p1f += (ibuf1->x << 2);
|
2002-10-12 13:37:38 +02:00
|
|
|
}
|
|
|
|
return (ibuf2);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
struct ImBuf *IMB_double_fast_x(struct ImBuf *ibuf1)
|
|
|
|
{
|
|
|
|
struct ImBuf *ibuf2;
|
2012-04-29 17:47:02 +02:00
|
|
|
int *p1, *dest, i, col, do_rect, do_float;
|
2007-01-22 18:43:36 +01:00
|
|
|
float *p1f, *destf;
|
2002-10-12 13:37:38 +02:00
|
|
|
|
2012-05-16 11:26:37 +02:00
|
|
|
if (ibuf1 == NULL) return (NULL);
|
|
|
|
if (ibuf1->rect == NULL && ibuf1->rect_float == NULL) return (NULL);
|
2002-10-12 13:37:38 +02:00
|
|
|
|
2012-05-16 11:26:37 +02:00
|
|
|
do_rect = (ibuf1->rect != NULL);
|
|
|
|
do_float = (ibuf1->rect_float != NULL);
|
2006-09-14 14:21:18 +02:00
|
|
|
|
2012-04-29 17:47:02 +02:00
|
|
|
ibuf2 = IMB_allocImBuf(2 * ibuf1->x, ibuf1->y, ibuf1->planes, ibuf1->flags);
|
2012-05-16 11:26:37 +02:00
|
|
|
if (ibuf2 == NULL) return (NULL);
|
2002-10-12 13:37:38 +02:00
|
|
|
|
|
|
|
p1 = (int *) ibuf1->rect;
|
2012-05-16 11:26:37 +02:00
|
|
|
dest = (int *) ibuf2->rect;
|
2007-01-22 18:43:36 +01:00
|
|
|
p1f = (float *)ibuf1->rect_float;
|
|
|
|
destf = (float *)ibuf2->rect_float;
|
2002-10-12 13:37:38 +02:00
|
|
|
|
2012-03-24 07:38:07 +01:00
|
|
|
for (i = ibuf1->y * ibuf1->x; i > 0; i--) {
|
2006-09-14 14:21:18 +02:00
|
|
|
if (do_rect) {
|
|
|
|
col = *p1++;
|
|
|
|
*dest++ = col;
|
|
|
|
*dest++ = col;
|
|
|
|
}
|
Orange branch: OpenEXR finally in Blender!
Credits go to Gernot Ziegler, who originally coded EXR support, and to
Austin Benesh for bringing it further. Kent Mein provided a lot of code
for integrating float buffers in Blender imbuf and ImBuf API cleanup,
and provided Make and Scons and static linking.
At this moment; the EXR libraries are a *dependency*, so you cannot get
the Orange branch compiled without having OpenEXR installed. Get the
(precompiled or sources) stuff from www.openexr.com. Current default is
that the headers and lib resides in /user/local/
Several changes/additions/fixes were added:
- EXR code only supported 'half' format (16 bits per channel). I've added
float writing, but for reading it I need tomorrow. :)
- Quite some clumsy copying of data happened in EXR code.
- cleaned up the api calls already a bit, preparing for more advanced
support
- Zbuffers were saved 16 bits, now 32 bits
- automatic adding of .exr extensions went wrong
Imbuf:
- added proper imbuf->flags and imbuf->mall support for float buffers, it
was created for *each* imbuf. :)
- found bugs for float buffers in scaling and flipping. Code there will
need more checks still
- imbuf also needs to be verified to behave properly when no 32 bits
rect exists (for saving for example)
TODO:
- support internal float images for textures, backbuf, AO probes, and
display in Image window
Hope this commit won't screwup syncing with bf-blender... :/
2006-01-09 01:40:35 +01:00
|
|
|
if (do_float) {
|
2012-05-16 11:26:37 +02:00
|
|
|
destf[0] = destf[4] = p1f[0];
|
|
|
|
destf[1] = destf[5] = p1f[1];
|
|
|
|
destf[2] = destf[6] = p1f[2];
|
|
|
|
destf[3] = destf[7] = p1f[3];
|
|
|
|
destf += 8;
|
|
|
|
p1f += 4;
|
Orange branch: OpenEXR finally in Blender!
Credits go to Gernot Ziegler, who originally coded EXR support, and to
Austin Benesh for bringing it further. Kent Mein provided a lot of code
for integrating float buffers in Blender imbuf and ImBuf API cleanup,
and provided Make and Scons and static linking.
At this moment; the EXR libraries are a *dependency*, so you cannot get
the Orange branch compiled without having OpenEXR installed. Get the
(precompiled or sources) stuff from www.openexr.com. Current default is
that the headers and lib resides in /user/local/
Several changes/additions/fixes were added:
- EXR code only supported 'half' format (16 bits per channel). I've added
float writing, but for reading it I need tomorrow. :)
- Quite some clumsy copying of data happened in EXR code.
- cleaned up the api calls already a bit, preparing for more advanced
support
- Zbuffers were saved 16 bits, now 32 bits
- automatic adding of .exr extensions went wrong
Imbuf:
- added proper imbuf->flags and imbuf->mall support for float buffers, it
was created for *each* imbuf. :)
- found bugs for float buffers in scaling and flipping. Code there will
need more checks still
- imbuf also needs to be verified to behave properly when no 32 bits
rect exists (for saving for example)
TODO:
- support internal float images for textures, backbuf, AO probes, and
display in Image window
Hope this commit won't screwup syncing with bf-blender... :/
2006-01-09 01:40:35 +01:00
|
|
|
}
|
2002-10-12 13:37:38 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
return (ibuf2);
|
|
|
|
}
|
|
|
|
|
|
|
|
struct ImBuf *IMB_double_x(struct ImBuf *ibuf1)
|
|
|
|
{
|
|
|
|
struct ImBuf *ibuf2;
|
|
|
|
|
2012-05-16 11:26:37 +02:00
|
|
|
if (ibuf1 == NULL) return (NULL);
|
|
|
|
if (ibuf1->rect == NULL && ibuf1->rect_float == NULL) return (NULL);
|
2002-10-12 13:37:38 +02:00
|
|
|
|
|
|
|
ibuf2 = IMB_double_fast_x(ibuf1);
|
|
|
|
|
|
|
|
imb_filterx(ibuf2);
|
|
|
|
return (ibuf2);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
struct ImBuf *IMB_half_y(struct ImBuf *ibuf1)
|
|
|
|
{
|
|
|
|
struct ImBuf *ibuf2;
|
2012-04-29 17:47:02 +02:00
|
|
|
uchar *p1, *p2, *_p1, *dest;
|
|
|
|
short a, r, g, b;
|
|
|
|
int x, y;
|
2006-09-14 14:21:18 +02:00
|
|
|
int do_rect, do_float;
|
2012-04-29 17:47:02 +02:00
|
|
|
float af, rf, gf, bf, *p1f, *p2f, *_p1f, *destf;
|
2002-10-12 13:37:38 +02:00
|
|
|
|
2012-05-16 11:26:37 +02:00
|
|
|
p1 = p2 = NULL;
|
|
|
|
p1f = p2f = NULL;
|
|
|
|
if (ibuf1 == NULL) return (NULL);
|
|
|
|
if (ibuf1->rect == NULL && ibuf1->rect_float == NULL) return (NULL);
|
2002-10-12 13:37:38 +02:00
|
|
|
if (ibuf1->y <= 1) return(IMB_dupImBuf(ibuf1));
|
|
|
|
|
2012-05-16 11:26:37 +02:00
|
|
|
do_rect = (ibuf1->rect != NULL);
|
|
|
|
do_float = (ibuf1->rect_float != NULL);
|
2006-09-14 14:21:18 +02:00
|
|
|
|
2012-04-29 17:47:02 +02:00
|
|
|
ibuf2 = IMB_allocImBuf(ibuf1->x, (ibuf1->y) / 2, ibuf1->planes, ibuf1->flags);
|
2012-05-16 11:26:37 +02:00
|
|
|
if (ibuf2 == NULL) return (NULL);
|
2002-10-12 13:37:38 +02:00
|
|
|
|
|
|
|
_p1 = (uchar *) ibuf1->rect;
|
2012-05-16 11:26:37 +02:00
|
|
|
dest = (uchar *) ibuf2->rect;
|
2007-01-22 18:43:36 +01:00
|
|
|
_p1f = (float *) ibuf1->rect_float;
|
2012-05-16 11:26:37 +02:00
|
|
|
destf = (float *) ibuf2->rect_float;
|
2002-10-12 13:37:38 +02:00
|
|
|
|
2012-05-16 11:26:37 +02:00
|
|
|
for (y = ibuf2->y; y > 0; y--) {
|
2006-09-14 14:21:18 +02:00
|
|
|
if (do_rect) {
|
|
|
|
p1 = _p1;
|
|
|
|
p2 = _p1 + (ibuf1->x << 2);
|
|
|
|
}
|
Orange branch: OpenEXR finally in Blender!
Credits go to Gernot Ziegler, who originally coded EXR support, and to
Austin Benesh for bringing it further. Kent Mein provided a lot of code
for integrating float buffers in Blender imbuf and ImBuf API cleanup,
and provided Make and Scons and static linking.
At this moment; the EXR libraries are a *dependency*, so you cannot get
the Orange branch compiled without having OpenEXR installed. Get the
(precompiled or sources) stuff from www.openexr.com. Current default is
that the headers and lib resides in /user/local/
Several changes/additions/fixes were added:
- EXR code only supported 'half' format (16 bits per channel). I've added
float writing, but for reading it I need tomorrow. :)
- Quite some clumsy copying of data happened in EXR code.
- cleaned up the api calls already a bit, preparing for more advanced
support
- Zbuffers were saved 16 bits, now 32 bits
- automatic adding of .exr extensions went wrong
Imbuf:
- added proper imbuf->flags and imbuf->mall support for float buffers, it
was created for *each* imbuf. :)
- found bugs for float buffers in scaling and flipping. Code there will
need more checks still
- imbuf also needs to be verified to behave properly when no 32 bits
rect exists (for saving for example)
TODO:
- support internal float images for textures, backbuf, AO probes, and
display in Image window
Hope this commit won't screwup syncing with bf-blender... :/
2006-01-09 01:40:35 +01:00
|
|
|
if (do_float) {
|
|
|
|
p1f = _p1f;
|
|
|
|
p2f = _p1f + (ibuf1->x << 2);
|
|
|
|
}
|
2012-03-24 07:38:07 +01:00
|
|
|
for (x = ibuf2->x; x > 0; x--) {
|
2006-09-14 14:21:18 +02:00
|
|
|
if (do_rect) {
|
2012-02-27 11:35:39 +01:00
|
|
|
a = *(p1++);
|
|
|
|
b = *(p1++);
|
|
|
|
g = *(p1++);
|
2006-09-14 14:21:18 +02:00
|
|
|
r = *(p1++);
|
2012-02-27 11:35:39 +01:00
|
|
|
a += *(p2++);
|
|
|
|
b += *(p2++);
|
|
|
|
g += *(p2++);
|
2006-09-14 14:21:18 +02:00
|
|
|
r += *(p2++);
|
|
|
|
*(dest++) = a >> 1;
|
|
|
|
*(dest++) = b >> 1;
|
|
|
|
*(dest++) = g >> 1;
|
|
|
|
*(dest++) = r >> 1;
|
|
|
|
}
|
Orange branch: OpenEXR finally in Blender!
Credits go to Gernot Ziegler, who originally coded EXR support, and to
Austin Benesh for bringing it further. Kent Mein provided a lot of code
for integrating float buffers in Blender imbuf and ImBuf API cleanup,
and provided Make and Scons and static linking.
At this moment; the EXR libraries are a *dependency*, so you cannot get
the Orange branch compiled without having OpenEXR installed. Get the
(precompiled or sources) stuff from www.openexr.com. Current default is
that the headers and lib resides in /user/local/
Several changes/additions/fixes were added:
- EXR code only supported 'half' format (16 bits per channel). I've added
float writing, but for reading it I need tomorrow. :)
- Quite some clumsy copying of data happened in EXR code.
- cleaned up the api calls already a bit, preparing for more advanced
support
- Zbuffers were saved 16 bits, now 32 bits
- automatic adding of .exr extensions went wrong
Imbuf:
- added proper imbuf->flags and imbuf->mall support for float buffers, it
was created for *each* imbuf. :)
- found bugs for float buffers in scaling and flipping. Code there will
need more checks still
- imbuf also needs to be verified to behave properly when no 32 bits
rect exists (for saving for example)
TODO:
- support internal float images for textures, backbuf, AO probes, and
display in Image window
Hope this commit won't screwup syncing with bf-blender... :/
2006-01-09 01:40:35 +01:00
|
|
|
if (do_float) {
|
2012-02-27 11:35:39 +01:00
|
|
|
af = *(p1f++);
|
|
|
|
bf = *(p1f++);
|
|
|
|
gf = *(p1f++);
|
Orange branch: OpenEXR finally in Blender!
Credits go to Gernot Ziegler, who originally coded EXR support, and to
Austin Benesh for bringing it further. Kent Mein provided a lot of code
for integrating float buffers in Blender imbuf and ImBuf API cleanup,
and provided Make and Scons and static linking.
At this moment; the EXR libraries are a *dependency*, so you cannot get
the Orange branch compiled without having OpenEXR installed. Get the
(precompiled or sources) stuff from www.openexr.com. Current default is
that the headers and lib resides in /user/local/
Several changes/additions/fixes were added:
- EXR code only supported 'half' format (16 bits per channel). I've added
float writing, but for reading it I need tomorrow. :)
- Quite some clumsy copying of data happened in EXR code.
- cleaned up the api calls already a bit, preparing for more advanced
support
- Zbuffers were saved 16 bits, now 32 bits
- automatic adding of .exr extensions went wrong
Imbuf:
- added proper imbuf->flags and imbuf->mall support for float buffers, it
was created for *each* imbuf. :)
- found bugs for float buffers in scaling and flipping. Code there will
need more checks still
- imbuf also needs to be verified to behave properly when no 32 bits
rect exists (for saving for example)
TODO:
- support internal float images for textures, backbuf, AO probes, and
display in Image window
Hope this commit won't screwup syncing with bf-blender... :/
2006-01-09 01:40:35 +01:00
|
|
|
rf = *(p1f++);
|
2012-02-27 11:35:39 +01:00
|
|
|
af += *(p2f++);
|
|
|
|
bf += *(p2f++);
|
|
|
|
gf += *(p2f++);
|
Orange branch: OpenEXR finally in Blender!
Credits go to Gernot Ziegler, who originally coded EXR support, and to
Austin Benesh for bringing it further. Kent Mein provided a lot of code
for integrating float buffers in Blender imbuf and ImBuf API cleanup,
and provided Make and Scons and static linking.
At this moment; the EXR libraries are a *dependency*, so you cannot get
the Orange branch compiled without having OpenEXR installed. Get the
(precompiled or sources) stuff from www.openexr.com. Current default is
that the headers and lib resides in /user/local/
Several changes/additions/fixes were added:
- EXR code only supported 'half' format (16 bits per channel). I've added
float writing, but for reading it I need tomorrow. :)
- Quite some clumsy copying of data happened in EXR code.
- cleaned up the api calls already a bit, preparing for more advanced
support
- Zbuffers were saved 16 bits, now 32 bits
- automatic adding of .exr extensions went wrong
Imbuf:
- added proper imbuf->flags and imbuf->mall support for float buffers, it
was created for *each* imbuf. :)
- found bugs for float buffers in scaling and flipping. Code there will
need more checks still
- imbuf also needs to be verified to behave properly when no 32 bits
rect exists (for saving for example)
TODO:
- support internal float images for textures, backbuf, AO probes, and
display in Image window
Hope this commit won't screwup syncing with bf-blender... :/
2006-01-09 01:40:35 +01:00
|
|
|
rf += *(p2f++);
|
2012-05-16 11:26:37 +02:00
|
|
|
*(destf++) = 0.5f * af;
|
|
|
|
*(destf++) = 0.5f * bf;
|
|
|
|
*(destf++) = 0.5f * gf;
|
|
|
|
*(destf++) = 0.5f * rf;
|
Orange branch: OpenEXR finally in Blender!
Credits go to Gernot Ziegler, who originally coded EXR support, and to
Austin Benesh for bringing it further. Kent Mein provided a lot of code
for integrating float buffers in Blender imbuf and ImBuf API cleanup,
and provided Make and Scons and static linking.
At this moment; the EXR libraries are a *dependency*, so you cannot get
the Orange branch compiled without having OpenEXR installed. Get the
(precompiled or sources) stuff from www.openexr.com. Current default is
that the headers and lib resides in /user/local/
Several changes/additions/fixes were added:
- EXR code only supported 'half' format (16 bits per channel). I've added
float writing, but for reading it I need tomorrow. :)
- Quite some clumsy copying of data happened in EXR code.
- cleaned up the api calls already a bit, preparing for more advanced
support
- Zbuffers were saved 16 bits, now 32 bits
- automatic adding of .exr extensions went wrong
Imbuf:
- added proper imbuf->flags and imbuf->mall support for float buffers, it
was created for *each* imbuf. :)
- found bugs for float buffers in scaling and flipping. Code there will
need more checks still
- imbuf also needs to be verified to behave properly when no 32 bits
rect exists (for saving for example)
TODO:
- support internal float images for textures, backbuf, AO probes, and
display in Image window
Hope this commit won't screwup syncing with bf-blender... :/
2006-01-09 01:40:35 +01:00
|
|
|
}
|
2002-10-12 13:37:38 +02:00
|
|
|
}
|
2006-09-14 14:21:18 +02:00
|
|
|
if (do_rect) _p1 += (ibuf1->x << 3);
|
Orange branch: OpenEXR finally in Blender!
Credits go to Gernot Ziegler, who originally coded EXR support, and to
Austin Benesh for bringing it further. Kent Mein provided a lot of code
for integrating float buffers in Blender imbuf and ImBuf API cleanup,
and provided Make and Scons and static linking.
At this moment; the EXR libraries are a *dependency*, so you cannot get
the Orange branch compiled without having OpenEXR installed. Get the
(precompiled or sources) stuff from www.openexr.com. Current default is
that the headers and lib resides in /user/local/
Several changes/additions/fixes were added:
- EXR code only supported 'half' format (16 bits per channel). I've added
float writing, but for reading it I need tomorrow. :)
- Quite some clumsy copying of data happened in EXR code.
- cleaned up the api calls already a bit, preparing for more advanced
support
- Zbuffers were saved 16 bits, now 32 bits
- automatic adding of .exr extensions went wrong
Imbuf:
- added proper imbuf->flags and imbuf->mall support for float buffers, it
was created for *each* imbuf. :)
- found bugs for float buffers in scaling and flipping. Code there will
need more checks still
- imbuf also needs to be verified to behave properly when no 32 bits
rect exists (for saving for example)
TODO:
- support internal float images for textures, backbuf, AO probes, and
display in Image window
Hope this commit won't screwup syncing with bf-blender... :/
2006-01-09 01:40:35 +01:00
|
|
|
if (do_float) _p1f += (ibuf1->x << 3);
|
2002-10-12 13:37:38 +02:00
|
|
|
}
|
|
|
|
return (ibuf2);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
struct ImBuf *IMB_double_fast_y(struct ImBuf *ibuf1)
|
|
|
|
{
|
|
|
|
struct ImBuf *ibuf2;
|
|
|
|
int *p1, *dest1, *dest2;
|
Orange branch: OpenEXR finally in Blender!
Credits go to Gernot Ziegler, who originally coded EXR support, and to
Austin Benesh for bringing it further. Kent Mein provided a lot of code
for integrating float buffers in Blender imbuf and ImBuf API cleanup,
and provided Make and Scons and static linking.
At this moment; the EXR libraries are a *dependency*, so you cannot get
the Orange branch compiled without having OpenEXR installed. Get the
(precompiled or sources) stuff from www.openexr.com. Current default is
that the headers and lib resides in /user/local/
Several changes/additions/fixes were added:
- EXR code only supported 'half' format (16 bits per channel). I've added
float writing, but for reading it I need tomorrow. :)
- Quite some clumsy copying of data happened in EXR code.
- cleaned up the api calls already a bit, preparing for more advanced
support
- Zbuffers were saved 16 bits, now 32 bits
- automatic adding of .exr extensions went wrong
Imbuf:
- added proper imbuf->flags and imbuf->mall support for float buffers, it
was created for *each* imbuf. :)
- found bugs for float buffers in scaling and flipping. Code there will
need more checks still
- imbuf also needs to be verified to behave properly when no 32 bits
rect exists (for saving for example)
TODO:
- support internal float images for textures, backbuf, AO probes, and
display in Image window
Hope this commit won't screwup syncing with bf-blender... :/
2006-01-09 01:40:35 +01:00
|
|
|
float *p1f, *dest1f, *dest2f;
|
2012-04-29 17:47:02 +02:00
|
|
|
int x, y;
|
2006-09-14 14:21:18 +02:00
|
|
|
int do_rect, do_float;
|
2002-10-12 13:37:38 +02:00
|
|
|
|
2012-05-16 11:26:37 +02:00
|
|
|
if (ibuf1 == NULL) return (NULL);
|
|
|
|
if (ibuf1->rect == NULL && ibuf1->rect_float == NULL) return (NULL);
|
2006-09-14 14:21:18 +02:00
|
|
|
|
2012-05-16 11:26:37 +02:00
|
|
|
do_rect = (ibuf1->rect != NULL);
|
|
|
|
do_float = (ibuf1->rect_float != NULL);
|
2002-10-12 13:37:38 +02:00
|
|
|
|
2012-04-29 17:47:02 +02:00
|
|
|
ibuf2 = IMB_allocImBuf(ibuf1->x, 2 * ibuf1->y, ibuf1->planes, ibuf1->flags);
|
2012-05-16 11:26:37 +02:00
|
|
|
if (ibuf2 == NULL) return (NULL);
|
2002-10-12 13:37:38 +02:00
|
|
|
|
|
|
|
p1 = (int *) ibuf1->rect;
|
2012-05-16 11:26:37 +02:00
|
|
|
dest1 = (int *) ibuf2->rect;
|
2007-01-22 18:43:36 +01:00
|
|
|
p1f = (float *) ibuf1->rect_float;
|
2012-05-16 11:26:37 +02:00
|
|
|
dest1f = (float *) ibuf2->rect_float;
|
2002-10-12 13:37:38 +02:00
|
|
|
|
2012-03-24 07:38:07 +01:00
|
|
|
for (y = ibuf1->y; y > 0; y--) {
|
2006-09-14 14:21:18 +02:00
|
|
|
if (do_rect) {
|
|
|
|
dest2 = dest1 + ibuf2->x;
|
2012-03-24 07:38:07 +01:00
|
|
|
for (x = ibuf2->x; x > 0; x--) *dest1++ = *dest2++ = *p1++;
|
2006-09-14 14:21:18 +02:00
|
|
|
dest1 = dest2;
|
|
|
|
}
|
2011-04-21 17:53:30 +02:00
|
|
|
if (do_float) {
|
2012-05-16 11:26:37 +02:00
|
|
|
dest2f = dest1f + (4 * ibuf2->x);
|
2012-03-24 07:38:07 +01:00
|
|
|
for (x = ibuf2->x * 4; x > 0; x--) *dest1f++ = *dest2f++ = *p1f++;
|
Orange branch: OpenEXR finally in Blender!
Credits go to Gernot Ziegler, who originally coded EXR support, and to
Austin Benesh for bringing it further. Kent Mein provided a lot of code
for integrating float buffers in Blender imbuf and ImBuf API cleanup,
and provided Make and Scons and static linking.
At this moment; the EXR libraries are a *dependency*, so you cannot get
the Orange branch compiled without having OpenEXR installed. Get the
(precompiled or sources) stuff from www.openexr.com. Current default is
that the headers and lib resides in /user/local/
Several changes/additions/fixes were added:
- EXR code only supported 'half' format (16 bits per channel). I've added
float writing, but for reading it I need tomorrow. :)
- Quite some clumsy copying of data happened in EXR code.
- cleaned up the api calls already a bit, preparing for more advanced
support
- Zbuffers were saved 16 bits, now 32 bits
- automatic adding of .exr extensions went wrong
Imbuf:
- added proper imbuf->flags and imbuf->mall support for float buffers, it
was created for *each* imbuf. :)
- found bugs for float buffers in scaling and flipping. Code there will
need more checks still
- imbuf also needs to be verified to behave properly when no 32 bits
rect exists (for saving for example)
TODO:
- support internal float images for textures, backbuf, AO probes, and
display in Image window
Hope this commit won't screwup syncing with bf-blender... :/
2006-01-09 01:40:35 +01:00
|
|
|
dest1f = dest2f;
|
|
|
|
}
|
2002-10-12 13:37:38 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
return (ibuf2);
|
|
|
|
}
|
|
|
|
|
|
|
|
struct ImBuf *IMB_double_y(struct ImBuf *ibuf1)
|
|
|
|
{
|
|
|
|
struct ImBuf *ibuf2;
|
|
|
|
|
2012-05-16 11:26:37 +02:00
|
|
|
if (ibuf1 == NULL) return (NULL);
|
|
|
|
if (ibuf1->rect == NULL) return (NULL);
|
2002-10-12 13:37:38 +02:00
|
|
|
|
|
|
|
ibuf2 = IMB_double_fast_y(ibuf1);
|
|
|
|
|
|
|
|
IMB_filtery(ibuf2);
|
|
|
|
return (ibuf2);
|
|
|
|
}
|
|
|
|
|
2010-12-14 19:02:41 +01:00
|
|
|
/* result in ibuf2, scaling should be done correctly */
|
|
|
|
void imb_onehalf_no_alloc(struct ImBuf *ibuf2, struct ImBuf *ibuf1)
|
2002-10-12 13:37:38 +02:00
|
|
|
{
|
2012-08-23 18:17:47 +02:00
|
|
|
int x, y;
|
2012-05-16 11:26:37 +02:00
|
|
|
const short do_rect = (ibuf1->rect != NULL);
|
|
|
|
const short do_float = (ibuf1->rect_float != NULL) && (ibuf2->rect_float != NULL);
|
2011-05-25 13:06:30 +02:00
|
|
|
|
2012-03-24 07:38:07 +01:00
|
|
|
if (do_rect && (ibuf2->rect == NULL)) {
|
2011-05-25 13:06:30 +02:00
|
|
|
imb_addrectImBuf(ibuf2);
|
|
|
|
}
|
2002-10-12 13:37:38 +02:00
|
|
|
|
2012-08-08 14:15:26 +02:00
|
|
|
if (do_rect) {
|
|
|
|
char *p1, *p2, *dest;
|
|
|
|
|
|
|
|
p1 = (char *) ibuf1->rect;
|
|
|
|
dest = (char *) ibuf2->rect;
|
|
|
|
for (y = ibuf2->y; y > 0; y--) {
|
|
|
|
p2 = p1 + (ibuf1->x << 2);
|
|
|
|
for (x = ibuf2->x; x > 0; x--) {
|
2006-09-14 14:21:18 +02:00
|
|
|
dest[0] = (p1[0] + p2[0] + p1[4] + p2[4]) >> 2;
|
|
|
|
dest[1] = (p1[1] + p2[1] + p1[5] + p2[5]) >> 2;
|
|
|
|
dest[2] = (p1[2] + p2[2] + p1[6] + p2[6]) >> 2;
|
|
|
|
dest[3] = (p1[3] + p2[3] + p1[7] + p2[7]) >> 2;
|
|
|
|
p1 += 8;
|
|
|
|
p2 += 8;
|
|
|
|
dest += 4;
|
|
|
|
}
|
2012-08-08 14:15:26 +02:00
|
|
|
p1 = p2;
|
|
|
|
if (ibuf1->x & 1) p1 += 4;
|
2002-10-12 13:37:38 +02:00
|
|
|
}
|
|
|
|
}
|
2010-12-14 19:02:41 +01:00
|
|
|
|
2012-08-08 14:15:26 +02:00
|
|
|
if (do_float) {
|
|
|
|
float *p1f, *p2f, *destf;
|
|
|
|
|
|
|
|
p1f = ibuf1->rect_float;
|
|
|
|
destf = ibuf2->rect_float;
|
|
|
|
for (y = ibuf2->y; y > 0; y--) {
|
|
|
|
p2f = p1f + (ibuf1->x << 2);
|
|
|
|
for (x = ibuf2->x; x > 0; x--) {
|
|
|
|
destf[0] = 0.25f * (p1f[0] + p2f[0] + p1f[4] + p2f[4]);
|
|
|
|
destf[1] = 0.25f * (p1f[1] + p2f[1] + p1f[5] + p2f[5]);
|
|
|
|
destf[2] = 0.25f * (p1f[2] + p2f[2] + p1f[6] + p2f[6]);
|
|
|
|
destf[3] = 0.25f * (p1f[3] + p2f[3] + p1f[7] + p2f[7]);
|
|
|
|
p1f += 8;
|
|
|
|
p2f += 8;
|
|
|
|
destf += 4;
|
|
|
|
}
|
|
|
|
p1f = p2f;
|
|
|
|
if (ibuf1->x & 1) p1f += 4;
|
|
|
|
}
|
|
|
|
}
|
2002-10-12 13:37:38 +02:00
|
|
|
}
|
|
|
|
|
2012-05-18 01:21:11 +02:00
|
|
|
ImBuf *IMB_onehalf(struct ImBuf *ibuf1)
|
|
|
|
{
|
2010-12-14 19:02:41 +01:00
|
|
|
struct ImBuf *ibuf2;
|
|
|
|
|
2012-05-16 11:26:37 +02:00
|
|
|
if (ibuf1 == NULL) return (NULL);
|
|
|
|
if (ibuf1->rect == NULL && ibuf1->rect_float == NULL) return (NULL);
|
2010-12-14 19:02:41 +01:00
|
|
|
|
|
|
|
if (ibuf1->x <= 1) return(IMB_half_y(ibuf1));
|
|
|
|
if (ibuf1->y <= 1) return(IMB_half_x(ibuf1));
|
|
|
|
|
2012-05-16 11:26:37 +02:00
|
|
|
ibuf2 = IMB_allocImBuf((ibuf1->x) / 2, (ibuf1->y) / 2, ibuf1->planes, ibuf1->flags);
|
|
|
|
if (ibuf2 == NULL) return (NULL);
|
2010-12-14 19:02:41 +01:00
|
|
|
|
|
|
|
imb_onehalf_no_alloc(ibuf2, ibuf1);
|
|
|
|
|
|
|
|
return (ibuf2);
|
|
|
|
}
|
2002-10-12 13:37:38 +02:00
|
|
|
|
2008-01-30 16:41:02 +01:00
|
|
|
/* q_scale_linear_interpolation helper functions */
|
|
|
|
|
|
|
|
static void enlarge_picture_byte(
|
2012-05-16 11:26:37 +02:00
|
|
|
unsigned char *src, unsigned char *dst, int src_width,
|
|
|
|
int src_height, int dst_width, int dst_height)
|
2008-01-30 16:41:02 +01:00
|
|
|
{
|
2012-05-09 11:24:15 +02:00
|
|
|
double ratiox = (double) (dst_width - 1.0) / (double) (src_width - 1.001);
|
|
|
|
double ratioy = (double) (dst_height - 1.0) / (double) (src_height - 1.001);
|
2008-08-17 19:08:00 +02:00
|
|
|
uintptr_t x_src, dx_src, x_dst;
|
|
|
|
uintptr_t y_src, dy_src, y_dst;
|
2008-01-30 16:41:02 +01:00
|
|
|
|
|
|
|
dx_src = 65536.0 / ratiox;
|
|
|
|
dy_src = 65536.0 / ratioy;
|
|
|
|
|
|
|
|
y_src = 0;
|
|
|
|
for (y_dst = 0; y_dst < dst_height; y_dst++) {
|
2012-05-16 11:26:37 +02:00
|
|
|
unsigned char *line1 = src + (y_src >> 16) * 4 * src_width;
|
|
|
|
unsigned char *line2 = line1 + 4 * src_width;
|
2008-08-17 19:08:00 +02:00
|
|
|
uintptr_t weight1y = 65536 - (y_src & 0xffff);
|
|
|
|
uintptr_t weight2y = 65536 - weight1y;
|
2008-01-30 16:41:02 +01:00
|
|
|
|
|
|
|
if ((y_src >> 16) == src_height - 1) {
|
|
|
|
line2 = line1;
|
|
|
|
}
|
|
|
|
|
|
|
|
x_src = 0;
|
|
|
|
for (x_dst = 0; x_dst < dst_width; x_dst++) {
|
2008-08-17 19:08:00 +02:00
|
|
|
uintptr_t weight1x = 65536 - (x_src & 0xffff);
|
|
|
|
uintptr_t weight2x = 65536 - weight1x;
|
2008-01-30 16:41:02 +01:00
|
|
|
|
|
|
|
unsigned long x = (x_src >> 16) * 4;
|
|
|
|
|
2012-05-09 11:24:15 +02:00
|
|
|
*dst++ = ((((line1[x] * weight1y) >> 16) * weight1x) >> 16) +
|
|
|
|
((((line2[x] * weight2y) >> 16) * weight1x) >> 16) +
|
|
|
|
((((line1[4 + x] * weight1y) >> 16) * weight2x) >> 16) +
|
|
|
|
((((line2[4 + x] * weight2y) >> 16) * weight2x) >> 16);
|
|
|
|
|
|
|
|
*dst++ = ((((line1[x + 1] * weight1y) >> 16) * weight1x) >> 16) +
|
|
|
|
((((line2[x + 1] * weight2y) >> 16) * weight1x) >> 16) +
|
|
|
|
((((line1[4 + x + 1] * weight1y) >> 16) * weight2x) >> 16) +
|
|
|
|
((((line2[4 + x + 1] * weight2y) >> 16) * weight2x) >> 16);
|
|
|
|
|
|
|
|
*dst++ = ((((line1[x + 2] * weight1y) >> 16) * weight1x) >> 16) +
|
|
|
|
((((line2[x + 2] * weight2y) >> 16) * weight1x) >> 16) +
|
|
|
|
((((line1[4 + x + 2] * weight1y) >> 16) * weight2x) >> 16) +
|
|
|
|
((((line2[4 + x + 2] * weight2y) >> 16) * weight2x) >> 16);
|
|
|
|
|
|
|
|
*dst++ = ((((line1[x + 3] * weight1y) >> 16) * weight1x) >> 16) +
|
|
|
|
((((line2[x + 3] * weight2y) >> 16) * weight1x) >> 16) +
|
|
|
|
((((line1[4 + x + 3] * weight1y) >> 16) * weight2x) >> 16) +
|
|
|
|
((((line2[4 + x + 3] * weight2y) >> 16) * weight2x) >> 16);
|
2008-01-30 16:41:02 +01:00
|
|
|
|
|
|
|
x_src += dx_src;
|
|
|
|
}
|
|
|
|
y_src += dy_src;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
struct scale_outpix_byte {
|
2008-08-17 19:08:00 +02:00
|
|
|
uintptr_t r;
|
|
|
|
uintptr_t g;
|
|
|
|
uintptr_t b;
|
|
|
|
uintptr_t a;
|
2008-01-30 16:41:02 +01:00
|
|
|
|
2008-08-17 19:08:00 +02:00
|
|
|
uintptr_t weight;
|
2008-01-30 16:41:02 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
static void shrink_picture_byte(
|
2012-05-16 11:26:37 +02:00
|
|
|
unsigned char *src, unsigned char *dst, int src_width,
|
|
|
|
int src_height, int dst_width, int dst_height)
|
2008-01-30 16:41:02 +01:00
|
|
|
{
|
|
|
|
double ratiox = (double) (dst_width) / (double) (src_width);
|
|
|
|
double ratioy = (double) (dst_height) / (double) (src_height);
|
2008-08-17 19:08:00 +02:00
|
|
|
uintptr_t x_src, dx_dst, x_dst;
|
|
|
|
uintptr_t y_src, dy_dst, y_dst;
|
|
|
|
intptr_t y_counter;
|
2012-05-16 11:26:37 +02:00
|
|
|
unsigned char *dst_begin = dst;
|
2008-01-30 16:41:02 +01:00
|
|
|
|
2012-05-16 11:26:37 +02:00
|
|
|
struct scale_outpix_byte *dst_line1 = NULL;
|
|
|
|
struct scale_outpix_byte *dst_line2 = NULL;
|
2008-01-30 16:41:02 +01:00
|
|
|
|
2012-05-16 11:26:37 +02:00
|
|
|
dst_line1 = (struct scale_outpix_byte *) MEM_callocN(
|
|
|
|
(dst_width + 1) * sizeof(struct scale_outpix_byte),
|
|
|
|
"shrink_picture_byte 1");
|
|
|
|
dst_line2 = (struct scale_outpix_byte *) MEM_callocN(
|
|
|
|
(dst_width + 1) * sizeof(struct scale_outpix_byte),
|
|
|
|
"shrink_picture_byte 2");
|
2008-01-30 16:41:02 +01:00
|
|
|
|
|
|
|
dx_dst = 65536.0 * ratiox;
|
|
|
|
dy_dst = 65536.0 * ratioy;
|
|
|
|
|
|
|
|
y_dst = 0;
|
|
|
|
y_counter = 65536;
|
|
|
|
for (y_src = 0; y_src < src_height; y_src++) {
|
2012-05-16 11:26:37 +02:00
|
|
|
unsigned char *line = src + y_src * 4 * src_width;
|
2009-05-18 12:34:26 +02:00
|
|
|
uintptr_t weight1y = 65535 - (y_dst & 0xffff);
|
|
|
|
uintptr_t weight2y = 65535 - weight1y;
|
2008-01-30 16:41:02 +01:00
|
|
|
x_dst = 0;
|
|
|
|
for (x_src = 0; x_src < src_width; x_src++) {
|
2009-05-18 12:34:26 +02:00
|
|
|
uintptr_t weight1x = 65535 - (x_dst & 0xffff);
|
|
|
|
uintptr_t weight2x = 65535 - weight1x;
|
2008-01-30 16:41:02 +01:00
|
|
|
|
2008-08-17 19:08:00 +02:00
|
|
|
uintptr_t x = x_dst >> 16;
|
2008-01-30 16:41:02 +01:00
|
|
|
|
2008-08-17 19:08:00 +02:00
|
|
|
uintptr_t w;
|
2008-01-30 16:41:02 +01:00
|
|
|
|
|
|
|
w = (weight1y * weight1x) >> 16;
|
|
|
|
|
2009-05-18 12:34:26 +02:00
|
|
|
/* ensure correct rounding, without this you get ugly banding, or too low color values (ton) */
|
2009-04-29 13:20:07 +02:00
|
|
|
dst_line1[x].r += (line[0] * w + 32767) >> 16;
|
|
|
|
dst_line1[x].g += (line[1] * w + 32767) >> 16;
|
|
|
|
dst_line1[x].b += (line[2] * w + 32767) >> 16;
|
|
|
|
dst_line1[x].a += (line[3] * w + 32767) >> 16;
|
2008-01-30 16:41:02 +01:00
|
|
|
dst_line1[x].weight += w;
|
|
|
|
|
|
|
|
w = (weight2y * weight1x) >> 16;
|
|
|
|
|
2009-04-29 13:20:07 +02:00
|
|
|
dst_line2[x].r += (line[0] * w + 32767) >> 16;
|
|
|
|
dst_line2[x].g += (line[1] * w + 32767) >> 16;
|
|
|
|
dst_line2[x].b += (line[2] * w + 32767) >> 16;
|
|
|
|
dst_line2[x].a += (line[3] * w + 32767) >> 16;
|
2008-01-30 16:41:02 +01:00
|
|
|
dst_line2[x].weight += w;
|
|
|
|
|
|
|
|
w = (weight1y * weight2x) >> 16;
|
|
|
|
|
2012-05-16 11:26:37 +02:00
|
|
|
dst_line1[x + 1].r += (line[0] * w + 32767) >> 16;
|
|
|
|
dst_line1[x + 1].g += (line[1] * w + 32767) >> 16;
|
|
|
|
dst_line1[x + 1].b += (line[2] * w + 32767) >> 16;
|
|
|
|
dst_line1[x + 1].a += (line[3] * w + 32767) >> 16;
|
|
|
|
dst_line1[x + 1].weight += w;
|
2008-01-30 16:41:02 +01:00
|
|
|
|
|
|
|
w = (weight2y * weight2x) >> 16;
|
|
|
|
|
2012-05-16 11:26:37 +02:00
|
|
|
dst_line2[x + 1].r += (line[0] * w + 32767) >> 16;
|
|
|
|
dst_line2[x + 1].g += (line[1] * w + 32767) >> 16;
|
|
|
|
dst_line2[x + 1].b += (line[2] * w + 32767) >> 16;
|
|
|
|
dst_line2[x + 1].a += (line[3] * w + 32767) >> 16;
|
|
|
|
dst_line2[x + 1].weight += w;
|
2008-01-30 16:41:02 +01:00
|
|
|
|
|
|
|
x_dst += dx_dst;
|
|
|
|
line += 4;
|
|
|
|
}
|
|
|
|
|
|
|
|
y_dst += dy_dst;
|
|
|
|
y_counter -= dy_dst;
|
|
|
|
if (y_counter < 0) {
|
2009-05-18 12:34:26 +02:00
|
|
|
int val;
|
2008-08-17 19:08:00 +02:00
|
|
|
uintptr_t x;
|
2012-05-16 11:26:37 +02:00
|
|
|
struct scale_outpix_byte *temp;
|
2008-01-30 16:41:02 +01:00
|
|
|
|
|
|
|
y_counter += 65536;
|
|
|
|
|
2012-05-16 11:26:37 +02:00
|
|
|
for (x = 0; x < dst_width; x++) {
|
2009-05-18 12:34:26 +02:00
|
|
|
uintptr_t f = 0x80000000UL / dst_line1[x].weight;
|
2012-05-16 11:26:37 +02:00
|
|
|
*dst++ = (val = (dst_line1[x].r * f) >> 15) > 255 ? 255 : val;
|
|
|
|
*dst++ = (val = (dst_line1[x].g * f) >> 15) > 255 ? 255 : val;
|
|
|
|
*dst++ = (val = (dst_line1[x].b * f) >> 15) > 255 ? 255 : val;
|
|
|
|
*dst++ = (val = (dst_line1[x].a * f) >> 15) > 255 ? 255 : val;
|
2008-01-30 16:41:02 +01:00
|
|
|
}
|
|
|
|
memset(dst_line1, 0, dst_width *
|
2011-11-11 14:09:14 +01:00
|
|
|
sizeof(struct scale_outpix_byte));
|
2008-01-30 16:41:02 +01:00
|
|
|
temp = dst_line1;
|
|
|
|
dst_line1 = dst_line2;
|
|
|
|
dst_line2 = temp;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (dst - dst_begin < dst_width * dst_height * 4) {
|
2009-05-18 12:34:26 +02:00
|
|
|
int val;
|
2008-08-17 19:08:00 +02:00
|
|
|
uintptr_t x;
|
2008-01-30 16:41:02 +01:00
|
|
|
for (x = 0; x < dst_width; x++) {
|
2008-08-17 19:08:00 +02:00
|
|
|
uintptr_t f = 0x80000000UL / dst_line1[x].weight;
|
2012-05-16 11:26:37 +02:00
|
|
|
*dst++ = (val = (dst_line1[x].r * f) >> 15) > 255 ? 255 : val;
|
|
|
|
*dst++ = (val = (dst_line1[x].g * f) >> 15) > 255 ? 255 : val;
|
|
|
|
*dst++ = (val = (dst_line1[x].b * f) >> 15) > 255 ? 255 : val;
|
|
|
|
*dst++ = (val = (dst_line1[x].a * f) >> 15) > 255 ? 255 : val;
|
2008-01-30 16:41:02 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
MEM_freeN(dst_line1);
|
|
|
|
MEM_freeN(dst_line2);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-05-16 11:26:37 +02:00
|
|
|
static void q_scale_byte(unsigned char *in, unsigned char *out, int in_width,
|
|
|
|
int in_height, int dst_width, int dst_height)
|
2008-01-30 16:41:02 +01:00
|
|
|
{
|
|
|
|
if (dst_width > in_width && dst_height > in_height) {
|
|
|
|
enlarge_picture_byte(in, out, in_width, in_height,
|
2012-05-16 11:26:37 +02:00
|
|
|
dst_width, dst_height);
|
2012-03-24 07:38:07 +01:00
|
|
|
}
|
|
|
|
else if (dst_width < in_width && dst_height < in_height) {
|
2008-01-30 16:41:02 +01:00
|
|
|
shrink_picture_byte(in, out, in_width, in_height,
|
2012-05-16 11:26:37 +02:00
|
|
|
dst_width, dst_height);
|
2008-01-30 16:41:02 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void enlarge_picture_float(
|
2012-05-16 11:26:37 +02:00
|
|
|
float *src, float *dst, int src_width,
|
|
|
|
int src_height, int dst_width, int dst_height)
|
2008-01-30 16:41:02 +01:00
|
|
|
{
|
2012-05-09 11:24:15 +02:00
|
|
|
double ratiox = (double) (dst_width - 1.0) / (double) (src_width - 1.001);
|
|
|
|
double ratioy = (double) (dst_height - 1.0) / (double) (src_height - 1.001);
|
2008-08-17 19:08:00 +02:00
|
|
|
uintptr_t x_dst;
|
|
|
|
uintptr_t y_dst;
|
2008-01-30 16:41:02 +01:00
|
|
|
double x_src, dx_src;
|
|
|
|
double y_src, dy_src;
|
|
|
|
|
|
|
|
dx_src = 1.0 / ratiox;
|
|
|
|
dy_src = 1.0 / ratioy;
|
|
|
|
|
|
|
|
y_src = 0;
|
|
|
|
for (y_dst = 0; y_dst < dst_height; y_dst++) {
|
2012-05-16 11:26:37 +02:00
|
|
|
float *line1 = src + ((int) y_src) * 4 * src_width;
|
|
|
|
float *line2 = line1 + 4 * src_width;
|
2011-03-27 19:12:59 +02:00
|
|
|
const float weight1y = (float)(1.0 - (y_src - (int) y_src));
|
|
|
|
const float weight2y = 1.0f - weight1y;
|
2008-01-30 16:41:02 +01:00
|
|
|
|
|
|
|
if ((int) y_src == src_height - 1) {
|
|
|
|
line2 = line1;
|
|
|
|
}
|
2011-04-21 15:11:51 +02:00
|
|
|
|
2008-01-30 16:41:02 +01:00
|
|
|
x_src = 0;
|
|
|
|
for (x_dst = 0; x_dst < dst_width; x_dst++) {
|
2011-03-27 19:12:59 +02:00
|
|
|
const float weight1x = (float)(1.0 - (x_src - (int) x_src));
|
|
|
|
const float weight2x = (float)(1.0f - weight1x);
|
2008-01-30 16:41:02 +01:00
|
|
|
|
2011-03-27 19:12:59 +02:00
|
|
|
const float w11 = weight1y * weight1x;
|
|
|
|
const float w21 = weight2y * weight1x;
|
|
|
|
const float w12 = weight1y * weight2x;
|
|
|
|
const float w22 = weight2y * weight2x;
|
2008-01-30 16:41:02 +01:00
|
|
|
|
2008-08-17 19:08:00 +02:00
|
|
|
uintptr_t x = ((int) x_src) * 4;
|
2008-01-30 16:41:02 +01:00
|
|
|
|
2012-05-16 11:26:37 +02:00
|
|
|
*dst++ = line1[x] * w11 +
|
2012-05-09 11:24:15 +02:00
|
|
|
line2[x] * w21 +
|
|
|
|
line1[4 + x] * w12 +
|
|
|
|
line2[4 + x] * w22;
|
|
|
|
|
|
|
|
*dst++ = line1[x + 1] * w11 +
|
|
|
|
line2[x + 1] * w21 +
|
|
|
|
line1[4 + x + 1] * w12 +
|
|
|
|
line2[4 + x + 1] * w22;
|
|
|
|
|
|
|
|
*dst++ = line1[x + 2] * w11 +
|
|
|
|
line2[x + 2] * w21 +
|
|
|
|
line1[4 + x + 2] * w12 +
|
|
|
|
line2[4 + x + 2] * w22;
|
|
|
|
|
|
|
|
*dst++ = line1[x + 3] * w11 +
|
|
|
|
line2[x + 3] * w21 +
|
|
|
|
line1[4 + x + 3] * w12 +
|
|
|
|
line2[4 + x + 3] * w22;
|
2008-01-30 16:41:02 +01:00
|
|
|
|
|
|
|
x_src += dx_src;
|
|
|
|
}
|
|
|
|
y_src += dy_src;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
struct scale_outpix_float {
|
|
|
|
float r;
|
|
|
|
float g;
|
|
|
|
float b;
|
|
|
|
float a;
|
|
|
|
|
|
|
|
float weight;
|
|
|
|
};
|
|
|
|
|
|
|
|
static void shrink_picture_float(
|
2012-05-16 11:26:37 +02:00
|
|
|
float *src, float *dst, int src_width,
|
|
|
|
int src_height, int dst_width, int dst_height)
|
2008-01-30 16:41:02 +01:00
|
|
|
{
|
|
|
|
double ratiox = (double) (dst_width) / (double) (src_width);
|
|
|
|
double ratioy = (double) (dst_height) / (double) (src_height);
|
2008-08-17 19:08:00 +02:00
|
|
|
uintptr_t x_src;
|
|
|
|
uintptr_t y_src;
|
2012-05-16 11:26:37 +02:00
|
|
|
float dx_dst, x_dst;
|
2008-01-30 16:41:02 +01:00
|
|
|
float dy_dst, y_dst;
|
|
|
|
float y_counter;
|
2012-05-16 11:26:37 +02:00
|
|
|
float *dst_begin = dst;
|
2008-01-30 16:41:02 +01:00
|
|
|
|
2012-05-16 11:26:37 +02:00
|
|
|
struct scale_outpix_float *dst_line1;
|
|
|
|
struct scale_outpix_float *dst_line2;
|
2008-01-30 16:41:02 +01:00
|
|
|
|
2012-05-16 11:26:37 +02:00
|
|
|
dst_line1 = (struct scale_outpix_float *) MEM_callocN(
|
|
|
|
(dst_width + 1) * sizeof(struct scale_outpix_float),
|
|
|
|
"shrink_picture_float 1");
|
|
|
|
dst_line2 = (struct scale_outpix_float *) MEM_callocN(
|
|
|
|
(dst_width + 1) * sizeof(struct scale_outpix_float),
|
|
|
|
"shrink_picture_float 2");
|
2008-01-30 16:41:02 +01:00
|
|
|
|
|
|
|
dx_dst = ratiox;
|
|
|
|
dy_dst = ratioy;
|
|
|
|
|
|
|
|
y_dst = 0;
|
|
|
|
y_counter = 1.0;
|
|
|
|
for (y_src = 0; y_src < src_height; y_src++) {
|
2012-05-16 11:26:37 +02:00
|
|
|
float *line = src + y_src * 4 * src_width;
|
2011-03-27 19:12:59 +02:00
|
|
|
uintptr_t weight1y = 1.0f - (y_dst - (int) y_dst);
|
|
|
|
uintptr_t weight2y = 1.0f - weight1y;
|
2008-01-30 16:41:02 +01:00
|
|
|
x_dst = 0;
|
|
|
|
for (x_src = 0; x_src < src_width; x_src++) {
|
2011-03-27 19:12:59 +02:00
|
|
|
uintptr_t weight1x = 1.0f - (x_dst - (int) x_dst);
|
|
|
|
uintptr_t weight2x = 1.0f - weight1x;
|
2008-01-30 16:41:02 +01:00
|
|
|
|
2008-08-17 19:08:00 +02:00
|
|
|
uintptr_t x = (int) x_dst;
|
2008-01-30 16:41:02 +01:00
|
|
|
|
|
|
|
float w;
|
|
|
|
|
|
|
|
w = weight1y * weight1x;
|
|
|
|
|
|
|
|
dst_line1[x].r += line[0] * w;
|
|
|
|
dst_line1[x].g += line[1] * w;
|
|
|
|
dst_line1[x].b += line[2] * w;
|
|
|
|
dst_line1[x].a += line[3] * w;
|
|
|
|
dst_line1[x].weight += w;
|
|
|
|
|
|
|
|
w = weight2y * weight1x;
|
|
|
|
|
|
|
|
dst_line2[x].r += line[0] * w;
|
|
|
|
dst_line2[x].g += line[1] * w;
|
|
|
|
dst_line2[x].b += line[2] * w;
|
|
|
|
dst_line2[x].a += line[3] * w;
|
|
|
|
dst_line2[x].weight += w;
|
|
|
|
|
|
|
|
w = weight1y * weight2x;
|
|
|
|
|
2012-05-16 11:26:37 +02:00
|
|
|
dst_line1[x + 1].r += line[0] * w;
|
|
|
|
dst_line1[x + 1].g += line[1] * w;
|
|
|
|
dst_line1[x + 1].b += line[2] * w;
|
|
|
|
dst_line1[x + 1].a += line[3] * w;
|
|
|
|
dst_line1[x + 1].weight += w;
|
2008-01-30 16:41:02 +01:00
|
|
|
|
|
|
|
w = weight2y * weight2x;
|
|
|
|
|
2012-05-16 11:26:37 +02:00
|
|
|
dst_line2[x + 1].r += line[0] * w;
|
|
|
|
dst_line2[x + 1].g += line[1] * w;
|
|
|
|
dst_line2[x + 1].b += line[2] * w;
|
|
|
|
dst_line2[x + 1].a += line[3] * w;
|
|
|
|
dst_line2[x + 1].weight += w;
|
2008-01-30 16:41:02 +01:00
|
|
|
|
|
|
|
x_dst += dx_dst;
|
|
|
|
line += 4;
|
|
|
|
}
|
|
|
|
|
|
|
|
y_dst += dy_dst;
|
|
|
|
y_counter -= dy_dst;
|
|
|
|
if (y_counter < 0) {
|
2008-08-17 19:08:00 +02:00
|
|
|
uintptr_t x;
|
2012-05-16 11:26:37 +02:00
|
|
|
struct scale_outpix_float *temp;
|
2008-01-30 16:41:02 +01:00
|
|
|
|
2011-03-27 19:12:59 +02:00
|
|
|
y_counter += 1.0f;
|
2008-01-30 16:41:02 +01:00
|
|
|
|
2012-05-16 11:26:37 +02:00
|
|
|
for (x = 0; x < dst_width; x++) {
|
2011-03-27 19:12:59 +02:00
|
|
|
float f = 1.0f / dst_line1[x].weight;
|
2008-01-30 16:41:02 +01:00
|
|
|
*dst++ = dst_line1[x].r * f;
|
|
|
|
*dst++ = dst_line1[x].g * f;
|
|
|
|
*dst++ = dst_line1[x].b * f;
|
|
|
|
*dst++ = dst_line1[x].a * f;
|
|
|
|
}
|
|
|
|
memset(dst_line1, 0, dst_width *
|
2011-11-11 14:09:14 +01:00
|
|
|
sizeof(struct scale_outpix_float));
|
2008-01-30 16:41:02 +01:00
|
|
|
temp = dst_line1;
|
|
|
|
dst_line1 = dst_line2;
|
|
|
|
dst_line2 = temp;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (dst - dst_begin < dst_width * dst_height * 4) {
|
2008-08-17 19:08:00 +02:00
|
|
|
uintptr_t x;
|
2008-01-30 16:41:02 +01:00
|
|
|
for (x = 0; x < dst_width; x++) {
|
2011-03-27 19:12:59 +02:00
|
|
|
float f = 1.0f / dst_line1[x].weight;
|
2008-01-30 16:41:02 +01:00
|
|
|
*dst++ = dst_line1[x].r * f;
|
|
|
|
*dst++ = dst_line1[x].g * f;
|
|
|
|
*dst++ = dst_line1[x].b * f;
|
|
|
|
*dst++ = dst_line1[x].a * f;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
MEM_freeN(dst_line1);
|
|
|
|
MEM_freeN(dst_line2);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-05-16 11:26:37 +02:00
|
|
|
static void q_scale_float(float *in, float *out, int in_width,
|
|
|
|
int in_height, int dst_width, int dst_height)
|
2008-01-30 16:41:02 +01:00
|
|
|
{
|
|
|
|
if (dst_width > in_width && dst_height > in_height) {
|
|
|
|
enlarge_picture_float(in, out, in_width, in_height,
|
2012-05-16 11:26:37 +02:00
|
|
|
dst_width, dst_height);
|
2012-03-24 07:38:07 +01:00
|
|
|
}
|
|
|
|
else if (dst_width < in_width && dst_height < in_height) {
|
2008-01-30 16:41:02 +01:00
|
|
|
shrink_picture_float(in, out, in_width, in_height,
|
2012-05-16 11:26:37 +02:00
|
|
|
dst_width, dst_height);
|
2008-01-30 16:41:02 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-03-09 19:28:30 +01:00
|
|
|
/**
|
|
|
|
* q_scale_linear_interpolation (derived from ppmqscale, http://libdv.sf.net)
|
|
|
|
*
|
|
|
|
* q stands for quick _and_ quality :)
|
|
|
|
*
|
|
|
|
* only handles common cases when we either
|
|
|
|
*
|
|
|
|
* scale both, x and y or
|
|
|
|
* shrink both, x and y
|
|
|
|
*
|
|
|
|
* but that is pretty fast:
|
|
|
|
* - does only blit once instead of two passes like the old code
|
|
|
|
* (fewer cache misses)
|
|
|
|
* - uses fixed point integer arithmetic for byte buffers
|
|
|
|
* - doesn't branch in tight loops
|
|
|
|
*
|
|
|
|
* Should be comparable in speed to the ImBuf ..._fast functions at least
|
|
|
|
* for byte-buffers.
|
|
|
|
*
|
2012-07-17 01:23:33 +02:00
|
|
|
* NOTE: disabled, due to unacceptable inaccuracy and quality loss, see bug #18609 (ton)
|
2012-03-09 19:28:30 +01:00
|
|
|
*/
|
2008-01-30 16:41:02 +01:00
|
|
|
static int q_scale_linear_interpolation(
|
2012-05-16 11:26:37 +02:00
|
|
|
struct ImBuf *ibuf, int newx, int newy)
|
2008-01-30 16:41:02 +01:00
|
|
|
{
|
2008-04-09 19:14:02 +02:00
|
|
|
if ((newx >= ibuf->x && newy <= ibuf->y) ||
|
2012-05-16 11:26:37 +02:00
|
|
|
(newx <= ibuf->x && newy >= ibuf->y))
|
|
|
|
{
|
2008-01-30 16:41:02 +01:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ibuf->rect) {
|
2012-05-16 11:26:37 +02:00
|
|
|
unsigned char *newrect =
|
|
|
|
MEM_mallocN(newx * newy * sizeof(int), "q_scale rect");
|
2008-02-08 16:36:39 +01:00
|
|
|
q_scale_byte((unsigned char *)ibuf->rect, newrect, ibuf->x, ibuf->y,
|
2011-11-11 14:09:14 +01:00
|
|
|
newx, newy);
|
2008-01-30 16:41:02 +01:00
|
|
|
|
|
|
|
imb_freerectImBuf(ibuf);
|
|
|
|
ibuf->mall |= IB_rect;
|
|
|
|
ibuf->rect = (unsigned int *) newrect;
|
|
|
|
}
|
|
|
|
if (ibuf->rect_float) {
|
2012-05-16 11:26:37 +02:00
|
|
|
float *newrect =
|
|
|
|
MEM_mallocN(newx * newy * 4 * sizeof(float),
|
|
|
|
"q_scale rectfloat");
|
2008-01-30 16:41:02 +01:00
|
|
|
q_scale_float(ibuf->rect_float, newrect, ibuf->x, ibuf->y,
|
2011-11-11 14:09:14 +01:00
|
|
|
newx, newy);
|
2008-01-30 16:41:02 +01:00
|
|
|
imb_freerectfloatImBuf(ibuf);
|
|
|
|
ibuf->mall |= IB_rectfloat;
|
|
|
|
ibuf->rect_float = newrect;
|
|
|
|
}
|
|
|
|
ibuf->x = newx;
|
|
|
|
ibuf->y = newy;
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
2002-10-12 13:37:38 +02:00
|
|
|
|
2012-05-18 01:21:11 +02:00
|
|
|
static ImBuf *scaledownx(struct ImBuf *ibuf, int newx)
|
2002-10-12 13:37:38 +02:00
|
|
|
{
|
2012-05-16 11:26:37 +02:00
|
|
|
const int do_rect = (ibuf->rect != NULL);
|
|
|
|
const int do_float = (ibuf->rect_float != NULL);
|
|
|
|
const size_t rect_size = ibuf->x * ibuf->y * 4;
|
2011-04-08 05:53:40 +02:00
|
|
|
|
2006-03-14 10:40:55 +01:00
|
|
|
uchar *rect, *_newrect, *newrect;
|
|
|
|
float *rectf, *_newrectf, *newrectf;
|
|
|
|
float sample, add, val[4], nval[4], valf[4], nvalf[4];
|
2011-04-08 05:53:40 +02:00
|
|
|
int x, y;
|
2002-10-12 13:37:38 +02:00
|
|
|
|
2012-05-16 11:26:37 +02:00
|
|
|
rectf = _newrectf = newrectf = NULL;
|
|
|
|
rect = _newrect = newrect = NULL;
|
|
|
|
nval[0] = nval[1] = nval[2] = nval[3] = 0.0f;
|
|
|
|
nvalf[0] = nvalf[1] = nvalf[2] = nvalf[3] = 0.0f;
|
2006-09-14 14:21:18 +02:00
|
|
|
|
2011-04-08 05:53:40 +02:00
|
|
|
if (!do_rect && !do_float) return (ibuf);
|
|
|
|
|
|
|
|
if (do_rect) {
|
|
|
|
_newrect = MEM_mallocN(newx * ibuf->y * sizeof(uchar) * 4, "scaledownx");
|
2012-05-16 11:26:37 +02:00
|
|
|
if (_newrect == NULL) return(ibuf);
|
2006-09-14 14:21:18 +02:00
|
|
|
}
|
2011-04-08 05:53:40 +02:00
|
|
|
if (do_float) {
|
Orange branch: OpenEXR finally in Blender!
Credits go to Gernot Ziegler, who originally coded EXR support, and to
Austin Benesh for bringing it further. Kent Mein provided a lot of code
for integrating float buffers in Blender imbuf and ImBuf API cleanup,
and provided Make and Scons and static linking.
At this moment; the EXR libraries are a *dependency*, so you cannot get
the Orange branch compiled without having OpenEXR installed. Get the
(precompiled or sources) stuff from www.openexr.com. Current default is
that the headers and lib resides in /user/local/
Several changes/additions/fixes were added:
- EXR code only supported 'half' format (16 bits per channel). I've added
float writing, but for reading it I need tomorrow. :)
- Quite some clumsy copying of data happened in EXR code.
- cleaned up the api calls already a bit, preparing for more advanced
support
- Zbuffers were saved 16 bits, now 32 bits
- automatic adding of .exr extensions went wrong
Imbuf:
- added proper imbuf->flags and imbuf->mall support for float buffers, it
was created for *each* imbuf. :)
- found bugs for float buffers in scaling and flipping. Code there will
need more checks still
- imbuf also needs to be verified to behave properly when no 32 bits
rect exists (for saving for example)
TODO:
- support internal float images for textures, backbuf, AO probes, and
display in Image window
Hope this commit won't screwup syncing with bf-blender... :/
2006-01-09 01:40:35 +01:00
|
|
|
_newrectf = MEM_mallocN(newx * ibuf->y * sizeof(float) * 4, "scaledownxf");
|
2012-05-16 11:26:37 +02:00
|
|
|
if (_newrectf == NULL) {
|
2006-09-14 14:21:18 +02:00
|
|
|
if (_newrect) MEM_freeN(_newrect);
|
|
|
|
return(ibuf);
|
|
|
|
}
|
Orange branch: OpenEXR finally in Blender!
Credits go to Gernot Ziegler, who originally coded EXR support, and to
Austin Benesh for bringing it further. Kent Mein provided a lot of code
for integrating float buffers in Blender imbuf and ImBuf API cleanup,
and provided Make and Scons and static linking.
At this moment; the EXR libraries are a *dependency*, so you cannot get
the Orange branch compiled without having OpenEXR installed. Get the
(precompiled or sources) stuff from www.openexr.com. Current default is
that the headers and lib resides in /user/local/
Several changes/additions/fixes were added:
- EXR code only supported 'half' format (16 bits per channel). I've added
float writing, but for reading it I need tomorrow. :)
- Quite some clumsy copying of data happened in EXR code.
- cleaned up the api calls already a bit, preparing for more advanced
support
- Zbuffers were saved 16 bits, now 32 bits
- automatic adding of .exr extensions went wrong
Imbuf:
- added proper imbuf->flags and imbuf->mall support for float buffers, it
was created for *each* imbuf. :)
- found bugs for float buffers in scaling and flipping. Code there will
need more checks still
- imbuf also needs to be verified to behave properly when no 32 bits
rect exists (for saving for example)
TODO:
- support internal float images for textures, backbuf, AO probes, and
display in Image window
Hope this commit won't screwup syncing with bf-blender... :/
2006-01-09 01:40:35 +01:00
|
|
|
}
|
2002-10-12 13:37:38 +02:00
|
|
|
|
2011-03-17 12:08:25 +01:00
|
|
|
add = (ibuf->x - 0.01) / newx;
|
2002-10-12 13:37:38 +02:00
|
|
|
|
2006-09-14 14:21:18 +02:00
|
|
|
if (do_rect) {
|
|
|
|
rect = (uchar *) ibuf->rect;
|
|
|
|
newrect = _newrect;
|
|
|
|
}
|
2006-03-14 18:48:40 +01:00
|
|
|
if (do_float) {
|
|
|
|
rectf = ibuf->rect_float;
|
|
|
|
newrectf = _newrectf;
|
|
|
|
}
|
2006-03-14 10:40:55 +01:00
|
|
|
|
2012-02-27 11:35:39 +01:00
|
|
|
for (y = ibuf->y; y > 0; y--) {
|
2006-03-14 10:40:55 +01:00
|
|
|
sample = 0.0f;
|
2012-05-16 11:26:37 +02:00
|
|
|
val[0] = val[1] = val[2] = val[3] = 0.0f;
|
|
|
|
valf[0] = valf[1] = valf[2] = valf[3] = 0.0f;
|
2006-03-14 10:40:55 +01:00
|
|
|
|
2012-02-27 11:35:39 +01:00
|
|
|
for (x = newx; x > 0; x--) {
|
2006-09-14 14:21:18 +02:00
|
|
|
if (do_rect) {
|
2012-05-16 11:26:37 +02:00
|
|
|
nval[0] = -val[0] * sample;
|
|
|
|
nval[1] = -val[1] * sample;
|
|
|
|
nval[2] = -val[2] * sample;
|
|
|
|
nval[3] = -val[3] * sample;
|
2006-09-14 14:21:18 +02:00
|
|
|
}
|
2006-03-14 10:40:55 +01:00
|
|
|
if (do_float) {
|
2012-05-16 11:26:37 +02:00
|
|
|
nvalf[0] = -valf[0] * sample;
|
|
|
|
nvalf[1] = -valf[1] * sample;
|
|
|
|
nvalf[2] = -valf[2] * sample;
|
|
|
|
nvalf[3] = -valf[3] * sample;
|
2006-03-14 10:40:55 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
sample += add;
|
|
|
|
|
2012-02-27 11:35:39 +01:00
|
|
|
while (sample >= 1.0f) {
|
2006-03-14 10:40:55 +01:00
|
|
|
sample -= 1.0f;
|
|
|
|
|
2006-09-14 14:21:18 +02:00
|
|
|
if (do_rect) {
|
|
|
|
nval[0] += rect[0];
|
|
|
|
nval[1] += rect[1];
|
|
|
|
nval[2] += rect[2];
|
|
|
|
nval[3] += rect[3];
|
|
|
|
rect += 4;
|
|
|
|
}
|
Orange branch: OpenEXR finally in Blender!
Credits go to Gernot Ziegler, who originally coded EXR support, and to
Austin Benesh for bringing it further. Kent Mein provided a lot of code
for integrating float buffers in Blender imbuf and ImBuf API cleanup,
and provided Make and Scons and static linking.
At this moment; the EXR libraries are a *dependency*, so you cannot get
the Orange branch compiled without having OpenEXR installed. Get the
(precompiled or sources) stuff from www.openexr.com. Current default is
that the headers and lib resides in /user/local/
Several changes/additions/fixes were added:
- EXR code only supported 'half' format (16 bits per channel). I've added
float writing, but for reading it I need tomorrow. :)
- Quite some clumsy copying of data happened in EXR code.
- cleaned up the api calls already a bit, preparing for more advanced
support
- Zbuffers were saved 16 bits, now 32 bits
- automatic adding of .exr extensions went wrong
Imbuf:
- added proper imbuf->flags and imbuf->mall support for float buffers, it
was created for *each* imbuf. :)
- found bugs for float buffers in scaling and flipping. Code there will
need more checks still
- imbuf also needs to be verified to behave properly when no 32 bits
rect exists (for saving for example)
TODO:
- support internal float images for textures, backbuf, AO probes, and
display in Image window
Hope this commit won't screwup syncing with bf-blender... :/
2006-01-09 01:40:35 +01:00
|
|
|
if (do_float) {
|
2006-03-14 10:40:55 +01:00
|
|
|
nvalf[0] += rectf[0];
|
|
|
|
nvalf[1] += rectf[1];
|
|
|
|
nvalf[2] += rectf[2];
|
|
|
|
nvalf[3] += rectf[3];
|
Orange branch: OpenEXR finally in Blender!
Credits go to Gernot Ziegler, who originally coded EXR support, and to
Austin Benesh for bringing it further. Kent Mein provided a lot of code
for integrating float buffers in Blender imbuf and ImBuf API cleanup,
and provided Make and Scons and static linking.
At this moment; the EXR libraries are a *dependency*, so you cannot get
the Orange branch compiled without having OpenEXR installed. Get the
(precompiled or sources) stuff from www.openexr.com. Current default is
that the headers and lib resides in /user/local/
Several changes/additions/fixes were added:
- EXR code only supported 'half' format (16 bits per channel). I've added
float writing, but for reading it I need tomorrow. :)
- Quite some clumsy copying of data happened in EXR code.
- cleaned up the api calls already a bit, preparing for more advanced
support
- Zbuffers were saved 16 bits, now 32 bits
- automatic adding of .exr extensions went wrong
Imbuf:
- added proper imbuf->flags and imbuf->mall support for float buffers, it
was created for *each* imbuf. :)
- found bugs for float buffers in scaling and flipping. Code there will
need more checks still
- imbuf also needs to be verified to behave properly when no 32 bits
rect exists (for saving for example)
TODO:
- support internal float images for textures, backbuf, AO probes, and
display in Image window
Hope this commit won't screwup syncing with bf-blender... :/
2006-01-09 01:40:35 +01:00
|
|
|
rectf += 4;
|
|
|
|
}
|
2002-10-12 13:37:38 +02:00
|
|
|
}
|
2006-03-14 10:40:55 +01:00
|
|
|
|
2006-09-14 14:21:18 +02:00
|
|
|
if (do_rect) {
|
2012-05-16 11:26:37 +02:00
|
|
|
val[0] = rect[0]; val[1] = rect[1]; val[2] = rect[2]; val[3] = rect[3];
|
2006-09-14 14:21:18 +02:00
|
|
|
rect += 4;
|
|
|
|
|
2012-05-16 11:26:37 +02:00
|
|
|
newrect[0] = ((nval[0] + sample * val[0]) / add + 0.5f);
|
|
|
|
newrect[1] = ((nval[1] + sample * val[1]) / add + 0.5f);
|
|
|
|
newrect[2] = ((nval[2] + sample * val[2]) / add + 0.5f);
|
|
|
|
newrect[3] = ((nval[3] + sample * val[3]) / add + 0.5f);
|
2006-09-14 14:21:18 +02:00
|
|
|
|
|
|
|
newrect += 4;
|
|
|
|
}
|
2006-03-14 10:40:55 +01:00
|
|
|
if (do_float) {
|
|
|
|
|
2012-05-16 11:26:37 +02:00
|
|
|
valf[0] = rectf[0]; valf[1] = rectf[1]; valf[2] = rectf[2]; valf[3] = rectf[3];
|
2006-03-14 10:40:55 +01:00
|
|
|
rectf += 4;
|
|
|
|
|
2012-05-16 11:26:37 +02:00
|
|
|
newrectf[0] = ((nvalf[0] + sample * valf[0]) / add);
|
|
|
|
newrectf[1] = ((nvalf[1] + sample * valf[1]) / add);
|
|
|
|
newrectf[2] = ((nvalf[2] + sample * valf[2]) / add);
|
|
|
|
newrectf[3] = ((nvalf[3] + sample * valf[3]) / add);
|
2006-03-14 10:40:55 +01:00
|
|
|
|
|
|
|
newrectf += 4;
|
|
|
|
}
|
|
|
|
|
|
|
|
sample -= 1.0f;
|
2002-10-12 13:37:38 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-09-14 14:21:18 +02:00
|
|
|
if (do_rect) {
|
2011-04-08 05:53:40 +02:00
|
|
|
// printf("%ld %ld\n", (uchar *)rect - ((uchar *)ibuf->rect), rect_size);
|
|
|
|
BLI_assert((uchar *)rect - ((uchar *)ibuf->rect) == rect_size); /* see bug [#26502] */
|
2006-09-14 14:21:18 +02:00
|
|
|
imb_freerectImBuf(ibuf);
|
|
|
|
ibuf->mall |= IB_rect;
|
|
|
|
ibuf->rect = (unsigned int *) _newrect;
|
|
|
|
}
|
Orange branch: OpenEXR finally in Blender!
Credits go to Gernot Ziegler, who originally coded EXR support, and to
Austin Benesh for bringing it further. Kent Mein provided a lot of code
for integrating float buffers in Blender imbuf and ImBuf API cleanup,
and provided Make and Scons and static linking.
At this moment; the EXR libraries are a *dependency*, so you cannot get
the Orange branch compiled without having OpenEXR installed. Get the
(precompiled or sources) stuff from www.openexr.com. Current default is
that the headers and lib resides in /user/local/
Several changes/additions/fixes were added:
- EXR code only supported 'half' format (16 bits per channel). I've added
float writing, but for reading it I need tomorrow. :)
- Quite some clumsy copying of data happened in EXR code.
- cleaned up the api calls already a bit, preparing for more advanced
support
- Zbuffers were saved 16 bits, now 32 bits
- automatic adding of .exr extensions went wrong
Imbuf:
- added proper imbuf->flags and imbuf->mall support for float buffers, it
was created for *each* imbuf. :)
- found bugs for float buffers in scaling and flipping. Code there will
need more checks still
- imbuf also needs to be verified to behave properly when no 32 bits
rect exists (for saving for example)
TODO:
- support internal float images for textures, backbuf, AO probes, and
display in Image window
Hope this commit won't screwup syncing with bf-blender... :/
2006-01-09 01:40:35 +01:00
|
|
|
if (do_float) {
|
2011-04-08 05:53:40 +02:00
|
|
|
// printf("%ld %ld\n", rectf - ibuf->rect_float, rect_size);
|
|
|
|
BLI_assert((rectf - ibuf->rect_float) == rect_size); /* see bug [#26502] */
|
Orange branch: OpenEXR finally in Blender!
Credits go to Gernot Ziegler, who originally coded EXR support, and to
Austin Benesh for bringing it further. Kent Mein provided a lot of code
for integrating float buffers in Blender imbuf and ImBuf API cleanup,
and provided Make and Scons and static linking.
At this moment; the EXR libraries are a *dependency*, so you cannot get
the Orange branch compiled without having OpenEXR installed. Get the
(precompiled or sources) stuff from www.openexr.com. Current default is
that the headers and lib resides in /user/local/
Several changes/additions/fixes were added:
- EXR code only supported 'half' format (16 bits per channel). I've added
float writing, but for reading it I need tomorrow. :)
- Quite some clumsy copying of data happened in EXR code.
- cleaned up the api calls already a bit, preparing for more advanced
support
- Zbuffers were saved 16 bits, now 32 bits
- automatic adding of .exr extensions went wrong
Imbuf:
- added proper imbuf->flags and imbuf->mall support for float buffers, it
was created for *each* imbuf. :)
- found bugs for float buffers in scaling and flipping. Code there will
need more checks still
- imbuf also needs to be verified to behave properly when no 32 bits
rect exists (for saving for example)
TODO:
- support internal float images for textures, backbuf, AO probes, and
display in Image window
Hope this commit won't screwup syncing with bf-blender... :/
2006-01-09 01:40:35 +01:00
|
|
|
imb_freerectfloatImBuf(ibuf);
|
|
|
|
ibuf->mall |= IB_rectfloat;
|
|
|
|
ibuf->rect_float = _newrectf;
|
|
|
|
}
|
2011-04-24 12:51:45 +02:00
|
|
|
(void)rect_size; /* UNUSED in release builds */
|
Orange branch: OpenEXR finally in Blender!
Credits go to Gernot Ziegler, who originally coded EXR support, and to
Austin Benesh for bringing it further. Kent Mein provided a lot of code
for integrating float buffers in Blender imbuf and ImBuf API cleanup,
and provided Make and Scons and static linking.
At this moment; the EXR libraries are a *dependency*, so you cannot get
the Orange branch compiled without having OpenEXR installed. Get the
(precompiled or sources) stuff from www.openexr.com. Current default is
that the headers and lib resides in /user/local/
Several changes/additions/fixes were added:
- EXR code only supported 'half' format (16 bits per channel). I've added
float writing, but for reading it I need tomorrow. :)
- Quite some clumsy copying of data happened in EXR code.
- cleaned up the api calls already a bit, preparing for more advanced
support
- Zbuffers were saved 16 bits, now 32 bits
- automatic adding of .exr extensions went wrong
Imbuf:
- added proper imbuf->flags and imbuf->mall support for float buffers, it
was created for *each* imbuf. :)
- found bugs for float buffers in scaling and flipping. Code there will
need more checks still
- imbuf also needs to be verified to behave properly when no 32 bits
rect exists (for saving for example)
TODO:
- support internal float images for textures, backbuf, AO probes, and
display in Image window
Hope this commit won't screwup syncing with bf-blender... :/
2006-01-09 01:40:35 +01:00
|
|
|
|
2002-10-12 13:37:38 +02:00
|
|
|
ibuf->x = newx;
|
|
|
|
return(ibuf);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-05-18 01:21:11 +02:00
|
|
|
static ImBuf *scaledowny(struct ImBuf *ibuf, int newy)
|
2002-10-12 13:37:38 +02:00
|
|
|
{
|
2012-05-16 11:26:37 +02:00
|
|
|
const int do_rect = (ibuf->rect != NULL);
|
|
|
|
const int do_float = (ibuf->rect_float != NULL);
|
|
|
|
const size_t rect_size = ibuf->x * ibuf->y * 4;
|
2011-04-08 05:53:40 +02:00
|
|
|
|
Orange branch: OpenEXR finally in Blender!
Credits go to Gernot Ziegler, who originally coded EXR support, and to
Austin Benesh for bringing it further. Kent Mein provided a lot of code
for integrating float buffers in Blender imbuf and ImBuf API cleanup,
and provided Make and Scons and static linking.
At this moment; the EXR libraries are a *dependency*, so you cannot get
the Orange branch compiled without having OpenEXR installed. Get the
(precompiled or sources) stuff from www.openexr.com. Current default is
that the headers and lib resides in /user/local/
Several changes/additions/fixes were added:
- EXR code only supported 'half' format (16 bits per channel). I've added
float writing, but for reading it I need tomorrow. :)
- Quite some clumsy copying of data happened in EXR code.
- cleaned up the api calls already a bit, preparing for more advanced
support
- Zbuffers were saved 16 bits, now 32 bits
- automatic adding of .exr extensions went wrong
Imbuf:
- added proper imbuf->flags and imbuf->mall support for float buffers, it
was created for *each* imbuf. :)
- found bugs for float buffers in scaling and flipping. Code there will
need more checks still
- imbuf also needs to be verified to behave properly when no 32 bits
rect exists (for saving for example)
TODO:
- support internal float images for textures, backbuf, AO probes, and
display in Image window
Hope this commit won't screwup syncing with bf-blender... :/
2006-01-09 01:40:35 +01:00
|
|
|
uchar *rect, *_newrect, *newrect;
|
|
|
|
float *rectf, *_newrectf, *newrectf;
|
2006-03-14 10:40:55 +01:00
|
|
|
float sample, add, val[4], nval[4], valf[4], nvalf[4];
|
2011-04-08 05:53:40 +02:00
|
|
|
int x, y, skipx;
|
2002-10-12 13:37:38 +02:00
|
|
|
|
2012-05-16 11:26:37 +02:00
|
|
|
rectf = _newrectf = newrectf = NULL;
|
|
|
|
rect = _newrect = newrect = NULL;
|
|
|
|
nval[0] = nval[1] = nval[2] = nval[3] = 0.0f;
|
|
|
|
nvalf[0] = nvalf[1] = nvalf[2] = nvalf[3] = 0.0f;
|
2002-10-12 13:37:38 +02:00
|
|
|
|
2011-04-08 05:53:40 +02:00
|
|
|
if (!do_rect && !do_float) return (ibuf);
|
2006-09-14 14:21:18 +02:00
|
|
|
|
2011-04-08 05:53:40 +02:00
|
|
|
if (do_rect) {
|
|
|
|
_newrect = MEM_mallocN(newy * ibuf->x * sizeof(uchar) * 4, "scaledowny");
|
2012-05-16 11:26:37 +02:00
|
|
|
if (_newrect == NULL) return(ibuf);
|
2006-09-14 14:21:18 +02:00
|
|
|
}
|
2011-04-08 05:53:40 +02:00
|
|
|
if (do_float) {
|
2010-09-01 23:06:25 +02:00
|
|
|
_newrectf = MEM_mallocN(newy * ibuf->x * sizeof(float) * 4, "scaledownyf");
|
2012-05-16 11:26:37 +02:00
|
|
|
if (_newrectf == NULL) {
|
2006-09-14 14:21:18 +02:00
|
|
|
if (_newrect) MEM_freeN(_newrect);
|
|
|
|
return(ibuf);
|
|
|
|
}
|
Orange branch: OpenEXR finally in Blender!
Credits go to Gernot Ziegler, who originally coded EXR support, and to
Austin Benesh for bringing it further. Kent Mein provided a lot of code
for integrating float buffers in Blender imbuf and ImBuf API cleanup,
and provided Make and Scons and static linking.
At this moment; the EXR libraries are a *dependency*, so you cannot get
the Orange branch compiled without having OpenEXR installed. Get the
(precompiled or sources) stuff from www.openexr.com. Current default is
that the headers and lib resides in /user/local/
Several changes/additions/fixes were added:
- EXR code only supported 'half' format (16 bits per channel). I've added
float writing, but for reading it I need tomorrow. :)
- Quite some clumsy copying of data happened in EXR code.
- cleaned up the api calls already a bit, preparing for more advanced
support
- Zbuffers were saved 16 bits, now 32 bits
- automatic adding of .exr extensions went wrong
Imbuf:
- added proper imbuf->flags and imbuf->mall support for float buffers, it
was created for *each* imbuf. :)
- found bugs for float buffers in scaling and flipping. Code there will
need more checks still
- imbuf also needs to be verified to behave properly when no 32 bits
rect exists (for saving for example)
TODO:
- support internal float images for textures, backbuf, AO probes, and
display in Image window
Hope this commit won't screwup syncing with bf-blender... :/
2006-01-09 01:40:35 +01:00
|
|
|
}
|
|
|
|
|
2011-03-17 12:08:25 +01:00
|
|
|
add = (ibuf->y - 0.01) / newy;
|
2002-10-12 13:37:38 +02:00
|
|
|
skipx = 4 * ibuf->x;
|
|
|
|
|
2012-02-27 11:35:39 +01:00
|
|
|
for (x = skipx - 4; x >= 0; x -= 4) {
|
2006-09-14 14:21:18 +02:00
|
|
|
if (do_rect) {
|
|
|
|
rect = ((uchar *) ibuf->rect) + x;
|
|
|
|
newrect = _newrect + x;
|
|
|
|
}
|
2006-03-14 10:40:55 +01:00
|
|
|
if (do_float) {
|
|
|
|
rectf = ibuf->rect_float + x;
|
|
|
|
newrectf = _newrectf + x;
|
|
|
|
}
|
|
|
|
|
|
|
|
sample = 0.0f;
|
2012-05-16 11:26:37 +02:00
|
|
|
val[0] = val[1] = val[2] = val[3] = 0.0f;
|
|
|
|
valf[0] = valf[1] = valf[2] = valf[3] = 0.0f;
|
2006-03-14 10:40:55 +01:00
|
|
|
|
2012-02-27 11:35:39 +01:00
|
|
|
for (y = newy; y > 0; y--) {
|
2006-09-14 14:21:18 +02:00
|
|
|
if (do_rect) {
|
2012-05-16 11:26:37 +02:00
|
|
|
nval[0] = -val[0] * sample;
|
|
|
|
nval[1] = -val[1] * sample;
|
|
|
|
nval[2] = -val[2] * sample;
|
|
|
|
nval[3] = -val[3] * sample;
|
2006-09-14 14:21:18 +02:00
|
|
|
}
|
Orange branch: OpenEXR finally in Blender!
Credits go to Gernot Ziegler, who originally coded EXR support, and to
Austin Benesh for bringing it further. Kent Mein provided a lot of code
for integrating float buffers in Blender imbuf and ImBuf API cleanup,
and provided Make and Scons and static linking.
At this moment; the EXR libraries are a *dependency*, so you cannot get
the Orange branch compiled without having OpenEXR installed. Get the
(precompiled or sources) stuff from www.openexr.com. Current default is
that the headers and lib resides in /user/local/
Several changes/additions/fixes were added:
- EXR code only supported 'half' format (16 bits per channel). I've added
float writing, but for reading it I need tomorrow. :)
- Quite some clumsy copying of data happened in EXR code.
- cleaned up the api calls already a bit, preparing for more advanced
support
- Zbuffers were saved 16 bits, now 32 bits
- automatic adding of .exr extensions went wrong
Imbuf:
- added proper imbuf->flags and imbuf->mall support for float buffers, it
was created for *each* imbuf. :)
- found bugs for float buffers in scaling and flipping. Code there will
need more checks still
- imbuf also needs to be verified to behave properly when no 32 bits
rect exists (for saving for example)
TODO:
- support internal float images for textures, backbuf, AO probes, and
display in Image window
Hope this commit won't screwup syncing with bf-blender... :/
2006-01-09 01:40:35 +01:00
|
|
|
if (do_float) {
|
2012-05-16 11:26:37 +02:00
|
|
|
nvalf[0] = -valf[0] * sample;
|
|
|
|
nvalf[1] = -valf[1] * sample;
|
|
|
|
nvalf[2] = -valf[2] * sample;
|
|
|
|
nvalf[3] = -valf[3] * sample;
|
Orange branch: OpenEXR finally in Blender!
Credits go to Gernot Ziegler, who originally coded EXR support, and to
Austin Benesh for bringing it further. Kent Mein provided a lot of code
for integrating float buffers in Blender imbuf and ImBuf API cleanup,
and provided Make and Scons and static linking.
At this moment; the EXR libraries are a *dependency*, so you cannot get
the Orange branch compiled without having OpenEXR installed. Get the
(precompiled or sources) stuff from www.openexr.com. Current default is
that the headers and lib resides in /user/local/
Several changes/additions/fixes were added:
- EXR code only supported 'half' format (16 bits per channel). I've added
float writing, but for reading it I need tomorrow. :)
- Quite some clumsy copying of data happened in EXR code.
- cleaned up the api calls already a bit, preparing for more advanced
support
- Zbuffers were saved 16 bits, now 32 bits
- automatic adding of .exr extensions went wrong
Imbuf:
- added proper imbuf->flags and imbuf->mall support for float buffers, it
was created for *each* imbuf. :)
- found bugs for float buffers in scaling and flipping. Code there will
need more checks still
- imbuf also needs to be verified to behave properly when no 32 bits
rect exists (for saving for example)
TODO:
- support internal float images for textures, backbuf, AO probes, and
display in Image window
Hope this commit won't screwup syncing with bf-blender... :/
2006-01-09 01:40:35 +01:00
|
|
|
}
|
2006-03-14 10:40:55 +01:00
|
|
|
|
|
|
|
sample += add;
|
|
|
|
|
2011-03-27 19:12:59 +02:00
|
|
|
while (sample >= 1.0f) {
|
|
|
|
sample -= 1.0f;
|
2006-03-14 10:40:55 +01:00
|
|
|
|
2006-09-14 14:21:18 +02:00
|
|
|
if (do_rect) {
|
|
|
|
nval[0] += rect[0];
|
|
|
|
nval[1] += rect[1];
|
|
|
|
nval[2] += rect[2];
|
|
|
|
nval[3] += rect[3];
|
|
|
|
rect += skipx;
|
|
|
|
}
|
Orange branch: OpenEXR finally in Blender!
Credits go to Gernot Ziegler, who originally coded EXR support, and to
Austin Benesh for bringing it further. Kent Mein provided a lot of code
for integrating float buffers in Blender imbuf and ImBuf API cleanup,
and provided Make and Scons and static linking.
At this moment; the EXR libraries are a *dependency*, so you cannot get
the Orange branch compiled without having OpenEXR installed. Get the
(precompiled or sources) stuff from www.openexr.com. Current default is
that the headers and lib resides in /user/local/
Several changes/additions/fixes were added:
- EXR code only supported 'half' format (16 bits per channel). I've added
float writing, but for reading it I need tomorrow. :)
- Quite some clumsy copying of data happened in EXR code.
- cleaned up the api calls already a bit, preparing for more advanced
support
- Zbuffers were saved 16 bits, now 32 bits
- automatic adding of .exr extensions went wrong
Imbuf:
- added proper imbuf->flags and imbuf->mall support for float buffers, it
was created for *each* imbuf. :)
- found bugs for float buffers in scaling and flipping. Code there will
need more checks still
- imbuf also needs to be verified to behave properly when no 32 bits
rect exists (for saving for example)
TODO:
- support internal float images for textures, backbuf, AO probes, and
display in Image window
Hope this commit won't screwup syncing with bf-blender... :/
2006-01-09 01:40:35 +01:00
|
|
|
if (do_float) {
|
2006-03-14 10:40:55 +01:00
|
|
|
nvalf[0] += rectf[0];
|
|
|
|
nvalf[1] += rectf[1];
|
|
|
|
nvalf[2] += rectf[2];
|
|
|
|
nvalf[3] += rectf[3];
|
Orange branch: OpenEXR finally in Blender!
Credits go to Gernot Ziegler, who originally coded EXR support, and to
Austin Benesh for bringing it further. Kent Mein provided a lot of code
for integrating float buffers in Blender imbuf and ImBuf API cleanup,
and provided Make and Scons and static linking.
At this moment; the EXR libraries are a *dependency*, so you cannot get
the Orange branch compiled without having OpenEXR installed. Get the
(precompiled or sources) stuff from www.openexr.com. Current default is
that the headers and lib resides in /user/local/
Several changes/additions/fixes were added:
- EXR code only supported 'half' format (16 bits per channel). I've added
float writing, but for reading it I need tomorrow. :)
- Quite some clumsy copying of data happened in EXR code.
- cleaned up the api calls already a bit, preparing for more advanced
support
- Zbuffers were saved 16 bits, now 32 bits
- automatic adding of .exr extensions went wrong
Imbuf:
- added proper imbuf->flags and imbuf->mall support for float buffers, it
was created for *each* imbuf. :)
- found bugs for float buffers in scaling and flipping. Code there will
need more checks still
- imbuf also needs to be verified to behave properly when no 32 bits
rect exists (for saving for example)
TODO:
- support internal float images for textures, backbuf, AO probes, and
display in Image window
Hope this commit won't screwup syncing with bf-blender... :/
2006-01-09 01:40:35 +01:00
|
|
|
rectf += skipx;
|
|
|
|
}
|
2002-10-12 13:37:38 +02:00
|
|
|
}
|
2006-09-14 14:21:18 +02:00
|
|
|
|
|
|
|
if (do_rect) {
|
2012-05-16 11:26:37 +02:00
|
|
|
val[0] = rect[0]; val[1] = rect[1]; val[2] = rect[2]; val[3] = rect[3];
|
2006-09-14 14:21:18 +02:00
|
|
|
rect += skipx;
|
|
|
|
|
2012-05-16 11:26:37 +02:00
|
|
|
newrect[0] = ((nval[0] + sample * val[0]) / add + 0.5f);
|
|
|
|
newrect[1] = ((nval[1] + sample * val[1]) / add + 0.5f);
|
|
|
|
newrect[2] = ((nval[2] + sample * val[2]) / add + 0.5f);
|
|
|
|
newrect[3] = ((nval[3] + sample * val[3]) / add + 0.5f);
|
2006-09-14 14:21:18 +02:00
|
|
|
|
|
|
|
newrect += skipx;
|
|
|
|
}
|
2006-03-14 10:40:55 +01:00
|
|
|
if (do_float) {
|
|
|
|
|
2012-05-16 11:26:37 +02:00
|
|
|
valf[0] = rectf[0]; valf[1] = rectf[1]; valf[2] = rectf[2]; valf[3] = rectf[3];
|
2006-03-14 10:40:55 +01:00
|
|
|
rectf += skipx;
|
|
|
|
|
2012-05-16 11:26:37 +02:00
|
|
|
newrectf[0] = ((nvalf[0] + sample * valf[0]) / add);
|
|
|
|
newrectf[1] = ((nvalf[1] + sample * valf[1]) / add);
|
|
|
|
newrectf[2] = ((nvalf[2] + sample * valf[2]) / add);
|
|
|
|
newrectf[3] = ((nvalf[3] + sample * valf[3]) / add);
|
2006-03-14 10:40:55 +01:00
|
|
|
|
|
|
|
newrectf += skipx;
|
|
|
|
}
|
|
|
|
|
2011-03-27 19:12:59 +02:00
|
|
|
sample -= 1.0f;
|
2002-10-12 13:37:38 +02:00
|
|
|
}
|
2012-09-16 06:58:18 +02:00
|
|
|
}
|
2002-10-12 13:37:38 +02:00
|
|
|
|
2006-09-14 14:21:18 +02:00
|
|
|
if (do_rect) {
|
2011-04-08 05:53:40 +02:00
|
|
|
// printf("%ld %ld\n", (uchar *)rect - ((uchar *)ibuf->rect), rect_size);
|
|
|
|
BLI_assert((uchar *)rect - ((uchar *)ibuf->rect) == rect_size); /* see bug [#26502] */
|
2006-09-14 14:21:18 +02:00
|
|
|
imb_freerectImBuf(ibuf);
|
|
|
|
ibuf->mall |= IB_rect;
|
|
|
|
ibuf->rect = (unsigned int *) _newrect;
|
|
|
|
}
|
Orange branch: OpenEXR finally in Blender!
Credits go to Gernot Ziegler, who originally coded EXR support, and to
Austin Benesh for bringing it further. Kent Mein provided a lot of code
for integrating float buffers in Blender imbuf and ImBuf API cleanup,
and provided Make and Scons and static linking.
At this moment; the EXR libraries are a *dependency*, so you cannot get
the Orange branch compiled without having OpenEXR installed. Get the
(precompiled or sources) stuff from www.openexr.com. Current default is
that the headers and lib resides in /user/local/
Several changes/additions/fixes were added:
- EXR code only supported 'half' format (16 bits per channel). I've added
float writing, but for reading it I need tomorrow. :)
- Quite some clumsy copying of data happened in EXR code.
- cleaned up the api calls already a bit, preparing for more advanced
support
- Zbuffers were saved 16 bits, now 32 bits
- automatic adding of .exr extensions went wrong
Imbuf:
- added proper imbuf->flags and imbuf->mall support for float buffers, it
was created for *each* imbuf. :)
- found bugs for float buffers in scaling and flipping. Code there will
need more checks still
- imbuf also needs to be verified to behave properly when no 32 bits
rect exists (for saving for example)
TODO:
- support internal float images for textures, backbuf, AO probes, and
display in Image window
Hope this commit won't screwup syncing with bf-blender... :/
2006-01-09 01:40:35 +01:00
|
|
|
if (do_float) {
|
2011-04-08 05:53:40 +02:00
|
|
|
// printf("%ld %ld\n", rectf - ibuf->rect_float, rect_size);
|
|
|
|
BLI_assert((rectf - ibuf->rect_float) == rect_size); /* see bug [#26502] */
|
Orange branch: OpenEXR finally in Blender!
Credits go to Gernot Ziegler, who originally coded EXR support, and to
Austin Benesh for bringing it further. Kent Mein provided a lot of code
for integrating float buffers in Blender imbuf and ImBuf API cleanup,
and provided Make and Scons and static linking.
At this moment; the EXR libraries are a *dependency*, so you cannot get
the Orange branch compiled without having OpenEXR installed. Get the
(precompiled or sources) stuff from www.openexr.com. Current default is
that the headers and lib resides in /user/local/
Several changes/additions/fixes were added:
- EXR code only supported 'half' format (16 bits per channel). I've added
float writing, but for reading it I need tomorrow. :)
- Quite some clumsy copying of data happened in EXR code.
- cleaned up the api calls already a bit, preparing for more advanced
support
- Zbuffers were saved 16 bits, now 32 bits
- automatic adding of .exr extensions went wrong
Imbuf:
- added proper imbuf->flags and imbuf->mall support for float buffers, it
was created for *each* imbuf. :)
- found bugs for float buffers in scaling and flipping. Code there will
need more checks still
- imbuf also needs to be verified to behave properly when no 32 bits
rect exists (for saving for example)
TODO:
- support internal float images for textures, backbuf, AO probes, and
display in Image window
Hope this commit won't screwup syncing with bf-blender... :/
2006-01-09 01:40:35 +01:00
|
|
|
imb_freerectfloatImBuf(ibuf);
|
|
|
|
ibuf->mall |= IB_rectfloat;
|
|
|
|
ibuf->rect_float = (float *) _newrectf;
|
|
|
|
}
|
2011-04-24 12:51:45 +02:00
|
|
|
(void)rect_size; /* UNUSED in release builds */
|
Orange branch: OpenEXR finally in Blender!
Credits go to Gernot Ziegler, who originally coded EXR support, and to
Austin Benesh for bringing it further. Kent Mein provided a lot of code
for integrating float buffers in Blender imbuf and ImBuf API cleanup,
and provided Make and Scons and static linking.
At this moment; the EXR libraries are a *dependency*, so you cannot get
the Orange branch compiled without having OpenEXR installed. Get the
(precompiled or sources) stuff from www.openexr.com. Current default is
that the headers and lib resides in /user/local/
Several changes/additions/fixes were added:
- EXR code only supported 'half' format (16 bits per channel). I've added
float writing, but for reading it I need tomorrow. :)
- Quite some clumsy copying of data happened in EXR code.
- cleaned up the api calls already a bit, preparing for more advanced
support
- Zbuffers were saved 16 bits, now 32 bits
- automatic adding of .exr extensions went wrong
Imbuf:
- added proper imbuf->flags and imbuf->mall support for float buffers, it
was created for *each* imbuf. :)
- found bugs for float buffers in scaling and flipping. Code there will
need more checks still
- imbuf also needs to be verified to behave properly when no 32 bits
rect exists (for saving for example)
TODO:
- support internal float images for textures, backbuf, AO probes, and
display in Image window
Hope this commit won't screwup syncing with bf-blender... :/
2006-01-09 01:40:35 +01:00
|
|
|
|
2002-10-12 13:37:38 +02:00
|
|
|
ibuf->y = newy;
|
|
|
|
return(ibuf);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-05-18 01:21:11 +02:00
|
|
|
static ImBuf *scaleupx(struct ImBuf *ibuf, int newx)
|
2002-10-12 13:37:38 +02:00
|
|
|
{
|
2012-05-16 11:26:37 +02:00
|
|
|
uchar *rect, *_newrect = NULL, *newrect;
|
|
|
|
float *rectf, *_newrectf = NULL, *newrectf;
|
2012-04-29 17:47:02 +02:00
|
|
|
float sample, add;
|
|
|
|
float val_a, nval_a, diff_a;
|
|
|
|
float val_b, nval_b, diff_b;
|
|
|
|
float val_g, nval_g, diff_g;
|
|
|
|
float val_r, nval_r, diff_r;
|
|
|
|
float val_af, nval_af, diff_af;
|
|
|
|
float val_bf, nval_bf, diff_bf;
|
|
|
|
float val_gf, nval_gf, diff_gf;
|
|
|
|
float val_rf, nval_rf, diff_rf;
|
2012-05-19 15:28:19 +02:00
|
|
|
int x, y, do_rect = FALSE, do_float = FALSE;
|
Orange branch: OpenEXR finally in Blender!
Credits go to Gernot Ziegler, who originally coded EXR support, and to
Austin Benesh for bringing it further. Kent Mein provided a lot of code
for integrating float buffers in Blender imbuf and ImBuf API cleanup,
and provided Make and Scons and static linking.
At this moment; the EXR libraries are a *dependency*, so you cannot get
the Orange branch compiled without having OpenEXR installed. Get the
(precompiled or sources) stuff from www.openexr.com. Current default is
that the headers and lib resides in /user/local/
Several changes/additions/fixes were added:
- EXR code only supported 'half' format (16 bits per channel). I've added
float writing, but for reading it I need tomorrow. :)
- Quite some clumsy copying of data happened in EXR code.
- cleaned up the api calls already a bit, preparing for more advanced
support
- Zbuffers were saved 16 bits, now 32 bits
- automatic adding of .exr extensions went wrong
Imbuf:
- added proper imbuf->flags and imbuf->mall support for float buffers, it
was created for *each* imbuf. :)
- found bugs for float buffers in scaling and flipping. Code there will
need more checks still
- imbuf also needs to be verified to behave properly when no 32 bits
rect exists (for saving for example)
TODO:
- support internal float images for textures, backbuf, AO probes, and
display in Image window
Hope this commit won't screwup syncing with bf-blender... :/
2006-01-09 01:40:35 +01:00
|
|
|
|
2006-09-14 14:21:18 +02:00
|
|
|
val_a = nval_a = diff_a = val_b = nval_b = diff_b = 0;
|
|
|
|
val_g = nval_g = diff_g = val_r = nval_r = diff_r = 0;
|
Orange branch: OpenEXR finally in Blender!
Credits go to Gernot Ziegler, who originally coded EXR support, and to
Austin Benesh for bringing it further. Kent Mein provided a lot of code
for integrating float buffers in Blender imbuf and ImBuf API cleanup,
and provided Make and Scons and static linking.
At this moment; the EXR libraries are a *dependency*, so you cannot get
the Orange branch compiled without having OpenEXR installed. Get the
(precompiled or sources) stuff from www.openexr.com. Current default is
that the headers and lib resides in /user/local/
Several changes/additions/fixes were added:
- EXR code only supported 'half' format (16 bits per channel). I've added
float writing, but for reading it I need tomorrow. :)
- Quite some clumsy copying of data happened in EXR code.
- cleaned up the api calls already a bit, preparing for more advanced
support
- Zbuffers were saved 16 bits, now 32 bits
- automatic adding of .exr extensions went wrong
Imbuf:
- added proper imbuf->flags and imbuf->mall support for float buffers, it
was created for *each* imbuf. :)
- found bugs for float buffers in scaling and flipping. Code there will
need more checks still
- imbuf also needs to be verified to behave properly when no 32 bits
rect exists (for saving for example)
TODO:
- support internal float images for textures, backbuf, AO probes, and
display in Image window
Hope this commit won't screwup syncing with bf-blender... :/
2006-01-09 01:40:35 +01:00
|
|
|
val_af = nval_af = diff_af = val_bf = nval_bf = diff_bf = 0;
|
|
|
|
val_gf = nval_gf = diff_gf = val_rf = nval_rf = diff_rf = 0;
|
2012-05-16 11:26:37 +02:00
|
|
|
if (ibuf == NULL) return(NULL);
|
|
|
|
if (ibuf->rect == NULL && ibuf->rect_float == NULL) return (ibuf);
|
Orange branch: OpenEXR finally in Blender!
Credits go to Gernot Ziegler, who originally coded EXR support, and to
Austin Benesh for bringing it further. Kent Mein provided a lot of code
for integrating float buffers in Blender imbuf and ImBuf API cleanup,
and provided Make and Scons and static linking.
At this moment; the EXR libraries are a *dependency*, so you cannot get
the Orange branch compiled without having OpenEXR installed. Get the
(precompiled or sources) stuff from www.openexr.com. Current default is
that the headers and lib resides in /user/local/
Several changes/additions/fixes were added:
- EXR code only supported 'half' format (16 bits per channel). I've added
float writing, but for reading it I need tomorrow. :)
- Quite some clumsy copying of data happened in EXR code.
- cleaned up the api calls already a bit, preparing for more advanced
support
- Zbuffers were saved 16 bits, now 32 bits
- automatic adding of .exr extensions went wrong
Imbuf:
- added proper imbuf->flags and imbuf->mall support for float buffers, it
was created for *each* imbuf. :)
- found bugs for float buffers in scaling and flipping. Code there will
need more checks still
- imbuf also needs to be verified to behave properly when no 32 bits
rect exists (for saving for example)
TODO:
- support internal float images for textures, backbuf, AO probes, and
display in Image window
Hope this commit won't screwup syncing with bf-blender... :/
2006-01-09 01:40:35 +01:00
|
|
|
|
2006-09-14 14:21:18 +02:00
|
|
|
if (ibuf->rect) {
|
2012-05-19 15:28:19 +02:00
|
|
|
do_rect = TRUE;
|
2006-09-14 14:21:18 +02:00
|
|
|
_newrect = MEM_mallocN(newx * ibuf->y * sizeof(int), "scaleupx");
|
2012-05-16 11:26:37 +02:00
|
|
|
if (_newrect == NULL) return(ibuf);
|
2006-09-14 14:21:18 +02:00
|
|
|
}
|
Orange branch: OpenEXR finally in Blender!
Credits go to Gernot Ziegler, who originally coded EXR support, and to
Austin Benesh for bringing it further. Kent Mein provided a lot of code
for integrating float buffers in Blender imbuf and ImBuf API cleanup,
and provided Make and Scons and static linking.
At this moment; the EXR libraries are a *dependency*, so you cannot get
the Orange branch compiled without having OpenEXR installed. Get the
(precompiled or sources) stuff from www.openexr.com. Current default is
that the headers and lib resides in /user/local/
Several changes/additions/fixes were added:
- EXR code only supported 'half' format (16 bits per channel). I've added
float writing, but for reading it I need tomorrow. :)
- Quite some clumsy copying of data happened in EXR code.
- cleaned up the api calls already a bit, preparing for more advanced
support
- Zbuffers were saved 16 bits, now 32 bits
- automatic adding of .exr extensions went wrong
Imbuf:
- added proper imbuf->flags and imbuf->mall support for float buffers, it
was created for *each* imbuf. :)
- found bugs for float buffers in scaling and flipping. Code there will
need more checks still
- imbuf also needs to be verified to behave properly when no 32 bits
rect exists (for saving for example)
TODO:
- support internal float images for textures, backbuf, AO probes, and
display in Image window
Hope this commit won't screwup syncing with bf-blender... :/
2006-01-09 01:40:35 +01:00
|
|
|
if (ibuf->rect_float) {
|
2012-05-19 15:28:19 +02:00
|
|
|
do_float = TRUE;
|
Orange branch: OpenEXR finally in Blender!
Credits go to Gernot Ziegler, who originally coded EXR support, and to
Austin Benesh for bringing it further. Kent Mein provided a lot of code
for integrating float buffers in Blender imbuf and ImBuf API cleanup,
and provided Make and Scons and static linking.
At this moment; the EXR libraries are a *dependency*, so you cannot get
the Orange branch compiled without having OpenEXR installed. Get the
(precompiled or sources) stuff from www.openexr.com. Current default is
that the headers and lib resides in /user/local/
Several changes/additions/fixes were added:
- EXR code only supported 'half' format (16 bits per channel). I've added
float writing, but for reading it I need tomorrow. :)
- Quite some clumsy copying of data happened in EXR code.
- cleaned up the api calls already a bit, preparing for more advanced
support
- Zbuffers were saved 16 bits, now 32 bits
- automatic adding of .exr extensions went wrong
Imbuf:
- added proper imbuf->flags and imbuf->mall support for float buffers, it
was created for *each* imbuf. :)
- found bugs for float buffers in scaling and flipping. Code there will
need more checks still
- imbuf also needs to be verified to behave properly when no 32 bits
rect exists (for saving for example)
TODO:
- support internal float images for textures, backbuf, AO probes, and
display in Image window
Hope this commit won't screwup syncing with bf-blender... :/
2006-01-09 01:40:35 +01:00
|
|
|
_newrectf = MEM_mallocN(newx * ibuf->y * sizeof(float) * 4, "scaleupxf");
|
2012-05-16 11:26:37 +02:00
|
|
|
if (_newrectf == NULL) {
|
2006-09-14 14:21:18 +02:00
|
|
|
if (_newrect) MEM_freeN(_newrect);
|
|
|
|
return(ibuf);
|
|
|
|
}
|
Orange branch: OpenEXR finally in Blender!
Credits go to Gernot Ziegler, who originally coded EXR support, and to
Austin Benesh for bringing it further. Kent Mein provided a lot of code
for integrating float buffers in Blender imbuf and ImBuf API cleanup,
and provided Make and Scons and static linking.
At this moment; the EXR libraries are a *dependency*, so you cannot get
the Orange branch compiled without having OpenEXR installed. Get the
(precompiled or sources) stuff from www.openexr.com. Current default is
that the headers and lib resides in /user/local/
Several changes/additions/fixes were added:
- EXR code only supported 'half' format (16 bits per channel). I've added
float writing, but for reading it I need tomorrow. :)
- Quite some clumsy copying of data happened in EXR code.
- cleaned up the api calls already a bit, preparing for more advanced
support
- Zbuffers were saved 16 bits, now 32 bits
- automatic adding of .exr extensions went wrong
Imbuf:
- added proper imbuf->flags and imbuf->mall support for float buffers, it
was created for *each* imbuf. :)
- found bugs for float buffers in scaling and flipping. Code there will
need more checks still
- imbuf also needs to be verified to behave properly when no 32 bits
rect exists (for saving for example)
TODO:
- support internal float images for textures, backbuf, AO probes, and
display in Image window
Hope this commit won't screwup syncing with bf-blender... :/
2006-01-09 01:40:35 +01:00
|
|
|
}
|
2002-10-12 13:37:38 +02:00
|
|
|
|
|
|
|
add = (ibuf->x - 1.001) / (newx - 1.0);
|
|
|
|
|
|
|
|
rect = (uchar *) ibuf->rect;
|
Orange branch: OpenEXR finally in Blender!
Credits go to Gernot Ziegler, who originally coded EXR support, and to
Austin Benesh for bringing it further. Kent Mein provided a lot of code
for integrating float buffers in Blender imbuf and ImBuf API cleanup,
and provided Make and Scons and static linking.
At this moment; the EXR libraries are a *dependency*, so you cannot get
the Orange branch compiled without having OpenEXR installed. Get the
(precompiled or sources) stuff from www.openexr.com. Current default is
that the headers and lib resides in /user/local/
Several changes/additions/fixes were added:
- EXR code only supported 'half' format (16 bits per channel). I've added
float writing, but for reading it I need tomorrow. :)
- Quite some clumsy copying of data happened in EXR code.
- cleaned up the api calls already a bit, preparing for more advanced
support
- Zbuffers were saved 16 bits, now 32 bits
- automatic adding of .exr extensions went wrong
Imbuf:
- added proper imbuf->flags and imbuf->mall support for float buffers, it
was created for *each* imbuf. :)
- found bugs for float buffers in scaling and flipping. Code there will
need more checks still
- imbuf also needs to be verified to behave properly when no 32 bits
rect exists (for saving for example)
TODO:
- support internal float images for textures, backbuf, AO probes, and
display in Image window
Hope this commit won't screwup syncing with bf-blender... :/
2006-01-09 01:40:35 +01:00
|
|
|
rectf = (float *) ibuf->rect_float;
|
2002-10-12 13:37:38 +02:00
|
|
|
newrect = _newrect;
|
2006-03-12 20:53:23 +01:00
|
|
|
newrectf = _newrectf;
|
2002-10-12 13:37:38 +02:00
|
|
|
|
2012-02-27 11:35:39 +01:00
|
|
|
for (y = ibuf->y; y > 0; y--) {
|
2002-10-12 13:37:38 +02:00
|
|
|
|
|
|
|
sample = 0;
|
2006-09-14 14:21:18 +02:00
|
|
|
|
|
|
|
if (do_rect) {
|
2012-02-27 11:35:39 +01:00
|
|
|
val_a = rect[0];
|
2006-09-14 14:21:18 +02:00
|
|
|
nval_a = rect[4];
|
2012-02-27 11:35:39 +01:00
|
|
|
diff_a = nval_a - val_a;
|
2011-03-27 19:12:59 +02:00
|
|
|
val_a += 0.5f;
|
2006-09-14 14:21:18 +02:00
|
|
|
|
2012-02-27 11:35:39 +01:00
|
|
|
val_b = rect[1];
|
2006-09-14 14:21:18 +02:00
|
|
|
nval_b = rect[5];
|
2012-02-27 11:35:39 +01:00
|
|
|
diff_b = nval_b - val_b;
|
2011-03-27 19:12:59 +02:00
|
|
|
val_b += 0.5f;
|
2006-09-14 14:21:18 +02:00
|
|
|
|
2012-02-27 11:35:39 +01:00
|
|
|
val_g = rect[2];
|
2006-09-14 14:21:18 +02:00
|
|
|
nval_g = rect[6];
|
2012-02-27 11:35:39 +01:00
|
|
|
diff_g = nval_g - val_g;
|
2011-03-27 19:12:59 +02:00
|
|
|
val_g += 0.5f;
|
2006-09-14 14:21:18 +02:00
|
|
|
|
2012-02-27 11:35:39 +01:00
|
|
|
val_r = rect[3];
|
2006-09-14 14:21:18 +02:00
|
|
|
nval_r = rect[7];
|
2012-02-27 11:35:39 +01:00
|
|
|
diff_r = nval_r - val_r;
|
2011-03-27 19:12:59 +02:00
|
|
|
val_r += 0.5f;
|
2006-09-14 14:21:18 +02:00
|
|
|
|
|
|
|
rect += 8;
|
|
|
|
}
|
Orange branch: OpenEXR finally in Blender!
Credits go to Gernot Ziegler, who originally coded EXR support, and to
Austin Benesh for bringing it further. Kent Mein provided a lot of code
for integrating float buffers in Blender imbuf and ImBuf API cleanup,
and provided Make and Scons and static linking.
At this moment; the EXR libraries are a *dependency*, so you cannot get
the Orange branch compiled without having OpenEXR installed. Get the
(precompiled or sources) stuff from www.openexr.com. Current default is
that the headers and lib resides in /user/local/
Several changes/additions/fixes were added:
- EXR code only supported 'half' format (16 bits per channel). I've added
float writing, but for reading it I need tomorrow. :)
- Quite some clumsy copying of data happened in EXR code.
- cleaned up the api calls already a bit, preparing for more advanced
support
- Zbuffers were saved 16 bits, now 32 bits
- automatic adding of .exr extensions went wrong
Imbuf:
- added proper imbuf->flags and imbuf->mall support for float buffers, it
was created for *each* imbuf. :)
- found bugs for float buffers in scaling and flipping. Code there will
need more checks still
- imbuf also needs to be verified to behave properly when no 32 bits
rect exists (for saving for example)
TODO:
- support internal float images for textures, backbuf, AO probes, and
display in Image window
Hope this commit won't screwup syncing with bf-blender... :/
2006-01-09 01:40:35 +01:00
|
|
|
if (do_float) {
|
2012-02-27 11:35:39 +01:00
|
|
|
val_af = rectf[0];
|
Orange branch: OpenEXR finally in Blender!
Credits go to Gernot Ziegler, who originally coded EXR support, and to
Austin Benesh for bringing it further. Kent Mein provided a lot of code
for integrating float buffers in Blender imbuf and ImBuf API cleanup,
and provided Make and Scons and static linking.
At this moment; the EXR libraries are a *dependency*, so you cannot get
the Orange branch compiled without having OpenEXR installed. Get the
(precompiled or sources) stuff from www.openexr.com. Current default is
that the headers and lib resides in /user/local/
Several changes/additions/fixes were added:
- EXR code only supported 'half' format (16 bits per channel). I've added
float writing, but for reading it I need tomorrow. :)
- Quite some clumsy copying of data happened in EXR code.
- cleaned up the api calls already a bit, preparing for more advanced
support
- Zbuffers were saved 16 bits, now 32 bits
- automatic adding of .exr extensions went wrong
Imbuf:
- added proper imbuf->flags and imbuf->mall support for float buffers, it
was created for *each* imbuf. :)
- found bugs for float buffers in scaling and flipping. Code there will
need more checks still
- imbuf also needs to be verified to behave properly when no 32 bits
rect exists (for saving for example)
TODO:
- support internal float images for textures, backbuf, AO probes, and
display in Image window
Hope this commit won't screwup syncing with bf-blender... :/
2006-01-09 01:40:35 +01:00
|
|
|
nval_af = rectf[4];
|
|
|
|
diff_af = nval_af - val_af;
|
|
|
|
|
2012-02-27 11:35:39 +01:00
|
|
|
val_bf = rectf[1];
|
Orange branch: OpenEXR finally in Blender!
Credits go to Gernot Ziegler, who originally coded EXR support, and to
Austin Benesh for bringing it further. Kent Mein provided a lot of code
for integrating float buffers in Blender imbuf and ImBuf API cleanup,
and provided Make and Scons and static linking.
At this moment; the EXR libraries are a *dependency*, so you cannot get
the Orange branch compiled without having OpenEXR installed. Get the
(precompiled or sources) stuff from www.openexr.com. Current default is
that the headers and lib resides in /user/local/
Several changes/additions/fixes were added:
- EXR code only supported 'half' format (16 bits per channel). I've added
float writing, but for reading it I need tomorrow. :)
- Quite some clumsy copying of data happened in EXR code.
- cleaned up the api calls already a bit, preparing for more advanced
support
- Zbuffers were saved 16 bits, now 32 bits
- automatic adding of .exr extensions went wrong
Imbuf:
- added proper imbuf->flags and imbuf->mall support for float buffers, it
was created for *each* imbuf. :)
- found bugs for float buffers in scaling and flipping. Code there will
need more checks still
- imbuf also needs to be verified to behave properly when no 32 bits
rect exists (for saving for example)
TODO:
- support internal float images for textures, backbuf, AO probes, and
display in Image window
Hope this commit won't screwup syncing with bf-blender... :/
2006-01-09 01:40:35 +01:00
|
|
|
nval_bf = rectf[5];
|
|
|
|
diff_bf = nval_bf - val_bf;
|
|
|
|
|
2012-02-27 11:35:39 +01:00
|
|
|
val_gf = rectf[2];
|
Orange branch: OpenEXR finally in Blender!
Credits go to Gernot Ziegler, who originally coded EXR support, and to
Austin Benesh for bringing it further. Kent Mein provided a lot of code
for integrating float buffers in Blender imbuf and ImBuf API cleanup,
and provided Make and Scons and static linking.
At this moment; the EXR libraries are a *dependency*, so you cannot get
the Orange branch compiled without having OpenEXR installed. Get the
(precompiled or sources) stuff from www.openexr.com. Current default is
that the headers and lib resides in /user/local/
Several changes/additions/fixes were added:
- EXR code only supported 'half' format (16 bits per channel). I've added
float writing, but for reading it I need tomorrow. :)
- Quite some clumsy copying of data happened in EXR code.
- cleaned up the api calls already a bit, preparing for more advanced
support
- Zbuffers were saved 16 bits, now 32 bits
- automatic adding of .exr extensions went wrong
Imbuf:
- added proper imbuf->flags and imbuf->mall support for float buffers, it
was created for *each* imbuf. :)
- found bugs for float buffers in scaling and flipping. Code there will
need more checks still
- imbuf also needs to be verified to behave properly when no 32 bits
rect exists (for saving for example)
TODO:
- support internal float images for textures, backbuf, AO probes, and
display in Image window
Hope this commit won't screwup syncing with bf-blender... :/
2006-01-09 01:40:35 +01:00
|
|
|
nval_gf = rectf[6];
|
|
|
|
diff_gf = nval_gf - val_gf;
|
|
|
|
|
2012-02-27 11:35:39 +01:00
|
|
|
val_rf = rectf[3];
|
Orange branch: OpenEXR finally in Blender!
Credits go to Gernot Ziegler, who originally coded EXR support, and to
Austin Benesh for bringing it further. Kent Mein provided a lot of code
for integrating float buffers in Blender imbuf and ImBuf API cleanup,
and provided Make and Scons and static linking.
At this moment; the EXR libraries are a *dependency*, so you cannot get
the Orange branch compiled without having OpenEXR installed. Get the
(precompiled or sources) stuff from www.openexr.com. Current default is
that the headers and lib resides in /user/local/
Several changes/additions/fixes were added:
- EXR code only supported 'half' format (16 bits per channel). I've added
float writing, but for reading it I need tomorrow. :)
- Quite some clumsy copying of data happened in EXR code.
- cleaned up the api calls already a bit, preparing for more advanced
support
- Zbuffers were saved 16 bits, now 32 bits
- automatic adding of .exr extensions went wrong
Imbuf:
- added proper imbuf->flags and imbuf->mall support for float buffers, it
was created for *each* imbuf. :)
- found bugs for float buffers in scaling and flipping. Code there will
need more checks still
- imbuf also needs to be verified to behave properly when no 32 bits
rect exists (for saving for example)
TODO:
- support internal float images for textures, backbuf, AO probes, and
display in Image window
Hope this commit won't screwup syncing with bf-blender... :/
2006-01-09 01:40:35 +01:00
|
|
|
nval_rf = rectf[7];
|
|
|
|
diff_rf = nval_rf - val_rf;
|
|
|
|
|
|
|
|
rectf += 8;
|
|
|
|
}
|
2012-02-27 11:35:39 +01:00
|
|
|
for (x = newx; x > 0; x--) {
|
|
|
|
if (sample >= 1.0f) {
|
2011-03-27 19:12:59 +02:00
|
|
|
sample -= 1.0f;
|
Orange branch: OpenEXR finally in Blender!
Credits go to Gernot Ziegler, who originally coded EXR support, and to
Austin Benesh for bringing it further. Kent Mein provided a lot of code
for integrating float buffers in Blender imbuf and ImBuf API cleanup,
and provided Make and Scons and static linking.
At this moment; the EXR libraries are a *dependency*, so you cannot get
the Orange branch compiled without having OpenEXR installed. Get the
(precompiled or sources) stuff from www.openexr.com. Current default is
that the headers and lib resides in /user/local/
Several changes/additions/fixes were added:
- EXR code only supported 'half' format (16 bits per channel). I've added
float writing, but for reading it I need tomorrow. :)
- Quite some clumsy copying of data happened in EXR code.
- cleaned up the api calls already a bit, preparing for more advanced
support
- Zbuffers were saved 16 bits, now 32 bits
- automatic adding of .exr extensions went wrong
Imbuf:
- added proper imbuf->flags and imbuf->mall support for float buffers, it
was created for *each* imbuf. :)
- found bugs for float buffers in scaling and flipping. Code there will
need more checks still
- imbuf also needs to be verified to behave properly when no 32 bits
rect exists (for saving for example)
TODO:
- support internal float images for textures, backbuf, AO probes, and
display in Image window
Hope this commit won't screwup syncing with bf-blender... :/
2006-01-09 01:40:35 +01:00
|
|
|
|
2006-09-14 14:21:18 +02:00
|
|
|
if (do_rect) {
|
2012-02-27 11:35:39 +01:00
|
|
|
val_a = nval_a;
|
|
|
|
nval_a = rect[0];
|
|
|
|
diff_a = nval_a - val_a;
|
2011-03-27 19:12:59 +02:00
|
|
|
val_a += 0.5f;
|
2006-09-14 14:21:18 +02:00
|
|
|
|
2012-02-27 11:35:39 +01:00
|
|
|
val_b = nval_b;
|
|
|
|
nval_b = rect[1];
|
|
|
|
diff_b = nval_b - val_b;
|
2011-03-27 19:12:59 +02:00
|
|
|
val_b += 0.5f;
|
2006-09-14 14:21:18 +02:00
|
|
|
|
2012-02-27 11:35:39 +01:00
|
|
|
val_g = nval_g;
|
|
|
|
nval_g = rect[2];
|
|
|
|
diff_g = nval_g - val_g;
|
2011-03-27 19:12:59 +02:00
|
|
|
val_g += 0.5f;
|
2006-09-14 14:21:18 +02:00
|
|
|
|
2012-02-27 11:35:39 +01:00
|
|
|
val_r = nval_r;
|
|
|
|
nval_r = rect[3];
|
|
|
|
diff_r = nval_r - val_r;
|
2011-03-27 19:12:59 +02:00
|
|
|
val_r += 0.5f;
|
2006-09-14 14:21:18 +02:00
|
|
|
rect += 4;
|
|
|
|
}
|
Orange branch: OpenEXR finally in Blender!
Credits go to Gernot Ziegler, who originally coded EXR support, and to
Austin Benesh for bringing it further. Kent Mein provided a lot of code
for integrating float buffers in Blender imbuf and ImBuf API cleanup,
and provided Make and Scons and static linking.
At this moment; the EXR libraries are a *dependency*, so you cannot get
the Orange branch compiled without having OpenEXR installed. Get the
(precompiled or sources) stuff from www.openexr.com. Current default is
that the headers and lib resides in /user/local/
Several changes/additions/fixes were added:
- EXR code only supported 'half' format (16 bits per channel). I've added
float writing, but for reading it I need tomorrow. :)
- Quite some clumsy copying of data happened in EXR code.
- cleaned up the api calls already a bit, preparing for more advanced
support
- Zbuffers were saved 16 bits, now 32 bits
- automatic adding of .exr extensions went wrong
Imbuf:
- added proper imbuf->flags and imbuf->mall support for float buffers, it
was created for *each* imbuf. :)
- found bugs for float buffers in scaling and flipping. Code there will
need more checks still
- imbuf also needs to be verified to behave properly when no 32 bits
rect exists (for saving for example)
TODO:
- support internal float images for textures, backbuf, AO probes, and
display in Image window
Hope this commit won't screwup syncing with bf-blender... :/
2006-01-09 01:40:35 +01:00
|
|
|
if (do_float) {
|
2012-02-27 11:35:39 +01:00
|
|
|
val_af = nval_af;
|
|
|
|
nval_af = rectf[0];
|
|
|
|
diff_af = nval_af - val_af;
|
Orange branch: OpenEXR finally in Blender!
Credits go to Gernot Ziegler, who originally coded EXR support, and to
Austin Benesh for bringing it further. Kent Mein provided a lot of code
for integrating float buffers in Blender imbuf and ImBuf API cleanup,
and provided Make and Scons and static linking.
At this moment; the EXR libraries are a *dependency*, so you cannot get
the Orange branch compiled without having OpenEXR installed. Get the
(precompiled or sources) stuff from www.openexr.com. Current default is
that the headers and lib resides in /user/local/
Several changes/additions/fixes were added:
- EXR code only supported 'half' format (16 bits per channel). I've added
float writing, but for reading it I need tomorrow. :)
- Quite some clumsy copying of data happened in EXR code.
- cleaned up the api calls already a bit, preparing for more advanced
support
- Zbuffers were saved 16 bits, now 32 bits
- automatic adding of .exr extensions went wrong
Imbuf:
- added proper imbuf->flags and imbuf->mall support for float buffers, it
was created for *each* imbuf. :)
- found bugs for float buffers in scaling and flipping. Code there will
need more checks still
- imbuf also needs to be verified to behave properly when no 32 bits
rect exists (for saving for example)
TODO:
- support internal float images for textures, backbuf, AO probes, and
display in Image window
Hope this commit won't screwup syncing with bf-blender... :/
2006-01-09 01:40:35 +01:00
|
|
|
|
2012-02-27 11:35:39 +01:00
|
|
|
val_bf = nval_bf;
|
|
|
|
nval_bf = rectf[1];
|
|
|
|
diff_bf = nval_bf - val_bf;
|
Orange branch: OpenEXR finally in Blender!
Credits go to Gernot Ziegler, who originally coded EXR support, and to
Austin Benesh for bringing it further. Kent Mein provided a lot of code
for integrating float buffers in Blender imbuf and ImBuf API cleanup,
and provided Make and Scons and static linking.
At this moment; the EXR libraries are a *dependency*, so you cannot get
the Orange branch compiled without having OpenEXR installed. Get the
(precompiled or sources) stuff from www.openexr.com. Current default is
that the headers and lib resides in /user/local/
Several changes/additions/fixes were added:
- EXR code only supported 'half' format (16 bits per channel). I've added
float writing, but for reading it I need tomorrow. :)
- Quite some clumsy copying of data happened in EXR code.
- cleaned up the api calls already a bit, preparing for more advanced
support
- Zbuffers were saved 16 bits, now 32 bits
- automatic adding of .exr extensions went wrong
Imbuf:
- added proper imbuf->flags and imbuf->mall support for float buffers, it
was created for *each* imbuf. :)
- found bugs for float buffers in scaling and flipping. Code there will
need more checks still
- imbuf also needs to be verified to behave properly when no 32 bits
rect exists (for saving for example)
TODO:
- support internal float images for textures, backbuf, AO probes, and
display in Image window
Hope this commit won't screwup syncing with bf-blender... :/
2006-01-09 01:40:35 +01:00
|
|
|
|
2012-02-27 11:35:39 +01:00
|
|
|
val_gf = nval_gf;
|
|
|
|
nval_gf = rectf[2];
|
|
|
|
diff_gf = nval_gf - val_gf;
|
Orange branch: OpenEXR finally in Blender!
Credits go to Gernot Ziegler, who originally coded EXR support, and to
Austin Benesh for bringing it further. Kent Mein provided a lot of code
for integrating float buffers in Blender imbuf and ImBuf API cleanup,
and provided Make and Scons and static linking.
At this moment; the EXR libraries are a *dependency*, so you cannot get
the Orange branch compiled without having OpenEXR installed. Get the
(precompiled or sources) stuff from www.openexr.com. Current default is
that the headers and lib resides in /user/local/
Several changes/additions/fixes were added:
- EXR code only supported 'half' format (16 bits per channel). I've added
float writing, but for reading it I need tomorrow. :)
- Quite some clumsy copying of data happened in EXR code.
- cleaned up the api calls already a bit, preparing for more advanced
support
- Zbuffers were saved 16 bits, now 32 bits
- automatic adding of .exr extensions went wrong
Imbuf:
- added proper imbuf->flags and imbuf->mall support for float buffers, it
was created for *each* imbuf. :)
- found bugs for float buffers in scaling and flipping. Code there will
need more checks still
- imbuf also needs to be verified to behave properly when no 32 bits
rect exists (for saving for example)
TODO:
- support internal float images for textures, backbuf, AO probes, and
display in Image window
Hope this commit won't screwup syncing with bf-blender... :/
2006-01-09 01:40:35 +01:00
|
|
|
|
2012-02-27 11:35:39 +01:00
|
|
|
val_rf = nval_rf;
|
|
|
|
nval_rf = rectf[3];
|
Orange branch: OpenEXR finally in Blender!
Credits go to Gernot Ziegler, who originally coded EXR support, and to
Austin Benesh for bringing it further. Kent Mein provided a lot of code
for integrating float buffers in Blender imbuf and ImBuf API cleanup,
and provided Make and Scons and static linking.
At this moment; the EXR libraries are a *dependency*, so you cannot get
the Orange branch compiled without having OpenEXR installed. Get the
(precompiled or sources) stuff from www.openexr.com. Current default is
that the headers and lib resides in /user/local/
Several changes/additions/fixes were added:
- EXR code only supported 'half' format (16 bits per channel). I've added
float writing, but for reading it I need tomorrow. :)
- Quite some clumsy copying of data happened in EXR code.
- cleaned up the api calls already a bit, preparing for more advanced
support
- Zbuffers were saved 16 bits, now 32 bits
- automatic adding of .exr extensions went wrong
Imbuf:
- added proper imbuf->flags and imbuf->mall support for float buffers, it
was created for *each* imbuf. :)
- found bugs for float buffers in scaling and flipping. Code there will
need more checks still
- imbuf also needs to be verified to behave properly when no 32 bits
rect exists (for saving for example)
TODO:
- support internal float images for textures, backbuf, AO probes, and
display in Image window
Hope this commit won't screwup syncing with bf-blender... :/
2006-01-09 01:40:35 +01:00
|
|
|
diff_rf = nval_rf - val_rf;
|
|
|
|
rectf += 4;
|
|
|
|
}
|
2002-10-12 13:37:38 +02:00
|
|
|
}
|
2006-09-14 14:21:18 +02:00
|
|
|
if (do_rect) {
|
|
|
|
newrect[0] = val_a + sample * diff_a;
|
|
|
|
newrect[1] = val_b + sample * diff_b;
|
|
|
|
newrect[2] = val_g + sample * diff_g;
|
|
|
|
newrect[3] = val_r + sample * diff_r;
|
|
|
|
newrect += 4;
|
|
|
|
}
|
Orange branch: OpenEXR finally in Blender!
Credits go to Gernot Ziegler, who originally coded EXR support, and to
Austin Benesh for bringing it further. Kent Mein provided a lot of code
for integrating float buffers in Blender imbuf and ImBuf API cleanup,
and provided Make and Scons and static linking.
At this moment; the EXR libraries are a *dependency*, so you cannot get
the Orange branch compiled without having OpenEXR installed. Get the
(precompiled or sources) stuff from www.openexr.com. Current default is
that the headers and lib resides in /user/local/
Several changes/additions/fixes were added:
- EXR code only supported 'half' format (16 bits per channel). I've added
float writing, but for reading it I need tomorrow. :)
- Quite some clumsy copying of data happened in EXR code.
- cleaned up the api calls already a bit, preparing for more advanced
support
- Zbuffers were saved 16 bits, now 32 bits
- automatic adding of .exr extensions went wrong
Imbuf:
- added proper imbuf->flags and imbuf->mall support for float buffers, it
was created for *each* imbuf. :)
- found bugs for float buffers in scaling and flipping. Code there will
need more checks still
- imbuf also needs to be verified to behave properly when no 32 bits
rect exists (for saving for example)
TODO:
- support internal float images for textures, backbuf, AO probes, and
display in Image window
Hope this commit won't screwup syncing with bf-blender... :/
2006-01-09 01:40:35 +01:00
|
|
|
if (do_float) {
|
|
|
|
newrectf[0] = val_af + sample * diff_af;
|
|
|
|
newrectf[1] = val_bf + sample * diff_bf;
|
|
|
|
newrectf[2] = val_gf + sample * diff_gf;
|
|
|
|
newrectf[3] = val_rf + sample * diff_rf;
|
|
|
|
newrectf += 4;
|
|
|
|
}
|
2002-10-12 13:37:38 +02:00
|
|
|
sample += add;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-09-14 14:21:18 +02:00
|
|
|
if (do_rect) {
|
|
|
|
imb_freerectImBuf(ibuf);
|
|
|
|
ibuf->mall |= IB_rect;
|
|
|
|
ibuf->rect = (unsigned int *) _newrect;
|
|
|
|
}
|
Orange branch: OpenEXR finally in Blender!
Credits go to Gernot Ziegler, who originally coded EXR support, and to
Austin Benesh for bringing it further. Kent Mein provided a lot of code
for integrating float buffers in Blender imbuf and ImBuf API cleanup,
and provided Make and Scons and static linking.
At this moment; the EXR libraries are a *dependency*, so you cannot get
the Orange branch compiled without having OpenEXR installed. Get the
(precompiled or sources) stuff from www.openexr.com. Current default is
that the headers and lib resides in /user/local/
Several changes/additions/fixes were added:
- EXR code only supported 'half' format (16 bits per channel). I've added
float writing, but for reading it I need tomorrow. :)
- Quite some clumsy copying of data happened in EXR code.
- cleaned up the api calls already a bit, preparing for more advanced
support
- Zbuffers were saved 16 bits, now 32 bits
- automatic adding of .exr extensions went wrong
Imbuf:
- added proper imbuf->flags and imbuf->mall support for float buffers, it
was created for *each* imbuf. :)
- found bugs for float buffers in scaling and flipping. Code there will
need more checks still
- imbuf also needs to be verified to behave properly when no 32 bits
rect exists (for saving for example)
TODO:
- support internal float images for textures, backbuf, AO probes, and
display in Image window
Hope this commit won't screwup syncing with bf-blender... :/
2006-01-09 01:40:35 +01:00
|
|
|
if (do_float) {
|
|
|
|
imb_freerectfloatImBuf(ibuf);
|
|
|
|
ibuf->mall |= IB_rectfloat;
|
|
|
|
ibuf->rect_float = (float *) _newrectf;
|
|
|
|
}
|
|
|
|
|
2002-10-12 13:37:38 +02:00
|
|
|
ibuf->x = newx;
|
|
|
|
return(ibuf);
|
|
|
|
}
|
|
|
|
|
2012-05-18 01:21:11 +02:00
|
|
|
static ImBuf *scaleupy(struct ImBuf *ibuf, int newy)
|
2002-10-12 13:37:38 +02:00
|
|
|
{
|
2012-05-16 11:26:37 +02:00
|
|
|
uchar *rect, *_newrect = NULL, *newrect;
|
|
|
|
float *rectf, *_newrectf = NULL, *newrectf;
|
2012-04-29 17:47:02 +02:00
|
|
|
float sample, add;
|
|
|
|
float val_a, nval_a, diff_a;
|
|
|
|
float val_b, nval_b, diff_b;
|
|
|
|
float val_g, nval_g, diff_g;
|
|
|
|
float val_r, nval_r, diff_r;
|
|
|
|
float val_af, nval_af, diff_af;
|
|
|
|
float val_bf, nval_bf, diff_bf;
|
|
|
|
float val_gf, nval_gf, diff_gf;
|
|
|
|
float val_rf, nval_rf, diff_rf;
|
2012-05-19 15:28:19 +02:00
|
|
|
int x, y, do_rect = FALSE, do_float = FALSE, skipx;
|
2002-10-12 13:37:38 +02:00
|
|
|
|
2006-09-14 14:21:18 +02:00
|
|
|
val_a = nval_a = diff_a = val_b = nval_b = diff_b = 0;
|
|
|
|
val_g = nval_g = diff_g = val_r = nval_r = diff_r = 0;
|
|
|
|
val_af = nval_af = diff_af = val_bf = nval_bf = diff_bf = 0;
|
|
|
|
val_gf = nval_gf = diff_gf = val_rf = nval_rf = diff_rf = 0;
|
2012-05-16 11:26:37 +02:00
|
|
|
if (ibuf == NULL) return(NULL);
|
|
|
|
if (ibuf->rect == NULL && ibuf->rect_float == NULL) return (ibuf);
|
2002-10-12 13:37:38 +02:00
|
|
|
|
2006-09-14 14:21:18 +02:00
|
|
|
if (ibuf->rect) {
|
2012-05-19 15:28:19 +02:00
|
|
|
do_rect = TRUE;
|
2006-09-14 14:21:18 +02:00
|
|
|
_newrect = MEM_mallocN(ibuf->x * newy * sizeof(int), "scaleupy");
|
2012-05-16 11:26:37 +02:00
|
|
|
if (_newrect == NULL) return(ibuf);
|
2006-09-14 14:21:18 +02:00
|
|
|
}
|
Orange branch: OpenEXR finally in Blender!
Credits go to Gernot Ziegler, who originally coded EXR support, and to
Austin Benesh for bringing it further. Kent Mein provided a lot of code
for integrating float buffers in Blender imbuf and ImBuf API cleanup,
and provided Make and Scons and static linking.
At this moment; the EXR libraries are a *dependency*, so you cannot get
the Orange branch compiled without having OpenEXR installed. Get the
(precompiled or sources) stuff from www.openexr.com. Current default is
that the headers and lib resides in /user/local/
Several changes/additions/fixes were added:
- EXR code only supported 'half' format (16 bits per channel). I've added
float writing, but for reading it I need tomorrow. :)
- Quite some clumsy copying of data happened in EXR code.
- cleaned up the api calls already a bit, preparing for more advanced
support
- Zbuffers were saved 16 bits, now 32 bits
- automatic adding of .exr extensions went wrong
Imbuf:
- added proper imbuf->flags and imbuf->mall support for float buffers, it
was created for *each* imbuf. :)
- found bugs for float buffers in scaling and flipping. Code there will
need more checks still
- imbuf also needs to be verified to behave properly when no 32 bits
rect exists (for saving for example)
TODO:
- support internal float images for textures, backbuf, AO probes, and
display in Image window
Hope this commit won't screwup syncing with bf-blender... :/
2006-01-09 01:40:35 +01:00
|
|
|
if (ibuf->rect_float) {
|
2012-05-19 15:28:19 +02:00
|
|
|
do_float = TRUE;
|
2006-09-14 14:21:18 +02:00
|
|
|
_newrectf = MEM_mallocN(ibuf->x * newy * sizeof(float) * 4, "scaleupyf");
|
2012-05-16 11:26:37 +02:00
|
|
|
if (_newrectf == NULL) {
|
2006-09-14 14:21:18 +02:00
|
|
|
if (_newrect) MEM_freeN(_newrect);
|
|
|
|
return(ibuf);
|
|
|
|
}
|
Orange branch: OpenEXR finally in Blender!
Credits go to Gernot Ziegler, who originally coded EXR support, and to
Austin Benesh for bringing it further. Kent Mein provided a lot of code
for integrating float buffers in Blender imbuf and ImBuf API cleanup,
and provided Make and Scons and static linking.
At this moment; the EXR libraries are a *dependency*, so you cannot get
the Orange branch compiled without having OpenEXR installed. Get the
(precompiled or sources) stuff from www.openexr.com. Current default is
that the headers and lib resides in /user/local/
Several changes/additions/fixes were added:
- EXR code only supported 'half' format (16 bits per channel). I've added
float writing, but for reading it I need tomorrow. :)
- Quite some clumsy copying of data happened in EXR code.
- cleaned up the api calls already a bit, preparing for more advanced
support
- Zbuffers were saved 16 bits, now 32 bits
- automatic adding of .exr extensions went wrong
Imbuf:
- added proper imbuf->flags and imbuf->mall support for float buffers, it
was created for *each* imbuf. :)
- found bugs for float buffers in scaling and flipping. Code there will
need more checks still
- imbuf also needs to be verified to behave properly when no 32 bits
rect exists (for saving for example)
TODO:
- support internal float images for textures, backbuf, AO probes, and
display in Image window
Hope this commit won't screwup syncing with bf-blender... :/
2006-01-09 01:40:35 +01:00
|
|
|
}
|
2006-06-10 21:56:28 +02:00
|
|
|
|
2002-10-12 13:37:38 +02:00
|
|
|
add = (ibuf->y - 1.001) / (newy - 1.0);
|
|
|
|
skipx = 4 * ibuf->x;
|
|
|
|
|
2006-09-14 14:21:18 +02:00
|
|
|
rect = (uchar *) ibuf->rect;
|
|
|
|
rectf = (float *) ibuf->rect_float;
|
|
|
|
newrect = _newrect;
|
|
|
|
newrectf = _newrectf;
|
|
|
|
|
2012-02-27 11:35:39 +01:00
|
|
|
for (x = ibuf->x; x > 0; x--) {
|
2006-09-14 14:21:18 +02:00
|
|
|
|
|
|
|
sample = 0;
|
|
|
|
if (do_rect) {
|
2012-05-16 11:26:37 +02:00
|
|
|
rect = ((uchar *)ibuf->rect) + 4 * (x - 1);
|
|
|
|
newrect = _newrect + 4 * (x - 1);
|
2006-09-14 14:21:18 +02:00
|
|
|
|
2012-02-27 11:35:39 +01:00
|
|
|
val_a = rect[0];
|
2006-09-14 14:21:18 +02:00
|
|
|
nval_a = rect[skipx];
|
2012-02-27 11:35:39 +01:00
|
|
|
diff_a = nval_a - val_a;
|
2011-03-27 19:12:59 +02:00
|
|
|
val_a += 0.5f;
|
2006-09-14 14:21:18 +02:00
|
|
|
|
2012-02-27 11:35:39 +01:00
|
|
|
val_b = rect[1];
|
2012-05-16 11:26:37 +02:00
|
|
|
nval_b = rect[skipx + 1];
|
2012-02-27 11:35:39 +01:00
|
|
|
diff_b = nval_b - val_b;
|
2011-03-27 19:12:59 +02:00
|
|
|
val_b += 0.5f;
|
2006-09-14 14:21:18 +02:00
|
|
|
|
2012-02-27 11:35:39 +01:00
|
|
|
val_g = rect[2];
|
2012-05-16 11:26:37 +02:00
|
|
|
nval_g = rect[skipx + 2];
|
2012-02-27 11:35:39 +01:00
|
|
|
diff_g = nval_g - val_g;
|
2011-03-27 19:12:59 +02:00
|
|
|
val_g += 0.5f;
|
2006-09-14 14:21:18 +02:00
|
|
|
|
2012-02-27 11:35:39 +01:00
|
|
|
val_r = rect[3];
|
2012-05-16 11:26:37 +02:00
|
|
|
nval_r = rect[skipx + 4];
|
2012-02-27 11:35:39 +01:00
|
|
|
diff_r = nval_r - val_r;
|
2011-03-27 19:12:59 +02:00
|
|
|
val_r += 0.5f;
|
2006-09-14 14:21:18 +02:00
|
|
|
|
2012-05-16 11:26:37 +02:00
|
|
|
rect += 2 * skipx;
|
2006-09-14 14:21:18 +02:00
|
|
|
}
|
|
|
|
if (do_float) {
|
2012-08-02 13:33:21 +02:00
|
|
|
rectf = ibuf->rect_float + 4 * (x - 1);
|
2012-05-16 11:26:37 +02:00
|
|
|
newrectf = _newrectf + 4 * (x - 1);
|
2006-09-14 14:21:18 +02:00
|
|
|
|
2012-02-27 11:35:39 +01:00
|
|
|
val_af = rectf[0];
|
2006-09-14 14:21:18 +02:00
|
|
|
nval_af = rectf[skipx];
|
|
|
|
diff_af = nval_af - val_af;
|
|
|
|
|
2012-02-27 11:35:39 +01:00
|
|
|
val_bf = rectf[1];
|
2012-05-16 11:26:37 +02:00
|
|
|
nval_bf = rectf[skipx + 1];
|
2006-09-14 14:21:18 +02:00
|
|
|
diff_bf = nval_bf - val_bf;
|
|
|
|
|
2012-02-27 11:35:39 +01:00
|
|
|
val_gf = rectf[2];
|
2012-05-16 11:26:37 +02:00
|
|
|
nval_gf = rectf[skipx + 2];
|
2006-09-14 14:21:18 +02:00
|
|
|
diff_gf = nval_gf - val_gf;
|
2002-10-12 13:37:38 +02:00
|
|
|
|
2012-02-27 11:35:39 +01:00
|
|
|
val_rf = rectf[3];
|
2012-05-16 11:26:37 +02:00
|
|
|
nval_rf = rectf[skipx + 3];
|
2006-09-14 14:21:18 +02:00
|
|
|
diff_rf = nval_rf - val_rf;
|
|
|
|
|
2012-05-16 11:26:37 +02:00
|
|
|
rectf += 2 * skipx;
|
2006-09-14 14:21:18 +02:00
|
|
|
}
|
|
|
|
|
2012-02-27 11:35:39 +01:00
|
|
|
for (y = newy; y > 0; y--) {
|
|
|
|
if (sample >= 1.0f) {
|
2011-03-27 19:12:59 +02:00
|
|
|
sample -= 1.0f;
|
2006-09-14 14:21:18 +02:00
|
|
|
|
|
|
|
if (do_rect) {
|
2012-02-27 11:35:39 +01:00
|
|
|
val_a = nval_a;
|
|
|
|
nval_a = rect[0];
|
|
|
|
diff_a = nval_a - val_a;
|
2011-03-27 19:12:59 +02:00
|
|
|
val_a += 0.5f;
|
2006-09-14 14:21:18 +02:00
|
|
|
|
2012-02-27 11:35:39 +01:00
|
|
|
val_b = nval_b;
|
|
|
|
nval_b = rect[1];
|
|
|
|
diff_b = nval_b - val_b;
|
2011-03-27 19:12:59 +02:00
|
|
|
val_b += 0.5f;
|
2006-09-14 14:21:18 +02:00
|
|
|
|
2012-02-27 11:35:39 +01:00
|
|
|
val_g = nval_g;
|
|
|
|
nval_g = rect[2];
|
|
|
|
diff_g = nval_g - val_g;
|
2011-03-27 19:12:59 +02:00
|
|
|
val_g += 0.5f;
|
2006-09-14 14:21:18 +02:00
|
|
|
|
2012-02-27 11:35:39 +01:00
|
|
|
val_r = nval_r;
|
|
|
|
nval_r = rect[3];
|
|
|
|
diff_r = nval_r - val_r;
|
2011-03-27 19:12:59 +02:00
|
|
|
val_r += 0.5f;
|
2002-10-12 13:37:38 +02:00
|
|
|
rect += skipx;
|
|
|
|
}
|
Orange branch: OpenEXR finally in Blender!
Credits go to Gernot Ziegler, who originally coded EXR support, and to
Austin Benesh for bringing it further. Kent Mein provided a lot of code
for integrating float buffers in Blender imbuf and ImBuf API cleanup,
and provided Make and Scons and static linking.
At this moment; the EXR libraries are a *dependency*, so you cannot get
the Orange branch compiled without having OpenEXR installed. Get the
(precompiled or sources) stuff from www.openexr.com. Current default is
that the headers and lib resides in /user/local/
Several changes/additions/fixes were added:
- EXR code only supported 'half' format (16 bits per channel). I've added
float writing, but for reading it I need tomorrow. :)
- Quite some clumsy copying of data happened in EXR code.
- cleaned up the api calls already a bit, preparing for more advanced
support
- Zbuffers were saved 16 bits, now 32 bits
- automatic adding of .exr extensions went wrong
Imbuf:
- added proper imbuf->flags and imbuf->mall support for float buffers, it
was created for *each* imbuf. :)
- found bugs for float buffers in scaling and flipping. Code there will
need more checks still
- imbuf also needs to be verified to behave properly when no 32 bits
rect exists (for saving for example)
TODO:
- support internal float images for textures, backbuf, AO probes, and
display in Image window
Hope this commit won't screwup syncing with bf-blender... :/
2006-01-09 01:40:35 +01:00
|
|
|
if (do_float) {
|
2012-02-27 11:35:39 +01:00
|
|
|
val_af = nval_af;
|
|
|
|
nval_af = rectf[0];
|
|
|
|
diff_af = nval_af - val_af;
|
2006-09-14 14:21:18 +02:00
|
|
|
|
2012-02-27 11:35:39 +01:00
|
|
|
val_bf = nval_bf;
|
|
|
|
nval_bf = rectf[1];
|
|
|
|
diff_bf = nval_bf - val_bf;
|
2006-09-14 14:21:18 +02:00
|
|
|
|
2012-02-27 11:35:39 +01:00
|
|
|
val_gf = nval_gf;
|
|
|
|
nval_gf = rectf[2];
|
|
|
|
diff_gf = nval_gf - val_gf;
|
2006-09-14 14:21:18 +02:00
|
|
|
|
2012-02-27 11:35:39 +01:00
|
|
|
val_rf = nval_rf;
|
|
|
|
nval_rf = rectf[3];
|
2006-09-14 14:21:18 +02:00
|
|
|
diff_rf = nval_rf - val_rf;
|
|
|
|
rectf += skipx;
|
Orange branch: OpenEXR finally in Blender!
Credits go to Gernot Ziegler, who originally coded EXR support, and to
Austin Benesh for bringing it further. Kent Mein provided a lot of code
for integrating float buffers in Blender imbuf and ImBuf API cleanup,
and provided Make and Scons and static linking.
At this moment; the EXR libraries are a *dependency*, so you cannot get
the Orange branch compiled without having OpenEXR installed. Get the
(precompiled or sources) stuff from www.openexr.com. Current default is
that the headers and lib resides in /user/local/
Several changes/additions/fixes were added:
- EXR code only supported 'half' format (16 bits per channel). I've added
float writing, but for reading it I need tomorrow. :)
- Quite some clumsy copying of data happened in EXR code.
- cleaned up the api calls already a bit, preparing for more advanced
support
- Zbuffers were saved 16 bits, now 32 bits
- automatic adding of .exr extensions went wrong
Imbuf:
- added proper imbuf->flags and imbuf->mall support for float buffers, it
was created for *each* imbuf. :)
- found bugs for float buffers in scaling and flipping. Code there will
need more checks still
- imbuf also needs to be verified to behave properly when no 32 bits
rect exists (for saving for example)
TODO:
- support internal float images for textures, backbuf, AO probes, and
display in Image window
Hope this commit won't screwup syncing with bf-blender... :/
2006-01-09 01:40:35 +01:00
|
|
|
}
|
2002-10-12 13:37:38 +02:00
|
|
|
}
|
2006-09-14 14:21:18 +02:00
|
|
|
if (do_rect) {
|
|
|
|
newrect[0] = val_a + sample * diff_a;
|
|
|
|
newrect[1] = val_b + sample * diff_b;
|
|
|
|
newrect[2] = val_g + sample * diff_g;
|
|
|
|
newrect[3] = val_r + sample * diff_r;
|
|
|
|
newrect += skipx;
|
|
|
|
}
|
|
|
|
if (do_float) {
|
|
|
|
newrectf[0] = val_af + sample * diff_af;
|
|
|
|
newrectf[1] = val_bf + sample * diff_bf;
|
|
|
|
newrectf[2] = val_gf + sample * diff_gf;
|
|
|
|
newrectf[3] = val_rf + sample * diff_rf;
|
|
|
|
newrectf += skipx;
|
|
|
|
}
|
|
|
|
sample += add;
|
2002-10-12 13:37:38 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-09-14 14:21:18 +02:00
|
|
|
if (do_rect) {
|
|
|
|
imb_freerectImBuf(ibuf);
|
|
|
|
ibuf->mall |= IB_rect;
|
|
|
|
ibuf->rect = (unsigned int *) _newrect;
|
|
|
|
}
|
|
|
|
if (do_float) {
|
Orange branch: OpenEXR finally in Blender!
Credits go to Gernot Ziegler, who originally coded EXR support, and to
Austin Benesh for bringing it further. Kent Mein provided a lot of code
for integrating float buffers in Blender imbuf and ImBuf API cleanup,
and provided Make and Scons and static linking.
At this moment; the EXR libraries are a *dependency*, so you cannot get
the Orange branch compiled without having OpenEXR installed. Get the
(precompiled or sources) stuff from www.openexr.com. Current default is
that the headers and lib resides in /user/local/
Several changes/additions/fixes were added:
- EXR code only supported 'half' format (16 bits per channel). I've added
float writing, but for reading it I need tomorrow. :)
- Quite some clumsy copying of data happened in EXR code.
- cleaned up the api calls already a bit, preparing for more advanced
support
- Zbuffers were saved 16 bits, now 32 bits
- automatic adding of .exr extensions went wrong
Imbuf:
- added proper imbuf->flags and imbuf->mall support for float buffers, it
was created for *each* imbuf. :)
- found bugs for float buffers in scaling and flipping. Code there will
need more checks still
- imbuf also needs to be verified to behave properly when no 32 bits
rect exists (for saving for example)
TODO:
- support internal float images for textures, backbuf, AO probes, and
display in Image window
Hope this commit won't screwup syncing with bf-blender... :/
2006-01-09 01:40:35 +01:00
|
|
|
imb_freerectfloatImBuf(ibuf);
|
|
|
|
ibuf->mall |= IB_rectfloat;
|
2006-09-14 14:21:18 +02:00
|
|
|
ibuf->rect_float = (float *) _newrectf;
|
Orange branch: OpenEXR finally in Blender!
Credits go to Gernot Ziegler, who originally coded EXR support, and to
Austin Benesh for bringing it further. Kent Mein provided a lot of code
for integrating float buffers in Blender imbuf and ImBuf API cleanup,
and provided Make and Scons and static linking.
At this moment; the EXR libraries are a *dependency*, so you cannot get
the Orange branch compiled without having OpenEXR installed. Get the
(precompiled or sources) stuff from www.openexr.com. Current default is
that the headers and lib resides in /user/local/
Several changes/additions/fixes were added:
- EXR code only supported 'half' format (16 bits per channel). I've added
float writing, but for reading it I need tomorrow. :)
- Quite some clumsy copying of data happened in EXR code.
- cleaned up the api calls already a bit, preparing for more advanced
support
- Zbuffers were saved 16 bits, now 32 bits
- automatic adding of .exr extensions went wrong
Imbuf:
- added proper imbuf->flags and imbuf->mall support for float buffers, it
was created for *each* imbuf. :)
- found bugs for float buffers in scaling and flipping. Code there will
need more checks still
- imbuf also needs to be verified to behave properly when no 32 bits
rect exists (for saving for example)
TODO:
- support internal float images for textures, backbuf, AO probes, and
display in Image window
Hope this commit won't screwup syncing with bf-blender... :/
2006-01-09 01:40:35 +01:00
|
|
|
}
|
2006-09-14 14:21:18 +02:00
|
|
|
|
2002-10-12 13:37:38 +02:00
|
|
|
ibuf->y = newy;
|
|
|
|
return(ibuf);
|
|
|
|
}
|
|
|
|
|
2006-09-14 14:21:18 +02:00
|
|
|
|
Orange branch: OpenEXR finally in Blender!
Credits go to Gernot Ziegler, who originally coded EXR support, and to
Austin Benesh for bringing it further. Kent Mein provided a lot of code
for integrating float buffers in Blender imbuf and ImBuf API cleanup,
and provided Make and Scons and static linking.
At this moment; the EXR libraries are a *dependency*, so you cannot get
the Orange branch compiled without having OpenEXR installed. Get the
(precompiled or sources) stuff from www.openexr.com. Current default is
that the headers and lib resides in /user/local/
Several changes/additions/fixes were added:
- EXR code only supported 'half' format (16 bits per channel). I've added
float writing, but for reading it I need tomorrow. :)
- Quite some clumsy copying of data happened in EXR code.
- cleaned up the api calls already a bit, preparing for more advanced
support
- Zbuffers were saved 16 bits, now 32 bits
- automatic adding of .exr extensions went wrong
Imbuf:
- added proper imbuf->flags and imbuf->mall support for float buffers, it
was created for *each* imbuf. :)
- found bugs for float buffers in scaling and flipping. Code there will
need more checks still
- imbuf also needs to be verified to behave properly when no 32 bits
rect exists (for saving for example)
TODO:
- support internal float images for textures, backbuf, AO probes, and
display in Image window
Hope this commit won't screwup syncing with bf-blender... :/
2006-01-09 01:40:35 +01:00
|
|
|
/* no float buf needed here! */
|
2011-03-17 06:15:54 +01:00
|
|
|
static void scalefast_Z_ImBuf(ImBuf *ibuf, int newx, int newy)
|
2002-10-12 13:37:38 +02:00
|
|
|
{
|
Orange branch: OpenEXR finally in Blender!
Credits go to Gernot Ziegler, who originally coded EXR support, and to
Austin Benesh for bringing it further. Kent Mein provided a lot of code
for integrating float buffers in Blender imbuf and ImBuf API cleanup,
and provided Make and Scons and static linking.
At this moment; the EXR libraries are a *dependency*, so you cannot get
the Orange branch compiled without having OpenEXR installed. Get the
(precompiled or sources) stuff from www.openexr.com. Current default is
that the headers and lib resides in /user/local/
Several changes/additions/fixes were added:
- EXR code only supported 'half' format (16 bits per channel). I've added
float writing, but for reading it I need tomorrow. :)
- Quite some clumsy copying of data happened in EXR code.
- cleaned up the api calls already a bit, preparing for more advanced
support
- Zbuffers were saved 16 bits, now 32 bits
- automatic adding of .exr extensions went wrong
Imbuf:
- added proper imbuf->flags and imbuf->mall support for float buffers, it
was created for *each* imbuf. :)
- found bugs for float buffers in scaling and flipping. Code there will
need more checks still
- imbuf also needs to be verified to behave properly when no 32 bits
rect exists (for saving for example)
TODO:
- support internal float images for textures, backbuf, AO probes, and
display in Image window
Hope this commit won't screwup syncing with bf-blender... :/
2006-01-09 01:40:35 +01:00
|
|
|
unsigned int *rect, *_newrect, *newrect;
|
|
|
|
int x, y;
|
|
|
|
int ofsx, ofsy, stepx, stepy;
|
2002-10-12 13:37:38 +02:00
|
|
|
|
|
|
|
if (ibuf->zbuf) {
|
Orange branch: OpenEXR finally in Blender!
Credits go to Gernot Ziegler, who originally coded EXR support, and to
Austin Benesh for bringing it further. Kent Mein provided a lot of code
for integrating float buffers in Blender imbuf and ImBuf API cleanup,
and provided Make and Scons and static linking.
At this moment; the EXR libraries are a *dependency*, so you cannot get
the Orange branch compiled without having OpenEXR installed. Get the
(precompiled or sources) stuff from www.openexr.com. Current default is
that the headers and lib resides in /user/local/
Several changes/additions/fixes were added:
- EXR code only supported 'half' format (16 bits per channel). I've added
float writing, but for reading it I need tomorrow. :)
- Quite some clumsy copying of data happened in EXR code.
- cleaned up the api calls already a bit, preparing for more advanced
support
- Zbuffers were saved 16 bits, now 32 bits
- automatic adding of .exr extensions went wrong
Imbuf:
- added proper imbuf->flags and imbuf->mall support for float buffers, it
was created for *each* imbuf. :)
- found bugs for float buffers in scaling and flipping. Code there will
need more checks still
- imbuf also needs to be verified to behave properly when no 32 bits
rect exists (for saving for example)
TODO:
- support internal float images for textures, backbuf, AO probes, and
display in Image window
Hope this commit won't screwup syncing with bf-blender... :/
2006-01-09 01:40:35 +01:00
|
|
|
_newrect = MEM_mallocN(newx * newy * sizeof(int), "z rect");
|
2012-05-16 11:26:37 +02:00
|
|
|
if (_newrect == NULL) return;
|
Orange branch: OpenEXR finally in Blender!
Credits go to Gernot Ziegler, who originally coded EXR support, and to
Austin Benesh for bringing it further. Kent Mein provided a lot of code
for integrating float buffers in Blender imbuf and ImBuf API cleanup,
and provided Make and Scons and static linking.
At this moment; the EXR libraries are a *dependency*, so you cannot get
the Orange branch compiled without having OpenEXR installed. Get the
(precompiled or sources) stuff from www.openexr.com. Current default is
that the headers and lib resides in /user/local/
Several changes/additions/fixes were added:
- EXR code only supported 'half' format (16 bits per channel). I've added
float writing, but for reading it I need tomorrow. :)
- Quite some clumsy copying of data happened in EXR code.
- cleaned up the api calls already a bit, preparing for more advanced
support
- Zbuffers were saved 16 bits, now 32 bits
- automatic adding of .exr extensions went wrong
Imbuf:
- added proper imbuf->flags and imbuf->mall support for float buffers, it
was created for *each* imbuf. :)
- found bugs for float buffers in scaling and flipping. Code there will
need more checks still
- imbuf also needs to be verified to behave properly when no 32 bits
rect exists (for saving for example)
TODO:
- support internal float images for textures, backbuf, AO probes, and
display in Image window
Hope this commit won't screwup syncing with bf-blender... :/
2006-01-09 01:40:35 +01:00
|
|
|
|
2002-10-12 13:37:38 +02:00
|
|
|
stepx = (65536.0 * (ibuf->x - 1.0) / (newx - 1.0)) + 0.5;
|
|
|
|
stepy = (65536.0 * (ibuf->y - 1.0) / (newy - 1.0)) + 0.5;
|
|
|
|
ofsy = 32768;
|
|
|
|
|
|
|
|
newrect = _newrect;
|
|
|
|
|
2012-02-27 11:35:39 +01:00
|
|
|
for (y = newy; y > 0; y--) {
|
2012-05-16 11:26:37 +02:00
|
|
|
rect = (unsigned int *) ibuf->zbuf;
|
2002-10-12 13:37:38 +02:00
|
|
|
rect += (ofsy >> 16) * ibuf->x;
|
|
|
|
ofsy += stepy;
|
|
|
|
ofsx = 32768;
|
2012-02-27 11:35:39 +01:00
|
|
|
for (x = newx; x > 0; x--) {
|
2002-10-12 13:37:38 +02:00
|
|
|
*newrect++ = rect[ofsx >> 16];
|
|
|
|
ofsx += stepx;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
IMB_freezbufImBuf(ibuf);
|
|
|
|
ibuf->mall |= IB_zbuf;
|
2012-05-16 11:26:37 +02:00
|
|
|
ibuf->zbuf = (int *) _newrect;
|
2002-10-12 13:37:38 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-05-16 11:26:37 +02:00
|
|
|
struct ImBuf *IMB_scaleImBuf(struct ImBuf *ibuf, unsigned int newx, unsigned int newy)
|
2002-10-12 13:37:38 +02:00
|
|
|
{
|
2012-05-16 11:26:37 +02:00
|
|
|
if (ibuf == NULL) return (NULL);
|
|
|
|
if (ibuf->rect == NULL && ibuf->rect_float == NULL) return (ibuf);
|
2008-01-30 16:41:02 +01:00
|
|
|
|
|
|
|
if (newx == ibuf->x && newy == ibuf->y) { return ibuf; }
|
2002-10-12 13:37:38 +02:00
|
|
|
|
2008-01-30 16:41:02 +01:00
|
|
|
/* scaleup / scaledown functions below change ibuf->x and ibuf->y
|
2012-03-09 19:28:30 +01:00
|
|
|
* so we first scale the Z-buffer (if any) */
|
2002-10-12 13:37:38 +02:00
|
|
|
scalefast_Z_ImBuf(ibuf, newx, newy);
|
|
|
|
|
2008-01-30 16:41:02 +01:00
|
|
|
/* try to scale common cases in a fast way */
|
2012-07-17 01:23:33 +02:00
|
|
|
/* disabled, quality loss is unacceptable, see report #18609 (ton) */
|
2009-05-18 12:34:26 +02:00
|
|
|
if (0 && q_scale_linear_interpolation(ibuf, newx, newy)) {
|
2008-01-30 16:41:02 +01:00
|
|
|
return ibuf;
|
|
|
|
}
|
|
|
|
|
2012-04-29 17:47:02 +02:00
|
|
|
if (newx < ibuf->x) if (newx) scaledownx(ibuf, newx);
|
|
|
|
if (newy < ibuf->y) if (newy) scaledowny(ibuf, newy);
|
|
|
|
if (newx > ibuf->x) if (newx) scaleupx(ibuf, newx);
|
|
|
|
if (newy > ibuf->y) if (newy) scaleupy(ibuf, newy);
|
2002-10-12 13:37:38 +02:00
|
|
|
|
|
|
|
return(ibuf);
|
|
|
|
}
|
|
|
|
|
Giant commit!
A full detailed description of this will be done later... is several days
of work. Here's a summary:
Render:
- Full cleanup of render code, removing *all* globals and bad level calls
all over blender. Render module is now not called abusive anymore
- API-fied calls to rendering
- Full recode of internal render pipeline. Is now rendering tiles by
default, prepared for much smarter 'bucket' render later.
- Each thread now can render a full part
- Renders were tested with 4 threads, goes fine, apart from some lookup
tables in softshadow and AO still
- Rendering is prepared to do multiple layers and passes
- No single 32 bits trick in render code anymore, all 100% floats now.
Writing images/movies
- moved writing images to blender kernel (bye bye 'schrijfplaatje'!)
- made a new Movie handle system, also in kernel. This will enable much
easier use of movies in Blender
PreviewRender:
- Using new render API, previewrender (in buttons) now uses regular render
code to generate images.
- new datafile 'preview.blend.c' has the preview scenes in it
- previews get rendered in exact displayed size (1 pixel = 1 pixel)
3D Preview render
- new; press Pkey in 3d window, for a panel that continuously renders
(pkey is for games, i know... but we dont do that in orange now!)
- this render works nearly identical to buttons-preview render, so it stops
rendering on any event (mouse, keyboard, etc)
- on moving/scaling the panel, the render code doesn't recreate all geometry
- same for shifting/panning view
- all other operations (now) regenerate the full render database still.
- this is WIP... but big fun, especially for simple scenes!
Compositor
- Using same node system as now in use for shaders, you can composit images
- works pretty straightforward... needs much more options/tools and integration
with rendering still
- is not threaded yet, nor is so smart to only recalculate changes... will be
done soon!
- the "Render Result" node will get all layers/passes as output sockets
- The "Output" node renders to a builtin image, which you can view in the Image
window. (yes, output nodes to render-result, and to files, is on the list!)
The Bad News
- "Unified Render" is removed. It might come back in some stage, but this
system should be built from scratch. I can't really understand this code...
I expect it is not much needed, especially with advanced layer/passes
control
- Panorama render, Field render, Motion blur, is not coded yet... (I had to
recode every single feature in render, so...!)
- Lens Flare is also not back... needs total revision, might become composit
effect though (using zbuffer for visibility)
- Part render is gone! (well, thats obvious, its default now).
- The render window is only restored with limited functionality... I am going
to check first the option to render to a Image window, so Blender can become
a true single-window application. :)
For example, the 'Spare render buffer' (jkey) doesnt work.
- Render with border, now default creates a smaller image
- No zbuffers are written yet... on the todo!
- Scons files and MSVC will need work to get compiling again
OK... thats what I can quickly recall. Now go compiling!
2006-01-23 23:05:47 +01:00
|
|
|
struct imbufRGBA {
|
|
|
|
float r, g, b, a;
|
|
|
|
};
|
2002-10-12 13:37:38 +02:00
|
|
|
|
2010-09-28 12:03:56 +02:00
|
|
|
struct ImBuf *IMB_scalefastImBuf(struct ImBuf *ibuf, unsigned int newx, unsigned int newy)
|
2002-10-12 13:37:38 +02:00
|
|
|
{
|
2012-04-29 17:47:02 +02:00
|
|
|
unsigned int *rect, *_newrect, *newrect;
|
Giant commit!
A full detailed description of this will be done later... is several days
of work. Here's a summary:
Render:
- Full cleanup of render code, removing *all* globals and bad level calls
all over blender. Render module is now not called abusive anymore
- API-fied calls to rendering
- Full recode of internal render pipeline. Is now rendering tiles by
default, prepared for much smarter 'bucket' render later.
- Each thread now can render a full part
- Renders were tested with 4 threads, goes fine, apart from some lookup
tables in softshadow and AO still
- Rendering is prepared to do multiple layers and passes
- No single 32 bits trick in render code anymore, all 100% floats now.
Writing images/movies
- moved writing images to blender kernel (bye bye 'schrijfplaatje'!)
- made a new Movie handle system, also in kernel. This will enable much
easier use of movies in Blender
PreviewRender:
- Using new render API, previewrender (in buttons) now uses regular render
code to generate images.
- new datafile 'preview.blend.c' has the preview scenes in it
- previews get rendered in exact displayed size (1 pixel = 1 pixel)
3D Preview render
- new; press Pkey in 3d window, for a panel that continuously renders
(pkey is for games, i know... but we dont do that in orange now!)
- this render works nearly identical to buttons-preview render, so it stops
rendering on any event (mouse, keyboard, etc)
- on moving/scaling the panel, the render code doesn't recreate all geometry
- same for shifting/panning view
- all other operations (now) regenerate the full render database still.
- this is WIP... but big fun, especially for simple scenes!
Compositor
- Using same node system as now in use for shaders, you can composit images
- works pretty straightforward... needs much more options/tools and integration
with rendering still
- is not threaded yet, nor is so smart to only recalculate changes... will be
done soon!
- the "Render Result" node will get all layers/passes as output sockets
- The "Output" node renders to a builtin image, which you can view in the Image
window. (yes, output nodes to render-result, and to files, is on the list!)
The Bad News
- "Unified Render" is removed. It might come back in some stage, but this
system should be built from scratch. I can't really understand this code...
I expect it is not much needed, especially with advanced layer/passes
control
- Panorama render, Field render, Motion blur, is not coded yet... (I had to
recode every single feature in render, so...!)
- Lens Flare is also not back... needs total revision, might become composit
effect though (using zbuffer for visibility)
- Part render is gone! (well, thats obvious, its default now).
- The render window is only restored with limited functionality... I am going
to check first the option to render to a Image window, so Blender can become
a true single-window application. :)
For example, the 'Spare render buffer' (jkey) doesnt work.
- Render with border, now default creates a smaller image
- No zbuffers are written yet... on the todo!
- Scons files and MSVC will need work to get compiling again
OK... thats what I can quickly recall. Now go compiling!
2006-01-23 23:05:47 +01:00
|
|
|
struct imbufRGBA *rectf, *_newrectf, *newrectf;
|
2012-05-19 15:28:19 +02:00
|
|
|
int x, y, do_float = FALSE, do_rect = FALSE;
|
2012-04-29 17:47:02 +02:00
|
|
|
int ofsx, ofsy, stepx, stepy;
|
2002-10-12 13:37:38 +02:00
|
|
|
|
Giant commit!
A full detailed description of this will be done later... is several days
of work. Here's a summary:
Render:
- Full cleanup of render code, removing *all* globals and bad level calls
all over blender. Render module is now not called abusive anymore
- API-fied calls to rendering
- Full recode of internal render pipeline. Is now rendering tiles by
default, prepared for much smarter 'bucket' render later.
- Each thread now can render a full part
- Renders were tested with 4 threads, goes fine, apart from some lookup
tables in softshadow and AO still
- Rendering is prepared to do multiple layers and passes
- No single 32 bits trick in render code anymore, all 100% floats now.
Writing images/movies
- moved writing images to blender kernel (bye bye 'schrijfplaatje'!)
- made a new Movie handle system, also in kernel. This will enable much
easier use of movies in Blender
PreviewRender:
- Using new render API, previewrender (in buttons) now uses regular render
code to generate images.
- new datafile 'preview.blend.c' has the preview scenes in it
- previews get rendered in exact displayed size (1 pixel = 1 pixel)
3D Preview render
- new; press Pkey in 3d window, for a panel that continuously renders
(pkey is for games, i know... but we dont do that in orange now!)
- this render works nearly identical to buttons-preview render, so it stops
rendering on any event (mouse, keyboard, etc)
- on moving/scaling the panel, the render code doesn't recreate all geometry
- same for shifting/panning view
- all other operations (now) regenerate the full render database still.
- this is WIP... but big fun, especially for simple scenes!
Compositor
- Using same node system as now in use for shaders, you can composit images
- works pretty straightforward... needs much more options/tools and integration
with rendering still
- is not threaded yet, nor is so smart to only recalculate changes... will be
done soon!
- the "Render Result" node will get all layers/passes as output sockets
- The "Output" node renders to a builtin image, which you can view in the Image
window. (yes, output nodes to render-result, and to files, is on the list!)
The Bad News
- "Unified Render" is removed. It might come back in some stage, but this
system should be built from scratch. I can't really understand this code...
I expect it is not much needed, especially with advanced layer/passes
control
- Panorama render, Field render, Motion blur, is not coded yet... (I had to
recode every single feature in render, so...!)
- Lens Flare is also not back... needs total revision, might become composit
effect though (using zbuffer for visibility)
- Part render is gone! (well, thats obvious, its default now).
- The render window is only restored with limited functionality... I am going
to check first the option to render to a Image window, so Blender can become
a true single-window application. :)
For example, the 'Spare render buffer' (jkey) doesnt work.
- Render with border, now default creates a smaller image
- No zbuffers are written yet... on the todo!
- Scons files and MSVC will need work to get compiling again
OK... thats what I can quickly recall. Now go compiling!
2006-01-23 23:05:47 +01:00
|
|
|
rect = NULL; _newrect = NULL; newrect = NULL;
|
Orange branch: OpenEXR finally in Blender!
Credits go to Gernot Ziegler, who originally coded EXR support, and to
Austin Benesh for bringing it further. Kent Mein provided a lot of code
for integrating float buffers in Blender imbuf and ImBuf API cleanup,
and provided Make and Scons and static linking.
At this moment; the EXR libraries are a *dependency*, so you cannot get
the Orange branch compiled without having OpenEXR installed. Get the
(precompiled or sources) stuff from www.openexr.com. Current default is
that the headers and lib resides in /user/local/
Several changes/additions/fixes were added:
- EXR code only supported 'half' format (16 bits per channel). I've added
float writing, but for reading it I need tomorrow. :)
- Quite some clumsy copying of data happened in EXR code.
- cleaned up the api calls already a bit, preparing for more advanced
support
- Zbuffers were saved 16 bits, now 32 bits
- automatic adding of .exr extensions went wrong
Imbuf:
- added proper imbuf->flags and imbuf->mall support for float buffers, it
was created for *each* imbuf. :)
- found bugs for float buffers in scaling and flipping. Code there will
need more checks still
- imbuf also needs to be verified to behave properly when no 32 bits
rect exists (for saving for example)
TODO:
- support internal float images for textures, backbuf, AO probes, and
display in Image window
Hope this commit won't screwup syncing with bf-blender... :/
2006-01-09 01:40:35 +01:00
|
|
|
rectf = NULL; _newrectf = NULL; newrectf = NULL;
|
2002-10-12 13:37:38 +02:00
|
|
|
|
2012-05-16 11:26:37 +02:00
|
|
|
if (ibuf == NULL) return(NULL);
|
2012-05-19 15:28:19 +02:00
|
|
|
if (ibuf->rect) do_rect = TRUE;
|
|
|
|
if (ibuf->rect_float) do_float = TRUE;
|
|
|
|
if (do_rect == FALSE && do_float == FALSE) return(ibuf);
|
Giant commit!
A full detailed description of this will be done later... is several days
of work. Here's a summary:
Render:
- Full cleanup of render code, removing *all* globals and bad level calls
all over blender. Render module is now not called abusive anymore
- API-fied calls to rendering
- Full recode of internal render pipeline. Is now rendering tiles by
default, prepared for much smarter 'bucket' render later.
- Each thread now can render a full part
- Renders were tested with 4 threads, goes fine, apart from some lookup
tables in softshadow and AO still
- Rendering is prepared to do multiple layers and passes
- No single 32 bits trick in render code anymore, all 100% floats now.
Writing images/movies
- moved writing images to blender kernel (bye bye 'schrijfplaatje'!)
- made a new Movie handle system, also in kernel. This will enable much
easier use of movies in Blender
PreviewRender:
- Using new render API, previewrender (in buttons) now uses regular render
code to generate images.
- new datafile 'preview.blend.c' has the preview scenes in it
- previews get rendered in exact displayed size (1 pixel = 1 pixel)
3D Preview render
- new; press Pkey in 3d window, for a panel that continuously renders
(pkey is for games, i know... but we dont do that in orange now!)
- this render works nearly identical to buttons-preview render, so it stops
rendering on any event (mouse, keyboard, etc)
- on moving/scaling the panel, the render code doesn't recreate all geometry
- same for shifting/panning view
- all other operations (now) regenerate the full render database still.
- this is WIP... but big fun, especially for simple scenes!
Compositor
- Using same node system as now in use for shaders, you can composit images
- works pretty straightforward... needs much more options/tools and integration
with rendering still
- is not threaded yet, nor is so smart to only recalculate changes... will be
done soon!
- the "Render Result" node will get all layers/passes as output sockets
- The "Output" node renders to a builtin image, which you can view in the Image
window. (yes, output nodes to render-result, and to files, is on the list!)
The Bad News
- "Unified Render" is removed. It might come back in some stage, but this
system should be built from scratch. I can't really understand this code...
I expect it is not much needed, especially with advanced layer/passes
control
- Panorama render, Field render, Motion blur, is not coded yet... (I had to
recode every single feature in render, so...!)
- Lens Flare is also not back... needs total revision, might become composit
effect though (using zbuffer for visibility)
- Part render is gone! (well, thats obvious, its default now).
- The render window is only restored with limited functionality... I am going
to check first the option to render to a Image window, so Blender can become
a true single-window application. :)
For example, the 'Spare render buffer' (jkey) doesnt work.
- Render with border, now default creates a smaller image
- No zbuffers are written yet... on the todo!
- Scons files and MSVC will need work to get compiling again
OK... thats what I can quickly recall. Now go compiling!
2006-01-23 23:05:47 +01:00
|
|
|
|
Orange branch: OpenEXR finally in Blender!
Credits go to Gernot Ziegler, who originally coded EXR support, and to
Austin Benesh for bringing it further. Kent Mein provided a lot of code
for integrating float buffers in Blender imbuf and ImBuf API cleanup,
and provided Make and Scons and static linking.
At this moment; the EXR libraries are a *dependency*, so you cannot get
the Orange branch compiled without having OpenEXR installed. Get the
(precompiled or sources) stuff from www.openexr.com. Current default is
that the headers and lib resides in /user/local/
Several changes/additions/fixes were added:
- EXR code only supported 'half' format (16 bits per channel). I've added
float writing, but for reading it I need tomorrow. :)
- Quite some clumsy copying of data happened in EXR code.
- cleaned up the api calls already a bit, preparing for more advanced
support
- Zbuffers were saved 16 bits, now 32 bits
- automatic adding of .exr extensions went wrong
Imbuf:
- added proper imbuf->flags and imbuf->mall support for float buffers, it
was created for *each* imbuf. :)
- found bugs for float buffers in scaling and flipping. Code there will
need more checks still
- imbuf also needs to be verified to behave properly when no 32 bits
rect exists (for saving for example)
TODO:
- support internal float images for textures, backbuf, AO probes, and
display in Image window
Hope this commit won't screwup syncing with bf-blender... :/
2006-01-09 01:40:35 +01:00
|
|
|
if (newx == ibuf->x && newy == ibuf->y) return(ibuf);
|
Giant commit!
A full detailed description of this will be done later... is several days
of work. Here's a summary:
Render:
- Full cleanup of render code, removing *all* globals and bad level calls
all over blender. Render module is now not called abusive anymore
- API-fied calls to rendering
- Full recode of internal render pipeline. Is now rendering tiles by
default, prepared for much smarter 'bucket' render later.
- Each thread now can render a full part
- Renders were tested with 4 threads, goes fine, apart from some lookup
tables in softshadow and AO still
- Rendering is prepared to do multiple layers and passes
- No single 32 bits trick in render code anymore, all 100% floats now.
Writing images/movies
- moved writing images to blender kernel (bye bye 'schrijfplaatje'!)
- made a new Movie handle system, also in kernel. This will enable much
easier use of movies in Blender
PreviewRender:
- Using new render API, previewrender (in buttons) now uses regular render
code to generate images.
- new datafile 'preview.blend.c' has the preview scenes in it
- previews get rendered in exact displayed size (1 pixel = 1 pixel)
3D Preview render
- new; press Pkey in 3d window, for a panel that continuously renders
(pkey is for games, i know... but we dont do that in orange now!)
- this render works nearly identical to buttons-preview render, so it stops
rendering on any event (mouse, keyboard, etc)
- on moving/scaling the panel, the render code doesn't recreate all geometry
- same for shifting/panning view
- all other operations (now) regenerate the full render database still.
- this is WIP... but big fun, especially for simple scenes!
Compositor
- Using same node system as now in use for shaders, you can composit images
- works pretty straightforward... needs much more options/tools and integration
with rendering still
- is not threaded yet, nor is so smart to only recalculate changes... will be
done soon!
- the "Render Result" node will get all layers/passes as output sockets
- The "Output" node renders to a builtin image, which you can view in the Image
window. (yes, output nodes to render-result, and to files, is on the list!)
The Bad News
- "Unified Render" is removed. It might come back in some stage, but this
system should be built from scratch. I can't really understand this code...
I expect it is not much needed, especially with advanced layer/passes
control
- Panorama render, Field render, Motion blur, is not coded yet... (I had to
recode every single feature in render, so...!)
- Lens Flare is also not back... needs total revision, might become composit
effect though (using zbuffer for visibility)
- Part render is gone! (well, thats obvious, its default now).
- The render window is only restored with limited functionality... I am going
to check first the option to render to a Image window, so Blender can become
a true single-window application. :)
For example, the 'Spare render buffer' (jkey) doesnt work.
- Render with border, now default creates a smaller image
- No zbuffers are written yet... on the todo!
- Scons files and MSVC will need work to get compiling again
OK... thats what I can quickly recall. Now go compiling!
2006-01-23 23:05:47 +01:00
|
|
|
|
2012-03-24 07:38:07 +01:00
|
|
|
if (do_rect) {
|
Giant commit!
A full detailed description of this will be done later... is several days
of work. Here's a summary:
Render:
- Full cleanup of render code, removing *all* globals and bad level calls
all over blender. Render module is now not called abusive anymore
- API-fied calls to rendering
- Full recode of internal render pipeline. Is now rendering tiles by
default, prepared for much smarter 'bucket' render later.
- Each thread now can render a full part
- Renders were tested with 4 threads, goes fine, apart from some lookup
tables in softshadow and AO still
- Rendering is prepared to do multiple layers and passes
- No single 32 bits trick in render code anymore, all 100% floats now.
Writing images/movies
- moved writing images to blender kernel (bye bye 'schrijfplaatje'!)
- made a new Movie handle system, also in kernel. This will enable much
easier use of movies in Blender
PreviewRender:
- Using new render API, previewrender (in buttons) now uses regular render
code to generate images.
- new datafile 'preview.blend.c' has the preview scenes in it
- previews get rendered in exact displayed size (1 pixel = 1 pixel)
3D Preview render
- new; press Pkey in 3d window, for a panel that continuously renders
(pkey is for games, i know... but we dont do that in orange now!)
- this render works nearly identical to buttons-preview render, so it stops
rendering on any event (mouse, keyboard, etc)
- on moving/scaling the panel, the render code doesn't recreate all geometry
- same for shifting/panning view
- all other operations (now) regenerate the full render database still.
- this is WIP... but big fun, especially for simple scenes!
Compositor
- Using same node system as now in use for shaders, you can composit images
- works pretty straightforward... needs much more options/tools and integration
with rendering still
- is not threaded yet, nor is so smart to only recalculate changes... will be
done soon!
- the "Render Result" node will get all layers/passes as output sockets
- The "Output" node renders to a builtin image, which you can view in the Image
window. (yes, output nodes to render-result, and to files, is on the list!)
The Bad News
- "Unified Render" is removed. It might come back in some stage, but this
system should be built from scratch. I can't really understand this code...
I expect it is not much needed, especially with advanced layer/passes
control
- Panorama render, Field render, Motion blur, is not coded yet... (I had to
recode every single feature in render, so...!)
- Lens Flare is also not back... needs total revision, might become composit
effect though (using zbuffer for visibility)
- Part render is gone! (well, thats obvious, its default now).
- The render window is only restored with limited functionality... I am going
to check first the option to render to a Image window, so Blender can become
a true single-window application. :)
For example, the 'Spare render buffer' (jkey) doesnt work.
- Render with border, now default creates a smaller image
- No zbuffers are written yet... on the todo!
- Scons files and MSVC will need work to get compiling again
OK... thats what I can quickly recall. Now go compiling!
2006-01-23 23:05:47 +01:00
|
|
|
_newrect = MEM_mallocN(newx * newy * sizeof(int), "scalefastimbuf");
|
2012-05-16 11:26:37 +02:00
|
|
|
if (_newrect == NULL) return(ibuf);
|
Giant commit!
A full detailed description of this will be done later... is several days
of work. Here's a summary:
Render:
- Full cleanup of render code, removing *all* globals and bad level calls
all over blender. Render module is now not called abusive anymore
- API-fied calls to rendering
- Full recode of internal render pipeline. Is now rendering tiles by
default, prepared for much smarter 'bucket' render later.
- Each thread now can render a full part
- Renders were tested with 4 threads, goes fine, apart from some lookup
tables in softshadow and AO still
- Rendering is prepared to do multiple layers and passes
- No single 32 bits trick in render code anymore, all 100% floats now.
Writing images/movies
- moved writing images to blender kernel (bye bye 'schrijfplaatje'!)
- made a new Movie handle system, also in kernel. This will enable much
easier use of movies in Blender
PreviewRender:
- Using new render API, previewrender (in buttons) now uses regular render
code to generate images.
- new datafile 'preview.blend.c' has the preview scenes in it
- previews get rendered in exact displayed size (1 pixel = 1 pixel)
3D Preview render
- new; press Pkey in 3d window, for a panel that continuously renders
(pkey is for games, i know... but we dont do that in orange now!)
- this render works nearly identical to buttons-preview render, so it stops
rendering on any event (mouse, keyboard, etc)
- on moving/scaling the panel, the render code doesn't recreate all geometry
- same for shifting/panning view
- all other operations (now) regenerate the full render database still.
- this is WIP... but big fun, especially for simple scenes!
Compositor
- Using same node system as now in use for shaders, you can composit images
- works pretty straightforward... needs much more options/tools and integration
with rendering still
- is not threaded yet, nor is so smart to only recalculate changes... will be
done soon!
- the "Render Result" node will get all layers/passes as output sockets
- The "Output" node renders to a builtin image, which you can view in the Image
window. (yes, output nodes to render-result, and to files, is on the list!)
The Bad News
- "Unified Render" is removed. It might come back in some stage, but this
system should be built from scratch. I can't really understand this code...
I expect it is not much needed, especially with advanced layer/passes
control
- Panorama render, Field render, Motion blur, is not coded yet... (I had to
recode every single feature in render, so...!)
- Lens Flare is also not back... needs total revision, might become composit
effect though (using zbuffer for visibility)
- Part render is gone! (well, thats obvious, its default now).
- The render window is only restored with limited functionality... I am going
to check first the option to render to a Image window, so Blender can become
a true single-window application. :)
For example, the 'Spare render buffer' (jkey) doesnt work.
- Render with border, now default creates a smaller image
- No zbuffers are written yet... on the todo!
- Scons files and MSVC will need work to get compiling again
OK... thats what I can quickly recall. Now go compiling!
2006-01-23 23:05:47 +01:00
|
|
|
newrect = _newrect;
|
|
|
|
}
|
|
|
|
|
Orange branch: OpenEXR finally in Blender!
Credits go to Gernot Ziegler, who originally coded EXR support, and to
Austin Benesh for bringing it further. Kent Mein provided a lot of code
for integrating float buffers in Blender imbuf and ImBuf API cleanup,
and provided Make and Scons and static linking.
At this moment; the EXR libraries are a *dependency*, so you cannot get
the Orange branch compiled without having OpenEXR installed. Get the
(precompiled or sources) stuff from www.openexr.com. Current default is
that the headers and lib resides in /user/local/
Several changes/additions/fixes were added:
- EXR code only supported 'half' format (16 bits per channel). I've added
float writing, but for reading it I need tomorrow. :)
- Quite some clumsy copying of data happened in EXR code.
- cleaned up the api calls already a bit, preparing for more advanced
support
- Zbuffers were saved 16 bits, now 32 bits
- automatic adding of .exr extensions went wrong
Imbuf:
- added proper imbuf->flags and imbuf->mall support for float buffers, it
was created for *each* imbuf. :)
- found bugs for float buffers in scaling and flipping. Code there will
need more checks still
- imbuf also needs to be verified to behave properly when no 32 bits
rect exists (for saving for example)
TODO:
- support internal float images for textures, backbuf, AO probes, and
display in Image window
Hope this commit won't screwup syncing with bf-blender... :/
2006-01-09 01:40:35 +01:00
|
|
|
if (do_float) {
|
|
|
|
_newrectf = MEM_mallocN(newx * newy * sizeof(float) * 4, "scalefastimbuf f");
|
2012-05-16 11:26:37 +02:00
|
|
|
if (_newrectf == NULL) {
|
2006-09-14 14:21:18 +02:00
|
|
|
if (_newrect) MEM_freeN(_newrect);
|
|
|
|
return(ibuf);
|
|
|
|
}
|
Orange branch: OpenEXR finally in Blender!
Credits go to Gernot Ziegler, who originally coded EXR support, and to
Austin Benesh for bringing it further. Kent Mein provided a lot of code
for integrating float buffers in Blender imbuf and ImBuf API cleanup,
and provided Make and Scons and static linking.
At this moment; the EXR libraries are a *dependency*, so you cannot get
the Orange branch compiled without having OpenEXR installed. Get the
(precompiled or sources) stuff from www.openexr.com. Current default is
that the headers and lib resides in /user/local/
Several changes/additions/fixes were added:
- EXR code only supported 'half' format (16 bits per channel). I've added
float writing, but for reading it I need tomorrow. :)
- Quite some clumsy copying of data happened in EXR code.
- cleaned up the api calls already a bit, preparing for more advanced
support
- Zbuffers were saved 16 bits, now 32 bits
- automatic adding of .exr extensions went wrong
Imbuf:
- added proper imbuf->flags and imbuf->mall support for float buffers, it
was created for *each* imbuf. :)
- found bugs for float buffers in scaling and flipping. Code there will
need more checks still
- imbuf also needs to be verified to behave properly when no 32 bits
rect exists (for saving for example)
TODO:
- support internal float images for textures, backbuf, AO probes, and
display in Image window
Hope this commit won't screwup syncing with bf-blender... :/
2006-01-09 01:40:35 +01:00
|
|
|
newrectf = _newrectf;
|
|
|
|
}
|
|
|
|
|
2002-10-12 13:37:38 +02:00
|
|
|
stepx = (65536.0 * (ibuf->x - 1.0) / (newx - 1.0)) + 0.5;
|
|
|
|
stepy = (65536.0 * (ibuf->y - 1.0) / (newy - 1.0)) + 0.5;
|
|
|
|
ofsy = 32768;
|
|
|
|
|
2012-02-27 11:35:39 +01:00
|
|
|
for (y = newy; y > 0; y--) {
|
2012-03-24 07:38:07 +01:00
|
|
|
if (do_rect) {
|
Giant commit!
A full detailed description of this will be done later... is several days
of work. Here's a summary:
Render:
- Full cleanup of render code, removing *all* globals and bad level calls
all over blender. Render module is now not called abusive anymore
- API-fied calls to rendering
- Full recode of internal render pipeline. Is now rendering tiles by
default, prepared for much smarter 'bucket' render later.
- Each thread now can render a full part
- Renders were tested with 4 threads, goes fine, apart from some lookup
tables in softshadow and AO still
- Rendering is prepared to do multiple layers and passes
- No single 32 bits trick in render code anymore, all 100% floats now.
Writing images/movies
- moved writing images to blender kernel (bye bye 'schrijfplaatje'!)
- made a new Movie handle system, also in kernel. This will enable much
easier use of movies in Blender
PreviewRender:
- Using new render API, previewrender (in buttons) now uses regular render
code to generate images.
- new datafile 'preview.blend.c' has the preview scenes in it
- previews get rendered in exact displayed size (1 pixel = 1 pixel)
3D Preview render
- new; press Pkey in 3d window, for a panel that continuously renders
(pkey is for games, i know... but we dont do that in orange now!)
- this render works nearly identical to buttons-preview render, so it stops
rendering on any event (mouse, keyboard, etc)
- on moving/scaling the panel, the render code doesn't recreate all geometry
- same for shifting/panning view
- all other operations (now) regenerate the full render database still.
- this is WIP... but big fun, especially for simple scenes!
Compositor
- Using same node system as now in use for shaders, you can composit images
- works pretty straightforward... needs much more options/tools and integration
with rendering still
- is not threaded yet, nor is so smart to only recalculate changes... will be
done soon!
- the "Render Result" node will get all layers/passes as output sockets
- The "Output" node renders to a builtin image, which you can view in the Image
window. (yes, output nodes to render-result, and to files, is on the list!)
The Bad News
- "Unified Render" is removed. It might come back in some stage, but this
system should be built from scratch. I can't really understand this code...
I expect it is not much needed, especially with advanced layer/passes
control
- Panorama render, Field render, Motion blur, is not coded yet... (I had to
recode every single feature in render, so...!)
- Lens Flare is also not back... needs total revision, might become composit
effect though (using zbuffer for visibility)
- Part render is gone! (well, thats obvious, its default now).
- The render window is only restored with limited functionality... I am going
to check first the option to render to a Image window, so Blender can become
a true single-window application. :)
For example, the 'Spare render buffer' (jkey) doesnt work.
- Render with border, now default creates a smaller image
- No zbuffers are written yet... on the todo!
- Scons files and MSVC will need work to get compiling again
OK... thats what I can quickly recall. Now go compiling!
2006-01-23 23:05:47 +01:00
|
|
|
rect = ibuf->rect;
|
|
|
|
rect += (ofsy >> 16) * ibuf->x;
|
|
|
|
}
|
Orange branch: OpenEXR finally in Blender!
Credits go to Gernot Ziegler, who originally coded EXR support, and to
Austin Benesh for bringing it further. Kent Mein provided a lot of code
for integrating float buffers in Blender imbuf and ImBuf API cleanup,
and provided Make and Scons and static linking.
At this moment; the EXR libraries are a *dependency*, so you cannot get
the Orange branch compiled without having OpenEXR installed. Get the
(precompiled or sources) stuff from www.openexr.com. Current default is
that the headers and lib resides in /user/local/
Several changes/additions/fixes were added:
- EXR code only supported 'half' format (16 bits per channel). I've added
float writing, but for reading it I need tomorrow. :)
- Quite some clumsy copying of data happened in EXR code.
- cleaned up the api calls already a bit, preparing for more advanced
support
- Zbuffers were saved 16 bits, now 32 bits
- automatic adding of .exr extensions went wrong
Imbuf:
- added proper imbuf->flags and imbuf->mall support for float buffers, it
was created for *each* imbuf. :)
- found bugs for float buffers in scaling and flipping. Code there will
need more checks still
- imbuf also needs to be verified to behave properly when no 32 bits
rect exists (for saving for example)
TODO:
- support internal float images for textures, backbuf, AO probes, and
display in Image window
Hope this commit won't screwup syncing with bf-blender... :/
2006-01-09 01:40:35 +01:00
|
|
|
if (do_float) {
|
Giant commit!
A full detailed description of this will be done later... is several days
of work. Here's a summary:
Render:
- Full cleanup of render code, removing *all* globals and bad level calls
all over blender. Render module is now not called abusive anymore
- API-fied calls to rendering
- Full recode of internal render pipeline. Is now rendering tiles by
default, prepared for much smarter 'bucket' render later.
- Each thread now can render a full part
- Renders were tested with 4 threads, goes fine, apart from some lookup
tables in softshadow and AO still
- Rendering is prepared to do multiple layers and passes
- No single 32 bits trick in render code anymore, all 100% floats now.
Writing images/movies
- moved writing images to blender kernel (bye bye 'schrijfplaatje'!)
- made a new Movie handle system, also in kernel. This will enable much
easier use of movies in Blender
PreviewRender:
- Using new render API, previewrender (in buttons) now uses regular render
code to generate images.
- new datafile 'preview.blend.c' has the preview scenes in it
- previews get rendered in exact displayed size (1 pixel = 1 pixel)
3D Preview render
- new; press Pkey in 3d window, for a panel that continuously renders
(pkey is for games, i know... but we dont do that in orange now!)
- this render works nearly identical to buttons-preview render, so it stops
rendering on any event (mouse, keyboard, etc)
- on moving/scaling the panel, the render code doesn't recreate all geometry
- same for shifting/panning view
- all other operations (now) regenerate the full render database still.
- this is WIP... but big fun, especially for simple scenes!
Compositor
- Using same node system as now in use for shaders, you can composit images
- works pretty straightforward... needs much more options/tools and integration
with rendering still
- is not threaded yet, nor is so smart to only recalculate changes... will be
done soon!
- the "Render Result" node will get all layers/passes as output sockets
- The "Output" node renders to a builtin image, which you can view in the Image
window. (yes, output nodes to render-result, and to files, is on the list!)
The Bad News
- "Unified Render" is removed. It might come back in some stage, but this
system should be built from scratch. I can't really understand this code...
I expect it is not much needed, especially with advanced layer/passes
control
- Panorama render, Field render, Motion blur, is not coded yet... (I had to
recode every single feature in render, so...!)
- Lens Flare is also not back... needs total revision, might become composit
effect though (using zbuffer for visibility)
- Part render is gone! (well, thats obvious, its default now).
- The render window is only restored with limited functionality... I am going
to check first the option to render to a Image window, so Blender can become
a true single-window application. :)
For example, the 'Spare render buffer' (jkey) doesnt work.
- Render with border, now default creates a smaller image
- No zbuffers are written yet... on the todo!
- Scons files and MSVC will need work to get compiling again
OK... thats what I can quickly recall. Now go compiling!
2006-01-23 23:05:47 +01:00
|
|
|
rectf = (struct imbufRGBA *)ibuf->rect_float;
|
Orange branch: OpenEXR finally in Blender!
Credits go to Gernot Ziegler, who originally coded EXR support, and to
Austin Benesh for bringing it further. Kent Mein provided a lot of code
for integrating float buffers in Blender imbuf and ImBuf API cleanup,
and provided Make and Scons and static linking.
At this moment; the EXR libraries are a *dependency*, so you cannot get
the Orange branch compiled without having OpenEXR installed. Get the
(precompiled or sources) stuff from www.openexr.com. Current default is
that the headers and lib resides in /user/local/
Several changes/additions/fixes were added:
- EXR code only supported 'half' format (16 bits per channel). I've added
float writing, but for reading it I need tomorrow. :)
- Quite some clumsy copying of data happened in EXR code.
- cleaned up the api calls already a bit, preparing for more advanced
support
- Zbuffers were saved 16 bits, now 32 bits
- automatic adding of .exr extensions went wrong
Imbuf:
- added proper imbuf->flags and imbuf->mall support for float buffers, it
was created for *each* imbuf. :)
- found bugs for float buffers in scaling and flipping. Code there will
need more checks still
- imbuf also needs to be verified to behave properly when no 32 bits
rect exists (for saving for example)
TODO:
- support internal float images for textures, backbuf, AO probes, and
display in Image window
Hope this commit won't screwup syncing with bf-blender... :/
2006-01-09 01:40:35 +01:00
|
|
|
rectf += (ofsy >> 16) * ibuf->x;
|
|
|
|
}
|
2002-10-12 13:37:38 +02:00
|
|
|
ofsy += stepy;
|
|
|
|
ofsx = 32768;
|
Orange branch: OpenEXR finally in Blender!
Credits go to Gernot Ziegler, who originally coded EXR support, and to
Austin Benesh for bringing it further. Kent Mein provided a lot of code
for integrating float buffers in Blender imbuf and ImBuf API cleanup,
and provided Make and Scons and static linking.
At this moment; the EXR libraries are a *dependency*, so you cannot get
the Orange branch compiled without having OpenEXR installed. Get the
(precompiled or sources) stuff from www.openexr.com. Current default is
that the headers and lib resides in /user/local/
Several changes/additions/fixes were added:
- EXR code only supported 'half' format (16 bits per channel). I've added
float writing, but for reading it I need tomorrow. :)
- Quite some clumsy copying of data happened in EXR code.
- cleaned up the api calls already a bit, preparing for more advanced
support
- Zbuffers were saved 16 bits, now 32 bits
- automatic adding of .exr extensions went wrong
Imbuf:
- added proper imbuf->flags and imbuf->mall support for float buffers, it
was created for *each* imbuf. :)
- found bugs for float buffers in scaling and flipping. Code there will
need more checks still
- imbuf also needs to be verified to behave properly when no 32 bits
rect exists (for saving for example)
TODO:
- support internal float images for textures, backbuf, AO probes, and
display in Image window
Hope this commit won't screwup syncing with bf-blender... :/
2006-01-09 01:40:35 +01:00
|
|
|
|
2006-03-07 21:01:12 +01:00
|
|
|
if (do_rect) {
|
2012-05-16 11:26:37 +02:00
|
|
|
for (x = newx; x > 0; x--) {
|
2006-03-07 21:01:12 +01:00
|
|
|
*newrect++ = rect[ofsx >> 16];
|
|
|
|
ofsx += stepx;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (do_float) {
|
2006-03-09 12:25:20 +01:00
|
|
|
ofsx = 32768;
|
2012-05-16 11:26:37 +02:00
|
|
|
for (x = newx; x > 0; x--) {
|
2006-03-07 21:01:12 +01:00
|
|
|
*newrectf++ = rectf[ofsx >> 16];
|
|
|
|
ofsx += stepx;
|
|
|
|
}
|
2002-10-12 13:37:38 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
Giant commit!
A full detailed description of this will be done later... is several days
of work. Here's a summary:
Render:
- Full cleanup of render code, removing *all* globals and bad level calls
all over blender. Render module is now not called abusive anymore
- API-fied calls to rendering
- Full recode of internal render pipeline. Is now rendering tiles by
default, prepared for much smarter 'bucket' render later.
- Each thread now can render a full part
- Renders were tested with 4 threads, goes fine, apart from some lookup
tables in softshadow and AO still
- Rendering is prepared to do multiple layers and passes
- No single 32 bits trick in render code anymore, all 100% floats now.
Writing images/movies
- moved writing images to blender kernel (bye bye 'schrijfplaatje'!)
- made a new Movie handle system, also in kernel. This will enable much
easier use of movies in Blender
PreviewRender:
- Using new render API, previewrender (in buttons) now uses regular render
code to generate images.
- new datafile 'preview.blend.c' has the preview scenes in it
- previews get rendered in exact displayed size (1 pixel = 1 pixel)
3D Preview render
- new; press Pkey in 3d window, for a panel that continuously renders
(pkey is for games, i know... but we dont do that in orange now!)
- this render works nearly identical to buttons-preview render, so it stops
rendering on any event (mouse, keyboard, etc)
- on moving/scaling the panel, the render code doesn't recreate all geometry
- same for shifting/panning view
- all other operations (now) regenerate the full render database still.
- this is WIP... but big fun, especially for simple scenes!
Compositor
- Using same node system as now in use for shaders, you can composit images
- works pretty straightforward... needs much more options/tools and integration
with rendering still
- is not threaded yet, nor is so smart to only recalculate changes... will be
done soon!
- the "Render Result" node will get all layers/passes as output sockets
- The "Output" node renders to a builtin image, which you can view in the Image
window. (yes, output nodes to render-result, and to files, is on the list!)
The Bad News
- "Unified Render" is removed. It might come back in some stage, but this
system should be built from scratch. I can't really understand this code...
I expect it is not much needed, especially with advanced layer/passes
control
- Panorama render, Field render, Motion blur, is not coded yet... (I had to
recode every single feature in render, so...!)
- Lens Flare is also not back... needs total revision, might become composit
effect though (using zbuffer for visibility)
- Part render is gone! (well, thats obvious, its default now).
- The render window is only restored with limited functionality... I am going
to check first the option to render to a Image window, so Blender can become
a true single-window application. :)
For example, the 'Spare render buffer' (jkey) doesnt work.
- Render with border, now default creates a smaller image
- No zbuffers are written yet... on the todo!
- Scons files and MSVC will need work to get compiling again
OK... thats what I can quickly recall. Now go compiling!
2006-01-23 23:05:47 +01:00
|
|
|
if (do_rect) {
|
|
|
|
imb_freerectImBuf(ibuf);
|
|
|
|
ibuf->mall |= IB_rect;
|
|
|
|
ibuf->rect = _newrect;
|
|
|
|
}
|
2002-10-12 13:37:38 +02:00
|
|
|
|
Orange branch: OpenEXR finally in Blender!
Credits go to Gernot Ziegler, who originally coded EXR support, and to
Austin Benesh for bringing it further. Kent Mein provided a lot of code
for integrating float buffers in Blender imbuf and ImBuf API cleanup,
and provided Make and Scons and static linking.
At this moment; the EXR libraries are a *dependency*, so you cannot get
the Orange branch compiled without having OpenEXR installed. Get the
(precompiled or sources) stuff from www.openexr.com. Current default is
that the headers and lib resides in /user/local/
Several changes/additions/fixes were added:
- EXR code only supported 'half' format (16 bits per channel). I've added
float writing, but for reading it I need tomorrow. :)
- Quite some clumsy copying of data happened in EXR code.
- cleaned up the api calls already a bit, preparing for more advanced
support
- Zbuffers were saved 16 bits, now 32 bits
- automatic adding of .exr extensions went wrong
Imbuf:
- added proper imbuf->flags and imbuf->mall support for float buffers, it
was created for *each* imbuf. :)
- found bugs for float buffers in scaling and flipping. Code there will
need more checks still
- imbuf also needs to be verified to behave properly when no 32 bits
rect exists (for saving for example)
TODO:
- support internal float images for textures, backbuf, AO probes, and
display in Image window
Hope this commit won't screwup syncing with bf-blender... :/
2006-01-09 01:40:35 +01:00
|
|
|
if (do_float) {
|
|
|
|
imb_freerectfloatImBuf(ibuf);
|
|
|
|
ibuf->mall |= IB_rectfloat;
|
Giant commit!
A full detailed description of this will be done later... is several days
of work. Here's a summary:
Render:
- Full cleanup of render code, removing *all* globals and bad level calls
all over blender. Render module is now not called abusive anymore
- API-fied calls to rendering
- Full recode of internal render pipeline. Is now rendering tiles by
default, prepared for much smarter 'bucket' render later.
- Each thread now can render a full part
- Renders were tested with 4 threads, goes fine, apart from some lookup
tables in softshadow and AO still
- Rendering is prepared to do multiple layers and passes
- No single 32 bits trick in render code anymore, all 100% floats now.
Writing images/movies
- moved writing images to blender kernel (bye bye 'schrijfplaatje'!)
- made a new Movie handle system, also in kernel. This will enable much
easier use of movies in Blender
PreviewRender:
- Using new render API, previewrender (in buttons) now uses regular render
code to generate images.
- new datafile 'preview.blend.c' has the preview scenes in it
- previews get rendered in exact displayed size (1 pixel = 1 pixel)
3D Preview render
- new; press Pkey in 3d window, for a panel that continuously renders
(pkey is for games, i know... but we dont do that in orange now!)
- this render works nearly identical to buttons-preview render, so it stops
rendering on any event (mouse, keyboard, etc)
- on moving/scaling the panel, the render code doesn't recreate all geometry
- same for shifting/panning view
- all other operations (now) regenerate the full render database still.
- this is WIP... but big fun, especially for simple scenes!
Compositor
- Using same node system as now in use for shaders, you can composit images
- works pretty straightforward... needs much more options/tools and integration
with rendering still
- is not threaded yet, nor is so smart to only recalculate changes... will be
done soon!
- the "Render Result" node will get all layers/passes as output sockets
- The "Output" node renders to a builtin image, which you can view in the Image
window. (yes, output nodes to render-result, and to files, is on the list!)
The Bad News
- "Unified Render" is removed. It might come back in some stage, but this
system should be built from scratch. I can't really understand this code...
I expect it is not much needed, especially with advanced layer/passes
control
- Panorama render, Field render, Motion blur, is not coded yet... (I had to
recode every single feature in render, so...!)
- Lens Flare is also not back... needs total revision, might become composit
effect though (using zbuffer for visibility)
- Part render is gone! (well, thats obvious, its default now).
- The render window is only restored with limited functionality... I am going
to check first the option to render to a Image window, so Blender can become
a true single-window application. :)
For example, the 'Spare render buffer' (jkey) doesnt work.
- Render with border, now default creates a smaller image
- No zbuffers are written yet... on the todo!
- Scons files and MSVC will need work to get compiling again
OK... thats what I can quickly recall. Now go compiling!
2006-01-23 23:05:47 +01:00
|
|
|
ibuf->rect_float = (float *)_newrectf;
|
Orange branch: OpenEXR finally in Blender!
Credits go to Gernot Ziegler, who originally coded EXR support, and to
Austin Benesh for bringing it further. Kent Mein provided a lot of code
for integrating float buffers in Blender imbuf and ImBuf API cleanup,
and provided Make and Scons and static linking.
At this moment; the EXR libraries are a *dependency*, so you cannot get
the Orange branch compiled without having OpenEXR installed. Get the
(precompiled or sources) stuff from www.openexr.com. Current default is
that the headers and lib resides in /user/local/
Several changes/additions/fixes were added:
- EXR code only supported 'half' format (16 bits per channel). I've added
float writing, but for reading it I need tomorrow. :)
- Quite some clumsy copying of data happened in EXR code.
- cleaned up the api calls already a bit, preparing for more advanced
support
- Zbuffers were saved 16 bits, now 32 bits
- automatic adding of .exr extensions went wrong
Imbuf:
- added proper imbuf->flags and imbuf->mall support for float buffers, it
was created for *each* imbuf. :)
- found bugs for float buffers in scaling and flipping. Code there will
need more checks still
- imbuf also needs to be verified to behave properly when no 32 bits
rect exists (for saving for example)
TODO:
- support internal float images for textures, backbuf, AO probes, and
display in Image window
Hope this commit won't screwup syncing with bf-blender... :/
2006-01-09 01:40:35 +01:00
|
|
|
}
|
|
|
|
|
2002-10-12 13:37:38 +02:00
|
|
|
scalefast_Z_ImBuf(ibuf, newx, newy);
|
|
|
|
|
|
|
|
ibuf->x = newx;
|
|
|
|
ibuf->y = newy;
|
|
|
|
return(ibuf);
|
|
|
|
}
|
|
|
|
|