From 0c1c2152622fbbc09f3fac99cf4687fdf77b0fff Mon Sep 17 00:00:00 2001 From: Ingo Weyrich Date: Sun, 15 Sep 2019 21:57:17 +0200 Subject: [PATCH 1/8] Improve readability of hasselblad_load_raw() code, #5434 --- rtengine/dcraw.cc | 121 +++++++++++++++++++++++++++------------------- 1 file changed, 70 insertions(+), 51 deletions(-) diff --git a/rtengine/dcraw.cc b/rtengine/dcraw.cc index e15a2bb0f..5e85b1e2e 100644 --- a/rtengine/dcraw.cc +++ b/rtengine/dcraw.cc @@ -2417,59 +2417,78 @@ void CLASS hasselblad_correct() void CLASS hasselblad_load_raw() { - struct jhead jh; - int shot, row, col, *back[5], len[2], diff[12], pred, sh, f, s, c; - unsigned upix, urow, ucol; - ushort *ip; + struct jhead jh; + int *back[5], diff[12]; - if (!ljpeg_start (&jh, 0)) return; - order = 0x4949; - ph1_bithuff_t ph1_bithuff(this, ifp, order); - hb_bits(-1); - back[4] = (int *) calloc (raw_width, 3*sizeof **back); - merror (back[4], "hasselblad_load_raw()"); - FORC3 back[c] = back[4] + c*raw_width; - cblack[6] >>= sh = tiff_samples > 1; - shot = LIM(shot_select, 1, tiff_samples) - 1; - for (row=0; row < raw_height; row++) { - FORC4 back[(c+3) & 3] = back[c]; - for (col=0; col < raw_width; col+=2) { - for (s=0; s < tiff_samples*2; s+=2) { - FORC(2) len[c] = ph1_huff(jh.huff[0]); - FORC(2) { - diff[s+c] = hb_bits(len[c]); - if ((diff[s+c] & (1 << (len[c]-1))) == 0) - diff[s+c] -= (1 << len[c]) - 1; - if (diff[s+c] == 65535) diff[s+c] = -32768; - } - } - for (s=col; s < col+2; s++) { - pred = 0x8000 + load_flags; - if (col) pred = back[2][s-2]; - if (col && row > 1) switch (jh.psv) { - case 11: pred += back[0][s]/2 - back[0][s-2]/2; break; - } - f = (row & 1)*3 ^ ((col+s) & 1); - FORC (tiff_samples) { - pred += diff[(s & 1)*tiff_samples+c]; - upix = pred >> sh & 0xffff; - if (raw_image && c == shot) - RAW(row,s) = upix; - if (image) { - urow = row-top_margin + (c & 1); - ucol = col-left_margin - ((c >> 1) & 1); - ip = &image[urow*width+ucol][f]; - if (urow < height && ucol < width) - *ip = c < 4 ? upix : (*ip + upix) >> 1; - } - } - back[2][s] = pred; - } + if (!ljpeg_start (&jh, 0)) { + return; + } + order = 0x4949; + ph1_bithuff_t ph1_bithuff(this, ifp, order); + hb_bits(-1); + back[4] = (int *) calloc(raw_width, 3 * sizeof **back); + merror(back[4], "hasselblad_load_raw()"); + for (int c = 0; c < 3; ++c) { + back[c] = back[4] + c * raw_width; + } + const int sh = tiff_samples > 1; + cblack[6] >>= sh; + const int shot = LIM(shot_select, 1, tiff_samples) - 1; + for (int row = 0; row < raw_height; ++row) { + for (int c = 0; c < 4; ++c) { + back[(c + 3) & 3] = back[c]; + } + for (int col = 0; col < raw_width; col += 2) { + for (int s = 0; s < tiff_samples * 2; s += 2) { + int len[2]; + for (int c = 0; c < 2; ++c) { + len[c] = ph1_huff(jh.huff[0]); + } + for (int c = 0; c < 2; ++c) { + diff[s + c] = hb_bits(len[c]); + if ((diff[s + c] & (1 << (len[c] - 1))) == 0) { + diff[s + c] -= (1 << len[c]) - 1; + } + if (diff[s + c] == 65535) { + diff[s + c] = -32768; + } + } + } + for (int s = col; s < col + 2; ++s) { + int pred; + if (col) { + pred = back[2][s - 2]; + if (row > 1 && jh.psv == 11) { + pred += back[0][s] / 2 - back[0][s - 2] / 2; + } + } else { + pred = 0x8000 + load_flags; + } + for (int c = 0; c < tiff_samples; ++c) { + pred += diff[(s & 1) * tiff_samples + c]; + const unsigned upix = pred >> sh & 0xffff; + if (raw_image && c == shot) { + RAW(row, s) = upix; + } + if (image) { + const int f = (row & 1) * 3 ^ ((col + s) & 1); + const unsigned urow = row - top_margin + (c & 1); + const unsigned ucol = col - left_margin - ((c >> 1) & 1); + ushort* const ip = &image[urow * width + ucol][f]; + if (urow < height && ucol < width) { + *ip = c < 4 ? upix : (*ip + upix) >> 1; + } + } + } + back[2][s] = pred; + } + } + } + free(back[4]); + ljpeg_end(&jh); + if (image) { + mix_green = 1; } - } - free (back[4]); - ljpeg_end (&jh); - if (image) mix_green = 1; } void CLASS leaf_hdr_load_raw() From a0c6c1569c1f7574952341e4be4a8a0859ba811a Mon Sep 17 00:00:00 2001 From: Ingo Weyrich Date: Mon, 16 Sep 2019 21:43:03 +0200 Subject: [PATCH 2/8] Fix indentations --- rtengine/dcraw.cc | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/rtengine/dcraw.cc b/rtengine/dcraw.cc index 5e85b1e2e..5275c42c1 100644 --- a/rtengine/dcraw.cc +++ b/rtengine/dcraw.cc @@ -2441,9 +2441,9 @@ void CLASS hasselblad_load_raw() for (int col = 0; col < raw_width; col += 2) { for (int s = 0; s < tiff_samples * 2; s += 2) { int len[2]; - for (int c = 0; c < 2; ++c) { - len[c] = ph1_huff(jh.huff[0]); - } + for (int c = 0; c < 2; ++c) { + len[c] = ph1_huff(jh.huff[0]); + } for (int c = 0; c < 2; ++c) { diff[s + c] = hb_bits(len[c]); if ((diff[s + c] & (1 << (len[c] - 1))) == 0) { @@ -2455,15 +2455,15 @@ void CLASS hasselblad_load_raw() } } for (int s = col; s < col + 2; ++s) { - int pred; - if (col) { + int pred; + if (col) { pred = back[2][s - 2]; if (row > 1 && jh.psv == 11) { pred += back[0][s] / 2 - back[0][s - 2] / 2; } - } else { - pred = 0x8000 + load_flags; - } + } else { + pred = 0x8000 + load_flags; + } for (int c = 0; c < tiff_samples; ++c) { pred += diff[(s & 1) * tiff_samples + c]; const unsigned upix = pred >> sh & 0xffff; From e33bee7ceab5e5f8bfbd01c3d26c60f463cc0088 Mon Sep 17 00:00:00 2001 From: scx Date: Thu, 19 Sep 2019 23:40:49 +0200 Subject: [PATCH 3/8] Update desktop file - Update Version entry (Keyword key was introduced in 1.1) - Fix GenericName - Add TryExec entry - Update Keywords --- rtdata/rawtherapee.desktop.in | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/rtdata/rawtherapee.desktop.in b/rtdata/rawtherapee.desktop.in index 233a737b6..9356c5a2d 100644 --- a/rtdata/rawtherapee.desktop.in +++ b/rtdata/rawtherapee.desktop.in @@ -1,8 +1,8 @@ [Desktop Entry] Type=Application -Version=1.0 +Version=1.1 Name=RawTherapee -GenericName=Raw photo editor +GenericName=Raw Photo Editor GenericName[cs]=Editor raw obrázků GenericName[fr]=Éditeur d'images raw GenericName[pl]=Edytor zdjęć raw @@ -11,9 +11,10 @@ Comment[cs]=Program pro konverzi a zpracování digitálních raw fotografií Comment[fr]=Logiciel de conversion et de traitement de photos numériques de format raw (but de capteur) Comment[pl]=Zaawansowany program do wywoływania zdjęć typu raw Icon=rawtherapee +TryExec=rawtherapee Exec=rawtherapee %f Terminal=false MimeType=image/jpeg;image/png;image/tiff;image/x-adobe-dng;image/x-canon-cr2;image/x-canon-crf;image/x-canon-crw;image/x-fuji-raf;image/x-hasselblad-3fr;image/x-hasselblad-fff;image/x-jpg;image/x-kodak-dcr;image/x-kodak-k25;image/x-kodak-kdc;image/x-leaf-mos;image/x-leica-rwl;image/x-mamiya-mef;image/x-minolta-mrw;image/x-nikon-nef;image/x-nikon-nrw;image/x-olympus-orf;image/x-panasonic-raw;image/x-panasonic-rw2;image/x-pentax-pef;image/x-pentax-raw;image/x-phaseone-iiq;image/x-raw;image/x-rwz;image/x-samsung-srw;image/x-sigma-x3f;image/x-sony-arq;image/x-sony-arw;image/x-sony-sr2;image/x-sony-srf;image/x-tif; Categories=Photography;Graphics;2DGraphics;RasterGraphics;GTK; -Keywords=raw;photography;develop;pp3;graphics; +Keywords=raw;photo;photography;develop;pp3;graphics; StartupWMClass=rawtherapee From 633eab24c288b2a8933af23b88d057f7df2ed0f3 Mon Sep 17 00:00:00 2001 From: scx Date: Thu, 19 Sep 2019 23:44:17 +0200 Subject: [PATCH 4/8] Update AppData file - Fix description (

