25% speedup for raw false colour suppression
This commit is contained in:
@@ -16,30 +16,15 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with RawTherapee. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "rt_math.h"
|
||||
|
||||
#define SORT3(a1,a2,a3,b1,b2,b3) \
|
||||
{ \
|
||||
if ((a1)<(a2)) { \
|
||||
if ((a2)<(a3)) { \
|
||||
(b1) = (a1); (b2) = (a2); (b3) = (a3); \
|
||||
} \
|
||||
else if ((a1)<(a3)) { \
|
||||
(b1) = (a1); (b2) = (a3); (b3) = (a2); \
|
||||
} \
|
||||
else { \
|
||||
(b1) = (a3); (b2) = (a1); (b3) = (a2); \
|
||||
} \
|
||||
} \
|
||||
else { \
|
||||
if ((a3)<(a2)) { \
|
||||
(b1) = (a3); (b2) = (a2); (b3) = (a1); \
|
||||
} \
|
||||
else if ((a3)<(a1)) { \
|
||||
(b1) = (a2); (b2) = (a3); (b3) = (a1); \
|
||||
} \
|
||||
else { \
|
||||
(b1) = (a2); (b2) = (a1); (b3) = (a3); \
|
||||
} \
|
||||
} \
|
||||
b2 = min(a1,a2);\
|
||||
b1 = min(b2,a3);\
|
||||
b3 = max(a1,a2);\
|
||||
b2 = max(b2, min(b3,a3));\
|
||||
b3 = max(b3,a3);\
|
||||
}
|
||||
|
||||
#define MERGESORT(a1,a2,a3,b1,b2,b3,c1,c2,c3,c4,c5,c6) \
|
||||
|
@@ -207,8 +207,8 @@ public:
|
||||
protected:
|
||||
typedef unsigned short ushort;
|
||||
void processFalseColorCorrection (Imagefloat* i, int steps);
|
||||
inline void convert_row_to_YIQ (float* r, float* g, float* b, float* Y, float* I, float* Q, int W);
|
||||
inline void convert_row_to_RGB (float* r, float* g, float* b, float* Y, float* I, float* Q, int W);
|
||||
inline void convert_row_to_YIQ (const float* const r, const float* const g, const float* const b, float* Y, float* I, float* Q, const int W);
|
||||
inline void convert_row_to_RGB (float* r, float* g, float* b, const float* const Y, const float* const I, const float* const Q, const int W);
|
||||
|
||||
inline void convert_to_cielab_row (float* ar, float* ag, float* ab, float* oL, float* oa, float* ob);
|
||||
inline void interpolate_row_g (float* agh, float* agv, int i);
|
||||
|
@@ -27,21 +27,21 @@
|
||||
namespace rtengine
|
||||
{
|
||||
|
||||
inline void RawImageSource::convert_row_to_YIQ (float* r, float* g, float* b, float* Y, float* I, float* Q, int W)
|
||||
inline void RawImageSource::convert_row_to_YIQ (const float* const r, const float* const g, const float* const b, float* Y, float* I, float* Q, const int W)
|
||||
{
|
||||
for (int j = 0; j < W; j++) {
|
||||
Y[j] = .299 * r[j] + .587 * g[j] + .114 * b[j];
|
||||
I[j] = .596 * r[j] - .275 * g[j] - .321 * b[j];
|
||||
Q[j] = .212 * r[j] - .523 * g[j] + .311 * b[j];
|
||||
Y[j] = .299f * r[j] + .587f * g[j] + .114f * b[j];
|
||||
I[j] = .596f * r[j] - .275f * g[j] - .321f * b[j];
|
||||
Q[j] = .212f * r[j] - .523f * g[j] + .311f * b[j];
|
||||
}
|
||||
}
|
||||
|
||||
inline void RawImageSource::convert_row_to_RGB (float* r, float* g, float* b, float* Y, float* I, float* Q, int W)
|
||||
inline void RawImageSource::convert_row_to_RGB (float* r, float* g, float* b, const float* const Y, const float* const I, const float* const Q, const int W)
|
||||
{
|
||||
for (int j = 1; j < W - 1; j++) {
|
||||
r[j] = Y[j] + 0.956 * I[j] + 0.621 * Q[j];
|
||||
g[j] = Y[j] - 0.272 * I[j] - 0.647 * Q[j];
|
||||
b[j] = Y[j] - 1.105 * I[j] + 1.702 * Q[j];
|
||||
r[j] = Y[j] + 0.956f * I[j] + 0.621f * Q[j];
|
||||
g[j] = Y[j] - 0.272f * I[j] - 0.647f * Q[j];
|
||||
b[j] = Y[j] - 1.105f * I[j] + 1.702f * Q[j];
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user