Commit Graph

76 Commits

Author SHA1 Message Date
Lawrence37
71f452aa12 Fix crash when trying to load DCP (#7039)
Stream a C-string of the file name instead of the Glib::ustring. The
ustring can throw an exception with certain locale settings and file
name character combinations, such as with LANG=es_ES and the character
"ä".
Only print the message if verbose is true.
2024-05-27 11:13:09 -07:00
Simone Gotti
ff65f86559 dcp: use std::unique_ptr to automatically close file descriptor
Use std::unique_ptr to automatically close file descriptor instead of
manually closing it at every return point.
2024-04-24 11:37:43 +02:00
Simone Gotti
232c11c37c dcp: avoid file descriptor leak on error.
If the provided file doesn't contain valid dcp metadata the DCPProfile
constructor will return without closing the file descriptor.
2024-04-22 09:45:12 +02:00
Lawrence Lee
7eb7fb210f Merge branch 'dev' into metadata-exiv2 2023-08-12 15:08:42 -07:00
Lawrence Lee
ab2cc4ba45 Fix auto DCP detection when using US English
For systems where the locale is not English but the language in
preferences is manually set to "English (US)", the Color Management
Auto-matched camera profile option is not selectable even if a DCP
exists for the camera. This is because the Glib::ustring
casefold_collate_key() method returns a locale-dependent value. When
initializing the list of DCP files, the system locale is used. When
finding a matching DCP profile for an image, a different locale is used
because the LANG environment variable is set while initializing the
RawTherapee GUI language.
2023-07-15 18:36:26 -07:00
Lawrence Lee
006a7d9975 Fix CodeQL alert 2023-02-18 18:16:12 -08:00
Lawrence Lee
8704c1dd86 Add bound check
Thanks to Floessie
(https://github.com/Beep6581/RawTherapee/pull/5889#discussion_r622755925)
2023-02-15 21:34:03 -08:00
Lawrence Lee
3833c6e634 Merge branch 'dev' into metadata-exiv2 2023-02-05 12:29:58 -08:00
Lawrence Lee
ec84e17224 Restore cleanups to rtengine/dcp.* 2022-12-03 22:21:30 -08:00
Lawrence Lee
4223f114cb Clean up merge 2022-12-03 21:24:17 -08:00
Ingo Weyrich
ce3c5d4cf1 cppcheck clean rtengine/dcp.h 2021-05-22 12:26:46 +02:00
Thanatomanic
9fcf45dca5 Several fixes and changes made by Floessie earlier 2021-04-27 21:35:43 +02:00
Thanatomanic
badf92ba64 Fix for declared near() function, backport from ART. Various other minor changes. 2020-10-16 13:30:47 +02:00
Thanatomanic
d9799ec5de Fix dcp.cc with some help from the implementation in ART 2020-10-16 12:39:17 +02:00
Thanatomanic
8b4389ade9 Resolve exiv2 merge conflicts and merge with 2020-10-16 11:45:26 +02:00
Ingo Weyrich
b2443b0e7e more double promote fixes, still not complete 2020-01-21 00:16:27 +01:00
Ingo Weyrich
6335b68a80 Further reduction of include dependencies 2019-11-03 14:52:42 +01:00
Ingo Weyrich
d731e172c2 Further reduction of include dependencies 2019-11-01 16:15:59 +01:00
Ingo Weyrich
cac2eb53ef Further reduction of include dependencies 2019-10-31 20:41:08 +01:00
Ingo Weyrich
6935faa258 Further cleanup of include dependencies 2019-10-30 22:12:06 +01:00
Ingo Weyrich
ba8dda1836 Further cleanup of include dependencies 2019-10-30 16:38:02 +01:00
Flössie
d7ec033829 Reduce dcp.h dependencies 2019-10-30 09:30:21 +01:00
Ingo Weyrich
ed161c6288 Reduce rawimage.h dependencies 2019-10-29 15:21:02 +01:00
Ingo Weyrich
c11087c28d Cleanup curves.h includes 2019-10-29 14:15:45 +01:00
Ingo Weyrich
20726d5bfe Forward declare Imagefloat 2019-10-28 20:01:16 +01:00
Flössie
28f0bc14da Merge branch 'dev' into metadata-exiv2
- Rating (#5325) not yet implemented
2019-09-24 14:30:54 +02:00
Morgan Hardwood
60b2196bce Updated gnu.org links to use HTTPS 2019-09-10 12:34:57 +02:00
Ingo Weyrich
4c99c9cf01 cppcheck: further fixes 2019-08-07 15:32:52 +02:00
Ingo Weyrich
7257aee235 DCPStore: use std::string instead of slow Glib::ustring 2019-07-12 12:56:47 +02:00
Flössie
801e7b175e DCPMetadata review 2019-05-19 22:12:27 +02:00
Flössie
ba4de904cc Cleanups and a few fixes 2019-05-10 21:24:22 +02:00
Alberto Griggio
c360fd7e2c Use exiv2 for metadata handling 2019-05-06 09:27:44 +02:00
heckflosse
540e359945 Inline DCPProfile::hsdApply() to speedup applying dcp profiles, closes #5206 2019-03-08 01:44:51 +01:00
George Hilliard
a63cd8a87c Fix mismatched malloc/delete leak, take 2 with cJSON_Delete
From the Valgrind report:

```
Mismatched free() / delete / delete []
   at 0x4838EAB: operator delete(void*) (vg_replace_malloc.c:576)
   by 0xBC5C87: std::default_delete<cJSON>::operator()(cJSON*) const (unique_ptr.h:81)
   by 0xBC4ACA: std::unique_ptr<cJSON, std::default_delete<cJSON> >::~unique_ptr() (unique_ptr.h:274)
   by 0xBBB755: (anonymous namespace)::getAliases(Glib::ustring const&) (dcp.cc:422)
   by 0xBC1CCA: rtengine::DCPStore::init(Glib::ustring const&, bool) (dcp.cc:1846)
   by 0xC3ED4F: rtengine::init(rtengine::Settings const*, Glib::ustring, Glib::ustring, bool) [clone ._omp_fn.0] (init.cc:81)
   by 0x89743FF: GOMP_parallel_sections (sections.c:158)
   by 0xC3E906: rtengine::init(rtengine::Settings const*, Glib::ustring, Glib::ustring, bool) (init.cc:52)
   by 0x9CE10E: Options::load(bool) (options.cc:2358)
   by 0x982CD6: main (main.cc:603)
 Address 0xd62d700 is 0 bytes inside a block of size 64 alloc'd
   at 0x483777F: malloc (vg_replace_malloc.c:299)
   by 0xE97390: cJSON_New_Item (cJSON.c:205)
   by 0xE98718: cJSON_ParseWithOpts (cJSON.c:1020)
   by 0xE9886F: cJSON_Parse (cJSON.c:1083)
   by 0xBBB4D3: (anonymous namespace)::getAliases(Glib::ustring const&) (dcp.cc:422)
   by 0xBC1CCA: rtengine::DCPStore::init(Glib::ustring const&, bool) (dcp.cc:1846)
   by 0xC3ED4F: rtengine::init(rtengine::Settings const*, Glib::ustring, Glib::ustring, bool) [clone ._omp_fn.0] (init.cc:81)
   by 0x89743FF: GOMP_parallel_sections (sections.c:158)
   by 0xC3E906: rtengine::init(rtengine::Settings const*, Glib::ustring, Glib::ustring, bool) (init.cc:52)
   by 0x9CE10E: Options::load(bool) (options.cc:2358)
   by 0x982CD6: main (main.cc:603)
```
2018-11-07 12:11:43 -06:00
George Hilliard
7cbf198db8 Revert "Fix mismatched malloc/delete leak"
This reverts commit 77eccdf13d.
2018-11-07 11:55:02 -06:00
George Hilliard
77eccdf13d Fix mismatched malloc/delete leak
From the Valgrind report:

```
Mismatched free() / delete / delete []
   at 0x4838EAB: operator delete(void*) (vg_replace_malloc.c:576)
   by 0xBC5C87: std::default_delete<cJSON>::operator()(cJSON*) const (unique_ptr.h:81)
   by 0xBC4ACA: std::unique_ptr<cJSON, std::default_delete<cJSON> >::~unique_ptr() (unique_ptr.h:274)
   by 0xBBB755: (anonymous namespace)::getAliases(Glib::ustring const&) (dcp.cc:422)
   by 0xBC1CCA: rtengine::DCPStore::init(Glib::ustring const&, bool) (dcp.cc:1846)
   by 0xC3ED4F: rtengine::init(rtengine::Settings const*, Glib::ustring, Glib::ustring, bool) [clone ._omp_fn.0] (init.cc:81)
   by 0x89743FF: GOMP_parallel_sections (sections.c:158)
   by 0xC3E906: rtengine::init(rtengine::Settings const*, Glib::ustring, Glib::ustring, bool) (init.cc:52)
   by 0x9CE10E: Options::load(bool) (options.cc:2358)
   by 0x982CD6: main (main.cc:603)
 Address 0xd62d700 is 0 bytes inside a block of size 64 alloc'd
   at 0x483777F: malloc (vg_replace_malloc.c:299)
   by 0xE97390: cJSON_New_Item (cJSON.c:205)
   by 0xE98718: cJSON_ParseWithOpts (cJSON.c:1020)
   by 0xE9886F: cJSON_Parse (cJSON.c:1083)
   by 0xBBB4D3: (anonymous namespace)::getAliases(Glib::ustring const&) (dcp.cc:422)
   by 0xBC1CCA: rtengine::DCPStore::init(Glib::ustring const&, bool) (dcp.cc:1846)
   by 0xC3ED4F: rtengine::init(rtengine::Settings const*, Glib::ustring, Glib::ustring, bool) [clone ._omp_fn.0] (init.cc:81)
   by 0x89743FF: GOMP_parallel_sections (sections.c:158)
   by 0xC3E906: rtengine::init(rtengine::Settings const*, Glib::ustring, Glib::ustring, bool) (init.cc:52)
   by 0x9CE10E: Options::load(bool) (options.cc:2358)
   by 0x982CD6: main (main.cc:603)
```
2018-11-02 03:06:59 -05:00
heckflosse
0edd4bfcea dcp profiles not found when user dcp profile dir did not exist 2018-06-14 15:38:40 +02:00
Alberto Griggio
09b5dca08d merge branch 'user-dcp-profiles-dir' 2018-06-13 14:31:07 +02:00
Flössie
df5c385135 Use cJSON_Minify() and fix missed const opportunities 2018-04-11 20:16:35 +02:00
Flössie
4332b7edeb Implement dcpprofiles/camera_model_aliases.json (#4500) 2018-04-10 20:33:54 +02:00
Alberto Griggio
4344603a3d further fixes to ensure smooth transitions to clipped colours 2018-04-04 01:05:23 +02:00
Alberto Griggio
b42a45b481 merged branch 'unbounded-processing' into 'dev' 2018-03-28 21:35:23 +02:00
Alberto Griggio
b09bf381b4 added possibility to specify extra working spaces via a json file
The JSON file is called workingspaces.json, it can be either in the global iccprofiles directory, or in the user's ICC profiles dir (set in preferences).

The format is the following:

{"working_spaces": [
    {
        "name" : "ACES",
        "file" : "/path/to/ACES.icc"
    },
    {
        "name" : "ACEScg",
        "matrix" : [0.7184354, 0.16578523, 0.09882643, 0.29728935, 0.66958117, 0.03571544, -0.00647622, 0.01469771, 0.66732561]
    }
]}

if "matrix" is present, "file" is ignored. If only "file" is present, the matrix is extracted from the ICC profile. For this, we look only at the R, G, and B matrix columns and the white point set in the profile. Bradford adaptation is used to convert the matrix to D50. Anything else (LUT, TRC, ...) in the profile is ignored.

It is the user's responsibility to ensure that the profile is suitable to be used as a working space.
2018-03-20 15:06:09 +01:00
Alberto Griggio
08846264c7 started work on making RT not clip the image at intermediate stages 2018-02-09 21:25:39 +01:00
Alberto Griggio
5d5c51d200 added support for user-specific DCP and input ICC profiles dirs
Look for direcories dcpprofiles/ and iccprofiles/input/ under Options::rtdir
(typically something like $HOME/.config/RawTherapee)
2018-02-07 09:34:19 +01:00
heckflosse
0498048ca0 Speedup for DCPProfile::apply(), closes #4294 2018-01-13 12:23:46 +01:00
Hombre57
ee0bff4124 Updated frame handling with any type of hierarchy (see #4008)
Images can now be detected in nested IFDs or as root IFDs.
2017-09-16 22:30:07 +02:00
Hombre57
f23be9345c Add multi-frame handling.
- Exif of all frames are displayed in the Editor's Exif tab (without
separator)
- isHDR and isPixelShift is added to the data files stored in cache
- In the Editor panel, the QuickInfo frame display the HDR and
PixelShift information, as well as the number of frame and bit-depth for
HDR image
- the number of frame is provided by dcraw. If not set, it is provided
by the Exif's main IFD count
- the PixelShift information (for Pentax as of now) is provided by
looking at the Exif informations
- the HDR information is provided by the Exif information of the first
frame for Pentax raw files, or by the bitspersample, sampleformat and
compression tags for other files

TODO: add icons to the thumbnails to tag HDR and PixelShift files.
2017-08-08 23:42:05 +02:00
heckflosse
642b4cc86c Fix some coverity issues 2017-06-16 21:21:22 +02:00
Alberto Griggio
2edd677d1a Fixed various memory leaks as reported by AddressSanitizer 2017-06-07 10:36:28 +02:00