Skip to content

Instantly share code, notes, and snippets.

View heckflosse's full-sized avatar

Ingo Weyrich heckflosse

View GitHub Profile
@heckflosse
heckflosse / issue3522.patch
Created January 17, 2017 23:45
issue3522.patch
diff --git a/rtgui/extprog.cc b/rtgui/extprog.cc
index d0cf441..da66436 100644
--- a/rtgui/extprog.cc
+++ b/rtgui/extprog.cc
@@ -244,8 +244,7 @@ bool ExtProgStore::openInGimp (const Glib::ustring& fileName)
#if defined WIN32
auto executable = Glib::build_filename (options.gimpDir, "bin", "gimp-win-remote");
- auto cmdLine = Glib::ustring::compose ("\"%1\" gimp-2.4.exe \"%2\"", executable, fileName);
- auto success = spawnCommandAsync (cmdLine);
@heckflosse
heckflosse / parallelfill.cpp
Created January 4, 2017 15:23
parallel floodfill from left
if (!containsXYZC(x0,y0,z0,0)) return *this;
const float nopacity = cimg::abs((float)opacity), copacity = 1 - std::max((float)opacity,0.0f);
const float tolerance2 = cimg::sqr(tolerance);
const CImg<T> ref = get_vector_at(x0,y0,z0);
CImg<ucharT> _region(_width,_height,_depth,1,0);
#pragma omp parallel
{
CImg<uintT> stack(_height,1,1,3);
unsigned int N = 0;
int x, y, z;
@heckflosse
heckflosse / test.cpp
Last active January 3, 2017 18:09
test code
while (N>0) {
_draw_fill_pop(x,y,z);
if (!_region(x,y,z)) {
bool lastXUp = false;
bool lastXDown = false;
bool firstXUp = false;
bool firstXDown = false;
if (x>=0 && x < width() && _draw_fill_is_inside(x,y,z)) {if(y > 0 && _draw_fill_is_inside(x,y-1,z)) { _draw_fill_push(x,y-1,z); firstXUp = lastXUp = true; if(y+1 < height() && _draw_fill_is_inside(x,y+1,z)) {_draw_fill_push(x,y+1,z); firstXDown = lastXDown = true; }}}
int xl = x - 1; while (xl>=0 && _draw_fill_is_inside(xl,y,z)) {if(y > 0 && _draw_fill_is_inside(xl,y-1,z)) {if(!lastXUp) { _draw_fill_push(xl,y-1,z);lastXUp = true;} } else {lastXUp = false;} if(y+1 < height() && _draw_fill_is_inside(xl,y+1,z)) {if(!lastXDown) {_draw_fill_push(xl,y+1,z);lastXDown = true;} }else{lastXDown = false;} --xl; }
@heckflosse
heckflosse / floodfill.cpp
Created January 2, 2017 16:24
flood fill
void floodFill4Impl(int y, int x, int xStart, int xEnd, int yStart, int yEnd, array2D<uint8_t> &mask, std::stack<std::pair<uint16_t, uint16_t>, std::vector<std::pair<uint16_t, uint16_t>>> &coordStack)
{
coordStack.emplace(x, y);
while(!coordStack.empty()) {
auto coord = coordStack.top();
coordStack.pop();
auto x = coord.first;
auto y = coord.second;
////////////////////////////////////////////////////////////////
//
// pentax pixelshift algorithm with motion detection
//
// non adaptive mode is derived from dcrawps (https://github.com/tomtor/dcrawps), but with additional motion correction methods and adapted for RawTherapee data structures
//
// If motion correction is enabled only the pixels which are not detected as motion are set
// That means for a complete image you have to demosaic one of the frames with a bayer demosaicer to fill red, green and blue
// before calling pixelshift in case motion correction is enabled.
//
/*
This file is part of RawTherapee.
Copyright (c) 2015 DrSlony
Copyright (c) 2016 Hombre
RawTherapee 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 3 of the License, or
(at your option) any later version.
@heckflosse
heckflosse / pixelshift
Last active November 15, 2016 23:27
simple pixelshift algorithm for pentax
////////////////////////////////////////////////////////////////
//
// pentax pixelshift algorithm with motion detection
//
// derived from dcrawps (https://github.com/tomtor/dcrawps), but with additional motion correction methods and adapted for RawTherapee data structures
//
// If motion correction is enabled only the pixels which are not detected as motion are set
// That means for a complete image you have to demosaic one of the frames with a bayer demosaicer to fill red, green and blue
// before calling pixelshift in case motion correction is enabled.
//
diff --git a/rtengine/FTblockDN.cc b/rtengine/FTblockDN.cc
index 6bb0c4c..efe9769 100644
--- a/rtengine/FTblockDN.cc
+++ b/rtengine/FTblockDN.cc
@@ -2102,13 +2102,13 @@ float ImProcFunctions::MadMax(float * DataList, int & max, int datalen)
}
-float ImProcFunctions::Mad(float * DataList, const int datalen)
+float ImProcFunctions::Mad(float * DataList, int datalen)
@heckflosse
heckflosse / rtcppcheck.log
Last active October 18, 2016 22:27
RawTherapee Cppcheck log
2016-10-19 d14e9ad branch master
[rtengine\CA_correct_RT.cc:48]: (style) The scope of the variable 'fMaxElem' can be reduced.
[rtengine\CA_correct_RT.cc:51]: (style) The scope of the variable 'm' can be reduced.
[rtengine\CA_correct_RT.cc:146]: (style) The scope of the variable 'blockave' can be reduced.
[rtengine\CA_correct_RT.cc:146]: (style) The scope of the variable 'blockdenom' can be reduced.
[rtengine\CA_correct_RT.cc:149]: (style) The scope of the variable 'processpasstwo' can be reduced.
[rtengine\CA_correct_RT.cc:151]: (style) The scope of the variable 'border' can be reduced.
[rtengine\CA_correct_RT.cc:166]: (style) The scope of the variable 'polyord' can be reduced.
[rtengine\CA_correct_RT.cc:166]: (style) The scope of the variable 'numpar' can be reduced.
int i = start;
#ifdef __SSE2__
for(; i<end - 3; i+=4) {
// sse code here
}
#endif
for(; i<end; i++) {
// scalar code here
}