[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [28651] trunk/blender/source: Merge image related changes from the render branch.
Brecht Van Lommel
brecht at blender.org
Fri May 7 17:18:04 CEST 2010
Revision: 28651
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=28651
Author: blendix
Date: 2010-05-07 17:18:04 +0200 (Fri, 07 May 2010)
Log Message:
-----------
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
Modified Paths:
--------------
trunk/blender/source/blender/blenkernel/BKE_image.h
trunk/blender/source/blender/blenkernel/intern/blender.c
trunk/blender/source/blender/blenkernel/intern/bmfont.c
trunk/blender/source/blender/blenkernel/intern/image.c
trunk/blender/source/blender/blenkernel/intern/multires.c
trunk/blender/source/blender/blenkernel/intern/sequencer.c
trunk/blender/source/blender/blenkernel/intern/writeavi.c
trunk/blender/source/blender/blenlib/BLI_math_vector.h
trunk/blender/source/blender/blenlib/BLI_path_util.h
trunk/blender/source/blender/blenlib/BLI_storage.h
trunk/blender/source/blender/blenlib/intern/math_vector_inline.c
trunk/blender/source/blender/blenlib/intern/path_util.c
trunk/blender/source/blender/blenlib/intern/storage.c
trunk/blender/source/blender/blenloader/intern/readfile.c
trunk/blender/source/blender/blenpluginapi/iff.h
trunk/blender/source/blender/blenpluginapi/intern/pluginapi.c
trunk/blender/source/blender/editors/interface/interface_draw.c
trunk/blender/source/blender/editors/interface/interface_icons.c
trunk/blender/source/blender/editors/screen/screendump.c
trunk/blender/source/blender/editors/space_file/filelist.c
trunk/blender/source/blender/editors/space_file/writeimage.c
trunk/blender/source/blender/editors/space_image/image_buttons.c
trunk/blender/source/blender/imbuf/IMB_imbuf.h
trunk/blender/source/blender/imbuf/IMB_imbuf_types.h
trunk/blender/source/blender/imbuf/IMB_thumbs.h
trunk/blender/source/blender/imbuf/SConscript
trunk/blender/source/blender/imbuf/intern/IMB_anim.h
trunk/blender/source/blender/imbuf/intern/IMB_filter.h
trunk/blender/source/blender/imbuf/intern/allocimbuf.c
trunk/blender/source/blender/imbuf/intern/anim.c
trunk/blender/source/blender/imbuf/intern/bmp.c
trunk/blender/source/blender/imbuf/intern/cineon/cineon_dpx.c
trunk/blender/source/blender/imbuf/intern/dds/dds_api.cpp
trunk/blender/source/blender/imbuf/intern/dds/dds_api.h
trunk/blender/source/blender/imbuf/intern/divers.c
trunk/blender/source/blender/imbuf/intern/dynlibtiff.c
trunk/blender/source/blender/imbuf/intern/dynlibtiff.h
trunk/blender/source/blender/imbuf/intern/filter.c
trunk/blender/source/blender/imbuf/intern/imageprocess.c
trunk/blender/source/blender/imbuf/intern/imbuf.h
trunk/blender/source/blender/imbuf/intern/imbuf_cocoa.m
trunk/blender/source/blender/imbuf/intern/iris.c
trunk/blender/source/blender/imbuf/intern/jp2.c
trunk/blender/source/blender/imbuf/intern/jpeg.c
trunk/blender/source/blender/imbuf/intern/openexr/openexr_api.cpp
trunk/blender/source/blender/imbuf/intern/openexr/openexr_api.h
trunk/blender/source/blender/imbuf/intern/png.c
trunk/blender/source/blender/imbuf/intern/radiance_hdr.c
trunk/blender/source/blender/imbuf/intern/readimage.c
trunk/blender/source/blender/imbuf/intern/rectop.c
trunk/blender/source/blender/imbuf/intern/rotate.c
trunk/blender/source/blender/imbuf/intern/scaling.c
trunk/blender/source/blender/imbuf/intern/targa.c
trunk/blender/source/blender/imbuf/intern/thumbs.c
trunk/blender/source/blender/imbuf/intern/tiff.c
trunk/blender/source/blender/imbuf/intern/util.c
trunk/blender/source/blender/imbuf/intern/writeimage.c
trunk/blender/source/blender/makesdna/DNA_image_types.h
trunk/blender/source/blender/makesrna/intern/rna_image.c
trunk/blender/source/blender/quicktime/apple/qtkit_import.m
trunk/blender/source/blender/quicktime/apple/quicktime_import.c
trunk/blender/source/blender/windowmanager/intern/wm_init_exit.c
trunk/blender/source/creator/creator.c
trunk/blender/source/gameengine/GamePlayer/ghost/GPG_Application.cpp
trunk/blender/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp
Added Paths:
-----------
trunk/blender/source/blender/imbuf/intern/IMB_filetype.h
trunk/blender/source/blender/imbuf/intern/IMB_metadata.h
trunk/blender/source/blender/imbuf/intern/cache.c
trunk/blender/source/blender/imbuf/intern/filetype.c
trunk/blender/source/blender/imbuf/intern/metadata.c
trunk/blender/source/blender/imbuf/intern/module.c
Removed Paths:
-------------
trunk/blender/source/blender/imbuf/intern/IMB_amiga.h
trunk/blender/source/blender/imbuf/intern/IMB_anim5.h
trunk/blender/source/blender/imbuf/intern/IMB_bitplanes.h
trunk/blender/source/blender/imbuf/intern/IMB_bmp.h
trunk/blender/source/blender/imbuf/intern/IMB_cmap.h
trunk/blender/source/blender/imbuf/intern/IMB_cocoa.h
trunk/blender/source/blender/imbuf/intern/IMB_divers.h
trunk/blender/source/blender/imbuf/intern/IMB_dpxcineon.h
trunk/blender/source/blender/imbuf/intern/IMB_ham.h
trunk/blender/source/blender/imbuf/intern/IMB_hamx.h
trunk/blender/source/blender/imbuf/intern/IMB_iff.h
trunk/blender/source/blender/imbuf/intern/IMB_imginfo.h
trunk/blender/source/blender/imbuf/intern/IMB_iris.h
trunk/blender/source/blender/imbuf/intern/IMB_jp2.h
trunk/blender/source/blender/imbuf/intern/IMB_jpeg.h
trunk/blender/source/blender/imbuf/intern/IMB_png.h
trunk/blender/source/blender/imbuf/intern/IMB_radiance_hdr.h
trunk/blender/source/blender/imbuf/intern/IMB_targa.h
trunk/blender/source/blender/imbuf/intern/IMB_tiff.h
trunk/blender/source/blender/imbuf/intern/amiga.c
trunk/blender/source/blender/imbuf/intern/anim5.c
trunk/blender/source/blender/imbuf/intern/antialias.c
trunk/blender/source/blender/imbuf/intern/bitplanes.c
trunk/blender/source/blender/imbuf/intern/cmap.c
trunk/blender/source/blender/imbuf/intern/cspace.c
trunk/blender/source/blender/imbuf/intern/data.c
trunk/blender/source/blender/imbuf/intern/dither.c
trunk/blender/source/blender/imbuf/intern/gen_dynlibtiff.py
trunk/blender/source/blender/imbuf/intern/ham.c
trunk/blender/source/blender/imbuf/intern/hamx.c
trunk/blender/source/blender/imbuf/intern/iff.c
trunk/blender/source/blender/imbuf/intern/imbuf_patch.h
trunk/blender/source/blender/imbuf/intern/imginfo.c
trunk/blender/source/blender/imbuf/intern/matrix.h
Modified: trunk/blender/source/blender/blenkernel/BKE_image.h
===================================================================
--- trunk/blender/source/blender/blenkernel/BKE_image.h 2010-05-07 15:08:45 UTC (rev 28650)
+++ trunk/blender/source/blender/blenkernel/BKE_image.h 2010-05-07 15:18:04 UTC (rev 28651)
@@ -55,7 +55,6 @@
struct anim *openanim(char * name, int flags);
-void converttopremul(struct ImBuf *ibuf);
void image_de_interlace(struct Image *ima, int odd);
void tag_image_time(struct Image *ima);
Modified: trunk/blender/source/blender/blenkernel/intern/blender.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/blender.c 2010-05-07 15:08:45 UTC (rev 28650)
+++ trunk/blender/source/blender/blenkernel/intern/blender.c 2010-05-07 15:18:04 UTC (rev 28651)
@@ -100,7 +100,7 @@
BKE_spacetypes_free(); /* after free main, it uses space callbacks */
- IMB_freeImBufdata(); /* imbuf lib */
+ IMB_exit();
free_nodesystem();
}
Modified: trunk/blender/source/blender/blenkernel/intern/bmfont.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/bmfont.c 2010-05-07 15:08:45 UTC (rev 28650)
+++ trunk/blender/source/blender/blenkernel/intern/bmfont.c 2010-05-07 15:18:04 UTC (rev 28651)
@@ -174,7 +174,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: trunk/blender/source/blender/blenkernel/intern/image.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/image.c 2010-05-07 15:08:45 UTC (rev 28650)
+++ trunk/blender/source/blender/blenkernel/intern/image.c 2010-05-07 15:18:04 UTC (rev 28651)
@@ -92,58 +92,6 @@
/* ******** IMAGE PROCESSING ************* */
-/* used by sequencer and image premul option - IMA_DO_PREMUL */
-void converttopremul(struct ImBuf *ibuf)
-{
- int x, y;
-
- if(ibuf==0) return;
- if (ibuf->rect) {
- int val;
- char *cp;
- if(ibuf->depth==24) { /* put alpha at 255 */
- cp= (char *)(ibuf->rect);
- for(y=0; y<ibuf->y; y++) {
- for(x=0; x<ibuf->x; x++, cp+=4) {
- cp[3]= 255;
- }
- }
- } else {
- cp= (char *)(ibuf->rect);
- for(y=0; y<ibuf->y; y++) {
- for(x=0; x<ibuf->x; x++, cp+=4) {
- val= cp[3];
- cp[0]= (cp[0]*val)>>8;
- cp[1]= (cp[1]*val)>>8;
- cp[2]= (cp[2]*val)>>8;
- }
- }
- }
- }
- if (ibuf->rect_float) {
- float val;
- float *cp;
- if(ibuf->depth==24) { /* put alpha at 1.0 */
- cp= ibuf->rect_float;;
- for(y=0; y<ibuf->y; y++) {
- for(x=0; x<ibuf->x; x++, cp+=4) {
- cp[3]= 1.0;
- }
- }
- } else {
- cp= ibuf->rect_float;
- for(y=0; y<ibuf->y; y++) {
- for(x=0; x<ibuf->x; x++, cp+=4) {
- val= cp[3];
- cp[0]= cp[0]*val;
- cp[1]= cp[1]*val;
- cp[2]= cp[2]*val;
- }
- }
- }
- }
-}
-
static void de_interlace_ng(struct ImBuf *ibuf) /* neogeo fields */
{
struct ImBuf * tbuf1, * tbuf2;
@@ -735,8 +683,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 +719,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 +731,6 @@
int BKE_imtype_is_movie(int imtype)
{
switch(imtype) {
- case R_MOVIE:
case R_AVIRAW:
case R_AVIJPEG:
case R_AVICODEC:
@@ -864,7 +807,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";
}
@@ -1211,15 +1154,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)
@@ -1273,9 +1216,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;
@@ -1299,7 +1239,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 */
@@ -1595,6 +1535,7 @@
struct ImBuf *ibuf;
unsigned short numlen;
char name[FILE_MAX], head[FILE_MAX], tail[FILE_MAX];
+ int flag;
/* XXX temp stuff? */
if(ima->lastframe != frame)
@@ -1611,8 +1552,12 @@
else
BLI_path_abs(name, G.sce);
+ flag= IB_rect|IB_multilayer;
+ if(ima->flag & IMA_DO_PREMUL)
+ flag |= IB_premul;
+
/* read ibuf */
- ibuf = IMB_loadiffname(name, IB_rect|IB_multilayer);
+ ibuf = IMB_loadiffname(name, flag);
if(G.f & G_DEBUG) printf("loaded %s\n", name);
if (ibuf) {
@@ -1632,10 +1577,6 @@
image_initialize_after_load(ima, ibuf);
image_assign_ibuf(ima, ibuf, 0, frame);
#endif
-
- if(ima->flag & IMA_DO_PREMUL)
- converttopremul(ibuf);
-
}
else
ima->ok= 0;
@@ -1718,7 +1659,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)
@@ -1749,21 +1690,25 @@
return ibuf;
}
-/* cfra used for # code, Image can only have this # for all its users */
+/* cfra used for # code, Image can only have this # for all its users
+ * warning, 'iuser' can be NULL */
static ImBuf *image_load_image_file(Image *ima, ImageUser *iuser, int cfra)
{
struct ImBuf *ibuf;
char str[FILE_MAX];
- int assign = 0;
+ int assign = 0, flag;
/* always ensure clean ima */
image_free_buffers(ima);
/* is there a PackedFile with this image ? */
if (ima->packedfile) {
- ibuf = IMB_ibImageFromMemory((int *) ima->packedfile->data, ima->packedfile->size, IB_rect|IB_multilayer);
+ ibuf = IMB_ibImageFromMemory((unsigned char*)ima->packedfile->data, ima->packedfile->size, IB_rect|IB_multilayer);
}
else {
+ flag= IB_rect|IB_multilayer|IB_metadata;
+ if(ima->flag & IMA_DO_PREMUL)
+ flag |= IB_premul;
/* get the right string */
BLI_strncpy(str, ima->name, sizeof(str));
@@ -1775,7 +1720,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) {
@@ -1797,9 +1742,6 @@
if ((ima->packedfile == NULL) && (G.fileflags & G_AUTOPACK))
ima->packedfile = newPackedFile(NULL, str);
}
-
- if(ima->flag & IMA_DO_PREMUL)
- converttopremul(ibuf);
}
else
ima->ok= 0;
Modified: trunk/blender/source/blender/blenkernel/intern/multires.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/multires.c 2010-05-07 15:08:45 UTC (rev 28650)
+++ trunk/blender/source/blender/blenkernel/intern/multires.c 2010-05-07 15:18:04 UTC (rev 28651)
@@ -264,39 +264,7 @@
return result;
}
-static void multires_set_tot_mdisps(Mesh *me, int lvl)
-{
- MDisps *mdisps= CustomData_get_layer(&me->fdata, CD_MDISPS);
- int i;
- if(mdisps) {
- for(i = 0; i < me->totface; i++) {
- if(mdisps[i].totdisp == 0) {
- int nvert = (me->mface[i].v4)? 4: 3;
- mdisps[i].totdisp = multires_grid_tot[lvl]*nvert;
- }
- }
- }
-}
-
-static void multires_reallocate_mdisps(Mesh *me, MDisps *mdisps, int lvl)
-{
- int i;
-
- /* reallocate displacements to be filled in */
- for(i = 0; i < me->totface; ++i) {
- int nvert = (me->mface[i].v4)? 4: 3;
- int totdisp = multires_grid_tot[lvl]*nvert;
- float (*disps)[3] = MEM_callocN(sizeof(float) * 3 * totdisp, "multires disps");
-
- if(mdisps[i].disps)
- MEM_freeN(mdisps[i].disps);
-
- mdisps[i].disps = disps;
- mdisps[i].totdisp = totdisp;
- }
-}
-
static void column_vectors_to_mat3(float mat[][3], float v1[3], float v2[3], float v3[3])
{
copy_v3_v3(mat[0], v1);
@@ -352,7 +320,6 @@
int levels = mmd->totlvl - lvl;
MDisps *mdisps;
- multires_set_tot_mdisps(me, mmd->totlvl);
CustomData_external_read(&me->fdata, &me->id, CD_MASK_MDISPS, me->totface);
mdisps= CustomData_get_layer(&me->fdata, CD_MDISPS);
@@ -426,6 +393,24 @@
return subsurf_make_derived_from_derived(dm, &smd, 0, NULL, 0, 0);
}
+static void multires_reallocate_mdisps(Mesh *me, MDisps *mdisps, int lvl)
+{
+ int i;
+
+ /* reallocate displacements to be filled in */
+ for(i = 0; i < me->totface; ++i) {
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list