Revision: 17521
          
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=17521
Author:   theeth
Date:     2008-11-20 22:57:21 +0100 (Thu, 20 Nov 2008)

Log Message:
-----------
merging trunk 17485:17520

Modified Paths:
--------------
    branches/etch-a-ton/SConstruct
    branches/etch-a-ton/config/darwin-config.py
    branches/etch-a-ton/config/linux2-config.py
    branches/etch-a-ton/config/openbsd3-config.py
    branches/etch-a-ton/config/sunos5-config.py
    branches/etch-a-ton/config/win32-vc-config.py
    branches/etch-a-ton/source/blender/imbuf/IMB_imbuf.h
    branches/etch-a-ton/source/blender/imbuf/intern/imageprocess.c
    branches/etch-a-ton/source/blender/src/buttons_editing.c
    branches/etch-a-ton/source/blender/src/seqeffects.c
    branches/etch-a-ton/tools/Blender.py
    branches/etch-a-ton/tools/btools.py

Modified: branches/etch-a-ton/SConstruct
===================================================================
--- branches/etch-a-ton/SConstruct      2008-11-20 21:45:22 UTC (rev 17520)
+++ branches/etch-a-ton/SConstruct      2008-11-20 21:57:21 UTC (rev 17521)
@@ -249,7 +249,7 @@
 # remove stdc++ from LLIBS if we are building a statc linked CXXFLAGS
 if env['WITH_BF_STATICCXX']:
        if 'stdc++' in env['LLIBS']:
-               env['LLIBS'] = env['LLIBS'].replace('stdc++', ' ')
+               env['LLIBS'].remove('stdc++')
        else:
                print '\tcould not remove stdc++ library from LLIBS, 
WITH_BF_STATICCXX may not work for your platform'
 

Modified: branches/etch-a-ton/config/darwin-config.py
===================================================================
--- branches/etch-a-ton/config/darwin-config.py 2008-11-20 21:45:22 UTC (rev 
17520)
+++ branches/etch-a-ton/config/darwin-config.py 2008-11-20 21:57:21 UTC (rev 
17521)
@@ -216,14 +216,14 @@
 PLATFORM_LINKFLAGS = '-fexceptions -framework CoreServices -framework 
Foundation -framework IOKit -framework AppKit -framework Carbon -framework AGL 
-framework AudioUnit -framework AudioToolbox -framework CoreAudio -framework 
QuickTime'
 
 #note to build succesfully on 10.3.9 SDK you need to patch  10.3.9 by adding 
the SystemStubs.a lib from 10.4
-LLIBS = 'stdc++ SystemStubs'
+LLIBS = ['stdc++', 'SystemStubs']
 
 # some flags shuffling for different Os versions
 if MAC_MIN_VERS == '10.3':
        CFLAGS = ['-fuse-cxa-atexit']+CFLAGS
        CXXFLAGS = ['-fuse-cxa-atexit']+CXXFLAGS
        PLATFORM_LINKFLAGS = '-fuse-cxa-atexit '+PLATFORM_LINKFLAGS
-       LLIBS = LLIBS + ' crt3.o'
+       LLIBS.append('crt3.o')
        
 if USE_SDK==True:
        SDK_FLAGS=['-isysroot', 
MACOSX_SDK,'-mmacosx-version-min='+MAC_MIN_VERS]        

Modified: branches/etch-a-ton/config/linux2-config.py
===================================================================
--- branches/etch-a-ton/config/linux2-config.py 2008-11-20 21:45:22 UTC (rev 
17520)
+++ branches/etch-a-ton/config/linux2-config.py 2008-11-20 21:57:21 UTC (rev 
17521)
@@ -193,7 +193,7 @@
 
 ##FIX_STUBS_WARNINGS = -Wno-unused
 
-LLIBS = 'util c m dl pthread stdc++'
+LLIBS = ['util', 'c', 'm', 'dl', 'pthread', 'stdc++']
 ##LOPTS = --dynamic
 ##DYNLDFLAGS = -shared $(LDFLAGS)
 

