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:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2010-05-07 19:18:04 +0400
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2010-05-07 19:18:04 +0400
commit008863daec1249d1f17bc69e1105e336db690d63 (patch)
tree78a4001857b26a287125a3f5fa31496052f6ebdd /source/blender/blenpluginapi
parent1613829e8e821321da99cad4790b7e6a1d90cea8 (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/blenpluginapi')
-rw-r--r--source/blender/blenpluginapi/iff.h153
-rw-r--r--source/blender/blenpluginapi/intern/pluginapi.c65
2 files changed, 27 insertions, 191 deletions
diff --git a/source/blender/blenpluginapi/iff.h b/source/blender/blenpluginapi/iff.h
index 9378cdc9134..b8628b00575 100644
--- a/source/blender/blenpluginapi/iff.h
+++ b/source/blender/blenpluginapi/iff.h
@@ -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)
-
-#define IB_fields (1 << 11)
-#define IB_yuv (1 << 12)
-#define IB_zbuf (1 << 13)
-#define IB_rgba (1 << 14)
-
-#define JP2 (1 << 18)
-
-#define AMI (1 << 31)
-#define PNG (1 << 30)
-#define Anim (1 << 29)
-#define TGA (1 << 28)
-#define JPG (1 << 27)
-#define BMP (1 << 26)
-#ifdef WITH_QUICKTIME
-#define QUICKTIME (1 << 25)
-#endif
-#define RADHDR (1<<24)
-
-#define RAWTGA (TGA | 1)
-
-#define JPG_STD (JPG | (0 << 8))
-#define JPG_VID (JPG | (1 << 8))
-#define JPG_JST (JPG | (2 << 8))
-#define JPG_MAX (JPG | (3 << 8))
-#define JPG_MSK (0xffffff00)
-
-#define AM_ham (0x0800 | AMI)
-#define AM_hbrite (0x0080 | AMI)
-#define AM_lace (0x0004 | AMI)
-#define AM_hires (0x8000 | AMI)
-#define AM_hblace (AM_hbrite | AM_lace)
-#define AM_hilace (AM_hires | AM_lace)
-#define AM_hamlace (AM_ham | AM_lace)
-
-#define RGB888 1
-#define RGB555 2
-#define DYUV 3
-#define CLUT8 4
-#define CLUT7 5
-#define CLUT4 6
-#define CLUT3 7
-#define RL7 8
-#define RL3 9
-#define MPLTE 10
-
-#define DYUV1 0
-#define C233 1
-#define YUVX 2
-#define HAMX 3
-#define TANX 4
-
-#define AN_c233 (Anim | C233)
-#define AN_yuvx (Anim | YUVX)
-#define AN_hamx (Anim | HAMX)
-#define AN_tanx (Anim | TANX)
-
-#define IS_amiga(x) (x->ftype & AMI)
-#define IS_ham(x) ((x->ftype & AM_ham) == AM_ham)
-#define IS_hbrite(x) ((x->ftype & AM_hbrite) == AM_hbrite)
-
-#define IS_lace(x) ((x->ftype & AM_lace) == AM_lace)
-#define IS_hires(x) ((x->ftype & AM_hires) == AM_hires)
-#define IS_hblace(x) ((x->ftype & AM_hblace) == AM_hblace)
-#define IS_hilace(x) ((x->ftype & AM_hilace) == AM_hilace)
-#define IS_hamlace(x) ((x->ftype & AM_hamlace) == AM_hamlace)
-
-#define IS_anim(x) (x->ftype & Anim)
-#define IS_hamx(x) (x->ftype == AN_hamx)
-#define IS_tga(x) (x->ftype & TGA)
-#define IS_png(x) (x->ftype & PNG)
-#define IS_bmp(x) (x->ftype & BMP)
-#define IS_radhdr(x) (x->ftype & RADHDR)
-#define IS_tim(x) (x->ftype & TIM)
-#define IS_tiff(x) (x->ftype & TIFF)
-#define IS_openexr(x) (x->ftype & OPENEXR)
-#define IS_jp2(x) (x->ftype & JP2)
-
-
-#define IMAGIC 0732
-#define IS_iris(x) (x->ftype == IMAGIC)
-
-#define IS_jpg(x) (x->ftype & JPG)
-#define IS_stdjpg(x) ((x->ftype & JPG_MSK) == JPG_STD)
-#define IS_vidjpg(x) ((x->ftype & JPG_MSK) == JPG_VID)
-#define IS_jstjpg(x) ((x->ftype & JPG_MSK) == JPG_JST)
-#define IS_maxjpg(x) ((x->ftype & JPG_MSK) == JPG_MAX)
-
-#define AN_INIT an_stringdec = stringdec; an_stringenc = stringenc;
-
-#define IB_MIPMAP_LEVELS 10
-
-struct MEM_CacheLimiterHandle_s;
+struct ImMetaData;
+
+#define IB_MIPMAP_LEVELS 20
+#define IB_FILENAME_SIZE 1023
typedef struct ImBuf {
struct ImBuf *next, *prev; /**< allow lists of ImBufs, for caches or flipbooks */
short x, y; /**< width and Height of our image buffer */
- short skipx; /**< Width in ints to get to the next scanline */
unsigned char depth; /**< Active amount of bits/bitplanes */
- unsigned char cbits; /**< Amount of active bits in cmap */
- unsigned short mincol; /**< smallest color in colormap */
- unsigned short maxcol; /**< Largest color in colormap */
- int type; /**< 0=abgr, 1=bitplanes */
- int ftype; /**< File type we are going to save as */
- unsigned int *cmap; /**< Color map data. */
unsigned int *rect; /**< pixel values stored here */
- unsigned int **planes; /**< bitplanes */
+ unsigned int *crect; /**< color corrected pixel values stored here */
int flags; /**< Controls which components should exist. */
int mall; /**< what is malloced internal, and can be freed */
- short xorig, yorig; /**< Cordinates of first pixel of an image used in some formats (example: targa) */
- char name[1023]; /**< The file name assocated with this image */
- char namenull; /**< Unused don't want to remove it thought messes things up */
- int userflags; /**< Used to set imbuf to Dirty and other stuff */
int *zbuf; /**< z buffer data, original zbuffer */
float *zbuf_float; /**< z buffer data, camera coordinates */
void *userdata; /**< temporary storage, only used by baking at the moment */
@@ -159,34 +55,43 @@ typedef struct ImBuf {
unsigned int encodedsize; /**< Size of data written to encodedbuffer */
unsigned int encodedbuffersize; /**< Size of encodedbuffer */
- float *rect_float; /**< floating point Rect equivilant */
+ float *rect_float; /**< floating point Rect equivalent
+ Linear RGB color space - may need gamma correction to
+ sRGB when generating 8bit representations */
int channels; /**< amount of channels in rect_float (0 = 4 channel default) */
float dither; /**< random dither value, for conversion from float -> byte rect */
-
- struct MEM_CacheLimiterHandle_s * c_handle; /**< handle for cache limiter */
- struct ImgInfo * img_info;
- int refcounter; /**< Refcounter for multiple users */
- int index; /**< reference index for ImBuf lists */
-
+ short profile; /** color space/profile preset that the byte rect buffer represents */
+ char profile_filename[256]; /** to be implemented properly, specific filename for custom profiles */
+
+ /* mipmapping */
struct ImBuf *mipmap[IB_MIPMAP_LEVELS]; /**< MipMap levels, a series of halved images */
+ int miplevels;
+
+ /* externally used flags */
+ int index; /* reference index for ImBuf lists */
+ int userflags; /* used to set imbuf to dirty and other stuff */
+ struct ImMetaData *metadata;
+
+ /* file information */
+ int ftype; /* file type we are going to save as */
+ char name[IB_FILENAME_SIZE]; /* filename associated with this image */
+
+ /* memory cache limiter */
+ struct MEM_CacheLimiterHandle_s *c_handle; /* handle for cache limiter */
+ int refcounter; /* reference counter for multiple users */
} ImBuf;
LIBIMPORT struct ImBuf *allocImBuf(short,short,uchar,uint,uchar);
LIBIMPORT struct ImBuf *dupImBuf(struct ImBuf *);
LIBIMPORT void freeImBuf(struct ImBuf*);
-LIBIMPORT short converttocmap(struct ImBuf* ibuf);
-
LIBIMPORT short saveiff(struct ImBuf *,char *,int);
-LIBIMPORT struct ImBuf *loadiffmem(int *,int);
LIBIMPORT struct ImBuf *loadifffile(int,int);
LIBIMPORT struct ImBuf *loadiffname(char *,int);
LIBIMPORT struct ImBuf *testiffname(char *,int);
LIBIMPORT struct ImBuf *onehalf(struct ImBuf *);
-LIBIMPORT struct ImBuf *onethird(struct ImBuf *);
-LIBIMPORT struct ImBuf *halflace(struct ImBuf *);
LIBIMPORT struct ImBuf *half_x(struct ImBuf *);
LIBIMPORT struct ImBuf *half_y(struct ImBuf *);
LIBIMPORT struct ImBuf *double_x(struct ImBuf *);
@@ -196,17 +101,11 @@ LIBIMPORT struct ImBuf *double_fast_y(struct ImBuf *);
LIBIMPORT int ispic(char *);
-LIBIMPORT void dit2(struct ImBuf *, short, short);
-LIBIMPORT void dit0(struct ImBuf *, short, short);
-
LIBIMPORT struct ImBuf *scaleImBuf(struct ImBuf *, short, short);
LIBIMPORT struct ImBuf *scalefastImBuf(struct ImBuf *, short, short);
-LIBIMPORT struct ImBuf *scalefieldImBuf(struct ImBuf *, short, short);
-LIBIMPORT struct ImBuf *scalefastfieldImBuf(struct ImBuf *, short, short);
LIBIMPORT void de_interlace(struct ImBuf *ib);
LIBIMPORT void interlace(struct ImBuf *ib);
-LIBIMPORT void gamwarp(struct ImBuf *ibuf, double gamma);
LIBIMPORT void IMB_rectcpy(struct ImBuf *dbuf, struct ImBuf *sbuf,
int destx, int desty, int srcx, int srcy, int width, int height);
diff --git a/source/blender/blenpluginapi/intern/pluginapi.c b/source/blender/blenpluginapi/intern/pluginapi.c
index 28bc06eaea0..9e739f7927d 100644
--- a/source/blender/blenpluginapi/intern/pluginapi.c
+++ b/source/blender/blenpluginapi/intern/pluginapi.c
@@ -118,11 +118,6 @@ LIBEXPORT void freeImBuf(struct ImBuf* ib)
IMB_freeImBuf(ib);
}
-LIBEXPORT short converttocmap(struct ImBuf* ibuf)
-{
- return IMB_converttocmap(ibuf);
-}
-
LIBEXPORT short saveiff(struct ImBuf *ib,
char *c,
int i)
@@ -130,11 +125,6 @@ LIBEXPORT short saveiff(struct ImBuf *ib,
return IMB_saveiff(ib, c, i);
}
-LIBEXPORT struct ImBuf *loadiffmem(int *mem,int flags)
-{
- return IMB_loadiffmem(mem, flags);
-}
-
LIBEXPORT struct ImBuf *loadifffile(int a,
int b)
{
@@ -158,16 +148,6 @@ LIBEXPORT struct ImBuf *onehalf(struct ImBuf *ib)
return IMB_onehalf(ib);
}
-LIBEXPORT struct ImBuf *onethird(struct ImBuf *ib)
-{
- return IMB_onethird(ib);
-}
-
-LIBEXPORT struct ImBuf *halflace(struct ImBuf *ib)
-{
- return IMB_halflace(ib);
-}
-
LIBEXPORT struct ImBuf *half_x(struct ImBuf *ib)
{
return IMB_half_x(ib);
@@ -203,20 +183,6 @@ LIBEXPORT int ispic(char * name)
return IMB_ispic(name);
}
-LIBEXPORT void dit2(struct ImBuf *ib,
- short a,
- short b)
-{
- IMB_dit2(ib, a, b);
-}
-
-LIBEXPORT void dit0(struct ImBuf *ib,
- short a,
- short b)
-{
- IMB_dit0(ib, a, b);
-}
-
/* still the same name */
/* void (*ditherfunc)(struct ImBuf *, short, short){} */
@@ -234,21 +200,6 @@ LIBEXPORT struct ImBuf *scalefastImBuf(struct ImBuf *ib,
return IMB_scalefastImBuf(ib, x, y);
}
-
-LIBEXPORT struct ImBuf *scalefieldImBuf(struct ImBuf *ib,
- short x,
- short y)
-{
- return IMB_scalefieldImBuf(ib, x, y);
-}
-
-LIBEXPORT struct ImBuf *scalefastfieldImBuf(struct ImBuf *ib,
- short x,
- short y)
-{
- return IMB_scalefastfieldImBuf(ib, x, y);
-}
-
/* Extra ones that some NaN (read Ton) plugins use,
* even though they aren't in the header
*/
@@ -258,11 +209,6 @@ LIBEXPORT void interlace(struct ImBuf *ibuf)
IMB_interlace(ibuf);
}
-LIBEXPORT void gamwarp(struct ImBuf *ibuf, double gamma)
-{
- IMB_gamwarp(ibuf,gamma);
-}
-
LIBEXPORT void de_interlace(struct ImBuf *ib)
{
IMB_de_interlace(ib);
@@ -334,15 +280,11 @@ int pluginapi_force_ref(void)
GET_INT_FROM_POINTER( allocImBuf ) +
GET_INT_FROM_POINTER( dupImBuf ) +
GET_INT_FROM_POINTER( freeImBuf ) +
- GET_INT_FROM_POINTER( converttocmap ) +
GET_INT_FROM_POINTER( saveiff ) +
- GET_INT_FROM_POINTER( loadiffmem ) +
GET_INT_FROM_POINTER( loadifffile ) +
GET_INT_FROM_POINTER( loadiffname ) +
GET_INT_FROM_POINTER( testiffname ) +
GET_INT_FROM_POINTER( onehalf ) +
- GET_INT_FROM_POINTER( onethird ) +
- GET_INT_FROM_POINTER( halflace ) +
GET_INT_FROM_POINTER( half_x ) +
GET_INT_FROM_POINTER( half_y ) +
GET_INT_FROM_POINTER( double_x ) +
@@ -350,17 +292,12 @@ int pluginapi_force_ref(void)
GET_INT_FROM_POINTER( double_fast_x ) +
GET_INT_FROM_POINTER( double_fast_y ) +
GET_INT_FROM_POINTER( ispic ) +
- GET_INT_FROM_POINTER( dit2 ) +
- GET_INT_FROM_POINTER( dit0 ) +
GET_INT_FROM_POINTER( scaleImBuf ) +
GET_INT_FROM_POINTER( scalefastImBuf ) +
- GET_INT_FROM_POINTER( scalefieldImBuf ) +
- GET_INT_FROM_POINTER( scalefastfieldImBuf ) +
GET_INT_FROM_POINTER( hnoise ) +
GET_INT_FROM_POINTER( hnoisep ) +
GET_INT_FROM_POINTER( turbulence ) +
GET_INT_FROM_POINTER( turbulence1 ) +
GET_INT_FROM_POINTER( de_interlace ) +
- GET_INT_FROM_POINTER( interlace ) +
- GET_INT_FROM_POINTER( gamwarp );
+ GET_INT_FROM_POINTER( interlace );
}