diff options
Diffstat (limited to 'source/blender/imbuf/intern/scaling.c')
-rw-r--r-- | source/blender/imbuf/intern/scaling.c | 189 |
1 files changed, 0 insertions, 189 deletions
diff --git a/source/blender/imbuf/intern/scaling.c b/source/blender/imbuf/intern/scaling.c index b3e25b52140..335e16402f9 100644 --- a/source/blender/imbuf/intern/scaling.c +++ b/source/blender/imbuf/intern/scaling.c @@ -32,7 +32,6 @@ #include "BLI_blenlib.h" #include "imbuf.h" -#include "imbuf_patch.h" #include "IMB_imbuf_types.h" #include "IMB_imbuf.h" @@ -347,142 +346,6 @@ struct ImBuf *IMB_onehalf(struct ImBuf *ibuf1) } - -struct ImBuf *IMB_onethird(struct ImBuf *ibuf1) -{ - struct ImBuf *ibuf2; - uchar *p1,*p2,*p3,*dest; - float *p1f, *p2f, *p3f, *destf; - int do_rect, do_float; - short a,r,g,b,x,y,i; - float af,rf,gf,bf; - - p2= p3= NULL; - p2f= p3f= NULL; - if (ibuf1==NULL) return (0); - if (ibuf1->rect==NULL && ibuf1->rect_float==NULL) return (0); - - do_rect= (ibuf1->rect != NULL); - do_float= (ibuf1->rect_float != NULL); - - ibuf2=IMB_allocImBuf((ibuf1->x)/3, (ibuf1->y)/3, ibuf1->depth, ibuf1->flags, 0); - if (ibuf2==NULL) return (0); - - p1f = ibuf1->rect_float; - destf = ibuf2->rect_float; - p1 = (uchar *) ibuf1->rect; - dest=(uchar *) ibuf2->rect; - - for(y=ibuf2->y;y>0;y--){ - if (do_rect) { - p2 = p1 + (ibuf1->x << 2); - p3 = p2 + (ibuf1->x << 2); - } - if (do_float) { - p2f = p1f + (ibuf1->x <<2); - p3f = p2f + (ibuf1->x <<2); - } - for(x=ibuf2->x;x>0;x--){ - a=r=g=b=0; - af=rf=gf=bf=0; - for (i=3;i>0;i--){ - if (do_rect) { - a += *(p1++) + *(p2++) + *(p3++); - b += *(p1++) + *(p2++) + *(p3++); - g += *(p1++) + *(p2++) + *(p3++); - r += *(p1++) + *(p2++) + *(p3++); - } - if (do_float) { - af += *(p1f++) + *(p2f++) + *(p3f++); - bf += *(p1f++) + *(p2f++) + *(p3f++); - gf += *(p1f++) + *(p2f++) + *(p3f++); - rf += *(p1f++) + *(p2f++) + *(p3f++); - } - } - if (do_rect) { - *(dest++) = a/9; - *(dest++) = b/9; - *(dest++) = g/9; - *(dest++) = r/9; - } - if (do_float) { - *(destf++) = af/9.0f; - *(destf++) = bf/9.0f; - *(destf++) = gf/9.0f; - *(destf++) = rf/9.0f; - } - } - if (do_rect) p1=p3; - if (do_float) p1f = p3f; - } - return (ibuf2); -} - - -struct ImBuf *IMB_halflace(struct ImBuf *ibuf1) -{ - struct ImBuf *ibuf2; - uchar *p1,*p2,*dest; - float *p1f,*p2f,*destf; - short a,r,g,b,x,y,i; - float af,rf,gf,bf; - int do_rect, do_float; - - p2= NULL; - p2f= NULL; - if (ibuf1==NULL) return (0); - if (ibuf1->rect==NULL && ibuf1->rect_float==NULL) return (0); - - do_rect= (ibuf1->rect != NULL); - do_float= (ibuf1->rect_float != NULL); - - ibuf2=IMB_allocImBuf((ibuf1->x)/4, (ibuf1->y)/2, ibuf1->depth, ibuf1->flags, 0); - if (ibuf2==NULL) return (0); - - p1f = ibuf1->rect_float; - destf= ibuf2->rect_float; - p1 = (uchar *) ibuf1->rect; - dest=(uchar *) ibuf2->rect; - - for(y= ibuf2->y / 2 ; y>0;y--){ - if (do_rect) p2 = p1 + (ibuf1->x << 3); - if (do_float) p2f = p1f + (ibuf1->x << 3); - for(x = 2 * ibuf2->x;x>0;x--){ - a=r=g=b=0; - af=rf=gf=bf=0; - for (i=4;i>0;i--){ - if (do_rect) { - a += *(p1++) + *(p2++); - b += *(p1++) + *(p2++); - g += *(p1++) + *(p2++); - r += *(p1++) + *(p2++); - } - if (do_float) { - af += *(p1f++) + *(p2f++); - bf += *(p1f++) + *(p2f++); - gf += *(p1f++) + *(p2f++); - rf += *(p1f++) + *(p2f++); - } - } - if (do_rect) { - *(dest++) = a >> 3; - *(dest++) = b >> 3; - *(dest++) = g >> 3; - *(dest++) = r >> 3; - } - if (do_float) { - *(destf++) = 0.125f*af; - *(destf++) = 0.125f*bf; - *(destf++) = 0.125f*gf; - *(destf++) = 0.125f*rf; - } - } - if (do_rect) p1 = p2; - if (do_float) p1f = p2f; - } - return (ibuf2); -} - /* q_scale_linear_interpolation helper functions */ static void enlarge_picture_byte( @@ -1687,55 +1550,3 @@ struct ImBuf *IMB_scalefastImBuf(struct ImBuf *ibuf, short newx, short newy) return(ibuf); } - -static struct ImBuf *generic_fieldscale(struct ImBuf *ibuf, short newx, short newy, struct ImBuf *(*scalefunc)(ImBuf *, short, short) ) -{ - struct ImBuf *sbuf1, *sbuf2; - - sbuf1 = IMB_allocImBuf(ibuf->x, ibuf->y / 2, ibuf->depth, ibuf->flags, 0); - sbuf2 = IMB_allocImBuf(ibuf->x, ibuf->y / 2, ibuf->depth, ibuf->flags, 0); - - ibuf->x *= 2; - - /* more args needed, 0 assumed... (nzc) */ - IMB_rectcpy(sbuf1, ibuf, 0, 0, 0, 0, ibuf->x, ibuf->y); - IMB_rectcpy(sbuf2, ibuf, 0, 0, sbuf2->x, 0, ibuf->x, ibuf->y); - - imb_freerectImBuf(ibuf); - imb_freerectfloatImBuf(ibuf); - - ibuf->x = newx; - ibuf->y = newy; - - imb_addrectImBuf(ibuf); - if(ibuf->flags & IB_rectfloat) - imb_addrectfloatImBuf(ibuf); - - scalefunc(sbuf1, newx, newy / 2); - scalefunc(sbuf2, newx, newy / 2); - - ibuf->x *= 2; - - /* more args needed, 0 assumed... (nzc) */ - IMB_rectcpy(ibuf, sbuf1, 0, 0, 0, 0, sbuf1->x, sbuf1->y); - IMB_rectcpy(ibuf, sbuf2, sbuf2->x, 0, 0, 0, sbuf2->x, sbuf2->y); - - ibuf->x /= 2; - - IMB_freeImBuf(sbuf1); - IMB_freeImBuf(sbuf2); - - return(ibuf); -} - - -struct ImBuf *IMB_scalefastfieldImBuf(struct ImBuf *ibuf, short newx, short newy) -{ - return(generic_fieldscale(ibuf, newx, newy, IMB_scalefastImBuf)); -} - -struct ImBuf *IMB_scalefieldImBuf(struct ImBuf *ibuf, short newx, short newy) -{ - return(generic_fieldscale(ibuf, newx, newy, IMB_scaleImBuf)); -} - |