tag) - Remove keywords (should be obtained from desktop file) - Fix URLs - Fix screenshot caption (too long) --- com.rawtherapee.RawTherapee.appdata.xml | 28 +++++++------------------ 1 file changed, 7 insertions(+), 21 deletions(-) diff --git a/com.rawtherapee.RawTherapee.appdata.xml b/com.rawtherapee.RawTherapee.appdata.xml index 0e5dfef50..564821cb4 100644 --- a/com.rawtherapee.RawTherapee.appdata.xml +++ b/com.rawtherapee.RawTherapee.appdata.xml @@ -8,31 +8,17 @@

Zaawansowany program do wywoływania zdjęć typu raw rawtherapee -

- RawTherapee is a powerful, cross-platform raw photo processing program. It is written mostly in C++ using a GTK+ front-end. It uses a patched version of dcraw for reading raw files, with an in-house solution which adds the highest quality support for certain camera models unsupported by dcraw and enhances the accuracy of certain raw files already supported by dcraw. It is notable for the advanced control it gives the user over the demosaicing and development process. -

-

- RawTherapee is designed for developing raw files from a broad range of digital cameras, as well as HDR DNG files and non-raw image formats (JPEG, TIFF and PNG). The target audience ranges from enthusiast newcomers who wish to broaden their understanding of how digital imaging works to semi-professional photographers. Knowledge in color science is not compulsory, but it is recommended that you are eager to learn and ready to read our documentation (RawPedia) as well as look up basic concepts which lie outside the scope of RawPedia, such as color balance, elsewhere. -

