Added IMB_gamwarp and IMB_interlace (and the interlace and gamwarp wrappers
for the plugins) Kent
This commit is contained in:
@@ -235,6 +235,16 @@ struct ImBuf *scalefastfieldImBuf(struct ImBuf *ib,
|
|||||||
* even though they aren't in the header
|
* 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)
|
void de_interlace(struct ImBuf *ib)
|
||||||
{
|
{
|
||||||
IMB_de_interlace(ib);
|
IMB_de_interlace(ib);
|
||||||
@@ -341,5 +351,7 @@ int pluginapi_force_ref(void)
|
|||||||
(int) turbulence +
|
(int) turbulence +
|
||||||
(int) turbulence1 +
|
(int) turbulence1 +
|
||||||
(int) de_interlace +
|
(int) de_interlace +
|
||||||
|
(int) interlace +
|
||||||
|
(int) gamwarp +
|
||||||
(int) rectop;
|
(int) rectop;
|
||||||
}
|
}
|
||||||
|
@@ -344,6 +344,8 @@ int imb_get_anim_type(char * name);
|
|||||||
* @attention Defined in divers.c
|
* @attention Defined in divers.c
|
||||||
*/
|
*/
|
||||||
void IMB_de_interlace(struct ImBuf *ibuf);
|
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
|
* Change the ordering of the colour bytes pointed to by rect from
|
||||||
|
@@ -88,7 +88,6 @@ void imb_checkncols(struct ImBuf *ibuf)
|
|||||||
void IMB_de_interlace(struct ImBuf *ibuf)
|
void IMB_de_interlace(struct ImBuf *ibuf)
|
||||||
{
|
{
|
||||||
struct ImBuf * tbuf1, * tbuf2;
|
struct ImBuf * tbuf1, * tbuf2;
|
||||||
/* extern rectcpy(); */
|
|
||||||
|
|
||||||
if (ibuf == 0) return;
|
if (ibuf == 0) return;
|
||||||
if (ibuf->flags & IB_fields) 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);
|
tbuf2 = IMB_allocImBuf(ibuf->x, ibuf->y / 2, 32, IB_rect, 0);
|
||||||
|
|
||||||
ibuf->x *= 2;
|
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(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_rectop(tbuf2, ibuf, 0, 0, tbuf2->x, 0, 32767, 32767, IMB_rectcpy, 0);
|
||||||
|
|
||||||
ibuf->x /= 2;
|
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, 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_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;
|
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];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user