diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2010-05-07 19:18:04 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2010-05-07 19:18:04 +0400 |
commit | 008863daec1249d1f17bc69e1105e336db690d63 (patch) | |
tree | 78a4001857b26a287125a3f5fa31496052f6ebdd /source/blender/imbuf/intern/scaling.c | |
parent | 1613829e8e821321da99cad4790b7e6a1d90cea8 (diff) |
Merge image related changes from the render branch. This includes the image
tile cache code in imbuf, but it is not hooked up to the render engine.
Imbuf module: some small refactoring and removing a lot of unused or old code
(about 6.5k lines).
* Added a ImFileType struct with callbacks to make adding an file format type,
or making changes to the API easier.
* Move imbuf init/exit code into IMB_init()/IMB_exit() functions.
* Increased mipmap levels from 10 to 20, you run into this limit already with
a 2k image.
* Removed hamx, amiga, anim5 format support.
* Removed colormap saving, only simple colormap code now for reading tga.
* Removed gen_dynlibtiff.py, editing this is almost as much work as just
editing the code directly.
* Functions removed that were only used for sequencer plugin API:
IMB_anim_nextpic, IMB_clever_double, IMB_antialias, IMB_gamwarp,
IMB_scalefieldImBuf, IMB_scalefastfieldImBuf, IMB_onethird, IMB_halflace,
IMB_dit0, IMB_dit2, IMB_cspace
* Write metadata info into OpenEXR images. Can be viewed with the command
line utility 'exrheader'
For the image tile cache code, see this page:
http://wiki.blender.org/index.php/Dev:2.5/Source/Imaging/ImageTileCache
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)); -} - |