-

- Of course, professionals may use RawTherapee too while enjoying complete freedom, but will probably lack some peripheral features such as Digital Asset Management, printing, uploading, etc. RawTherapee is not aimed at being an inclusive all-in-one program, and the open-source community is sufficiently developed by now to offer all those peripheral features in other specialized software. -

+

RawTherapee is a powerful, cross-platform raw photo processing program. It is written mostly in C++ using a GTK+ front-end. It uses a patched version of dcraw for reading raw files, with an in-house solution which adds the highest quality support for certain camera models unsupported by dcraw and enhances the accuracy of certain raw files already supported by dcraw. It is notable for the advanced control it gives the user over the demosaicing and development process.

+

RawTherapee is designed for developing raw files from a broad range of digital cameras, as well as HDR DNG files and non-raw image formats (JPEG, TIFF and PNG). The target audience ranges from enthusiast newcomers who wish to broaden their understanding of how digital imaging works to semi-professional photographers. Knowledge in color science is not compulsory, but it is recommended that you are eager to learn and ready to read our documentation (RawPedia) as well as look up basic concepts which lie outside the scope of RawPedia, such as color balance, elsewhere.

+

Of course, professionals may use RawTherapee too while enjoying complete freedom, but will probably lack some peripheral features such as Digital Asset Management, printing, uploading, etc. RawTherapee is not aimed at being an inclusive all-in-one program, and the open-source community is sufficiently developed by now to offer all those peripheral features in other specialized software.

