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
path: root/source
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
parentabd2a37f8a07f9dfe440ff6760ccbf2bd43d38bc (diff)
Added IMB_gamwarp and IMB_interlace (and the interlace and gamwarp wrappers
for the plugins) Kent
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenpluginapi/intern/pluginapi.c12
-rw-r--r--source/blender/imbuf/IMB_imbuf.h2
-rw-r--r--source/blender/imbuf/intern/divers.c60
3 files changed, 68 insertions, 6 deletions
diff --git a/source/blender/blenpluginapi/intern/pluginapi.c b/source/blender/blenpluginapi/intern/pluginapi.c
index 889c50fe0dc..c9cbc72ca60 100644
--- a/source/blender/blenpluginapi/intern/pluginapi.c
+++ b/source/blender/blenpluginapi/intern/pluginapi.c
@@ -234,6 +234,16 @@ struct ImBuf *scalefastfieldImBuf(struct ImBuf *ib,
/* Extra ones that some NaN (read Ton) plugins use,
* even though they aren't in the header
*/
+
+void interlace(struct ImBuf *ibuf)
+{
+ IMB_interlace(ibuf);
+}
+
+void gamwarp(struct ImBuf *ibuf, double gamma)
+{
+ IMB_gamwarp(ibuf,gamma);
+}
void de_interlace(struct ImBuf *ib)
{
@@ -341,5 +351,7 @@ int pluginapi_force_ref(void)
(int) turbulence +
(int) turbulence1 +
(int) de_interlace +
+ (int) interlace +
+ (int) gamwarp +
(int) rectop;
}
diff --git a/source/blender/imbuf/IMB_imbuf.h b/source/blender/imbuf/IMB_imbuf.h
index 8c97e9b2120..461f68423c5 100644
--- a/source/blender/imbuf/IMB_imbuf.h
+++ b/source/blender/imbuf/IMB_imbuf.h
@@ -344,6 +344,8 @@ int imb_get_anim_type(char * name);
* @attention Defined in divers.c
*/
void IMB_de_interlace(struct ImBuf *ibuf);
+void IMB_interlace(struct ImBuf *ibuf);
+void IMB_gamwarp(struct ImBuf *ibuf, double gamma);
/**
* Change the ordering of the colour bytes pointed to by rect from
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];
+ }
+}