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:
authorSergey Sharybin <sergey.vfx@gmail.com>2012-08-08 15:15:36 +0400
committerSergey Sharybin <sergey.vfx@gmail.com>2012-08-08 15:15:36 +0400
commit0b31218c858c74e9b1e3fe1ed2be1b2a79d1e8fe (patch)
tree59402e3d34c55b5c5bc26238328a56e9405bd615 /source/blender
parent1cdc39f49b2b93c57718c7ee1b1b8bb1fcdacf79 (diff)
Style cleanup: white space
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/blenkernel/intern/seqeffects.c892
-rw-r--r--source/blender/blenkernel/intern/sequencer.c326
2 files changed, 473 insertions, 745 deletions
diff --git a/source/blender/blenkernel/intern/seqeffects.c b/source/blender/blenkernel/intern/seqeffects.c
index 0532a019ecc..21cfafe97cc 100644
--- a/source/blender/blenkernel/intern/seqeffects.c
+++ b/source/blender/blenkernel/intern/seqeffects.c
@@ -58,7 +58,8 @@
/* **** XXX **** */
-/* Glow effect */
+/*********************** Glow effect *************************/
+
enum {
GlowR = 0,
GlowG = 1,
@@ -66,12 +67,9 @@ enum {
GlowA = 3
};
-static ImBuf *prepare_effect_imbufs(
- SeqRenderData context,
- struct ImBuf *ibuf1, struct ImBuf *ibuf2,
- struct ImBuf *ibuf3)
+static ImBuf *prepare_effect_imbufs(SeqRenderData context, ImBuf *ibuf1, ImBuf *ibuf2, ImBuf *ibuf3)
{
- struct ImBuf *out;
+ ImBuf *out;
int x = context.rectx;
int y = context.recty;
@@ -114,9 +112,7 @@ static ImBuf *prepare_effect_imbufs(
return out;
}
-/* **********************************************************************
- * ALPHA OVER
- * ********************************************************************** */
+/*********************** Alpha Over *************************/
static void init_alpha_over_or_under(Sequence *seq)
{
@@ -127,23 +123,21 @@ static void init_alpha_over_or_under(Sequence *seq)
seq->seq1 = seq2;
}
-static void do_alphaover_effect_byte(float facf0, float facf1, int x, int y,
- char *rect1, char *rect2, char *out)
+static void do_alphaover_effect_byte(float facf0, float facf1, int x, int y, char *rect1, char *rect2, char *out)
{
int fac2, mfac, fac, fac4;
int xo, tempc;
char *rt1, *rt2, *rt;
xo = x;
- rt1 = (char *)rect1;
- rt2 = (char *)rect2;
- rt = (char *)out;
+ rt1 = (char *) rect1;
+ rt2 = (char *) rect2;
+ rt = (char *) out;
- fac2 = (int)(256.0f * facf0);
- fac4 = (int)(256.0f * facf1);
+ fac2 = (int) (256.0f * facf0);
+ fac4 = (int) (256.0f * facf1);
while (y--) {
-
x = xo;
while (x--) {
@@ -152,8 +146,8 @@ static void do_alphaover_effect_byte(float facf0, float facf1, int x, int y,
fac = fac2;
mfac = 256 - ( (fac2 * rt1[3]) >> 8);
- if (fac == 0) *( (unsigned int *)rt) = *( (unsigned int *)rt2);
- else if (mfac == 0) *( (unsigned int *)rt) = *( (unsigned int *)rt1);
+ if (fac == 0) *( (unsigned int *) rt) = *( (unsigned int *) rt2);
+ else if (mfac == 0) *( (unsigned int *) rt) = *( (unsigned int *) rt1);
else {
tempc = (fac * rt1[0] + mfac * rt2[0]) >> 8;
if (tempc > 255) rt[0] = 255; else rt[0] = tempc;
@@ -172,12 +166,11 @@ static void do_alphaover_effect_byte(float facf0, float facf1, int x, int y,
x = xo;
while (x--) {
-
fac = fac4;
mfac = 256 - ( (fac4 * rt1[3]) >> 8);
- if (fac == 0) *( (unsigned int *)rt) = *( (unsigned int *)rt2);
- else if (mfac == 0) *( (unsigned int *)rt) = *( (unsigned int *)rt1);
+ if (fac == 0) *( (unsigned int *) rt) = *( (unsigned int *) rt2);
+ else if (mfac == 0) *( (unsigned int *) rt) = *( (unsigned int *) rt1);
else {
tempc = (fac * rt1[0] + mfac * rt2[0]) >> 8;
if (tempc > 255) rt[0] = 255; else rt[0] = tempc;
@@ -193,8 +186,7 @@ static void do_alphaover_effect_byte(float facf0, float facf1, int x, int y,
}
}
-static void do_alphaover_effect_float(float facf0, float facf1, int x, int y,
- float *rect1, float *rect2, float *out)
+static void do_alphaover_effect_float(float facf0, float facf1, int x, int y, float *rect1, float *rect2, float *out)
{
float fac2, mfac, fac, fac4;
int xo;
@@ -209,10 +201,8 @@ static void do_alphaover_effect_float(float facf0, float facf1, int x, int y,
fac4 = facf1;
while (y--) {
-
x = xo;
while (x--) {
-
/* rt = rt1 over rt2 (alpha from rt1) */
fac = fac2;
@@ -233,12 +223,12 @@ static void do_alphaover_effect_float(float facf0, float facf1, int x, int y,
rt1 += 4; rt2 += 4; rt += 4;
}
- if (y == 0) break;
+ if (y == 0)
+ break;
y--;
x = xo;
while (x--) {
-
fac = fac4;
mfac = 1.0f - (fac4 * rt1[3]);
@@ -259,11 +249,8 @@ static void do_alphaover_effect_float(float facf0, float facf1, int x, int y,
}
}
-static ImBuf *do_alphaover_effect(
- SeqRenderData context, Sequence *UNUSED(seq), float UNUSED(cfra),
- float facf0, float facf1,
- struct ImBuf *ibuf1, struct ImBuf *ibuf2,
- struct ImBuf *ibuf3)
+static ImBuf *do_alphaover_effect(SeqRenderData context, Sequence *UNUSED(seq), float UNUSED(cfra), float facf0,
+ float facf1, ImBuf *ibuf1, ImBuf *ibuf2, ImBuf *ibuf3)
{
struct ImBuf *out = prepare_effect_imbufs(context, ibuf1, ibuf2, ibuf3);
@@ -279,17 +266,13 @@ static ImBuf *do_alphaover_effect(
(char *) ibuf1->rect, (char *) ibuf2->rect,
(char *) out->rect);
}
+
return out;
}
+/*********************** Alpha Under *************************/
-/* **********************************************************************
- * ALPHA UNDER
- * ********************************************************************** */
-
-static void do_alphaunder_effect_byte(
- float facf0, float facf1, int x, int y, char *rect1,
- char *rect2, char *out)
+static void do_alphaunder_effect_byte(float facf0, float facf1, int x, int y, char *rect1, char *rect2, char *out)
{
int fac2, mfac, fac, fac4;
int xo;
@@ -304,22 +287,20 @@ static void do_alphaunder_effect_byte(
fac4 = (int)(256.0f * facf1);
while (y--) {
-
x = xo;
while (x--) {
-
/* rt = rt1 under rt2 (alpha from rt2) */
/* this complex optimization is because the
* 'skybuf' can be crossed in
*/
- if (rt2[3] == 0 && fac2 == 256) *( (unsigned int *)rt) = *( (unsigned int *)rt1);
- else if (rt2[3] == 255) *( (unsigned int *)rt) = *( (unsigned int *)rt2);
+ if (rt2[3] == 0 && fac2 == 256) *( (unsigned int *) rt) = *( (unsigned int *) rt1);
+ else if (rt2[3] == 255) *( (unsigned int *) rt) = *( (unsigned int *) rt2);
else {
mfac = rt2[3];
fac = (fac2 * (256 - mfac)) >> 8;
- if (fac == 0) *( (unsigned int *)rt) = *( (unsigned int *)rt2);
+ if (fac == 0) *( (unsigned int *) rt) = *( (unsigned int *) rt2);
else {
rt[0] = (fac * rt1[0] + mfac * rt2[0]) >> 8;
rt[1] = (fac * rt1[1] + mfac * rt2[1]) >> 8;
@@ -330,14 +311,14 @@ static void do_alphaunder_effect_byte(
rt1 += 4; rt2 += 4; rt += 4;
}
- if (y == 0) break;
+ if (y == 0)
+ break;
y--;
x = xo;
while (x--) {
-
- if (rt2[3] == 0 && fac4 == 256) *( (unsigned int *)rt) = *( (unsigned int *)rt1);
- else if (rt2[3] == 255) *( (unsigned int *)rt) = *( (unsigned int *)rt2);
+ if (rt2[3] == 0 && fac4 == 256) *( (unsigned int *) rt) = *( (unsigned int *) rt1);
+ else if (rt2[3] == 255) *( (unsigned int *) rt) = *( (unsigned int *) rt2);
else {
mfac = rt2[3];
fac = (fac4 * (256 - mfac)) >> 8;
@@ -355,10 +336,7 @@ static void do_alphaunder_effect_byte(
}
}
-
-static void do_alphaunder_effect_float(float facf0, float facf1, int x, int y,
- float *rect1, float *rect2,
- float *out)
+static void do_alphaunder_effect_float(float facf0, float facf1, int x, int y, float *rect1, float *rect2, float *out)
{
float fac2, mfac, fac, fac4;
int xo;
@@ -373,10 +351,8 @@ static void do_alphaunder_effect_float(float facf0, float facf1, int x, int y,
fac4 = facf1;
while (y--) {
-
x = xo;
while (x--) {
-
/* rt = rt1 under rt2 (alpha from rt2) */
/* this complex optimization is because the
@@ -405,15 +381,14 @@ static void do_alphaunder_effect_float(float facf0, float facf1, int x, int y,
rt1 += 4; rt2 += 4; rt += 4;
}
- if (y == 0) break;
+ if (y == 0)
+ break;
y--;
x = xo;
while (x--) {
-
if (rt2[3] <= 0 && fac4 >= 1.0f) {
memcpy(rt, rt1, 4 * sizeof(float));
-
}
else if (rt2[3] >= 1.0f) {
memcpy(rt, rt2, 4 * sizeof(float));
@@ -437,38 +412,25 @@ static void do_alphaunder_effect_float(float facf0, float facf1, int x, int y,
}
}
-static ImBuf *do_alphaunder_effect(
- SeqRenderData context, Sequence *UNUSED(seq), float UNUSED(cfra),
- float facf0, float facf1,
- struct ImBuf *ibuf1, struct ImBuf *ibuf2,
- struct ImBuf *ibuf3)
+static ImBuf *do_alphaunder_effect(SeqRenderData context, Sequence *UNUSED(seq), float UNUSED(cfra),
+ float facf0, float facf1, ImBuf *ibuf1, ImBuf *ibuf2, ImBuf *ibuf3)
{
- struct ImBuf *out = prepare_effect_imbufs(
- context, ibuf1, ibuf2, ibuf3);
+ struct ImBuf *out = prepare_effect_imbufs(context, ibuf1, ibuf2, ibuf3);
if (out->rect_float) {
- do_alphaunder_effect_float(
- facf0, facf1, context.rectx, context.recty,
- ibuf1->rect_float, ibuf2->rect_float,
- out->rect_float);
+ do_alphaunder_effect_float(facf0, facf1, context.rectx, context.recty, ibuf1->rect_float,
+ ibuf2->rect_float, out->rect_float);
}
else {
- do_alphaunder_effect_byte(
- facf0, facf1, context.rectx, context.recty,
- (char *) ibuf1->rect, (char *) ibuf2->rect,
- (char *) out->rect);
+ do_alphaunder_effect_byte(facf0, facf1, context.rectx, context.recty,
+ (char *) ibuf1->rect, (char *) ibuf2->rect, (char *) out->rect);
}
return out;
}
+/*********************** Cross *************************/
-/* **********************************************************************
- * CROSS
- * ********************************************************************** */
-
-static void do_cross_effect_byte(float facf0, float facf1, int x, int y,
- char *rect1, char *rect2,
- char *out)
+static void do_cross_effect_byte(float facf0, float facf1, int x, int y, char *rect1, char *rect2, char *out)
{
int fac1, fac2, fac3, fac4;
int xo;
@@ -479,16 +441,14 @@ static void do_cross_effect_byte(float facf0, float facf1, int x, int y,
rt2 = rect2;
rt = out;
- fac2 = (int)(256.0f * facf0);
+ fac2 = (int) (256.0f * facf0);
fac1 = 256 - fac2;
- fac4 = (int)(256.0f * facf1);
+ fac4 = (int) (256.0f * facf1);
fac3 = 256 - fac4;
while (y--) {
-
x = xo;
while (x--) {
-
rt[0] = (fac1 * rt1[0] + fac2 * rt2[0]) >> 8;
rt[1] = (fac1 * rt1[1] + fac2 * rt2[1]) >> 8;
rt[2] = (fac1 * rt1[2] + fac2 * rt2[2]) >> 8;
@@ -497,12 +457,12 @@ static void do_cross_effect_byte(float facf0, float facf1, int x, int y,
rt1 += 4; rt2 += 4; rt += 4;
}
- if (y == 0) break;
+ if (y == 0)
+ break;
y--;
x = xo;
while (x--) {
-
rt[0] = (fac3 * rt1[0] + fac4 * rt2[0]) >> 8;
rt[1] = (fac3 * rt1[1] + fac4 * rt2[1]) >> 8;
rt[2] = (fac3 * rt1[2] + fac4 * rt2[2]) >> 8;
@@ -514,8 +474,7 @@ static void do_cross_effect_byte(float facf0, float facf1, int x, int y,
}
}
-static void do_cross_effect_float(float facf0, float facf1, int x, int y,
- float *rect1, float *rect2, float *out)
+static void do_cross_effect_float(float facf0, float facf1, int x, int y, float *rect1, float *rect2, float *out)
{
float fac1, fac2, fac3, fac4;
int xo;
@@ -532,10 +491,8 @@ static void do_cross_effect_float(float facf0, float facf1, int x, int y,
fac3 = 1.0f - fac4;
while (y--) {
-
x = xo;
while (x--) {
-
rt[0] = fac1 * rt1[0] + fac2 * rt2[0];
rt[1] = fac1 * rt1[1] + fac2 * rt2[1];
rt[2] = fac1 * rt1[2] + fac2 * rt2[2];
@@ -544,12 +501,12 @@ static void do_cross_effect_float(float facf0, float facf1, int x, int y,
rt1 += 4; rt2 += 4; rt += 4;
}
- if (y == 0) break;
+ if (y == 0)
+ break;
y--;
x = xo;
while (x--) {
-
rt[0] = fac3 * rt1[0] + fac4 * rt2[0];
rt[1] = fac3 * rt1[1] + fac4 * rt2[1];
rt[2] = fac3 * rt1[2] + fac4 * rt2[2];
@@ -563,34 +520,23 @@ static void do_cross_effect_float(float facf0, float facf1, int x, int y,
/* careful: also used by speed effect! */
-static ImBuf *do_cross_effect(
- SeqRenderData context, Sequence *UNUSED(seq), float UNUSED(cfra),
- float facf0, float facf1,
- struct ImBuf *ibuf1, struct ImBuf *ibuf2,
- struct ImBuf *ibuf3)
+static ImBuf *do_cross_effect(SeqRenderData context, Sequence *UNUSED(seq), float UNUSED(cfra),
+ float facf0, float facf1, ImBuf *ibuf1, ImBuf *ibuf2, ImBuf *ibuf3)
{
- struct ImBuf *out = prepare_effect_imbufs(
- context, ibuf1, ibuf2, ibuf3);
+ ImBuf *out = prepare_effect_imbufs(context, ibuf1, ibuf2, ibuf3);
if (out->rect_float) {
- do_cross_effect_float(
- facf0, facf1, context.rectx, context.recty,
- ibuf1->rect_float, ibuf2->rect_float,
- out->rect_float);
+ do_cross_effect_float(facf0, facf1, context.rectx, context.recty,
+ ibuf1->rect_float, ibuf2->rect_float, out->rect_float);
}
else {
- do_cross_effect_byte(
- facf0, facf1, context.rectx, context.recty,
- (char *) ibuf1->rect, (char *) ibuf2->rect,
- (char *) out->rect);
+ do_cross_effect_byte(facf0, facf1, context.rectx, context.recty,
+ (char *) ibuf1->rect, (char *) ibuf2->rect, (char *) out->rect);
}
return out;
}
-
-/* **********************************************************************
- * GAMMA CROSS
- * ********************************************************************** */
+/*********************** Gamma Cross *************************/
/* copied code from initrender.c */
static unsigned short gamtab[65536];
@@ -614,39 +560,36 @@ static void makeGammaTables(float gamma)
/* we need two tables: one forward, one backward */
int i;
- valid_gamma = gamma;
- valid_inv_gamma = 1.0f / gamma;
+ valid_gamma = gamma;
+ valid_inv_gamma = 1.0f / gamma;
color_step = 1.0f / RE_GAMMA_TABLE_SIZE;
inv_color_step = (float) RE_GAMMA_TABLE_SIZE;
- /* We could squeeze out the two range tables to gain some memory. */
+ /* We could squeeze out the two range tables to gain some memory */
for (i = 0; i < RE_GAMMA_TABLE_SIZE; i++) {
- color_domain_table[i] = i * color_step;
- gamma_range_table[i] = pow(color_domain_table[i],
- valid_gamma);
- inv_gamma_range_table[i] = pow(color_domain_table[i],
- valid_inv_gamma);
- }
-
- /* The end of the table should match 1.0 carefully. In order to avoid */
- /* rounding errors, we just set this explicitly. The last segment may */
- /* have a different length than the other segments, but our */
- /* interpolation is insensitive to that. */
- color_domain_table[RE_GAMMA_TABLE_SIZE] = 1.0;
+ color_domain_table[i] = i * color_step;
+ gamma_range_table[i] = pow(color_domain_table[i], valid_gamma);
+ inv_gamma_range_table[i] = pow(color_domain_table[i], valid_inv_gamma);
+ }
+
+ /* The end of the table should match 1.0 carefully. In order to avoid
+ * rounding errors, we just set this explicitly. The last segment may
+ * have a different length than the other segments, but our
+ * interpolation is insensitive to that
+ */
+ color_domain_table[RE_GAMMA_TABLE_SIZE] = 1.0;
gamma_range_table[RE_GAMMA_TABLE_SIZE] = 1.0;
inv_gamma_range_table[RE_GAMMA_TABLE_SIZE] = 1.0;
- /* To speed up calculations, we make these calc factor tables. They are */
- /* multiplication factors used in scaling the interpolation. */
+ /* To speed up calculations, we make these calc factor tables. They are
+ * multiplication factors used in scaling the interpolation
+ */
for (i = 0; i < RE_GAMMA_TABLE_SIZE; i++) {
- gamfactor_table[i] = inv_color_step *
- (gamma_range_table[i + 1] - gamma_range_table[i]);
- inv_gamfactor_table[i] = inv_color_step *
- (inv_gamma_range_table[i + 1] - inv_gamma_range_table[i]);
+ gamfactor_table[i] = inv_color_step * (gamma_range_table[i + 1] - gamma_range_table[i]);
+ inv_gamfactor_table[i] = inv_color_step * (inv_gamma_range_table[i + 1] - inv_gamma_range_table[i]);
}
-} /* end of void makeGammaTables(float gamma) */
-
+}
static float gammaCorrect(float c)
{
@@ -654,17 +597,17 @@ static float gammaCorrect(float c)
float res = 0.0;
i = floor(c * inv_color_step);
- /* Clip to range [0, 1]: outside, just do the complete calculation. */
- /* We may have some performance problems here. Stretching up the LUT */
- /* may help solve that, by exchanging LUT size for the interpolation. */
- /* Negative colors are explicitly handled. */
+ /* Clip to range [0, 1]: outside, just do the complete calculation.
+ * We may have some performance problems here. Stretching up the LUT
+ * may help solve that, by exchanging LUT size for the interpolation.
+ * Negative colors are explicitly handled.
+ */
if (i < 0) res = -pow(abs(c), valid_gamma);
else if (i >= RE_GAMMA_TABLE_SIZE) res = pow(c, valid_gamma);
- else res = gamma_range_table[i] +
- ( (c - color_domain_table[i]) * gamfactor_table[i]);
+ else res = gamma_range_table[i] + ( (c - color_domain_table[i]) * gamfactor_table[i]);
return res;
-} /* end of float gammaCorrect(float col) */
+}
/* ------------------------------------------------------------------------- */
@@ -674,15 +617,13 @@ static float invGammaCorrect(float col)
float res = 0.0;
i = floor(col * inv_color_step);
- /* Negative colors are explicitly handled. */
+ /* Negative colors are explicitly handled */
if (i < 0) res = -pow(abs(col), valid_inv_gamma);
else if (i >= RE_GAMMA_TABLE_SIZE) res = pow(col, valid_inv_gamma);
- else res = inv_gamma_range_table[i] +
- ( (col - color_domain_table[i]) * inv_gamfactor_table[i]);
+ else res = inv_gamma_range_table[i] + ( (col - color_domain_table[i]) * inv_gamfactor_table[i]);
return res;
-} /* end of float invGammaCorrect(float col) */
-
+}
static void gamtabs(float gamma)
{
@@ -708,7 +649,6 @@ static void gamtabs(float gamma)
igamtab1[a - 1] = (65535.0 * pow(val, gamma)) - 1;
}
}
-
}
static void build_gammatabs(void)
@@ -732,29 +672,24 @@ static void free_gammacross(Sequence *UNUSED(seq))
{
}
-static void do_gammacross_effect_byte(float facf0, float UNUSED(facf1),
- int x, int y,
- unsigned char *rect1,
- unsigned char *rect2,
- unsigned char *out)
+static void do_gammacross_effect_byte(float facf0, float UNUSED(facf1), int x, int y, unsigned char *rect1,
+ unsigned char *rect2, unsigned char *out)
{
int fac1, fac2, col;
int xo;
unsigned char *rt1, *rt2, *rt;
xo = x;
- rt1 = (unsigned char *)rect1;
- rt2 = (unsigned char *)rect2;
- rt = (unsigned char *)out;
+ rt1 = (unsigned char *) rect1;
+ rt2 = (unsigned char *) rect2;
+ rt = (unsigned char *) out;
fac2 = (int)(256.0f * facf0);
fac1 = 256 - fac2;
while (y--) {
-
x = xo;
while (x--) {
-
col = (fac1 * igamtab1[rt1[0]] + fac2 * igamtab1[rt2[0]]) >> 8;
if (col > 65535) rt[0] = 255; else rt[0] = ( (char *)(gamtab + col))[MOST_SIG_BYTE];
col = (fac1 * igamtab1[rt1[1]] + fac2 * igamtab1[rt2[1]]) >> 8;
@@ -767,12 +702,12 @@ static void do_gammacross_effect_byte(float facf0, float UNUSED(facf1),
rt1 += 4; rt2 += 4; rt += 4;
}
- if (y == 0) break;
+ if (y == 0)
+ break;
y--;
x = xo;
while (x--) {
-
col = (fac1 * igamtab1[rt1[0]] + fac2 * igamtab1[rt2[0]]) >> 8;
if (col > 65535) rt[0] = 255; else rt[0] = ( (char *)(gamtab + col))[MOST_SIG_BYTE];
col = (fac1 * igamtab1[rt1[1]] + fac2 * igamtab1[rt2[1]]) >> 8;
@@ -785,13 +720,10 @@ static void do_gammacross_effect_byte(float facf0, float UNUSED(facf1),
rt1 += 4; rt2 += 4; rt += 4;
}
}
-
}
-static void do_gammacross_effect_float(float facf0, float UNUSED(facf1),
- int x, int y,
- float *rect1, float *rect2,
- float *out)
+static void do_gammacross_effect_float(float facf0, float UNUSED(facf1), int x, int y, float *rect1,
+ float *rect2, float *out)
{
float fac1, fac2;
int xo;
@@ -806,62 +738,48 @@ static void do_gammacross_effect_float(float facf0, float UNUSED(facf1),
fac1 = 1.0f - fac2;
while (y--) {
-
x = xo * 4;
while (x--) {
-
- *rt = gammaCorrect(
- fac1 * invGammaCorrect(*rt1) + fac2 * invGammaCorrect(*rt2));
+ *rt = gammaCorrect(fac1 * invGammaCorrect(*rt1) + fac2 * invGammaCorrect(*rt2));
rt1++; rt2++; rt++;
}
- if (y == 0) break;
+ if (y == 0)
+ break;
y--;
x = xo * 4;
while (x--) {
-
- *rt = gammaCorrect(
- fac1 * invGammaCorrect(*rt1) + fac2 * invGammaCorrect(*rt2));
+ *rt = gammaCorrect(fac1 * invGammaCorrect(*rt1) + fac2 * invGammaCorrect(*rt2));
rt1++; rt2++; rt++;
}
}
}
-static ImBuf *do_gammacross_effect(
- SeqRenderData context,
- Sequence *UNUSED(seq), float UNUSED(cfra),
- float facf0, float facf1,
- struct ImBuf *ibuf1, struct ImBuf *ibuf2,
- struct ImBuf *ibuf3)
+static ImBuf *do_gammacross_effect(SeqRenderData context, Sequence *UNUSED(seq), float UNUSED(cfra),
+ float facf0, float facf1, ImBuf *ibuf1, ImBuf *ibuf2, ImBuf *ibuf3)
{
struct ImBuf *out = prepare_effect_imbufs(context, ibuf1, ibuf2, ibuf3);
build_gammatabs();
if (out->rect_float) {
- do_gammacross_effect_float(
- facf0, facf1, context.rectx, context.recty,
- ibuf1->rect_float, ibuf2->rect_float,
- out->rect_float);
+ do_gammacross_effect_float(facf0, facf1, context.rectx, context.recty, ibuf1->rect_float,
+ ibuf2->rect_float, out->rect_float);
}
else {
- do_gammacross_effect_byte(
- facf0, facf1, context.rectx, context.recty,
- (unsigned char *) ibuf1->rect, (unsigned char *) ibuf2->rect,
- (unsigned char *) out->rect);
+ do_gammacross_effect_byte(facf0, facf1, context.rectx, context.recty,
+ (unsigned char *) ibuf1->rect, (unsigned char *) ibuf2->rect,
+ (unsigned char *) out->rect);
}
+
return out;
}
+/*********************** Add *************************/
-/* **********************************************************************
- * ADD
- * ********************************************************************** */
-
-static void do_add_effect_byte(float facf0, float facf1, int x, int y,
- unsigned char *rect1, unsigned char *rect2,
+static void do_add_effect_byte(float facf0, float facf1, int x, int y, unsigned char *rect1, unsigned char *rect2,
unsigned char *out)
{
int col, xo, fac1, fac3;
@@ -876,10 +794,9 @@ static void do_add_effect_byte(float facf0, float facf1, int x, int y,
fac3 = (int)(256.0f * facf1);
while (y--) {
-
x = xo;
- while (x--) {
+ while (x--) {
col = rt1[0] + ((fac1 * rt2[0]) >> 8);
if (col > 255) rt[0] = 255; else rt[0] = col;
col = rt1[1] + ((fac1 * rt2[1]) >> 8);
@@ -892,12 +809,12 @@ static void do_add_effect_byte(float facf0, float facf1, int x, int y,
rt1 += 4; rt2 += 4; rt += 4;
}
- if (y == 0) break;
+ if (y == 0)
+ break;
y--;
x = xo;
while (x--) {
-
col = rt1[0] + ((fac3 * rt2[0]) >> 8);
if (col > 255) rt[0] = 255; else rt[0] = col;
col = rt1[1] + ((fac3 * rt2[1]) >> 8);
@@ -912,9 +829,7 @@ static void do_add_effect_byte(float facf0, float facf1, int x, int y,
}
}
-static void do_add_effect_float(float facf0, float facf1, int x, int y,
- float *rect1, float *rect2,
- float *out)
+static void do_add_effect_float(float facf0, float facf1, int x, int y, float *rect1, float *rect2, float *out)
{
int xo;
float fac1, fac3;
@@ -929,7 +844,6 @@ static void do_add_effect_float(float facf0, float facf1, int x, int y,
fac3 = facf1;
while (y--) {
-
x = xo * 4;
while (x--) {
*rt = *rt1 + fac1 * (*rt2);
@@ -937,7 +851,8 @@ static void do_add_effect_float(float facf0, float facf1, int x, int y,
rt1++; rt2++; rt++;
}
- if (y == 0) break;
+ if (y == 0)
+ break;
y--;
x = xo * 4;
@@ -949,54 +864,41 @@ static void do_add_effect_float(float facf0, float facf1, int x, int y,
}
}
-static ImBuf *do_add_effect(SeqRenderData context,
- Sequence *UNUSED(seq), float UNUSED(cfra),
- float facf0, float facf1,
- struct ImBuf *ibuf1, struct ImBuf *ibuf2,
- struct ImBuf *ibuf3)
+static ImBuf *do_add_effect(SeqRenderData context, Sequence *UNUSED(seq), float UNUSED(cfra), float facf0, float facf1,
+ ImBuf *ibuf1, ImBuf *ibuf2, ImBuf *ibuf3)
{
struct ImBuf *out = prepare_effect_imbufs(context, ibuf1, ibuf2, ibuf3);
if (out->rect_float) {
- do_add_effect_float(
- facf0, facf1, context.rectx, context.recty,
- ibuf1->rect_float, ibuf2->rect_float,
- out->rect_float);
+ do_add_effect_float(facf0, facf1, context.rectx, context.recty, ibuf1->rect_float,
+ ibuf2->rect_float, out->rect_float);
}
else {
- do_add_effect_byte(
- facf0, facf1, context.rectx, context.recty,
- (unsigned char *) ibuf1->rect, (unsigned char *) ibuf2->rect,
- (unsigned char *) out->rect);
+ do_add_effect_byte(facf0, facf1, context.rectx, context.recty, (unsigned char *) ibuf1->rect,
+ (unsigned char *) ibuf2->rect, (unsigned char *) out->rect);
}
+
return out;
}
+/*********************** Sub *************************/
-/* **********************************************************************
- * SUB
- * ********************************************************************** */
-
-static void do_sub_effect_byte(float facf0, float facf1,
- int x, int y,
- char *rect1, char *rect2, char *out)
+static void do_sub_effect_byte(float facf0, float facf1, int x, int y, char *rect1, char *rect2, char *out)
{
int col, xo, fac1, fac3;
char *rt1, *rt2, *rt;
xo = x;
- rt1 = (char *)rect1;
- rt2 = (char *)rect2;
- rt = (char *)out;
+ rt1 = (char *) rect1;
+ rt2 = (char *) rect2;
+ rt = (char *) out;
- fac1 = (int)(256.0f * facf0);
- fac3 = (int)(256.0f * facf1);
+ fac1 = (int) (256.0f * facf0);
+ fac3 = (int) (256.0f * facf1);
while (y--) {
-
x = xo;
while (x--) {
-
col = rt1[0] - ((fac1 * rt2[0]) >> 8);
if (col < 0) rt[0] = 0; else rt[0] = col;
col = rt1[1] - ((fac1 * rt2[1]) >> 8);
@@ -1009,12 +911,12 @@ static void do_sub_effect_byte(float facf0, float facf1,
rt1 += 4; rt2 += 4; rt += 4;
}
- if (y == 0) break;
+ if (y == 0)
+ break;
y--;
x = xo;
while (x--) {
-
col = rt1[0] - ((fac3 * rt2[0]) >> 8);
if (col < 0) rt[0] = 0; else rt[0] = col;
col = rt1[1] - ((fac3 * rt2[1]) >> 8);
@@ -1029,9 +931,7 @@ static void do_sub_effect_byte(float facf0, float facf1,
}
}
-static void do_sub_effect_float(float facf0, float facf1, int x, int y,
- float *rect1, float *rect2,
- float *out)
+static void do_sub_effect_float(float facf0, float facf1, int x, int y, float *rect1, float *rect2, float *out)
{
int xo;
float fac1, fac3;
@@ -1046,7 +946,6 @@ static void do_sub_effect_float(float facf0, float facf1, int x, int y,
fac3 = facf1;
while (y--) {
-
x = xo * 4;
while (x--) {
*rt = *rt1 - fac1 * (*rt2);
@@ -1054,7 +953,8 @@ static void do_sub_effect_float(float facf0, float facf1, int x, int y,
rt1++; rt2++; rt++;
}
- if (y == 0) break;
+ if (y == 0)
+ break;
y--;
x = xo * 4;
@@ -1066,40 +966,30 @@ static void do_sub_effect_float(float facf0, float facf1, int x, int y,
}
}
-static ImBuf *do_sub_effect(
- SeqRenderData context, Sequence *UNUSED(seq), float UNUSED(cfra),
- float facf0, float facf1,
- struct ImBuf *ibuf1, struct ImBuf *ibuf2,
- struct ImBuf *ibuf3)
+static ImBuf *do_sub_effect(SeqRenderData context, Sequence *UNUSED(seq), float UNUSED(cfra), float facf0, float facf1,
+ ImBuf *ibuf1, ImBuf *ibuf2, ImBuf *ibuf3)
{
struct ImBuf *out = prepare_effect_imbufs(context, ibuf1, ibuf2, ibuf3);
if (out->rect_float) {
- do_sub_effect_float(
- facf0, facf1, context.rectx, context.recty,
- ibuf1->rect_float, ibuf2->rect_float,
- out->rect_float);
+ do_sub_effect_float(facf0, facf1, context.rectx, context.recty, ibuf1->rect_float,
+ ibuf2->rect_float, out->rect_float);
}
else {
- do_sub_effect_byte(
- facf0, facf1, context.rectx, context.recty,
- (char *) ibuf1->rect, (char *) ibuf2->rect,
- (char *) out->rect);
+ do_sub_effect_byte(facf0, facf1, context.rectx, context.recty, (char *) ibuf1->rect,
+ (char *) ibuf2->rect, (char *) out->rect);
}
+
return out;
}
-/* **********************************************************************
- * DROP
- * ********************************************************************** */
+/*********************** Drop *************************/
/* Must be > 0 or add precopy, etc to the function */
#define XOFF 8
#define YOFF 8
-static void do_drop_effect_byte(float facf0, float facf1, int x, int y,
- char *rect2i, char *rect1i,
- char *outi)
+static void do_drop_effect_byte(float facf0, float facf1, int x, int y, char *rect2i, char *rect1i, char *outi)
{
int height, width, temp, fac, fac1, fac2;
char *rt1, *rt2, *out;
@@ -1108,8 +998,8 @@ static void do_drop_effect_byte(float facf0, float facf1, int x, int y,
width = x;
height = y;
- fac1 = (int)(70.0f * facf0);
- fac2 = (int)(70.0f * facf1);
+ fac1 = (int) (70.0f * facf0);
+ fac2 = (int) (70.0f * facf1);
rt2 = (char *) (rect2i + YOFF * width);
rt1 = (char *) rect1i;
@@ -1137,9 +1027,7 @@ static void do_drop_effect_byte(float facf0, float facf1, int x, int y,
memcpy(out, rt1, sizeof(int) * YOFF * width);
}
-static void do_drop_effect_float(float facf0, float facf1, int x, int y,
- float *rect2i, float *rect1i,
- float *outi)
+static void do_drop_effect_float(float facf0, float facf1, int x, int y, float *rect2i, float *rect1i, float *outi)
{
int height, width;
float temp, fac, fac1, fac2;
@@ -1178,12 +1066,9 @@ static void do_drop_effect_float(float facf0, float facf1, int x, int y,
memcpy(out, rt1, 4 * sizeof(float) * YOFF * width);
}
-/* **********************************************************************
- * MUL
- * ********************************************************************** */
+/*********************** Mul *************************/
-static void do_mul_effect_byte(float facf0, float facf1, int x, int y,
- unsigned char *rect1, unsigned char *rect2,
+static void do_mul_effect_byte(float facf0, float facf1, int x, int y, unsigned char *rect1, unsigned char *rect2,
unsigned char *out)
{
int xo, fac1, fac3;
@@ -1231,9 +1116,7 @@ static void do_mul_effect_byte(float facf0, float facf1, int x, int y,
}
}
-static void do_mul_effect_float(float facf0, float facf1, int x, int y,
- float *rect1, float *rect2,
- float *out)
+static void do_mul_effect_float(float facf0, float facf1, int x, int y, float *rect1, float *rect2, float *out)
{
int xo;
float fac1, fac3;
@@ -1252,10 +1135,8 @@ static void do_mul_effect_float(float facf0, float facf1, int x, int y,
*/
while (y--) {
-
x = xo;
while (x--) {
-
rt[0] = rt1[0] + fac1 * rt1[0] * (rt2[0] - 1.0f);
rt[1] = rt1[1] + fac1 * rt1[1] * (rt2[1] - 1.0f);
rt[2] = rt1[2] + fac1 * rt1[2] * (rt2[2] - 1.0f);
@@ -1264,12 +1145,12 @@ static void do_mul_effect_float(float facf0, float facf1, int x, int y,
rt1 += 4; rt2 += 4; rt += 4;
}
- if (y == 0) break;
+ if (y == 0)
+ break;
y--;
x = xo;
while (x--) {
-
rt[0] = rt1[0] + fac3 * rt1[0] * (rt2[0] - 1.0f);
rt[1] = rt1[1] + fac3 * rt1[1] * (rt2[1] - 1.0f);
rt[2] = rt1[2] + fac3 * rt1[2] * (rt2[2] - 1.0f);
@@ -1280,33 +1161,24 @@ static void do_mul_effect_float(float facf0, float facf1, int x, int y,
}
}
-static ImBuf *do_mul_effect(
- SeqRenderData context, Sequence *UNUSED(seq), float UNUSED(cfra),
- float facf0, float facf1,
- struct ImBuf *ibuf1, struct ImBuf *ibuf2,
- struct ImBuf *ibuf3)
+static ImBuf *do_mul_effect(SeqRenderData context, Sequence *UNUSED(seq), float UNUSED(cfra), float facf0, float facf1,
+ ImBuf *ibuf1, ImBuf *ibuf2, ImBuf *ibuf3)
{
struct ImBuf *out = prepare_effect_imbufs(context, ibuf1, ibuf2, ibuf3);
if (out->rect_float) {
- do_mul_effect_float(
- facf0, facf1, context.rectx, context.recty,
- ibuf1->rect_float, ibuf2->rect_float,
- out->rect_float);
+ do_mul_effect_float(facf0, facf1, context.rectx, context.recty, ibuf1->rect_float,
+ ibuf2->rect_float, out->rect_float);
}
else {
- do_mul_effect_byte(
- facf0, facf1, context.rectx, context.recty,
- (unsigned char *) ibuf1->rect, (unsigned char *) ibuf2->rect,
- (unsigned char *) out->rect);
+ do_mul_effect_byte(facf0, facf1, context.rectx, context.recty, (unsigned char *) ibuf1->rect,
+ (unsigned char *) ibuf2->rect, (unsigned char *) out->rect);
}
return out;
}
-/* **********************************************************************
- * WIPE
- * ********************************************************************** */
+/*********************** Wipe *************************/
typedef struct WipeZone {
float angle;
@@ -1348,13 +1220,12 @@ static float in_band(float width, float dist, int side, int dir)
return alpha;
}
-static float check_zone(WipeZone *wipezone, int x, int y,
- Sequence *seq, float facf0)
+static float check_zone(WipeZone *wipezone, int x, int y, Sequence *seq, float facf0)
{
float posx, posy, hyp, hyp2, angle, hwidth, b1, b2, b3, pointdist;
/* some future stuff */
- // float hyp3, hyp4, b4, b5
- float temp1, temp2, temp3, temp4; //some placeholder variables
+ /* float hyp3, hyp4, b4, b5 */
+ float temp1, temp2, temp3, temp4; /* some placeholder variables */
int xo = wipezone->xo;
int yo = wipezone->yo;
float halfx = xo * 0.5f;
@@ -1412,9 +1283,9 @@ static float check_zone(WipeZone *wipezone, int x, int y,
case DO_DOUBLE_WIPE:
if (!wipe->forward)
- facf0 = 1.0f - facf0; // Go the other direction
+ facf0 = 1.0f - facf0; /* Go the other direction */
- width = wipezone->width; // calculate the blur width
+ width = wipezone->width; /* calculate the blur width */
hwidth = width * 0.5f;
if (angle == 0) {
b1 = posy * 0.5f;
@@ -1586,7 +1457,9 @@ static float check_zone(WipeZone *wipezone, int x, int y,
static void init_wipe_effect(Sequence *seq)
{
- if (seq->effectdata) MEM_freeN(seq->effectdata);
+ if (seq->effectdata)
+ MEM_freeN(seq->effectdata);
+
seq->effectdata = MEM_callocN(sizeof(struct WipeVars), "wipevars");
}
@@ -1597,7 +1470,9 @@ static int num_inputs_wipe(void)
static void free_wipe_effect(Sequence *seq)
{
- if (seq->effectdata) MEM_freeN(seq->effectdata);
+ if (seq->effectdata)
+ MEM_freeN(seq->effectdata);
+
seq->effectdata = NULL;
}
@@ -1606,9 +1481,7 @@ static void copy_wipe_effect(Sequence *dst, Sequence *src)
dst->effectdata = MEM_dupallocN(src->effectdata);
}
-static void do_wipe_effect_byte(Sequence *seq, float facf0, float UNUSED(facf1),
- int x, int y,
- unsigned char *rect1,
+static void do_wipe_effect_byte(Sequence *seq, float facf0, float UNUSED(facf1), int x, int y, unsigned char *rect1,
unsigned char *rect2, unsigned char *out)
{
WipeZone wipezone;
@@ -1667,9 +1540,7 @@ static void do_wipe_effect_byte(Sequence *seq, float facf0, float UNUSED(facf1),
}
}
-static void do_wipe_effect_float(Sequence *seq, float facf0, float UNUSED(facf1),
- int x, int y,
- float *rect1,
+static void do_wipe_effect_float(Sequence *seq, float facf0, float UNUSED(facf1), int x, int y, float *rect1,
float *rect2, float *out)
{
WipeZone wipezone;
@@ -1728,40 +1599,35 @@ static void do_wipe_effect_float(Sequence *seq, float facf0, float UNUSED(facf1)
}
}
-static ImBuf *do_wipe_effect(
- SeqRenderData context, Sequence *seq, float UNUSED(cfra),
- float facf0, float facf1,
- struct ImBuf *ibuf1, struct ImBuf *ibuf2,
- struct ImBuf *ibuf3)
+static ImBuf *do_wipe_effect(SeqRenderData context, Sequence *seq, float UNUSED(cfra), float facf0, float facf1,
+ ImBuf *ibuf1, ImBuf *ibuf2, ImBuf *ibuf3)
{
struct ImBuf *out = prepare_effect_imbufs(context, ibuf1, ibuf2, ibuf3);
if (out->rect_float) {
- do_wipe_effect_float(seq,
- facf0, facf1, context.rectx, context.recty,
- ibuf1->rect_float, ibuf2->rect_float,
- out->rect_float);
+ do_wipe_effect_float(seq, facf0, facf1, context.rectx, context.recty, ibuf1->rect_float,
+ ibuf2->rect_float, out->rect_float);
}
else {
- do_wipe_effect_byte(seq,
- facf0, facf1, context.rectx, context.recty,
- (unsigned char *) ibuf1->rect, (unsigned char *) ibuf2->rect,
- (unsigned char *) out->rect);
+ do_wipe_effect_byte(seq, facf0, facf1, context.rectx, context.recty, (unsigned char *) ibuf1->rect,
+ (unsigned char *) ibuf2->rect, (unsigned char *) out->rect);
}
return out;
}
-/* **********************************************************************
- * TRANSFORM
- * ********************************************************************** */
+
+/*********************** Transform *************************/
+
static void init_transform_effect(Sequence *seq)
{
TransformVars *transform;
- if (seq->effectdata) MEM_freeN(seq->effectdata);
+ if (seq->effectdata)
+ MEM_freeN(seq->effectdata);
+
seq->effectdata = MEM_callocN(sizeof(struct TransformVars), "transformvars");
- transform = (TransformVars *)seq->effectdata;
+ transform = (TransformVars *) seq->effectdata;
transform->ScalexIni = 1.0f;
transform->ScaleyIni = 1.0f;
@@ -1792,9 +1658,8 @@ static void copy_transform_effect(Sequence *dst, Sequence *src)
dst->effectdata = MEM_dupallocN(src->effectdata);
}
-static void transform_image(int x, int y, struct ImBuf *ibuf1, struct ImBuf *out,
- float scale_x, float scale_y, float translate_x, float translate_y,
- float rotate, int interpolation)
+static void transform_image(int x, int y, ImBuf *ibuf1, ImBuf *out, float scale_x, float scale_y,
+ float translate_x, float translate_y, float rotate, int interpolation)
{
int xo, yo, xi, yi;
float xt, yt, xr, yr;
@@ -1803,30 +1668,29 @@ static void transform_image(int x, int y, struct ImBuf *ibuf1, struct ImBuf *out
xo = x;
yo = y;
- // Rotate
+ /* Rotate */
s = sin(rotate);
c = cos(rotate);
for (yi = 0; yi < yo; yi++) {
for (xi = 0; xi < xo; xi++) {
-
- //translate point
+ /* translate point */
xt = xi - translate_x;
yt = yi - translate_y;
- //rotate point with center ref
+ /* rotate point with center ref */
xr = c * xt + s * yt;
yr = -s * xt + c * yt;
- //scale point with center ref
+ /* scale point with center ref */
xt = xr / scale_x;
yt = yr / scale_y;
- //undo reference center point
+ /* undo reference center point */
xt += (xo / 2.0f);
yt += (yo / 2.0f);
- //interpolate
+ /* interpolate */
switch (interpolation) {
case 0:
neareast_interpolation(ibuf1, out, xt, yt, xi, yi);
@@ -1842,10 +1706,9 @@ static void transform_image(int x, int y, struct ImBuf *ibuf1, struct ImBuf *out
}
}
-static void do_transform(Scene *scene, Sequence *seq, float UNUSED(facf0), int x, int y,
- struct ImBuf *ibuf1, struct ImBuf *out)
+static void do_transform(Scene *scene, Sequence *seq, float UNUSED(facf0), int x, int y, ImBuf *ibuf1, ImBuf *out)
{
- TransformVars *transform = (TransformVars *)seq->effectdata;
+ TransformVars *transform = (TransformVars *) seq->effectdata;
float scale_x, scale_y, translate_x, translate_y, rotate_radians;
/* Scale */
@@ -1876,28 +1739,19 @@ static void do_transform(Scene *scene, Sequence *seq, float UNUSED(facf0), int x
}
-static ImBuf *do_transform_effect(
- SeqRenderData context, Sequence *seq, float UNUSED(cfra),
- float facf0, float UNUSED(facf1),
- struct ImBuf *ibuf1, struct ImBuf *ibuf2,
- struct ImBuf *ibuf3)
+static ImBuf *do_transform_effect(SeqRenderData context, Sequence *seq, float UNUSED(cfra), float facf0,
+ float UNUSED(facf1), ImBuf *ibuf1, ImBuf *ibuf2, ImBuf *ibuf3)
{
struct ImBuf *out = prepare_effect_imbufs(context, ibuf1, ibuf2, ibuf3);
- do_transform(context.scene, seq, facf0,
- context.rectx, context.recty, ibuf1, out);
+ do_transform(context.scene, seq, facf0, context.rectx, context.recty, ibuf1, out);
return out;
}
+/*********************** Glow *************************/
-/* **********************************************************************
- * GLOW
- * ********************************************************************** */
-
-static void RVBlurBitmap2_byte(unsigned char *map, int width, int height,
- float blur,
- int quality)
+static void RVBlurBitmap2_byte(unsigned char *map, int width, int height, float blur, int quality)
/* MUUUCCH better than the previous blur. */
/* We do the blurring in two passes which is a whole lot faster. */
/* I changed the math arount to implement an actual Gaussian */
@@ -1913,16 +1767,16 @@ static void RVBlurBitmap2_byte(unsigned char *map, int width, int height,
int index, ix, halfWidth;
float fval, k, curColor[3], curColor2[3], weight = 0;
- /* If we're not really blurring, bail out */
+ /* If we're not really blurring, bail out */
if (blur <= 0)
return;
- /* Allocate memory for the tempmap and the blur filter matrix */
+ /*Allocate memory for the tempmap and the blur filter matrix */
temp = MEM_mallocN((width * height * 4), "blurbitmaptemp");
if (!temp)
return;
- /* Allocate memory for the filter elements */
+ /*Allocate memory for the filter elements */
halfWidth = ((quality + 1) * blur);
filter = (float *)MEM_mallocN(sizeof(float) * halfWidth * 2, "blurbitmapfilter");
if (!filter) {
@@ -1930,11 +1784,10 @@ static void RVBlurBitmap2_byte(unsigned char *map, int width, int height,
return;
}
- /* Apparently we're calculating a bell curve */
- /* based on the standard deviation (or radius) */
- /* This code is based on an example */
- /* posted to comp.graphics.algorithms by */
- /* Blancmange (bmange@airdmhor.gen.nz) */
+ /* Apparently we're calculating a bell curve based on the standard deviation (or radius)
+ * This code is based on an example posted to comp.graphics.algorithms by
+ * Blancmange (bmange@airdmhor.gen.nz)
+ */
k = -1.0f / (2.0f * (float)M_PI * blur * blur);
for (ix = 0; ix < halfWidth; ix++) {
@@ -1944,7 +1797,7 @@ static void RVBlurBitmap2_byte(unsigned char *map, int width, int height,
}
filter[0] = weight;
- /* Normalize the array */
+ /* Normalize the array */
fval = 0;
for (ix = 0; ix < halfWidth * 2; ix++)
fval += filter[ix];
@@ -1952,9 +1805,9 @@ static void RVBlurBitmap2_byte(unsigned char *map, int width, int height,
for (ix = 0; ix < halfWidth * 2; ix++)
filter[ix] /= fval;
- /* Blur the rows */
+ /* Blur the rows */
for (y = 0; y < height; y++) {
- /* Do the left & right strips */
+ /* Do the left & right strips */
for (x = 0; x < halfWidth; x++) {
index = (x + y * width) * 4;
fx = 0;
@@ -1967,12 +1820,9 @@ static void RVBlurBitmap2_byte(unsigned char *map, int width, int height,
curColor[1] += map[(i + y * width) * 4 + GlowG] * filter[fx];
curColor[2] += map[(i + y * width) * 4 + GlowB] * filter[fx];
- curColor2[0] += map[(width - 1 - i + y * width) * 4 + GlowR] *
- filter[fx];
- curColor2[1] += map[(width - 1 - i + y * width) * 4 + GlowG] *
- filter[fx];
- curColor2[2] += map[(width - 1 - i + y * width) * 4 + GlowB] *
- filter[fx];
+ curColor2[0] += map[(width - 1 - i + y * width) * 4 + GlowR] * filter[fx];
+ curColor2[1] += map[(width - 1 - i + y * width) * 4 + GlowG] * filter[fx];
+ curColor2[2] += map[(width - 1 - i + y * width) * 4 + GlowB] * filter[fx];
}
fx++;
}
@@ -1985,7 +1835,8 @@ static void RVBlurBitmap2_byte(unsigned char *map, int width, int height,
temp[((width - 1 - x + y * width) * 4) + GlowB] = curColor2[2];
}
- /* Do the main body */
+
+ /* Do the main body */
for (x = halfWidth; x < width - halfWidth; x++) {
index = (x + y * width) * 4;
fx = 0;
@@ -2002,13 +1853,12 @@ static void RVBlurBitmap2_byte(unsigned char *map, int width, int height,
}
}
- /* Swap buffers */
+ /* Swap buffers */
swap = temp; temp = map; map = swap;
-
- /* Blur the columns */
+ /* Blur the columns */
for (x = 0; x < width; x++) {
- /* Do the top & bottom strips */
+ /* Do the top & bottom strips */
for (y = 0; y < halfWidth; y++) {
index = (x + y * width) * 4;
fy = 0;
@@ -2016,18 +1866,15 @@ static void RVBlurBitmap2_byte(unsigned char *map, int width, int height,
zero_v3(curColor2);
for (i = y - halfWidth; i < y + halfWidth; i++) {
if ((i >= 0) && (i < height)) {
- /* Bottom */
+ /* Bottom */
curColor[0] += map[(x + i * width) * 4 + GlowR] * filter[fy];
curColor[1] += map[(x + i * width) * 4 + GlowG] * filter[fy];
curColor[2] += map[(x + i * width) * 4 + GlowB] * filter[fy];
- /* Top */
- curColor2[0] += map[(x + (height - 1 - i) * width) *
- 4 + GlowR] * filter[fy];
- curColor2[1] += map[(x + (height - 1 - i) * width) *
- 4 + GlowG] * filter[fy];
- curColor2[2] += map[(x + (height - 1 - i) * width) *
- 4 + GlowB] * filter[fy];
+ /* Top */
+ curColor2[0] += map[(x + (height - 1 - i) * width) * 4 + GlowR] * filter[fy];
+ curColor2[1] += map[(x + (height - 1 - i) * width) * 4 + GlowG] * filter[fy];
+ curColor2[2] += map[(x + (height - 1 - i) * width) * 4 + GlowB] * filter[fy];
}
fy++;
}
@@ -2038,7 +1885,8 @@ static void RVBlurBitmap2_byte(unsigned char *map, int width, int height,
temp[((x + (height - 1 - y) * width) * 4) + GlowG] = curColor2[1];
temp[((x + (height - 1 - y) * width) * 4) + GlowB] = curColor2[2];
}
- /* Do the main body */
+
+ /* Do the main body */
for (y = halfWidth; y < height - halfWidth; y++) {
index = (x + y * width) * 4;
fy = 0;
@@ -2055,18 +1903,15 @@ static void RVBlurBitmap2_byte(unsigned char *map, int width, int height,
}
}
-
- /* Swap buffers */
+ /* Swap buffers */
swap = temp; temp = map; /* map = swap; */ /* UNUSED */
- /* Tidy up */
+ /* Tidy up */
MEM_freeN(filter);
MEM_freeN(temp);
}
-static void RVBlurBitmap2_float(float *map, int width, int height,
- float blur,
- int quality)
+static void RVBlurBitmap2_float(float *map, int width, int height, float blur, int quality)
/* MUUUCCH better than the previous blur. */
/* We do the blurring in two passes which is a whole lot faster. */
/* I changed the math arount to implement an actual Gaussian */
@@ -2077,21 +1922,21 @@ static void RVBlurBitmap2_float(float *map, int width, int height,
/*=============================== */
{
float *temp = NULL, *swap;
- float *filter = NULL;
+ float *filter = NULL;
int x, y, i, fx, fy;
int index, ix, halfWidth;
float fval, k, curColor[3], curColor2[3], weight = 0;
- /* If we're not really blurring, bail out */
+ /* If we're not really blurring, bail out */
if (blur <= 0)
return;
- /* Allocate memory for the tempmap and the blur filter matrix */
+ /* Allocate memory for the tempmap and the blur filter matrix */
temp = MEM_mallocN((width * height * 4 * sizeof(float)), "blurbitmaptemp");
if (!temp)
return;
- /* Allocate memory for the filter elements */
+ /* Allocate memory for the filter elements */
halfWidth = ((quality + 1) * blur);
filter = (float *)MEM_mallocN(sizeof(float) * halfWidth * 2, "blurbitmapfilter");
if (!filter) {
@@ -2099,11 +1944,10 @@ static void RVBlurBitmap2_float(float *map, int width, int height,
return;
}
- /* Apparently we're calculating a bell curve */
- /* based on the standard deviation (or radius) */
- /* This code is based on an example */
- /* posted to comp.graphics.algorithms by */
- /* Blancmange (bmange@airdmhor.gen.nz) */
+ /* Apparently we're calculating a bell curve based on the standard deviation (or radius)
+ * This code is based on an example posted to comp.graphics.algorithms by
+ * Blancmange (bmange@airdmhor.gen.nz)
+ */
k = -1.0f / (2.0f * (float)M_PI * blur * blur);
@@ -2114,7 +1958,7 @@ static void RVBlurBitmap2_float(float *map, int width, int height,
}
filter[0] = weight;
- /* Normalize the array */
+ /* Normalize the array */
fval = 0;
for (ix = 0; ix < halfWidth * 2; ix++)
fval += filter[ix];
@@ -2122,9 +1966,9 @@ static void RVBlurBitmap2_float(float *map, int width, int height,
for (ix = 0; ix < halfWidth * 2; ix++)
filter[ix] /= fval;
- /* Blur the rows */
+ /* Blur the rows */
for (y = 0; y < height; y++) {
- /* Do the left & right strips */
+ /* Do the left & right strips */
for (x = 0; x < halfWidth; x++) {
index = (x + y * width) * 4;
fx = 0;
@@ -2137,12 +1981,9 @@ static void RVBlurBitmap2_float(float *map, int width, int height,
curColor[1] += map[(i + y * width) * 4 + GlowG] * filter[fx];
curColor[2] += map[(i + y * width) * 4 + GlowB] * filter[fx];
- curColor2[0] += map[(width - 1 - i + y * width) * 4 + GlowR] *
- filter[fx];
- curColor2[1] += map[(width - 1 - i + y * width) * 4 + GlowG] *
- filter[fx];
- curColor2[2] += map[(width - 1 - i + y * width) * 4 + GlowB] *
- filter[fx];
+ curColor2[0] += map[(width - 1 - i + y * width) * 4 + GlowR] * filter[fx];
+ curColor2[1] += map[(width - 1 - i + y * width) * 4 + GlowG] * filter[fx];
+ curColor2[2] += map[(width - 1 - i + y * width) * 4 + GlowB] * filter[fx];
}
fx++;
}
@@ -2155,7 +1996,8 @@ static void RVBlurBitmap2_float(float *map, int width, int height,
temp[((width - 1 - x + y * width) * 4) + GlowB] = curColor2[2];
}
- /* Do the main body */
+
+ /* Do the main body */
for (x = halfWidth; x < width - halfWidth; x++) {
index = (x + y * width) * 4;
fx = 0;
@@ -2172,13 +2014,12 @@ static void RVBlurBitmap2_float(float *map, int width, int height,
}
}
- /* Swap buffers */
+ /* Swap buffers */
swap = temp; temp = map; map = swap;
-
- /* Blur the columns */
+ /* Blur the columns */
for (x = 0; x < width; x++) {
- /* Do the top & bottom strips */
+ /* Do the top & bottom strips */
for (y = 0; y < halfWidth; y++) {
index = (x + y * width) * 4;
fy = 0;
@@ -2186,18 +2027,15 @@ static void RVBlurBitmap2_float(float *map, int width, int height,
zero_v3(curColor2);
for (i = y - halfWidth; i < y + halfWidth; i++) {
if ((i >= 0) && (i < height)) {
- /* Bottom */
+ /* Bottom */
curColor[0] += map[(x + i * width) * 4 + GlowR] * filter[fy];
curColor[1] += map[(x + i * width) * 4 + GlowG] * filter[fy];
curColor[2] += map[(x + i * width) * 4 + GlowB] * filter[fy];
- /* Top */
- curColor2[0] += map[(x + (height - 1 - i) * width) *
- 4 + GlowR] * filter[fy];
- curColor2[1] += map[(x + (height - 1 - i) * width) *
- 4 + GlowG] * filter[fy];
- curColor2[2] += map[(x + (height - 1 - i) * width) *
- 4 + GlowB] * filter[fy];
+ /* Top */
+ curColor2[0] += map[(x + (height - 1 - i) * width) * 4 + GlowR] * filter[fy];
+ curColor2[1] += map[(x + (height - 1 - i) * width) * 4 + GlowG] * filter[fy];
+ curColor2[2] += map[(x + (height - 1 - i) * width) * 4 + GlowB] * filter[fy];
}
fy++;
}
@@ -2208,7 +2046,8 @@ static void RVBlurBitmap2_float(float *map, int width, int height,
temp[((x + (height - 1 - y) * width) * 4) + GlowG] = curColor2[1];
temp[((x + (height - 1 - y) * width) * 4) + GlowB] = curColor2[2];
}
- /* Do the main body */
+
+ /* Do the main body */
for (y = halfWidth; y < height - halfWidth; y++) {
index = (x + y * width) * 4;
fy = 0;
@@ -2225,11 +2064,10 @@ static void RVBlurBitmap2_float(float *map, int width, int height,
}
}
-
- /* Swap buffers */
+ /* Swap buffers */
swap = temp; temp = map; /* map = swap; */ /* UNUSED */
- /* Tidy up */
+ /* Tidy up */
MEM_freeN(filter);
MEM_freeN(temp);
}
@@ -2254,8 +2092,7 @@ static void RVAddBitmaps_byte(unsigned char *a, unsigned char *b, unsigned char
}
}
-static void RVAddBitmaps_float(float *a, float *b, float *c,
- int width, int height)
+static void RVAddBitmaps_float(float *a, float *b, float *c, int width, int height)
{
int x, y, index;
@@ -2270,21 +2107,20 @@ static void RVAddBitmaps_float(float *a, float *b, float *c,
}
}
-/* For each pixel whose total luminance exceeds the threshold, */
-/* Multiply it's value by BOOST and add it to the output map */
-static void RVIsolateHighlights_byte(unsigned char *in, unsigned char *out,
- int width, int height, int threshold,
+/* For each pixel whose total luminance exceeds the threshold,
+ * Multiply it's value by BOOST and add it to the output map
+ */
+static void RVIsolateHighlights_byte(unsigned char *in, unsigned char *out, int width, int height, int threshold,
float boost, float clamp)
{
int x, y, index;
int intensity;
-
for (y = 0; y < height; y++) {
for (x = 0; x < width; x++) {
index = (x + y * width) * 4;
- /* Isolate the intensity */
+ /* Isolate the intensity */
intensity = (in[index + GlowR] + in[index + GlowG] + in[index + GlowB] - threshold);
if (intensity > 0) {
out[index + GlowR] = MIN2(255 * clamp, (in[index + GlowR] * boost * intensity) / 255);
@@ -2302,19 +2138,16 @@ static void RVIsolateHighlights_byte(unsigned char *in, unsigned char *out,
}
}
-static void RVIsolateHighlights_float(float *in, float *out,
- int width, int height, float threshold,
- float boost, float clamp)
+static void RVIsolateHighlights_float(float *in, float *out, int width, int height, float threshold, float boost, float clamp)
{
int x, y, index;
float intensity;
-
for (y = 0; y < height; y++) {
for (x = 0; x < width; x++) {
index = (x + y * width) * 4;
- /* Isolate the intensity */
+ /* Isolate the intensity */
intensity = (in[index + GlowR] + in[index + GlowG] + in[index + GlowB] - threshold);
if (intensity > 0) {
out[index + GlowR] = MIN2(clamp, (in[index + GlowR] * boost * intensity));
@@ -2336,7 +2169,9 @@ static void init_glow_effect(Sequence *seq)
{
GlowVars *glow;
- if (seq->effectdata) MEM_freeN(seq->effectdata);
+ if (seq->effectdata)
+ MEM_freeN(seq->effectdata);
+
seq->effectdata = MEM_callocN(sizeof(struct GlowVars), "glowvars");
glow = (GlowVars *)seq->effectdata;
@@ -2355,7 +2190,9 @@ static int num_inputs_glow(void)
static void free_glow_effect(Sequence *seq)
{
- if (seq->effectdata) MEM_freeN(seq->effectdata);
+ if (seq->effectdata)
+ MEM_freeN(seq->effectdata);
+
seq->effectdata = NULL;
}
@@ -2364,10 +2201,8 @@ static void copy_glow_effect(Sequence *dst, Sequence *src)
dst->effectdata = MEM_dupallocN(src->effectdata);
}
-//void do_glow_effect(Cast *cast, float facf0, float facf1, int xo, int yo, ImBuf *ibuf1, ImBuf *ibuf2, ImBuf *outbuf, ImBuf *use)
-static void do_glow_effect_byte(Sequence *seq, int render_size, float facf0, float UNUSED(facf1),
- int x, int y, char *rect1,
- char *UNUSED(rect2), char *out)
+static void do_glow_effect_byte(Sequence *seq, int render_size, float facf0, float UNUSED(facf1), int x, int y,
+ char *rect1, char *UNUSED(rect2), char *out)
{
unsigned char *outbuf = (unsigned char *)out;
unsigned char *inbuf = (unsigned char *)rect1;
@@ -2379,8 +2214,7 @@ static void do_glow_effect_byte(Sequence *seq, int render_size, float facf0, flo
RVAddBitmaps_byte(inbuf, outbuf, outbuf, x, y);
}
-static void do_glow_effect_float(Sequence *seq, int render_size, float facf0, float UNUSED(facf1),
- int x, int y,
+static void do_glow_effect_float(Sequence *seq, int render_size, float facf0, float UNUSED(facf1), int x, int y,
float *rect1, float *UNUSED(rect2), float *out)
{
float *outbuf = out;
@@ -2393,43 +2227,34 @@ static void do_glow_effect_float(Sequence *seq, int render_size, float facf0, fl
RVAddBitmaps_float(inbuf, outbuf, outbuf, x, y);
}
-static ImBuf *do_glow_effect(
- SeqRenderData context, Sequence *seq, float UNUSED(cfra),
- float facf0, float facf1,
- struct ImBuf *ibuf1, struct ImBuf *ibuf2,
- struct ImBuf *ibuf3)
+static ImBuf *do_glow_effect(SeqRenderData context, Sequence *seq, float UNUSED(cfra), float facf0, float facf1,
+ ImBuf *ibuf1, ImBuf *ibuf2, ImBuf *ibuf3)
{
struct ImBuf *out = prepare_effect_imbufs(context, ibuf1, ibuf2, ibuf3);
int render_size = 100 * context.rectx / context.scene->r.xsch;
if (out->rect_float) {
- do_glow_effect_float(seq, render_size,
- facf0, facf1,
- context.rectx, context.recty,
- ibuf1->rect_float, ibuf2->rect_float,
- out->rect_float);
+ do_glow_effect_float(seq, render_size, facf0, facf1, context.rectx, context.recty,
+ ibuf1->rect_float, ibuf2->rect_float, out->rect_float);
}
else {
- do_glow_effect_byte(seq, render_size,
- facf0, facf1,
- context.rectx, context.recty,
- (char *) ibuf1->rect, (char *) ibuf2->rect,
- (char *) out->rect);
+ do_glow_effect_byte(seq, render_size, facf0, facf1, context.rectx, context.recty,
+ (char *) ibuf1->rect, (char *) ibuf2->rect, (char *) out->rect);
}
return out;
}
-/* **********************************************************************
- * SOLID COLOR
- * ********************************************************************** */
+/*********************** Solid color *************************/
static void init_solid_color(Sequence *seq)
{
SolidColorVars *cv;
- if (seq->effectdata) MEM_freeN(seq->effectdata);
+ if (seq->effectdata)
+ MEM_freeN(seq->effectdata);
+
seq->effectdata = MEM_callocN(sizeof(struct SolidColorVars), "solidcolor");
cv = (SolidColorVars *)seq->effectdata;
@@ -2443,7 +2268,9 @@ static int num_inputs_color(void)
static void free_solid_color(Sequence *seq)
{
- if (seq->effectdata) MEM_freeN(seq->effectdata);
+ if (seq->effectdata)
+ MEM_freeN(seq->effectdata);
+
seq->effectdata = NULL;
}
@@ -2452,19 +2279,15 @@ static void copy_solid_color(Sequence *dst, Sequence *src)
dst->effectdata = MEM_dupallocN(src->effectdata);
}
-static int early_out_color(struct Sequence *UNUSED(seq),
- float UNUSED(facf0), float UNUSED(facf1))
+static int early_out_color(Sequence *UNUSED(seq), float UNUSED(facf0), float UNUSED(facf1))
{
return -1;
}
-static ImBuf *do_solid_color(
- SeqRenderData context, Sequence *seq, float UNUSED(cfra),
- float facf0, float facf1,
- struct ImBuf *ibuf1, struct ImBuf *ibuf2,
- struct ImBuf *ibuf3)
+static ImBuf *do_solid_color(SeqRenderData context, Sequence *seq, float UNUSED(cfra), float facf0, float facf1,
+ ImBuf *ibuf1, ImBuf *ibuf2, ImBuf *ibuf3)
{
- struct ImBuf *out = prepare_effect_imbufs(context, ibuf1, ibuf2, ibuf3);
+ ImBuf *out = prepare_effect_imbufs(context, ibuf1, ibuf2, ibuf3);
SolidColorVars *cv = (SolidColorVars *)seq->effectdata;
@@ -2541,9 +2364,7 @@ static ImBuf *do_solid_color(
return out;
}
-/* **********************************************************************
- * MULTICAM
- * ********************************************************************** */
+/*********************** Mulitcam *************************/
/* no effect inputs for multicam, we use give_ibuf_seq */
static int num_inputs_multicam(void)
@@ -2556,14 +2377,11 @@ static int early_out_multicam(struct Sequence *UNUSED(seq), float UNUSED(facf0),
return -1;
}
-static ImBuf *do_multicam(
- SeqRenderData context, Sequence *seq, float cfra,
- float UNUSED(facf0), float UNUSED(facf1),
- struct ImBuf *UNUSED(ibuf1), struct ImBuf *UNUSED(ibuf2),
- struct ImBuf *UNUSED(ibuf3))
+static ImBuf *do_multicam(SeqRenderData context, Sequence *seq, float cfra, float UNUSED(facf0), float UNUSED(facf1),
+ ImBuf *UNUSED(ibuf1), ImBuf *UNUSED(ibuf2), ImBuf *UNUSED(ibuf3))
{
- struct ImBuf *i;
- struct ImBuf *out;
+ ImBuf *i;
+ ImBuf *out;
Editing *ed;
ListBase *seqbasep;
@@ -2596,9 +2414,7 @@ static ImBuf *do_multicam(
return out;
}
-/* **********************************************************************
- * ADJUSTMENT
- * ********************************************************************** */
+/*********************** Adjustment *************************/
/* no effect inputs for adjustment, we use give_ibuf_seq */
static int num_inputs_adjustment(void)
@@ -2606,7 +2422,7 @@ static int num_inputs_adjustment(void)
return 0;
}
-static int early_out_adjustment(struct Sequence *UNUSED(seq), float UNUSED(facf0), float UNUSED(facf1))
+static int early_out_adjustment(Sequence *UNUSED(seq), float UNUSED(facf0), float UNUSED(facf1))
{
return -1;
}
@@ -2615,20 +2431,19 @@ static ImBuf *do_adjustment_impl(SeqRenderData context, Sequence *seq, float cfr
{
Editing *ed;
ListBase *seqbasep;
- struct ImBuf *i = NULL;
+ ImBuf *i = NULL;
ed = context.scene->ed;
seqbasep = seq_seqbase(&ed->seqbase, seq);
if (seq->machine > 0) {
- i = give_ibuf_seqbase(context, cfra,
- seq->machine - 1, seqbasep);
+ i = give_ibuf_seqbase(context, cfra, seq->machine - 1, seqbasep);
}
/* found nothing? so let's work the way up the metastrip stack, so
- * that it is possible to group a bunch of adjustment strips into
- * a metastrip and have that work on everything below the metastrip
+ * that it is possible to group a bunch of adjustment strips into
+ * a metastrip and have that work on everything below the metastrip
*/
if (!i) {
@@ -2644,14 +2459,11 @@ static ImBuf *do_adjustment_impl(SeqRenderData context, Sequence *seq, float cfr
return i;
}
-static ImBuf *do_adjustment(
- SeqRenderData context, Sequence *seq, float cfra,
- float UNUSED(facf0), float UNUSED(facf1),
- struct ImBuf *UNUSED(ibuf1), struct ImBuf *UNUSED(ibuf2),
- struct ImBuf *UNUSED(ibuf3))
+static ImBuf *do_adjustment(SeqRenderData context, Sequence *seq, float cfra, float UNUSED(facf0), float UNUSED(facf1),
+ ImBuf *UNUSED(ibuf1), ImBuf *UNUSED(ibuf2), ImBuf *UNUSED(ibuf3))
{
- struct ImBuf *i = NULL;
- struct ImBuf *out;
+ ImBuf *i = NULL;
+ ImBuf *out;
Editing *ed;
ed = context.scene->ed;
@@ -2673,16 +2485,16 @@ static ImBuf *do_adjustment(
return out;
}
-/* **********************************************************************
- * SPEED
- * ********************************************************************** */
+/*********************** Speed *************************/
+
static void init_speed_effect(Sequence *seq)
{
SpeedControlVars *v;
- if (seq->effectdata) MEM_freeN(seq->effectdata);
- seq->effectdata = MEM_callocN(sizeof(struct SpeedControlVars),
- "speedcontrolvars");
+ if (seq->effectdata)
+ MEM_freeN(seq->effectdata);
+
+ seq->effectdata = MEM_callocN(sizeof(struct SpeedControlVars), "speedcontrolvars");
v = (SpeedControlVars *)seq->effectdata;
v->globalSpeed = 1.0;
@@ -2707,8 +2519,10 @@ static int num_inputs_speed(void)
static void free_speed_effect(Sequence *seq)
{
SpeedControlVars *v = (SpeedControlVars *)seq->effectdata;
- if (v->frameMap) MEM_freeN(v->frameMap);
- if (seq->effectdata) MEM_freeN(seq->effectdata);
+ if (v->frameMap)
+ MEM_freeN(v->frameMap);
+ if (seq->effectdata)
+ MEM_freeN(seq->effectdata);
seq->effectdata = NULL;
}
@@ -2721,14 +2535,12 @@ static void copy_speed_effect(Sequence *dst, Sequence *src)
v->length = 0;
}
-static int early_out_speed(struct Sequence *UNUSED(seq),
- float UNUSED(facf0), float UNUSED(facf1))
+static int early_out_speed(Sequence *UNUSED(seq), float UNUSED(facf0), float UNUSED(facf1))
{
return 1;
}
-static void store_icu_yrange_speed(struct Sequence *seq,
- short UNUSED(adrcode), float *ymin, float *ymax)
+static void store_icu_yrange_speed(Sequence *seq, short UNUSED(adrcode), float *ymin, float *ymax)
{
SpeedControlVars *v = (SpeedControlVars *)seq->effectdata;
@@ -2750,11 +2562,12 @@ static void store_icu_yrange_speed(struct Sequence *seq,
}
}
}
+
void sequence_effect_speed_rebuild_map(Scene *scene, Sequence *seq, int force)
{
int cfra;
float fallback_fac = 1.0f;
- SpeedControlVars *v = (SpeedControlVars *)seq->effectdata;
+ SpeedControlVars *v = (SpeedControlVars *) seq->effectdata;
FCurve *fcu = NULL;
int flags = v->flags;
@@ -2782,8 +2595,7 @@ void sequence_effect_speed_rebuild_map(Scene *scene, Sequence *seq, int force)
v->length = seq->len;
- v->frameMap = MEM_callocN(sizeof(float) * v->length,
- "speedcontrol frameMap");
+ v->frameMap = MEM_callocN(sizeof(float) * v->length, "speedcontrol frameMap");
}
fallback_fac = 1.0;
@@ -2792,8 +2604,7 @@ void sequence_effect_speed_rebuild_map(Scene *scene, Sequence *seq, int force)
if ((seq->seq1->enddisp != seq->seq1->start) &&
(seq->seq1->len != 0))
{
- fallback_fac = (float) seq->seq1->len /
- (float) (seq->seq1->enddisp - seq->seq1->start);
+ fallback_fac = (float) seq->seq1->len / (float) (seq->seq1->enddisp - seq->seq1->start);
flags = SEQ_SPEED_INTEGRATE;
fcu = NULL;
}
@@ -2861,22 +2672,19 @@ void sequence_effect_speed_rebuild_map(Scene *scene, Sequence *seq, int force)
}
}
-/* **********************************************************************
- * sequence effect factory
- * ********************************************************************** */
-
+/*********************** sequence effect factory *************************/
-static void init_noop(struct Sequence *UNUSED(seq))
+static void init_noop(Sequence *UNUSED(seq))
{
}
-static void load_noop(struct Sequence *UNUSED(seq))
+static void load_noop(Sequence *UNUSED(seq))
{
}
-static void free_noop(struct Sequence *UNUSED(seq))
+static void free_noop(Sequence *UNUSED(seq))
{
}
@@ -2886,14 +2694,12 @@ static int num_inputs_default(void)
return 2;
}
-static int early_out_noop(struct Sequence *UNUSED(seq),
- float UNUSED(facf0), float UNUSED(facf1))
+static int early_out_noop(Sequence *UNUSED(seq), float UNUSED(facf0), float UNUSED(facf1))
{
return 0;
}
-static int early_out_fade(struct Sequence *UNUSED(seq),
- float facf0, float facf1)
+static int early_out_fade(Sequence *UNUSED(seq), float facf0, float facf1)
{
if (facf0 == 0.0f && facf1 == 0.0f) {
return 1;
@@ -2904,8 +2710,7 @@ static int early_out_fade(struct Sequence *UNUSED(seq),
return 0;
}
-static int early_out_mul_input2(struct Sequence *UNUSED(seq),
- float facf0, float facf1)
+static int early_out_mul_input2(Sequence *UNUSED(seq), float facf0, float facf1)
{
if (facf0 == 0.0f && facf1 == 0.0f) {
return 1;
@@ -2913,20 +2718,17 @@ static int early_out_mul_input2(struct Sequence *UNUSED(seq),
return 0;
}
-static void store_icu_yrange_noop(struct Sequence *UNUSED(seq),
- short UNUSED(adrcode), float *UNUSED(ymin), float *UNUSED(ymax))
+static void store_icu_yrange_noop(Sequence *UNUSED(seq), short UNUSED(adrcode), float *UNUSED(ymin), float *UNUSED(ymax))
{
/* defaults are fine */
}
-static void get_default_fac_noop(struct Sequence *UNUSED(seq), float UNUSED(cfra),
- float *facf0, float *facf1)
+static void get_default_fac_noop(Sequence *UNUSED(seq), float UNUSED(cfra), float *facf0, float *facf1)
{
*facf0 = *facf1 = 1.0;
}
-static void get_default_fac_fade(struct Sequence *seq, float cfra,
- float *facf0, float *facf1)
+static void get_default_fac_fade(Sequence *seq, float cfra, float *facf0, float *facf1)
{
*facf0 = (float)(cfra - seq->startdisp);
*facf1 = (float)(*facf0 + 0.5f);
@@ -2934,38 +2736,20 @@ static void get_default_fac_fade(struct Sequence *seq, float cfra,
*facf1 /= seq->len;
}
-static ImBuf *do_overdrop_effect(SeqRenderData context,
- Sequence *UNUSED(seq),
- float UNUSED(cfra),
- float facf0, float facf1,
- struct ImBuf *ibuf1,
- struct ImBuf *ibuf2,
- struct ImBuf *ibuf3)
+static ImBuf *do_overdrop_effect(SeqRenderData context, Sequence *UNUSED(seq), float UNUSED(cfra), float facf0, float facf1,
+ ImBuf *ibuf1, ImBuf *ibuf2, ImBuf *ibuf3)
{
- struct ImBuf *out = prepare_effect_imbufs(context, ibuf1, ibuf2, ibuf3);
+ ImBuf *out = prepare_effect_imbufs(context, ibuf1, ibuf2, ibuf3);
int x = context.rectx;
int y = context.recty;
if (out->rect_float) {
- do_drop_effect_float(
- facf0, facf1, x, y,
- ibuf1->rect_float, ibuf2->rect_float,
- out->rect_float);
- do_alphaover_effect_float(
- facf0, facf1, x, y,
- ibuf1->rect_float, ibuf2->rect_float,
- out->rect_float);
+ do_drop_effect_float(facf0, facf1, x, y, ibuf1->rect_float, ibuf2->rect_float, out->rect_float);
+ do_alphaover_effect_float(facf0, facf1, x, y, ibuf1->rect_float, ibuf2->rect_float, out->rect_float);
}
else {
- do_drop_effect_byte(
- facf0, facf1, x, y,
- (char *) ibuf1->rect,
- (char *) ibuf2->rect,
- (char *) out->rect);
- do_alphaover_effect_byte(
- facf0, facf1, x, y,
- (char *) ibuf1->rect, (char *) ibuf2->rect,
- (char *) out->rect);
+ do_drop_effect_byte(facf0, facf1, x, y, (char *) ibuf1->rect, (char *) ibuf2->rect, (char *) out->rect);
+ do_alphaover_effect_byte(facf0, facf1, x, y, (char *) ibuf1->rect, (char *) ibuf2->rect, (char *) out->rect);
}
return out;
diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c
index 182e89a169f..70652564233 100644
--- a/source/blender/blenkernel/intern/sequencer.c
+++ b/source/blender/blenkernel/intern/sequencer.c
@@ -80,12 +80,8 @@
# include "AUD_C-API.h"
#endif
-static ImBuf *seq_render_strip_stack(
- SeqRenderData context, ListBase *seqbasep, float cfra, int chanshown);
-
-static ImBuf *seq_render_strip(
- SeqRenderData context, Sequence *seq, float cfra);
-
+static ImBuf *seq_render_strip_stack(SeqRenderData context, ListBase *seqbasep, float cfra, int chanshown);
+static ImBuf *seq_render_strip(SeqRenderData context, Sequence *seq, float cfra);
static void seq_free_animdata(Scene *scene, Sequence *seq);
@@ -98,9 +94,13 @@ SequencerDrawView sequencer_view3d_cb = NULL; /* NULL in background mode */
#if 0 /* unused function */
static void printf_strip(Sequence *seq)
{
- fprintf(stderr, "name: '%s', len:%d, start:%d, (startofs:%d, endofs:%d), (startstill:%d, endstill:%d), machine:%d, (startdisp:%d, enddisp:%d)\n",
- seq->name, seq->len, seq->start, seq->startofs, seq->endofs, seq->startstill, seq->endstill, seq->machine, seq->startdisp, seq->enddisp);
- fprintf(stderr, "\tseq_tx_set_final_left: %d %d\n\n", seq_tx_get_final_left(seq, 0), seq_tx_get_final_right(seq, 0));
+ fprintf(stderr, "name: '%s', len:%d, start:%d, (startofs:%d, endofs:%d), "
+ "(startstill:%d, endstill:%d), machine:%d, (startdisp:%d, enddisp:%d)\n",
+ seq->name, seq->len, seq->start, seq->startofs, seq->endofs, seq->startstill, seq->endstill, seq->machine,
+ seq->startdisp, seq->enddisp);
+
+ fprintf(stderr, "\tseq_tx_set_final_left: %d %d\n\n", seq_tx_get_final_left(seq, 0),
+ seq_tx_get_final_right(seq, 0));
}
#endif
@@ -127,9 +127,7 @@ int seq_recursive_apply(Sequence *seq, int (*apply_func)(Sequence *, void *), vo
return ret;
}
-/* **********************************************************************
- * alloc / free functions
- * ********************************************************************** */
+/*********************** alloc / free functions *************************/
/* free */
@@ -144,7 +142,8 @@ static void free_proxy_seq(Sequence *seq)
static void seq_free_strip(Strip *strip)
{
strip->us--;
- if (strip->us > 0) return;
+ if (strip->us > 0)
+ return;
if (strip->us < 0) {
printf("error: negative users in strip\n");
return;
@@ -176,9 +175,11 @@ static void seq_free_strip(Strip *strip)
void seq_free_sequence(Scene *scene, Sequence *seq)
{
- if (seq->strip) seq_free_strip(seq->strip);
+ if (seq->strip)
+ seq_free_strip(seq->strip);
- if (seq->anim) IMB_free_anim(seq->anim);
+ if (seq->anim)
+ IMB_free_anim(seq->anim);
if (seq->type & SEQ_TYPE_EFFECT) {
struct SeqEffectHandle sh = get_sequence_effect(seq);
@@ -286,13 +287,9 @@ void BKE_sequencer_editing_free(Scene *scene)
scene->ed = NULL;
}
-/* **********************************************************************
- * sequencer pipeline functions
- * ********************************************************************** */
+/*********************** sequencer pipeline functions *************************/
-SeqRenderData seq_new_render_data(
- struct Main *bmain, struct Scene *scene,
- int rectx, int recty, int preview_render_size)
+SeqRenderData seq_new_render_data(Main *bmain, Scene *scene, int rectx, int recty, int preview_render_size)
{
SeqRenderData rval;
@@ -312,7 +309,8 @@ SeqRenderData seq_new_render_data(
/* **************** use now SEQ_BEGIN () SEQ_END ***************** */
/* sequence strip iterator:
- * - builds a full array, recursively into meta strips */
+ * - builds a full array, recursively into meta strips
+ */
static void seq_count(ListBase *seqbase, int *tot)
{
@@ -403,8 +401,8 @@ void seq_end(SeqIterator *iter)
* *********************************************************************
*/
-static void do_seq_count_cb(ListBase *seqbase, int *totseq,
- int (*test_func)(Sequence *seq))
+#if 0 /* currently unused */
+static void do_seq_count_cb(ListBase *seqbase, int *totseq, int (*test_func)(Sequence *seq))
{
Sequence *seq;
@@ -421,8 +419,7 @@ static void do_seq_count_cb(ListBase *seqbase, int *totseq,
}
}
-static void do_build_seqar_cb(ListBase *seqbase, Sequence ***seqar, int depth,
- int (*test_func)(Sequence *seq))
+static void do_build_seqar_cb(ListBase *seqbase, Sequence ***seqar, int depth, int (*test_func)(Sequence *seq))
{
Sequence *seq;
@@ -441,10 +438,10 @@ static void do_build_seqar_cb(ListBase *seqbase, Sequence ***seqar, int depth,
seq = seq->next;
}
}
+#endif
#if 0 /* unused function */
-static void build_seqar_cb(ListBase *seqbase, Sequence ***seqar, int *totseq,
- int (*test_func)(Sequence *seq))
+static void build_seqar_cb(ListBase *seqbase, Sequence ***seqar, int *totseq, int (*test_func)(Sequence *seq))
{
Sequence **tseqar;
@@ -481,8 +478,7 @@ static void seq_update_sound_bounds_recursive_rec(Scene *scene, Sequence *metase
* since sound is played outside of evaluating the imbufs, */
for (seq = metaseq->seqbase.first; seq; seq = seq->next) {
if (seq->type == SEQ_TYPE_META) {
- seq_update_sound_bounds_recursive_rec(scene, seq,
- maxi(start, metaseq_start(seq)),
+ seq_update_sound_bounds_recursive_rec(scene, seq, maxi(start, metaseq_start(seq)),
mini(end, metaseq_end(seq)));
}
else if (ELEM(seq->type, SEQ_TYPE_SOUND_RAM, SEQ_TYPE_SCENE)) {
@@ -494,7 +490,9 @@ static void seq_update_sound_bounds_recursive_rec(Scene *scene, Sequence *metase
if (seq->start + seq->len - seq->endofs > end)
endofs = seq->start + seq->len - end;
- sound_move_scene_sound(scene, seq->scene_sound, seq->start + startofs, seq->start + seq->len - endofs, startofs);
+
+ sound_move_scene_sound(scene, seq->scene_sound, seq->start + startofs,
+ seq->start + seq->len - endofs, startofs);
}
}
}
@@ -507,8 +505,10 @@ static void seq_update_sound_bounds_recursive(Scene *scene, Sequence *metaseq)
void calc_sequence_disp(Scene *scene, Sequence *seq)
{
- if (seq->startofs && seq->startstill) seq->startstill = 0;
- if (seq->endofs && seq->endstill) seq->endstill = 0;
+ if (seq->startofs && seq->startstill)
+ seq->startstill = 0;
+ if (seq->endofs && seq->endstill)
+ seq->endstill = 0;
seq->startdisp = seq->start + seq->startofs - seq->startstill;
seq->enddisp = seq->start + seq->len - seq->endofs + seq->endstill;
@@ -544,8 +544,10 @@ void calc_sequence(Scene *scene, Sequence *seq)
if (seq->type & SEQ_TYPE_EFFECT) {
/* pointers */
- if (seq->seq2 == NULL) seq->seq2 = seq->seq1;
- if (seq->seq3 == NULL) seq->seq3 = seq->seq1;
+ if (seq->seq2 == NULL)
+ seq->seq2 = seq->seq1;
+ if (seq->seq3 == NULL)
+ seq->seq3 = seq->seq1;
/* effecten go from seq1 -> seq2: test */
@@ -648,10 +650,7 @@ void reload_sequence_new_file(Scene *scene, Sequence *seq, int lock_range)
return;
}
- seq->len = IMB_anim_get_duration(seq->anim,
- seq->strip->proxy ?
- seq->strip->proxy->tc :
- IMB_TC_RECORD_RUN);
+ seq->len = IMB_anim_get_duration(seq->anim, seq->strip->proxy ? seq->strip->proxy->tc : IMB_TC_RECORD_RUN);
seq->anim_preseek = IMB_anim_get_preseek(seq->anim);
@@ -724,7 +723,8 @@ void BKE_sequencer_sort(Scene *scene)
Sequence *seq, *seqt;
- if (ed == NULL) return;
+ if (ed == NULL)
+ return;
seqbase.first = seqbase.last = NULL;
effbase.first = effbase.last = NULL;
@@ -741,7 +741,8 @@ void BKE_sequencer_sort(Scene *scene)
}
seqt = seqt->next;
}
- if (seqt == NULL) BLI_addtail(&effbase, seq);
+ if (seqt == NULL)
+ BLI_addtail(&effbase, seq);
}
else {
seqt = seqbase.first;
@@ -752,7 +753,8 @@ void BKE_sequencer_sort(Scene *scene)
}
seqt = seqt->next;
}
- if (seqt == NULL) BLI_addtail(&seqbase, seq);
+ if (seqt == NULL)
+ BLI_addtail(&seqbase, seq);
}
}
@@ -760,7 +762,6 @@ void BKE_sequencer_sort(Scene *scene)
*(ed->seqbasep) = seqbase;
}
-
static int clear_scene_in_allseqs_cb(Sequence *seq, void *arg_pt)
{
if (seq->scene == (Scene *)arg_pt)
@@ -888,7 +889,7 @@ const char *give_seqname(Sequence *seq)
return name;
}
-/* ***************** DO THE SEQUENCE ***************** */
+/*********************** DO THE SEQUENCE *************************/
static void make_black_ibuf(ImBuf *ibuf)
{
@@ -906,7 +907,7 @@ static void make_black_ibuf(ImBuf *ibuf)
rect_float = ibuf->rect_float;
if (rect) {
- memset(rect, 0, tot * sizeof(char) * 4);
+ memset(rect, 0, tot * sizeof(char) * 4);
}
if (rect_float) {
@@ -993,14 +994,15 @@ StripElem *give_stripelem(Sequence *seq, int cfra)
{
StripElem *se = seq->strip->stripdata;
- if (seq->type == SEQ_TYPE_IMAGE) { /* only
- * IMAGE strips use the whole array,
- * MOVIE strips use only
- * the first element, all other strips
- * don't use this... */
- int nr = (int)give_stripelem_index(seq, cfra);
+ if (seq->type == SEQ_TYPE_IMAGE) {
+ /* only IMAGE strips use the whole array, MOVIE strips use only the first element,
+ * all other strips don't use this...
+ */
+
+ int nr = (int) give_stripelem_index(seq, cfra);
- if (nr == -1 || se == NULL) return NULL;
+ if (nr == -1 || se == NULL)
+ return NULL;
se += nr + seq->anim_startofs;
}
@@ -1031,7 +1033,9 @@ int evaluate_seq_frame(Scene *scene, int cfra)
Editing *ed = BKE_sequencer_editing_get(scene, FALSE);
Sequence *seq_arr[MAXSEQ + 1];
- if (ed == NULL) return 0;
+ if (ed == NULL)
+ return 0;
+
return evaluate_seq_frame_gen(seq_arr, ed->seqbasep, cfra);
}
@@ -1080,10 +1084,7 @@ static int get_shown_sequences(ListBase *seqbasep, int cfra, int chanshown, Sequ
return cnt;
}
-
-/* **********************************************************************
- * proxy management
- * ********************************************************************** */
+/*********************** proxy management *************************/
typedef struct SeqIndexBuildContext {
struct IndexBuildContext *index_context;
@@ -1143,9 +1144,7 @@ static void seq_open_anim_file(Sequence *seq)
seq->strip->dir, seq->strip->stripdata->name);
BLI_path_abs(name, G.main->name);
- seq->anim = openanim(name, IB_rect |
- ((seq->flag & SEQ_FILTERY) ?
- IB_animdeinterlace : 0), seq->streamindex);
+ seq->anim = openanim(name, IB_rect | ((seq->flag & SEQ_FILTERY) ? IB_animdeinterlace : 0), seq->streamindex);
if (seq->anim == NULL) {
return;
@@ -1281,9 +1280,7 @@ static ImBuf *seq_proxy_fetch(SeqRenderData context, Sequence *seq, int cfra)
}
}
-static void seq_proxy_build_frame(SeqRenderData context,
- Sequence *seq, int cfra,
- int proxy_render_size)
+static void seq_proxy_build_frame(SeqRenderData context, Sequence *seq, int cfra, int proxy_render_size)
{
char name[PROXY_MAXFILE];
int quality;
@@ -1387,15 +1384,11 @@ void seq_proxy_rebuild(SeqIndexBuildContext *context, short *stop, short *do_upd
/* fail safe code */
- render_context = seq_new_render_data(
- context->bmain, context->scene,
- (scene->r.size * (float)scene->r.xsch) / 100.0f + 0.5f,
- (scene->r.size * (float)scene->r.ysch) / 100.0f + 0.5f,
- 100);
+ render_context = seq_new_render_data(context->bmain, context->scene,
+ (scene->r.size * (float) scene->r.xsch) / 100.0f + 0.5f,
+ (scene->r.size * (float) scene->r.ysch) / 100.0f + 0.5f, 100);
- for (cfra = seq->startdisp + seq->startstill;
- cfra < seq->enddisp - seq->endstill; cfra++)
- {
+ for (cfra = seq->startdisp + seq->startstill; cfra < seq->enddisp - seq->endstill; cfra++) {
if (context->size_flags & IMB_PROXY_25) {
seq_proxy_build_frame(render_context, seq, cfra, 25);
}
@@ -1409,8 +1402,7 @@ void seq_proxy_rebuild(SeqIndexBuildContext *context, short *stop, short *do_upd
seq_proxy_build_frame(render_context, seq, cfra, 100);
}
- *progress = (float)cfra / (seq->enddisp - seq->endstill -
- seq->startdisp + seq->startstill);
+ *progress = (float) cfra / (seq->enddisp - seq->endstill - seq->startdisp + seq->startstill);
*do_update = TRUE;
if (*stop || G.afbreek)
@@ -1431,9 +1423,7 @@ void seq_proxy_rebuild_finish(SeqIndexBuildContext *context, short stop)
MEM_freeN(context);
}
-/* **********************************************************************
- * color balance
- * ********************************************************************** */
+/*********************** color balance *************************/
static StripColorBalance calc_cb(StripColorBalance *cb_)
{
@@ -1486,7 +1476,8 @@ MINLINE float color_balance_fl(float in, const float lift, const float gain, con
float x = (((in - 1.0f) * lift) + 1.0f) * gain;
/* prevent NaN */
- if (x < 0.f) x = 0.f;
+ if (x < 0.f)
+ x = 0.f;
return powf(x, gamma) * mul;
}
@@ -1498,6 +1489,7 @@ static void make_cb_table_byte(float lift, float gain, float gamma,
for (y = 0; y < 256; y++) {
float v = color_balance_fl((float)y * (1.0f / 255.0f), lift, gain, gamma, mul);
+
table[y] = FTOCHAR(v);
}
}
@@ -1509,6 +1501,7 @@ static void make_cb_table_float(float lift, float gain, float gamma,
for (y = 0; y < 256; y++) {
float v = color_balance_fl((float)y * (1.0f / 255.0f), lift, gain, gamma, mul);
+
table[y] = v;
}
}
@@ -1523,8 +1516,7 @@ static void color_balance_byte_byte(Sequence *seq, unsigned char *rect, int widt
StripColorBalance cb = calc_cb(seq->strip->color_balance);
for (c = 0; c < 3; c++) {
- make_cb_table_byte(cb.lift[c], cb.gain[c], cb.gamma[c],
- cb_tab[c], mul);
+ make_cb_table_byte(cb.lift[c], cb.gain[c], cb.gamma[c], cb_tab[c], mul);
}
while (p < e) {
@@ -1672,8 +1664,8 @@ static void color_balance(Sequence *seq, ImBuf *ibuf, float mul)
handle.rect_float = ibuf->rect_float;
color_balance_do_thread(&handle);
-} }
-
+ }
+}
/*
* input preprocessing for SEQ_TYPE_IMAGE, SEQ_TYPE_MOVIE, SEQ_TYPE_MOVIECLIP and SEQ_TYPE_SCENE
@@ -1693,8 +1685,7 @@ static void color_balance(Sequence *seq, ImBuf *ibuf, float mul)
* - Premultiply
*/
-int input_have_to_preprocess(
- SeqRenderData UNUSED(context), Sequence *seq, float UNUSED(cfra))
+int input_have_to_preprocess(SeqRenderData UNUSED(context), Sequence *seq, float UNUSED(cfra))
{
float mul;
@@ -1721,9 +1712,8 @@ int input_have_to_preprocess(
return FALSE;
}
-static ImBuf *input_preprocess(
- SeqRenderData context, Sequence *seq, float UNUSED(cfra), ImBuf *ibuf,
- int is_proxy_image, int is_preprocessed)
+static ImBuf *input_preprocess(SeqRenderData context, Sequence *seq, float UNUSED(cfra), ImBuf *ibuf,
+ int is_proxy_image, int is_preprocessed)
{
float mul;
@@ -1743,12 +1733,10 @@ static ImBuf *input_preprocess(
double yscale = 1.0;
if (is_proxy_image) {
- double f = seq_rendersize_to_scale_factor(
- context.preview_render_size);
+ double f = seq_rendersize_to_scale_factor(context.preview_render_size);
if (f != 1.0) {
- IMB_scalefastImBuf(
- ibuf, ibuf->x / f, ibuf->y / f);
+ IMB_scalefastImBuf(ibuf, ibuf->x / f, ibuf->y / f);
}
}
@@ -1759,12 +1747,8 @@ static ImBuf *input_preprocess(
t = *seq->strip->transform;
}
- xscale = context.scene->r.xsch ?
- ((double) context.rectx /
- (double) context.scene->r.xsch) : 1.0;
- yscale = context.scene->r.ysch ?
- ((double) context.recty /
- (double) context.scene->r.ysch) : 1.0;
+ xscale = context.scene->r.xsch ? ((double) context.rectx / (double) context.scene->r.xsch) : 1.0;
+ yscale = context.scene->r.ysch ? ((double) context.recty / (double) context.scene->r.ysch) : 1.0;
c.left *= xscale; c.right *= xscale;
c.top *= yscale; c.bottom *= yscale;
@@ -1794,12 +1778,9 @@ static ImBuf *input_preprocess(
make_black_ibuf(ibuf);
}
else {
- ImBuf *i = IMB_allocImBuf(
- dx, dy, 32,
- ibuf->rect_float ? IB_rectfloat : IB_rect);
+ ImBuf *i = IMB_allocImBuf(dx, dy, 32, ibuf->rect_float ? IB_rectfloat : IB_rect);
- IMB_rectcpy(i, ibuf,
- t.xofs, t.yofs, c.left, c.bottom, sx, sy);
+ IMB_rectcpy(i, ibuf, t.xofs, t.yofs, c.left, c.bottom, sx, sy);
IMB_freeImBuf(ibuf);
@@ -1868,14 +1849,10 @@ static ImBuf *copy_from_ibuf_still(SeqRenderData context, Sequence *seq,
ImBuf *ibuf = NULL;
if (nr == 0) {
- ibuf = seq_stripelem_cache_get(
- context, seq, seq->start,
- SEQ_STRIPELEM_IBUF_STARTSTILL);
+ ibuf = seq_stripelem_cache_get(context, seq, seq->start, SEQ_STRIPELEM_IBUF_STARTSTILL);
}
else if (nr == seq->len - 1) {
- ibuf = seq_stripelem_cache_get(
- context, seq, seq->start,
- SEQ_STRIPELEM_IBUF_ENDSTILL);
+ ibuf = seq_stripelem_cache_get(context, seq, seq->start, SEQ_STRIPELEM_IBUF_ENDSTILL);
}
if (ibuf) {
@@ -1896,34 +1873,20 @@ static void copy_to_ibuf_still(SeqRenderData context, Sequence *seq, float nr,
ibuf = IMB_dupImBuf(ibuf);
if (nr == 0) {
- seq_stripelem_cache_put(
- context, seq, seq->start,
- SEQ_STRIPELEM_IBUF_STARTSTILL, ibuf);
+ seq_stripelem_cache_put(context, seq, seq->start, SEQ_STRIPELEM_IBUF_STARTSTILL, ibuf);
}
if (nr == seq->len - 1) {
- seq_stripelem_cache_put(
- context, seq, seq->start,
- SEQ_STRIPELEM_IBUF_ENDSTILL, ibuf);
+ seq_stripelem_cache_put(context, seq, seq->start, SEQ_STRIPELEM_IBUF_ENDSTILL, ibuf);
}
IMB_freeImBuf(ibuf);
}
}
-/* **********************************************************************
- * strip rendering functions
- * ********************************************************************** */
-
-static ImBuf *seq_render_strip_stack(
- SeqRenderData context, ListBase *seqbasep, float cfra, int chanshown);
-
-static ImBuf *seq_render_strip(
- SeqRenderData context, Sequence *seq, float cfra);
+/*********************** strip rendering functions *************************/
-
-static ImBuf *seq_render_effect_strip_impl(
- SeqRenderData context, Sequence *seq, float cfra)
+static ImBuf *seq_render_effect_strip_impl(SeqRenderData context, Sequence *seq, float cfra)
{
float fac, facf;
int early_out;
@@ -1938,7 +1901,8 @@ static ImBuf *seq_render_effect_strip_impl(
input[0] = seq->seq1; input[1] = seq->seq2; input[2] = seq->seq3;
- if (!sh.execute) { /* effect not supported in this version... */
+ if (!sh.execute) {
+ /* effect not supported in this version... */
out = IMB_allocImBuf(context.rectx, context.recty, 32, IB_rect);
return out;
}
@@ -2022,8 +1986,7 @@ static ImBuf *seq_render_effect_strip_impl(
return out;
}
-static ImBuf *seq_render_movieclip_strip(
- SeqRenderData context, Sequence *seq, float nr)
+static ImBuf *seq_render_movieclip_strip(SeqRenderData context, Sequence *seq, float nr)
{
ImBuf *ibuf = NULL;
MovieClipUser user;
@@ -2062,21 +2025,17 @@ static ImBuf *seq_render_movieclip_strip(
}
if (seq->clip_flag & SEQ_MOVIECLIP_RENDER_STABILIZED) {
- ibuf = BKE_movieclip_get_stable_ibuf(
- seq->clip, &user, tloc, &tscale, &tangle,
- 0);
+ ibuf = BKE_movieclip_get_stable_ibuf(seq->clip, &user, tloc, &tscale, &tangle, 0);
}
else {
- ibuf = BKE_movieclip_get_ibuf_flag(
- seq->clip, &user, 0, MOVIECLIP_CACHE_SKIP);
+ ibuf = BKE_movieclip_get_ibuf_flag(seq->clip, &user, 0, MOVIECLIP_CACHE_SKIP);
}
return ibuf;
}
-static ImBuf *seq_render_mask_strip(
- SeqRenderData context, Sequence *seq, float nr)
+static ImBuf *seq_render_mask_strip(SeqRenderData context, Sequence *seq, float nr)
{
/* TODO - add option to rasterize to alpha imbuf? */
ImBuf *ibuf = NULL;
@@ -2098,9 +2057,7 @@ static ImBuf *seq_render_mask_strip(
mr_handle = BKE_maskrasterize_handle_new();
- BKE_maskrasterize_handle_init(mr_handle, mask_temp,
- context.rectx, context.recty,
- TRUE, TRUE, TRUE);
+ BKE_maskrasterize_handle_init(mr_handle, mask_temp, context.rectx, context.recty, TRUE, TRUE, TRUE);
BKE_mask_free(mask_temp);
MEM_freeN(mask_temp);
@@ -2153,8 +2110,7 @@ static ImBuf *seq_render_mask_strip(
return ibuf;
}
-static ImBuf *seq_render_scene_strip(
- SeqRenderData context, Sequence *seq, float nr)
+static ImBuf *seq_render_scene_strip(SeqRenderData context, Sequence *seq, float nr)
{
ImBuf *ibuf = NULL;
float frame;
@@ -2387,8 +2343,7 @@ static ImBuf *seq_render_strip(SeqRenderData context, Sequence *seq, float cfra)
}
case SEQ_TYPE_EFFECT:
{
- ibuf = seq_render_effect_strip_impl(
- context, seq, seq->start + nr);
+ ibuf = seq_render_effect_strip_impl(context, seq, seq->start + nr);
break;
}
case SEQ_TYPE_IMAGE:
@@ -2423,16 +2378,11 @@ static ImBuf *seq_render_strip(SeqRenderData context, Sequence *seq, float cfra)
seq_open_anim_file(seq);
if (seq->anim) {
- IMB_anim_set_preseek(seq->anim,
- seq->anim_preseek);
+ IMB_anim_set_preseek(seq->anim, seq->anim_preseek);
- ibuf = IMB_anim_absolute(
- seq->anim, nr + seq->anim_startofs,
- seq->strip->proxy ?
- seq->strip->proxy->tc :
- IMB_TC_RECORD_RUN,
- seq_rendersize_to_proxysize(
- context.preview_render_size));
+ ibuf = IMB_anim_absolute(seq->anim, nr + seq->anim_startofs,
+ seq->strip->proxy ? seq->strip->proxy->tc : IMB_TC_RECORD_RUN,
+ seq_rendersize_to_proxysize(context.preview_render_size));
/* we don't need both (speed reasons)! */
if (ibuf && ibuf->rect_float && ibuf->rect)
@@ -2446,7 +2396,8 @@ static ImBuf *seq_render_strip(SeqRenderData context, Sequence *seq, float cfra)
break;
}
case SEQ_TYPE_SCENE:
- { // scene can be NULL after deletions
+ {
+ /* scene can be NULL after deletions */
ibuf = seq_render_scene_strip(context, seq, nr);
/* Scene strips update all animation, so we need to restore original state.*/
@@ -2478,7 +2429,7 @@ static ImBuf *seq_render_strip(SeqRenderData context, Sequence *seq, float cfra)
copy_to_ibuf_still(context, seq, nr, ibuf);
break;
}
- }
+ }
if (ibuf == NULL)
ibuf = IMB_allocImBuf(context.rectx, context.recty, 32, IB_rect);
@@ -2487,17 +2438,14 @@ static ImBuf *seq_render_strip(SeqRenderData context, Sequence *seq, float cfra)
use_preprocess = TRUE;
if (use_preprocess)
- ibuf = input_preprocess(context, seq, cfra, ibuf,
- is_proxy_image, is_preprocessed);
+ ibuf = input_preprocess(context, seq, cfra, ibuf, is_proxy_image, is_preprocessed);
seq_stripelem_cache_put(context, seq, cfra, SEQ_STRIPELEM_IBUF, ibuf);
return ibuf;
}
-/* **********************************************************************
- * strip stack rendering functions
- * ********************************************************************** */
+/*********************** strip stack rendering functions *************************/
static int seq_must_swap_input_in_blend_mode(Sequence *seq)
{
@@ -2534,8 +2482,7 @@ static int seq_get_early_out_for_blend_mode(Sequence *seq)
return early_out;
}
-static ImBuf *seq_render_strip_stack(
- SeqRenderData context, ListBase *seqbasep, float cfra, int chanshown)
+static ImBuf *seq_render_strip_stack(SeqRenderData context, ListBase *seqbasep, float cfra, int chanshown)
{
Sequence *seq_arr[MAXSEQ + 1];
int count;
@@ -2556,8 +2503,7 @@ static ImBuf *seq_render_strip_stack(
}
#endif
- out = seq_stripelem_cache_get(context, seq_arr[count - 1],
- cfra, SEQ_STRIPELEM_IBUF_COMP);
+ out = seq_stripelem_cache_get(context, seq_arr[count - 1], cfra, SEQ_STRIPELEM_IBUF_COMP);
if (out) {
return out;
@@ -2565,8 +2511,7 @@ static ImBuf *seq_render_strip_stack(
if (count == 1) {
out = seq_render_strip(context, seq_arr[0], cfra);
- seq_stripelem_cache_put(context, seq_arr[0], cfra,
- SEQ_STRIPELEM_IBUF_COMP, out);
+ seq_stripelem_cache_put(context, seq_arr[0], cfra, SEQ_STRIPELEM_IBUF_COMP, out);
return out;
}
@@ -2576,8 +2521,7 @@ static ImBuf *seq_render_strip_stack(
int early_out;
Sequence *seq = seq_arr[i];
- out = seq_stripelem_cache_get(
- context, seq, cfra, SEQ_STRIPELEM_IBUF_COMP);
+ out = seq_stripelem_cache_get(context, seq, cfra, SEQ_STRIPELEM_IBUF_COMP);
if (out) {
break;
@@ -2611,9 +2555,7 @@ static ImBuf *seq_render_strip_stack(
}
}
- seq_stripelem_cache_put(context, seq_arr[i], cfra,
- SEQ_STRIPELEM_IBUF_COMP, out);
-
+ seq_stripelem_cache_put(context, seq_arr[i], cfra, SEQ_STRIPELEM_IBUF_COMP, out);
i++;
@@ -2643,8 +2585,7 @@ static ImBuf *seq_render_strip_stack(
IMB_freeImBuf(ibuf2);
}
- seq_stripelem_cache_put(context, seq_arr[i], cfra,
- SEQ_STRIPELEM_IBUF_COMP, out);
+ seq_stripelem_cache_put(context, seq_arr[i], cfra, SEQ_STRIPELEM_IBUF_COMP, out);
}
return out;
@@ -3015,9 +2956,7 @@ ImBuf *give_ibuf_seq_threaded(SeqRenderData context, float cfra, int chanshown)
e = NULL;
if (!found_something) {
- fprintf(stderr,
- "SEQ-THREAD: Requested frame "
- "not in queue ???\n");
+ fprintf(stderr, "SEQ-THREAD: Requested frame not in queue ???\n");
break;
}
pthread_mutex_lock(&frame_done_lock);
@@ -3039,8 +2978,7 @@ static void free_anim_seq(Sequence *seq)
}
}
-void free_imbuf_seq(Scene *scene, ListBase *seqbase, int check_mem_usage,
- int keep_file_handles)
+void free_imbuf_seq(Scene *scene, ListBase *seqbase, int check_mem_usage, int keep_file_handles)
{
Sequence *seq;
@@ -3770,7 +3708,6 @@ static void seq_free_animdata(Scene *scene, Sequence *seq)
}
}
-
Sequence *get_seq_by_name(ListBase *seqbase, const char *name, int recursive)
{
Sequence *iseq = NULL;
@@ -3791,14 +3728,19 @@ Sequence *get_seq_by_name(ListBase *seqbase, const char *name, int recursive)
Sequence *BKE_sequencer_active_get(Scene *scene)
{
Editing *ed = BKE_sequencer_editing_get(scene, FALSE);
- if (ed == NULL) return NULL;
+
+ if (ed == NULL)
+ return NULL;
+
return ed->act_seq;
}
void BKE_sequencer_active_set(Scene *scene, Sequence *seq)
{
Editing *ed = BKE_sequencer_editing_get(scene, FALSE);
- if (ed == NULL) return;
+
+ if (ed == NULL)
+ return;
ed->act_seq = seq;
}
@@ -3937,8 +3879,11 @@ Sequence *sequencer_add_sound_strip(bContext *C, ListBase *seqbasep, SeqLoadInfo
sound = sound_new_file(bmain, seq_load->path); /* handles relative paths */
if (sound == NULL || sound->playback_handle == NULL) {
- //if (op)
- // BKE_report(op->reports, RPT_ERROR, "Unsupported audio format");
+ /*
+ if (op)
+ BKE_report(op->reports, RPT_ERROR, "Unsupported audio format");
+ */
+
return NULL;
}
@@ -3946,8 +3891,10 @@ Sequence *sequencer_add_sound_strip(bContext *C, ListBase *seqbasep, SeqLoadInfo
if (info.specs.channels == AUD_CHANNELS_INVALID) {
sound_delete(bmain, sound);
- //if (op)
- // BKE_report(op->reports, RPT_ERROR, "Unsupported audio format");
+ /*
+ if (op)
+ BKE_report(op->reports, RPT_ERROR, "Unsupported audio format");
+ */
return NULL;
}
@@ -3982,9 +3929,9 @@ Sequence *sequencer_add_sound_strip(bContext *C, ListBase *seqbasep, SeqLoadInfo
#else // WITH_AUDASPACE
Sequence *sequencer_add_sound_strip(bContext *C, ListBase *seqbasep, SeqLoadInfo *seq_load)
{
- (void)C;
- (void)seqbasep;
- (void)seq_load;
+ (void) C;
+ (void) seqbasep;
+ (void) seq_load;
return NULL;
}
#endif // WITH_AUDASPACE
@@ -4049,7 +3996,6 @@ Sequence *sequencer_add_movie_strip(bContext *C, ListBase *seqbasep, SeqLoadInfo
return seq;
}
-
static Sequence *seq_dupli(struct Scene *scene, struct Scene *scene_to, Sequence *seq, int dupe_flag)
{
Scene *sce_audio = scene_to ? scene_to : scene;
@@ -4058,7 +4004,7 @@ static Sequence *seq_dupli(struct Scene *scene, struct Scene *scene_to, Sequence
seq->tmp = seqn;
seqn->strip = MEM_dupallocN(seq->strip);
- // XXX: add F-Curve duplication stuff?
+ /* XXX: add F-Curve duplication stuff? */
if (seq->strip->crop) {
seqn->strip->crop = MEM_dupallocN(seq->strip->crop);
@@ -4122,9 +4068,7 @@ static Sequence *seq_dupli(struct Scene *scene, struct Scene *scene_to, Sequence
}
else {
- fprintf(stderr, "Aiiiiekkk! sequence type not "
- "handled in duplicate!\nExpect a crash"
- " now...\n");
+ fprintf(stderr, "Aiiiiekkk! sequence type not handled in duplicate!\nExpect a crash now...\n");
}
if (dupe_flag & SEQ_DUPE_UNIQUE_NAME)