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:
authorJeroen Bakker <j.bakker@atmind.nl>2012-06-12 08:23:21 +0400
committerJeroen Bakker <j.bakker@atmind.nl>2012-06-12 08:23:21 +0400
commitac5a735e3fe9fe29e38e3a20c20da87b27feb112 (patch)
tree52059f3dbc9827eb498abe772e763e541b3b3608 /source/blender/compositor/operations
parent7977078227d6da77e294dd860f4685387f0bae56 (diff)
* FIX for
- [#31777] Border Crop gives black - [#31768] Crash when connecting a Math node to a translate node in Tiles comp - [#31638] View node in new node compo system crashes when inside a group * make sure a very fast vignette can be made by using a EliipseMask + Fast Gaussian blur
Diffstat (limited to 'source/blender/compositor/operations')
-rw-r--r--source/blender/compositor/operations/COM_BokehBlurOperation.cpp5
-rw-r--r--source/blender/compositor/operations/COM_BokehImageOperation.cpp2
-rw-r--r--source/blender/compositor/operations/COM_CompositorOperation.cpp19
-rw-r--r--source/blender/compositor/operations/COM_PreviewOperation.h2
-rw-r--r--source/blender/compositor/operations/COM_ReadBufferOperation.cpp8
-rw-r--r--source/blender/compositor/operations/COM_ReadBufferOperation.h2
-rw-r--r--source/blender/compositor/operations/COM_RotateOperation.cpp32
-rw-r--r--source/blender/compositor/operations/COM_RotateOperation.h3
-rw-r--r--source/blender/compositor/operations/COM_SetVectorOperation.cpp10
-rw-r--r--source/blender/compositor/operations/COM_SocketProxyOperation.cpp4
-rw-r--r--source/blender/compositor/operations/COM_TranslateOperation.cpp8
-rw-r--r--source/blender/compositor/operations/COM_TranslateOperation.h12
-rw-r--r--source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.cpp21
-rw-r--r--source/blender/compositor/operations/COM_WriteBufferOperation.cpp6
-rw-r--r--source/blender/compositor/operations/COM_WriteBufferOperation.h1
15 files changed, 96 insertions, 39 deletions
diff --git a/source/blender/compositor/operations/COM_BokehBlurOperation.cpp b/source/blender/compositor/operations/COM_BokehBlurOperation.cpp
index 71a87dce2a7..b4811c89dc5 100644
--- a/source/blender/compositor/operations/COM_BokehBlurOperation.cpp
+++ b/source/blender/compositor/operations/COM_BokehBlurOperation.cpp
@@ -86,6 +86,7 @@ void BokehBlurOperation::executePixel(float *color, int x, int y, MemoryBuffer *
float overallmultiplyerr = 0;
float overallmultiplyerg = 0;
float overallmultiplyerb = 0;
+ float overallmultiplyera = 0;
MemoryBuffer *inputBuffer = (MemoryBuffer*)data;
float *buffer = inputBuffer->getBuffer();
int bufferwidth = inputBuffer->getWidth();
@@ -115,16 +116,18 @@ void BokehBlurOperation::executePixel(float *color, int x, int y, MemoryBuffer *
tempColor[0] += bokeh[0] * buffer[bufferindex];
tempColor[1] += bokeh[1] * buffer[bufferindex+1];
tempColor[2] += bokeh[2]* buffer[bufferindex+2];
+ tempColor[3] += bokeh[3]* buffer[bufferindex+3];
overallmultiplyerr += bokeh[0];
overallmultiplyerg += bokeh[1];
overallmultiplyerb += bokeh[2];
+ overallmultiplyera += bokeh[3];
bufferindex +=offsetadd;
}
}
color[0] = tempColor[0] * (1.0f / overallmultiplyerr);
color[1] = tempColor[1] * (1.0f / overallmultiplyerg);
color[2] = tempColor[2] * (1.0f / overallmultiplyerb);
- color[3] = 1.0f;
+ color[3] = tempColor[3] * (1.0f / overallmultiplyera);
}
else {
inputProgram->read(color, x, y, COM_PS_NEAREST, inputBuffers);
diff --git a/source/blender/compositor/operations/COM_BokehImageOperation.cpp b/source/blender/compositor/operations/COM_BokehImageOperation.cpp
index a0297b12961..189ba98aa57 100644
--- a/source/blender/compositor/operations/COM_BokehImageOperation.cpp
+++ b/source/blender/compositor/operations/COM_BokehImageOperation.cpp
@@ -105,7 +105,7 @@ void BokehImageOperation::executePixel(float *color, float x, float y, PixelSamp
color[1] = insideBokehMed;
color[2] = insideBokehMax;
}
- color[3] = 1.0f;
+ color[3] = (insideBokehMax+insideBokehMed+insideBokehMin)/3.0f;
}
void BokehImageOperation::deinitExecution()
diff --git a/source/blender/compositor/operations/COM_CompositorOperation.cpp b/source/blender/compositor/operations/COM_CompositorOperation.cpp
index d75cb39325f..c6e8faaa638 100644
--- a/source/blender/compositor/operations/COM_CompositorOperation.cpp
+++ b/source/blender/compositor/operations/COM_CompositorOperation.cpp
@@ -102,7 +102,7 @@ void CompositorOperation::executeRegion(rcti *rect, unsigned int tileNumber, Mem
int y1 = rect->ymin;
int x2 = rect->xmax;
int y2 = rect->ymax;
- int offset = (y1*this->getWidth() + x1 ) * 4;
+ int offset = (y1*this->getWidth() + x1 ) * COM_NUMBER_OF_CHANNELS;
int x;
int y;
bool breaked = false;
@@ -117,12 +117,12 @@ void CompositorOperation::executeRegion(rcti *rect, unsigned int tileNumber, Mem
buffer[offset+1] = color[1];
buffer[offset+2] = color[2];
buffer[offset+3] = color[3];
- offset +=4;
+ offset +=COM_NUMBER_OF_CHANNELS;
if (tree->test_break && tree->test_break(tree->tbh)) {
breaked = true;
}
}
- offset += (this->getWidth()-(x2-x1))*4;
+ offset += (this->getWidth()-(x2-x1))*COM_NUMBER_OF_CHANNELS;
}
}
@@ -130,6 +130,19 @@ void CompositorOperation::determineResolution(unsigned int resolution[], unsigne
{
int width = this->scene->r.xsch*this->scene->r.size/100;
int height = this->scene->r.ysch*this->scene->r.size/100;
+
+ // check actual render resolution with cropping it may differ with cropped border.rendering
+ // FIX for: [31777] Border Crop gives black (easy)
+ Render *re= RE_GetRender(this->scene->id.name);
+ if (re) {
+ RenderResult *rr= RE_AcquireResultRead(re);
+ if (rr) {
+ width = rr->rectx;
+ height = rr->recty;
+ }
+ RE_ReleaseResult(re);
+ }
+
preferredResolution[0] = width;
preferredResolution[1] = height;
diff --git a/source/blender/compositor/operations/COM_PreviewOperation.h b/source/blender/compositor/operations/COM_PreviewOperation.h
index 3d1cd38a5ea..2b81b914746 100644
--- a/source/blender/compositor/operations/COM_PreviewOperation.h
+++ b/source/blender/compositor/operations/COM_PreviewOperation.h
@@ -50,5 +50,7 @@ public:
void setbNode(bNode *node) { this->node = node;}
void setbNodeTree(const bNodeTree *tree) { this->tree = tree;}
bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output);
+ bool isPreviewOperation() {return true;}
+
};
#endif
diff --git a/source/blender/compositor/operations/COM_ReadBufferOperation.cpp b/source/blender/compositor/operations/COM_ReadBufferOperation.cpp
index d7f95c10cfb..14b6db9037b 100644
--- a/source/blender/compositor/operations/COM_ReadBufferOperation.cpp
+++ b/source/blender/compositor/operations/COM_ReadBufferOperation.cpp
@@ -75,3 +75,11 @@ bool ReadBufferOperation::determineDependingAreaOfInterest(rcti * input, ReadBuf
}
return false;
}
+
+void ReadBufferOperation::readResolutionFromWriteBuffer() {
+ if (this->memoryProxy != NULL) {
+ WriteBufferOperation * operation = memoryProxy->getWriteBufferOperation();
+ this->setWidth(operation->getWidth());
+ this->setHeight(operation->getHeight());
+ }
+}
diff --git a/source/blender/compositor/operations/COM_ReadBufferOperation.h b/source/blender/compositor/operations/COM_ReadBufferOperation.h
index d58d131264b..449b4a82618 100644
--- a/source/blender/compositor/operations/COM_ReadBufferOperation.h
+++ b/source/blender/compositor/operations/COM_ReadBufferOperation.h
@@ -45,7 +45,7 @@ public:
unsigned int getOffset() {return this->offset;}
bool determineDependingAreaOfInterest(rcti * input, ReadBufferOperation *readOperation, rcti *output);
MemoryBuffer *getInputMemoryBuffer(MemoryBuffer** memoryBuffers) {return memoryBuffers[offset];}
-
+ void readResolutionFromWriteBuffer();
};
#endif
diff --git a/source/blender/compositor/operations/COM_RotateOperation.cpp b/source/blender/compositor/operations/COM_RotateOperation.cpp
index af2633f0e53..a391a26b89c 100644
--- a/source/blender/compositor/operations/COM_RotateOperation.cpp
+++ b/source/blender/compositor/operations/COM_RotateOperation.cpp
@@ -32,6 +32,7 @@ RotateOperation::RotateOperation() : NodeOperation()
this->imageSocket = NULL;
this->degreeSocket = NULL;
this->doDegree2RadConversion = false;
+ this->isDegreeSet = false;
}
void RotateOperation::initExecution()
{
@@ -39,17 +40,6 @@ void RotateOperation::initExecution()
this->degreeSocket = this->getInputSocketReader(1);
this->centerX = this->getWidth()/2.0;
this->centerY = this->getHeight()/2.0;
- float degree[4];
- this->degreeSocket->read(degree, 0, 0, COM_PS_NEAREST, NULL);
- double rad;
- if (this->doDegree2RadConversion) {
- rad = DEG2RAD((double)degree[0]);
- }
- else {
- rad = degree[0];
- }
- this->cosine = cos(rad);
- this->sine = sin(rad);
}
void RotateOperation::deinitExecution()
@@ -58,9 +48,28 @@ void RotateOperation::deinitExecution()
this->degreeSocket = NULL;
}
+inline void RotateOperation::ensureDegree() {
+ if (!isDegreeSet) {
+ float degree[4];
+ this->degreeSocket->read(degree, 0, 0, COM_PS_NEAREST, NULL);
+ double rad;
+ if (this->doDegree2RadConversion) {
+ rad = DEG2RAD((double)degree[0]);
+ }
+ else {
+ rad = degree[0];
+ }
+ this->cosine = cos(rad);
+ this->sine = sin(rad);
+
+ isDegreeSet = true;
+ }
+}
+
void RotateOperation::executePixel(float *color,float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
{
+ ensureDegree();
const float dy = y - this->centerY;
const float dx = x - this->centerX;
const float nx = this->centerX+(this->cosine*dx + this->sine*dy);
@@ -70,6 +79,7 @@ void RotateOperation::executePixel(float *color,float x, float y, PixelSampler s
bool RotateOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output)
{
+ ensureDegree();
rcti newInput;
const float dxmin = input->xmin - this->centerX;
diff --git a/source/blender/compositor/operations/COM_RotateOperation.h b/source/blender/compositor/operations/COM_RotateOperation.h
index 9965d1021da..6afed39908b 100644
--- a/source/blender/compositor/operations/COM_RotateOperation.h
+++ b/source/blender/compositor/operations/COM_RotateOperation.h
@@ -34,6 +34,7 @@ private:
float cosine;
float sine;
bool doDegree2RadConversion;
+ bool isDegreeSet;
public:
RotateOperation();
bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output);
@@ -41,6 +42,8 @@ public:
void initExecution();
void deinitExecution();
void setDoDegree2RadConversion(bool abool) {this->doDegree2RadConversion = abool;}
+
+ void ensureDegree();
};
#endif
diff --git a/source/blender/compositor/operations/COM_SetVectorOperation.cpp b/source/blender/compositor/operations/COM_SetVectorOperation.cpp
index 70477de0514..79c0201733e 100644
--- a/source/blender/compositor/operations/COM_SetVectorOperation.cpp
+++ b/source/blender/compositor/operations/COM_SetVectorOperation.cpp
@@ -38,12 +38,6 @@ void SetVectorOperation::executePixel(float *outputValue, float x, float y, Pixe
void SetVectorOperation::determineResolution(unsigned int resolution[], unsigned int preferredResolution[])
{
- if (preferredResolution[0] == 0 ||preferredResolution[1]==0) {
- resolution[0] = COM_DEFAULT_RESOLUTION_WIDTH;
- resolution[1] = COM_DEFAULT_RESOLUTION_HEIGHT;
- }
- else {
- resolution[0] = preferredResolution[0];
- resolution[1] = preferredResolution[1];
- }
+ resolution[0] = preferredResolution[0];
+ resolution[1] = preferredResolution[1];
}
diff --git a/source/blender/compositor/operations/COM_SocketProxyOperation.cpp b/source/blender/compositor/operations/COM_SocketProxyOperation.cpp
index 6ed877523d1..51b16506dd9 100644
--- a/source/blender/compositor/operations/COM_SocketProxyOperation.cpp
+++ b/source/blender/compositor/operations/COM_SocketProxyOperation.cpp
@@ -41,5 +41,7 @@ void SocketProxyOperation::deinitExecution()
void SocketProxyOperation::executePixel(float *color,float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
{
- this->inputOperation->read(color, x, y, sampler, inputBuffers);
+ if (this->inputOperation) {
+ this->inputOperation->read(color, x, y, sampler, inputBuffers);
+ }
}
diff --git a/source/blender/compositor/operations/COM_TranslateOperation.cpp b/source/blender/compositor/operations/COM_TranslateOperation.cpp
index 6d2fdfc11d0..b9b06d6d356 100644
--- a/source/blender/compositor/operations/COM_TranslateOperation.cpp
+++ b/source/blender/compositor/operations/COM_TranslateOperation.cpp
@@ -32,6 +32,7 @@ TranslateOperation::TranslateOperation() : NodeOperation()
this->inputOperation = NULL;
this->inputXOperation = NULL;
this->inputYOperation = NULL;
+ this->isDeltaSet = false;
}
void TranslateOperation::initExecution()
{
@@ -39,11 +40,6 @@ void TranslateOperation::initExecution()
this->inputXOperation = this->getInputSocketReader(1);
this->inputYOperation = this->getInputSocketReader(2);
- float tempDelta[4];
- this->inputXOperation->read(tempDelta, 0, 0, COM_PS_NEAREST, NULL);
- this->deltaX = tempDelta[0];
- this->inputYOperation->read(tempDelta, 0, 0, COM_PS_NEAREST, NULL);
- this->deltaY = tempDelta[0];
}
void TranslateOperation::deinitExecution()
@@ -56,11 +52,13 @@ void TranslateOperation::deinitExecution()
void TranslateOperation::executePixel(float *color,float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
{
+ ensureDelta();
this->inputOperation->read(color, x-this->getDeltaX(), y-this->getDeltaY(), sampler, inputBuffers);
}
bool TranslateOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output)
{
+ ensureDelta();
rcti newInput;
newInput.xmax = input->xmax - this->getDeltaX();
diff --git a/source/blender/compositor/operations/COM_TranslateOperation.h b/source/blender/compositor/operations/COM_TranslateOperation.h
index eab3391041e..63d6ee0d0b5 100644
--- a/source/blender/compositor/operations/COM_TranslateOperation.h
+++ b/source/blender/compositor/operations/COM_TranslateOperation.h
@@ -32,6 +32,7 @@ private:
SocketReader*inputYOperation;
float deltaX;
float deltaY;
+ float isDeltaSet;
public:
TranslateOperation();
bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output);
@@ -42,6 +43,17 @@ public:
float getDeltaX() {return this->deltaX;}
float getDeltaY() {return this->deltaY;}
+
+ inline void ensureDelta() {
+ if (!isDeltaSet) {
+ float tempDelta[4];
+ this->inputXOperation->read(tempDelta, 0, 0, COM_PS_NEAREST, NULL);
+ this->deltaX = tempDelta[0];
+ this->inputYOperation->read(tempDelta, 0, 0, COM_PS_NEAREST, NULL);
+ this->deltaY = tempDelta[0];
+ this->isDeltaSet = true;
+ }
+ }
};
#endif
diff --git a/source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.cpp b/source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.cpp
index 270fedc174b..562b0fc2bb5 100644
--- a/source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.cpp
+++ b/source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.cpp
@@ -64,6 +64,7 @@ void VariableSizeBokehBlurOperation::executePixel(float *color, int x, int y, Me
float overallmultiplyerr = 0;
float overallmultiplyerg = 0;
float overallmultiplyerb = 0;
+ float overallmultiplyera = 0;
int miny = y - maxBlur;
int maxy = y + maxBlur;
@@ -74,16 +75,18 @@ void VariableSizeBokehBlurOperation::executePixel(float *color, int x, int y, Me
tempColor[0] += readColor[0];
tempColor[1] += readColor[1];
tempColor[2] += readColor[2];
+ tempColor[3] += readColor[3];
overallmultiplyerr += 1;
overallmultiplyerg += 1;
overallmultiplyerb += 1;
+ overallmultiplyera += 1;
for (int ny = miny ; ny < maxy ; ny += QualityStepHelper::getStep()) {
for (int nx = minx ; nx < maxx ; nx += QualityStepHelper::getStep()) {
if (nx >=0 && nx < this->getWidth() && ny >= 0 && ny < getHeight()) {
inputSizeProgram->read(tempSize, nx, ny, COM_PS_NEAREST, inputBuffers);
float size = tempSize[0];
- size += this->threshold;
+// size += this->threshold;
float dx = nx - x;
float dy = ny - y;
if (nx == x && ny == y) {
@@ -94,20 +97,22 @@ void VariableSizeBokehBlurOperation::executePixel(float *color, int x, int y, Me
float v = 256 + dy*256/size;
inputBokehProgram->read(bokeh, u, v, COM_PS_NEAREST, inputBuffers);
inputProgram->read(readColor, nx, ny, COM_PS_NEAREST, inputBuffers);
- tempColor[0] += bokeh[0] * readColor[0];
- tempColor[1] += bokeh[1] * readColor[1];
- tempColor[2] += bokeh[2]* readColor[2];
+ tempColor[0] += bokeh[1]*readColor[0];
+ tempColor[1] += bokeh[2]*readColor[1];
+ tempColor[2] += bokeh[2]*readColor[2];
+ tempColor[3] += bokeh[3]*readColor[3];
overallmultiplyerr += bokeh[0];
overallmultiplyerg += bokeh[1];
overallmultiplyerb += bokeh[2];
+ overallmultiplyera += bokeh[3];
}
}
}
}
- color[0] = tempColor[0] * (1.0f / overallmultiplyerr);
- color[1] = tempColor[1] * (1.0f / overallmultiplyerg);
- color[2] = tempColor[2] * (1.0f / overallmultiplyerb);
- color[3] = 1.0f;
+ color[0] = tempColor[0] / overallmultiplyerr;
+ color[1] = tempColor[1] / overallmultiplyerg;
+ color[2] = tempColor[2] / overallmultiplyerb;
+ color[3] = tempColor[3] / overallmultiplyera;
}
}
diff --git a/source/blender/compositor/operations/COM_WriteBufferOperation.cpp b/source/blender/compositor/operations/COM_WriteBufferOperation.cpp
index 222b879645c..8888d30ba2f 100644
--- a/source/blender/compositor/operations/COM_WriteBufferOperation.cpp
+++ b/source/blender/compositor/operations/COM_WriteBufferOperation.cpp
@@ -175,3 +175,9 @@ void WriteBufferOperation::executeOpenCLRegion(cl_context context, cl_program pr
}
delete clKernelsToCleanUp;
}
+
+void WriteBufferOperation::readResolutionFromInputSocket() {
+ NodeOperation* inputOperation = this->getInputOperation(0);
+ this->setWidth(inputOperation->getWidth());
+ this->setHeight(inputOperation->getHeight());
+}
diff --git a/source/blender/compositor/operations/COM_WriteBufferOperation.h b/source/blender/compositor/operations/COM_WriteBufferOperation.h
index 6f2c49c49bd..068adc03293 100644
--- a/source/blender/compositor/operations/COM_WriteBufferOperation.h
+++ b/source/blender/compositor/operations/COM_WriteBufferOperation.h
@@ -47,6 +47,7 @@ public:
void deinitExecution();
void setbNodeTree(const bNodeTree *tree) {this->tree = tree;}
void executeOpenCLRegion(cl_context context, cl_program program, cl_command_queue queue, rcti *rect, unsigned int chunkNumber, MemoryBuffer** memoryBuffers, MemoryBuffer* outputBuffer);
+ void readResolutionFromInputSocket();
};
#endif