Modified: branches/etch-a-ton/config/openbsd3-config.py
===================================================================
--- branches/etch-a-ton/config/openbsd3-config.py       2008-11-20 21:45:22 UTC 
(rev 17520)
+++ branches/etch-a-ton/config/openbsd3-config.py       2008-11-20 21:57:21 UTC 
(rev 17521)
@@ -151,7 +151,7 @@
 
 ##FIX_STUBS_WARNINGS = -Wno-unused
 
-LLIBS = 'm stdc++ pthread util'
+LLIBS = ['m', 'stdc++', 'pthread', 'util']
 ##LOPTS = --dynamic
 ##DYNLDFLAGS = -shared $(LDFLAGS)
 

Modified: branches/etch-a-ton/config/sunos5-config.py
===================================================================
--- branches/etch-a-ton/config/sunos5-config.py 2008-11-20 21:45:22 UTC (rev 
17520)
+++ branches/etch-a-ton/config/sunos5-config.py 2008-11-20 21:57:21 UTC (rev 
17521)
@@ -165,7 +165,7 @@
 
 ##FIX_STUBS_WARNINGS = -Wno-unused
 
-LLIBS = 'c m dl pthread stdc++'
+LLIBS = ['c', 'm', 'dl', 'pthread', 'stdc++']
 ##LOPTS = --dynamic
 ##DYNLDFLAGS = -shared $(LDFLAGS)
 

Modified: branches/etch-a-ton/config/win32-vc-config.py
===================================================================
--- branches/etch-a-ton/config/win32-vc-config.py       2008-11-20 21:45:22 UTC 
(rev 17520)
+++ branches/etch-a-ton/config/win32-vc-config.py       2008-11-20 21:57:21 UTC 
(rev 17521)
@@ -181,7 +181,7 @@
 CC_WARN = []
 CXX_WARN = []
 
