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
diff options
context:
space:
mode:
authorTon Roosendaal <ton@blender.org>2006-02-10 21:57:52 +0300
committerTon Roosendaal <ton@blender.org>2006-02-10 21:57:52 +0300
commitb9425b2a3509b4715acf753cefd4a2392b537ccb (patch)
treebb222286e4c223f4b3c16952830f4594656ad1b5 /source/blender/imbuf/intern/filter.c
parent945484e92ab55d61c10d968a207fe4468e26e927 (diff)
Interesting commit for artists using huge textures;
The code that generated mipmaps took a real long time to do it... on a 5k x 5k image it took here (no optim, debug compile) 32.5 sec. Recoded the very old filtering routine, which already brought it down to 2.8 seconds. Then tested if we even need this filtering... in many cases the images are painted or photographs, which is filtered OK already. Without the filter, the mipmap timing went down to 0.39 second. :) http://www.blender.org/bf/filters/index1.html Here's an example of two 'mips' generated with or without gauss filter. Note that aliasing in an image remains there... which can be a wanted effect anyway. So; added the gauss filter as option in making mipmaps. Also had to reshuffle the buttons there in a more logical manner. There's also disabled code in the do_versions to set 'gauss' on in older files. Will be enabled during release time.
Diffstat (limited to 'source/blender/imbuf/intern/filter.c')
-rw-r--r--source/blender/imbuf/intern/filter.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/source/blender/imbuf/intern/filter.c b/source/blender/imbuf/intern/filter.c
index 810e012761b..8c5bc430aea 100644
--- a/source/blender/imbuf/intern/filter.c
+++ b/source/blender/imbuf/intern/filter.c
@@ -203,6 +203,36 @@ void imb_filterx(struct ImBuf *ibuf)
}
}
+void IMB_filterN(ImBuf *out, ImBuf *in)
+{
+ register char *row1, *row2, *row3;
+ register char *cp;
+ int rowlen, x, y;
+
+ rowlen= in->x;
+
+ for(y=2; y<in->y; y++) {
+ /* setup rows */
+ row1= (char *)(in->rect + (y-2)*rowlen);
+ row2= row1 + 4*rowlen;
+ row3= row2 + 4*rowlen;
+
+ cp= (char *)(out->rect + (y-1)*rowlen);
+ cp[0]= row2[0];
+ cp[1]= row2[1];
+ cp[2]= row2[2];
+ cp[3]= row2[3];
+ cp+= 4;
+
+ for(x=2; x<rowlen; x++) {
+ cp[0]= (row1[0] + 2*row1[4] + row1[8] + 2*row2[0] + 4*row2[4] + 2*row2[8] + row3[0] + 2*row3[4] + row3[8])>>4;
+ cp[1]= (row1[1] + 2*row1[5] + row1[9] + 2*row2[1] + 4*row2[5] + 2*row2[9] + row3[1] + 2*row3[5] + row3[9])>>4;
+ cp[2]= (row1[2] + 2*row1[6] + row1[10] + 2*row2[2] + 4*row2[6] + 2*row2[10] + row3[2] + 2*row3[6] + row3[10])>>4;
+ cp[3]= (row1[3] + 2*row1[7] + row1[11] + 2*row2[3] + 4*row2[7] + 2*row2[11] + row3[3] + 2*row3[7] + row3[11])>>4;
+ cp+=4; row1+=4; row2+=4; row3+=4;
+ }
+ }
+}
void IMB_filter(struct ImBuf *ibuf)
{