Don't crash when using lmmse or vng4 on non RGB raw files, #5849

This commit is contained in:
Ingo Weyrich
2020-07-14 21:05:41 +02:00
parent fccb582e88
commit c322127db3
2 changed files with 24 additions and 0 deletions

View File

@@ -41,6 +41,18 @@ namespace rtengine
// TODO Tiles to reduce memory consumption
void RawImageSource::lmmse_interpolate_omp(int winw, int winh, const array2D<float> &rawData, array2D<float> &red, array2D<float> &green, array2D<float> &blue, int iterations)
{
// Test for RGB cfa
for (int i = 0; i < 2; i++) {
for (int j = 0; j < 2; j++) {
if (FC(i, j) == 3) {
// avoid crash
std::cout << "lmmse_interpolate_omp supports only RGB Colour filter arrays. Falling back to igv_interpolate" << std::endl;
igv_interpolate(winw, winh);
return;
}
}
}
const int width = winw, height = winh;
const int ba = 10;
const int rr1 = height + 2 * ba;

View File

@@ -63,6 +63,18 @@ namespace rtengine
void RawImageSource::vng4_demosaic (const array2D<float> &rawData, array2D<float> &red, array2D<float> &green, array2D<float> &blue)
{
// Test for RGB cfa
for (int i = 0; i < 2; i++) {
for (int j = 0; j < 2; j++) {
if (FC(i, j) == 3) {
// avoid crash
std::cout << "vng4_demosaic supports only RGB Colour filter arrays. Falling back to igv_interpolate" << std::endl;
igv_interpolate(W, H);
return;
}
}
}
BENCHFUN
const signed short int *cp, terms[] = {
-2, -2, +0, -1, 0, 0x01, -2, -2, +0, +0, 1, 0x01, -2, -1, -1, +0, 0, 0x01,