Skip to content

Commit

Permalink
Merge pull request #69 from CarVac/dev
Browse files Browse the repository at this point in the history
Quick Pipe
  • Loading branch information
CarVac authored May 30, 2018
2 parents 573e9c4 + 369f72a commit 1150b31
Show file tree
Hide file tree
Showing 22 changed files with 1,209 additions and 167 deletions.
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ sudo: require
dist: trusty

before_install:
- sudo add-apt-repository ppa:beineri/opt-qt59-trusty -y
- sudo add-apt-repository ppa:beineri/opt-qt591-trusty -y
- sudo apt-get update -qq

install:
Expand All @@ -16,6 +16,7 @@ script:
- git clone https://github.com/LibRaw/LibRaw-demosaic-pack-GPL2.git
- git clone https://github.com/LibRaw/LibRaw-demosaic-pack-GPL3.git
- cd LibRaw
- git checkout 0.18-stable
- patch -p1 < ../patches/libraw-makefile.patch
- make -j3 -f Makefile.dist
- sudo make install -f Makefile.dist
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ libtiff
libgomp
libexiv2
libjpeg
libraw
libraw v0.18 or older

Some libraw package maintainers don't include the GPL demosaic packs, so we highly encourage you to compile it yourself.

It also requires Qt 5.4: open the .pro file from Qt Creator and select Build in order to run it. You may have to initialize the build configurations upon first loading the project; I suggest you add the -j# flag to the Make build parameters to speed compilation.
It also requires Qt 5.4 or newer: open the .pro file from Qt Creator and select Build in order to run it. You may have to initialize the build configurations upon first loading the project; I suggest you add the -j# flag to the Make build parameters to speed compilation.

A note: Use a standalone git client to clone the repository initially, and then you can use Qt Creator's built-in git tools.

Expand Down Expand Up @@ -55,7 +55,7 @@ If you want the UI to appear larger on a high-pixel density display, use the Use

# Status

If told to make a version number for it right now, I'd put it as 0.6.3.
If told to make a version number for it right now, I'd put it as 0.7.0.

Currently, the photo editor is mostly complete, although noise reduction and sharpening are currently missing. Both the Import and Organize tabs need some UI massaging, as does the queue. Finally, the Output tab hasn't even been started yet.

