Revision: 28209
          
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=28209
Author:   blendix
Date:     2010-04-15 17:49:48 +0200 (Thu, 15 Apr 2010)

Log Message:
-----------
Render Branch:

Imbuf module: some small refactoring and removing a lot of unused or old code
(about 6.5k lines), it's a bit drastic but can add back if it's still useful. 

* 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

Image textures can now lazely load mipmap levels from files, so if an object
is far away only a lower level is loaded. This is supported for the .tx file
format as used by prman, which is basically a tiff image with all the mipmap
levels saved in it. I tested generating them using OpenImageIO maketx utility,
(there is no way to save these from Blender currently).

Added mipmap levels simplify option (couldn't think of a better name). This
makes it possible to force using lower resolution mipmap levels, which helps
reducing memory usage a lot when using .tx files.

Next: tile loading support, then swapping them in and out with a cache.

Modified Paths:
--------------
    branches/render25/release/scripts/ui/properties_scene.py
    branches/render25/source/blender/blenkernel/BKE_blender.h
    branches/render25/source/blender/blenkernel/intern/blender.c
    branches/render25/source/blender/blenkernel/intern/bmfont.c
    branches/render25/source/blender/blenkernel/intern/image.c
    branches/render25/source/blender/blenkernel/intern/texture.c
    branches/render25/source/blender/blenkernel/intern/writeavi.c
    branches/render25/source/blender/blenloader/intern/readfile.c
    branches/render25/source/blender/blenpluginapi/iff.h
    branches/render25/source/blender/blenpluginapi/intern/pluginapi.c
    branches/render25/source/blender/editors/screen/screendump.c
    branches/render25/source/blender/editors/space_file/filelist.c
    branches/render25/source/blender/editors/space_file/writeimage.c
    branches/render25/source/blender/editors/space_image/image_buttons.c
    branches/render25/source/blender/imbuf/IMB_imbuf.h
    branches/render25/source/blender/imbuf/IMB_imbuf_types.h
    branches/render25/source/blender/imbuf/IMB_thumbs.h
    branches/render25/source/blender/imbuf/intern/IMB_anim.h
    branches/render25/source/blender/imbuf/intern/allocimbuf.c
    branches/render25/source/blender/imbuf/intern/anim.c
    branches/render25/source/blender/imbuf/intern/bmp.c
    branches/render25/source/blender/imbuf/intern/cineon/cineon_dpx.c
    branches/render25/source/blender/imbuf/intern/dds/dds_api.cpp
    branches/render25/source/blender/imbuf/intern/dds/dds_api.h
    branches/render25/source/blender/imbuf/intern/divers.c
    branches/render25/source/blender/imbuf/intern/dynlibtiff.c
    branches/render25/source/blender/imbuf/intern/dynlibtiff.h
    branches/render25/source/blender/imbuf/intern/filter.c
    branches/render25/source/blender/imbuf/intern/imageprocess.c
    branches/render25/source/blender/imbuf/intern/imbuf.h
    branches/render25/source/blender/imbuf/intern/imbuf_cocoa.m
    branches/render25/source/blender/imbuf/intern/iris.c
    branches/render25/source/blender/imbuf/intern/jp2.c
    branches/render25/source/blender/imbuf/intern/jpeg.c
    branches/render25/source/blender/imbuf/intern/openexr/openexr_api.cpp
    branches/render25/source/blender/imbuf/intern/openexr/openexr_api.h
    branches/render25/source/blender/imbuf/intern/png.c
    branches/render25/source/blender/imbuf/intern/radiance_hdr.c
    branches/render25/source/blender/imbuf/intern/readimage.c
    branches/render25/source/blender/imbuf/intern/rectop.c
    branches/render25/source/blender/imbuf/intern/rotate.c
    branches/render25/source/blender/imbuf/intern/scaling.c
    branches/render25/source/blender/imbuf/intern/targa.c
    branches/render25/source/blender/imbuf/intern/thumbs.c
    branches/render25/source/blender/imbuf/intern/tiff.c
    branches/render25/source/blender/imbuf/intern/util.c
    branches/render25/source/blender/imbuf/intern/writeimage.c
    branches/render25/source/blender/makesdna/DNA_image_types.h
    branches/render25/source/blender/makesdna/DNA_scene_types.h
    branches/render25/source/blender/makesrna/intern/rna_image.c
    branches/render25/source/blender/makesrna/intern/rna_scene.c
    branches/render25/source/blender/quicktime/apple/qtkit_import.m
    branches/render25/source/blender/quicktime/apple/quicktime_import.c
    branches/render25/source/blender/render/intern/source/texture_image.c
    branches/render25/source/blender/windowmanager/intern/wm_init_exit.c
    branches/render25/source/creator/creator.c
    branches/render25/source/gameengine/GamePlayer/ghost/GPG_Application.cpp
    branches/render25/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp

Added Paths:
-----------
    branches/render25/source/blender/imbuf/intern/IMB_filetype.h
    branches/render25/source/blender/imbuf/intern/IMB_metadata.h
    branches/render25/source/blender/imbuf/intern/filetype.c
    branches/render25/source/blender/imbuf/intern/metadata.c
    branches/render25/source/blender/imbuf/intern/module.c

Removed Paths:
-------------
    branches/render25/source/blender/imbuf/intern/IMB_amiga.h
    branches/render25/source/blender/imbuf/intern/IMB_anim5.h
    branches/render25/source/blender/imbuf/intern/IMB_bitplanes.h
    branches/render25/source/blender/imbuf/intern/IMB_bmp.h
    branches/render25/source/blender/imbuf/intern/IMB_cmap.h
    branches/render25/source/blender/imbuf/intern/IMB_cocoa.h
    branches/render25/source/blender/imbuf/intern/IMB_divers.h
    branches/render25/source/blender/imbuf/intern/IMB_dpxcineon.h
    branches/render25/source/blender/imbuf/intern/IMB_ham.h
    branches/render25/source/blender/imbuf/intern/IMB_hamx.h
    branches/render25/source/blender/imbuf/intern/IMB_iff.h
    branches/render25/source/blender/imbuf/intern/IMB_imginfo.h
    branches/render25/source/blender/imbuf/intern/IMB_iris.h
    branches/render25/source/blender/imbuf/intern/IMB_jp2.h
    branches/render25/source/blender/imbuf/intern/IMB_jpeg.h
    branches/render25/source/blender/imbuf/intern/IMB_png.h
    branches/render25/source/blender/imbuf/intern/IMB_radiance_hdr.h
    branches/render25/source/blender/imbuf/intern/IMB_targa.h
    branches/render25/source/blender/imbuf/intern/IMB_tiff.h
    branches/render25/source/blender/imbuf/intern/amiga.c
    branches/render25/source/blender/imbuf/intern/anim5.c
    branches/render25/source/blender/imbuf/intern/antialias.c
    branches/render25/source/blender/imbuf/intern/bitplanes.c
    branches/render25/source/blender/imbuf/intern/cmap.c
    branches/render25/source/blender/imbuf/intern/cspace.c
    branches/render25/source/blender/imbuf/intern/data.c
    branches/render25/source/blender/imbuf/intern/dither.c
    branches/render25/source/blender/imbuf/intern/gen_dynlibtiff.py
    branches/render25/source/blender/imbuf/intern/ham.c
    branches/render25/source/blender/imbuf/intern/hamx.c
    branches/render25/source/blender/imbuf/intern/iff.c
    branches/render25/source/blender/imbuf/intern/imbuf_patch.h
    branches/render25/source/blender/imbuf/intern/imginfo.c
    branches/render25/source/blender/imbuf/intern/matrix.h

Modified: branches/render25/release/scripts/ui/properties_scene.py
===================================================================
--- branches/render25/release/scripts/ui/properties_scene.py    2010-04-15 
15:36:51 UTC (rev 28208)
+++ branches/render25/release/scripts/ui/properties_scene.py    2010-04-15 
15:49:48 UTC (rev 28209)
@@ -220,6 +220,7 @@
             col = split.column()
         col.prop(rd, "simplify_shadow_samples", text="Shadow Samples")
         col.prop(rd, "simplify_ao_sss", text="AO and SSS")
+        col.prop(rd, "simplify_mipmap_levels", text="Mipmap Levels")
 
 
 from bpy.props import *

Modified: branches/render25/source/blender/blenkernel/BKE_blender.h
===================================================================
--- branches/render25/source/blender/blenkernel/BKE_blender.h   2010-04-15 
15:36:51 UTC (rev 28208)
+++ branches/render25/source/blender/blenkernel/BKE_blender.h   2010-04-15 
15:49:48 UTC (rev 28209)
@@ -45,7 +45,7 @@
 struct Main;
        
 #define BLENDER_VERSION                        252
-#define BLENDER_SUBVERSION             11
+#define BLENDER_SUBVERSION             12
 
 #define BLENDER_MINVERSION             250
 #define BLENDER_MINSUBVERSION  0

Modified: branches/render25/source/blender/blenkernel/intern/blender.c
===================================================================
--- branches/render25/source/blender/blenkernel/intern/blender.c        
2010-04-15 15:36:51 UTC (rev 28208)
+++ branches/render25/source/blender/blenkernel/intern/blender.c        
2010-04-15 15:49:48 UTC (rev 28209)
@@ -100,7 +100,7 @@
 
        BKE_spacetypes_free();          /* after free main, it uses space 
callbacks */
        
-       IMB_freeImBufdata();            /* imbuf lib */
+       IMB_exit();
        
        free_nodesystem();      
 }

