AP RAW Converter
Copyright (C) 2026 AP Product Lab (https://approductlab.com)

AP RAW Converter 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 3 of the License, 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.
The licence text is in the file LICENSE (LICENSE.txt in the binary distribution).


Additional permission under GNU GPL version 3 section 7
-------------------------------------------------------

If you modify this Program, or any covered work, by linking or combining it with OpenCV or OpenCvSharp (or a
modified version of those libraries) containing the Intel(R) Integrated Performance Primitives library (Intel IPP /
IPP ICV), covered by the terms of the Intel Simplified Software License, the licensors of this Program grant you
additional permission to convey the resulting work.

(The OpenCvSharp4.runtime.win package used for HDR / panorama alignment and auto perspective contains OpenCV built with
Intel IPP, which Intel distributes in binary form only.)


Two programs
------------

The distribution contains two separate programs:

1. AP RAW Converter - APRawConverter.exe (application), apraw.exe (command line) and the libraries next to them.
   Licence: GPL-3.0-or-later with the additional permission above.

2. apraw-heifenc - apraw-heifenc.exe with libheif.dll, libde265.dll, libx265.dll and aom.dll: the HEVC encoder for
   HEIC export. Licence: GPL-3.0-or-later (it contains x265, GPL-2.0-or-later, and libheif / libde265, LGPL-3.0).

AP RAW Converter starts apraw-heifenc.exe as a separate process and exchanges only image data with it: RGB pixels
go to its standard input, finished HEIC files come back from its standard output. x265 is never loaded into the
AP RAW Converter process, which contains Intel IPP: the GPL of x265 does not allow combining x265 and Intel IPP in
one program. Anyone modifying the code must keep it that way (do not load libheif or x265 into ApRaw.Core).

apraw-heifenc.exe and its four DLLs may be deleted; HEIC export then uses the Windows HEIF encoder (Microsoft
Store "HEIF Image Extensions" and "HEVC Video Extensions") without a quality setting.


Source code
-----------

The complete source code of both programs (Visual Studio / .NET 10 solution, build scripts included) is published
with every binary release as APRawConverter-<version>-source.zip, next to the binary package. It can be built with
"dotnet publish" as described in README.md; tools\make-release.ps1 produces both packages.

The licences of all third-party components and where to get their source code are listed in
licenses\THIRD-PARTY-NOTICES.txt. The source archives of the components under the GPL and LGPL (x265, libheif,
libde265, LibRaw and the vcpkg build recipes they were built with) are published next to each release in the folder
third-party-sources (created by "tools\make-release.ps1 -ThirdPartySources").


Patents
-------

HEVC (HEIC) and AV1 are covered by patents. The GPL does not grant licences for patents of third parties; whether
a patent licence is needed to use or distribute an HEVC encoder depends on your country and use.

Some image processing methods implemented in AP RAW Converter are or were patented in some countries (status checked
in November 2026, not legal advice):
  * Malvar-He-Cutler demosaicing - US 7,502,505 (Microsoft), in force until 25 January 2027. Not implemented for
    that reason (older settings that selected it are developed with RCD).
  * Automatic upright / perspective adjustment from vanishing points - Adobe holds US 9,008,460 and US 9,519,954
    (until 2033) on a related method; the scope of their claims has not been checked against the auto perspective
    function of this program.
  * Dark channel prior dehazing - US 8,340,461 (Microsoft) lapsed in 2020 (maintenance fee not paid).
  * SIFT - US 6,711,293 expired in 2020. Non-local means - EP 1,749,278 has expired.


Algorithms and credits
----------------------

AP RAW Converter's own code implements published methods. No source code of the projects named below is included.
  * RCD demosaicing (Ratio Corrected Demosaicing) by Luis Sanz Rodriguez.
  * Non-local means denoising: A. Buades, B. Coll, J.-M. Morel, CVPR 2005.
  * Guided filter and dark channel prior: K. He, J. Sun, X. Tang (ECCV 2010, CVPR 2009).
  * Oklab / OkLCh colour space: Bjorn Ottosson (2020).
  * Lens correction models (poly3, poly5, ptlens distortion, linear / poly3 lateral CA, pa vignetting) and their
    coordinate conventions follow the lensfun project (https://lensfun.github.io).
  * "Blend" highlight recovery follows the idea of dcraw by Dave Coffin.
  * Auto perspective: line segments with OpenCV's LSD (R. Grompone von Gioi et al.), vanishing points with RANSAC.
  * HDR / panorama registration: SIFT (D. Lowe), RANSAC, ECC image alignment (G. Evangelidis, E. Psarakis);
    panorama pipeline after M. Brown and D. Lowe, "Automatic Panoramic Image Stitching using Invariant Features".
  * Gain map formats: Adobe Gain Map specification (hdrgm), ISO 21496-1, Google Ultra HDR (JPEG + MPF).


Trademarks
----------

The film simulations are AP RAW Converter's own colour looks, made to resemble the general character of the named
films; they are not measured from the films and are not produced, approved or endorsed by the film manufacturers.
Portra, Ektar, Gold, UltraMax, ColorPlus, Ektachrome, Kodachrome, Tri-X and T-Max are trademarks of Eastman Kodak
Company or Kodak Alaris; Fujicolor, Superia, Pro 400H, Velvia, Provia, Astia and Acros of FUJIFILM Corporation;
HP5 Plus, FP4 Plus, Delta and Pan F Plus of Harman Technology (Ilford Photo); CineStill of CineStill Film;
Lomography of Lomographische AG; Vista (AgfaPhoto) of its owner. Instagram is a trademark of Meta Platforms;
iPhone and Mac of Apple Inc.; Ultra HDR is Google's name for its gain map JPEG format; camera and lens names belong
to their manufacturers. All trademarks are the property of their owners and are used only to
describe compatibility or the look being imitated. AP RAW Converter is not affiliated with any of these companies.
