diff -Nru libraw-0.16.2/bootstrap.linux libraw-0.17.0/bootstrap.linux --- libraw-0.16.2/bootstrap.linux 2015-05-16 12:32:15.000000000 +0000 +++ libraw-0.17.0/bootstrap.linux 1970-01-01 00:00:00.000000000 +0000 @@ -1,29 +0,0 @@ -#!/bin/sh - -# Copyright (c) 2013, Gilles Caulier, -# -# Redistribution and use is allowed according to the terms of the BSD license. -# For details see the accompanying COPYING-CMAKE-SCRIPTS file. - -# adjust setup here if necessary -export INSTALL_PREFIX='/usr' -export BUILD_TYPE='debugfull' - -if [ ! -d "build" ]; then - mkdir build -fi - -cd build - -cmake -G "Unix Makefiles" . \ - -DCMAKE_BUILD_TYPE="$BUILD_TYPE" \ - -DCMAKE_INSTALL_PREFIX="$INSTALL_PREFIX" \ - -Wno-dev \ - -DENABLE_OPENMP=ON \ - -DENABLE_LCMS=ON \ - -DENABLE_EXAMPLES=ON \ - -DENABLE_RAWSPEED=OFF \ - -DENABLE_DEMOSAIC_PACK_GPL2=OFF \ - -DENABLE_DEMOSAIC_PACK_GPL3=OFF \ - -DENABLE_DCRAW_DEBUG=ON \ - .. diff -Nru libraw-0.16.2/bootstrap.macports libraw-0.17.0/bootstrap.macports --- libraw-0.16.2/bootstrap.macports 2015-05-16 12:32:15.000000000 +0000 +++ libraw-0.17.0/bootstrap.macports 1970-01-01 00:00:00.000000000 +0000 @@ -1,46 +0,0 @@ -#!/bin/sh - -# Copyright (c) 2013, Gilles Caulier, -# -# Redistribution and use is allowed according to the terms of the BSD license. -# For details see the accompanying COPYING-CMAKE-SCRIPTS file. - -# adjust setup here if necessary -# NOTE: TARGET_TYPE ='x86_64' for OSX Lion (default), 'i386' for Snow Leopard. -export TARGET_TYPE='x86_64' -export INSTALL_PREFIX='/usr' -export BUILD_TYPE='debugfull' - -if [ ! -d "build" ]; then - mkdir build -fi - -cd build - -cmake -G "Unix Makefiles" . \ - -DCMAKE_BUILD_TYPE=${BUILD_TYPE} \ - -DCMAKE_INSTALL_PREFIX=${INSTALL_PREFIX} \ - -DCMAKE_OSX_ARCHITECTURES=${TARGET_TYPE} \ - -DCMAKE_COLOR_MAKEFILE=ON \ - -DCMAKE_BUILD_WITH_INSTALL_RPATH=ON \ - -DCMAKE_INSTALL_NAME_DIR=/opt/local/lib \ - -DCMAKE_SYSTEM_PREFIX_PATH="/opt/local;/usr" \ - -DCMAKE_MODULE_PATH="/opt/local/share/cmake-2.8/Modules;/opt/local/share/cmake/modules" \ - -Wno-dev \ - -DENABLE_OPENMP=ON \ - -DENABLE_LCMS=ON \ - -DENABLE_EXAMPLES=ON \ - -DENABLE_RAWSPEED=ON \ - -DRAWSPEED_RPATH=../RawSpeed.libraw \ - -DCHECKOUT_RAWSPEED=ON \ - -DRAWSPEED_REVISION=HEAD \ - -DENABLE_DEMOSAIC_PACK_GPL2=ON \ - -DDEMOSAIC_PACK_GPL2_RPATH=../LibRaw-demosaic-pack-GPL2/ \ - -DCHECKOUT_DEMOSAIC_PACK_GPL2=ON \ - -DDEMOSAIC_PACK_GPL2_REVISION=HEAD \ - -DENABLE_DEMOSAIC_PACK_GPL3=ON \ - -DDEMOSAIC_PACK_GPL3_RPATH=../LibRaw-demosaic-pack-GPL3/ \ - -DCHECKOUT_DEMOSAIC_PACK_GPL3=ON \ - -DDEMOSAIC_PACK_GPL3_REVISION=HEAD \ - -DENABLE_DCRAW_DEBUG=ON \ - .. diff -Nru libraw-0.16.2/bootstrap.msvc.bat libraw-0.17.0/bootstrap.msvc.bat --- libraw-0.16.2/bootstrap.msvc.bat 2015-05-16 12:32:15.000000000 +0000 +++ libraw-0.17.0/bootstrap.msvc.bat 1970-01-01 00:00:00.000000000 +0000 @@ -1,37 +0,0 @@ -@ECHO OFF - -REM Copyright (c) 2013, Gilles Caulier, -REM -REM Redistribution and use is allowed according to the terms of the BSD license. -REM For details see the accompanying COPYING-CMAKE-SCRIPTS file. - -REM adjust setup here if necessary -SET INSTALL_PREFIX=C:\ -SET BUILD_TYPE=debugfull - -IF NOT EXIST "build" md "build" - -cd "build" - -REM Microsoft Visual C++ command line compiler. -cmake -G "NMake Makefiles" . ^ - -DCMAKE_BUILD_TYPE=%BUILD_TYPE% ^ - -DCMAKE_INSTALL_PREFIX=%INSTALL_PREFIX% ^ - -Wno-dev ^ - -DENABLE_OPENMP=ON ^ - -DENABLE_LCMS=ON ^ - -DENABLE_EXAMPLES=ON ^ - -DENABLE_RAWSPEED=ON ^ - -DRAWSPEED_RPATH=../RawSpeed.libraw ^ - -DCHECKOUT_RAWSPEED=ON ^ - -DRAWSPEED_REVISION=HEAD ^ - -DENABLE_DEMOSAIC_PACK_GPL2=ON ^ - -DDEMOSAIC_PACK_GPL2_RPATH=../LibRaw-demosaic-pack-GPL2/ ^ - -DCHECKOUT_DEMOSAIC_PACK_GPL2=ON ^ - -DDEMOSAIC_PACK_GPL2_REVISION=HEAD ^ - -DENABLE_DEMOSAIC_PACK_GPL3=ON ^ - -DDEMOSAIC_PACK_GPL3_RPATH=../LibRaw-demosaic-pack-GPL3/ ^ - -DCHECKOUT_DEMOSAIC_PACK_GPL3=ON ^ - -DDEMOSAIC_PACK_GPL3_REVISION=HEAD ^ - -DENABLE_DCRAW_DEBUG=ON ^ - .. diff -Nru libraw-0.16.2/buildfiles/libraw-common-lib.pro libraw-0.17.0/buildfiles/libraw-common-lib.pro --- libraw-0.16.2/buildfiles/libraw-common-lib.pro 2015-05-16 12:32:15.000000000 +0000 +++ libraw-0.17.0/buildfiles/libraw-common-lib.pro 2015-08-15 13:10:27.000000000 +0000 @@ -14,7 +14,7 @@ win32:OUTD=release-$$SUFF macx:OUTD=release } -INCLUDEPATH=../../LibRaw +INCLUDEPATH+=../../LibRaw OBJECTS_DIR = $$OUTD/ MOC_DIR = $$OUTD/ RCC_DIR = $$OUTD/ diff -Nru libraw-0.16.2/buildfiles/libraw.pro libraw-0.17.0/buildfiles/libraw.pro --- libraw-0.16.2/buildfiles/libraw.pro 2015-05-16 12:32:15.000000000 +0000 +++ libraw-0.17.0/buildfiles/libraw.pro 2015-08-15 13:10:27.000000000 +0000 @@ -9,7 +9,7 @@ DEFINES+=USE_RAWSPEED INCLUDEPATH+=../../RawSpeed/ win32:INCLUDEPATH+=d:/Qt/local/include d:/Qt/local/include/libxml2 -win32:LIBS+=-lrawspeed -Ld:/Qt/local/lib/$$SUFF -llibxml2 -ljpeg -lpthreadVC2 +win32:LIBS+=-lrawspeed -Ld:/Qt/local/lib/$$SUFF -llibxml2 -ljpeg HEADERS=../libraw/libraw.h \ diff -Nru libraw-0.16.2/Changelog.rus libraw-0.17.0/Changelog.rus --- libraw-0.16.2/Changelog.rus 2015-05-16 12:32:15.000000000 +0000 +++ libraw-0.17.0/Changelog.rus 1970-01-01 00:00:00.000000000 +0000 @@ -1,1667 +0,0 @@ -2015-05-11 Alex Tutubalin - * Исправлена уязвимость в dcraw:ljpeg_start() - * LibRaw 0.16.1 - -2014-01-17 Alex Tutubalin - * Поддержка камер - Добавлены: Fujifilm X-E2,XQ1 - Обновлены цветовые данные: Nikon D4, 1 AW1/J3; Fuji X-M2 - Исправления: видимая область у Nikon D610, паттерн - светофильтров у Canon A330 - * Улучшен разбор High-ISO у камер Nikon - * Работа с RawSpeed: разрешен процессинг этой библиотекой - для камер, неизвестных RawSpeed (касается в первую очередь - DNG-формата) - * Исправлена ошибка в разборе thumbnail - * Увеличена скорость работы вызова my_strcasestr - * Исправлены ошибки компиляции при сборке VS2012 с включенным - OpenMP - * Исправлена опечатка, не дававшая использовать Demosaic Pack GPL2 - * LibRaw 0.16.0 - -2013-11-12 Alex Tutubalin - * Поддержка новых камер - Leica C, X VARIO - Nikon D5300, D610, Df, 1 AW1 - Nokia Lumia 1020, 1520 - Olympus STYLUS1 - Pentax K-3 - Sony RX10, A3000 (ILCE-3000), - * Обновлены цветовые данные для камер: - Canon S120 - Nikon P7800 - Olympus E-M1 - * Исправлены/добавлены корректные размеры видимой области - изображений для камер: - Canon G16 - Sigma pre-Merrill: размеры для "маленьких" и "промежуточных" - RAW - - * Улучшен разбор EXIF: - - Значения ISO для тех камер Nikon, которые пишут ISO - в нестандартный тег (D4, D800) - - Уровень черного для Nikon D5300 - - Правильное извлечение цветовых данных для камер Olympus - - * Лучшая совместимость с Visual Studio (особенно со старыми версиями) - * Cmake: для MinGW-сборки добавлена библиотека ws2_32 - * LibRaw 0.16.0-Beta1 - -2013-10-22 Alex Tutubalin - * Поддержка новых камер - Sony A7, A7R - Panasonic GM1 - * Имя модели для камер Sony устанавливается по EXIF-тегу SonyModelID - * Sony ARW2: цветовая матрица и уровень черного извлекаются из - EXIF-данных. - * Samsung: цветовая матрица и уровень черного извлекаются из - EXIF-данных. Множители баланса белого извлекаются корректно даже - для ненулевого уровня черного. - * Лучшая совместимость по исходным текстам с Win32 (особенно старые - компиляторы) и Mac OS X. - * Обновлены цветовые данные для камер Sony RX1R и RX100M2 - * Файлы DNG без тега Compression считаются несжатыми (и обрабатываются) - - * Улучшена поддержка Foveon (на основе X3F-tools) - - Новый парсер метаданных на основе X3F-tools. - Если Libraw скомпилирована без demosaic-pack-GPL2, то будет использован - этот парсер (и, затем, распаковка на базе X3F-tools). - Если Libraw скомпилирована с demosaic-pack-GPL2, то способ - распаковки файлов Foveon может быть выбран на runtime (см. ниже) - - Поддержка RAW-файлов промежуточного разрешения от камер DPx Merrill - и SD1. - RAW-данные извлекаются в "натуральном" их размере (~4800x1600 пикселов) - и устанавливается aspect ratio 0.5. При RGB-рендеринге - размер выходного изображения будет ~4800x3200 - - Поддержка превью-файлов для Foveon. Извлекаются только превью в - форматах JPEG и битмеп (RAW-превью - не извлекаются), этого достаточно - для всех существующих production-камер. - - Новый параметр обработки imgdata.params.force_foveon_x3f - Если LibRaw собрана с demosaic-pack-GPL2, то установка данного - параметра в не 0 приведет к использованию нового кода обработки - Foveon (на базе X3F-tools). - Если LibRaw собрана без demosaic-pack-GPL2, то данный параметр - никак не влияет на обработку. - Новый флаг командной строки -disadcf примера dcraw_emu ставит - вышеуказанный параметр обработки. - - Исправлена ошибка: exit() более не вызывается при обработке - поврежденных файлов Foveon - * API/ABI изменены, требуется перекомпиляция всех приложений - * LibRaw 0.16.0-Alpha3 - -2013-10-15 Alex Tutubalin - * Поддержка новых камер - Canon Powershot S120 (предварительные цветовые данные) и G16 - Fujifilm X-A1 (предварительные цветовые данные) - Hasselblad Lunar, Stellar - Nikon Coolpix P7800 (предварительные цветовые данные) - Pentax K50, K500, Q7 - Samsung Galaxy NX (EK-GN120) - Sony NEX-5T - * Обновлены цветовые данные для камер: - Samsung NX300 - Sony RX1R - Sigma SD1, Sigma SD1/DPx Merrill - приближенные цветовые данные для Sigma DPxx (pre-Merrill) - - * Таблица размеров для камер на Foveon: размеры черной рамки - ставятся корректно. - - * Исправлен memory leak в библиотеке x3f - * Исправлена несовместимость OpenMP-директив в DHT-демозаике - с компилятором Visual Studio. - * Дополнительная проверка размеров изображения для раннего - отторжения битых файлов. - * LibRaw 0.16.0-Alpha1 - -2013-09-22 Alex Tutubalin - * Поддержка новых камер - Baumer TXG14 - Blackmagic Cinema - Canon EOS 70D, C500 - Fujifilm X-M1 - Nikon D5200 - Olympus E-P5,E-M1 - OmniVision OV5647 (Raspberry Pi) - Panasonic LF1, GX7, GF6 - Richon GR - Samsung NX300, NX1100, NX2000 - Sony RX100II, RX1R, NEX-3N - - * Новый код для поддержки Foveon, основанный на библиотеке x3f - (by Roland Karlsson) - BSD-лицензия, поэтому включен в основное дерево исходных текстов LibRaw - Отсутствует интерполяция цвета (необходимая для старых камер), поэтому - получить приемлемый цвет для старых камер (Sigma SD9 и SD14, Polaroid x530) - скорее всего не получится. Для современных Foveon-камер можно пытаться - обойтись ICC-профилем (пока его нет). - - TODO: извлечение thumbnails, быстрое завершение декодера, переход на - LibRaw_memmgr для аллокаций. - - При сборке с LIBRAW_DEMOSAIC_PACK_GPL2 будет работать старый - Foveon-код (из dcraw) - - * Изменения в API: - - + Новые параметры процессинга (в imgdata.params) - - imgdata.params.no_interpolation - выключает этап интерполяции - (дебайера) в вызове LibRaw::dcraw_process(). - - imgdata.params.no_auto_scale - выключает этап масштабирования данных - (scale_colors() в вызове LibRaw::dcraw_process() - - imgdata.params.sraw_ycc - запрещает преобразование YCbCr-данных - файлов Canon sRAW/mRAW в RGB-формат при распаковке (LibRaw::unpack()) - - + Новый код обработки Fuji X-Trans привносит следующие изменения: - - Для файлов X-Trans значение поля imgdata.iparams.filters теперь - равно 9 (было 2). - - В массиве imgdata.iparams.xtrans[6][6] содержится цвет пикселя в - блоке 6x6. - - + Новый вызов: LibRaw::setCancelFlag() - быстрая остановка декодера - (LibRaw::unpack() если он работает. Для использования в многопоточных - программах. - - + В интерфейсе абстрактного класса LibRaw_abstract_datastream - заведующего чтением данных удален вызов make_byte_buffer(), - он более не нужен. - - + Новый метод демозаики: DHT Demosaic by Anton Petrusevich - Использование: imgdata.params.user_qual=11 - - + Новый метод демозаики: Modified AHD Demosaic by Anton Petrusevich - Использование: imgdata.params.user_qual=12 - - + Новый вызов C-API: libraw_COLOR(libraw_data_t *t, int row,int col) - (это LibRaw::COLOR(row,col) для пользователей C-API) - - * Удален (более) быстрый декодер LJPEG, идея которого была позаимствованна - в свое время в библиотеке RawSpeed. Для быстрого декодирования - используйте интеграцию RawSpeed и LibRaw - - * Исправлена ошибка декодирования некоторых файлов Canon sRAW. - - * Выключена обработка bad pixels встроенная в RawSpeed, при необходимости - используется обработка, встроенная в LibRaw. - - * Имена камер Canon выдаются по таблице unique ID (т.е. 700D всегда будет - 700D, даже если в EXIF написано Rebel T5i) - - * Импортированы дополнительные проверки данных из LibRaw 0.15.4 - - * Поддержка сборки CMake - - * Обновлен встроенный cameras.xml (RawSpeed) - - * Много изменений в структурах данных, все приложения, использующие LibRaw, - должны быть перекомпилированы. - - * LibRaw 0.16.0-Alpha1 - -2013-05-23 Alex Tutubalin - - LibRaw 0.15.0 Release: - - * Поддержка новых камер: - Adobe DNG: поддержка Fast Load DNG (LightRoom 4.x), поддержка - lossy-compressed DNG (LR 4.x, необходима сборка с libjpeg 6+) - Canon: G1 X, SX220 HS, EOS 5D Mark III, EOS 650D, EOS 1D-X, - 100D (Rebel SL1), 700D (Rebel T5i),6D,EOS M,G15, S110, SX50 - Casio: EX-ZR100,EX-Z8 - Fujifilm: X-S1, HS30EXR, X1-Pro,X-E1,X20, X100S,SL1000, HS50EXR, - F800EXR, XF1 - Leica: D-LUX6 и V-LUX4 - Nikon: D4, D3200, D800, D800E,1 J2, 1 V2, D600,1 J3, 1 S1, Coolpix A, - Coolpix P330, Coolpix P7700, D7100 - Olympus: E-M5, XZ-2, XZ-10, E-PL5, E-PM2 - Panasonic: G5, G6, DMC-GF5, FZ200, GH3, LX7 - Pentax: MX-1, K-5 II, K-5 IIs, K-30, Q10 - Samsung: EX2F, NX20, NX210, поддержка нового firmware NX100 - Sigma: SD15,SD1, SD1 Merill, DP1, DP1S, DP1X, DP2, DP2S, DP2X (только - в Demosaic-pack-GPL2) - Sony: SLT-A58, RX-1, SLT-A99, NEX-5R, NEX-6, NEX-F3, SLT-A37, SLT-A57 - Multishot-файлы Imacon Ixpress 39Mpix - - * Изменения в API - 1. dcraw_process() можно вызывать несколько раз без переоткрытия файла - (с разными параметрами). - - 2. Удалены т.к. никто не использует - * вызов LibRaw::dcraw_document_mode_processing (и соответствующий - вызов C-API) - * Поле данных imgdata.color.color_flags - - 3. LibRaw::unpack() раскодирует данные в отдельный буфер, в зависимости - от типа данных: - imgdata.rawdata.raw_image - 1 цветовой компонент на пиксель - (байеровские и ч-б камеры) - imgdata.rawdata.color3_image - 3 компонента на пиксель (sRAW/mRAW - при использовании RawSpeed) - imgdata.rawdata.color4_image - 4 компонента на пиксель (4-й может не - использоваться) - 4. Поддержка сборки с библиотекой RawSpeed (http://rawstudio.org/blog/?p=800) - Детали в README.RawSpeed. - - 5. Подавление бэндинга (полосатости) - - 6. Новые вызовы API - recycle_datastream(), - open_file(wchar_t*) (Win32) - -2012-04-04 Alex Tutubalin - * Поддержка камеры Casio EX-Z500 - * Обработка исключений ввода-вывода при открытии файла - * Исправлен (несуществующий) buffer overrun (readonly) в - раскодировании формата ARW2, на который ругался valgrind - * Исправления для компиляции LibRaw_windows_datastream mingw32 - * Дополнительные (закомментированные) ключи компиляции в - Makefile.msvc для сборки с LCMS и OpenMP - * Исправлена ошибка распаковки для некоторых файлов с - Leaf Aptus II - * LibRaw 0.14.6-Release - -2011-03-09 Alex Tutubalin - * WIN32: Поддержан вызов LibRaw::open_file(wchar_t* filename) - * импортирована обработка исключений из ветки 0.14 - * imgdata.params.user_cblack[4] позволяет задать поканальный - уровень черного - -2011-12-24 Alex Tutubalin - * Исправлена ошибка (неинициализированная переменная) в - декодере формата SMAL. - - * Импортирована новая версия dcraw (9.12/1.446): поддержка для - Leica V-LUX 3, обновлены цветовые данные для камер Canon S100, - Fujifilm X10, Nikon 1 J1/V1, Panasonic GX1, Samsung NX200, - Sony NEX-7 - - * LibRaw 0.14.5-Release -2011-12-12 Alex Tutubalin - * Обработчик файлов с камер Panasonic/Leica file больше не падает - на поврежденных JPEG-файлах - - * Изменен порядок следования #include в src/libraw_datastream.cpp, - что должно облегчить сборку под KDEWIN - - * DNG-файлы в плавучей точке отвергаются на ранних стадиях обработки - - * Поддержка новых камер: Canon S100, Fuji X10, Panasonic GX1, - Samsung NX200, Sony NEX-7. - - * LibRaw 0.14.4-Release - -2011-10-26 Alex Tutubalin - * Исправления в коде вычитания уровня черного в файлах PhaseOne - - * Новый вызов LibRaw::get_internal_data_pointer() для нужд тех - разработчиков, кому нужен доступ в самые потроха (например, - описание layout для камер Fuji SuperCCD) - - * Исправления в документации (doc/API-overview), отражающие - изменения версии 0.14. - - * LibRaw 0.14.3-Release - -2011-10-19 Alex Tutubalin - * Исправлена ошибка в раскодировании файлов Canon 1D/1Ds - * Новый флаг LIBRAW_DECODER_HASRAWCURVE в libraw_decoder_info.flags - * LibRaw 0.14.2-Release - -2011-10-11 Alex Tutubalin - * Импортирована dcraw 9.11/1.445: - - + Поддержка новых камер: Fujifilm F600EXR, Nikon P7100, - Olympus E-PL3 и E-PM1, Panasonic DMC-FZ150, Sony NEX-5N, - A65 и A77. - - + Изменены цветовые данные камер: Olympus E-P3, Panasonic G3 и GF3, - PhaseOne H25, P40 и P65, Sony NEX-C3, NEX-5, NEX-3, A35 и A55. - - + Извлечение темной рамки на камерах Sony (там где она есть) - - * DCB-интерполяция: размер выходного изображения уменьшен на 3 пикселя, - чтобы дать интерполятору больше места (и подавить цветные артефакты) - - * LibRaw 0.14.1-Release - -2011-09-21 Alex Tutubalin - * Косметические изменения для OpenMP-сборки Visual C++ - * Исправлен расчет мегапикселей изображения в примере - postprocessing_benchmark - * Увеличен номер версии разделяемой библиотеки (Unix) - * LibRaw 0.14.0-Release - -2011-09-04 Alex Tutubalin - * Исправлена ошибка в распаковке thumbnail для камер Kodak - * Функция raw2image_ex() всегда возвращает значение - * LibRaw 0.14.0-Beta2 - -2011-09-02 Alex Tutubalin - * Минимальные косметические изменения в описании интерфейса - LibRaw_file_datastream interface - - * OpenMP-ускорение постпроцессинга (до 50% для режима half_size - на 4-ядерном CPU) - - * LibRaw 0.14.0-Beta1 - -2011-08-20 Alex Tutubalin - - * Пример dcraw_emu: косметические исправления для совместимости - с компилятором SunStudio - - * Исправлена ошибка в примере unprocessed_raw, приводившая к падениям - под Win32 при генерации TIFF - - * Исправлена ошибка в аллокации памяти в случае, когда размер - RAW-изображения меньше, чем размер результирующего изображения. - - * Параметр imgdata.sizes.flip устанавливается в пользовательское - значение params.user_flip только на стадии препроцессинга. - - * Исправлено переполнение буфера возникавшее на некотрых файлах с - LJPEG-сжатием - - * Большинство исходных текстов методов LibRaw*datastream перемещено в - отдельный файл с исходными текстами, дабы не захламлять - libraw_datastream.h - - * Класс LibRaw_windows_datastream (работа под Win32 с memory-mapped - файлами) включен в "основную" библиотеку. - - * LibRaw 0.14.0-Alpha5 - -2011-08-10 Alex Tutubalin - * Импортирована dcraw 9.10 (1.444), добавлена поддержка для камер: - ARRIRAW, Canon SX30 IS, Leica D-LUX 5 и V-LUX2, - Olympus E-P3, Panasonic G3 и GF3, Sony NEX-C3 и SLT-A35 - - * Исправлена ошибка: green_matching несовместим (и не имеет смысла) - с вейвлет-фильтрацией, коррекцией аберраций и прочими случаями - уменьшения выходного изображения вдвое. - - * Поддержка цифровых кинокамер RedOne (формат R3D). - Для использования этой поддержки вам надо: - + Установить библиотеку libjasper для раскодирования JPEG2000 - - + компилировать LibRaw с ключом компилятора -DUSE_JASPER - (./configure сделает это сама) - - + Если вы используюете свой LibRaw_datastream, вы должны имплементировать - там вызов make_jas_stream(), который вернет указатель на "поток" - libjasper. - Примеры реализаций этого вызова для потоков LibRaw можно найти - в хвосте файла src/libraw_cxx.cpp - - * Исправлена работа при последовательности вызовов - open_file() + adjust_sizes_info_only() - - * Удалены поля данных imgdata.sizes.bottom_margin и right_margin. - Если размеры этих полей интересны, используйте для их вычисления - raw_width - width - left_margin (и аналогично для нижнего поля). - - * Косметические изменения в ./configure - - * Обновлены файлы для Qmake и проектные файлы Visual Studio. - - * Новые макросы проверки версий: - LIBRAW_RUNTIME_CHECK_VERSION_EXACT() - рантайм проверка, - что версия библиотеки (DLL, .SO) в точности та же, что была - на компиляции приложения. - LIBRAW_RUNTIME_CHECK_VERSION_NOTLESS() - рантайм проверка, - что версия не меньше той, что была на компиляции. - - LIBRAW_COMPILE_CHECK_VERSION_EXACT(major,minor) - Проверка на - компиляции, что версия в точности major.minor - - LIBRAW_COMPILE_CHECK_VERSION_NOTLESS(major,minor) - Проверка на - шаге компиляции, что версия не меньше чем major.minor - - * Структуры данных изменены, требуется перекомпиляция всех приложений. - - * LibRaw 0.14.0-Alpha4 - -2011-07-19 Alex Tutubalin - * Новый пример samples/postprocessing_benchmark.cpp - Позволяет оценить скорость этапа постпроцессинга. - Поддерживает разные варианты интерполяции, кроппинг, - averaged white balance, медианный фильтр, - wavelet-фильтрацию и highlight recovery. - * Удален вызов LibRaw::rotate_fuji_raw() и соответствующий - ему вызов С API. - * LibRaw::adjust_sizes_info_only() может вызываться произвольное - количество раз, втч. и вместе с dcraw_process() - * Оптимизация постпроцессинга, особенно для обрезанных (cropped) - изображений. - * Кроппинг работает и для сенсоров FujiCCD. По ряду причин, - позиция верхнего левого угла области кроппинга округляется до - ближайшего меньшего целого числа кратного 4. - - * LibRaw 0.14.0-Alpha3 - - -2011-07-15 Alex Tutubalin - * Импортирован код кроппинга из 0.13.7 - -2011-07-11 Alex Tutubalin - * Новый вызов LibRaw::free_image() - Освобождает память, выделенную для imgdata.image. Может быть - использован в случае, если обработанный битмэп более не нужен - вызывающему приложению, однако время для уничтожения или - recycle() объекта LibRaw еще не наступило, например может - повторно быть вызвана функция постобработки dcraw_process() - - * Новые вызовы добавлены в C-API: - libraw_raw2image() - аналог LibRaw::raw2image() - libraw_free_image() - аналог LibRaw::free_image() - libraw_get_decoder_info() - аналог LibRaw::get_decoder_info() - - * Bugfix: изменение params.user_flip после open()/unpack() - обрабатывается правильно. - - * LibRaw 0.14.0-Alpha2 - -2011-07-10 Alex Tutubalin - * Разрешены повторные вызовы постобработки (LibRaw::dcraw_process) - без переоткрытия файла парой вызовов open()/unpack(). - При этом, постобработку можно повторять меняя любые параметры - обработки (за исключением выбора кадра через shot_select). - - + Новый пример samples/multirender_test.cpp показывает - как использовать новые возможности. - - + Необработанные RAW-данные сохраняются в отдельном буфере - (2 байта на пиксель для Байеровских изображений, 8 байт на - пиксель для Foveon, sRAW и других полноцветных RAW). - Как следствие, для байеровских изображений LibRaw требует - на 25% больше памяти чем ранее. - - + Новый вызов LibRaw::raw2image() преобразует RAW-данные - в старый формат imgdata.image - Если вы используете LibRaw::dcraw_process или - LibRaw::document_mode_processing(), вызывать raw2image() не - нужно (и даже вредно), все будет сделано внутри функции - постпроцессинга. - - + Новый вызов LibRaw::get_decoder_info() позволяет определить - формат хранения RAW-данных (если вам нужен к ним доступ). - См. samples/unprocessed_raw.cpp как пример использования. - - Если ваша программа использует обычный порядок вызовов - open()/unpack()/dcraw_process(), то можно в ней ничего не менять - и все будет работать как раньше. Однако для интерактивных программ, - где параметры обработки меняются пользователем, можно пропустить - вызовы open()/unpack() при повторной отрисовке и показать - пользователю результат гораздо быстрее. - - Если ваш код использует RAW-данные (open()+unpack(), а обработка - своя), то вам нужно или переключиться на новый формат данных, или - использовать вызов LibRaw::raw2image() для конверсии из нового - формата в старый. - - Если ваш код использовал доступ к маскированной ("черной") рамке, - то вам нужно использовать новый RAW-буфер. См. - samples/unprocessed_raw.cpp в качестве примера. - - К сожалению, документация в этой версии не отражает изменений. - Это будет исправлено в следующей Альфа-версии. - - Прочие изменения: - - * Отдельных буферов под черную (маскированную) рамку более не - существует. Байеровские данные хранятся в буфере вместе с рамкой, - а для остальных (полноцветных) форматов данных рамка несущественна. - Как следствие, нет больше и отвратительного вызова - LibRaw::add_masked_border_to_bitmap() - - * Параметра, управлявшего фильтрацией RAW-данных (params.filtering_mode) - тоже больше нет с нами. Тоновая кривая RAW применяется всегда (для - тех форматов, где она есть) на стадии распаковки, нулевые пикселы - затираются усредненными соседними данными на стадии постпроцессинга - (тоже, только для тех форматов, где есть проблема нулевых пикселов). - - * Примеры unprocessed_raw и 4colors используют новые форматы хранения - RAW и новый вызов raw2image. - - * Структуры данных изменены, требуется перекомпиляция всех приложений. - - * LibRaw 0.14.0-Alpha1 - -2011-07-03 Alex Tutubalin - * Косметические исправления в коде Libraw_memmgr - - * Поддержка OpenMP разрешена для MS VS2008 - - * Расширенный интерфейс копирования процессированных изображений - в буфер памяти: - + Новый вызов get_mem_image_format() возвращает размеры - результирующего битмепа. - + Новый вызов copy_mem_image() копирует изображение в - переданный буфер в заданном порядке цветов пиксела (RGB/BGR) - и с заданным шагом (stride) строк. - + dcraw_make_mem_image() использует вышеуказанные вызовы. - + Подробности описаны в документации. - - * libraw/librawwindows.h - реализация LibRaw_datastream поверх - Windows memory mapped files. Win32/64. - Спасибо Linc Brookes. - - * Исправлены ошибки зависимостей в configure/Makefile.am - - * LibRaw 0.13.6-Release - -2011-05-18 Alex Tutubalin - * Imported new dcraw 9.08/1.443: - + Новые цветовые данные для камер Canon 600D и 1100D, Fuji S200EXR - + Поддержка новых камер: Fuji HS20EXR и F550EXR, Kodak Z990, - Nikon D5100, Olympus E-PL1s и XZ-1, - Samsung NX11, Sony A230 и 290. - * LibRaw 0.13.5-Release - -2011-04-02 Alex Tutubalin - * Импортирована dcraw 9.07/1.442: - + Поддержка новых камер: Canon 600D и 1100D, Hasselblad H4D-60, - Olympus E-PL2 - * Цветовые данные для Leaf Aptus II и Canon Powershot S2 IS - * LibRaw 0.13.4-Release - -2011-03-30 Alex Tutubalin - * Предварительная поддержка для камер Leaf Aptus II (без цветовых - данных). Протестировано на файлах Leaf Aptus II 6,7,8,10 и 12, - должно работать с Aptus II 5. - * Предварительная поддержка для Fujifilm X100 (тоже без цветовых - матриц). - * Исправлено возможное заглядывание за конец буфера при обработке - RAW-данных из файла. - * Исправлена возможная потеря маркера синхронизации в LJPEG-потоке - (проявлялась только на данных с камер Leaf Aptus II) - * LibRaw 0.13.3-Release - -2011-03-08 Alex Tutubalin - * Исправлена ошибка чтения камерного баланса белого для некоторых - камер Sony - * LibRaw 0.13.2-Release - -2011-02-25 Alex Tutubalin - * Поддержка камеры Sony A390 (цветовые данные от A380) - * Leica D-LUX 4: исправлена опечатка в названии камеры в - таблице цветовых данных - -2011-02-15 Alex Tutubalin - * Пример dcraw_emu: добавлен параметр командной строки -mem - для тестирования чтения из буфера - * Удалена отладочная печать из LibRaw_memory_buffer - * Предварительная поддержка shared library через ./configure - -2011-02-12 Alex Tutubalin - * Добавлены файлы проектов для qmake и Visual Studio 2008 -2011-02-07 Alex Tutubalin - * Обновлена документация dcraw_emu - * Обновлены файлы ./configure для более корректной линковки на - некоторых системах - * Алгоритм подавления FBDD выключен для полноцветных (не байеровских) - и 4-цветных байеровских файлов из-за несовместимости (включая - псевдо-4-цветный байер, включенный опцией four_color_rgb) - * LibRaw 0.13.1-Release - -2011-02-05 Alex Tutubalin - * Исправления в ./configure: установка правильных зависимостей - в pkg-config - * Makefile.msvc: правильные флаги компиляции для сборки с demosaic packs - * Импортирована dcraw.c 9.06/1.440: - + Поддержка камер: Canon S95, Casio EX-Z1080, Panasonic GF2 - и GH2, Samsung NX100, Sony A-580 - + Новые цветовые данные для камер: Canon G12, Nikon D3100, - D7000 и P7000, Olympus E-5, Pentax K-r и K-5, - Samsung NX10 и WB2000 - * green_matching() выключается при half-size интерполяции - (потому что для такой интерполяции от green_matching только вред). - * LibRaw 0.13.0-Release - -2011-01-15 Alex Tutubalin - * Для файлов Sony у которых неизвестна длина данных (Sony A100, возможно - и другие тоже) используется старый метод распаковки. - * Исправлена неполная переинциализация данных в LibRaw::recycle() - * LibRaw 0.13.0-Beta3 - -2011-01-13 Alex Tutubalin - * Улучшен разбор неправильных параметров командной строки в - примере dcraw_emu - * Таблица яркостей в ahd_demosaic рассчитывается в обратном порядке, - чтобы избежать возможной (но маловероятной) неправильной работы - в многопоточных приложениях. - * Новый код коррекции экспозиции, основанный на комбинации линейной - функции и кубического корня. Рабочий диапазон коррекции теперь - от 0.25 (-2 стопа) до 8 (+3 стопа). - * LibRaw 0.13.0-Beta2 - -2011-01-10 Alex Tutubalin - * Fixed file extension in half_mt.c sample - -2011-01-10 Alex Tutubalin - * Три патча от Jacques Desmis: - - Экспокоррекция перед байеровской интерполяцией - (demosaic pack GPL3) - - Ускорение медианных фильтров за счет OpenMP - (demosaic pack GPL2) - - Ускорение кода выравнивания зеленого за счет OpenMP - (demosaic pack GPL3) - * Импортированы правки версий 0.12.2-0.12.3: - - Исправление для configure-скриптов для лучшей поддержки LCMS2 - - math.h включается перед всеми другими #include, чтобы избежать - конфликта при сборке KDE под Win32 компилятором Visual C++ - - Изображения с камеры Fuji FinePix S5500 обрезаются на 8 - пикселов с каждой стороны, дабы избежать (редкого?) мусора по краям - * Структуры данных изменены, требуется перекомпиляция всех приложений. - * LibRaw 0.13.0-Beta1 - -2010-12-22 Alex Tutubalin - * Для LibRaw_buffer_datastream реализован zero-copy буфер для - распаковки сжатия по Хаффману. - * Исправлена утечка памяти в распаковке сжатых NEF-файлов - * LibRaw 0.13.0-Alpha2 - -2010-12-20 Alex Tutubalin - * Новое в demosaic-pack-GPL3: - + Три дополнительных метода подавления шума перед демозаикой: - - Подавление banding - - Подавление шума - - Уравнивание зеленых каналов - + Обновлен код подавителя хроматических аберраций. - Все это написано Emil Martinec для Raw Therapee. - Адаптация для LibRaw сделана Jacques Desmis - - * Импортированы правки обработки Sigma DPx из LibRaw 0.12.1 - * Ускорение декомпрессора LJPEG (примерно в 1.5 раза для камер Canon - и чуть меньше для остальных). - * Структуры данных изменены, требуется перекомпиляция всех приложений. - * LibRaw 0.13.0-Alpha1 - -2010-12-12 Alex Tutubalin - * Поддержка thread-safe сборки и demosaic packs для MinGW-сборки - * Поддержка demosaic packs для MS VC-сборки - * LibRaw 0.12.0-Release - -2010-12-09 Alex Tutubalin - * Исправлена ошибка в вызове add_masked_borders_to_bitmap(), которая - проявлялась на камерах с нечетной шириной черной рамки. - * Новые параметры командной строки примера unprocessed_raw: - -B - вычитать уровень черного, -M - добавлять маскированную рамку - к изображению. - * Камеры с сенсором Foveon добавляются в список поддерживаемого - оборудования при сброрке с demosaic pack GPL2 - * LibRaw 0.12.0-Beta4 - -2010-12-05 Alex Tutubalin - * Поддержка demosaic packs в Makefile.dist - * Поддержка Foveon в LibRaw demosaic pack GPL2 - * Структуры данных изменены, требуется перекомпиляция всех приложений. - * LibRaw 0.12.0-Beta3 - -2010-11-27 Alex Tutubalin - * Исправлена ошибка в lmmse_interpolation (demosaic-pack-GPL2) - * в lmmse и amaze_interpolation аллокация заменена на calloc, - чтобы осчастливить valgrind - * Изменения в скриптах подготовки дистрибутива. - * LibRaw 0.12.0-Beta2 - -2010-11-21 Alex Tutubalin - * Исправления в green_matching для некоторых layouts байеровских - матриц. Спасибо Сергею Павлову. - -2010-11-20 Alex Tutubalin - * Update for new demosaic-pack-GPL3 - * LibRaw 0.12.0-Beta1 - -2010-11-19 Alex Tutubalin - * Поддержка demosaic pack(s) в ./configure - -2010-11-17 Alex Tutubalin - * Добавлена поддержка LCMS2 - * afd_interpolate(2,1) вместо (5,0) - * Добавление и упорядочение ключей командной строки примера dcraw_emu - * Nikon P7000: цветовая матрица и хак для уровня черного при ISO>=400 - Спасибо Gunnar Thorburn - * Поддержка некоторых индустриальных камер на сенсоре Sony ICX 625/655 - JAI BB500CL/GE, SVS625CL, ptGrey GRAS-50S5C - * LibRaw 0.12-alpha2 - -2010-11-11 Alex Tutubalin - - * Several demosaic algorithms, found in other open-source RAW processing - packages are implemented in LibRaw. - - 1) DCB demosaic and FBDD denoise by Jacek Gozdz are included in - main LibRaw source. - 2) GPL2 demosaic pack with these demosaic methods: - * AFD and LMMSE implementations from PerfectRaw by Manuel Llorens - * VCD, Modified AHD, post-demosaic refinemend and median - filters by Paul Lee - 3) GPL3 demosaic pack with AMaZe interpolation by Emil Martinec - - See more details in README.demosaic-packs - - * Current implementation of dcraw_emu sample allows only selection - of demosaic method (via -q) options. All other parameters change - will be implemented later. - - * LibRaw 0.12-alpha1 - -2010-11-11 Alex Tutubalin - * Импортированы изменения ветки 0.11: - + Исправлена обработка параметров командной строки в примере dcraw_emu - + OpenMP выключен на MacOS X если библиотека собирается с -pthread - + Импортирована dcraw 9.05 (1.439), поддержка новых камер: - Canon: G12, SX120, 60D, - Hasselblad H4D, Nokia X2, Olympus E-5, - Nikon: D3100, D7000, P7000, - Panasonic: FZ40, FZ100, LX5, - Pentax: K-r, K-5, 645D, - Samsung GX20, WB2000 - * LibRaw 0.12-alpha0 - -2010-11-08 Alex Tutubalin - * Исправления для совместимости с компилятором Sun Studio - * Исправления для совместимости с Visual Studio 2010 - * Исправления с #ifndef/defined - * Все русские файлы перекодированы в UTF-8 - * LibRaw 0.11.0-Release - -2010-10-18 Alex Tutubalin - * Mac OS X: Выключено OpenMP для wavelet_denoise - * Почищены предупреждения Visual C++ 2003 в include-файлах - * LibRaw 0.11-Beta7 - -2010-10-16 Alex Tutubalin - * internal/dcraw_fileio.c опять компилируется с -DDCRAW_VERBOSE - * исправлен стиль комментариев (С++ -> C) в libraw_datastream.h - * LibRaw 0.11-Beta6 - -2010-10-15 Alex Tutubalin - * Обновление интерфейса чтения данных. Реализованы следующие классы - LibRaw_*_datastream: - + LibRaw_buffer_datastream - чтение из буфера в памяти - + LibRaw_file_datastream - чтение из файла через iostreams - + LibRaw_bigfile_datastream - чтение из файла через FILE* - * Выбор среди двух методов чтения файлов производится - LibRaw::open_file() в зависимости от размера файла: - + добавлен необязательный второй параметр у open_file(): - если размер файла (в байтах) больше этого значения, - то будет использован LibRaw_bigfile_datastream - + Если параметр не задан, то он равен 250 мегабайтам. - - * C API не позволяет задать параметры функции по умолчанию, - поэтому в этом API добавлен второй вызов libraw_open_file_ex() - второй параметр которого - значение размера файла, начиная с - которого начинается использование LibRaw_bigfile_datastream() - - * И это не последнее изменение I/O Layer - - * Все методы LibRaw_abstract_datastream опять виртуальные. - - * Структуры данных изменены, требуется перекомпиляция всех приложений. - - * Пример dcraw_emu с ключом -d печатает времена исполнения - отдельных операций. - - * Пример simple_dcraw еще упрощен, убран код работы с mmap() - (в dcraw_emu он остался) - - * LibRaw 0.11-Beta5 - -2010-10-08 Alex Tutubalin - * Исправлена ошибка порождения C++ exceptions внутри OpenMP-секции - в AHD-интерполяции - - * LibRaw_datastreams переведены с FILE* I/O на C++ iostreams - Многопоточные программы на многих ОС стали читать RAW гораздо - быстрее. - - * Структуры данных изменены, требуется перекомпиляция всех приложений. - - * LibRaw 0.11-Beta4 - -2010-10-01 Alex Tutubalin - * Исправлена ошибка в dcraw_process: - params.half_size выставляла params.four_color_rgb - и не возвращала обратно. - - * Исправления для совместимости с Visual Studio 2003 - - + Оптимизации AHD, теперь работа быстрее стандартной dcraw - на 10% в однопоточном режиме и до полутора раз для OpenMP - на четырех ядрах. - Спасибо Adam Hooper - - + LibRaw 0.11-Beta3 - -2010-09-07 Alex Tutubalin - * Файлы Phase One: LibRaw::unpack() устанавливает уровень - черного (colordata.black) в приблизительно корректное значение - (точная установка black/cblack невозомжна т.к. у PhaseOne - другой набор данных о точке черного, чем у обычных камер). - - * Исправлена ошибка в установке colordata.maximum для файлов - Phase One. - - * LibRaw::subtract_black() обнуляет colordata.black и - colordata.cblack[] при своей работе, таким образом значения - этих полей всегда консистентны реальному состоянию данных. - - * LibRaw 0.11-Beta2 - -2010-09-04 Alex Tutubalin - - * Возможность обрезать (crop) выходное изображение на этапе - постпроцессинга (dcraw_process). Координаты и размер выходного - изображения задаются через поле imgdata.params.cropbox[4], - подробное описание приведено в документации. - + Новый код ошибки LIBRAW_BAD_CROP - + новый параметр вызова примера dcraw_emu: -B x y w h - (задает cropbox) - + Ввод-вывод через mmap у примера dcraw_emu включается - теперь параметром -E - Спасибо Патрику и Яну за патч. - - * Изменена последовательность шагов при распаковке и обработке - изображений: на этапе распаковки не производится вычитание - уровня черного. Это вычитание делается либо автоматически - на этапе постпроцессинга (dcraw_process), либо явным - вызовом: - + Новый вызов LibRaw::subtract_black() (C++ API) и - libraw_subtract_black (C API). Если вы используете - dcraw_process(), то пользоваться этим вызовом НЕ НУЖНО. - + Флаг распаковки RAW-данных LIBRAW_FILTERING_NOBLACKS - более не существует. - - * Добавлен простой скрипт ./configure позволяющий задать - используемый компилятор и ряд других параметров. - Используйте ./configure -h для получения справки. - Спасибо Siddhesh Poyarekar - - * Новые вызовы: static LibRaw::dcraw_clear_mem() (C++) и - libraw_dcraw_clear_mem(..) (C API). - Предназначены для освобождения памяти, выделенной - dcraw_make_mem_image() и dcraw_make_mem_thumb() в случае, когда в - библиотеке и в вызывающем приложении используются разные - аллокаторы (например, при сборке отладочного Windows-приложения - с релизным Libraw.dll). - На Unix-системах можно продолжать пользоваться системным free(). - - * LibRaw::free() опять стала private вместо public (это было - временное решение в версии 0.10, используйте dcraw_clear_mem). - - * Мелкие изменения и багфиксы: - + возможные исключения (exceptions) по нехватке памяти - перехватываются, вызовы в которых они могут возникнуть - возвращают теперь правильный код ошибки. - (в реальности эта проблема невероятна - если не хватило - памяти на структуры данных, то ее не хватит и на - память под изображение). - + WIN32/VisualStudio 2008/2010: вызовы fopen,fscanf и sscanf в - Libraw_datastream заменены на соответствующие _s (secure) - варианты. - + удален отладочный fprintf(stderr,..) из обработчика - исключительных ситуаций (фатальных ошибок). - * Структуры данных изменены, требуется перекомпиляция всех приложений. - - * LibRaw 0.11-Beta1 - -2010-07-31 Alex Tutubalin - * Импортирована dcraw 9.04 (1.438): изменения в разборе метаданных TIFF - * Небольшое исправление в коде разбора файлов Sony ARW2, не ошибка, но - для счастья проверки valgrind. - * LibRaw 0.10.0-Beta3. - -2010-07-05 Alex Tutubalin - * Импортирована dcraw 9.03 (1.437) - + Новые камеры: Canon SX20, Nikon D3s, Olympus E-P2, Panasoni DMC-GF1, - Samsung EX1, Sony A450 - + Изменены цветовые данные для некоторых камер - - * LibRaw 0.10.0-Beta2. -2010-06-06 Alex Tutubalin - * Импортирована dcraw 9.01 (1.434): - + отдельные минимумы данных по 4-м каналам (color.cblack[8], - первые 4 значения - усредненные минимумы, вторые - счетчики - черных пикселов) - + Новые камеры: Canon 550D, Casio EX-Z1050, Fuji HS10/HS11, - Kodak Z981, Panasonic G2 и G10, Phase One P65, - Samsung NX-10 и WB550, Sony NEX-3 и NEX-5. - + Исправлена ошибка с незакрытием файла с dark frame - - * Исправлена привнесенная dcraw 9.01 ошибка в расчете уровня черного - для DNG-файлов - - * Предварительная поддержка для Sony A450 - - * добавлен свитч -h к примеру mem_image (поддержка half_size) - - * Добавлено несколько патчей от Johannes Hanika (автор darktable): - + PPG-интерполяция поддерживает ускорение посредством OpenMP - + green_matching - подавление разбаланса зеленых каналов, - включается одноименной опцией в imgdata.params. - - * Структуры данных изменены, требуется перекомпиляция всех приложений. - - * LibRaw::free() стала public вместо private. - - * LibRaw 0.10.0-Beta1. - -2010-05-15 Alex Tutubalin - * Исправлена ошибка в коде распаковки 8-битных RAW. - * LibRaw 0.9.1-Release - -2010-04-26 Alex Tutubalin - * OpenMP возможна (не запрещена) компиляция c OpenMP под MinGW - (не тестировалось) - * LibRaw 0.9.0-Release - -2010-04-21 Alex Tutubalin - * Окончательно удалены неудобства при работе с RAW-файлами Fuji - из пользовательских приложений - - * Новый вызов COLOR(row,col) возвращает индекс в массиве image[], - соответствующий цвету данного байеровского пиксела. Вызов заменяет - FC(row,col), который будет спрятан в следующих версиях. - - * Пример unprocessed_raw переведен на вызов COLOR() - - * LibRaw 0.9.0-Beta5 - -2010-04-10 Alex Tutubalin - * Исправлена ошибка в обработке DNG-файлов, сконвертированных из - RAF-файлов Fuji. - * LibRaw 0.9.0-Beta4 - -2010-04-09 Alex Tutubalin - * Исправлена ошибка в обработке .CRW-файлов, проявлявшаяся - на некоторых версиях gcc 4.4 - * Вызов LibRaw::adjust_maximum() де-документирован, авто-коррекция - максимума сейчас включена по-умолчанию. - * Вызов C-API libraw_adjust_maximum() удален. - * Новое поле в параметрах пост-обработки: params.adjust_maximum_thr - позволяет более гибко (чем старый интерфейс LibRaw::adjust_maximum) - управлять авто-коррекцией максимума. - * Убрана последняя OpenMP warning, возникавшие при компиляции приложений, - использующих LibRaw. - * Параметр -c у примера dcraw_emu принимает числовое значение и - устанавливает params.adjust_maximum_thr. Для совместимости с dcraw - используйте -c 0 - * Структуры данных изменены, требуется перекомпиляция всех приложений. - * LibRaw 0.9.0-Beta3 - - -2010-03-29 Alex Tutubalin - * Исправлена ошибка в расчете channel_maximum для камер - Panasonic. - * channel_maximum[] рассчитывается для всех камер - * Убраны OpenMP warnings, возникавшие при компиляции приложений, - использующих LibRaw. - * Документирован ключ -c у примера dcraw_emu - * Убрана излишняя разговорчивость у примера dcraw_emu - * LibRaw 0.9.0-Beta2 - -2010-03-28 Alex Tutubalin - - Смена лицензирования: - - * Тройное лицензирование: - + LGPL 2.1 (http://www.gnu.org/licenses/lgpl-2.1.html) - + CDDL 1.0 (http://www.opensource.org/licenses/cddl1.txt) - + LibRaw Software License (27 March 2010 version) - (http://www.libraw.org/data/LICENSE.LibRaw.pdf) - - * Отдельные LibRaw-Lite и LibRaw-Commercial более не существуют, - есть единая библиотека LibRaw. Пользователям LibRaw-Commercial - следует переключиться на LibRaw (потери функциональности не будет) - при этом возможна и смена лицензии. - - * Удалена поддержка Foveon: на этих камерах невозможно нормальное - цветовоспроизведение (ни один из конверторов его не дает), - соответствующий код из dcraw (с проблемами цвета) лицензирован - по GPL, что создает проблемы. - - Новые возможности: - - * Добавлено поле colordata.channel_maximum[4] - поканальные максимумы - RAW-значений - - * Добавлен вызов adjust_maximum (libraw_adjust_maximum), меняющий поле - maximum на вычисленное (max(color_maximum[]), что позволяет избавиться - от паразитных тонов в светах при постпроцессинге. - - * Новый параметр командной строки -c у пример dcraw_emu. При задании этого - параметра adjust_maximum() вызывается при обработке входного файла. - - * Структуры данных изменены, требуется перекомпиляция всех приложений. - - * LibRaw 0.9.0-Beta1 - -2010-02-06 Alex Tutubalin - * Исправлена двусмысленность в вызовах pow/sqrt - (проявляется с компилятором Sun). - * OpenMP не поддерживается с компилятором MS Visual Studio - * Замаскирована ошибка при разборе (поврежденных?) RIFF-файлов - * LibRaw 0.8.6 - -2009-12-30 Alex Tutubalin - * Исправлена ошибка в разборе параметров примера simple_dcraw - * Импортирована dcraw 8.99 (1.432): - + Поддержка новых камер: Canon: 1D mk IV, Canon S90; Casio Z750, - Nikon D3S, Pentax K-x, Sony A-500/550, Fuji S200EXR - + Цветовые данные для Canon G11, Sony A850 - + Изменения в разборе Canon sRAW - + Изменения в разборе метаданных Kodak - + Изменения в поддержке несжатых файлов Fuji (FinePix S5xxx) - * LibRaw 0.8.5 - -2009-11-21 Alex Tutubalin - + Исправлена ошибка в обработке некомпрессированных файлов Phase One - * LibRaw 0.8.4 - -2009-10-24 Alex Tutubalin - + Импортирована dcraw 8.98/1.431: - * Новые камеры: Canon 7D, Panasonic GF1, Sony A850 и A380, Casio Z850, - Nikon D300s - + Изменения в заголовочных файлах для подавления предупреждений компилятора - * LibRaw 0.8.3 - -2009-09-02 Alex Tutubalin - + Исправлена ошибка в коде распаковки Hasselblad .3FR - * Импортирована dcraw 8.97/1.428: исправлена ошибка определения - ширины изображения для Nikon D3000 - * LibRaw 0.8.2 - -2009-08-31 Alex Tutubalin - + Значения Enum LibRaw_thumbnail_formats (LIBRAW_IMAGE_*) изменены, - чтобы соответствовать значениям в enum LibRaw_image_formats - (LIBRAW_THUMBNAIL_*). - Если вы используете упомянутые символьные константы, вам необходимо - перекомпилировать ваш код. - -2009-08-30 Alex Tutubalin - * Импортирована dcraw 8.97/1.427: - + Новые камеры: Canon A470, Canon G11, - Nikon D3000, Olympus E-P1, Panasonic DMC-FZ35/FZ38 - * Исправления для совместимости с Microsoft Visual C++ 6.0 - * Вызов C-API dcraw_make_mem_thumb() экспортируется в DLL - * LibRaw 0.8.1 - -2009-08-24 Alex Tutubalin - * Импортирована dcraw 8.86/1.426 - + Новые камеры: Casio EX-Z60 and EX-Z75, Kodak Z980, - Nikon D5000, Olympus X200, D560Z,C350Z,E620, - Pentax K7, Sony A330. - + Новые цветовые данные для многих камер - + Более общий код для распаковки данных P&S камер Canon и Casio - * LibRaw 0.8.0-Release - -2009-08-13 Alex Tutubalin - * Поддержка RAW-файлов размером более 2Gb - - Unix (все варианты) - - Windows (для систем с версией C runtime >= 8.0) - * bzero более не используется, ибо есть не везде. - * на всех 32-битных системах требуется полная перекомиляция - приложений - * LibRaw 0.8.0-Beta5 - -2009-07-21 Alex Tutubalin - * Импортирована dcraw 8.95 (1.425): - + Новый код для распаковки huffman tree - + Добавлена поддержка камер: AGFAPHOTO DC-833m, Casio EX-S20, - Phase One P65, Samsung S850 - + Удалены стандартные значения коэффициентов баланса белого для - ряда P&S камер. - Для стандартной обработки рекомендуется устанавливать - params.use_camera_wb=1, что даст разумные умолчания для баланса - белого. - * Исправление: на файлах Nikon D5000 больше нет розовой полосы - справа - * C-интерфейс: добавлены пропущенные ранее вызовы - libraw_dcraw_make_mem_image() - libraw_dcraw_ make_mem_thumb() - * Внутренние структуры данных изменены, требуется перекомпиляция - всего клиентского кода. - * Мелкие исправления для беспроблемной компиляции на компиляторах, - отличных от gcc - * LibRaw 0.8.0-Beta4 - -2009-06-08 Alex Tutubalin - * Исправление: гамма-кривая не накладывалась в функции - dcraw_write_mem_image() - * Исправление: гамма-кривая не накладывалась при обработке - preview некоторых камер Kodak - * LibRaw 0.8.0-Beta3 - -2009-06-05 Alex Tutubalin - * Поправки в документации: params.gamm[] описан более точно - * Поправки в номере версии, 0.8-beta1 has version 0.0.0-beta2 - * LibRaw 0.8.0-Beta2 - -2009-06-04 Alex Tutubalin - * Импортирована dcraw 8.94 (1.423): - + Поддержка новых камер: - Canon: SX1, 500D/Rebel T1i, A570, A590, SX110 - Kodak Z1015, Motorola PIXL, Olympus E30, Panasonic DMC-GH1 - + Улучшены цветовые данные для камеры Nikon D3X - + Новая схема работы с гамма-кривой - + множество изменений в коде распаковки - + Для камер Canon: вычитание уровня черного не производится, если - через параметры установлена params.document_mode > 1 - - * Изменения API: параметра params.gamma_16bit field более не - существует. - Параметры гамма-кривой задаются через поля params.gamm[0]/gamm[1] - (см. документацию и исходные тексты примеров). - * Функция LibRaw::identify() разделена на две для обхода ошибки в MS - VS2008 bug - * Изменения в примерах: примеры dcraw_emu и mem_image поддерживают - новые ключи командной строки dcraw: - 16bit/gamma semantics: - -6 16-битный вывод (гамма-корректированный) - -4 16-бит, линейная гамма-кривая и выключено автоматическое - повышение яркости - * LibRaw 0.8.0-Beta1 - -2009-04-28 Alex Tutubalin - * Пример identify переименован в raw-identify (конфликт с ImageMagic) - * Исправлены копирайты - * Удалено множество предупреждений компилятора - -2009-04-07 Alex Tutubalin - * Более аккуратное преобразование типов в libraw_datastream.h - (подавление warnings при компиляции сторонних приложений с -Wall) - * Новый параметр пост-обработки imgdata.params.auto_bright_thr - - задает долю насыщенных пикселов при использовании - авто-установки яркости (вместо забитого ранее в код 1%) - * Параметр -U у примера dcraw_emu: устанавливает параметр - auto_bright_thr - * Все клиентские приложения должны быть перекомпилированы из-за - смены размеров структур данных. - * LibRaw 0.7.2-Release - -2009-03-22 Alex Tutubalin - * Исправлена опечатка в коде поддержки OpenMP - * Поддержан MinGW - * В поставку включен исходный текст dcraw.c - * LibRaw 0.7.1-Release - -2009-03-15 Alex Tutubalin - * Цветовые каналы для файлов Fuji SuperCCD упорядочиваются на этапе - распаковки RAW (а не на этапе постпроцессинга, как ранее) - * LibRaw 0.7.0-Release - -2009-03-13 Alex Tutubalin - * Импортирована dcraw 8.93/1.421 - + более общая поддержка Pentax PEF - + правки в идентификации файлов Kodak DSC620X/720X - + более быстрая идентификация для ряда форматов. - * LibRaw 0.7.0-Beta5 - -2009-03-08 Alex Tutubalin - * Импортирована dcraw 8.92/1.420 - + возможность задания пользовательской гамма-кривой - + поддержка Pentax K2000/Km - + изменения в обработке в Canon sRAW - - * требуется перекомпиляция всего клиентского кода - - * LibRaw 0.7.0-Beta4 - -2009-02-13 Alex Tutubalin - * bugfix: Пример 4channels вычитает уровень черного по-умолчанию - - * dcraw 8.91/1.419 imported: - + правки в разборе файлов RIFF - - * LibRaw 0.7.0-Beta3 - -2009-02-12 Alex Tutubalin - * Для камер кэнон не рассчитывался уровень черного для ряда режимов - фильтрации RAW - - * Пример 4channels теперь печатает уровень черного (масштабированный - если используется автомасштабирование), имена порождаемых - файлов теперь содержат название цветового канала. - - * LibRaw 0.7.0-Beta2 - -2009-02-09 Alex Tutubalin - * Новый пример 4channels: сохраняет каналы файла в отдельных - tiff-файлах - - * LibRaw 0.7.0-Beta1 - -2009-02-07 Alex Tutubalin - * Исправлена ошибка в обработке чтения метаданных из - внешних JPEG-файлов - * Устранены некоторые предупреждения компилятора С++ - - * Импортирована dcraw 8.91/1.418 - + Поддержка Hasselblad V96C - - * Если ваш код использует потоки ввода LibRaw, то вам - следует его перекомпилировать - - * LibRaw 0.7.0-Alpha6 - -2009-01-30 Alex Tutubalin - * Реализован полностью новый framework ввода, допускающий - легкое переопределение функций чтения RAW-файлов пользователем - библиотеки. - - * Все программы, написанные для старых версий LibRaw полностью - совместимы с данной на уровне исходных текстов - - * На базе новой input framework реализован интерфейс ввода данных - из буфера в памяти LibRaw::open_buffer(). Примеры dcraw_emu - и simple_dcraw используют этот интерфейс если задан ключ -B - - * Функциям - уведомителям об ошибках может быть передано - нулевое (NULL) имя обрабатываемого файла, если поток ввода - не ассоциирован с файлом. Эта ситуация должна корректно - обрабатываться клиентским кодом, если он ставит свои уведомители - об ошибках. - - * Требуется полная перекомпиляция клиентского кода - - * Импортирована dcraw 8.90/1.417: - + Поддержка загрузки баланса белого из файлов - Sony ARW, редактированных конвертором Sony IDC. - - * LibRaw 0.7.0-Alpha5 - -2009-01-17 Alex Tutubalin - * LIBRAW_FILTERING_NOPOSTPROCESS переименована - LIBRAW_FILTERING_NORAWCURVE, что означает "не пропускать - RAW-данные через тоновую кривую" (для PhaseOne это - отключает и весь прочий постпроцессинг RAW данных) - - * Режим фильтрации NORAWCURVE реализован для всех - релевантных камер с байеровской матрицей: - + Adobe DNG (только RAW-данные с байеровской матрицы) - + Nikon compressed NEF - + Ряд камер Kodak - + Sony A700/A900 (только 8-битные RAW-файлы) - - * Реализована распаковка без поворота для DNG-файлов - сконвертированных из Fuji RAF (SuperCCD) - - * Пример unprocessed_raw: добавлен ключ -N, включающий - режим LIBRAW_FILTERING_NORAWCURVE - - * Импортирована dcraw 8.90/1.416: - + улучшена поддержка камеры Samsung S85 - + исправлено возможное переполнение целого в - wavelet-шумопонижении - - * LibRaw 0.7.0-Alpha4 - - -2009-01-14 Alex Tutubalin - * Извлечение черной рамки теперь работает для всех камер с - одноцветными данными (добавлена поддержка для Fuji и PhaseOne). - Все еще не работает для многоцветных данных: Foveon, Canon sRAW, - Sinar 4-shot, Kodak YRGB и YCbCr - * Режим невычитания черного работает для всех камер с одноцветными - данными (добавилась поддержка PhaseOne backs) - - * Изменения в обработке данных камер FujiFilm: - + исходное RAW-изображение извлекается без поворота на 45 градусов - + поворот происходит на стадии постобработки - + вызывающая программа может сделать поворот (и для ряда камер - - двойное сжатие по длинной стороне) самостоятельно, вызовом - rotate_fuji_raw() - - * Новый бит в настройках filtering_mode: - LIBRAW_FILTERING_NOPOSTPROCESS - Отключает постпроцессинг, который делается на основании считанных - из RAW метаданных. В настоящий момент функциональность поддержана - только для PhaseOne (планируется поддержка для всех релевантных - камер) - - * Для камер PhaseOne помимо черной рамки хранятся данные о точке - черного, считанные из данных файла. - - * Исправлена имеющаяся в dcraw ошибка с расчетом уровня черного - для камер PhaseOne, результаты работы для этих задников бинарно - не совпадают со стандартной dcraw. - - * Исправлена ошибка в обработке параметра -s в примере dcraw_emu - - * Добавлен параметр -s N в пример unprocessed_raw, позволяющий - задать номер изображения для извлечения. - - * Импортирована dcraw 8.90/1.414: - + изменения в обработке внешних jpeg с метаданными (Diag RAW) - + Поддержка Samsung S85 - + изменения в обработке файлов QuickTake 100 - - * Требуется полная перекомпиляция всего клиентского кода - - * LibRaw 0.7.0-Alpha3 - - -2009-01-10 Alex Tutubalin - * Исправлена ошибка в add_masked_borders(): все портилось, если - размер выходного изображения был больше, чем размер RAW-данных - * Исправлена ошибка в samples/unprocessed_raw.cpp проявлявшаяся на - файлов с камер с неквадратными пикселами - - * LibRaw 0.7.0-Alpha2 released - -2009-01-08 Alex Tutubalin - * исправлена ошибка 0.7.0-a0 - размеры рамки не обнулялись, - проявлялось при батч-обработке, если у следующего файла была рамка - нулевого размера. - - * Чтение черной рамки сделано практически для всех камер, где это имеет - смысл (имеется рамка). Исключения: - + Canon sRAW, Leaf (MOS), Sinar 4-shot - форматы в которых больше - одного компонента в рамке (в Leaf: потенциально, в остальных - всегда), - требуется смена формата данных хранения рамки. - + Fuji SuperCCD: пока не принято решение, как совместить хранение рамки - и поворот изображение (со сменой масштаба) - Тестирование извлечение рамки неполное: для 9 форматов паковки (из 21 - для которых поддержано извлечение черной рамки) пока нет примеров данных. - Правда 7 из этих 9 - это старые P&S камеры. - - * Новые параметры у примера identify: - -u - печатать имя функции-распаковщика, - -f - печатать размеры черной рамки у изображения. - Работают только если identify запущена без -v - - * новый вызов unpack_function_name(), возвращает имя функции-распаковщика - - * Импортирована dcraw 8.89/1.411 - + исправления в разборе файлов Panasonic FZ50 - - * LibRaw 0.7.0-Alpha1 - -2009-01-05 Alex Tutubalin - * Возможность отключения фильтрации RAW-данных (вычитание уровня черного, - замазывание пикселов с нулевыми значениями): - + поддержано на всех камерах кроме камер Foveon и Phase One - + управление фильтрацией параметром filtering_mode - + возможность расширения API процедурами фильтрации, специализированными - для конкретной модели камеры - * Извлечение данных черной рамки - + API для хранения данных черной рамки - + Процедуры извлечения данных рамки для форматов .CRW, .CR2 (кроме sRAW), - DNG, NEF, Canon A600 и Canon A5 - * Вызов add_masked_borders_to_bitmap для построения общего битмэпа - маскированная рамка + RAW-данные. - * Пример использования вышеописанной функциональности: samples/unprocessed_raw - * Импортирована новая редакция dcraw 8.89 (версия 1.410) - + исправления в разборе файлов Hasselblad - + исправления в разборе файлов Imacon - * Изменения в документации - * Требуется полная перекомпиляция всего клиентского кода - * LibRaw 0.7.0-Alpha0 - -2009-01-01 Alex Tutubalin - * Исправлена ошибка (filedescriptor and buffer memory leak) в коде извлечения - preview, если извлечение preview вызывалось до открытия RAW-файла. - Thanks to Albert Astalis Cid. - * LibRaw 0.6.4 Release - -2008-12-11 Alex Tutubalin - * Импортирована новая редакция dcraw 8.89 (версия 1.409) - * Изменено раскодирование NEF-файлов (лучше обрабатывается переполнение) - * LibRaw 0.6.3 Release - -2008-12-04 Alex Tutubalin - * Исправлена ошибка в обработке файлов .RW2 (Panasonic). Ошибка проявлялась - только в thread-safe режиме, single-threaded вариант не был затронут. - * Требуется полная перекомпиляция всего клиентского кода - * LibRaw 0.6.2 Release - -2008-12-03 Alex Tutubalin - * Импортирована dcraw 8.89 - * Поддержка новых камер - Canon G10 и 5D Mk2, Leaf AFi 7, Leica D-LUX4, Panasonic FX150 и G1, Fujifilm IS Pro - * Изменена поддержка камер (цветовые таблицы), поддержаных в предыдущей версии - Canon 50D, Nikon D90 & P6000, Panasonic LX3 & FZ28, Sony A900 - * LibRaw 0.6.2 beta - -Добавлено поле float LibRaw::imgdata.color.cam_xyz[4][3] - таблица - преобразования из камерного RGB в XYZ. Эта таблица - константна - для каждой камеры (и константна в коде) - * Требуется полная перекомпиляция всего клиентского кода - * LibRaw 0.6.1 Release - -2008-09-25 Alex Tutubalin - * Добавлено поле float LibRaw::imgdata.color.cam_xyz[4][3] - таблица - преобразования из камерного RGB в XYZ. Эта таблица - константна - для каждой камеры (и константна в коде) - * Требуется полная перекомпиляция всего клиентского кода - * LibRaw 0.6.1 Release - -2008-09-18 Alex Tutubalin - * импорт dcraw 8.88: - - поддержка новых камер (Canon 50D, Sony A900, Nikon D90 & P6000, - Panasonic LX3 FZ28) - - новая обработка точки черного на камерах Canon: борьба с бэндингом - (очень приблизительная) - * Уменьшение требований по памяти на стеке для объекта LibRaw - (локальные данные thread перенесены в динамическую память) - * патчи для совместимости с MS Visual C++ - * LibRaw 0.6.0 Release - -2008-09-16 Alex Tutubalin - * Изменения в определении констант, чтобы сделать gcc -pedantic счастливым - * Флаги компиляции не влияют на содержимое полей класса LibRaw - * При компиляции по-умолчанию компилируется thread-safe версия, хранящая - статические данные распаковщиков в объекте LibRaw - -2008-09-14 Alex Tutubalin - * параллелизация через OpenMP наиболее ресурсоемких этапов обработки - ahd_interpolation. wavelet_denoise - Поддержка OpenMP работает только на Unix (Linux/FreeBSD) и Mac OS X - - * LibRaw 0.6.0-Beta-1 - -2008-09-10 Alex Tutubalin - * При установке callbacks сохраняется дополнительный void* - указатель, - указывающий на приватные данные callback (для использования нескольких - LibRaw instances) - - * LibRaw 0.6.0-alpha5 - - * Требуется полная перекомпиляция всего клиентского кода - -2008-09-10 Alex Tutubalin - * Добавлены стадии обработки LIBRAW_PROGRESS_BAD_PIXELS и - LIBRAW_PROGRESS_DARK_FRAME - (удалены LIBRAW_PROGRESS_RESERVED_PRE1-LIBRAW_PROGRESS_RESERVED_PRE2) - - * Добавлена поддержка user callbacks на промежуточных стадиях обработки - - * libraw_strprogress call - - * новая фатальная ошибка 'CANCELLED_BY_CALLBACK' - - * пример использования callback в примере dcraw_emu (запустить с - ключами -v -v -v) - - * LibRaw 0.6.0-alpha4 - - * Требуется полная перекомпиляция всего клиентского кода - - -2008-09-08 Alex Tutubalin - * Поддержка ICC-профилей, аналогичная поддержке в dcraw - + возможность задать профиль камеры (включая embedded) и выходной - профиль после конверсии - + дополнительные предупреждения, если заданы неверные профили - + используется библиотека LCMS - - * поддержка карты плохих пикселей (задается путь к файлу, формат - аналогичен dcraw) - - * поддержка вычитания dark frame ([задается путь к 16-бит PGM) - samples/simple_dcraw.cpp - добавлен ключ -4 для генерации dark frame file - - * поддержка карты плохих пикселов (в формате dcraw) - - * пример dcraw_emu поддерживает всю новую функциональность - (ICC, dark frame, bad pixels) - - * libraw/libraw_version.h, вызовы и макросы для проверки версии - + LibRaw::version(), LibRaw::versionNumber(), LIBRAW_CHECK_VERSION() - - * выдается список поддерживаемых камер: - + LibRaw::cameraCount() - + LibRaw::cameraList() - - * исправлена ошибка в вызове adjust_sizes_info_only - - * изменения в документации - - * LibRaw 0.6.0-alpha3 - -2008-09-07 Alex Tutubalin - * samples/mem_image.c - вывод 16-битных данных теперь одинаков с dcraw -4 - (вывод PPM производится в network byte order) - - * LibRaw 0.6.0-alpha2 - -2008-09-06 Alex Tutubalin - * Добавлены функции dcraw_make_mem_image и dcraw_make_mem_image: - + реализация функций - + изменения в документации - + новый пример samples/mem_image.cpp - * Добавлен параметр LibRaw::imgdata.params.gamma_16bit - (если он установлен в 1, то вывод в TIFF/память 16-битных данных - будет с гамма-коррекцией) - * LibRaw 0.6.0-alpha1 - -2008-08-28 Alex Tutubalin - * Импорт dcraw 1.404 (8.87): - - новые камеры (Canon 1000D, A720, SD300; - Nikon D700, Oly E-520,Kodak C603) - * Лицензирование изменено на GPL v2 - -2008-05-02 Alex Tutubalin - * Удален io layer, как не дающий существенного выигрыша - в производительности, возвращен FILE I/O - -2008-05-02 Alex Tutubalin - * Импорт dcraw 1.403 - - изменения в распаковке ljpeg: индекс в кривой - обрезается до 12 бит (ранее не было) - - изменения в обработке картинок с foveon с - jpeg thumbnail: обрабатывается случай, когда - заявленная длина thumbnail больше, чем есть места - * LibRaw 0.5.3 released - -2008-04-24 Alex Tutubalin - * Редактирование английской документации - * поправлена сборка примера identify под Linux - * LibRaw 0.5.2 released - -2008-04-21 Alex Tutubalin - * Окончательный перевод документации на английский - * Микро-исправлени (путь до include) в samples/half-mt - * LibRaw 0.5.1 released - -2008-04-20 Alex Tutubalin - * Добавлена и задокументирована установка под Unix - * добавлена вторая порция английской документации - * импортирована dcraw 1.402 (8.86) - * LibRaw 0.5.0 released - -2008-04-18 Alex Tutubalin - * правка опечаток в русской документации - * добавлена первая порция английской документации - -2008-04-11 Alex Tutubalin - * Импортирована dcraw 1.401 (8.85) - -2008-04-06 Alex Tutubalin - * Импортирована dcraw 1.400 (8.84) - -2008-04-03 Alex Tutubalin - * Добавлена сборка DLL для Win32 - * LibRaw 0.4.9 released - -2008-04-03 Alex Tutubalin - * Добавлена (и задокументирована) сборка под Win32 - * Добавлен ключ -T к half_mt (вывод в Tiff) - * пример half_mt переписан под Win32 (тамошний threads interface) - * LibRaw 0.4.8 released - -2008-03-24 Alex Tutubalin - * Исправлена ошибка в проверке на OUT_OF_ORDER calls - * Исправлены проблемы c thread safety (Coffin static variables) - * добавлен пример half_mt - * Добавлены warnings и все что с этим связано. - -2008-03-23 Alex Tutubalin - * шлифовка Why-LibRaw-rus - * open_file() теперь извлекает ICC-профиль (если он есть в файле) - * удалена поддержка bad_pixels и dark_frame - * исправлена ошибка в open_file(): params.use_camera_wb не копировался в - params.use_camera_matrix если у последнего было значение по умолчанию. - * Пример samples/dcraw_emu.cpp - полная эмуляция режимов dcraw (кроме - ключей -i -e -D -d -P -K). - * Поведение "-h implies -f" hardcoded в dcraw_process() - * C API (сделано, документировано) - * пример dcraw_half (использование C API) - -2008-03-22 Alex Tutubalin - * добавлена char *libraw_strerror(int errcode); - * добавлен макрос LIBRAW_FATAL_ERROR - * обработка ошибок в примерах приведена к современным веяниям - * Примеры переименованы и изменены - - dcraw_main - удален, запутывает картину - - identify_cxx => identify - - docmode_cxx => simple_dcraw, добавлен "эмулятор" dcraw без - параметров (все - defaults) - * переупорядочено расположение исходных текстов - * io.h => libraw_io.h - * запрограммирована dcraw_process() - * шлифовка документации - * LibRaw 0.3.0 released - -2008-03-20 Alex Tutubalin - * все переменные _offset спрятаны из зоны видимости - * удалена обработка ошибки нехватки памяти на longjmp (все равно - не работала), заменена на C++ exceptions. - - * память под гистограмму теперь аллоцируется динамически - * Изменения в обработке preview для камер Kodak (повлекшие - за собой массированные изменения в интерфейсе): - - kodak thumbnails сразу гамма-корректируются и применяется - внутрикамерный баланс белого (аналогично dcraw -e) - - Удалена функция int LibRaw::dcraw_ppm_tiff_writer (т.к. - все bitmap-превью теперь в одинаковом формате, то она - не нужна) - - удалены константы формата thumbnail: - LIBRAW_THUMBNAIL_FOVEON - LIBRAW_THUMBNAIL_KODAK - LIBRAW_THUMBNAIL_PPM - вместо них теперь - LIBRAW_THUMBNAIL_BITMAP - - * имплементированы пользовательские callbacks на ошибочные - состояния "нехватка памяти" и "ошибка при чтении данных" - - * имплементирован менеджер памяти и автоматическое освобождение - всего аллоцированного по recycle() - - * При возникновении исключительной ситуации при записи во - внешний файл - файл закрывается. - - * Добавлены новые коды ошибок - LIBRAW_UNSUFFICIENT_MEMORY - LIBRAW_DATA_ERROR - LIBRAW_IO_ERROR - При возникновении этих ошибок делается recycle() и объект - LibRaw переходит в исходное (стартовое) состояние - - * Добавлено новое состояние источника цветовых данных: - LIBRAW_COLORSTATE_INIT - - * LibRaw 0.3.0 released diff -Nru libraw-0.16.2/Changelog.txt libraw-0.17.0/Changelog.txt --- libraw-0.16.2/Changelog.txt 2015-05-16 12:32:15.000000000 +0000 +++ libraw-0.17.0/Changelog.txt 2015-08-15 13:10:27.000000000 +0000 @@ -1,10 +1,112 @@ -2015-05-16 Alex Tutubalin - * Fix for several problems reported by AFL run - * LibRaw 0.16.2-Release - -2015-05-11 Alex Tutubalin - * Fix for dcraw ljpeg_start() vulnerability - * LibRaw 0.16.1-Release +2015-08-15 Alex Tutubalin + + * LibRaw 0.17 + + * Fixed dcraw.c ljpeg_start possibly buffer overrun + + * fixed several bugs detected by using American Fuzzy Lop + + * C-API extension to support 3DLut Creator + + * More metadata parsing/extraction: + - XMP packet extracted (if exists) + - DNG Color information parsed + - GPS data (partially) parsed + - EXIF/Makernotes parsed for used optics (for both RAW files and DNG converted by Adobe convertor). + + * Exif/Makernotes parser callback (called for each processed tag) + + * Sony ARW2.3 decoder: + - params.sony_arw2_hack removed, decoded data are always in 0...17k range (note the difference with dcraw!) + - Additional processing options for Sony lossy compression techincal analysis. + + * Dcraw 9.26 imported (but some changes not approved because Libraw do it better) with some exceptions: + - no Pentax K3-II frame selection code + - no built-in JPEG decompressor + + * Many improvements in data decoding/processing: + - Correct decoding of black level values from metadata for many formats, LibRaw do not rely on hardcoded black levels. + + * 224 camera models added to supported camera list. + Some of them are new (released since LibRaw 0.16 come out), some was supported before, but missed from the list. + Added cameras are: + + Alcatel 5035D + BlackMagic Pocket Cinema Camera, Production Camera 4k + Canon PowerShot A550, A3300 IS, G1 X Mark II, G7 X, SD950, SX60 HS, EOS 7D Mark II, EOS 20Da, EOS 60Da, EOS 1200D, EOS-1D C, 5DS, 5DS R, 750D, 760D, M2, M3, G3 X + Casio EX-FC300S, EX-FC400S, EX-Z1080, EX-ZR700, EX-ZR710, EX-ZR750, EX-ZR800, EX-ZR850, EX-ZR1000, EX-ZR1100, ZR1200, ZR1300, EX-ZR1500, EX-100, EX-10 + Digital Bolex D16,D16M + DJI 4384x3288, + Epson R-D1s, R-D1x + FujiFilm E505,S1,S205EXR,HS10,HS11,HS22EXR,HS33EXR,HS35EXR,F505EXR,F605EXR,F775EXR,F900EXR,X100T,X30,X-T1,X-T1 Graphite Silver, XQ2, X-A2, X-T10 + Hasselblad H5D-60, H5D-50,H5D-50c,H5D-40,H4D-60,H4D-50,H4D-40,H4D-31,H3DII-22,H3DII-31,H3DII-39,H3DII-50,H3D-22,H3D-31,H3D-39,H2D-22,H2D-39,CF-22,CF-31,CF-39,Stellar II,HV + HTC UltraPixel + Imacon Ixpress 96, 96C, 384, 384C (single shot only),132C, 528C (single shot only) + ISG 2020x1520 + Ikonoskop A-Cam dII Panchromatic, A-Cam dII + Kinefinity KineMINI, KineRAW Mini, KineRAW S35 + Kodak DCS460D, S-1 + Leaf Credo 50 + Lenovo a820 + Leica Digital-Modul-R, D-Lux (Typ 109), M (Typ 240), Monochrom (Typ 240), M-E, M-P, R8, S, T (Typ 701), X (Typ 113), X2, X-E (Typ 102), V-Lux (Typ 114), Monochrom (Typ 246), Q + Matrix 4608x3288 + Nikon D4s, D600, D610, D750, D800, D800E, D810, D3300, D5500, Df, 1 J4, 1 S2, 1 V3, Coolpix P340, Coolscan NEF, D7200, 1 J5,D810A + Nokia 1200x1600 + Olympus E-450, E-600, E-PL6, E-PL7, E-M1, E-M10, E-M5 Mark II, SP565UZ, STYLUS1s, SH-2, TG-4, AIR-A01 + Panasonic DMC-CM1, DMC-FZ7, DMC-FZ70, DMC-FZ1000, DMC-GF7, DMC-GH4, AG-GH4, DMC-GM1s, DMC-GM5, DMC-LX100, DMC-TZ60/61/SZ40, DMC-TZ70, FZ300/330, GX8 + Pentax GR, K110D, K-01, K-S1, Q, QS-1, 645Z, K-S2, K3 II + PhaseOne IQ250, IQ260, IQ260 Achromatic, IQ280, Achromatic+, P 20+, P 21, P 25+, P 30+, P 40+ + Ricoh GXR MOUNT A12, GXR MOUNT A16 24-85mm F3.5-5.5, GXR, S10 24-72mm F2.5-4.4 VC, GXR, GR A12 50mm F2.5 MACRO, GXR, GR LENS A12 28mm F2.5, GXR, GXR P10 + Samsung GX-1L, NX1, NX5, NX1000, NX1100, NX30, NX300, NX300M, NX3000, NX mini, Galaxy S3, Galaxy Nexus, NX500 + Sigma dp1 Quattro, dp2 Quattro, dp3 Quattro, dp0 Quattro + Sinar eMotion 22, eMotion 54, eSpirit 65, eMotion 75, eVolution 75, Sinarback 54 + Sony A7 II, A7S, ILCA-77M2 (A77-II), ILCE-3000, ILCE-5000, ILCE-5100, ILCE-6000, ILCE-QX1, DSC-RX100III, DSLR-A560, NEX-VG20, NEX-VG30, NEX-VG900, IMX135-mipi 13mp, IMX135-QCOM, IMX072-mipi, RX100-IV, A7R-II, RX10-II + + * Fujifilm F700/S20Pro second frame support + + +2014-02-01 Alex Tutubalin + * Updated Oly E-M10 & Panasonic TZ60/61 color data + * Updated foveon SD9-14 white level + * Support for 1x1 BlackLevelRepeatDim + +2014-01-31 Alex Tutubalin + * imported dcraw 1.461: fixed error in BlackLevelDim handling + * Accurate work with pattern black-level (cblack[6+]) + * Support for Olympus E-M10 and Fujifilm X-T1 + * Adjusted possbile maximum value for Sigma SD9 small raws + +2014-01-27 Alex Tutubalin + * dcraw 1.460: Nikon D3300, Panasonic DMC-TZ61, Sony ILCE-5000 +2014-01-25 Alex Tutubalin + * PhaseOne IQ250 support (both compressed and uncompressed) +2014-01-21 Alex Tutubalin + * imgdata.params.sony_arw2_hack removed. + It always on for ARW2-files. + * New imgdata.params.sony_arw2_options processing flags + Values: + LIBRAW_SONYARW2_NONE - normal processing + LIBRAW_SONYARW2_BASEONLY - BASE pixels outputeed, delta pixels set to 0 + LIBRAW_SONYARW2_DELTAONLY - Delta pixels written to raw data, base pixels zeroed + LIBRAW_SONYARW2_DELTAZEROBASE - Only deltas written without base offset + +2014-01-20 Alex Tutubalin + * Imported dcraw 9.20: + - Support for DNG BlackLevelRepeatDim tags + - imgdata.color.cblack[] holds variable BlackLevel for DNG files (up to ~4k values) + - imgdata.params.use_camera_matrix is now ON by default. Set it to 3 if you want + to force use of DNG embedded matrix. + - Tone curve for Canon RMF format supported + - Color data for Canon C500 + * Additional camera support: + Alcatel 5035D + DJI 4384x3288 + Fujifilm F900EXR + Kodak 12MP + Matrix 4608x3288 + Nokia 1200x1600 + Olympus E-PL6 + Panasonic DMC-FZ7 2014-01-17 Alex Tutubalin * Camera support: diff -Nru libraw-0.16.2/clist2html.pl libraw-0.17.0/clist2html.pl --- libraw-0.16.2/clist2html.pl 1970-01-01 00:00:00.000000000 +0000 +++ libraw-0.17.0/clist2html.pl 2015-08-15 13:10:27.000000000 +0000 @@ -0,0 +1,54 @@ +#!/usr/bin/perl +use Data::Dumper; + +@makes=( "AgfaPhoto", "Canon", "Casio", "Digital Bolex", "Epson", "Fujifilm", "Imacon", + "Mamiya", "Minolta", "Motorola", "Kodak", "Konica", "Leica", "Hasselblad", + "Nikon", "Nokia", "Olympus", "Pentax", "Phase One", "Ricoh", + "Samsung", "Sigma", "Sinar", "Sony" ); + +MAINLOOP: +while(<>) +{ + chomp; + $cname = $_; + $cname=~s/^\s+//g; + $cname=~s/\s+$//g; + for my $camera (@makes) + { + if ($cname=~/\Q$camera\E\s+(.*)/) + { + + $model = $1; + push @{$cameralist->{$camera}},$model; + next MAINLOOP; + } + } + if($cname=~/(\S+)\s+(.*)/) + { + ($make,$model) = ($1,$2); + push @{$cameralist->{$make}},$model; + next MAINLOOP; + } + push @{$cameralist->{$make}},"NO MODEL"; + +} +my $havenx1=0; +print "
    \n"; +for my $make (sort keys %$cameralist) +{ + if( $#{$cameralist->{$make}} < 1) + { + print "
  • $make $cameralist->{$make}->[0]
  • \n"; + + } + else + { + print "
  • $make\n
      \n"; + for my $model (@{$cameralist->{$make}}) + { + print "
    • $model
    • \n"; + } + print "
    \n
  • \n"; + } +} +print "
\n"; diff -Nru libraw-0.16.2/cmake/data/libraw_config.h.cmake libraw-0.17.0/cmake/data/libraw_config.h.cmake --- libraw-0.16.2/cmake/data/libraw_config.h.cmake 2015-05-16 12:32:15.000000000 +0000 +++ libraw-0.17.0/cmake/data/libraw_config.h.cmake 1970-01-01 00:00:00.000000000 +0000 @@ -1,50 +0,0 @@ -/* -*- C++ -*- - * File: libraw_version.h - * Copyright 2008-2013 LibRaw LLC (info@libraw.org) - * Created: Mon Sept 8, 2008 - * - * LibRaw C++ interface - * - -LibRaw is free software; you can redistribute it and/or modify -it under the terms of the one of three licenses as you choose: - -1. GNU LESSER GENERAL PUBLIC LICENSE version 2.1 -(See the file LICENSE.LGPL provided in LibRaw distribution archive for details). - -2. COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0 -(See the file LICENSE.CDDL provided in LibRaw distribution archive for details). - -3. LibRaw Software License 27032010 - (See the file LICENSE.LibRaw.pdf provided in LibRaw distribution archive for details). - - */ - -#ifndef __LIBRAW_CONFIG_H -#define __LIBRAW_CONFIG_H - -/* Define to 1 if LibRaw have been compiled with DNG lossy codec support */ -#cmakedefine LIBRAW_USE_DNGLOSSYCODEC 1 - -/* Define to 1 if LibRaw have been compiled with OpenMP support */ -#cmakedefine LIBRAW_USE_OPENMP 1 - -/* Define to 1 if LibRaw have been compiled with LCMS support */ -#cmakedefine LIBRAW_USE_LCMS 1 - -/* Define to 1 if LibRaw have been compiled with RedCine codec support */ -#cmakedefine LIBRAW_USE_REDCINECODEC 1 - -/* Define to 1 if LibRaw have been compiled with RawSpeed codec support */ -#cmakedefine LIBRAW_USE_RAWSPEED 1 - -/* Define to 1 if LibRaw have been compiled with Demosaic pack GPL2 support */ -#cmakedefine LIBRAW_USE_DEMOSAIC_PACK_GPL2 1 - -/* Define to 1 if LibRaw have been compiled with Demosaic pack GPL3 support */ -#cmakedefine LIBRAW_USE_DEMOSAIC_PACK_GPL3 1 - -/* Define to 1 if LibRaw have been compiled with debug message from dcraw */ -#cmakedefine LIBRAW_USE_DCRAW_DEBUG 1 - -#endif diff -Nru libraw-0.16.2/cmake/data/libraw.lsm.cmake libraw-0.17.0/cmake/data/libraw.lsm.cmake --- libraw-0.16.2/cmake/data/libraw.lsm.cmake 2015-05-16 12:32:15.000000000 +0000 +++ libraw-0.17.0/cmake/data/libraw.lsm.cmake 1970-01-01 00:00:00.000000000 +0000 @@ -1,13 +0,0 @@ -Begin4 -Title: ${PROJECT_NAME} -Version: ${RAW_LIB_VERSION_STRING} -Entered-date: 2013-09-08 -Description: Raw image decoder library -Keywords: Raw image digital camera demosaicing decoding -Author: Copyright 2008-2013 LibRaw LLC (info@libraw.org) -Maintained-by: -Primary-site: http://www.libraw.org -Original-site: -Platforms: Linux and other Unices, MacOs-X, Win32 -Copying-policy: GPL -End diff -Nru libraw-0.16.2/cmake/data/libraw.pc.cmake libraw-0.17.0/cmake/data/libraw.pc.cmake --- libraw-0.16.2/cmake/data/libraw.pc.cmake 2015-05-16 12:32:15.000000000 +0000 +++ libraw-0.17.0/cmake/data/libraw.pc.cmake 1970-01-01 00:00:00.000000000 +0000 @@ -1,12 +0,0 @@ -prefix=@CMAKE_INSTALL_PREFIX@ -exec_prefix=${prefix} -libdir=${prefix}/lib -includedir=${prefix}/include/libraw - -Name: @PROJECT_NAME@ -Description: @PROJECT_NAME@ - Raw image decoder library (non-thread-safe) -URL: http://www.libraw.org -Requires: -Version: @RAW_LIB_VERSION_STRING@ -Libs: -L${libdir} -lraw -Cflags: -I${includedir}/libraw diff -Nru libraw-0.16.2/cmake/data/libraw_r.pc.cmake libraw-0.17.0/cmake/data/libraw_r.pc.cmake --- libraw-0.16.2/cmake/data/libraw_r.pc.cmake 2015-05-16 12:32:15.000000000 +0000 +++ libraw-0.17.0/cmake/data/libraw_r.pc.cmake 1970-01-01 00:00:00.000000000 +0000 @@ -1,12 +0,0 @@ -prefix=@CMAKE_INSTALL_PREFIX@ -exec_prefix=${prefix} -libdir=${prefix}/lib -includedir=${prefix}/include/libraw - -Name: @PROJECT_NAME@ -Description: @PROJECT_NAME@ - Raw image decoder library (thread-safe) -URL: http://www.libraw.org -Requires: -Version: @RAW_LIB_VERSION_STRING@ -Libs: -L${libdir} -lraw_r -Cflags: -I${includedir}/libraw diff -Nru libraw-0.16.2/cmake/modules/FindLCMS2.cmake libraw-0.17.0/cmake/modules/FindLCMS2.cmake --- libraw-0.16.2/cmake/modules/FindLCMS2.cmake 2015-05-16 12:32:15.000000000 +0000 +++ libraw-0.17.0/cmake/modules/FindLCMS2.cmake 1970-01-01 00:00:00.000000000 +0000 @@ -1,72 +0,0 @@ -# - Find LCMS2 -# Find the LCMS2 includes and library -# This module defines -# LCMS2_INCLUDE_DIR, where to find lcms.h -# LCMS2_LIBRARIES, the libraries needed to use LCMS2. -# LCMS2_VERSION, The value of LCMS_VERSION defined in lcms.h -# LCMS2_FOUND, If false, do not try to use LCMS2. - - -# Copyright (c) 2008, Adrian Page, -# Copyright (c) 2009, Cyrille Berger, -# -# Redistribution and use is allowed according to the terms of the BSD license. -# For details see the accompanying COPYING-CMAKE-SCRIPTS file. - - -# use pkg-config to get the directories and then use these values -# in the FIND_PATH() and FIND_LIBRARY() calls -if(NOT WIN32) - find_package(PkgConfig) - pkg_check_modules(PC_LCMS2 lcms2) - set(LCMS2_DEFINITIONS ${PC_LCMS2_CFLAGS_OTHER}) -endif(NOT WIN32) - -find_path(LCMS2_INCLUDE_DIR lcms2.h - PATHS - ${PC_LCMS2_INCLUDEDIR} - ${PC_LCMS2_INCLUDE_DIRS} - PATH_SUFFIXES lcms2 liblcms2 -) - -find_library(LCMS2_LIBRARIES NAMES lcms2 liblcms2 lcms-2 liblcms-2 - PATHS - ${PC_LCMS2_LIBDIR} - ${PC_LCMS2_LIBRARY_DIRS} - PATH_SUFFIXES lcms2 -) - -if(LCMS2_INCLUDE_DIR AND LCMS2_LIBRARIES) - set(LCMS2_FOUND TRUE) -else(LCMS2_INCLUDE_DIR AND LCMS2_LIBRARIES) - set(LCMS2_FOUND FALSE) -endif(LCMS2_INCLUDE_DIR AND LCMS2_LIBRARIES) - -if(LCMS2_FOUND) - file(READ ${LCMS2_INCLUDE_DIR}/lcms2.h LCMS2_VERSION_CONTENT) - string(REGEX MATCH "#define LCMS_VERSION[ ]*[0-9]*\n" LCMS2_VERSION_MATCH ${LCMS2_VERSION_CONTENT}) - if(LCMS2_VERSION_MATCH) - string(REGEX REPLACE "#define LCMS_VERSION[ ]*([0-9]*)\n" "\\1" LCMS2_VERSION ${LCMS2_VERSION_MATCH}) - if(NOT LCMS2_FIND_QUIETLY) - string(SUBSTRING ${LCMS2_VERSION} 0 1 LCMS2_MAJOR_VERSION) - string(SUBSTRING ${LCMS2_VERSION} 1 2 LCMS2_MINOR_VERSION) - message(STATUS "Found lcms version ${LCMS2_MAJOR_VERSION}.${LCMS2_MINOR_VERSION}, ${LCMS2_LIBRARIES}") - endif(NOT LCMS2_FIND_QUIETLY) - else(LCMS2_VERSION_MATCH) - if(NOT LCMS2_FIND_QUIETLY) - message(STATUS "Found lcms2 but failed to find version ${LCMS2_LIBRARIES}") - endif(NOT LCMS2_FIND_QUIETLY) - set(LCMS2_VERSION NOTFOUND) - endif(LCMS2_VERSION_MATCH) -else(LCMS2_FOUND) - if(NOT LCMS2_FIND_QUIETLY) - if(LCMS2_FIND_REQUIRED) - message(FATAL_ERROR "Required package lcms2 NOT found") - else(LCMS2_FIND_REQUIRED) - message(STATUS "lcms2 NOT found") - endif(LCMS2_FIND_REQUIRED) - endif(NOT LCMS2_FIND_QUIETLY) -endif(LCMS2_FOUND) - -mark_as_advanced(LCMS2_INCLUDE_DIR LCMS2_LIBRARIES LCMS2_VERSION) - diff -Nru libraw-0.16.2/cmake/modules/FindLCMS.cmake libraw-0.17.0/cmake/modules/FindLCMS.cmake --- libraw-0.16.2/cmake/modules/FindLCMS.cmake 2015-05-16 12:32:15.000000000 +0000 +++ libraw-0.17.0/cmake/modules/FindLCMS.cmake 1970-01-01 00:00:00.000000000 +0000 @@ -1,60 +0,0 @@ -# - Find LCMS -# Find the LCMS (Little Color Management System) library and includes and -# This module defines -# LCMS_INCLUDE_DIR, where to find lcms.h -# LCMS_LIBRARIES, the libraries needed to use LCMS. -# LCMS_DOT_VERSION, The version number of the LCMS library, e.g. "1.19" -# LCMS_VERSION, Similar to LCMS_DOT_VERSION, but without the dots, e.g. "119" -# LCMS_FOUND, If false, do not try to use LCMS. -# -# The minimum required version of LCMS can be specified using the -# standard syntax, e.g. find_package(LCMS 1.10) - -# Copyright (c) 2008, Adrian Page, -# Copyright (c) 2009, Cyrille Berger, -# -# Redistribution and use is allowed according to the terms of the BSD license. -# For details see the accompanying COPYING-CMAKE-SCRIPTS file. - - -# use pkg-config to get the directories and then use these values -# in the FIND_PATH() and FIND_LIBRARY() calls -if(NOT WIN32) - find_package(PkgConfig) - pkg_check_modules(PC_LCMS lcms) - set(LCMS_DEFINITIONS ${PC_LCMS_CFLAGS_OTHER}) -endif(NOT WIN32) - -find_path(LCMS_INCLUDE_DIR lcms.h - HINTS - ${PC_LCMS_INCLUDEDIR} - ${PC_LCMS_INCLUDE_DIRS} - PATH_SUFFIXES lcms liblcms1 -) - -find_library(LCMS_LIBRARIES NAMES lcms liblcms lcms-1 liblcms-1 - HINTS - ${PC_LCMS_LIBDIR} - ${PC_LCMS_LIBRARY_DIRS} - PATH_SUFFIXES lcms -) - -# Store the LCMS version number in the cache, so we don't have to search every time again -if(LCMS_INCLUDE_DIR AND NOT LCMS_VERSION) - file(READ ${LCMS_INCLUDE_DIR}/lcms.h LCMS_VERSION_CONTENT) - string(REGEX MATCH "#define LCMS_VERSION[ ]*[0-9]*\n" LCMS_VERSION_MATCH ${LCMS_VERSION_CONTENT}) - if(LCMS_VERSION_MATCH) - string(REGEX REPLACE "#define LCMS_VERSION[ ]*([0-9]*)\n" "\\1" _LCMS_VERSION ${LCMS_VERSION_MATCH}) - string(SUBSTRING ${_LCMS_VERSION} 0 1 LCMS_MAJOR_VERSION) - string(SUBSTRING ${_LCMS_VERSION} 1 2 LCMS_MINOR_VERSION) - endif(LCMS_VERSION_MATCH) - set(LCMS_VERSION "${LCMS_MAJOR_VERSION}${LCMS_MINOR_VERSION}" CACHE STRING "Version number of lcms" FORCE) - set(LCMS_DOT_VERSION "${LCMS_MAJOR_VERSION}.${LCMS_MINOR_VERSION}" CACHE STRING "Version number of lcms split into components" FORCE) -endif(LCMS_INCLUDE_DIR AND NOT LCMS_VERSION) - -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(LCMS REQUIRED_VARS LCMS_LIBRARIES LCMS_INCLUDE_DIR - VERSION_VAR LCMS_DOT_VERSION ) - -mark_as_advanced(LCMS_INCLUDE_DIR LCMS_LIBRARIES LCMS_VERSION) - diff -Nru libraw-0.16.2/cmake/modules/FindLibRaw.cmake libraw-0.17.0/cmake/modules/FindLibRaw.cmake --- libraw-0.16.2/cmake/modules/FindLibRaw.cmake 2015-05-16 12:32:15.000000000 +0000 +++ libraw-0.17.0/cmake/modules/FindLibRaw.cmake 1970-01-01 00:00:00.000000000 +0000 @@ -1,79 +0,0 @@ -# - Find LibRaw -# Find the LibRaw library -# This module defines -# LibRaw_VERSION_STRING, the version string of LibRaw -# LibRaw_INCLUDE_DIR, where to find libraw.h -# LibRaw_LIBRARIES, the libraries needed to use LibRaw (non-thread-safe) -# LibRaw_r_LIBRARIES, the libraries needed to use LibRaw (thread-safe) -# LibRaw_DEFINITIONS, the definitions needed to use LibRaw (non-thread-safe) -# LibRaw_r_DEFINITIONS, the definitions needed to use LibRaw (thread-safe) -# -# Copyright (c) 2013, Pino Toscano -# Copyright (c) 2013, Gilles Caulier -# -# Redistribution and use is allowed according to the terms of the BSD license. -# For details see the accompanying COPYING-CMAKE-SCRIPTS file. - -FIND_PACKAGE(PkgConfig) - -IF(PKG_CONFIG_FOUND) - PKG_CHECK_MODULES(PC_LIBRAW libraw) - SET(LibRaw_DEFINITIONS ${PC_LIBRAW_CFLAGS_OTHER}) - - PKG_CHECK_MODULES(PC_LIBRAW_R libraw_r) - SET(LibRaw_r_DEFINITIONS ${PC_LIBRAW_R_CFLAGS_OTHER}) -ENDIF() - -FIND_PATH(LibRaw_INCLUDE_DIR libraw.h - HINTS - ${PC_LIBRAW_INCLUDEDIR} - ${PC_LibRaw_INCLUDE_DIRS} - PATH_SUFFIXES libraw - ) - -FIND_LIBRARY(LibRaw_LIBRARIES NAMES raw - HINTS - ${PC_LIBRAW_LIBDIR} - ${PC_LIBRAW_LIBRARY_DIRS} - ) - -FIND_LIBRARY(LibRaw_r_LIBRARIES NAMES raw_r - HINTS - ${PC_LIBRAW_R_LIBDIR} - ${PC_LIBRAW_R_LIBRARY_DIRS} - ) - -IF(LibRaw_INCLUDE_DIR) - FILE(READ ${LibRaw_INCLUDE_DIR}/libraw_version.h _libraw_version_content) - - STRING(REGEX MATCH "#define LIBRAW_MAJOR_VERSION[ \t]*([0-9]*)\n" _version_major_match ${_libraw_version_content}) - SET(_libraw_version_major "${CMAKE_MATCH_1}") - - STRING(REGEX MATCH "#define LIBRAW_MINOR_VERSION[ \t]*([0-9]*)\n" _version_minor_match ${_libraw_version_content}) - SET(_libraw_version_minor "${CMAKE_MATCH_1}") - - STRING(REGEX MATCH "#define LIBRAW_PATCH_VERSION[ \t]*([0-9]*)\n" _version_patch_match ${_libraw_version_content}) - SET(_libraw_version_patch "${CMAKE_MATCH_1}") - - IF(_version_major_match AND _version_minor_match AND _version_patch_match) - SET(LibRaw_VERSION_STRING "${_libraw_version_major}.${_libraw_version_minor}.${_libraw_version_patch}") - ELSE() - IF(NOT LibRaw_FIND_QUIETLY) - MESSAGE(STATUS "Failed to get version information from ${LibRaw_INCLUDE_DIR}/libraw_version.h") - ENDIF() - ENDIF() -ENDIF() - -INCLUDE(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibRaw - REQUIRED_VARS LibRaw_LIBRARIES LibRaw_INCLUDE_DIR - VERSION_VAR LibRaw_VERSION_STRING - ) - -MARK_AS_ADVANCED(LibRaw_VERSION_STRING - LibRaw_INCLUDE_DIR - LibRaw_LIBRARIES - LibRaw_r_LIBRARIES - LibRaw_DEFINITIONS - LibRaw_r_DEFINITIONS - ) diff -Nru libraw-0.16.2/cmake/modules/FindPthreads.cmake libraw-0.17.0/cmake/modules/FindPthreads.cmake --- libraw-0.16.2/cmake/modules/FindPthreads.cmake 2015-05-16 12:32:15.000000000 +0000 +++ libraw-0.17.0/cmake/modules/FindPthreads.cmake 1970-01-01 00:00:00.000000000 +0000 @@ -1,98 +0,0 @@ -# - Find the Pthreads library -# This module searches for the Pthreads library (including the -# pthreads-win32 port). -# -# This module defines these variables: -# -# PTHREADS_FOUND -# True if the Pthreads library was found -# PTHREADS_LIBRARY -# The location of the Pthreads library -# PTHREADS_INCLUDE_DIR -# The include path of the Pthreads library -# PTHREADS_DEFINITIONS -# Preprocessor definitions to define -# -# This module responds to the PTHREADS_EXCEPTION_SCHEME -# variable on Win32 to allow the user to control the -# library linked against. The Pthreads-win32 port -# provides the ability to link against a version of the -# library with exception handling. IT IS NOT RECOMMENDED -# THAT YOU USE THIS because most POSIX thread implementations -# do not support stack unwinding. -# -# PTHREADS_EXCEPTION_SCHEME -# C = no exceptions (default) -# (NOTE: This is the default scheme on most POSIX thread -# implementations and what you should probably be using) -# CE = C++ Exception Handling -# SE = Structure Exception Handling (MSVC only) -# - -# -# Define a default exception scheme to link against -# and validate user choice. -# -IF(NOT DEFINED PTHREADS_EXCEPTION_SCHEME) - # Assign default if needed - SET(PTHREADS_EXCEPTION_SCHEME "C") -ELSE(NOT DEFINED PTHREADS_EXCEPTION_SCHEME) - # Validate - IF(NOT PTHREADS_EXCEPTION_SCHEME STREQUAL "C" AND - NOT PTHREADS_EXCEPTION_SCHEME STREQUAL "CE" AND - NOT PTHREADS_EXCEPTION_SCHEME STREQUAL "SE") - - MESSAGE(FATAL_ERROR "See documentation for FindPthreads.cmake, only C, CE, and SE modes are allowed") - - ENDIF(NOT PTHREADS_EXCEPTION_SCHEME STREQUAL "C" AND - NOT PTHREADS_EXCEPTION_SCHEME STREQUAL "CE" AND - NOT PTHREADS_EXCEPTION_SCHEME STREQUAL "SE") - - IF(NOT MSVC AND PTHREADS_EXCEPTION_SCHEME STREQUAL "SE") - MESSAGE(FATAL_ERROR "Structured Exception Handling is only allowed for MSVC") - ENDIF(NOT MSVC AND PTHREADS_EXCEPTION_SCHEME STREQUAL "SE") - -ENDIF(NOT DEFINED PTHREADS_EXCEPTION_SCHEME) - -# -# Find the header file -# -FIND_PATH(PTHREADS_INCLUDE_DIR pthread.h) - -# -# Find the library -# -SET(names) -IF(MSVC) - SET(names - pthreadV${PTHREADS_EXCEPTION_SCHEME}2 - pthread - ) -ELSEIF(MINGW) - SET(names - pthreadG${PTHREADS_EXCEPTION_SCHEME}2 - pthread - ) -ELSE(MSVC) # Unix / Cygwin / Apple - SET(names pthread) -ENDIF(MSVC) - -FIND_LIBRARY(PTHREADS_LIBRARY ${names} - DOC "The Portable Threads Library") - -IF(PTHREADS_INCLUDE_DIR AND PTHREADS_LIBRARY) - SET(PTHREADS_FOUND true) - SET(PTHREADS_DEFINITIONS -DHAVE_PTHREAD_H) - SET(PTHREADS_INCLUDE_DIRS ${PTHREADS_INCLUDE_DIR}) - SET(PTHREADS_LIBRARIES ${PTHREADS_LIBRARY}) -ENDIF(PTHREADS_INCLUDE_DIR AND PTHREADS_LIBRARY) - -IF(PTHREADS_FOUND) - IF(NOT PTHREADS_FIND_QUIETLY) - MESSAGE(STATUS "Found Pthreads: ${PTHREADS_LIBRARY}") - ENDIF(NOT PTHREADS_FIND_QUIETLY) -ELSE(PTHREADS_FOUND) - IF(PTHREADS_FIND_REQUIRED) - MESSAGE(FATAL_ERROR "Could not find the Pthreads Library") - ENDIF(PTHREADS_FIND_REQUIRED) -ENDIF(PTHREADS_FOUND) diff -Nru libraw-0.16.2/cmake/modules/MacroBoolTo01.cmake libraw-0.17.0/cmake/modules/MacroBoolTo01.cmake --- libraw-0.16.2/cmake/modules/MacroBoolTo01.cmake 2015-05-16 12:32:15.000000000 +0000 +++ libraw-0.17.0/cmake/modules/MacroBoolTo01.cmake 1970-01-01 00:00:00.000000000 +0000 @@ -1,20 +0,0 @@ -# MACRO_BOOL_TO_01( VAR RESULT0 ... RESULTN ) -# This macro evaluates its first argument -# and sets all the given vaiables either to 0 or 1 -# depending on the value of the first one - -# Copyright (c) 2006, Alexander Neundorf, -# -# Redistribution and use is allowed according to the terms of the BSD license. -# For details see the accompanying COPYING-CMAKE-SCRIPTS file. - - -MACRO(MACRO_BOOL_TO_01 FOUND_VAR ) - FOREACH (_current_VAR ${ARGN}) - IF(${FOUND_VAR}) - SET(${_current_VAR} 1) - ELSE(${FOUND_VAR}) - SET(${_current_VAR} 0) - ENDIF(${FOUND_VAR}) - ENDFOREACH(_current_VAR) -ENDMACRO(MACRO_BOOL_TO_01) diff -Nru libraw-0.16.2/cmake/modules/MacroLogFeature.cmake libraw-0.17.0/cmake/modules/MacroLogFeature.cmake --- libraw-0.16.2/cmake/modules/MacroLogFeature.cmake 2015-05-16 12:32:15.000000000 +0000 +++ libraw-0.17.0/cmake/modules/MacroLogFeature.cmake 1970-01-01 00:00:00.000000000 +0000 @@ -1,157 +0,0 @@ -# This file defines the Feature Logging macros. -# -# MACRO_LOG_FEATURE(VAR FEATURE DESCRIPTION URL [REQUIRED [MIN_VERSION [COMMENTS]]]) -# Logs the information so that it can be displayed at the end -# of the configure run -# VAR : TRUE or FALSE, indicating whether the feature is supported -# FEATURE: name of the feature, e.g. "libjpeg" -# DESCRIPTION: description what this feature provides -# URL: home page -# REQUIRED: TRUE or FALSE, indicating whether the feature is required -# MIN_VERSION: minimum version number. empty string if unneeded -# COMMENTS: More info you may want to provide. empty string if unnecessary -# -# MACRO_DISPLAY_FEATURE_LOG() -# Call this to display the collected results. -# Exits CMake with a FATAL error message if a required feature is missing -# -# Example: -# -# INCLUDE(MacroLogFeature) -# -# FIND_PACKAGE(JPEG) -# MACRO_LOG_FEATURE(JPEG_FOUND "libjpeg" "Support JPEG images" "http://www.ijg.org" TRUE "3.2a" "") -# ... -# MACRO_DISPLAY_FEATURE_LOG() - -# Copyright (c) 2006, Alexander Neundorf, -# Copyright (c) 2006, Allen Winter, -# Copyright (c) 2009, Sebastian Trueg, -# -# Redistribution and use is allowed according to the terms of the BSD license. -# For details see the accompanying COPYING-CMAKE-SCRIPTS file. - -IF (NOT _macroLogFeatureAlreadyIncluded) - SET(_file ${CMAKE_BINARY_DIR}/MissingRequirements.txt) - IF (EXISTS ${_file}) - FILE(REMOVE ${_file}) - ENDIF (EXISTS ${_file}) - - SET(_file ${CMAKE_BINARY_DIR}/EnabledFeatures.txt) - IF (EXISTS ${_file}) - FILE(REMOVE ${_file}) - ENDIF (EXISTS ${_file}) - - SET(_file ${CMAKE_BINARY_DIR}/DisabledFeatures.txt) - IF (EXISTS ${_file}) - FILE(REMOVE ${_file}) - ENDIF (EXISTS ${_file}) - - SET(_macroLogFeatureAlreadyIncluded TRUE) - - INCLUDE(FeatureSummary) - -ENDIF (NOT _macroLogFeatureAlreadyIncluded) - - -MACRO(MACRO_LOG_FEATURE _var _package _description _url ) # _required _minvers _comments) - - STRING(TOUPPER "${ARGV4}" _required) - SET(_minvers "${ARGV5}") - SET(_comments "${ARGV6}") - - IF (${_var}) - SET(_LOGFILENAME ${CMAKE_BINARY_DIR}/EnabledFeatures.txt) - ELSE (${_var}) - IF ("${_required}" STREQUAL "TRUE") - SET(_LOGFILENAME ${CMAKE_BINARY_DIR}/MissingRequirements.txt) - ELSE ("${_required}" STREQUAL "TRUE") - SET(_LOGFILENAME ${CMAKE_BINARY_DIR}/DisabledFeatures.txt) - ENDIF ("${_required}" STREQUAL "TRUE") - ENDIF (${_var}) - - SET(_logtext " * ${_package}") - - IF (NOT ${_var}) - IF (${_minvers} MATCHES ".*") - SET(_logtext "${_logtext} (${_minvers} or higher)") - ENDIF (${_minvers} MATCHES ".*") - SET(_logtext "${_logtext} <${_url}>\n ") - ELSE (NOT ${_var}) - SET(_logtext "${_logtext} - ") - ENDIF (NOT ${_var}) - - SET(_logtext "${_logtext}${_description}") - - IF (NOT ${_var}) - IF (${_comments} MATCHES ".*") - SET(_logtext "${_logtext}\n ${_comments}") - ENDIF (${_comments} MATCHES ".*") -# SET(_logtext "${_logtext}\n") #double-space missing features? - ENDIF (NOT ${_var}) - - FILE(APPEND "${_LOGFILENAME}" "${_logtext}\n") - - IF(COMMAND SET_PACKAGE_INFO) # in FeatureSummary.cmake since CMake 2.8.3 - SET_PACKAGE_INFO("${_package}" "\"${_description}\"" "${_url}" "\"${_comments}\"") - ENDIF(COMMAND SET_PACKAGE_INFO) - -ENDMACRO(MACRO_LOG_FEATURE) - - -MACRO(MACRO_DISPLAY_FEATURE_LOG) - IF(COMMAND FEATURE_SUMMARY) # in FeatureSummary.cmake since CMake 2.8.3 - FEATURE_SUMMARY(FILENAME ${CMAKE_CURRENT_BINARY_DIR}/FindPackageLog.txt - WHAT ALL) - ENDIF(COMMAND FEATURE_SUMMARY) - - SET(_missingFile ${CMAKE_BINARY_DIR}/MissingRequirements.txt) - SET(_enabledFile ${CMAKE_BINARY_DIR}/EnabledFeatures.txt) - SET(_disabledFile ${CMAKE_BINARY_DIR}/DisabledFeatures.txt) - - IF (EXISTS ${_missingFile} OR EXISTS ${_enabledFile} OR EXISTS ${_disabledFile}) - SET(_printSummary TRUE) - ENDIF (EXISTS ${_missingFile} OR EXISTS ${_enabledFile} OR EXISTS ${_disabledFile}) - - IF(_printSummary) - SET(_missingDeps 0) - IF (EXISTS ${_enabledFile}) - FILE(READ ${_enabledFile} _enabled) - FILE(REMOVE ${_enabledFile}) - SET(_summary "${_summary}\n-----------------------------------------------------------------------------\n-- The following external packages were located on your system.\n-- This installation will have the extra features provided by these packages.\n-----------------------------------------------------------------------------\n${_enabled}") - ENDIF (EXISTS ${_enabledFile}) - - - IF (EXISTS ${_disabledFile}) - SET(_missingDeps 1) - FILE(READ ${_disabledFile} _disabled) - FILE(REMOVE ${_disabledFile}) - SET(_summary "${_summary}\n-----------------------------------------------------------------------------\n-- The following OPTIONAL packages could NOT be located on your system.\n-- Consider installing them to enable more features from this software.\n-----------------------------------------------------------------------------\n${_disabled}") - ENDIF (EXISTS ${_disabledFile}) - - - IF (EXISTS ${_missingFile}) - SET(_missingDeps 1) - FILE(READ ${_missingFile} _requirements) - SET(_summary "${_summary}\n-----------------------------------------------------------------------------\n-- The following REQUIRED packages could NOT be located on your system.\n-- You must install these packages before continuing.\n-----------------------------------------------------------------------------\n${_requirements}") - FILE(REMOVE ${_missingFile}) - SET(_haveMissingReq 1) - ENDIF (EXISTS ${_missingFile}) - - - IF (NOT ${_missingDeps}) - SET(_summary "${_summary}\n-----------------------------------------------------------------------------\n-- Congratulations! All external packages have been found.") - ENDIF (NOT ${_missingDeps}) - - - MESSAGE(${_summary}) - MESSAGE("-----------------------------------------------------------------------------\n") - - - IF(_haveMissingReq) - MESSAGE(FATAL_ERROR "Exiting: Missing Requirements") - ENDIF(_haveMissingReq) - - ENDIF(_printSummary) - -ENDMACRO(MACRO_DISPLAY_FEATURE_LOG) diff -Nru libraw-0.16.2/cmake/modules/MacroOptionalFindPackage.cmake libraw-0.17.0/cmake/modules/MacroOptionalFindPackage.cmake --- libraw-0.16.2/cmake/modules/MacroOptionalFindPackage.cmake 2015-05-16 12:32:15.000000000 +0000 +++ libraw-0.17.0/cmake/modules/MacroOptionalFindPackage.cmake 1970-01-01 00:00:00.000000000 +0000 @@ -1,48 +0,0 @@ -# - MACRO_OPTIONAL_FIND_PACKAGE() combines FIND_PACKAGE() with an OPTION() -# MACRO_OPTIONAL_FIND_PACKAGE( [QUIT] ) -# This macro is a combination of OPTION() and FIND_PACKAGE(), it -# works like FIND_PACKAGE(), but additionally it automatically creates -# an option name WITH_, which can be disabled via the cmake GUI. -# or via -DWITH_=OFF -# The standard _FOUND variables can be used in the same way -# as when using the normal FIND_PACKAGE() - -# Copyright (c) 2006-2010 Alexander Neundorf, -# -# Redistribution and use is allowed according to the terms of the BSD license. -# For details see the accompanying COPYING-CMAKE-SCRIPTS file. - -# This is just a helper macro to set a bunch of variables empty. -# We don't know whether the package uses UPPERCASENAME or CamelCaseName, so we try both: -macro(_MOFP_SET_EMPTY_IF_DEFINED _name _var) - if(DEFINED ${_name}_${_var}) - set(${_name}_${_var} "") - endif(DEFINED ${_name}_${_var}) - - string(TOUPPER ${_name} _nameUpper) - if(DEFINED ${_nameUpper}_${_var}) - set(${_nameUpper}_${_var} "") - endif(DEFINED ${_nameUpper}_${_var}) -endmacro(_MOFP_SET_EMPTY_IF_DEFINED _package _var) - - -macro (MACRO_OPTIONAL_FIND_PACKAGE _name ) - option(WITH_${_name} "Search for ${_name} package" ON) - if (WITH_${_name}) - find_package(${_name} ${ARGN}) - else (WITH_${_name}) - string(TOUPPER ${_name} _nameUpper) - set(${_name}_FOUND FALSE) - set(${_nameUpper}_FOUND FALSE) - - _mofp_set_empty_if_defined(${_name} INCLUDE_DIRS) - _mofp_set_empty_if_defined(${_name} INCLUDE_DIR) - _mofp_set_empty_if_defined(${_name} INCLUDES) - _mofp_set_empty_if_defined(${_name} LIBRARY) - _mofp_set_empty_if_defined(${_name} LIBRARIES) - _mofp_set_empty_if_defined(${_name} LIBS) - _mofp_set_empty_if_defined(${_name} FLAGS) - _mofp_set_empty_if_defined(${_name} DEFINITIONS) - endif (WITH_${_name}) -endmacro (MACRO_OPTIONAL_FIND_PACKAGE) - diff -Nru libraw-0.16.2/cmake/modules/Uninstall.cmake libraw-0.17.0/cmake/modules/Uninstall.cmake --- libraw-0.16.2/cmake/modules/Uninstall.cmake 2015-05-16 12:32:15.000000000 +0000 +++ libraw-0.17.0/cmake/modules/Uninstall.cmake 1970-01-01 00:00:00.000000000 +0000 @@ -1,22 +0,0 @@ -IF(NOT EXISTS "@CMAKE_BINARY_DIR@/install_manifest.txt") - MESSAGE(FATAL_ERROR "Cannot find install manifest: \"@CMAKE_BINARY_DIR@/install_manifest.txt\"") -ENDIF(NOT EXISTS "@CMAKE_BINARY_DIR@/install_manifest.txt") - -FILE(READ "@CMAKE_BINARY_DIR@/install_manifest.txt" files) -STRING(REGEX REPLACE "\n" ";" files "${files}") -FOREACH(file ${files}) - MESSAGE(STATUS "Uninstalling \"${file}\"") - IF(EXISTS "${file}") - EXEC_PROGRAM( - "@CMAKE_COMMAND@" ARGS "-E remove \"${file}\"" - OUTPUT_VARIABLE rm_out - RETURN_VALUE rm_retval - ) - IF("${rm_retval}" STREQUAL 0) - ELSE("${rm_retval}" STREQUAL 0) - MESSAGE(FATAL_ERROR "Problem when removing \"${file}\"") - ENDIF("${rm_retval}" STREQUAL 0) - ELSE(EXISTS "${file}") - MESSAGE(STATUS "File \"${file}\" does not exist.") - ENDIF(EXISTS "${file}") -ENDFOREACH(file) diff -Nru libraw-0.16.2/CMakeLists.txt libraw-0.17.0/CMakeLists.txt --- libraw-0.16.2/CMakeLists.txt 2015-05-16 12:32:15.000000000 +0000 +++ libraw-0.17.0/CMakeLists.txt 1970-01-01 00:00:00.000000000 +0000 @@ -1,664 +0,0 @@ -# =========================================================== -# -# This file is a part of Libraw project -# http://www.libraw.org -# -# @date 2013-09-07 -# @brief Library for reading and processing of RAW images -# -# @author Copyright (C) 2013 by Gilles Caulier -# caulier dot gilles at gmail dot com -# -# This program is free software; you can redistribute it -# and/or modify it under the terms of the GNU General -# Public License as published by the Free Software Foundation; -# either version 2, or (at your option) -# any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# ============================================================ - -CMAKE_MINIMUM_REQUIRED(VERSION 2.6.3) - -PROJECT(libraw) - -# ================================================================================================== -# Library version info extraction - -FILE(READ ${CMAKE_CURRENT_SOURCE_DIR}/libraw/libraw_version.h _libraw_version_content) - -# API version strings -STRING(REGEX MATCH "#define LIBRAW_MAJOR_VERSION[ \t]*([0-9]*)\n" _version_major_match ${_libraw_version_content}) -SET(RAW_LIB_MAJOR_VERSION "${CMAKE_MATCH_1}") - -STRING(REGEX MATCH "#define LIBRAW_MINOR_VERSION[ \t]*([0-9]*)\n" _version_minor_match ${_libraw_version_content}) -SET(RAW_LIB_MINOR_VERSION "${CMAKE_MATCH_1}") - -STRING(REGEX MATCH "#define LIBRAW_PATCH_VERSION[ \t]*([0-9]*)\n" _version_patch_match ${_libraw_version_content}) -SET(RAW_LIB_PATCH_VERSION "${CMAKE_MATCH_1}") - -# ABI version strings - -STRING(REGEX MATCH "#define LIBRAW_SHLIB_CURRENT[ \t]*([0-9]*)\n" _version_socur_match ${_libraw_version_content}) -SET(RAW_LIB_SO_CUR_VERSION "${CMAKE_MATCH_1}") - -STRING(REGEX MATCH "#define LIBRAW_SHLIB_REVISION[ \t]*([0-9]*)\n" _version_sorev_match ${_libraw_version_content}) -SET(RAW_LIB_SO_REV_VERSION "${CMAKE_MATCH_1}") - -STRING(REGEX MATCH "#define LIBRAW_SHLIB_AGE[ \t]*([0-9]*)\n" _version_soage_match ${_libraw_version_content}) -SET(RAW_LIB_SO_AGE_VERSION "${CMAKE_MATCH_1}") - -# Set env. variables accordinly. -SET(RAW_LIB_VERSION_STRING "${RAW_LIB_MAJOR_VERSION}.${RAW_LIB_MINOR_VERSION}.${RAW_LIB_PATCH_VERSION}") -SET(RAW_LIB_VERSION_ID "0x${RAW_LIB_MAJOR_VERSION}${RAW_LIB_MINOR_VERSION}${RAW_LIB_PATCH_VERSION}") -SET(RAW_LIB_SO_VERSION_STRING "${RAW_LIB_SO_CUR_VERSION}.${RAW_LIB_SO_REV_VERSION}.${RAW_LIB_SO_AGE_VERSION}") - -MESSAGE(STATUS "LibRaw string version: ${RAW_LIB_VERSION_STRING}") -MESSAGE(STATUS "LibRaw ID version: ${RAW_LIB_VERSION_ID}") -MESSAGE(STATUS "LibRaw SO version: ${RAW_LIB_SO_VERSION_STRING}") - -# ================================================================================================== -# Project Options - -OPTION(ENABLE_OPENMP "Build library with OpenMP support (default=ON)" ON) -OPTION(ENABLE_LCMS "Build library with LCMS support (default=ON)" ON) -OPTION(ENABLE_EXAMPLES "Build library with sample command-line programs (default=ON)" ON) -OPTION(ENABLE_RAWSPEED "Build library with extra RawSpeed codec support (default=OFF)" OFF) -OPTION(ENABLE_DEMOSAIC_PACK_GPL2 "Build library with extra Demosaic pack GPL2 (default=OFF)" OFF) -OPTION(ENABLE_DEMOSAIC_PACK_GPL3 "Build library with extra Demosaic pack GPL3 (default=OFF)" OFF) -OPTION(ENABLE_DCRAW_DEBUG "Build library with debug message from dcraw (default=OFF)" OFF) - -SET(DEMOSAIC_PACK_GPL2_RPATH "LibRaw-demosaic-pack-GPL2-${RAW_LIB_VERSION_STRING}" CACHE STRING - "Relavive path to extra Demosaic pack GPL2 (default=LibRaw-demosaic-pack-GPL2-M.m.p)") - -SET(DEMOSAIC_PACK_GPL3_RPATH "LibRaw-demosaic-pack-GPL3-${RAW_LIB_VERSION_STRING}" CACHE STRING - "Relavive path to extra Demosaic pack GPL3 (default=LibRaw-demosaic-pack-GPL3-M.m.p)") - -SET(RAWSPEED_RPATH "RawSpeed" CACHE STRING - "Relavive path to extra RawSpeed codec (default=RawSpeed)") - -SET(DEMOSAIC_PACK_GPL2_PATH "${CMAKE_CURRENT_SOURCE_DIR}/${DEMOSAIC_PACK_GPL2_RPATH}") -SET(DEMOSAIC_PACK_GPL3_PATH "${CMAKE_CURRENT_SOURCE_DIR}/${DEMOSAIC_PACK_GPL3_RPATH}") -SET(RAWSPEED_PATH "${CMAKE_CURRENT_SOURCE_DIR}/${RAWSPEED_RPATH}") - -# ================================================================================================== -# General definitions rules - -SET(LIB_SUFFIX "" CACHE STRING "Define suffix of lib directory name (32/64)" ) - -# To prevent warnings from M$ compiler -IF(WIN32 AND MSVC) - ADD_DEFINITIONS(-D_CRT_SECURE_NO_WARNINGS) - ADD_DEFINITIONS(-D_ATL_SECURE_NO_WARNINGS) - ADD_DEFINITIONS(-D_AFX_SECURE_NO_WARNINGS) -ENDIF() - -# Under Windows, use specific flag to compile. -IF(WIN32) - ADD_DEFINITIONS(-DDJGPP) -ENDIF() - -# -- Check dependencies -------------------------------------------------------------------------------- - -SET(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules ${CMAKE_MODULE_PATH} ) - -INCLUDE(MacroBoolTo01) -INCLUDE(MacroLogFeature) -INCLUDE(MacroOptionalFindPackage) - -# Math library check - -IF(NOT WIN32) - FIND_LIBRARY(MATH_LIBRARY m) -ENDIF() - -# LCMS version 1 and 2 library check - -SET(LCMS_SUPPORT_CAN_BE_COMPILED false) - -IF (ENABLE_LCMS) - MESSAGE(STATUS "Check for LCMS1 availability...") - FIND_PACKAGE(LCMS) - IF (LCMS_FOUND) - MESSAGE(STATUS "Found LCMS1: ${LCMS_LIBRARIES} ${LCMS_INCLUDE_DIR}") - INCLUDE_DIRECTORIES(${LCMS_INCLUDE_DIR}) - MACRO_LOG_FEATURE(LCMS_FOUND "LCMS1" "A small-footprint color management engine" "http://www.littlecms.com" TRUE "" "Needed by libkdcraw") - # Flag to compile Little CMS version 1 with LibRaw - ADD_DEFINITIONS(-DUSE_LCMS) - # For compatibility - SET(LCMS2_LIBRARIES ${LCMS_LIBRARIES}) - SET(LCMS_SUPPORT_CAN_BE_COMPILED true) - ELSE () - MESSAGE(STATUS "Check for LCMS2 availability instead LCMS1...") - FIND_PACKAGE(LCMS2) - IF (LCMS2_FOUND AND (LCMS2_VERSION VERSION_EQUAL 2.1 OR LCMS2_VERSION VERSION_GREATER 2.1)) - MESSAGE(STATUS "Found LCMS2 instead LCMS1: ${LCMS2_LIBRARIES} ${LCMS2_INCLUDE_DIR}") - INCLUDE_DIRECTORIES(${LCMS2_INCLUDE_DIR}) - MACRO_LOG_FEATURE(LCMS2_FOUND "LCMS2" "A small-footprint color management engine" "http://www.littlecms.com" FALSE "" "Needed by libkdcraw") - # Flag to compile Little CMS version 2 with LibRaw - ADD_DEFINITIONS(-DUSE_LCMS2) - SET(LCMS_SUPPORT_CAN_BE_COMPILED true) - ENDIF () - ENDIF () -ENDIF() - -# For registration to libraw_config.h -MACRO_BOOL_TO_01(LCMS_SUPPORT_CAN_BE_COMPILED LIBRAW_USE_LCMS) - -# JPEG library check - -FIND_PACKAGE(JPEG) -IF(JPEG_FOUND) - # check version of libjpeg - # inspired from digikam/CMakeLists.txt - SET(_jpeglib_version_source "#include \n#include\n#include \n int main()\n {\n #if (JPEG_LIB_VERSION >= 80) \n #error JPEG_LIB_VERSION >= 80 found \n #endif \n }\n") - SET(_jpeglib_version_source_file ${CMAKE_BINARY_DIR}/CMakeTmp/cmake_jpeglib_version_check.cpp) - FILE(WRITE "${_jpeglib_version_source_file}" "${_jpeglib_version_source}") - SET(_jpeglib_version_include_dirs "-DINCLUDE_DIRECTORIES:STRING=${JPEG_INCLUDE_DIR}") - - TRY_COMPILE(_jpeglib_version_compile_result ${CMAKE_BINARY_DIR} ${_jpeglib_version_source_file} - CMAKE_FLAGS "${_jpeglib_version_include_dirs}" - ) - IF(_jpeglib_version_compile_result) - MESSAGE(STATUS "Identified libjpeg version less than 80 (too low)") - SET(JPEG_FOUND FALSE) - ENDIF() -ENDIF() - -MACRO_LOG_FEATURE(JPEG_FOUND "libjpeg" "JPEG image format support" "http://www.ijg.org" FALSE "80" "needed for the LibRaw DNG lossy codec") - -# Flag to use libjpeg with LibRaw DNG lossy codec -IF(JPEG_FOUND) - ADD_DEFINITIONS(-DUSE_JPEG) - ADD_DEFINITIONS(-DUSE_JPEG8) - INCLUDE_DIRECTORIES(${JPEG_INCLUDE_DIR}) -ENDIF() - -# For registration to libraw_config.h -MACRO_BOOL_TO_01(JPEG_FOUND LIBRAW_USE_DNGLOSSYCODEC) - -# OpenMP library check - -SET(OPENMP_FOUND false) - -IF(ENABLE_OPENMP) - # OpenMP library detection (requires CMake >= 2.6.3) - # NOTE: OpenMP under MacOSX do not support multithreading. - - IF(NOT APPLE) - MACRO_OPTIONAL_FIND_PACKAGE(OpenMP) - - IF(OPENMP_FOUND) - SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}") - IF("${OpenMP_CXX_FLAGS}" STREQUAL "-fopenmp") - SET(OPENMP_LDFLAGS "-lgomp") - ENDIF() - IF("${OpenMP_CXX_FLAGS}" STREQUAL "-xopenmp") - SET(OPENMP_LDFLAGS "-xopenmp") - ENDIF() - ENDIF() - ENDIF() -ENDIF() - -# For registration to libraw_config.h -MACRO_BOOL_TO_01(OPENMP_FOUND LIBRAW_USE_OPENMP) - -# Jasper library check - -FIND_PACKAGE(Jasper) - -# Flag to use libjasper with LibRaw RedCine codec -IF(JASPER_FOUND) - ADD_DEFINITIONS(-DUSE_JASPER) - INCLUDE_DIRECTORIES(${JASPER_INCLUDE_DIR}) -ENDIF() - -# For registration to libraw_config.h -MACRO_BOOL_TO_01(JASPER_FOUND LIBRAW_USE_REDCINECODEC) - -# For RawSpeed Codec Support - -SET(RAWSPEED_FOUND false) -SET(RAWSPEED_SUPPORT_CAN_BE_COMPILED false) - -IF(ENABLE_RAWSPEED) - - FIND_PACKAGE(LibXml2) - FIND_PACKAGE(Pthreads) - - MESSAGE(STATUS "RawSpeed codec path: ${RAWSPEED_PATH}") - - IF(EXISTS "${RAWSPEED_PATH}/Common.cpp") - SET(RAWSPEED_FOUND true) - ELSE() - MESSAGE(STATUS "RawSpeed source code not found. Please checkout source code from RawStudio project website.") - ENDIF() - - IF(ENABLE_RAWSPEED AND RAWSPEED_FOUND AND JPEG_FOUND AND LIBXML2_FOUND AND PTHREADS_FOUND) - - SET(RAWSPEED_SUPPORT_CAN_BE_COMPILED true) - - ELSE() - IF (NOT JPEG_FOUND) - MESSAGE(STATUS "LibJPEG dependency not resolved. LibRaw cannot be compiled with RawSpeed codec") - ENDIF() - - IF (NOT LIBXML2_FOUND) - MESSAGE(STATUS "LibXML2 dependency not resolved. LibRaw cannot be compiled with RawSpeed codec") - ENDIF() - - IF (NOT PTHREADS_FOUND) - MESSAGE(STATUS "Pthreads dependency not resolved. LibRaw cannot be compiled with RawSpeed codec") - ENDIF() - - ENDIF() -ENDIF() - -# For registration to libraw_config.h -MACRO_BOOL_TO_01(RAWSPEED_SUPPORT_CAN_BE_COMPILED LIBRAW_USE_RAWSPEED) - -# -- Compilation rules for RawSpeed library ------------------------------------------------------------- - -IF(RAWSPEED_SUPPORT_CAN_BE_COMPILED) - - INCLUDE_DIRECTORIES(${RAWSPEED_PATH}) - - INCLUDE_DIRECTORIES(${LIBXML2_INCLUDE_DIR} ${PTHREADS_INCLUDE_DIR}) - - # Flag to include RawSpeed codec with Libraw - ADD_DEFINITIONS(-DUSE_RAWSPEED) - - ADD_DEFINITIONS(${LIBXML2_DEFINITIONS} ${PTHREADS_DEFINITIONS}) - - SET(librawspeed_LIB_SRCS ${RAWSPEED_PATH}/ArwDecoder.cpp - ${RAWSPEED_PATH}/BitPumpJPEG.cpp - ${RAWSPEED_PATH}/BitPumpMSB.cpp - ${RAWSPEED_PATH}/BitPumpMSB32.cpp - ${RAWSPEED_PATH}/BitPumpPlain.cpp - ${RAWSPEED_PATH}/BlackArea.cpp - ${RAWSPEED_PATH}/ByteStream.cpp - ${RAWSPEED_PATH}/ByteStreamSwap.cpp - ${RAWSPEED_PATH}/Camera.cpp - ${RAWSPEED_PATH}/CameraMetaData.cpp - ${RAWSPEED_PATH}/CameraMetadataException.cpp - ${RAWSPEED_PATH}/CameraSensorInfo.cpp - ${RAWSPEED_PATH}/ColorFilterArray.cpp - ${RAWSPEED_PATH}/Common.cpp - ${RAWSPEED_PATH}/Cr2Decoder.cpp - ${RAWSPEED_PATH}/DngDecoder.cpp - ${RAWSPEED_PATH}/DngDecoderSlices.cpp - ${RAWSPEED_PATH}/DngOpcodes.cpp - ${RAWSPEED_PATH}/FileIOException.cpp - ${RAWSPEED_PATH}/FileMap.cpp - ${RAWSPEED_PATH}/IOException.cpp - ${RAWSPEED_PATH}/LJpegDecompressor.cpp - ${RAWSPEED_PATH}/LJpegPlain.cpp - ${RAWSPEED_PATH}/NefDecoder.cpp - ${RAWSPEED_PATH}/NikonDecompressor.cpp - ${RAWSPEED_PATH}/OrfDecoder.cpp - ${RAWSPEED_PATH}/PefDecoder.cpp - ${RAWSPEED_PATH}/PentaxDecompressor.cpp - ${RAWSPEED_PATH}/RawDecoder.cpp - ${RAWSPEED_PATH}/RawDecoderException.cpp - ${RAWSPEED_PATH}/RawImage.cpp - ${RAWSPEED_PATH}/RawImageDataFloat.cpp - ${RAWSPEED_PATH}/RawImageDataU16.cpp - ${RAWSPEED_PATH}/RawParser.cpp - ${RAWSPEED_PATH}/Rw2Decoder.cpp - ${RAWSPEED_PATH}/SrwDecoder.cpp - ${RAWSPEED_PATH}/TiffEntry.cpp - ${RAWSPEED_PATH}/TiffEntryBE.cpp - ${RAWSPEED_PATH}/TiffIFD.cpp - ${RAWSPEED_PATH}/TiffIFDBE.cpp - ${RAWSPEED_PATH}/TiffParser.cpp - ${RAWSPEED_PATH}/TiffParserException.cpp - ${RAWSPEED_PATH}/TiffParserHeaderless.cpp - ${RAWSPEED_PATH}/TiffParserOlympus.cpp - ) - -ENDIF() - -# -- Common LibRaw library compilation rules ------------------------------------------------------------------ - -SET(DEMOSAIC_PACK_GPL2_SUPPORT_CAN_BE_COMPILED false) - -IF(ENABLE_DEMOSAIC_PACK_GPL2) - MESSAGE(STATUS "Demosaic pack GPL2 path: ${DEMOSAIC_PACK_GPL2_PATH}") - - IF(EXISTS "${DEMOSAIC_PACK_GPL2_PATH}/dcraw_foveon.c") - INCLUDE_DIRECTORIES(${DEMOSAIC_PACK_GPL2_PATH}) - # Flag to include demosaic pack GPL2 - ADD_DEFINITIONS(-DLIBRAW_DEMOSAIC_PACK_GPL2) - SET(DEMOSAIC_PACK_GPL2_SUPPORT_CAN_BE_COMPILED true) - ELSE() - MESSAGE(STATUS "Demosaic pack GPL2 source code not found. Please checkout source code from Libraw project website.") - ENDIF() -ENDIF() - -# For registration to libraw_config.h -MACRO_BOOL_TO_01(DEMOSAIC_PACK_GPL2_SUPPORT_CAN_BE_COMPILED LIBRAW_USE_DEMOSAIC_PACK_GPL2) - -SET(DEMOSAIC_PACK_GPL3_SUPPORT_CAN_BE_COMPILED false) - -IF(ENABLE_DEMOSAIC_PACK_GPL3) - MESSAGE(STATUS "Demosaic pack GPL3 path: ${DEMOSAIC_PACK_GPL3_PATH}") - - IF(EXISTS "${DEMOSAIC_PACK_GPL3_PATH}/green_equi.c") - INCLUDE_DIRECTORIES(${DEMOSAIC_PACK_GPL3_PATH}) - # Flag to include demosaic pack GPL3 - ADD_DEFINITIONS(-DLIBRAW_DEMOSAIC_PACK_GPL3) - SET(DEMOSAIC_PACK_GPL3_SUPPORT_CAN_BE_COMPILED true) - ELSE() - MESSAGE(STATUS "Demosaic pack GPL3 source code not found. Please checkout source code from Libraw project website.") - ENDIF() -ENDIF() - -# For registration to libraw_config.h -MACRO_BOOL_TO_01(DEMOSAIC_PACK_GPL3_SUPPORT_CAN_BE_COMPILED LIBRAW_USE_DEMOSAIC_PACK_GPL3) - -# Flag to add debug print on the console -IF(ENABLE_DCRAW_DEBUG) - ADD_DEFINITIONS(-DDCRAW_VERBOSE) -ENDIF() - -# For registration to libraw_config.h -MACRO_BOOL_TO_01(ENABLE_DCRAW_DEBUG LIBRAW_USE_DCRAW_DEBUG) - -# Flag to export library symbols -IF (WIN32) - ADD_DEFINITIONS(-DLIBRAW_BUILDLIB) -ENDIF() - -# Create a config header for client application. -CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/cmake/data/libraw_config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/libraw_config.h) - -INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}/ - ${CMAKE_CURRENT_SOURCE_DIR}/ - ) - -# -- Log messages about configuration ------------------------------------------------------------------ - -MESSAGE(STATUS "") -MESSAGE(STATUS "----------------------------------------------------------------------------------") -MESSAGE(STATUS " Libraw ${RAW_LIB_VERSION_STRING} configuration ") -MESSAGE(STATUS "") - -IF(OPENMP_FOUND) - MESSAGE(STATUS " Libraw will be compiled with OpenMP support .................. YES") -ELSE() - MESSAGE(STATUS " Libraw will be compiled with OpenMP support .................. NO") -ENDIF() - -IF(LCMS_SUPPORT_CAN_BE_COMPILED) - MESSAGE(STATUS " Libraw will be compiled with LCMS support .................... YES") -ELSE() - MESSAGE(STATUS " Libraw will be compiled with LCMS support .................... NO") -ENDIF() - -IF(ENABLE_EXAMPLES) - MESSAGE(STATUS " Libraw will be compiled with example command-line programs ... YES") -ELSE() - MESSAGE(STATUS " Libraw will be compiled with example command-line programs ... NO") -ENDIF() - -IF(JASPER_FOUND) - MESSAGE(STATUS " Libraw will be compiled with RedCine codec support ........... YES") -ELSE() - MESSAGE(STATUS " Libraw will be compiled with RedCine codec support ........... NO") -ENDIF() - -IF(JPEG_FOUND) - MESSAGE(STATUS " Libraw will be compiled with DNG lossy codec support ......... YES") -ELSE() - MESSAGE(STATUS " Libraw will be compiled with DNG lossy codec support ......... NO") -ENDIF() - -IF(DEMOSAIC_PACK_GPL2_SUPPORT_CAN_BE_COMPILED) - MESSAGE(STATUS " Libraw will be compiled with Demosaic Pack GPL2 support ...... YES") -ELSE() - MESSAGE(STATUS " Libraw will be compiled with Demosaic Pack GPL2 support ...... NO") -ENDIF() - -IF(DEMOSAIC_PACK_GPL3_SUPPORT_CAN_BE_COMPILED) - MESSAGE(STATUS " Libraw will be compiled with Demosaic Pack GPL3 support ...... YES") -ELSE() - MESSAGE(STATUS " Libraw will be compiled with Demosaic Pack GPL3 support ...... NO") -ENDIF() - -IF(RAWSPEED_SUPPORT_CAN_BE_COMPILED) - MESSAGE(STATUS " Libraw will be compiled with RawSpeed support ................ YES") -ELSE() - MESSAGE(STATUS " Libraw will be compiled with RawSpeed support ................ NO") -ENDIF() - -IF(ENABLE_DCRAW_DEBUG) - MESSAGE(STATUS " Libraw will be compiled with debug message from dcraw ........ YES") -ELSE() - MESSAGE(STATUS " Libraw will be compiled with debug message from dcraw ........ NO") -ENDIF() - -MESSAGE(STATUS "----------------------------------------------------------------------------------") -MESSAGE(STATUS "") - -# -- Dedicated libraw target which not support multi-threading --------------------------------------- - -SET(libraw_LIB_SRCS ${CMAKE_CURRENT_SOURCE_DIR}/internal/dcraw_common.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/internal/dcraw_fileio.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/internal/demosaic_packs.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/src/libraw_cxx.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/src/libraw_c_api.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/src/libraw_datastream.cpp - ) - -IF(RAWSPEED_SUPPORT_CAN_BE_COMPILED) - SET(libraw_LIB_SRCS ${libraw_LIB_SRCS} ${librawspeed_LIB_SRCS}) -ENDIF() - -# Disable compilation warnings from LibRaw. Just to be clear on the console. -# Add flag to not support re-entrancy. Faster but cannot be used in multi-threading. -# Adjust flag for static lib and 64 bits computers using -fPIC for GCC compiler -# Use O4 GCC compilation option to prevent artifacts with OpenMP -FOREACH(_curentfile ${libraw_LIB_SRCS}) - IF(WIN32 AND MSVC) - SET_SOURCE_FILES_PROPERTIES(${_curentfile} PROPERTIES COMPILE_FLAGS "-w -DLIBRAW_NOTHREADS") - ELSE() - SET_SOURCE_FILES_PROPERTIES(${_curentfile} PROPERTIES COMPILE_FLAGS "-w -DLIBRAW_NOTHREADS -fPIC -O4 ") - ENDIF() -ENDFOREACH(_curentfile ${libraw_LIB_SRCS}) - -ADD_LIBRARY(raw SHARED ${libraw_LIB_SRCS}) - -TARGET_LINK_LIBRARIES(raw ${MATH_LIBRARY}) - -IF(MINGW) - TARGET_LINK_LIBRARIES(raw ws2_32) -ENDIF() - -IF(OPENMP_FOUND) - TARGET_LINK_LIBRARIES(raw ${OPENMP_LDFLAGS}) -ENDIF() - -IF(LCMS_SUPPORT_CAN_BE_COMPILED) - TARGET_LINK_LIBRARIES(raw ${LCMS2_LIBRARIES}) -ENDIF() - -IF(JPEG_FOUND) - TARGET_LINK_LIBRARIES(raw ${JPEG_LIBRARY}) -ENDIF() - -IF(JASPER_FOUND) - TARGET_LINK_LIBRARIES(raw ${JASPER_LIBRARIES}) -ENDIF() - -IF(RAWSPEED_SUPPORT_CAN_BE_COMPILED) - TARGET_LINK_LIBRARIES(raw ${LIBXML2_LIBRARIES}) -ENDIF() - -SET_TARGET_PROPERTIES(raw PROPERTIES VERSION ${RAW_LIB_SO_VERSION_STRING}) -SET_TARGET_PROPERTIES(raw PROPERTIES SOVERSION ${RAW_LIB_SO_CUR_VERSION}) -SET_TARGET_PROPERTIES(raw PROPERTIES OUTPUT_NAME "raw") - -# -- Dedicated libraw target to support multi-threading --------------------------------------------- - -SET(libraw_r_LIB_SRCS ${libraw_LIB_SRCS}) - -FOREACH(_curentfile ${libraw_r_LIB_SRCS}) - IF(WIN32 AND MSVC) - SET_SOURCE_FILES_PROPERTIES(${_curentfile} PROPERTIES COMPILE_FLAGS "-w") - ELSE() - SET_SOURCE_FILES_PROPERTIES(${_curentfile} PROPERTIES COMPILE_FLAGS "-w -fPIC -O4") - ENDIF() -ENDFOREACH(_curentfile ${libraw_r_LIB_SRCS}) - -ADD_LIBRARY(raw_r SHARED ${libraw_r_LIB_SRCS}) - -TARGET_LINK_LIBRARIES(raw_r ${MATH_LIBRARY}) - -IF(MINGW) - TARGET_LINK_LIBRARIES(raw_r ws2_32) -ENDIF() - -IF(OPENMP_FOUND) - TARGET_LINK_LIBRARIES(raw_r ${OPENMP_LDFLAGS}) -ENDIF() - -IF(LCMS_SUPPORT_CAN_BE_COMPILED) - TARGET_LINK_LIBRARIES(raw_r ${LCMS2_LIBRARIES}) -ENDIF() - -IF(JPEG_FOUND) - TARGET_LINK_LIBRARIES(raw_r ${JPEG_LIBRARY}) -ENDIF() - -IF(JASPER_FOUND) - TARGET_LINK_LIBRARIES(raw_r ${JASPER_LIBRARIES}) -ENDIF() - -IF(RAWSPEED_SUPPORT_CAN_BE_COMPILED) - TARGET_LINK_LIBRARIES(raw_r ${LIBXML2_LIBRARIES} ${PTHREADS_LIBRARY}) -ENDIF() - -SET_TARGET_PROPERTIES(raw_r PROPERTIES VERSION ${RAW_LIB_SO_VERSION_STRING}) -SET_TARGET_PROPERTIES(raw_r PROPERTIES SOVERSION ${RAW_LIB_SO_CUR_VERSION}) -SET_TARGET_PROPERTIES(raw_r PROPERTIES OUTPUT_NAME "raw_r") - -# -- Files to install ------------------------------------------------------------------------------------- - -# Configure and install data file for packaging. -IF(NOT WIN32) - CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/cmake/data/libraw.pc.cmake ${CMAKE_CURRENT_BINARY_DIR}/libraw.pc @ONLY) - INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/libraw.pc DESTINATION lib${LIB_SUFFIX}/pkgconfig) - - CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/cmake/data/libraw_r.pc.cmake ${CMAKE_CURRENT_BINARY_DIR}/libraw_r.pc @ONLY) - INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/libraw_r.pc DESTINATION lib${LIB_SUFFIX}/pkgconfig) - - CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/cmake/data/libraw.lsm.cmake ${CMAKE_CURRENT_BINARY_DIR}/libraw.lsm) -ENDIF() - -# Install Shared header files. -INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/libraw/libraw.h - ${CMAKE_CURRENT_SOURCE_DIR}/libraw/libraw_alloc.h - ${CMAKE_CURRENT_SOURCE_DIR}/libraw/libraw_const.h - ${CMAKE_CURRENT_SOURCE_DIR}/libraw/libraw_datastream.h - ${CMAKE_CURRENT_SOURCE_DIR}/libraw/libraw_internal.h - ${CMAKE_CURRENT_SOURCE_DIR}/libraw/libraw_types.h - ${CMAKE_CURRENT_SOURCE_DIR}/libraw/libraw_version.h - ${CMAKE_CURRENT_BINARY_DIR}/libraw_config.h - DESTINATION include/libraw - COMPONENT Devel - ) - -# Install Shared binary files. -INSTALL(TARGETS raw - RUNTIME DESTINATION bin - LIBRARY DESTINATION lib${LIB_SUFFIX} - ARCHIVE DESTINATION lib${LIB_SUFFIX} - ) - -INSTALL(TARGETS raw_r - RUNTIME DESTINATION bin - LIBRARY DESTINATION lib${LIB_SUFFIX} - ARCHIVE DESTINATION lib${LIB_SUFFIX} - ) - -# Install find cmake script to the system for client applications. -INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules/FindLibRaw.cmake - DESTINATION ${CMAKE_ROOT}/Modules) - -# Install doc data files. -IF(NOT WIN32) - INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/COPYRIGHT - ${CMAKE_CURRENT_SOURCE_DIR}/LICENSE.CDDL - ${CMAKE_CURRENT_SOURCE_DIR}/LICENSE.LGPL - ${CMAKE_CURRENT_SOURCE_DIR}/LICENSE.LibRaw.pdf - ${CMAKE_CURRENT_SOURCE_DIR}/Changelog.txt - DESTINATION share/libraw - COMPONENT main - ) -ENDIF() - -# Uninstall rules -CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules/Uninstall.cmake ${CMAKE_BINARY_DIR}/cmake_uninstall.cmake COPYONLY) -ADD_CUSTOM_TARGET(uninstall "${CMAKE_COMMAND}" -P "${CMAKE_BINARY_DIR}/cmake_uninstall.cmake") - -# -- Compile LibRaw Examples -------------------------------------------------------------------------------- - -# add a small macro so that this is a bit cleaner -MACRO(LIBRAW_BUILD_SAMPLES) - - SET(_filename ${ARGV0}) - SET(_rawlib ${ARGV1}) - STRING(REPLACE "." ";" _temp ${_filename}) - LIST(GET _temp 0 _target) - - SET(${_target}_SRCS samples/${_filename}) - SET_SOURCE_FILES_PROPERTIES(${${_target}_SRCS} PROPERTIES COMPILE_FLAGS -w) - - ADD_EXECUTABLE(${_target} ${${_target}_SRCS}) - - TARGET_LINK_LIBRARIES(${_target} ${_rawlib}) - - IF(OPENMP_FOUND) - TARGET_LINK_LIBRARIES(${_target} ${OPENMP_LDFLAGS}) - ENDIF() - - IF (${_rawlib} MATCHES "raw_r") - TARGET_LINK_LIBRARIES(${_target} ${PTHREADS_LIBRARY}) - ENDIF() - - IF(WIN32) - TARGET_LINK_LIBRARIES(${_target} ws2_32) - ENDIF() - - INSTALL(TARGETS ${_target} - RUNTIME DESTINATION bin - LIBRARY DESTINATION lib${LIB_SUFFIX} - ARCHIVE DESTINATION lib${LIB_SUFFIX} - ) - -ENDMACRO(LIBRAW_BUILD_SAMPLES) - -IF(ENABLE_EXAMPLES) - - LIBRAW_BUILD_SAMPLES(simple_dcraw.cpp raw) - LIBRAW_BUILD_SAMPLES(mem_image.cpp raw) - LIBRAW_BUILD_SAMPLES(dcraw_emu.cpp raw) - LIBRAW_BUILD_SAMPLES(4channels.cpp raw) - LIBRAW_BUILD_SAMPLES(unprocessed_raw.cpp raw) - LIBRAW_BUILD_SAMPLES(raw-identify.cpp raw) - LIBRAW_BUILD_SAMPLES(multirender_test.cpp raw) - LIBRAW_BUILD_SAMPLES(postprocessing_benchmark.cpp raw) - - IF (PTHREADS_FOUND) - IF(WIN32) - LIBRAW_BUILD_SAMPLES(half_mt_win32.c raw_r) - ELSE() - LIBRAW_BUILD_SAMPLES(dcraw_half.c raw_r) - LIBRAW_BUILD_SAMPLES(half_mt.c raw_r) - ENDIF() - ENDIF() -ENDIF() diff -Nru libraw-0.16.2/COPYRIGHT libraw-0.17.0/COPYRIGHT --- libraw-0.16.2/COPYRIGHT 2015-05-16 12:32:15.000000000 +0000 +++ libraw-0.17.0/COPYRIGHT 2015-08-15 13:10:27.000000000 +0000 @@ -1,6 +1,6 @@ ** LibRaw: Raw images processing library ** -Copyright (C) 2008-2013 LibRaw LLC (http://www.libraw.org, info@libraw.org) +Copyright (C) 2008-2015 LibRaw LLC (http://www.libraw.org, info@libraw.org) LibRaw is free software; you can redistribute it and/or modify it under the terms of the one of three licenses as you choose: diff -Nru libraw-0.16.2/dcraw/dcraw.1.html libraw-0.17.0/dcraw/dcraw.1.html --- libraw-0.16.2/dcraw/dcraw.1.html 2015-05-16 12:32:15.000000000 +0000 +++ libraw-0.17.0/dcraw/dcraw.1.html 2015-08-15 13:10:27.000000000 +0000 @@ -2,7 +2,7 @@ Manpage of dcraw

dcraw

-Section: User Commands (1)
Updated: May 14, 2009
Index +Section: User Commands (1)
Updated: March 3, 2015
Index Return to Main Contents
@@ -193,11 +193,11 @@ if -w -is set, +is set or the photo is in DNG format, -M -otherwise. -This option only affects Olympus, Leaf, and Phase One cameras. +otherwise. Besides DNG, +this option only affects Olympus, Leaf, and Phase One cameras.
-o [0-5]
@@ -382,7 +382,7 @@

-These coordinates are before any cropping or rotation, so use +These coordinates are before any stretching or rotation, so use dcraw -j -t 0 to locate dead pixels. @@ -435,6 +435,6 @@ This document was created by man2html, using the manual pages.
-Time: 06:04:09 GMT, June 17, 2013 +Time: 01:29:54 GMT, April 11, 2015 diff -Nru libraw-0.16.2/dcraw/dcraw.c libraw-0.17.0/dcraw/dcraw.c --- libraw-0.16.2/dcraw/dcraw.c 2015-05-16 12:32:15.000000000 +0000 +++ libraw-0.17.0/dcraw/dcraw.c 2015-08-15 13:10:27.000000000 +0000 @@ -1,7 +1,7 @@ #ifndef IGNOREALL /* dcraw.c -- Dave Coffin's raw photo decoder - Copyright 1997-2013 by Dave Coffin, dcoffin a cybercom o net + Copyright 1997-2015 by Dave Coffin, dcoffin a cybercom o net This is a command-line ANSI C program to convert raw photos from any digital camera on any computer running any operating system. @@ -20,8 +20,8 @@ *If you have not modified dcraw.c in any way, a link to my homepage qualifies as "full source code". - $Revision: 1.456 $ - $Date: 2013/06/16 18:01:08 $ + $Revision: 1.475 $ + $Date: 2015/04/11 00:08:36 $ */ /*@out DEFINES #ifndef USE_JPEG @@ -35,7 +35,8 @@ #define NO_LCMS #define DCRAW_VERBOSE //@out DEFINES -#define DCRAW_VERSION "9.19" +#define DCRAW_VERSION "9.25" + #ifndef _GNU_SOURCE #define _GNU_SOURCE @@ -134,8 +135,8 @@ FILE *ifp, *ofp; short order; const char *ifname; -char *meta_data, xtrans[6][6]; -char cdesc[5], desc[512], make[64], model[64], model2[64], artist[64]; +char *meta_data, xtrans[6][6], xtrans_abs[6][6]; +char cdesc[5], desc[512], make[64], model[64], model2[64], artist[64],software[64]; float flash_used, canon_ev, iso_speed, shutter, aperture, focal_len; time_t timestamp; off_t strip_offset, data_offset; @@ -144,19 +145,19 @@ unsigned thumb_length, meta_length, profile_length; unsigned thumb_misc, *oprof, fuji_layout, shot_select=0, multi_out=0; unsigned tiff_nifds, tiff_samples, tiff_bps, tiff_compress; -unsigned black, cblack[4], maximum, mix_green, raw_color, zero_is_bad; +unsigned black, maximum, mix_green, raw_color, zero_is_bad; unsigned zero_after_ff, is_raw, dng_version, is_foveon, data_error; unsigned tile_width, tile_length, gpsdata[32], load_flags; unsigned flip, tiff_flip, filters, colors; ushort raw_height, raw_width, height, width, top_margin, left_margin; ushort shrink, iheight, iwidth, fuji_width, thumb_width, thumb_height; -ushort *raw_image, (*image)[4]; +ushort *raw_image, (*image)[4], cblack[4102]; ushort white[8][8], curve[0x10000], cr2_slice[3], sraw_mul[4]; double pixel_aspect, aber[4]={1,1,1,1}, gamm[6]={ 0.45,4.5,0,0,0,0 }; float bright=1, user_mul[4]={0,0,0,0}, threshold=0; int mask[8][4]; int half_size=0, four_color_rgb=0, document_mode=0, highlight=0; -int verbose=0, use_auto_wb=0, use_camera_wb=0, use_camera_matrix=-1; +int verbose=0, use_auto_wb=0, use_camera_wb=0, use_camera_matrix=1; int output_color=1, output_bps=8, output_tiff=0, med_passes=0; int no_auto_bright=0; unsigned greybox[4] = { 0, 0, UINT_MAX, UINT_MAX }; @@ -182,7 +183,8 @@ } tiff_ifd[10]; struct ph1 { - int format, key_off, t_black, black_off, split_col, tag_21a; + int format, key_off, tag_21a; + int t_black, split_col, black_col, split_row, black_row; float tag_210; } ph1; @@ -203,6 +205,8 @@ #define CLIP(x) LIM(x,0,65535) #define SWAP(a,b) { a=a+b; b=a-b; a=a-b; } +#define my_swap(type, i, j) {type t = i; i = j; j = t;} + /* In order to inline this calculation, I make the risky assumption that all filter patterns can be described @@ -290,7 +294,7 @@ { 0,3,1,0,0,2,0,3,2,1,3,1,1,3,1,3 } }; if (filters == 1) return filter[(row+top_margin)&15][(col+left_margin)&15]; - if (filters == 9) return xtrans[(row+top_margin+6)%6][(col+left_margin+6)%6]; + if (filters == 9) return xtrans[(row+6) % 6][(col+6) % 6]; return FC(row,col); } @@ -317,6 +321,7 @@ #endif //@end COMMON + void CLASS merror (void *ptr, const char *where) { if (ptr) return; @@ -345,6 +350,46 @@ return s[0] << 8 | s[1]; } +// DNG was written by: +#define CameraDNG 1 +#define AdobeDNG 2 + +#ifdef LIBRAW_LIBRARY_BUILD + + +static ushort saneSonyCameraInfo(uchar a, uchar b, uchar c, uchar d, uchar e, uchar f){ + if ((a >> 4) > 9) return 0; + else if ((a & 0x0f) > 9) return 0; + else if ((b >> 4) > 9) return 0; + else if ((b & 0x0f) > 9) return 0; + else if ((c >> 4) > 9) return 0; + else if ((c & 0x0f) > 9) return 0; + else if ((d >> 4) > 9) return 0; + else if ((d & 0x0f) > 9) return 0; + else if ((e >> 4) > 9) return 0; + else if ((e & 0x0f) > 9) return 0; + else if ((f >> 4) > 9) return 0; + else if ((f & 0x0f) > 9) return 0; +return 1; +} + +static ushort bcd2dec(uchar data){ + if ((data >> 4) > 9) return 0; + else if ((data & 0x0f) > 9) return 0; + else return (data >> 4) * 10 + (data & 0x0f); +} + +static uchar SonySubstitution[257] = "\x00\x01\x32\xb1\x0a\x0e\x87\x28\x02\xcc\xca\xad\x1b\xdc\x08\xed\x64\x86\xf0\x4f\x8c\x6c\xb8\xcb\x69\xc4\x2c\x03\x97\xb6\x93\x7c\x14\xf3\xe2\x3e\x30\x8e\xd7\x60\x1c\xa1\xab\x37\xec\x75\xbe\x23\x15\x6a\x59\x3f\xd0\xb9\x96\xb5\x50\x27\x88\xe3\x81\x94\xe0\xc0\x04\x5c\xc6\xe8\x5f\x4b\x70\x38\x9f\x82\x80\x51\x2b\xc5\x45\x49\x9b\x21\x52\x53\x54\x85\x0b\x5d\x61\xda\x7b\x55\x26\x24\x07\x6e\x36\x5b\x47\xb7\xd9\x4a\xa2\xdf\xbf\x12\x25\xbc\x1e\x7f\x56\xea\x10\xe6\xcf\x67\x4d\x3c\x91\x83\xe1\x31\xb3\x6f\xf4\x05\x8a\x46\xc8\x18\x76\x68\xbd\xac\x92\x2a\x13\xe9\x0f\xa3\x7a\xdb\x3d\xd4\xe7\x3a\x1a\x57\xaf\x20\x42\xb2\x9e\xc3\x8b\xf2\xd5\xd3\xa4\x7e\x1f\x98\x9c\xee\x74\xa5\xa6\xa7\xd8\x5e\xb0\xb4\x34\xce\xa8\x79\x77\x5a\xc1\x89\xae\x9a\x11\x33\x9d\xf5\x39\x19\x65\x78\x16\x71\xd2\xa9\x44\x63\x40\x29\xba\xa0\x8f\xe4\xd6\x3b\x84\x0d\xc2\x4e\x58\xdd\x99\x22\x6b\xc9\xbb\x17\x06\xe5\x7d\x66\x43\x62\xf6\xcd\x35\x90\x2e\x41\x8d\x6d\xaa\x09\x73\x95\x0c\xf1\x1d\xde\x4c\x2f\x2d\xf7\xd1\x72\xeb\xef\x48\xc7\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff"; + +ushort CLASS sget2Rev(uchar *s) // specific to some Canon Makernotes fields, where they have endian in reverse +{ + if (order == 0x4d4d) /* "II" means little-endian, and we reverse to "MM" - big endian */ + return s[0] | s[1] << 8; + else /* "MM" means big-endian... */ + return s[0] << 8 | s[1]; +} +#endif + ushort CLASS get2() { uchar str[2] = { 0xff,0xff }; @@ -382,18 +427,22 @@ double CLASS getreal (int type) { - union { char c[8]; double d; } u; + union { char c[8]; double d; } u,v; int i, rev; switch (type) { case 3: return (unsigned short) get2(); case 4: return (unsigned int) get4(); - case 5: u.d = (unsigned int) get4(); - return u.d / (unsigned int) get4(); + case 5: + u.d = (unsigned int) get4(); + v.d = (unsigned int)get4(); + return u.d / (v.d ? v.d : 1); case 8: return (signed short) get2(); case 9: return (signed int) get4(); - case 10: u.d = (signed int) get4(); - return u.d / (signed int) get4(); + case 10: + u.d = (signed int) get4(); + v.d = (signed int)get4(); + return u.d / (v.d?v.d:1); case 11: return int_to_float (get4()); case 12: rev = 7 * ((order == 0x4949) == (ntohs(0x1234) == 0x1234)); @@ -411,6 +460,61 @@ swab ((char*)pixel, (char*)pixel, count*2); } +void CLASS cubic_spline (const int *x_, const int *y_, const int len) +{ + float **A, *b, *c, *d, *x, *y; + int i, j; + + A = (float **) calloc (((2*len + 4)*sizeof **A + sizeof *A), 2*len); + if (!A) return; + A[0] = (float *) (A + 2*len); + for (i = 1; i < 2*len; i++) + A[i] = A[0] + 2*len*i; + y = len + (x = i + (d = i + (c = i + (b = A[0] + i*i)))); + for (i = 0; i < len; i++) { + x[i] = x_[i] / 65535.0; + y[i] = y_[i] / 65535.0; + } + for (i = len-1; i > 0; i--) { + b[i] = (y[i] - y[i-1]) / (x[i] - x[i-1]); + d[i-1] = x[i] - x[i-1]; + } + for (i = 1; i < len-1; i++) { + A[i][i] = 2 * (d[i-1] + d[i]); + if (i > 1) { + A[i][i-1] = d[i-1]; + A[i-1][i] = d[i-1]; + } + A[i][len-1] = 6 * (b[i+1] - b[i]); + } + for(i = 1; i < len-2; i++) { + float v = A[i+1][i] / A[i][i]; + for(j = 1; j <= len-1; j++) + A[i+1][j] -= v * A[i][j]; + } + for(i = len-2; i > 0; i--) { + float acc = 0; + for(j = i; j <= len-2; j++) + acc += A[i][j]*c[j]; + c[i] = (A[i][len-1] - acc) / A[i][i]; + } + for (i = 0; i < 0x10000; i++) { + float x_out = (float)(i / 65535.0); + float y_out = 0; + for (j = 0; j < len-1; j++) { + if (x[j] <= x_out && x_out <= x[j+1]) { + float v = x_out - x[j]; + y_out = y[j] + + ((y[j+1] - y[j]) / d[j] - (2 * d[j] * c[j] + c[j+1] * d[j])/6) * v + + (c[j] * 0.5) * v*v + ((c[j+1] - c[j]) / (6 * d[j])) * v*v*v; + } + } + curve[i] = y_out < 0.0 ? 0 : (y_out >= 1.0 ? 65535 : + (ushort)(y_out * 65535.0 + 0.5)); + } + free (A); +} + void CLASS canon_600_fixed_wb (int temp) { static const short mul[4][5] = { @@ -843,9 +947,9 @@ { int c, tag; ushort len; + int cnt = 0; uchar data[0x10000]; const uchar *dp; - int cnt = 0; memset (jh, 0, sizeof *jh); jh->restart = INT_MAX; @@ -853,32 +957,33 @@ if (data[1] != 0xd8) return 0; do { if(feof(ifp)) return 0; - if(cnt++ > 1024) return 0; + if(cnt++ > 1024) return 0; // 1024 tags limit fread (data, 2, 2, ifp); tag = data[0] << 8 | data[1]; len = (data[2] << 8 | data[3]) - 2; if (tag <= 0xff00) return 0; fread (data, 1, len, ifp); switch (tag) { - case 0xffc3: + case 0xffc3: // start of frame; lossless, Huffman jh->sraw = ((data[7] >> 4) * (data[7] & 15) - 1) & 3; - case 0xffc0: + case 0xffc0: // start of frame; baseline jpeg jh->bits = data[0]; jh->high = data[1] << 8 | data[2]; jh->wide = data[3] << 8 | data[4]; jh->clrs = data[5] + jh->sraw; + if (len == 9 && !dng_version) getc(ifp); break; - case 0xffc4: + case 0xffc4: // define Huffman tables if (info_only) break; for (dp = data; dp < data+len && (c = *dp++) < 4; ) jh->free[c] = jh->huff[c] = make_decoder_ref (&dp); break; - case 0xffda: + case 0xffda: // start of scan jh->psv = data[1+data[0]*2]; jh->bits -= data[3+data[0]*2] & 15; break; - case 0xffdd: + case 0xffdd: // define restart interval jh->restart = data[0] << 8 | data[1]; } } while (tag != 0xffda); @@ -962,7 +1067,7 @@ void CLASS lossless_jpeg_load_raw() { - int jwide, jrow, jcol, val, jidx, i, j, row=0, col=0; + int jwide, jhigh, jrow, jcol, val, jidx, i, j, row=0, col=0; struct jhead jh; ushort *rp; @@ -975,6 +1080,8 @@ longjmp (failure, 2); #endif jwide = jh.wide * jh.clrs; + jhigh = jh.high; + if(jh.clrs == 4 && jwide >= raw_width*2) jhigh *= 2; #ifdef LIBRAW_LIBRARY_BUILD try { @@ -990,10 +1097,10 @@ val = curve[*rp++]; if (cr2_slice[0]) { jidx = jrow*jwide + jcol; - i = jidx / (cr2_slice[1]*jh.high); + i = jidx / (cr2_slice[1]*raw_height); if ((j = i >= cr2_slice[0])) i = cr2_slice[0]; - jidx -= i * (cr2_slice[1]*jh.high); + jidx -= i * (cr2_slice[1]*raw_height); row = jidx / cr2_slice[1+j]; col = jidx % cr2_slice[1+j] + i*cr2_slice[1]; } @@ -1211,7 +1318,7 @@ fseek (ifp, save+4, SEEK_SET); if ((tcol += tile_width) >= raw_width) trow += tile_length + (tcol = 0); - + ljpeg_end (&jh); } } @@ -1281,6 +1388,43 @@ } } +#ifdef LIBRAW_LIBRARY_BUILD + +void CLASS nikon_coolscan_load_raw() +{ + int bufsize = width*3*tiff_bps/8; + if(tiff_bps <= 8) + gamma_curve(1.0/imgdata.params.coolscan_nef_gamma,0.,1,255); + else + gamma_curve(1.0/imgdata.params.coolscan_nef_gamma,0.,1,65535); + fseek (ifp, data_offset, SEEK_SET); + unsigned char *buf = (unsigned char*)malloc(bufsize); + unsigned short *ubuf = (unsigned short *)buf; + for(int row = 0; row < raw_height; row++) + { + int red = fread (buf, 1, bufsize, ifp); + unsigned short (*ip)[4] = (unsigned short (*)[4]) image + row*width; + if(tiff_bps <= 8) + for(int col=0; col> c*12 & 0xfff) - (c >> 1 << 11); + } + rgb[0] = yuv[b] + 1.370705*yuv[3]; + rgb[1] = yuv[b] - 0.337633*yuv[2] - 0.698001*yuv[3]; + rgb[2] = yuv[b] + 1.732446*yuv[2]; + FORC3 image[row*width+col][c] = curve[LIM(rgb[c],0,0xfff)] / cam_mul[c]; + } + } +} + /* Returns 1 for a Coolpix 995, 0 for anything else. */ @@ -1531,14 +1700,19 @@ void CLASS phase_one_flat_field (int is_float, int nc) { ushort head[8]; - unsigned wide, y, x, c, rend, cend, row, col; + unsigned wide, high, y, x, c, rend, cend, row, col; float *mrow, num, mult[4]; read_shorts (head, 8); - wide = head[2] / head[4]; + if (head[2] * head[3] * head[4] * head[5] == 0) return; + wide = head[2] / head[4] + (head[2] % head[4] != 0); + high = head[3] / head[5] + (head[3] % head[5] != 0); mrow = (float *) calloc (nc*wide, sizeof *mrow); merror (mrow, "phase_one_flat_field()"); - for (y=0; y < head[3] / head[5]; y++) { + for (y=0; y < high; y++) { +#ifdef LIBRAW_LIBRARY_BUILD + checkCancel(); +#endif for (x=0; x < wide; x++) for (c=0; c < nc; c+=2) { num = is_float ? getreal(11) : get2()/32768.0; @@ -1547,14 +1721,18 @@ } if (y==0) continue; rend = head[1] + y*head[5]; - for (row = rend-head[5]; row < raw_height && row < rend; row++) { + for (row = rend-head[5]; + row < raw_height && row < rend && + row < head[1]+head[3]-head[5]; row++) { for (x=1; x < wide; x++) { for (c=0; c < nc; c+=2) { mult[c] = mrow[c*wide+x-1]; mult[c+1] = (mrow[c*wide+x] - mult[c]) / head[4]; } cend = head[0] + x*head[4]; - for (col = cend-head[4]; col < raw_width && col < cend; col++) { + for (col = cend-head[4]; + col < raw_width && + col < cend && col < head[0]+head[2]-head[4]; col++) { c = nc > 2 ? FC(row-top_margin,col-left_margin) : 0; if (!(c & 1)) { c = RAW(row,col) * mult[c]; @@ -1572,18 +1750,19 @@ free (mrow); } -void CLASS phase_one_correct() +int CLASS phase_one_correct() { unsigned entries, tag, data, save, col, row, type; int len, i, j, k, cip, val[4], dev[4], sum, max; int head[9], diff, mindiff=INT_MAX, off_412=0; - static const signed char dir[12][2] = + /* static */ const signed char dir[12][2] = { {-1,-1}, {-1,1}, {1,-1}, {1,1}, {-2,0}, {0,-2}, {0,2}, {2,0}, {-2,-2}, {-2,2}, {2,-2}, {2,2} }; float poly[8], num, cfrac, frac, mult[2], *yval[2]; ushort *xval[2]; + int qmult_applied = 0, qlin_applied = 0; - if (half_size || !meta_length) return; + if (half_size || !meta_length) return 0; #ifdef DCRAW_VERBOSE if (verbose) fprintf (stderr,_("Phase One correction...\n")); #endif @@ -1592,7 +1771,14 @@ fseek (ifp, 6, SEEK_CUR); fseek (ifp, meta_offset+get4(), SEEK_SET); entries = get4(); get4(); + +#ifdef LIBRAW_LIBRARY_BUILD + try { +#endif while (entries--) { +#ifdef LIBRAW_LIBRARY_BUILD + checkCancel(); +#endif tag = get4(); len = get4(); data = get4(); @@ -1615,15 +1801,20 @@ curve[i] = LIM(num+i,0,65535); } apply: /* apply to whole image */ for (row=0; row < raw_height; row++) + { +#ifdef LIBRAW_LIBRARY_BUILD + checkCancel(); +#endif for (col = (tag & 1)*ph1.split_col; col < raw_width; col++) RAW(row,col) = curve[RAW(row,col)]; + } } else if (tag == 0x400) { /* Sensor defects */ while ((len -= 8) >= 0) { col = get2(); row = get2(); type = get2(); get2(); if (col >= raw_width) continue; - if (type == 131) /* Bad column */ + if (type == 131 || type == 137) /* Bad column */ for (row=0; row < raw_height; row++) if (FC(row-top_margin,col-left_margin) == 1) { for (sum=i=0; i < 4; i++) @@ -1660,6 +1851,99 @@ mindiff = diff; off_412 = ftell(ifp) - 38; } + } else if (tag == 0x41f && !qlin_applied) { /* Quadrant linearization */ + ushort lc[2][2][16], ref[16]; + int qr, qc; + for (qr = 0; qr < 2; qr++) + for (qc = 0; qc < 2; qc++) + for (i = 0; i < 16; i++) + lc[qr][qc][i] = get4(); + for (i = 0; i < 16; i++) { + int v = 0; + for (qr = 0; qr < 2; qr++) + for (qc = 0; qc < 2; qc++) + v += lc[qr][qc][i]; + ref[i] = (v + 2) >> 2; + } + for (qr = 0; qr < 2; qr++) { + for (qc = 0; qc < 2; qc++) { + int cx[19], cf[19]; + for (i = 0; i < 16; i++) { + cx[1+i] = lc[qr][qc][i]; + cf[1+i] = ref[i]; + } + cx[0] = cf[0] = 0; + cx[17] = cf[17] = ((unsigned int)ref[15] * 65535) / lc[qr][qc][15]; + cf[18] = cx[18] = 65535; + cubic_spline(cx, cf, 19); + + for (row = (qr ? ph1.split_row : 0); + row < (qr ? raw_height : ph1.split_row); row++) + { +#ifdef LIBRAW_LIBRARY_BUILD + checkCancel(); +#endif + for (col = (qc ? ph1.split_col : 0); + col < (qc ? raw_width : ph1.split_col); col++) + RAW(row,col) = curve[RAW(row,col)]; + } + } + } + qlin_applied = 1; + } else if (tag == 0x41e && !qmult_applied) { /* Quadrant multipliers */ + float qmult[2][2] = { { 1, 1 }, { 1, 1 } }; + get4(); get4(); get4(); get4(); + qmult[0][0] = 1.0 + getreal(11); + get4(); get4(); get4(); get4(); get4(); + qmult[0][1] = 1.0 + getreal(11); + get4(); get4(); get4(); + qmult[1][0] = 1.0 + getreal(11); + get4(); get4(); get4(); + qmult[1][1] = 1.0 + getreal(11); + for (row=0; row < raw_height; row++) + { +#ifdef LIBRAW_LIBRARY_BUILD + checkCancel(); +#endif + for (col=0; col < raw_width; col++) { + i = qmult[row >= ph1.split_row][col >= ph1.split_col] * RAW(row,col); + RAW(row,col) = LIM(i,0,65535); + } + } + qmult_applied = 1; + } else if (tag == 0x431 && !qmult_applied) { /* Quadrant combined */ + ushort lc[2][2][7], ref[7]; + int qr, qc; + for (i = 0; i < 7; i++) + ref[i] = get4(); + for (qr = 0; qr < 2; qr++) + for (qc = 0; qc < 2; qc++) + for (i = 0; i < 7; i++) + lc[qr][qc][i] = get4(); + for (qr = 0; qr < 2; qr++) { + for (qc = 0; qc < 2; qc++) { + int cx[9], cf[9]; + for (i = 0; i < 7; i++) { + cx[1+i] = ref[i]; + cf[1+i] = ((unsigned) ref[i] * lc[qr][qc][i]) / 10000; + } + cx[0] = cf[0] = 0; + cx[8] = cf[8] = 65535; + cubic_spline(cx, cf, 9); + for (row = (qr ? ph1.split_row : 0); + row < (qr ? raw_height : ph1.split_row); row++) + { +#ifdef LIBRAW_LIBRARY_BUILD + checkCancel(); +#endif + for (col = (qc ? ph1.split_col : 0); + col < (qc ? raw_width : ph1.split_col); col++) + RAW(row,col) = curve[RAW(row,col)]; + } + } + } + qmult_applied = 1; + qlin_applied = 1; } fseek (ifp, save, SEEK_SET); } @@ -1679,6 +1963,10 @@ for (j=0; j < head[i+1]*head[i+3]; j++) xval[i][j] = get2(); for (row=0; row < raw_height; row++) + { +#ifdef LIBRAW_LIBRARY_BUILD + checkCancel(); +#endif for (col=0; col < raw_width; col++) { cfrac = (float) col * head[3] / raw_width; cfrac -= cip = cfrac; @@ -1693,8 +1981,16 @@ i = ((mult[0] * (1-cfrac) + mult[1] * cfrac) * row + num) * 2; RAW(row,col) = LIM(i,0,65535); } + } free (yval[0]); } +#ifdef LIBRAW_LIBRARY_BUILD + } + catch (...) + { + return LIBRAW_CANCELLED_BY_CALLBACK; + } +#endif } void CLASS phase_one_load_raw() @@ -1706,6 +2002,25 @@ akey = get2(); bkey = get2(); t_mask = ph1.format == 1 ? 0x5555:0x1354; +#ifdef LIBRAW_LIBRARY_BUILD + if (ph1.black_col || ph1.black_row ) + { + imgdata.rawdata.ph1_cblack = (short(*)[2])calloc(raw_height*2,sizeof(ushort)); + merror(imgdata.rawdata.ph1_cblack,"phase_one_load_raw()"); + imgdata.rawdata.ph1_rblack = (short(*)[2])calloc(raw_width*2,sizeof(ushort)); + merror(imgdata.rawdata.ph1_rblack,"phase_one_load_raw()"); + if (ph1.black_col) + { + fseek (ifp, ph1.black_col, SEEK_SET); + read_shorts ((ushort *)imgdata.rawdata.ph1_cblack[0], raw_height*2); + } + if (ph1.black_row) + { + fseek (ifp, ph1.black_row, SEEK_SET); + read_shorts ((ushort *) imgdata.rawdata.ph1_rblack[0], raw_width*2); + } + } +#endif fseek (ifp, data_offset, SEEK_SET); read_shorts (raw_image, raw_width*raw_height); if (ph1.format) @@ -1721,7 +2036,7 @@ { #ifndef LIBRAW_NOTHREADS #define bitbuf tls->ph1_bits.bitbuf -#define vbits tls->ph1_bits.vbits +#define vbits tls->ph1_bits.vbits #else static UINT64 bitbuf=0; static int vbits=0; @@ -1755,25 +2070,40 @@ static const int length[] = { 8,7,6,9,11,10,5,12,14,13 }; int *offset, len[2], pred[2], row, col, i, j; ushort *pixel; - short (*t_black)[2]; + short (*c_black)[2], (*r_black)[2]; +#ifdef LIBRAW_LIBRARY_BUILD + if(ph1.format == 6) + throw LIBRAW_EXCEPTION_IO_CORRUPT; +#endif - pixel = (ushort *) calloc (raw_width + raw_height*4, 2); + pixel = (ushort *) calloc (raw_width*3 + raw_height*4, 2); merror (pixel, "phase_one_load_raw_c()"); offset = (int *) (pixel + raw_width); fseek (ifp, strip_offset, SEEK_SET); for (row=0; row < raw_height; row++) offset[row] = get4(); - t_black = (short (*)[2]) offset + raw_height; - fseek (ifp, ph1.black_off, SEEK_SET); - if (ph1.black_off) - { - read_shorts ((ushort *) t_black[0], raw_height*2); -#ifdef LIBRAW_LIBRARY_BUILD - imgdata.rawdata.ph1_black = (short (*)[2])calloc(raw_height*2,sizeof(short)); - merror (imgdata.rawdata.ph1_black, "phase_one_load_raw_c()"); - memmove(imgdata.rawdata.ph1_black,(short *) t_black[0],raw_height*2*sizeof(short)); + c_black = (short (*)[2]) (offset + raw_height); + fseek (ifp, ph1.black_col, SEEK_SET); + if (ph1.black_col) + read_shorts ((ushort *) c_black[0], raw_height*2); + r_black = c_black + raw_height; + fseek (ifp, ph1.black_row, SEEK_SET); + if (ph1.black_row) + read_shorts ((ushort *) r_black[0], raw_width*2); + +#ifdef LIBRAW_LIBRARY_BUILD + // Copy data to internal copy (ever if not read) + if (ph1.black_col || ph1.black_row ) + { + imgdata.rawdata.ph1_cblack = (short(*)[2])calloc(raw_height*2,sizeof(ushort)); + merror(imgdata.rawdata.ph1_cblack,"phase_one_load_raw_c()"); + memmove(imgdata.rawdata.ph1_cblack,(ushort*)c_black[0],raw_height*2*sizeof(ushort)); + imgdata.rawdata.ph1_rblack = (short(*)[2])calloc(raw_width*2,sizeof(ushort)); + merror(imgdata.rawdata.ph1_rblack,"phase_one_load_raw_c()"); + memmove(imgdata.rawdata.ph1_rblack,(ushort*)r_black[0],raw_width*2*sizeof(ushort)); + } #endif - } + for (i=0; i < 256; i++) curve[i] = i*i / 3.969 + 0.5; #ifdef LIBRAW_LIBRARY_BUILD @@ -1804,7 +2134,9 @@ } for (col=0; col < raw_width; col++) { #ifndef LIBRAW_LIBRARY_BUILD - i = (pixel[col] << 2) - ph1.t_black + t_black[row][col >= ph1.split_col]; + i = (pixel[col] << 2) - ph1.t_black + + c_black[row][col >= ph1.split_col] + + r_black[col][row >= ph1.split_row]; if (i > 0) RAW(row,col) = i; #else RAW(row,col) = pixel[col] << 2; @@ -1824,7 +2156,9 @@ void CLASS hasselblad_load_raw() { struct jhead jh; - int row, col, pred[2], len[2], diff, c; + int shot, row, col, *back[5], len[2], diff[12], pred, sh, f, s, c; + unsigned upix, urow, ucol; + ushort *ip; if (!ljpeg_start (&jh, 0)) return; order = 0x4949; @@ -1832,32 +2166,63 @@ #ifdef LIBRAW_LIBRARY_BUILD try { #endif + 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++) { #ifdef LIBRAW_LIBRARY_BUILD checkCancel(); #endif - pred[0] = pred[1] = 0x8000 + load_flags; + FORC4 back[(c+3) & 3] = back[c]; for (col=0; col < raw_width; col+=2) { - FORC(2) len[c] = ph1_huff(jh.huff[0]); - FORC(2) { - diff = ph1_bits(len[c]); - if ((diff & (1 << (len[c]-1))) == 0) - diff -= (1 << len[c]) - 1; - if (diff == 65535) diff = -32768; - RAW(row,col+c) = pred[c] += diff; + for (s=0; s < tiff_samples*2; s+=2) { + FORC(2) len[c] = ph1_huff(jh.huff[0]); + FORC(2) { + diff[s+c] = ph1_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; } } } #ifdef LIBRAW_LIBRARY_BUILD } catch (...){ + free (back[4]); ljpeg_end (&jh); throw; } #endif + free (back[4]); ljpeg_end (&jh); - maximum = 0xffff; + if (image) mix_green = 1; } + void CLASS leaf_hdr_load_raw() { ushort *pixel=0; @@ -1902,7 +2267,6 @@ void CLASS unpacked_load_raw() { int row, col, bits=0; - while (1 << ++bits < maximum); read_shorts (raw_image, raw_width*raw_height); for (row=0; row < raw_height; row++) @@ -1917,55 +2281,47 @@ } } + void CLASS sinar_4shot_load_raw() { ushort *pixel; unsigned shot, row, col, r, c; - if ((shot = shot_select) || half_size) { - if (shot) shot--; - if (shot > 3) shot = 3; + if (raw_image) { + shot = LIM (shot_select, 1, 4) - 1; fseek (ifp, data_offset + shot*4, SEEK_SET); fseek (ifp, get4(), SEEK_SET); unpacked_load_raw(); return; } -#ifndef LIBRAW_LIBRARY_BUILD - free (raw_image); - raw_image = 0; - free (image); - image = (ushort (*)[4]) - calloc ((iheight=height), (iwidth=width)*sizeof *image); - merror (image, "sinar_4shot_load_raw()"); -#endif pixel = (ushort *) calloc (raw_width, sizeof *pixel); merror (pixel, "sinar_4shot_load_raw()"); #ifdef LIBRAW_LIBRARY_BUILD try { #endif for (shot=0; shot < 4; shot++) { - fseek (ifp, data_offset + shot*4, SEEK_SET); - fseek (ifp, get4(), SEEK_SET); - for (row=0; row < raw_height; row++) { #ifdef LIBRAW_LIBRARY_BUILD checkCancel(); #endif + fseek (ifp, data_offset + shot*4, SEEK_SET); + fseek (ifp, get4(), SEEK_SET); + for (row=0; row < raw_height; row++) { read_shorts (pixel, raw_width); if ((r = row-top_margin - (shot >> 1 & 1)) >= height) continue; for (col=0; col < raw_width; col++) { if ((c = col-left_margin - (shot & 1)) >= width) continue; - image[r*width+c][FC(row,col)] = pixel[col]; + image[r*width+c][(row & 1)*3 ^ (~col & 1)] = pixel[col]; } } } #ifdef LIBRAW_LIBRARY_BUILD - } catch(...) { - free (pixel); + } catch (...) { + free(pixel); throw; } #endif free (pixel); - shrink = filters = 0; + mix_green = 1; } void CLASS imacon_full_load_raw() @@ -1973,14 +2329,33 @@ int row, col; if (!image) return; + +#ifdef LIBRAW_LIBRARY_BUILD + unsigned short *buf = (unsigned short *)malloc(width*3*sizeof(unsigned short)); + merror(buf,"imacon_full_load_raw"); +#endif + for (row=0; row < height; row++) { #ifdef LIBRAW_LIBRARY_BUILD checkCancel(); -#endif + read_shorts(buf,width*3); + unsigned short (*rowp)[4] = &image[row*width]; + for (col=0; col < width; col++) + { + rowp[col][0]=buf[col*3]; + rowp[col][1]=buf[col*3+1]; + rowp[col][2]=buf[col*3+2]; + rowp[col][3]=0; + } +#else for (col=0; col < width; col++) read_shorts (image[row*width+col], 3); +#endif } +#ifdef LIBRAW_LIBRARY_BUILD + free(buf); +#endif } void CLASS packed_load_raw() @@ -2017,8 +2392,8 @@ } val = bitbuf << (64-tiff_bps-vbits) >> (64-tiff_bps); RAW(row,col ^ (load_flags >> 6 & 1)) = val; - if (load_flags & 1 && (col % 10) == 9 && - fgetc(ifp) && col < width+left_margin) derror(); + if (load_flags & 1 && (col % 10) == 9 && fgetc(ifp) && + row < height+top_margin && col < width+left_margin) derror(); } vbits -= rbits; } @@ -2028,6 +2403,7 @@ { uchar *data, *dp; int rev, dwide, row, col, c; + double sum[]={0,0}; rev = 3 * (order == 0x4949); dwide = (raw_width * 5 + 1) / 4; @@ -2053,17 +2429,78 @@ #endif free (data); maximum = 0x3ff; + if (strncmp(make,"OmniVision",10)) return; + row = raw_height/2; + FORC(width-1) { + sum[ c & 1] += SQR(RAW(row,c)-RAW(row+1,c+1)); + sum[~c & 1] += SQR(RAW(row+1,c)-RAW(row,c+1)); + } + if (sum[1] > sum[0]) filters = 0x4b4b4b4b; +} + +void CLASS android_tight_load_raw() +{ + uchar *data, *dp; + int bwide, row, col, c; + + bwide = -(-5*raw_width >> 5) << 3; + data = (uchar *) malloc (bwide); + merror (data, "android_tight_load_raw()"); + for (row=0; row < raw_height; row++) { + if (fread (data, 1, bwide, ifp) < bwide) derror(); + for (dp=data, col=0; col < raw_width; dp+=5, col+=4) + FORC4 RAW(row,col+c) = (dp[c] << 2) | (dp[4] >> (c << 1) & 3); +} + free (data); +} + +void CLASS android_loose_load_raw() +{ + uchar *data, *dp; + int bwide, row, col, c; + UINT64 bitbuf=0; + + bwide = (raw_width+5)/6 << 3; + data = (uchar *) malloc (bwide); + merror (data, "android_loose_load_raw()"); + for (row=0; row < raw_height; row++) { + if (fread (data, 1, bwide, ifp) < bwide) derror(); + for (dp=data, col=0; col < raw_width; dp+=8, col+=6) { + FORC(8) bitbuf = (bitbuf << 8) | dp[c^7]; + FORC(6) RAW(row,col+c) = (bitbuf >> c*10) & 0x3ff; + } + } + free (data); } void CLASS canon_rmf_load_raw() { int row, col, bits, orow, ocol, c; +#ifdef LIBRAW_LIBRARY_BUILD + int *words = (int*)malloc(sizeof(int)*(raw_width/3+1)); + merror(words,"canon_rmf_load_raw"); +#endif for (row=0; row < raw_height; row++) { #ifdef LIBRAW_LIBRARY_BUILD checkCancel(); -#endif + fread(words,sizeof(int),raw_width/3,ifp); + for (col=0; col < raw_width-2; col+=3) + { + bits = words[col/3]; + FORC3 { + orow = row; + if ((ocol = col+c-4) < 0) + { + ocol += raw_width; + if ((orow -= 2) < 0) + orow += raw_height; + } + RAW(orow,ocol) = curve[bits >> (10*c+2) & 0x3ff]; + } + } +#else for (col=0; col < raw_width-2; col+=3) { bits = get4(); FORC3 { @@ -2073,18 +2510,22 @@ if ((orow -= 2) < 0) orow += raw_height; } - RAW(orow,ocol) = bits >> (10*c+2) & 0x3ff; + RAW(orow,ocol) = curve[bits >> (10*c+2) & 0x3ff]; } } - } - maximum = 0x3ff; +#endif + } +#ifdef LIBRAW_LIBRARY_BUILD + free(words); +#endif + maximum = curve[0x3ff]; } unsigned CLASS pana_bits (int nbits) { #ifndef LIBRAW_NOTHREADS #define buf tls->pana_bits.buf -#define vbits tls->pana_bits.vbits +#define vbits tls->pana_bits.vbits #else static uchar buf[0x4000]; static int vbits; @@ -2342,12 +2783,12 @@ (c-pt[i-2]) / (pt[i]-pt[i-2]) * (pt[i+1]-pt[i-1]) + pt[i-1] + 0.5; for (s=i=0; i < sizeof src; i+=2) FORC(256 >> src[i]) - huff[0][s++] = src[i] << 8 | (uchar) src[i+1]; + ((ushort *)huff)[s++] = src[i] << 8 | (uchar) src[i+1]; s = kodak_cbpp == 243 ? 2 : 3; FORC(256) huff[18][c] = (8-s) << 8 | c >> s << s | 1 << (s-1); getbits(-1); for (i=0; i < sizeof(buf)/sizeof(short); i++) - buf[0][0][i] = 2048; + ((short *)buf)[i] = 2048; for (row=0; row < height; row+=4) { #ifdef LIBRAW_LIBRARY_BUILD checkCancel(); @@ -2359,7 +2800,7 @@ x = ~((~0u) << (s-1)); val <<= 12-s; for (i=0; i < sizeof(buf[0])/sizeof(short); i++) - buf[c][0][i] = (buf[c][0][i] * val + x) >> s; + ((short *)buf[c])[i] = (((short *)buf[c])[i] * val + x) >> s; last[c] = mul[c]; for (r=0; r <= !c; r++) { buf[c][1][width/2] = buf[c][2][width/2] = mul[c] << 7; @@ -2416,18 +2857,12 @@ void CLASS lossy_dng_load_raw() {} #else -#ifdef LIBRAW_LIBRARY_BUILD -void CLASS kodak_jpeg_load_raw() {} -#else +#ifndef LIBRAW_LIBRARY_BUILD METHODDEF(boolean) fill_input_buffer (j_decompress_ptr cinfo) { -#ifndef LIBRAW_NOTHREADS -#define jpeg_buffer tls->jpeg_buffer -#else static uchar jpeg_buffer[4096]; -#endif size_t nbytes; nbytes = fread (jpeg_buffer, 1, 4096, ifp); @@ -2435,11 +2870,7 @@ cinfo->src->next_input_byte = jpeg_buffer; cinfo->src->bytes_in_buffer = nbytes; return TRUE; -#ifndef LIBRAW_NOTHREADS -#undef jpeg_buffer -#endif } - void CLASS kodak_jpeg_load_raw() { struct jpeg_decompress_struct cinfo; @@ -2457,26 +2888,14 @@ if ((cinfo.output_width != width ) || (cinfo.output_height*2 != height ) || (cinfo.output_components != 3 )) { -#ifdef DCRAW_VERBOSE fprintf (stderr,_("%s: incorrect JPEG dimensions\n"), ifname); -#endif jpeg_destroy_decompress (&cinfo); -#ifdef LIBRAW_LIBRARY_BUILD - throw LIBRAW_EXCEPTION_DECODE_JPEG; -#else longjmp (failure, 3); -#endif } buf = (*cinfo.mem->alloc_sarray) - ((j_common_ptr) &cinfo, JPOOL_IMAGE, width*3, 1); + ((j_common_ptr) &cinfo, JPOOL_IMAGE, width*3, 1); -#ifdef LIBRAW_LIBRARY_BUILD - try { -#endif while (cinfo.output_scanline < cinfo.output_height) { -#ifdef LIBRAW_LIBRARY_BUILD - checkCancel(); -#endif row = cinfo.output_scanline * 2; jpeg_read_scanlines (&cinfo, buf, 1); pixel = (JSAMPLE (*)[3]) buf[0]; @@ -2487,17 +2906,94 @@ RAW(row+1,col+0) = pixel[col][2] + pixel[col+1][2]; } } -#ifdef LIBRAW_LIBRARY_BUILD - } catch(...) { - jpeg_finish_decompress (&cinfo); - jpeg_destroy_decompress (&cinfo); - throw; - } -#endif jpeg_finish_decompress (&cinfo); jpeg_destroy_decompress (&cinfo); maximum = 0xff << 1; } +#else + +struct jpegErrorManager { + struct jpeg_error_mgr pub; +}; + +static void jpegErrorExit (j_common_ptr cinfo) +{ + jpegErrorManager* myerr = (jpegErrorManager*) cinfo->err; + throw LIBRAW_EXCEPTION_DECODE_JPEG; +} + + +// LibRaw's Kodak_jpeg_load_raw +void CLASS kodak_jpeg_load_raw() +{ + if(data_size < 1) + throw LIBRAW_EXCEPTION_DECODE_JPEG; + + int row, col; + jpegErrorManager jerr; + struct jpeg_decompress_struct cinfo; + + cinfo.err = jpeg_std_error(&jerr.pub); + jerr.pub.error_exit = jpegErrorExit; + + unsigned char *jpg_buf = (unsigned char *)malloc(data_size); + merror(jpg_buf,"kodak_jpeg_load_raw"); + unsigned char *pixel_buf = (unsigned char*) malloc(width*3); + jpeg_create_decompress (&cinfo); + merror(pixel_buf,"kodak_jpeg_load_raw"); + + fread(jpg_buf,data_size,1,ifp); + swab ((char*)jpg_buf, (char*)jpg_buf, data_size); + try + { + jpeg_mem_src(&cinfo, jpg_buf, data_size); + int rc = jpeg_read_header(&cinfo, TRUE); + if(rc!=1) + throw LIBRAW_EXCEPTION_DECODE_JPEG; + + jpeg_start_decompress (&cinfo); + if ((cinfo.output_width != width ) || + (cinfo.output_height*2 != height ) || + (cinfo.output_components != 3 )) + { + throw LIBRAW_EXCEPTION_DECODE_JPEG; + } + + unsigned char *buf[1]; + buf[0] = pixel_buf; + + while (cinfo.output_scanline < cinfo.output_height) + { + checkCancel(); + row = cinfo.output_scanline * 2; + jpeg_read_scanlines (&cinfo, buf, 1); + unsigned char (*pixel)[3] = (unsigned char (*)[3]) buf[0]; + for (col=0; col < width; col+=2) { + RAW(row+0,col+0) = pixel[col+0][1] << 1; + RAW(row+1,col+1) = pixel[col+1][1] << 1; + RAW(row+0,col+1) = pixel[col][0] + pixel[col+1][0]; + RAW(row+1,col+0) = pixel[col][2] + pixel[col+1][2]; + } + } + } + catch (...) + { + jpeg_finish_decompress (&cinfo); + jpeg_destroy_decompress (&cinfo); + free(jpg_buf); + free(pixel_buf); + throw; + } + jpeg_finish_decompress (&cinfo); + jpeg_destroy_decompress (&cinfo); + free(jpg_buf); + free(pixel_buf); + maximum = 0xff << 1; +} +#endif + +#ifndef LIBRAW_LIBRARY_BUILD +void CLASS gamma_curve (double pwr, double ts, int mode, int imax); #endif void CLASS lossy_dng_load_raw() @@ -2508,29 +3004,34 @@ JSAMPLE (*pixel)[3]; unsigned sorder=order, ntags, opcode, deg, i, j, c; unsigned save=data_offset-4, trow=0, tcol=0, row, col; - ushort t_curve[3][256]; + ushort cur[3][256]; double coeff[9], tot; - fseek (ifp, meta_offset, SEEK_SET); - order = 0x4d4d; - ntags = get4(); - while (ntags--) { - opcode = get4(); get4(); get4(); - if (opcode != 8) - { fseek (ifp, get4(), SEEK_CUR); continue; } - fseek (ifp, 20, SEEK_CUR); - if ((c = get4()) > 2) break; - fseek (ifp, 12, SEEK_CUR); - if ((deg = get4()) > 8) break; - for (i=0; i <= deg && i < 9; i++) - coeff[i] = getreal(12); - for (i=0; i < 256; i++) { - for (tot=j=0; j <= deg; j++) - tot += coeff[j] * pow(i/255.0, (int)j); - t_curve[c][i] = tot*0xffff; + if (meta_offset) { + fseek (ifp, meta_offset, SEEK_SET); + order = 0x4d4d; + ntags = get4(); + while (ntags--) { + opcode = get4(); get4(); get4(); + if (opcode != 8) + { fseek (ifp, get4(), SEEK_CUR); continue; } + fseek (ifp, 20, SEEK_CUR); + if ((c = get4()) > 2) break; + fseek (ifp, 12, SEEK_CUR); + if ((deg = get4()) > 8) break; + for (i=0; i <= deg && i < 9; i++) + coeff[i] = getreal(12); + for (i=0; i < 256; i++) { + for (tot=j=0; j <= deg; j++) + tot += coeff[j] * pow(i/255.0, (int)j); + cur[c][i] = tot*0xffff; + } } + order = sorder; + } else { + gamma_curve (1/2.4, 12.92, 1, 255); + FORC3 memcpy (cur[c], curve, sizeof cur[0]); } - order = sorder; cinfo.err = jpeg_std_error (&jerr); jpeg_create_decompress (&cinfo); while (trow < raw_height) { @@ -2561,7 +3062,7 @@ jpeg_read_scanlines (&cinfo, buf, 1); pixel = (JSAMPLE (*)[3]) buf[0]; for (col=0; col < cinfo.output_width && tcol+col < width; col++) { - FORC3 image[row*width+tcol+col][c] = t_curve[c][pixel[col][c]]; + FORC3 image[row*width+tcol+col][c] = cur[c][pixel[col][c]]; } } #ifdef LIBRAW_LIBRARY_BUILD @@ -2626,13 +3127,50 @@ maximum = curve[0xff]; } -void CLASS kodak_yrgb_load_raw() +void CLASS kodak_c330_load_raw() +{ + uchar *pixel; + int row, col, y, cb, cr, rgb[3], c; + + pixel = (uchar *) calloc (raw_width, 2*sizeof *pixel); + merror (pixel, "kodak_c330_load_raw()"); +#ifdef LIBRAW_LIBRARY_BUILD + try { +#endif + for (row=0; row < height; row++) { +#ifdef LIBRAW_LIBRARY_BUILD + checkCancel(); +#endif + if (fread (pixel, raw_width, 2, ifp) < 2) derror(); + if (load_flags && (row & 31) == 31) + fseek (ifp, raw_width*32, SEEK_CUR); + for (col=0; col < width; col++) { + y = pixel[col*2]; + cb = pixel[(col*2 & -4) | 1] - 128; + cr = pixel[(col*2 & -4) | 3] - 128; + rgb[1] = y - ((cb + cr + 2) >> 2); + rgb[2] = rgb[1] + cb; + rgb[0] = rgb[1] + cr; + FORC3 image[row*width+col][c] = curve[LIM(rgb[c],0,255)]; + } + } +#ifdef LIBRAW_LIBRARY_BUILD + } catch(...) { + free (pixel); + throw; + } +#endif + free (pixel); + maximum = curve[0xff]; +} + +void CLASS kodak_c603_load_raw() { uchar *pixel; int row, col, y, cb, cr, rgb[3], c; pixel = (uchar *) calloc (raw_width, 3*sizeof *pixel); - merror (pixel, "kodak_yrgb_load_raw()"); + merror (pixel, "kodak_c603_load_raw()"); #ifdef LIBRAW_LIBRARY_BUILD try { #endif @@ -2642,11 +3180,11 @@ #endif if (~row & 1) if (fread (pixel, raw_width, 3, ifp) < 3) derror(); - for (col=0; col < raw_width; col++) { + for (col=0; col < width; col++) { y = pixel[width*2*(row & 1) + col]; cb = pixel[width + (col & -2)] - 128; cr = pixel[width + (col & -2)+1] - 128; - rgb[1] = y-((cb + cr + 2) >> 2); + rgb[1] = y - ((cb + cr + 2) >> 2); rgb[2] = rgb[1] + cb; rgb[0] = rgb[1] + cr; FORC3 image[row*width+col][c] = curve[LIM(rgb[c],0,255)]; @@ -2789,6 +3327,7 @@ ushort *ip; if (!image) return; + unsigned int bits = (load_flags && load_flags > 9 && load_flags < 17)?load_flags:10; for (row=0; row < height; row+=2) { #ifdef LIBRAW_LIBRARY_BUILD @@ -2806,7 +3345,7 @@ rgb[0] = rgb[1] + cr; for (j=0; j < 2; j++) for (k=0; k < 2; k++) { - if ((y[j][k] = y[j][k^1] + *bp++) >> 10) derror(); + if ((y[j][k] = y[j][k^1] + *bp++) >> bits) derror(); ip = image[(row+j)*width + col+i+k]; FORC3 ip[c] = curve[LIM(y[j][k]+rgb[c], 0, 0xfff)]; } @@ -2818,13 +3357,9 @@ void CLASS kodak_rgb_load_raw() { short buf[768], *bp; - int row, col, len, c, i, rgb[3]; + int row, col, len, c, i, rgb[3],ret; ushort *ip=image[0]; -#ifndef LIBRAW_LIBRARY_BUILD - if (raw_image) free (raw_image); - raw_image = 0; -#endif for (row=0; row < height; row++) { #ifdef LIBRAW_LIBRARY_BUILD @@ -2832,10 +3367,17 @@ #endif for (col=0; col < width; col+=256) { len = MIN (256, width-col); - kodak_65000_decode (buf, len*3); + ret = kodak_65000_decode (buf, len*3); memset (rgb, 0, sizeof rgb); for (bp=buf, i=0; i < len; i++, ip+=4) - FORC3 if ((ip[c] = rgb[c] += *bp++) >> 12) derror(); +#ifdef LIBRAW_LIBRARY_BUILD + if(load_flags == 12) + { + FORC3 ip[c] = ret ? (*bp++) : (rgb[c] += *bp++); + } + else +#endif + FORC3 if ((ip[c] = ret ? (*bp++) : (rgb[c] += *bp++)) >> 12) derror(); } } } @@ -2867,16 +3409,11 @@ for (p=0; p < 127; p++) pad[p] = htonl(pad[p]); } -#if 1 // Avoid gcc 4.8 bug while (len--) { *data++ ^= pad[p & 127] = pad[(p+1) & 127] ^ pad[(p+65) & 127]; - p++; + p++; } -#else - while (len--) - *data++ ^= pad[p++ & 127] = pad[(p+1) & 127] ^ pad[(p+65) & 127]; -#endif #ifndef LIBRAW_NOTHREADS #undef pad #undef p @@ -2895,7 +3432,7 @@ key = get4(); fseek (ifp, 164600, SEEK_SET); fread (head, 1, 40, ifp); - sony_decrypt ((unsigned int *) head, 10, 1, key); + sony_decrypt ((unsigned *) head, 10, 1, key); for (i=26; i-- > 22; ) key = key << 8 | head[i]; fseek (ifp, data_offset, SEEK_SET); @@ -2905,7 +3442,7 @@ #endif pixel = raw_image + row*raw_width; if (fread (pixel, 2, raw_width, ifp) < raw_width) derror(); - sony_decrypt ((unsigned int *) pixel, raw_width/2, !row, key); + sony_decrypt ((unsigned *) pixel, raw_width/2, !row, key); for (col=0; col < raw_width; col++) if ((pixel[col] = ntohs(pixel[col])) >> 14) derror(); } @@ -2914,14 +3451,15 @@ void CLASS sony_arw_load_raw() { - ushort huff[32768]; + ushort huff[32770]; static const ushort tab[18] = { 0xf11,0xf10,0xe0f,0xd0e,0xc0d,0xb0c,0xa0b,0x90a,0x809, 0x708,0x607,0x506,0x405,0x304,0x303,0x300,0x202,0x201 }; - int i, c, n, col, row, len, diff, sum=0; + int i, c, n, col, row, sum=0; + huff[0] = 15; for (n=i=0; i < 18; i++) - FORC(32768 >> (tab[i] >> 8)) huff[n++] = tab[i]; + FORC(32768 >> (tab[i] >> 8)) huff[++n] = tab[i]; getbits(-1); for (col = raw_width; col--; ) { @@ -2930,11 +3468,7 @@ #endif for (row=0; row < raw_height+1; row+=2) { if (row == raw_height) row = 1; - len = getbithuff(15,huff); - diff = getbits(len); - if ((diff & (1 << (len-1))) == 0) - diff -= (1 << len) - 1; - if ((sum += diff) >> 12) derror(); + if ((sum += ljpeg_diff(huff)) >> 12) derror(); if (row < height) RAW(row,col) = sum; } } @@ -2946,7 +3480,7 @@ ushort pix[16]; int row, col, val, max, min, imax, imin, sh, bit, i; - data = (uchar *) malloc (raw_width); + data = (uchar *) malloc (raw_width+1); merror (data, "sony_arw2_load_raw()"); #ifdef LIBRAW_LIBRARY_BUILD try { @@ -2962,6 +3496,52 @@ imax = 0x0f & val >> 22; imin = 0x0f & val >> 26; for (sh=0; sh < 4 && 0x80 << sh <= max-min; sh++); +#ifdef LIBRAW_LIBRARY_BUILD + /* flag checks if outside of loop */ + if(imgdata.params.sony_arw2_options == LIBRAW_SONYARW2_NONE + || imgdata.params.sony_arw2_options == LIBRAW_SONYARW2_DELTATOVALUE + ) + { + for (bit=30, i=0; i < 16; i++) + if (i == imax) pix[i] = max; + else if (i == imin) pix[i] = min; + else { + pix[i] = ((sget2(dp+(bit >> 3)) >> (bit & 7) & 0x7f) << sh) + min; + if (pix[i] > 0x7ff) pix[i] = 0x7ff; + bit += 7; + } + } + else if(imgdata.params.sony_arw2_options == LIBRAW_SONYARW2_BASEONLY) + { + for (bit=30, i=0; i < 16; i++) + if (i == imax) pix[i] = max; + else if (i == imin) pix[i] = min; + else pix[i]=0; + } + else if(imgdata.params.sony_arw2_options == LIBRAW_SONYARW2_DELTAONLY) + { + for (bit=30, i=0; i < 16; i++) + if (i == imax) pix[i] = 0; + else if (i == imin) pix[i] = 0; + else { + pix[i] = ((sget2(dp+(bit >> 3)) >> (bit & 7) & 0x7f) << sh) + min; + if (pix[i] > 0x7ff) pix[i] = 0x7ff; + bit += 7; + } + } + else if(imgdata.params.sony_arw2_options == LIBRAW_SONYARW2_DELTAZEROBASE) + { + for (bit=30, i=0; i < 16; i++) + if (i == imax) pix[i] = 0; + else if (i == imin) pix[i] = 0; + else { + pix[i] = ((sget2(dp+(bit >> 3)) >> (bit & 7) & 0x7f) << sh); + if (pix[i] > 0x7ff) pix[i] = 0x7ff; + bit += 7; + } + } +#else + /* unaltered dcraw processing */ for (bit=30, i=0; i < 16; i++) if (i == imax) pix[i] = max; else if (i == imin) pix[i] = min; @@ -2970,17 +3550,24 @@ if (pix[i] > 0x7ff) pix[i] = 0x7ff; bit += 7; } +#endif + #ifdef LIBRAW_LIBRARY_BUILD - if(imgdata.params.sony_arw2_hack) - { - for (i=0; i < 16; i++, col+=2) - RAW(row,col) = curve[pix[i] << 1]; - } + if(imgdata.params.sony_arw2_options == LIBRAW_SONYARW2_DELTATOVALUE) + { + for (i=0; i < 16; i++, col+=2) + { + unsigned slope = pix[i] < 1001? 2 : curve[pix[i]<<1]-curve[(pix[i]<<1)-2]; + unsigned step = 1 << sh; + RAW(row,col)=curve[pix[i]<<1]>black+imgdata.params.sony_arw2_posterization_thr? + LIM(((slope*step*1000)/(curve[pix[i]<<1]-black)),0,10000):0; + } + } else - { - for (i=0; i < 16; i++, col+=2) - RAW(row,col) = curve[pix[i] << 1] >> 2; - } + { + for (i=0; i < 16; i++, col+=2) + RAW(row,col) = curve[pix[i] << 1]; + } #else for (i=0; i < 16; i++, col+=2) RAW(row,col) = curve[pix[i] << 1] >> 2; @@ -2993,15 +3580,10 @@ free (data); throw; } + if(imgdata.params.sony_arw2_options == LIBRAW_SONYARW2_DELTATOVALUE) + maximum=10000; #endif free (data); -#ifdef LIBRAW_LIBRARY_BUILD - if(imgdata.params.sony_arw2_hack) - { - black <<= 2; - maximum <<=2; - } -#endif } void CLASS samsung_load_raw() @@ -3033,6 +3615,88 @@ } } } + for (row=0; row < raw_height-1; row+=2) + for (col=0; col < raw_width-1; col+=2) + SWAP (RAW(row,col+1), RAW(row+1,col)); +} + +void CLASS samsung2_load_raw() +{ + static const ushort tab[14] = + { 0x304,0x307,0x206,0x205,0x403,0x600,0x709, + 0x80a,0x90b,0xa0c,0xa0d,0x501,0x408,0x402 }; + ushort huff[1026], vpred[2][2] = {{0,0},{0,0}}, hpred[2]; + int i, c, n, row, col, diff; + + huff[0] = 10; + for (n=i=0; i < 14; i++) + FORC(1024 >> (tab[i] >> 8)) huff[++n] = tab[i]; + getbits(-1); + for (row=0; row < raw_height; row++) + { +#ifdef LIBRAW_LIBRARY_BUILD + checkCancel(); +#endif + for (col=0; col < raw_width; col++) { + diff = ljpeg_diff (huff); + if (col < 2) hpred[col] = vpred[row & 1][col] += diff; + else hpred[col & 1] += diff; + RAW(row,col) = hpred[col & 1]; + if (hpred[col & 1] >> tiff_bps) derror(); + } + } +} + +void CLASS samsung3_load_raw() +{ + int opt, init, mag, pmode, row, tab, col, pred, diff, i, c; + ushort lent[3][2], len[4], *prow[2]; + + order = 0x4949; + fseek (ifp, 9, SEEK_CUR); + opt = fgetc(ifp); + init = (get2(),get2()); + for (row=0; row < raw_height; row++) { +#ifdef LIBRAW_LIBRARY_BUILD + checkCancel(); +#endif + fseek (ifp, (data_offset-ftell(ifp)) & 15, SEEK_CUR); + ph1_bits(-1); + mag = 0; pmode = 7; + FORC(6) ((ushort *)lent)[c] = row < 2 ? 7:4; + prow[ row & 1] = &RAW(row-1,1-((row & 1) << 1)); // green + prow[~row & 1] = &RAW(row-2,0); // red and blue + for (tab=0; tab+15 < raw_width; tab+=16) { + if (~opt & 4 && !(tab & 63)) { + i = ph1_bits(2); + mag = i < 3 ? mag-'2'+"204"[i] : ph1_bits(12); + } + if (opt & 2) + pmode = 7 - 4*ph1_bits(1); + else if (!ph1_bits(1)) + pmode = ph1_bits(3); + if (opt & 1 || !ph1_bits(1)) { + FORC4 len[c] = ph1_bits(2); + FORC4 { + i = ((row & 1) << 1 | (c & 1)) % 3; + len[c] = len[c] < 3 ? lent[i][0]-'1'+"120"[len[c]] : ph1_bits(4); + lent[i][0] = lent[i][1]; + lent[i][1] = len[c]; + } + } + FORC(16) { + col = tab + (((c & 7) << 1)^(c >> 3)^(row & 1)); + pred = (pmode == 7 || row < 2) + ? (tab ? RAW(row,tab-2+(col & 1)) : init) + : (prow[col & 1][col-'4'+"0224468"[pmode]] + + prow[col & 1][col-'4'+"0244668"[pmode]] + 1) >> 1; + diff = ph1_bits (i = len[c >> 2]); + if (diff >> (i-1)) diff -= 1 << i; + diff = diff * (mag*2+1) + mag; + RAW(row,col) = pred + diff; + } + } + } } #define HOLE(row) ((holes >> (((row) - raw_height) & 7)) & 1) @@ -3156,10 +3820,10 @@ fseek (ifp, 67, SEEK_SET); offset = get4(); - nseg = fgetc(ifp); + nseg = (uchar) fgetc(ifp); fseek (ifp, offset, SEEK_SET); for (i=0; i < nseg*2; i++) - seg[0][i] = get4() + data_offset*(i & 1); + ((unsigned *)seg)[i] = get4() + data_offset*(i & 1); fseek (ifp, 78, SEEK_SET); holes = fgetc(ifp); fseek (ifp, 88, SEEK_SET); @@ -3194,10 +3858,10 @@ if (!jimg) longjmp (failure, 3); #else if(!jimg) - { - jas_stream_close (in); - throw LIBRAW_EXCEPTION_DECODE_JPEG2000; - } + { + jas_stream_close (in); + throw LIBRAW_EXCEPTION_DECODE_JPEG2000; + } #endif jmat = jas_matrix_create (height/2, width/2); merror (jmat, "redcine_load_raw()"); @@ -3447,7 +4111,7 @@ } } } - } + } #ifdef DCRAW_VERBOSE else fprintf (stderr,_("%s has unknown CAMF type %d.\n"), ifname, type); @@ -3625,7 +4289,7 @@ } if (!(cp = foveon_camf_param ("WhiteBalanceIlluminants", model2))) - { + { #ifdef DCRAW_VERBOSE fprintf (stderr,_("%s: Invalid white balance \"%s\"\n"), ifname, model2); #endif @@ -3678,8 +4342,8 @@ black = (float (*)[3]) calloc (height, sizeof *black); for (row=0; row < height; row++) { for (i=0; i < 6; i++) - ddft[0][0][i] = ddft[1][0][i] + - row / (height-1.0) * (ddft[2][0][i] - ddft[1][0][i]); + ((float *)ddft[0])[i] = ((float *)ddft[1])[i] + + row / (height-1.0) * (((float *)ddft[2])[i] - ((float *)ddft[1])[i]); FORC3 black[row][c] = ( foveon_avg (image[row*width]+c, dscr[0], cfilt) + foveon_avg (image[row*width]+c, dscr[1], cfilt) * 3 @@ -3724,8 +4388,8 @@ for (row=0; row < height; row++) { for (i=0; i < 6; i++) - ddft[0][0][i] = ddft[1][0][i] + - row / (height-1.0) * (ddft[2][0][i] - ddft[1][0][i]); + ((float *)ddft[0])[i] = ((float *)ddft[1])[i] + + row / (height-1.0) * (((float *)ddft[2])[i] - ((float *)ddft[1])[i]); pix = image[row*width]; memcpy (prev, pix, sizeof prev); frow = row / (height-1.0) * (dim[2]-1); @@ -3764,7 +4428,7 @@ free (sgrow); free (sgain); - if ((badpix = (unsigned int *) foveon_camf_matrix (dim, "BadPixels"))) { + if ((badpix = (unsigned *) foveon_camf_matrix (dim, "BadPixels"))) { for (i=0; i < dim[0]; i++) { col = (badpix[i] >> 8 & 0xfff) - keep[0]; row = (badpix[i] >> 20 ) - keep[1]; @@ -3986,7 +4650,7 @@ void CLASS crop_masked_pixels() { int row, col; - unsigned + unsigned #ifndef LIBRAW_LIBRARY_BUILD r, raw_pitch = raw_width*2, c, m, mblack[8], zero, val; @@ -4019,11 +4683,11 @@ BAYER2(row,col) = RAW(row+top_margin,col+left_margin); } #endif - if (mask[0][3]) goto mask_set; + if (mask[0][3] > 0) goto mask_set; if (load_raw == &CLASS canon_load_raw || load_raw == &CLASS lossless_jpeg_load_raw) { - mask[0][1] = mask[1][1] = 2; - mask[0][3] = -2; + mask[0][1] = mask[1][1] += 2; + mask[0][3] -= 2; goto sides; } if (load_raw == &CLASS canon_600_load_raw || @@ -4058,8 +4722,10 @@ #ifndef LIBRAW_LIBRARY_BUILD canon_600_correct(); #endif - } else if (zero < mblack[4] && mblack[5] && mblack[6] && mblack[7]) + } else if (zero < mblack[4] && mblack[5] && mblack[6] && mblack[7]) { FORC4 cblack[c] = mblack[c] / mblack[4+c]; + cblack[4] = cblack[5] = cblack[6] = 0; + } } #ifdef LIBRAW_LIBRARY_BUILD #undef mblack @@ -4202,7 +4868,7 @@ if (!(fp = fopen (fname, "rb"))) { #ifdef DCRAW_VERBOSE - perror (fname); + perror (fname); #endif #ifdef LIBRAW_LIBRARY_BUILD imgdata.process_warnings |= LIBRAW_WARN_BAD_DARKFRAME_FILE; @@ -4254,6 +4920,41 @@ //@end FILEIO //@out COMMON + +static const uchar xlat[2][256] = { + { 0xc1,0xbf,0x6d,0x0d,0x59,0xc5,0x13,0x9d,0x83,0x61,0x6b,0x4f,0xc7,0x7f,0x3d,0x3d, + 0x53,0x59,0xe3,0xc7,0xe9,0x2f,0x95,0xa7,0x95,0x1f,0xdf,0x7f,0x2b,0x29,0xc7,0x0d, + 0xdf,0x07,0xef,0x71,0x89,0x3d,0x13,0x3d,0x3b,0x13,0xfb,0x0d,0x89,0xc1,0x65,0x1f, + 0xb3,0x0d,0x6b,0x29,0xe3,0xfb,0xef,0xa3,0x6b,0x47,0x7f,0x95,0x35,0xa7,0x47,0x4f, + 0xc7,0xf1,0x59,0x95,0x35,0x11,0x29,0x61,0xf1,0x3d,0xb3,0x2b,0x0d,0x43,0x89,0xc1, + 0x9d,0x9d,0x89,0x65,0xf1,0xe9,0xdf,0xbf,0x3d,0x7f,0x53,0x97,0xe5,0xe9,0x95,0x17, + 0x1d,0x3d,0x8b,0xfb,0xc7,0xe3,0x67,0xa7,0x07,0xf1,0x71,0xa7,0x53,0xb5,0x29,0x89, + 0xe5,0x2b,0xa7,0x17,0x29,0xe9,0x4f,0xc5,0x65,0x6d,0x6b,0xef,0x0d,0x89,0x49,0x2f, + 0xb3,0x43,0x53,0x65,0x1d,0x49,0xa3,0x13,0x89,0x59,0xef,0x6b,0xef,0x65,0x1d,0x0b, + 0x59,0x13,0xe3,0x4f,0x9d,0xb3,0x29,0x43,0x2b,0x07,0x1d,0x95,0x59,0x59,0x47,0xfb, + 0xe5,0xe9,0x61,0x47,0x2f,0x35,0x7f,0x17,0x7f,0xef,0x7f,0x95,0x95,0x71,0xd3,0xa3, + 0x0b,0x71,0xa3,0xad,0x0b,0x3b,0xb5,0xfb,0xa3,0xbf,0x4f,0x83,0x1d,0xad,0xe9,0x2f, + 0x71,0x65,0xa3,0xe5,0x07,0x35,0x3d,0x0d,0xb5,0xe9,0xe5,0x47,0x3b,0x9d,0xef,0x35, + 0xa3,0xbf,0xb3,0xdf,0x53,0xd3,0x97,0x53,0x49,0x71,0x07,0x35,0x61,0x71,0x2f,0x43, + 0x2f,0x11,0xdf,0x17,0x97,0xfb,0x95,0x3b,0x7f,0x6b,0xd3,0x25,0xbf,0xad,0xc7,0xc5, + 0xc5,0xb5,0x8b,0xef,0x2f,0xd3,0x07,0x6b,0x25,0x49,0x95,0x25,0x49,0x6d,0x71,0xc7 }, + { 0xa7,0xbc,0xc9,0xad,0x91,0xdf,0x85,0xe5,0xd4,0x78,0xd5,0x17,0x46,0x7c,0x29,0x4c, + 0x4d,0x03,0xe9,0x25,0x68,0x11,0x86,0xb3,0xbd,0xf7,0x6f,0x61,0x22,0xa2,0x26,0x34, + 0x2a,0xbe,0x1e,0x46,0x14,0x68,0x9d,0x44,0x18,0xc2,0x40,0xf4,0x7e,0x5f,0x1b,0xad, + 0x0b,0x94,0xb6,0x67,0xb4,0x0b,0xe1,0xea,0x95,0x9c,0x66,0xdc,0xe7,0x5d,0x6c,0x05, + 0xda,0xd5,0xdf,0x7a,0xef,0xf6,0xdb,0x1f,0x82,0x4c,0xc0,0x68,0x47,0xa1,0xbd,0xee, + 0x39,0x50,0x56,0x4a,0xdd,0xdf,0xa5,0xf8,0xc6,0xda,0xca,0x90,0xca,0x01,0x42,0x9d, + 0x8b,0x0c,0x73,0x43,0x75,0x05,0x94,0xde,0x24,0xb3,0x80,0x34,0xe5,0x2c,0xdc,0x9b, + 0x3f,0xca,0x33,0x45,0xd0,0xdb,0x5f,0xf5,0x52,0xc3,0x21,0xda,0xe2,0x22,0x72,0x6b, + 0x3e,0xd0,0x5b,0xa8,0x87,0x8c,0x06,0x5d,0x0f,0xdd,0x09,0x19,0x93,0xd0,0xb9,0xfc, + 0x8b,0x0f,0x84,0x60,0x33,0x1c,0x9b,0x45,0xf1,0xf0,0xa3,0x94,0x3a,0x12,0x77,0x33, + 0x4d,0x44,0x78,0x28,0x3c,0x9e,0xfd,0x65,0x57,0x16,0x94,0x6b,0xfb,0x59,0xd0,0xc8, + 0x22,0x36,0xdb,0xd2,0x63,0x98,0x43,0xa1,0x04,0x87,0x86,0xf7,0xa6,0x26,0xbb,0xd6, + 0x59,0x4d,0xbf,0x6a,0x2e,0xaa,0x2b,0xef,0xe6,0x78,0xb6,0x4e,0xe0,0x2f,0xdc,0x7c, + 0xbe,0x57,0x19,0x32,0x7e,0x2a,0xd0,0xb8,0xba,0x29,0x00,0x3c,0x52,0x7d,0xa8,0x49, + 0x3b,0x2d,0xeb,0x25,0x49,0xfa,0xa3,0xaa,0x39,0xa7,0xc5,0xa7,0x50,0x11,0x36,0xfb, + 0xc6,0x67,0x4a,0xf5,0xa5,0x12,0x65,0x7e,0xb0,0xdf,0xaf,0x4e,0xb3,0x61,0x7f,0x2f } }; + void CLASS gamma_curve (double pwr, double ts, int mode, int imax) { int i; @@ -4318,7 +5019,7 @@ out[i][j] += work[j][k+3] * in[i][k]; } -void CLASS cam_xyz_coeff (double cam_xyz[4][3]) +void CLASS cam_xyz_coeff (float _rgb_cam[3][4], double cam_xyz[4][3]) { double cam_rgb[4][3], inverse[4][3], num; int i, j, k; @@ -4345,9 +5046,9 @@ } } pseudoinverse (cam_rgb, inverse, colors); - for (raw_color = i=0; i < 3; i++) + for (i=0; i < 3; i++) for (j=0; j < colors; j++) - rgb_cam[i][j] = inverse[j][i]; + _rgb_cam[i][j] = inverse[j][i]; } #ifdef COLORCHECK @@ -4384,8 +5085,8 @@ { 0.310, 0.316, 9.0 }, // Neutral 3.5 { 0.310, 0.316, 3.1 } }; // Black double gmb_cam[NSQ][4], gmb_xyz[NSQ][3]; - double inverse[NSQ][3], cam_xyz[4][3], num; - int c, i, j, k, sq, row, col, count[4]; + double inverse[NSQ][3], cam_xyz[4][3], balance[4], num; + int c, i, j, k, sq, row, col, pass, count[4]; memset (gmb_cam, 0, sizeof gmb_cam); for (sq=0; sq < NSQ; sq++) { @@ -4394,7 +5095,8 @@ for (col=cut[sq][2]; col < cut[sq][2]+cut[sq][0]; col++) { c = FC(row,col); if (c >= colors) c -= 2; - gmb_cam[sq][c] += BAYER(row,col); + gmb_cam[sq][c] += BAYER2(row,col); + BAYER2(row,col) = black + (BAYER2(row,col)-black)/2; count[c]++; } FORCC gmb_cam[sq][c] = gmb_cam[sq][c]/count[c] - black; @@ -4404,11 +5106,16 @@ (1 - gmb_xyY[sq][0] - gmb_xyY[sq][1]) / gmb_xyY[sq][1]; } pseudoinverse (gmb_xyz, inverse, NSQ); - for (i=0; i < colors; i++) - for (j=0; j < 3; j++) - for (cam_xyz[i][j] = k=0; k < NSQ; k++) - cam_xyz[i][j] += gmb_cam[k][i] * inverse[k][j]; - cam_xyz_coeff (cam_xyz); + for (pass=0; pass < 2; pass++) { + for (raw_color = i=0; i < colors; i++) + for (j=0; j < 3; j++) + for (cam_xyz[i][j] = k=0; k < NSQ; k++) + cam_xyz[i][j] += gmb_cam[k][i] * inverse[k][j]; + cam_xyz_coeff (rgb_cam, cam_xyz); + FORCC balance[c] = pre_mul[c] * gmb_cam[20][c]; + for (sq=0; sq < NSQ; sq++) + FORCC gmb_cam[sq][c] *= balance[c]; + } if (verbose) { printf (" { \"%s %s\", %d,\n\t{", make, model, black); num = 10000 / (cam_xyz[1][0] + cam_xyz[1][1] + cam_xyz[1][2]); @@ -4534,7 +5241,7 @@ temp = fimg + size*3; if ((nc = colors) == 3 && filters) nc++; #ifdef LIBRAW_LIBRARY_BUILD -#pragma omp parallel default(shared) private(i,col,row,thold,lev,lpass,hpass,temp,c) firstprivate(scale,size) +#pragma omp parallel default(shared) private(i,col,row,thold,lev,lpass,hpass,temp,c) firstprivate(scale,size) #endif { temp = (float*)malloc( (iheight + iwidth) * sizeof *fimg); @@ -4715,6 +5422,14 @@ sum[c] += val; sum[c+4]++; } +#ifdef LIBRAW_LIBRARY_BUILD + if(load_raw == &LibRaw::nikon_load_sraw) + { + // Nikon sRAW: camera WB already applied: + pre_mul[0]=pre_mul[1]=pre_mul[2]=pre_mul[3]=1.0; + } + else +#endif if (sum[0] && sum[1] && sum[2] && sum[3]) FORC4 pre_mul[c] = (float) sum[c+4] / sum[c]; else if (cam_mul[0] && cam_mul[2]) @@ -4729,6 +5444,16 @@ #endif } } +#ifdef LIBRAW_LIBRARY_BUILD + // Nikon sRAW, daylight + if (load_raw == &LibRaw::nikon_load_sraw + && !use_camera_wb && !use_auto_wb + && cam_mul[0] > 0.001f && cam_mul[1] > 0.001f && cam_mul[2] > 0.001f ) + { + for(c=0;c<3;c++) + pre_mul[c]/=cam_mul[c]; + } +#endif if (pre_mul[1] == 0) pre_mul[1] = 1; if (pre_mul[3] == 0) pre_mul[3] = colors < 4 ? pre_mul[1] : 1; dark = black; @@ -4751,16 +5476,23 @@ fputc ('\n', stderr); } #endif + if (filters > 1000 && (cblack[4]+1)/2 == 1 && (cblack[5]+1)/2 == 1) { + FORC4 cblack[FC(c/2,c%2)] += + cblack[6 + c/2 % cblack[4] * cblack[5] + c%2 % cblack[5]]; + cblack[4] = cblack[5] = 0; + } size = iheight*iwidth; #ifdef LIBRAW_LIBRARY_BUILD scale_colors_loop(scale_mul); #else for (i=0; i < size*4; i++) { - val = image[0][i]; - if (!val) continue; + if (!(val = ((ushort *)image)[i])) continue; + if (cblack[4] && cblack[5]) + val -= cblack[6 + i/4 / iwidth % cblack[4] * cblack[5] + + i/4 % iwidth % cblack[5]]; val -= cblack[i & 3]; val *= scale_mul[i & 3]; - image[0][i] = CLIP(val); + ((ushort *)image)[i] = CLIP(val); } #endif if ((aber[0] != 1 || aber[2] != 1) && colors == 3) { @@ -5197,7 +5929,7 @@ } #define TS 512 /* Tile Size */ -#define fcol(row,col) xtrans[(row+top_margin+6)%6][(col+left_margin+6)%6] +#define fcol(row,col) xtrans[(row+6) % 6][(col+6) % 6] /* Frank Markesteijn's algorithm for Fuji X-Trans sensors @@ -5223,7 +5955,6 @@ #endif cielab (0,0); - border_interpolate(6); ndir = 4 << (passes > 1); buffer = (char *) malloc (TS*TS*(ndir*11+6)); merror (buffer, "xtrans_interpolate()"); @@ -5337,14 +6068,19 @@ } /* Interpolate red for blue pixels and vice versa: */ - for (row=top+1; row < mrow-1; row++) - for (col=left+1; col < mcol-1; col++) { + for (row=top+3; row < mrow-3; row++) + for (col=left+3; col < mcol-3; col++) { if ((f = 2-fcol(row,col)) == 1) continue; rix = &rgb[0][row-top][col-left]; - i = (row-sgrow) % 3 ? TS:1; - for (d=0; d < 4; d++, rix += TS*TS) + c = (row-sgrow) % 3 ? TS:1; + h = 3 * (c ^ TS ^ 1); + for (d=0; d < 4; d++, rix += TS*TS) { + i = d > 1 || ((d ^ c) & 1) || + ((ABS(rix[0][1]-rix[c][1])+ABS(rix[0][1]-rix[-c][1])) < + 2*(ABS(rix[0][1]-rix[h][1])+ABS(rix[0][1]-rix[-h][1]))) ? c:h; rix[0][f] = CLIP((rix[i][f] + rix[-i][f] + 2*rix[0][1] - rix[i][1] - rix[-i][1])/2); + } } /* Fill in red and blue for 2x2 blocks of green: */ @@ -5423,6 +6159,7 @@ } } free(buffer); + border_interpolate(8); } #undef fcol @@ -5649,7 +6386,7 @@ #ifdef LIBRAW_USE_OPENMP if(0== omp_get_thread_num()) #endif - if(callbacks.progress_cb) { + if(callbacks.progress_cb) { int rr = (*callbacks.progress_cb)(callbacks.progresscb_data,LIBRAW_PROGRESS_INTERPOLATE,top-2,height-7); if(rr) terminate_flag = 1; @@ -5664,7 +6401,7 @@ } free (buffer); } -#ifdef LIBRAW_LIBRARY_BUILD +#ifdef LIBRAW_LIBRARY_BUILD if(terminate_flag) throw LIBRAW_EXCEPTION_CANCELLED_BY_CALLBACK; #endif @@ -5947,7 +6684,7 @@ *type = get2(); *len = get4(); *save = ftell(ifp) + 4; - if (*len * ("11124811248488"[*type < 14 ? *type:0]-'0') > 4) + if (*len * ("11124811248484"[*type < 14 ? *type:0]-'0') > 4) fseek (ifp, get4()+base, SEEK_SET); } @@ -5968,128 +6705,2551 @@ int CLASS parse_tiff_ifd (int base); //@out COMMON -void CLASS parse_makernote (int base, int uptag) + +static float powf_lim(float a, float b, float limup) { - static const uchar xlat[2][256] = { - { 0xc1,0xbf,0x6d,0x0d,0x59,0xc5,0x13,0x9d,0x83,0x61,0x6b,0x4f,0xc7,0x7f,0x3d,0x3d, - 0x53,0x59,0xe3,0xc7,0xe9,0x2f,0x95,0xa7,0x95,0x1f,0xdf,0x7f,0x2b,0x29,0xc7,0x0d, - 0xdf,0x07,0xef,0x71,0x89,0x3d,0x13,0x3d,0x3b,0x13,0xfb,0x0d,0x89,0xc1,0x65,0x1f, - 0xb3,0x0d,0x6b,0x29,0xe3,0xfb,0xef,0xa3,0x6b,0x47,0x7f,0x95,0x35,0xa7,0x47,0x4f, - 0xc7,0xf1,0x59,0x95,0x35,0x11,0x29,0x61,0xf1,0x3d,0xb3,0x2b,0x0d,0x43,0x89,0xc1, - 0x9d,0x9d,0x89,0x65,0xf1,0xe9,0xdf,0xbf,0x3d,0x7f,0x53,0x97,0xe5,0xe9,0x95,0x17, - 0x1d,0x3d,0x8b,0xfb,0xc7,0xe3,0x67,0xa7,0x07,0xf1,0x71,0xa7,0x53,0xb5,0x29,0x89, - 0xe5,0x2b,0xa7,0x17,0x29,0xe9,0x4f,0xc5,0x65,0x6d,0x6b,0xef,0x0d,0x89,0x49,0x2f, - 0xb3,0x43,0x53,0x65,0x1d,0x49,0xa3,0x13,0x89,0x59,0xef,0x6b,0xef,0x65,0x1d,0x0b, - 0x59,0x13,0xe3,0x4f,0x9d,0xb3,0x29,0x43,0x2b,0x07,0x1d,0x95,0x59,0x59,0x47,0xfb, - 0xe5,0xe9,0x61,0x47,0x2f,0x35,0x7f,0x17,0x7f,0xef,0x7f,0x95,0x95,0x71,0xd3,0xa3, - 0x0b,0x71,0xa3,0xad,0x0b,0x3b,0xb5,0xfb,0xa3,0xbf,0x4f,0x83,0x1d,0xad,0xe9,0x2f, - 0x71,0x65,0xa3,0xe5,0x07,0x35,0x3d,0x0d,0xb5,0xe9,0xe5,0x47,0x3b,0x9d,0xef,0x35, - 0xa3,0xbf,0xb3,0xdf,0x53,0xd3,0x97,0x53,0x49,0x71,0x07,0x35,0x61,0x71,0x2f,0x43, - 0x2f,0x11,0xdf,0x17,0x97,0xfb,0x95,0x3b,0x7f,0x6b,0xd3,0x25,0xbf,0xad,0xc7,0xc5, - 0xc5,0xb5,0x8b,0xef,0x2f,0xd3,0x07,0x6b,0x25,0x49,0x95,0x25,0x49,0x6d,0x71,0xc7 }, - { 0xa7,0xbc,0xc9,0xad,0x91,0xdf,0x85,0xe5,0xd4,0x78,0xd5,0x17,0x46,0x7c,0x29,0x4c, - 0x4d,0x03,0xe9,0x25,0x68,0x11,0x86,0xb3,0xbd,0xf7,0x6f,0x61,0x22,0xa2,0x26,0x34, - 0x2a,0xbe,0x1e,0x46,0x14,0x68,0x9d,0x44,0x18,0xc2,0x40,0xf4,0x7e,0x5f,0x1b,0xad, - 0x0b,0x94,0xb6,0x67,0xb4,0x0b,0xe1,0xea,0x95,0x9c,0x66,0xdc,0xe7,0x5d,0x6c,0x05, - 0xda,0xd5,0xdf,0x7a,0xef,0xf6,0xdb,0x1f,0x82,0x4c,0xc0,0x68,0x47,0xa1,0xbd,0xee, - 0x39,0x50,0x56,0x4a,0xdd,0xdf,0xa5,0xf8,0xc6,0xda,0xca,0x90,0xca,0x01,0x42,0x9d, - 0x8b,0x0c,0x73,0x43,0x75,0x05,0x94,0xde,0x24,0xb3,0x80,0x34,0xe5,0x2c,0xdc,0x9b, - 0x3f,0xca,0x33,0x45,0xd0,0xdb,0x5f,0xf5,0x52,0xc3,0x21,0xda,0xe2,0x22,0x72,0x6b, - 0x3e,0xd0,0x5b,0xa8,0x87,0x8c,0x06,0x5d,0x0f,0xdd,0x09,0x19,0x93,0xd0,0xb9,0xfc, - 0x8b,0x0f,0x84,0x60,0x33,0x1c,0x9b,0x45,0xf1,0xf0,0xa3,0x94,0x3a,0x12,0x77,0x33, - 0x4d,0x44,0x78,0x28,0x3c,0x9e,0xfd,0x65,0x57,0x16,0x94,0x6b,0xfb,0x59,0xd0,0xc8, - 0x22,0x36,0xdb,0xd2,0x63,0x98,0x43,0xa1,0x04,0x87,0x86,0xf7,0xa6,0x26,0xbb,0xd6, - 0x59,0x4d,0xbf,0x6a,0x2e,0xaa,0x2b,0xef,0xe6,0x78,0xb6,0x4e,0xe0,0x2f,0xdc,0x7c, - 0xbe,0x57,0x19,0x32,0x7e,0x2a,0xd0,0xb8,0xba,0x29,0x00,0x3c,0x52,0x7d,0xa8,0x49, - 0x3b,0x2d,0xeb,0x25,0x49,0xfa,0xa3,0xaa,0x39,0xa7,0xc5,0xa7,0x50,0x11,0x36,0xfb, - 0xc6,0x67,0x4a,0xf5,0xa5,0x12,0x65,0x7e,0xb0,0xdf,0xaf,0x4e,0xb3,0x61,0x7f,0x2f } }; - unsigned offset=0, entries, tag, type, len, save, c; - unsigned ver97=0, serial=0, i, wbi=0, wb[4]={0,0,0,0}; - uchar buf97[324], ci, cj, ck; - short morder, sorder=order; - char buf[10]; - unsigned SamsungKey[11]; - static const double rgb_adobe[3][3] = // inv(sRGB2XYZ_D65) * AdobeRGB2XYZ_D65 - {{ 1.398283396477404, -0.398283116703571, 4.427165001263944E-08}, - {-1.233904514232401E-07, 0.999999995196570, 3.126724276714121e-08}, - { 4.561487232726535E-08, -0.042938290466635, 1.042938250416105 }}; - - float adobe_cam [3][3]; + return (b>limup || b < -limup)?0.f:powf(a,b); +} +static float powf64(float a, float b) +{ + return powf_lim(a,b,64.f); +} -/* - The MakerNote might have its own TIFF header (possibly with - its own byte-order!), or it might just be a table. - */ - if (!strcmp(make,"Nokia")) return; - fread (buf, 1, 10, ifp); - if (!strncmp (buf,"KDK" ,3) || /* these aren't TIFF tables */ - !strncmp (buf,"VER" ,3) || - !strncmp (buf,"IIII",4) || - !strncmp (buf,"MMMM",4)) return; - if (!strncmp (buf,"KC" ,2) || /* Konica KD-400Z, KD-510Z */ - !strncmp (buf,"MLY" ,3)) { /* Minolta DiMAGE G series */ - order = 0x4d4d; - while ((i=ftell(ifp)) < data_offset && i < 16384) { - wb[0] = wb[2]; wb[2] = wb[1]; wb[1] = wb[3]; - wb[3] = get2(); - if (wb[1] == 256 && wb[3] == 256 && - wb[0] > 256 && wb[0] < 640 && wb[2] > 256 && wb[2] < 640) - FORC4 cam_mul[c] = wb[c]; - } - goto quit; - } - if (!strcmp (buf,"Nikon")) { - base = ftell(ifp); - order = get2(); - if (get2() != 42) goto quit; - offset = get4(); - fseek (ifp, offset-8, SEEK_CUR); - } else if (!strcmp (buf,"OLYMPUS")) { - base = ftell(ifp)-10; - fseek (ifp, -2, SEEK_CUR); - order = get2(); get2(); - } else if (!strncmp (buf,"SONY",4) || - !strcmp (buf,"Panasonic")) { - goto nf; - } else if (!strncmp (buf,"FUJIFILM",8)) { - base = ftell(ifp)-10; -nf: order = 0x4949; - fseek (ifp, 2, SEEK_CUR); - } else if (!strcmp (buf,"OLYMP") || - !strcmp (buf,"LEICA") || - !strcmp (buf,"Ricoh") || - !strcmp (buf,"EPSON")) - fseek (ifp, -2, SEEK_CUR); - else if (!strcmp (buf,"AOC") || - !strcmp (buf,"QVC")) - fseek (ifp, -4, SEEK_CUR); - else { - fseek (ifp, -10, SEEK_CUR); - if (!strncmp(make,"SAMSUNG",7)) - base = ftell(ifp); + +#ifdef LIBRAW_LIBRARY_BUILD + +static float my_roundf(float x) { + float t; + if (x >= 0.0) { + t = ceilf(x); + if (t - x > 0.5) t -= 1.0; + return t; + } else { + t = ceilf(-x); + if (t + x > 0.5) t -= 1.0; + return -t; } - entries = get2(); - if (entries > 1000) return; - morder = order; - while (entries--) { - order = morder; +} + +static float _CanonConvertAperture(ushort in) +{ + if ((in == (ushort)0xffe0) || (in == (ushort)0x7fff)) return 0.0f; + return powf64(2.0, in/64.0); +} + +void CLASS setCanonBodyFeatures (unsigned id) + { + imgdata.lens.makernotes.CamID = id; + if ( + (id == 0x80000001) || // 1D + (id == 0x80000174) || // 1D2 + (id == 0x80000232) || // 1D2N + (id == 0x80000169) || // 1D3 + (id == 0x80000281) // 1D4 + ) + { + imgdata.lens.makernotes.CameraFormat = LIBRAW_FORMAT_APSH; + imgdata.lens.makernotes.CameraMount = LIBRAW_MOUNT_Canon_EF; + } + else + if ( + (id == 0x80000167) || // 1Ds + (id == 0x80000188) || // 1Ds2 + (id == 0x80000215) || // 1Ds3 + (id == 0x80000213) || // 5D + (id == 0x80000218) || // 5D2 + (id == 0x80000285) || // 5D3 + (id == 0x80000302) || // 6D + (id == 0x80000269) || // 1DX + (id == 0x80000324) || // 1DC + (id == 0x80000382) || // 5DS + (id == 0x80000401) // 5DS R + ) + { + imgdata.lens.makernotes.CameraFormat = LIBRAW_FORMAT_FF; + imgdata.lens.makernotes.CameraMount = LIBRAW_MOUNT_Canon_EF; + } + else + if ( + (id == 0x80000331) || // M + (id == 0x80000355) || // M2 + (id == 0x80000374) // M3 + ) + { + imgdata.lens.makernotes.CameraFormat = LIBRAW_FORMAT_APSC; + imgdata.lens.makernotes.CameraMount = LIBRAW_MOUNT_Canon_EF_M; + } + else + if ( + (id == 0x01140000) || // D30 + (id == 0x01668000) || // D60 + (id > 0x80000000) + ) + { + imgdata.lens.makernotes.CameraFormat = LIBRAW_FORMAT_APSC; + imgdata.lens.makernotes.CameraMount = LIBRAW_MOUNT_Canon_EF; + imgdata.lens.makernotes.LensMount = LIBRAW_MOUNT_Unknown; + } + else + { + imgdata.lens.makernotes.CameraMount = LIBRAW_MOUNT_FixedLens; + imgdata.lens.makernotes.LensMount = LIBRAW_MOUNT_FixedLens; + } + + return; + } + +void CLASS processCanonCameraInfo (unsigned id, uchar *CameraInfo, unsigned maxlen) +{ + ushort iCanonLensID = 0, iCanonMaxFocal = 0, iCanonMinFocal = 0, iCanonLens = 0, iCanonCurFocal = 0, iCanonFocalType = 0; + CameraInfo[0] = 0; + CameraInfo[1] = 0; + switch (id) { + case 0x80000001: // 1D + case 0x80000167: // 1DS + iCanonCurFocal = 10; + iCanonLensID = 13; + iCanonMinFocal = 14; + iCanonMaxFocal = 16; + if (!imgdata.lens.makernotes.CurFocal) + imgdata.lens.makernotes.CurFocal = sget2(CameraInfo + iCanonCurFocal); + if (!imgdata.lens.makernotes.MinFocal) + imgdata.lens.makernotes.MinFocal = sget2(CameraInfo + iCanonMinFocal); + if (!imgdata.lens.makernotes.MaxFocal) + imgdata.lens.makernotes.MaxFocal = sget2(CameraInfo + iCanonMaxFocal); + break; + case 0x80000174: // 1DMkII + case 0x80000188: // 1DsMkII + iCanonCurFocal = 9; + iCanonLensID = 12; + iCanonMinFocal = 17; + iCanonMaxFocal = 19; + iCanonFocalType = 45; + break; + case 0x80000232: // 1DMkII N + iCanonCurFocal = 9; + iCanonLensID = 12; + iCanonMinFocal = 17; + iCanonMaxFocal = 19; + break; + case 0x80000169: // 1DMkIII + case 0x80000215: // 1DsMkIII + iCanonCurFocal = 29; + iCanonLensID = 273; + iCanonMinFocal = 275; + iCanonMaxFocal = 277; + break; + case 0x80000281: // 1DMkIV + iCanonCurFocal = 30; + iCanonLensID = 335; + iCanonMinFocal = 337; + iCanonMaxFocal = 339; + break; + case 0x80000269: // 1D X + iCanonCurFocal = 35; + iCanonLensID = 423; + iCanonMinFocal = 425; + iCanonMaxFocal = 427; + break; + case 0x80000213: // 5D + iCanonCurFocal = 40; + if (!sget2Rev(CameraInfo + 12)) iCanonLensID = 151; + else iCanonLensID = 12; + iCanonMinFocal = 147; + iCanonMaxFocal = 149; + break; + case 0x80000218: // 5DMkII + iCanonCurFocal = 30; + iCanonLensID = 230; + iCanonMinFocal = 232; + iCanonMaxFocal = 234; + break; + case 0x80000285: // 5DMkIII + iCanonCurFocal = 35; + iCanonLensID = 339; + iCanonMinFocal = 341; + iCanonMaxFocal = 343; + break; + case 0x80000302: // 6D + iCanonCurFocal = 35; + iCanonLensID = 353; + iCanonMinFocal = 355; + iCanonMaxFocal = 357; + break; + case 0x80000250: // 7D + iCanonCurFocal = 30; + iCanonLensID = 274; + iCanonMinFocal = 276; + iCanonMaxFocal = 278; + break; + case 0x80000190: // 40D + iCanonCurFocal = 29; + iCanonLensID = 214; + iCanonMinFocal = 216; + iCanonMaxFocal = 218; + iCanonLens = 2347; + break; + case 0x80000261: // 50D + iCanonCurFocal = 30; + iCanonLensID = 234; + iCanonMinFocal = 236; + iCanonMaxFocal = 238; + break; + case 0x80000287: // 60D + iCanonCurFocal = 30; + iCanonLensID = 232; + iCanonMinFocal = 234; + iCanonMaxFocal = 236; + break; + case 0x80000325: // 70D + iCanonCurFocal = 35; + iCanonLensID = 358; + iCanonMinFocal = 360; + iCanonMaxFocal = 362; + break; + case 0x80000176: // 450D + iCanonCurFocal = 29; + iCanonLensID = 222; + iCanonLens = 2355; + break; + case 0x80000252: // 500D + iCanonCurFocal = 30; + iCanonLensID = 246; + iCanonMinFocal = 248; + iCanonMaxFocal = 250; + break; + case 0x80000270: // 550D + iCanonCurFocal = 30; + iCanonLensID = 255; + iCanonMinFocal = 257; + iCanonMaxFocal = 259; + break; + case 0x80000286: // 600D + case 0x80000288: // 1100D + iCanonCurFocal = 30; + iCanonLensID = 234; + iCanonMinFocal = 236; + iCanonMaxFocal = 238; + break; + case 0x80000301: // 650D + case 0x80000326: // 700D + iCanonCurFocal = 35; + iCanonLensID = 295; + iCanonMinFocal = 297; + iCanonMaxFocal = 299; + break; + case 0x80000254: // 1000D + iCanonCurFocal = 29; + iCanonLensID = 226; + iCanonMinFocal = 228; + iCanonMaxFocal = 230; + iCanonLens = 2359; + break; + } + if (iCanonFocalType) + { + if(iCanonFocalType>=maxlen) return; // broken; + imgdata.lens.makernotes.FocalType = CameraInfo[iCanonFocalType]; + if (!imgdata.lens.makernotes.FocalType) // zero means 'fixed' here, replacing with standard '1' + imgdata.lens.makernotes.FocalType = 1; + } + if (!imgdata.lens.makernotes.CurFocal) + { + if(iCanonCurFocal>=maxlen) return; // broken; + imgdata.lens.makernotes.CurFocal = sget2Rev(CameraInfo + iCanonCurFocal); + } + if (!imgdata.lens.makernotes.LensID) + { + if(iCanonLensID>=maxlen) return; // broken; + imgdata.lens.makernotes.LensID = sget2Rev(CameraInfo + iCanonLensID); + } + if (!imgdata.lens.makernotes.MinFocal) + { + if(iCanonMinFocal>=maxlen) return; // broken; + imgdata.lens.makernotes.MinFocal = sget2Rev(CameraInfo + iCanonMinFocal); + } + if (!imgdata.lens.makernotes.MaxFocal) + { + if(iCanonMaxFocal>=maxlen) return; // broken; + imgdata.lens.makernotes.MaxFocal = sget2Rev(CameraInfo + iCanonMaxFocal); + } + if (!imgdata.lens.makernotes.Lens[0] && iCanonLens) { + if(iCanonLens+64>=maxlen) return; // broken; + if (CameraInfo[iCanonLens] < 65) // non-Canon lens + { + memcpy(imgdata.lens.makernotes.Lens, CameraInfo + iCanonLens, 64); + } + else if (!strncmp((char *)CameraInfo + iCanonLens, "EF-S", 4)) + { + memcpy(imgdata.lens.makernotes.Lens, "EF-S ", 5); + memcpy(imgdata.lens.makernotes.LensFeatures_pre, "EF-E", 4); + imgdata.lens.makernotes.LensMount = LIBRAW_MOUNT_Canon_EF_S; + memcpy(imgdata.lens.makernotes.Lens + 5, CameraInfo + iCanonLens + 4, 60); + } + else if (!strncmp((char *)CameraInfo + iCanonLens, "TS-E", 4)) { + memcpy(imgdata.lens.makernotes.Lens, "TS-E ", 5); + memcpy(imgdata.lens.makernotes.LensFeatures_pre, "TS-E", 4); + imgdata.lens.makernotes.LensMount = LIBRAW_MOUNT_Canon_EF; + memcpy(imgdata.lens.makernotes.Lens + 5, CameraInfo + iCanonLens + 4, 60); + } + else if (!strncmp((char *)CameraInfo + iCanonLens, "MP-E", 4)) { + memcpy(imgdata.lens.makernotes.Lens, "MP-E ", 5); + memcpy(imgdata.lens.makernotes.LensFeatures_pre, "MP-E", 4); + imgdata.lens.makernotes.LensMount = LIBRAW_MOUNT_Canon_EF; + memcpy(imgdata.lens.makernotes.Lens + 5, CameraInfo + iCanonLens + 4, 60); + } + else if (!strncmp((char *)CameraInfo + iCanonLens, "EF-M", 4)) { + memcpy(imgdata.lens.makernotes.Lens, "EF-M ", 5); + memcpy(imgdata.lens.makernotes.LensFeatures_pre, "EF-M", 4); + imgdata.lens.makernotes.LensMount = LIBRAW_MOUNT_Canon_EF_M; + memcpy(imgdata.lens.makernotes.Lens + 5, CameraInfo + iCanonLens + 4, 60); + } + else { + memcpy(imgdata.lens.makernotes.Lens, CameraInfo + iCanonLens, 2); + memcpy(imgdata.lens.makernotes.LensFeatures_pre, "EF", 2); + imgdata.lens.makernotes.LensMount = LIBRAW_MOUNT_Canon_EF; + imgdata.lens.makernotes.Lens[2] = 32; + memcpy(imgdata.lens.makernotes.Lens + 3, CameraInfo + iCanonLens + 2, 62); + } + } + return; +} + +void CLASS processNikonLensData (uchar *LensData, unsigned len) +{ + ushort i; + if (!(imgdata.lens.nikon.NikonLensType & 0x01)) + { + imgdata.lens.makernotes.LensFeatures_pre[0] = 'A'; + imgdata.lens.makernotes.LensFeatures_pre[1] = 'F'; + } + else + { + imgdata.lens.makernotes.LensFeatures_pre[0] = 'M'; + imgdata.lens.makernotes.LensFeatures_pre[1] = 'F'; + } + + if (imgdata.lens.nikon.NikonLensType & 0x02) + { + if (imgdata.lens.nikon.NikonLensType & 0x04) + imgdata.lens.makernotes.LensFeatures_suf[0] = 'G'; + else + imgdata.lens.makernotes.LensFeatures_suf[0] = 'D'; + imgdata.lens.makernotes.LensFeatures_suf[1] = ' '; + } + + if (imgdata.lens.nikon.NikonLensType & 0x08) + { + imgdata.lens.makernotes.LensFeatures_suf[2] = 'V'; + imgdata.lens.makernotes.LensFeatures_suf[3] = 'R'; + } + + if (imgdata.lens.nikon.NikonLensType & 0x10) + imgdata.lens.makernotes.LensMount = LIBRAW_MOUNT_Nikon_CX; + else + imgdata.lens.makernotes.LensMount = LIBRAW_MOUNT_Nikon_F; + + if (imgdata.lens.nikon.NikonLensType & 0x20) + { + strcpy(imgdata.lens.makernotes.Adapter, "FT-1"); + imgdata.lens.makernotes.LensMount = LIBRAW_MOUNT_Nikon_F; + } + + imgdata.lens.nikon.NikonLensType = imgdata.lens.nikon.NikonLensType & 0xdf; + + if (len < 20) { + switch (len) { + case 9: + i = 2; + break; + case 15: + i = 7; + break; + case 16: + i = 8; + break; + } + imgdata.lens.nikon.NikonLensIDNumber = LensData[i]; + imgdata.lens.nikon.NikonLensFStops = LensData[i + 1]; + imgdata.lens.makernotes.LensFStops = (float)imgdata.lens.nikon.NikonLensFStops /12.0f; + if (fabsf(imgdata.lens.makernotes.MinFocal) < 1.1f) + { + if ((imgdata.lens.nikon.NikonLensType ^ (uchar)0x01) || LensData[i + 2]) + imgdata.lens.makernotes.MinFocal = 5.0f * powf64(2.0f, (float)LensData[i + 2] / 24.0f); + if ((imgdata.lens.nikon.NikonLensType ^ (uchar)0x01) || LensData[i + 3]) + imgdata.lens.makernotes.MaxFocal = 5.0f * powf64(2.0f, (float)LensData[i + 3] / 24.0f); + if ((imgdata.lens.nikon.NikonLensType ^ (uchar)0x01) || LensData[i + 4]) + imgdata.lens.makernotes.MaxAp4MinFocal = powf64(2.0f, (float)LensData[i + 4] / 24.0f); + if ((imgdata.lens.nikon.NikonLensType ^ (uchar)0x01) || LensData[i + 5]) + imgdata.lens.makernotes.MaxAp4MaxFocal = powf64(2.0f, (float)LensData[i + 5] / 24.0f); + } + imgdata.lens.nikon.NikonMCUVersion = LensData[i + 6]; + if (i != 2) + { + if ((LensData[i - 1]) && + (fabsf(imgdata.lens.makernotes.CurFocal) < 1.1f)) + imgdata.lens.makernotes.CurFocal = 5.0f * powf64(2.0f, (float)LensData[i - 1] / 24.0f); + if (LensData[i + 7]) imgdata.lens.nikon.NikonEffectiveMaxAp = powf64(2.0f, (float)LensData[i + 7] / 24.0f); + } + imgdata.lens.makernotes.LensID = + (unsigned long long) LensData[i] << 56 | + (unsigned long long) LensData[i + 1] << 48 | + (unsigned long long) LensData[i + 2] << 40 | + (unsigned long long) LensData[i + 3] << 32 | + (unsigned long long) LensData[i + 4] << 24 | + (unsigned long long) LensData[i + 5] << 16 | + (unsigned long long) LensData[i + 6] << 8 | + (unsigned long long) imgdata.lens.nikon.NikonLensType; + + } + else if ((len == 459) || (len == 590)) + { + memcpy(imgdata.lens.makernotes.Lens, LensData + 390, 64); + } + else if (len == 509) + { + memcpy(imgdata.lens.makernotes.Lens, LensData + 391, 64); + } + else if (len == 879) + { + memcpy(imgdata.lens.makernotes.Lens, LensData + 680, 64); + } + return; +} + +void CLASS setOlympusBodyFeatures (unsigned long long id) +{ + imgdata.lens.makernotes.CamID = id; + if ((id == 0x4434303430ULL) || // E-1 + (id == 0x4434303431ULL) || // E-300 + ((id & 0x00ffff0000ULL) == 0x0030300000ULL)) + { + imgdata.lens.makernotes.CameraFormat = LIBRAW_FORMAT_FT; + if ((id == 0x4434303430ULL) || // E-1 + (id == 0x4434303431ULL) || // E-330 + ((id >= 0x5330303033ULL) && (id <= 0x5330303138ULL)) || // E-330 to E-520 + (id == 0x5330303233ULL) || // E-620 + (id == 0x5330303239ULL) || // E-450 + (id == 0x5330303330ULL) || // E-600 + (id == 0x5330303333ULL)) // E-5 + { + imgdata.lens.makernotes.CameraMount = LIBRAW_MOUNT_FT; + } + else + { + imgdata.lens.makernotes.CameraMount = LIBRAW_MOUNT_mFT; + } + } + else + { + imgdata.lens.makernotes.LensMount = + imgdata.lens.makernotes.CameraMount = LIBRAW_MOUNT_FixedLens; + } + return; +} + +void CLASS setPentaxBodyFeatures (unsigned id) +{ + imgdata.lens.makernotes.CamID = id; + + switch (id) { + case 0x12994: + case 0x12aa2: + case 0x12b1a: + case 0x12b60: + case 0x12b62: + case 0x12b7e: + case 0x12b80: + case 0x12b9c: + case 0x12b9d: + case 0x12ba2: + case 0x12c1e: + case 0x12c20: + case 0x12cd2: + case 0x12cd4: + case 0x12cfa: + case 0x12d72: + case 0x12d73: + case 0x12db8: + case 0x12dfe: + case 0x12e6c: + case 0x12e76: + case 0x12ef8: + case 0x12f52: + case 0x12f70: + case 0x12f71: + case 0x12fb6: + case 0x12fc0: + case 0x12fca: + case 0x1301a: + case 0x13024: + case 0x1309c: + imgdata.lens.makernotes.LensMount = LIBRAW_MOUNT_Pentax_K; + imgdata.lens.makernotes.CameraMount = LIBRAW_MOUNT_Pentax_K; + imgdata.lens.makernotes.CameraFormat = LIBRAW_FORMAT_APSC; + break; + case 0x12e08: + case 0x13010: + imgdata.lens.makernotes.LensMount = LIBRAW_MOUNT_Pentax_645; + imgdata.lens.makernotes.LensFormat = LIBRAW_FORMAT_MF; + imgdata.lens.makernotes.CameraMount = LIBRAW_MOUNT_Pentax_645; + imgdata.lens.makernotes.CameraFormat = LIBRAW_FORMAT_MF; + break; + case 0x12ee4: + case 0x12f66: + case 0x12f7a: + case 0x1302e: + imgdata.lens.makernotes.LensMount = LIBRAW_MOUNT_Pentax_Q; + imgdata.lens.makernotes.CameraMount = LIBRAW_MOUNT_Pentax_Q; + break; + default: + imgdata.lens.makernotes.LensMount = LIBRAW_MOUNT_FixedLens; + imgdata.lens.makernotes.CameraMount = LIBRAW_MOUNT_FixedLens; + } + return; +} + +void CLASS PentaxLensInfo (unsigned id, unsigned len) // tag 0x0207 +{ + ushort iLensData = 0; + uchar *table_buf; + table_buf = (uchar*)malloc(MAX(len,128)); + fread(table_buf, len, 1, ifp); + if ((id < 0x12b9c) || + ((id == 0x12b9c) || // K100D + (id == 0x12b9d) || // K110D + (id == 0x12ba2) && // K100D Super + (!table_buf[20] || (table_buf[20] == 0xff)))) + { + iLensData = 3; + if (imgdata.lens.makernotes.LensID == -1) + imgdata.lens.makernotes.LensID = + (((unsigned)table_buf[0]) << 8) + table_buf[1]; + } + else switch (len) + { + case 90: // LensInfo3 + iLensData = 13; + if (imgdata.lens.makernotes.LensID == -1) + imgdata.lens.makernotes.LensID = + ((unsigned)((table_buf[1] & 0x0f) + table_buf[3]) <<8) + table_buf[4]; + break; + case 91: // LensInfo4 + iLensData = 12; + if (imgdata.lens.makernotes.LensID == -1) + imgdata.lens.makernotes.LensID = + ((unsigned)((table_buf[1] & 0x0f) + table_buf[3]) <<8) + table_buf[4]; + break; + case 80: // LensInfo5 + case 128: + iLensData = 15; + if (imgdata.lens.makernotes.LensID == -1) + imgdata.lens.makernotes.LensID = + ((unsigned)((table_buf[1] & 0x0f) + table_buf[4]) <<8) + table_buf[5]; + break; + default: + if (id >= 0x12b9c) // LensInfo2 + { + iLensData = 4; + if (imgdata.lens.makernotes.LensID == -1) + imgdata.lens.makernotes.LensID = + ((unsigned)((table_buf[0] & 0x0f) + table_buf[2]) <<8) + table_buf[3]; + } + } + if (iLensData) + { + if (table_buf[iLensData+9] && + (fabs(imgdata.lens.makernotes.CurFocal) < 0.1f)) + imgdata.lens.makernotes.CurFocal = + 10*(table_buf[iLensData+9]>>2) * powf64(4, (table_buf[iLensData+9] & 0x03)-2); + if (table_buf[iLensData+10] & 0xf0) + imgdata.lens.makernotes.MaxAp4CurFocal = + powf64(2.0f, (float)((table_buf[iLensData+10] & 0xf0) >>4)/4.0f); + if (table_buf[iLensData+10] & 0x0f) + imgdata.lens.makernotes.MinAp4CurFocal = + powf64(2.0f, (float)((table_buf[iLensData+10] & 0x0f) + 10)/4.0f); + + if (iLensData != 12) + { + switch (table_buf[iLensData] & 0x06) + { + case 0: imgdata.lens.makernotes.MinAp4MinFocal = 22.0f; break; + case 2: imgdata.lens.makernotes.MinAp4MinFocal = 32.0f; break; + case 4: imgdata.lens.makernotes.MinAp4MinFocal = 45.0f; break; + case 6: imgdata.lens.makernotes.MinAp4MinFocal = 16.0f; break; + } + if (table_buf[iLensData] & 0x70) + imgdata.lens.makernotes.LensFStops = + ((float)(((table_buf[iLensData] & 0x70) >> 4) ^ 0x07)) / 2.0f + 5.0f; + if ((table_buf[iLensData+14] > 1) && + (fabs(imgdata.lens.makernotes.MaxAp4CurFocal) < 0.7f)) + imgdata.lens.makernotes.MaxAp4CurFocal = + powf64(2.0f, (float)((table_buf[iLensData+14] & 0x7f) -1)/32.0f); + } + else if ((id != 0x12e76) && // K-5 + (table_buf[iLensData+15] > 1) && + (fabs(imgdata.lens.makernotes.MaxAp4CurFocal) < 0.7f)) + { + imgdata.lens.makernotes.MaxAp4CurFocal = + powf64(2.0f, (float)((table_buf[iLensData+15] & 0x7f) -1)/32.0f); + } + } + free(table_buf); + return; +} + +void CLASS setPhaseOneFeatures (unsigned id) { + + ushort i; + static const struct { + ushort id; + char t_model[32]; + } p1_unique[] = { + // Phase One section: + {1, "Hasselblad V"}, + {10, "PhaseOne/Mamiya"}, + {12, "Contax 645"}, + {16, "Hasselblad V"}, + {17, "Hasselblad V"}, + {18, "Contax 645"}, + {19, "PhaseOne/Mamiya"}, + {20, "Hasselblad V"}, + {21, "Contax 645"}, + {22, "PhaseOne/Mamiya"}, + {23, "Hasselblad V"}, + {24, "Hasselblad H"}, + {25, "PhaseOne/Mamiya"}, + {32, "Contax 645"}, + {34, "Hasselblad V"}, + {35, "Hasselblad V"}, + {36, "Hasselblad H"}, + {37, "Contax 645"}, + {38, "PhaseOne/Mamiya"}, + {39, "Hasselblad V"}, + {40, "Hasselblad H"}, + {41, "Contax 645"}, + {42, "PhaseOne/Mamiya"}, + {44, "Hasselblad V"}, + {45, "Hasselblad H"}, + {46, "Contax 645"}, + {47, "PhaseOne/Mamiya"}, + {48, "Hasselblad V"}, + {49, "Hasselblad H"}, + {50, "Contax 645"}, + {51, "PhaseOne/Mamiya"}, + {52, "Hasselblad V"}, + {53, "Hasselblad H"}, + {54, "Contax 645"}, + {55, "PhaseOne/Mamiya"}, + {67, "Hasselblad V"}, + {68, "Hasselblad H"}, + {69, "Contax 645"}, + {70, "PhaseOne/Mamiya"}, + {71, "Hasselblad V"}, + {72, "Hasselblad H"}, + {73, "Contax 645"}, + {74, "PhaseOne/Mamiya"}, + {76, "Hasselblad V"}, + {77, "Hasselblad H"}, + {78, "Contax 645"}, + {79, "PhaseOne/Mamiya"}, + {80, "Hasselblad V"}, + {81, "Hasselblad H"}, + {82, "Contax 645"}, + {83, "PhaseOne/Mamiya"}, + {84, "Hasselblad V"}, + {85, "Hasselblad H"}, + {86, "Contax 645"}, + {87, "PhaseOne/Mamiya"}, + {99, "Hasselblad V"}, + {100, "Hasselblad H"}, + {101, "Contax 645"}, + {102, "PhaseOne/Mamiya"}, + {103, "Hasselblad V"}, + {104, "Hasselblad H"}, + {105, "PhaseOne/Mamiya"}, + {106, "Contax 645"}, + {112, "Hasselblad V"}, + {113, "Hasselblad H"}, + {114, "Contax 645"}, + {115, "PhaseOne/Mamiya"}, + {131, "Hasselblad V"}, + {132, "Hasselblad H"}, + {133, "Contax 645"}, + {134, "PhaseOne/Mamiya"}, + {135, "Hasselblad V"}, + {136, "Hasselblad H"}, + {137, "Contax 645"}, + {138, "PhaseOne/Mamiya"}, + {140, "Hasselblad V"}, + {141, "Hasselblad H"}, + {142, "Contax 645"}, + {143, "PhaseOne/Mamiya"}, + {148, "Hasselblad V"}, + {149, "Hasselblad H"}, + {150, "Contax 645"}, + {151, "PhaseOne/Mamiya"}, + {160, "A-250"}, + {161, "A-260"}, + {162, "A-280"}, + {167, "Hasselblad V"}, + {168, "Hasselblad H"}, + {169, "Contax 645"}, + {170, "PhaseOne/Mamiya"}, + {172, "Hasselblad V"}, + {173, "Hasselblad H"}, + {174, "Contax 645"}, + {175, "PhaseOne/Mamiya"}, + {176, "Hasselblad V"}, + {177, "Hasselblad H"}, + {178, "Contax 645"}, + {179, "PhaseOne/Mamiya"}, + {180, "Hasselblad V"}, + {181, "Hasselblad H"}, + {182, "Contax 645"}, + {183, "PhaseOne/Mamiya"}, + {208, "Hasselblad V"}, + {211, "PhaseOne/Mamiya"}, + {448, "Phase One 645AF"}, + {457, "Phase One 645DF"}, + {471, "Phase One 645DF+"}, + {704, "Phase One iXA"}, + {705, "Phase One iXA - R"}, + {706, "Phase One iXU 150"}, + {707, "Phase One iXU 150 - NIR"}, + {708, "Phase One iXU 180"}, + {721, "Phase One iXR"}, + // Leaf section: + {333,"Mamiya"}, + {329,"Universal"}, + {330,"Hasselblad H1/H2"}, + {332,"Contax"}, + {336,"AFi"}, + {327,"Mamiya"}, + {324,"Universal"}, + {325,"Hasselblad H1/H2"}, + {326,"Contax"}, + {335,"AFi"}, + {340,"Mamiya"}, + {337,"Universal"}, + {338,"Hasselblad H1/H2"}, + {339,"Contax"}, + {323,"Mamiya"}, + {320,"Universal"}, + {322,"Hasselblad H1/H2"}, + {321,"Contax"}, + {334,"AFi"}, + {369,"Universal"}, + {370,"Mamiya"}, + {371,"Hasselblad H1/H2"}, + {372,"Contax"}, + {373,"Afi"}, + }; + imgdata.lens.makernotes.CamID = id; + if (id && !imgdata.lens.makernotes.body[0]) { + for (i=0; i < sizeof p1_unique / sizeof *p1_unique; i++) + if (id == p1_unique[i].id) { + strcpy(imgdata.lens.makernotes.body,p1_unique[i].t_model); + } + } + return; +} + +void CLASS setSonyBodyFeatures (unsigned id) { + + imgdata.lens.makernotes.CamID = id; + if ( // FF cameras + (id == 257) || // a900 + (id == 269) || // a850 + (id == 340) || // ILCE-7M2 + (id == 318) || // ILCE-7S + (id == 311) || // ILCE-7R + (id == 347) || // ILCE-7RM2 + (id == 306) || // ILCE-7 + (id == 298) || // DSC-RX1 + (id == 299) || // NEX-VG900 + (id == 310) || // DSC-RX1R + (id == 294) // SLT-99, Hasselblad HV + ) + { + imgdata.lens.makernotes.CameraFormat = LIBRAW_FORMAT_FF; + } + else + { + if ((id != 002) && // DSC-R1 + (id != 297) && // DSC-RX100 + (id != 308) && // DSC-RX100M2 + (id != 309) && // DSC-RX10 + (id != 317) && // DSC-RX100M3 + (id != 341) && // DSC-RX100M4 + (id != 342) // DSC-RX10M2 + ) + imgdata.lens.makernotes.CameraFormat = LIBRAW_FORMAT_APSC; + } + + if ( // E-mount cameras + // ILCE: + (id == 302) || + (id == 306) || + (id == 311) || + (id == 312) || + (id == 313) || + (id == 318) || + (id == 339) || + (id == 340) || + (id == 346) || + (id == 347) || + // NEX: + (id == 278) || + (id == 279) || + (id == 284) || + (id == 288) || + (id == 289) || + (id == 290) || + (id == 293) || + (id == 295) || + (id == 296) || + (id == 299) || + (id == 300) || + (id == 305) || + (id == 307) + ) + { + imgdata.lens.makernotes.CameraMount = LIBRAW_MOUNT_Sony_E; + } + + else if ( // A-mount cameras + // DSLR: + (id == 256) || + (id == 257) || + (id == 258) || + (id == 259) || + (id == 260) || + (id == 261) || + (id == 262) || + (id == 263) || + (id == 264) || + (id == 265) || + (id == 266) || + (id == 269) || + (id == 270) || + (id == 273) || + (id == 274) || + (id == 275) || + (id == 282) || + (id == 283) || + // SLT: + (id == 280) || + (id == 281) || + (id == 285) || + (id == 286) || + (id == 287) || + (id == 291) || + (id == 292) || + (id == 294) || + (id == 303) || + // ILCA: + (id == 319) + ) + { + imgdata.lens.makernotes.CameraMount = LIBRAW_MOUNT_Minolta_A; + } + + else if ( // DSC + (id == 002) || // DSC-R1 + (id == 297) || // DSC-RX100 + (id == 298) || // DSC-RX1 + (id == 308) || // DSC-RX100M2 + (id == 309) || // DSC-RX10 + (id == 310) || // DSC-RX1R + (id == 317) || // DSC-RX100M3 + (id == 341) || // DSC-RX100M4 + (id == 342) // DSC-RX10M2 + ) + { + imgdata.lens.makernotes.CameraMount = LIBRAW_MOUNT_FixedLens; + imgdata.lens.makernotes.LensMount = LIBRAW_MOUNT_FixedLens; + } + return; +} + +void CLASS parseSonyLensType2 (uchar a, uchar b) { + ushort lid2; + lid2 = (((ushort)a)<<8) | ((ushort)b); + if (!lid2) return; + if (lid2 < 0x100) + { + imgdata.lens.makernotes.AdapterID = lid2; + switch (lid2) { + case 1: + case 2: + case 3: + case 6: + imgdata.lens.makernotes.LensMount = LIBRAW_MOUNT_Minolta_A; + break; + case 44: + case 78: + case 239: + imgdata.lens.makernotes.LensMount = LIBRAW_MOUNT_Canon_EF; + break; + } + } + else + imgdata.lens.makernotes.LensID = lid2; + return; +} + +void CLASS parseSonyLensFeatures (uchar a, uchar b) { + + ushort features; + features = (((ushort)a)<<8) | ((ushort)b); + + if ((imgdata.lens.makernotes.LensMount == LIBRAW_MOUNT_Canon_EF) || !features) + return; + + imgdata.lens.makernotes.LensFeatures_pre[0] = 0; + imgdata.lens.makernotes.LensFeatures_suf[0] = 0; + if ((features & 0x0200) && (features & 0x0100)) strcpy(imgdata.lens.makernotes.LensFeatures_pre, "E"); + else if (features & 0x0200) strcpy(imgdata.lens.makernotes.LensFeatures_pre, "FE"); + else if (features & 0x0100) strcpy(imgdata.lens.makernotes.LensFeatures_pre, "DT"); + + if (!imgdata.lens.makernotes.LensFormat && !imgdata.lens.makernotes.LensMount) + { + imgdata.lens.makernotes.LensFormat = LIBRAW_FORMAT_FF; + imgdata.lens.makernotes.LensMount = LIBRAW_MOUNT_Minolta_A; + + if ((features & 0x0200) && (features & 0x0100)) { + imgdata.lens.makernotes.LensFormat = LIBRAW_FORMAT_APSC; + imgdata.lens.makernotes.LensMount = LIBRAW_MOUNT_Sony_E; + } else if (features & 0x0200) { + imgdata.lens.makernotes.LensMount = LIBRAW_MOUNT_Sony_E; + } else if (features & 0x0100) { + imgdata.lens.makernotes.LensFormat = LIBRAW_FORMAT_APSC; + } + } + + if (features & 0x4000) + strncat(imgdata.lens.makernotes.LensFeatures_pre, " PZ", sizeof(imgdata.lens.makernotes.LensFeatures_pre)); + + if (features & 0x0008) + strncat(imgdata.lens.makernotes.LensFeatures_suf, " G", sizeof(imgdata.lens.makernotes.LensFeatures_suf)); + else if (features & 0x0004) + strncat(imgdata.lens.makernotes.LensFeatures_suf, " ZA", sizeof(imgdata.lens.makernotes.LensFeatures_suf)); + + if ((features & 0x0020) && (features & 0x0040)) + strncat(imgdata.lens.makernotes.LensFeatures_suf, " Macro", sizeof(imgdata.lens.makernotes.LensFeatures_suf)); + else if (features & 0x0020) + strncat(imgdata.lens.makernotes.LensFeatures_suf, " STF", sizeof(imgdata.lens.makernotes.LensFeatures_suf)); + else if (features & 0x0040) + strncat(imgdata.lens.makernotes.LensFeatures_suf, " Reflex", sizeof(imgdata.lens.makernotes.LensFeatures_suf)); + else if (features & 0x0080) + strncat(imgdata.lens.makernotes.LensFeatures_suf, " Fisheye", sizeof(imgdata.lens.makernotes.LensFeatures_suf)); + + if (features & 0x0001) + strncat(imgdata.lens.makernotes.LensFeatures_suf, " SSM", sizeof(imgdata.lens.makernotes.LensFeatures_suf)); + else if (features & 0x0002) + strncat(imgdata.lens.makernotes.LensFeatures_suf, " SAM", sizeof(imgdata.lens.makernotes.LensFeatures_suf)); + + if (features & 0x8000) + strncat(imgdata.lens.makernotes.LensFeatures_suf, " OSS", sizeof(imgdata.lens.makernotes.LensFeatures_suf)); + + if (features & 0x2000) + strncat(imgdata.lens.makernotes.LensFeatures_suf, " LE", sizeof(imgdata.lens.makernotes.LensFeatures_suf)); + + if (features & 0x0800) + strncat(imgdata.lens.makernotes.LensFeatures_suf, " II", sizeof(imgdata.lens.makernotes.LensFeatures_suf)); + + if (imgdata.lens.makernotes.LensFeatures_suf[0] == ' ') + memmove(imgdata.lens.makernotes.LensFeatures_suf, imgdata.lens.makernotes.LensFeatures_suf+1, strlen(imgdata.lens.makernotes.LensFeatures_suf)); + + return; +} + +void CLASS process_Sony_0x940c (uchar * buf) +{ + ushort lid2; + if (imgdata.lens.makernotes.LensMount != LIBRAW_MOUNT_Canon_EF) + { + switch (SonySubstitution[buf[0x0008]]) { + case 1: + case 5: + imgdata.lens.makernotes.LensMount = LIBRAW_MOUNT_Minolta_A; + break; + case 4: + imgdata.lens.makernotes.LensMount = LIBRAW_MOUNT_Sony_E; + break; + } + } + lid2 = (((ushort)SonySubstitution[buf[0x000a]])<<8) | + ((ushort)SonySubstitution[buf[0x0009]]); + if ((lid2 > 0) && (lid2 < 32784)) + parseSonyLensType2 (SonySubstitution[buf[0x000a]], // LensType2 - Sony lens ids + SonySubstitution[buf[0x0009]]); + return; +} + + +void CLASS process_Sony_0x9050 (uchar * buf, unsigned id) +{ + ushort lid; + + if ((imgdata.lens.makernotes.CameraMount != LIBRAW_MOUNT_Sony_E) && + (imgdata.lens.makernotes.CameraMount != LIBRAW_MOUNT_FixedLens)) + { + if (buf[0]) + imgdata.lens.makernotes.MaxAp4CurFocal = + my_roundf(powf64(2.0f, ((float)SonySubstitution[buf[0]] / 8.0 - 1.06f) / 2.0f)*10.0f) / 10.0f; + + if (buf[1]) + imgdata.lens.makernotes.MinAp4CurFocal = + my_roundf(powf64(2.0f, ((float)SonySubstitution[buf[1]] / 8.0 - 1.06f) / 2.0f)*10.0f) / 10.0f; + } + + if (imgdata.lens.makernotes.CameraMount != LIBRAW_MOUNT_FixedLens) + { + if (buf[0x3d] | buf[0x3c]) + { + lid = SonySubstitution[buf[0x3d]] << 8 | + SonySubstitution[buf[0x3c]]; + imgdata.lens.makernotes.CurAp = + powf64(2.0f, ((float)lid/256.0f - 16.0f) / 2.0f); + } + if (buf[0x105] && (imgdata.lens.makernotes.LensMount != LIBRAW_MOUNT_Canon_EF)) + imgdata.lens.makernotes.LensMount = + SonySubstitution[buf[0x105]]; + if (buf[0x106]) + imgdata.lens.makernotes.LensFormat = + SonySubstitution[buf[0x106]]; + } + + if (imgdata.lens.makernotes.CameraMount == LIBRAW_MOUNT_Sony_E) + { + parseSonyLensType2 (SonySubstitution[buf[0x0108]], // LensType2 - Sony lens ids + SonySubstitution[buf[0x0107]]); + } + + if ((imgdata.lens.makernotes.LensID == -1) && + (imgdata.lens.makernotes.CameraMount == LIBRAW_MOUNT_Minolta_A) && + (buf[0x010a] | buf[0x0109])) + { + imgdata.lens.makernotes.LensID = // LensType - Minolta/Sony lens ids + SonySubstitution[buf[0x010a]] << 8 | + SonySubstitution[buf[0x0109]]; + if ((imgdata.lens.makernotes.LensID > 61184) && + (imgdata.lens.makernotes.LensID < 65535)) + { + imgdata.lens.makernotes.LensID -= 61184; + imgdata.lens.makernotes.LensMount = LIBRAW_MOUNT_Canon_EF; + } + } + + if ((id >= 286) && (id <= 293)) + // "SLT-A65", "SLT-A77", "NEX-7", "NEX-VG20E", + // "SLT-A37", "SLT-A57", "NEX-F3", "Lunar" + parseSonyLensFeatures (SonySubstitution[buf[0x115]], + SonySubstitution[buf[0x116]]); + else if (imgdata.lens.makernotes.CameraMount != LIBRAW_MOUNT_FixedLens) + parseSonyLensFeatures (SonySubstitution[buf[0x116]], + SonySubstitution[buf[0x117]]); + return; +} + +void CLASS parse_makernote_0xc634(int base, int uptag, unsigned dng_writer) +{ + unsigned ver97 = 0, offset = 0, entries, tag, type, len, save, c; + unsigned i; + + uchar NikonKey, ci, cj, ck; + unsigned serial = 0; + unsigned NikonLensDataVersion = 0; + unsigned lenNikonLensData = 0; + + uchar *CanonCameraInfo; + unsigned lenCanonCameraInfo = 0; + + uchar *table_buf; + uchar *table_buf_0x9050; + ushort table_buf_0x9050_present = 0; + uchar *table_buf_0x940c; + ushort table_buf_0x940c_present = 0; + + short morder, sorder = order; + char buf[10]; + + fread(buf, 1, 10, ifp); + if (!strcmp(buf, "Nikon")) { + base = ftell(ifp); + order = get2(); + if (get2() != 42) goto quit; + offset = get4(); + fseek(ifp, offset - 8, SEEK_CUR); + } + else if (!strcmp(buf, "OLYMPUS") || + !strcmp(buf, "PENTAX ") || + (!strncmp(make, "SAMSUNG", 7) && (dng_writer == CameraDNG))) { + base = ftell(ifp) - 10; + fseek(ifp, -2, SEEK_CUR); + order = get2(); + if (buf[0] == 'O') get2(); + } + else if (!strncmp(buf, "SONY", 4) || + !strcmp(buf, "Panasonic")) { + goto nf; + } + else if (!strncmp(buf, "FUJIFILM", 8)) { + base = ftell(ifp) - 10; + nf: order = 0x4949; + fseek(ifp, 2, SEEK_CUR); + } + else if (!strcmp(buf, "OLYMP") || + !strcmp(buf, "LEICA") || + !strcmp(buf, "Ricoh") || + !strcmp(buf, "EPSON")) + fseek(ifp, -2, SEEK_CUR); + else if (!strcmp(buf, "AOC") || + !strcmp(buf, "QVC")) + fseek(ifp, -4, SEEK_CUR); + else { + fseek(ifp, -10, SEEK_CUR); + if ((!strncmp(make, "SAMSUNG", 7) && + (dng_writer == AdobeDNG))) + base = ftell(ifp); + } + + entries = get2(); + if (entries > 1000) return; + morder = order; + + while (entries--) { + order = morder; + tiff_get(base, &tag, &type, &len, &save); + tag |= uptag << 16; + if(len > 100*1024*1024) goto next; // 100Mb tag? No! + + if (!strncmp(make, "Canon",5)) + { + if (tag == 0x0001) // camera settings + { + fseek(ifp, 44, SEEK_CUR); + imgdata.lens.makernotes.LensID = get2(); + imgdata.lens.makernotes.MaxFocal = get2(); + imgdata.lens.makernotes.MinFocal = get2(); + imgdata.lens.makernotes.CanonFocalUnits = get2(); + if (imgdata.lens.makernotes.CanonFocalUnits != 1) + { + imgdata.lens.makernotes.MaxFocal /= (float)imgdata.lens.makernotes.CanonFocalUnits; + imgdata.lens.makernotes.MinFocal /= (float)imgdata.lens.makernotes.CanonFocalUnits; + } + imgdata.lens.makernotes.MaxAp = _CanonConvertAperture(get2()); + imgdata.lens.makernotes.MinAp = _CanonConvertAperture(get2()); + } + + else if (tag == 0x0002) // focal length + { + imgdata.lens.makernotes.FocalType = get2(); + imgdata.lens.makernotes.CurFocal = get2(); + if ((imgdata.lens.makernotes.CanonFocalUnits != 1) && + imgdata.lens.makernotes.CanonFocalUnits) + { + imgdata.lens.makernotes.CurFocal /= (float)imgdata.lens.makernotes.CanonFocalUnits; + } + } + + else if (tag == 0x0004) // shot info + { + short tempAp; + fseek(ifp, 8, SEEK_CUR); + if ((tempAp = get2()) != 0x7fff) + imgdata.lens.makernotes.CurAp = _CanonConvertAperture(tempAp); + if (imgdata.lens.makernotes.CurAp < 0.7f) + { + fseek(ifp, 32, SEEK_CUR); + imgdata.lens.makernotes.CurAp = _CanonConvertAperture(get2()); + } + if (!aperture) aperture = imgdata.lens.makernotes.CurAp; + } + + else if (tag == 0x000d) // camera info + { + CanonCameraInfo = (uchar*)malloc(len); + fread(CanonCameraInfo, len, 1, ifp); + lenCanonCameraInfo = len; + } + + else if (tag == 0x10) // Canon ModelID + { + unique_id = get4(); + if (unique_id == 0x03740000) unique_id = 0x80000374; + setCanonBodyFeatures(unique_id); + if (lenCanonCameraInfo) + { + processCanonCameraInfo(unique_id, CanonCameraInfo,lenCanonCameraInfo); + free(CanonCameraInfo); + CanonCameraInfo = 0; + lenCanonCameraInfo = 0; + } + } + + else if (tag == 0x0095 && // lens model tag + !imgdata.lens.makernotes.Lens[0]) + { + fread(imgdata.lens.makernotes.Lens, 2, 1, ifp); + imgdata.lens.makernotes.LensMount = LIBRAW_MOUNT_Canon_EF; + if (imgdata.lens.makernotes.Lens[0] < 65) // non-Canon lens + fread(imgdata.lens.makernotes.Lens + 2, 62, 1, ifp); + else + { + char efs[2]; + imgdata.lens.makernotes.LensFeatures_pre[0] = imgdata.lens.makernotes.Lens[0]; + imgdata.lens.makernotes.LensFeatures_pre[1] = imgdata.lens.makernotes.Lens[1]; + fread(efs, 2, 1, ifp); + if (efs[0] == 45 && (efs[1] == 83 || efs[1] == 69 || efs[1] == 77)) + { // "EF-S, TS-E, MP-E, EF-M" lenses + imgdata.lens.makernotes.Lens[2] = imgdata.lens.makernotes.LensFeatures_pre[2] = efs[0]; + imgdata.lens.makernotes.Lens[3] = imgdata.lens.makernotes.LensFeatures_pre[3] = efs[1]; + imgdata.lens.makernotes.Lens[4] = 32; + if (efs[1] == 83) + { + imgdata.lens.makernotes.LensMount = LIBRAW_MOUNT_Canon_EF_S; + imgdata.lens.makernotes.LensFormat = LIBRAW_FORMAT_APSC; + } + else if (efs[1] == 77) + { + imgdata.lens.makernotes.LensMount = LIBRAW_MOUNT_Canon_EF_M; + } + } + else + { // "EF" lenses + imgdata.lens.makernotes.Lens[2] = 32; + imgdata.lens.makernotes.Lens[3] = efs[0]; + imgdata.lens.makernotes.Lens[4] = efs[1]; + } + fread(imgdata.lens.makernotes.Lens + 5, 58, 1, ifp); + } + } + } + + else if (!strncmp(make, "FUJI", 4)) + switch (tag) { + case 0x1404: imgdata.lens.makernotes.MinFocal = getreal(type); break; + case 0x1405: imgdata.lens.makernotes.MaxFocal = getreal(type); break; + case 0x1406: imgdata.lens.makernotes.MaxAp4MinFocal = getreal(type); break; + case 0x1407: imgdata.lens.makernotes.MaxAp4MaxFocal = getreal(type); break; + } + + else if (!strncasecmp(make, "LEICA", 5)) + { + if ((tag == 0x0303) && (type != 4)) + { + fread(imgdata.lens.makernotes.Lens, MIN(len,127), 1, ifp); + } + + if ((tag == 0x3405) || + (tag == 0x0310) || + (tag == 0x34003405)) + { + imgdata.lens.makernotes.LensID = get4(); + imgdata.lens.makernotes.LensID = + ((imgdata.lens.makernotes.LensID>>2)<<8) | + (imgdata.lens.makernotes.LensID & 0x3); + if (imgdata.lens.makernotes.LensID != -1) + { + if ((model[0] == 'M') || + !strncasecmp (model, "LEICA M", 7)) + { + imgdata.lens.makernotes.CameraMount = LIBRAW_MOUNT_Leica_M; + if (imgdata.lens.makernotes.LensID) + imgdata.lens.makernotes.LensMount = LIBRAW_MOUNT_Leica_M; + } + else if ((model[0] == 'S') || + !strncasecmp (model, "LEICA S", 7)) + { + imgdata.lens.makernotes.CameraMount = LIBRAW_MOUNT_Leica_S; + if (imgdata.lens.makernotes.Lens[0]) + imgdata.lens.makernotes.LensMount = LIBRAW_MOUNT_Leica_S; + } + } + } + + else if ( + ((tag == 0x0313) || (tag == 0x34003406)) && + (fabs(imgdata.lens.makernotes.CurAp) < 0.17f) && + ((type == 10) || (type == 5)) + ) + { + imgdata.lens.makernotes.CurAp = getreal(type); + if (imgdata.lens.makernotes.CurAp > 126.3) + imgdata.lens.makernotes.CurAp = 0.0f; + } + + else if (tag == 0x3400) + { + parse_makernote (base, 0x3400); + } + } + + else if (!strncmp(make, "NIKON", 5)) + { + if (tag == 0x1d) // serial number + while ((c = fgetc(ifp)) && c != EOF) + serial = serial * 10 + (isdigit(c) ? c - '0' : c % 10); + else if (tag == 0x000a) + { + imgdata.lens.makernotes.LensMount = LIBRAW_MOUNT_FixedLens; + imgdata.lens.makernotes.CameraMount = LIBRAW_MOUNT_FixedLens; + } + else if (tag == 0x0082) // lens attachment + { + fread(imgdata.lens.makernotes.Attachment, MIN(len,127), 1, ifp); + } + else if (tag == 0x0083) // lens type + { + imgdata.lens.nikon.NikonLensType = fgetc(ifp); + } + else if (tag == 0x0084) // lens + { + imgdata.lens.makernotes.MinFocal = getreal(type); + imgdata.lens.makernotes.MaxFocal = getreal(type); + imgdata.lens.makernotes.MaxAp4MinFocal = getreal(type); + imgdata.lens.makernotes.MaxAp4MaxFocal = getreal(type); + } + else if (tag == 0x008b) // lens f-stops + { + uchar a, b, c; + a = fgetc(ifp); + b = fgetc(ifp); + c = fgetc(ifp); + if (c) + { + imgdata.lens.nikon.NikonLensFStops = a*b*(12/c); + imgdata.lens.makernotes.LensFStops = + (float)imgdata.lens.nikon.NikonLensFStops /12.0f; + } + } + else if (tag == 0x0093) + { + i = get2(); + if ((i == 7) || (i == 9)) + { + imgdata.lens.makernotes.LensMount = LIBRAW_MOUNT_FixedLens; + imgdata.lens.makernotes.CameraMount = LIBRAW_MOUNT_FixedLens; + } + } + else if (tag == 0x0097) + { + for (i=0; i < 4; i++) + ver97 = ver97 * 10 + fgetc(ifp)-'0'; + if (ver97 == 601) // Coolpix A + { + imgdata.lens.makernotes.LensMount = LIBRAW_MOUNT_FixedLens; + imgdata.lens.makernotes.CameraMount = LIBRAW_MOUNT_FixedLens; + } + } + else if (tag == 0x0098) // contains lens data + { + for (i = 0; i < 4; i++) + { + NikonLensDataVersion = NikonLensDataVersion * 10 + fgetc(ifp) - '0'; + } + switch (NikonLensDataVersion) + { + case 100: lenNikonLensData = 9; break; + case 101: + case 201: // encrypted, starting from v.201 + case 202: + case 203: lenNikonLensData = 15; break; + case 204: lenNikonLensData = 16; break; + case 400: lenNikonLensData = 459; break; + case 401: lenNikonLensData = 590; break; + case 402: lenNikonLensData = 509; break; + case 403: lenNikonLensData = 879; break; + } + if(lenNikonLensData) + { + table_buf = (uchar*)malloc(lenNikonLensData); + fread(table_buf, lenNikonLensData, 1, ifp); + if ((NikonLensDataVersion < 201) && lenNikonLensData) + { + processNikonLensData(table_buf, lenNikonLensData); + free(table_buf); + lenNikonLensData = 0; + } + } + } + + else if (tag == 0xa7) // shutter count + { + NikonKey = fgetc(ifp) ^ fgetc(ifp) ^ fgetc(ifp) ^ fgetc(ifp); + if ((NikonLensDataVersion > 200) && lenNikonLensData) + { + ci = xlat[0][serial & 0xff]; + cj = xlat[1][NikonKey]; + ck = 0x60; + for (i = 0; i < lenNikonLensData; i++) + table_buf[i] ^= (cj += ci * ck++); + processNikonLensData(table_buf, lenNikonLensData); + free(table_buf); + lenNikonLensData = 0; + } + } + + else if (tag == 37 && (!iso_speed || iso_speed == 65535)) + { + unsigned char cc; + fread(&cc, 1, 1, ifp); + iso_speed = (int)(100.0 * powf64(2.0, (double)(cc) / 12.0 - 5.0)); + break; + } + } + + else if (!strncmp(make, "OLYMPUS", 7)) + { + if (tag == 0x2010) + { + fseek(ifp, save - 4, SEEK_SET); + fseek(ifp, base + get4(), SEEK_SET); + parse_makernote_0xc634(base, 0x2010, dng_writer); + } + + switch (tag) { + case 0x0207: + case 0x20100100: + { + uchar sOlyID[8]; + unsigned long long OlyID; + fread (sOlyID, MIN(len,7), 1, ifp); + sOlyID[7] = 0; + OlyID = sOlyID[0]; + i = 1; + while (i < 7 && sOlyID[i]) + { + OlyID = OlyID << 8 | sOlyID[i]; + i++; + } + setOlympusBodyFeatures(OlyID); + } + break; + case 0x1002: + imgdata.lens.makernotes.CurAp = powf64(2.0f, getreal(type)/2); + break; + case 0x20100201: + imgdata.lens.makernotes.LensID = + (unsigned long long)fgetc(ifp)<<16 | + (unsigned long long)(fgetc(ifp), fgetc(ifp))<<8 | + (unsigned long long)fgetc(ifp); + imgdata.lens.makernotes.LensMount = LIBRAW_MOUNT_FT; + imgdata.lens.makernotes.LensFormat = LIBRAW_FORMAT_FT; + if (((imgdata.lens.makernotes.LensID < 0x20000) || + (imgdata.lens.makernotes.LensID > 0x4ffff)) && + (imgdata.lens.makernotes.LensID & 0x10)) + { + imgdata.lens.makernotes.LensMount = LIBRAW_MOUNT_mFT; + } + break; + case 0x20100203: + fread(imgdata.lens.makernotes.Lens, MIN(len,127), 1, ifp); + break; + case 0x20100205: + imgdata.lens.makernotes.MaxAp4MinFocal = powf64(sqrt(2.0f), get2() / 256.0f); + break; + case 0x20100206: + imgdata.lens.makernotes.MaxAp4MaxFocal = powf64(sqrt(2.0f), get2() / 256.0f); + break; + case 0x20100207: + imgdata.lens.makernotes.MinFocal = (float)get2(); + break; + case 0x20100208: + imgdata.lens.makernotes.MaxFocal = (float)get2(); + if (imgdata.lens.makernotes.MaxFocal > 1000.0f) + imgdata.lens.makernotes.MaxFocal = imgdata.lens.makernotes.MinFocal; + break; + case 0x2010020a: + imgdata.lens.makernotes.MaxAp4CurFocal = powf64(sqrt(2.0f), get2() / 256.0f); + break; + case 0x20100301: + imgdata.lens.makernotes.TeleconverterID = fgetc(ifp) << 8; + fgetc(ifp); + imgdata.lens.makernotes.TeleconverterID = + imgdata.lens.makernotes.TeleconverterID | fgetc(ifp); + break; + case 0x20100303: + fread(imgdata.lens.makernotes.Teleconverter, MIN(len,127), 1, ifp); + break; + case 0x20100403: + fread(imgdata.lens.makernotes.Attachment, MIN(len,127), 1, ifp); + break; + } + } + + else if (!strncmp(make, "PENTAX", 6) || + !strncmp(model, "PENTAX", 6) || + (!strncmp(make, "SAMSUNG", 7) && (dng_writer == CameraDNG))) + { + if (tag == 0x0005) + { + unique_id = get4(); + setPentaxBodyFeatures(unique_id); + } + else if (tag == 0x0013) + { + imgdata.lens.makernotes.CurAp = (float)get2()/10.0f; + } + else if (tag == 0x001d) + { + imgdata.lens.makernotes.CurFocal = (float)get4()/100.0f; + } + else if (tag == 0x003f) + { + imgdata.lens.makernotes.LensID = fgetc(ifp) << 8 | fgetc(ifp); + } + else if (tag == 0x0207) + { + PentaxLensInfo(imgdata.lens.makernotes.CamID, len); + } + else if (tag == 0x0239) // Q-series lens info (LensInfoQ) + { + char LensInfo [20]; + fseek (ifp, 12, SEEK_CUR); + fread(imgdata.lens.makernotes.Lens, 30, 1, ifp); + strcat(imgdata.lens.makernotes.Lens, " "); + fread(LensInfo, 20, 1, ifp); + strcat(imgdata.lens.makernotes.Lens, LensInfo); + } + } + + else if (!strncmp(make, "SAMSUNG", 7) && + (dng_writer == AdobeDNG)) + { + if (tag == 0x0002) + { + if(get4() == 0x2000) + { + imgdata.lens.makernotes.CameraMount = LIBRAW_MOUNT_Samsung_NX; + } + else if (!strncmp(model, "NX mini", 7)) + { + imgdata.lens.makernotes.CameraMount = LIBRAW_MOUNT_Samsung_NX_M; + } + else + { + imgdata.lens.makernotes.CameraMount = LIBRAW_MOUNT_FixedLens; + imgdata.lens.makernotes.LensMount = LIBRAW_MOUNT_FixedLens; + } + } + else if (tag == 0x0003) + { + imgdata.lens.makernotes.CamID = unique_id = get4(); + } + else if (tag == 0xa003) + { + imgdata.lens.makernotes.LensID = get2(); + if (imgdata.lens.makernotes.LensID) + imgdata.lens.makernotes.LensMount = LIBRAW_MOUNT_Samsung_NX; + } + else if (tag == 0xa019) + { + imgdata.lens.makernotes.CurAp = getreal(type); + } + else if (tag == 0xa01a) + { + imgdata.lens.makernotes.FocalLengthIn35mmFormat = get4() / 10.0f; + if (imgdata.lens.makernotes.FocalLengthIn35mmFormat < 10.0f) + imgdata.lens.makernotes.FocalLengthIn35mmFormat *= 10.0f; + } + } + + else if (!strncasecmp(make, "SONY", 4) || + !strncasecmp(make, "Konica", 6) || + !strncasecmp(make, "Minolta", 7) || + (!strncasecmp(make, "Hasselblad", 10) && + (!strncasecmp(model, "Stellar", 7) || + !strncasecmp(model, "Lunar", 5) || + !strncasecmp(model, "Lusso", 5) || + !strncasecmp(model, "HV",2)))) + { + ushort lid; + + if (tag == 0xb001) // Sony ModelID + { + unique_id = get2(); + setSonyBodyFeatures(unique_id); + if (table_buf_0x9050_present) + { + process_Sony_0x9050(table_buf_0x9050, unique_id); + free (table_buf_0x9050); + table_buf_0x9050_present = 0; + } + if (table_buf_0x940c_present) + { + if (imgdata.lens.makernotes.CameraMount == LIBRAW_MOUNT_Sony_E) + { + process_Sony_0x940c(table_buf_0x940c); + } + free (table_buf_0x940c); + table_buf_0x940c_present = 0; + } + } + else if ((tag == 0x0010) && // CameraInfo + strncasecmp(model, "DSLR-A100", 9) && + strncasecmp(model, "NEX-5C", 6) && + !strncasecmp(make, "SONY", 4) && + ((len == 368) || // a700 + (len == 5478) || // a850, a900 + (len == 5506) || // a200, a300, a350 + (len == 6118) || // a230, a290, a330, a380, a390 + + // a450, a500, a550, a560, a580 + // a33, a35, a55 + // NEX3, NEX5, NEX5C, NEXC3, VG10E + (len == 15360)) + ) + { + table_buf = (uchar*)malloc(len); + fread(table_buf, len, 1, ifp); + if (memcmp(table_buf, "\xff\xff\xff\xff\xff\xff\xff\xff", 8) && + memcmp(table_buf, "\x00\x00\x00\x00\x00\x00\x00\x00", 8)) + { + switch (len) { + case 368: + case 5478: + // a700, a850, a900: CameraInfo + if (saneSonyCameraInfo(table_buf[0], table_buf[3], table_buf[2], table_buf[5], table_buf[4], table_buf[7])) + { + if (table_buf[0] | table_buf[3]) + imgdata.lens.makernotes.MinFocal = + bcd2dec(table_buf[0]) * 100 + bcd2dec(table_buf[3]); + if (table_buf[2] | table_buf[5]) + imgdata.lens.makernotes.MaxFocal = + bcd2dec(table_buf[2]) * 100 + bcd2dec(table_buf[5]); + if (table_buf[4]) + imgdata.lens.makernotes.MaxAp4MinFocal = bcd2dec(table_buf[4]) / 10.0f; + if (table_buf[4]) + imgdata.lens.makernotes.MaxAp4MaxFocal = bcd2dec(table_buf[7]) / 10.0f; + parseSonyLensFeatures(table_buf[1], table_buf[6]); + } + break; + default: + // CameraInfo2 & 3 + if (saneSonyCameraInfo(table_buf[1], table_buf[2], table_buf[3], table_buf[4], table_buf[5], table_buf[6])) + { + if (table_buf[1] | table_buf[2]) + imgdata.lens.makernotes.MinFocal = + bcd2dec(table_buf[1]) * 100 + bcd2dec(table_buf[2]); + if (table_buf[3] | table_buf[4]) + imgdata.lens.makernotes.MaxFocal = + bcd2dec(table_buf[3]) * 100 + bcd2dec(table_buf[4]); + if (table_buf[5]) + imgdata.lens.makernotes.MaxAp4MinFocal = bcd2dec(table_buf[5]) / 10.0f; + if (table_buf[6]) + imgdata.lens.makernotes.MaxAp4MaxFocal = bcd2dec(table_buf[6]) / 10.0f; + parseSonyLensFeatures(table_buf[0], table_buf[7]); + } + } + } + free(table_buf); + } + + else if (tag == 0x0105) // Teleconverter + { + imgdata.lens.makernotes.TeleconverterID = get2(); + } + + else if (tag == 0x0114) // CameraSettings + { + table_buf = (uchar*)malloc(len); + fread(table_buf, len, 1, ifp); + switch (len) { + case 280: + case 364: + case 332: + // CameraSettings and CameraSettings2 are big endian + if (table_buf[2] | table_buf[3]) + { + lid = (((ushort)table_buf[2])<<8) | + ((ushort)table_buf[3]); + imgdata.lens.makernotes.CurAp = + powf64(2.0f, ((float)lid/8.0f-1.0f)/2.0f); + } + break; + case 1536: + case 2048: + // CameraSettings3 are little endian + parseSonyLensType2(table_buf[1016], table_buf[1015]); + if (imgdata.lens.makernotes.LensMount != LIBRAW_MOUNT_Canon_EF) + { + switch (table_buf[153]) { + case 16: imgdata.lens.makernotes.LensMount = LIBRAW_MOUNT_Minolta_A; break; + case 17: imgdata.lens.makernotes.LensMount = LIBRAW_MOUNT_Sony_E; break; + } + } + break; + } + free(table_buf); + } + + else if (tag == 0x9050) // little endian + { + table_buf_0x9050 = (uchar*)malloc(len); + table_buf_0x9050_present = 1; + fread(table_buf_0x9050, len, 1, ifp); + + if (imgdata.lens.makernotes.CamID) + { + process_Sony_0x9050(table_buf_0x9050, imgdata.lens.makernotes.CamID); + free (table_buf_0x9050); + table_buf_0x9050_present = 0; + } + } + + else if (tag == 0x940c) + { + table_buf_0x940c = (uchar*)malloc(len); + table_buf_0x940c_present = 1; + fread(table_buf_0x940c, len, 1, ifp); + if ((imgdata.lens.makernotes.CamID) && + (imgdata.lens.makernotes.CameraMount == LIBRAW_MOUNT_Sony_E)) + { + process_Sony_0x940c(table_buf_0x940c); + free(table_buf_0x940c); + table_buf_0x940c_present = 0; + } + } + + else if (((tag == 0xb027) || (tag == 0x010c)) && (imgdata.lens.makernotes.LensID == -1)) + { + imgdata.lens.makernotes.LensID = get4(); + if ((imgdata.lens.makernotes.LensID > 61184) && + (imgdata.lens.makernotes.LensID < 65535)) + { + imgdata.lens.makernotes.LensID -= 61184; + imgdata.lens.makernotes.LensMount = LIBRAW_MOUNT_Canon_EF; + } + if (tag == 0x010c) imgdata.lens.makernotes.CameraMount = LIBRAW_MOUNT_Minolta_A; + } + + else if (tag == 0xb02a) // Sony LensSpec + { + table_buf = (uchar*)malloc(len); + fread(table_buf, len, 1, ifp); + if (saneSonyCameraInfo(table_buf[1], table_buf[2], table_buf[3], table_buf[4], table_buf[5], table_buf[6])) + { + if (table_buf[1] | table_buf[2]) + imgdata.lens.makernotes.MinFocal = + bcd2dec(table_buf[1]) * 100 + bcd2dec(table_buf[2]); + if (table_buf[3] | table_buf[4]) + imgdata.lens.makernotes.MaxFocal = + bcd2dec(table_buf[3]) * 100 + bcd2dec(table_buf[4]); + if (table_buf[5]) + imgdata.lens.makernotes.MaxAp4MinFocal = bcd2dec(table_buf[5]) / 10.0f; + if (table_buf[6]) + imgdata.lens.makernotes.MaxAp4MaxFocal = bcd2dec(table_buf[6]) / 10.0f; + parseSonyLensFeatures(table_buf[0], table_buf[7]); + } + free(table_buf); + } + } + next: + fseek (ifp, save, SEEK_SET); + } + quit: + order = sorder; +} + +#else +void CLASS parse_makernote_0xc634(int base, int uptag, unsigned dng_writer) +{ + /*placeholder */ +} +#endif + + +void CLASS parse_makernote (int base, int uptag) +{ + unsigned offset=0, entries, tag, type, len, save, c; + unsigned ver97=0, serial=0, i, wbi=0, wb[4]={0,0,0,0}; + uchar buf97[324], ci, cj, ck; + short morder, sorder=order; + char buf[10]; + unsigned SamsungKey[11]; + static const double rgb_adobe[3][3] = // inv(sRGB2XYZ_D65) * AdobeRGB2XYZ_D65 + {{ 1.398283396477404, -0.398283116703571, 4.427165001263944E-08}, + {-1.233904514232401E-07, 0.999999995196570, 3.126724276714121e-08}, + { 4.561487232726535E-08, -0.042938290466635, 1.042938250416105 }}; + + float adobe_cam [3][3]; + uchar NikonKey; + +#ifdef LIBRAW_LIBRARY_BUILD + unsigned NikonLensDataVersion = 0; + unsigned lenNikonLensData = 0; + + uchar *CanonCameraInfo; + unsigned lenCanonCameraInfo = 0; + + uchar *table_buf; + uchar *table_buf_0x9050; + ushort table_buf_0x9050_present = 0; + uchar *table_buf_0x940c; + ushort table_buf_0x940c_present = 0; +#endif +/* + The MakerNote might have its own TIFF header (possibly with + its own byte-order!), or it might just be a table. + */ + if (!strncmp(make,"Nokia",5)) return; + fread (buf, 1, 10, ifp); + if (!strncmp (buf,"KDK" ,3) || /* these aren't TIFF tables */ + !strncmp (buf,"VER" ,3) || + !strncmp (buf,"IIII",4) || + !strncmp (buf,"MMMM",4)) return; + if (!strncmp (buf,"KC" ,2) || /* Konica KD-400Z, KD-510Z */ + !strncmp (buf,"MLY" ,3)) { /* Minolta DiMAGE G series */ + order = 0x4d4d; + while ((i=ftell(ifp)) < data_offset && i < 16384) { + wb[0] = wb[2]; wb[2] = wb[1]; wb[1] = wb[3]; + wb[3] = get2(); + if (wb[1] == 256 && wb[3] == 256 && + wb[0] > 256 && wb[0] < 640 && wb[2] > 256 && wb[2] < 640) + FORC4 cam_mul[c] = wb[c]; + } + goto quit; + } + if (!strcmp (buf,"Nikon")) { + base = ftell(ifp); + order = get2(); + if (get2() != 42) goto quit; + offset = get4(); + fseek (ifp, offset-8, SEEK_CUR); + } else if (!strcmp (buf,"OLYMPUS") || + !strcmp (buf,"PENTAX ")) { + base = ftell(ifp)-10; + fseek (ifp, -2, SEEK_CUR); + order = get2(); + if (buf[0] == 'O') get2(); + } else if (!strncmp (buf,"SONY",4) || + !strcmp (buf,"Panasonic")) { + goto nf; + } else if (!strncmp (buf,"FUJIFILM",8)) { + base = ftell(ifp)-10; + nf: order = 0x4949; + fseek (ifp, 2, SEEK_CUR); + } else if (!strcmp (buf,"OLYMP") || + !strcmp (buf,"LEICA") || + !strcmp (buf,"Ricoh") || + !strcmp (buf,"EPSON")) + fseek (ifp, -2, SEEK_CUR); + else if (!strcmp (buf,"AOC") || + !strcmp (buf,"QVC")) + fseek (ifp, -4, SEEK_CUR); + else { + fseek (ifp, -10, SEEK_CUR); + if (!strncmp(make,"SAMSUNG",7)) + base = ftell(ifp); + } + + // adjust pos & base for Leica M8/M9/M Mono tags and dir in tag 0x3400 + if (!strncasecmp(make, "LEICA", 5)) + { + if (!strncmp(model, "M8", 2) || + !strncasecmp(model, "Leica M8", 8) || + !strncasecmp(model, "LEICA X", 7)) + { + base = ftell(ifp)-8; + } + else if (!strncasecmp(model, "LEICA M (Typ 240)", 17)) + { + base = 0; + } + else if (!strncmp(model, "M9", 2) || + !strncasecmp(model, "Leica M9", 8) || + !strncasecmp(model, "M Monochrom", 11) || + !strncasecmp(model, "Leica M Monochrom", 11)) + { + if (!uptag) + { + base = ftell(ifp) - 10; + fseek (ifp, 8, SEEK_CUR); + } + else if (uptag == 0x3400) + { + fseek (ifp, 10, SEEK_CUR); + base += 10; + } + } + else if (!strncasecmp(model, "LEICA T", 7)) + { + base = ftell(ifp)-8; +#ifdef LIBRAW_LIBRARY_BUILD + imgdata.lens.makernotes.CameraMount = LIBRAW_MOUNT_Leica_T; +#endif + } + } + + entries = get2(); + if (entries > 1000) return; + morder = order; + while (entries--) { + order = morder; tiff_get (base, &tag, &type, &len, &save); tag |= uptag << 16; + if(len > 100*1024*1024) continue; // 100Mb tag? No! + +#ifdef LIBRAW_LIBRARY_BUILD + INT64 _pos = ftell(ifp); + if (!strncmp(make, "Canon",5)) + { + if (tag == 0x0001) // camera settings + { + fseek(ifp, 44, SEEK_CUR); + imgdata.lens.makernotes.LensID = get2(); + imgdata.lens.makernotes.MaxFocal = get2(); + imgdata.lens.makernotes.MinFocal = get2(); + imgdata.lens.makernotes.CanonFocalUnits = get2(); + if (imgdata.lens.makernotes.CanonFocalUnits != 1) + { + imgdata.lens.makernotes.MaxFocal /= (float)imgdata.lens.makernotes.CanonFocalUnits; + imgdata.lens.makernotes.MinFocal /= (float)imgdata.lens.makernotes.CanonFocalUnits; + } + imgdata.lens.makernotes.MaxAp = _CanonConvertAperture(get2()); + imgdata.lens.makernotes.MinAp = _CanonConvertAperture(get2()); + } + + else if (tag == 0x0002) // focal length + { + imgdata.lens.makernotes.FocalType = get2(); + imgdata.lens.makernotes.CurFocal = get2(); + if ((imgdata.lens.makernotes.CanonFocalUnits != 1) && + imgdata.lens.makernotes.CanonFocalUnits) + { + imgdata.lens.makernotes.CurFocal /= (float)imgdata.lens.makernotes.CanonFocalUnits; + } + } + + else if (tag == 0x0004) // shot info + { + short tempAp; + fseek(ifp, 8, SEEK_CUR); + if ((tempAp = get2()) != 0x7fff) + imgdata.lens.makernotes.CurAp = _CanonConvertAperture(tempAp); + if (imgdata.lens.makernotes.CurAp < 0.7f) + { + fseek(ifp, 32, SEEK_CUR); + imgdata.lens.makernotes.CurAp = _CanonConvertAperture(get2()); + } + if (!aperture) aperture = imgdata.lens.makernotes.CurAp; + } + + else if (tag == 0x000d) // camera info + { + CanonCameraInfo = (uchar*)malloc(len); + fread(CanonCameraInfo, len, 1, ifp); + lenCanonCameraInfo = len; + } + + else if (tag == 0x0095 && // lens model tag + !imgdata.lens.makernotes.Lens[0]) + { + fread(imgdata.lens.makernotes.Lens, 2, 1, ifp); + imgdata.lens.makernotes.LensMount = LIBRAW_MOUNT_Canon_EF; + if (imgdata.lens.makernotes.Lens[0] < 65) // non-Canon lens + fread(imgdata.lens.makernotes.Lens + 2, 62, 1, ifp); + else + { + char efs[2]; + imgdata.lens.makernotes.LensFeatures_pre[0] = imgdata.lens.makernotes.Lens[0]; + imgdata.lens.makernotes.LensFeatures_pre[1] = imgdata.lens.makernotes.Lens[1]; + fread(efs, 2, 1, ifp); + if (efs[0] == 45 && (efs[1] == 83 || efs[1] == 69 || efs[1] == 77)) + { // "EF-S, TS-E, MP-E, EF-M" lenses + imgdata.lens.makernotes.Lens[2] = imgdata.lens.makernotes.LensFeatures_pre[2] = efs[0]; + imgdata.lens.makernotes.Lens[3] = imgdata.lens.makernotes.LensFeatures_pre[3] = efs[1]; + imgdata.lens.makernotes.Lens[4] = 32; + if (efs[1] == 83) + { + imgdata.lens.makernotes.LensMount = LIBRAW_MOUNT_Canon_EF_S; + imgdata.lens.makernotes.LensFormat = LIBRAW_FORMAT_APSC; + } + else if (efs[1] == 77) + { + imgdata.lens.makernotes.LensMount = LIBRAW_MOUNT_Canon_EF_M; + } + } + else + { // "EF" lenses + imgdata.lens.makernotes.Lens[2] = 32; + imgdata.lens.makernotes.Lens[3] = efs[0]; + imgdata.lens.makernotes.Lens[4] = efs[1]; + } + fread(imgdata.lens.makernotes.Lens + 5, 58, 1, ifp); + } + } + } + + else if (!strncmp(make, "FUJI", 4)) + switch (tag) { + case 0x1404: imgdata.lens.makernotes.MinFocal = getreal(type); break; + case 0x1405: imgdata.lens.makernotes.MaxFocal = getreal(type); break; + case 0x1406: imgdata.lens.makernotes.MaxAp4MinFocal = getreal(type); break; + case 0x1407: imgdata.lens.makernotes.MaxAp4MaxFocal = getreal(type); break; + } + + else if (!strncasecmp(make, "LEICA", 5)) + { + if ((tag == 0x0303) && (type != 4)) + { + fread(imgdata.lens.makernotes.Lens, MIN(len,127), 1, ifp); + } + + if ((tag == 0x3405) || + (tag == 0x0310) || + (tag == 0x34003405)) + { + imgdata.lens.makernotes.LensID = get4(); + imgdata.lens.makernotes.LensID = + ((imgdata.lens.makernotes.LensID>>2)<<8) | + (imgdata.lens.makernotes.LensID & 0x3); + if (imgdata.lens.makernotes.LensID != -1) + { + if ((model[0] == 'M') || + !strncasecmp (model, "LEICA M", 7)) + { + imgdata.lens.makernotes.CameraMount = LIBRAW_MOUNT_Leica_M; + if (imgdata.lens.makernotes.LensID) + imgdata.lens.makernotes.LensMount = LIBRAW_MOUNT_Leica_M; + } + else if ((model[0] == 'S') || + !strncasecmp (model, "LEICA S", 7)) + { + imgdata.lens.makernotes.CameraMount = LIBRAW_MOUNT_Leica_S; + if (imgdata.lens.makernotes.Lens[0]) + imgdata.lens.makernotes.LensMount = LIBRAW_MOUNT_Leica_S; + } + } + } + + else if ( + ((tag == 0x0313) || (tag == 0x34003406)) && + (fabs(imgdata.lens.makernotes.CurAp) < 0.17f) && + ((type == 10) || (type == 5)) + ) + { + imgdata.lens.makernotes.CurAp = getreal(type); + if (imgdata.lens.makernotes.CurAp > 126.3) + imgdata.lens.makernotes.CurAp = 0.0f; + } + + else if (tag == 0x3400) + { + parse_makernote (base, 0x3400); + } + } + + else if (!strncmp(make, "NIKON",5)) + { + if (tag == 0x000a) + { + imgdata.lens.makernotes.LensMount = LIBRAW_MOUNT_FixedLens; + imgdata.lens.makernotes.CameraMount = LIBRAW_MOUNT_FixedLens; + } + else if (tag == 0x0082) // lens attachment + { + fread(imgdata.lens.makernotes.Attachment, MIN(len,127), 1, ifp); + } + else if (tag == 0x0083) // lens type + { + imgdata.lens.nikon.NikonLensType = fgetc(ifp); + } + else if (tag == 0x0084) // lens + { + imgdata.lens.makernotes.MinFocal = getreal(type); + imgdata.lens.makernotes.MaxFocal = getreal(type); + imgdata.lens.makernotes.MaxAp4MinFocal = getreal(type); + imgdata.lens.makernotes.MaxAp4MaxFocal = getreal(type); + } + else if (tag == 0x008b) // lens f-stops + { + uchar a, b, c; + a = fgetc(ifp); + b = fgetc(ifp); + c = fgetc(ifp); + if (c) + { + imgdata.lens.nikon.NikonLensFStops = a*b*(12/c); + imgdata.lens.makernotes.LensFStops = + (float)imgdata.lens.nikon.NikonLensFStops /12.0f; + } + } + else if (tag == 0x0093) + { + i = get2(); + if ((i == 7) || (i == 9)) + { + imgdata.lens.makernotes.LensMount = LIBRAW_MOUNT_FixedLens; + imgdata.lens.makernotes.CameraMount = LIBRAW_MOUNT_FixedLens; + } + } + else if (tag == 0x0098) // contains lens data + { + for (i = 0; i < 4; i++) + { + NikonLensDataVersion = NikonLensDataVersion * 10 + fgetc(ifp) - '0'; + } + switch (NikonLensDataVersion) + { + case 100: lenNikonLensData = 9; break; + case 101: + case 201: // encrypted, starting from v.201 + case 202: + case 203: lenNikonLensData = 15; break; + case 204: lenNikonLensData = 16; break; + case 400: lenNikonLensData = 459; break; + case 401: lenNikonLensData = 590; break; + case 402: lenNikonLensData = 509; break; + case 403: lenNikonLensData = 879; break; + } + if(lenNikonLensData>0) + { + table_buf = (uchar*)malloc(lenNikonLensData); + fread(table_buf, lenNikonLensData, 1, ifp); + if ((NikonLensDataVersion < 201) && lenNikonLensData) + { + processNikonLensData(table_buf, lenNikonLensData); + free(table_buf); + lenNikonLensData = 0; + } + } + } + } + + else if (!strncmp(make, "OLYMPUS", 7)) + { + switch (tag) { + case 0x0207: + case 0x20100100: + { + uchar sOlyID[8]; + unsigned long long OlyID; + fread (sOlyID, MIN(len,7), 1, ifp); + sOlyID[7] = 0; + OlyID = sOlyID[0]; + i = 1; + while (i < 7 && sOlyID[i]) + { + OlyID = OlyID << 8 | sOlyID[i]; + i++; + } + setOlympusBodyFeatures(OlyID); + } + break; + case 0x1002: + imgdata.lens.makernotes.CurAp = powf64(2.0f, getreal(type)/2); + break; + case 0x20100201: + { + unsigned long long oly_lensid [3]; + oly_lensid[0] = fgetc(ifp); + fgetc(ifp); + oly_lensid[1] = fgetc(ifp); + oly_lensid[2] = fgetc(ifp); + imgdata.lens.makernotes.LensID = + (oly_lensid[0] << 16) | (oly_lensid[1] << 8) | oly_lensid[2]; + } + imgdata.lens.makernotes.LensMount = LIBRAW_MOUNT_FT; + imgdata.lens.makernotes.LensFormat = LIBRAW_FORMAT_FT; + if (((imgdata.lens.makernotes.LensID < 0x20000) || + (imgdata.lens.makernotes.LensID > 0x4ffff)) && + (imgdata.lens.makernotes.LensID & 0x10)) + { + imgdata.lens.makernotes.LensMount = LIBRAW_MOUNT_mFT; + } + break; + case 0x20100203: + fread(imgdata.lens.makernotes.Lens, MIN(len,127), 1, ifp); + break; + case 0x20100205: + imgdata.lens.makernotes.MaxAp4MinFocal = powf64(sqrt(2.0f), get2() / 256.0f); + break; + case 0x20100206: + imgdata.lens.makernotes.MaxAp4MaxFocal = powf64(sqrt(2.0f), get2() / 256.0f); + break; + case 0x20100207: + imgdata.lens.makernotes.MinFocal = (float)get2(); + break; + case 0x20100208: + imgdata.lens.makernotes.MaxFocal = (float)get2(); + if (imgdata.lens.makernotes.MaxFocal > 1000.0f) + imgdata.lens.makernotes.MaxFocal = imgdata.lens.makernotes.MinFocal; + break; + case 0x2010020a: + imgdata.lens.makernotes.MaxAp4CurFocal = powf64(sqrt(2.0f), get2() / 256.0f); + break; + case 0x20100301: + imgdata.lens.makernotes.TeleconverterID = fgetc(ifp) << 8; + fgetc(ifp); + imgdata.lens.makernotes.TeleconverterID = + imgdata.lens.makernotes.TeleconverterID | fgetc(ifp); + break; + case 0x20100303: + fread(imgdata.lens.makernotes.Teleconverter, MIN(len,127), 1, ifp); + break; + case 0x20100403: + fread(imgdata.lens.makernotes.Attachment, MIN(len,127), 1, ifp); + break; + } + } + + else if ((!strncmp(make, "PENTAX", 6) || !strncmp(make, "RICOH", 5)) && + !strncmp(model, "GR", 2)) + { + if ((tag == 0x1001) && (type == 3)) + { + imgdata.lens.makernotes.CameraMount = LIBRAW_MOUNT_FixedLens; + imgdata.lens.makernotes.LensMount = LIBRAW_MOUNT_FixedLens; + imgdata.lens.makernotes.CameraFormat = LIBRAW_FORMAT_APSC; + imgdata.lens.makernotes.LensID = -1; + imgdata.lens.makernotes.FocalType = 1; + } + else if ((tag == 0x1017) && (get2() == 2)) + { + strcpy(imgdata.lens.makernotes.Attachment, "Wide-Angle Adapter"); + } + else if (tag == 0x1500) + { + imgdata.lens.makernotes.CurFocal = getreal(type); + } + } + + else if (!strncmp(make, "RICOH", 5) && + strncmp(model, "PENTAX", 6)) + { + if ((tag == 0x1017) && (get2() == 2)) + { + strcpy(imgdata.lens.makernotes.Attachment, "Wide-Angle Adapter"); + } + + else if (tag == 0x1500) + { + imgdata.lens.makernotes.CurFocal = getreal(type); + } + + else if ((tag == 0x2001) && !strncmp(model, "GXR", 3)) + { + short ntags, cur_tag; + fseek(ifp, 20, SEEK_CUR); + ntags = get2(); + cur_tag = get2(); + while (cur_tag != 0x002c) + { + fseek(ifp, 10, SEEK_CUR); + cur_tag = get2(); + } + fseek(ifp, 6, SEEK_CUR); + fseek(ifp, get4()+34, SEEK_SET); + imgdata.lens.makernotes.LensID = getc(ifp) - '0'; + switch(imgdata.lens.makernotes.LensID) + { + case 1: + case 2: + case 3: + case 5: + case 6: + imgdata.lens.makernotes.CameraMount = LIBRAW_MOUNT_FixedLens; + imgdata.lens.makernotes.LensMount = LIBRAW_MOUNT_RicohModule; + break; + case 8: + imgdata.lens.makernotes.CameraMount = LIBRAW_MOUNT_Leica_M; + imgdata.lens.makernotes.CameraFormat = LIBRAW_FORMAT_APSC; + imgdata.lens.makernotes.LensID = -1; + break; + default: + imgdata.lens.makernotes.LensID = -1; + } + } + } + + else if (!strncmp(make, "PENTAX", 6) || + !strncmp(model, "PENTAX", 6) || + (!strncmp(make, "SAMSUNG", 7) && dng_version) && + strncmp(model, "GR", 2)) + { + if (tag == 0x0005) + { + unique_id = get4(); + setPentaxBodyFeatures(unique_id); + } + else if (tag == 0x0013) + { + imgdata.lens.makernotes.CurAp = (float)get2()/10.0f; + } + else if (tag == 0x001d) + { + imgdata.lens.makernotes.CurFocal = (float)get4()/100.0f; + } + else if (tag == 0x003f) + { + imgdata.lens.makernotes.LensID = fgetc(ifp) << 8 | fgetc(ifp); + } + else if (tag == 0x0207) + { + PentaxLensInfo(imgdata.lens.makernotes.CamID, len); + } + else if (tag == 0x0239) // Q-series lens info (LensInfoQ) + { + char LensInfo [20]; + fseek (ifp, 2, SEEK_CUR); + fread(imgdata.lens.makernotes.Lens, 30, 1, ifp); + strcat(imgdata.lens.makernotes.Lens, " "); + fread(LensInfo, 20, 1, ifp); + strcat(imgdata.lens.makernotes.Lens, LensInfo); + } + } + + else if (!strncmp(make, "SAMSUNG", 7)) + { + if (tag == 0x0002) + { + if(get4() == 0x2000) + { + imgdata.lens.makernotes.CameraMount = LIBRAW_MOUNT_Samsung_NX; + } + else if (!strncmp(model, "NX mini", 7)) + { + imgdata.lens.makernotes.CameraMount = LIBRAW_MOUNT_Samsung_NX_M; + } + else + { + imgdata.lens.makernotes.CameraMount = LIBRAW_MOUNT_FixedLens; + imgdata.lens.makernotes.LensMount = LIBRAW_MOUNT_FixedLens; + } + } + else if (tag == 0x0003) + { + unique_id = imgdata.lens.makernotes.CamID = get4(); + } + else if (tag == 0xa003) + { + imgdata.lens.makernotes.LensID = get2(); + if (imgdata.lens.makernotes.LensID) + imgdata.lens.makernotes.LensMount = LIBRAW_MOUNT_Samsung_NX; + } + else if (tag == 0xa019) + { + imgdata.lens.makernotes.CurAp = getreal(type); + } + else if (tag == 0xa01a) + { + imgdata.lens.makernotes.FocalLengthIn35mmFormat = get4() / 10.0f; + if (imgdata.lens.makernotes.FocalLengthIn35mmFormat < 10.0f) + imgdata.lens.makernotes.FocalLengthIn35mmFormat *= 10.0f; + } + } + + else if (!strncasecmp(make, "SONY", 4) || + !strncasecmp(make, "Konica", 6) || + !strncasecmp(make, "Minolta", 7) || + (!strncasecmp(make, "Hasselblad", 10) && + (!strncasecmp(model, "Stellar", 7) || + !strncasecmp(model, "Lunar", 5) || + !strncasecmp(model, "Lusso", 5) || + !strncasecmp(model, "HV",2)))) + { + ushort lid; + + if (tag == 0xb001) // Sony ModelID + { + unique_id = get2(); + setSonyBodyFeatures(unique_id); + if (table_buf_0x9050_present) + { + process_Sony_0x9050(table_buf_0x9050, unique_id); + free (table_buf_0x9050); + table_buf_0x9050_present = 0; + } + if (table_buf_0x940c_present) + { + if (imgdata.lens.makernotes.CameraMount == LIBRAW_MOUNT_Sony_E) + { + process_Sony_0x940c(table_buf_0x940c); + } + free (table_buf_0x940c); + table_buf_0x940c_present = 0; + } + } + + else if ((tag == 0x0010) && // CameraInfo + strncasecmp(model, "DSLR-A100", 9) && + strncasecmp(model, "NEX-5C", 6) && + !strncasecmp(make, "SONY", 4) && + ((len == 368) || // a700 + (len == 5478) || // a850, a900 + (len == 5506) || // a200, a300, a350 + (len == 6118) || // a230, a290, a330, a380, a390 + + // a450, a500, a550, a560, a580 + // a33, a35, a55 + // NEX3, NEX5, NEX5C, NEXC3, VG10E + (len == 15360)) + ) + { + table_buf = (uchar*)malloc(len); + fread(table_buf, len, 1, ifp); + if (memcmp(table_buf, "\xff\xff\xff\xff\xff\xff\xff\xff", 8) && + memcmp(table_buf, "\x00\x00\x00\x00\x00\x00\x00\x00", 8)) + { + switch (len) + { + case 368: + case 5478: + // a700, a850, a900: CameraInfo + if (table_buf[0] | table_buf[3]) + imgdata.lens.makernotes.MinFocal = + bcd2dec(table_buf[0]) * 100 + bcd2dec(table_buf[3]); + if (table_buf[2] | table_buf[5]) + imgdata.lens.makernotes.MaxFocal = + bcd2dec(table_buf[2]) * 100 + bcd2dec(table_buf[5]); + if (table_buf[4]) + imgdata.lens.makernotes.MaxAp4MinFocal = bcd2dec(table_buf[4]) / 10.0f; + if (table_buf[4]) + imgdata.lens.makernotes.MaxAp4MaxFocal = bcd2dec(table_buf[7]) / 10.0f; + parseSonyLensFeatures(table_buf[1], table_buf[6]); + break; + default: + // CameraInfo2 & 3 + if (table_buf[1] | table_buf[2]) + imgdata.lens.makernotes.MinFocal = + bcd2dec(table_buf[1]) * 100 + bcd2dec(table_buf[2]); + if (table_buf[3] | table_buf[4]) + imgdata.lens.makernotes.MaxFocal = + bcd2dec(table_buf[3]) * 100 + bcd2dec(table_buf[4]); + if (table_buf[5]) + imgdata.lens.makernotes.MaxAp4MinFocal = bcd2dec(table_buf[5]) / 10.0f; + if (table_buf[6]) + imgdata.lens.makernotes.MaxAp4MaxFocal = bcd2dec(table_buf[6]) / 10.0f; + parseSonyLensFeatures(table_buf[0], table_buf[7]); + } + } + free(table_buf); + } + + else if (tag == 0x0105) // Teleconverter + { + imgdata.lens.makernotes.TeleconverterID = get2(); + } + + else if (tag == 0x0114) // CameraSettings + { + table_buf = (uchar*)malloc(len); + fread(table_buf, len, 1, ifp); + switch (len) { + case 280: + case 364: + case 332: + // CameraSettings and CameraSettings2 are big endian + if (table_buf[2] | table_buf[3]) + { + lid = (((ushort)table_buf[2])<<8) | + ((ushort)table_buf[3]); + imgdata.lens.makernotes.CurAp = + powf64(2.0f, ((float)lid/8.0f-1.0f)/2.0f); + } + break; + case 1536: + case 2048: + // CameraSettings3 are little endian + parseSonyLensType2(table_buf[1016], table_buf[1015]); + if (imgdata.lens.makernotes.LensMount != LIBRAW_MOUNT_Canon_EF) + { + switch (table_buf[153]) { + case 16: imgdata.lens.makernotes.LensMount = LIBRAW_MOUNT_Minolta_A; break; + case 17: imgdata.lens.makernotes.LensMount = LIBRAW_MOUNT_Sony_E; break; + } + } + break; + } + free(table_buf); + } + + else if (tag == 0x9050) // little endian + { + table_buf_0x9050 = (uchar*)malloc(len); + table_buf_0x9050_present = 1; + fread(table_buf_0x9050, len, 1, ifp); + + if (imgdata.lens.makernotes.CamID) + { + process_Sony_0x9050(table_buf_0x9050, imgdata.lens.makernotes.CamID); + free (table_buf_0x9050); + table_buf_0x9050_present = 0; + } + } + + else if (tag == 0x940c) + { + table_buf_0x940c = (uchar*)malloc(len); + table_buf_0x940c_present = 1; + fread(table_buf_0x940c, len, 1, ifp); + if ((imgdata.lens.makernotes.CamID) && + (imgdata.lens.makernotes.CameraMount == LIBRAW_MOUNT_Sony_E)) + { + process_Sony_0x940c(table_buf_0x940c); + free(table_buf_0x940c); + table_buf_0x940c_present = 0; + } + } + + else if (((tag == 0xb027) || (tag == 0x010c)) && (imgdata.lens.makernotes.LensID == -1)) + { + imgdata.lens.makernotes.LensID = get4(); + if ((imgdata.lens.makernotes.LensID > 61184) && + (imgdata.lens.makernotes.LensID < 65535)) + { + imgdata.lens.makernotes.LensID -= 61184; + imgdata.lens.makernotes.LensMount = LIBRAW_MOUNT_Canon_EF; + } + if (tag == 0x010c) imgdata.lens.makernotes.CameraMount = LIBRAW_MOUNT_Minolta_A; + } + + else if (tag == 0xb02a) // Sony LensSpec + { + table_buf = (uchar*)malloc(len); + fread(table_buf, len, 1, ifp); + if (table_buf[1] | table_buf[2]) + imgdata.lens.makernotes.MinFocal = + bcd2dec(table_buf[1]) * 100 + bcd2dec(table_buf[2]); + if (table_buf[3] | table_buf[4]) + imgdata.lens.makernotes.MaxFocal = + bcd2dec(table_buf[3]) * 100 + bcd2dec(table_buf[4]); + if (table_buf[5]) + imgdata.lens.makernotes.MaxAp4MinFocal = bcd2dec(table_buf[5]) / 10.0f; + if (table_buf[6]) + imgdata.lens.makernotes.MaxAp4MaxFocal = bcd2dec(table_buf[6]) / 10.0f; + parseSonyLensFeatures(table_buf[0], table_buf[7]); + free(table_buf); + } + } + + fseek(ifp,_pos,SEEK_SET); +#endif + if (tag == 2 && strstr(make,"NIKON") && !iso_speed) iso_speed = (get2(),get2()); - if (tag == 37 && strstr(make,"NIKON") && !iso_speed) + if (tag == 37 && strstr(make,"NIKON") && (!iso_speed || iso_speed == 65535)) { unsigned char cc; fread(&cc,1,1,ifp); - iso_speed = int(100.0 * pow(2.0,double(cc)/12.0-5.0)); + iso_speed = int(100.0 * powf64(2.0f,float(cc)/12.0-5.0)); } if (tag == 4 && len > 26 && len < 35) { - if ((i=(get4(),get2())) != 0x7fff && !iso_speed) - iso_speed = 50 * pow (2.0, i/32.0 - 4); + if ((i=(get4(),get2())) != 0x7fff && (!iso_speed || iso_speed == 65535)) + iso_speed = 50 * powf64(2.0, i/32.0 - 4); +#ifdef LIBRAW_LIBRARY_BUILD + get4(); +#else if ((i=(get2(),get2())) != 0x7fff && !aperture) - aperture = pow (2.0, i/64.0); + aperture = powf64(2.0, i/64.0); +#endif if ((i=get2()) != 0xffff && !shutter) - shutter = pow (2.0, (short) i/-32.0); + shutter = powf64(2.0, (short) i/-32.0); wbi = (get2(),get2()); shot_order = (get2(),get2()); } @@ -6105,7 +9265,7 @@ fgets (model2, 64, ifp); if (tag == 8 && type == 4) shot_order = get4(); - if (tag == 9 && !strcmp(make,"Canon")) + if (tag == 9 && !strncmp(make,"Canon",5)) fread (artist, 64, 1, ifp); if (tag == 0xc && len == 4) FORC3 cam_mul[(c << 1 | c >> 1) & 3] = getreal(type); @@ -6116,8 +9276,150 @@ if (get4() == 257 && (i=len) && (c = (get4(),fgetc(ifp))) < 3) flip = "065"[c]-'0'; } + if (tag == 0x10 && type == 4) - unique_id = get4(); + { + unique_id = get4(); + +#ifdef LIBRAW_LIBRARY_BUILD + if (unique_id == 0x03740000) unique_id = 0x80000374; + setCanonBodyFeatures(unique_id); + if (lenCanonCameraInfo) + { + processCanonCameraInfo(unique_id, CanonCameraInfo,lenCanonCameraInfo); + free(CanonCameraInfo); + CanonCameraInfo = 0; + lenCanonCameraInfo = 0; + } +#endif + } + +#ifdef LIBRAW_LIBRARY_BUILD + INT64 _pos2 = ftell(ifp); + + if(tag == 0x20400805 && len == 2 && !strncasecmp(make,"Olympus",7)) + { + imgdata.color.OlympusSensorCalibration[0]=getreal(type); + imgdata.color.OlympusSensorCalibration[1]=getreal(type); + } + if (tag == 0x4001 && len > 500 && !strncasecmp(make,"Canon",5)) + { + long int save1 = ftell(ifp); + switch (len) + { + case 582: + imgdata.color.canon_makernotes.CanonColorDataVer = 1; // 20D / 350D + break; + case 653: + imgdata.color.canon_makernotes.CanonColorDataVer = 2; // 1Dmk2 / 1DsMK2 + break; + case 796: + imgdata.color.canon_makernotes.CanonColorDataVer = 3; // 1DmkIIN / 5D / 30D / 400D + imgdata.color.canon_makernotes.CanonColorDataSubVer = get2(); + { + fseek (ifp, save1+(0x0c4<<1), SEEK_SET); // offset 196 short + int bls=0; + FORC4 bls+=get2(); + imgdata.color.canon_makernotes.AverageBlackLevel = bls/4; + } + break; + // 1DmkIII / 1DSmkIII / 1DmkIV / 5DmkII + // 7D / 40D / 50D / 60D / 450D / 500D + // 550D / 1000D / 1100D + case 674: case 692: case 702: case 1227: case 1250: + case 1251: case 1337: case 1338: case 1346: + imgdata.color.canon_makernotes.CanonColorDataVer = 4; + imgdata.color.canon_makernotes.CanonColorDataSubVer = get2(); + { + fseek (ifp, save1+(0x0e7<<1), SEEK_SET); // offset 231 short + int bls=0; + FORC4 bls+=get2(); + imgdata.color.canon_makernotes.AverageBlackLevel = bls/4; + } + if ((imgdata.color.canon_makernotes.CanonColorDataSubVer == 4) + || (imgdata.color.canon_makernotes.CanonColorDataSubVer == 5)) + { + fseek (ifp, save1+(0x2b9<<1), SEEK_SET); // offset 697 shorts + imgdata.color.canon_makernotes.SpecularWhiteLevel = get2(); + } + else if ((imgdata.color.canon_makernotes.CanonColorDataSubVer == 6) || + (imgdata.color.canon_makernotes.CanonColorDataSubVer == 7)) + { + fseek (ifp, save1+(0x2d0<<1), SEEK_SET); // offset 720 shorts + imgdata.color.canon_makernotes.SpecularWhiteLevel = get2(); + } + else if (imgdata.color.canon_makernotes.CanonColorDataSubVer == 9) + { + fseek (ifp, save1+(0x2d4<<1), SEEK_SET); // offset 724 shorts + imgdata.color.canon_makernotes.SpecularWhiteLevel = get2(); + } + break; + + case 5120: + imgdata.color.canon_makernotes.CanonColorDataVer = 5; // PowerSot G10, EOS M3 + { + fseek (ifp, save1+(0x108<<1), SEEK_SET); // offset 264 short + int bls=0; + FORC4 bls+=get2(); + imgdata.color.canon_makernotes.AverageBlackLevel = bls/4; + } + break; + + case 1273: case 1275: + imgdata.color.canon_makernotes.CanonColorDataVer = 6; // 600D / 1200D + imgdata.color.canon_makernotes.CanonColorDataSubVer = get2(); + { + fseek (ifp, save1+(0x0fb<<1), SEEK_SET); // offset 251 short + int bls=0; + FORC4 bls+=get2(); + imgdata.color.canon_makernotes.AverageBlackLevel = bls/4; + } + fseek (ifp, save1+(0x1e4<<1), SEEK_SET); // offset 484 shorts + imgdata.color.canon_makernotes.SpecularWhiteLevel = get2(); + break; + + // 1DX / 5DmkIII / 6D / 100D / 650D / 700D / M / 7DmkII / 750D / 760D + case 1312: case 1313: case 1316: case 1506: + imgdata.color.canon_makernotes.CanonColorDataVer = 7; + imgdata.color.canon_makernotes.CanonColorDataSubVer = get2(); + { + fseek (ifp, save1+(0x114<<1), SEEK_SET); // offset 276 shorts + int bls=0; + FORC4 bls+=get2(); + imgdata.color.canon_makernotes.AverageBlackLevel = bls/4; + } + if (imgdata.color.canon_makernotes.CanonColorDataSubVer == 10) + { + fseek (ifp, save1+(0x1fd<<1), SEEK_SET); // offset 509 shorts + imgdata.color.canon_makernotes.SpecularWhiteLevel = get2(); + } else if (imgdata.color.canon_makernotes.CanonColorDataSubVer == 11) + { + fseek (ifp, save1+(0x2dd<<1), SEEK_SET); // offset 733 shorts + imgdata.color.canon_makernotes.SpecularWhiteLevel = get2(); + } + break; + + // 5DS / 5DS R + case 1560: + imgdata.color.canon_makernotes.CanonColorDataVer = 8; + imgdata.color.canon_makernotes.CanonColorDataSubVer = get2(); + { + fseek (ifp, save1+(0x146<<1), SEEK_SET); // offset 326 shorts + int bls=0; + FORC4 bls+=get2(); + imgdata.color.canon_makernotes.AverageBlackLevel = bls/4; + } + fseek (ifp, save1+(0x30f<<1), SEEK_SET); // offset 783 shorts + imgdata.color.canon_makernotes.SpecularWhiteLevel = get2(); + break; + + } + fseek (ifp, save1, SEEK_SET); + } + + fseek(ifp,_pos2,SEEK_SET); + +#endif if (tag == 0x11 && is_raw && !strncmp(make,"NIKON",5)) { fseek (ifp, get4()+base, SEEK_SET); parse_tiff_ifd (base); @@ -6144,6 +9446,16 @@ if (tag == 0x1d) while ((c = fgetc(ifp)) && c != EOF) serial = serial*10 + (isdigit(c) ? c - '0' : c % 10); + if (tag == 0x29 && type == 1) { // Canon PowerShot G9 + c = wbi < 18 ? "012347800000005896"[wbi]-'0' : 0; + fseek (ifp, 8 + c*32, SEEK_CUR); + FORC4 cam_mul[c ^ (c >> 1) ^ 1] = get4(); + } +#ifndef LIBRAW_LIBRARY_BUILD + // works for some files, but not all + if (tag == 0x3d && type == 3 && len == 4) + FORC4 cblack[c ^ c >> 1] = get2() >> (14-tiff_ifd[2].bps); +#endif if (tag == 0x81 && type == 4) { data_offset = get4(); fseek (ifp, data_offset + 41, SEEK_SET); @@ -6151,11 +9463,6 @@ raw_width = get2(); filters = 0x61616161; } - if (tag == 0x29 && type == 1) { - c = wbi < 18 ? "012347800000005896"[wbi]-'0' : 0; - fseek (ifp, 8 + c*32, SEEK_CUR); - FORC4 cam_mul[c ^ (c >> 1) ^ 1] = get4(); - } if ((tag == 0x81 && type == 7) || (tag == 0x100 && type == 7) || (tag == 0x280 && type == 1)) { @@ -6178,7 +9485,8 @@ break; case 102: fseek (ifp, 6, SEEK_CUR); - goto get2_rggb; + FORC4 cam_mul[c ^ (c >> 1)] = get2(); + break; case 103: fseek (ifp, 16, SEEK_CUR); FORC4 cam_mul[c] = get2(); @@ -6197,17 +9505,40 @@ fseek (ifp, wbi*48, SEEK_CUR); FORC3 cam_mul[c] = get2(); } - if (tag == 0xa7 && (unsigned) (ver97-200) < 17) { - ci = xlat[0][serial & 0xff]; - cj = xlat[1][fgetc(ifp)^fgetc(ifp)^fgetc(ifp)^fgetc(ifp)]; - ck = 0x60; - for (i=0; i < 324; i++) - buf97[i] ^= (cj += ci * ck++); - i = "66666>666;6A;:;55"[ver97-200] - '0'; - FORC4 cam_mul[c ^ (c >> 1) ^ (i & 1)] = - sget2 (buf97 + (i & -2) + c*2); + + if (tag == 0xa7) { // shutter count + NikonKey = fgetc(ifp)^fgetc(ifp)^fgetc(ifp)^fgetc(ifp); + if ( (unsigned) (ver97-200) < 17) { + ci = xlat[0][serial & 0xff]; + cj = xlat[1][NikonKey]; + ck = 0x60; + for (i=0; i < 324; i++) + buf97[i] ^= (cj += ci * ck++); + i = "66666>666;6A;:;55"[ver97-200] - '0'; + FORC4 cam_mul[c ^ (c >> 1) ^ (i & 1)] = + sget2 (buf97 + (i & -2) + c*2); + } +#ifdef LIBRAW_LIBRARY_BUILD + if ((NikonLensDataVersion > 200) && lenNikonLensData) + { + ci = xlat[0][serial & 0xff]; + cj = xlat[1][NikonKey]; + ck = 0x60; + for (i = 0; i < lenNikonLensData; i++) + table_buf[i] ^= (cj += ci * ck++); + processNikonLensData(table_buf, lenNikonLensData); + lenNikonLensData = 0; + free(table_buf); + } + if (ver97 == 601) // Coolpix A + { + imgdata.lens.makernotes.LensMount = LIBRAW_MOUNT_FixedLens; + imgdata.lens.makernotes.CameraMount = LIBRAW_MOUNT_FixedLens; + } +#endif } - if(tag == 0xb001 && type == 3) + + if(tag == 0xb001 && type == 3) // Sony ModelID { unique_id = get2(); } @@ -6216,17 +9547,33 @@ if (tag == 0x200 && len == 4) FORC4 cblack[c ^ c >> 1] = get2(); if (tag == 0x201 && len == 4) - goto get2_rggb; + FORC4 cam_mul[c ^ (c >> 1)] = get2(); if (tag == 0x220 && type == 7) meta_offset = ftell(ifp); if (tag == 0x401 && type == 4 && len == 4) FORC4 cblack[c ^ c >> 1] = get4(); +#ifdef LIBRAW_LIBRARY_BUILD + // not corrected for file bitcount, to be patched in open_datastream if (tag == 0x03d && strstr(make,"NIKON") && len == 4) - FORC4 cblack[c ^ c >> 1] = get2(); + { + FORC4 cblack[c ^ c >> 1] = get2(); + i = cblack[3]; + FORC3 if(i>cblack[c]) i = cblack[c]; + FORC4 cblack[c]-=i; + black += i; + } +#endif if (tag == 0xe01) { /* Nikon Capture Note */ +#ifdef LIBRAW_LIBRARY_BUILD + int loopc = 0; +#endif order = 0x4949; fseek (ifp, 22, SEEK_CUR); for (offset=22; offset+22 < len; offset += 22+i) { +#ifdef LIBRAW_LIBRARY_BUILD + if(loopc++>1024) + throw LIBRAW_EXCEPTION_IO_CORRUPT; +#endif tag = get4(); fseek (ifp, 14, SEEK_CUR); i = get4()-4; @@ -6249,7 +9596,7 @@ } if ((tag == 0x1011 && len == 9) || tag == 0x20400200) { - if(!strcasecmp(make,"Olympus")) + if(!strncasecmp(make,"Olympus", 7)) { int j,k; for (i=0; i < 3; i++) @@ -6275,26 +9622,37 @@ cam_mul[0] = get2() / 256.0; cam_mul[2] = get2() / 256.0; } - if ((tag | 0x70) == 0x2070 && type == 4) + if ((tag | 0x70) == 0x2070 && (type == 4 || type == 13)) fseek (ifp, get4()+base, SEEK_SET); - if (tag == 0x2020) + if ((tag == 0x2020) && ((type == 7) || (type == 13))) parse_thumb_note (base, 257, 258); if (tag == 0x2040) parse_makernote (base, 0x2040); +#ifdef LIBRAW_LIBRARY_BUILD +// IB start + if (tag == 0x2010) + { + INT64 _pos3 = ftell(ifp); + parse_makernote(base, 0x2010); + fseek(ifp,_pos3,SEEK_SET); + } +// IB end +#endif if (tag == 0xb028) { fseek (ifp, get4()+base, SEEK_SET); parse_thumb_note (base, 136, 137); } - if (tag == 0x4001 && len > 500) { + if (tag == 0x4001 && len > 500 && len < 100000) { i = len == 582 ? 50 : len == 653 ? 68 : len == 5120 ? 142 : 126; fseek (ifp, i, SEEK_CUR); -get2_rggb: FORC4 cam_mul[c ^ (c >> 1)] = get2(); - i = len >> 3 == 164 ? 112:22; - fseek (ifp, i, SEEK_CUR); - FORC4 sraw_mul[c ^ (c >> 1)] = get2(); + for (i+=18; i <= len; i+=10) { + get2(); + FORC4 sraw_mul[c ^ (c >> 1)] = get2(); + if (sraw_mul[1] == 1170) break; + } } - if(!strcasecmp(make,"Samsung")) + if(!strncasecmp(make,"Samsung",7)) { if (tag == 0xa020) // get the full Samsung encryption key for (i=0; i<11; i++) SamsungKey[i] = get4(); @@ -6314,6 +9672,8 @@ if (tag == 0xa028) FORC4 cam_mul[c ^ (c >> 1)] -= get4(); } + if (tag == 0x4021 && get4() && get4()) + FORC4 cam_mul[c] = 1024; next: fseek (ifp, save, SEEK_SET); } @@ -6350,23 +9710,69 @@ void CLASS parse_exif (int base) { unsigned kodak, entries, tag, type, len, save, c; - double expo; + double expo,ape; kodak = !strncmp(make,"EASTMAN",7) && tiff_nifds < 3; entries = get2(); + if(!strncmp(make,"Hasselblad",10) && (tiff_nifds > 3) && (entries > 512)) return; while (entries--) { tiff_get (base, &tag, &type, &len, &save); + +#ifdef LIBRAW_LIBRARY_BUILD + if(callbacks.exif_cb) + { + int savepos = ftell(ifp); + callbacks.exif_cb(callbacks.exifparser_data,tag,type,len,order,ifp); + fseek(ifp,savepos,SEEK_SET); + } +#endif switch (tag) { +#ifdef LIBRAW_LIBRARY_BUILD + case 0xa405: // FocalLengthIn35mmFormat + imgdata.lens.FocalLengthIn35mmFormat = get2(); + break; + case 0xa432: // LensInfo, 42034dec, Lens Specification per EXIF standard + imgdata.lens.MinFocal = getreal(type); + imgdata.lens.MaxFocal = getreal(type); + imgdata.lens.MaxAp4MinFocal = getreal(type); + imgdata.lens.MaxAp4MaxFocal = getreal(type); + break; + case 0xc630: // DNG LensInfo, Lens Specification per EXIF standard + imgdata.lens.dng.MinFocal = getreal(type); + imgdata.lens.dng.MaxFocal = getreal(type); + imgdata.lens.dng.MaxAp4MinFocal = getreal(type); + imgdata.lens.dng.MaxAp4MaxFocal = getreal(type); + break; + case 0xa433: // LensMake + fread(imgdata.lens.LensMake, MIN(len,sizeof(imgdata.lens.LensMake)), 1, ifp); + break; + case 0xa434: // LensModel + fread(imgdata.lens.Lens, MIN(len, sizeof(imgdata.lens.LensMake)), 1, ifp); + if (!strncmp(imgdata.lens.Lens, "----", 4)) + imgdata.lens.Lens[0] = 0; + break; + case 0x9205: + imgdata.lens.EXIF_MaxAp = powf64(2.0f, (getreal(type) / 2.0f)); + break; +#endif case 33434: shutter = getreal(type); break; - case 33437: aperture = getreal(type); break; + case 33437: aperture = getreal(type); break; // 0x829d FNumber case 34855: iso_speed = get2(); break; + case 34866: + if (iso_speed == 0xffff && (!strncasecmp(make, "SONY",4) || !strncasecmp(make, "CANON",5))) + iso_speed = getreal(type); + break; case 36867: case 36868: get_timestamp(0); break; - case 37377: if ((expo = -getreal(type)) < 128) - shutter = pow (2.0, expo); break; - case 37378: aperture = pow (2.0, getreal(type)/2); break; + case 37377: if ((expo = -getreal(type)) < 128 && shutter == 0.) + shutter = powf64(2.0, expo); break; + case 37378: // 0x9202 ApertureValue + if ((fabs(ape = getreal(type))<256.0) && (!aperture)) + aperture = powf64(2.0, ape/2); + break; + case 37385: flash_used = getreal(type); break; case 37386: focal_len = getreal(type); break; - case 37500: parse_makernote (base, 0); break; + case 37500: parse_makernote (base, 0); break; // tag 0x927c case 40962: if (kodak) raw_width = get4(); break; case 40963: if (kodak) raw_height = get4(); break; case 41730: @@ -6378,6 +9784,45 @@ } } +#ifdef LIBRAW_LIBRARY_BUILD + +void CLASS parse_gps_libraw(int base) +{ + unsigned entries, tag, type, len, save, c; + + entries = get2(); + if (entries > 200) + return; + if (entries > 0) + imgdata.other.parsed_gps.gpsparsed = 1; + while (entries--) { + tiff_get(base, &tag, &type, &len, &save); + switch (tag) { + case 1: imgdata.other.parsed_gps.latref = getc(ifp); break; + case 3: imgdata.other.parsed_gps.longref = getc(ifp); break; + case 5: imgdata.other.parsed_gps.altref = getc(ifp); break; + case 2: + if (len == 3) + FORC(3) imgdata.other.parsed_gps.latitude[c] = getreal(type); + break; + case 4: + if (len == 3) + FORC(3) imgdata.other.parsed_gps.longtitude[c] = getreal(type); + break; + case 7: + if (len == 3) + FORC(3) imgdata.other.parsed_gps.gpstimestamp[c] = getreal(type); + break; + case 6: + imgdata.other.parsed_gps.altitude = getreal(type); + break; + case 9: imgdata.other.parsed_gps.gpsstatus = getc(ifp); break; + } + fseek(ifp, save, SEEK_SET); + } +} +#endif + void CLASS parse_gps (int base) { unsigned entries, tag, type, len, save, c; @@ -6411,6 +9856,9 @@ for (j=0; j < 3; j++) for (cmatrix[i][j] = k=0; k < 3; k++) cmatrix[i][j] += rgb_romm[i][k] * romm_cam[k][j]; +#ifdef LIBRAW_LIBRARY_BUILD + imgdata.color.digitalBack_color=1; +#endif } void CLASS parse_mos (int offset) @@ -6421,7 +9869,8 @@ { "","DCB2","Volare","Cantare","CMost","Valeo 6","Valeo 11","Valeo 22", "Valeo 11p","Valeo 17","","Aptus 17","Aptus 22","Aptus 75","Aptus 65", "Aptus 54S","Aptus 65S","Aptus 75S","AFi 5","AFi 6","AFi 7", - "","","","","","","","","","","","","","","","","","AFi-II 12" }; + "AFi-II 7","Aptus-II 7","","Aptus-II 6","","","Aptus-II 10","Aptus-II 5", + "","","","","Aptus-II 10R","Aptus-II 8","","Aptus-II 12","","AFi-II 12" }; float romm_cam[3][3]; fseek (ifp, offset, SEEK_SET); @@ -6431,6 +9880,14 @@ fread (data, 1, 40, ifp); skip = get4(); from = ftell(ifp); + +// IB start +#ifdef LIBRAW_LIBRARY_BUILD + if (!strcmp(data,"CameraObj_camera_type")) { + fread(imgdata.lens.makernotes.body, MIN(skip,63), 1, ifp); + } +#endif +// IB end if (!strcmp(data,"JPEG_preview_data")) { thumb_offset = from; thumb_length = skip; @@ -6446,12 +9903,12 @@ } if (!strcmp(data,"icc_camera_to_tone_matrix")) { for (i=0; i < 9; i++) - romm_cam[0][i] = int_to_float(get4()); + ((float *)romm_cam)[i] = int_to_float(get4()); romm_coeff (romm_cam); } if (!strcmp(data,"CaptProf_color_matrix")) { for (i=0; i < 9; i++) - fscanf (ifp, "%f", &romm_cam[0][i]); + fscanf (ifp, "%f", (float *)romm_cam + i); romm_coeff (romm_cam); } if (!strcmp(data,"CaptProf_number_of_planes")) @@ -6484,13 +9941,58 @@ void CLASS linear_table (unsigned len) { int i; - if (len > 0x1000) len = 0x1000; + if (len > 0x10000) len = 0x10000; read_shorts (curve, len); - for (i=len; i < 0x1000; i++) + for (i=len; i < 0x10000; i++) curve[i] = curve[i-1]; - maximum = curve[0xfff]; + maximum = curve[len<0x1000?0xfff:len-1]; } +#ifdef LIBRAW_LIBRARY_BUILD +/* Thanks to Alexey Danilchenko for wb as-shot parsing code */ +void CLASS parse_kodak_ifd (int base) +{ + unsigned entries, tag, type, len, save; + int i, c, wbi=-2; + float mul[3]={1,1,1}, num; + static const int wbtag[] = { 64037,64040,64039,64041,-1,-1,64042 }; + + entries = get2(); + if (entries > 1024) return; + while (entries--) { + tiff_get (base, &tag, &type, &len, &save); +#ifdef LIBRAW_LIBRARY_BUILD + if(callbacks.exif_cb) + { + int savepos = ftell(ifp); + callbacks.exif_cb(callbacks.exifparser_data,tag | 0x20000,type,len,order,ifp); + fseek(ifp,savepos,SEEK_SET); + } +#endif + if (tag == 1020) wbi = getint(type); + if (tag == 1021 && len == 72) { /* WB set in software */ + fseek (ifp, 40, SEEK_CUR); + FORC3 cam_mul[c] = 2048.0 / get2(); + wbi = -2; + } + if (tag == 2120 + wbi || + (wbi<0 && tag == 2125)) /* use Auto WB if illuminant index is not set */ + { + FORC3 mul[c] = (num=getreal(type))==0 ? 1 : num; + FORC3 cam_mul[c] = mul[1] / mul[c]; /* normalise against green */ + } + if (tag == 2317) linear_table (len); + if (tag == 0x903) iso_speed = getreal(type); + //if (tag == 6020) iso_speed = getint(type); + if (tag == 64013) wbi = fgetc(ifp); + if ((unsigned) wbi < 7 && tag == wbtag[wbi]) + FORC3 cam_mul[c] = get4(); + if (tag == 64019) width = getint(type); + if (tag == 64020) height = (getint(type)+1) & -2; + fseek (ifp, save, SEEK_SET); + } +} +#else void CLASS parse_kodak_ifd (int base) { unsigned entries, tag, type, len, save; @@ -6509,6 +10011,8 @@ wbi = -2; } if (tag == 2118) wbtemp = getint(type); + if (tag == 2120 + wbi && wbi >= 0) + FORC3 cam_mul[c] = 2048.0 / getreal(type); if (tag == 2130 + wbi) FORC3 mul[c] = getreal(type); if (tag == 2140 + wbi && wbi >= 0) @@ -6527,6 +10031,7 @@ fseek (ifp, save, SEEK_SET); } } +#endif //@end COMMON void CLASS parse_minolta (int base); @@ -6537,14 +10042,14 @@ { unsigned entries, tag, type, len, plen=16, save; int ifd, use_cm=0, cfa, i, j, c, ima_len=0; - int blrr=1, blrc=1, dblack[] = { 0,0,0,0 }; - char software[64], *cbuf, *cp; + char *cbuf, *cp; uchar cfa_pat[16], cfa_pc[] = { 0,1,2,3 }, tab[256]; double cc[4][4], cm[4][3], cam_xyz[4][3], num; double ab[]={ 1,1,1,1 }, asn[] = { 0,0,0,0 }, xyz[] = { 1,1,1 }; unsigned sony_curve[] = { 0,0,0,0,0,4095 }; unsigned *buf, sony_offset=0, sony_length=0, sony_key=0; struct jhead jh; + int pana_raw = 0; #ifndef LIBRAW_LIBRARY_BUILD FILE *sfp; #endif @@ -6559,11 +10064,33 @@ if (entries > 512) return 1; while (entries--) { tiff_get (base, &tag, &type, &len, &save); + +#ifdef LIBRAW_LIBRARY_BUILD + if(callbacks.exif_cb) + { + int savepos = ftell(ifp); + callbacks.exif_cb(callbacks.exifparser_data,tag|(pana_raw?0x30000:0),type,len,order,ifp); + fseek(ifp,savepos,SEEK_SET); + } +#endif switch (tag) { + case 1: if(len==4) pana_raw = get4(); break; case 5: width = get2(); break; case 6: height = get2(); break; case 7: width += get2(); break; - case 9: if ((i = get2())) filters = i; break; + case 9: if ((i = get2())) filters = i; +#ifdef LIBRAW_LIBRARY_BUILD + if(pana_raw && len == 1 && type ==3) + pana_black[3]+=i; +#endif + break; + case 8: + case 10: +#ifdef LIBRAW_LIBRARY_BUILD + if(pana_raw && len == 1 && type ==3) + pana_black[3]+=get2(); +#endif + break; case 17: case 18: if (type == 3 && len == 1) cam_mul[(tag-17)*2] = get2() / 256.0; @@ -6571,8 +10098,21 @@ case 23: if (type == 3) iso_speed = get2(); break; + case 28: case 29: case 30: +#ifdef LIBRAW_LIBRARY_BUILD + if(pana_raw && len == 1 && type ==3) + { + pana_black[tag-28] = get2(); + } + else +#endif + { + cblack[tag-28] = get2(); + cblack[3] = cblack[1]; + } + break; case 36: case 37: case 38: - cam_mul[tag-0x24] = get2(); + cam_mul[tag-36] = get2(); break; case 39: if (len < 50 || cam_mul[0]) break; @@ -6585,6 +10125,7 @@ thumb_length = len; break; case 61440: /* Fuji HS10 table */ + fseek (ifp, get4()+base, SEEK_SET); parse_tiff_ifd (base); break; case 2: case 256: case 61441: /* ImageWidth */ @@ -6637,6 +10178,10 @@ tiff_ifd[ifd].samples = jh.clrs; if (!(jh.sraw || (jh.clrs & 1))) tiff_ifd[ifd].t_width *= jh.clrs; + if ((tiff_ifd[ifd].t_width > 4*tiff_ifd[ifd].t_height) & ~jh.clrs) { + tiff_ifd[ifd].t_width /= 2; + tiff_ifd[ifd].t_height *= 2; + } i = order; parse_tiff (tiff_ifd[ifd].offset + 12); order = i; @@ -6663,7 +10208,6 @@ !strncmp(software,"dcraw",5) || !strncmp(software,"UFRaw",5) || !strncmp(software,"Bibble",6) || - !strncmp(software,"Nikon Scan",10) || !strcmp (software,"Digital Photo Professional")) is_raw = 0; break; @@ -6681,6 +10225,8 @@ break; case 324: /* TileOffsets */ tiff_ifd[ifd].offset = len > 1 ? ftell(ifp) : get4(); + if (len == 1) + tiff_ifd[ifd].t_tile_width = tiff_ifd[ifd].t_tile_length = 0; if (len == 4) { load_raw = &CLASS sinar_4shot_load_raw; is_raw = 5; @@ -6692,6 +10238,14 @@ data_offset = get4()+base; ifd++; break; } +#ifdef LIBRAW_LIBRARY_BUILD + if (!strncmp(make,"Hasselblad",10) && libraw_internal_data.unpacker_data.hasselblad_parser_flag) { + fseek (ifp, ftell(ifp)+4, SEEK_SET); + fseek (ifp, get4()+base, SEEK_SET); + parse_tiff_ifd (base); + break; + } +#endif if(len > 1000) len=1000; /* 1000 SubIFDs is enough */ while (len--) { i = ftell(ifp); @@ -6704,6 +10258,16 @@ strcpy (make, "Sarnoff"); maximum = 0xfff; break; +#ifdef LIBRAW_LIBRARY_BUILD + case 700: + if((type == 1 || type == 2 || type == 6 || type == 7) && len > 1 && len < 5100000) + { + xmpdata = (char*)malloc(xmplen = len+1); + fread(xmpdata,len,1,ifp); + xmpdata[len]=0; + } + break; +#endif case 28688: FORC4 sony_curve[c+1] = get2() >> 2 & 0xfff; for (i=0; i < 5; i++) @@ -6732,8 +10296,8 @@ if (verbose) fprintf (stderr, _(" Sony matrix:\n%f %f %f\n%f %f %f\n%f %f %f\n"), cmatrix[0][0], cmatrix[0][1], cmatrix[0][2], cmatrix[1][0], cmatrix[1][1], cmatrix[1][2], cmatrix[2][0], cmatrix[2][1], cmatrix[2][2]); #endif break; - case 29456: // Sony black level, Sony_SR2SubIFD_0x7310, needs to be divided by 4 - FORC4 cblack[c ^ c >> 1] = get2()/4; + case 29456: // Sony black level, Sony_SR2SubIFD_0x7310, no more needs to be divided by 4 + FORC4 cblack[c ^ c >> 1] = get2(); i = cblack[3]; FORC3 if(i>cblack[c]) i = cblack[c]; FORC4 cblack[c]-=i; @@ -6745,9 +10309,23 @@ case 33405: /* Model2 */ fgets (model2, 64, ifp); break; + case 33421: /* CFARepeatPatternDim */ + if (get2() == 6 && get2() == 6) + filters = 9; + break; case 33422: /* CFAPattern */ + if (filters == 9) { + FORC(36) ((char *)xtrans)[c] = fgetc(ifp) & 3; + break; + } case 64777: /* Kodak P-series */ - if(len > 0) + if(len == 36) + { + filters = 9; + colors = 3; + FORC(36) xtrans[0][c] = fgetc(ifp) & 3; + } + else if(len > 0) { if ((plen=len) > 16) plen = 16; fread (cfa_pat, 1, plen, ifp); @@ -6759,8 +10337,7 @@ if (cfa == 072) memcpy (cfa_pc,"\005\003\004\001",4); /* GMCY */ goto guess_cfa_pc; } - else - break; + break; case 33424: case 65024: fseek (ifp, get4()+base, SEEK_SET); @@ -6772,6 +10349,36 @@ case 33437: /* FNumber */ aperture = getreal(type); break; +#ifdef LIBRAW_LIBRARY_BUILD +// IB start + case 0xa405: // FocalLengthIn35mmFormat + imgdata.lens.FocalLengthIn35mmFormat = get2(); + break; + case 0xa432: // LensInfo, 42034dec, Lens Specification per EXIF standard + imgdata.lens.MinFocal = getreal(type); + imgdata.lens.MaxFocal = getreal(type); + imgdata.lens.MaxAp4MinFocal = getreal(type); + imgdata.lens.MaxAp4MaxFocal = getreal(type); + break; + case 0xc630: // DNG LensInfo, Lens Specification per EXIF standard + imgdata.lens.MinFocal = getreal(type); + imgdata.lens.MaxFocal = getreal(type); + imgdata.lens.MaxAp4MinFocal = getreal(type); + imgdata.lens.MaxAp4MaxFocal = getreal(type); + break; + case 0xa433: // LensMake + fread(imgdata.lens.LensMake, MIN(len, sizeof(imgdata.lens.LensMake)), 1, ifp); + break; + case 0xa434: // LensModel + fread(imgdata.lens.Lens, MIN(len, sizeof(imgdata.lens.Lens)), 1, ifp); + if (!strncmp(imgdata.lens.Lens, "----", 4)) + imgdata.lens.Lens[0] = 0; + break; + case 0x9205: + imgdata.lens.EXIF_MaxAp = powf64(2.0f, (getreal(type) / 2.0f)); + break; +// IB end +#endif case 34306: /* Leaf white balance */ FORC4 cam_mul[c ^ 1] = 4096.0 / get2(); break; @@ -6797,8 +10404,15 @@ parse_exif (base); break; case 34853: /* GPSInfo tag */ - fseek (ifp, get4()+base, SEEK_SET); - parse_gps (base); + { + unsigned pos; + fseek(ifp, pos = (get4() + base), SEEK_SET); + parse_gps(base); +#ifdef LIBRAW_LIBRARY_BUILD + fseek(ifp, pos, SEEK_SET); + parse_gps_libraw(base); +#endif + } break; case 34675: /* InterColorProfile */ case 50831: /* AsShotICCProfile */ @@ -6822,7 +10436,11 @@ break; case 40976: strip_offset = get4(); - load_raw = &CLASS samsung_load_raw; + switch (tiff_ifd[ifd].comp) { + case 32770: load_raw = &CLASS samsung_load_raw; break; + case 32772: load_raw = &CLASS samsung2_load_raw; break; + case 32773: load_raw = &CLASS samsung3_load_raw; break; + } break; case 46275: /* Imacon tags */ strcpy (make, "Imacon"); @@ -6871,7 +10489,12 @@ case 50454: /* Sinar tag */ case 50455: if (!(cbuf = (char *) malloc(len))) break; +#ifndef LIBRAW_LIBRARY_BUILD fread (cbuf, 1, len, ifp); +#else + if(fread (cbuf, 1, len, ifp) != len) + throw LIBRAW_EXCEPTION_IO_CORRUPT; // cbuf to be free'ed in recycle +#endif for (cp = cbuf-1; cp && cp < cbuf+len; cp = strchr(cp,'\n')) if (!strncmp (++cp,"Neutral ",8)) sscanf (cp+8, "%f %f %f", cam_mul, cam_mul+1, cam_mul+2); @@ -6881,6 +10504,9 @@ if (!make[0]) strcpy (make, "Hasselblad"); break; case 50459: /* Hasselblad tag */ +#ifdef LIBRAW_LIBRARY_BUILD + libraw_internal_data.unpacker_data.hasselblad_parser_flag=1; +#endif i = order; j = ftell(ifp); c = tiff_nifds; @@ -6896,45 +10522,52 @@ if (!make[0]) strcpy (make, "DNG"); is_raw = 1; break; + case 50708: /* UniqueCameraModel */ + if (model[0]) break; + fgets (make, 64, ifp); + if ((cp = strchr(make,' '))) { + strcpy(model,cp+1); + *cp = 0; + } + break; case 50710: /* CFAPlaneColor */ + if (filters == 9) break; if (len > 4) len = 4; colors = len; fread (cfa_pc, 1, colors, ifp); guess_cfa_pc: - FORCC tab[cfa_pc[c]] = c; - cdesc[c] = 0; - for (i=16; i--; ) - filters = filters << 2 | tab[cfa_pat[i % plen]]; - filters -= !filters; + FORCC tab[cfa_pc[c]] = c; + cdesc[c] = 0; + for (i=16; i--; ) + filters = filters << 2 | tab[cfa_pat[i % plen]]; + filters -= !filters; break; case 50711: /* CFALayout */ - if (get2() == 2) { - fuji_width = 1; - filters = 0x49494949; - } + if (get2() == 2) fuji_width = 1; break; case 291: case 50712: /* LinearizationTable */ linear_table (len); break; case 50713: /* BlackLevelRepeatDim */ - blrr = get2(); - blrc = get2(); + cblack[4] = get2(); + cblack[5] = get2(); + if (cblack[4] * cblack[5] > (sizeof(cblack) / sizeof (cblack[0]) - 6)) + cblack[4] = cblack[5] = 1; break; case 61450: - blrr = blrc = 2; + cblack[4] = cblack[5] = MIN(sqrt((double)len),64); case 50714: /* BlackLevel */ - black = getreal(type); - if ((unsigned)(filters+1) < 1000) break; - dblack[0] = black; - dblack[1] = (blrc == 2) ? getreal(type):dblack[0]; - dblack[2] = (blrr == 2) ? getreal(type):dblack[0]; - dblack[3] = (blrc == 2 && blrr == 2) ? getreal(type):dblack[1]; - if (colors == 3) - filters |= ((filters >> 2 & 0x22222222) | - (filters << 2 & 0x88888888)) & filters << 1; - FORC4 cblack[filters >> (c << 1) & 3] = dblack[c]; - black = 0; + if((cblack[4] * cblack[5] < 2) && len == 1) + { + black = getreal(type); + } + else if(cblack[4] * cblack[5] <= len) + { + FORC (cblack[4] * cblack[5]) + cblack[6+c] = getreal(type); + black = 0; + } break; case 50715: /* BlackLevelDeltaH */ case 50716: /* BlackLevelDeltaV */ @@ -6948,17 +10581,44 @@ case 50718: /* DefaultScale */ pixel_aspect = getreal(type); pixel_aspect /= getreal(type); + if(pixel_aspect > 0.995 && pixel_aspect < 1.005) + pixel_aspect = 1.0; break; +#ifdef LIBRAW_LIBRARY_BUILD + case 50778: + imgdata.color.dng_color[0].illuminant = get2(); + break; + case 50779: + imgdata.color.dng_color[1].illuminant = get2(); + break; +#endif case 50721: /* ColorMatrix1 */ case 50722: /* ColorMatrix2 */ +#ifdef LIBRAW_LIBRARY_BUILD + i = tag == 50721?0:1; +#endif FORCC for (j=0; j < 3; j++) + { +#ifdef LIBRAW_LIBRARY_BUILD + imgdata.color.dng_color[i].colormatrix[c][j]= +#endif cm[c][j] = getreal(type); + } use_cm = 1; break; case 50723: /* CameraCalibration1 */ case 50724: /* CameraCalibration2 */ +#ifdef LIBRAW_LIBRARY_BUILD + j = tag == 50723?0:1; +#endif for (i=0; i < colors; i++) - FORCC cc[i][c] = getreal(type); + FORCC + { +#ifdef LIBRAW_LIBRARY_BUILD + imgdata.color.dng_color[j].calibration[i][c]= +#endif + cc[i][c] = getreal(type); + } break; case 50727: /* AnalogBalance */ FORCC ab[c] = getreal(type); @@ -6972,39 +10632,91 @@ xyz[2] = 1 - xyz[0] - xyz[1]; FORC3 xyz[c] /= d65_white[c]; break; - case 50740: /* DNGPrivateData */ - if (dng_version) break; - parse_minolta (j = get4()+base); - fseek (ifp, j, SEEK_SET); - parse_tiff_ifd (base); - break; - case 50752: - read_shorts (cr2_slice, 3); - break; - case 50829: /* ActiveArea */ - top_margin = getint(type); - left_margin = getint(type); - height = getint(type) - top_margin; - width = getint(type) - left_margin; - break; - case 50830: /* MaskedAreas */ - for (i=0; i < len && i < 32; i++) - mask[0][i] = getint(type); - black = 0; - break; - case 51009: /* OpcodeList2 */ - meta_offset = ftell(ifp); - break; - case 64772: /* Kodak P-series */ - if (len < 13) break; - fseek (ifp, 16, SEEK_CUR); - data_offset = get4(); - fseek (ifp, 28, SEEK_CUR); - data_offset += get4(); - load_raw = &CLASS packed_load_raw; - break; - case 65026: - if (type == 2) fgets (model2, 64, ifp); +#ifdef LIBRAW_LIBRARY_BUILD + case 50730: /* DNG: Baseline Exposure */ + baseline_exposure = getreal(type); + break; +#endif + // IB start + case 50740: /* tag 0xc634 : DNG Adobe, DNG Pentax, Sony SR2, DNG Private */ +#ifdef LIBRAW_LIBRARY_BUILD + { + char mbuf[64]; + unsigned short makernote_found = 0; + INT64 curr_pos, start_pos = ftell(ifp); + unsigned MakN_order, m_sorder = order; + unsigned MakN_length; + unsigned pos_in_original_raw; + fread(mbuf, 1, 6, ifp); + + if (!strcmp(mbuf, "Adobe")) + { + order = 0x4d4d; // Adobe header is always in "MM" / big endian + curr_pos = start_pos + 6; + while (curr_pos + 8 - start_pos <= len) + { + fread(mbuf, 1, 4, ifp); + curr_pos += 8; + if (!strncmp(mbuf, "MakN", 4)) { + makernote_found = 1; + MakN_length = get4(); + MakN_order = get2(); + pos_in_original_raw = get4(); + order = MakN_order; + parse_makernote_0xc634(curr_pos + 6 - pos_in_original_raw, 0, AdobeDNG); + break; + } + } + } + else + { + fread(mbuf + 6, 1, 2, ifp); + if (!strcmp(mbuf, "PENTAX ") || + !strcmp(mbuf, "SAMSUNG")) + { + makernote_found = 1; + fseek(ifp, start_pos, SEEK_SET); + parse_makernote_0xc634(base, 0, CameraDNG); + } + } + + fseek(ifp, start_pos, SEEK_SET); + order = m_sorder; + } + // IB end +#endif + if (dng_version) break; + parse_minolta (j = get4()+base); + fseek (ifp, j, SEEK_SET); + parse_tiff_ifd (base); + break; + case 50752: + read_shorts (cr2_slice, 3); + break; + case 50829: /* ActiveArea */ + top_margin = getint(type); + left_margin = getint(type); + height = getint(type) - top_margin; + width = getint(type) - left_margin; + break; + case 50830: /* MaskedAreas */ + for (i=0; i < len && i < 32; i++) + ((int*)mask)[i] = getint(type); + black = 0; + break; + case 51009: /* OpcodeList2 */ + meta_offset = ftell(ifp); + break; + case 64772: /* Kodak P-series */ + if (len < 13) break; + fseek (ifp, 16, SEEK_CUR); + data_offset = get4(); + fseek (ifp, 28, SEEK_CUR); + data_offset += get4(); + load_raw = &CLASS packed_load_raw; + break; + case 65026: + if (type == 2) fgets (model2, 64, ifp); } fseek (ifp, save, SEEK_SET); } @@ -7036,7 +10748,7 @@ FORCC for (i=0; i < 3; i++) for (cam_xyz[c][i]=j=0; j < colors; j++) cam_xyz[c][i] += cc[c][j] * cm[j][i] * xyz[i]; - cam_xyz_coeff (cam_xyz); + cam_xyz_coeff (cmatrix, cam_xyz); } if (asn[0]) { cam_mul[3] = 0; @@ -7050,7 +10762,6 @@ int CLASS parse_tiff (int base) { int doff; - fseek (ifp, base, SEEK_SET); order = get2(); if (order != 0x4949 && order != 0x4d4d) return 0; @@ -7120,6 +10831,15 @@ case 32770: case 32773: goto slr; case 0: case 1: +#ifdef LIBRAW_LIBRARY_BUILD + if(!strncasecmp(make,"Nikon",5) && !strncmp(software,"Nikon Scan",10)) + { + load_raw = &CLASS nikon_coolscan_load_raw; + raw_color = 1; + filters = 0; + break; + } +#endif if (!strncmp(make,"OLYMPUS",7) && tiff_ifd[raw].bytes*2 == raw_width*raw_height*3) load_flags = 24; @@ -7147,12 +10867,28 @@ if ((raw_width+9)/10*16*raw_height == tiff_ifd[raw].bytes) { load_raw = &CLASS packed_load_raw; load_flags = 1; + } else if (raw_width*raw_height*3 == tiff_ifd[raw].bytes*2) { + load_raw = &CLASS packed_load_raw; + if (model[0] == 'N') load_flags = 80; + } else if (raw_width*raw_height*3 == tiff_ifd[raw].bytes) { + load_raw = &CLASS nikon_yuv_load_raw; + gamma_curve (1/2.4, 12.92, 1, 4095); + memset (cblack, 0, sizeof cblack); + filters = 0; } else if (raw_width*raw_height*2 == tiff_ifd[raw].bytes) { load_raw = &CLASS unpacked_load_raw; load_flags = 4; order = 0x4d4d; } else - load_raw = &CLASS nikon_load_raw; break; +#ifdef LIBRAW_LIBRARY_BUILD + if(raw_width*raw_height*3 == tiff_ifd[raw].bytes*2) + { + load_raw = &CLASS packed_load_raw; + load_flags=80; + } + else +#endif + load_raw = &CLASS nikon_load_raw; break; case 65535: load_raw = &CLASS pentax_load_raw; break; case 65000: @@ -7165,10 +10901,11 @@ default: is_raw = 0; } if (!dng_version) - if ( (tiff_samples == 3 && tiff_ifd[raw].bytes && tiff_bps != 14 && - tiff_compress != 32769 && tiff_compress != 32770) - || (tiff_bps == 8 && !strcasestr(make,"Kodak") && + if ( ((tiff_samples == 3 && tiff_ifd[raw].bytes && tiff_bps != 14 && + (tiff_compress & -16) != 32768) + || (tiff_bps == 8 && !strcasestr(make,"Kodak") && !strstr(model2,"DEBUG RAW"))) + && strncmp(software,"Nikon Scan",10)) is_raw = 0; for (i=0; i < tiff_nifds; i++) if (i != raw && tiff_ifd[i].samples == max_samp && @@ -7193,7 +10930,7 @@ case 1: if (tiff_ifd[thm].bps <= 8) write_thumb = &CLASS ppm_thumb; - else if (!strcmp(make,"Imacon")) + else if (!strncmp(make,"Imacon",6)) write_thumb = &CLASS ppm16_thumb; else thumb_load_raw = &CLASS kodak_thumb_load_raw; @@ -7319,7 +11056,7 @@ } } #else - if (strcmp (jname, ifname)) + if (strcmp (jname, ifname)) { if(!ifp->subfile_open(jname)) { @@ -7366,15 +11103,14 @@ bitbuf = bitbuf << 16 | (get2() ^ key[i++ & 1]); vbits += 16; } - white[row][col] = - bitbuf << (LONG_BIT - vbits) >> (LONG_BIT - bpp); - vbits -= bpp; + white[row][col] = bitbuf >> (vbits -= bpp) & ~(-1 << bpp); } } /* Parse a CIFF file, better known as Canon CRW format. */ + void CLASS parse_ciff (int offset, int length, int depth) { int tboff, nrecs, c, type, len, save, wbi=-1; @@ -7390,8 +11126,9 @@ len = get4(); save = ftell(ifp) + 4; fseek (ifp, offset+get4(), SEEK_SET); - if ((((type >> 8) + 8) | 8) == 0x38) + if ((((type >> 8) + 8) | 8) == 0x38) { parse_ciff (ftell(ifp), len, depth+1); /* Parse a sub-table */ + } if (type == 0x0810) fread (artist, 64, 1, ifp); if (type == 0x080a) { @@ -7412,13 +11149,22 @@ thumb_length = len; } if (type == 0x1818) { - shutter = pow (2.0f, -int_to_float((get4(),get4()))); - aperture = pow (2.0f, int_to_float(get4())/2); + shutter = powf64(2.0f, -int_to_float((get4(),get4()))); + aperture = powf64(2.0f, int_to_float(get4())/2); +#ifdef LIBRAW_LIBRARY_BUILD + imgdata.lens.makernotes.CurAp = aperture; +#endif } if (type == 0x102a) { - iso_speed = pow (2.0, (get4(),get2())/32.0 - 4) * 50; - aperture = pow (2.0, (get2(),(short)get2())/64.0); - shutter = pow (2.0,-((short)get2())/32.0); + // iso_speed = pow (2.0, (get4(),get2())/32.0 - 4) * 50; + iso_speed = powf64(2.0f, ((get2(),get2()) + get2())/32.0f - 5.0f) * 100.0f; +#ifdef LIBRAW_LIBRARY_BUILD + aperture = _CanonConvertAperture((get2(),get2())); + imgdata.lens.makernotes.CurAp = aperture; +#else + aperture = powf64(2.0, (get2(),(short)get2())/64.0); +#endif + shutter = powf64(2.0,-((short)get2())/32.0); wbi = (get2(),get2()); if (wbi > 17) wbi = 0; fseek (ifp, 32, SEEK_CUR); @@ -7433,6 +11179,22 @@ FORC4 cam_mul[c ^ (c >> 1) ^ 1] = get2(); } } +#ifdef LIBRAW_LIBRARY_BUILD + if (type == 0x102d) { + fseek(ifp, 44, SEEK_CUR); + imgdata.lens.makernotes.LensID = get2(); + imgdata.lens.makernotes.MaxFocal = get2(); + imgdata.lens.makernotes.MinFocal = get2(); + imgdata.lens.makernotes.CanonFocalUnits = get2(); + if (imgdata.lens.makernotes.CanonFocalUnits != 1) + { + imgdata.lens.makernotes.MaxFocal /= (float)imgdata.lens.makernotes.CanonFocalUnits; + imgdata.lens.makernotes.MinFocal /= (float)imgdata.lens.makernotes.CanonFocalUnits; + } + imgdata.lens.makernotes.MaxAp = _CanonConvertAperture(get2()); + imgdata.lens.makernotes.MinAp = _CanonConvertAperture(get2()); + } +#endif if (type == 0x0032) { if (len == 768) { /* EOS D30 */ fseek (ifp, 72, SEEK_CUR); @@ -7462,14 +11224,33 @@ raw_width = (get2(),get2()); raw_height = get2(); } + if (type == 0x501c) { + iso_speed = len & 0xffff; + } if (type == 0x5029) { +#ifdef LIBRAW_LIBRARY_BUILD + imgdata.lens.makernotes.CurFocal = len >> 16; + imgdata.lens.makernotes.FocalType = len & 0xffff; + if (imgdata.lens.makernotes.FocalType == 2) { + imgdata.lens.makernotes.CanonFocalUnits = 32; + imgdata.lens.makernotes.CurFocal /= (float)imgdata.lens.makernotes.CanonFocalUnits; + } + focal_len = imgdata.lens.makernotes.CurFocal; +#else focal_len = len >> 16; if ((len & 0xffff) == 2) focal_len /= 32; +#endif } if (type == 0x5813) flash_used = int_to_float(len); if (type == 0x5814) canon_ev = int_to_float(len); if (type == 0x5817) shot_order = len; - if (type == 0x5834) unique_id = len; + if (type == 0x5834) + { + unique_id = len; +#ifdef LIBRAW_LIBRARY_BUILD + setCanonBodyFeatures(unique_id); +#endif + } if (type == 0x580e) timestamp = len; if (type == 0x180e) timestamp = get4(); #ifdef LOCALTIME @@ -7556,6 +11337,11 @@ float romm_cam[3][3]; char *cp; +#ifdef LIBRAW_LIBRARY_BUILD + char body_id[3]; + body_id[0] = 0; +#endif + memset (&ph1, 0, sizeof ph1); fseek (ifp, base, SEEK_SET); order = get4() & 0xffff; @@ -7571,10 +11357,68 @@ save = ftell(ifp); fseek (ifp, base+data, SEEK_SET); switch (tag) { + +#ifdef LIBRAW_LIBRARY_BUILD + case 0x0102: + fread(body_id, 1, 3, ifp); + if ((body_id[0] == 0x4c) && (body_id[1] == 0x49)) { + body_id[1] = body_id[2]; + } + unique_id = (((body_id[0] & 0x3f) << 5) | (body_id[1] & 0x3f)) - 0x41; + setPhaseOneFeatures(unique_id); + break; + case 0x0401: + if (type == 4) imgdata.lens.makernotes.CurAp = powf64(2.0f, (int_to_float(data)/2.0f)); + else imgdata.lens.makernotes.CurAp = powf64(2.0f, (getreal(type)/2.0f)); + break; + case 0x0403: + if (type == 4) imgdata.lens.makernotes.CurFocal = int_to_float(data); + else imgdata.lens.makernotes.CurFocal = getreal(type); + break; + case 0x0410: + fread(imgdata.lens.makernotes.body, 1, len, ifp); + break; + case 0x0412: + fread(imgdata.lens.makernotes.Lens, 1, len, ifp); + break; + case 0x0414: + if (type == 4) { + imgdata.lens.makernotes.MaxAp4CurFocal = powf64(2.0f, (int_to_float(data)/2.0f)); + } else { + imgdata.lens.makernotes.MaxAp4CurFocal = powf64(2.0f, (getreal(type) / 2.0f)); + } + break; + case 0x0415: + if (type == 4) { + imgdata.lens.makernotes.MinAp4CurFocal = powf64(2.0f, (int_to_float(data)/2.0f)); + } else { + imgdata.lens.makernotes.MinAp4CurFocal = powf64(2.0f, (getreal(type) / 2.0f)); + } + break; + case 0x0416: + if (type == 4) { + imgdata.lens.makernotes.MinFocal = int_to_float(data); + } else { + imgdata.lens.makernotes.MinFocal = getreal(type); + } + if (imgdata.lens.makernotes.MinFocal > 1000.0f) + { + imgdata.lens.makernotes.MinFocal = 0.0f; + } + break; + case 0x0417: + if (type == 4) { + imgdata.lens.makernotes.MaxFocal = int_to_float(data); + } else { + imgdata.lens.makernotes.MaxFocal = getreal(type); + } + break; +#endif + case 0x100: flip = "0653"[data & 3]-'0'; break; case 0x106: for (i=0; i < 9; i++) - romm_cam[0][i] = getreal(11); + ((float *)romm_cam)[i] = getreal(11); romm_coeff (romm_cam); break; case 0x107: @@ -7596,7 +11440,9 @@ case 0x21c: strip_offset = data+base; break; case 0x21d: ph1.t_black = data; break; case 0x222: ph1.split_col = data; break; - case 0x223: ph1.black_off = data+base; break; + case 0x223: ph1.black_col = data+base; break; + case 0x224: ph1.split_row = data; break; + case 0x225: ph1.black_row = data+base; break; case 0x301: model[63] = 0; fread (model, 1, 63, ifp); @@ -7604,6 +11450,33 @@ } fseek (ifp, save, SEEK_SET); } + +#ifdef LIBRAW_LIBRARY_BUILD + if (!imgdata.lens.makernotes.body[0] && !body_id[0]) { + fseek (ifp, meta_offset, SEEK_SET); + order = get2(); + fseek (ifp, 6, SEEK_CUR); + fseek (ifp, meta_offset+get4(), SEEK_SET); + entries = get4(); get4(); + while (entries--) { + tag = get4(); + len = get4(); + data = get4(); + save = ftell(ifp); + fseek (ifp, meta_offset+data, SEEK_SET); + if (tag == 0x0407) { + fread(body_id, 1, 3, ifp); + if ((body_id[0] == 0x4c) && (body_id[1] == 0x49)) { + body_id[1] = body_id[2]; + } + unique_id = (((body_id[0] & 0x3f) << 5) | (body_id[1] & 0x3f)) - 0x41; + setPhaseOneFeatures(unique_id); + } + fseek (ifp, save, SEEK_SET); + } + } +#endif + load_raw = ph1.format < 3 ? &CLASS phase_one_load_raw : &CLASS phase_one_load_raw_c; maximum = 0xffff; @@ -7628,6 +11501,7 @@ tag = get2(); len = get2(); save = ftell(ifp); + if (tag == 0x100) { raw_height = get2(); raw_width = get2(); @@ -7639,9 +11513,17 @@ fuji_width = !(fgetc(ifp) & 8); } else if (tag == 0x131) { filters = 9; - FORC(36) xtrans[0][35-c] = fgetc(ifp) & 3; + FORC(36) xtrans_abs[0][35-c] = fgetc(ifp) & 3; } else if (tag == 0x2ff0) { FORC4 cam_mul[c ^ 1] = get2(); + +// IB start +#ifdef LIBRAW_LIBRARY_BUILD + } else if (tag == 0x9650) { + imgdata.color.FujiExpoMidPointShift = ((short)get2()) / ((float)get2()); +#endif +// IB end + } else if (tag == 0xc000) { c = order; order = 0x4949; @@ -7659,7 +11541,6 @@ int CLASS parse_jpeg (int offset) { int len, save, hlen, mark; - fseek (ifp, offset, SEEK_SET); if (fgetc(ifp) != 0xff || fgetc(ifp) != 0xd8) return 0; @@ -7675,7 +11556,13 @@ order = get2(); hlen = get4(); if (get4() == 0x48454150) /* "HEAP" */ + { +#ifdef LIBRAW_LIBRARY_BUILD + imgdata.lens.makernotes.CameraMount = LIBRAW_MOUNT_FixedLens; + imgdata.lens.makernotes.LensMount = LIBRAW_MOUNT_FixedLens; +#endif parse_ciff (save+hlen, len-hlen, 0); + } if (parse_tiff (save+6)) apply_tiff(); fseek (ifp, save+len, SEEK_SET); } @@ -7693,14 +11580,11 @@ order = 0x4949; fread (tag, 4, 1, ifp); size = get4(); -#ifdef LIBRAW_LIBRARY_BUILD - if((int)size<0) - throw LIBRAW_EXCEPTION_IO_EOF; -#endif end = ftell(ifp) + size; if (!memcmp(tag,"RIFF",4) || !memcmp(tag,"LIST",4)) { + int maxloop = 1000; get4(); - while (ftell(ifp)+7 < end) + while (ftell(ifp)+7 < end && !feof(ifp) && maxloop--) parse_riff(); } else if (!memcmp(tag,"nctg",4)) { while (ftell(ifp)+7 < end) { @@ -7726,6 +11610,26 @@ fseek (ifp, size, SEEK_CUR); } +void CLASS parse_qt (int end) +{ + unsigned save, size; + char tag[4]; + + order = 0x4d4d; + while (ftell(ifp)+7 < end) { + save = ftell(ifp); + if ((size = get4()) < 8) return; + fread (tag, 4, 1, ifp); + if (!memcmp(tag,"moov",4) || + !memcmp(tag,"udta",4) || + !memcmp(tag,"CNTH",4)) + parse_qt (save+size); + if (!memcmp(tag,"CNDA",4)) + parse_jpeg (ftell(ifp)); + fseek (ifp, save+size, SEEK_SET); + } +} + void CLASS parse_smal (int offset, int fsize) { int ver; @@ -7840,7 +11744,6 @@ { int entries, img=0, off, len, tag, save, i, wide, high, pent, poff[256][2]; char name[64], value[64]; - order = 0x4949; /* Little-endian */ fseek (ifp, 36, SEEK_SET); flip = get4(); @@ -7898,7 +11801,7 @@ off += pent*8 + 24; if ((unsigned) pent > 256) pent=256; for (i=0; i < pent*2; i++) - poff[0][i] = off + get4()*2; + ((int *)poff)[i] = off + get4()*2; for (i=0; i < pent; i++) { foveon_gets (poff[i][0], name, 64); foveon_gets (poff[i][1], value, 64); @@ -7918,7 +11821,42 @@ aperture = atof(value); if (!strcmp (name, "FLENGTH")) focal_len = atof(value); - } +#ifdef LIBRAW_LIBRARY_BUILD + if (!strcmp (name, "FLEQ35MM")) + imgdata.lens.makernotes.FocalLengthIn35mmFormat = atof(value); + if (!strcmp (name, "LENSARANGE")) + { + char *sp; + imgdata.lens.makernotes.MaxAp4CurFocal = imgdata.lens.makernotes.MinAp4CurFocal = atof(value); + sp = strrchr (value, ' '); + if (sp) + { + imgdata.lens.makernotes.MinAp4CurFocal = atof(sp); + if (imgdata.lens.makernotes.MaxAp4CurFocal > imgdata.lens.makernotes.MinAp4CurFocal) + my_swap (float, imgdata.lens.makernotes.MaxAp4CurFocal, imgdata.lens.makernotes.MinAp4CurFocal); + } + } + if (!strcmp (name, "LENSFRANGE")) + { + char *sp; + imgdata.lens.makernotes.MinFocal = imgdata.lens.makernotes.MaxFocal = atof(value); + sp = strrchr (value, ' '); + if (sp) + { + imgdata.lens.makernotes.MaxFocal = atof(sp); + if ((imgdata.lens.makernotes.MaxFocal + 0.17f) < imgdata.lens.makernotes.MinFocal) + my_swap (float, imgdata.lens.makernotes.MaxFocal, imgdata.lens.makernotes.MinFocal); + } + } + if (!strcmp (name, "LENSMODEL")) + { + imgdata.lens.makernotes.LensID = atoi(value); + if (imgdata.lens.makernotes.LensID) + imgdata.lens.makernotes.LensMount = Sigma_X3F; + } + } +#endif + } #ifdef LOCALTIME timestamp = mktime (gmtime (×tamp)); #endif @@ -7932,896 +11870,1109 @@ /* All matrices are from Adobe DNG Converter unless otherwise noted. */ -void CLASS adobe_coeff (const char *t_make, const char *t_model) +void CLASS adobe_coeff (const char *t_make, const char *t_model +#ifdef LIBRAW_LIBRARY_BUILD + ,int internal_only +#endif +) { static const struct { const char *prefix; - short t_black, t_maximum, trans[12]; + int t_black, t_maximum, trans[12]; } table[] = { { "AgfaPhoto DC-833m", 0, 0, /* DJC */ - { 11438,-3762,-1115,-2409,9914,2497,-1227,2295,5300 } }, + { 11438,-3762,-1115,-2409,9914,2497,-1227,2295,5300 } }, { "Apple QuickTake", 0, 0, /* DJC */ - { 21392,-5653,-3353,2406,8010,-415,7166,1427,2078 } }, + { 21392,-5653,-3353,2406,8010,-415,7166,1427,2078 } }, { "Canon EOS D2000", 0, 0, - { 24542,-10860,-3401,-1490,11370,-297,2858,-605,3225 } }, + { 24542,-10860,-3401,-1490,11370,-297,2858,-605,3225 } }, { "Canon EOS D6000", 0, 0, - { 20482,-7172,-3125,-1033,10410,-285,2542,226,3136 } }, + { 20482,-7172,-3125,-1033,10410,-285,2542,226,3136 } }, { "Canon EOS D30", 0, 0, - { 9805,-2689,-1312,-5803,13064,3068,-2438,3075,8775 } }, + { 9805,-2689,-1312,-5803,13064,3068,-2438,3075,8775 } }, { "Canon EOS D60", 0, 0xfa0, { 6188,-1341,-890,-7168,14489,2937,-2640,3228,8483 } }, + { "Canon EOS 5DS", 0, 0x3c96, + { 6250,-711,-808,-5153,12794,2636,-1249,2198,5610 } }, { "Canon EOS 5D Mark III", 0, 0x3c80, - { 6722,-635,-963,-4287,12460,2028,-908,2162,5668 } }, + { 6722,-635,-963,-4287,12460,2028,-908,2162,5668 } }, { "Canon EOS 5D Mark II", 0, 0x3cf0, - { 4716,603,-830,-7798,15474,2480,-1496,1937,6651 } }, + { 4716,603,-830,-7798,15474,2480,-1496,1937,6651 } }, { "Canon EOS 5D", 0, 0xe6c, - { 6347,-479,-972,-8297,15954,2480,-1968,2131,7649 } }, + { 6347,-479,-972,-8297,15954,2480,-1968,2131,7649 } }, { "Canon EOS 6D", 0, 0x3c82, - { 7034,-804,-1014,-4420,12564,2058,-851,1994,5758 } }, + { 8621,-2197,-787,-3150,11358,912,-1161,2400,4836 } }, + { "Canon EOS 7D Mark II", 0, 0x3510, + { 7268,-1082,-969,-4186,11839,2663,-825,2029,5839 } }, { "Canon EOS 7D", 0, 0x3510, - { 6844,-996,-856,-3876,11761,2396,-593,1772,6198 } }, + { 6844,-996,-856,-3876,11761,2396,-593,1772,6198 } }, { "Canon EOS 10D", 0, 0xfa0, - { 8197,-2000,-1118,-6714,14335,2592,-2536,3178,8266 } }, + { 8197,-2000,-1118,-6714,14335,2592,-2536,3178,8266 } }, { "Canon EOS 20Da", 0, 0, - { 14155,-5065,-1382,-6550,14633,2039,-1623,1824,6561 } }, + { 14155,-5065,-1382,-6550,14633,2039,-1623,1824,6561 } }, { "Canon EOS 20D", 0, 0xfff, - { 6599,-537,-891,-8071,15783,2424,-1983,2234,7462 } }, + { 6599,-537,-891,-8071,15783,2424,-1983,2234,7462 } }, { "Canon EOS 30D", 0, 0, - { 6257,-303,-1000,-7880,15621,2396,-1714,1904,7046 } }, + { 6257,-303,-1000,-7880,15621,2396,-1714,1904,7046 } }, { "Canon EOS 40D", 0, 0x3f60, - { 6071,-747,-856,-7653,15365,2441,-2025,2553,7315 } }, + { 6071,-747,-856,-7653,15365,2441,-2025,2553,7315 } }, { "Canon EOS 50D", 0, 0x3d93, - { 4920,616,-593,-6493,13964,2784,-1774,3178,7005 } }, + { 4920,616,-593,-6493,13964,2784,-1774,3178,7005 } }, { "Canon EOS 60D", 0, 0x2ff7, - { 6719,-994,-925,-4408,12426,2211,-887,2129,6051 } }, - { "Canon EOS 70D", 0, 0x3c80, - { 7034,-804,-1014,-4420,12564,2058,-851,1994,5758 } }, + { 6719,-994,-925,-4408,12426,2211,-887,2129,6051 } }, + { "Canon EOS 70D", 0, 0x3bc7, + { 7034,-804,-1014,-4420,12564,2058,-851,1994,5758 } }, { "Canon EOS 100D", 0, 0x350f, - { 6602,-841,-939,-4472,12458,2247,-975,2039,6148 } }, + { 6602,-841,-939,-4472,12458,2247,-975,2039,6148 } }, { "Canon EOS 300D", 0, 0xfa0, - { 8197,-2000,-1118,-6714,14335,2592,-2536,3178,8266 } }, + { 8197,-2000,-1118,-6714,14335,2592,-2536,3178,8266 } }, { "Canon EOS 350D", 0, 0xfff, - { 6018,-617,-965,-8645,15881,2975,-1530,1719,7642 } }, + { 6018,-617,-965,-8645,15881,2975,-1530,1719,7642 } }, { "Canon EOS 400D", 0, 0xe8e, - { 7054,-1501,-990,-8156,15544,2812,-1278,1414,7796 } }, + { 7054,-1501,-990,-8156,15544,2812,-1278,1414,7796 } }, { "Canon EOS 450D", 0, 0x390d, - { 5784,-262,-821,-7539,15064,2672,-1982,2681,7427 } }, + { 5784,-262,-821,-7539,15064,2672,-1982,2681,7427 } }, { "Canon EOS 500D", 0, 0x3479, - { 4763,712,-646,-6821,14399,2640,-1921,3276,6561 } }, + { 4763,712,-646,-6821,14399,2640,-1921,3276,6561 } }, { "Canon EOS 550D", 0, 0x3dd7, - { 6941,-1164,-857,-3825,11597,2534,-416,1540,6039 } }, + { 6941,-1164,-857,-3825,11597,2534,-416,1540,6039 } }, { "Canon EOS 600D", 0, 0x3510, - { 6461,-907,-882,-4300,12184,2378,-819,1944,5931 } }, + { 6461,-907,-882,-4300,12184,2378,-819,1944,5931 } }, { "Canon EOS 650D", 0, 0x354d, - { 6602,-841,-939,-4472,12458,2247,-975,2039,6148 } }, + { 6602,-841,-939,-4472,12458,2247,-975,2039,6148 } }, + { "Canon EOS 750D", 0, 0x3c00, + { 6362,-823,-847,-4426,12109,2616,-743,1857,5635 } }, + { "Canon EOS 760D", 0, 0x3c00, + { 6362,-823,-847,-4426,12109,2616,-743,1857,5635 } }, { "Canon EOS 700D", 0, 0x3c00, - { 6602,-841,-939,-4472,12458,2247,-975,2039,6148 } }, + { 6602,-841,-939,-4472,12458,2247,-975,2039,6148 } }, { "Canon EOS 1000D", 0, 0xe43, - { 6771,-1139,-977,-7818,15123,2928,-1244,1437,7533 } }, + { 6771,-1139,-977,-7818,15123,2928,-1244,1437,7533 } }, { "Canon EOS 1100D", 0, 0x3510, - { 6444,-904,-893,-4563,12308,2535,-903,2016,6728 } }, + { 6444,-904,-893,-4563,12308,2535,-903,2016,6728 } }, + { "Canon EOS 1200D", 0, 0x37c2, + { 6461,-907,-882,-4300,12184,2378,-819,1944,5931 } }, + { "Canon EOS M3", 0, 0, + { 6362,-823,-847,-4426,12109,2616,-743,1857,5635 } }, { "Canon EOS M", 0, 0, - { 6602,-841,-939,-4472,12458,2247,-975,2039,6148 } }, + { 6602,-841,-939,-4472,12458,2247,-975,2039,6148 } }, { "Canon EOS-1Ds Mark III", 0, 0x3bb0, - { 5859,-211,-930,-8255,16017,2353,-1732,1887,7448 } }, + { 5859,-211,-930,-8255,16017,2353,-1732,1887,7448 } }, { "Canon EOS-1Ds Mark II", 0, 0xe80, - { 6517,-602,-867,-8180,15926,2378,-1618,1771,7633 } }, + { 6517,-602,-867,-8180,15926,2378,-1618,1771,7633 } }, { "Canon EOS-1D Mark IV", 0, 0x3bb0, - { 6014,-220,-795,-4109,12014,2361,-561,1824,5787 } }, + { 6014,-220,-795,-4109,12014,2361,-561,1824,5787 } }, { "Canon EOS-1D Mark III", 0, 0x3bb0, - { 6291,-540,-976,-8350,16145,2311,-1714,1858,7326 } }, + { 6291,-540,-976,-8350,16145,2311,-1714,1858,7326 } }, { "Canon EOS-1D Mark II N", 0, 0xe80, - { 6240,-466,-822,-8180,15825,2500,-1801,1938,8042 } }, + { 6240,-466,-822,-8180,15825,2500,-1801,1938,8042 } }, { "Canon EOS-1D Mark II", 0, 0xe80, - { 6264,-582,-724,-8312,15948,2504,-1744,1919,8664 } }, + { 6264,-582,-724,-8312,15948,2504,-1744,1919,8664 } }, { "Canon EOS-1DS", 0, 0xe20, - { 4374,3631,-1743,-7520,15212,2472,-2892,3632,8161 } }, + { 4374,3631,-1743,-7520,15212,2472,-2892,3632,8161 } }, { "Canon EOS-1D C", 0, 0x3c4e, - { 6847,-614,-1014,-4669,12737,2139,-1197,2488,6846 } }, + { 6847,-614,-1014,-4669,12737,2139,-1197,2488,6846 } }, { "Canon EOS-1D X", 0, 0x3c4e, - { 6847,-614,-1014,-4669,12737,2139,-1197,2488,6846 } }, + { 6847,-614,-1014,-4669,12737,2139,-1197,2488,6846 } }, { "Canon EOS-1D", 0, 0xe20, - { 6806,-179,-1020,-8097,16415,1687,-3267,4236,7690 } }, + { 6806,-179,-1020,-8097,16415,1687,-3267,4236,7690 } }, + { "Canon EOS C500", 853, 0, /* DJC */ + { 17851,-10604,922,-7425,16662,763,-3660,3636,22278 } }, { "Canon PowerShot A530", 0, 0, - { 0 } }, /* don't want the A5 matrix */ + { 0 } }, /* don't want the A5 matrix */ { "Canon PowerShot A50", 0, 0, - { -5300,9846,1776,3436,684,3939,-5540,9879,6200,-1404,11175,217 } }, + { -5300,9846,1776,3436,684,3939,-5540,9879,6200,-1404,11175,217 } }, { "Canon PowerShot A5", 0, 0, - { -4801,9475,1952,2926,1611,4094,-5259,10164,5947,-1554,10883,547 } }, + { -4801,9475,1952,2926,1611,4094,-5259,10164,5947,-1554,10883,547 } }, { "Canon PowerShot G10", 0, 0, - { 11093,-3906,-1028,-5047,12492,2879,-1003,1750,5561 } }, + { 11093,-3906,-1028,-5047,12492,2879,-1003,1750,5561 } }, { "Canon PowerShot G11", 0, 0, - { 12177,-4817,-1069,-1612,9864,2049,-98,850,4471 } }, + { 12177,-4817,-1069,-1612,9864,2049,-98,850,4471 } }, { "Canon PowerShot G12", 0, 0, - { 13244,-5501,-1248,-1508,9858,1935,-270,1083,4366 } }, + { 13244,-5501,-1248,-1508,9858,1935,-270,1083,4366 } }, { "Canon PowerShot G15", 0, 0, - { 7474,-2301,-567,-4056,11456,2975,-222,716,4181 } }, + { 7474,-2301,-567,-4056,11456,2975,-222,716,4181 } }, { "Canon PowerShot G16", 0, 0, - { 14130,-8071,127,2199,6528,1551,3402,-1721,4960 } }, + { 14130,-8071,127,2199,6528,1551,3402,-1721,4960 } }, + { "Canon PowerShot G1 X Mark II", 0, 0, + { 7378,-1255,-1043,-4088,12251,2048,-876,1946,5805 } }, { "Canon PowerShot G1 X", 0, 0, - { 7378,-1255,-1043,-4088,12251,2048,-876,1946,5805 } }, + { 7378,-1255,-1043,-4088,12251,2048,-876,1946,5805 } }, { "Canon PowerShot G1", 0, 0, - { -4778,9467,2172,4743,-1141,4344,-5146,9908,6077,-1566,11051,557 } }, + { -4778,9467,2172,4743,-1141,4344,-5146,9908,6077,-1566,11051,557 } }, { "Canon PowerShot G2", 0, 0, - { 9087,-2693,-1049,-6715,14382,2537,-2291,2819,7790 } }, + { 9087,-2693,-1049,-6715,14382,2537,-2291,2819,7790 } }, + { "Canon PowerShot G3 X", 0, 0, + { 9701,-3857,-921,-3149,11537,1817,-786,1817,5147 } }, { "Canon PowerShot G3", 0, 0, - { 9212,-2781,-1073,-6573,14189,2605,-2300,2844,7664 } }, + { 9212,-2781,-1073,-6573,14189,2605,-2300,2844,7664 } }, { "Canon PowerShot G5", 0, 0, - { 9757,-2872,-933,-5972,13861,2301,-1622,2328,7212 } }, + { 9757,-2872,-933,-5972,13861,2301,-1622,2328,7212 } }, { "Canon PowerShot G6", 0, 0, - { 9877,-3775,-871,-7613,14807,3072,-1448,1305,7485 } }, + { 9877,-3775,-871,-7613,14807,3072,-1448,1305,7485 } }, + { "Canon PowerShot G7 X", 0, 0, + { 9602,-3823,-937,-2984,11495,1675,-407,1415,5049 } }, { "Canon PowerShot G9", 0, 0, - { 7368,-2141,-598,-5621,13254,2625,-1418,1696,5743 } }, + { 7368,-2141,-598,-5621,13254,2625,-1418,1696,5743 } }, { "Canon PowerShot Pro1", 0, 0, - { 10062,-3522,-999,-7643,15117,2730,-765,817,7323 } }, + { 10062,-3522,-999,-7643,15117,2730,-765,817,7323 } }, { "Canon PowerShot Pro70", 34, 0, - { -4155,9818,1529,3939,-25,4522,-5521,9870,6610,-2238,10873,1342 } }, + { -4155,9818,1529,3939,-25,4522,-5521,9870,6610,-2238,10873,1342 } }, { "Canon PowerShot Pro90", 0, 0, - { -4963,9896,2235,4642,-987,4294,-5162,10011,5859,-1770,11230,577 } }, + { -4963,9896,2235,4642,-987,4294,-5162,10011,5859,-1770,11230,577 } }, { "Canon PowerShot S30", 0, 0, - { 10566,-3652,-1129,-6552,14662,2006,-2197,2581,7670 } }, + { 10566,-3652,-1129,-6552,14662,2006,-2197,2581,7670 } }, { "Canon PowerShot S40", 0, 0, - { 8510,-2487,-940,-6869,14231,2900,-2318,2829,9013 } }, + { 8510,-2487,-940,-6869,14231,2900,-2318,2829,9013 } }, { "Canon PowerShot S45", 0, 0, - { 8163,-2333,-955,-6682,14174,2751,-2077,2597,8041 } }, + { 8163,-2333,-955,-6682,14174,2751,-2077,2597,8041 } }, { "Canon PowerShot S50", 0, 0, - { 8882,-2571,-863,-6348,14234,2288,-1516,2172,6569 } }, + { 8882,-2571,-863,-6348,14234,2288,-1516,2172,6569 } }, { "Canon PowerShot S60", 0, 0, - { 8795,-2482,-797,-7804,15403,2573,-1422,1996,7082 } }, + { 8795,-2482,-797,-7804,15403,2573,-1422,1996,7082 } }, { "Canon PowerShot S70", 0, 0, - { 9976,-3810,-832,-7115,14463,2906,-901,989,7889 } }, + { 9976,-3810,-832,-7115,14463,2906,-901,989,7889 } }, { "Canon PowerShot S90", 0, 0, - { 12374,-5016,-1049,-1677,9902,2078,-83,852,4683 } }, + { 12374,-5016,-1049,-1677,9902,2078,-83,852,4683 } }, { "Canon PowerShot S95", 0, 0, - { 13440,-5896,-1279,-1236,9598,1931,-180,1001,4651 } }, - { "Canon PowerShot S120", 0, 0, /* LibRaw */ - { 10800,-4782,-628,-2057,10783,1176,-802,2091,4739 } }, + { 13440,-5896,-1279,-1236,9598,1931,-180,1001,4651 } }, + { "Canon PowerShot S120", 0, 0, + { 6961,-1685,-695,-4625,12945,1836,-1114,2152,5518 } }, { "Canon PowerShot S110", 0, 0, - { 8039,-2643,-654,-3783,11230,2930,-206,690,4194 } }, + { 8039,-2643,-654,-3783,11230,2930,-206,690,4194 } }, { "Canon PowerShot S100", 0, 0, - { 7968,-2565,-636,-2873,10697,2513,180,667,4211 } }, + { 7968,-2565,-636,-2873,10697,2513,180,667,4211 } }, { "Canon PowerShot SX1 IS", 0, 0, - { 6578,-259,-502,-5974,13030,3309,-308,1058,4970 } }, + { 6578,-259,-502,-5974,13030,3309,-308,1058,4970 } }, { "Canon PowerShot SX50 HS", 0, 0, - { 12432,-4753,-1247,-2110,10691,1629,-412,1623,4926 } }, + { 12432,-4753,-1247,-2110,10691,1629,-412,1623,4926 } }, + { "Canon PowerShot SX60 HS", 0, 0, + { 13161,-5451,-1344,-1989,10654,1531,-47,1271,4955 } }, { "Canon PowerShot A3300", 0, 0, /* DJC */ - { 10826,-3654,-1023,-3215,11310,1906,0,999,4960 } }, + { 10826,-3654,-1023,-3215,11310,1906,0,999,4960 } }, { "Canon PowerShot A470", 0, 0, /* DJC */ - { 12513,-4407,-1242,-2680,10276,2405,-878,2215,4734 } }, + { 12513,-4407,-1242,-2680,10276,2405,-878,2215,4734 } }, { "Canon PowerShot A610", 0, 0, /* DJC */ - { 15591,-6402,-1592,-5365,13198,2168,-1300,1824,5075 } }, + { 15591,-6402,-1592,-5365,13198,2168,-1300,1824,5075 } }, { "Canon PowerShot A620", 0, 0, /* DJC */ - { 15265,-6193,-1558,-4125,12116,2010,-888,1639,5220 } }, + { 15265,-6193,-1558,-4125,12116,2010,-888,1639,5220 } }, { "Canon PowerShot A630", 0, 0, /* DJC */ - { 14201,-5308,-1757,-6087,14472,1617,-2191,3105,5348 } }, + { 14201,-5308,-1757,-6087,14472,1617,-2191,3105,5348 } }, { "Canon PowerShot A640", 0, 0, /* DJC */ - { 13124,-5329,-1390,-3602,11658,1944,-1612,2863,4885 } }, + { 13124,-5329,-1390,-3602,11658,1944,-1612,2863,4885 } }, { "Canon PowerShot A650", 0, 0, /* DJC */ - { 9427,-3036,-959,-2581,10671,1911,-1039,1982,4430 } }, + { 9427,-3036,-959,-2581,10671,1911,-1039,1982,4430 } }, { "Canon PowerShot A720", 0, 0, /* DJC */ - { 14573,-5482,-1546,-1266,9799,1468,-1040,1912,3810 } }, + { 14573,-5482,-1546,-1266,9799,1468,-1040,1912,3810 } }, { "Canon PowerShot S3 IS", 0, 0, /* DJC */ - { 14062,-5199,-1446,-4712,12470,2243,-1286,2028,4836 } }, + { 14062,-5199,-1446,-4712,12470,2243,-1286,2028,4836 } }, { "Canon PowerShot SX110 IS", 0, 0, /* DJC */ - { 14134,-5576,-1527,-1991,10719,1273,-1158,1929,3581 } }, + { 14134,-5576,-1527,-1991,10719,1273,-1158,1929,3581 } }, { "Canon PowerShot SX220", 0, 0, /* DJC */ - { 13898,-5076,-1447,-1405,10109,1297,-244,1860,3687 } }, + { 13898,-5076,-1447,-1405,10109,1297,-244,1860,3687 } }, { "Casio EX-S20", 0, 0, /* DJC */ - { 11634,-3924,-1128,-4968,12954,2015,-1588,2648,7206 } }, + { 11634,-3924,-1128,-4968,12954,2015,-1588,2648,7206 } }, { "Casio EX-Z750", 0, 0, /* DJC */ - { 10819,-3873,-1099,-4903,13730,1175,-1755,3751,4632 } }, + { 10819,-3873,-1099,-4903,13730,1175,-1755,3751,4632 } }, { "Casio EX-Z10", 128, 0xfff, /* DJC */ - { 9790,-3338,-603,-2321,10222,2099,-344,1273,4799 } }, + { 9790,-3338,-603,-2321,10222,2099,-344,1273,4799 } }, { "CINE 650", 0, 0, - { 3390,480,-500,-800,3610,340,-550,2336,1192 } }, + { 3390,480,-500,-800,3610,340,-550,2336,1192 } }, { "CINE 660", 0, 0, - { 3390,480,-500,-800,3610,340,-550,2336,1192 } }, + { 3390,480,-500,-800,3610,340,-550,2336,1192 } }, { "CINE", 0, 0, - { 20183,-4295,-423,-3940,15330,3985,-280,4870,9800 } }, + { 20183,-4295,-423,-3940,15330,3985,-280,4870,9800 } }, { "Contax N Digital", 0, 0xf1e, - { 7777,1285,-1053,-9280,16543,2916,-3677,5679,7060 } }, + { 7777,1285,-1053,-9280,16543,2916,-3677,5679,7060 } }, { "Epson R-D1", 0, 0, - { 6827,-1878,-732,-8429,16012,2564,-704,592,7145 } }, + { 6827,-1878,-732,-8429,16012,2564,-704,592,7145 } }, { "Fujifilm E550", 0, 0, - { 11044,-3888,-1120,-7248,15168,2208,-1531,2277,8069 } }, + { 11044,-3888,-1120,-7248,15168,2208,-1531,2277,8069 } }, { "Fujifilm E900", 0, 0, - { 9183,-2526,-1078,-7461,15071,2574,-2022,2440,8639 } }, + { 9183,-2526,-1078,-7461,15071,2574,-2022,2440,8639 } }, { "Fujifilm F5", 0, 0, - { 13690,-5358,-1474,-3369,11600,1998,-132,1554,4395 } }, + { 13690,-5358,-1474,-3369,11600,1998,-132,1554,4395 } }, { "Fujifilm F6", 0, 0, - { 13690,-5358,-1474,-3369,11600,1998,-132,1554,4395 } }, + { 13690,-5358,-1474,-3369,11600,1998,-132,1554,4395 } }, { "Fujifilm F77", 0, 0xfe9, - { 13690,-5358,-1474,-3369,11600,1998,-132,1554,4395 } }, + { 13690,-5358,-1474,-3369,11600,1998,-132,1554,4395 } }, { "Fujifilm F7", 0, 0, - { 10004,-3219,-1201,-7036,15047,2107,-1863,2565,7736 } }, + { 10004,-3219,-1201,-7036,15047,2107,-1863,2565,7736 } }, { "Fujifilm F8", 0, 0, - { 13690,-5358,-1474,-3369,11600,1998,-132,1554,4395 } }, + { 13690,-5358,-1474,-3369,11600,1998,-132,1554,4395 } }, { "Fujifilm S100FS", 514, 0, - { 11521,-4355,-1065,-6524,13767,3058,-1466,1984,6045 } }, - { "Fujifilm S200EXR", 512, 0x3fff, - { 11401,-4498,-1312,-5088,12751,2613,-838,1568,5941 } }, + { 11521,-4355,-1065,-6524,13767,3058,-1466,1984,6045 } }, + { "Fujifilm S1", 0, 0, + { 12297,-4882,-1202,-2106,10691,1623,-88,1312,4790 } }, { "Fujifilm S20Pro", 0, 0, - { 10004,-3219,-1201,-7036,15047,2107,-1863,2565,7736 } }, + { 10004,-3219,-1201,-7036,15047,2107,-1863,2565,7736 } }, + { "Fujifilm S20", 512, 0x3fff, + { 11401,-4498,-1312,-5088,12751,2613,-838,1568,5941 } }, { "Fujifilm S2Pro", 128, 0, - { 12492,-4690,-1402,-7033,15423,1647,-1507,2111,7697 } }, + { 12492,-4690,-1402,-7033,15423,1647,-1507,2111,7697 } }, { "Fujifilm S3Pro", 0, 0, - { 11807,-4612,-1294,-8927,16968,1988,-2120,2741,8006 } }, + { 11807,-4612,-1294,-8927,16968,1988,-2120,2741,8006 } }, { "Fujifilm S5Pro", 0, 0, - { 12300,-5110,-1304,-9117,17143,1998,-1947,2448,8100 } }, + { 12300,-5110,-1304,-9117,17143,1998,-1947,2448,8100 } }, { "Fujifilm S5000", 0, 0, - { 8754,-2732,-1019,-7204,15069,2276,-1702,2334,6982 } }, + { 8754,-2732,-1019,-7204,15069,2276,-1702,2334,6982 } }, { "Fujifilm S5100", 0, 0, - { 11940,-4431,-1255,-6766,14428,2542,-993,1165,7421 } }, + { 11940,-4431,-1255,-6766,14428,2542,-993,1165,7421 } }, { "Fujifilm S5500", 0, 0, - { 11940,-4431,-1255,-6766,14428,2542,-993,1165,7421 } }, + { 11940,-4431,-1255,-6766,14428,2542,-993,1165,7421 } }, { "Fujifilm S5200", 0, 0, - { 9636,-2804,-988,-7442,15040,2589,-1803,2311,8621 } }, + { 9636,-2804,-988,-7442,15040,2589,-1803,2311,8621 } }, { "Fujifilm S5600", 0, 0, - { 9636,-2804,-988,-7442,15040,2589,-1803,2311,8621 } }, + { 9636,-2804,-988,-7442,15040,2589,-1803,2311,8621 } }, { "Fujifilm S6", 0, 0, - { 12628,-4887,-1401,-6861,14996,1962,-2198,2782,7091 } }, + { 12628,-4887,-1401,-6861,14996,1962,-2198,2782,7091 } }, { "Fujifilm S7000", 0, 0, - { 10190,-3506,-1312,-7153,15051,2238,-2003,2399,7505 } }, + { 10190,-3506,-1312,-7153,15051,2238,-2003,2399,7505 } }, { "Fujifilm S9000", 0, 0, - { 10491,-3423,-1145,-7385,15027,2538,-1809,2275,8692 } }, + { 10491,-3423,-1145,-7385,15027,2538,-1809,2275,8692 } }, { "Fujifilm S9500", 0, 0, - { 10491,-3423,-1145,-7385,15027,2538,-1809,2275,8692 } }, + { 10491,-3423,-1145,-7385,15027,2538,-1809,2275,8692 } }, { "Fujifilm S9100", 0, 0, - { 12343,-4515,-1285,-7165,14899,2435,-1895,2496,8800 } }, + { 12343,-4515,-1285,-7165,14899,2435,-1895,2496,8800 } }, { "Fujifilm S9600", 0, 0, - { 12343,-4515,-1285,-7165,14899,2435,-1895,2496,8800 } }, + { 12343,-4515,-1285,-7165,14899,2435,-1895,2496,8800 } }, { "Fujifilm SL1000", 0, 0, - { 11705,-4262,-1107,-2282,10791,1709,-555,1713,4945 } }, + { 11705,-4262,-1107,-2282,10791,1709,-555,1713,4945 } }, { "Fujifilm IS-1", 0, 0, - { 21461,-10807,-1441,-2332,10599,1999,289,875,7703 } }, + { 21461,-10807,-1441,-2332,10599,1999,289,875,7703 } }, { "Fujifilm IS Pro", 0, 0, - { 12300,-5110,-1304,-9117,17143,1998,-1947,2448,8100 } }, + { 12300,-5110,-1304,-9117,17143,1998,-1947,2448,8100 } }, { "Fujifilm HS10 HS11", 0, 0xf68, - { 12440,-3954,-1183,-1123,9674,1708,-83,1614,4086 } }, - { "Fujifilm HS20EXR", 0, 0, - { 13690,-5358,-1474,-3369,11600,1998,-132,1554,4395 } }, + { 12440,-3954,-1183,-1123,9674,1708,-83,1614,4086 } }, + { "Fujifilm HS2", 0, 0, + { 13690,-5358,-1474,-3369,11600,1998,-132,1554,4395 } }, { "Fujifilm HS3", 0, 0, - { 13690,-5358,-1474,-3369,11600,1998,-132,1554,4395 } }, + { 13690,-5358,-1474,-3369,11600,1998,-132,1554,4395 } }, { "Fujifilm HS50EXR", 0, 0, - { 12085,-4727,-953,-3257,11489,2002,-511,2046,4592 } }, + { 12085,-4727,-953,-3257,11489,2002,-511,2046,4592 } }, + { "Fujifilm F900EXR", 0, 0, + { 12085,-4727,-953,-3257,11489,2002,-511,2046,4592 } }, { "Fujifilm X100S", 0, 0, - { 10592,-4262,-1008,-3514,11355,2465,-870,2025,6386 } }, + { 10592,-4262,-1008,-3514,11355,2465,-870,2025,6386 } }, + { "Fujifilm X100T", 0, 0, + { 10592,-4262,-1008,-3514,11355,2465,-870,2025,6386 } }, { "Fujifilm X100", 0, 0, - { 12161,-4457,-1069,-5034,12874,2400,-795,1724,6904 } }, + { 12161,-4457,-1069,-5034,12874,2400,-795,1724,6904 } }, { "Fujifilm X10", 0, 0, - { 13509,-6199,-1254,-4430,12733,1865,-331,1441,5022 } }, + { 13509,-6199,-1254,-4430,12733,1865,-331,1441,5022 } }, { "Fujifilm X20", 0, 0, - { 11768,-4971,-1133,-4904,12927,2183,-480,1723,4605 } }, + { 11768,-4971,-1133,-4904,12927,2183,-480,1723,4605 } }, + { "Fujifilm X30", 0, 0, + { 12328,-5256,-1144,-4469,12927,1675,-87,1291,4351 } }, { "Fujifilm X-Pro1", 0, 0, - { 10413,-3996,-993,-3721,11640,2361,-733,1540,6011 } }, + { 10413,-3996,-993,-3721,11640,2361,-733,1540,6011 } }, { "Fujifilm X-A1", 0, 0, - { 10413,-3996,-993,-3721,11640,2361,-733,1540,6011 } }, + { 11086,-4555,-839,-3512,11310,2517,-815,1341,5940 } }, + { "Fujifilm X-A2", 0, 0, + { 10763,-4560,-917,-3346,11311,2322,-475,1135,5843 } }, { "Fujifilm X-E1", 0, 0, - { 10413,-3996,-993,-3721,11640,2361,-733,1540,6011 } }, + { 10413,-3996,-993,-3721,11640,2361,-733,1540,6011 } }, { "Fujifilm X-E2", 0, 0, { 12066,-5927,-367,-1969,9878,1503,-721,2034,5453 } }, { "Fujifilm XF1", 0, 0, - { 13509,-6199,-1254,-4430,12733,1865,-331,1441,5022 } }, + { 13509,-6199,-1254,-4430,12733,1865,-331,1441,5022 } }, { "Fujifilm X-M1", 0, 0, { 13193,-6685,-425,-2229,10458,1534,-878,1763,5217 } }, { "Fujifilm X-S1", 0, 0, - { 13509,-6199,-1254,-4430,12733,1865,-331,1441,5022 } }, + { 13509,-6199,-1254,-4430,12733,1865,-331,1441,5022 } }, + { "Fujifilm X-T10", 0, 0, + { 10763,-4560,-917,-3346,11311,2322,-475,1135,5843 }}, + { "Fujifilm X-T1", 0, 0, + { 8458,-2451,-855,-4597,12447,2407,-1475,2482,6526 } }, { "Fujifilm XQ1", 0, 0, - { 14305,-7365,-687,-3117,12383,432,-287,1660,4361 } }, - { "Hasselblad Lunar", 128, 0, - { 5491,-1192,-363,-4951,12342,2948,-911,1722,7192 } }, - { "Hasselblad Stellar", 200, 0, - { 8651,-2754,-1057,-3464,12207,1373,-568,1398,4434 } }, + { 9252,-2704,-1064,-5893,14265,1717,-1101,2341,4349 } }, + { "Fujifilm XQ2", 0, 0, + { 9252,-2704,-1064,-5893,14265,1717,-1101,2341,4349 } }, + { "Hasselblad Lunar", -512, 0, + { 5491,-1192,-363,-4951,12342,2948,-911,1722,7192 } }, + { "Hasselblad Stellar", -800, 0, + { 8651,-2754,-1057,-3464,12207,1373,-568,1398,4434 } }, + { "Hasselblad CFV", 0, 0, /* Adobe */ + { 8519, -3260, -280, -5081, 13459, 1738, -1449, 2960, 7809, } }, + { "Hasselblad H-16MP", 0, 0, /* LibRaw */ + { 17765,-5322,-1734,-6168,13354,2135,-264,2524,7440 } }, + { "Hasselblad H-22MP", 0, 0, /* LibRaw */ + { 17765,-5322,-1734,-6168,13354,2135,-264,2524,7440 } }, + { "Hasselblad H-31MP",0, 0, /* LibRaw */ + { 14480,-5448,-1686,-3534,13123,2260,384,2952,7232 } }, + { "Hasselblad H-39MP",0, 0, /* Adobe */ + { 3857,452, -46, -6008, 14477, 1596, -2627, 4481, 5718 } }, + { "Hasselblad H3D-50", 0, 0, /* Adobe */ + { 3857,452, -46, -6008, 14477, 1596, -2627, 4481, 5718 } }, + { "Hasselblad H4D-40",0, 0, /* LibRaw */ + { 6325,-860,-957,-6559,15945,266,167,770,5936 } }, + { "Hasselblad H4D-50",0, 0, /* LibRaw */ + { 15283,-6272,-465,-2030,16031,478,-2379,390,7965 } }, + { "Hasselblad H4D-60",0, 0, /* Adobe */ + { 9662, -684, -279, -4903, 12293, 2950, -344, 1669, 6024 } }, + { "Hasselblad H5D-50c",0, 0, /* Adobe */ + { 4932, -835, 141, -4878, 11868, 3437, -1138, 1961, 7067 } }, + { "Hasselblad H5D-50",0, 0, /* Adobe */ + { 5656, -659, -346, -3923, 12306, 1791, -1602, 3509, 5442 } }, { "Imacon Ixpress", 0, 0, /* DJC */ - { 7025,-1415,-704,-5188,13765,1424,-1248,2742,6038 } }, + { 7025,-1415,-704,-5188,13765,1424,-1248,2742,6038 } }, { "Kodak NC2000", 0, 0, - { 13891,-6055,-803,-465,9919,642,2121,82,1291 } }, - { "Kodak DCS315C", 8, 0, - { 17523,-4827,-2510,756,8546,-137,6113,1649,2250 } }, - { "Kodak DCS330C", 8, 0, - { 20620,-7572,-2801,-103,10073,-396,3551,-233,2220 } }, + { 13891,-6055,-803,-465,9919,642,2121,82,1291 } }, + { "Kodak DCS315C", -8, 0, + { 17523,-4827,-2510,756,8546,-137,6113,1649,2250 } }, + { "Kodak DCS330C", -8, 0, + { 20620,-7572,-2801,-103,10073,-396,3551,-233,2220 } }, { "Kodak DCS420", 0, 0, - { 10868,-1852,-644,-1537,11083,484,2343,628,2216 } }, + { 10868,-1852,-644,-1537,11083,484,2343,628,2216 } }, { "Kodak DCS460", 0, 0, - { 10592,-2206,-967,-1944,11685,230,2206,670,1273 } }, + { 10592,-2206,-967,-1944,11685,230,2206,670,1273 } }, { "Kodak EOSDCS1", 0, 0, - { 10592,-2206,-967,-1944,11685,230,2206,670,1273 } }, + { 10592,-2206,-967,-1944,11685,230,2206,670,1273 } }, { "Kodak EOSDCS3B", 0, 0, - { 9898,-2700,-940,-2478,12219,206,1985,634,1031 } }, - { "Kodak DCS520C", 178, 0, - { 24542,-10860,-3401,-1490,11370,-297,2858,-605,3225 } }, - { "Kodak DCS560C", 177, 0, - { 20482,-7172,-3125,-1033,10410,-285,2542,226,3136 } }, - { "Kodak DCS620C", 177, 0, - { 23617,-10175,-3149,-2054,11749,-272,2586,-489,3453 } }, - { "Kodak DCS620X", 176, 0, - { 13095,-6231,154,12221,-21,-2137,895,4602,2258 } }, - { "Kodak DCS660C", 173, 0, - { 18244,-6351,-2739,-791,11193,-521,3711,-129,2802 } }, + { 9898,-2700,-940,-2478,12219,206,1985,634,1031 } }, + { "Kodak DCS520C", -178, 0, + { 24542,-10860,-3401,-1490,11370,-297,2858,-605,3225 } }, + { "Kodak DCS560C", -177, 0, + { 20482,-7172,-3125,-1033,10410,-285,2542,226,3136 } }, + { "Kodak DCS620C", -177, 0, + { 23617,-10175,-3149,-2054,11749,-272,2586,-489,3453 } }, + { "Kodak DCS620X", -176, 0, + { 13095,-6231,154,12221,-21,-2137,895,4602,2258 } }, + { "Kodak DCS660C", -173, 0, + { 18244,-6351,-2739,-791,11193,-521,3711,-129,2802 } }, { "Kodak DCS720X", 0, 0, - { 11775,-5884,950,9556,1846,-1286,-1019,6221,2728 } }, + { 11775,-5884,950,9556,1846,-1286,-1019,6221,2728 } }, { "Kodak DCS760C", 0, 0, - { 16623,-6309,-1411,-4344,13923,323,2285,274,2926 } }, + { 16623,-6309,-1411,-4344,13923,323,2285,274,2926 } }, { "Kodak DCS Pro SLR", 0, 0, - { 5494,2393,-232,-6427,13850,2846,-1876,3997,5445 } }, + { 5494,2393,-232,-6427,13850,2846,-1876,3997,5445 } }, { "Kodak DCS Pro 14nx", 0, 0, - { 5494,2393,-232,-6427,13850,2846,-1876,3997,5445 } }, + { 5494,2393,-232,-6427,13850,2846,-1876,3997,5445 } }, { "Kodak DCS Pro 14", 0, 0, - { 7791,3128,-776,-8588,16458,2039,-2455,4006,6198 } }, + { 7791,3128,-776,-8588,16458,2039,-2455,4006,6198 } }, { "Kodak ProBack645", 0, 0, - { 16414,-6060,-1470,-3555,13037,473,2545,122,4948 } }, + { 16414,-6060,-1470,-3555,13037,473,2545,122,4948 } }, { "Kodak ProBack", 0, 0, - { 21179,-8316,-2918,-915,11019,-165,3477,-180,4210 } }, + { 21179,-8316,-2918,-915,11019,-165,3477,-180,4210 } }, { "Kodak P712", 0, 0, - { 9658,-3314,-823,-5163,12695,2768,-1342,1843,6044 } }, + { 9658,-3314,-823,-5163,12695,2768,-1342,1843,6044 } }, { "Kodak P850", 0, 0xf7c, - { 10511,-3836,-1102,-6946,14587,2558,-1481,1792,6246 } }, + { 10511,-3836,-1102,-6946,14587,2558,-1481,1792,6246 } }, { "Kodak P880", 0, 0xfff, - { 12805,-4662,-1376,-7480,15267,2360,-1626,2194,7904 } }, + { 12805,-4662,-1376,-7480,15267,2360,-1626,2194,7904 } }, { "Kodak EasyShare Z980", 0, 0, - { 11313,-3559,-1101,-3893,11891,2257,-1214,2398,4908 } }, + { 11313,-3559,-1101,-3893,11891,2257,-1214,2398,4908 } }, { "Kodak EasyShare Z981", 0, 0, - { 12729,-4717,-1188,-1367,9187,2582,274,860,4411 } }, + { 12729,-4717,-1188,-1367,9187,2582,274,860,4411 } }, { "Kodak EasyShare Z990", 0, 0xfed, - { 11749,-4048,-1309,-1867,10572,1489,-138,1449,4522 } }, + { 11749,-4048,-1309,-1867,10572,1489,-138,1449,4522 } }, { "Kodak EASYSHARE Z1015", 0, 0xef1, - { 11265,-4286,-992,-4694,12343,2647,-1090,1523,5447 } }, + { 11265,-4286,-992,-4694,12343,2647,-1090,1523,5447 } }, { "Leaf CMost", 0, 0, - { 3952,2189,449,-6701,14585,2275,-4536,7349,6536 } }, + { 3952,2189,449,-6701,14585,2275,-4536,7349,6536 } }, { "Leaf Valeo 6", 0, 0, - { 3952,2189,449,-6701,14585,2275,-4536,7349,6536 } }, + { 3952,2189,449,-6701,14585,2275,-4536,7349,6536 } }, { "Leaf Aptus 54S", 0, 0, - { 8236,1746,-1314,-8251,15953,2428,-3673,5786,5771 } }, + { 8236,1746,-1314,-8251,15953,2428,-3673,5786,5771 } }, { "Leaf Aptus 65", 0, 0, - { 7914,1414,-1190,-8777,16582,2280,-2811,4605,5562 } }, + { 7914,1414,-1190,-8777,16582,2280,-2811,4605,5562 } }, { "Leaf Aptus 75", 0, 0, - { 7914,1414,-1190,-8777,16582,2280,-2811,4605,5562 } }, + { 7914,1414,-1190,-8777,16582,2280,-2811,4605,5562 } }, + { "Leaf Credo 40", 0, 0, + { 8035, 435, -962, -6001, 13872, 2320, -1159, 3065, 5434 } }, + { "Leaf Credo 50", 0, 0, + { 3984, 0, 0, 0, 10000, 0, 0, 0, 7666 } }, + { "Leaf Credo 60", 0, 0, + { 8035, 435, -962, -6001, 13872,2320,-1159,3065,5434 } }, + { "Leaf Credo 80", 0, 0, + { 6294, 686, -712, -5435, 13417, 2211, -1006, 2435, 5042 } }, { "Leaf", 0, 0, - { 8236,1746,-1314,-8251,15953,2428,-3673,5786,5771 } }, + { 8236,1746,-1314,-8251,15953,2428,-3673,5786,5771 } }, { "Mamiya ZD", 0, 0, - { 7645,2579,-1363,-8689,16717,2015,-3712,5941,5961 } }, + { 7645,2579,-1363,-8689,16717,2015,-3712,5941,5961 } }, { "Micron 2010", 110, 0, /* DJC */ - { 16695,-3761,-2151,155,9682,163,3433,951,4904 } }, + { 16695,-3761,-2151,155,9682,163,3433,951,4904 } }, { "Minolta DiMAGE 5", 0, 0xf7d, - { 8983,-2942,-963,-6556,14476,2237,-2426,2887,8014 } }, + { 8983,-2942,-963,-6556,14476,2237,-2426,2887,8014 } }, { "Minolta DiMAGE 7Hi", 0, 0xf7d, - { 11368,-3894,-1242,-6521,14358,2339,-2475,3056,7285 } }, + { 11368,-3894,-1242,-6521,14358,2339,-2475,3056,7285 } }, { "Minolta DiMAGE 7", 0, 0xf7d, - { 9144,-2777,-998,-6676,14556,2281,-2470,3019,7744 } }, + { 9144,-2777,-998,-6676,14556,2281,-2470,3019,7744 } }, { "Minolta DiMAGE A1", 0, 0xf8b, - { 9274,-2547,-1167,-8220,16323,1943,-2273,2720,8340 } }, + { 9274,-2547,-1167,-8220,16323,1943,-2273,2720,8340 } }, { "Minolta DiMAGE A200", 0, 0, - { 8560,-2487,-986,-8112,15535,2771,-1209,1324,7743 } }, + { 8560,-2487,-986,-8112,15535,2771,-1209,1324,7743 } }, { "Minolta DiMAGE A2", 0, 0xf8f, - { 9097,-2726,-1053,-8073,15506,2762,-966,981,7763 } }, + { 9097,-2726,-1053,-8073,15506,2762,-966,981,7763 } }, { "Minolta DiMAGE Z2", 0, 0, /* DJC */ - { 11280,-3564,-1370,-4655,12374,2282,-1423,2168,5396 } }, + { 11280,-3564,-1370,-4655,12374,2282,-1423,2168,5396 } }, { "Minolta DYNAX 5", 0, 0xffb, - { 10284,-3283,-1086,-7957,15762,2316,-829,882,6644 } }, + { 10284,-3283,-1086,-7957,15762,2316,-829,882,6644 } }, { "Minolta DYNAX 7", 0, 0xffb, - { 10239,-3104,-1099,-8037,15727,2451,-927,925,6871 } }, + { 10239,-3104,-1099,-8037,15727,2451,-927,925,6871 } }, { "Motorola PIXL", 0, 0, /* DJC */ - { 8898,-989,-1033,-3292,11619,1674,-661,3178,5216 } }, + { 8898,-989,-1033,-3292,11619,1674,-661,3178,5216 } }, { "Nikon D100", 0, 0, - { 5902,-933,-782,-8983,16719,2354,-1402,1455,6464 } }, + { 5902,-933,-782,-8983,16719,2354,-1402,1455,6464 } }, { "Nikon D1H", 0, 0, - { 7577,-2166,-926,-7454,15592,1934,-2377,2808,8606 } }, + { 7577,-2166,-926,-7454,15592,1934,-2377,2808,8606 } }, { "Nikon D1X", 0, 0, - { 7702,-2245,-975,-9114,17242,1875,-2679,3055,8521 } }, + { 7702,-2245,-975,-9114,17242,1875,-2679,3055,8521 } }, { "Nikon D1", 0, 0, /* multiplied by 2.218750, 1.0, 1.148438 */ - { 16772,-4726,-2141,-7611,15713,1972,-2846,3494,9521 } }, + { 16772,-4726,-2141,-7611,15713,1972,-2846,3494,9521 } }, { "Nikon D200", 0, 0xfbc, - { 8367,-2248,-763,-8758,16447,2422,-1527,1550,8053 } }, + { 8367,-2248,-763,-8758,16447,2422,-1527,1550,8053 } }, { "Nikon D2H", 0, 0, - { 5710,-901,-615,-8594,16617,2024,-2975,4120,6830 } }, + { 5710,-901,-615,-8594,16617,2024,-2975,4120,6830 } }, { "Nikon D2X", 0, 0, - { 10231,-2769,-1255,-8301,15900,2552,-797,680,7148 } }, + { 10231,-2769,-1255,-8301,15900,2552,-797,680,7148 } }, { "Nikon D3000", 0, 0, - { 8736,-2458,-935,-9075,16894,2251,-1354,1242,8263 } }, + { 8736,-2458,-935,-9075,16894,2251,-1354,1242,8263 } }, { "Nikon D3100", 0, 0, - { 7911,-2167,-813,-5327,13150,2408,-1288,2483,7968 } }, + { 7911,-2167,-813,-5327,13150,2408,-1288,2483,7968 } }, { "Nikon D3200", 0, 0xfb9, - { 7013,-1408,-635,-5268,12902,2640,-1470,2801,7379 } }, + { 7013,-1408,-635,-5268,12902,2640,-1470,2801,7379 } }, + { "Nikon D3300", 0, 0, + { 6988,-1384,-714,-5631,13410,2447,-1485,2204,7318 } }, { "Nikon D300", 0, 0, - { 9030,-1992,-715,-8465,16302,2255,-2689,3217,8069 } }, + { 9030,-1992,-715,-8465,16302,2255,-2689,3217,8069 } }, { "Nikon D3X", 0, 0, - { 7171,-1986,-648,-8085,15555,2718,-2170,2512,7457 } }, + { 7171,-1986,-648,-8085,15555,2718,-2170,2512,7457 } }, { "Nikon D3S", 0, 0, - { 8828,-2406,-694,-4874,12603,2541,-660,1509,7587 } }, + { 8828,-2406,-694,-4874,12603,2541,-660,1509,7587 } }, { "Nikon D3", 0, 0, - { 8139,-2171,-663,-8747,16541,2295,-1925,2008,8093 } }, + { 8139,-2171,-663,-8747,16541,2295,-1925,2008,8093 } }, { "Nikon D40X", 0, 0, - { 8819,-2543,-911,-9025,16928,2151,-1329,1213,8449 } }, + { 8819,-2543,-911,-9025,16928,2151,-1329,1213,8449 } }, { "Nikon D40", 0, 0, - { 6992,-1668,-806,-8138,15748,2543,-874,850,7897 } }, + { 6992,-1668,-806,-8138,15748,2543,-874,850,7897 } }, + { "Nikon D4S", 0, 0, + { 8598,-2848,-857,-5618,13606,2195,-1002,1773,7137 } }, { "Nikon D4", 0, 0, - { 10076,-4135,-659,-4586,13006,746,-1189,2107,6185 } }, + { 8598,-2848,-857,-5618,13606,2195,-1002,1773,7137 } }, + { "Nikon Df", 0, 0, + { 8598,-2848,-857,-5618,13606,2195,-1002,1773,7137 } }, { "Nikon D5000", 0, 0xf00, - { 7309,-1403,-519,-8474,16008,2622,-2433,2826,8064 } }, + { 7309,-1403,-519,-8474,16008,2622,-2433,2826,8064 } }, { "Nikon D5100", 0, 0x3de6, - { 8198,-2239,-724,-4871,12389,2798,-1043,2050,7181 } }, + { 8198,-2239,-724,-4871,12389,2798,-1043,2050,7181 } }, { "Nikon D5200", 0, 0, - { 8322,-3112,-1047,-6367,14342,2179,-988,1638,6394 } }, - {"Nikon D5300",0, 0, - { 10645,-5086,-698,-4938,13608,761,-1107,1874,5312 } }, + { 8322,-3112,-1047,-6367,14342,2179,-988,1638,6394 } }, + { "Nikon D5300", 0, 0, + { 6988,-1384,-714,-5631,13410,2447,-1485,2204,7318 } }, + { "Nikon D5500", 0, 0, + { 8821,-2938,-785,-4178,12142,2287,-824,1651,6860 } }, { "Nikon D50", 0, 0, - { 7732,-2422,-789,-8238,15884,2498,-859,783,7330 } }, + { 7732,-2422,-789,-8238,15884,2498,-859,783,7330 } }, { "Nikon D600", 0, 0x3e07, - { 8178,-2245,-609,-4857,12394,2776,-1207,2086,7298 } }, - {"Nikon D610",0, 0, - { 10426,-4005,-444,-3565,11764,1403,-1206,2266,6549 } }, + { 8178,-2245,-609,-4857,12394,2776,-1207,2086,7298 } }, + { "Nikon D610",0, 0, + { 10426,-4005,-444,-3565,11764,1403,-1206,2266,6549 } }, { "Nikon D60", 0, 0, - { 8736,-2458,-935,-9075,16894,2251,-1354,1242,8263 } }, + { 8736,-2458,-935,-9075,16894,2251,-1354,1242,8263 } }, { "Nikon D7000", 0, 0, - { 8198,-2239,-724,-4871,12389,2798,-1043,2050,7181 } }, + { 8198,-2239,-724,-4871,12389,2798,-1043,2050,7181 } }, { "Nikon D7100", 0, 0, { 8322,-3112,-1047,-6367,14342,2179,-988,1638,6394 } }, + { "Nikon D7200", 0, 0, + { 8322,-3112,-1047,-6367,14342,2179,-988,1638,6394 } }, + { "Nikon D750", 0, 0, + { 9020,-2890,-715,-4535,12436,2348,-934,1919,7086 } }, { "Nikon D700", 0, 0, - { 8139,-2171,-663,-8747,16541,2295,-1925,2008,8093 } }, + { 8139,-2171,-663,-8747,16541,2295,-1925,2008,8093 } }, { "Nikon D70", 0, 0, - { 7732,-2422,-789,-8238,15884,2498,-859,783,7330 } }, + { 7732,-2422,-789,-8238,15884,2498,-859,783,7330 } }, + { "Nikon D810A", 0, 0, + { 11973, -5685, -888, -1965, 10326, 1901, -115, 1123, 7169 }}, + { "Nikon D810", 0, 0, + { 9369,-3195,-791,-4488,12430,2301,-893,1796,6872 } }, { "Nikon D800", 0, 0, - { 7866,-2108,-555,-4869,12483,2681,-1176,2069,7501 } }, + { 7866,-2108,-555,-4869,12483,2681,-1176,2069,7501 } }, { "Nikon D80", 0, 0, - { 8629,-2410,-883,-9055,16940,2171,-1490,1363,8520 } }, + { 8629,-2410,-883,-9055,16940,2171,-1490,1363,8520 } }, { "Nikon D90", 0, 0xf00, - { 7309,-1403,-519,-8474,16008,2622,-2434,2826,8064 } }, - {"Nikon Df",0, 0, - { 10076,-4135,-659,-4586,13006,746,-1189,2107,6185 } }, + { 7309,-1403,-519,-8474,16008,2622,-2434,2826,8064 } }, { "Nikon E700", 0, 0x3dd, /* DJC */ - { -3746,10611,1665,9621,-1734,2114,-2389,7082,3064,3406,6116,-244 } }, + { -3746,10611,1665,9621,-1734,2114,-2389,7082,3064,3406,6116,-244 } }, { "Nikon E800", 0, 0x3dd, /* DJC */ - { -3746,10611,1665,9621,-1734,2114,-2389,7082,3064,3406,6116,-244 } }, + { -3746,10611,1665,9621,-1734,2114,-2389,7082,3064,3406,6116,-244 } }, { "Nikon E950", 0, 0x3dd, /* DJC */ - { -3746,10611,1665,9621,-1734,2114,-2389,7082,3064,3406,6116,-244 } }, + { -3746,10611,1665,9621,-1734,2114,-2389,7082,3064,3406,6116,-244 } }, { "Nikon E995", 0, 0, /* copied from E5000 */ - { -5547,11762,2189,5814,-558,3342,-4924,9840,5949,688,9083,96 } }, + { -5547,11762,2189,5814,-558,3342,-4924,9840,5949,688,9083,96 } }, { "Nikon E2100", 0, 0, /* copied from Z2, new white balance */ - { 13142,-4152,-1596,-4655,12374,2282,-1769,2696,6711} }, + { 13142,-4152,-1596,-4655,12374,2282,-1769,2696,6711 } }, { "Nikon E2500", 0, 0, - { -5547,11762,2189,5814,-558,3342,-4924,9840,5949,688,9083,96 } }, + { -5547,11762,2189,5814,-558,3342,-4924,9840,5949,688,9083,96 } }, { "Nikon E3200", 0, 0, /* DJC */ - { 9846,-2085,-1019,-3278,11109,2170,-774,2134,5745 } }, + { 9846,-2085,-1019,-3278,11109,2170,-774,2134,5745 } }, { "Nikon E4300", 0, 0, /* copied from Minolta DiMAGE Z2 */ - { 11280,-3564,-1370,-4655,12374,2282,-1423,2168,5396 } }, + { 11280,-3564,-1370,-4655,12374,2282,-1423,2168,5396 } }, { "Nikon E4500", 0, 0, - { -5547,11762,2189,5814,-558,3342,-4924,9840,5949,688,9083,96 } }, + { -5547,11762,2189,5814,-558,3342,-4924,9840,5949,688,9083,96 } }, { "Nikon E5000", 0, 0, - { -5547,11762,2189,5814,-558,3342,-4924,9840,5949,688,9083,96 } }, + { -5547,11762,2189,5814,-558,3342,-4924,9840,5949,688,9083,96 } }, { "Nikon E5400", 0, 0, - { 9349,-2987,-1001,-7919,15766,2266,-2098,2680,6839 } }, + { 9349,-2987,-1001,-7919,15766,2266,-2098,2680,6839 } }, { "Nikon E5700", 0, 0, - { -5368,11478,2368,5537,-113,3148,-4969,10021,5782,778,9028,211 } }, + { -5368,11478,2368,5537,-113,3148,-4969,10021,5782,778,9028,211 } }, { "Nikon E8400", 0, 0, - { 7842,-2320,-992,-8154,15718,2599,-1098,1342,7560 } }, + { 7842,-2320,-992,-8154,15718,2599,-1098,1342,7560 } }, { "Nikon E8700", 0, 0, - { 8489,-2583,-1036,-8051,15583,2643,-1307,1407,7354 } }, + { 8489,-2583,-1036,-8051,15583,2643,-1307,1407,7354 } }, { "Nikon E8800", 0, 0, - { 7971,-2314,-913,-8451,15762,2894,-1442,1520,7610 } }, + { 7971,-2314,-913,-8451,15762,2894,-1442,1520,7610 } }, { "Nikon COOLPIX A", 0, 0, - { 8198,-2239,-724,-4871,12389,2798,-1043,2050,7181 } }, - { "Nikon COOLPIX P330", 0, 0, - { 10321,-3920,-931,-2750,11146,1824,-442,1545,5539 } }, + { 8198,-2239,-724,-4871,12389,2798,-1043,2050,7181 } }, + { "Nikon COOLPIX P330", -200, 0, + { 10321,-3920,-931,-2750,11146,1824,-442,1545,5539 } }, + { "Nikon COOLPIX P340", -200, 0, + { 10321,-3920,-931,-2750,11146,1824,-442,1545,5539 } }, { "Nikon COOLPIX P6000", 0, 0, - { 9698,-3367,-914,-4706,12584,2368,-837,968,5801 } }, + { 9698,-3367,-914,-4706,12584,2368,-837,968,5801 } }, { "Nikon COOLPIX P7000", 0, 0, - { 11432,-3679,-1111,-3169,11239,2202,-791,1380,4455 } }, + { 11432,-3679,-1111,-3169,11239,2202,-791,1380,4455 } }, { "Nikon COOLPIX P7100", 0, 0, - { 11053,-4269,-1024,-1976,10182,2088,-526,1263,4469 } }, - { "Nikon COOLPIX P7700", 200, 0, - { 10321,-3920,-931,-2750,11146,1824,-442,1545,5539 } }, - { "Nikon COOLPIX P7800", 200, 0, - { 13443,-6418,-673,-1309,10025,1131,-462,1827,4782 } }, + { 11053,-4269,-1024,-1976,10182,2088,-526,1263,4469 } }, + { "Nikon COOLPIX P7700", -3200, 0, + { 10321,-3920,-931,-2750,11146,1824,-442,1545,5539 } }, + { "Nikon COOLPIX P7800", -3200, 0, + { 10321,-3920,-931,-2750,11146,1824,-442,1545,5539 } }, + { "Nikon 1 V3", -200, 0, + { 5958,-1559,-571,-4021,11453,2939,-634,1548,5087 } }, + { "Nikon 1 J4", 0, 0, + { 5958,-1559,-571,-4021,11453,2939,-634,1548,5087 } }, + { "Nikon 1 J5", 0, 0, + { 7520,-2518,-645,-3844,12102,1945,-913,2249,6835} }, + { "Nikon 1 S2", -200, 0, + { 6612,-1342,-618,-3338,11055,2623,-174,1792,5075 } }, { "Nikon 1 V2", 0, 0, - { 6588,-1305,-693,-3277,10987,2634,-355,2016,5106 } }, + { 6588,-1305,-693,-3277,10987,2634,-355,2016,5106 } }, { "Nikon 1 J3", 0, 0, - { 8144,-2671,-473,-1740,9834,1601,-58,1971,4296 } }, + { 8144,-2671,-473,-1740,9834,1601,-58,1971,4296 } }, { "Nikon 1 AW1", 0, 0, - { 8144,-2671,-473,-1740,9834,1601,-58,1971,4296 } }, - { "Nikon 1 ", 0, 0, - { 8994,-2667,-865,-4594,12324,2552,-699,1786,6260 } }, + { 6588,-1305,-693,-3277,10987,2634,-355,2016,5106 } }, + { "Nikon 1 ", 0, 0, /* J1, J2, S1, V1 */ + { 8994,-2667,-865,-4594,12324,2552,-699,1786,6260 } }, + { "Olympus AIR-A01", 0, 0xfe1, + { 8992,-3093,-639,-2563,10721,2122,-437,1270,5473 } }, { "Olympus C5050", 0, 0, - { 10508,-3124,-1273,-6079,14294,1901,-1653,2306,6237 } }, + { 10508,-3124,-1273,-6079,14294,1901,-1653,2306,6237 } }, { "Olympus C5060", 0, 0, - { 10445,-3362,-1307,-7662,15690,2058,-1135,1176,7602 } }, + { 10445,-3362,-1307,-7662,15690,2058,-1135,1176,7602 } }, { "Olympus C7070", 0, 0, - { 10252,-3531,-1095,-7114,14850,2436,-1451,1723,6365 } }, + { 10252,-3531,-1095,-7114,14850,2436,-1451,1723,6365 } }, { "Olympus C70", 0, 0, - { 10793,-3791,-1146,-7498,15177,2488,-1390,1577,7321 } }, + { 10793,-3791,-1146,-7498,15177,2488,-1390,1577,7321 } }, { "Olympus C80", 0, 0, - { 8606,-2509,-1014,-8238,15714,2703,-942,979,7760 } }, + { 8606,-2509,-1014,-8238,15714,2703,-942,979,7760 } }, { "Olympus E-10", 0, 0xffc, - { 12745,-4500,-1416,-6062,14542,1580,-1934,2256,6603 } }, + { 12745,-4500,-1416,-6062,14542,1580,-1934,2256,6603 } }, { "Olympus E-1", 0, 0, - { 11846,-4767,-945,-7027,15878,1089,-2699,4122,8311 } }, + { 11846,-4767,-945,-7027,15878,1089,-2699,4122,8311 } }, { "Olympus E-20", 0, 0xffc, - { 13173,-4732,-1499,-5807,14036,1895,-2045,2452,7142 } }, + { 13173,-4732,-1499,-5807,14036,1895,-2045,2452,7142 } }, { "Olympus E-300", 0, 0, - { 7828,-1761,-348,-5788,14071,1830,-2853,4518,6557 } }, + { 7828,-1761,-348,-5788,14071,1830,-2853,4518,6557 } }, { "Olympus E-330", 0, 0, - { 8961,-2473,-1084,-7979,15990,2067,-2319,3035,8249 } }, + { 8961,-2473,-1084,-7979,15990,2067,-2319,3035,8249 } }, { "Olympus E-30", 0, 0xfbc, - { 8144,-1861,-1111,-7763,15894,1929,-1865,2542,7607 } }, + { 8144,-1861,-1111,-7763,15894,1929,-1865,2542,7607 } }, { "Olympus E-3", 0, 0xf99, - { 9487,-2875,-1115,-7533,15606,2010,-1618,2100,7389 } }, + { 9487,-2875,-1115,-7533,15606,2010,-1618,2100,7389 } }, { "Olympus E-400", 0, 0, - { 6169,-1483,-21,-7107,14761,2536,-2904,3580,8568 } }, + { 6169,-1483,-21,-7107,14761,2536,-2904,3580,8568 } }, { "Olympus E-410", 0, 0xf6a, - { 8856,-2582,-1026,-7761,15766,2082,-2009,2575,7469 } }, + { 8856,-2582,-1026,-7761,15766,2082,-2009,2575,7469 } }, { "Olympus E-420", 0, 0xfd7, - { 8746,-2425,-1095,-7594,15612,2073,-1780,2309,7416 } }, + { 8746,-2425,-1095,-7594,15612,2073,-1780,2309,7416 } }, { "Olympus E-450", 0, 0xfd2, - { 8745,-2425,-1095,-7594,15613,2073,-1780,2309,7416 } }, + { 8745,-2425,-1095,-7594,15613,2073,-1780,2309,7416 } }, { "Olympus E-500", 0, 0, - { 8136,-1968,-299,-5481,13742,1871,-2556,4205,6630 } }, + { 8136,-1968,-299,-5481,13742,1871,-2556,4205,6630 } }, { "Olympus E-510", 0, 0xf6a, - { 8785,-2529,-1033,-7639,15624,2112,-1783,2300,7817 } }, + { 8785,-2529,-1033,-7639,15624,2112,-1783,2300,7817 } }, { "Olympus E-520", 0, 0xfd2, - { 8344,-2322,-1020,-7596,15635,2048,-1748,2269,7287 } }, + { 8344,-2322,-1020,-7596,15635,2048,-1748,2269,7287 } }, { "Olympus E-5", 0, 0xeec, - { 11200,-3783,-1325,-4576,12593,2206,-695,1742,7504 } }, + { 11200,-3783,-1325,-4576,12593,2206,-695,1742,7504 } }, { "Olympus E-600", 0, 0xfaf, - { 8453,-2198,-1092,-7609,15681,2008,-1725,2337,7824 } }, + { 8453,-2198,-1092,-7609,15681,2008,-1725,2337,7824 } }, { "Olympus E-620", 0, 0xfaf, - { 8453,-2198,-1092,-7609,15681,2008,-1725,2337,7824 } }, + { 8453,-2198,-1092,-7609,15681,2008,-1725,2337,7824 } }, { "Olympus E-P1", 0, 0xffd, - { 8343,-2050,-1021,-7715,15705,2103,-1831,2380,8235 } }, + { 8343,-2050,-1021,-7715,15705,2103,-1831,2380,8235 } }, { "Olympus E-P2", 0, 0xffd, - { 8343,-2050,-1021,-7715,15705,2103,-1831,2380,8235 } }, + { 8343,-2050,-1021,-7715,15705,2103,-1831,2380,8235 } }, { "Olympus E-P3", 0, 0, - { 7575,-2159,-571,-3722,11341,2725,-1434,2819,6271 } }, - { "OLYMPUS E-P5", 0, 0, - { 8380,-2630,-639,-2887,10725,2496,-627,1427,5438 } }, + { 7575,-2159,-571,-3722,11341,2725,-1434,2819,6271 } }, + { "Olympus E-P5", 0, 0, + { 8380,-2630,-639,-2887,10725,2496,-627,1427,5438 } }, { "Olympus E-PL1s", 0, 0, - { 11409,-3872,-1393,-4572,12757,2003,-709,1810,7415 } }, + { 11409,-3872,-1393,-4572,12757,2003,-709,1810,7415 } }, { "Olympus E-PL1", 0, 0, - { 11408,-4289,-1215,-4286,12385,2118,-387,1467,7787 } }, + { 11408,-4289,-1215,-4286,12385,2118,-387,1467,7787 } }, { "Olympus E-PL2", 0, 0xcf3, - { 15030,-5552,-1806,-3987,12387,1767,-592,1670,7023 } }, + { 15030,-5552,-1806,-3987,12387,1767,-592,1670,7023 } }, { "Olympus E-PL3", 0, 0, - { 7575,-2159,-571,-3722,11341,2725,-1434,2819,6271 } }, + { 7575,-2159,-571,-3722,11341,2725,-1434,2819,6271 } }, { "Olympus E-PL5", 0, 0xfcb, - { 8380,-2630,-639,-2887,10725,2496,-627,1427,5438 } }, + { 8380,-2630,-639,-2887,10725,2496,-627,1427,5438 } }, + { "Olympus E-PL6", 0, 0, + { 8380,-2630,-639,-2887,10725,2496,-627,1427,5438 } }, + { "Olympus E-PL7", 0, 0, + { 9197,-3190,-659,-2606,10830,2039,-458,1250,5458 } }, { "Olympus E-PM1", 0, 0, - { 7575,-2159,-571,-3722,11341,2725,-1434,2819,6271 } }, + { 7575,-2159,-571,-3722,11341,2725,-1434,2819,6271 } }, { "Olympus E-PM2", 0, 0, - { 8380,-2630,-639,-2887,10725,2496,-627,1427,5438 } }, - {"Olympus E-M1", 0, 0, - { 11663,-5527,-419,-1683,9915,1389,-582,1933,5016 } }, + { 8380,-2630,-639,-2887,10725,2496,-627,1427,5438 } }, + { "Olympus E-M10", 0, 0, + { 8380,-2630,-639,-2887,10725,2496,-627,1427,5438 } }, + { "Olympus E-M1", 0, 0, + { 7687,-1984,-606,-4327,11928,2721,-1381,2339,6452 } }, + { "Olympus E-M5MarkII", 0, 0, + { 9422,-3258,-711,-2655,10898,2015,-512,1354,5512 } }, { "Olympus E-M5", 0, 0xfe1, - { 8380,-2630,-639,-2887,10725,2496,-627,1427,5438 } }, + { 8380,-2630,-639,-2887,10725,2496,-627,1427,5438 } }, { "Olympus SP350", 0, 0, - { 12078,-4836,-1069,-6671,14306,2578,-786,939,7418 } }, + { 12078,-4836,-1069,-6671,14306,2578,-786,939,7418 } }, { "Olympus SP3", 0, 0, - { 11766,-4445,-1067,-6901,14421,2707,-1029,1217,7572 } }, + { 11766,-4445,-1067,-6901,14421,2707,-1029,1217,7572 } }, { "Olympus SP500UZ", 0, 0xfff, - { 9493,-3415,-666,-5211,12334,3260,-1548,2262,6482 } }, + { 9493,-3415,-666,-5211,12334,3260,-1548,2262,6482 } }, { "Olympus SP510UZ", 0, 0xffe, - { 10593,-3607,-1010,-5881,13127,3084,-1200,1805,6721 } }, + { 10593,-3607,-1010,-5881,13127,3084,-1200,1805,6721 } }, { "Olympus SP550UZ", 0, 0xffe, - { 11597,-4006,-1049,-5432,12799,2957,-1029,1750,6516 } }, + { 11597,-4006,-1049,-5432,12799,2957,-1029,1750,6516 } }, { "Olympus SP560UZ", 0, 0xff9, - { 10915,-3677,-982,-5587,12986,2911,-1168,1968,6223 } }, + { 10915,-3677,-982,-5587,12986,2911,-1168,1968,6223 } }, { "Olympus SP570UZ", 0, 0, - { 11522,-4044,-1146,-4736,12172,2904,-988,1829,6039 } }, - {"Olympus STYLUS1",0, 0, - { 11976,-5518,-545,-1419,10472,846,-475,1766,4524 } }, + { 11522,-4044,-1146,-4736,12172,2904,-988,1829,6039 } }, + {"Olympus SH-2", 0, 0, + {10156,-3425,-1077,-2611,11177,1624,-385,1592,5080}}, + { "Olympus STYLUS1",0, 0, + { 11976,-5518,-545,-1419,10472,846,-475,1766,4524 } }, + {"Olympus TG-4", 0, 0, + {11426,-4159,-1126,-2066,10678,1593,-120,1327,4998}}, { "Olympus XZ-10", 0, 0, - { 9777,-3483,-925,-2886,11297,1800,-602,1663,5134 } }, + { 9777,-3483,-925,-2886,11297,1800,-602,1663,5134 } }, { "Olympus XZ-1", 0, 0, - { 10901,-4095,-1074,-1141,9208,2293,-62,1417,5158 } }, + { 10901,-4095,-1074,-1141,9208,2293,-62,1417,5158 } }, { "Olympus XZ-2", 0, 0, - { 9777,-3483,-925,-2886,11297,1800,-602,1663,5134 } }, - { "OmniVision ov5647", 0, 0, /* DJC */ - { 12782,-4059,-379,-478,9066,1413,1340,1513,5176 } }, + { 9777,-3483,-925,-2886,11297,1800,-602,1663,5134 } }, + { "OmniVision", 0, 0, /* DJC */ + { 12782,-4059,-379,-478,9066,1413,1340,1513,5176 } }, { "Pentax *ist DL2", 0, 0, - { 10504,-2438,-1189,-8603,16207,2531,-1022,863,12242 } }, + { 10504,-2438,-1189,-8603,16207,2531,-1022,863,12242 } }, { "Pentax *ist DL", 0, 0, - { 10829,-2838,-1115,-8339,15817,2696,-837,680,11939 } }, + { 10829,-2838,-1115,-8339,15817,2696,-837,680,11939 } }, { "Pentax *ist DS2", 0, 0, - { 10504,-2438,-1189,-8603,16207,2531,-1022,863,12242 } }, + { 10504,-2438,-1189,-8603,16207,2531,-1022,863,12242 } }, { "Pentax *ist DS", 0, 0, - { 10371,-2333,-1206,-8688,16231,2602,-1230,1116,11282 } }, + { 10371,-2333,-1206,-8688,16231,2602,-1230,1116,11282 } }, { "Pentax *ist D", 0, 0, - { 9651,-2059,-1189,-8881,16512,2487,-1460,1345,10687 } }, + { 9651,-2059,-1189,-8881,16512,2487,-1460,1345,10687 } }, { "Pentax K10D", 0, 0, - { 9566,-2863,-803,-7170,15172,2112,-818,803,9705 } }, + { 9566,-2863,-803,-7170,15172,2112,-818,803,9705 } }, { "Pentax K1", 0, 0, - { 11095,-3157,-1324,-8377,15834,2720,-1108,947,11688 } }, + { 11095,-3157,-1324,-8377,15834,2720,-1108,947,11688 } }, { "Pentax K20D", 0, 0, - { 9427,-2714,-868,-7493,16092,1373,-2199,3264,7180 } }, + { 9427,-2714,-868,-7493,16092,1373,-2199,3264,7180 } }, { "Pentax K200D", 0, 0, - { 9186,-2678,-907,-8693,16517,2260,-1129,1094,8524 } }, + { 9186,-2678,-907,-8693,16517,2260,-1129,1094,8524 } }, { "Pentax K2000", 0, 0, - { 11057,-3604,-1155,-5152,13046,2329,-282,375,8104 } }, + { 11057,-3604,-1155,-5152,13046,2329,-282,375,8104 } }, { "Pentax K-m", 0, 0, - { 11057,-3604,-1155,-5152,13046,2329,-282,375,8104 } }, + { 11057,-3604,-1155,-5152,13046,2329,-282,375,8104 } }, { "Pentax K-x", 0, 0, - { 8843,-2837,-625,-5025,12644,2668,-411,1234,7410 } }, + { 8843,-2837,-625,-5025,12644,2668,-411,1234,7410 } }, { "Pentax K-r", 0, 0, - { 9895,-3077,-850,-5304,13035,2521,-883,1768,6936 } }, + { 9895,-3077,-850,-5304,13035,2521,-883,1768,6936 } }, + { "Pentax K-3 II", 0, 0, + {7415,-2052,-721,-5186,12788,2682,-1446,2157,6773 } }, + { "Pentax K-3", 0, 0, + { 7415,-2052,-721,-5186,12788,2682,-1446,2157,6773 } }, { "Pentax K-5 II", 0, 0, - { 8170,-2725,-639,-4440,12017,2744,-771,1465,6599 } }, + { 8170,-2725,-639,-4440,12017,2744,-771,1465,6599 } }, { "Pentax K-5", 0, 0, - { 8713,-2833,-743,-4342,11900,2772,-722,1543,6247 } }, + { 8713,-2833,-743,-4342,11900,2772,-722,1543,6247 } }, { "Pentax K-7", 0, 0, - { 9142,-2947,-678,-8648,16967,1663,-2224,2898,8615 } }, + { 9142,-2947,-678,-8648,16967,1663,-2224,2898,8615 } }, + { "Pentax K-S1", 0, 0, + { 8512,-3211,-787,-4167,11966,2487,-638,1288,6054 } }, + { "Pentax K-S2", 0, 0, + { 8130,-2556,-1157,-3882,12350,1689,-843,1491,6305 } }, + { "Pentax Q-S1", 0, 0, + { 12995,-5593,-1107,-1879,10139,2027,-64,1233,4919 } }, { "Pentax MX-1", 0, 0, - { 8804,-2523,-1238,-2423,11627,860,-682,1774,4753 } }, + { 8804,-2523,-1238,-2423,11627,860,-682,1774,4753 } }, { "Pentax Q10", 0, 0, - { 12995,-5593,-1107,-1879,10139,2027,-64,1233,4919 } }, + { 12995,-5593,-1107,-1879,10139,2027,-64,1233,4919 } }, { "Pentax 645D", 0, 0x3e00, - { 10646,-3593,-1158,-3329,11699,1831,-667,2874,6287 } }, + { 10646,-3593,-1158,-3329,11699,1831,-667,2874,6287 } }, + { "Panasonic DMC-CM1", -15, 0, + { 8770, -3194,-820,-2871,11281,1803,-513,1552,4434 } }, { "Panasonic DMC-FZ8", 0, 0xf7f, - { 8986,-2755,-802,-6341,13575,3077,-1476,2144,6379 } }, + { 8986,-2755,-802,-6341,13575,3077,-1476,2144,6379 } }, { "Panasonic DMC-FZ18", 0, 0, - { 9932,-3060,-935,-5809,13331,2753,-1267,2155,5575 } }, - { "Panasonic DMC-FZ28", 15, 0xf96, - { 10109,-3488,-993,-5412,12812,2916,-1305,2140,5543 } }, + { 9932,-3060,-935,-5809,13331,2753,-1267,2155,5575 } }, + { "Panasonic DMC-FZ28", -15, 0xf96, + { 10109,-3488,-993,-5412,12812,2916,-1305,2140,5543 } }, + { "Panasonic DMC-FZ300", -15, 0xfff, + { 8378,-2798,-769,-3068,11410,1877,-538,1792,4623 } }, + { "Panasonic DMC-FZ330", -15, 0xfff, // same as FZ300 + { 8378,-2798,-769,-3068,11410,1877,-538,1792,4623 } }, { "Panasonic DMC-FZ30", 0, 0xf94, - { 10976,-4029,-1141,-7918,15491,2600,-1670,2071,8246 } }, - { "Panasonic DMC-FZ3", 143, 0, - { 9938,-2780,-890,-4604,12393,2480,-1117,2304,4620 } }, - { "Panasonic DMC-FZ4", 143, 0, - { 13639,-5535,-1371,-1698,9633,2430,316,1152,4108 } }, + { 10976,-4029,-1141,-7918,15491,2600,-1670,2071,8246 } }, + { "Panasonic DMC-FZ3", -15, 0, + { 9938,-2780,-890,-4604,12393,2480,-1117,2304,4620 } }, + { "Panasonic DMC-FZ4", -15, 0, + { 13639,-5535,-1371,-1698,9633,2430,316,1152,4108 } }, { "Panasonic DMC-FZ50", 0, 0, - { 7906,-2709,-594,-6231,13351,3220,-1922,2631,6537 } }, + { 7906,-2709,-594,-6231,13351,3220,-1922,2631,6537 } }, + { "Panasonic DMC-FZ7", -15, 0, + { 11532,-4324,-1066,-2375,10847,1749,-564,1699,4351 } }, { "Leica V-LUX1", 0, 0, - { 7906,-2709,-594,-6231,13351,3220,-1922,2631,6537 } }, - { "Panasonic DMC-L10", 15, 0xf96, - { 8025,-1942,-1050,-7920,15904,2100,-2456,3005,7039 } }, + { 7906,-2709,-594,-6231,13351,3220,-1922,2631,6537 } }, + { "Panasonic DMC-L10", -15, 0xf96, + { 8025,-1942,-1050,-7920,15904,2100,-2456,3005,7039 } }, { "Panasonic DMC-L1", 0, 0xf7f, - { 8054,-1885,-1025,-8349,16367,2040,-2805,3542,7629 } }, + { 8054,-1885,-1025,-8349,16367,2040,-2805,3542,7629 } }, { "Leica DIGILUX 3", 0, 0xf7f, - { 8054,-1885,-1025,-8349,16367,2040,-2805,3542,7629 } }, + { 8054,-1885,-1025,-8349,16367,2040,-2805,3542,7629 } }, { "Panasonic DMC-LC1", 0, 0, - { 11340,-4069,-1275,-7555,15266,2448,-2960,3426,7685 } }, + { 11340,-4069,-1275,-7555,15266,2448,-2960,3426,7685 } }, { "Leica DIGILUX 2", 0, 0, - { 11340,-4069,-1275,-7555,15266,2448,-2960,3426,7685 } }, - { "Panasonic DMC-LF1", 143, 0, - { 9379,-3267,-816,-3227,11560,1881,-926,1928,5340 } }, - { "Leica C", 143, 0, - { 9379,-3267,-816,-3227,11560,1881,-926,1928,5340 } }, + { 11340,-4069,-1275,-7555,15266,2448,-2960,3426,7685 } }, + { "Panasonic DMC-LX100", -15, 0, + { 8844,-3538,-768,-3709,11762,2200,-698,1792,5220 } }, + { "Leica D-LUX (Typ 109)", -15, 0, + { 8844,-3538,-768,-3709,11762,2200,-698,1792,5220 } }, + { "Panasonic DMC-LF1", -15, 0, + { 9379,-3267,-816,-3227,11560,1881,-926,1928,5340 } }, + { "Leica C (Typ 112)", -15, 0, + { 9379,-3267,-816,-3227,11560,1881,-926,1928,5340 } }, { "Panasonic DMC-LX1", 0, 0xf7f, - { 10704,-4187,-1230,-8314,15952,2501,-920,945,8927 } }, + { 10704,-4187,-1230,-8314,15952,2501,-920,945,8927 } }, + { "Leica D-Lux (Typ 109)", 0, 0xf7f, + { 8844,-3538,-768,-3709,11762,2200,-698,1792,5220 } }, { "Leica D-LUX2", 0, 0xf7f, - { 10704,-4187,-1230,-8314,15952,2501,-920,945,8927 } }, + { 10704,-4187,-1230,-8314,15952,2501,-920,945,8927 } }, { "Panasonic DMC-LX2", 0, 0, - { 8048,-2810,-623,-6450,13519,3272,-1700,2146,7049 } }, + { 8048,-2810,-623,-6450,13519,3272,-1700,2146,7049 } }, { "Leica D-LUX3", 0, 0, - { 8048,-2810,-623,-6450,13519,3272,-1700,2146,7049 } }, - { "Panasonic DMC-LX3", 15, 0, - { 8128,-2668,-655,-6134,13307,3161,-1782,2568,6083 } }, - { "Leica D-LUX 4", 15, 0, - { 8128,-2668,-655,-6134,13307,3161,-1782,2568,6083 } }, - { "Panasonic DMC-LX5", 143, 0, - { 10909,-4295,-948,-1333,9306,2399,22,1738,4582 } }, - { "Leica D-LUX 5", 143, 0, - { 10909,-4295,-948,-1333,9306,2399,22,1738,4582 } }, - { "Panasonic DMC-LX7", 143, 0, - { 10148,-3743,-991,-2837,11366,1659,-701,1893,4899 } }, - { "Leica D-LUX 6", 143, 0, - { 10148,-3743,-991,-2837,11366,1659,-701,1893,4899 } }, - { "Panasonic DMC-FZ100", 143, 0xfff, - { 16197,-6146,-1761,-2393,10765,1869,366,2238,5248 } }, - { "Leica V-LUX 2", 143, 0xfff, - { 16197,-6146,-1761,-2393,10765,1869,366,2238,5248 } }, - { "Panasonic DMC-FZ150", 143, 0xfff, - { 11904,-4541,-1189,-2355,10899,1662,-296,1586,4289 } }, - { "Leica V-LUX 3", 143, 0xfff, - { 11904,-4541,-1189,-2355,10899,1662,-296,1586,4289 } }, - { "Panasonic DMC-FZ200", 143, 0xfff, - { 8112,-2563,-740,-3730,11784,2197,-941,2075,4933 } }, - { "Leica V-LUX 4", 143, 0xfff, - { 8112,-2563,-740,-3730,11784,2197,-941,2075,4933 } }, - { "Panasonic DMC-FX150", 15, 0xfff, - { 9082,-2907,-925,-6119,13377,3058,-1797,2641,5609 } }, + { 8048,-2810,-623,-6450,13519,3272,-1700,2146,7049 } }, + { "Panasonic DMC-LX3", -15, 0, + { 8128,-2668,-655,-6134,13307,3161,-1782,2568,6083 } }, + { "Leica D-LUX 4", -15, 0, + { 8128,-2668,-655,-6134,13307,3161,-1782,2568,6083 } }, + { "Panasonic DMC-LX5", -15, 0, + { 10909,-4295,-948,-1333,9306,2399,22,1738,4582 } }, + { "Leica D-LUX 5", -15, 0, + { 10909,-4295,-948,-1333,9306,2399,22,1738,4582 } }, + { "Panasonic DMC-LX7", -15, 0, + { 10148,-3743,-991,-2837,11366,1659,-701,1893,4899 } }, + { "Leica D-LUX 6", -15, 0, + { 10148,-3743,-991,-2837,11366,1659,-701,1893,4899 } }, + { "Panasonic DMC-FZ1000", -15, 0, + { 7830,-2696,-763,-3325,11667,1866,-641,1712,4824 } }, + { "Leica V-LUX (Typ 114)", 15, 0, + { 7830,-2696,-763,-3325,11667,1866,-641,1712,4824 } }, + { "Panasonic DMC-FZ100", -15, 0xfff, + { 16197,-6146,-1761,-2393,10765,1869,366,2238,5248 } }, + { "Leica V-LUX 2", -15, 0xfff, + { 16197,-6146,-1761,-2393,10765,1869,366,2238,5248 } }, + { "Panasonic DMC-FZ150", -15, 0xfff, + { 11904,-4541,-1189,-2355,10899,1662,-296,1586,4289 } }, + { "Leica V-LUX 3", -15, 0xfff, + { 11904,-4541,-1189,-2355,10899,1662,-296,1586,4289 } }, + { "Panasonic DMC-FZ200", -15, 0xfff, + { 8112,-2563,-740,-3730,11784,2197,-941,2075,4933 } }, + { "Leica V-LUX 4", -15, 0xfff, + { 8112,-2563,-740,-3730,11784,2197,-941,2075,4933 } }, + { "Panasonic DMC-FX150", -15, 0xfff, + { 9082,-2907,-925,-6119,13377,3058,-1797,2641,5609 } }, { "Panasonic DMC-G10", 0, 0, - { 10113,-3400,-1114,-4765,12683,2317,-377,1437,6710 } }, - { "Panasonic DMC-G1", 15, 0xf94, - { 8199,-2065,-1056,-8124,16156,2033,-2458,3022,7220 } }, - { "Panasonic DMC-G2", 15, 0xf3c, - { 10113,-3400,-1114,-4765,12683,2317,-377,1437,6710 } }, - { "Panasonic DMC-G3", 143, 0xfff, - { 6763,-1919,-863,-3868,11515,2684,-1216,2387,5879 } }, - { "Panasonic DMC-G5", 143, 0xfff, - { 7798,-2562,-740,-3879,11584,2613,-1055,2248,5434 } }, - { "Panasonic DMC-G6", 143, 0xfff, /* DJC */ - { 6395,-2583,-40,-3677,9109,4569,-1502,2806,6431 } }, - { "Panasonic DMC-GF1", 15, 0xf92, - { 7888,-1902,-1011,-8106,16085,2099,-2353,2866,7330 } }, - { "Panasonic DMC-GF2", 143, 0xfff, - { 7888,-1902,-1011,-8106,16085,2099,-2353,2866,7330 } }, - { "Panasonic DMC-GF3", 143, 0xfff, - { 9051,-2468,-1204,-5212,13276,2121,-1197,2510,6890 } }, - { "Panasonic DMC-GF5", 143, 0xfff, - { 8228,-2945,-660,-3938,11792,2430,-1094,2278,5793 } }, - { "Panasonic DMC-GF6", 143, 0, - { 8130,-2801,-946,-3520,11289,2552,-1314,2511,5791 } }, - { "Panasonic DMC-GH1", 15, 0xf92, - { 6299,-1466,-532,-6535,13852,2969,-2331,3112,5984 } }, - { "Panasonic DMC-GH2", 15, 0xf95, - { 7780,-2410,-806,-3913,11724,2484,-1018,2390,5298 } }, - { "Panasonic DMC-GH3", 144, 0, - { 6559,-1752,-491,-3672,11407,2586,-962,1875,5130 } }, - { "Panasonic DMC-GM1", 143, 0, - { 8977,-3976,-425,-3050,11095,1117,-1217,2563,4750 } }, - { "Panasonic DMC-GX1", 143, 0, - { 6763,-1919,-863,-3868,11515,2684,-1216,2387,5879 } }, - {"Panasonic DMC-GX7",143,0, - {7541,-2355,-591,-3163,10598,1894,-933,2109,5006}}, + { 10113,-3400,-1114,-4765,12683,2317,-377,1437,6710 } }, + { "Panasonic DMC-G1", -15, 0xf94, + { 8199,-2065,-1056,-8124,16156,2033,-2458,3022,7220 } }, + { "Panasonic DMC-G2", -15, 0xf3c, + { 10113,-3400,-1114,-4765,12683,2317,-377,1437,6710 } }, + { "Panasonic DMC-G3", -15, 0xfff, + { 6763,-1919,-863,-3868,11515,2684,-1216,2387,5879 } }, + { "Panasonic DMC-G5", -15, 0xfff, + { 7798,-2562,-740,-3879,11584,2613,-1055,2248,5434 } }, + { "Panasonic DMC-G6", -15, 0xfff, + { 8294,-2891,-651,-3869,11590,2595,-1183,2267,5352 } }, + { "Panasonic DMC-G7", -15, 0xfff, + {7610,-2780,-576,-4614,12195,2733,-1375,2393,6490 }}, + { "Panasonic DMC-GF1", -15, 0xf92, + { 7888,-1902,-1011,-8106,16085,2099,-2353,2866,7330 } }, + { "Panasonic DMC-GF2", -15, 0xfff, + { 7888,-1902,-1011,-8106,16085,2099,-2353,2866,7330 } }, + { "Panasonic DMC-GF3", -15, 0xfff, + { 9051,-2468,-1204,-5212,13276,2121,-1197,2510,6890 } }, + { "Panasonic DMC-GF5", -15, 0xfff, + { 8228,-2945,-660,-3938,11792,2430,-1094,2278,5793 } }, + { "Panasonic DMC-GF6", -15, 0, + { 8130,-2801,-946,-3520,11289,2552,-1314,2511,5791 } }, + { "Panasonic DMC-GF7", -15, 0, + { 7610,-2780,-576,-4614,12195,2733,-1375,2393,6490 } }, + { "Panasonic DMC-GH1", -15, 0xf92, + { 6299,-1466,-532,-6535,13852,2969,-2331,3112,5984 } }, + { "Panasonic DMC-GH2", -15, 0xf95, + { 7780,-2410,-806,-3913,11724,2484,-1018,2390,5298 } }, + { "Panasonic DMC-GH3", -15, 0, + { 6559,-1752,-491,-3672,11407,2586,-962,1875,5130 } }, + { "Panasonic DMC-GH4", -15, 0, + { 7122,-2108,-512,-3155,11201,2231,-541,1423,5045 } }, + { "Panasonic DMC-GM1", -15, 0, + { 6770,-1895,-744,-5232,13145,2303,-1664,2691,5703 } }, + { "Panasonic DMC-GM5", -15, 0, + { 8238,-3244,-679,-3921,11814,2384,-836,2022,5852 } }, + { "Panasonic DMC-GX1", -15, 0, + { 6763,-1919,-863,-3868,11515,2684,-1216,2387,5879 } }, + { "Panasonic DMC-GX7", -15,0, + { 7610,-2780,-576,-4614,12195,2733,-1375,2393,6490 } }, + { "Panasonic DMC-GX8", -15,0, + { 7564,-2263,-606,-3148,11239,2177,-540,1435,4853 } }, + { "Panasonic DMC-TZ6", -15, 0, + { 8607,-2822,-808,-3755,11930,2049,-820,2060,5224 } }, + { "Panasonic DMC-ZS4", -15, 0, + { 8607,-2822,-808,-3755,11930,2049,-820,2060,5224 } }, + { "Panasonic DMC-TZ7", -15, 0, + { 8802,-3135,-789,-3151,11468,1904,-550,1745,4810 } }, + { "Panasonic DMC-ZS5", -15, 0, + { 8802,-3135,-789,-3151,11468,1904,-550,1745,4810 } }, { "Phase One H 20", 0, 0, /* DJC */ - { 1313,1855,-109,-6715,15908,808,-327,1840,6020 } }, + { 1313,1855,-109,-6715,15908,808,-327,1840,6020 } }, { "Phase One H 25", 0, 0, - { 2905,732,-237,-8134,16626,1476,-3038,4253,7517 } }, + { 2905,732,-237,-8134,16626,1476,-3038,4253,7517 } }, + { "Phase One IQ250",0, 0, + { 4396,-153,-249,-5267,12249,2657,-1397,2323,6014 } }, { "Phase One P 2", 0, 0, - { 2905,732,-237,-8134,16626,1476,-3038,4253,7517 } }, + { 2905,732,-237,-8134,16626,1476,-3038,4253,7517 } }, { "Phase One P 30", 0, 0, - { 4516,-245,-37,-7020,14976,2173,-3206,4671,7087 } }, + { 4516,-245,-37,-7020,14976,2173,-3206,4671,7087 } }, { "Phase One P 45", 0, 0, - { 5053,-24,-117,-5684,14076,1702,-2619,4492,5849 } }, + { 5053,-24,-117,-5684,14076,1702,-2619,4492,5849 } }, { "Phase One P40", 0, 0, - { 8035,435,-962,-6001,13872,2320,-1159,3065,5434 } }, + { 8035,435,-962,-6001,13872,2320,-1159,3065,5434 } }, { "Phase One P65", 0, 0, - { 8035,435,-962,-6001,13872,2320,-1159,3065,5434 } }, + { 8035,435,-962,-6001,13872,2320,-1159,3065,5434 } }, + { "Photron BC2-HD", 0, 0, /* DJC */ + { 14603,-4122,-528,-1810,9794,2017,-297,2763,5936 } }, { "Red One", 704, 0xffff, /* DJC */ - { 21014,-7891,-2613,-3056,12201,856,-2203,5125,8042 } }, + { 21014,-7891,-2613,-3056,12201,856,-2203,5125,8042 } }, { "Samsung EK-GN120", 0, 0, /* Adobe; Galaxy NX */ - { 7557,-2522,-739,-4679,12949,1894,-840,1777,5311 } }, + { 7557,-2522,-739,-4679,12949,1894,-840,1777,5311 } }, { "Samsung EX1", 0, 0x3e00, - { 8898,-2498,-994,-3144,11328,2066,-760,1381,4576 } }, + { 8898,-2498,-994,-3144,11328,2066,-760,1381,4576 } }, { "Samsung EX2F", 0, 0x7ff, - { 10648,-3897,-1055,-2022,10573,1668,-492,1611,4742 } }, - { "Samsung NX300", 0, 0, - { 8873,-3984,-372,-3759,12305,1013,-994,1981,4788 } }, + { 10648,-3897,-1055,-2022,10573,1668,-492,1611,4742 } }, + { "Samsung NX mini", 0, 0, + { 5222,-1196,-550,-6540,14649,2009,-1666,2819,5657 } }, + { "Samsung NX3000", 0, 0, + { 8060,-2933,-761,-4504,12890,1762,-630,1489,5227 } }, + { "Samsung NX30", 0, 0, /* NX30, NX300, NX300M */ + { 7557,-2522,-739,-4679,12949,1894,-840,1777,5311 } }, { "Samsung NX2000", 0, 0, - { 7557,-2522,-739,-4679,12949,1894,-840,1777,5311 } }, + { 7557,-2522,-739,-4679,12949,1894,-840,1777,5311 } }, { "Samsung NX2", 0, 0xfff, /* NX20, NX200, NX210 */ - { 6933,-2268,-753,-4921,13387,1647,-803,1641,6096 } }, + { 6933,-2268,-753,-4921,13387,1647,-803,1641,6096 } }, { "Samsung NX1000", 0, 0, - { 6933,-2268,-753,-4921,13387,1647,-803,1641,6096 } }, + { 6933,-2268,-753,-4921,13387,1647,-803,1641,6096 } }, { "Samsung NX1100", 0, 0, - { 6933,-2268,-753,-4921,13387,1647,-803,1641,6096 } }, - { "Samsung NX", 0, 0, /* NX5, NX10, NX11, NX100 */ + { 6933,-2268,-753,-4921,13387,1647,-803,1641,6096 } }, + { "Samsung NX11", 0, 0, + { 10332,-3234,-1168,-6111,14639,1520,-1352,2647,8331 } }, + { "Samsung NX10", 0, 0, /* also NX100 */ + { 10332,-3234,-1168,-6111,14639,1520,-1352,2647,8331 } }, + { "Samsung NX500", 0, 0, + { 10686,-4042,-1052,-3595,13238,276,-464,1259,5931 } }, + { "Samsung NX5", 0, 0, { 10332,-3234,-1168,-6111,14639,1520,-1352,2647,8331 } }, + { "Samsung NX1", 0, 0, + { 10686,-4042,-1052,-3595,13238,276,-464,1259,5931 } }, { "Samsung WB2000", 0, 0xfff, - { 12093,-3557,-1155,-1000,9534,1733,-22,1787,4576 } }, + { 12093,-3557,-1155,-1000,9534,1733,-22,1787,4576 } }, { "Samsung GX-1", 0, 0, - { 10504,-2438,-1189,-8603,16207,2531,-1022,863,12242 } }, + { 10504,-2438,-1189,-8603,16207,2531,-1022,863,12242 } }, + { "Samsung GX20", 0, 0, /* copied from Pentax K20D */ + { 9427,-2714,-868,-7493,16092,1373,-2199,3264,7180 } }, { "Samsung S85", 0, 0, /* DJC */ - { 11885,-3968,-1473,-4214,12299,1916,-835,1655,5549 } }, + { 11885,-3968,-1473,-4214,12299,1916,-835,1655,5549 } }, // Foveon: LibRaw color data + { "Sigma dp0 Quattro", 2047, 0, + { 13801,-3390,-1016,5535,3802,877,1848,4245,3730 } }, + { "Sigma dp1 Quattro", 2047, 0, + { 13801,-3390,-1016,5535,3802,877,1848,4245,3730 } }, + { "Sigma dp2 Quattro", 2047, 0, + { 13801,-3390,-1016,5535,3802,877,1848,4245,3730 } }, + { "Sigma dp3 Quattro", 2047, 0, + { 13801,-3390,-1016,5535,3802,877,1848,4245,3730 } }, { "Sigma SD9", 15, 4095, /* LibRaw */ - { 14082,-2201,-1056,-5243,14788,167,-121,196,8881 } }, - //{ 7401,-1169,-567,2059,3769,1510,664,3367,5328 } }, + { 14082,-2201,-1056,-5243,14788,167,-121,196,8881 } }, { "Sigma SD10", 15, 16383, /* LibRaw */ - { 14082,-2201,-1056,-5243,14788,167,-121,196,8881 } }, - //{ 7401,-1169,-567,2059,3769,1510,664,3367,5328 } }, + { 14082,-2201,-1056,-5243,14788,167,-121,196,8881 } }, { "Sigma SD14", 15, 16383, /* LibRaw */ - { 14082,-2201,-1056,-5243,14788,167,-121,196,8881 } }, - //{ 7401,-1169,-567,2059,3769,1510,664,3367,5328 } }, + { 14082,-2201,-1056,-5243,14788,167,-121,196,8881 } }, { "Sigma SD15", 15, 4095, /* LibRaw */ - { 14082,-2201,-1056,-5243,14788,167,-121,196,8881 } }, - //{ 7401,-1169,-567,2059,3769,1510,664,3367,5328 } }, + { 14082,-2201,-1056,-5243,14788,167,-121,196,8881 } }, // Merills + SD1 { "Sigma SD1", 31, 4095, /* LibRaw */ - { 5133,-1895,-353,4978,744,144,3837,3069,2777 } }, + { 5133,-1895,-353,4978,744,144,3837,3069,2777 } }, { "Sigma DP1 Merrill", 31, 4095, /* LibRaw */ - { 5133,-1895,-353,4978,744,144,3837,3069,2777 } }, + { 5133,-1895,-353,4978,744,144,3837,3069,2777 } }, { "Sigma DP2 Merrill", 31, 4095, /* LibRaw */ - { 5133,-1895,-353,4978,744,144,3837,3069,2777 } }, + { 5133,-1895,-353,4978,744,144,3837,3069,2777 } }, { "Sigma DP3 Merrill", 31, 4095, /* LibRaw */ - { 5133,-1895,-353,4978,744,144,3837,3069,2777 } }, + { 5133,-1895,-353,4978,744,144,3837,3069,2777 } }, // Sigma DP (non-Merill Versions) { "Sigma DP", 0, 4095, /* LibRaw */ // { 7401,-1169,-567,2059,3769,1510,664,3367,5328 } }, - { 13100,-3638,-847,6855,2369,580,2723,3218,3251 } }, + { 13100,-3638,-847,6855,2369,580,2723,3218,3251 } }, { "Sinar", 0, 0, /* DJC */ - { 16442,-2956,-2422,-2877,12128,750,-1136,6066,4559 } }, + { 16442,-2956,-2422,-2877,12128,750,-1136,6066,4559 } }, { "Sony DSC-F828", 0, 0, - { 7924,-1910,-777,-8226,15459,2998,-1517,2199,6818,-7242,11401,3481 } }, + { 7924,-1910,-777,-8226,15459,2998,-1517,2199,6818,-7242,11401,3481 } }, { "Sony DSC-R1", -512, 0, - { 8512,-2641,-694,-8042,15670,2526,-1821,2117,7414 } }, + { 8512,-2641,-694,-8042,15670,2526,-1821,2117,7414 } }, { "Sony DSC-V3", 0, 0, - { 7511,-2571,-692,-7894,15088,3060,-948,1111,8128 } }, - { "Sony DSC-RX100M2", -200, 0, - { 8651,-2754,-1057,-3464,12207,1373,-568,1398,4434 } }, - { "Sony DSC-RX100", -200, 0, - { 8651,-2754,-1057,-3464,12207,1373,-568,1398,4434 } }, - {"Sony DSC-RX10",0, 0, - { 8562,-3595,-385,-2715,11089,1128,-1023,2081,4400 } }, - { "Sony DSC-RX1R", -128, 0, - { 8195,-2800,-422,-4261,12273,1709,-1505,2400,5624 } }, - { "Sony DSC-RX1", -128, 0, - { 6344,-1612,-462,-4863,12477,2681,-865,1786,6899 } }, + { 7511,-2571,-692,-7894,15088,3060,-948,1111,8128 } }, + { "Sony DSC-RX100M", -800, 0, /* M2 and M3 and M4 */ + { 6596,-2079,-562,-4782,13016,1933,-970,1581,5181 } }, + { "Sony DSC-RX100", -800, 0, + { 8651,-2754,-1057,-3464,12207,1373,-568,1398,4434 } }, + { "Sony DSC-RX10",0, 0, + { 6679,-1825,-745,-5047,13256,1953,-1580,2422,5183 } }, + { "Sony DSC-RX1R", -512, 0, + { 8195,-2800,-422,-4261,12273,1709,-1505,2400,5624 } }, + { "Sony DSC-RX1", -512, 0, + { 6344,-1612,-462,-4863,12477,2681,-865,1786,6899 } }, { "Sony DSLR-A100", 0, 0xfeb, - { 9437,-2811,-774,-8405,16215,2290,-710,596,7181 } }, + { 9437,-2811,-774,-8405,16215,2290,-710,596,7181 } }, { "Sony DSLR-A290", 0, 0, - { 6038,-1484,-579,-9145,16746,2512,-875,746,7218 } }, + { 6038,-1484,-579,-9145,16746,2512,-875,746,7218 } }, { "Sony DSLR-A2", 0, 0, - { 9847,-3091,-928,-8485,16345,2225,-715,595,7103 } }, + { 9847,-3091,-928,-8485,16345,2225,-715,595,7103 } }, { "Sony DSLR-A300", 0, 0, - { 9847,-3091,-928,-8485,16345,2225,-715,595,7103 } }, + { 9847,-3091,-928,-8485,16345,2225,-715,595,7103 } }, { "Sony DSLR-A330", 0, 0, - { 9847,-3091,-929,-8485,16346,2225,-714,595,7103 } }, + { 9847,-3091,-929,-8485,16346,2225,-714,595,7103 } }, { "Sony DSLR-A350", 0, 0xffc, - { 6038,-1484,-578,-9146,16746,2513,-875,746,7217 } }, + { 6038,-1484,-578,-9146,16746,2513,-875,746,7217 } }, { "Sony DSLR-A380", 0, 0, - { 6038,-1484,-579,-9145,16746,2512,-875,746,7218 } }, + { 6038,-1484,-579,-9145,16746,2512,-875,746,7218 } }, { "Sony DSLR-A390", 0, 0, - { 6038,-1484,-579,-9145,16746,2512,-875,746,7218 } }, - { "Sony DSLR-A450", -128, 0xfeb, - { 4950,-580,-103,-5228,12542,3029,-709,1435,7371 } }, - { "Sony DSLR-A580", -128, 0xfeb, - { 5932,-1492,-411,-4813,12285,2856,-741,1524,6739 } }, - { "Sony DSLR-A5", -128, 0xfeb, - { 4950,-580,-103,-5228,12542,3029,-709,1435,7371 } }, - { "Sony DSLR-A700", -128, 0, - { 5775,-805,-359,-8574,16295,2391,-1943,2341,7249 } }, - { "Sony DSLR-A850", -128, 0, - { 5413,-1162,-365,-5665,13098,2866,-608,1179,8440 } }, - { "Sony DSLR-A900", -128, 0, - { 5209,-1072,-397,-8845,16120,2919,-1618,1803,8654 } }, - {"Sony ILCE-3000",-128, 0, - { 14009,-8208,729,3738,4752,2932,5743,-3800,6494 } }, - {"Sony ILCE-A7R",-128, 0, - { 8592,-3219,-348,-3846,12042,1475,-1079,2166,5893 } }, - {"Sony ILCE-A7",-128, 0, - { 8592,-3219,-348,-3846,12042,1475,-1079,2166,5893 } }, - { "Sony NEX-5T", -128, 0, - { 7623,-2693,-347,-4060,11875,1928,-1363,2329,5752 } }, - { "Sony NEX-5N", -128, 0, - { 5991,-1456,-455,-4764,12135,2980,-707,1425,6701 } }, - { "Sony NEX-5R", -128, 0, - { 6129,-1545,-418,-4930,12490,2743,-977,1693,6615 } }, - { "Sony NEX-3N", -128, 0, - { 6129,-1545,-418,-4930,12490,2743,-977,1693,6615 } }, - { "Sony NEX-3", -128, 0, /* Adobe */ - { 6549,-1550,-436,-4880,12435,2753,-854,1868,6976 } }, - { "Sony NEX-5", -128, 0, /* Adobe */ - { 6549,-1550,-436,-4880,12435,2753,-854,1868,6976 } }, - { "Sony NEX-6", -128, 0, - { 6129,-1545,-418,-4930,12490,2743,-977,1693,6615 } }, - { "Sony NEX-7", -128, 0, - { 5491,-1192,-363,-4951,12342,2948,-911,1722,7192 } }, - { "Sony NEX", -128, 0, /* NEX-C3, NEX-F3 */ - { 5991,-1456,-455,-4764,12135,2980,-707,1425,6701 } }, - { "Sony SLT-A33", -128, 0, - { 6069,-1221,-366,-5221,12779,2734,-1024,2066,6834 } }, - { "Sony SLT-A35", -128, 0, - { 5986,-1618,-415,-4557,11820,3120,-681,1404,6971 } }, - { "Sony SLT-A37", -128, 0, - { 5991,-1456,-455,-4764,12135,2980,-707,1425,6701 } }, - { "Sony SLT-A55", -128, 0, - { 5932,-1492,-411,-4813,12285,2856,-741,1524,6739 } }, - { "Sony SLT-A57", -128, 0, - { 5991,-1456,-455,-4764,12135,2980,-707,1425,6701 } }, - { "Sony SLT-A58", -128, 0, - { 5991,-1456,-455,-4764,12135,2980,-707,1425,6701 } }, - { "Sony SLT-A65", -128, 0, - { 5491,-1192,-363,-4951,12342,2948,-911,1722,7192 } }, - { "Sony SLT-A77", -128, 0, - { 5491,-1192,-363,-4951,12342,2948,-911,1722,7192 } }, - { "Sony SLT-A99", -128, 0, - { 6344,-1612,-462,-4863,12477,2681,-865,1786,6899 } }, + { 6038,-1484,-579,-9145,16746,2512,-875,746,7218 } }, + { "Sony DSLR-A450", -512, 0xfeb, + { 4950,-580,-103,-5228,12542,3029,-709,1435,7371 } }, + { "Sony DSLR-A580", -512, 0xfeb, + { 5932,-1492,-411,-4813,12285,2856,-741,1524,6739 } }, + { "Sony DSLR-A500", -512, 0xfeb, + { 6046,-1127,-278,-5574,13076,2786,-691,1419,7625 } }, + { "Sony DSLR-A5", -512, 0xfeb, + { 4950,-580,-103,-5228,12542,3029,-709,1435,7371 } }, + { "Sony DSLR-A700", -512, 0, + { 5775,-805,-359,-8574,16295,2391,-1943,2341,7249 } }, + { "Sony DSLR-A850", -512, 0, + { 5413,-1162,-365,-5665,13098,2866,-608,1179,8440 } }, + { "Sony DSLR-A900", -512, 0, + { 5209,-1072,-397,-8845,16120,2919,-1618,1803,8654 } }, + { "Sony ILCA-77M2", -512, 0, + { 5991,-1732,-443,-4100,11989,2381,-704,1467,5992 } }, + { "Sony ILCE-7M2", -512, 0, + { 5271,-712,-347,-6153,13653,2763,-1601,2366,7242 } }, + { "Sony ILCE-7S", -512, 0, + { 5838,-1430,-246,-3497,11477,2297,-748,1885,5778 } }, + { "Sony ILCE-7RM2", -512, 0, + { 6629,-1900,-483,-4618,12349,2550,-622,1381,6514 } }, + { "Sony ILCE-7R", -512, 0, + { 4913,-541,-202,-6130,13513,2906,-1564,2151,7183 } }, + { "Sony ILCE-7", -512, 0, + { 5271,-712,-347,-6153,13653,2763,-1601,2366,7242 } }, + { "Sony ILCE", -512, 0, /* 3000, 5000, 5100, 6000, and QX1 */ + { 5991,-1456,-455,-4764,12135,2980,-707,1425,6701 } }, + { "Sony NEX-5N", -512, 0, + { 5991,-1456,-455,-4764,12135,2980,-707,1425,6701 } }, + { "Sony NEX-5R", -512, 0, + { 6129,-1545,-418,-4930,12490,2743,-977,1693,6615 } }, + { "Sony NEX-5T", -512, 0, + { 6129,-1545,-418,-4930,12490,2743,-977,1693,6615 } }, + { "Sony NEX-3N", -512, 0, + { 6129,-1545,-418,-4930,12490,2743,-977,1693,6615 } }, + { "Sony NEX-3", -512, 0, /* Adobe */ + { 6549,-1550,-436,-4880,12435,2753,-854,1868,6976 } }, + { "Sony NEX-5", -512, 0, /* Adobe */ + { 6549,-1550,-436,-4880,12435,2753,-854,1868,6976 } }, + { "Sony NEX-6", -512, 0, + { 6129,-1545,-418,-4930,12490,2743,-977,1693,6615 } }, + { "Sony NEX-7", -512, 0, + { 5491,-1192,-363,-4951,12342,2948,-911,1722,7192 } }, + { "Sony NEX", -512, 0, /* NEX-C3, NEX-F3 */ + { 5991,-1456,-455,-4764,12135,2980,-707,1425,6701 } }, + { "Sony SLT-A33", -512, 0, + { 6069,-1221,-366,-5221,12779,2734,-1024,2066,6834 } }, + { "Sony SLT-A35", -512, 0, + { 5986,-1618,-415,-4557,11820,3120,-681,1404,6971 } }, + { "Sony SLT-A37", -512, 0, + { 5991,-1456,-455,-4764,12135,2980,-707,1425,6701 } }, + { "Sony SLT-A55", -512, 0, + { 5932,-1492,-411,-4813,12285,2856,-741,1524,6739 } }, + { "Sony SLT-A57", -512, 0, + { 5991,-1456,-455,-4764,12135,2980,-707,1425,6701 } }, + { "Sony SLT-A58", -512, 0, + { 5991,-1456,-455,-4764,12135,2980,-707,1425,6701 } }, + { "Sony SLT-A65", -512, 0, + { 5491,-1192,-363,-4951,12342,2948,-911,1722,7192 } }, + { "Sony SLT-A77", -512, 0, + { 5491,-1192,-363,-4951,12342,2948,-911,1722,7192 } }, + { "Sony SLT-A99", -512, 0, + { 6344,-1612,-462,-4863,12477,2681,-865,1786,6899 } }, }; double cam_xyz[4][3]; char name[130]; int i, j; + if(colors>4 || colors < 1) return; + + int bl4=(cblack[0]+cblack[1]+cblack[2]+cblack[3])/4,bl64=0; + if(cblack[4]*cblack[5]>0) + { + for (unsigned c = 0; c < 4096 && c < cblack[4]*cblack[5]; c++) + bl64+=cblack[c+6]; + bl64 /= cblack[4]*cblack[5]; + } + int rblack = black+bl4+bl64; + sprintf (name, "%s %s", t_make, t_model); for (i=0; i < sizeof table / sizeof *table; i++) if (!strncasecmp(name, table[i].prefix, strlen(table[i].prefix))) { - if (table[i].t_black>0) black = (ushort) table[i].t_black; - else if(table[i].t_black <0 && black == 0 ) black = (ushort) (-table[i].t_black); + if (table[i].t_black>0) + { + black = (ushort) table[i].t_black; + memset(cblack,0,sizeof(cblack)); + } + else if(table[i].t_black <0 && rblack == 0 ) + { + black = (ushort) (-table[i].t_black); + memset(cblack,0,sizeof(cblack)); + } if (table[i].t_maximum) maximum = (ushort) table[i].t_maximum; if (table[i].trans[0]) { - for (j=0; j < 12; j++) + for (raw_color = j=0; j < 12; j++) #ifdef LIBRAW_LIBRARY_BUILD - imgdata.color.cam_xyz[0][j] = + if(internal_only) + imgdata.color.cam_xyz[0][j] = table[i].trans[j] / 10000.0; + else + imgdata.color.cam_xyz[0][j] = #endif - cam_xyz[0][j] = table[i].trans[j] / 10000.0; - cam_xyz_coeff (cam_xyz); + ((double*)cam_xyz)[j] = table[i].trans[j] / 10000.0; +#ifdef LIBRAW_LIBRARY_BUILD + if(!internal_only) +#endif + cam_xyz_coeff (rgb_cam, cam_xyz); } break; } @@ -8923,13 +13074,13 @@ { 4508, 2962, 0, 0, -3, -4 }, { 4508, 3330, 0, 0, -3, -6 }, }; - static const ushort canon[][6] = { + static const ushort canon[][11] = { { 1944, 1416, 0, 0, 48, 0 }, - { 2144, 1560, 4, 8, 52, 2 }, + { 2144, 1560, 4, 8, 52, 2, 0, 0, 0, 25 }, { 2224, 1456, 48, 6, 0, 2 }, { 2376, 1728, 12, 6, 52, 2 }, { 2672, 1968, 12, 6, 44, 2 }, - { 3152, 2068, 64, 12, 0, 0 }, + { 3152, 2068, 64, 12, 0, 0, 16 }, { 3160, 2344, 44, 12, 4, 4 }, { 3344, 2484, 4, 6, 52, 6 }, { 3516, 2328, 42, 14, 0, 0 }, @@ -8937,107 +13088,146 @@ { 3744, 2784, 52, 12, 8, 12 }, { 3944, 2622, 30, 18, 6, 2 }, { 3948, 2622, 42, 18, 0, 2 }, - { 3984, 2622, 76, 20, 0, 2 }, + { 3984, 2622, 76, 20, 0, 2, 14 }, { 4104, 3048, 48, 12, 24, 12 }, { 4116, 2178, 4, 2, 0, 0 }, { 4152, 2772, 192, 12, 0, 0 }, { 4160, 3124, 104, 11, 8, 65 }, - { 4176, 3062, 96, 17, 8, 0 }, + { 4176, 3062, 96, 17, 8, 0, 0, 16, 0, 7, 0x49 }, + { 4192, 3062, 96, 17, 24, 0, 0, 16, 0, 0, 0x49 }, { 4312, 2876, 22, 18, 0, 2 }, { 4352, 2874, 62, 18, 0, 0 }, { 4476, 2954, 90, 34, 0, 0 }, - { 4480, 3348, 12, 10, 36, 12 }, + { 4480, 3348, 12, 10, 36, 12, 0, 0, 0, 18, 0x49 }, + { 4480, 3366, 80, 50, 0, 0 }, { 4496, 3366, 80, 50, 12, 0 }, + { 4768, 3516, 96, 16, 0, 0, 0, 16 }, { 4832, 3204, 62, 26, 0, 0 }, { 4832, 3228, 62, 51, 0, 0 }, { 5108, 3349, 98, 13, 0, 0 }, { 5120, 3318, 142, 45, 62, 0 }, - { 5280, 3528, 72, 52, 0, 0 }, + { 5280, 3528, 72, 52, 0, 0 }, /* EOS M */ { 5344, 3516, 142, 51, 0, 0 }, { 5344, 3584, 126,100, 0, 2 }, { 5360, 3516, 158, 51, 0, 0 }, { 5568, 3708, 72, 38, 0, 0 }, + { 5632, 3710, 96, 17, 0, 0, 0, 16, 0, 0, 0x49 }, { 5712, 3774, 62, 20, 10, 2 }, { 5792, 3804, 158, 51, 0, 0 }, { 5920, 3950, 122, 80, 2, 0 }, + { 6096, 4056, 72, 34, 0, 0 }, /* EOS M3 */ + { 8896, 5920, 160, 64, 0, 0 }, }; static const struct { ushort id; char t_model[20]; } unique[] = { - { 0x168, "EOS 10D" }, { 0x001, "EOS-1D" }, - { 0x175, "EOS 20D" }, { 0x174, "EOS-1D Mark II" }, - { 0x234, "EOS 30D" }, { 0x232, "EOS-1D Mark II N" }, - { 0x190, "EOS 40D" }, { 0x169, "EOS-1D Mark III" }, - { 0x261, "EOS 50D" }, { 0x281, "EOS-1D Mark IV" }, - { 0x287, "EOS 60D" }, { 0x167, "EOS-1DS" }, - { 0x170, "EOS 300D" }, { 0x188, "EOS-1Ds Mark II" }, - { 0x176, "EOS 450D" }, { 0x215, "EOS-1Ds Mark III" }, - { 0x189, "EOS 350D" }, { 0x324, "EOS-1D C" }, - { 0x236, "EOS 400D" }, { 0x269, "EOS-1D X" }, - { 0x252, "EOS 500D" }, { 0x213, "EOS 5D" }, - { 0x270, "EOS 550D" }, { 0x218, "EOS 5D Mark II" }, - { 0x286, "EOS 600D" }, { 0x285, "EOS 5D Mark III" }, - { 0x301, "EOS 650D" }, { 0x302, "EOS 6D" }, - { 0x325, "EOS 70D" }, { 0x326, "EOS 700D" }, { 0x250, "EOS 7D" }, + { 0x001, "EOS-1D" }, + { 0x167, "EOS-1DS" }, + { 0x168, "EOS 10D" }, + { 0x169, "EOS-1D Mark III" }, + { 0x170, "EOS 300D" }, + { 0x174, "EOS-1D Mark II" }, + { 0x175, "EOS 20D" }, + { 0x176, "EOS 450D" }, + { 0x188, "EOS-1Ds Mark II" }, + { 0x189, "EOS 350D" }, + { 0x190, "EOS 40D" }, + { 0x213, "EOS 5D" }, + { 0x215, "EOS-1Ds Mark III" }, + { 0x218, "EOS 5D Mark II" }, + { 0x232, "EOS-1D Mark II N" }, + { 0x234, "EOS 30D" }, + { 0x236, "EOS 400D" }, + { 0x250, "EOS 7D" }, + { 0x252, "EOS 500D" }, { 0x254, "EOS 1000D" }, + { 0x261, "EOS 50D" }, + { 0x269, "EOS-1D X" }, + { 0x270, "EOS 550D" }, + { 0x281, "EOS-1D Mark IV" }, + { 0x285, "EOS 5D Mark III" }, + { 0x286, "EOS 600D" }, + { 0x287, "EOS 60D" }, { 0x288, "EOS 1100D" }, - { 0x346, "EOS 100D" }, + { 0x289, "EOS 7D Mark II" }, + { 0x301, "EOS 650D" }, + { 0x302, "EOS 6D" }, + { 0x324, "EOS-1D C" }, + { 0x325, "EOS 70D" }, + { 0x326, "EOS 700D" }, + { 0x327, "EOS 1200D" }, { 0x331, "EOS M" }, + { 0x335, "EOS M2" }, + { 0x374, "EOS M3"}, /* temp */ + { 0x346, "EOS 100D" }, + { 0x347, "EOS 760D" }, + { 0x382, "EOS 5DS" }, + { 0x393, "EOS 750D" }, + { 0x401, "EOS 5DS R" }, + }, sonique[] = { + { 0x002, "DSC-R1" }, + { 0x100, "DSLR-A100" }, + { 0x101, "DSLR-A900" }, + { 0x102, "DSLR-A700" }, + { 0x103, "DSLR-A200" }, + { 0x104, "DSLR-A350" }, + { 0x105, "DSLR-A300" }, + { 0x106, "DSLR-A900" }, + { 0x107, "DSLR-A380" }, + { 0x108, "DSLR-A330" }, + { 0x109, "DSLR-A230" }, + { 0x10a, "DSLR-A290" }, + { 0x10d, "DSLR-A850" }, + { 0x10e, "DSLR-A850" }, + { 0x111, "DSLR-A550" }, + { 0x112, "DSLR-A500" }, + { 0x113, "DSLR-A450" }, + { 0x116, "NEX-5" }, + { 0x117, "NEX-3" }, + { 0x118, "SLT-A33" }, + { 0x119, "SLT-A55V" }, + { 0x11a, "DSLR-A560" }, + { 0x11b, "DSLR-A580" }, + { 0x11c, "NEX-C3" }, + { 0x11d, "SLT-A35" }, + { 0x11e, "SLT-A65V" }, + { 0x11f, "SLT-A77V" }, + { 0x120, "NEX-5N" }, + { 0x121, "NEX-7" }, + { 0x122, "NEX-VG20E"}, + { 0x123, "SLT-A37" }, + { 0x124, "SLT-A57" }, + { 0x125, "NEX-F3" }, + { 0x126, "SLT-A99V" }, + { 0x127, "NEX-6" }, + { 0x128, "NEX-5R" }, + { 0x129, "DSC-RX100" }, + { 0x12a, "DSC-RX1" }, + { 0x12b, "NEX-VG900" }, + { 0x12c, "NEX-VG30E" }, + { 0x12e, "ILCE-3000" }, + { 0x12f, "SLT-A58" }, + { 0x131, "NEX-3N" }, + { 0x132, "ILCE-7" }, + { 0x133, "NEX-5T" }, + { 0x134, "DSC-RX100M2" }, + { 0x135, "DSC-RX10" }, + { 0x136, "DSC-RX1R" }, + { 0x137, "ILCE-7R" }, + { 0x138, "ILCE-6000" }, + { 0x139, "ILCE-5000" }, + { 0x13d, "DSC-RX100M3" }, + { 0x13e, "ILCE-7S" }, + { 0x13f, "ILCA-77M2" }, + { 0x153, "ILCE-5100" }, + { 0x154, "ILCE-7M2" }, + { 0x155, "DSC-RX100M4" }, + { 0x156, "DSC-RX10M2" }, + { 0x15a, "ILCE-QX1" }, + { 0x15b, "ILCE-7RM2" }, }; - static const struct { - ushort id; - char t_model[20]; - } sony_unique[] = { - {2,"DSC-R1"}, - {256,"DSLR-A100"}, - {257,"DSLR-A900"}, - {258,"DSLR-A700"}, - {259,"DSLR-A200"}, - {260,"DSLR-A350"}, - {261,"DSLR-A300"}, - {262,"DSLR-A900"}, - {263,"DSLR-A380"}, - {264,"DSLR-A330"}, - {265,"DSLR-A230"}, - {266,"DSLR-A290"}, - {269,"DSLR-A850"}, - {270,"DSLR-A850"}, - {273,"DSLR-A550"}, - {274,"DSLR-A500"}, - {275,"DSLR-A450"}, - {278,"NEX-5"}, - {279,"NEX-3"}, - {280,"SLT-A33"}, - {281,"SLT-A55"}, - {282,"DSLR-A560"}, - {283,"DSLR-A580"}, - {284,"NEX-C3"}, - {285,"SLT-A35"}, - {286,"SLT-A65"}, - {287,"SLT-A77"}, - {288,"NEX-5N"}, - {289,"NEX-7"}, - {290,"NEX-VG20E"}, - {291,"SLT-A37"}, - {292,"SLT-A57"}, - {293,"NEX-F3"}, - {294,"SLT-A99"}, - {295,"NEX-6"}, - {296,"NEX-5R"}, - {297,"DSC-RX100"}, - {298,"DSC-RX1"}, - {299,"NEX-VG900"}, - {300,"NEX-VG30E"}, - {302,"ILCE-3000"}, - {303,"SLT-A58"}, - {305,"NEX-3N"}, - {306,"ILCE-A7"}, - {307,"NEX-5T"}, - {308,"DSC-RX100M2"}, - {310,"DSC-RX1R"}, - {311,"ILCE-A7R"}, - }; + static const struct { unsigned fsize; ushort rw, rh; @@ -9054,6 +13244,18 @@ { 10134620,2588,1958, 0, 0, 0, 0, 9,0x94,0,0,"AVT","F-510C",12 }, { 16157136,3272,2469, 0, 0, 0, 0, 9,0x94,0,0,"AVT","F-810C" }, { 15980544,3264,2448, 0, 0, 0, 0, 8,0x61,0,1,"AgfaPhoto","DC-833m" }, + { 9631728,2532,1902, 0, 0, 0, 0,96,0x61,0,0,"Alcatel","5035D" }, + +// Android Raw dumps id start +// File Size in bytes Horizontal Res Vertical Flag then bayer order eg 0x16 bbgr 0x94 rggb + { 16424960,4208,3120, 0, 0, 0, 0, 1,0x16,0,0,"Sony","IMX135-mipi 13mp" }, + { 17522688,4212,3120, 0, 0, 0, 0, 0,0x16,0,0,"Sony","IMX135-QCOM" }, + { 10223360,2608,1960, 0, 0, 0, 0, 1,0x94,0,0,"Sony","IMX072-mipi" }, + { 5107712,2688,1520, 0, 0, 0, 0, 1,0x61,0,0,"HTC","UltraPixel" }, + { 1540857,2688,1520, 0, 0, 0, 0, 1,0x61,0,0,"Samsung","S3" }, + { 10223363,2688,1520, 0, 0, 0, 0, 1,0x61,0,0,"Samsung","GalaxyNexus" }, + // Android Raw dumps id end + { 2868726,1384,1036, 0, 0, 0, 0,64,0x49,0,8,"Baumer","TXG14",1078 }, { 5298000,2400,1766,12,12,44, 2,40,0x94,0,2,"Canon","PowerShot SD300" }, { 6553440,2664,1968, 4, 4,44, 4,40,0x94,0,2,"Canon","PowerShot A460" }, @@ -9069,7 +13271,7 @@ { 15467760,3720,2772, 6,12,30, 0,40,0x94,0,2,"Canon","PowerShot SX110 IS" }, { 15534576,3728,2778,12, 9,44, 9,40,0x94,0,2,"Canon","PowerShot SX120 IS" }, { 18653760,4080,3048,24,12,24,12,40,0x94,0,2,"Canon","PowerShot SX20 IS" }, - { 19131120,4168,3060,92,16, 4, 1, 8,0x94,0,2,"Canon","PowerShot SX220 HS" }, + { 19131120,4168,3060,92,16, 4, 1,40,0x94,0,2,"Canon","PowerShot SX220 HS" }, { 21936096,4464,3276,25,10,73,12,40,0x16,0,2,"Canon","PowerShot SX30 IS" }, { 24724224,4704,3504, 8,16,56, 8,40,0x49,0,2,"Canon","PowerShot A3300 IS" }, { 1976352,1632,1211, 0, 2, 0, 1, 0,0x94,0,1,"Casio","QV-2000UX" }, @@ -9094,18 +13296,26 @@ { 18702336,4096,3044, 0, 0,24, 0,80,0x94,7,1,"Casio","EX-ZR100" }, { 7684000,2260,1700, 0, 0, 0, 0,13,0x94,0,1,"Casio","QV-4000" }, { 787456,1024, 769, 0, 1, 0, 0, 0,0x49,0,0,"Creative","PC-CAM 600" }, + { 28829184,4384,3288, 0, 0, 0, 0,36,0x61,0,0,"DJI" }, + { 15151104,4608,3288, 0, 0, 0, 0, 0,0x94,0,0,"Matrix" }, { 3840000,1600,1200, 0, 0, 0, 0,65,0x49,0,0,"Foculus","531C" }, - { 307200, 640, 480, 0, 0, 0, 0, 0,0x94,0,0,"Generic","640x480" }, + { 307200, 640, 480, 0, 0, 0, 0, 0,0x94,0,0,"Generic" }, { 62464, 256, 244, 1, 1, 6, 1, 0,0x8d,0,0,"Kodak","DC20" }, { 124928, 512, 244, 1, 1,10, 1, 0,0x8d,0,0,"Kodak","DC20" }, { 1652736,1536,1076, 0,52, 0, 0, 0,0x61,0,0,"Kodak","DCS200" }, { 4159302,2338,1779, 1,33, 1, 2, 0,0x94,0,0,"Kodak","C330" }, { 4162462,2338,1779, 1,33, 1, 2, 0,0x94,0,0,"Kodak","C330",3160 }, + { 2247168,1232, 912, 0, 0,16, 0, 0,0x00,0,0,"Kodak","C330" }, + { 3370752,1232, 912, 0, 0,16, 0, 0,0x00,0,0,"Kodak","C330" }, { 6163328,2864,2152, 0, 0, 0, 0, 0,0x94,0,0,"Kodak","C603" }, { 6166488,2864,2152, 0, 0, 0, 0, 0,0x94,0,0,"Kodak","C603",3160 }, { 460800, 640, 480, 0, 0, 0, 0, 0,0x00,0,0,"Kodak","C603" }, { 9116448,2848,2134, 0, 0, 0, 0, 0,0x00,0,0,"Kodak","C603" }, + { 12241200,4040,3030, 2, 0, 0,13, 0,0x49,0,0,"Kodak","12MP" }, + { 12272756,4040,3030, 2, 0, 0,13, 0,0x49,0,0,"Kodak","12MP",31556 }, + { 18000000,4000,3000, 0, 0, 0, 0, 0,0x00,0,0,"Kodak","12MP" }, { 614400, 640, 480, 0, 3, 0, 0,64,0x94,0,0,"Kodak","KAI-0340" }, + { 15360000,3200,2400, 0, 0, 0, 0,96,0x16,0,0,"Lenovo","A820" }, { 3884928,1608,1207, 0, 0, 0, 0,96,0x16,0,0,"Micron","2010",3212 }, { 1138688,1534, 986, 0, 0, 0, 0, 0,0x61,0,0,"Minolta","RD175",513 }, { 1581060,1305, 969, 0, 0,18, 6, 6,0x1e,4,1,"Nikon","E900" }, @@ -9122,6 +13332,8 @@ { 4841984,2090,1544, 0, 0,22, 0, 0,0x94,7,1,"Pentax","Optio S" }, { 6114240,2346,1737, 0, 0,22, 0, 0,0x94,7,1,"Pentax","Optio S4" }, { 10702848,3072,2322, 0, 0, 0,21,30,0x94,0,1,"Pentax","Optio 750Z" }, + { 4147200,1920,1080, 0, 0, 0, 0, 0,0x49,0,0,"Photron","BC2-HD" }, + { 4151666,1920,1080, 0, 0, 0, 0, 0,0x49,0,0,"Photron","BC2-HD",8 }, { 13248000,2208,3000, 0, 0, 0, 0,13,0x61,0,0,"Pixelink","A782" }, { 6291456,2048,1536, 0, 0, 0, 0,96,0x61,0,0,"RoverShot","3320AF" }, { 311696, 644, 484, 0, 0, 0, 0, 0,0x16,0,8,"ST Micro","STV680 VGA" }, @@ -9129,9 +13341,9 @@ { 16215552,3312,2448, 0, 0,48, 0, 9,0x94,0,1,"Samsung","S85" }, { 20487168,3648,2808, 0, 0, 0, 0,13,0x94,5,1,"Samsung","WB550" }, { 24000000,4000,3000, 0, 0, 0, 0,13,0x94,5,1,"Samsung","WB550" }, - { 12582980,3072,2048, 0, 0, 0, 0,33,0x61,0,0,"Sinar","3072x2048",68 }, - { 33292868,4080,4080, 0, 0, 0, 0,33,0x61,0,0,"Sinar","4080x4080",68 }, - { 44390468,4080,5440, 0, 0, 0, 0,33,0x61,0,0,"Sinar","4080x5440",68 }, + { 12582980,3072,2048, 0, 0, 0, 0,33,0x61,0,0,"Sinar","",68 }, + { 33292868,4080,4080, 0, 0, 0, 0,33,0x61,0,0,"Sinar","",68 }, + { 44390468,4080,5440, 0, 0, 0, 0,33,0x61,0,0,"Sinar","",68 }, { 1409024,1376,1024, 0, 0, 1, 0, 0,0x49,0,0,"Sony","XCD-SX910CR" }, { 2818048,1376,1024, 0, 0, 1, 0,97,0x49,0,0,"Sony","XCD-SX910CR" }, }; @@ -9158,12 +13370,14 @@ thumb_offset = thumb_length = thumb_width = thumb_height = 0; load_raw = thumb_load_raw = 0; write_thumb = &CLASS jpeg_thumb; - data_offset = meta_length = tiff_bps = tiff_compress = 0; + data_offset = meta_offset = meta_length = tiff_bps = tiff_compress = 0; kodak_cbpp = zero_after_ff = dng_version = load_flags = 0; timestamp = shot_order = tiff_samples = black = is_foveon = 0; mix_green = profile_length = data_error = zero_is_bad = 0; pixel_aspect = is_raw = raw_color = 1; tile_width = tile_length = 0; + + for (i=0; i < 4; i++) { cam_mul[i] = i == 1; pre_mul[i] = i < 3; @@ -9186,6 +13400,10 @@ } else if (order == 0x4949 || order == 0x4d4d) { if (!memcmp (head+6,"HEAPCCDR",8)) { data_offset = hlen; +#ifdef LIBRAW_LIBRARY_BUILD + imgdata.lens.makernotes.CameraMount = LIBRAW_MOUNT_FixedLens; + imgdata.lens.makernotes.LensMount = LIBRAW_MOUNT_FixedLens; +#endif parse_ciff (hlen, flen-hlen, 0); load_raw = &CLASS canon_load_raw; } else if (parse_tiff(0)) apply_tiff(); @@ -9202,8 +13420,37 @@ strcpy (model,"N Digital"); fseek (ifp, 33, SEEK_SET); get_timestamp(1); - fseek (ifp, 60, SEEK_SET); + fseek (ifp, 52, SEEK_SET); + switch (get4()) { + case 7: iso_speed = 25; break; + case 8: iso_speed = 32; break; + case 9: iso_speed = 40; break; + case 10: iso_speed = 50; break; + case 11: iso_speed = 64; break; + case 12: iso_speed = 80; break; + case 13: iso_speed = 100; break; + case 14: iso_speed = 125; break; + case 15: iso_speed = 160; break; + case 16: iso_speed = 200; break; + case 17: iso_speed = 250; break; + case 18: iso_speed = 320; break; + case 19: iso_speed = 400; break; + } + shutter = powf64(2.0f, (((float)get4())/8.0f)) / 16000.0f; FORC4 cam_mul[c ^ (c >> 1)] = get4(); + fseek (ifp, 88, SEEK_SET); + aperture = powf64(2.0f, ((float)get4())/16.0f); + fseek (ifp, 112, SEEK_SET); + focal_len = get4(); +#ifdef LIBRAW_LIBRARY_BUILD + fseek (ifp, 104, SEEK_SET); + imgdata.lens.makernotes.MaxAp4CurFocal = powf64(2.0f, ((float)get4())/16.0f); + fseek (ifp, 124, SEEK_SET); + fread(imgdata.lens.makernotes.Lens, 32, 1, ifp); + imgdata.lens.makernotes.CameraMount = LIBRAW_MOUNT_Contax_N; + if (imgdata.lens.makernotes.Lens[0]) + imgdata.lens.makernotes.LensMount = LIBRAW_MOUNT_Contax_N; +#endif } else if (!strcmp (head, "PXN")) { strcpy (make, "Logitech"); strcpy (model,"Fotoman Pixtura"); @@ -9235,6 +13482,10 @@ } else if (!memcmp (head,"RIFF",4)) { fseek (ifp, 0, SEEK_SET); parse_riff(); + } else if (!memcmp (head+4,"ftypqt ",9)) { + fseek (ifp, 0, SEEK_SET); + parse_qt (fsize); + is_raw = 0; } else if (!memcmp (head,"\0\001\0\001\0@",6)) { fseek (ifp, 6, SEEK_SET); fread (make, 1, 8, ifp); @@ -9248,15 +13499,18 @@ filters = 0x61616161; } else if (!memcmp (head,"NOKIARAW",8)) { strcpy (make, "NOKIA"); - strcpy (model, "X2"); order = 0x4949; fseek (ifp, 300, SEEK_SET); data_offset = get4(); i = get4(); width = get2(); height = get2(); - data_offset += i - width * 5 / 4 * height; - load_raw = &CLASS nokia_load_raw; + switch (tiff_bps = i*8 / (width * height)) { + case 8: load_raw = &CLASS eight_bit_load_raw; break; + case 10: load_raw = &CLASS nokia_load_raw; + } + raw_height = height + (top_margin = i / (width * tiff_bps/8) - height); + mask[0][3] = 1; filters = 0x61616161; } else if (!memcmp (head,"ARRI",4)) { order = 0x4949; @@ -9280,6 +13534,7 @@ fread (model, 1, 30, ifp); data_offset = 0x10000; load_raw = &CLASS canon_rmf_load_raw; + gamma_curve (0, 12.25, 1, 1023); } else if (!memcmp (head+4,"RED1",4)) { strcpy (make, "Red"); strcpy (model,"One"); @@ -9310,10 +13565,17 @@ } else if (!memcmp (head,"CI",2)) parse_cine(); - else + if(make[0] == 0) for (zero_fsize=i=0; i < sizeof table / sizeof *table; i++) if (fsize == table[i].fsize) { strcpy (make, table[i].t_make ); +#ifdef LIBRAW_LIBRARY_BUILD + if (!strncmp(make, "Canon",5)) + { + imgdata.lens.makernotes.CameraMount = LIBRAW_MOUNT_FixedLens; + imgdata.lens.makernotes.LensMount = LIBRAW_MOUNT_FixedLens; + } +#endif strcpy (model, table[i].t_model); flip = table[i].flags >> 2; zero_is_bad = table[i].flags & 2; @@ -9332,9 +13594,15 @@ switch (tiff_bps = (fsize-data_offset)*8 / (raw_width*raw_height)) { case 6: load_raw = &CLASS minolta_rd175_load_raw; break; - case 8: + case 8: load_raw = &CLASS eight_bit_load_raw; break; - case 10: case 12: + case 10: + if ((fsize-data_offset)/raw_height*3 >= raw_width*4) { + load_raw = &CLASS android_loose_load_raw; break; + } else if (load_flags & 1) { + load_raw = &CLASS android_tight_load_raw; break; + } + case 12: load_flags |= 128; load_raw = &CLASS packed_load_raw; break; case 16: @@ -9351,7 +13619,8 @@ parse_jpeg(0); fseek(ifp,0,SEEK_END); int sz = ftell(ifp); - if (!strncmp(model,"ov",2) && sz>=6404096 && !fseek (ifp, -6404096, SEEK_END) && + if (!(strncmp(model,"ov",2) && strncmp(model,"RP_OV",5)) && sz>=6404096 && + !fseek (ifp, -6404096, SEEK_END) && fread (head, 1, 32, ifp) && !strcmp(head,"BRCMn")) { strcpy (make, "OmniVision"); data_offset = ftell(ifp) + 0x8000-32; @@ -9365,10 +13634,12 @@ for (i=0; i < sizeof corp / sizeof *corp; i++) if (strcasestr (make, corp[i])) /* Simplify company names */ strcpy (make, corp[i]); - if ((!strcmp(make,"Kodak") || !strcmp(make,"Leica")) && + if ((!strncmp(make,"Kodak",5) || !strncmp(make,"Leica",5)) && ((cp = strcasestr(model," DIGITAL CAMERA")) || (cp = strstr(model,"FILE VERSION")))) *cp = 0; + if (!strncasecmp(model,"PENTAX",6)) + strcpy (make, "Pentax"); cp = make + strlen(make); /* Remove trailing spaces */ while (*--cp == ' ') *cp = 0; cp = model + strlen(model); @@ -9395,6 +13666,10 @@ { left_margin = 10; width = 4950; filters = 0x16161616; } if (width == 4736 && !strcmp(model,"K-7")) { height = 3122; width = 4684; filters = 0x16161616; top_margin = 2; } + if (width == 6080 && !strcmp(model,"K-3 II")) + { left_margin = 4; width = 6040; } + if (width == 6080 && !strcmp(model,"K-3")) + { left_margin = 4; width = 6040; } if (width == 7424 && !strcmp(model,"645D")) { height = 5502; width = 7328; filters = 0x61616161; top_margin = 29; left_margin = 48; } @@ -9411,9 +13686,27 @@ case 34892: load_raw = &CLASS lossy_dng_load_raw; break; default: load_raw = 0; } + if (!strncmp(make, "Canon",5) && unique_id) + { + for (i = 0; i < sizeof unique / sizeof *unique; i++) + if (unique_id == 0x80000000 + unique[i].id) + { + strcpy(model, unique[i].t_model); + break; + } + } + if (!strncasecmp(make, "Sony",4) && unique_id) + { + for (i = 0; i < sizeof sonique / sizeof *sonique; i++) + if (unique_id == sonique[i].id) + { + strcpy(model, sonique[i].t_model); + break; + } + } goto dng_skip; } - if (!strcmp(make,"Canon") && !fsize && tiff_bps != 15) { + if (!strncmp(make,"Canon",5) && !fsize && tiff_bps != 15) { if (!load_raw) load_raw = &CLASS lossless_jpeg_load_raw; for (i=0; i < sizeof canon / sizeof *canon; i++) @@ -9422,13 +13715,18 @@ height = raw_height - (top_margin = canon[i][3]); width -= canon[i][4]; height -= canon[i][5]; + mask[0][1] = canon[i][6]; + mask[0][3] = -canon[i][7]; + mask[1][1] = canon[i][8]; + mask[1][3] = -canon[i][9]; + if (canon[i][10]) filters = canon[i][10] * 0x01010101; } if ((unique_id | 0x20000) == 0x2720000) { left_margin = 8; top_margin = 16; } } - if (!strcmp(make,"Canon") && unique_id) + if (!strncmp(make,"Canon",5) && unique_id) { for (i=0; i < sizeof unique / sizeof *unique; i++) if (unique_id == 0x80000000 + unique[i].id) @@ -9438,17 +13736,17 @@ } } - if (!strcasecmp(make,"Sony") && unique_id) + if (!strncasecmp(make,"Sony",4) && unique_id) { - for (i=0; i < sizeof sony_unique / sizeof *sony_unique; i++) - if (unique_id == sony_unique[i].id) + for (i=0; i < sizeof sonique / sizeof *sonique; i++) + if (unique_id == sonique[i].id) { - adobe_coeff ("Sony", sony_unique[i].t_model); - strcpy(model,sony_unique[i].t_model); + adobe_coeff ("Sony", sonique[i].t_model); + strcpy(model,sonique[i].t_model); } } - if (!strcmp(make,"Nikon")) { + if (!strncmp(make,"Nikon",5)) { if (!load_raw) load_raw = &CLASS packed_load_raw; if (model[0] == 'E') @@ -9471,12 +13769,19 @@ if(!imgdata.params.force_foveon_x3f) simple_coeff(0); #endif - } else if (!strcmp(make,"Canon") && tiff_bps == 15) { + } else if (!strncmp(make,"Canon",5) && tiff_bps == 15) { switch (width) { case 3344: width -= 66; case 3872: width -= 6; } - if (height > width) SWAP(height,width); + if (height > width) { + SWAP(height,width); + SWAP(raw_height,raw_width); + } + if (width == 7200 && height == 3888) { + raw_width = width = 6480; + raw_height = height = 4320; + } filters = 0; tiff_samples = colors = 3; load_raw = &CLASS canon_sraw_load_raw; @@ -9517,35 +13822,30 @@ } else if (!strcmp(model,"PowerShot A610")) { if (canon_s2is()) strcpy (model+10, "S2 IS"); } else if (!strcmp(model,"PowerShot SX220 HS")) { - mask[0][0] = top_margin = 16; - mask[0][2] = top_margin + height; - mask[0][3] = left_margin = 92; + mask[1][3] = -4; + top_margin=16; + left_margin = 92; } else if (!strcmp(model,"PowerShot S120")) { raw_width = 4192; raw_height = 3062; width = 4022; - height = 3017; - mask[0][0] = top_margin = 30; + height = 3016; + mask[0][0] = top_margin = 31; mask[0][2] = top_margin + height; left_margin = 120; - mask[0][1] = 23; + mask[0][1] = 23; mask[0][3] = 72; } else if (!strcmp(model,"PowerShot G16")) { mask[0][0] = 0; mask[0][2] = 80; mask[0][1] = 0; mask[0][3] = 16; - top_margin = 28; + top_margin = 29; left_margin = 120; width = raw_width-left_margin-48; height = raw_height-top_margin-14; } else if (!strcmp(model,"PowerShot SX50 HS")) { - mask[0][0] = top_margin = 17; - mask[0][2] = raw_height; - mask[0][3] = 80; - filters = 0x49494949; - } else if (!strcmp(model,"PowerShot G10")) { - filters = 0x49494949; + top_margin = 17; } else if (!strcmp(model,"EOS D2000C")) { filters = 0x61616161; black = curve[200]; @@ -9577,11 +13877,11 @@ !strcmp(model,"COOLPIX A")) { width -= 44; } else if (!strcmp(model,"D3200") || - !strcmp(model,"D600") || - !strcmp(model,"D610") || + !strncmp(model,"D6",2) || !strncmp(model,"D800",4)) { width -= 46; - } else if (!strcmp(model,"D4")) { + } else if (!strcmp(model,"D4") || + !strcmp(model,"Df")) { width -= 52; left_margin = 2; } else if (!strncmp(model,"D40",3) || @@ -9603,12 +13903,22 @@ else width -= 8; } else if (!strncmp(model,"D300",4)) { width -= 32; - } else if (!strcmp(make,"Nikon") && !strcmp(model,"Df")) { - left_margin=4; - width-=64; - } else if (!strcmp(make,"Nikon") && raw_width == 4032) { - adobe_coeff ("Nikon","COOLPIX P7700"); - } else if (!strncmp(model,"COOLPIX P",9)) { + } else if (!strncmp(make,"Nikon",5) && raw_width == 4032) { + if(!strcmp(model,"COOLPIX P7700")) + { + adobe_coeff ("Nikon","COOLPIX P7700"); + maximum = 65504; + load_flags = 0; + } + else if(!strcmp(model,"COOLPIX P7800")) + { + adobe_coeff ("Nikon","COOLPIX P7800"); + maximum = 65504; + load_flags = 0; + } + else if(!strcmp(model,"COOLPIX P340")) + load_flags=0; + } else if (!strncmp(model,"COOLPIX P",9) && raw_width != 4032) { load_flags = 24; filters = 0x94949494; if (model[9] == '7' && iso_speed >= 400) @@ -9674,7 +13984,7 @@ strcpy (make, "ISG"); model[0] = 0; } - } else if (!strcmp(make,"Fujifilm")) { + } else if (!strncmp(make,"Fujifilm",8)) { if (!strcmp(model+7,"S2Pro")) { strcpy (model,"S2Pro"); height = 2144; @@ -9688,12 +13998,20 @@ if (width == 4032 || width == 4952) left_margin = 0; if (width == 3328 && (width -= 66)) left_margin = 34; if (width == 4936) left_margin = 4; - if (!strcmp(model,"HS50EXR")) { + if (!strcmp(model,"HS50EXR") || + !strcmp(model,"F900EXR")) { width += 2; left_margin = 0; filters = 0x16161616; } + if(!strcmp(model,"S5500")) + { + height -= (top_margin=6); + } if (fuji_layout) raw_width *= is_raw; + if (filters == 9) + FORC(36) ((char *)xtrans)[c] = + xtrans_abs[(c/6+top_margin) % 6][(c+left_margin) % 6]; } else if (!strcmp(model,"KD-400Z")) { height = 1712; width = 2312; @@ -9701,7 +14019,7 @@ goto konica_400z; } else if (!strcmp(model,"KD-510Z")) { goto konica_510z; - } else if (!strcasecmp(make,"Minolta")) { + } else if (!strncasecmp(make,"Minolta",7)) { if (!load_raw && (maximum = 0xfff)) load_raw = &CLASS unpacked_load_raw; if (!strncmp(model,"DiMAGE A",8)) { @@ -9740,20 +14058,41 @@ data_error = -1; } else if (!strcmp(model,"*ist DS")) { height -= 2; - } else if (!strcmp(make,"Samsung") && raw_width == 4704) { + } else if (!strncmp(make,"Samsung",7) && raw_width == 4704) { height -= top_margin = 8; width -= 2 * (left_margin = 8); load_flags = 32; - } else if (!strcmp(make,"Samsung") && raw_height == 3714) { - height -= 18; - width = 5536; - filters = 0x49494949; - } else if (!strcmp(make,"Samsung") && raw_width == 5632) { + } else if (!strncmp(make,"Samsung",7) && !strcmp(model,"NX3000")) { + top_margin = 24; + left_margin = 64; + width = 5472; + height = 3648; + filters = 0x61616161; + colors = 3; + } else if (!strncmp(make,"Samsung",7) && raw_height == 3714) { + height -= top_margin = 18; + left_margin = raw_width - (width = 5536); + if (raw_width != 5600) + left_margin = top_margin = 0; + filters = 0x61616161; + colors = 3; + } else if (!strncmp(make,"Samsung",7) && raw_width == 5632) { order = 0x4949; height = 3694; top_margin = 2; width = 5574 - (left_margin = 32 + tiff_bps); if (tiff_bps == 12) load_flags = 80; + } else if (!strncmp(make,"Samsung",7) && raw_width == 5664) { + height -= top_margin = 17; + left_margin = 96; + width = 5544; + filters = 0x49494949; + } else if (!strncmp(make,"Samsung",7) && raw_width == 6496) { + filters = 0x61616161; +#ifdef LIBRAW_LIBRARY_BUILD + if(!black && !cblack[0] && !cblack[1] && !cblack[2] && !cblack[3]) +#endif + black = 1 << (tiff_bps - 7); } else if (!strcmp(model,"EX1")) { order = 0x4949; height -= 20; @@ -9787,7 +14126,7 @@ height = raw_height - (top_margin = 2); } else if (!strcmp(model,"640x480")) { gamma_curve (0.45, 4.5, 1, 255); - } else if (!strcmp(make,"Hasselblad")) { + } else if (!strncmp(make,"Hasselblad",10)) { if (load_raw == &CLASS lossless_jpeg_load_raw) load_raw = &CLASS hasselblad_load_raw; if (raw_width == 7262) { @@ -9796,29 +14135,86 @@ top_margin = 4; left_margin = 7; filters = 0x61616161; - } else if (raw_width == 7410) { - height = 5502; - width = 7328; + if(!strncasecmp(model,"H3D",3)) + { + adobe_coeff("Hasselblad","H3DII-39"); + strcpy(model,"H3DII-39"); + } + } else if (raw_width == 7410 || raw_width == 8282) { + height -= 84; + width -= 82; top_margin = 4; left_margin = 41; filters = 0x61616161; + adobe_coeff("Hasselblad","H4D-40"); + strcpy(model,"H4D-40"); } else if (raw_width == 9044) { - height = 6716; - width = 8964; - top_margin = 8; - left_margin = 40; - black += load_flags = 256; - maximum = 0x8101; + if(black > 500) + { + top_margin = 12; + left_margin = 44; + width = 8956; + height = 6708; + memset(cblack,0,sizeof(cblack)); + adobe_coeff("Hasselblad","H4D-60"); + strcpy(model,"H4D-60"); + black = 512; + } + else + { + height = 6716; + width = 8964; + top_margin = 8; + left_margin = 40; + black += load_flags = 256; + maximum = 0x8101; + strcpy(model,"H3DII-60"); + } } else if (raw_width == 4090) { strcpy (model, "V96C"); height -= (top_margin = 6); width -= (left_margin = 3) + 7; filters = 0x61616161; + } else if (raw_width == 8282 && raw_height == 6240) { + if(!strncasecmp(model,"H5D",3)) + { + /* H5D 50*/ + left_margin = 54; + top_margin = 16; + width = 8176; + height = 6132; + black = 256; + strcpy(model,"H5D-50"); + } + else if(!strncasecmp(model,"H3D",3)) + { + black=0; + left_margin = 54; + top_margin = 16; + width = 8176; + height = 6132; + memset(cblack,0,sizeof(cblack)); + adobe_coeff("Hasselblad","H3D-50"); + strcpy(model,"H3D-50"); + } + } else if (raw_width == 8374 && raw_height == 6304) { + /* H5D 50c*/ + left_margin = 52; + top_margin = 100; + width = 8272; + height = 6200; + black = 256; + strcpy(model,"H5D-50c"); + } + if (tiff_samples > 1) { + is_raw = tiff_samples+1; + if (!shot_select && !half_size) filters = 0; } - } else if (!strcmp(make,"Sinar")) { + } else if (!strncmp(make,"Sinar",5)) { if (!load_raw) load_raw = &CLASS unpacked_load_raw; + if (is_raw > 1 && !shot_select && !half_size) filters = 0; maximum = 0x3fff; - } else if (!strcmp(make,"Leaf")) { + } else if (!strncmp(make,"Leaf",4)) { maximum = 0x3fff; fseek (ifp, data_offset, SEEK_SET); if (ljpeg_start (&jh, 1) && jh.bits == 15) @@ -9860,8 +14256,8 @@ width -= 2 * (left_margin = 24); filters = 0x16161616; } - } else if (!strcmp(make,"Leica") || !strcmp(make,"Panasonic")) { - if (raw_width > 0 && ((flen - data_offset) / (raw_width*8/7) == raw_height)) + } else if (!strncmp(make,"Leica",5) || !strncmp(make,"Panasonic",9)) { + if (raw_width > 0&& ((flen - data_offset) / (raw_width*8/7) == raw_height) ) load_raw = &CLASS panasonic_load_raw; if (!load_raw) { load_raw = &CLASS unpacked_load_raw; @@ -9884,11 +14280,12 @@ filters = 0x16161616; load_raw = &CLASS packed_load_raw; load_flags = 30; - } else if (!strcmp(make,"Olympus")) { + } else if (!strncmp(make,"Olympus",7)) { height += height & 1; if (exif_cfa) filters = exif_cfa; if (width == 4100) width -= 4; if (width == 4080) width -= 24; + if (width == 9280) { width -= 6; height -= 6; } if (load_raw == &CLASS unpacked_load_raw) load_flags = 4; tiff_bps = 12; @@ -9932,23 +14329,28 @@ mask[0][1] = 9; data_offset = 787392; load_raw = &CLASS sony_load_raw; - } else if (!strcmp(make,"Sony") && raw_width == 3984) { - adobe_coeff ("Sony","DSC-R1"); + } else if (!strncmp(make,"Sony",4) && raw_width == 3984) { width = 3925; order = 0x4d4d; - } else if (!strcmp(make,"Sony") && !strcmp(model,"ILCE-3000")) { + } else if (!strncmp(make,"Sony",4) && raw_width == 4288) { width -= 32; - } else if (!strcmp(make,"Sony") && raw_width == 5504) { - width -= 8; - } else if (!strcmp(make,"Sony") && raw_width == 6048) { + } else if (!strncmp(make,"Sony",4) && raw_width == 4928) { + if (height < 3280) width -= 8; + } else if (!strncmp(make,"Sony",4) && raw_width == 5504) { // ILCE-3000//5000 + width -= height > 3664 ? 8 : 32; + } else if (!strncmp(make,"Sony",4) && raw_width == 6048) { width -= 24; - } else if (!strcmp(make,"Sony") && raw_width == 7392) { - width -= 24; // 21 pix really + if (strstr(model,"RX1") || strstr(model,"A99")) + width -= 6; + } else if (!strncmp(make,"Sony",4) && raw_width == 7392) { + width -= 30; } else if (!strcmp(model,"DSLR-A100")) { if (width == 3880) { height--; width = ++raw_width; } else { + height -= 4; + width -= 4; order = 0x4d4d; load_flags = 2; } @@ -9959,46 +14361,35 @@ height -= top_margin = 4; width -= left_margin = 32; gamma_curve (0, 7, 1, 255); - } else if (!strcmp(model,"C603") || !strcmp(model,"C330")) { + } else if (!strcmp(model,"C603") || !strcmp(model,"C330") + || !strcmp(model,"12MP")) { order = 0x4949; if (filters && data_offset) { - fseek (ifp, 168, SEEK_SET); + fseek (ifp, data_offset < 4096 ? 168 : 5252, SEEK_SET); read_shorts (curve, 256); } else gamma_curve (0, 3.875, 1, 255); - load_raw = filters ? &CLASS eight_bit_load_raw - : &CLASS kodak_yrgb_load_raw; + load_raw = filters ? &CLASS eight_bit_load_raw : + strcmp(model,"C330") ? &CLASS kodak_c603_load_raw : + &CLASS kodak_c330_load_raw; + load_flags = tiff_bps > 16; + tiff_bps = 8; } else if (!strncasecmp(model,"EasyShare",9)) { data_offset = data_offset < 0x15000 ? 0x15000 : 0x17000; load_raw = &CLASS packed_load_raw; - } else if (!strcasecmp(make,"Kodak")) { + } else if (!strncasecmp(make,"Kodak",5)) { if (filters == UINT_MAX) filters = 0x61616161; - if (!strncmp(model,"NC2000",6)) { - width -= 4; - left_margin = 2; - } else if (!strcmp(model,"EOSDCS3B")) { - width -= 4; - left_margin = 2; - } else if (!strcmp(model,"EOSDCS1")) { - width -= 4; - left_margin = 2; - } else if (!strcmp(model,"DCS420")) { - width -= 4; - left_margin = 2; - } else if (!strncmp(model,"DCS460 ",7)) { - model[6] = 0; - width -= 4; - left_margin = 2; - } else if (!strcmp(model,"DCS460A")) { + if (!strncmp(model,"NC2000",6) || + !strncmp(model,"EOSDCS",6) || + !strncmp(model,"DCS4",4)) { width -= 4; left_margin = 2; - colors = 1; - filters = 0; + if (model[6] == ' ') model[6] = 0; + if (!strcmp(model,"DCS460A")) goto bw; } else if (!strcmp(model,"DCS660M")) { black = 214; - colors = 1; - filters = 0; + goto bw; } else if (!strcmp(model,"DCS760M")) { - colors = 1; +bw: colors = 1; filters = 0; } if (!strcmp(model+4,"20X")) @@ -10009,6 +14400,10 @@ } if (!strncmp(model,"DC2",3)) { raw_height = 2 + (height = 242); + if (!strncmp(model, "DC290", 5)) + iso_speed = 100; + if (!strncmp(model, "DC280", 5)) + iso_speed = 70; if (flen < 100000) { raw_width = 256; width = 249; pixel_aspect = (4.0*height) / (3.0*width); @@ -10034,12 +14429,14 @@ strcpy (model, "DC50"); height = 512; width = 768; + iso_speed=84; data_offset = 19712; load_raw = &CLASS kodak_radc_load_raw; } else if (strstr(model,"DC120")) { strcpy (model, "DC120"); height = 976; width = 848; + iso_speed=160; pixel_aspect = height/0.75/width; load_raw = tiff_compress == 7 ? &CLASS kodak_jpeg_load_raw : &CLASS kodak_dc120_load_raw; @@ -10048,6 +14445,7 @@ thumb_width = 192; thumb_offset = 6144; thumb_misc = 360; + iso_speed=140; write_thumb = &CLASS layer_thumb; black = 17; } @@ -10070,7 +14468,7 @@ flip = ~get2() & 3 ? 5:6; } filters = 0x61616161; - } else if (!strcmp(make,"Rollei") && !load_raw) { + } else if (!strncmp(make,"Rollei",6) && !load_raw) { switch (raw_width) { case 1316: height = 1030; @@ -10133,9 +14531,6 @@ if (!model[0]) sprintf (model, "%dx%d", width, height); if (filters == UINT_MAX) filters = 0x94949494; - if (raw_color) adobe_coeff (make, model); - if (load_raw == &CLASS kodak_radc_load_raw) - if (raw_color) adobe_coeff ("Apple","Quicktake"); if (thumb_offset && !thumb_height) { fseek (ifp, thumb_offset, SEEK_SET); if (ljpeg_start (&jh, 1)) { @@ -10145,10 +14540,34 @@ } dng_skip: + /* Early reject for damaged images */ + if (!load_raw || height < 22 || width < 22 || + tiff_bps > 16 || tiff_samples > 4 || colors > 4 || colors < 1) + { + is_raw = 0; +#ifdef LIBRAW_LIBRARY_BUILD + RUN_CALLBACK(LIBRAW_PROGRESS_IDENTIFY,1,2); +#endif + return; + } + if ((use_camera_matrix & (use_camera_wb || dng_version)) + && cmatrix[0][0] > 0.125) { + memcpy (rgb_cam, cmatrix, sizeof cmatrix); + raw_color = 0; + } + + if (raw_color) adobe_coeff (make, model); +#ifdef LIBRAW_LIBRARY_BUILD + else if(imgdata.color.cam_xyz[0][0]<0.01) + adobe_coeff (make, model,1); +#endif + + if (load_raw == &CLASS kodak_radc_load_raw) + if (raw_color) adobe_coeff ("Apple","Quicktake"); if (fuji_width) { fuji_width = width >> !fuji_layout; - if (~fuji_width & 1) filters = 0x49494949; + filters = fuji_width & 1 ? 0x94949494 : 0x49494949; width = (height >> fuji_layout) + fuji_width; height = width - 1; pixel_aspect = 1; @@ -10157,10 +14576,19 @@ if (raw_width < width ) raw_width = width; } if (!tiff_bps) tiff_bps = 12; - if (!maximum) maximum = (1 << tiff_bps) - 1; + if (!maximum) + { + maximum = (1 << tiff_bps) - 1; + if(maximum < 0x10000 && curve[maximum]>0 && load_raw == &CLASS sony_arw2_load_raw) + maximum = curve[maximum]; + } if (!load_raw || height < 22 || width < 22 || - tiff_bps > 16 || tiff_samples > 4 || colors > 4) + tiff_bps > 16 || tiff_samples > 6 || colors > 4) + is_raw = 0; + + if(raw_width < 22 || raw_width > 64000 || raw_height < 22 || raw_width > 64000) is_raw = 0; + #ifdef NO_JASPER if (load_raw == &CLASS redcine_load_raw) { #ifdef DCRAW_VERBOSE @@ -10215,9 +14643,6 @@ FILE *fp; unsigned size; -#ifndef USE_LCMS2 - cmsErrorAction (LCMS_ERROR_SHOW); -#endif if (strcmp (input, "embed")) hInProfile = cmsOpenProfileFromFile (input, "r"); else if (profile_length) { @@ -10355,7 +14780,7 @@ raw_color |= colors == 1 || document_mode || output_color < 1 || output_color > 5; #else - raw_color |= colors == 1 || + raw_color |= colors == 1 || output_color < 1 || output_color > 5; #endif if (!raw_color) { @@ -10637,7 +15062,7 @@ strncpy (th->t_desc, desc, 512); strncpy (th->t_make, make, 64); strncpy (th->t_model, model, 64); - strcpy (th->soft, "dcraw v"DCRAW_VERSION); + strcpy (th->soft, "dcraw v" DCRAW_VERSION); t = localtime (×tamp); sprintf (th->date, "%04d:%02d:%02d %02d:%02d:%02d", t->tm_year+1900,t->tm_mon+1,t->tm_mday,t->tm_hour,t->tm_min,t->tm_sec); @@ -10704,7 +15129,7 @@ int perc, val, total, t_white=0x2000; #ifdef LIBRAW_LIBRARY_BUILD - perc = width * height * auto_bright_thr; /* 99th percentile white level */ + perc = width * height * auto_bright_thr; #else perc = width * height * 0.01; /* 99th percentile white level */ #endif @@ -10868,7 +15293,7 @@ case 'A': FORC4 greybox[c] = atoi(argv[arg++]); case 'a': use_auto_wb = 1; break; case 'w': use_camera_wb = 1; break; - case 'M': use_camera_matrix = (opm == '+'); break; + case 'M': use_camera_matrix = 3 * (opm == '+'); break; case 'I': read_from_stdin = 1; break; case 'E': document_mode++; case 'D': document_mode++; @@ -10884,8 +15309,6 @@ return 1; } } - if (use_camera_matrix < 0) - use_camera_matrix = use_camera_wb; if (arg == argc) { fprintf (stderr,_("No files to process.\n")); return 1; @@ -10952,6 +15375,7 @@ height = thumb_height; width = thumb_width; filters = 0; + colors = 3; } else { fseek (ifp, thumb_offset, SEEK_SET); write_fun = write_thumb; @@ -10962,6 +15386,7 @@ height += height & 1; width += width & 1; } + if (identify_only && verbose && make[0]) { printf (_("\nFilename: %s\n"), ifname); printf (_("Timestamp: %s"), ctime(×tamp)); @@ -11019,9 +15444,15 @@ printf (_("Output size: %4d x %d\n"), iwidth, iheight); printf (_("Raw colors: %d"), colors); if (filters) { + int fhigh = 2, fwide = 2; + if ((filters ^ (filters >> 8)) & 0xff) fhigh = 4; + if ((filters ^ (filters >> 16)) & 0xffff) fhigh = 8; + if (filters == 1) fhigh = fwide = 16; + if (filters == 9) fhigh = fwide = 6; printf (_("\nFilter pattern: ")); - for (i=0; i < 16; i++) - putchar (cdesc[fcol(i >> 1,i & 1)]); + for (i=0; i < fhigh; i++) + for (c = i && putchar('/') && 0; c < fwide; c++) + putchar (cdesc[fcol(i,c)]); } printf (_("\nDaylight multipliers:")); FORCC printf (" %f", pre_mul[c]); @@ -11036,10 +15467,6 @@ fclose(ifp); continue; } - if (use_camera_matrix && cmatrix[0][0] > 0.25) { - memcpy (rgb_cam, cmatrix, sizeof cmatrix); - raw_color = 0; - } if (meta_length) { meta_data = (char *) malloc (meta_length); merror (meta_data, "main()"); @@ -11083,6 +15510,12 @@ FORC3 if (i > cblack[c]) i = cblack[c]; FORC4 cblack[c] -= i; black += i; + i = cblack[6]; + FORC (cblack[4] * cblack[5]) + if (i > cblack[6+c]) i = cblack[6+c]; + FORC (cblack[4] * cblack[5]) + cblack[6+c] -= i; + black += i; if (user_black >= 0) black = user_black; FORC4 cblack[c] += black; if (user_sat > 0) maximum = user_sat; diff -Nru libraw-0.16.2/debian/changelog libraw-0.17.0/debian/changelog --- libraw-0.16.2/debian/changelog 2015-05-26 07:06:13.000000000 +0000 +++ libraw-0.17.0/debian/changelog 2015-10-16 08:03:53.000000000 +0000 @@ -1,3 +1,13 @@ +libraw (0.17.0-1) unstable; urgency=medium + + * New upstream release + - debian/: SONAME bump libraw10 => libraw15 + - debian/rules: bump dh_makeshlibs to libraw15 + - debian/libraw15.symbols: symbols refreshed + * debian/copyright: file updated + + -- Matteo F. Vescovi Fri, 16 Oct 2015 10:03:52 +0200 + libraw (0.16.2-1) unstable; urgency=high * New upstream release diff -Nru libraw-0.16.2/debian/control libraw-0.17.0/debian/control --- libraw-0.16.2/debian/control 2015-05-26 07:00:06.000000000 +0000 +++ libraw-0.17.0/debian/control 2015-09-02 12:25:30.000000000 +0000 @@ -15,7 +15,7 @@ Vcs-Git: git://anonscm.debian.org/pkg-shotwell/libraw.git Vcs-Browser: http://anonscm.debian.org/gitweb/?p=pkg-shotwell/libraw.git -Package: libraw10 +Package: libraw15 Architecture: any Pre-Depends: ${misc:Pre-Depends} Depends: ${shlibs:Depends}, @@ -43,7 +43,7 @@ Section: libdevel Architecture: any Depends: ${misc:Depends}, - libraw10 (= ${binary:Version}), + libraw15 (= ${binary:Version}), liblcms2-dev Multi-Arch: same Description: raw image decoder library (development files) diff -Nru libraw-0.16.2/debian/copyright libraw-0.17.0/debian/copyright --- libraw-0.16.2/debian/copyright 2015-05-22 12:12:10.000000000 +0000 +++ libraw-0.17.0/debian/copyright 2015-09-02 12:09:04.000000000 +0000 @@ -22,13 +22,10 @@ Copyright: 2010, Roland Karlsson License: BSD-3-clause -Files: bootstrap.* -Copyright: 2013, Gilles Caulier -License: BSD-3-clause - Files: debian/* Copyright: 2011, Devid Filoni 2010-2014, Luca Falavigna + 2015, Matteo F. Vescovi License: GPL-2+ License: LGPL-2.1 diff -Nru libraw-0.16.2/debian/libraw10.install libraw-0.17.0/debian/libraw10.install --- libraw-0.16.2/debian/libraw10.install 2015-05-22 12:12:10.000000000 +0000 +++ libraw-0.17.0/debian/libraw10.install 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -usr/lib/*/lib*so.* diff -Nru libraw-0.16.2/debian/libraw10.symbols libraw-0.17.0/debian/libraw10.symbols --- libraw-0.16.2/debian/libraw10.symbols 2015-05-22 12:12:10.000000000 +0000 +++ libraw-0.17.0/debian/libraw10.symbols 1970-01-01 00:00:00.000000000 +0000 @@ -1,843 +0,0 @@ -# SymbolsHelper-Confirmed: 0.16.0 alpha amd64 arm64 armel armhf hurd-i386 i386 kfreebsd-amd64 arm64 kfreebsd-i386 mips mipsel powerpc ppc64 ppc64el s390x sparc sparc64 -libraw.so.10 libraw10 #MINVER# - (c++)"AAHD::AAHD(LibRaw&)@Base" 0.16.0 - (c++)"AAHD::combine_image()@Base" 0.16.0 - (c++)"AAHD::evaluate_ahd()@Base" 0.16.0 - (c++)"AAHD::gammaLUT@Base" 0.16.0 - (c++)"AAHD::hide_hots()@Base" 0.16.0 - (c++)"AAHD::illustrate_dirs()@Base" 0.16.0 - (c++)"AAHD::illustrate_dline(int)@Base" 0.16.0 - (c++)"AAHD::make_ahd_gline(int)@Base" 0.16.0 - (c++)"AAHD::make_ahd_greens()@Base" 0.16.0 - (c++)"AAHD::make_ahd_rb()@Base" 0.16.0 - (c++)"AAHD::make_ahd_rb_hv(int)@Base" 0.16.0 - (c++)"AAHD::make_ahd_rb_last(int)@Base" 0.16.0 - (c++)"AAHD::refine_hv_dirs()@Base" 0.16.0 - (c++)"AAHD::refine_hv_dirs(int, int)@Base" 0.16.0 - (c++)"AAHD::refine_ihv_dirs(int)@Base" 0.16.0 - (c++)"AAHD::yuv_coeff@Base" 0.16.0 - (c++)"AAHD::~AAHD()@Base" 0.16.0 - (c++)"DHT::DHT(LibRaw&)@Base" 0.16.0 - (c++)"DHT::copy_to_image()@Base" 0.16.0 - (c++)"DHT::hide_hots()@Base" 0.16.0 - (c++)"DHT::illustrate_dirs()@Base" 0.16.0 - (c++)"DHT::illustrate_dline(int)@Base" 0.16.0 - (c++)"DHT::make_diag_dirs()@Base" 0.16.0 - (c++)"DHT::make_diag_dline(int)@Base" 0.16.0 - (c++)"DHT::make_gline(int)@Base" 0.16.0 - (c++)"DHT::make_greens()@Base" 0.16.0 - (c++)"DHT::make_hv_dirs()@Base" 0.16.0 - (c++)"DHT::make_hv_dline(int)@Base" 0.16.0 - (c++)"DHT::make_rb()@Base" 0.16.0 - (c++)"DHT::make_rbdiag(int)@Base" 0.16.0 - (c++)"DHT::make_rbhv(int)@Base" 0.16.0 - (c++)"DHT::refine_diag_dirs(int, int)@Base" 0.16.0 - (c++)"DHT::refine_hv_dirs(int, int)@Base" 0.16.0 - (c++)"DHT::refine_idiag_dirs(int)@Base" 0.16.0 - (c++)"DHT::refine_ihv_dirs(int)@Base" 0.16.0 - (c++)"DHT::restore_hots()@Base" 0.16.0 - (c++)"DHT::~DHT()@Base" 0.16.0 - (c++)"LibRaw::CA_correct_RT(float, float)@Base" 0.16.0 - (c++)"LibRaw::LibRaw(unsigned int)@Base" 0.16.0 - (c++)"LibRaw::aahd_interpolate()@Base" 0.16.0 - (c++)"LibRaw::adjust_bl()@Base" 0.16.0 - (c++)"LibRaw::adjust_maximum()@Base" 0.16.0 - (c++)"LibRaw::adjust_sizes_info_only()@Base" 0.16.0 - (c++)"LibRaw::adobe_coeff(char const*, char const*)@Base" 0.16.0 - (c++)"LibRaw::adobe_copy_pixel(unsigned int, unsigned int, unsigned short**)@Base" 0.16.0 - (c++)"LibRaw::afd_interpolate_pl(int, int)@Base" 0.16.0 - (c++)"LibRaw::ahd_interpolate()@Base" 0.16.0 - (c++)"LibRaw::ahd_interpolate_build_homogeneity_map(int, int, short (*) [512][512][3], char (*) [512][2])@Base" 0.16.0 - (c++)"LibRaw::ahd_interpolate_combine_homogeneous_pixels(int, int, unsigned short (*) [512][512][3], char (*) [512][2])@Base" 0.16.0 - (c++)"LibRaw::ahd_interpolate_green_h_and_v(int, int, unsigned short (*) [512][512][3])@Base" 0.16.0 - (c++)"LibRaw::ahd_interpolate_mod()@Base" 0.16.0 - (c++)"LibRaw::ahd_interpolate_r_and_b_and_convert_to_cielab(int, int, unsigned short (*) [512][512][3], short (*) [512][512][3])@Base" 0.16.0 - (c++)"LibRaw::ahd_interpolate_r_and_b_in_rgb_and_convert_to_cielab(int, int, unsigned short (*) [512][3], short (*) [512][3])@Base" 0.16.0 - (c++)"LibRaw::amaze_demosaic_RT()@Base" 0.16.0 - (c++)"LibRaw::apply_profile(char const*, char const*)@Base" 0.16.0 - (c++)"LibRaw::apply_tiff()@Base" 0.16.0 - (c++)"LibRaw::bad_pixels(char const*)@Base" 0.16.0 - (c++)"LibRaw::blend_highlights()@Base" 0.16.0 - (c++)"LibRaw::border_interpolate(int)@Base" 0.16.0 - (c++|arch=alpha amd64 arm64 kfreebsd-amd64 mips64 mips64el ppc64 ppc64el s390x sparc64)"LibRaw::calloc(unsigned long, unsigned long)@Base" 0.16.0 - (c++)"LibRaw::cam_xyz_coeff(double (*) [3])@Base" 0.16.0 - (c++)"LibRaw::cameraCount()@Base" 0.16.0 - (c++)"LibRaw::cameraList()@Base" 0.16.0 - (c++)"LibRaw::canon_600_auto_wb()@Base" 0.16.0 - (c++)"LibRaw::canon_600_coeff()@Base" 0.16.0 - (c++)"LibRaw::canon_600_color(int*, int)@Base" 0.16.0 - (c++)"LibRaw::canon_600_correct()@Base" 0.16.0 - (c++)"LibRaw::canon_600_fixed_wb(int)@Base" 0.16.0 - (c++)"LibRaw::canon_600_load_raw()@Base" 0.16.0 - (c++)"LibRaw::canon_has_lowbits()@Base" 0.16.0 - (c++)"LibRaw::canon_load_raw()@Base" 0.16.0 - (c++)"LibRaw::canon_rmf_load_raw()@Base" 0.16.0 - (c++)"LibRaw::canon_s2is()@Base" 0.16.0 - (c++)"LibRaw::canon_sraw_load_raw()@Base" 0.16.0 - (c++)"LibRaw::cfa_impulse_gauss(float, float)@Base" 0.16.0 - (c++)"LibRaw::cfa_linedn(float)@Base" 0.16.0 - (c++)"LibRaw::checkCancel()@Base" 0.16.0 - (c++)"LibRaw::cielab(unsigned short*, short*)@Base" 0.16.0 - (c++)"LibRaw::ciff_block_1030()@Base" 0.16.0 - (c++)"LibRaw::convert_to_rgb()@Base" 0.16.0 - (c++)"LibRaw::convert_to_rgb_loop(float (*) [4])@Base" 0.16.0 - (c++)"LibRaw::copy_bayer(unsigned short*, unsigned short*)@Base" 0.16.0 - (c++)"LibRaw::copy_fuji_uncropped(unsigned short*, unsigned short*)@Base" 0.16.0 - (c++)"LibRaw::copy_mem_image(void*, int, int)@Base" 0.16.0 - (c++)"LibRaw::crop_masked_pixels()@Base" 0.16.0 - (c++)"LibRaw::crw_init_tables(unsigned int, unsigned short**)@Base" 0.16.0 - (c++)"LibRaw::dcb(int, int)@Base" 0.16.0 - (c++)"LibRaw::dcb_color()@Base" 0.16.0 - (c++)"LibRaw::dcb_color2(float (*) [3])@Base" 0.16.0 - (c++)"LibRaw::dcb_color3(float (*) [3])@Base" 0.16.0 - (c++)"LibRaw::dcb_color_full()@Base" 0.16.0 - (c++)"LibRaw::dcb_copy_to_buffer(float (*) [3])@Base" 0.16.0 - (c++)"LibRaw::dcb_correction()@Base" 0.16.0 - (c++)"LibRaw::dcb_correction2()@Base" 0.16.0 - (c++)"LibRaw::dcb_decide(float (*) [3], float (*) [3])@Base" 0.16.0 - (c++)"LibRaw::dcb_hor(float (*) [3])@Base" 0.16.0 - (c++)"LibRaw::dcb_map()@Base" 0.16.0 - (c++)"LibRaw::dcb_nyquist()@Base" 0.16.0 - (c++)"LibRaw::dcb_pp()@Base" 0.16.0 - (c++)"LibRaw::dcb_refinement()@Base" 0.16.0 - (c++)"LibRaw::dcb_restore_from_buffer(float (*) [3])@Base" 0.16.0 - (c++)"LibRaw::dcb_ver(float (*) [3])@Base" 0.16.0 - (c++)"LibRaw::dcraw_clear_mem(libraw_processed_image_t*)@Base" 0.16.0 - (c++)"LibRaw::dcraw_make_mem_image(int*)@Base" 0.16.0 - (c++)"LibRaw::dcraw_make_mem_thumb(int*)@Base" 0.16.0 - (c++)"LibRaw::dcraw_ppm_tiff_writer(char const*)@Base" 0.16.0 - (c++)"LibRaw::dcraw_process()@Base" 0.16.0 - (c++)"LibRaw::dcraw_thumb_writer(char const*)@Base" 0.16.0 - (c++)"LibRaw::derror()@Base" 0.16.0 - (c++)"LibRaw::dht_interpolate()@Base" 0.16.0 - (c++)"LibRaw::eight_bit_load_raw()@Base" 0.16.0 - (c++)"LibRaw::es_median_filter()@Base" 0.16.0 - (c++)"LibRaw::exp_bef(float, float)@Base" 0.16.0 - (c++)"LibRaw::fbdd(int)@Base" 0.16.0 - (c++)"LibRaw::fbdd_correction()@Base" 0.16.0 - (c++)"LibRaw::fbdd_correction2(double (*) [3])@Base" 0.16.0 - (c++)"LibRaw::fbdd_green()@Base" 0.16.0 - (c++)"LibRaw::fcol(int, int)@Base" 0.16.0 - (c++)"LibRaw::fill_holes(int)@Base" 0.16.0 - (c++)"LibRaw::find_green(int, int, int, int)@Base" 0.16.0 - (c++)"LibRaw::fix_after_rawspeed(int)@Base" 0.16.0 - (c++)"LibRaw::flip_index(int, int)@Base" 0.16.0 - (c++)"LibRaw::free(void*)@Base" 0.16.0 - (c++)"LibRaw::free_image()@Base" 0.16.0 - (c++)"LibRaw::fuji_rotate()@Base" 0.16.0 - (c++)"LibRaw::gamma_curve(double, double, int, int)@Base" 0.16.0 - (c++)"LibRaw::get2()@Base" 0.16.0 - (c++)"LibRaw::get4()@Base" 0.16.0 - (c++)"LibRaw::get_decoder_info(libraw_decoder_info_t*)@Base" 0.16.0 - (c++)"LibRaw::get_mem_image_format(int*, int*, int*, int*) const@Base" 0.16.0 - (c++)"LibRaw::get_timestamp(int)@Base" 0.16.0 - (c++)"LibRaw::getbithuff(int, unsigned short*)@Base" 0.16.0 - (c++)"LibRaw::getint(int)@Base" 0.16.0 - (c++)"LibRaw::getreal(int)@Base" 0.16.0 - (c++)"LibRaw::green_equilibrate(float)@Base" 0.16.0 - (c++)"LibRaw::green_matching()@Base" 0.16.0 - (c++)"LibRaw::guess_byte_order(int)@Base" 0.16.0 - (c++)"LibRaw::hasselblad_full_load_raw()@Base" 0.16.0 - (c++)"LibRaw::hasselblad_load_raw()@Base" 0.16.0 - (c++)"LibRaw::hat_transform(float*, float*, int, int, int)@Base" 0.16.0 - (c++)"LibRaw::identify()@Base" 0.16.0 - (c++)"LibRaw::imacon_full_load_raw()@Base" 0.16.0 - (c++)"LibRaw::int_to_float(int)@Base" 0.16.0 - (c++)"LibRaw::is_phaseone_compressed()@Base" 0.16.0 - (c++)"LibRaw::is_sraw()@Base" 0.16.0 - (c++)"LibRaw::jpeg_thumb()@Base" 0.16.0 - (c++)"LibRaw::jpeg_thumb_writer(_IO_FILE*, char*, int)@Base" 0.16.0 - (c++)"LibRaw::kodak_262_load_raw()@Base" 0.16.0 - (c++)"LibRaw::kodak_65000_decode(short*, int)@Base" 0.16.0 - (c++)"LibRaw::kodak_65000_load_raw()@Base" 0.16.0 - (c++)"LibRaw::kodak_dc120_load_raw()@Base" 0.16.0 - (c++)"LibRaw::kodak_jpeg_load_raw()@Base" 0.16.0 - (c++)"LibRaw::kodak_radc_load_raw()@Base" 0.16.0 - (c++)"LibRaw::kodak_rgb_load_raw()@Base" 0.16.0 - (c++)"LibRaw::kodak_thumb_load_raw()@Base" 0.16.0 - (c++)"LibRaw::kodak_thumb_loader()@Base" 0.16.0 - (c++)"LibRaw::kodak_ycbcr_load_raw()@Base" 0.16.0 - (c++)"LibRaw::kodak_yrgb_load_raw()@Base" 0.16.0 - (c++)"LibRaw::layer_thumb()@Base" 0.16.0 - (c++)"LibRaw::lch_to_rgb(double (*) [3])@Base" 0.16.0 - (c++)"LibRaw::leaf_hdr_load_raw()@Base" 0.16.0 - (c++)"LibRaw::lin_interpolate()@Base" 0.16.0 - (c++)"LibRaw::lin_interpolate_loop(int (*) [16][32], int)@Base" 0.16.0 - (c++)"LibRaw::linear_table(unsigned int)@Base" 0.16.0 - (c++)"LibRaw::ljpeg_diff(unsigned short*)@Base" 0.16.0 - (c++)"LibRaw::ljpeg_end(jhead*)@Base" 0.16.0 - (c++)"LibRaw::ljpeg_row(int, jhead*)@Base" 0.16.0 - (c++)"LibRaw::ljpeg_start(jhead*, int)@Base" 0.16.0 - (c++)"LibRaw::lmmse_interpolate(int)@Base" 0.16.0 - (c++)"LibRaw::lossless_dng_load_raw()@Base" 0.16.0 - (c++)"LibRaw::lossless_jpeg_load_raw()@Base" 0.16.0 - (c++)"LibRaw::lossy_dng_load_raw()@Base" 0.16.0 - (c++)"LibRaw::make_decoder(unsigned char const*)@Base" 0.16.0 - (c++)"LibRaw::make_decoder_ref(unsigned char const**)@Base" 0.16.0 - (c++|arch=alpha amd64 arm64 kfreebsd-amd64 mips64 mips64el ppc64 ppc64el s390x sparc64)"LibRaw::malloc(unsigned long)@Base" 0.16.0 - (c++)"LibRaw::median4(int*)@Base" 0.16.0 - (c++)"LibRaw::median_filter()@Base" 0.16.0 - (c++)"LibRaw::median_filter_new()@Base" 0.16.0 - (c++)"LibRaw::merror(void*, char const*)@Base" 0.16.0 - (c++)"LibRaw::minolta_rd175_load_raw()@Base" 0.16.0 - (c++)"LibRaw::minolta_z2()@Base" 0.16.0 - (c++)"LibRaw::nikon_3700()@Base" 0.16.0 - (c++)"LibRaw::nikon_e2100()@Base" 0.16.0 - (c++)"LibRaw::nikon_e995()@Base" 0.16.0 - (c++)"LibRaw::nikon_load_raw()@Base" 0.16.0 - (c++)"LibRaw::nokia_load_raw()@Base" 0.16.0 - (c++)"LibRaw::olympus_load_raw()@Base" 0.16.0 - (c++|arch=alpha amd64 arm64 kfreebsd-amd64 mips64 mips64el ppc64 ppc64el s390x sparc64)"LibRaw::open_buffer(void*, unsigned long)@Base" 0.16.0 - (c++)"LibRaw::open_datastream(LibRaw_abstract_datastream*)@Base" 0.16.0 - (c++)"LibRaw::open_file(char const*, long long)@Base" 0.16.0 - (c++)"LibRaw::packed_dng_load_raw()@Base" 0.16.0 - (c++)"LibRaw::packed_load_raw()@Base" 0.16.0 - (c++)"LibRaw::pana_bits(int)@Base" 0.16.0 - (c++)"LibRaw::panasonic_load_raw()@Base" 0.16.0 - (c++)"LibRaw::parse_ciff(int, int, int)@Base" 0.16.0 - (c++)"LibRaw::parse_cine()@Base" 0.16.0 - (c++)"LibRaw::parse_exif(int)@Base" 0.16.0 - (c++)"LibRaw::parse_external_jpeg()@Base" 0.16.0 - (c++)"LibRaw::parse_fuji(int)@Base" 0.16.0 - (c++)"LibRaw::parse_gps(int)@Base" 0.16.0 - (c++)"LibRaw::parse_jpeg(int)@Base" 0.16.0 - (c++)"LibRaw::parse_kodak_ifd(int)@Base" 0.16.0 - (c++)"LibRaw::parse_makernote(int, int)@Base" 0.16.0 - (c++)"LibRaw::parse_minolta(int)@Base" 0.16.0 - (c++)"LibRaw::parse_mos(int)@Base" 0.16.0 - (c++)"LibRaw::parse_phase_one(int)@Base" 0.16.0 - (c++)"LibRaw::parse_redcine()@Base" 0.16.0 - (c++)"LibRaw::parse_riff()@Base" 0.16.0 - (c++)"LibRaw::parse_rollei()@Base" 0.16.0 - (c++)"LibRaw::parse_sinar_ia()@Base" 0.16.0 - (c++)"LibRaw::parse_smal(int, int)@Base" 0.16.0 - (c++)"LibRaw::parse_thumb_note(int, unsigned int, unsigned int)@Base" 0.16.0 - (c++)"LibRaw::parse_tiff(int)@Base" 0.16.0 - (c++)"LibRaw::parse_tiff_ifd(int)@Base" 0.16.0 - (c++)"LibRaw::parse_x3f()@Base" 0.16.0 - (c++)"LibRaw::pentax_load_raw()@Base" 0.16.0 - (c++)"LibRaw::ph1_bithuff(int, unsigned short*)@Base" 0.16.0 - (c++)"LibRaw::phase_one_allocate_tempbuffer()@Base" 0.16.0 - (c++)"LibRaw::phase_one_correct()@Base" 0.16.0 - (c++)"LibRaw::phase_one_flat_field(int, int)@Base" 0.16.0 - (c++)"LibRaw::phase_one_free_tempbuffer()@Base" 0.16.0 - (c++)"LibRaw::phase_one_load_raw()@Base" 0.16.0 - (c++)"LibRaw::phase_one_load_raw_c()@Base" 0.16.0 - (c++)"LibRaw::phase_one_subtract_black(unsigned short*, unsigned short*)@Base" 0.16.0 - (c++)"LibRaw::ppg_interpolate()@Base" 0.16.0 - (c++)"LibRaw::ppm16_thumb()@Base" 0.16.0 - (c++)"LibRaw::ppm_thumb()@Base" 0.16.0 - (c++)"LibRaw::pre_interpolate()@Base" 0.16.0 - (c++)"LibRaw::pseudoinverse(double (*) [3], double (*) [3], int)@Base" 0.16.0 - (c++)"LibRaw::quicktake_100_load_raw()@Base" 0.16.0 - (c++)"LibRaw::raw(unsigned int, unsigned int)@Base" 0.16.0 - (c++)"LibRaw::raw2image()@Base" 0.16.0 - (c++)"LibRaw::raw2image_ex(int)@Base" 0.16.0 - (c++)"LibRaw::raw2image_start()@Base" 0.16.0 - (c++)"LibRaw::read_shorts(unsigned short*, int)@Base" 0.16.0 - (c++|arch=alpha amd64 arm64 kfreebsd-amd64 mips64 mips64el ppc64 ppc64el s390x sparc64)"LibRaw::realloc(void*, unsigned long)@Base" 0.16.0 - (c++)"LibRaw::recover_highlights()@Base" 0.16.0 - (c++)"LibRaw::recycle()@Base" 0.16.0 - (c++)"LibRaw::recycle_datastream()@Base" 0.16.0 - (c++)"LibRaw::redcine_load_raw()@Base" 0.16.0 - (c++)"LibRaw::refinement()@Base" 0.16.0 - (c++)"LibRaw::remove_zeroes()@Base" 0.16.0 - (c++)"LibRaw::rgb_to_lch(double (*) [3])@Base" 0.16.0 - (c++)"LibRaw::rollei_load_raw()@Base" 0.16.0 - (c++)"LibRaw::rollei_thumb()@Base" 0.16.0 - (c++)"LibRaw::romm_coeff(float (*) [3])@Base" 0.16.0 - (c++)"LibRaw::samsung_load_raw()@Base" 0.16.0 - (c++)"LibRaw::scale_colors()@Base" 0.16.0 - (c++)"LibRaw::scale_colors_loop(float*)@Base" 0.16.0 - (c++)"LibRaw::setCancelFlag()@Base" 0.16.0 - (c++)"LibRaw::set_rawspeed_camerafile(char*)@Base" 0.16.0 - (c++)"LibRaw::sget2(unsigned char*)@Base" 0.16.0 - (c++)"LibRaw::sget4(unsigned char*)@Base" 0.16.0 - (c++)"LibRaw::simple_coeff(int)@Base" 0.16.0 - (c++)"LibRaw::sinar_4shot_load_raw()@Base" 0.16.0 - (c++)"LibRaw::smal_decode_segment(unsigned int (*) [2], int)@Base" 0.16.0 - (c++)"LibRaw::smal_v6_load_raw()@Base" 0.16.0 - (c++)"LibRaw::smal_v9_load_raw()@Base" 0.16.0 - (c++)"LibRaw::sony_arw2_load_raw()@Base" 0.16.0 - (c++)"LibRaw::sony_arw_load_raw()@Base" 0.16.0 - (c++)"LibRaw::sony_decrypt(unsigned int*, int, int, int)@Base" 0.16.0 - (c++)"LibRaw::sony_load_raw()@Base" 0.16.0 - (c++)"LibRaw::strerror(int)@Base" 0.16.0 - (c++)"LibRaw::stretch()@Base" 0.16.0 - (c++)"LibRaw::strprogress(LibRaw_progress)@Base" 0.16.0 - (c++)"LibRaw::subtract(char const*)@Base" 0.16.0 - (c++)"LibRaw::subtract_black()@Base" 0.16.0 - (c++)"LibRaw::subtract_black_internal()@Base" 0.16.0 - (c++)"LibRaw::tiff_get(unsigned int, unsigned int*, unsigned int*, unsigned int*, unsigned int*)@Base" 0.16.0 - (c++)"LibRaw::tiff_head(tiff_hdr*, int)@Base" 0.16.0 - (c++)"LibRaw::tiff_set(unsigned short*, unsigned short, unsigned short, int, int)@Base" 0.16.0 - (c++)"LibRaw::unpack()@Base" 0.16.0 - (c++)"LibRaw::unpack_function_name()@Base" 0.16.0 - (c++)"LibRaw::unpack_thumb()@Base" 0.16.0 - (c++)"LibRaw::unpacked_load_raw()@Base" 0.16.0 - (c++)"LibRaw::vcd_interpolate(int)@Base" 0.16.0 - (c++)"LibRaw::version()@Base" 0.16.0 - (c++)"LibRaw::versionNumber()@Base" 0.16.0 - (c++)"LibRaw::vng_interpolate()@Base" 0.16.0 - (c++)"LibRaw::wavelet_denoise()@Base" 0.16.0 - (c++)"LibRaw::wf_bayer4_block_filter(int*, void*, int, void*, int)@Base" 0.16.0 - (c++)"LibRaw::wf_bayer4_green_blur(int, void*, int, void*, int)@Base" 0.16.0 - (c++)"LibRaw::wf_bayer4_igauss_filter(int, void*, int, void*, int)@Base" 0.16.0 - (c++)"LibRaw::wf_filter_energy(int, int, int, int)@Base" 0.16.0 - (c++)"LibRaw::wf_remove_banding()@Base" 0.16.0 - (c++)"LibRaw::write_ppm_tiff()@Base" 0.16.0 - (c++)"LibRaw::x3f_load_raw()@Base" 0.16.0 - (c++)"LibRaw::x3f_thumb_loader()@Base" 0.16.0 - (c++)"LibRaw::xtrans_interpolate(int)@Base" 0.16.0 - (c++)"LibRaw::~LibRaw()@Base" 0.16.0 - (c++)"LibRaw_abstract_datastream::fname()@Base" 0.16.0 - (c++)"LibRaw_abstract_datastream::jpeg_src(void*)@Base" 0.16.0 - (c++)"LibRaw_abstract_datastream::subfile_close()@Base" 0.16.0 - (c++)"LibRaw_abstract_datastream::subfile_open(char const*)@Base" 0.16.0 - (c++)"LibRaw_abstract_datastream::tempbuffer_close()@Base" 0.16.0 - (c++|arch=alpha amd64 arm64 kfreebsd-amd64 mips64 mips64el ppc64 ppc64el s390x sparc64)"LibRaw_abstract_datastream::tempbuffer_open(void*, unsigned long)@Base" 0.16.0 -#MISSING: 0.16.0-7# (c++|optional=gcc-4.8)"LibRaw_abstract_datastream::~LibRaw_abstract_datastream()@Base" 0.16.0 - (c++)"LibRaw_bigfile_datastream::LibRaw_bigfile_datastream(char const*)@Base" 0.16.0 - (c++)"LibRaw_bigfile_datastream::eof()@Base" 0.16.0 - (c++)"LibRaw_bigfile_datastream::fname()@Base" 0.16.0 - (c++)"LibRaw_bigfile_datastream::get_char()@Base" 0.16.0 - (c++)"LibRaw_bigfile_datastream::gets(char*, int)@Base" 0.16.0 - (c++)"LibRaw_bigfile_datastream::jpeg_src(void*)@Base" 0.16.0 - (c++)"LibRaw_bigfile_datastream::make_jas_stream()@Base" 0.16.0 - (c++|arch=alpha amd64 arm64 kfreebsd-amd64 mips64 mips64el ppc64 ppc64el s390x sparc64)"LibRaw_bigfile_datastream::read(void*, unsigned long, unsigned long)@Base" 0.16.0 - (c++)"LibRaw_bigfile_datastream::scanf_one(char const*, void*)@Base" 0.16.0 - (c++)"LibRaw_bigfile_datastream::seek(long long, int)@Base" 0.16.0 - (c++)"LibRaw_bigfile_datastream::size()@Base" 0.16.0 - (c++)"LibRaw_bigfile_datastream::subfile_close()@Base" 0.16.0 - (c++)"LibRaw_bigfile_datastream::subfile_open(char const*)@Base" 0.16.0 - (c++)"LibRaw_bigfile_datastream::tell()@Base" 0.16.0 - (c++)"LibRaw_bigfile_datastream::valid()@Base" 0.16.0 - (c++)"LibRaw_bigfile_datastream::~LibRaw_bigfile_datastream()@Base" 0.16.0 - (c++|arch=alpha amd64 arm64 kfreebsd-amd64 mips64 mips64el ppc64 ppc64el s390x sparc64)"LibRaw_buffer_datastream::LibRaw_buffer_datastream(void*, unsigned long)@Base" 0.16.0 - (c++)"LibRaw_buffer_datastream::eof()@Base" 0.16.0 - (c++)"LibRaw_buffer_datastream::get_char()@Base" 0.16.0 - (c++)"LibRaw_buffer_datastream::gets(char*, int)@Base" 0.16.0 - (c++)"LibRaw_buffer_datastream::jpeg_src(void*)@Base" 0.16.0 - (c++)"LibRaw_buffer_datastream::make_jas_stream()@Base" 0.16.0 - (c++|arch=alpha amd64 arm64 kfreebsd-amd64 mips64 mips64el ppc64 ppc64el s390x sparc64)"LibRaw_buffer_datastream::read(void*, unsigned long, unsigned long)@Base" 0.16.0 - (c++)"LibRaw_buffer_datastream::scanf_one(char const*, void*)@Base" 0.16.0 - (c++)"LibRaw_buffer_datastream::seek(long long, int)@Base" 0.16.0 - (c++)"LibRaw_buffer_datastream::size()@Base" 0.16.0 - (c++)"LibRaw_buffer_datastream::tell()@Base" 0.16.0 - (c++)"LibRaw_buffer_datastream::valid()@Base" 0.16.0 - (c++)"LibRaw_buffer_datastream::~LibRaw_buffer_datastream()@Base" 0.16.0 - (c++)"LibRaw_constants::d65_white@Base" 0.16.0 - (c++)"LibRaw_constants::xyz_rgb@Base" 0.16.0 - (c++)"LibRaw_file_datastream::LibRaw_file_datastream(char const*)@Base" 0.16.0 - (c++)"LibRaw_file_datastream::eof()@Base" 0.16.0 - (c++)"LibRaw_file_datastream::fname()@Base" 0.16.0 - (c++)"LibRaw_file_datastream::get_char()@Base" 0.16.0 - (c++)"LibRaw_file_datastream::gets(char*, int)@Base" 0.16.0 - (c++)"LibRaw_file_datastream::jpeg_src(void*)@Base" 0.16.0 - (c++)"LibRaw_file_datastream::make_jas_stream()@Base" 0.16.0 - (c++|arch=alpha amd64 arm64 kfreebsd-amd64 mips64 mips64el ppc64 ppc64el s390x sparc64)"LibRaw_file_datastream::read(void*, unsigned long, unsigned long)@Base" 0.16.0 - (c++)"LibRaw_file_datastream::scanf_one(char const*, void*)@Base" 0.16.0 - (c++)"LibRaw_file_datastream::seek(long long, int)@Base" 0.16.0 - (c++)"LibRaw_file_datastream::size()@Base" 0.16.0 - (c++)"LibRaw_file_datastream::subfile_close()@Base" 0.16.0 - (c++)"LibRaw_file_datastream::subfile_open(char const*)@Base" 0.16.0 - (c++)"LibRaw_file_datastream::tell()@Base" 0.16.0 - (c++)"LibRaw_file_datastream::valid()@Base" 0.16.0 - (c++)"LibRaw_file_datastream::~LibRaw_file_datastream()@Base" 0.16.0 - (c++|arch=!alpha !amd64 !arm64 !kfreebsd-amd64 !mips64 !mips64el !ppc64 !ppc64el !s390x !sparc64)"LibRaw_file_datastream::read(void*, unsigned int, unsigned int)@Base" 0.16.0 - (c++|arch=!alpha !amd64 !arm64 !kfreebsd-amd64 !mips64 !mips64el !ppc64 !ppc64el !s390x !sparc64)"LibRaw_buffer_datastream::read(void*, unsigned int, unsigned int)@Base" 0.16.0 - (c++|arch=!alpha !amd64 !arm64 !kfreebsd-amd64 !mips64 !mips64el !ppc64 !ppc64el !s390x !sparc64)"LibRaw_buffer_datastream::LibRaw_buffer_datastream(void*, unsigned int)@Base" 0.16.0 - (c++|arch=!alpha !amd64 !arm64 !kfreebsd-amd64 !mips64 !mips64el !ppc64 !ppc64el !s390x !sparc64)"LibRaw_bigfile_datastream::read(void*, unsigned int, unsigned int)@Base" 0.16.0 - (c++|arch=!alpha !amd64 !arm64 !kfreebsd-amd64 !mips64 !mips64el !ppc64 !ppc64el !s390x !sparc64)"LibRaw_abstract_datastream::tempbuffer_open(void*, unsigned int)@Base" 0.16.0 - (c++|arch=!alpha !amd64 !arm64 !kfreebsd-amd64 !mips64 !mips64el !ppc64 !ppc64el !s390x !sparc64)"LibRaw::open_buffer(void*, unsigned int)@Base" 0.16.0 - (c++|arch=!alpha !amd64 !arm64 !kfreebsd-amd64 !mips64 !mips64el !ppc64 !ppc64el !s390x !sparc64)"LibRaw::calloc(unsigned int, unsigned int)@Base" 0.16.0 - (c++|arch=!alpha !amd64 !arm64 !kfreebsd-amd64 !mips64 !mips64el !ppc64 !ppc64el !s390x !sparc64)"LibRaw::malloc(unsigned int)@Base" 0.16.0 - (c++|arch=!alpha !amd64 !arm64 !kfreebsd-amd64 !mips64 !mips64el !ppc64 !ppc64el !s390x !sparc64)"LibRaw::realloc(void*, unsigned int)@Base" 0.16.0 - (c++|optional=gcc-4.9)"std::ctype::do_widen(char) const@Base" 0.16.0 - default_data_callback@Base 0.16.0 - default_memory_callback@Base 0.16.0 - foveon_data@Base 0.16.0 - libraw_COLOR@Base 0.16.0 - libraw_adjust_sizes_info_only@Base 0.16.0 - libraw_cameraCount@Base 0.16.0 - libraw_cameraList@Base 0.16.0 - libraw_close@Base 0.16.0 - libraw_dcraw_clear_mem@Base 0.16.0 - libraw_dcraw_make_mem_image@Base 0.16.0 - libraw_dcraw_make_mem_thumb@Base 0.16.0 - libraw_dcraw_ppm_tiff_writer@Base 0.16.0 - libraw_dcraw_process@Base 0.16.0 - libraw_dcraw_thumb_writer@Base 0.16.0 - libraw_free_image@Base 0.16.0 - libraw_get_decoder_info@Base 0.16.0 - libraw_init@Base 0.16.0 - libraw_open_buffer@Base 0.16.0 - libraw_open_file@Base 0.16.0 - libraw_open_file_ex@Base 0.16.0 - libraw_raw2image@Base 0.16.0 - libraw_recycle@Base 0.16.0 - libraw_recycle_datastream@Base 0.16.0 - libraw_set_dataerror_handler@Base 0.16.0 - libraw_set_memerror_handler@Base 0.16.0 - libraw_set_progress_handler@Base 0.16.0 - libraw_strerror@Base 0.16.0 - libraw_strprogress@Base 0.16.0 - libraw_subtract_black@Base 0.16.0 - libraw_unpack@Base 0.16.0 - libraw_unpack_function_name@Base 0.16.0 - libraw_unpack_thumb@Base 0.16.0 - libraw_version@Base 0.16.0 - libraw_versionNumber@Base 0.16.0 - (c++)"set_bit_state(bit_state_s*, unsigned char*)@Base" 0.16.0 - (c++)"typeinfo for LibRaw@Base" 0.16.0 - (c++)"typeinfo for LibRaw_abstract_datastream@Base" 0.16.0 - (c++)"typeinfo for LibRaw_bigfile_datastream@Base" 0.16.0 - (c++)"typeinfo for LibRaw_buffer_datastream@Base" 0.16.0 - (c++)"typeinfo for LibRaw_exceptions@Base" 0.16.0 - (c++)"typeinfo for LibRaw_file_datastream@Base" 0.16.0 - (c++)"typeinfo name for LibRaw@Base" 0.16.0 - (c++)"typeinfo name for LibRaw_abstract_datastream@Base" 0.16.0 - (c++)"typeinfo name for LibRaw_bigfile_datastream@Base" 0.16.0 - (c++)"typeinfo name for LibRaw_buffer_datastream@Base" 0.16.0 - (c++)"typeinfo name for LibRaw_exceptions@Base" 0.16.0 - (c++)"typeinfo name for LibRaw_file_datastream@Base" 0.16.0 - (c++)"vtable for LibRaw@Base" 0.16.0 - (c++)"vtable for LibRaw_abstract_datastream@Base" 0.16.0 - (c++)"vtable for LibRaw_bigfile_datastream@Base" 0.16.0 - (c++)"vtable for LibRaw_buffer_datastream@Base" 0.16.0 - (c++)"vtable for LibRaw_file_datastream@Base" 0.16.0 - (c++)"x3f_clear(void*)@Base" 0.16.0 - (c++)"x3f_delete(x3f_s*)@Base" 0.16.0 - (c++)"x3f_dump_raw_data(x3f_s*, char*)@Base" 0.16.0 - (c++)"x3f_get4(LibRaw_abstract_datastream*)@Base" 0.16.0 - (c++)"x3f_get_camf(x3f_s*)@Base" 0.16.0 - (c++)"x3f_get_prop(x3f_s*)@Base" 0.16.0 - (c++)"x3f_get_raw(x3f_s*)@Base" 0.16.0 - (c++)"x3f_get_thumb_huffman(x3f_s*)@Base" 0.16.0 - (c++)"x3f_get_thumb_jpeg(x3f_s*)@Base" 0.16.0 - (c++)"x3f_get_thumb_plain(x3f_s*)@Base" 0.16.0 - (c++)"x3f_load_data(x3f_s*, x3f_directory_entry_s*)@Base" 0.16.0 - (c++)"x3f_load_image_block(x3f_s*, x3f_directory_entry_s*)@Base" 0.16.0 - (c++)"x3f_new_from_file(LibRaw_abstract_datastream*)@Base" 0.16.0 - (c++)"x3f_sget4(unsigned char*)@Base" 0.16.0 -libraw_r.so.10 libraw10 #MINVER# - (c++)"AAHD::AAHD(LibRaw&)@Base" 0.16.0 - (c++)"AAHD::combine_image()@Base" 0.16.0 - (c++)"AAHD::evaluate_ahd()@Base" 0.16.0 - (c++)"AAHD::gammaLUT@Base" 0.16.0 - (c++)"AAHD::hide_hots()@Base" 0.16.0 - (c++)"AAHD::illustrate_dirs()@Base" 0.16.0 - (c++)"AAHD::illustrate_dline(int)@Base" 0.16.0 - (c++)"AAHD::make_ahd_gline(int)@Base" 0.16.0 - (c++)"AAHD::make_ahd_greens()@Base" 0.16.0 - (c++)"AAHD::make_ahd_rb()@Base" 0.16.0 - (c++)"AAHD::make_ahd_rb_hv(int)@Base" 0.16.0 - (c++)"AAHD::make_ahd_rb_last(int)@Base" 0.16.0 - (c++)"AAHD::refine_hv_dirs()@Base" 0.16.0 - (c++)"AAHD::refine_hv_dirs(int, int)@Base" 0.16.0 - (c++)"AAHD::refine_ihv_dirs(int)@Base" 0.16.0 - (c++)"AAHD::yuv_coeff@Base" 0.16.0 - (c++)"AAHD::~AAHD()@Base" 0.16.0 - (c++)"DHT::DHT(LibRaw&)@Base" 0.16.0 - (c++)"DHT::copy_to_image()@Base" 0.16.0 - (c++)"DHT::hide_hots()@Base" 0.16.0 - (c++)"DHT::illustrate_dirs()@Base" 0.16.0 - (c++)"DHT::illustrate_dline(int)@Base" 0.16.0 - (c++)"DHT::make_diag_dirs()@Base" 0.16.0 - (c++)"DHT::make_diag_dline(int)@Base" 0.16.0 - (c++)"DHT::make_gline(int)@Base" 0.16.0 - (c++)"DHT::make_greens()@Base" 0.16.0 - (c++)"DHT::make_hv_dirs()@Base" 0.16.0 - (c++)"DHT::make_hv_dline(int)@Base" 0.16.0 - (c++)"DHT::make_rb()@Base" 0.16.0 - (c++)"DHT::make_rbdiag(int)@Base" 0.16.0 - (c++)"DHT::make_rbhv(int)@Base" 0.16.0 - (c++)"DHT::refine_diag_dirs(int, int)@Base" 0.16.0 - (c++)"DHT::refine_hv_dirs(int, int)@Base" 0.16.0 - (c++)"DHT::refine_idiag_dirs(int)@Base" 0.16.0 - (c++)"DHT::refine_ihv_dirs(int)@Base" 0.16.0 - (c++)"DHT::restore_hots()@Base" 0.16.0 - (c++)"DHT::~DHT()@Base" 0.16.0 - (c++)"LibRaw::CA_correct_RT(float, float)@Base" 0.16.0 - (c++)"LibRaw::LibRaw(unsigned int)@Base" 0.16.0 - (c++)"LibRaw::aahd_interpolate()@Base" 0.16.0 - (c++)"LibRaw::adjust_bl()@Base" 0.16.0 - (c++)"LibRaw::adjust_maximum()@Base" 0.16.0 - (c++)"LibRaw::adjust_sizes_info_only()@Base" 0.16.0 - (c++)"LibRaw::adobe_coeff(char const*, char const*)@Base" 0.16.0 - (c++)"LibRaw::adobe_copy_pixel(unsigned int, unsigned int, unsigned short**)@Base" 0.16.0 - (c++)"LibRaw::afd_interpolate_pl(int, int)@Base" 0.16.0 - (c++)"LibRaw::ahd_interpolate()@Base" 0.16.0 - (c++)"LibRaw::ahd_interpolate_build_homogeneity_map(int, int, short (*) [512][512][3], char (*) [512][2])@Base" 0.16.0 - (c++)"LibRaw::ahd_interpolate_combine_homogeneous_pixels(int, int, unsigned short (*) [512][512][3], char (*) [512][2])@Base" 0.16.0 - (c++)"LibRaw::ahd_interpolate_green_h_and_v(int, int, unsigned short (*) [512][512][3])@Base" 0.16.0 - (c++)"LibRaw::ahd_interpolate_mod()@Base" 0.16.0 - (c++)"LibRaw::ahd_interpolate_r_and_b_and_convert_to_cielab(int, int, unsigned short (*) [512][512][3], short (*) [512][512][3])@Base" 0.16.0 - (c++)"LibRaw::ahd_interpolate_r_and_b_in_rgb_and_convert_to_cielab(int, int, unsigned short (*) [512][3], short (*) [512][3])@Base" 0.16.0 - (c++)"LibRaw::amaze_demosaic_RT()@Base" 0.16.0 - (c++)"LibRaw::apply_profile(char const*, char const*)@Base" 0.16.0 - (c++)"LibRaw::apply_tiff()@Base" 0.16.0 - (c++)"LibRaw::bad_pixels(char const*)@Base" 0.16.0 - (c++)"LibRaw::blend_highlights()@Base" 0.16.0 - (c++)"LibRaw::border_interpolate(int)@Base" 0.16.0 - (c++|arch=alpha amd64 arm64 kfreebsd-amd64 mips64 mips64el ppc64 ppc64el s390x sparc64)"LibRaw::calloc(unsigned long, unsigned long)@Base" 0.16.0 - (c++)"LibRaw::cam_xyz_coeff(double (*) [3])@Base" 0.16.0 - (c++)"LibRaw::cameraCount()@Base" 0.16.0 - (c++)"LibRaw::cameraList()@Base" 0.16.0 - (c++)"LibRaw::canon_600_auto_wb()@Base" 0.16.0 - (c++)"LibRaw::canon_600_coeff()@Base" 0.16.0 - (c++)"LibRaw::canon_600_color(int*, int)@Base" 0.16.0 - (c++)"LibRaw::canon_600_correct()@Base" 0.16.0 - (c++)"LibRaw::canon_600_fixed_wb(int)@Base" 0.16.0 - (c++)"LibRaw::canon_600_load_raw()@Base" 0.16.0 - (c++)"LibRaw::canon_has_lowbits()@Base" 0.16.0 - (c++)"LibRaw::canon_load_raw()@Base" 0.16.0 - (c++)"LibRaw::canon_rmf_load_raw()@Base" 0.16.0 - (c++)"LibRaw::canon_s2is()@Base" 0.16.0 - (c++)"LibRaw::canon_sraw_load_raw()@Base" 0.16.0 - (c++)"LibRaw::cfa_impulse_gauss(float, float)@Base" 0.16.0 - (c++)"LibRaw::cfa_linedn(float)@Base" 0.16.0 - (c++)"LibRaw::checkCancel()@Base" 0.16.0 - (c++)"LibRaw::cielab(unsigned short*, short*)@Base" 0.16.0 - (c++)"LibRaw::ciff_block_1030()@Base" 0.16.0 - (c++)"LibRaw::convert_to_rgb()@Base" 0.16.0 - (c++)"LibRaw::convert_to_rgb_loop(float (*) [4])@Base" 0.16.0 - (c++)"LibRaw::copy_bayer(unsigned short*, unsigned short*)@Base" 0.16.0 - (c++)"LibRaw::copy_fuji_uncropped(unsigned short*, unsigned short*)@Base" 0.16.0 - (c++)"LibRaw::copy_mem_image(void*, int, int)@Base" 0.16.0 - (c++)"LibRaw::crop_masked_pixels()@Base" 0.16.0 - (c++)"LibRaw::crw_init_tables(unsigned int, unsigned short**)@Base" 0.16.0 - (c++)"LibRaw::dcb(int, int)@Base" 0.16.0 - (c++)"LibRaw::dcb_color()@Base" 0.16.0 - (c++)"LibRaw::dcb_color2(float (*) [3])@Base" 0.16.0 - (c++)"LibRaw::dcb_color3(float (*) [3])@Base" 0.16.0 - (c++)"LibRaw::dcb_color_full()@Base" 0.16.0 - (c++)"LibRaw::dcb_copy_to_buffer(float (*) [3])@Base" 0.16.0 - (c++)"LibRaw::dcb_correction()@Base" 0.16.0 - (c++)"LibRaw::dcb_correction2()@Base" 0.16.0 - (c++)"LibRaw::dcb_decide(float (*) [3], float (*) [3])@Base" 0.16.0 - (c++)"LibRaw::dcb_hor(float (*) [3])@Base" 0.16.0 - (c++)"LibRaw::dcb_map()@Base" 0.16.0 - (c++)"LibRaw::dcb_nyquist()@Base" 0.16.0 - (c++)"LibRaw::dcb_pp()@Base" 0.16.0 - (c++)"LibRaw::dcb_refinement()@Base" 0.16.0 - (c++)"LibRaw::dcb_restore_from_buffer(float (*) [3])@Base" 0.16.0 - (c++)"LibRaw::dcb_ver(float (*) [3])@Base" 0.16.0 - (c++)"LibRaw::dcraw_clear_mem(libraw_processed_image_t*)@Base" 0.16.0 - (c++)"LibRaw::dcraw_make_mem_image(int*)@Base" 0.16.0 - (c++)"LibRaw::dcraw_make_mem_thumb(int*)@Base" 0.16.0 - (c++)"LibRaw::dcraw_ppm_tiff_writer(char const*)@Base" 0.16.0 - (c++)"LibRaw::dcraw_process()@Base" 0.16.0 - (c++)"LibRaw::dcraw_thumb_writer(char const*)@Base" 0.16.0 - (c++)"LibRaw::derror()@Base" 0.16.0 - (c++)"LibRaw::dht_interpolate()@Base" 0.16.0 - (c++)"LibRaw::eight_bit_load_raw()@Base" 0.16.0 - (c++)"LibRaw::es_median_filter()@Base" 0.16.0 - (c++)"LibRaw::exp_bef(float, float)@Base" 0.16.0 - (c++)"LibRaw::fbdd(int)@Base" 0.16.0 - (c++)"LibRaw::fbdd_correction()@Base" 0.16.0 - (c++)"LibRaw::fbdd_correction2(double (*) [3])@Base" 0.16.0 - (c++)"LibRaw::fbdd_green()@Base" 0.16.0 - (c++)"LibRaw::fcol(int, int)@Base" 0.16.0 - (c++)"LibRaw::fill_holes(int)@Base" 0.16.0 - (c++)"LibRaw::find_green(int, int, int, int)@Base" 0.16.0 - (c++)"LibRaw::fix_after_rawspeed(int)@Base" 0.16.0 - (c++)"LibRaw::flip_index(int, int)@Base" 0.16.0 - (c++)"LibRaw::free(void*)@Base" 0.16.0 - (c++)"LibRaw::free_image()@Base" 0.16.0 - (c++)"LibRaw::fuji_rotate()@Base" 0.16.0 - (c++)"LibRaw::gamma_curve(double, double, int, int)@Base" 0.16.0 - (c++)"LibRaw::get2()@Base" 0.16.0 - (c++)"LibRaw::get4()@Base" 0.16.0 - (c++)"LibRaw::get_decoder_info(libraw_decoder_info_t*)@Base" 0.16.0 - (c++)"LibRaw::get_mem_image_format(int*, int*, int*, int*) const@Base" 0.16.0 - (c++)"LibRaw::get_timestamp(int)@Base" 0.16.0 - (c++)"LibRaw::getbithuff(int, unsigned short*)@Base" 0.16.0 - (c++)"LibRaw::getint(int)@Base" 0.16.0 - (c++)"LibRaw::getreal(int)@Base" 0.16.0 - (c++)"LibRaw::green_equilibrate(float)@Base" 0.16.0 - (c++)"LibRaw::green_matching()@Base" 0.16.0 - (c++)"LibRaw::guess_byte_order(int)@Base" 0.16.0 - (c++)"LibRaw::hasselblad_full_load_raw()@Base" 0.16.0 - (c++)"LibRaw::hasselblad_load_raw()@Base" 0.16.0 - (c++)"LibRaw::hat_transform(float*, float*, int, int, int)@Base" 0.16.0 - (c++)"LibRaw::identify()@Base" 0.16.0 - (c++)"LibRaw::imacon_full_load_raw()@Base" 0.16.0 - (c++)"LibRaw::int_to_float(int)@Base" 0.16.0 - (c++)"LibRaw::is_phaseone_compressed()@Base" 0.16.0 - (c++)"LibRaw::is_sraw()@Base" 0.16.0 - (c++)"LibRaw::jpeg_thumb()@Base" 0.16.0 - (c++)"LibRaw::jpeg_thumb_writer(_IO_FILE*, char*, int)@Base" 0.16.0 - (c++)"LibRaw::kodak_262_load_raw()@Base" 0.16.0 - (c++)"LibRaw::kodak_65000_decode(short*, int)@Base" 0.16.0 - (c++)"LibRaw::kodak_65000_load_raw()@Base" 0.16.0 - (c++)"LibRaw::kodak_dc120_load_raw()@Base" 0.16.0 - (c++)"LibRaw::kodak_jpeg_load_raw()@Base" 0.16.0 - (c++)"LibRaw::kodak_radc_load_raw()@Base" 0.16.0 - (c++)"LibRaw::kodak_rgb_load_raw()@Base" 0.16.0 - (c++)"LibRaw::kodak_thumb_load_raw()@Base" 0.16.0 - (c++)"LibRaw::kodak_thumb_loader()@Base" 0.16.0 - (c++)"LibRaw::kodak_ycbcr_load_raw()@Base" 0.16.0 - (c++)"LibRaw::kodak_yrgb_load_raw()@Base" 0.16.0 - (c++)"LibRaw::layer_thumb()@Base" 0.16.0 - (c++)"LibRaw::lch_to_rgb(double (*) [3])@Base" 0.16.0 - (c++)"LibRaw::leaf_hdr_load_raw()@Base" 0.16.0 - (c++)"LibRaw::lin_interpolate()@Base" 0.16.0 - (c++)"LibRaw::lin_interpolate_loop(int (*) [16][32], int)@Base" 0.16.0 - (c++)"LibRaw::linear_table(unsigned int)@Base" 0.16.0 - (c++)"LibRaw::ljpeg_diff(unsigned short*)@Base" 0.16.0 - (c++)"LibRaw::ljpeg_end(jhead*)@Base" 0.16.0 - (c++)"LibRaw::ljpeg_row(int, jhead*)@Base" 0.16.0 - (c++)"LibRaw::ljpeg_start(jhead*, int)@Base" 0.16.0 - (c++)"LibRaw::lmmse_interpolate(int)@Base" 0.16.0 - (c++)"LibRaw::lossless_dng_load_raw()@Base" 0.16.0 - (c++)"LibRaw::lossless_jpeg_load_raw()@Base" 0.16.0 - (c++)"LibRaw::lossy_dng_load_raw()@Base" 0.16.0 - (c++)"LibRaw::make_decoder(unsigned char const*)@Base" 0.16.0 - (c++)"LibRaw::make_decoder_ref(unsigned char const**)@Base" 0.16.0 - (c++|arch=alpha amd64 arm64 kfreebsd-amd64 mips64 mips64el ppc64 ppc64el s390x sparc64)"LibRaw::malloc(unsigned long)@Base" 0.16.0 - (c++)"LibRaw::median4(int*)@Base" 0.16.0 - (c++)"LibRaw::median_filter()@Base" 0.16.0 - (c++)"LibRaw::median_filter_new()@Base" 0.16.0 - (c++)"LibRaw::merror(void*, char const*)@Base" 0.16.0 - (c++)"LibRaw::minolta_rd175_load_raw()@Base" 0.16.0 - (c++)"LibRaw::minolta_z2()@Base" 0.16.0 - (c++)"LibRaw::nikon_3700()@Base" 0.16.0 - (c++)"LibRaw::nikon_e2100()@Base" 0.16.0 - (c++)"LibRaw::nikon_e995()@Base" 0.16.0 - (c++)"LibRaw::nikon_load_raw()@Base" 0.16.0 - (c++)"LibRaw::nokia_load_raw()@Base" 0.16.0 - (c++)"LibRaw::olympus_load_raw()@Base" 0.16.0 - (c++|arch=alpha amd64 arm64 kfreebsd-amd64 mips64 mips64el ppc64 ppc64el s390x sparc64)"LibRaw::open_buffer(void*, unsigned long)@Base" 0.16.0 - (c++)"LibRaw::open_datastream(LibRaw_abstract_datastream*)@Base" 0.16.0 - (c++)"LibRaw::open_file(char const*, long long)@Base" 0.16.0 - (c++)"LibRaw::packed_dng_load_raw()@Base" 0.16.0 - (c++)"LibRaw::packed_load_raw()@Base" 0.16.0 - (c++)"LibRaw::pana_bits(int)@Base" 0.16.0 - (c++)"LibRaw::panasonic_load_raw()@Base" 0.16.0 - (c++)"LibRaw::parse_ciff(int, int, int)@Base" 0.16.0 - (c++)"LibRaw::parse_cine()@Base" 0.16.0 - (c++)"LibRaw::parse_exif(int)@Base" 0.16.0 - (c++)"LibRaw::parse_external_jpeg()@Base" 0.16.0 - (c++)"LibRaw::parse_fuji(int)@Base" 0.16.0 - (c++)"LibRaw::parse_gps(int)@Base" 0.16.0 - (c++)"LibRaw::parse_jpeg(int)@Base" 0.16.0 - (c++)"LibRaw::parse_kodak_ifd(int)@Base" 0.16.0 - (c++)"LibRaw::parse_makernote(int, int)@Base" 0.16.0 - (c++)"LibRaw::parse_minolta(int)@Base" 0.16.0 - (c++)"LibRaw::parse_mos(int)@Base" 0.16.0 - (c++)"LibRaw::parse_phase_one(int)@Base" 0.16.0 - (c++)"LibRaw::parse_redcine()@Base" 0.16.0 - (c++)"LibRaw::parse_riff()@Base" 0.16.0 - (c++)"LibRaw::parse_rollei()@Base" 0.16.0 - (c++)"LibRaw::parse_sinar_ia()@Base" 0.16.0 - (c++)"LibRaw::parse_smal(int, int)@Base" 0.16.0 - (c++)"LibRaw::parse_thumb_note(int, unsigned int, unsigned int)@Base" 0.16.0 - (c++)"LibRaw::parse_tiff(int)@Base" 0.16.0 - (c++)"LibRaw::parse_tiff_ifd(int)@Base" 0.16.0 - (c++)"LibRaw::parse_x3f()@Base" 0.16.0 - (c++)"LibRaw::pentax_load_raw()@Base" 0.16.0 - (c++)"LibRaw::ph1_bithuff(int, unsigned short*)@Base" 0.16.0 - (c++)"LibRaw::phase_one_allocate_tempbuffer()@Base" 0.16.0 - (c++)"LibRaw::phase_one_correct()@Base" 0.16.0 - (c++)"LibRaw::phase_one_flat_field(int, int)@Base" 0.16.0 - (c++)"LibRaw::phase_one_free_tempbuffer()@Base" 0.16.0 - (c++)"LibRaw::phase_one_load_raw()@Base" 0.16.0 - (c++)"LibRaw::phase_one_load_raw_c()@Base" 0.16.0 - (c++)"LibRaw::phase_one_subtract_black(unsigned short*, unsigned short*)@Base" 0.16.0 - (c++)"LibRaw::ppg_interpolate()@Base" 0.16.0 - (c++)"LibRaw::ppm16_thumb()@Base" 0.16.0 - (c++)"LibRaw::ppm_thumb()@Base" 0.16.0 - (c++)"LibRaw::pre_interpolate()@Base" 0.16.0 - (c++)"LibRaw::pseudoinverse(double (*) [3], double (*) [3], int)@Base" 0.16.0 - (c++)"LibRaw::quicktake_100_load_raw()@Base" 0.16.0 - (c++)"LibRaw::raw(unsigned int, unsigned int)@Base" 0.16.0 - (c++)"LibRaw::raw2image()@Base" 0.16.0 - (c++)"LibRaw::raw2image_ex(int)@Base" 0.16.0 - (c++)"LibRaw::raw2image_start()@Base" 0.16.0 - (c++)"LibRaw::read_shorts(unsigned short*, int)@Base" 0.16.0 - (c++|arch=alpha amd64 arm64 kfreebsd-amd64 mips64 mips64el ppc64 ppc64el s390x sparc64)"LibRaw::realloc(void*, unsigned long)@Base" 0.16.0 - (c++)"LibRaw::recover_highlights()@Base" 0.16.0 - (c++)"LibRaw::recycle()@Base" 0.16.0 - (c++)"LibRaw::recycle_datastream()@Base" 0.16.0 - (c++)"LibRaw::redcine_load_raw()@Base" 0.16.0 - (c++)"LibRaw::refinement()@Base" 0.16.0 - (c++)"LibRaw::remove_zeroes()@Base" 0.16.0 - (c++)"LibRaw::rgb_to_lch(double (*) [3])@Base" 0.16.0 - (c++)"LibRaw::rollei_load_raw()@Base" 0.16.0 - (c++)"LibRaw::rollei_thumb()@Base" 0.16.0 - (c++)"LibRaw::romm_coeff(float (*) [3])@Base" 0.16.0 - (c++)"LibRaw::samsung_load_raw()@Base" 0.16.0 - (c++)"LibRaw::scale_colors()@Base" 0.16.0 - (c++)"LibRaw::scale_colors_loop(float*)@Base" 0.16.0 - (c++)"LibRaw::setCancelFlag()@Base" 0.16.0 - (c++)"LibRaw::set_rawspeed_camerafile(char*)@Base" 0.16.0 - (c++)"LibRaw::sget2(unsigned char*)@Base" 0.16.0 - (c++)"LibRaw::sget4(unsigned char*)@Base" 0.16.0 - (c++)"LibRaw::simple_coeff(int)@Base" 0.16.0 - (c++)"LibRaw::sinar_4shot_load_raw()@Base" 0.16.0 - (c++)"LibRaw::smal_decode_segment(unsigned int (*) [2], int)@Base" 0.16.0 - (c++)"LibRaw::smal_v6_load_raw()@Base" 0.16.0 - (c++)"LibRaw::smal_v9_load_raw()@Base" 0.16.0 - (c++)"LibRaw::sony_arw2_load_raw()@Base" 0.16.0 - (c++)"LibRaw::sony_arw_load_raw()@Base" 0.16.0 - (c++)"LibRaw::sony_decrypt(unsigned int*, int, int, int)@Base" 0.16.0 - (c++)"LibRaw::sony_load_raw()@Base" 0.16.0 - (c++)"LibRaw::strerror(int)@Base" 0.16.0 - (c++)"LibRaw::stretch()@Base" 0.16.0 - (c++)"LibRaw::strprogress(LibRaw_progress)@Base" 0.16.0 - (c++)"LibRaw::subtract(char const*)@Base" 0.16.0 - (c++)"LibRaw::subtract_black()@Base" 0.16.0 - (c++)"LibRaw::subtract_black_internal()@Base" 0.16.0 - (c++)"LibRaw::tiff_get(unsigned int, unsigned int*, unsigned int*, unsigned int*, unsigned int*)@Base" 0.16.0 - (c++)"LibRaw::tiff_head(tiff_hdr*, int)@Base" 0.16.0 - (c++)"LibRaw::tiff_set(unsigned short*, unsigned short, unsigned short, int, int)@Base" 0.16.0 - (c++)"LibRaw::unpack()@Base" 0.16.0 - (c++)"LibRaw::unpack_function_name()@Base" 0.16.0 - (c++)"LibRaw::unpack_thumb()@Base" 0.16.0 - (c++)"LibRaw::unpacked_load_raw()@Base" 0.16.0 - (c++)"LibRaw::vcd_interpolate(int)@Base" 0.16.0 - (c++)"LibRaw::version()@Base" 0.16.0 - (c++)"LibRaw::versionNumber()@Base" 0.16.0 - (c++)"LibRaw::vng_interpolate()@Base" 0.16.0 - (c++)"LibRaw::wavelet_denoise()@Base" 0.16.0 - (c++)"LibRaw::wf_bayer4_block_filter(int*, void*, int, void*, int)@Base" 0.16.0 - (c++)"LibRaw::wf_bayer4_green_blur(int, void*, int, void*, int)@Base" 0.16.0 - (c++)"LibRaw::wf_bayer4_igauss_filter(int, void*, int, void*, int)@Base" 0.16.0 - (c++)"LibRaw::wf_filter_energy(int, int, int, int)@Base" 0.16.0 - (c++)"LibRaw::wf_remove_banding()@Base" 0.16.0 - (c++)"LibRaw::write_ppm_tiff()@Base" 0.16.0 - (c++)"LibRaw::x3f_load_raw()@Base" 0.16.0 - (c++)"LibRaw::x3f_thumb_loader()@Base" 0.16.0 - (c++)"LibRaw::xtrans_interpolate(int)@Base" 0.16.0 - (c++)"LibRaw::~LibRaw()@Base" 0.16.0 - (c++)"LibRaw_abstract_datastream::fname()@Base" 0.16.0 - (c++)"LibRaw_abstract_datastream::jpeg_src(void*)@Base" 0.16.0 - (c++)"LibRaw_abstract_datastream::subfile_close()@Base" 0.16.0 - (c++)"LibRaw_abstract_datastream::subfile_open(char const*)@Base" 0.16.0 - (c++)"LibRaw_abstract_datastream::tempbuffer_close()@Base" 0.16.0 - (c++|arch=alpha amd64 arm64 kfreebsd-amd64 mips64 mips64el ppc64 ppc64el s390x sparc64)"LibRaw_abstract_datastream::tempbuffer_open(void*, unsigned long)@Base" 0.16.0 -#MISSING: 0.16.0-7# (c++|optional=gcc-4.8)"LibRaw_abstract_datastream::~LibRaw_abstract_datastream()@Base" 0.16.0 - (c++)"LibRaw_bigfile_datastream::LibRaw_bigfile_datastream(char const*)@Base" 0.16.0 - (c++)"LibRaw_bigfile_datastream::eof()@Base" 0.16.0 - (c++)"LibRaw_bigfile_datastream::fname()@Base" 0.16.0 - (c++)"LibRaw_bigfile_datastream::get_char()@Base" 0.16.0 - (c++)"LibRaw_bigfile_datastream::gets(char*, int)@Base" 0.16.0 - (c++)"LibRaw_bigfile_datastream::jpeg_src(void*)@Base" 0.16.0 - (c++)"LibRaw_bigfile_datastream::make_jas_stream()@Base" 0.16.0 - (c++|arch=alpha amd64 arm64 kfreebsd-amd64 mips64 mips64el ppc64 ppc64el s390x sparc64)"LibRaw_bigfile_datastream::read(void*, unsigned long, unsigned long)@Base" 0.16.0 - (c++)"LibRaw_bigfile_datastream::scanf_one(char const*, void*)@Base" 0.16.0 - (c++)"LibRaw_bigfile_datastream::seek(long long, int)@Base" 0.16.0 - (c++)"LibRaw_bigfile_datastream::size()@Base" 0.16.0 - (c++)"LibRaw_bigfile_datastream::subfile_close()@Base" 0.16.0 - (c++)"LibRaw_bigfile_datastream::subfile_open(char const*)@Base" 0.16.0 - (c++)"LibRaw_bigfile_datastream::tell()@Base" 0.16.0 - (c++)"LibRaw_bigfile_datastream::valid()@Base" 0.16.0 - (c++)"LibRaw_bigfile_datastream::~LibRaw_bigfile_datastream()@Base" 0.16.0 - (c++|arch=alpha amd64 arm64 kfreebsd-amd64 mips64 mips64el ppc64 ppc64el s390x sparc64)"LibRaw_buffer_datastream::LibRaw_buffer_datastream(void*, unsigned long)@Base" 0.16.0 - (c++)"LibRaw_buffer_datastream::eof()@Base" 0.16.0 - (c++)"LibRaw_buffer_datastream::get_char()@Base" 0.16.0 - (c++)"LibRaw_buffer_datastream::gets(char*, int)@Base" 0.16.0 - (c++)"LibRaw_buffer_datastream::jpeg_src(void*)@Base" 0.16.0 - (c++)"LibRaw_buffer_datastream::make_jas_stream()@Base" 0.16.0 - (c++|arch=alpha amd64 arm64 kfreebsd-amd64 mips64 mips64el ppc64 ppc64el s390x sparc64)"LibRaw_buffer_datastream::read(void*, unsigned long, unsigned long)@Base" 0.16.0 - (c++)"LibRaw_buffer_datastream::scanf_one(char const*, void*)@Base" 0.16.0 - (c++)"LibRaw_buffer_datastream::seek(long long, int)@Base" 0.16.0 - (c++)"LibRaw_buffer_datastream::size()@Base" 0.16.0 - (c++)"LibRaw_buffer_datastream::tell()@Base" 0.16.0 - (c++)"LibRaw_buffer_datastream::valid()@Base" 0.16.0 - (c++)"LibRaw_buffer_datastream::~LibRaw_buffer_datastream()@Base" 0.16.0 - (c++)"LibRaw_constants::d65_white@Base" 0.16.0 - (c++)"LibRaw_constants::xyz_rgb@Base" 0.16.0 - (c++)"LibRaw_file_datastream::LibRaw_file_datastream(char const*)@Base" 0.16.0 - (c++)"LibRaw_file_datastream::eof()@Base" 0.16.0 - (c++)"LibRaw_file_datastream::fname()@Base" 0.16.0 - (c++)"LibRaw_file_datastream::get_char()@Base" 0.16.0 - (c++)"LibRaw_file_datastream::gets(char*, int)@Base" 0.16.0 - (c++)"LibRaw_file_datastream::jpeg_src(void*)@Base" 0.16.0 - (c++)"LibRaw_file_datastream::make_jas_stream()@Base" 0.16.0 - (c++|arch=alpha amd64 arm64 kfreebsd-amd64 mips64 mips64el ppc64 ppc64el s390x sparc64)"LibRaw_file_datastream::read(void*, unsigned long, unsigned long)@Base" 0.16.0 - (c++)"LibRaw_file_datastream::scanf_one(char const*, void*)@Base" 0.16.0 - (c++)"LibRaw_file_datastream::seek(long long, int)@Base" 0.16.0 - (c++)"LibRaw_file_datastream::size()@Base" 0.16.0 - (c++)"LibRaw_file_datastream::subfile_close()@Base" 0.16.0 - (c++)"LibRaw_file_datastream::subfile_open(char const*)@Base" 0.16.0 - (c++)"LibRaw_file_datastream::tell()@Base" 0.16.0 - (c++)"LibRaw_file_datastream::valid()@Base" 0.16.0 - (c++)"LibRaw_file_datastream::~LibRaw_file_datastream()@Base" 0.16.0 - (c++|arch=!alpha !amd64 !arm64 !kfreebsd-amd64 !mips64 !mips64el !ppc64 !ppc64el !s390x !sparc64)"LibRaw_file_datastream::read(void*, unsigned int, unsigned int)@Base" 0.16.0 - (c++|arch=!alpha !amd64 !arm64 !kfreebsd-amd64 !mips64 !mips64el !ppc64 !ppc64el !s390x !sparc64)"LibRaw_buffer_datastream::read(void*, unsigned int, unsigned int)@Base" 0.16.0 - (c++|arch=!alpha !amd64 !arm64 !kfreebsd-amd64 !mips64 !mips64el !ppc64 !ppc64el !s390x !sparc64)"LibRaw_buffer_datastream::LibRaw_buffer_datastream(void*, unsigned int)@Base" 0.16.0 - (c++|arch=!alpha !amd64 !arm64 !kfreebsd-amd64 !mips64 !mips64el !ppc64 !ppc64el !s390x !sparc64)"LibRaw_bigfile_datastream::read(void*, unsigned int, unsigned int)@Base" 0.16.0 - (c++|arch=!alpha !amd64 !arm64 !kfreebsd-amd64 !mips64 !mips64el !ppc64 !ppc64el !s390x !sparc64)"LibRaw_abstract_datastream::tempbuffer_open(void*, unsigned int)@Base" 0.16.0 - (c++|arch=!alpha !amd64 !arm64 !kfreebsd-amd64 !mips64 !mips64el !ppc64 !ppc64el !s390x !sparc64)"LibRaw::open_buffer(void*, unsigned int)@Base" 0.16.0 - (c++|arch=!alpha !amd64 !arm64 !kfreebsd-amd64 !mips64 !mips64el !ppc64 !ppc64el !s390x !sparc64)"LibRaw::calloc(unsigned int, unsigned int)@Base" 0.16.0 - (c++|arch=!alpha !amd64 !arm64 !kfreebsd-amd64 !mips64 !mips64el !ppc64 !ppc64el !s390x !sparc64)"LibRaw::malloc(unsigned int)@Base" 0.16.0 - (c++|arch=!alpha !amd64 !arm64 !kfreebsd-amd64 !mips64 !mips64el !ppc64 !ppc64el !s390x !sparc64)"LibRaw::realloc(void*, unsigned int)@Base" 0.16.0 - (c++|optional=gcc-4.9)"std::ctype::do_widen(char) const@Base" 0.16.0 - default_data_callback@Base 0.16.0 - default_memory_callback@Base 0.16.0 - foveon_data@Base 0.16.0 - libraw_COLOR@Base 0.16.0 - libraw_adjust_sizes_info_only@Base 0.16.0 - libraw_cameraCount@Base 0.16.0 - libraw_cameraList@Base 0.16.0 - libraw_close@Base 0.16.0 - libraw_dcraw_clear_mem@Base 0.16.0 - libraw_dcraw_make_mem_image@Base 0.16.0 - libraw_dcraw_make_mem_thumb@Base 0.16.0 - libraw_dcraw_ppm_tiff_writer@Base 0.16.0 - libraw_dcraw_process@Base 0.16.0 - libraw_dcraw_thumb_writer@Base 0.16.0 - libraw_free_image@Base 0.16.0 - libraw_get_decoder_info@Base 0.16.0 - libraw_init@Base 0.16.0 - libraw_open_buffer@Base 0.16.0 - libraw_open_file@Base 0.16.0 - libraw_open_file_ex@Base 0.16.0 - libraw_raw2image@Base 0.16.0 - libraw_recycle@Base 0.16.0 - libraw_recycle_datastream@Base 0.16.0 - libraw_set_dataerror_handler@Base 0.16.0 - libraw_set_memerror_handler@Base 0.16.0 - libraw_set_progress_handler@Base 0.16.0 - libraw_strerror@Base 0.16.0 - libraw_strprogress@Base 0.16.0 - libraw_subtract_black@Base 0.16.0 - libraw_unpack@Base 0.16.0 - libraw_unpack_function_name@Base 0.16.0 - libraw_unpack_thumb@Base 0.16.0 - libraw_version@Base 0.16.0 - libraw_versionNumber@Base 0.16.0 - (c++)"set_bit_state(bit_state_s*, unsigned char*)@Base" 0.16.0 - (c++)"typeinfo for LibRaw@Base" 0.16.0 - (c++)"typeinfo for LibRaw_abstract_datastream@Base" 0.16.0 - (c++)"typeinfo for LibRaw_bigfile_datastream@Base" 0.16.0 - (c++)"typeinfo for LibRaw_buffer_datastream@Base" 0.16.0 - (c++)"typeinfo for LibRaw_exceptions@Base" 0.16.0 - (c++)"typeinfo for LibRaw_file_datastream@Base" 0.16.0 - (c++)"typeinfo name for LibRaw@Base" 0.16.0 - (c++)"typeinfo name for LibRaw_abstract_datastream@Base" 0.16.0 - (c++)"typeinfo name for LibRaw_bigfile_datastream@Base" 0.16.0 - (c++)"typeinfo name for LibRaw_buffer_datastream@Base" 0.16.0 - (c++)"typeinfo name for LibRaw_exceptions@Base" 0.16.0 - (c++)"typeinfo name for LibRaw_file_datastream@Base" 0.16.0 - (c++)"vtable for LibRaw@Base" 0.16.0 - (c++)"vtable for LibRaw_abstract_datastream@Base" 0.16.0 - (c++)"vtable for LibRaw_bigfile_datastream@Base" 0.16.0 - (c++)"vtable for LibRaw_buffer_datastream@Base" 0.16.0 - (c++)"vtable for LibRaw_file_datastream@Base" 0.16.0 - (c++)"x3f_clear(void*)@Base" 0.16.0 - (c++)"x3f_delete(x3f_s*)@Base" 0.16.0 - (c++)"x3f_dump_raw_data(x3f_s*, char*)@Base" 0.16.0 - (c++)"x3f_get4(LibRaw_abstract_datastream*)@Base" 0.16.0 - (c++)"x3f_get_camf(x3f_s*)@Base" 0.16.0 - (c++)"x3f_get_prop(x3f_s*)@Base" 0.16.0 - (c++)"x3f_get_raw(x3f_s*)@Base" 0.16.0 - (c++)"x3f_get_thumb_huffman(x3f_s*)@Base" 0.16.0 - (c++)"x3f_get_thumb_jpeg(x3f_s*)@Base" 0.16.0 - (c++)"x3f_get_thumb_plain(x3f_s*)@Base" 0.16.0 - (c++)"x3f_load_data(x3f_s*, x3f_directory_entry_s*)@Base" 0.16.0 - (c++)"x3f_load_image_block(x3f_s*, x3f_directory_entry_s*)@Base" 0.16.0 - (c++)"x3f_new_from_file(LibRaw_abstract_datastream*)@Base" 0.16.0 - (c++)"x3f_sget4(unsigned char*)@Base" 0.16.0 diff -Nru libraw-0.16.2/debian/libraw15.install libraw-0.17.0/debian/libraw15.install --- libraw-0.16.2/debian/libraw15.install 1970-01-01 00:00:00.000000000 +0000 +++ libraw-0.17.0/debian/libraw15.install 2015-09-02 12:25:30.000000000 +0000 @@ -0,0 +1 @@ +usr/lib/*/lib*so.* diff -Nru libraw-0.16.2/debian/libraw15.symbols libraw-0.17.0/debian/libraw15.symbols --- libraw-0.16.2/debian/libraw15.symbols 1970-01-01 00:00:00.000000000 +0000 +++ libraw-0.17.0/debian/libraw15.symbols 2015-10-16 08:02:05.000000000 +0000 @@ -0,0 +1,953 @@ +# SymbolsHelper-Confirmed: 0.16.0 alpha amd64 arm64 armel armhf hurd-i386 i386 kfreebsd-amd64 arm64 kfreebsd-i386 mips mipsel powerpc ppc64 ppc64el s390x sparc sparc64 +libraw.so.15 libraw15 #MINVER# + (c++)"AAHD::AAHD(LibRaw&)@Base" 0.16.0 + (c++)"AAHD::combine_image()@Base" 0.16.0 + (c++)"AAHD::evaluate_ahd()@Base" 0.16.0 + (c++)"AAHD::gammaLUT@Base" 0.16.0 + (c++)"AAHD::hide_hots()@Base" 0.16.0 + (c++)"AAHD::illustrate_dirs()@Base" 0.16.0 + (c++)"AAHD::illustrate_dline(int)@Base" 0.16.0 + (c++)"AAHD::make_ahd_gline(int)@Base" 0.16.0 + (c++)"AAHD::make_ahd_greens()@Base" 0.16.0 + (c++)"AAHD::make_ahd_rb()@Base" 0.16.0 + (c++)"AAHD::make_ahd_rb_hv(int)@Base" 0.16.0 + (c++)"AAHD::make_ahd_rb_last(int)@Base" 0.16.0 + (c++)"AAHD::refine_hv_dirs()@Base" 0.16.0 + (c++)"AAHD::refine_hv_dirs(int, int)@Base" 0.16.0 + (c++)"AAHD::refine_ihv_dirs(int)@Base" 0.16.0 + (c++)"AAHD::yuv_coeff@Base" 0.16.0 + (c++)"AAHD::~AAHD()@Base" 0.16.0 + (c++)"DHT::DHT(LibRaw&)@Base" 0.16.0 + (c++)"DHT::copy_to_image()@Base" 0.16.0 + (c++)"DHT::hide_hots()@Base" 0.16.0 + (c++)"DHT::illustrate_dirs()@Base" 0.16.0 + (c++)"DHT::illustrate_dline(int)@Base" 0.16.0 + (c++)"DHT::make_diag_dirs()@Base" 0.16.0 + (c++)"DHT::make_diag_dline(int)@Base" 0.16.0 + (c++)"DHT::make_gline(int)@Base" 0.16.0 + (c++)"DHT::make_greens()@Base" 0.16.0 + (c++)"DHT::make_hv_dirs()@Base" 0.16.0 + (c++)"DHT::make_hv_dline(int)@Base" 0.16.0 + (c++)"DHT::make_rb()@Base" 0.16.0 + (c++)"DHT::make_rbdiag(int)@Base" 0.16.0 + (c++)"DHT::make_rbhv(int)@Base" 0.16.0 + (c++)"DHT::refine_diag_dirs(int, int)@Base" 0.16.0 + (c++)"DHT::refine_hv_dirs(int, int)@Base" 0.16.0 + (c++)"DHT::refine_idiag_dirs(int)@Base" 0.16.0 + (c++)"DHT::refine_ihv_dirs(int)@Base" 0.16.0 + (c++)"DHT::restore_hots()@Base" 0.16.0 + (c++)"DHT::~DHT()@Base" 0.16.0 + (c++)"LibRaw::CA_correct_RT(float, float)@Base" 0.16.0 + (c++)"LibRaw::LibRaw(unsigned int)@Base" 0.16.0 + (c++)"LibRaw::aahd_interpolate()@Base" 0.16.0 + (c++)"LibRaw::adjust_bl()@Base" 0.16.0 + (c++)"LibRaw::adjust_maximum()@Base" 0.16.0 + (c++)"LibRaw::adjust_sizes_info_only()@Base" 0.16.0 +#MISSING: 0.17.0-1# (c++)"LibRaw::adobe_coeff(char const*, char const*)@Base" 0.16.0 + (c++)"LibRaw::adobe_copy_pixel(unsigned int, unsigned int, unsigned short**)@Base" 0.16.0 + (c++)"LibRaw::afd_interpolate_pl(int, int)@Base" 0.16.0 + (c++)"LibRaw::ahd_interpolate()@Base" 0.16.0 + (c++)"LibRaw::ahd_interpolate_build_homogeneity_map(int, int, short (*) [512][512][3], char (*) [512][2])@Base" 0.16.0 + (c++)"LibRaw::ahd_interpolate_combine_homogeneous_pixels(int, int, unsigned short (*) [512][512][3], char (*) [512][2])@Base" 0.16.0 + (c++)"LibRaw::ahd_interpolate_green_h_and_v(int, int, unsigned short (*) [512][512][3])@Base" 0.16.0 + (c++)"LibRaw::ahd_interpolate_mod()@Base" 0.16.0 + (c++)"LibRaw::ahd_interpolate_r_and_b_and_convert_to_cielab(int, int, unsigned short (*) [512][512][3], short (*) [512][512][3])@Base" 0.16.0 + (c++)"LibRaw::ahd_interpolate_r_and_b_in_rgb_and_convert_to_cielab(int, int, unsigned short (*) [512][3], short (*) [512][3])@Base" 0.16.0 + (c++)"LibRaw::amaze_demosaic_RT()@Base" 0.16.0 + (c++)"LibRaw::apply_profile(char const*, char const*)@Base" 0.16.0 + (c++)"LibRaw::apply_tiff()@Base" 0.16.0 + (c++)"LibRaw::bad_pixels(char const*)@Base" 0.16.0 + (c++)"LibRaw::blend_highlights()@Base" 0.16.0 + (c++)"LibRaw::border_interpolate(int)@Base" 0.16.0 + (c++|arch=alpha amd64 arm64 kfreebsd-amd64 mips64 mips64el ppc64 ppc64el s390x sparc64)"LibRaw::calloc(unsigned long, unsigned long)@Base" 0.16.0 +#MISSING: 0.17.0-1# (c++)"LibRaw::cam_xyz_coeff(double (*) [3])@Base" 0.16.0 + (c++)"LibRaw::cameraCount()@Base" 0.16.0 + (c++)"LibRaw::cameraList()@Base" 0.16.0 + (c++)"LibRaw::canon_600_auto_wb()@Base" 0.16.0 + (c++)"LibRaw::canon_600_coeff()@Base" 0.16.0 + (c++)"LibRaw::canon_600_color(int*, int)@Base" 0.16.0 + (c++)"LibRaw::canon_600_correct()@Base" 0.16.0 + (c++)"LibRaw::canon_600_fixed_wb(int)@Base" 0.16.0 + (c++)"LibRaw::canon_600_load_raw()@Base" 0.16.0 + (c++)"LibRaw::canon_has_lowbits()@Base" 0.16.0 + (c++)"LibRaw::canon_load_raw()@Base" 0.16.0 + (c++)"LibRaw::canon_rmf_load_raw()@Base" 0.16.0 + (c++)"LibRaw::canon_s2is()@Base" 0.16.0 + (c++)"LibRaw::canon_sraw_load_raw()@Base" 0.16.0 + (c++)"LibRaw::cfa_impulse_gauss(float, float)@Base" 0.16.0 + (c++)"LibRaw::cfa_linedn(float)@Base" 0.16.0 + (c++)"LibRaw::checkCancel()@Base" 0.16.0 + (c++)"LibRaw::cielab(unsigned short*, short*)@Base" 0.16.0 + (c++)"LibRaw::ciff_block_1030()@Base" 0.16.0 + (c++)"LibRaw::convert_to_rgb()@Base" 0.16.0 + (c++)"LibRaw::convert_to_rgb_loop(float (*) [4])@Base" 0.16.0 + (c++)"LibRaw::copy_bayer(unsigned short*, unsigned short*)@Base" 0.16.0 + (c++)"LibRaw::copy_fuji_uncropped(unsigned short*, unsigned short*)@Base" 0.16.0 + (c++)"LibRaw::copy_mem_image(void*, int, int)@Base" 0.16.0 + (c++)"LibRaw::crop_masked_pixels()@Base" 0.16.0 + (c++)"LibRaw::crw_init_tables(unsigned int, unsigned short**)@Base" 0.16.0 + (c++)"LibRaw::dcb(int, int)@Base" 0.16.0 + (c++)"LibRaw::dcb_color()@Base" 0.16.0 + (c++)"LibRaw::dcb_color2(float (*) [3])@Base" 0.16.0 + (c++)"LibRaw::dcb_color3(float (*) [3])@Base" 0.16.0 + (c++)"LibRaw::dcb_color_full()@Base" 0.16.0 + (c++)"LibRaw::dcb_copy_to_buffer(float (*) [3])@Base" 0.16.0 + (c++)"LibRaw::dcb_correction()@Base" 0.16.0 + (c++)"LibRaw::dcb_correction2()@Base" 0.16.0 + (c++)"LibRaw::dcb_decide(float (*) [3], float (*) [3])@Base" 0.16.0 + (c++)"LibRaw::dcb_hor(float (*) [3])@Base" 0.16.0 + (c++)"LibRaw::dcb_map()@Base" 0.16.0 + (c++)"LibRaw::dcb_nyquist()@Base" 0.16.0 + (c++)"LibRaw::dcb_pp()@Base" 0.16.0 + (c++)"LibRaw::dcb_refinement()@Base" 0.16.0 + (c++)"LibRaw::dcb_restore_from_buffer(float (*) [3])@Base" 0.16.0 + (c++)"LibRaw::dcb_ver(float (*) [3])@Base" 0.16.0 + (c++)"LibRaw::dcraw_clear_mem(libraw_processed_image_t*)@Base" 0.16.0 + (c++)"LibRaw::dcraw_make_mem_image(int*)@Base" 0.16.0 + (c++)"LibRaw::dcraw_make_mem_thumb(int*)@Base" 0.16.0 + (c++)"LibRaw::dcraw_ppm_tiff_writer(char const*)@Base" 0.16.0 + (c++)"LibRaw::dcraw_process()@Base" 0.16.0 + (c++)"LibRaw::dcraw_thumb_writer(char const*)@Base" 0.16.0 + (c++)"LibRaw::derror()@Base" 0.16.0 + (c++)"LibRaw::dht_interpolate()@Base" 0.16.0 + (c++)"LibRaw::eight_bit_load_raw()@Base" 0.16.0 + (c++)"LibRaw::es_median_filter()@Base" 0.16.0 + (c++)"LibRaw::exp_bef(float, float)@Base" 0.16.0 + (c++)"LibRaw::fbdd(int)@Base" 0.16.0 + (c++)"LibRaw::fbdd_correction()@Base" 0.16.0 + (c++)"LibRaw::fbdd_correction2(double (*) [3])@Base" 0.16.0 + (c++)"LibRaw::fbdd_green()@Base" 0.16.0 + (c++)"LibRaw::fcol(int, int)@Base" 0.16.0 + (c++)"LibRaw::fill_holes(int)@Base" 0.16.0 + (c++)"LibRaw::find_green(int, int, int, int)@Base" 0.16.0 + (c++)"LibRaw::fix_after_rawspeed(int)@Base" 0.16.0 + (c++)"LibRaw::flip_index(int, int)@Base" 0.16.0 + (c++)"LibRaw::free(void*)@Base" 0.16.0 + (c++)"LibRaw::free_image()@Base" 0.16.0 + (c++)"LibRaw::fuji_rotate()@Base" 0.16.0 + (c++)"LibRaw::gamma_curve(double, double, int, int)@Base" 0.16.0 + (c++)"LibRaw::get2()@Base" 0.16.0 + (c++)"LibRaw::get4()@Base" 0.16.0 + (c++)"LibRaw::get_decoder_info(libraw_decoder_info_t*)@Base" 0.16.0 + (c++)"LibRaw::get_mem_image_format(int*, int*, int*, int*) const@Base" 0.16.0 + (c++)"LibRaw::get_timestamp(int)@Base" 0.16.0 + (c++)"LibRaw::getbithuff(int, unsigned short*)@Base" 0.16.0 + (c++)"LibRaw::getint(int)@Base" 0.16.0 + (c++)"LibRaw::getreal(int)@Base" 0.16.0 + (c++)"LibRaw::green_equilibrate(float)@Base" 0.16.0 + (c++)"LibRaw::green_matching()@Base" 0.16.0 + (c++)"LibRaw::guess_byte_order(int)@Base" 0.16.0 + (c++)"LibRaw::hasselblad_full_load_raw()@Base" 0.16.0 + (c++)"LibRaw::hasselblad_load_raw()@Base" 0.16.0 + (c++)"LibRaw::hat_transform(float*, float*, int, int, int)@Base" 0.16.0 + (c++)"LibRaw::identify()@Base" 0.16.0 + (c++)"LibRaw::imacon_full_load_raw()@Base" 0.16.0 + (c++)"LibRaw::int_to_float(int)@Base" 0.16.0 + (c++)"LibRaw::is_phaseone_compressed()@Base" 0.16.0 + (c++)"LibRaw::is_sraw()@Base" 0.16.0 + (c++)"LibRaw::jpeg_thumb()@Base" 0.16.0 + (c++)"LibRaw::jpeg_thumb_writer(_IO_FILE*, char*, int)@Base" 0.16.0 + (c++)"LibRaw::kodak_262_load_raw()@Base" 0.16.0 + (c++)"LibRaw::kodak_65000_decode(short*, int)@Base" 0.16.0 + (c++)"LibRaw::kodak_65000_load_raw()@Base" 0.16.0 + (c++)"LibRaw::kodak_dc120_load_raw()@Base" 0.16.0 + (c++)"LibRaw::kodak_jpeg_load_raw()@Base" 0.16.0 + (c++)"LibRaw::kodak_radc_load_raw()@Base" 0.16.0 + (c++)"LibRaw::kodak_rgb_load_raw()@Base" 0.16.0 + (c++)"LibRaw::kodak_thumb_load_raw()@Base" 0.16.0 + (c++)"LibRaw::kodak_thumb_loader()@Base" 0.16.0 + (c++)"LibRaw::kodak_ycbcr_load_raw()@Base" 0.16.0 +#MISSING: 0.17.0-1# (c++)"LibRaw::kodak_yrgb_load_raw()@Base" 0.16.0 + (c++)"LibRaw::layer_thumb()@Base" 0.16.0 + (c++)"LibRaw::lch_to_rgb(double (*) [3])@Base" 0.16.0 + (c++)"LibRaw::leaf_hdr_load_raw()@Base" 0.16.0 + (c++)"LibRaw::lin_interpolate()@Base" 0.16.0 + (c++)"LibRaw::lin_interpolate_loop(int (*) [16][32], int)@Base" 0.16.0 + (c++)"LibRaw::linear_table(unsigned int)@Base" 0.16.0 + (c++)"LibRaw::ljpeg_diff(unsigned short*)@Base" 0.16.0 + (c++)"LibRaw::ljpeg_end(jhead*)@Base" 0.16.0 + (c++)"LibRaw::ljpeg_row(int, jhead*)@Base" 0.16.0 + (c++)"LibRaw::ljpeg_start(jhead*, int)@Base" 0.16.0 + (c++)"LibRaw::lmmse_interpolate(int)@Base" 0.16.0 + (c++)"LibRaw::lossless_dng_load_raw()@Base" 0.16.0 + (c++)"LibRaw::lossless_jpeg_load_raw()@Base" 0.16.0 + (c++)"LibRaw::lossy_dng_load_raw()@Base" 0.16.0 + (c++)"LibRaw::make_decoder(unsigned char const*)@Base" 0.16.0 + (c++)"LibRaw::make_decoder_ref(unsigned char const**)@Base" 0.16.0 + (c++|arch=alpha amd64 arm64 kfreebsd-amd64 mips64 mips64el ppc64 ppc64el s390x sparc64)"LibRaw::malloc(unsigned long)@Base" 0.16.0 + (c++)"LibRaw::median4(int*)@Base" 0.16.0 + (c++)"LibRaw::median_filter()@Base" 0.16.0 + (c++)"LibRaw::median_filter_new()@Base" 0.16.0 + (c++)"LibRaw::merror(void*, char const*)@Base" 0.16.0 + (c++)"LibRaw::minolta_rd175_load_raw()@Base" 0.16.0 + (c++)"LibRaw::minolta_z2()@Base" 0.16.0 + (c++)"LibRaw::nikon_3700()@Base" 0.16.0 + (c++)"LibRaw::nikon_e2100()@Base" 0.16.0 + (c++)"LibRaw::nikon_e995()@Base" 0.16.0 + (c++)"LibRaw::nikon_load_raw()@Base" 0.16.0 + (c++)"LibRaw::nokia_load_raw()@Base" 0.16.0 + (c++)"LibRaw::olympus_load_raw()@Base" 0.16.0 + (c++|arch=alpha amd64 arm64 kfreebsd-amd64 mips64 mips64el ppc64 ppc64el s390x sparc64)"LibRaw::open_buffer(void*, unsigned long)@Base" 0.16.0 + (c++)"LibRaw::open_datastream(LibRaw_abstract_datastream*)@Base" 0.16.0 + (c++)"LibRaw::open_file(char const*, long long)@Base" 0.16.0 + (c++)"LibRaw::packed_dng_load_raw()@Base" 0.16.0 + (c++)"LibRaw::packed_load_raw()@Base" 0.16.0 + (c++)"LibRaw::pana_bits(int)@Base" 0.16.0 + (c++)"LibRaw::panasonic_load_raw()@Base" 0.16.0 + (c++)"LibRaw::parse_ciff(int, int, int)@Base" 0.16.0 + (c++)"LibRaw::parse_cine()@Base" 0.16.0 + (c++)"LibRaw::parse_exif(int)@Base" 0.16.0 + (c++)"LibRaw::parse_external_jpeg()@Base" 0.16.0 + (c++)"LibRaw::parse_fuji(int)@Base" 0.16.0 + (c++)"LibRaw::parse_gps(int)@Base" 0.16.0 + (c++)"LibRaw::parse_jpeg(int)@Base" 0.16.0 + (c++)"LibRaw::parse_kodak_ifd(int)@Base" 0.16.0 + (c++)"LibRaw::parse_makernote(int, int)@Base" 0.16.0 + (c++)"LibRaw::parse_minolta(int)@Base" 0.16.0 + (c++)"LibRaw::parse_mos(int)@Base" 0.16.0 + (c++)"LibRaw::parse_phase_one(int)@Base" 0.16.0 + (c++)"LibRaw::parse_redcine()@Base" 0.16.0 + (c++)"LibRaw::parse_riff()@Base" 0.16.0 + (c++)"LibRaw::parse_rollei()@Base" 0.16.0 + (c++)"LibRaw::parse_sinar_ia()@Base" 0.16.0 + (c++)"LibRaw::parse_smal(int, int)@Base" 0.16.0 + (c++)"LibRaw::parse_thumb_note(int, unsigned int, unsigned int)@Base" 0.16.0 + (c++)"LibRaw::parse_tiff(int)@Base" 0.16.0 + (c++)"LibRaw::parse_tiff_ifd(int)@Base" 0.16.0 + (c++)"LibRaw::parse_x3f()@Base" 0.16.0 + (c++)"LibRaw::pentax_load_raw()@Base" 0.16.0 + (c++)"LibRaw::ph1_bithuff(int, unsigned short*)@Base" 0.16.0 + (c++)"LibRaw::phase_one_allocate_tempbuffer()@Base" 0.16.0 + (c++)"LibRaw::phase_one_correct()@Base" 0.16.0 + (c++)"LibRaw::phase_one_flat_field(int, int)@Base" 0.16.0 + (c++)"LibRaw::phase_one_free_tempbuffer()@Base" 0.16.0 + (c++)"LibRaw::phase_one_load_raw()@Base" 0.16.0 + (c++)"LibRaw::phase_one_load_raw_c()@Base" 0.16.0 + (c++)"LibRaw::phase_one_subtract_black(unsigned short*, unsigned short*)@Base" 0.16.0 + (c++)"LibRaw::ppg_interpolate()@Base" 0.16.0 + (c++)"LibRaw::ppm16_thumb()@Base" 0.16.0 + (c++)"LibRaw::ppm_thumb()@Base" 0.16.0 + (c++)"LibRaw::pre_interpolate()@Base" 0.16.0 + (c++)"LibRaw::pseudoinverse(double (*) [3], double (*) [3], int)@Base" 0.16.0 + (c++)"LibRaw::quicktake_100_load_raw()@Base" 0.16.0 + (c++)"LibRaw::raw(unsigned int, unsigned int)@Base" 0.16.0 + (c++)"LibRaw::raw2image()@Base" 0.16.0 + (c++)"LibRaw::raw2image_ex(int)@Base" 0.16.0 + (c++)"LibRaw::raw2image_start()@Base" 0.16.0 + (c++)"LibRaw::read_shorts(unsigned short*, int)@Base" 0.16.0 + (c++|arch=alpha amd64 arm64 kfreebsd-amd64 mips64 mips64el ppc64 ppc64el s390x sparc64)"LibRaw::realloc(void*, unsigned long)@Base" 0.16.0 + (c++)"LibRaw::recover_highlights()@Base" 0.16.0 + (c++)"LibRaw::recycle()@Base" 0.16.0 + (c++)"LibRaw::recycle_datastream()@Base" 0.16.0 + (c++)"LibRaw::redcine_load_raw()@Base" 0.16.0 + (c++)"LibRaw::refinement()@Base" 0.16.0 + (c++)"LibRaw::remove_zeroes()@Base" 0.16.0 + (c++)"LibRaw::rgb_to_lch(double (*) [3])@Base" 0.16.0 + (c++)"LibRaw::rollei_load_raw()@Base" 0.16.0 + (c++)"LibRaw::rollei_thumb()@Base" 0.16.0 + (c++)"LibRaw::romm_coeff(float (*) [3])@Base" 0.16.0 + (c++)"LibRaw::samsung_load_raw()@Base" 0.16.0 + (c++)"LibRaw::scale_colors()@Base" 0.16.0 + (c++)"LibRaw::scale_colors_loop(float*)@Base" 0.16.0 + (c++)"LibRaw::setCancelFlag()@Base" 0.16.0 + (c++)"LibRaw::set_rawspeed_camerafile(char*)@Base" 0.16.0 + (c++)"LibRaw::sget2(unsigned char*)@Base" 0.16.0 + (c++)"LibRaw::sget4(unsigned char*)@Base" 0.16.0 + (c++)"LibRaw::simple_coeff(int)@Base" 0.16.0 + (c++)"LibRaw::sinar_4shot_load_raw()@Base" 0.16.0 + (c++)"LibRaw::smal_decode_segment(unsigned int (*) [2], int)@Base" 0.16.0 + (c++)"LibRaw::smal_v6_load_raw()@Base" 0.16.0 + (c++)"LibRaw::smal_v9_load_raw()@Base" 0.16.0 + (c++)"LibRaw::sony_arw2_load_raw()@Base" 0.16.0 + (c++)"LibRaw::sony_arw_load_raw()@Base" 0.16.0 + (c++)"LibRaw::sony_decrypt(unsigned int*, int, int, int)@Base" 0.16.0 + (c++)"LibRaw::sony_load_raw()@Base" 0.16.0 + (c++)"LibRaw::strerror(int)@Base" 0.16.0 + (c++)"LibRaw::stretch()@Base" 0.16.0 + (c++)"LibRaw::strprogress(LibRaw_progress)@Base" 0.16.0 + (c++)"LibRaw::subtract(char const*)@Base" 0.16.0 + (c++)"LibRaw::subtract_black()@Base" 0.16.0 + (c++)"LibRaw::subtract_black_internal()@Base" 0.16.0 + (c++)"LibRaw::tiff_get(unsigned int, unsigned int*, unsigned int*, unsigned int*, unsigned int*)@Base" 0.16.0 + (c++)"LibRaw::tiff_head(tiff_hdr*, int)@Base" 0.16.0 + (c++)"LibRaw::tiff_set(unsigned short*, unsigned short, unsigned short, int, int)@Base" 0.16.0 + (c++)"LibRaw::unpack()@Base" 0.16.0 + (c++)"LibRaw::unpack_function_name()@Base" 0.16.0 + (c++)"LibRaw::unpack_thumb()@Base" 0.16.0 + (c++)"LibRaw::unpacked_load_raw()@Base" 0.16.0 + (c++)"LibRaw::vcd_interpolate(int)@Base" 0.16.0 + (c++)"LibRaw::version()@Base" 0.16.0 + (c++)"LibRaw::versionNumber()@Base" 0.16.0 + (c++)"LibRaw::vng_interpolate()@Base" 0.16.0 + (c++)"LibRaw::wavelet_denoise()@Base" 0.16.0 + (c++)"LibRaw::wf_bayer4_block_filter(int*, void*, int, void*, int)@Base" 0.16.0 + (c++)"LibRaw::wf_bayer4_green_blur(int, void*, int, void*, int)@Base" 0.16.0 + (c++)"LibRaw::wf_bayer4_igauss_filter(int, void*, int, void*, int)@Base" 0.16.0 + (c++)"LibRaw::wf_filter_energy(int, int, int, int)@Base" 0.16.0 + (c++)"LibRaw::wf_remove_banding()@Base" 0.16.0 + (c++)"LibRaw::write_ppm_tiff()@Base" 0.16.0 + (c++)"LibRaw::x3f_load_raw()@Base" 0.16.0 + (c++)"LibRaw::x3f_thumb_loader()@Base" 0.16.0 + (c++)"LibRaw::xtrans_interpolate(int)@Base" 0.16.0 + (c++)"LibRaw::~LibRaw()@Base" 0.16.0 + (c++)"LibRaw_abstract_datastream::fname()@Base" 0.16.0 + (c++)"LibRaw_abstract_datastream::jpeg_src(void*)@Base" 0.16.0 + (c++)"LibRaw_abstract_datastream::subfile_close()@Base" 0.16.0 + (c++)"LibRaw_abstract_datastream::subfile_open(char const*)@Base" 0.16.0 + (c++)"LibRaw_abstract_datastream::tempbuffer_close()@Base" 0.16.0 + (c++|arch=alpha amd64 arm64 kfreebsd-amd64 mips64 mips64el ppc64 ppc64el s390x sparc64)"LibRaw_abstract_datastream::tempbuffer_open(void*, unsigned long)@Base" 0.16.0 +#MISSING: 0.17.0-1# (c++|optional=gcc-4.8)"LibRaw_abstract_datastream::~LibRaw_abstract_datastream()@Base" 0.16.0 + (c++)"LibRaw_bigfile_datastream::LibRaw_bigfile_datastream(char const*)@Base" 0.16.0 + (c++)"LibRaw_bigfile_datastream::eof()@Base" 0.16.0 + (c++)"LibRaw_bigfile_datastream::fname()@Base" 0.16.0 + (c++)"LibRaw_bigfile_datastream::get_char()@Base" 0.16.0 + (c++)"LibRaw_bigfile_datastream::gets(char*, int)@Base" 0.16.0 + (c++)"LibRaw_bigfile_datastream::jpeg_src(void*)@Base" 0.16.0 + (c++)"LibRaw_bigfile_datastream::make_jas_stream()@Base" 0.16.0 + (c++|arch=alpha amd64 arm64 kfreebsd-amd64 mips64 mips64el ppc64 ppc64el s390x sparc64)"LibRaw_bigfile_datastream::read(void*, unsigned long, unsigned long)@Base" 0.16.0 + (c++)"LibRaw_bigfile_datastream::scanf_one(char const*, void*)@Base" 0.16.0 + (c++)"LibRaw_bigfile_datastream::seek(long long, int)@Base" 0.16.0 + (c++)"LibRaw_bigfile_datastream::size()@Base" 0.16.0 + (c++)"LibRaw_bigfile_datastream::subfile_close()@Base" 0.16.0 + (c++)"LibRaw_bigfile_datastream::subfile_open(char const*)@Base" 0.16.0 + (c++)"LibRaw_bigfile_datastream::tell()@Base" 0.16.0 + (c++)"LibRaw_bigfile_datastream::valid()@Base" 0.16.0 + (c++)"LibRaw_bigfile_datastream::~LibRaw_bigfile_datastream()@Base" 0.16.0 + (c++|arch=alpha amd64 arm64 kfreebsd-amd64 mips64 mips64el ppc64 ppc64el s390x sparc64)"LibRaw_buffer_datastream::LibRaw_buffer_datastream(void*, unsigned long)@Base" 0.16.0 + (c++)"LibRaw_buffer_datastream::eof()@Base" 0.16.0 + (c++)"LibRaw_buffer_datastream::get_char()@Base" 0.16.0 + (c++)"LibRaw_buffer_datastream::gets(char*, int)@Base" 0.16.0 + (c++)"LibRaw_buffer_datastream::jpeg_src(void*)@Base" 0.16.0 + (c++)"LibRaw_buffer_datastream::make_jas_stream()@Base" 0.16.0 + (c++|arch=alpha amd64 arm64 kfreebsd-amd64 mips64 mips64el ppc64 ppc64el s390x sparc64)"LibRaw_buffer_datastream::read(void*, unsigned long, unsigned long)@Base" 0.16.0 + (c++)"LibRaw_buffer_datastream::scanf_one(char const*, void*)@Base" 0.16.0 + (c++)"LibRaw_buffer_datastream::seek(long long, int)@Base" 0.16.0 + (c++)"LibRaw_buffer_datastream::size()@Base" 0.16.0 + (c++)"LibRaw_buffer_datastream::tell()@Base" 0.16.0 + (c++)"LibRaw_buffer_datastream::valid()@Base" 0.16.0 + (c++)"LibRaw_buffer_datastream::~LibRaw_buffer_datastream()@Base" 0.16.0 + (c++)"LibRaw_constants::d65_white@Base" 0.16.0 + (c++)"LibRaw_constants::xyz_rgb@Base" 0.16.0 + (c++)"LibRaw_file_datastream::LibRaw_file_datastream(char const*)@Base" 0.16.0 + (c++)"LibRaw_file_datastream::eof()@Base" 0.16.0 + (c++)"LibRaw_file_datastream::fname()@Base" 0.16.0 + (c++)"LibRaw_file_datastream::get_char()@Base" 0.16.0 + (c++)"LibRaw_file_datastream::gets(char*, int)@Base" 0.16.0 + (c++)"LibRaw_file_datastream::jpeg_src(void*)@Base" 0.16.0 + (c++)"LibRaw_file_datastream::make_jas_stream()@Base" 0.16.0 + (c++|arch=alpha amd64 arm64 kfreebsd-amd64 mips64 mips64el ppc64 ppc64el s390x sparc64)"LibRaw_file_datastream::read(void*, unsigned long, unsigned long)@Base" 0.16.0 + (c++)"LibRaw_file_datastream::scanf_one(char const*, void*)@Base" 0.16.0 + (c++)"LibRaw_file_datastream::seek(long long, int)@Base" 0.16.0 + (c++)"LibRaw_file_datastream::size()@Base" 0.16.0 + (c++)"LibRaw_file_datastream::subfile_close()@Base" 0.16.0 + (c++)"LibRaw_file_datastream::subfile_open(char const*)@Base" 0.16.0 + (c++)"LibRaw_file_datastream::tell()@Base" 0.16.0 + (c++)"LibRaw_file_datastream::valid()@Base" 0.16.0 + (c++)"LibRaw_file_datastream::~LibRaw_file_datastream()@Base" 0.16.0 + (c++|arch=!alpha !amd64 !arm64 !kfreebsd-amd64 !mips64 !mips64el !ppc64 !ppc64el !s390x !sparc64)"LibRaw_file_datastream::read(void*, unsigned int, unsigned int)@Base" 0.16.0 + (c++|arch=!alpha !amd64 !arm64 !kfreebsd-amd64 !mips64 !mips64el !ppc64 !ppc64el !s390x !sparc64)"LibRaw_buffer_datastream::read(void*, unsigned int, unsigned int)@Base" 0.16.0 + (c++|arch=!alpha !amd64 !arm64 !kfreebsd-amd64 !mips64 !mips64el !ppc64 !ppc64el !s390x !sparc64)"LibRaw_buffer_datastream::LibRaw_buffer_datastream(void*, unsigned int)@Base" 0.16.0 + (c++|arch=!alpha !amd64 !arm64 !kfreebsd-amd64 !mips64 !mips64el !ppc64 !ppc64el !s390x !sparc64)"LibRaw_bigfile_datastream::read(void*, unsigned int, unsigned int)@Base" 0.16.0 + (c++|arch=!alpha !amd64 !arm64 !kfreebsd-amd64 !mips64 !mips64el !ppc64 !ppc64el !s390x !sparc64)"LibRaw_abstract_datastream::tempbuffer_open(void*, unsigned int)@Base" 0.16.0 + (c++|arch=!alpha !amd64 !arm64 !kfreebsd-amd64 !mips64 !mips64el !ppc64 !ppc64el !s390x !sparc64)"LibRaw::open_buffer(void*, unsigned int)@Base" 0.16.0 + (c++|arch=!alpha !amd64 !arm64 !kfreebsd-amd64 !mips64 !mips64el !ppc64 !ppc64el !s390x !sparc64)"LibRaw::calloc(unsigned int, unsigned int)@Base" 0.16.0 + (c++|arch=!alpha !amd64 !arm64 !kfreebsd-amd64 !mips64 !mips64el !ppc64 !ppc64el !s390x !sparc64)"LibRaw::malloc(unsigned int)@Base" 0.16.0 + (c++|arch=!alpha !amd64 !arm64 !kfreebsd-amd64 !mips64 !mips64el !ppc64 !ppc64el !s390x !sparc64)"LibRaw::realloc(void*, unsigned int)@Base" 0.16.0 + (c++|optional=gcc-4.9)"std::ctype::do_widen(char) const@Base" 0.16.0 + (c++)"LibRaw::adobe_coeff(char const*, char const*, int)@Base" 0.17.0 + (c++)"LibRaw::cubic_spline(int const*, int const*, int)@Base" 0.17.0 + (c++)"LibRaw::cam_xyz_coeff(float (*) [4], double (*) [3])@Base" 0.17.0 + (c++)"LibRaw::is_nikon_sraw()@Base" 0.17.0 + (c++)"LibRaw::sraw_midpoint()@Base" 0.17.0 + (c++)"LibRaw::PentaxLensInfo(unsigned int, unsigned int)@Base" 0.17.0 + (c++)"LibRaw::clearCancelFlag()@Base" 0.17.0 + (c++)"LibRaw::is_coolscan_nef()@Base" 0.17.0 + (c++)"LibRaw::nikon_load_sraw()@Base" 0.17.0 + (c++)"LibRaw::parse_gps_libraw(int)@Base" 0.17.0 + (c++)"LibRaw::camera_color_type()@Base" 0.17.0 + (c++)"LibRaw::samsung2_load_raw()@Base" 0.17.0 + (c++)"LibRaw::samsung3_load_raw()@Base" 0.17.0 + (c++)"LibRaw::nikon_yuv_load_raw()@Base" 0.17.0 + (c++)"LibRaw::parseSonyLensType2(unsigned char, unsigned char)@Base" 0.17.0 + (c++)"LibRaw::kodak_c330_load_raw()@Base" 0.17.0 + (c++)"LibRaw::kodak_c603_load_raw()@Base" 0.17.0 + (c++)"LibRaw::process_Sony_0x9050(unsigned char*, unsigned int)@Base" 0.17.0 + (c++)"LibRaw::process_Sony_0x940c(unsigned char*)@Base" 0.17.0 + (c++)"LibRaw::setPhaseOneFeatures(unsigned int)@Base" 0.17.0 + (c++)"LibRaw::setSonyBodyFeatures(unsigned int)@Base" 0.17.0 + (c++)"LibRaw::processNikonLensData(unsigned char*, unsigned int)@Base" 0.17.0 + (c++)"LibRaw::setCanonBodyFeatures(unsigned int)@Base" 0.17.0 + (c++)"LibRaw::parseSonyLensFeatures(unsigned char, unsigned char)@Base" 0.17.0 + (c++)"LibRaw::setPentaxBodyFeatures(unsigned int)@Base" 0.17.0 + (c++)"LibRaw::android_loose_load_raw()@Base" 0.17.0 + (c++)"LibRaw::android_tight_load_raw()@Base" 0.17.0 + (c++)"LibRaw::parse_makernote_0xc634(int, int, unsigned int)@Base" 0.17.0 + (c++)"LibRaw::processCanonCameraInfo(unsigned int, unsigned char*, unsigned int)@Base" 0.17.0 + (c++)"LibRaw::setOlympusBodyFeatures(unsigned long long)@Base" 0.17.0 + (c++)"LibRaw::x3f_dpq_interpolate_af(int, int, int)@Base" 0.17.0 + (c++)"LibRaw::x3f_dpq_interpolate_rg()@Base" 0.17.0 + (c++)"LibRaw::nikon_coolscan_load_raw()@Base" 0.17.0 + (c++)"LibRaw::unpacked_load_raw_fuji_f700s20()@Base" 0.17.0 + (c++)"LibRaw::parse_qt(int)@Base" 0.17.0 + (c++)"LibRaw::sget2Rev(unsigned char*)@Base" 0.17.0 + auto_legacy_offset@Base 0.17.0 + default_data_callback@Base 0.16.0 + default_memory_callback@Base 0.16.0 + foveon_data@Base 0.16.0 + legacy_offset@Base 0.17.0 + libraw_COLOR@Base 0.16.0 + libraw_adjust_sizes_info_only@Base 0.16.0 + libraw_cameraCount@Base 0.16.0 + libraw_cameraList@Base 0.16.0 + libraw_close@Base 0.16.0 + libraw_dcraw_clear_mem@Base 0.16.0 + libraw_dcraw_make_mem_image@Base 0.16.0 + libraw_dcraw_make_mem_thumb@Base 0.16.0 + libraw_dcraw_ppm_tiff_writer@Base 0.16.0 + libraw_dcraw_process@Base 0.16.0 + libraw_dcraw_thumb_writer@Base 0.16.0 + libraw_free_image@Base 0.16.0 + libraw_get_cam_mul@Base 0.17.0 + libraw_get_color_maximum@Base 0.17.0 + libraw_get_decoder_info@Base 0.16.0 + libraw_get_iheight@Base 0.17.0 + libraw_get_iwidth@Base 0.17.0 + libraw_get_pre_mul@Base 0.17.0 + libraw_get_raw_height@Base 0.17.0 + libraw_get_raw_width@Base 0.17.0 + libraw_get_rgb_cam@Base 0.17.0 + libraw_init@Base 0.16.0 + libraw_open_buffer@Base 0.16.0 + libraw_open_file@Base 0.16.0 + libraw_open_file_ex@Base 0.16.0 + libraw_raw2image@Base 0.16.0 + libraw_recycle@Base 0.16.0 + libraw_recycle_datastream@Base 0.16.0 + libraw_set_bright@Base 0.17.0 + libraw_set_dataerror_handler@Base 0.16.0 + libraw_set_demosaic@Base 0.17.0 + libraw_set_exifparser_handler@Base 0.17.0 + libraw_set_fbdd_noiserd@Base 0.17.0 + libraw_set_gamma@Base 0.17.0 + libraw_set_highlight@Base 0.17.0 + libraw_set_memerror_handler@Base 0.16.0 + libraw_set_no_auto_bright@Base 0.17.0 + libraw_set_output_bps@Base 0.17.0 + libraw_set_output_color@Base 0.17.0 + libraw_set_progress_handler@Base 0.16.0 + libraw_strerror@Base 0.16.0 + libraw_strprogress@Base 0.16.0 + libraw_subtract_black@Base 0.16.0 + libraw_unpack@Base 0.16.0 + libraw_unpack_function_name@Base 0.16.0 + libraw_unpack_thumb@Base 0.16.0 + libraw_version@Base 0.16.0 + libraw_versionNumber@Base 0.16.0 +#MISSING: 0.17.0-1# (c++)"set_bit_state(bit_state_s*, unsigned char*)@Base" 0.16.0 + (c++)"typeinfo for LibRaw@Base" 0.16.0 + (c++)"typeinfo for LibRaw_abstract_datastream@Base" 0.16.0 + (c++)"typeinfo for LibRaw_bigfile_datastream@Base" 0.16.0 + (c++)"typeinfo for LibRaw_buffer_datastream@Base" 0.16.0 + (c++)"typeinfo for LibRaw_exceptions@Base" 0.16.0 + (c++)"typeinfo for LibRaw_file_datastream@Base" 0.16.0 + (c++)"typeinfo name for LibRaw@Base" 0.16.0 + (c++)"typeinfo name for LibRaw_abstract_datastream@Base" 0.16.0 + (c++)"typeinfo name for LibRaw_bigfile_datastream@Base" 0.16.0 + (c++)"typeinfo name for LibRaw_buffer_datastream@Base" 0.16.0 + (c++)"typeinfo name for LibRaw_exceptions@Base" 0.16.0 + (c++)"typeinfo name for LibRaw_file_datastream@Base" 0.16.0 + (c++)"vtable for LibRaw@Base" 0.16.0 + (c++)"vtable for LibRaw_abstract_datastream@Base" 0.16.0 + (c++)"vtable for LibRaw_bigfile_datastream@Base" 0.16.0 + (c++)"vtable for LibRaw_buffer_datastream@Base" 0.16.0 + (c++)"vtable for LibRaw_file_datastream@Base" 0.16.0 + (c++)"x3f_clear(void*)@Base" 0.16.0 + (c++)"x3f_delete(x3f_s*)@Base" 0.16.0 +#MISSING: 0.17.0-1# (c++)"x3f_dump_raw_data(x3f_s*, char*)@Base" 0.16.0 + (c++)"x3f_get4(LibRaw_abstract_datastream*)@Base" 0.16.0 + (c++)"x3f_get_camf(x3f_s*)@Base" 0.16.0 + (c++)"x3f_get_prop(x3f_s*)@Base" 0.16.0 + (c++)"x3f_get_raw(x3f_s*)@Base" 0.16.0 + (c++)"x3f_get_thumb_huffman(x3f_s*)@Base" 0.16.0 + (c++)"x3f_get_thumb_jpeg(x3f_s*)@Base" 0.16.0 + (c++)"x3f_get_thumb_plain(x3f_s*)@Base" 0.16.0 + (c++)"x3f_load_data(x3f_s*, x3f_directory_entry_s*)@Base" 0.16.0 + (c++)"x3f_load_image_block(x3f_s*, x3f_directory_entry_s*)@Base" 0.16.0 + (c++)"x3f_new_from_file(LibRaw_abstract_datastream*)@Base" 0.16.0 + (c++)"x3f_sget4(unsigned char*)@Base" 0.16.0 +libraw_r.so.15 libraw15 #MINVER# + (c++)"AAHD::AAHD(LibRaw&)@Base" 0.16.0 + (c++)"AAHD::combine_image()@Base" 0.16.0 + (c++)"AAHD::evaluate_ahd()@Base" 0.16.0 + (c++)"AAHD::gammaLUT@Base" 0.16.0 + (c++)"AAHD::hide_hots()@Base" 0.16.0 + (c++)"AAHD::illustrate_dirs()@Base" 0.16.0 + (c++)"AAHD::illustrate_dline(int)@Base" 0.16.0 + (c++)"AAHD::make_ahd_gline(int)@Base" 0.16.0 + (c++)"AAHD::make_ahd_greens()@Base" 0.16.0 + (c++)"AAHD::make_ahd_rb()@Base" 0.16.0 + (c++)"AAHD::make_ahd_rb_hv(int)@Base" 0.16.0 + (c++)"AAHD::make_ahd_rb_last(int)@Base" 0.16.0 + (c++)"AAHD::refine_hv_dirs()@Base" 0.16.0 + (c++)"AAHD::refine_hv_dirs(int, int)@Base" 0.16.0 + (c++)"AAHD::refine_ihv_dirs(int)@Base" 0.16.0 + (c++)"AAHD::yuv_coeff@Base" 0.16.0 + (c++)"AAHD::~AAHD()@Base" 0.16.0 + (c++)"DHT::DHT(LibRaw&)@Base" 0.16.0 + (c++)"DHT::copy_to_image()@Base" 0.16.0 + (c++)"DHT::hide_hots()@Base" 0.16.0 + (c++)"DHT::illustrate_dirs()@Base" 0.16.0 + (c++)"DHT::illustrate_dline(int)@Base" 0.16.0 + (c++)"DHT::make_diag_dirs()@Base" 0.16.0 + (c++)"DHT::make_diag_dline(int)@Base" 0.16.0 + (c++)"DHT::make_gline(int)@Base" 0.16.0 + (c++)"DHT::make_greens()@Base" 0.16.0 + (c++)"DHT::make_hv_dirs()@Base" 0.16.0 + (c++)"DHT::make_hv_dline(int)@Base" 0.16.0 + (c++)"DHT::make_rb()@Base" 0.16.0 + (c++)"DHT::make_rbdiag(int)@Base" 0.16.0 + (c++)"DHT::make_rbhv(int)@Base" 0.16.0 + (c++)"DHT::refine_diag_dirs(int, int)@Base" 0.16.0 + (c++)"DHT::refine_hv_dirs(int, int)@Base" 0.16.0 + (c++)"DHT::refine_idiag_dirs(int)@Base" 0.16.0 + (c++)"DHT::refine_ihv_dirs(int)@Base" 0.16.0 + (c++)"DHT::restore_hots()@Base" 0.16.0 + (c++)"DHT::~DHT()@Base" 0.16.0 + (c++)"LibRaw::CA_correct_RT(float, float)@Base" 0.16.0 + (c++)"LibRaw::LibRaw(unsigned int)@Base" 0.16.0 + (c++)"LibRaw::aahd_interpolate()@Base" 0.16.0 + (c++)"LibRaw::adjust_bl()@Base" 0.16.0 + (c++)"LibRaw::adjust_maximum()@Base" 0.16.0 + (c++)"LibRaw::adjust_sizes_info_only()@Base" 0.16.0 +#MISSING: 0.17.0-1# (c++)"LibRaw::adobe_coeff(char const*, char const*)@Base" 0.16.0 + (c++)"LibRaw::adobe_copy_pixel(unsigned int, unsigned int, unsigned short**)@Base" 0.16.0 + (c++)"LibRaw::afd_interpolate_pl(int, int)@Base" 0.16.0 + (c++)"LibRaw::ahd_interpolate()@Base" 0.16.0 + (c++)"LibRaw::ahd_interpolate_build_homogeneity_map(int, int, short (*) [512][512][3], char (*) [512][2])@Base" 0.16.0 + (c++)"LibRaw::ahd_interpolate_combine_homogeneous_pixels(int, int, unsigned short (*) [512][512][3], char (*) [512][2])@Base" 0.16.0 + (c++)"LibRaw::ahd_interpolate_green_h_and_v(int, int, unsigned short (*) [512][512][3])@Base" 0.16.0 + (c++)"LibRaw::ahd_interpolate_mod()@Base" 0.16.0 + (c++)"LibRaw::ahd_interpolate_r_and_b_and_convert_to_cielab(int, int, unsigned short (*) [512][512][3], short (*) [512][512][3])@Base" 0.16.0 + (c++)"LibRaw::ahd_interpolate_r_and_b_in_rgb_and_convert_to_cielab(int, int, unsigned short (*) [512][3], short (*) [512][3])@Base" 0.16.0 + (c++)"LibRaw::amaze_demosaic_RT()@Base" 0.16.0 + (c++)"LibRaw::apply_profile(char const*, char const*)@Base" 0.16.0 + (c++)"LibRaw::apply_tiff()@Base" 0.16.0 + (c++)"LibRaw::bad_pixels(char const*)@Base" 0.16.0 + (c++)"LibRaw::blend_highlights()@Base" 0.16.0 + (c++)"LibRaw::border_interpolate(int)@Base" 0.16.0 + (c++|arch=alpha amd64 arm64 kfreebsd-amd64 mips64 mips64el ppc64 ppc64el s390x sparc64)"LibRaw::calloc(unsigned long, unsigned long)@Base" 0.16.0 +#MISSING: 0.17.0-1# (c++)"LibRaw::cam_xyz_coeff(double (*) [3])@Base" 0.16.0 + (c++)"LibRaw::cameraCount()@Base" 0.16.0 + (c++)"LibRaw::cameraList()@Base" 0.16.0 + (c++)"LibRaw::canon_600_auto_wb()@Base" 0.16.0 + (c++)"LibRaw::canon_600_coeff()@Base" 0.16.0 + (c++)"LibRaw::canon_600_color(int*, int)@Base" 0.16.0 + (c++)"LibRaw::canon_600_correct()@Base" 0.16.0 + (c++)"LibRaw::canon_600_fixed_wb(int)@Base" 0.16.0 + (c++)"LibRaw::canon_600_load_raw()@Base" 0.16.0 + (c++)"LibRaw::canon_has_lowbits()@Base" 0.16.0 + (c++)"LibRaw::canon_load_raw()@Base" 0.16.0 + (c++)"LibRaw::canon_rmf_load_raw()@Base" 0.16.0 + (c++)"LibRaw::canon_s2is()@Base" 0.16.0 + (c++)"LibRaw::canon_sraw_load_raw()@Base" 0.16.0 + (c++)"LibRaw::cfa_impulse_gauss(float, float)@Base" 0.16.0 + (c++)"LibRaw::cfa_linedn(float)@Base" 0.16.0 + (c++)"LibRaw::checkCancel()@Base" 0.16.0 + (c++)"LibRaw::cielab(unsigned short*, short*)@Base" 0.16.0 + (c++)"LibRaw::ciff_block_1030()@Base" 0.16.0 + (c++)"LibRaw::convert_to_rgb()@Base" 0.16.0 + (c++)"LibRaw::convert_to_rgb_loop(float (*) [4])@Base" 0.16.0 + (c++)"LibRaw::copy_bayer(unsigned short*, unsigned short*)@Base" 0.16.0 + (c++)"LibRaw::copy_fuji_uncropped(unsigned short*, unsigned short*)@Base" 0.16.0 + (c++)"LibRaw::copy_mem_image(void*, int, int)@Base" 0.16.0 + (c++)"LibRaw::crop_masked_pixels()@Base" 0.16.0 + (c++)"LibRaw::crw_init_tables(unsigned int, unsigned short**)@Base" 0.16.0 + (c++)"LibRaw::dcb(int, int)@Base" 0.16.0 + (c++)"LibRaw::dcb_color()@Base" 0.16.0 + (c++)"LibRaw::dcb_color2(float (*) [3])@Base" 0.16.0 + (c++)"LibRaw::dcb_color3(float (*) [3])@Base" 0.16.0 + (c++)"LibRaw::dcb_color_full()@Base" 0.16.0 + (c++)"LibRaw::dcb_copy_to_buffer(float (*) [3])@Base" 0.16.0 + (c++)"LibRaw::dcb_correction()@Base" 0.16.0 + (c++)"LibRaw::dcb_correction2()@Base" 0.16.0 + (c++)"LibRaw::dcb_decide(float (*) [3], float (*) [3])@Base" 0.16.0 + (c++)"LibRaw::dcb_hor(float (*) [3])@Base" 0.16.0 + (c++)"LibRaw::dcb_map()@Base" 0.16.0 + (c++)"LibRaw::dcb_nyquist()@Base" 0.16.0 + (c++)"LibRaw::dcb_pp()@Base" 0.16.0 + (c++)"LibRaw::dcb_refinement()@Base" 0.16.0 + (c++)"LibRaw::dcb_restore_from_buffer(float (*) [3])@Base" 0.16.0 + (c++)"LibRaw::dcb_ver(float (*) [3])@Base" 0.16.0 + (c++)"LibRaw::dcraw_clear_mem(libraw_processed_image_t*)@Base" 0.16.0 + (c++)"LibRaw::dcraw_make_mem_image(int*)@Base" 0.16.0 + (c++)"LibRaw::dcraw_make_mem_thumb(int*)@Base" 0.16.0 + (c++)"LibRaw::dcraw_ppm_tiff_writer(char const*)@Base" 0.16.0 + (c++)"LibRaw::dcraw_process()@Base" 0.16.0 + (c++)"LibRaw::dcraw_thumb_writer(char const*)@Base" 0.16.0 + (c++)"LibRaw::derror()@Base" 0.16.0 + (c++)"LibRaw::dht_interpolate()@Base" 0.16.0 + (c++)"LibRaw::eight_bit_load_raw()@Base" 0.16.0 + (c++)"LibRaw::es_median_filter()@Base" 0.16.0 + (c++)"LibRaw::exp_bef(float, float)@Base" 0.16.0 + (c++)"LibRaw::fbdd(int)@Base" 0.16.0 + (c++)"LibRaw::fbdd_correction()@Base" 0.16.0 + (c++)"LibRaw::fbdd_correction2(double (*) [3])@Base" 0.16.0 + (c++)"LibRaw::fbdd_green()@Base" 0.16.0 + (c++)"LibRaw::fcol(int, int)@Base" 0.16.0 + (c++)"LibRaw::fill_holes(int)@Base" 0.16.0 + (c++)"LibRaw::find_green(int, int, int, int)@Base" 0.16.0 + (c++)"LibRaw::fix_after_rawspeed(int)@Base" 0.16.0 + (c++)"LibRaw::flip_index(int, int)@Base" 0.16.0 + (c++)"LibRaw::free(void*)@Base" 0.16.0 + (c++)"LibRaw::free_image()@Base" 0.16.0 + (c++)"LibRaw::fuji_rotate()@Base" 0.16.0 + (c++)"LibRaw::gamma_curve(double, double, int, int)@Base" 0.16.0 + (c++)"LibRaw::get2()@Base" 0.16.0 + (c++)"LibRaw::get4()@Base" 0.16.0 + (c++)"LibRaw::get_decoder_info(libraw_decoder_info_t*)@Base" 0.16.0 + (c++)"LibRaw::get_mem_image_format(int*, int*, int*, int*) const@Base" 0.16.0 + (c++)"LibRaw::get_timestamp(int)@Base" 0.16.0 + (c++)"LibRaw::getbithuff(int, unsigned short*)@Base" 0.16.0 + (c++)"LibRaw::getint(int)@Base" 0.16.0 + (c++)"LibRaw::getreal(int)@Base" 0.16.0 + (c++)"LibRaw::green_equilibrate(float)@Base" 0.16.0 + (c++)"LibRaw::green_matching()@Base" 0.16.0 + (c++)"LibRaw::guess_byte_order(int)@Base" 0.16.0 + (c++)"LibRaw::hasselblad_full_load_raw()@Base" 0.16.0 + (c++)"LibRaw::hasselblad_load_raw()@Base" 0.16.0 + (c++)"LibRaw::hat_transform(float*, float*, int, int, int)@Base" 0.16.0 + (c++)"LibRaw::identify()@Base" 0.16.0 + (c++)"LibRaw::imacon_full_load_raw()@Base" 0.16.0 + (c++)"LibRaw::int_to_float(int)@Base" 0.16.0 + (c++)"LibRaw::is_phaseone_compressed()@Base" 0.16.0 + (c++)"LibRaw::is_sraw()@Base" 0.16.0 + (c++)"LibRaw::jpeg_thumb()@Base" 0.16.0 + (c++)"LibRaw::jpeg_thumb_writer(_IO_FILE*, char*, int)@Base" 0.16.0 + (c++)"LibRaw::kodak_262_load_raw()@Base" 0.16.0 + (c++)"LibRaw::kodak_65000_decode(short*, int)@Base" 0.16.0 + (c++)"LibRaw::kodak_65000_load_raw()@Base" 0.16.0 + (c++)"LibRaw::kodak_dc120_load_raw()@Base" 0.16.0 + (c++)"LibRaw::kodak_jpeg_load_raw()@Base" 0.16.0 + (c++)"LibRaw::kodak_radc_load_raw()@Base" 0.16.0 + (c++)"LibRaw::kodak_rgb_load_raw()@Base" 0.16.0 + (c++)"LibRaw::kodak_thumb_load_raw()@Base" 0.16.0 + (c++)"LibRaw::kodak_thumb_loader()@Base" 0.16.0 + (c++)"LibRaw::kodak_ycbcr_load_raw()@Base" 0.16.0 +#MISSING: 0.17.0-1# (c++)"LibRaw::kodak_yrgb_load_raw()@Base" 0.16.0 + (c++)"LibRaw::layer_thumb()@Base" 0.16.0 + (c++)"LibRaw::lch_to_rgb(double (*) [3])@Base" 0.16.0 + (c++)"LibRaw::leaf_hdr_load_raw()@Base" 0.16.0 + (c++)"LibRaw::lin_interpolate()@Base" 0.16.0 + (c++)"LibRaw::lin_interpolate_loop(int (*) [16][32], int)@Base" 0.16.0 + (c++)"LibRaw::linear_table(unsigned int)@Base" 0.16.0 + (c++)"LibRaw::ljpeg_diff(unsigned short*)@Base" 0.16.0 + (c++)"LibRaw::ljpeg_end(jhead*)@Base" 0.16.0 + (c++)"LibRaw::ljpeg_row(int, jhead*)@Base" 0.16.0 + (c++)"LibRaw::ljpeg_start(jhead*, int)@Base" 0.16.0 + (c++)"LibRaw::lmmse_interpolate(int)@Base" 0.16.0 + (c++)"LibRaw::lossless_dng_load_raw()@Base" 0.16.0 + (c++)"LibRaw::lossless_jpeg_load_raw()@Base" 0.16.0 + (c++)"LibRaw::lossy_dng_load_raw()@Base" 0.16.0 + (c++)"LibRaw::make_decoder(unsigned char const*)@Base" 0.16.0 + (c++)"LibRaw::make_decoder_ref(unsigned char const**)@Base" 0.16.0 + (c++|arch=alpha amd64 arm64 kfreebsd-amd64 mips64 mips64el ppc64 ppc64el s390x sparc64)"LibRaw::malloc(unsigned long)@Base" 0.16.0 + (c++)"LibRaw::median4(int*)@Base" 0.16.0 + (c++)"LibRaw::median_filter()@Base" 0.16.0 + (c++)"LibRaw::median_filter_new()@Base" 0.16.0 + (c++)"LibRaw::merror(void*, char const*)@Base" 0.16.0 + (c++)"LibRaw::minolta_rd175_load_raw()@Base" 0.16.0 + (c++)"LibRaw::minolta_z2()@Base" 0.16.0 + (c++)"LibRaw::nikon_3700()@Base" 0.16.0 + (c++)"LibRaw::nikon_e2100()@Base" 0.16.0 + (c++)"LibRaw::nikon_e995()@Base" 0.16.0 + (c++)"LibRaw::nikon_load_raw()@Base" 0.16.0 + (c++)"LibRaw::nokia_load_raw()@Base" 0.16.0 + (c++)"LibRaw::olympus_load_raw()@Base" 0.16.0 + (c++|arch=alpha amd64 arm64 kfreebsd-amd64 mips64 mips64el ppc64 ppc64el s390x sparc64)"LibRaw::open_buffer(void*, unsigned long)@Base" 0.16.0 + (c++)"LibRaw::open_datastream(LibRaw_abstract_datastream*)@Base" 0.16.0 + (c++)"LibRaw::open_file(char const*, long long)@Base" 0.16.0 + (c++)"LibRaw::packed_dng_load_raw()@Base" 0.16.0 + (c++)"LibRaw::packed_load_raw()@Base" 0.16.0 + (c++)"LibRaw::pana_bits(int)@Base" 0.16.0 + (c++)"LibRaw::panasonic_load_raw()@Base" 0.16.0 + (c++)"LibRaw::parse_ciff(int, int, int)@Base" 0.16.0 + (c++)"LibRaw::parse_cine()@Base" 0.16.0 + (c++)"LibRaw::parse_exif(int)@Base" 0.16.0 + (c++)"LibRaw::parse_external_jpeg()@Base" 0.16.0 + (c++)"LibRaw::parse_fuji(int)@Base" 0.16.0 + (c++)"LibRaw::parse_gps(int)@Base" 0.16.0 + (c++)"LibRaw::parse_jpeg(int)@Base" 0.16.0 + (c++)"LibRaw::parse_kodak_ifd(int)@Base" 0.16.0 + (c++)"LibRaw::parse_makernote(int, int)@Base" 0.16.0 + (c++)"LibRaw::parse_minolta(int)@Base" 0.16.0 + (c++)"LibRaw::parse_mos(int)@Base" 0.16.0 + (c++)"LibRaw::parse_phase_one(int)@Base" 0.16.0 + (c++)"LibRaw::parse_redcine()@Base" 0.16.0 + (c++)"LibRaw::parse_riff()@Base" 0.16.0 + (c++)"LibRaw::parse_rollei()@Base" 0.16.0 + (c++)"LibRaw::parse_sinar_ia()@Base" 0.16.0 + (c++)"LibRaw::parse_smal(int, int)@Base" 0.16.0 + (c++)"LibRaw::parse_thumb_note(int, unsigned int, unsigned int)@Base" 0.16.0 + (c++)"LibRaw::parse_tiff(int)@Base" 0.16.0 + (c++)"LibRaw::parse_tiff_ifd(int)@Base" 0.16.0 + (c++)"LibRaw::parse_x3f()@Base" 0.16.0 + (c++)"LibRaw::pentax_load_raw()@Base" 0.16.0 + (c++)"LibRaw::ph1_bithuff(int, unsigned short*)@Base" 0.16.0 + (c++)"LibRaw::phase_one_allocate_tempbuffer()@Base" 0.16.0 + (c++)"LibRaw::phase_one_correct()@Base" 0.16.0 + (c++)"LibRaw::phase_one_flat_field(int, int)@Base" 0.16.0 + (c++)"LibRaw::phase_one_free_tempbuffer()@Base" 0.16.0 + (c++)"LibRaw::phase_one_load_raw()@Base" 0.16.0 + (c++)"LibRaw::phase_one_load_raw_c()@Base" 0.16.0 + (c++)"LibRaw::phase_one_subtract_black(unsigned short*, unsigned short*)@Base" 0.16.0 + (c++)"LibRaw::ppg_interpolate()@Base" 0.16.0 + (c++)"LibRaw::ppm16_thumb()@Base" 0.16.0 + (c++)"LibRaw::ppm_thumb()@Base" 0.16.0 + (c++)"LibRaw::pre_interpolate()@Base" 0.16.0 + (c++)"LibRaw::pseudoinverse(double (*) [3], double (*) [3], int)@Base" 0.16.0 + (c++)"LibRaw::quicktake_100_load_raw()@Base" 0.16.0 + (c++)"LibRaw::raw(unsigned int, unsigned int)@Base" 0.16.0 + (c++)"LibRaw::raw2image()@Base" 0.16.0 + (c++)"LibRaw::raw2image_ex(int)@Base" 0.16.0 + (c++)"LibRaw::raw2image_start()@Base" 0.16.0 + (c++)"LibRaw::read_shorts(unsigned short*, int)@Base" 0.16.0 + (c++|arch=alpha amd64 arm64 kfreebsd-amd64 mips64 mips64el ppc64 ppc64el s390x sparc64)"LibRaw::realloc(void*, unsigned long)@Base" 0.16.0 + (c++)"LibRaw::recover_highlights()@Base" 0.16.0 + (c++)"LibRaw::recycle()@Base" 0.16.0 + (c++)"LibRaw::recycle_datastream()@Base" 0.16.0 + (c++)"LibRaw::redcine_load_raw()@Base" 0.16.0 + (c++)"LibRaw::refinement()@Base" 0.16.0 + (c++)"LibRaw::remove_zeroes()@Base" 0.16.0 + (c++)"LibRaw::rgb_to_lch(double (*) [3])@Base" 0.16.0 + (c++)"LibRaw::rollei_load_raw()@Base" 0.16.0 + (c++)"LibRaw::rollei_thumb()@Base" 0.16.0 + (c++)"LibRaw::romm_coeff(float (*) [3])@Base" 0.16.0 + (c++)"LibRaw::samsung_load_raw()@Base" 0.16.0 + (c++)"LibRaw::scale_colors()@Base" 0.16.0 + (c++)"LibRaw::scale_colors_loop(float*)@Base" 0.16.0 + (c++)"LibRaw::setCancelFlag()@Base" 0.16.0 + (c++)"LibRaw::set_rawspeed_camerafile(char*)@Base" 0.16.0 + (c++)"LibRaw::sget2(unsigned char*)@Base" 0.16.0 + (c++)"LibRaw::sget4(unsigned char*)@Base" 0.16.0 + (c++)"LibRaw::simple_coeff(int)@Base" 0.16.0 + (c++)"LibRaw::sinar_4shot_load_raw()@Base" 0.16.0 + (c++)"LibRaw::smal_decode_segment(unsigned int (*) [2], int)@Base" 0.16.0 + (c++)"LibRaw::smal_v6_load_raw()@Base" 0.16.0 + (c++)"LibRaw::smal_v9_load_raw()@Base" 0.16.0 + (c++)"LibRaw::sony_arw2_load_raw()@Base" 0.16.0 + (c++)"LibRaw::sony_arw_load_raw()@Base" 0.16.0 + (c++)"LibRaw::sony_decrypt(unsigned int*, int, int, int)@Base" 0.16.0 + (c++)"LibRaw::sony_load_raw()@Base" 0.16.0 + (c++)"LibRaw::strerror(int)@Base" 0.16.0 + (c++)"LibRaw::stretch()@Base" 0.16.0 + (c++)"LibRaw::strprogress(LibRaw_progress)@Base" 0.16.0 + (c++)"LibRaw::subtract(char const*)@Base" 0.16.0 + (c++)"LibRaw::subtract_black()@Base" 0.16.0 + (c++)"LibRaw::subtract_black_internal()@Base" 0.16.0 + (c++)"LibRaw::tiff_get(unsigned int, unsigned int*, unsigned int*, unsigned int*, unsigned int*)@Base" 0.16.0 + (c++)"LibRaw::tiff_head(tiff_hdr*, int)@Base" 0.16.0 + (c++)"LibRaw::tiff_set(unsigned short*, unsigned short, unsigned short, int, int)@Base" 0.16.0 + (c++)"LibRaw::unpack()@Base" 0.16.0 + (c++)"LibRaw::unpack_function_name()@Base" 0.16.0 + (c++)"LibRaw::unpack_thumb()@Base" 0.16.0 + (c++)"LibRaw::unpacked_load_raw()@Base" 0.16.0 + (c++)"LibRaw::vcd_interpolate(int)@Base" 0.16.0 + (c++)"LibRaw::version()@Base" 0.16.0 + (c++)"LibRaw::versionNumber()@Base" 0.16.0 + (c++)"LibRaw::vng_interpolate()@Base" 0.16.0 + (c++)"LibRaw::wavelet_denoise()@Base" 0.16.0 + (c++)"LibRaw::wf_bayer4_block_filter(int*, void*, int, void*, int)@Base" 0.16.0 + (c++)"LibRaw::wf_bayer4_green_blur(int, void*, int, void*, int)@Base" 0.16.0 + (c++)"LibRaw::wf_bayer4_igauss_filter(int, void*, int, void*, int)@Base" 0.16.0 + (c++)"LibRaw::wf_filter_energy(int, int, int, int)@Base" 0.16.0 + (c++)"LibRaw::wf_remove_banding()@Base" 0.16.0 + (c++)"LibRaw::write_ppm_tiff()@Base" 0.16.0 + (c++)"LibRaw::x3f_load_raw()@Base" 0.16.0 + (c++)"LibRaw::x3f_thumb_loader()@Base" 0.16.0 + (c++)"LibRaw::xtrans_interpolate(int)@Base" 0.16.0 + (c++)"LibRaw::~LibRaw()@Base" 0.16.0 + (c++)"LibRaw_abstract_datastream::fname()@Base" 0.16.0 + (c++)"LibRaw_abstract_datastream::jpeg_src(void*)@Base" 0.16.0 + (c++)"LibRaw_abstract_datastream::subfile_close()@Base" 0.16.0 + (c++)"LibRaw_abstract_datastream::subfile_open(char const*)@Base" 0.16.0 + (c++)"LibRaw_abstract_datastream::tempbuffer_close()@Base" 0.16.0 + (c++|arch=alpha amd64 arm64 kfreebsd-amd64 mips64 mips64el ppc64 ppc64el s390x sparc64)"LibRaw_abstract_datastream::tempbuffer_open(void*, unsigned long)@Base" 0.16.0 +#MISSING: 0.17.0-1# (c++|optional=gcc-4.8)"LibRaw_abstract_datastream::~LibRaw_abstract_datastream()@Base" 0.16.0 + (c++)"LibRaw_bigfile_datastream::LibRaw_bigfile_datastream(char const*)@Base" 0.16.0 + (c++)"LibRaw_bigfile_datastream::eof()@Base" 0.16.0 + (c++)"LibRaw_bigfile_datastream::fname()@Base" 0.16.0 + (c++)"LibRaw_bigfile_datastream::get_char()@Base" 0.16.0 + (c++)"LibRaw_bigfile_datastream::gets(char*, int)@Base" 0.16.0 + (c++)"LibRaw_bigfile_datastream::jpeg_src(void*)@Base" 0.16.0 + (c++)"LibRaw_bigfile_datastream::make_jas_stream()@Base" 0.16.0 + (c++|arch=alpha amd64 arm64 kfreebsd-amd64 mips64 mips64el ppc64 ppc64el s390x sparc64)"LibRaw_bigfile_datastream::read(void*, unsigned long, unsigned long)@Base" 0.16.0 + (c++)"LibRaw_bigfile_datastream::scanf_one(char const*, void*)@Base" 0.16.0 + (c++)"LibRaw_bigfile_datastream::seek(long long, int)@Base" 0.16.0 + (c++)"LibRaw_bigfile_datastream::size()@Base" 0.16.0 + (c++)"LibRaw_bigfile_datastream::subfile_close()@Base" 0.16.0 + (c++)"LibRaw_bigfile_datastream::subfile_open(char const*)@Base" 0.16.0 + (c++)"LibRaw_bigfile_datastream::tell()@Base" 0.16.0 + (c++)"LibRaw_bigfile_datastream::valid()@Base" 0.16.0 + (c++)"LibRaw_bigfile_datastream::~LibRaw_bigfile_datastream()@Base" 0.16.0 + (c++|arch=alpha amd64 arm64 kfreebsd-amd64 mips64 mips64el ppc64 ppc64el s390x sparc64)"LibRaw_buffer_datastream::LibRaw_buffer_datastream(void*, unsigned long)@Base" 0.16.0 + (c++)"LibRaw_buffer_datastream::eof()@Base" 0.16.0 + (c++)"LibRaw_buffer_datastream::get_char()@Base" 0.16.0 + (c++)"LibRaw_buffer_datastream::gets(char*, int)@Base" 0.16.0 + (c++)"LibRaw_buffer_datastream::jpeg_src(void*)@Base" 0.16.0 + (c++)"LibRaw_buffer_datastream::make_jas_stream()@Base" 0.16.0 + (c++|arch=alpha amd64 arm64 kfreebsd-amd64 mips64 mips64el ppc64 ppc64el s390x sparc64)"LibRaw_buffer_datastream::read(void*, unsigned long, unsigned long)@Base" 0.16.0 + (c++)"LibRaw_buffer_datastream::scanf_one(char const*, void*)@Base" 0.16.0 + (c++)"LibRaw_buffer_datastream::seek(long long, int)@Base" 0.16.0 + (c++)"LibRaw_buffer_datastream::size()@Base" 0.16.0 + (c++)"LibRaw_buffer_datastream::tell()@Base" 0.16.0 + (c++)"LibRaw_buffer_datastream::valid()@Base" 0.16.0 + (c++)"LibRaw_buffer_datastream::~LibRaw_buffer_datastream()@Base" 0.16.0 + (c++)"LibRaw_constants::d65_white@Base" 0.16.0 + (c++)"LibRaw_constants::xyz_rgb@Base" 0.16.0 + (c++)"LibRaw_file_datastream::LibRaw_file_datastream(char const*)@Base" 0.16.0 + (c++)"LibRaw_file_datastream::eof()@Base" 0.16.0 + (c++)"LibRaw_file_datastream::fname()@Base" 0.16.0 + (c++)"LibRaw_file_datastream::get_char()@Base" 0.16.0 + (c++)"LibRaw_file_datastream::gets(char*, int)@Base" 0.16.0 + (c++)"LibRaw_file_datastream::jpeg_src(void*)@Base" 0.16.0 + (c++)"LibRaw_file_datastream::make_jas_stream()@Base" 0.16.0 + (c++|arch=alpha amd64 arm64 kfreebsd-amd64 mips64 mips64el ppc64 ppc64el s390x sparc64)"LibRaw_file_datastream::read(void*, unsigned long, unsigned long)@Base" 0.16.0 + (c++)"LibRaw_file_datastream::scanf_one(char const*, void*)@Base" 0.16.0 + (c++)"LibRaw_file_datastream::seek(long long, int)@Base" 0.16.0 + (c++)"LibRaw_file_datastream::size()@Base" 0.16.0 + (c++)"LibRaw_file_datastream::subfile_close()@Base" 0.16.0 + (c++)"LibRaw_file_datastream::subfile_open(char const*)@Base" 0.16.0 + (c++)"LibRaw_file_datastream::tell()@Base" 0.16.0 + (c++)"LibRaw_file_datastream::valid()@Base" 0.16.0 + (c++)"LibRaw_file_datastream::~LibRaw_file_datastream()@Base" 0.16.0 + (c++|arch=!alpha !amd64 !arm64 !kfreebsd-amd64 !mips64 !mips64el !ppc64 !ppc64el !s390x !sparc64)"LibRaw_file_datastream::read(void*, unsigned int, unsigned int)@Base" 0.16.0 + (c++|arch=!alpha !amd64 !arm64 !kfreebsd-amd64 !mips64 !mips64el !ppc64 !ppc64el !s390x !sparc64)"LibRaw_buffer_datastream::read(void*, unsigned int, unsigned int)@Base" 0.16.0 + (c++|arch=!alpha !amd64 !arm64 !kfreebsd-amd64 !mips64 !mips64el !ppc64 !ppc64el !s390x !sparc64)"LibRaw_buffer_datastream::LibRaw_buffer_datastream(void*, unsigned int)@Base" 0.16.0 + (c++|arch=!alpha !amd64 !arm64 !kfreebsd-amd64 !mips64 !mips64el !ppc64 !ppc64el !s390x !sparc64)"LibRaw_bigfile_datastream::read(void*, unsigned int, unsigned int)@Base" 0.16.0 + (c++|arch=!alpha !amd64 !arm64 !kfreebsd-amd64 !mips64 !mips64el !ppc64 !ppc64el !s390x !sparc64)"LibRaw_abstract_datastream::tempbuffer_open(void*, unsigned int)@Base" 0.16.0 + (c++|arch=!alpha !amd64 !arm64 !kfreebsd-amd64 !mips64 !mips64el !ppc64 !ppc64el !s390x !sparc64)"LibRaw::open_buffer(void*, unsigned int)@Base" 0.16.0 + (c++|arch=!alpha !amd64 !arm64 !kfreebsd-amd64 !mips64 !mips64el !ppc64 !ppc64el !s390x !sparc64)"LibRaw::calloc(unsigned int, unsigned int)@Base" 0.16.0 + (c++|arch=!alpha !amd64 !arm64 !kfreebsd-amd64 !mips64 !mips64el !ppc64 !ppc64el !s390x !sparc64)"LibRaw::malloc(unsigned int)@Base" 0.16.0 + (c++|arch=!alpha !amd64 !arm64 !kfreebsd-amd64 !mips64 !mips64el !ppc64 !ppc64el !s390x !sparc64)"LibRaw::realloc(void*, unsigned int)@Base" 0.16.0 + (c++|optional=gcc-4.9)"std::ctype::do_widen(char) const@Base" 0.16.0 + (c++)"LibRaw::adobe_coeff(char const*, char const*, int)@Base" 0.17.0 + (c++)"LibRaw::cubic_spline(int const*, int const*, int)@Base" 0.17.0 + (c++)"LibRaw::cam_xyz_coeff(float (*) [4], double (*) [3])@Base" 0.17.0 + (c++)"LibRaw::is_nikon_sraw()@Base" 0.17.0 + (c++)"LibRaw::sraw_midpoint()@Base" 0.17.0 + (c++)"LibRaw::PentaxLensInfo(unsigned int, unsigned int)@Base" 0.17.0 + (c++)"LibRaw::clearCancelFlag()@Base" 0.17.0 + (c++)"LibRaw::is_coolscan_nef()@Base" 0.17.0 + (c++)"LibRaw::nikon_load_sraw()@Base" 0.17.0 + (c++)"LibRaw::parse_gps_libraw(int)@Base" 0.17.0 + (c++)"LibRaw::camera_color_type()@Base" 0.17.0 + (c++)"LibRaw::samsung2_load_raw()@Base" 0.17.0 + (c++)"LibRaw::samsung3_load_raw()@Base" 0.17.0 + (c++)"LibRaw::nikon_yuv_load_raw()@Base" 0.17.0 + (c++)"LibRaw::parseSonyLensType2(unsigned char, unsigned char)@Base" 0.17.0 + (c++)"LibRaw::kodak_c330_load_raw()@Base" 0.17.0 + (c++)"LibRaw::kodak_c603_load_raw()@Base" 0.17.0 + (c++)"LibRaw::process_Sony_0x9050(unsigned char*, unsigned int)@Base" 0.17.0 + (c++)"LibRaw::process_Sony_0x940c(unsigned char*)@Base" 0.17.0 + (c++)"LibRaw::setPhaseOneFeatures(unsigned int)@Base" 0.17.0 + (c++)"LibRaw::setSonyBodyFeatures(unsigned int)@Base" 0.17.0 + (c++)"LibRaw::processNikonLensData(unsigned char*, unsigned int)@Base" 0.17.0 + (c++)"LibRaw::setCanonBodyFeatures(unsigned int)@Base" 0.17.0 + (c++)"LibRaw::parseSonyLensFeatures(unsigned char, unsigned char)@Base" 0.17.0 + (c++)"LibRaw::setPentaxBodyFeatures(unsigned int)@Base" 0.17.0 + (c++)"LibRaw::android_loose_load_raw()@Base" 0.17.0 + (c++)"LibRaw::android_tight_load_raw()@Base" 0.17.0 + (c++)"LibRaw::parse_makernote_0xc634(int, int, unsigned int)@Base" 0.17.0 + (c++)"LibRaw::processCanonCameraInfo(unsigned int, unsigned char*, unsigned int)@Base" 0.17.0 + (c++)"LibRaw::setOlympusBodyFeatures(unsigned long long)@Base" 0.17.0 + (c++)"LibRaw::x3f_dpq_interpolate_af(int, int, int)@Base" 0.17.0 + (c++)"LibRaw::x3f_dpq_interpolate_rg()@Base" 0.17.0 + (c++)"LibRaw::nikon_coolscan_load_raw()@Base" 0.17.0 + (c++)"LibRaw::unpacked_load_raw_fuji_f700s20()@Base" 0.17.0 + (c++)"LibRaw::parse_qt(int)@Base" 0.17.0 + (c++)"LibRaw::sget2Rev(unsigned char*)@Base" 0.17.0 + auto_legacy_offset@Base 0.17.0 + default_data_callback@Base 0.16.0 + default_memory_callback@Base 0.16.0 + foveon_data@Base 0.16.0 + legacy_offset@Base 0.17.0 + libraw_COLOR@Base 0.16.0 + libraw_adjust_sizes_info_only@Base 0.16.0 + libraw_cameraCount@Base 0.16.0 + libraw_cameraList@Base 0.16.0 + libraw_close@Base 0.16.0 + libraw_dcraw_clear_mem@Base 0.16.0 + libraw_dcraw_make_mem_image@Base 0.16.0 + libraw_dcraw_make_mem_thumb@Base 0.16.0 + libraw_dcraw_ppm_tiff_writer@Base 0.16.0 + libraw_dcraw_process@Base 0.16.0 + libraw_dcraw_thumb_writer@Base 0.16.0 + libraw_free_image@Base 0.16.0 + libraw_get_cam_mul@Base 0.17.0 + libraw_get_color_maximum@Base 0.17.0 + libraw_get_decoder_info@Base 0.16.0 + libraw_get_iheight@Base 0.17.0 + libraw_get_iwidth@Base 0.17.0 + libraw_get_pre_mul@Base 0.17.0 + libraw_get_raw_height@Base 0.17.0 + libraw_get_raw_width@Base 0.17.0 + libraw_get_rgb_cam@Base 0.17.0 + libraw_init@Base 0.16.0 + libraw_open_buffer@Base 0.16.0 + libraw_open_file@Base 0.16.0 + libraw_open_file_ex@Base 0.16.0 + libraw_raw2image@Base 0.16.0 + libraw_recycle@Base 0.16.0 + libraw_recycle_datastream@Base 0.16.0 + libraw_set_bright@Base 0.17.0 + libraw_set_dataerror_handler@Base 0.16.0 + libraw_set_demosaic@Base 0.17.0 + libraw_set_exifparser_handler@Base 0.17.0 + libraw_set_fbdd_noiserd@Base 0.17.0 + libraw_set_gamma@Base 0.17.0 + libraw_set_highlight@Base 0.17.0 + libraw_set_memerror_handler@Base 0.16.0 + libraw_set_no_auto_bright@Base 0.17.0 + libraw_set_output_bps@Base 0.17.0 + libraw_set_output_color@Base 0.17.0 + libraw_set_progress_handler@Base 0.16.0 + libraw_strerror@Base 0.16.0 + libraw_strprogress@Base 0.16.0 + libraw_subtract_black@Base 0.16.0 + libraw_unpack@Base 0.16.0 + libraw_unpack_function_name@Base 0.16.0 + libraw_unpack_thumb@Base 0.16.0 + libraw_version@Base 0.16.0 + libraw_versionNumber@Base 0.16.0 +#MISSING: 0.17.0-1# (c++)"set_bit_state(bit_state_s*, unsigned char*)@Base" 0.16.0 + (c++)"typeinfo for LibRaw@Base" 0.16.0 + (c++)"typeinfo for LibRaw_abstract_datastream@Base" 0.16.0 + (c++)"typeinfo for LibRaw_bigfile_datastream@Base" 0.16.0 + (c++)"typeinfo for LibRaw_buffer_datastream@Base" 0.16.0 + (c++)"typeinfo for LibRaw_exceptions@Base" 0.16.0 + (c++)"typeinfo for LibRaw_file_datastream@Base" 0.16.0 + (c++)"typeinfo name for LibRaw@Base" 0.16.0 + (c++)"typeinfo name for LibRaw_abstract_datastream@Base" 0.16.0 + (c++)"typeinfo name for LibRaw_bigfile_datastream@Base" 0.16.0 + (c++)"typeinfo name for LibRaw_buffer_datastream@Base" 0.16.0 + (c++)"typeinfo name for LibRaw_exceptions@Base" 0.16.0 + (c++)"typeinfo name for LibRaw_file_datastream@Base" 0.16.0 + (c++)"vtable for LibRaw@Base" 0.16.0 + (c++)"vtable for LibRaw_abstract_datastream@Base" 0.16.0 + (c++)"vtable for LibRaw_bigfile_datastream@Base" 0.16.0 + (c++)"vtable for LibRaw_buffer_datastream@Base" 0.16.0 + (c++)"vtable for LibRaw_file_datastream@Base" 0.16.0 + (c++)"x3f_clear(void*)@Base" 0.16.0 + (c++)"x3f_delete(x3f_s*)@Base" 0.16.0 +#MISSING: 0.17.0-1# (c++)"x3f_dump_raw_data(x3f_s*, char*)@Base" 0.16.0 + (c++)"x3f_get4(LibRaw_abstract_datastream*)@Base" 0.16.0 + (c++)"x3f_get_camf(x3f_s*)@Base" 0.16.0 + (c++)"x3f_get_prop(x3f_s*)@Base" 0.16.0 + (c++)"x3f_get_raw(x3f_s*)@Base" 0.16.0 + (c++)"x3f_get_thumb_huffman(x3f_s*)@Base" 0.16.0 + (c++)"x3f_get_thumb_jpeg(x3f_s*)@Base" 0.16.0 + (c++)"x3f_get_thumb_plain(x3f_s*)@Base" 0.16.0 + (c++)"x3f_load_data(x3f_s*, x3f_directory_entry_s*)@Base" 0.16.0 + (c++)"x3f_load_image_block(x3f_s*, x3f_directory_entry_s*)@Base" 0.16.0 + (c++)"x3f_new_from_file(LibRaw_abstract_datastream*)@Base" 0.16.0 + (c++)"x3f_sget4(unsigned char*)@Base" 0.16.0 diff -Nru libraw-0.16.2/debian/rules libraw-0.17.0/debian/rules --- libraw-0.16.2/debian/rules 2015-05-22 12:12:10.000000000 +0000 +++ libraw-0.17.0/debian/rules 2015-09-02 12:25:23.000000000 +0000 @@ -6,9 +6,10 @@ dh $@ --with autotools_dev,autoreconf override_dh_auto_configure: - dh_auto_configure -- --prefix=/usr \ - --bindir=/usr/lib/libraw \ + dh_auto_configure -- \ + --prefix=/usr \ + --bindir=/usr/lib/libraw \ --enable-jpeg override_dh_makeshlibs: - dh_makeshlibs -V 'libraw10 (>= 0.16.0-1)' + dh_makeshlibs -V 'libraw15 (>= 0.17.0-1)' diff -Nru libraw-0.16.2/doc/API-C-eng.html libraw-0.17.0/doc/API-C-eng.html --- libraw-0.16.2/doc/API-C-eng.html 2015-05-16 12:32:15.000000000 +0000 +++ libraw-0.17.0/doc/API-C-eng.html 1970-01-01 00:00:00.000000000 +0000 @@ -1,207 +0,0 @@ - - - - LibRaw: C API - - - - [back to Index] -

LibRaw: C API

-

LibRaw C API is a wrapper around C++ API; therefore, virtually all documentation to C - API functions is represented by a set of hyperlinks to the corresponding places in the description of C++ API. -

-

Contents

-
    -
  1. Initialization: libraw_data_t *libraw_init(unsigned int flags);
  2. -
  3. Returned values
  4. -
  5. Data loading
  6. -
  7. Auxiliary Functions
  8. -
  9. Data Postprocessing, Emulation of dcraw Behavior - -
  10. -
  11. Writing to Output Files
  12. -
  13. Writing processing results to memory buffer
  14. -
- - - -

Initialization: libraw_data_t *libraw_init(unsigned int flags);

-

- The function returns the pointer to the instance of - libraw_data_t structure.
- The resultant pointer should be passed as the first argument to all C API functions (except for libraw_strerror). -

-

Returns NULL in case of error, pointer to the structure in all other cases.

- - -

Returned values

-

Functions of C API return EINVAL (see errno.h) if the null pointer was passed to them as the first argument. -In all other cases, the C++ API return code is returned. -

- - -

Data Loading from a File

-
-
int libraw_open_file(libraw_data_t*, const char *)
-
int libraw_open_file_ex(libraw_data_t*, const char *,INT64 bigfile_size)
-
WIN32: int libraw_open_wfile(libraw_data_t*, const wchar_t *)
-
WIN32: int libraw_open_wfile_ex(libraw_data_t*, const wchar_t *,INT64 bigfile_size)
-
- See LibRaw::open_file() -
-
int libraw_open_buffer(libraw_data_t*, void *buffer, size_t bufsize)
-
- See LibRaw::open_buffer() -
-
int libraw_unpack(libraw_data_t*);
-
- See LibRaw::unpack() -
-
int libraw_unpack_thumb(libraw_data_t*);
-
- See LibRaw::unpack_thumb() -
- -
- -

Auxiliary Functions

-
-
const char* libraw_version()
-
- See LibRaw::version() -
-
const char* libraw_versionNumber()
-
- See LibRaw::versionNumber() -
-
bool LIBRAW_CHECK_VERSION(major,minor,patch)
-
- See LIBRAW_CHECK_VERSION -
-
int libraw_cameraCount()
-
- See LibRaw::cameraCount() -
-
int libraw_cameraList()
-
- See LibRaw::cameraList() -
-
void libraw_get_decoder_info(libraw_data_t*,libraw_decoder_info_t *);
-
- See LibRaw::get_decoder_info() -
-
void libraw_unpack_function_name(libraw_data_t*);
-
- See LibRaw::unpack_function_name() -
-
void libraw_COLOR(libraw_data_t*,int row,int col);
-
- See LibRaw::COLOR() -
-
void libraw_subtract_black(libraw_data_t*);
-
- See LibRaw::subtract_black() -
-
void libraw_recycle_datastream(libraw_data_t*);
-
- See LibRaw::recycle_datastream() -
-
void libraw_recycle(libraw_data_t*);
-
- See LibRaw::recycle() -
-
void libraw_close(libraw_data_t*);
-
- See LibRaw::~LibRaw() -
-
const char *libraw_strerror(int errorcode);
-
- See LibRaw::strerror -
-
const char *libraw_strprogress(enum LibRaw_progress);
-
- See LibRaw::strprogress -
-
void libraw_set_memerror_handler(libraw_data_t*, memory_callback cb);
-
- See LibRaw::set_memerror_handler() -
-
void libraw_set_dataerror_handler(libraw_data_t*,data_callback func);
-
- See LibRaw::set_dataerror_handler() -
-
void libraw_set_progress_handler(libraw_data_t*,progress_callback func);
-
- See LibRaw::set_progress_handler() -
-
- -

Data Postprocessing, Emulation of dcraw Behavior

- -

Setting of Parameters

-

- The postprocessing parameters for the calls described below are set, just as for C++ API, via setting of fields in the - libraw_output_params_t structure: -

-
- libraw_data_t *ptr = libraw_init(0);
- ptr->params.output_tiff = 1; //  output to TIFF
-    
-

- Fields of this structure are described in the documentation to - libraw_output_params_t. For notes on their use, see API notes. -

- -

Emulation of dcraw Behavior

-
-
int libraw_raw2image(libraw_data_t*);
-
- See LibRaw::raw2image -
-
int libraw_free_image(libraw_data_t*);
-
- See LibRaw::free_image -
-
int libraw_adjust_sizes_info_only(libraw_data_t*);
-
- See LibRaw::adjust_sizes_info_only() -
-
int libraw_dcraw_process(libraw_data_t* lr);
-
- See LibRaw::dcraw_process() -
-
-

Writing to Output Files

-
-
int libraw_dcraw_ppm_tiff_writer(libraw_data_t* lr,const char *filename);
-
- See LibRaw::dcraw_ppm_tiff_writer() -
-
int libraw_dcraw_thumb_writer(libraw_data_t* lr,const char *fname);
-
- See LibRaw::dcraw_thumb_writer() -
-
-

Writing processing results to memory buffer

-
-
libraw_processed_image_t *libraw_dcraw_make_mem_image(libraw_data_t* lr,int * errcode)
-
- See LibRaw::dcraw_make_mem_image() -
-
libraw_processed_image_t *libraw_dcraw_make_mem_thumb(libraw_data_t* lr,int * errcode)
-
- See LibRaw::dcraw_make_mem_thumb() -
-
- [back to Index] -
-
LibRaw Team
- - -Last modified: Sun Sep 22 13:47:50 MSK 2013 - - - diff -Nru libraw-0.16.2/doc/API-C.html libraw-0.17.0/doc/API-C.html --- libraw-0.16.2/doc/API-C.html 1970-01-01 00:00:00.000000000 +0000 +++ libraw-0.17.0/doc/API-C.html 2015-08-15 13:10:27.000000000 +0000 @@ -0,0 +1,201 @@ + + + + LibRaw: C API + + + + [back to Index] +

LibRaw: C API

+

LibRaw C API is a wrapper around C++ API; therefore, virtually all documentation to C + API functions is represented by a set of hyperlinks to the corresponding places in the description of C++ API. +

+

Contents

+
    +
  1. Initialization: libraw_data_t *libraw_init(unsigned int flags);
  2. +
  3. Returned values
  4. +
  5. Data loading
  6. +
  7. Auxiliary Functions
  8. +
  9. Data Postprocessing, Emulation of dcraw Behavior + +
  10. +
  11. Writing to Output Files
  12. +
  13. Writing processing results to memory buffer
  14. +
+ + + +

Initialization: libraw_data_t *libraw_init(unsigned int flags);

+

+ The function returns the pointer to the instance of + libraw_data_t structure.
+ The resultant pointer should be passed as the first argument to all C API functions (except for libraw_strerror). +

+

Returns NULL in case of error, pointer to the structure in all other cases.

+ + +

Returned values

+

Functions of C API return EINVAL (see errno.h) if the null pointer was passed to them as the first argument. +In all other cases, the C++ API return code is returned. +

+ + +

Data Loading from a File

+
+
int libraw_open_file(libraw_data_t*, const char *)
+
int libraw_open_file_ex(libraw_data_t*, const char *,INT64 bigfile_size)
+
WIN32: int libraw_open_wfile(libraw_data_t*, const wchar_t *)
+
WIN32: int libraw_open_wfile_ex(libraw_data_t*, const wchar_t *,INT64 bigfile_size)
+
+ See LibRaw::open_file() +
+
int libraw_open_buffer(libraw_data_t*, void *buffer, size_t bufsize)
+
+ See LibRaw::open_buffer() +
+
int libraw_unpack(libraw_data_t*);
+
+ See LibRaw::unpack() +
+
int libraw_unpack_thumb(libraw_data_t*);
+
+ See LibRaw::unpack_thumb() +
+ +
+ +

Auxiliary Functions

+
+
const char* libraw_version()
+
+ See LibRaw::version() +
+
const char* libraw_versionNumber()
+
+ See LibRaw::versionNumber() +
+
bool LIBRAW_CHECK_VERSION(major,minor,patch)
+
+ See LIBRAW_CHECK_VERSION +
+
int libraw_cameraCount()
+
+ See LibRaw::cameraCount() +
+
int libraw_cameraList()
+
+ See LibRaw::cameraList() +
+
void libraw_get_decoder_info(libraw_data_t*,libraw_decoder_info_t *);
+
+ See LibRaw::get_decoder_info() +
+
void libraw_unpack_function_name(libraw_data_t*);
+
+ See LibRaw::unpack_function_name() +
+
void libraw_COLOR(libraw_data_t*,int row,int col);
+
+ See LibRaw::COLOR() +
+
void libraw_subtract_black(libraw_data_t*);
+
+ See LibRaw::subtract_black() +
+
void libraw_recycle_datastream(libraw_data_t*);
+
+ See LibRaw::recycle_datastream() +
+
void libraw_recycle(libraw_data_t*);
+
+ See LibRaw::recycle() +
+
void libraw_close(libraw_data_t*);
+
+ See LibRaw::~LibRaw() +
+
const char *libraw_strerror(int errorcode);
+
+ See LibRaw::strerror +
+
const char *libraw_strprogress(enum LibRaw_progress);
+
+ See LibRaw::strprogress +
+
void libraw_set_memerror_handler(libraw_data_t*, memory_callback cb);
+
+ See LibRaw::set_memerror_handler() +
+
void libraw_set_dataerror_handler(libraw_data_t*,data_callback func);
+
+ See LibRaw::set_dataerror_handler() +
+
void libraw_set_progress_handler(libraw_data_t*,progress_callback func);
+
+ See LibRaw::set_progress_handler() +
+
+ +

Data Postprocessing, Emulation of dcraw Behavior

+ +

Setting of Parameters

+

+ The postprocessing parameters for the calls described below are set, just as for C++ API, via setting of fields in the + libraw_output_params_t structure: +

+
+ libraw_data_t *ptr = libraw_init(0);
+ ptr->params.output_tiff = 1; //  output to TIFF
+    
+

+ Fields of this structure are described in the documentation to + libraw_output_params_t. For notes on their use, see API notes. +

+ +

Emulation of dcraw Behavior

+
+
int libraw_raw2image(libraw_data_t*);
+
+ See LibRaw::raw2image +
+
int libraw_free_image(libraw_data_t*);
+
+ See LibRaw::free_image +
+
int libraw_adjust_sizes_info_only(libraw_data_t*);
+
+ See LibRaw::adjust_sizes_info_only() +
+
int libraw_dcraw_process(libraw_data_t* lr);
+
+ See LibRaw::dcraw_process() +
+
+

Writing to Output Files

+
+
int libraw_dcraw_ppm_tiff_writer(libraw_data_t* lr,const char *filename);
+
+ See LibRaw::dcraw_ppm_tiff_writer() +
+
int libraw_dcraw_thumb_writer(libraw_data_t* lr,const char *fname);
+
+ See LibRaw::dcraw_thumb_writer() +
+
+

Writing processing results to memory buffer

+
+
libraw_processed_image_t *libraw_dcraw_make_mem_image(libraw_data_t* lr,int * errcode)
+
+ See LibRaw::dcraw_make_mem_image() +
+
libraw_processed_image_t *libraw_dcraw_make_mem_thumb(libraw_data_t* lr,int * errcode)
+
+ See LibRaw::dcraw_make_mem_thumb() +
+
+ [back to Index] + + diff -Nru libraw-0.16.2/doc/API-C-rus.html libraw-0.17.0/doc/API-C-rus.html --- libraw-0.16.2/doc/API-C-rus.html 2015-05-16 12:32:15.000000000 +0000 +++ libraw-0.17.0/doc/API-C-rus.html 1970-01-01 00:00:00.000000000 +0000 @@ -1,208 +0,0 @@ - - - - LibRaw: C API - - - [вернуться к оглавлению] -

LibRaw: C API

-

LibRaw C API является "оберткой" (wrapper) вокруг С++ API, поэтому практически вся документация к функциям C - API является набором гиперссылок на соответствующие места описания C++ API. -

- -

Содержание

-
    -
  1. Инициализация: libraw_data_t *libraw_init(unsigned int flags);
  2. -
  3. Возвращаемые значения
  4. -
  5. Загрузка данных из файла
  6. -
  7. Вспомогательные функции
  8. -
  9. Постобработка данных, эмуляция поведения dcraw - -
  10. -
  11. Запись выходных файлов
  12. -
  13. Запись результатов распаковки в память
  14. -
- - -

Инициализация: libraw_data_t *libraw_init(unsigned int flags);

-

- Функция возвращает указатель на экземпляр структуры - libraw_data_t.
- Полученный указатель нужно передавать в качестве первого аргумента во все функции C API (кроме libraw_strerror). -

-

Возвращает: NULL при ошибке, указатель на структуру во всех остальных случаях.

- - -

Возвращаемые значения

-

Функции C API возвращают EINVAL (см. errno.h) если им передан нулевой указатель в качестве первого - аргумента. Во всех прочих случаях транслируется код возврата C++ API. -

- - -

Загрузка данных из файла

-
-
int libraw_open_file(libraw_data_t*, const char *)
-
int libraw_open_file_ex(libraw_data_t*, const char *,INT64 bigfile_size)
-
WIN32: int libraw_open_wfile(libraw_data_t*, const wchar_t *)
-
WIN32: int libraw_open_wfile_ex(libraw_data_t*, const wchar_t *,INT64 bigfile_size)
-
- См. LibRaw::open_file() -
-
int libraw_open_buffer(libraw_data_t*, void *buffer, size_t bufsize)
-
- См. LibRaw::open_buffer() -
-
int libraw_unpack(libraw_data_t*);
-
- См. LibRaw::unpack() -
-
int libraw_unpack_thumb(libraw_data_t*);
-
- См. LibRaw::unpack_thumb() -
- -
- -

Вспомогательные функции

-
-
const char* libraw_version()
-
- См. LibRaw::version() -
-
const char* libraw_versionNumber()
-
- См. LibRaw::versionNumber() -
-
bool LIBRAW_CHECK_VERSION(major,minor,patch)
-
- См. LIBRAW_CHECK_VERSION в описании C++ API -
-
int libraw_cameraCount()
-
- См. LibRaw::cameraCount() -
-
int libraw_cameraList()
-
- См. LibRaw::cameraList() -
-
void libraw_get_decoder_info(libraw_data_t*,libraw_decoder_info_t *);
-
- См. LibRaw::get_decoder_info() -
-
void libraw_unpack_function_name(libraw_data_t*);
-
- См. LibRaw::unpack_function_name() -
-
void libraw_COLOR(libraw_data_t*,int row,int col);
-
- See LibRaw::COLOR() -
-
void libraw_subtract_black(libraw_data_t*);
-
- См. LibRaw::subtract_black() -
-
void libraw_recycle_datastream(libraw_data_t*);
-
- См. LibRaw::recycle_datastream() -
-
void libraw_recycle(libraw_data_t*);
-
- См. LibRaw::recycle() -
-
void libraw_close(libraw_data_t*);
-
- См. LibRaw::~LibRaw() -
-
const char *libraw_strerror(int errorcode);
-
- См. libraw_strerror -
-
const char *libraw_streprogress(enum LibRaw_progress);
-
- См. LibRaw::strprogress -
-
void libraw_set_memerror_handler(libraw_data_t*, memory_callback cb);
-
- См. LibRaw::set_memerror_handler() -
-
void libraw_set_dataerror_handler(libraw_data_t*,data_callback func);
-
- См. LibRaw::set_dataerror_handler() -
-
void libraw_set_progress_handler(libraw_data_t*,progress_callback func);
-
- См. LibRaw::set_progress_handler() -
-
- -

Постобработка данных, эмуляция поведения dcraw

- -

Установка параметров

-

- Параметры постобработки для описанных ниже вызовов ставятся, как и для С++ API, модификацией полей структуры - libraw_output_params_t: -

-
- libraw_data_t *ptr = libraw_init(0);
- ptr->params.output_tiff = 1; //  выводить в TIFF
-    
-

- Поля структуры описаны в документации на - libraw_output_params_t, замечания по их использованию указаны в API notes. -

- -

Эмуляция поведения dcraw

-
-
int libraw_raw2image(libraw_data_t*);
-
- См. LibRaw::raw2image() -
-
int libraw_free_image(libraw_data_t*);
-
- См. LibRaw::free_image() -
-
int libraw_adjust_sizes_info_only(libraw_data_t*);
-
- См. LibRaw::adjust_sizes_info_only() -
-
int libraw_dcraw_process(libraw_data_t* lr);
-
- См. LibRaw::dcraw_process() -
-
- -

Запись выходных файлов

-
-
int libraw_dcraw_ppm_tiff_writer(libraw_data_t* lr,const char *filename);
-
- См. LibRaw::dcraw_ppm_tiff_writer() -
-
int libraw_dcraw_thumb_writer(libraw_data_t* lr,const char *fname);
-
- См. LibRaw::dcraw_thumb_writer() -
-
- -

Запись результатов распаковки в память

-
-
libraw_processed_image_t *libraw_dcraw_make_mem_image(libraw_data_t* lr,int * errcode)
-
- См. LibRaw::dcraw_make_mem_image() -
-
libraw_processed_image_t *libraw_dcraw_make_mem_thumb(libraw_data_t* lr,int * errcode)
-
- См. LibRaw::dcraw_make_mem_thumb() -
-
- [вернуться к оглавлению] -
-
LibRaw Team
- - -Last modified: Tue Jul 19 14:49:40 MSD 2011 - - - diff -Nru libraw-0.16.2/doc/API-CXX-eng.html libraw-0.17.0/doc/API-CXX-eng.html --- libraw-0.16.2/doc/API-CXX-eng.html 2015-05-16 12:32:15.000000000 +0000 +++ libraw-0.17.0/doc/API-CXX-eng.html 1970-01-01 00:00:00.000000000 +0000 @@ -1,937 +0,0 @@ - - - - LibRaw C++ API - - - - [back to Index] -

LibRaw C++ API

-

Contents

-
    -
  1. LibRaw Objects
  2. -
  3. Returned values
  4. -
  5. Methods Loading Data from a File - -
  6. -
  7. Auxiliary Functions - -
  8. -
  9. Data Postprocessing: Emulation of dcraw Behavior - -
  10. -
  11. Data Output to Files: Emulation of dcraw Behavior - -
  12. -
  13. - Copying unpacked data into memory buffer - -
  14. -
  15. Input layer abstraction - -
  16. -
- - -

LibRaw Objects

-

- The main LibRaw object (class) is created either without parameters or with flags determining the object behavior. -

-
-#include "libraw/libraw.h"
-...
-
-   LibRaw ImageProcessor(unsigned int flags=0);
-...
-    
-

Flags (several flags are combined via operator |, i.e., bitwise OR):

-
    -
  • LIBRAW_OPTIONS_NO_MEMERR_CALLBACK: do not set the standard -out-of-memory error handler (standard handler outputs the error report in stderr);
  • -
  • LIBRAW_OPTIONS_NO_DATAERR_CALLBACK: do not set the standard -file read error handler (standard handler outputs the error report in stderr).
  • -
-

- Three groups of methods are used for image processing -

- -

- The results of processing are placed in the imgdata field of type libraw_data_t; the same data set contains fields that control the postprocessing -and output. -

- -

Returned Values

-

- All LibRaw API functions return an integer number in accordance with the -return code convention. Please read the descriptions of -this convention and LibRaw behavior -in cases of fatal errors. -

- - -

Methods Loading Data from a File

- -

int LibRaw::open_datastream(LibRaw_abstract_datastream *stream)

-

Opens a datastream with RAW data, reads metadata (EXIF) from it, and fills the following structures: -

- -

The function returns an integer number in accordance with the return -code convention: positive if any system call has returned an error, negative - (from the LibRaw error list) if there has been an error -situation within LibRaw. -

-

Before file opening, recycle() is always called; hence, if several images -are processed in the batch mode, there is no need to call recycle() at the end of each processing cycle. -

-

Input data: pointer to object, derived from LibRaw_abstract_datastream class. - This object should be initialized and ready to read. This object should be destroyed in calling application - after use. -

- -

int LibRaw::open_file(const char *filename[,INT64 bigfile_size])

-

Win32 only: int LibRaw::open_file(const wchar_t *filename[,INT64 bigfile_size])

-

- Creates an LibRaw_file_datastream object, calls - open_datastream(). If succeed, sets internal flag which signals - to destroy internal datastream object on recycle(). On failure, - just created file_datastream destroyed immediately. -

-

- Second optional parameter bigfile_size controls background I/O interface used for file operations. For - files smaller than bigfile_size the LibRaw_file_datastream will be used and the LibRaw_bigfile_datastream otherwise. -

The function returns an integer number in accordance with the - return code convention: positive if any system call has returned an error, negative - (from the LibRaw error list) if there has been an error - situation within LibRaw. -

- - -

int LibRaw::open_buffer(void *buffer, size_t bufsize)

-

- Created an LibRaw_buffer_datastream object, calls - open_datastream(). If succeed, sets internal flag which signals - to destroy internal datastream object on recycle(). On failure, - just created file_datastream destroyed immediately. -

-

The function returns an integer number in accordance with the - return code convention: positive if any system call has returned an error, negative - (from the LibRaw error list) if there has been an error - situation within LibRaw. -

- - -

int LibRaw::unpack(void)

-

- Unpacks the RAW files of the image, calculates the black level (not for all formats). The results are placed in imgdata.image. -

-

- Data reading is sometimes (not frequently) affected by settings made in imgdata.params (libraw_output_params_t); see API notes for details. -

-

The function returns an integer number in accordance with the return code -convention: positive if any system call has returned an error, negative (from the - LibRaw error list) if there has been an error -situation within LibRaw. -

- - -

int LibRaw::unpack_thumb(void)

-

- Reads (or unpacks) the image preview (thumbnail), placing the result into the imgdata.thumbnail.thumb buffer.
- JPEG previews are placed into this buffer without any changes (with the header etc.). Other preview -formats are placed into the buffer in the form of the unpacked bitmap image (three components, 8 bits per component).
- The thumbnail format is written to the imgdata.thumbnail.tformat field; for the possible values, see -description of constants and data structures. - -

-

The function returns an integer number in accordance with the return code -convention: positive if any system call has returned an error, negative (from the -LibRaw error list) if there has been an error situation within -LibRaw. -

- -

Auxiliary Functions

-

Library version check

- -

const char* LibRaw::version()

-

- Returns string representation of LibRaw version in MAJOR.MINOR.PATCH-Status format (i.e. 0.6.0-Alpha2 - or 0.6.1-Release). -

- -

int LibRaw::versionNumber()

-

- Returns integer representation of LibRaw version. During LibRaw development, the version number is always - increase . -

- -

bool LIBRAW_CHECK_VERSION(major,minor,patch)

-

- Macro for version check in caller applications. Returns 'true' if current library version is greater or equal to - set in macro parameters. This macro executes at runtime (not at compile time) and may be used for checking - version of dynamically loaded LibRaw (from DLL/shared library). -

-

List of supported RAW formats (cameras)

- -

int LibRaw::cameraCount()

-

- Returns count of cameras supported. -

- -

const char** LibRaw::cameraList()

-

- Returns list of supported cameras. Latest item of list is set to NULL (for easy printing). -

- -

int LibRaw::set_rawspeed_camerafile(char *path_to_cameras_xml)

-

- (Only if LibRaw was built with RawSpeed support). -

- Loads XML file with RawSpeed camera description data (cameras.xml) specified by path_to_cameras_xml. - Returns 0 on success, nonzero on error. - -

int LibRaw::get_decoder_info(libraw_decoder_info_t *)

-

- The function fills libraw_decoder_info_t - structure by passed pointer with current raw decoder data. -

-

The function returns an integer number in accordance with the return code - convention: positive if any system call has returned an error, negative (from the - LibRaw error list) if there has been an error situation within - LibRaw. -

- -

const char* LibRaw::unpack_function_name()

-

- Returns function name of file unpacking function. Intended only for LibRaw test suite designers to use in test - coverage evaluation. -

- - -

void LibRaw::setCancelFlag()

-

- This call sets internal fast cancel flags. If set, current Raw decoder will be terminated ASAP. - This call is useful if you need to cancel all LibRaw decoders in multithreaded program (e.g. for - fast program termination). -

- - -

int LibRaw::COLOR(int row, int col)

-

- This call returns pixel color (color component number) in bayer patter at row,col. The returned value - is in 0..3 range for 4-component Bayer (RGBG2, CMYG and so on) and in 0..2 range for 3-color data. -

- - -

void LibRaw::subtract_black()

-

- This call will subtract black level values from RAW data (for suitable RAW data). - colordata.data_maximum and - colordata.maximum and black level data (colordata.black and colordata.cblack) will be adjusted - too. -

-

- This call should be used if you postprocess RAW data by your own code. LibRaw - postprocessing functions will call subtract_black() by oneself. -

-

The function returns an integer number in accordance with the return code - convention: positive if any system call has returned an error, negative (from the - LibRaw error list) if there has been an error situation within - LibRaw. -

- - -

void LibRaw::recycle_datastream(void)

-

- This call closes input datastream with associated data buffer and unblocks opened file. - - -

void LibRaw::recycle(void)

-

Frees the allocated data of LibRaw instance, enabling one to process the next file using -the same processor. Repeated calls of recycle() are quite possible and do not conflict with anything. -

- - -

LibRaw::~LibRaw()

-

Destructor, which consists in calling recycle().

- - -

const char* LibRaw::strprogress(enum LibRaw_progress code)

-

Converts progress stage code to description string (in English).

- - -

const char* LibRaw::strerror(int errorcode)

-

Analog of strerror(3) function: outputs the text descriptions of LibRaw error codes (in English).

- - -

Setting Error Notification Functions

-

- In process of RAW conversion LibRaw can call user-setted callback. This callback can be used for: -

-
    -
  • Dynamic status update (progress bar and so on).
  • -
  • Cancel of processing (for example, user pressed Cancel button).
  • -
-

Also, work of the library may cause two types of exceptional situations that require notification of the calling application: -

-
    -
  • Memory shortage
  • -
  • Data read error.
  • -
-

- An application may set its own callbacks that will be called in the cases mentioned above to notify the user (or the calling program). -

- -

Progress indication/processing termination

-
-        typedef int (*progress_callback)(void *callback_data,enum LibRaw_progress stage, int iteration, int expected);
-        void LibRaw::set_progress_handler(progress_callback func,void *callback_data);
-    
-

- LibRaw user can set own callback which will be called 10-50 times during RAW postprocessing - by dcraw_process(). -

-

- This callback may terminate current image processing by returning of non-zero value. In such case all processing - will be cancelled immediately and all resources will be returned to system by recycle() call. - Current call of dcraw_process() will return error code - LIBRAW_CANCELLED_BY_CALLBACK. -

-

- Callback parameters: -

-
void *callback_data
-
void*-pointer, passed as 2nd argument to set_progress_handler(). This pointer should be used to pass - additional data to callback (i.e. thread local data and so on). -
-
enum LibRaw_progress stage
-
Current processing stage. This number can be converted to string by call to - LibRaw::strprogress. Not all processing stages are covered by callback calls. -
-
int iteration
-
Iteration number within current stage (from 0 to expected-1). -
-
int expected
-
Expected number of iterations on current stage.
-
- Callback should return value of: 0 for continue processing and non-zero for immediate cancel of processing. -

-

- If LibRaw compiled with OpenMP support, iteration parameter may not always increase within one stage. Out of - order callback calls are possible. -

-

- Callback code sample: -

-int my_progress_callback(void *data,enum LibRaw_progress p,int iteration, int expected)
-{
-    char *passed_string = (char *data);
-    printf("Callback: %s  pass %d of %d, data passed: %s\n",libraw_strprogress(p),iteration,expected,passed_string);
-    if(timeout || key_pressed )
-        return 1; // cancel processing immediately
-    else
-        return 0; // can continue
-}
-
-
- - -

Out-of-Memory Notifier

-
-        typedef void (* memory_callback)(void *callback_data,const char *file, const char *where);
-        void LibRaw::set_memerror_handler(memory_callback func,void *callback_data);
-    
-

The user may set his or her own function called in the case of memory shortage. It is a void function -receiving two string parameters: -

-
    -
  • void *callback_data - void*-pointer, passed as 2nd argument to set_progress_handler(). This pointer - should be used to pass additional data to callback (i.e. thread local data and so on).
  • -
  • file is the name of the RAW file whose processing evoked the out-of-memory error. - This name can be NULL if underlying data input layer does not know the name. So, if calling - application sets own callback, this callback should work with NULL file name. -
  • -
  • where is the name of the function where memory shortage occurred.
  • -
-

The callback function is intended for information purposes: it notifies the user -or the program code that processing is impossible.

-

If the user does not set his or her own handler, the standard one (output of error message in stderr) will be used.

-

One can set the null handler by passing NULL to set_memerror_handler; then no notifier -function will be called. The same effect can be achieved by creating a LibRaw object with the LIBRAW_OPTIONS_NO_MEMERR_CALLBACK -flag in the contructor. -

-

In the case of memory shortage, processing of the current file is terminated and a notifier is called; all -allocated resources are freed, and recycle() is performed. The current call will return -LIBRAW_UNSUFFICIENT_MEMORY. -
-At an attempt to continue data processing, all subsequent calls will return LIBRAW_OUT_OF_ORDER_CALL. -Processing of a new file may be started in the usual way, by calling LibRaw::open_file(). -

- -

File Read Error Notifier

-
-        typedef void (*data_callback)(void *callback_data,const char *file, const int offset);
-        void LibRaw::set_dataerror_handler(data_callback func, void *callback_data); 
-    
-

- The user can define his or her own function to be called in the case of error in the input data. It is a void function receiving -two parameters: -

-
    -
  • void *callback_data - void*-pointer, passed as 2nd argument to set_progress_handler(). This pointer - should be used to pass additional data to callback (i.e. thread local data and so on).
  • -
  • file is the name of the RAW file whose processing evoked the file read error. - This name can be NULL if underlying data input layer does not know the name. So, if calling - application sets own callback, this callback should work with NULL file name. -
  • -
  • offset is -1 at end-of-file (if LibRaw expects more data) or a positive number equal to -the file position (bytes from file beginning) where the unpacking error occurred.
  • -
-

The callback function is intended for information purposes: it notifies the user -or the program code that processing is impossible.

-

If the user does not set his or her own handler, the standard one (output of error message in stderr) will be used.

-

One can set the null handler by passing NULL to set_memerror_handler; then no notifier -function will be called. The same effect can be achieved by creating a LibRaw object with the LIBRAW_OPTIONS_NO_DATAERR_CALLBACK -flag in the contructor.

-

In the case of error in the input data, processing of the current file is terminated and a notifier is called; all -allocated resources are freed, and recycle() is performed. The current call will return -LIBRAW_IO_ERROR. -
-At an attempt to continue data processing, all subsequent calls will return LIBRAW_OUT_OF_ORDER_CALL. -Processing of a new file may be started in the usual way, by calling LibRaw::open_file(). -

- - -

Data Postprocessing: Emulation of dcraw Behavior

-

- Instead of writing one's own Bayer pattern postprocessing, one can use the dcraw functions, which are called - after the calls of open_file() + unpack() /+ unpack_thumb()/ -

- -

Parameter Setting

-

- Virtually all parameters that can be set through the dcraw command line are specified by assigning values to - fields of the LibRaw::imgdata.params structure. The type of this structure is - libraw_output_params_t; all fields are listed and described in sufficient detail in the description of data structures. -

- -

int LibRaw::raw2image

-

- This function allocates buffer for postprocessing (imgdata.image) and fills it with data layout compatible - with LibRaw 0.13/0.14 and below. If the buffer is already allocated, it will be free()ed and allocated again. -

-

- This function should be called only if your code do postprocessing stage. If you use LibRaw's postprocessing - calls (see below) you don't need to call raw2image(). -

-

The function returns an integer number in accordance with the return code - convention: positive if any system call has returned an error, negative (from the - LibRaw error list) if there has been an error situation within - LibRaw. -

- - -

void LibRaw::free_image

-

- This function releases the imgdata.image buffer allocated by raw2image(); -

-

- This method should be called if current postprocessing results are not needed by the program (e.g. already - copied somewhere), but new postprocessing calls (with another settings) are possible, so it is to early - to call recycle(). -

- - -

int LibRaw::adjust_sizes_info_only(void)

-

- The function calculates the correct size of the output image (imgdata.sizes.iwidth and imgdata.sizes.iheight) for the - following cases: -

-
    -
  • Files from Fuji cameras (with a 45-degree rotation)
  • -
  • Files from cameras with non-square pixels
  • -
  • Images shot by a rotated camera.
  • -
-

- In the aforementioned cases, the function changes the fields of the image output size; note that -this change cannot be repeated again. -

- - -

int LibRaw::dcraw_process(void)

-

- The function emulates the postprocessing capabilities available in dcraw.
- Called after calling LibRaw::unpack(); -

-

The entire functionality of dcraw (set via the field values in imgdata.params) is supported, except for -

-
    -
  • Dark frame subtraction
  • -
  • Work with bad pixels.
  • -
-

The function is intended solely for demonstration and testing purposes; it is assumed that its source code -will be used in most real applications as the reference material concerning the order of RAW data processing. -

-

The function returns an integer number in accordance with the error -code convention: positive if any system call has returned an error, negative (from the -LibRaw error list) if there has been an error situation within -LibRaw. -

- -

Data Output to Files: Emulation of dcraw Behavior

-

In spite of the abundance of libraries for file output in any formats, LibRaw includes calls that emulate -the file output provided by dcraw. This is done primarily for easier verification of library work: the resultant -files must be binary identical. -

- - -

int LibRaw::dcraw_ppm_tiff_writer(const char *outfile)

-

- The function outputs the postprocessing results to a file in the PPM/PGM or TIFF format (the format is set via - imgdata.params.output_tiff). The results are binary identical to those provided by dcraw. -

-

The function returns an integer number in accordance with the error -code convention: positive if any system call has returned an error, negative (from the -LibRaw error list) if there has been an error situation within -LibRaw. -

- -

int LibRaw::dcraw_thumb_writer(const char *thumbfile)

-

Writes the thumbnail to a file in the PPM format for bitmap thumbnails and in the JPEG format for JPEG thumbnails, i.e., -in the format completely identical to the results provided by dcraw. -

-

The function returns an integer number in accordance with the error -code convention: positive if any system call has returned an error, negative (from the -LibRaw error list) if there has been an error situation within -LibRaw. -

- -

Copying unpacked data into memory buffer

-

- There is several function calls for store unpacked data into memory buffer (after using dcraw_process() and so on): -

    -
  • get_mem_image_format - get resulting bitmap size and bit depth.
  • -
  • copy_mem_image - copy postprocessed data into some memory buffer with different color order and - line stride. -
  • -
  • dcraw_make_mem_image - store processed image data into allocated buffer; -
  • -
  • dcraw_make_mem_thumb - store extracted thumbnail into buffer as JPEG-file image (for most cameras) - or as RGB-bitmap. -
  • -
- For usage primer see samples/mem_image.c sample. -

- -

void get_mem_image_format(int *widthp, int *heightp, int *colorsp, int *bpp) const - return processing bitmap - size

-

This function returns size of postprocessed image: -

-
    -
  • Image width is returned in *widthp;
  • -
  • Bitmap height is returned in *heightp;
  • -
  • Image color count is returned in *colorsp;
  • -
  • Bits per pixel (8 or 16) is returned in *bpp;
  • -
- -

int LibRaw::copy_mem_image(void* scan0, int stride, int bgr) - copies postprocessed bitmap data into - buffer

-

- Function parameters: -

-
    -
  • void *scan0 - pointer to buffer to copy data to. The buffer should be at least stride*image_height - bytes;
  • -
  • int stride - stride of each other image line (row) in bytes. Usually - image_width*(bit_per_pixel/8)*image_colors, but may be more if you wish to align image rows to, for example, 8 - or 16 or 32 bytes to make CPU more happy.
  • -
  • int bgr - pixel copy order. RGB if bgr==0 and BGR overwise.
  • -
-

The function returns an integer number in accordance with the error -code convention: positive if any system call has returned an error, negative (from the -LibRaw error list) if there has been an error situation within -LibRaw. -

- -

libraw_processed_image_t *dcraw_make_mem_image(int *errorcode=NULL) - store unpacked and processed image into - memory buffer as RGB-bitmap

-

- This function allocates memory buffer and stores unpacked-preprocessed image into this buffer. Function returns - allocated structure libraw_processed_image_t with - filled fields. Always returns data as RGB bitmap (i.e. type field is equal to LIBRAW_IMAGE_BITMAP). -

-

- - dcraw_process() should be called before dcraw_make_mem_image(); -

-

- Returns NULL in case of an error. If caller has passed not-NULL value as errorcode parameter, than *errorcode - will be set to error code according to error code convention. -

-

NOTE! Memory, allocated for return value will not be fried at destructor or LibRaw::recycle - calls. Caller of dcraw_make_mem_image should free this memory by call to LibRaw::dcraw_clear_mem(). -

- - -

libraw_processed_image_t *dcraw_make_mem_thumb(int *errorcode=NULL) - store unpacked thumbnail into memory buffer

-

- This function allocates memory buffer and stores thumbnail data in it. Function returns allocated - structure libraw_processed_image_t with - filled fields. For most RAW images allocated structure will contains JPEG image (i.e. type - field is equal to LIBRAW_IMAGE_JPEG). For some cameras with RGB-bitmap thumbnail (Kodak SLRs) - returned structure contains RGB bitmap (type field is equal to LIBRAW_IMAGE_JPEG, see structure - description for details). -

-

- unpack_thumb() should be called before dcraw_make_mem_thumb(); -

-

- Returns NULL in case of an error. If caller has passed not-NULL value as errorcode parameter, than *errorcode - will be set to error code according to error code convention. -

-

NOTE! Memory, allocated for return value will not be fried at destructor or LibRaw::recycle - calls. Caller of dcraw_make_mem_image should free this memory by call to LibRaw::dcraw_clear_mem(). -

- -

void LibRaw::dcraw_clear_mem(libraw_processed_image_t *)

-

- This function will free the memory allocated by dcraw_make_mem_image or dcraw_make_mem_thumb. -

-

- This is static class member, so call syntax should be LibRaw::dcraw_clear_mem(...). -

-

- This call translates directly to free() system function, but it is better to use dcraw_clear_mem because - LibRaw (DLL) may be compiled with memory manager other than in calling application. -

- - -

Input layer abstraction

- -

class LibRaw_abstract_datastream - abstract RAW read interface

-

- LibRaw reads RAW-data by calling (virtual) methods of C++ object derived from - LibRaw_abstract_datastream. This C++ class does not implement any read, but defines interface to be - called. Call to base class methods always results in error. -

- -

LibRaw_abstract_datastream class methods

- -
Object verification
-
-
virtual int valid()
-
Checks input datastream validity. Returns 1 on valid stream and 0 if datastream was created on non-valid - input parameters (wrong filename for file stream and so on). -
- -
Stream read and positioning
-

This group of methods implements file object (FILE*) semantics.

-
-
virtual int read(void * ptr,size_t size, size_t nmemb)
-
- Similar to fread(ptr,size,nmemb,file). -
-
virtual int seek(off_t o, int whence)
-
- Similar to fseek(file,o,whence). -
-
virtual int tell(
-
- Similar to ftell(file). -
-
virtual int get_char()
-
- Similar to getc(file)/fgetc(file). -
-
virtual char* gets(char *s, int n)
-
- Similar to fgets(s,n,file). -
-
virtual int eof()
-
- Similar to feof(file). -
-
virtual int scanf_one(const char *fmt, void *val)
-
- Simplified variant of fscanf(file,fmt,val): format string is always contains one argument to read. So, - variable args call is not needed and only one pointer to data passed. -
-
virtual int jpeg_src(void * p);
-
- Initializes read structures in j_decompress_ptr object passed as *p. - This object is used by libjpeg for JPEG data reading from datastream. -

- Retuens -1 on error and 0 on success. -

-
virtual void * make_jas_stream();
-
- Creates LibJasper input stream (for JPEG2000 decoding). -

- returns NULL on error or data pointer on success. -

-
- -
Other methods
-

This group of methods includes several supplementary calls. These calls are used to temporary switch to another - data stream (file and/or memory buffer). -

-
-
virtual const char* fname()
-
- Returns name of opened file if datastream object knows it (for example, - LibRaw_file_datastream used). Filename used in: -
    -
  • error notification callbacks;
  • -
  • generation of filename of JPEG-file with metadata when needed (i.e. cameras with 'Diag RAW hack'). -
-
-
virtual int subfile_open(const char *fn)
-
- This call temporary switches input to file fn. Returns 0 on success and error code on error.
- The function used to read metadata from external JPEG file (on cameras with "Diag RAW hack"). -
- This call is not implemented for LibRaw_buffer_datastream, so - external JPEG processing is not possible when buffer datastream used. -
- This functon should be implemented in real input class, base class call always return error. -
- Working implementation sample can be found in - LibRaw_file_datastream implementation in libraw/libraw_datastream.h file. -
-
virtual void subfile_close()
-
- This call switches input stream from temporary open file back to main data stream. -
-
virtual int tempbuffer_open(void *buf, size_t size)
-
- This call temporary switches input to LibRaw_buffer_datastream object, - created from buf.
- This method is needed for Sony encrypted metadata parser. -

- This call implemented in base class (LibRaw_abstract_datastream), there is no need to - reimplement in in derived classes.
- Possible activity of temporary datastream requires very accurate programming when implementing - datastreams derived from base LibRaw_abstract_datastream. See below - for more details. -

-
virtual void tempbuffer_close()
-
- This call switch input back from temporary datastream to main stream. This call implemented - in base LibRaw_abstract_datastream class. -
-
- - -

Derived input classes included in LibRaw

-

- There is three "standard" input classes in LibRaw distribution: -

- -

- LibRaw C++ interface users can implement their own input classes and use them via - LibRaw::open_datastream call. Requirements and implementation specifics are - described below. -

- -

class LibRaw_file_datastream - file input interface

-

- This class implements input from file. -

-

Class methods:

-
-
LibRaw_file_datastream(const char *fname)
-
- This constructor creates LibRaw_file_datastream object from file fname.
- Unfortunately, C++ constructor cannot return an error. So if bad filename passed (e.g. nonexistent file) - object is created as non-valid (valid() call returns zero). -
-
-

- All other class methods are described above.
- This class implements all possble methods, including fname() and subfile_open(). -

- -

class LibRaw_bigfile_datastream - file input interface

-

- This class implements input from file. -

-

Class methods:

-
-
LibRaw_bigfile_datastream(const char *fname)
-
- This constructor creates LibRaw_bigfile_datastream object from file fname.
- Unfortunately, C++ constructor cannot return an error. So if bad filename passed (e.g. nonexistent file) - object is created as non-valid (valid() call returns zero). -
-
-

The difference between file and bigfile datastreams are obvious from class name: bigfile one - supports large files (more than 2Gb) on all supported systems. File one uses streambuf interface which is - limited to 2Gb on many systems. -

- All other class methods are described above.
- This class implements all possble methods, including fname() and subfile_open(). -

- -

class LibRaw_buffer_datastream - memory buffer input interface

-

- This class implements input from memory buffer. -

-

Class methods:

-
-
LibRaw_buffer_datastream(void *buffer, size_t bsize)
-
- This constructor creates datastream object from buffer with size bsize.
- It is not possibly to verify the pointer passed, so buffer address is checked against 0 and -1 only. -
-
-

- All other class methods are described above.
- This class does not implement fname() and subfile_open() calls, so external JPEG metadata parsing - is not possible. -

- -

Own datastream derived classes

-

- To create own read interface LibRaw user should implement C++ class derived from - LibRaw_abstract_datastream with all read methods.
- LibRaw standard implementations may be used as reference. See libraw/libraw_datastream.h file for details - (all standard LibRaw input classes are implemented using inline functions only). -

- -

substream field: secondary input stream

-

- substream field, defined in base LibRaw_abstract_datastream class requires some additional notes. - This field is used when input switched to temporary buffer (used for Sony metadata processing). Unfortunately, - there is now ideal C++ way to hide this functionality into base class internals. So, any read call in - derived class should include 1-line statement like this:
- int method(...args...){ if(substream) return substream->method(...args...). For example: -

-    virtual int eof() 
-    { 
-        if(substream) return substream->eof();
-....
-    virtual int scanf_one(const char *fmt, void* val) 
-    { 
-        if(substream) return substream->scanf_one(fmt,val);
-
- - - - [back to Index] -
-
LibRaw Team
- - -Last modified: Sun Sep 22 13:53:18 MSK 2013 - - - diff -Nru libraw-0.16.2/doc/API-CXX.html libraw-0.17.0/doc/API-CXX.html --- libraw-0.16.2/doc/API-CXX.html 1970-01-01 00:00:00.000000000 +0000 +++ libraw-0.17.0/doc/API-CXX.html 2015-08-15 13:10:27.000000000 +0000 @@ -0,0 +1,985 @@ + + + + LibRaw C++ API + + + + [back to Index] +

LibRaw C++ API

+

Contents

+
    +
  1. LibRaw Objects
  2. +
  3. Returned values
  4. +
  5. Methods Loading Data from a File + +
  6. +
  7. Auxiliary Functions + +
  8. +
  9. Data Postprocessing: Emulation of dcraw Behavior + +
  10. +
  11. Data Output to Files: Emulation of dcraw Behavior + +
  12. +
  13. + Copying unpacked data into memory buffer + +
  14. +
  15. Input layer abstraction + +
  16. +
+ + +

LibRaw Objects

+

+ The main LibRaw object (class) is created either without parameters or with flags determining the object behavior. +

+
+#include "libraw/libraw.h"
+...
+
+   LibRaw ImageProcessor(unsigned int flags=0);
+...
+    
+

Flags (several flags are combined via operator |, i.e., bitwise OR):

+
    +
  • LIBRAW_OPTIONS_NO_MEMERR_CALLBACK: do not set the standard +out-of-memory error handler (standard handler outputs the error report in stderr);
  • +
  • LIBRAW_OPTIONS_NO_DATAERR_CALLBACK: do not set the standard +file read error handler (standard handler outputs the error report in stderr).
  • +
+

+ Three groups of methods are used for image processing +

+ +

+ The results of processing are placed in the imgdata field of type libraw_data_t; the same data set contains fields that control the postprocessing +and output. +

+ +

Returned Values

+

+ All LibRaw API functions return an integer number in accordance with the +return code convention. Please read the descriptions of +this convention and LibRaw behavior +in cases of fatal errors. +

+ + +

Methods Loading Data from a File

+ +

int LibRaw::open_datastream(LibRaw_abstract_datastream *stream)

+

Opens a datastream with RAW data, reads metadata (EXIF) from it, and fills the following structures: +

+ +

The function returns an integer number in accordance with the return +code convention: positive if any system call has returned an error, negative + (from the LibRaw error list) if there has been an error +situation within LibRaw. +

+

Before file opening, recycle() is always called; hence, if several images +are processed in the batch mode, there is no need to call recycle() at the end of each processing cycle. +

+

Input data: pointer to object, derived from LibRaw_abstract_datastream class. + This object should be initialized and ready to read. This object should be destroyed in calling application + after use. +

+ +

int LibRaw::open_file(const char *filename[,INT64 bigfile_size])

+

Win32 only: int LibRaw::open_file(const wchar_t *filename[,INT64 bigfile_size])

+

+ Creates an LibRaw_file_datastream object, calls + open_datastream(). If succeed, sets internal flag which signals + to destroy internal datastream object on recycle(). On failure, + just created file_datastream destroyed immediately. +

+

+ Second optional parameter bigfile_size controls background I/O interface used for file operations. For + files smaller than bigfile_size the LibRaw_file_datastream will be used and the LibRaw_bigfile_datastream otherwise. +

The function returns an integer number in accordance with the + return code convention: positive if any system call has returned an error, negative + (from the LibRaw error list) if there has been an error + situation within LibRaw. +

+ + +

int LibRaw::open_buffer(void *buffer, size_t bufsize)

+

+ Created an LibRaw_buffer_datastream object, calls + open_datastream(). If succeed, sets internal flag which signals + to destroy internal datastream object on recycle(). On failure, + just created file_datastream destroyed immediately. +

+

The function returns an integer number in accordance with the + return code convention: positive if any system call has returned an error, negative + (from the LibRaw error list) if there has been an error + situation within LibRaw. +

+ + +

int LibRaw::unpack(void)

+

+ Unpacks the RAW files of the image, calculates the black level (not for all formats). The results are placed in imgdata.image. +

+

+ Data reading is sometimes (not frequently) affected by settings made in imgdata.params (libraw_output_params_t); see API notes for details. +

+

The function returns an integer number in accordance with the return code +convention: positive if any system call has returned an error, negative (from the + LibRaw error list) if there has been an error +situation within LibRaw. +

+ + +

int LibRaw::unpack_thumb(void)

+

+ Reads (or unpacks) the image preview (thumbnail), placing the result into the imgdata.thumbnail.thumb buffer.
+ JPEG previews are placed into this buffer without any changes (with the header etc.). Other preview +formats are placed into the buffer in the form of the unpacked bitmap image (three components, 8 bits per component).
+ The thumbnail format is written to the imgdata.thumbnail.tformat field; for the possible values, see +description of constants and data structures. + +

+

The function returns an integer number in accordance with the return code +convention: positive if any system call has returned an error, negative (from the +LibRaw error list) if there has been an error situation within +LibRaw. +

+ +

Auxiliary Functions

+

Library version check

+ +

const char* LibRaw::version()

+

+ Returns string representation of LibRaw version in MAJOR.MINOR.PATCH-Status format (i.e. 0.6.0-Alpha2 + or 0.6.1-Release). +

+ +

int LibRaw::versionNumber()

+

+ Returns integer representation of LibRaw version. During LibRaw development, the version number is always + increase . +

+ +

bool LIBRAW_CHECK_VERSION(major,minor,patch)

+

+ Macro for version check in caller applications. Returns 'true' if current library version is greater or equal to + set in macro parameters. This macro executes at runtime (not at compile time) and may be used for checking + version of dynamically loaded LibRaw (from DLL/shared library). +

+

List of supported RAW formats (cameras)

+ +

int LibRaw::cameraCount()

+

+ Returns count of cameras supported. +

+ +

const char** LibRaw::cameraList()

+

+ Returns list of supported cameras. Latest item of list is set to NULL (for easy printing). +

+ +

int LibRaw::set_rawspeed_camerafile(char *path_to_cameras_xml)

+

+ (Only if LibRaw was built with RawSpeed support). +

+ Loads XML file with RawSpeed camera description data (cameras.xml) specified by path_to_cameras_xml. + Returns 0 on success, nonzero on error. + +

int LibRaw::get_decoder_info(libraw_decoder_info_t *)

+

+ The function fills libraw_decoder_info_t + structure by passed pointer with current raw decoder data. +

+

The function returns an integer number in accordance with the return code + convention: positive if any system call has returned an error, negative (from the + LibRaw error list) if there has been an error situation within + LibRaw. +

+ +

const char* LibRaw::unpack_function_name()

+

+ Returns function name of file unpacking function. Intended only for LibRaw test suite designers to use in test + coverage evaluation. +

+ + +

void LibRaw::setCancelFlag()

+

+ This call sets internal fast cancel flags. If set, current Raw decoder will be terminated ASAP. + This call is useful if you need to cancel all LibRaw decoders in multithreaded program (e.g. for + fast program termination or just for cancel current processing). +

+ +

void LibRaw::clearCancelFlag()

+

+ This call clears internal fast cancel flags, so (early) terminated LibRaw decoder may work again. +

+ + +

int LibRaw::COLOR(int row, int col)

+

+ This call returns pixel color (color component number) in bayer patter at row,col. The returned value + is in 0..3 range for 4-component Bayer (RGBG2, CMYG and so on) and in 0..2 range for 3-color data. +

+ +

int LibRaw::camera_color_type()

+

+ This call returns color data type found in opened file: +

    +
  • LIBRAW_CMATRIX_NONE - no colordata embedded in file, built-in color matrix will be used; +
  • LIBRAW_CMATRIX_DNG - DNG color data; +
  • LIBRAW_CMATRIX_DIGBACK - digital back color data (Leaf/PhaseOne) +
  • LIBRAW_CMATRIX_OTHER - other color data (e.g. Olympus or Sony camera) +
+

+ + +

int LibRaw::error_count()

+

+ This call returns count of non-fatal data errors (out of range, etc) occured in unpack() stage. +

+ +

void LibRaw::subtract_black()

+

+ This call will subtract black level values from RAW data (for suitable RAW data). + colordata.data_maximum and + colordata.maximum and black level data (colordata.black and colordata.cblack) will be adjusted + too. +

+

+ This call should be used if you postprocess RAW data by your own code. LibRaw + postprocessing functions will call subtract_black() by oneself. +

+

The function returns an integer number in accordance with the return code + convention: positive if any system call has returned an error, negative (from the + LibRaw error list) if there has been an error situation within + LibRaw. +

+ + +

Support for YCC formats (Canon sRAW/mRAW and Nikon Small NEF)

+
+       int LibRaw::is_sraw();
+       int LibRaw::is_nikon_sraw();
+       int LibRaw::sraw_midpoint()
+    
+
    +
  • is_sraw() call returns nonzero if current image is YCC-based. +
  • is_nikon_sraw() call returns nonzero for Nikon Small NEF files +
  • sraw_midpoint() call returns neutral (gray) point for color channels +
+ +

void LibRaw::recycle_datastream(void)

+

+ This call closes input datastream with associated data buffer and unblocks opened file. + + +

void LibRaw::recycle(void)

+

Frees the allocated data of LibRaw instance, enabling one to process the next file using +the same processor. Repeated calls of recycle() are quite possible and do not conflict with anything. +

+ + +

LibRaw::~LibRaw()

+

Destructor, which consists in calling recycle().

+ + +

const char* LibRaw::strprogress(enum LibRaw_progress code)

+

Converts progress stage code to description string (in English).

+ + +

const char* LibRaw::strerror(int errorcode)

+

Analog of strerror(3) function: outputs the text descriptions of LibRaw error codes (in English).

+ + +

Setting Error Notification Functions

+

+ In process of RAW conversion LibRaw can call user-setted callback. This callback can be used for: +

+
    +
  • Dynamic status update (progress bar and so on).
  • +
  • Cancel of processing (for example, user pressed Cancel button).
  • +
+

Also, work of the library may cause two types of exceptional situations that require notification of the calling application: +

+
    +
  • Memory shortage
  • +
  • Data read error.
  • +
+

+ An application may set its own callbacks that will be called in the cases mentioned above to notify the user (or the calling program). +

+ +

Progress indication/processing termination

+
+        typedef int (*progress_callback)(void *callback_data,enum LibRaw_progress stage, int iteration, int expected);
+        void LibRaw::set_progress_handler(progress_callback func,void *callback_data);
+    
+

+ LibRaw user can set own callback which will be called 10-50 times during RAW postprocessing + by dcraw_process(). +

+

+ This callback may terminate current image processing by returning of non-zero value. In such case all processing + will be cancelled immediately and all resources will be returned to system by recycle() call. + Current call of dcraw_process() will return error code + LIBRAW_CANCELLED_BY_CALLBACK. +

+

+ Callback parameters: +

+
void *callback_data
+
void*-pointer, passed as 2nd argument to set_progress_handler(). This pointer should be used to pass + additional data to callback (i.e. thread local data and so on). +
+
enum LibRaw_progress stage
+
Current processing stage. This number can be converted to string by call to + LibRaw::strprogress. Not all processing stages are covered by callback calls. +
+
int iteration
+
Iteration number within current stage (from 0 to expected-1). +
+
int expected
+
Expected number of iterations on current stage.
+
+ Callback should return value of: 0 for continue processing and non-zero for immediate cancel of processing. +

+

+ If LibRaw compiled with OpenMP support, iteration parameter may not always increase within one stage. Out of + order callback calls are possible. +

+

+ Callback code sample: +

+int my_progress_callback(void *data,enum LibRaw_progress p,int iteration, int expected)
+{
+    char *passed_string = (char *data);
+    printf("Callback: %s  pass %d of %d, data passed: %s\n",libraw_strprogress(p),iteration,expected,passed_string);
+    if(timeout || key_pressed )
+        return 1; // cancel processing immediately
+    else
+        return 0; // can continue
+}
+
+
+ +

User-specified exif tag parser callback

+
+       typedef void (*exif_parser_callback) (void *context, int tag, int type, int len,unsigned int ord, void *ifp);
+       void    LibRaw::set_exifparser_handler( exif_parser_callback cb,void *context);
+    
+

+ Callback to be called on each parsed EXIF/Makernotes tag with parameters: +

    +
  • context - pointer to context passed to set_exifparser_handler(); +
  • tag - EXIF/Makernotes tag value +
  • type - TIFF(EXIF) tag type +
  • len - tag length +
  • ord - byte order (II or MM) +
  • void *ifp - pointer to LibRaw_abstract_datastream, positioned to tag data +
+

+ +

Out-of-Memory Notifier

+
+        typedef void (* memory_callback)(void *callback_data,const char *file, const char *where);
+        void LibRaw::set_memerror_handler(memory_callback func,void *callback_data);
+    
+

The user may set his or her own function called in the case of memory shortage. It is a void function +receiving two string parameters: +

+
    +
  • void *callback_data - void*-pointer, passed as 2nd argument to set_progress_handler(). This pointer + should be used to pass additional data to callback (i.e. thread local data and so on).
  • +
  • file is the name of the RAW file whose processing evoked the out-of-memory error. + This name can be NULL if underlying data input layer does not know the name. So, if calling + application sets own callback, this callback should work with NULL file name. +
  • +
  • where is the name of the function where memory shortage occurred.
  • +
+

The callback function is intended for information purposes: it notifies the user +or the program code that processing is impossible.

+

If the user does not set his or her own handler, the standard one (output of error message in stderr) will be used.

+

One can set the null handler by passing NULL to set_memerror_handler; then no notifier +function will be called. The same effect can be achieved by creating a LibRaw object with the LIBRAW_OPTIONS_NO_MEMERR_CALLBACK +flag in the contructor. +

+

In the case of memory shortage, processing of the current file is terminated and a notifier is called; all +allocated resources are freed, and recycle() is performed. The current call will return +LIBRAW_UNSUFFICIENT_MEMORY. +
+At an attempt to continue data processing, all subsequent calls will return LIBRAW_OUT_OF_ORDER_CALL. +Processing of a new file may be started in the usual way, by calling LibRaw::open_file(). +

+ +

File Read Error Notifier

+
+        typedef void (*data_callback)(void *callback_data,const char *file, const int offset);
+        void LibRaw::set_dataerror_handler(data_callback func, void *callback_data); 
+    
+

+ The user can define his or her own function to be called in the case of error in the input data. It is a void function receiving +two parameters: +

+
    +
  • void *callback_data - void*-pointer, passed as 2nd argument to set_progress_handler(). This pointer + should be used to pass additional data to callback (i.e. thread local data and so on).
  • +
  • file is the name of the RAW file whose processing evoked the file read error. + This name can be NULL if underlying data input layer does not know the name. So, if calling + application sets own callback, this callback should work with NULL file name. +
  • +
  • offset is -1 at end-of-file (if LibRaw expects more data) or a positive number equal to +the file position (bytes from file beginning) where the unpacking error occurred.
  • +
+

The callback function is intended for information purposes: it notifies the user +or the program code that processing is impossible.

+

If the user does not set his or her own handler, the standard one (output of error message in stderr) will be used.

+

One can set the null handler by passing NULL to set_memerror_handler; then no notifier +function will be called. The same effect can be achieved by creating a LibRaw object with the LIBRAW_OPTIONS_NO_DATAERR_CALLBACK +flag in the contructor.

+

In the case of error in the input data, processing of the current file is terminated and a notifier is called; all +allocated resources are freed, and recycle() is performed. The current call will return +LIBRAW_IO_ERROR. +
+At an attempt to continue data processing, all subsequent calls will return LIBRAW_OUT_OF_ORDER_CALL. +Processing of a new file may be started in the usual way, by calling LibRaw::open_file(). +

+ + +

Data Postprocessing: Emulation of dcraw Behavior

+

+ Instead of writing one's own Bayer pattern postprocessing, one can use the dcraw functions, which are called + after the calls of open_file() + unpack() /+ unpack_thumb()/ +

+ +

Parameter Setting

+

+ Virtually all parameters that can be set through the dcraw command line are specified by assigning values to + fields of the LibRaw::imgdata.params structure. The type of this structure is + libraw_output_params_t; all fields are listed and described in sufficient detail in the description of data structures. +

+ +

int LibRaw::raw2image

+

+ This function allocates buffer for postprocessing (imgdata.image) and fills it with data layout compatible + with LibRaw 0.13/0.14 and below. If the buffer is already allocated, it will be free()ed and allocated again. +

+

+ This function should be called only if your code do postprocessing stage. If you use LibRaw's postprocessing + calls (see below) you don't need to call raw2image(). +

+

The function returns an integer number in accordance with the return code + convention: positive if any system call has returned an error, negative (from the + LibRaw error list) if there has been an error situation within + LibRaw. +

+ + +

void LibRaw::free_image

+

+ This function releases the imgdata.image buffer allocated by raw2image(); +

+

+ This method should be called if current postprocessing results are not needed by the program (e.g. already + copied somewhere), but new postprocessing calls (with another settings) are possible, so it is to early + to call recycle(). +

+ + +

int LibRaw::adjust_sizes_info_only(void)

+

+ The function calculates the correct size of the output image (imgdata.sizes.iwidth and imgdata.sizes.iheight) for the + following cases: +

+
    +
  • Files from Fuji cameras (with a 45-degree rotation)
  • +
  • Files from cameras with non-square pixels
  • +
  • Images shot by a rotated camera.
  • +
+

+ In the aforementioned cases, the function changes the fields of the image output size; note that +this change cannot be repeated again. +

+ + +

int LibRaw::dcraw_process(void)

+

+ The function emulates the postprocessing capabilities available in dcraw.
+ Called after calling LibRaw::unpack(); +

+

The entire functionality of dcraw (set via the field values in imgdata.params) is supported, except for +

+
    +
  • Dark frame subtraction
  • +
  • Work with bad pixels.
  • +
+

The function is intended solely for demonstration and testing purposes; it is assumed that its source code +will be used in most real applications as the reference material concerning the order of RAW data processing. +

+

The function returns an integer number in accordance with the error +code convention: positive if any system call has returned an error, negative (from the +LibRaw error list) if there has been an error situation within +LibRaw. +

+ +

Data Output to Files: Emulation of dcraw Behavior

+

In spite of the abundance of libraries for file output in any formats, LibRaw includes calls that emulate +the file output provided by dcraw. This is done primarily for easier verification of library work: the resultant +files must be binary identical. +

+ + +

int LibRaw::dcraw_ppm_tiff_writer(const char *outfile)

+

+ The function outputs the postprocessing results to a file in the PPM/PGM or TIFF format (the format is set via + imgdata.params.output_tiff). The results are binary identical to those provided by dcraw. +

+

The function returns an integer number in accordance with the error +code convention: positive if any system call has returned an error, negative (from the +LibRaw error list) if there has been an error situation within +LibRaw. +

+ +

int LibRaw::dcraw_thumb_writer(const char *thumbfile)

+

Writes the thumbnail to a file in the PPM format for bitmap thumbnails and in the JPEG format for JPEG thumbnails, i.e., +in the format completely identical to the results provided by dcraw. +

+

The function returns an integer number in accordance with the error +code convention: positive if any system call has returned an error, negative (from the +LibRaw error list) if there has been an error situation within +LibRaw. +

+ +

Copying unpacked data into memory buffer

+

+ There is several function calls for store unpacked data into memory buffer (after using dcraw_process() and so on): +

    +
  • get_mem_image_format - get resulting bitmap size and bit depth.
  • +
  • copy_mem_image - copy postprocessed data into some memory buffer with different color order and + line stride. +
  • +
  • dcraw_make_mem_image - store processed image data into allocated buffer; +
  • +
  • dcraw_make_mem_thumb - store extracted thumbnail into buffer as JPEG-file image (for most cameras) + or as RGB-bitmap. +
  • +
+ For usage primer see samples/mem_image.c sample. +

+ +

void get_mem_image_format(int *widthp, int *heightp, int *colorsp, int *bpp) const - return processing bitmap + size

+

This function returns size of postprocessed image: +

+
    +
  • Image width is returned in *widthp;
  • +
  • Bitmap height is returned in *heightp;
  • +
  • Image color count is returned in *colorsp;
  • +
  • Bits per pixel (8 or 16) is returned in *bpp;
  • +
+ +

int LibRaw::copy_mem_image(void* scan0, int stride, int bgr) - copies postprocessed bitmap data into + buffer

+

+ Function parameters: +

+
    +
  • void *scan0 - pointer to buffer to copy data to. The buffer should be at least stride*image_height + bytes;
  • +
  • int stride - stride of each other image line (row) in bytes. Usually + image_width*(bit_per_pixel/8)*image_colors, but may be more if you wish to align image rows to, for example, 8 + or 16 or 32 bytes to make CPU more happy.
  • +
  • int bgr - pixel copy order. RGB if bgr==0 and BGR overwise.
  • +
+

The function returns an integer number in accordance with the error +code convention: positive if any system call has returned an error, negative (from the +LibRaw error list) if there has been an error situation within +LibRaw. +

+ +

libraw_processed_image_t *dcraw_make_mem_image(int *errorcode=NULL) - store unpacked and processed image into + memory buffer as RGB-bitmap

+

+ This function allocates memory buffer and stores unpacked-preprocessed image into this buffer. Function returns + allocated structure libraw_processed_image_t with + filled fields. Always returns data as RGB bitmap (i.e. type field is equal to LIBRAW_IMAGE_BITMAP). +

+

+ + dcraw_process() should be called before dcraw_make_mem_image(); +

+

+ Returns NULL in case of an error. If caller has passed not-NULL value as errorcode parameter, than *errorcode + will be set to error code according to error code convention. +

+

NOTE! Memory, allocated for return value will not be fried at destructor or LibRaw::recycle + calls. Caller of dcraw_make_mem_image should free this memory by call to LibRaw::dcraw_clear_mem(). +

+ + +

libraw_processed_image_t *dcraw_make_mem_thumb(int *errorcode=NULL) - store unpacked thumbnail into memory buffer

+

+ This function allocates memory buffer and stores thumbnail data in it. Function returns allocated + structure libraw_processed_image_t with + filled fields. For most RAW images allocated structure will contains JPEG image (i.e. type + field is equal to LIBRAW_IMAGE_JPEG). For some cameras with RGB-bitmap thumbnail (Kodak SLRs) + returned structure contains RGB bitmap (type field is equal to LIBRAW_IMAGE_JPEG, see structure + description for details). +

+

+ unpack_thumb() should be called before dcraw_make_mem_thumb(); +

+

+ Returns NULL in case of an error. If caller has passed not-NULL value as errorcode parameter, than *errorcode + will be set to error code according to error code convention. +

+

NOTE! Memory, allocated for return value will not be fried at destructor or LibRaw::recycle + calls. Caller of dcraw_make_mem_image should free this memory by call to LibRaw::dcraw_clear_mem(). +

+ +

void LibRaw::dcraw_clear_mem(libraw_processed_image_t *)

+

+ This function will free the memory allocated by dcraw_make_mem_image or dcraw_make_mem_thumb. +

+

+ This is static class member, so call syntax should be LibRaw::dcraw_clear_mem(...). +

+

+ This call translates directly to free() system function, but it is better to use dcraw_clear_mem because + LibRaw (DLL) may be compiled with memory manager other than in calling application. +

+ + +

Input layer abstraction

+ +

class LibRaw_abstract_datastream - abstract RAW read interface

+

+ LibRaw reads RAW-data by calling (virtual) methods of C++ object derived from + LibRaw_abstract_datastream. This C++ class does not implement any read, but defines interface to be + called. Call to base class methods always results in error. +

+ +

LibRaw_abstract_datastream class methods

+ +
Object verification
+
+
virtual int valid()
+
Checks input datastream validity. Returns 1 on valid stream and 0 if datastream was created on non-valid + input parameters (wrong filename for file stream and so on). +
+ +
Stream read and positioning
+

This group of methods implements file object (FILE*) semantics.

+
+
virtual int read(void * ptr,size_t size, size_t nmemb)
+
+ Similar to fread(ptr,size,nmemb,file). +
+
virtual int seek(off_t o, int whence)
+
+ Similar to fseek(file,o,whence). +
+
virtual int tell(
+
+ Similar to ftell(file). +
+
virtual int get_char()
+
+ Similar to getc(file)/fgetc(file). +
+
virtual char* gets(char *s, int n)
+
+ Similar to fgets(s,n,file). +
+
virtual int eof()
+
+ Similar to feof(file). +
+
virtual int scanf_one(const char *fmt, void *val)
+
+ Simplified variant of fscanf(file,fmt,val): format string is always contains one argument to read. So, + variable args call is not needed and only one pointer to data passed. +
+
virtual int jpeg_src(void * p);
+
+ Initializes read structures in j_decompress_ptr object passed as *p. + This object is used by libjpeg for JPEG data reading from datastream. +

+ Retuens -1 on error and 0 on success. +

+
virtual void * make_jas_stream();
+
+ Creates LibJasper input stream (for JPEG2000 decoding). +

+ returns NULL on error or data pointer on success. +

+
+ +
Other methods
+

This group of methods includes several supplementary calls. These calls are used to temporary switch to another + data stream (file and/or memory buffer). +

+
+
virtual const char* fname()
+
+ Returns name of opened file if datastream object knows it (for example, + LibRaw_file_datastream used). Filename used in: +
    +
  • error notification callbacks;
  • +
  • generation of filename of JPEG-file with metadata when needed (i.e. cameras with 'Diag RAW hack'). +
+
+
virtual int subfile_open(const char *fn)
+
+ This call temporary switches input to file fn. Returns 0 on success and error code on error.
+ The function used to read metadata from external JPEG file (on cameras with "Diag RAW hack"). +
+ This call is not implemented for LibRaw_buffer_datastream, so + external JPEG processing is not possible when buffer datastream used. +
+ This functon should be implemented in real input class, base class call always return error. +
+ Working implementation sample can be found in + LibRaw_file_datastream implementation in libraw/libraw_datastream.h file. +
+
virtual void subfile_close()
+
+ This call switches input stream from temporary open file back to main data stream. +
+
virtual int tempbuffer_open(void *buf, size_t size)
+
+ This call temporary switches input to LibRaw_buffer_datastream object, + created from buf.
+ This method is needed for Sony encrypted metadata parser. +

+ This call implemented in base class (LibRaw_abstract_datastream), there is no need to + reimplement in in derived classes.
+ Possible activity of temporary datastream requires very accurate programming when implementing + datastreams derived from base LibRaw_abstract_datastream. See below + for more details. +

+
virtual void tempbuffer_close()
+
+ This call switch input back from temporary datastream to main stream. This call implemented + in base LibRaw_abstract_datastream class. +
+
+ + +

Derived input classes included in LibRaw

+

+ There is three "standard" input classes in LibRaw distribution: +

+ +

+ LibRaw C++ interface users can implement their own input classes and use them via + LibRaw::open_datastream call. Requirements and implementation specifics are + described below. +

+ +

class LibRaw_file_datastream - file input interface

+

+ This class implements input from file. +

+

Class methods:

+
+
LibRaw_file_datastream(const char *fname)
+
+ This constructor creates LibRaw_file_datastream object from file fname.
+ Unfortunately, C++ constructor cannot return an error. So if bad filename passed (e.g. nonexistent file) + object is created as non-valid (valid() call returns zero). +
+
+

+ All other class methods are described above.
+ This class implements all possble methods, including fname() and subfile_open(). +

+ +

class LibRaw_bigfile_datastream - file input interface

+

+ This class implements input from file. +

+

Class methods:

+
+
LibRaw_bigfile_datastream(const char *fname)
+
+ This constructor creates LibRaw_bigfile_datastream object from file fname.
+ Unfortunately, C++ constructor cannot return an error. So if bad filename passed (e.g. nonexistent file) + object is created as non-valid (valid() call returns zero). +
+
+

The difference between file and bigfile datastreams are obvious from class name: bigfile one + supports large files (more than 2Gb) on all supported systems. File one uses streambuf interface which is + limited to 2Gb on many systems. +

+ All other class methods are described above.
+ This class implements all possble methods, including fname() and subfile_open(). +

+ +

class LibRaw_buffer_datastream - memory buffer input interface

+

+ This class implements input from memory buffer. +

+

Class methods:

+
+
LibRaw_buffer_datastream(void *buffer, size_t bsize)
+
+ This constructor creates datastream object from buffer with size bsize.
+ It is not possibly to verify the pointer passed, so buffer address is checked against 0 and -1 only. +
+
+

+ All other class methods are described above.
+ This class does not implement fname() and subfile_open() calls, so external JPEG metadata parsing + is not possible. +

+ +

Own datastream derived classes

+

+ To create own read interface LibRaw user should implement C++ class derived from + LibRaw_abstract_datastream with all read methods.
+ LibRaw standard implementations may be used as reference. See libraw/libraw_datastream.h file for details + (all standard LibRaw input classes are implemented using inline functions only). +

+ +

substream field: secondary input stream

+

+ substream field, defined in base LibRaw_abstract_datastream class requires some additional notes. + This field is used when input switched to temporary buffer (used for Sony metadata processing). Unfortunately, + there is now ideal C++ way to hide this functionality into base class internals. So, any read call in + derived class should include 1-line statement like this:
+ int method(...args...){ if(substream) return substream->method(...args...). For example: +

+    virtual int eof() 
+    { 
+        if(substream) return substream->eof();
+....
+    virtual int scanf_one(const char *fmt, void* val) 
+    { 
+        if(substream) return substream->scanf_one(fmt,val);
+
+ + + + [back to Index] + + diff -Nru libraw-0.16.2/doc/API-CXX-rus.html libraw-0.17.0/doc/API-CXX-rus.html --- libraw-0.16.2/doc/API-CXX-rus.html 2015-05-16 12:32:15.000000000 +0000 +++ libraw-0.17.0/doc/API-CXX-rus.html 1970-01-01 00:00:00.000000000 +0000 @@ -1,935 +0,0 @@ - - - - LibRaw C++ API - - - - - [вернуться к оглавлению] -

LibRaw C++ API

-

Содержание

-
    -
  1. Объект LibRaw
  2. -
  3. Возвращаемые значения
  4. -
  5. Методы, загружающие данные из файла - -
  6. -
  7. Вспомогательные функции - -
  8. -
  9. Постобработка данных, эмуляция поведения dcraw - -
  10. -
  11. Запись данных в файлы, эмуляция поведения dcraw - -
  12. -
  13. Запись распакованых данных в буфер в памяти - -
  14. -
  15. Абстракция ввода -
- - -

Объект LibRaw

-

- Основной объект (класс) LibRaw, создается либо без параметров, либо передаются флаги, определяющие поведение - объекта. -

-
-#include "libraw/libraw.h"
-...
-
-   LibRaw ImageProcessor(unsigned int flags=0);
-...
-    
-

Флаги (несколько флагов задаются через | - оператор bitwise-OR):

- -

- Для обработки изображения используются три группы методов -

- -

- Результаты обработки размещаются в поле imgdata, которое имеет тип libraw_data_t, в этом же наборе данных содержатся поля, управляющие - постобработкой и выводом. -

- -

Возвращаемые значения

-

- Все функции LibRaw API возвращают целое число в соответствии с соглашением о - кодах возврата. Пожалуйста, прочитайте описание этого соглашения и - описание поведения LibRaw при фатальных ошибках. -

- - -

Методы, загружающие данные из файла

- -

int LibRaw::open_datastream(LibRaw_abstract_datastream *stream)

-

Открывает поток с RAW-данными, считывает оттуда метаданные (EXIF), заполняет - структуры: -

- -

Функция возвращает целое число в соответствии с соглашением о кодах - возврата: положительное число, если какой-то из системных вызовов вернул ошибку, отрицательное число (из - списка ошибок LibRaw) при ошибочной ситуации - внутри LibRaw. -

-

Перед началом обработки вызывается recycle(), следовательно при обработке нескольких - изображений в batch-режиме необязательно вызываеть recycle() в конце цикла обработки. -

-

Входной параметр: Объект класса, производного от LibRaw_abstract_datastream. - Объект должен быть проиницализирован и готов к чтению. Деинициализация объекта производится в вызвавшем - приложении. -

- -

int LibRaw::open_file(const char *filename[,INT64 bigfile_size])

-

Win32 only: int LibRaw::open_file(const wchar_t *filename[,INT64 bigfile_size])

-

- Создает объект LibRaw_file_datastream или LibRaw_bigfile_datastream, вызывает open_datastream(), при успехе выставляет внутренний флаг, сигнализирующий о том, - что созданный объект должен быть уничтожен при recycle(), при неуспехе открытия - - уничтожает только что созданный объект. -

-

Необязательный Параметр bigfle_size задает размер входного файла, начиная с которого происходит - использование LibRaw_bigfile_datastream. По-умолчанию, этот размер равен 250 - Мб. -

Функция возвращает целое число в соответствии с соглашением о кодах - возврата: положительное число, если какой-то из системных вызовов вернул ошибку, отрицательное число (из - списка ошибок LibRaw) при ошибочной ситуации - внутри LibRaw. -

- - -

int LibRaw::open_buffer(void *buffer, size_t bufsize)

-

- Создает объект LibRaw_buffer_datastream, вызывает open_datastream(), при успехе выставляет внутренний флаг, сигнализирующий о том, - что созданный объект должен быть уничтожен при recycle(), при неуспехе открытия - - уничтожает только что созданный объект. -

-

Функция возвращает целое число в соответствии с соглашением о кодах - возврата: положительное число, если какой-то из системных вызовов вернул ошибку, отрицательное число (из - списка ошибок LibRaw) при ошибочной ситуации - внутри LibRaw. -

- -

int LibRaw::unpack(void)

-

- Производит распаковку RAW-данных изображения и вычисление уровня черного (не для всех форматов). Результаты - работы помещаются в imgdata.image. -

-

- На чтение данных в ряде (редких) случаев влияют настройки, сделанные в imgdata.params (libraw_output_params_t), подробнее см. в API notes. -

-

Функция возвращает целое число в соответствии с соглашением о кодах - возврата: положительное число, если какой-то из системных вызовов вернул ошибку, отрицательное число (из - списка ошибок LibRaw) при ошибочной ситуации - внутри LibRaw. -

- - -

int LibRaw::unpack_thumb(void)

-

- Производит чтение (либо распаковку) preview (thumbnail) изображения, - помещая результат в буфер imgdata.thumbnail.thumb.
- JPEG-preview помещаются в данный буфер без каких-либо изменений (с - заголовком и т.п.), Другие форматы preview помещаются в буфер в виде распакованого - image bitmap (3 компонента, 8 бит на компонент).
- Формат thumbnail записывается в поле imgdata.thumbnail.tformat, - возможные значения описаны в описании констант и структур данных. - -

-

Функция возвращает целое число в соответствии с соглашением о кодах - возврата: положительное число, если какой-то из системных вызовов вернул ошибку, отрицательное число (из - списка ошибок LibRaw) при ошибочной ситуации - внутри LibRaw. -

- -

Вспомогательные функции

-

Информация о версии библиотеки

- -

const char* LibRaw::version()

-

- Возвращает строковое представление версии библиотеки в формате MAJOR.MINOR.PATCH-Status (например, 0.6.0-Alpha2 - или 0.6.1-Release). -

- -

int LibRaw::versionNumber()

-

- Возвращает целочисленное представление версии библиотеки. При выходе новых версий библиотеки версия всегда не убывает. -

- -

bool LIBRAW_CHECK_VERSION(major,minor,patch)

-

- Макрос для проверки версии в прикладных программах. Возвращает true если текущая версия библиотеки больше или - равна переданной в параметрах. Макрос выполняется динамически и может использоваться для проверки версии - библиотеки, загружаемой из shared library/DLL. -

-

Список поддерживаемых форматов (камер)

- -

int LibRaw::cameraCount()

-

- Возвращает количество камер, поддерживаемых текущей версией библиотеки. -

- -

const char** LibRaw::cameraList()

-

- Возвращает cписок камер, поддерживаемых библиотекой. Список на 1 элемент длиннее, чем количество камер, в - последнем элементе списка содержится NULL. -

-

Прочие вспомогательные функции

- -

int LibRaw::set_rawspeed_camerafile(char *path_to_cameras_xml)

-

- (Только для LibRaw, скомпилированной с поддержкой библиотеки RawSpeed) -

- Получает имя файла, содержащего Читает XML-описание камер (cameras.xml) - -

int LibRaw::get_decoder_info(libraw_decoder_info_t *)

-

- Функция заполняет структуру libraw_decoder_info_t по переданному указателю данными о текущем декодере. -

-

Функция возвращает целое число в соответствии с соглашением о кодах - возврата: положительное число, если какой-то из системных вызовов вернул ошибку, отрицательное число (из - списка ошибок LibRaw) при ошибочной ситуации - внутри LibRaw. -

- -

const char* LibRaw::unpack_function_name()

-

- Возвращает имя функции-распаковщика файла. Интересна только разработчикам тестов для LibRaw, чтобы проверить - test coverage. -

- -

void LibRaw::setCancelFlag()

-

- Этот вызов устанавливает внутренний флаг быстрого завершения декодера. - Если флаг установлен, то декодер будет завершен так быстро, насколько - это возможно. - Данный флаг предназначен для ситуации, когда вам нужно быстро завершить - все декодеры LibRaw, например для быстрого завершения программы. -

- - -

int LibRaw::COLOR(int row, int col)

-

- Этот вызов возвращает цвет (номер цветового компонента) пиксела с - координатами row,col. Для 4-цветных файлов (CMYG, RGBG2) возвращается - число в диапазоне 0..3, для 3-цветных файлов - в диапазоне 0..2. -

- -

void LibRaw::subtract_black()

-

- Вызов производит вычитание уровня черного из RAW-данных, если вычитание не произведено самой камерой. - При этом соответствующим образом исправляются поля colordata.data_maximum, - colordata.data_maximum и даные об уровне черного (colordata.black и colordata.cblack). -

-

- Данный вызов надлежит использовать в случае, когда вы хотите делать постпроцессинг RAW-данных - самостоятельно. Встроенные в LibRaw функции постпроцессинга вызовут - subtract_black() самостоятельно. -

-

Функция возвращает целое число в соответствии с соглашением о кодах - возврата: положительное число, если какой-то из системных вызовов вернул ошибку, отрицательное число (из - списка ошибок LibRaw) при ошибочной ситуации - внутри LibRaw. -

- - -

void LibRaw::recycle_datastream(void)

-

- Этот вызов позволяет освободить file handle (и ассоциированные - буферы), если ваше приложение больше не собирается вызывать unpack() - или unpack_thumb() и, следовательно, может разблокировать файл и - освободить память, которая использовалась для чтения RAW-файла. - - -

void LibRaw::recycle(void)

-

- Освобождает аллоцированные данные экземпляра LibRaw, делая возможным обработку следующего файла тем же - процессором. Повторные вызовы recycle() вполне возможны и ничему не противоречат. -

- - -

LibRaw::~LibRaw()

-

Деструктор, сводится к вызову recycle()

- - -

const char* LibRaw::strprogress(enum LibRaw_progress code)

-

Выдает текстовую расшифровку (на английском языке) для кодов текущей стадии обработки LibRaw

- -

const char* LibRaw::strerror(int errorcode)

-

Аналог функции strerror(3) - выдает текстовую расшифровку (на английском языке) для кодов ошибок LibRaw

- - -

Установка функций нотификации

-

- При работе библиотеки можно вызывать пользовательский callback, который может быть использован для - двух целей: -

-
    -
  • Динамическая отрисовка статуса обработки изображения.
  • -
  • Досрочное прекращение процесса обработки (например, по запросу пользователя)
  • -
-

Кроме того, при работе библиотеки возможны два типа исключительных ситуаций, которые могут требовать - уведомления вызывающего приложения: -

-
    -
  • нехватка памяти
  • -
  • ошибка чтения данных
  • -
-

- Приложение может установить свои callbacks, которые будут вызваны в вышеперечисленных случаях, с целью - уведомления пользователя (или вызывающей программы). -

- -

Индикация стадий обработки/досрочное ее прекращение

-
-        typedef int (*progress_callback)(void *callback_data,enum LibRaw_progress stage, int iteration, int expected);
-        void LibRaw::set_progress_handler(progress_callback func,void *callback_data);
-    
-

- Пользователь может определить свою функцию, которая будет многократно (10-50 раз) вызываться в процессе - обработки данных RAW-файла вызовами dcraw_process(). -

-

- Этот callback может сигнализировать о необходимости прекратить обработку путем возврата ненулевого значения. В - этом случае обработка будет завершена, память освобождена вызовом recycle() и объект LibRaw будет готов к - обработке следующего файла. Текущий вызов dcraw_process() вернет код ошибки - LIBRAW_CANCELLED_BY_CALLBACK. -

-

- Параметры вызова: -

-
void *callback_data
-
void*-указатель, переданный при установке callback через - set_memerror_handler. Используется для передачи в callback дополнительных данных
-
enum LibRaw_progress stage
-
Текущая стадия обработки. Код может быть превращен в строку путем вызова функции - LibRaw::strprogress. Callback вызывается не на всех стадиях обработки, а только на - тех, которые могут занять большое время. -
-
int iteration
-
Номер итерации обработки (от 0 до expected-1). Внутри стадии обработки callback вызывается более одного - раза, номер итерации внутри одной стадии всегда возрастает. -
-
int expected
-
Ожидаемое количество итераций на этой стадии обработки
-
- Возвращаемые значения: 0 если обработку можно продолжить, ненулевое число - если обработку следует - немедленно прекратить. -

-

- При использовании OpenMP порядок следования iteration неопределен, они не обязаны строго возрастать. -

-

- Пример кода callback: -

-int my_progress_callback(void *data,enum LibRaw_progress p,int iteration, int expected)
-{
-    char *passed_string = (char *data);
-    printf("Callback: %s  pass %d of %d, data passed: %s\n",libraw_strprogress(p),iteration,expected,passed_string);
-    if(timeout || key_pressed )
-        return 1; // cancel processing immediately
-    else
-        return 0; // can continue
-}
-
-
- -

Уведомитель о нехватке памяти

-
-        typedef void (* memory_callback)(void *callback_data,const char *file, const char *where);
-        void LibRaw::set_memerror_handler(memory_callback func,void *callback_data);
-    
-

- Пользователь может определить свою функцию, вызываемую по - нехватке памяти. Это void-функция, получающая три параметра: -

-
    -
  • callback_data - void*-указатель, переданный при установке callback через - set_memerror_handler. Используется для передачи в callback дополнительных данных
  • -
  • file - имя RAW-файла при обработке которого произошла ошибка нехватки памяти. Это имя файла может - быть нулевым - в случае, когда оно неизвестно модулю получения данных. Callback должен правильно - обрабатывать случай нулевого имени.
  • -
  • where - имя функции в которой не хватило памяти;
  • -
-

Задача callback - информационная (уведомление пользователя или кода программы о невозможности выполнить - обработку).

-

Если не установить свой обработчик, то будет использован стандартный (печать сообщения об ошибке в stderr).

-

Можно установить нулевой обработчик, передав NULL в set_memerror_handler, тогда функция уведомления вызываться - не будет. Того же эффекта можно добиться, если создать объект LibRaw с флагом конструктора - LIBRAW_OPTIONS_NO_MEMERR_CALLBACK. -

-

В случае нехватки памяти, обработка текущего файла прекращается, вызывается уведомитель, все аллоцированные - ресурсы освобождаются, делается recycle(). Текущий вызов вернет ошибку - LIBRAW_UNSUFFICIENT_MEMORY. -
- При попытке продолжить обработку данных, все вызовы последущие будут возвращать - LIBRAW_OUT_OF_ORDER_CALL. Обработку нового файла можно начать обычным образом: вызвав LibRaw::open_file(). -

- -

Уведомитель об ошибке чтения файла

-
-        typedef void (*data_callback)(void *callback_data,const char *file, const int offset);
-        void LibRaw::set_dataerror_handler(data_callback func,void *callback_data); 
-    
-

- Пользователь может определить свою функцию, вызываемую по ошибке входных данных. Это void-функция, получающая - три параметра: -

-
    -
  • callback_data - void*-указатель, переданный при установке callback через - set_memerror_handler. Используется для передачи в callback дополнительных данных
  • -
  • file: имя RAW-файла при обработке которого произошла ошибка нехватки памяти, этот параметр может - быть нулевым (NULL), вызываемый callback должен корректно обрабатывать этот случай.
  • -
  • offset: -1 если файл закончился (тогда как LibRaw ожидает там еще данные), положительное число - - позиция в файле (в байтах от начала), где возникла ошибка распаковки.
  • -
-

Задача callback - информационная (уведомление пользователя или кода программы о невозможности выполнить - обработку).

-

Если не установить свой обработчик, то будет использован стандартный (печать сообщения об ошибке в stderr).

-

Можно установить нулевой обработчик, передав NULL в set_dataerror_handler, тогда функция уведомления вызываться - не будет. Того же эффекта можно добиться, если создать объект LibRaw с флагом конструктора - LIBRAW_OPTIONS_NO_DATAERR_CALLBACK. -

-

В случае ошибки во входных данных, обработка текущего файла прекращается, вызывается уведомитель, все - аллоцированные ресурсы освобождаются, делается recycle(). Текущий вызов вернет ошибку - LIBRAW_IO_ERROR. -
- При попытке продолжить обработку данных, все вызовы последущие будут возвращать - LIBRAW_OUT_OF_ORDER_CALL. Обработку нового файла можно начать обычным образом: вызвав LibRaw::open_file(). -

- - -

Постобработка данных, эмуляция поведения dcraw

-

- Вместо написания своей пост-обработки Bayer Pattern, можно - воспользоваться вызовами dcraw (которые вызываются после вызова - open_file() + unpack() /+ unpack_thumb()/). -

- -

Задание параметров

-

- Практически все параметры, которые можно задать через командную строку dcraw, задаются путем присваивания - значений полям структуры LibRaw::imgdata.params, структура имеет тип libraw_output_params_t, все - поля перечислены и достаточно подробно описаны в - описании структур данных. -

- - -

int LibRaw::raw2image

-

- Функция аллоцирует буфер для постобработки imgdata.image, предварительно освобождая его, если он уже - был аллоцирован, и заполняет его данными в формате, - совместимыми с версиями LibRaw 0.13 и старше. -

-

- Эту функцию следует вызывать самостоятельно только если вы собираетесь самостоятельно обрабатывать - RAW-данные и ваш код рассчитан на LibRaw 0.13 и более старые версии. Функции постпроцессинга (см. - ниже) вызывают raw2image() самостоятельно. -

-

Функция возвращает целое число в соответствии с соглашением о кодах - возврата: положительное число, если какой-то из системных вызовов вернул ошибку, отрицательное число (из - списка ошибок LibRaw) при ошибочной ситуации - внутри LibRaw. -

- -

void LibRaw::free_image

-

- Этот вызов освобождает буфер imgdata.image, аллоцированный вызовом raw2image(); -

-

- Эту функцию следует вызывать, если текущий результат постпроцессинга уже не нужен (например, скопирован - куда-то), но возможны повторные вызовы постпроцессинга тех же данных (например, с другими параметрами), - поэтому вызывать recycle() еще рано. -

- - -

int LibRaw::adjust_sizes_info_only(void)

-

- Функция рассчитывает правильные размеры выходного изображения (imgdata.sizes.iwidth и imgdata.sizes.iheight) для - следующих случаев: -

-
    -
  • файлы от камер Fuji (повернутые на 45 градусов);
  • -
  • файлы от камер с неквадратными пикселами;
  • -
  • изображения, снятые повернутой камерой.
  • -
-

- В перечисленных выше случаях, функция меняет значения полей выходного размера изображения, причем это изменение - не может быть выполнено повторно. -

- - -

int LibRaw::dcraw_process(void)

-

- Функция эмулирует возможности постобработки, имеющиеся в dcraw
- Вызывается после вызова LibRaw::unpack(); -

-

Поддерживается вся функциональность dcraw (задаваемая через значение полей в imgdata.params) за исключением: -

-
    -
  • вычитания dark frame
  • -
  • работы с bad pixels
  • -
-

Функция предназначена исключительно для демонстрационных и тестовых целей, предполагается что в большинстве - реальных приложений ее исходный текст будет использован как справочник по порядку обработки RAW-данных. -

-

Функция возвращает целое число в соответствии с соглашением о кодах - возврата: положительное число, если какой-то из системных вызовов вернул ошибку, отрицательное число (из - списка ошибок LibRaw) при ошибочной ситуации - внутри LibRaw. -

- -

Запись данных в файлы, эмуляция поведения dcraw

-

Несмотря на обилие библиотек, предназначенных для записи файлов любых форматов, в LibRaw включены вызовы, - эмулирующие запись в файлы, производимую dcraw. В первую очередь это сделано для облегчения верификации работы - библиотеки - производимые ей файлы должны бинарно совпадать. -

- - -

int LibRaw::dcraw_ppm_tiff_writer(const char *outfile)

-

- Записывает результаты постобработки в файл в формате PPM/PGM или TIFF (формат задается через - imgdata.params.output_tiff). Производит результаты, бинарно идентичные с dcraw. -

-

Функция возвращает целое число в соответствии с соглашением о кодах - возврата: положительное число, если какой-то из системных вызовов вернул ошибку, отрицательное число (из - списка ошибок LibRaw) при ошибочной ситуации - внутри LibRaw. -

- -

int LibRaw::dcraw_thumb_writer(const char *thumbfile)

-

Записывает thumbnail в файл в формате PPM для bitmap-thumbnails и JPEG для JPEG-thumbnails, в формате - полностью идентичном результатам работы dcraw. -

-

Функция возвращает целое число в соответствии с соглашением о кодах - возврата: положительное число, если какой-то из системных вызовов вернул ошибку, отрицательное число (из - списка ошибок LibRaw) при ошибочной ситуации - внутри LibRaw. -

- - -

Запись распакованых данных в буфер в памяти

-

- Помимо записи в файл, библиотека предоставляет возможности записи извлеченных и обработанных функциями - dcraw_* данных в буфер в памяти. Для этого имеются такие вызовы: -

    -
  • get_mem_image_format - возвращает размер битмепа и его битность
  • -
  • copy_mem_image - копирует постпроцессированное изображение в произвольный буфер с заданным шагом - (stride) строк и с заданным порядком данных в пикселе (RGB/BGR) -
  • -
  • dcraw_make_mem_image - преобразование извлеченных данных в RGB-битмэп нужного размера. -
  • -
  • dcraw_make_mem_thumb - извлечение thumbnail в виде образа JPEG-файла в памяти, либо (для тех камер, - где preview - не JPEG) в виде RGB-bitmap. -
  • -
- Пример использования этих функций - mem_image (см. каталог samples/ дистрибутива). -

- -

void get_mem_image_format(int *widthp, int *heightp, int *colorsp, int *bpp) const - возвращает размеры - обработанного изображения

-

Значения (размеры изображения) возвращаются в переменных, заданных указателями: -

-
    -
  • Ширина изображения в пикселах - в *widthp;
  • -
  • Высота - в *heightp;
  • -
  • Количество цветов изображения - в *colorsp;
  • -
  • Битность изображения (8 или 16) в *bpp;
  • -
- -

int LibRaw::copy_mem_image(void* scan0, int stride, int bgr) - копирует постпроцессированное изображение - в виде битмепа в произвольный буфер

-

- Параметры функции: -

-
    -
  • void *scan0 - указатель на буфер. Буфер аллоцируется вызывающим приложением и должен быть не меньше чем - stride*image_height
  • -
  • int stride - шаг (stride) строки изображения в байтах. Обычно должен быть равен - image_width*(bits_per_pixel/8*image_colors, но может быть больше, если, например, строки изображения хочется - выровнять на 8 (16, 32) байта. -
  • int bgr - порядок следования цветов пиксела. RGB для bgr==0 и BGR в остальных случаях.
  • -
-

The function returns an integer number in accordance with the error -code convention: positive if any system call has returned an error, negative (from the -LibRaw error list) if there has been an error situation within -LibRaw. -

- - - -

libraw_processed_image_t *dcraw_make_mem_image(int *errorcode=NULL) - запись распакованного изображения в буфер в памяти

-

- Аллоцирует буфер необходимого размера и записывает в него распакованное и обработанное изображение. Возвращает - аллоцированную структуру libraw_processed_image_t - с заполненными полями. Всегда возвращает распакованый bitmap (т.е. поле type возвращаемой структуры равно - LIBRAW_IMAGE_BITMAP). -

-

- Перед вызовом этой функции должна быть вызвана dcraw_process(). -

-

- В случае ошибки возвращается NULL. Если в качестве аргумента errorcode передан ненулевой указатель, то по адресу - указателя записывается код - ошибки в соответствии с соглашением о кодах - возврата. -

-

Внимание! Память, аллоцированная функцией, не освобождается при вызове деструктора или - LibRaw::recycle и должна быть освобождена вызвавшим приложением путем вызова LibRaw::dcraw_clear_mem(). -

- - -

libraw_processed_image_t *dcraw_make_mem_thumb(int *errorcode=NULL) - запись распакованного thumbnail в буфер в памяти

-

- Аллоцирует буфер необходимого размера и записывает в него thumbnail. Возвращает - аллоцированную структуру libraw_processed_image_t - с заполненными полями. Для большинства типов RAW-файлов в структуре будет содержаться JPEG, - (т.е. поле type возвращаемой структуры равно LIBRAW_IMAGE_JPEG), для некоторых типов камер - RGB-bitmap. -

-

- Перед вызовом этой функции должна быть вызвана unpack_thumb(); -

-

- В случае ошибки возвращается NULL. Если в качестве аргумента errorcode передан ненулевой указатель, то по адресу - указателя записывается код - ошибки в соответствии с соглашением о кодах - возврата. -

-

Внимание! Память, аллоцированная функцией, не освобождается при вызове деструктора или - LibRaw::recycle и должна быть освобождена вызвавшим приложением путем вызова LibRaw::dcraw_clear_mem(). -

- -

void LibRaw::dcraw_clear_mem(libraw_processed_image_t *)

-

- Освобождает память, аллоцированную dcraw_make_mem_image и dcraw_make_mem_thumb. -

-

- Это статический член класса, вызывать его нужно как LibRaw::dcraw_clear_mem(...). -

-

- Данный вызов эквивалентен вызову системной функции free(), но рекомендуется использовать именно его, так как не - исключено, что LibRaw и вызывающее приложение используют разные и несовместимые системы управления памятью. -

- - -

Абстракция ввода

- -

class LibRaw_abstract_datastream - абстрактный интерфейс чтения RAW-файлов

-

- Чтение RAW-данных в LibRaw производится при помощи объекта класса, производного от - LibRaw_abstract_datastream. Сам этот класс не реализует никакого чтения, но задает список виртуальных - методов, используемых в LibRaw. Реализации методов в базовом классе возвращают ошибку. -

- -

Методы класса LibRaw_abstract_datastream

- -
Верификация объекта
-
-
virtual int valid()
-
Проверка валидности потока. Метод возвращает 1 если поток сконструирован правильно и 0 если из данного - потока нельзя читать (передали несуществующее имя файла для файлового потока и т.п.). -
- -
Чтение данных и позиционирование
-

Данная группа методов воспроизводит семантику объекта файл (FILE*) с произвольным позиционированием.

-
-
virtual int read(void * ptr,size_t size, size_t nmemb)
-
- Аналог вызова fread(ptr,size,nmemb,file). -
-
virtual int seek(off_t o, int whence)
-
- Аналог fseek(file,o,whence). -
-
virtual int tell(
-
- Аналог ftell(file). -
-
virtual int get_char()
-
- Аналог getc(file)/fgetc(file). -
-
virtual char* gets(char *s, int n)
-
- Аналог fgets(s,n,file). -
-
virtual int eof()
-
- Аналог feof(file). -
-
virtual int scanf_one(const char *fmt, void *val)
-
- Упрощенный аналог fscanf(file,fmt,val): формат всегда описывает один аргумент, в результате функция с - переменным числом параметров не нужна: указатель в который считываются данные всегда один. -
-
virtual int jpeg_src(void * p);
-
- Инициализирует объект j_decompress_ptr, полученный через void *p; Дальше этот объект используется - libjpeg для чтения данных из JPEG-потока. Подробности смотрите в документации на LibJPEG -

- Возвращает: -1 если чтение JPEG-данных не поддержано или произошла ошибка, 0 при успехе. -

-
virtual void * make_jas_stream();
-
- Создает объект ввода-вывода LibJasper (распаковка JPEG2000). -

- Возвращает: NULL если создать поток не удалось, указатель на поток если он создан. -

- -
- -
Прочие методы
-

Данная группа методов включает в себя разнообразные вспомогательные методы, обеспечивающие временное - переключение потока ввода на другой объект. -

-
-
virtual const char* fname()
-
- Вызов возвращает имя открытого файла, если данному объекту ввода известно это имя (например, используется - LibRaw_file_datastream). Это имя используется в следующих случаях: -
    -
  • Передается в функции нотификации об ошибках.
  • -
  • Используются для генерации имени JPEG-файла с метаданными в соответствующих случаях (файлы с камер, где - RAW-изображение получается через недокументированные диагностические функции). -
-
-
virtual int subfile_open(const char *fn)
-
- Вызов временно переключает ввод на файл с именем fn. При успехе возвращается 0, при неуспехе - ненулевое - значение (например, код ошибки).
- Данный вызов используется при разборе JPEG-файлов с метаданными для камер с "Diag RAW Hack". -
- Данный вызов не реализован в LibRaw_buffer_datastream, соответственно - разбор внешних метаданных для файлов, открытых через этот интерфейс - невозможен. -
- Стандартная реализация метода (реализованная в базовом классе) всегда возвращает ошибку. -
- Пример работающей реализации можно посмотреть в реализации класса - LibRaw_file_datastream в файле libraw/libraw_datastream.h. -
-
virtual void subfile_close()
-
- Закрывает временно открытый файл с метаданными, возвращая ввод на исходный поток данных. -
-
virtual int tempbuffer_open(void *buf, size_t size)
-
- Вызов временно переключает ввод на объект LibRaw_buffer_datastream, - построенный на буфере buf размера size.
- Это метод нужен для реализации разбора шифрованых метаданных камер Sony. -

- Этот метод реализован в рамках базового класса, переопределение в производных классах не требуется. Однако - наличие и возможная активность временного потока данных требует аккуратного программирования при реализации - собственных методов ввода-вывода. Подробнее это описано в разделе реализация - собственных интерфейсов чтения ниже. -

-
virtual void tempbuffer_close()
-
- Вызов восстанавливает ввод обратно на полный поток данных. -
-
- - -

Производные классы, входящие в LibRaw

-

- В состав LibRaw входят два стандартных класса, реализующих ввод данных: -

- -

- Кроме того, пользователи C++-интерфейса могут реализовывать собственные методы чтения и использовать их через - метод LibRaw::open_datastream, требования и особенности реализации описаны ниже. -

- - -

class LibRaw_file_datastream - интерфейс чтения RAW-данных из файла

-

class LibRaw_bigfile_datastream - интерфейс чтения RAW-данных из файла

-

- Данные классы реализуют ввод данных из файла. -

-

Методы класса:

-
-
LibRaw_(big)file_datastream(const char *fname)
-
- Конструктор: создает объект LibRaw_(big)file_datastream для файла fname.
- К сожалению, в C++ нельзя не создать объект в конструкторе, поэтому может быть создан невалидный объект (для - несуществующего файла). Работоспособность объекта проверяется методом valid(), описанным выше. -
-
-

- Все прочие методы класса полностью соответствуют описанным выше.
- Данный класс реализует все методы, включая fname() и subfile_open(). -

- -

class LibRaw_buffer_datastream - интерфейс чтения RAW-данных из буфера в памяти

-

- Данный класс реализует ввод данных из буфера в памяти. -

-

Методы класса:

-
-
LibRaw_buffer_datastream(void *buffer, size_t bsize)
-
- Конструктор: создает объект над буфером buffer размера bsize.
- Верифицировать валидность переданного указателя нормально невозможно, он проверяется только на ноль и -1. - Валидность всех прочих значений - на совести вызвавшего. -
-
-

- Все прочие методы класса полностью соответствуют описанным выше.
- Данный класс не поддерживает методы fname() subfile_open(), следовательно разбор внешних JPEG-файлов - с метаданными невозможен. -

- -

Создание собственных интерфейсов чтения

-

- Для создания собственных интерфейсов чтения необходимо сделать класс, производный от - LibRaw_abstract_datastream и реализовать в нем все методы чтения, описанные выше. - В качестве образца можно использовать реализацию стандартных классов, поставляемых с LibRaw, - посмотреть которую можно в файле libraw/libraw_datastream.h в поставке (оба стандартных интерфейса ввода - реализованы только на inline-функциях). -

- -

Поле substream: второй поток чтения данных

-

- Отдельного описания требует поле substream, которое объявлено в базовом классе и используется при временном - переключении ввода на другой поток данных. C++ не дает средств для красивой реализации нужной функциональности, - поэтому любой читающий метод ввода должен содержать в начале приблизительно такую строку:
- int method(...args...){ if(substream) return substream->method(...args...). Например: -

-    virtual int eof() 
-    { 
-        if(substream) return substream->eof();
-....
-    virtual int scanf_one(const char *fmt, void* val) 
-    { 
-        if(substream) return substream->scanf_one(fmt,val);
-
- - [вернуться к оглавлению] -
-
LibRaw Team
- - -Last modified: Tue Jul 19 14:50:24 MSD 2011 - - - diff -Nru libraw-0.16.2/doc/API-datastruct-eng.html libraw-0.17.0/doc/API-datastruct-eng.html --- libraw-0.16.2/doc/API-datastruct-eng.html 2015-05-16 12:32:15.000000000 +0000 +++ libraw-0.17.0/doc/API-datastruct-eng.html 1970-01-01 00:00:00.000000000 +0000 @@ -1,1123 +0,0 @@ - - - - LibRaw: Data Structures and Constants - - - - [back to Index] -

LibRaw: Data Structures and Constants

-

- LibRaw data structures are defined in header file libraw/libraw_types.h
- Constants used in its work are defined in file libraw/libraw_const.h -

-

Contents:

-
    -
  1. Data structures -
      -
    1. libraw_data_t: Main Data Structure in LibRaw
    2. -
    3. Structure libraw_iparams_t: Main Parameters of the Image
    4. -
    5. Structure libraw_image_sizes_t: Image Dimensions
    6. -
    7. Structure libraw_colordata_t: Color Information
    8. -
    9. Structure libraw_imgother_t: Other Parameters of the Image
    10. -
    11. Structure libraw_rawdata_t: holds unpacked RAW data
    12. -
    13. Structure libraw_thumbnail_t: Description of Thumbnail
    14. -
    15. Structure libraw_output_params_t: Management of dcraw-Style Postprocessing.
    16. -
    17. Stucture libraw_processed_image_t - result set for dcraw_make_mem_image()/dcraw_make_mem_thumb() functions
    18. -
    -
  2. -
  3. - Input abstraction layer - -
  4. -
  5. Constants -
      -
    1. enum LibRaw_errors: Error Codes
    2. -
    3. enum LibRaw_decoder_flags - RAW data format description
    4. -
    5. enum LibRaw_progress: Current State of LibRaw Object
    6. -
    7. enum LibRaw_thumbnail_formats: Thumbnail Data Formats
    8. -
    9. Nonstandard Situations (Warnings) during RAW Data Processing
    10. -
    11. enum LibRaw_image_formats - possible types of data, contains in libraw_processed_image_t structure -
    -
  6. -
- - -

Data Structures

- -

libraw_data_t: Main Data Structure of LibRaw

-

- Structure libraw_data_t is a "wrapping" for data structures accessible to the user of the library.
- When one uses C++ API, it is accessible as LibRaw::imgdata (class_instance.imgdata). The data in this structure appear after - a file is opened through open_file (and other open_ calls), except for the image itself (filled by unpack()) and data containing -the preview information (filled by calling unpack_thumb()).
- Data fields: -

-
-
unsigned int progress_flags;
-
- This field records the past phases of image processing. -
-
unsigned int progress_flags;
-
- This field records suspicious situations (warnings) that have emerged during image processing. -
-
libraw_iparams_t idata;
-
- The structure describes the main image parameters retrieved from the RAW file. Fields of this structure -are described in detail below. -
-
libraw_image_sizes_t sizes;
-
- The structure describes the geometrical parameters of the image. Fields of this structure - are described in detail below. -
-
libraw_colordata_t color;
-
- The structure contains color data retrieved from the file. Fields of this structure -are described in detail below. -
-
libraw_imgother_t other;
-
-Data structure for information purposes: it contains the image parameters that have been extracted from the file but are -not needed in further file processing. Fields of this structure are described in detail below. -
- -
libraw_thumbnail_t thumbnail;
-
- Data structure containing information on the preview and the preview data themselves. All fields of this - structure but thumbnail itself are filled when open_file() is called. Thumbnail readed by unpack_thumb() call. - The fields are described in detail below. -
-
libraw_rawdata_t rawdata;
-
- Data structure with pointer to raw-data buffer. - Details are described below. -
-
ushort (*image)[4];
-
- The memory area that contains the image pixels per se. It is filled when raw2image() or dcraw_process() is called. -
- -
libraw_output_params_t params;
-
- Data structure intended for management of image postprocessing (using the dcraw emulator). -Fields of this structure are described in detail below. -
-
- -

Structure libraw_iparams_t: Main Parameters of the Image

-

- -

-
-
char make[64];
-
- Camera manufacturer. -
-
char model[64];
-
- Camera model. -
-
unsigned raw_count;
-
- Number of RAW images in file (0 means that the file has not been recognized). -
-
unsigned dng_version;
-
- DNG version (for the DNG format). -
-
- 1 for Foveon matrices, 0 for others. Foveon is supported in LibRaw-demosaic-pack-GPL2. -

-
-
int colors;
-
- Number of colors in the file. -
-
unsigned filters;
-
- Bit mask describing the order of color pixels in the matrix (0 for full-color images). 32 bits of this field describe 16 pixels -(8 rows with two pixels in each, from left to right and from top to bottom). Each two bits have values 0 to 3, which -correspond to four possible colors. Convenient work with this field is ensured by the COLOR(row,column) function, -which returns the number of the active color for a given pixel. -

- values less than 1000 are reserved as special cases: -

    -
  • 1 - Leaf Catchlight with 16x16 bayer matrix; -
  • 9 - Fuji X-Trans (6x6 matrix) -
  • 3..8 and 10..999 - are unused. -
- -
-
char xtrans[6][6];
-
- This matrix contains Fuji X-Trans row/col to color mapping. -
-
char cdesc[5];
-
- Description of colors numbered from 0 to 3 (RGBG,RGBE,GMCY, or GBTG). -
-
- -

Structure libraw_image_sizes_t: Image Dimensions

-

Structure libraw_image_sizes_t is a collection of all file data that describe the size of the image.
- Data fields: -

-
-
ushort raw_height, raw_width;
-
- Full size of RAW image (including the frame) in pixels. -
-
ushort height, width;
-
- Size of visible ("meaningful") part of the image (without the frame). -
-
ushort top_margin, left_margin;
-
- Coordinates of the top left corner of the frame (the second corner is calculated from the full size of the image and size of its visible part). -
-
ushort iheight, iwidth;
-
- Size of the output image (may differ from height/width for cameras that require image rotation or have non-square pixels). -
-
unsigned raw_pitch;
-
- Full size of raw data row in bytes. -
-
double pixel_aspect;
-
- Pixel width/height ratio. If it is not unity, scaling of the image along one of the axes is required during output. -
-
int flip;
-
- Image orientation (0 if does not require rotation; 3 if requires 180-deg rotation; 5 if 90 deg counterclockwise, 6 if 90 deg clockwise). -
-
- -

Structure libraw_colordata_t: Color Information

-

Structure libraw_colordata_t unites all color data, both retrieved from the RAW file and calculated on the basis of the -image itself. For different cameras, there are different ways of color handling.
- Data fields: -

-
-
ushort white[8][8];
-
- Block of white pixels extracted from files CIFF/CRW. Not extracted for other formats. Used to calculate white -balance coefficients. -
-
float cam_xyz[4][3];
-
- Camera RGB - XYZ conversion matrix. This matrix is constant (different for different models). - Last row is zero for RGB cameras and non-zero for different color models (CMYG and so on). -
-
float cam_mul[4];
-
- White balance coefficients (as shot). Either read from file or calculated. -
-
float pre_mul[4];
-
- White balance coefficients for daylight (daylight balance). Either read from file, or calculated on the basis of file data, -or taken from hardcoded constants. -
-
float cmatrix[3][4];
-
- White balance matrix. Read from file for some cameras, calculated for others. -
-
float rgb_cam[3][4];
-
- Another white balance matrix, read from file for Leaf and Kodak cameras. -
-
ushort curve[0x4001];
-
- Camera tone curve, read from file for Nikon, Sony and some other cameras. -
-
unsigned black;
-
- Black level. Depending on the camera, it may be zero (this means that black has been subtracted at the unpacking stage -or by the camera itself), calculated at the unpacking stage, read from the RAW file, or hardcoded. -
-
unsigned cblack[4];
-
- Per-channel black level correction. Final black level in channel N equals black + cblack[N] -
-
unsigned maximum;
-
- Maximum pixel value. Calculated from the data for most cameras, hardcoded for others. - This value may be changed on postprocessing stage (when black subtraction performed) and by - automated maximum adjustment (this adjustment performed if params.adjust_maximum_thr - is set to nonzero). -
-
unsigned data_maximum;
-
- Maximum pixel value in real image (not including masked area). Calculated from RAW data on black - subtraction stage. -
-
ph1_t phase_one_data;
-
- Color data block that is read for Phase One cameras. -
-
float flash_used;
-
float canon_ev;
-
- Fields used for white balance calculations (for some P&S Canon cameras). -
-
char model2[64];
-
- Firmware revision (for some cameras). -
-
void *profile;
-
- Pointer to the retrieved ICC profile (if it is present in the RAW file). -
-
unsigned profile_length;
-
- Length of ICC profile in bytes. -
-
- -

Structure libraw_imgother_t: Other Parameters of the Image

-

- Structure libraw_imgother_t is a collection of data that have been read from the RAW file but are not needed for image postprocessing.
- Data fields: -

-
-
float iso_speed;
-
- ISO sensitivity. -
-
float shutter;
-
- Shutter speed. -
-
float aperture;
-
- Aperture. -
-
float focal_len;
-
- Focal length. -
-
time_t timestamp;
-
- Date of shooting. -
-
unsigned shot_order;
-
- Serial number of image. -
-
unsigned gpsdata[32];
-
- GPS data. -
-
char desc[512];
-
- Image description. -
-
char artist[64];
-
- Author of image. -
-
- -

Structure libraw_rawdata_t: holds unpacked RAW data

-

- Structure libraw_rawdata_t holds: -

-
    -
  • RAW-data from sensor, readed and unpacked by the unpack() call. -
  • -
  • "backup" copy of color and over data modified during postprocessing. When postprocessing calls repeats, - the needed data is restored from this backup. -
-

- Data fields: -

-
-
void *raw_alloc;
-
Buffer allocated to hold RAW-data
-
unsigned short *raw_image;
-
Pointer to buffer with one-component (bayer) data.
-
unsigned short (*color3_image)[3] ;
-
Pointer to 3-component pixel array.
-
unsigned short (*color4_image)[4] ;
-
Pointer to buffer with 4-component pixel data data
-
- After call to unpack() only one of these fields is non-NULL. -

- All other fields of this structure are for internal use and should not be touched by user code. - - -

Structure libraw_thumbnail_t: Description of Thumbnail

-

Structure libraw_thumbnail_t describes all parameters associated with the preview saved in the RAW file.
- Data fields: -

-
-
LibRaw_thumbnail_formats tformat;
-
- Thumbnail data format. One of the values among enum LibRaw_thumbnail_formats. -
-
ushort twidth, theight;
-
- Dimensions of the preview image in pixels. -
-
unsigned tlength;
-
- Thumbnail length in bytes. -
-
int tcolors;
-
- Number of colors in the preview. -
-
char *thumb;
-
- Pointer to thumbmail, extracted from the data file. -
-
- - -

Structure libraw_output_params_t: Management of dcraw-Style Postprocessing

-

Structure libraw_output_params_t is used for management of dcraw-compatible calls dcraw_process(), - dcraw_ppm_tiff_writer(), and dcraw_thumb_writer(). Fields of this structure -correspond to command line keys of dcraw.
- Data fields: -

-
-
unsigned greybox[4];
-
- dcraw keys: -A x y w h
- 4 numbers corresponding to the coordinates (in pixels) of the rectangle that is used to calculate the white - balance. X and Y are coordinates of the left-top rectangle corner; w and h are the rectangle's width and - height, respectively. -
-
unsigned cropbox[4];
-
- dcraw keys:none
- This field sets the image cropping rectangle. Cropbox[0] and cropbox[1] are the rectangle's top-left - corner coordinates, remaining two values are width and height respectively. All coordinates are - applied before any image rotation. -
-
double aber[4];
-
- dcraw keys: -C
- Correction of chromatic aberrations; the only specified values are
- aber[0], the red multiplier
- aber[2], the green multiplier. - For some formats, it affects RAW data reading, since correction of aberrations -changes the output size. -
-
double gamm[6];
-
- dcraw keys: -g power toe_slope
- Sets user gamma-curve. Library user should set first two fields of gamm array:
- gamm[0] - inverted gamma value)
- gamm[1] - slope for linear part (so called toe slope). Set to zero for simple power curve. -
- Remaining 4 values are filled automatically. -

- By default settings for rec. BT.709 are used: power 2.222 (i.e. gamm[0]=1/2.222) and slope 4.5. - For sRGB curve use gamm[0]=1/2.4 and gamm[1]=12.92, for linear curve set gamm[0]/gamm[1] to 1.0. -

-
float user_mul[4];
-
- dcraw keys: -r mul0 mul1 mul2 mul3
- 4 multipliers (r,g,b,g) of the user's white balance. -
-
unsigned shot_select;
-
- dcraw keys: -s
- Selection of image number for processing (for formats that contain several RAW images in one file). -
-
float bright;
-
- dcraw keys: -b
- Brightness (default 1.0). -
-
float threshold;
-
- dcraw keys: -n
- Parameter for noise reduction through wavelet denoising. -
-
int half_size;
-
- dcraw keys: -h
- Outputs the image in 50% size. For some formats, it affects RAW data reading. -
-
int four_color_rgb;
-
- dcraw keys: -f
- Switches on separate interpolations for two green components. -
-
int highlight;
-
- dcraw keys: -H
- 0-9: Highlight mode (0=clip, 1=unclip, 2=blend, 3+=rebuild). -
-
int use_auto_wb;
-
- dcraw keys: -a
- Use automatic white balance obtained after averaging over the entire image. -
-
int use_camera_wb;
-
- dcraw keys: -w
- If possible, use the white balance from the camera. -
-
int use_camera_matrix;
-
- dcraw keys: +M/-M
- Use (1)/don't use camera color matrix. -
-
int output_color;
-
- dcraw keys: -o
- [0-5] Output colorspace (raw, sRGB, Adobe, Wide, ProPhoto, XYZ). -
-
char* output_profile;
-
- dcraw keys: -o filename
- Path to output profile ICC file (used only if LibRaw compiled with LCMS support) -
-
char* camera_profile;
-
- dcraw keys: -p file
- Path to input (camera) profile ICC file (or 'embed' for embedded profile). Used only if LCMS support compiled in. -
-
char* bad_pixels;
-
- dcraw keys: -P file
- Path to file with bad pixels map (in dcraw format: "column row date-of-pixel-death-in-UNIX-format", one pixel - per row). -
-
char* dark_frame;
-
- dcraw keys: -K file
- Path to dark frame file (in 16-bit PGM format) -
-
int output_bps;
-
- dcraw keys: -4
- 8 bit (default)/16 bit (key -4). -
-
int output_tiff;
-
- dcraw keys: -T
- 0/1: output PPM/TIFF. -
-
int user_flip;
-
- dcraw keys: -t
- [0-7] Flip image (0=none, 3=180, 5=90CCW, 6=90CW). - Default -1, which means taking the corresponding value from RAW.
- For some formats, affects RAW data reading, e.g., unpacking of thumbnails - from Kodak cameras. -
-
int user_qual;
-
- dcraw keys: -q
- 0-10: interpolation quality: -
    -
  • 0 - linear interpolation
  • -
  • 1 - VNG interpolation
  • -
  • 2 - PPG interpolation
  • -
  • 3 - AHD interpolation
  • -
  • 4 - DCB interpolation
  • -
  • 5 - Modified AHD interpolation by Paul Lee
  • -
  • 6 - AFD interpolation (5-pass)
  • -
  • 7 - VCD interpolation
  • -
  • 8 - Mixed VCD/Modified AHD interpolation
  • -
  • 9 - LMMSE interpolation
  • -
  • 10 - AMaZE intepolation
  • -
  • 11 - DHT intepolation
  • -
  • 12 - Modified AHD intepolation (by Anton Petrusevich)
  • -
- Values 5-9 are useful only if "LibRaw demosaic pack GPL2" compiled in (see README.demosaic-packs in - your distribution for details). Value 10 is useful only if LibRaw compiled with "LibRaw demosaic pack GPL3". - If some interpolation method is unsupported because LibRaw compiled without corresponding demosaic pack, - AHD interpolation will be used without any notice. -
-
int user_black;
-
- dcraw keys: -k
- User black level. -
-
int user_cblack[4];
-
- dcraw keys: none
- Per-channel corrections to user_black. -
-
int sony_arw2_hack;
-
- dcraw keys: none
- Turns off division by four for Sony ARW (2nd version) data. This is incompatible with old - LibRaw/dcraw, but adds one significant bit to data (only one, because of tone curve values). -
- -
int user_sat;
-
- dcraw keys: -S
- Saturation adjustment. -
-
int med_passes;
-
- dcraw keys: -m
- Number of median filter passes. -
-
int no_auto_bright;
-
- dcraw keys: -W
- Don't use automatic increase of brightness by histogram. -
-
float auto_bright_thr;
-
- dcraw keys:none
- Portion of clipped pixels when auto brighness increase is used. Default value is 0.01 (1%) for dcraw - compatibility. Recommended value for modern low-noise multimegapixel cameras depends on shooting style. Values - in 0.001-0.00003 range looks reasonable. -
-
float adjust_maximum_thr;
-
- dcraw keys:none
- This parameters controls auto-adjusting of maximum value based on channel_maximum[] data, calculated from - real frame data. If calculated maximum is greater than adjust_maximum_thr*maximum, than maximum is - set to calculated_maximum. -
Default: 0.75. If you set this value above 0.99999, than default value will be used. If you set - this value below 0.00001, than no maximum adjustment will be performed. -
- Adjusting maximum should not damage any picture (esp. if you use default value) and is very useful for - correcting channel overflow problems (magenta clouds on landscape shots, green-blue highlights for - indoor shots). -
-
int use_fuji_rotate;
-
- dcraw keys: -j
- Default -1 (use), 0 - don't use rotation for cameras on a Fuji sensor. -
-
int green_matching;
-
- Turns on fixing of green channels disbalance. - dcraw keys: none
- Default: 0 (not use), 1 - turns on this postprocessing stage. green_matching requires additional memory for - image data. -
-
int dcb_iterations
-
- dcraw keys: none
- Number of DCB correction passes. Default is -1 (no correction). Useful only for DCB interpolation. -
-
int dcb_enhance_fl
-
- dcraw keys: none
- nonzero: DCB interpolation with enhance interpolated colors. -
-
int fbdd_noiserd
-
- dcraw keys: none
- Controls FBDD noise reduction before demosaic. -
    -
  • 0 - do not use FBDD noise reduction
  • -
  • 1 - light FBDD reduction
  • -
  • 2 (and more) - full FBDD reduction
  • -
-
-
int eeci_refine
-
- dcraw keys: none
- nonzero- Use EECI refine for VCD interpolation. -
-
int es_med_passes
-
- dcraw keys: none
- Number of edge-sensitive median filter passes after VCD+AHD demosaic. - Value above 1 is highly not recommended. -
-
int ca_correc
-
- dcraw keys:none
- positive value turns on chromatic aberrations suppression (default:0 i.e. off). -
-
float cared,cablue
-
- dcraw keys: none
- If one of these fields is non-zero, then these values will be used instead of automatic ones. - Useable range is +-0.1..+-4.0. -
-
int cfaline; float linenoise;
-
Line noise (banding) reduction. -
- positive value turns this feature on (default: off). -
- linenoise - amount of reduction. Useful range is 0.001 to 0.02. Default value is 0.0 i.e. not clean anything. -
-
int cfa_clean; float lclean,cclean;
-
- Reduce impulse noise and Gaussian high frequency. -
- cfa_clean: positive value turns the feature on (default: off). -
- lclean,cclean - amount of noise reduction for (L)uminance and (C)olor. Useable range from 0.005 to 0.05, - common value 0.01 -
-
int cfa_green; float green_thresh;
-
- Reduces maze artifacts produced by bad balance of green channels. -
- cfa_green: positive value turns the feature on (default: off). -
- green_thresh - max difference between channels allowed for equalization. Useful range between 0.01 and 0.1. -
-
int exp_correc; float exp_shift,exp_preser;
-
- Exposure correction before demosaic. -
-
    -
  • exp_correc: positive value turns the feature on (default: off).
  • -
  • exp_shift: exposure shift in linear scale. Usable range from 0.25 (2-stop darken) to - 8.0 (3-stop lighter). Default: 1.0 (no exposure shift).
  • -
  • exp_preser: preserve highlights when lighten the image. Usable range from 0.0 (no preservation) to 1.0 - (full preservation). 0.0 is the default value. -
- -
int wf_debanding; float wf_deband_treshold[4];
-
- wf_debanding: 1 turns on banding suppression (slow!), 0 turns it off. -

- wf_deband_treshold[] - per channel debanding thresholds. -

-
int use_rawspeed;
-
- Turns on using RawSpeed library for data unpacking (only if RawSpeed support compiled in). -
-
int no_auto_scale;
-
- Disables pixel values scaling (call to LibRaw::scale_colors()) in LibRaw::dcraw_process() -
-
int no_interpolation;
-
- Disables call to demosaic code in LibRaw::dcraw_process() -
-
int sraw_ycc;
-
- Disables YCbCr to RGB conversion for Canon sRAW/mRAW files. -
- -
- - -

Structure libraw_decoder_info_t: RAW decoder name and data format

-

- This structure describes RAW format decoder name and data format: -

-
-
const char *decoder_name
-
Decoder function name
-
unsigned decoder_flags
-
Decoder data format. See list of LibRaw_decoder_flags for details. -
-
- - -

Stucture libraw_processed_image_t - result set for dcraw_make_mem_image()/dcraw_make_mem_thumb() functions

-

Structure libraw_processed_image_t is produced by call of dcraw_make_mem_image()/dcraw_make_mem_thumb() and contains - in-memory image of interpolated data or thumbnail.
- Data fields: -

-
-
LibRaw_image_formats type
-
This field records type of data, containing in remaining fields of structure. -
    -
  • LIBRAW_IMAGE_BITMAP - structure contains RGB bitmap. All metadata fields (see below) are valid - and describes image data. -
  • LIBRAW_IMAGE_JPEG - structure contain in-memory image of JPEG file. Only type, data_size and - data fields are valid (and nonzero); -
-
-
ushort height,width
-
Image size (in pixels). Valid only if type==LIBRAW_IMAGE_BITMAP.
-
ushort colors, bits
-
Number of colors components (1 or 3) and color depth in bits (8 or 16). These fields are valid only if - type==LIBRAW_IMAGE_BITMAP. -
-
ushort gamma_corrected
-
Is bitmap data gamma-corrected (always 1 for 8-bit data, may be 0 or 1 for 16-bit). - Valid only if type==LIBRAW_IMAGE_BITMAP.
-
unsigned int data_size
-
Size of data field (in bytes). For bitmap image equal to (height*width*colors * (bits/8)). - For JPEG image - exact JPEG size (i.e. extracted thnumbnail size + JPEG header + EXIF header). -
-
unsigned char data[]
-
Data array itself. Should be interpreted as RGB triplets for bitmap type and as JPEG file for JPEG type. -
-
- - -

Input abstraction layer

-

- RAW data input (read) in LibRaw implemented by calling methods of object derived from - LibRaw_abstract_datastream abstract class. Full list of methods is described in - href="API-CXX-eng.html#datastream">C++ API reference. -

-

- There is two ready to use implementations of datastream objects: -

- -

- LibRaw user can create own datastream object derived from - LibRaw_abstract_datastream. For example, such object may - implement reading RAW data directly from camera (by remote interface). LibRaw can use these - objects via - LibRaw::open_datastream() interface. -

-

- Datastreams can be used either via - LibRaw::open_datastream() call (in this case datastream - object should be created an maintained by user) or via - LibRaw::open_file() and - LibRaw::open_buffer() shortcuts. -

-

- Only C++ API users may use object-oriented interface and - implement own input interfaces. For C API users only - built-on libraw_open_file()/libraw_open_buffer() shortcuts are avaliable. -

- -

Data fields

-

Definition:

-
-class LibRaw_abstract_datastream {
-...
-protected:
-    LibRaw_abstract_datastream *substream;
-}
-
-

Description: - Ojects derived from LibRaw_abstract_datastream always contains pointer to secondary data stream - (substream). This substream initialized internally when needed (really used only for Sony RAW data) and - used for temporary switch input stream to temporary memory buffer allocated internally in LibRaw. -

-

- Substream usage details described more precisely in - own datastream objects creation guide. -

- - -

Constants

- -

enum LibRaw_errors: Error Codes

-

All functions returning integer numbers must return either errno or one of the following error codes (see also error code conventions).

-

Fatal errors (return of such an error code implies that file processing has to be terminated, since -the state of data structures is unknown).

-
-
LIBRAW_UNSUFFICIENT_MEMORY
-
Attempt to get memory from the system has failed.
- All allocated resources will be freed, recycle() will be called, and the LibRaw -object will be brought to the state "right after creation." -
-
LIBRAW_DATA_ERROR
-
A fatal error emerged during data unpacking.
- All allocated resources will be freed, recycle() will be called, and the LibRaw -object will be brought to the state "right after creation." -
-
LIBRAW_IO_ERROR
-
A fatal error emerged during file reading (premature end-of-file encountered or file is corrupt).
- All allocated resources will be freed, recycle() will be called, and the LibRaw -object will be brought to the state "right after creation." -
-
LIBRAW_CANCELLED_BY_CALLBACK
-
Processing cancelled due to calling application demand (by returning nonzero code from - progress callback).
- All allocated resources will be freed, recycle() will be called, and - the LibRaw object will be brought to the state "right after creation." -
-
LIBRAW_BAD_CROP
-
The incorrect cropping coordinates are set via params.cropbox[]: the left-top corner of cropping - rectangle is outside the image. - The processing will be cancelled, all allocated resources will be freed, recycle() will be called, and the LibRaw object will be brought to the - state "right after creation." -
-

Non-Fatal Errors

-
-
LIBRAW_SUCCESS=0
-
No error; function terminated successfully.
-
LIBRAW_UNSPECIFIED_ERROR
-
An unknown error has been encountered. This code should never be generated.
-
LIBRAW_FILE_UNSUPPORTED
-
Unsupported file format (attempt to open a RAW file with a format unknown to the program).
-
LIBRAW_REQUEST_FOR_NONEXISTENT_IMAGE
-
Attempt to retrieve a RAW image with a number absent in the data file (only for formats supporting storage - of several images in a file).
-
LIBRAW_OUT_OF_ORDER_CALL
-
API functions have been called in wrong order (e.g., unpack() before - open_file()) or the previous stage has ended with an error (e.g., - unpack() is called after open_file() has returned an error). -
-
LIBRAW_NO_THUMBNAIL
-
Returned upon an attempt to retrieve a thumbnail from a file containing no preview.
-
LIBRAW_UNSUPPORTED_THUMBNAIL
-
RAW file contains a preview of unsupported format.
-
- - -

enum LibRaw_decoder_flags - RAW data format description

-

- Depending of capabilities of given data format, the buffer with RAW data may have different layouts: -

-
-
LIBRAW_DECODER_FLATFIELD
-
- "Flat" buffer with one 16-bit value per pixel. This format is used for all bayer-pattern sensors. - Masked pixels (black frame) are included into buffer, so buffer size is [raw_width*raw_height]. -
-
LIBRAW_DECODER_4COMPONENT
-
- This buffer format is used for full-color RAW data: Foveon, Canon sRAW, demosaiced DNG files, some - multi-shot medium format backs. The picture frame (masked pixels) are stored with image data. - Four 16-bit values are allocated for each pixel. -
-
LIBRAW_DECODER_LEGACY
-
- Same as LIBRAW_DECODER_4COMPONENT, but without masked pixels data. Buffer size is [width*height*4] 16-bit - values. -
-
LIBRAW_DECODER_HASCURVE
-
This flag is set if decoder uses RAW tone curve and curve data may be modified before call - to decoder (i.e. curve values are not read or calculated within decoder). -
-
- - -

enum LibRaw_progress: Current State of LibRaw Object

-

LibRaw::imgdata.progress_flags contains a bit mask describing all stages of file processing that have already been performed. -

-

File opening and RAW data extraction phase.

-
-
LIBRAW_PROGRESS_START=0
-
- Object just created, no processing carried out. -
-
LIBRAW_PROGRESS_OPEN
-
- File to be processed has been opened. -
-
LIBRAW_PROGRESS_IDENTIFY
-
- Data identification performed, format recognized, metadata extracted. -
-
LIBRAW_PROGRESS_SIZE_ADJUST
-
- Data sizes adjusted (for files that require such adjustment, namely, certain files from Kodak cameras). -
-
LIBRAW_PROGRESS_LOAD_RAW
-
- RAW data loaded. -
-
-

The following flags are set during usage of image processing that has been taken from dcraw.

-
-
LIBRAW_PROGRESS_RAW2_IMAGE
-
- imgdata.image array allocated and filled with data. -
- -
LIBRAW_PROGRESS_REMOVE_ZEROES
-
- Zero values removed for cameras that require such removal (Panasonic cameras). -
-
LIBRAW_PROGRESS_BAD_PIXELS
-
- Bad (dead) pixels removed. -
-
LIBRAW_PROGRESS_DARK_FRAME
-
- Dark frame subtracted from RAW data. -
-
LIBRAW_PROGRESS_FOVEON_INTERPOLATE
-
- Interpolation for cameras with a Foveon sensor performed. -
-
LIBRAW_PROGRESS_SCALE_COLORS
-
- White balance performed. -
-
LIBRAW_PROGRESS_PRE_INTERPOLATE
-
- Image size reduction (for the half_size mode) performed, as well as copying of 2nd green channel to the 1st one in points - where the second channel is present and the first one is absent. -
-
LIBRAW_PROGRESS_INTERPOLATE
-
- Interpolation (debayer) performed. -
-
LIBRAW_PROGRESS_MIX_GREEN
-
- Averaging of green channels performed. -
-
LIBRAW_PROGRESS_MEDIAN_FILTER
-
- Median filtration performed. -
-
LIBRAW_PROGRESS_HIGHLIGHTS
-
- Work with highlights performed. -
-
LIBRAW_PROGRESS_FUJI_ROTATE
-
- For images from Fuji cameras, rotation performed (or adjust_sizes_info_only() called). -
-
LIBRAW_PROGRESS_FLIP
-
- Dimensions recalculated for images shot with a rotated camera (sizes.iwidth/sizes.iheight swapped). -
-
LIBRAW_PROGRESS_CONVERT_RGB
-
- Conversion into output RGB space performed. -
-
LIBRAW_PROGRESS_STRETCH
-
- Image dimensions changed for cameras with non-square pixels. -
-
LIBRAW_PROGRESS_STAGE17 - LIBRAW_PROGRESS_STAGE27
-
- Reserved for possible appearance of other processing stages. -
-
-

The following flags are set during loading of thumbnails.

-
LIBRAW_PROGRESS_THUMB_LOAD
-
- Thumbnail data have been loaded (for Kodak cameras, the necessary conversions have also been made). -
-
LIBRAW_PROGRESS_TRESERVED1 - LIBRAW_PROGRESS_TRESERVED3
-
- Reserved for possible future processing stages. -
-
- - -

enum LibRaw_thumbnail_formats: Thumbnail Data Formats

-

Thumbnail data format is written in the imgdata.thumbnail.tformat data field.
- Presently LibRaw knows about four thumbnail formats, among which two are unpacked: -

-
-
LIBRAW_THUMBNAIL_UNKNOWN
-
Format unknown or thumbnail not yet read. -
-
LIBRAW_THUMBNAIL_JPEG
-
The thumbnail buffer contains a JPEG file (read from the RAW file "as is," without any manipulations performed on it). -
-
LIBRAW_THUMBNAIL_BITMAP
-
- The thumbnail buffer contains the gamma-adjusted RGB bitmap (for Kodak cameras, the gamma correction is performed with allowance - for maximum values and the white balance is set in accordance with the camera settings).
- In this format, each pixel of the image is represented by a 8-bit RGB triplet. -
-
LIBRAW_THUMBNAIL_LAYER
-
- Data format is presently recognized upon opening of RAW file but not supported: not unpacked into LibRaw::unpack_thumb. -
-
LIBRAW_THUMBNAIL_ROLLEI
-
- Data format is presently recognized upon opening of RAW file but not supported: not unpacked into LibRaw::unpack_thumb. -
-
- -

Nonstandard Situations (Warnings) during RAW Data Processing

-

Some suspicious situations emerging during image processing are not fatal but may affect the result of data -retrieval or postprocessing. Such states are indicated by setting a bit in the imgdata.process_warnings field.

-
-
LIBRAW_WARN_FOVEON_NOMATRIX
-
- Only for cameras with Foveon: extraction of one of data matrices has failed. -
-
LIBRAW_WARN_FOVEON_INVALIDWB
-
- Only for cameras with Foveon: extraction of white balance data has failed. -
-
LIBRAW_WARN_BAD_CAMERA_WB
-
- Postprocessing must use white balance of the camera but this balance is not suitable for use. -
-
LIBRAW_WARN_NO_METADATA
-
- Only for cameras where the metadata are taken from an external JPEG file: metadata extraction has failed. -
-
LIBRAW_WARN_NO_JPEGLIB
-
- Only for P&S Kodak cameras: data in JPEG format. At the same time, open_file() will return LIBRAW_FILE_UNSUPPORTED. -
-
LIBRAW_WARN_NO_EMBEDDED_PROFILE
-
- (only if LCMS support compiled in). - Caller set embedded input profile use, but no such profile exists in RAW. -
-
LIBRAW_WARN_NO_INPUT_PROFILE
-
- (only if LCMS support compiled in). - Error when opening input profile ICC file. -
-
LIBRAW_WARN_BAD_OUTPUT_PROFILE
-
- (only if LCMS support compiled in). - Error when opening output profile ICC file. -
-
LIBRAW_WARN_NO_BADPIXELMAP
-
- Error when opening bad pixels map file. -
-
LIBRAW_WARN_BAD_DARKFRAME_FILE
-
- Error when opening dark frame file. -
-
LIBRAW_WARN_BAD_DARKFRAME_DIM
-
- Dark frame file either differs in dimensions from RAW-file processed, or have wrong format. - Dark frame should be in 16-bit PGM format (one can generate it using simple_dcraw -4 -D). -
-
LIBRAW_WARN_RAWSPEED_PROBLEM
-
- Problems detected in RawSpeed decompressor. The image data processed by LibRaw own decoder. -
-
LIBRAW_WARN_RAWSPEED_UNSUPPORTED
-
- This file not supported by RawSpeed (although compatible decoder exists). -
-
LIBRAW_WARN_RAWSPEED_PROCESSED
-
- Not warning, but information. The file was decoded by RawSpeed. -
-
- - -

enum LibRaw_image_formats - possible types of data, contains in libraw_processed_image_t structure

-

type field of libraw_processed_image_t structure may have one of these values: -

-
-
LIBRAW_IMAGE_BITMAP
-
- The structure contains RGB-bitmap, metadata described in other fields of libraw_processed_image_t. -
-
LIBRAW_IMAGE_JPEG
-
- libraw_processed_image_t structure contains JPEG image (in memory). Only data_size field is meaningful. -
-
- - - [back to Index] -
-
LibRaw Team
- - -Last modified: Sun Sep 22 14:02:03 MSK 2013 - - - diff -Nru libraw-0.16.2/doc/API-datastruct.html libraw-0.17.0/doc/API-datastruct.html --- libraw-0.16.2/doc/API-datastruct.html 1970-01-01 00:00:00.000000000 +0000 +++ libraw-0.17.0/doc/API-datastruct.html 2015-08-15 13:10:27.000000000 +0000 @@ -0,0 +1,1239 @@ + + + + LibRaw: Data Structures and Constants + + + + [back to Index] +

LibRaw: Data Structures and Constants

+

+ LibRaw data structures are defined in header file libraw/libraw_types.h
+ Constants used in its work are defined in file libraw/libraw_const.h +

+

Contents:

+
    +
  1. Data structures +
      +
    1. libraw_data_t: Main Data Structure in LibRaw
    2. +
    3. Structure libraw_iparams_t: Main Parameters of the Image
    4. +
    5. Structure libraw_image_sizes_t: Image Dimensions
    6. +
    7. Structure libraw_colordata_t: Color Information
    8. +
    9. Structure libraw_imgother_t: Other Parameters of the Image
    10. +
    11. Structure libraw_rawdata_t: holds unpacked RAW data
    12. +
    13. Structure libraw_thumbnail_t: Description of Thumbnail
    14. +
    15. Structure libraw_lensinfo_t - lens data, extracted from EXIF/Makernotes
    16. +
    17. Structure libraw_output_params_t: Management of dcraw-Style Postprocessing.
    18. +
    19. Stucture libraw_processed_image_t - result set for dcraw_make_mem_image()/dcraw_make_mem_thumb() functions
    20. +
    +
  2. +
  3. + Input abstraction layer + +
  4. +
  5. Constants +
      +
    1. enum LibRaw_errors: Error Codes
    2. +
    3. enum LibRaw_decoder_flags - RAW data format description
    4. +
    5. enum LibRaw_progress: Current State of LibRaw Object
    6. +
    7. enum LibRaw_thumbnail_formats: Thumbnail Data Formats
    8. +
    9. Nonstandard Situations (Warnings) during RAW Data Processing
    10. +
    11. enum LibRaw_image_formats - possible types of data, contains in libraw_processed_image_t structure +
    +
  6. +
+ + +

Data Structures

+ +

libraw_data_t: Main Data Structure of LibRaw

+

+ Structure libraw_data_t is a "wrapping" for data structures accessible to the user of the library.
+ When one uses C++ API, it is accessible as LibRaw::imgdata (class_instance.imgdata). The data in this structure appear after + a file is opened through open_file (and other open_ calls), except for the image itself (filled by unpack()) and data containing +the preview information (filled by calling unpack_thumb()).
+ Data fields: +

+
+
unsigned int progress_flags;
+
+ This field records the past phases of image processing. +
+
unsigned int progress_flags;
+
+ This field records suspicious situations (warnings) that have emerged during image processing. +
+
libraw_iparams_t idata;
+
+ The structure describes the main image parameters retrieved from the RAW file. Fields of this structure +are described in detail below. +
+
libraw_image_sizes_t sizes;
+
+ The structure describes the geometrical parameters of the image. Fields of this structure + are described in detail below. +
+
libraw_colordata_t color;
+
+ The structure contains color data retrieved from the file. Fields of this structure +are described in detail below. +
+
libraw_imgother_t other;
+
+Data structure for information purposes: it contains the image parameters that have been extracted from the file but are +not needed in further file processing. Fields of this structure are described in detail below. +
+ +
libraw_thumbnail_t thumbnail;
+
+ Data structure containing information on the preview and the preview data themselves. All fields of this + structure but thumbnail itself are filled when open_file() is called. Thumbnail readed by unpack_thumb() call. + The fields are described in detail below. +
+
libraw_rawdata_t rawdata;
+
+ Data structure with pointer to raw-data buffer. + Details are described below. +
+
ushort (*image)[4];
+
+ The memory area that contains the image pixels per se. It is filled when raw2image() or dcraw_process() is called. +
+ +
libraw_output_params_t params;
+
+ Data structure intended for management of image postprocessing (using the dcraw emulator). +Fields of this structure are described in detail below. +
+
+ +

Structure libraw_iparams_t: Main Parameters of the Image

+

+ +

+
+
char make[64];
+
+ Camera manufacturer. +
+
char model[64];
+
+ Camera model. +
+
char software[64];
+
+ Softwary name/version (mostly for DNG files, to distinguish in-camera DNGs from Adobe DNG Converter produced ones). +
+
unsigned raw_count;
+
+ Number of RAW images in file (0 means that the file has not been recognized). +
+
unsigned dng_version;
+
+ DNG version (for the DNG format). +
+
+ 1 for Foveon matrices, 0 for others. Foveon is supported in LibRaw-demosaic-pack-GPL2. +

+
+
int colors;
+
+ Number of colors in the file. +
+
unsigned filters;
+
+ Bit mask describing the order of color pixels in the matrix (0 for full-color images). 32 bits of this field describe 16 pixels +(8 rows with two pixels in each, from left to right and from top to bottom). Each two bits have values 0 to 3, which +correspond to four possible colors. Convenient work with this field is ensured by the COLOR(row,column) function, +which returns the number of the active color for a given pixel. +

+ values less than 1000 are reserved as special cases: +

    +
  • 1 - Leaf Catchlight with 16x16 bayer matrix; +
  • 9 - Fuji X-Trans (6x6 matrix) +
  • 3..8 and 10..999 - are unused. +
+ +
+
char xtrans[6][6];
+
char xtrans_abs[6][6];
+
+ These matrices contains Fuji X-Trans row/col to color mapping. First one is relative to visible area, + while second is positioned relative to sensor edges. +
+
char cdesc[5];
+
+ Description of colors numbered from 0 to 3 (RGBG,RGBE,GMCY, or GBTG). +
+
unsigned xmplen; char *xmpdata;
+
+ XMP packed data length and pointer to extracted XMP packet. +
+
+ +

Structure libraw_image_sizes_t: Image Dimensions

+

Structure libraw_image_sizes_t is a collection of all file data that describe the size of the image.
+ Data fields: +

+
+
ushort raw_height, raw_width;
+
+ Full size of RAW image (including the frame) in pixels. +
+
ushort height, width;
+
+ Size of visible ("meaningful") part of the image (without the frame). +
+
ushort top_margin, left_margin;
+
+ Coordinates of the top left corner of the frame (the second corner is calculated from the full size of the image and size of its visible part). +
+
ushort iheight, iwidth;
+
+ Size of the output image (may differ from height/width for cameras that require image rotation or have non-square pixels). +
+
unsigned raw_pitch;
+
+ Full size of raw data row in bytes. +
+
double pixel_aspect;
+
+ Pixel width/height ratio. If it is not unity, scaling of the image along one of the axes is required during output. +
+
int flip;
+
+ Image orientation (0 if does not require rotation; 3 if requires 180-deg rotation; 5 if 90 deg counterclockwise, 6 if 90 deg clockwise). +
+
+ +

Structure libraw_colordata_t: Color Information

+

Structure libraw_colordata_t unites all color data, both retrieved from the RAW file and calculated on the basis of the +image itself. For different cameras, there are different ways of color handling.
+ Data fields: +

+
+
ushort curve[0x10000];
+
+ Camera tone curve. May be read from file as is, or calculated, depending on file format; +
+
unsigned black;
+
+ Black level. Depending on the camera, it may be zero (this means that black has been subtracted at the unpacking stage +or by the camera itself), calculated at the unpacking stage, read from the RAW file, or hardcoded. +
+
unsigned cblack[4102];
+
+ Per-channel black level correction. First 4 values are per-channel correction, next two are black level + pattern block size, than cblack[5]*cblack[6] correction values. +
+
unsigned maximum;
+
+ Maximum pixel value. Calculated from the data for most cameras, hardcoded for others. + This value may be changed on postprocessing stage (when black subtraction performed) and by + automated maximum adjustment (this adjustment performed if params.adjust_maximum_thr + is set to nonzero). +
+
unsigned data_maximum;
+
+ Maximum pixel value in real image (not including masked area). Calculated from RAW data on black + subtraction stage. +
+
ushort white[8][8];
+
+ Block of white pixels extracted from files CIFF/CRW. Not extracted for other formats. Used to calculate white +balance coefficients. +
+
float cam_xyz[4][3];
+
+ Camera RGB - XYZ conversion matrix. This matrix is constant (different for different models). + Last row is zero for RGB cameras and non-zero for different color models (CMYG and so on). +
+
float cam_mul[4];
+
+ White balance coefficients (as shot). Either read from file or calculated. +
+
float pre_mul[4];
+
+ White balance coefficients for daylight (daylight balance). Either read from file, or calculated on the basis of file data, +or taken from hardcoded constants. +
+
float cmatrix[3][4];
+
+ Camera color data read from RAW file (if any) +
+
float rgb_cam[3][4];
+
+ Camera to sRGB conversion matrix +
+
ph1_t phase_one_data;
+
+ Color data block that is read for Phase One cameras. +
+
float flash_used;
+
float canon_ev;
+
+ Fields used for white balance calculations (for some P&S Canon cameras). +
+
char model2[64];
+
+ Firmware revision (for some cameras). +
+
void *profile;
+
+ Pointer to the retrieved ICC profile (if it is present in the RAW file). +
+
unsigned profile_length;
+
+ Length of ICC profile in bytes. +
+
unsigned black_stat[8];
+
+ Black level statistics if calcluated from masked area: 4 sum of pixel values, than 4 pixel counts (per channel). +
+
libraw_dng_color_t dng_color[2];
+
+ Color data read from DNG: illuminant, calbiration matrix and color matrix for two light sources. + (see DNG specs for details). +
+
libraw_canon_makernotes_t canon_makernotes;
+
+ Canon specific data: color data version, saturation level, average black level. +
+
float baseline_exposure;
+
+ DNG-files: value of BaselineExposure tag. +
+
int OlympusSensorCalibration[2]
+
+ Olympus file: sensor calibration values (midtone and max). +
+
float FujiExpoMidPointShift
+
+ Fujifilm file: indicates the shift of metering point relative to SOS calibration standard, can be used as an instruction to raw converter to compensate raw image brightness. If the raw file contains 2 frames, each one may have its own value for FujiExpoMidPointShift. +
+
int digitalBack_color
+
+ Set to non-zero if current file is from Leaf/PhaseOne digital back and color data is read from file. +
+
+ +

Structure libraw_imgother_t: Other Parameters of the Image

+

+ Structure libraw_imgother_t is a collection of data that have been read from the RAW file but are not needed for image postprocessing.
+ Data fields: +

+
+
float iso_speed;
+
+ ISO sensitivity. +
+
float shutter;
+
+ Shutter speed. +
+
float aperture;
+
+ Aperture. +
+
float focal_len;
+
+ Focal length. +
+
time_t timestamp;
+
+ Date of shooting. +
+
unsigned shot_order;
+
+ Serial number of image. +
+
unsigned gpsdata[32];
+
+ GPS data (unparsed block, to write to output as is). +
+
+
libraw_gps_info_t parsed_gps;
+
+ Parsed GPS-data: longtitude/lattitude/altitude and time stamp. +
+
char desc[512];
+
+ Image description. +
+
char artist[64];
+
+ Author of image. +
+ + +

Structure libraw_rawdata_t: holds unpacked RAW data

+

+ Structure libraw_rawdata_t holds: +

+
    +
  • RAW-data from sensor, readed and unpacked by the unpack() call. +
  • +
  • "backup" copy of color and over data modified during postprocessing. When postprocessing calls repeats, + the needed data is restored from this backup. +
+

+ Data fields: +

+
+
void *raw_alloc;
+
Buffer allocated to hold RAW-data
+
unsigned short *raw_image;
+
Pointer to buffer with one-component (bayer) data.
+
unsigned short (*color3_image)[3] ;
+
Pointer to 3-component pixel array.
+
unsigned short (*color4_image)[4] ;
+
Pointer to buffer with 4-component pixel data data
+
+ After call to unpack() only one of these fields is non-NULL. +

+ All other fields of this structure are for internal use and should not be touched by user code. + + +

Structure libraw_thumbnail_t: Description of Thumbnail

+

Structure libraw_thumbnail_t describes all parameters associated with the preview saved in the RAW file.
+ Data fields: +

+
+
LibRaw_thumbnail_formats tformat;
+
+ Thumbnail data format. One of the values among enum LibRaw_thumbnail_formats. +
+
ushort twidth, theight;
+
+ Dimensions of the preview image in pixels. +
+
unsigned tlength;
+
+ Thumbnail length in bytes. +
+
int tcolors;
+
+ Number of colors in the preview. +
+
char *thumb;
+
+ Pointer to thumbmail, extracted from the data file. +
+
+ + +

Structure libraw_lensinfo_t: parsed lens data

+

+ The following parameters are extracted from Makernotes and EXIF, to help identify which lens + was mounted on the camera. If the value is missing in Makernotes or EXIF, the parameter is set + to zero with some exceptions noted below. In some cases the values for the fields like + CameraFormat and CameraMount are set based on the camera model and/or camera ID. +

libraw_makernotes_lens_t structure:

+
    +
  • LensID (if not -1) and CamID (camera id, if non-zero) values are compatible with + those used in exiftool, like |0x0010 CanonModelID| and |22 LensType| + see http://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/Canon.html + or 0x0207/CameraType and 0x0201/LensType (see http://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/Olympus.html ) +
  • Lens string, if not empty, contains the lens name present in Makernotes. +
  • LensFormat and CameraFormat' currently provide one of value from enum LibRaw_camera_formats; +
  • In a similar manner, values for 'LensMount' and 'CameraMount' follow the enum LibRaw_camera_mounts; +
  • In some cases, the Makernotes for MF cameras contain either an id for the body, or a string containing the name of the body. The name is copied to 'body' field, while the id is converted to the appropriate body name and also copied to 'body' field. In other cases the 'body' field is empty. +
  • FocalType is set based on Makernotes tag, if present. The values are: -1 Undefined; 0 Unknown;1 Fixed focal length lens; 2 Zoom lens +
  • LensFeatures_pre - lens name prefix and LensFeatures_suf - lens name suffix: + (if not empty) some cameras record alphabet soup that characterizes the lens in separate Makernote tags (see, for example, 0xb02a LensSpec at http://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/Sony.html ), and for some lenses those acronyms can be derived from the 'Lens' field itself (see processCanonCameraInfo). Those can also help better lens identification. +
  • 'MinFocal' and 'MaxFocal' , if non-zero, contain the minimum and maximum focal lengths for the lens mounted on the camera. +
  • 'MaxAp4MinFocal', 'MaxAp4MaxFocal', 'MinAp4MinFocal', 'MinAp4MaxFocal' - if non-zero, +contain maximum aperture available at minimal focal length, maximum aperture available at maximum focal length, minimum aperture available at minimal focal length, minimum aperture available at maximum focal length, respectively. +
  • 'MaxAp' and 'MinAp', if non-zero, contain the maximum aperture for the lens (usually it is the maximum aperture for minimal focal length) and the minimum aperture across the focal length range. For zooms with variable maximum aperture this is usually the minimum aperture for the maximum focal length. +
  • 'CurFocal', if non-zero, is current focal length - that is the focal length used to take the shot. +
  • 'CurAp', if non-zero, is current aperture. +
  • 'MaxAp4CurFocal' and 'MinAp4CurFocal', if non-zero, contain the minimum and maximum apertures for the current focal length. +
  • 'LensFStops' - if non-zero, contains the number of aperture "clicks" or the number of f-stops, depending on the model of the camera. +
  • 'TeleconverterID', 'AdapterID', 'AttachmentID', if non-zero, are the numbers extracted from Makernotes to identify lens accessories used to take the shot. +
  • 'Teleconverter', 'Adapter', 'Attachment', if non-empty, are the strings containing the names of the accessories as they appear in Makernotes, or for some cameras, decoded from a numeric field in Makernotes. +
  • 'CanonFocalUnits' - an auxiliary field, should not be needed most of the cases. See Canon.pm module in exiftool for more information on this value. +
  • 'FocalLengthIn35mmFormat', if non-zero: for some reason certain Samsung cameras record this value in Makernotes instead of the EXIF proper. Also used for Sigma cameras. +
+

libraw_nikonlens_t structure:

+ Contains additional parameters needed to identify the lens on a Nikon camera using a table - + please see Nikon LensID Values at http://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/Nikon.html +

libraw_dnglens_t structure:

+ Contains minimum focal length, maximum focal length, maximum aperture available at minimal focal length, + and maximum aperture available at maximum focal length, extracted from EXIF field of a DNG raw file. +

libraw_lensinfo_t structure:

+ Contains all the structures described above, plus parameters extracted directly from EXIF fields: +
    +
  • 'MinFocal' and 'MaxFocal' , if non-zero, contain the minimum and maximum focal lengths for the lens mounted on the camera. +
  • 'MaxAp4MinFocal', 'MaxAp4MaxFocal' - if non-zero, contain maximum aperture available at minimal focal length and maximum aperture available at maximum focal length +
  • 'LensMake', if not empty, contains a string with the lens manufacturer name. +
  • 'Lens', if not empty, contains the lens name as recorded in EXIF +
  • 'FocalLengthIn35mmFormat' - if non-zero, same as FocalLengthIn35mmFilm in EXIF standard, tag 0xa405. +
  • 'EXIF_MaxAp' - if non-zero, contains the value derived from EXIF tag 0x9205. +
+ + +

Structure libraw_output_params_t: Management of dcraw-Style Postprocessing

+

Structure libraw_output_params_t is used for management of dcraw-compatible calls dcraw_process(), + dcraw_ppm_tiff_writer(), and dcraw_thumb_writer(). Fields of this structure +correspond to command line keys of dcraw.
+ Data fields: +

+
+
unsigned greybox[4];
+
+ dcraw keys: -A x y w h
+ 4 numbers corresponding to the coordinates (in pixels) of the rectangle that is used to calculate the white + balance. X and Y are coordinates of the left-top rectangle corner; w and h are the rectangle's width and + height, respectively. +
+
unsigned cropbox[4];
+
+ dcraw keys:none
+ This field sets the image cropping rectangle. Cropbox[0] and cropbox[1] are the rectangle's top-left + corner coordinates, remaining two values are width and height respectively. All coordinates are + applied before any image rotation. +
+
double aber[4];
+
+ dcraw keys: -C
+ Correction of chromatic aberrations; the only specified values are
+ aber[0], the red multiplier
+ aber[2], the green multiplier. + For some formats, it affects RAW data reading, since correction of aberrations +changes the output size. +
+
double gamm[6];
+
+ dcraw keys: -g power toe_slope
+ Sets user gamma-curve. Library user should set first two fields of gamm array:
+ gamm[0] - inverted gamma value)
+ gamm[1] - slope for linear part (so called toe slope). Set to zero for simple power curve. +
+ Remaining 4 values are filled automatically. +

+ By default settings for rec. BT.709 are used: power 2.222 (i.e. gamm[0]=1/2.222) and slope 4.5. + For sRGB curve use gamm[0]=1/2.4 and gamm[1]=12.92, for linear curve set gamm[0]/gamm[1] to 1.0. +

+
float user_mul[4];
+
+ dcraw keys: -r mul0 mul1 mul2 mul3
+ 4 multipliers (r,g,b,g) of the user's white balance. +
+
unsigned shot_select;
+
+ dcraw keys: -s
+ Selection of image number for processing (for formats that contain several RAW images in one file). +
+
float bright;
+
+ dcraw keys: -b
+ Brightness (default 1.0). +
+
float threshold;
+
+ dcraw keys: -n
+ Parameter for noise reduction through wavelet denoising. +
+
int half_size;
+
+ dcraw keys: -h
+ Outputs the image in 50% size. For some formats, it affects RAW data reading. +
+
int four_color_rgb;
+
+ dcraw keys: -f
+ Switches on separate interpolations for two green components. +
+
int highlight;
+
+ dcraw keys: -H
+ 0-9: Highlight mode (0=clip, 1=unclip, 2=blend, 3+=rebuild). +
+
int use_auto_wb;
+
+ dcraw keys: -a
+ Use automatic white balance obtained after averaging over the entire image. +
+
int use_camera_wb;
+
+ dcraw keys: -w
+ If possible, use the white balance from the camera. +
+
int use_camera_matrix;
+
+ dcraw keys: +M/-M
+
    +
  • 0: do not use embedded color profile +
  • 1 (default): use embedded color profile (if present) for DNG files (always); for other files only if use_camera_wb is set; +
  • 3: use embedded color data (if present) regardless of white balance setting. +
+
int output_color;
+
+ dcraw keys: -o
+ [0-5] Output colorspace (raw, sRGB, Adobe, Wide, ProPhoto, XYZ). +
+
char* output_profile;
+
+ dcraw keys: -o filename
+ Path to output profile ICC file (used only if LibRaw compiled with LCMS support) +
+
char* camera_profile;
+
+ dcraw keys: -p file
+ Path to input (camera) profile ICC file (or 'embed' for embedded profile). Used only if LCMS support compiled in. +
+
char* bad_pixels;
+
+ dcraw keys: -P file
+ Path to file with bad pixels map (in dcraw format: "column row date-of-pixel-death-in-UNIX-format", one pixel + per row). +
+
char* dark_frame;
+
+ dcraw keys: -K file
+ Path to dark frame file (in 16-bit PGM format) +
+
int output_bps;
+
+ dcraw keys: -4
+ 8 bit (default)/16 bit (key -4). +
+
int output_tiff;
+
+ dcraw keys: -T
+ 0/1: output PPM/TIFF. +
+
int user_flip;
+
+ dcraw keys: -t
+ [0-7] Flip image (0=none, 3=180, 5=90CCW, 6=90CW). + Default -1, which means taking the corresponding value from RAW.
+ For some formats, affects RAW data reading, e.g., unpacking of thumbnails + from Kodak cameras. +
+
int user_qual;
+
+ dcraw keys: -q
+ 0-10: interpolation quality: +
    +
  • 0 - linear interpolation
  • +
  • 1 - VNG interpolation
  • +
  • 2 - PPG interpolation
  • +
  • 3 - AHD interpolation
  • +
  • 4 - DCB interpolation
  • +
  • 5 - Modified AHD interpolation by Paul Lee
  • +
  • 6 - AFD interpolation (5-pass)
  • +
  • 7 - VCD interpolation
  • +
  • 8 - Mixed VCD/Modified AHD interpolation
  • +
  • 9 - LMMSE interpolation
  • +
  • 10 - AMaZE intepolation
  • +
  • 11 - DHT intepolation
  • +
  • 12 - Modified AHD intepolation (by Anton Petrusevich)
  • +
+ Values 5-9 are useful only if "LibRaw demosaic pack GPL2" compiled in (see README.demosaic-packs in + your distribution for details). Value 10 is useful only if LibRaw compiled with "LibRaw demosaic pack GPL3". + If some interpolation method is unsupported because LibRaw compiled without corresponding demosaic pack, + AHD interpolation will be used without any notice. +
+
int user_black;
+
+ dcraw keys: -k
+ User black level. +
+
int user_cblack[4];
+
+ dcraw keys: none
+ Per-channel corrections to user_black. +
+
int user_sat;
+
+ dcraw keys: -S
+ Saturation adjustment. +
+
int med_passes;
+
+ dcraw keys: -m
+ Number of median filter passes. +
+
int no_auto_bright;
+
+ dcraw keys: -W
+ Don't use automatic increase of brightness by histogram. +
+
float auto_bright_thr;
+
+ dcraw keys:none
+ Portion of clipped pixels when auto brighness increase is used. Default value is 0.01 (1%) for dcraw + compatibility. Recommended value for modern low-noise multimegapixel cameras depends on shooting style. Values + in 0.001-0.00003 range looks reasonable. +
+
float adjust_maximum_thr;
+
+ dcraw keys:none
+ This parameters controls auto-adjusting of maximum value based on channel_maximum[] data, calculated from + real frame data. If calculated maximum is greater than adjust_maximum_thr*maximum, than maximum is + set to calculated_maximum. +
Default: 0.75. If you set this value above 0.99999, than default value will be used. If you set + this value below 0.00001, than no maximum adjustment will be performed. +
+ Adjusting maximum should not damage any picture (esp. if you use default value) and is very useful for + correcting channel overflow problems (magenta clouds on landscape shots, green-blue highlights for + indoor shots). +
+
int use_fuji_rotate;
+
+ dcraw keys: -j
+ Default -1 (use), 0 - don't use rotation for cameras on a Fuji sensor. +
+
int green_matching;
+
+ Turns on fixing of green channels disbalance. + dcraw keys: none
+ Default: 0 (not use), 1 - turns on this postprocessing stage. green_matching requires additional memory for + image data. +
+
int dcb_iterations
+
+ dcraw keys: none
+ Number of DCB correction passes. Default is -1 (no correction). Useful only for DCB interpolation. +
+
int dcb_enhance_fl
+
+ dcraw keys: none
+ nonzero: DCB interpolation with enhance interpolated colors. +
+
int fbdd_noiserd
+
+ dcraw keys: none
+ Controls FBDD noise reduction before demosaic. +
    +
  • 0 - do not use FBDD noise reduction
  • +
  • 1 - light FBDD reduction
  • +
  • 2 (and more) - full FBDD reduction
  • +
+
+
int eeci_refine
+
+ dcraw keys: none
+ nonzero- Use EECI refine for VCD interpolation. +
+
int es_med_passes
+
+ dcraw keys: none
+ Number of edge-sensitive median filter passes after VCD+AHD demosaic. + Value above 1 is highly not recommended. +
+
int ca_correc
+
+ dcraw keys:none
+ positive value turns on chromatic aberrations suppression (default:0 i.e. off). +
+
float cared,cablue
+
+ dcraw keys: none
+ If one of these fields is non-zero, then these values will be used instead of automatic ones. + Useable range is +-0.1..+-4.0. +
+
int cfaline; float linenoise;
+
Line noise (banding) reduction. +
+ positive value turns this feature on (default: off). +
+ linenoise - amount of reduction. Useful range is 0.001 to 0.02. Default value is 0.0 i.e. not clean anything. +
+
int cfa_clean; float lclean,cclean;
+
+ Reduce impulse noise and Gaussian high frequency. +
+ cfa_clean: positive value turns the feature on (default: off). +
+ lclean,cclean - amount of noise reduction for (L)uminance and (C)olor. Useable range from 0.005 to 0.05, + common value 0.01 +
+
int cfa_green; float green_thresh;
+
+ Reduces maze artifacts produced by bad balance of green channels. +
+ cfa_green: positive value turns the feature on (default: off). +
+ green_thresh - max difference between channels allowed for equalization. Useful range between 0.01 and 0.1. +
+
int exp_correc; float exp_shift,exp_preser;
+
+ Exposure correction before demosaic. +
+
    +
  • exp_correc: positive value turns the feature on (default: off).
  • +
  • exp_shift: exposure shift in linear scale. Usable range from 0.25 (2-stop darken) to + 8.0 (3-stop lighter). Default: 1.0 (no exposure shift).
  • +
  • exp_preser: preserve highlights when lighten the image. Usable range from 0.0 (no preservation) to 1.0 + (full preservation). 0.0 is the default value. +
+ +
int wf_debanding; float wf_deband_treshold[4];
+
+ wf_debanding: 1 turns on banding suppression (slow!), 0 turns it off. +

+ wf_deband_treshold[] - per channel debanding thresholds. +

+
int use_rawspeed;
+
+ Turns on using RawSpeed library for data unpacking (only if RawSpeed support compiled in). +
+
int no_auto_scale;
+
+ Disables pixel values scaling (call to LibRaw::scale_colors()) in LibRaw::dcraw_process() +
+
int no_interpolation;
+
+ Disables call to demosaic code in LibRaw::dcraw_process() +
+
int sraw_ycc;
+
+ Disables YCbCr to RGB conversion for Canon sRAW/mRAW files. +
+
int force_foveon_x3f
+
+ Turns on LibRaw standard Foveon files processing based on X3F Tools even if LibRaw compiled with + Demosaic-Pack-GPL2 (with dcraw-based foveon code). +
+
int x3f_flags
+
+ Sigma Quattro decoding flags: +
    +
  • LIBRAW_DP2QOPT_NONE - just unpack the data; +
  • LIBRAW_DP2Q_INTERPOLATERG - turn on R/G channels interpolation +
  • LIBRAW_DP2Q_INTERPOLATEAF - turn on data interpolation of low-sensitivity (AF or overexposure control) points on + Quattro sensors. +
+
+
int sony_arw2_options
+
+ Sony ARW2.3 processing options: + (for more details see http://www.rawdigger.com/howtouse/sony-craw-arw2-posterization-detection) +
    +
  • LIBRAW_SONYARW2_NONE - normal decoding; +
  • LIBRAW_SONYARW2_BASEONLY - decode only base pixels, leave delta pixels as zero; +
  • LIBRAW_SONYARW2_DELTAONLY - decode only delta pixels with base pixels zeroed; +
  • LIBRAW_SONYARW2_DELTAZEROBASE - decode delta pixels, do not add base value; +
  • LIBRAW_SONYARW2_DELTATOVALUE - show possible posterization areas; +
+
+
int sony_arw2_posterization_thr
+
+ If LIBRAW_SONYARW2_DELTATOVALUE used for arw2_options, sets the level to suppress posterization display in shadows. +
+
float coolscan_nef_gamma;
+
+ Gamma value for Coolscan NEF decoding (no way to get if from file, it should be set by calling application). +
+
+ + +

Structure libraw_decoder_info_t: RAW decoder name and data format

+

+ This structure describes RAW format decoder name and data format: +

+
+
const char *decoder_name
+
Decoder function name
+
unsigned decoder_flags
+
Decoder data format. See list of LibRaw_decoder_flags for details. +
+
+ + +

Stucture libraw_processed_image_t - result set for dcraw_make_mem_image()/dcraw_make_mem_thumb() functions

+

Structure libraw_processed_image_t is produced by call of dcraw_make_mem_image()/dcraw_make_mem_thumb() and contains + in-memory image of interpolated data or thumbnail.
+ Data fields: +

+
+
LibRaw_image_formats type
+
This field records type of data, containing in remaining fields of structure. +
    +
  • LIBRAW_IMAGE_BITMAP - structure contains RGB bitmap. All metadata fields (see below) are valid + and describes image data. +
  • LIBRAW_IMAGE_JPEG - structure contain in-memory image of JPEG file. Only type, data_size and + data fields are valid (and nonzero); +
+
+
ushort height,width
+
Image size (in pixels). Valid only if type==LIBRAW_IMAGE_BITMAP.
+
ushort colors, bits
+
Number of colors components (1 or 3) and color depth in bits (8 or 16). These fields are valid only if + type==LIBRAW_IMAGE_BITMAP. +
+
ushort gamma_corrected
+
Is bitmap data gamma-corrected (always 1 for 8-bit data, may be 0 or 1 for 16-bit). + Valid only if type==LIBRAW_IMAGE_BITMAP.
+
unsigned int data_size
+
Size of data field (in bytes). For bitmap image equal to (height*width*colors * (bits/8)). + For JPEG image - exact JPEG size (i.e. extracted thnumbnail size + JPEG header + EXIF header). +
+
unsigned char data[]
+
Data array itself. Should be interpreted as RGB triplets for bitmap type and as JPEG file for JPEG type. +
+
+ + +

Input abstraction layer

+

+ RAW data input (read) in LibRaw implemented by calling methods of object derived from + LibRaw_abstract_datastream abstract class. Full list of methods is described in + href="API-CXX.html#datastream">C++ API reference. +

+

+ There is two ready to use implementations of datastream objects: +

+ +

+ LibRaw user can create own datastream object derived from + LibRaw_abstract_datastream. For example, such object may + implement reading RAW data directly from camera (by remote interface). LibRaw can use these + objects via + LibRaw::open_datastream() interface. +

+

+ Datastreams can be used either via + LibRaw::open_datastream() call (in this case datastream + object should be created an maintained by user) or via + LibRaw::open_file() and + LibRaw::open_buffer() shortcuts. +

+

+ Only C++ API users may use object-oriented interface and + implement own input interfaces. For C API users only + built-on libraw_open_file()/libraw_open_buffer() shortcuts are avaliable. +

+ +

Data fields

+

Definition:

+
+class LibRaw_abstract_datastream {
+...
+protected:
+    LibRaw_abstract_datastream *substream;
+}
+
+

Description: + Ojects derived from LibRaw_abstract_datastream always contains pointer to secondary data stream + (substream). This substream initialized internally when needed (really used only for Sony RAW data) and + used for temporary switch input stream to temporary memory buffer allocated internally in LibRaw. +

+

+ Substream usage details described more precisely in + own datastream objects creation guide. +

+ + +

Constants

+ +

enum LibRaw_errors: Error Codes

+

All functions returning integer numbers must return either errno or one of the following error codes (see also error code conventions).

+

Fatal errors (return of such an error code implies that file processing has to be terminated, since +the state of data structures is unknown).

+
+
LIBRAW_UNSUFFICIENT_MEMORY
+
Attempt to get memory from the system has failed.
+ All allocated resources will be freed, recycle() will be called, and the LibRaw +object will be brought to the state "right after creation." +
+
LIBRAW_DATA_ERROR
+
A fatal error emerged during data unpacking.
+ All allocated resources will be freed, recycle() will be called, and the LibRaw +object will be brought to the state "right after creation." +
+
LIBRAW_IO_ERROR
+
A fatal error emerged during file reading (premature end-of-file encountered or file is corrupt).
+ All allocated resources will be freed, recycle() will be called, and the LibRaw +object will be brought to the state "right after creation." +
+
LIBRAW_CANCELLED_BY_CALLBACK
+
Processing cancelled due to calling application demand (by returning nonzero code from + progress callback).
+ All allocated resources will be freed, recycle() will be called, and + the LibRaw object will be brought to the state "right after creation." +
+
LIBRAW_BAD_CROP
+
The incorrect cropping coordinates are set via params.cropbox[]: the left-top corner of cropping + rectangle is outside the image. + The processing will be cancelled, all allocated resources will be freed, recycle() will be called, and the LibRaw object will be brought to the + state "right after creation." +
+

Non-Fatal Errors

+
+
LIBRAW_SUCCESS=0
+
No error; function terminated successfully.
+
LIBRAW_UNSPECIFIED_ERROR
+
An unknown error has been encountered. This code should never be generated.
+
LIBRAW_FILE_UNSUPPORTED
+
Unsupported file format (attempt to open a RAW file with a format unknown to the program).
+
LIBRAW_REQUEST_FOR_NONEXISTENT_IMAGE
+
Attempt to retrieve a RAW image with a number absent in the data file (only for formats supporting storage + of several images in a file).
+
LIBRAW_OUT_OF_ORDER_CALL
+
API functions have been called in wrong order (e.g., unpack() before + open_file()) or the previous stage has ended with an error (e.g., + unpack() is called after open_file() has returned an error). +
+
LIBRAW_NO_THUMBNAIL
+
Returned upon an attempt to retrieve a thumbnail from a file containing no preview.
+
LIBRAW_UNSUPPORTED_THUMBNAIL
+
RAW file contains a preview of unsupported format.
+
+ + +

enum LibRaw_decoder_flags - RAW data format description

+

+ Depending of capabilities of given data format, the buffer with RAW data may have different layouts: +

+
+
LIBRAW_DECODER_HASCURVE
+
This flag is set if decoder uses RAW tone curve and curve data may be modified before call + to decoder (i.e. curve values are not read or calculated within decoder). +
+
LIBRAW_DECODER_SONYARW2
+
This flag is set if file format is Sony ARW2.3, so sony_arw2_options is applicable. +
+
LIBRAW_DECODER_TRYRAWSPEED
+
This flag is set if file format is (possibly) supported by RawSpeed library, so unpack() will try to use it. +
+
LIBRAW_DECODER_FIXEDMAXC
+
Do not use automated maximum calculation for this data format. +
+
+ + +

enum LibRaw_progress: Current State of LibRaw Object

+

LibRaw::imgdata.progress_flags contains a bit mask describing all stages of file processing that have already been performed. +

+

File opening and RAW data extraction phase.

+
+
LIBRAW_PROGRESS_START=0
+
+ Object just created, no processing carried out. +
+
LIBRAW_PROGRESS_OPEN
+
+ File to be processed has been opened. +
+
LIBRAW_PROGRESS_IDENTIFY
+
+ Data identification performed, format recognized, metadata extracted. +
+
LIBRAW_PROGRESS_SIZE_ADJUST
+
+ Data sizes adjusted (for files that require such adjustment, namely, certain files from Kodak cameras). +
+
LIBRAW_PROGRESS_LOAD_RAW
+
+ RAW data loaded. +
+
+

The following flags are set during usage of image processing that has been taken from dcraw.

+
+
LIBRAW_PROGRESS_RAW2_IMAGE
+
+ imgdata.image array allocated and filled with data. +
+ +
LIBRAW_PROGRESS_REMOVE_ZEROES
+
+ Zero values removed for cameras that require such removal (Panasonic cameras). +
+
LIBRAW_PROGRESS_BAD_PIXELS
+
+ Bad (dead) pixels removed. +
+
LIBRAW_PROGRESS_DARK_FRAME
+
+ Dark frame subtracted from RAW data. +
+
LIBRAW_PROGRESS_FOVEON_INTERPOLATE
+
+ Interpolation for cameras with a Foveon sensor performed. +
+
LIBRAW_PROGRESS_SCALE_COLORS
+
+ White balance performed. +
+
LIBRAW_PROGRESS_PRE_INTERPOLATE
+
+ Image size reduction (for the half_size mode) performed, as well as copying of 2nd green channel to the 1st one in points + where the second channel is present and the first one is absent. +
+
LIBRAW_PROGRESS_INTERPOLATE
+
+ Interpolation (debayer) performed. +
+
LIBRAW_PROGRESS_MIX_GREEN
+
+ Averaging of green channels performed. +
+
LIBRAW_PROGRESS_MEDIAN_FILTER
+
+ Median filtration performed. +
+
LIBRAW_PROGRESS_HIGHLIGHTS
+
+ Work with highlights performed. +
+
LIBRAW_PROGRESS_FUJI_ROTATE
+
+ For images from Fuji cameras, rotation performed (or adjust_sizes_info_only() called). +
+
LIBRAW_PROGRESS_FLIP
+
+ Dimensions recalculated for images shot with a rotated camera (sizes.iwidth/sizes.iheight swapped). +
+
LIBRAW_PROGRESS_CONVERT_RGB
+
+ Conversion into output RGB space performed. +
+
LIBRAW_PROGRESS_STRETCH
+
+ Image dimensions changed for cameras with non-square pixels. +
+
LIBRAW_PROGRESS_STAGE17 - LIBRAW_PROGRESS_STAGE27
+
+ Reserved for possible appearance of other processing stages. +
+
+

The following flags are set during loading of thumbnails.

+
LIBRAW_PROGRESS_THUMB_LOAD
+
+ Thumbnail data have been loaded (for Kodak cameras, the necessary conversions have also been made). +
+
LIBRAW_PROGRESS_TRESERVED1 - LIBRAW_PROGRESS_TRESERVED3
+
+ Reserved for possible future processing stages. +
+ + + +

enum LibRaw_thumbnail_formats: Thumbnail Data Formats

+

Thumbnail data format is written in the imgdata.thumbnail.tformat data field.
+ Presently LibRaw knows about four thumbnail formats, among which two are unpacked: +

+
+
LIBRAW_THUMBNAIL_UNKNOWN
+
Format unknown or thumbnail not yet read. +
+
LIBRAW_THUMBNAIL_JPEG
+
The thumbnail buffer contains a JPEG file (read from the RAW file "as is," without any manipulations performed on it). +
+
LIBRAW_THUMBNAIL_BITMAP
+
+ The thumbnail buffer contains the gamma-adjusted RGB bitmap (for Kodak cameras, the gamma correction is performed with allowance + for maximum values and the white balance is set in accordance with the camera settings).
+ In this format, each pixel of the image is represented by a 8-bit RGB triplet. +
+
LIBRAW_THUMBNAIL_LAYER
+
+ Data format is presently recognized upon opening of RAW file but not supported: not unpacked into LibRaw::unpack_thumb. +
+
LIBRAW_THUMBNAIL_ROLLEI
+
+ Data format is presently recognized upon opening of RAW file but not supported: not unpacked into LibRaw::unpack_thumb. +
+
+ +

Nonstandard Situations (Warnings) during RAW Data Processing

+

Some suspicious situations emerging during image processing are not fatal but may affect the result of data +retrieval or postprocessing. Such states are indicated by setting a bit in the imgdata.process_warnings field.

+
+
LIBRAW_WARN_FOVEON_NOMATRIX
+
+ Only for cameras with Foveon: extraction of one of data matrices has failed. +
+
LIBRAW_WARN_FOVEON_INVALIDWB
+
+ Only for cameras with Foveon: extraction of white balance data has failed. +
+
LIBRAW_WARN_BAD_CAMERA_WB
+
+ Postprocessing must use white balance of the camera but this balance is not suitable for use. +
+
LIBRAW_WARN_NO_METADATA
+
+ Only for cameras where the metadata are taken from an external JPEG file: metadata extraction has failed. +
+
LIBRAW_WARN_NO_JPEGLIB
+
+ Only for P&S Kodak cameras: data in JPEG format. At the same time, open_file() will return LIBRAW_FILE_UNSUPPORTED. +
+
LIBRAW_WARN_NO_EMBEDDED_PROFILE
+
+ (only if LCMS support compiled in). + Caller set embedded input profile use, but no such profile exists in RAW. +
+
LIBRAW_WARN_NO_INPUT_PROFILE
+
+ (only if LCMS support compiled in). + Error when opening input profile ICC file. +
+
LIBRAW_WARN_BAD_OUTPUT_PROFILE
+
+ (only if LCMS support compiled in). + Error when opening output profile ICC file. +
+
LIBRAW_WARN_NO_BADPIXELMAP
+
+ Error when opening bad pixels map file. +
+
LIBRAW_WARN_BAD_DARKFRAME_FILE
+
+ Error when opening dark frame file. +
+
LIBRAW_WARN_BAD_DARKFRAME_DIM
+
+ Dark frame file either differs in dimensions from RAW-file processed, or have wrong format. + Dark frame should be in 16-bit PGM format (one can generate it using simple_dcraw -4 -D). +
+
LIBRAW_WARN_RAWSPEED_PROBLEM
+
+ Problems detected in RawSpeed decompressor. The image data processed by LibRaw own decoder. +
+
LIBRAW_WARN_RAWSPEED_UNSUPPORTED
+
+ This file not supported by RawSpeed (although compatible decoder exists). +
+
LIBRAW_WARN_RAWSPEED_PROCESSED
+
+ Not warning, but information. The file was decoded by RawSpeed. +
+
LIBRAW_WARN_FALLBACK_TO_AHD
+
+ Incorrect/unsupported user_qual was set, AHD demosaic used instead. +
+
+ + +

enum LibRaw_image_formats - possible types of data, contains in libraw_processed_image_t structure

+

type field of libraw_processed_image_t structure may have one of these values: +

+
+
LIBRAW_IMAGE_BITMAP
+
+ The structure contains RGB-bitmap, metadata described in other fields of libraw_processed_image_t. +
+
LIBRAW_IMAGE_JPEG
+
+ libraw_processed_image_t structure contains JPEG image (in memory). Only data_size field is meaningful. +
+
+ + [back to Index] + + diff -Nru libraw-0.16.2/doc/API-datastruct-rus.html libraw-0.17.0/doc/API-datastruct-rus.html --- libraw-0.16.2/doc/API-datastruct-rus.html 2015-05-16 12:32:15.000000000 +0000 +++ libraw-0.17.0/doc/API-datastruct-rus.html 1970-01-01 00:00:00.000000000 +0000 @@ -1,1150 +0,0 @@ - - - - LibRaw: структуры данных и константы - - - - - [вернуться к оглавлению] -

LibRaw: структуры данных и константы

-

- Структуры данных LibRaw определены в заголовочном файле libraw/libraw_types.h
- Используемые константы определены в файле libraw/libraw_const.h -

-

Содержание:

-
    -
  1. Структуры данных -
      -
    1. libraw_data_t - основная структура данных LibRaw
    2. -
    3. Структура libraw_iparams_t - основные параметры изображения
    4. -
    5. Структура libraw_image_sizes_t - размеры изображения
    6. -
    7. Структура libraw_colordata_t - информация о цвете
    8. -
    9. Структура libraw_imgother_t - прочие параметры изображения
    10. -
    11. Структура libraw_rawdata_t - хранение распакованых RAW-данных
    12. -
    13. Структура libraw_thumbnail_t - описание Thumbnail
    14. -
    15. Структура libraw_output_params_t - управление постобработкой в стиле - dcraw
    16. -
    17. Структура libraw_decoder_info_t - информация о декодере RAW-изображения
    18. -
    19. Структура libraw_processed_image_t - данные, выводимые функциями - dcraw_make_mem_image()/dcraw_make_mem_thumb()
    20. -
    -
  2. -
  3. Объекты абстракции ввода данных - -
  4. -
  5. Константы -
      -
    1. enum LibRaw_errors - коды ошибок
    2. -
    3. Нештатные ситуации (warnings) возникающие при обработке RAW-данных
    4. -
    5. enum LibRaw_decoder_flags - описание layout данных конкретного распаковщика форматов
    6. -
    7. enum LibRaw_progress - текущее состояние объекта LibRaw
    8. -
    9. enum LibRaw_thumbnail_formats - форматы данных Thumbnails
    10. -
    11. enum LibRaw_image_formats - описание типов данных, содержащихся в - структуре libraw_processed_image_t
    12. -
    -
  6. -
- - -

Структуры данных

- -

libraw_data_t - основная структура данных LibRaw

-

- Структура libraw_data_t - это "обертка" для структур данных, доступных пользователю библиотеки.
- При использовании C++ API она доступна как LibRaw::imgdata (экземпляр_класса.imgdata). Данные в этой структуре - появляются после открытия файла через open_file, за исключением собственно изображения (заполняется по unpack()) - и данных содержащих preview-данные (заполняются по вызову unpack_thumb())
- Поля данных: -

-
-
unsigned int progress_flags;
-
- В этом поле фиксируются проведенные фазы обработки изображения. -
-
unsigned int progress_flags;
-
- В этом поле фиксируются подозрительные ситуации (warnings), возникшие при обработке изображения. -
-
libraw_iparams_t idata;
-
- В этой структуре описаны извлеченные из RAW-файла основные параметры изображения. - Детально поля структуры описаны ниже. -
-
libraw_image_sizes_t sizes;
-
- В этой структуре описаны геометрические параметры изображения. - Детально поля структуры описаны ниже. -
-
libraw_colordata_t color;
-
- В этой структуре находятся извлеченные из файла цветовые данные. - Детально поля структуры описаны ниже. -
-
libraw_imgother_t other;
-
- Информационная структура данных, в нее помещаются извлеченные из файла параметры изображения, которые не нужны - при дальнейшей обработке файла. - Детально поля структуры описаны ниже. -
-
libraw_thumbnail_t thumbnail;
-
- Структура данных, содержащая информацию о preview и сами данные preview. - Все поля структуры кроме собственно данных preview заполняются в - open_file() или других вызовах открытия потока - (open_buffer(),open_datastream()), само изображение-preview считывается отдельным вызовом - unpack_thumb(). - Детально поля структуры описаны ниже. -
-
libraw_rawdata_t rawdata;
-
- Структура данных, содержащая аллоцированный буфер для RAW-данных и копии параметров, которые могут меняться - при обработке. - Детально поля структуры описаны ниже. -
-
ushort (*image)[4];
-
- Регион памяти, содержащий собственно пиксели изображения, заполняется при вызове raw2image(); или - dcraw_process(). -
-
libraw_output_params_t params;
-
- Структура данных, предназначенная для управления пост-обработкой изображения (при использовании эмулятора - dcraw). - Детально поля структуры описаны ниже. -
-
- -

Структура libraw_iparams_t - основные параметры изображения

-

- -

-
-
char make[64];
-
- Изготовитель камеры. -
-
char model[64];
-
- Модель камеры. -
-
unsigned raw_count;
-
- Количество RAW-изображений в файле (0 - означает что файл не распознан). -
-
unsigned dng_version;
-
- Версия DNG (для DNG-формата). -
-
unsigned is_foveon;
-
- 1 для матриц Foveon, 0 - для остальных. -
- Матрицы Foveon поддерживаются в LibRaw-demosaic-pack-GPL2 -
-
int colors;
-
- Количество цветов в файле. -
-
unsigned filters;
-
- Битовая маска, описывающая порядок цветовых пикселей в матрице (0 - для полноцветных RAW). 32 бита поля описывают 16 - пикселов (8 строк по 2 пиксела, слева направа и сверху вниз), каждые два бита имеют значения от 0 до 3, - соответствующие 4-м возможным цветам. Для удобной работы с этим полем предназначена функция COLOR(row,column) - возвращающая номер активного цвета для данного пиксела. -

- Специальные значения данного поля: -

    -
  • 1 - Leaf Catchlight с байеровской матрицей 16x16 -
  • 9 - Fuji X-Trans с матрицей 6x6 -
-
-
char xtrans[6][6];
-
- Эта матрица содержит мэппинг цветов в блоке 6x6 сенсора Fuji X-Trans. -
-
char cdesc[5];
-
- Описание цветов с номерами 0-3 (RGBG,RGBE,GMCY или GBTG). -
-
- -

Структура libraw_image_sizes_t - размеры изображения

-

В структуру libraw_image_sizes_t собраны все данные из файла, описывающие размеры изображения.
- Поля данных: -

-
-
ushort raw_height, raw_width;
-
- Полный размер RAW-изображения (включая рамку) в пикселах. -
-
unsigned raw_pitch;
-
- Полный размер строки raw-данных в байтах. Он может быть больше, чем raw_width*размер пикселя. -
-
ushort height, width;
-
- Размер видимой (содержательной) части изображения (без рамки). -
-
ushort top_margin, left_margin;
-
- Координаты верхнего левого угла рамки (второй угол рассчитывается исходя из полного размера изображения и - размера видимой части). -
-
ushort iheight, iwidth;
-
- Размер выходного изображения (может отличаться от height/width для камер, где требуется поворот изображения, - либо где пиксели неквадратные). -
-
double pixel_aspect;
-
- Отношение ширины пикселя к высоте. Если оно отличается от единицы, то при выводе требуется масштабирование - изображения по одной из осей. -
-
int flip;
-
- Ориентация изображения (0 - не требует поворота, 3 - требуется поворот на 180, 5 - 90 градусов против часовой - стрелки, 6 - 90 градусов по часовой). -
-
- -

Структура libraw_colordata_t - информация о цвете

-

В структуру libraw_colordata_t собраны все цветовые данные, как полученные из RAW-файла, так и рассчитанные на - основании самого изображения. Для разных камер работают разные способы работы с цветом.
- Поля данных: -

-
-
ushort white[8][8];
-
- Блок белых пикселей, извлекаемый из файлов CIFF/CRW. Для других форматов не извлекается, используется для - расчетов коэффициентов баланса белого. -
-
float cam_mul[4];
-
- Коэффициенты баланса белого (as shot). Либо считывается из файла, либо рассчитывается. -
-
float pre_mul[4];
-
- Коэффициенты баланса белого для дневного света (Daylight balance). Либо считывается из файла, либо - рассчитывается из данных файла, либо берутся hardcoded-константы. -
-
float cam_xyz[4][3];
-
- Матрица преобразования из камерного RGB в XYZ. Константная таблица, разная для разных камер, - полный аналог ColorMatrix формата DNG. Последняя строка для RGB-камер как правило нулевая, - для CMYG и подобных - не нулевая. -
-
float cmatrix[3][4];
-
- Матрица баланса белого, для части камер считывается из файла, из остальных рассчитывается. -
-
float rgb_cam[3][4];
-
- Еще одна матрица баланса белого, считывается из файла для камер Leaf и Kodak. -
-
ushort curve[0x4001];
-
- Camera tone curve, считывается для камер Nikon, Sony и некоторых других. -
-
unsigned black;
-
- Уровень черного. Для некоторых камер будет равен нулю (что означает, что вычитание черного проведено на этапе - распаковки или самой камерой), для некоторых камер рассчитывается на этапе распаковки, для некоторых - - считывается из RAW-файла, для некоторых - hardcoded. -
-
unsigned cblack[4];
-
- Поканальные поправки уровня черного. Уровень черного в i-м канале равен black+cblack[i]; -
-
unsigned maximum;
-
- Максимальное значение пикселя. Для ряда камер рассчитывается из данных, для ряда - hardcoded. Значение - maximum может меняться на стадии постпроцессинга (после вычитания черного) и автоустановкой максимума - на основании поканальных максимумов в реальных данных (регулируется параметром params.adjust_maximum_thr). -
-
unsigned data_maximum;
-
- Максимальное значение пикселей в видимой области файла. Рассчитывается - при вызове subtract_black(). -
- -
ph1_t phase_one_data;
-
- Блок цветовых данных, считываемый для камер Phase One. -
-
float flash_used;
-
float canon_ev;
-
- Поля используются для расчета баланса белого (для некоторых P&S камер Canon). -
-
char model2[64];
-
- Для некоторых камер - версия Firmware. -
- -
void *profile;
-
- Указатель на извлеченный ICC-профиль (если он есть в RAW-файле). -
-
unsigned profile_length;
-
- Длина ICC-профиля в байтах. -
-
- -

Структура libraw_imgother_t - прочие параметры изображения

-

- В структуру libraw_imgother_t собраны данные, считанные из RAW-файла и не нужные для пост-обработки - изображения.
- Поля данных: -

-
-
float iso_speed;
-
- Чувствительность ISO. -
-
float shutter;
-
- Выдержка. -
-
float aperture;
-
- Диафрагма. -
-
float focal_len;
-
- Фокусное расстояние. -
-
time_t timestamp;
-
- Дата съемки. -
-
unsigned shot_order;
-
- Серийный номер изображения. -
-
unsigned gpsdata[32];
-
- GPS-данные. -
-
char desc[512];
-
- Описание изображения. -
-
char artist[64];
-
- Автор изображения. -
-
- -

Структура libraw_rawdata_t - хранение распакованых RAW-данных

-

- В структуре libraw_rawdata_t хранятся следующие данные: -

-
    -
  • RAW-данные с сенсора, получаемые на этапе чтения и распаковки данных камеры - вызовом unpack(). -
  • -
  • Резервная копия данных о размерах, цветах и ряде других параметров, которые могут модифицироваться - на этапе постобработки данных. -
-

- Поля данных: -

-
-
void *raw_alloc;
-
Буфер, аллоцированный для хранения RAW-данных.
-
unsigned short *raw_image;
-
Указатель на буфер для хранения 1-компонентных (байеровских) данных.
-
unsigned short (*color3_image)[3] ;
-
Указатель на буфер для хранение 3-компонентных (полноцветных) raw-данных.
-
unsigned short (*color4_image)[4] ;
-
Указатель на буфер для хранение 4-компонентных (полноцветных) raw-данных.
-
- Все прочие поля являются служебными и не предназначены для использования в пользовательских программах. -

- После вызова unpack() только одно из полей raw_image/color3_image/color4_image - будет ненулевым. - - -

Структура libraw_thumbnail_t - описание Thumbnail

-

Структура libraw_thumbnail_t описывает все параметры, связанные с сохраненным в RAW-файле preview.
- Поля данных: -

-
-
LibRaw_thumbnail_formats tformat;
-
- Формат данных thumbnail. Одно из значений enum LibRaw_thumbnail_formats. -
-
ushort twidth, theight;
-
- Размер preview-изображения в пикселах. -
-
unsigned tlength;
-
- Длина thumbnail в байтах. -
-
int tcolors;
-
- Количество цветов preview. -
-
char *thumb;
-
- Указатель на thumbmail, извлеченный из файла данных. -
-
- - -

Структура libraw_output_params_t - управление постобработкой в стиле dcraw

-

Структура libraw_output_params_t используется для управления dcraw-совместимыми вызовами dcraw_process(), - dcraw_ppm_tiff_writer(), dcraw_thumb_writer(). Поля этой структуры - соответствуют ключам командной строки программы dcraw.
- Поля данных: -

-
-
unsigned greybox[4];
-
- Ключи dcraw: -A x1 y1 width height
- 4 числа, отвечающие координатам (в пикселах) прямоугольника по которому рассчитывается баланс белого: - верхний левый угол, ширина и высота. Координаты задаются для неповернутого изображения. -
-
unsigned cropbox[4];
-
- Ключи dcraw:нет
- 4 числа, отвечающие координатам (в пикселах) прямоугольника, до которого будет обрезано результирующее - изображение: верхний левый угол, ширина и высота. Координаты задаются для неповернутого изображения. - Результат обрезания затем может быть повернут в соответствии со значениями flip и user_flip. -
-
double aber[4];
-
- Ключи dcraw: -C
- Исправление хроматических аббераций, задаются только
- aber[0] - множитель красного
- aber[2] - множитель зеленого. - Для ряда форматов влияет на чтение RAW-данных т.к. при коррекции аберраций - выходной размер меняется. -
-
double gamm[6];
-
- Ключи dcraw: -g
- Задание пользовательской гамма-кривой. Должны быть установлены первые два поля в массиве:
- gamm[0] - инвертированный (1.0/g) показатель степени
- gamm[1] - наклон для начальной линейной части. Для получения чистой степенной функции должно быть установлено - в 0. -
- Остальные 4 значения в этом поле заполняются автоматически. -

- По-умолчанию используются настройки спецификации BT.709: степень 2.222, наклон 4.5. Для задания sRGB-кривой - нужно ставить значения gamm[0]=1/2.4 и gamm[1]=12.92. Для простой степенной функции без линейного участка - наклон линейной части задается нулевым, для линейной кривой нужно устанавливать gamm[0]=gamm[1]=1. -

- -
float user_mul[4];
-
- Ключи dcraw: -r mul0 mul1 mul2 mul3
- 4 множителя (r,g,b,g) пользовательского баланса белого -
-
unsigned shot_select;
-
- Ключи dcraw: -s
- выбор номера изображения для обработки (для форматов, содержащих несколько RAW-изображений в одном файле) -
-
float bright;
-
- Ключи dcraw: -b
- Яркость (умолчание 1.0) -
-
float threshold;
-
- Ключи dcraw: -n
- Параметр для подавления шума через wavelet denoising. -
-
int half_size;
-
- Ключи dcraw: -h
- Выводить изображение в половинном размере. Для ряда форматов влияет на чтение - RAW-данных. -
-
int four_color_rgb;
-
- Ключи dcraw: -f
- Включает отдельную интерполяцию для двух зеленых компонент. -
-
int highlight;
-
- Ключи dcraw: -H
- 0-9 - Highlight mode (0=clip, 1=unclip, 2=blend, 3+=rebuild) -
-
int use_auto_wb;
-
- Ключи dcraw: -a
- Использовать автобаланс белого, полученный после усреднения всего изображения. -
-
int use_camera_wb;
-
- Ключи dcraw: -w
- Использовать баланс белого полученный из камеры, если это возможно. -
-
int use_camera_matrix;
-
- Ключи dcraw: +M/-M
- Использовать (1)/не использовать(0) camera color matrix. -
-
int output_color;
-
- Ключи dcraw: -o число
- [0-5] Output colorspace (raw,sRGB,Adobe,Wide,ProPhoto,XYZ) -
-
char* output_profile;
-
- Ключи dcraw: -o имя файла
- Путь к ICC-файлу выходного профиля (используется только если библиотека собрана с поддержкой LCMS) -
-
char* camera_profile;
-
- Ключи dcraw: -p имя файла
- Путь к ICC-файлу профиля камеры (используется только если библиотека собрана с поддержкой LCMS) -
-
char* bad_pixels;
-
- Ключи dcraw: -P имя файла
- Путь к файлу с картой плохих пикселов (в формате "столбец строка дата-появления в unix-формате", по одной - записи на строку). -
-
char* dark_frame;
-
- Ключи dcraw: -K имя файла
- Путь к файлу с темновым кадром (16-битный PGM-файл, полученный, например, запуском dcraw -D). -
-
int output_bps;
-
- Ключи dcraw: -4
- 8 bit (default)/ 16 bit (ключ -4) -
-
int output_tiff;
-
- Ключи dcraw: -T
- 0/1 - выводить PPM/TIFF -
-
int user_flip;
-
- Ключи dcraw: -t
- [0-7] Flip image (0=none, 3=180, 5=90CCW, 6=90CW) - Умолчание -1, означает брать из RAW.
- Для ряда форматов влияет на чтение RAW-данных, в частности на распаковку - thumbnails от камер Kodak. -
-
int user_qual;
-
- Ключи dcraw: -q
- 0-10: качество и вид интерполяции (дебайеризации): -
    -
  • 0 - линейная интерполяция
  • -
  • 1 - VNG-интерполяция
  • -
  • 2 - PPG-интерполяция
  • -
  • 3 - AHD-интерполяция
  • -
  • 4 - DCB-интерполяция
  • -
  • 5 - Модифицированная AHD-интерполяция
  • -
  • 6 - AFD-интерполяция (5-проходов)
  • -
  • 7 - VCD-интерполяция
  • -
  • 8 - Смешанная VCD/измененная AHD
  • -
  • 9 - LMMSE-интерполяция
  • -
  • 10 - AMaZE-интерполяция
  • -
  • 11 - DHT-интерполяция
  • -
  • 12 - Еще одна модицифицированная AHD
  • -
- Значения 5-9 имеют смысл только если LibRaw скомпилирована с "LibRaw demosaic pack GPL2" - (файл README.demosaic-packs в вашем дистрибутиве LibRaw описывает это в подробностях). - Значение 10 (AMaZe-интерполяция) имеет смысл только если LibRaw скомпилирована с - "LibRaw demosaic pack GPL3".
- Если задан неподдерживаемый LibRaw вариант (например, demosaic pack не вкомпилирован), - будет выполнена AHD-интерполяция. -
-
int user_black;
-
- Ключи dcraw: -k
- Пользовательский уровень черного. -
-
int user_cblack;
-
- Ключи dcraw: нет
- Пользовательские поканальные поправки к уровню черного. -
-
int sony_arw2_hack;
-
- Ключи dcraw: нет
- Выключает деление данных, полученных из файлов Sony ARW (вторая версия: современные камеры - NEX и SLT) на 4, увеличивая количество значащих битов в теневой части изображения. -
-
int user_sat;
-
- Ключи dcraw: -S
- Регулировка насыщенности. -
-
int med_passes;
-
- Ключи dcraw: -m
- Количество проходов median filter -
-
int no_auto_bright;
-
- Ключи dcraw: -W
- Не использовать автоматическое повышение яркости по гистограмме. -
-
float auto_bright_thr;
-
- Ключи dcraw:нет
- Доля пикселов, которые будут насыщены при использовании автоматического повышения яркости. Значение - по-умолчанию 0.01 (для совместимости с dcraw), рекомендованное стартовое значение для современных - многомегапиксельных малошумных камер 0.001-0.00003. -
- -
float adjust_maximum_thr;
-
- Ключи dcraw:нет
- Этот параметр управляет авто-установкой значения maximum, используемого на стадии постпроцессинга. - Если поканальный максимум (data_maximum) больше чем maximum*adjust_maximum_thr, то поле - maximum будет установлено в значение, рассчитанное по данным конкретного снимка. -
Стандартное значение поля: 0.75. Если вы установите его больше чем 0.99999, то будет использовано - стандартное значение. Если вы установите adjust_maximum_thr меньше чем 0.00001, то корректировка - максимума будет выключена. -
- Автокорректировка максимума не должна повреждать снимки (особенно если используется стандартное значение), - но очень полезна при обработке снимков с выбитыми (пересвеченными) участками и позволяет автоматически - бороться с "розовыми облаками" (для дневного света) и с "сине-зелеными светами" (для освещения лампами - накаливания). -
- -
int use_fuji_rotate;
-
- Ключи dcraw: -j
- Умолчание - 1 (использовать), 0 - отключает поворот для камер на сенсоре Fuji. -
-
int green_matching;
-
- Включает подавление разбаланса чувствительности зеленых каналов. - Ключи dcraw: нет
- Умолчание - 0 (не использовать), 1 - включает этот этап обработки. Включение этого режима требует - удвоенного количества памяти под bitmap. -
-
int dcb_iterations
-
- Ключи dcraw: нет
- Количество циклов коррекции после DCB-алгоритма. Умолчание - нет коррекции. -
-
int dcb_enhance_fl
-
- Ключи dcraw: нет
- ненулевое значение: усиливать цвета после DCB-интерполяции. -
-
int fbdd_noiserd
-
- Ключи dcraw: нет
- Управляет алгоритмом подавления шума FBDD перед демозаикой (интерполяцией) -
    -
  • 0 - не использовать FBDD
  • -
  • 1 - легкое подавление шума
  • -
  • 2 - полное подавление шума
  • -
-
-
int eeci_refine
-
- Ключи dcraw: нет
- ненулевое значение - Использовать алгоритм EECI refine после VCD+AHD-интерполяции. -
-
int es_med_passes
-
- Ключи dcraw: нет
- Количество проходов медианного фильтра, чувствительного к границам для подавления артефактов - VCD+AHD интерполяции. Значения больше 1 не рекомендуются. -
-
int ca_correc
-
- Ключи dcraw: нет
- положительное значение - подавлять хроматическую аберрацию перед интерполяцией. -
-
float cared,cablue
-
- Ключи dcraw: нет
- Если одно из этих полей имеет отличное от нуля значение, то автоматическая подборка параметров - коррекции аберрации производиться не будет. Диапазон значений обеих полей: +-0.1..+-4. -
-
int cfaline; float linenoise;
-
Подавление полосатости (banding). -
- cfaline - положительное значение включает подавление. -
- linenoise - степень подавления, разумный диапазон параметра от 0.001 до 0.02. -
-
int cfa_clean; float lclean,cclean;
-
- Подавляет импульсный (высокочастотный) шум. -
- cfa_clean: положительное значение включает подавление. -
- lclean,cclean - Степень подавления для яркостного (lclean) и цветового (cclean) шумов. Разумное значение от - 0.005 до 0.05. -
-
int cfa_green; float green_thresh;
-
- Подавление "лабиринтных" артефактов, возникающих из-за неравенства каналов зеленого. -
- cfa_green - положительное значение включает подавление. -
- green_thresh - максимальное различие междк каналами при котором происходит выравнивание. Разумные значения от - 0.01 до 0.1. -
-
int exp_correc; float exp_shift,exp_preser;
-
- Экспокоррекция перед байеровской интерполяцией. -
-
    -
  • exp_correc: положительное значение включает экспокоррекцию (умолчание: выключено).
  • -
  • exp_shift: экспозиционный сдвиг в линейной шкале. Нормально обрабатываются значения от 0.25 (затемнение - на 2 ступени экспозиции) до 8.0 (осветление на 3 ступени). Умолчание: 1.0 (нет экспокоррекции).
  • -
  • exp_preser: степень сохранения деталей в светах при осветлении изображения. Диапазон значений от 0.0 - (линейный сдвиг экспозиции с вылетом светов) до 1.0 (максимальное сохранение деталей в светах). Умолчание: - 0.0. -
-
int wf_debanding; float wf_deband_treshold[4];
-
- wf_debanding: 1 включает подавление полосатости, 0 - выключает. -

- wf_deband_treshold[] - поканальные пороги подавления. -

-
int use_rawspeed;
-
- Включает использование библиотеки RawSpeed (только если LibRaw собрана с поддержкой этой библиотеки) -
-
int no_auto_scale;
-
- Запрещает масштабирование значений пикселов (LibRaw::scale_colors()) - при обработке в LibRaw::dcraw_process() -
-
int no_interpolation;
-
- Запрещает вызов демозаики при обработке в LibRaw::dcraw_process() -
-
int sraw_ycc;
-
- Запрещает преобразование из YCbCr в RGB для файлов Canon sRAW/mRAW. -
-
- -

Структура libraw_decoder_info_t - информация о декодере RAW-изображения

-

- Данная структура описывает декодер RAW-формата и включает два поля данных: -

-
-
const char *decoder_name
-
Имя декодирующей функции (в информационных целях)
-
unsigned decoder_flags
-
Флаги декодера, описывающие формат выдаваемых им данных. См список - LibRaw_decoder_flags. -
-
- -

Структура libraw_processed_image_t - данные, выводимые функциями dcraw_make_mem_image()/dcraw_make_mem_thumb()

-

Структура libraw_processed_image_t - порождается в результате работы функций - dcraw_make_mem_image()/dcraw_make_mem_thumb() и содержит образ данных изображения или preview.
- Поля данных: -

-
-
LibRaw_image_formats type
-
Тип данных, содержащихся в структуре: -
    -
  • LIBRAW_IMAGE_BITMAP - структура содержит обычный RGB или серый bitmap, размеры которого и прочие - характеристики описываются параметрами данной структуры (см. ниже). -
  • LIBRAW_IMAGE_JPEG - структура содержит значимые поля data_size и data, в поле data находится - структура данных JPEG-файла. -
-
-
ushort height,width
-
Размер изображения в пикселах. Эти поля данных валидны только если type==LIBRAW_IMAGE_BITMAP.
-
ushort colors, bits
-
Количество цветов (3 или 1) и глубина цвета в битах (8 или 16). Эти поля валидны только если type==LIBRAW_IMAGE_BITMAP
-
ushort gamma_corrected
-
Являются ли значения данных гамма-корректироваными (0 или 1).Эти поля данных валидны только если - type==LIBRAW_IMAGE_BITMAP.
-
unsigned int data_size
-
Размер следующего поля (data) в байтах. В случае type==LIBRAW_IMAGE_BITMAP его, конечно, несложно - вычислить как (height*width*colors * (bits/8)). В случае type==LIBRAW_IMAGE_JPEG - вычислить никак нельзя, а - размер данных может быть нужен. -
-
unsigned char data[]
-
Массив данных, содержащий либо RGB-битмэп, либо JPEG-файл (в памяти), в зависимости от значения поля - type. -
-
- -

Объекты абстракции ввода данных

-

- Ввод (чтение) RAW-данных в LibRaw обеспечивается объектом, производным от класса - LibRaw_abstract_datastream. Функциональность этих объектов подробно описана в описании C++ API. -

-

- LibRaw предлагает две готовых реализации объектов datastream: -

-
    -
  • LibRaw_file_datastream - ввод из файла (объект создается для - файла с заданным именем).
  • -
  • LibRaw_buffer_datastream - ввод из буфера в памяти (это - может быть mmap()-ed файл или буфер со считанными RAW-данными).
  • -
-

- Пользователь библиотеки может запрограмировать свой объект, производный от LibRaw_abstract_datastream, реализующий, например, чтение RAW-файла - через интерфейс удаленного управления камерой, и использовать LibRaw c этим объектом через интерфейс - LibRaw::open_datastream(). -

-

Входящие в библиотеку реализации потока данных могут быть использованы как через посредство интерфейса - LibRaw::open_datastream(), так и через shortcuts - LibRaw::open_file() и - LibRaw::open_buffer(). -

-

Переопределение интерфейса ввода и интерфейс LibRaw::open_datastream() доступны только пользователям - C++ API, пользователи C API могут использовать - только встроенные интерфейсы libraw_open_file()/libraw_open_buffer(). -

- -

Поля данных

-

Определение:

-
-class LibRaw_abstract_datastream {
-...
-protected:
-    LibRaw_abstract_datastream *substream;
-}
-
-

Описание: - Объекты производные от LibRaw_abstract_datastream всегда содержат указатель на вторичный поток данных - (substream), этот поток данных инициализируется при необходимости временно переключить ввод на расшифрованные - метаданные, считанные из файла во временный буфер (актуально только для камер Sony). -

-

- Подробнее работа с вторичным потоком данных описана в - описании реализации собственных объектов ввода данных. -

- - -

Константы

- -

enum LibRaw_errors - коды ошибок

-

Все функции, возвращающие целые числа, возвращают либо errno, либо один из следующих кодов ошибок (см. также соглашения о кодах ошибок)

-

Фатальные ошибки (получение такого кода ошибки означает безусловное прекращение обработки файла, ибо - структуры данных находятся в неизвестном состоянии).

-
-
LIBRAW_UNSUFFICIENT_MEMORY
-
Попытка получения памяти от системы закончилась неудачей.
- Все аллоцированные ресурсы будут освобождены, вызвана функция recycle(), объект LibRaw приведен в состояние "сразу после создания". -
-
LIBRAW_DATA_ERROR
-
При распаковке данных возникла фатальная ошибка.
- Все аллоцированные ресурсы будут освобождены, вызвана функция recycle(), объект LibRaw приведен в состояние "сразу после создания". -
-
LIBRAW_IO_ERROR
-
При чтении файла возникла фатальная ошибка (файл закончился раньше времени, либо поврежден).
- Все аллоцированные ресурсы будут освобождены, вызвана функция recycle(), объект LibRaw приведен в состояние "сразу после создания". -
-
LIBRAW_CANCELLED_BY_CALLBACK
-
Обработка завершена досрочно по требованию вызывающего приложения (путем возврата ненулевого кода из progress callback.
- Все аллоцированные ресурсы будут освобождены, вызвана функция recycle(), объект LibRaw приведен в состояние "сразу после создания". -
-
LIBRAW_BAD_CROP
-
Заданы неверные координаты прямоугольника обрезания выходного изображения (cropbox): левый верхний угол - находится вне изображения. Обработка не может быть продолжена и завершена - досрочно. Все аллоцированные ресурсы будут освобождены, вызвана функция recycle(), объект LibRaw приведен в состояние "сразу после создания". -
-
-

Нефатальные ошибки

-
-
LIBRAW_SUCCESS=0
-
Нет ошибки, функция завершилась успешно.
-
LIBRAW_UNSPECIFIED_ERROR
-
Произошла неизвестная ошибка. Этот код не должен выдаваться никогда.
-
LIBRAW_FILE_UNSUPPORTED
-
Не поддерживаемый формат файла (попытка открыть RAW-файл неизвестного программе формата).
-
LIBRAW_REQUEST_FOR_NONEXISTENT_IMAGE
-
Попытка извлечь RAW-изображение с номером, не существующим в файле данных (только для форматов, - поддерживающих хранение нескольких изображений в одном файле).
-
LIBRAW_OUT_OF_ORDER_CALL
-
Функции API вызывались в неправильном порядке (например, unpack() до - open_file()), либо предыдущая стадия - завершилась с ошибкой (например, вызываем unpack() если open_file() вернула ошибку).
-
LIBRAW_NO_THUMBNAIL
-
Возвращается при попытке получить thumbnail из файла, не содержащего preview.
-
LIBRAW_UNSUPPORTED_THUMBNAIL
-
RAW-файл содержит preview неподдерживаемого формата.
-
LIBRAW_INPUT_CLOSED
-
Была сделана попытка вызвать unpack() или unpack_thumb() при уже закрытом потоке данных.
-
- -

enum LibRaw_decoder_flags - описание layout данных конкретного распаковщика форматов

-

- В зависимости от свойств конкретного формата RAW-данных, распаковщик использует различные - форматы буфера под raw-данные. Существуют такие типы буферов: -

-
-
LIBRAW_DECODER_FLATFIELD
-
- "Плоский" буфер, одно 16-битное значение на пиксел. Этот формат используется для всех байеровских - матриц. Маскированная (черная) рамка хранится вместе с изображением, размер буфера [raw_width*raw_height]; -
-
LIBRAW_DECODER_4COMPONENT
-
- Хранится четыре 16-битных значений на пиксел. Этот формат используется для большинства полноцветных - изображений (sRAW, multishot MF backs, DNG с проведенной демозаикой). -
-
LIBRAW_DECODER_LEGACY
-
- Аналогичен LIBRAW_DECODER_4COMPONENT, но черная рамка отсутствует. Размер буфера [width*height]. -
-
LIBRAW_DECODER_HASCURVE
-
Флаг выставляется, если в декодере используется тоновая кривая, данные для которой - можно изменить до вызова декодера (т.е. кривая не считываются внутри декодера). -
-
- -

enum LibRaw_progress - текущее состояние объекта LibRaw

-

В LibRaw::imgdata.progress_flags содержится битовая маска, описывающая все стадии обработки, уже проведенные - над файлом. -

-

Фаза открытия файла и извлечения RAW-данных.

-
-
LIBRAW_PROGRESS_START=0
-
- Объект только создан, никакой обработки не проводилось. -
-
LIBRAW_PROGRESS_OPEN
-
- Обрабатываемый файл открыт -
-
LIBRAW_PROGRESS_IDENTIFY
-
- Проведена идентификация данных, формат опознан, извлечены метаданные. -
-
LIBRAW_PROGRESS_SIZE_ADJUST
-
- Проведено выравнивание размеров данных (для тех файлов, которым это нужно, а это некоторые файлы с камер - Kodak). -
-
LIBRAW_PROGRESS_LOAD_RAW
-
- Загружены RAW-данные. -
-
-

Следующие флаги выставляются при использовании обработки изображений, позаимствованной у dcraw.

-
-
LIBRAW_PROGRESS_RAW2_IMAGE
-
- Аллоцирован и заполнен массив imgdata.image -
-
LIBRAW_PROGRESS_REMOVE_ZEROES
-
- Удалены нулевые значения для тех камер, для которых это нужно (камеры Panasonic). -
-
LIBRAW_PROGRESS_BAD_PIXELS
-
- Удалены плохие пикселы (если включена соотв. опция) -
-
LIBRAW_PROGRESS_DARK_FRAME
-
- Проведено вычитание темнового кадра (если включена соотв. опция) -
-
LIBRAW_PROGRESS_FOVEON_INTERPOLATE
-
- Проведена интерполяция для камер с сенсором Foveon. -
-
LIBRAW_PROGRESS_SCALE_COLORS
-
- Произведена балансировка белого. -
-
LIBRAW_PROGRESS_PRE_INTERPOLATE
-
- Проведено удаление плохих пикселов (если соответствующий режим задан в настройках).
- Проведено вычитание темнового кадра (если соответствующий режим задан в настройках).
- Проведено уменьшение изображения (для режима half_size) и копирование 2-го канала зеленого в первый - в тех точках, где 2-й канал есть, а первого - нет. -
-
LIBRAW_PROGRESS_INTERPOLATE
-
- Проведена интерполяция (де-байеризация). -
-
LIBRAW_PROGRESS_MIX_GREEN
-
- Проведено усреднение каналов зеленого. -
-
LIBRAW_PROGRESS_MEDIAN_FILTER
-
- Проведена медианная фильтрация. -
-
LIBRAW_PROGRESS_HIGHLIGHTS
-
- Проведена работа со светами. -
-
LIBRAW_PROGRESS_FUJI_ROTATE
-
- Для изображений с камер Fuji проведен поворот (либо вызвана adjust_sizes_info_only()). -
-
LIBRAW_PROGRESS_FLIP
-
- Для изображений, снятых повернутой камерой, произведен пересчет размеров (sizes.iwidth/sizes.iheight поменяли местами). -
-
LIBRAW_PROGRESS_CONVERT_RGB
-
- Проведена конверсия в выходное RGB-пространство. -
-
LIBRAW_PROGRESS_STRETCH
-
- Произведено изменение размеров изображения для камер с неквадратными пикселами. -
-
LIBRAW_PROGRESS_STAGE17 - LIBRAW_PROGRESS_STAGE27
-
- Зарезервировано на случай появления других стадий обработки. -
-
-

Следующие флаги выставляются при загрузке thumbnails.

-
LIBRAW_PROGRESS_THUMB_LOAD
-
- Произведена загрузка данных Thumbnail (для камер Kodak - еще сделаны необходимые преобразования). -
-
LIBRAW_PROGRESS_TRESERVED1 - LIBRAW_PROGRESS_TRESERVED3
-
- Зарезервировано на случай появления других стадий обработки. -
- - - -

enum LibRaw_thumbnail_formats - форматы данных Thumbnails

-

Формат данных thumbnail записывается в поле данных imgdata.thumbnail.tformat.
- На сегодняшний день LibRaw знает о четырех форматах thumbnail из которых распаковываются два: -

-
-
LIBRAW_THUMBNAIL_UNKNOWN
-
Формат неизвестен или thumbnail еще не читался. -
-
LIBRAW_THUMBNAIL_JPEG
-
В буфере thumbnail лежит JPEG-файл (считанный as-is из RAW-файла, каких-либо манипуляций над ним не - проводится). -
-
LIBRAW_THUMBNAIL_BITMAP
-
- В буфере для thumbnaill лежит гамма-скорректированный RGB-bitmaip (для камер Kodak гамма-коррекция проводится - с учетом максимальных значений, а баланс белого выставляется в соответствии с настройками камеры)
- В этом формате каждый пиксель изображения представлен 8-битным RGB-триплетом. -
-
LIBRAW_THUMBNAIL_LAYER
-
- Формат данных в настоящее время распознается при открытии RAW-файла, но не поддерживается: не распаковывается - в LibRaw::unpack_thumb. -
-
LIBRAW_THUMBNAIL_ROLLEI
-
- Формат данных в настоящее время распознается при открытии RAW-файла, но не поддерживается: не распаковывается - в LibRaw::unpack_thumb. -
-
- -

Нештатные ситуации (warnings) возникающие при обработке RAW-данных

-

При обработке изображений могут возникнуть сомнительные ситуации, не являющиеся фатальными, но возможно - влияющие на результат извлечения данных или их постобработки. Индикация таких состояний производится путем - установки бита в поле imgdata.process_warnings

-
-
LIBRAW_WARN_FOVEON_NOMATRIX
-
Только для камер на Foveon: не удалось извлечь одну из матриц данных. -
-
LIBRAW_WARN_FOVEON_INVALIDWB
-
- Только для камер на Foveon: не удалось извлечь данные о балансе белого. -
-
LIBRAW_WARN_BAD_CAMERA_WB
-
- При постобработке задано использовать баланс белого камеры, а он непригоден для использования. -
-
LIBRAW_WARN_NO_METADATA
-
- Только для камер, где метаданные берутся из внешнего jpeg: не удалось извлечь метаданные. -
-
LIBRAW_WARN_NO_JPEGLIB
-
- Только для P&S камер Kodak: данные в формате JPEG. Одновременно open_file() вернет LIBRAW_FILE_UNSUPPORTED. -
-
LIBRAW_WARN_NO_EMBEDDED_PROFILE
-
- (Только при включенной поддержке ICC). - Задано использование вложенного профиля камеры, но в RAW-файле нет профиля. -
-
LIBRAW_WARN_NO_INPUT_PROFILE
-
- (Только при включенной поддержке ICC). - Заданный файл с профилем входных данных не удалось открыть. -
-
LIBRAW_WARN_BAD_OUTPUT_PROFILE
-
- (Только при включенной поддержке ICC). - Заданный файл с выходным профилем не удалось открыть. -
-
LIBRAW_WARN_NO_BADPIXELMAP
-
- Заданный файл с картой плохих пикселов не удалось открыть. -
-
LIBRAW_WARN_BAD_DARKFRAME_FILE
-
- Заданный файл с темновым кадром не удалось открыть. -
-
LIBRAW_WARN_BAD_DARKFRAME_DIM
-
- Темновой кадр либо имеет размеры, отличающиеся от обрабатываемого кадра, либо имеет неверный формат (нужен - 16-bit PGM, можно сгенерировать запуском примера simple_dcraw -4 -D) -
-
LIBRAW_WARN_RAWSPEED_PROBLEM
-
- При декодировании файла библиотекой RawSpeed возникла проблема. Файл был декодирован - собственным декодером LibRaw -
-
LIBRAW_WARN_RAWSPEED_UNSUPPORTED
-
- Файл не поддерживается RawSpeed и был декодирован декодером LibRaw -
-
LIBRAW_WARN_RAWSPEED_PROCESSED
-
- (не warning, информационный флаг) Файл был декодирован библиотекой RawSpeed -
- -
- -

enum LibRaw_image_formats - описание типов данных, содержащихся в структуре libraw_processed_image_t

-

Поле type структуры libraw_processed_image_t может принимать одно из следующих значений: -

-
-
LIBRAW_IMAGE_BITMAP
-
- В структуре данных находится обычный RGB-bitmap (его параметры определены в прочих полях структуры). -
-
LIBRAW_IMAGE_JPEG
-
- В структуре данных находится образ JPEG-файла, в метаданных определена только его длина. -
-
- [вернуться к оглавлению] -
-
LibRaw Team
- - -Last modified: Wed Oct 19 13:09:51 MSD 2011 - - - diff -Nru libraw-0.16.2/doc/API-notes-eng.html libraw-0.17.0/doc/API-notes-eng.html --- libraw-0.16.2/doc/API-notes-eng.html 2015-05-16 12:32:15.000000000 +0000 +++ libraw-0.17.0/doc/API-notes-eng.html 1970-01-01 00:00:00.000000000 +0000 @@ -1,359 +0,0 @@ - - - - LibRaw: General Notes on API - - - - [back to Index] -

LibRaw: General Notes on API

-

Contents

- -
    -
  1. LibRaw editions
  2. -
  3. Error Code Conventions and Error Handling
  4. -
  5. Nonstandard Situations That Are Not Errors
  6. -
  7. Input Layer Abstraction
  8. -
  9. Thread Safety
  10. -
  11. The Use of C++
  12. -
  13. Parameters of the LibRaw::imgdata.params Structure Affecting the Behavior of - open_file/unpack/unpack_thumb
  14. -
  15. Memory Usage -
      -
    1. Stack Usage
    2. -
    3. Dynamic Memory Management
    4. -
    5. Dynamic Memory Usage -
        -
      1. Memory Buffer for the RAW Image
      2. -
      3. Memory for the Postprocessed Image
      4. -
      5. Memory for the Decoded Thumbnail
      6. -
      7. Memory for the Decoded ICC Profile
      8. -
      9. Memory for RAW Unpacking
      10. -
      11. Memory for Postprocessing
      12. -
      13. Memory for File Writing
      14. -
      15. Unpacking into memory buffer
      16. -
      -
    6. -
    -
  16. -
  17. Incompatibilities with dcraw -
      -
    1. Processing of Thumbnails from Kodak cameras
    2. -
    -
  18. -
- - -

LibRaw Versions

-

Since version 0.9, there is only one LibRaw variants. Older versions have three separate editions (normal, - -Lite and -Commercial versions). -

- - -

Error Code Conventions and Error Handling

-

- The following conventions concern the returned errors: -

-
    -
  1. All functions that can return an error code have integer type of return data.
  2. -
  3. If there is no error, the return value is 0 (LIBRAW_SUCCESS).
  4. -
  5. If an error has happened in a system call, the return value is errno -(a positive number), which can be analyzed using strerror() or similar means.
  6. -
  7. All LibRaw's own error codes are negative; each of these errors belongs to one of two types: -
    -
    Non-fatal errors
    -
    - Non-fatal errors do not forbid execution of other functions in the processing succession - (e.g., unpack_thumb() can easily return the code corresponding to "preview is absent" - but this does not prevent further call of unpack(). -
    -
    Fatal errors
    -
    - In the case of fatal errors (memory shortage, input data error, data unpacking failure), the current stage of processing - is terminated and all allocated resouces are freed.
    - If an attempt to continue processing is made, all subsequent API calls will return the LIBRAW_OUT_OF_ORDER_CALL error.
    - At the same time, the LibRaw instance in which a fatal error has occurred can process the next RAW - files in the usual way (by calling open_file() (or other input methods), then unpack(), - etc.). -
    -
    -
  8. The macro LIBRAW_FATAL_ERROR(error code) checks if an error is fatal or not.
  9. -
  10. The error codes are listed and deciphered here.
  11. -
- - -

Nonstandard Situations That Are Not Errors

-

If the program has encountered a nonstandard situation that does not prevent retrieval of some data - from a file, it sends a signal by setting the corresponding bit in imgdata.process_warnings. - The possible types of warnings are listed and deciphered here. -

- - -

Input Layer Abstraction

-

- LibRaw uses objects derived from - LibRaw_abstract_datastream for data input. - Semantics of these objects is similar to 'file with arbitrary seek' object: both read and seek - operations are used. -

-

- Some RAW formats requires temporary switch to another data stream created on top on memory buffer for metadata - read. Methods for doing so are implemented in base class - LibRaw_abstract_datastream by internal data field substream. - Look into source code of LibRaw_file_datastream class - in libraw/libraw_datastream.h file for more details. -
- When implementing own datastream classes, you need to take substream into account and pass control to - methods of this field if it is active (not NULL). -

-

- If datastream implementaton knows name of input file, it should provide fname() call. This name will be used - in error callbacks and in guessing name of JPEG file with metadata - (for RAW files with external metadata). -

-

- For external metadata support input class should implement - subfile_open()/subfile_close() methods. - . -
- Sample of these methods implementation may be found in - LibRaw_file_datastream class (look into - libraw/libraw_datastream.h file for details). -

- - -

Thread safety

-

- Thread safety is ensured if a LibRaw object is created and used within one thread. At the same time, the number - of threads (each with its own LibRaw object) is not limited in any way (except by memory requirements). -

-

- If a LibRaw object is created in one execution thread and used in another, external synchronization is - necessary. -

-

- There is two libraries under Unix enviroment (Linux/FreeBSD/MacOS): libraw_r.a (thread-safe) and libraw.a - (single-threaded, slightly faster). -

-

- Thread-safe library version stores intermediate unpacker data into LibRaw class data. So, several copies of - LibRaw, working in parallel, is possible. -

-

- Not thread-safe library uses global variable for intermediate data store which is faster but not reenterant. - This library may be used in multi-threaded apps, but only if exactly one LibRaw class copy exists in program. -

-

- Windows version is similar to multi-threaded Unix one. -

- -

The Use of C++

-

- Exception situations within LibRaw are handled using the C++ exception mechanism. All exceptions are caught inside - the library functions and should not penetrate outside. -

-

- Memory is allocated/freed using functions malloc(calloc)/free rather than new/delete. -

-

- No specific libraries (STL, Boost, smart pointers) are used.

-

- If C API is used, references to C++ calls new/delete still remain, and so linking with libstdc++(Unix)/....(Windows) is necessary. -

- -

Parameters of the LibRaw::imgdata.params Structure Affecting the Behavior of open_file/unpack/unpack_thumb

-

- Most data fields of structure LibRaw::imgdata.params affect only data - postprocessing, but there are some exceptions, which have been inherited by the current version of LibRaw - from/ dcraw source texts (these dependences will be gradually removed). -

-
imgdata.params.use_camera_matrix and imgdata.params.use_camera_wb
-
- These fields affect loading of RAW data for cameras with a color matrix.
- Attention! If parameter imgdata.params.use_camera_matrix is not set by the user, it is copied from - imgdata.params.use_camera_wb at the stage of file opening. -
-
imgdata.params.user_flip
-
- If this parameter is greater than or equal to zero, assignment imgdata.sizes.flip = imgdata.params.user_flip is - performed at the open_file() stage. -
-
imgdata.params.shot_select
-
- This parameter makes it possible to select the number of the extracted image for data formats in which storage - of several RAW images in one data file is possible. -
-
imgdata.params.half_size
-
- Affects RAW data loading for Phase One and Sinar backs. Also, it this parameter is set then image bitmap - will be reduced by half in each dimension. In later case, all 4 components of bitmap will be filled during - data extraction phase. -
-
imgdata.params.threshold, imgdata.params.aber
-
- If these parameters used, then half-sized bitmap will be used for data unpacking. See above for details. -
- -
imgdata.params.use_camera_wb
-
- Affects loading of white balance matrix for Leaf backs. -
-
- - -

Memory Usage

- -

Stack Usage

-

- An instance of the LibRaw class has its own size about 100 Kb; if constructions like LibRaw - imageProcessor; are used, this memory is stack-allocated. -

-

- Methods of class LibRaw (and C API calls) may allocate up to 130-140 Kb of data on the stack (to place auto - variables) during their work. -

-

Thus, the work of one LibRaw instance may require about 250 Kb of stack memory. This is not a problem for most - contemporary architectures. However, when working in a multithreaded environment, one should not forget to - allocate a sufficient amount of memory for the thread stack. -

-

In the case of dynamic allocation (LibRaw *iProcessor = new LibRaw;), the requirements to stack - memory will decrease by 100 Kb, which is the size of a class instance). If C API is - used, the LibRaw instance is allocated dynamically. -

- - -

Dynamic Memory Management

-

LibRaw keeps record of all allocated dynamic memory blocks; in the case of an exceptional situation (fatal - error), they are all freed. The code for keeping this record is fairly primitive and not designed to consider - allocation of many blocks (in the normal situation, allocation takes place from 2 to 6 times during file - processing); this fact should be taken into account by developers trying to add new methods to LibRaw. -

- -

Dynamic Memory Usage

-

LibRaw uses dynamic memory

-
    -
  • for the decoded image;
  • -
  • for the decoded thumbnail;
  • -
  • for the postprocessed image;
  • -
  • for the ICC profile retrieved from the RAW file (if available);
  • -
  • for temporary data at the stage of RAW file unpacking;
  • -
  • for temporary data at the stage of postprocessing and result output;
  • -
  • for reading of the RAW source file (only under Win32).
  • -
- -

Memory buffer for the RAW image

-

- Decoded RAW data are stored: -

-
    -
  • one 16-bit value per pixel for "bayer" images. The masked pixels (black or dark or masked frame) are - stored with image data. -
  • -
  • Four 16-bit values for full-color images (Foveon, Linear DNG, Canon sRAW etc.). -
  • -
-

The buffer for RAW data is allocated by - href="API-CXX-eng.html#unpack">unpack() call and freeed upon calling - recycle(). -

- - -

Memory for the Postprocessed Image

-

- On postprocessing stage each pixel contains four 16-bit values, one for each possible color channel (some - sensors are actually 4-color). -

The buffer for the decoded image is allocated upon calling - raw2image(), - dcraw_process() or -

-

The buffer freed upon calling recycle() - or - free_image() calls. -

- -

Memory for the Decoded Thumbnail

-

- Memory for the thumbmail is allocated upon calling unpack_thumb() and freed upon - calling recycle(). The size of the allocated buffer is precisely adjusted to the thumbnail size, - i.e., up to several Mb. -

- - -

Memory for the Decoded ICC Profile

-

- Memory for the ICC profile is allocated upon calling unpack_profile() and freed upon - calling recycle(). The size of the allocated buffer is precisely adjusted to the ICC profile size, - i.e., up to several hundred Kb. -

- -

Memory for RAW Unpacking

-

- Memory for temporary buffer needed during RAW data unpacking may be allocated during the work of unpack() and freed before completion of this function. The sizes of the allocated - buffers are small, up to tens of Kb. -

- - -

Memory for Postprocessing

-

During image postprocessing (inherited from dcraw), memory for the histogram (128 Kb) is allocated. - This memory is allocated upon calling - dcraw_process() and freed upon calling - recycle(). -

-

- In addition, during the work of dcraw_process() and during the - usage of some available possibilities, like -

-
    -
  • rotation of images from FUJI cameras;
  • -
  • correction of chromatic aberrations;
  • -
  • image size changes (including correction of non-square pixels);
  • -
  • highlight recovery;
  • -
-

- a temporary buffer with the size equal to the size of the resultant image (6-8 bytes per pixel for various processing stages) - will be allocated. As soon as the intermediate substage of processing is completed, the buffer with the previous copy - of the image will be freed.
- If postprocessing is not used, then temporary buffers are not allocated. -

- - -

Memory for File Writing

-

- Upon calling dcraw_ppm_tiff_writer(), memory for a single row of the - output image is allocated. The allocated memory is freed before the end of this call. -

- -

Unpacking into memory buffer

-

- Functons dcraw_make_mem_image() - dcraw_make_mem_thumb() (and complementary calls in C-API) - allocates memory for entire output datasets (full RGB bitmap and thumbnail, respectively). - Calling function should free() this memory themself. -

- - - -

Incompatibilities with dcraw

- -

Processing of Thumbnails from Kodak cameras

-

In some Kodak cameras, the preview (thumbnail) is stored in the form of uncorrected image. During its extraction using - dcraw -e, the white balance, color conversion, and other settings are the same as those used for extraction of the main RAW data - (including defect removal and dark frame subtraction, which is erroneous, since the image size is different). -
- In LibRaw::unpack_thumb() calls, the white balance taken from the camera ("as shot") is used and no settings from - imgdata.params are considered. -

-

- For all other cameras, thumbnails are extracted "as is," without any color conversions, both in dcraw and in LibRaw. -

- - [back to Index] -
-
LibRaw Team
- - -Last modified: Fri Aug 24 00:31:09 MSK 2012 - - - diff -Nru libraw-0.16.2/doc/API-notes.html libraw-0.17.0/doc/API-notes.html --- libraw-0.16.2/doc/API-notes.html 1970-01-01 00:00:00.000000000 +0000 +++ libraw-0.17.0/doc/API-notes.html 2015-08-15 13:10:27.000000000 +0000 @@ -0,0 +1,353 @@ + + + + LibRaw: General Notes on API + + + + [back to Index] +

LibRaw: General Notes on API

+

Contents

+ +
    +
  1. LibRaw editions
  2. +
  3. Error Code Conventions and Error Handling
  4. +
  5. Nonstandard Situations That Are Not Errors
  6. +
  7. Input Layer Abstraction
  8. +
  9. Thread Safety
  10. +
  11. The Use of C++
  12. +
  13. Parameters of the LibRaw::imgdata.params Structure Affecting the Behavior of + open_file/unpack/unpack_thumb
  14. +
  15. Memory Usage +
      +
    1. Stack Usage
    2. +
    3. Dynamic Memory Management
    4. +
    5. Dynamic Memory Usage +
        +
      1. Memory Buffer for the RAW Image
      2. +
      3. Memory for the Postprocessed Image
      4. +
      5. Memory for the Decoded Thumbnail
      6. +
      7. Memory for the Decoded ICC Profile
      8. +
      9. Memory for RAW Unpacking
      10. +
      11. Memory for Postprocessing
      12. +
      13. Memory for File Writing
      14. +
      15. Unpacking into memory buffer
      16. +
      +
    6. +
    +
  16. +
  17. Incompatibilities with dcraw +
      +
    1. Processing of Thumbnails from Kodak cameras
    2. +
    +
  18. +
+ + +

LibRaw Versions

+

Since version 0.9, there is only one LibRaw variants. Older versions have three separate editions (normal, + -Lite and -Commercial versions). +

+ + +

Error Code Conventions and Error Handling

+

+ The following conventions concern the returned errors: +

+
    +
  1. All functions that can return an error code have integer type of return data.
  2. +
  3. If there is no error, the return value is 0 (LIBRAW_SUCCESS).
  4. +
  5. If an error has happened in a system call, the return value is errno +(a positive number), which can be analyzed using strerror() or similar means.
  6. +
  7. All LibRaw's own error codes are negative; each of these errors belongs to one of two types: +
    +
    Non-fatal errors
    +
    + Non-fatal errors do not forbid execution of other functions in the processing succession + (e.g., unpack_thumb() can easily return the code corresponding to "preview is absent" + but this does not prevent further call of unpack(). +
    +
    Fatal errors
    +
    + In the case of fatal errors (memory shortage, input data error, data unpacking failure), the current stage of processing + is terminated and all allocated resouces are freed.
    + If an attempt to continue processing is made, all subsequent API calls will return the LIBRAW_OUT_OF_ORDER_CALL error.
    + At the same time, the LibRaw instance in which a fatal error has occurred can process the next RAW + files in the usual way (by calling open_file() (or other input methods), then unpack(), + etc.). +
    +
    +
  8. The macro LIBRAW_FATAL_ERROR(error code) checks if an error is fatal or not.
  9. +
  10. The error codes are listed and deciphered here.
  11. +
+ + +

Nonstandard Situations That Are Not Errors

+

If the program has encountered a nonstandard situation that does not prevent retrieval of some data + from a file, it sends a signal by setting the corresponding bit in imgdata.process_warnings. + The possible types of warnings are listed and deciphered here. +

+ + +

Input Layer Abstraction

+

+ LibRaw uses objects derived from + LibRaw_abstract_datastream for data input. + Semantics of these objects is similar to 'file with arbitrary seek' object: both read and seek + operations are used. +

+

+ Some RAW formats requires temporary switch to another data stream created on top on memory buffer for metadata + read. Methods for doing so are implemented in base class + LibRaw_abstract_datastream by internal data field substream. + Look into source code of LibRaw_file_datastream class + in libraw/libraw_datastream.h file for more details. +
+ When implementing own datastream classes, you need to take substream into account and pass control to + methods of this field if it is active (not NULL). +

+

+ If datastream implementaton knows name of input file, it should provide fname() call. This name will be used + in error callbacks and in guessing name of JPEG file with metadata + (for RAW files with external metadata). +

+

+ For external metadata support input class should implement + subfile_open()/subfile_close() methods. + . +
+ Sample of these methods implementation may be found in + LibRaw_file_datastream class (look into + libraw/libraw_datastream.h file for details). +

+ + +

Thread safety

+

+ Thread safety is ensured if a LibRaw object is created and used within one thread. At the same time, the number + of threads (each with its own LibRaw object) is not limited in any way (except by memory requirements). +

+

+ If a LibRaw object is created in one execution thread and used in another, external synchronization is + necessary. +

+

+ There is two libraries under Unix enviroment (Linux/FreeBSD/MacOS): libraw_r.a (thread-safe) and libraw.a + (single-threaded, slightly faster). +

+

+ Thread-safe library version stores intermediate unpacker data into LibRaw class data. So, several copies of + LibRaw, working in parallel, is possible. +

+

+ Not thread-safe library uses global variable for intermediate data store which is faster but not reenterant. + This library may be used in multi-threaded apps, but only if exactly one LibRaw class copy exists in program. +

+

+ Windows version is similar to multi-threaded Unix one. +

+ +

The Use of C++

+

+ Exception situations within LibRaw are handled using the C++ exception mechanism. All exceptions are caught inside + the library functions and should not penetrate outside. +

+

+ Memory is allocated/freed using functions malloc(calloc)/free rather than new/delete. +

+

+ No specific libraries (STL, Boost, smart pointers) are used.

+

+ If C API is used, references to C++ calls new/delete still remain, and so linking with libstdc++(Unix)/....(Windows) is necessary. +

+ +

Parameters of the LibRaw::imgdata.params Structure Affecting the Behavior of open_file/unpack/unpack_thumb

+

+ Most data fields of structure LibRaw::imgdata.params affect only data + postprocessing, but there are some exceptions, which have been inherited by the current version of LibRaw + from/ dcraw source texts (these dependences will be gradually removed). +

+
imgdata.params.use_camera_matrix and imgdata.params.use_camera_wb
+
+ These fields affect loading of RAW data for cameras with a color matrix.
+ Attention! If parameter imgdata.params.use_camera_matrix is not set by the user, it is copied from + imgdata.params.use_camera_wb at the stage of file opening. +
+
imgdata.params.user_flip
+
+ If this parameter is greater than or equal to zero, assignment imgdata.sizes.flip = imgdata.params.user_flip is + performed at the open_file() stage. +
+
imgdata.params.shot_select
+
+ This parameter makes it possible to select the number of the extracted image for data formats in which storage + of several RAW images in one data file is possible. +
+
imgdata.params.half_size
+
+ Affects RAW data loading for Phase One and Sinar backs. Also, it this parameter is set then image bitmap + will be reduced by half in each dimension. In later case, all 4 components of bitmap will be filled during + data extraction phase. +
+
imgdata.params.threshold, imgdata.params.aber
+
+ If these parameters used, then half-sized bitmap will be used for data unpacking. See above for details. +
+ +
imgdata.params.use_camera_wb
+
+ Affects loading of white balance matrix for Leaf backs. +
+
+ + +

Memory Usage

+ +

Stack Usage

+

+ An instance of the LibRaw class has its own size about 100 Kb; if constructions like LibRaw + imageProcessor; are used, this memory is stack-allocated. +

+

+ Methods of class LibRaw (and C API calls) may allocate up to 130-140 Kb of data on the stack (to place auto + variables) during their work. +

+

Thus, the work of one LibRaw instance may require about 250 Kb of stack memory. This is not a problem for most + contemporary architectures. However, when working in a multithreaded environment, one should not forget to + allocate a sufficient amount of memory for the thread stack. +

+

In the case of dynamic allocation (LibRaw *iProcessor = new LibRaw;), the requirements to stack + memory will decrease by 100 Kb, which is the size of a class instance). If C API is + used, the LibRaw instance is allocated dynamically. +

+ + +

Dynamic Memory Management

+

LibRaw keeps record of all allocated dynamic memory blocks; in the case of an exceptional situation (fatal + error), they are all freed. The code for keeping this record is fairly primitive and not designed to consider + allocation of many blocks (in the normal situation, allocation takes place from 2 to 6 times during file + processing); this fact should be taken into account by developers trying to add new methods to LibRaw. +

+ +

Dynamic Memory Usage

+

LibRaw uses dynamic memory

+
    +
  • for the decoded image;
  • +
  • for the decoded thumbnail;
  • +
  • for the postprocessed image;
  • +
  • for the ICC profile retrieved from the RAW file (if available);
  • +
  • for temporary data at the stage of RAW file unpacking;
  • +
  • for temporary data at the stage of postprocessing and result output;
  • +
  • for reading of the RAW source file (only under Win32).
  • +
+ +

Memory buffer for the RAW image

+

+ Decoded RAW data are stored: +

+
    +
  • one 16-bit value per pixel for "bayer" images. The masked pixels (black or dark or masked frame) are + stored with image data. +
  • +
  • Four 16-bit values for full-color images (Foveon, Linear DNG, Canon sRAW etc.). +
  • +
+

The buffer for RAW data is allocated by + href="API-CXX.html#unpack">unpack() call and freeed upon calling + recycle(). +

+ + +

Memory for the Postprocessed Image

+

+ On postprocessing stage each pixel contains four 16-bit values, one for each possible color channel (some + sensors are actually 4-color). +

The buffer for the decoded image is allocated upon calling + raw2image(), + dcraw_process() or +

+

The buffer freed upon calling recycle() + or + free_image() calls. +

+ +

Memory for the Decoded Thumbnail

+

+ Memory for the thumbmail is allocated upon calling unpack_thumb() and freed upon + calling recycle(). The size of the allocated buffer is precisely adjusted to the thumbnail size, + i.e., up to several Mb. +

+ + +

Memory for the Decoded ICC Profile

+

+ Memory for the ICC profile is allocated upon calling unpack_profile() and freed upon + calling recycle(). The size of the allocated buffer is precisely adjusted to the ICC profile size, + i.e., up to several hundred Kb. +

+ +

Memory for RAW Unpacking

+

+ Memory for temporary buffer needed during RAW data unpacking may be allocated during the work of unpack() and freed before completion of this function. The sizes of the allocated + buffers are small, up to tens of Kb. +

+ + +

Memory for Postprocessing

+

During image postprocessing (inherited from dcraw), memory for the histogram (128 Kb) is allocated. + This memory is allocated upon calling + dcraw_process() and freed upon calling + recycle(). +

+

+ In addition, during the work of dcraw_process() and during the + usage of some available possibilities, like +

+
    +
  • rotation of images from FUJI cameras;
  • +
  • correction of chromatic aberrations;
  • +
  • image size changes (including correction of non-square pixels);
  • +
  • highlight recovery;
  • +
+

+ a temporary buffer with the size equal to the size of the resultant image (6-8 bytes per pixel for various processing stages) + will be allocated. As soon as the intermediate substage of processing is completed, the buffer with the previous copy + of the image will be freed.
+ If postprocessing is not used, then temporary buffers are not allocated. +

+ + +

Memory for File Writing

+

+ Upon calling dcraw_ppm_tiff_writer(), memory for a single row of the + output image is allocated. The allocated memory is freed before the end of this call. +

+ +

Unpacking into memory buffer

+

+ Functons dcraw_make_mem_image() + dcraw_make_mem_thumb() (and complementary calls in C-API) + allocates memory for entire output datasets (full RGB bitmap and thumbnail, respectively). + Calling function should free() this memory themself. +

+ + + +

Incompatibilities with dcraw

+ +

Processing of Thumbnails from Kodak cameras

+

In some Kodak cameras, the preview (thumbnail) is stored in the form of uncorrected image. During its extraction using + dcraw -e, the white balance, color conversion, and other settings are the same as those used for extraction of the main RAW data + (including defect removal and dark frame subtraction, which is erroneous, since the image size is different). +
+ In LibRaw::unpack_thumb() calls, the white balance taken from the camera ("as shot") is used and no settings from + imgdata.params are considered. +

+

+ For all other cameras, thumbnails are extracted "as is," without any color conversions, both in dcraw and in LibRaw. +

+ + [back to Index] + + diff -Nru libraw-0.16.2/doc/API-notes-rus.html libraw-0.17.0/doc/API-notes-rus.html --- libraw-0.16.2/doc/API-notes-rus.html 2015-05-16 12:32:15.000000000 +0000 +++ libraw-0.17.0/doc/API-notes-rus.html 1970-01-01 00:00:00.000000000 +0000 @@ -1,377 +0,0 @@ - - - - LibRaw: общие комментарии к API - - - - [вернуться к оглавлению] -

LibRaw: общие комментарии к API

-

Содержание

- -
    -
  1. Варианты LibRaw
  2. -
  3. Соглашения о кодах ошибок и действиях при ошибках
  4. -
  5. Нештатные ситуации, не являющиеся ошибкой
  6. -
  7. Абстракция ввода данных
  8. -
  9. Thread safety
  10. -
  11. Использование C++
  12. -
  13. Параметры структуры LibRaw::imgdata.params, влияющие на поведение - open_file/unpack/unpack_thumb
  14. -
  15. Использование памяти -
      -
    1. Использование стека
    2. -
    3. Управление динамической памятью
    4. -
    5. Использование динамической памяти -
        -
      1. Память для хранения RAW-данных
      2. -
      3. Память для раскодированного изображения
      4. -
      5. Память для раскодированного thumbnail
      6. -
      7. Память для раскодированного ICC-profile
      8. -
      9. Память для распаковки RAW
      10. -
      11. Память для постобработки
      12. -
      13. Память для записи файла
      14. -
      15. Память для распаковки в буфер в памяти
      16. -
      -
    6. -
    -
  16. -
  17. Несовместимости с dcraw -
      -
    1. Обработка Thumbnails от камер Kodak
    2. -
    -
  18. -
- - -

Варианты LibRaw

-

Начиная с версии 0.9, библиотека LibRaw существует в единственном варианте. Более старые версии - существовали в трех редакциях (основная, облегченная и коммерческая). -

- -

Соглашения о кодах ошибок и действиях при ошибках

-

- Приняты следующие соглашения о возвращаемых ошибках -

-
    -
  1. Все функции, которые могут вернуть код ошибки имеют целый тип возвращаемых данных.
  2. -
  3. При отсутствии ошибки возвращается 0 (LIBRAW_SUCCESS).
  4. -
  5. Если случилась ошибка в системном вызове, то возвращается значение errno (это положительное число), которое - может быть проанализировано с помощью strerror() или подобных средств.
  6. -
  7. Все собственные коды ошибок LibRaw - отрицательные, при этом ошибки делятся на два типа: -
    -
    Нефатальные ошибки
    -
    - Нефатальные ошибки не запрещают исполнение других функций в последовательности обработки (например, - unpack_thumb() вполне может вернуть код, означающий "preview - отсутствует" и это не мешает затем вызвать unpack()). -
    -
    Фатальные ошибки
    -
    - В случае возникновения фатальной ошибки (нехватка памяти, ошибка во входных данных, невозможность - распаковки данных) текущая стадия обработки завершается, все аллоцированные ресурсы освобождаются.
    - В случае попытки продолжения обработки - все последущие вызовы API вернут ошибку - LIBRAW_OUT_OF_ORDER_CALL.
    - Вместе с тем, экземпляр LibRaw, в котором возникла фатальная ошибка, может - обрабатывать следущие RAW-файлы обычным образом (вызов - open_file() (либо - open_datastream(), - open_buffer()) - затем unpack() и так далее). -
    -
    -
  8. Проверка фатальности ошибки осуществляется макросом LIBAW_FATAL_ERROR(код ошибки)
  9. -
  10. Коды ошибок перечислены и расшифрованы здесь.
  11. -
- - -

Нештатные ситуации, не являющиеся ошибкой

-

В случае возникновения нештатной ситуации, не мешающей получить из файла какие-то данные, о ней будет - просигнализировано путем взведения соответствующего бита в imgdata.process_warnings. Возможные типы предупреждений перечислены и расшифрованы здесь. -

- - -

Абстракция ввода данных

-

- LibRaw использует для чтения файла объект, производный от класса - LibRaw_abstract_datastream. - Cемантика этого класса схожа с семантикой объектов типа "файл с произвольным позиционированием", объект - реализующий ввод должен поддерживать операции позиционирования и чтения. -

-

- Для работы с некоторыми форматами, содержащими зашифрованые куски TIFF-каталогов, требуется временное - переключение ввода на временный поток, привязанный к созданному LibRaw буферу в памяти. Эта функциональность - реализуется в базовом классе LibRaw_abstract_datastream через - имеющеется там поле substream, которое является указателем на объект класса - LibRaw_buffer_datastream. -
- При использовании собственных реализаций потоков данных, необходимо в методах чтения и позиционирования - проверять инициализированность этого поля и если оно не нулевое - передавать управление туда. Подробнее - см. реализацию класса - LibRaw_file_datastream в заголовочном файле - libraw/libraw_datastream.h. -

-

- Если поток данных знает имя обрабатываемого файла в файловой системе, он должен уметь сообщить его всем, кто в - нем нуждается вызовом fname(). Это имя будет использовано при вызове - callbacks (уведомителях об ошибках) и может быть использовано для - генерации имени файла с метаданными, если это нужно для распаковываемого формата. -

-

- Для некоторых форматов данных метаданные (экспозиционные параметры, баланс белого) не хранятся в RAW-файле, но - могут быть считаны из JPEG-версии того же снимка. Если реализация надстройки над - LibRaw_abstract_datastream умеет вернуть имя обрабатываемого файла при - вызове fname(), то предполагается, что для такой реализации возможно временное переключение потока ввода - на другой файл. Чтобы это было действительно так, - реализация потока данных должна реализовать методы - subfile_open()/subfile_close(). Стандартные реализации, унаследованные от базового класса, просто - возврашают код ошибки. -
- Пример реализации методов открытия дополнительного потока данных можно подсмотреть в реализации класса - LibRaw_file_datastream в заголовочном файле - libraw/libraw_datastream.h. -

- - -

Thread safety

-

- Thread safety обеспечивается, если объект LibRaw создается и иcпользуется внутри одного thread. При этом - количество threads (каждая со своим объектом LibRaw) ничем не ограничено (кроме потребностей в памяти). -

-

- В случае создания объекта LibRaw в одном потоке исполнения, а использования в другом - необходима внешняя - синхронизация, не дающая произвести одновременный доступ к одному объекту. -

-

- В Unix (Linux/FreeBSD/MacOS) собираются две версии библиотеки: thread-safe версия libraw_r.a и более быстрая - не thread-safe libraw.a. -

-

- Thread-safe версия использует для хранения локальных данных поля в классе LibRaw, что позволяет иметь несколько - экземпляров класса LibRaw, работающих одновременно. -

-

- Не thread-safe версия хранит промежуточные данные в глобальных переменных, что несколько быстрее. Не thread-safe - версия может использоваться и в multithreaded-приложениях, но только если экземпляр класса LibRaw гарантированно - один. -

-

- Под Windows собирается только thread-safe версия. -

- -

Использование C++

-

- При обработке исключительных ситуаций внутри LibRaw используется механизм C++ exceptions. Все исключения - перехватываются внутри функций библиотеки и проникать наружу не должны. -

-

- Для аллокации/освобождения памяти используются функции malloc(calloc)/free, а не new/delete. -

-

Какие-либо специфические библиотеки (STL, Boost, smart pointers) - не используются.

-

При использовании С API ссылки на C++-вызовы new/delete остаются, поэтому линковаться надо с - libstdc++(Unix)/....(Windows). -

- -

Параметры структуры LibRaw::imgdata.params, влияющие на поведение open_file/unpack/unpack_thumb

-

- Большинство полей данных структуры LibRaw::imgdata.params влияют только на постобработку данных, но есть ряд исключений, унаследованных текущей - версией LibRaw от особенностей исходных текстов dcraw (постепенно эти зависимости будут удаляться). -

-
imgdata.params.use_camera_matrix и imgdata.params.use_camera_wb
-
- Влияют на загрузку RAW-данных для камер у которых есть colormatrix.
- Внимание! Если параметр imgdata.params.use_camera_matrix не установлен пользователем, то он - копируется из imgdata.params.use_camera_wb на этапе открытия файла. -
-
imgdata.params.user_flip
-
- Если этот параметр больше или равен нулю, то на этапе открытия файла - (open_file() и остальные подобные вызовы) - производится присваивание imgdata.sizes.flip = imgdata.params.user_flip. -
-
imgdata.params.shot_select
-
- Позволяет выбрать номер извлекаемого изображения для тех форматов данных, где возможно хранение нескольких - RAW-изображений в одном файле данных. -
-
imgdata.params.half_size
-
- Влияет на загрузку RAW-данных для задников Phase One и Sinar. Кроме того, если установлен этот параметр, то - считывание данных будет производиться в битмэп половинного размера в котором будут заполняться 4 компонента. -
-
imgdata.params.threshold, imgdata.params.aber
-
- Использование этих параметров (т.е. указание, что будет использоваться, соответственно, wavelet denoising и - исправление аберраций) то чтение данных будет производиться в битмэп половинного размера, у каждого пиксела - будут заполнены вcе 4 компонента (для байеровских матриц). -
- -
imgdata.params.use_camera_wb
-
- Влияет на загрузку матрицы баланса белого для задников Leaf. -
-
- -

Использование памяти

- -

Использование стека

-

- Экземпляр класса LibRaw имеет собственный размер около 100 килобайт, при использовании конструкций вида - LibRaw imageProcessor; эта память аллоцируется на стеке. -

-

- Методы класса LibRaw (и вызовы С API) при работе могут аллоцировать до 130-140 килобайт данных на стеке под - автоматические переменные. -

-

Таким образом, для работы одного экземпляра LibRaw может требоваться около 250 килобайт стека. В большинстве - современных архитектур это не является проблемой, но при использовании LibRaw в multi-threaded-окружении - необходимо не забывать аллоцировать достаточно памяти для стека thread. -

-

При динамической аллокации (LibRaw *iProcessor = new LibRaw;) требования к памяти на стеке - снижаются (на 100 килобайт - размер экземпляра класса). При использовании C API - экземпляр LibRaw аллоцируется динамически. -

- - -

Управление динамической памятью

-

LibRaw ведет учет всех блоков аллоцированной динамической памяти, при возникновении исключительной ситуации - (фатальной ошибки) все они освобождаются. Код учета довольно примитивный и не расчитан на аллокацию большого - числа блоков (в обычной ситуации при обработке файла аллокация происходи 2-6 раз), при расширении LibRaw - собственными методами это надлежит учитывать. -

- -

Использование динамической памяти

-

LibRaw использует динамическую память:

-
    -
  • для извлеченных из файла RAW-данных;
  • -
  • для постобработки изображения;
  • -
  • для раскодированного thumbnail;
  • -
  • для извлеченного из RAW-файла ICC-профиля (если он там есть);
  • -
  • для временных данных на этапе распаковки RAW-файла;
  • -
  • для временных данных на этапе постобработки и записи результата;
  • -
  • для чтения исходного RAW-файла (только на Win32)
  • -
- -

Память для хранения RAW-данных

-

- Извлеченные из файла RAW-данные хранятся в формате: -

-
    -
  • 16-битное целое на пиксель для "байеровских" (1 цвет на пиксель) камер. Если у RAW-изображения есть черная - рамка, она хранится вместе с изображением. -
  • -
  • 4 16-битных целых для полноцветных изображений (Foveon, Linear DNG, Canon sRAW и т.п.). Полноцветные - изображения бывают как 3, так и 4-цветные, все они хранятся в виде 4 компонента на пиксел, для трехцветных - изображений четвертый компонент будет нулевым. -
  • -
-

Буфер для раскодированного изображения аллоцируется при вызове unpack() и - освобождается при recycle(). -

- -

Память для постобработки изображения

-

- Для каждого пикселя при постобработке отводится 4 16-битных компонента - Таким образом, размер памяти под буфер изображения в 6-10 раз превышает размер исходного RAW-файла (с учетом - сжатия RAW-данных).
-

-

Буфер для раскодированного изображения аллоцируется при вызове - dcraw_process() - или raw2image() и - освобождается при recycle() или - free_image() -

- - -

Память для раскодированного thumbnail

-

- Память для thumbnail аллоцируется при вызове unpack_thumb() и - освобождается при recycle(). Аллоцируется буфер размером ровно под - thumbnail т.е. до нескольких мегабайт. -

- - -

Память для раскодированного ICC-profile

-

- Память для ICC-профиля аллоцируется при вызове unpack_profile() и - освобождается при recycle(). Аллоцируется буфер размером ровно под - размер ICC-профиля т.е. до нескольких сотен килобайт. -

- -

Память для распаковки RAW

-

- Память для временных буферов, нужных при распаковке RAW-данных может быт аллоцирована во время работы unpack() и освобождается до завершения этой функции. Размеры аллоцированных - буферов невелики, в пределах нескольких десятков килобайт. -

- - -

Память для постобработки

-

При постобработке изображений (унаследованной от dcraw) выделяется память под гистограмму (128 килобайт). Эта - память выделяется при вызове - dcraw_process(), а освобождается при вызове - recycle(). - -

- Помимо этого, при работе dcraw_process() и использовании ряда - имеющихся возможностей: -

-
    -
  • ротации изображений с камер FUJI;
  • -
  • коррекции хроматических аберраций;
  • -
  • изменении размеров изображения (включая случаи коррекции неквадратного пиксела);
  • -
  • highlight recovery;
  • -
-

- будет аллоцирован временный буфер, размер которого равен размеру результирующего изображения (из расчета 6-8 - байт на пиксел для разных стадий обработки). При завершении промежуточной подстадии обработки, буфер с - предыдущей копией изображения будет освобожден.
- Если постобработка не используется, то временные буферы не аллоцируются. -

- - -

Память для записи файла

-

- Вызов dcraw_ppm_tiff_writer() аллоцирует память под одну - строку выходного изображения. Аллоцированная память освобождается перед выходом из вызова. -

- - -

Память для распаковки в буфер в памяти

-

- Вызовы dcraw_make_mem_image() и - dcraw_make_mem_thumb() (и их аналоги в C-API) - аллоцируют дополнительную память в объеме, необходимом для хранения выводимых данных (изображения - и thumbnail, соответственно).Освобождение этой памяти - задача вызывающей функции. -

- - -

Несовместимости с dcraw

- -

Обработка Thumbnails от камер Kodak

-

В ряде камер Kodak preview (thumbnail) хранится в виде нескорректированного изображения. При извлечении его с - помощью dcraw -e используются те же настройки баланса белого, коррекции цветов и так далее, что и для - извлечения основных RAW-данных (включая удаление дефектов и вычитание dark frame, что ошибочно т.к. размер - изображения другой). -
- В вызове LibRaw::unpack_thumb() всегда используется баланс белого, взятый из камеры (as shot), какие-либо - настроки из imgdata.params не используются. -

-

- Для Всех остальных камер thumbnails извлекаются as-is, без каких-либо цветовых - преобразований, как в dcraw, так и в LibRaw. -

- - [вернуться к оглавлению] -
-
LibRaw Team
- - -Last modified: Mon Jul 11 13:40:10 MSD 2011 - - - diff -Nru libraw-0.16.2/doc/API-overview-eng.html libraw-0.17.0/doc/API-overview-eng.html --- libraw-0.16.2/doc/API-overview-eng.html 2015-05-16 12:32:15.000000000 +0000 +++ libraw-0.17.0/doc/API-overview-eng.html 1970-01-01 00:00:00.000000000 +0000 @@ -1,72 +0,0 @@ - - - - Overview of LibRaw API (C++) - - - - [back to Index] -

Overview of LibRaw API (C++)

-

General Remarks

-
    -
  1. The entire processing is carried out by an instance of the LibRaw class, which is an image processor.
  2. -
  3. One image processor can simultaneously process only one data source file, but consecutive processing of any number of files -is possible.
  4. -
  5. There may be several simultaneously working image processors in a software program (e.g., in different threads), although one -should remember that each image processor may require much memory.
  6. -
  7. Reading of source data from the RAW file requires virtually no customization (see API Notes for exceptions to this rule).
  8. -
  9. All data extracted from the RAW file are accessible through data fields of the image processor (LibRaw class instance).
  10. -
  11. Although LibRaw is not intended for RAW data postprocessing, the library includes calls that enable complete -emulation of the dcraw utility. -
  12. All customization for the processing is performed via data fields of the LibRaw class.
  13. -
- -

Brief Demonstration

-

- The example below contains no error processing for the sake of brevity. -

-
-#include "libraw/libraw.h"
-int process_image(char *file)
-{
-        // Let us create an image processor
-        LibRaw iProcessor;
-
-        // Open the file and read the metadata
-        iProcessor.open_file(file);
-
-        // The metadata are accessible through data fields of the class
-        printf("Image size: %d x %d\n",iProcessor.imgdata.sizes.width,iProcessor.imgdata.sizes.height);
-
-        // Let us unpack the image
-        iProcessor.unpack();
-
-        // Convert from imgdata.rawdata to imgdata.image:
-        iProcessor.raw2image();
-
-        // And let us print its dump; the data are accessible through data fields of the class
-        for(i = 0;i lt; iProcessor.imgdata.sizes.iwidth *  iProcessor.imgdata.sizes.iheight; i++)
-           printf("i=%d R=%d G=%d B=%d G2=%d\n",
-                        i,
-                        iProcessor.imgdata.image[i][0],
-                        iProcessor.imgdata.image[i][1],
-                        iProcessor.imgdata.image[i][2],
-                        iProcessor.imgdata.image[i][3]
-                );
-
-        // Finally, let us free the image processor for work with the next image
-        iProcessor.recycle();
-}
-
- - - [back to Index] -
-
LibRaw Team
- - -Last modified: Mon Oct 24 13:09:54 MSD 2011 - - - diff -Nru libraw-0.16.2/doc/API-overview.html libraw-0.17.0/doc/API-overview.html --- libraw-0.16.2/doc/API-overview.html 1970-01-01 00:00:00.000000000 +0000 +++ libraw-0.17.0/doc/API-overview.html 2015-08-15 13:10:27.000000000 +0000 @@ -0,0 +1,66 @@ + + + + Overview of LibRaw API (C++) + + + + [back to Index] +

Overview of LibRaw API (C++)

+

General Remarks

+
    +
  1. The entire processing is carried out by an instance of the LibRaw class, which is an image processor.
  2. +
  3. One image processor can simultaneously process only one data source file, but consecutive processing of any number of files +is possible.
  4. +
  5. There may be several simultaneously working image processors in a software program (e.g., in different threads), although one +should remember that each image processor may require much memory.
  6. +
  7. Reading of source data from the RAW file requires virtually no customization (see API Notes for exceptions to this rule).
  8. +
  9. All data extracted from the RAW file are accessible through data fields of the image processor (LibRaw class instance).
  10. +
  11. Although LibRaw is not intended for RAW data postprocessing, the library includes calls that enable complete +emulation of the dcraw utility. +
  12. All customization for the processing is performed via data fields of the LibRaw class.
  13. +
+ +

Brief Demonstration

+

+ The example below contains no error processing for the sake of brevity. +

+
+#include "libraw/libraw.h"
+int process_image(char *file)
+{
+        // Let us create an image processor
+        LibRaw iProcessor;
+
+        // Open the file and read the metadata
+        iProcessor.open_file(file);
+
+        // The metadata are accessible through data fields of the class
+        printf("Image size: %d x %d\n",iProcessor.imgdata.sizes.width,iProcessor.imgdata.sizes.height);
+
+        // Let us unpack the image
+        iProcessor.unpack();
+
+        // Convert from imgdata.rawdata to imgdata.image:
+        iProcessor.raw2image();
+
+        // And let us print its dump; the data are accessible through data fields of the class
+        for(i = 0;i lt; iProcessor.imgdata.sizes.iwidth *  iProcessor.imgdata.sizes.iheight; i++)
+           printf("i=%d R=%d G=%d B=%d G2=%d\n",
+                        i,
+                        iProcessor.imgdata.image[i][0],
+                        iProcessor.imgdata.image[i][1],
+                        iProcessor.imgdata.image[i][2],
+                        iProcessor.imgdata.image[i][3]
+                );
+
+        // Finally, let us free the image processor for work with the next image
+        iProcessor.recycle();
+}
+
+ + + [back to Index] + + diff -Nru libraw-0.16.2/doc/API-overview-rus.html libraw-0.17.0/doc/API-overview-rus.html --- libraw-0.16.2/doc/API-overview-rus.html 2015-05-16 12:32:15.000000000 +0000 +++ libraw-0.17.0/doc/API-overview-rus.html 1970-01-01 00:00:00.000000000 +0000 @@ -1,72 +0,0 @@ - - - - Обзор LibRaw API (C++) - - - - [вернуться к оглавлению] -

Обзор LibRaw API (C++)

-

Общие положения

-
    -
  1. Вся обработка ведется экземпляром класса LibRaw - обработчиком изображений.
  2. -
  3. Один обработчик изображений одновременно может обрабатывать только один исходный файл, последовательно - - сколько угодно файлов.
  4. -
  5. В программе (например, в разных threads) могут одновременно работать несколько обработчиков, хотя следует - учитывать, что потребление памяти в обработчике может быть значительным.
  6. -
  7. Чтение исходных данных RAW-файла практически не требует настроек (об исключениях сказано в API Notes).
  8. -
  9. Все данные, извлеченные из RAW-файла доступны через поля данных обработчика (экземпляра класса LibRaw).
  10. -
  11. Несмотря на то, что LibRaw не предназначена для постобработки RAW-данных, в библиотеку включены - вызовы, позволяющие полностью воспроизвести поведение утилиты dcraw. -
  12. Все настройки обработки производятся через поля данных класса LibRaw.
  13. -
- -

Краткая демонстрация

-

- Пример ниже не содержит какой-либо обработки ошибок в целях компактности демонстрации -

-
-#include "libraw/libraw.h"
-int process_image(char *file)
-{
-        // Cоздадим обработчик изображений
-        LibRaw iProcessor;
-
-        // Открыть файл и считать метаданные
-        iProcessor.open_file(file);
-
-        // Метаданные доступны в полях данных класса
-        printf("Image size: %d x %d\n",iProcessor.imgdata.sizes.width,iProcessor.imgdata.sizes.height);
-
-        // Распакуем изображение
-        iProcessor.unpack();
-        
-        // Преобразуем из iProcessor.rawdata... в iProcessor.image
-        iProcessor.raw2image();
-
-        // И напечатаем его дамп, данные доступны в полях данных класса
-        for(i = 0;i lt; iProcessor.imgdata.sizes.iwidth *  iProcessor.imgdata.sizes.iheight; i++)
-           printf("i=%d R=%d G=%d B=%d G2=%d\n",
-                        i,
-                        iProcessor.imgdata.image[i][0],
-                        iProcessor.imgdata.image[i][1],
-                        iProcessor.imgdata.image[i][2],
-                        iProcessor.imgdata.image[i][3]
-                );
-
-        // Освободим процессор для работы со следующим изображением
-        iProcessor.recycle();
-}
-
- - - [вернуться к оглавлению] -
-
LibRaw Team
- - -Last modified: Mon Oct 24 13:10:54 MSD 2011 - - - diff -Nru libraw-0.16.2/doc/index-eng.html libraw-0.17.0/doc/index-eng.html --- libraw-0.16.2/doc/index-eng.html 2015-05-16 12:32:15.000000000 +0000 +++ libraw-0.17.0/doc/index-eng.html 1970-01-01 00:00:00.000000000 +0000 @@ -1,56 +0,0 @@ - - - - LibRaw: better dcraw (library) - - -

LibRaw: A Better dcraw

- -

LibRaw is a library for reading RAW files from digital photo cameras (CRW/CR2, NEF, RAF, DNG, MOS, KDC, DCR, etc.; -virtually all RAW formats are supported). It pays special attention to correct retrieval of data required for -subsequent RAW conversion.

-

The library is intended for embedding in RAW converters, data analyzers, and other programs -using RAW files as the initial data.

- -

- Contents -

-
    -
  1. Copyright -
  2. Acknowledgments -
  3. Purpose and Objectives -
  4. Overview of LibRaw API (C++) -
  5. Compilation and Installation -
  6. Data Structures, Error Codes, and Constants -
  7. C++ API -
  8. C API -
  9. Notes on API (error code conventions, memory usage) -
  10. Examples -
- -

Copyright

-

- LibRaw library, Copyright (C) 2008-2013 LibRaw LLC (info@libraw.org)
- The library includes source code from
- dcraw.c, Dave Coffin's raw photo decoder
- Copyright 1997-2008 by Dave Coffin, dcoffin a cybercom o net
-
-

-

- LibRaw is distributed for free under three different licenses: -

- You may use one of these licensing modes and switch between them. -

-
-
LibRaw Team
- - -Last modified: Sat Mar 27 21:00:51 MSK 2010 - - - diff -Nru libraw-0.16.2/doc/index.html libraw-0.17.0/doc/index.html --- libraw-0.16.2/doc/index.html 2015-05-16 12:32:15.000000000 +0000 +++ libraw-0.17.0/doc/index.html 2015-08-15 13:10:27.000000000 +0000 @@ -1,20 +1,49 @@ - + - LibRaw Documentation + LibRaw: better dcraw (library) - -

LibRaw Documentation

- -
-
LibRaw Team
- - -Last modified: Mon May 4 22:11:48 MSD 2009 - +

LibRaw: A Better dcraw

+ +

LibRaw is a library for reading RAW files from digital photo cameras (CRW/CR2, NEF, RAF, DNG, MOS, KDC, DCR, etc.; +virtually all RAW formats are supported). It pays special attention to correct retrieval of data required for +subsequent RAW conversion.

+

The library is intended for embedding in RAW converters, data analyzers, and other programs +using RAW files as the initial data.

+ +

+ Contents +

+
    +
  1. Copyright +
  2. Purpose and Objectives +
  3. Overview of LibRaw API (C++) +
  4. Compilation and Installation +
  5. Data Structures, Error Codes, and Constants +
  6. C++ API +
  7. C API +
  8. Notes on API (error code conventions, memory usage) +
  9. Examples +
+ +

Copyright

+

+ LibRaw library, Copyright (C) 2008-2015 LibRaw LLC (info@libraw.org)
+ The library includes source code from
+ dcraw.c, Dave Coffin's raw photo decoder
+ Copyright 1997-2015 by Dave Coffin, dcoffin a cybercom o net
+
+

+

+ LibRaw is distributed for free under three different licenses: +

+ You may use one of these licensing modes and switch between them. +

diff -Nru libraw-0.16.2/doc/index-rus.html libraw-0.17.0/doc/index-rus.html --- libraw-0.16.2/doc/index-rus.html 2015-05-16 12:32:15.000000000 +0000 +++ libraw-0.17.0/doc/index-rus.html 1970-01-01 00:00:00.000000000 +0000 @@ -1,58 +0,0 @@ - - - - LibRaw: better dcraw (library) - - -

LibRaw: better dcraw

- -

LibRaw: библиотека для чтения RAW-файлов цифровых фотокамер (CRW/CR2,NEF,RAF,DNG,MOS,KDC,DCR и так далее, - поддерживаются практически все RAW-форматы). Основное внимание уделено корректному извлечению данных, - необходимых для дальнейшего преобразования RAW.

-

Библиотека предназначена для встраивания в RAW-конверторы, анализаторы данных и прочие программы, использующие - RAW-файлы в качестве входных данных.

- -

- Оглавление -

-
    -
  1. Copyright -
  2. Благодарности -
  3. Цели и задачи проекта -
  4. Обзор LibRaw API (C++) -
  5. Компиляция и установка -
  6. Структуры данных, коды ошибок и константы -
  7. C++ API -
  8. C API -
  9. Пояснения к API (соглашения о - кодах ошибок, использование памяти) -
  10. Примеры использования -
- -

Copyright

-

- Библиотека LibRaw Copyright (C) 2008-2013 LibRaw LLC (info@libraw.org)
- Библиотека включает в себя код из
- dcraw.c -- Dave Coffin's raw photo decoder
- Copyright 1997-2008 by Dave Coffin, dcoffin a cybercom o net
-
-

-

- LibRaw свободно распространяется на условиях следующих лицензий: -

- Вы можете выбрать наиболее подходящий вам режим лицензирования из перечисленных трех. -

- -
-
LibRaw Team
- - -Last modified: Sat Mar 27 21:00:18 MSK 2010 - - - diff -Nru libraw-0.16.2/doc/Install-LibRaw-eng.html libraw-0.17.0/doc/Install-LibRaw-eng.html --- libraw-0.16.2/doc/Install-LibRaw-eng.html 2015-05-16 12:32:15.000000000 +0000 +++ libraw-0.17.0/doc/Install-LibRaw-eng.html 1970-01-01 00:00:00.000000000 +0000 @@ -1,187 +0,0 @@ - - - - LibRaw Compilation and Installation - - - - [back to Index] -

LibRaw Compilation and Installation

-

LibRaw is distributed in the form of source codes. For further use, they should be compiled (and, if desired, placed into - system folders with libraries and include-files).

- -

Unix Systems (FreeBSD, Linux, Mac OS X)

-

- To build the library, you will need a working C++ compiler (gcc ver. 3.x or 4.x will be OK; other compilers have - not been tested) and the make utility. No other libraries or utilities are required.

-

- LibRaw has been tested on 32- and 64-bit Unix systems working on x86- (and AMD64-) compatible processors. - Building and work on other architectures have not been tested. -

-

Compilation of Library and Examples

-

- Unpack the downloaded distribution package. If you wish to use LibRaw-demosaic-pack(s), unpack these archives - too: -

-
-        tar xzvf LibRaw-X.YY.tar.gz
-        tar xzvf LibRaw-demosaic-pack-GPL2-X.YY.tar.gz
-        tar xzvf LibRaw-demosaic-pack-GPL3-X.YY.tar.gz
-        tar xzvf LibRaw-X.YY.tar.gz
-    
-

Go to LibRaw directory and run ./configure and make: -

-
-cd LibRaw-X.YY
-./condigure # with optional args
-make
-    
-

As a result, you will compile

-
    -
  • Library libraw.a in the lib/ folder
  • -
  • Examples in the bin/ folder (source codes of examples are in the samples/ folder).
  • -
-

In the current version, only static libraries are built:

-
    -
  • libraw.a: non-thread-safe version
  • -
  • libraw_r.a: thread-safe
  • -
-

Build parameters

-

- ./configure script have some non-standard parameters: -

-
-
- --enable-openmp
- --disable-openmp -
-
- Enable/disable OpenMP support if compiler supports it. - OpenMP is enabled by default. -
-
- --enable-lcms
- --disable-lcms -
-
- Enable/disable LCMS color engine support. If enabled, ./configure will try to - find lcms library. Both LCMS-1.x and LCMS-2.x are supported - LCMS support is enabled by default -
-
- --enable-examples
- --disable-examples -
-
- Enables/disables examples compilation and installation. Enabled by default -
-
- --enable-demosaic-pack-gpl2
- --enable-demosaic-pack-gpl2=FOLDERNAME
- --enable-demosaic-pack-gpl2=no
- --disable-demosaic-pack-gpl2 -
-
- Enables/disables support of additional demosaic methods licensed under GPL2 - You need to download and unpack LibRaw-demosaic-pack-GPL2 archive to use - this feature.
- ./configure will try to find demosaic pack in: -
    -
  • If folder is specified via --enable-demosaic-pack-gpl2=FOLDERNAME - command-line option, then only this folder will be checked. -
  • -
  • If no folder is specified in --enable-demosaic-pack-gpl2 switch: -
      -
    • ./LibRaw-demosaic-pack-GPL2 (in LibRaw folder)
    • -
    • ../LibRaw-demosaic-pack*GPL2* - upper level folder
    • -
    - If several ../LibRaw-demosaic-pack*GPL2* folders exists in upper level - catalog, then ./configure will NOT use any of them due of ambiguity. - Specify exact folder name in this case using - --enable-demosaic-pack-gpl2=FOLDERNAME -
  • -
-
-
- --enable-demosaic-pack-gpl3
- --enable-demosaic-pack-gpl3=FOLDERNAME
- --enable-demosaic-pack-gpl3=no
- --disable-demosaic-pack-gpl3 -
-
- Same as above, but for GPL3-licensed demosaic pack. -
-
-

Installation and Usage

-

To install the library, run

-
-    sudo make install
-    
-

- It will place the libraries in /usr/local/lib, the include-files in /usr/local/include (subfolder of - libraw) and LibRaw samples to /usr/local/bin. You can override installation path by using - ./configure script. -
- To use LibRaw, add the following parameters to the compiler call (when building your own projects): -

-
    -
  • Path to include-files: -I/usr/local/include
  • -
  • Path to libraries: -L/usr/local/lib
  • -
  • Library: -lraw (ordinary version) or -lraw_r (thread-safe version).
  • -
-

Windows: Building under Cygwin

-

- Building and installation are completely similar to building and installation under Unix systems. -

-

Windows: Native Building

-

- Building under Windows has three steps: -

-
    -
  • Unpack the distribution package (if you have got no tar+gzip, take the LibRaw distribution package in the .ZIP format) and go to folder - LibRaw-X.YYY. -
  • -
  • Set the environment parameters so that the compiler/linker would find the libraries and include-files. For Visual C++, this is - done by running vcvars32.bat. -
  • -
  • - Run
    - nmake -f Makefile.msvc
    -
  • -
-

- If all paths are set correctly and the include-files/libraries have been found, then the following will be compiled:

-
    -
  • Library libraw_static.lib in folder lib
  • -
  • Dynamic library bin/libraw.dll and linking library for it lib/libraw.lib
  • -
  • Examples in folder bin/.
  • -
-

Only the thread-safe library is built under Win32, but it can be used with non-threaded applications as well. All examples are linked - with the dynamic library (DLL); if static linking is necessary, one should link applications with library libraw_static.lib and - set the preprocessor option /DLIBRAW_NODLL during compilation. -

-

- Windows-version compiles without LCMS support for now. -

-

- During building of DLL, all public functions are exported; further, the exported subset may be reduced. -

-

- Unfortunately, paths to include/ libraries depend on the way Visual C (or other compiler) is installed; therefore, it is impossible - to specify some standard paths in Makefile.msvc. -

-

Windows Installation

-

- No installation under Windows is supported. It is assumed that all DLLs will be supplied together with the software using them - (and this software will perform the installation). Accordingly, in building of programs using LibRaw, the paths to libraries, DLLs, - and include-files should be specified manually. -

- [back to Index] -
-
LibRaw Team
- - -Last modified: Fri Nov 19 20:07:01 UTC 2010 - - - diff -Nru libraw-0.16.2/doc/Install-LibRaw.html libraw-0.17.0/doc/Install-LibRaw.html --- libraw-0.16.2/doc/Install-LibRaw.html 1970-01-01 00:00:00.000000000 +0000 +++ libraw-0.17.0/doc/Install-LibRaw.html 2015-08-15 13:10:27.000000000 +0000 @@ -0,0 +1,181 @@ + + + + LibRaw Compilation and Installation + + + + [back to Index] +

LibRaw Compilation and Installation

+

LibRaw is distributed in the form of source codes. For further use, they should be compiled (and, if desired, placed into + system folders with libraries and include-files).

+ +

Unix Systems (FreeBSD, Linux, Mac OS X)

+

+ To build the library, you will need a working C++ compiler (gcc ver. 3.x or 4.x will be OK; other compilers have + not been tested) and the make utility. No other libraries or utilities are required.

+

+ LibRaw has been tested on 32- and 64-bit Unix systems working on x86- (and AMD64-) compatible processors. + Building and work on other architectures have not been tested. +

+

Compilation of Library and Examples

+

+ Unpack the downloaded distribution package. If you wish to use LibRaw-demosaic-pack(s), unpack these archives + too: +

+
+        tar xzvf LibRaw-X.YY.tar.gz
+        tar xzvf LibRaw-demosaic-pack-GPL2-X.YY.tar.gz
+        tar xzvf LibRaw-demosaic-pack-GPL3-X.YY.tar.gz
+        tar xzvf LibRaw-X.YY.tar.gz
+    
+

Go to LibRaw directory and run ./configure and make: +

+
+cd LibRaw-X.YY
+./condigure # with optional args
+make
+    
+

As a result, you will compile

+
    +
  • Library libraw.a in the lib/ folder
  • +
  • Examples in the bin/ folder (source codes of examples are in the samples/ folder).
  • +
+

In the current version, only static libraries are built:

+
    +
  • libraw.a: non-thread-safe version
  • +
  • libraw_r.a: thread-safe
  • +
+

Build parameters

+

+ ./configure script have some non-standard parameters: +

+
+
+ --enable-openmp
+ --disable-openmp +
+
+ Enable/disable OpenMP support if compiler supports it. + OpenMP is enabled by default. +
+
+ --enable-lcms
+ --disable-lcms +
+
+ Enable/disable LCMS color engine support. If enabled, ./configure will try to + find lcms library. Both LCMS-1.x and LCMS-2.x are supported + LCMS support is enabled by default +
+
+ --enable-examples
+ --disable-examples +
+
+ Enables/disables examples compilation and installation. Enabled by default +
+
+ --enable-demosaic-pack-gpl2
+ --enable-demosaic-pack-gpl2=FOLDERNAME
+ --enable-demosaic-pack-gpl2=no
+ --disable-demosaic-pack-gpl2 +
+
+ Enables/disables support of additional demosaic methods licensed under GPL2 + You need to download and unpack LibRaw-demosaic-pack-GPL2 archive to use + this feature.
+ ./configure will try to find demosaic pack in: +
    +
  • If folder is specified via --enable-demosaic-pack-gpl2=FOLDERNAME + command-line option, then only this folder will be checked. +
  • +
  • If no folder is specified in --enable-demosaic-pack-gpl2 switch: +
      +
    • ./LibRaw-demosaic-pack-GPL2 (in LibRaw folder)
    • +
    • ../LibRaw-demosaic-pack*GPL2* - upper level folder
    • +
    + If several ../LibRaw-demosaic-pack*GPL2* folders exists in upper level + catalog, then ./configure will NOT use any of them due of ambiguity. + Specify exact folder name in this case using + --enable-demosaic-pack-gpl2=FOLDERNAME +
  • +
+
+
+ --enable-demosaic-pack-gpl3
+ --enable-demosaic-pack-gpl3=FOLDERNAME
+ --enable-demosaic-pack-gpl3=no
+ --disable-demosaic-pack-gpl3 +
+
+ Same as above, but for GPL3-licensed demosaic pack. +
+
+

Installation and Usage

+

To install the library, run

+
+    sudo make install
+    
+

+ It will place the libraries in /usr/local/lib, the include-files in /usr/local/include (subfolder of + libraw) and LibRaw samples to /usr/local/bin. You can override installation path by using + ./configure script. +
+ To use LibRaw, add the following parameters to the compiler call (when building your own projects): +

+
    +
  • Path to include-files: -I/usr/local/include
  • +
  • Path to libraries: -L/usr/local/lib
  • +
  • Library: -lraw (ordinary version) or -lraw_r (thread-safe version).
  • +
+

Windows: Building under Cygwin

+

+ Building and installation are completely similar to building and installation under Unix systems. +

+

Windows: Native Building

+

+ Building under Windows has three steps: +

+
    +
  • Unpack the distribution package (if you have got no tar+gzip, take the LibRaw distribution package in the .ZIP format) and go to folder + LibRaw-X.YYY. +
  • +
  • Set the environment parameters so that the compiler/linker would find the libraries and include-files. For Visual C++, this is + done by running vcvars32.bat. +
  • +
  • + Run
    + nmake -f Makefile.msvc
    +
  • +
+

+ If all paths are set correctly and the include-files/libraries have been found, then the following will be compiled:

+
    +
  • Library libraw_static.lib in folder lib
  • +
  • Dynamic library bin/libraw.dll and linking library for it lib/libraw.lib
  • +
  • Examples in folder bin/.
  • +
+

Only the thread-safe library is built under Win32, but it can be used with non-threaded applications as well. All examples are linked + with the dynamic library (DLL); if static linking is necessary, one should link applications with library libraw_static.lib and + set the preprocessor option /DLIBRAW_NODLL during compilation. +

+

+ Windows-version compiles without LCMS support for now. +

+

+ During building of DLL, all public functions are exported; further, the exported subset may be reduced. +

+

+ Unfortunately, paths to include/ libraries depend on the way Visual C (or other compiler) is installed; therefore, it is impossible + to specify some standard paths in Makefile.msvc. +

+

Windows Installation

+

+ No installation under Windows is supported. It is assumed that all DLLs will be supplied together with the software using them + (and this software will perform the installation). Accordingly, in building of programs using LibRaw, the paths to libraries, DLLs, + and include-files should be specified manually. +

+ [back to Index] + + diff -Nru libraw-0.16.2/doc/Install-LibRaw-rus.html libraw-0.17.0/doc/Install-LibRaw-rus.html --- libraw-0.16.2/doc/Install-LibRaw-rus.html 2015-05-16 12:32:15.000000000 +0000 +++ libraw-0.17.0/doc/Install-LibRaw-rus.html 1970-01-01 00:00:00.000000000 +0000 @@ -1,173 +0,0 @@ - - - - LibRaw: компиляция и установка - - - - [вернуться к оглавлению] -

LibRaw: компиляция и установка

-

LibRaw поставляется в исходных текстах, для использования необходимо их скомпилировать (и, при желании, - установить в системные каталоги с библиотеками и include-файлами)

- -

Unix-системы (FreeBSD, Linux, Mac OS X)

-

- Для сборки библиотеки вам нужен работающий компилятор C++ (gcc версий 3.x или 4.x вполне подойдет, сборка - другими компиляторами не тестировалась) и программа make. Никаких других библиотек, утилит и т.п. - не - требуется.

-

- LibRaw тестировалась на 32-битных и 64-битных Unix-системах на x86- (и AMD64-) совместимых процессорах. Сборка - и работоспособность на каких-либо еще архитектурах не тестировалась. -

-

Компиляция библиотеки и примеров

-

- Распакуйте скачанный дистрибутив. Если вы хотите использовать дополнительные наборы интерполяторов - (дебайеризаторов), распакуйте соответствующий архив LibRaw-demosaic-pack: -

-
-        tar xzvf LibRaw-X.YY.tar.gz
-        tar xzvf LibRaw-demosaic-pack-X.YY.tar.gz
-    
-

- Перейдите в каталог ./LibRaw-X.YY и запустите ./configure а затем make: -

-
-        cd LibRaw-X.YY
-        ./configure  # см. ниже параметры ./configure
-        make
-      
-

В результате скомпилируются:

-
    -
  • Библиотеку libraw.a в каталоге lib/
  • -
  • Примеры в каталоге bin/ (исходные тексты примеров находятся в каталоге - samples).
  • -
-

В текущей версии собираются только статические библиотеки:

-
    -
  • libraw.a - не thread_safe вариант
  • -
  • libraw_r.a - thread safe
  • -
-

Для установки выполните команду make install от пользователя с соответствующими правами: -

-     sudo make install
-    
- -

Параметры сборки

-

- Для задания параметров сборки (использование OpenMP, использование LCMS) и установки, запустите - скрипт configure с нужными параметрами (./configure --help покажет список параметров). -

- Описание нестандартных параметров: -

-
--enable-openmp
- --disable-openmp -
-
Включает/выключает проверки поддержки OpenMP если ваш компилятор поддерживает OpenMP. По-умолчанию, - проверка поддержки OpenMP включена. - Если проверкой установлено, что OpenMP поддерживается, то LibRaw будет собрана с OpenMP. -
-
--enable-lcms
- --disable-lcms -
-
Включает-выключает проверку наличия библиотеки LCMS на компьютере. Если проверка включена и - библиотека найдена, то LibRaw будет скомпилирована с поддержкой LCMS. -
-
- --enable-examples
- --disable-examples -
-
Включает-выключает компиляцию примеров использования LibRaw
-
---enable-demosaic-pack-gpl2
---enable-demosaic-pack-gpl2=FOLDERNAME
---enable-demosaic-pack-gpl2=no
---disable-demosaic-pack-gpl2 -
-
Включает (первые две опции)/выключает проверку наличия LibRaw-demosaic-pack-GPL2. - Если проверка включена и каталог с дополнительными дебайеризаторами найден - LibRaw будет собрана с - дополнительными методами интерполяции. -
- Поиск дополнительных дебайеризаторов производится: -
    -
  • Если каталог с дебайеризаторами задан через --enable-demosaic-pack-gpl2=FOLDERNAME, - то только в каталоге FOLDERNAME. -
  • -
  • - Если каталог не указан то поиск будет производиться в -
      -
    • ./LibRaw-demosaic-pack-GPL2 (внутри текущего каталога LibRaw) -
    • -
    • ../LibRaw-demosaic-pack*GPL2* (на один уровень выше). -
    - Во втором случае дополнительный каталог будет подключен только если найден ровно один каталог, - удовлетворяющий маске. Если найдено несколько, подключен не будет ни один из них (т.к. двусмысленность), - задайте в этом случае нужный каталог вручную. -
-
-
---enable-demosaic-pack-gpl3
---enable-demosaic-pack-gpl3=FOLDERNAME
---enable-demosaic-pack-gpl3=no
---disable-demosaic-pack-gpl3 -
-
То же самое, что для demosaic-pack-GPL2 (см. выше). -
- -

Windows, сборка под Cygwin

-

- Сборка и установка полностью аналогична сборке и установке на unix-системах. -

-

Windows, native-сборка

-

- Сборка под Windows делается в три шага: -

-
    -
  • Распакуйте дистрибутив (если у вас нет tar+gzip, возьмите дистрибутив LibRaw в формате .ZIP), перейдите в - каталог LibRaw-X.YYY -
  • -
  • Нужно установить переменные окружения так, чтобы компилятор/линковщик находил библиотеки и - include-файлы. Для Visual C++ это делается запуском vcvars32.bat. -
  • -
  • - Запускается
    - nmake -f Makefile.msvc
    -
  • -
-

- Если все пути установлены правильно и include-файлы/библиотеки нашлись, то скомпилируются:

-
    -
  • Библиотека libraw_static.lib в каталоге lib
  • -
  • Динамическая библиотека bin/libraw.dll и линковочная библиотека к ней lib/libraw.lib
  • -
  • Примеры в каталоге bin
  • -
-

Под Win32 собирается только thread-safe библиотека, ее можно использовать и не с - multi-threaded-приложениями. Все примеры собираются с динамической библиотекой (DLL), - при необходимости использовать статическую сборку, нужно линковаться с библиотекой libraw_static.lib а при - компиляции указывать директиву препроцессора /DLIBRAW_NODLL. -

-

- Windows-версия в настоящее время собирается без поддержки библиотеки LCMS (ICC-профилей). -

-

- При сборке DLL экспортируются все публичные функции, в дальнейшем экспортируемое подмножество может быть - уменьшено. -

-

- К сожалению, пути к include/библиотекам зависят от способа, которым у вас установлен Visual C (или другой - компилятор), поэтому вписать какие-то стандартные пути в Makefile.msvc невозможно. -

-

Windows, установка

-

- Какая-либо установка под Windows не поддерживается, предполагается что все .DLL будут поставляться вместе с - использующей их программой (которая и сделает установку). Соответственно, при сборке программ, использующих - LibRaw путь до библиотек, DLL и include-файлов должен задаваться вручную. -

- [вернуться к оглавлению] -
-
LibRaw Team
- - -Last modified: Fri Nov 19 14:49:22 UTC 2010 - - - diff -Nru libraw-0.16.2/doc/Samples-LibRaw-eng.html libraw-0.17.0/doc/Samples-LibRaw-eng.html --- libraw-0.16.2/doc/Samples-LibRaw-eng.html 2015-05-16 12:32:15.000000000 +0000 +++ libraw-0.17.0/doc/Samples-LibRaw-eng.html 1970-01-01 00:00:00.000000000 +0000 @@ -1,255 +0,0 @@ - - - - LibRaw: Usage Examples - - - - [back to Index] -

LibRaw: Usage Examples

- -

Overview of Examples in the Distribution Package (samples/*)

-

The LibRaw package contains several examples illustrating the use of this library. -Their source codes are located in the samples/ folder, and after library build they will be in the bin/ folder:

-
    -
  • raw-identify The only LibRaw call it uses is open_file(); - further code prints the values of the fields of the imgdata structure. The output of - raw-identify/raw-identify -v is virtually identical to the output of - dcraw -i/dcraw -i -v (in the output of this example, the sources of color data in the numeric - form are additionally printed). Command line key -u shows unpacking function name, while -u -f - prints function name and masked are sizes. -
  • -
  • simple_dcraw A simple "emulation" of dcraw reproducing the behavior of - dcraw [-D] [-e] [-v] [-T]. The result of its work must be binary identical to the result produced by a - dcraw run with relevant keys. A simplified version of this example is considered below. -
    - -B command-line switch turns on use of open_buffer() API call - used via mmap() of input file (Unix only). -
  • -
  • dcraw_half Demonstrates the use of C API. The example emulates the - behavior of dcraw -h (no other control parameters can be specified in this example). The result of its - work must be binary identical to the results produced by dcraw -h. -
  • -
  • dcraw_emu Complete emulation of dcraw (except for keys -D -d -P -K -i -e, which are considered in - other usage examples). Of most interest is processing of command line keys (copied from dcraw). The result of - its work must be binary identical to the results produced by dcraw with the same command line keys. - -

    - This sample supports additional command-line parameters absent in original dcraw: -

    -
    -
    -mmap
    -
    - Use open_buffer() interface. Buffer prepared by mmap() - call. This option not supported under Win32. -
    -
    -meme
    -
    - Use open_buffer() interface. Buffer prepared by - malloc()+read() calls. -
    -
    -c float-value
    -
    - This key sets params.adjust_maximum_thr parameter.
    - Use -c 0 to completely disable automatic maximum calculation. -
    - Default value: 0.75 -
    -
    -timing
    -
    - Turns on detailed timing print. -
    -
    -G
    -
    - Turns on "green_matching" mode to suppress color mazes on cameras with different green channels. -
    -
    -B x y w h
    -
    - Crops output to rectangle with width w, height h and x,y coordinates of left upper corner. - All coordinates applied before any image rotation. -
    -
    -dcbi N
    -
    - Sets number of additional DCB-demosaic iterations (option valid only for -q 4, i.e. for DCB demosaic). -
    -
    -dcbe
    -
    - Turns on DCB color enhance mode (only for DCB demosaic, -q 4). -
    -
    -eeci
    -
    - Turns on EECI refine (only for mixed VCD/AHD -q 8) -
    -
    -esmed N
    -
    - Number of passes of edge-sensitive median filter for VCD+AHD demosaic. -
    -
    -acae r b
    -
    - Turns on chromatic aberration suppression. r and b parameters are amount of red and blue axis correction - respectively. For automatic correction use -acae 0 0. -
    -
    -aline l
    -
    - Turns on banding suppression. l is the correction amount, useable range is from 0.001 to 0.02, typical - value is 0.005. -
    -
    -aclean l c
    -
    - Turns on impulse noise suppression. l and c are luminocity and chrominance suppression values, - respectively. Useable range for both is 0.005-0.05 and typical value is 0.01. -
    -
    -agreen g
    -
    - Turns on green channels equalization on uniform surfaces. g is the algorithm sensitivity with - useable range 0.01-0.1 and typical value 0.03. -
    -
    -aexpo e p
    -
    - Turns on exposure correction. e is exposure shift in linear scale from 0.25 (darken 2 stops) to - 8.0 (lighten 3 stops). p is highlights preservation amount from 0.0 (no preservation, full clipping) - to 1.0 (full preservation, S-like curve in highlights). -
    -
    -
  • -
  • half_mt Emulation of dcraw -h. It "understands" the following keys: -a (automatic - white balance over the entire image), -w (white balance of the camera), -T (output in the tiff format), and -J - n (number of parallel threads launched for image processing).
    - On multiprocessor/multicore computers, the speed gain is notable in the case of mass processing. On a - Win32 machine, the example is assembled from the initial file half_mt_win32.c, since - work with threads under Windows is fundamentally different and it it easier to copy simple source codes - than write one complex code. -
  • -
  • mem_image This sample uses - dcraw_make_mem_image and - dcraw_make_mem_thumb calls, than writes data in PPM - format. Results should be identical with dcraw with same command-line options (options supported: - -4, -1, -e, -h). -
  • -
  • unprocessed_raw This sample extracts (mostly) unaltered RAW data including masked pixels - data (on supported cameras). - If black frame exists and black frame extraction is supported for given format, masked pixels - data is added to resulting .TIFF file. - Command line options: -q - be quiet, -A - autoscale data (integer multiplier), - -g gamma-correction (gamma 2.2) for data (instead of precise linear one), -B turns on black - level subtraction -
  • -
  • 4channnels - splits RAW-file into four separate 16-bit grayscale TIFFs (per RAW channel).
    - Command line switches: -
      -
    • -s N selects N-th image from RAW with multiple images
    • -
    • -g gamma correction (gamma 2.2)
    • -
    • -A values autoscale by auto-calculated integer factor
    • -
    • -B turn off black subtraction
    • -
    • -N no RAW curve
    • -
    -
  • -
  • multirender_test - very simple example of multiple rendering on one file without reopen. -
  • -
-

Example of docmode

-

Below we consider the samples/simple_dcraw.cpp example, which emulates the behavior of - dcraw [-D] [-e][-v][-t]. To save space, let us assume that keys -t -v are always specified (to avoid - comments on command line parsing) and there is always one parameter (name of file), which is the only one and - always passed to the program. -

-
-int main(int ac, char *av[])
-{
-    int  i, ret, verbose=0, output_thumbs=0;
-    char outfn[1024],thumbfn[1024]; 
-
-    // Creation of image processing object
-    LibRaw RawProcessor;
-    
-    // The date in TIFF is written in the local format; let us specify the timezone for compatibility with dcraw 
-    putenv ((char*)"TZ=UTC"); 
-
-// Let us define variables for convenient access to fields of RawProcessor
-
-#define P1  RawProcessor.imgdata.idata
-#define S   RawProcessor.imgdata.sizes
-#define C   RawProcessor.imgdata.color
-#define T   RawProcessor.imgdata.thumbnail
-#define P2  RawProcessor.imgdata.other
-#define OUT RawProcessor.imgdata.params
-
-    OUT.output_tiff = 1; // Let us output TIFF
-
-   // Let us open the file
-   if( (ret = RawProcessor.open_file(av[1])) != LIBRAW_SUCCESS)
-      {
-          fprintf(stderr,"Cannot open %s: %s\n",av[i],libraw_strerror(ret));
-
-          // recycle() is needed only if we want to free the resources right now. 
-          // If we process files in a cycle, the next open_file() 
-          // will also call recycle(). If a fatal error has happened, it means that recycle()
-          // has already been called (repeated call will not cause any harm either).
-
-          RawProcessor.recycle(); 
-          goto end;
-      }
-
-   // Let us unpack the image
-   if( (ret = RawProcessor.unpack() ) != LIBRAW_SUCCESS)
-      {
-          fprintf(stderr,"Cannot unpack_thumb %s: %s\n",av[i],libraw_strerror(ret));
-
-          if(LIBRAW_FATAL_ERROR(ret))
-                    goto end;
-          // if there has been a non-fatal error, we will try to continue
-      }
-  // Let us unpack the thumbnail
-  if( (ret = RawProcessor.unpack_thumb() ) != LIBRAW_SUCCESS)
-     {
-          // error processing is completely similar to the previous case
-           fprintf(stderr,"Cannot unpack_thumb %s: %s\n",av[i],libraw_strerror(ret));
-           if(LIBRAW_FATAL_ERROR(ret))
-                   goto end; 
-    }
-  else // We have successfully unpacked the thumbnail, now let us write it to a file
-    {
-      snprintf(thumbfn,sizeof(thumbfn),"%s.%s",av[i],T.tformat == LIBRAW_THUMBNAIL_JPEG ? "thumb.jpg" : "thumb.ppm");
-      if( LIBRAW_SUCCESS != (ret = RawProcessor.dcraw_thumb_writer(thumbfn)))
-        {
-                fprintf(stderr,"Cannot write %s: %s\n",thumbfn,libraw_strerror(ret));
-
-                // in the case of fatal error, we should terminate processing of the current file
-                if(LIBRAW_FATAL_ERROR(ret))
-                          goto end; 
-        }
-    }
-   // Data unpacking
-   ret = RawProcessor.dcraw_process();
-
-    if(LIBRAW_SUCCESS != ret ) // error at the previous step
-          {
-               fprintf(stderr,"Cannot do postprocessing on %s: %s\n",av[i],libraw_strerror(ret));
-               if(LIBRAW_FATAL_ERROR(ret))
-                        goto end;
-          }
-   else  // Successful document processing
-     {
-        snprintf(outfn,sizeof(outfn),"%s.%s", av[i], "tiff");
-        if( LIBRAW_SUCCESS != (ret = RawProcessor.dcraw_ppm_tiff_writer(outfn)))
-                fprintf(stderr,"Cannot write %s: error %d\n",outfn,ret);
-     }
-
-  // we don't evoke recycle() or call the desctructor; C++ will do everything for us
-  return 0;
-end:
-  // got here after an error
-  return 1;
-}
-
- - - [back to Index] -
-
LibRaw Team
- - -Last modified: Fri Aug 24 00:31:06 MSK 2012 - - - diff -Nru libraw-0.16.2/doc/Samples-LibRaw.html libraw-0.17.0/doc/Samples-LibRaw.html --- libraw-0.16.2/doc/Samples-LibRaw.html 1970-01-01 00:00:00.000000000 +0000 +++ libraw-0.17.0/doc/Samples-LibRaw.html 2015-08-15 13:10:27.000000000 +0000 @@ -0,0 +1,249 @@ + + + + LibRaw: Usage Examples + + + + [back to Index] +

LibRaw: Usage Examples

+ +

Overview of Examples in the Distribution Package (samples/*)

+

The LibRaw package contains several examples illustrating the use of this library. +Their source codes are located in the samples/ folder, and after library build they will be in the bin/ folder:

+
    +
  • raw-identify The only LibRaw call it uses is open_file(); + further code prints the values of the fields of the imgdata structure. The output of + raw-identify/raw-identify -v is virtually identical to the output of + dcraw -i/dcraw -i -v (in the output of this example, the sources of color data in the numeric + form are additionally printed). Command line key -u shows unpacking function name, while -u -f + prints function name and masked are sizes. +
  • +
  • simple_dcraw A simple "emulation" of dcraw reproducing the behavior of + dcraw [-D] [-e] [-v] [-T]. The result of its work must be binary identical to the result produced by a + dcraw run with relevant keys. A simplified version of this example is considered below. +
    + -B command-line switch turns on use of open_buffer() API call + used via mmap() of input file (Unix only). +
  • +
  • dcraw_half Demonstrates the use of C API. The example emulates the + behavior of dcraw -h (no other control parameters can be specified in this example). The result of its + work must be binary identical to the results produced by dcraw -h. +
  • +
  • dcraw_emu Complete emulation of dcraw (except for keys -D -d -P -K -i -e, which are considered in + other usage examples). Of most interest is processing of command line keys (copied from dcraw). The result of + its work must be binary identical to the results produced by dcraw with the same command line keys. + +

    + This sample supports additional command-line parameters absent in original dcraw: +

    +
    +
    -mmap
    +
    + Use open_buffer() interface. Buffer prepared by mmap() + call. This option not supported under Win32. +
    +
    -meme
    +
    + Use open_buffer() interface. Buffer prepared by + malloc()+read() calls. +
    +
    -c float-value
    +
    + This key sets params.adjust_maximum_thr parameter.
    + Use -c 0 to completely disable automatic maximum calculation. +
    + Default value: 0.75 +
    +
    -timing
    +
    + Turns on detailed timing print. +
    +
    -G
    +
    + Turns on "green_matching" mode to suppress color mazes on cameras with different green channels. +
    +
    -B x y w h
    +
    + Crops output to rectangle with width w, height h and x,y coordinates of left upper corner. + All coordinates applied before any image rotation. +
    +
    -dcbi N
    +
    + Sets number of additional DCB-demosaic iterations (option valid only for -q 4, i.e. for DCB demosaic). +
    +
    -dcbe
    +
    + Turns on DCB color enhance mode (only for DCB demosaic, -q 4). +
    +
    -eeci
    +
    + Turns on EECI refine (only for mixed VCD/AHD -q 8) +
    +
    -esmed N
    +
    + Number of passes of edge-sensitive median filter for VCD+AHD demosaic. +
    +
    -acae r b
    +
    + Turns on chromatic aberration suppression. r and b parameters are amount of red and blue axis correction + respectively. For automatic correction use -acae 0 0. +
    +
    -aline l
    +
    + Turns on banding suppression. l is the correction amount, useable range is from 0.001 to 0.02, typical + value is 0.005. +
    +
    -aclean l c
    +
    + Turns on impulse noise suppression. l and c are luminocity and chrominance suppression values, + respectively. Useable range for both is 0.005-0.05 and typical value is 0.01. +
    +
    -agreen g
    +
    + Turns on green channels equalization on uniform surfaces. g is the algorithm sensitivity with + useable range 0.01-0.1 and typical value 0.03. +
    +
    -aexpo e p
    +
    + Turns on exposure correction. e is exposure shift in linear scale from 0.25 (darken 2 stops) to + 8.0 (lighten 3 stops). p is highlights preservation amount from 0.0 (no preservation, full clipping) + to 1.0 (full preservation, S-like curve in highlights). +
    +
    +
  • +
  • half_mt Emulation of dcraw -h. It "understands" the following keys: -a (automatic + white balance over the entire image), -w (white balance of the camera), -T (output in the tiff format), and -J + n (number of parallel threads launched for image processing).
    + On multiprocessor/multicore computers, the speed gain is notable in the case of mass processing. On a + Win32 machine, the example is assembled from the initial file half_mt_win32.c, since + work with threads under Windows is fundamentally different and it it easier to copy simple source codes + than write one complex code. +
  • +
  • mem_image This sample uses + dcraw_make_mem_image and + dcraw_make_mem_thumb calls, than writes data in PPM + format. Results should be identical with dcraw with same command-line options (options supported: + -4, -1, -e, -h). +
  • +
  • unprocessed_raw This sample extracts (mostly) unaltered RAW data including masked pixels + data (on supported cameras). + If black frame exists and black frame extraction is supported for given format, masked pixels + data is added to resulting .TIFF file. + Command line options: -q - be quiet, -A - autoscale data (integer multiplier), + -g gamma-correction (gamma 2.2) for data (instead of precise linear one), -B turns on black + level subtraction +
  • +
  • 4channnels - splits RAW-file into four separate 16-bit grayscale TIFFs (per RAW channel).
    + Command line switches: +
      +
    • -s N selects N-th image from RAW with multiple images
    • +
    • -g gamma correction (gamma 2.2)
    • +
    • -A values autoscale by auto-calculated integer factor
    • +
    • -B turn off black subtraction
    • +
    • -N no RAW curve
    • +
    +
  • +
  • multirender_test - very simple example of multiple rendering on one file without reopen. +
  • +
+

Example of docmode

+

Below we consider the samples/simple_dcraw.cpp example, which emulates the behavior of + dcraw [-D] [-e][-v][-t]. To save space, let us assume that keys -t -v are always specified (to avoid + comments on command line parsing) and there is always one parameter (name of file), which is the only one and + always passed to the program. +

+
+int main(int ac, char *av[])
+{
+    int  i, ret, verbose=0, output_thumbs=0;
+    char outfn[1024],thumbfn[1024]; 
+
+    // Creation of image processing object
+    LibRaw RawProcessor;
+    
+    // The date in TIFF is written in the local format; let us specify the timezone for compatibility with dcraw 
+    putenv ((char*)"TZ=UTC"); 
+
+// Let us define variables for convenient access to fields of RawProcessor
+
+#define P1  RawProcessor.imgdata.idata
+#define S   RawProcessor.imgdata.sizes
+#define C   RawProcessor.imgdata.color
+#define T   RawProcessor.imgdata.thumbnail
+#define P2  RawProcessor.imgdata.other
+#define OUT RawProcessor.imgdata.params
+
+    OUT.output_tiff = 1; // Let us output TIFF
+
+   // Let us open the file
+   if( (ret = RawProcessor.open_file(av[1])) != LIBRAW_SUCCESS)
+      {
+          fprintf(stderr,"Cannot open %s: %s\n",av[i],libraw_strerror(ret));
+
+          // recycle() is needed only if we want to free the resources right now. 
+          // If we process files in a cycle, the next open_file() 
+          // will also call recycle(). If a fatal error has happened, it means that recycle()
+          // has already been called (repeated call will not cause any harm either).
+
+          RawProcessor.recycle(); 
+          goto end;
+      }
+
+   // Let us unpack the image
+   if( (ret = RawProcessor.unpack() ) != LIBRAW_SUCCESS)
+      {
+          fprintf(stderr,"Cannot unpack_thumb %s: %s\n",av[i],libraw_strerror(ret));
+
+          if(LIBRAW_FATAL_ERROR(ret))
+                    goto end;
+          // if there has been a non-fatal error, we will try to continue
+      }
+  // Let us unpack the thumbnail
+  if( (ret = RawProcessor.unpack_thumb() ) != LIBRAW_SUCCESS)
+     {
+          // error processing is completely similar to the previous case
+           fprintf(stderr,"Cannot unpack_thumb %s: %s\n",av[i],libraw_strerror(ret));
+           if(LIBRAW_FATAL_ERROR(ret))
+                   goto end; 
+    }
+  else // We have successfully unpacked the thumbnail, now let us write it to a file
+    {
+      snprintf(thumbfn,sizeof(thumbfn),"%s.%s",av[i],T.tformat == LIBRAW_THUMBNAIL_JPEG ? "thumb.jpg" : "thumb.ppm");
+      if( LIBRAW_SUCCESS != (ret = RawProcessor.dcraw_thumb_writer(thumbfn)))
+        {
+                fprintf(stderr,"Cannot write %s: %s\n",thumbfn,libraw_strerror(ret));
+
+                // in the case of fatal error, we should terminate processing of the current file
+                if(LIBRAW_FATAL_ERROR(ret))
+                          goto end; 
+        }
+    }
+   // Data unpacking
+   ret = RawProcessor.dcraw_process();
+
+    if(LIBRAW_SUCCESS != ret ) // error at the previous step
+          {
+               fprintf(stderr,"Cannot do postprocessing on %s: %s\n",av[i],libraw_strerror(ret));
+               if(LIBRAW_FATAL_ERROR(ret))
+                        goto end;
+          }
+   else  // Successful document processing
+     {
+        snprintf(outfn,sizeof(outfn),"%s.%s", av[i], "tiff");
+        if( LIBRAW_SUCCESS != (ret = RawProcessor.dcraw_ppm_tiff_writer(outfn)))
+                fprintf(stderr,"Cannot write %s: error %d\n",outfn,ret);
+     }
+
+  // we don't evoke recycle() or call the desctructor; C++ will do everything for us
+  return 0;
+end:
+  // got here after an error
+  return 1;
+}
+
+ + + [back to Index] + + diff -Nru libraw-0.16.2/doc/Samples-LibRaw-rus.html libraw-0.17.0/doc/Samples-LibRaw-rus.html --- libraw-0.16.2/doc/Samples-LibRaw-rus.html 2015-05-16 12:32:15.000000000 +0000 +++ libraw-0.17.0/doc/Samples-LibRaw-rus.html 1970-01-01 00:00:00.000000000 +0000 @@ -1,258 +0,0 @@ - - - - LibRaw: примеры использования - - - - [вернуться к оглавлению] -

LibRaw: примеры использования

- -

Обзор примеров в дистрибутиве (samples/*)

-

В поставку LibRaw включено несколько примеров использования библиотеки, их исходные тексты расположены в - каталоге samples/, после сборки они оказываются в каталоге bin/:

-
    -
  • raw-identify Из вызовов LibRaw используется только open_file(), далее идет код, печатающий значения полей структуры - imgdata. Выдача raw-identify/raw-identify -v практически полностью копирует выдачу dcraw - -i/dcraw -i -v (в выдаче примера дополнительно печатаются источники цветовых данных и легенда к - ним). -

    - Дополнительные параметры, отсутствующие у dcraw: -u - печатать имя функции - распаковщика данных; - -u -f - печатать имя распаковщика и размер черной (маскированной) рамки. -

    -
  • -
  • simple_dcraw Простой "эмулятор" dcraw, воспроизводящий поведение dcraw [-D] [-e] [-v] - [-T]. Результат работы должен бинарно совпадать с результатами работы dcraw запущенной с нужными - ключами. Упрощенный вариант этого примера рассмотрен ниже.
    - Ключ -B включает использование интерфейса open_buffer() - куда передается mmap()-ed файл (Unix only). - -
  • -
  • dcraw_half Демонстрация использования C API. Пример эмулирует поведение - dcraw -h (какие-то еще управляющие параметры этому примеру задать нельзя). Результат работы должен - бинарно совпадать с результатами работы dcraw -h. -
  • -
  • dcraw_emu Полный эмулятор dcraw (за исключением ключей -D -d -P -K -i -e, которые обрабатываются в - других примерах использования). Основной интерес представляет обработка ключей командной строки (скопированная - из dcraw). Результат работы должен бинарно совпадать с результатом работы dcraw с теми же ключами командной - строки. -

    - Этот пример поддерживает дополнительные ключи, отсутствующие в оригинальной dcraw: -

    -
    -
    -mmap
    -
    - Включает использование интерфейса open_buffer() - куда передается mmap()-ed файл (Unix only). -
    -
    -mem
    -
    - Входной файл читается в буфер в памяти и раскодируется оттуда. -
    -
    -c значение в диапазоне 0-1
    -
    - Ключ меняет значение параметра params.adjust_maximum_thr. - Для отключения автоматического вычисления максимума, поставьте этот параметр в 0.0. -
    - Умолчание: 0.75 -
    -
    -timing
    -
    - Включает тайминг отдельных этапов обработки. -
    -
    -G
    -
    - Включает green_matching: выравнивание каналов зеленого для тех камер, где эти каналы различаются. -
    -
    -B x y w h
    -
    - Включает обрезание (cropping) выходного изображения до прямоугольника с - верхним левым углом в x,y шириной w и высотой h. Координаты и размеры - до поворотов изображения (если - применяются повороты). -
    -
    -dcbi N
    -
    Устанавливает количество дополнительных итераций алгоритма DCB (только для -q 4). - Умолчание - 0 (нет дополнительных итераций) -
    -
    -dcbe
    -
    - Включает режим DCB color enhance (только для -q 4). -
    -
    -eeci
    -
    - Включает режим EECI refine (только для mixed VCD/AHD -q 8) -
    -
    -esmed N
    -
    - Количество проходов edge-sensitive median filter для интерполяции VCD+AHD -
    -
    -acae r b
    -
    - Включает режим подавления хроматической аберрации. Параметры r и b означают величину коррекции по красной - и синей осям. Эти параметры обязательны, для автоматической коррекции следует использовать - -acae 0 0 -
    -
    -aline l
    -
    - Включает режим подавления полосатости (banding). l - степень подавления шума, диапазон значений - 0.001-0.02, типичное значение 0.005 -
    -
    -aclean l c
    -
    - Включает режим подавления импульсного шума. l - степень подавления яркостного (luminocity) шума, - c - цветового (chrominance) шума. Разумный диапазон значений обоих параметров 0.005-0.05, типовое - 0.01. -
    -
    -agreen g
    -
    - Включает режим выравнивания зеленых каналов на равномерных поверхностях. g - степень чувствительности - алгоритма, диапазон значений 0.01-0.1, типичное значение 0.03. -
    -
    -aexpo e p
    -
    - Включает экспокоррекцию (до демозаики). e - величина экспокоррекции (в линейной шкале), диапазон от 0.25 - (-2 стопа) до 8 (+3 стопа). p - степень предохранения светов при положительной экспокоррекции, диапазон от - 0.0 (просто линейный сдвиг данных с клиппингом) до 1.0 (полное отсутствие дополнительного клиппинга от - экспокоррекции). -
    -
    -
  • -
  • half_mt Эмулятор dcraw -h, понимает ключи -a (автоматический баланс белого по всему - изображению), -w (баланс белого камеры), -T (выводить в tiff) и -J n - количество параллельных threads, - запускаемых для обработки изображений.
    - На мультипроцессорных/multicore машинах дает существенный выигрыш в скорости при массовой обработке.
    - На Win32-машине пример собирается из исходного файла half_mt_win32.c, причина в том, что работа с threads на - Windows принципиально другая и проще размножить простые исходники, чем написать один сложный. -
  • -
  • mem_image Пример использования функций - dcraw_make_mem_image и - dcraw_make_mem_thumb: распаковка изображений и preview() - в память с последующей простой записью в форматах PPM (и JPEG для thumbnail). Результат работы должен быть - идентичен результатам работы dcraw с теми же ключами (поддерживаются ключи -4, -1, -e, -h). -
  • -
  • unprocessed_raw - извлечение максимально неизмененных RAW-данных, без вычитания уровня черного - и маскирования черных пикселов (на тех камерах, где возможно маскирование). Для тех камер, которые выдают - в RAW-данные черную рамку (маскированные пикселы) - рамка включается в выдаваемые данные. - Ключи командной строки: -q - не выдавать текстовую справку о размерах файла, -A - - автомасштабирование данных в целое число раз, -g выдавать гамма-корректированные (2.2) данные, а не - линейные, -N - выключает наложение тоновой кривой на RAW-данные, -B включает вычитание уровня - черного из данных, -M добавляет маскированную рамку к результирующему изображению. -
  • -
  • 4channnels - сохраняет RAW-файл в виде 4 отдельных 16-битных grayscale TIFF-файлов (поканально).
    - Ключи командной строки: -
      -
    • -s N выбрать N-е изображение (для файлов с несколькими изображениями)
    • -
    • -g выводить гамма-корректированное (2.2) изображение
    • -
    • -A автомасштабирование значений в целое число раз
    • -
    • -B отключить вычитание уровня черного
    • -
    • -N отключить тоновую кривую для RAW
    • -
    -
  • -
  • multirender_test - простой пример, показывающий возможность множественной постобработки с - разными параметрами без переоткрытия файла. -
  • -
- -

Пример simple_dcraw

-

Ниже рассмотрен пример samples/simple_dcraw.cpp - эмулирующий поведение dcraw [-D] [-e][-v][-t]. Для - экономии места представим, что всегда заданы ключи -t -v (чтобы не комментировать разбор командной строки) - и что параметр (имя файла) всегда один и всегда передается. -

-
-int main(int ac, char *av[])
-{
-    int  i, ret, verbose=0, output_thumbs=0;
-    char outfn[1024],thumbfn[1024]; 
-
-    // Создадим объект - обработчик изображений.
-    LibRaw RawProcessor;
-    
-    // В TIFF пишется дата в локальном формате, для совместимости с dcraw поставим таймзону
-    putenv ((char*)"TZ=UTC"); 
-
-// Определим переменные для удобного доступа к полям RawProcessor
-#define P1  RawProcessor.imgdata.idata
-#define S   RawProcessor.imgdata.sizes
-#define C   RawProcessor.imgdata.color
-#define T   RawProcessor.imgdata.thumbnail
-#define P2  RawProcessor.imgdata.other
-#define OUT RawProcessor.imgdata.params
-
-    OUT.output_tiff = 1; // Выводить будем TIFF
-
-   // Откроем файл
-   if( (ret = RawProcessor.open_file(av[1])) != LIBRAW_SUCCESS)
-      {
-          fprintf(stderr,"Cannot open %s: %s\n",av[i],libraw_strerror(ret));
-
-          // recycle() нужен только если мы хотим освободить ресурсы прямо сейчас.
-          // Если мы обрабатываем файлы в цикле, то следующий open_file() 
-          // тоже вызовет recycle. Если случилась фатальная ошибка, то recycle()
-          // уже вызван (вреда от повторного вызова тоже нет)
-
-          RawProcessor.recycle(); 
-          goto end;
-      }
-
-   // Распакуем изображение
-   if( (ret = RawProcessor.unpack() ) != LIBRAW_SUCCESS)
-      {
-          fprintf(stderr,"Cannot unpack_thumb %s: %s\n",av[i],libraw_strerror(ret));
-
-          if(LIBRAW_FATAL_ERROR(ret))
-                    goto end;
-          // для нефатальной ошибки - пробуем продолжить
-      }
-  // Распакуем thumbnail
-  if( (ret = RawProcessor.unpack_thumb() ) != LIBRAW_SUCCESS)
-     {
-          // обработка ошибки полностью аналогична предыдущему случаю
-           fprintf(stderr,"Cannot unpack_thumb %s: %s\n",av[i],libraw_strerror(ret));
-           if(LIBRAW_FATAL_ERROR(ret))
-                   goto end; 
-    }
-  else // Успешно распаковали thumbnail, запишем его в файл
-    {
-      snprintf(thumbfn,sizeof(thumbfn),"%s.%s",av[i],T.tformat == LIBRAW_THUMBNAIL_JPEG ? "thumb.jpg" : "thumb.ppm");
-      if( LIBRAW_SUCCESS != (ret = RawProcessor.dcraw_thumb_writer(thumbfn)))
-        {
-                fprintf(stderr,"Cannot write %s: %s\n",thumbfn,libraw_strerror(ret));
-
-                // в случае фатальной ошибки мы должны заканчивать обработку текущего файла
-                if(LIBRAW_FATAL_ERROR(ret))
-                          goto end; 
-        }
-    }
-   // Распаковка данных
-   ret = RawProcessor.dcraw_process();
-
-    if(LIBRAW_SUCCESS != ret ) // ошибка на предыдущем шаге
-          {
-               fprintf(stderr,"Cannot do postprocessing on %s: %s\n",av[i],libraw_strerror(ret));
-               if(LIBRAW_FATAL_ERROR(ret))
-                        goto end;
-          }
-   else  // Успешная обработка документа
-     {
-        snprintf(outfn,sizeof(outfn),"%s.%s", av[i], "tiff");
-        if( LIBRAW_SUCCESS != (ret = RawProcessor.dcraw_ppm_tiff_writer(outfn)))
-                fprintf(stderr,"Cannot write %s: error %d\n",outfn,ret);
-     }
-
-  // Не делаем recycle, не зовем деструктор, C++ все делает за нас.
-  return 0;
-end:
-  // сюда попали после ошибки
-  return 1;
-}
-
- - [вернуться к оглавлению] -
-
LibRaw Team
- - -Last modified: Mon Jul 11 20:23:33 MSD 2011 - - - diff -Nru libraw-0.16.2/doc/Why-LibRaw-eng.html libraw-0.17.0/doc/Why-LibRaw-eng.html --- libraw-0.16.2/doc/Why-LibRaw-eng.html 2015-05-16 12:32:15.000000000 +0000 +++ libraw-0.17.0/doc/Why-LibRaw-eng.html 1970-01-01 00:00:00.000000000 +0000 @@ -1,209 +0,0 @@ - - - - Purpose and Objectives - - - - [back to Index] -

LibRaw Project Goals and Objectives

-

Contents

-
    -
  1. Who May Be Interested in This Project
  2. -
  3. Goals and Objectives
  4. -
  5. LibRaw Support Principles
  6. -
  7. Implemented Improvements of dcraw
  8. -
  9. Planned Improvements
  10. -
- - -

Who May Be Interested in This Project

-

The proposed project and the software products generated within this project are intended for

-
    -
  • Developers of RAW converters, including current and new developments
  • -
  • Those willing to write their own graphic interface for RAW file processing
  • -
  • Developers and enthusiasts creating their own primary and auxiliary data processing algorithms, -including -
      -
    • Interpolation (de-Bayer),
    • -
    • Noise reduction
    • -
    • White balance
    • -
    • Correction of aberrations and distortions
    • -
    • Color conversions (e.g., creation, editing and application of camera profiles )
    • -
    • RAW data analysis
    • -
    • Comparison of cameras and lenses
    • -
    • and so on...
    • -
    -
  • -
-

Among the few existing implementations of RAW converters, those based on the - dcraw utility by Dave Coffin are the most used. -It is hard to find a more or less popular camera that is not supported by this -utility; while the implementation of RAW data extraction in dcraw is of -a very high quality. -

-

However, developers and enthusiasts who use or are going to use dcraw for - fulfilling the above-listed and similar objectives encounter a - number of difficulties. First, the author of dcraw refuses to turn his - product into a handy library, yet permitting anybody else to do so. - Besides, dcraw contains a number of questionable features which may - hinder its use without modifications, as well as instances of - distortions in the photographic sense of it. As a result, once every - several months, virtually all developers, part of them listed on the - dcraw Web site, independently convert each subsequent release of the - software into the library. -

-

- As for enthusiasts, the "entry cost" of verifying their own ideas and - implementing their own algorithms is often unreasonably high: they have - to either use the dcraw command line, thus being forced to use the - unavoidable early processing stages, or understand the source code and - maintain their own library based on it. -

-

- Thus, the inconveniences of dcraw make the developers' community quite - small and halt further evolution and improvement of RAW format - converters. -

- -

Goals and Objectives

-

We are going to create LibRaw in order to "get a library based on dcraw, only better". Thus: -

-
    -
  1. To "librarize" dcraw, i.e., to develop a stable and consistent API suitable for other applications - (RAW converters, data analyzers, panorama stitchers, etc.). -
  2. -
  3. To divide processing into independent parts (groups of API calls) -
      -
    • Reading, decoding, and unpacking of RAW data: this is the main functionality of LibRaw
    • -
    • Data conversions: interpolation, white balance, etc.
    • -
    • File output of the processing results.
    • -
    - The latter two groups of functions are maintained primarily for dcraw compatibility testing. -
  4. -
  5. To improve the procedures of RAW data retrieval and decoding (see below for details) -
  6. -
  7. To supply other developers with a "framework" (freeware and open-source), e.g., -for experimenting with their own methods of RAW data processing -(interpolation, noise reduction, white balance, etc.; some directions -of the possible efforts are listed above), -so that they could create their own GUI programs and interfaces without developing the entire RAW converter.
  8. -
  9. To ensure easy modification for code synchronization with dcraw releases.
  10. -
- - -

LibRaw Support Principles

-
    -
  1. To reproduce the functionality of dcraw using its source code as the basis for our work; to -achieve binary identity of results generated by dcraw and by LibRaw-based utilities, provided the same processing settings are used. -
  2. -
  3. To eliminate the shortcomings of dcraw (see sections -Implemented Improvements of dcraw and Planned Improvements). -
  4. -
  5. To monitor future improvements in dcraw (support of new cameras, error correction, -use of better algorithms) and import them from dcraw to LibRaw. -
  6. -
  7. API modifications: the planned improvements will require extending -of the API. Such changes will be introduced in the form of large change-sets, -while the compatibility mode supporting older - applications based on the legacy API set will be preserved as long - as possible. -
  8. -
- - -

Implemented Improvements of dcraw

-

- As of the time of writing, additional improvements to the dcraw source - code have been introduced into LibRaw: -

-
    -
  • - All global variables have been removed (while linking the - thread-safe version, static variables of functions have been - removed as well). -
  • -
  • Thread safety. An example of its use in the multithreaded model is included into the library distribution package. -
  • -
  • - Data extracted from a RAW file is already somewhat structured: - geometry is separated from color data. - This work has not yet been completed; it will be continued simultaneously with the -work on improvement of EXIF processing. -
  • -
  • Retrieval of RAW data and thumbnail can be performed in two or three API calls with a very simple - program interface. -
  • -
  • Work with color information: color data (white balance coefficients, tone curve, etc.) has flags referencing - the source of this information: retrieved from RAW data, calculated - from the image itself, or taken from the code as constants. -
  • -
  • ICC profile is extracted (for those RAW files that contain it).
  • -
  • The image itself and the thumbnail can be retrieved by successive calls, without reopening the file - or relaunching the library. -
  • -
  • The required amount of RAM is somewhat lower.
  • -
  • Work with black subtraction:: it is possible to turn off black level subtraction.
  • -
  • Processing of the black frame: black subtraction and zero pixel cleaning already can be turned off. - Code for accurate black level calculation and banding suppression is planned. -
  • -
  • The maximum values may also be nonidentical for different channels; accordingly, these values - are calculated at the stage of RAW data unpacking and output within the framework of the API. Calculation of - the maximum values for a given camera sample at a specified sensitivity (converter calibration) is to be done - in the application that calls LibRaw. -
  • - - -
- - -

Planned Improvements

-

The dcraw code needs significant modifications and additions:

-
    -
  • Single-pass unpacking of RAW files containing several image variants/planes: for applicable cameras - (Fuji cameras, cameras with 4-shot/16-shot modes), several planes of the same image will be extracted. -
  • - -
  • Data unpacking verifications for the widest possible set of file formats. According to some studies, - dcraw does not completely ensure correct unpacking of some data formats. -
  • - -
  • Processing of the EXIF/Makernote data: retrieval of large data amounts, including -
      -
    • Extraction of the maximum possible amount of color data (white balance settings, - profile, tone curve, contrast settings, etc.)
    • - -
    • Color data generalization: reduction of color data from different cameras - "to a common denominator" in order to facilitate color processing (without loss of quality)
    • - -
    • Extraction of camera data (firmware version, serial number)
    • - -
    • Extraction of photographic data (lens used, focusing distance, focus points and their coordinates, etc.)
    • - -
    • Extraction of the bulk EXIF data set without analyzing the structure in order to - facilitate copying of that EXIF data to output files.
    • -
    -
  • -
  • Generalization of work with complex formats, including -
      -
    • RAW files from Fuji cameras (with two sets of sensors)
    • -
    • RAW files from digital backs with 4-shot and 16-shot modes.
    • -
    -
  • -
-

At the same time, we are not planning any modifications or extensions of the dcraw data processing code - (de-Bayer, color conversions, etc.); all of this is up to the calling application. Standard processing modes - included in dcraw will be preserved for an indefinite time in the set - of dcraw-emulating API calls, with the exception of LCMS and libjpeg - support, as well as certain processing stages of minor importance. -

- - [back to Index] -
-
LibRaw Team
- - -Last modified: Mon Jul 11 20:20:12 MSD 2011 - - - diff -Nru libraw-0.16.2/doc/Why-LibRaw.html libraw-0.17.0/doc/Why-LibRaw.html --- libraw-0.16.2/doc/Why-LibRaw.html 1970-01-01 00:00:00.000000000 +0000 +++ libraw-0.17.0/doc/Why-LibRaw.html 2015-08-15 13:10:27.000000000 +0000 @@ -0,0 +1,117 @@ + + + + Purpose and Objectives + + + + [back to Index] +

LibRaw Project Goals and Objectives

+

Contents

+
    +
  1. Who May Be Interested in This Project
  2. +
  3. Goals and Objectives
  4. +
  5. LibRaw Support Principles
  6. +
+ + +

Who May Be Interested in This Project

+

The proposed project and the software products generated within this project are intended for

+
    +
  • Developers of RAW converters, including current and new developments
  • +
  • Those willing to write their own graphic interface for RAW file processing
  • +
  • Developers and enthusiasts creating their own primary and auxiliary data processing algorithms, +including +
      +
    • Interpolation (de-Bayer),
    • +
    • Noise reduction
    • +
    • White balance
    • +
    • Correction of aberrations and distortions
    • +
    • Color conversions (e.g., creation, editing and application of camera profiles )
    • +
    • RAW data analysis
    • +
    • Comparison of cameras and lenses
    • +
    • and so on...
    • +
    +
  • +
+

Among the few existing implementations of RAW converters, those based on the + dcraw utility by Dave Coffin are the most used. +It is hard to find a more or less popular camera that is not supported by this +utility; while the implementation of RAW data extraction in dcraw is of +a very high quality. +

+

However, developers and enthusiasts who use or are going to use dcraw for + fulfilling the above-listed and similar objectives encounter a + number of difficulties. First, the author of dcraw refuses to turn his + product into a handy library, yet permitting anybody else to do so. + Besides, dcraw contains a number of questionable features which may + hinder its use without modifications, as well as instances of + distortions in the photographic sense of it. As a result, once every + several months, virtually all developers, part of them listed on the + dcraw Web site, independently convert each subsequent release of the + software into the library. +

+

+ As for enthusiasts, the "entry cost" of verifying their own ideas and + implementing their own algorithms is often unreasonably high: they have + to either use the dcraw command line, thus being forced to use the + unavoidable early processing stages, or understand the source code and + maintain their own library based on it. +

+

+ Thus, the inconveniences of dcraw make the developers' community quite + small and halt further evolution and improvement of RAW format + converters. +

+ +

Goals and Objectives

+

We are going to create LibRaw in order to "get a library based on dcraw, only better". Thus: +

+
    +
  1. To "librarize" dcraw, i.e., to develop a stable and consistent API suitable for other applications + (RAW converters, data analyzers, panorama stitchers, etc.). +
  2. +
  3. To divide processing into independent parts (groups of API calls) +
      +
    • Reading, decoding, and unpacking of RAW data: this is the main functionality of LibRaw
    • +
    • Data conversions: interpolation, white balance, etc.
    • +
    • File output of the processing results.
    • +
    + The latter two groups of functions are maintained primarily for dcraw compatibility testing. +
  4. +
  5. To improve the procedures of RAW data retrieval and decoding (see below for details) +
  6. +
  7. To supply other developers with a "framework" (freeware and open-source), e.g., +for experimenting with their own methods of RAW data processing +(interpolation, noise reduction, white balance, etc.; some directions +of the possible efforts are listed above), +so that they could create their own GUI programs and interfaces without developing the entire RAW converter.
  8. +
  9. To ensure easy modification for code synchronization with dcraw releases.
  10. +
+ + +

LibRaw Support Principles

+
    +
  1. To reproduce the functionality of dcraw using its source code as the basis for our work; to +achieve binary identity of results generated by dcraw and by LibRaw-based utilities, provided the same processing settings are used. +
  2. +
  3. To eliminate the shortcomings of dcraw. +
  4. +
  5. To monitor future improvements in dcraw (support of new cameras, error correction, +use of better algorithms) and import them from dcraw to LibRaw. +
  6. +
  7. API modifications: the planned improvements will require extending +of the API. Such changes will be introduced in the form of large change-sets, +while the compatibility mode supporting older + applications based on the legacy API set will be preserved as long + as possible. +
  8. +
+ + + + + + [back to Index] + + diff -Nru libraw-0.16.2/doc/Why-LibRaw-rus.html libraw-0.17.0/doc/Why-LibRaw-rus.html --- libraw-0.16.2/doc/Why-LibRaw-rus.html 2015-05-16 12:32:15.000000000 +0000 +++ libraw-0.17.0/doc/Why-LibRaw-rus.html 1970-01-01 00:00:00.000000000 +0000 @@ -1,204 +0,0 @@ - - - - Цели и задачи - - - - [вернуться к оглавлению] -

Цели и задачи проекта LibRaw

-

Содержание

-
    -
  1. Кому может быть интересен этот проект, и что мы хотим получить
  2. -
  3. Цели и задачи
  4. -
  5. Принципы сопровождения LibRaw
  6. -
  7. Произведенные улучшения dcraw
  8. -
  9. Планируемые улучшения
  10. -
- - -

Кому может быть интересен этот проект

-

Предлагаемый вашему вниманию проект и порождаемый им программный продукт предназначены для:

-
    -
  • разработчиков новых raw-конверторов,
  • -
  • желающих написать свой графический интерфейс для обработки raw-файлов
  • -
  • разработчиков и энтузиастов, создающих отдельные собственные основные и вспомогательные алгоритмы обработки - изображений, как то: -
      -
    • интерполяция (дебайеризация),
    • -
    • шумопонижение,
    • -
    • баланс белого,
    • -
    • коррекция аберраций и дисторсий,
    • -
    • преобразования цвета (например, обработка профилей камер),
    • -
    • анализ данных raw,
    • -
    • сравнение камер и объективов
    • -
    • и так далее...
    • -
    -
  • -
-

Среди существующих сегодня относительно немногочисленных реализаций распаковки RAW-данных, получаемых с цифровых - фотокамер наиболее распространены и наиболее широко используются реализации на основе утилиты - dcraw, написанной Dave Coffin. Ее популярность - связана с тем, что трудно найти сколько-нибудь распространённую камеру, которая не была бы поддержана данной - утилитой, а сам уровень поддержки распаковки весьма хороший. -

-

Однако на пути разработчиков и энтузиастов, использующих или собирающихся использовать dcraw для решения - указанных выше задач, стоят несколько препятствий. Первое из них состоит в том, что автор dcraw принципиально не - оформляет свой программный продукт в виде библиотеки, удобной для использования, оставляя это на откуп всем - желающим (и не возражая против этого). Помимо этого, dcraw содержит ряд особенностей и фотографических - некорректностей, которые могут мешать ее использованию без модификаций. - В результате, практически все - разработчики (часть из которых перечислена на сайте dcraw) раз в несколько месяцев, независимо друг от друга - переводят очередную версию утилиты в библиотечный вид. -

-

- Для энтузиастов же «входная стоимость» - возможности проверки собственных идей и реализации собственных алгоритмов оказывается, зачастую, непомерно - высокой: нужно либо пользоваться командной строкой dcraw (что приводит к обязательному использованию - неотключаемых ранних стадий обработки), либо разобраться в исходном коде dcraw и поддерживать собственную - библиотеку на ее основе. -

-

Таким образом, неудобства, присущие dcraw, значительно сужают сообщество разработчиков и тормозят процесс - развития и совершенствования конверторов RAW-формата. -

- - -

Цели и задачи

-

При создании LibRaw мы хотим "получить библиотеку на основе dcraw, только лучше": -

-
    -
  1. "обиблиотечить" dcraw, т.е. разработать стабильный и консистентный API, пригодный для использования в других - приложениях (RAW-конверторах, анализаторах данных, склейщиках панорам и так далее). -
  2. -
  3. Разделить на независимые части (группы вызовов API): -
      -
    • чтение, раскодирование и распаковку RAW-данных - и это основная функциональность LibRaw;
    • -
    • преобразования данных: интерполяцию, баланс белого и т.п.;
    • -
    • вывод результатов обработки в файлы.
    • -
    - Две последние группы функций поддерживаются, в первую очередь, для целей тестирования совместимости с dcraw. -
  4. -
  5. Улучшить процедуры извлечения и раскодирования RAW-данных (подробнее - ниже) -
  6. -
  7. Дать другим разработчикам "рамку" (бесплатную и в открытых исходниках) в которой можно было бы, например, - экспериментировать со своими способами обработки RAW-данных (интерполяция, шумопонижение, баланс белого и так - далее, возможные варианты приложения своих усилий частично перечислены выше), и - создавать свои графические оболочки и интерфейсы не разрабатывая RAW-конвертор целиком. -
  8. -
  9. Обеспечить лёгкость внесения изменений для синхронизации кода с релизами самой dcraw.
  10. -
- - -

Принципы сопровождения LibRaw

-
    -
  1. Повторить функциональность dcraw, взяв ее исходные тексты за основу, добиться бинарной идентичности (при - одинаковых настройках) результатов работы dcraw и утилит на основе LibRaw. -
  2. -
  3. Избавляться от недостатков dcraw (о некоторых из них см. ниже улучшения dcraw и - план работ). -
  4. -
  5. По мере совершенствования dcraw (поддержка новых камер, исправление ошибок, улучшение алгоритмов) - - импортировать улучшения из dcraw в LibRaw. -
  6. -
  7. Изменения API: запланированные улучшения потребуют расширения API. Такие - изменения будут делаться большими change-set-ами, а режимы совместмости со старыми приложениями - будут сохраняться, насколько возможно. -
  8. -
- - -

Произведенные улучшения dcraw

-

На момент написания данного текста в LibRaw внесены следующие дополнительные улучшения относительно исходного - кода dcraw:

-
    -
  • Полностью убраны глобальные переменные (а при сборке thread-safe варианта - и статические переменные - функций). -
  • -
  • Thread-safety. Пример использования в многопоточном режиме включен в поставку библиотеки. -
  • -
  • Извлекаемые из RAW-файла данные несколько структурированы: геометрия отдельно, цветовые данные отдельно. - Эта работа еще не закончена и будет продолжена одновременно с работой над улучшением - обработки EXIF. -
  • -
  • Извлечение RAW-данных и thumbnail может быть сделано за 2-3 вызова API с очень простым программным - интерфейсом. -
  • -
  • Работа с цветовой информацией: для цветовых данных (коэффициенты баланса белого, тоновая кривая и т.д.) - добавлены флаги, показывающие откуда эта информация: извлечена из RAW-данных, вычислена по самому изображению, - взяты константы из кода. -
  • -
  • Извлекается ICC-профиль (для тех RAW-файлов, где он есть)
  • -
  • Само изображение и thumbnail можно извлечь последовательными вызовами, без переоткрытия файла и перезапуска - библиотеки. -
  • -
  • Несколько снижены требования к необходимому количеству оперативной памяти
  • -
  • Работа с маскированными пикселями и уровнем черного: возможно отключить обязательное вычитание уровня - черного и фильтрацию нулевых пикселов
  • -
  • Работа с краями диапазона значений: минимальными значениями (часто называемыми точкой черного) и - максимальными значениями (точкой насыщения). -
      -
    • Вычитание точки черного сделано необязательным. -
    • -
    • Рассчитываются максимальные значения данных по каналам. -
    • -
    -
  • - -
- - -

Планируемые улучшения

-

Код dcraw нуждается в существенных изменениях и дополнениях:

-
    -
  • Однопроходная распаковка RAW-файлов с несколькими вариантами изображения: для тех камер, для которых - это применимо (камеры FUJI, камеры с режимами 4-shot/16-shot) будут извлекаться несколько планов одного - изображения. -
  • -
  • Работа с черной рамкой: данные, считанные с черной рамки (или двух черных рамок, на тех камерах, где - их две) нужно делать доступными в вызывающем приложении (например, это необходимо для подавления - определённых артефактов, в частности - banding).
  • - -
  • Верификация распаковки данных для максимального набора форматов файлов. Существует мнение, что - некоторые форматы данных dcraw распаковывает не вполне корректно. -
  • - -
  • Работа с EXIF/Makernote: извлечение данных в большем объеме, в частности: -
      -
    • Извлечение максимально возможного количества данных о цвете (настройки баланса белого, профиль, тоновая - кривая, настройки контраста и т.п.)
    • - -
    • Генерализация данных о цвете: приведение цветовых данных от различных камер к "общему знаменателю" с - целью упростить обработку цвета (без потери качества обработки).
    • - -
    • Извлечение данных о камере (версия firmware, серийный номер)
    • - -
    • Извлечение данных о кадре (оптика, дистанция фокусировки, фокусировочные точки и их координаты и - т.п.)
    • - -
    • Извлечение полного массива EXIF-данных без анализа структуры с целью облегчения копирования EXIF-данных - в выходные файлы.
    • -
    -
  • -
  • Генерализация работы со сложными форматами, в частности: -
      -
    • RAW-файлы от камер Fuji (с двумя наборами сенсоров)
    • -
    • RAW-файлы от задников с режимами 4-shot и 16-shot
    • -
    -
  • -
-

В то же время, никаких модификаций и расширений кода обработки данных dcraw (де-байеризация, цветовые - преобразования и так далее) мы производить не планируем, это все должно быть задачей вызывающего - приложения. Стандартные режимы обработки, включенные в dcraw (за исключением поддержки LCMS и libjpeg и - некоторых несущественных этапов обработки) будут сохранены неопределенное время (в наборе вызовов API, - эмулирующих dcraw). -

- - [вернуться к оглавлению] -
-
LibRaw Team
- - -Last modified: Mon Jul 11 14:54:53 MSD 2011 - - - diff -Nru libraw-0.16.2/.gitignore libraw-0.17.0/.gitignore --- libraw-0.16.2/.gitignore 1970-01-01 00:00:00.000000000 +0000 +++ libraw-0.17.0/.gitignore 2015-08-15 13:10:27.000000000 +0000 @@ -0,0 +1 @@ +samples/lens-identify.cpp diff -Nru libraw-0.16.2/INSTALL.CMAKE libraw-0.17.0/INSTALL.CMAKE --- libraw-0.16.2/INSTALL.CMAKE 2015-05-16 12:32:15.000000000 +0000 +++ libraw-0.17.0/INSTALL.CMAKE 1970-01-01 00:00:00.000000000 +0000 @@ -1,94 +0,0 @@ - -========= Installing LibRaw (CMake version) ========== - -I. Installation steps - -1. Unpack the distribution file: - - $ tar xzvf LibRaw-0.xx.yy.tar.gz - -2. If you wish to use LibRaw demosaic pack(s), unpack them in the same folder: - - $ tar xzvf LibRaw-demosaic-pack-GPL2-0.xx.yy.tar.gz - $ tar xzvf LibRaw-demosaic-pack-GPL3-0.xx.yy.tar.gz - - -3. Go to LibRaw folder and run ./configure and make: - - $ cd LibRaw-0.xx.yy - $ ./cmake [...optional args...] . - $ make - -4. install by run make install as root: - - $ sudo make install - - -II. ./cmake options - --DENABLE_OPENMP=ON/OFF - - Enable/disable OpenMP support if compiler supports it. - OpenMP is enabled by default. - - --DENABLE_LCMS=ON/OFF - - Enable/disable LCMS color engine support. If enabled, ./cmake will try to - find lcms library. Both LCMS-1.x and LCMS-2.x are supported - LCMS support is enabled by default - - --DENABLE_EXAMPLES=ON/OFF - - Enables/disables examples compilation and installation. Enabled by default - - --DENABLE_DEMOSAIC_PACK_GPL2=ON/OFF --DDEMOSAIC_PACK_GPL2_RPATH=FOLDERNAME --DCHECKOUT_DEMOSAIC_PACK_GPL2=ON/OFF - - Enables/disables support of additional demosaic methods licensed under GPL2 - You need to download and unpack LibRaw-demosaic-pack-GPL2 archive to use - this feature. - ./cmake will try to find demosaic pack in: - - a) If folder is specified via -DDDEMOSAIC_PACK_GPL2_RPATH=FOLDERNAME - command-line option, then only this folder will be checked. - - b) If no folder is specified in -DDENABLE_DEMOSAIC_PACK_GPL2 switch: - - ./LibRaw-demosaic-pack-GPL2 (in LibRaw folder) - - If DCHECKOUT_DEMOSAIC_PACK_GPL2 is enabled, code wil be checkout from remote repository - --DENABLE_DEMOSAIC_PACK_GPL3=ON/OFF --DDEMOSAIC_PACK_GPL3_RPATH=FOLDERNAME --DCHECKOUT_DEMOSAIC_PACK_GPL3=ON/OFF - Same as above, but for GPL3-licensed demosaic pack. - - --DENABLE_RAWSPEED=ON/OFF --DRAWSPEED_RPATH=FOLDERNAME - - Enables/disables support of additional code from RawStudio project - You need to download RawSpeed source code to use this feature. - See README.RawSpeed.txt for details. - ./cmake will try to find RawSpeed code in: - - a) If folder is specified via -DRAWSPEED_RPATH=FOLDERNAME - command-line option, then only this folder will be checked. - - b) If no folder is specified in -DENABLE_RAWSPEED switch: - - ./RawSpeed (in LibRaw folder) -<<<<<<< HEAD - -======= - - If CHECKOUT_RAWSPEED is enabled, code wil be checkout from remote repository - ->>>>>>> 0eeff91... polish --DENABLE_DCRAW_DEBUG=ON/OFF - - Enables/disables support of additional debug traces from dcraw operations. Disabled by default diff -Nru libraw-0.16.2/internal/dcraw_common.cpp libraw-0.17.0/internal/dcraw_common.cpp --- libraw-0.16.2/internal/dcraw_common.cpp 2015-05-16 12:32:15.000000000 +0000 +++ libraw-0.17.0/internal/dcraw_common.cpp 2015-08-15 13:10:27.000000000 +0000 @@ -1,5 +1,5 @@ /* - Copyright 2008-2013 LibRaw LLC (info@libraw.org) + Copyright 2008-2015 LibRaw LLC (info@libraw.org) LibRaw is free software; you can redistribute it and/or modify it under the terms of the one of three licenses as you choose: @@ -21,7 +21,6 @@ for more information */ -#line 261 "dcraw/dcraw.c" #include #define CLASS LibRaw:: #include "libraw/libraw_types.h" @@ -30,7 +29,6 @@ #include "libraw/libraw.h" #include "internal/defines.h" #include "internal/var_defines.h" -#line 272 "dcraw/dcraw.c" int CLASS fcol (int row, int col) { static const char filter[16][16] = @@ -52,7 +50,7 @@ { 0,3,1,0,0,2,0,3,2,1,3,1,1,3,1,3 } }; if (filters == 1) return filter[(row+top_margin)&15][(col+left_margin)&15]; - if (filters == 9) return xtrans[(row+top_margin+6)%6][(col+left_margin+6)%6]; + if (filters == 9) return xtrans[(row+6) % 6][(col+6) % 6]; return FC(row,col); } @@ -77,7 +75,6 @@ } #define strcasestr my_strcasestr #endif -#line 340 "dcraw/dcraw.c" ushort CLASS sget2 (uchar *s) { if (order == 0x4949) /* "II" means little-endian */ @@ -86,6 +83,46 @@ return s[0] << 8 | s[1]; } +// DNG was written by: +#define CameraDNG 1 +#define AdobeDNG 2 + +#ifdef LIBRAW_LIBRARY_BUILD + + +static ushort saneSonyCameraInfo(uchar a, uchar b, uchar c, uchar d, uchar e, uchar f){ + if ((a >> 4) > 9) return 0; + else if ((a & 0x0f) > 9) return 0; + else if ((b >> 4) > 9) return 0; + else if ((b & 0x0f) > 9) return 0; + else if ((c >> 4) > 9) return 0; + else if ((c & 0x0f) > 9) return 0; + else if ((d >> 4) > 9) return 0; + else if ((d & 0x0f) > 9) return 0; + else if ((e >> 4) > 9) return 0; + else if ((e & 0x0f) > 9) return 0; + else if ((f >> 4) > 9) return 0; + else if ((f & 0x0f) > 9) return 0; +return 1; +} + +static ushort bcd2dec(uchar data){ + if ((data >> 4) > 9) return 0; + else if ((data & 0x0f) > 9) return 0; + else return (data >> 4) * 10 + (data & 0x0f); +} + +static uchar SonySubstitution[257] = "\x00\x01\x32\xb1\x0a\x0e\x87\x28\x02\xcc\xca\xad\x1b\xdc\x08\xed\x64\x86\xf0\x4f\x8c\x6c\xb8\xcb\x69\xc4\x2c\x03\x97\xb6\x93\x7c\x14\xf3\xe2\x3e\x30\x8e\xd7\x60\x1c\xa1\xab\x37\xec\x75\xbe\x23\x15\x6a\x59\x3f\xd0\xb9\x96\xb5\x50\x27\x88\xe3\x81\x94\xe0\xc0\x04\x5c\xc6\xe8\x5f\x4b\x70\x38\x9f\x82\x80\x51\x2b\xc5\x45\x49\x9b\x21\x52\x53\x54\x85\x0b\x5d\x61\xda\x7b\x55\x26\x24\x07\x6e\x36\x5b\x47\xb7\xd9\x4a\xa2\xdf\xbf\x12\x25\xbc\x1e\x7f\x56\xea\x10\xe6\xcf\x67\x4d\x3c\x91\x83\xe1\x31\xb3\x6f\xf4\x05\x8a\x46\xc8\x18\x76\x68\xbd\xac\x92\x2a\x13\xe9\x0f\xa3\x7a\xdb\x3d\xd4\xe7\x3a\x1a\x57\xaf\x20\x42\xb2\x9e\xc3\x8b\xf2\xd5\xd3\xa4\x7e\x1f\x98\x9c\xee\x74\xa5\xa6\xa7\xd8\x5e\xb0\xb4\x34\xce\xa8\x79\x77\x5a\xc1\x89\xae\x9a\x11\x33\x9d\xf5\x39\x19\x65\x78\x16\x71\xd2\xa9\x44\x63\x40\x29\xba\xa0\x8f\xe4\xd6\x3b\x84\x0d\xc2\x4e\x58\xdd\x99\x22\x6b\xc9\xbb\x17\x06\xe5\x7d\x66\x43\x62\xf6\xcd\x35\x90\x2e\x41\x8d\x6d\xaa\x09\x73\x95\x0c\xf1\x1d\xde\x4c\x2f\x2d\xf7\xd1\x72\xeb\xef\x48\xc7\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff"; + +ushort CLASS sget2Rev(uchar *s) // specific to some Canon Makernotes fields, where they have endian in reverse +{ + if (order == 0x4d4d) /* "II" means little-endian, and we reverse to "MM" - big endian */ + return s[0] | s[1] << 8; + else /* "MM" means big-endian... */ + return s[0] << 8 | s[1]; +} +#endif + ushort CLASS get2() { uchar str[2] = { 0xff,0xff }; @@ -123,18 +160,22 @@ double CLASS getreal (int type) { - union { char c[8]; double d; } u; + union { char c[8]; double d; } u,v; int i, rev; switch (type) { case 3: return (unsigned short) get2(); case 4: return (unsigned int) get4(); - case 5: u.d = (unsigned int) get4(); - return u.d / (unsigned int) get4(); + case 5: + u.d = (unsigned int) get4(); + v.d = (unsigned int)get4(); + return u.d / (v.d ? v.d : 1); case 8: return (signed short) get2(); case 9: return (signed int) get4(); - case 10: u.d = (signed int) get4(); - return u.d / (signed int) get4(); + case 10: + u.d = (signed int) get4(); + v.d = (signed int)get4(); + return u.d / (v.d?v.d:1); case 11: return int_to_float (get4()); case 12: rev = 7 * ((order == 0x4949) == (ntohs(0x1234) == 0x1234)); @@ -152,6 +193,61 @@ swab ((char*)pixel, (char*)pixel, count*2); } +void CLASS cubic_spline (const int *x_, const int *y_, const int len) +{ + float **A, *b, *c, *d, *x, *y; + int i, j; + + A = (float **) calloc (((2*len + 4)*sizeof **A + sizeof *A), 2*len); + if (!A) return; + A[0] = (float *) (A + 2*len); + for (i = 1; i < 2*len; i++) + A[i] = A[0] + 2*len*i; + y = len + (x = i + (d = i + (c = i + (b = A[0] + i*i)))); + for (i = 0; i < len; i++) { + x[i] = x_[i] / 65535.0; + y[i] = y_[i] / 65535.0; + } + for (i = len-1; i > 0; i--) { + b[i] = (y[i] - y[i-1]) / (x[i] - x[i-1]); + d[i-1] = x[i] - x[i-1]; + } + for (i = 1; i < len-1; i++) { + A[i][i] = 2 * (d[i-1] + d[i]); + if (i > 1) { + A[i][i-1] = d[i-1]; + A[i-1][i] = d[i-1]; + } + A[i][len-1] = 6 * (b[i+1] - b[i]); + } + for(i = 1; i < len-2; i++) { + float v = A[i+1][i] / A[i][i]; + for(j = 1; j <= len-1; j++) + A[i+1][j] -= v * A[i][j]; + } + for(i = len-2; i > 0; i--) { + float acc = 0; + for(j = i; j <= len-2; j++) + acc += A[i][j]*c[j]; + c[i] = (A[i][len-1] - acc) / A[i][i]; + } + for (i = 0; i < 0x10000; i++) { + float x_out = (float)(i / 65535.0); + float y_out = 0; + for (j = 0; j < len-1; j++) { + if (x[j] <= x_out && x_out <= x[j+1]) { + float v = x_out - x[j]; + y_out = y[j] + + ((y[j+1] - y[j]) / d[j] - (2 * d[j] * c[j] + c[j+1] * d[j])/6) * v + + (c[j] * 0.5) * v*v + ((c[j+1] - c[j]) / (6 * d[j])) * v*v*v; + } + } + curve[i] = y_out < 0.0 ? 0 : (y_out >= 1.0 ? 65535 : + (ushort)(y_out * 65535.0 + 0.5)); + } + free (A); +} + void CLASS canon_600_fixed_wb (int temp) { static const short mul[4][5] = { @@ -567,15 +663,14 @@ #endif FORC(2) free (huff[c]); } -#line 841 "dcraw/dcraw.c" int CLASS ljpeg_start (struct jhead *jh, int info_only) { int c, tag; ushort len; + int cnt = 0; uchar data[0x10000]; const uchar *dp; - int cnt = 0; memset (jh, 0, sizeof *jh); jh->restart = INT_MAX; @@ -583,32 +678,33 @@ if (data[1] != 0xd8) return 0; do { if(feof(ifp)) return 0; - if(cnt++ > 1024) return 0; + if(cnt++ > 1024) return 0; // 1024 tags limit fread (data, 2, 2, ifp); tag = data[0] << 8 | data[1]; len = (data[2] << 8 | data[3]) - 2; if (tag <= 0xff00) return 0; fread (data, 1, len, ifp); switch (tag) { - case 0xffc3: + case 0xffc3: // start of frame; lossless, Huffman jh->sraw = ((data[7] >> 4) * (data[7] & 15) - 1) & 3; - case 0xffc0: + case 0xffc0: // start of frame; baseline jpeg jh->bits = data[0]; jh->high = data[1] << 8 | data[2]; jh->wide = data[3] << 8 | data[4]; jh->clrs = data[5] + jh->sraw; + if (len == 9 && !dng_version) getc(ifp); break; - case 0xffc4: + case 0xffc4: // define Huffman tables if (info_only) break; for (dp = data; dp < data+len && (c = *dp++) < 4; ) jh->free[c] = jh->huff[c] = make_decoder_ref (&dp); break; - case 0xffda: + case 0xffda: // start of scan jh->psv = data[1+data[0]*2]; jh->bits -= data[3+data[0]*2] & 15; break; - case 0xffdd: + case 0xffdd: // define restart interval jh->restart = data[0] << 8 | data[1]; } } while (tag != 0xffda); @@ -692,7 +788,7 @@ void CLASS lossless_jpeg_load_raw() { - int jwide, jrow, jcol, val, jidx, i, j, row=0, col=0; + int jwide, jhigh, jrow, jcol, val, jidx, i, j, row=0, col=0; struct jhead jh; ushort *rp; @@ -705,6 +801,8 @@ longjmp (failure, 2); #endif jwide = jh.wide * jh.clrs; + jhigh = jh.high; + if(jh.clrs == 4 && jwide >= raw_width*2) jhigh *= 2; #ifdef LIBRAW_LIBRARY_BUILD try { @@ -720,10 +818,10 @@ val = curve[*rp++]; if (cr2_slice[0]) { jidx = jrow*jwide + jcol; - i = jidx / (cr2_slice[1]*jh.high); + i = jidx / (cr2_slice[1]*raw_height); if ((j = i >= cr2_slice[0])) i = cr2_slice[0]; - jidx -= i * (cr2_slice[1]*jh.high); + jidx -= i * (cr2_slice[1]*raw_height); row = jidx / cr2_slice[1+j]; col = jidx % cr2_slice[1+j] + i*cr2_slice[1]; } @@ -941,7 +1039,7 @@ fseek (ifp, save+4, SEEK_SET); if ((tcol += tile_width) >= raw_width) trow += tile_length + (tcol = 0); - + ljpeg_end (&jh); } } @@ -1011,6 +1109,43 @@ } } +#ifdef LIBRAW_LIBRARY_BUILD + +void CLASS nikon_coolscan_load_raw() +{ + int bufsize = width*3*tiff_bps/8; + if(tiff_bps <= 8) + gamma_curve(1.0/imgdata.params.coolscan_nef_gamma,0.,1,255); + else + gamma_curve(1.0/imgdata.params.coolscan_nef_gamma,0.,1,65535); + fseek (ifp, data_offset, SEEK_SET); + unsigned char *buf = (unsigned char*)malloc(bufsize); + unsigned short *ubuf = (unsigned short *)buf; + for(int row = 0; row < raw_height; row++) + { + int red = fread (buf, 1, bufsize, ifp); + unsigned short (*ip)[4] = (unsigned short (*)[4]) image + row*width; + if(tiff_bps <= 8) + for(int col=0; col> c*12 & 0xfff) - (c >> 1 << 11); + } + rgb[0] = yuv[b] + 1.370705*yuv[3]; + rgb[1] = yuv[b] - 0.337633*yuv[2] - 0.698001*yuv[3]; + rgb[2] = yuv[b] + 1.732446*yuv[2]; + FORC3 image[row*width+col][c] = curve[LIM(rgb[c],0,0xfff)] / cam_mul[c]; + } + } +} + /* Returns 1 for a Coolpix 995, 0 for anything else. */ @@ -1161,7 +1321,6 @@ if (tail[i]) nz++; return nz > 20; } -#line 1439 "dcraw/dcraw.c" void CLASS ppm_thumb() { char *thumb; @@ -1257,14 +1416,19 @@ void CLASS phase_one_flat_field (int is_float, int nc) { ushort head[8]; - unsigned wide, y, x, c, rend, cend, row, col; + unsigned wide, high, y, x, c, rend, cend, row, col; float *mrow, num, mult[4]; read_shorts (head, 8); - wide = head[2] / head[4]; + if (head[2] * head[3] * head[4] * head[5] == 0) return; + wide = head[2] / head[4] + (head[2] % head[4] != 0); + high = head[3] / head[5] + (head[3] % head[5] != 0); mrow = (float *) calloc (nc*wide, sizeof *mrow); merror (mrow, "phase_one_flat_field()"); - for (y=0; y < head[3] / head[5]; y++) { + for (y=0; y < high; y++) { +#ifdef LIBRAW_LIBRARY_BUILD + checkCancel(); +#endif for (x=0; x < wide; x++) for (c=0; c < nc; c+=2) { num = is_float ? getreal(11) : get2()/32768.0; @@ -1273,14 +1437,18 @@ } if (y==0) continue; rend = head[1] + y*head[5]; - for (row = rend-head[5]; row < raw_height && row < rend; row++) { + for (row = rend-head[5]; + row < raw_height && row < rend && + row < head[1]+head[3]-head[5]; row++) { for (x=1; x < wide; x++) { for (c=0; c < nc; c+=2) { mult[c] = mrow[c*wide+x-1]; mult[c+1] = (mrow[c*wide+x] - mult[c]) / head[4]; } cend = head[0] + x*head[4]; - for (col = cend-head[4]; col < raw_width && col < cend; col++) { + for (col = cend-head[4]; + col < raw_width && + col < cend && col < head[0]+head[2]-head[4]; col++) { c = nc > 2 ? FC(row-top_margin,col-left_margin) : 0; if (!(c & 1)) { c = RAW(row,col) * mult[c]; @@ -1298,18 +1466,19 @@ free (mrow); } -void CLASS phase_one_correct() +int CLASS phase_one_correct() { unsigned entries, tag, data, save, col, row, type; int len, i, j, k, cip, val[4], dev[4], sum, max; int head[9], diff, mindiff=INT_MAX, off_412=0; - static const signed char dir[12][2] = + /* static */ const signed char dir[12][2] = { {-1,-1}, {-1,1}, {1,-1}, {1,1}, {-2,0}, {0,-2}, {0,2}, {2,0}, {-2,-2}, {-2,2}, {2,-2}, {2,2} }; float poly[8], num, cfrac, frac, mult[2], *yval[2]; ushort *xval[2]; + int qmult_applied = 0, qlin_applied = 0; - if (half_size || !meta_length) return; + if (half_size || !meta_length) return 0; #ifdef DCRAW_VERBOSE if (verbose) fprintf (stderr,_("Phase One correction...\n")); #endif @@ -1318,7 +1487,14 @@ fseek (ifp, 6, SEEK_CUR); fseek (ifp, meta_offset+get4(), SEEK_SET); entries = get4(); get4(); + +#ifdef LIBRAW_LIBRARY_BUILD + try { +#endif while (entries--) { +#ifdef LIBRAW_LIBRARY_BUILD + checkCancel(); +#endif tag = get4(); len = get4(); data = get4(); @@ -1341,15 +1517,20 @@ curve[i] = LIM(num+i,0,65535); } apply: /* apply to whole image */ for (row=0; row < raw_height; row++) + { +#ifdef LIBRAW_LIBRARY_BUILD + checkCancel(); +#endif for (col = (tag & 1)*ph1.split_col; col < raw_width; col++) RAW(row,col) = curve[RAW(row,col)]; + } } else if (tag == 0x400) { /* Sensor defects */ while ((len -= 8) >= 0) { col = get2(); row = get2(); type = get2(); get2(); if (col >= raw_width) continue; - if (type == 131) /* Bad column */ + if (type == 131 || type == 137) /* Bad column */ for (row=0; row < raw_height; row++) if (FC(row-top_margin,col-left_margin) == 1) { for (sum=i=0; i < 4; i++) @@ -1386,6 +1567,99 @@ mindiff = diff; off_412 = ftell(ifp) - 38; } + } else if (tag == 0x41f && !qlin_applied) { /* Quadrant linearization */ + ushort lc[2][2][16], ref[16]; + int qr, qc; + for (qr = 0; qr < 2; qr++) + for (qc = 0; qc < 2; qc++) + for (i = 0; i < 16; i++) + lc[qr][qc][i] = get4(); + for (i = 0; i < 16; i++) { + int v = 0; + for (qr = 0; qr < 2; qr++) + for (qc = 0; qc < 2; qc++) + v += lc[qr][qc][i]; + ref[i] = (v + 2) >> 2; + } + for (qr = 0; qr < 2; qr++) { + for (qc = 0; qc < 2; qc++) { + int cx[19], cf[19]; + for (i = 0; i < 16; i++) { + cx[1+i] = lc[qr][qc][i]; + cf[1+i] = ref[i]; + } + cx[0] = cf[0] = 0; + cx[17] = cf[17] = ((unsigned int)ref[15] * 65535) / lc[qr][qc][15]; + cf[18] = cx[18] = 65535; + cubic_spline(cx, cf, 19); + + for (row = (qr ? ph1.split_row : 0); + row < (qr ? raw_height : ph1.split_row); row++) + { +#ifdef LIBRAW_LIBRARY_BUILD + checkCancel(); +#endif + for (col = (qc ? ph1.split_col : 0); + col < (qc ? raw_width : ph1.split_col); col++) + RAW(row,col) = curve[RAW(row,col)]; + } + } + } + qlin_applied = 1; + } else if (tag == 0x41e && !qmult_applied) { /* Quadrant multipliers */ + float qmult[2][2] = { { 1, 1 }, { 1, 1 } }; + get4(); get4(); get4(); get4(); + qmult[0][0] = 1.0 + getreal(11); + get4(); get4(); get4(); get4(); get4(); + qmult[0][1] = 1.0 + getreal(11); + get4(); get4(); get4(); + qmult[1][0] = 1.0 + getreal(11); + get4(); get4(); get4(); + qmult[1][1] = 1.0 + getreal(11); + for (row=0; row < raw_height; row++) + { +#ifdef LIBRAW_LIBRARY_BUILD + checkCancel(); +#endif + for (col=0; col < raw_width; col++) { + i = qmult[row >= ph1.split_row][col >= ph1.split_col] * RAW(row,col); + RAW(row,col) = LIM(i,0,65535); + } + } + qmult_applied = 1; + } else if (tag == 0x431 && !qmult_applied) { /* Quadrant combined */ + ushort lc[2][2][7], ref[7]; + int qr, qc; + for (i = 0; i < 7; i++) + ref[i] = get4(); + for (qr = 0; qr < 2; qr++) + for (qc = 0; qc < 2; qc++) + for (i = 0; i < 7; i++) + lc[qr][qc][i] = get4(); + for (qr = 0; qr < 2; qr++) { + for (qc = 0; qc < 2; qc++) { + int cx[9], cf[9]; + for (i = 0; i < 7; i++) { + cx[1+i] = ref[i]; + cf[1+i] = ((unsigned) ref[i] * lc[qr][qc][i]) / 10000; + } + cx[0] = cf[0] = 0; + cx[8] = cf[8] = 65535; + cubic_spline(cx, cf, 9); + for (row = (qr ? ph1.split_row : 0); + row < (qr ? raw_height : ph1.split_row); row++) + { +#ifdef LIBRAW_LIBRARY_BUILD + checkCancel(); +#endif + for (col = (qc ? ph1.split_col : 0); + col < (qc ? raw_width : ph1.split_col); col++) + RAW(row,col) = curve[RAW(row,col)]; + } + } + } + qmult_applied = 1; + qlin_applied = 1; } fseek (ifp, save, SEEK_SET); } @@ -1405,6 +1679,10 @@ for (j=0; j < head[i+1]*head[i+3]; j++) xval[i][j] = get2(); for (row=0; row < raw_height; row++) + { +#ifdef LIBRAW_LIBRARY_BUILD + checkCancel(); +#endif for (col=0; col < raw_width; col++) { cfrac = (float) col * head[3] / raw_width; cfrac -= cip = cfrac; @@ -1419,8 +1697,16 @@ i = ((mult[0] * (1-cfrac) + mult[1] * cfrac) * row + num) * 2; RAW(row,col) = LIM(i,0,65535); } + } free (yval[0]); } +#ifdef LIBRAW_LIBRARY_BUILD + } + catch (...) + { + return LIBRAW_CANCELLED_BY_CALLBACK; + } +#endif } void CLASS phase_one_load_raw() @@ -1432,6 +1718,25 @@ akey = get2(); bkey = get2(); t_mask = ph1.format == 1 ? 0x5555:0x1354; +#ifdef LIBRAW_LIBRARY_BUILD + if (ph1.black_col || ph1.black_row ) + { + imgdata.rawdata.ph1_cblack = (short(*)[2])calloc(raw_height*2,sizeof(ushort)); + merror(imgdata.rawdata.ph1_cblack,"phase_one_load_raw()"); + imgdata.rawdata.ph1_rblack = (short(*)[2])calloc(raw_width*2,sizeof(ushort)); + merror(imgdata.rawdata.ph1_rblack,"phase_one_load_raw()"); + if (ph1.black_col) + { + fseek (ifp, ph1.black_col, SEEK_SET); + read_shorts ((ushort *)imgdata.rawdata.ph1_cblack[0], raw_height*2); + } + if (ph1.black_row) + { + fseek (ifp, ph1.black_row, SEEK_SET); + read_shorts ((ushort *) imgdata.rawdata.ph1_rblack[0], raw_width*2); + } + } +#endif fseek (ifp, data_offset, SEEK_SET); read_shorts (raw_image, raw_width*raw_height); if (ph1.format) @@ -1447,7 +1752,7 @@ { #ifndef LIBRAW_NOTHREADS #define bitbuf tls->ph1_bits.bitbuf -#define vbits tls->ph1_bits.vbits +#define vbits tls->ph1_bits.vbits #else static UINT64 bitbuf=0; static int vbits=0; @@ -1481,25 +1786,40 @@ static const int length[] = { 8,7,6,9,11,10,5,12,14,13 }; int *offset, len[2], pred[2], row, col, i, j; ushort *pixel; - short (*t_black)[2]; + short (*c_black)[2], (*r_black)[2]; +#ifdef LIBRAW_LIBRARY_BUILD + if(ph1.format == 6) + throw LIBRAW_EXCEPTION_IO_CORRUPT; +#endif - pixel = (ushort *) calloc (raw_width + raw_height*4, 2); + pixel = (ushort *) calloc (raw_width*3 + raw_height*4, 2); merror (pixel, "phase_one_load_raw_c()"); offset = (int *) (pixel + raw_width); fseek (ifp, strip_offset, SEEK_SET); for (row=0; row < raw_height; row++) offset[row] = get4(); - t_black = (short (*)[2]) offset + raw_height; - fseek (ifp, ph1.black_off, SEEK_SET); - if (ph1.black_off) - { - read_shorts ((ushort *) t_black[0], raw_height*2); -#ifdef LIBRAW_LIBRARY_BUILD - imgdata.rawdata.ph1_black = (short (*)[2])calloc(raw_height*2,sizeof(short)); - merror (imgdata.rawdata.ph1_black, "phase_one_load_raw_c()"); - memmove(imgdata.rawdata.ph1_black,(short *) t_black[0],raw_height*2*sizeof(short)); + c_black = (short (*)[2]) (offset + raw_height); + fseek (ifp, ph1.black_col, SEEK_SET); + if (ph1.black_col) + read_shorts ((ushort *) c_black[0], raw_height*2); + r_black = c_black + raw_height; + fseek (ifp, ph1.black_row, SEEK_SET); + if (ph1.black_row) + read_shorts ((ushort *) r_black[0], raw_width*2); + +#ifdef LIBRAW_LIBRARY_BUILD + // Copy data to internal copy (ever if not read) + if (ph1.black_col || ph1.black_row ) + { + imgdata.rawdata.ph1_cblack = (short(*)[2])calloc(raw_height*2,sizeof(ushort)); + merror(imgdata.rawdata.ph1_cblack,"phase_one_load_raw_c()"); + memmove(imgdata.rawdata.ph1_cblack,(ushort*)c_black[0],raw_height*2*sizeof(ushort)); + imgdata.rawdata.ph1_rblack = (short(*)[2])calloc(raw_width*2,sizeof(ushort)); + merror(imgdata.rawdata.ph1_rblack,"phase_one_load_raw_c()"); + memmove(imgdata.rawdata.ph1_rblack,(ushort*)r_black[0],raw_width*2*sizeof(ushort)); + } #endif - } + for (i=0; i < 256; i++) curve[i] = i*i / 3.969 + 0.5; #ifdef LIBRAW_LIBRARY_BUILD @@ -1530,7 +1850,9 @@ } for (col=0; col < raw_width; col++) { #ifndef LIBRAW_LIBRARY_BUILD - i = (pixel[col] << 2) - ph1.t_black + t_black[row][col >= ph1.split_col]; + i = (pixel[col] << 2) - ph1.t_black + + c_black[row][col >= ph1.split_col] + + r_black[col][row >= ph1.split_row]; if (i > 0) RAW(row,col) = i; #else RAW(row,col) = pixel[col] << 2; @@ -1550,7 +1872,9 @@ void CLASS hasselblad_load_raw() { struct jhead jh; - int row, col, pred[2], len[2], diff, c; + int shot, row, col, *back[5], len[2], diff[12], pred, sh, f, s, c; + unsigned upix, urow, ucol; + ushort *ip; if (!ljpeg_start (&jh, 0)) return; order = 0x4949; @@ -1558,32 +1882,63 @@ #ifdef LIBRAW_LIBRARY_BUILD try { #endif + 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++) { #ifdef LIBRAW_LIBRARY_BUILD checkCancel(); #endif - pred[0] = pred[1] = 0x8000 + load_flags; + FORC4 back[(c+3) & 3] = back[c]; for (col=0; col < raw_width; col+=2) { - FORC(2) len[c] = ph1_huff(jh.huff[0]); - FORC(2) { - diff = ph1_bits(len[c]); - if ((diff & (1 << (len[c]-1))) == 0) - diff -= (1 << len[c]) - 1; - if (diff == 65535) diff = -32768; - RAW(row,col+c) = pred[c] += diff; + for (s=0; s < tiff_samples*2; s+=2) { + FORC(2) len[c] = ph1_huff(jh.huff[0]); + FORC(2) { + diff[s+c] = ph1_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; } } } #ifdef LIBRAW_LIBRARY_BUILD } catch (...){ + free (back[4]); ljpeg_end (&jh); throw; } #endif + free (back[4]); ljpeg_end (&jh); - maximum = 0xffff; + if (image) mix_green = 1; } + void CLASS leaf_hdr_load_raw() { ushort *pixel=0; @@ -1628,7 +1983,6 @@ void CLASS unpacked_load_raw() { int row, col, bits=0; - while (1 << ++bits < maximum); read_shorts (raw_image, raw_width*raw_height); for (row=0; row < raw_height; row++) @@ -1643,55 +1997,47 @@ } } + void CLASS sinar_4shot_load_raw() { ushort *pixel; unsigned shot, row, col, r, c; - if ((shot = shot_select) || half_size) { - if (shot) shot--; - if (shot > 3) shot = 3; + if (raw_image) { + shot = LIM (shot_select, 1, 4) - 1; fseek (ifp, data_offset + shot*4, SEEK_SET); fseek (ifp, get4(), SEEK_SET); unpacked_load_raw(); return; } -#ifndef LIBRAW_LIBRARY_BUILD - free (raw_image); - raw_image = 0; - free (image); - image = (ushort (*)[4]) - calloc ((iheight=height), (iwidth=width)*sizeof *image); - merror (image, "sinar_4shot_load_raw()"); -#endif pixel = (ushort *) calloc (raw_width, sizeof *pixel); merror (pixel, "sinar_4shot_load_raw()"); #ifdef LIBRAW_LIBRARY_BUILD try { #endif for (shot=0; shot < 4; shot++) { - fseek (ifp, data_offset + shot*4, SEEK_SET); - fseek (ifp, get4(), SEEK_SET); - for (row=0; row < raw_height; row++) { #ifdef LIBRAW_LIBRARY_BUILD checkCancel(); #endif + fseek (ifp, data_offset + shot*4, SEEK_SET); + fseek (ifp, get4(), SEEK_SET); + for (row=0; row < raw_height; row++) { read_shorts (pixel, raw_width); if ((r = row-top_margin - (shot >> 1 & 1)) >= height) continue; for (col=0; col < raw_width; col++) { if ((c = col-left_margin - (shot & 1)) >= width) continue; - image[r*width+c][FC(row,col)] = pixel[col]; + image[r*width+c][(row & 1)*3 ^ (~col & 1)] = pixel[col]; } } } #ifdef LIBRAW_LIBRARY_BUILD - } catch(...) { - free (pixel); + } catch (...) { + free(pixel); throw; } #endif free (pixel); - shrink = filters = 0; + mix_green = 1; } void CLASS imacon_full_load_raw() @@ -1699,14 +2045,33 @@ int row, col; if (!image) return; + +#ifdef LIBRAW_LIBRARY_BUILD + unsigned short *buf = (unsigned short *)malloc(width*3*sizeof(unsigned short)); + merror(buf,"imacon_full_load_raw"); +#endif + for (row=0; row < height; row++) { #ifdef LIBRAW_LIBRARY_BUILD checkCancel(); -#endif + read_shorts(buf,width*3); + unsigned short (*rowp)[4] = &image[row*width]; + for (col=0; col < width; col++) + { + rowp[col][0]=buf[col*3]; + rowp[col][1]=buf[col*3+1]; + rowp[col][2]=buf[col*3+2]; + rowp[col][3]=0; + } +#else for (col=0; col < width; col++) read_shorts (image[row*width+col], 3); +#endif } +#ifdef LIBRAW_LIBRARY_BUILD + free(buf); +#endif } void CLASS packed_load_raw() @@ -1743,8 +2108,8 @@ } val = bitbuf << (64-tiff_bps-vbits) >> (64-tiff_bps); RAW(row,col ^ (load_flags >> 6 & 1)) = val; - if (load_flags & 1 && (col % 10) == 9 && - fgetc(ifp) && col < width+left_margin) derror(); + if (load_flags & 1 && (col % 10) == 9 && fgetc(ifp) && + row < height+top_margin && col < width+left_margin) derror(); } vbits -= rbits; } @@ -1754,6 +2119,7 @@ { uchar *data, *dp; int rev, dwide, row, col, c; + double sum[]={0,0}; rev = 3 * (order == 0x4949); dwide = (raw_width * 5 + 1) / 4; @@ -1779,17 +2145,78 @@ #endif free (data); maximum = 0x3ff; + if (strncmp(make,"OmniVision",10)) return; + row = raw_height/2; + FORC(width-1) { + sum[ c & 1] += SQR(RAW(row,c)-RAW(row+1,c+1)); + sum[~c & 1] += SQR(RAW(row+1,c)-RAW(row,c+1)); + } + if (sum[1] > sum[0]) filters = 0x4b4b4b4b; +} + +void CLASS android_tight_load_raw() +{ + uchar *data, *dp; + int bwide, row, col, c; + + bwide = -(-5*raw_width >> 5) << 3; + data = (uchar *) malloc (bwide); + merror (data, "android_tight_load_raw()"); + for (row=0; row < raw_height; row++) { + if (fread (data, 1, bwide, ifp) < bwide) derror(); + for (dp=data, col=0; col < raw_width; dp+=5, col+=4) + FORC4 RAW(row,col+c) = (dp[c] << 2) | (dp[4] >> (c << 1) & 3); +} + free (data); +} + +void CLASS android_loose_load_raw() +{ + uchar *data, *dp; + int bwide, row, col, c; + UINT64 bitbuf=0; + + bwide = (raw_width+5)/6 << 3; + data = (uchar *) malloc (bwide); + merror (data, "android_loose_load_raw()"); + for (row=0; row < raw_height; row++) { + if (fread (data, 1, bwide, ifp) < bwide) derror(); + for (dp=data, col=0; col < raw_width; dp+=8, col+=6) { + FORC(8) bitbuf = (bitbuf << 8) | dp[c^7]; + FORC(6) RAW(row,col+c) = (bitbuf >> c*10) & 0x3ff; + } + } + free (data); } void CLASS canon_rmf_load_raw() { int row, col, bits, orow, ocol, c; +#ifdef LIBRAW_LIBRARY_BUILD + int *words = (int*)malloc(sizeof(int)*(raw_width/3+1)); + merror(words,"canon_rmf_load_raw"); +#endif for (row=0; row < raw_height; row++) { #ifdef LIBRAW_LIBRARY_BUILD checkCancel(); -#endif + fread(words,sizeof(int),raw_width/3,ifp); + for (col=0; col < raw_width-2; col+=3) + { + bits = words[col/3]; + FORC3 { + orow = row; + if ((ocol = col+c-4) < 0) + { + ocol += raw_width; + if ((orow -= 2) < 0) + orow += raw_height; + } + RAW(orow,ocol) = curve[bits >> (10*c+2) & 0x3ff]; + } + } +#else for (col=0; col < raw_width-2; col+=3) { bits = get4(); FORC3 { @@ -1799,18 +2226,22 @@ if ((orow -= 2) < 0) orow += raw_height; } - RAW(orow,ocol) = bits >> (10*c+2) & 0x3ff; + RAW(orow,ocol) = curve[bits >> (10*c+2) & 0x3ff]; } } - } - maximum = 0x3ff; +#endif + } +#ifdef LIBRAW_LIBRARY_BUILD + free(words); +#endif + maximum = curve[0x3ff]; } unsigned CLASS pana_bits (int nbits) { #ifndef LIBRAW_NOTHREADS #define buf tls->pana_bits.buf -#define vbits tls->pana_bits.vbits +#define vbits tls->pana_bits.vbits #else static uchar buf[0x4000]; static int vbits; @@ -2068,12 +2499,12 @@ (c-pt[i-2]) / (pt[i]-pt[i-2]) * (pt[i+1]-pt[i-1]) + pt[i-1] + 0.5; for (s=i=0; i < sizeof src; i+=2) FORC(256 >> src[i]) - huff[0][s++] = src[i] << 8 | (uchar) src[i+1]; + ((ushort *)huff)[s++] = src[i] << 8 | (uchar) src[i+1]; s = kodak_cbpp == 243 ? 2 : 3; FORC(256) huff[18][c] = (8-s) << 8 | c >> s << s | 1 << (s-1); getbits(-1); for (i=0; i < sizeof(buf)/sizeof(short); i++) - buf[0][0][i] = 2048; + ((short *)buf)[i] = 2048; for (row=0; row < height; row+=4) { #ifdef LIBRAW_LIBRARY_BUILD checkCancel(); @@ -2085,7 +2516,7 @@ x = ~((~0u) << (s-1)); val <<= 12-s; for (i=0; i < sizeof(buf[0])/sizeof(short); i++) - buf[c][0][i] = (buf[c][0][i] * val + x) >> s; + ((short *)buf[c])[i] = (((short *)buf[c])[i] * val + x) >> s; last[c] = mul[c]; for (r=0; r <= !c; r++) { buf[c][1][width/2] = buf[c][2][width/2] = mul[c] << 7; @@ -2142,18 +2573,12 @@ void CLASS lossy_dng_load_raw() {} #else -#ifdef LIBRAW_LIBRARY_BUILD -void CLASS kodak_jpeg_load_raw() {} -#else +#ifndef LIBRAW_LIBRARY_BUILD METHODDEF(boolean) fill_input_buffer (j_decompress_ptr cinfo) { -#ifndef LIBRAW_NOTHREADS -#define jpeg_buffer tls->jpeg_buffer -#else static uchar jpeg_buffer[4096]; -#endif size_t nbytes; nbytes = fread (jpeg_buffer, 1, 4096, ifp); @@ -2161,11 +2586,7 @@ cinfo->src->next_input_byte = jpeg_buffer; cinfo->src->bytes_in_buffer = nbytes; return TRUE; -#ifndef LIBRAW_NOTHREADS -#undef jpeg_buffer -#endif } - void CLASS kodak_jpeg_load_raw() { struct jpeg_decompress_struct cinfo; @@ -2183,26 +2604,14 @@ if ((cinfo.output_width != width ) || (cinfo.output_height*2 != height ) || (cinfo.output_components != 3 )) { -#ifdef DCRAW_VERBOSE fprintf (stderr,_("%s: incorrect JPEG dimensions\n"), ifname); -#endif jpeg_destroy_decompress (&cinfo); -#ifdef LIBRAW_LIBRARY_BUILD - throw LIBRAW_EXCEPTION_DECODE_JPEG; -#else longjmp (failure, 3); -#endif } buf = (*cinfo.mem->alloc_sarray) - ((j_common_ptr) &cinfo, JPOOL_IMAGE, width*3, 1); + ((j_common_ptr) &cinfo, JPOOL_IMAGE, width*3, 1); -#ifdef LIBRAW_LIBRARY_BUILD - try { -#endif while (cinfo.output_scanline < cinfo.output_height) { -#ifdef LIBRAW_LIBRARY_BUILD - checkCancel(); -#endif row = cinfo.output_scanline * 2; jpeg_read_scanlines (&cinfo, buf, 1); pixel = (JSAMPLE (*)[3]) buf[0]; @@ -2213,17 +2622,94 @@ RAW(row+1,col+0) = pixel[col][2] + pixel[col+1][2]; } } -#ifdef LIBRAW_LIBRARY_BUILD - } catch(...) { - jpeg_finish_decompress (&cinfo); - jpeg_destroy_decompress (&cinfo); - throw; - } -#endif jpeg_finish_decompress (&cinfo); jpeg_destroy_decompress (&cinfo); maximum = 0xff << 1; } +#else + +struct jpegErrorManager { + struct jpeg_error_mgr pub; +}; + +static void jpegErrorExit (j_common_ptr cinfo) +{ + jpegErrorManager* myerr = (jpegErrorManager*) cinfo->err; + throw LIBRAW_EXCEPTION_DECODE_JPEG; +} + + +// LibRaw's Kodak_jpeg_load_raw +void CLASS kodak_jpeg_load_raw() +{ + if(data_size < 1) + throw LIBRAW_EXCEPTION_DECODE_JPEG; + + int row, col; + jpegErrorManager jerr; + struct jpeg_decompress_struct cinfo; + + cinfo.err = jpeg_std_error(&jerr.pub); + jerr.pub.error_exit = jpegErrorExit; + + unsigned char *jpg_buf = (unsigned char *)malloc(data_size); + merror(jpg_buf,"kodak_jpeg_load_raw"); + unsigned char *pixel_buf = (unsigned char*) malloc(width*3); + jpeg_create_decompress (&cinfo); + merror(pixel_buf,"kodak_jpeg_load_raw"); + + fread(jpg_buf,data_size,1,ifp); + swab ((char*)jpg_buf, (char*)jpg_buf, data_size); + try + { + jpeg_mem_src(&cinfo, jpg_buf, data_size); + int rc = jpeg_read_header(&cinfo, TRUE); + if(rc!=1) + throw LIBRAW_EXCEPTION_DECODE_JPEG; + + jpeg_start_decompress (&cinfo); + if ((cinfo.output_width != width ) || + (cinfo.output_height*2 != height ) || + (cinfo.output_components != 3 )) + { + throw LIBRAW_EXCEPTION_DECODE_JPEG; + } + + unsigned char *buf[1]; + buf[0] = pixel_buf; + + while (cinfo.output_scanline < cinfo.output_height) + { + checkCancel(); + row = cinfo.output_scanline * 2; + jpeg_read_scanlines (&cinfo, buf, 1); + unsigned char (*pixel)[3] = (unsigned char (*)[3]) buf[0]; + for (col=0; col < width; col+=2) { + RAW(row+0,col+0) = pixel[col+0][1] << 1; + RAW(row+1,col+1) = pixel[col+1][1] << 1; + RAW(row+0,col+1) = pixel[col][0] + pixel[col+1][0]; + RAW(row+1,col+0) = pixel[col][2] + pixel[col+1][2]; + } + } + } + catch (...) + { + jpeg_finish_decompress (&cinfo); + jpeg_destroy_decompress (&cinfo); + free(jpg_buf); + free(pixel_buf); + throw; + } + jpeg_finish_decompress (&cinfo); + jpeg_destroy_decompress (&cinfo); + free(jpg_buf); + free(pixel_buf); + maximum = 0xff << 1; +} +#endif + +#ifndef LIBRAW_LIBRARY_BUILD +void CLASS gamma_curve (double pwr, double ts, int mode, int imax); #endif void CLASS lossy_dng_load_raw() @@ -2234,29 +2720,34 @@ JSAMPLE (*pixel)[3]; unsigned sorder=order, ntags, opcode, deg, i, j, c; unsigned save=data_offset-4, trow=0, tcol=0, row, col; - ushort t_curve[3][256]; + ushort cur[3][256]; double coeff[9], tot; - fseek (ifp, meta_offset, SEEK_SET); - order = 0x4d4d; - ntags = get4(); - while (ntags--) { - opcode = get4(); get4(); get4(); - if (opcode != 8) - { fseek (ifp, get4(), SEEK_CUR); continue; } - fseek (ifp, 20, SEEK_CUR); - if ((c = get4()) > 2) break; - fseek (ifp, 12, SEEK_CUR); - if ((deg = get4()) > 8) break; - for (i=0; i <= deg && i < 9; i++) - coeff[i] = getreal(12); - for (i=0; i < 256; i++) { - for (tot=j=0; j <= deg; j++) - tot += coeff[j] * pow(i/255.0, (int)j); - t_curve[c][i] = tot*0xffff; + if (meta_offset) { + fseek (ifp, meta_offset, SEEK_SET); + order = 0x4d4d; + ntags = get4(); + while (ntags--) { + opcode = get4(); get4(); get4(); + if (opcode != 8) + { fseek (ifp, get4(), SEEK_CUR); continue; } + fseek (ifp, 20, SEEK_CUR); + if ((c = get4()) > 2) break; + fseek (ifp, 12, SEEK_CUR); + if ((deg = get4()) > 8) break; + for (i=0; i <= deg && i < 9; i++) + coeff[i] = getreal(12); + for (i=0; i < 256; i++) { + for (tot=j=0; j <= deg; j++) + tot += coeff[j] * pow(i/255.0, (int)j); + cur[c][i] = tot*0xffff; + } } + order = sorder; + } else { + gamma_curve (1/2.4, 12.92, 1, 255); + FORC3 memcpy (cur[c], curve, sizeof cur[0]); } - order = sorder; cinfo.err = jpeg_std_error (&jerr); jpeg_create_decompress (&cinfo); while (trow < raw_height) { @@ -2287,7 +2778,7 @@ jpeg_read_scanlines (&cinfo, buf, 1); pixel = (JSAMPLE (*)[3]) buf[0]; for (col=0; col < cinfo.output_width && tcol+col < width; col++) { - FORC3 image[row*width+tcol+col][c] = t_curve[c][pixel[col][c]]; + FORC3 image[row*width+tcol+col][c] = cur[c][pixel[col][c]]; } } #ifdef LIBRAW_LIBRARY_BUILD @@ -2352,13 +2843,13 @@ maximum = curve[0xff]; } -void CLASS kodak_yrgb_load_raw() +void CLASS kodak_c330_load_raw() { uchar *pixel; int row, col, y, cb, cr, rgb[3], c; - pixel = (uchar *) calloc (raw_width, 3*sizeof *pixel); - merror (pixel, "kodak_yrgb_load_raw()"); + pixel = (uchar *) calloc (raw_width, 2*sizeof *pixel); + merror (pixel, "kodak_c330_load_raw()"); #ifdef LIBRAW_LIBRARY_BUILD try { #endif @@ -2366,13 +2857,50 @@ #ifdef LIBRAW_LIBRARY_BUILD checkCancel(); #endif - if (~row & 1) + if (fread (pixel, raw_width, 2, ifp) < 2) derror(); + if (load_flags && (row & 31) == 31) + fseek (ifp, raw_width*32, SEEK_CUR); + for (col=0; col < width; col++) { + y = pixel[col*2]; + cb = pixel[(col*2 & -4) | 1] - 128; + cr = pixel[(col*2 & -4) | 3] - 128; + rgb[1] = y - ((cb + cr + 2) >> 2); + rgb[2] = rgb[1] + cb; + rgb[0] = rgb[1] + cr; + FORC3 image[row*width+col][c] = curve[LIM(rgb[c],0,255)]; + } + } +#ifdef LIBRAW_LIBRARY_BUILD + } catch(...) { + free (pixel); + throw; + } +#endif + free (pixel); + maximum = curve[0xff]; +} + +void CLASS kodak_c603_load_raw() +{ + uchar *pixel; + int row, col, y, cb, cr, rgb[3], c; + + pixel = (uchar *) calloc (raw_width, 3*sizeof *pixel); + merror (pixel, "kodak_c603_load_raw()"); +#ifdef LIBRAW_LIBRARY_BUILD + try { +#endif + for (row=0; row < height; row++) { +#ifdef LIBRAW_LIBRARY_BUILD + checkCancel(); +#endif + if (~row & 1) if (fread (pixel, raw_width, 3, ifp) < 3) derror(); - for (col=0; col < raw_width; col++) { + for (col=0; col < width; col++) { y = pixel[width*2*(row & 1) + col]; cb = pixel[width + (col & -2)] - 128; cr = pixel[width + (col & -2)+1] - 128; - rgb[1] = y-((cb + cr + 2) >> 2); + rgb[1] = y - ((cb + cr + 2) >> 2); rgb[2] = rgb[1] + cb; rgb[0] = rgb[1] + cr; FORC3 image[row*width+col][c] = curve[LIM(rgb[c],0,255)]; @@ -2515,6 +3043,7 @@ ushort *ip; if (!image) return; + unsigned int bits = (load_flags && load_flags > 9 && load_flags < 17)?load_flags:10; for (row=0; row < height; row+=2) { #ifdef LIBRAW_LIBRARY_BUILD @@ -2532,7 +3061,7 @@ rgb[0] = rgb[1] + cr; for (j=0; j < 2; j++) for (k=0; k < 2; k++) { - if ((y[j][k] = y[j][k^1] + *bp++) >> 10) derror(); + if ((y[j][k] = y[j][k^1] + *bp++) >> bits) derror(); ip = image[(row+j)*width + col+i+k]; FORC3 ip[c] = curve[LIM(y[j][k]+rgb[c], 0, 0xfff)]; } @@ -2544,13 +3073,9 @@ void CLASS kodak_rgb_load_raw() { short buf[768], *bp; - int row, col, len, c, i, rgb[3]; + int row, col, len, c, i, rgb[3],ret; ushort *ip=image[0]; -#ifndef LIBRAW_LIBRARY_BUILD - if (raw_image) free (raw_image); - raw_image = 0; -#endif for (row=0; row < height; row++) { #ifdef LIBRAW_LIBRARY_BUILD @@ -2558,10 +3083,17 @@ #endif for (col=0; col < width; col+=256) { len = MIN (256, width-col); - kodak_65000_decode (buf, len*3); + ret = kodak_65000_decode (buf, len*3); memset (rgb, 0, sizeof rgb); for (bp=buf, i=0; i < len; i++, ip+=4) - FORC3 if ((ip[c] = rgb[c] += *bp++) >> 12) derror(); +#ifdef LIBRAW_LIBRARY_BUILD + if(load_flags == 12) + { + FORC3 ip[c] = ret ? (*bp++) : (rgb[c] += *bp++); + } + else +#endif + FORC3 if ((ip[c] = ret ? (*bp++) : (rgb[c] += *bp++)) >> 12) derror(); } } } @@ -2593,16 +3125,11 @@ for (p=0; p < 127; p++) pad[p] = htonl(pad[p]); } -#if 1 // Avoid gcc 4.8 bug while (len--) { *data++ ^= pad[p & 127] = pad[(p+1) & 127] ^ pad[(p+65) & 127]; - p++; + p++; } -#else - while (len--) - *data++ ^= pad[p++ & 127] = pad[(p+1) & 127] ^ pad[(p+65) & 127]; -#endif #ifndef LIBRAW_NOTHREADS #undef pad #undef p @@ -2621,7 +3148,7 @@ key = get4(); fseek (ifp, 164600, SEEK_SET); fread (head, 1, 40, ifp); - sony_decrypt ((unsigned int *) head, 10, 1, key); + sony_decrypt ((unsigned *) head, 10, 1, key); for (i=26; i-- > 22; ) key = key << 8 | head[i]; fseek (ifp, data_offset, SEEK_SET); @@ -2631,7 +3158,7 @@ #endif pixel = raw_image + row*raw_width; if (fread (pixel, 2, raw_width, ifp) < raw_width) derror(); - sony_decrypt ((unsigned int *) pixel, raw_width/2, !row, key); + sony_decrypt ((unsigned *) pixel, raw_width/2, !row, key); for (col=0; col < raw_width; col++) if ((pixel[col] = ntohs(pixel[col])) >> 14) derror(); } @@ -2640,14 +3167,15 @@ void CLASS sony_arw_load_raw() { - ushort huff[32768]; + ushort huff[32770]; static const ushort tab[18] = { 0xf11,0xf10,0xe0f,0xd0e,0xc0d,0xb0c,0xa0b,0x90a,0x809, 0x708,0x607,0x506,0x405,0x304,0x303,0x300,0x202,0x201 }; - int i, c, n, col, row, len, diff, sum=0; + int i, c, n, col, row, sum=0; + huff[0] = 15; for (n=i=0; i < 18; i++) - FORC(32768 >> (tab[i] >> 8)) huff[n++] = tab[i]; + FORC(32768 >> (tab[i] >> 8)) huff[++n] = tab[i]; getbits(-1); for (col = raw_width; col--; ) { @@ -2656,11 +3184,7 @@ #endif for (row=0; row < raw_height+1; row+=2) { if (row == raw_height) row = 1; - len = getbithuff(15,huff); - diff = getbits(len); - if ((diff & (1 << (len-1))) == 0) - diff -= (1 << len) - 1; - if ((sum += diff) >> 12) derror(); + if ((sum += ljpeg_diff(huff)) >> 12) derror(); if (row < height) RAW(row,col) = sum; } } @@ -2672,7 +3196,7 @@ ushort pix[16]; int row, col, val, max, min, imax, imin, sh, bit, i; - data = (uchar *) malloc (raw_width); + data = (uchar *) malloc (raw_width+1); merror (data, "sony_arw2_load_raw()"); #ifdef LIBRAW_LIBRARY_BUILD try { @@ -2688,6 +3212,52 @@ imax = 0x0f & val >> 22; imin = 0x0f & val >> 26; for (sh=0; sh < 4 && 0x80 << sh <= max-min; sh++); +#ifdef LIBRAW_LIBRARY_BUILD + /* flag checks if outside of loop */ + if(imgdata.params.sony_arw2_options == LIBRAW_SONYARW2_NONE + || imgdata.params.sony_arw2_options == LIBRAW_SONYARW2_DELTATOVALUE + ) + { + for (bit=30, i=0; i < 16; i++) + if (i == imax) pix[i] = max; + else if (i == imin) pix[i] = min; + else { + pix[i] = ((sget2(dp+(bit >> 3)) >> (bit & 7) & 0x7f) << sh) + min; + if (pix[i] > 0x7ff) pix[i] = 0x7ff; + bit += 7; + } + } + else if(imgdata.params.sony_arw2_options == LIBRAW_SONYARW2_BASEONLY) + { + for (bit=30, i=0; i < 16; i++) + if (i == imax) pix[i] = max; + else if (i == imin) pix[i] = min; + else pix[i]=0; + } + else if(imgdata.params.sony_arw2_options == LIBRAW_SONYARW2_DELTAONLY) + { + for (bit=30, i=0; i < 16; i++) + if (i == imax) pix[i] = 0; + else if (i == imin) pix[i] = 0; + else { + pix[i] = ((sget2(dp+(bit >> 3)) >> (bit & 7) & 0x7f) << sh) + min; + if (pix[i] > 0x7ff) pix[i] = 0x7ff; + bit += 7; + } + } + else if(imgdata.params.sony_arw2_options == LIBRAW_SONYARW2_DELTAZEROBASE) + { + for (bit=30, i=0; i < 16; i++) + if (i == imax) pix[i] = 0; + else if (i == imin) pix[i] = 0; + else { + pix[i] = ((sget2(dp+(bit >> 3)) >> (bit & 7) & 0x7f) << sh); + if (pix[i] > 0x7ff) pix[i] = 0x7ff; + bit += 7; + } + } +#else + /* unaltered dcraw processing */ for (bit=30, i=0; i < 16; i++) if (i == imax) pix[i] = max; else if (i == imin) pix[i] = min; @@ -2696,17 +3266,24 @@ if (pix[i] > 0x7ff) pix[i] = 0x7ff; bit += 7; } +#endif + #ifdef LIBRAW_LIBRARY_BUILD - if(imgdata.params.sony_arw2_hack) - { - for (i=0; i < 16; i++, col+=2) - RAW(row,col) = curve[pix[i] << 1]; - } + if(imgdata.params.sony_arw2_options == LIBRAW_SONYARW2_DELTATOVALUE) + { + for (i=0; i < 16; i++, col+=2) + { + unsigned slope = pix[i] < 1001? 2 : curve[pix[i]<<1]-curve[(pix[i]<<1)-2]; + unsigned step = 1 << sh; + RAW(row,col)=curve[pix[i]<<1]>black+imgdata.params.sony_arw2_posterization_thr? + LIM(((slope*step*1000)/(curve[pix[i]<<1]-black)),0,10000):0; + } + } else - { - for (i=0; i < 16; i++, col+=2) - RAW(row,col) = curve[pix[i] << 1] >> 2; - } + { + for (i=0; i < 16; i++, col+=2) + RAW(row,col) = curve[pix[i] << 1]; + } #else for (i=0; i < 16; i++, col+=2) RAW(row,col) = curve[pix[i] << 1] >> 2; @@ -2719,15 +3296,10 @@ free (data); throw; } + if(imgdata.params.sony_arw2_options == LIBRAW_SONYARW2_DELTATOVALUE) + maximum=10000; #endif free (data); -#ifdef LIBRAW_LIBRARY_BUILD - if(imgdata.params.sony_arw2_hack) - { - black <<= 2; - maximum <<=2; - } -#endif } void CLASS samsung_load_raw() @@ -2759,6 +3331,88 @@ } } } + for (row=0; row < raw_height-1; row+=2) + for (col=0; col < raw_width-1; col+=2) + SWAP (RAW(row,col+1), RAW(row+1,col)); +} + +void CLASS samsung2_load_raw() +{ + static const ushort tab[14] = + { 0x304,0x307,0x206,0x205,0x403,0x600,0x709, + 0x80a,0x90b,0xa0c,0xa0d,0x501,0x408,0x402 }; + ushort huff[1026], vpred[2][2] = {{0,0},{0,0}}, hpred[2]; + int i, c, n, row, col, diff; + + huff[0] = 10; + for (n=i=0; i < 14; i++) + FORC(1024 >> (tab[i] >> 8)) huff[++n] = tab[i]; + getbits(-1); + for (row=0; row < raw_height; row++) + { +#ifdef LIBRAW_LIBRARY_BUILD + checkCancel(); +#endif + for (col=0; col < raw_width; col++) { + diff = ljpeg_diff (huff); + if (col < 2) hpred[col] = vpred[row & 1][col] += diff; + else hpred[col & 1] += diff; + RAW(row,col) = hpred[col & 1]; + if (hpred[col & 1] >> tiff_bps) derror(); + } + } +} + +void CLASS samsung3_load_raw() +{ + int opt, init, mag, pmode, row, tab, col, pred, diff, i, c; + ushort lent[3][2], len[4], *prow[2]; + + order = 0x4949; + fseek (ifp, 9, SEEK_CUR); + opt = fgetc(ifp); + init = (get2(),get2()); + for (row=0; row < raw_height; row++) { +#ifdef LIBRAW_LIBRARY_BUILD + checkCancel(); +#endif + fseek (ifp, (data_offset-ftell(ifp)) & 15, SEEK_CUR); + ph1_bits(-1); + mag = 0; pmode = 7; + FORC(6) ((ushort *)lent)[c] = row < 2 ? 7:4; + prow[ row & 1] = &RAW(row-1,1-((row & 1) << 1)); // green + prow[~row & 1] = &RAW(row-2,0); // red and blue + for (tab=0; tab+15 < raw_width; tab+=16) { + if (~opt & 4 && !(tab & 63)) { + i = ph1_bits(2); + mag = i < 3 ? mag-'2'+"204"[i] : ph1_bits(12); + } + if (opt & 2) + pmode = 7 - 4*ph1_bits(1); + else if (!ph1_bits(1)) + pmode = ph1_bits(3); + if (opt & 1 || !ph1_bits(1)) { + FORC4 len[c] = ph1_bits(2); + FORC4 { + i = ((row & 1) << 1 | (c & 1)) % 3; + len[c] = len[c] < 3 ? lent[i][0]-'1'+"120"[len[c]] : ph1_bits(4); + lent[i][0] = lent[i][1]; + lent[i][1] = len[c]; + } + } + FORC(16) { + col = tab + (((c & 7) << 1)^(c >> 3)^(row & 1)); + pred = (pmode == 7 || row < 2) + ? (tab ? RAW(row,tab-2+(col & 1)) : init) + : (prow[col & 1][col-'4'+"0224468"[pmode]] + + prow[col & 1][col-'4'+"0244668"[pmode]] + 1) >> 1; + diff = ph1_bits (i = len[c >> 2]); + if (diff >> (i-1)) diff -= 1 << i; + diff = diff * (mag*2+1) + mag; + RAW(row,col) = pred + diff; + } + } + } } #define HOLE(row) ((holes >> (((row) - raw_height) & 7)) & 1) @@ -2882,10 +3536,10 @@ fseek (ifp, 67, SEEK_SET); offset = get4(); - nseg = fgetc(ifp); + nseg = (uchar) fgetc(ifp); fseek (ifp, offset, SEEK_SET); for (i=0; i < nseg*2; i++) - seg[0][i] = get4() + data_offset*(i & 1); + ((unsigned *)seg)[i] = get4() + data_offset*(i & 1); fseek (ifp, 78, SEEK_SET); holes = fgetc(ifp); fseek (ifp, 88, SEEK_SET); @@ -2920,10 +3574,10 @@ if (!jimg) longjmp (failure, 3); #else if(!jimg) - { - jas_stream_close (in); - throw LIBRAW_EXCEPTION_DECODE_JPEG2000; - } + { + jas_stream_close (in); + throw LIBRAW_EXCEPTION_DECODE_JPEG2000; + } #endif jmat = jas_matrix_create (height/2, width/2); merror (jmat, "redcine_load_raw()"); @@ -2985,11 +3639,10 @@ #endif #endif } -#line 3986 "dcraw/dcraw.c" void CLASS crop_masked_pixels() { int row, col; - unsigned + unsigned #ifndef LIBRAW_LIBRARY_BUILD r, raw_pitch = raw_width*2, c, m, mblack[8], zero, val; @@ -3022,11 +3675,11 @@ BAYER2(row,col) = RAW(row+top_margin,col+left_margin); } #endif - if (mask[0][3]) goto mask_set; + if (mask[0][3] > 0) goto mask_set; if (load_raw == &CLASS canon_load_raw || load_raw == &CLASS lossless_jpeg_load_raw) { - mask[0][1] = mask[1][1] = 2; - mask[0][3] = -2; + mask[0][1] = mask[1][1] += 2; + mask[0][3] -= 2; goto sides; } if (load_raw == &CLASS canon_600_load_raw || @@ -3061,8 +3714,10 @@ #ifndef LIBRAW_LIBRARY_BUILD canon_600_correct(); #endif - } else if (zero < mblack[4] && mblack[5] && mblack[6] && mblack[7]) + } else if (zero < mblack[4] && mblack[5] && mblack[6] && mblack[7]) { FORC4 cblack[c] = mblack[c] / mblack[4+c]; + cblack[4] = cblack[5] = cblack[6] = 0; + } } #ifdef LIBRAW_LIBRARY_BUILD #undef mblack @@ -3091,7 +3746,41 @@ RUN_CALLBACK(LIBRAW_PROGRESS_REMOVE_ZEROES,1,2); #endif } -#line 4257 "dcraw/dcraw.c" + +static const uchar xlat[2][256] = { + { 0xc1,0xbf,0x6d,0x0d,0x59,0xc5,0x13,0x9d,0x83,0x61,0x6b,0x4f,0xc7,0x7f,0x3d,0x3d, + 0x53,0x59,0xe3,0xc7,0xe9,0x2f,0x95,0xa7,0x95,0x1f,0xdf,0x7f,0x2b,0x29,0xc7,0x0d, + 0xdf,0x07,0xef,0x71,0x89,0x3d,0x13,0x3d,0x3b,0x13,0xfb,0x0d,0x89,0xc1,0x65,0x1f, + 0xb3,0x0d,0x6b,0x29,0xe3,0xfb,0xef,0xa3,0x6b,0x47,0x7f,0x95,0x35,0xa7,0x47,0x4f, + 0xc7,0xf1,0x59,0x95,0x35,0x11,0x29,0x61,0xf1,0x3d,0xb3,0x2b,0x0d,0x43,0x89,0xc1, + 0x9d,0x9d,0x89,0x65,0xf1,0xe9,0xdf,0xbf,0x3d,0x7f,0x53,0x97,0xe5,0xe9,0x95,0x17, + 0x1d,0x3d,0x8b,0xfb,0xc7,0xe3,0x67,0xa7,0x07,0xf1,0x71,0xa7,0x53,0xb5,0x29,0x89, + 0xe5,0x2b,0xa7,0x17,0x29,0xe9,0x4f,0xc5,0x65,0x6d,0x6b,0xef,0x0d,0x89,0x49,0x2f, + 0xb3,0x43,0x53,0x65,0x1d,0x49,0xa3,0x13,0x89,0x59,0xef,0x6b,0xef,0x65,0x1d,0x0b, + 0x59,0x13,0xe3,0x4f,0x9d,0xb3,0x29,0x43,0x2b,0x07,0x1d,0x95,0x59,0x59,0x47,0xfb, + 0xe5,0xe9,0x61,0x47,0x2f,0x35,0x7f,0x17,0x7f,0xef,0x7f,0x95,0x95,0x71,0xd3,0xa3, + 0x0b,0x71,0xa3,0xad,0x0b,0x3b,0xb5,0xfb,0xa3,0xbf,0x4f,0x83,0x1d,0xad,0xe9,0x2f, + 0x71,0x65,0xa3,0xe5,0x07,0x35,0x3d,0x0d,0xb5,0xe9,0xe5,0x47,0x3b,0x9d,0xef,0x35, + 0xa3,0xbf,0xb3,0xdf,0x53,0xd3,0x97,0x53,0x49,0x71,0x07,0x35,0x61,0x71,0x2f,0x43, + 0x2f,0x11,0xdf,0x17,0x97,0xfb,0x95,0x3b,0x7f,0x6b,0xd3,0x25,0xbf,0xad,0xc7,0xc5, + 0xc5,0xb5,0x8b,0xef,0x2f,0xd3,0x07,0x6b,0x25,0x49,0x95,0x25,0x49,0x6d,0x71,0xc7 }, + { 0xa7,0xbc,0xc9,0xad,0x91,0xdf,0x85,0xe5,0xd4,0x78,0xd5,0x17,0x46,0x7c,0x29,0x4c, + 0x4d,0x03,0xe9,0x25,0x68,0x11,0x86,0xb3,0xbd,0xf7,0x6f,0x61,0x22,0xa2,0x26,0x34, + 0x2a,0xbe,0x1e,0x46,0x14,0x68,0x9d,0x44,0x18,0xc2,0x40,0xf4,0x7e,0x5f,0x1b,0xad, + 0x0b,0x94,0xb6,0x67,0xb4,0x0b,0xe1,0xea,0x95,0x9c,0x66,0xdc,0xe7,0x5d,0x6c,0x05, + 0xda,0xd5,0xdf,0x7a,0xef,0xf6,0xdb,0x1f,0x82,0x4c,0xc0,0x68,0x47,0xa1,0xbd,0xee, + 0x39,0x50,0x56,0x4a,0xdd,0xdf,0xa5,0xf8,0xc6,0xda,0xca,0x90,0xca,0x01,0x42,0x9d, + 0x8b,0x0c,0x73,0x43,0x75,0x05,0x94,0xde,0x24,0xb3,0x80,0x34,0xe5,0x2c,0xdc,0x9b, + 0x3f,0xca,0x33,0x45,0xd0,0xdb,0x5f,0xf5,0x52,0xc3,0x21,0xda,0xe2,0x22,0x72,0x6b, + 0x3e,0xd0,0x5b,0xa8,0x87,0x8c,0x06,0x5d,0x0f,0xdd,0x09,0x19,0x93,0xd0,0xb9,0xfc, + 0x8b,0x0f,0x84,0x60,0x33,0x1c,0x9b,0x45,0xf1,0xf0,0xa3,0x94,0x3a,0x12,0x77,0x33, + 0x4d,0x44,0x78,0x28,0x3c,0x9e,0xfd,0x65,0x57,0x16,0x94,0x6b,0xfb,0x59,0xd0,0xc8, + 0x22,0x36,0xdb,0xd2,0x63,0x98,0x43,0xa1,0x04,0x87,0x86,0xf7,0xa6,0x26,0xbb,0xd6, + 0x59,0x4d,0xbf,0x6a,0x2e,0xaa,0x2b,0xef,0xe6,0x78,0xb6,0x4e,0xe0,0x2f,0xdc,0x7c, + 0xbe,0x57,0x19,0x32,0x7e,0x2a,0xd0,0xb8,0xba,0x29,0x00,0x3c,0x52,0x7d,0xa8,0x49, + 0x3b,0x2d,0xeb,0x25,0x49,0xfa,0xa3,0xaa,0x39,0xa7,0xc5,0xa7,0x50,0x11,0x36,0xfb, + 0xc6,0x67,0x4a,0xf5,0xa5,0x12,0x65,0x7e,0xb0,0xdf,0xaf,0x4e,0xb3,0x61,0x7f,0x2f } }; + void CLASS gamma_curve (double pwr, double ts, int mode, int imax) { int i; @@ -3156,7 +3845,7 @@ out[i][j] += work[j][k+3] * in[i][k]; } -void CLASS cam_xyz_coeff (double cam_xyz[4][3]) +void CLASS cam_xyz_coeff (float _rgb_cam[3][4], double cam_xyz[4][3]) { double cam_rgb[4][3], inverse[4][3], num; int i, j, k; @@ -3183,9 +3872,9 @@ } } pseudoinverse (cam_rgb, inverse, colors); - for (raw_color = i=0; i < 3; i++) + for (i=0; i < 3; i++) for (j=0; j < colors; j++) - rgb_cam[i][j] = inverse[j][i]; + _rgb_cam[i][j] = inverse[j][i]; } #ifdef COLORCHECK @@ -3222,8 +3911,8 @@ { 0.310, 0.316, 9.0 }, // Neutral 3.5 { 0.310, 0.316, 3.1 } }; // Black double gmb_cam[NSQ][4], gmb_xyz[NSQ][3]; - double inverse[NSQ][3], cam_xyz[4][3], num; - int c, i, j, k, sq, row, col, count[4]; + double inverse[NSQ][3], cam_xyz[4][3], balance[4], num; + int c, i, j, k, sq, row, col, pass, count[4]; memset (gmb_cam, 0, sizeof gmb_cam); for (sq=0; sq < NSQ; sq++) { @@ -3232,7 +3921,8 @@ for (col=cut[sq][2]; col < cut[sq][2]+cut[sq][0]; col++) { c = FC(row,col); if (c >= colors) c -= 2; - gmb_cam[sq][c] += BAYER(row,col); + gmb_cam[sq][c] += BAYER2(row,col); + BAYER2(row,col) = black + (BAYER2(row,col)-black)/2; count[c]++; } FORCC gmb_cam[sq][c] = gmb_cam[sq][c]/count[c] - black; @@ -3242,11 +3932,16 @@ (1 - gmb_xyY[sq][0] - gmb_xyY[sq][1]) / gmb_xyY[sq][1]; } pseudoinverse (gmb_xyz, inverse, NSQ); - for (i=0; i < colors; i++) - for (j=0; j < 3; j++) - for (cam_xyz[i][j] = k=0; k < NSQ; k++) - cam_xyz[i][j] += gmb_cam[k][i] * inverse[k][j]; - cam_xyz_coeff (cam_xyz); + for (pass=0; pass < 2; pass++) { + for (raw_color = i=0; i < colors; i++) + for (j=0; j < 3; j++) + for (cam_xyz[i][j] = k=0; k < NSQ; k++) + cam_xyz[i][j] += gmb_cam[k][i] * inverse[k][j]; + cam_xyz_coeff (rgb_cam, cam_xyz); + FORCC balance[c] = pre_mul[c] * gmb_cam[20][c]; + for (sq=0; sq < NSQ; sq++) + FORCC gmb_cam[sq][c] *= balance[c]; + } if (verbose) { printf (" { \"%s %s\", %d,\n\t{", make, model, black); num = 10000 / (cam_xyz[1][0] + cam_xyz[1][1] + cam_xyz[1][2]); @@ -3372,7 +4067,7 @@ temp = fimg + size*3; if ((nc = colors) == 3 && filters) nc++; #ifdef LIBRAW_LIBRARY_BUILD -#pragma omp parallel default(shared) private(i,col,row,thold,lev,lpass,hpass,temp,c) firstprivate(scale,size) +#pragma omp parallel default(shared) private(i,col,row,thold,lev,lpass,hpass,temp,c) firstprivate(scale,size) #endif { temp = (float*)malloc( (iheight + iwidth) * sizeof *fimg); @@ -3553,6 +4248,14 @@ sum[c] += val; sum[c+4]++; } +#ifdef LIBRAW_LIBRARY_BUILD + if(load_raw == &LibRaw::nikon_load_sraw) + { + // Nikon sRAW: camera WB already applied: + pre_mul[0]=pre_mul[1]=pre_mul[2]=pre_mul[3]=1.0; + } + else +#endif if (sum[0] && sum[1] && sum[2] && sum[3]) FORC4 pre_mul[c] = (float) sum[c+4] / sum[c]; else if (cam_mul[0] && cam_mul[2]) @@ -3567,6 +4270,16 @@ #endif } } +#ifdef LIBRAW_LIBRARY_BUILD + // Nikon sRAW, daylight + if (load_raw == &LibRaw::nikon_load_sraw + && !use_camera_wb && !use_auto_wb + && cam_mul[0] > 0.001f && cam_mul[1] > 0.001f && cam_mul[2] > 0.001f ) + { + for(c=0;c<3;c++) + pre_mul[c]/=cam_mul[c]; + } +#endif if (pre_mul[1] == 0) pre_mul[1] = 1; if (pre_mul[3] == 0) pre_mul[3] = colors < 4 ? pre_mul[1] : 1; dark = black; @@ -3589,16 +4302,23 @@ fputc ('\n', stderr); } #endif + if (filters > 1000 && (cblack[4]+1)/2 == 1 && (cblack[5]+1)/2 == 1) { + FORC4 cblack[FC(c/2,c%2)] += + cblack[6 + c/2 % cblack[4] * cblack[5] + c%2 % cblack[5]]; + cblack[4] = cblack[5] = 0; + } size = iheight*iwidth; #ifdef LIBRAW_LIBRARY_BUILD scale_colors_loop(scale_mul); #else for (i=0; i < size*4; i++) { - val = image[0][i]; - if (!val) continue; + if (!(val = ((ushort *)image)[i])) continue; + if (cblack[4] && cblack[5]) + val -= cblack[6 + i/4 / iwidth % cblack[4] * cblack[5] + + i/4 % iwidth % cblack[5]]; val -= cblack[i & 3]; val *= scale_mul[i & 3]; - image[0][i] = CLIP(val); + ((ushort *)image)[i] = CLIP(val); } #endif if ((aber[0] != 1 || aber[2] != 1) && colors == 3) { @@ -4035,7 +4755,7 @@ } #define TS 512 /* Tile Size */ -#define fcol(row,col) xtrans[(row+top_margin+6)%6][(col+left_margin+6)%6] +#define fcol(row,col) xtrans[(row+6) % 6][(col+6) % 6] /* Frank Markesteijn's algorithm for Fuji X-Trans sensors @@ -4061,7 +4781,6 @@ #endif cielab (0,0); - border_interpolate(6); ndir = 4 << (passes > 1); buffer = (char *) malloc (TS*TS*(ndir*11+6)); merror (buffer, "xtrans_interpolate()"); @@ -4175,14 +4894,19 @@ } /* Interpolate red for blue pixels and vice versa: */ - for (row=top+1; row < mrow-1; row++) - for (col=left+1; col < mcol-1; col++) { + for (row=top+3; row < mrow-3; row++) + for (col=left+3; col < mcol-3; col++) { if ((f = 2-fcol(row,col)) == 1) continue; rix = &rgb[0][row-top][col-left]; - i = (row-sgrow) % 3 ? TS:1; - for (d=0; d < 4; d++, rix += TS*TS) + c = (row-sgrow) % 3 ? TS:1; + h = 3 * (c ^ TS ^ 1); + for (d=0; d < 4; d++, rix += TS*TS) { + i = d > 1 || ((d ^ c) & 1) || + ((ABS(rix[0][1]-rix[c][1])+ABS(rix[0][1]-rix[-c][1])) < + 2*(ABS(rix[0][1]-rix[h][1])+ABS(rix[0][1]-rix[-h][1]))) ? c:h; rix[0][f] = CLIP((rix[i][f] + rix[-i][f] + 2*rix[0][1] - rix[i][1] - rix[-i][1])/2); + } } /* Fill in red and blue for 2x2 blocks of green: */ @@ -4261,6 +4985,7 @@ } } free(buffer); + border_interpolate(8); } #undef fcol @@ -4487,7 +5212,7 @@ #ifdef LIBRAW_USE_OPENMP if(0== omp_get_thread_num()) #endif - if(callbacks.progress_cb) { + if(callbacks.progress_cb) { int rr = (*callbacks.progress_cb)(callbacks.progresscb_data,LIBRAW_PROGRESS_INTERPOLATE,top-2,height-7); if(rr) terminate_flag = 1; @@ -4502,7 +5227,7 @@ } free (buffer); } -#ifdef LIBRAW_LIBRARY_BUILD +#ifdef LIBRAW_LIBRARY_BUILD if(terminate_flag) throw LIBRAW_EXCEPTION_CANCELLED_BY_CALLBACK; #endif @@ -4785,7 +5510,7 @@ *type = get2(); *len = get4(); *save = ftell(ifp) + 4; - if (*len * ("11124811248488"[*type < 14 ? *type:0]-'0') > 4) + if (*len * ("11124811248484"[*type < 14 ? *type:0]-'0') > 4) fseek (ifp, get4()+base, SEEK_SET); } @@ -4801,76 +5526,1814 @@ fseek (ifp, save, SEEK_SET); } } -#line 5971 "dcraw/dcraw.c" -void CLASS parse_makernote (int base, int uptag) + +static float powf_lim(float a, float b, float limup) { - static const uchar xlat[2][256] = { - { 0xc1,0xbf,0x6d,0x0d,0x59,0xc5,0x13,0x9d,0x83,0x61,0x6b,0x4f,0xc7,0x7f,0x3d,0x3d, - 0x53,0x59,0xe3,0xc7,0xe9,0x2f,0x95,0xa7,0x95,0x1f,0xdf,0x7f,0x2b,0x29,0xc7,0x0d, - 0xdf,0x07,0xef,0x71,0x89,0x3d,0x13,0x3d,0x3b,0x13,0xfb,0x0d,0x89,0xc1,0x65,0x1f, - 0xb3,0x0d,0x6b,0x29,0xe3,0xfb,0xef,0xa3,0x6b,0x47,0x7f,0x95,0x35,0xa7,0x47,0x4f, - 0xc7,0xf1,0x59,0x95,0x35,0x11,0x29,0x61,0xf1,0x3d,0xb3,0x2b,0x0d,0x43,0x89,0xc1, - 0x9d,0x9d,0x89,0x65,0xf1,0xe9,0xdf,0xbf,0x3d,0x7f,0x53,0x97,0xe5,0xe9,0x95,0x17, - 0x1d,0x3d,0x8b,0xfb,0xc7,0xe3,0x67,0xa7,0x07,0xf1,0x71,0xa7,0x53,0xb5,0x29,0x89, - 0xe5,0x2b,0xa7,0x17,0x29,0xe9,0x4f,0xc5,0x65,0x6d,0x6b,0xef,0x0d,0x89,0x49,0x2f, - 0xb3,0x43,0x53,0x65,0x1d,0x49,0xa3,0x13,0x89,0x59,0xef,0x6b,0xef,0x65,0x1d,0x0b, - 0x59,0x13,0xe3,0x4f,0x9d,0xb3,0x29,0x43,0x2b,0x07,0x1d,0x95,0x59,0x59,0x47,0xfb, - 0xe5,0xe9,0x61,0x47,0x2f,0x35,0x7f,0x17,0x7f,0xef,0x7f,0x95,0x95,0x71,0xd3,0xa3, - 0x0b,0x71,0xa3,0xad,0x0b,0x3b,0xb5,0xfb,0xa3,0xbf,0x4f,0x83,0x1d,0xad,0xe9,0x2f, - 0x71,0x65,0xa3,0xe5,0x07,0x35,0x3d,0x0d,0xb5,0xe9,0xe5,0x47,0x3b,0x9d,0xef,0x35, - 0xa3,0xbf,0xb3,0xdf,0x53,0xd3,0x97,0x53,0x49,0x71,0x07,0x35,0x61,0x71,0x2f,0x43, - 0x2f,0x11,0xdf,0x17,0x97,0xfb,0x95,0x3b,0x7f,0x6b,0xd3,0x25,0xbf,0xad,0xc7,0xc5, - 0xc5,0xb5,0x8b,0xef,0x2f,0xd3,0x07,0x6b,0x25,0x49,0x95,0x25,0x49,0x6d,0x71,0xc7 }, - { 0xa7,0xbc,0xc9,0xad,0x91,0xdf,0x85,0xe5,0xd4,0x78,0xd5,0x17,0x46,0x7c,0x29,0x4c, - 0x4d,0x03,0xe9,0x25,0x68,0x11,0x86,0xb3,0xbd,0xf7,0x6f,0x61,0x22,0xa2,0x26,0x34, - 0x2a,0xbe,0x1e,0x46,0x14,0x68,0x9d,0x44,0x18,0xc2,0x40,0xf4,0x7e,0x5f,0x1b,0xad, - 0x0b,0x94,0xb6,0x67,0xb4,0x0b,0xe1,0xea,0x95,0x9c,0x66,0xdc,0xe7,0x5d,0x6c,0x05, - 0xda,0xd5,0xdf,0x7a,0xef,0xf6,0xdb,0x1f,0x82,0x4c,0xc0,0x68,0x47,0xa1,0xbd,0xee, - 0x39,0x50,0x56,0x4a,0xdd,0xdf,0xa5,0xf8,0xc6,0xda,0xca,0x90,0xca,0x01,0x42,0x9d, - 0x8b,0x0c,0x73,0x43,0x75,0x05,0x94,0xde,0x24,0xb3,0x80,0x34,0xe5,0x2c,0xdc,0x9b, - 0x3f,0xca,0x33,0x45,0xd0,0xdb,0x5f,0xf5,0x52,0xc3,0x21,0xda,0xe2,0x22,0x72,0x6b, - 0x3e,0xd0,0x5b,0xa8,0x87,0x8c,0x06,0x5d,0x0f,0xdd,0x09,0x19,0x93,0xd0,0xb9,0xfc, - 0x8b,0x0f,0x84,0x60,0x33,0x1c,0x9b,0x45,0xf1,0xf0,0xa3,0x94,0x3a,0x12,0x77,0x33, - 0x4d,0x44,0x78,0x28,0x3c,0x9e,0xfd,0x65,0x57,0x16,0x94,0x6b,0xfb,0x59,0xd0,0xc8, - 0x22,0x36,0xdb,0xd2,0x63,0x98,0x43,0xa1,0x04,0x87,0x86,0xf7,0xa6,0x26,0xbb,0xd6, - 0x59,0x4d,0xbf,0x6a,0x2e,0xaa,0x2b,0xef,0xe6,0x78,0xb6,0x4e,0xe0,0x2f,0xdc,0x7c, - 0xbe,0x57,0x19,0x32,0x7e,0x2a,0xd0,0xb8,0xba,0x29,0x00,0x3c,0x52,0x7d,0xa8,0x49, - 0x3b,0x2d,0xeb,0x25,0x49,0xfa,0xa3,0xaa,0x39,0xa7,0xc5,0xa7,0x50,0x11,0x36,0xfb, - 0xc6,0x67,0x4a,0xf5,0xa5,0x12,0x65,0x7e,0xb0,0xdf,0xaf,0x4e,0xb3,0x61,0x7f,0x2f } }; - unsigned offset=0, entries, tag, type, len, save, c; - unsigned ver97=0, serial=0, i, wbi=0, wb[4]={0,0,0,0}; - uchar buf97[324], ci, cj, ck; - short morder, sorder=order; - char buf[10]; - unsigned SamsungKey[11]; - static const double rgb_adobe[3][3] = // inv(sRGB2XYZ_D65) * AdobeRGB2XYZ_D65 - {{ 1.398283396477404, -0.398283116703571, 4.427165001263944E-08}, - {-1.233904514232401E-07, 0.999999995196570, 3.126724276714121e-08}, - { 4.561487232726535E-08, -0.042938290466635, 1.042938250416105 }}; - - float adobe_cam [3][3]; + return (b>limup || b < -limup)?0.f:powf(a,b); +} +static float powf64(float a, float b) +{ + return powf_lim(a,b,64.f); +} -/* - The MakerNote might have its own TIFF header (possibly with - its own byte-order!), or it might just be a table. - */ - if (!strcmp(make,"Nokia")) return; - fread (buf, 1, 10, ifp); - if (!strncmp (buf,"KDK" ,3) || /* these aren't TIFF tables */ - !strncmp (buf,"VER" ,3) || - !strncmp (buf,"IIII",4) || - !strncmp (buf,"MMMM",4)) return; - if (!strncmp (buf,"KC" ,2) || /* Konica KD-400Z, KD-510Z */ - !strncmp (buf,"MLY" ,3)) { /* Minolta DiMAGE G series */ - order = 0x4d4d; - while ((i=ftell(ifp)) < data_offset && i < 16384) { - wb[0] = wb[2]; wb[2] = wb[1]; wb[1] = wb[3]; - wb[3] = get2(); - if (wb[1] == 256 && wb[3] == 256 && - wb[0] > 256 && wb[0] < 640 && wb[2] > 256 && wb[2] < 640) - FORC4 cam_mul[c] = wb[c]; + +#ifdef LIBRAW_LIBRARY_BUILD + +static float my_roundf(float x) { + float t; + if (x >= 0.0) { + t = ceilf(x); + if (t - x > 0.5) t -= 1.0; + return t; + } else { + t = ceilf(-x); + if (t + x > 0.5) t -= 1.0; + return -t; + } +} + +static float _CanonConvertAperture(ushort in) +{ + if ((in == (ushort)0xffe0) || (in == (ushort)0x7fff)) return 0.0f; + return powf64(2.0, in/64.0); +} + +void CLASS setCanonBodyFeatures (unsigned id) + { + imgdata.lens.makernotes.CamID = id; + if ( + (id == 0x80000001) || // 1D + (id == 0x80000174) || // 1D2 + (id == 0x80000232) || // 1D2N + (id == 0x80000169) || // 1D3 + (id == 0x80000281) // 1D4 + ) + { + imgdata.lens.makernotes.CameraFormat = LIBRAW_FORMAT_APSH; + imgdata.lens.makernotes.CameraMount = LIBRAW_MOUNT_Canon_EF; + } + else + if ( + (id == 0x80000167) || // 1Ds + (id == 0x80000188) || // 1Ds2 + (id == 0x80000215) || // 1Ds3 + (id == 0x80000213) || // 5D + (id == 0x80000218) || // 5D2 + (id == 0x80000285) || // 5D3 + (id == 0x80000302) || // 6D + (id == 0x80000269) || // 1DX + (id == 0x80000324) || // 1DC + (id == 0x80000382) || // 5DS + (id == 0x80000401) // 5DS R + ) + { + imgdata.lens.makernotes.CameraFormat = LIBRAW_FORMAT_FF; + imgdata.lens.makernotes.CameraMount = LIBRAW_MOUNT_Canon_EF; + } + else + if ( + (id == 0x80000331) || // M + (id == 0x80000355) || // M2 + (id == 0x80000374) // M3 + ) + { + imgdata.lens.makernotes.CameraFormat = LIBRAW_FORMAT_APSC; + imgdata.lens.makernotes.CameraMount = LIBRAW_MOUNT_Canon_EF_M; + } + else + if ( + (id == 0x01140000) || // D30 + (id == 0x01668000) || // D60 + (id > 0x80000000) + ) + { + imgdata.lens.makernotes.CameraFormat = LIBRAW_FORMAT_APSC; + imgdata.lens.makernotes.CameraMount = LIBRAW_MOUNT_Canon_EF; + imgdata.lens.makernotes.LensMount = LIBRAW_MOUNT_Unknown; + } + else + { + imgdata.lens.makernotes.CameraMount = LIBRAW_MOUNT_FixedLens; + imgdata.lens.makernotes.LensMount = LIBRAW_MOUNT_FixedLens; + } + + return; + } + +void CLASS processCanonCameraInfo (unsigned id, uchar *CameraInfo, unsigned maxlen) +{ + ushort iCanonLensID = 0, iCanonMaxFocal = 0, iCanonMinFocal = 0, iCanonLens = 0, iCanonCurFocal = 0, iCanonFocalType = 0; + CameraInfo[0] = 0; + CameraInfo[1] = 0; + switch (id) { + case 0x80000001: // 1D + case 0x80000167: // 1DS + iCanonCurFocal = 10; + iCanonLensID = 13; + iCanonMinFocal = 14; + iCanonMaxFocal = 16; + if (!imgdata.lens.makernotes.CurFocal) + imgdata.lens.makernotes.CurFocal = sget2(CameraInfo + iCanonCurFocal); + if (!imgdata.lens.makernotes.MinFocal) + imgdata.lens.makernotes.MinFocal = sget2(CameraInfo + iCanonMinFocal); + if (!imgdata.lens.makernotes.MaxFocal) + imgdata.lens.makernotes.MaxFocal = sget2(CameraInfo + iCanonMaxFocal); + break; + case 0x80000174: // 1DMkII + case 0x80000188: // 1DsMkII + iCanonCurFocal = 9; + iCanonLensID = 12; + iCanonMinFocal = 17; + iCanonMaxFocal = 19; + iCanonFocalType = 45; + break; + case 0x80000232: // 1DMkII N + iCanonCurFocal = 9; + iCanonLensID = 12; + iCanonMinFocal = 17; + iCanonMaxFocal = 19; + break; + case 0x80000169: // 1DMkIII + case 0x80000215: // 1DsMkIII + iCanonCurFocal = 29; + iCanonLensID = 273; + iCanonMinFocal = 275; + iCanonMaxFocal = 277; + break; + case 0x80000281: // 1DMkIV + iCanonCurFocal = 30; + iCanonLensID = 335; + iCanonMinFocal = 337; + iCanonMaxFocal = 339; + break; + case 0x80000269: // 1D X + iCanonCurFocal = 35; + iCanonLensID = 423; + iCanonMinFocal = 425; + iCanonMaxFocal = 427; + break; + case 0x80000213: // 5D + iCanonCurFocal = 40; + if (!sget2Rev(CameraInfo + 12)) iCanonLensID = 151; + else iCanonLensID = 12; + iCanonMinFocal = 147; + iCanonMaxFocal = 149; + break; + case 0x80000218: // 5DMkII + iCanonCurFocal = 30; + iCanonLensID = 230; + iCanonMinFocal = 232; + iCanonMaxFocal = 234; + break; + case 0x80000285: // 5DMkIII + iCanonCurFocal = 35; + iCanonLensID = 339; + iCanonMinFocal = 341; + iCanonMaxFocal = 343; + break; + case 0x80000302: // 6D + iCanonCurFocal = 35; + iCanonLensID = 353; + iCanonMinFocal = 355; + iCanonMaxFocal = 357; + break; + case 0x80000250: // 7D + iCanonCurFocal = 30; + iCanonLensID = 274; + iCanonMinFocal = 276; + iCanonMaxFocal = 278; + break; + case 0x80000190: // 40D + iCanonCurFocal = 29; + iCanonLensID = 214; + iCanonMinFocal = 216; + iCanonMaxFocal = 218; + iCanonLens = 2347; + break; + case 0x80000261: // 50D + iCanonCurFocal = 30; + iCanonLensID = 234; + iCanonMinFocal = 236; + iCanonMaxFocal = 238; + break; + case 0x80000287: // 60D + iCanonCurFocal = 30; + iCanonLensID = 232; + iCanonMinFocal = 234; + iCanonMaxFocal = 236; + break; + case 0x80000325: // 70D + iCanonCurFocal = 35; + iCanonLensID = 358; + iCanonMinFocal = 360; + iCanonMaxFocal = 362; + break; + case 0x80000176: // 450D + iCanonCurFocal = 29; + iCanonLensID = 222; + iCanonLens = 2355; + break; + case 0x80000252: // 500D + iCanonCurFocal = 30; + iCanonLensID = 246; + iCanonMinFocal = 248; + iCanonMaxFocal = 250; + break; + case 0x80000270: // 550D + iCanonCurFocal = 30; + iCanonLensID = 255; + iCanonMinFocal = 257; + iCanonMaxFocal = 259; + break; + case 0x80000286: // 600D + case 0x80000288: // 1100D + iCanonCurFocal = 30; + iCanonLensID = 234; + iCanonMinFocal = 236; + iCanonMaxFocal = 238; + break; + case 0x80000301: // 650D + case 0x80000326: // 700D + iCanonCurFocal = 35; + iCanonLensID = 295; + iCanonMinFocal = 297; + iCanonMaxFocal = 299; + break; + case 0x80000254: // 1000D + iCanonCurFocal = 29; + iCanonLensID = 226; + iCanonMinFocal = 228; + iCanonMaxFocal = 230; + iCanonLens = 2359; + break; + } + if (iCanonFocalType) + { + if(iCanonFocalType>=maxlen) return; // broken; + imgdata.lens.makernotes.FocalType = CameraInfo[iCanonFocalType]; + if (!imgdata.lens.makernotes.FocalType) // zero means 'fixed' here, replacing with standard '1' + imgdata.lens.makernotes.FocalType = 1; + } + if (!imgdata.lens.makernotes.CurFocal) + { + if(iCanonCurFocal>=maxlen) return; // broken; + imgdata.lens.makernotes.CurFocal = sget2Rev(CameraInfo + iCanonCurFocal); + } + if (!imgdata.lens.makernotes.LensID) + { + if(iCanonLensID>=maxlen) return; // broken; + imgdata.lens.makernotes.LensID = sget2Rev(CameraInfo + iCanonLensID); + } + if (!imgdata.lens.makernotes.MinFocal) + { + if(iCanonMinFocal>=maxlen) return; // broken; + imgdata.lens.makernotes.MinFocal = sget2Rev(CameraInfo + iCanonMinFocal); + } + if (!imgdata.lens.makernotes.MaxFocal) + { + if(iCanonMaxFocal>=maxlen) return; // broken; + imgdata.lens.makernotes.MaxFocal = sget2Rev(CameraInfo + iCanonMaxFocal); + } + if (!imgdata.lens.makernotes.Lens[0] && iCanonLens) { + if(iCanonLens+64>=maxlen) return; // broken; + if (CameraInfo[iCanonLens] < 65) // non-Canon lens + { + memcpy(imgdata.lens.makernotes.Lens, CameraInfo + iCanonLens, 64); + } + else if (!strncmp((char *)CameraInfo + iCanonLens, "EF-S", 4)) + { + memcpy(imgdata.lens.makernotes.Lens, "EF-S ", 5); + memcpy(imgdata.lens.makernotes.LensFeatures_pre, "EF-E", 4); + imgdata.lens.makernotes.LensMount = LIBRAW_MOUNT_Canon_EF_S; + memcpy(imgdata.lens.makernotes.Lens + 5, CameraInfo + iCanonLens + 4, 60); + } + else if (!strncmp((char *)CameraInfo + iCanonLens, "TS-E", 4)) { + memcpy(imgdata.lens.makernotes.Lens, "TS-E ", 5); + memcpy(imgdata.lens.makernotes.LensFeatures_pre, "TS-E", 4); + imgdata.lens.makernotes.LensMount = LIBRAW_MOUNT_Canon_EF; + memcpy(imgdata.lens.makernotes.Lens + 5, CameraInfo + iCanonLens + 4, 60); + } + else if (!strncmp((char *)CameraInfo + iCanonLens, "MP-E", 4)) { + memcpy(imgdata.lens.makernotes.Lens, "MP-E ", 5); + memcpy(imgdata.lens.makernotes.LensFeatures_pre, "MP-E", 4); + imgdata.lens.makernotes.LensMount = LIBRAW_MOUNT_Canon_EF; + memcpy(imgdata.lens.makernotes.Lens + 5, CameraInfo + iCanonLens + 4, 60); + } + else if (!strncmp((char *)CameraInfo + iCanonLens, "EF-M", 4)) { + memcpy(imgdata.lens.makernotes.Lens, "EF-M ", 5); + memcpy(imgdata.lens.makernotes.LensFeatures_pre, "EF-M", 4); + imgdata.lens.makernotes.LensMount = LIBRAW_MOUNT_Canon_EF_M; + memcpy(imgdata.lens.makernotes.Lens + 5, CameraInfo + iCanonLens + 4, 60); + } + else { + memcpy(imgdata.lens.makernotes.Lens, CameraInfo + iCanonLens, 2); + memcpy(imgdata.lens.makernotes.LensFeatures_pre, "EF", 2); + imgdata.lens.makernotes.LensMount = LIBRAW_MOUNT_Canon_EF; + imgdata.lens.makernotes.Lens[2] = 32; + memcpy(imgdata.lens.makernotes.Lens + 3, CameraInfo + iCanonLens + 2, 62); } - goto quit; + } + return; +} + +void CLASS processNikonLensData (uchar *LensData, unsigned len) +{ + ushort i; + if (!(imgdata.lens.nikon.NikonLensType & 0x01)) + { + imgdata.lens.makernotes.LensFeatures_pre[0] = 'A'; + imgdata.lens.makernotes.LensFeatures_pre[1] = 'F'; + } + else + { + imgdata.lens.makernotes.LensFeatures_pre[0] = 'M'; + imgdata.lens.makernotes.LensFeatures_pre[1] = 'F'; + } + + if (imgdata.lens.nikon.NikonLensType & 0x02) + { + if (imgdata.lens.nikon.NikonLensType & 0x04) + imgdata.lens.makernotes.LensFeatures_suf[0] = 'G'; + else + imgdata.lens.makernotes.LensFeatures_suf[0] = 'D'; + imgdata.lens.makernotes.LensFeatures_suf[1] = ' '; + } + + if (imgdata.lens.nikon.NikonLensType & 0x08) + { + imgdata.lens.makernotes.LensFeatures_suf[2] = 'V'; + imgdata.lens.makernotes.LensFeatures_suf[3] = 'R'; + } + + if (imgdata.lens.nikon.NikonLensType & 0x10) + imgdata.lens.makernotes.LensMount = LIBRAW_MOUNT_Nikon_CX; + else + imgdata.lens.makernotes.LensMount = LIBRAW_MOUNT_Nikon_F; + + if (imgdata.lens.nikon.NikonLensType & 0x20) + { + strcpy(imgdata.lens.makernotes.Adapter, "FT-1"); + imgdata.lens.makernotes.LensMount = LIBRAW_MOUNT_Nikon_F; + } + + imgdata.lens.nikon.NikonLensType = imgdata.lens.nikon.NikonLensType & 0xdf; + + if (len < 20) { + switch (len) { + case 9: + i = 2; + break; + case 15: + i = 7; + break; + case 16: + i = 8; + break; + } + imgdata.lens.nikon.NikonLensIDNumber = LensData[i]; + imgdata.lens.nikon.NikonLensFStops = LensData[i + 1]; + imgdata.lens.makernotes.LensFStops = (float)imgdata.lens.nikon.NikonLensFStops /12.0f; + if (fabsf(imgdata.lens.makernotes.MinFocal) < 1.1f) + { + if ((imgdata.lens.nikon.NikonLensType ^ (uchar)0x01) || LensData[i + 2]) + imgdata.lens.makernotes.MinFocal = 5.0f * powf64(2.0f, (float)LensData[i + 2] / 24.0f); + if ((imgdata.lens.nikon.NikonLensType ^ (uchar)0x01) || LensData[i + 3]) + imgdata.lens.makernotes.MaxFocal = 5.0f * powf64(2.0f, (float)LensData[i + 3] / 24.0f); + if ((imgdata.lens.nikon.NikonLensType ^ (uchar)0x01) || LensData[i + 4]) + imgdata.lens.makernotes.MaxAp4MinFocal = powf64(2.0f, (float)LensData[i + 4] / 24.0f); + if ((imgdata.lens.nikon.NikonLensType ^ (uchar)0x01) || LensData[i + 5]) + imgdata.lens.makernotes.MaxAp4MaxFocal = powf64(2.0f, (float)LensData[i + 5] / 24.0f); + } + imgdata.lens.nikon.NikonMCUVersion = LensData[i + 6]; + if (i != 2) + { + if ((LensData[i - 1]) && + (fabsf(imgdata.lens.makernotes.CurFocal) < 1.1f)) + imgdata.lens.makernotes.CurFocal = 5.0f * powf64(2.0f, (float)LensData[i - 1] / 24.0f); + if (LensData[i + 7]) imgdata.lens.nikon.NikonEffectiveMaxAp = powf64(2.0f, (float)LensData[i + 7] / 24.0f); + } + imgdata.lens.makernotes.LensID = + (unsigned long long) LensData[i] << 56 | + (unsigned long long) LensData[i + 1] << 48 | + (unsigned long long) LensData[i + 2] << 40 | + (unsigned long long) LensData[i + 3] << 32 | + (unsigned long long) LensData[i + 4] << 24 | + (unsigned long long) LensData[i + 5] << 16 | + (unsigned long long) LensData[i + 6] << 8 | + (unsigned long long) imgdata.lens.nikon.NikonLensType; + + } + else if ((len == 459) || (len == 590)) + { + memcpy(imgdata.lens.makernotes.Lens, LensData + 390, 64); + } + else if (len == 509) + { + memcpy(imgdata.lens.makernotes.Lens, LensData + 391, 64); + } + else if (len == 879) + { + memcpy(imgdata.lens.makernotes.Lens, LensData + 680, 64); + } + return; +} + +void CLASS setOlympusBodyFeatures (unsigned long long id) +{ + imgdata.lens.makernotes.CamID = id; + if ((id == 0x4434303430ULL) || // E-1 + (id == 0x4434303431ULL) || // E-300 + ((id & 0x00ffff0000ULL) == 0x0030300000ULL)) + { + imgdata.lens.makernotes.CameraFormat = LIBRAW_FORMAT_FT; + if ((id == 0x4434303430ULL) || // E-1 + (id == 0x4434303431ULL) || // E-330 + ((id >= 0x5330303033ULL) && (id <= 0x5330303138ULL)) || // E-330 to E-520 + (id == 0x5330303233ULL) || // E-620 + (id == 0x5330303239ULL) || // E-450 + (id == 0x5330303330ULL) || // E-600 + (id == 0x5330303333ULL)) // E-5 + { + imgdata.lens.makernotes.CameraMount = LIBRAW_MOUNT_FT; + } + else + { + imgdata.lens.makernotes.CameraMount = LIBRAW_MOUNT_mFT; + } + } + else + { + imgdata.lens.makernotes.LensMount = + imgdata.lens.makernotes.CameraMount = LIBRAW_MOUNT_FixedLens; + } + return; +} + +void CLASS setPentaxBodyFeatures (unsigned id) +{ + imgdata.lens.makernotes.CamID = id; + + switch (id) { + case 0x12994: + case 0x12aa2: + case 0x12b1a: + case 0x12b60: + case 0x12b62: + case 0x12b7e: + case 0x12b80: + case 0x12b9c: + case 0x12b9d: + case 0x12ba2: + case 0x12c1e: + case 0x12c20: + case 0x12cd2: + case 0x12cd4: + case 0x12cfa: + case 0x12d72: + case 0x12d73: + case 0x12db8: + case 0x12dfe: + case 0x12e6c: + case 0x12e76: + case 0x12ef8: + case 0x12f52: + case 0x12f70: + case 0x12f71: + case 0x12fb6: + case 0x12fc0: + case 0x12fca: + case 0x1301a: + case 0x13024: + case 0x1309c: + imgdata.lens.makernotes.LensMount = LIBRAW_MOUNT_Pentax_K; + imgdata.lens.makernotes.CameraMount = LIBRAW_MOUNT_Pentax_K; + imgdata.lens.makernotes.CameraFormat = LIBRAW_FORMAT_APSC; + break; + case 0x12e08: + case 0x13010: + imgdata.lens.makernotes.LensMount = LIBRAW_MOUNT_Pentax_645; + imgdata.lens.makernotes.LensFormat = LIBRAW_FORMAT_MF; + imgdata.lens.makernotes.CameraMount = LIBRAW_MOUNT_Pentax_645; + imgdata.lens.makernotes.CameraFormat = LIBRAW_FORMAT_MF; + break; + case 0x12ee4: + case 0x12f66: + case 0x12f7a: + case 0x1302e: + imgdata.lens.makernotes.LensMount = LIBRAW_MOUNT_Pentax_Q; + imgdata.lens.makernotes.CameraMount = LIBRAW_MOUNT_Pentax_Q; + break; + default: + imgdata.lens.makernotes.LensMount = LIBRAW_MOUNT_FixedLens; + imgdata.lens.makernotes.CameraMount = LIBRAW_MOUNT_FixedLens; + } + return; +} + +void CLASS PentaxLensInfo (unsigned id, unsigned len) // tag 0x0207 +{ + ushort iLensData = 0; + uchar *table_buf; + table_buf = (uchar*)malloc(MAX(len,128)); + fread(table_buf, len, 1, ifp); + if ((id < 0x12b9c) || + ((id == 0x12b9c) || // K100D + (id == 0x12b9d) || // K110D + (id == 0x12ba2) && // K100D Super + (!table_buf[20] || (table_buf[20] == 0xff)))) + { + iLensData = 3; + if (imgdata.lens.makernotes.LensID == -1) + imgdata.lens.makernotes.LensID = + (((unsigned)table_buf[0]) << 8) + table_buf[1]; + } + else switch (len) + { + case 90: // LensInfo3 + iLensData = 13; + if (imgdata.lens.makernotes.LensID == -1) + imgdata.lens.makernotes.LensID = + ((unsigned)((table_buf[1] & 0x0f) + table_buf[3]) <<8) + table_buf[4]; + break; + case 91: // LensInfo4 + iLensData = 12; + if (imgdata.lens.makernotes.LensID == -1) + imgdata.lens.makernotes.LensID = + ((unsigned)((table_buf[1] & 0x0f) + table_buf[3]) <<8) + table_buf[4]; + break; + case 80: // LensInfo5 + case 128: + iLensData = 15; + if (imgdata.lens.makernotes.LensID == -1) + imgdata.lens.makernotes.LensID = + ((unsigned)((table_buf[1] & 0x0f) + table_buf[4]) <<8) + table_buf[5]; + break; + default: + if (id >= 0x12b9c) // LensInfo2 + { + iLensData = 4; + if (imgdata.lens.makernotes.LensID == -1) + imgdata.lens.makernotes.LensID = + ((unsigned)((table_buf[0] & 0x0f) + table_buf[2]) <<8) + table_buf[3]; + } + } + if (iLensData) + { + if (table_buf[iLensData+9] && + (fabs(imgdata.lens.makernotes.CurFocal) < 0.1f)) + imgdata.lens.makernotes.CurFocal = + 10*(table_buf[iLensData+9]>>2) * powf64(4, (table_buf[iLensData+9] & 0x03)-2); + if (table_buf[iLensData+10] & 0xf0) + imgdata.lens.makernotes.MaxAp4CurFocal = + powf64(2.0f, (float)((table_buf[iLensData+10] & 0xf0) >>4)/4.0f); + if (table_buf[iLensData+10] & 0x0f) + imgdata.lens.makernotes.MinAp4CurFocal = + powf64(2.0f, (float)((table_buf[iLensData+10] & 0x0f) + 10)/4.0f); + + if (iLensData != 12) + { + switch (table_buf[iLensData] & 0x06) + { + case 0: imgdata.lens.makernotes.MinAp4MinFocal = 22.0f; break; + case 2: imgdata.lens.makernotes.MinAp4MinFocal = 32.0f; break; + case 4: imgdata.lens.makernotes.MinAp4MinFocal = 45.0f; break; + case 6: imgdata.lens.makernotes.MinAp4MinFocal = 16.0f; break; + } + if (table_buf[iLensData] & 0x70) + imgdata.lens.makernotes.LensFStops = + ((float)(((table_buf[iLensData] & 0x70) >> 4) ^ 0x07)) / 2.0f + 5.0f; + if ((table_buf[iLensData+14] > 1) && + (fabs(imgdata.lens.makernotes.MaxAp4CurFocal) < 0.7f)) + imgdata.lens.makernotes.MaxAp4CurFocal = + powf64(2.0f, (float)((table_buf[iLensData+14] & 0x7f) -1)/32.0f); + } + else if ((id != 0x12e76) && // K-5 + (table_buf[iLensData+15] > 1) && + (fabs(imgdata.lens.makernotes.MaxAp4CurFocal) < 0.7f)) + { + imgdata.lens.makernotes.MaxAp4CurFocal = + powf64(2.0f, (float)((table_buf[iLensData+15] & 0x7f) -1)/32.0f); + } + } + free(table_buf); + return; +} + +void CLASS setPhaseOneFeatures (unsigned id) { + + ushort i; + static const struct { + ushort id; + char t_model[32]; + } p1_unique[] = { + // Phase One section: + {1, "Hasselblad V"}, + {10, "PhaseOne/Mamiya"}, + {12, "Contax 645"}, + {16, "Hasselblad V"}, + {17, "Hasselblad V"}, + {18, "Contax 645"}, + {19, "PhaseOne/Mamiya"}, + {20, "Hasselblad V"}, + {21, "Contax 645"}, + {22, "PhaseOne/Mamiya"}, + {23, "Hasselblad V"}, + {24, "Hasselblad H"}, + {25, "PhaseOne/Mamiya"}, + {32, "Contax 645"}, + {34, "Hasselblad V"}, + {35, "Hasselblad V"}, + {36, "Hasselblad H"}, + {37, "Contax 645"}, + {38, "PhaseOne/Mamiya"}, + {39, "Hasselblad V"}, + {40, "Hasselblad H"}, + {41, "Contax 645"}, + {42, "PhaseOne/Mamiya"}, + {44, "Hasselblad V"}, + {45, "Hasselblad H"}, + {46, "Contax 645"}, + {47, "PhaseOne/Mamiya"}, + {48, "Hasselblad V"}, + {49, "Hasselblad H"}, + {50, "Contax 645"}, + {51, "PhaseOne/Mamiya"}, + {52, "Hasselblad V"}, + {53, "Hasselblad H"}, + {54, "Contax 645"}, + {55, "PhaseOne/Mamiya"}, + {67, "Hasselblad V"}, + {68, "Hasselblad H"}, + {69, "Contax 645"}, + {70, "PhaseOne/Mamiya"}, + {71, "Hasselblad V"}, + {72, "Hasselblad H"}, + {73, "Contax 645"}, + {74, "PhaseOne/Mamiya"}, + {76, "Hasselblad V"}, + {77, "Hasselblad H"}, + {78, "Contax 645"}, + {79, "PhaseOne/Mamiya"}, + {80, "Hasselblad V"}, + {81, "Hasselblad H"}, + {82, "Contax 645"}, + {83, "PhaseOne/Mamiya"}, + {84, "Hasselblad V"}, + {85, "Hasselblad H"}, + {86, "Contax 645"}, + {87, "PhaseOne/Mamiya"}, + {99, "Hasselblad V"}, + {100, "Hasselblad H"}, + {101, "Contax 645"}, + {102, "PhaseOne/Mamiya"}, + {103, "Hasselblad V"}, + {104, "Hasselblad H"}, + {105, "PhaseOne/Mamiya"}, + {106, "Contax 645"}, + {112, "Hasselblad V"}, + {113, "Hasselblad H"}, + {114, "Contax 645"}, + {115, "PhaseOne/Mamiya"}, + {131, "Hasselblad V"}, + {132, "Hasselblad H"}, + {133, "Contax 645"}, + {134, "PhaseOne/Mamiya"}, + {135, "Hasselblad V"}, + {136, "Hasselblad H"}, + {137, "Contax 645"}, + {138, "PhaseOne/Mamiya"}, + {140, "Hasselblad V"}, + {141, "Hasselblad H"}, + {142, "Contax 645"}, + {143, "PhaseOne/Mamiya"}, + {148, "Hasselblad V"}, + {149, "Hasselblad H"}, + {150, "Contax 645"}, + {151, "PhaseOne/Mamiya"}, + {160, "A-250"}, + {161, "A-260"}, + {162, "A-280"}, + {167, "Hasselblad V"}, + {168, "Hasselblad H"}, + {169, "Contax 645"}, + {170, "PhaseOne/Mamiya"}, + {172, "Hasselblad V"}, + {173, "Hasselblad H"}, + {174, "Contax 645"}, + {175, "PhaseOne/Mamiya"}, + {176, "Hasselblad V"}, + {177, "Hasselblad H"}, + {178, "Contax 645"}, + {179, "PhaseOne/Mamiya"}, + {180, "Hasselblad V"}, + {181, "Hasselblad H"}, + {182, "Contax 645"}, + {183, "PhaseOne/Mamiya"}, + {208, "Hasselblad V"}, + {211, "PhaseOne/Mamiya"}, + {448, "Phase One 645AF"}, + {457, "Phase One 645DF"}, + {471, "Phase One 645DF+"}, + {704, "Phase One iXA"}, + {705, "Phase One iXA - R"}, + {706, "Phase One iXU 150"}, + {707, "Phase One iXU 150 - NIR"}, + {708, "Phase One iXU 180"}, + {721, "Phase One iXR"}, + // Leaf section: + {333,"Mamiya"}, + {329,"Universal"}, + {330,"Hasselblad H1/H2"}, + {332,"Contax"}, + {336,"AFi"}, + {327,"Mamiya"}, + {324,"Universal"}, + {325,"Hasselblad H1/H2"}, + {326,"Contax"}, + {335,"AFi"}, + {340,"Mamiya"}, + {337,"Universal"}, + {338,"Hasselblad H1/H2"}, + {339,"Contax"}, + {323,"Mamiya"}, + {320,"Universal"}, + {322,"Hasselblad H1/H2"}, + {321,"Contax"}, + {334,"AFi"}, + {369,"Universal"}, + {370,"Mamiya"}, + {371,"Hasselblad H1/H2"}, + {372,"Contax"}, + {373,"Afi"}, + }; + imgdata.lens.makernotes.CamID = id; + if (id && !imgdata.lens.makernotes.body[0]) { + for (i=0; i < sizeof p1_unique / sizeof *p1_unique; i++) + if (id == p1_unique[i].id) { + strcpy(imgdata.lens.makernotes.body,p1_unique[i].t_model); + } + } + return; +} + +void CLASS setSonyBodyFeatures (unsigned id) { + + imgdata.lens.makernotes.CamID = id; + if ( // FF cameras + (id == 257) || // a900 + (id == 269) || // a850 + (id == 340) || // ILCE-7M2 + (id == 318) || // ILCE-7S + (id == 311) || // ILCE-7R + (id == 347) || // ILCE-7RM2 + (id == 306) || // ILCE-7 + (id == 298) || // DSC-RX1 + (id == 299) || // NEX-VG900 + (id == 310) || // DSC-RX1R + (id == 294) // SLT-99, Hasselblad HV + ) + { + imgdata.lens.makernotes.CameraFormat = LIBRAW_FORMAT_FF; + } + else + { + if ((id != 002) && // DSC-R1 + (id != 297) && // DSC-RX100 + (id != 308) && // DSC-RX100M2 + (id != 309) && // DSC-RX10 + (id != 317) && // DSC-RX100M3 + (id != 341) && // DSC-RX100M4 + (id != 342) // DSC-RX10M2 + ) + imgdata.lens.makernotes.CameraFormat = LIBRAW_FORMAT_APSC; + } + + if ( // E-mount cameras + // ILCE: + (id == 302) || + (id == 306) || + (id == 311) || + (id == 312) || + (id == 313) || + (id == 318) || + (id == 339) || + (id == 340) || + (id == 346) || + (id == 347) || + // NEX: + (id == 278) || + (id == 279) || + (id == 284) || + (id == 288) || + (id == 289) || + (id == 290) || + (id == 293) || + (id == 295) || + (id == 296) || + (id == 299) || + (id == 300) || + (id == 305) || + (id == 307) + ) + { + imgdata.lens.makernotes.CameraMount = LIBRAW_MOUNT_Sony_E; + } + + else if ( // A-mount cameras + // DSLR: + (id == 256) || + (id == 257) || + (id == 258) || + (id == 259) || + (id == 260) || + (id == 261) || + (id == 262) || + (id == 263) || + (id == 264) || + (id == 265) || + (id == 266) || + (id == 269) || + (id == 270) || + (id == 273) || + (id == 274) || + (id == 275) || + (id == 282) || + (id == 283) || + // SLT: + (id == 280) || + (id == 281) || + (id == 285) || + (id == 286) || + (id == 287) || + (id == 291) || + (id == 292) || + (id == 294) || + (id == 303) || + // ILCA: + (id == 319) + ) + { + imgdata.lens.makernotes.CameraMount = LIBRAW_MOUNT_Minolta_A; + } + + else if ( // DSC + (id == 002) || // DSC-R1 + (id == 297) || // DSC-RX100 + (id == 298) || // DSC-RX1 + (id == 308) || // DSC-RX100M2 + (id == 309) || // DSC-RX10 + (id == 310) || // DSC-RX1R + (id == 317) || // DSC-RX100M3 + (id == 341) || // DSC-RX100M4 + (id == 342) // DSC-RX10M2 + ) + { + imgdata.lens.makernotes.CameraMount = LIBRAW_MOUNT_FixedLens; + imgdata.lens.makernotes.LensMount = LIBRAW_MOUNT_FixedLens; + } + return; +} + +void CLASS parseSonyLensType2 (uchar a, uchar b) { + ushort lid2; + lid2 = (((ushort)a)<<8) | ((ushort)b); + if (!lid2) return; + if (lid2 < 0x100) + { + imgdata.lens.makernotes.AdapterID = lid2; + switch (lid2) { + case 1: + case 2: + case 3: + case 6: + imgdata.lens.makernotes.LensMount = LIBRAW_MOUNT_Minolta_A; + break; + case 44: + case 78: + case 239: + imgdata.lens.makernotes.LensMount = LIBRAW_MOUNT_Canon_EF; + break; + } + } + else + imgdata.lens.makernotes.LensID = lid2; + return; +} + +void CLASS parseSonyLensFeatures (uchar a, uchar b) { + + ushort features; + features = (((ushort)a)<<8) | ((ushort)b); + + if ((imgdata.lens.makernotes.LensMount == LIBRAW_MOUNT_Canon_EF) || !features) + return; + + imgdata.lens.makernotes.LensFeatures_pre[0] = 0; + imgdata.lens.makernotes.LensFeatures_suf[0] = 0; + if ((features & 0x0200) && (features & 0x0100)) strcpy(imgdata.lens.makernotes.LensFeatures_pre, "E"); + else if (features & 0x0200) strcpy(imgdata.lens.makernotes.LensFeatures_pre, "FE"); + else if (features & 0x0100) strcpy(imgdata.lens.makernotes.LensFeatures_pre, "DT"); + + if (!imgdata.lens.makernotes.LensFormat && !imgdata.lens.makernotes.LensMount) + { + imgdata.lens.makernotes.LensFormat = LIBRAW_FORMAT_FF; + imgdata.lens.makernotes.LensMount = LIBRAW_MOUNT_Minolta_A; + + if ((features & 0x0200) && (features & 0x0100)) { + imgdata.lens.makernotes.LensFormat = LIBRAW_FORMAT_APSC; + imgdata.lens.makernotes.LensMount = LIBRAW_MOUNT_Sony_E; + } else if (features & 0x0200) { + imgdata.lens.makernotes.LensMount = LIBRAW_MOUNT_Sony_E; + } else if (features & 0x0100) { + imgdata.lens.makernotes.LensFormat = LIBRAW_FORMAT_APSC; + } + } + + if (features & 0x4000) + strncat(imgdata.lens.makernotes.LensFeatures_pre, " PZ", sizeof(imgdata.lens.makernotes.LensFeatures_pre)); + + if (features & 0x0008) + strncat(imgdata.lens.makernotes.LensFeatures_suf, " G", sizeof(imgdata.lens.makernotes.LensFeatures_suf)); + else if (features & 0x0004) + strncat(imgdata.lens.makernotes.LensFeatures_suf, " ZA", sizeof(imgdata.lens.makernotes.LensFeatures_suf)); + + if ((features & 0x0020) && (features & 0x0040)) + strncat(imgdata.lens.makernotes.LensFeatures_suf, " Macro", sizeof(imgdata.lens.makernotes.LensFeatures_suf)); + else if (features & 0x0020) + strncat(imgdata.lens.makernotes.LensFeatures_suf, " STF", sizeof(imgdata.lens.makernotes.LensFeatures_suf)); + else if (features & 0x0040) + strncat(imgdata.lens.makernotes.LensFeatures_suf, " Reflex", sizeof(imgdata.lens.makernotes.LensFeatures_suf)); + else if (features & 0x0080) + strncat(imgdata.lens.makernotes.LensFeatures_suf, " Fisheye", sizeof(imgdata.lens.makernotes.LensFeatures_suf)); + + if (features & 0x0001) + strncat(imgdata.lens.makernotes.LensFeatures_suf, " SSM", sizeof(imgdata.lens.makernotes.LensFeatures_suf)); + else if (features & 0x0002) + strncat(imgdata.lens.makernotes.LensFeatures_suf, " SAM", sizeof(imgdata.lens.makernotes.LensFeatures_suf)); + + if (features & 0x8000) + strncat(imgdata.lens.makernotes.LensFeatures_suf, " OSS", sizeof(imgdata.lens.makernotes.LensFeatures_suf)); + + if (features & 0x2000) + strncat(imgdata.lens.makernotes.LensFeatures_suf, " LE", sizeof(imgdata.lens.makernotes.LensFeatures_suf)); + + if (features & 0x0800) + strncat(imgdata.lens.makernotes.LensFeatures_suf, " II", sizeof(imgdata.lens.makernotes.LensFeatures_suf)); + + if (imgdata.lens.makernotes.LensFeatures_suf[0] == ' ') + memmove(imgdata.lens.makernotes.LensFeatures_suf, imgdata.lens.makernotes.LensFeatures_suf+1, strlen(imgdata.lens.makernotes.LensFeatures_suf)); + + return; +} + +void CLASS process_Sony_0x940c (uchar * buf) +{ + ushort lid2; + if (imgdata.lens.makernotes.LensMount != LIBRAW_MOUNT_Canon_EF) + { + switch (SonySubstitution[buf[0x0008]]) { + case 1: + case 5: + imgdata.lens.makernotes.LensMount = LIBRAW_MOUNT_Minolta_A; + break; + case 4: + imgdata.lens.makernotes.LensMount = LIBRAW_MOUNT_Sony_E; + break; + } + } + lid2 = (((ushort)SonySubstitution[buf[0x000a]])<<8) | + ((ushort)SonySubstitution[buf[0x0009]]); + if ((lid2 > 0) && (lid2 < 32784)) + parseSonyLensType2 (SonySubstitution[buf[0x000a]], // LensType2 - Sony lens ids + SonySubstitution[buf[0x0009]]); + return; +} + + +void CLASS process_Sony_0x9050 (uchar * buf, unsigned id) +{ + ushort lid; + + if ((imgdata.lens.makernotes.CameraMount != LIBRAW_MOUNT_Sony_E) && + (imgdata.lens.makernotes.CameraMount != LIBRAW_MOUNT_FixedLens)) + { + if (buf[0]) + imgdata.lens.makernotes.MaxAp4CurFocal = + my_roundf(powf64(2.0f, ((float)SonySubstitution[buf[0]] / 8.0 - 1.06f) / 2.0f)*10.0f) / 10.0f; + + if (buf[1]) + imgdata.lens.makernotes.MinAp4CurFocal = + my_roundf(powf64(2.0f, ((float)SonySubstitution[buf[1]] / 8.0 - 1.06f) / 2.0f)*10.0f) / 10.0f; + } + + if (imgdata.lens.makernotes.CameraMount != LIBRAW_MOUNT_FixedLens) + { + if (buf[0x3d] | buf[0x3c]) + { + lid = SonySubstitution[buf[0x3d]] << 8 | + SonySubstitution[buf[0x3c]]; + imgdata.lens.makernotes.CurAp = + powf64(2.0f, ((float)lid/256.0f - 16.0f) / 2.0f); + } + if (buf[0x105] && (imgdata.lens.makernotes.LensMount != LIBRAW_MOUNT_Canon_EF)) + imgdata.lens.makernotes.LensMount = + SonySubstitution[buf[0x105]]; + if (buf[0x106]) + imgdata.lens.makernotes.LensFormat = + SonySubstitution[buf[0x106]]; + } + + if (imgdata.lens.makernotes.CameraMount == LIBRAW_MOUNT_Sony_E) + { + parseSonyLensType2 (SonySubstitution[buf[0x0108]], // LensType2 - Sony lens ids + SonySubstitution[buf[0x0107]]); + } + + if ((imgdata.lens.makernotes.LensID == -1) && + (imgdata.lens.makernotes.CameraMount == LIBRAW_MOUNT_Minolta_A) && + (buf[0x010a] | buf[0x0109])) + { + imgdata.lens.makernotes.LensID = // LensType - Minolta/Sony lens ids + SonySubstitution[buf[0x010a]] << 8 | + SonySubstitution[buf[0x0109]]; + if ((imgdata.lens.makernotes.LensID > 61184) && + (imgdata.lens.makernotes.LensID < 65535)) + { + imgdata.lens.makernotes.LensID -= 61184; + imgdata.lens.makernotes.LensMount = LIBRAW_MOUNT_Canon_EF; + } + } + + if ((id >= 286) && (id <= 293)) + // "SLT-A65", "SLT-A77", "NEX-7", "NEX-VG20E", + // "SLT-A37", "SLT-A57", "NEX-F3", "Lunar" + parseSonyLensFeatures (SonySubstitution[buf[0x115]], + SonySubstitution[buf[0x116]]); + else if (imgdata.lens.makernotes.CameraMount != LIBRAW_MOUNT_FixedLens) + parseSonyLensFeatures (SonySubstitution[buf[0x116]], + SonySubstitution[buf[0x117]]); + return; +} + +void CLASS parse_makernote_0xc634(int base, int uptag, unsigned dng_writer) +{ + unsigned ver97 = 0, offset = 0, entries, tag, type, len, save, c; + unsigned i; + + uchar NikonKey, ci, cj, ck; + unsigned serial = 0; + unsigned NikonLensDataVersion = 0; + unsigned lenNikonLensData = 0; + + uchar *CanonCameraInfo; + unsigned lenCanonCameraInfo = 0; + + uchar *table_buf; + uchar *table_buf_0x9050; + ushort table_buf_0x9050_present = 0; + uchar *table_buf_0x940c; + ushort table_buf_0x940c_present = 0; + + short morder, sorder = order; + char buf[10]; + + fread(buf, 1, 10, ifp); + if (!strcmp(buf, "Nikon")) { + base = ftell(ifp); + order = get2(); + if (get2() != 42) goto quit; + offset = get4(); + fseek(ifp, offset - 8, SEEK_CUR); + } + else if (!strcmp(buf, "OLYMPUS") || + !strcmp(buf, "PENTAX ") || + (!strncmp(make, "SAMSUNG", 7) && (dng_writer == CameraDNG))) { + base = ftell(ifp) - 10; + fseek(ifp, -2, SEEK_CUR); + order = get2(); + if (buf[0] == 'O') get2(); + } + else if (!strncmp(buf, "SONY", 4) || + !strcmp(buf, "Panasonic")) { + goto nf; + } + else if (!strncmp(buf, "FUJIFILM", 8)) { + base = ftell(ifp) - 10; + nf: order = 0x4949; + fseek(ifp, 2, SEEK_CUR); + } + else if (!strcmp(buf, "OLYMP") || + !strcmp(buf, "LEICA") || + !strcmp(buf, "Ricoh") || + !strcmp(buf, "EPSON")) + fseek(ifp, -2, SEEK_CUR); + else if (!strcmp(buf, "AOC") || + !strcmp(buf, "QVC")) + fseek(ifp, -4, SEEK_CUR); + else { + fseek(ifp, -10, SEEK_CUR); + if ((!strncmp(make, "SAMSUNG", 7) && + (dng_writer == AdobeDNG))) + base = ftell(ifp); + } + + entries = get2(); + if (entries > 1000) return; + morder = order; + + while (entries--) { + order = morder; + tiff_get(base, &tag, &type, &len, &save); + tag |= uptag << 16; + if(len > 100*1024*1024) goto next; // 100Mb tag? No! + + if (!strncmp(make, "Canon",5)) + { + if (tag == 0x0001) // camera settings + { + fseek(ifp, 44, SEEK_CUR); + imgdata.lens.makernotes.LensID = get2(); + imgdata.lens.makernotes.MaxFocal = get2(); + imgdata.lens.makernotes.MinFocal = get2(); + imgdata.lens.makernotes.CanonFocalUnits = get2(); + if (imgdata.lens.makernotes.CanonFocalUnits != 1) + { + imgdata.lens.makernotes.MaxFocal /= (float)imgdata.lens.makernotes.CanonFocalUnits; + imgdata.lens.makernotes.MinFocal /= (float)imgdata.lens.makernotes.CanonFocalUnits; + } + imgdata.lens.makernotes.MaxAp = _CanonConvertAperture(get2()); + imgdata.lens.makernotes.MinAp = _CanonConvertAperture(get2()); + } + + else if (tag == 0x0002) // focal length + { + imgdata.lens.makernotes.FocalType = get2(); + imgdata.lens.makernotes.CurFocal = get2(); + if ((imgdata.lens.makernotes.CanonFocalUnits != 1) && + imgdata.lens.makernotes.CanonFocalUnits) + { + imgdata.lens.makernotes.CurFocal /= (float)imgdata.lens.makernotes.CanonFocalUnits; + } + } + + else if (tag == 0x0004) // shot info + { + short tempAp; + fseek(ifp, 8, SEEK_CUR); + if ((tempAp = get2()) != 0x7fff) + imgdata.lens.makernotes.CurAp = _CanonConvertAperture(tempAp); + if (imgdata.lens.makernotes.CurAp < 0.7f) + { + fseek(ifp, 32, SEEK_CUR); + imgdata.lens.makernotes.CurAp = _CanonConvertAperture(get2()); + } + if (!aperture) aperture = imgdata.lens.makernotes.CurAp; + } + + else if (tag == 0x000d) // camera info + { + CanonCameraInfo = (uchar*)malloc(len); + fread(CanonCameraInfo, len, 1, ifp); + lenCanonCameraInfo = len; + } + + else if (tag == 0x10) // Canon ModelID + { + unique_id = get4(); + if (unique_id == 0x03740000) unique_id = 0x80000374; + setCanonBodyFeatures(unique_id); + if (lenCanonCameraInfo) + { + processCanonCameraInfo(unique_id, CanonCameraInfo,lenCanonCameraInfo); + free(CanonCameraInfo); + CanonCameraInfo = 0; + lenCanonCameraInfo = 0; + } + } + + else if (tag == 0x0095 && // lens model tag + !imgdata.lens.makernotes.Lens[0]) + { + fread(imgdata.lens.makernotes.Lens, 2, 1, ifp); + imgdata.lens.makernotes.LensMount = LIBRAW_MOUNT_Canon_EF; + if (imgdata.lens.makernotes.Lens[0] < 65) // non-Canon lens + fread(imgdata.lens.makernotes.Lens + 2, 62, 1, ifp); + else + { + char efs[2]; + imgdata.lens.makernotes.LensFeatures_pre[0] = imgdata.lens.makernotes.Lens[0]; + imgdata.lens.makernotes.LensFeatures_pre[1] = imgdata.lens.makernotes.Lens[1]; + fread(efs, 2, 1, ifp); + if (efs[0] == 45 && (efs[1] == 83 || efs[1] == 69 || efs[1] == 77)) + { // "EF-S, TS-E, MP-E, EF-M" lenses + imgdata.lens.makernotes.Lens[2] = imgdata.lens.makernotes.LensFeatures_pre[2] = efs[0]; + imgdata.lens.makernotes.Lens[3] = imgdata.lens.makernotes.LensFeatures_pre[3] = efs[1]; + imgdata.lens.makernotes.Lens[4] = 32; + if (efs[1] == 83) + { + imgdata.lens.makernotes.LensMount = LIBRAW_MOUNT_Canon_EF_S; + imgdata.lens.makernotes.LensFormat = LIBRAW_FORMAT_APSC; + } + else if (efs[1] == 77) + { + imgdata.lens.makernotes.LensMount = LIBRAW_MOUNT_Canon_EF_M; + } + } + else + { // "EF" lenses + imgdata.lens.makernotes.Lens[2] = 32; + imgdata.lens.makernotes.Lens[3] = efs[0]; + imgdata.lens.makernotes.Lens[4] = efs[1]; + } + fread(imgdata.lens.makernotes.Lens + 5, 58, 1, ifp); + } + } + } + + else if (!strncmp(make, "FUJI", 4)) + switch (tag) { + case 0x1404: imgdata.lens.makernotes.MinFocal = getreal(type); break; + case 0x1405: imgdata.lens.makernotes.MaxFocal = getreal(type); break; + case 0x1406: imgdata.lens.makernotes.MaxAp4MinFocal = getreal(type); break; + case 0x1407: imgdata.lens.makernotes.MaxAp4MaxFocal = getreal(type); break; + } + + else if (!strncasecmp(make, "LEICA", 5)) + { + if ((tag == 0x0303) && (type != 4)) + { + fread(imgdata.lens.makernotes.Lens, MIN(len,127), 1, ifp); + } + + if ((tag == 0x3405) || + (tag == 0x0310) || + (tag == 0x34003405)) + { + imgdata.lens.makernotes.LensID = get4(); + imgdata.lens.makernotes.LensID = + ((imgdata.lens.makernotes.LensID>>2)<<8) | + (imgdata.lens.makernotes.LensID & 0x3); + if (imgdata.lens.makernotes.LensID != -1) + { + if ((model[0] == 'M') || + !strncasecmp (model, "LEICA M", 7)) + { + imgdata.lens.makernotes.CameraMount = LIBRAW_MOUNT_Leica_M; + if (imgdata.lens.makernotes.LensID) + imgdata.lens.makernotes.LensMount = LIBRAW_MOUNT_Leica_M; + } + else if ((model[0] == 'S') || + !strncasecmp (model, "LEICA S", 7)) + { + imgdata.lens.makernotes.CameraMount = LIBRAW_MOUNT_Leica_S; + if (imgdata.lens.makernotes.Lens[0]) + imgdata.lens.makernotes.LensMount = LIBRAW_MOUNT_Leica_S; + } + } + } + + else if ( + ((tag == 0x0313) || (tag == 0x34003406)) && + (fabs(imgdata.lens.makernotes.CurAp) < 0.17f) && + ((type == 10) || (type == 5)) + ) + { + imgdata.lens.makernotes.CurAp = getreal(type); + if (imgdata.lens.makernotes.CurAp > 126.3) + imgdata.lens.makernotes.CurAp = 0.0f; + } + + else if (tag == 0x3400) + { + parse_makernote (base, 0x3400); + } + } + + else if (!strncmp(make, "NIKON", 5)) + { + if (tag == 0x1d) // serial number + while ((c = fgetc(ifp)) && c != EOF) + serial = serial * 10 + (isdigit(c) ? c - '0' : c % 10); + else if (tag == 0x000a) + { + imgdata.lens.makernotes.LensMount = LIBRAW_MOUNT_FixedLens; + imgdata.lens.makernotes.CameraMount = LIBRAW_MOUNT_FixedLens; + } + else if (tag == 0x0082) // lens attachment + { + fread(imgdata.lens.makernotes.Attachment, MIN(len,127), 1, ifp); + } + else if (tag == 0x0083) // lens type + { + imgdata.lens.nikon.NikonLensType = fgetc(ifp); + } + else if (tag == 0x0084) // lens + { + imgdata.lens.makernotes.MinFocal = getreal(type); + imgdata.lens.makernotes.MaxFocal = getreal(type); + imgdata.lens.makernotes.MaxAp4MinFocal = getreal(type); + imgdata.lens.makernotes.MaxAp4MaxFocal = getreal(type); + } + else if (tag == 0x008b) // lens f-stops + { + uchar a, b, c; + a = fgetc(ifp); + b = fgetc(ifp); + c = fgetc(ifp); + if (c) + { + imgdata.lens.nikon.NikonLensFStops = a*b*(12/c); + imgdata.lens.makernotes.LensFStops = + (float)imgdata.lens.nikon.NikonLensFStops /12.0f; + } + } + else if (tag == 0x0093) + { + i = get2(); + if ((i == 7) || (i == 9)) + { + imgdata.lens.makernotes.LensMount = LIBRAW_MOUNT_FixedLens; + imgdata.lens.makernotes.CameraMount = LIBRAW_MOUNT_FixedLens; + } + } + else if (tag == 0x0097) + { + for (i=0; i < 4; i++) + ver97 = ver97 * 10 + fgetc(ifp)-'0'; + if (ver97 == 601) // Coolpix A + { + imgdata.lens.makernotes.LensMount = LIBRAW_MOUNT_FixedLens; + imgdata.lens.makernotes.CameraMount = LIBRAW_MOUNT_FixedLens; + } + } + else if (tag == 0x0098) // contains lens data + { + for (i = 0; i < 4; i++) + { + NikonLensDataVersion = NikonLensDataVersion * 10 + fgetc(ifp) - '0'; + } + switch (NikonLensDataVersion) + { + case 100: lenNikonLensData = 9; break; + case 101: + case 201: // encrypted, starting from v.201 + case 202: + case 203: lenNikonLensData = 15; break; + case 204: lenNikonLensData = 16; break; + case 400: lenNikonLensData = 459; break; + case 401: lenNikonLensData = 590; break; + case 402: lenNikonLensData = 509; break; + case 403: lenNikonLensData = 879; break; + } + if(lenNikonLensData) + { + table_buf = (uchar*)malloc(lenNikonLensData); + fread(table_buf, lenNikonLensData, 1, ifp); + if ((NikonLensDataVersion < 201) && lenNikonLensData) + { + processNikonLensData(table_buf, lenNikonLensData); + free(table_buf); + lenNikonLensData = 0; + } + } + } + + else if (tag == 0xa7) // shutter count + { + NikonKey = fgetc(ifp) ^ fgetc(ifp) ^ fgetc(ifp) ^ fgetc(ifp); + if ((NikonLensDataVersion > 200) && lenNikonLensData) + { + ci = xlat[0][serial & 0xff]; + cj = xlat[1][NikonKey]; + ck = 0x60; + for (i = 0; i < lenNikonLensData; i++) + table_buf[i] ^= (cj += ci * ck++); + processNikonLensData(table_buf, lenNikonLensData); + free(table_buf); + lenNikonLensData = 0; + } + } + + else if (tag == 37 && (!iso_speed || iso_speed == 65535)) + { + unsigned char cc; + fread(&cc, 1, 1, ifp); + iso_speed = (int)(100.0 * powf64(2.0, (double)(cc) / 12.0 - 5.0)); + break; + } + } + + else if (!strncmp(make, "OLYMPUS", 7)) + { + if (tag == 0x2010) + { + fseek(ifp, save - 4, SEEK_SET); + fseek(ifp, base + get4(), SEEK_SET); + parse_makernote_0xc634(base, 0x2010, dng_writer); + } + + switch (tag) { + case 0x0207: + case 0x20100100: + { + uchar sOlyID[8]; + unsigned long long OlyID; + fread (sOlyID, MIN(len,7), 1, ifp); + sOlyID[7] = 0; + OlyID = sOlyID[0]; + i = 1; + while (i < 7 && sOlyID[i]) + { + OlyID = OlyID << 8 | sOlyID[i]; + i++; + } + setOlympusBodyFeatures(OlyID); + } + break; + case 0x1002: + imgdata.lens.makernotes.CurAp = powf64(2.0f, getreal(type)/2); + break; + case 0x20100201: + imgdata.lens.makernotes.LensID = + (unsigned long long)fgetc(ifp)<<16 | + (unsigned long long)(fgetc(ifp), fgetc(ifp))<<8 | + (unsigned long long)fgetc(ifp); + imgdata.lens.makernotes.LensMount = LIBRAW_MOUNT_FT; + imgdata.lens.makernotes.LensFormat = LIBRAW_FORMAT_FT; + if (((imgdata.lens.makernotes.LensID < 0x20000) || + (imgdata.lens.makernotes.LensID > 0x4ffff)) && + (imgdata.lens.makernotes.LensID & 0x10)) + { + imgdata.lens.makernotes.LensMount = LIBRAW_MOUNT_mFT; + } + break; + case 0x20100203: + fread(imgdata.lens.makernotes.Lens, MIN(len,127), 1, ifp); + break; + case 0x20100205: + imgdata.lens.makernotes.MaxAp4MinFocal = powf64(sqrt(2.0f), get2() / 256.0f); + break; + case 0x20100206: + imgdata.lens.makernotes.MaxAp4MaxFocal = powf64(sqrt(2.0f), get2() / 256.0f); + break; + case 0x20100207: + imgdata.lens.makernotes.MinFocal = (float)get2(); + break; + case 0x20100208: + imgdata.lens.makernotes.MaxFocal = (float)get2(); + if (imgdata.lens.makernotes.MaxFocal > 1000.0f) + imgdata.lens.makernotes.MaxFocal = imgdata.lens.makernotes.MinFocal; + break; + case 0x2010020a: + imgdata.lens.makernotes.MaxAp4CurFocal = powf64(sqrt(2.0f), get2() / 256.0f); + break; + case 0x20100301: + imgdata.lens.makernotes.TeleconverterID = fgetc(ifp) << 8; + fgetc(ifp); + imgdata.lens.makernotes.TeleconverterID = + imgdata.lens.makernotes.TeleconverterID | fgetc(ifp); + break; + case 0x20100303: + fread(imgdata.lens.makernotes.Teleconverter, MIN(len,127), 1, ifp); + break; + case 0x20100403: + fread(imgdata.lens.makernotes.Attachment, MIN(len,127), 1, ifp); + break; + } + } + + else if (!strncmp(make, "PENTAX", 6) || + !strncmp(model, "PENTAX", 6) || + (!strncmp(make, "SAMSUNG", 7) && (dng_writer == CameraDNG))) + { + if (tag == 0x0005) + { + unique_id = get4(); + setPentaxBodyFeatures(unique_id); + } + else if (tag == 0x0013) + { + imgdata.lens.makernotes.CurAp = (float)get2()/10.0f; + } + else if (tag == 0x001d) + { + imgdata.lens.makernotes.CurFocal = (float)get4()/100.0f; + } + else if (tag == 0x003f) + { + imgdata.lens.makernotes.LensID = fgetc(ifp) << 8 | fgetc(ifp); + } + else if (tag == 0x0207) + { + PentaxLensInfo(imgdata.lens.makernotes.CamID, len); + } + else if (tag == 0x0239) // Q-series lens info (LensInfoQ) + { + char LensInfo [20]; + fseek (ifp, 12, SEEK_CUR); + fread(imgdata.lens.makernotes.Lens, 30, 1, ifp); + strcat(imgdata.lens.makernotes.Lens, " "); + fread(LensInfo, 20, 1, ifp); + strcat(imgdata.lens.makernotes.Lens, LensInfo); + } + } + + else if (!strncmp(make, "SAMSUNG", 7) && + (dng_writer == AdobeDNG)) + { + if (tag == 0x0002) + { + if(get4() == 0x2000) + { + imgdata.lens.makernotes.CameraMount = LIBRAW_MOUNT_Samsung_NX; + } + else if (!strncmp(model, "NX mini", 7)) + { + imgdata.lens.makernotes.CameraMount = LIBRAW_MOUNT_Samsung_NX_M; + } + else + { + imgdata.lens.makernotes.CameraMount = LIBRAW_MOUNT_FixedLens; + imgdata.lens.makernotes.LensMount = LIBRAW_MOUNT_FixedLens; + } + } + else if (tag == 0x0003) + { + imgdata.lens.makernotes.CamID = unique_id = get4(); + } + else if (tag == 0xa003) + { + imgdata.lens.makernotes.LensID = get2(); + if (imgdata.lens.makernotes.LensID) + imgdata.lens.makernotes.LensMount = LIBRAW_MOUNT_Samsung_NX; + } + else if (tag == 0xa019) + { + imgdata.lens.makernotes.CurAp = getreal(type); + } + else if (tag == 0xa01a) + { + imgdata.lens.makernotes.FocalLengthIn35mmFormat = get4() / 10.0f; + if (imgdata.lens.makernotes.FocalLengthIn35mmFormat < 10.0f) + imgdata.lens.makernotes.FocalLengthIn35mmFormat *= 10.0f; + } + } + + else if (!strncasecmp(make, "SONY", 4) || + !strncasecmp(make, "Konica", 6) || + !strncasecmp(make, "Minolta", 7) || + (!strncasecmp(make, "Hasselblad", 10) && + (!strncasecmp(model, "Stellar", 7) || + !strncasecmp(model, "Lunar", 5) || + !strncasecmp(model, "Lusso", 5) || + !strncasecmp(model, "HV",2)))) + { + ushort lid; + + if (tag == 0xb001) // Sony ModelID + { + unique_id = get2(); + setSonyBodyFeatures(unique_id); + if (table_buf_0x9050_present) + { + process_Sony_0x9050(table_buf_0x9050, unique_id); + free (table_buf_0x9050); + table_buf_0x9050_present = 0; + } + if (table_buf_0x940c_present) + { + if (imgdata.lens.makernotes.CameraMount == LIBRAW_MOUNT_Sony_E) + { + process_Sony_0x940c(table_buf_0x940c); + } + free (table_buf_0x940c); + table_buf_0x940c_present = 0; + } + } + else if ((tag == 0x0010) && // CameraInfo + strncasecmp(model, "DSLR-A100", 9) && + strncasecmp(model, "NEX-5C", 6) && + !strncasecmp(make, "SONY", 4) && + ((len == 368) || // a700 + (len == 5478) || // a850, a900 + (len == 5506) || // a200, a300, a350 + (len == 6118) || // a230, a290, a330, a380, a390 + + // a450, a500, a550, a560, a580 + // a33, a35, a55 + // NEX3, NEX5, NEX5C, NEXC3, VG10E + (len == 15360)) + ) + { + table_buf = (uchar*)malloc(len); + fread(table_buf, len, 1, ifp); + if (memcmp(table_buf, "\xff\xff\xff\xff\xff\xff\xff\xff", 8) && + memcmp(table_buf, "\x00\x00\x00\x00\x00\x00\x00\x00", 8)) + { + switch (len) { + case 368: + case 5478: + // a700, a850, a900: CameraInfo + if (saneSonyCameraInfo(table_buf[0], table_buf[3], table_buf[2], table_buf[5], table_buf[4], table_buf[7])) + { + if (table_buf[0] | table_buf[3]) + imgdata.lens.makernotes.MinFocal = + bcd2dec(table_buf[0]) * 100 + bcd2dec(table_buf[3]); + if (table_buf[2] | table_buf[5]) + imgdata.lens.makernotes.MaxFocal = + bcd2dec(table_buf[2]) * 100 + bcd2dec(table_buf[5]); + if (table_buf[4]) + imgdata.lens.makernotes.MaxAp4MinFocal = bcd2dec(table_buf[4]) / 10.0f; + if (table_buf[4]) + imgdata.lens.makernotes.MaxAp4MaxFocal = bcd2dec(table_buf[7]) / 10.0f; + parseSonyLensFeatures(table_buf[1], table_buf[6]); + } + break; + default: + // CameraInfo2 & 3 + if (saneSonyCameraInfo(table_buf[1], table_buf[2], table_buf[3], table_buf[4], table_buf[5], table_buf[6])) + { + if (table_buf[1] | table_buf[2]) + imgdata.lens.makernotes.MinFocal = + bcd2dec(table_buf[1]) * 100 + bcd2dec(table_buf[2]); + if (table_buf[3] | table_buf[4]) + imgdata.lens.makernotes.MaxFocal = + bcd2dec(table_buf[3]) * 100 + bcd2dec(table_buf[4]); + if (table_buf[5]) + imgdata.lens.makernotes.MaxAp4MinFocal = bcd2dec(table_buf[5]) / 10.0f; + if (table_buf[6]) + imgdata.lens.makernotes.MaxAp4MaxFocal = bcd2dec(table_buf[6]) / 10.0f; + parseSonyLensFeatures(table_buf[0], table_buf[7]); + } + } + } + free(table_buf); + } + + else if (tag == 0x0105) // Teleconverter + { + imgdata.lens.makernotes.TeleconverterID = get2(); + } + + else if (tag == 0x0114) // CameraSettings + { + table_buf = (uchar*)malloc(len); + fread(table_buf, len, 1, ifp); + switch (len) { + case 280: + case 364: + case 332: + // CameraSettings and CameraSettings2 are big endian + if (table_buf[2] | table_buf[3]) + { + lid = (((ushort)table_buf[2])<<8) | + ((ushort)table_buf[3]); + imgdata.lens.makernotes.CurAp = + powf64(2.0f, ((float)lid/8.0f-1.0f)/2.0f); + } + break; + case 1536: + case 2048: + // CameraSettings3 are little endian + parseSonyLensType2(table_buf[1016], table_buf[1015]); + if (imgdata.lens.makernotes.LensMount != LIBRAW_MOUNT_Canon_EF) + { + switch (table_buf[153]) { + case 16: imgdata.lens.makernotes.LensMount = LIBRAW_MOUNT_Minolta_A; break; + case 17: imgdata.lens.makernotes.LensMount = LIBRAW_MOUNT_Sony_E; break; + } + } + break; + } + free(table_buf); + } + + else if (tag == 0x9050) // little endian + { + table_buf_0x9050 = (uchar*)malloc(len); + table_buf_0x9050_present = 1; + fread(table_buf_0x9050, len, 1, ifp); + + if (imgdata.lens.makernotes.CamID) + { + process_Sony_0x9050(table_buf_0x9050, imgdata.lens.makernotes.CamID); + free (table_buf_0x9050); + table_buf_0x9050_present = 0; + } + } + + else if (tag == 0x940c) + { + table_buf_0x940c = (uchar*)malloc(len); + table_buf_0x940c_present = 1; + fread(table_buf_0x940c, len, 1, ifp); + if ((imgdata.lens.makernotes.CamID) && + (imgdata.lens.makernotes.CameraMount == LIBRAW_MOUNT_Sony_E)) + { + process_Sony_0x940c(table_buf_0x940c); + free(table_buf_0x940c); + table_buf_0x940c_present = 0; + } + } + + else if (((tag == 0xb027) || (tag == 0x010c)) && (imgdata.lens.makernotes.LensID == -1)) + { + imgdata.lens.makernotes.LensID = get4(); + if ((imgdata.lens.makernotes.LensID > 61184) && + (imgdata.lens.makernotes.LensID < 65535)) + { + imgdata.lens.makernotes.LensID -= 61184; + imgdata.lens.makernotes.LensMount = LIBRAW_MOUNT_Canon_EF; + } + if (tag == 0x010c) imgdata.lens.makernotes.CameraMount = LIBRAW_MOUNT_Minolta_A; + } + + else if (tag == 0xb02a) // Sony LensSpec + { + table_buf = (uchar*)malloc(len); + fread(table_buf, len, 1, ifp); + if (saneSonyCameraInfo(table_buf[1], table_buf[2], table_buf[3], table_buf[4], table_buf[5], table_buf[6])) + { + if (table_buf[1] | table_buf[2]) + imgdata.lens.makernotes.MinFocal = + bcd2dec(table_buf[1]) * 100 + bcd2dec(table_buf[2]); + if (table_buf[3] | table_buf[4]) + imgdata.lens.makernotes.MaxFocal = + bcd2dec(table_buf[3]) * 100 + bcd2dec(table_buf[4]); + if (table_buf[5]) + imgdata.lens.makernotes.MaxAp4MinFocal = bcd2dec(table_buf[5]) / 10.0f; + if (table_buf[6]) + imgdata.lens.makernotes.MaxAp4MaxFocal = bcd2dec(table_buf[6]) / 10.0f; + parseSonyLensFeatures(table_buf[0], table_buf[7]); + } + free(table_buf); + } + } + next: + fseek (ifp, save, SEEK_SET); + } + quit: + order = sorder; +} + +#else +void CLASS parse_makernote_0xc634(int base, int uptag, unsigned dng_writer) +{ + /*placeholder */ +} +#endif + + +void CLASS parse_makernote (int base, int uptag) +{ + unsigned offset=0, entries, tag, type, len, save, c; + unsigned ver97=0, serial=0, i, wbi=0, wb[4]={0,0,0,0}; + uchar buf97[324], ci, cj, ck; + short morder, sorder=order; + char buf[10]; + unsigned SamsungKey[11]; + static const double rgb_adobe[3][3] = // inv(sRGB2XYZ_D65) * AdobeRGB2XYZ_D65 + {{ 1.398283396477404, -0.398283116703571, 4.427165001263944E-08}, + {-1.233904514232401E-07, 0.999999995196570, 3.126724276714121e-08}, + { 4.561487232726535E-08, -0.042938290466635, 1.042938250416105 }}; + + float adobe_cam [3][3]; + uchar NikonKey; + +#ifdef LIBRAW_LIBRARY_BUILD + unsigned NikonLensDataVersion = 0; + unsigned lenNikonLensData = 0; + + uchar *CanonCameraInfo; + unsigned lenCanonCameraInfo = 0; + + uchar *table_buf; + uchar *table_buf_0x9050; + ushort table_buf_0x9050_present = 0; + uchar *table_buf_0x940c; + ushort table_buf_0x940c_present = 0; +#endif +/* + The MakerNote might have its own TIFF header (possibly with + its own byte-order!), or it might just be a table. + */ + if (!strncmp(make,"Nokia",5)) return; + fread (buf, 1, 10, ifp); + if (!strncmp (buf,"KDK" ,3) || /* these aren't TIFF tables */ + !strncmp (buf,"VER" ,3) || + !strncmp (buf,"IIII",4) || + !strncmp (buf,"MMMM",4)) return; + if (!strncmp (buf,"KC" ,2) || /* Konica KD-400Z, KD-510Z */ + !strncmp (buf,"MLY" ,3)) { /* Minolta DiMAGE G series */ + order = 0x4d4d; + while ((i=ftell(ifp)) < data_offset && i < 16384) { + wb[0] = wb[2]; wb[2] = wb[1]; wb[1] = wb[3]; + wb[3] = get2(); + if (wb[1] == 256 && wb[3] == 256 && + wb[0] > 256 && wb[0] < 640 && wb[2] > 256 && wb[2] < 640) + FORC4 cam_mul[c] = wb[c]; + } + goto quit; } if (!strcmp (buf,"Nikon")) { base = ftell(ifp); @@ -4878,30 +7341,71 @@ if (get2() != 42) goto quit; offset = get4(); fseek (ifp, offset-8, SEEK_CUR); - } else if (!strcmp (buf,"OLYMPUS")) { + } else if (!strcmp (buf,"OLYMPUS") || + !strcmp (buf,"PENTAX ")) { base = ftell(ifp)-10; fseek (ifp, -2, SEEK_CUR); - order = get2(); get2(); + order = get2(); + if (buf[0] == 'O') get2(); } else if (!strncmp (buf,"SONY",4) || - !strcmp (buf,"Panasonic")) { + !strcmp (buf,"Panasonic")) { goto nf; } else if (!strncmp (buf,"FUJIFILM",8)) { base = ftell(ifp)-10; -nf: order = 0x4949; + nf: order = 0x4949; fseek (ifp, 2, SEEK_CUR); } else if (!strcmp (buf,"OLYMP") || - !strcmp (buf,"LEICA") || - !strcmp (buf,"Ricoh") || - !strcmp (buf,"EPSON")) + !strcmp (buf,"LEICA") || + !strcmp (buf,"Ricoh") || + !strcmp (buf,"EPSON")) fseek (ifp, -2, SEEK_CUR); else if (!strcmp (buf,"AOC") || - !strcmp (buf,"QVC")) + !strcmp (buf,"QVC")) fseek (ifp, -4, SEEK_CUR); else { fseek (ifp, -10, SEEK_CUR); if (!strncmp(make,"SAMSUNG",7)) base = ftell(ifp); } + + // adjust pos & base for Leica M8/M9/M Mono tags and dir in tag 0x3400 + if (!strncasecmp(make, "LEICA", 5)) + { + if (!strncmp(model, "M8", 2) || + !strncasecmp(model, "Leica M8", 8) || + !strncasecmp(model, "LEICA X", 7)) + { + base = ftell(ifp)-8; + } + else if (!strncasecmp(model, "LEICA M (Typ 240)", 17)) + { + base = 0; + } + else if (!strncmp(model, "M9", 2) || + !strncasecmp(model, "Leica M9", 8) || + !strncasecmp(model, "M Monochrom", 11) || + !strncasecmp(model, "Leica M Monochrom", 11)) + { + if (!uptag) + { + base = ftell(ifp) - 10; + fseek (ifp, 8, SEEK_CUR); + } + else if (uptag == 0x3400) + { + fseek (ifp, 10, SEEK_CUR); + base += 10; + } + } + else if (!strncasecmp(model, "LEICA T", 7)) + { + base = ftell(ifp)-8; +#ifdef LIBRAW_LIBRARY_BUILD + imgdata.lens.makernotes.CameraMount = LIBRAW_MOUNT_Leica_T; +#endif + } + } + entries = get2(); if (entries > 1000) return; morder = order; @@ -4909,21 +7413,664 @@ order = morder; tiff_get (base, &tag, &type, &len, &save); tag |= uptag << 16; + if(len > 100*1024*1024) continue; // 100Mb tag? No! + +#ifdef LIBRAW_LIBRARY_BUILD + INT64 _pos = ftell(ifp); + if (!strncmp(make, "Canon",5)) + { + if (tag == 0x0001) // camera settings + { + fseek(ifp, 44, SEEK_CUR); + imgdata.lens.makernotes.LensID = get2(); + imgdata.lens.makernotes.MaxFocal = get2(); + imgdata.lens.makernotes.MinFocal = get2(); + imgdata.lens.makernotes.CanonFocalUnits = get2(); + if (imgdata.lens.makernotes.CanonFocalUnits != 1) + { + imgdata.lens.makernotes.MaxFocal /= (float)imgdata.lens.makernotes.CanonFocalUnits; + imgdata.lens.makernotes.MinFocal /= (float)imgdata.lens.makernotes.CanonFocalUnits; + } + imgdata.lens.makernotes.MaxAp = _CanonConvertAperture(get2()); + imgdata.lens.makernotes.MinAp = _CanonConvertAperture(get2()); + } + + else if (tag == 0x0002) // focal length + { + imgdata.lens.makernotes.FocalType = get2(); + imgdata.lens.makernotes.CurFocal = get2(); + if ((imgdata.lens.makernotes.CanonFocalUnits != 1) && + imgdata.lens.makernotes.CanonFocalUnits) + { + imgdata.lens.makernotes.CurFocal /= (float)imgdata.lens.makernotes.CanonFocalUnits; + } + } + + else if (tag == 0x0004) // shot info + { + short tempAp; + fseek(ifp, 8, SEEK_CUR); + if ((tempAp = get2()) != 0x7fff) + imgdata.lens.makernotes.CurAp = _CanonConvertAperture(tempAp); + if (imgdata.lens.makernotes.CurAp < 0.7f) + { + fseek(ifp, 32, SEEK_CUR); + imgdata.lens.makernotes.CurAp = _CanonConvertAperture(get2()); + } + if (!aperture) aperture = imgdata.lens.makernotes.CurAp; + } + + else if (tag == 0x000d) // camera info + { + CanonCameraInfo = (uchar*)malloc(len); + fread(CanonCameraInfo, len, 1, ifp); + lenCanonCameraInfo = len; + } + + else if (tag == 0x0095 && // lens model tag + !imgdata.lens.makernotes.Lens[0]) + { + fread(imgdata.lens.makernotes.Lens, 2, 1, ifp); + imgdata.lens.makernotes.LensMount = LIBRAW_MOUNT_Canon_EF; + if (imgdata.lens.makernotes.Lens[0] < 65) // non-Canon lens + fread(imgdata.lens.makernotes.Lens + 2, 62, 1, ifp); + else + { + char efs[2]; + imgdata.lens.makernotes.LensFeatures_pre[0] = imgdata.lens.makernotes.Lens[0]; + imgdata.lens.makernotes.LensFeatures_pre[1] = imgdata.lens.makernotes.Lens[1]; + fread(efs, 2, 1, ifp); + if (efs[0] == 45 && (efs[1] == 83 || efs[1] == 69 || efs[1] == 77)) + { // "EF-S, TS-E, MP-E, EF-M" lenses + imgdata.lens.makernotes.Lens[2] = imgdata.lens.makernotes.LensFeatures_pre[2] = efs[0]; + imgdata.lens.makernotes.Lens[3] = imgdata.lens.makernotes.LensFeatures_pre[3] = efs[1]; + imgdata.lens.makernotes.Lens[4] = 32; + if (efs[1] == 83) + { + imgdata.lens.makernotes.LensMount = LIBRAW_MOUNT_Canon_EF_S; + imgdata.lens.makernotes.LensFormat = LIBRAW_FORMAT_APSC; + } + else if (efs[1] == 77) + { + imgdata.lens.makernotes.LensMount = LIBRAW_MOUNT_Canon_EF_M; + } + } + else + { // "EF" lenses + imgdata.lens.makernotes.Lens[2] = 32; + imgdata.lens.makernotes.Lens[3] = efs[0]; + imgdata.lens.makernotes.Lens[4] = efs[1]; + } + fread(imgdata.lens.makernotes.Lens + 5, 58, 1, ifp); + } + } + } + + else if (!strncmp(make, "FUJI", 4)) + switch (tag) { + case 0x1404: imgdata.lens.makernotes.MinFocal = getreal(type); break; + case 0x1405: imgdata.lens.makernotes.MaxFocal = getreal(type); break; + case 0x1406: imgdata.lens.makernotes.MaxAp4MinFocal = getreal(type); break; + case 0x1407: imgdata.lens.makernotes.MaxAp4MaxFocal = getreal(type); break; + } + + else if (!strncasecmp(make, "LEICA", 5)) + { + if ((tag == 0x0303) && (type != 4)) + { + fread(imgdata.lens.makernotes.Lens, MIN(len,127), 1, ifp); + } + + if ((tag == 0x3405) || + (tag == 0x0310) || + (tag == 0x34003405)) + { + imgdata.lens.makernotes.LensID = get4(); + imgdata.lens.makernotes.LensID = + ((imgdata.lens.makernotes.LensID>>2)<<8) | + (imgdata.lens.makernotes.LensID & 0x3); + if (imgdata.lens.makernotes.LensID != -1) + { + if ((model[0] == 'M') || + !strncasecmp (model, "LEICA M", 7)) + { + imgdata.lens.makernotes.CameraMount = LIBRAW_MOUNT_Leica_M; + if (imgdata.lens.makernotes.LensID) + imgdata.lens.makernotes.LensMount = LIBRAW_MOUNT_Leica_M; + } + else if ((model[0] == 'S') || + !strncasecmp (model, "LEICA S", 7)) + { + imgdata.lens.makernotes.CameraMount = LIBRAW_MOUNT_Leica_S; + if (imgdata.lens.makernotes.Lens[0]) + imgdata.lens.makernotes.LensMount = LIBRAW_MOUNT_Leica_S; + } + } + } + + else if ( + ((tag == 0x0313) || (tag == 0x34003406)) && + (fabs(imgdata.lens.makernotes.CurAp) < 0.17f) && + ((type == 10) || (type == 5)) + ) + { + imgdata.lens.makernotes.CurAp = getreal(type); + if (imgdata.lens.makernotes.CurAp > 126.3) + imgdata.lens.makernotes.CurAp = 0.0f; + } + + else if (tag == 0x3400) + { + parse_makernote (base, 0x3400); + } + } + + else if (!strncmp(make, "NIKON",5)) + { + if (tag == 0x000a) + { + imgdata.lens.makernotes.LensMount = LIBRAW_MOUNT_FixedLens; + imgdata.lens.makernotes.CameraMount = LIBRAW_MOUNT_FixedLens; + } + else if (tag == 0x0082) // lens attachment + { + fread(imgdata.lens.makernotes.Attachment, MIN(len,127), 1, ifp); + } + else if (tag == 0x0083) // lens type + { + imgdata.lens.nikon.NikonLensType = fgetc(ifp); + } + else if (tag == 0x0084) // lens + { + imgdata.lens.makernotes.MinFocal = getreal(type); + imgdata.lens.makernotes.MaxFocal = getreal(type); + imgdata.lens.makernotes.MaxAp4MinFocal = getreal(type); + imgdata.lens.makernotes.MaxAp4MaxFocal = getreal(type); + } + else if (tag == 0x008b) // lens f-stops + { + uchar a, b, c; + a = fgetc(ifp); + b = fgetc(ifp); + c = fgetc(ifp); + if (c) + { + imgdata.lens.nikon.NikonLensFStops = a*b*(12/c); + imgdata.lens.makernotes.LensFStops = + (float)imgdata.lens.nikon.NikonLensFStops /12.0f; + } + } + else if (tag == 0x0093) + { + i = get2(); + if ((i == 7) || (i == 9)) + { + imgdata.lens.makernotes.LensMount = LIBRAW_MOUNT_FixedLens; + imgdata.lens.makernotes.CameraMount = LIBRAW_MOUNT_FixedLens; + } + } + else if (tag == 0x0098) // contains lens data + { + for (i = 0; i < 4; i++) + { + NikonLensDataVersion = NikonLensDataVersion * 10 + fgetc(ifp) - '0'; + } + switch (NikonLensDataVersion) + { + case 100: lenNikonLensData = 9; break; + case 101: + case 201: // encrypted, starting from v.201 + case 202: + case 203: lenNikonLensData = 15; break; + case 204: lenNikonLensData = 16; break; + case 400: lenNikonLensData = 459; break; + case 401: lenNikonLensData = 590; break; + case 402: lenNikonLensData = 509; break; + case 403: lenNikonLensData = 879; break; + } + if(lenNikonLensData>0) + { + table_buf = (uchar*)malloc(lenNikonLensData); + fread(table_buf, lenNikonLensData, 1, ifp); + if ((NikonLensDataVersion < 201) && lenNikonLensData) + { + processNikonLensData(table_buf, lenNikonLensData); + free(table_buf); + lenNikonLensData = 0; + } + } + } + } + + else if (!strncmp(make, "OLYMPUS", 7)) + { + switch (tag) { + case 0x0207: + case 0x20100100: + { + uchar sOlyID[8]; + unsigned long long OlyID; + fread (sOlyID, MIN(len,7), 1, ifp); + sOlyID[7] = 0; + OlyID = sOlyID[0]; + i = 1; + while (i < 7 && sOlyID[i]) + { + OlyID = OlyID << 8 | sOlyID[i]; + i++; + } + setOlympusBodyFeatures(OlyID); + } + break; + case 0x1002: + imgdata.lens.makernotes.CurAp = powf64(2.0f, getreal(type)/2); + break; + case 0x20100201: + { + unsigned long long oly_lensid [3]; + oly_lensid[0] = fgetc(ifp); + fgetc(ifp); + oly_lensid[1] = fgetc(ifp); + oly_lensid[2] = fgetc(ifp); + imgdata.lens.makernotes.LensID = + (oly_lensid[0] << 16) | (oly_lensid[1] << 8) | oly_lensid[2]; + } + imgdata.lens.makernotes.LensMount = LIBRAW_MOUNT_FT; + imgdata.lens.makernotes.LensFormat = LIBRAW_FORMAT_FT; + if (((imgdata.lens.makernotes.LensID < 0x20000) || + (imgdata.lens.makernotes.LensID > 0x4ffff)) && + (imgdata.lens.makernotes.LensID & 0x10)) + { + imgdata.lens.makernotes.LensMount = LIBRAW_MOUNT_mFT; + } + break; + case 0x20100203: + fread(imgdata.lens.makernotes.Lens, MIN(len,127), 1, ifp); + break; + case 0x20100205: + imgdata.lens.makernotes.MaxAp4MinFocal = powf64(sqrt(2.0f), get2() / 256.0f); + break; + case 0x20100206: + imgdata.lens.makernotes.MaxAp4MaxFocal = powf64(sqrt(2.0f), get2() / 256.0f); + break; + case 0x20100207: + imgdata.lens.makernotes.MinFocal = (float)get2(); + break; + case 0x20100208: + imgdata.lens.makernotes.MaxFocal = (float)get2(); + if (imgdata.lens.makernotes.MaxFocal > 1000.0f) + imgdata.lens.makernotes.MaxFocal = imgdata.lens.makernotes.MinFocal; + break; + case 0x2010020a: + imgdata.lens.makernotes.MaxAp4CurFocal = powf64(sqrt(2.0f), get2() / 256.0f); + break; + case 0x20100301: + imgdata.lens.makernotes.TeleconverterID = fgetc(ifp) << 8; + fgetc(ifp); + imgdata.lens.makernotes.TeleconverterID = + imgdata.lens.makernotes.TeleconverterID | fgetc(ifp); + break; + case 0x20100303: + fread(imgdata.lens.makernotes.Teleconverter, MIN(len,127), 1, ifp); + break; + case 0x20100403: + fread(imgdata.lens.makernotes.Attachment, MIN(len,127), 1, ifp); + break; + } + } + + else if ((!strncmp(make, "PENTAX", 6) || !strncmp(make, "RICOH", 5)) && + !strncmp(model, "GR", 2)) + { + if ((tag == 0x1001) && (type == 3)) + { + imgdata.lens.makernotes.CameraMount = LIBRAW_MOUNT_FixedLens; + imgdata.lens.makernotes.LensMount = LIBRAW_MOUNT_FixedLens; + imgdata.lens.makernotes.CameraFormat = LIBRAW_FORMAT_APSC; + imgdata.lens.makernotes.LensID = -1; + imgdata.lens.makernotes.FocalType = 1; + } + else if ((tag == 0x1017) && (get2() == 2)) + { + strcpy(imgdata.lens.makernotes.Attachment, "Wide-Angle Adapter"); + } + else if (tag == 0x1500) + { + imgdata.lens.makernotes.CurFocal = getreal(type); + } + } + + else if (!strncmp(make, "RICOH", 5) && + strncmp(model, "PENTAX", 6)) + { + if ((tag == 0x1017) && (get2() == 2)) + { + strcpy(imgdata.lens.makernotes.Attachment, "Wide-Angle Adapter"); + } + + else if (tag == 0x1500) + { + imgdata.lens.makernotes.CurFocal = getreal(type); + } + + else if ((tag == 0x2001) && !strncmp(model, "GXR", 3)) + { + short ntags, cur_tag; + fseek(ifp, 20, SEEK_CUR); + ntags = get2(); + cur_tag = get2(); + while (cur_tag != 0x002c) + { + fseek(ifp, 10, SEEK_CUR); + cur_tag = get2(); + } + fseek(ifp, 6, SEEK_CUR); + fseek(ifp, get4()+34, SEEK_SET); + imgdata.lens.makernotes.LensID = getc(ifp) - '0'; + switch(imgdata.lens.makernotes.LensID) + { + case 1: + case 2: + case 3: + case 5: + case 6: + imgdata.lens.makernotes.CameraMount = LIBRAW_MOUNT_FixedLens; + imgdata.lens.makernotes.LensMount = LIBRAW_MOUNT_RicohModule; + break; + case 8: + imgdata.lens.makernotes.CameraMount = LIBRAW_MOUNT_Leica_M; + imgdata.lens.makernotes.CameraFormat = LIBRAW_FORMAT_APSC; + imgdata.lens.makernotes.LensID = -1; + break; + default: + imgdata.lens.makernotes.LensID = -1; + } + } + } + + else if (!strncmp(make, "PENTAX", 6) || + !strncmp(model, "PENTAX", 6) || + (!strncmp(make, "SAMSUNG", 7) && dng_version) && + strncmp(model, "GR", 2)) + { + if (tag == 0x0005) + { + unique_id = get4(); + setPentaxBodyFeatures(unique_id); + } + else if (tag == 0x0013) + { + imgdata.lens.makernotes.CurAp = (float)get2()/10.0f; + } + else if (tag == 0x001d) + { + imgdata.lens.makernotes.CurFocal = (float)get4()/100.0f; + } + else if (tag == 0x003f) + { + imgdata.lens.makernotes.LensID = fgetc(ifp) << 8 | fgetc(ifp); + } + else if (tag == 0x0207) + { + PentaxLensInfo(imgdata.lens.makernotes.CamID, len); + } + else if (tag == 0x0239) // Q-series lens info (LensInfoQ) + { + char LensInfo [20]; + fseek (ifp, 2, SEEK_CUR); + fread(imgdata.lens.makernotes.Lens, 30, 1, ifp); + strcat(imgdata.lens.makernotes.Lens, " "); + fread(LensInfo, 20, 1, ifp); + strcat(imgdata.lens.makernotes.Lens, LensInfo); + } + } + + else if (!strncmp(make, "SAMSUNG", 7)) + { + if (tag == 0x0002) + { + if(get4() == 0x2000) + { + imgdata.lens.makernotes.CameraMount = LIBRAW_MOUNT_Samsung_NX; + } + else if (!strncmp(model, "NX mini", 7)) + { + imgdata.lens.makernotes.CameraMount = LIBRAW_MOUNT_Samsung_NX_M; + } + else + { + imgdata.lens.makernotes.CameraMount = LIBRAW_MOUNT_FixedLens; + imgdata.lens.makernotes.LensMount = LIBRAW_MOUNT_FixedLens; + } + } + else if (tag == 0x0003) + { + unique_id = imgdata.lens.makernotes.CamID = get4(); + } + else if (tag == 0xa003) + { + imgdata.lens.makernotes.LensID = get2(); + if (imgdata.lens.makernotes.LensID) + imgdata.lens.makernotes.LensMount = LIBRAW_MOUNT_Samsung_NX; + } + else if (tag == 0xa019) + { + imgdata.lens.makernotes.CurAp = getreal(type); + } + else if (tag == 0xa01a) + { + imgdata.lens.makernotes.FocalLengthIn35mmFormat = get4() / 10.0f; + if (imgdata.lens.makernotes.FocalLengthIn35mmFormat < 10.0f) + imgdata.lens.makernotes.FocalLengthIn35mmFormat *= 10.0f; + } + } + + else if (!strncasecmp(make, "SONY", 4) || + !strncasecmp(make, "Konica", 6) || + !strncasecmp(make, "Minolta", 7) || + (!strncasecmp(make, "Hasselblad", 10) && + (!strncasecmp(model, "Stellar", 7) || + !strncasecmp(model, "Lunar", 5) || + !strncasecmp(model, "Lusso", 5) || + !strncasecmp(model, "HV",2)))) + { + ushort lid; + + if (tag == 0xb001) // Sony ModelID + { + unique_id = get2(); + setSonyBodyFeatures(unique_id); + if (table_buf_0x9050_present) + { + process_Sony_0x9050(table_buf_0x9050, unique_id); + free (table_buf_0x9050); + table_buf_0x9050_present = 0; + } + if (table_buf_0x940c_present) + { + if (imgdata.lens.makernotes.CameraMount == LIBRAW_MOUNT_Sony_E) + { + process_Sony_0x940c(table_buf_0x940c); + } + free (table_buf_0x940c); + table_buf_0x940c_present = 0; + } + } + + else if ((tag == 0x0010) && // CameraInfo + strncasecmp(model, "DSLR-A100", 9) && + strncasecmp(model, "NEX-5C", 6) && + !strncasecmp(make, "SONY", 4) && + ((len == 368) || // a700 + (len == 5478) || // a850, a900 + (len == 5506) || // a200, a300, a350 + (len == 6118) || // a230, a290, a330, a380, a390 + + // a450, a500, a550, a560, a580 + // a33, a35, a55 + // NEX3, NEX5, NEX5C, NEXC3, VG10E + (len == 15360)) + ) + { + table_buf = (uchar*)malloc(len); + fread(table_buf, len, 1, ifp); + if (memcmp(table_buf, "\xff\xff\xff\xff\xff\xff\xff\xff", 8) && + memcmp(table_buf, "\x00\x00\x00\x00\x00\x00\x00\x00", 8)) + { + switch (len) + { + case 368: + case 5478: + // a700, a850, a900: CameraInfo + if (table_buf[0] | table_buf[3]) + imgdata.lens.makernotes.MinFocal = + bcd2dec(table_buf[0]) * 100 + bcd2dec(table_buf[3]); + if (table_buf[2] | table_buf[5]) + imgdata.lens.makernotes.MaxFocal = + bcd2dec(table_buf[2]) * 100 + bcd2dec(table_buf[5]); + if (table_buf[4]) + imgdata.lens.makernotes.MaxAp4MinFocal = bcd2dec(table_buf[4]) / 10.0f; + if (table_buf[4]) + imgdata.lens.makernotes.MaxAp4MaxFocal = bcd2dec(table_buf[7]) / 10.0f; + parseSonyLensFeatures(table_buf[1], table_buf[6]); + break; + default: + // CameraInfo2 & 3 + if (table_buf[1] | table_buf[2]) + imgdata.lens.makernotes.MinFocal = + bcd2dec(table_buf[1]) * 100 + bcd2dec(table_buf[2]); + if (table_buf[3] | table_buf[4]) + imgdata.lens.makernotes.MaxFocal = + bcd2dec(table_buf[3]) * 100 + bcd2dec(table_buf[4]); + if (table_buf[5]) + imgdata.lens.makernotes.MaxAp4MinFocal = bcd2dec(table_buf[5]) / 10.0f; + if (table_buf[6]) + imgdata.lens.makernotes.MaxAp4MaxFocal = bcd2dec(table_buf[6]) / 10.0f; + parseSonyLensFeatures(table_buf[0], table_buf[7]); + } + } + free(table_buf); + } + + else if (tag == 0x0105) // Teleconverter + { + imgdata.lens.makernotes.TeleconverterID = get2(); + } + + else if (tag == 0x0114) // CameraSettings + { + table_buf = (uchar*)malloc(len); + fread(table_buf, len, 1, ifp); + switch (len) { + case 280: + case 364: + case 332: + // CameraSettings and CameraSettings2 are big endian + if (table_buf[2] | table_buf[3]) + { + lid = (((ushort)table_buf[2])<<8) | + ((ushort)table_buf[3]); + imgdata.lens.makernotes.CurAp = + powf64(2.0f, ((float)lid/8.0f-1.0f)/2.0f); + } + break; + case 1536: + case 2048: + // CameraSettings3 are little endian + parseSonyLensType2(table_buf[1016], table_buf[1015]); + if (imgdata.lens.makernotes.LensMount != LIBRAW_MOUNT_Canon_EF) + { + switch (table_buf[153]) { + case 16: imgdata.lens.makernotes.LensMount = LIBRAW_MOUNT_Minolta_A; break; + case 17: imgdata.lens.makernotes.LensMount = LIBRAW_MOUNT_Sony_E; break; + } + } + break; + } + free(table_buf); + } + + else if (tag == 0x9050) // little endian + { + table_buf_0x9050 = (uchar*)malloc(len); + table_buf_0x9050_present = 1; + fread(table_buf_0x9050, len, 1, ifp); + + if (imgdata.lens.makernotes.CamID) + { + process_Sony_0x9050(table_buf_0x9050, imgdata.lens.makernotes.CamID); + free (table_buf_0x9050); + table_buf_0x9050_present = 0; + } + } + + else if (tag == 0x940c) + { + table_buf_0x940c = (uchar*)malloc(len); + table_buf_0x940c_present = 1; + fread(table_buf_0x940c, len, 1, ifp); + if ((imgdata.lens.makernotes.CamID) && + (imgdata.lens.makernotes.CameraMount == LIBRAW_MOUNT_Sony_E)) + { + process_Sony_0x940c(table_buf_0x940c); + free(table_buf_0x940c); + table_buf_0x940c_present = 0; + } + } + + else if (((tag == 0xb027) || (tag == 0x010c)) && (imgdata.lens.makernotes.LensID == -1)) + { + imgdata.lens.makernotes.LensID = get4(); + if ((imgdata.lens.makernotes.LensID > 61184) && + (imgdata.lens.makernotes.LensID < 65535)) + { + imgdata.lens.makernotes.LensID -= 61184; + imgdata.lens.makernotes.LensMount = LIBRAW_MOUNT_Canon_EF; + } + if (tag == 0x010c) imgdata.lens.makernotes.CameraMount = LIBRAW_MOUNT_Minolta_A; + } + + else if (tag == 0xb02a) // Sony LensSpec + { + table_buf = (uchar*)malloc(len); + fread(table_buf, len, 1, ifp); + if (table_buf[1] | table_buf[2]) + imgdata.lens.makernotes.MinFocal = + bcd2dec(table_buf[1]) * 100 + bcd2dec(table_buf[2]); + if (table_buf[3] | table_buf[4]) + imgdata.lens.makernotes.MaxFocal = + bcd2dec(table_buf[3]) * 100 + bcd2dec(table_buf[4]); + if (table_buf[5]) + imgdata.lens.makernotes.MaxAp4MinFocal = bcd2dec(table_buf[5]) / 10.0f; + if (table_buf[6]) + imgdata.lens.makernotes.MaxAp4MaxFocal = bcd2dec(table_buf[6]) / 10.0f; + parseSonyLensFeatures(table_buf[0], table_buf[7]); + free(table_buf); + } + } + + fseek(ifp,_pos,SEEK_SET); +#endif + if (tag == 2 && strstr(make,"NIKON") && !iso_speed) iso_speed = (get2(),get2()); - if (tag == 37 && strstr(make,"NIKON") && !iso_speed) + if (tag == 37 && strstr(make,"NIKON") && (!iso_speed || iso_speed == 65535)) { unsigned char cc; fread(&cc,1,1,ifp); - iso_speed = int(100.0 * pow(2.0,double(cc)/12.0-5.0)); + iso_speed = int(100.0 * powf64(2.0f,float(cc)/12.0-5.0)); } if (tag == 4 && len > 26 && len < 35) { - if ((i=(get4(),get2())) != 0x7fff && !iso_speed) - iso_speed = 50 * pow (2.0, i/32.0 - 4); + if ((i=(get4(),get2())) != 0x7fff && (!iso_speed || iso_speed == 65535)) + iso_speed = 50 * powf64(2.0, i/32.0 - 4); +#ifdef LIBRAW_LIBRARY_BUILD + get4(); +#else if ((i=(get2(),get2())) != 0x7fff && !aperture) - aperture = pow (2.0, i/64.0); + aperture = powf64(2.0, i/64.0); +#endif if ((i=get2()) != 0xffff && !shutter) - shutter = pow (2.0, (short) i/-32.0); + shutter = powf64(2.0, (short) i/-32.0); wbi = (get2(),get2()); shot_order = (get2(),get2()); } @@ -4939,7 +8086,7 @@ fgets (model2, 64, ifp); if (tag == 8 && type == 4) shot_order = get4(); - if (tag == 9 && !strcmp(make,"Canon")) + if (tag == 9 && !strncmp(make,"Canon",5)) fread (artist, 64, 1, ifp); if (tag == 0xc && len == 4) FORC3 cam_mul[(c << 1 | c >> 1) & 3] = getreal(type); @@ -4950,8 +8097,150 @@ if (get4() == 257 && (i=len) && (c = (get4(),fgetc(ifp))) < 3) flip = "065"[c]-'0'; } + if (tag == 0x10 && type == 4) - unique_id = get4(); + { + unique_id = get4(); + +#ifdef LIBRAW_LIBRARY_BUILD + if (unique_id == 0x03740000) unique_id = 0x80000374; + setCanonBodyFeatures(unique_id); + if (lenCanonCameraInfo) + { + processCanonCameraInfo(unique_id, CanonCameraInfo,lenCanonCameraInfo); + free(CanonCameraInfo); + CanonCameraInfo = 0; + lenCanonCameraInfo = 0; + } +#endif + } + +#ifdef LIBRAW_LIBRARY_BUILD + INT64 _pos2 = ftell(ifp); + + if(tag == 0x20400805 && len == 2 && !strncasecmp(make,"Olympus",7)) + { + imgdata.color.OlympusSensorCalibration[0]=getreal(type); + imgdata.color.OlympusSensorCalibration[1]=getreal(type); + } + if (tag == 0x4001 && len > 500 && !strncasecmp(make,"Canon",5)) + { + long int save1 = ftell(ifp); + switch (len) + { + case 582: + imgdata.color.canon_makernotes.CanonColorDataVer = 1; // 20D / 350D + break; + case 653: + imgdata.color.canon_makernotes.CanonColorDataVer = 2; // 1Dmk2 / 1DsMK2 + break; + case 796: + imgdata.color.canon_makernotes.CanonColorDataVer = 3; // 1DmkIIN / 5D / 30D / 400D + imgdata.color.canon_makernotes.CanonColorDataSubVer = get2(); + { + fseek (ifp, save1+(0x0c4<<1), SEEK_SET); // offset 196 short + int bls=0; + FORC4 bls+=get2(); + imgdata.color.canon_makernotes.AverageBlackLevel = bls/4; + } + break; + // 1DmkIII / 1DSmkIII / 1DmkIV / 5DmkII + // 7D / 40D / 50D / 60D / 450D / 500D + // 550D / 1000D / 1100D + case 674: case 692: case 702: case 1227: case 1250: + case 1251: case 1337: case 1338: case 1346: + imgdata.color.canon_makernotes.CanonColorDataVer = 4; + imgdata.color.canon_makernotes.CanonColorDataSubVer = get2(); + { + fseek (ifp, save1+(0x0e7<<1), SEEK_SET); // offset 231 short + int bls=0; + FORC4 bls+=get2(); + imgdata.color.canon_makernotes.AverageBlackLevel = bls/4; + } + if ((imgdata.color.canon_makernotes.CanonColorDataSubVer == 4) + || (imgdata.color.canon_makernotes.CanonColorDataSubVer == 5)) + { + fseek (ifp, save1+(0x2b9<<1), SEEK_SET); // offset 697 shorts + imgdata.color.canon_makernotes.SpecularWhiteLevel = get2(); + } + else if ((imgdata.color.canon_makernotes.CanonColorDataSubVer == 6) || + (imgdata.color.canon_makernotes.CanonColorDataSubVer == 7)) + { + fseek (ifp, save1+(0x2d0<<1), SEEK_SET); // offset 720 shorts + imgdata.color.canon_makernotes.SpecularWhiteLevel = get2(); + } + else if (imgdata.color.canon_makernotes.CanonColorDataSubVer == 9) + { + fseek (ifp, save1+(0x2d4<<1), SEEK_SET); // offset 724 shorts + imgdata.color.canon_makernotes.SpecularWhiteLevel = get2(); + } + break; + + case 5120: + imgdata.color.canon_makernotes.CanonColorDataVer = 5; // PowerSot G10, EOS M3 + { + fseek (ifp, save1+(0x108<<1), SEEK_SET); // offset 264 short + int bls=0; + FORC4 bls+=get2(); + imgdata.color.canon_makernotes.AverageBlackLevel = bls/4; + } + break; + + case 1273: case 1275: + imgdata.color.canon_makernotes.CanonColorDataVer = 6; // 600D / 1200D + imgdata.color.canon_makernotes.CanonColorDataSubVer = get2(); + { + fseek (ifp, save1+(0x0fb<<1), SEEK_SET); // offset 251 short + int bls=0; + FORC4 bls+=get2(); + imgdata.color.canon_makernotes.AverageBlackLevel = bls/4; + } + fseek (ifp, save1+(0x1e4<<1), SEEK_SET); // offset 484 shorts + imgdata.color.canon_makernotes.SpecularWhiteLevel = get2(); + break; + + // 1DX / 5DmkIII / 6D / 100D / 650D / 700D / M / 7DmkII / 750D / 760D + case 1312: case 1313: case 1316: case 1506: + imgdata.color.canon_makernotes.CanonColorDataVer = 7; + imgdata.color.canon_makernotes.CanonColorDataSubVer = get2(); + { + fseek (ifp, save1+(0x114<<1), SEEK_SET); // offset 276 shorts + int bls=0; + FORC4 bls+=get2(); + imgdata.color.canon_makernotes.AverageBlackLevel = bls/4; + } + if (imgdata.color.canon_makernotes.CanonColorDataSubVer == 10) + { + fseek (ifp, save1+(0x1fd<<1), SEEK_SET); // offset 509 shorts + imgdata.color.canon_makernotes.SpecularWhiteLevel = get2(); + } else if (imgdata.color.canon_makernotes.CanonColorDataSubVer == 11) + { + fseek (ifp, save1+(0x2dd<<1), SEEK_SET); // offset 733 shorts + imgdata.color.canon_makernotes.SpecularWhiteLevel = get2(); + } + break; + + // 5DS / 5DS R + case 1560: + imgdata.color.canon_makernotes.CanonColorDataVer = 8; + imgdata.color.canon_makernotes.CanonColorDataSubVer = get2(); + { + fseek (ifp, save1+(0x146<<1), SEEK_SET); // offset 326 shorts + int bls=0; + FORC4 bls+=get2(); + imgdata.color.canon_makernotes.AverageBlackLevel = bls/4; + } + fseek (ifp, save1+(0x30f<<1), SEEK_SET); // offset 783 shorts + imgdata.color.canon_makernotes.SpecularWhiteLevel = get2(); + break; + + } + fseek (ifp, save1, SEEK_SET); + } + + fseek(ifp,_pos2,SEEK_SET); + +#endif if (tag == 0x11 && is_raw && !strncmp(make,"NIKON",5)) { fseek (ifp, get4()+base, SEEK_SET); parse_tiff_ifd (base); @@ -4978,6 +8267,16 @@ if (tag == 0x1d) while ((c = fgetc(ifp)) && c != EOF) serial = serial*10 + (isdigit(c) ? c - '0' : c % 10); + if (tag == 0x29 && type == 1) { // Canon PowerShot G9 + c = wbi < 18 ? "012347800000005896"[wbi]-'0' : 0; + fseek (ifp, 8 + c*32, SEEK_CUR); + FORC4 cam_mul[c ^ (c >> 1) ^ 1] = get4(); + } +#ifndef LIBRAW_LIBRARY_BUILD + // works for some files, but not all + if (tag == 0x3d && type == 3 && len == 4) + FORC4 cblack[c ^ c >> 1] = get2() >> (14-tiff_ifd[2].bps); +#endif if (tag == 0x81 && type == 4) { data_offset = get4(); fseek (ifp, data_offset + 41, SEEK_SET); @@ -4985,11 +8284,6 @@ raw_width = get2(); filters = 0x61616161; } - if (tag == 0x29 && type == 1) { - c = wbi < 18 ? "012347800000005896"[wbi]-'0' : 0; - fseek (ifp, 8 + c*32, SEEK_CUR); - FORC4 cam_mul[c ^ (c >> 1) ^ 1] = get4(); - } if ((tag == 0x81 && type == 7) || (tag == 0x100 && type == 7) || (tag == 0x280 && type == 1)) { @@ -5012,7 +8306,8 @@ break; case 102: fseek (ifp, 6, SEEK_CUR); - goto get2_rggb; + FORC4 cam_mul[c ^ (c >> 1)] = get2(); + break; case 103: fseek (ifp, 16, SEEK_CUR); FORC4 cam_mul[c] = get2(); @@ -5031,17 +8326,40 @@ fseek (ifp, wbi*48, SEEK_CUR); FORC3 cam_mul[c] = get2(); } - if (tag == 0xa7 && (unsigned) (ver97-200) < 17) { - ci = xlat[0][serial & 0xff]; - cj = xlat[1][fgetc(ifp)^fgetc(ifp)^fgetc(ifp)^fgetc(ifp)]; - ck = 0x60; - for (i=0; i < 324; i++) - buf97[i] ^= (cj += ci * ck++); - i = "66666>666;6A;:;55"[ver97-200] - '0'; - FORC4 cam_mul[c ^ (c >> 1) ^ (i & 1)] = - sget2 (buf97 + (i & -2) + c*2); + + if (tag == 0xa7) { // shutter count + NikonKey = fgetc(ifp)^fgetc(ifp)^fgetc(ifp)^fgetc(ifp); + if ( (unsigned) (ver97-200) < 17) { + ci = xlat[0][serial & 0xff]; + cj = xlat[1][NikonKey]; + ck = 0x60; + for (i=0; i < 324; i++) + buf97[i] ^= (cj += ci * ck++); + i = "66666>666;6A;:;55"[ver97-200] - '0'; + FORC4 cam_mul[c ^ (c >> 1) ^ (i & 1)] = + sget2 (buf97 + (i & -2) + c*2); + } +#ifdef LIBRAW_LIBRARY_BUILD + if ((NikonLensDataVersion > 200) && lenNikonLensData) + { + ci = xlat[0][serial & 0xff]; + cj = xlat[1][NikonKey]; + ck = 0x60; + for (i = 0; i < lenNikonLensData; i++) + table_buf[i] ^= (cj += ci * ck++); + processNikonLensData(table_buf, lenNikonLensData); + lenNikonLensData = 0; + free(table_buf); + } + if (ver97 == 601) // Coolpix A + { + imgdata.lens.makernotes.LensMount = LIBRAW_MOUNT_FixedLens; + imgdata.lens.makernotes.CameraMount = LIBRAW_MOUNT_FixedLens; + } +#endif } - if(tag == 0xb001 && type == 3) + + if(tag == 0xb001 && type == 3) // Sony ModelID { unique_id = get2(); } @@ -5050,17 +8368,33 @@ if (tag == 0x200 && len == 4) FORC4 cblack[c ^ c >> 1] = get2(); if (tag == 0x201 && len == 4) - goto get2_rggb; + FORC4 cam_mul[c ^ (c >> 1)] = get2(); if (tag == 0x220 && type == 7) meta_offset = ftell(ifp); if (tag == 0x401 && type == 4 && len == 4) FORC4 cblack[c ^ c >> 1] = get4(); +#ifdef LIBRAW_LIBRARY_BUILD + // not corrected for file bitcount, to be patched in open_datastream if (tag == 0x03d && strstr(make,"NIKON") && len == 4) - FORC4 cblack[c ^ c >> 1] = get2(); + { + FORC4 cblack[c ^ c >> 1] = get2(); + i = cblack[3]; + FORC3 if(i>cblack[c]) i = cblack[c]; + FORC4 cblack[c]-=i; + black += i; + } +#endif if (tag == 0xe01) { /* Nikon Capture Note */ +#ifdef LIBRAW_LIBRARY_BUILD + int loopc = 0; +#endif order = 0x4949; fseek (ifp, 22, SEEK_CUR); for (offset=22; offset+22 < len; offset += 22+i) { +#ifdef LIBRAW_LIBRARY_BUILD + if(loopc++>1024) + throw LIBRAW_EXCEPTION_IO_CORRUPT; +#endif tag = get4(); fseek (ifp, 14, SEEK_CUR); i = get4()-4; @@ -5083,7 +8417,7 @@ } if ((tag == 0x1011 && len == 9) || tag == 0x20400200) { - if(!strcasecmp(make,"Olympus")) + if(!strncasecmp(make,"Olympus", 7)) { int j,k; for (i=0; i < 3; i++) @@ -5109,26 +8443,37 @@ cam_mul[0] = get2() / 256.0; cam_mul[2] = get2() / 256.0; } - if ((tag | 0x70) == 0x2070 && type == 4) + if ((tag | 0x70) == 0x2070 && (type == 4 || type == 13)) fseek (ifp, get4()+base, SEEK_SET); - if (tag == 0x2020) + if ((tag == 0x2020) && ((type == 7) || (type == 13))) parse_thumb_note (base, 257, 258); if (tag == 0x2040) parse_makernote (base, 0x2040); +#ifdef LIBRAW_LIBRARY_BUILD +// IB start + if (tag == 0x2010) + { + INT64 _pos3 = ftell(ifp); + parse_makernote(base, 0x2010); + fseek(ifp,_pos3,SEEK_SET); + } +// IB end +#endif if (tag == 0xb028) { fseek (ifp, get4()+base, SEEK_SET); parse_thumb_note (base, 136, 137); } - if (tag == 0x4001 && len > 500) { + if (tag == 0x4001 && len > 500 && len < 100000) { i = len == 582 ? 50 : len == 653 ? 68 : len == 5120 ? 142 : 126; fseek (ifp, i, SEEK_CUR); -get2_rggb: FORC4 cam_mul[c ^ (c >> 1)] = get2(); - i = len >> 3 == 164 ? 112:22; - fseek (ifp, i, SEEK_CUR); - FORC4 sraw_mul[c ^ (c >> 1)] = get2(); + for (i+=18; i <= len; i+=10) { + get2(); + FORC4 sraw_mul[c ^ (c >> 1)] = get2(); + if (sraw_mul[1] == 1170) break; + } } - if(!strcasecmp(make,"Samsung")) + if(!strncasecmp(make,"Samsung",7)) { if (tag == 0xa020) // get the full Samsung encryption key for (i=0; i<11; i++) SamsungKey[i] = get4(); @@ -5148,6 +8493,8 @@ if (tag == 0xa028) FORC4 cam_mul[c ^ (c >> 1)] -= get4(); } + if (tag == 0x4021 && get4() && get4()) + FORC4 cam_mul[c] = 1024; next: fseek (ifp, save, SEEK_SET); } @@ -5184,23 +8531,69 @@ void CLASS parse_exif (int base) { unsigned kodak, entries, tag, type, len, save, c; - double expo; + double expo,ape; kodak = !strncmp(make,"EASTMAN",7) && tiff_nifds < 3; entries = get2(); + if(!strncmp(make,"Hasselblad",10) && (tiff_nifds > 3) && (entries > 512)) return; while (entries--) { tiff_get (base, &tag, &type, &len, &save); + +#ifdef LIBRAW_LIBRARY_BUILD + if(callbacks.exif_cb) + { + int savepos = ftell(ifp); + callbacks.exif_cb(callbacks.exifparser_data,tag,type,len,order,ifp); + fseek(ifp,savepos,SEEK_SET); + } +#endif switch (tag) { +#ifdef LIBRAW_LIBRARY_BUILD + case 0xa405: // FocalLengthIn35mmFormat + imgdata.lens.FocalLengthIn35mmFormat = get2(); + break; + case 0xa432: // LensInfo, 42034dec, Lens Specification per EXIF standard + imgdata.lens.MinFocal = getreal(type); + imgdata.lens.MaxFocal = getreal(type); + imgdata.lens.MaxAp4MinFocal = getreal(type); + imgdata.lens.MaxAp4MaxFocal = getreal(type); + break; + case 0xc630: // DNG LensInfo, Lens Specification per EXIF standard + imgdata.lens.dng.MinFocal = getreal(type); + imgdata.lens.dng.MaxFocal = getreal(type); + imgdata.lens.dng.MaxAp4MinFocal = getreal(type); + imgdata.lens.dng.MaxAp4MaxFocal = getreal(type); + break; + case 0xa433: // LensMake + fread(imgdata.lens.LensMake, MIN(len,sizeof(imgdata.lens.LensMake)), 1, ifp); + break; + case 0xa434: // LensModel + fread(imgdata.lens.Lens, MIN(len, sizeof(imgdata.lens.LensMake)), 1, ifp); + if (!strncmp(imgdata.lens.Lens, "----", 4)) + imgdata.lens.Lens[0] = 0; + break; + case 0x9205: + imgdata.lens.EXIF_MaxAp = powf64(2.0f, (getreal(type) / 2.0f)); + break; +#endif case 33434: shutter = getreal(type); break; - case 33437: aperture = getreal(type); break; + case 33437: aperture = getreal(type); break; // 0x829d FNumber case 34855: iso_speed = get2(); break; + case 34866: + if (iso_speed == 0xffff && (!strncasecmp(make, "SONY",4) || !strncasecmp(make, "CANON",5))) + iso_speed = getreal(type); + break; case 36867: case 36868: get_timestamp(0); break; - case 37377: if ((expo = -getreal(type)) < 128) - shutter = pow (2.0, expo); break; - case 37378: aperture = pow (2.0, getreal(type)/2); break; + case 37377: if ((expo = -getreal(type)) < 128 && shutter == 0.) + shutter = powf64(2.0, expo); break; + case 37378: // 0x9202 ApertureValue + if ((fabs(ape = getreal(type))<256.0) && (!aperture)) + aperture = powf64(2.0, ape/2); + break; + case 37385: flash_used = getreal(type); break; case 37386: focal_len = getreal(type); break; - case 37500: parse_makernote (base, 0); break; + case 37500: parse_makernote (base, 0); break; // tag 0x927c case 40962: if (kodak) raw_width = get4(); break; case 40963: if (kodak) raw_height = get4(); break; case 41730: @@ -5212,6 +8605,45 @@ } } +#ifdef LIBRAW_LIBRARY_BUILD + +void CLASS parse_gps_libraw(int base) +{ + unsigned entries, tag, type, len, save, c; + + entries = get2(); + if (entries > 200) + return; + if (entries > 0) + imgdata.other.parsed_gps.gpsparsed = 1; + while (entries--) { + tiff_get(base, &tag, &type, &len, &save); + switch (tag) { + case 1: imgdata.other.parsed_gps.latref = getc(ifp); break; + case 3: imgdata.other.parsed_gps.longref = getc(ifp); break; + case 5: imgdata.other.parsed_gps.altref = getc(ifp); break; + case 2: + if (len == 3) + FORC(3) imgdata.other.parsed_gps.latitude[c] = getreal(type); + break; + case 4: + if (len == 3) + FORC(3) imgdata.other.parsed_gps.longtitude[c] = getreal(type); + break; + case 7: + if (len == 3) + FORC(3) imgdata.other.parsed_gps.gpstimestamp[c] = getreal(type); + break; + case 6: + imgdata.other.parsed_gps.altitude = getreal(type); + break; + case 9: imgdata.other.parsed_gps.gpsstatus = getc(ifp); break; + } + fseek(ifp, save, SEEK_SET); + } +} +#endif + void CLASS parse_gps (int base) { unsigned entries, tag, type, len, save, c; @@ -5245,6 +8677,9 @@ for (j=0; j < 3; j++) for (cmatrix[i][j] = k=0; k < 3; k++) cmatrix[i][j] += rgb_romm[i][k] * romm_cam[k][j]; +#ifdef LIBRAW_LIBRARY_BUILD + imgdata.color.digitalBack_color=1; +#endif } void CLASS parse_mos (int offset) @@ -5255,7 +8690,8 @@ { "","DCB2","Volare","Cantare","CMost","Valeo 6","Valeo 11","Valeo 22", "Valeo 11p","Valeo 17","","Aptus 17","Aptus 22","Aptus 75","Aptus 65", "Aptus 54S","Aptus 65S","Aptus 75S","AFi 5","AFi 6","AFi 7", - "","","","","","","","","","","","","","","","","","AFi-II 12" }; + "AFi-II 7","Aptus-II 7","","Aptus-II 6","","","Aptus-II 10","Aptus-II 5", + "","","","","Aptus-II 10R","Aptus-II 8","","Aptus-II 12","","AFi-II 12" }; float romm_cam[3][3]; fseek (ifp, offset, SEEK_SET); @@ -5265,6 +8701,14 @@ fread (data, 1, 40, ifp); skip = get4(); from = ftell(ifp); + +// IB start +#ifdef LIBRAW_LIBRARY_BUILD + if (!strcmp(data,"CameraObj_camera_type")) { + fread(imgdata.lens.makernotes.body, MIN(skip,63), 1, ifp); + } +#endif +// IB end if (!strcmp(data,"JPEG_preview_data")) { thumb_offset = from; thumb_length = skip; @@ -5280,12 +8724,12 @@ } if (!strcmp(data,"icc_camera_to_tone_matrix")) { for (i=0; i < 9; i++) - romm_cam[0][i] = int_to_float(get4()); + ((float *)romm_cam)[i] = int_to_float(get4()); romm_coeff (romm_cam); } if (!strcmp(data,"CaptProf_color_matrix")) { for (i=0; i < 9; i++) - fscanf (ifp, "%f", &romm_cam[0][i]); + fscanf (ifp, "%f", (float *)romm_cam + i); romm_coeff (romm_cam); } if (!strcmp(data,"CaptProf_number_of_planes")) @@ -5318,13 +8762,58 @@ void CLASS linear_table (unsigned len) { int i; - if (len > 0x1000) len = 0x1000; + if (len > 0x10000) len = 0x10000; read_shorts (curve, len); - for (i=len; i < 0x1000; i++) + for (i=len; i < 0x10000; i++) curve[i] = curve[i-1]; - maximum = curve[0xfff]; + maximum = curve[len<0x1000?0xfff:len-1]; } +#ifdef LIBRAW_LIBRARY_BUILD +/* Thanks to Alexey Danilchenko for wb as-shot parsing code */ +void CLASS parse_kodak_ifd (int base) +{ + unsigned entries, tag, type, len, save; + int i, c, wbi=-2; + float mul[3]={1,1,1}, num; + static const int wbtag[] = { 64037,64040,64039,64041,-1,-1,64042 }; + + entries = get2(); + if (entries > 1024) return; + while (entries--) { + tiff_get (base, &tag, &type, &len, &save); +#ifdef LIBRAW_LIBRARY_BUILD + if(callbacks.exif_cb) + { + int savepos = ftell(ifp); + callbacks.exif_cb(callbacks.exifparser_data,tag | 0x20000,type,len,order,ifp); + fseek(ifp,savepos,SEEK_SET); + } +#endif + if (tag == 1020) wbi = getint(type); + if (tag == 1021 && len == 72) { /* WB set in software */ + fseek (ifp, 40, SEEK_CUR); + FORC3 cam_mul[c] = 2048.0 / get2(); + wbi = -2; + } + if (tag == 2120 + wbi || + (wbi<0 && tag == 2125)) /* use Auto WB if illuminant index is not set */ + { + FORC3 mul[c] = (num=getreal(type))==0 ? 1 : num; + FORC3 cam_mul[c] = mul[1] / mul[c]; /* normalise against green */ + } + if (tag == 2317) linear_table (len); + if (tag == 0x903) iso_speed = getreal(type); + //if (tag == 6020) iso_speed = getint(type); + if (tag == 64013) wbi = fgetc(ifp); + if ((unsigned) wbi < 7 && tag == wbtag[wbi]) + FORC3 cam_mul[c] = get4(); + if (tag == 64019) width = getint(type); + if (tag == 64020) height = (getint(type)+1) & -2; + fseek (ifp, save, SEEK_SET); + } +} +#else void CLASS parse_kodak_ifd (int base) { unsigned entries, tag, type, len, save; @@ -5343,6 +8832,8 @@ wbi = -2; } if (tag == 2118) wbtemp = getint(type); + if (tag == 2120 + wbi && wbi >= 0) + FORC3 cam_mul[c] = 2048.0 / getreal(type); if (tag == 2130 + wbi) FORC3 mul[c] = getreal(type); if (tag == 2140 + wbi && wbi >= 0) @@ -5361,19 +8852,19 @@ fseek (ifp, save, SEEK_SET); } } -#line 6536 "dcraw/dcraw.c" +#endif int CLASS parse_tiff_ifd (int base) { unsigned entries, tag, type, len, plen=16, save; int ifd, use_cm=0, cfa, i, j, c, ima_len=0; - int blrr=1, blrc=1, dblack[] = { 0,0,0,0 }; - char software[64], *cbuf, *cp; + char *cbuf, *cp; uchar cfa_pat[16], cfa_pc[] = { 0,1,2,3 }, tab[256]; double cc[4][4], cm[4][3], cam_xyz[4][3], num; double ab[]={ 1,1,1,1 }, asn[] = { 0,0,0,0 }, xyz[] = { 1,1,1 }; unsigned sony_curve[] = { 0,0,0,0,0,4095 }; unsigned *buf, sony_offset=0, sony_length=0, sony_key=0; struct jhead jh; + int pana_raw = 0; #ifndef LIBRAW_LIBRARY_BUILD FILE *sfp; #endif @@ -5388,11 +8879,33 @@ if (entries > 512) return 1; while (entries--) { tiff_get (base, &tag, &type, &len, &save); + +#ifdef LIBRAW_LIBRARY_BUILD + if(callbacks.exif_cb) + { + int savepos = ftell(ifp); + callbacks.exif_cb(callbacks.exifparser_data,tag|(pana_raw?0x30000:0),type,len,order,ifp); + fseek(ifp,savepos,SEEK_SET); + } +#endif switch (tag) { + case 1: if(len==4) pana_raw = get4(); break; case 5: width = get2(); break; case 6: height = get2(); break; case 7: width += get2(); break; - case 9: if ((i = get2())) filters = i; break; + case 9: if ((i = get2())) filters = i; +#ifdef LIBRAW_LIBRARY_BUILD + if(pana_raw && len == 1 && type ==3) + pana_black[3]+=i; +#endif + break; + case 8: + case 10: +#ifdef LIBRAW_LIBRARY_BUILD + if(pana_raw && len == 1 && type ==3) + pana_black[3]+=get2(); +#endif + break; case 17: case 18: if (type == 3 && len == 1) cam_mul[(tag-17)*2] = get2() / 256.0; @@ -5400,8 +8913,21 @@ case 23: if (type == 3) iso_speed = get2(); break; + case 28: case 29: case 30: +#ifdef LIBRAW_LIBRARY_BUILD + if(pana_raw && len == 1 && type ==3) + { + pana_black[tag-28] = get2(); + } + else +#endif + { + cblack[tag-28] = get2(); + cblack[3] = cblack[1]; + } + break; case 36: case 37: case 38: - cam_mul[tag-0x24] = get2(); + cam_mul[tag-36] = get2(); break; case 39: if (len < 50 || cam_mul[0]) break; @@ -5414,6 +8940,7 @@ thumb_length = len; break; case 61440: /* Fuji HS10 table */ + fseek (ifp, get4()+base, SEEK_SET); parse_tiff_ifd (base); break; case 2: case 256: case 61441: /* ImageWidth */ @@ -5466,6 +8993,10 @@ tiff_ifd[ifd].samples = jh.clrs; if (!(jh.sraw || (jh.clrs & 1))) tiff_ifd[ifd].t_width *= jh.clrs; + if ((tiff_ifd[ifd].t_width > 4*tiff_ifd[ifd].t_height) & ~jh.clrs) { + tiff_ifd[ifd].t_width /= 2; + tiff_ifd[ifd].t_height *= 2; + } i = order; parse_tiff (tiff_ifd[ifd].offset + 12); order = i; @@ -5492,7 +9023,6 @@ !strncmp(software,"dcraw",5) || !strncmp(software,"UFRaw",5) || !strncmp(software,"Bibble",6) || - !strncmp(software,"Nikon Scan",10) || !strcmp (software,"Digital Photo Professional")) is_raw = 0; break; @@ -5510,6 +9040,8 @@ break; case 324: /* TileOffsets */ tiff_ifd[ifd].offset = len > 1 ? ftell(ifp) : get4(); + if (len == 1) + tiff_ifd[ifd].t_tile_width = tiff_ifd[ifd].t_tile_length = 0; if (len == 4) { load_raw = &CLASS sinar_4shot_load_raw; is_raw = 5; @@ -5521,6 +9053,14 @@ data_offset = get4()+base; ifd++; break; } +#ifdef LIBRAW_LIBRARY_BUILD + if (!strncmp(make,"Hasselblad",10) && libraw_internal_data.unpacker_data.hasselblad_parser_flag) { + fseek (ifp, ftell(ifp)+4, SEEK_SET); + fseek (ifp, get4()+base, SEEK_SET); + parse_tiff_ifd (base); + break; + } +#endif if(len > 1000) len=1000; /* 1000 SubIFDs is enough */ while (len--) { i = ftell(ifp); @@ -5533,6 +9073,16 @@ strcpy (make, "Sarnoff"); maximum = 0xfff; break; +#ifdef LIBRAW_LIBRARY_BUILD + case 700: + if((type == 1 || type == 2 || type == 6 || type == 7) && len > 1 && len < 5100000) + { + xmpdata = (char*)malloc(xmplen = len+1); + fread(xmpdata,len,1,ifp); + xmpdata[len]=0; + } + break; +#endif case 28688: FORC4 sony_curve[c+1] = get2() >> 2 & 0xfff; for (i=0; i < 5; i++) @@ -5561,8 +9111,8 @@ if (verbose) fprintf (stderr, _(" Sony matrix:\n%f %f %f\n%f %f %f\n%f %f %f\n"), cmatrix[0][0], cmatrix[0][1], cmatrix[0][2], cmatrix[1][0], cmatrix[1][1], cmatrix[1][2], cmatrix[2][0], cmatrix[2][1], cmatrix[2][2]); #endif break; - case 29456: // Sony black level, Sony_SR2SubIFD_0x7310, needs to be divided by 4 - FORC4 cblack[c ^ c >> 1] = get2()/4; + case 29456: // Sony black level, Sony_SR2SubIFD_0x7310, no more needs to be divided by 4 + FORC4 cblack[c ^ c >> 1] = get2(); i = cblack[3]; FORC3 if(i>cblack[c]) i = cblack[c]; FORC4 cblack[c]-=i; @@ -5574,9 +9124,23 @@ case 33405: /* Model2 */ fgets (model2, 64, ifp); break; + case 33421: /* CFARepeatPatternDim */ + if (get2() == 6 && get2() == 6) + filters = 9; + break; case 33422: /* CFAPattern */ + if (filters == 9) { + FORC(36) ((char *)xtrans)[c] = fgetc(ifp) & 3; + break; + } case 64777: /* Kodak P-series */ - if(len > 0) + if(len == 36) + { + filters = 9; + colors = 3; + FORC(36) xtrans[0][c] = fgetc(ifp) & 3; + } + else if(len > 0) { if ((plen=len) > 16) plen = 16; fread (cfa_pat, 1, plen, ifp); @@ -5588,8 +9152,7 @@ if (cfa == 072) memcpy (cfa_pc,"\005\003\004\001",4); /* GMCY */ goto guess_cfa_pc; } - else - break; + break; case 33424: case 65024: fseek (ifp, get4()+base, SEEK_SET); @@ -5601,6 +9164,36 @@ case 33437: /* FNumber */ aperture = getreal(type); break; +#ifdef LIBRAW_LIBRARY_BUILD +// IB start + case 0xa405: // FocalLengthIn35mmFormat + imgdata.lens.FocalLengthIn35mmFormat = get2(); + break; + case 0xa432: // LensInfo, 42034dec, Lens Specification per EXIF standard + imgdata.lens.MinFocal = getreal(type); + imgdata.lens.MaxFocal = getreal(type); + imgdata.lens.MaxAp4MinFocal = getreal(type); + imgdata.lens.MaxAp4MaxFocal = getreal(type); + break; + case 0xc630: // DNG LensInfo, Lens Specification per EXIF standard + imgdata.lens.MinFocal = getreal(type); + imgdata.lens.MaxFocal = getreal(type); + imgdata.lens.MaxAp4MinFocal = getreal(type); + imgdata.lens.MaxAp4MaxFocal = getreal(type); + break; + case 0xa433: // LensMake + fread(imgdata.lens.LensMake, MIN(len, sizeof(imgdata.lens.LensMake)), 1, ifp); + break; + case 0xa434: // LensModel + fread(imgdata.lens.Lens, MIN(len, sizeof(imgdata.lens.Lens)), 1, ifp); + if (!strncmp(imgdata.lens.Lens, "----", 4)) + imgdata.lens.Lens[0] = 0; + break; + case 0x9205: + imgdata.lens.EXIF_MaxAp = powf64(2.0f, (getreal(type) / 2.0f)); + break; +// IB end +#endif case 34306: /* Leaf white balance */ FORC4 cam_mul[c ^ 1] = 4096.0 / get2(); break; @@ -5626,8 +9219,15 @@ parse_exif (base); break; case 34853: /* GPSInfo tag */ - fseek (ifp, get4()+base, SEEK_SET); - parse_gps (base); + { + unsigned pos; + fseek(ifp, pos = (get4() + base), SEEK_SET); + parse_gps(base); +#ifdef LIBRAW_LIBRARY_BUILD + fseek(ifp, pos, SEEK_SET); + parse_gps_libraw(base); +#endif + } break; case 34675: /* InterColorProfile */ case 50831: /* AsShotICCProfile */ @@ -5651,7 +9251,11 @@ break; case 40976: strip_offset = get4(); - load_raw = &CLASS samsung_load_raw; + switch (tiff_ifd[ifd].comp) { + case 32770: load_raw = &CLASS samsung_load_raw; break; + case 32772: load_raw = &CLASS samsung2_load_raw; break; + case 32773: load_raw = &CLASS samsung3_load_raw; break; + } break; case 46275: /* Imacon tags */ strcpy (make, "Imacon"); @@ -5700,7 +9304,12 @@ case 50454: /* Sinar tag */ case 50455: if (!(cbuf = (char *) malloc(len))) break; +#ifndef LIBRAW_LIBRARY_BUILD fread (cbuf, 1, len, ifp); +#else + if(fread (cbuf, 1, len, ifp) != len) + throw LIBRAW_EXCEPTION_IO_CORRUPT; // cbuf to be free'ed in recycle +#endif for (cp = cbuf-1; cp && cp < cbuf+len; cp = strchr(cp,'\n')) if (!strncmp (++cp,"Neutral ",8)) sscanf (cp+8, "%f %f %f", cam_mul, cam_mul+1, cam_mul+2); @@ -5710,6 +9319,9 @@ if (!make[0]) strcpy (make, "Hasselblad"); break; case 50459: /* Hasselblad tag */ +#ifdef LIBRAW_LIBRARY_BUILD + libraw_internal_data.unpacker_data.hasselblad_parser_flag=1; +#endif i = order; j = ftell(ifp); c = tiff_nifds; @@ -5725,45 +9337,52 @@ if (!make[0]) strcpy (make, "DNG"); is_raw = 1; break; + case 50708: /* UniqueCameraModel */ + if (model[0]) break; + fgets (make, 64, ifp); + if ((cp = strchr(make,' '))) { + strcpy(model,cp+1); + *cp = 0; + } + break; case 50710: /* CFAPlaneColor */ + if (filters == 9) break; if (len > 4) len = 4; colors = len; fread (cfa_pc, 1, colors, ifp); guess_cfa_pc: - FORCC tab[cfa_pc[c]] = c; - cdesc[c] = 0; - for (i=16; i--; ) - filters = filters << 2 | tab[cfa_pat[i % plen]]; - filters -= !filters; + FORCC tab[cfa_pc[c]] = c; + cdesc[c] = 0; + for (i=16; i--; ) + filters = filters << 2 | tab[cfa_pat[i % plen]]; + filters -= !filters; break; case 50711: /* CFALayout */ - if (get2() == 2) { - fuji_width = 1; - filters = 0x49494949; - } + if (get2() == 2) fuji_width = 1; break; case 291: case 50712: /* LinearizationTable */ linear_table (len); break; case 50713: /* BlackLevelRepeatDim */ - blrr = get2(); - blrc = get2(); + cblack[4] = get2(); + cblack[5] = get2(); + if (cblack[4] * cblack[5] > (sizeof(cblack) / sizeof (cblack[0]) - 6)) + cblack[4] = cblack[5] = 1; break; case 61450: - blrr = blrc = 2; + cblack[4] = cblack[5] = MIN(sqrt((double)len),64); case 50714: /* BlackLevel */ - black = getreal(type); - if ((unsigned)(filters+1) < 1000) break; - dblack[0] = black; - dblack[1] = (blrc == 2) ? getreal(type):dblack[0]; - dblack[2] = (blrr == 2) ? getreal(type):dblack[0]; - dblack[3] = (blrc == 2 && blrr == 2) ? getreal(type):dblack[1]; - if (colors == 3) - filters |= ((filters >> 2 & 0x22222222) | - (filters << 2 & 0x88888888)) & filters << 1; - FORC4 cblack[filters >> (c << 1) & 3] = dblack[c]; - black = 0; + if((cblack[4] * cblack[5] < 2) && len == 1) + { + black = getreal(type); + } + else if(cblack[4] * cblack[5] <= len) + { + FORC (cblack[4] * cblack[5]) + cblack[6+c] = getreal(type); + black = 0; + } break; case 50715: /* BlackLevelDeltaH */ case 50716: /* BlackLevelDeltaV */ @@ -5777,17 +9396,44 @@ case 50718: /* DefaultScale */ pixel_aspect = getreal(type); pixel_aspect /= getreal(type); + if(pixel_aspect > 0.995 && pixel_aspect < 1.005) + pixel_aspect = 1.0; break; +#ifdef LIBRAW_LIBRARY_BUILD + case 50778: + imgdata.color.dng_color[0].illuminant = get2(); + break; + case 50779: + imgdata.color.dng_color[1].illuminant = get2(); + break; +#endif case 50721: /* ColorMatrix1 */ case 50722: /* ColorMatrix2 */ +#ifdef LIBRAW_LIBRARY_BUILD + i = tag == 50721?0:1; +#endif FORCC for (j=0; j < 3; j++) + { +#ifdef LIBRAW_LIBRARY_BUILD + imgdata.color.dng_color[i].colormatrix[c][j]= +#endif cm[c][j] = getreal(type); + } use_cm = 1; break; case 50723: /* CameraCalibration1 */ case 50724: /* CameraCalibration2 */ +#ifdef LIBRAW_LIBRARY_BUILD + j = tag == 50723?0:1; +#endif for (i=0; i < colors; i++) - FORCC cc[i][c] = getreal(type); + FORCC + { +#ifdef LIBRAW_LIBRARY_BUILD + imgdata.color.dng_color[j].calibration[i][c]= +#endif + cc[i][c] = getreal(type); + } break; case 50727: /* AnalogBalance */ FORCC ab[c] = getreal(type); @@ -5801,39 +9447,91 @@ xyz[2] = 1 - xyz[0] - xyz[1]; FORC3 xyz[c] /= d65_white[c]; break; - case 50740: /* DNGPrivateData */ - if (dng_version) break; - parse_minolta (j = get4()+base); - fseek (ifp, j, SEEK_SET); - parse_tiff_ifd (base); - break; - case 50752: - read_shorts (cr2_slice, 3); - break; - case 50829: /* ActiveArea */ - top_margin = getint(type); - left_margin = getint(type); - height = getint(type) - top_margin; - width = getint(type) - left_margin; - break; - case 50830: /* MaskedAreas */ - for (i=0; i < len && i < 32; i++) - mask[0][i] = getint(type); - black = 0; - break; - case 51009: /* OpcodeList2 */ - meta_offset = ftell(ifp); - break; - case 64772: /* Kodak P-series */ - if (len < 13) break; - fseek (ifp, 16, SEEK_CUR); - data_offset = get4(); - fseek (ifp, 28, SEEK_CUR); - data_offset += get4(); - load_raw = &CLASS packed_load_raw; - break; - case 65026: - if (type == 2) fgets (model2, 64, ifp); +#ifdef LIBRAW_LIBRARY_BUILD + case 50730: /* DNG: Baseline Exposure */ + baseline_exposure = getreal(type); + break; +#endif + // IB start + case 50740: /* tag 0xc634 : DNG Adobe, DNG Pentax, Sony SR2, DNG Private */ +#ifdef LIBRAW_LIBRARY_BUILD + { + char mbuf[64]; + unsigned short makernote_found = 0; + INT64 curr_pos, start_pos = ftell(ifp); + unsigned MakN_order, m_sorder = order; + unsigned MakN_length; + unsigned pos_in_original_raw; + fread(mbuf, 1, 6, ifp); + + if (!strcmp(mbuf, "Adobe")) + { + order = 0x4d4d; // Adobe header is always in "MM" / big endian + curr_pos = start_pos + 6; + while (curr_pos + 8 - start_pos <= len) + { + fread(mbuf, 1, 4, ifp); + curr_pos += 8; + if (!strncmp(mbuf, "MakN", 4)) { + makernote_found = 1; + MakN_length = get4(); + MakN_order = get2(); + pos_in_original_raw = get4(); + order = MakN_order; + parse_makernote_0xc634(curr_pos + 6 - pos_in_original_raw, 0, AdobeDNG); + break; + } + } + } + else + { + fread(mbuf + 6, 1, 2, ifp); + if (!strcmp(mbuf, "PENTAX ") || + !strcmp(mbuf, "SAMSUNG")) + { + makernote_found = 1; + fseek(ifp, start_pos, SEEK_SET); + parse_makernote_0xc634(base, 0, CameraDNG); + } + } + + fseek(ifp, start_pos, SEEK_SET); + order = m_sorder; + } + // IB end +#endif + if (dng_version) break; + parse_minolta (j = get4()+base); + fseek (ifp, j, SEEK_SET); + parse_tiff_ifd (base); + break; + case 50752: + read_shorts (cr2_slice, 3); + break; + case 50829: /* ActiveArea */ + top_margin = getint(type); + left_margin = getint(type); + height = getint(type) - top_margin; + width = getint(type) - left_margin; + break; + case 50830: /* MaskedAreas */ + for (i=0; i < len && i < 32; i++) + ((int*)mask)[i] = getint(type); + black = 0; + break; + case 51009: /* OpcodeList2 */ + meta_offset = ftell(ifp); + break; + case 64772: /* Kodak P-series */ + if (len < 13) break; + fseek (ifp, 16, SEEK_CUR); + data_offset = get4(); + fseek (ifp, 28, SEEK_CUR); + data_offset += get4(); + load_raw = &CLASS packed_load_raw; + break; + case 65026: + if (type == 2) fgets (model2, 64, ifp); } fseek (ifp, save, SEEK_SET); } @@ -5865,7 +9563,7 @@ FORCC for (i=0; i < 3; i++) for (cam_xyz[c][i]=j=0; j < colors; j++) cam_xyz[c][i] += cc[c][j] * cm[j][i] * xyz[i]; - cam_xyz_coeff (cam_xyz); + cam_xyz_coeff (cmatrix, cam_xyz); } if (asn[0]) { cam_mul[3] = 0; @@ -5879,7 +9577,6 @@ int CLASS parse_tiff (int base) { int doff; - fseek (ifp, base, SEEK_SET); order = get2(); if (order != 0x4949 && order != 0x4d4d) return 0; @@ -5949,6 +9646,15 @@ case 32770: case 32773: goto slr; case 0: case 1: +#ifdef LIBRAW_LIBRARY_BUILD + if(!strncasecmp(make,"Nikon",5) && !strncmp(software,"Nikon Scan",10)) + { + load_raw = &CLASS nikon_coolscan_load_raw; + raw_color = 1; + filters = 0; + break; + } +#endif if (!strncmp(make,"OLYMPUS",7) && tiff_ifd[raw].bytes*2 == raw_width*raw_height*3) load_flags = 24; @@ -5976,12 +9682,28 @@ if ((raw_width+9)/10*16*raw_height == tiff_ifd[raw].bytes) { load_raw = &CLASS packed_load_raw; load_flags = 1; + } else if (raw_width*raw_height*3 == tiff_ifd[raw].bytes*2) { + load_raw = &CLASS packed_load_raw; + if (model[0] == 'N') load_flags = 80; + } else if (raw_width*raw_height*3 == tiff_ifd[raw].bytes) { + load_raw = &CLASS nikon_yuv_load_raw; + gamma_curve (1/2.4, 12.92, 1, 4095); + memset (cblack, 0, sizeof cblack); + filters = 0; } else if (raw_width*raw_height*2 == tiff_ifd[raw].bytes) { load_raw = &CLASS unpacked_load_raw; load_flags = 4; order = 0x4d4d; } else - load_raw = &CLASS nikon_load_raw; break; +#ifdef LIBRAW_LIBRARY_BUILD + if(raw_width*raw_height*3 == tiff_ifd[raw].bytes*2) + { + load_raw = &CLASS packed_load_raw; + load_flags=80; + } + else +#endif + load_raw = &CLASS nikon_load_raw; break; case 65535: load_raw = &CLASS pentax_load_raw; break; case 65000: @@ -5994,10 +9716,11 @@ default: is_raw = 0; } if (!dng_version) - if ( (tiff_samples == 3 && tiff_ifd[raw].bytes && tiff_bps != 14 && - tiff_compress != 32769 && tiff_compress != 32770) - || (tiff_bps == 8 && !strcasestr(make,"Kodak") && + if ( ((tiff_samples == 3 && tiff_ifd[raw].bytes && tiff_bps != 14 && + (tiff_compress & -16) != 32768) + || (tiff_bps == 8 && !strcasestr(make,"Kodak") && !strstr(model2,"DEBUG RAW"))) + && strncmp(software,"Nikon Scan",10)) is_raw = 0; for (i=0; i < tiff_nifds; i++) if (i != raw && tiff_ifd[i].samples == max_samp && @@ -6022,7 +9745,7 @@ case 1: if (tiff_ifd[thm].bps <= 8) write_thumb = &CLASS ppm_thumb; - else if (!strcmp(make,"Imacon")) + else if (!strncmp(make,"Imacon",6)) write_thumb = &CLASS ppm16_thumb; else thumb_load_raw = &CLASS kodak_thumb_load_raw; @@ -6148,7 +9871,7 @@ } } #else - if (strcmp (jname, ifname)) + if (strcmp (jname, ifname)) { if(!ifp->subfile_open(jname)) { @@ -6195,15 +9918,14 @@ bitbuf = bitbuf << 16 | (get2() ^ key[i++ & 1]); vbits += 16; } - white[row][col] = - bitbuf << (LONG_BIT - vbits) >> (LONG_BIT - bpp); - vbits -= bpp; + white[row][col] = bitbuf >> (vbits -= bpp) & ~(-1 << bpp); } } /* Parse a CIFF file, better known as Canon CRW format. */ + void CLASS parse_ciff (int offset, int length, int depth) { int tboff, nrecs, c, type, len, save, wbi=-1; @@ -6219,8 +9941,9 @@ len = get4(); save = ftell(ifp) + 4; fseek (ifp, offset+get4(), SEEK_SET); - if ((((type >> 8) + 8) | 8) == 0x38) + if ((((type >> 8) + 8) | 8) == 0x38) { parse_ciff (ftell(ifp), len, depth+1); /* Parse a sub-table */ + } if (type == 0x0810) fread (artist, 64, 1, ifp); if (type == 0x080a) { @@ -6241,13 +9964,22 @@ thumb_length = len; } if (type == 0x1818) { - shutter = pow (2.0f, -int_to_float((get4(),get4()))); - aperture = pow (2.0f, int_to_float(get4())/2); + shutter = powf64(2.0f, -int_to_float((get4(),get4()))); + aperture = powf64(2.0f, int_to_float(get4())/2); +#ifdef LIBRAW_LIBRARY_BUILD + imgdata.lens.makernotes.CurAp = aperture; +#endif } if (type == 0x102a) { - iso_speed = pow (2.0, (get4(),get2())/32.0 - 4) * 50; - aperture = pow (2.0, (get2(),(short)get2())/64.0); - shutter = pow (2.0,-((short)get2())/32.0); + // iso_speed = pow (2.0, (get4(),get2())/32.0 - 4) * 50; + iso_speed = powf64(2.0f, ((get2(),get2()) + get2())/32.0f - 5.0f) * 100.0f; +#ifdef LIBRAW_LIBRARY_BUILD + aperture = _CanonConvertAperture((get2(),get2())); + imgdata.lens.makernotes.CurAp = aperture; +#else + aperture = powf64(2.0, (get2(),(short)get2())/64.0); +#endif + shutter = powf64(2.0,-((short)get2())/32.0); wbi = (get2(),get2()); if (wbi > 17) wbi = 0; fseek (ifp, 32, SEEK_CUR); @@ -6262,6 +9994,22 @@ FORC4 cam_mul[c ^ (c >> 1) ^ 1] = get2(); } } +#ifdef LIBRAW_LIBRARY_BUILD + if (type == 0x102d) { + fseek(ifp, 44, SEEK_CUR); + imgdata.lens.makernotes.LensID = get2(); + imgdata.lens.makernotes.MaxFocal = get2(); + imgdata.lens.makernotes.MinFocal = get2(); + imgdata.lens.makernotes.CanonFocalUnits = get2(); + if (imgdata.lens.makernotes.CanonFocalUnits != 1) + { + imgdata.lens.makernotes.MaxFocal /= (float)imgdata.lens.makernotes.CanonFocalUnits; + imgdata.lens.makernotes.MinFocal /= (float)imgdata.lens.makernotes.CanonFocalUnits; + } + imgdata.lens.makernotes.MaxAp = _CanonConvertAperture(get2()); + imgdata.lens.makernotes.MinAp = _CanonConvertAperture(get2()); + } +#endif if (type == 0x0032) { if (len == 768) { /* EOS D30 */ fseek (ifp, 72, SEEK_CUR); @@ -6291,14 +10039,33 @@ raw_width = (get2(),get2()); raw_height = get2(); } + if (type == 0x501c) { + iso_speed = len & 0xffff; + } if (type == 0x5029) { +#ifdef LIBRAW_LIBRARY_BUILD + imgdata.lens.makernotes.CurFocal = len >> 16; + imgdata.lens.makernotes.FocalType = len & 0xffff; + if (imgdata.lens.makernotes.FocalType == 2) { + imgdata.lens.makernotes.CanonFocalUnits = 32; + imgdata.lens.makernotes.CurFocal /= (float)imgdata.lens.makernotes.CanonFocalUnits; + } + focal_len = imgdata.lens.makernotes.CurFocal; +#else focal_len = len >> 16; if ((len & 0xffff) == 2) focal_len /= 32; +#endif } if (type == 0x5813) flash_used = int_to_float(len); if (type == 0x5814) canon_ev = int_to_float(len); if (type == 0x5817) shot_order = len; - if (type == 0x5834) unique_id = len; + if (type == 0x5834) + { + unique_id = len; +#ifdef LIBRAW_LIBRARY_BUILD + setCanonBodyFeatures(unique_id); +#endif + } if (type == 0x580e) timestamp = len; if (type == 0x180e) timestamp = get4(); #ifdef LOCALTIME @@ -6385,6 +10152,11 @@ float romm_cam[3][3]; char *cp; +#ifdef LIBRAW_LIBRARY_BUILD + char body_id[3]; + body_id[0] = 0; +#endif + memset (&ph1, 0, sizeof ph1); fseek (ifp, base, SEEK_SET); order = get4() & 0xffff; @@ -6400,10 +10172,68 @@ save = ftell(ifp); fseek (ifp, base+data, SEEK_SET); switch (tag) { + +#ifdef LIBRAW_LIBRARY_BUILD + case 0x0102: + fread(body_id, 1, 3, ifp); + if ((body_id[0] == 0x4c) && (body_id[1] == 0x49)) { + body_id[1] = body_id[2]; + } + unique_id = (((body_id[0] & 0x3f) << 5) | (body_id[1] & 0x3f)) - 0x41; + setPhaseOneFeatures(unique_id); + break; + case 0x0401: + if (type == 4) imgdata.lens.makernotes.CurAp = powf64(2.0f, (int_to_float(data)/2.0f)); + else imgdata.lens.makernotes.CurAp = powf64(2.0f, (getreal(type)/2.0f)); + break; + case 0x0403: + if (type == 4) imgdata.lens.makernotes.CurFocal = int_to_float(data); + else imgdata.lens.makernotes.CurFocal = getreal(type); + break; + case 0x0410: + fread(imgdata.lens.makernotes.body, 1, len, ifp); + break; + case 0x0412: + fread(imgdata.lens.makernotes.Lens, 1, len, ifp); + break; + case 0x0414: + if (type == 4) { + imgdata.lens.makernotes.MaxAp4CurFocal = powf64(2.0f, (int_to_float(data)/2.0f)); + } else { + imgdata.lens.makernotes.MaxAp4CurFocal = powf64(2.0f, (getreal(type) / 2.0f)); + } + break; + case 0x0415: + if (type == 4) { + imgdata.lens.makernotes.MinAp4CurFocal = powf64(2.0f, (int_to_float(data)/2.0f)); + } else { + imgdata.lens.makernotes.MinAp4CurFocal = powf64(2.0f, (getreal(type) / 2.0f)); + } + break; + case 0x0416: + if (type == 4) { + imgdata.lens.makernotes.MinFocal = int_to_float(data); + } else { + imgdata.lens.makernotes.MinFocal = getreal(type); + } + if (imgdata.lens.makernotes.MinFocal > 1000.0f) + { + imgdata.lens.makernotes.MinFocal = 0.0f; + } + break; + case 0x0417: + if (type == 4) { + imgdata.lens.makernotes.MaxFocal = int_to_float(data); + } else { + imgdata.lens.makernotes.MaxFocal = getreal(type); + } + break; +#endif + case 0x100: flip = "0653"[data & 3]-'0'; break; case 0x106: for (i=0; i < 9; i++) - romm_cam[0][i] = getreal(11); + ((float *)romm_cam)[i] = getreal(11); romm_coeff (romm_cam); break; case 0x107: @@ -6425,7 +10255,9 @@ case 0x21c: strip_offset = data+base; break; case 0x21d: ph1.t_black = data; break; case 0x222: ph1.split_col = data; break; - case 0x223: ph1.black_off = data+base; break; + case 0x223: ph1.black_col = data+base; break; + case 0x224: ph1.split_row = data; break; + case 0x225: ph1.black_row = data+base; break; case 0x301: model[63] = 0; fread (model, 1, 63, ifp); @@ -6433,6 +10265,33 @@ } fseek (ifp, save, SEEK_SET); } + +#ifdef LIBRAW_LIBRARY_BUILD + if (!imgdata.lens.makernotes.body[0] && !body_id[0]) { + fseek (ifp, meta_offset, SEEK_SET); + order = get2(); + fseek (ifp, 6, SEEK_CUR); + fseek (ifp, meta_offset+get4(), SEEK_SET); + entries = get4(); get4(); + while (entries--) { + tag = get4(); + len = get4(); + data = get4(); + save = ftell(ifp); + fseek (ifp, meta_offset+data, SEEK_SET); + if (tag == 0x0407) { + fread(body_id, 1, 3, ifp); + if ((body_id[0] == 0x4c) && (body_id[1] == 0x49)) { + body_id[1] = body_id[2]; + } + unique_id = (((body_id[0] & 0x3f) << 5) | (body_id[1] & 0x3f)) - 0x41; + setPhaseOneFeatures(unique_id); + } + fseek (ifp, save, SEEK_SET); + } + } +#endif + load_raw = ph1.format < 3 ? &CLASS phase_one_load_raw : &CLASS phase_one_load_raw_c; maximum = 0xffff; @@ -6457,6 +10316,7 @@ tag = get2(); len = get2(); save = ftell(ifp); + if (tag == 0x100) { raw_height = get2(); raw_width = get2(); @@ -6468,9 +10328,17 @@ fuji_width = !(fgetc(ifp) & 8); } else if (tag == 0x131) { filters = 9; - FORC(36) xtrans[0][35-c] = fgetc(ifp) & 3; + FORC(36) xtrans_abs[0][35-c] = fgetc(ifp) & 3; } else if (tag == 0x2ff0) { FORC4 cam_mul[c ^ 1] = get2(); + +// IB start +#ifdef LIBRAW_LIBRARY_BUILD + } else if (tag == 0x9650) { + imgdata.color.FujiExpoMidPointShift = ((short)get2()) / ((float)get2()); +#endif +// IB end + } else if (tag == 0xc000) { c = order; order = 0x4949; @@ -6488,7 +10356,6 @@ int CLASS parse_jpeg (int offset) { int len, save, hlen, mark; - fseek (ifp, offset, SEEK_SET); if (fgetc(ifp) != 0xff || fgetc(ifp) != 0xd8) return 0; @@ -6504,7 +10371,13 @@ order = get2(); hlen = get4(); if (get4() == 0x48454150) /* "HEAP" */ + { +#ifdef LIBRAW_LIBRARY_BUILD + imgdata.lens.makernotes.CameraMount = LIBRAW_MOUNT_FixedLens; + imgdata.lens.makernotes.LensMount = LIBRAW_MOUNT_FixedLens; +#endif parse_ciff (save+hlen, len-hlen, 0); + } if (parse_tiff (save+6)) apply_tiff(); fseek (ifp, save+len, SEEK_SET); } @@ -6522,14 +10395,11 @@ order = 0x4949; fread (tag, 4, 1, ifp); size = get4(); -#ifdef LIBRAW_LIBRARY_BUILD - if((int)size<0) - throw LIBRAW_EXCEPTION_IO_EOF; -#endif end = ftell(ifp) + size; if (!memcmp(tag,"RIFF",4) || !memcmp(tag,"LIST",4)) { + int maxloop = 1000; get4(); - while (ftell(ifp)+7 < end) + while (ftell(ifp)+7 < end && !feof(ifp) && maxloop--) parse_riff(); } else if (!memcmp(tag,"nctg",4)) { while (ftell(ifp)+7 < end) { @@ -6555,6 +10425,26 @@ fseek (ifp, size, SEEK_CUR); } +void CLASS parse_qt (int end) +{ + unsigned save, size; + char tag[4]; + + order = 0x4d4d; + while (ftell(ifp)+7 < end) { + save = ftell(ifp); + if ((size = get4()) < 8) return; + fread (tag, 4, 1, ifp); + if (!memcmp(tag,"moov",4) || + !memcmp(tag,"udta",4) || + !memcmp(tag,"CNTH",4)) + parse_qt (save+size); + if (!memcmp(tag,"CNDA",4)) + parse_jpeg (ftell(ifp)); + fseek (ifp, save+size, SEEK_SET); + } +} + void CLASS parse_smal (int offset, int fsize) { int ver; @@ -6653,901 +10543,1113 @@ data_offset = get4(); } } -#line 7931 "dcraw/dcraw.c" /* All matrices are from Adobe DNG Converter unless otherwise noted. */ -void CLASS adobe_coeff (const char *t_make, const char *t_model) +void CLASS adobe_coeff (const char *t_make, const char *t_model +#ifdef LIBRAW_LIBRARY_BUILD + ,int internal_only +#endif +) { static const struct { const char *prefix; - short t_black, t_maximum, trans[12]; + int t_black, t_maximum, trans[12]; } table[] = { { "AgfaPhoto DC-833m", 0, 0, /* DJC */ - { 11438,-3762,-1115,-2409,9914,2497,-1227,2295,5300 } }, + { 11438,-3762,-1115,-2409,9914,2497,-1227,2295,5300 } }, { "Apple QuickTake", 0, 0, /* DJC */ - { 21392,-5653,-3353,2406,8010,-415,7166,1427,2078 } }, + { 21392,-5653,-3353,2406,8010,-415,7166,1427,2078 } }, { "Canon EOS D2000", 0, 0, - { 24542,-10860,-3401,-1490,11370,-297,2858,-605,3225 } }, + { 24542,-10860,-3401,-1490,11370,-297,2858,-605,3225 } }, { "Canon EOS D6000", 0, 0, - { 20482,-7172,-3125,-1033,10410,-285,2542,226,3136 } }, + { 20482,-7172,-3125,-1033,10410,-285,2542,226,3136 } }, { "Canon EOS D30", 0, 0, - { 9805,-2689,-1312,-5803,13064,3068,-2438,3075,8775 } }, + { 9805,-2689,-1312,-5803,13064,3068,-2438,3075,8775 } }, { "Canon EOS D60", 0, 0xfa0, { 6188,-1341,-890,-7168,14489,2937,-2640,3228,8483 } }, + { "Canon EOS 5DS", 0, 0x3c96, + { 6250,-711,-808,-5153,12794,2636,-1249,2198,5610 } }, { "Canon EOS 5D Mark III", 0, 0x3c80, - { 6722,-635,-963,-4287,12460,2028,-908,2162,5668 } }, + { 6722,-635,-963,-4287,12460,2028,-908,2162,5668 } }, { "Canon EOS 5D Mark II", 0, 0x3cf0, - { 4716,603,-830,-7798,15474,2480,-1496,1937,6651 } }, + { 4716,603,-830,-7798,15474,2480,-1496,1937,6651 } }, { "Canon EOS 5D", 0, 0xe6c, - { 6347,-479,-972,-8297,15954,2480,-1968,2131,7649 } }, + { 6347,-479,-972,-8297,15954,2480,-1968,2131,7649 } }, { "Canon EOS 6D", 0, 0x3c82, - { 7034,-804,-1014,-4420,12564,2058,-851,1994,5758 } }, + { 8621,-2197,-787,-3150,11358,912,-1161,2400,4836 } }, + { "Canon EOS 7D Mark II", 0, 0x3510, + { 7268,-1082,-969,-4186,11839,2663,-825,2029,5839 } }, { "Canon EOS 7D", 0, 0x3510, - { 6844,-996,-856,-3876,11761,2396,-593,1772,6198 } }, + { 6844,-996,-856,-3876,11761,2396,-593,1772,6198 } }, { "Canon EOS 10D", 0, 0xfa0, - { 8197,-2000,-1118,-6714,14335,2592,-2536,3178,8266 } }, + { 8197,-2000,-1118,-6714,14335,2592,-2536,3178,8266 } }, { "Canon EOS 20Da", 0, 0, - { 14155,-5065,-1382,-6550,14633,2039,-1623,1824,6561 } }, + { 14155,-5065,-1382,-6550,14633,2039,-1623,1824,6561 } }, { "Canon EOS 20D", 0, 0xfff, - { 6599,-537,-891,-8071,15783,2424,-1983,2234,7462 } }, + { 6599,-537,-891,-8071,15783,2424,-1983,2234,7462 } }, { "Canon EOS 30D", 0, 0, - { 6257,-303,-1000,-7880,15621,2396,-1714,1904,7046 } }, + { 6257,-303,-1000,-7880,15621,2396,-1714,1904,7046 } }, { "Canon EOS 40D", 0, 0x3f60, - { 6071,-747,-856,-7653,15365,2441,-2025,2553,7315 } }, + { 6071,-747,-856,-7653,15365,2441,-2025,2553,7315 } }, { "Canon EOS 50D", 0, 0x3d93, - { 4920,616,-593,-6493,13964,2784,-1774,3178,7005 } }, + { 4920,616,-593,-6493,13964,2784,-1774,3178,7005 } }, { "Canon EOS 60D", 0, 0x2ff7, - { 6719,-994,-925,-4408,12426,2211,-887,2129,6051 } }, - { "Canon EOS 70D", 0, 0x3c80, - { 7034,-804,-1014,-4420,12564,2058,-851,1994,5758 } }, + { 6719,-994,-925,-4408,12426,2211,-887,2129,6051 } }, + { "Canon EOS 70D", 0, 0x3bc7, + { 7034,-804,-1014,-4420,12564,2058,-851,1994,5758 } }, { "Canon EOS 100D", 0, 0x350f, - { 6602,-841,-939,-4472,12458,2247,-975,2039,6148 } }, + { 6602,-841,-939,-4472,12458,2247,-975,2039,6148 } }, { "Canon EOS 300D", 0, 0xfa0, - { 8197,-2000,-1118,-6714,14335,2592,-2536,3178,8266 } }, + { 8197,-2000,-1118,-6714,14335,2592,-2536,3178,8266 } }, { "Canon EOS 350D", 0, 0xfff, - { 6018,-617,-965,-8645,15881,2975,-1530,1719,7642 } }, + { 6018,-617,-965,-8645,15881,2975,-1530,1719,7642 } }, { "Canon EOS 400D", 0, 0xe8e, - { 7054,-1501,-990,-8156,15544,2812,-1278,1414,7796 } }, + { 7054,-1501,-990,-8156,15544,2812,-1278,1414,7796 } }, { "Canon EOS 450D", 0, 0x390d, - { 5784,-262,-821,-7539,15064,2672,-1982,2681,7427 } }, + { 5784,-262,-821,-7539,15064,2672,-1982,2681,7427 } }, { "Canon EOS 500D", 0, 0x3479, - { 4763,712,-646,-6821,14399,2640,-1921,3276,6561 } }, + { 4763,712,-646,-6821,14399,2640,-1921,3276,6561 } }, { "Canon EOS 550D", 0, 0x3dd7, - { 6941,-1164,-857,-3825,11597,2534,-416,1540,6039 } }, + { 6941,-1164,-857,-3825,11597,2534,-416,1540,6039 } }, { "Canon EOS 600D", 0, 0x3510, - { 6461,-907,-882,-4300,12184,2378,-819,1944,5931 } }, + { 6461,-907,-882,-4300,12184,2378,-819,1944,5931 } }, { "Canon EOS 650D", 0, 0x354d, - { 6602,-841,-939,-4472,12458,2247,-975,2039,6148 } }, + { 6602,-841,-939,-4472,12458,2247,-975,2039,6148 } }, + { "Canon EOS 750D", 0, 0x3c00, + { 6362,-823,-847,-4426,12109,2616,-743,1857,5635 } }, + { "Canon EOS 760D", 0, 0x3c00, + { 6362,-823,-847,-4426,12109,2616,-743,1857,5635 } }, { "Canon EOS 700D", 0, 0x3c00, - { 6602,-841,-939,-4472,12458,2247,-975,2039,6148 } }, + { 6602,-841,-939,-4472,12458,2247,-975,2039,6148 } }, { "Canon EOS 1000D", 0, 0xe43, - { 6771,-1139,-977,-7818,15123,2928,-1244,1437,7533 } }, + { 6771,-1139,-977,-7818,15123,2928,-1244,1437,7533 } }, { "Canon EOS 1100D", 0, 0x3510, - { 6444,-904,-893,-4563,12308,2535,-903,2016,6728 } }, + { 6444,-904,-893,-4563,12308,2535,-903,2016,6728 } }, + { "Canon EOS 1200D", 0, 0x37c2, + { 6461,-907,-882,-4300,12184,2378,-819,1944,5931 } }, + { "Canon EOS M3", 0, 0, + { 6362,-823,-847,-4426,12109,2616,-743,1857,5635 } }, { "Canon EOS M", 0, 0, - { 6602,-841,-939,-4472,12458,2247,-975,2039,6148 } }, + { 6602,-841,-939,-4472,12458,2247,-975,2039,6148 } }, { "Canon EOS-1Ds Mark III", 0, 0x3bb0, - { 5859,-211,-930,-8255,16017,2353,-1732,1887,7448 } }, + { 5859,-211,-930,-8255,16017,2353,-1732,1887,7448 } }, { "Canon EOS-1Ds Mark II", 0, 0xe80, - { 6517,-602,-867,-8180,15926,2378,-1618,1771,7633 } }, + { 6517,-602,-867,-8180,15926,2378,-1618,1771,7633 } }, { "Canon EOS-1D Mark IV", 0, 0x3bb0, - { 6014,-220,-795,-4109,12014,2361,-561,1824,5787 } }, + { 6014,-220,-795,-4109,12014,2361,-561,1824,5787 } }, { "Canon EOS-1D Mark III", 0, 0x3bb0, - { 6291,-540,-976,-8350,16145,2311,-1714,1858,7326 } }, + { 6291,-540,-976,-8350,16145,2311,-1714,1858,7326 } }, { "Canon EOS-1D Mark II N", 0, 0xe80, - { 6240,-466,-822,-8180,15825,2500,-1801,1938,8042 } }, + { 6240,-466,-822,-8180,15825,2500,-1801,1938,8042 } }, { "Canon EOS-1D Mark II", 0, 0xe80, - { 6264,-582,-724,-8312,15948,2504,-1744,1919,8664 } }, + { 6264,-582,-724,-8312,15948,2504,-1744,1919,8664 } }, { "Canon EOS-1DS", 0, 0xe20, - { 4374,3631,-1743,-7520,15212,2472,-2892,3632,8161 } }, + { 4374,3631,-1743,-7520,15212,2472,-2892,3632,8161 } }, { "Canon EOS-1D C", 0, 0x3c4e, - { 6847,-614,-1014,-4669,12737,2139,-1197,2488,6846 } }, + { 6847,-614,-1014,-4669,12737,2139,-1197,2488,6846 } }, { "Canon EOS-1D X", 0, 0x3c4e, - { 6847,-614,-1014,-4669,12737,2139,-1197,2488,6846 } }, + { 6847,-614,-1014,-4669,12737,2139,-1197,2488,6846 } }, { "Canon EOS-1D", 0, 0xe20, - { 6806,-179,-1020,-8097,16415,1687,-3267,4236,7690 } }, + { 6806,-179,-1020,-8097,16415,1687,-3267,4236,7690 } }, + { "Canon EOS C500", 853, 0, /* DJC */ + { 17851,-10604,922,-7425,16662,763,-3660,3636,22278 } }, { "Canon PowerShot A530", 0, 0, - { 0 } }, /* don't want the A5 matrix */ + { 0 } }, /* don't want the A5 matrix */ { "Canon PowerShot A50", 0, 0, - { -5300,9846,1776,3436,684,3939,-5540,9879,6200,-1404,11175,217 } }, + { -5300,9846,1776,3436,684,3939,-5540,9879,6200,-1404,11175,217 } }, { "Canon PowerShot A5", 0, 0, - { -4801,9475,1952,2926,1611,4094,-5259,10164,5947,-1554,10883,547 } }, + { -4801,9475,1952,2926,1611,4094,-5259,10164,5947,-1554,10883,547 } }, { "Canon PowerShot G10", 0, 0, - { 11093,-3906,-1028,-5047,12492,2879,-1003,1750,5561 } }, + { 11093,-3906,-1028,-5047,12492,2879,-1003,1750,5561 } }, { "Canon PowerShot G11", 0, 0, - { 12177,-4817,-1069,-1612,9864,2049,-98,850,4471 } }, + { 12177,-4817,-1069,-1612,9864,2049,-98,850,4471 } }, { "Canon PowerShot G12", 0, 0, - { 13244,-5501,-1248,-1508,9858,1935,-270,1083,4366 } }, + { 13244,-5501,-1248,-1508,9858,1935,-270,1083,4366 } }, { "Canon PowerShot G15", 0, 0, - { 7474,-2301,-567,-4056,11456,2975,-222,716,4181 } }, + { 7474,-2301,-567,-4056,11456,2975,-222,716,4181 } }, { "Canon PowerShot G16", 0, 0, - { 14130,-8071,127,2199,6528,1551,3402,-1721,4960 } }, + { 14130,-8071,127,2199,6528,1551,3402,-1721,4960 } }, + { "Canon PowerShot G1 X Mark II", 0, 0, + { 7378,-1255,-1043,-4088,12251,2048,-876,1946,5805 } }, { "Canon PowerShot G1 X", 0, 0, - { 7378,-1255,-1043,-4088,12251,2048,-876,1946,5805 } }, + { 7378,-1255,-1043,-4088,12251,2048,-876,1946,5805 } }, { "Canon PowerShot G1", 0, 0, - { -4778,9467,2172,4743,-1141,4344,-5146,9908,6077,-1566,11051,557 } }, + { -4778,9467,2172,4743,-1141,4344,-5146,9908,6077,-1566,11051,557 } }, { "Canon PowerShot G2", 0, 0, - { 9087,-2693,-1049,-6715,14382,2537,-2291,2819,7790 } }, + { 9087,-2693,-1049,-6715,14382,2537,-2291,2819,7790 } }, + { "Canon PowerShot G3 X", 0, 0, + { 9701,-3857,-921,-3149,11537,1817,-786,1817,5147 } }, { "Canon PowerShot G3", 0, 0, - { 9212,-2781,-1073,-6573,14189,2605,-2300,2844,7664 } }, + { 9212,-2781,-1073,-6573,14189,2605,-2300,2844,7664 } }, { "Canon PowerShot G5", 0, 0, - { 9757,-2872,-933,-5972,13861,2301,-1622,2328,7212 } }, + { 9757,-2872,-933,-5972,13861,2301,-1622,2328,7212 } }, { "Canon PowerShot G6", 0, 0, - { 9877,-3775,-871,-7613,14807,3072,-1448,1305,7485 } }, + { 9877,-3775,-871,-7613,14807,3072,-1448,1305,7485 } }, + { "Canon PowerShot G7 X", 0, 0, + { 9602,-3823,-937,-2984,11495,1675,-407,1415,5049 } }, { "Canon PowerShot G9", 0, 0, - { 7368,-2141,-598,-5621,13254,2625,-1418,1696,5743 } }, + { 7368,-2141,-598,-5621,13254,2625,-1418,1696,5743 } }, { "Canon PowerShot Pro1", 0, 0, - { 10062,-3522,-999,-7643,15117,2730,-765,817,7323 } }, + { 10062,-3522,-999,-7643,15117,2730,-765,817,7323 } }, { "Canon PowerShot Pro70", 34, 0, - { -4155,9818,1529,3939,-25,4522,-5521,9870,6610,-2238,10873,1342 } }, + { -4155,9818,1529,3939,-25,4522,-5521,9870,6610,-2238,10873,1342 } }, { "Canon PowerShot Pro90", 0, 0, - { -4963,9896,2235,4642,-987,4294,-5162,10011,5859,-1770,11230,577 } }, + { -4963,9896,2235,4642,-987,4294,-5162,10011,5859,-1770,11230,577 } }, { "Canon PowerShot S30", 0, 0, - { 10566,-3652,-1129,-6552,14662,2006,-2197,2581,7670 } }, + { 10566,-3652,-1129,-6552,14662,2006,-2197,2581,7670 } }, { "Canon PowerShot S40", 0, 0, - { 8510,-2487,-940,-6869,14231,2900,-2318,2829,9013 } }, + { 8510,-2487,-940,-6869,14231,2900,-2318,2829,9013 } }, { "Canon PowerShot S45", 0, 0, - { 8163,-2333,-955,-6682,14174,2751,-2077,2597,8041 } }, + { 8163,-2333,-955,-6682,14174,2751,-2077,2597,8041 } }, { "Canon PowerShot S50", 0, 0, - { 8882,-2571,-863,-6348,14234,2288,-1516,2172,6569 } }, + { 8882,-2571,-863,-6348,14234,2288,-1516,2172,6569 } }, { "Canon PowerShot S60", 0, 0, - { 8795,-2482,-797,-7804,15403,2573,-1422,1996,7082 } }, + { 8795,-2482,-797,-7804,15403,2573,-1422,1996,7082 } }, { "Canon PowerShot S70", 0, 0, - { 9976,-3810,-832,-7115,14463,2906,-901,989,7889 } }, + { 9976,-3810,-832,-7115,14463,2906,-901,989,7889 } }, { "Canon PowerShot S90", 0, 0, - { 12374,-5016,-1049,-1677,9902,2078,-83,852,4683 } }, + { 12374,-5016,-1049,-1677,9902,2078,-83,852,4683 } }, { "Canon PowerShot S95", 0, 0, - { 13440,-5896,-1279,-1236,9598,1931,-180,1001,4651 } }, - { "Canon PowerShot S120", 0, 0, /* LibRaw */ - { 10800,-4782,-628,-2057,10783,1176,-802,2091,4739 } }, + { 13440,-5896,-1279,-1236,9598,1931,-180,1001,4651 } }, + { "Canon PowerShot S120", 0, 0, + { 6961,-1685,-695,-4625,12945,1836,-1114,2152,5518 } }, { "Canon PowerShot S110", 0, 0, - { 8039,-2643,-654,-3783,11230,2930,-206,690,4194 } }, + { 8039,-2643,-654,-3783,11230,2930,-206,690,4194 } }, { "Canon PowerShot S100", 0, 0, - { 7968,-2565,-636,-2873,10697,2513,180,667,4211 } }, + { 7968,-2565,-636,-2873,10697,2513,180,667,4211 } }, { "Canon PowerShot SX1 IS", 0, 0, - { 6578,-259,-502,-5974,13030,3309,-308,1058,4970 } }, + { 6578,-259,-502,-5974,13030,3309,-308,1058,4970 } }, { "Canon PowerShot SX50 HS", 0, 0, - { 12432,-4753,-1247,-2110,10691,1629,-412,1623,4926 } }, + { 12432,-4753,-1247,-2110,10691,1629,-412,1623,4926 } }, + { "Canon PowerShot SX60 HS", 0, 0, + { 13161,-5451,-1344,-1989,10654,1531,-47,1271,4955 } }, { "Canon PowerShot A3300", 0, 0, /* DJC */ - { 10826,-3654,-1023,-3215,11310,1906,0,999,4960 } }, + { 10826,-3654,-1023,-3215,11310,1906,0,999,4960 } }, { "Canon PowerShot A470", 0, 0, /* DJC */ - { 12513,-4407,-1242,-2680,10276,2405,-878,2215,4734 } }, + { 12513,-4407,-1242,-2680,10276,2405,-878,2215,4734 } }, { "Canon PowerShot A610", 0, 0, /* DJC */ - { 15591,-6402,-1592,-5365,13198,2168,-1300,1824,5075 } }, + { 15591,-6402,-1592,-5365,13198,2168,-1300,1824,5075 } }, { "Canon PowerShot A620", 0, 0, /* DJC */ - { 15265,-6193,-1558,-4125,12116,2010,-888,1639,5220 } }, + { 15265,-6193,-1558,-4125,12116,2010,-888,1639,5220 } }, { "Canon PowerShot A630", 0, 0, /* DJC */ - { 14201,-5308,-1757,-6087,14472,1617,-2191,3105,5348 } }, + { 14201,-5308,-1757,-6087,14472,1617,-2191,3105,5348 } }, { "Canon PowerShot A640", 0, 0, /* DJC */ - { 13124,-5329,-1390,-3602,11658,1944,-1612,2863,4885 } }, + { 13124,-5329,-1390,-3602,11658,1944,-1612,2863,4885 } }, { "Canon PowerShot A650", 0, 0, /* DJC */ - { 9427,-3036,-959,-2581,10671,1911,-1039,1982,4430 } }, + { 9427,-3036,-959,-2581,10671,1911,-1039,1982,4430 } }, { "Canon PowerShot A720", 0, 0, /* DJC */ - { 14573,-5482,-1546,-1266,9799,1468,-1040,1912,3810 } }, + { 14573,-5482,-1546,-1266,9799,1468,-1040,1912,3810 } }, { "Canon PowerShot S3 IS", 0, 0, /* DJC */ - { 14062,-5199,-1446,-4712,12470,2243,-1286,2028,4836 } }, + { 14062,-5199,-1446,-4712,12470,2243,-1286,2028,4836 } }, { "Canon PowerShot SX110 IS", 0, 0, /* DJC */ - { 14134,-5576,-1527,-1991,10719,1273,-1158,1929,3581 } }, + { 14134,-5576,-1527,-1991,10719,1273,-1158,1929,3581 } }, { "Canon PowerShot SX220", 0, 0, /* DJC */ - { 13898,-5076,-1447,-1405,10109,1297,-244,1860,3687 } }, + { 13898,-5076,-1447,-1405,10109,1297,-244,1860,3687 } }, { "Casio EX-S20", 0, 0, /* DJC */ - { 11634,-3924,-1128,-4968,12954,2015,-1588,2648,7206 } }, + { 11634,-3924,-1128,-4968,12954,2015,-1588,2648,7206 } }, { "Casio EX-Z750", 0, 0, /* DJC */ - { 10819,-3873,-1099,-4903,13730,1175,-1755,3751,4632 } }, + { 10819,-3873,-1099,-4903,13730,1175,-1755,3751,4632 } }, { "Casio EX-Z10", 128, 0xfff, /* DJC */ - { 9790,-3338,-603,-2321,10222,2099,-344,1273,4799 } }, + { 9790,-3338,-603,-2321,10222,2099,-344,1273,4799 } }, { "CINE 650", 0, 0, - { 3390,480,-500,-800,3610,340,-550,2336,1192 } }, + { 3390,480,-500,-800,3610,340,-550,2336,1192 } }, { "CINE 660", 0, 0, - { 3390,480,-500,-800,3610,340,-550,2336,1192 } }, + { 3390,480,-500,-800,3610,340,-550,2336,1192 } }, { "CINE", 0, 0, - { 20183,-4295,-423,-3940,15330,3985,-280,4870,9800 } }, + { 20183,-4295,-423,-3940,15330,3985,-280,4870,9800 } }, { "Contax N Digital", 0, 0xf1e, - { 7777,1285,-1053,-9280,16543,2916,-3677,5679,7060 } }, + { 7777,1285,-1053,-9280,16543,2916,-3677,5679,7060 } }, { "Epson R-D1", 0, 0, - { 6827,-1878,-732,-8429,16012,2564,-704,592,7145 } }, + { 6827,-1878,-732,-8429,16012,2564,-704,592,7145 } }, { "Fujifilm E550", 0, 0, - { 11044,-3888,-1120,-7248,15168,2208,-1531,2277,8069 } }, + { 11044,-3888,-1120,-7248,15168,2208,-1531,2277,8069 } }, { "Fujifilm E900", 0, 0, - { 9183,-2526,-1078,-7461,15071,2574,-2022,2440,8639 } }, + { 9183,-2526,-1078,-7461,15071,2574,-2022,2440,8639 } }, { "Fujifilm F5", 0, 0, - { 13690,-5358,-1474,-3369,11600,1998,-132,1554,4395 } }, + { 13690,-5358,-1474,-3369,11600,1998,-132,1554,4395 } }, { "Fujifilm F6", 0, 0, - { 13690,-5358,-1474,-3369,11600,1998,-132,1554,4395 } }, + { 13690,-5358,-1474,-3369,11600,1998,-132,1554,4395 } }, { "Fujifilm F77", 0, 0xfe9, - { 13690,-5358,-1474,-3369,11600,1998,-132,1554,4395 } }, + { 13690,-5358,-1474,-3369,11600,1998,-132,1554,4395 } }, { "Fujifilm F7", 0, 0, - { 10004,-3219,-1201,-7036,15047,2107,-1863,2565,7736 } }, + { 10004,-3219,-1201,-7036,15047,2107,-1863,2565,7736 } }, { "Fujifilm F8", 0, 0, - { 13690,-5358,-1474,-3369,11600,1998,-132,1554,4395 } }, + { 13690,-5358,-1474,-3369,11600,1998,-132,1554,4395 } }, { "Fujifilm S100FS", 514, 0, - { 11521,-4355,-1065,-6524,13767,3058,-1466,1984,6045 } }, - { "Fujifilm S200EXR", 512, 0x3fff, - { 11401,-4498,-1312,-5088,12751,2613,-838,1568,5941 } }, + { 11521,-4355,-1065,-6524,13767,3058,-1466,1984,6045 } }, + { "Fujifilm S1", 0, 0, + { 12297,-4882,-1202,-2106,10691,1623,-88,1312,4790 } }, { "Fujifilm S20Pro", 0, 0, - { 10004,-3219,-1201,-7036,15047,2107,-1863,2565,7736 } }, + { 10004,-3219,-1201,-7036,15047,2107,-1863,2565,7736 } }, + { "Fujifilm S20", 512, 0x3fff, + { 11401,-4498,-1312,-5088,12751,2613,-838,1568,5941 } }, { "Fujifilm S2Pro", 128, 0, - { 12492,-4690,-1402,-7033,15423,1647,-1507,2111,7697 } }, + { 12492,-4690,-1402,-7033,15423,1647,-1507,2111,7697 } }, { "Fujifilm S3Pro", 0, 0, - { 11807,-4612,-1294,-8927,16968,1988,-2120,2741,8006 } }, + { 11807,-4612,-1294,-8927,16968,1988,-2120,2741,8006 } }, { "Fujifilm S5Pro", 0, 0, - { 12300,-5110,-1304,-9117,17143,1998,-1947,2448,8100 } }, + { 12300,-5110,-1304,-9117,17143,1998,-1947,2448,8100 } }, { "Fujifilm S5000", 0, 0, - { 8754,-2732,-1019,-7204,15069,2276,-1702,2334,6982 } }, + { 8754,-2732,-1019,-7204,15069,2276,-1702,2334,6982 } }, { "Fujifilm S5100", 0, 0, - { 11940,-4431,-1255,-6766,14428,2542,-993,1165,7421 } }, + { 11940,-4431,-1255,-6766,14428,2542,-993,1165,7421 } }, { "Fujifilm S5500", 0, 0, - { 11940,-4431,-1255,-6766,14428,2542,-993,1165,7421 } }, + { 11940,-4431,-1255,-6766,14428,2542,-993,1165,7421 } }, { "Fujifilm S5200", 0, 0, - { 9636,-2804,-988,-7442,15040,2589,-1803,2311,8621 } }, + { 9636,-2804,-988,-7442,15040,2589,-1803,2311,8621 } }, { "Fujifilm S5600", 0, 0, - { 9636,-2804,-988,-7442,15040,2589,-1803,2311,8621 } }, + { 9636,-2804,-988,-7442,15040,2589,-1803,2311,8621 } }, { "Fujifilm S6", 0, 0, - { 12628,-4887,-1401,-6861,14996,1962,-2198,2782,7091 } }, + { 12628,-4887,-1401,-6861,14996,1962,-2198,2782,7091 } }, { "Fujifilm S7000", 0, 0, - { 10190,-3506,-1312,-7153,15051,2238,-2003,2399,7505 } }, + { 10190,-3506,-1312,-7153,15051,2238,-2003,2399,7505 } }, { "Fujifilm S9000", 0, 0, - { 10491,-3423,-1145,-7385,15027,2538,-1809,2275,8692 } }, + { 10491,-3423,-1145,-7385,15027,2538,-1809,2275,8692 } }, { "Fujifilm S9500", 0, 0, - { 10491,-3423,-1145,-7385,15027,2538,-1809,2275,8692 } }, + { 10491,-3423,-1145,-7385,15027,2538,-1809,2275,8692 } }, { "Fujifilm S9100", 0, 0, - { 12343,-4515,-1285,-7165,14899,2435,-1895,2496,8800 } }, + { 12343,-4515,-1285,-7165,14899,2435,-1895,2496,8800 } }, { "Fujifilm S9600", 0, 0, - { 12343,-4515,-1285,-7165,14899,2435,-1895,2496,8800 } }, + { 12343,-4515,-1285,-7165,14899,2435,-1895,2496,8800 } }, { "Fujifilm SL1000", 0, 0, - { 11705,-4262,-1107,-2282,10791,1709,-555,1713,4945 } }, + { 11705,-4262,-1107,-2282,10791,1709,-555,1713,4945 } }, { "Fujifilm IS-1", 0, 0, - { 21461,-10807,-1441,-2332,10599,1999,289,875,7703 } }, + { 21461,-10807,-1441,-2332,10599,1999,289,875,7703 } }, { "Fujifilm IS Pro", 0, 0, - { 12300,-5110,-1304,-9117,17143,1998,-1947,2448,8100 } }, + { 12300,-5110,-1304,-9117,17143,1998,-1947,2448,8100 } }, { "Fujifilm HS10 HS11", 0, 0xf68, - { 12440,-3954,-1183,-1123,9674,1708,-83,1614,4086 } }, - { "Fujifilm HS20EXR", 0, 0, - { 13690,-5358,-1474,-3369,11600,1998,-132,1554,4395 } }, + { 12440,-3954,-1183,-1123,9674,1708,-83,1614,4086 } }, + { "Fujifilm HS2", 0, 0, + { 13690,-5358,-1474,-3369,11600,1998,-132,1554,4395 } }, { "Fujifilm HS3", 0, 0, - { 13690,-5358,-1474,-3369,11600,1998,-132,1554,4395 } }, + { 13690,-5358,-1474,-3369,11600,1998,-132,1554,4395 } }, { "Fujifilm HS50EXR", 0, 0, - { 12085,-4727,-953,-3257,11489,2002,-511,2046,4592 } }, + { 12085,-4727,-953,-3257,11489,2002,-511,2046,4592 } }, + { "Fujifilm F900EXR", 0, 0, + { 12085,-4727,-953,-3257,11489,2002,-511,2046,4592 } }, { "Fujifilm X100S", 0, 0, - { 10592,-4262,-1008,-3514,11355,2465,-870,2025,6386 } }, + { 10592,-4262,-1008,-3514,11355,2465,-870,2025,6386 } }, + { "Fujifilm X100T", 0, 0, + { 10592,-4262,-1008,-3514,11355,2465,-870,2025,6386 } }, { "Fujifilm X100", 0, 0, - { 12161,-4457,-1069,-5034,12874,2400,-795,1724,6904 } }, + { 12161,-4457,-1069,-5034,12874,2400,-795,1724,6904 } }, { "Fujifilm X10", 0, 0, - { 13509,-6199,-1254,-4430,12733,1865,-331,1441,5022 } }, + { 13509,-6199,-1254,-4430,12733,1865,-331,1441,5022 } }, { "Fujifilm X20", 0, 0, - { 11768,-4971,-1133,-4904,12927,2183,-480,1723,4605 } }, + { 11768,-4971,-1133,-4904,12927,2183,-480,1723,4605 } }, + { "Fujifilm X30", 0, 0, + { 12328,-5256,-1144,-4469,12927,1675,-87,1291,4351 } }, { "Fujifilm X-Pro1", 0, 0, - { 10413,-3996,-993,-3721,11640,2361,-733,1540,6011 } }, + { 10413,-3996,-993,-3721,11640,2361,-733,1540,6011 } }, { "Fujifilm X-A1", 0, 0, - { 10413,-3996,-993,-3721,11640,2361,-733,1540,6011 } }, + { 11086,-4555,-839,-3512,11310,2517,-815,1341,5940 } }, + { "Fujifilm X-A2", 0, 0, + { 10763,-4560,-917,-3346,11311,2322,-475,1135,5843 } }, { "Fujifilm X-E1", 0, 0, - { 10413,-3996,-993,-3721,11640,2361,-733,1540,6011 } }, + { 10413,-3996,-993,-3721,11640,2361,-733,1540,6011 } }, { "Fujifilm X-E2", 0, 0, { 12066,-5927,-367,-1969,9878,1503,-721,2034,5453 } }, { "Fujifilm XF1", 0, 0, - { 13509,-6199,-1254,-4430,12733,1865,-331,1441,5022 } }, + { 13509,-6199,-1254,-4430,12733,1865,-331,1441,5022 } }, { "Fujifilm X-M1", 0, 0, { 13193,-6685,-425,-2229,10458,1534,-878,1763,5217 } }, { "Fujifilm X-S1", 0, 0, - { 13509,-6199,-1254,-4430,12733,1865,-331,1441,5022 } }, + { 13509,-6199,-1254,-4430,12733,1865,-331,1441,5022 } }, + { "Fujifilm X-T10", 0, 0, + { 10763,-4560,-917,-3346,11311,2322,-475,1135,5843 }}, + { "Fujifilm X-T1", 0, 0, + { 8458,-2451,-855,-4597,12447,2407,-1475,2482,6526 } }, { "Fujifilm XQ1", 0, 0, - { 14305,-7365,-687,-3117,12383,432,-287,1660,4361 } }, - { "Hasselblad Lunar", 128, 0, - { 5491,-1192,-363,-4951,12342,2948,-911,1722,7192 } }, - { "Hasselblad Stellar", 200, 0, - { 8651,-2754,-1057,-3464,12207,1373,-568,1398,4434 } }, + { 9252,-2704,-1064,-5893,14265,1717,-1101,2341,4349 } }, + { "Fujifilm XQ2", 0, 0, + { 9252,-2704,-1064,-5893,14265,1717,-1101,2341,4349 } }, + { "Hasselblad Lunar", -512, 0, + { 5491,-1192,-363,-4951,12342,2948,-911,1722,7192 } }, + { "Hasselblad Stellar", -800, 0, + { 8651,-2754,-1057,-3464,12207,1373,-568,1398,4434 } }, + { "Hasselblad CFV", 0, 0, /* Adobe */ + { 8519, -3260, -280, -5081, 13459, 1738, -1449, 2960, 7809, } }, + { "Hasselblad H-16MP", 0, 0, /* LibRaw */ + { 17765,-5322,-1734,-6168,13354,2135,-264,2524,7440 } }, + { "Hasselblad H-22MP", 0, 0, /* LibRaw */ + { 17765,-5322,-1734,-6168,13354,2135,-264,2524,7440 } }, + { "Hasselblad H-31MP",0, 0, /* LibRaw */ + { 14480,-5448,-1686,-3534,13123,2260,384,2952,7232 } }, + { "Hasselblad H-39MP",0, 0, /* Adobe */ + { 3857,452, -46, -6008, 14477, 1596, -2627, 4481, 5718 } }, + { "Hasselblad H3D-50", 0, 0, /* Adobe */ + { 3857,452, -46, -6008, 14477, 1596, -2627, 4481, 5718 } }, + { "Hasselblad H4D-40",0, 0, /* LibRaw */ + { 6325,-860,-957,-6559,15945,266,167,770,5936 } }, + { "Hasselblad H4D-50",0, 0, /* LibRaw */ + { 15283,-6272,-465,-2030,16031,478,-2379,390,7965 } }, + { "Hasselblad H4D-60",0, 0, /* Adobe */ + { 9662, -684, -279, -4903, 12293, 2950, -344, 1669, 6024 } }, + { "Hasselblad H5D-50c",0, 0, /* Adobe */ + { 4932, -835, 141, -4878, 11868, 3437, -1138, 1961, 7067 } }, + { "Hasselblad H5D-50",0, 0, /* Adobe */ + { 5656, -659, -346, -3923, 12306, 1791, -1602, 3509, 5442 } }, { "Imacon Ixpress", 0, 0, /* DJC */ - { 7025,-1415,-704,-5188,13765,1424,-1248,2742,6038 } }, + { 7025,-1415,-704,-5188,13765,1424,-1248,2742,6038 } }, { "Kodak NC2000", 0, 0, - { 13891,-6055,-803,-465,9919,642,2121,82,1291 } }, - { "Kodak DCS315C", 8, 0, - { 17523,-4827,-2510,756,8546,-137,6113,1649,2250 } }, - { "Kodak DCS330C", 8, 0, - { 20620,-7572,-2801,-103,10073,-396,3551,-233,2220 } }, + { 13891,-6055,-803,-465,9919,642,2121,82,1291 } }, + { "Kodak DCS315C", -8, 0, + { 17523,-4827,-2510,756,8546,-137,6113,1649,2250 } }, + { "Kodak DCS330C", -8, 0, + { 20620,-7572,-2801,-103,10073,-396,3551,-233,2220 } }, { "Kodak DCS420", 0, 0, - { 10868,-1852,-644,-1537,11083,484,2343,628,2216 } }, + { 10868,-1852,-644,-1537,11083,484,2343,628,2216 } }, { "Kodak DCS460", 0, 0, - { 10592,-2206,-967,-1944,11685,230,2206,670,1273 } }, + { 10592,-2206,-967,-1944,11685,230,2206,670,1273 } }, { "Kodak EOSDCS1", 0, 0, - { 10592,-2206,-967,-1944,11685,230,2206,670,1273 } }, + { 10592,-2206,-967,-1944,11685,230,2206,670,1273 } }, { "Kodak EOSDCS3B", 0, 0, - { 9898,-2700,-940,-2478,12219,206,1985,634,1031 } }, - { "Kodak DCS520C", 178, 0, - { 24542,-10860,-3401,-1490,11370,-297,2858,-605,3225 } }, - { "Kodak DCS560C", 177, 0, - { 20482,-7172,-3125,-1033,10410,-285,2542,226,3136 } }, - { "Kodak DCS620C", 177, 0, - { 23617,-10175,-3149,-2054,11749,-272,2586,-489,3453 } }, - { "Kodak DCS620X", 176, 0, - { 13095,-6231,154,12221,-21,-2137,895,4602,2258 } }, - { "Kodak DCS660C", 173, 0, - { 18244,-6351,-2739,-791,11193,-521,3711,-129,2802 } }, + { 9898,-2700,-940,-2478,12219,206,1985,634,1031 } }, + { "Kodak DCS520C", -178, 0, + { 24542,-10860,-3401,-1490,11370,-297,2858,-605,3225 } }, + { "Kodak DCS560C", -177, 0, + { 20482,-7172,-3125,-1033,10410,-285,2542,226,3136 } }, + { "Kodak DCS620C", -177, 0, + { 23617,-10175,-3149,-2054,11749,-272,2586,-489,3453 } }, + { "Kodak DCS620X", -176, 0, + { 13095,-6231,154,12221,-21,-2137,895,4602,2258 } }, + { "Kodak DCS660C", -173, 0, + { 18244,-6351,-2739,-791,11193,-521,3711,-129,2802 } }, { "Kodak DCS720X", 0, 0, - { 11775,-5884,950,9556,1846,-1286,-1019,6221,2728 } }, + { 11775,-5884,950,9556,1846,-1286,-1019,6221,2728 } }, { "Kodak DCS760C", 0, 0, - { 16623,-6309,-1411,-4344,13923,323,2285,274,2926 } }, + { 16623,-6309,-1411,-4344,13923,323,2285,274,2926 } }, { "Kodak DCS Pro SLR", 0, 0, - { 5494,2393,-232,-6427,13850,2846,-1876,3997,5445 } }, + { 5494,2393,-232,-6427,13850,2846,-1876,3997,5445 } }, { "Kodak DCS Pro 14nx", 0, 0, - { 5494,2393,-232,-6427,13850,2846,-1876,3997,5445 } }, + { 5494,2393,-232,-6427,13850,2846,-1876,3997,5445 } }, { "Kodak DCS Pro 14", 0, 0, - { 7791,3128,-776,-8588,16458,2039,-2455,4006,6198 } }, + { 7791,3128,-776,-8588,16458,2039,-2455,4006,6198 } }, { "Kodak ProBack645", 0, 0, - { 16414,-6060,-1470,-3555,13037,473,2545,122,4948 } }, + { 16414,-6060,-1470,-3555,13037,473,2545,122,4948 } }, { "Kodak ProBack", 0, 0, - { 21179,-8316,-2918,-915,11019,-165,3477,-180,4210 } }, + { 21179,-8316,-2918,-915,11019,-165,3477,-180,4210 } }, { "Kodak P712", 0, 0, - { 9658,-3314,-823,-5163,12695,2768,-1342,1843,6044 } }, + { 9658,-3314,-823,-5163,12695,2768,-1342,1843,6044 } }, { "Kodak P850", 0, 0xf7c, - { 10511,-3836,-1102,-6946,14587,2558,-1481,1792,6246 } }, + { 10511,-3836,-1102,-6946,14587,2558,-1481,1792,6246 } }, { "Kodak P880", 0, 0xfff, - { 12805,-4662,-1376,-7480,15267,2360,-1626,2194,7904 } }, + { 12805,-4662,-1376,-7480,15267,2360,-1626,2194,7904 } }, { "Kodak EasyShare Z980", 0, 0, - { 11313,-3559,-1101,-3893,11891,2257,-1214,2398,4908 } }, + { 11313,-3559,-1101,-3893,11891,2257,-1214,2398,4908 } }, { "Kodak EasyShare Z981", 0, 0, - { 12729,-4717,-1188,-1367,9187,2582,274,860,4411 } }, + { 12729,-4717,-1188,-1367,9187,2582,274,860,4411 } }, { "Kodak EasyShare Z990", 0, 0xfed, - { 11749,-4048,-1309,-1867,10572,1489,-138,1449,4522 } }, + { 11749,-4048,-1309,-1867,10572,1489,-138,1449,4522 } }, { "Kodak EASYSHARE Z1015", 0, 0xef1, - { 11265,-4286,-992,-4694,12343,2647,-1090,1523,5447 } }, + { 11265,-4286,-992,-4694,12343,2647,-1090,1523,5447 } }, { "Leaf CMost", 0, 0, - { 3952,2189,449,-6701,14585,2275,-4536,7349,6536 } }, + { 3952,2189,449,-6701,14585,2275,-4536,7349,6536 } }, { "Leaf Valeo 6", 0, 0, - { 3952,2189,449,-6701,14585,2275,-4536,7349,6536 } }, + { 3952,2189,449,-6701,14585,2275,-4536,7349,6536 } }, { "Leaf Aptus 54S", 0, 0, - { 8236,1746,-1314,-8251,15953,2428,-3673,5786,5771 } }, + { 8236,1746,-1314,-8251,15953,2428,-3673,5786,5771 } }, { "Leaf Aptus 65", 0, 0, - { 7914,1414,-1190,-8777,16582,2280,-2811,4605,5562 } }, + { 7914,1414,-1190,-8777,16582,2280,-2811,4605,5562 } }, { "Leaf Aptus 75", 0, 0, - { 7914,1414,-1190,-8777,16582,2280,-2811,4605,5562 } }, + { 7914,1414,-1190,-8777,16582,2280,-2811,4605,5562 } }, + { "Leaf Credo 40", 0, 0, + { 8035, 435, -962, -6001, 13872, 2320, -1159, 3065, 5434 } }, + { "Leaf Credo 50", 0, 0, + { 3984, 0, 0, 0, 10000, 0, 0, 0, 7666 } }, + { "Leaf Credo 60", 0, 0, + { 8035, 435, -962, -6001, 13872,2320,-1159,3065,5434 } }, + { "Leaf Credo 80", 0, 0, + { 6294, 686, -712, -5435, 13417, 2211, -1006, 2435, 5042 } }, { "Leaf", 0, 0, - { 8236,1746,-1314,-8251,15953,2428,-3673,5786,5771 } }, + { 8236,1746,-1314,-8251,15953,2428,-3673,5786,5771 } }, { "Mamiya ZD", 0, 0, - { 7645,2579,-1363,-8689,16717,2015,-3712,5941,5961 } }, + { 7645,2579,-1363,-8689,16717,2015,-3712,5941,5961 } }, { "Micron 2010", 110, 0, /* DJC */ - { 16695,-3761,-2151,155,9682,163,3433,951,4904 } }, + { 16695,-3761,-2151,155,9682,163,3433,951,4904 } }, { "Minolta DiMAGE 5", 0, 0xf7d, - { 8983,-2942,-963,-6556,14476,2237,-2426,2887,8014 } }, + { 8983,-2942,-963,-6556,14476,2237,-2426,2887,8014 } }, { "Minolta DiMAGE 7Hi", 0, 0xf7d, - { 11368,-3894,-1242,-6521,14358,2339,-2475,3056,7285 } }, + { 11368,-3894,-1242,-6521,14358,2339,-2475,3056,7285 } }, { "Minolta DiMAGE 7", 0, 0xf7d, - { 9144,-2777,-998,-6676,14556,2281,-2470,3019,7744 } }, + { 9144,-2777,-998,-6676,14556,2281,-2470,3019,7744 } }, { "Minolta DiMAGE A1", 0, 0xf8b, - { 9274,-2547,-1167,-8220,16323,1943,-2273,2720,8340 } }, + { 9274,-2547,-1167,-8220,16323,1943,-2273,2720,8340 } }, { "Minolta DiMAGE A200", 0, 0, - { 8560,-2487,-986,-8112,15535,2771,-1209,1324,7743 } }, + { 8560,-2487,-986,-8112,15535,2771,-1209,1324,7743 } }, { "Minolta DiMAGE A2", 0, 0xf8f, - { 9097,-2726,-1053,-8073,15506,2762,-966,981,7763 } }, + { 9097,-2726,-1053,-8073,15506,2762,-966,981,7763 } }, { "Minolta DiMAGE Z2", 0, 0, /* DJC */ - { 11280,-3564,-1370,-4655,12374,2282,-1423,2168,5396 } }, + { 11280,-3564,-1370,-4655,12374,2282,-1423,2168,5396 } }, { "Minolta DYNAX 5", 0, 0xffb, - { 10284,-3283,-1086,-7957,15762,2316,-829,882,6644 } }, + { 10284,-3283,-1086,-7957,15762,2316,-829,882,6644 } }, { "Minolta DYNAX 7", 0, 0xffb, - { 10239,-3104,-1099,-8037,15727,2451,-927,925,6871 } }, + { 10239,-3104,-1099,-8037,15727,2451,-927,925,6871 } }, { "Motorola PIXL", 0, 0, /* DJC */ - { 8898,-989,-1033,-3292,11619,1674,-661,3178,5216 } }, + { 8898,-989,-1033,-3292,11619,1674,-661,3178,5216 } }, { "Nikon D100", 0, 0, - { 5902,-933,-782,-8983,16719,2354,-1402,1455,6464 } }, + { 5902,-933,-782,-8983,16719,2354,-1402,1455,6464 } }, { "Nikon D1H", 0, 0, - { 7577,-2166,-926,-7454,15592,1934,-2377,2808,8606 } }, + { 7577,-2166,-926,-7454,15592,1934,-2377,2808,8606 } }, { "Nikon D1X", 0, 0, - { 7702,-2245,-975,-9114,17242,1875,-2679,3055,8521 } }, + { 7702,-2245,-975,-9114,17242,1875,-2679,3055,8521 } }, { "Nikon D1", 0, 0, /* multiplied by 2.218750, 1.0, 1.148438 */ - { 16772,-4726,-2141,-7611,15713,1972,-2846,3494,9521 } }, + { 16772,-4726,-2141,-7611,15713,1972,-2846,3494,9521 } }, { "Nikon D200", 0, 0xfbc, - { 8367,-2248,-763,-8758,16447,2422,-1527,1550,8053 } }, + { 8367,-2248,-763,-8758,16447,2422,-1527,1550,8053 } }, { "Nikon D2H", 0, 0, - { 5710,-901,-615,-8594,16617,2024,-2975,4120,6830 } }, + { 5710,-901,-615,-8594,16617,2024,-2975,4120,6830 } }, { "Nikon D2X", 0, 0, - { 10231,-2769,-1255,-8301,15900,2552,-797,680,7148 } }, + { 10231,-2769,-1255,-8301,15900,2552,-797,680,7148 } }, { "Nikon D3000", 0, 0, - { 8736,-2458,-935,-9075,16894,2251,-1354,1242,8263 } }, + { 8736,-2458,-935,-9075,16894,2251,-1354,1242,8263 } }, { "Nikon D3100", 0, 0, - { 7911,-2167,-813,-5327,13150,2408,-1288,2483,7968 } }, + { 7911,-2167,-813,-5327,13150,2408,-1288,2483,7968 } }, { "Nikon D3200", 0, 0xfb9, - { 7013,-1408,-635,-5268,12902,2640,-1470,2801,7379 } }, + { 7013,-1408,-635,-5268,12902,2640,-1470,2801,7379 } }, + { "Nikon D3300", 0, 0, + { 6988,-1384,-714,-5631,13410,2447,-1485,2204,7318 } }, { "Nikon D300", 0, 0, - { 9030,-1992,-715,-8465,16302,2255,-2689,3217,8069 } }, + { 9030,-1992,-715,-8465,16302,2255,-2689,3217,8069 } }, { "Nikon D3X", 0, 0, - { 7171,-1986,-648,-8085,15555,2718,-2170,2512,7457 } }, + { 7171,-1986,-648,-8085,15555,2718,-2170,2512,7457 } }, { "Nikon D3S", 0, 0, - { 8828,-2406,-694,-4874,12603,2541,-660,1509,7587 } }, + { 8828,-2406,-694,-4874,12603,2541,-660,1509,7587 } }, { "Nikon D3", 0, 0, - { 8139,-2171,-663,-8747,16541,2295,-1925,2008,8093 } }, + { 8139,-2171,-663,-8747,16541,2295,-1925,2008,8093 } }, { "Nikon D40X", 0, 0, - { 8819,-2543,-911,-9025,16928,2151,-1329,1213,8449 } }, + { 8819,-2543,-911,-9025,16928,2151,-1329,1213,8449 } }, { "Nikon D40", 0, 0, - { 6992,-1668,-806,-8138,15748,2543,-874,850,7897 } }, + { 6992,-1668,-806,-8138,15748,2543,-874,850,7897 } }, + { "Nikon D4S", 0, 0, + { 8598,-2848,-857,-5618,13606,2195,-1002,1773,7137 } }, { "Nikon D4", 0, 0, - { 10076,-4135,-659,-4586,13006,746,-1189,2107,6185 } }, + { 8598,-2848,-857,-5618,13606,2195,-1002,1773,7137 } }, + { "Nikon Df", 0, 0, + { 8598,-2848,-857,-5618,13606,2195,-1002,1773,7137 } }, { "Nikon D5000", 0, 0xf00, - { 7309,-1403,-519,-8474,16008,2622,-2433,2826,8064 } }, + { 7309,-1403,-519,-8474,16008,2622,-2433,2826,8064 } }, { "Nikon D5100", 0, 0x3de6, - { 8198,-2239,-724,-4871,12389,2798,-1043,2050,7181 } }, + { 8198,-2239,-724,-4871,12389,2798,-1043,2050,7181 } }, { "Nikon D5200", 0, 0, - { 8322,-3112,-1047,-6367,14342,2179,-988,1638,6394 } }, - {"Nikon D5300",0, 0, - { 10645,-5086,-698,-4938,13608,761,-1107,1874,5312 } }, + { 8322,-3112,-1047,-6367,14342,2179,-988,1638,6394 } }, + { "Nikon D5300", 0, 0, + { 6988,-1384,-714,-5631,13410,2447,-1485,2204,7318 } }, + { "Nikon D5500", 0, 0, + { 8821,-2938,-785,-4178,12142,2287,-824,1651,6860 } }, { "Nikon D50", 0, 0, - { 7732,-2422,-789,-8238,15884,2498,-859,783,7330 } }, + { 7732,-2422,-789,-8238,15884,2498,-859,783,7330 } }, { "Nikon D600", 0, 0x3e07, - { 8178,-2245,-609,-4857,12394,2776,-1207,2086,7298 } }, - {"Nikon D610",0, 0, - { 10426,-4005,-444,-3565,11764,1403,-1206,2266,6549 } }, + { 8178,-2245,-609,-4857,12394,2776,-1207,2086,7298 } }, + { "Nikon D610",0, 0, + { 10426,-4005,-444,-3565,11764,1403,-1206,2266,6549 } }, { "Nikon D60", 0, 0, - { 8736,-2458,-935,-9075,16894,2251,-1354,1242,8263 } }, + { 8736,-2458,-935,-9075,16894,2251,-1354,1242,8263 } }, { "Nikon D7000", 0, 0, - { 8198,-2239,-724,-4871,12389,2798,-1043,2050,7181 } }, + { 8198,-2239,-724,-4871,12389,2798,-1043,2050,7181 } }, { "Nikon D7100", 0, 0, { 8322,-3112,-1047,-6367,14342,2179,-988,1638,6394 } }, + { "Nikon D7200", 0, 0, + { 8322,-3112,-1047,-6367,14342,2179,-988,1638,6394 } }, + { "Nikon D750", 0, 0, + { 9020,-2890,-715,-4535,12436,2348,-934,1919,7086 } }, { "Nikon D700", 0, 0, - { 8139,-2171,-663,-8747,16541,2295,-1925,2008,8093 } }, + { 8139,-2171,-663,-8747,16541,2295,-1925,2008,8093 } }, { "Nikon D70", 0, 0, - { 7732,-2422,-789,-8238,15884,2498,-859,783,7330 } }, + { 7732,-2422,-789,-8238,15884,2498,-859,783,7330 } }, + { "Nikon D810A", 0, 0, + { 11973, -5685, -888, -1965, 10326, 1901, -115, 1123, 7169 }}, + { "Nikon D810", 0, 0, + { 9369,-3195,-791,-4488,12430,2301,-893,1796,6872 } }, { "Nikon D800", 0, 0, - { 7866,-2108,-555,-4869,12483,2681,-1176,2069,7501 } }, + { 7866,-2108,-555,-4869,12483,2681,-1176,2069,7501 } }, { "Nikon D80", 0, 0, - { 8629,-2410,-883,-9055,16940,2171,-1490,1363,8520 } }, + { 8629,-2410,-883,-9055,16940,2171,-1490,1363,8520 } }, { "Nikon D90", 0, 0xf00, - { 7309,-1403,-519,-8474,16008,2622,-2434,2826,8064 } }, - {"Nikon Df",0, 0, - { 10076,-4135,-659,-4586,13006,746,-1189,2107,6185 } }, + { 7309,-1403,-519,-8474,16008,2622,-2434,2826,8064 } }, { "Nikon E700", 0, 0x3dd, /* DJC */ - { -3746,10611,1665,9621,-1734,2114,-2389,7082,3064,3406,6116,-244 } }, + { -3746,10611,1665,9621,-1734,2114,-2389,7082,3064,3406,6116,-244 } }, { "Nikon E800", 0, 0x3dd, /* DJC */ - { -3746,10611,1665,9621,-1734,2114,-2389,7082,3064,3406,6116,-244 } }, + { -3746,10611,1665,9621,-1734,2114,-2389,7082,3064,3406,6116,-244 } }, { "Nikon E950", 0, 0x3dd, /* DJC */ - { -3746,10611,1665,9621,-1734,2114,-2389,7082,3064,3406,6116,-244 } }, + { -3746,10611,1665,9621,-1734,2114,-2389,7082,3064,3406,6116,-244 } }, { "Nikon E995", 0, 0, /* copied from E5000 */ - { -5547,11762,2189,5814,-558,3342,-4924,9840,5949,688,9083,96 } }, + { -5547,11762,2189,5814,-558,3342,-4924,9840,5949,688,9083,96 } }, { "Nikon E2100", 0, 0, /* copied from Z2, new white balance */ - { 13142,-4152,-1596,-4655,12374,2282,-1769,2696,6711} }, + { 13142,-4152,-1596,-4655,12374,2282,-1769,2696,6711 } }, { "Nikon E2500", 0, 0, - { -5547,11762,2189,5814,-558,3342,-4924,9840,5949,688,9083,96 } }, + { -5547,11762,2189,5814,-558,3342,-4924,9840,5949,688,9083,96 } }, { "Nikon E3200", 0, 0, /* DJC */ - { 9846,-2085,-1019,-3278,11109,2170,-774,2134,5745 } }, + { 9846,-2085,-1019,-3278,11109,2170,-774,2134,5745 } }, { "Nikon E4300", 0, 0, /* copied from Minolta DiMAGE Z2 */ - { 11280,-3564,-1370,-4655,12374,2282,-1423,2168,5396 } }, + { 11280,-3564,-1370,-4655,12374,2282,-1423,2168,5396 } }, { "Nikon E4500", 0, 0, - { -5547,11762,2189,5814,-558,3342,-4924,9840,5949,688,9083,96 } }, + { -5547,11762,2189,5814,-558,3342,-4924,9840,5949,688,9083,96 } }, { "Nikon E5000", 0, 0, - { -5547,11762,2189,5814,-558,3342,-4924,9840,5949,688,9083,96 } }, + { -5547,11762,2189,5814,-558,3342,-4924,9840,5949,688,9083,96 } }, { "Nikon E5400", 0, 0, - { 9349,-2987,-1001,-7919,15766,2266,-2098,2680,6839 } }, + { 9349,-2987,-1001,-7919,15766,2266,-2098,2680,6839 } }, { "Nikon E5700", 0, 0, - { -5368,11478,2368,5537,-113,3148,-4969,10021,5782,778,9028,211 } }, + { -5368,11478,2368,5537,-113,3148,-4969,10021,5782,778,9028,211 } }, { "Nikon E8400", 0, 0, - { 7842,-2320,-992,-8154,15718,2599,-1098,1342,7560 } }, + { 7842,-2320,-992,-8154,15718,2599,-1098,1342,7560 } }, { "Nikon E8700", 0, 0, - { 8489,-2583,-1036,-8051,15583,2643,-1307,1407,7354 } }, + { 8489,-2583,-1036,-8051,15583,2643,-1307,1407,7354 } }, { "Nikon E8800", 0, 0, - { 7971,-2314,-913,-8451,15762,2894,-1442,1520,7610 } }, + { 7971,-2314,-913,-8451,15762,2894,-1442,1520,7610 } }, { "Nikon COOLPIX A", 0, 0, - { 8198,-2239,-724,-4871,12389,2798,-1043,2050,7181 } }, - { "Nikon COOLPIX P330", 0, 0, - { 10321,-3920,-931,-2750,11146,1824,-442,1545,5539 } }, + { 8198,-2239,-724,-4871,12389,2798,-1043,2050,7181 } }, + { "Nikon COOLPIX P330", -200, 0, + { 10321,-3920,-931,-2750,11146,1824,-442,1545,5539 } }, + { "Nikon COOLPIX P340", -200, 0, + { 10321,-3920,-931,-2750,11146,1824,-442,1545,5539 } }, { "Nikon COOLPIX P6000", 0, 0, - { 9698,-3367,-914,-4706,12584,2368,-837,968,5801 } }, + { 9698,-3367,-914,-4706,12584,2368,-837,968,5801 } }, { "Nikon COOLPIX P7000", 0, 0, - { 11432,-3679,-1111,-3169,11239,2202,-791,1380,4455 } }, + { 11432,-3679,-1111,-3169,11239,2202,-791,1380,4455 } }, { "Nikon COOLPIX P7100", 0, 0, - { 11053,-4269,-1024,-1976,10182,2088,-526,1263,4469 } }, - { "Nikon COOLPIX P7700", 200, 0, - { 10321,-3920,-931,-2750,11146,1824,-442,1545,5539 } }, - { "Nikon COOLPIX P7800", 200, 0, - { 13443,-6418,-673,-1309,10025,1131,-462,1827,4782 } }, + { 11053,-4269,-1024,-1976,10182,2088,-526,1263,4469 } }, + { "Nikon COOLPIX P7700", -3200, 0, + { 10321,-3920,-931,-2750,11146,1824,-442,1545,5539 } }, + { "Nikon COOLPIX P7800", -3200, 0, + { 10321,-3920,-931,-2750,11146,1824,-442,1545,5539 } }, + { "Nikon 1 V3", -200, 0, + { 5958,-1559,-571,-4021,11453,2939,-634,1548,5087 } }, + { "Nikon 1 J4", 0, 0, + { 5958,-1559,-571,-4021,11453,2939,-634,1548,5087 } }, + { "Nikon 1 J5", 0, 0, + { 7520,-2518,-645,-3844,12102,1945,-913,2249,6835} }, + { "Nikon 1 S2", -200, 0, + { 6612,-1342,-618,-3338,11055,2623,-174,1792,5075 } }, { "Nikon 1 V2", 0, 0, - { 6588,-1305,-693,-3277,10987,2634,-355,2016,5106 } }, + { 6588,-1305,-693,-3277,10987,2634,-355,2016,5106 } }, { "Nikon 1 J3", 0, 0, - { 8144,-2671,-473,-1740,9834,1601,-58,1971,4296 } }, + { 8144,-2671,-473,-1740,9834,1601,-58,1971,4296 } }, { "Nikon 1 AW1", 0, 0, - { 8144,-2671,-473,-1740,9834,1601,-58,1971,4296 } }, - { "Nikon 1 ", 0, 0, - { 8994,-2667,-865,-4594,12324,2552,-699,1786,6260 } }, + { 6588,-1305,-693,-3277,10987,2634,-355,2016,5106 } }, + { "Nikon 1 ", 0, 0, /* J1, J2, S1, V1 */ + { 8994,-2667,-865,-4594,12324,2552,-699,1786,6260 } }, + { "Olympus AIR-A01", 0, 0xfe1, + { 8992,-3093,-639,-2563,10721,2122,-437,1270,5473 } }, { "Olympus C5050", 0, 0, - { 10508,-3124,-1273,-6079,14294,1901,-1653,2306,6237 } }, + { 10508,-3124,-1273,-6079,14294,1901,-1653,2306,6237 } }, { "Olympus C5060", 0, 0, - { 10445,-3362,-1307,-7662,15690,2058,-1135,1176,7602 } }, + { 10445,-3362,-1307,-7662,15690,2058,-1135,1176,7602 } }, { "Olympus C7070", 0, 0, - { 10252,-3531,-1095,-7114,14850,2436,-1451,1723,6365 } }, + { 10252,-3531,-1095,-7114,14850,2436,-1451,1723,6365 } }, { "Olympus C70", 0, 0, - { 10793,-3791,-1146,-7498,15177,2488,-1390,1577,7321 } }, + { 10793,-3791,-1146,-7498,15177,2488,-1390,1577,7321 } }, { "Olympus C80", 0, 0, - { 8606,-2509,-1014,-8238,15714,2703,-942,979,7760 } }, + { 8606,-2509,-1014,-8238,15714,2703,-942,979,7760 } }, { "Olympus E-10", 0, 0xffc, - { 12745,-4500,-1416,-6062,14542,1580,-1934,2256,6603 } }, + { 12745,-4500,-1416,-6062,14542,1580,-1934,2256,6603 } }, { "Olympus E-1", 0, 0, - { 11846,-4767,-945,-7027,15878,1089,-2699,4122,8311 } }, + { 11846,-4767,-945,-7027,15878,1089,-2699,4122,8311 } }, { "Olympus E-20", 0, 0xffc, - { 13173,-4732,-1499,-5807,14036,1895,-2045,2452,7142 } }, + { 13173,-4732,-1499,-5807,14036,1895,-2045,2452,7142 } }, { "Olympus E-300", 0, 0, - { 7828,-1761,-348,-5788,14071,1830,-2853,4518,6557 } }, + { 7828,-1761,-348,-5788,14071,1830,-2853,4518,6557 } }, { "Olympus E-330", 0, 0, - { 8961,-2473,-1084,-7979,15990,2067,-2319,3035,8249 } }, + { 8961,-2473,-1084,-7979,15990,2067,-2319,3035,8249 } }, { "Olympus E-30", 0, 0xfbc, - { 8144,-1861,-1111,-7763,15894,1929,-1865,2542,7607 } }, + { 8144,-1861,-1111,-7763,15894,1929,-1865,2542,7607 } }, { "Olympus E-3", 0, 0xf99, - { 9487,-2875,-1115,-7533,15606,2010,-1618,2100,7389 } }, + { 9487,-2875,-1115,-7533,15606,2010,-1618,2100,7389 } }, { "Olympus E-400", 0, 0, - { 6169,-1483,-21,-7107,14761,2536,-2904,3580,8568 } }, + { 6169,-1483,-21,-7107,14761,2536,-2904,3580,8568 } }, { "Olympus E-410", 0, 0xf6a, - { 8856,-2582,-1026,-7761,15766,2082,-2009,2575,7469 } }, + { 8856,-2582,-1026,-7761,15766,2082,-2009,2575,7469 } }, { "Olympus E-420", 0, 0xfd7, - { 8746,-2425,-1095,-7594,15612,2073,-1780,2309,7416 } }, + { 8746,-2425,-1095,-7594,15612,2073,-1780,2309,7416 } }, { "Olympus E-450", 0, 0xfd2, - { 8745,-2425,-1095,-7594,15613,2073,-1780,2309,7416 } }, + { 8745,-2425,-1095,-7594,15613,2073,-1780,2309,7416 } }, { "Olympus E-500", 0, 0, - { 8136,-1968,-299,-5481,13742,1871,-2556,4205,6630 } }, + { 8136,-1968,-299,-5481,13742,1871,-2556,4205,6630 } }, { "Olympus E-510", 0, 0xf6a, - { 8785,-2529,-1033,-7639,15624,2112,-1783,2300,7817 } }, + { 8785,-2529,-1033,-7639,15624,2112,-1783,2300,7817 } }, { "Olympus E-520", 0, 0xfd2, - { 8344,-2322,-1020,-7596,15635,2048,-1748,2269,7287 } }, + { 8344,-2322,-1020,-7596,15635,2048,-1748,2269,7287 } }, { "Olympus E-5", 0, 0xeec, - { 11200,-3783,-1325,-4576,12593,2206,-695,1742,7504 } }, + { 11200,-3783,-1325,-4576,12593,2206,-695,1742,7504 } }, { "Olympus E-600", 0, 0xfaf, - { 8453,-2198,-1092,-7609,15681,2008,-1725,2337,7824 } }, + { 8453,-2198,-1092,-7609,15681,2008,-1725,2337,7824 } }, { "Olympus E-620", 0, 0xfaf, - { 8453,-2198,-1092,-7609,15681,2008,-1725,2337,7824 } }, + { 8453,-2198,-1092,-7609,15681,2008,-1725,2337,7824 } }, { "Olympus E-P1", 0, 0xffd, - { 8343,-2050,-1021,-7715,15705,2103,-1831,2380,8235 } }, + { 8343,-2050,-1021,-7715,15705,2103,-1831,2380,8235 } }, { "Olympus E-P2", 0, 0xffd, - { 8343,-2050,-1021,-7715,15705,2103,-1831,2380,8235 } }, + { 8343,-2050,-1021,-7715,15705,2103,-1831,2380,8235 } }, { "Olympus E-P3", 0, 0, - { 7575,-2159,-571,-3722,11341,2725,-1434,2819,6271 } }, - { "OLYMPUS E-P5", 0, 0, - { 8380,-2630,-639,-2887,10725,2496,-627,1427,5438 } }, + { 7575,-2159,-571,-3722,11341,2725,-1434,2819,6271 } }, + { "Olympus E-P5", 0, 0, + { 8380,-2630,-639,-2887,10725,2496,-627,1427,5438 } }, { "Olympus E-PL1s", 0, 0, - { 11409,-3872,-1393,-4572,12757,2003,-709,1810,7415 } }, + { 11409,-3872,-1393,-4572,12757,2003,-709,1810,7415 } }, { "Olympus E-PL1", 0, 0, - { 11408,-4289,-1215,-4286,12385,2118,-387,1467,7787 } }, + { 11408,-4289,-1215,-4286,12385,2118,-387,1467,7787 } }, { "Olympus E-PL2", 0, 0xcf3, - { 15030,-5552,-1806,-3987,12387,1767,-592,1670,7023 } }, + { 15030,-5552,-1806,-3987,12387,1767,-592,1670,7023 } }, { "Olympus E-PL3", 0, 0, - { 7575,-2159,-571,-3722,11341,2725,-1434,2819,6271 } }, + { 7575,-2159,-571,-3722,11341,2725,-1434,2819,6271 } }, { "Olympus E-PL5", 0, 0xfcb, - { 8380,-2630,-639,-2887,10725,2496,-627,1427,5438 } }, + { 8380,-2630,-639,-2887,10725,2496,-627,1427,5438 } }, + { "Olympus E-PL6", 0, 0, + { 8380,-2630,-639,-2887,10725,2496,-627,1427,5438 } }, + { "Olympus E-PL7", 0, 0, + { 9197,-3190,-659,-2606,10830,2039,-458,1250,5458 } }, { "Olympus E-PM1", 0, 0, - { 7575,-2159,-571,-3722,11341,2725,-1434,2819,6271 } }, + { 7575,-2159,-571,-3722,11341,2725,-1434,2819,6271 } }, { "Olympus E-PM2", 0, 0, - { 8380,-2630,-639,-2887,10725,2496,-627,1427,5438 } }, - {"Olympus E-M1", 0, 0, - { 11663,-5527,-419,-1683,9915,1389,-582,1933,5016 } }, + { 8380,-2630,-639,-2887,10725,2496,-627,1427,5438 } }, + { "Olympus E-M10", 0, 0, + { 8380,-2630,-639,-2887,10725,2496,-627,1427,5438 } }, + { "Olympus E-M1", 0, 0, + { 7687,-1984,-606,-4327,11928,2721,-1381,2339,6452 } }, + { "Olympus E-M5MarkII", 0, 0, + { 9422,-3258,-711,-2655,10898,2015,-512,1354,5512 } }, { "Olympus E-M5", 0, 0xfe1, - { 8380,-2630,-639,-2887,10725,2496,-627,1427,5438 } }, + { 8380,-2630,-639,-2887,10725,2496,-627,1427,5438 } }, { "Olympus SP350", 0, 0, - { 12078,-4836,-1069,-6671,14306,2578,-786,939,7418 } }, + { 12078,-4836,-1069,-6671,14306,2578,-786,939,7418 } }, { "Olympus SP3", 0, 0, - { 11766,-4445,-1067,-6901,14421,2707,-1029,1217,7572 } }, + { 11766,-4445,-1067,-6901,14421,2707,-1029,1217,7572 } }, { "Olympus SP500UZ", 0, 0xfff, - { 9493,-3415,-666,-5211,12334,3260,-1548,2262,6482 } }, + { 9493,-3415,-666,-5211,12334,3260,-1548,2262,6482 } }, { "Olympus SP510UZ", 0, 0xffe, - { 10593,-3607,-1010,-5881,13127,3084,-1200,1805,6721 } }, + { 10593,-3607,-1010,-5881,13127,3084,-1200,1805,6721 } }, { "Olympus SP550UZ", 0, 0xffe, - { 11597,-4006,-1049,-5432,12799,2957,-1029,1750,6516 } }, + { 11597,-4006,-1049,-5432,12799,2957,-1029,1750,6516 } }, { "Olympus SP560UZ", 0, 0xff9, - { 10915,-3677,-982,-5587,12986,2911,-1168,1968,6223 } }, + { 10915,-3677,-982,-5587,12986,2911,-1168,1968,6223 } }, { "Olympus SP570UZ", 0, 0, - { 11522,-4044,-1146,-4736,12172,2904,-988,1829,6039 } }, - {"Olympus STYLUS1",0, 0, - { 11976,-5518,-545,-1419,10472,846,-475,1766,4524 } }, + { 11522,-4044,-1146,-4736,12172,2904,-988,1829,6039 } }, + {"Olympus SH-2", 0, 0, + {10156,-3425,-1077,-2611,11177,1624,-385,1592,5080}}, + { "Olympus STYLUS1",0, 0, + { 11976,-5518,-545,-1419,10472,846,-475,1766,4524 } }, + {"Olympus TG-4", 0, 0, + {11426,-4159,-1126,-2066,10678,1593,-120,1327,4998}}, { "Olympus XZ-10", 0, 0, - { 9777,-3483,-925,-2886,11297,1800,-602,1663,5134 } }, + { 9777,-3483,-925,-2886,11297,1800,-602,1663,5134 } }, { "Olympus XZ-1", 0, 0, - { 10901,-4095,-1074,-1141,9208,2293,-62,1417,5158 } }, + { 10901,-4095,-1074,-1141,9208,2293,-62,1417,5158 } }, { "Olympus XZ-2", 0, 0, - { 9777,-3483,-925,-2886,11297,1800,-602,1663,5134 } }, - { "OmniVision ov5647", 0, 0, /* DJC */ - { 12782,-4059,-379,-478,9066,1413,1340,1513,5176 } }, + { 9777,-3483,-925,-2886,11297,1800,-602,1663,5134 } }, + { "OmniVision", 0, 0, /* DJC */ + { 12782,-4059,-379,-478,9066,1413,1340,1513,5176 } }, { "Pentax *ist DL2", 0, 0, - { 10504,-2438,-1189,-8603,16207,2531,-1022,863,12242 } }, + { 10504,-2438,-1189,-8603,16207,2531,-1022,863,12242 } }, { "Pentax *ist DL", 0, 0, - { 10829,-2838,-1115,-8339,15817,2696,-837,680,11939 } }, + { 10829,-2838,-1115,-8339,15817,2696,-837,680,11939 } }, { "Pentax *ist DS2", 0, 0, - { 10504,-2438,-1189,-8603,16207,2531,-1022,863,12242 } }, + { 10504,-2438,-1189,-8603,16207,2531,-1022,863,12242 } }, { "Pentax *ist DS", 0, 0, - { 10371,-2333,-1206,-8688,16231,2602,-1230,1116,11282 } }, + { 10371,-2333,-1206,-8688,16231,2602,-1230,1116,11282 } }, { "Pentax *ist D", 0, 0, - { 9651,-2059,-1189,-8881,16512,2487,-1460,1345,10687 } }, + { 9651,-2059,-1189,-8881,16512,2487,-1460,1345,10687 } }, { "Pentax K10D", 0, 0, - { 9566,-2863,-803,-7170,15172,2112,-818,803,9705 } }, + { 9566,-2863,-803,-7170,15172,2112,-818,803,9705 } }, { "Pentax K1", 0, 0, - { 11095,-3157,-1324,-8377,15834,2720,-1108,947,11688 } }, + { 11095,-3157,-1324,-8377,15834,2720,-1108,947,11688 } }, { "Pentax K20D", 0, 0, - { 9427,-2714,-868,-7493,16092,1373,-2199,3264,7180 } }, + { 9427,-2714,-868,-7493,16092,1373,-2199,3264,7180 } }, { "Pentax K200D", 0, 0, - { 9186,-2678,-907,-8693,16517,2260,-1129,1094,8524 } }, + { 9186,-2678,-907,-8693,16517,2260,-1129,1094,8524 } }, { "Pentax K2000", 0, 0, - { 11057,-3604,-1155,-5152,13046,2329,-282,375,8104 } }, + { 11057,-3604,-1155,-5152,13046,2329,-282,375,8104 } }, { "Pentax K-m", 0, 0, - { 11057,-3604,-1155,-5152,13046,2329,-282,375,8104 } }, + { 11057,-3604,-1155,-5152,13046,2329,-282,375,8104 } }, { "Pentax K-x", 0, 0, - { 8843,-2837,-625,-5025,12644,2668,-411,1234,7410 } }, + { 8843,-2837,-625,-5025,12644,2668,-411,1234,7410 } }, { "Pentax K-r", 0, 0, - { 9895,-3077,-850,-5304,13035,2521,-883,1768,6936 } }, + { 9895,-3077,-850,-5304,13035,2521,-883,1768,6936 } }, + { "Pentax K-3 II", 0, 0, + {7415,-2052,-721,-5186,12788,2682,-1446,2157,6773 } }, + { "Pentax K-3", 0, 0, + { 7415,-2052,-721,-5186,12788,2682,-1446,2157,6773 } }, { "Pentax K-5 II", 0, 0, - { 8170,-2725,-639,-4440,12017,2744,-771,1465,6599 } }, + { 8170,-2725,-639,-4440,12017,2744,-771,1465,6599 } }, { "Pentax K-5", 0, 0, - { 8713,-2833,-743,-4342,11900,2772,-722,1543,6247 } }, + { 8713,-2833,-743,-4342,11900,2772,-722,1543,6247 } }, { "Pentax K-7", 0, 0, - { 9142,-2947,-678,-8648,16967,1663,-2224,2898,8615 } }, + { 9142,-2947,-678,-8648,16967,1663,-2224,2898,8615 } }, + { "Pentax K-S1", 0, 0, + { 8512,-3211,-787,-4167,11966,2487,-638,1288,6054 } }, + { "Pentax K-S2", 0, 0, + { 8130,-2556,-1157,-3882,12350,1689,-843,1491,6305 } }, + { "Pentax Q-S1", 0, 0, + { 12995,-5593,-1107,-1879,10139,2027,-64,1233,4919 } }, { "Pentax MX-1", 0, 0, - { 8804,-2523,-1238,-2423,11627,860,-682,1774,4753 } }, + { 8804,-2523,-1238,-2423,11627,860,-682,1774,4753 } }, { "Pentax Q10", 0, 0, - { 12995,-5593,-1107,-1879,10139,2027,-64,1233,4919 } }, + { 12995,-5593,-1107,-1879,10139,2027,-64,1233,4919 } }, { "Pentax 645D", 0, 0x3e00, - { 10646,-3593,-1158,-3329,11699,1831,-667,2874,6287 } }, + { 10646,-3593,-1158,-3329,11699,1831,-667,2874,6287 } }, + { "Panasonic DMC-CM1", -15, 0, + { 8770, -3194,-820,-2871,11281,1803,-513,1552,4434 } }, { "Panasonic DMC-FZ8", 0, 0xf7f, - { 8986,-2755,-802,-6341,13575,3077,-1476,2144,6379 } }, + { 8986,-2755,-802,-6341,13575,3077,-1476,2144,6379 } }, { "Panasonic DMC-FZ18", 0, 0, - { 9932,-3060,-935,-5809,13331,2753,-1267,2155,5575 } }, - { "Panasonic DMC-FZ28", 15, 0xf96, - { 10109,-3488,-993,-5412,12812,2916,-1305,2140,5543 } }, + { 9932,-3060,-935,-5809,13331,2753,-1267,2155,5575 } }, + { "Panasonic DMC-FZ28", -15, 0xf96, + { 10109,-3488,-993,-5412,12812,2916,-1305,2140,5543 } }, + { "Panasonic DMC-FZ300", -15, 0xfff, + { 8378,-2798,-769,-3068,11410,1877,-538,1792,4623 } }, + { "Panasonic DMC-FZ330", -15, 0xfff, // same as FZ300 + { 8378,-2798,-769,-3068,11410,1877,-538,1792,4623 } }, { "Panasonic DMC-FZ30", 0, 0xf94, - { 10976,-4029,-1141,-7918,15491,2600,-1670,2071,8246 } }, - { "Panasonic DMC-FZ3", 143, 0, - { 9938,-2780,-890,-4604,12393,2480,-1117,2304,4620 } }, - { "Panasonic DMC-FZ4", 143, 0, - { 13639,-5535,-1371,-1698,9633,2430,316,1152,4108 } }, + { 10976,-4029,-1141,-7918,15491,2600,-1670,2071,8246 } }, + { "Panasonic DMC-FZ3", -15, 0, + { 9938,-2780,-890,-4604,12393,2480,-1117,2304,4620 } }, + { "Panasonic DMC-FZ4", -15, 0, + { 13639,-5535,-1371,-1698,9633,2430,316,1152,4108 } }, { "Panasonic DMC-FZ50", 0, 0, - { 7906,-2709,-594,-6231,13351,3220,-1922,2631,6537 } }, + { 7906,-2709,-594,-6231,13351,3220,-1922,2631,6537 } }, + { "Panasonic DMC-FZ7", -15, 0, + { 11532,-4324,-1066,-2375,10847,1749,-564,1699,4351 } }, { "Leica V-LUX1", 0, 0, - { 7906,-2709,-594,-6231,13351,3220,-1922,2631,6537 } }, - { "Panasonic DMC-L10", 15, 0xf96, - { 8025,-1942,-1050,-7920,15904,2100,-2456,3005,7039 } }, + { 7906,-2709,-594,-6231,13351,3220,-1922,2631,6537 } }, + { "Panasonic DMC-L10", -15, 0xf96, + { 8025,-1942,-1050,-7920,15904,2100,-2456,3005,7039 } }, { "Panasonic DMC-L1", 0, 0xf7f, - { 8054,-1885,-1025,-8349,16367,2040,-2805,3542,7629 } }, + { 8054,-1885,-1025,-8349,16367,2040,-2805,3542,7629 } }, { "Leica DIGILUX 3", 0, 0xf7f, - { 8054,-1885,-1025,-8349,16367,2040,-2805,3542,7629 } }, + { 8054,-1885,-1025,-8349,16367,2040,-2805,3542,7629 } }, { "Panasonic DMC-LC1", 0, 0, - { 11340,-4069,-1275,-7555,15266,2448,-2960,3426,7685 } }, + { 11340,-4069,-1275,-7555,15266,2448,-2960,3426,7685 } }, { "Leica DIGILUX 2", 0, 0, - { 11340,-4069,-1275,-7555,15266,2448,-2960,3426,7685 } }, - { "Panasonic DMC-LF1", 143, 0, - { 9379,-3267,-816,-3227,11560,1881,-926,1928,5340 } }, - { "Leica C", 143, 0, - { 9379,-3267,-816,-3227,11560,1881,-926,1928,5340 } }, + { 11340,-4069,-1275,-7555,15266,2448,-2960,3426,7685 } }, + { "Panasonic DMC-LX100", -15, 0, + { 8844,-3538,-768,-3709,11762,2200,-698,1792,5220 } }, + { "Leica D-LUX (Typ 109)", -15, 0, + { 8844,-3538,-768,-3709,11762,2200,-698,1792,5220 } }, + { "Panasonic DMC-LF1", -15, 0, + { 9379,-3267,-816,-3227,11560,1881,-926,1928,5340 } }, + { "Leica C (Typ 112)", -15, 0, + { 9379,-3267,-816,-3227,11560,1881,-926,1928,5340 } }, { "Panasonic DMC-LX1", 0, 0xf7f, - { 10704,-4187,-1230,-8314,15952,2501,-920,945,8927 } }, + { 10704,-4187,-1230,-8314,15952,2501,-920,945,8927 } }, + { "Leica D-Lux (Typ 109)", 0, 0xf7f, + { 8844,-3538,-768,-3709,11762,2200,-698,1792,5220 } }, { "Leica D-LUX2", 0, 0xf7f, - { 10704,-4187,-1230,-8314,15952,2501,-920,945,8927 } }, + { 10704,-4187,-1230,-8314,15952,2501,-920,945,8927 } }, { "Panasonic DMC-LX2", 0, 0, - { 8048,-2810,-623,-6450,13519,3272,-1700,2146,7049 } }, + { 8048,-2810,-623,-6450,13519,3272,-1700,2146,7049 } }, { "Leica D-LUX3", 0, 0, - { 8048,-2810,-623,-6450,13519,3272,-1700,2146,7049 } }, - { "Panasonic DMC-LX3", 15, 0, - { 8128,-2668,-655,-6134,13307,3161,-1782,2568,6083 } }, - { "Leica D-LUX 4", 15, 0, - { 8128,-2668,-655,-6134,13307,3161,-1782,2568,6083 } }, - { "Panasonic DMC-LX5", 143, 0, - { 10909,-4295,-948,-1333,9306,2399,22,1738,4582 } }, - { "Leica D-LUX 5", 143, 0, - { 10909,-4295,-948,-1333,9306,2399,22,1738,4582 } }, - { "Panasonic DMC-LX7", 143, 0, - { 10148,-3743,-991,-2837,11366,1659,-701,1893,4899 } }, - { "Leica D-LUX 6", 143, 0, - { 10148,-3743,-991,-2837,11366,1659,-701,1893,4899 } }, - { "Panasonic DMC-FZ100", 143, 0xfff, - { 16197,-6146,-1761,-2393,10765,1869,366,2238,5248 } }, - { "Leica V-LUX 2", 143, 0xfff, - { 16197,-6146,-1761,-2393,10765,1869,366,2238,5248 } }, - { "Panasonic DMC-FZ150", 143, 0xfff, - { 11904,-4541,-1189,-2355,10899,1662,-296,1586,4289 } }, - { "Leica V-LUX 3", 143, 0xfff, - { 11904,-4541,-1189,-2355,10899,1662,-296,1586,4289 } }, - { "Panasonic DMC-FZ200", 143, 0xfff, - { 8112,-2563,-740,-3730,11784,2197,-941,2075,4933 } }, - { "Leica V-LUX 4", 143, 0xfff, - { 8112,-2563,-740,-3730,11784,2197,-941,2075,4933 } }, - { "Panasonic DMC-FX150", 15, 0xfff, - { 9082,-2907,-925,-6119,13377,3058,-1797,2641,5609 } }, + { 8048,-2810,-623,-6450,13519,3272,-1700,2146,7049 } }, + { "Panasonic DMC-LX3", -15, 0, + { 8128,-2668,-655,-6134,13307,3161,-1782,2568,6083 } }, + { "Leica D-LUX 4", -15, 0, + { 8128,-2668,-655,-6134,13307,3161,-1782,2568,6083 } }, + { "Panasonic DMC-LX5", -15, 0, + { 10909,-4295,-948,-1333,9306,2399,22,1738,4582 } }, + { "Leica D-LUX 5", -15, 0, + { 10909,-4295,-948,-1333,9306,2399,22,1738,4582 } }, + { "Panasonic DMC-LX7", -15, 0, + { 10148,-3743,-991,-2837,11366,1659,-701,1893,4899 } }, + { "Leica D-LUX 6", -15, 0, + { 10148,-3743,-991,-2837,11366,1659,-701,1893,4899 } }, + { "Panasonic DMC-FZ1000", -15, 0, + { 7830,-2696,-763,-3325,11667,1866,-641,1712,4824 } }, + { "Leica V-LUX (Typ 114)", 15, 0, + { 7830,-2696,-763,-3325,11667,1866,-641,1712,4824 } }, + { "Panasonic DMC-FZ100", -15, 0xfff, + { 16197,-6146,-1761,-2393,10765,1869,366,2238,5248 } }, + { "Leica V-LUX 2", -15, 0xfff, + { 16197,-6146,-1761,-2393,10765,1869,366,2238,5248 } }, + { "Panasonic DMC-FZ150", -15, 0xfff, + { 11904,-4541,-1189,-2355,10899,1662,-296,1586,4289 } }, + { "Leica V-LUX 3", -15, 0xfff, + { 11904,-4541,-1189,-2355,10899,1662,-296,1586,4289 } }, + { "Panasonic DMC-FZ200", -15, 0xfff, + { 8112,-2563,-740,-3730,11784,2197,-941,2075,4933 } }, + { "Leica V-LUX 4", -15, 0xfff, + { 8112,-2563,-740,-3730,11784,2197,-941,2075,4933 } }, + { "Panasonic DMC-FX150", -15, 0xfff, + { 9082,-2907,-925,-6119,13377,3058,-1797,2641,5609 } }, { "Panasonic DMC-G10", 0, 0, - { 10113,-3400,-1114,-4765,12683,2317,-377,1437,6710 } }, - { "Panasonic DMC-G1", 15, 0xf94, - { 8199,-2065,-1056,-8124,16156,2033,-2458,3022,7220 } }, - { "Panasonic DMC-G2", 15, 0xf3c, - { 10113,-3400,-1114,-4765,12683,2317,-377,1437,6710 } }, - { "Panasonic DMC-G3", 143, 0xfff, - { 6763,-1919,-863,-3868,11515,2684,-1216,2387,5879 } }, - { "Panasonic DMC-G5", 143, 0xfff, - { 7798,-2562,-740,-3879,11584,2613,-1055,2248,5434 } }, - { "Panasonic DMC-G6", 143, 0xfff, /* DJC */ - { 6395,-2583,-40,-3677,9109,4569,-1502,2806,6431 } }, - { "Panasonic DMC-GF1", 15, 0xf92, - { 7888,-1902,-1011,-8106,16085,2099,-2353,2866,7330 } }, - { "Panasonic DMC-GF2", 143, 0xfff, - { 7888,-1902,-1011,-8106,16085,2099,-2353,2866,7330 } }, - { "Panasonic DMC-GF3", 143, 0xfff, - { 9051,-2468,-1204,-5212,13276,2121,-1197,2510,6890 } }, - { "Panasonic DMC-GF5", 143, 0xfff, - { 8228,-2945,-660,-3938,11792,2430,-1094,2278,5793 } }, - { "Panasonic DMC-GF6", 143, 0, - { 8130,-2801,-946,-3520,11289,2552,-1314,2511,5791 } }, - { "Panasonic DMC-GH1", 15, 0xf92, - { 6299,-1466,-532,-6535,13852,2969,-2331,3112,5984 } }, - { "Panasonic DMC-GH2", 15, 0xf95, - { 7780,-2410,-806,-3913,11724,2484,-1018,2390,5298 } }, - { "Panasonic DMC-GH3", 144, 0, - { 6559,-1752,-491,-3672,11407,2586,-962,1875,5130 } }, - { "Panasonic DMC-GM1", 143, 0, - { 8977,-3976,-425,-3050,11095,1117,-1217,2563,4750 } }, - { "Panasonic DMC-GX1", 143, 0, - { 6763,-1919,-863,-3868,11515,2684,-1216,2387,5879 } }, - {"Panasonic DMC-GX7",143,0, - {7541,-2355,-591,-3163,10598,1894,-933,2109,5006}}, + { 10113,-3400,-1114,-4765,12683,2317,-377,1437,6710 } }, + { "Panasonic DMC-G1", -15, 0xf94, + { 8199,-2065,-1056,-8124,16156,2033,-2458,3022,7220 } }, + { "Panasonic DMC-G2", -15, 0xf3c, + { 10113,-3400,-1114,-4765,12683,2317,-377,1437,6710 } }, + { "Panasonic DMC-G3", -15, 0xfff, + { 6763,-1919,-863,-3868,11515,2684,-1216,2387,5879 } }, + { "Panasonic DMC-G5", -15, 0xfff, + { 7798,-2562,-740,-3879,11584,2613,-1055,2248,5434 } }, + { "Panasonic DMC-G6", -15, 0xfff, + { 8294,-2891,-651,-3869,11590,2595,-1183,2267,5352 } }, + { "Panasonic DMC-G7", -15, 0xfff, + {7610,-2780,-576,-4614,12195,2733,-1375,2393,6490 }}, + { "Panasonic DMC-GF1", -15, 0xf92, + { 7888,-1902,-1011,-8106,16085,2099,-2353,2866,7330 } }, + { "Panasonic DMC-GF2", -15, 0xfff, + { 7888,-1902,-1011,-8106,16085,2099,-2353,2866,7330 } }, + { "Panasonic DMC-GF3", -15, 0xfff, + { 9051,-2468,-1204,-5212,13276,2121,-1197,2510,6890 } }, + { "Panasonic DMC-GF5", -15, 0xfff, + { 8228,-2945,-660,-3938,11792,2430,-1094,2278,5793 } }, + { "Panasonic DMC-GF6", -15, 0, + { 8130,-2801,-946,-3520,11289,2552,-1314,2511,5791 } }, + { "Panasonic DMC-GF7", -15, 0, + { 7610,-2780,-576,-4614,12195,2733,-1375,2393,6490 } }, + { "Panasonic DMC-GH1", -15, 0xf92, + { 6299,-1466,-532,-6535,13852,2969,-2331,3112,5984 } }, + { "Panasonic DMC-GH2", -15, 0xf95, + { 7780,-2410,-806,-3913,11724,2484,-1018,2390,5298 } }, + { "Panasonic DMC-GH3", -15, 0, + { 6559,-1752,-491,-3672,11407,2586,-962,1875,5130 } }, + { "Panasonic DMC-GH4", -15, 0, + { 7122,-2108,-512,-3155,11201,2231,-541,1423,5045 } }, + { "Panasonic DMC-GM1", -15, 0, + { 6770,-1895,-744,-5232,13145,2303,-1664,2691,5703 } }, + { "Panasonic DMC-GM5", -15, 0, + { 8238,-3244,-679,-3921,11814,2384,-836,2022,5852 } }, + { "Panasonic DMC-GX1", -15, 0, + { 6763,-1919,-863,-3868,11515,2684,-1216,2387,5879 } }, + { "Panasonic DMC-GX7", -15,0, + { 7610,-2780,-576,-4614,12195,2733,-1375,2393,6490 } }, + { "Panasonic DMC-GX8", -15,0, + { 7564,-2263,-606,-3148,11239,2177,-540,1435,4853 } }, + { "Panasonic DMC-TZ6", -15, 0, + { 8607,-2822,-808,-3755,11930,2049,-820,2060,5224 } }, + { "Panasonic DMC-ZS4", -15, 0, + { 8607,-2822,-808,-3755,11930,2049,-820,2060,5224 } }, + { "Panasonic DMC-TZ7", -15, 0, + { 8802,-3135,-789,-3151,11468,1904,-550,1745,4810 } }, + { "Panasonic DMC-ZS5", -15, 0, + { 8802,-3135,-789,-3151,11468,1904,-550,1745,4810 } }, { "Phase One H 20", 0, 0, /* DJC */ - { 1313,1855,-109,-6715,15908,808,-327,1840,6020 } }, + { 1313,1855,-109,-6715,15908,808,-327,1840,6020 } }, { "Phase One H 25", 0, 0, - { 2905,732,-237,-8134,16626,1476,-3038,4253,7517 } }, + { 2905,732,-237,-8134,16626,1476,-3038,4253,7517 } }, + { "Phase One IQ250",0, 0, + { 4396,-153,-249,-5267,12249,2657,-1397,2323,6014 } }, { "Phase One P 2", 0, 0, - { 2905,732,-237,-8134,16626,1476,-3038,4253,7517 } }, + { 2905,732,-237,-8134,16626,1476,-3038,4253,7517 } }, { "Phase One P 30", 0, 0, - { 4516,-245,-37,-7020,14976,2173,-3206,4671,7087 } }, + { 4516,-245,-37,-7020,14976,2173,-3206,4671,7087 } }, { "Phase One P 45", 0, 0, - { 5053,-24,-117,-5684,14076,1702,-2619,4492,5849 } }, + { 5053,-24,-117,-5684,14076,1702,-2619,4492,5849 } }, { "Phase One P40", 0, 0, - { 8035,435,-962,-6001,13872,2320,-1159,3065,5434 } }, + { 8035,435,-962,-6001,13872,2320,-1159,3065,5434 } }, { "Phase One P65", 0, 0, - { 8035,435,-962,-6001,13872,2320,-1159,3065,5434 } }, + { 8035,435,-962,-6001,13872,2320,-1159,3065,5434 } }, + { "Photron BC2-HD", 0, 0, /* DJC */ + { 14603,-4122,-528,-1810,9794,2017,-297,2763,5936 } }, { "Red One", 704, 0xffff, /* DJC */ - { 21014,-7891,-2613,-3056,12201,856,-2203,5125,8042 } }, + { 21014,-7891,-2613,-3056,12201,856,-2203,5125,8042 } }, { "Samsung EK-GN120", 0, 0, /* Adobe; Galaxy NX */ - { 7557,-2522,-739,-4679,12949,1894,-840,1777,5311 } }, + { 7557,-2522,-739,-4679,12949,1894,-840,1777,5311 } }, { "Samsung EX1", 0, 0x3e00, - { 8898,-2498,-994,-3144,11328,2066,-760,1381,4576 } }, + { 8898,-2498,-994,-3144,11328,2066,-760,1381,4576 } }, { "Samsung EX2F", 0, 0x7ff, - { 10648,-3897,-1055,-2022,10573,1668,-492,1611,4742 } }, - { "Samsung NX300", 0, 0, - { 8873,-3984,-372,-3759,12305,1013,-994,1981,4788 } }, + { 10648,-3897,-1055,-2022,10573,1668,-492,1611,4742 } }, + { "Samsung NX mini", 0, 0, + { 5222,-1196,-550,-6540,14649,2009,-1666,2819,5657 } }, + { "Samsung NX3000", 0, 0, + { 8060,-2933,-761,-4504,12890,1762,-630,1489,5227 } }, + { "Samsung NX30", 0, 0, /* NX30, NX300, NX300M */ + { 7557,-2522,-739,-4679,12949,1894,-840,1777,5311 } }, { "Samsung NX2000", 0, 0, - { 7557,-2522,-739,-4679,12949,1894,-840,1777,5311 } }, + { 7557,-2522,-739,-4679,12949,1894,-840,1777,5311 } }, { "Samsung NX2", 0, 0xfff, /* NX20, NX200, NX210 */ - { 6933,-2268,-753,-4921,13387,1647,-803,1641,6096 } }, + { 6933,-2268,-753,-4921,13387,1647,-803,1641,6096 } }, { "Samsung NX1000", 0, 0, - { 6933,-2268,-753,-4921,13387,1647,-803,1641,6096 } }, + { 6933,-2268,-753,-4921,13387,1647,-803,1641,6096 } }, { "Samsung NX1100", 0, 0, - { 6933,-2268,-753,-4921,13387,1647,-803,1641,6096 } }, - { "Samsung NX", 0, 0, /* NX5, NX10, NX11, NX100 */ + { 6933,-2268,-753,-4921,13387,1647,-803,1641,6096 } }, + { "Samsung NX11", 0, 0, + { 10332,-3234,-1168,-6111,14639,1520,-1352,2647,8331 } }, + { "Samsung NX10", 0, 0, /* also NX100 */ + { 10332,-3234,-1168,-6111,14639,1520,-1352,2647,8331 } }, + { "Samsung NX500", 0, 0, + { 10686,-4042,-1052,-3595,13238,276,-464,1259,5931 } }, + { "Samsung NX5", 0, 0, { 10332,-3234,-1168,-6111,14639,1520,-1352,2647,8331 } }, + { "Samsung NX1", 0, 0, + { 10686,-4042,-1052,-3595,13238,276,-464,1259,5931 } }, { "Samsung WB2000", 0, 0xfff, - { 12093,-3557,-1155,-1000,9534,1733,-22,1787,4576 } }, + { 12093,-3557,-1155,-1000,9534,1733,-22,1787,4576 } }, { "Samsung GX-1", 0, 0, - { 10504,-2438,-1189,-8603,16207,2531,-1022,863,12242 } }, + { 10504,-2438,-1189,-8603,16207,2531,-1022,863,12242 } }, + { "Samsung GX20", 0, 0, /* copied from Pentax K20D */ + { 9427,-2714,-868,-7493,16092,1373,-2199,3264,7180 } }, { "Samsung S85", 0, 0, /* DJC */ - { 11885,-3968,-1473,-4214,12299,1916,-835,1655,5549 } }, + { 11885,-3968,-1473,-4214,12299,1916,-835,1655,5549 } }, // Foveon: LibRaw color data + { "Sigma dp0 Quattro", 2047, 0, + { 13801,-3390,-1016,5535,3802,877,1848,4245,3730 } }, + { "Sigma dp1 Quattro", 2047, 0, + { 13801,-3390,-1016,5535,3802,877,1848,4245,3730 } }, + { "Sigma dp2 Quattro", 2047, 0, + { 13801,-3390,-1016,5535,3802,877,1848,4245,3730 } }, + { "Sigma dp3 Quattro", 2047, 0, + { 13801,-3390,-1016,5535,3802,877,1848,4245,3730 } }, { "Sigma SD9", 15, 4095, /* LibRaw */ - { 14082,-2201,-1056,-5243,14788,167,-121,196,8881 } }, - //{ 7401,-1169,-567,2059,3769,1510,664,3367,5328 } }, + { 14082,-2201,-1056,-5243,14788,167,-121,196,8881 } }, { "Sigma SD10", 15, 16383, /* LibRaw */ - { 14082,-2201,-1056,-5243,14788,167,-121,196,8881 } }, - //{ 7401,-1169,-567,2059,3769,1510,664,3367,5328 } }, + { 14082,-2201,-1056,-5243,14788,167,-121,196,8881 } }, { "Sigma SD14", 15, 16383, /* LibRaw */ - { 14082,-2201,-1056,-5243,14788,167,-121,196,8881 } }, - //{ 7401,-1169,-567,2059,3769,1510,664,3367,5328 } }, + { 14082,-2201,-1056,-5243,14788,167,-121,196,8881 } }, { "Sigma SD15", 15, 4095, /* LibRaw */ - { 14082,-2201,-1056,-5243,14788,167,-121,196,8881 } }, - //{ 7401,-1169,-567,2059,3769,1510,664,3367,5328 } }, + { 14082,-2201,-1056,-5243,14788,167,-121,196,8881 } }, // Merills + SD1 { "Sigma SD1", 31, 4095, /* LibRaw */ - { 5133,-1895,-353,4978,744,144,3837,3069,2777 } }, + { 5133,-1895,-353,4978,744,144,3837,3069,2777 } }, { "Sigma DP1 Merrill", 31, 4095, /* LibRaw */ - { 5133,-1895,-353,4978,744,144,3837,3069,2777 } }, + { 5133,-1895,-353,4978,744,144,3837,3069,2777 } }, { "Sigma DP2 Merrill", 31, 4095, /* LibRaw */ - { 5133,-1895,-353,4978,744,144,3837,3069,2777 } }, + { 5133,-1895,-353,4978,744,144,3837,3069,2777 } }, { "Sigma DP3 Merrill", 31, 4095, /* LibRaw */ - { 5133,-1895,-353,4978,744,144,3837,3069,2777 } }, + { 5133,-1895,-353,4978,744,144,3837,3069,2777 } }, // Sigma DP (non-Merill Versions) { "Sigma DP", 0, 4095, /* LibRaw */ // { 7401,-1169,-567,2059,3769,1510,664,3367,5328 } }, - { 13100,-3638,-847,6855,2369,580,2723,3218,3251 } }, + { 13100,-3638,-847,6855,2369,580,2723,3218,3251 } }, { "Sinar", 0, 0, /* DJC */ - { 16442,-2956,-2422,-2877,12128,750,-1136,6066,4559 } }, + { 16442,-2956,-2422,-2877,12128,750,-1136,6066,4559 } }, { "Sony DSC-F828", 0, 0, - { 7924,-1910,-777,-8226,15459,2998,-1517,2199,6818,-7242,11401,3481 } }, + { 7924,-1910,-777,-8226,15459,2998,-1517,2199,6818,-7242,11401,3481 } }, { "Sony DSC-R1", -512, 0, - { 8512,-2641,-694,-8042,15670,2526,-1821,2117,7414 } }, + { 8512,-2641,-694,-8042,15670,2526,-1821,2117,7414 } }, { "Sony DSC-V3", 0, 0, - { 7511,-2571,-692,-7894,15088,3060,-948,1111,8128 } }, - { "Sony DSC-RX100M2", -200, 0, - { 8651,-2754,-1057,-3464,12207,1373,-568,1398,4434 } }, - { "Sony DSC-RX100", -200, 0, - { 8651,-2754,-1057,-3464,12207,1373,-568,1398,4434 } }, - {"Sony DSC-RX10",0, 0, - { 8562,-3595,-385,-2715,11089,1128,-1023,2081,4400 } }, - { "Sony DSC-RX1R", -128, 0, - { 8195,-2800,-422,-4261,12273,1709,-1505,2400,5624 } }, - { "Sony DSC-RX1", -128, 0, - { 6344,-1612,-462,-4863,12477,2681,-865,1786,6899 } }, + { 7511,-2571,-692,-7894,15088,3060,-948,1111,8128 } }, + { "Sony DSC-RX100M", -800, 0, /* M2 and M3 and M4 */ + { 6596,-2079,-562,-4782,13016,1933,-970,1581,5181 } }, + { "Sony DSC-RX100", -800, 0, + { 8651,-2754,-1057,-3464,12207,1373,-568,1398,4434 } }, + { "Sony DSC-RX10",0, 0, + { 6679,-1825,-745,-5047,13256,1953,-1580,2422,5183 } }, + { "Sony DSC-RX1R", -512, 0, + { 8195,-2800,-422,-4261,12273,1709,-1505,2400,5624 } }, + { "Sony DSC-RX1", -512, 0, + { 6344,-1612,-462,-4863,12477,2681,-865,1786,6899 } }, { "Sony DSLR-A100", 0, 0xfeb, - { 9437,-2811,-774,-8405,16215,2290,-710,596,7181 } }, + { 9437,-2811,-774,-8405,16215,2290,-710,596,7181 } }, { "Sony DSLR-A290", 0, 0, - { 6038,-1484,-579,-9145,16746,2512,-875,746,7218 } }, + { 6038,-1484,-579,-9145,16746,2512,-875,746,7218 } }, { "Sony DSLR-A2", 0, 0, - { 9847,-3091,-928,-8485,16345,2225,-715,595,7103 } }, + { 9847,-3091,-928,-8485,16345,2225,-715,595,7103 } }, { "Sony DSLR-A300", 0, 0, - { 9847,-3091,-928,-8485,16345,2225,-715,595,7103 } }, + { 9847,-3091,-928,-8485,16345,2225,-715,595,7103 } }, { "Sony DSLR-A330", 0, 0, - { 9847,-3091,-929,-8485,16346,2225,-714,595,7103 } }, + { 9847,-3091,-929,-8485,16346,2225,-714,595,7103 } }, { "Sony DSLR-A350", 0, 0xffc, - { 6038,-1484,-578,-9146,16746,2513,-875,746,7217 } }, + { 6038,-1484,-578,-9146,16746,2513,-875,746,7217 } }, { "Sony DSLR-A380", 0, 0, - { 6038,-1484,-579,-9145,16746,2512,-875,746,7218 } }, + { 6038,-1484,-579,-9145,16746,2512,-875,746,7218 } }, { "Sony DSLR-A390", 0, 0, - { 6038,-1484,-579,-9145,16746,2512,-875,746,7218 } }, - { "Sony DSLR-A450", -128, 0xfeb, - { 4950,-580,-103,-5228,12542,3029,-709,1435,7371 } }, - { "Sony DSLR-A580", -128, 0xfeb, - { 5932,-1492,-411,-4813,12285,2856,-741,1524,6739 } }, - { "Sony DSLR-A5", -128, 0xfeb, - { 4950,-580,-103,-5228,12542,3029,-709,1435,7371 } }, - { "Sony DSLR-A700", -128, 0, - { 5775,-805,-359,-8574,16295,2391,-1943,2341,7249 } }, - { "Sony DSLR-A850", -128, 0, - { 5413,-1162,-365,-5665,13098,2866,-608,1179,8440 } }, - { "Sony DSLR-A900", -128, 0, - { 5209,-1072,-397,-8845,16120,2919,-1618,1803,8654 } }, - {"Sony ILCE-3000",-128, 0, - { 14009,-8208,729,3738,4752,2932,5743,-3800,6494 } }, - {"Sony ILCE-A7R",-128, 0, - { 8592,-3219,-348,-3846,12042,1475,-1079,2166,5893 } }, - {"Sony ILCE-A7",-128, 0, - { 8592,-3219,-348,-3846,12042,1475,-1079,2166,5893 } }, - { "Sony NEX-5T", -128, 0, - { 7623,-2693,-347,-4060,11875,1928,-1363,2329,5752 } }, - { "Sony NEX-5N", -128, 0, - { 5991,-1456,-455,-4764,12135,2980,-707,1425,6701 } }, - { "Sony NEX-5R", -128, 0, - { 6129,-1545,-418,-4930,12490,2743,-977,1693,6615 } }, - { "Sony NEX-3N", -128, 0, - { 6129,-1545,-418,-4930,12490,2743,-977,1693,6615 } }, - { "Sony NEX-3", -128, 0, /* Adobe */ - { 6549,-1550,-436,-4880,12435,2753,-854,1868,6976 } }, - { "Sony NEX-5", -128, 0, /* Adobe */ - { 6549,-1550,-436,-4880,12435,2753,-854,1868,6976 } }, - { "Sony NEX-6", -128, 0, - { 6129,-1545,-418,-4930,12490,2743,-977,1693,6615 } }, - { "Sony NEX-7", -128, 0, - { 5491,-1192,-363,-4951,12342,2948,-911,1722,7192 } }, - { "Sony NEX", -128, 0, /* NEX-C3, NEX-F3 */ - { 5991,-1456,-455,-4764,12135,2980,-707,1425,6701 } }, - { "Sony SLT-A33", -128, 0, - { 6069,-1221,-366,-5221,12779,2734,-1024,2066,6834 } }, - { "Sony SLT-A35", -128, 0, - { 5986,-1618,-415,-4557,11820,3120,-681,1404,6971 } }, - { "Sony SLT-A37", -128, 0, - { 5991,-1456,-455,-4764,12135,2980,-707,1425,6701 } }, - { "Sony SLT-A55", -128, 0, - { 5932,-1492,-411,-4813,12285,2856,-741,1524,6739 } }, - { "Sony SLT-A57", -128, 0, - { 5991,-1456,-455,-4764,12135,2980,-707,1425,6701 } }, - { "Sony SLT-A58", -128, 0, - { 5991,-1456,-455,-4764,12135,2980,-707,1425,6701 } }, - { "Sony SLT-A65", -128, 0, - { 5491,-1192,-363,-4951,12342,2948,-911,1722,7192 } }, - { "Sony SLT-A77", -128, 0, - { 5491,-1192,-363,-4951,12342,2948,-911,1722,7192 } }, - { "Sony SLT-A99", -128, 0, - { 6344,-1612,-462,-4863,12477,2681,-865,1786,6899 } }, + { 6038,-1484,-579,-9145,16746,2512,-875,746,7218 } }, + { "Sony DSLR-A450", -512, 0xfeb, + { 4950,-580,-103,-5228,12542,3029,-709,1435,7371 } }, + { "Sony DSLR-A580", -512, 0xfeb, + { 5932,-1492,-411,-4813,12285,2856,-741,1524,6739 } }, + { "Sony DSLR-A500", -512, 0xfeb, + { 6046,-1127,-278,-5574,13076,2786,-691,1419,7625 } }, + { "Sony DSLR-A5", -512, 0xfeb, + { 4950,-580,-103,-5228,12542,3029,-709,1435,7371 } }, + { "Sony DSLR-A700", -512, 0, + { 5775,-805,-359,-8574,16295,2391,-1943,2341,7249 } }, + { "Sony DSLR-A850", -512, 0, + { 5413,-1162,-365,-5665,13098,2866,-608,1179,8440 } }, + { "Sony DSLR-A900", -512, 0, + { 5209,-1072,-397,-8845,16120,2919,-1618,1803,8654 } }, + { "Sony ILCA-77M2", -512, 0, + { 5991,-1732,-443,-4100,11989,2381,-704,1467,5992 } }, + { "Sony ILCE-7M2", -512, 0, + { 5271,-712,-347,-6153,13653,2763,-1601,2366,7242 } }, + { "Sony ILCE-7S", -512, 0, + { 5838,-1430,-246,-3497,11477,2297,-748,1885,5778 } }, + { "Sony ILCE-7RM2", -512, 0, + { 6629,-1900,-483,-4618,12349,2550,-622,1381,6514 } }, + { "Sony ILCE-7R", -512, 0, + { 4913,-541,-202,-6130,13513,2906,-1564,2151,7183 } }, + { "Sony ILCE-7", -512, 0, + { 5271,-712,-347,-6153,13653,2763,-1601,2366,7242 } }, + { "Sony ILCE", -512, 0, /* 3000, 5000, 5100, 6000, and QX1 */ + { 5991,-1456,-455,-4764,12135,2980,-707,1425,6701 } }, + { "Sony NEX-5N", -512, 0, + { 5991,-1456,-455,-4764,12135,2980,-707,1425,6701 } }, + { "Sony NEX-5R", -512, 0, + { 6129,-1545,-418,-4930,12490,2743,-977,1693,6615 } }, + { "Sony NEX-5T", -512, 0, + { 6129,-1545,-418,-4930,12490,2743,-977,1693,6615 } }, + { "Sony NEX-3N", -512, 0, + { 6129,-1545,-418,-4930,12490,2743,-977,1693,6615 } }, + { "Sony NEX-3", -512, 0, /* Adobe */ + { 6549,-1550,-436,-4880,12435,2753,-854,1868,6976 } }, + { "Sony NEX-5", -512, 0, /* Adobe */ + { 6549,-1550,-436,-4880,12435,2753,-854,1868,6976 } }, + { "Sony NEX-6", -512, 0, + { 6129,-1545,-418,-4930,12490,2743,-977,1693,6615 } }, + { "Sony NEX-7", -512, 0, + { 5491,-1192,-363,-4951,12342,2948,-911,1722,7192 } }, + { "Sony NEX", -512, 0, /* NEX-C3, NEX-F3 */ + { 5991,-1456,-455,-4764,12135,2980,-707,1425,6701 } }, + { "Sony SLT-A33", -512, 0, + { 6069,-1221,-366,-5221,12779,2734,-1024,2066,6834 } }, + { "Sony SLT-A35", -512, 0, + { 5986,-1618,-415,-4557,11820,3120,-681,1404,6971 } }, + { "Sony SLT-A37", -512, 0, + { 5991,-1456,-455,-4764,12135,2980,-707,1425,6701 } }, + { "Sony SLT-A55", -512, 0, + { 5932,-1492,-411,-4813,12285,2856,-741,1524,6739 } }, + { "Sony SLT-A57", -512, 0, + { 5991,-1456,-455,-4764,12135,2980,-707,1425,6701 } }, + { "Sony SLT-A58", -512, 0, + { 5991,-1456,-455,-4764,12135,2980,-707,1425,6701 } }, + { "Sony SLT-A65", -512, 0, + { 5491,-1192,-363,-4951,12342,2948,-911,1722,7192 } }, + { "Sony SLT-A77", -512, 0, + { 5491,-1192,-363,-4951,12342,2948,-911,1722,7192 } }, + { "Sony SLT-A99", -512, 0, + { 6344,-1612,-462,-4863,12477,2681,-865,1786,6899 } }, }; double cam_xyz[4][3]; char name[130]; int i, j; + if(colors>4 || colors < 1) return; + + int bl4=(cblack[0]+cblack[1]+cblack[2]+cblack[3])/4,bl64=0; + if(cblack[4]*cblack[5]>0) + { + for (unsigned c = 0; c < 4096 && c < cblack[4]*cblack[5]; c++) + bl64+=cblack[c+6]; + bl64 /= cblack[4]*cblack[5]; + } + int rblack = black+bl4+bl64; + sprintf (name, "%s %s", t_make, t_model); for (i=0; i < sizeof table / sizeof *table; i++) if (!strncasecmp(name, table[i].prefix, strlen(table[i].prefix))) { - if (table[i].t_black>0) black = (ushort) table[i].t_black; - else if(table[i].t_black <0 && black == 0 ) black = (ushort) (-table[i].t_black); + if (table[i].t_black>0) + { + black = (ushort) table[i].t_black; + memset(cblack,0,sizeof(cblack)); + } + else if(table[i].t_black <0 && rblack == 0 ) + { + black = (ushort) (-table[i].t_black); + memset(cblack,0,sizeof(cblack)); + } if (table[i].t_maximum) maximum = (ushort) table[i].t_maximum; if (table[i].trans[0]) { - for (j=0; j < 12; j++) + for (raw_color = j=0; j < 12; j++) #ifdef LIBRAW_LIBRARY_BUILD - imgdata.color.cam_xyz[0][j] = + if(internal_only) + imgdata.color.cam_xyz[0][j] = table[i].trans[j] / 10000.0; + else + imgdata.color.cam_xyz[0][j] = #endif - cam_xyz[0][j] = table[i].trans[j] / 10000.0; - cam_xyz_coeff (cam_xyz); + ((double*)cam_xyz)[j] = table[i].trans[j] / 10000.0; +#ifdef LIBRAW_LIBRARY_BUILD + if(!internal_only) +#endif + cam_xyz_coeff (rgb_cam, cam_xyz); } break; } @@ -7649,13 +11751,13 @@ { 4508, 2962, 0, 0, -3, -4 }, { 4508, 3330, 0, 0, -3, -6 }, }; - static const ushort canon[][6] = { + static const ushort canon[][11] = { { 1944, 1416, 0, 0, 48, 0 }, - { 2144, 1560, 4, 8, 52, 2 }, + { 2144, 1560, 4, 8, 52, 2, 0, 0, 0, 25 }, { 2224, 1456, 48, 6, 0, 2 }, { 2376, 1728, 12, 6, 52, 2 }, { 2672, 1968, 12, 6, 44, 2 }, - { 3152, 2068, 64, 12, 0, 0 }, + { 3152, 2068, 64, 12, 0, 0, 16 }, { 3160, 2344, 44, 12, 4, 4 }, { 3344, 2484, 4, 6, 52, 6 }, { 3516, 2328, 42, 14, 0, 0 }, @@ -7663,107 +11765,146 @@ { 3744, 2784, 52, 12, 8, 12 }, { 3944, 2622, 30, 18, 6, 2 }, { 3948, 2622, 42, 18, 0, 2 }, - { 3984, 2622, 76, 20, 0, 2 }, + { 3984, 2622, 76, 20, 0, 2, 14 }, { 4104, 3048, 48, 12, 24, 12 }, { 4116, 2178, 4, 2, 0, 0 }, { 4152, 2772, 192, 12, 0, 0 }, { 4160, 3124, 104, 11, 8, 65 }, - { 4176, 3062, 96, 17, 8, 0 }, + { 4176, 3062, 96, 17, 8, 0, 0, 16, 0, 7, 0x49 }, + { 4192, 3062, 96, 17, 24, 0, 0, 16, 0, 0, 0x49 }, { 4312, 2876, 22, 18, 0, 2 }, { 4352, 2874, 62, 18, 0, 0 }, { 4476, 2954, 90, 34, 0, 0 }, - { 4480, 3348, 12, 10, 36, 12 }, + { 4480, 3348, 12, 10, 36, 12, 0, 0, 0, 18, 0x49 }, + { 4480, 3366, 80, 50, 0, 0 }, { 4496, 3366, 80, 50, 12, 0 }, + { 4768, 3516, 96, 16, 0, 0, 0, 16 }, { 4832, 3204, 62, 26, 0, 0 }, { 4832, 3228, 62, 51, 0, 0 }, { 5108, 3349, 98, 13, 0, 0 }, { 5120, 3318, 142, 45, 62, 0 }, - { 5280, 3528, 72, 52, 0, 0 }, + { 5280, 3528, 72, 52, 0, 0 }, /* EOS M */ { 5344, 3516, 142, 51, 0, 0 }, { 5344, 3584, 126,100, 0, 2 }, { 5360, 3516, 158, 51, 0, 0 }, { 5568, 3708, 72, 38, 0, 0 }, + { 5632, 3710, 96, 17, 0, 0, 0, 16, 0, 0, 0x49 }, { 5712, 3774, 62, 20, 10, 2 }, { 5792, 3804, 158, 51, 0, 0 }, { 5920, 3950, 122, 80, 2, 0 }, + { 6096, 4056, 72, 34, 0, 0 }, /* EOS M3 */ + { 8896, 5920, 160, 64, 0, 0 }, }; static const struct { ushort id; char t_model[20]; } unique[] = { - { 0x168, "EOS 10D" }, { 0x001, "EOS-1D" }, - { 0x175, "EOS 20D" }, { 0x174, "EOS-1D Mark II" }, - { 0x234, "EOS 30D" }, { 0x232, "EOS-1D Mark II N" }, - { 0x190, "EOS 40D" }, { 0x169, "EOS-1D Mark III" }, - { 0x261, "EOS 50D" }, { 0x281, "EOS-1D Mark IV" }, - { 0x287, "EOS 60D" }, { 0x167, "EOS-1DS" }, - { 0x170, "EOS 300D" }, { 0x188, "EOS-1Ds Mark II" }, - { 0x176, "EOS 450D" }, { 0x215, "EOS-1Ds Mark III" }, - { 0x189, "EOS 350D" }, { 0x324, "EOS-1D C" }, - { 0x236, "EOS 400D" }, { 0x269, "EOS-1D X" }, - { 0x252, "EOS 500D" }, { 0x213, "EOS 5D" }, - { 0x270, "EOS 550D" }, { 0x218, "EOS 5D Mark II" }, - { 0x286, "EOS 600D" }, { 0x285, "EOS 5D Mark III" }, - { 0x301, "EOS 650D" }, { 0x302, "EOS 6D" }, - { 0x325, "EOS 70D" }, { 0x326, "EOS 700D" }, { 0x250, "EOS 7D" }, + { 0x001, "EOS-1D" }, + { 0x167, "EOS-1DS" }, + { 0x168, "EOS 10D" }, + { 0x169, "EOS-1D Mark III" }, + { 0x170, "EOS 300D" }, + { 0x174, "EOS-1D Mark II" }, + { 0x175, "EOS 20D" }, + { 0x176, "EOS 450D" }, + { 0x188, "EOS-1Ds Mark II" }, + { 0x189, "EOS 350D" }, + { 0x190, "EOS 40D" }, + { 0x213, "EOS 5D" }, + { 0x215, "EOS-1Ds Mark III" }, + { 0x218, "EOS 5D Mark II" }, + { 0x232, "EOS-1D Mark II N" }, + { 0x234, "EOS 30D" }, + { 0x236, "EOS 400D" }, + { 0x250, "EOS 7D" }, + { 0x252, "EOS 500D" }, { 0x254, "EOS 1000D" }, + { 0x261, "EOS 50D" }, + { 0x269, "EOS-1D X" }, + { 0x270, "EOS 550D" }, + { 0x281, "EOS-1D Mark IV" }, + { 0x285, "EOS 5D Mark III" }, + { 0x286, "EOS 600D" }, + { 0x287, "EOS 60D" }, { 0x288, "EOS 1100D" }, - { 0x346, "EOS 100D" }, + { 0x289, "EOS 7D Mark II" }, + { 0x301, "EOS 650D" }, + { 0x302, "EOS 6D" }, + { 0x324, "EOS-1D C" }, + { 0x325, "EOS 70D" }, + { 0x326, "EOS 700D" }, + { 0x327, "EOS 1200D" }, { 0x331, "EOS M" }, + { 0x335, "EOS M2" }, + { 0x374, "EOS M3"}, /* temp */ + { 0x346, "EOS 100D" }, + { 0x347, "EOS 760D" }, + { 0x382, "EOS 5DS" }, + { 0x393, "EOS 750D" }, + { 0x401, "EOS 5DS R" }, + }, sonique[] = { + { 0x002, "DSC-R1" }, + { 0x100, "DSLR-A100" }, + { 0x101, "DSLR-A900" }, + { 0x102, "DSLR-A700" }, + { 0x103, "DSLR-A200" }, + { 0x104, "DSLR-A350" }, + { 0x105, "DSLR-A300" }, + { 0x106, "DSLR-A900" }, + { 0x107, "DSLR-A380" }, + { 0x108, "DSLR-A330" }, + { 0x109, "DSLR-A230" }, + { 0x10a, "DSLR-A290" }, + { 0x10d, "DSLR-A850" }, + { 0x10e, "DSLR-A850" }, + { 0x111, "DSLR-A550" }, + { 0x112, "DSLR-A500" }, + { 0x113, "DSLR-A450" }, + { 0x116, "NEX-5" }, + { 0x117, "NEX-3" }, + { 0x118, "SLT-A33" }, + { 0x119, "SLT-A55V" }, + { 0x11a, "DSLR-A560" }, + { 0x11b, "DSLR-A580" }, + { 0x11c, "NEX-C3" }, + { 0x11d, "SLT-A35" }, + { 0x11e, "SLT-A65V" }, + { 0x11f, "SLT-A77V" }, + { 0x120, "NEX-5N" }, + { 0x121, "NEX-7" }, + { 0x122, "NEX-VG20E"}, + { 0x123, "SLT-A37" }, + { 0x124, "SLT-A57" }, + { 0x125, "NEX-F3" }, + { 0x126, "SLT-A99V" }, + { 0x127, "NEX-6" }, + { 0x128, "NEX-5R" }, + { 0x129, "DSC-RX100" }, + { 0x12a, "DSC-RX1" }, + { 0x12b, "NEX-VG900" }, + { 0x12c, "NEX-VG30E" }, + { 0x12e, "ILCE-3000" }, + { 0x12f, "SLT-A58" }, + { 0x131, "NEX-3N" }, + { 0x132, "ILCE-7" }, + { 0x133, "NEX-5T" }, + { 0x134, "DSC-RX100M2" }, + { 0x135, "DSC-RX10" }, + { 0x136, "DSC-RX1R" }, + { 0x137, "ILCE-7R" }, + { 0x138, "ILCE-6000" }, + { 0x139, "ILCE-5000" }, + { 0x13d, "DSC-RX100M3" }, + { 0x13e, "ILCE-7S" }, + { 0x13f, "ILCA-77M2" }, + { 0x153, "ILCE-5100" }, + { 0x154, "ILCE-7M2" }, + { 0x155, "DSC-RX100M4" }, + { 0x156, "DSC-RX10M2" }, + { 0x15a, "ILCE-QX1" }, + { 0x15b, "ILCE-7RM2" }, }; - static const struct { - ushort id; - char t_model[20]; - } sony_unique[] = { - {2,"DSC-R1"}, - {256,"DSLR-A100"}, - {257,"DSLR-A900"}, - {258,"DSLR-A700"}, - {259,"DSLR-A200"}, - {260,"DSLR-A350"}, - {261,"DSLR-A300"}, - {262,"DSLR-A900"}, - {263,"DSLR-A380"}, - {264,"DSLR-A330"}, - {265,"DSLR-A230"}, - {266,"DSLR-A290"}, - {269,"DSLR-A850"}, - {270,"DSLR-A850"}, - {273,"DSLR-A550"}, - {274,"DSLR-A500"}, - {275,"DSLR-A450"}, - {278,"NEX-5"}, - {279,"NEX-3"}, - {280,"SLT-A33"}, - {281,"SLT-A55"}, - {282,"DSLR-A560"}, - {283,"DSLR-A580"}, - {284,"NEX-C3"}, - {285,"SLT-A35"}, - {286,"SLT-A65"}, - {287,"SLT-A77"}, - {288,"NEX-5N"}, - {289,"NEX-7"}, - {290,"NEX-VG20E"}, - {291,"SLT-A37"}, - {292,"SLT-A57"}, - {293,"NEX-F3"}, - {294,"SLT-A99"}, - {295,"NEX-6"}, - {296,"NEX-5R"}, - {297,"DSC-RX100"}, - {298,"DSC-RX1"}, - {299,"NEX-VG900"}, - {300,"NEX-VG30E"}, - {302,"ILCE-3000"}, - {303,"SLT-A58"}, - {305,"NEX-3N"}, - {306,"ILCE-A7"}, - {307,"NEX-5T"}, - {308,"DSC-RX100M2"}, - {310,"DSC-RX1R"}, - {311,"ILCE-A7R"}, - }; + static const struct { unsigned fsize; ushort rw, rh; @@ -7780,6 +11921,18 @@ { 10134620,2588,1958, 0, 0, 0, 0, 9,0x94,0,0,"AVT","F-510C",12 }, { 16157136,3272,2469, 0, 0, 0, 0, 9,0x94,0,0,"AVT","F-810C" }, { 15980544,3264,2448, 0, 0, 0, 0, 8,0x61,0,1,"AgfaPhoto","DC-833m" }, + { 9631728,2532,1902, 0, 0, 0, 0,96,0x61,0,0,"Alcatel","5035D" }, + +// Android Raw dumps id start +// File Size in bytes Horizontal Res Vertical Flag then bayer order eg 0x16 bbgr 0x94 rggb + { 16424960,4208,3120, 0, 0, 0, 0, 1,0x16,0,0,"Sony","IMX135-mipi 13mp" }, + { 17522688,4212,3120, 0, 0, 0, 0, 0,0x16,0,0,"Sony","IMX135-QCOM" }, + { 10223360,2608,1960, 0, 0, 0, 0, 1,0x94,0,0,"Sony","IMX072-mipi" }, + { 5107712,2688,1520, 0, 0, 0, 0, 1,0x61,0,0,"HTC","UltraPixel" }, + { 1540857,2688,1520, 0, 0, 0, 0, 1,0x61,0,0,"Samsung","S3" }, + { 10223363,2688,1520, 0, 0, 0, 0, 1,0x61,0,0,"Samsung","GalaxyNexus" }, + // Android Raw dumps id end + { 2868726,1384,1036, 0, 0, 0, 0,64,0x49,0,8,"Baumer","TXG14",1078 }, { 5298000,2400,1766,12,12,44, 2,40,0x94,0,2,"Canon","PowerShot SD300" }, { 6553440,2664,1968, 4, 4,44, 4,40,0x94,0,2,"Canon","PowerShot A460" }, @@ -7795,7 +11948,7 @@ { 15467760,3720,2772, 6,12,30, 0,40,0x94,0,2,"Canon","PowerShot SX110 IS" }, { 15534576,3728,2778,12, 9,44, 9,40,0x94,0,2,"Canon","PowerShot SX120 IS" }, { 18653760,4080,3048,24,12,24,12,40,0x94,0,2,"Canon","PowerShot SX20 IS" }, - { 19131120,4168,3060,92,16, 4, 1, 8,0x94,0,2,"Canon","PowerShot SX220 HS" }, + { 19131120,4168,3060,92,16, 4, 1,40,0x94,0,2,"Canon","PowerShot SX220 HS" }, { 21936096,4464,3276,25,10,73,12,40,0x16,0,2,"Canon","PowerShot SX30 IS" }, { 24724224,4704,3504, 8,16,56, 8,40,0x49,0,2,"Canon","PowerShot A3300 IS" }, { 1976352,1632,1211, 0, 2, 0, 1, 0,0x94,0,1,"Casio","QV-2000UX" }, @@ -7820,18 +11973,26 @@ { 18702336,4096,3044, 0, 0,24, 0,80,0x94,7,1,"Casio","EX-ZR100" }, { 7684000,2260,1700, 0, 0, 0, 0,13,0x94,0,1,"Casio","QV-4000" }, { 787456,1024, 769, 0, 1, 0, 0, 0,0x49,0,0,"Creative","PC-CAM 600" }, + { 28829184,4384,3288, 0, 0, 0, 0,36,0x61,0,0,"DJI" }, + { 15151104,4608,3288, 0, 0, 0, 0, 0,0x94,0,0,"Matrix" }, { 3840000,1600,1200, 0, 0, 0, 0,65,0x49,0,0,"Foculus","531C" }, - { 307200, 640, 480, 0, 0, 0, 0, 0,0x94,0,0,"Generic","640x480" }, + { 307200, 640, 480, 0, 0, 0, 0, 0,0x94,0,0,"Generic" }, { 62464, 256, 244, 1, 1, 6, 1, 0,0x8d,0,0,"Kodak","DC20" }, { 124928, 512, 244, 1, 1,10, 1, 0,0x8d,0,0,"Kodak","DC20" }, { 1652736,1536,1076, 0,52, 0, 0, 0,0x61,0,0,"Kodak","DCS200" }, { 4159302,2338,1779, 1,33, 1, 2, 0,0x94,0,0,"Kodak","C330" }, { 4162462,2338,1779, 1,33, 1, 2, 0,0x94,0,0,"Kodak","C330",3160 }, + { 2247168,1232, 912, 0, 0,16, 0, 0,0x00,0,0,"Kodak","C330" }, + { 3370752,1232, 912, 0, 0,16, 0, 0,0x00,0,0,"Kodak","C330" }, { 6163328,2864,2152, 0, 0, 0, 0, 0,0x94,0,0,"Kodak","C603" }, { 6166488,2864,2152, 0, 0, 0, 0, 0,0x94,0,0,"Kodak","C603",3160 }, { 460800, 640, 480, 0, 0, 0, 0, 0,0x00,0,0,"Kodak","C603" }, { 9116448,2848,2134, 0, 0, 0, 0, 0,0x00,0,0,"Kodak","C603" }, + { 12241200,4040,3030, 2, 0, 0,13, 0,0x49,0,0,"Kodak","12MP" }, + { 12272756,4040,3030, 2, 0, 0,13, 0,0x49,0,0,"Kodak","12MP",31556 }, + { 18000000,4000,3000, 0, 0, 0, 0, 0,0x00,0,0,"Kodak","12MP" }, { 614400, 640, 480, 0, 3, 0, 0,64,0x94,0,0,"Kodak","KAI-0340" }, + { 15360000,3200,2400, 0, 0, 0, 0,96,0x16,0,0,"Lenovo","A820" }, { 3884928,1608,1207, 0, 0, 0, 0,96,0x16,0,0,"Micron","2010",3212 }, { 1138688,1534, 986, 0, 0, 0, 0, 0,0x61,0,0,"Minolta","RD175",513 }, { 1581060,1305, 969, 0, 0,18, 6, 6,0x1e,4,1,"Nikon","E900" }, @@ -7848,6 +12009,8 @@ { 4841984,2090,1544, 0, 0,22, 0, 0,0x94,7,1,"Pentax","Optio S" }, { 6114240,2346,1737, 0, 0,22, 0, 0,0x94,7,1,"Pentax","Optio S4" }, { 10702848,3072,2322, 0, 0, 0,21,30,0x94,0,1,"Pentax","Optio 750Z" }, + { 4147200,1920,1080, 0, 0, 0, 0, 0,0x49,0,0,"Photron","BC2-HD" }, + { 4151666,1920,1080, 0, 0, 0, 0, 0,0x49,0,0,"Photron","BC2-HD",8 }, { 13248000,2208,3000, 0, 0, 0, 0,13,0x61,0,0,"Pixelink","A782" }, { 6291456,2048,1536, 0, 0, 0, 0,96,0x61,0,0,"RoverShot","3320AF" }, { 311696, 644, 484, 0, 0, 0, 0, 0,0x16,0,8,"ST Micro","STV680 VGA" }, @@ -7855,9 +12018,9 @@ { 16215552,3312,2448, 0, 0,48, 0, 9,0x94,0,1,"Samsung","S85" }, { 20487168,3648,2808, 0, 0, 0, 0,13,0x94,5,1,"Samsung","WB550" }, { 24000000,4000,3000, 0, 0, 0, 0,13,0x94,5,1,"Samsung","WB550" }, - { 12582980,3072,2048, 0, 0, 0, 0,33,0x61,0,0,"Sinar","3072x2048",68 }, - { 33292868,4080,4080, 0, 0, 0, 0,33,0x61,0,0,"Sinar","4080x4080",68 }, - { 44390468,4080,5440, 0, 0, 0, 0,33,0x61,0,0,"Sinar","4080x5440",68 }, + { 12582980,3072,2048, 0, 0, 0, 0,33,0x61,0,0,"Sinar","",68 }, + { 33292868,4080,4080, 0, 0, 0, 0,33,0x61,0,0,"Sinar","",68 }, + { 44390468,4080,5440, 0, 0, 0, 0,33,0x61,0,0,"Sinar","",68 }, { 1409024,1376,1024, 0, 0, 1, 0, 0,0x49,0,0,"Sony","XCD-SX910CR" }, { 2818048,1376,1024, 0, 0, 1, 0,97,0x49,0,0,"Sony","XCD-SX910CR" }, }; @@ -7884,12 +12047,14 @@ thumb_offset = thumb_length = thumb_width = thumb_height = 0; load_raw = thumb_load_raw = 0; write_thumb = &CLASS jpeg_thumb; - data_offset = meta_length = tiff_bps = tiff_compress = 0; + data_offset = meta_offset = meta_length = tiff_bps = tiff_compress = 0; kodak_cbpp = zero_after_ff = dng_version = load_flags = 0; timestamp = shot_order = tiff_samples = black = is_foveon = 0; mix_green = profile_length = data_error = zero_is_bad = 0; pixel_aspect = is_raw = raw_color = 1; tile_width = tile_length = 0; + + for (i=0; i < 4; i++) { cam_mul[i] = i == 1; pre_mul[i] = i < 3; @@ -7912,6 +12077,10 @@ } else if (order == 0x4949 || order == 0x4d4d) { if (!memcmp (head+6,"HEAPCCDR",8)) { data_offset = hlen; +#ifdef LIBRAW_LIBRARY_BUILD + imgdata.lens.makernotes.CameraMount = LIBRAW_MOUNT_FixedLens; + imgdata.lens.makernotes.LensMount = LIBRAW_MOUNT_FixedLens; +#endif parse_ciff (hlen, flen-hlen, 0); load_raw = &CLASS canon_load_raw; } else if (parse_tiff(0)) apply_tiff(); @@ -7928,8 +12097,37 @@ strcpy (model,"N Digital"); fseek (ifp, 33, SEEK_SET); get_timestamp(1); - fseek (ifp, 60, SEEK_SET); + fseek (ifp, 52, SEEK_SET); + switch (get4()) { + case 7: iso_speed = 25; break; + case 8: iso_speed = 32; break; + case 9: iso_speed = 40; break; + case 10: iso_speed = 50; break; + case 11: iso_speed = 64; break; + case 12: iso_speed = 80; break; + case 13: iso_speed = 100; break; + case 14: iso_speed = 125; break; + case 15: iso_speed = 160; break; + case 16: iso_speed = 200; break; + case 17: iso_speed = 250; break; + case 18: iso_speed = 320; break; + case 19: iso_speed = 400; break; + } + shutter = powf64(2.0f, (((float)get4())/8.0f)) / 16000.0f; FORC4 cam_mul[c ^ (c >> 1)] = get4(); + fseek (ifp, 88, SEEK_SET); + aperture = powf64(2.0f, ((float)get4())/16.0f); + fseek (ifp, 112, SEEK_SET); + focal_len = get4(); +#ifdef LIBRAW_LIBRARY_BUILD + fseek (ifp, 104, SEEK_SET); + imgdata.lens.makernotes.MaxAp4CurFocal = powf64(2.0f, ((float)get4())/16.0f); + fseek (ifp, 124, SEEK_SET); + fread(imgdata.lens.makernotes.Lens, 32, 1, ifp); + imgdata.lens.makernotes.CameraMount = LIBRAW_MOUNT_Contax_N; + if (imgdata.lens.makernotes.Lens[0]) + imgdata.lens.makernotes.LensMount = LIBRAW_MOUNT_Contax_N; +#endif } else if (!strcmp (head, "PXN")) { strcpy (make, "Logitech"); strcpy (model,"Fotoman Pixtura"); @@ -7961,6 +12159,10 @@ } else if (!memcmp (head,"RIFF",4)) { fseek (ifp, 0, SEEK_SET); parse_riff(); + } else if (!memcmp (head+4,"ftypqt ",9)) { + fseek (ifp, 0, SEEK_SET); + parse_qt (fsize); + is_raw = 0; } else if (!memcmp (head,"\0\001\0\001\0@",6)) { fseek (ifp, 6, SEEK_SET); fread (make, 1, 8, ifp); @@ -7974,15 +12176,18 @@ filters = 0x61616161; } else if (!memcmp (head,"NOKIARAW",8)) { strcpy (make, "NOKIA"); - strcpy (model, "X2"); order = 0x4949; fseek (ifp, 300, SEEK_SET); data_offset = get4(); i = get4(); width = get2(); height = get2(); - data_offset += i - width * 5 / 4 * height; - load_raw = &CLASS nokia_load_raw; + switch (tiff_bps = i*8 / (width * height)) { + case 8: load_raw = &CLASS eight_bit_load_raw; break; + case 10: load_raw = &CLASS nokia_load_raw; + } + raw_height = height + (top_margin = i / (width * tiff_bps/8) - height); + mask[0][3] = 1; filters = 0x61616161; } else if (!memcmp (head,"ARRI",4)) { order = 0x4949; @@ -8006,6 +12211,7 @@ fread (model, 1, 30, ifp); data_offset = 0x10000; load_raw = &CLASS canon_rmf_load_raw; + gamma_curve (0, 12.25, 1, 1023); } else if (!memcmp (head+4,"RED1",4)) { strcpy (make, "Red"); strcpy (model,"One"); @@ -8036,10 +12242,17 @@ } else if (!memcmp (head,"CI",2)) parse_cine(); - else + if(make[0] == 0) for (zero_fsize=i=0; i < sizeof table / sizeof *table; i++) if (fsize == table[i].fsize) { strcpy (make, table[i].t_make ); +#ifdef LIBRAW_LIBRARY_BUILD + if (!strncmp(make, "Canon",5)) + { + imgdata.lens.makernotes.CameraMount = LIBRAW_MOUNT_FixedLens; + imgdata.lens.makernotes.LensMount = LIBRAW_MOUNT_FixedLens; + } +#endif strcpy (model, table[i].t_model); flip = table[i].flags >> 2; zero_is_bad = table[i].flags & 2; @@ -8058,9 +12271,15 @@ switch (tiff_bps = (fsize-data_offset)*8 / (raw_width*raw_height)) { case 6: load_raw = &CLASS minolta_rd175_load_raw; break; - case 8: + case 8: load_raw = &CLASS eight_bit_load_raw; break; - case 10: case 12: + case 10: + if ((fsize-data_offset)/raw_height*3 >= raw_width*4) { + load_raw = &CLASS android_loose_load_raw; break; + } else if (load_flags & 1) { + load_raw = &CLASS android_tight_load_raw; break; + } + case 12: load_flags |= 128; load_raw = &CLASS packed_load_raw; break; case 16: @@ -8077,7 +12296,8 @@ parse_jpeg(0); fseek(ifp,0,SEEK_END); int sz = ftell(ifp); - if (!strncmp(model,"ov",2) && sz>=6404096 && !fseek (ifp, -6404096, SEEK_END) && + if (!(strncmp(model,"ov",2) && strncmp(model,"RP_OV",5)) && sz>=6404096 && + !fseek (ifp, -6404096, SEEK_END) && fread (head, 1, 32, ifp) && !strcmp(head,"BRCMn")) { strcpy (make, "OmniVision"); data_offset = ftell(ifp) + 0x8000-32; @@ -8091,10 +12311,12 @@ for (i=0; i < sizeof corp / sizeof *corp; i++) if (strcasestr (make, corp[i])) /* Simplify company names */ strcpy (make, corp[i]); - if ((!strcmp(make,"Kodak") || !strcmp(make,"Leica")) && + if ((!strncmp(make,"Kodak",5) || !strncmp(make,"Leica",5)) && ((cp = strcasestr(model," DIGITAL CAMERA")) || (cp = strstr(model,"FILE VERSION")))) *cp = 0; + if (!strncasecmp(model,"PENTAX",6)) + strcpy (make, "Pentax"); cp = make + strlen(make); /* Remove trailing spaces */ while (*--cp == ' ') *cp = 0; cp = model + strlen(model); @@ -8121,6 +12343,10 @@ { left_margin = 10; width = 4950; filters = 0x16161616; } if (width == 4736 && !strcmp(model,"K-7")) { height = 3122; width = 4684; filters = 0x16161616; top_margin = 2; } + if (width == 6080 && !strcmp(model,"K-3 II")) + { left_margin = 4; width = 6040; } + if (width == 6080 && !strcmp(model,"K-3")) + { left_margin = 4; width = 6040; } if (width == 7424 && !strcmp(model,"645D")) { height = 5502; width = 7328; filters = 0x61616161; top_margin = 29; left_margin = 48; } @@ -8137,9 +12363,27 @@ case 34892: load_raw = &CLASS lossy_dng_load_raw; break; default: load_raw = 0; } + if (!strncmp(make, "Canon",5) && unique_id) + { + for (i = 0; i < sizeof unique / sizeof *unique; i++) + if (unique_id == 0x80000000 + unique[i].id) + { + strcpy(model, unique[i].t_model); + break; + } + } + if (!strncasecmp(make, "Sony",4) && unique_id) + { + for (i = 0; i < sizeof sonique / sizeof *sonique; i++) + if (unique_id == sonique[i].id) + { + strcpy(model, sonique[i].t_model); + break; + } + } goto dng_skip; } - if (!strcmp(make,"Canon") && !fsize && tiff_bps != 15) { + if (!strncmp(make,"Canon",5) && !fsize && tiff_bps != 15) { if (!load_raw) load_raw = &CLASS lossless_jpeg_load_raw; for (i=0; i < sizeof canon / sizeof *canon; i++) @@ -8148,13 +12392,18 @@ height = raw_height - (top_margin = canon[i][3]); width -= canon[i][4]; height -= canon[i][5]; + mask[0][1] = canon[i][6]; + mask[0][3] = -canon[i][7]; + mask[1][1] = canon[i][8]; + mask[1][3] = -canon[i][9]; + if (canon[i][10]) filters = canon[i][10] * 0x01010101; } if ((unique_id | 0x20000) == 0x2720000) { left_margin = 8; top_margin = 16; } } - if (!strcmp(make,"Canon") && unique_id) + if (!strncmp(make,"Canon",5) && unique_id) { for (i=0; i < sizeof unique / sizeof *unique; i++) if (unique_id == 0x80000000 + unique[i].id) @@ -8164,17 +12413,17 @@ } } - if (!strcasecmp(make,"Sony") && unique_id) + if (!strncasecmp(make,"Sony",4) && unique_id) { - for (i=0; i < sizeof sony_unique / sizeof *sony_unique; i++) - if (unique_id == sony_unique[i].id) + for (i=0; i < sizeof sonique / sizeof *sonique; i++) + if (unique_id == sonique[i].id) { - adobe_coeff ("Sony", sony_unique[i].t_model); - strcpy(model,sony_unique[i].t_model); + adobe_coeff ("Sony", sonique[i].t_model); + strcpy(model,sonique[i].t_model); } } - if (!strcmp(make,"Nikon")) { + if (!strncmp(make,"Nikon",5)) { if (!load_raw) load_raw = &CLASS packed_load_raw; if (model[0] == 'E') @@ -8197,12 +12446,19 @@ if(!imgdata.params.force_foveon_x3f) simple_coeff(0); #endif - } else if (!strcmp(make,"Canon") && tiff_bps == 15) { + } else if (!strncmp(make,"Canon",5) && tiff_bps == 15) { switch (width) { case 3344: width -= 66; case 3872: width -= 6; } - if (height > width) SWAP(height,width); + if (height > width) { + SWAP(height,width); + SWAP(raw_height,raw_width); + } + if (width == 7200 && height == 3888) { + raw_width = width = 6480; + raw_height = height = 4320; + } filters = 0; tiff_samples = colors = 3; load_raw = &CLASS canon_sraw_load_raw; @@ -8243,35 +12499,30 @@ } else if (!strcmp(model,"PowerShot A610")) { if (canon_s2is()) strcpy (model+10, "S2 IS"); } else if (!strcmp(model,"PowerShot SX220 HS")) { - mask[0][0] = top_margin = 16; - mask[0][2] = top_margin + height; - mask[0][3] = left_margin = 92; + mask[1][3] = -4; + top_margin=16; + left_margin = 92; } else if (!strcmp(model,"PowerShot S120")) { raw_width = 4192; raw_height = 3062; width = 4022; - height = 3017; - mask[0][0] = top_margin = 30; + height = 3016; + mask[0][0] = top_margin = 31; mask[0][2] = top_margin + height; left_margin = 120; - mask[0][1] = 23; + mask[0][1] = 23; mask[0][3] = 72; } else if (!strcmp(model,"PowerShot G16")) { mask[0][0] = 0; mask[0][2] = 80; mask[0][1] = 0; mask[0][3] = 16; - top_margin = 28; + top_margin = 29; left_margin = 120; width = raw_width-left_margin-48; height = raw_height-top_margin-14; } else if (!strcmp(model,"PowerShot SX50 HS")) { - mask[0][0] = top_margin = 17; - mask[0][2] = raw_height; - mask[0][3] = 80; - filters = 0x49494949; - } else if (!strcmp(model,"PowerShot G10")) { - filters = 0x49494949; + top_margin = 17; } else if (!strcmp(model,"EOS D2000C")) { filters = 0x61616161; black = curve[200]; @@ -8303,11 +12554,11 @@ !strcmp(model,"COOLPIX A")) { width -= 44; } else if (!strcmp(model,"D3200") || - !strcmp(model,"D600") || - !strcmp(model,"D610") || + !strncmp(model,"D6",2) || !strncmp(model,"D800",4)) { width -= 46; - } else if (!strcmp(model,"D4")) { + } else if (!strcmp(model,"D4") || + !strcmp(model,"Df")) { width -= 52; left_margin = 2; } else if (!strncmp(model,"D40",3) || @@ -8329,12 +12580,22 @@ else width -= 8; } else if (!strncmp(model,"D300",4)) { width -= 32; - } else if (!strcmp(make,"Nikon") && !strcmp(model,"Df")) { - left_margin=4; - width-=64; - } else if (!strcmp(make,"Nikon") && raw_width == 4032) { - adobe_coeff ("Nikon","COOLPIX P7700"); - } else if (!strncmp(model,"COOLPIX P",9)) { + } else if (!strncmp(make,"Nikon",5) && raw_width == 4032) { + if(!strcmp(model,"COOLPIX P7700")) + { + adobe_coeff ("Nikon","COOLPIX P7700"); + maximum = 65504; + load_flags = 0; + } + else if(!strcmp(model,"COOLPIX P7800")) + { + adobe_coeff ("Nikon","COOLPIX P7800"); + maximum = 65504; + load_flags = 0; + } + else if(!strcmp(model,"COOLPIX P340")) + load_flags=0; + } else if (!strncmp(model,"COOLPIX P",9) && raw_width != 4032) { load_flags = 24; filters = 0x94949494; if (model[9] == '7' && iso_speed >= 400) @@ -8400,7 +12661,7 @@ strcpy (make, "ISG"); model[0] = 0; } - } else if (!strcmp(make,"Fujifilm")) { + } else if (!strncmp(make,"Fujifilm",8)) { if (!strcmp(model+7,"S2Pro")) { strcpy (model,"S2Pro"); height = 2144; @@ -8414,12 +12675,20 @@ if (width == 4032 || width == 4952) left_margin = 0; if (width == 3328 && (width -= 66)) left_margin = 34; if (width == 4936) left_margin = 4; - if (!strcmp(model,"HS50EXR")) { + if (!strcmp(model,"HS50EXR") || + !strcmp(model,"F900EXR")) { width += 2; left_margin = 0; filters = 0x16161616; } + if(!strcmp(model,"S5500")) + { + height -= (top_margin=6); + } if (fuji_layout) raw_width *= is_raw; + if (filters == 9) + FORC(36) ((char *)xtrans)[c] = + xtrans_abs[(c/6+top_margin) % 6][(c+left_margin) % 6]; } else if (!strcmp(model,"KD-400Z")) { height = 1712; width = 2312; @@ -8427,7 +12696,7 @@ goto konica_400z; } else if (!strcmp(model,"KD-510Z")) { goto konica_510z; - } else if (!strcasecmp(make,"Minolta")) { + } else if (!strncasecmp(make,"Minolta",7)) { if (!load_raw && (maximum = 0xfff)) load_raw = &CLASS unpacked_load_raw; if (!strncmp(model,"DiMAGE A",8)) { @@ -8466,20 +12735,41 @@ data_error = -1; } else if (!strcmp(model,"*ist DS")) { height -= 2; - } else if (!strcmp(make,"Samsung") && raw_width == 4704) { + } else if (!strncmp(make,"Samsung",7) && raw_width == 4704) { height -= top_margin = 8; width -= 2 * (left_margin = 8); load_flags = 32; - } else if (!strcmp(make,"Samsung") && raw_height == 3714) { - height -= 18; - width = 5536; - filters = 0x49494949; - } else if (!strcmp(make,"Samsung") && raw_width == 5632) { + } else if (!strncmp(make,"Samsung",7) && !strcmp(model,"NX3000")) { + top_margin = 24; + left_margin = 64; + width = 5472; + height = 3648; + filters = 0x61616161; + colors = 3; + } else if (!strncmp(make,"Samsung",7) && raw_height == 3714) { + height -= top_margin = 18; + left_margin = raw_width - (width = 5536); + if (raw_width != 5600) + left_margin = top_margin = 0; + filters = 0x61616161; + colors = 3; + } else if (!strncmp(make,"Samsung",7) && raw_width == 5632) { order = 0x4949; height = 3694; top_margin = 2; width = 5574 - (left_margin = 32 + tiff_bps); if (tiff_bps == 12) load_flags = 80; + } else if (!strncmp(make,"Samsung",7) && raw_width == 5664) { + height -= top_margin = 17; + left_margin = 96; + width = 5544; + filters = 0x49494949; + } else if (!strncmp(make,"Samsung",7) && raw_width == 6496) { + filters = 0x61616161; +#ifdef LIBRAW_LIBRARY_BUILD + if(!black && !cblack[0] && !cblack[1] && !cblack[2] && !cblack[3]) +#endif + black = 1 << (tiff_bps - 7); } else if (!strcmp(model,"EX1")) { order = 0x4949; height -= 20; @@ -8513,7 +12803,7 @@ height = raw_height - (top_margin = 2); } else if (!strcmp(model,"640x480")) { gamma_curve (0.45, 4.5, 1, 255); - } else if (!strcmp(make,"Hasselblad")) { + } else if (!strncmp(make,"Hasselblad",10)) { if (load_raw == &CLASS lossless_jpeg_load_raw) load_raw = &CLASS hasselblad_load_raw; if (raw_width == 7262) { @@ -8522,29 +12812,86 @@ top_margin = 4; left_margin = 7; filters = 0x61616161; - } else if (raw_width == 7410) { - height = 5502; - width = 7328; + if(!strncasecmp(model,"H3D",3)) + { + adobe_coeff("Hasselblad","H3DII-39"); + strcpy(model,"H3DII-39"); + } + } else if (raw_width == 7410 || raw_width == 8282) { + height -= 84; + width -= 82; top_margin = 4; left_margin = 41; filters = 0x61616161; + adobe_coeff("Hasselblad","H4D-40"); + strcpy(model,"H4D-40"); } else if (raw_width == 9044) { - height = 6716; - width = 8964; - top_margin = 8; - left_margin = 40; - black += load_flags = 256; - maximum = 0x8101; + if(black > 500) + { + top_margin = 12; + left_margin = 44; + width = 8956; + height = 6708; + memset(cblack,0,sizeof(cblack)); + adobe_coeff("Hasselblad","H4D-60"); + strcpy(model,"H4D-60"); + black = 512; + } + else + { + height = 6716; + width = 8964; + top_margin = 8; + left_margin = 40; + black += load_flags = 256; + maximum = 0x8101; + strcpy(model,"H3DII-60"); + } } else if (raw_width == 4090) { strcpy (model, "V96C"); height -= (top_margin = 6); width -= (left_margin = 3) + 7; filters = 0x61616161; + } else if (raw_width == 8282 && raw_height == 6240) { + if(!strncasecmp(model,"H5D",3)) + { + /* H5D 50*/ + left_margin = 54; + top_margin = 16; + width = 8176; + height = 6132; + black = 256; + strcpy(model,"H5D-50"); + } + else if(!strncasecmp(model,"H3D",3)) + { + black=0; + left_margin = 54; + top_margin = 16; + width = 8176; + height = 6132; + memset(cblack,0,sizeof(cblack)); + adobe_coeff("Hasselblad","H3D-50"); + strcpy(model,"H3D-50"); + } + } else if (raw_width == 8374 && raw_height == 6304) { + /* H5D 50c*/ + left_margin = 52; + top_margin = 100; + width = 8272; + height = 6200; + black = 256; + strcpy(model,"H5D-50c"); + } + if (tiff_samples > 1) { + is_raw = tiff_samples+1; + if (!shot_select && !half_size) filters = 0; } - } else if (!strcmp(make,"Sinar")) { + } else if (!strncmp(make,"Sinar",5)) { if (!load_raw) load_raw = &CLASS unpacked_load_raw; + if (is_raw > 1 && !shot_select && !half_size) filters = 0; maximum = 0x3fff; - } else if (!strcmp(make,"Leaf")) { + } else if (!strncmp(make,"Leaf",4)) { maximum = 0x3fff; fseek (ifp, data_offset, SEEK_SET); if (ljpeg_start (&jh, 1) && jh.bits == 15) @@ -8586,8 +12933,8 @@ width -= 2 * (left_margin = 24); filters = 0x16161616; } - } else if (!strcmp(make,"Leica") || !strcmp(make,"Panasonic")) { - if (raw_width > 0 && ((flen - data_offset) / (raw_width*8/7) == raw_height)) + } else if (!strncmp(make,"Leica",5) || !strncmp(make,"Panasonic",9)) { + if (raw_width > 0&& ((flen - data_offset) / (raw_width*8/7) == raw_height) ) load_raw = &CLASS panasonic_load_raw; if (!load_raw) { load_raw = &CLASS unpacked_load_raw; @@ -8610,11 +12957,12 @@ filters = 0x16161616; load_raw = &CLASS packed_load_raw; load_flags = 30; - } else if (!strcmp(make,"Olympus")) { + } else if (!strncmp(make,"Olympus",7)) { height += height & 1; if (exif_cfa) filters = exif_cfa; if (width == 4100) width -= 4; if (width == 4080) width -= 24; + if (width == 9280) { width -= 6; height -= 6; } if (load_raw == &CLASS unpacked_load_raw) load_flags = 4; tiff_bps = 12; @@ -8658,23 +13006,28 @@ mask[0][1] = 9; data_offset = 787392; load_raw = &CLASS sony_load_raw; - } else if (!strcmp(make,"Sony") && raw_width == 3984) { - adobe_coeff ("Sony","DSC-R1"); + } else if (!strncmp(make,"Sony",4) && raw_width == 3984) { width = 3925; order = 0x4d4d; - } else if (!strcmp(make,"Sony") && !strcmp(model,"ILCE-3000")) { + } else if (!strncmp(make,"Sony",4) && raw_width == 4288) { width -= 32; - } else if (!strcmp(make,"Sony") && raw_width == 5504) { - width -= 8; - } else if (!strcmp(make,"Sony") && raw_width == 6048) { + } else if (!strncmp(make,"Sony",4) && raw_width == 4928) { + if (height < 3280) width -= 8; + } else if (!strncmp(make,"Sony",4) && raw_width == 5504) { // ILCE-3000//5000 + width -= height > 3664 ? 8 : 32; + } else if (!strncmp(make,"Sony",4) && raw_width == 6048) { width -= 24; - } else if (!strcmp(make,"Sony") && raw_width == 7392) { - width -= 24; // 21 pix really + if (strstr(model,"RX1") || strstr(model,"A99")) + width -= 6; + } else if (!strncmp(make,"Sony",4) && raw_width == 7392) { + width -= 30; } else if (!strcmp(model,"DSLR-A100")) { if (width == 3880) { height--; width = ++raw_width; } else { + height -= 4; + width -= 4; order = 0x4d4d; load_flags = 2; } @@ -8685,46 +13038,35 @@ height -= top_margin = 4; width -= left_margin = 32; gamma_curve (0, 7, 1, 255); - } else if (!strcmp(model,"C603") || !strcmp(model,"C330")) { + } else if (!strcmp(model,"C603") || !strcmp(model,"C330") + || !strcmp(model,"12MP")) { order = 0x4949; if (filters && data_offset) { - fseek (ifp, 168, SEEK_SET); + fseek (ifp, data_offset < 4096 ? 168 : 5252, SEEK_SET); read_shorts (curve, 256); } else gamma_curve (0, 3.875, 1, 255); - load_raw = filters ? &CLASS eight_bit_load_raw - : &CLASS kodak_yrgb_load_raw; + load_raw = filters ? &CLASS eight_bit_load_raw : + strcmp(model,"C330") ? &CLASS kodak_c603_load_raw : + &CLASS kodak_c330_load_raw; + load_flags = tiff_bps > 16; + tiff_bps = 8; } else if (!strncasecmp(model,"EasyShare",9)) { data_offset = data_offset < 0x15000 ? 0x15000 : 0x17000; load_raw = &CLASS packed_load_raw; - } else if (!strcasecmp(make,"Kodak")) { + } else if (!strncasecmp(make,"Kodak",5)) { if (filters == UINT_MAX) filters = 0x61616161; - if (!strncmp(model,"NC2000",6)) { - width -= 4; - left_margin = 2; - } else if (!strcmp(model,"EOSDCS3B")) { - width -= 4; - left_margin = 2; - } else if (!strcmp(model,"EOSDCS1")) { - width -= 4; - left_margin = 2; - } else if (!strcmp(model,"DCS420")) { + if (!strncmp(model,"NC2000",6) || + !strncmp(model,"EOSDCS",6) || + !strncmp(model,"DCS4",4)) { width -= 4; left_margin = 2; - } else if (!strncmp(model,"DCS460 ",7)) { - model[6] = 0; - width -= 4; - left_margin = 2; - } else if (!strcmp(model,"DCS460A")) { - width -= 4; - left_margin = 2; - colors = 1; - filters = 0; + if (model[6] == ' ') model[6] = 0; + if (!strcmp(model,"DCS460A")) goto bw; } else if (!strcmp(model,"DCS660M")) { black = 214; - colors = 1; - filters = 0; + goto bw; } else if (!strcmp(model,"DCS760M")) { - colors = 1; +bw: colors = 1; filters = 0; } if (!strcmp(model+4,"20X")) @@ -8735,6 +13077,10 @@ } if (!strncmp(model,"DC2",3)) { raw_height = 2 + (height = 242); + if (!strncmp(model, "DC290", 5)) + iso_speed = 100; + if (!strncmp(model, "DC280", 5)) + iso_speed = 70; if (flen < 100000) { raw_width = 256; width = 249; pixel_aspect = (4.0*height) / (3.0*width); @@ -8760,12 +13106,14 @@ strcpy (model, "DC50"); height = 512; width = 768; + iso_speed=84; data_offset = 19712; load_raw = &CLASS kodak_radc_load_raw; } else if (strstr(model,"DC120")) { strcpy (model, "DC120"); height = 976; width = 848; + iso_speed=160; pixel_aspect = height/0.75/width; load_raw = tiff_compress == 7 ? &CLASS kodak_jpeg_load_raw : &CLASS kodak_dc120_load_raw; @@ -8774,6 +13122,7 @@ thumb_width = 192; thumb_offset = 6144; thumb_misc = 360; + iso_speed=140; write_thumb = &CLASS layer_thumb; black = 17; } @@ -8796,7 +13145,7 @@ flip = ~get2() & 3 ? 5:6; } filters = 0x61616161; - } else if (!strcmp(make,"Rollei") && !load_raw) { + } else if (!strncmp(make,"Rollei",6) && !load_raw) { switch (raw_width) { case 1316: height = 1030; @@ -8859,9 +13208,6 @@ if (!model[0]) sprintf (model, "%dx%d", width, height); if (filters == UINT_MAX) filters = 0x94949494; - if (raw_color) adobe_coeff (make, model); - if (load_raw == &CLASS kodak_radc_load_raw) - if (raw_color) adobe_coeff ("Apple","Quicktake"); if (thumb_offset && !thumb_height) { fseek (ifp, thumb_offset, SEEK_SET); if (ljpeg_start (&jh, 1)) { @@ -8871,10 +13217,34 @@ } dng_skip: + /* Early reject for damaged images */ + if (!load_raw || height < 22 || width < 22 || + tiff_bps > 16 || tiff_samples > 4 || colors > 4 || colors < 1) + { + is_raw = 0; +#ifdef LIBRAW_LIBRARY_BUILD + RUN_CALLBACK(LIBRAW_PROGRESS_IDENTIFY,1,2); +#endif + return; + } + if ((use_camera_matrix & (use_camera_wb || dng_version)) + && cmatrix[0][0] > 0.125) { + memcpy (rgb_cam, cmatrix, sizeof cmatrix); + raw_color = 0; + } + + if (raw_color) adobe_coeff (make, model); +#ifdef LIBRAW_LIBRARY_BUILD + else if(imgdata.color.cam_xyz[0][0]<0.01) + adobe_coeff (make, model,1); +#endif + + if (load_raw == &CLASS kodak_radc_load_raw) + if (raw_color) adobe_coeff ("Apple","Quicktake"); if (fuji_width) { fuji_width = width >> !fuji_layout; - if (~fuji_width & 1) filters = 0x49494949; + filters = fuji_width & 1 ? 0x94949494 : 0x49494949; width = (height >> fuji_layout) + fuji_width; height = width - 1; pixel_aspect = 1; @@ -8883,10 +13253,19 @@ if (raw_width < width ) raw_width = width; } if (!tiff_bps) tiff_bps = 12; - if (!maximum) maximum = (1 << tiff_bps) - 1; + if (!maximum) + { + maximum = (1 << tiff_bps) - 1; + if(maximum < 0x10000 && curve[maximum]>0 && load_raw == &CLASS sony_arw2_load_raw) + maximum = curve[maximum]; + } if (!load_raw || height < 22 || width < 22 || - tiff_bps > 16 || tiff_samples > 4 || colors > 4) + tiff_bps > 16 || tiff_samples > 6 || colors > 4) + is_raw = 0; + + if(raw_width < 22 || raw_width > 64000 || raw_height < 22 || raw_width > 64000) is_raw = 0; + #ifdef NO_JASPER if (load_raw == &CLASS redcine_load_raw) { #ifdef DCRAW_VERBOSE @@ -8929,7 +13308,6 @@ } -#line 10298 "dcraw/dcraw.c" void CLASS convert_to_rgb() { #ifndef LIBRAW_LIBRARY_BUILD @@ -8990,7 +13368,7 @@ raw_color |= colors == 1 || document_mode || output_color < 1 || output_color > 5; #else - raw_color |= colors == 1 || + raw_color |= colors == 1 || output_color < 1 || output_color > 5; #endif if (!raw_color) { @@ -9160,7 +13538,6 @@ if (flip & 1) col = iwidth - 1 - col; return row * iwidth + col; } -#line 10554 "dcraw/dcraw.c" void CLASS tiff_set (ushort *ntag, ushort tag, ushort type, int count, int val) { @@ -9247,7 +13624,7 @@ strncpy (th->t_desc, desc, 512); strncpy (th->t_make, make, 64); strncpy (th->t_model, model, 64); - strcpy (th->soft, "dcraw v"DCRAW_VERSION); + strcpy (th->soft, "dcraw v" DCRAW_VERSION); t = localtime (×tamp); sprintf (th->date, "%04d:%02d:%02d %02d:%02d:%02d", t->tm_year+1900,t->tm_mon+1,t->tm_mday,t->tm_hour,t->tm_min,t->tm_sec); @@ -9314,7 +13691,7 @@ int perc, val, total, t_white=0x2000; #ifdef LIBRAW_LIBRARY_BUILD - perc = width * height * auto_bright_thr; /* 99th percentile white level */ + perc = width * height * auto_bright_thr; #else perc = width * height * 0.01; /* 99th percentile white level */ #endif diff -Nru libraw-0.16.2/internal/dcraw_fileio.cpp libraw-0.17.0/internal/dcraw_fileio.cpp --- libraw-0.16.2/internal/dcraw_fileio.cpp 2015-05-16 12:32:15.000000000 +0000 +++ libraw-0.17.0/internal/dcraw_fileio.cpp 2015-08-15 13:10:27.000000000 +0000 @@ -1,5 +1,5 @@ /* - Copyright 2008-2013 LibRaw LLC (info@libraw.org) + Copyright 2008-2015 LibRaw LLC (info@libraw.org) LibRaw is free software; you can redistribute it and/or modify it under the terms of the one of three licenses as you choose: @@ -21,7 +21,6 @@ for more information */ -#line 4094 "dcraw/dcraw.c" #include #define CLASS LibRaw:: #include "libraw/libraw_types.h" @@ -29,7 +28,6 @@ #include "libraw/libraw.h" #include "internal/defines.h" #include "internal/var_defines.h" -#line 4105 "dcraw/dcraw.c" /* Seach from the current directory up to the root looking for a ".badpixels" file, and fix those pixels now. @@ -54,7 +52,6 @@ #endif if (cfname) fp = fopen (cfname, "r"); -#line 4155 "dcraw/dcraw.c" if (!fp) { #ifdef LIBRAW_LIBRARY_BUILD @@ -105,7 +102,7 @@ if (!(fp = fopen (fname, "rb"))) { #ifdef DCRAW_VERBOSE - perror (fname); + perror (fname); #endif #ifdef LIBRAW_LIBRARY_BUILD imgdata.process_warnings |= LIBRAW_WARN_BAD_DARKFRAME_FILE; @@ -154,7 +151,6 @@ RUN_CALLBACK(LIBRAW_PROGRESS_DARK_FRAME,1,2); #endif } -#line 10209 "dcraw/dcraw.c" #ifndef NO_LCMS void CLASS apply_profile (const char *input, const char *output) { @@ -164,9 +160,6 @@ FILE *fp; unsigned size; -#ifndef USE_LCMS2 - cmsErrorAction (LCMS_ERROR_SHOW); -#endif if (strcmp (input, "embed")) hInProfile = cmsOpenProfileFromFile (input, "r"); else if (profile_length) { diff -Nru libraw-0.16.2/internal/defines.h libraw-0.17.0/internal/defines.h --- libraw-0.16.2/internal/defines.h 2015-05-16 12:32:15.000000000 +0000 +++ libraw-0.17.0/internal/defines.h 2015-08-15 13:10:27.000000000 +0000 @@ -1,5 +1,5 @@ /* - Copyright 2008-2013 LibRaw LLC (info@libraw.org) + Copyright 2008-2015 LibRaw LLC (info@libraw.org) LibRaw is free software; you can redistribute it and/or modify it under the terms of the one of three licenses as you choose: @@ -21,15 +21,14 @@ for more information */ -#line 27 "dcraw/dcraw.c" #ifndef USE_JPEG #define NO_JPEG #endif #ifndef USE_JASPER #define NO_JASPER #endif -#line 38 "dcraw/dcraw.c" -#define DCRAW_VERSION "9.19" +#define DCRAW_VERSION "9.25" + #ifndef _GNU_SOURCE #define _GNU_SOURCE @@ -47,7 +46,6 @@ #include #include #include -#line 65 "dcraw/dcraw.c" #ifdef __CYGWIN__ #include #endif @@ -58,7 +56,6 @@ #define snprintf _snprintf #define strcasecmp stricmp #define strncasecmp strnicmp -#line 79 "dcraw/dcraw.c" #else #include #include @@ -100,7 +97,6 @@ #ifndef LONG_BIT #define LONG_BIT (8 * sizeof (long)) #endif -#line 192 "dcraw/dcraw.c" #define FORC(cnt) for (c=0; c < cnt; c++) #define FORC3 FORC(3) #define FORC4 FORC(4) @@ -115,6 +111,8 @@ #define CLIP(x) LIM(x,0,65535) #define SWAP(a,b) { a=a+b; b=a-b; a=a-b; } +#define my_swap(type, i, j) {type t = i; i = j; j = t;} + /* In order to inline this calculation, I make the risky assumption that all filter patterns can be described @@ -156,7 +154,6 @@ #define RAW(row,col) \ raw_image[(row)*raw_width+(col)] -#line 253 "dcraw/dcraw.c" #define BAYER(row,col) \ image[((row) >> shrink)*iwidth + ((col) >> shrink)][FC(row,col)] diff -Nru libraw-0.16.2/internal/libraw_internal_funcs.h libraw-0.17.0/internal/libraw_internal_funcs.h --- libraw-0.16.2/internal/libraw_internal_funcs.h 2015-05-16 12:32:15.000000000 +0000 +++ libraw-0.17.0/internal/libraw_internal_funcs.h 2015-08-15 13:10:27.000000000 +0000 @@ -1,6 +1,6 @@ /* -*- C++ -*- * File: libraw_internal_funcs.h - * Copyright 2008-2013 LibRaw LLC (info@libraw.org) + * Copyright 2008-2015 LibRaw LLC (info@libraw.org) * Created: Sat Mar 14, 2008 LibRaw is free software; you can redistribute it and/or modify @@ -25,13 +25,27 @@ #else /* WF */ void wf_bayer4_igauss_filter(int radius,void* src_image, int src_imgmode, void* dst_image, int dst_imgmode); - void wf_bayer4_green_blur (int mode,void* src_image, int src_imgmode, void* dst_image, int dst_imgmode); + void wf_bayer4_green_blur (int mode,void* src_image, int src_imgmode, void* dst_image, int dst_imgmode); void wf_bayer4_block_filter (int* radius_list, void* src_image, int src_imgmode, void* dst_image, int dst_imgmode); double wf_filter_energy (int r1_greenmode, int r1, int r2_greenmode, int r2); // inline functions ushort sget2 (uchar *s); + ushort sget2Rev(uchar *s); + void setCanonBodyFeatures (unsigned id); + void processCanonCameraInfo (unsigned id, uchar *CameraInfo, unsigned maxlen); + void processNikonLensData (uchar *LensData, unsigned len); + void setOlympusBodyFeatures (unsigned long long id); + void setPhaseOneFeatures (unsigned id); + void setPentaxBodyFeatures (unsigned id); + void PentaxLensInfo (unsigned id, unsigned len); + void setSonyBodyFeatures (unsigned id); + void parseSonyLensType2 (uchar a, uchar b); + void parseSonyLensFeatures (uchar a, uchar b); + void process_Sony_0x9050 (uchar * buf, unsigned id); + void process_Sony_0x940c (uchar * buf); + ushort get2(); unsigned sget4 (uchar *s); unsigned getint (int type); @@ -50,13 +64,14 @@ void parse_ciff (int offset, int length, int); void ciff_block_1030(); + // LJPEG decoder unsigned getbithuff (int nbits, ushort *huff); ushort* make_decoder_ref (const uchar **source); ushort* make_decoder (const uchar *source); int ljpeg_start (struct jhead *jh, int info_only); void ljpeg_end(struct jhead *jh); - int ljpeg_diff (ushort *huff); + int ljpeg_diff (ushort *huff); ushort * ljpeg_row (int jrow, struct jhead *jh); unsigned ph1_bithuff (int nbits, ushort *huff); @@ -79,7 +94,9 @@ // Nikon (and Minolta Z2) void nikon_load_raw(); -//void nikon_load_raw(); + void nikon_load_sraw(); + void nikon_yuv_load_raw(); + void nikon_coolscan_load_raw(); int nikon_e995(); int nikon_e2100(); void nikon_3700(); @@ -113,11 +130,14 @@ void packed_load_raw(); float find_green(int,int,int,int); void unpacked_load_raw(); + void unpacked_load_raw_fuji_f700s20(); void parse_sinar_ia(); void parse_phase_one (int base); // Misc P&S cameras void nokia_load_raw(); + void android_loose_load_raw(); + void android_tight_load_raw(); void canon_rmf_load_raw(); unsigned pana_bits (int nbits); void panasonic_load_raw(); @@ -146,8 +166,10 @@ int kodak_65000_decode (short *out, int bsize); void kodak_65000_load_raw(); void kodak_rgb_load_raw(); - void kodak_yrgb_load_raw(); void kodak_ycbcr_load_raw(); +// void kodak_yrgb_load_raw(); + void kodak_c330_load_raw(); + void kodak_c603_load_raw(); void kodak_rgb_load_thumb(); void kodak_ycbcr_load_thumb(); @@ -157,6 +179,8 @@ void sony_arw_load_raw(); void sony_arw2_load_raw(); void samsung_load_raw(); + void samsung2_load_raw(); + void samsung3_load_raw(); void parse_minolta (int base); // Foveon/Sigma @@ -180,11 +204,11 @@ // We always have x3f code compiled in! void parse_x3f(); void x3f_load_raw(); + void x3f_dpq_interpolate_rg(); + void x3f_dpq_interpolate_af(int xstep, int ystep, int scale); // 1x1 af pixels // CAM/RGB void pseudoinverse (double (*in)[3], double (*out)[3], int size); - void cam_xyz_coeff (double cam_xyz[4][3]); - void adobe_coeff (const char *, const char *); void simple_coeff (int index); @@ -192,6 +216,7 @@ void tiff_get (unsigned base,unsigned *tag, unsigned *type, unsigned *len, unsigned *save); void parse_thumb_note (int base, unsigned toff, unsigned tlen); void parse_makernote (int base, int uptag); + void parse_makernote_0xc634(int base, int uptag, unsigned dng_writer); void parse_exif (int base); void linear_table (unsigned len); void parse_kodak_ifd (int base); @@ -199,8 +224,10 @@ int parse_tiff (int base); void apply_tiff(void); void parse_gps (int base); - void romm_coeff (float romm_cam[3][3]); + void parse_gps_libraw(int base); + void romm_coeff(float romm_cam[3][3]); void parse_mos (int offset); + void parse_qt (int end); void get_timestamp (int reversed); // External JPEGs, what cameras uses it ? diff -Nru libraw-0.16.2/internal/libraw_x3f.cpp libraw-0.17.0/internal/libraw_x3f.cpp --- libraw-0.16.2/internal/libraw_x3f.cpp 2015-05-16 12:32:15.000000000 +0000 +++ libraw-0.17.0/internal/libraw_x3f.cpp 2015-08-15 13:10:27.000000000 +0000 @@ -1,4 +1,4 @@ -/* Library for accessing X3F Files +/* Library for accessing X3F Files ---------------------------------------------------------------- BSD-style License ---------------------------------------------------------------- @@ -31,23 +31,6 @@ */ /* From X3F_IO.H */ -#if defined(_WIN32) - #if defined _MSC_VER - typedef signed __int8 int8_t; - typedef unsigned __int8 uint8_t; - typedef signed __int16 int16_t; - typedef unsigned __int16 uint16_t; - typedef signed __int32 int32_t; - typedef unsigned __int32 uint32_t; - typedef signed __int64 int64_t; - typedef unsigned __int64 uint64_t; - #else - #include - #endif // _WIN32 - #include -#else -#include -#endif #include #include @@ -84,18 +67,16 @@ #define X3F_CMbM (uint32_t)(0x4d624d43) #define X3F_CMb (uint32_t)(0x00624d43) -/* TODO: bad name */ -#define X3F_IMAGE_RAW_TRUE_SD1 (uint32_t)(0x0001001e) - -/* TODO: bad name */ -#define X3F_IMAGE_RAW_HUFFMAN_X530 (uint32_t)(0x00030005) - -#define X3F_IMAGE_RAW_TRUE (uint32_t)(0x0003001e) -#define X3F_IMAGE_RAW_HUFFMAN_10BIT (uint32_t)(0x00030006) #define X3F_IMAGE_THUMB_PLAIN (uint32_t)(0x00020003) #define X3F_IMAGE_THUMB_HUFFMAN (uint32_t)(0x0002000b) #define X3F_IMAGE_THUMB_JPEG (uint32_t)(0x00020012) +#define X3F_IMAGE_RAW_HUFFMAN_X530 (uint32_t)(0x00030005) +#define X3F_IMAGE_RAW_HUFFMAN_10BIT (uint32_t)(0x00030006) +#define X3F_IMAGE_RAW_TRUE (uint32_t)(0x0003001e) +#define X3F_IMAGE_RAW_MERRILL (uint32_t)(0x0001001e) +#define X3F_IMAGE_RAW_QUATTRO (uint32_t)(0x00010023) + #define X3F_IMAGE_HEADER_SIZE 28 #define X3F_CAMF_HEADER_SIZE 28 #define X3F_PROPERTY_LIST_HEADER_SIZE 24 @@ -142,7 +123,7 @@ x3f_property_table_t property_table; - unsigned char *data; + void *data; uint32_t data_size; @@ -185,11 +166,11 @@ x3f_true_huffman_element_t *element; } x3f_true_huffman_t; -/* TODO: is this a constant? */ +/* 0=bottom, 1=middle, 2=top */ #define TRUE_PLANES 3 typedef struct x3f_true_s { - uint16_t seed[3]; /* Always 512,512,512 */ + uint16_t seed[TRUE_PLANES]; /* Always 512,512,512 */ uint16_t unknown; /* Always 0 */ x3f_true_huffman_t table; /* Huffman table - zero terminated. size is the number of @@ -201,6 +182,14 @@ x3f_table16_t x3rgb16; /* 3x16 bit X3-RGB data */ } x3f_true_t; +typedef struct x3f_quattro_s { + struct { + uint16_t columns; + uint16_t rows; + } plane[TRUE_PLANES]; + uint32_t unknown; +} x3f_quattro_t; + typedef struct x3f_huffman_s { x3f_table16_t mapping; /* Value Mapping = X3F lossy compression */ x3f_table32_t table; /* Coding Table */ @@ -224,15 +213,17 @@ 18 = JPEG */ uint32_t type_format; /* type<<16 + format */ /* ------------------------------------------------------------------ */ + uint32_t columns; /* width / row size in pixels */ uint32_t rows; /* height */ uint32_t row_stride; /* row size in bytes */ + /* NULL if not used */ x3f_huffman_t *huffman; /* Huffman help data */ + x3f_true_t *tru; /* TRUE help data */ + x3f_quattro_t *quattro; /* Quattro help data */ - x3f_true_t *tru; /* TRUE coding help data */ - - unsigned char *data; /* Take from file if NULL. Otherwise, + void *data; /* Take from file if NULL. Otherwise, this is the actual data bytes in the file. */ uint32_t data_size; @@ -289,7 +280,7 @@ }; /* The encrypted raw data */ - unsigned char *data; + void *data; uint32_t data_size; /* Help data for type 4 Huffman compression */ @@ -306,7 +297,7 @@ } x3f_camf_t; typedef struct x3f_directory_entry_header_s { - uint32_t identifier; /* Should be 'SECp', 'SECi;, */ + uint32_t identifier; /* Should be ´SECp´, "SECi", ... */ uint32_t version; /* 0x00020001 is version 2.1 */ union { x3f_property_list_t property_list; @@ -319,7 +310,7 @@ struct { uint32_t offset; uint32_t size; - } input,output; + } input, output; uint32_t type; @@ -327,7 +318,7 @@ } x3f_directory_entry_t; typedef struct x3f_directory_section_s { - uint32_t identifier; /* Should be 'SECd' */ + uint32_t identifier; /* Should be ´SECd´ */ uint32_t version; /* 0x00020001 is version 2.1 */ /* 2.0 Fields */ @@ -337,7 +328,7 @@ typedef struct x3f_header_s { /* 2.0 Fields */ - uint32_t identifier; /* Should be 'FOVb' */ + uint32_t identifier; /* Should be ´FOVb´ */ uint32_t version; /* 0x00020001 means 2.1 */ uint8_t unique_identifier[SIZE_UNIQUE_IDENTIFIER]; uint32_t mark_bits; @@ -352,10 +343,10 @@ } x3f_header_t; typedef struct x3f_info_s { - char *error; + const char *error; struct { - LibRaw_abstract_datastream *file; /* Use if more data is needed */ - } input; + LibRaw_abstract_datastream *file; /* Use if more data is needed */ + } input, output; } x3f_info_t; typedef struct x3f_s { @@ -372,27 +363,15 @@ X3F_INTERNAL_ERROR=4 } x3f_return_t; -extern x3f_t *x3f_new_from_file(LibRaw_abstract_datastream *infile); - -extern x3f_return_t x3f_delete(x3f_t *x3f); - -extern x3f_directory_entry_t *x3f_get_raw(x3f_t *x3f); - -extern x3f_directory_entry_t *x3f_get_thumb_plain(x3f_t *x3f); - -extern x3f_directory_entry_t *x3f_get_thumb_huffman(x3f_t *x3f); - -extern x3f_directory_entry_t *x3f_get_thumb_jpeg(x3f_t *x3f); - -extern x3f_directory_entry_t *x3f_get_camf(x3f_t *x3f); - -extern x3f_directory_entry_t *x3f_get_prop(x3f_t *x3f); +x3f_return_t x3f_delete(x3f_t *x3f); -extern x3f_return_t x3f_load_data(x3f_t *x3f, x3f_directory_entry_t *DE); -extern x3f_return_t x3f_load_image_block(x3f_t *x3f, x3f_directory_entry_t *DE); +/* --------------------------------------------------------------------- */ +/* Hacky external flags */ +/* --------------------------------------------------------------------- */ -extern x3f_return_t x3f_swap_images(x3f_t *x3f_template, x3f_t *x3f_images); +/* extern */ int legacy_offset = 0; +/* extern */ bool_t auto_legacy_offset = 1; /* --------------------------------------------------------------------- */ /* Huffman Decode Macros */ @@ -409,109 +388,91 @@ static int x3f_get1(LibRaw_abstract_datastream *f) { - /* Little endian file */ - return f->get_char(); + /* Little endian file */ + return f->get_char(); } static int x3f_sget2 (uchar *s) { - return s[0] | s[1] << 8; + return s[0] | s[1] << 8; } static int x3f_get2(LibRaw_abstract_datastream *f) { - uchar str[2] = { 0xff,0xff }; - f->read (str, 1, 2); - return x3f_sget2(str); + uchar str[2] = { 0xff,0xff }; + f->read (str, 1, 2); + return x3f_sget2(str); } unsigned x3f_sget4 (uchar *s) { - return s[0] | s[1] << 8 | s[2] << 16 | s[3] << 24; + return s[0] | s[1] << 8 | s[2] << 16 | s[3] << 24; } unsigned x3f_get4(LibRaw_abstract_datastream *f) { - uchar str[4] = { 0xff,0xff,0xff,0xff }; - f->read (str, 1, 4); - return x3f_sget4(str); + uchar str[4] = { 0xff,0xff,0xff,0xff }; + f->read (str, 1, 4); + return x3f_sget4(str); } #define FREE(P) do { free(P); (P) = NULL; } while (0) #define PUT_GET_N(_buffer,_size,_file,_func) \ - do \ - { \ - int _left = _size; \ - while (_left != 0) { \ + do \ +{ \ + int _left = _size; \ + while (_left != 0) { \ int _cur = _file->_func(_buffer,1,_left); \ if (_cur == 0) { \ - fprintf(stderr, "Failure to access file\n"); \ - throw LIBRAW_EXCEPTION_IO_CORRUPT; \ + break; \ } \ _left -= _cur; \ - } \ - } while(0) + } \ +} while(0) #define GET1(_v) do {(_v) = x3f_get1(I->input.file);} while (0) #define GET2(_v) do {(_v) = x3f_get2(I->input.file);} while (0) #define GET4(_v) do {(_v) = x3f_get4(I->input.file);} while (0) #define GETN(_v,_s) PUT_GET_N(_v,_s,I->input.file,read) -#define GET_TABLE(_TYPE,_T, _GETX, _NUM) \ - do { \ - int _i; \ - (_T).size = (_NUM); \ - (_T).element = (_TYPE *)realloc((_T).element, \ - (_NUM)*sizeof((_T).element[0])); \ - for (_i = 0; _i < (_T).size; _i++) \ - _GETX((_T).element[_i]); \ - } while (0) - - +#define GET_TABLE(_T, _GETX, _NUM,_TYPE) \ + do { \ + int _i; \ + (_T).size = (_NUM); \ + (_T).element = (_TYPE *)realloc((_T).element, \ + (_NUM)*sizeof((_T).element[0])); \ + for (_i = 0; _i < (_T).size; _i++) \ + _GETX((_T).element[_i]); \ + } while (0) + +#define GET_PROPERTY_TABLE(_T, _NUM) \ + do { \ + int _i; \ + (_T).size = (_NUM); \ + (_T).element = (x3f_property_t *)realloc((_T).element, \ + (_NUM)*sizeof((_T).element[0])); \ + for (_i = 0; _i < (_T).size; _i++) { \ + GET4((_T).element[_i].name_offset); \ + GET4((_T).element[_i].value_offset); \ + } \ + } while (0) #define GET_TRUE_HUFF_TABLE(_T) \ - do { \ - int _i; \ - (_T).element = NULL; \ - for (_i = 0; ; _i++) { \ - (_T).size = _i + 1; \ - (_T).element = (void *)realloc((_T).element, \ - (_i + 1)*sizeof((_T).element[0])); \ - GET1((_T).element[_i].code_size); \ - GET1((_T).element[_i].code); \ - if ((_T).element[_i].code_size == 0) break; \ - } \ - } while (0) + do { \ + int _i; \ + (_T).element = NULL; \ + for (_i = 0; ; _i++) { \ + (_T).size = _i + 1; \ + (_T).element = (x3f_true_huffman_element_t *)realloc((_T).element, \ + (_i + 1)*sizeof((_T).element[0])); \ + GET1((_T).element[_i].code_size); \ + GET1((_T).element[_i].code); \ + if ((_T).element[_i].code_size == 0) break; \ + } \ + } while (0) -#if 0 -/* --------------------------------------------------------------------- */ -/* Converting - ingeger vs memory - assuming little endian in the memory */ -/* --------------------------------------------------------------------- */ - -static void x3f_convert2(void *to, void *from) -{ - uint8_t *f = (uint8_t *)from; - uint16_t *t = (uint16_t *)to; - - /* Little endian memory */ - *t = (uint16_t)((*(f+0)<<0) + (*(f+1)<<8)); -} - -static void x3f_convert4(void *to, void *from) -{ - uint8_t *f = (uint8_t *)from; - uint16_t *t = (uint16_t *)to; - - /* Little endian memory */ - *t = (uint32_t)((*(f+0)<<0) + (*(f+1)<<8) + (*(f+2)<<16) + (*(f+3)<<24)); -} - -#define CONV2(_v, _p) do {x3f_conv2(_p, _v);} while (0) -#define CONV4(_v, _p) do {x3f_conv4(_p, _v);} while (0) -#endif - /* --------------------------------------------------------------------- */ /* Allocating Huffman tree help data */ @@ -570,6 +531,36 @@ return TRU; } +static void cleanup_quattro(x3f_quattro_t **QP) +{ + x3f_quattro_t *Q = *QP; + + if (Q == NULL) return; + + FREE(Q); + + *QP = NULL; +} + +static x3f_quattro_t *new_quattro(x3f_quattro_t **QP) +{ + x3f_quattro_t *Q = (x3f_quattro_t *)calloc(1, sizeof(x3f_quattro_t)); + int i; + + cleanup_quattro(QP); + + for (i=0; iplane[i].columns = 0; + Q->plane[i].rows = 0; + } + + Q->unknown = 0; + + *QP = Q; + + return Q; +} + /* --------------------------------------------------------------------- */ /* Allocating Huffman engine help data */ /* --------------------------------------------------------------------- */ @@ -631,9 +622,10 @@ I = &x3f->info; I->error = NULL; I->input.file = infile; + I->output.file = NULL; if (infile == NULL) { - I->error = (char*)"No infile"; + I->error = "No infile"; return x3f; } @@ -641,6 +633,7 @@ H = &x3f->header; infile->seek(0, SEEK_SET); GET4(H->identifier); + if (H->identifier != X3F_FOVb) { #ifdef DCRAW_VERBOSE fprintf(stderr, "Faulty file type\n"); @@ -687,6 +680,9 @@ GET4(DE->input.offset); GET4(DE->input.size); + DE->output.offset = 0; + DE->output.size = 0; + GET4(DE->type); /* Save current pos and go to the entry */ @@ -757,32 +753,13 @@ } /* Reset the file pointer back to the directory */ - infile->seek( save_dir_pos, SEEK_SET); + infile->seek(save_dir_pos, SEEK_SET); } return x3f; } -static char x3f_id_buf[5] = {0,0,0,0,0}; - -static char *x3f_id(uint32_t id) -{ - x3f_id_buf[0] = (id>>0) & 0xff; - x3f_id_buf[1] = (id>>8) & 0xff; - x3f_id_buf[2] = (id>>16) & 0xff; - x3f_id_buf[3] = (id>>24) & 0xff; - - return x3f_id_buf; -} - - -static uint32_t row_offsets_size(x3f_huffman_t *HUF) -{ - return HUF->row_offsets.size * sizeof(HUF->row_offsets.element[0]); -} - - /* --------------------------------------------------------------------- */ /* Clean up an x3f structure */ @@ -813,7 +790,7 @@ x3f_image_data_t *ID = &DEH->data_subsection.image_data; cleanup_huffman(&ID->huffman); - cleanup_true(&ID->tru); + FREE(ID->data); } @@ -830,6 +807,7 @@ FREE(DS->directory_entry); FREE(x3f); + return X3F_OK; } @@ -887,7 +865,10 @@ if ((DE = x3f_get(x3f, X3F_SECi, X3F_IMAGE_RAW_TRUE)) != NULL) return DE; - if ((DE = x3f_get(x3f, X3F_SECi, X3F_IMAGE_RAW_TRUE_SD1)) != NULL) + if ((DE = x3f_get(x3f, X3F_SECi, X3F_IMAGE_RAW_MERRILL)) != NULL) + return DE; + + if ((DE = x3f_get(x3f, X3F_SECi, X3F_IMAGE_RAW_QUATTRO)) != NULL) return DE; return NULL; @@ -934,6 +915,21 @@ /* Make the huffman tree */ +#ifdef DBG_PRNT +static char *display_code(int length, uint32_t code, char *buffer) +{ + int i; + + for (i=0; i>pos)&1) == 0 ? '0' : '1'; + } + + buffer[i] = 0; + + return buffer; +} +#endif static x3f_huffnode_t *new_node(x3f_hufftree_t *tree) { @@ -987,6 +983,15 @@ add_code_to_tree(tree, length, code, value); +#ifdef DBG_PRNT + { + char buffer[100]; + + printf("H %5d : %5x : %5d : %02x %08x (%08x) (%s)\n", + i, i, value, length, code, value, + display_code(length, code, buffer)); + } +#endif } } } @@ -1017,10 +1022,38 @@ add_code_to_tree(tree, length, code, value); +#ifdef DBG_PRNT + { + char buffer[100]; + + printf("H %5d : %5x : %5d : %02x %08x (%08x) (%s)\n", + i, i, value, length, code, element, + display_code(length, code, buffer)); + } +#endif } } } +#ifdef DBG_PRNT +static void print_huffman_tree(x3f_huffnode_t *t, int length, uint32_t code) +{ + char buf1[100]; + char buf2[100]; + + printf("%*s (%s,%s) %s (%s)\n", + length, length < 1 ? "-" : (code&1) ? "1" : "0", + t->branch[0]==NULL ? "-" : "0", + t->branch[1]==NULL ? "-" : "1", + t->leaf==UNDEFINED_LEAF ? "-" : (sprintf(buf1, "%x", t->leaf),buf1), + display_code(length, code, buf2)); + + code = code << 1; + if (t->branch[0]) print_huffman_tree(t->branch[0], length+1, code+0); + if (t->branch[1]) print_huffman_tree(t->branch[1], length+1, code+1); +} +#endif + /* Help machinery for reading bits in a memory */ typedef struct bit_state_s { @@ -1029,7 +1062,7 @@ uint8_t bits[8]; } bit_state_t; -void set_bit_state(bit_state_t *BS, uint8_t *address) +static void set_bit_state(bit_state_t *BS, uint8_t *address) { BS->next_address = address; BS->bit_offset = 8; @@ -1116,8 +1149,8 @@ int32_t row_start_acc[2][2]; uint32_t rows = ID->rows; uint32_t cols = ID->columns; + uint32_t out_cols = ID->columns; - uint16_t *dst = TRU->x3rgb16.element + color; set_bit_state(&BS, TRU->plane_address[color]); @@ -1126,26 +1159,42 @@ row_start_acc[1][0] = seed; row_start_acc[1][1] = seed; - for (row = 0; row < rows; row++) { - int col; - bool_t odd_row = row&1; - int32_t acc[2]; - for (col = 0; col < cols; col++) { - bool_t odd_col = col&1; - int32_t diff = get_true_diff(&BS, tree); - int32_t prev = col < 2 ? - row_start_acc[odd_row][odd_col] : - acc[odd_col]; - int32_t value = prev + diff; + int datastep = 1; - acc[odd_col] = value; - if (col < 2) - row_start_acc[odd_row][odd_col] = value; + if (ID->type_format == X3F_IMAGE_RAW_QUATTRO) { + if(ID->quattro->plane[color].rows < (rows/2)+16) + { + // Half sized layer + datastep = 2; + } + rows = ID->quattro->plane[color].rows; + cols = ID->quattro->plane[color].columns; + } - *dst = value; - dst += 3; - } + + for (row = 0; row < rows; row++) + { + uint16_t *dst = TRU->x3rgb16.element + row * out_cols * 3 * datastep+ color; + int col; + bool_t odd_row = row&1; + int32_t acc[2]; + for (col = 0; col < cols; col++) + { + bool_t odd_col = col&1; + int32_t diff = get_true_diff(&BS, tree); + int32_t prev = col < 2 ? row_start_acc[odd_row][odd_col] : acc[odd_col]; + int32_t value = prev + diff; + acc[odd_col] = value; + if (col < 2) + row_start_acc[odd_row][odd_col] = value; + if (col < out_cols) + { + /* For quattro the input may be larger than the output */ + *dst = value; + dst += 3*datastep; + } + } } } @@ -1189,41 +1238,48 @@ static void huffman_decode_row(x3f_info_t *I, x3f_directory_entry_t *DE, int bits, - int row) + int row, + int offset, + int *minimum) { x3f_directory_entry_header_t *DEH = &DE->header; x3f_image_data_t *ID = &DEH->data_subsection.image_data; x3f_huffman_t *HUF = ID->huffman; - uint16_t c[3] = {0,0,0}, c_fix[3]; + int16_t c[3] = {offset,offset,offset}; int col; bit_state_t BS; - - set_bit_state(&BS, ID->data + HUF->row_offsets.element[row]); + + set_bit_state(&BS, ((unsigned char*)ID->data) + HUF->row_offsets.element[row]); for (col = 0; col < ID->columns; col++) { int color; for (color = 0; color < 3; color++) { + uint16_t c_fix; + c[color] += get_huffman_diff(&BS, &HUF->tree); + if (c[color] < 0) { + c_fix = 0; + if (c[color] < *minimum) + *minimum = c[color]; + } else { + c_fix = c[color]; + } switch (ID->type_format) { case X3F_IMAGE_RAW_HUFFMAN_X530: case X3F_IMAGE_RAW_HUFFMAN_10BIT: - c_fix[color] = (int16_t)c[color] > 0 ? c[color] : 0; - - HUF->x3rgb16.element[3*(row*ID->columns + col) + color] = c_fix[color]; + HUF->x3rgb16.element[3*(row*ID->columns + col) + color] = (uint16_t)c_fix; break; case X3F_IMAGE_THUMB_HUFFMAN: - c_fix[color] = (int8_t)c[color] > 0 ? c[color] : 0; - - HUF->rgb8.element[3*(row*ID->columns + col) + color] = c_fix[color]; + HUF->rgb8.element[3*(row*ID->columns + col) + color] = (uint8_t)c_fix; break; default: #ifdef DCRAW_VERBOSE fprintf(stderr, "Unknown huffman image type\n"); #endif - ; + break; } } } @@ -1237,11 +1293,24 @@ x3f_image_data_t *ID = &DEH->data_subsection.image_data; int row; + int minimum = 0; + int offset = legacy_offset; +#ifdef DCRAW_VERBOSE + printf("Huffman decode with offset: %d\n", offset); +#endif for (row = 0; row < ID->rows; row++) - huffman_decode_row(I, DE, bits, row); -} + huffman_decode_row(I, DE, bits, row, offset, &minimum); + if (auto_legacy_offset && minimum < 0) { + offset = -minimum; +#ifdef DCRAW_VERBOSE + printf("Redo with offset: %d\n", offset); +#endif + for (row = 0; row < ID->rows; row++) + huffman_decode_row(I, DE, bits, row, offset, &minimum); + } +} static int32_t get_simple_diff(x3f_huffman_t *HUF, uint16_t index) { @@ -1261,9 +1330,9 @@ x3f_image_data_t *ID = &DEH->data_subsection.image_data; x3f_huffman_t *HUF = ID->huffman; - uint32_t *data = (uint32_t *)(ID->data + row*row_stride); + uint32_t *data = (uint32_t *)((unsigned char*)ID->data + row*row_stride); - uint16_t c[3] = {0,0,0}, c_fix[3]; + uint16_t c[3] = {0,0,0}; int col; uint32_t mask = 0; @@ -1297,25 +1366,26 @@ uint32_t val = data[col]; for (color = 0; color < 3; color++) { + uint16_t c_fix; c[color] += get_simple_diff(HUF, (val>>(color*bits))&mask); switch (ID->type_format) { case X3F_IMAGE_RAW_HUFFMAN_X530: case X3F_IMAGE_RAW_HUFFMAN_10BIT: - c_fix[color] = (int16_t)c[color] > 0 ? c[color] : 0; + c_fix = (int16_t)c[color] > 0 ? c[color] : 0; - HUF->x3rgb16.element[3*(row*ID->columns + col) + color] = c_fix[color]; + HUF->x3rgb16.element[3*(row*ID->columns + col) + color] = c_fix; break; case X3F_IMAGE_THUMB_HUFFMAN: - c_fix[color] = (int8_t)c[color] > 0 ? c[color] : 0; + c_fix = (int8_t)c[color] > 0 ? c[color] : 0; - HUF->rgb8.element[3*(row*ID->columns + col) + color] = c_fix[color]; + HUF->rgb8.element[3*(row*ID->columns + col) + color] = c_fix; break; default: #ifdef DCRAW_VERBOSE fprintf(stderr, "Unknown huffman image type\n"); #endif - ; + break; } } } @@ -1352,7 +1422,7 @@ /* ... then you read the data, block for block */ -static uint32_t read_data_block(unsigned char **data, +static uint32_t read_data_block(void **data, x3f_info_t *I, x3f_directory_entry_t *DE, uint32_t footer) @@ -1360,7 +1430,7 @@ uint32_t size = DE->input.size + DE->input.offset - I->input.file->tell() - footer; - *data = (unsigned char *)malloc(size); + *data = (void *)malloc(size); GETN(*data, size); @@ -1372,7 +1442,11 @@ x3f_directory_entry_header_t *DEH = &DE->header; x3f_image_data_t *ID = &DEH->data_subsection.image_data; - ID->data_size = read_data_block(&ID->data, I, DE, 0); +#ifdef DCRAW_VERBOSE + printf("Load image verbatim\n"); +#endif + + ID->data_size = read_data_block((void**)&ID->data, I, DE, 0); } static void x3f_load_property_list(x3f_info_t *I, x3f_directory_entry_t *DE) @@ -1384,13 +1458,7 @@ read_data_set_offset(I, DE, X3F_PROPERTY_LIST_HEADER_SIZE); - PL->property_table.size = PL->num_properties; - PL->property_table.element = (x3f_property_t *)realloc(PL->property_table.element, - PL->num_properties*sizeof(PL->property_table.element[0])); - for (i = 0; i < PL->property_table.size; i++) { - GET4(PL->property_table.element[i].name_offset); - GET4(PL->property_table.element[i].value_offset); - } + GET_PROPERTY_TABLE(PL->property_table, PL->num_properties); PL->data_size = read_data_block(&PL->data, I, DE, 0); @@ -1408,25 +1476,39 @@ x3f_directory_entry_header_t *DEH = &DE->header; x3f_image_data_t *ID = &DEH->data_subsection.image_data; x3f_true_t *TRU = new_true(&ID->tru); + x3f_quattro_t *Q = NULL; int i; + if (ID->type_format == X3F_IMAGE_RAW_QUATTRO) { +#ifdef DCRAW_VERBOSE + printf("Load Quattro extra info\n"); +#endif + Q = new_quattro(&ID->quattro); + + for (i=0; iplane[i].columns); + GET2(Q->plane[i].rows); + } + } +#ifdef DCRAW_VERBOSE + printf("Load TRUE\n"); +#endif + /* Read TRUE header data */ GET2(TRU->seed[0]); /* TODO : should it always be 512 ?? */ GET2(TRU->seed[1]); /* TODO : should it always be 512 ?? */ GET2(TRU->seed[2]); /* TODO : should it always be 512 ?? */ GET2(TRU->unknown); /* TODO : should it always be zero ?? */ + GET_TRUE_HUFF_TABLE(TRU->table); - TRU->table.element = NULL; - for (i = 0; ; i++) { - TRU->table.size = i + 1; - TRU->table.element = (x3f_true_huffman_element_t*)realloc(TRU->table.element, - (i + 1)*sizeof(TRU->table.element[0])); - GET1(TRU->table.element[i].code_size); - GET1(TRU->table.element[i].code); - if (TRU->table.element[i].code_size == 0) break; + if (ID->type_format == X3F_IMAGE_RAW_QUATTRO) { +#ifdef DCRAW_VERBOSE + printf("Load Quattro extra info 2\n"); +#endif + GET4(Q->unknown); } - GET_TABLE(uint32_t,TRU->plane_size, GET4, TRUE_PLANES); + GET_TABLE(TRU->plane_size, GET4, TRUE_PLANES,uint32_t); /* Read image data */ ID->data_size = read_data_block(&ID->data, I, DE, 0); @@ -1436,10 +1518,12 @@ populate_true_huffman_tree(&TRU->tree, &TRU->table); +#ifdef DBG_PRNT + print_huffman_tree(TRU->tree.nodes, 0, 0); +#endif - /* TODO : we here assume 3 planes - thats not neccessarily right */ - TRU->plane_address[0] = ID->data; - for (i=1; i<3; i++) + TRU->plane_address[0] = (uint8_t*)ID->data; + for (i=1; iplane_address[i] = TRU->plane_address[i-1] + (((TRU->plane_size.element[i-1] + 15) / 16) * 16); @@ -1447,6 +1531,7 @@ TRU->x3rgb16.size = ID->columns * ID->rows * 3; TRU->x3rgb16.element = (uint16_t *)malloc(sizeof(uint16_t)*TRU->x3rgb16.size); + true_decode(I, DE); } @@ -1461,14 +1546,25 @@ int table_size = 1<rows * sizeof(HUF->row_offsets.element[0]); - GET_TABLE(uint32_t,HUF->table, GET4, table_size); +#ifdef DCRAW_VERBOSE + printf("Load huffman compressed\n"); +#endif + GET_TABLE(HUF->table, GET4, table_size,uint32_t); ID->data_size = read_data_block(&ID->data, I, DE, row_offsets_size); - GET_TABLE(uint32_t,HUF->row_offsets, GET4, ID->rows); - + GET_TABLE(HUF->row_offsets, GET4, ID->rows,uint32_t); +#ifdef DCRAW_VERBOSE + printf("Make huffman tree ...\n"); +#endif new_huffman_tree(&HUF->tree, bits); populate_huffman_tree(&HUF->tree, &HUF->table, &HUF->mapping); +#ifdef DCRAW_VERBOSE + printf("... DONE\n"); +#endif +#ifdef DBG_PRNT + print_huffman_tree(HUF->tree.nodes, 0, 0); +#endif huffman_decode(I, DE, bits); } @@ -1481,7 +1577,9 @@ { x3f_directory_entry_header_t *DEH = &DE->header; x3f_image_data_t *ID = &DEH->data_subsection.image_data; - +#ifdef DCRAW_VERBOSE + printf("Load huffman not compressed\n"); +#endif ID->data_size = read_data_block(&ID->data, I, DE, 0); simple_decode(I, DE, bits, row_stride); @@ -1500,7 +1598,7 @@ if (use_map_table) { int table_size = 1<mapping, GET2, table_size); + GET_TABLE(HUF->mapping, GET2, table_size,uint16_t); } switch (ID->type_format) { @@ -1519,7 +1617,7 @@ #ifdef DCRAW_VERBOSE fprintf(stderr, "Unknown huffman image type\n"); #endif - ; + break; } if (row_stride == 0) @@ -1547,7 +1645,8 @@ switch (ID->type_format) { case X3F_IMAGE_RAW_TRUE: - case X3F_IMAGE_RAW_TRUE_SD1: + case X3F_IMAGE_RAW_MERRILL: + case X3F_IMAGE_RAW_QUATTRO: x3f_load_true(I, DE); break; case X3F_IMAGE_RAW_HUFFMAN_X530: @@ -1567,7 +1666,7 @@ #ifdef DCRAW_VERBOSE fprintf(stderr, "Unknown image type\n"); #endif - ; + break; } } @@ -1665,7 +1764,7 @@ uint8_t *p; x3f_true_huffman_element_t *element = NULL; - for (i=0, p = CAMF->data; *p != 0; i++) { + for (i=0, p = (uint8_t*)CAMF->data; *p != 0; i++) { /* TODO: Is this too expensive ??*/ element = (x3f_true_huffman_element_t *)realloc(element, (i+1)*sizeof(*element)); @@ -1686,6 +1785,9 @@ populate_true_huffman_tree(&CAMF->tree, &CAMF->table); +#ifdef DBG_PRNT + print_huffman_tree(CAMF->tree.nodes, 0, 0); +#endif camf_decode_type4(CAMF); } @@ -1750,7 +1852,7 @@ #ifdef DCRAW_VERBOSE fprintf(stderr, "Unknown CAMF type\n"); #endif - ; + break; } if (CAMF->decoded_data != NULL) @@ -1811,32 +1913,7 @@ } -/* extern */ x3f_return_t x3f_dump_raw_data(x3f_t *x3f, - char *outfilename) -{ - x3f_directory_entry_t *DE = x3f_get_raw(x3f); - - if (DE == NULL) { - return X3F_ARGUMENT_ERROR; - } else { - x3f_directory_entry_header_t *DEH = &DE->header; - x3f_image_data_t *ID = &DEH->data_subsection.image_data; - void *data = ID->data; - - if (data == NULL) { - return X3F_INTERNAL_ERROR; - } else { - FILE *f_out = fopen(outfilename, "wb"); - - if (f_out == NULL) { - return X3F_OUTFILE_ERROR; - } else { - fwrite(data, 1, DE->input.size, f_out); - fclose(f_out); - } - } - } - - return X3F_OK; -} +/* --------------------------------------------------------------------- */ +/* The End */ +/* --------------------------------------------------------------------- */ diff -Nru libraw-0.16.2/internal/preprocess.pl libraw-0.17.0/internal/preprocess.pl --- libraw-0.16.2/internal/preprocess.pl 2015-05-16 12:32:15.000000000 +0000 +++ libraw-0.17.0/internal/preprocess.pl 2015-08-15 13:10:27.000000000 +0000 @@ -1,7 +1,7 @@ #!/usr/bin/perl # File: preprocess.pl -# Copyright 2008-2013 LibRaw LLC (info@libraw.org) +# Copyright 2008-2015 LibRaw LLC (info@libraw.org) # Created: Sat Mar 8, 2008 # LibRaw preprocessor for dcraw source # @@ -28,7 +28,7 @@ my $date = scalar localtime; print <read(ptr,size,n) #define fseek(stream,o,w) stream->seek(o,w) -#define feof(stream) stream->eof() #define fseeko(stream,o,w) stream->seek(o,w) #define ftell(stream) stream->tell() #define ftello(stream) stream->tell() +#define feof(stream) stream->eof() #ifdef getc #undef getc #endif diff -Nru libraw-0.16.2/internal/wf_filtering.cpp libraw-0.17.0/internal/wf_filtering.cpp --- libraw-0.16.2/internal/wf_filtering.cpp 2015-05-16 12:32:15.000000000 +0000 +++ libraw-0.17.0/internal/wf_filtering.cpp 2015-08-15 13:10:27.000000000 +0000 @@ -1166,7 +1166,7 @@ for (i=0; i<4; i++) { - int padding = i<2 && (S.width & 1 == 1) ? 1 : 0; + int padding = i<2 && (S.width & 1) ? 1 : 0; right_edge[i]=width_d2 + radius + padding; } @@ -1329,7 +1329,7 @@ for (i=0; i<4; i++) { - int padding = i<2 && (S.height & 1 == 1) ? 1 : 0; + int padding = i<2 && (S.height & 1 ) ? 1 : 0; lower_edge[i]=height_d2 + radius + padding; } diff -Nru libraw-0.16.2/libraw/libraw_alloc.h libraw-0.17.0/libraw/libraw_alloc.h --- libraw-0.16.2/libraw/libraw_alloc.h 2015-05-16 12:32:15.000000000 +0000 +++ libraw-0.17.0/libraw/libraw_alloc.h 2015-08-15 13:10:27.000000000 +0000 @@ -1,6 +1,6 @@ /* -*- C++ -*- * File: libraw_alloc.h - * Copyright 2008-2013 LibRaw LLC (info@libraw.org) + * Copyright 2008-2015 LibRaw LLC (info@libraw.org) * Created: Sat Mar 22, 2008 * * LibRaw C++ interface diff -Nru libraw-0.16.2/libraw/libraw_const.h libraw-0.17.0/libraw/libraw_const.h --- libraw-0.16.2/libraw/libraw_const.h 2015-05-16 12:32:15.000000000 +0000 +++ libraw-0.17.0/libraw/libraw_const.h 2015-08-15 13:10:27.000000000 +0000 @@ -1,6 +1,6 @@ /* -*- C++ -*- * File: libraw_const.h - * Copyright 2008-2013 LibRaw LLC (info@libraw.org) + * Copyright 2008-2015 LibRaw LLC (info@libraw.org) * Created: Sat Mar 8 , 2008 * LibRaw error codes LibRaw is free software; you can redistribute it and/or modify @@ -23,15 +23,78 @@ #define LIBRAW_DEFAULT_ADJUST_MAXIMUM_THRESHOLD 0.75 #define LIBRAW_DEFAULT_AUTO_BRIGHTNESS_THRESHOLD 0.01 +enum LibRaw_colormatrix_type +{ + LIBRAW_CMATRIX_NONE=0, + LIBRAW_CMATRIX_DNG=1, + LIBRAW_CMATRIX_DIGBACK=2, + LIBRAW_CMATRIX_OTHER=4 +}; + +enum LibRaw_camera_mounts + { + LIBRAW_MOUNT_Unknown=0, + LIBRAW_MOUNT_Minolta_A=1, + LIBRAW_MOUNT_Sony_E=2, + LIBRAW_MOUNT_Canon_EF=3, + LIBRAW_MOUNT_Canon_EF_S=4, + LIBRAW_MOUNT_Canon_EF_M=5, + LIBRAW_MOUNT_Nikon_F=6, + LIBRAW_MOUNT_Nikon_CX=7, /* used in Nikon 1 series */ + LIBRAW_MOUNT_FT=8, /* original 4/3 */ + LIBRAW_MOUNT_mFT=9, /* micro 4/3 */ + LIBRAW_MOUNT_Pentax_K=10, + LIBRAW_MOUNT_Pentax_Q=11, + LIBRAW_MOUNT_Pentax_645=12, + LIBRAW_MOUNT_Fuji_X=13, + LIBRAW_MOUNT_Leica_M=14, + LIBRAW_MOUNT_Leica_R=15, + LIBRAW_MOUNT_Leica_S=16, + LIBRAW_MOUNT_Samsung_NX=17, + LIBRAW_MOUNT_RicohModule=18, + LIBRAW_MOUNT_Samsung_NX_M=19, + LIBRAW_MOUNT_Leica_T=20, + LIBRAW_MOUNT_Contax_N=21, + LIBRAW_MOUNT_Sigma_X3F=22, + LIBRAW_MOUNT_FixedLens=99 + }; + +enum LibRaw_camera_formats + { + + LIBRAW_FORMAT_APSC=1, + LIBRAW_FORMAT_FF=2, + LIBRAW_FORMAT_MF=3, + LIBRAW_FORMAT_APSH=4, + LIBRAW_FORMAT_FT=8 + }; + + +enum LibRaw_sonyarw2_options +{ + LIBRAW_SONYARW2_NONE=0, + LIBRAW_SONYARW2_BASEONLY=1, + LIBRAW_SONYARW2_DELTAONLY=2, + LIBRAW_SONYARW2_DELTAZEROBASE=3, + LIBRAW_SONYARW2_DELTATOVALUE=4 +}; +enum LibRaw_dp2q_options +{ + LIBRAW_DP2QOPT_NONE=0, + LIBRAW_DP2Q_INTERPOLATERG=1, + LIBRAW_DP2Q_INTERPOLATEAF=2 +}; + enum LibRaw_decoder_flags { - LIBRAW_DECODER_LEGACY = 1, - LIBRAW_DECODER_FLATFIELD = 1<<1, +/* LIBRAW_DECODER_LEGACY = 1, */ +/* LIBRAW_DECODER_FLATFIELD = 1<<1, */ LIBRAW_DECODER_USEBAYER2 = 1<<3, LIBRAW_DECODER_HASCURVE = 1<<4, - LIBRAW_DECODER_ITSASONY = 1<<5, + LIBRAW_DECODER_SONYARW2 = 1<<5, LIBRAW_DECODER_TRYRAWSPEED = 1<<6, LIBRAW_DECODER_OWNALLOC = 1<<7, + LIBRAW_DECODER_FIXEDMAXC = 1<<8, LIBRAW_DECODER_NOTSET = 1<<15 }; @@ -61,7 +124,8 @@ LIBRAW_WARN_NO_JASPER = 1<<11, LIBRAW_WARN_RAWSPEED_PROBLEM = 1<<12, LIBRAW_WARN_RAWSPEED_UNSUPPORTED = 1<<13, - LIBRAW_WARN_RAWSPEED_PROCESSED = 1<<14 + LIBRAW_WARN_RAWSPEED_PROCESSED = 1<<14, + LIBRAW_WARN_FALLBACK_TO_AHD = 1<<15 }; enum LibRaw_exceptions @@ -78,7 +142,7 @@ LIBRAW_EXCEPTION_DECODE_JPEG2000=9 }; - +#if 0 enum LibRaw_colorstate { LIBRAW_COLORSTATE_UNKNOWN =0, @@ -90,6 +154,7 @@ LIBRAW_COLORSTATE_RESERVED2 =6, LIBRAW_COLORSTATE_RESERVED3 =7 }; +#endif enum LibRaw_progress { diff -Nru libraw-0.16.2/libraw/libraw_datastream.h libraw-0.17.0/libraw/libraw_datastream.h --- libraw-0.16.2/libraw/libraw_datastream.h 2015-05-16 12:32:15.000000000 +0000 +++ libraw-0.17.0/libraw/libraw_datastream.h 2015-08-15 13:10:27.000000000 +0000 @@ -1,6 +1,6 @@ /* -*- C -*- * File: libraw_datastream.h - * Copyright 2008-2013 LibRaw LLC (info@libraw.org) + * Copyright 2008-2015 LibRaw LLC (info@libraw.org) * Created: Sun Jan 18 13:07:35 2009 * * LibRaw Data stream interface @@ -151,7 +151,7 @@ { if(substream) return substream->get_char(); if(streampos>=streamsize) - throw LIBRAW_EXCEPTION_IO_EOF; + return -1; return buf[streampos++]; } diff -Nru libraw-0.16.2/libraw/libraw.h libraw-0.17.0/libraw/libraw.h --- libraw-0.16.2/libraw/libraw.h 2015-05-16 12:32:15.000000000 +0000 +++ libraw-0.17.0/libraw/libraw.h 2015-08-15 13:10:27.000000000 +0000 @@ -1,6 +1,6 @@ /* -*- C++ -*- * File: libraw.h - * Copyright 2008-2013 LibRaw LLC (info@libraw.org) + * Copyright 2008-2015 LibRaw LLC (info@libraw.org) * Created: Sat Mar 8, 2008 * * LibRaw C++ interface @@ -75,6 +75,7 @@ /* helpers */ DllDef void libraw_set_memerror_handler(libraw_data_t*, memory_callback cb, void *datap); +DllDef void libraw_set_exifparser_handler(libraw_data_t*, exif_parser_callback cb, void *datap); DllDef void libraw_set_dataerror_handler(libraw_data_t*,data_callback func,void *datap); DllDef void libraw_set_progress_handler(libraw_data_t*,progress_callback cb,void *datap); DllDef const char * libraw_unpack_function_name(libraw_data_t* lr); @@ -89,6 +90,24 @@ DllDef libraw_processed_image_t* libraw_dcraw_make_mem_image(libraw_data_t* lr, int *errc); DllDef libraw_processed_image_t* libraw_dcraw_make_mem_thumb(libraw_data_t* lr, int *errc); DllDef void libraw_dcraw_clear_mem(libraw_processed_image_t*); + /* getters/setters used by 3DLut Creator */ +DllDef void libraw_set_demosaic(libraw_data_t *lr,int value); +DllDef void libraw_set_output_color(libraw_data_t *lr,int value); +DllDef void libraw_set_output_bps(libraw_data_t *lr,int value); +DllDef void libraw_set_gamma(libraw_data_t *lr,int index, float value); +DllDef void libraw_set_no_auto_bright(libraw_data_t *lr,int value); +DllDef void libraw_set_bright(libraw_data_t *lr,float value); +DllDef void libraw_set_highlight(libraw_data_t *lr,int value); +DllDef void libraw_set_fbdd_noiserd(libraw_data_t *lr,int value); +DllDef int libraw_get_raw_height(libraw_data_t *lr); +DllDef int libraw_get_raw_width(libraw_data_t *lr); +DllDef int libraw_get_iheight(libraw_data_t *lr); +DllDef int libraw_get_iwidth(libraw_data_t *lr); +DllDef float libraw_get_cam_mul(libraw_data_t *lr,int index); +DllDef float libraw_get_pre_mul(libraw_data_t *lr,int index); +DllDef float libraw_get_rgb_cam(libraw_data_t *lr,int index1, int index2); +DllDef int libraw_get_color_maximum(libraw_data_t *lr); + #ifdef __cplusplus } #endif @@ -109,12 +128,14 @@ int open_file(const wchar_t *fname, INT64 max_buffered_sz=LIBRAW_USE_STREAMS_DATASTREAM_MAXSIZE); #endif int open_buffer(void *buffer, size_t size); - int open_datastream(LibRaw_abstract_datastream *); + virtual int open_datastream(LibRaw_abstract_datastream *); + int error_count(){return libraw_internal_data.unpacker_data.data_error;} void recycle_datastream(); int unpack(void); int unpack_thumb(void); int adjust_sizes_info_only(void); + LibRaw_colormatrix_type camera_color_type(); int subtract_black(); int subtract_black_internal(); int raw2image(); @@ -122,6 +143,7 @@ void raw2image_start(); void free_image(); int adjust_maximum(); + void set_exifparser_handler( exif_parser_callback cb,void *data) {callbacks.exifparser_data = data; callbacks.exif_cb = cb; } void set_memerror_handler( memory_callback cb,void *data) {callbacks.memcb_data = data; callbacks.mem_cb = cb; } void set_dataerror_handler(data_callback func, void *data) { callbacks.datacb_data = data; callbacks.data_cb = func;} void set_progress_handler(progress_callback pcb, void *data) { callbacks.progresscb_data = data; callbacks.progress_cb = pcb;} @@ -140,6 +162,9 @@ /* information calls */ int is_fuji_rotated(){return libraw_internal_data.internal_output_params.fuji_width;} int is_sraw(); + int sraw_midpoint(); + int is_nikon_sraw(); + int is_coolscan_nef(); /* memory writers */ virtual libraw_processed_image_t* dcraw_make_mem_image(int *errcode=NULL); virtual libraw_processed_image_t* dcraw_make_mem_thumb(int *errcode=NULL); @@ -159,20 +184,27 @@ int fcol (int row, int col); const char *unpack_function_name(); - int get_decoder_info(libraw_decoder_info_t* d_info); + virtual int get_decoder_info(libraw_decoder_info_t* d_info); libraw_internal_data_t * get_internal_data_pointer(){ return &libraw_internal_data; } /* Debanding filter */ - int wf_remove_banding(); + int wf_remove_banding(); /* Phase one correction/subtractBL calls */ - void phase_one_subtract_black(ushort *src, ushort *dest); - void phase_one_correct(); - int set_rawspeed_camerafile(char *filename); + /* Returns libraw error code */ + + int phase_one_subtract_black(ushort *src, ushort *dest); + int phase_one_correct(); + + int set_rawspeed_camerafile(char *filename); void setCancelFlag(); + void clearCancelFlag(); + virtual void adobe_coeff (const char *, const char *, int internal_only=0); + protected: void checkCancel(); + void cam_xyz_coeff(float _rgb_cam[3][4], double cam_xyz[4][3]); void phase_one_allocate_tempbuffer(); void phase_one_free_tempbuffer(); virtual int is_phaseone_compressed(); @@ -292,6 +324,7 @@ int flip_index (int row, int col); void gamma_curve (double pwr, double ts, int mode, int imax); + void cubic_spline (const int *x_, const int *y_, const int len); /* RawSpeed data */ void *_rawspeed_camerameta; diff -Nru libraw-0.16.2/libraw/libraw_internal.h libraw-0.17.0/libraw/libraw_internal.h --- libraw-0.16.2/libraw/libraw_internal.h 2015-05-16 12:32:15.000000000 +0000 +++ libraw-0.17.0/libraw/libraw_internal.h 2015-08-15 13:10:27.000000000 +0000 @@ -1,6 +1,6 @@ /* -*- C++ -*- * File: libraw_internal.h - * Copyright 2008-2013 LibRaw LLC (info@libraw.org) + * Copyright 2008-2015 LibRaw LLC (info@libraw.org) * Created: Sat Mar 8 , 2008 * * LibRaw internal data structures (not visible outside) @@ -51,7 +51,7 @@ unsigned bitbuf; int vbits, reset; }getbits; - struct + struct { UINT64 bitbuf; int vbits; @@ -67,12 +67,12 @@ int vbits, padding; }pana_bits; uchar jpeg_buffer[4096]; - struct + struct { float cbrt[0x10000], xyz_cam[3][4]; }ahd_data; - void init() - { + void init() + { getbits.bitbuf = 0; getbits.vbits = getbits.reset = 0; ph1_bits.bitbuf = 0; ph1_bits.vbits = 0; pana_bits.vbits = 0; @@ -101,6 +101,7 @@ char *meta_data; INT64 profile_offset; INT64 toffset; + unsigned pana_black[4]; } internal_data_t; @@ -122,7 +123,7 @@ typedef struct { - short order; + short order; ushort sraw_mul[4],cr2_slice[3]; unsigned kodak_cbpp; INT64 strip_offset, data_offset; @@ -137,6 +138,7 @@ unsigned zero_after_ff; unsigned tile_width, tile_length,load_flags; unsigned data_error; + int hasselblad_parser_flag; }unpacker_data_t; @@ -144,22 +146,22 @@ typedef struct { internal_data_t internal_data; - libraw_internal_output_params_t internal_output_params; + libraw_internal_output_params_t internal_output_params; output_data_t output_data; identify_data_t identify_data; unpacker_data_t unpacker_data; } libraw_internal_data_t; -struct decode +struct decode { struct decode *branch[2]; int leaf; }; -struct tiff_ifd_t +struct tiff_ifd_t { - int t_width, t_height, bps, comp, phint, offset, t_flip, samples, bytes,tile_maxbytes; + int t_width, t_height, bps, comp, phint, offset, t_flip, samples, bytes; int t_tile_width, t_tile_length; }; diff -Nru libraw-0.16.2/libraw/libraw_types.h libraw-0.17.0/libraw/libraw_types.h --- libraw-0.16.2/libraw/libraw_types.h 2015-05-16 12:32:15.000000000 +0000 +++ libraw-0.17.0/libraw/libraw_types.h 2015-08-15 13:10:27.000000000 +0000 @@ -1,6 +1,6 @@ /* -*- C++ -*- * File: libraw_types.h - * Copyright 2008-2013 LibRaw LLC (info@libraw.org) + * Copyright 2008-2015 LibRaw LLC (info@libraw.org) * Created: Sat Mar 8 , 2008 * * LibRaw C data structures @@ -29,10 +29,10 @@ #endif #include -#if defined (_OPENMP) +#if defined (_OPENMP) -#if defined(WIN32) -# if defined (_MSC_VER) && (_MSC_VER >= 1600 || (_MSC_VER == 1500 && _MSC_FULL_VER >= 150030729) ) +#if defined(WIN32) +# if defined (_MSC_VER) && (_MSC_VER >= 1600 || (_MSC_VER == 1500 && _MSC_FULL_VER >= 150030729) ) /* VS2010+ : OpenMP works OK, VS2008: have tested by cgilles */ # define LIBRAW_USE_OPENMP #elif defined (__INTEL_COMPILER) && (__INTEL_COMPILER >=910) @@ -44,7 +44,7 @@ /* Not Win32 */ # elif (defined(__APPLE__) || defined(__MACOSX__)) && defined(_REENTRANT) # undef LIBRAW_USE_OPENMP -# else +# else # define LIBRAW_USE_OPENMP # endif #endif @@ -111,6 +111,7 @@ typedef void (* memory_callback)(void * data, const char *file, const char *where); +typedef void (*exif_parser_callback) (void *context, int tag, int type, int len,unsigned int ord, void *ifp); DllDef void default_memory_callback(void *data,const char *file, const char *where); @@ -130,44 +131,49 @@ progress_callback progress_cb; void *progresscb_data; + + exif_parser_callback exif_cb; + void *exifparser_data; } libraw_callbacks_t; typedef struct { - enum LibRaw_image_formats type; + enum LibRaw_image_formats type; ushort height, width, colors, bits; - unsigned int data_size; - unsigned char data[1]; + unsigned int data_size; + unsigned char data[1]; }libraw_processed_image_t; typedef struct { - char make[64]; - char model[64]; - - unsigned raw_count; - unsigned dng_version; - unsigned is_foveon; - int colors; - - unsigned filters; - char xtrans[6][6]; - char cdesc[5]; + char make[64]; + char model[64]; + char software[64]; + unsigned raw_count; + unsigned dng_version; + unsigned is_foveon; + int colors; + unsigned filters; + char xtrans[6][6]; + char xtrans_abs[6][6]; + char cdesc[5]; + unsigned xmplen; + char *xmpdata; }libraw_iparams_t; typedef struct { - ushort raw_height, + ushort raw_height, raw_width, - height, - width, - top_margin, + height, + width, + top_margin, left_margin; ushort iheight, iwidth; @@ -180,52 +186,86 @@ struct ph1_t { - int format, key_off, t_black, black_off, split_col, tag_21a; - float tag_210; + int format, key_off, tag_21a; + int t_black, split_col, black_col, split_row, black_row; + float tag_210; }; typedef struct { - ushort curve[0x10000]; - unsigned cblack[4]; + unsigned short illuminant; + float calibration[4][4]; + float colormatrix[4][3]; +} libraw_dng_color_t; + +typedef struct +{ + int CanonColorDataVer; + int CanonColorDataSubVer; + int SpecularWhiteLevel; + int AverageBlackLevel; +} libraw_canon_makernotes_t; + +typedef struct +{ + ushort curve[0x10000]; + unsigned cblack[4102]; unsigned black; unsigned data_maximum; unsigned maximum; - ushort white[8][8]; - float cam_mul[4]; - float pre_mul[4]; - float cmatrix[3][4]; - float rgb_cam[3][4]; - float cam_xyz[4][3]; + ushort white[8][8]; + float cam_mul[4]; + float pre_mul[4]; + float cmatrix[3][4]; + float rgb_cam[3][4]; + float cam_xyz[4][3]; struct ph1_t phase_one_data; - float flash_used; - float canon_ev; + float flash_used; + float canon_ev; char model2[64]; void *profile; unsigned profile_length; unsigned black_stat[8]; + libraw_dng_color_t dng_color[2]; + libraw_canon_makernotes_t canon_makernotes; + float baseline_exposure; + int OlympusSensorCalibration[2]; + float FujiExpoMidPointShift; + int digitalBack_color; }libraw_colordata_t; typedef struct { enum LibRaw_thumbnail_formats tformat; - ushort twidth, + ushort twidth, theight; unsigned tlength; int tcolors; - + char *thumb; }libraw_thumbnail_t; typedef struct { - float iso_speed; + float latitude[3]; /* Deg,min,sec */ + float longtitude[3]; /* Deg,min,sec */ + float gpstimestamp[3]; /* Deg,min,sec */ + float altitude; + char altref, latref, longref, gpsstatus; + char gpsparsed; + +} libraw_gps_info_t; + +typedef struct +{ + float iso_speed; float shutter; float aperture; float focal_len; - time_t timestamp; + time_t timestamp; unsigned shot_order; unsigned gpsdata[32]; + libraw_gps_info_t parsed_gps; char desc[512], artist[64]; } libraw_imgother_t; @@ -257,23 +297,14 @@ int user_qual; /* -q */ int user_black; /* -k */ int user_cblack[4]; - int sony_arw2_hack; int user_sat; /* -S */ int med_passes; /* -m */ - float auto_bright_thr; + float auto_bright_thr; float adjust_maximum_thr; int no_auto_bright; /* -W */ int use_fuji_rotate;/* -j */ int green_matching; -#if 0 - /* AFD noise suppression parameters, disabled for now */ - int afd_noise_att; - int afd_noise_thres; - int afd_luminance_passes; - int afd_chrominance_method; - int afd_luminance_only; -#endif /* DCB parameters */ int dcb_iterations; int dcb_enhance_fl; @@ -308,6 +339,12 @@ int sraw_ycc; /* Force use x3f data decoding either if demosaic pack GPL2 enabled */ int force_foveon_x3f; + int x3f_flags; + /* Sony ARW2 digging mode */ + int sony_arw2_options; + int sony_arw2_posterization_thr; + /* Nikon Coolscan */ + float coolscan_nef_gamma; }libraw_output_params_t; typedef struct @@ -320,9 +357,10 @@ ushort (*color4_image)[4] ; /* alias to 3-color variand decoded by RawSpeed */ ushort (*color3_image)[3]; - + /* Phase One black level data; */ - short (*ph1_black)[2]; + short (*ph1_cblack)[2]; + short (*ph1_rblack)[2]; /* save color and sizes here, too.... */ libraw_iparams_t iparams; libraw_image_sizes_t sizes; @@ -330,12 +368,62 @@ libraw_colordata_t color; } libraw_rawdata_t; +typedef struct +{ + unsigned long long LensID; + char Lens[128]; + ushort LensFormat; /* to characterize the image circle the lens covers */ + ushort LensMount; /* 'male', lens itself */ + unsigned long long CamID; + ushort CameraFormat; /* some of the sensor formats */ + ushort CameraMount; /* 'female', body throat */ + char body[64]; + short FocalType; /* -1/0 is unknown; 1 is fixed focal; 2 is zoom */ + char LensFeatures_pre[16], LensFeatures_suf[16]; + float MinFocal, MaxFocal; + float MaxAp4MinFocal, MaxAp4MaxFocal, MinAp4MinFocal, MinAp4MaxFocal; + float MaxAp, MinAp; + float CurFocal, CurAp; + float MaxAp4CurFocal, MinAp4CurFocal; + float LensFStops; + unsigned long long TeleconverterID; + char Teleconverter[128]; + unsigned long long AdapterID; + char Adapter[128]; + unsigned long long AttachmentID; + char Attachment[128]; + short CanonFocalUnits; + float FocalLengthIn35mmFormat; +} libraw_makernotes_lens_t; + +typedef struct +{ + float NikonEffectiveMaxAp; + uchar NikonLensIDNumber, NikonLensFStops, NikonMCUVersion, NikonLensType; +} libraw_nikonlens_t; + +typedef struct +{ + float MinFocal, MaxFocal, MaxAp4MinFocal, MaxAp4MaxFocal; +} libraw_dnglens_t; + +typedef struct +{ + float MinFocal, MaxFocal, MaxAp4MinFocal, MaxAp4MaxFocal, EXIF_MaxAp; + char LensMake[128], Lens[128]; + ushort FocalLengthIn35mmFormat; + libraw_nikonlens_t nikon; + libraw_dnglens_t dng; + libraw_makernotes_lens_t makernotes; +} libraw_lensinfo_t; + typedef struct { ushort (*image)[4] ; libraw_image_sizes_t sizes; libraw_iparams_t idata; + libraw_lensinfo_t lens; libraw_output_params_t params; unsigned int progress_flags; unsigned int process_warnings; @@ -343,7 +431,7 @@ libraw_imgother_t other; libraw_thumbnail_t thumbnail; libraw_rawdata_t rawdata; - void *parent_class; + void *parent_class; } libraw_data_t; diff -Nru libraw-0.16.2/libraw/libraw_version.h libraw-0.17.0/libraw/libraw_version.h --- libraw-0.16.2/libraw/libraw_version.h 2015-05-16 12:32:15.000000000 +0000 +++ libraw-0.17.0/libraw/libraw_version.h 2015-08-15 13:10:27.000000000 +0000 @@ -1,6 +1,6 @@ /* -*- C++ -*- * File: libraw_version.h - * Copyright 2008-2013 LibRaw LLC (info@libraw.org) + * Copyright 2008-2015 LibRaw LLC (info@libraw.org) * Created: Mon Sept 8, 2008 * * LibRaw C++ interface @@ -24,11 +24,11 @@ #define __VERSION_H #define LIBRAW_MAJOR_VERSION 0 -#define LIBRAW_MINOR_VERSION 16 -#define LIBRAW_PATCH_VERSION 2 +#define LIBRAW_MINOR_VERSION 17 +#define LIBRAW_PATCH_VERSION 0 #define LIBRAW_VERSION_TAIL Release -#define LIBRAW_SHLIB_CURRENT 10 +#define LIBRAW_SHLIB_CURRENT 15 #define LIBRAW_SHLIB_REVISION 0 #define LIBRAW_SHLIB_AGE 0 diff -Nru libraw-0.16.2/Makefile.devel libraw-0.17.0/Makefile.devel --- libraw-0.16.2/Makefile.devel 2015-05-16 12:32:15.000000000 +0000 +++ libraw-0.17.0/Makefile.devel 2015-08-15 13:10:27.000000000 +0000 @@ -5,39 +5,46 @@ CC=gcc CXX=g++ -CFLAGS= +#CFLAGS= # RawSpeed Support -CFLAGS+=-DUSE_RAWSPEED -I../RawSpeed -I/usr/local/include/libxml2 -LDADD+=-L../RawSpeed/RawSpeed/release -lrawspeed -L/usr/local/include -ljpeg -lxml2 -RAWSPEED_DATA=../RawSpeed/data/cameras.xml +# CFLAGS+=-DUSE_RAWSPEED -I../RawSpeed -I/opt/local/include/libxml2 +# LDADD+=-L../RawSpeed/RawSpeed/release -lrawspeed -L/opt/local/include -ljpeg -lxml2 +# RAWSPEED_DATA=../RawSpeed/data/cameras.xml -CC=gcc48 -CXX=g++48 -CFLAGS+= -g -I. -pedantic -Wno-long-long -Wno-overflow -O4 -fopenmp +CC=gcc +CXX=g++ +# CFLAGS+= -g -I. -pedantic -Wno-long-long -Wno-overflow -O4 -fopenmp +CFLAGS+= -g -I. -pedantic -Wno-long-long -Wno-overflow -O3 + + +#CC=gcc +#CXX=g++ +CFLAGS+= -g -I. -pedantic -Wno-long-long -Wno-overflow -O2 # Haswell: #CFLAGS+=-march=core-avx2 -mtune=core-avx2 -mavx2 # LCMS support # For lcms2 set -DUSE_LCMS2 -#CFLAGS+=-DUSE_LCMS -I/usr/local/include -#LDADD+=-L/usr/local/lib -llcms +CFLAGS+=-DUSE_LCMS2 -I/opt/local/include +LDADD+=-L/opt/local/lib -llcms # Jasper support for RedCine -CFLAGS+=-DUSE_JASPER -I/usr/local/include -LDADD+=-L/usr/local/lib -ljasper +CFLAGS+=-DUSE_JASPER -I/opt/local/include +LDADD+=-L/opt/local/lib -ljasper # JPEG support for DNG -CFLAGS+=-DUSE_JPEG -I/usr/local/include -LDADD+=-L/usr/local/lib -ljpeg +CFLAGS+=-DUSE_JPEG -I/opt/local/include +LDADD+=-L/opt/local/lib -ljpeg + # LIBJPEG8: CFLAGS+=-DUSE_JPEG8 # Demosaic Pack GPL2: -DPCFLAGS+=-I../LibRaw-demosaic-pack-GPL2 -CFLAGS+=-DLIBRAW_DEMOSAIC_PACK_GPL2 +# DPCFLAGS+=-I../LibRaw-demosaic-pack-GPL2 +# CFLAGS+=-DLIBRAW_DEMOSAIC_PACK_GPL2 # Demosaic Pack GPL3: #DPCFLAGS+=-I../LibRaw-demosaic-pack-GPL3 @@ -61,7 +68,7 @@ ## Demosaic Pack(s) -object/demosaic_packs.o: internal/demosaic_packs.cpp ${LR_INCLUDES} +object/demosaic_packs.o: internal/demosaic_packs.cpp ${LR_INCLUDES} $(CXX) -w -c -DLIBRAW_NOTHREADS ${CFLAGS} ${DPCFLAGS} -o object/demosaic_packs.o internal/demosaic_packs.cpp object/demosaic_packs_mt.o: internal/demosaic_packs.cpp ${LR_INCLUDES} @@ -101,7 +108,7 @@ dcraw_binaries: bin/dcraw_dist bin/dcraw_dist: dcraw/dcraw.c Makefile.devel - $(CXX) -w -O4 -DLIBRAW_NOTHREADS -DNO_JPEG -DNO_LCMS -DNO_JASPER -I/usr/local/include -o bin/dcraw_dist dcraw/dcraw.c -lm -L/usr/local/lib + $(CXX) -w -O3 -DLIBRAW_NOTHREADS -DNO_LCMS -DNO_JASPER -I/opt/local/include -o bin/dcraw_dist dcraw/dcraw.c -lm -L/opt/local/lib -ljpeg regenerate: ${PP} -N -DDEFINES dcraw/dcraw.c >internal/defines.h @@ -148,7 +155,7 @@ object/dcraw_fileio_mt.o: internal/dcraw_fileio.cpp ${LR_INCLUDES} $(CXX) -c -pthread ${LCMS_DEF} ${CFLAGS} -o object/dcraw_fileio_mt.o internal/dcraw_fileio.cpp -object/libraw_cxx_mt.o: src/libraw_cxx.cpp ${LR_INCLUDES} +object/libraw_cxx_mt.o: src/libraw_cxx.cpp ${LR_INCLUDES} $(CXX) -c ${LCMS_DEF} -pthread ${CFLAGS} -o object/libraw_cxx_mt.o src/libraw_cxx.cpp object/libraw_datastream_mt.o: src/libraw_datastream.cpp ${LR_INCLUDES} diff -Nru libraw-0.16.2/Makefile.dist libraw-0.17.0/Makefile.dist --- libraw-0.16.2/Makefile.dist 2015-05-16 12:32:15.000000000 +0000 +++ libraw-0.17.0/Makefile.dist 2015-08-15 13:10:27.000000000 +0000 @@ -1,25 +1,25 @@ all: library all_samples -CFLAGS=-O4 -I. -w +CFLAGS=-O3 -I. -w # OpenMP support #CFLAGS+=-fopenmp # RawSpeed Support #CFLAGS+=-pthread -DUSE_RAWSPEED -I../RawSpeed -I/usr/local/include/libxml2 -#LDADD+=-L../RawSpeed/RawSpeed -lrawspeed -L/usr/local/include -ljpeg -lxml2 +#LDADD+=-L../RawSpeed/RawSpeed -lrawspeed -L/usr/local/lib -ljpeg -lxml2 #RAWSPEED_DATA=../RawSpeed/data/cameras.xml # Jasper support for RedCine -CFLAGS+=-DUSE_JASPER -I/usr/local/include -LDADD+=-L/usr/local/lib -ljasper +#CFLAGS+=-DUSE_JASPER -I/usr/local/include +#LDADD+=-L/usr/local/lib -ljasper # JPEG support for DNG -CFLAGS+=-DUSE_JPEG -I/usr/local/include -LDADD+=-L/usr/local/lib -ljpeg +#CFLAGS+=-DUSE_JPEG -I/usr/local/include +#LDADD+=-L/usr/local/lib -ljpeg # LIBJPEG8: -CFLAGS+=-DUSE_JPEG8 +#CFLAGS+=-DUSE_JPEG8 # LCMS support #CFLAGS+=-DUSE_LCMS -I/usr/local/include diff -Nru libraw-0.16.2/RawSpeed/rawspeed_xmldata.cpp libraw-0.17.0/RawSpeed/rawspeed_xmldata.cpp --- libraw-0.16.2/RawSpeed/rawspeed_xmldata.cpp 2015-05-16 12:32:15.000000000 +0000 +++ libraw-0.17.0/RawSpeed/rawspeed_xmldata.cpp 2015-08-15 13:10:27.000000000 +0000 @@ -4,8 +4,8 @@ "\n", " \n", @@ -2413,7 +2519,7 @@ " \n", " \n", " \n", -" \n", +" \n", " \n", " \n", " BLUE\n", @@ -2465,7 +2571,7 @@ " \n", " \n", " \n", -" \n", +" \n", " \n", " \n", " GREEN\n", @@ -2543,7 +2649,7 @@ " \n", " \n", " \n", -" \n", +" \n", " \n", " \n", " GREEN\n", @@ -2725,7 +2831,7 @@ " \n", " \n", " \n", -" \n", +" \n", " \n", " \n", " GREEN\n", @@ -2816,7 +2922,7 @@ " \n", " \n", " \n", -" \t\n", +" \n", " \n", " \n", " BLUE\n", @@ -3027,7 +3133,7 @@ " \n", " \n", " \n", -" \t\n", +" \n", " \n", " \n", " GREEN\n", @@ -3040,7 +3146,7 @@ " \n", " \n", " \n", -" \t\n", +" \n", " \n", " \n", " GREEN\n", @@ -3080,7 +3186,7 @@ " \n", " \n", " \n", -" \t\n", +" \n", " \n", " \n", " GREEN\n", @@ -3093,7 +3199,7 @@ " \n", " \n", " \n", -" \t\n", +" \n", " \n", " \n", " GREEN\n", @@ -3132,7 +3238,7 @@ " \n", " \n", " \n", -" \t\n", +" \n", " \n", " \n", " GREEN\n", @@ -3145,7 +3251,7 @@ " \n", " \n", " \n", -" \t\n", +" \n", " \n", " \n", " GREEN\n", @@ -3158,7 +3264,7 @@ " \n", " \n", " \n", -" \t\n", +" \n", " \n", " \n", " GREEN\n", @@ -3171,7 +3277,7 @@ " \n", " \n", " \n", -" \t\n", +" \n", " \n", " \n", " GREEN\n", @@ -3184,7 +3290,7 @@ " \n", " \n", " \n", -" \t\t\n", +" \n", " \n", " \n", " RED\n", @@ -3283,7 +3389,7 @@ " \n", " \n", " \n", -" \t \n", +" \n", " \n", " \n", " BLUE\n", @@ -3367,6 +3473,19 @@ " \n", " \n", " \n", +" \n", +" \n", +" BLUE\n", +" GREEN\n", +" GREEN\n", +" RED\n", +" \n", +" \n", +" \n", +" \n", +" \n", +" \n", +" \n", " \n", " \n", " BLUE\n", @@ -3379,8 +3498,8 @@ " \n", " \n", " \n", -" \t\n", -" \t\n", +" \n", +" \n", " \n", " \n", " BLUE\n", @@ -3392,8 +3511,8 @@ " \n", " \n", " \n", -" \t\n", -" \t\n", +" \n", +" \n", " \n", " \n", " BLUE\n", @@ -3406,8 +3525,8 @@ " \n", " \n", " \n", -" \t\n", -" \t\n", +" \n", +" \n", " \n", " \n", " GREEN\n", @@ -3415,12 +3534,25 @@ " BLUE\n", " GREEN\n", " \n", -" \n", +" \n", " \n", " \n", " \n", -" \t\t\n", -" \t\n", +" \n", +" \n", +" \n", +" \n", +" GREEN\n", +" RED\n", +" BLUE\n", +" GREEN\n", +" \n", +" \n", +" \n", +" \n", +" \n", +" \n", +" \n", " \n", " \n", " GREEN\n", @@ -3428,12 +3560,12 @@ " BLUE\n", " GREEN\n", " \n", -" \n", +" \n", " \n", " \n", " \n", -" \t\t\n", -" \t\n", +" \n", +" \n", " \n", " \n", " GREEN\n", @@ -3441,12 +3573,12 @@ " BLUE\n", " GREEN\n", " \n", -" \n", +" \n", " \n", " \n", " \n", -" \t\t\n", -" \t\n", +" \n", +" \n", " \n", " \n", " GREEN\n", @@ -3454,12 +3586,12 @@ " BLUE\n", " GREEN\n", " \n", -" \n", +" \n", " \n", " \n", " \n", -" \t\t\n", -" \t\n", +" \n", +" \n", " \n", " \n", " GREEN\n", @@ -3467,42 +3599,39 @@ " RED\n", " GREEN\n", " \n", -" \n", +" \n", " \n", -" \t\n", -" \n", +" \n", +" \n", " \n", " GREEN\n", " BLUE\n", " RED\n", " GREEN\n", " \n", -" \n", +" \n", " \n", -" \t\n", -" \n", +" \n", +" \n", " \n", " GREEN\n", " BLUE\n", " RED\n", " GREEN\n", " \n", -" \n", +" \n", " \n", " \n", -" \n", +" \n", " \n", -" BLUE\n", -" GREEN\n", -" GREEN\n", -" RED\n", +" GREEN\n", +" BLUE\n", +" RED\n", +" GREEN\n", " \n", -" \n", +" \n", " \n", -" \n", -" \n", -" \t\n", -" \n", +" \n", " \n", " \n", " RED\n", @@ -3512,7 +3641,7 @@ " \n", " \n", " \n", -" \t\n", +" \n", " \n", " \n", " RED\n", @@ -3555,7 +3684,7 @@ " \n", " \n", " \n", -" \n", +" \n", " \n", " \n", " \n", @@ -3587,7 +3716,7 @@ " \n", " \n", " \n", -" \t\n", +" \n", " \n", " \n", " RED\n", @@ -3727,7 +3856,7 @@ " \n", " \n", " \n", -" \t\n", +" \n", " \n", " \n", " RED\n", @@ -3807,7 +3936,7 @@ " \n", " \n", " \n", -" \t \n", +" \n", " \n", " \n", " RED\n", @@ -3817,7 +3946,7 @@ " \n", " \n", " \n", -" \t\n", +" \n", " \n", " \n", " RED\n", @@ -3825,7 +3954,27 @@ " GREEN\n", " BLUE\n", " \n", -" \n", +" \n", +" \n", +" \n", +" \n", +" \n", +" RED\n", +" GREEN\n", +" GREEN\n", +" BLUE\n", +" \n", +" \n", +" \n", +" \n", +" \n", +" \n", +" RED\n", +" GREEN\n", +" GREEN\n", +" BLUE\n", +" \n", +" \n", " \n", " \n", " \n", @@ -3835,7 +3984,7 @@ " GREEN\n", " BLUE\n", " \n", -" \n", +" \n", " \n", " \n", " \n", @@ -3845,7 +3994,7 @@ " GREEN\n", " BLUE\n", " \n", -" \n", +" \n", " \n", " \n", " \n", @@ -3927,7 +4076,7 @@ " \n", " \n", " \n", -" \t\n", +" \n", " \n", " \n", " RED\n", @@ -3959,8 +4108,8 @@ " \n", " \n", " \n", -" \t \n", -" \n", +" \n", +" \n", "\n", 0 }; diff -Nru libraw-0.16.2/README libraw-0.17.0/README --- libraw-0.16.2/README 2015-05-16 12:32:15.000000000 +0000 +++ libraw-0.17.0/README 2015-08-15 13:10:27.000000000 +0000 @@ -11,11 +11,11 @@ The library is intended for embedding in RAW converters, data analyzers, and other programs using RAW files as the initial data. -LibRaw library, Copyright (C) 2008-2009 LibRaw LLC (info@libraw.org) +LibRaw library, Copyright (C) 2008-2015 LibRaw LLC (info@libraw.org) The library includes source code from dcraw.c, Dave Coffin's raw photo decoder - Copyright 1997-2010 by Dave Coffin, dcoffin a cybercom o net + Copyright 1997-2015 by Dave Coffin, dcoffin a cybercom o net LibRaw is distributed for free under three different licenses: * GNU Lesser General Public License, version 2.1 diff -Nru libraw-0.16.2/README.cmake libraw-0.17.0/README.cmake --- libraw-0.16.2/README.cmake 1970-01-01 00:00:00.000000000 +0000 +++ libraw-0.17.0/README.cmake 2015-08-15 13:10:27.000000000 +0000 @@ -0,0 +1,9 @@ +Due to inability to support (user contributed) Cmake scripts, +the cmake builds are not officially supported by LibRaw team +since October 23, 2014 + +The scripts are moved to separate github repository +github.com:LibRaw/LibRaw-cmake.git + +Checkout from this repo if you want to use Cmake to build LibRaw. + diff -Nru libraw-0.16.2/README.demosaic-packs.rus libraw-0.17.0/README.demosaic-packs.rus --- libraw-0.16.2/README.demosaic-packs.rus 2015-05-16 12:32:15.000000000 +0000 +++ libraw-0.17.0/README.demosaic-packs.rus 1970-01-01 00:00:00.000000000 +0000 @@ -1,59 +0,0 @@ -======================= LibRaw demosaic pack(s) =============================== - -Существует множество методов бейеровской интерполяции (демозаики), реализованных -в open-source приложениях. - -К сожалению, многие реализации распространяются под лицензиями GPL2/GPL3, что -не дает включить их в LibRaw, распространяемую под более свободными лицензиями. - -Конечно, эти методы интерполяции можно распространять на условиях их "родных" -GPL2/GPL3 и использовать совместно с LibRaw в следующем случае - - * LibRaw используется на условиях LGPL (которая совместима с GPL) - * Результирующее приложение, использующее LibRaw (лицензия LGPL) и - дополнительные реализации демозаики (лицензии GPL2/GPL3) распространяется на - условиях лицензии использованной демозаики. Т.е. GPL2+/GPL3+ - -Для облегчения такого использования мы собрали два "комплекта" алгоритмов -интерполяции. В настоящее время они доступны через GitHub: - - 1) LibRaw demosaic pack GPL2 - GitHub URL: git://github.com/LibRaw/LibRaw-demosaic-pack-GPL2.git - - Этот набор включает следующие алгоритмы байеровской интерполяции: - - * AFD и LMMSE, заимствованные из программы PerfectRaw, автор Manuel - Llorens - * VCD, Улучшенный AHD, несколько алгоритмов постпроцессинга - заимствованы из "Modified DCRAW", автор Paul Lee - - 2) LibRaw demosaic pack GPL3 - GitHub URL: git://github.com/LibRaw/LibRaw-demosaic-pack-GPL3.git - - Этот набор включает интерполяцию AMaZE из программы RawTherapee, - автор by Emil Martinec. - -== Как использовать (developer only!) === - -0. В настоящий момент LibRaw с поддержкой demosaic pack(s) доступна только на -GitHub: git://github.com/LibRaw/LibRaw.git - -1. Возьмите с GitHub головную ветку проекта LibRaw: - git clone git://github.com/LibRaw/LibRaw.git - -2. Возьмите оттуда же нужные вам наборы реализаций демозаики: - git clone git://github.com/LibRaw/LibRaw-demosaic-pack-GPL2.git - git clone git://github.com/LibRaw/LibRaw-demosaic-pack-GPL3.git - - -3. Перейдите в каталог LibRaw и проверьте настройки в Makefile: -Переменные CFLAGS_DP1 и CFLAGS_DP2 должны "указывать" в каталоги с demosaic pack(s) -Переменная CFLAGS должна содержать -DLIBRAW_DEMOSAIC_PACK_GPL2 и/или --DLIBRAW_DEMOSAIC_PACK_GPL3 - -4. Запустите make - -Не поддерживаются на текущий момент: - ./configure - если вы запустите этот скрипт, то все сломается - передача дополнительных параметров новых алгоритмов интерполяции в примере -dcraw_emu diff -Nru libraw-0.16.2/README.RawSpeed.rus libraw-0.17.0/README.RawSpeed.rus --- libraw-0.16.2/README.RawSpeed.rus 2015-05-16 12:32:15.000000000 +0000 +++ libraw-0.17.0/README.RawSpeed.rus 1970-01-01 00:00:00.000000000 +0000 @@ -1,63 +0,0 @@ -======================= СборкаLibRaw с библиотекой RawSpeed ================== - -1) Требования: - -Для сборки RawSpeed в вашей системе должны быть установлены библиотеки -libxml2, iconv и LibJPEG - -2) Сборка RawSpeed - -- Сборка описана на странице http://rawstudio.org/blog/?p=800 - - -- Win32: помимо перечисленных выше библиотек, вам понадобится библиотека - POSIX Threads for Win32 (http://sources.redhat.com/pthreads-win32/) - - -- вы можете использовать .pro-файлы для qmake, поставляемые с LibRaw - (RawSpeed/rawspeed.qmake-pro-files.patch) - Поправьте пути до библиотек и заголовочных файлов в соответствии с - настройками вашей системы. - - -- Win32: Для сборки RawSpeed как .DLL вам нужно добавить описание - __declspec(..) ко всем используемым классам. - Вы можете использовать патч, поставляемый с LibRaw - (RawSpeed/rawspeed.win32-dll.patch) - - -- Unix: вам нужно определить функцию rawspeed_get_number_of_processor_cores() - Для большинства Unix-систем подойдет определение через вызов sysconf(). - В составе LibRaw есть соответствующий патч - (RawSpeed/rawspeed.cpucount-unix.patch) - -3) Сборка LibRaw с поддержкой RawSpeed - - Win32: - --Раскомментируйте строчки CFLAGS_RAWSPEED и LDFLAGS_RAWSPEED в - Makefile.msvc. Поправьте в них пути к библиотекам и заголовочным - файлам, если это нужно. - -- запустите nmake -f Makefile.msvc - - Unix/MacOS: - -- Раскомментируйте строки CFLAGS/LDADD в секции RawSpeed в файле - Makefile.dist - -- Раскомментируйте строчку RAWSPEED_DATA (она должна указывать на - файл cameras.xml из дистрибутива RawSpeed), если вы хотите обновить - встроенное в LibRaw описание камер RawSpeed - -- запустите make -f Makefile.dist - - Опции сборки: - -- Вы можете указать дефайн -DNOSONY_RAWSPEED если вы хотите запретить - обработку файлов с камер Sony с помощью RawSpeed (это может быть нужно, - если вы работаете с RAW-данными напрямую т.к. результат распаковки - LibRaw и RawSpeed отличается. Результаты постпроцессинга при этом - - не отличаются) - -4) Сборка ваших приложений с LibRaw+RawSpeed - - -- Собирайте как обычно, никаких изменений в ваших приложениях - не требуется, если вы не работаете с raw-данными напрямую. - Стандартные пути обработки (open_file/unpack/dcraw_process и - open_file/unpack/raw2image) полностью совместимы с предыдущими версиями. - - -- Вы можете выключить поддержку RawSpeed на рантайме, установив - imgdata.params.use_rawspeed = 0. - - -- Вашему приложению потребуются все разделяемые библиотеки/DLL, - использованные при сборке (iconv, LibJPEG, posix threads на Win32). diff -Nru libraw-0.16.2/samples/4channels.cpp libraw-0.17.0/samples/4channels.cpp --- libraw-0.16.2/samples/4channels.cpp 2015-05-16 12:32:15.000000000 +0000 +++ libraw-0.17.0/samples/4channels.cpp 2015-08-15 13:10:27.000000000 +0000 @@ -1,6 +1,6 @@ /* -*- C++ -*- * File: 4channels.cpp - * Copyright 2008-2013 LibRaw LLC (info@libraw.org) + * Copyright 2008-2015 LibRaw LLC (info@libraw.org) * Created: Mon Feb 09, 2009 * * LibRaw sample diff -Nru libraw-0.16.2/samples/dcraw_emu.cpp libraw-0.17.0/samples/dcraw_emu.cpp --- libraw-0.16.2/samples/dcraw_emu.cpp 2015-05-16 12:32:15.000000000 +0000 +++ libraw-0.17.0/samples/dcraw_emu.cpp 2015-08-15 13:10:27.000000000 +0000 @@ -1,6 +1,6 @@ /* -*- C++ -*- * File: dcraw_emu.cpp - * Copyright 2008-2013 LibRaw LLC (info@libraw.org) + * Copyright 2008-2015 LibRaw LLC (info@libraw.org) * Created: Sun Mar 23, 2008 * * LibRaw simple C++ API sample: almost complete dcraw emulator diff -Nru libraw-0.16.2/samples/dcraw_half.c libraw-0.17.0/samples/dcraw_half.c --- libraw-0.16.2/samples/dcraw_half.c 2015-05-16 12:32:15.000000000 +0000 +++ libraw-0.17.0/samples/dcraw_half.c 2015-08-15 13:10:27.000000000 +0000 @@ -1,6 +1,6 @@ /* -*- C++ -*- * File: dcraw_half.c - * Copyright 2008-2013 LibRaw LLC (info@libraw.org) + * Copyright 2008-2015 LibRaw LLC (info@libraw.org) * Created: Sat Mar 8 , 2008 * * LibRaw C API sample: emulates "dcraw -h" diff -Nru libraw-0.16.2/samples/half_mt.c libraw-0.17.0/samples/half_mt.c --- libraw-0.16.2/samples/half_mt.c 2015-05-16 12:32:15.000000000 +0000 +++ libraw-0.17.0/samples/half_mt.c 2015-08-15 13:10:27.000000000 +0000 @@ -1,6 +1,6 @@ /* -*- C++ -*- * File: halt_mt.c - * Copyright 2008-2013 LibRaw LLC (info@libraw.org) + * Copyright 2008-2015 LibRaw LLC (info@libraw.org) * Created: Sat Mar 8, 2008 * * LibRaw C API mutithreaded sample: emulates call to "dcraw -h [-w] [-a] [-v]" diff -Nru libraw-0.16.2/samples/half_mt_win32.c libraw-0.17.0/samples/half_mt_win32.c --- libraw-0.16.2/samples/half_mt_win32.c 2015-05-16 12:32:15.000000000 +0000 +++ libraw-0.17.0/samples/half_mt_win32.c 2015-08-15 13:10:27.000000000 +0000 @@ -1,6 +1,6 @@ /* -*- C++ -*- * File: halt_mt_win32.c - * Copyright 2008-2013 LibRaw LLC (info@libraw.org) + * Copyright 2008-2015 LibRaw LLC (info@libraw.org) * Created: Sat Mar 8, 2008 * * LibRaw C API mutithreaded sample: emulates call to "dcraw -h [-w] [-a] [-v]" diff -Nru libraw-0.16.2/samples/mem_image.cpp libraw-0.17.0/samples/mem_image.cpp --- libraw-0.16.2/samples/mem_image.cpp 2015-05-16 12:32:15.000000000 +0000 +++ libraw-0.17.0/samples/mem_image.cpp 2015-08-15 13:10:27.000000000 +0000 @@ -1,6 +1,6 @@ /* -*- C++ -*- * File: mem_image.cpp - * Copyright 2008-2013 LibRaw LLC (info@libraw.org) + * Copyright 2008-2015 LibRaw LLC (info@libraw.org) * * LibRaw mem_image/mem_thumb API test. Results should be same (bitwise) to dcraw [-4] [-6] [-e] * Testing note: for ppm-thumbnails you should use dcraw -w -e for thumbnail extraction diff -Nru libraw-0.16.2/samples/multirender_test.cpp libraw-0.17.0/samples/multirender_test.cpp --- libraw-0.16.2/samples/multirender_test.cpp 2015-05-16 12:32:15.000000000 +0000 +++ libraw-0.17.0/samples/multirender_test.cpp 2015-08-15 13:10:27.000000000 +0000 @@ -1,6 +1,6 @@ /* -*- C++ -*- * File: multirender_test.cpp - * Copyright 2008-2013 LibRaw LLC (info@libraw.org) + * Copyright 2008-2015 LibRaw LLC (info@libraw.org) * Created: Jul 10, 2011 * * LibRaw simple C++ API: creates 8 different renderings from 1 source file. The 1st and 4th one should be identical diff -Nru libraw-0.16.2/samples/postprocessing_benchmark.cpp libraw-0.17.0/samples/postprocessing_benchmark.cpp --- libraw-0.16.2/samples/postprocessing_benchmark.cpp 2015-05-16 12:32:15.000000000 +0000 +++ libraw-0.17.0/samples/postprocessing_benchmark.cpp 2015-08-15 13:10:27.000000000 +0000 @@ -1,6 +1,6 @@ /* -*- C++ -*- * File: postprocessing_benchmark.cpp - * Copyright 2008-2013 LibRaw LLC (info@libraw.org) + * Copyright 2008-2015 LibRaw LLC (info@libraw.org) * Created: Jul 13, 2011 * * LibRaw simple C++ API: creates 8 different renderings from 1 source file. The 1st and 4th one should be identical diff -Nru libraw-0.16.2/samples/raw-identify.cpp libraw-0.17.0/samples/raw-identify.cpp --- libraw-0.16.2/samples/raw-identify.cpp 2015-05-16 12:32:15.000000000 +0000 +++ libraw-0.17.0/samples/raw-identify.cpp 2015-08-15 13:10:27.000000000 +0000 @@ -1,6 +1,6 @@ /* -*- C++ -*- * File: identify.cpp - * Copyright 2008-2013 LibRaw LLC (info@libraw.org) + * Copyright 2008-2015 LibRaw LLC (info@libraw.org) * Created: Sat Mar 8, 2008 * * LibRaw C++ demo: emulates dcraw -i [-v] @@ -35,6 +35,9 @@ #define P1 MyCoolRawProcessor.imgdata.idata #define P2 MyCoolRawProcessor.imgdata.other +#define mnLens MyCoolRawProcessor.imgdata.lens.makernotes +#define exifLens MyCoolRawProcessor.imgdata.lens + #define S MyCoolRawProcessor.imgdata.sizes #define O MyCoolRawProcessor.imgdata.params #define C MyCoolRawProcessor.imgdata.color @@ -66,7 +69,7 @@ printf("Cannot decode %s: %s\n",av[i],libraw_strerror(ret)); continue; // no recycle, open_file will recycle } - + printf ("\nFilename: %s\n", av[i]); printf ("Timestamp: %s", ctime(&(P2.timestamp))); printf ("Camera: %s %s\n", P1.make, P1.model); @@ -77,6 +80,143 @@ for (int i=24; i >= 0; i -= 8) printf ("%d%c", P1.dng_version >> i & 255, i ? '.':'\n'); } + printf ("\nEXIF:\n"); + printf ("\tMinFocal: %0.1f mm\n", exifLens.MinFocal); + printf ("\tMaxFocal: %0.1f mm\n", exifLens.MaxFocal); + printf ("\tMaxAp @MinFocal: f/%0.1f\n", exifLens.MaxAp4MinFocal); + printf ("\tMaxAp @MaxFocal: f/%0.1f\n", exifLens.MaxAp4MaxFocal); + printf ("\tMaxAperture @CurFocal: f/%0.1f\n", exifLens.EXIF_MaxAp); + printf ("\tFocalLengthIn35mmFormat: %d mm\n", exifLens.FocalLengthIn35mmFormat); + printf ("\tLensMake: %s\n", exifLens.LensMake); + printf ("\tLens: %s\n", exifLens.Lens); + printf ("\n"); + + printf ("\nMakernotes:\n"); + if (mnLens.body[0]) + { + printf("\tMF Camera Body: %s\n", mnLens.body); + } + printf("\tCameraFormat: %d, ", mnLens.CameraFormat); + switch (mnLens.CameraFormat) + { + case 0: printf("Undefined\n"); break; + case 1: printf("APS-C\n"); break; + case 2: printf("FF\n"); break; + case 3: printf("MF\n"); break; + case 4: printf("APS-H\n"); break; + case 8: printf("4/3\n"); break; + default: printf("Unknown\n"); break; + } + printf("\tCameraMount: %d, ", mnLens.CameraMount); + switch (mnLens.CameraMount) + { + case 0: printf("Undefined or Fixed Lens\n"); break; + case 1: printf("Sony/Minolta A\n"); break; + case 2: printf("Sony E\n"); break; + case 3: printf("Canon EF\n"); break; + case 4: printf("Canon EF-S\n"); break; + case 5: printf("Canon EF-M\n"); break; + case 6: printf("Nikon F\n"); break; + case 7: printf("Nikon CX\n"); break; + case 8: printf("4/3\n"); break; + case 9: printf("m4/3\n"); break; + case 10: printf("Pentax K\n"); break; + case 11: printf("Pentax Q\n"); break; + case 12: printf("Pentax 645\n"); break; + case 13: printf("Fuji X\n"); break; + case 14: printf("Leica M\n"); break; + case 15: printf("Leica R\n"); break; + case 16: printf("Leica S\n"); break; + case 17: printf("Samsung NX\n"); break; + case 19: printf("Samsung NX-M\n"); break; + case 99: printf("Fixed Lens\n"); break; + default: printf("Unknown\n"); break; + } + + if (mnLens.LensID == -1) + { + printf("\tLensID: n/a\n"); + } + else + { + printf("\tLensID: %llu 0x%0llx\n", mnLens.LensID, mnLens.LensID); + } + printf("\tLens: %s\n", mnLens.Lens); + printf("\tLensFormat: %d, ", mnLens.LensFormat); + switch (mnLens.LensFormat) + { + case 0: printf("Undefined\n"); break; + case 1: printf("APS-C\n"); break; + case 2: printf("FF\n"); break; + case 3: printf("MF\n"); break; + case 8: printf("4/3\n"); break; + default: printf("Unknown\n"); break; + } + printf("\tLensMount: %d, ", mnLens.LensMount); + switch (mnLens.LensMount) + { + case 0: printf("Undefined or Fixed Lens\n"); break; + case 1: printf("Sony/Minolta A\n"); break; + case 2: printf("Sony E\n"); break; + case 3: printf("Canon EF\n"); break; + case 4: printf("Canon EF-S\n"); break; + case 5: printf("Canon EF-M\n"); break; + case 6: printf("Nikon F\n"); break; + case 7: printf("Nikon CX\n"); break; + case 8: printf("4/3\n"); break; + case 9: printf("m4/3\n"); break; + case 10: printf("Pentax K\n"); break; + case 11: printf("Pentax Q\n"); break; + case 12: printf("Pentax 645\n"); break; + case 13: printf("Fuji X\n"); break; + case 14: printf("Leica M\n"); break; + case 15: printf("Leica R\n"); break; + case 16: printf("Leica S\n"); break; + case 17: printf("Samsung NX\n"); break; + case 18: printf("Ricoh module\n"); break; + case 99: printf("Fixed Lens\n"); break; + default: printf("Unknown\n"); break; + } + printf("\tFocalType: %d, ", mnLens.FocalType); + switch (mnLens.FocalType) + { + case 0: printf("Undefined\n"); break; + case 1: printf("Fixed Focal\n"); break; + case 2: printf("Zoom\n"); break; + default: printf("Unknown\n"); break; + } + printf("\tLensFeatures_pre: %s\n", mnLens.LensFeatures_pre); + printf("\tLensFeatures_suf: %s\n", mnLens.LensFeatures_suf); + printf("\tMinFocal: %0.1f mm\n", mnLens.MinFocal); + printf("\tMaxFocal: %0.1f mm\n", mnLens.MaxFocal); + printf("\tMaxAp @MinFocal: f/%0.1f\n", mnLens.MaxAp4MinFocal); + printf("\tMaxAp @MaxFocal: f/%0.1f\n", mnLens.MaxAp4MaxFocal); + printf("\tMinAp @MinFocal: f/%0.1f\n", mnLens.MinAp4MinFocal); + printf("\tMinAp @MaxFocal: f/%0.1f\n", mnLens.MinAp4MaxFocal); + printf("\tMaxAp: f/%0.1f\n", mnLens.MaxAp); + printf("\tMinAp: f/%0.1f\n", mnLens.MinAp); + printf("\tCurFocal: %0.1f mm\n", mnLens.CurFocal); + printf("\tCurAp: f/%0.1f\n", mnLens.CurAp); + printf("\tMaxAp @CurFocal: f/%0.1f\n", mnLens.MaxAp4CurFocal); + printf("\tMinAp @CurFocal: f/%0.1f\n", mnLens.MinAp4CurFocal); + + if (exifLens.makernotes.FocalLengthIn35mmFormat > 1.0f) + printf("\tFocalLengthIn35mmFormat: %0.1f mm\n", exifLens.makernotes.FocalLengthIn35mmFormat); + + if (exifLens.nikon.NikonEffectiveMaxAp > 0.1f) + printf("\tNikonEffectiveMaxAp: f/%0.1f\n", exifLens.nikon.NikonEffectiveMaxAp); + + if (exifLens.makernotes.LensFStops > 0.1f) + printf("\tLensFStops @CurFocal: %0.2f\n", exifLens.makernotes.LensFStops); + + printf("\tTeleconverterID: %lld\n", mnLens.TeleconverterID); + printf("\tTeleconverter: %s\n", mnLens.Teleconverter); + printf("\tAdapterID: %lld\n", mnLens.AdapterID); + printf("\tAdapter: %s\n", mnLens.Adapter); + printf("\tAttachmentID: %lld\n", mnLens.AttachmentID); + printf("\tAttachment: %s\n", mnLens.Attachment); + printf ("\n"); + printf ("ISO speed: %d\n", (int) P2.iso_speed); printf ("Shutter: "); if (P2.shutter > 0 && P2.shutter < 1) @@ -88,18 +228,21 @@ printf ("Embedded ICC profile: yes, %d bytes\n", C.profile_length); else printf ("Embedded ICC profile: no\n"); - + + if (C.baseline_exposure > -999.f) printf ("Baseline exposure: %04.3f\n", C.baseline_exposure); + printf ("Number of raw images: %d\n", P1.raw_count); + if (C.FujiExpoMidPointShift) printf ("Fuji Exposure shift: %04.3f\n", C.FujiExpoMidPointShift); if (S.pixel_aspect != 1) printf ("Pixel Aspect Ratio: %0.6f\n", S.pixel_aspect); if (T.tlength) printf ("Thumb size: %4d x %d\n", T.twidth, T.theight); printf ("Full size: %4d x %d\n", S.raw_width, S.raw_height); - + printf ("Image size: %4d x %d\n", S.width, S.height); printf ("Output size: %4d x %d\n", S.iwidth, S.iheight); printf ("Raw colors: %d", P1.colors); - if (P1.filters) + if (P1.filters) { printf ("\nFilter pattern: "); if (!P1.cdesc[3]) P1.cdesc[3] = 'G'; @@ -108,16 +251,16 @@ } printf ("\nDaylight multipliers:"); for(int c=0;c 0) + if (C.cam_mul[0] > 0) { printf ("\nCamera multipliers:"); for(int c=0;c<4;c++) printf (" %f", C.cam_mul[c]); } - printf("Cam->XYZ matrix:\n"); + printf("\nCam->XYZ matrix:\n"); for(int i=0; i< 4; i++) printf("%6.4f\t%6.4f\t%6.4f\n",C.cam_xyz[i][0],C.cam_xyz[i][1],C.cam_xyz[i][2]); } - else + else { if(print_unpack) { @@ -129,7 +272,7 @@ snprintf(frame,48,"F=%dx%dx%dx%d RS=%dx%d", S.left_margin,S.top_margin,right_margin,bottom_margin, S.raw_width,S.raw_height); - printf ("%s\t%s\t%s\t%s/%s\n", + printf ("%s\t%s\t%s\t%s/%s\n", av[i], MyCoolRawProcessor.unpack_function_name(), frame, @@ -138,6 +281,7 @@ } else printf ("%s is a %s %s image.\n", av[i],P1.make, P1.model); +// printf ("%s=%s=%d=%04.3f=%04.3f\n", P1.make, P1.model, (int)P2.iso_speed, C.baseline_exposure, C.FujiExpoMidPointShift); } MyCoolRawProcessor.recycle(); }// endfor diff -Nru libraw-0.16.2/samples/simple_dcraw.cpp libraw-0.17.0/samples/simple_dcraw.cpp --- libraw-0.16.2/samples/simple_dcraw.cpp 2015-05-16 12:32:15.000000000 +0000 +++ libraw-0.17.0/samples/simple_dcraw.cpp 2015-08-15 13:10:27.000000000 +0000 @@ -1,6 +1,6 @@ /* -*- C++ -*- * File: simple_dcraw.cpp - * Copyright 2008-2013 LibRaw LLC (info@libraw.org) + * Copyright 2008-2015 LibRaw LLC (info@libraw.org) * Created: Sat Mar 8, 2008 * * LibRaw simple C++ API: emulates call to "dcraw [-D] [-T] [-v] [-e] [-4]" @@ -60,6 +60,7 @@ " %d cameras supported\n" "Usage: %s [-D] [-T] [-v] [-e] raw-files....\n" "\t-4 - 16-bit mode\n" + "\t-L - list supported cameras and exit\n" "\t-v - verbose output\n" "\t-T - output TIFF files instead of .pgm/ppm\n" "\t-e - extract thumbnails (same as dcraw -e in separate run)\n",LibRaw::version(), @@ -92,6 +93,18 @@ OUT.output_bps=16; if(av[i][1]=='C' && av[i][2]==0) RawProcessor.set_progress_handler(my_progress_callback,NULL); + if(av[i][1]=='L' && av[i][2]==0) + { + const char **clist = LibRaw::cameraList(); + const char **cc = clist; + while(*cc) + { + printf("%s\n",*cc); + cc++; + } + + exit(0); + } continue; } diff -Nru libraw-0.16.2/samples/unprocessed_raw.cpp libraw-0.17.0/samples/unprocessed_raw.cpp --- libraw-0.16.2/samples/unprocessed_raw.cpp 2015-05-16 12:32:15.000000000 +0000 +++ libraw-0.17.0/samples/unprocessed_raw.cpp 2015-08-15 13:10:27.000000000 +0000 @@ -1,6 +1,6 @@ /* -*- C++ -*- * File: unprocessed_raw.cpp - * Copyright 2009-2013 LibRaw LLC (info@libraw.org) + * Copyright 2009-2015 LibRaw LLC (info@libraw.org) * Created: Fri Jan 02, 2009 * * LibRaw sample @@ -116,9 +116,7 @@ if(verbose) printf("Unpacked....\n"); - libraw_decoder_info_t decoder_info; - RawProcessor.get_decoder_info(&decoder_info); - if(!(decoder_info.decoder_flags & LIBRAW_DECODER_FLATFIELD)) + if(!(RawProcessor.imgdata.idata.filters || RawProcessor.imgdata.idata.colors == 1)) { printf("Only Bayer-pattern RAW files supported, sorry....\n"); continue; diff -Nru libraw-0.16.2/shlib-version.sh libraw-0.17.0/shlib-version.sh --- libraw-0.16.2/shlib-version.sh 2015-05-16 12:32:15.000000000 +0000 +++ libraw-0.17.0/shlib-version.sh 2015-08-15 13:10:27.000000000 +0000 @@ -6,6 +6,6 @@ minor=`grep LIBRAW_SHLIB_REVISION $vfile | head -1 | awk '{print $3}'` patch=`grep LIBRAW_SHLIB_AGE $vfile | head -1 | awk '{print $3}'` -echo -n "$major:$minor:$patch" +echo "$major:$minor:$patch" | awk '{printf $1}' diff -Nru libraw-0.16.2/src/libraw_c_api.cpp libraw-0.17.0/src/libraw_c_api.cpp --- libraw-0.16.2/src/libraw_c_api.cpp 2015-05-16 12:32:15.000000000 +0000 +++ libraw-0.17.0/src/libraw_c_api.cpp 2015-08-15 13:10:27.000000000 +0000 @@ -1,6 +1,6 @@ /* -*- C++ -*- * File: libraw_c_api.cpp - * Copyright 2008-2013 LibRaw LLC (info@libraw.org) + * Copyright 2008-2015 LibRaw LLC (info@libraw.org) * Created: Sat Mar 8 , 2008 * * LibRaw C interface @@ -127,6 +127,14 @@ delete ip; } + void libraw_set_exifparser_handler(libraw_data_t* lr, exif_parser_callback cb,void *data) + { + if(!lr) return; + LibRaw *ip = (LibRaw*) lr->parent_class; + ip->set_exifparser_handler(cb,data); + + } + void libraw_set_memerror_handler(libraw_data_t* lr, memory_callback cb,void *data) { if(!lr) return; @@ -217,6 +225,117 @@ LibRaw *ip = (LibRaw*) lr->parent_class; return ip->COLOR(row,col); } + + /* getters/setters used by 3DLut Creator */ +DllDef void libraw_set_demosaic(libraw_data_t *lr,int value) + { + if(!lr) return; + LibRaw *ip = (LibRaw*) lr->parent_class; + ip->imgdata.params.user_qual = value; + } + +DllDef void libraw_set_output_color(libraw_data_t *lr,int value) + { + if(!lr) return; + LibRaw *ip = (LibRaw*) lr->parent_class; + ip->imgdata.params.output_color = value; + } + +DllDef void libraw_set_output_bps(libraw_data_t *lr,int value) + { + if(!lr) return; + LibRaw *ip = (LibRaw*) lr->parent_class; + ip->imgdata.params.output_bps = value; + } + +#define MIN(a,b) ((a) < (b) ? (a) : (b)) +#define MAX(a,b) ((a) > (b) ? (a) : (b)) +#define LIM(x,min,max) MAX(min,MIN(x,max)) + +DllDef void libraw_set_gamma(libraw_data_t *lr,int index, float value) + { + if(!lr) return; + LibRaw *ip = (LibRaw*) lr->parent_class; + ip->imgdata.params.gamm[LIM(index,0,5)] = value; + } + +DllDef void libraw_set_no_auto_bright(libraw_data_t *lr,int value) + { + if(!lr) return; + LibRaw *ip = (LibRaw*) lr->parent_class; + ip->imgdata.params.no_auto_bright = value; + } + +DllDef void libraw_set_bright(libraw_data_t *lr,float value) + { + if(!lr) return; + LibRaw *ip = (LibRaw*) lr->parent_class; + ip->imgdata.params.bright = value; + } + +DllDef void libraw_set_highlight(libraw_data_t *lr,int value) + { + if(!lr) return; + LibRaw *ip = (LibRaw*) lr->parent_class; + ip->imgdata.params.highlight = value; + } + +DllDef void libraw_set_fbdd_noiserd(libraw_data_t *lr,int value) + { + if(!lr) return; + LibRaw *ip = (LibRaw*) lr->parent_class; + ip->imgdata.params.fbdd_noiserd = value; + } + +DllDef int libraw_get_raw_height(libraw_data_t *lr) + { + if(!lr) return EINVAL; + return lr->sizes.raw_height; + } + +DllDef int libraw_get_raw_width(libraw_data_t *lr) + { + if(!lr) return EINVAL; + return lr->sizes.raw_width; + } + +DllDef int libraw_get_iheight(libraw_data_t *lr) + { + if(!lr) return EINVAL; + return lr->sizes.iheight; + } + +DllDef int libraw_get_iwidth(libraw_data_t *lr) + { + if(!lr) return EINVAL; + return lr->sizes.iwidth; + } + + +DllDef float libraw_get_cam_mul(libraw_data_t *lr,int index) + { + if(!lr) return EINVAL; + return lr->color.cam_mul[LIM(index,0,3)]; + } + +DllDef float libraw_get_pre_mul(libraw_data_t *lr,int index) + { + if(!lr) return EINVAL; + return lr->color.pre_mul[LIM(index,0,3)]; + } + +DllDef float libraw_get_rgb_cam(libraw_data_t *lr,int index1, int index2) + { + if(!lr) return EINVAL; + return lr->color.rgb_cam[LIM(index1,0,2)][LIM(index2,0,3)]; + } + +DllDef int libraw_get_color_maximum(libraw_data_t *lr) + { + if(!lr) return EINVAL; + return lr->color.maximum; + } + #ifdef __cplusplus } #endif diff -Nru libraw-0.16.2/src/libraw_cxx.cpp libraw-0.17.0/src/libraw_cxx.cpp --- libraw-0.16.2/src/libraw_cxx.cpp 2015-05-16 12:32:15.000000000 +0000 +++ libraw-0.17.0/src/libraw_cxx.cpp 2015-08-15 13:10:27.000000000 +0000 @@ -1,6 +1,6 @@ /* -*- C++ -*- * File: libraw_cxx.cpp - * Copyright 2008-2013 LibRaw LLC (info@libraw.org) + * Copyright 2008-2015 LibRaw LLC (info@libraw.org) * Created: Sat Mar 8 , 2008 * * LibRaw C++ interface (implementation) @@ -35,6 +35,26 @@ #include "libraw/libraw.h" #include "internal/defines.h" + +#if defined(_WIN32) +#if defined _MSC_VER +typedef signed __int8 int8_t; +typedef unsigned __int8 uint8_t; +typedef signed __int16 int16_t; +typedef unsigned __int16 uint16_t; +typedef signed __int32 int32_t; +typedef unsigned __int32 uint32_t; +typedef signed __int64 int64_t; +typedef unsigned __int64 uint64_t; +#else +#include +#endif // _WIN32 +#include +#else +#include +#endif + + #ifdef USE_RAWSPEED #include "../RawSpeed/rawspeed_xmldata.cpp" #include @@ -47,7 +67,7 @@ #ifdef __cplusplus -extern "C" +extern "C" { #endif void default_memory_callback(void *,const char *file,const char *where) @@ -60,7 +80,7 @@ if(offset < 0) fprintf (stderr,"%s: Unexpected end of file\n", file?file:"unknown file"); else - fprintf (stderr,"%s: data corrupted at %d\n",file?file:"unknown file",offset); + fprintf (stderr,"%s: data corrupted at %d\n",file?file:"unknown file",offset); } const char *libraw_strerror(int e) { @@ -102,12 +122,13 @@ } #endif +#define Sigma_X3F 22 -const double LibRaw_constants::xyz_rgb[3][3] = +const double LibRaw_constants::xyz_rgb[3][3] = { { 0.412453, 0.357580, 0.180423 }, { 0.212671, 0.715160, 0.072169 }, - { 0.019334, 0.119193, 0.950227 } + { 0.019334, 0.119193, 0.950227 } }; const float LibRaw_constants::d65_white[3] = { 0.950456f, 1.0f, 1.088754f }; @@ -153,10 +174,18 @@ int LibRaw::versionNumber() { return LIBRAW_VERSION; } const char* LibRaw::strerror(int p) { return libraw_strerror(p);} +LibRaw_colormatrix_type LibRaw::camera_color_type() +{ + if(C.cmatrix[0][0] <= 0.125) return LIBRAW_CMATRIX_NONE; + if(P1.dng_version) return LIBRAW_CMATRIX_DNG; + if(C.digitalBack_color) return LIBRAW_CMATRIX_DIGBACK; + return LIBRAW_CMATRIX_OTHER; + +} void LibRaw::derror() { - if (!libraw_internal_data.unpacker_data.data_error && libraw_internal_data.internal_data.input) + if (!libraw_internal_data.unpacker_data.data_error && libraw_internal_data.internal_data.input) { if (libraw_internal_data.internal_data.input->eof()) { @@ -169,7 +198,7 @@ if(callbacks.data_cb)(*callbacks.data_cb)(callbacks.datacb_data, libraw_internal_data.internal_data.input->fname(), libraw_internal_data.internal_data.input->tell()); - throw LIBRAW_EXCEPTION_IO_CORRUPT; + //throw LIBRAW_EXCEPTION_IO_CORRUPT; } } libraw_internal_data.unpacker_data.data_error++; @@ -180,7 +209,18 @@ if(p) ::free(p); } -int LibRaw::is_sraw() { return load_raw == &LibRaw::canon_sraw_load_raw; } +int LibRaw::is_sraw() { return load_raw == &LibRaw::canon_sraw_load_raw || load_raw == &LibRaw::nikon_load_sraw ; } +int LibRaw::is_coolscan_nef() { return load_raw == &LibRaw::nikon_coolscan_load_raw;} + +int LibRaw::is_nikon_sraw(){ + return load_raw == &LibRaw::nikon_load_sraw; +} +int LibRaw::sraw_midpoint() { + if (load_raw == &LibRaw::canon_sraw_load_raw) return 8192; + else if (load_raw == &LibRaw::nikon_load_sraw) return 2048; + else return 0; +} + #ifdef USE_RAWSPEED using namespace RawSpeed; @@ -197,14 +237,14 @@ if (ctxt == NULL) { ThrowCME("CameraMetaData:Could not initialize context."); } - + xmlResetLastError(); doc = xmlCtxtReadMemory(ctxt, data,sz, "", NULL, XML_PARSE_DTDVALID); - + if (doc == NULL) { ThrowCME("CameraMetaData: XML Document could not be parsed successfully. Error was: %s", ctxt->lastError.message); } - + if (ctxt->valid == 0) { if (ctxt->lastError.code == 0x5e) { // printf("CameraMetaData: Unable to locate DTD, attempting to ignore."); @@ -212,22 +252,22 @@ ThrowCME("CameraMetaData: XML file does not validate. DTD Error was: %s", ctxt->lastError.message); } } - + xmlNodePtr cur; cur = xmlDocGetRootElement(doc); if (xmlStrcmp(cur->name, (const xmlChar *) "Cameras")) { ThrowCME("CameraMetaData: XML document of the wrong type, root node is not cameras."); return; } - + cur = cur->xmlChildrenNode; while (cur != NULL) { if ((!xmlStrcmp(cur->name, (const xmlChar *)"Camera"))) { Camera *camera = new Camera(doc, cur); addCamera(camera); - + // Create cameras for aliases. - for (uint32 i = 0; i < camera->aliases.size(); i++) { + for (unsigned int i = 0; i < camera->aliases.size(); i++) { addCamera(new Camera(camera, i)); } } @@ -276,6 +316,13 @@ #define ZERO(a) memset(&a,0,sizeof(a)) +static void cleargps(libraw_gps_info_t*q) +{ + for (int i = 0; i < 3; i++) + q->latitude[i] = q->longtitude[i] = q->gpstimestamp[i] = 0.f; + q->altitude = 0.f; + q->altref = q->latref = q->longref = q->gpsstatus = q->gpsparsed = 0; +} LibRaw:: LibRaw(unsigned int flags) { @@ -289,9 +336,13 @@ verbose = 0; #endif ZERO(imgdata); + imgdata.lens.makernotes.CanonFocalUnits = 1; + imgdata.lens.makernotes.LensID = 0xffffffffffffffffULL; + + cleargps(&imgdata.other.parsed_gps); ZERO(libraw_internal_data); ZERO(callbacks); - + _rawspeed_camerameta = _rawspeed_decoder = NULL; _x3f_data = NULL; @@ -301,13 +352,14 @@ #endif callbacks.mem_cb = (flags & LIBRAW_OPIONS_NO_MEMERR_CALLBACK) ? NULL: &default_memory_callback; callbacks.data_cb = (flags & LIBRAW_OPIONS_NO_DATAERR_CALLBACK)? NULL : &default_data_callback; + callbacks.exif_cb = NULL; // no default callback memmove(&imgdata.params.aber,&aber,sizeof(aber)); memmove(&imgdata.params.gamm,&gamm,sizeof(gamm)); memmove(&imgdata.params.greybox,&greybox,sizeof(greybox)); memmove(&imgdata.params.cropbox,&cropbox,sizeof(cropbox)); - + imgdata.params.bright=1; - imgdata.params.use_camera_matrix=-1; + imgdata.params.use_camera_matrix=1; imgdata.params.user_flip=-1; imgdata.params.user_black=-1; imgdata.params.user_cblack[0]=imgdata.params.user_cblack[1]=imgdata.params.user_cblack[2]=imgdata.params.user_cblack[3]=-1000001; @@ -324,9 +376,14 @@ imgdata.params.no_interpolation = 0; imgdata.params.sraw_ycc = 0; imgdata.params.force_foveon_x3f = 0; + imgdata.params.x3f_flags = LIBRAW_DP2Q_INTERPOLATERG|LIBRAW_DP2Q_INTERPOLATEAF; + imgdata.params.sony_arw2_options = 0; + imgdata.params.sony_arw2_posterization_thr = 0; imgdata.params.green_matching = 0; + imgdata.params.coolscan_nef_gamma = 1.0f; imgdata.parent_class = this; imgdata.progress_flags = 0; + imgdata.color.baseline_exposure = -999.f; _exitflag = 0; tls = new LibRaw_TLS; tls->init(); @@ -356,8 +413,8 @@ LibRaw::~LibRaw() { - recycle(); - delete tls; + recycle(); + delete tls; #ifdef USE_RAWSPEED if(_rawspeed_camerameta) { @@ -396,11 +453,11 @@ memmgr.free(p); } -void LibRaw:: recycle_datastream() +void LibRaw:: recycle_datastream() { - if(libraw_internal_data.internal_data.input && libraw_internal_data.internal_data.input_internal) - { - delete libraw_internal_data.internal_data.input; + if(libraw_internal_data.internal_data.input && libraw_internal_data.internal_data.input_internal) + { + delete libraw_internal_data.internal_data.input; libraw_internal_data.internal_data.input = NULL; } libraw_internal_data.internal_data.input_internal = 0; @@ -408,24 +465,34 @@ void x3f_clear(void*); -void LibRaw:: recycle() + +void LibRaw:: recycle() { recycle_datastream(); #define FREE(a) do { if(a) { free(a); a = NULL;} }while(0) - - FREE(imgdata.image); + + FREE(imgdata.image); FREE(imgdata.thumbnail.thumb); FREE(libraw_internal_data.internal_data.meta_data); FREE(libraw_internal_data.output_data.histogram); FREE(libraw_internal_data.output_data.oprof); FREE(imgdata.color.profile); - FREE(imgdata.rawdata.ph1_black); - FREE(imgdata.rawdata.raw_alloc); + FREE(imgdata.rawdata.ph1_cblack); + FREE(imgdata.rawdata.ph1_rblack); + FREE(imgdata.rawdata.raw_alloc); + FREE(imgdata.idata.xmpdata); #undef FREE ZERO(imgdata.rawdata); ZERO(imgdata.sizes); ZERO(imgdata.color); + cleargps(&imgdata.other.parsed_gps); + imgdata.color.baseline_exposure = -999.f; + imgdata.color.FujiExpoMidPointShift = -999.f; ZERO(libraw_internal_data); + ZERO(imgdata.lens); + imgdata.lens.makernotes.CanonFocalUnits = 1; + imgdata.lens.makernotes.LensID = 0xffffffffffffffffULL; + _exitflag = 0; #ifdef USE_RAWSPEED if(_rawspeed_decoder) @@ -444,7 +511,7 @@ memmgr.cleanup(); imgdata.thumbnail.tformat = LIBRAW_THUMBNAIL_UNKNOWN; imgdata.progress_flags = 0; - + tls->init(); } @@ -459,264 +526,259 @@ { if(!d_info) return LIBRAW_UNSPECIFIED_ERROR; if(!load_raw) return LIBRAW_OUT_OF_ORDER_CALL; - - d_info->decoder_flags = LIBRAW_DECODER_NOTSET; + + d_info->decoder_flags = 0; int rawdata = (imgdata.idata.filters || P1.colors == 1); // dcraw.c names order - if (load_raw == &LibRaw::canon_600_load_raw) + if (load_raw == &LibRaw::android_tight_load_raw) + { + d_info->decoder_name = "android_tight_load_raw()"; + } + else if (load_raw == &LibRaw::android_loose_load_raw) + { + d_info->decoder_name = "android_loose_load_raw()"; + } + else if (load_raw == &LibRaw::canon_600_load_raw) { - d_info->decoder_name = "canon_600_load_raw()"; - d_info->decoder_flags = LIBRAW_DECODER_FLATFIELD; // WB set within decoder, no need to load raw + d_info->decoder_name = "canon_600_load_raw()"; } else if (load_raw == &LibRaw::canon_load_raw) { - d_info->decoder_name = "canon_load_raw()"; - d_info->decoder_flags = LIBRAW_DECODER_FLATFIELD; + d_info->decoder_name = "canon_load_raw()"; } else if (load_raw == &LibRaw::lossless_jpeg_load_raw) { // Check rbayer - d_info->decoder_name = "lossless_jpeg_load_raw()"; - d_info->decoder_flags = LIBRAW_DECODER_FLATFIELD | LIBRAW_DECODER_HASCURVE | LIBRAW_DECODER_TRYRAWSPEED; + d_info->decoder_name = "lossless_jpeg_load_raw()"; + d_info->decoder_flags = LIBRAW_DECODER_HASCURVE | LIBRAW_DECODER_TRYRAWSPEED; } - else if (load_raw == &LibRaw::canon_sraw_load_raw) + else if (load_raw == &LibRaw::canon_sraw_load_raw) { d_info->decoder_name = "canon_sraw_load_raw()"; - d_info->decoder_flags = LIBRAW_DECODER_LEGACY | LIBRAW_DECODER_TRYRAWSPEED; + d_info->decoder_flags = LIBRAW_DECODER_TRYRAWSPEED; } - else if (load_raw == &LibRaw::lossless_dng_load_raw) + else if (load_raw == &LibRaw::lossless_dng_load_raw) { // Check rbayer - d_info->decoder_name = "lossless_dng_load_raw()"; - d_info->decoder_flags = rawdata? LIBRAW_DECODER_FLATFIELD : LIBRAW_DECODER_LEGACY ; - d_info->decoder_flags |= LIBRAW_DECODER_HASCURVE; - d_info->decoder_flags |= LIBRAW_DECODER_TRYRAWSPEED; + d_info->decoder_name = "lossless_dng_load_raw()"; + d_info->decoder_flags = LIBRAW_DECODER_HASCURVE | LIBRAW_DECODER_TRYRAWSPEED; } else if (load_raw == &LibRaw::packed_dng_load_raw) { // Check rbayer - d_info->decoder_name = "packed_dng_load_raw()"; - d_info->decoder_flags = rawdata ? LIBRAW_DECODER_FLATFIELD : LIBRAW_DECODER_LEGACY; - d_info->decoder_flags |= LIBRAW_DECODER_HASCURVE; - d_info->decoder_flags |= LIBRAW_DECODER_TRYRAWSPEED; + d_info->decoder_name = "packed_dng_load_raw()"; + d_info->decoder_flags = LIBRAW_DECODER_HASCURVE | LIBRAW_DECODER_TRYRAWSPEED; } else if (load_raw == &LibRaw::pentax_load_raw ) { - d_info->decoder_name = "pentax_load_raw()"; - d_info->decoder_flags = LIBRAW_DECODER_FLATFIELD | LIBRAW_DECODER_TRYRAWSPEED; + d_info->decoder_name = "pentax_load_raw()"; + d_info->decoder_flags = LIBRAW_DECODER_TRYRAWSPEED; } else if (load_raw == &LibRaw::nikon_load_raw) { // Check rbayer d_info->decoder_name = "nikon_load_raw()"; - d_info->decoder_flags = LIBRAW_DECODER_FLATFIELD | LIBRAW_DECODER_TRYRAWSPEED; + d_info->decoder_flags = LIBRAW_DECODER_TRYRAWSPEED; + } + else if (load_raw == &LibRaw::nikon_coolscan_load_raw ) + { + d_info->decoder_name = "nikon_coolscan_load_raw()"; + d_info->decoder_flags = LIBRAW_DECODER_FIXEDMAXC; + } + else if (load_raw == &LibRaw::nikon_load_sraw ) + { + d_info->decoder_name = "nikon_load_sraw()"; + d_info->decoder_flags = LIBRAW_DECODER_HASCURVE | LIBRAW_DECODER_FIXEDMAXC; + } + else if (load_raw == &LibRaw::nikon_yuv_load_raw ) + { + d_info->decoder_name = "nikon_load_sraw()"; + d_info->decoder_flags = LIBRAW_DECODER_HASCURVE; } else if (load_raw == &LibRaw::rollei_load_raw ) { // UNTESTED - d_info->decoder_name = "rollei_load_raw()"; - d_info->decoder_flags = LIBRAW_DECODER_FLATFIELD; + d_info->decoder_name = "rollei_load_raw()"; } else if (load_raw == &LibRaw::phase_one_load_raw ) { - d_info->decoder_name = "phase_one_load_raw()"; - d_info->decoder_flags = LIBRAW_DECODER_FLATFIELD; + d_info->decoder_name = "phase_one_load_raw()"; } else if (load_raw == &LibRaw::phase_one_load_raw_c ) { - d_info->decoder_name = "phase_one_load_raw_c()"; - d_info->decoder_flags = LIBRAW_DECODER_FLATFIELD; + d_info->decoder_name = "phase_one_load_raw_c()"; } else if (load_raw == &LibRaw::hasselblad_load_raw ) { - d_info->decoder_name = "hasselblad_load_raw()"; - d_info->decoder_flags = LIBRAW_DECODER_FLATFIELD; + d_info->decoder_name = "hasselblad_load_raw()"; } else if (load_raw == &LibRaw::leaf_hdr_load_raw ) { - d_info->decoder_name = "leaf_hdr_load_raw()"; - d_info->decoder_flags = imgdata.idata.filters? LIBRAW_DECODER_FLATFIELD:LIBRAW_DECODER_LEGACY; + d_info->decoder_name = "leaf_hdr_load_raw()"; } else if (load_raw == &LibRaw::unpacked_load_raw ) { - d_info->decoder_name = "unpacked_load_raw()"; - d_info->decoder_flags = LIBRAW_DECODER_FLATFIELD | LIBRAW_DECODER_USEBAYER2; + d_info->decoder_name = "unpacked_load_raw()"; } else if (load_raw == &LibRaw::sinar_4shot_load_raw ) { // UNTESTED d_info->decoder_name = "sinar_4shot_load_raw()"; - d_info->decoder_flags = (O.shot_select|| O.half_size)?LIBRAW_DECODER_FLATFIELD:LIBRAW_DECODER_LEGACY; } else if (load_raw == &LibRaw::imacon_full_load_raw ) { - d_info->decoder_name = "imacon_full_load_raw()"; - d_info->decoder_flags = LIBRAW_DECODER_LEGACY; + d_info->decoder_name = "imacon_full_load_raw()"; } else if (load_raw == &LibRaw::hasselblad_full_load_raw ) { - d_info->decoder_name = "hasselblad_full_load_raw()"; - d_info->decoder_flags = LIBRAW_DECODER_LEGACY; + d_info->decoder_name = "hasselblad_full_load_raw()"; } else if (load_raw == &LibRaw::packed_load_raw ) { d_info->decoder_name = "packed_load_raw()"; - d_info->decoder_flags = LIBRAW_DECODER_FLATFIELD; - d_info->decoder_flags |= LIBRAW_DECODER_TRYRAWSPEED; + d_info->decoder_flags = LIBRAW_DECODER_TRYRAWSPEED; } else if (load_raw == &LibRaw::nokia_load_raw ) { // UNTESTED d_info->decoder_name = "nokia_load_raw()"; - d_info->decoder_flags = LIBRAW_DECODER_FLATFIELD; } else if (load_raw == &LibRaw::canon_rmf_load_raw ) { // UNTESTED d_info->decoder_name = "canon_rmf_load_raw()"; - d_info->decoder_flags = LIBRAW_DECODER_FLATFIELD; } else if (load_raw == &LibRaw::panasonic_load_raw ) { d_info->decoder_name = "panasonic_load_raw()"; - d_info->decoder_flags = LIBRAW_DECODER_FLATFIELD | LIBRAW_DECODER_TRYRAWSPEED; + d_info->decoder_flags = LIBRAW_DECODER_TRYRAWSPEED; } else if (load_raw == &LibRaw::olympus_load_raw ) { - d_info->decoder_name = "olympus_load_raw()"; - d_info->decoder_flags = LIBRAW_DECODER_FLATFIELD | LIBRAW_DECODER_TRYRAWSPEED; + d_info->decoder_name = "olympus_load_raw()"; + d_info->decoder_flags = LIBRAW_DECODER_TRYRAWSPEED; } - else if (load_raw == &LibRaw::minolta_rd175_load_raw ) - { + else if (load_raw == &LibRaw::minolta_rd175_load_raw ) + { // UNTESTED - d_info->decoder_name = "minolta_rd175_load_raw()"; - d_info->decoder_flags = LIBRAW_DECODER_FLATFIELD; + d_info->decoder_name = "minolta_rd175_load_raw()"; } else if (load_raw == &LibRaw::quicktake_100_load_raw ) { // UNTESTED d_info->decoder_name = "quicktake_100_load_raw()"; - d_info->decoder_flags = LIBRAW_DECODER_FLATFIELD; } else if (load_raw == &LibRaw::kodak_radc_load_raw ) { - d_info->decoder_name = "kodak_radc_load_raw()"; - d_info->decoder_flags = LIBRAW_DECODER_FLATFIELD; + d_info->decoder_name = "kodak_radc_load_raw()"; } else if (load_raw == &LibRaw::kodak_jpeg_load_raw ) { // UNTESTED + RBAYER - d_info->decoder_name = "kodak_jpeg_load_raw()"; - d_info->decoder_flags = LIBRAW_DECODER_FLATFIELD; + d_info->decoder_name = "kodak_jpeg_load_raw()"; } else if (load_raw == &LibRaw::lossy_dng_load_raw) { // Check rbayer - d_info->decoder_name = "lossy_dng_load_raw()"; - d_info->decoder_flags = LIBRAW_DECODER_LEGACY | LIBRAW_DECODER_TRYRAWSPEED; - d_info->decoder_flags |= LIBRAW_DECODER_HASCURVE; + d_info->decoder_name = "lossy_dng_load_raw()"; + d_info->decoder_flags = LIBRAW_DECODER_TRYRAWSPEED | LIBRAW_DECODER_HASCURVE; } else if (load_raw == &LibRaw::kodak_dc120_load_raw ) { - d_info->decoder_name = "kodak_dc120_load_raw()"; - d_info->decoder_flags = LIBRAW_DECODER_FLATFIELD; + d_info->decoder_name = "kodak_dc120_load_raw()"; } else if (load_raw == &LibRaw::eight_bit_load_raw ) { d_info->decoder_name = "eight_bit_load_raw()"; - d_info->decoder_flags = LIBRAW_DECODER_FLATFIELD; - d_info->decoder_flags |= LIBRAW_DECODER_HASCURVE; + d_info->decoder_flags = LIBRAW_DECODER_HASCURVE; + } + else if (load_raw == &LibRaw::kodak_c330_load_raw ) + { + d_info->decoder_name = "kodak_yrgb_load_raw()"; + d_info->decoder_flags = LIBRAW_DECODER_HASCURVE; } - else if (load_raw == &LibRaw::kodak_yrgb_load_raw ) + else if (load_raw == &LibRaw::kodak_c603_load_raw ) { - d_info->decoder_name = "kodak_yrgb_load_raw()"; - d_info->decoder_flags = LIBRAW_DECODER_LEGACY; - d_info->decoder_flags |= LIBRAW_DECODER_HASCURVE; + d_info->decoder_name = "kodak_yrgb_load_raw()"; + d_info->decoder_flags = LIBRAW_DECODER_HASCURVE; } else if (load_raw == &LibRaw::kodak_262_load_raw ) { d_info->decoder_name = "kodak_262_load_raw()"; // UNTESTED! - d_info->decoder_flags = LIBRAW_DECODER_FLATFIELD; - d_info->decoder_flags |= LIBRAW_DECODER_HASCURVE; + d_info->decoder_flags = LIBRAW_DECODER_HASCURVE; } else if (load_raw == &LibRaw::kodak_65000_load_raw ) { d_info->decoder_name = "kodak_65000_load_raw()"; - d_info->decoder_flags = LIBRAW_DECODER_FLATFIELD; - d_info->decoder_flags |= LIBRAW_DECODER_HASCURVE; + d_info->decoder_flags = LIBRAW_DECODER_HASCURVE; } else if (load_raw == &LibRaw::kodak_ycbcr_load_raw ) { // UNTESTED - d_info->decoder_name = "kodak_ycbcr_load_raw()"; - d_info->decoder_flags = LIBRAW_DECODER_LEGACY; - d_info->decoder_flags |= LIBRAW_DECODER_HASCURVE; + d_info->decoder_name = "kodak_ycbcr_load_raw()"; + d_info->decoder_flags = LIBRAW_DECODER_HASCURVE; } - else if (load_raw == &LibRaw::kodak_rgb_load_raw ) + else if (load_raw == &LibRaw::kodak_rgb_load_raw ) { // UNTESTED - d_info->decoder_name = "kodak_rgb_load_raw()"; - d_info->decoder_flags = LIBRAW_DECODER_LEGACY; + d_info->decoder_name = "kodak_rgb_load_raw()"; } else if (load_raw == &LibRaw::sony_load_raw ) { - d_info->decoder_name = "sony_load_raw()"; - d_info->decoder_flags = LIBRAW_DECODER_FLATFIELD; + d_info->decoder_name = "sony_load_raw()"; } else if (load_raw == &LibRaw::sony_arw_load_raw ) { d_info->decoder_name = "sony_arw_load_raw()"; - d_info->decoder_flags = LIBRAW_DECODER_FLATFIELD; - d_info->decoder_flags |= LIBRAW_DECODER_TRYRAWSPEED; + d_info->decoder_flags = LIBRAW_DECODER_TRYRAWSPEED; } else if (load_raw == &LibRaw::sony_arw2_load_raw ) { d_info->decoder_name = "sony_arw2_load_raw()"; - d_info->decoder_flags = LIBRAW_DECODER_FLATFIELD; - d_info->decoder_flags |= LIBRAW_DECODER_HASCURVE; - d_info->decoder_flags |= LIBRAW_DECODER_TRYRAWSPEED; - d_info->decoder_flags |= LIBRAW_DECODER_ITSASONY; + d_info->decoder_flags = LIBRAW_DECODER_HASCURVE | LIBRAW_DECODER_TRYRAWSPEED | LIBRAW_DECODER_SONYARW2; } else if (load_raw == &LibRaw::samsung_load_raw ) { d_info->decoder_name = "samsung_load_raw()"; - d_info->decoder_flags = LIBRAW_DECODER_FLATFIELD; - d_info->decoder_flags |= LIBRAW_DECODER_TRYRAWSPEED; + d_info->decoder_flags = LIBRAW_DECODER_TRYRAWSPEED; + } + else if (load_raw == &LibRaw::samsung2_load_raw ) + { + d_info->decoder_name = "samsung2_load_raw()"; + } + else if (load_raw == &LibRaw::samsung3_load_raw ) + { + d_info->decoder_name = "samsung3_load_raw()"; } else if (load_raw == &LibRaw::smal_v6_load_raw ) { // UNTESTED d_info->decoder_name = "smal_v6_load_raw()"; - d_info->decoder_flags = LIBRAW_DECODER_FLATFIELD; } else if (load_raw == &LibRaw::smal_v9_load_raw ) { // UNTESTED d_info->decoder_name = "smal_v9_load_raw()"; - d_info->decoder_flags = LIBRAW_DECODER_FLATFIELD; } else if (load_raw == &LibRaw::redcine_load_raw) { d_info->decoder_name = "redcine_load_raw()"; - d_info->decoder_flags = LIBRAW_DECODER_FLATFIELD; - d_info->decoder_flags |= LIBRAW_DECODER_HASCURVE; + d_info->decoder_flags = LIBRAW_DECODER_HASCURVE; } else if (load_raw == &LibRaw::x3f_load_raw ) { d_info->decoder_name = "x3f_load_raw()"; - d_info->decoder_flags = LIBRAW_DECODER_LEGACY | LIBRAW_DECODER_OWNALLOC; + d_info->decoder_flags = LIBRAW_DECODER_OWNALLOC; } #ifdef LIBRAW_DEMOSAIC_PACK_GPL2 else if (load_raw == &LibRaw::foveon_sd_load_raw ) { d_info->decoder_name = "foveon_sd_load_raw()"; - d_info->decoder_flags = LIBRAW_DECODER_LEGACY; } else if (load_raw == &LibRaw::foveon_dp_load_raw ) { d_info->decoder_name = "foveon_dp_load_raw()"; - d_info->decoder_flags = LIBRAW_DECODER_LEGACY; } #endif else @@ -738,8 +800,8 @@ auto_threshold = LIBRAW_DEFAULT_ADJUST_MAXIMUM_THRESHOLD; else auto_threshold = O.adjust_maximum_thr; - - + + real_max = C.data_maximum; if (real_max > 0 && real_max < C.maximum && real_max > C.maximum* auto_threshold) { @@ -771,7 +833,7 @@ int big = (st.st_size > max_buf_size)?1:0; #else struct _stati64 st; - if(_stati64(fname,&st)) + if(_stati64(fname,&st)) return LIBRAW_IO_ERROR; int big = (st.st_size > max_buf_size)?1:0; #endif @@ -812,7 +874,7 @@ int LibRaw::open_file(const wchar_t *fname, INT64 max_buf_size) { struct _stati64 st; - if(_wstati64(fname,&st)) + if(_wstati64(fname,&st)) return LIBRAW_IO_ERROR; int big = (st.st_size > max_buf_size)?1:0; @@ -906,13 +968,13 @@ const int width,height; } foveon_data [] = { - {"Sigma","SD9",2304,1531,3600,20,8,2266,1510}, - {"Sigma","SD9",1152,763,3600,10,2,1132,755}, - {"Sigma","SD10",2304,1531,9340,20,8,2266,1510}, - {"Sigma","SD10",1152,763,3600,10,2,1132,755}, - {"Sigma","SD14",2688,1792,7200,18,12,2651,1767}, - {"Sigma","SD14",2688,896,7200,18,6,2651,883}, // 2/3 - {"Sigma","SD14",1344,896,7200,9,6,1326,883}, // 1/2 + {"Sigma","SD9",2304,1531,12000,20,8,2266,1510}, + {"Sigma","SD9",1152,763,12000,10,2,1132,755}, + {"Sigma","SD10",2304,1531,12000,20,8,2266,1510}, + {"Sigma","SD10",1152,763,12000,10,2,1132,755}, + {"Sigma","SD14",2688,1792,14000,18,12,2651,1767}, + {"Sigma","SD14",2688,896,14000,18,6,2651,883}, // 2/3 + {"Sigma","SD14",1344,896,14000,9,6,1326,883}, // 1/2 {"Sigma","SD15",2688,1792,2900,18,12,2651,1767}, {"Sigma","SD15",2688,896,2900,18,6,2651,883}, // 2/3 ? {"Sigma","SD15",1344,896,2900,9,6,1326,883}, // 1/2 ? @@ -937,9 +999,9 @@ {"Sigma","SD1",4928,3264,3900,12,52,4807,3205}, // Full size {"Sigma","SD1",4928,1632,3900,12,26,4807,1603}, // 2/3 size {"Sigma","SD1",2464,1632,3900,6,26,2403,1603}, // 1/2 size - {"Sigma","SD1 Merill",4928,3264,3900,12,52,4807,3205}, // Full size - {"Sigma","SD1 Merill",4928,1632,3900,12,26,4807,1603}, // 2/3 size - {"Sigma","SD1 Merill",2464,1632,3900,6,26,2403,1603}, // 1/2 size + {"Sigma","SD1 Merrill",4928,3264,3900,12,52,4807,3205}, // Full size + {"Sigma","SD1 Merrill",4928,1632,3900,12,26,4807,1603}, // 2/3 size + {"Sigma","SD1 Merrill",2464,1632,3900,6,26,2403,1603}, // 1/2 size {"Sigma","DP1 Merrill",4928,3264,3900,12,0,4807,3205}, {"Sigma","DP1 Merrill",2464,1632,3900,12,0,2403,1603}, // 1/2 size {"Sigma","DP1 Merrill",4928,1632,3900,12,0,4807,1603}, // 2/3 size @@ -950,9 +1012,19 @@ {"Sigma","DP3 Merrill",2464,1632,3900,12,0,2403,1603}, // 1/2 size {"Sigma","DP3 Merrill",4928,1632,3900,12,0,4807,1603}, // 2/3 size {"Polaroid","x530",1440,1088,2700,10,13,1419,1059}, + // dp2 Q + {"Sigma","dp3 Quattro",5888,3672,16383,204,24,5446,3624}, // full size + {"Sigma","dp3 Quattro",2944,1836,16383,102,12,2723,1812}, // half size + {"Sigma","dp2 Quattro",5888,3672,16383,204,24,5446,3624}, // full size + {"Sigma","dp2 Quattro",2944,1836,16383,102,12,2723,1812}, // half size + {"Sigma","dp1 Quattro",5888,3672,16383,204,24,5446,3624}, // full size + {"Sigma","dp1 Quattro",2944,1836,16383,102,12,2723,1812}, // half size + {"Sigma","dp0 Quattro",5888,3672,16383,204,24,5446,3624}, // full size + {"Sigma","dp0 Quattro",2944,1836,16383,102,12,2723,1812}, // half size }; const int foveon_count = sizeof(foveon_data)/sizeof(foveon_data[0]); + int LibRaw::open_datastream(LibRaw_abstract_datastream *stream) { @@ -966,10 +1038,108 @@ ID.input = stream; SET_PROC_FLAG(LIBRAW_PROGRESS_OPEN); - if (O.use_camera_matrix < 0) - O.use_camera_matrix = O.use_camera_wb; - identify(); + + if (!imgdata.idata.dng_version && !strcmp(imgdata.idata.make, "Leaf") && !strcmp(imgdata.idata.model, "Credo 50")) + { + imgdata.color.pre_mul[0] = 1.f / 0.3984f; + imgdata.color.pre_mul[2] = 1.f / 0.7666f; + imgdata.color.pre_mul[1] = imgdata.color.pre_mul[3] = 1.0; + } + + // S3Pro DNG patch + if(imgdata.idata.dng_version && !strcmp(imgdata.idata.make,"Fujifilm") && !strcmp(imgdata.idata.model,"S3Pro") && imgdata.sizes.raw_width == 4288 ) + { + imgdata.sizes.left_margin++; + imgdata.sizes.width--; + } + if(imgdata.idata.dng_version && !strcmp(imgdata.idata.make,"Fujifilm") && !strcmp(imgdata.idata.model,"S5Pro") && imgdata.sizes.raw_width == 4288 ) + { + imgdata.sizes.left_margin++; + imgdata.sizes.width--; + } + if(!imgdata.idata.dng_version && !strcmp(imgdata.idata.make,"Fujifilm") + && (!strncmp(imgdata.idata.model,"S20Pro",6) || !strncmp(imgdata.idata.model,"F700",4)) + ) + { + imgdata.sizes.raw_width/=2; + load_raw= &LibRaw::unpacked_load_raw_fuji_f700s20; + } + if(load_raw == &LibRaw::packed_load_raw && !strcasecmp(imgdata.idata.make,"Nikon") + && !libraw_internal_data.unpacker_data.load_flags + && (!strncasecmp(imgdata.idata.model,"D810",4) || !strcasecmp(imgdata.idata.model,"D4S")) + && libraw_internal_data.unpacker_data.data_size*2 == imgdata.sizes.raw_height*imgdata.sizes.raw_width*3) + { + libraw_internal_data.unpacker_data.load_flags = 80; + } + // Adjust BL for Sony A900/A850 + if(load_raw == &LibRaw::packed_load_raw && !strcasecmp(imgdata.idata.make,"Sony")) // 12 bit sony, but metadata may be for 14-bit range + { + if(C.maximum>4095) + C.maximum = 4095; + if(C.black > 256 || C.cblack[0] > 256) + { + C.black /=4; + for(int c=0; c< 4; c++) + C.cblack[c]/=4; + for(int c=0; c< C.cblack[4]*C.cblack[5];c++) + C.cblack[6+c]/=4; + } + } + if( load_raw == &LibRaw::nikon_yuv_load_raw ) // Is it Nikon sRAW? + { + load_raw= &LibRaw::nikon_load_sraw; + C.black =0; + memset(C.cblack,0,sizeof(C.cblack)); + imgdata.idata.filters = 0; + libraw_internal_data.unpacker_data.tiff_samples=3; + imgdata.idata.colors = 3; + double beta_1 = -5.79342238397656E-02; + double beta_2 = 3.28163551282665; + double beta_3 = -8.43136004842678; + double beta_4 = 1.03533181861023E+01; + for(int i=0; i<=3072;i++) + { + double x = (double)i/3072.; + double y = (1.-exp(-beta_1*x-beta_2*x*x-beta_3*x*x*x-beta_4*x*x*x*x)); + if(y<0.)y=0.; + imgdata.color.curve[i] = (y*16383.); + } + for(int i=0;i<3;i++) + for(int j=0;j<4;j++) + imgdata.color.rgb_cam[i][j]=float(i==j); + } + // Adjust BL for Nikon 12bit + if(( + load_raw == &LibRaw::nikon_load_raw + || load_raw == &LibRaw::packed_load_raw) + && !strcasecmp(imgdata.idata.make,"Nikon") + && strncmp(imgdata.idata.model,"COOLPIX",7) +// && strncmp(imgdata.idata.model,"1 ",2) + && libraw_internal_data.unpacker_data.tiff_bps == 12) + { + C.maximum = 4095; + C.black /=4; + for(int c=0; c< 4; c++) + C.cblack[c]/=4; + for(int c=0; c< C.cblack[4]*C.cblack[5];c++) + C.cblack[6+c]/=4; + } + + // Adjust BL for Panasonic + if(load_raw == &LibRaw::panasonic_load_raw && (!strcasecmp(imgdata.idata.make,"Panasonic") || !strcasecmp(imgdata.idata.make,"Leica")) + && ID.pana_black[0] && ID.pana_black[1] && ID.pana_black[2]) + { + C.black=0; + C.cblack[0] = ID.pana_black[0]+ID.pana_black[3]; + C.cblack[1] = C.cblack[3] = ID.pana_black[1]+ID.pana_black[3]; + C.cblack[2] = ID.pana_black[2]+ID.pana_black[3]; + int i = C.cblack[3]; + for(int c=0; c<3; c++) if(i>C.cblack[c]) i = C.cblack[c]; + for(int c=0; c< 4; c++) C.cblack[c]-=i; + C.black = i; + } + // Adjust sizes for X3F processing if(load_raw == &LibRaw::x3f_load_raw) { @@ -983,6 +1153,7 @@ imgdata.sizes.left_margin = foveon_data[i].left_margin; imgdata.sizes.width = imgdata.sizes.iwidth = foveon_data[i].width; imgdata.sizes.height = imgdata.sizes.iheight = foveon_data[i].height; + C.maximum = foveon_data[i].white; break; } } @@ -1011,7 +1182,7 @@ ID.input->seek(ID.profile_offset,SEEK_SET); ID.input->read(C.profile,C.profile_length,1); } - + SET_PROC_FLAG(LIBRAW_PROGRESS_IDENTIFY); } catch ( LibRaw_exceptions err) { @@ -1021,13 +1192,13 @@ EXCEPTION_HANDLER(LIBRAW_EXCEPTION_IO_CORRUPT); } - if(P1.raw_count < 1) + if(P1.raw_count < 1) return LIBRAW_FILE_UNSUPPORTED; - + write_fun = &LibRaw::write_ppm_tiff; - - if (load_raw == &LibRaw::kodak_ycbcr_load_raw) + + if (load_raw == &LibRaw::kodak_ycbcr_load_raw) { S.height += S.height & 1; S.width += S.width & 1; @@ -1044,7 +1215,7 @@ memmove(&imgdata.rawdata.sizes,&imgdata.sizes,sizeof(imgdata.sizes)); memmove(&imgdata.rawdata.iparams,&imgdata.idata,sizeof(imgdata.idata)); memmove(&imgdata.rawdata.ioparams,&libraw_internal_data.internal_output_params,sizeof(libraw_internal_data.internal_output_params)); - + SET_PROC_FLAG(LIBRAW_PROGRESS_SIZE_ADJUST); @@ -1058,16 +1229,6 @@ C.maximum = 0xffff; else if (load_raw == &LibRaw::sony_load_raw) C.maximum = 0x3ff0; - else if ( - (load_raw == &LibRaw::sony_arw2_load_raw || (load_raw == &LibRaw::packed_load_raw && !strcasecmp(imgdata.idata.make,"Sony"))) - && bl >= (C.black+C.cblack[0])*2 - ) - { - C.maximum *=4; - C.black *=4; - for(int c=0; c< 4; c++) - C.cblack[c]*=4; - } } #else void LibRaw::fix_after_rawspeed(int) @@ -1075,10 +1236,27 @@ } #endif +void LibRaw::clearCancelFlag() +{ +#ifdef WIN32 + InterlockedExchange(&_exitflag, 0); +#else + __sync_fetch_and_and(&_exitflag, 0); +#endif +#ifdef RAWSPEED_FASTEXIT + if (_rawspeed_decoder) + { + RawDecoder *d = static_cast(_rawspeed_decoder); + d->resumeProcessing(); + } +#endif + +} + void LibRaw::setCancelFlag() { #ifdef WIN32 - InterlockedExchangeAdd(&_exitflag,1); + InterlockedExchange(&_exitflag,1); #else __sync_fetch_and_add(&_exitflag,1); #endif @@ -1094,10 +1272,10 @@ void LibRaw::checkCancel() { #ifdef WIN32 - if(InterlockedExchangeAdd(&_exitflag,0)) + if(InterlockedExchange(&_exitflag,0)) throw LIBRAW_EXCEPTION_CANCELLED_BY_CALLBACK; #else - if( __sync_add_and_fetch(&_exitflag,0)) + if( __sync_fetch_and_and(&_exitflag,0)) throw LIBRAW_EXCEPTION_CANCELLED_BY_CALLBACK; #endif } @@ -1114,16 +1292,10 @@ RUN_CALLBACK(LIBRAW_PROGRESS_LOAD_RAW,0,2); if (O.shot_select >= P1.raw_count) return LIBRAW_REQUEST_FOR_NONEXISTENT_IMAGE; - + if(!load_raw) return LIBRAW_UNSPECIFIED_ERROR; - - if (O.use_camera_matrix && C.cmatrix[0][0] > 0.25) - { - memcpy (C.rgb_cam, C.cmatrix, sizeof (C.cmatrix)); - IO.raw_color = 0; - } // already allocated ? if(imgdata.image) { @@ -1135,9 +1307,9 @@ free(imgdata.rawdata.raw_alloc); imgdata.rawdata.raw_alloc = 0; } - if (libraw_internal_data.unpacker_data.meta_length) + if (libraw_internal_data.unpacker_data.meta_length) { - libraw_internal_data.internal_data.meta_data = + libraw_internal_data.internal_data.meta_data = (char *) malloc (libraw_internal_data.unpacker_data.meta_length); merror (libraw_internal_data.internal_data.meta_data, "LibRaw::unpack()"); } @@ -1161,14 +1333,28 @@ imgdata.rawdata.color4_image = 0; imgdata.rawdata.color3_image = 0; #ifdef USE_RAWSPEED - // RawSpeed Supported, - if(O.use_rawspeed + int rawspeed_enabled = 1; + if(imgdata.idata.dng_version && libraw_internal_data.unpacker_data.tiff_samples == 2) + rawspeed_enabled = 0; + // Disable rawspeed for double-sized Oly files + if(!strncasecmp(imgdata.idata.make,"Olympus",7) && + ( (!strncasecmp(imgdata.idata.model,"E-M5MarkII",10) && imgdata.sizes.raw_width == 9280) || !strncasecmp(imgdata.idata.model,"SH-2",4) || !strncasecmp(imgdata.idata.model,"TG-4",4)) + ) + rawspeed_enabled = 0; + + if(!strncasecmp(imgdata.idata.make,"Canon",5) + && !strncasecmp(imgdata.idata.model,"EOS 5DS",7) + && (load_raw == &LibRaw::canon_sraw_load_raw)) + rawspeed_enabled = 0; + + // RawSpeed Supported, + if(O.use_rawspeed && rawspeed_enabled && !(is_sraw() && O.sraw_ycc) && (decoder_info.decoder_flags & LIBRAW_DECODER_TRYRAWSPEED) && _rawspeed_camerameta) { INT64 spos = ID.input->tell(); void *_rawspeed_buffer = 0; - try + try { // printf("Using rawspeed\n"); ID.input->seek(0,SEEK_SET); @@ -1200,16 +1386,22 @@ { delete d; _rawspeed_decoder = 0; - throw; + throw 1; } - if (r->isCFA) { + if (r->isCFA) + { imgdata.rawdata.raw_image = (ushort*) r->getDataUncropped(0,0); - } else if(r->getCpp()==4) { + } + else if(r->getCpp()==4) + { imgdata.rawdata.color4_image = (ushort(*)[4]) r->getDataUncropped(0,0); - C.maximum = r->whitePoint; + if(r->whitePoint > 0 && r->whitePoint < 65536) + C.maximum = r->whitePoint; } else if(r->getCpp() == 3) { imgdata.rawdata.color3_image = (ushort(*)[3]) r->getDataUncropped(0,0); + if(r->whitePoint > 0 && r->whitePoint < 65536) + C.maximum = r->whitePoint; } else { @@ -1229,8 +1421,20 @@ free(_rawspeed_buffer); _rawspeed_buffer = 0; imgdata.process_warnings |= LIBRAW_WARN_RAWSPEED_PROCESSED; - } - catch (...) + } + catch (const RawDecoderException& RDE) + { + imgdata.process_warnings |= LIBRAW_WARN_RAWSPEED_PROBLEM; + if (_rawspeed_buffer) + { + free(_rawspeed_buffer); + _rawspeed_buffer = 0; + } + const char *p = RDE.what(); + if (!strncmp(RDE.what(), "Decoder canceled", strlen("Decoder canceled"))) + throw LIBRAW_EXCEPTION_CANCELLED_BY_CALLBACK; + } + catch (...) { // We may get here due to cancellation flag imgdata.process_warnings |= LIBRAW_WARN_RAWSPEED_PROBLEM; @@ -1251,26 +1455,26 @@ // x3f foveon decoder // Do nothing! Decoder will allocate data internally } - else if(decoder_info.decoder_flags & LIBRAW_DECODER_FLATFIELD) + else if(imgdata.idata.filters || P1.colors == 1) // Bayer image or single color -> decode to raw_image { - imgdata.rawdata.raw_alloc = malloc(rwidth*(rheight+7)*sizeof(imgdata.rawdata.raw_image[0])); + imgdata.rawdata.raw_alloc = malloc(rwidth*(rheight+8)*sizeof(imgdata.rawdata.raw_image[0])); imgdata.rawdata.raw_image = (ushort*) imgdata.rawdata.raw_alloc; if(!S.raw_pitch) S.raw_pitch = S.raw_width*2; // Bayer case, not set before } - else if (decoder_info.decoder_flags & LIBRAW_DECODER_LEGACY) + else // NO LEGACY FLAG if (decoder_info.decoder_flags & LIBRAW_DECODER_LEGACY) { // sRAW and old Foveon decoders only, so extra buffer size is just 1/4 S.iwidth = S.width; - S.iheight= S.height; + S.iheight= S.height; IO.shrink = 0; S.raw_pitch = S.width*8; - // allocate image as temporary buffer, size + // allocate image as temporary buffer, size imgdata.rawdata.raw_alloc = 0; imgdata.image = (ushort (*)[4]) calloc(S.iwidth*S.iheight,sizeof(*imgdata.image)); } ID.input->seek(libraw_internal_data.unpacker_data.data_offset, SEEK_SET); - + unsigned m_save = C.maximum; if(load_raw == &LibRaw::unpacked_load_raw && !strcasecmp(imgdata.idata.make,"Nikon")) C.maximum=65535; @@ -1282,17 +1486,17 @@ // x3f foveon decoder only: do nothing } - else if (decoder_info.decoder_flags & LIBRAW_DECODER_LEGACY) + else if (!(imgdata.idata.filters || P1.colors == 1)) { // successfully decoded legacy image, attach image to raw_alloc imgdata.rawdata.raw_alloc = imgdata.image; - imgdata.image = 0; + imgdata.image = 0; // Restore saved values. Note: Foveon have masked frame // Other 4-color legacy data: no borders S.raw_width = S.width; S.left_margin = 0; S.raw_height = S.height; - S.top_margin = 0; + S.top_margin = 0; } } @@ -1300,9 +1504,9 @@ crop_masked_pixels(); // calculate black levels // recover saved - if( (decoder_info.decoder_flags & LIBRAW_DECODER_LEGACY) && !imgdata.rawdata.color4_image) + if( !(imgdata.idata.filters || P1.colors == 1) && !imgdata.rawdata.color4_image) { - imgdata.image = 0; + imgdata.image = 0; imgdata.rawdata.color4_image = (ushort (*)[4]) imgdata.rawdata.raw_alloc; } @@ -1328,7 +1532,7 @@ SET_PROC_FLAG(LIBRAW_PROGRESS_LOAD_RAW); RUN_CALLBACK(LIBRAW_PROGRESS_LOAD_RAW,1,2); - + return 0; } catch ( LibRaw_exceptions err) { @@ -1339,13 +1543,113 @@ } } +void LibRaw::unpacked_load_raw_fuji_f700s20() +{ + int base_offset = 0; + int row_size = imgdata.sizes.raw_width * 2; // in bytes + if(imgdata.idata.raw_count==2 && imgdata.params.shot_select) + { + libraw_internal_data.internal_data.input->seek(-row_size,SEEK_CUR); + base_offset = row_size; // in bytes + } + unsigned char *buffer = (unsigned char*)malloc(row_size*2); + for(int row = 0; row < imgdata.sizes.raw_height; row++) + { + read_shorts((ushort*)buffer,imgdata.sizes.raw_width * 2); + memmove(&imgdata.rawdata.raw_image[row*imgdata.sizes.raw_pitch/2],buffer+base_offset,row_size); + } + free(buffer); +} + +void LibRaw::nikon_load_sraw() +{ + // We're already seeked to data! + unsigned char *rd = (unsigned char *)malloc(3*(imgdata.sizes.raw_width+2)); + if(!rd) throw LIBRAW_EXCEPTION_ALLOC; + try { + int row,col; + for(row = 0; row < imgdata.sizes.raw_height; row++) + { + checkCancel(); + libraw_internal_data.internal_data.input->read(rd,3,imgdata.sizes.raw_width); + for(col = 0; col < imgdata.sizes.raw_width-1;col+=2) + { + int bi = col*3; + ushort bits1 = (rd[bi+1] &0xf)<<8| rd[bi]; // 3,0,1 + ushort bits2 = rd[bi+2] << 4 | ((rd[bi+1]>>4)& 0xf); //452 + ushort bits3 = ((rd[bi+4] & 0xf)<<8) | rd[bi+3]; // 967 + ushort bits4 = rd[bi+5] << 4 | ((rd[bi+4]>>4)& 0xf); // ab8 + imgdata.image[row*imgdata.sizes.raw_width+col][0]=bits1; + imgdata.image[row*imgdata.sizes.raw_width+col][1]=bits3; + imgdata.image[row*imgdata.sizes.raw_width+col][2]=bits4; + imgdata.image[row*imgdata.sizes.raw_width+col+1][0]=bits2; + imgdata.image[row*imgdata.sizes.raw_width+col+1][1]=2048; + imgdata.image[row*imgdata.sizes.raw_width+col+1][2]=2048; + } + } + }catch (...) { + free(rd); + throw ; + } + free(rd); + C.maximum = 0xfff; // 12 bit? + if(imgdata.params.sraw_ycc>=2) + { + return; // no CbCr interpolation + } + // Interpolate CC channels + int row,col; + for(row = 0; row < imgdata.sizes.raw_height; row++) + { + checkCancel(); // will throw out + for(col = 0; col < imgdata.sizes.raw_width;col+=2) + { + int col2 = col0) + return; + + for(row = 0; row < imgdata.sizes.raw_height; row++) + { + checkCancel(); // will throw out + for(col = 0; col < imgdata.sizes.raw_width;col++) + { + float Y = float(imgdata.image[row*imgdata.sizes.raw_width+col][0])/2549.f; + float Ch2 = float(imgdata.image[row*imgdata.sizes.raw_width+col][1]-1280)/1536.f; + float Ch3 = float(imgdata.image[row*imgdata.sizes.raw_width+col][2]-1280)/1536.f; + if(Y>1.f) Y = 1.f; + if(Y>0.803f) Ch2 = Ch3 = 0.5f; + float r = Y + 1.40200f*(Ch3 - 0.5f); + if(r<0.f) r=0.f; + if(r>1.f) r=1.f; + float g = Y - 0.34414f*(Ch2-0.5f) - 0.71414*(Ch3 - 0.5f) ; + if(g>1.f) g = 1.f; + if(g<0.f) g = 0.f; + float b = Y + 1.77200*(Ch2-0.5f); + if(b>1.f) b = 1.f; + if(b<0.f) b = 0.f; + imgdata.image[row*imgdata.sizes.raw_width+col][0]=imgdata.color.curve[int(r*3072.f)]; + imgdata.image[row*imgdata.sizes.raw_width+col][1]=imgdata.color.curve[int(g*3072.f)]; + imgdata.image[row*imgdata.sizes.raw_width+col][2]=imgdata.color.curve[int(b*3072.f)]; + } + } + C.maximum=16383; +} + void LibRaw::free_image(void) { if(imgdata.image) { free(imgdata.image); imgdata.image = 0; - imgdata.progress_flags + imgdata.progress_flags = LIBRAW_PROGRESS_START|LIBRAW_PROGRESS_OPEN |LIBRAW_PROGRESS_IDENTIFY|LIBRAW_PROGRESS_SIZE_ADJUST|LIBRAW_PROGRESS_LOAD_RAW; } @@ -1362,8 +1666,8 @@ if (O.user_flip >= 0) S.flip = O.user_flip; - - switch ((S.flip+3600) % 360) + + switch ((S.flip+3600) % 360) { case 270: S.flip = 5; break; case 180: S.flip = 3; break; @@ -1373,15 +1677,15 @@ // adjust for half mode! IO.shrink = P1.filters && (O.half_size || ((O.threshold || O.aber[0] != 1 || O.aber[2] != 1) )); - + S.iheight = (S.height + IO.shrink) >> IO.shrink; S.iwidth = (S.width + IO.shrink) >> IO.shrink; } -int LibRaw::is_phaseone_compressed() -{ - return (load_raw == &LibRaw::phase_one_load_raw_c && imgdata.rawdata.ph1_black); +int LibRaw::is_phaseone_compressed() +{ + return (load_raw == &LibRaw::phase_one_load_raw_c || load_raw == &LibRaw::phase_one_load_raw); } int LibRaw::raw2image(void) @@ -1412,9 +1716,9 @@ libraw_decoder_info_t decoder_info; get_decoder_info(&decoder_info); - + // Move saved bitmap to imgdata.image - if(decoder_info.decoder_flags & LIBRAW_DECODER_FLATFIELD) + if( imgdata.idata.filters || P1.colors == 1) { if (IO.fuji_width) { unsigned r,c; @@ -1429,20 +1733,20 @@ c = row + ((col+1) >> 1); } if (r < S.height && c < S.width) - imgdata.image[((r)>>IO.shrink)*S.iwidth+((c)>>IO.shrink)][FC(r,c)] + imgdata.image[((r)>>IO.shrink)*S.iwidth+((c)>>IO.shrink)][FC(r,c)] = imgdata.rawdata.raw_image[(row+S.top_margin)*S.raw_pitch/2+(col+S.left_margin)]; } } - } + } else { int row,col; for (row=0; row < S.height; row++) for (col=0; col < S.width; col++) - imgdata.image[((row) >> IO.shrink)*S.iwidth + ((col) >> IO.shrink)][fcol(row,col)] + imgdata.image[((row) >> IO.shrink)*S.iwidth + ((col) >> IO.shrink)][fcol(row,col)] = imgdata.rawdata.raw_image[(row+S.top_margin)*S.raw_pitch/2+(col+S.left_margin)]; } } - else if(decoder_info.decoder_flags & LIBRAW_DECODER_LEGACY) + else // if(decoder_info.decoder_flags & LIBRAW_DECODER_LEGACY) { if(imgdata.rawdata.color4_image) { @@ -1485,12 +1789,12 @@ } // hack - clear later flags! - if (load_raw == &CLASS canon_600_load_raw && S.width < S.raw_width) + if (load_raw == &CLASS canon_600_load_raw && S.width < S.raw_width) { canon_600_correct(); } - imgdata.progress_flags + imgdata.progress_flags = LIBRAW_PROGRESS_START|LIBRAW_PROGRESS_OPEN | LIBRAW_PROGRESS_RAW2_IMAGE |LIBRAW_PROGRESS_IDENTIFY|LIBRAW_PROGRESS_SIZE_ADJUST|LIBRAW_PROGRESS_LOAD_RAW; return 0; @@ -1512,46 +1816,67 @@ imgdata.rawdata.raw_image = (ushort*) imgdata.rawdata.raw_alloc; } -void LibRaw::phase_one_subtract_black(ushort *src, ushort *dest) +int LibRaw::phase_one_subtract_black(ushort *src, ushort *dest) { - // ushort *src = (ushort*)imgdata.rawdata.raw_alloc; - if(O.user_black<0 && O.user_cblack[0] <= -1000000 && O.user_cblack[1] <= -1000000 && O.user_cblack[2] <= -1000000 && O.user_cblack[3] <= -1000000) + + try { - for(int row = 0; row < S.raw_height; row++) + if (O.user_black < 0 && O.user_cblack[0] <= -1000000 && O.user_cblack[1] <= -1000000 && O.user_cblack[2] <= -1000000 && O.user_cblack[3] <= -1000000) { - ushort bl = imgdata.color.phase_one_data.t_black - imgdata.rawdata.ph1_black[row][0]; - for(int col=0; col < imgdata.color.phase_one_data.split_col && col < S.raw_width; col++) + if (!imgdata.rawdata.ph1_cblack || !imgdata.rawdata.ph1_rblack) { - int idx = row*S.raw_width + col; - ushort val = src[idx]; - dest[idx] = val>bl?val-bl:0; + register int bl = imgdata.color.phase_one_data.t_black; + for (int row = 0; row < S.raw_height; row++) + { + checkCancel(); + for (int col = 0; col < S.raw_width; col++) + { + int idx = row*S.raw_width + col; + int val = int(src[idx]) - bl; + dest[idx] = val>0 ? val : 0; + } + } } - bl = imgdata.color.phase_one_data.t_black - imgdata.rawdata.ph1_black[row][1]; - for(int col=imgdata.color.phase_one_data.split_col; col < S.raw_width; col++) + else { - int idx = row*S.raw_width + col; - ushort val = src[idx]; - dest[idx] = val>bl?val-bl:0; + register int bl = imgdata.color.phase_one_data.t_black; + for (int row = 0; row < S.raw_height; row++) + { + checkCancel(); + for (int col = 0; col < S.raw_width; col++) + { + int idx = row*S.raw_width + col; + int val = int(src[idx]) - bl + + imgdata.rawdata.ph1_cblack[row][col >= imgdata.rawdata.color.phase_one_data.split_col] + + imgdata.rawdata.ph1_rblack[col][row >= imgdata.rawdata.color.phase_one_data.split_row]; + dest[idx] = val>0 ? val : 0; + } + } } } - } - else // black set by user interaction - { - // Black level in cblack! - for(int row = 0; row < S.raw_height; row++) + else // black set by user interaction { - unsigned short cblk[16]; - for(int cc=0; cc<16;cc++) - cblk[cc]=C.cblack[fcol(row,cc)]; - for(int col = 0; col < S.raw_width; col++) + // Black level in cblack! + for (int row = 0; row < S.raw_height; row++) { - int idx = row*S.raw_width + col; - ushort val = src[idx]; - ushort bl = cblk[col&0xf]; - dest[idx] = val>bl?val-bl:0; + checkCancel(); + unsigned short cblk[16]; + for (int cc = 0; cc < 16; cc++) + cblk[cc] = C.cblack[fcol(row, cc)]; + for (int col = 0; col < S.raw_width; col++) + { + int idx = row*S.raw_width + col; + ushort val = src[idx]; + ushort bl = cblk[col & 0xf]; + dest[idx] = val>bl ? val - bl : 0; + } } } + return 0; } + catch (LibRaw_exceptions err) { + return LIBRAW_CANCELLED_BY_CALLBACK; + } } void LibRaw::copy_fuji_uncropped(unsigned short cblack[4],unsigned short *dmaxp) @@ -1560,11 +1885,11 @@ #if defined(LIBRAW_USE_OPENMP) #pragma omp parallel for default(shared) #endif - for (row=0; row < S.raw_height-S.top_margin*2; row++) + for (row=0; row < S.raw_height-S.top_margin*2; row++) { int col; unsigned short ldmax = 0; - for (col=0; col < IO.fuji_width << !libraw_internal_data.unpacker_data.fuji_layout; col++) + for (col=0; col < IO.fuji_width << !libraw_internal_data.unpacker_data.fuji_layout; col++) { unsigned r,c; if (libraw_internal_data.unpacker_data.fuji_layout) { @@ -1585,7 +1910,7 @@ } else val = 0; - imgdata.image[((r)>>IO.shrink)*S.iwidth+((c)>>IO.shrink)][cc] = val; + imgdata.image[((r)>>IO.shrink)*S.iwidth+((c)>>IO.shrink)][cc] = val; } } #if defined(LIBRAW_USE_OPENMP) @@ -1621,7 +1946,7 @@ } else val = 0; - imgdata.image[((row) >> IO.shrink)*S.iwidth + ((col) >> IO.shrink)][cc] = val; + imgdata.image[((row) >> IO.shrink)*S.iwidth + ((col) >> IO.shrink)][cc] = val; } #if defined(LIBRAW_USE_OPENMP) #pragma omp critical(dataupdate) @@ -1653,21 +1978,21 @@ // process cropping int do_crop = 0; unsigned save_width = S.width; - if (~O.cropbox[2] && ~O.cropbox[3] + if (~O.cropbox[2] && ~O.cropbox[3] #ifdef LIBRAW_DEMOSAIC_PACK_GPL2 && load_raw != &LibRaw::foveon_sd_load_raw #endif ) // Foveon SD to be cropped later { int crop[4],c,filt; - for(int c=0;c<4;c++) + for(int c=0;c<4;c++) { crop[c] = O.cropbox[c]; if(crop[c]<0) crop[c]=0; } - - if(IO.fuji_width && imgdata.idata.filters >= 1000) + + if(IO.fuji_width && imgdata.idata.filters >= 1000) { crop[0] = (crop[0]/4)*4; crop[1] = (crop[1]/4)*4; @@ -1690,18 +2015,18 @@ crop[1] = (crop[1]/6)*6; } do_crop = 1; - + crop[2] = MIN (crop[2], (signed) S.width-crop[0]); crop[3] = MIN (crop[3], (signed) S.height-crop[1]); if (crop[2] <= 0 || crop[3] <= 0) throw LIBRAW_EXCEPTION_BAD_CROP; - + // adjust sizes! S.left_margin+=crop[0]; S.top_margin+=crop[1]; S.width=crop[2]; S.height=crop[3]; - + S.iheight = (S.height + IO.shrink) >> IO.shrink; S.iwidth = (S.width + IO.shrink) >> IO.shrink; if(!IO.fuji_width && imgdata.idata.filters && imgdata.idata.filters >= 1000) @@ -1715,7 +2040,7 @@ int alloc_width = S.iwidth; int alloc_height = S.iheight; - + if(IO.fuji_width && do_crop) { int IO_fw = S.width >> !libraw_internal_data.unpacker_data.fuji_layout; @@ -1747,18 +2072,18 @@ for(int i=0; i< 4; i++) cblack[i] = (unsigned short)C.cblack[i]; } - + // Move saved bitmap to imgdata.image - if(decoder_info.decoder_flags & LIBRAW_DECODER_FLATFIELD) + if(imgdata.idata.filters || P1.colors == 1) { - if (IO.fuji_width) + if (IO.fuji_width) { if(do_crop) { IO.fuji_width = S.width >> !libraw_internal_data.unpacker_data.fuji_layout; int IO_fwidth = (S.height >> libraw_internal_data.unpacker_data.fuji_layout) + IO.fuji_width; int IO_fheight = IO_fwidth - 1; - + int row,col; for(row=0;row> 1); c = row + ((col+1) >> 1); } - + unsigned short val = imgdata.rawdata.raw_image[(row+S.top_margin)*S.raw_pitch/2 +(col+S.left_margin)]; int cc = FCF(row,col); @@ -1797,12 +2122,12 @@ copy_fuji_uncropped(cblack,&dmax); } } // end Fuji - else + else { copy_bayer(cblack,&dmax); } } - else if(decoder_info.decoder_flags & LIBRAW_DECODER_LEGACY) + else //if(decoder_info.decoder_flags & LIBRAW_DECODER_LEGACY) { if(imgdata.rawdata.color4_image) { @@ -1846,7 +2171,7 @@ { phase_one_free_tempbuffer(); } - if (load_raw == &CLASS canon_600_load_raw && S.width < S.raw_width) + if (load_raw == &CLASS canon_600_load_raw && S.width < S.raw_width) { canon_600_correct(); } @@ -1855,12 +2180,13 @@ { C.data_maximum = (int)dmax; C.maximum -= C.black; - ZERO(C.cblack); + // ZERO(C.cblack); + C.cblack[0]=C.cblack[1]=C.cblack[2]=C.cblack[3]=0; C.black = 0; } // hack - clear later flags! - imgdata.progress_flags + imgdata.progress_flags = LIBRAW_PROGRESS_START|LIBRAW_PROGRESS_OPEN | LIBRAW_PROGRESS_RAW2_IMAGE |LIBRAW_PROGRESS_IDENTIFY|LIBRAW_PROGRESS_SIZE_ADJUST|LIBRAW_PROGRESS_LOAD_RAW; return 0; @@ -1869,14 +2195,14 @@ EXCEPTION_HANDLER(err); } } - + #if 1 libraw_processed_image_t * LibRaw::dcraw_make_mem_thumb(int *errcode) { if(!T.thumb) { - if ( !ID.toffset) + if ( !ID.toffset) { if(errcode) *errcode= LIBRAW_NO_THUMBNAIL; } @@ -1886,10 +2212,10 @@ } return NULL; } - + if (T.tformat == LIBRAW_THUMBNAIL_BITMAP) { - libraw_processed_image_t * ret = + libraw_processed_image_t * ret = (libraw_processed_image_t *)::malloc(sizeof(libraw_processed_image_t)+T.tlength); if(!ret) @@ -1902,7 +2228,7 @@ ret->type = LIBRAW_IMAGE_BITMAP; ret->height = T.theight; ret->width = T.twidth; - ret->colors = 3; + ret->colors = 3; ret->bits = 8; ret->data_size = T.tlength; memmove(ret->data,T.thumb,T.tlength); @@ -1914,10 +2240,10 @@ ushort exif[5]; int mk_exif = 0; if(strcmp(T.thumb+6,"Exif")) mk_exif = 1; - + int dsize = T.tlength + mk_exif * (sizeof(exif)+sizeof(tiff_hdr)); - libraw_processed_image_t * ret = + libraw_processed_image_t * ret = (libraw_processed_image_t *)::malloc(sizeof(libraw_processed_image_t)+dsize); if(!ret) @@ -1930,7 +2256,7 @@ ret->type = LIBRAW_IMAGE_JPEG; ret->data_size = dsize; - + ret->data[0] = 0xff; ret->data[1] = 0xd8; if(mk_exif) @@ -1949,7 +2275,7 @@ } if(errcode) *errcode= 0; return ret; - + } else { @@ -1990,7 +2316,7 @@ if(libraw_internal_data.output_data.histogram) { int perc, val, total, t_white=0x2000,c; - perc = S.width * S.height * O.auto_bright_thr; /* 99th percentile white level */ + perc = S.width * S.height * O.auto_bright_thr; if (IO.fuji_width) perc /= 2; if (!((O.highlight & ~2) || O.no_auto_bright)) for (t_white=c=0; c < P1.colors; c++) { @@ -2000,7 +2326,7 @@ } gamma_curve (O.gamm[0], O.gamm[1], 2, (t_white << 3)/O.bright); } - + int s_iheight = S.iheight; int s_iwidth = S.iwidth; int s_width = S.width; @@ -2018,35 +2344,35 @@ cstep = flip_index (0, 1) - soff; rstep = flip_index (1, 0) - flip_index (0, S.width); - for (row=0; row < S.height; row++, soff += rstep) + for (row=0; row < S.height; row++, soff += rstep) { uchar *bufp = ((uchar*)scan0)+row*stride; ppm2 = (ushort*) (ppm = bufp); // keep trivial decisions in the outer loop for speed if (bgr) { if (O.output_bps == 8) { - for (col=0; col < S.width; col++, soff += cstep) + for (col=0; col < S.width; col++, soff += cstep) FORBGR *ppm++ = imgdata.color.curve[imgdata.image[soff][c]]>>8; } else { - for (col=0; col < S.width; col++, soff += cstep) + for (col=0; col < S.width; col++, soff += cstep) FORBGR *ppm2++ = imgdata.color.curve[imgdata.image[soff][c]]; } } else { if (O.output_bps == 8) { - for (col=0; col < S.width; col++, soff += cstep) + for (col=0; col < S.width; col++, soff += cstep) FORRGB *ppm++ = imgdata.color.curve[imgdata.image[soff][c]]>>8; } else { - for (col=0; col < S.width; col++, soff += cstep) + for (col=0; col < S.width; col++, soff += cstep) FORRGB *ppm2++ = imgdata.color.curve[imgdata.image[soff][c]]; } } - + // bufp += stride; // go to the next line } - + S.iheight = s_iheight; S.iwidth = s_iwidth; S.width = s_width; @@ -2059,7 +2385,7 @@ #undef FORBGR #undef FORRGB - + libraw_processed_image_t *LibRaw::dcraw_make_mem_image(int *errcode) @@ -2083,7 +2409,7 @@ ret->colors = colors; ret->bits = bps; ret->data_size = ds; - copy_mem_image(ret->data, stride, 0); + copy_mem_image(ret->data, stride, 0); return ret; } @@ -2098,20 +2424,20 @@ { CHECK_ORDER_LOW(LIBRAW_PROGRESS_LOAD_RAW); - if(!imgdata.image) + if(!imgdata.image) return LIBRAW_OUT_OF_ORDER_CALL; - if(!filename) + if(!filename) return ENOENT; FILE *f = fopen(filename,"wb"); - if(!f) + if(!f) return errno; try { if(!libraw_internal_data.output_data.histogram) { - libraw_internal_data.output_data.histogram = + libraw_internal_data.output_data.histogram = (int (*)[LIBRAW_HISTOGRAM_SIZE]) malloc(sizeof(*libraw_internal_data.output_data.histogram)*4); merror(libraw_internal_data.output_data.histogram,"LibRaw::dcraw_ppm_tiff_writer()"); } @@ -2132,27 +2458,52 @@ { // some kodak cameras ushort s_height = S.height, s_width = S.width,s_iwidth = S.iwidth,s_iheight=S.iheight; + ushort s_flags = libraw_internal_data.unpacker_data.load_flags; + libraw_internal_data.unpacker_data.load_flags = 12; int s_colors = P1.colors; unsigned s_filters = P1.filters; ushort (*s_image)[4] = imgdata.image; - + S.height = T.theight; S.width = T.twidth; P1.filters = 0; - if (thumb_load_raw == &CLASS kodak_ycbcr_load_raw) + if (thumb_load_raw == &CLASS kodak_ycbcr_load_raw) { S.height += S.height & 1; S.width += S.width & 1; } - + imgdata.image = (ushort (*)[4]) calloc (S.iheight*S.iwidth, sizeof (*imgdata.image)); merror (imgdata.image, "LibRaw::kodak_thumb_loader()"); ID.input->seek(ID.toffset, SEEK_SET); // read kodak thumbnail into T.image[] - (this->*thumb_load_raw)(); + try { + (this->*thumb_load_raw)(); + } catch (...) + { + free(imgdata.image); + imgdata.image = s_image; + + T.twidth = 0; + S.width = s_width; + + S.iwidth = s_iwidth; + S.iheight = s_iheight; + + T.theight = 0; + S.height = s_height; + + T.tcolors = 0; + P1.colors = s_colors; + + P1.filters = s_filters; + T.tlength=0; + libraw_internal_data.unpacker_data.load_flags = s_flags; + return; + } // copy-n-paste from image pipe #define MIN(a,b) ((a) < (b) ? (a) : (b)) @@ -2166,7 +2517,7 @@ double dmax; float scale_mul[4]; int c,val; - for (dmax=DBL_MAX, c=0; c < 3; c++) + for (dmax=DBL_MAX, c=0; c < 3; c++) if (dmax > C.pre_mul[c]) dmax = C.pre_mul[c]; @@ -2175,7 +2526,7 @@ scale_mul[3] = scale_mul[1]; size_t size = S.height * S.width; - for (unsigned i=0; i < size*4 ; i++) + for (unsigned i=0; i < size*4 ; i++) { val = imgdata.image[0][i]; if(!val) continue; @@ -2187,15 +2538,15 @@ // from convert_to_rgb ushort *img; int row,col; - + int (*t_hist)[LIBRAW_HISTOGRAM_SIZE] = (int (*)[LIBRAW_HISTOGRAM_SIZE]) calloc(sizeof(*t_hist),4); merror (t_hist, "LibRaw::kodak_thumb_loader()"); - - float out[3], - out_cam[3][4] = + + float out[3], + out_cam[3][4] = { - {2.81761312, -1.98369181, 0.166078627, 0}, - {-0.111855984, 1.73688626, -0.625030339, 0}, + {2.81761312, -1.98369181, 0.166078627, 0}, + {-0.111855984, 1.73688626, -0.625030339, 0}, {-0.0379119813, -0.891268849, 1.92918086, 0} }; @@ -2204,7 +2555,7 @@ { out[0] = out[1] = out[2] = 0; int c; - for(c=0;c<3;c++) + for(c=0;c<3;c++) { out[0] += out_cam[0][c] * img[c]; out[1] += out_cam[1][c] * img[c]; @@ -2214,7 +2565,7 @@ img[c] = CLIP((int) out[c]); for(c=0; c> 3]++; - + } // from gamma_lut @@ -2239,12 +2590,12 @@ } gamma_curve (O.gamm[0], O.gamm[1], 2, (t_white << 3)/O.bright); } - + libraw_internal_data.output_data.histogram = save_hist; free(t_hist); - + // from write_ppm_tiff - copy pixels into bitmap - + S.iheight = S.height; S.iwidth = S.width; if (S.flip & 4) SWAP(S.height,S.width); @@ -2259,8 +2610,8 @@ int soff = flip_index (0, 0); int cstep = flip_index (0, 1) - soff; int rstep = flip_index (1, 0) - flip_index (0, S.width); - - for (int row=0; row < S.height; row++, soff += rstep) + + for (int row=0; row < S.height; row++, soff += rstep) { char *ppm = T.thumb + row*S.width*P1.colors; for (int col=0; col < S.width; col++, soff += cstep) @@ -2275,7 +2626,7 @@ // restore variables free(imgdata.image); imgdata.image = s_image; - + T.twidth = S.width; S.width = s_width; @@ -2289,6 +2640,7 @@ P1.colors = s_colors; P1.filters = s_filters; + libraw_internal_data.unpacker_data.load_flags = s_flags; } #undef MIN #undef MAX @@ -2307,18 +2659,18 @@ if(!libraw_internal_data.internal_data.input) return LIBRAW_INPUT_CLOSED; - if ( !ID.toffset) + if ( !ID.toffset) { return LIBRAW_NO_THUMBNAIL; - } - else if (thumb_load_raw) + } + else if (thumb_load_raw) { kodak_thumb_loader(); T.tformat = LIBRAW_THUMBNAIL_BITMAP; SET_PROC_FLAG(LIBRAW_PROGRESS_THUMB_LOAD); return 0; - } - else + } + else { ID.input->seek(ID.toffset, SEEK_SET); if ( write_thumb == &LibRaw::jpeg_thumb) @@ -2327,6 +2679,8 @@ T.thumb = (char *) malloc (T.tlength); merror (T.thumb, "jpeg_thumb()"); ID.input->read (T.thumb, 1, T.tlength); + T.thumb[0] = 0xff; + T.thumb[1] = 0xd8; T.tcolors = 3; T.tformat = LIBRAW_THUMBNAIL_JPEG; SET_PROC_FLAG(LIBRAW_PROGRESS_THUMB_LOAD); @@ -2401,12 +2755,12 @@ { // CHECK_ORDER_LOW(LIBRAW_PROGRESS_THUMB_LOAD); - if(!fname) + if(!fname) return ENOENT; - + FILE *tfp = fopen(fname,"wb"); - - if(!tfp) + + if(!tfp) return errno; if(!T.thumb) @@ -2445,16 +2799,16 @@ raw2image_start(); if (O.use_fuji_rotate) { - if (IO.fuji_width) + if (IO.fuji_width) { IO.fuji_width = (IO.fuji_width - 1 + IO.shrink) >> IO.shrink; S.iwidth = (ushort)(IO.fuji_width / sqrt(0.5)); S.iheight = (ushort)( (S.iheight - IO.fuji_width) / sqrt(0.5)); - } - else + } + else { - if (S.pixel_aspect < 1) S.iheight = (ushort)( S.iheight / S.pixel_aspect + 0.5); - if (S.pixel_aspect > 1) S.iwidth = (ushort) (S.iwidth * S.pixel_aspect + 0.5); + if (S.pixel_aspect < 0.995) S.iheight = (ushort)( S.iheight / S.pixel_aspect + 0.5); + if (S.pixel_aspect > 1.005) S.iwidth = (ushort) (S.iwidth * S.pixel_aspect + 0.5); } } SET_PROC_FLAG(LIBRAW_PROGRESS_FUJI_ROTATE); @@ -2479,9 +2833,9 @@ CHECK_ORDER_LOW(LIBRAW_PROGRESS_RAW2_IMAGE); try { - if(!is_phaseone_compressed() && (C.cblack[0] || C.cblack[1] || C.cblack[2] || C.cblack[3])) + if(!is_phaseone_compressed() && (C.cblack[0] || C.cblack[1] || C.cblack[2] || C.cblack[3] || (C.cblack[4] && C.cblack[5]) )) { -#define BAYERC(row,col,c) imgdata.image[((row) >> IO.shrink)*S.iwidth + ((col) >> IO.shrink)][c] +#define BAYERC(row,col,c) imgdata.image[((row) >> IO.shrink)*S.iwidth + ((col) >> IO.shrink)][c] int cblk[4],i; for(i=0;i<4;i++) cblk[i] = C.cblack[i]; @@ -2492,12 +2846,27 @@ #define LIM(x,min,max) MAX(min,MIN(x,max)) #define CLIP(x) LIM(x,0,65535) int dmax = 0; - for(i=0; i< size*4; i++) + if(C.cblack[4] && C.cblack[5]) + { + for(i=0; i< size*4; i++) + { + int val = imgdata.image[0][i]; + val -= C.cblack[6 + i/4 / S.iwidth % C.cblack[4] * C.cblack[5] + + i/4 % S.iwidth % C.cblack[5]]; + val -= cblk[i & 3]; + imgdata.image[0][i] = CLIP(val); + if(dmax < val) dmax = val; + } + } + else { - int val = imgdata.image[0][i]; - val -= cblk[i & 3]; - imgdata.image[0][i] = CLIP(val); - if(dmax < val) dmax = val; + for(i=0; i< size*4; i++) + { + int val = imgdata.image[0][i]; + val -= cblk[i & 3]; + imgdata.image[0][i] = CLIP(val); + if(dmax < val) dmax = val; + } } C.data_maximum = dmax & 0xffff; #undef MIN @@ -2505,7 +2874,7 @@ #undef LIM #undef CLIP C.maximum -= C.black; - ZERO(C.cblack); + ZERO(C.cblack); // Yeah, we used cblack[6+] values too! C.black = 0; #undef BAYERC } @@ -2537,7 +2906,7 @@ if(shift<0.25) shift = 0.25; if(smooth < 0.0) smooth = 0.0; if(smooth > 1.0) smooth = 1.0; - + unsigned short *lut = (ushort*)malloc((TBLN+1)*sizeof(unsigned short)); if(shift <=1.0) @@ -2617,10 +2986,24 @@ void LibRaw::scale_colors_loop(float scale_mul[4]) { unsigned size = S.iheight*S.iwidth; - - if(C.cblack[0]||C.cblack[1]||C.cblack[2]||C.cblack[3]) + + + if (C.cblack[4] && C.cblack[5]) + { + int val; + for (unsigned i=0; i < size*4; i++) + { + if (!(val = imgdata.image[0][i])) continue; + val -= C.cblack[6 + i/4 / S.iwidth % C.cblack[4] * C.cblack[5] + + i/4 % S.iwidth % C.cblack[5]]; + val -= C.cblack[i & 3]; + val *= scale_mul[i & 3]; + imgdata.image[0][i] = CLIP(val); + } + } + else if(C.cblack[0]||C.cblack[1]||C.cblack[2]||C.cblack[3]) { - for (unsigned i=0; i < size*4; i++) + for (unsigned i=0; i < size*4; i++) { int val = imgdata.image[0][i]; if (!val) continue; @@ -2631,7 +3014,7 @@ } else // BL is zero { - for (unsigned i=0; i < size*4; i++) + for (unsigned i=0; i < size*4; i++) { int val = imgdata.image[0][i]; val *= scale_mul[i & 3]; @@ -2642,19 +3025,61 @@ void LibRaw::adjust_bl() { - - if (O.user_black >= 0) - C.black = O.user_black; + int clear_repeat=0; + if (O.user_black >= 0) + { + C.black = O.user_black; + clear_repeat = 1; + } for(int i=0; i<4; i++) if(O.user_cblack[i]>-1000000) - C.cblack[i] = O.user_cblack[i]; - + { + C.cblack[i] = O.user_cblack[i]; + clear_repeat = 1; + } + + if(clear_repeat) + C.cblack[4]=C.cblack[5]=0; + + // Add common part to cblack[] early + if (imgdata.idata.filters > 1000 && (C.cblack[4]+1)/2 == 1 && (C.cblack[5]+1)/2 == 1) + { + for(int c=0; c<4; c++) + C.cblack[c] += C.cblack[6 + c/2 % C.cblack[4] * C.cblack[5] + c%2 % C.cblack[5]]; + C.cblack[4]=C.cblack[5]=0; + } + else if(imgdata.idata.filters <= 1000 && C.cblack[4]==1 && C.cblack[5]==1) // Fuji RAF dng + { + for(int c=0; c<4; c++) + C.cblack[c] += C.cblack[6]; + C.cblack[4]=C.cblack[5]=0; + } // remove common part from C.cblack[] int i = C.cblack[3]; int c; for(c=0;c<3;c++) if (i > C.cblack[c]) i = C.cblack[c]; - for(c=0;c<4;c++) C.cblack[c] -= i; + + for(c=0;c<4;c++) C.cblack[c] -= i; // remove common part C.black += i; + + // Now calculate common part for cblack[6+] part and move it to C.black + + if(C.cblack[4] && C.cblack[5]) + { + i = C.cblack[6]; + for(c=1; cC.cblack[6+c]) i = C.cblack[6+c]; + // Remove i from cblack[6+] + int nonz=0; + for(c=0; c 0) C.maximum = O.user_sat; - if (P1.is_foveon) + if (P1.is_foveon) { if(load_raw == &LibRaw::x3f_load_raw) { @@ -2789,13 +3206,13 @@ // LIBRAW_DEMOSAIC_PACK_GPL3 - if (!O.half_size && O.cfa_green >0) {thresh=O.green_thresh ;green_equilibrate(thresh);} - if (O.exp_correc >0) {expos=O.exp_shift ; preser=O.exp_preser; exp_bef(expos,preser);} + if (!O.half_size && O.cfa_green >0) {thresh=O.green_thresh ;green_equilibrate(thresh);} + if (O.exp_correc >0) {expos=O.exp_shift ; preser=O.exp_preser; exp_bef(expos,preser);} if (O.ca_correc >0 ) {cablue=O.cablue; cared=O.cared; CA_correct_RT(cablue, cared);} if (O.cfaline >0 ) {linenoise=O.linenoise; cfa_linedn(linenoise);} if (O.cfa_clean >0 ) {lclean=O.lclean; cclean=O.cclean; cfa_impulse_gauss(lclean,cclean);} - if (P1.filters && !O.no_interpolation) + if (P1.filters && !O.no_interpolation) { if (noiserd>0 && P1.colors==3 && P1.filters) fbdd(noiserd); if (quality == 0) @@ -2809,11 +3226,11 @@ // Fuji X-Trans xtrans_interpolate(quality>2?3:1); } - else if (quality == 3) + else if (quality == 3) ahd_interpolate(); // really don't need it here due to fallback op else if (quality == 4) dcb(iterations, dcb_enhance); - // LIBRAW_DEMOSAIC_PACK_GPL2 + // LIBRAW_DEMOSAIC_PACK_GPL2 else if (quality == 5) ahd_interpolate_mod(); else if (quality == 6) @@ -2824,7 +3241,7 @@ vcd_interpolate(12); else if (quality == 9) lmmse_interpolate(1); - + // LIBRAW_DEMOSAIC_PACK_GPL3 else if (quality == 10) amaze_demosaic_RT(); @@ -2835,7 +3252,11 @@ aahd_interpolate(); // fallback to AHD else - ahd_interpolate(); + { + ahd_interpolate(); + imgdata.process_warnings |= LIBRAW_WARN_FALLBACK_TO_AHD; + } + SET_PROC_FLAG(LIBRAW_PROGRESS_INTERPOLATE); } @@ -2848,40 +3269,40 @@ if(!P1.is_foveon) { - if (P1.colors == 3) + if (P1.colors == 3) { - - if (quality == 8) + + if (quality == 8) { if (eeci_refine_fl == 1) refinement(); if (O.med_passes > 0) median_filter_new(); if (es_med_passes_fl > 0) es_median_filter(); - } + } else { median_filter(); } SET_PROC_FLAG(LIBRAW_PROGRESS_MEDIAN_FILTER); } } - - if (O.highlight == 2) + + if (O.highlight == 2) { blend_highlights(); SET_PROC_FLAG(LIBRAW_PROGRESS_HIGHLIGHTS); } - - if (O.highlight > 2) + + if (O.highlight > 2) { recover_highlights(); SET_PROC_FLAG(LIBRAW_PROGRESS_HIGHLIGHTS); } - - if (O.use_fuji_rotate) + + if (O.use_fuji_rotate) { fuji_rotate(); SET_PROC_FLAG(LIBRAW_PROGRESS_FUJI_ROTATE); } - + if(!libraw_internal_data.output_data.histogram) { libraw_internal_data.output_data.histogram = (int (*)[LIBRAW_HISTOGRAM_SIZE]) malloc(sizeof(*libraw_internal_data.output_data.histogram)*4); @@ -2898,7 +3319,7 @@ convert_to_rgb(); SET_PROC_FLAG(LIBRAW_PROGRESS_CONVERT_RGB); - if (O.use_fuji_rotate) + if (O.use_fuji_rotate) { stretch(); SET_PROC_FLAG(LIBRAW_PROGRESS_STRETCH); @@ -2913,10 +3334,11 @@ } // Supported cameras: -static const char *static_camera_list[] = +static const char *static_camera_list[] = { "Adobe Digital Negative (DNG)", "AgfaPhoto DC-833m", +"Alcatel 5035D", "Apple QuickTake 100", "Apple QuickTake 150", "Apple QuickTake 200", @@ -2928,6 +3350,8 @@ "AVT F-810C", "Baumer TXG14", "BlackMagic Cinema Camera", +"BlackMagic Pocket Cinema Camera", +"BlackMagic Production Camera 4k", "Canon PowerShot 600", "Canon PowerShot A5", "Canon PowerShot A5 Zoom", @@ -2935,6 +3359,7 @@ "Canon PowerShot A460 (CHDK hack)", "Canon PowerShot A470 (CHDK hack)", "Canon PowerShot A530 (CHDK hack)", +"Canon PowerShot A550 (CHDK hack)", "Canon PowerShot A570 (CHDK hack)", "Canon PowerShot A590 (CHDK hack)", "Canon PowerShot A610 (CHDK hack)", @@ -2944,16 +3369,20 @@ "Canon PowerShot A650 (CHDK hack)", "Canon PowerShot A710 IS (CHDK hack)", "Canon PowerShot A720 IS (CHDK hack)", +"Canon PowerShot A3300 IS (CHDK hack)", "Canon PowerShot Pro70", "Canon PowerShot Pro90 IS", "Canon PowerShot Pro1", "Canon PowerShot G1", "Canon PowerShot G1 X", +"Canon PowerShot G1 X Mark II", "Canon PowerShot G2", "Canon PowerShot G3", +"Canon PowerShot G3 X", "Canon PowerShot G5", "Canon PowerShot G6", "Canon PowerShot G7 (CHDK hack)", +"Canon PowerShot G7 X", "Canon PowerShot G9", "Canon PowerShot G10", "Canon PowerShot G11", @@ -2964,6 +3393,7 @@ "Canon PowerShot S3 IS (CHDK hack)", "Canon PowerShot S5 IS (CHDK hack)", "Canon PowerShot SD300 (CHDK hack)", +"Canon PowerShot SD950 (CHDK hack)", "Canon PowerShot S30", "Canon PowerShot S40", "Canon PowerShot S45", @@ -2977,6 +3407,7 @@ "Canon PowerShot S120", "Canon PowerShot SX1 IS", "Canon PowerShot SX50 HS", +"Canon PowerShot SX60 HS", "Canon PowerShot SX110 IS (CHDK hack)", "Canon PowerShot SX120 IS (CHDK hack)", "Canon PowerShot SX220 HS (CHDK hack)", @@ -2985,16 +3416,21 @@ "Canon EOS D30", "Canon EOS D60", "Canon EOS 5D", +"Canon EOS 5DS", +"Canon EOS 5DS R", "Canon EOS 5D Mark II", "Canon EOS 5D Mark III", "Canon EOS 6D", "Canon EOS 7D", +"Canon EOS 7D Mark II", "Canon EOS 10D", "Canon EOS 20D", +"Canon EOS 20Da", "Canon EOS 30D", "Canon EOS 40D", "Canon EOS 50D", "Canon EOS 60D", +"Canon EOS 60Da", "Canon EOS 70D", "Canon EOS 300D / Digital Rebel / Kiss Digital", "Canon EOS 350D / Digital Rebel XT / Kiss Digital N", @@ -3005,14 +3441,20 @@ "Canon EOS 600D / Digital Rebel T3i / Kiss Digital X5", "Canon EOS 650D / Digital Rebel T4i / Kiss Digital X6i", "Canon EOS 700D / Digital Rebel T5i", +"Canon EOS 750D / Digital Rebel T6i", +"Canon EOS 760D / Digital Rebel T6S", "Canon EOS 100D / Digital Rebel SL1", "Canon EOS 1000D / Digital Rebel XS / Kiss Digital F", "Canon EOS 1100D / Digital Rebel T3 / Kiss Digital X50", +"Canon EOS 1200D", "Canon EOS C500", "Canon EOS D2000C", "Canon EOS M", +"Canon EOS M2", +"Canon EOS M3", "Canon EOS-1D", "Canon EOS-1DS", +"Canon EOS-1D C", "Canon EOS-1D X", "Canon EOS-1D Mark II", "Canon EOS-1D Mark II N", @@ -3029,6 +3471,8 @@ "Casio QV-R51", "Casio QV-R61", "Casio EX-F1", +"Casio EX-FC300S", +"Casio EX-FC400S", "Casio EX-FH20", "Casio EX-FH25", "Casio EX-FH100", @@ -3044,16 +3488,35 @@ "Casio EX-Z8", "Casio EX-Z850", "Casio EX-Z1050", -"Casio EX-Z1080", "Casio EX-ZR100", +"Casio EX-Z1080", +"Casio EX-ZR700", +"Casio EX-ZR710", +"Casio EX-ZR750", +"Casio EX-ZR800", +"Casio EX-ZR850", +"Casio EX-ZR1000", +"Casio EX-ZR1100", +"Casio EX-ZR1200", +"Casio EX-ZR1300", +"Casio EX-ZR1500", +"Casio EX-ZR3000", +"Casio EX-100", +"Casio EX-100F", +"Casio EX-10", "Casio Exlim Pro 505", "Casio Exlim Pro 600", "Casio Exlim Pro 700", "Contax N Digital", "Creative PC-CAM 600", +"Digital Bolex D16", +"Digital Bolex D16M", +"DJI 4384x3288", "Epson R-D1", +"Epson R-D1s", +"Epson R-D1x", "Foculus 531C", -"FujiFilm E550", +"FujiFilm E505", "FujiFilm E900", "FujiFilm F700", "FujiFilm F710", @@ -3063,6 +3526,7 @@ "FujiFilm S3Pro", "FujiFilm S5Pro", "FujiFilm S20Pro", +"FujiFilm S1", "FujiFilm S100FS", "FujiFilm S5000", "FujiFilm S5100/S5500", @@ -3072,51 +3536,95 @@ "FujiFilm S9000/S9500", "FujiFilm S9100/S9600", "FujiFilm S200EXR", +"FujiFilm S205EXR", "FujiFilm SL1000", -"FujiFilm HS10/HS11", +"FujiFilm HS10", +"FujiFilm HS11", "FujiFilm HS20EXR", +"FujiFilm HS22EXR", "FujiFilm HS30EXR", +"FujiFilm HS33EXR", +"FujiFilm HS35EXR", "FujiFilm HS50EXR", +"FujiFilm F505EXR", "FujiFilm F550EXR", "FujiFilm F600EXR", +"FujiFilm F605EXR", "FujiFilm F770EXR", +"FujiFilm F775EXR", "FujiFilm F800EXR", +"FujiFilm F900EXR", "FujiFilm X-Pro1", "FujiFilm X-S1", "FujiFilm XQ1", +"FujiFilm XQ2", "FujiFilm X100", "FujiFilm X100S", +"FujiFilm X100T", "FujiFilm X10", "FujiFilm X20", +"FujiFilm X30", "FujiFilm X-A1", +"FujiFilm X-A2", "FujiFilm X-E1", "FujiFilm X-E2", "FujiFilm X-M1", "FujiFilm XF1", +"FujiFilm X-T1", +"FujiFilm X-T1 Graphite Silver", +"FujiFilm X-T10", "FujiFilm IS-1", +"Hasselblad H5D-60", +"Hasselblad H5D-50", +"Hasselblad H5D-50c", +"Hasselblad H5D-40", +"Hasselblad H4D-60", +"Hasselblad H4D-50", +"Hasselblad H4D-40", +"Hasselblad H4D-31", +"Hasselblad H3DII-22", +"Hasselblad H3DII-31", +"Hasselblad H3DII-39", +"Hasselblad H3DII-50", +"Hasselblad H3D-22", +"Hasselblad H3D-31", +"Hasselblad H3D-39", +"Hasselblad H2D-22", +"Hasselblad H2D-39", "Hasselblad CFV", "Hasselblad CFH", -"Hasselblad H2D", -"Hasselblad H3D", -"Hasselblad H4D", +"Hasselblad CF-22", +"Hasselblad CF-31", +"Hasselblad CF-39", "Hasselblad V96C", +"Hasselblad Lusso", "Hasselblad Lunar", "Hasselblad Stellar", -"Imacon Ixpress 16-megapixel", -"Imacon Ixpress 22-megapixel", -"Imacon Ixpress 39-megapixel", +"Hasselblad Stellar II", +"Hasselblad HV", +"HTC UltraPixel", +"Imacon Ixpress 96, 96C", +"Imacon Ixpress 384, 384C (single shot only)", +"Imacon Ixpress 132C", +"Imacon Ixpress 528C (single shot only)", "ISG 2020x1520", +"Ikonoskop A-Cam dII Panchromatic", +"Ikonoskop A-Cam dII", +"Kinefinity KineMINI", +"Kinefinity KineRAW Mini", +"Kinefinity KineRAW S35", "Kodak DC20", "Kodak DC25", "Kodak DC40", "Kodak DC50", -"Kodak DC120 (also try kdc2tiff)", +"Kodak DC120", "Kodak DCS200", "Kodak DCS315C", "Kodak DCS330C", "Kodak DCS420", "Kodak DCS460", "Kodak DCS460A", +"Kodak DCS460D", "Kodak DCS520C", "Kodak DCS560C", "Kodak DCS620C", @@ -3141,6 +3649,7 @@ "Kodak C603", "Kodak P850", "Kodak P880", +"Kodak S-1", "Kodak Z980", "Kodak Z981", "Kodak Z990", @@ -3167,6 +3676,7 @@ "Leaf CatchLight", "Leaf CMost", "Leaf Credo 40", +"Leaf Credo 50", "Leaf Credo 60", "Leaf Credo 80", "Leaf DCB2", @@ -3175,27 +3685,44 @@ "Leaf Valeo 17", "Leaf Valeo 22", "Leaf Volare", +"Lenovo a820", "Leica C (Typ 112)", "Leica Digilux 2", "Leica Digilux 3", +"Leica Digital-Modul-R", "Leica D-LUX2", "Leica D-LUX3", "Leica D-LUX4", "Leica D-LUX5", "Leica D-LUX6", +"Leica D-Lux (Typ 109)", "Leica M8", "Leica M8.2", "Leica M9", -"Leica M (Type 240)", +"Leica M (Typ 240)", +"Leica Monochrom (Typ 240)", +"Leica Monochrom (Typ 246)", +"Leica M-E", +"Leica M-P", +"Leica R8", +"Leica Q (Typ 116)", +"Leica S", "Leica S2", +//"Leica S3", +"Leica T (Typ 701)", "Leica X1", +"Leica X (Typ 113)", +"Leica X2", +"Leica X-E (Typ 102)", "Leica V-LUX1", "Leica V-LUX2", "Leica V-LUX3", "Leica V-LUX4", +"Leica V-Lux (Typ 114)", "Leica X VARIO (Typ 107)", "Logitech Fotoman Pixtura", "Mamiya ZD", +"Matrix 4608x3288", "Micron 2010", "Minolta RD175", "Minolta DiMAGE 5", @@ -3224,12 +3751,11 @@ "Nikon D3s", "Nikon D3X", "Nikon D4", +"Nikon D4s", "Nikon D40", "Nikon D40X", "Nikon D50", "Nikon D60", -"Nikon D600", -"Nikon D610", "Nikon D70", "Nikon D70s", "Nikon D80", @@ -3238,25 +3764,38 @@ "Nikon D200", "Nikon D300", "Nikon D300s", +"Nikon D600", +"Nikon D610", "Nikon D700", +"Nikon D750", +"Nikon D800", +"Nikon D800E", +"Nikon D810", +"Nikon D810A", "Nikon D3000", "Nikon D3100", "Nikon D3200", +"Nikon D3300", "Nikon D5000", "Nikon D5100", "Nikon D5200", "Nikon D5300", +"Nikon D5500", "Nikon D7000", "Nikon D7100", -"Nikon D800", -"Nikon D800E", +"Nikon D7200", +"Nikon Df", "Nikon 1 AW1", "Nikon 1 J1", "Nikon 1 J2", "Nikon 1 J3", +"Nikon 1 J4", +"Nikon 1 J5", "Nikon 1 S1", +"Nikon 1 S2", "Nikon 1 V1", "Nikon 1 V2", +"Nikon 1 V3", "Nikon E700 (\"DIAG RAW\" hack)", "Nikon E800 (\"DIAG RAW\" hack)", "Nikon E880 (\"DIAG RAW\" hack)", @@ -3278,19 +3817,23 @@ "Nikon E8800", "Nikon Coolpix A", "Nikon Coolpix P330", +"Nikon Coolpix P340", "Nikon Coolpix P6000", "Nikon Coolpix P7000", "Nikon Coolpix P7100", "Nikon Coolpix P7700", "Nikon Coolpix P7800", "Nikon Coolpix S6 (\"DIAG RAW\" hack)", +"Nikon Coolscan NEF", "Nokia N95", "Nokia X2", +"Nokia 1200x1600", "Nokia Lumia 1020", "Nokia Lumia 1520", +"Olympus AIR A01", "Olympus C3030Z", "Olympus C5050Z", -"Olympus C5060WZ", +"Olympus C5060Z", "Olympus C7070WZ", "Olympus C70Z,C7000Z", "Olympus C740UZ", @@ -3308,9 +3851,11 @@ "Olympus E-400", "Olympus E-410", "Olympus E-420", +"Olympus E-450", "Olympus E-500", "Olympus E-510", "Olympus E-520", +"Olympus E-600", "Olympus E-620", "Olympus E-P1", "Olympus E-P2", @@ -3321,9 +3866,14 @@ "Olympus E-PL2", "Olympus E-PL3", "Olympus E-PL5", +"Olympus E-PL6", +"Olympus E-PL7", "Olympus E-PM1", "Olympus E-PM2", +"Olympus E-M1", +"Olympus E-M10", "Olympus E-M5", +"Olympus E-M5 Mark II", "Olympus SP310", "Olympus SP320", "Olympus SP350", @@ -3331,12 +3881,17 @@ "Olympus SP510UZ", "Olympus SP550UZ", "Olympus SP560UZ", +"Olympus SP565UZ", "Olympus SP570UZ", "Olympus STYLUS1", +"Olympus STYLUS1s", +"Olympus SH-2", +"Olympus TG-4", "Olympus XZ-1", "Olympus XZ-2", "Olympus XZ-10", "OmniVision OV5647 (Raspberry Pi)", +"Panasonic DMC-CM1", "Panasonic DMC-FZ8", "Panasonic DMC-FZ18", "Panasonic DMC-FZ28", @@ -3344,9 +3899,13 @@ "Panasonic DMC-FZ35/FZ38", "Panasonic DMC-FZ40", "Panasonic DMC-FZ50", +"Panasonic DMC-FZ7", +"Panasonic DMC-FZ70", "Panasonic DMC-FZ100", "Panasonic DMC-FZ150", "Panasonic DMC-FZ200", +"Panasonic DMC-FZ300/330", +"Panasonic DMC-FZ1000", "Panasonic DMC-FX150", "Panasonic DMC-G1", "Panasonic DMC-G10", @@ -3354,17 +3913,25 @@ "Panasonic DMC-G3", "Panasonic DMC-G5", "Panasonic DMC-G6", +"Panasonic DMC-G7/G70", "Panasonic DMC-GF1", "Panasonic DMC-GF2", "Panasonic DMC-GF3", +//"Panasonic DMC-GF3KK", "Panasonic DMC-GF5", "Panasonic DMC-GF6", +"Panasonic DMC-GF7", "Panasonic DMC-GH1", "Panasonic DMC-GH2", "Panasonic DMC-GH3", +"Panasonic DMC-GH4", +"Panasonic AG-GH4", "Panasonic DMC-GM1", +"Panasonic DMC-GM1s", +"Panasonic DMC-GM5", "Panasonic DMC-GX1", "Panasonic DMC-GX7", +"Panasonic DMC-GX8", "Panasonic DMC-L1", "Panasonic DMC-L10", "Panasonic DMC-LC1", @@ -3374,20 +3941,27 @@ "Panasonic DMC-LX3", "Panasonic DMC-LX5", "Panasonic DMC-LX7", +"Panasonic DMC-LX100", +"Panasonic DMC-TZ60/61/SZ40", +"Panasonic DMC-TZ70/71/ZS50", "Pentax *ist D", "Pentax *ist DL", "Pentax *ist DL2", "Pentax *ist DS", "Pentax *ist DS2", +"Pentax GR", "Pentax K10D", "Pentax K20D", "Pentax K100D", "Pentax K100D Super", +"Pentax K110D", "Pentax K200D", "Pentax K2000/K-m", "Pentax K-x", "Pentax K-r", +"Pentax K-01", "Pentax K-3", +"Pentax K-3 II (std mode)", "Pentax K-30", "Pentax K-5", "Pentax K-5 II", @@ -3395,37 +3969,59 @@ "Pentax K-50", "Pentax K-500", "Pentax K-7", +"Pentax K-S1", +"Pentax K-S2", "Pentax MX-1", +"Pentax Q", "Pentax Q7", "Pentax Q10", +"Pentax QS-1", "Pentax Optio S", "Pentax Optio S4", "Pentax Optio 33WR", "Pentax Optio 750Z", "Pentax 645D", +"Pentax 645Z", "PhaseOne IQ140", "PhaseOne IQ160", "PhaseOne IQ180", +"PhaseOne IQ250", +"PhaseOne IQ260", +"PhaseOne IQ260 Achromatic", +"PhaseOne IQ280", "PhaseOne LightPhase", +"PhaseOne Achromatic+", "PhaseOne H 10", "PhaseOne H 20", "PhaseOne H 25", "PhaseOne P 20", +"PhaseOne P 20+", +"PhaseOne P 21", "PhaseOne P 25", +"PhaseOne P 25+", "PhaseOne P 30", +"PhaseOne P 30+", +"PhaseOne P 40+", "PhaseOne P 45", "PhaseOne P 45+", "PhaseOne P 65", "PhaseOne P 65+", +"Photron BC2-HD", "Pixelink A782", "Polaroid x530", +"Ricoh GR", "Ricoh GR Digital", "Ricoh GR Digital II", "Ricoh GR Digital III", -"Ricoh GR", +"Ricoh GR Digital IV", "Ricoh GX100", "Ricoh GX200", -"Ricoh GXR", +"Ricoh GXR MOUNT A12", +"Ricoh GXR MOUNT A16 24-85mm F3.5-5.5", +"Ricoh GXR, S10 24-72mm F2.5-4.4 VC", +"Ricoh GXR, GR A12 50mm F2.5 MACRO", +"Ricoh GXR, GR LENS A12 28mm F2.5", +"Ricoh GXR, GXR P10", #ifndef NO_JASPER "Redcode R3D format", #endif @@ -3433,30 +4029,40 @@ "RoverShot 3320af", "Samsung EX1", "Samsung EX2F", +"Samsung GX-1L", "Samsung GX-1S", "Samsung GX10", "Samsung GX20", "Samsung Galaxy NX (EK-GN120)", +"Samsung NX1", +"Samsung NX5", "Samsung NX10", "Samsung NX11", "Samsung NX100", +"Samsung NX1000", +"Samsung NX1100", "Samsung NX20", "Samsung NX200", "Samsung NX210", -"Samsung NX300", -"Samsung NX1000", -"Samsung NX1100", "Samsung NX2000", +"Samsung NX30", +"Samsung NX300", +"Samsung NX300M", +"Samsung NX3000", +"Samsung NX500", +"Samsung NX mini", "Samsung Pro815", "Samsung WB550", "Samsung WB2000", "Samsung S85 (hacked)", "Samsung S850 (hacked)", +"Samsung Galaxy S3", +"Samsung Galaxy Nexus", "Sarnoff 4096x5440", "Seitz 6x17", "Seitz Roundshot D3", "Seitz Roundshot D2X", -"Seitz Roundshot D2xs", +"Seitz Roundshot D2Xs", "Sigma SD9", "Sigma SD10", "Sigma SD14", @@ -3471,25 +4077,45 @@ "Sigma DP2 Merill", "Sigma DP2S", "Sigma DP2X", +"Sigma DP3 Merill", +"Sigma dp0 Quattro", +"Sigma dp1 Quattro", +"Sigma dp2 Quattro", +"Sigma dp3 Quattro", +"Sinar eMotion 22", +"Sinar eMotion 54", +"Sinar eSpirit 65", +"Sinar eMotion 75", +"Sinar eVolution 75", "Sinar 3072x2048", "Sinar 4080x4080", "Sinar 4080x5440", "Sinar STI format", -"Sinar Hy6", -"Sinar eSpirit", +"Sinar Sinarback 54", "SMaL Ultra-Pocket 3", "SMaL Ultra-Pocket 4", "SMaL Ultra-Pocket 5", -"Sony A3000", "Sony A7", +"Sony A7 II", "Sony A7R", +"Sony A7R II", +"Sony A7S", +"Sony ILCA-77M2 (A77-II)", +"Sony ILCE-3000", +"Sony ILCE-5000", +"Sony ILCE-5100", +"Sony ILCE-6000", +"Sony ILCE-QX1", "Sony DSC-F828", "Sony DSC-R1", "Sony DSC-RX1", "Sony DSC-RX1R", "Sony DSC-RX10", +"Sony DSC-RX10II", "Sony DSC-RX100", "Sony DSC-RX100II", +"Sony DSC-RX100III", +"Sony DSC-RX100IV", "Sony DSC-V3", "Sony DSLR-A100", "Sony DSLR-A200", @@ -3503,6 +4129,7 @@ "Sony DSLR-A450", "Sony DSLR-A500", "Sony DSLR-A550", +"Sony DSLR-A560", "Sony DSLR-A580", "Sony DSLR-A700", "Sony DSLR-A850", @@ -3517,6 +4144,9 @@ "Sony NEX-7", "Sony NEX-C3", "Sony NEX-F3", +"Sony NEX-VG20", +"Sony NEX-VG30", +"Sony NEX-VG900", "Sony SLT-A33", "Sony SLT-A35", "Sony SLT-A37", @@ -3527,6 +4157,9 @@ "Sony SLT-A77V", "Sony SLT-A99V", "Sony XCD-SX910CR", +"Sony IMX135-mipi 13mp", +"Sony IMX135-QCOM", +"Sony IMX072-mipi", "STV680 VGA", "ptGrey GRAS-50S5C", "JaiPulnix BB-500CL", @@ -3613,7 +4246,32 @@ return buffer; } - +static void *lr_memmem(const void *l, size_t l_len, const void *s, size_t s_len) +{ + register char *cur, *last; + const char *cl = (const char *)l; + const char *cs = (const char *)s; + + /* we need something to compare */ + if (l_len == 0 || s_len == 0) + return NULL; + + /* "s" must be smaller or equal to "l" */ + if (l_len < s_len) + return NULL; + + /* special case where s_len == 1 */ + if (s_len == 1) + return (void*)memchr(l, (int)*cs, l_len); + + /* the last position where its possible to find "s" in "l" */ + last = (char *)cl + l_len - s_len; + + for (cur = (char *)cl; cur <= last; cur++) + if (cur[0] == cs[0] && memcmp(cur, cs, s_len) == 0) + return cur; + return NULL; +} void LibRaw::parse_x3f() { @@ -3636,41 +4294,105 @@ imgdata.sizes.raw_height = ID->rows; // Parse other params from property section DE = x3f_get_prop(x3f); - if(! (x3f_load_data(x3f,DE) == X3F_OK)) - return; - DEH = &DE->header; - x3f_property_list_t *PL = &DEH->data_subsection.property_list; - if (PL->property_table.size != 0) { - int i; - x3f_property_t *P = PL->property_table.element; - for (i=0; inum_properties; i++) { - char name[100], value[100]; - utf2char(P[i].name,name); - utf2char(P[i].value,value); - if (!strcmp (name, "ISO")) - imgdata.other.iso_speed = atoi(value); - if (!strcmp (name, "CAMMANUF")) - strcpy (imgdata.idata.make, value); - if (!strcmp (name, "CAMMODEL")) - strcpy (imgdata.idata.model, value); - if (!strcmp (name, "WB_DESC")) - strcpy (imgdata.color.model2, value); - if (!strcmp (name, "TIME")) - imgdata.other.timestamp = atoi(value); - if (!strcmp (name, "EXPTIME")) - imgdata.other.shutter = atoi(value) / 1000000.0; - if (!strcmp (name, "APERTURE")) - imgdata.other.aperture = atof(value); - if (!strcmp (name, "FLENGTH")) - imgdata.other.focal_len = atof(value); - } - imgdata.idata.raw_count=1; - load_raw = &LibRaw::x3f_load_raw; - imgdata.sizes.raw_pitch = imgdata.sizes.raw_width*6; - imgdata.idata.is_foveon = 1; - libraw_internal_data.internal_output_params.raw_color=1; // Force adobe coeff - imgdata.color.maximum=0x3fff; // To be reset by color table - libraw_internal_data.unpacker_data.order = 0x4949; + if((x3f_load_data(x3f,DE) == X3F_OK)) + { + // Parse property list + DEH = &DE->header; + x3f_property_list_t *PL = &DEH->data_subsection.property_list; + if (PL->property_table.size != 0) { + int i; + x3f_property_t *P = PL->property_table.element; + for (i=0; inum_properties; i++) { + char name[100], value[100]; + utf2char(P[i].name,name); + utf2char(P[i].value,value); + if (!strcmp (name, "ISO")) + imgdata.other.iso_speed = atoi(value); + if (!strcmp (name, "CAMMANUF")) + strcpy (imgdata.idata.make, value); + if (!strcmp (name, "CAMMODEL")) + strcpy (imgdata.idata.model, value); + if (!strcmp (name, "WB_DESC")) + strcpy (imgdata.color.model2, value); + if (!strcmp (name, "TIME")) + imgdata.other.timestamp = atoi(value); + if (!strcmp (name, "SHUTTER")) + imgdata.other.shutter = atof(value); + if (!strcmp (name, "APERTURE")) + imgdata.other.aperture = atof(value); + if (!strcmp (name, "FLENGTH")) + imgdata.other.focal_len = atof(value); + if (!strcmp (name, "FLEQ35MM")) + imgdata.lens.makernotes.FocalLengthIn35mmFormat = atof(value); + if (!strcmp (name, "LENSARANGE")) + { + char *sp; + imgdata.lens.makernotes.MaxAp4CurFocal = imgdata.lens.makernotes.MinAp4CurFocal = atof(value); + sp = strrchr (value, ' '); + if (sp) + { + imgdata.lens.makernotes.MinAp4CurFocal = atof(sp); + if (imgdata.lens.makernotes.MaxAp4CurFocal > imgdata.lens.makernotes.MinAp4CurFocal) + my_swap (float, imgdata.lens.makernotes.MaxAp4CurFocal, imgdata.lens.makernotes.MinAp4CurFocal); + } + } + if (!strcmp (name, "LENSFRANGE")) + { + char *sp; + imgdata.lens.makernotes.MinFocal = imgdata.lens.makernotes.MaxFocal = atof(value); + sp = strrchr (value, ' '); + if (sp) + { + imgdata.lens.makernotes.MaxFocal = atof(sp); + if ((imgdata.lens.makernotes.MaxFocal + 0.17f) < imgdata.lens.makernotes.MinFocal) + my_swap (float, imgdata.lens.makernotes.MaxFocal, imgdata.lens.makernotes.MinFocal); + } + } + if (!strcmp (name, "LENSMODEL")) + { + imgdata.lens.makernotes.LensID = atoi(value); + if (imgdata.lens.makernotes.LensID) + imgdata.lens.makernotes.LensMount = Sigma_X3F; + } + } + imgdata.idata.raw_count=1; + load_raw = &LibRaw::x3f_load_raw; + imgdata.sizes.raw_pitch = imgdata.sizes.raw_width*6; + imgdata.idata.is_foveon = 1; + libraw_internal_data.internal_output_params.raw_color=1; // Force adobe coeff + imgdata.color.maximum=0x3fff; // To be reset by color table + libraw_internal_data.unpacker_data.order = 0x4949; + } + } + else + { + // No property list + if(imgdata.sizes.raw_width == 5888 ||imgdata.sizes.raw_width == 2944 ) // dp2Q + { + imgdata.idata.raw_count=1; + load_raw = &LibRaw::x3f_load_raw; + imgdata.sizes.raw_pitch = imgdata.sizes.raw_width*6; + imgdata.idata.is_foveon = 1; + libraw_internal_data.internal_output_params.raw_color=1; // Force adobe coeff + libraw_internal_data.unpacker_data.order = 0x4949; + strcpy (imgdata.idata.make, "SIGMA"); +#if 1 + // Try to find model number in first 2048 bytes; + int pos = libraw_internal_data.internal_data.input->tell(); + libraw_internal_data.internal_data.input->seek(0,SEEK_SET); + unsigned char buf[2048]; + libraw_internal_data.internal_data.input->read(buf,2048,1); + libraw_internal_data.internal_data.input->seek(pos,SEEK_SET); + unsigned char *fnd=(unsigned char*)lr_memmem(buf,2048,"SIGMA dp",8); + if(fnd) + { + unsigned char *nm = fnd+8; + snprintf(imgdata.idata.model,64,"dp%c Quattro",*nm<='9' && *nm >='0' ? *nm: '2'); + } + else +#endif + strcpy (imgdata.idata.model, "dp2 Quattro"); + } } // Try to get thumbnail data LibRaw_thumbnail_formats format = LIBRAW_THUMBNAIL_UNKNOWN; @@ -3723,16 +4445,103 @@ imgdata.thumbnail.tlength = ID->columns * ID->rows * 3; imgdata.thumbnail.thumb = (char*)malloc(ID->columns * ID->rows * 3); merror(imgdata.thumbnail.thumb,"LibRaw::x3f_thumb_loader()"); - char *src0 = (char*)ID->data; + char *src0 = (char*)ID->data; for(int row = 0; row < ID->rows;row++) { + int offset = row * ID->row_stride; + if (offset + ID->columns * 3 > ID->data_size) + break; char *dest = &imgdata.thumbnail.thumb[row*ID->columns*3]; - char *src = &src0[row * ID->row_stride]; + char *src = &src0[offset]; memmove(dest,src,ID->columns*3); } } } +static inline uint32_t _clampbits(int x, uint32_t n) { + uint32_t _y_temp; + if( (_y_temp=x>>n) ) + x = ~_y_temp >> (32-n); + return x; +} + +void LibRaw::x3f_dpq_interpolate_rg() +{ + int w = imgdata.sizes.raw_width/2; + int h = imgdata.sizes.raw_height/2; + unsigned short *image = (ushort*)imgdata.rawdata.color3_image; + + for (int color = 0; color < 2; color++) + { + for (int y = 2; y < (h-2); y++) + { + uint16_t* row0 = &image[imgdata.sizes.raw_width*3*(y*2)+color]; // dst[1] + uint16_t row0_3 = row0[3]; + uint16_t* row1 = &image[imgdata.sizes.raw_width*3*(y*2+1)+color]; //dst1[1] + uint16_t row1_3 = row1[3]; + for (int x = 2; x < (w-2); x++) + { + row1[0]=row1[3]=row0[3]=row0[0]; + row0 += 6; + row1 += 6; + } + } + } +} + +#define _ABS(a) ((a)<0?-(a):(a)) + +#undef CLIP +#define CLIP(value,high) ((value)>(high)?(high):(value)) + +void LibRaw::x3f_dpq_interpolate_af(int xstep, int ystep, int scale) +{ + unsigned short *image = (ushort*)imgdata.rawdata.color3_image; + unsigned int rowpitch = imgdata.rawdata.sizes.raw_pitch/2; // in 16-bit words + // Interpolate single pixel + for(int y = 0; y < imgdata.rawdata.sizes.height+imgdata.rawdata.sizes.top_margin; y+=ystep) + { + if(yimgdata.rawdata.sizes.raw_height-scale) break; + uint16_t* row0 = &image[imgdata.sizes.raw_width*3*y]; // Наша строка + uint16_t* row_minus = &image[imgdata.sizes.raw_width*3*(y-scale)]; // Строка выше + uint16_t* row_plus = &image[imgdata.sizes.raw_width*3*(y+scale)]; // Строка ниже + for(int x = 0; x < imgdata.rawdata.sizes.width+imgdata.rawdata.sizes.left_margin; x+= xstep) + { + if(ximgdata.rawdata.sizes.raw_width-scale) break; + uint16_t* pixel0 = &row0[x*3]; + uint16_t* pixel_top = &row_minus[x*3]; + uint16_t* pixel_bottom = &row_plus[x*3]; + uint16_t* pixel_left = &row0[(x-scale)*3]; + uint16_t* pixel_right = &row0[(x+scale)*3]; + uint16_t* pixf = pixel_top; + if(_ABS(pixf[2]-pixel0[2])>_ABS(pixel_bottom[2]-pixel0[2])) + pixf = pixel_bottom; + if(_ABS(pixf[2]-pixel0[2])>_ABS(pixel_left[2]-pixel0[2])) + pixf = pixel_left; + if(_ABS(pixf[2]-pixel0[2])>_ABS(pixel_right[2]-pixel0[2])) + pixf = pixel_right; + int blocal = pixel0[2],bnear = pixf[2]; + if(blocal < imgdata.color.black+16 || bnear < imgdata.color.black+16 ) + { + pixel0[0] = CLIP((pixel0[0] - imgdata.color.black)*4 + imgdata.color.black,16383); + pixel0[1] = CLIP((pixel0[1] - imgdata.color.black)*4 + imgdata.color.black,16383); + } + else + { + float multip = float(bnear - imgdata.color.black)/float(blocal-imgdata.color.black); + pixel0[0] = CLIP(((float(pixf[0]-imgdata.color.black)*multip + imgdata.color.black)+((pixel0[0]-imgdata.color.black)*3.75 + imgdata.color.black))/2,16383); + pixel0[1] = CLIP(((float(pixf[1]-imgdata.color.black)*multip + imgdata.color.black)+((pixel0[1]-imgdata.color.black)*3.75 + imgdata.color.black))/2,16383); + //pixel0[1] = float(pixf[1]-imgdata.color.black)*multip + imgdata.color.black; + } + } + } +} + + void LibRaw::x3f_load_raw() { int raise_error=0; @@ -3755,13 +4564,37 @@ data = HUF->x3rgb16.element; if (TRU != NULL) data = TRU->x3rgb16.element; - if (data == NULL) + if (data == NULL) { raise_error = 1; goto end; } imgdata.rawdata.color3_image = (ushort (*)[3])data; - } + + if(!strcasecmp(imgdata.idata.make,"Sigma") + && !strncasecmp(imgdata.idata.model,"dp",2) && !strncasecmp(imgdata.idata.model+4,"Quattro",7) + && (imgdata.params.x3f_flags & LIBRAW_DP2Q_INTERPOLATEAF) + ) + { + if(imgdata.sizes.raw_width == 5888) + { + x3f_dpq_interpolate_af(32,8,2); + } + if(imgdata.sizes.raw_width == 2944) + { + x3f_dpq_interpolate_af(16,4,1); + } + } + + if(!strcasecmp(imgdata.idata.make,"Sigma") + && !strncasecmp(imgdata.idata.model,"dp",2) && !strncasecmp(imgdata.idata.model+4,"Quattro",7) + && (imgdata.params.x3f_flags & LIBRAW_DP2Q_INTERPOLATERG) + && (imgdata.sizes.raw_width== 5888) + ) + x3f_dpq_interpolate_rg(); + + + } else raise_error = 1; end: diff -Nru libraw-0.16.2/src/libraw_datastream.cpp libraw-0.17.0/src/libraw_datastream.cpp --- libraw-0.16.2/src/libraw_datastream.cpp 2015-05-16 12:32:15.000000000 +0000 +++ libraw-0.17.0/src/libraw_datastream.cpp 2015-08-15 13:10:27.000000000 +0000 @@ -1,6 +1,6 @@ /* -*- C++ -*- * File: libraw_datastream.cpp - * Copyright 2008-2013 LibRaw LLC (info@libraw.org) + * Copyright 2008-2015 LibRaw LLC (info@libraw.org) * * LibRaw C++ interface (implementation) @@ -122,9 +122,9 @@ /* Visual Studio 2008 marks sgetn as insecure, but VS2010 does not. */ #if defined(WIN32SECURECALLS) && (_MSC_VER < 1600) - LR_STREAM_CHK(); return int(f->_Sgetn_s(static_cast(ptr), nmemb * size,nmemb * size) / size); + LR_STREAM_CHK(); return int(f->_Sgetn_s(static_cast(ptr), nmemb * size,nmemb * size) / (size>0?size:1)); #else - LR_STREAM_CHK(); return int(f->sgetn(static_cast(ptr), std::streamsize(nmemb * size)) / size); + LR_STREAM_CHK(); return int(f->sgetn(static_cast(ptr), std::streamsize(nmemb * size)) / (size>0?size:1)); #endif } @@ -306,7 +306,7 @@ return 0; memmove(ptr,buf+streampos,to_read); streampos+=to_read; - return int((to_read+sz-1)/sz); + return int((to_read+sz-1)/(sz>0?sz:1)); } int LibRaw_buffer_datastream::seek(INT64 o, int whence) diff -Nru libraw-0.16.2/version.sh libraw-0.17.0/version.sh --- libraw-0.16.2/version.sh 2015-05-16 12:32:15.000000000 +0000 +++ libraw-0.17.0/version.sh 2015-08-15 13:10:27.000000000 +0000 @@ -8,9 +8,9 @@ tail=`grep LIBRAW_VERSION_TAIL $vfile | head -1 | awk '{print $3}'` if [ x$tail = xRelease ] ; then - echo -n "$major.$minor.$patch" + echo "$major.$minor.$patch" | awk '{printf $1}' else - echo -n "$major.$minor.$patch-$tail" + echo "$major.$minor.$patch-$tail" | awk '{printf $1}' fi