Modified: branches/render25/source/blender/blenkernel/intern/bmfont.c
===================================================================
--- branches/render25/source/blender/blenkernel/intern/bmfont.c 2010-04-15 
15:36:51 UTC (rev 28208)
+++ branches/render25/source/blender/blenkernel/intern/bmfont.c 2010-04-15 
15:49:48 UTC (rev 28209)
@@ -178,7 +178,7 @@
        unsigned short version;
        int i;
        
-       if (ibuf != NULL) {
+       if (ibuf != NULL && ibuf->rect != NULL) {
                        // bitmap must have an x size that is a power of two
                if (is_power_of_two(ibuf->x)) {
                        rect = (unsigned char *) (ibuf->rect + (ibuf->x * 
(ibuf->y - 1)));

Modified: branches/render25/source/blender/blenkernel/intern/image.c
===================================================================
--- branches/render25/source/blender/blenkernel/intern/image.c  2010-04-15 
15:36:51 UTC (rev 28208)
+++ branches/render25/source/blender/blenkernel/intern/image.c  2010-04-15 
15:49:48 UTC (rev 28209)
@@ -735,8 +735,6 @@
                return TGA;
        else if(imtype==R_RAWTGA)
                return RAWTGA;
-       else if(imtype==R_HAMX)
-               return AN_hamx;
 #ifdef WITH_OPENJPEG
        else if(imtype==R_JP2)
                return JP2;
@@ -773,8 +771,6 @@
                return R_TARGA;
        else if(ftype & RAWTGA)
                return R_RAWTGA;
-       else if(ftype == AN_hamx)
-               return R_HAMX;
 #ifdef WITH_OPENJPEG
        else if(ftype & JP2)
                return R_JP2;
@@ -787,7 +783,6 @@
 int BKE_imtype_is_movie(int imtype)
 {
        switch(imtype) {
-       case R_MOVIE:
        case R_AVIRAW:
        case R_AVIJPEG:
        case R_AVICODEC:
@@ -864,7 +859,7 @@
                        extension= ".jp2";
        }
 #endif
-       else { //   R_MOVIE, R_AVICODEC, R_AVIRAW, R_AVIJPEG, R_JPEG90, 
R_QUICKTIME etc
+       else { //   R_AVICODEC, R_AVIRAW, R_AVIJPEG, R_JPEG90, R_QUICKTIME etc
                if(!( BLI_testextensie(string, ".jpg") || 
BLI_testextensie(string, ".jpeg")))
                        extension= ".jpg";
        }
@@ -1212,15 +1207,15 @@
        /* fill all the data values, no prefix */
        stampdata(scene, &stamp_data, 0);
        
-       if (stamp_data.file[0])         IMB_imginfo_change_field (ibuf, "File", 
        stamp_data.file);
-       if (stamp_data.note[0])         IMB_imginfo_change_field (ibuf, "Note", 
        stamp_data.note);
-       if (stamp_data.date[0])         IMB_imginfo_change_field (ibuf, "Date", 
        stamp_data.date);
-       if (stamp_data.marker[0])       IMB_imginfo_change_field (ibuf, 
"Marker",       stamp_data.marker);
-       if (stamp_data.time[0])         IMB_imginfo_change_field (ibuf, "Time", 
        stamp_data.time);
-       if (stamp_data.frame[0])        IMB_imginfo_change_field (ibuf, 
"Frame",        stamp_data.frame);
-       if (stamp_data.camera[0])       IMB_imginfo_change_field (ibuf, 
"Camera",       stamp_data.camera);
-       if (stamp_data.scene[0])        IMB_imginfo_change_field (ibuf, 
"Scene",        stamp_data.scene);
-       if (stamp_data.strip[0])        IMB_imginfo_change_field (ibuf, 
"Strip",        stamp_data.strip);
+       if (stamp_data.file[0])         IMB_metadata_change_field (ibuf, 
"File",                stamp_data.file);
+       if (stamp_data.note[0])         IMB_metadata_change_field (ibuf, 
"Note",                stamp_data.note);
+       if (stamp_data.date[0])         IMB_metadata_change_field (ibuf, 
"Date",                stamp_data.date);
+       if (stamp_data.marker[0])       IMB_metadata_change_field (ibuf, 
"Marker",      stamp_data.marker);
+       if (stamp_data.time[0])         IMB_metadata_change_field (ibuf, 
"Time",                stamp_data.time);
+       if (stamp_data.frame[0])        IMB_metadata_change_field (ibuf, 
"Frame",       stamp_data.frame);
+       if (stamp_data.camera[0])       IMB_metadata_change_field (ibuf, 
"Camera",      stamp_data.camera);
+       if (stamp_data.scene[0])        IMB_metadata_change_field (ibuf, 
"Scene",       stamp_data.scene);
+       if (stamp_data.strip[0])        IMB_metadata_change_field (ibuf, 
"Strip",       stamp_data.strip);
 }
 
 int BKE_write_ibuf(Scene *scene, ImBuf *ibuf, char *name, int imtype, int 
subimtype, int quality)
@@ -1274,9 +1269,6 @@
        else if(imtype==R_RAWTGA) {
                ibuf->ftype= RAWTGA;
        }
-       else if(imtype==R_HAMX) {
-               ibuf->ftype= AN_hamx;
-       }
 #ifdef WITH_OPENJPEG
        else if(imtype==R_JP2) {
                if(quality < 10) quality= 90;
@@ -1300,7 +1292,7 @@
        }
 #endif
        else {
-               /* R_JPEG90, R_MOVIE, etc. default we save jpegs */
+               /* R_JPEG90, etc. default we save jpegs */
                if(quality < 10) quality= 90;
                ibuf->ftype= JPG|quality;
                if(ibuf->depth==32) ibuf->depth= 24;    /* unsupported feature 
only confuses other s/w */
@@ -1719,7 +1711,7 @@
                else
                        BLI_path_abs(str, G.sce);
                
-               ima->anim = openanim(str, IB_cmap | IB_rect);
+               ima->anim = openanim(str, IB_rect);
                
                /* let's initialize this user */
                if(ima->anim && iuser && iuser->frames==0)
@@ -1755,7 +1747,7 @@
 {
        struct ImBuf *ibuf;
        char str[FILE_MAX];
-       int assign = 0;
+       int assign = 0, flag;
        
        /* always ensure clean ima */
        image_free_buffers(ima);
@@ -1765,6 +1757,9 @@
                ibuf = IMB_ibImageFromMemory((int *) ima->packedfile->data, 
ima->packedfile->size, IB_rect|IB_multilayer);
        } 
        else {
+               flag= IB_rect|IB_multilayer|IB_metadata;
+               if(iuser->flag & IMA_USECACHE)
+                       flag |= IB_usecache;
                        
                /* get the right string */
                BLI_strncpy(str, ima->name, sizeof(str));
@@ -1776,7 +1771,7 @@
                BLI_path_frame(str, cfra, 0);
                
                /* read ibuf */
-               ibuf = IMB_loadiffname(str, IB_rect|IB_multilayer|IB_imginfo);
+               ibuf = IMB_loadiffname(str, flag);
        }
        
        if (ibuf) {
@@ -2137,6 +2132,13 @@
                BLI_unlock_thread(LOCK_IMAGE);
        }
 
+       /* XXX temp code until tiles are used for cache, forces
+          full image rect to be loaded into memory */
+       if((!iuser || !(iuser->flag & IMA_USECACHE)) && ibuf && (ibuf->flags & 
IB_usecache)) {
+               IMB_getmipmaplevel(ibuf, 0);
+               ibuf->flags &= ~IB_usecache;
+       }
+
        /* we assuming that if it is not rendering, it's also not multithreaded
         * (a somewhat weak assumption) */
        if(G.rendering==0)

Modified: branches/render25/source/blender/blenkernel/intern/texture.c
===================================================================
--- branches/render25/source/blender/blenkernel/intern/texture.c        
2010-04-15 15:36:51 UTC (rev 28208)
+++ branches/render25/source/blender/blenkernel/intern/texture.c        
2010-04-15 15:49:48 UTC (rev 28209)
@@ -505,6 +505,7 @@
        tex->iuser.fie_ima= 2;
        tex->iuser.ok= 1;
        tex->iuser.frames= 100;
+       tex->iuser.flag |= IMA_USECACHE;
        
        tex->preview = NULL;
 }

Modified: branches/render25/source/blender/blenkernel/intern/writeavi.c
===================================================================
--- branches/render25/source/blender/blenkernel/intern/writeavi.c       
2010-04-15 15:36:51 UTC (rev 28208)
+++ branches/render25/source/blender/blenkernel/intern/writeavi.c       
2010-04-15 15:49:48 UTC (rev 28209)
@@ -75,11 +75,6 @@
        mh.get_movie_path = filepath_avi;
        
        /* do the platform specific handles */
-#ifdef __sgi
-       if (imtype == R_MOVIE) {
-               
-       }
-#endif
 #if defined(_WIN32) && !defined(FREE_WINDOWS)
        if (imtype == R_AVICODEC) {             
                //XXX mh.start_movie= start_avi_codec;

Modified: branches/render25/source/blender/blenloader/intern/readfile.c
===================================================================
--- branches/render25/source/blender/blenloader/intern/readfile.c       
2010-04-15 15:36:51 UTC (rev 28208)
+++ branches/render25/source/blender/blenloader/intern/readfile.c       
2010-04-15 15:49:48 UTC (rev 28209)
@@ -6501,6 +6501,14 @@
                sce->r.subdivision_rate= 1.0f;
 }
 
+static void do_version_image_cache_250(FileData *fd, Library *lib, Main *main)
+{
+       Tex *tex;
+
+       for(tex= main->tex.first; tex; tex=tex->id.next)
+               tex->iuser.flag |= IMA_USECACHE;
+}
+
 static void do_version_constraints_radians_degrees_250(ListBase *lb)
 {
        bConstraint *con;
@@ -8429,8 +8437,6 @@
                                                ima->flag |= IMA_FIELDS;
                                        if(tex->imaflag & TEX_STD_FIELD_)
                                                ima->flag |= IMA_STD_FIELD;
-                                       if(tex->imaflag & TEX_ANTIALI_)
-                                               ima->flag |= IMA_ANTIALI;
                                }
                                tex->iuser.frames= tex->frames;
                                tex->iuser.fie_ima= tex->fie_ima;
@@ -10827,6 +10833,8 @@
                do_version_shading_sys_250(fd, lib, main);
        if (main->versionfile < 252 || (main->versionfile == 252 && 
main->subversionfile < 11))
                do_version_subdivision_250(fd, lib, main);
+       if (main->versionfile < 252 || (main->versionfile == 252 && 
main->subversionfile < 12))
+               do_version_image_cache_250(fd, lib, main);
 
        /* WATCH IT!!!: pointers from libdata have not been converted yet here! 
*/
        /* WATCH IT 2!: Userdef struct init has to be in 
editors/interface/resources.c! */

Modified: branches/render25/source/blender/blenpluginapi/iff.h
===================================================================
--- branches/render25/source/blender/blenpluginapi/iff.h        2010-04-15 
15:36:51 UTC (rev 28208)
+++ branches/render25/source/blender/blenpluginapi/iff.h        2010-04-15 
15:49:48 UTC (rev 28209)
@@ -35,123 +35,19 @@
 #include "util.h"
 #include "externdef.h"
 
-#define IB_rect                        (1 << 0)
-#define IB_planes              (1 << 1)
-#define IB_cmap                        (1 << 2)
-#define IB_test                        (1 << 7)
+struct ImMetaData;
 
-#define IB_fields              (1 << 11)
-#define IB_yuv                 (1 << 12)
-#define IB_zbuf                        (1 << 13)
-#define IB_rgba                        (1 << 14)
+#define IB_MIPMAP_LEVELS       20
+#define IB_FILENAME_SIZE       1023
 
-#define JP2             (1 << 18)
-

@@ Diff output truncated at 10240 characters. @@

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to