2012-08-19 15:41:56 +00:00
|
|
|
/*
|
|
|
|
* ***** BEGIN GPL LICENSE BLOCK *****
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software Foundation,
|
|
|
|
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
*
|
|
|
|
* The Original Code is Copyright (C) 2012 Blender Foundation.
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* Contributor(s): Blender Foundation,
|
|
|
|
* Sergey Sharybin
|
|
|
|
*
|
|
|
|
* ***** END GPL LICENSE BLOCK *****
|
|
|
|
*/
|
|
|
|
|
|
|
|
/** \file blender/blenkernel/intern/seqmodifier.c
|
|
|
|
* \ingroup bke
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stddef.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
#include "MEM_guardedalloc.h"
|
|
|
|
|
|
|
|
#include "BLI_listbase.h"
|
|
|
|
#include "BLI_path_util.h"
|
|
|
|
#include "BLI_string.h"
|
|
|
|
#include "BLI_utildefines.h"
|
|
|
|
#include "BLI_math.h"
|
|
|
|
|
2013-03-25 08:29:06 +00:00
|
|
|
#include "BLF_translation.h"
|
|
|
|
|
2012-08-19 15:41:56 +00:00
|
|
|
#include "DNA_sequence_types.h"
|
|
|
|
|
|
|
|
#include "BKE_colortools.h"
|
|
|
|
#include "BKE_sequencer.h"
|
|
|
|
|
|
|
|
#include "IMB_imbuf.h"
|
|
|
|
#include "IMB_imbuf_types.h"
|
|
|
|
|
|
|
|
static SequenceModifierTypeInfo *modifiersTypes[NUM_SEQUENCE_MODIFIER_TYPES];
|
2014-03-20 15:45:20 +06:00
|
|
|
static bool modifierTypesInit = false;
|
2012-08-19 15:41:56 +00:00
|
|
|
|
|
|
|
/*********************** Modifiers *************************/
|
|
|
|
|
|
|
|
typedef void (*modifier_apply_threaded_cb) (int width, int height, unsigned char *rect, float *rect_float,
|
|
|
|
unsigned char *mask_rect, float *mask_rect_float, void *data_v);
|
|
|
|
|
|
|
|
typedef struct ModifierInitData {
|
|
|
|
ImBuf *ibuf;
|
|
|
|
ImBuf *mask;
|
|
|
|
void *user_data;
|
|
|
|
|
|
|
|
modifier_apply_threaded_cb apply_callback;
|
|
|
|
} ModifierInitData;
|
|
|
|
|
|
|
|
typedef struct ModifierThread {
|
|
|
|
int width, height;
|
|
|
|
|
|
|
|
unsigned char *rect, *mask_rect;
|
|
|
|
float *rect_float, *mask_rect_float;
|
|
|
|
|
|
|
|
void *user_data;
|
|
|
|
|
|
|
|
modifier_apply_threaded_cb apply_callback;
|
|
|
|
} ModifierThread;
|
|
|
|
|
|
|
|
|
2014-03-20 15:45:20 +06:00
|
|
|
static ImBuf *modifier_mask_get(SequenceModifierData *smd, const SeqRenderData *context, int cfra, bool make_float)
|
2012-08-19 15:41:56 +00:00
|
|
|
{
|
|
|
|
return BKE_sequencer_render_mask_input(context, smd->mask_input_type, smd->mask_sequence, smd->mask_id, cfra, make_float);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void modifier_init_handle(void *handle_v, int start_line, int tot_line, void *init_data_v)
|
|
|
|
{
|
|
|
|
ModifierThread *handle = (ModifierThread *) handle_v;
|
|
|
|
ModifierInitData *init_data = (ModifierInitData *) init_data_v;
|
|
|
|
ImBuf *ibuf = init_data->ibuf;
|
|
|
|
ImBuf *mask = init_data->mask;
|
|
|
|
|
|
|
|
int offset = 4 * start_line * ibuf->x;
|
|
|
|
|
|
|
|
memset(handle, 0, sizeof(ModifierThread));
|
|
|
|
|
|
|
|
handle->width = ibuf->x;
|
|
|
|
handle->height = tot_line;
|
|
|
|
handle->apply_callback = init_data->apply_callback;
|
|
|
|
handle->user_data = init_data->user_data;
|
|
|
|
|
|
|
|
if (ibuf->rect)
|
|
|
|
handle->rect = (unsigned char *) ibuf->rect + offset;
|
|
|
|
|
|
|
|
if (ibuf->rect_float)
|
|
|
|
handle->rect_float = ibuf->rect_float + offset;
|
|
|
|
|
|
|
|
if (mask) {
|
|
|
|
if (mask->rect)
|
|
|
|
handle->mask_rect = (unsigned char *) mask->rect + offset;
|
|
|
|
|
|
|
|
if (mask->rect_float)
|
|
|
|
handle->mask_rect_float = mask->rect_float + offset;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
handle->mask_rect = NULL;
|
|
|
|
handle->mask_rect_float = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void *modifier_do_thread(void *thread_data_v)
|
|
|
|
{
|
|
|
|
ModifierThread *td = (ModifierThread *) thread_data_v;
|
|
|
|
|
|
|
|
td->apply_callback(td->width, td->height, td->rect, td->rect_float, td->mask_rect, td->mask_rect_float, td->user_data);
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void modifier_apply_threaded(ImBuf *ibuf, ImBuf *mask, modifier_apply_threaded_cb apply_callback, void *user_data)
|
|
|
|
{
|
|
|
|
ModifierInitData init_data;
|
|
|
|
|
|
|
|
init_data.ibuf = ibuf;
|
|
|
|
init_data.mask = mask;
|
|
|
|
init_data.user_data = user_data;
|
|
|
|
|
|
|
|
init_data.apply_callback = apply_callback;
|
|
|
|
|
|
|
|
IMB_processor_apply_threaded(ibuf->y, sizeof(ModifierThread), &init_data,
|
2013-02-04 00:18:09 +00:00
|
|
|
modifier_init_handle, modifier_do_thread);
|
2012-08-19 15:41:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* **** Color Balance Modifier **** */
|
|
|
|
|
2012-09-15 01:52:28 +00:00
|
|
|
static void colorBalance_init_data(SequenceModifierData *smd)
|
2012-08-19 15:41:56 +00:00
|
|
|
{
|
|
|
|
ColorBalanceModifierData *cbmd = (ColorBalanceModifierData *) smd;
|
|
|
|
int c;
|
|
|
|
|
|
|
|
cbmd->color_multiply = 1.0f;
|
|
|
|
|
|
|
|
for (c = 0; c < 3; c++) {
|
|
|
|
cbmd->color_balance.lift[c] = 1.0f;
|
|
|
|
cbmd->color_balance.gamma[c] = 1.0f;
|
|
|
|
cbmd->color_balance.gain[c] = 1.0f;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-09-15 01:52:28 +00:00
|
|
|
static void colorBalance_apply(SequenceModifierData *smd, ImBuf *ibuf, ImBuf *mask)
|
2012-08-19 15:41:56 +00:00
|
|
|
{
|
|
|
|
ColorBalanceModifierData *cbmd = (ColorBalanceModifierData *) smd;
|
|
|
|
|
2014-03-20 15:45:20 +06:00
|
|
|
BKE_sequencer_color_balance_apply(&cbmd->color_balance, ibuf, cbmd->color_multiply, false, mask);
|
2012-08-19 15:41:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static SequenceModifierTypeInfo seqModifier_ColorBalance = {
|
2013-03-25 08:29:06 +00:00
|
|
|
CTX_N_(BLF_I18NCONTEXT_ID_SEQUENCE, "Color Balance"), /* name */
|
|
|
|
"ColorBalanceModifierData", /* struct_name */
|
|
|
|
sizeof(ColorBalanceModifierData), /* struct_size */
|
|
|
|
colorBalance_init_data, /* init_data */
|
|
|
|
NULL, /* free_data */
|
|
|
|
NULL, /* copy_data */
|
|
|
|
colorBalance_apply /* apply */
|
2012-08-19 15:41:56 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/* **** Curves Modifier **** */
|
|
|
|
|
2012-09-15 01:52:28 +00:00
|
|
|
static void curves_init_data(SequenceModifierData *smd)
|
2012-08-19 15:41:56 +00:00
|
|
|
{
|
|
|
|
CurvesModifierData *cmd = (CurvesModifierData *) smd;
|
|
|
|
|
|
|
|
curvemapping_set_defaults(&cmd->curve_mapping, 4, 0.0f, 0.0f, 1.0f, 1.0f);
|
|
|
|
}
|
|
|
|
|
2012-09-15 01:52:28 +00:00
|
|
|
static void curves_free_data(SequenceModifierData *smd)
|
2012-08-19 15:41:56 +00:00
|
|
|
{
|
|
|
|
CurvesModifierData *cmd = (CurvesModifierData *) smd;
|
|
|
|
|
|
|
|
curvemapping_free_data(&cmd->curve_mapping);
|
|
|
|
}
|
|
|
|
|
2012-09-15 01:52:28 +00:00
|
|
|
static void curves_copy_data(SequenceModifierData *target, SequenceModifierData *smd)
|
2012-08-19 15:41:56 +00:00
|
|
|
{
|
|
|
|
CurvesModifierData *cmd = (CurvesModifierData *) smd;
|
|
|
|
CurvesModifierData *cmd_target = (CurvesModifierData *) target;
|
|
|
|
|
|
|
|
curvemapping_copy_data(&cmd_target->curve_mapping, &cmd->curve_mapping);
|
|
|
|
}
|
|
|
|
|
2012-09-15 01:52:28 +00:00
|
|
|
static void curves_apply_threaded(int width, int height, unsigned char *rect, float *rect_float,
|
|
|
|
unsigned char *mask_rect, float *mask_rect_float, void *data_v)
|
2012-08-19 15:41:56 +00:00
|
|
|
{
|
|
|
|
CurveMapping *curve_mapping = (CurveMapping *) data_v;
|
|
|
|
int x, y;
|
|
|
|
|
|
|
|
for (y = 0; y < height; y++) {
|
|
|
|
for (x = 0; x < width; x++) {
|
|
|
|
int pixel_index = (y * width + x) * 4;
|
|
|
|
|
|
|
|
if (rect_float) {
|
|
|
|
float *pixel = rect_float + pixel_index;
|
|
|
|
float result[3];
|
|
|
|
|
|
|
|
curvemapping_evaluate_premulRGBF(curve_mapping, result, pixel);
|
|
|
|
|
|
|
|
if (mask_rect_float) {
|
|
|
|
float *m = mask_rect_float + pixel_index;
|
|
|
|
|
|
|
|
pixel[0] = pixel[0] * (1.0f - m[0]) + result[0] * m[0];
|
|
|
|
pixel[1] = pixel[1] * (1.0f - m[1]) + result[1] * m[1];
|
|
|
|
pixel[2] = pixel[2] * (1.0f - m[2]) + result[2] * m[2];
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
pixel[0] = result[0];
|
|
|
|
pixel[1] = result[1];
|
|
|
|
pixel[2] = result[2];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (rect) {
|
|
|
|
unsigned char *pixel = rect + pixel_index;
|
2012-12-31 13:52:13 +00:00
|
|
|
float result[3], tempc[4];
|
2012-08-19 15:41:56 +00:00
|
|
|
|
2012-12-31 13:52:13 +00:00
|
|
|
straight_uchar_to_premul_float(tempc, pixel);
|
|
|
|
|
|
|
|
curvemapping_evaluate_premulRGBF(curve_mapping, result, tempc);
|
2012-08-19 15:41:56 +00:00
|
|
|
|
|
|
|
if (mask_rect) {
|
|
|
|
float t[3];
|
|
|
|
|
|
|
|
rgb_uchar_to_float(t, mask_rect + pixel_index);
|
|
|
|
|
2013-02-27 09:58:40 +00:00
|
|
|
tempc[0] = tempc[0] * (1.0f - t[0]) + result[0] * t[0];
|
|
|
|
tempc[1] = tempc[1] * (1.0f - t[1]) + result[1] * t[1];
|
|
|
|
tempc[2] = tempc[2] * (1.0f - t[2]) + result[2] * t[2];
|
2012-08-19 15:41:56 +00:00
|
|
|
}
|
|
|
|
else {
|
2012-12-31 13:52:13 +00:00
|
|
|
tempc[0] = result[0];
|
|
|
|
tempc[1] = result[1];
|
|
|
|
tempc[2] = result[2];
|
2012-08-19 15:41:56 +00:00
|
|
|
}
|
2012-12-31 13:52:13 +00:00
|
|
|
|
|
|
|
premul_float_to_straight_uchar(pixel, tempc);
|
2012-08-19 15:41:56 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-09-15 01:52:28 +00:00
|
|
|
static void curves_apply(struct SequenceModifierData *smd, ImBuf *ibuf, ImBuf *mask)
|
2012-08-19 15:41:56 +00:00
|
|
|
{
|
|
|
|
CurvesModifierData *cmd = (CurvesModifierData *) smd;
|
|
|
|
|
|
|
|
float black[3] = {0.0f, 0.0f, 0.0f};
|
|
|
|
float white[3] = {1.0f, 1.0f, 1.0f};
|
|
|
|
|
|
|
|
curvemapping_initialize(&cmd->curve_mapping);
|
|
|
|
|
|
|
|
curvemapping_premultiply(&cmd->curve_mapping, 0);
|
|
|
|
curvemapping_set_black_white(&cmd->curve_mapping, black, white);
|
|
|
|
|
2012-09-04 16:55:12 +00:00
|
|
|
modifier_apply_threaded(ibuf, mask, curves_apply_threaded, &cmd->curve_mapping);
|
2012-08-19 15:41:56 +00:00
|
|
|
|
|
|
|
curvemapping_premultiply(&cmd->curve_mapping, 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
static SequenceModifierTypeInfo seqModifier_Curves = {
|
2013-03-25 08:29:06 +00:00
|
|
|
CTX_N_(BLF_I18NCONTEXT_ID_SEQUENCE, "Curves"), /* name */
|
|
|
|
"CurvesModifierData", /* struct_name */
|
|
|
|
sizeof(CurvesModifierData), /* struct_size */
|
|
|
|
curves_init_data, /* init_data */
|
|
|
|
curves_free_data, /* free_data */
|
|
|
|
curves_copy_data, /* copy_data */
|
|
|
|
curves_apply /* apply */
|
2012-08-19 15:41:56 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/* **** Hue Correct Modifier **** */
|
|
|
|
|
2012-09-15 01:52:28 +00:00
|
|
|
static void hue_correct_init_data(SequenceModifierData *smd)
|
2012-08-19 15:41:56 +00:00
|
|
|
{
|
|
|
|
HueCorrectModifierData *hcmd = (HueCorrectModifierData *) smd;
|
|
|
|
int c;
|
|
|
|
|
|
|
|
curvemapping_set_defaults(&hcmd->curve_mapping, 1, 0.0f, 0.0f, 1.0f, 1.0f);
|
|
|
|
hcmd->curve_mapping.preset = CURVE_PRESET_MID9;
|
|
|
|
|
|
|
|
for (c = 0; c < 3; c++) {
|
|
|
|
CurveMap *cuma = &hcmd->curve_mapping.cm[c];
|
|
|
|
|
|
|
|
curvemap_reset(cuma, &hcmd->curve_mapping.clipr, hcmd->curve_mapping.preset, CURVEMAP_SLOPE_POSITIVE);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* default to showing Saturation */
|
|
|
|
hcmd->curve_mapping.cur = 1;
|
|
|
|
}
|
|
|
|
|
2012-09-15 01:52:28 +00:00
|
|
|
static void hue_correct_free_data(SequenceModifierData *smd)
|
2012-08-19 15:41:56 +00:00
|
|
|
{
|
|
|
|
HueCorrectModifierData *hcmd = (HueCorrectModifierData *) smd;
|
|
|
|
|
|
|
|
curvemapping_free_data(&hcmd->curve_mapping);
|
|
|
|
}
|
|
|
|
|
2012-09-15 01:52:28 +00:00
|
|
|
static void hue_correct_copy_data(SequenceModifierData *target, SequenceModifierData *smd)
|
2012-08-19 15:41:56 +00:00
|
|
|
{
|
|
|
|
HueCorrectModifierData *hcmd = (HueCorrectModifierData *) smd;
|
|
|
|
HueCorrectModifierData *hcmd_target = (HueCorrectModifierData *) target;
|
|
|
|
|
|
|
|
curvemapping_copy_data(&hcmd_target->curve_mapping, &hcmd->curve_mapping);
|
|
|
|
}
|
|
|
|
|
2012-09-15 01:52:28 +00:00
|
|
|
static void hue_correct_apply_threaded(int width, int height, unsigned char *rect, float *rect_float,
|
2012-08-19 15:41:56 +00:00
|
|
|
unsigned char *mask_rect, float *mask_rect_float, void *data_v)
|
|
|
|
{
|
|
|
|
CurveMapping *curve_mapping = (CurveMapping *) data_v;
|
|
|
|
int x, y;
|
|
|
|
|
|
|
|
for (y = 0; y < height; y++) {
|
|
|
|
for (x = 0; x < width; x++) {
|
|
|
|
int pixel_index = (y * width + x) * 4;
|
|
|
|
float pixel[3], result[3], mask[3] = {1.0f, 1.0f, 1.0f};
|
|
|
|
float hsv[3], f;
|
|
|
|
|
|
|
|
if (rect_float)
|
|
|
|
copy_v3_v3(pixel, rect_float + pixel_index);
|
|
|
|
else
|
|
|
|
rgb_uchar_to_float(pixel, rect + pixel_index);
|
|
|
|
|
|
|
|
rgb_to_hsv(pixel[0], pixel[1], pixel[2], hsv, hsv + 1, hsv + 2);
|
|
|
|
|
|
|
|
/* adjust hue, scaling returned default 0.5 up to 1 */
|
|
|
|
f = curvemapping_evaluateF(curve_mapping, 0, hsv[0]);
|
|
|
|
hsv[0] += f - 0.5f;
|
|
|
|
|
|
|
|
/* adjust saturation, scaling returned default 0.5 up to 1 */
|
|
|
|
f = curvemapping_evaluateF(curve_mapping, 1, hsv[0]);
|
|
|
|
hsv[1] *= (f * 2.0f);
|
|
|
|
|
|
|
|
/* adjust value, scaling returned default 0.5 up to 1 */
|
|
|
|
f = curvemapping_evaluateF(curve_mapping, 2, hsv[0]);
|
|
|
|
hsv[2] *= (f * 2.f);
|
|
|
|
|
|
|
|
hsv[0] = hsv[0] - floorf(hsv[0]); /* mod 1.0 */
|
|
|
|
CLAMP(hsv[1], 0.0f, 1.0f);
|
|
|
|
|
|
|
|
/* convert back to rgb */
|
|
|
|
hsv_to_rgb(hsv[0], hsv[1], hsv[2], result, result + 1, result + 2);
|
|
|
|
|
|
|
|
if (mask_rect_float)
|
2012-11-09 09:33:28 +00:00
|
|
|
copy_v3_v3(mask, mask_rect_float + pixel_index);
|
2012-08-19 15:41:56 +00:00
|
|
|
else if (mask_rect)
|
2012-11-09 09:33:28 +00:00
|
|
|
rgb_uchar_to_float(mask, mask_rect + pixel_index);
|
2012-08-19 15:41:56 +00:00
|
|
|
|
|
|
|
result[0] = pixel[0] * (1.0f - mask[0]) + result[0] * mask[0];
|
|
|
|
result[1] = pixel[1] * (1.0f - mask[1]) + result[1] * mask[1];
|
|
|
|
result[2] = pixel[2] * (1.0f - mask[2]) + result[2] * mask[2];
|
|
|
|
|
|
|
|
if (rect_float)
|
|
|
|
copy_v3_v3(rect_float + pixel_index, result);
|
|
|
|
else
|
|
|
|
rgb_float_to_uchar(rect + pixel_index, result);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-09-15 01:52:28 +00:00
|
|
|
static void hue_correct_apply(struct SequenceModifierData *smd, ImBuf *ibuf, ImBuf *mask)
|
2012-08-19 15:41:56 +00:00
|
|
|
{
|
|
|
|
HueCorrectModifierData *hcmd = (HueCorrectModifierData *) smd;
|
|
|
|
|
|
|
|
curvemapping_initialize(&hcmd->curve_mapping);
|
|
|
|
|
2012-09-04 16:55:12 +00:00
|
|
|
modifier_apply_threaded(ibuf, mask, hue_correct_apply_threaded, &hcmd->curve_mapping);
|
2012-08-19 15:41:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static SequenceModifierTypeInfo seqModifier_HueCorrect = {
|
2013-03-25 08:29:06 +00:00
|
|
|
CTX_N_(BLF_I18NCONTEXT_ID_SEQUENCE, "Hue Correct"), /* name */
|
|
|
|
"HueCorrectModifierData", /* struct_name */
|
|
|
|
sizeof(HueCorrectModifierData), /* struct_size */
|
|
|
|
hue_correct_init_data, /* init_data */
|
|
|
|
hue_correct_free_data, /* free_data */
|
|
|
|
hue_correct_copy_data, /* copy_data */
|
|
|
|
hue_correct_apply /* apply */
|
2012-08-19 15:41:56 +00:00
|
|
|
};
|
|
|
|
|
2012-08-24 09:07:04 +00:00
|
|
|
/* **** Bright/Contrast Modifier **** */
|
|
|
|
|
|
|
|
typedef struct BrightContrastThreadData {
|
|
|
|
float bright;
|
|
|
|
float contrast;
|
|
|
|
} BrightContrastThreadData;
|
|
|
|
|
2012-09-15 01:52:28 +00:00
|
|
|
static void brightcontrast_apply_threaded(int width, int height, unsigned char *rect, float *rect_float,
|
|
|
|
unsigned char *mask_rect, float *mask_rect_float, void *data_v)
|
2012-08-24 09:07:04 +00:00
|
|
|
{
|
|
|
|
BrightContrastThreadData *data = (BrightContrastThreadData *) data_v;
|
|
|
|
int x, y;
|
|
|
|
|
|
|
|
float i;
|
|
|
|
int c;
|
|
|
|
float a, b, v;
|
|
|
|
float brightness = data->bright / 100.0f;
|
|
|
|
float contrast = data->contrast;
|
|
|
|
float delta = contrast / 200.0f;
|
|
|
|
|
|
|
|
a = 1.0f - delta * 2.0f;
|
|
|
|
/*
|
|
|
|
* The algorithm is by Werner D. Streidt
|
|
|
|
* (http://visca.com/ffactory/archives/5-99/msg00021.html)
|
|
|
|
* Extracted of OpenCV demhist.c
|
|
|
|
*/
|
|
|
|
if (contrast > 0) {
|
|
|
|
a = 1.0f / a;
|
|
|
|
b = a * (brightness - delta);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
delta *= -1;
|
|
|
|
b = a * (brightness + delta);
|
|
|
|
}
|
|
|
|
|
|
|
|
for (y = 0; y < height; y++) {
|
|
|
|
for (x = 0; x < width; x++) {
|
|
|
|
int pixel_index = (y * width + x) * 4;
|
|
|
|
|
|
|
|
if (rect) {
|
|
|
|
unsigned char *pixel = rect + pixel_index;
|
|
|
|
|
|
|
|
for (c = 0; c < 3; c++) {
|
2012-11-30 13:42:52 +00:00
|
|
|
i = (float) pixel[c] / 255.0f;
|
2012-08-24 09:07:04 +00:00
|
|
|
v = a * i + b;
|
|
|
|
|
|
|
|
if (mask_rect) {
|
|
|
|
unsigned char *m = mask_rect + pixel_index;
|
|
|
|
float t = (float) m[c] / 255.0f;
|
|
|
|
|
2013-02-27 09:58:40 +00:00
|
|
|
v = (float) pixel[c] / 255.0f * (1.0f - t) + v * t;
|
2012-08-24 09:07:04 +00:00
|
|
|
}
|
2012-11-30 13:42:52 +00:00
|
|
|
|
|
|
|
pixel[c] = FTOCHAR(v);
|
2012-08-24 09:07:04 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (rect_float) {
|
|
|
|
float *pixel = rect_float + pixel_index;
|
|
|
|
|
|
|
|
for (c = 0; c < 3; c++) {
|
|
|
|
i = pixel[c];
|
|
|
|
v = a * i + b;
|
|
|
|
|
|
|
|
if (mask_rect_float) {
|
|
|
|
float *m = mask_rect_float + pixel_index;
|
|
|
|
|
|
|
|
pixel[c] = pixel[c] * (1.0f - m[c]) + v * m[c];
|
|
|
|
}
|
|
|
|
else
|
|
|
|
pixel[c] = v;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-09-15 01:52:28 +00:00
|
|
|
static void brightcontrast_apply(struct SequenceModifierData *smd, ImBuf *ibuf, ImBuf *mask)
|
2012-08-24 09:07:04 +00:00
|
|
|
{
|
|
|
|
BrightContrastModifierData *bcmd = (BrightContrastModifierData *) smd;
|
|
|
|
BrightContrastThreadData data;
|
|
|
|
|
|
|
|
data.bright = bcmd->bright;
|
|
|
|
data.contrast = bcmd->contrast;
|
|
|
|
|
2012-09-04 16:55:12 +00:00
|
|
|
modifier_apply_threaded(ibuf, mask, brightcontrast_apply_threaded, &data);
|
2012-08-24 09:07:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static SequenceModifierTypeInfo seqModifier_BrightContrast = {
|
2013-03-25 08:29:06 +00:00
|
|
|
CTX_N_(BLF_I18NCONTEXT_ID_SEQUENCE, "Bright/Contrast"), /* name */
|
|
|
|
"BrightContrastModifierData", /* struct_name */
|
|
|
|
sizeof(BrightContrastModifierData), /* struct_size */
|
|
|
|
NULL, /* init_data */
|
|
|
|
NULL, /* free_data */
|
|
|
|
NULL, /* copy_data */
|
|
|
|
brightcontrast_apply /* apply */
|
2012-08-24 09:07:04 +00:00
|
|
|
};
|
|
|
|
|
2013-05-08 14:20:57 +00:00
|
|
|
/* **** Mask Modifier **** */
|
|
|
|
|
|
|
|
static void maskmodifier_apply_threaded(int width, int height, unsigned char *rect, float *rect_float,
|
|
|
|
unsigned char *mask_rect, float *mask_rect_float, void *UNUSED(data_v))
|
|
|
|
{
|
|
|
|
int x, y;
|
|
|
|
|
|
|
|
if (rect && !mask_rect)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (rect_float && !mask_rect_float)
|
|
|
|
return;
|
|
|
|
|
|
|
|
for (y = 0; y < height; y++) {
|
|
|
|
for (x = 0; x < width; x++) {
|
|
|
|
int pixel_index = (y * width + x) * 4;
|
|
|
|
|
|
|
|
if (rect) {
|
|
|
|
unsigned char *pixel = rect + pixel_index;
|
|
|
|
unsigned char *mask_pixel = mask_rect + pixel_index;
|
|
|
|
unsigned char mask = min_iii(mask_pixel[0], mask_pixel[1], mask_pixel[2]);
|
|
|
|
|
|
|
|
/* byte buffer is straight, so only affect on alpha itself,
|
|
|
|
* this is the only way to alpha-over byte strip after
|
|
|
|
* applying mask modifier.
|
|
|
|
*/
|
|
|
|
pixel[3] = (float)(pixel[3] * mask) / 255.0f;
|
|
|
|
}
|
|
|
|
else if (rect_float) {
|
|
|
|
int c;
|
|
|
|
float *pixel = rect_float + pixel_index;
|
|
|
|
float *mask_pixel = mask_rect_float + pixel_index;
|
|
|
|
float mask = min_fff(mask_pixel[0], mask_pixel[1], mask_pixel[2]);
|
|
|
|
|
|
|
|
/* float buffers are premultiplied, so need to premul color
|
|
|
|
* as well to make it easy to alpha-over masted strip.
|
|
|
|
*/
|
|
|
|
for (c = 0; c < 4; c++)
|
|
|
|
pixel[c] = pixel[c] * mask;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void maskmodifier_apply(struct SequenceModifierData *smd, ImBuf *ibuf, ImBuf *mask)
|
|
|
|
{
|
|
|
|
BrightContrastModifierData *bcmd = (BrightContrastModifierData *) smd;
|
|
|
|
BrightContrastThreadData data;
|
|
|
|
|
|
|
|
data.bright = bcmd->bright;
|
|
|
|
data.contrast = bcmd->contrast;
|
|
|
|
|
|
|
|
modifier_apply_threaded(ibuf, mask, maskmodifier_apply_threaded, &data);
|
|
|
|
}
|
|
|
|
|
|
|
|
static SequenceModifierTypeInfo seqModifier_Mask = {
|
|
|
|
CTX_N_(BLF_I18NCONTEXT_ID_SEQUENCE, "Mask"), /* name */
|
|
|
|
"SequencerMaskModifierData", /* struct_name */
|
|
|
|
sizeof(SequencerMaskModifierData), /* struct_size */
|
|
|
|
NULL, /* init_data */
|
|
|
|
NULL, /* free_data */
|
|
|
|
NULL, /* copy_data */
|
|
|
|
maskmodifier_apply /* apply */
|
|
|
|
};
|
|
|
|
|
2012-08-19 15:41:56 +00:00
|
|
|
/*********************** Modifier functions *************************/
|
|
|
|
|
|
|
|
static void sequence_modifier_type_info_init(void)
|
|
|
|
{
|
|
|
|
#define INIT_TYPE(typeName) (modifiersTypes[seqModifierType_##typeName] = &seqModifier_##typeName)
|
|
|
|
|
|
|
|
INIT_TYPE(ColorBalance);
|
|
|
|
INIT_TYPE(Curves);
|
|
|
|
INIT_TYPE(HueCorrect);
|
2012-08-24 09:07:04 +00:00
|
|
|
INIT_TYPE(BrightContrast);
|
2013-05-08 14:20:57 +00:00
|
|
|
INIT_TYPE(Mask);
|
2012-08-19 15:41:56 +00:00
|
|
|
|
|
|
|
#undef INIT_TYPE
|
|
|
|
}
|
|
|
|
|
|
|
|
SequenceModifierTypeInfo *BKE_sequence_modifier_type_info_get(int type)
|
|
|
|
{
|
|
|
|
if (!modifierTypesInit) {
|
|
|
|
sequence_modifier_type_info_init();
|
2014-03-20 15:45:20 +06:00
|
|
|
modifierTypesInit = true;
|
2012-08-19 15:41:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return modifiersTypes[type];
|
|
|
|
}
|
|
|
|
|
2012-08-20 10:15:32 +00:00
|
|
|
SequenceModifierData *BKE_sequence_modifier_new(Sequence *seq, const char *name, int type)
|
2012-08-19 15:41:56 +00:00
|
|
|
{
|
|
|
|
SequenceModifierData *smd;
|
|
|
|
SequenceModifierTypeInfo *smti = BKE_sequence_modifier_type_info_get(type);
|
|
|
|
|
|
|
|
smd = MEM_callocN(smti->struct_size, "sequence modifier");
|
|
|
|
|
|
|
|
smd->type = type;
|
|
|
|
smd->flag |= SEQUENCE_MODIFIER_EXPANDED;
|
|
|
|
|
2012-08-20 10:15:32 +00:00
|
|
|
if (!name || !name[0])
|
|
|
|
BLI_strncpy(smd->name, smti->name, sizeof(smd->name));
|
|
|
|
else
|
|
|
|
BLI_strncpy(smd->name, name, sizeof(smd->name));
|
2012-08-19 15:41:56 +00:00
|
|
|
|
|
|
|
BLI_addtail(&seq->modifiers, smd);
|
|
|
|
|
|
|
|
BKE_sequence_modifier_unique_name(seq, smd);
|
|
|
|
|
|
|
|
if (smti->init_data)
|
|
|
|
smti->init_data(smd);
|
2012-08-20 10:15:32 +00:00
|
|
|
|
|
|
|
return smd;
|
|
|
|
}
|
|
|
|
|
2014-03-20 15:45:20 +06:00
|
|
|
bool BKE_sequence_modifier_remove(Sequence *seq, SequenceModifierData *smd)
|
2012-08-20 10:15:32 +00:00
|
|
|
{
|
|
|
|
if (BLI_findindex(&seq->modifiers, smd) == -1)
|
2014-03-20 15:45:20 +06:00
|
|
|
return false;
|
2012-08-20 10:15:32 +00:00
|
|
|
|
|
|
|
BLI_remlink(&seq->modifiers, smd);
|
|
|
|
BKE_sequence_modifier_free(smd);
|
|
|
|
|
2014-03-20 15:45:20 +06:00
|
|
|
return true;
|
2012-08-20 10:15:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void BKE_sequence_modifier_clear(Sequence *seq)
|
|
|
|
{
|
|
|
|
SequenceModifierData *smd, *smd_next;
|
|
|
|
|
|
|
|
for (smd = seq->modifiers.first; smd; smd = smd_next) {
|
|
|
|
smd_next = smd->next;
|
|
|
|
BKE_sequence_modifier_free(smd);
|
|
|
|
}
|
|
|
|
|
2014-02-08 06:07:10 +11:00
|
|
|
BLI_listbase_clear(&seq->modifiers);
|
2012-08-19 15:41:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void BKE_sequence_modifier_free(SequenceModifierData *smd)
|
|
|
|
{
|
|
|
|
SequenceModifierTypeInfo *smti = BKE_sequence_modifier_type_info_get(smd->type);
|
|
|
|
|
|
|
|
if (smti && smti->free_data) {
|
|
|
|
smti->free_data(smd);
|
|
|
|
}
|
|
|
|
|
|
|
|
MEM_freeN(smd);
|
|
|
|
}
|
|
|
|
|
|
|
|
void BKE_sequence_modifier_unique_name(Sequence *seq, SequenceModifierData *smd)
|
|
|
|
{
|
|
|
|
SequenceModifierTypeInfo *smti = BKE_sequence_modifier_type_info_get(smd->type);
|
|
|
|
|
2013-03-25 08:29:06 +00:00
|
|
|
BLI_uniquename(&seq->modifiers, smd, CTX_DATA_(BLF_I18NCONTEXT_ID_SEQUENCE, smti->name), '.',
|
|
|
|
offsetof(SequenceModifierData, name), sizeof(smd->name));
|
2012-08-19 15:41:56 +00:00
|
|
|
}
|
|
|
|
|
2013-04-13 04:28:04 +00:00
|
|
|
SequenceModifierData *BKE_sequence_modifier_find_by_name(Sequence *seq, const char *name)
|
2012-08-19 15:41:56 +00:00
|
|
|
{
|
|
|
|
return BLI_findstring(&(seq->modifiers), name, offsetof(SequenceModifierData, name));
|
|
|
|
}
|
|
|
|
|
2014-01-19 00:16:19 +06:00
|
|
|
ImBuf *BKE_sequence_modifier_apply_stack(const SeqRenderData *context, Sequence *seq, ImBuf *ibuf, int cfra)
|
2012-08-19 15:41:56 +00:00
|
|
|
{
|
|
|
|
SequenceModifierData *smd;
|
|
|
|
ImBuf *processed_ibuf = ibuf;
|
|
|
|
|
Color Management, Stage 2: Switch color pipeline to use OpenColorIO
Replace old color pipeline which was supporting linear/sRGB color spaces
only with OpenColorIO-based pipeline.
This introduces two configurable color spaces:
- Input color space for images and movie clips. This space is used to convert
images/movies from color space in which file is saved to Blender's linear
space (for float images, byte images are not internally converted, only input
space is stored for such images and used later).
This setting could be found in image/clip data block settings.
- Display color space which defines space in which particular display is working.
This settings could be found in scene's Color Management panel.
When render result is being displayed on the screen, apart from converting image
to display space, some additional conversions could happen.
This conversions are:
- View, which defines tone curve applying before display transformation.
These are different ways to view the image on the same display device.
For example it could be used to emulate film view on sRGB display.
- Exposure affects on image exposure before tone map is applied.
- Gamma is post-display gamma correction, could be used to match particular
display gamma.
- RGB curves are user-defined curves which are applying before display
transformation, could be used for different purposes.
All this settings by default are only applying on render result and does not
affect on other images. If some particular image needs to be affected by this
transformation, "View as Render" setting of image data block should be set to
truth. Movie clips are always affected by all display transformations.
This commit also introduces configurable color space in which sequencer is
working. This setting could be found in scene's Color Management panel and
it should be used if such stuff as grading needs to be done in color space
different from sRGB (i.e. when Film view on sRGB display is use, using VD16
space as sequencer's internal space would make grading working in space
which is close to the space using for display).
Some technical notes:
- Image buffer's float buffer is now always in linear space, even if it was
created from 16bit byte images.
- Space of byte buffer is stored in image buffer's rect_colorspace property.
- Profile of image buffer was removed since it's not longer meaningful.
- OpenGL and GLSL is supposed to always work in sRGB space. It is possible
to support other spaces, but it's quite large project which isn't so
much important.
- Legacy Color Management option disabled is emulated by using None display.
It could have some regressions, but there's no clear way to avoid them.
- If OpenColorIO is disabled on build time, it should make blender behaving
in the same way as previous release with color management enabled.
More details could be found at this page (more details would be added soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.64/Color_Management
--
Thanks to Xavier Thomas, Lukas Toene for initial work on OpenColorIO
integration and to Brecht van Lommel for some further development and code/
usecase review!
2012-09-15 10:05:07 +00:00
|
|
|
if (seq->modifiers.first && (seq->flag & SEQ_USE_LINEAR_MODIFIERS)) {
|
|
|
|
processed_ibuf = IMB_dupImBuf(ibuf);
|
2014-01-19 00:16:19 +06:00
|
|
|
BKE_sequencer_imbuf_from_sequencer_space(context->scene, processed_ibuf);
|
Color Management, Stage 2: Switch color pipeline to use OpenColorIO
Replace old color pipeline which was supporting linear/sRGB color spaces
only with OpenColorIO-based pipeline.
This introduces two configurable color spaces:
- Input color space for images and movie clips. This space is used to convert
images/movies from color space in which file is saved to Blender's linear
space (for float images, byte images are not internally converted, only input
space is stored for such images and used later).
This setting could be found in image/clip data block settings.
- Display color space which defines space in which particular display is working.
This settings could be found in scene's Color Management panel.
When render result is being displayed on the screen, apart from converting image
to display space, some additional conversions could happen.
This conversions are:
- View, which defines tone curve applying before display transformation.
These are different ways to view the image on the same display device.
For example it could be used to emulate film view on sRGB display.
- Exposure affects on image exposure before tone map is applied.
- Gamma is post-display gamma correction, could be used to match particular
display gamma.
- RGB curves are user-defined curves which are applying before display
transformation, could be used for different purposes.
All this settings by default are only applying on render result and does not
affect on other images. If some particular image needs to be affected by this
transformation, "View as Render" setting of image data block should be set to
truth. Movie clips are always affected by all display transformations.
This commit also introduces configurable color space in which sequencer is
working. This setting could be found in scene's Color Management panel and
it should be used if such stuff as grading needs to be done in color space
different from sRGB (i.e. when Film view on sRGB display is use, using VD16
space as sequencer's internal space would make grading working in space
which is close to the space using for display).
Some technical notes:
- Image buffer's float buffer is now always in linear space, even if it was
created from 16bit byte images.
- Space of byte buffer is stored in image buffer's rect_colorspace property.
- Profile of image buffer was removed since it's not longer meaningful.
- OpenGL and GLSL is supposed to always work in sRGB space. It is possible
to support other spaces, but it's quite large project which isn't so
much important.
- Legacy Color Management option disabled is emulated by using None display.
It could have some regressions, but there's no clear way to avoid them.
- If OpenColorIO is disabled on build time, it should make blender behaving
in the same way as previous release with color management enabled.
More details could be found at this page (more details would be added soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.64/Color_Management
--
Thanks to Xavier Thomas, Lukas Toene for initial work on OpenColorIO
integration and to Brecht van Lommel for some further development and code/
usecase review!
2012-09-15 10:05:07 +00:00
|
|
|
}
|
|
|
|
|
2012-08-19 15:41:56 +00:00
|
|
|
for (smd = seq->modifiers.first; smd; smd = smd->next) {
|
|
|
|
SequenceModifierTypeInfo *smti = BKE_sequence_modifier_type_info_get(smd->type);
|
|
|
|
|
|
|
|
/* could happen if modifier is being removed or not exists in current version of blender */
|
|
|
|
if (!smti)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
/* modifier is muted, do nothing */
|
|
|
|
if (smd->flag & SEQUENCE_MODIFIER_MUTE)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
if (smti->apply) {
|
|
|
|
ImBuf *mask = modifier_mask_get(smd, context, cfra, ibuf->rect_float != NULL);
|
|
|
|
|
|
|
|
if (processed_ibuf == ibuf)
|
|
|
|
processed_ibuf = IMB_dupImBuf(ibuf);
|
|
|
|
|
2012-09-04 16:55:12 +00:00
|
|
|
smti->apply(smd, processed_ibuf, mask);
|
2012-08-19 15:41:56 +00:00
|
|
|
|
|
|
|
if (mask)
|
|
|
|
IMB_freeImBuf(mask);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
Color Management, Stage 2: Switch color pipeline to use OpenColorIO
Replace old color pipeline which was supporting linear/sRGB color spaces
only with OpenColorIO-based pipeline.
This introduces two configurable color spaces:
- Input color space for images and movie clips. This space is used to convert
images/movies from color space in which file is saved to Blender's linear
space (for float images, byte images are not internally converted, only input
space is stored for such images and used later).
This setting could be found in image/clip data block settings.
- Display color space which defines space in which particular display is working.
This settings could be found in scene's Color Management panel.
When render result is being displayed on the screen, apart from converting image
to display space, some additional conversions could happen.
This conversions are:
- View, which defines tone curve applying before display transformation.
These are different ways to view the image on the same display device.
For example it could be used to emulate film view on sRGB display.
- Exposure affects on image exposure before tone map is applied.
- Gamma is post-display gamma correction, could be used to match particular
display gamma.
- RGB curves are user-defined curves which are applying before display
transformation, could be used for different purposes.
All this settings by default are only applying on render result and does not
affect on other images. If some particular image needs to be affected by this
transformation, "View as Render" setting of image data block should be set to
truth. Movie clips are always affected by all display transformations.
This commit also introduces configurable color space in which sequencer is
working. This setting could be found in scene's Color Management panel and
it should be used if such stuff as grading needs to be done in color space
different from sRGB (i.e. when Film view on sRGB display is use, using VD16
space as sequencer's internal space would make grading working in space
which is close to the space using for display).
Some technical notes:
- Image buffer's float buffer is now always in linear space, even if it was
created from 16bit byte images.
- Space of byte buffer is stored in image buffer's rect_colorspace property.
- Profile of image buffer was removed since it's not longer meaningful.
- OpenGL and GLSL is supposed to always work in sRGB space. It is possible
to support other spaces, but it's quite large project which isn't so
much important.
- Legacy Color Management option disabled is emulated by using None display.
It could have some regressions, but there's no clear way to avoid them.
- If OpenColorIO is disabled on build time, it should make blender behaving
in the same way as previous release with color management enabled.
More details could be found at this page (more details would be added soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.64/Color_Management
--
Thanks to Xavier Thomas, Lukas Toene for initial work on OpenColorIO
integration and to Brecht van Lommel for some further development and code/
usecase review!
2012-09-15 10:05:07 +00:00
|
|
|
if (seq->modifiers.first && (seq->flag & SEQ_USE_LINEAR_MODIFIERS)) {
|
2014-03-20 15:45:20 +06:00
|
|
|
BKE_sequencer_imbuf_to_sequencer_space(context->scene, processed_ibuf, false);
|
Color Management, Stage 2: Switch color pipeline to use OpenColorIO
Replace old color pipeline which was supporting linear/sRGB color spaces
only with OpenColorIO-based pipeline.
This introduces two configurable color spaces:
- Input color space for images and movie clips. This space is used to convert
images/movies from color space in which file is saved to Blender's linear
space (for float images, byte images are not internally converted, only input
space is stored for such images and used later).
This setting could be found in image/clip data block settings.
- Display color space which defines space in which particular display is working.
This settings could be found in scene's Color Management panel.
When render result is being displayed on the screen, apart from converting image
to display space, some additional conversions could happen.
This conversions are:
- View, which defines tone curve applying before display transformation.
These are different ways to view the image on the same display device.
For example it could be used to emulate film view on sRGB display.
- Exposure affects on image exposure before tone map is applied.
- Gamma is post-display gamma correction, could be used to match particular
display gamma.
- RGB curves are user-defined curves which are applying before display
transformation, could be used for different purposes.
All this settings by default are only applying on render result and does not
affect on other images. If some particular image needs to be affected by this
transformation, "View as Render" setting of image data block should be set to
truth. Movie clips are always affected by all display transformations.
This commit also introduces configurable color space in which sequencer is
working. This setting could be found in scene's Color Management panel and
it should be used if such stuff as grading needs to be done in color space
different from sRGB (i.e. when Film view on sRGB display is use, using VD16
space as sequencer's internal space would make grading working in space
which is close to the space using for display).
Some technical notes:
- Image buffer's float buffer is now always in linear space, even if it was
created from 16bit byte images.
- Space of byte buffer is stored in image buffer's rect_colorspace property.
- Profile of image buffer was removed since it's not longer meaningful.
- OpenGL and GLSL is supposed to always work in sRGB space. It is possible
to support other spaces, but it's quite large project which isn't so
much important.
- Legacy Color Management option disabled is emulated by using None display.
It could have some regressions, but there's no clear way to avoid them.
- If OpenColorIO is disabled on build time, it should make blender behaving
in the same way as previous release with color management enabled.
More details could be found at this page (more details would be added soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.64/Color_Management
--
Thanks to Xavier Thomas, Lukas Toene for initial work on OpenColorIO
integration and to Brecht van Lommel for some further development and code/
usecase review!
2012-09-15 10:05:07 +00:00
|
|
|
}
|
|
|
|
|
2012-08-19 15:41:56 +00:00
|
|
|
return processed_ibuf;
|
|
|
|
}
|
|
|
|
|
|
|
|
void BKE_sequence_modifier_list_copy(Sequence *seqn, Sequence *seq)
|
|
|
|
{
|
|
|
|
SequenceModifierData *smd;
|
|
|
|
|
|
|
|
for (smd = seq->modifiers.first; smd; smd = smd->next) {
|
|
|
|
SequenceModifierData *smdn;
|
|
|
|
SequenceModifierTypeInfo *smti = BKE_sequence_modifier_type_info_get(smd->type);
|
|
|
|
|
|
|
|
smdn = MEM_dupallocN(smd);
|
|
|
|
|
|
|
|
if (smti && smti->copy_data)
|
|
|
|
smti->copy_data(smdn, smd);
|
|
|
|
|
|
|
|
smdn->next = smdn->prev = NULL;
|
|
|
|
BLI_addtail(&seqn->modifiers, smdn);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
int BKE_sequence_supports_modifiers(Sequence *seq)
|
|
|
|
{
|
|
|
|
return !ELEM(seq->type, SEQ_TYPE_SOUND_RAM, SEQ_TYPE_SOUND_HD);
|
|
|
|
}
|