* otherwise we may reference missing data.
*
* Currently its only used for ID's, but nodes may one day
- * referene other pointers which need validation.
+ * reference other pointers which need validation.
*/
typedef struct bNodeClipboardExtraInfo {
struct bNodeClipboardExtraInfo *next, *prev;
register_node_type_sh_tex_gradient(ttype);
register_node_type_sh_tex_magic(ttype);
register_node_type_sh_tex_checker(ttype);
+ register_node_type_sh_tex_brick(ttype);
}
static void registerTextureNodes(bNodeTreeType *ttype)
#include "IMB_imbuf.h"
#include "IMB_imbuf_types.h"
+#include "IMB_colormanagement.h"
#include "BKE_context.h"
#include "BKE_sound.h"
float mul;
if (seq->flag & (SEQ_FILTERY | SEQ_USE_CROP | SEQ_USE_TRANSFORM | SEQ_FLIPX |
- SEQ_FLIPY | SEQ_USE_COLOR_BALANCE | SEQ_MAKE_PREMUL))
+ SEQ_FLIPY | SEQ_USE_COLOR_BALANCE | SEQ_MAKE_PREMUL | SEQ_MAKE_FLOAT))
{
return TRUE;
}
}
if (seq->flag & SEQ_MAKE_FLOAT) {
- if (!ibuf->rect_float)
- IMB_float_from_rect_simple(ibuf);
+ if (!ibuf->rect_float) {
+ IMB_colormanagement_imbuf_to_sequencer_space(ibuf, TRUE);
+ }
if (ibuf->rect) {
imb_freerectImBuf(ibuf);
}
/* float buffers in the sequencer are not linear */
- if (scene->r.color_mgt_flag & R_COLOR_MANAGEMENT)
- ibuf->profile = IB_PROFILE_LINEAR_RGB;
- else
- ibuf->profile = IB_PROFILE_NONE;
- IMB_convert_profile(ibuf, IB_PROFILE_SRGB);
+ ibuf->profile = IB_PROFILE_LINEAR_RGB;
+ IMB_colormanagement_imbuf_to_sequencer_space(ibuf, FALSE);
}
else if (rres.rect32) {
ibuf = IMB_allocImBuf(rres.rectx, rres.recty, 32, IB_rect);
imb_freerectImBuf(ibuf);
/* all sequencer color is done in SRGB space, linear gives odd crossfades */
- if (ibuf->profile == IB_PROFILE_LINEAR_RGB)
- IMB_convert_profile(ibuf, IB_PROFILE_NONE);
+ IMB_colormanagement_imbuf_to_sequencer_space(ibuf, FALSE);
copy_to_ibuf_still(context, seq, nr, ibuf);
if (count == 1) {
out = seq_render_strip(context, seq_arr[0], cfra);
+
+ if (out) {
+ /* put buffer back to linear space */
+ IMB_colormanagement_imbuf_from_sequencer_space(out);
+ }
+
BKE_sequencer_cache_put(context, seq_arr[0], cfra, SEQ_STRIPELEM_IBUF_COMP, out);
return out;
BKE_sequencer_cache_put(context, seq_arr[i], cfra, SEQ_STRIPELEM_IBUF_COMP, out);
}
+ if (out) {
+ /* put buffer back to linear space */
+ IMB_colormanagement_imbuf_from_sequencer_space(out);
+ }
+
return out;
}
sequence_invalidate_cache(scene, seq, FALSE);
}
-void BKE_sequencer_free_imbuf(Scene *scene, ListBase *seqbase, int check_mem_usage, int keep_file_handles)
+void BKE_sequencer_free_imbuf(Scene *scene, ListBase *seqbase, int for_render)
{
Sequence *seq;
- if (check_mem_usage) {
- /* Let the cache limitor take care of this (schlaile) */
- /* While render let's keep all memory available for render
- * (ton)
- * At least if free memory is tight...
- * This can make a big difference in encoding speed
- * (it is around 4 times(!) faster, if we do not waste time
- * on freeing _all_ buffers every time on long timelines...)
- * (schlaile)
- */
-
- uintptr_t mem_in_use;
- uintptr_t mmap_in_use;
- uintptr_t max;
-
- mem_in_use = MEM_get_memory_in_use();
- mmap_in_use = MEM_get_mapped_memory_in_use();
- max = MEM_CacheLimiter_get_maximum();
-
- if (max == 0 || mem_in_use + mmap_in_use <= max) {
- return;
- }
- }
-
BKE_sequencer_cache_cleanup();
-
+
for (seq = seqbase->first; seq; seq = seq->next) {
+ if (for_render && CFRA >= seq->startdisp && CFRA <= seq->enddisp) {
+ continue;
+ }
+
if (seq->strip) {
- if (seq->type == SEQ_TYPE_MOVIE && !keep_file_handles)
+ if (seq->type == SEQ_TYPE_MOVIE) {
free_anim_seq(seq);
+ }
if (seq->type == SEQ_TYPE_SPEED) {
BKE_sequence_effect_speed_rebuild_map(scene, seq, 1);
}
}
if (seq->type == SEQ_TYPE_META) {
- BKE_sequencer_free_imbuf(scene, &seq->seqbase, FALSE, keep_file_handles);
+ BKE_sequencer_free_imbuf(scene, &seq->seqbase, for_render);
}
if (seq->type == SEQ_TYPE_SCENE) {
/* FIXME: recurs downwards,
SWAP(float, seq_a->blend_opacity, seq_b->blend_opacity);
- SWAP(void *, seq_a->prev, seq_b->prev);
- SWAP(void *, seq_a->next, seq_b->next);
+ SWAP(Sequence *, seq_a->prev, seq_b->prev);
+ SWAP(Sequence *, seq_a->next, seq_b->next);
SWAP(int, seq_a->start, seq_b->start);
SWAP(int, seq_a->startofs, seq_b->startofs);
SWAP(int, seq_a->endofs, seq_b->endofs);
#include "ED_object.h"
#include "RE_pipeline.h"
+#include "IMB_colormanagement.h"
#include "IMB_imbuf.h"
#include "IMB_imbuf_types.h"
IMB_buffer_byte_from_float(rectc, rectf,
4, ibuf->dither, IB_PROFILE_SRGB, profile_from, predivide,
xmax, ymax, ibuf->x, rr->rectx);
+
+ IMB_partial_display_buffer_update(ibuf, rectf, rr->rectx, rxmin, rymin,
+ rxmin, rymin, rxmin + xmax, rymin + ymax);
}
/* ****************************** render invoking ***************** */
/* store actual owner of job, so modal operator could check for it,
* the reason of this is that active scene could change when rendering
- * several layers from composistor [#31800]
+ * several layers from compositor [#31800]
*/
op->customdata = scene;
#include "GPU_draw.h"
#include "GPU_extensions.h"
+#include "IMB_colormanagement.h"
+
#include "paint_intern.h"
/* Defines and Structs */
char idname[MAX_ID_NAME]; /* name instead of pointer*/
char ibufname[IB_FILENAME_SIZE];
- void *rect;
+ union {
+ float *fp;
+ unsigned int *uint;
+ void *pt;
+ } rect;
int x, y;
short source, use_float;
tile->y * IMAPAINT_TILE_SIZE, IMAPAINT_TILE_SIZE, IMAPAINT_TILE_SIZE);
if (ibuf->rect_float) {
- SWAP(void *, tmpibuf->rect_float, tile->rect);
+ SWAP(float *, tmpibuf->rect_float, tile->rect.fp);
}
else {
- SWAP(void *, tmpibuf->rect, tile->rect);
+ SWAP(unsigned int *, tmpibuf->rect, tile->rect.uint);
}
if (restore)
if (tile->x == x_tile && tile->y == y_tile && ima->gen_type == tile->gen_type && ima->source == tile->source)
if (tile->use_float == use_float)
if (strcmp(tile->idname, ima->id.name) == 0 && strcmp(tile->ibufname, ibuf->name) == 0)
- return tile->rect;
+ return tile->rect.pt;
if (*tmpibuf == NULL)
*tmpibuf = IMB_allocImBuf(IMAPAINT_TILE_SIZE, IMAPAINT_TILE_SIZE, 32, IB_rectfloat | IB_rect);
allocsize = IMAPAINT_TILE_SIZE * IMAPAINT_TILE_SIZE * 4;
allocsize *= (ibuf->rect_float) ? sizeof(float) : sizeof(char);
- tile->rect = MEM_mapallocN(allocsize, "UndeImageTile.rect");
+ tile->rect.pt = MEM_mapallocN(allocsize, "UndeImageTile.rect");
BLI_strncpy(tile->ibufname, ibuf->name, sizeof(tile->ibufname));
BLI_addtail(lb, tile);
- return tile->rect;
+ return tile->rect.pt;
}
static void image_undo_restore(bContext *C, ListBase *lb)
UndoImageTile *tile;
for (tile = lb->first; tile; tile = tile->next)
- MEM_freeN(tile->rect);
+ MEM_freeN(tile->rect.pt);
}
/* get active image for face depending on old/new shading system */
static void imapaint_image_update(SpaceImage *sima, Image *image, ImBuf *ibuf, short texpaint)
{
- if (ibuf->rect_float)
- ibuf->userflags |= IB_RECT_INVALID; /* force recreate of char rect */
+ if (ibuf->rect_float) {
+ IMB_partial_display_buffer_update(ibuf, ibuf->rect_float, ibuf->x, 0, 0,
+ imapaintpartial.x1, imapaintpartial.y1,
+ imapaintpartial.x2, imapaintpartial.y2);
+ }
if (ibuf->mipmap[0])
ibuf->userflags |= IB_MIPMAP_INVALID;
/* temporarily add float rect for cloning */
if (s->canvas->rect_float && !s->clonecanvas->rect_float) {
- int profile = IB_PROFILE_NONE;
+ short profile = IB_PROFILE_NONE;
/* Don't want to color manage, but don't disturb existing profiles */
- SWAP(int, s->clonecanvas->profile, profile);
+ SWAP(short, s->clonecanvas->profile, profile);
IMB_float_from_rect(s->clonecanvas);
s->clonefreefloat = 1;
- SWAP(int, s->clonecanvas->profile, profile);
+ SWAP(short, s->clonecanvas->profile, profile);
}
else if (!s->canvas->rect_float && !s->clonecanvas->rect)
IMB_rect_from_float(s->clonecanvas);
int width, int height, int stride_to, int stride_from);
void IMB_buffer_float_clamp(float *buf, int width, int height);
+/* converting pixel buffers using tonecurve */
+
+typedef void (*imb_tonecurveCb) (float rgbOut[3], const float rgbIn[3]);
+
+void IMB_buffer_byte_from_float_tonecurve(unsigned char *rect_to, const float *rect_from,
+ int channels_from, float dither, int profile_to, int profile_from, int predivide,
+ int width, int height, int stride_to, int stride_from,
+ imb_tonecurveCb tonecurve_func);
+
/**
* Change the ordering of the color bytes pointed to by rect from
* rgba to abgr. size * 4 color bytes are reordered.
void *customdata),
void *(do_thread) (void *));
+ /* ffmpeg */
+ void IMB_ffmpeg_init(void);
+ const char *IMB_ffmpeg_last_error(void);
+
#endif
RNA_def_property_range(prop, 0.0f, 10.0f);
RNA_def_property_ui_text(prop, "G", "Log conversion gamma");
RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ /* color management */
+ prop = RNA_def_property(srna, "view_settings", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "view_settings");
+ RNA_def_property_struct_type(prop, "ColorManagedViewSettings");
+ RNA_def_property_ui_text(prop, "View Settings", "Color management settings applied on image before saving");
+
+ prop = RNA_def_property(srna, "display_settings", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "display_settings");
+ RNA_def_property_struct_type(prop, "ColorManagedDisplaySettings");
+ RNA_def_property_ui_text(prop, "Display Settings", "Settings of device saved image would be displayed on");
}
static void rna_def_scene_ffmpeg_settings(BlenderRNA *brna)
{CODEC_ID_FLV1, "FLASH", 0, "Flash Video", ""},
{CODEC_ID_FFV1, "FFV1", 0, "FFmpeg video codec #1", ""},
{CODEC_ID_QTRLE, "QTRLE", 0, "QTRLE", ""},
- /* {CODEC_ID_DNXHD, "DNXHD", 0, "DNxHD", ""}, */ /* disabled for after release */
+ {CODEC_ID_DNXHD, "DNXHD", 0, "DNxHD", ""},
{0, NULL, 0, NULL, NULL}
};
RNA_def_property_ui_text(prop, "Active Movie Clip", "Active movie clip used for constraints and viewport drawing");
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+ /* color management */
+ prop = RNA_def_property(srna, "view_settings", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "view_settings");
+ RNA_def_property_struct_type(prop, "ColorManagedViewSettings");
+ RNA_def_property_ui_text(prop, "View Settings", "Color management settings applied on image before saving");
+
+ prop = RNA_def_property(srna, "display_settings", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "display_settings");
+ RNA_def_property_struct_type(prop, "ColorManagedDisplaySettings");
+ RNA_def_property_ui_text(prop, "Display Settings", "Settings of device saved image would be displayed on");
+
/* Nestled Data */
rna_def_tool_settings(brna);
rna_def_unified_paint_settings(brna);
/* rna */
float *give_cursor(struct Scene *scene, struct View3D *v3d) {return (float *) NULL;}
void WM_menutype_free(void) {}
- void WM_menutype_freelink(struct MenuType* mt) {}
+ void WM_menutype_freelink(struct MenuType *mt) {}
int WM_menutype_add(struct MenuType *mt) {return 0;}
int WM_operator_props_dialog_popup(struct bContext *C, struct wmOperator *op, int width, int height) {return 0;}
int WM_operator_confirm(struct bContext *C, struct wmOperator *op, struct wmEvent *event) {return 0;}
void uiTemplateHistogram(struct uiLayout *layout, struct PointerRNA *ptr, char *propname, int expand) {}
void uiTemplateReportsBanner(struct uiLayout *layout, struct bContext *C, struct wmOperator *op) {}
void uiTemplateWaveform(struct uiLayout *layout, struct PointerRNA *ptr, char *propname, int expand) {}
- void uiTemplateVectorscope(struct uiLayout *_self, struct PointerRNA *data, char* property, int expand) {}
+ void uiTemplateVectorscope(struct uiLayout *_self, struct PointerRNA *data, char *property, int expand) {}
void uiTemplateNodeLink(struct uiLayout *layout, struct bNodeTree *ntree, struct bNode *node, struct bNodeSocket *input) {}
void uiTemplateNodeView(struct uiLayout *layout, struct bContext *C, struct bNodeTree *ntree, struct bNode *node, struct bNodeSocket *input) {}
void uiTemplateTextureUser(struct uiLayout *layout, struct bContext *C) {}
void uiTemplateTrack(struct uiLayout *layout, struct PointerRNA *ptr, const char *propname) {}
void uiTemplateMarker(struct uiLayout *layout, struct PointerRNA *ptr, const char *propname, PointerRNA *userptr, PointerRNA *trackptr, int compact) {}
void uiTemplateImageSettings(struct uiLayout *layout, struct PointerRNA *imfptr) {}
+void uiTemplateColorspaceSettings(struct uiLayout *layout, struct PointerRNA *ptr, const char *propname) {}
+void uiTemplateColormanagedViewSettings(struct uiLayout *layout, struct bContext *C, struct PointerRNA *ptr, const char *propname, int show_global_settings) {}
/* rna render */
struct RenderResult *RE_engine_begin_result(struct RenderEngine *engine, int x, int y, int w, int h) {return (struct RenderResult *) NULL;}