[Bf-blender-cvs] [ef33f66] blender-tiles: uhh.... missed some
Jeroen Bakker
noreply at git.blender.org
Wed Sep 17 21:52:39 CEST 2014
Commit: ef33f661d66a281ecb38ee70c7cd1dd1a7b380ae
Author: Jeroen Bakker
Date: Wed Sep 17 21:52:07 2014 +0200
Branches: blender-tiles
https://developer.blender.org/rBef33f661d66a281ecb38ee70c7cd1dd1a7b380ae
uhh.... missed some
===================================================================
M source/blender/compositor/intern/COM_MemoryBuffer.cpp
A source/blender/compositor/intern/COM_SocketReader.cpp
A source/blender/compositor/intern/COM_SocketReader.h
M source/blender/compositor/operations/COM_PlaneDistortCommonOperation.cpp
M source/blender/compositor/operations/COM_ScreenLensDistortionOperation.cpp
===================================================================
diff --git a/source/blender/compositor/intern/COM_MemoryBuffer.cpp b/source/blender/compositor/intern/COM_MemoryBuffer.cpp
index e1a5fe7..fe082d3 100644
--- a/source/blender/compositor/intern/COM_MemoryBuffer.cpp
+++ b/source/blender/compositor/intern/COM_MemoryBuffer.cpp
@@ -206,7 +206,7 @@ void MemoryBuffer::addPixel(int x, int y, const float color[4])
{
const int offset = (this->m_chunkWidth * (y - this->m_rect.ymin) + x - this->m_rect.xmin) * this->m_num_channels;
float *dst = &this->m_buffer[offset];
- float *src = color;
+ const float *src = color;
for (int i = 0; i < this->m_num_channels ; i++, dst++, src++) {
*dst += *src;
}
diff --git a/source/blender/compositor/intern/COM_SocketReader.cpp b/source/blender/compositor/intern/COM_SocketReader.cpp
new file mode 100644
index 0000000..45f3be5
--- /dev/null
+++ b/source/blender/compositor/intern/COM_SocketReader.cpp
@@ -0,0 +1,25 @@
+/*
+ * Copyright 2011, Blender Foundation.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Contributor:
+ * Jeroen Bakker
+ * Monique Dewanchand
+ */
+
+#include "COM_SocketReader.h"
+
+
diff --git a/source/blender/compositor/intern/COM_SocketReader.h b/source/blender/compositor/intern/COM_SocketReader.h
new file mode 100644
index 0000000..c996ef5
--- /dev/null
+++ b/source/blender/compositor/intern/COM_SocketReader.h
@@ -0,0 +1,119 @@
+/*
+ * Copyright 2011, Blender Foundation.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Contributor:
+ * Jeroen Bakker
+ * Monique Dewanchand
+ */
+
+#ifndef _COM_SocketReader_h
+#define _COM_SocketReader_h
+#include "BLI_rect.h"
+#include "COM_defines.h"
+
+#ifdef WITH_CXX_GUARDEDALLOC
+#include "MEM_guardedalloc.h"
+#endif
+
+typedef enum PixelSampler {
+ COM_PS_NEAREST = 0,
+ COM_PS_BILINEAR = 1,
+ COM_PS_BICUBIC = 2
+} PixelSampler;
+
+class MemoryBuffer;
+/**
+ * @brief Helper class for reading socket data.
+ * Only use this class for dispatching (un-ary and n-ary) executions.
+ * @ingroup Execution
+ */
+class SocketReader {
+private:
+protected:
+ /**
+ * @brief Holds the width of the output of this operation.
+ */
+ unsigned int m_width;
+
+ /**
+ * @brief Holds the height of the output of this operation.
+ */
+ unsigned int m_height;
+
+
+ /**
+ * @brief calculate a single pixel
+ * @note this method is called for non-complex
+ * @param result is a float[4] array to store the result
+ * @param x the x-coordinate of the pixel to calculate in image space
+ * @param y the y-coordinate of the pixel to calculate in image space
+ * @param inputBuffers chunks that can be read by their ReadBufferOperation.
+ */
+ virtual void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) {}
+
+ /**
+ * @brief calculate a single pixel
+ * @note this method is called for complex
+ * @param result is a float[4] array to store the result
+ * @param x the x-coordinate of the pixel to calculate in image space
+ * @param y the y-coordinate of the pixel to calculate in image space
+ * @param inputBuffers chunks that can be read by their ReadBufferOperation.
+ * @param chunkData chunk specific data a during execution time.
+ */
+ virtual void executePixel(float output[4], int x, int y, void *chunkData) {
+ executePixelSampled(output, x, y, COM_PS_NEAREST);
+ }
+
+ /**
+ * @brief calculate a single pixel using an EWA filter
+ * @note this method is called for complex
+ * @param result is a float[4] array to store the result
+ * @param x the x-coordinate of the pixel to calculate in image space
+ * @param y the y-coordinate of the pixel to calculate in image space
+ * @param dx
+ * @param dy
+ * @param inputBuffers chunks that can be read by their ReadBufferOperation.
+ */
+ virtual void executePixelFiltered(float output[4], float x, float y, float dx[2], float dy[2], PixelSampler sampler) {}
+
+public:
+ inline void readSampled(float result[4], float x, float y, PixelSampler sampler) {
+ executePixelSampled(result, x, y, sampler);
+ }
+ inline void read(float result[4], int x, int y, void *chunkData) {
+ executePixel(result, x, y, chunkData);
+ }
+ inline void readFiltered(float result[4], float x, float y, float dx[2], float dy[2], PixelSampler sampler) {
+ executePixelFiltered(result, x, y, dx, dy, sampler);
+ }
+
+ virtual void *initializeTileData(rcti *rect) { return 0; }
+ virtual void deinitializeTileData(rcti *rect, void *data) {}
+
+ virtual ~SocketReader() {}
+
+ virtual MemoryBuffer *getInputMemoryBuffer(MemoryBuffer **memoryBuffers) { return 0; }
+
+ inline const unsigned int getWidth() const { return this->m_width; }
+ inline const unsigned int getHeight() const { return this->m_height; }
+
+#ifdef WITH_CXX_GUARDEDALLOC
+ MEM_CXX_CLASS_ALLOC_FUNCS("COM:SocketReader")
+#endif
+};
+
+#endif /* _COM_SocketReader_h */
diff --git a/source/blender/compositor/operations/COM_PlaneDistortCommonOperation.cpp b/source/blender/compositor/operations/COM_PlaneDistortCommonOperation.cpp
index c507b4c..6caad2b 100644
--- a/source/blender/compositor/operations/COM_PlaneDistortCommonOperation.cpp
+++ b/source/blender/compositor/operations/COM_PlaneDistortCommonOperation.cpp
@@ -106,7 +106,7 @@ void PlaneDistortWarpImageOperation::executePixelSampled(float output[4], float
pixelTransform(xy, uv, deriv);
- m_pixelReader->readFiltered(output, uv[0], uv[1], deriv[0], deriv[1], COM_PS_BILINEAR);
+ m_pixelReader->readFiltered(output, uv[0], uv[1], deriv[0], deriv[1], COM_PS_BICUBIC);
}
void PlaneDistortWarpImageOperation::pixelTransform(const float xy[2], float r_uv[2], float r_deriv[2][2])
diff --git a/source/blender/compositor/operations/COM_ScreenLensDistortionOperation.cpp b/source/blender/compositor/operations/COM_ScreenLensDistortionOperation.cpp
index ad9b761..5ce7184 100644
--- a/source/blender/compositor/operations/COM_ScreenLensDistortionOperation.cpp
+++ b/source/blender/compositor/operations/COM_ScreenLensDistortionOperation.cpp
@@ -147,7 +147,7 @@ void ScreenLensDistortionOperation::accumulate(MemoryBuffer *buffer,
float xy[2];
distort_uv(uv, t, xy);
- buffer->readBilinear(color, xy[0], xy[1]);
+ buffer->readBicubic(color, xy[0], xy[1]);
sum[a] += (1.0f - tz) * color[a], sum[b] += tz * color[b];
++count[a];
More information about the Bf-blender-cvs
mailing list