Don't crash when using lmmse or vng4 on non RGB raw files, #5849
This commit is contained in:
@@ -41,6 +41,18 @@ namespace rtengine
|
|||||||
// TODO Tiles to reduce memory consumption
|
// 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)
|
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 width = winw, height = winh;
|
||||||
const int ba = 10;
|
const int ba = 10;
|
||||||
const int rr1 = height + 2 * ba;
|
const int rr1 = height + 2 * ba;
|
||||||
|
@@ -63,6 +63,18 @@ namespace rtengine
|
|||||||
|
|
||||||
void RawImageSource::vng4_demosaic (const array2D<float> &rawData, array2D<float> &red, array2D<float> &green, array2D<float> &blue)
|
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
|
BENCHFUN
|
||||||
const signed short int *cp, terms[] = {
|
const signed short int *cp, terms[] = {
|
||||||
-2, -2, +0, -1, 0, 0x01, -2, -2, +0, +0, 1, 0x01, -2, -1, -1, +0, 0, 0x01,
|
-2, -2, +0, -1, 0, 0x01, -2, -2, +0, +0, 1, 0x01, -2, -1, -1, +0, 0, 0x01,
|
||||||
|
Reference in New Issue
Block a user