Index: intern/SoundSystem/openal/SND_OpenALDevice.cpp =================================================================== --- intern/SoundSystem/openal/SND_OpenALDevice.cpp (revision 20609) +++ intern/SoundSystem/openal/SND_OpenALDevice.cpp (working copy) @@ -40,7 +40,7 @@ #include "SND_Utils.h" -#ifdef APPLE_FRAMEWORK_FIX +#if 1 //def APPLE_FRAMEWORK_FIX #include #include #include Index: source/blender/render/intern/source/texture.c =================================================================== --- source/blender/render/intern/source/texture.c (revision 20609) +++ source/blender/render/intern/source/texture.c (working copy) @@ -48,6 +48,7 @@ #include "IMB_imbuf_types.h" #include "IMB_imbuf.h" +#include "BKE_colortools.h" #include "BKE_image.h" #include "BKE_node.h" #include "BKE_plugin_types.h" @@ -1808,6 +1809,11 @@ } else texres.tin= texres.ta; + /* inverse gamma correction */ + tcol[0] = srgb_to_linearrgb(tcol[0]); + tcol[1] = srgb_to_linearrgb(tcol[1]); + tcol[2] = srgb_to_linearrgb(tcol[2]); + if(mtex->mapto & MAP_COL) { texture_rgb_blend(&shi->r, tcol, &shi->r, texres.tin, colfac, mtex->blendtype); } Index: source/blender/blenkernel/intern/colortools.c =================================================================== --- source/blender/blenkernel/intern/colortools.c (revision 20609) +++ source/blender/blenkernel/intern/colortools.c (working copy) @@ -58,6 +58,48 @@ #include "IMB_imbuf.h" #include "IMB_imbuf_types.h" +/* ********************************* color transforms ********************************* */ + +/*Transform linear RGB values to nonlinear RGB values. Rec. + 709 is ITU-R Recommendation BT. 709 (1990) ``Basic + Parameter Values for the HDTV Standard for the Studio and + for International Programme Exchange'', formerly CCIR Rec. + 709.*/ +void gamma_correct_rec709(float *c, float gamma) +{ + /* Rec. 709 gamma correction. */ + float cc = 0.018f; + + if (*c < cc) + *c *= ((1.099f * (float)pow(cc, gamma)) - 0.099f) / cc; + else + *c = (1.099f * (float)pow(*c, gamma)) - 0.099f; +} + +void gamma_correct(float *c, float gamma) +{ + *c = pow((*c), gamma); +} + +float srgb_to_linearrgb(float c) +{ + if (c < 0.04045f) + return (c < 0.f)?0.f:c / 12.92; + else + return pow((c + 0.055)/1.055, 2.4); +} + +float linearrgb_to_srgb(float c) +{ + if (c < 0.0031308) + return (c < 0.f)?0.f:c * 12.92; + else + return 1.055 * pow(c, 1.0/2.4) - 0.055; +} + + + + /* ********************************* color curve ********************* */ /* ***************** operations on full struct ************* */ Index: source/blender/blenkernel/BKE_colortools.h =================================================================== --- source/blender/blenkernel/BKE_colortools.h (revision 20609) +++ source/blender/blenkernel/BKE_colortools.h (working copy) @@ -33,6 +33,11 @@ struct CurveMap; struct ImBuf; struct rctf; + +void gamma_correct_rec709(float *c, float gamma); +void gamma_correct(float *c, float gamma); +float srgb_to_linearrgb(float c); +float linearrgb_to_srgb(float c); struct CurveMapping *curvemapping_add(int tot, float minx, float miny, float maxx, float maxy); void curvemapping_free(struct CurveMapping *cumap); @@ -60,5 +65,6 @@ void curvemapping_table_RGBA(struct CurveMapping *cumap, float **array, int *size); void colorcorrection_do_ibuf(struct ImBuf *ibuf, const char *profile); + #endif Index: source/blender/makesdna/DNA_space_types.h =================================================================== --- source/blender/makesdna/DNA_space_types.h (revision 20609) +++ source/blender/makesdna/DNA_space_types.h (working copy) @@ -572,7 +572,7 @@ #define SI_DEPRECATED1 1<<4 /* stick UVs to others in the same location */ #define SI_DRAWSHADOW 1<<5 #define SI_SELACTFACE 1<<6 /* deprecated */ -#define SI_DEPRECATED2 1<<7 +#define SI_DRAW_CORRECTED 1<<7 /* image editor uses color profiles to show corrected display */ #define SI_DEPRECATED3 1<<8 /* stick UV selection to mesh vertex (UVs wont always be touching) */ #define SI_COORDFLOATS 1<<9 #define SI_PIXELSNAP 1<<10 Index: source/blender/makesdna/DNA_scene_types.h =================================================================== --- source/blender/makesdna/DNA_scene_types.h (revision 20609) +++ source/blender/makesdna/DNA_scene_types.h (working copy) @@ -269,8 +269,11 @@ * Value used to define filter size for all filter options */ float gauss; + /* for linear workflow - gamma corrected textures and render */ + float gamma; + /** post-production settings. Depricated, but here for upwards compat (initialized to 1) */ - float postmul, postgamma, posthue, postsat; + float postgamma, posthue, postsat; /* Dither noise intensity */ float dither_intensity; Index: source/blender/makesrna/intern/rna_space.c =================================================================== --- source/blender/makesrna/intern/rna_space.c (revision 20609) +++ source/blender/makesrna/intern/rna_space.c (working copy) @@ -580,6 +580,10 @@ RNA_def_property_boolean_sdna(prop, NULL, "lock", 0); RNA_def_property_ui_text(prop, "Update Automatically", "Update other affected window spaces automatically to reflect changes during interactive operations such as transform."); + prop= RNA_def_property(srna, "display_corrected", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", SI_DRAW_CORRECTED); + RNA_def_property_ui_text(prop, "Display Corrected", "Use colour profiles to display images color/gamma corrected"); + rna_def_space_image_uv(brna); } Index: source/blender/makesrna/intern/rna_scene.c =================================================================== --- source/blender/makesrna/intern/rna_scene.c (revision 20609) +++ source/blender/makesrna/intern/rna_scene.c (working copy) @@ -412,6 +412,12 @@ RNA_def_property_ui_text(prop, "Render Textures", "Use textures to affect material properties."); RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); + prop= RNA_def_property(srna, "gamma", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "gamma"); + RNA_def_property_range(prop, 0.01f, 10.0f); + RNA_def_property_ui_text(prop, "Gamma", "Gamma value for correcting textures and render"); + RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS|NC_WINDOW, NULL); + prop= RNA_def_property(srna, "edge", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "mode", R_EDGE); RNA_def_property_ui_text(prop, "Edge", "Create a toon outline around the edges of geometry"); Index: source/blender/imbuf/intern/divers.c =================================================================== --- source/blender/imbuf/intern/divers.c (revision 20609) +++ source/blender/imbuf/intern/divers.c (working copy) @@ -39,6 +39,7 @@ #include "IMB_allocimbuf.h" #include "IMB_divers.h" #include "BKE_utildefines.h" +#include "BKE_colortools.h" void imb_checkncols(struct ImBuf *ibuf) { @@ -176,9 +177,10 @@ void IMB_rect_from_float(struct ImBuf *ibuf) { /* quick method to convert floatbuf to byte */ - float *tof = ibuf->rect_float; + float *tof = (float *)ibuf->rect_float; float dither= ibuf->dither; int i, channels= ibuf->channels; + short profile= ibuf->profile; unsigned char *to = (unsigned char *) ibuf->rect; if(tof==NULL) return; @@ -187,7 +189,25 @@ to = (unsigned char *) ibuf->rect; } - if(dither==0.0f || channels!=4) { + if (profile == IB_PROFILE_SRGB && (channels == 3 || channels == 4)) { + if(channels == 3) { + for (i = ibuf->x * ibuf->y; i > 0; i--, to+=4, tof+=3) { + to[0] = FTOCHAR(linearrgb_to_srgb(tof[0])); + to[1] = FTOCHAR(linearrgb_to_srgb(tof[1])); + to[2] = FTOCHAR(linearrgb_to_srgb(tof[2])); + to[3] = 255; + } + } + else if (channels == 4) { + for (i = ibuf->x * ibuf->y; i > 0; i--, to+=4, tof+=4) { + to[0] = FTOCHAR(linearrgb_to_srgb(tof[0])); + to[1] = FTOCHAR(linearrgb_to_srgb(tof[1])); + to[2] = FTOCHAR(linearrgb_to_srgb(tof[2])); + to[3] = FTOCHAR(tof[3]); + } + } + } + else if(ELEM(profile, IB_PROFILE_NONE, IB_PROFILE_LINEAR_RGB) && (dither==0.0f || channels!=4)) { if(channels==1) { for (i = ibuf->x * ibuf->y; i > 0; i--, to+=4, tof++) to[1]= to[2]= to[3]= to[0] = FTOCHAR(tof[0]); Index: source/blender/imbuf/IMB_imbuf_types.h =================================================================== --- source/blender/imbuf/IMB_imbuf_types.h (revision 20609) +++ source/blender/imbuf/IMB_imbuf_types.h (working copy) @@ -98,9 +98,13 @@ unsigned int encodedsize; /**< Size of data written to encodedbuffer */ unsigned int encodedbuffersize; /**< Size of encodedbuffer */ - float *rect_float; /**< floating point Rect equivalent */ + float *rect_float; /**< floating point Rect equivalent + Linear RGB colour 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 */ + short profile; /** colour space/profile preset that the byte rect buffer represents */ + char profile_filename[256]; /** to be implemented properly, specific filename for custom profiles */ struct MEM_CacheLimiterHandle_s * c_handle; /**< handle for cache limiter */ struct ImgInfo * img_info; @@ -213,6 +217,18 @@ #define AN_tanx (Anim | TANX) /**@}*/ +/** + * \name Imbuf preset profile tags + * \brief Some predefined color space profiles that 8 bit imbufs can represent + */ +/**@{*/ +#define IB_PROFILE_NONE 0 +#define IB_PROFILE_LINEAR_RGB 1 +#define IB_PROFILE_SRGB 2 +#define IB_PROFILE_CUSTOM 3 +/**@}*/ + + /** \name Imbuf File Type Tests * \brief These macros test if an ImBuf struct is the corresponding file type. */ Index: source/blender/blenloader/intern/readfile.c =================================================================== --- source/blender/blenloader/intern/readfile.c (revision 20609) +++ source/blender/blenloader/intern/readfile.c (working copy) @@ -8866,10 +8866,21 @@ Mesh *me; Scene *sce; Tex *tx; + SpaceLink *sl; + ScrArea *sa; for(screen= main->screen.first; screen; screen= screen->id.next) { do_versions_windowmanager_2_50(screen); do_versions_gpencil_2_50(main, screen); + + for(sa= screen->areabase.first; sa; sa= sa->next) { + for(sl= sa->spacedata.first; sl; sl= sl->next) { + if(sl->spacetype==SPACE_IMAGE) { + SpaceImage *si = (SpaceImage *)sl; + si->flag |= SI_DRAW_CORRECTED; + } + } + } } /* old Animation System (using IPO's) needs to be converted to the new Animato system Index: source/blender/blenlib/BLI_arithb.h =================================================================== --- source/blender/blenlib/BLI_arithb.h (revision 20609) +++ source/blender/blenlib/BLI_arithb.h (working copy) @@ -339,7 +339,6 @@ void rgb_to_hsv(float r, float g, float b, float *lh, float *ls, float *lv); void xyz_to_rgb(float x, float y, float z, float *r, float *g, float *b, int colorspace); int constrain_rgb(float *r, float *g, float *b); -void gamma_correct_rgb(float *r, float *g, float *b); unsigned int hsv_to_cpack(float h, float s, float v); unsigned int rgb_to_cpack(float r, float g, float b); void cpack_to_rgb(unsigned int col, float *r, float *g, float *b); Index: source/blender/blenlib/intern/arithb.c =================================================================== --- source/blender/blenlib/intern/arithb.c (revision 20609) +++ source/blender/blenlib/intern/arithb.c (working copy) @@ -3548,30 +3548,7 @@ return 0; /* Colour within RGB gamut */ } -/*Transform linear RGB values to nonlinear RGB values. Rec. - 709 is ITU-R Recommendation BT. 709 (1990) ``Basic - Parameter Values for the HDTV Standard for the Studio and - for International Programme Exchange'', formerly CCIR Rec. - 709.*/ -static void gamma_correct(float *c) -{ - /* Rec. 709 gamma correction. */ - float cc = 0.018f; - - if (*c < cc) - *c *= ((1.099f * (float)pow(cc, 0.45)) - 0.099f) / cc; - else - *c = (1.099f * (float)pow(*c, 0.45)) - 0.099f; -} -void gamma_correct_rgb(float *r, float *g, float *b) -{ - gamma_correct(r); - gamma_correct(g); - gamma_correct(b); -} - - /* we define a 'cpack' here as a (3 byte color code) number that can be expressed like 0xFFAA66 or so. for that reason it is sensitive for endianness... with this function it works correctly */ Index: source/blender/editors/screen/screen_ops.c =================================================================== --- source/blender/editors/screen/screen_ops.c (revision 20609) +++ source/blender/editors/screen/screen_ops.c (working copy) @@ -40,6 +40,7 @@ #include "DNA_scene_types.h" #include "BKE_blender.h" +#include "BKE_colortools.h" #include "BKE_context.h" #include "BKE_customdata.h" #include "BKE_global.h" @@ -2421,9 +2422,9 @@ /* XXX temp. because crop offset */ if( rectc >= (char *)(ibuf->rect)) { for(x1= 0; x1rect is zero for compositor and render results after change @@ -121,6 +121,10 @@ curvemapping_do_ibuf(sima->cumap, ibuf); } else { + if (sima->flag & SI_DRAW_CORRECTED) { + if (ima && ima->source == IMA_SRC_VIEWER) + ibuf->profile = IB_PROFILE_SRGB; + } IMB_rect_from_float(ibuf); } } @@ -370,7 +374,7 @@ MEM_freeN(rectf); } -static void draw_image_buffer(SpaceImage *sima, ARegion *ar, Scene *scene, ImBuf *ibuf, float fx, float fy, float zoomx, float zoomy) +static void draw_image_buffer(SpaceImage *sima, ARegion *ar, Scene *scene, Image *ima, ImBuf *ibuf, float fx, float fy, float zoomx, float zoomy) { int x, y; @@ -397,7 +401,7 @@ } #ifdef WITH_LCMS else if(sima->flag & SI_COLOR_CORRECTION) { - image_verify_buffer_float(sima, ibuf); + image_verify_buffer_float(sima, ima, ibuf); sima_draw_colorcorrected_pixels(x, y, ibuf); @@ -413,7 +417,7 @@ /* we don't draw floats buffers directly but * convert them, and optionally apply curves */ - image_verify_buffer_float(sima, ibuf); + image_verify_buffer_float(sima, ima, ibuf); if(ibuf->rect) glaDrawPixelsSafe(x, y, ibuf->x, ibuf->y, ibuf->x, GL_RGBA, GL_UNSIGNED_BYTE, ibuf->rect); @@ -465,7 +469,7 @@ sima->curtile = ima->xrep*ima->yrep - 1; /* create char buffer from float if needed */ - image_verify_buffer_float(sima, ibuf); + image_verify_buffer_float(sima, ima, ibuf); /* retrieve part of image buffer */ dx= ibuf->x/ima->xrep; @@ -488,7 +492,7 @@ MEM_freeN(rect); } -static void draw_image_buffer_repeated(SpaceImage *sima, ARegion *ar, Scene *scene, ImBuf *ibuf, float zoomx, float zoomy) +static void draw_image_buffer_repeated(SpaceImage *sima, ARegion *ar, Scene *scene, Image *ima, ImBuf *ibuf, float zoomx, float zoomy) { float x, y; double time_current; @@ -497,7 +501,7 @@ for(x=ar->v2d.cur.xmin; xv2d.cur.xmax; x += zoomx) { for(y=ar->v2d.cur.ymin; yv2d.cur.ymax; y += zoomy) { - draw_image_buffer(sima, ar, scene, ibuf, x, y, zoomx, zoomy); + draw_image_buffer(sima, ar, scene, ima, ibuf, x, y, zoomx, zoomy); /* only draw until running out of time */ if((PIL_check_seconds_timer() - time_current) > 0.25) @@ -667,11 +671,11 @@ if(ibuf==NULL) draw_image_grid(ar, zoomx, zoomy); else if(sima->flag & SI_DRAW_TILE) - draw_image_buffer_repeated(sima, ar, scene, ibuf, zoomx, zoomy); + draw_image_buffer_repeated(sima, ar, scene, ima, ibuf, zoomx, zoomy); else if(ima && (ima->tpageflag & IMA_TILES)) draw_image_buffer_tiled(sima, ar, ima, ibuf, zoomx, zoomy); else - draw_image_buffer(sima, ar, scene, ibuf, 0.0f, 0.0f, zoomx, zoomy); + draw_image_buffer(sima, ar, scene, ima, ibuf, 0.0f, 0.0f, zoomx, zoomy); /* grease pencil */ draw_image_grease_pencil(sima, ibuf); Index: source/blender/editors/space_image/image_header.c =================================================================== --- source/blender/editors/space_image/image_header.c (revision 20609) +++ source/blender/editors/space_image/image_header.c (working copy) @@ -150,6 +150,7 @@ uiItemS(layout); + uiItemR(layout, NULL, 0, &spaceptr, "display_corrected", 0, 0, 0); uiItemR(layout, NULL, 0, &spaceptr, "update_automatically", 0, 0, 0); // XXX if(show_uvedit) uiItemR(layout, NULL, 0, &uvptr, "local_view", 0, 0, 0); // "UV Local View", Numpad / Index: source/blender/editors/space_image/space_image.c =================================================================== --- source/blender/editors/space_image/space_image.c (revision 20609) +++ source/blender/editors/space_image/space_image.c (working copy) @@ -113,6 +113,8 @@ simage= MEM_callocN(sizeof(SpaceImage), "initimage"); simage->spacetype= SPACE_IMAGE; simage->zoom= 1; + simage->lock = 1; + simage->flag |= SI_DRAW_CORRECTED; simage->iuser.ok= 1; simage->iuser.fie_ima= 2; @@ -158,7 +160,7 @@ /* spacetype; init callback */ static void image_init(struct wmWindowManager *wm, ScrArea *sa) { - + } static SpaceLink *image_duplicate(SpaceLink *sl) Index: config/darwin-config.py =================================================================== --- config/darwin-config.py (revision 20609) +++ config/darwin-config.py (working copy) @@ -10,7 +10,7 @@ # IMPORTANT NOTE : OFFICIAL BUILDS SHOULD BE DONE WITH SDKs USE_SDK=True -BF_PYTHON_VERSION = '2.3' +BF_PYTHON_VERSION = '2.5' cmd = 'uname -p' MAC_PROC=commands.getoutput(cmd) @@ -38,7 +38,7 @@ # enable ffmpeg support -WITH_BF_FFMPEG = True # -DWITH_FFMPEG +WITH_BF_FFMPEG = False # -DWITH_FFMPEG BF_FFMPEG = "#extern/ffmpeg" BF_FFMPEG_INC = '${BF_FFMPEG}' if USE_SDK==True: @@ -55,7 +55,7 @@ if BF_PYTHON_VERSION=='2.3': BF_PYTHON = '/System/Library/Frameworks/Python.framework/Versions/' else: - BF_PYTHON = '/Library/Frameworks/Python.framework/Versions/' + BF_PYTHON = '/System/Library/Frameworks/Python.framework/Versions/' BF_PYTHON_INC = '${BF_PYTHON}${BF_PYTHON_VERSION}/include/python${BF_PYTHON_VERSION}' BF_PYTHON_BINARY = '${BF_PYTHON}${BF_PYTHON_VERSION}/bin/python${BF_PYTHON_VERSION}' @@ -100,7 +100,7 @@ BF_SDL_LIB = 'SDL' #BF_SDL #$(shell $(BF_SDL)/bin/sdl-config --libs) -lSDL_mixer BF_SDL_LIBPATH = '${BF_SDL}/lib' -WITH_BF_OPENEXR = True +WITH_BF_OPENEXR = False WITH_BF_STATICOPENEXR = False BF_OPENEXR = '${LCGDIR}/openexr' BF_OPENEXR_INC = '${BF_OPENEXR}/include ${BF_OPENEXR}/include/OpenEXR' @@ -109,7 +109,7 @@ # Warning, this static lib configuration is untested! users of this OS please confirm. BF_OPENEXR_LIB_STATIC = '${BF_OPENEXR}/lib/libHalf.a ${BF_OPENEXR}/lib/libIlmImf.a ${BF_OPENEXR}/lib/libIex.a ${BF_OPENEXR}/lib/libImath.a ${BF_OPENEXR}/lib/libIlmThread.a' -WITH_BF_DDS = True +WITH_BF_DDS = False WITH_BF_JPEG = True BF_JPEG = LIBDIR + '/jpeg' @@ -138,15 +138,15 @@ BF_GETTEXT_LIB = 'intl' BF_GETTEXT_LIBPATH = '${BF_GETTEXT}/lib' -WITH_BF_GAMEENGINE=True -WITH_BF_PLAYER=True +WITH_BF_GAMEENGINE=False +WITH_BF_PLAYER=False WITH_BF_ODE = False BF_ODE = LIBDIR + '/ode' BF_ODE_INC = '${BF_ODE}/include' BF_ODE_LIB = '${BF_ODE}/lib/libode.a' -WITH_BF_BULLET = True +WITH_BF_BULLET = False BF_BULLET = '#extern/bullet2/src' BF_BULLET_INC = '${BF_BULLET}' BF_BULLET_LIB = 'extern_bullet' @@ -155,6 +155,11 @@ BF_SOLID_INC = '${BF_SOLID}' BF_SOLID_LIB = 'extern_solid' +<<<<<<< .mine +WITH_BF_YAFRAY = False + +======= +>>>>>>> .r20578 #WITH_BF_NSPR = True #BF_NSPR = $(LIBDIR)/nspr #BF_NSPR_INC = -I$(BF_NSPR)/include -I$(BF_NSPR)/include/nspr Index: CMakeLists.txt =================================================================== --- CMakeLists.txt (revision 20609) +++ CMakeLists.txt (working copy) @@ -54,17 +54,17 @@ #----------------------------------------------------------------------------- # Set default config options OPTION(WITH_PLAYER "Build Player" OFF) -OPTION(WITH_GAMEENGINE "Enable Game Engine" ON) +OPTION(WITH_GAMEENGINE "Enable Game Engine" OFF) OPTION(WITH_BULLET "Enable Bullet (Physics Engine)" ON) OPTION(WITH_INTERNATIONAL "Enable I18N (International fonts and text)" ON) -OPTION(WITH_ELBEEM "Enable Elbeem (Fluid Simulation)" ON) -OPTION(WITH_QUICKTIME "Enable Quicktime Support" OFF) +OPTION(WITH_ELBEEM "Enable Elbeem (Fluid Simulation)" OFF) +OPTION(WITH_QUICKTIME "Enable Quicktime Support" ON) OPTION(WITH_OPENEXR "Enable OpenEXR Support (http://www.openexr.com)" ON) -OPTION(WITH_DDS "Enable DDS Support" ON) +OPTION(WITH_DDS "Enable DDS Support" OFF) OPTION(WITH_FFMPEG "Enable FFMPeg Support (http://ffmpeg.mplayerhq.hu/)" OFF) OPTION(WITH_PYTHON "Enable Embedded Python API" ON) OPTION(WITH_OPENJPEG "Enable OpenJpeg Support (http://www.openjpeg.org/)" OFF) -OPTION(WITH_OPENAL "Enable OpenAL Support (http://www.openal.org)" ON) +OPTION(WITH_OPENAL "Enable OpenAL Support (http://www.openal.org)" OFF) OPTION(WITH_OPENMP "Enable OpenMP (has to be supported by the compiler)" OFF) OPTION(WITH_WEBPLUGIN "Enable Web Plugin (Unix only)" OFF)