"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "rtengine/imageio.cc" between
rawtherapee-5.6.tar.xz and rawtherapee-5.7.tar.xz

About: RawTherapee is a powerful cross-platform raw image processing program.

imageio.cc  (rawtherapee-5.6.tar.xz):imageio.cc  (rawtherapee-5.7.tar.xz)
skipping to change at line 18 skipping to change at line 18
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* RawTherapee is distributed in the hope that it will be useful, * RawTherapee is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with RawTherapee. If not, see <http://www.gnu.org/licenses/>. * along with RawTherapee. If not, see <https://www.gnu.org/licenses/>.
*/ */
#include <png.h> #include <png.h>
#include <glib/gstdio.h> #include <glib/gstdio.h>
#include <tiff.h> #include <tiff.h>
#include <tiffio.h> #include <tiffio.h>
#include <cstdio> #include <cstdio>
#include <cstring> #include <cstring>
#include <fcntl.h> #include <fcntl.h>
#include <libiptcdata/iptc-jpeg.h> #include <libiptcdata/iptc-jpeg.h>
#include "rt_math.h" #include "rt_math.h"
skipping to change at line 92 skipping to change at line 92
// For only copying the raw input data // For only copying the raw input data
void ImageIO::setMetadata (const rtexif::TagDirectory* eroot) void ImageIO::setMetadata (const rtexif::TagDirectory* eroot)
{ {
if (exifRoot != nullptr) { if (exifRoot != nullptr) {
delete exifRoot; delete exifRoot;
exifRoot = nullptr; exifRoot = nullptr;
} }
if (eroot) { if (eroot) {
rtexif::TagDirectory* td = ((rtexif::TagDirectory*)eroot)->clone (nullpt r); rtexif::TagDirectory* td = eroot->clone (nullptr);
// make IPTC and XMP pass through // make IPTC and XMP pass through
td->keepTag(0x83bb); // IPTC td->keepTag(0x83bb); // IPTC
td->keepTag(0x02bc); // XMP td->keepTag(0x02bc); // XMP
exifRoot = td; exifRoot = td;
} }
} }
// For merging with RT specific data // For merging with RT specific data
skipping to change at line 116 skipping to change at line 116
// store exif info // store exif info
exifChange->clear(); exifChange->clear();
*exifChange = exif; *exifChange = exif;
if (exifRoot != nullptr) { if (exifRoot != nullptr) {
delete exifRoot; delete exifRoot;
exifRoot = nullptr; exifRoot = nullptr;
} }
if (eroot) { if (eroot) {
exifRoot = ((rtexif::TagDirectory*)eroot)->clone (nullptr); exifRoot = eroot->clone (nullptr);
} }
if (iptc != nullptr) { if (iptc != nullptr) {
iptc_data_free (iptc); iptc_data_free (iptc);
iptc = nullptr; iptc = nullptr;
} }
// build iptc structures for libiptcdata // build iptc structures for libiptcdata
if (iptcc.empty()) { if (iptcc.empty()) {
return; return;
skipping to change at line 143 skipping to change at line 143
iptc_dataset_set_tag (ds, IPTC_RECORD_OBJECT_ENV, IPTC_TAG_CHARACTER_SET); iptc_dataset_set_tag (ds, IPTC_RECORD_OBJECT_ENV, IPTC_TAG_CHARACTER_SET);
iptc_dataset_set_data (ds, utf8Esc, 3, IPTC_DONT_VALIDATE); iptc_dataset_set_data (ds, utf8Esc, 3, IPTC_DONT_VALIDATE);
iptc_data_add_dataset (iptc, ds); iptc_data_add_dataset (iptc, ds);
iptc_dataset_unref (ds); iptc_dataset_unref (ds);
for (rtengine::procparams::IPTCPairs::const_iterator i = iptcc.begin(); i != iptcc.end(); ++i) { for (rtengine::procparams::IPTCPairs::const_iterator i = iptcc.begin(); i != iptcc.end(); ++i) {
if (i->first == "Keywords" && !(i->second.empty())) { if (i->first == "Keywords" && !(i->second.empty())) {
for (unsigned int j = 0; j < i->second.size(); j++) { for (unsigned int j = 0; j < i->second.size(); j++) {
IptcDataSet * ds = iptc_dataset_new (); IptcDataSet * ds = iptc_dataset_new ();
iptc_dataset_set_tag (ds, IPTC_RECORD_APP_2, IPTC_TAG_KEYWORDS); iptc_dataset_set_tag (ds, IPTC_RECORD_APP_2, IPTC_TAG_KEYWORDS);
iptc_dataset_set_data (ds, (unsigned char*)i->second.at(j).c_str (), min(static_cast<size_t>(64), i->second.at(j).bytes()), IPTC_DONT_VALIDATE); iptc_dataset_set_data (ds, (const unsigned char*)i->second.at(j) .c_str(), min(static_cast<size_t>(64), i->second.at(j).bytes()), IPTC_DONT_VALID ATE);
iptc_data_add_dataset (iptc, ds); iptc_data_add_dataset (iptc, ds);
iptc_dataset_unref (ds); iptc_dataset_unref (ds);
} }
continue; continue;
} else if (i->first == "SupplementalCategories" && !(i->second.empty())) { } else if (i->first == "SupplementalCategories" && !(i->second.empty())) {
for (unsigned int j = 0; j < i->second.size(); j++) { for (unsigned int j = 0; j < i->second.size(); j++) {
IptcDataSet * ds = iptc_dataset_new (); IptcDataSet * ds = iptc_dataset_new ();
iptc_dataset_set_tag (ds, IPTC_RECORD_APP_2, IPTC_TAG_SUPPL_CATE GORY); iptc_dataset_set_tag (ds, IPTC_RECORD_APP_2, IPTC_TAG_SUPPL_CATE GORY);
iptc_dataset_set_data (ds, (unsigned char*)i->second.at(j).c_str (), min(static_cast<size_t>(32), i->second.at(j).bytes()), IPTC_DONT_VALIDATE); iptc_dataset_set_data (ds, (const unsigned char*)i->second.at(j) .c_str(), min(static_cast<size_t>(32), i->second.at(j).bytes()), IPTC_DONT_VALID ATE);
iptc_data_add_dataset (iptc, ds); iptc_data_add_dataset (iptc, ds);
iptc_dataset_unref (ds); iptc_dataset_unref (ds);
} }
continue; continue;
} }
for (int j = 0; j < 16; j++) for (int j = 0; j < 16; j++)
if (i->first == strTags[j].field && !(i->second.empty())) { if (i->first == strTags[j].field && !(i->second.empty())) {
IptcDataSet * ds = iptc_dataset_new (); IptcDataSet * ds = iptc_dataset_new ();
iptc_dataset_set_tag (ds, IPTC_RECORD_APP_2, strTags[j].tag); iptc_dataset_set_tag (ds, IPTC_RECORD_APP_2, strTags[j].tag);
iptc_dataset_set_data (ds, (unsigned char*)i->second.at(0).c_str (), min(strTags[j].size, i->second.at(0).bytes()), IPTC_DONT_VALIDATE); iptc_dataset_set_data (ds, (const unsigned char*)i->second.at(0) .c_str(), min(strTags[j].size, i->second.at(0).bytes()), IPTC_DONT_VALIDATE);
iptc_data_add_dataset (iptc, ds); iptc_data_add_dataset (iptc, ds);
iptc_dataset_unref (ds); iptc_dataset_unref (ds);
} }
} }
iptc_data_sort (iptc); iptc_data_sort (iptc);
} }
void ImageIO::setOutputProfile (const char* pdata, int plen) void ImageIO::setOutputProfile (const char* pdata, int plen)
{ {
skipping to change at line 576 skipping to change at line 576
return IMIO_CANNOTREADFILE; return IMIO_CANNOTREADFILE;
} }
jpeg_decompress_struct cinfo; jpeg_decompress_struct cinfo;
jpeg_error_mgr jerr; jpeg_error_mgr jerr;
cinfo.err = my_jpeg_std_error(&jerr); cinfo.err = my_jpeg_std_error(&jerr);
jpeg_create_decompress(&cinfo); jpeg_create_decompress(&cinfo);
my_jpeg_stdio_src (&cinfo, file); my_jpeg_stdio_src (&cinfo, file);
#if defined( WIN32 ) && defined( __x86_64__ ) && !defined(__clang__)
if ( __builtin_setjmp((reinterpret_cast<rt_jpeg_error_mgr*>(cinfo.src))->err
or_jmp_buf) == 0 ) {
#else
if ( setjmp((reinterpret_cast<rt_jpeg_error_mgr*>(cinfo.src))->error_jmp_buf ) == 0 ) { if ( setjmp((reinterpret_cast<rt_jpeg_error_mgr*>(cinfo.src))->error_jmp_buf ) == 0 ) {
#endif
if (pl) { if (pl) {
pl->setProgressStr ("PROGRESSBAR_LOADJPEG"); pl->setProgressStr ("PROGRESSBAR_LOADJPEG");
pl->setProgress (0.0); pl->setProgress (0.0);
} }
setup_read_icc_profile (&cinfo); setup_read_icc_profile (&cinfo);
//jpeg_stdio_src(&cinfo,file); //jpeg_stdio_src(&cinfo,file);
jpeg_read_header(&cinfo, TRUE); jpeg_read_header(&cinfo, TRUE);
skipping to change at line 907 skipping to change at line 911
int ImageIO::loadPPMFromMemory(const char* buffer, int width, int height, bool s wap, int bps) int ImageIO::loadPPMFromMemory(const char* buffer, int width, int height, bool s wap, int bps)
{ {
allocate (width, height); allocate (width, height);
int line_length(width * 3 * (bps / 8)); int line_length(width * 3 * (bps / 8));
if ( swap && bps > 8 ) { if ( swap && bps > 8 ) {
char swapped[line_length]; char swapped[line_length];
for ( int row = 0; row < height; ++row ) { for ( int row = 0; row < height; ++row ) {
::rtengine::swab(((char*)buffer) + (row * line_length), swapped, lin e_length); ::rtengine::swab(((const char*)buffer) + (row * line_length), swappe d, line_length);
setScanline(row, (unsigned char*)&swapped[0], bps); setScanline(row, (unsigned char*)&swapped[0], bps);
} }
} else { } else {
for ( int row = 0; row < height; ++row ) { for ( int row = 0; row < height; ++row ) {
setScanline(row, ((unsigned char*)buffer) + (row * line_length), bps ); setScanline(row, ((const unsigned char*)buffer) + (row * line_length ), bps);
} }
} }
return IMIO_SUCCESS; return IMIO_SUCCESS;
} }
namespace { namespace {
// Taken from Darktable -- src/imageio/format/png.c // Taken from Darktable -- src/imageio/format/png.c
// //
 End of changes. 10 change blocks. 
8 lines changed or deleted 13 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)