a87fb34eda
This gives around 30% of speedup for gaussian blur node. Pretty much straightforward implementation inside the node itself, but needed to implement some additional things: - Aligned malloc. It's needed to load data onto SSE registers faster. based on the aligned_malloc() from Libmv with some additional trickery going on to support arbitrary alignment (this magic is needed because of MemHead). In the practice only 16bit alignment is supported because of the lack of aligned malloc with arbitrary alignment for OSX. Not a bit deal for now because we need 16 bytes alignment at this moment only. Could be tweaked further later. - Memory buffers in compositor are now aligned to 16 bytes. Should be harmless for non-SSE cases too. just mentioning. Reviewers: campbellbarton, lukastoenne, jbakker Reviewed By: campbellbarton CC: lockal Differential Revision: https://developer.blender.org/D564
74 lines
1.8 KiB
C++
74 lines
1.8 KiB
C++
/*
|
|
* 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_BlurBaseOperation_h
|
|
#define _COM_BlurBaseOperation_h
|
|
#include "COM_NodeOperation.h"
|
|
#include "COM_QualityStepHelper.h"
|
|
|
|
#define MAX_GAUSSTAB_RADIUS 30000
|
|
|
|
#ifdef __SSE2__
|
|
# include <emmintrin.h>
|
|
#endif
|
|
|
|
class BlurBaseOperation : public NodeOperation, public QualityStepHelper {
|
|
private:
|
|
|
|
protected:
|
|
|
|
BlurBaseOperation(DataType data_type);
|
|
float *make_gausstab(float rad, int size);
|
|
#ifdef __SSE2__
|
|
__m128 *convert_gausstab_sse(const float *gaustab, float rad, int size);
|
|
#endif
|
|
float *make_dist_fac_inverse(float rad, int size, int falloff);
|
|
|
|
void updateSize();
|
|
|
|
/**
|
|
* Cached reference to the inputProgram
|
|
*/
|
|
SocketReader *m_inputProgram;
|
|
SocketReader *m_inputSize;
|
|
NodeBlurData m_data;
|
|
|
|
float m_size;
|
|
bool m_sizeavailable;
|
|
|
|
public:
|
|
/**
|
|
* Initialize the execution
|
|
*/
|
|
void initExecution();
|
|
|
|
/**
|
|
* Deinitialize the execution
|
|
*/
|
|
void deinitExecution();
|
|
|
|
void setData(const NodeBlurData *data);
|
|
|
|
void setSize(float size) { this->m_size = size; this->m_sizeavailable = true; }
|
|
};
|
|
#endif
|