Expand Down
35 changes: 34 additions & 1 deletion filmulator-gui/core/diffuse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,8 @@ void diffuse_x(matrix<float> &developer_concentration, int convlength,
// in Signal Processing 44 (1995) 139-151
//Referencing code from here:
//https://github.com/halide/Halide/blob/e23f83b9bde63ed64f4d9a2fbe1ed29b9cfbf2e6/test/generator/gaussian_blur_generator.cpp

//Don't use this for radii > 70!!!
void diffuse_short_convolution(matrix<float> &developer_concentration,
const float sigma_const,
const float pixels_per_millimeter,
Expand All @@ -178,7 +180,7 @@ void diffuse_short_convolution(matrix<float> &developer_concentration,
const int width = developer_concentration.nc();

//Compute the standard deviation of the blur we want, in pixels.
double sigma = sqrt(timestep*pow(sigma_const*pixels_per_millimeter,2));
const double sigma = sqrt(timestep*pow(sigma_const*pixels_per_millimeter,2));

//We set the padding to be 4 standard deviations so as to catch as much as possible.
const int paddedWidth = width + 4*sigma + 3;
Expand Down Expand Up @@ -456,3 +458,34 @@ void diffuse_short_convolution(matrix<float> &developer_concentration,
}
}
}

//Since the aforementioned infinite impulse response doesn't work nicely with large radii,
//this will downsample it so that the radius ends up at about 30.
//Then, it'll apply the van Vliet IIR filter.
//If the radius was already less than 70, then it won't downsample at all.
void diffuse_resize_iir(matrix<float> &developer_concentration,
const float sigma_const,
const float pixels_per_millimeter,
const float timestep)
{
//set up test sigma
const double sigma = sqrt(timestep*pow(sigma_const*pixels_per_millimeter,2));

std::cout << "sigma: " << sigma << "=======================================================" << std::endl;

//If it's small enough, we're not going to resize at all.
if (sigma < 70)
{
diffuse_short_convolution(developer_concentration,
sigma_const,
pixels_per_millimeter,
timestep);
}
else
{
diffuse(developer_concentration,
sigma_const,
pixels_per_millimeter,
timestep);
}
}
5 changes: 5 additions & 0 deletions filmulator-gui/core/filmSim.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,11 @@ void diffuse_short_convolution(matrix<float> &developer_concentration,
const float pixels_per_millimeter,
const float timestep);

void diffuse_resize_iir(matrix<float> &developer_concentration,
const float sigma_const,
const float pixels_per_millimeter,
const float timestep);

//Reading raws with libraw
//TODO: remove
//PROBABLY NOT NECESSARY ANYMORE
Expand Down
32 changes: 18 additions & 14 deletions filmulator-gui/core/filmulate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ bool ImagePipeline::filmulate(matrix<float> &input_image,
FilmParams filmParam;
AbortStatus abort;
Valid valid;
std::tie(valid, abort, filmParam) = paramManager->claimFilmParams(FilmFetch::initial);
std::tie(valid, abort, filmParam) = paramManager->claimFilmParams();
if(abort == AbortStatus::restart)
{
return true;
Expand Down Expand Up @@ -120,14 +120,14 @@ bool ImagePipeline::filmulate(matrix<float> &input_image,
for(int i = 0; i <= development_steps; i++)
{
//Check for cancellation
std::tie(valid, abort, filmParam) = paramManager->claimFilmParams(FilmFetch::subsequent);
abort = paramManager->claimFilmAbort();
if(abort == AbortStatus::restart)
{
return true;
}

//Updating for starting the development simulation. Valid is one too high here.
pipeline->updateProgress(Valid::prefilmulation, float(i)/float(development_steps));
pipeline->updateProgress(Valid::partfilmulation, float(i)/float(development_steps));

gettimeofday(&develop_start,NULL);

Expand All @@ -148,26 +148,30 @@ bool ImagePipeline::filmulate(matrix<float> &input_image,
gettimeofday(&diffuse_start,NULL);

//Check for cancellation
std::tie(valid, abort, filmParam) = paramManager->claimFilmParams(FilmFetch::subsequent);
abort = paramManager->claimFilmAbort();
if(abort == AbortStatus::restart)
{
return true;
}

//Updating for starting the diffusion simulation. Valid is one too high here.
pipeline->updateProgress(Valid::prefilmulation, float(i)/float(development_steps));
pipeline->updateProgress(Valid::partfilmulation, float(i)/float(development_steps));

//Now, we are going to perform the diffusion part.
//Here we mix the layer among itself, which grants us the
// local contrast increases.
// diffuse(developer_concentration,
// sigma_const,
// pixels_per_millimeter,
// timestep);
diffuse_short_convolution(developer_concentration,
sigma_const,
pixels_per_millimeter,
timestep);
diffuse(developer_concentration,
sigma_const,
pixels_per_millimeter,
timestep);
// diffuse_short_convolution(developer_concentration,
// sigma_const,
// pixels_per_millimeter,
// timestep);
// diffuse_resize_iir(developer_concentration,
// sigma_const,
// pixels_per_millimeter,
// timestep);

diffuse_dif += timeDiff(diffuse_start);

Expand Down Expand Up @@ -216,7 +220,7 @@ bool ImagePipeline::filmulate(matrix<float> &input_image,
struct timeval mult_start;
gettimeofday(&mult_start,NULL);

std::tie(valid, abort, filmParam) = paramManager->claimFilmParams(FilmFetch::subsequent);
abort = paramManager->claimFilmAbort();
if(abort == AbortStatus::restart)
{
return true;
Expand Down
Loading

0 comments on commit 1150b31

Please sign in to comment.