- - raw - photo - photography - develop - pp3 - graphics - CC-BY-SA-4.0 GPL-3.0+ - https://github.com/Beep6581/RawTherapee/issues/new + https://github.com/Beep6581/RawTherapee/issues https://www.paypal.me/rawtherapee - https://rawpedia.rawtherapee.com/ - https://www.rawtherapee.com/ + https://rawpedia.rawtherapee.com + https://www.rawtherapee.com https://discuss.pixls.us/t/localization-how-to-translate-rawtherapee-and-rawpedia/2594 rawtherapee.desktop @@ -48,7 +34,7 @@ - Color-correcting a drosera rotundifolia in RawTherapee 5.7. + Color-correcting a drosera rotundifolia https://rawtherapee.com/images/screenshots/rt570_1.jpg From 2415511b7011434b6f088fb46df8f4737b9e717b Mon Sep 17 00:00:00 2001 From: scx Date: Thu, 19 Sep 2019 23:55:31 +0200 Subject: [PATCH 5/8] Update desktop file - Change order of categories (Main Category before Additional Categories) --- rtdata/rawtherapee.desktop.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rtdata/rawtherapee.desktop.in b/rtdata/rawtherapee.desktop.in index 9356c5a2d..c6c675c4d 100644 --- a/rtdata/rawtherapee.desktop.in +++ b/rtdata/rawtherapee.desktop.in @@ -15,6 +15,6 @@ TryExec=rawtherapee Exec=rawtherapee %f Terminal=false MimeType=image/jpeg;image/png;image/tiff;image/x-adobe-dng;image/x-canon-cr2;image/x-canon-crf;image/x-canon-crw;image/x-fuji-raf;image/x-hasselblad-3fr;image/x-hasselblad-fff;image/x-jpg;image/x-kodak-dcr;image/x-kodak-k25;image/x-kodak-kdc;image/x-leaf-mos;image/x-leica-rwl;image/x-mamiya-mef;image/x-minolta-mrw;image/x-nikon-nef;image/x-nikon-nrw;image/x-olympus-orf;image/x-panasonic-raw;image/x-panasonic-rw2;image/x-pentax-pef;image/x-pentax-raw;image/x-phaseone-iiq;image/x-raw;image/x-rwz;image/x-samsung-srw;image/x-sigma-x3f;image/x-sony-arq;image/x-sony-arw;image/x-sony-sr2;image/x-sony-srf;image/x-tif; -Categories=Photography;Graphics;2DGraphics;RasterGraphics;GTK; +Categories=Graphics;Photography;2DGraphics;RasterGraphics;GTK; Keywords=raw;photo;photography;develop;pp3;graphics; StartupWMClass=rawtherapee From 581e46c7b053b69ebc488011f43e7290870fa287 Mon Sep 17 00:00:00 2001 From: scx Date: Thu, 19 Sep 2019 23:59:00 +0200 Subject: [PATCH 6/8] Fix AppData file - Remove unreachable screenshot URL --- com.rawtherapee.RawTherapee.appdata.xml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/com.rawtherapee.RawTherapee.appdata.xml b/com.rawtherapee.RawTherapee.appdata.xml index 564821cb4..41a669532 100644 --- a/com.rawtherapee.RawTherapee.appdata.xml +++ b/com.rawtherapee.RawTherapee.appdata.xml @@ -33,10 +33,6 @@ rawtherapee-cli - - Color-correcting a drosera rotundifolia - https://rawtherapee.com/images/screenshots/rt570_1.jpg - HDR DNG of a misty morning in the countryside https://rawtherapee.com/images/screenshots/rt540_1.jpg From c656fa0fc768c8fb8a82ca48e9a68b138bab370b Mon Sep 17 00:00:00 2001 From: Morgan Hardwood Date: Mon, 23 Sep 2019 01:21:52 +0200 Subject: [PATCH 7/8] Update screenshots in appdata file --- com.rawtherapee.RawTherapee.appdata.xml | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/com.rawtherapee.RawTherapee.appdata.xml b/com.rawtherapee.RawTherapee.appdata.xml index 41a669532..3a55109ba 100644 --- a/com.rawtherapee.RawTherapee.appdata.xml +++ b/com.rawtherapee.RawTherapee.appdata.xml @@ -33,17 +33,21 @@ rawtherapee-cli - - HDR DNG of a misty morning in the countryside - https://rawtherapee.com/images/screenshots/rt540_1.jpg + + Color correction + https://rawtherapee.com/images/screenshots/rt57_drosera_rotundifolia.png - Straight-out-of-camera vs RawTherapee - https://rawtherapee.com/images/screenshots/rt540_2.jpg + File browser + https://rawtherapee.com/images/screenshots/rt57_file_browser.png - - RawTherapee using the Auto-Matched Tone Curve tool - https://rawtherapee.com/images/screenshots/rt540_3.jpg + + High dynamic range compression + https://rawtherapee.com/images/screenshots/rt57_field_sunset.png + + + Developing a film negative + https://rawtherapee.com/images/screenshots/rt57_film_negative.png contactus@rawtherapee.com From c83b577dc7b06a8d092c27f60f2e47911e5caba8 Mon Sep 17 00:00:00 2001 From: Ingo Weyrich Date: Mon, 23 Sep 2019 14:22:14 +0200 Subject: [PATCH 8/8] hasselblad_load_raw: apply changes requested by @Floessie in code review --- rtengine/dcraw.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/rtengine/dcraw.cc b/rtengine/dcraw.cc index 5275c42c1..c9c66a8fb 100644 --- a/rtengine/dcraw.cc +++ b/rtengine/dcraw.cc @@ -2440,10 +2440,10 @@ void CLASS hasselblad_load_raw() } for (int col = 0; col < raw_width; col += 2) { for (int s = 0; s < tiff_samples * 2; s += 2) { - int len[2]; - for (int c = 0; c < 2; ++c) { - len[c] = ph1_huff(jh.huff[0]); - } + const int len[2]= { + ph1_huff(jh.huff[0]), + ph1_huff(jh.huff[0]) + }; for (int c = 0; c < 2; ++c) { diff[s + c] = hb_bits(len[c]); if ((diff[s + c] & (1 << (len[c] - 1))) == 0) {