-LLIBS = 'ws2_32 vfw32 winmm kernel32 user32 gdi32 comdlg32 advapi32 shfolder 
shell32 ole32 oleaut32 uuid'
+LLIBS = ['ws2_32', 'vfw32', 'winmm', 'kernel32', 'user32', 'gdi32', 
'comdlg32', 'advapi32', 'shfolder', 'shell32', 'ole32', 'oleaut32', 'uuid']
 
 PLATFORM_LINKFLAGS = '''
                        /SUBSYSTEM:CONSOLE

Modified: branches/etch-a-ton/source/blender/imbuf/IMB_imbuf.h
===================================================================
--- branches/etch-a-ton/source/blender/imbuf/IMB_imbuf.h        2008-11-20 
21:45:22 UTC (rev 17520)
+++ branches/etch-a-ton/source/blender/imbuf/IMB_imbuf.h        2008-11-20 
21:57:21 UTC (rev 17521)
@@ -403,9 +403,14 @@
  *
  * @attention defined in imageprocess.c
  */
-void bicubic_interpolation(struct ImBuf *in, struct ImBuf *out, float x, float 
y, int xout, int yout);
+void bicubic_interpolation(struct ImBuf *in, struct ImBuf *out, float u, float 
v, int xout, int yout);
 void neareast_interpolation(struct ImBuf *in, struct ImBuf *out, float u, 
float v, int xout, int yout);
 void bilinear_interpolation(struct ImBuf *in, struct ImBuf *out, float u, 
float v, int xout, int yout);
+
+void bicubic_interpolation_color(struct ImBuf *in, unsigned char *col, float 
*col_float, float u, float v);
+void neareast_interpolation_color(struct ImBuf *in, unsigned char *col, float 
*col_float, float u, float v);
+void bilinear_interpolation_color(struct ImBuf *in, unsigned char *col, float 
*col_float, float u, float v);
+
 /**
  * Change the ordering of the color bytes pointed to by rect from
  * rgba to abgr. size * 4 color bytes are reordered.

Modified: branches/etch-a-ton/source/blender/imbuf/intern/imageprocess.c
===================================================================
--- branches/etch-a-ton/source/blender/imbuf/intern/imageprocess.c      
2008-11-20 21:45:22 UTC (rev 17520)
+++ branches/etch-a-ton/source/blender/imbuf/intern/imageprocess.c      
2008-11-20 21:57:21 UTC (rev 17521)
@@ -80,7 +80,18 @@
                }
        }
 }
+static void pixel_from_buffer(struct ImBuf *ibuf, unsigned char **outI, float 
**outF, int x, int y)
 
+{
+       int offset = ibuf->x * y * 4 + 4*x;
+       
+       if (ibuf->rect)
+               *outI= (unsigned char *)ibuf->rect + offset;
+       
+       if (ibuf->rect_float)
+               *outF= (float *)ibuf->rect_float + offset;
+}
+
 /**************************************************************************
 *                            INTERPOLATIONS 
 *
@@ -92,33 +103,41 @@
 /*  More info: 
http://wiki.blender.org/index.php/User:Damiles#Bicubic_pixel_interpolation
 */
 /* function assumes out to be zero'ed, only does RGBA */
+
 static float P(float k){
+       float p1, p2, p3, p4;
+       p1 = MAX2(k+2.0f,0);
+       p2 = MAX2(k+1.0f,0);
+       p3 = MAX2(k,0);
+       p4 = MAX2(k-1.0f,0);
+       return (float)(1.0f/6.0f)*( p1*p1*p1 - 4.0f * p2*p2*p2 + 6.0f * 
p3*p3*p3 - 4.0f * p4*p4*p4);
+}
+
+
+#if 0
+/* older, slower function, works the same as above */
+static float P(float k){
        return (float)(1.0f/6.0f)*( pow( MAX2(k+2.0f,0) , 3.0f ) - 4.0f * pow( 
MAX2(k+1.0f,0) , 3.0f ) + 6.0f * pow( MAX2(k,0) , 3.0f ) - 4.0f * pow( 
MAX2(k-1.0f,0) , 3.0f));
 }
+#endif
 
-void bicubic_interpolation(ImBuf *in, ImBuf *out, float x, float y, int xout, 
int yout)
+void bicubic_interpolation_color(struct ImBuf *in, unsigned char *outI, float 
*outF, float u, float v)
 {
        int i,j,n,m,x1,y1;
-       unsigned char *dataI,*outI;
-       float a,b,w,wx,wy[4], outR,outG,outB,outA,*dataF,*outF;
-       int do_rect, do_float;
+       unsigned char *dataI;
+       float a,b,w,wx,wy[4], outR,outG,outB,outA,*dataF;
 
-       if (in == NULL) return;
-       if (in->rect == NULL && in->rect_float == NULL) return;
+       /* ImBuf in must have a valid rect or rect_float, assume this is alredy 
checked */
 
-       do_rect= (out->rect != NULL);
-       do_float= (out->rect_float != NULL);
+       i= (int)floor(u);
+       j= (int)floor(v);
+       a= u - i;
+       b= v - j;
 
-       i= (int)floor(x);
-       j= (int)floor(y);
-       a= x - i;
-       b= y - j;
-
-       outR= 0.0f;
-       outG= 0.0f;
-       outB= 0.0f;
-       outA= 0.0f;
+       outR = outG = outB = outA = 0.0f;
        
+/* Optimized and not so easy to read */
+       
        /* avoid calling multiple times */
        wy[0] = P(b-(-1));
        wy[1] = P(b-  0);
@@ -137,14 +156,14 @@
                                        /* except that would call P() 16 times 
per pixel therefor pow() 64 times, better precalc these */
                                        w = wx * wy[m+1];
                                        
-                                       if (do_float) {
+                                       if (outF) {
                                                dataF= in->rect_float + in->x * 
y1 * 4 + 4*x1;
                                                outR+= dataF[0] * w;
                                                outG+= dataF[1] * w;
                                                outB+= dataF[2] * w;
                                                outA+= dataF[3] * w;
                                        }
-                                       if (do_rect) {
+                                       if (outI) {
                                                dataI= (unsigned char*)in->rect 
+ in->x * y1 * 4 + 4*x1;
                                                outR+= dataI[0] * w;
                                                outG+= dataI[1] * w;
@@ -155,15 +174,42 @@
                        }
                }
        }
-       if (do_rect) {
-               outI= (unsigned char *)out->rect + out->x * yout * 4 + 4*xout;
+
+/* Done with optimized part */
+       
+#if 0 
+       /* older, slower function, works the same as above */
+       for(n= -1; n<= 2; n++){
+               for(m= -1; m<= 2; m++){
+                       x1= i+n;
+                       y1= j+m;
+                       if (x1>0 && x1 < in->x && y1>0 && y1<in->y) {
+                               if (do_float) {
+                                       dataF= in->rect_float + in->x * y1 * 4 
+ 4*x1;
+                                       outR+= dataF[0] * P(n-a) * P(b-m);
+                                       outG+= dataF[1] * P(n-a) * P(b-m);
+                                       outB+= dataF[2] * P(n-a) * P(b-m);
+                                       outA+= dataF[3] * P(n-a) * P(b-m);
+                               }
+                               if (do_rect) {
+                                       dataI= (unsigned char*)in->rect + in->x 
* y1 * 4 + 4*x1;
+                                       outR+= dataI[0] * P(n-a) * P(b-m);
+                                       outG+= dataI[1] * P(n-a) * P(b-m);
+                                       outB+= dataI[2] * P(n-a) * P(b-m);
+                                       outA+= dataI[3] * P(n-a) * P(b-m);
+                               }
+                       }
+               }
+       }
+#endif
+       
+       if (outI) {
                outI[0]= (int)outR;
                outI[1]= (int)outG;
                outI[2]= (int)outB;
                outI[3]= (int)outA;
        }
-       if (do_float) {
-               outF= (float *)out->rect_float + out->x * yout * 4 + 4*xout;
+       if (outF) {
                outF[0]= outR;
                outF[1]= outG;
                outF[2]= outB;
@@ -171,24 +217,34 @@
        }
 }
 
+
+void bicubic_interpolation(ImBuf *in, ImBuf *out, float u, float v, int xout, 
int yout)
+{
+       
+       unsigned char *outI = NULL;
+       float *outF = NULL;
+       
+       if (in == NULL || (in->rect == NULL && in->rect_float == NULL)) return;
+       
+       pixel_from_buffer(out, &outI, &outF, xout, yout); /* gcc warns these 
could be uninitialized, but its ok */
+       
+       bicubic_interpolation_color(in, outI, outF, u, v);
+}
+
 /* function assumes out to be zero'ed, only does RGBA */
 /* BILINEAR INTERPOLATION */
-void bilinear_interpolation(ImBuf *in, ImBuf *out, float u, float v, int xout, 
int yout)
+void bilinear_interpolation_color(struct ImBuf *in, unsigned char *outI, float 
*outF, float u, float v)
 {
-       float *row1, *row2, *row3, *row4, a, b, *outF;
-       unsigned char *row1I, *row2I, *row3I, *row4I, *outI;
+       float *row1, *row2, *row3, *row4, a, b;
+       unsigned char *row1I, *row2I, *row3I, *row4I;
        float a_b, ma_b, a_mb, ma_mb;
        float empty[4]= {0.0f, 0.0f, 0.0f, 0.0f};
        unsigned char emptyI[4]= {0, 0, 0, 0};
        int y1, y2, x1, x2;
-       int do_rect, do_float;
+       
+       
+       /* ImBuf in must have a valid rect or rect_float, assume this is alredy 
checked */
 
-       if (in==NULL) return;
-       if (in->rect==NULL && in->rect_float==NULL) return;
-

@@ Diff output truncated at 10240 characters. @@

_______________________________________________
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to