Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTon Roosendaal <ton@blender.org>2006-01-09 03:40:35 +0300
committerTon Roosendaal <ton@blender.org>2006-01-09 03:40:35 +0300
commit014aa7261e29810b35b3d65c759f9d255bf8a277 (patch)
tree360325f8db9431bdd187c0f0e7f7c40dcaa3a073 /source/blender/imbuf/intern/divers.c
parent104ab9b103ab30ca87ccb9e739a58863fc29d3bf (diff)
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... :/
Diffstat (limited to 'source/blender/imbuf/intern/divers.c')
-rw-r--r--source/blender/imbuf/intern/divers.c31
1 files changed, 17 insertions, 14 deletions
diff --git a/source/blender/imbuf/intern/divers.c b/source/blender/imbuf/intern/divers.c
index 8c579156691..a56f16f71db 100644
--- a/source/blender/imbuf/intern/divers.c
+++ b/source/blender/imbuf/intern/divers.c
@@ -95,12 +95,12 @@ void IMB_de_interlace(struct ImBuf *ibuf)
tbuf2 = IMB_allocImBuf(ibuf->x, ibuf->y / 2, 32, IB_rect, 0);
ibuf->x *= 2;
- IMB_rectop(tbuf1, ibuf, 0, 0, 0, 0, 32767, 32767, IMB_rectcpy, 0);
- IMB_rectop(tbuf2, ibuf, 0, 0, tbuf2->x, 0, 32767, 32767, IMB_rectcpy, 0);
+ IMB_rectcpy(tbuf1, ibuf, 0, 0, 0, 0, ibuf->x, ibuf->y);
+ IMB_rectcpy(tbuf2, ibuf, 0, 0, tbuf2->x, 0, ibuf->x, ibuf->y);
ibuf->x /= 2;
- IMB_rectop(ibuf, tbuf1, 0, 0, 0, 0, 32767, 32767, IMB_rectcpy, 0);
- IMB_rectop(ibuf, tbuf2, 0, tbuf2->y, 0, 0, 32767, 32767, IMB_rectcpy, 0);
+ IMB_rectcpy(ibuf, tbuf1, 0, 0, 0, 0, tbuf1->x, tbuf1->y);
+ IMB_rectcpy(ibuf, tbuf2, 0, tbuf2->y, 0, 0, tbuf2->x, tbuf2->y);
IMB_freeImBuf(tbuf1);
IMB_freeImBuf(tbuf2);
@@ -122,16 +122,12 @@ void IMB_interlace(struct ImBuf *ibuf)
tbuf1 = IMB_allocImBuf(ibuf->x, ibuf->y / 2, 32, IB_rect, 0);
tbuf2 = IMB_allocImBuf(ibuf->x, ibuf->y / 2, 32, IB_rect, 0);
- IMB_rectop(tbuf1, ibuf, 0, 0, 0, 0, 32767, 32767, IMB_rectcpy,
- 0);
- IMB_rectop(tbuf2, ibuf, 0, 0, 0, tbuf2->y, 32767, 32767,
- IMB_rectcpy,0);
+ IMB_rectcpy(tbuf1, ibuf, 0, 0, 0, 0, ibuf->x, ibuf->y);
+ IMB_rectcpy(tbuf2, ibuf, 0, 0, 0, tbuf2->y, ibuf->x, ibuf->y);
ibuf->x *= 2;
- IMB_rectop(ibuf, tbuf1, 0, 0, 0, 0, 32767, 32767, IMB_rectcpy,
- 0);
- IMB_rectop(ibuf, tbuf2, tbuf2->x, 0, 0, 0, 32767, 32767,
- IMB_rectcpy,0);
+ IMB_rectcpy(ibuf, tbuf1, 0, 0, 0, 0, tbuf1->x, tbuf1->y);
+ IMB_rectcpy(ibuf, tbuf2, tbuf2->x, 0, 0, 0, tbuf2->x, tbuf2->y);
ibuf->x /= 2;
IMB_freeImBuf(tbuf1);
@@ -143,11 +139,13 @@ void IMB_interlace(struct ImBuf *ibuf)
void IMB_gamwarp(struct ImBuf *ibuf, double gamma)
{
uchar gam[256];
- int i;
- uchar *rect;
+ int i, do_float=0;
+ uchar *rect = (uchar *) ibuf->rect;
+ float *rectf = ibuf->rect_float;
if (ibuf == 0) return;
if (ibuf->rect == 0) return;
+ if (ibuf->rect != NULL) do_float = 1;
if (gamma == 1.0) return;
gamma = 1.0 / gamma;
@@ -159,5 +157,10 @@ void IMB_gamwarp(struct ImBuf *ibuf, double gamma)
rect[0] = gam[rect[0]];
rect[1] = gam[rect[1]];
rect[2] = gam[rect[2]];
+ if (do_float) {
+ rectf[0] = pow(rectf[0] / 255.0, gamma);
+ rectf[1] = pow(rectf[1] / 255.0, gamma);
+ rectf[2] = pow(rectf[2] / 255.0, gamma);
+ }
}
}