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:
authorKent Mein <mein@cs.umn.edu>2003-04-30 22:38:50 +0400
committerKent Mein <mein@cs.umn.edu>2003-04-30 22:38:50 +0400
commitc31b578d7709b51028218805d3857986a36b4eb9 (patch)
tree19731231b53a98c3031da7aecd2968dd95bcb0a1 /source/blender/imbuf/intern/divers.c
parentabd2a37f8a07f9dfe440ff6760ccbf2bd43d38bc (diff)
Added IMB_gamwarp and IMB_interlace (and the interlace and gamwarp wrappers
for the plugins) Kent
Diffstat (limited to 'source/blender/imbuf/intern/divers.c')
-rw-r--r--source/blender/imbuf/intern/divers.c60
1 files changed, 54 insertions, 6 deletions
diff --git a/source/blender/imbuf/intern/divers.c b/source/blender/imbuf/intern/divers.c
index 3b2ae27577c..70958b08c21 100644
--- a/source/blender/imbuf/intern/divers.c
+++ b/source/blender/imbuf/intern/divers.c
@@ -88,7 +88,6 @@ void imb_checkncols(struct ImBuf *ibuf)
void IMB_de_interlace(struct ImBuf *ibuf)
{
struct ImBuf * tbuf1, * tbuf2;
-/* extern rectcpy(); */
if (ibuf == 0) return;
if (ibuf->flags & IB_fields) return;
@@ -100,15 +99,10 @@ void IMB_de_interlace(struct ImBuf *ibuf)
tbuf2 = IMB_allocImBuf(ibuf->x, ibuf->y / 2, 32, IB_rect, 0);
ibuf->x *= 2;
-/* Functions need more args :( */
-/* rectop(tbuf1, ibuf, 0, 0, 0, 0, 32767, 32767, rectcpy); */
-/* rectop(tbuf2, ibuf, 0, 0, tbuf2->x, 0, 32767, 32767, rectcpy); */
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);
ibuf->x /= 2;
-/* rectop(ibuf, tbuf1, 0, 0, 0, 0, 32767, 32767, rectcpy); */
-/* rectop(ibuf, tbuf2, 0, tbuf2->y, 0, 0, 32767, 32767, rectcpy); */
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);
@@ -118,3 +112,57 @@ void IMB_de_interlace(struct ImBuf *ibuf)
ibuf->y /= 2;
}
+void IMB_interlace(struct ImBuf *ibuf)
+{
+ struct ImBuf * tbuf1, * tbuf2;
+
+ if (ibuf == 0) return;
+ ibuf->flags &= ~IB_fields;
+
+ ibuf->y *= 2;
+
+ if (ibuf->rect) {
+ /* make copies */
+ 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);
+
+ 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);
+ ibuf->x /= 2;
+
+ IMB_freeImBuf(tbuf1);
+ IMB_freeImBuf(tbuf2);
+ }
+}
+
+
+void IMB_gamwarp(struct ImBuf *ibuf, double gamma)
+{
+ uchar gam[256];
+ int i;
+ uchar *rect;
+
+ if (ibuf == 0) return;
+ if (ibuf->rect == 0) return;
+ if (gamma == 1.0) return;
+
+ gamma = 1.0 / gamma;
+ for (i = 255 ; i >= 0 ; i--) gam[i] = (255.0 * pow(i / 255.0 ,
+ gamma)) + 0.5;
+
+ rect = (uchar *) ibuf->rect;
+ for (i = ibuf->x * ibuf->y ; i>0 ; i--){
+ rect ++;
+ *rect ++ = gam[*rect];
+ *rect ++ = gam[*rect];
+ *rect ++ = gam[*rect];
+ }
+}