rawloader-0.37.1/.cargo_vcs_info.json0000644000000001360000000000100131040ustar { "git": { "sha1": "c718175883f0e62b531e6b000f9389c14caf8fec" }, "path_in_vcs": "" }rawloader-0.37.1/.gitignore000064400000000000000000000000220072674642500137060ustar 00000000000000target Cargo.lock rawloader-0.37.1/.travis.yml000064400000000000000000000005350072674642500140400ustar 00000000000000language: rust rust: - stable - beta - nightly matrix: allow_failures: - rust: nightly notifications: email: recipients: - pedro@pedrocr.net on_success: change on_failure: always irc: channels: - "irc.libera.chat#chimper" on_success: change on_failure: always skip_join: true if: tag IS blank rawloader-0.37.1/Cargo.lock0000644000000136610000000000100110660ustar # This file is automatically @generated by Cargo. # It is not intended for manual editing. version = 3 [[package]] name = "autocfg" version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" [[package]] name = "byteorder" version = "1.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" [[package]] name = "cfg-if" version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "crossbeam-channel" version = "0.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5aaa7bd5fb665c6864b5f963dd9097905c54125909c7aa94c9e18507cdbe6c53" dependencies = [ "cfg-if", "crossbeam-utils", ] [[package]] name = "crossbeam-deque" version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6455c0ca19f0d2fbf751b908d5c55c1f5cbc65e03c4225427254b46890bdde1e" dependencies = [ "cfg-if", "crossbeam-epoch", "crossbeam-utils", ] [[package]] name = "crossbeam-epoch" version = "0.9.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1145cf131a2c6ba0615079ab6a638f7e1973ac9c2634fcbeaaad6114246efe8c" dependencies = [ "autocfg", "cfg-if", "crossbeam-utils", "lazy_static", "memoffset", "scopeguard", ] [[package]] name = "crossbeam-utils" version = "0.8.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0bf124c720b7686e3c2663cf54062ab0f68a88af2fb6a030e87e30bf721fcb38" dependencies = [ "cfg-if", "lazy_static", ] [[package]] name = "either" version = "1.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457" [[package]] name = "enumn" version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4e58b112d5099aa0857c5d05f0eacab86406dd8c0f85fe5d320a13256d29ecf4" dependencies = [ "proc-macro2", "quote", "syn", ] [[package]] name = "glob" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574" [[package]] name = "hermit-abi" version = "0.1.19" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" dependencies = [ "libc", ] [[package]] name = "lazy_static" version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" version = "0.2.123" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cb691a747a7ab48abc15c5b42066eaafde10dc427e3b6ee2a1cf43db04c763bd" [[package]] name = "memoffset" version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5aa361d4faea93603064a027415f07bd8e1d5c88c9fbf68bf56a285428fd79ce" dependencies = [ "autocfg", ] [[package]] name = "num_cpus" version = "1.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "19e64526ebdee182341572e50e9ad03965aa510cd94427a4549448f285e957a1" dependencies = [ "hermit-abi", "libc", ] [[package]] name = "proc-macro2" version = "1.0.37" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec757218438d5fda206afc041538b2f6d889286160d649a86a24d37e1235afd1" dependencies = [ "unicode-xid", ] [[package]] name = "quote" version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a1feb54ed693b93a84e14094943b84b7c4eae204c512b7ccb95ab0c66d278ad1" dependencies = [ "proc-macro2", ] [[package]] name = "rawloader" version = "0.37.1" dependencies = [ "byteorder", "enumn", "glob", "lazy_static", "rayon", "rustc_version", "toml", ] [[package]] name = "rayon" version = "1.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fd249e82c21598a9a426a4e00dd7adc1d640b22445ec8545feef801d1a74c221" dependencies = [ "autocfg", "crossbeam-deque", "either", "rayon-core", ] [[package]] name = "rayon-core" version = "1.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9f51245e1e62e1f1629cbfec37b5793bbabcaeb90f30e94d2ba03564687353e4" dependencies = [ "crossbeam-channel", "crossbeam-deque", "crossbeam-utils", "num_cpus", ] [[package]] name = "rustc_version" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" dependencies = [ "semver", ] [[package]] name = "scopeguard" version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" [[package]] name = "semver" version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d65bd28f48be7196d222d95b9243287f48d27aca604e08497513019ff0502cc4" [[package]] name = "serde" version = "1.0.136" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ce31e24b01e1e524df96f1c2fdd054405f8d7376249a5110886fb4b658484789" [[package]] name = "syn" version = "1.0.91" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b683b2b825c8eef438b77c36a06dc262294da3d5a5813fac20da149241dcd44d" dependencies = [ "proc-macro2", "quote", "unicode-xid", ] [[package]] name = "toml" version = "0.5.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8d82e1a7758622a465f8cee077614c73484dac5b836c02ff6a40d5d1010324d7" dependencies = [ "serde", ] [[package]] name = "unicode-xid" version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3" rawloader-0.37.1/Cargo.toml0000644000000024630000000000100111070ustar # THIS FILE IS AUTOMATICALLY GENERATED BY CARGO # # When uploading crates to the registry Cargo will automatically # "normalize" Cargo.toml files for maximal compatibility # with all versions of Cargo and also rewrite `path` dependencies # to registry (e.g., crates.io) dependencies. # # If you are reading this file be aware that the original Cargo.toml # will likely look very different (and much more reasonable). # See Cargo.toml.orig for the original contents. [package] edition = "2018" name = "rawloader" version = "0.37.1" authors = ["Pedro Côrte-Real "] build = "data/cameras/join.rs" description = "A library to extract the data from camera raw formats" documentation = "https://docs.rs/rawloader/" categories = ["multimedia::images"] license = "LGPL-2.1" repository = "https://github.com/pedrocr/rawloader" [profile.dev] opt-level = 3 panic = "unwind" [profile.release] panic = "unwind" [[bin]] name = "benchmark" doc = false [[bin]] name = "identify" doc = false [dependencies.byteorder] version = "1" [dependencies.enumn] version = "0.1" [dependencies.lazy_static] version = "1" [dependencies.rayon] version = "1" [dependencies.toml] version = "0.5" [build-dependencies.glob] version = "0.3" [build-dependencies.rustc_version] version = "0.4" [build-dependencies.toml] version = "0.5" rawloader-0.37.1/Cargo.toml.orig000064400000000000000000000013070072674642500146140ustar 00000000000000[package] name = "rawloader" version = "0.37.1" authors = ["Pedro Côrte-Real "] description = "A library to extract the data from camera raw formats" documentation = "https://docs.rs/rawloader/" #homepage = "..." repository = "https://github.com/pedrocr/rawloader" license = "LGPL-2.1" categories = ["multimedia::images"] edition = "2018" build = "data/cameras/join.rs" [dependencies] toml = "0.5" enumn = "0.1" lazy_static = "1" byteorder = "1" rayon = "1" [build-dependencies] glob = "0.3" toml = "0.5" rustc_version = "0.4" [profile.release] panic = "unwind" [profile.dev] panic = "unwind" opt-level = 3 [[bin]] name = "benchmark" doc = false [[bin]] name = "identify" doc = false rawloader-0.37.1/LICENSE000064400000000000000000000635120072674642500127400ustar 00000000000000GNU LESSER GENERAL PUBLIC LICENSE Version 2.1, February 1999 Copyright (C) 1991, 1999 Free Software Foundation, Inc. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. (This is the first released version of the Lesser GPL. It also counts as the successor of the GNU Library Public License, version 2, hence the version number 2.1.) Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public Licenses are intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This license, the Lesser General Public License, applies to some specially designated software packages--typically libraries--of the Free Software Foundation and other authors who decide to use it. You can use it too, but we suggest you first think carefully about whether this license or the ordinary General Public License is the better strategy to use in any particular case, based on the explanations below. When we speak of free software, we are referring to freedom of use, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish); that you receive source code or can get it if you want it; that you can change the software and use pieces of it in new free programs; and that you are informed that you can do these things. To protect your rights, we need to make restrictions that forbid distributors to deny you these rights or to ask you to surrender these rights. These restrictions translate to certain responsibilities for you if you distribute copies of the library or if you modify it. For example, if you distribute copies of the library, whether gratis or for a fee, you must give the recipients all the rights that we gave you. You must make sure that they, too, receive or can get the source code. If you link other code with the library, you must provide complete object files to the recipients, so that they can relink them with the library after making changes to the library and recompiling it. And you must show them these terms so they know their rights. We protect your rights with a two-step method: (1) we copyright the library, and (2) we offer you this license, which gives you legal permission to copy, distribute and/or modify the library. To protect each distributor, we want to make it very clear that there is no warranty for the free library. Also, if the library is modified by someone else and passed on, the recipients should know that what they have is not the original version, so that the original author's reputation will not be affected by problems that might be introduced by others. Finally, software patents pose a constant threat to the existence of any free program. We wish to make sure that a company cannot effectively restrict the users of a free program by obtaining a restrictive license from a patent holder. Therefore, we insist that any patent license obtained for a version of the library must be consistent with the full freedom of use specified in this license. Most GNU software, including some libraries, is covered by the ordinary GNU General Public License. This license, the GNU Lesser General Public License, applies to certain designated libraries, and is quite different from the ordinary General Public License. We use this license for certain libraries in order to permit linking those libraries into non-free programs. When a program is linked with a library, whether statically or using a shared library, the combination of the two is legally speaking a combined work, a derivative of the original library. The ordinary General Public License therefore permits such linking only if the entire combination fits its criteria of freedom. The Lesser General Public License permits more lax criteria for linking other code with the library. We call this license the "Lesser" General Public License because it does Less to protect the user's freedom than the ordinary General Public License. It also provides other free software developers Less of an advantage over competing non-free programs. These disadvantages are the reason we use the ordinary General Public License for many libraries. However, the Lesser license provides advantages in certain special circumstances. For example, on rare occasions, there may be a special need to encourage the widest possible use of a certain library, so that it becomes a de-facto standard. To achieve this, non-free programs must be allowed to use the library. A more frequent case is that a free library does the same job as widely used non-free libraries. In this case, there is little to gain by limiting the free library to free software only, so we use the Lesser General Public License. In other cases, permission to use a particular library in non-free programs enables a greater number of people to use a large body of free software. For example, permission to use the GNU C Library in non-free programs enables many more people to use the whole GNU operating system, as well as its variant, the GNU/Linux operating system. Although the Lesser General Public License is Less protective of the users' freedom, it does ensure that the user of a program that is linked with the Library has the freedom and the wherewithal to run that program using a modified version of the Library. The precise terms and conditions for copying, distribution and modification follow. Pay close attention to the difference between a "work based on the library" and a "work that uses the library". The former contains code derived from the library, whereas the latter must be combined with the library in order to run. GNU LESSER GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any software library or other program which contains a notice placed by the copyright holder or other authorized party saying it may be distributed under the terms of this Lesser General Public License (also called "this License"). Each licensee is addressed as "you". A "library" means a collection of software functions and/or data prepared so as to be conveniently linked with application programs (which use some of those functions and data) to form executables. The "Library", below, refers to any such software library or work which has been distributed under these terms. A "work based on the Library" means either the Library or any derivative work under copyright law: that is to say, a work containing the Library or a portion of it, either verbatim or with modifications and/or translated straightforwardly into another language. (Hereinafter, translation is included without limitation in the term "modification".) "Source code" for a work means the preferred form of the work for making modifications to it. For a library, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the library. Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running a program using the Library is not restricted, and output from such a program is covered only if its contents constitute a work based on the Library (independent of the use of the Library in a tool for writing it). Whether that is true depends on what the Library does and what the program that uses the Library does. 1. You may copy and distribute verbatim copies of the Library's complete source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and distribute a copy of this License along with the Library. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Library or any portion of it, thus forming a work based on the Library, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) The modified work must itself be a software library. b) You must cause the files modified to carry prominent notices stating that you changed the files and the date of any change. c) You must cause the whole of the work to be licensed at no charge to all third parties under the terms of this License. d) If a facility in the modified Library refers to a function or a table of data to be supplied by an application program that uses the facility, other than as an argument passed when the facility is invoked, then you must make a good faith effort to ensure that, in the event an application does not supply such function or table, the facility still operates, and performs whatever part of its purpose remains meaningful. (For example, a function in a library to compute square roots has a purpose that is entirely well-defined independent of the application. Therefore, Subsection 2d requires that any application-supplied function or table used by this function must be optional: if the application does not supply it, the square root function must still compute square roots.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Library, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Library, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Library. In addition, mere aggregation of another work not based on the Library with the Library (or with a work based on the Library) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may opt to apply the terms of the ordinary GNU General Public License instead of this License to a given copy of the Library. To do this, you must alter all the notices that refer to this License, so that they refer to the ordinary GNU General Public License, version 2, instead of to this License. (If a newer version than version 2 of the ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices. Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy. This option is useful when you wish to copy part of the code of the Library into a program that is not a library. 4. You may copy and distribute the Library (or a portion or derivative of it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange. If distribution of object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place satisfies the requirement to distribute the source code, even though third parties are not compelled to copy the source along with the object code. 5. A program that contains no derivative of any portion of the Library, but is designed to work with the Library by being compiled or linked with it, is called a "work that uses the Library". Such a work, in isolation, is not a derivative work of the Library, and therefore falls outside the scope of this License. However, linking a "work that uses the Library" with the Library creates an executable that is a derivative of the Library (because it contains portions of the Library), rather than a "work that uses the library". The executable is therefore covered by this License. Section 6 states terms for distribution of such executables. When a "work that uses the Library" uses material from a header file that is part of the Library, the object code for the work may be a derivative work of the Library even though the source code is not. Whether this is true is especially significant if the work can be linked without the Library, or if the work is itself a library. The threshold for this to be true is not precisely defined by law. If such an object file uses only numerical parameters, data structure layouts and accessors, and small macros and small inline functions (ten lines or less in length), then the use of the object file is unrestricted, regardless of whether it is legally a derivative work. (Executables containing this object code plus portions of the Library will still fall under Section 6.) Otherwise, if the work is a derivative of the Library, you may distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself. 6. As an exception to the Sections above, you may also combine or link a "work that uses the Library" with the Library to produce a work containing portions of the Library, and distribute that work under terms of your choice, provided that the terms permit modification of the work for the customer's own use and reverse engineering for debugging such modifications. You must give prominent notice with each copy of the work that the Library is used in it and that the Library and its use are covered by this License. You must supply a copy of this License. If the work during execution displays copyright notices, you must include the copyright notice for the Library among them, as well as a reference directing the user to the copy of this License. Also, you must do one of these things: a) Accompany the work with the complete corresponding machine-readable source code for the Library including whatever changes were used in the work (which must be distributed under Sections 1 and 2 above); and, if the work is an executable linked with the Library, with the complete machine-readable "work that uses the Library", as object code and/or source code, so that the user can modify the Library and then relink to produce a modified executable containing the modified Library. (It is understood that the user who changes the contents of definitions files in the Library will not necessarily be able to recompile the application to use the modified definitions.) b) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (1) uses at run time a copy of the library already present on the user's computer system, rather than copying library functions into the executable, and (2) will operate properly with a modified version of the library, if the user installs one, as long as the modified version is interface-compatible with the version that the work was made with. c) Accompany the work with a written offer, valid for at least three years, to give the same user the materials specified in Subsection 6a, above, for a charge no more than the cost of performing this distribution. d) If distribution of the work is made by offering access to copy from a designated place, offer equivalent access to copy the above specified materials from the same place. e) Verify that the user has already received a copy of these materials or that you have already sent this user a copy. For an executable, the required form of the "work that uses the Library" must include any data and utility programs needed for reproducing the executable from it. However, as a special exception, the materials to be distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. It may happen that this requirement contradicts the license restrictions of other proprietary libraries that do not normally accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute. 7. You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined library, provided that the separate distribution of the work based on the Library and of the other library facilities is otherwise permitted, and provided that you do these two things: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities. This must be distributed under the terms of the Sections above. b) Give prominent notice with the combined library of the fact that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 8. You may not copy, modify, sublicense, link with, or distribute the Library except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, link with, or distribute the Library is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 9. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Library or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Library (or any work based on the Library), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Library or works based on it. 10. Each time you redistribute the Library (or any work based on the Library), the recipient automatically receives a license from the original licensor to copy, distribute, link with or modify the Library subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties with this License. 11. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Library at all. For example, if a patent license would not permit royalty-free redistribution of the Library by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Library. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply, and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 12. If the distribution and/or use of the Library is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Library under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 13. The Free Software Foundation may publish revised and/or new versions of the Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Library specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation. 14. If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Libraries If you develop a new library, and you want it to be of the greatest possible use to the public, we recommend making it free software that everyone can redistribute and change. You can do so by permitting redistribution under these terms (or, alternatively, under the terms of the ordinary General Public License). To apply these terms, attach the following notices to the library. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. {description} Copyright (C) {year} {fullname} This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Also add information on how to contact you by electronic and paper mail. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the library, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the library `Frob' (a library for tweaking knobs) written by James Random Hacker. {signature of Ty Coon}, 1 April 1990 Ty Coon, President of Vice That's all there is to it!rawloader-0.37.1/README.md000064400000000000000000000067640072674642500132200ustar 00000000000000# rawloader [![Build Status](https://travis-ci.com/pedrocr/rawloader.svg?branch=master)](https://travis-ci.com/pedrocr/rawloader) [![Crates.io](https://img.shields.io/crates/v/rawloader.svg)](https://crates.io/crates/rawloader) This is a rust library to extract the raw data and some metadata from digital camera images. Given an image in a supported format and camera you will be able to get everything needed to process the image: * Identification of the camera that produced the image (both the EXIF name and a cleaned up name) * The raw pixels themselves, exactly as encoded by the camera * The number of pixels to crop on the top, right, bottom, left of the image to only use the actual image area * The black and white points of each of the color channels * The multipliers to apply to the color channels for the white balance * A conversion matrix between the camera color space and XYZ * The description of the bayer pattern itself so you'll know which pixels are which color Current State ------------- The library is still a work in process with the following formats already implemented: * Minolta MRW * Sony ARW, SRF and SR2 * Mamiya MEF * Olympus ORF * Samsung SRW * Epson ERF * Kodak KDC * Kodak DCS * Panasonic RW2 (also used by Leica) * Fuji RAF * Kodak DCR * Adobe DNG (the "good parts"1) * Pentax PEF * Canon CRW * "Naked" files2 * Leaf IIQ * Hasselblad 3FR * Nikon NRW * Nikon NEF * Leaf MOS * Canon CR2 * ARRI's ARI 1 DNG is a 101 page overambitious spec that tries to be an interchange format for processed images, complete with image transformation operations. We just implement enough of the spec so that actual raw files from DNG producing cameras or the Adobe DNG converter can be read. 2 Files that are just the raw data itself with no metadata whatsoever. The most common of these are the files generated by the Canon CHDK hacked firmware. Later versions produced actual DNG files but the first ones just did a dump of the raw data next to the JPG and assumed the user would use the JPG for the metadata. We match them by the filesize itself which means that if you feed rawloader with a file that has the exact same bytecount as these files you'll get a nice garbage output... Usage ----- Here's a simple sample program that uses this library: ```rust use std::env; use std::fs::File; use std::io::prelude::*; use std::io::BufWriter; fn main() { let args: Vec<_> = env::args().collect(); if args.len() != 2 { println!("Usage: {} ", args[0]); std::process::exit(2); } let file = &args[1]; let image = rawloader::decode_file(file).unwrap(); // Write out the image as a grayscale PPM let mut f = BufWriter::new(File::create(format!("{}.ppm",file)).unwrap()); let preamble = format!("P6 {} {} {}\n", image.width, image.height, 65535).into_bytes(); f.write_all(&preamble).unwrap(); if let rawloader::RawImageData::Integer(data) = image.data { for pix in data { // Do an extremely crude "demosaic" by setting R=G=B let pixhigh = (pix>>8) as u8; let pixlow = (pix&0x0f) as u8; f.write_all(&[pixhigh, pixlow, pixhigh, pixlow, pixhigh, pixlow]).unwrap() } } else { eprintln!("Don't know how to process non-integer raw files"); } } ``` Contributing ------------ Bug reports and pull requests welcome at https://github.com/pedrocr/rawloader Meet us at #chimper on irc.libera.chat if you need to discuss a feature or issue in detail or even just for general chat. rawloader-0.37.1/data/cameras/arri/alexa.toml000064400000000000000000000004360072674642500171770ustar 00000000000000make = "ARRI" model = "ALEXA" clean_make = "ARRI" clean_model = "ALEXA" blackpoint = 0 whitepoint = 4095 # we don't have a matrix so use sRGB color_matrix = [32404542, -15371385, -4985314, -9692660, 18760108, 415560, 556434, -2040259, 10572252] color_pattern = "RGGB" crops = [0,0,0,0] rawloader-0.37.1/data/cameras/canon/1000d.toml000064400000000000000000000006710072674642500167730ustar 00000000000000make = "Canon" model = "Canon EOS 1000D" clean_make = "Canon" clean_model = "EOS 1000D" model_aliases = [ ["Canon EOS DIGITAL REBEL XS", "Rebel XS"], ["Canon EOS REBEL XS", "Rebel XS"], ["Canon EOS Kiss Digital F", "Kiss F"], ["Canon EOS Kiss F", "Kiss F"], ] blackpoint = 0 whitepoint = 3600 color_matrix = [6771, -1139, -977, -7818, 15123, 2928, -1244, 1437, 7533] color_pattern = "RGGB" crops = [18,0,2,42] blackareav = [0, 41] rawloader-0.37.1/data/cameras/canon/100d.toml000064400000000000000000000007260072674642500167140ustar 00000000000000make = "Canon" model = "Canon EOS 100D" clean_make = "Canon" clean_model = "EOS 100D" model_aliases = [ ["Canon EOS DIGITAL REBEL SL1", "Rebel SL1"], ["Canon EOS REBEL SL1", "Rebel SL1"], ["Canon EOS Kiss Digital X7", "Kiss X7"], ["Canon EOS Kiss X7", "Kiss X7"], ] blackpoint = 2047 whitepoint = 12277 color_matrix = [6602, -841, -939, -4472, 12458, 2247, -975, 2039, 6148] color_pattern = "RGGB" crops = [52,0,0,72] blackareav = [0, 72] blackareah = [8, 44] rawloader-0.37.1/data/cameras/canon/10d.toml000064400000000000000000000003730072674642500166320ustar 00000000000000make = "Canon" model = "Canon EOS 10D" clean_make = "Canon" clean_model = "EOS 10D" blackpoint = 124 whitepoint = 4000 color_matrix = [8197, -2000, -1118, -6714, 14335, 2592, -2536, 3178, 8266] color_pattern = "RGGB" crops = [12,0,0,64] wb_offset = 1 rawloader-0.37.1/data/cameras/canon/1100d.toml000064400000000000000000000007030072674642500167700ustar 00000000000000make = "Canon" model = "Canon EOS 1100D" clean_make = "Canon" clean_model = "EOS 1100D" model_aliases = [ ["Canon EOS DIGITAL REBEL T3", "Rebel T3"], ["Canon EOS REBEL T3", "Rebel T3"], ["Canon EOS Kiss Digital X50", "Kiss X50"], ["Canon EOS Kiss X50", "Kiss X50"], ] blackpoint = 2046 whitepoint = 15000 color_matrix = [6444, -904, -893, -4563, 12308, 2535, -903, 2016, 6728] color_pattern = "RGGB" crops = [20,0,0,64] blackareav = [0, 58] rawloader-0.37.1/data/cameras/canon/1200d.toml000064400000000000000000000007320072674642500167730ustar 00000000000000make = "Canon" model = "Canon EOS 1200D" clean_make = "Canon" clean_model = "EOS 1200D" model_aliases = [ ["Canon EOS DIGITAL REBEL T5", "Rebel T5"], ["Canon EOS REBEL T5", "Rebel T5"], ["Canon EOS Kiss Digital X70", "Kiss X70"], ["Canon EOS Kiss X70", "Kiss X70"], ] blackpoint = 2046 whitepoint = 12279 color_matrix = [6461, -907, -882, -4300, 12184, 2378, -819, 1944, 5931] color_pattern = "GBRG" crops = [54,0,0,146] blackareav = [0, 140] blackareah = [4, 44] rawloader-0.37.1/data/cameras/canon/1300d.toml000064400000000000000000000007140072674642500167740ustar 00000000000000make = "Canon" model = "Canon EOS 1300D" clean_make = "Canon" clean_model = "Canon EOS 1300D" model_aliases = [ ["Canon EOS DIGITAL REBEL T6", "Rebel T6"], ["Canon EOS REBEL T6", "Rebel T6"], ["Canon EOS Kiss Digital X80", "Kiss X80"], ["Canon EOS Kiss X80", "Kiss X80"], ] blackpoint = 2046 whitepoint = 12279 color_matrix = [6939, -1016, -866, -4428, 12473, 2177, -1175, 2178, 6162] color_pattern = "GRBG" crops = [50,0,0,142] blackareav = [0,140] rawloader-0.37.1/data/cameras/canon/1d.toml000064400000000000000000000003760072674642500165550ustar 00000000000000make = "Canon" model = "Canon EOS-1D" clean_make = "Canon" clean_model = "EOS-1D" blackpoint = 0 whitepoint = 3588 color_matrix = [6806, -179, -1020, -8097, 16415, 1687, -3267, 4236, 7690] color_pattern = "GRBG" crops = [0,0,0,0] hints = ["double_line"] rawloader-0.37.1/data/cameras/canon/1dm2.toml000064400000000000000000000004330072674642500170060ustar 00000000000000make = "Canon" model = "Canon EOS-1D Mark II" clean_make = "Canon" clean_model = "EOS-1D Mark II" blackpoint = 0 whitepoint = 3700 color_matrix = [6264, -582, -724, -8312, 15948, 2504, -1744, 1919, 8664] color_pattern = "RGGB" crops = [12,0,0,74] blackareav = [0, 72] wb_offset = 34 rawloader-0.37.1/data/cameras/canon/1dm2n.toml000064400000000000000000000004200072674642500171600ustar 00000000000000make = "Canon" model = "Canon EOS-1D Mark II N" clean_make = "Canon" clean_model = "EOS-1D Mark II N" blackpoint = 0 whitepoint = 3700 color_matrix = [6240, -466, -822, -8180, 15825, 2500, -1801, 1938, 8042] color_pattern = "RGGB" crops = [12,0,0,74] blackareav = [0, 72] rawloader-0.37.1/data/cameras/canon/1dm3.toml000064400000000000000000000004170072674642500170110ustar 00000000000000make = "Canon" model = "Canon EOS-1D Mark III" clean_make = "Canon" clean_model = "EOS-1D Mark III" blackpoint = 0 whitepoint = 15100 color_matrix = [6291, -540, -976, -8350, 16145, 2311, -1714, 1858, 7326] color_pattern = "RGGB" crops = [20,0,2,78] blackareav = [2, 74] rawloader-0.37.1/data/cameras/canon/1dm4.toml000064400000000000000000000004220072674642500170060ustar 00000000000000make = "Canon" model = "Canon EOS-1D Mark IV" clean_make = "Canon" clean_model = "EOS-1D Mark IV" blackpoint = 2048 whitepoint = 15100 color_matrix = [6014, -220, -795, -4109, 12014, 2361, -561, 1824, 5787] color_pattern = "GBRG" crops = [46,64,2,144] blackareav = [0, 140] rawloader-0.37.1/data/cameras/canon/1ds.toml000064400000000000000000000004000072674642500167240ustar 00000000000000make = "Canon" model = "Canon EOS-1DS" clean_make = "Canon" clean_model = "EOS-1Ds" blackpoint = 0 whitepoint = 3500 color_matrix = [4374, 3631, -1743, -7520, 15212, 2472, -2892, 3632, 8161] color_pattern = "GRBG" crops = [0,0,0,0] hints = ["double_line"] rawloader-0.37.1/data/cameras/canon/1dsm2.toml000064400000000000000000000004350072674642500171730ustar 00000000000000make = "Canon" model = "Canon EOS-1Ds Mark II" clean_make = "Canon" clean_model = "EOS-1Ds Mark II" blackpoint = 0 whitepoint = 4060 color_matrix = [6517, -602, -867, -8180, 15926, 2378, -1618, 1771, 7633] color_pattern = "GBRG" crops = [13,0,0,98] blackareav = [0, 96] wb_offset = 34 rawloader-0.37.1/data/cameras/canon/1dsm3.toml000064400000000000000000000004220072674642500171700ustar 00000000000000make = "Canon" model = "Canon EOS-1Ds Mark III" clean_make = "Canon" clean_model = "EOS-1Ds Mark III" blackpoint = 0 whitepoint = 15100 color_matrix = [5859, -211, -930, -8255, 16017, 2353, -1732, 1887, 7448] color_pattern = "RGGB" crops = [20,10,2,62] blackareav = [0, 60] rawloader-0.37.1/data/cameras/canon/1dx.toml000064400000000000000000000004320072674642500167360ustar 00000000000000make = "Canon" model = "Canon EOS-1D X" clean_make = "Canon" clean_model = "EOS-1D X" blackpoint = 0 whitepoint = 13000 color_matrix = [6847, -614, -1014, -4669, 12737, 2139, -1197, 2488, 6846] color_pattern = "RGGB" crops = [102,0,2,128] blackareav = [0, 120] blackareah = [0, 98] rawloader-0.37.1/data/cameras/canon/1dx_m2.toml000064400000000000000000000004030072674642500173320ustar 00000000000000make = "Canon" model = "Canon EOS-1D X Mark II" clean_make = "Canon" clean_model = "Canon EOS-1D X Mark II" blackpoint = 2048 whitepoint = 14888 color_matrix = [7596, -978, -967, -4808, 12571, 2503, -1398, 2567, 5752] color_pattern = "RGGB" crops = [0,0,0,0] rawloader-0.37.1/data/cameras/canon/200d.toml000064400000000000000000000006030072674642500167070ustar 00000000000000make = "Canon" model = "Canon EOS 200D" clean_make = "Canon" clean_model = "EOS 200D" model_aliases = [ ["Canon EOS Kiss X9", "EOS Kiss X9"], ["Canon EOS Rebel SL2", "EOS Rebel SL2"], ] blackpoint = 511 whitepoint = 11892 color_matrix = [7377, -742, -998, -4235, 11981, 2549, -673, 1918, 5538] color_pattern = "RGGB" blackareav = [0, 260] blackareah = [0, 30] crops = [36,0,0,264] rawloader-0.37.1/data/cameras/canon/20d.toml000064400000000000000000000004150072674642500166300ustar 00000000000000make = "Canon" model = "Canon EOS 20D" clean_make = "Canon" clean_model = "EOS 20D" blackpoint = 0 whitepoint = 4095 color_matrix = [6599, -537, -891, -8071, 15783, 2424, -1983, 2234, 7462] color_pattern = "RGGB" crops = [12,0,0,74] blackareav = [0, 72] wb_offset = 25 rawloader-0.37.1/data/cameras/canon/300d.toml000064400000000000000000000007460072674642500167200ustar 00000000000000make = "Canon" model = "Canon EOS 300D DIGITAL" clean_make = "Canon" clean_model = "EOS 300D" model_aliases = [ ["Canon EOS 350D Digital", "EOS 350D"], ["Canon EOS DIGITAL REBEL", "Rebel"], ["Canon EOS REBEL", "Rebel"], ["Canon EOS Kiss Digital", "Kiss"], ["Canon EOS Kiss", "Kiss"], ] blackpoint = 124 whitepoint = 4000 color_matrix = [8197, -2000, -1118, -6714, 14335, 2592, -2536, 3178, 8266] color_pattern = "RGGB" crops = [12,0,0,64] wb_offset = 13 blackareav = [0,60] rawloader-0.37.1/data/cameras/canon/30d.toml000064400000000000000000000003770072674642500166400ustar 00000000000000make = "Canon" model = "Canon EOS 30D" clean_make = "Canon" clean_model = "EOS 30D" blackpoint = 0 whitepoint = 4071 color_matrix = [6257, -303, -1000, -7880, 15621, 2396, -1714, 1904, 7046] color_pattern = "RGGB" crops = [12,0,0,74] blackareav = [0, 72] rawloader-0.37.1/data/cameras/canon/350d.toml000064400000000000000000000007670072674642500167300ustar 00000000000000make = "Canon" model = "Canon EOS 350D DIGITAL" clean_make = "Canon" clean_model = "EOS 350D" model_aliases = [ ["Canon EOS 350D Digital", "EOS 350D"], ["Canon EOS DIGITAL REBEL XT", "Rebel XT"], ["Canon EOS REBEL XT", "Rebel XT"], ["Canon EOS Kiss Digital N", "Kiss N"], ["Canon EOS Kiss N", "Kiss N"], ] blackpoint = 0 whitepoint = 4095 color_matrix = [6018, -617, -965, -8645, 15881, 2975, -1530, 1719, 7642] color_pattern = "RGGB" crops = [14,0,0,42] blackareav = [0, 40] wb_offset = 25 rawloader-0.37.1/data/cameras/canon/400d.toml000064400000000000000000000007030072674642500167120ustar 00000000000000make = "Canon" model = "Canon EOS 400D DIGITAL" clean_make = "Canon" clean_model = "EOS 400D" model_aliases = [ ["Canon EOS DIGITAL REBEL XTi", "Rebel XTi"], ["Canon EOS REBEL XTi", "Rebel XTi"], ["Canon EOS Kiss Digital X", "Kiss X"], ["Canon EOS Kiss X", "Kiss X"], ] blackpoint = 0 whitepoint = 4058 color_matrix = [7054, -1501, -990, -8156, 15544, 2812, -1278, 1414, 7796] color_pattern = "RGGB" crops = [18,0,2,42] blackareav = [0, 40] rawloader-0.37.1/data/cameras/canon/40d.toml000064400000000000000000000004260072674642500166340ustar 00000000000000make = "Canon" model = "Canon EOS 40D" clean_make = "Canon" clean_model = "EOS 40D" blackpoint = 1021 whitepoint = 13600 color_matrix = [6071, -747, -856, -7653, 15365, 2441, -2025, 2553, 7315] color_pattern = "RGGB" crops = [18,6,2,30] blackareav = [0, 28] hints = ["40d_yuv"] rawloader-0.37.1/data/cameras/canon/450d.toml000064400000000000000000000006550072674642500167250ustar 00000000000000make = "Canon" model = "Canon EOS 450D" clean_make = "Canon" clean_model = "EOS 450D" model_aliases = [ ["Canon EOS DIGITAL REBEL XSi", "Rebel XSi"], ["Canon EOS REBEL XSi", "Rebel XSi"], ["Canon EOS Kiss Digital X2", "Kiss X2"], ["Canon EOS Kiss X2", "Kiss X2"], ] blackpoint = 1020 whitepoint = 14500 color_matrix = [5784, -262, -821, -7539, 15064, 2672, -1982, 2681, 7427] color_pattern = "RGGB" crops = [18,0,2,22] rawloader-0.37.1/data/cameras/canon/500d.toml000064400000000000000000000006560072674642500167220ustar 00000000000000make = "Canon" model = "Canon EOS 500D" clean_make = "Canon" clean_model = "EOS 500D" model_aliases = [ ["Canon EOS DIGITAL REBEL T1i", "Rebel T1i"], ["Canon EOS REBEL T1i", "Rebel T1i"], ["Canon EOS Kiss Digital X3", "Kiss X3"], ["Canon EOS Kiss X3", "Kiss X3"], ] blackpoint = 1024 whitepoint = 15600 color_matrix = [4763, 712, -646, -6821, 14399, 2640, -1921, 3276, 6561] color_pattern = "RGGB" crops = [30,48,32,62] rawloader-0.37.1/data/cameras/canon/50d.toml000064400000000000000000000004300072674642500166300ustar 00000000000000make = "Canon" model = "Canon EOS 50D" clean_make = "Canon" clean_model = "EOS 50D" blackpoint = 1026 whitepoint = 15500 color_matrix = [4920, 616, -593, -6493, 13964, 2784, -1774, 3178, 7005] color_pattern = "GBRG" crops = [52,16,18,64] blackareav = [0, 60] blackareah = [2, 46] rawloader-0.37.1/data/cameras/canon/550d.toml000064400000000000000000000007310072674642500167210ustar 00000000000000make = "Canon" model = "Canon EOS 550D" clean_make = "Canon" clean_model = "EOS 550D" model_aliases = [ ["Canon EOS DIGITAL REBEL T2i", "Rebel T2i"], ["Canon EOS REBEL T2i", "Rebel T2i"], ["Canon EOS Kiss Digital X4", "Kiss X4"], ["Canon EOS Kiss X4", "Kiss X4"], ] blackpoint = 2048 whitepoint = 15831 color_matrix = [6941, -1164, -857, -3825, 11597, 2534, -416, 1540, 6039] color_pattern = "GBRG" crops = [54,0,0,148] blackareav = [0, 140] blackareah = [4, 44] rawloader-0.37.1/data/cameras/canon/5d.toml000064400000000000000000000004210072674642500165500ustar 00000000000000make = "Canon" model = "Canon EOS 5D" clean_make = "Canon" clean_model = "EOS 5D" blackpoint = 0 whitepoint = 3650 color_matrix = [6347, -479, -972, -8297, 15954, 2480, -1968, 2131, 7649] color_pattern = "RGGB" crops = [34,0,0,90] blackareav = [0, 88] blackareah = [2, 30] rawloader-0.37.1/data/cameras/canon/5dm2.toml000064400000000000000000000004460072674642500170160ustar 00000000000000make = "Canon" model = "Canon EOS 5D Mark II" clean_make = "Canon" clean_model = "EOS 5D Mark II" blackpoint = 1020 whitepoint = 15600 color_matrix = [4716, 603, -830, -7798, 15474, 2480, -1496, 1937, 6651] color_pattern = "GBRG" crops = [51,0,0,158] blackareav = [0, 156] blackareah = [2, 48] rawloader-0.37.1/data/cameras/canon/5dm3.toml000064400000000000000000000004500072674642500170120ustar 00000000000000make = "Canon" model = "Canon EOS 5D Mark III" clean_make = "Canon" clean_model = "EOS 5D Mark III" blackpoint = 2036 whitepoint = 15000 color_matrix = [6722, -635, -963, -4287, 12460, 2028, -908, 2162, 5668] color_pattern = "RGGB" crops = [82,2,0,124] blackareav = [0, 120] blackareah = [2, 78] rawloader-0.37.1/data/cameras/canon/5dm4.toml000064400000000000000000000004530072674642500170160ustar 00000000000000make = "Canon" model = "Canon EOS 5D Mark IV" clean_make = "Canon" clean_model = "Canon EOS 5D Mark IV" blackpoint = 0 whitepoint = 14008 color_matrix = [6446, -366, -864, -4436, 12204, 2513, -952, 2496, 6348] color_pattern = "RGGB" crops = [42,0,0,136] hints = ["double_line"] blackareav = [0,130] rawloader-0.37.1/data/cameras/canon/5ds.toml000064400000000000000000000004610072674642500167370ustar 00000000000000make = "Canon" model = "Canon EOS 5DS" clean_make = "Canon" clean_model = "EOS 5DS" blackpoint = 2047 whitepoint = 14466 color_matrix = [6250, -711, -808, -5153, 12794, 2636, -1249, 2198, 5610] color_pattern = "RGGB" crops = [64,2,0,160] blackareav = [0, 150] blackareah = [2, 60] hints = ["double_line"] rawloader-0.37.1/data/cameras/canon/5dsr.toml000064400000000000000000000004650072674642500171250ustar 00000000000000make = "Canon" model = "Canon EOS 5DS R" clean_make = "Canon" clean_model = "EOS 5DS R" blackpoint = 2048 whitepoint = 15181 color_matrix = [6250, -711, -808, -5153, 12794, 2636, -1249, 2198, 5610] color_pattern = "RGGB" crops = [64,2,0,160] blackareav = [0, 150] blackareah = [2, 60] hints = ["double_line"] rawloader-0.37.1/data/cameras/canon/600d.toml000064400000000000000000000007300072674642500167140ustar 00000000000000make = "Canon" model = "Canon EOS 600D" clean_make = "Canon" clean_model = "EOS 600D" model_aliases = [ ["Canon EOS DIGITAL REBEL T3i", "Rebel T3i"], ["Canon EOS REBEL T3i", "Rebel T3i"], ["Canon EOS Kiss Digital X5", "Kiss X5"], ["Canon EOS Kiss X5", "Kiss X5"], ] blackpoint = 2048 whitepoint = 13926 color_matrix = [6461, -907, -882, -4300, 12184, 2378, -819, 1944, 5931] color_pattern = "GBRG" crops = [54,0,0,146] blackareav = [0, 140] blackareah = [4, 44] rawloader-0.37.1/data/cameras/canon/60d.toml000064400000000000000000000004300072674642500166310ustar 00000000000000make = "Canon" model = "Canon EOS 60D" clean_make = "Canon" clean_model = "EOS 60D" blackpoint = 2048 whitepoint = 15000 color_matrix = [6719, -994, -925, -4408, 12426, 2211, -887, 2129, 6051] color_pattern = "GBRG" crops = [54,0,0,146] blackareav = [0, 140] blackareah = [4, 46] rawloader-0.37.1/data/cameras/canon/650d.toml000064400000000000000000000007320072674642500167230ustar 00000000000000make = "Canon" model = "Canon EOS 650D" clean_make = "Canon" clean_model = "EOS 650D" model_aliases = [ ["Canon EOS DIGITAL REBEL T4i", "Rebel T4i"], ["Canon EOS REBEL T4i", "Rebel T4i"], ["Canon EOS Kiss Digital X6i", "Kiss X6i"], ["Canon EOS Kiss X6i", "Kiss X6i"], ] blackpoint = 2047 whitepoint = 12277 color_matrix = [6602, -841, -939, -4472, 12458, 2247, -975, 2039, 6148] color_pattern = "RGGB" crops = [56,0,0,76] blackareav = [0, 70] blackareah = [4, 44] rawloader-0.37.1/data/cameras/canon/6d.toml000064400000000000000000000004250072674642500165550ustar 00000000000000make = "Canon" model = "Canon EOS 6D" clean_make = "Canon" clean_model = "EOS 6D" blackpoint = 2047 whitepoint = 15000 color_matrix = [7034, -804, -1014, -4420, 12564, 2058, -851, 1994, 5758] color_pattern = "RGGB" crops = [40,0,2,74] blackareav = [0, 68] blackareah = [2, 36] rawloader-0.37.1/data/cameras/canon/6dmk2.toml000064400000000000000000000004750072674642500171740ustar 00000000000000make = "Canon" model = "Canon EOS 6D Mark II" clean_make = "Canon" clean_model = "EOS 6D Mark II" blackpoint = 513 whitepoint = 14558 color_matrix = [6875, -970, -932, -4691, 12459, 2501, -874, 1953, 5809] color_pattern = "RGGB" crops = [44,0,0,120] hints = ["double_line"] blackareav = [0, 110] blackareah = [0, 40] rawloader-0.37.1/data/cameras/canon/700d.toml000064400000000000000000000007320072674642500167170ustar 00000000000000make = "Canon" model = "Canon EOS 700D" clean_make = "Canon" clean_model = "EOS 700D" model_aliases = [ ["Canon EOS DIGITAL REBEL T5i", "Rebel T5i"], ["Canon EOS REBEL T5i", "Rebel T5i"], ["Canon EOS Kiss Digital X7i", "Kiss X7i"], ["Canon EOS Kiss X7i", "Kiss X7i"], ] blackpoint = 2048 whitepoint = 15000 color_matrix = [6602, -841, -939, -4472, 12458, 2247, -975, 2039, 6148] color_pattern = "RGGB" crops = [52,0,0,72] blackareav = [0, 70] blackareah = [4, 50] rawloader-0.37.1/data/cameras/canon/70d.toml000064400000000000000000000004270072674642500166400ustar 00000000000000make = "Canon" model = "Canon EOS 70D" clean_make = "Canon" clean_model = "EOS 70D" blackpoint = 2049 whitepoint = 12277 color_matrix = [7034, -804, -1014, -4420, 12564, 2058, -851, 1994, 5758] color_pattern = "RGGB" crops = [38,0,0,72] blackareav = [0, 72] blackareah = [0, 38] rawloader-0.37.1/data/cameras/canon/750d.toml000064400000000000000000000006600072674642500167240ustar 00000000000000make = "Canon" model = "Canon EOS 750D" clean_make = "Canon" clean_model = "EOS 750D" model_aliases = [ ["Canon EOS DIGITAL REBEL T6i", "Rebel T6i"], ["Canon EOS REBEL T6i", "Rebel T6i"], ["Canon EOS Kiss Digital X8i", "Kiss X8i"], ["Canon EOS Kiss X8i", "Kiss X8i"], ] blackpoint = 2047 whitepoint = 11765 color_matrix = [6362, -823, -847, -4426, 12109, 2616, -743, 1857, 5635] color_pattern = "RGGB" crops = [34,0,0,72] rawloader-0.37.1/data/cameras/canon/760d.toml000064400000000000000000000006000072674642500167170ustar 00000000000000make = "Canon" model = "Canon EOS 760D" clean_make = "Canon" clean_model = "EOS 760D" model_aliases = [ ["Canon EOS DIGITAL REBEL T6s", "Rebel T6s"], ["Canon EOS REBEL T6s", "Rebel T6s"], ["Canon EOS 8000D", "EOS 8000D"], ] blackpoint = 2047 whitepoint = 11765 color_matrix = [6362, -823, -847, -4426, 12109, 2616, -743, 1857, 5635] color_pattern = "RGGB" crops = [34,0,0,72] rawloader-0.37.1/data/cameras/canon/77d.toml000064400000000000000000000004340072674642500166450ustar 00000000000000make = "Canon" model = "Canon EOS 77D" clean_make = "Canon" clean_model = "Canon EOS 77D" blackpoint = 2048 whitepoint = 14338 color_matrix = [7377, -742, -998, -4235, 11981, 2549, -673, 1918, 5538] color_pattern = "RGGB" crops = [36,0,0,264] blackareav = [0,260] blackareah = [0,30] rawloader-0.37.1/data/cameras/canon/7d.toml000064400000000000000000000004010072674642500165500ustar 00000000000000make = "Canon" model = "Canon EOS 7D" clean_make = "Canon" clean_model = "EOS 7D" blackpoint = 2048 whitepoint = 13600 color_matrix = [6844, -996, -856, -3876, 11761, 2396, -593, 1772, 6198] color_pattern = "GBRG" crops = [52,0,0,158] blackareav = [8, 156] rawloader-0.37.1/data/cameras/canon/7dmk2.toml000064400000000000000000000004150072674642500171670ustar 00000000000000make = "Canon" model = "Canon EOS 7D Mark II" clean_make = "Canon" clean_model = "EOS 7D Mark II" blackpoint = 0 whitepoint = 10400 color_matrix = [7268, -1082, -969, -4186, 11839, 2663, -825, 2029, 5839] color_pattern = "RGGB" crops = [38,0,0,72] blackareav = [4, 64] rawloader-0.37.1/data/cameras/canon/800d.toml000064400000000000000000000005330072674642500167170ustar 00000000000000make = "Canon" model = "Canon EOS 800D" clean_make = "Canon" clean_model = "EOS 800D" model_aliases = [ ["Canon EOS Rebel T7i", "EOS Rebel T7i"], ] blackpoint = 511 whitepoint = 11892 color_matrix = [6970, -512, -968, -4425, 12161, 2553, -739, 1982, 5601] color_pattern = "RGGB" crops = [36,0,0,264] blackareav = [0, 250] blackareah = [0, 30] rawloader-0.37.1/data/cameras/canon/80d.toml000064400000000000000000000004320072674642500166350ustar 00000000000000make = "Canon" model = "Canon EOS 80D" clean_make = "Canon" clean_model = "Canon EOS 80D" blackpoint = 0 whitepoint = 11892 color_matrix = [7457, -671, -937, -4849, 12495, 2643, -1213, 2354, 5492] color_pattern = "RGGB" crops = [34,0,0,264] blackareav = [0,260] blackareah = [0,30] rawloader-0.37.1/data/cameras/canon/a3300is.toml000064400000000000000000000005060072674642500173260ustar 00000000000000make = "Canon" model = "PowerShot A3300 IS" clean_make = "Canon" clean_model = "PowerShot A3300 IS" blackpoint = 127 whitepoint = 4095 color_matrix = [1301431, -469837, -102652, -200195, 961551, 238645, -16441, 142319, 375979] color_pattern = "GBRG" crops = [16,56,8,16] filesize = 24724224 raw_width = 4704 raw_height = 3504 rawloader-0.37.1/data/cameras/canon/a610.toml000064400000000000000000000005010072674642500167060ustar 00000000000000make = "Canon" model = "PowerShot A610" clean_make = "Canon" clean_model = "PowerShot A610" blackpoint = 0 whitepoint = 1023 color_matrix = [15591, -6402, -1592, -5365, 13198, 2168, -1300, 1824, 5075] color_pattern = "RGGB" crops = [8,44,0,12] filesize = 6573120 raw_width = 2672 raw_height = 1968 blackareav = [2632,40] rawloader-0.37.1/data/cameras/canon/a620.toml000064400000000000000000000004750072674642500167210ustar 00000000000000make = "Canon" model = "PowerShot A620" clean_make = "Canon" clean_model = "PowerShot A620" blackpoint = 0 whitepoint = 1023 color_matrix = [15265, -6193, -1558, -4125, 12116, 2010, -888, 1639, 5220] color_pattern = "RGGB" crops = [12,4,0,36] filesize = 9219600 raw_width = 3152 raw_height = 2340 blackareav = [0,30] rawloader-0.37.1/data/cameras/canon/a630.toml000064400000000000000000000004770072674642500167240ustar 00000000000000make = "Canon" model = "PowerShot A630" clean_make = "Canon" clean_model = "PowerShot A630" blackpoint = 0 whitepoint = 1023 color_matrix = [14201, -5308, -1757, -6087, 14472, 1617, -2191, 3105, 5348] color_pattern = "RGGB" crops = [6,44,6,12] filesize = 10383120 raw_width = 3344 raw_height = 2484 blackareav = [0,30] rawloader-0.37.1/data/cameras/canon/a640.toml000064400000000000000000000005020072674642500167120ustar 00000000000000make = "Canon" model = "PowerShot A640" clean_make = "Canon" clean_model = "PowerShot A640" blackpoint = 0 whitepoint = 1023 color_matrix = [13124, -5329, -1390, -3602, 11658, 1944, -1612, 2863, 4885] color_pattern = "RGGB" crops = [6,52,6,12] filesize = 12945240 raw_width = 3736 raw_height = 2772 blackareav = [3686,50] rawloader-0.37.1/data/cameras/canon/a650.toml000064400000000000000000000005000072674642500167110ustar 00000000000000make = "Canon" model = "PowerShot A650" clean_make = "Canon" clean_model = "PowerShot A650" blackpoint = 0 whitepoint = 1023 color_matrix = [9427, -3036, -959, -2581, 10671, 1911, -1039, 1982, 4430] color_pattern = "RGGB" crops = [12,24,12,48] filesize = 15636240 raw_width = 4104 raw_height = 3048 blackareav = [0, 45] rawloader-0.37.1/data/cameras/canon/a720is.toml000064400000000000000000000005060072674642500172510ustar 00000000000000make = "Canon" model = "PowerShot A720 IS" clean_make = "Canon" clean_model = "PowerShot A720 IS" blackpoint = 0 whitepoint = 1023 color_matrix = [14573, -5482, -1546, -1266, 9799, 1468, -1040, 1912, 3810] color_pattern = "GBRG" crops = [5,32,3,6] filesize = 10341600 raw_width = 3336 raw_height = 2480 blackareav = [3306,30] rawloader-0.37.1/data/cameras/canon/d10.toml000064400000000000000000000005060072674642500166300ustar 00000000000000make = "Canon" model = "Canon PowerShot D10" clean_make = "Canon" clean_model = "PowerShot D10" blackpoint = 0 whitepoint = 4095 color_matrix = [9427, -3036, -959, -2581, 10671, 1911, -1039, 1982, 4430] color_pattern = "GBRG" crops = [22,80,8,25] filesize = 18763488 raw_width = 4104 raw_height = 3048 blackareav = [4074, 30] rawloader-0.37.1/data/cameras/canon/d2000.toml000064400000000000000000000004040072674642500167660ustar 00000000000000make = "Canon" model = "EOS D2000C" clean_make = "Canon" clean_model = "EOS D2000C" blackpoint = 0 whitepoint = 4095 color_matrix = [24542, -10860, -3401, -1490, 11370, -297, 2858, -605, 3225] color_pattern = "GRBG" crops = [0,0,0,0] hints = ["linearization"] rawloader-0.37.1/data/cameras/canon/d30.toml000064400000000000000000000004250072674642500166320ustar 00000000000000make = "Canon" model = "Canon EOS D30" clean_make = "Canon" clean_model = "EOS D30" blackpoint = 126 whitepoint = 4095 color_matrix = [9805, -2689, -1312, -5803, 13064, 3068, -2438, 3075, 8775] color_pattern = "RGGB" crops = [6,0,2,48] blackareav = [0,46] hints = ["nocinfo2"] rawloader-0.37.1/data/cameras/canon/d60.toml000064400000000000000000000004160072674642500166350ustar 00000000000000make = "Canon" model = "Canon EOS D60" clean_make = "Canon" clean_model = "EOS D60" blackpoint = 127 whitepoint = 4000 color_matrix = [6188, -1341, -890, -7168, 14489, 2937, -2640, 3228, 8483] color_pattern = "RGGB" crops = [12,0,0,64] wb_offset = 1 blackareav = [0,60] rawloader-0.37.1/data/cameras/canon/g1.toml000064400000000000000000000004630072674642500165550ustar 00000000000000make = "Canon" model = "Canon PowerShot G1" clean_make = "Canon" clean_model = "PowerShot G1" blackpoint = 31 whitepoint = 1023 color_matrix = [-4778, 9467, 2172, 4743, -1141, 4344, -5146, 9908, 6077, -1566, 11051, 557] color_pattern = "RGEB" crops = [8,52,2,4] hints = ["nolowbits"] blackareav = [2094,50] rawloader-0.37.1/data/cameras/canon/g10.toml000064400000000000000000000004130072674642500166300ustar 00000000000000make = "Canon" model = "Canon PowerShot G10" clean_make = "Canon" clean_model = "PowerShot G10" blackpoint = 128 whitepoint = 4095 color_matrix = [11093, -3906, -1028, -5047, 12492, 2879, -1003, 1750, 5561] color_pattern = "GBRG" crops = [13,36,12,12] wb_offset = 71 rawloader-0.37.1/data/cameras/canon/g11.toml000064400000000000000000000004370072674642500166370ustar 00000000000000make = "Canon" model = "Canon PowerShot G11" clean_make = "Canon" clean_model = "PowerShot G11" blackpoint = 128 whitepoint = 4095 color_matrix = [12177, -4817, -1069, -1612, 9864, 2049, -98, 850, 4471] color_pattern = "RGGB" crops = [18,56,14,10] blackareav = [3696, 48] wb_offset = 71 rawloader-0.37.1/data/cameras/canon/g12.toml000064400000000000000000000004360072674642500166370ustar 00000000000000make = "Canon" model = "Canon PowerShot G12" clean_make = "Canon" clean_model = "PowerShot G12" blackpoint = 128 whitepoint = 4000 color_matrix = [13244, -5501, -1248, -1508, 9858, 1935, -270, 1083, 4366] color_pattern = "RGGB" crops = [14,12,18,54] blackareav = [0, 50] wb_offset = 71 rawloader-0.37.1/data/cameras/canon/g15.toml000064400000000000000000000004660072674642500166450ustar 00000000000000make = "Canon" model = "Canon PowerShot G15" clean_make = "Canon" clean_model = "PowerShot G15" blackpoint = 128 whitepoint = 4000 color_matrix = [7474, -2301, -567, -4056, 11456, 2975, -222, 716, 4181] color_pattern = "GBRG" crops = [12,10,66,106] blackareav = [0, 100] blackareah = [3062, 60] wb_offset = 71 rawloader-0.37.1/data/cameras/canon/g16.toml000064400000000000000000000004340072674642500166410ustar 00000000000000make = "Canon" model = "Canon PowerShot G16" clean_make = "Canon" clean_model = "PowerShot G16" blackpoint = 128 whitepoint = 4000 color_matrix = [8020, -2687, -682, -3704, 11879, 2052, -965, 1921, 5556] color_pattern = "RGGB" crops = [18,24,0,96] blackareav = [0, 80] wb_offset = 71 rawloader-0.37.1/data/cameras/canon/g1x.toml000064400000000000000000000004650072674642500167470ustar 00000000000000make = "Canon" model = "Canon PowerShot G1 X" clean_make = "Canon" clean_model = "PowerShot G1 X" blackpoint = 512 whitepoint = 16000 color_matrix = [7378, -1255, -1043, -4088, 12251, 2048, -876, 1946, 5805] color_pattern = "RGGB" crops = [52,14,0,82] blackareav = [0, 68] blackareah = [0, 46] wb_offset = 71 rawloader-0.37.1/data/cameras/canon/g1xm2.toml000064400000000000000000000005050072674642500172010ustar 00000000000000make = "Canon" model = "Canon PowerShot G1 X Mark II" clean_make = "Canon" clean_model = "PowerShot G1 X Mark II" blackpoint = 512 whitepoint = 16000 color_matrix = [7378, -1255, -1043, -4088, 12251, 2048, -876, 1946, 5805] color_pattern = "RGGB" crops = [52,14,0,82] blackareav = [0, 68] blackareah = [0, 46] wb_offset = 71 rawloader-0.37.1/data/cameras/canon/g1xm3.toml000064400000000000000000000005070072674642500172040ustar 00000000000000make = "Canon" model = "Canon PowerShot G1 X Mark III" clean_make = "Canon" clean_model = "PowerShot G1 X Mark III" blackpoint = 512 whitepoint = 16000 color_matrix = [8532, -701, -1167, -4095, 11879, 2508, -797, 2424, 7010] color_pattern = "RGGB" crops = [36,0,0,264] wb_offset = 71 blackareav = [0, 250] blackareah = [0, 30] rawloader-0.37.1/data/cameras/canon/g2.toml000064400000000000000000000004420072674642500165530ustar 00000000000000make = "Canon" model = "Canon PowerShot G2" clean_make = "Canon" clean_model = "PowerShot G2" blackpoint = 0 whitepoint = 1023 color_matrix = [9087, -2693, -1049, -6715, 14382, 2537, -2291, 2819, 7790] color_pattern = "RGGB" crops = [6,52,2,12] hints = ["nolowbits"] blackareav = [2326,50] rawloader-0.37.1/data/cameras/canon/g3.toml000064400000000000000000000004330072674642500165540ustar 00000000000000make = "Canon" model = "Canon PowerShot G3" clean_make = "Canon" clean_model = "PowerShot G3" blackpoint = 0 whitepoint = 4095 color_matrix = [9212, -2781, -1073, -6573, 14189, 2605, -2300, 2844, 7664] color_pattern = "RGGB" crops = [6,52,2,12] wb_offset = 60 blackareav = [2326,50] rawloader-0.37.1/data/cameras/canon/g3x.toml000064400000000000000000000004370072674642500167500ustar 00000000000000make = "Canon" model = "Canon PowerShot G3 X" clean_make = "Canon" clean_model = "PowerShot G3 X" blackpoint = 2047 whitepoint = 16000 color_matrix = [9701, -3857, -921, -3149, 11537, 1817, -786, 1817, 5147] color_pattern = "RGGB" crops = [17,0,0,96] blackareav = [0, 90] wb_offset = 71 rawloader-0.37.1/data/cameras/canon/g5.toml000064400000000000000000000004320072674642500165550ustar 00000000000000make = "Canon" model = "Canon PowerShot G5" clean_make = "Canon" clean_model = "PowerShot G5" blackpoint = 0 whitepoint = 4095 color_matrix = [9757, -2872, -933, -5972, 13861, 2301, -1622, 2328, 7212] color_pattern = "RGGB" crops = [6,44,2,12] wb_offset = 60 blackareav = [2632,40] rawloader-0.37.1/data/cameras/canon/g5x.toml000064400000000000000000000004120072674642500167430ustar 00000000000000make = "Canon" model = "Canon PowerShot G5 X" clean_make = "Canon" clean_model = "PowerShot G5 X" blackpoint = 2047 whitepoint = 16000 color_matrix = [9602, -3823, -937, -2984, 11495, 1675, -407, 1415, 5049] color_pattern = "RGGB" crops = [17,0,0,96] wb_offset = 71 rawloader-0.37.1/data/cameras/canon/g6.toml000064400000000000000000000004570072674642500165650ustar 00000000000000make = "Canon" model = "Canon PowerShot G6" clean_make = "Canon" clean_model = "PowerShot G6" blackpoint = 128 whitepoint = 4095 color_matrix = [9877, -3775, -871, -7613, 14807, 3072, -1448, 1305, 7485] color_pattern = "RGGB" crops = [12,4,4,44] wb_offset = 48 hints = ["wb_mangle"] blackareav = [0,40] rawloader-0.37.1/data/cameras/canon/g7x.toml000064400000000000000000000004100072674642500167430ustar 00000000000000make = "Canon" model = "Canon PowerShot G7 X" clean_make = "Canon" clean_model = "PowerShot G7 X" blackpoint = 511 whitepoint = 4000 color_matrix = [9602, -3823, -937, -2984, 11495, 1675, -407, 1415, 5049] color_pattern = "RGGB" crops = [18,0,0,96] wb_offset = 71 rawloader-0.37.1/data/cameras/canon/g7x_crw.toml000064400000000000000000000004640072674642500176270ustar 00000000000000make = "Canon" model = "Canon PowerShot G7 X CRW" clean_make = "Canon" clean_model = "PowerShot G7 X" blackpoint = 511 whitepoint = 4000 color_matrix = [9602, -3823, -937, -2984, 11495, 1675, -407, 1415, 5049] color_pattern = "RGGB" crops = [18,0,0,96] filesize = 31342080 raw_width = 5632 raw_height = 3710 rawloader-0.37.1/data/cameras/canon/g7xm2.toml000064400000000000000000000004360072674642500172120ustar 00000000000000make = "Canon" model = "Canon PowerShot G7 X Mark II" clean_make = "Canon" clean_model = "Canon PowerShot G7 X Mark II" blackpoint = 2047 whitepoint = 16000 color_matrix = [9602, -3823, -937, -2984, 11495, 1675, -407, 1415, 5049] color_pattern = "RGGB" crops = [0,0,0,0] wb_offset = 71 rawloader-0.37.1/data/cameras/canon/g9.toml000064400000000000000000000004130072674642500165600ustar 00000000000000make = "Canon" model = "Canon PowerShot G9" clean_make = "Canon" clean_model = "PowerShot G9" blackpoint = 0 whitepoint = 4095 color_matrix = [7368, -2141, -598, -5621, 13254, 2625, -1418, 1696, 5743] color_pattern = "RGGB" crops = [12,24,12,48] blackareav = [0, 46] rawloader-0.37.1/data/cameras/canon/g9x.toml000064400000000000000000000004640072674642500167560ustar 00000000000000make = "Canon" model = "Canon PowerShot G9 X" clean_make = "Canon" clean_model = "PowerShot G9 X" blackpoint = 2049 whitepoint = 16000 color_matrix = [9602, -3823, -937, -2984, 11495, 1675, -407, 1415, 5049] color_pattern = "RGGB" crops = [16,0,0,96] wb_offset = 71 blackareav = [0, 70] blackareah = [0, 15] rawloader-0.37.1/data/cameras/canon/g9xm2.toml000064400000000000000000000005050072674642500172110ustar 00000000000000make = "Canon" model = "Canon PowerShot G9 X Mark II" clean_make = "Canon" clean_model = "PowerShot G9 X Mark II" blackpoint = 2048 whitepoint = 16000 color_matrix = [10056, -4131, -944, -2576, 11143, 1625, -238, 1294, 5179] color_pattern = "RGGB" crops = [16,0,0,96] wb_offset = 71 blackareav = [0, 70] blackareah = [0, 15] rawloader-0.37.1/data/cameras/canon/m.toml000064400000000000000000000004220072674642500164750ustar 00000000000000make = "Canon" model = "Canon EOS M" clean_make = "Canon" clean_model = "EOS M" blackpoint = 2048 whitepoint = 11222 color_matrix = [6602, -841, -939, -4472, 12458, 2247, -975, 2039, 6148] color_pattern = "RGGB" crops = [56,0,0,76] blackareav = [0, 70] blackareah = [4, 44] rawloader-0.37.1/data/cameras/canon/m10.toml000064400000000000000000000004460072674642500166440ustar 00000000000000make = "Canon" model = "Canon EOS M10" clean_make = "Canon" clean_model = "EOS M10" blackpoint = 2048 whitepoint = 16000 color_matrix = [6400, -480, -888, -5294, 13416, 2047, -1296, 2203, 6137] color_pattern = "RGGB" crops = [50,0,2,72] wb_offset = 71 blackareav = [0, 60] blackareah = [0, 40] rawloader-0.37.1/data/cameras/canon/m100.toml000064400000000000000000000004520072674642500167210ustar 00000000000000make = "Canon" model = "Canon EOS M100" clean_make = "Canon" clean_model = "EOS M100" blackpoint = 2048 whitepoint = 16000 color_matrix = [8532, -701, -1167, -4095, 11879, 2508, -797, 2424, 7010] color_pattern = "RGGB" crops = [36,0,0,264] wb_offset = 71 blackareav = [0, 250] blackareah = [0, 30] rawloader-0.37.1/data/cameras/canon/m2.toml000064400000000000000000000004250072674642500165620ustar 00000000000000make = "Canon" model = "Canon EOS M2" clean_make = "Canon" clean_model = "EOS M2" blackpoint = 2047 whitepoint = 12277 color_matrix = [6400, -480, -888, -5294, 13416, 2047, -1296, 2203, 6137] color_pattern = "RGGB" crops = [52,0,0,72] blackareav = [0, 70] blackareah = [4, 44] rawloader-0.37.1/data/cameras/canon/m3.toml000064400000000000000000000004430072674642500165630ustar 00000000000000make = "Canon" model = "Canon EOS M3" clean_make = "Canon" clean_model = "EOS M3" blackpoint = 2048 whitepoint = 16000 color_matrix = [6362, -823, -847, -4426, 12109, 2616, -743, 1857, 5635] color_pattern = "RGGB" crops = [34,0,0,72] blackareav = [2, 68] blackareah = [2, 30] wb_offset = 71 rawloader-0.37.1/data/cameras/canon/m5.toml000064400000000000000000000004510072674642500165640ustar 00000000000000make = "Canon" model = "Canon EOS M5" clean_make = "Canon" clean_model = "Canon EOS M5" blackpoint = 512 whitepoint = 16000 color_matrix = [8532, -701, -1167, -4095, 11879, 2508, -797, 2424, 7010] color_pattern = "RGGB" crops = [36,0,0,264] blackareav = [0,260] blackareah = [0,30] wb_offset = 71 rawloader-0.37.1/data/cameras/canon/m6.toml000064400000000000000000000004510072674642500165650ustar 00000000000000make = "Canon" model = "Canon EOS M6" clean_make = "Canon" clean_model = "Canon EOS M6" blackpoint = 512 whitepoint = 16000 color_matrix = [8532, -701, -1167, -4095, 11879, 2508, -797, 2424, 7010] color_pattern = "RGGB" crops = [36,0,0,264] blackareav = [0,260] blackareah = [0,30] wb_offset = 71 rawloader-0.37.1/data/cameras/canon/pro1.toml000064400000000000000000000004640072674642500171300ustar 00000000000000make = "Canon" model = "Canon PowerShot Pro1" clean_make = "Canon" clean_model = "PowerShot Pro1" blackpoint = 129 whitepoint = 4095 color_matrix = [10062, -3522, -999, -7643, 15117, 2730, -765, 817, 7323] color_pattern = "RGGB" crops = [6,52,6,4] wb_offset = 48 hints = ["wb_mangle"] blackareav = [3294,50] rawloader-0.37.1/data/cameras/canon/pro70.toml000064400000000000000000000004250072674642500172130ustar 00000000000000make = "Canon" model = "Canon PowerShot Pro70" clean_make = "Canon" clean_model = "PowerShot Pro70" blackpoint = 34 whitepoint = 990 color_matrix = [-4155, 9818, 1529, 3939, -25, 4522, -5521, 9870, 6610, -2238, 10873, 1342] color_pattern = "EBGRBERGEBRGBEGR" crops = [0,0,0,0] rawloader-0.37.1/data/cameras/canon/s100.toml000064400000000000000000000004670072674642500167350ustar 00000000000000make = "Canon" model = "Canon PowerShot S100" clean_make = "Canon" clean_model = "PowerShot S100" blackpoint = 128 whitepoint = 4000 color_matrix = [7968, -2565, -636, -2873, 10697, 2513, 180, 667, 4211] color_pattern = "GBRG" crops = [12,10,66,104] blackareav = [0, 100] blackareah = [3062, 60] wb_offset = 71 rawloader-0.37.1/data/cameras/canon/s100_crw.toml000064400000000000000000000005430072674642500176030ustar 00000000000000make = "Canon" model = "Canon PowerShot S100 CRW" clean_make = "Canon" clean_model = "PowerShot S100" blackpoint = 128 whitepoint = 4000 color_matrix = [7968, -2565, -636, -2873, 10697, 2513, 180, 667, 4211] color_pattern = "GBRG" crops = [12,10,66,104] blackareav = [0, 100] blackareah = [3062, 60] filesize = 19493760 raw_width = 4160 raw_height = 3124 rawloader-0.37.1/data/cameras/canon/s110.toml000064400000000000000000000004700072674642500167300ustar 00000000000000make = "Canon" model = "Canon PowerShot S110" clean_make = "Canon" clean_model = "PowerShot S110" blackpoint = 128 whitepoint = 4000 color_matrix = [8039, -2643, -654, -3783, 11230, 2930, -206, 690, 4194] color_pattern = "GBRG" crops = [12,10,66,106] blackareav = [0, 100] blackareah = [3062, 60] wb_offset = 71 rawloader-0.37.1/data/cameras/canon/s120.toml000064400000000000000000000004410072674642500167270ustar 00000000000000make = "Canon" model = "Canon PowerShot S120" clean_make = "Canon" clean_model = "PowerShot S120" blackpoint = 127 whitepoint = 4000 color_matrix = [6961, -1685, -695, -4625, 12945, 1836, -1114, 2152, 5518] color_pattern = "RGGB" crops = [30,47,14,121] blackareav = [0, 74] wb_offset = 71 rawloader-0.37.1/data/cameras/canon/s30.toml000064400000000000000000000004450072674642500166530ustar 00000000000000make = "Canon" model = "Canon PowerShot S30" clean_make = "Canon" clean_model = "PowerShot S30" blackpoint = 31 whitepoint = 1023 color_matrix = [10566, -3652, -1129, -6552, 14662, 2006, -2197, 2581, 7670] color_pattern = "RGGB" crops = [8,52,2,4] hints = ["nolowbits"] blackareav = [2094,50] rawloader-0.37.1/data/cameras/canon/s3is.toml000064400000000000000000000004770072674642500171340ustar 00000000000000make = "Canon" model = "PowerShot S3 IS" clean_make = "Canon" clean_model = "PowerShot S3 IS" blackpoint = 0 whitepoint = 1023 color_matrix = [14062, -5199, -1446, -4712, 12470, 2243, -1286, 2028, 4836] color_pattern = "RGGB" crops = [8,4,0,44] filesize = 7710960 raw_width = 2888 raw_height = 2136 blackareav = [0,40] rawloader-0.37.1/data/cameras/canon/s40.toml000064400000000000000000000004620072674642500166530ustar 00000000000000make = "Canon" model = "Canon PowerShot S40" clean_make = "Canon" clean_model = "PowerShot S40" blackpoint = 0 whitepoint = 1023 color_matrix = [8510, -2487, -940, -6869, 14231, 2900, -2318, 2829, 9013] color_pattern = "RGGB" crops = [6,52,2,12] hints = ["nolowbits"] wb_offset = 60 blackareav = [2326,50] rawloader-0.37.1/data/cameras/canon/s45.toml000064400000000000000000000004340072674642500166570ustar 00000000000000make = "Canon" model = "Canon PowerShot S45" clean_make = "Canon" clean_model = "PowerShot S45" blackpoint = 0 whitepoint = 4095 color_matrix = [8163, -2333, -955, -6682, 14174, 2751, -2077, 2597, 8041] color_pattern = "RGGB" crops = [6,52,2,12] wb_offset = 60 blackareav = [2326,50] rawloader-0.37.1/data/cameras/canon/s50.toml000064400000000000000000000004340072674642500166530ustar 00000000000000make = "Canon" model = "Canon PowerShot S50" clean_make = "Canon" clean_model = "PowerShot S50" blackpoint = 0 whitepoint = 4095 color_matrix = [8882, -2571, -863, -6348, 14234, 2288, -1516, 2172, 6569] color_pattern = "RGGB" crops = [6,44,2,12] wb_offset = 60 blackareav = [2632,40] rawloader-0.37.1/data/cameras/canon/s60.toml000064400000000000000000000004620072674642500166550ustar 00000000000000make = "Canon" model = "Canon PowerShot S60" clean_make = "Canon" clean_model = "PowerShot S60" blackpoint = 0 whitepoint = 4095 color_matrix = [8795, -2482, -797, -7804, 15403, 2573, -1422, 1996, 7082] color_pattern = "RGGB" crops = [6,44,2,12] wb_offset = 48 hints = ["wb_mangle"] blackareav = [2632,40] rawloader-0.37.1/data/cameras/canon/s70.toml000064400000000000000000000004570072674642500166620ustar 00000000000000make = "Canon" model = "Canon PowerShot S70" clean_make = "Canon" clean_model = "PowerShot S70" blackpoint = 129 whitepoint = 4095 color_matrix = [9976, -3810, -832, -7115, 14463, 2906, -901, 989, 7889] color_pattern = "RGGB" crops = [12,4,4,44] wb_offset = 48 hints = ["wb_mangle"] blackareav = [0,40] rawloader-0.37.1/data/cameras/canon/s90.toml000064400000000000000000000004070072674642500166570ustar 00000000000000make = "Canon" model = "Canon PowerShot S90" clean_make = "Canon" clean_model = "PowerShot S90" blackpoint = 128 whitepoint = 4095 color_matrix = [12374, -5016, -1049, -1677, 9902, 2078, -83, 852, 4683] color_pattern = "RGGB" crops = [18,54,10,10] wb_offset = 71 rawloader-0.37.1/data/cameras/canon/s95.toml000064400000000000000000000004110072674642500166570ustar 00000000000000make = "Canon" model = "Canon PowerShot S95" clean_make = "Canon" clean_model = "PowerShot S95" blackpoint = 128 whitepoint = 4000 color_matrix = [13440, -5896, -1279, -1236, 9598, 1931, -180, 1001, 4651] color_pattern = "RGGB" crops = [24,20,24,66] wb_offset = 71 rawloader-0.37.1/data/cameras/canon/sl1.toml000064400000000000000000000003700072674642500167420ustar 00000000000000make = "Canon" model = "Canon EOS REBEL SL1" clean_make = "Canon" clean_model = "EOS Rebel SL1" blackpoint = 2048 whitepoint = 15000 color_matrix = [6602, -841, -939, -4472, 12458, 2247, -975, 2039, 6148] color_pattern = "RGGB" crops = [52,0,0,72] rawloader-0.37.1/data/cameras/canon/sx110is.toml000064400000000000000000000005120072674642500174510ustar 00000000000000make = "Canon" model = "PowerShot SX110 IS" clean_make = "Canon" clean_model = "PowerShot SX110 IS" blackpoint = 0 whitepoint = 4095 color_matrix = [14134, -5576, -1527, -1991, 10719, 1273, -1158, 1929, 3581] color_pattern = "RGGB" crops = [12,30,0,6] filesize = 15467760 raw_width = 3720 raw_height = 2772 blackareav = [3690,30] rawloader-0.37.1/data/cameras/canon/sx1is.toml000064400000000000000000000004420072674642500173120ustar 00000000000000make = "Canon" model = "Canon PowerShot SX1 IS" clean_make = "Canon" clean_model = "PowerShot SX1 IS" blackpoint = 128 whitepoint = 4095 color_matrix = [6578, -259, -502, -5974, 13030, 3309, -308, 1058, 4970] color_pattern = "RGGB" crops = [12,2,0,192] blackareav = [0, 188] wb_offset = 71 rawloader-0.37.1/data/cameras/canon/sx40hs.toml000064400000000000000000000005130072674642500173730ustar 00000000000000make = "Canon" model = "Canon PowerShot SX40 HS" clean_make = "Canon" clean_model = "PowerShot SX40 HS" blackpoint = 0 whitepoint = 4095 color_matrix = [12432, -4753, -1247, -2110, 10691, 1629, -412, 1623, 4926] color_pattern = "RGGB" crops = [16,8,0,96] filesize = 19167840 raw_width = 4176 raw_height = 3060 blackareav = [0, 94] rawloader-0.37.1/data/cameras/canon/sx50.toml000064400000000000000000000004470072674642500170470ustar 00000000000000make = "Canon" model = "Canon PowerShot SX50 HS" clean_make = "Canon" clean_model = "PowerShot SX50 HS" blackpoint = 128 whitepoint = 4000 color_matrix = [12432, -4753, -1247, -2110, 10691, 1629, -412, 1623, 4926] color_pattern = "RGGB" crops = [20,10,0,100] blackareav = [6, 70] wb_offset = 71 rawloader-0.37.1/data/cameras/canon/sx60hs.toml000064400000000000000000000004470072674642500174030ustar 00000000000000make = "Canon" model = "Canon PowerShot SX60 HS" clean_make = "Canon" clean_model = "PowerShot SX60 HS" blackpoint = 128 whitepoint = 4000 color_matrix = [13161, -5451, -1344, -1989, 10654, 1531, -47, 1271, 4955] color_pattern = "RGGB" crops = [26,24,10,112] blackareav = [0, 70] wb_offset = 71 rawloader-0.37.1/data/cameras/canon/t1i.toml000064400000000000000000000003720072674642500167420ustar 00000000000000make = "Canon" model = "Canon EOS REBEL T1i" clean_make = "Canon" clean_model = "EOS Rebel T1i" blackpoint = 1024 whitepoint = 15600 color_matrix = [4763, 712, -646, -6821, 14399, 2640, -1921, 3276, 6561] color_pattern = "RGGB" crops = [30,48,32,62] rawloader-0.37.1/data/cameras/canon/t2i.toml000064400000000000000000000004450072674642500167440ustar 00000000000000make = "Canon" model = "Canon EOS REBEL T2i" clean_make = "Canon" clean_model = "EOS Rebel T2i" blackpoint = 2048 whitepoint = 15831 color_matrix = [6941, -1164, -857, -3825, 11597, 2534, -416, 1540, 6039] color_pattern = "GBRG" crops = [54,0,0,148] blackareav = [0, 140] blackareah = [4, 44] rawloader-0.37.1/data/cameras/canon/t3.toml000064400000000000000000000004130072674642500165670ustar 00000000000000make = "Canon" model = "Canon EOS REBEL T3" clean_make = "Canon" clean_model = "EOS Rebel T3" blackpoint = 2046 whitepoint = 15000 color_matrix = [6444, -904, -893, -4563, 12308, 2535, -903, 2016, 6728] color_pattern = "RGGB" crops = [20,0,0,64] blackareav = [0, 58] rawloader-0.37.1/data/cameras/canon/t3i.toml000064400000000000000000000004440072674642500167440ustar 00000000000000make = "Canon" model = "Canon EOS REBEL T3i" clean_make = "Canon" clean_model = "EOS Rebel T3i" blackpoint = 2048 whitepoint = 13926 color_matrix = [6461, -907, -882, -4300, 12184, 2378, -819, 1944, 5931] color_pattern = "GBRG" crops = [54,0,0,146] blackareav = [0, 140] blackareah = [4, 44] rawloader-0.37.1/data/cameras/canon/t5.toml000064400000000000000000000004420072674642500165730ustar 00000000000000make = "Canon" model = "Canon EOS REBEL T5" clean_make = "Canon" clean_model = "EOS Rebel T5" blackpoint = 2046 whitepoint = 12279 color_matrix = [6461, -907, -882, -4300, 12184, 2378, -819, 1944, 5931] color_pattern = "GBRG" crops = [54,0,0,146] blackareav = [0, 140] blackareah = [4, 44] rawloader-0.37.1/data/cameras/canon/t5i.toml000064400000000000000000000003700072674642500167440ustar 00000000000000make = "Canon" model = "Canon EOS REBEL T5i" clean_make = "Canon" clean_model = "EOS Rebel T5i" blackpoint = 2047 whitepoint = 12277 color_matrix = [6602, -841, -939, -4472, 12458, 2247, -975, 2039, 6148] color_pattern = "RGGB" crops = [52,0,0,72] rawloader-0.37.1/data/cameras/canon/t6.toml000064400000000000000000000004240072674642500165740ustar 00000000000000make = "Canon" model = "Canon EOS Rebel T6" clean_make = "Canon" clean_model = "Canon EOS Rebel T6" blackpoint = 2046 whitepoint = 12279 color_matrix = [6939, -1016, -866, -4428, 12473, 2177, -1175, 2178, 6162] color_pattern = "GRBG" crops = [50,0,0,142] blackareav = [0,140] rawloader-0.37.1/data/cameras/canon/t6i.toml000064400000000000000000000003700072674642500167450ustar 00000000000000make = "Canon" model = "Canon EOS Rebel T6i" clean_make = "Canon" clean_model = "EOS Rebel T6i" blackpoint = 2048 whitepoint = 14580 color_matrix = [6362, -823, -847, -4426, 12109, 2616, -743, 1857, 5635] color_pattern = "RGGB" crops = [34,0,0,72] rawloader-0.37.1/data/cameras/epson/r-d1.toml000064400000000000000000000003470072674642500170400ustar 00000000000000make = "SEIKO EPSON CORP." model = "R-D1" clean_make = "Epson" clean_model = "R-D1" blackpoint = 63 whitepoint = 4095 color_matrix = [6827, -1878, -732, -8429, 16012, 2564, -704, 592, 7145] color_pattern = "RGGB" crops = [0,0,0,0] rawloader-0.37.1/data/cameras/fuji/e550.toml000064400000000000000000000004170072674642500165620ustar 00000000000000make = "FUJIFILM" model = "FinePix E550" clean_make = "Fujifilm" clean_model = "FinePix E550" blackpoint = 0 whitepoint = 15875 color_matrix = [11044, -3888, -1120, -7248, 15168, 2208, -1531, 2277, 8069] color_pattern = "GBRG" crops = [0,0,0,0] hints = ["fuji_rotation"] rawloader-0.37.1/data/cameras/fuji/e900.toml000064400000000000000000000004200072674642500165530ustar 00000000000000make = "FUJIFILM" model = "FinePix E900" clean_make = "Fujifilm" clean_model = "FinePix E900" blackpoint = 0 whitepoint = 15564 color_matrix = [9183, -2526, -1078, -7461, 15071, 2574, -2022, 2440, 8639] color_pattern = "GBRG" crops = [0,32,0,32] hints = ["fuji_rotation"] rawloader-0.37.1/data/cameras/fuji/f600exr.toml000064400000000000000000000003750072674642500173010ustar 00000000000000make = "FUJIFILM" model = "FinePix F600EXR" clean_make = "Fujifilm" clean_model = "FinePix F600EXR" blackpoint = 256 whitepoint = 3900 color_matrix = [13690, -5358, -1474, -3369, 11600, 1998, -132, 1554, 4395] color_pattern = "RGGB" crops = [0,32,0,34] rawloader-0.37.1/data/cameras/fuji/f700.toml000064400000000000000000000004410072674642500165550ustar 00000000000000make = "FUJIFILM" model = "FinePix F700" clean_make = "Fujifilm" clean_model = "FinePix F700" blackpoint = 0 whitepoint = 16383 color_matrix = [10004, -3219, -1201, -7036, 15047, 2107, -1863, 2565, 7736] color_pattern = "GBRG" crops = [0,16,0,16] hints = ["fuji_rotation", "double_width"] rawloader-0.37.1/data/cameras/fuji/f900exr.toml000064400000000000000000000003730072674642500173020ustar 00000000000000make = "FUJIFILM" model = "FinePix F900EXR" clean_make = "Fujifilm" clean_model = "FinePix F900EXR" blackpoint = 256 whitepoint = 3900 color_matrix = [12085, -4727, -953, -3257, 11489, 2002, -511, 2046, 4592] color_pattern = "BGGR" crops = [0,64,0,0] rawloader-0.37.1/data/cameras/fuji/gfx50s.toml000064400000000000000000000003540072674642500172200ustar 00000000000000make = "FUJIFILM" model = "GFX 50S" clean_make = "Fujifilm" clean_model = "GFX 50S" blackpoint = 1023 whitepoint = 16383 color_matrix = [11756, -4754, -874, -3056, 11045, 2305, -381, 1457, 6006] color_pattern = "RGGB" crops = [0,0,0,0] rawloader-0.37.1/data/cameras/fuji/hs10.toml000064400000000000000000000004170072674642500166570ustar 00000000000000make = "FUJIFILM" model = "FinePix HS10 HS11" clean_make = "Fujifilm" clean_model = "FinePix HS10 HS11" blackpoint = 50 whitepoint = 3900 color_matrix = [12440, -3954, -1183, -1123, 9674, 1708, -83, 1614, 4086] color_pattern = "BGGR" crops = [0,0,0,0] hints = ["jpeg32"] rawloader-0.37.1/data/cameras/fuji/hs20exr.toml000064400000000000000000000003750072674642500174020ustar 00000000000000make = "FUJIFILM" model = "FinePix HS20EXR" clean_make = "Fujifilm" clean_model = "FinePix HS20EXR" blackpoint = 256 whitepoint = 3900 color_matrix = [13690, -5358, -1474, -3369, 11600, 1998, -132, 1554, 4395] color_pattern = "RGGB" crops = [0,32,0,34] rawloader-0.37.1/data/cameras/fuji/hs50exr.toml000064400000000000000000000003730072674642500174030ustar 00000000000000make = "FUJIFILM" model = "FinePix HS50EXR" clean_make = "Fujifilm" clean_model = "FinePix HS50EXR" blackpoint = 256 whitepoint = 3900 color_matrix = [12085, -4727, -953, -3257, 11489, 2002, -511, 2046, 4592] color_pattern = "BGGR" crops = [0,64,0,0] rawloader-0.37.1/data/cameras/fuji/s1.toml000064400000000000000000000004030072674642500164220ustar 00000000000000make = "FUJIFILM" model = "FinePix S1" clean_make = "FUJIFILM" clean_model = "FinePix S1" blackpoint = 200 whitepoint = 4095 color_matrix = [12297, -4882, -1202, -2106, 10691, 1623, -88, 1312, 4790] color_pattern = "RGGB" crops = [0,0,0,0] hints = ["jpeg32"] rawloader-0.37.1/data/cameras/fuji/s200exr.toml000064400000000000000000000003760072674642500173130ustar 00000000000000make = "FUJIFILM" model = "FinePix S200EXR" clean_make = "Fujifilm" clean_model = "FinePix S200EXR" blackpoint = 519 whitepoint = 16250 color_matrix = [11401, -4498, -1312, -5088, 12751, 2613, -838, 1568, 5941] color_pattern = "RGGB" crops = [0,28,0,28] rawloader-0.37.1/data/cameras/fuji/s2pro.toml000064400000000000000000000004310072674642500171450ustar 00000000000000make = "FUJIFILM" model = "FinePixS2Pro" clean_make = "Fujifilm" clean_model = "FinePix S2Pro" blackpoint = 126 whitepoint = 4095 color_matrix = [12492, -4690, -1402, -7033, 15423, 1647, -1507, 2111, 7697] color_pattern = "GBRG" crops = [32,32,32,32] hints = ["fuji_rotation_alt"] rawloader-0.37.1/data/cameras/fuji/s3pro.toml000064400000000000000000000004270072674642500171530ustar 00000000000000make = "FUJIFILM" model = "FinePix S3Pro" clean_make = "Fujifilm" clean_model = "FinePix S3Pro" blackpoint = 0 whitepoint = 16383 color_matrix = [11807, -4612, -1294, -8927, 16968, 1988, -2120, 2741, 8006] color_pattern = "GBRG" crops = [2,32,2,32] hints = ["fuji_rotation_alt"] rawloader-0.37.1/data/cameras/fuji/s5000.toml000064400000000000000000000004220072674642500166470ustar 00000000000000make = "FUJIFILM" model = "FinePix S5000" clean_make = "Fujifilm" clean_model = "FinePix S5000" blackpoint = 0 whitepoint = 15866 color_matrix = [8754, -2732, -1019, -7204, 15069, 2276, -1702, 2334, 6982] color_pattern = "GBRG" crops = [4,24,4,24] hints = ["fuji_rotation"] rawloader-0.37.1/data/cameras/fuji/s5200.toml000064400000000000000000000004210072674642500166500ustar 00000000000000make = "FUJIFILM" model = "FinePix S5200" clean_make = "Fujifilm" clean_model = "FinePix S5200" blackpoint = 0 whitepoint = 15564 color_matrix = [9636, -2804, -988, -7442, 15040, 2589, -1803, 2311, 8621] color_pattern = "GBRG" crops = [4,30,4,30] hints = ["fuji_rotation"] rawloader-0.37.1/data/cameras/fuji/s5500.toml000064400000000000000000000003660072674642500166630ustar 00000000000000make = "FUJIFILM" model = "FinePix S5500" clean_make = "Fujifilm" clean_model = "FinePix S5500" blackpoint = 0 whitepoint = 15880 color_matrix = [11940, -4431, -1255, -6766, 14428, 2542, -993, 1165, 7421] color_pattern = "RGGB" crops = [0,0,0,0] rawloader-0.37.1/data/cameras/fuji/s5600.toml000064400000000000000000000004210072674642500166540ustar 00000000000000make = "FUJIFILM" model = "FinePix S5600" clean_make = "Fujifilm" clean_model = "FinePix S5600" blackpoint = 0 whitepoint = 15564 color_matrix = [9636, -2804, -988, -7442, 15040, 2589, -1803, 2311, 8621] color_pattern = "GBRG" crops = [0,30,0,30] hints = ["fuji_rotation"] rawloader-0.37.1/data/cameras/fuji/s5pro.toml000064400000000000000000000004270072674642500171550ustar 00000000000000make = "FUJIFILM" model = "FinePix S5Pro" clean_make = "Fujifilm" clean_model = "FinePix S5Pro" blackpoint = 0 whitepoint = 16383 color_matrix = [12300, -5110, -1304, -9117, 17143, 1998, -1947, 2448, 8100] color_pattern = "GBRG" crops = [2,32,2,32] hints = ["fuji_rotation_alt"] rawloader-0.37.1/data/cameras/fuji/s6500fd.toml000064400000000000000000000004330072674642500171710ustar 00000000000000make = "FUJIFILM" model = "FinePix S6500fd" clean_make = "Fujifilm" clean_model = "FinePix S6500fd" blackpoint = 0 whitepoint = 15564 color_matrix = [12628, -4887, -1401, -6861, 14996, 1962, -2198, 2782, 7091] color_pattern = "GBRG" crops = [0,64,0,64] hints = ["fuji_rotation_alt"] rawloader-0.37.1/data/cameras/fuji/s9500.toml000064400000000000000000000004230072674642500166610ustar 00000000000000make = "FUJIFILM" model = "FinePix S9500" clean_make = "Fujifilm" clean_model = "FinePix S9500" blackpoint = 0 whitepoint = 16115 color_matrix = [10491, -3423, -1145, -7385, 15027, 2538, -1809, 2275, 8692] color_pattern = "GBRG" crops = [0,32,0,32] hints = ["fuji_rotation"] rawloader-0.37.1/data/cameras/fuji/s9600.toml000064400000000000000000000004230072674642500166620ustar 00000000000000make = "FUJIFILM" model = "FinePix S9600" clean_make = "Fujifilm" clean_model = "FinePix S9600" blackpoint = 0 whitepoint = 15564 color_matrix = [12343, -4515, -1285, -7165, 14899, 2435, -1895, 2496, 8800] color_pattern = "GBRG" crops = [0,32,0,32] hints = ["fuji_rotation"] rawloader-0.37.1/data/cameras/fuji/x-a1.toml000064400000000000000000000003460072674642500166530ustar 00000000000000make = "FUJIFILM" model = "X-A1" clean_make = "Fujifilm" clean_model = "X-A1" blackpoint = 256 whitepoint = 4094 color_matrix = [11086, -4555, -839, -3512, 11310, 2517, -815, 1341, 5940] color_pattern = "RGGB" crops = [0,168,0,0] rawloader-0.37.1/data/cameras/fuji/x-a2.toml000064400000000000000000000003460072674642500166540ustar 00000000000000make = "FUJIFILM" model = "X-A2" clean_make = "Fujifilm" clean_model = "X-A2" blackpoint = 256 whitepoint = 4094 color_matrix = [10763, -4560, -917, -3346, 11311, 2322, -475, 1135, 5843] color_pattern = "RGGB" crops = [0,168,0,0] rawloader-0.37.1/data/cameras/fuji/x-a3.toml000064400000000000000000000003470072674642500166560ustar 00000000000000make = "FUJIFILM" model = "X-A3" clean_make = "Fujifilm" clean_model = "X-A3" blackpoint = 1024 whitepoint = 16383 color_matrix = [12407, -5222, -1086, -2971, 11116, 2120, -294, 1029, 5284] color_pattern = "RGGB" crops = [0,0,0,0] rawloader-0.37.1/data/cameras/fuji/x-e1.toml000064400000000000000000000004060072674642500166540ustar 00000000000000make = "FUJIFILM" model = "X-E1" clean_make = "Fujifilm" clean_model = "X-E1" blackpoint = 256 whitepoint = 4094 color_matrix = [10413, -3996, -993, -3721, 11640, 2361, -733, 1540, 6011] color_pattern = "GGRGGBGGBGGRBRGRBGGGBGGRGGRGGBRBGBRG" crops = [0,168,0,0] rawloader-0.37.1/data/cameras/fuji/x-e2.toml000064400000000000000000000004070072674642500166560ustar 00000000000000make = "FUJIFILM" model = "X-E2" clean_make = "Fujifilm" clean_model = "X-E2" blackpoint = 1024 whitepoint = 16383 color_matrix = [8458, -2451, -855, -4597, 12447, 2407, -1475, 2482, 6526] color_pattern = "RBGBRGGGRGGBGGBGGRBRGRBGGGBGGRGGRGGB" crops = [0,52,0,4] rawloader-0.37.1/data/cameras/fuji/x-e2s.toml000064400000000000000000000004110072674642500170340ustar 00000000000000make = "FUJIFILM" model = "X-E2S" clean_make = "Fujifilm" clean_model = "X-E2S" blackpoint = 1024 whitepoint = 16383 color_matrix = [11562, -5118, -961, -3022, 11007, 2311, -525, 1569, 6097] color_pattern = "RBGBRGGGRGGBGGBGGRBRGRBGGGBGGRGGRGGB" crops = [0,52,0,4] rawloader-0.37.1/data/cameras/fuji/x-e3.toml000064400000000000000000000004070072674642500166570ustar 00000000000000make = "FUJIFILM" model = "X-E3" clean_make = "Fujifilm" clean_model = "X-E3" blackpoint = 1023 whitepoint = 16383 color_matrix = [11434, -4948, -1210, -3746, 12042, 1903, -666, 1479, 5235] color_pattern = "RBGBRGGGRGGBGGBGGRBRGRBGGGBGGRGGRGGB" crops = [0,0,0,0] rawloader-0.37.1/data/cameras/fuji/x-m1.toml000064400000000000000000000004060072674642500166640ustar 00000000000000make = "FUJIFILM" model = "X-M1" clean_make = "Fujifilm" clean_model = "X-M1" blackpoint = 256 whitepoint = 4094 color_matrix = [10413, -3996, -993, -3721, 11640, 2361, -733, 1540, 6011] color_pattern = "GGRGGBGGBGGRBRGRBGGGBGGRGGRGGBRBGBRG" crops = [0,168,0,0] rawloader-0.37.1/data/cameras/fuji/x-pro1.toml000064400000000000000000000004120072674642500172250ustar 00000000000000make = "FUJIFILM" model = "X-Pro1" clean_make = "Fujifilm" clean_model = "X-Pro1" blackpoint = 256 whitepoint = 4094 color_matrix = [10413, -3996, -993, -3721, 11640, 2361, -733, 1540, 6011] color_pattern = "GGRGGBGGBGGRBRGRBGGGBGGRGGRGGBRBGBRG" crops = [0,168,0,0] rawloader-0.37.1/data/cameras/fuji/x-pro2.toml000064400000000000000000000004150072674642500172310ustar 00000000000000make = "FUJIFILM" model = "X-Pro2" clean_make = "Fujifilm" clean_model = "X-Pro2" blackpoint = 1024 whitepoint = 16383 color_matrix = [11434, -4948, -1210, -3746, 12042, 1903, -666, 1479, 5235] color_pattern = "RBGBRGGGRGGBGGBGGRBRGRBGGGBGGRGGRGGB" crops = [0,128,0,0] rawloader-0.37.1/data/cameras/fuji/x-s1.toml000064400000000000000000000003470072674642500166760ustar 00000000000000make = "FUJIFILM" model = "X-S1" clean_make = "Fujifilm" clean_model = "X-S1" blackpoint = 256 whitepoint = 4000 color_matrix = [13509, -6199, -1254, -4430, 12733, 1865, -331, 1441, 5022] color_pattern = "BGGR" crops = [0,48,0,48] rawloader-0.37.1/data/cameras/fuji/x-t1.toml000064400000000000000000000004070072674642500166740ustar 00000000000000make = "FUJIFILM" model = "X-T1" clean_make = "Fujifilm" clean_model = "X-T1" blackpoint = 1024 whitepoint = 16383 color_matrix = [8458, -2451, -855, -4597, 12447, 2407, -1475, 2482, 6526] color_pattern = "RBGBRGGGRGGBGGBGGRBRGRBGGGBGGRGGRGGB" crops = [0,52,0,4] rawloader-0.37.1/data/cameras/fuji/x-t10.toml000064400000000000000000000004110072674642500167470ustar 00000000000000make = "FUJIFILM" model = "X-T10" clean_make = "Fujifilm" clean_model = "X-T10" blackpoint = 1024 whitepoint = 16383 color_matrix = [8458, -2451, -855, -4597, 12447, 2407, -1475, 2482, 6526] color_pattern = "RBGBRGGGRGGBGGBGGRBRGRBGGGBGGRGGRGGB" crops = [0,52,0,4] rawloader-0.37.1/data/cameras/fuji/x-t2.toml000064400000000000000000000004110072674642500166700ustar 00000000000000make = "FUJIFILM" model = "X-T2" clean_make = "Fujifilm" clean_model = "X-T2" blackpoint = 1024 whitepoint = 16383 color_matrix = [11434, -4948, -1210, -3746, 12042, 1903, -666, 1479, 5235] color_pattern = "RBGBRGGGRGGBGGBGGRBRGRBGGGBGGRGGRGGB" crops = [0,128,0,0] rawloader-0.37.1/data/cameras/fuji/x-t20.toml000064400000000000000000000004130072674642500167520ustar 00000000000000make = "FUJIFILM" model = "X-T20" clean_make = "Fujifilm" clean_model = "X-T20" blackpoint = 1024 whitepoint = 16383 color_matrix = [11434, -4948, -1210, -3746, 12042, 1903, -666, 1479, 5235] color_pattern = "RBGBRGGGRGGBGGBGGRBRGRBGGGBGGRGGRGGB" crops = [0,128,0,0] rawloader-0.37.1/data/cameras/fuji/x10.toml000064400000000000000000000003550072674642500165150ustar 00000000000000make = "FUJIFILM" model = "X10" clean_make = "Fujifilm" clean_model = "FinePix X10" blackpoint = 256 whitepoint = 4000 color_matrix = [13509, -6199, -1254, -4430, 12733, 1865, -331, 1441, 5022] color_pattern = "BGGR" crops = [0,48,0,48] rawloader-0.37.1/data/cameras/fuji/x100.toml000064400000000000000000000003670072674642500166000ustar 00000000000000make = "FUJIFILM" model = "FinePix X100" clean_make = "Fujifilm" clean_model = "FinePix X100" blackpoint = 254 whitepoint = 4000 color_matrix = [12161, -4457, -1069, -5034, 12874, 2400, -795, 1724, 6904] color_pattern = "RGGB" crops = [1,73,1,73] rawloader-0.37.1/data/cameras/fuji/x100f.toml000064400000000000000000000004130072674642500167360ustar 00000000000000make = "FUJIFILM" model = "X100F" clean_make = "Fujifilm" clean_model = "X100F" blackpoint = 1024 whitepoint = 16383 color_matrix = [11434, -4948, -1210, -3746, 12042, 1903, -666, 1479, 5235] color_pattern = "RBGBRGGGRGGBGGBGGRBRGRBGGGBGGRGGRGGB" crops = [0,128,0,0] rawloader-0.37.1/data/cameras/fuji/x100s.toml000064400000000000000000000004120072674642500167520ustar 00000000000000make = "FUJIFILM" model = "X100S" clean_make = "Fujifilm" clean_model = "X100S" blackpoint = 1024 whitepoint = 16383 color_matrix = [10592, -4262, -1008, -3514, 11355, 2465, -870, 2025, 6386] color_pattern = "RBGBRGGGRGGBGGBGGRBRGRBGGGBGGRGGRGGB" crops = [0,52,0,4] rawloader-0.37.1/data/cameras/fuji/x100t.toml000064400000000000000000000004120072674642500167530ustar 00000000000000make = "FUJIFILM" model = "X100T" clean_make = "Fujifilm" clean_model = "X100T" blackpoint = 1024 whitepoint = 16383 color_matrix = [10592, -4262, -1008, -3514, 11355, 2465, -870, 2025, 6386] color_pattern = "RBGBRGGGRGGBGGBGGRBRGRBGGGBGGRGGRGGB" crops = [0,52,0,4] rawloader-0.37.1/data/cameras/fuji/x20.toml000064400000000000000000000004040072674642500165110ustar 00000000000000make = "FUJIFILM" model = "X20" clean_make = "Fujifilm" clean_model = "X20" blackpoint = 257 whitepoint = 4094 color_matrix = [11768, -4971, -1133, -4904, 12927, 2183, -480, 1723, 4605] color_pattern = "GBGGRGRGRBGBGBGGRGGRGGBGBGBRGRGRGGBG" crops = [0,64,0,0] rawloader-0.37.1/data/cameras/fuji/x30.toml000064400000000000000000000004030072674642500165110ustar 00000000000000make = "FUJIFILM" model = "X30" clean_make = "Fujifilm" clean_model = "X30" blackpoint = 257 whitepoint = 4094 color_matrix = [12328, -5256, -1144, -4469, 12927, 1675, -87, 1291, 4351] color_pattern = "GBGGRGRGRBGBGBGGRGGRGGBGBGBRGRGRGGBG" crops = [0,64,0,0] rawloader-0.37.1/data/cameras/fuji/x70.toml000064400000000000000000000004050072674642500165170ustar 00000000000000make = "FUJIFILM" model = "X70" clean_make = "Fujifilm" clean_model = "X70" blackpoint = 1024 whitepoint = 16383 color_matrix = [10450, -4329, -878, -3217, 11105, 2421, -752, 1758, 6519] color_pattern = "RBGBRGGGRGGBGGBGGRBRGRBGGGBGGRGGRGGB" crops = [0,52,0,4] rawloader-0.37.1/data/cameras/fuji/xf1.toml000064400000000000000000000003450072674642500166020ustar 00000000000000make = "FUJIFILM" model = "XF1" clean_make = "Fujifilm" clean_model = "XF1" blackpoint = 257 whitepoint = 4000 color_matrix = [13509, -6199, -1254, -4430, 12733, 1865, -331, 1441, 5022] color_pattern = "BGGR" crops = [0,48,0,48] rawloader-0.37.1/data/cameras/fuji/xq1.toml000064400000000000000000000004040072674642500166110ustar 00000000000000make = "FUJIFILM" model = "XQ1" clean_make = "Fujifilm" clean_model = "XQ1" blackpoint = 257 whitepoint = 4094 color_matrix = [9252, -2704, -1064, -5893, 14265, 1717, -1101, 2341, 4349] color_pattern = "GBGGRGRGRBGBGBGGRGGRGGBGBGBRGRGRGGBG" crops = [0,64,0,0] rawloader-0.37.1/data/cameras/fuji/xq2.toml000064400000000000000000000004040072674642500166120ustar 00000000000000make = "FUJIFILM" model = "XQ2" clean_make = "Fujifilm" clean_model = "XQ2" blackpoint = 257 whitepoint = 4094 color_matrix = [9252, -2704, -1064, -5893, 14265, 1717, -1101, 2341, 4349] color_pattern = "GBGGRGRGRBGBGBGGRGGRGGBGBGBRGRGRGGBG" crops = [0,64,0,0] rawloader-0.37.1/data/cameras/hasselblad/cf132.toml000064400000000000000000000003560072674642500200710ustar 00000000000000make = "Hasselblad" model = "Flash Sync" clean_make = "Hasselblad" clean_model = "CF132" blackpoint = 0 whitepoint = 62914 color_matrix = [8519, -3260, -280, -5081, 13459, 1738, -1449, 2960, 7809] color_pattern = "RGGB" crops = [0,0,0,0] rawloader-0.37.1/data/cameras/hasselblad/cfv-50.toml000064400000000000000000000003700072674642500202470ustar 00000000000000make = "Hasselblad" model = "Hasselblad CFV-50" clean_make = "Hasselblad" clean_model = "CFV-50" blackpoint = 0 whitepoint = 65535 color_matrix = [5656, -659, -346, -3923, 12306, 1791, -1602, 3509, 5442] color_pattern = "RGGB" crops = [4,40,80,42] rawloader-0.37.1/data/cameras/hasselblad/cfv.toml000064400000000000000000000003660072674642500200320ustar 00000000000000make = "Hasselblad" model = "Hasselblad 500 mech." clean_make = "Hasselblad" clean_model = "CFV" blackpoint = 0 whitepoint = 31456 color_matrix = [8519, -3260, -280, -5081, 13459, 1738, -1449, 2960, 7809] color_pattern = "RGGB" crops = [0,0,0,0] rawloader-0.37.1/data/cameras/hasselblad/h3d-39ii.toml000064400000000000000000000003550072674642500205030ustar 00000000000000make = "Hasselblad" model = "Hasselblad H3D" clean_make = "Hasselblad" clean_model = "H3D" blackpoint = 0 whitepoint = 31456 color_matrix = [3857, 452, -46, -6008, 14477, 1596, -2627, 4481, 5718] color_pattern = "RGGB" crops = [0,0,0,0] rawloader-0.37.1/data/cameras/hasselblad/h4d.toml000064400000000000000000000003720072674642500177300ustar 00000000000000make = "Hasselblad" model = "Hasselblad H4D-40" clean_make = "Hasselblad" clean_model = "H4D-40" blackpoint = 256 whitepoint = 62914 color_matrix = [6159, -1402, -177, -5439, 12762, 3007, -955, 2200, 7104] color_pattern = "RGGB" crops = [4,40,80,42] rawloader-0.37.1/data/cameras/hasselblad/h5d-40.toml000064400000000000000000000003720072674642500201520ustar 00000000000000make = "Hasselblad" model = "Hasselblad H5D-40" clean_make = "Hasselblad" clean_model = "H5D-40" blackpoint = 256 whitepoint = 62914 color_matrix = [6159, -1402, -177, -5439, 12762, 3007, -955, 2200, 7104] color_pattern = "RGGB" crops = [4,40,80,42] rawloader-0.37.1/data/cameras/hasselblad/h5d-50.toml000064400000000000000000000003730072674642500201540ustar 00000000000000make = "Hasselblad" model = "Hasselblad H5D-50c" clean_make = "Hasselblad" clean_model = "H5D-50c" blackpoint = 256 whitepoint = 62914 color_matrix = [4932, -835, 141, -4878, 11868, 3437, -1138, 1961, 7067] color_pattern = "RGGB" crops = [96,46,0,48] rawloader-0.37.1/data/cameras/hasselblad/h6d-100.toml000064400000000000000000000004040072674642500202240ustar 00000000000000make = "Hasselblad" model = "Hasselblad H6D-100cMS" clean_make = "Hasselblad" clean_model = "H6D-100cMS" blackpoint = 256 whitepoint = 62914 color_matrix = [5656, -659, -346, -3923, 12306, 1791, -1602, 3509, 5442] color_pattern = "RGGB" crops = [108,328,0,64] rawloader-0.37.1/data/cameras/hasselblad/x1d.toml000064400000000000000000000004120072674642500177400ustar 00000000000000make = "Hasselblad" model = "Hasselblad X1D" clean_make = "Hasselblad" clean_model = "X1D" blackpoint = 0 whitepoint = 65535 color_matrix = [4932, -835, 141, -4878, 11868, 3437, -1138, 1961, 7067] color_pattern = "RGGB" crops = [96,58,0,46] hints = ["uncompressed"] rawloader-0.37.1/data/cameras/join.rs000064400000000000000000000020600072674642500155530ustar 00000000000000use std::fs::File; use std::io::prelude::*; use std::env; use std::path::Path; extern crate glob; use self::glob::glob; extern crate toml; use toml::Value; extern crate rustc_version; use rustc_version::{version, Version}; fn main() { let out_dir = env::var("OUT_DIR").unwrap(); let dest_path = Path::new(&out_dir).join("all.toml"); let mut out = File::create(dest_path).unwrap(); for entry in glob("./data/cameras/*/**/*.toml").expect("Failed to read glob pattern") { out.write_all(b"[[cameras]]\n").unwrap(); let path = entry.unwrap(); let mut f = File::open(path.clone()).unwrap(); let mut toml = String::new(); f.read_to_string(&mut toml).unwrap(); { match toml.parse::() { Ok(_) => {}, Err(e) => panic!("Error parsing {:?}: {:?}", path, e), }; } out.write_all(&toml.into_bytes()).unwrap(); out.write_all(b"\n").unwrap(); } // Check for a minimum version if version().unwrap() < Version::parse("1.31.0").unwrap() { println!("cargo:rustc-cfg=needs_chunks_exact"); } } rawloader-0.37.1/data/cameras/kodak/dc120.toml000064400000000000000000000004620072674642500170510ustar 00000000000000make = "Eastman Kodak Company" model = "Kodak DC120 ZOOM Digital Camera" clean_make = "Kodak" clean_model = "DC120" blackpoint = 0 whitepoint = 255 # sRGB for lack of a better one color_matrix = [324045, -153713, -49853, -96926, 187601, 4155, 5564, -20402, 105722] color_pattern = "GRBG" crops = [0,0,0,0] rawloader-0.37.1/data/cameras/kodak/dcs1.toml000064400000000000000000000003720072674642500170720ustar 00000000000000make = "KODAK" model = "EOSDCS1B FILE VERSION 3" clean_make = "Kodak" clean_model = "EOS DCS 1" blackpoint = 19 whitepoint = 7638 color_matrix = [10592, -2206, -967, -1944, 11685, 230, 2206, 670, 1273] color_pattern = "GRBG" crops = [3,0,3,0] rawloader-0.37.1/data/cameras/kodak/dcs460d.toml000064400000000000000000000003670072674642500174130ustar 00000000000000make = "KODAK" model = "DCS460D FILE VERSION 3" clean_make = "Kodak" clean_model = "DCS460D" blackpoint = 7 whitepoint = 6664 color_matrix = [10592, -2206, -967, -1944, 11685, 230, 2206, 670, 1273] color_pattern = "GRBG" crops = [0,3,0,3] rawloader-0.37.1/data/cameras/kodak/dcs560c.toml000064400000000000000000000003740072674642500174110ustar 00000000000000make = "Kodak" model = "DCS560C" clean_make = "Kodak" clean_model = "DCS560C" blackpoint = 0 whitepoint = 4095 color_matrix = [20482, -7172, -3125, -1033, 10410, -285, 2542, 226, 3136] color_pattern = "GRBG" crops = [0,0,0,0] hints = ["linearization"] rawloader-0.37.1/data/cameras/kodak/dcs760c.toml000064400000000000000000000003410072674642500174050ustar 00000000000000make = "Kodak" model = "DCS760C" clean_make = "Kodak" clean_model = "DCS760C" blackpoint = 0 whitepoint = 3500 color_matrix = [16623, -6309, -1411, -4344, 13923, 323, 2285, 274, 2926] color_pattern = "GRBG" crops = [0,0,0,0] rawloader-0.37.1/data/cameras/kodak/dcs_pro.toml000064400000000000000000000003550072674642500176720ustar 00000000000000make = "Kodak" model = "DCS Pro SLR/n" clean_make = "Kodak" clean_model = "DCS Pro SLR/n" blackpoint = 0 whitepoint = 3700 color_matrix = [5494, 2393, -232, -6427, 13850, 2846, -1876, 3997, 5445] color_pattern = "GRBG" crops = [0,0,0,0] rawloader-0.37.1/data/cameras/kodak/dcs_pro14nx.toml000064400000000000000000000003530072674642500204030ustar 00000000000000make = "Kodak" model = "DCS Pro 14nx" clean_make = "Kodak" clean_model = "DCS Pro 14nx" blackpoint = 0 whitepoint = 3700 color_matrix = [5494, 2393, -232, -6427, 13850, 2846, -1876, 3997, 5445] color_pattern = "GRBG" crops = [0,0,0,0] rawloader-0.37.1/data/cameras/kodak/p712.toml000064400000000000000000000004060072674642500167270ustar 00000000000000make = "EASTMAN KODAK COMPANY" model = "KODAK P712 ZOOM DIGITAL CAMERA" clean_make = "Kodak" clean_model = "P712" blackpoint = 0 whitepoint = 4030 color_matrix = [9658, -3314, -823, -5163, 12695, 2768, -1342, 1843, 6044] color_pattern = "BGGR" crops = [0,0,0,0] rawloader-0.37.1/data/cameras/kodak/p880.toml000064400000000000000000000004100072674642500167300ustar 00000000000000make = "EASTMAN KODAK COMPANY" model = "KODAK P880 ZOOM DIGITAL CAMERA" clean_make = "Kodak" clean_model = "P880" blackpoint = 0 whitepoint = 4095 color_matrix = [12805, -4662, -1376, -7480, 15267, 2360, -1626, 2194, 7904] color_pattern = "BGGR" crops = [0,0,0,0] rawloader-0.37.1/data/cameras/kodak/z1015.toml000064400000000000000000000005000072674642500170110ustar 00000000000000make = "EASTMAN KODAK COMPANY" model = "KODAK EASYSHARE Z1015 IS DIGITAL CAMERA" clean_make = "Kodak" clean_model = "EasyShare Z1015 IS" blackpoint = 0 whitepoint = 4095 color_matrix = [11265, -4286, -992, -4694, 12343, 2647, -1090, 1523, 5447] color_pattern = "BGGR" crops = [0,0,0,0] hints = ["easyshare_offset_hack"] rawloader-0.37.1/data/cameras/kodak/z990.toml000064400000000000000000000004700072674642500167520ustar 00000000000000make = "EASTMAN KODAK COMPANY" model = "KODAK EasyShare Z990 Digital Camera" clean_make = "Kodak" clean_model = "EasyShare Z990" blackpoint = 0 whitepoint = 4000 color_matrix = [11749, -4048, -1309, -1867, 10572, 1489, -138, 1449, 4522] color_pattern = "BGGR" crops = [0,0,0,0] hints = ["easyshare_offset_hack"] rawloader-0.37.1/data/cameras/leaf/aptus22.toml000064400000000000000000000003550072674642500173570ustar 00000000000000make = "Creo/Leaf" model = "Leaf Aptus 22" clean_make = "Leaf" clean_model = "Aptus 22" blackpoint = 0 whitepoint = 16191 color_matrix = [8236, 1746, -1314, -8251, 15953, 2428, -3673, 5786, 5771] color_pattern = "RGGB" crops = [0,0,0,0] rawloader-0.37.1/data/cameras/leaf/aptus75.toml000064400000000000000000000003500072674642500173620ustar 00000000000000make = "Leaf" model = "Leaf Aptus 75" clean_make = "Leaf" clean_model = "Aptus 75" blackpoint = 0 whitepoint = 16191 color_matrix = [7914, 1414, -1190, -8777, 16582, 2280, -2811, 4605, 5562] color_pattern = "GBRG" crops = [0,0,0,0] rawloader-0.37.1/data/cameras/leaf/aptusII-10.toml000064400000000000000000000003620072674642500176510ustar 00000000000000make = "Leaf" model = "Leaf Aptus-II 10" clean_make = "Leaf" clean_model = "Leaf Aptus-II 10" blackpoint = 0 whitepoint = 15000 color_matrix = [7527, 1285, -166, -6929, 14061, 3176, -1995, 3747, 6077] color_pattern = "RGGB" crops = [0,0,0,0] rawloader-0.37.1/data/cameras/leaf/aptusII-10R.toml000064400000000000000000000003640072674642500177750ustar 00000000000000make = "Leaf" model = "Leaf Aptus-II 10R" clean_make = "Leaf" clean_model = "Leaf Aptus-II 10R" blackpoint = 0 whitepoint = 15000 color_matrix = [7527, 1285, -166, -6929, 14061, 3176, -1995, 3747, 6077] color_pattern = "GBRG" crops = [0,0,0,0] rawloader-0.37.1/data/cameras/leaf/aptusII-12.toml000064400000000000000000000004110072674642500176460ustar 00000000000000make = "Leaf" model = "Leaf Aptus-II 12" clean_make = "Leaf" clean_model = "Leaf Aptus-II 12" blackpoint = 0 whitepoint = 15000 color_matrix = [7527, 1285, -166, -6929, 14061, 3176, -1995, 3747, 6077] color_pattern = "RGGB" crops = [0,0,0,0] hints = ["interlaced"] rawloader-0.37.1/data/cameras/leaf/aptusII-5.toml000064400000000000000000000003550072674642500175770ustar 00000000000000make = "Leaf" model = "Leaf Aptus-II 5" clean_make = "Leaf" clean_model = "Aptus-II 5" blackpoint = 0 whitepoint = 15000 color_matrix = [1846, 7955, -1222, -12994, 19563, 3596, -2035, 3340, 5136] color_pattern = "GRBG" crops = [0,0,0,0] rawloader-0.37.1/data/cameras/leaf/aptusII-7.toml000064400000000000000000000003470072674642500176020ustar 00000000000000make = "Leaf" model = "Leaf AFi-II 7" clean_make = "Leaf" clean_model = "AFi-II 7" blackpoint = 0 whitepoint = 15000 color_matrix = [7691, -108, -339, -6185, 13627, 2833, -2046, 3899, 5952] color_pattern = "RGGB" crops = [0,0,0,0] rawloader-0.37.1/data/cameras/leaf/aptusII-8.toml000064400000000000000000000003530072674642500176000ustar 00000000000000make = "Leaf" model = "Leaf Aptus-II 8" clean_make = "Leaf" clean_model = "Aptus-II 8" blackpoint = 0 whitepoint = 15000 color_matrix = [6355, 1085, -140, -6929, 14061, 3176, -2008, 3771, 6117] color_pattern = "GBRG" crops = [0,0,0,0] rawloader-0.37.1/data/cameras/leaf/credo40.toml000064400000000000000000000003440072674642500173150ustar 00000000000000make = "Leaf" model = "Credo 40" clean_make = "Leaf" clean_model = "Credo 40" blackpoint = 0 whitepoint = 16383 color_matrix = [8035, 435, -962, -6001, 13872, 2320, -1159, 3065, 5434] color_pattern = "RGGB" crops = [6,16,46,36] rawloader-0.37.1/data/cameras/leaf/credo60.toml000064400000000000000000000003440072674642500173170ustar 00000000000000make = "Leaf" model = "Credo 60" clean_make = "Leaf" clean_model = "Credo 60" blackpoint = 0 whitepoint = 16383 color_matrix = [8035, 435, -962, -6001, 13872, 2320, -1159, 3065, 5434] color_pattern = "RGGB" crops = [6,16,46,36] rawloader-0.37.1/data/cameras/leaf/credo80.toml000064400000000000000000000003440072674642500173210ustar 00000000000000make = "Leaf" model = "Credo 80" clean_make = "Leaf" clean_model = "Credo 80" blackpoint = 0 whitepoint = 16383 color_matrix = [6294, 686, -712, -5435, 13417, 2211, -1006, 2435, 5042] color_pattern = "RGGB" crops = [8,16,48,36] rawloader-0.37.1/data/cameras/leica/digilux2.toml000064400000000000000000000004100072674642500177440ustar 00000000000000make = "LEICA" model = "DIGILUX 2" clean_make = "Leica" clean_model = "Digilux 2" blackpoint = 0 whitepoint = 4095 color_matrix = [11340, -4069, -1275, -7555, 15266, 2448, -2960, 3426, 7685] color_pattern = "RGGB" [[cameras.modes]] mode = "4:3" crops = [0,0,0,0] rawloader-0.37.1/data/cameras/leica/dlux109.toml000064400000000000000000000006570072674642500174400ustar 00000000000000make = "LEICA" model = "D-LUX (Typ 109)" clean_make = "Leica" clean_model = "D-LUX (Typ 109)" blackpoint = 143 whitepoint = 4095 color_matrix = [8844, -3538, -768, -3709, 11762, 2200, -698, 1792, 5220] color_pattern = "BGGR" [[cameras.modes]] mode = "3:2" crops = [0,80,0,0] [[cameras.modes]] mode = "4:3" crops = [0,16,0,0] [[cameras.modes]] mode = "1:1" crops = [0,144,0,0] [[cameras.modes]] mode = "16:9" crops = [0,96,0,0] rawloader-0.37.1/data/cameras/leica/dlux3.toml000064400000000000000000000004070072674642500172620ustar 00000000000000make = "LEICA" model = "D-LUX 3" clean_make = "Leica" clean_model = "D-LUX 3" blackpoint = 0 whitepoint = 3986 color_matrix = [8048, -2810, -623, -6450, 13519, 3272, -1700, 2146, 7049] color_pattern = "BGGR" [[cameras.modes]] mode = "16:9" crops = [17,65,24,17] rawloader-0.37.1/data/cameras/leica/vlux1.toml000064400000000000000000000004660072674642500173070ustar 00000000000000make = "LEICA" model = "V-LUX 1" clean_make = "Leica" clean_model = "V-LUX 1" blackpoint = 0 whitepoint = 3986 color_matrix = [7906, -2709, -594, -6231, 13351, 3220, -1922, 2631, 6537] color_pattern = "BGGR" [[cameras.modes]] mode = "4:3" crops = [0,14,3,4] [[cameras.modes]] mode = "3:2" crops = [0,14,3,4] rawloader-0.37.1/data/cameras/leica/vlux4.toml000064400000000000000000000004050072674642500173030ustar 00000000000000make = "LEICA" model = "V-LUX 4" clean_make = "LEICA" clean_model = "V-LUX 4" blackpoint = 143 whitepoint = 3956 color_matrix = [8112, -2563, -740, -3730, 11784, 2197, -941, 2075, 4933] color_pattern = "GBRG" [[cameras.modes]] mode = "4:3" crops = [0,128,3,0] rawloader-0.37.1/data/cameras/mamiya/zd.toml000064400000000000000000000003550072674642500170420ustar 00000000000000make = "Mamiya-OP Co.,Ltd." model = "MAMIYA ZD" clean_make = "Mamiya" clean_model = "ZD" blackpoint = 0 whitepoint = 4000 color_matrix = [7645, 2579, -1363, -8689, 16717, 2015, -3712, 5941, 5961] color_pattern = "RGGB" crops = [0,0,0,0] rawloader-0.37.1/data/cameras/minolta/5.toml000064400000000000000000000003620072674642500167550ustar 00000000000000make = "Minolta Co., Ltd." model = "DiMAGE 5" clean_make = "Minolta" clean_model = "DiMAGE 5" blackpoint = 0 whitepoint = 3965 color_matrix = [8983, -2942, -963, -6556, 14476, 2237, -2426, 2887, 8014] color_pattern = "RGGB" crops = [0,0,0,0] rawloader-0.37.1/data/cameras/minolta/5d.toml000064400000000000000000000003570072674642500171250ustar 00000000000000make = "KONICA MINOLTA" model = "DYNAX 5D" clean_make = "Minolta" clean_model = "Dynax 5D" blackpoint = 0 whitepoint = 4095 color_matrix = [10284, -3283, -1086, -7957, 15762, 2316, -829, 882, 6644] color_pattern = "RGGB" crops = [0,0,0,0] rawloader-0.37.1/data/cameras/minolta/7.toml000064400000000000000000000003620072674642500167570ustar 00000000000000make = "Minolta Co., Ltd." model = "DiMAGE 7" clean_make = "Minolta" clean_model = "DiMAGE 7" blackpoint = 0 whitepoint = 3965 color_matrix = [9144, -2777, -998, -6676, 14556, 2281, -2470, 3019, 7744] color_pattern = "RGGB" crops = [0,0,0,0] rawloader-0.37.1/data/cameras/minolta/7d.toml000064400000000000000000000003570072674642500171270ustar 00000000000000make = "KONICA MINOLTA" model = "DYNAX 7D" clean_make = "Minolta" clean_model = "Dynax 7D" blackpoint = 0 whitepoint = 4095 color_matrix = [10239, -3104, -1099, -8037, 15727, 2451, -927, 925, 6871] color_pattern = "RGGB" crops = [0,0,0,0] rawloader-0.37.1/data/cameras/minolta/7hi.toml000064400000000000000000000003700072674642500172770ustar 00000000000000make = "Minolta Co., Ltd." model = "DiMAGE 7Hi" clean_make = "Minolta" clean_model = "DiMAGE 7Hi" blackpoint = 0 whitepoint = 3965 color_matrix = [11368, -3894, -1242, -6521, 14358, 2339, -2475, 3056, 7285] color_pattern = "RGGB" crops = [0,0,0,0] rawloader-0.37.1/data/cameras/minolta/7i.toml000064400000000000000000000003660072674642500171340ustar 00000000000000make = "Minolta Co., Ltd." model = "DiMAGE 7i" clean_make = "Minolta" clean_model = "DiMAGE 7i" blackpoint = 0 whitepoint = 3965 color_matrix = [10880, -3638, -1186, -6496, 14313, 2364, -2456, 3092, 7485] color_pattern = "RGGB" crops = [0,0,0,0] rawloader-0.37.1/data/cameras/minolta/a1.toml000064400000000000000000000003650072674642500171150ustar 00000000000000make = "Minolta Co., Ltd." model = "DiMAGE A1" clean_make = "Minolta" clean_model = "DiMAGE A1" blackpoint = 0 whitepoint = 3965 color_matrix = [9274, -2547, -1167, -8220, 16323, 1943, -2273, 2720, 8340] color_pattern = "RGGB" crops = [0,0,0,0] rawloader-0.37.1/data/cameras/minolta/a2.toml000064400000000000000000000003750072674642500171170ustar 00000000000000make = "Konica Minolta Camera, Inc." model = "DiMAGE A2" clean_make = "Minolta" clean_model = "DiMAGE A2" blackpoint = 0 whitepoint = 3965 color_matrix = [9097, -2726, -1053, -8073, 15506, 2762, -966, 981, 7763] color_pattern = "RGGB" crops = [0,0,0,0] rawloader-0.37.1/data/cameras/minolta/a200.toml000064400000000000000000000004140072674642500172510ustar 00000000000000make = "KONICA MINOLTA" model = "DiMAGE A200" clean_make = "Minolta" clean_model = "DiMAGE A200" blackpoint = 0 whitepoint = 3965 color_matrix = [8560, -2487, -986, -8112, 15535, 2771, -1209, 1324, 7743] color_pattern = "GBRG" crops = [0,0,0,0] hints = ["swapped_wb"] rawloader-0.37.1/data/cameras/nikon/1aw1.toml000064400000000000000000000004210072674642500170310ustar 00000000000000make = "NIKON CORPORATION" model = "NIKON 1 AW1" clean_make = "Nikon" clean_model = "1 AW1" color_matrix = [6588, -1305, -693, -3277, 10987, 2634, -355, 2016, 5106] color_pattern = "RGGB" crops = [0,0,0,0] [[cameras.modes]] mode = "12bit" blackpoint = 0 whitepoint = 3300 rawloader-0.37.1/data/cameras/nikon/1j1.toml000064400000000000000000000004170072674642500166600ustar 00000000000000make = "NIKON CORPORATION" model = "NIKON 1 J1" clean_make = "Nikon" clean_model = "1 J1" color_matrix = [8994, -2667, -865, -4594, 12324, 2552, -699, 1786, 6260] color_pattern = "RGGB" crops = [0,0,2,0] [[cameras.modes]] mode = "12bit" blackpoint = 0 whitepoint = 3300 rawloader-0.37.1/data/cameras/nikon/1j2.toml000064400000000000000000000004170072674642500166610ustar 00000000000000make = "NIKON CORPORATION" model = "NIKON 1 J2" clean_make = "Nikon" clean_model = "1 J2" color_matrix = [8994, -2667, -865, -4594, 12324, 2552, -699, 1786, 6260] color_pattern = "RGGB" crops = [0,0,2,0] [[cameras.modes]] mode = "12bit" blackpoint = 0 whitepoint = 3300 rawloader-0.37.1/data/cameras/nikon/1j3.toml000064400000000000000000000004170072674642500166620ustar 00000000000000make = "NIKON CORPORATION" model = "NIKON 1 J3" clean_make = "Nikon" clean_model = "1 J3" color_matrix = [6588, -1305, -693, -3277, 10987, 2634, -355, 2016, 5106] color_pattern = "RGGB" crops = [0,0,2,0] [[cameras.modes]] mode = "12bit" blackpoint = 0 whitepoint = 3300 rawloader-0.37.1/data/cameras/nikon/1j5.toml000064400000000000000000000004210072674642500166570ustar 00000000000000make = "NIKON CORPORATION" model = "NIKON 1 J5" clean_make = "Nikon" clean_model = "1 J5" color_matrix = [7520, -2518, -645, -3844, 12102, 1945, -913, 2249, 6835] color_pattern = "RGGB" crops = [0,0,0,0] [[cameras.modes]] mode = "12bit" blackpoint = 200 whitepoint = 3800 rawloader-0.37.1/data/cameras/nikon/1s2.toml000064400000000000000000000004210072674642500166650ustar 00000000000000make = "NIKON CORPORATION" model = "NIKON 1 S2" clean_make = "Nikon" clean_model = "1 S2" color_matrix = [6612, -1342, -618, -3338, 11055, 2623, -174, 1792, 5075] color_pattern = "RGGB" crops = [0,0,0,0] [[cameras.modes]] mode = "12bit" blackpoint = 200 whitepoint = 4095 rawloader-0.37.1/data/cameras/nikon/1v2.toml000064400000000000000000000004170072674642500166750ustar 00000000000000make = "NIKON CORPORATION" model = "NIKON 1 V2" clean_make = "Nikon" clean_model = "1 V2" color_matrix = [6588, -1305, -693, -3277, 10987, 2634, -355, 2016, 5106] color_pattern = "RGGB" crops = [0,0,0,0] [[cameras.modes]] mode = "12bit" blackpoint = 0 whitepoint = 4095 rawloader-0.37.1/data/cameras/nikon/1v3.toml000064400000000000000000000004210072674642500166710ustar 00000000000000make = "NIKON CORPORATION" model = "NIKON 1 V3" clean_make = "Nikon" clean_model = "1 V3" color_matrix = [5958, -1559, -571, -4021, 11453, 2939, -634, 1548, 5087] color_pattern = "RGGB" crops = [0,0,0,0] [[cameras.modes]] mode = "12bit" blackpoint = 200 whitepoint = 4000 rawloader-0.37.1/data/cameras/nikon/b700.toml000064400000000000000000000004170072674642500167350ustar 00000000000000make = "NIKON" model = "COOLPIX B700" clean_make = "Nikon" clean_model = "Coolpix B700" color_matrix = [14387, -6014, -1299, -1357, 9975, 1616, 467, 1047, 4744] color_pattern = "RGGB" crops = [0,0,0,0] [[cameras.modes]] mode = "12bit" blackpoint = 200 whitepoint = 4000 rawloader-0.37.1/data/cameras/nikon/coolpixa.toml000064400000000000000000000004260072674642500201030ustar 00000000000000make = "NIKON CORPORATION" model = "COOLPIX A" clean_make = "Nikon" clean_model = "Coolpix A" color_matrix = [8198, -2239, -724, -4871, 12389, 2798, -1043, 2050, 7181] color_pattern = "RGGB" crops = [0,44,0,0] [[cameras.modes]] mode = "14bit" blackpoint = 0 whitepoint = 15892 rawloader-0.37.1/data/cameras/nikon/d1.toml000064400000000000000000000004160072674642500165700ustar 00000000000000make = "NIKON CORPORATION" model = "NIKON D1" clean_make = "Nikon" clean_model = "D1" color_matrix = [7559, -2130, -965, -7611, 15713, 1972, -2478, 3042, 8290] color_pattern = "BGGR" crops = [0,12,12,0] [[cameras.modes]] mode = "12bit" blackpoint = 0 whitepoint = 4095 rawloader-0.37.1/data/cameras/nikon/d100.toml000064400000000000000000000004170072674642500167310ustar 00000000000000make = "NIKON CORPORATION" model = "NIKON D100" clean_make = "Nikon" clean_model = "D100" color_matrix = [5902, -933, -782, -8983, 16719, 2354, -1402, 1455, 6464] color_pattern = "GRBG" crops = [0,0,0,2] [[cameras.modes]] mode = "12bit" blackpoint = 0 whitepoint = 4095 rawloader-0.37.1/data/cameras/nikon/d1x.toml000064400000000000000000000004160072674642500167600ustar 00000000000000make = "NIKON CORPORATION" model = "NIKON D1X" clean_make = "Nikon" clean_model = "D1X" color_matrix = [7702, -2245, -975, -9114, 17242, 1875, -2679, 3055, 8521] color_pattern = "BGGR" crops = [0,0,0,0] [[cameras.modes]] mode = "12bit" blackpoint = 0 whitepoint = 4095 rawloader-0.37.1/data/cameras/nikon/d200.toml000064400000000000000000000004200072674642500167240ustar 00000000000000make = "NIKON CORPORATION" model = "NIKON D200" clean_make = "Nikon" clean_model = "D200" color_matrix = [8367, -2248, -763, -8758, 16447, 2422, -1527, 1550, 8053] color_pattern = "GRBG" crops = [0,0,0,2] [[cameras.modes]] mode = "12bit" blackpoint = 0 whitepoint = 3880 rawloader-0.37.1/data/cameras/nikon/d2x.toml000064400000000000000000000004170072674642500167620ustar 00000000000000make = "NIKON CORPORATION" model = "NIKON D2X" clean_make = "Nikon" clean_model = "D2X" color_matrix = [10231, -2769, -1255, -8301, 15900, 2552, -797, 680, 7148] color_pattern = "RGGB" crops = [0,32,8,0] [[cameras.modes]] mode = "12bit" blackpoint = 0 whitepoint = 3880 rawloader-0.37.1/data/cameras/nikon/d3.toml000064400000000000000000000004150072674642500165710ustar 00000000000000make = "NIKON CORPORATION" model = "NIKON D3" clean_make = "Nikon" clean_model = "D3" color_matrix = [8139, -2171, -663, -8747, 16541, 2295, -1925, 2008, 8093] color_pattern = "RGGB" crops = [0,0,0,2] [[cameras.modes]] mode = "14bit" blackpoint = 0 whitepoint = 15892 rawloader-0.37.1/data/cameras/nikon/d300.toml000064400000000000000000000005240072674642500167320ustar 00000000000000make = "NIKON CORPORATION" model = "NIKON D300" clean_make = "Nikon" clean_model = "D300" color_matrix = [9030, -1992, -715, -8465, 16302, 2255, -2689, 3217, 8069] color_pattern = "RGGB" crops = [0,0,0,0] [[cameras.modes]] mode = "12bit" blackpoint = 0 whitepoint = 3808 [[cameras.modes]] mode = "14bit" blackpoint = 0 whitepoint = 15236 rawloader-0.37.1/data/cameras/nikon/d3000.toml000064400000000000000000000004220072674642500170070ustar 00000000000000make = "NIKON CORPORATION" model = "NIKON D3000" clean_make = "Nikon" clean_model = "D3000" color_matrix = [8736, -2458, -935, -9075, 16894, 2251, -1354, 1242, 8263] color_pattern = "GBRG" crops = [0,2,3,0] [[cameras.modes]] mode = "12bit" blackpoint = 0 whitepoint = 3880 rawloader-0.37.1/data/cameras/nikon/d300s.toml000064400000000000000000000004230072674642500171130ustar 00000000000000make = "NIKON CORPORATION" model = "NIKON D300S" clean_make = "Nikon" clean_model = "D300S" color_matrix = [9030, -1992, -716, -8465, 16302, 2256, -2689, 3217, 8069] color_pattern = "RGGB" crops = [0,0,0,0] [[cameras.modes]] mode = "14bit" blackpoint = 0 whitepoint = 15236 rawloader-0.37.1/data/cameras/nikon/d3100.toml000064400000000000000000000004230072674642500170110ustar 00000000000000make = "NIKON CORPORATION" model = "NIKON D3100" clean_make = "Nikon" clean_model = "D3100" color_matrix = [7911, -2167, -813, -5327, 13150, 2408, -1288, 2483, 7968] color_pattern = "GBRG" crops = [2,24,2,8] [[cameras.modes]] mode = "12bit" blackpoint = 0 whitepoint = 3880 rawloader-0.37.1/data/cameras/nikon/d3200.toml000064400000000000000000000004230072674642500170120ustar 00000000000000make = "NIKON CORPORATION" model = "NIKON D3200" clean_make = "Nikon" clean_model = "D3200" color_matrix = [7013, -1408, -635, -5268, 12902, 2640, -1470, 2801, 7379] color_pattern = "RGGB" crops = [0,48,0,0] [[cameras.modes]] mode = "12bit" blackpoint = 0 whitepoint = 3880 rawloader-0.37.1/data/cameras/nikon/d3300.toml000064400000000000000000000004240072674642500170140ustar 00000000000000make = "NIKON CORPORATION" model = "NIKON D3300" clean_make = "Nikon" clean_model = "D3300" color_matrix = [6988, -1384, -714, -5631, 13410, 2447, -1485, 2204, 7318] color_pattern = "RGGB" crops = [8,8,8,8] [[cameras.modes]] mode = "12bit" blackpoint = 150 whitepoint = 3880 rawloader-0.37.1/data/cameras/nikon/d3400.toml000064400000000000000000000004240072674642500170150ustar 00000000000000make = "NIKON CORPORATION" model = "NIKON D3400" clean_make = "Nikon" clean_model = "D3400" color_matrix = [6988, -1384, -714, -5631, 13410, 2447, -1485, 2204, 7318] color_pattern = "RGGB" crops = [0,0,0,0] [[cameras.modes]] mode = "12bit" blackpoint = 150 whitepoint = 3880 rawloader-0.37.1/data/cameras/nikon/d3x.toml000064400000000000000000000004170072674642500167630ustar 00000000000000make = "NIKON CORPORATION" model = "NIKON D3X" clean_make = "Nikon" clean_model = "D3X" color_matrix = [7171, -1986, -648, -8085, 15555, 2718, -2170, 2512, 7457] color_pattern = "RGGB" crops = [0,0,0,0] [[cameras.modes]] mode = "14bit" blackpoint = 0 whitepoint = 15892 rawloader-0.37.1/data/cameras/nikon/d4.toml000064400000000000000000000005210072674642500165700ustar 00000000000000make = "NIKON CORPORATION" model = "NIKON D4" clean_make = "Nikon" clean_model = "D4" color_matrix = [8598, -2848, -857, -5618, 13606, 2195, -1002, 1773, 7137] color_pattern = "RGGB" crops = [0,50,0,2] [[cameras.modes]] mode = "14bit" blackpoint = 0 whitepoint = 15520 [[cameras.modes]] mode = "12bit" blackpoint = 0 whitepoint = 3880 rawloader-0.37.1/data/cameras/nikon/d40.toml000064400000000000000000000004140072674642500166510ustar 00000000000000make = "NIKON CORPORATION" model = "NIKON D40" clean_make = "Nikon" clean_model = "D40" color_matrix = [6992, -1668, -806, -8138, 15748, 2543, -874, 850, 7897] color_pattern = "BGGR" crops = [0,2,0,0] [[cameras.modes]] mode = "12bit" blackpoint = 0 whitepoint = 3880 rawloader-0.37.1/data/cameras/nikon/d40x.toml000064400000000000000000000004200072674642500170360ustar 00000000000000make = "NIKON CORPORATION" model = "NIKON D40X" clean_make = "Nikon" clean_model = "D40X" color_matrix = [8819, -2543, -911, -9025, 16928, 2151, -1329, 1213, 8449] color_pattern = "GBRG" crops = [0,0,0,4] [[cameras.modes]] mode = "12bit" blackpoint = 0 whitepoint = 3880 rawloader-0.37.1/data/cameras/nikon/d4s.toml000064400000000000000000000005260072674642500167600ustar 00000000000000make = "NIKON CORPORATION" model = "NIKON D4S" clean_make = "Nikon" clean_model = "D4S" color_matrix = [8598, -2848, -857, -5618, 13606, 2195, -1002, 1773, 7137] color_pattern = "RGGB" crops = [0,0,0,0] [[cameras.modes]] mode = "14bit" blackpoint = 768 whitepoint = 15520 [[cameras.modes]] mode = "12bit" blackpoint = 192 whitepoint = 3880 rawloader-0.37.1/data/cameras/nikon/d5.toml000064400000000000000000000004160072674642500165740ustar 00000000000000make = "NIKON CORPORATION" model = "NIKON D5" clean_make = "Nikon" clean_model = "D5" color_matrix = [9200, -3522, -992, -5755, 13803, 2117, -753, 1486, 6338] color_pattern = "RGGB" crops = [0,0,0,0] [[cameras.modes]] mode = "14bit" blackpoint = 400 whitepoint = 15520 rawloader-0.37.1/data/cameras/nikon/d50.toml000064400000000000000000000004140072674642500166520ustar 00000000000000make = "NIKON CORPORATION" model = "NIKON D50" clean_make = "Nikon" clean_model = "D50" color_matrix = [7732, -2422, -789, -8238, 15884, 2498, -859, 783, 7330] color_pattern = "BGGR" crops = [0,2,2,0] [[cameras.modes]] mode = "12bit" blackpoint = 0 whitepoint = 4095 rawloader-0.37.1/data/cameras/nikon/d500.toml000064400000000000000000000005310072674642500167320ustar 00000000000000make = "NIKON CORPORATION" model = "NIKON D500" clean_make = "Nikon" clean_model = "D500" color_matrix = [8813, -3210, -1036, -4703, 12868, 2021, -1054, 1940, 6129] color_pattern = "RGGB" crops = [0,0,0,0] [[cameras.modes]] mode = "14bit" blackpoint = 400 whitepoint = 15520 [[cameras.modes]] mode = "12bit" blackpoint = 100 whitepoint = 3880 rawloader-0.37.1/data/cameras/nikon/d5000.toml000064400000000000000000000004220072674642500170110ustar 00000000000000make = "NIKON CORPORATION" model = "NIKON D5000" clean_make = "Nikon" clean_model = "D5000" color_matrix = [7309, -1403, -519, -8474, 16008, 2622, -2433, 2826, 8064] color_pattern = "GBRG" crops = [0,0,0,0] [[cameras.modes]] mode = "12bit" blackpoint = 0 whitepoint = 3767 rawloader-0.37.1/data/cameras/nikon/d5100.toml000064400000000000000000000004240072674642500170140ustar 00000000000000make = "NIKON CORPORATION" model = "NIKON D5100" clean_make = "Nikon" clean_model = "D5100" color_matrix = [8198, -2239, -724, -4871, 12389, 2798, -1043, 2050, 7181] color_pattern = "RGGB" crops = [0,46,0,0] [[cameras.modes]] mode = "14bit" blackpoint = 0 whitepoint = 15892 rawloader-0.37.1/data/cameras/nikon/d5200.toml000064400000000000000000000004230072674642500170140ustar 00000000000000make = "NIKON CORPORATION" model = "NIKON D5200" clean_make = "Nikon" clean_model = "D5200" color_matrix = [8322, -3112, -1047, -6367, 14342, 2179, -988, 1638, 6394] color_pattern = "RGGB" crops = [0,0,0,0] [[cameras.modes]] mode = "14bit" blackpoint = 0 whitepoint = 15892 rawloader-0.37.1/data/cameras/nikon/d5300.toml000064400000000000000000000005320072674642500170160ustar 00000000000000make = "NIKON CORPORATION" model = "NIKON D5300" clean_make = "Nikon" clean_model = "D5300" color_matrix = [6988, -1384, -714, -5631, 13410, 2447, -1485, 2204, 7318] color_pattern = "RGGB" crops = [0,0,0,0] [[cameras.modes]] mode = "12bit" blackpoint = 150 whitepoint = 3972 [[cameras.modes]] mode = "14bit" blackpoint = 600 whitepoint = 15892 rawloader-0.37.1/data/cameras/nikon/d5500.toml000064400000000000000000000005310072674642500170170ustar 00000000000000make = "NIKON CORPORATION" model = "NIKON D5500" clean_make = "Nikon" clean_model = "D5500" color_matrix = [8821, -2938, -785, -4178, 12142, 2287, -824, 1651, 6860] color_pattern = "RGGB" crops = [0,0,0,0] [[cameras.modes]] mode = "14bit" blackpoint = 600 whitepoint = 15892 [[cameras.modes]] mode = "12bit" blackpoint = 150 whitepoint = 3972 rawloader-0.37.1/data/cameras/nikon/d5600.toml000064400000000000000000000005310072674642500170200ustar 00000000000000make = "NIKON CORPORATION" model = "NIKON D5600" clean_make = "Nikon" clean_model = "D5600" color_matrix = [8821, -2938, -785, -4178, 12142, 2287, -824, 1651, 6860] color_pattern = "RGGB" crops = [0,0,0,0] [[cameras.modes]] mode = "14bit" blackpoint = 600 whitepoint = 15892 [[cameras.modes]] mode = "12bit" blackpoint = 150 whitepoint = 3972 rawloader-0.37.1/data/cameras/nikon/d60.toml000064400000000000000000000004160072674642500166550ustar 00000000000000make = "NIKON CORPORATION" model = "NIKON D60" clean_make = "Nikon" clean_model = "D60" color_matrix = [8736, -2458, -935, -9075, 16894, 2251, -1354, 1242, 8263] color_pattern = "GBRG" crops = [0,0,0,0] [[cameras.modes]] mode = "12bit" blackpoint = 0 whitepoint = 3880 rawloader-0.37.1/data/cameras/nikon/d600.toml000064400000000000000000000005250072674642500167360ustar 00000000000000make = "NIKON CORPORATION" model = "NIKON D600" clean_make = "Nikon" clean_model = "D600" color_matrix = [8178, -2245, -609, -4857, 12394, 2776, -1207, 2086, 7298] color_pattern = "RGGB" crops = [0,50,0,0] [[cameras.modes]] mode = "14bit" blackpoint = 0 whitepoint = 15520 [[cameras.modes]] mode = "12bit" blackpoint = 0 whitepoint = 3880 rawloader-0.37.1/data/cameras/nikon/d610.toml000064400000000000000000000005250072674642500167370ustar 00000000000000make = "NIKON CORPORATION" model = "NIKON D610" clean_make = "Nikon" clean_model = "D610" color_matrix = [8178, -2245, -609, -4857, 12394, 2776, -1207, 2086, 7298] color_pattern = "RGGB" crops = [0,50,0,0] [[cameras.modes]] mode = "14bit" blackpoint = 0 whitepoint = 15520 [[cameras.modes]] mode = "12bit" blackpoint = 0 whitepoint = 3880 rawloader-0.37.1/data/cameras/nikon/d70.toml000064400000000000000000000004140072674642500166540ustar 00000000000000make = "NIKON CORPORATION" model = "NIKON D70" clean_make = "Nikon" clean_model = "D70" color_matrix = [7732, -2422, -789, -8238, 15884, 2498, -859, 783, 7330] color_pattern = "BGGR" crops = [0,2,0,0] [[cameras.modes]] mode = "12bit" blackpoint = 0 whitepoint = 4095 rawloader-0.37.1/data/cameras/nikon/d700.toml000064400000000000000000000005240072674642500167360ustar 00000000000000make = "NIKON CORPORATION" model = "NIKON D700" clean_make = "Nikon" clean_model = "D700" color_matrix = [8139, -2171, -663, -8747, 16541, 2295, -1925, 2008, 8093] color_pattern = "RGGB" crops = [0,0,0,2] [[cameras.modes]] mode = "14bit" blackpoint = 0 whitepoint = 15892 [[cameras.modes]] mode = "12bit" blackpoint = 0 whitepoint = 3972 rawloader-0.37.1/data/cameras/nikon/d7000.toml000064400000000000000000000005270072674642500170210ustar 00000000000000make = "NIKON CORPORATION" model = "NIKON D7000" clean_make = "Nikon" clean_model = "D7000" color_matrix = [8198, -2239, -724, -4871, 12389, 2798, -1043, 2050, 7181] color_pattern = "RGGB" crops = [0,46,2,0] [[cameras.modes]] mode = "14bit" blackpoint = 0 whitepoint = 15892 [[cameras.modes]] mode = "12bit" blackpoint = 0 whitepoint = 3972 rawloader-0.37.1/data/cameras/nikon/d70s.toml000064400000000000000000000004160072674642500170410ustar 00000000000000make = "NIKON CORPORATION" model = "NIKON D70s" clean_make = "Nikon" clean_model = "D70s" color_matrix = [7732, -2422, -789, -8238, 15884, 2498, -859, 783, 7330] color_pattern = "BGGR" crops = [0,0,0,0] [[cameras.modes]] mode = "12bit" blackpoint = 0 whitepoint = 4095 rawloader-0.37.1/data/cameras/nikon/d7100.toml000064400000000000000000000005260072674642500170210ustar 00000000000000make = "NIKON CORPORATION" model = "NIKON D7100" clean_make = "Nikon" clean_model = "D7100" color_matrix = [8322, -3112, -1047, -6367, 14342, 2179, -988, 1638, 6394] color_pattern = "RGGB" crops = [0,0,0,0] [[cameras.modes]] mode = "14bit" blackpoint = 0 whitepoint = 15892 [[cameras.modes]] mode = "12bit" blackpoint = 0 whitepoint = 3972 rawloader-0.37.1/data/cameras/nikon/d7200.toml000064400000000000000000000005320072674642500170170ustar 00000000000000make = "NIKON CORPORATION" model = "NIKON D7200" clean_make = "Nikon" clean_model = "D7200" color_matrix = [8322, -3112, -1047, -6367, 14342, 2179, -988, 1638, 6394] color_pattern = "RGGB" crops = [0,0,0,0] [[cameras.modes]] mode = "14bit" blackpoint = 600 whitepoint = 15892 [[cameras.modes]] mode = "12bit" blackpoint = 150 whitepoint = 3972 rawloader-0.37.1/data/cameras/nikon/d750.toml000064400000000000000000000005270072674642500167460ustar 00000000000000make = "NIKON CORPORATION" model = "NIKON D750" clean_make = "Nikon" clean_model = "D750" color_matrix = [9020, -2890, -715, -4535, 12436, 2348, -934, 1919, 7086] color_pattern = "RGGB" crops = [0,0,0,0] [[cameras.modes]] mode = "14bit" blackpoint = 600 whitepoint = 15520 [[cameras.modes]] mode = "12bit" blackpoint = 150 whitepoint = 3880 rawloader-0.37.1/data/cameras/nikon/d7500.toml000064400000000000000000000005550072674642500170270ustar 00000000000000make = "NIKON CORPORATION" model = "NIKON D7500" clean_make = "NIKON CORPORATION" clean_model = "NIKON D7500" color_matrix = [8813, -3210, -1036, -4703, 12868, 2021, -1054, 1940, 6129] color_pattern = "RGGB" crops = [0,0,0,0] [[cameras.modes]] mode = "12bit" blackpoint = 100 whitepoint = 3880 [[cameras.modes]] mode = "14bit" blackpoint = 400 whitepoint = 15520 rawloader-0.37.1/data/cameras/nikon/d80.toml000064400000000000000000000004160072674642500166570ustar 00000000000000make = "NIKON CORPORATION" model = "NIKON D80" clean_make = "Nikon" clean_model = "D80" color_matrix = [8629, -2410, -883, -9055, 16940, 2171, -1490, 1363, 8520] color_pattern = "GBRG" crops = [0,0,0,0] [[cameras.modes]] mode = "12bit" blackpoint = 0 whitepoint = 3880 rawloader-0.37.1/data/cameras/nikon/d800.toml000064400000000000000000000006070072674642500167410ustar 00000000000000make = "NIKON CORPORATION" model = "NIKON D800" clean_make = "Nikon" clean_model = "D800" model_aliases = [ ["NIKON D800E", "D800E"], ] color_matrix = [7866, -2108, -555, -4869, 12483, 2681, -1176, 2069, 7501] color_pattern = "RGGB" crops = [0,48,0,2] [[cameras.modes]] mode = "12bit" blackpoint = 0 whitepoint = 3880 [[cameras.modes]] mode = "14bit" blackpoint = 0 whitepoint = 15520 rawloader-0.37.1/data/cameras/nikon/d810.toml000064400000000000000000000005270072674642500167430ustar 00000000000000make = "NIKON CORPORATION" model = "NIKON D810" clean_make = "Nikon" clean_model = "D810" color_matrix = [9369, -3195, -791, -4488, 12430, 2301, -893, 1796, 6872] color_pattern = "RGGB" crops = [0,0,0,0] [[cameras.modes]] mode = "12bit" blackpoint = 150 whitepoint = 3880 [[cameras.modes]] mode = "14bit" blackpoint = 600 whitepoint = 15520 rawloader-0.37.1/data/cameras/nikon/d850.toml000064400000000000000000000005550072674642500167500ustar 00000000000000make = "NIKON CORPORATION" model = "NIKON D850" clean_make = "NIKON CORPORATION" clean_model = "NIKON D850" color_matrix = [10405, -3755, -1270, -5461, 13787, 1793, -1040, 2015, 6785] color_pattern = "RGGB" crops = [0,0,0,0] [[cameras.modes]] mode = "12bit" blackpoint = 100 whitepoint = 3880 [[cameras.modes]] mode = "14bit" blackpoint = 400 whitepoint = 15520 rawloader-0.37.1/data/cameras/nikon/d90.toml000064400000000000000000000004160072674642500166600ustar 00000000000000make = "NIKON CORPORATION" model = "NIKON D90" clean_make = "Nikon" clean_model = "D90" color_matrix = [7309, -1403, -519, -8474, 16008, 2622, -2434, 2826, 8064] color_pattern = "GBRG" crops = [0,0,0,0] [[cameras.modes]] mode = "12bit" blackpoint = 0 whitepoint = 3767 rawloader-0.37.1/data/cameras/nikon/df.toml000064400000000000000000000005210072674642500166520ustar 00000000000000make = "NIKON CORPORATION" model = "NIKON Df" clean_make = "Nikon" clean_model = "Df" color_matrix = [8598, -2848, -857, -5618, 13606, 2195, -1002, 1773, 7137] color_pattern = "RGGB" crops = [0,50,0,2] [[cameras.modes]] mode = "14bit" blackpoint = 0 whitepoint = 15520 [[cameras.modes]] mode = "12bit" blackpoint = 0 whitepoint = 3880 rawloader-0.37.1/data/cameras/nikon/ds200.toml000064400000000000000000000004230072674642500171120ustar 00000000000000make = "NIKON CORPORATION" model = "NIKON D5200" clean_make = "Nikon" clean_model = "D5200" color_matrix = [8322, -3112, -1047, -6367, 14342, 2179, -988, 1638, 6394] color_pattern = "RGGB" crops = [0,0,0,0] [[cameras.modes]] mode = "14bit" blackpoint = 0 whitepoint = 15892 rawloader-0.37.1/data/cameras/nikon/e5400.toml000064400000000000000000000003700072674642500170200ustar 00000000000000make = "NIKON" model = "E5400" clean_make = "Nikon" clean_model = "E5400" blackpoint = 0 whitepoint = 4095 color_matrix = [9349, -2987, -1001, -7919, 15766, 2266, -2098, 2680, 6839] color_pattern = "BGGR" crops = [0,0,0,0] hints = ["coolpixsplit"] rawloader-0.37.1/data/cameras/nikon/e5700.toml000064400000000000000000000004170072674642500170250ustar 00000000000000make = "NIKON" model = "E5700" clean_make = "Nikon" clean_model = "E5700" blackpoint = 0 whitepoint = 4095 color_matrix = [-5368, 11478, 2368, 5537, -113, 3148, -4969, 10021, 5782, 778, 9028, 211] color_pattern = "RGEB" crops = [0,0,0,0] hints = ["coolpixsplit", "nowb"] rawloader-0.37.1/data/cameras/nikon/e8400.toml000064400000000000000000000003670072674642500170310ustar 00000000000000make = "NIKON" model = "E8400" clean_make = "Nikon" clean_model = "E8400" color_matrix = [7842, -2320, -992, -8154, 15718, 2599, -1098, 1342, 7560] color_pattern = "BGGR" crops = [0,0,0,0] blackpoint = 0 whitepoint = 4095 hints = ["coolpixsplit"] rawloader-0.37.1/data/cameras/nikon/p330.toml000064400000000000000000000004220072674642500167460ustar 00000000000000make = "NIKON" model = "COOLPIX P330" clean_make = "Nikon" clean_model = "Coolpix P330" color_matrix = [10321, -3920, -931, -2750, 11146, 1824, -442, 1545, 5539] color_pattern = "RGGB" crops = [0,0,0,0] [[cameras.modes]] mode = "14bit" blackpoint = 3210 whitepoint = 65000 rawloader-0.37.1/data/cameras/nikon/p340.toml000064400000000000000000000003760072674642500167570ustar 00000000000000make = "NIKON" model = "COOLPIX P340" clean_make = "Nikon" clean_model = "Coolpix P340" blackpoint = 200 whitepoint = 3800 color_matrix = [10321, -3920, -931, -2750, 11146, 1824, -442, 1545, 5539] color_pattern = "RGGB" crops = [0,0,0,0] hints = ["msb"] rawloader-0.37.1/data/cameras/nikon/p6000.toml000064400000000000000000000003760072674642500170360ustar 00000000000000make = "NIKON" model = "COOLPIX P6000" clean_make = "Nikon" clean_model = "Coolpix P6000" blackpoint = 0 whitepoint = 4095 color_matrix = [9698, -3367, -914, -4706, 12584, 2368, -837, 968, 5801] color_pattern = "RGGB" crops = [0,0,0,0] hints = ["msb32"] rawloader-0.37.1/data/cameras/nikon/p7000.toml000064400000000000000000000004010072674642500170240ustar 00000000000000make = "NIKON" model = "COOLPIX P7000" clean_make = "Nikon" clean_model = "Coolpix P7000" blackpoint = 0 whitepoint = 4095 color_matrix = [11432, -3679, -1111, -3169, 11239, 2202, -791, 1380, 4455] color_pattern = "RGGB" crops = [0,0,0,0] hints = ["msb32"] rawloader-0.37.1/data/cameras/nikon/p7100.toml000064400000000000000000000004010072674642500170250ustar 00000000000000make = "NIKON" model = "COOLPIX P7100" clean_make = "Nikon" clean_model = "Coolpix P7100" blackpoint = 0 whitepoint = 3800 color_matrix = [11053, -4269, -1024, -1976, 10182, 2088, -526, 1263, 4469] color_pattern = "RGGB" crops = [0,0,0,0] hints = ["msb32"] rawloader-0.37.1/data/cameras/nikon/p7800.toml000064400000000000000000000004070072674642500170420ustar 00000000000000make = "NIKON" model = "COOLPIX P7800" clean_make = "Nikon" clean_model = "Coolpix P7800" blackpoint = 3195 whitepoint = 65000 color_matrix = [10321, -3920, -931, -2750, 11146, 1824, -442, 1545, 5539] color_pattern = "RGGB" crops = [0,0,0,0] hints = ["unpacked"] rawloader-0.37.1/data/cameras/nikon/v1.toml000064400000000000000000000004170072674642500166130ustar 00000000000000make = "NIKON CORPORATION" model = "NIKON 1 V1" clean_make = "Nikon" clean_model = "1 V1" color_matrix = [8994, -2667, -865, -4594, 12324, 2552, -699, 1786, 6260] color_pattern = "RGGB" crops = [0,0,2,0] [[cameras.modes]] mode = "12bit" blackpoint = 0 whitepoint = 4095 rawloader-0.37.1/data/cameras/olympus/c5050z.toml000064400000000000000000000003660072674642500176100ustar 00000000000000make = "OLYMPUS OPTICAL CO.,LTD" model = "C5050Z" clean_make = "Olympus" clean_model = "C5050Z" blackpoint = 0 whitepoint = 4095 color_matrix = [10508, -3124, -1273, -6079, 14294, 1901, -1653, 2306, 6237] color_pattern = "BGGR" crops = [0,0,0,0] rawloader-0.37.1/data/cameras/olympus/c5060wz.toml000064400000000000000000000003640072674642500177760ustar 00000000000000make = "OLYMPUS CORPORATION" model = "C5060WZ" clean_make = "Olympus" clean_model = "C5060WZ" blackpoint = 0 whitepoint = 4095 color_matrix = [10445, -3362, -1307, -7662, 15690, 2058, -1135, 1176, 7602] color_pattern = "RGGB" crops = [0,0,0,0] rawloader-0.37.1/data/cameras/olympus/c7070wz.toml000064400000000000000000000003660072674642500200030ustar 00000000000000make = "OLYMPUS IMAGING CORP." model = "C7070WZ" clean_make = "Olympus" clean_model = "C7070WZ" blackpoint = 0 whitepoint = 4095 color_matrix = [10252, -3531, -1095, -7114, 14850, 2436, -1451, 1723, 6365] color_pattern = "RGGB" crops = [0,0,0,0] rawloader-0.37.1/data/cameras/olympus/c8080.toml000064400000000000000000000003610072674642500174170ustar 00000000000000make = "OLYMPUS CORPORATION" model = "C8080WZ" clean_make = "Olympus" clean_model = "C8080WZ" blackpoint = 0 whitepoint = 4095 color_matrix = [8606, -2509, -1014, -8238, 15714, 2703, -942, 979, 7760] color_pattern = "BGGR" crops = [0,0,0,0] rawloader-0.37.1/data/cameras/olympus/e-1.toml000064400000000000000000000003540072674642500172410ustar 00000000000000make = "OLYMPUS CORPORATION" model = "E-1" clean_make = "Olympus" clean_model = "E-1" blackpoint = 65 whitepoint = 4095 color_matrix = [11846, -4767, -945, -7027, 15878, 1089, -2699, 4122, 8311] color_pattern = "GRBG" crops = [0,0,0,0] rawloader-0.37.1/data/cameras/olympus/e-20.toml000064400000000000000000000003760072674642500173260ustar 00000000000000make = "OLYMPUS OPTICAL CO.,LTD" model = "E-20,E-20N,E-20P" clean_make = "Olympus" clean_model = "E-20" blackpoint = 0 whitepoint = 4092 color_matrix = [13173, -4732, -1499, -5807, 14036, 1895, -2045, 2452, 7142] color_pattern = "RGGB" crops = [0,0,0,0] rawloader-0.37.1/data/cameras/olympus/e-3.toml000064400000000000000000000003560072674642500172450ustar 00000000000000make = "OLYMPUS IMAGING CORP." model = "E-3" clean_make = "Olympus" clean_model = "E-3" blackpoint = 53 whitepoint = 4015 color_matrix = [9487, -2875, -1115, -7533, 15606, 2010, -1618, 2100, 7389] color_pattern = "RGGB" crops = [0,0,0,0] rawloader-0.37.1/data/cameras/olympus/e-30.toml000064400000000000000000000003600072674642500173200ustar 00000000000000make = "OLYMPUS IMAGING CORP." model = "E-30" clean_make = "Olympus" clean_model = "E-30" blackpoint = 64 whitepoint = 4015 color_matrix = [8144, -1861, -1111, -7763, 15894, 1929, -1865, 2542, 7607] color_pattern = "BGGR" crops = [0,6,2,0] rawloader-0.37.1/data/cameras/olympus/e-300.toml000064400000000000000000000003620072674642500174020ustar 00000000000000make = "OLYMPUS IMAGING CORP." model = "E-300" clean_make = "Olympus" clean_model = "E-300" blackpoint = 63 whitepoint = 4095 color_matrix = [7828, -1761, -348, -5788, 14071, 1830, -2853, 4518, 6557] color_pattern = "RGGB" crops = [0,20,0,0] rawloader-0.37.1/data/cameras/olympus/e-330.toml000064400000000000000000000003630072674642500174060ustar 00000000000000make = "OLYMPUS IMAGING CORP." model = "E-330" clean_make = "Olympus" clean_model = "E-330" blackpoint = 70 whitepoint = 4095 color_matrix = [8961, -2473, -1084, -7979, 15990, 2067, -2319, 3035, 8249] color_pattern = "RGGB" crops = [0,30,0,0] rawloader-0.37.1/data/cameras/olympus/e-400.toml000064400000000000000000000003600072674642500174010ustar 00000000000000make = "OLYMPUS IMAGING CORP." model = "E-400" clean_make = "Olympus" clean_model = "E-400" blackpoint = 95 whitepoint = 4095 color_matrix = [6169, -1483, -21, -7107, 14761, 2536, -2904, 3580, 8568] color_pattern = "GRBG" crops = [0,0,0,0] rawloader-0.37.1/data/cameras/olympus/e-410.toml000064400000000000000000000003620072674642500174040ustar 00000000000000make = "OLYMPUS IMAGING CORP." model = "E-410" clean_make = "Olympus" clean_model = "E-410" blackpoint = 72 whitepoint = 3601 color_matrix = [8856, -2582, -1026, -7761, 15766, 2082, -2009, 2575, 7469] color_pattern = "RGGB" crops = [0,0,0,0] rawloader-0.37.1/data/cameras/olympus/e-420.toml000064400000000000000000000003610072674642500174040ustar 00000000000000make = "OLYMPUS IMAGING CORP." model = "E-420" clean_make = "Olympus" clean_model = "E-420" blackpoint = 0 whitepoint = 4015 color_matrix = [8746, -2425, -1095, -7594, 15612, 2073, -1780, 2309, 7416] color_pattern = "RGGB" crops = [0,0,0,0] rawloader-0.37.1/data/cameras/olympus/e-450.toml000064400000000000000000000003620072674642500174100ustar 00000000000000make = "OLYMPUS IMAGING CORP." model = "E-450" clean_make = "Olympus" clean_model = "E-450" blackpoint = 69 whitepoint = 4015 color_matrix = [8745, -2425, -1095, -7594, 15613, 2073, -1780, 2309, 7416] color_pattern = "RGGB" crops = [0,0,0,0] rawloader-0.37.1/data/cameras/olympus/e-5.toml000064400000000000000000000003560072674642500172470ustar 00000000000000make = "OLYMPUS IMAGING CORP." model = "E-5" clean_make = "Olympus" clean_model = "E-5" blackpoint = 64 whitepoint = 3604 color_matrix = [11200, -3783, -1325, -4576, 12593, 2206, -695, 1742, 7504] color_pattern = "BGGR" crops = [0,4,0,0] rawloader-0.37.1/data/cameras/olympus/e-500.toml000064400000000000000000000003620072674642500174040ustar 00000000000000make = "OLYMPUS IMAGING CORP." model = "E-500" clean_make = "Olympus" clean_model = "E-500" blackpoint = 63 whitepoint = 3967 color_matrix = [8136, -1968, -299, -5481, 13742, 1871, -2556, 4205, 6630] color_pattern = "RGGB" crops = [0,20,0,0] rawloader-0.37.1/data/cameras/olympus/e-510.toml000064400000000000000000000003620072674642500174050ustar 00000000000000make = "OLYMPUS IMAGING CORP." model = "E-510" clean_make = "Olympus" clean_model = "E-510" blackpoint = 73 whitepoint = 3500 color_matrix = [8785, -2529, -1033, -7639, 15624, 2112, -1783, 2300, 7817] color_pattern = "RGGB" crops = [0,0,0,0] rawloader-0.37.1/data/cameras/olympus/e-520.toml000064400000000000000000000003620072674642500174060ustar 00000000000000make = "OLYMPUS IMAGING CORP." model = "E-520" clean_make = "Olympus" clean_model = "E-520" blackpoint = 69 whitepoint = 4015 color_matrix = [8344, -2322, -1020, -7596, 15635, 2048, -1748, 2269, 7287] color_pattern = "RGGB" crops = [0,0,0,0] rawloader-0.37.1/data/cameras/olympus/e-600.toml000064400000000000000000000003630072674642500174060ustar 00000000000000make = "OLYMPUS IMAGING CORP." model = "E-600" clean_make = "Olympus" clean_model = "E-600" blackpoint = 65 whitepoint = 4015 color_matrix = [8453, -2198, -1092, -7609, 15681, 2008, -1725, 2337, 7824] color_pattern = "BGGR" crops = [0,4,12,0] rawloader-0.37.1/data/cameras/olympus/e-m1.toml000064400000000000000000000003600072674642500174130ustar 00000000000000make = "OLYMPUS IMAGING CORP." model = "E-M1" clean_make = "Olympus" clean_model = "E-M1" blackpoint = 255 whitepoint = 4000 color_matrix = [7687, -1984, -606, -4327, 11928, 2721, -1381, 2339, 6452] color_pattern = "BGGR" crops = [0,0,0,0] rawloader-0.37.1/data/cameras/olympus/e-m10.toml000064400000000000000000000003620072674642500174750ustar 00000000000000make = "OLYMPUS IMAGING CORP." model = "E-M10" clean_make = "Olympus" clean_model = "E-M10" blackpoint = 252 whitepoint = 4000 color_matrix = [8380, -2630, -639, -2887, 10725, 2496, -627, 1427, 5438] color_pattern = "RGGB" crops = [8,24,8,8] rawloader-0.37.1/data/cameras/olympus/e-m10mk2.toml000064400000000000000000000003750072674642500201130ustar 00000000000000make = "OLYMPUS CORPORATION" model = "E-M10MarkII" clean_make = "Olympus" clean_model = "E-M10 Mark II" blackpoint = 254 whitepoint = 4000 color_matrix = [8380, -2630, -639, -2887, 10725, 2496, -627, 1427, 5438] color_pattern = "RGGB" crops = [0,0,0,0] rawloader-0.37.1/data/cameras/olympus/e-m10mk3.toml000064400000000000000000000004150072674642500201070ustar 00000000000000make = "OLYMPUS CORPORATION" model = "E-M10 Mark III" clean_make = "OLYMPUS CORPORATION" clean_model = "E-M10 Mark III" blackpoint = 254 whitepoint = 4000 color_matrix = [8380, -2630, -639, -2887, 10725, 2496, -627, 1427, 5438] color_pattern = "RGGB" crops = [0,0,0,0] rawloader-0.37.1/data/cameras/olympus/e-m1mk2.toml000064400000000000000000000005220072674642500200250ustar 00000000000000make = "OLYMPUS CORPORATION" model = "E-M1MarkII" clean_make = "OLYMPUS CORPORATION" clean_model = "E-M1MarkII" blackpoint = 254 whitepoint = 4000 color_matrix = [9383, -3170, -763, -2457, 10702, 2020, -384, 1236, 5552] color_pattern = "RGGB" crops = [0,0,0,0] highres_width = 10000 [[cameras.modes]] mode = "highres" crops = [0,10,0,0] rawloader-0.37.1/data/cameras/olympus/e-m5.toml000064400000000000000000000003600072674642500174170ustar 00000000000000make = "OLYMPUS IMAGING CORP." model = "E-M5" clean_make = "Olympus" clean_model = "E-M5" blackpoint = 254 whitepoint = 4000 color_matrix = [8380, -2630, -639, -2887, 10725, 2496, -627, 1427, 5438] color_pattern = "RGGB" crops = [8,24,8,8] rawloader-0.37.1/data/cameras/olympus/e-m5mk2.toml000064400000000000000000000005150072674642500200330ustar 00000000000000make = "OLYMPUS IMAGING CORP." model = "E-M5MarkII" clean_make = "Olympus" clean_model = "E-M5 Mark II" blackpoint = 253 whitepoint = 4000 color_matrix = [9422, -3258, -711, -2655, 10898, 2015, -512, 1354, 5512] color_pattern = "RGGB" crops = [0,0,0,0] highres_width = 9280 [[cameras.modes]] mode = "highres" color_pattern = "GRBG" rawloader-0.37.1/data/cameras/olympus/e-p1.toml000064400000000000000000000003600072674642500174160ustar 00000000000000make = "OLYMPUS IMAGING CORP." model = "E-P1" clean_make = "Olympus" clean_model = "E-P1" blackpoint = 64 whitepoint = 4095 color_matrix = [8343, -2050, -1021, -7715, 15705, 2103, -1831, 2380, 8235] color_pattern = "RGGB" crops = [0,6,2,0] rawloader-0.37.1/data/cameras/olympus/e-p2.toml000064400000000000000000000003600072674642500174170ustar 00000000000000make = "OLYMPUS IMAGING CORP." model = "E-P2" clean_make = "Olympus" clean_model = "E-P2" blackpoint = 64 whitepoint = 4095 color_matrix = [8343, -2050, -1021, -7715, 15705, 2103, -1831, 2380, 8235] color_pattern = "RGGB" crops = [0,0,0,0] rawloader-0.37.1/data/cameras/olympus/e-p3.toml000064400000000000000000000003600072674642500174200ustar 00000000000000make = "OLYMPUS IMAGING CORP." model = "E-P3" clean_make = "Olympus" clean_model = "E-P3" blackpoint = 64 whitepoint = 3843 color_matrix = [7575, -2159, -571, -3722, 11341, 2725, -1434, 2819, 6271] color_pattern = "RGGB" crops = [0,26,0,0] rawloader-0.37.1/data/cameras/olympus/e-p5.toml000064400000000000000000000003600072674642500174220ustar 00000000000000make = "OLYMPUS IMAGING CORP." model = "E-P5" clean_make = "Olympus" clean_model = "E-P5" blackpoint = 255 whitepoint = 4000 color_matrix = [8380, -2630, -639, -2887, 10725, 2496, -627, 1427, 5438] color_pattern = "RGGB" crops = [8,24,8,8] rawloader-0.37.1/data/cameras/olympus/e-pl1.toml000064400000000000000000000003620072674642500175740ustar 00000000000000make = "OLYMPUS IMAGING CORP." model = "E-PL1" clean_make = "Olympus" clean_model = "E-PL1" blackpoint = 64 whitepoint = 3604 color_matrix = [11408, -4289, -1215, -4286, 12385, 2118, -387, 1467, 7787] color_pattern = "RGGB" crops = [0,6,2,0] rawloader-0.37.1/data/cameras/olympus/e-pl2.toml000064400000000000000000000003620072674642500175750ustar 00000000000000make = "OLYMPUS IMAGING CORP." model = "E-PL2" clean_make = "Olympus" clean_model = "E-PL2" blackpoint = 64 whitepoint = 3604 color_matrix = [15030, -5552, -1806, -3987, 12387, 1767, -592, 1670, 7023] color_pattern = "RGGB" crops = [0,4,0,0] rawloader-0.37.1/data/cameras/olympus/e-pl3.toml000064400000000000000000000003620072674642500175760ustar 00000000000000make = "OLYMPUS IMAGING CORP." model = "E-PL3" clean_make = "Olympus" clean_model = "E-PL3" blackpoint = 64 whitepoint = 3700 color_matrix = [7575, -2159, -571, -3722, 11341, 2725, -1434, 2819, 6271] color_pattern = "RGGB" crops = [0,30,0,0] rawloader-0.37.1/data/cameras/olympus/e-pl5.toml000064400000000000000000000003600072674642500175760ustar 00000000000000make = "OLYMPUS IMAGING CORP." model = "E-PL5" clean_make = "Olympus" clean_model = "E-PL5" blackpoint = 0 whitepoint = 4000 color_matrix = [8380, -2630, -639, -2887, 10725, 2496, -627, 1427, 5438] color_pattern = "RGGB" crops = [8,24,8,8] rawloader-0.37.1/data/cameras/olympus/e-pl6.toml000064400000000000000000000003620072674642500176010ustar 00000000000000make = "OLYMPUS IMAGING CORP." model = "E-PL6" clean_make = "Olympus" clean_model = "E-PL6" blackpoint = 254 whitepoint = 4000 color_matrix = [8380, -2630, -639, -2887, 10725, 2496, -627, 1427, 5438] color_pattern = "RGGB" crops = [8,24,8,8] rawloader-0.37.1/data/cameras/olympus/e-pl7.toml000064400000000000000000000003620072674642500176020ustar 00000000000000make = "OLYMPUS IMAGING CORP." model = "E-PL7" clean_make = "Olympus" clean_model = "E-PL7" blackpoint = 254 whitepoint = 4000 color_matrix = [9197, -3190, -659, -2606, 10830, 2039, -458, 1250, 5458] color_pattern = "RGGB" crops = [8,24,8,8] rawloader-0.37.1/data/cameras/olympus/e-pl8.toml000064400000000000000000000003730072674642500176050ustar 00000000000000make = "OLYMPUS CORPORATION" model = "E-PL8" clean_make = "OLYMPUS CORPORATION" clean_model = "E-PL8" blackpoint = 254 whitepoint = 4000 color_matrix = [9197, -3190, -659, -2606, 10830, 2039, -458, 1250, 5458] color_pattern = "RGGB" crops = [0,0,0,0] rawloader-0.37.1/data/cameras/olympus/e-pm1.toml000064400000000000000000000003620072674642500175750ustar 00000000000000make = "OLYMPUS IMAGING CORP." model = "E-PM1" clean_make = "Olympus" clean_model = "E-PM1" blackpoint = 64 whitepoint = 4011 color_matrix = [7575, -2159, -571, -3722, 11341, 2725, -1434, 2819, 6271] color_pattern = "RGGB" crops = [0,24,0,0] rawloader-0.37.1/data/cameras/olympus/e-pm2.toml000064400000000000000000000003600072674642500175740ustar 00000000000000make = "OLYMPUS IMAGING CORP." model = "E-PM2" clean_make = "Olympus" clean_model = "E-PM2" blackpoint = 0 whitepoint = 4000 color_matrix = [8380, -2630, -639, -2887, 10725, 2496, -627, 1427, 5438] color_pattern = "RGGB" crops = [8,24,8,8] rawloader-0.37.1/data/cameras/olympus/e620.toml000064400000000000000000000003630072674642500173330ustar 00000000000000make = "OLYMPUS IMAGING CORP." model = "E-620" clean_make = "Olympus" clean_model = "E-620" blackpoint = 65 whitepoint = 4015 color_matrix = [8453, -2198, -1092, -7609, 15681, 2008, -1725, 2337, 7824] color_pattern = "BGGR" crops = [0,4,12,0] rawloader-0.37.1/data/cameras/olympus/penf.toml000064400000000000000000000003570072674642500176120ustar 00000000000000make = "OLYMPUS CORPORATION" model = "PEN-F" clean_make = "Olympus" clean_model = "PEN-F" blackpoint = 242 whitepoint = 4000 color_matrix = [9476, -3182, -765, -2613, 10958, 1893, -449, 1315, 5268] color_pattern = "RGGB" crops = [0,0,0,0] rawloader-0.37.1/data/cameras/olympus/sh-2.toml000064400000000000000000000003770072674642500174350ustar 00000000000000make = "OLYMPUS IMAGING CORP." model = "SH-2" clean_make = "OLYMPUS IMAGING CORP." clean_model = "SH-2" blackpoint = 200 whitepoint = 4000 color_matrix = [10156, -3425, -1077, -2611, 11177, 1624, -385, 1592, 5080] color_pattern = "GRBG" crops = [0,0,0,0] rawloader-0.37.1/data/cameras/olympus/sp320.toml000064400000000000000000000003620072674642500175250ustar 00000000000000make = "OLYMPUS IMAGING CORP." model = "SP320" clean_make = "Olympus" clean_model = "SP320" blackpoint = 0 whitepoint = 4095 color_matrix = [11766, -4445, -1067, -6901, 14421, 2707, -1029, 1217, 7572] color_pattern = "RGGB" crops = [0,0,0,0] rawloader-0.37.1/data/cameras/olympus/sp350.toml000064400000000000000000000003600072674642500175260ustar 00000000000000make = "OLYMPUS IMAGING CORP." model = "SP350" clean_make = "Olympus" clean_model = "SP350" blackpoint = 0 whitepoint = 4095 color_matrix = [12078, -4836, -1069, -6671, 14306, 2578, -786, 939, 7418] color_pattern = "RGGB" crops = [0,0,0,0] rawloader-0.37.1/data/cameras/olympus/sp500uz.toml000064400000000000000000000003640072674642500201060ustar 00000000000000make = "OLYMPUS IMAGING CORP." model = "SP500UZ" clean_make = "Olympus" clean_model = "SP500UZ" blackpoint = 0 whitepoint = 4095 color_matrix = [9493, -3415, -666, -5211, 12334, 3260, -1548, 2262, 6482] color_pattern = "GBRG" crops = [0,0,0,0] rawloader-0.37.1/data/cameras/olympus/sp510uz.toml000064400000000000000000000004040072674642500201020ustar 00000000000000make = "OLYMPUS IMAGING CORP." model = "SP510UZ" clean_make = "OLYMPUS IMAGING CORP." clean_model = "SP510UZ" blackpoint = 0 whitepoint = 4095 color_matrix = [10593, -3607, -1010, -5881, 13127, 3084, -1200, 1805, 6721] color_pattern = "GBRG" crops = [0,0,0,0] rawloader-0.37.1/data/cameras/olympus/stylus1-1.toml000064400000000000000000000003720072674642500204410ustar 00000000000000make = "OLYMPUS IMAGING CORP." model = "STYLUS1,1s" clean_make = "Olympus" clean_model = "Stylus1" blackpoint = 200 whitepoint = 3900 color_matrix = [8360, -2420, -880, -3928, 12353, 1739, -1381, 2416, 5173] color_pattern = "RGGB" crops = [0,14,0,0] rawloader-0.37.1/data/cameras/olympus/stylus1.toml000064400000000000000000000003670072674642500203070ustar 00000000000000make = "OLYMPUS IMAGING CORP." model = "STYLUS1" clean_make = "Olympus" clean_model = "Stylus1" blackpoint = 200 whitepoint = 3900 color_matrix = [8360, -2420, -880, -3928, 12353, 1739, -1381, 2416, 5173] color_pattern = "RGGB" crops = [0,14,0,0] rawloader-0.37.1/data/cameras/olympus/tg-4.toml000064400000000000000000000003610072674642500174300ustar 00000000000000make = "OLYMPUS CORPORATION" model = "TG-4" clean_make = "Olympus" clean_model = "TG-4" blackpoint = 302 whitepoint = 4000 color_matrix = [11426, -4159, -1126, -2066, 10678, 1593, -120, 1327, 4998] color_pattern = "GRBG" crops = [8,16,8,16] rawloader-0.37.1/data/cameras/olympus/tg-5.toml000064400000000000000000000003730072674642500174340ustar 00000000000000make = "OLYMPUS CORPORATION" model = "TG-5" clean_make = "OLYMPUS CORPORATION" clean_model = "TG-5" blackpoint = 256 whitepoint = 4000 color_matrix = [10899, -3833, -1082, -2112, 10736, 1575, -267, 1452, 5269] color_pattern = "GRBG" crops = [0,0,0,0] rawloader-0.37.1/data/cameras/olympus/xz-1.toml000064400000000000000000000003560072674642500174600ustar 00000000000000make = "OLYMPUS IMAGING CORP." model = "XZ-1" clean_make = "Olympus" clean_model = "XZ-1" blackpoint = 67 whitepoint = 3900 color_matrix = [10901, -4095, -1074, -1141, 9208, 2293, -62, 1417, 5158] color_pattern = "RGGB" crops = [0,0,2,0] rawloader-0.37.1/data/cameras/olympus/xz-10.toml000064400000000000000000000003610072674642500175340ustar 00000000000000make = "OLYMPUS IMAGING CORP." model = "XZ-10" clean_make = "Olympus" clean_model = "XZ-10" blackpoint = 200 whitepoint = 3900 color_matrix = [9777, -3483, -925, -2886, 11297, 1800, -602, 1663, 5134] color_pattern = "RGGB" crops = [0,0,0,0] rawloader-0.37.1/data/cameras/olympus/xz-2.toml000064400000000000000000000003570072674642500174620ustar 00000000000000make = "OLYMPUS IMAGING CORP." model = "XZ-2" clean_make = "Olympus" clean_model = "XZ-2" blackpoint = 200 whitepoint = 3900 color_matrix = [9777, -3483, -925, -2886, 11297, 1800, -602, 1663, 5134] color_pattern = "RGGB" crops = [0,0,2,0] rawloader-0.37.1/data/cameras/panasonic/cm1.toml000064400000000000000000000006450072674642500176050ustar 00000000000000make = "Panasonic" model = "DMC-CM1" clean_make = "Panasonic" clean_model = "DMC-CM1" blackpoint = 142 whitepoint = 4095 color_matrix = [8770, -3194, -820, -2871, 11281, 1803, -513, 1552, 4434] color_pattern = "RGGB" [[cameras.modes]] mode = "3:2" crops = [0,0,0,0] [[cameras.modes]] mode = "1:1" crops = [0,32,0,0] [[cameras.modes]] mode = "16:9" crops = [0,0,0,0] [[cameras.modes]] mode = "4:3" crops = [0,160,0,0] rawloader-0.37.1/data/cameras/panasonic/fz1000.toml000064400000000000000000000006530072674642500200440ustar 00000000000000make = "Panasonic" model = "DMC-FZ1000" clean_make = "Panasonic" clean_model = "DMC-FZ1000" blackpoint = 143 whitepoint = 4095 color_matrix = [7830, -2696, -763, -3325, 11667, 1866, -641, 1712, 4824] color_pattern = "GBRG" [[cameras.modes]] mode = "1:1" crops = [0,32,0,0] [[cameras.modes]] mode = "4:3" crops = [0,160,0,0] [[cameras.modes]] mode = "3:2" crops = [0,0,0,0] [[cameras.modes]] mode = "16:9" crops = [0,0,0,0] rawloader-0.37.1/data/cameras/panasonic/fz150.toml000064400000000000000000000006570072674642500177750ustar 00000000000000make = "Panasonic" model = "DMC-FZ150" clean_make = "Panasonic" clean_model = "DMC-FZ150" blackpoint = 142 whitepoint = 3971 color_matrix = [11904, -4541, -1189, -2355, 10899, 1662, -296, 1586, 4289] color_pattern = "GBRG" [[cameras.modes]] mode = "1:1" crops = [0,16,0,0] [[cameras.modes]] mode = "4:3" crops = [0,128,0,0] [[cameras.modes]] mode = "3:2" crops = [0,128,0,0] [[cameras.modes]] mode = "16:9" crops = [0,128,0,0] rawloader-0.37.1/data/cameras/panasonic/fz18.toml000064400000000000000000000005650072674642500177160ustar 00000000000000make = "Panasonic" model = "DMC-FZ18" clean_make = "Panasonic" clean_model = "DMC-FZ18" blackpoint = 0 whitepoint = 3986 color_matrix = [9932, -3060, -935, -5809, 13331, 2753, -1267, 2155, 5575] color_pattern = "BGGR" [[cameras.modes]] mode = "4:3" crops = [0,30,1,10] [[cameras.modes]] mode = "3:2" crops = [0,31,0,9] [[cameras.modes]] mode = "16:9" crops = [0,31,0,9] rawloader-0.37.1/data/cameras/panasonic/fz200.toml000064400000000000000000000006550072674642500177670ustar 00000000000000make = "Panasonic" model = "DMC-FZ200" clean_make = "Panasonic" clean_model = "DMC-FZ200" blackpoint = 142 whitepoint = 3971 color_matrix = [8112, -2563, -740, -3730, 11784, 2197, -941, 2075, 4933] color_pattern = "GBRG" [[cameras.modes]] mode = "1:1" crops = [0,16,0,0] [[cameras.modes]] mode = "4:3" crops = [0,128,4,0] [[cameras.modes]] mode = "3:2" crops = [0,128,0,0] [[cameras.modes]] mode = "16:9" crops = [0,128,0,0] rawloader-0.37.1/data/cameras/panasonic/fz2000.toml000064400000000000000000000003370072674642500200440ustar 00000000000000make = "Panasonic" model = "DMC-FZ2000" clean_make = "Panasonic" clean_model = "DMC-FZ2000" blackpoint = 142 whitepoint = 2095 color_matrix = [7386, -2443, -743, -3437, 11864, 1757, -608, 1660, 4766] color_pattern = "GBRG" rawloader-0.37.1/data/cameras/panasonic/fz2500.toml000064400000000000000000000005070072674642500200500ustar 00000000000000make = "Panasonic" model = "DMC-FZ2500" clean_make = "Panasonic" clean_model = "DMC-FZ2500" model_aliases = [ ["DMC-FZ2000", "DMC-FZ2000"], ] blackpoint = 141 whitepoint = 4095 color_matrix = [7386, -2443, -743, -3437, 11864, 1757, -608, 1660, 4766] color_pattern = "GBRG" [[cameras.modes]] mode = "3:2" crops = [0,0,0,0] rawloader-0.37.1/data/cameras/panasonic/fz28.toml000064400000000000000000000005660072674642500177200ustar 00000000000000make = "Panasonic" model = "DMC-FZ28" clean_make = "Panasonic" clean_model = "DMC-FZ28" blackpoint = 15 whitepoint = 3986 color_matrix = [10109, -3488, -993, -5412, 12812, 2916, -1305, 2140, 5543] color_pattern = "BGGR" [[cameras.modes]] mode = "4:3" crops = [0,56,0,0] [[cameras.modes]] mode = "3:2" crops = [0,56,0,0] [[cameras.modes]] mode = "16:9" crops = [0,56,0,0] rawloader-0.37.1/data/cameras/panasonic/fz30.toml000064400000000000000000000004170072674642500177040ustar 00000000000000make = "Panasonic" model = "DMC-FZ30" clean_make = "Panasonic" clean_model = "DMC-FZ30" blackpoint = 0 whitepoint = 3971 color_matrix = [10976, -4029, -1141, -7918, 15491, 2600, -1670, 2071, 8246] color_pattern = "RGGB" [[cameras.modes]] mode = "4:3" crops = [0,16,0,0] rawloader-0.37.1/data/cameras/panasonic/fz300.toml000064400000000000000000000004210072674642500177570ustar 00000000000000make = "Panasonic" model = "DMC-FZ300" clean_make = "Panasonic" clean_model = "DMC-FZ300" blackpoint = 143 whitepoint = 4095 color_matrix = [8378, -2798, -769, -3068, 11410, 1877, -538, 1792, 4623] color_pattern = "GBRG" [[cameras.modes]] mode = "4:3" crops = [0,128,0,0] rawloader-0.37.1/data/cameras/panasonic/fz330.toml000064400000000000000000000004210072674642500177620ustar 00000000000000make = "Panasonic" model = "DMC-FZ330" clean_make = "Panasonic" clean_model = "DMC-FZ330" blackpoint = 142 whitepoint = 4095 color_matrix = [8378, -2798, -769, -3068, 11410, 1877, -538, 1792, 4623] color_pattern = "GBRG" [[cameras.modes]] mode = "4:3" crops = [0,126,0,0] rawloader-0.37.1/data/cameras/panasonic/fz38.toml000064400000000000000000000006500072674642500177130ustar 00000000000000make = "Panasonic" model = "DMC-FZ38" clean_make = "Panasonic" clean_model = "DMC-FZ38" model_aliases = [ ["DMC-FZ35", "DMC-FZ35"], ] blackpoint = 143 whitepoint = 3986 color_matrix = [9938, -2780, -890, -4604, 12393, 2480, -1117, 2304, 4620] color_pattern = "BGGR" [[cameras.modes]] mode = "4:3" crops = [0,44,0,0] [[cameras.modes]] mode = "3:2" crops = [0,42,4,0] [[cameras.modes]] mode = "16:9" crops = [0,42,4,0] rawloader-0.37.1/data/cameras/panasonic/fz45.toml000064400000000000000000000005020072674642500177050ustar 00000000000000make = "Panasonic" model = "DMC-FZ45" clean_make = "Panasonic" clean_model = "DMC-FZ45" blackpoint = 143 whitepoint = 3986 color_matrix = [13639, -5535, -1371, -1698, 9633, 2430, 316, 1152, 4108] color_pattern = "GBRG" [[cameras.modes]] mode = "4:3" crops = [0,58,10,0] [[cameras.modes]] mode = "3:2" crops = [0,62,0,0] rawloader-0.37.1/data/cameras/panasonic/fz50.toml000064400000000000000000000005660072674642500177130ustar 00000000000000make = "Panasonic" model = "DMC-FZ50" clean_make = "Panasonic" clean_model = "DMC-FZ50" blackpoint = 0 whitepoint = 3986 color_matrix = [7906, -2709, -594, -6231, 13351, 3220, -1922, 2631, 6537] color_pattern = "BGGR" [[cameras.modes]] mode = "4:3" crops = [18,16,5,20] [[cameras.modes]] mode = "3:2" crops = [0,17,5,3] [[cameras.modes]] mode = "16:9" crops = [0,15,5,3] rawloader-0.37.1/data/cameras/panasonic/fz70.toml000064400000000000000000000006540072674642500177130ustar 00000000000000make = "Panasonic" model = "DMC-FZ70" clean_make = "Panasonic" clean_model = "DMC-FZ70" blackpoint = 163 whitepoint = 3941 color_matrix = [11532, -4324, -1066, -2375, 10847, 1749, -564, 1699, 4351] color_pattern = "RGGB" [[cameras.modes]] mode = "1:1" crops = [0,0,0,0] [[cameras.modes]] mode = "4:3" crops = [0,182,0,0] [[cameras.modes]] mode = "3:2" crops = [0,182,0,0] [[cameras.modes]] mode = "16:9" crops = [0,182,0,0] rawloader-0.37.1/data/cameras/panasonic/fz72.toml000064400000000000000000000006540072674642500177150ustar 00000000000000make = "Panasonic" model = "DMC-FZ72" clean_make = "Panasonic" clean_model = "DMC-FZ72" blackpoint = 144 whitepoint = 3956 color_matrix = [11532, -4324, -1066, -2375, 10847, 1749, -564, 1699, 4351] color_pattern = "RGGB" [[cameras.modes]] mode = "1:1" crops = [0,0,0,0] [[cameras.modes]] mode = "4:3" crops = [0,182,0,0] [[cameras.modes]] mode = "3:2" crops = [0,182,0,0] [[cameras.modes]] mode = "16:9" crops = [0,182,0,0] rawloader-0.37.1/data/cameras/panasonic/fz8.toml000064400000000000000000000004130072674642500176250ustar 00000000000000make = "Panasonic" model = "DMC-FZ8" clean_make = "Panasonic" clean_model = "DMC-FZ8" blackpoint = 0 whitepoint = 3986 color_matrix = [8986, -2755, -802, -6341, 13575, 3077, -1476, 2144, 6379] color_pattern = "RGGB" [[cameras.modes]] mode = "4:3" crops = [0,31,1,5] rawloader-0.37.1/data/cameras/panasonic/fz80.toml000064400000000000000000000004150072674642500177070ustar 00000000000000make = "Panasonic" model = "DC-FZ80" clean_make = "Panasonic" clean_model = "DC-FZ80" blackpoint = 170 whitepoint = 4095 color_matrix = [8550, -2908, -842, -3195, 11529, 1881, -338, 1603, 4631] color_pattern = "GBRG" [[cameras.modes]] mode = "4:3" crops = [0,126,0,0] rawloader-0.37.1/data/cameras/panasonic/fz82.toml000064400000000000000000000004150072674642500177110ustar 00000000000000make = "Panasonic" model = "DC-FZ82" clean_make = "Panasonic" clean_model = "DC-FZ82" blackpoint = 142 whitepoint = 4095 color_matrix = [8550, -2908, -842, -3195, 11529, 1881, -338, 1603, 4631] color_pattern = "GBRG" [[cameras.modes]] mode = "4:3" crops = [0,128,0,0] rawloader-0.37.1/data/cameras/panasonic/g1.toml000064400000000000000000000005620072674642500174320ustar 00000000000000make = "Panasonic" model = "DMC-G1" clean_make = "Panasonic" clean_model = "DMC-G1" blackpoint = 15 whitepoint = 3986 color_matrix = [8199, -2065, -1056, -8124, 16156, 2033, -2458, 3022, 7220] color_pattern = "GBRG" [[cameras.modes]] mode = "3:2" crops = [0,44,0,0] [[cameras.modes]] mode = "16:9" crops = [0,32,0,0] [[cameras.modes]] mode = "4:3" crops = [0,42,0,0] rawloader-0.37.1/data/cameras/panasonic/g10.toml000064400000000000000000000004150072674642500175070ustar 00000000000000make = "Panasonic" model = "DMC-G10" clean_make = "Panasonic" clean_model = "DMC-G10" blackpoint = 15 whitepoint = 3900 color_matrix = [10113, -3400, -1114, -4765, 12683, 2317, -377, 1437, 6710] color_pattern = "GBRG" [[cameras.modes]] mode = "4:3" crops = [0,44,0,0] rawloader-0.37.1/data/cameras/panasonic/g3.toml000064400000000000000000000006510072674642500174330ustar 00000000000000make = "Panasonic" model = "DMC-G3" clean_make = "Panasonic" clean_model = "DMC-G3" blackpoint = 143 whitepoint = 3956 color_matrix = [6763, -1919, -863, -3868, 11515, 2684, -1216, 2387, 5879] color_pattern = "GRBG" [[cameras.modes]] mode = "1:1" crops = [0,200,0,0] [[cameras.modes]] mode = "4:3" crops = [0,152,0,0] [[cameras.modes]] mode = "3:2" crops = [0,168,0,0] [[cameras.modes]] mode = "16:9" crops = [0,168,0,0] rawloader-0.37.1/data/cameras/panasonic/g5.toml000064400000000000000000000006470072674642500174420ustar 00000000000000make = "Panasonic" model = "DMC-G5" clean_make = "Panasonic" clean_model = "DMC-G5" blackpoint = 143 whitepoint = 3956 color_matrix = [7798, -2562, -740, -3879, 11584, 2613, -1055, 2248, 5434] color_pattern = "BGGR" [[cameras.modes]] mode = "1:1" crops = [0,0,0,0] [[cameras.modes]] mode = "4:3" crops = [0,192,0,0] [[cameras.modes]] mode = "3:2" crops = [0,192,0,0] [[cameras.modes]] mode = "16:9" crops = [0,192,0,0] rawloader-0.37.1/data/cameras/panasonic/g6.toml000064400000000000000000000006470072674642500174430ustar 00000000000000make = "Panasonic" model = "DMC-G6" clean_make = "Panasonic" clean_model = "DMC-G6" blackpoint = 142 whitepoint = 3971 color_matrix = [8294, -2891, -651, -3869, 11590, 2595, -1183, 2267, 5352] color_pattern = "BGGR" [[cameras.modes]] mode = "1:1" crops = [0,0,0,0] [[cameras.modes]] mode = "4:3" crops = [0,194,0,0] [[cameras.modes]] mode = "3:2" crops = [0,194,0,0] [[cameras.modes]] mode = "16:9" crops = [0,194,0,0] rawloader-0.37.1/data/cameras/panasonic/g7.toml000064400000000000000000000006500072674642500174360ustar 00000000000000make = "Panasonic" model = "DMC-G7" clean_make = "Panasonic" clean_model = "DMC-G7" blackpoint = 143 whitepoint = 4095 color_matrix = [7610, -2780, -576, -4614, 12195, 2733, -1375, 2393, 6490] color_pattern = "BGGR" [[cameras.modes]] mode = "1:1" crops = [0,32,0,0] [[cameras.modes]] mode = "4:3" crops = [0,208,0,0] [[cameras.modes]] mode = "3:2" crops = [0,208,0,0] [[cameras.modes]] mode = "16:9" crops = [0,208,0,0] rawloader-0.37.1/data/cameras/panasonic/g70.toml000064400000000000000000000006520072674642500175200ustar 00000000000000make = "Panasonic" model = "DMC-G70" clean_make = "Panasonic" clean_model = "DMC-G70" blackpoint = 143 whitepoint = 4095 color_matrix = [7610, -2780, -576, -4614, 12195, 2733, -1375, 2393, 6490] color_pattern = "BGGR" [[cameras.modes]] mode = "1:1" crops = [0,32,0,0] [[cameras.modes]] mode = "4:3" crops = [0,208,0,0] [[cameras.modes]] mode = "3:2" crops = [0,208,0,0] [[cameras.modes]] mode = "16:9" crops = [0,208,0,0] rawloader-0.37.1/data/cameras/panasonic/g80.toml000064400000000000000000000005300072674642500175140ustar 00000000000000make = "Panasonic" model = "DMC-G80" clean_make = "Panasonic" clean_model = "DMC-G80" model_aliases = [ ["DMC-G85", "DMC-G85"], ["DMC-G81", "DMC-G81"], ] blackpoint = 143 whitepoint = 4095 color_matrix = [7610, -2780, -576, -4614, 12195, 2733, -1375, 2393, 6490] color_pattern = "BGGR" [[cameras.modes]] mode = "4:3" crops = [0,208,0,0] rawloader-0.37.1/data/cameras/panasonic/g9.toml000064400000000000000000000004070072674642500174400ustar 00000000000000make = "Panasonic" model = "DC-G9" clean_make = "Panasonic" clean_model = "DC-G9" blackpoint = 143 whitepoint = 4095 color_matrix = [7685, -2375, -634, -3687, 11700, 2249, -748, 1546, 5111] color_pattern = "RGGB" [[cameras.modes]] mode = "4:3" crops = [0,0,0,0] rawloader-0.37.1/data/cameras/panasonic/gf1.toml000064400000000000000000000006470072674642500176040ustar 00000000000000make = "Panasonic" model = "DMC-GF1" clean_make = "Panasonic" clean_model = "DMC-GF1" blackpoint = 15 whitepoint = 3986 color_matrix = [7888, -1902, -1011, -8106, 16085, 2099, -2353, 2866, 7330] color_pattern = "GBRG" [[cameras.modes]] mode = "1:1" crops = [0,44,0,0] [[cameras.modes]] mode = "4:3" crops = [0,44,0,0] [[cameras.modes]] mode = "3:2" crops = [0,44,0,0] [[cameras.modes]] mode = "16:9" crops = [0,44,0,0] rawloader-0.37.1/data/cameras/panasonic/gf3.toml000064400000000000000000000006510072674642500176010ustar 00000000000000make = "Panasonic" model = "DMC-GF3" clean_make = "Panasonic" clean_model = "DMC-GF3" blackpoint = 143 whitepoint = 3956 color_matrix = [9051, -2468, -1204, -5212, 13276, 2121, -1197, 2510, 6890] color_pattern = "GBRG" [[cameras.modes]] mode = "1:1" crops = [0,184,0,0] [[cameras.modes]] mode = "4:3" crops = [0,72,0,0] [[cameras.modes]] mode = "3:2" crops = [0,72,0,0] [[cameras.modes]] mode = "16:9" crops = [0,72,0,0] rawloader-0.37.1/data/cameras/panasonic/gf5.toml000064400000000000000000000006520072674642500176040ustar 00000000000000make = "Panasonic" model = "DMC-GF5" clean_make = "Panasonic" clean_model = "DMC-GF5" blackpoint = 143 whitepoint = 3956 color_matrix = [8228, -2945, -660, -3938, 11792, 2430, -1094, 2278, 5793] color_pattern = "GBRG" [[cameras.modes]] mode = "1:1" crops = [0,16,0,0] [[cameras.modes]] mode = "4:3" crops = [0,128,0,0] [[cameras.modes]] mode = "3:2" crops = [0,128,0,0] [[cameras.modes]] mode = "16:9" crops = [0,128,0,0] rawloader-0.37.1/data/cameras/panasonic/gf6.toml000064400000000000000000000006520072674642500176050ustar 00000000000000make = "Panasonic" model = "DMC-GF6" clean_make = "Panasonic" clean_model = "DMC-GF6" blackpoint = 143 whitepoint = 3956 color_matrix = [8130, -2801, -946, -3520, 11289, 2552, -1314, 2511, 5791] color_pattern = "GRBG" [[cameras.modes]] mode = "1:1" crops = [0,32,0,0] [[cameras.modes]] mode = "4:3" crops = [0,208,0,0] [[cameras.modes]] mode = "3:2" crops = [0,208,0,0] [[cameras.modes]] mode = "16:9" crops = [0,208,0,0] rawloader-0.37.1/data/cameras/panasonic/gf7.toml000064400000000000000000000006520072674642500176060ustar 00000000000000make = "Panasonic" model = "DMC-GF7" clean_make = "Panasonic" clean_model = "DMC-GF7" blackpoint = 143 whitepoint = 4095 color_matrix = [7610, -2780, -576, -4614, 12195, 2733, -1375, 2393, 6490] color_pattern = "BGGR" [[cameras.modes]] mode = "1:1" crops = [0,32,0,0] [[cameras.modes]] mode = "4:3" crops = [0,208,0,0] [[cameras.modes]] mode = "3:2" crops = [0,208,0,0] [[cameras.modes]] mode = "16:9" crops = [0,208,0,0] rawloader-0.37.1/data/cameras/panasonic/gh1.toml000064400000000000000000000006460072674642500176050ustar 00000000000000make = "Panasonic" model = "DMC-GH1" clean_make = "Panasonic" clean_model = "DMC-GH1" blackpoint = 15 whitepoint = 3986 color_matrix = [6299, -1466, -532, -6535, 13852, 2969, -2331, 3112, 5984] color_pattern = "GBRG" [[cameras.modes]] mode = "4:3" crops = [0,44,0,0] [[cameras.modes]] mode = "3:2" crops = [0,28,0,0] [[cameras.modes]] mode = "16:9" crops = [0,28,0,0] [[cameras.modes]] mode = "1:1" crops = [0,44,0,0] rawloader-0.37.1/data/cameras/panasonic/gh2.toml000064400000000000000000000006520072674642500176030ustar 00000000000000make = "Panasonic" model = "DMC-GH2" clean_make = "Panasonic" clean_model = "DMC-GH2" blackpoint = 15 whitepoint = 3800 color_matrix = [7780, -2410, -806, -3913, 11724, 2484, -1018, 2390, 5298] color_pattern = "BGGR" [[cameras.modes]] mode = "1:1" crops = [0,168,0,0] [[cameras.modes]] mode = "4:3" crops = [0,136,0,0] [[cameras.modes]] mode = "3:2" crops = [0,216,0,0] [[cameras.modes]] mode = "16:9" crops = [0,216,0,0] rawloader-0.37.1/data/cameras/panasonic/gh3.toml000064400000000000000000000006500072674642500176020ustar 00000000000000make = "Panasonic" model = "DMC-GH3" clean_make = "Panasonic" clean_model = "DMC-GH3" blackpoint = 142 whitepoint = 3971 color_matrix = [6559, -1752, -491, -3672, 11407, 2586, -962, 1875, 5130] color_pattern = "GBRG" [[cameras.modes]] mode = "1:1" crops = [0,0,0,0] [[cameras.modes]] mode = "4:3" crops = [0,194,0,0] [[cameras.modes]] mode = "3:2" crops = [0,194,0,0] [[cameras.modes]] mode = "16:9" crops = [0,194,0,0] rawloader-0.37.1/data/cameras/panasonic/gh4.toml000064400000000000000000000006500072674642500176030ustar 00000000000000make = "Panasonic" model = "DMC-GH4" clean_make = "Panasonic" clean_model = "DMC-GH4" blackpoint = 143 whitepoint = 4095 color_matrix = [7122, -2108, -512, -3155, 11201, 2231, -541, 1423, 5045] color_pattern = "BGGR" [[cameras.modes]] mode = "1:1" crops = [0,0,0,0] [[cameras.modes]] mode = "4:3" crops = [8,200,8,8] [[cameras.modes]] mode = "3:2" crops = [8,200,8,8] [[cameras.modes]] mode = "16:9" crops = [8,200,8,8] rawloader-0.37.1/data/cameras/panasonic/gh5.toml000064400000000000000000000004120072674642500176000ustar 00000000000000make = "Panasonic" model = "DC-GH5" clean_make = "Panasonic" clean_model = "DC-GH5" blackpoint = 144 whitepoint = 4095 color_matrix = [7641, -2336, -605, -3218, 11299, 2187, -485, 1338, 5121] color_pattern = "RGGB" [[cameras.modes]] mode = "4:3" crops = [0,56,0,0] rawloader-0.37.1/data/cameras/panasonic/gm1.toml000064400000000000000000000006520072674642500176070ustar 00000000000000make = "Panasonic" model = "DMC-GM1" clean_make = "Panasonic" clean_model = "DMC-GM1" blackpoint = 143 whitepoint = 3956 color_matrix = [6770, -1895, -744, -5232, 13145, 2303, -1664, 2691, 5703] color_pattern = "BGGR" [[cameras.modes]] mode = "1:1" crops = [0,32,0,0] [[cameras.modes]] mode = "4:3" crops = [0,206,0,0] [[cameras.modes]] mode = "3:2" crops = [0,206,0,0] [[cameras.modes]] mode = "16:9" crops = [0,206,0,0] rawloader-0.37.1/data/cameras/panasonic/gm1s.toml000064400000000000000000000004200072674642500177630ustar 00000000000000make = "Panasonic" model = "DMC-GM1S" clean_make = "Panasonic" clean_model = "DMC-GM1S" blackpoint = 143 whitepoint = 4095 color_matrix = [6770, -1895, -744, -5232, 13145, 2303, -1664, 2691, 5703] color_pattern = "BGGR" [[cameras.modes]] mode = "4:3" crops = [0,208,0,0] rawloader-0.37.1/data/cameras/panasonic/gm5.toml000064400000000000000000000006520072674642500176130ustar 00000000000000make = "Panasonic" model = "DMC-GM5" clean_make = "Panasonic" clean_model = "DMC-GM5" blackpoint = 143 whitepoint = 4095 color_matrix = [8238, -3244, -679, -3921, 11814, 2384, -836, 2022, 5852] color_pattern = "BGGR" [[cameras.modes]] mode = "4:3" crops = [0,224,16,0] [[cameras.modes]] mode = "1:1" crops = [0,32,0,0] [[cameras.modes]] mode = "3:2" crops = [0,224,0,0] [[cameras.modes]] mode = "16:9" crops = [0,224,0,0] rawloader-0.37.1/data/cameras/panasonic/gx1.toml000064400000000000000000000006530072674642500176230ustar 00000000000000make = "Panasonic" model = "DMC-GX1" clean_make = "Panasonic" clean_model = "DMC-GX1" blackpoint = 143 whitepoint = 3956 color_matrix = [6763, -1919, -863, -3868, 11515, 2684, -1216, 2387, 5879] color_pattern = "GRBG" [[cameras.modes]] mode = "1:1" crops = [0,198,0,0] [[cameras.modes]] mode = "4:3" crops = [0,154,0,0] [[cameras.modes]] mode = "3:2" crops = [0,170,0,0] [[cameras.modes]] mode = "16:9" crops = [0,170,0,0] rawloader-0.37.1/data/cameras/panasonic/gx7.toml000064400000000000000000000006520072674642500176300ustar 00000000000000make = "Panasonic" model = "DMC-GX7" clean_make = "Panasonic" clean_model = "DMC-GX7" blackpoint = 143 whitepoint = 3956 color_matrix = [7610, -2780, -576, -4614, 12195, 2733, -1375, 2393, 6490] color_pattern = "BGGR" [[cameras.modes]] mode = "1:1" crops = [0,32,0,0] [[cameras.modes]] mode = "4:3" crops = [0,208,0,0] [[cameras.modes]] mode = "3:2" crops = [0,208,0,0] [[cameras.modes]] mode = "16:9" crops = [0,208,0,0] rawloader-0.37.1/data/cameras/panasonic/gx8.toml000064400000000000000000000004140072674642500176250ustar 00000000000000make = "Panasonic" model = "DMC-GX8" clean_make = "Panasonic" clean_model = "DMC-GX8" blackpoint = 144 whitepoint = 4095 color_matrix = [7564, -2263, -606, -3148, 11239, 2177, -540, 1435, 4853] color_pattern = "GBRG" [[cameras.modes]] mode = "4:3" crops = [0,64,0,0] rawloader-0.37.1/data/cameras/panasonic/gx80.toml000064400000000000000000000005010072674642500177020ustar 00000000000000make = "Panasonic" model = "DMC-GX80" clean_make = "Panasonic" clean_model = "DMC-GX80" model_aliases = [ ["DMC-GX85", "DMC-GX85"], ] blackpoint = 143 whitepoint = 4095 color_matrix = [7771, -3020, -629, -4029, 11950, 2345, -821, 1977, 6119] color_pattern = "BGGR" [[cameras.modes]] mode = "4:3" crops = [0,208,0,0] rawloader-0.37.1/data/cameras/panasonic/gx800.toml000064400000000000000000000005020072674642500177630ustar 00000000000000make = "Panasonic" model = "DC-GX800" clean_make = "Panasonic" clean_model = "DC-GX800" model_aliases = [ ["DC-GX850", "DC-GX850"], ] blackpoint = 143 whitepoint = 4095 color_matrix = [7610, -2780, -576, -4614, 12195, 2733, -1375, 2393, 6490] color_pattern = "BGGR" [[cameras.modes]] mode = "4:3" crops = [0,208,0,0] rawloader-0.37.1/data/cameras/panasonic/gx9.toml000064400000000000000000000004120072674642500176240ustar 00000000000000make = "Panasonic" model = "DC-GX9" clean_make = "Panasonic" clean_model = "DC-GX9" blackpoint = 143 whitepoint = 4095 color_matrix = [7564, -2263, -606, -3148, 11239, 2177, -540, 1435, 4853] color_pattern = "BGGR" [[cameras.modes]] mode = "4:3" crops = [0,64,0,0] rawloader-0.37.1/data/cameras/panasonic/l1.toml000064400000000000000000000004120072674642500174310ustar 00000000000000make = "Panasonic" model = "DMC-L1" clean_make = "Panasonic" clean_model = "DMC-L1" blackpoint = 0 whitepoint = 3986 color_matrix = [8054, -1885, -1025, -8349, 16367, 2040, -2805, 3542, 7629] color_pattern = "GBRG" [[cameras.modes]] mode = "4:3" crops = [0,11,1,0] rawloader-0.37.1/data/cameras/panasonic/l10.toml000064400000000000000000000004140072674642500175130ustar 00000000000000make = "Panasonic" model = "DMC-L10" clean_make = "Panasonic" clean_model = "DMC-L10" blackpoint = 0 whitepoint = 3986 color_matrix = [8025, -1942, -1050, -7920, 15904, 2100, -2456, 3005, 7039] color_pattern = "GBRG" [[cameras.modes]] mode = "4:3" crops = [0,28,1,0] rawloader-0.37.1/data/cameras/panasonic/lf1.toml000064400000000000000000000006510072674642500176040ustar 00000000000000make = "Panasonic" model = "DMC-LF1" clean_make = "Panasonic" clean_model = "DMC-LF1" blackpoint = 143 whitepoint = 3971 color_matrix = [9379, -3267, -816, -3227, 11560, 1881, -926, 1928, 5340] color_pattern = "RGGB" [[cameras.modes]] mode = "1:1" crops = [0,16,0,0] [[cameras.modes]] mode = "4:3" crops = [0,126,0,0] [[cameras.modes]] mode = "3:2" crops = [0,126,0,0] [[cameras.modes]] mode = "16:9" crops = [0,126,0,0] rawloader-0.37.1/data/cameras/panasonic/lx1.toml000064400000000000000000000004140072674642500176230ustar 00000000000000make = "Panasonic" model = "DMC-LX1" clean_make = "Panasonic" clean_model = "DMC-LX1" blackpoint = 0 whitepoint = 3971 color_matrix = [10704, -4187, -1230, -8314, 15952, 2501, -920, 945, 8927] color_pattern = "RGGB" [[cameras.modes]] mode = "16:9" crops = [0,16,0,6] rawloader-0.37.1/data/cameras/panasonic/lx10.toml000064400000000000000000000004770072674642500177140ustar 00000000000000make = "Panasonic" model = "DMC-LX10" clean_make = "Panasonic" clean_model = "DMC-LX10" model_aliases = [ ["DMC-LX15", "DMC-LX15"], ] blackpoint = 143 whitepoint = 4095 color_matrix = [7790, -2736, -755, -3452, 11870, 1769, -628, 1647, 4898] color_pattern = "GBRG" [[cameras.modes]] mode = "3:2" crops = [0,0,0,0] rawloader-0.37.1/data/cameras/panasonic/lx100.toml000064400000000000000000000006530072674642500177700ustar 00000000000000make = "Panasonic" model = "DMC-LX100" clean_make = "Panasonic" clean_model = "DMC-LX100" blackpoint = 143 whitepoint = 4095 color_matrix = [8844, -3538, -768, -3709, 11762, 2200, -698, 1792, 5220] color_pattern = "BGGR" [[cameras.modes]] mode = "1:1" crops = [0,144,0,0] [[cameras.modes]] mode = "4:3" crops = [0,16,0,0] [[cameras.modes]] mode = "3:2" crops = [0,80,0,0] [[cameras.modes]] mode = "16:9" crops = [0,96,0,0] rawloader-0.37.1/data/cameras/panasonic/lx2.toml000064400000000000000000000004140072674642500176240ustar 00000000000000make = "Panasonic" model = "DMC-LX2" clean_make = "Panasonic" clean_model = "DMC-LX2" blackpoint = 0 whitepoint = 3986 color_matrix = [8048, -2810, -623, -6450, 13519, 3272, -1700, 2146, 7049] color_pattern = "BGGR" [[cameras.modes]] mode = "16:9" crops = [0,38,3,4] rawloader-0.37.1/data/cameras/panasonic/lx3.toml000064400000000000000000000006460072674642500176340ustar 00000000000000make = "Panasonic" model = "DMC-LX3" clean_make = "Panasonic" clean_model = "DMC-LX3" blackpoint = 15 whitepoint = 3986 color_matrix = [8128, -2668, -655, -6134, 13307, 3161, -1782, 2568, 6083] color_pattern = "BGGR" [[cameras.modes]] mode = "1:1" crops = [0,74,0,0] [[cameras.modes]] mode = "4:3" crops = [0,58,0,0] [[cameras.modes]] mode = "3:2" crops = [0,44,0,0] [[cameras.modes]] mode = "16:9" crops = [0,70,0,0] rawloader-0.37.1/data/cameras/panasonic/lx5.toml000064400000000000000000000006470072674642500176370ustar 00000000000000make = "Panasonic" model = "DMC-LX5" clean_make = "Panasonic" clean_model = "DMC-LX5" blackpoint = 143 whitepoint = 3986 color_matrix = [10909, -4295, -948, -1333, 9306, 2399, 22, 1738, 4582] color_pattern = "GRBG" [[cameras.modes]] mode = "1:1" crops = [0,220,4,0] [[cameras.modes]] mode = "4:3" crops = [0,200,4,0] [[cameras.modes]] mode = "3:2" crops = [0,74,4,0] [[cameras.modes]] mode = "16:9" crops = [0,104,4,0] rawloader-0.37.1/data/cameras/panasonic/lx7.toml000064400000000000000000000006510072674642500176340ustar 00000000000000make = "Panasonic" model = "DMC-LX7" clean_make = "Panasonic" clean_model = "DMC-LX7" blackpoint = 142 whitepoint = 3971 color_matrix = [10148, -3743, -991, -2837, 11366, 1659, -701, 1893, 4899] color_pattern = "GRBG" [[cameras.modes]] mode = "1:1" crops = [0,48,0,0] [[cameras.modes]] mode = "4:3" crops = [0,34,0,0] [[cameras.modes]] mode = "3:2" crops = [0,128,0,0] [[cameras.modes]] mode = "16:9" crops = [0,160,0,0] rawloader-0.37.1/data/cameras/panasonic/tz100.toml000064400000000000000000000005770072674642500200070ustar 00000000000000make = "Panasonic" model = "DMC-TZ100" clean_make = "Panasonic" clean_model = "DMC-TZ100" model_aliases = [ ["DMC-TZ101", "DMC-TZ101"], ["DMC-TZ110", "DMC-TZ110"], ["DMC-ZS100", "DMC-ZS100"], ] blackpoint = 141 whitepoint = 4095 color_matrix = [7790, -2736, -755, -3452, 11870, 1769, -628, 1647, 4898] color_pattern = "GBRG" [[cameras.modes]] mode = "3:2" crops = [0,0,0,0] rawloader-0.37.1/data/cameras/panasonic/tz60.toml000064400000000000000000000007340072674642500177270ustar 00000000000000make = "Panasonic" model = "DMC-TZ60" clean_make = "Panasonic" clean_model = "DMC-TZ60" model_aliases = [ ["DMC-ZS40", "DMC-ZS40"], ] blackpoint = 145 whitepoint = 3956 color_matrix = [8607, -2822, -808, -3755, 11930, 2049, -820, 2060, 5224] color_pattern = "RGGB" [[cameras.modes]] mode = "1:1" crops = [0,8,0,0] [[cameras.modes]] mode = "4:3" crops = [0,128,0,0] [[cameras.modes]] mode = "3:2" crops = [0,128,0,0] [[cameras.modes]] mode = "16:9" crops = [0,128,0,0] rawloader-0.37.1/data/cameras/panasonic/tz61.toml000064400000000000000000000006520072674642500177270ustar 00000000000000make = "Panasonic" model = "DMC-TZ61" clean_make = "Panasonic" clean_model = "DMC-TZ61" blackpoint = 145 whitepoint = 3971 color_matrix = [8607, -2822, -808, -3755, 11930, 2049, -820, 2060, 5224] color_pattern = "RGGB" [[cameras.modes]] mode = "1:1" crops = [0,8,0,0] [[cameras.modes]] mode = "4:3" crops = [0,126,0,0] [[cameras.modes]] mode = "3:2" crops = [0,126,0,0] [[cameras.modes]] mode = "16:9" crops = [0,126,0,0] rawloader-0.37.1/data/cameras/panasonic/tz70.toml000064400000000000000000000006530072674642500177300ustar 00000000000000make = "Panasonic" model = "DMC-TZ70" clean_make = "Panasonic" clean_model = "DMC-TZ70" blackpoint = 143 whitepoint = 3971 color_matrix = [8802, -3135, -789, -3151, 11468, 1904, -550, 1745, 4810] color_pattern = "RGGB" [[cameras.modes]] mode = "1:1" crops = [0,16,0,0] [[cameras.modes]] mode = "4:3" crops = [0,128,0,0] [[cameras.modes]] mode = "3:2" crops = [0,128,0,0] [[cameras.modes]] mode = "16:9" crops = [0,128,0,0] rawloader-0.37.1/data/cameras/panasonic/tz71.toml000064400000000000000000000006530072674642500177310ustar 00000000000000make = "Panasonic" model = "DMC-TZ71" clean_make = "Panasonic" clean_model = "DMC-TZ71" blackpoint = 142 whitepoint = 3971 color_matrix = [8802, -3135, -789, -3151, 11468, 1904, -550, 1745, 4810] color_pattern = "RGGB" [[cameras.modes]] mode = "1:1" crops = [0,16,0,0] [[cameras.modes]] mode = "4:3" crops = [0,128,0,0] [[cameras.modes]] mode = "3:2" crops = [0,128,0,0] [[cameras.modes]] mode = "16:9" crops = [0,128,0,0] rawloader-0.37.1/data/cameras/panasonic/tz80.toml000064400000000000000000000005010072674642500177210ustar 00000000000000make = "Panasonic" model = "DMC-TZ80" clean_make = "Panasonic" clean_model = "DMC-TZ80" model_aliases = [ ["DMC-TZ81", "DMC-TZ81"], ] blackpoint = 154 whitepoint = 4095 color_matrix = [8550, -2908, -842, -3195, 11529, 1881, -338, 1603, 4631] color_pattern = "GBRG" [[cameras.modes]] mode = "4:3" crops = [0,126,0,0] rawloader-0.37.1/data/cameras/panasonic/tz90.toml000064400000000000000000000004140072674642500177250ustar 00000000000000make = "Panasonic" model = "DC-TZ90" clean_make = "Panasonic" clean_model = "DC-TZ90" blackpoint = 139 whitepoint = 4095 color_matrix = [9052, -3117, -883, -3045, 11346, 1927, -205, 1520, 4730] color_pattern = "GBRG" [[cameras.modes]] mode = "4:3" crops = [0,64,0,0] rawloader-0.37.1/data/cameras/pentax/645d.toml000064400000000000000000000003470072674642500171320ustar 00000000000000make = "PENTAX" model = "PENTAX 645D" clean_make = "Pentax" clean_model = "645D" blackpoint = 0 whitepoint = 15767 color_matrix = [10646, -3593, -1158, -3329, 11699, 1831, -667, 2874, 6287] color_pattern = "BGGR" crops = [0,0,0,0] rawloader-0.37.1/data/cameras/pentax/645z.toml000064400000000000000000000003720072674642500171560ustar 00000000000000make = "RICOH IMAGING COMPANY, LTD." model = "PENTAX 645Z" clean_make = "Pentax" clean_model = "645Z" blackpoint = 1 whitepoint = 16316 color_matrix = [9519, -3591, -664, -4074, 11725, 2671, -624, 1501, 6653] color_pattern = "RGGB" crops = [0,0,0,0] rawloader-0.37.1/data/cameras/pentax/istD.toml000064400000000000000000000003710072674642500173500ustar 00000000000000make = "PENTAX Corporation" model = "PENTAX *ist D" clean_make = "Pentax" clean_model = "*ist D" blackpoint = 128 whitepoint = 4095 color_matrix = [9651, -2059, -1189, -8881, 16512, 2487, -1460, 1345, 10687] color_pattern = "RGGB" crops = [0,0,0,0] rawloader-0.37.1/data/cameras/pentax/istDL.toml000064400000000000000000000003720072674642500174650ustar 00000000000000make = "PENTAX Corporation" model = "PENTAX *ist DL" clean_make = "Pentax" clean_model = "*ist DL" blackpoint = 128 whitepoint = 4095 color_matrix = [10829, -2838, -1115, -8339, 15817, 2696, -837, 680, 11939] color_pattern = "RGGB" crops = [0,0,0,0] rawloader-0.37.1/data/cameras/pentax/istDL2.toml000064400000000000000000000003750072674642500175520ustar 00000000000000make = "PENTAX Corporation" model = "PENTAX *ist DL2" clean_make = "Pentax" clean_model = "*ist DL2" blackpoint = 127 whitepoint = 3950 color_matrix = [10504, -2438, -1189, -8603, 16207, 2531, -1022, 863, 12242] color_pattern = "RGGB" crops = [0,0,0,0] rawloader-0.37.1/data/cameras/pentax/istDS.toml000064400000000000000000000003740072674642500174760ustar 00000000000000make = "PENTAX Corporation" model = "PENTAX *ist DS" clean_make = "Pentax" clean_model = "*ist DS" blackpoint = 128 whitepoint = 3950 color_matrix = [10371, -2333, -1206, -8688, 16231, 2602, -1230, 1116, 11282] color_pattern = "RGGB" crops = [0,0,2,0] rawloader-0.37.1/data/cameras/pentax/k-1.toml000064400000000000000000000004250072674642500170350ustar 00000000000000make = "RICOH IMAGING COMPANY, LTD." model = "PENTAX K-1" clean_make = "RICOH IMAGING COMPANY, LTD." clean_model = "PENTAX K-1" blackpoint = 64 whitepoint = 16315 color_matrix = [8596, -2981, -639, -4202, 12046, 2431, -685, 1424, 6122] color_pattern = "RGGB" crops = [0,0,0,0] rawloader-0.37.1/data/cameras/pentax/k-3.toml000064400000000000000000000003720072674642500170400ustar 00000000000000make = "RICOH IMAGING COMPANY, LTD." model = "PENTAX K-3" clean_make = "Pentax" clean_model = "K-3" blackpoint = 1 whitepoint = 16315 color_matrix = [7415, -2052, -721, -5186, 12788, 2682, -1446, 2157, 6773] color_pattern = "RGGB" crops = [0,36,0,4] rawloader-0.37.1/data/cameras/pentax/k-3II.toml000064400000000000000000000004000072674642500172520ustar 00000000000000make = "RICOH IMAGING COMPANY, LTD." model = "PENTAX K-3 II" clean_make = "Pentax" clean_model = "K-3 II" blackpoint = 0 whitepoint = 16253 color_matrix = [7415, -2052, -721, -5186, 12788, 2682, -1446, 2157, 6773] color_pattern = "RGGB" crops = [0,36,0,4] rawloader-0.37.1/data/cameras/pentax/k-5.toml000064400000000000000000000003470072674642500170440ustar 00000000000000make = "PENTAX" model = "PENTAX K-5" clean_make = "Pentax" clean_model = "K-5" blackpoint = 512 whitepoint = 15866 color_matrix = [8713, -2833, -743, -4342, 11900, 2772, -722, 1543, 6247] color_pattern = "BGGR" crops = [0,34,0,12] rawloader-0.37.1/data/cameras/pentax/k-5II.toml000064400000000000000000000003550072674642500172650ustar 00000000000000make = "PENTAX" model = "PENTAX K-5 II" clean_make = "Pentax" clean_model = "K-5 II" blackpoint = 256 whitepoint = 16124 color_matrix = [8170, -2725, -639, -4440, 12017, 2744, -771, 1465, 6599] color_pattern = "BGGR" crops = [0,34,0,12] rawloader-0.37.1/data/cameras/pentax/k-5IIs.toml000064400000000000000000000003610072674642500174450ustar 00000000000000make = "PENTAX" model = "PENTAX K-5 II s" clean_make = "Pentax" clean_model = "K-5 II s" blackpoint = 129 whitepoint = 16253 color_matrix = [8170, -2725, -639, -4440, 12017, 2744, -771, 1465, 6599] color_pattern = "BGGR" crops = [0,34,0,12] rawloader-0.37.1/data/cameras/pentax/k-7.toml000064400000000000000000000003450072674642500170440ustar 00000000000000make = "PENTAX" model = "PENTAX K-7" clean_make = "Pentax" clean_model = "K-7" blackpoint = 0 whitepoint = 4095 color_matrix = [9142, -2947, -678, -8648, 16967, 1663, -2224, 2898, 8615] color_pattern = "BGGR" crops = [0,64,32,0] rawloader-0.37.1/data/cameras/pentax/k-70.toml000064400000000000000000000004270072674642500171250ustar 00000000000000make = "RICOH IMAGING COMPANY, LTD." model = "PENTAX K-70" clean_make = "RICOH IMAGING COMPANY, LTD." clean_model = "PENTAX K-70" blackpoint = 64 whitepoint = 16315 color_matrix = [8766, -3149, -747, -3976, 11943, 2292, -517, 1259, 5552] color_pattern = "RGGB" crops = [0,0,0,0] rawloader-0.37.1/data/cameras/pentax/k-m.toml000064400000000000000000000003440072674642500171310ustar 00000000000000make = "PENTAX" model = "PENTAX K-m" clean_make = "Pentax" clean_model = "K-m" blackpoint = 0 whitepoint = 4095 color_matrix = [11057, -3604, -1155, -5152, 13046, 2329, -282, 375, 8104] color_pattern = "RGGB" crops = [0,36,8,0] rawloader-0.37.1/data/cameras/pentax/k-r.toml000064400000000000000000000003450072674642500171370ustar 00000000000000make = "PENTAX" model = "PENTAX K-r" clean_make = "Pentax" clean_model = "K-r" blackpoint = 129 whitepoint = 3964 color_matrix = [9895, -3077, -850, -5304, 13035, 2521, -883, 1768, 6936] color_pattern = "BGGR" crops = [2,44,0,2] rawloader-0.37.1/data/cameras/pentax/k-s1.toml000064400000000000000000000003720072674642500172210ustar 00000000000000make = "RICOH IMAGING COMPANY, LTD." model = "PENTAX K-S1" clean_make = "Pentax" clean_model = "K-S1" blackpoint = 32 whitepoint = 4062 color_matrix = [8512, -3211, -787, -4167, 11966, 2487, -638, 1288, 6054] color_pattern = "RGGB" crops = [0,0,0,0] rawloader-0.37.1/data/cameras/pentax/k-s2.toml000064400000000000000000000004010072674642500172130ustar 00000000000000make = "RICOH IMAGING COMPANY, LTD." model = "PENTAX K-S2" clean_make = "Pentax" clean_model = "K-S2" blackpoint = 16 whitepoint = 4079 color_matrix = [52900, -16627, -7529, -25443, 80936, 11071, -5585, 9879, 41775] color_pattern = "RGGB" crops = [0,0,0,0] rawloader-0.37.1/data/cameras/pentax/k-x.toml000064400000000000000000000003440072674642500171440ustar 00000000000000make = "PENTAX" model = "PENTAX K-x" clean_make = "Pentax" clean_model = "K-x" blackpoint = 48 whitepoint = 4095 color_matrix = [8843, -2837, -625, -5025, 12644, 2668, -411, 1234, 7410] color_pattern = "BGGR" crops = [0,44,2,0] rawloader-0.37.1/data/cameras/pentax/k100.toml000064400000000000000000000003670072674642500171250ustar 00000000000000make = "PENTAX Corporation" model = "PENTAX K100D" clean_make = "Pentax" clean_model = "K100D" blackpoint = 128 whitepoint = 3950 color_matrix = [11095, -3157, -1324, -8377, 15834, 2720, -1108, 947, 11688] color_pattern = "RGGB" crops = [0,0,0,0] rawloader-0.37.1/data/cameras/pentax/k100dsuper.toml000064400000000000000000000004030072674642500203370ustar 00000000000000make = "PENTAX Corporation" model = "PENTAX K100D Super" clean_make = "Pentax" clean_model = "K100D Super" blackpoint = 127 whitepoint = 4095 color_matrix = [11095, -3157, -1324, -8377, 15834, 2720, -1108, 947, 11688] color_pattern = "RGGB" crops = [0,0,0,0] rawloader-0.37.1/data/cameras/pentax/k10d.toml000064400000000000000000000003610072674642500172030ustar 00000000000000make = "PENTAX Corporation" model = "PENTAX K10D" clean_make = "Pentax" clean_model = "K10D" blackpoint = 0 whitepoint = 4095 color_matrix = [9566, -2863, -803, -7170, 15172, 2112, -818, 803, 9705] color_pattern = "RGGB" crops = [0,48,16,0] rawloader-0.37.1/data/cameras/pentax/k110d.toml000064400000000000000000000003670072674642500172720ustar 00000000000000make = "PENTAX Corporation" model = "PENTAX K110D" clean_make = "Pentax" clean_model = "K110D" blackpoint = 127 whitepoint = 4095 color_matrix = [11095, -3157, -1324, -8377, 15834, 2720, -1108, 947, 11688] color_pattern = "RGGB" crops = [0,0,0,0] rawloader-0.37.1/data/cameras/pentax/k200d.toml000064400000000000000000000003650072674642500172700ustar 00000000000000make = "PENTAX Corporation" model = "PENTAX K200D" clean_make = "Pentax" clean_model = "K200D" blackpoint = 0 whitepoint = 4095 color_matrix = [9186, -2678, -907, -8693, 16517, 2260, -1129, 1094, 8524] color_pattern = "RGGB" crops = [0,56,20,0] rawloader-0.37.1/data/cameras/pentax/k20d.toml000064400000000000000000000003640072674642500172070ustar 00000000000000make = "PENTAX Corporation" model = "PENTAX K20D" clean_make = "Pentax" clean_model = "K20D" blackpoint = 0 whitepoint = 4095 color_matrix = [9427, -2714, -868, -7493, 16092, 1373, -2199, 3264, 7180] color_pattern = "BGGR" crops = [0,176,12,0] rawloader-0.37.1/data/cameras/pentax/kp.toml000064400000000000000000000003710072674642500170570ustar 00000000000000make = "RICOH IMAGING COMPANY, LTD." model = "PENTAX KP" clean_make = "Pentax" clean_model = "KP" blackpoint = 128 whitepoint = 16254 color_matrix = [8617, -3228, -1034, -4674, 12821, 2044, -803, 1577, 5728] color_pattern = "RGGB" crops = [0,0,0,0] rawloader-0.37.1/data/cameras/pentax/optios4.toml000064400000000000000000000005640072674642500200520ustar 00000000000000make = "Pentax" model = "Optio S4" clean_make = "Pentax" clean_model = "Optio S4" blackpoint = 0 whitepoint = 3968 # Matrix stolen from Canon A610 because it looks ok... color_matrix = [15591, -6402, -1592, -5365, 13198, 2168, -1300, 1824, 5075] color_pattern = "RGGB" crops = [0,22,0,0] filesize = 6114240 raw_width = 2346 raw_height = 1737 hints = ["12le_16bitaligned"] rawloader-0.37.1/data/cameras/phase_one/iq140.toml000064400000000000000000000003540072674642500177460ustar 00000000000000make = "Phase One A/S" model = "IQ140" clean_make = "Phase One" clean_model = "IQ140" blackpoint = 0 whitepoint = 65535 color_matrix = [8035, 435, -962, -6001, 13872, 2320, -1159, 3065, 5434] color_pattern = "RGGB" crops = [6,16,46,36] rawloader-0.37.1/data/cameras/phase_one/iq250.toml000064400000000000000000000003340072674642500177460ustar 00000000000000make = "Phase One A/S" model = "IQ250" clean_make = "Phase One" clean_model = "IQ250" blackpoint = 1024 whitepoint = 65535 color_matrix = [3984, 0, 0, 0, 10000, 0, 0, 0, 7666] color_pattern = "RGGB" crops = [108,0,0,92] rawloader-0.37.1/data/cameras/phase_one/p30.toml000064400000000000000000000003550072674642500175130ustar 00000000000000make = "Phase One A/S" model = "P30" clean_make = "Phase One A/S" clean_model = "P30" blackpoint = 0 whitepoint = 65535 color_matrix = [4516, -245, -37, -7020, 14976, 2173, -3206, 4671, 7087] color_pattern = "GRBG" crops = [22,20,28,40] rawloader-0.37.1/data/cameras/phase_one/p65.toml000064400000000000000000000003560072674642500175240ustar 00000000000000make = "Phase One A/S" model = "P65+" clean_make = "Phase One A/S" clean_model = "P65+" blackpoint = 0 whitepoint = 65535 color_matrix = [8035, 435, -962, -6001, 13872, 2320, -1159, 3065, 5434] color_pattern = "RGGB" crops = [6,16,32,46] rawloader-0.37.1/data/cameras/samsung/ex1.toml000064400000000000000000000003370072674642500173220ustar 00000000000000make = "SAMSUNG" model = "EX1" clean_make = "Samsung" clean_model = "EX1" blackpoint = 0 whitepoint = 15600 color_matrix = [8898, -2498, -994, -3144, 11328, 2066, -760, 1381, 4576] color_pattern = "RGGB" crops = [2,8,22,0] rawloader-0.37.1/data/cameras/samsung/ex2f.toml000064400000000000000000000003460072674642500174710ustar 00000000000000make = "SAMSUNG" model = "EX2F" clean_make = "Samsung" clean_model = "EX2F" blackpoint = 0 whitepoint = 4095 color_matrix = [10648, -3897, -1055, -2022, 10573, 1668, -492, 1611, 4742] color_pattern = "RGGB" crops = [12,148,18,22] rawloader-0.37.1/data/cameras/samsung/galaxy_nx.toml000064400000000000000000000003530072674642500206150ustar 00000000000000make = "SAMSUNG" model = "EK-GN120" clean_make = "Samsung" clean_model = "EK-GN120" blackpoint = 0 whitepoint = 4095 color_matrix = [7557, -2522, -739, -4679, 12949, 1894, -840, 1777, 5311] color_pattern = "GRBG" crops = [25,11,29,45] rawloader-0.37.1/data/cameras/samsung/nx1.toml000064400000000000000000000003410072674642500173260ustar 00000000000000make = "SAMSUNG" model = "NX1" clean_make = "Samsung" clean_model = "NX1" blackpoint = 128 whitepoint = 16100 color_matrix = [10686, -4042, -1052, -3595, 13238, 276, -464, 1259, 5931] color_pattern = "GRBG" crops = [0,0,0,0] rawloader-0.37.1/data/cameras/samsung/nx10.toml000064400000000000000000000003450072674642500174120ustar 00000000000000make = "SAMSUNG" model = "NX10" clean_make = "Samsung" clean_model = "NX10" blackpoint = 3 whitepoint = 3750 color_matrix = [10332, -3234, -1168, -6111, 14639, 1520, -1352, 2647, 8331] color_pattern = "BGGR" crops = [8,85,48,17] rawloader-0.37.1/data/cameras/samsung/nx100.toml000064400000000000000000000003470072674642500174740ustar 00000000000000make = "SAMSUNG" model = "NX100" clean_make = "Samsung" clean_model = "NX100" blackpoint = 3 whitepoint = 3750 color_matrix = [10332, -3234, -1168, -6111, 14639, 1520, -1352, 2647, 8331] color_pattern = "BGGR" crops = [8,85,48,17] rawloader-0.37.1/data/cameras/samsung/nx1000.toml000064400000000000000000000004010072674642500175430ustar 00000000000000make = "SAMSUNG" model = "NX1000" clean_make = "Samsung" clean_model = "NX1000" blackpoint = 0 whitepoint = 3750 color_matrix = [6933, -2268, -753, -4921, 13387, 1647, -803, 1641, 6096] color_pattern = "GRBG" crops = [17,71,55,89] hints = ["little_endian"] rawloader-0.37.1/data/cameras/samsung/nx11.toml000064400000000000000000000003450072674642500174130ustar 00000000000000make = "SAMSUNG" model = "NX11" clean_make = "Samsung" clean_model = "NX11" blackpoint = 3 whitepoint = 3750 color_matrix = [10332, -3234, -1168, -6111, 14639, 1520, -1352, 2647, 8331] color_pattern = "BGGR" crops = [8,85,48,17] rawloader-0.37.1/data/cameras/samsung/nx20.toml000064400000000000000000000003750072674642500174160ustar 00000000000000make = "SAMSUNG" model = "NX20" clean_make = "Samsung" clean_model = "NX20" blackpoint = 0 whitepoint = 3750 color_matrix = [6933, -2268, -753, -4921, 13387, 1647, -803, 1641, 6096] color_pattern = "GRBG" crops = [17,71,55,89] hints = ["little_endian"] rawloader-0.37.1/data/cameras/samsung/nx200.toml000064400000000000000000000003450072674642500174730ustar 00000000000000make = "SAMSUNG" model = "NX200" clean_make = "Samsung" clean_model = "NX200" blackpoint = 0 whitepoint = 3750 color_matrix = [6933, -2268, -753, -4921, 13387, 1647, -803, 1641, 6096] color_pattern = "GRBG" crops = [17,71,55,89] rawloader-0.37.1/data/cameras/samsung/nx2000.toml000064400000000000000000000003470072674642500175550ustar 00000000000000make = "SAMSUNG" model = "NX2000" clean_make = "Samsung" clean_model = "NX2000" blackpoint = 0 whitepoint = 4095 color_matrix = [7557, -2522, -739, -4679, 12949, 1894, -840, 1777, 5311] color_pattern = "GRBG" crops = [25,11,29,45] rawloader-0.37.1/data/cameras/samsung/nx210.toml000064400000000000000000000003770072674642500175010ustar 00000000000000make = "SAMSUNG" model = "NX210" clean_make = "Samsung" clean_model = "NX210" blackpoint = 0 whitepoint = 3750 color_matrix = [6933, -2268, -753, -4921, 13387, 1647, -803, 1641, 6096] color_pattern = "GRBG" crops = [17,71,55,89] hints = ["little_endian"] rawloader-0.37.1/data/cameras/samsung/nx30.toml000064400000000000000000000003430072674642500174120ustar 00000000000000make = "SAMSUNG" model = "NX30" clean_make = "Samsung" clean_model = "NX30" blackpoint = 0 whitepoint = 4095 color_matrix = [7557, -2522, -739, -4679, 12949, 1894, -840, 1777, 5311] color_pattern = "GRBG" crops = [25,11,29,45] rawloader-0.37.1/data/cameras/samsung/nx300.toml000064400000000000000000000003450072674642500174740ustar 00000000000000make = "SAMSUNG" model = "NX300" clean_make = "Samsung" clean_model = "NX300" blackpoint = 0 whitepoint = 4095 color_matrix = [7557, -2522, -739, -4679, 12949, 1894, -840, 1777, 5311] color_pattern = "GRBG" crops = [25,11,29,45] rawloader-0.37.1/data/cameras/samsung/nx3000.toml000064400000000000000000000003470072674642500175560ustar 00000000000000make = "SAMSUNG" model = "NX3000" clean_make = "Samsung" clean_model = "NX3000" blackpoint = 0 whitepoint = 4095 color_matrix = [8060, -2933, -761, -4504, 12890, 1762, -630, 1489, 5227] color_pattern = "GRBG" crops = [42,32,24,96] rawloader-0.37.1/data/cameras/samsung/nx300m.toml000064400000000000000000000003470072674642500176530ustar 00000000000000make = "SAMSUNG" model = "NX300M" clean_make = "Samsung" clean_model = "NX300M" blackpoint = 0 whitepoint = 4095 color_matrix = [7557, -2522, -739, -4679, 12949, 1894, -840, 1777, 5311] color_pattern = "GRBG" crops = [25,11,29,45] rawloader-0.37.1/data/cameras/samsung/nx500.toml000064400000000000000000000003450072674642500174760ustar 00000000000000make = "SAMSUNG" model = "NX500" clean_make = "Samsung" clean_model = "NX500" blackpoint = 128 whitepoint = 16100 color_matrix = [10686, -4042, -1052, -3595, 13238, 276, -464, 1259, 5931] color_pattern = "GRBG" crops = [0,0,0,0] rawloader-0.37.1/data/cameras/samsung/nx_mini.toml000064400000000000000000000003510072674642500202620ustar 00000000000000make = "SAMSUNG" model = "NX mini" clean_make = "Samsung" clean_model = "NX mini" blackpoint = 0 whitepoint = 4000 color_matrix = [5222, -1196, -550, -6540, 14649, 2009, -1666, 2819, 5657] color_pattern = "RGGB" crops = [16,56,0,96] rawloader-0.37.1/data/cameras/sony/a100.toml000064400000000000000000000003520072674642500165760ustar 00000000000000make = "SONY" model = "DSLR-A100" clean_make = "Sony" clean_model = "DSLR-A100" blackpoint = 0 whitepoint = 4095 color_matrix = [9437, -2811, -774, -8405, 16215, 2290, -710, 596, 7181] color_pattern = "GRBG" crops = [0,0,0,0] bps = 8 rawloader-0.37.1/data/cameras/sony/a200.toml000064400000000000000000000003520072674642500165770ustar 00000000000000make = "SONY" model = "DSLR-A200" clean_make = "Sony" clean_model = "DSLR-A200" blackpoint = 0 whitepoint = 4095 color_matrix = [9847, -3091, -928, -8485, 16345, 2225, -715, 595, 7103] color_pattern = "RGGB" crops = [0,0,0,0] bps = 8 rawloader-0.37.1/data/cameras/sony/a230.toml000064400000000000000000000003520072674642500166020ustar 00000000000000make = "SONY" model = "DSLR-A230" clean_make = "Sony" clean_model = "DSLR-A230" blackpoint = 0 whitepoint = 4095 color_matrix = [9847, -3091, -929, -8485, 16346, 2225, -714, 595, 7103] color_pattern = "RGGB" crops = [0,0,0,0] bps = 8 rawloader-0.37.1/data/cameras/sony/a300.toml000064400000000000000000000003420072674642500165770ustar 00000000000000make = "SONY" model = "DSLR-A300" clean_make = "Sony" clean_model = "DSLR-A300" blackpoint = 0 whitepoint = 4095 color_matrix = [9847, -3091, -928, -8485, 16345, 2225, -715, 595, 7103] color_pattern = "RGGB" crops = [0,0,0,0] rawloader-0.37.1/data/cameras/sony/a3000.toml000064400000000000000000000003570072674642500166650ustar 00000000000000make = "SONY" model = "ILCE-3000" clean_make = "Sony" clean_model = "ILCE-3000" blackpoint = 512 whitepoint = 16300 color_matrix = [5991, -1456, -455, -4764, 12135, 2980, -707, 1425, 6701] color_pattern = "RGGB" crops = [0,34,0,0] bps = 8 rawloader-0.37.1/data/cameras/sony/a33.toml000064400000000000000000000003530072674642500165240ustar 00000000000000make = "SONY" model = "SLT-A33" clean_make = "Sony" clean_model = "SLT-A33" blackpoint = 512 whitepoint = 16300 color_matrix = [6069, -1221, -366, -5221, 12779, 2734, -1024, 2066, 6834] color_pattern = "RGGB" crops = [0,0,0,0] bps = 8 rawloader-0.37.1/data/cameras/sony/a330.toml000064400000000000000000000003520072674642500166030ustar 00000000000000make = "SONY" model = "DSLR-A330" clean_make = "Sony" clean_model = "DSLR-A330" blackpoint = 0 whitepoint = 4095 color_matrix = [9847, -3091, -929, -8485, 16346, 2225, -714, 595, 7103] color_pattern = "RGGB" crops = [0,0,0,0] bps = 8 rawloader-0.37.1/data/cameras/sony/a35.toml000064400000000000000000000003520072674642500165250ustar 00000000000000make = "SONY" model = "SLT-A35" clean_make = "Sony" clean_model = "SLT-A35" blackpoint = 512 whitepoint = 16300 color_matrix = [5986, -1618, -415, -4557, 11820, 3120, -681, 1404, 6971] color_pattern = "RGGB" crops = [0,0,0,0] bps = 8 rawloader-0.37.1/data/cameras/sony/a350.toml000064400000000000000000000003520072674642500166050ustar 00000000000000make = "SONY" model = "DSLR-A350" clean_make = "Sony" clean_model = "DSLR-A350" blackpoint = 0 whitepoint = 4095 color_matrix = [6038, -1484, -578, -9146, 16746, 2513, -875, 746, 7217] color_pattern = "RGGB" crops = [0,0,0,0] bps = 8 rawloader-0.37.1/data/cameras/sony/a3500.toml000064400000000000000000000003570072674642500166720ustar 00000000000000make = "SONY" model = "ILCE-3500" clean_make = "Sony" clean_model = "ILCE-3500" blackpoint = 512 whitepoint = 16300 color_matrix = [5991, -1456, -455, -4764, 12135, 2980, -707, 1425, 6701] color_pattern = "RGGB" crops = [0,34,0,0] bps = 8 rawloader-0.37.1/data/cameras/sony/a37.toml000064400000000000000000000003520072674642500165270ustar 00000000000000make = "SONY" model = "SLT-A37" clean_make = "Sony" clean_model = "SLT-A37" blackpoint = 512 whitepoint = 16300 color_matrix = [5991, -1456, -455, -4764, 12135, 2980, -707, 1425, 6701] color_pattern = "RGGB" crops = [0,0,0,0] bps = 8 rawloader-0.37.1/data/cameras/sony/a390.toml000064400000000000000000000003520072674642500166110ustar 00000000000000make = "SONY" model = "DSLR-A390" clean_make = "Sony" clean_model = "DSLR-A390" blackpoint = 0 whitepoint = 4095 color_matrix = [6038, -1484, -579, -9145, 16746, 2512, -875, 746, 7218] color_pattern = "RGGB" crops = [0,0,0,0] bps = 8 rawloader-0.37.1/data/cameras/sony/a450.toml000064400000000000000000000003550072674642500166110ustar 00000000000000make = "SONY" model = "DSLR-A450" clean_make = "Sony" clean_model = "DSLR-A450" blackpoint = 512 whitepoint = 16300 color_matrix = [4950, -580, -103, -5228, 12542, 3029, -709, 1435, 7371] color_pattern = "RGGB" crops = [0,0,0,0] bps = 8 rawloader-0.37.1/data/cameras/sony/a500.toml000064400000000000000000000003560072674642500166060ustar 00000000000000make = "SONY" model = "DSLR-A500" clean_make = "Sony" clean_model = "DSLR-A500" blackpoint = 512 whitepoint = 16300 color_matrix = [6046, -1127, -278, -5574, 13076, 2786, -691, 1419, 7625] color_pattern = "RGGB" crops = [0,0,0,0] bps = 8 rawloader-0.37.1/data/cameras/sony/a5000.toml000064400000000000000000000003570072674642500166670ustar 00000000000000make = "SONY" model = "ILCE-5000" clean_make = "Sony" clean_model = "ILCE-5000" blackpoint = 512 whitepoint = 16300 color_matrix = [5991, -1456, -455, -4764, 12135, 2980, -707, 1425, 6701] color_pattern = "RGGB" crops = [0,34,0,0] bps = 8 rawloader-0.37.1/data/cameras/sony/a5100.toml000064400000000000000000000003570072674642500166700ustar 00000000000000make = "SONY" model = "ILCE-5100" clean_make = "Sony" clean_model = "ILCE-5100" blackpoint = 512 whitepoint = 16300 color_matrix = [5991, -1456, -455, -4764, 12135, 2980, -707, 1425, 6701] color_pattern = "RGGB" crops = [0,26,0,0] bps = 8 rawloader-0.37.1/data/cameras/sony/a55.toml000064400000000000000000000004340072674642500165300ustar 00000000000000make = "SONY" model = "SLT-A55" clean_make = "Sony" clean_model = "SLT-A55" model_aliases = [ ["SLT-A55V", "SLT-A55V"], ] blackpoint = 512 whitepoint = 16300 color_matrix = [5932, -1492, -411, -4813, 12285, 2856, -741, 1524, 6739] color_pattern = "RGGB" crops = [0,0,0,0] bps = 8 rawloader-0.37.1/data/cameras/sony/a550.toml000064400000000000000000000003550072674642500166120ustar 00000000000000make = "SONY" model = "DSLR-A550" clean_make = "Sony" clean_model = "DSLR-A550" blackpoint = 512 whitepoint = 16300 color_matrix = [4950, -580, -103, -5228, 12542, 3029, -709, 1435, 7371] color_pattern = "RGGB" crops = [0,0,0,0] bps = 8 rawloader-0.37.1/data/cameras/sony/a57.toml000064400000000000000000000003520072674642500165310ustar 00000000000000make = "SONY" model = "SLT-A57" clean_make = "Sony" clean_model = "SLT-A57" blackpoint = 512 whitepoint = 16300 color_matrix = [5991, -1456, -455, -4764, 12135, 2980, -707, 1425, 6701] color_pattern = "RGGB" crops = [0,0,0,0] bps = 8 rawloader-0.37.1/data/cameras/sony/a58.toml000064400000000000000000000003530072674642500165330ustar 00000000000000make = "SONY" model = "SLT-A58" clean_make = "Sony" clean_model = "SLT-A58" blackpoint = 512 whitepoint = 16300 color_matrix = [5991, -1456, -455, -4764, 12135, 2980, -707, 1425, 6701] color_pattern = "RGGB" crops = [0,36,0,0] bps = 8 rawloader-0.37.1/data/cameras/sony/a580.toml000064400000000000000000000003560072674642500166160ustar 00000000000000make = "SONY" model = "DSLR-A580" clean_make = "Sony" clean_model = "DSLR-A580" blackpoint = 512 whitepoint = 16300 color_matrix = [5932, -1492, -411, -4813, 12285, 2856, -741, 1524, 6739] color_pattern = "RGGB" crops = [0,2,2,0] bps = 8 rawloader-0.37.1/data/cameras/sony/a6000.toml000064400000000000000000000003570072674642500166700ustar 00000000000000make = "SONY" model = "ILCE-6000" clean_make = "Sony" clean_model = "ILCE-6000" blackpoint = 512 whitepoint = 16300 color_matrix = [5991, -1456, -455, -4764, 12135, 2980, -707, 1425, 6701] color_pattern = "RGGB" crops = [0,28,0,0] bps = 8 rawloader-0.37.1/data/cameras/sony/a6300.toml000064400000000000000000000003560072674642500166720ustar 00000000000000make = "SONY" model = "ILCE-6300" clean_make = "SONY" clean_model = "ILCE-6300" blackpoint = 512 whitepoint = 16300 color_matrix = [5973, -1695, -419, -3826, 11797, 2293, -639, 1398, 5789] color_pattern = "RGGB" crops = [0,0,0,0] bps = 8 rawloader-0.37.1/data/cameras/sony/a65.toml000064400000000000000000000004350072674642500165320ustar 00000000000000make = "SONY" model = "SLT-A65" clean_make = "Sony" clean_model = "SLT-A65" model_aliases = [ ["SLT-A65V", "SLT-A65V"], ] blackpoint = 512 whitepoint = 16300 color_matrix = [5491, -1192, -363, -4951, 12342, 2948, -911, 1722, 7192] color_pattern = "RGGB" crops = [0,30,0,0] bps = 8 rawloader-0.37.1/data/cameras/sony/a6500.toml000064400000000000000000000003560072674642500166740ustar 00000000000000make = "SONY" model = "ILCE-6500" clean_make = "SONY" clean_model = "ILCE-6500" blackpoint = 512 whitepoint = 16300 color_matrix = [5973, -1695, -419, -3826, 11797, 2293, -639, 1398, 5789] color_pattern = "RGGB" crops = [0,0,0,0] bps = 8 rawloader-0.37.1/data/cameras/sony/a68.toml000064400000000000000000000003530072674642500165340ustar 00000000000000make = "SONY" model = "ILCA-68" clean_make = "Sony" clean_model = "ILCA-68" blackpoint = 512 whitepoint = 16300 color_matrix = [6435, -1903, -536, -4722, 12449, 2550, -663, 1363, 6517] color_pattern = "RGGB" crops = [0,32,0,0] bps = 8 rawloader-0.37.1/data/cameras/sony/a7.toml000064400000000000000000000003510072674642500164430ustar 00000000000000make = "SONY" model = "ILCE-7" clean_make = "Sony" clean_model = "ILCE-7" blackpoint = 512 whitepoint = 16300 color_matrix = [5271, -712, -347, -6153, 13653, 2763, -1601, 2366, 7242] color_pattern = "RGGB" crops = [0,26,0,0] bps = 8 rawloader-0.37.1/data/cameras/sony/a700.toml000064400000000000000000000003460072674642500166070ustar 00000000000000make = "SONY" model = "DSLR-A700" clean_make = "Sony" clean_model = "DSLR-A700" blackpoint = 512 whitepoint = 16383 color_matrix = [5775, -805, -359, -8574, 16295, 2391, -1943, 2341, 7249] color_pattern = "RGGB" crops = [0,0,0,0] rawloader-0.37.1/data/cameras/sony/a77.toml000064400000000000000000000004350072674642500165350ustar 00000000000000make = "SONY" model = "SLT-A77" clean_make = "Sony" clean_model = "SLT-A77" model_aliases = [ ["SLT-A77V", "SLT-A77V"], ] blackpoint = 512 whitepoint = 16300 color_matrix = [5491, -1192, -363, -4951, 12342, 2948, -911, 1722, 7192] color_pattern = "RGGB" crops = [0,28,0,0] bps = 8 rawloader-0.37.1/data/cameras/sony/a77m2.toml000064400000000000000000000003570072674642500167770ustar 00000000000000make = "SONY" model = "ILCA-77M2" clean_make = "Sony" clean_model = "ILCA-77M2" blackpoint = 512 whitepoint = 16300 color_matrix = [5991, -1732, -443, -4100, 11989, 2381, -704, 1467, 5992] color_pattern = "RGGB" crops = [0,26,0,0] bps = 8 rawloader-0.37.1/data/cameras/sony/a7m2.toml000064400000000000000000000003550072674642500167060ustar 00000000000000make = "SONY" model = "ILCE-7M2" clean_make = "Sony" clean_model = "ILCE-7M2" blackpoint = 512 whitepoint = 16300 color_matrix = [5271, -712, -347, -6153, 13653, 2763, -1601, 2366, 7242] color_pattern = "RGGB" crops = [0,26,0,0] bps = 8 rawloader-0.37.1/data/cameras/sony/a7m3.toml000064400000000000000000000003550072674642500167070ustar 00000000000000make = "SONY" model = "ILCE-7M3" clean_make = "Sony" clean_model = "ILCE-7M3" blackpoint = 512 whitepoint = 16300 color_matrix = [7374, -2389, -551, -5435, 13162, 2519, -1006, 1795, 6552] color_pattern = "RGGB" crops = [0,0,0,0] bps = 8 rawloader-0.37.1/data/cameras/sony/a7r.toml000064400000000000000000000003530072674642500166270ustar 00000000000000make = "SONY" model = "ILCE-7R" clean_make = "Sony" clean_model = "ILCE-7R" blackpoint = 512 whitepoint = 16300 color_matrix = [4913, -541, -202, -6130, 13513, 2906, -1564, 2151, 7183] color_pattern = "RGGB" crops = [0,26,0,0] bps = 8 rawloader-0.37.1/data/cameras/sony/a7rm2.toml000064400000000000000000000003570072674642500170720ustar 00000000000000make = "SONY" model = "ILCE-7RM2" clean_make = "Sony" clean_model = "ILCE-7RM2" blackpoint = 512 whitepoint = 16300 color_matrix = [6629, -1900, -483, -4618, 12349, 2550, -622, 1381, 6514] color_pattern = "RGGB" crops = [0,32,0,0] bps = 8 rawloader-0.37.1/data/cameras/sony/a7rm3.toml000064400000000000000000000003560072674642500170720ustar 00000000000000make = "SONY" model = "ILCE-7RM3" clean_make = "Sony" clean_model = "ILCE-7RM3" blackpoint = 512 whitepoint = 16380 color_matrix = [6640, -1847, -503, -5238, 13010, 2474, -993, 1673, 6527] color_pattern = "RGGB" crops = [0,0,0,0] bps = 8 rawloader-0.37.1/data/cameras/sony/a7s.toml000064400000000000000000000003530072674642500166300ustar 00000000000000make = "SONY" model = "ILCE-7S" clean_make = "Sony" clean_model = "ILCE-7S" blackpoint = 512 whitepoint = 16300 color_matrix = [5838, -1430, -246, -3497, 11477, 2297, -748, 1885, 5778] color_pattern = "RGGB" crops = [0,32,0,0] bps = 8 rawloader-0.37.1/data/cameras/sony/a7sm2.toml000064400000000000000000000003570072674642500170730ustar 00000000000000make = "SONY" model = "ILCE-7SM2" clean_make = "Sony" clean_model = "ILCE-7SM2" blackpoint = 512 whitepoint = 16300 color_matrix = [5838, -1430, -246, -3497, 11477, 2297, -748, 1885, 5778] color_pattern = "RGGB" crops = [0,32,0,0] bps = 8 rawloader-0.37.1/data/cameras/sony/a850.toml000064400000000000000000000003450072674642500166140ustar 00000000000000make = "SONY" model = "DSLR-A850" clean_make = "Sony" clean_model = "DSLR-A850" blackpoint = 128 whitepoint = 4095 color_matrix = [5413, -1162, -365, -5665, 13098, 2866, -608, 1179, 8440] color_pattern = "RGGB" crops = [0,0,0,0] rawloader-0.37.1/data/cameras/sony/a9.toml000064400000000000000000000003500072674642500164440ustar 00000000000000make = "SONY" model = "ILCE-9" clean_make = "Sony" clean_model = "ILCE-9" blackpoint = 512 whitepoint = 16383 color_matrix = [6389, -1703, -378, -4562, 12265, 2587, -670, 1489, 6550] color_pattern = "RGGB" crops = [0,0,0,0] bps = 8 rawloader-0.37.1/data/cameras/sony/a900.toml000064400000000000000000000003460072674642500166110ustar 00000000000000make = "SONY" model = "DSLR-A900" clean_make = "Sony" clean_model = "DSLR-A900" blackpoint = 128 whitepoint = 4095 color_matrix = [5209, -1072, -397, -8845, 16120, 2919, -1618, 1803, 8654] color_pattern = "RGGB" crops = [0,0,0,0] rawloader-0.37.1/data/cameras/sony/a99.toml000064400000000000000000000004350072674642500165410ustar 00000000000000make = "SONY" model = "SLT-A99" clean_make = "Sony" clean_model = "SLT-A99" model_aliases = [ ["SLT-A99V", "SLT-A99V"], ] blackpoint = 512 whitepoint = 16300 color_matrix = [6344, -1612, -462, -4863, 12477, 2681, -865, 1786, 6899] color_pattern = "RGGB" crops = [0,28,0,0] bps = 8 rawloader-0.37.1/data/cameras/sony/a99m2.toml000064400000000000000000000003560072674642500170020ustar 00000000000000make = "SONY" model = "ILCA-99M2" clean_make = "Sony" clean_model = "ILCA-99M2" blackpoint = 512 whitepoint = 16300 color_matrix = [6660, -1918, -471, -4613, 12398, 2485, -649, 1433, 6447] color_pattern = "RGGB" crops = [0,0,0,0] bps = 8 rawloader-0.37.1/data/cameras/sony/f828.toml000064400000000000000000000003720072674642500166260ustar 00000000000000make = "SONY" model = "DSC-F828" clean_make = "Sony" clean_model = "DSC-F828" blackpoint = 495 whitepoint = 16383 color_matrix = [7924, -1910, -777, -8226, 15459, 2998, -1517, 2199, 6818, -7242, 11401, 3481] color_pattern = "ERBG" crops = [0,67,0,5] rawloader-0.37.1/data/cameras/sony/nex3.toml000064400000000000000000000003460072674642500170150ustar 00000000000000make = "SONY" model = "NEX-3" clean_make = "Sony" clean_model = "NEX-3" blackpoint = 512 whitepoint = 16300 color_matrix = [6549, -1550, -436, -4880, 12435, 2753, -854, 1868, 6976] color_pattern = "RGGB" crops = [0,0,0,0] bps = 8 rawloader-0.37.1/data/cameras/sony/nex3n.toml000064400000000000000000000003510072674642500171670ustar 00000000000000make = "SONY" model = "NEX-3N" clean_make = "Sony" clean_model = "NEX-3N" blackpoint = 512 whitepoint = 16300 color_matrix = [6129, -1545, -418, -4930, 12490, 2743, -977, 1693, 6615] color_pattern = "RGGB" crops = [0,10,0,0] bps = 8 rawloader-0.37.1/data/cameras/sony/nex5.toml000064400000000000000000000003460072674642500170170ustar 00000000000000make = "SONY" model = "NEX-5" clean_make = "Sony" clean_model = "NEX-5" blackpoint = 512 whitepoint = 16300 color_matrix = [6549, -1550, -436, -4880, 12435, 2753, -854, 1868, 6976] color_pattern = "RGGB" crops = [0,0,0,0] bps = 8 rawloader-0.37.1/data/cameras/sony/nex5n.toml000064400000000000000000000003510072674642500171710ustar 00000000000000make = "SONY" model = "NEX-5N" clean_make = "Sony" clean_model = "NEX-5N" blackpoint = 512 whitepoint = 16300 color_matrix = [5991, -1456, -455, -4764, 12135, 2980, -707, 1425, 6701] color_pattern = "RGGB" crops = [0,12,0,0] bps = 8 rawloader-0.37.1/data/cameras/sony/nex5r.toml000064400000000000000000000003510072674642500171750ustar 00000000000000make = "SONY" model = "NEX-5R" clean_make = "Sony" clean_model = "NEX-5R" blackpoint = 512 whitepoint = 16300 color_matrix = [6129, -1545, -418, -4930, 12490, 2743, -977, 1693, 6615] color_pattern = "RGGB" crops = [0,12,0,0] bps = 8 rawloader-0.37.1/data/cameras/sony/nex5t.toml000064400000000000000000000003510072674642500171770ustar 00000000000000make = "SONY" model = "NEX-5T" clean_make = "Sony" clean_model = "NEX-5T" blackpoint = 512 whitepoint = 16300 color_matrix = [6129, -1545, -418, -4930, 12490, 2743, -977, 1693, 6615] color_pattern = "RGGB" crops = [0,12,0,0] bps = 8 rawloader-0.37.1/data/cameras/sony/nex6.toml000064400000000000000000000003470072674642500170210ustar 00000000000000make = "SONY" model = "NEX-6" clean_make = "Sony" clean_model = "NEX-6" blackpoint = 512 whitepoint = 16300 color_matrix = [6129, -1545, -418, -4930, 12490, 2743, -977, 1693, 6615] color_pattern = "RGGB" crops = [0,16,0,0] bps = 8 rawloader-0.37.1/data/cameras/sony/nex7.toml000064400000000000000000000003470072674642500170220ustar 00000000000000make = "SONY" model = "NEX-7" clean_make = "Sony" clean_model = "NEX-7" blackpoint = 512 whitepoint = 16300 color_matrix = [5491, -1192, -363, -4951, 12342, 2948, -911, 1722, 7192] color_pattern = "RGGB" crops = [0,26,0,0] bps = 8 rawloader-0.37.1/data/cameras/sony/nexc3.toml000064400000000000000000000003500072674642500171530ustar 00000000000000make = "SONY" model = "NEX-C3" clean_make = "Sony" clean_model = "NEX-C3" blackpoint = 512 whitepoint = 16300 color_matrix = [5991, -1456, -455, -4764, 12135, 2980, -707, 1425, 6701] color_pattern = "RGGB" crops = [0,0,0,0] bps = 8 rawloader-0.37.1/data/cameras/sony/nexf3.toml000064400000000000000000000003500072674642500171560ustar 00000000000000make = "SONY" model = "NEX-F3" clean_make = "Sony" clean_model = "NEX-F3" blackpoint = 512 whitepoint = 16300 color_matrix = [5991, -1456, -455, -4764, 12135, 2980, -707, 1425, 6701] color_pattern = "RGGB" crops = [0,0,0,0] bps = 8 rawloader-0.37.1/data/cameras/sony/r1.toml000064400000000000000000000003520072674642500164570ustar 00000000000000make = "SONY" model = "DSC-R1" clean_make = "Sony" clean_model = "DSC-R1" blackpoint = 511 whitepoint = 16383 color_matrix = [8512, -2641, -694, -8042, 15670, 2526, -1821, 2117, 7414] color_pattern = "GRBG" crops = [0,60,0,0] bps = 8 rawloader-0.37.1/data/cameras/sony/rx0.toml000064400000000000000000000003520072674642500166460ustar 00000000000000make = "SONY" model = "DSC-RX0" clean_make = "Sony" clean_model = "DSC-RX0" blackpoint = 800 whitepoint = 16300 color_matrix = [9396, -3507, -843, -2497, 11111, 1572, -343, 1355, 5089] color_pattern = "RGGB" crops = [0,0,0,0] bps = 8 rawloader-0.37.1/data/cameras/sony/rx1.toml000064400000000000000000000003530072674642500166500ustar 00000000000000make = "SONY" model = "DSC-RX1" clean_make = "Sony" clean_model = "DSC-RX1" blackpoint = 512 whitepoint = 16300 color_matrix = [6344, -1612, -462, -4863, 12477, 2681, -865, 1786, 6899] color_pattern = "RGGB" crops = [0,18,0,0] bps = 8 rawloader-0.37.1/data/cameras/sony/rx10.toml000064400000000000000000000003550072674642500167320ustar 00000000000000make = "SONY" model = "DSC-RX10" clean_make = "Sony" clean_model = "DSC-RX10" blackpoint = 800 whitepoint = 16300 color_matrix = [6679, -1825, -745, -5047, 13256, 1953, -1580, 2422, 5183] color_pattern = "RGGB" crops = [0,8,0,0] bps = 8 rawloader-0.37.1/data/cameras/sony/rx100.toml000064400000000000000000000003600072674642500170060ustar 00000000000000make = "SONY" model = "DSC-RX100" clean_make = "Sony" clean_model = "DSC-RX100" blackpoint = 800 whitepoint = 16300 color_matrix = [8651, -2754, -1057, -3464, 12207, 1373, -568, 1398, 4434] color_pattern = "RGGB" crops = [0,12,0,0] bps = 8 rawloader-0.37.1/data/cameras/sony/rx100m2.toml000064400000000000000000000003630072674642500172500ustar 00000000000000make = "SONY" model = "DSC-RX100M2" clean_make = "Sony" clean_model = "DSC-RX100M2" blackpoint = 800 whitepoint = 16300 color_matrix = [6596, -2079, -562, -4782, 13016, 1933, -970, 1581, 5181] color_pattern = "RGGB" crops = [0,12,0,0] bps = 8 rawloader-0.37.1/data/cameras/sony/rx100m3.toml000064400000000000000000000003630072674642500172510ustar 00000000000000make = "SONY" model = "DSC-RX100M3" clean_make = "Sony" clean_model = "DSC-RX100M3" blackpoint = 800 whitepoint = 16300 color_matrix = [6596, -2079, -562, -4782, 13016, 1933, -970, 1581, 5181] color_pattern = "RGGB" crops = [0,12,0,0] bps = 8 rawloader-0.37.1/data/cameras/sony/rx100m4.toml000064400000000000000000000003620072674642500172510ustar 00000000000000make = "SONY" model = "DSC-RX100M4" clean_make = "Sony" clean_model = "DSC-RX100M4" blackpoint = 800 whitepoint = 16300 color_matrix = [6596, -2079, -562, -4782, 13016, 1933, -970, 1581, 5181] color_pattern = "RGGB" crops = [0,0,0,0] bps = 8 rawloader-0.37.1/data/cameras/sony/rx100m5.toml000064400000000000000000000003620072674642500172520ustar 00000000000000make = "SONY" model = "DSC-RX100M5" clean_make = "SONY" clean_model = "DSC-RX100M5" blackpoint = 800 whitepoint = 16300 color_matrix = [6596, -2079, -562, -4782, 13016, 1933, -970, 1581, 5181] color_pattern = "RGGB" crops = [0,0,0,0] bps = 8 rawloader-0.37.1/data/cameras/sony/rx10m2.toml000064400000000000000000000003610072674642500171660ustar 00000000000000make = "SONY" model = "DSC-RX10M2" clean_make = "Sony" clean_model = "DSC-RX10M2" blackpoint = 800 whitepoint = 16300 color_matrix = [6679, -1825, -745, -5047, 13256, 1953, -1580, 2422, 5183] color_pattern = "RGGB" crops = [0,8,0,0] bps = 8 rawloader-0.37.1/data/cameras/sony/rx10m3.toml000064400000000000000000000003610072674642500171670ustar 00000000000000make = "SONY" model = "DSC-RX10M3" clean_make = "SONY" clean_model = "DSC-RX10M3" blackpoint = 800 whitepoint = 16300 color_matrix = [6679, -1825, -745, -5047, 13256, 1953, -1580, 2422, 5183] color_pattern = "RGGB" crops = [0,0,0,0] bps = 8 rawloader-0.37.1/data/cameras/sony/rx10m4.toml000064400000000000000000000003600072674642500171670ustar 00000000000000make = "SONY" model = "DSC-RX10M4" clean_make = "Sony" clean_model = "DSC-RX10M4" blackpoint = 800 whitepoint = 16380 color_matrix = [7699, -2566, -629, -2967, 11270, 1928, -378, 1286, 4807] color_pattern = "RGGB" crops = [0,0,0,0] bps = 8 rawloader-0.37.1/data/cameras/sony/rx1r.toml000064400000000000000000000003550072674642500170340ustar 00000000000000make = "SONY" model = "DSC-RX1R" clean_make = "Sony" clean_model = "DSC-RX1R" blackpoint = 512 whitepoint = 16300 color_matrix = [6344, -1612, -462, -4863, 12477, 2681, -865, 1786, 6899] color_pattern = "RGGB" crops = [0,16,0,0] bps = 8 rawloader-0.37.1/src/bin/benchmark.rs000064400000000000000000000022260072674642500155650ustar 00000000000000use std::env; use std::fs::File; use std::time::Instant; fn usage() { println!("benchmark "); std::process::exit(1); } static ITERATIONS: u64 = 50; fn error(err: &str) { println!("ERROR: {}", err); std::process::exit(2); } fn main() { let args: Vec<_> = env::args().collect(); if args.len() != 2 { usage(); } let file = &args[1]; println!("Loading file \"{}\"", file); let mut f = match File::open(file) { Ok(val) => val, Err(e) => {error(&e.to_string());return}, }; let buffer = match rawloader::Buffer::new(&mut f) { Ok(val) => val, Err(e) => {error(&e); return}, }; let rawloader = rawloader::RawLoader::new(); let from_time = Instant::now(); { for _ in 0..ITERATIONS { let decoder = match rawloader.get_decoder(&buffer) { Ok(val) => val, Err(e) => {error(&e); return}, }; match decoder.image(false) { Ok(_) => {}, Err(e) => error(&e), } } } let duration = from_time.elapsed(); let avgtime = ((duration.as_nanos() as u64)/ITERATIONS/1000) as f64 / 1000.0; println!("Average decode time: {} ms ({} iterations)", avgtime, ITERATIONS); } rawloader-0.37.1/src/bin/identify.rs000064400000000000000000000004660072674642500154520ustar 00000000000000use std::env; fn main() { let args: Vec<_> = env::args().collect(); if args.len() != 2 { println!("Usage: {} ", args[0]); std::process::exit(2); } let file = &args[1]; match rawloader::decode_file(file) { Ok(_) => println!("OK file"), Err(_) => println!("FAILED file"), } } rawloader-0.37.1/src/decoders/ari.rs000064400000000000000000000022720072674642500154270ustar 00000000000000use std::f32::NAN; use crate::decoders::*; use crate::decoders::basics::*; pub fn is_ari(buf: &[u8]) -> bool { buf[0..4] == b"ARRI"[..] } #[derive(Debug, Clone)] pub struct AriDecoder<'a> { buffer: &'a [u8], rawloader: &'a RawLoader, } impl<'a> AriDecoder<'a> { pub fn new(buf: &'a [u8], rawloader: &'a RawLoader) -> AriDecoder<'a> { AriDecoder { buffer: buf, rawloader: rawloader, } } } impl<'a> Decoder for AriDecoder<'a> { fn image(&self, dummy: bool) -> Result { let offset = LEu32(self.buffer, 8) as usize; let width = LEu32(self.buffer, 20) as usize; let height = LEu32(self.buffer, 24) as usize; let model = String::from_utf8_lossy(&self.buffer[668..]).split_terminator("\0").next().unwrap_or("").to_string(); let camera = self.rawloader.check_supported_with_everything("ARRI", &model, "")?; let src = &self.buffer[offset..]; let image = decode_12be_msb32(src, width, height, dummy); ok_image(camera, width, height, self.get_wb()?, image) } } impl<'a> AriDecoder<'a> { fn get_wb(&self) -> Result<[f32;4], String> { Ok([LEf32(self.buffer, 100), LEf32(self.buffer, 104), LEf32(self.buffer, 108), NAN]) } } rawloader-0.37.1/src/decoders/arw.rs000064400000000000000000000246100072674642500154450ustar 00000000000000use std::f32::NAN; use std::cmp; use crate::decoders::*; use crate::decoders::tiff::*; use crate::decoders::basics::*; #[derive(Debug, Clone)] pub struct ArwDecoder<'a> { buffer: &'a [u8], rawloader: &'a RawLoader, tiff: TiffIFD<'a>, } impl<'a> ArwDecoder<'a> { pub fn new(buf: &'a [u8], tiff: TiffIFD<'a>, rawloader: &'a RawLoader) -> ArwDecoder<'a> { ArwDecoder { buffer: buf, tiff: tiff, rawloader: rawloader, } } } impl<'a> Decoder for ArwDecoder<'a> { fn image(&self, dummy: bool) -> Result { let camera = self.rawloader.check_supported(&self.tiff)?; let data = self.tiff.find_ifds_with_tag(Tag::StripOffsets); if data.len() == 0 { if camera.model == "DSLR-A100" { return self.image_a100(camera, dummy) } else { // try decoding as SRF return self.image_srf(camera, dummy) } } let raw = data[0]; let width = fetch_tag!(raw, Tag::ImageWidth).get_usize(0); let mut height = fetch_tag!(raw, Tag::ImageLength).get_usize(0); let offset = fetch_tag!(raw, Tag::StripOffsets).get_usize(0); let count = fetch_tag!(raw, Tag::StripByteCounts).get_usize(0); let compression = fetch_tag!(raw, Tag::Compression).get_u32(0); let bps = if camera.bps != 0 { camera.bps } else { fetch_tag!(raw, Tag::BitsPerSample).get_usize(0) }; let mut white = camera.whitelevels[0]; let mut black = camera.blacklevels[0]; let src = &self.buffer[offset..]; let image = match compression { 1 => { if camera.model == "DSC-R1" { decode_14be_unpacked(src, width, height, dummy) } else { decode_16le(src, width, height, dummy) } } 32767 => { if (width*height*bps) != count*8 { height += 8; ArwDecoder::decode_arw1(src, width, height, dummy) } else { match bps { 8 => { let curve = ArwDecoder::get_curve(raw)?; ArwDecoder::decode_arw2(src, width, height, &curve, dummy) }, 12 => { /* Some cameras like the A700 have an uncompressed mode where the output is 12bit and does not require any curve. For these all we need to do is set 12bit black and white points instead of the 14bit ones of the normal compressed 8bit -> 10bit -> 14bit mode. We set these 12bit points by shifting down the 14bit points. It might make sense to have a separate camera mode instead but since the values seem good we don't bother. */ white >>= 2; black >>= 2; decode_12le(src, width, height, dummy) }, _ => return Err(format!("ARW2: Don't know how to decode images with {} bps", bps)), } } }, _ => return Err(format!("ARW: Don't know how to decode type {}", compression).to_string()), }; ok_image_with_black_white(camera, width, height, self.get_wb()?, black, white, image) } } impl<'a> ArwDecoder<'a> { fn image_a100(&self, camera: Camera, dummy: bool) -> Result { // We've caught the elusive A100 in the wild, a transitional format // between the simple sanity of the MRW custom format and the wordly // wonderfullness of the Tiff-based ARW format, let's shoot from the hip let data = self.tiff.find_ifds_with_tag(Tag::SubIFDs); if data.len() == 0 { return Err("ARW: Couldn't find the data IFD!".to_string()) } let raw = data[0]; let width = 3881; let height = 2608; let offset = fetch_tag!(raw, Tag::SubIFDs).get_usize(0); let src = &self.buffer[offset..]; let image = ArwDecoder::decode_arw1(src, width, height, dummy); // Get the WB the MRW way let priv_offset = fetch_tag!(self.tiff, Tag::DNGPrivateArea).get_force_u32(0) as usize; let buf = &self.buffer[priv_offset..]; let mut currpos: usize = 8; let mut wb_coeffs: [f32;4] = [0.0, 0.0, 0.0, NAN]; // At most we read 20 bytes from currpos so check we don't step outside that while currpos+20 < buf.len() { let tag: u32 = BEu32(buf,currpos); let len: usize = LEu32(buf,currpos+4) as usize; if tag == 0x574247 { // WBG wb_coeffs[0] = LEu16(buf, currpos+12) as f32; wb_coeffs[1] = LEu16(buf, currpos+14) as f32; wb_coeffs[2] = LEu16(buf, currpos+18) as f32; break; } currpos += len+8; } ok_image(camera, width, height, wb_coeffs, image) } fn image_srf(&self, camera: Camera, dummy: bool) -> Result { let data = self.tiff.find_ifds_with_tag(Tag::ImageWidth); if data.len() == 0 { return Err("ARW: Couldn't find the data IFD!".to_string()) } let raw = data[0]; let width = fetch_tag!(raw, Tag::ImageWidth).get_usize(0); let height = fetch_tag!(raw, Tag::ImageLength).get_usize(0); let image = if dummy { vec![0] } else { let len = width*height*2; // Constants taken from dcraw let off: usize = 862144; let key_off: usize = 200896; let head_off: usize = 164600; // Replicate the dcraw contortions to get the "decryption" key let offset = (self.buffer[key_off] as usize)*4; let first_key = BEu32(self.buffer, key_off+offset); let head = ArwDecoder::sony_decrypt(self.buffer, head_off, 40, first_key); let second_key = LEu32(&head, 22); // "Decrypt" the whole image buffer let image_data = ArwDecoder::sony_decrypt(self.buffer, off, len, second_key); decode_16be(&image_data, width, height, dummy) }; ok_image(camera, width, height, [NAN,NAN,NAN,NAN], image) } pub(crate) fn decode_arw1(buf: &[u8], width: usize, height: usize, dummy: bool) -> Vec { let mut out: Vec = alloc_image!(width, height, dummy); let mut pump = BitPumpMSB::new(buf); let mut sum: i32 = 0; for x in 0..width { let col = width-1-x; let mut row = 0; while row <= height { if row == height { row = 1; } let mut len: u32 = 4 - pump.get_bits(2); if len == 3 && pump.get_bits(1) != 0 { len = 0; } else if len == 4 { let zeros = pump.peek_bits(13).leading_zeros() - 19; len += zeros; pump.get_bits(cmp::min(13, zeros+1)); } let diff: i32 = pump.get_ibits(len); sum += diff; if len > 0 && (diff & (1 << (len - 1))) == 0 { sum -= (1 << len) - 1; } out[row*width+col] = sum as u16; row += 2 } } out } pub(crate) fn decode_arw2(buf: &[u8], width: usize, height: usize, curve: &LookupTable, dummy: bool) -> Vec { decode_threaded(width, height, dummy, &(|out: &mut [u16], row| { let mut pump = BitPumpLSB::new(&buf[(row*width)..]); let mut random = pump.peek_bits(16); for out in out.chunks_exact_mut(32) { // Process 32 pixels at a time in interleaved fashion for j in 0..2 { let max = pump.get_bits(11); let min = pump.get_bits(11); let delta = max-min; // Calculate the size of the data shift needed by how large the delta is // A delta with 11 bits requires a shift of 4, 10 bits of 3, etc let delta_shift: u32 = cmp::max(0, (32-(delta.leading_zeros() as i32)) - 7) as u32; let imax = pump.get_bits(4) as usize; let imin = pump.get_bits(4) as usize; for i in 0..16 { let val = if i == imax { max } else if i == imin { min } else { cmp::min(0x7ff,(pump.get_bits(7) << delta_shift) + min) }; out[j+(i*2)] = curve.dither((val<<1) as u16, &mut random); } } } })) } fn get_wb(&self) -> Result<[f32;4], String> { let priv_offset = fetch_tag!(self.tiff, Tag::DNGPrivateArea).get_force_u32(0) as usize; let priv_tiff = TiffIFD::new(self.buffer, priv_offset, 0, 0, 0, LITTLE_ENDIAN)?; let sony_offset = fetch_tag!(priv_tiff, Tag::SonyOffset).get_usize(0); let sony_length = fetch_tag!(priv_tiff, Tag::SonyLength).get_usize(0); let sony_key = fetch_tag!(priv_tiff, Tag::SonyKey).get_u32(0); let decrypted_buf = ArwDecoder::sony_decrypt(self.buffer, sony_offset, sony_length, sony_key); let decrypted_tiff = TiffIFD::new(&decrypted_buf, 0, sony_offset, 0, 0, LITTLE_ENDIAN).unwrap(); let grgb_levels = decrypted_tiff.find_entry(Tag::SonyGRBG); let rggb_levels = decrypted_tiff.find_entry(Tag::SonyRGGB); if grgb_levels.is_some() { let levels = grgb_levels.unwrap(); Ok([levels.get_u32(1) as f32, levels.get_u32(0) as f32, levels.get_u32(2) as f32, NAN]) } else if rggb_levels.is_some() { let levels = rggb_levels.unwrap(); Ok([levels.get_u32(0) as f32, levels.get_u32(1) as f32, levels.get_u32(3) as f32, NAN]) } else { Err("ARW: Couldn't find GRGB or RGGB levels".to_string()) } } fn get_curve(raw: &TiffIFD) -> Result { let centry = fetch_tag!(raw, Tag::SonyCurve); let mut curve: [usize;6] = [ 0, 0, 0, 0, 0, 4095 ]; for i in 0..4 { curve[i+1] = ((centry.get_u32(i) >> 2) & 0xfff) as usize; } Ok(Self::calculate_curve(curve)) } pub(crate) fn calculate_curve(curve: [usize;6]) -> LookupTable { let mut out = vec![0 as u16; curve[5]+1]; for i in 0..5 { for j in (curve[i]+1)..(curve[i+1]+1) { out[j] = out[(j-1)] + (1< Vec{ let mut pad: [u32; 128] = [0 as u32; 128]; let mut mkey = key; // Initialize the decryption pad from the key for p in 0..4 { mkey = mkey.wrapping_mul(48828125).wrapping_add(1); pad[p] = mkey; } pad[3] = pad[3] << 1 | (pad[0]^pad[2]) >> 31; for p in 4..127 { pad[p] = (pad[p-4]^pad[p-2]) << 1 | (pad[p-3]^pad[p-1]) >> 31; } for p in 0..127 { pad[p] = u32::from_be(pad[p]); } let mut out = Vec::with_capacity(length+4); for i in 0..(length/4+1) { let p = i + 127; pad[p & 127] = pad[(p+1) & 127] ^ pad[(p+1+64) & 127]; let output = LEu32(buf, offset+i*4) ^ pad[p & 127]; out.push(((output >> 0) & 0xff) as u8); out.push(((output >> 8) & 0xff) as u8); out.push(((output >> 16) & 0xff) as u8); out.push(((output >> 24) & 0xff) as u8); } out } } rawloader-0.37.1/src/decoders/basics.rs000064400000000000000000000106570072674642500161260ustar 00000000000000use byteorder::{BigEndian, LittleEndian, ByteOrder}; use rayon::prelude::*; pub use crate::decoders::packed::*; pub use crate::decoders::pumps::*; #[inline(always)] pub fn clampbits(val: i32, bits: u32) -> u16 { let max = (1 << bits) - 1; if val < 0 { 0 } else if val > max { max as u16 } else { val as u16 } } #[derive(Debug, Copy, Clone)] pub struct Endian { big: bool, } impl Endian { pub fn ri32(&self, buf: &[u8], pos: usize) -> i32 { if self.big { BEi32(buf,pos) } else { LEi32(buf,pos) } } pub fn ru32(&self, buf: &[u8], pos: usize) -> u32 { if self.big { BEu32(buf,pos) } else { LEu32(buf,pos) } } pub fn ru16(&self, buf: &[u8], pos: usize) -> u16 { if self.big { BEu16(buf,pos) } else { LEu16(buf,pos) } } pub fn little(&self) -> bool { !self.big } } pub static BIG_ENDIAN: Endian = Endian{big: true}; pub static LITTLE_ENDIAN: Endian = Endian{big: false}; #[allow(non_snake_case)] #[inline] pub fn BEi32(buf: &[u8], pos: usize) -> i32 { BigEndian::read_i32(&buf[pos..pos+4]) } #[allow(non_snake_case)] #[inline] pub fn LEi32(buf: &[u8], pos: usize) -> i32 { LittleEndian::read_i32(&buf[pos..pos+4]) } #[allow(non_snake_case)] #[inline] pub fn BEu32(buf: &[u8], pos: usize) -> u32 { BigEndian::read_u32(&buf[pos..pos+4]) } #[allow(non_snake_case)] #[inline] pub fn LEu32(buf: &[u8], pos: usize) -> u32 { LittleEndian::read_u32(&buf[pos..pos+4]) } #[allow(non_snake_case)] #[inline] pub fn LEf32(buf: &[u8], pos: usize) -> f32 { LittleEndian::read_f32(&buf[pos..pos+4]) } #[allow(non_snake_case)] #[inline] pub fn BEu16(buf: &[u8], pos: usize) -> u16 { BigEndian::read_u16(&buf[pos..pos+2]) } #[allow(non_snake_case)] #[inline] pub fn LEu16(buf: &[u8], pos: usize) -> u16 { LittleEndian::read_u16(&buf[pos..pos+2]) } pub fn decode_threaded(width: usize, height: usize, dummy: bool, closure: &F) -> Vec where F : Fn(&mut [u16], usize)+Sync { let mut out: Vec = alloc_image!(width, height, dummy); out.par_chunks_mut(width).enumerate().for_each(|(row, line)| { closure(line, row); }); out } pub fn decode_threaded_multiline(width: usize, height: usize, lines: usize, dummy: bool, closure: &F) -> Vec where F : Fn(&mut [u16], usize)+Sync { let mut out: Vec = alloc_image!(width, height, dummy); out.par_chunks_mut(width*lines).enumerate().for_each(|(row, line)| { closure(line, row*lines); }); out } #[derive(Debug, Clone)] pub struct LookupTable { table: Vec<(u16, u16, u16)>, } impl LookupTable { pub fn new(table: &[u16]) -> LookupTable { let mut tbl = vec![(0,0,0); table.len()]; for i in 0..table.len() { let center = table[i]; let lower = if i > 0 {table[i-1]} else {center}; let upper = if i < (table.len()-1) {table[i+1]} else {center}; let base = if center == 0 {0} else {center - ((upper - lower + 2) / 4)}; let delta = upper - lower; tbl[i] = (center, base, delta); } LookupTable { table: tbl, } } // pub fn lookup(&self, value: u16) -> u16 { // let (val, _, _) = self.table[value as usize]; // val // } #[inline(always)] pub fn dither(&self, value: u16, rand: &mut u32) -> u16 { let (_, sbase, sdelta) = self.table[value as usize]; let base = sbase as u32; let delta = sdelta as u32; let pixel = base + ((delta * (*rand & 2047) + 1024) >> 12); *rand = 15700 * (*rand & 65535) + (*rand >> 16); pixel as u16 } } // For rust <= 1.31 we just alias chunks_exact() and chunks_exact_mut() to the non-exact versions // so we can use exact everywhere without spreading special cases across the code #[cfg(needs_chunks_exact)] mod chunks_exact { use std::slice; // Add a chunks_exact for &[u8] and Vec pub trait ChunksExact { fn chunks_exact(&self, n: usize) -> slice::Chunks; } impl<'a, T> ChunksExact for &'a [T] { fn chunks_exact(&self, n: usize) -> slice::Chunks { self.chunks(n) } } impl ChunksExact for Vec { fn chunks_exact(&self, n: usize) -> slice::Chunks { self.chunks(n) } } // Add a chunks_exact_mut for &mut[u16] mostly pub trait ChunksExactMut<'a, T> { fn chunks_exact_mut(self, n: usize) -> slice::ChunksMut<'a, T>; } impl<'a, T> ChunksExactMut<'a, T> for &'a mut [T] { fn chunks_exact_mut(self, n: usize) -> slice::ChunksMut<'a, T> { self.chunks_mut(n) } } } #[cfg(needs_chunks_exact)] pub use self::chunks_exact::*; rawloader-0.37.1/src/decoders/cfa.rs000064400000000000000000000123440072674642500154060ustar 00000000000000use std::fmt; use crate::decoders::tiff::*; /// Representation of the color filter array pattern in raw cameras /// /// # Example /// ``` /// use rawloader::CFA; /// let cfa = CFA::new("RGGB"); /// assert_eq!(cfa.color_at(0,0), 0); /// assert_eq!(cfa.color_at(0,1), 1); /// assert_eq!(cfa.color_at(1,0), 1); /// assert_eq!(cfa.color_at(1,1), 2); /// ``` /// /// You will almost always get your CFA struct from a RawImage decode, already fully /// initialized and ready to be used in processing. The color_at() implementation is /// designed to be fast so it can be called inside the inner loop of demosaic or other /// color-aware algorithms that work on pre-demosaic data #[derive(Clone)] pub struct CFA { /// CFA pattern as a String pub name: String, /// Width of the repeating pattern pub width: usize, /// Height of the repeating pattern pub height: usize, pattern: [[usize;48];48], } impl CFA { #[doc(hidden)] pub fn new_from_tag(pat: &TiffEntry) -> CFA { let mut patname = String::new(); for i in 0..pat.count() { patname.push(match pat.get_u32(i as usize) { 0 => 'R', 1 => 'G', 2 => 'B', _ => 'U', }); } CFA::new(&patname) } /// Create a new CFA from a string describing it. For simplicity the pattern is specified /// as each pixel being one of R/G/B/E representing the 0/1/2/3 colors in a 4 color image. /// The pattern is specified as the colors in each row concatenated so RGGB means that /// the first row is RG and the second row GB. Row size is determined by pattern size /// (e.g., the xtrans pattern is 6x6 and thus 36 characters long). In theory this could /// lead to confusion between different pattern sizes but in practice there are only /// a few oddball cameras no one cares about that do anything but 2x2 and 6x6 (and those /// work fine with this as well). pub fn new(patname: &str) -> CFA { let (width, height) = match patname.len() { 0 => (0,0), 4 => (2,2), 36 => (6,6), 16 => (2,8), 144 => (12,12), _ => panic!("Unknown CFA size \"{}\"", patname), }; let mut pattern: [[usize;48];48] = [[0;48];48]; if width > 0 { // copy the pattern into the top left for (i,c) in patname.bytes().enumerate() { pattern[i/width][i%width] = match c { b'R' => 0, b'G' => 1, b'B' => 2, b'E' => 3, b'M' => 1, b'Y' => 3, _ => { let unknown_char = patname[i..].chars().next().unwrap(); panic!("Unknown CFA color \"{}\" in pattern \"{}\"", unknown_char, patname) }, }; } // extend the pattern into the full matrix for row in 0..48 { for col in 0..48 { pattern[row][col] = pattern[row%height][col%width]; } } } CFA { name: patname.to_string(), pattern: pattern, width: width, height: height, } } /// Get the color index at the given position. Designed to be fast so it can be called /// from inner loops without performance issues. pub fn color_at(&self, row: usize, col: usize) -> usize { self.pattern[(row+48) % 48][(col+48) % 48] } /// Shift the pattern left and/or down. This is useful when cropping the image to get /// the equivalent pattern of the crop when it's not a multiple of the pattern size. /// /// # Example /// ``` /// use rawloader::CFA; /// let cfa = CFA::new("RGGB"); /// assert_eq!(cfa.color_at(0,0), 0); /// assert_eq!(cfa.color_at(0,1), 1); /// assert_eq!(cfa.color_at(1,0), 1); /// assert_eq!(cfa.color_at(1,1), 2); /// /// let shifted = cfa.shift(1,1); /// assert_eq!(shifted.color_at(0,0), 2); /// assert_eq!(shifted.color_at(0,1), 1); /// assert_eq!(shifted.color_at(1,0), 1); /// assert_eq!(shifted.color_at(1,1), 0); /// ``` pub fn shift(&self, x: usize, y: usize) -> CFA { let mut pattern: [[usize;48];48] = [[0;48];48]; for row in 0..48 { for col in 0..48 { pattern[row][col] = self.color_at(row+y,col+x); } } let mut name = "".to_string(); for row in 0..self.height { for col in 0..self.width { name.push_str(match pattern[row][col] { 0 => "R", 1 => "G", 2 => "B", 3 => "E", x => panic!("Unknown CFA color \"{}\"", x), }); } } CFA { name: name, pattern: pattern, width: self.width, height: self.height, } } /// Test if this is actually a valid CFA pattern /// /// # Example /// ``` /// use rawloader::CFA; /// let cfa = CFA::new("RGGB"); /// assert!(cfa.is_valid()); /// /// let cfa = CFA::new(""); /// assert!(!cfa.is_valid()); /// ``` pub fn is_valid(&self) -> bool { self.width != 0 && self.height != 0 } /// Convert the CFA back into a pattern string /// /// # Example /// ``` /// use rawloader::CFA; /// let cfa = CFA::new("RGGB"); /// assert_eq!(cfa.to_string(), "RGGB"); /// /// let shifted = cfa.shift(1,1); /// assert_eq!(shifted.to_string(), "BGGR"); /// ``` pub fn to_string(&self) -> String { self.name.clone() } } impl fmt::Debug for CFA { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "CFA {{ {} }}", self.name) } } rawloader-0.37.1/src/decoders/ciff.rs000064400000000000000000000103130072674642500155560ustar 00000000000000use std::collections::HashMap; use crate::decoders::basics::*; use crate::decoders::Buffer; #[derive(Debug, Copy, Clone, PartialEq)] pub enum CiffTag { //Null = 0x0000, ColorInfo1 = 0x0032, MakeModel = 0x080a, //ShotInfo = 0x102a, ColorInfo2 = 0x102c, WhiteBalance = 0x10a9, SensorInfo = 0x1031, //ImageInfo = 0x1810, DecoderTable = 0x1835, //RawData = 0x2005, //SubIFD = 0x300a, //Exif = 0x300b, } fn ct (tag: CiffTag) -> u16 { tag as u16 } #[derive(Debug, Copy, Clone)] pub struct CiffEntry<'a> { pub tag: u16, pub typ: u16, pub count: usize, pub bytesize: usize, pub data_offset: usize, pub data: &'a [u8], } #[derive(Debug, Clone)] pub struct CiffIFD<'a> { entries: HashMap>, subifds: Vec>, } pub fn is_ciff(buf: &[u8]) -> bool { buf[6..14] == b"HEAPCCDR"[..] } impl<'a> CiffIFD<'a> { pub fn new_file(buf: &'a Buffer) -> Result,String> { let data = &buf.buf; CiffIFD::new(data, LEu32(data,2) as usize, buf.size, 1) } pub fn new(buf: &'a[u8], start: usize, end: usize, depth: u32) -> Result, String> { let mut entries = HashMap::new(); let mut subifds = Vec::new(); let valuedata_size = LEu32(buf, end-4) as usize; let dircount = LEu16(buf, start+valuedata_size) as usize; for i in 0..dircount { let entry_offset: usize = start+valuedata_size+2+i*10; let e = CiffEntry::new(buf, start, entry_offset)?; if e.typ == 0x2800 || e.typ == 0x3000 { // SubIFDs if depth < 10 { // Avoid infinite looping IFDs let ifd = CiffIFD::new(buf, e.data_offset, e.data_offset+e.bytesize, depth+1); match ifd { Ok(val) => {subifds.push(val);}, Err(_) => {entries.insert(e.tag, e);}, // Ignore unparsable IFDs } } } else { entries.insert(e.tag, e); } } Ok(CiffIFD { entries: entries, subifds: subifds, }) } pub fn find_entry(&self, tag: CiffTag) -> Option<&CiffEntry> { if self.entries.contains_key(&ct(tag)) { self.entries.get(&ct(tag)) } else { for ifd in &self.subifds { match ifd.find_entry(tag) { Some(x) => return Some(x), None => {}, } } None } } } impl<'a> CiffEntry<'a> { pub fn new(buf: &'a[u8], value_data: usize, offset: usize) -> Result, String> { let p = LEu16(buf, offset); let tag = p & 0x3fff; let datalocation = (p & 0xc000) as usize; let typ = p & 0x3800; let (bytesize, data_offset) = match datalocation { // Data is offset in value_data 0x0000 => (LEu32(buf, offset+2) as usize, LEu32(buf, offset+6) as usize + value_data), // Data is stored directly in entry 0x4000 => (8, offset+2), val => return Err(format!("CIFF: Don't know about data location {:x}", val).to_string()), }; let data = &buf[data_offset..data_offset+bytesize]; let count = bytesize >> CiffEntry::element_shift(typ); Ok(CiffEntry { tag: tag, typ: typ, count: count, bytesize: bytesize, data_offset: data_offset, data: data, }) } pub fn element_shift(typ: u16) -> usize { match typ { // Byte and ASCII 0x0000 | 0x8000 => 0, // Short 0x1000 => 1, // Long, Mix, Sub1 and Sub2 0x1800 | 0x2000 | 0x2800 | 0x3000 => 2, // Default to 0 _ => 0, } } pub fn get_strings(&self) -> Vec { String::from_utf8_lossy(self.data).split_terminator("\0").map(|x| x.to_string()).collect() } pub fn get_u32(&self, idx: usize) -> u32 { match self.typ { 0x0000 | 0x8000 => self.data[idx] as u32, 0x1000 => LEu16(self.data, idx*2) as u32, 0x1800 | 0x2000 | 0x2800 | 0x3000 => LEu32(self.data, idx*4), _ => panic!("Trying to read typ {} for a u32", self.typ), } } pub fn get_usize(&self, idx: usize) -> usize { self.get_u32(idx) as usize } pub fn get_f32(&self, idx: usize) -> f32 { self.get_u32(idx) as f32 } pub fn get_force_u16(&self, idx: usize) -> u16 { LEu16(self.data, idx*2) } } rawloader-0.37.1/src/decoders/cr2.rs000064400000000000000000000160720072674642500153450ustar 00000000000000use std::f32::NAN; use crate::decoders::*; use crate::decoders::tiff::*; use crate::decoders::basics::*; use crate::decoders::ljpeg::*; #[derive(Debug, Clone)] pub struct Cr2Decoder<'a> { buffer: &'a [u8], rawloader: &'a RawLoader, tiff: TiffIFD<'a>, } impl<'a> Cr2Decoder<'a> { pub fn new(buf: &'a [u8], tiff: TiffIFD<'a>, rawloader: &'a RawLoader) -> Cr2Decoder<'a> { Cr2Decoder { buffer: buf, tiff: tiff, rawloader: rawloader, } } } impl<'a> Decoder for Cr2Decoder<'a> { fn image(&self, dummy: bool) -> Result { let camera = self.rawloader.check_supported(&self.tiff)?; let (raw, offset) = { if let Some(raw) = self.tiff.find_first_ifd(Tag::Cr2Id) { (raw, fetch_tag!(raw, Tag::StripOffsets).get_usize(0)) } else if let Some(raw) = self.tiff.find_first_ifd(Tag::CFAPattern) { (raw, fetch_tag!(raw, Tag::StripOffsets).get_usize(0)) } else if let Some(off) = self.tiff.find_entry(Tag::Cr2OldOffset) { (&self.tiff, off.get_usize(0)) } else { return Err("CR2: Couldn't find raw info".to_string()) } }; let src = &self.buffer[offset..]; let (width, height, cpp, image) = { let decompressor = LjpegDecompressor::new(src)?; let ljpegwidth = decompressor.width(); let mut width = ljpegwidth; let mut height = decompressor.height(); let cpp = if decompressor.super_h() == 2 {3} else {1}; let mut ljpegout = alloc_image_plain!(width, height, dummy); decompressor.decode(&mut ljpegout, 0, width, width, height, dummy)?; // Linearize the output (applies only to D2000 as far as I can tell) if camera.find_hint("linearization") { let table = { let linearization = fetch_tag!(self.tiff, Tag::GrayResponse); let mut t = [0 as u16;4096]; for i in 0..t.len() { t[i] = linearization.get_u32(i) as u16; } LookupTable::new(&t) }; let mut random = ljpegout[0] as u32; for o in ljpegout.chunks_exact_mut(1) { o[0] = table.dither(o[0], &mut random); } } // Convert the YUV in sRAWs to RGB if cpp == 3 { self.convert_to_rgb(&camera, &mut ljpegout, dummy)?; if raw.has_entry(Tag::ImageWidth) { width = fetch_tag!(raw, Tag::ImageWidth).get_usize(0) * cpp; height = fetch_tag!(raw, Tag::ImageLength).get_usize(0) ; } else if width/cpp < height { let temp = width/cpp; width = height*cpp; height = temp; } } else if camera.find_hint("double_line") { width /= 2; height *= 2; } // Take each of the vertical fields and put them into the right location // FIXME: Doing this at the decode would reduce about 5% in runtime but I haven't // been able to do it without hairy code if let Some(canoncol) = raw.find_entry(Tag::Cr2StripeWidths) { if canoncol.get_usize(0) == 0 { (width, height, cpp, ljpegout) } else { let mut out = alloc_image_plain!(width, height, dummy); if !dummy { let mut fieldwidths = Vec::new(); for _ in 0..canoncol.get_usize(0) { fieldwidths.push(canoncol.get_usize(1)); } fieldwidths.push(canoncol.get_usize(2)); if decompressor.super_v() == 2 { // We've decoded 2 lines at a time so we also need to copy two strips at a time let nfields = fieldwidths.len(); let fieldwidth = fieldwidths[0]; let mut fieldstart = 0; let mut inpos = 0; for _ in 0..nfields { for row in (0..height).step_by(2) { for col in (0..fieldwidth).step_by(3) { let outpos = row*width+fieldstart+col; out[outpos..outpos+3].copy_from_slice(&ljpegout[inpos..inpos+3]); let outpos = (row+1)*width+fieldstart+col; let inpos2 = inpos+ljpegwidth; out[outpos..outpos+3].copy_from_slice(&ljpegout[inpos2..inpos2+3]); inpos += 3; if inpos % ljpegwidth == 0 { // we've used a full input line and we're reading 2 by 2 so skip one inpos += ljpegwidth; } } } fieldstart += fieldwidth; } } else { let sh = decompressor.super_h(); let mut fieldstart = 0; let mut fieldpos = 0; for fieldwidth in fieldwidths { let fieldwidth = fieldwidth/sh*cpp; for row in 0..height { let outpos = row*width+fieldstart; let inpos = fieldpos+row*fieldwidth; let outb = &mut out[outpos..outpos+fieldwidth]; let inb = &ljpegout[inpos..inpos+fieldwidth]; outb.copy_from_slice(inb); } fieldstart += fieldwidth; fieldpos += fieldwidth*height; } } } (width, height, cpp, out) } } else { (width, height, cpp, ljpegout) } }; let wb = self.get_wb(&camera)?; let mut img = RawImage::new(camera, width, height, wb, image, dummy); if cpp == 3 { img.cpp = 3; img.width /= 3; img.crops = [0,0,0,0]; img.blacklevels = [0,0,0,0]; img.whitelevels = [65535,65535,65535,65535]; } Ok(img) } } impl<'a> Cr2Decoder<'a> { fn get_wb(&self, cam: &Camera) -> Result<[f32;4], String> { if let Some(levels) = self.tiff.find_entry(Tag::Cr2ColorData) { let offset = if cam.wb_offset != 0 {cam.wb_offset} else {63}; Ok([levels.get_force_u16(offset) as f32, levels.get_force_u16(offset+1) as f32, levels.get_force_u16(offset+3) as f32, NAN]) } else if let Some(levels) = self.tiff.find_entry(Tag::Cr2PowerShotWB) { Ok([levels.get_force_u32(3) as f32, levels.get_force_u32(2) as f32, levels.get_force_u32(4) as f32, NAN]) } else if let Some(levels) = self.tiff.find_entry(Tag::Cr2OldWB) { Ok([levels.get_f32(0), levels.get_f32(1), levels.get_f32(2), NAN]) } else { // At least the D2000 has no WB Ok([NAN,NAN,NAN,NAN]) } } fn convert_to_rgb(&self, cam: &Camera, image: &mut [u16], dummy: bool) -> Result<(),String>{ let coeffs = self.get_wb(cam)?; if dummy { return Ok(()) } let c1 = (1024.0*1024.0/coeffs[0]) as i32; let c2 = coeffs[1] as i32; let c3 = (1024.0*1024.0/coeffs[2]) as i32; let yoffset = if cam.find_hint("40d_yuv") { 512 } else { 0 }; for pix in image.chunks_exact_mut(3) { let y = pix[0] as i32 - yoffset; let cb = pix[1] as i32 - 16383; let cr = pix[2] as i32 - 16383; let r = c1 * (y + cr); let g = c2 * (y + ((-778*cb - (cr<<11)) >> 12)); let b = c3 * (y + cb); pix[0] = clampbits(r >> 8, 16); pix[1] = clampbits(g >> 8, 16); pix[2] = clampbits(b >> 8, 16); } Ok(()) } } rawloader-0.37.1/src/decoders/crw.rs000064400000000000000000000215110072674642500154440ustar 00000000000000use std::f32::NAN; use crate::decoders::*; use crate::decoders::ciff::*; use crate::decoders::basics::*; use crate::decoders::ljpeg::huffman::*; const CRW_FIRST_TREE: [[u8;29];3] = [ [ 0,1,4,2,3,1,2,0,0,0,0,0,0,0,0,0, 0x04,0x03,0x05,0x06,0x02,0x07,0x01,0x08,0x09,0x00,0x0a,0x0b,0xff ], [ 0,2,2,3,1,1,1,1,2,0,0,0,0,0,0,0, 0x03,0x02,0x04,0x01,0x05,0x00,0x06,0x07,0x09,0x08,0x0a,0x0b,0xff ], [ 0,0,6,3,1,1,2,0,0,0,0,0,0,0,0,0, 0x06,0x05,0x07,0x04,0x08,0x03,0x09,0x02,0x00,0x0a,0x01,0x0b,0xff ], ]; const CRW_SECOND_TREE: [[u8;180];3] = [ [ 0,2,2,2,1,4,2,1,2,5,1,1,0,0,0,139, 0x03,0x04,0x02,0x05,0x01,0x06,0x07,0x08, 0x12,0x13,0x11,0x14,0x09,0x15,0x22,0x00,0x21,0x16,0x0a,0xf0, 0x23,0x17,0x24,0x31,0x32,0x18,0x19,0x33,0x25,0x41,0x34,0x42, 0x35,0x51,0x36,0x37,0x38,0x29,0x79,0x26,0x1a,0x39,0x56,0x57, 0x28,0x27,0x52,0x55,0x58,0x43,0x76,0x59,0x77,0x54,0x61,0xf9, 0x71,0x78,0x75,0x96,0x97,0x49,0xb7,0x53,0xd7,0x74,0xb6,0x98, 0x47,0x48,0x95,0x69,0x99,0x91,0xfa,0xb8,0x68,0xb5,0xb9,0xd6, 0xf7,0xd8,0x67,0x46,0x45,0x94,0x89,0xf8,0x81,0xd5,0xf6,0xb4, 0x88,0xb1,0x2a,0x44,0x72,0xd9,0x87,0x66,0xd4,0xf5,0x3a,0xa7, 0x73,0xa9,0xa8,0x86,0x62,0xc7,0x65,0xc8,0xc9,0xa1,0xf4,0xd1, 0xe9,0x5a,0x92,0x85,0xa6,0xe7,0x93,0xe8,0xc1,0xc6,0x7a,0x64, 0xe1,0x4a,0x6a,0xe6,0xb3,0xf1,0xd3,0xa5,0x8a,0xb2,0x9a,0xba, 0x84,0xa4,0x63,0xe5,0xc5,0xf3,0xd2,0xc4,0x82,0xaa,0xda,0xe4, 0xf2,0xca,0x83,0xa3,0xa2,0xc3,0xea,0xc2,0xe2,0xe3,0xff,0xff ], [ 0,2,2,1,4,1,4,1,3,3,1,0,0,0,0,140, 0x02,0x03,0x01,0x04,0x05,0x12,0x11,0x06, 0x13,0x07,0x08,0x14,0x22,0x09,0x21,0x00,0x23,0x15,0x31,0x32, 0x0a,0x16,0xf0,0x24,0x33,0x41,0x42,0x19,0x17,0x25,0x18,0x51, 0x34,0x43,0x52,0x29,0x35,0x61,0x39,0x71,0x62,0x36,0x53,0x26, 0x38,0x1a,0x37,0x81,0x27,0x91,0x79,0x55,0x45,0x28,0x72,0x59, 0xa1,0xb1,0x44,0x69,0x54,0x58,0xd1,0xfa,0x57,0xe1,0xf1,0xb9, 0x49,0x47,0x63,0x6a,0xf9,0x56,0x46,0xa8,0x2a,0x4a,0x78,0x99, 0x3a,0x75,0x74,0x86,0x65,0xc1,0x76,0xb6,0x96,0xd6,0x89,0x85, 0xc9,0xf5,0x95,0xb4,0xc7,0xf7,0x8a,0x97,0xb8,0x73,0xb7,0xd8, 0xd9,0x87,0xa7,0x7a,0x48,0x82,0x84,0xea,0xf4,0xa6,0xc5,0x5a, 0x94,0xa4,0xc6,0x92,0xc3,0x68,0xb5,0xc8,0xe4,0xe5,0xe6,0xe9, 0xa2,0xa3,0xe3,0xc2,0x66,0x67,0x93,0xaa,0xd4,0xd5,0xe7,0xf8, 0x88,0x9a,0xd7,0x77,0xc4,0x64,0xe2,0x98,0xa5,0xca,0xda,0xe8, 0xf3,0xf6,0xa9,0xb2,0xb3,0xf2,0xd2,0x83,0xba,0xd3,0xff,0xff ], [ 0,0,6,2,1,3,3,2,5,1,2,2,8,10,0,117, 0x04,0x05,0x03,0x06,0x02,0x07,0x01,0x08, 0x09,0x12,0x13,0x14,0x11,0x15,0x0a,0x16,0x17,0xf0,0x00,0x22, 0x21,0x18,0x23,0x19,0x24,0x32,0x31,0x25,0x33,0x38,0x37,0x34, 0x35,0x36,0x39,0x79,0x57,0x58,0x59,0x28,0x56,0x78,0x27,0x41, 0x29,0x77,0x26,0x42,0x76,0x99,0x1a,0x55,0x98,0x97,0xf9,0x48, 0x54,0x96,0x89,0x47,0xb7,0x49,0xfa,0x75,0x68,0xb6,0x67,0x69, 0xb9,0xb8,0xd8,0x52,0xd7,0x88,0xb5,0x74,0x51,0x46,0xd9,0xf8, 0x3a,0xd6,0x87,0x45,0x7a,0x95,0xd5,0xf6,0x86,0xb4,0xa9,0x94, 0x53,0x2a,0xa8,0x43,0xf5,0xf7,0xd4,0x66,0xa7,0x5a,0x44,0x8a, 0xc9,0xe8,0xc8,0xe7,0x9a,0x6a,0x73,0x4a,0x61,0xc7,0xf4,0xc6, 0x65,0xe9,0x72,0xe6,0x71,0x91,0x93,0xa6,0xda,0x92,0x85,0x62, 0xf3,0xc5,0xb2,0xa4,0x84,0xba,0x64,0xa5,0xb3,0xd2,0x81,0xe5, 0xd3,0xaa,0xc4,0xca,0xf2,0xb1,0xe4,0xd1,0x83,0x63,0xea,0xc3, 0xe2,0x82,0xf1,0xa3,0xc2,0xa1,0xc1,0xe3,0xa2,0xe1,0xff,0xff ] ]; #[derive(Debug, Clone)] pub struct CrwDecoder<'a> { buffer: &'a [u8], rawloader: &'a RawLoader, ciff: CiffIFD<'a>, } impl<'a> CrwDecoder<'a> { pub fn new(buf: &'a [u8], ciff: CiffIFD<'a>, rawloader: &'a RawLoader) -> CrwDecoder<'a> { CrwDecoder { buffer: buf, ciff: ciff, rawloader: rawloader, } } } impl<'a> Decoder for CrwDecoder<'a> { fn image(&self, dummy: bool) -> Result { let makemodel = fetch_tag!(self.ciff, CiffTag::MakeModel).get_strings(); if makemodel.len() < 2 { return Err("CRW: MakeModel tag needs to have 2 strings".to_string()) } let camera = self.rawloader.check_supported_with_everything(&makemodel[0], &makemodel[1], "")?; let (width, height, image) = if camera.model == "Canon PowerShot Pro70" { (1552,1024,decode_10le_lsb16(&self.buffer[26..], 1552, 1024, dummy)) } else { let sensorinfo = fetch_tag!(self.ciff, CiffTag::SensorInfo); let width = sensorinfo.get_usize(1); let height = sensorinfo.get_usize(2); (width, height, self.decode_compressed(&camera, width, height, dummy)?) }; let wb = self.get_wb(&camera)?; ok_image(camera, width, height, wb, image) } } impl<'a> CrwDecoder<'a> { fn get_wb(&self, cam: &Camera) -> Result<[f32;4], String> { if let Some(levels) = self.ciff.find_entry(CiffTag::WhiteBalance) { let offset = cam.wb_offset; return Ok([levels.get_f32(offset+0), levels.get_f32(offset+1), levels.get_f32(offset+3), NAN]) } if !cam.find_hint("nocinfo2") { if let Some(cinfo) = self.ciff.find_entry(CiffTag::ColorInfo2) { return Ok(if cinfo.get_u32(0) > 512 { [cinfo.get_f32(62), cinfo.get_f32(63), cinfo.get_f32(60), cinfo.get_f32(61)] } else { [cinfo.get_f32(51), (cinfo.get_f32(50)+cinfo.get_f32(53))/2.0, cinfo.get_f32(52), NAN] }) } } if let Some(cinfo) = self.ciff.find_entry(CiffTag::ColorInfo1) { if cinfo.count == 768 { // D30 return Ok([1024.0/(cinfo.get_force_u16(36) as f32), 1024.0/(cinfo.get_force_u16(37) as f32), 1024.0/(cinfo.get_force_u16(39) as f32), NAN]) } let off = cam.wb_offset; let key: [u16;2] = if cam.find_hint("wb_mangle") {[0x410, 0x45f3]} else {[0,0]}; return Ok([(cinfo.get_force_u16(off+1)^key[1]) as f32, (cinfo.get_force_u16(off+0)^key[0]) as f32, (cinfo.get_force_u16(off+2)^key[0]) as f32, NAN]) } Ok([NAN,NAN,NAN,NAN]) } fn create_hufftables(num: usize) -> [HuffTable;2] { [ Self::create_hufftable(&CRW_FIRST_TREE[num]), Self::create_hufftable(&CRW_SECOND_TREE[num]), ] } fn create_hufftable(table: &[u8]) -> HuffTable { let mut htable = HuffTable::empty(); for i in 0..16 { htable.bits[i+1] = table[i] as u32; } for i in 16..table.len() { htable.huffval[i-16] = table[i] as u32; } htable.disable_cache = true; htable.initialize().unwrap(); htable } fn decode_compressed(&self, cam: &Camera, width: usize, height: usize, dummy: bool) -> Result,String> { let lowbits = !cam.find_hint("nolowbits"); let dectable = fetch_tag!(self.ciff, CiffTag::DecoderTable).get_usize(0); if dectable > 2 { return Err(format!("CRW: Unknown decoder table {}", dectable).to_string()) } Ok(Self::do_decode(&self.buffer, lowbits, dectable, width, height, dummy)) } pub(crate) fn do_decode(buffer: &[u8], lowbits: bool, dectable: usize, width: usize, height: usize, dummy: bool) -> Vec { let mut out = alloc_image!(width, height, dummy); let htables = Self::create_hufftables(dectable); let offset = 540 + (lowbits as usize)*height*width/4; let mut pump = BitPumpJPEG::new(&buffer[offset..]); let mut carry: i32 = 0; let mut base = [0 as i32;2]; let mut pnum = 0; for pixout in out.chunks_exact_mut(64) { // Decode a block of 64 differences let mut diffbuf = [0 as i32; 64]; let mut i: usize = 0; while i < 64 { let ref tbl = htables[(i > 0) as usize]; let leaf = tbl.huff_get_bits(&mut pump); if leaf == 0 && i != 0 { break; } if leaf == 0xff { i+= 1; continue; } i += (leaf >> 4) as usize; let len = leaf & 0x0f; if len == 0 { i+= 1; continue; } let mut diff: i32 = pump.get_bits(len) as i32; if (diff & (1 << (len-1))) == 0 { diff -= (1 << len) - 1; } if i < 64 { diffbuf[i] = diff; } i += 1; } diffbuf[0] += carry; carry = diffbuf[0]; // Save those differences to 64 pixels adjusting the predictor as we go for i in 0..64 { // At the start of lines reset the predictor to 512 if pnum % width == 0 { base[0] = 512; base[1] = 512; } pnum += 1; base[i & 1] += diffbuf[i]; pixout[i] = base[i & 1] as u16; } } if lowbits { // Add the uncompressed 2 low bits to the decoded 8 high bits for (i,o) in out.chunks_exact_mut(4).enumerate() { let c = buffer[26+i] as u16; o[0] = o[0] << 2 | (c ) & 0x03; o[1] = o[1] << 2 | (c >> 2) & 0x03; o[2] = o[2] << 2 | (c >> 4) & 0x03; o[3] = o[3] << 2 | (c >> 6) & 0x03; if width == 2672 { // No idea why this is needed, probably some broken camera if o[0] < 512 { o[0] += 2} if o[1] < 512 { o[1] += 2} if o[2] < 512 { o[2] += 2} if o[3] < 512 { o[3] += 2} } } } out } } rawloader-0.37.1/src/decoders/dcr.rs000064400000000000000000000064450072674642500154320ustar 00000000000000use std::f32::NAN; use std::cmp; use crate::decoders::*; use crate::decoders::tiff::*; use crate::decoders::basics::*; #[derive(Debug, Clone)] pub struct DcrDecoder<'a> { buffer: &'a [u8], rawloader: &'a RawLoader, tiff: TiffIFD<'a>, } impl<'a> DcrDecoder<'a> { pub fn new(buf: &'a [u8], tiff: TiffIFD<'a>, rawloader: &'a RawLoader) -> DcrDecoder<'a> { DcrDecoder { buffer: buf, tiff: tiff, rawloader: rawloader, } } } impl<'a> Decoder for DcrDecoder<'a> { fn image(&self, dummy: bool) -> Result { let camera = self.rawloader.check_supported(&self.tiff)?; let raw = fetch_ifd!(&self.tiff, Tag::CFAPattern); let width = fetch_tag!(raw, Tag::ImageWidth).get_usize(0); let height = fetch_tag!(raw, Tag::ImageLength).get_usize(0); let offset = fetch_tag!(raw, Tag::StripOffsets).get_usize(0); let src = &self.buffer[offset..]; let linearization = fetch_tag!(self.tiff, Tag::DcrLinearization); let curve = { let mut points = Vec::new(); for i in 0..linearization.count() { points.push(linearization.get_u32(i) as u16); } LookupTable::new(&points) }; let image = DcrDecoder::decode_kodak65000(src, &curve, width, height, dummy); ok_image(camera, width, height, self.get_wb()?, image) } } impl<'a> DcrDecoder<'a> { fn get_wb(&self) -> Result<[f32;4], String> { let dcrwb = fetch_tag!(self.tiff, Tag::DcrWB); if dcrwb.count() >= 46 { let levels = dcrwb.get_data(); Ok([2048.0 / BEu16(levels,40) as f32, 2048.0 / BEu16(levels,42) as f32, 2048.0 / BEu16(levels,44) as f32, NAN]) } else { Ok([NAN,NAN,NAN,NAN]) } } pub(crate) fn decode_kodak65000(buf: &[u8], curve: &LookupTable, width: usize, height: usize, dummy: bool) -> Vec { let mut out: Vec = alloc_image!(width, height, dummy); let mut input = ByteStream::new(buf, LITTLE_ENDIAN); let mut random: u32 = 0; for row in 0..height { for col in (0..width).step_by(256) { let mut pred: [i32;2] = [0;2]; let buf = DcrDecoder::decode_segment(&mut input, cmp::min(256, width-col)); for (i,val) in buf.iter().enumerate() { pred[i & 1] += *val; if pred[i & 1] < 0 { panic!("Found a negative pixel!"); } out[row*width+col+i] = curve.dither(pred[i & 1] as u16, &mut random); } } } out } fn decode_segment(input: &mut ByteStream, size: usize) -> Vec { let mut out: Vec = vec![0; size]; let mut lens: [usize;256] = [0;256]; for i in (0..size).step_by(2) { lens[i] = (input.peek_u8() & 15) as usize; lens[i+1] = (input.get_u8() >> 4) as usize; } let mut bitbuf: u64 = 0; let mut bits: usize = 0; if (size & 7) == 4 { bitbuf = (input.get_u8() as u64) << 8 | (input.get_u8() as u64); bits = 16; } for i in 0..size { let len = lens[i]; if bits < len { for j in (0..32).step_by(8) { bitbuf += (input.get_u8() as u64) << (bits+(j^8)); } bits += 32; } out[i] = (bitbuf & (0xffff >> (16-len))) as i32; bitbuf >>= len; bits -= len; if len != 0 && (out[i] & (1 << (len-1))) == 0 { out[i] -= (1 << len) - 1; } } out } } rawloader-0.37.1/src/decoders/dcs.rs000064400000000000000000000025700072674642500154260ustar 00000000000000use std::f32::NAN; use crate::decoders::*; use crate::decoders::tiff::*; use crate::decoders::basics::*; #[derive(Debug, Clone)] pub struct DcsDecoder<'a> { buffer: &'a [u8], rawloader: &'a RawLoader, tiff: TiffIFD<'a>, } impl<'a> DcsDecoder<'a> { pub fn new(buf: &'a [u8], tiff: TiffIFD<'a>, rawloader: &'a RawLoader) -> DcsDecoder<'a> { DcsDecoder { buffer: buf, tiff: tiff, rawloader: rawloader, } } } impl<'a> Decoder for DcsDecoder<'a> { fn image(&self, dummy: bool) -> Result { let camera = self.rawloader.check_supported(&self.tiff)?; let data = self.tiff.find_ifds_with_tag(Tag::StripOffsets); let raw = data.iter().find(|&&ifd| { ifd.find_entry(Tag::ImageWidth).unwrap().get_u32(0) > 1000 }).unwrap(); let width = fetch_tag!(raw, Tag::ImageWidth).get_usize(0); let height = fetch_tag!(raw, Tag::ImageLength).get_usize(0); let offset = fetch_tag!(raw, Tag::StripOffsets).get_usize(0); let src = &self.buffer[offset..]; let linearization = fetch_tag!(self.tiff, Tag::GrayResponse); let table = { let mut t: [u16;256] = [0;256]; for i in 0..256 { t[i] = linearization.get_u32(i) as u16; } LookupTable::new(&t) }; let image = decode_8bit_wtable(src, &table, width, height, dummy); ok_image(camera, width, height, [NAN,NAN,NAN,NAN], image) } } rawloader-0.37.1/src/decoders/dng.rs000064400000000000000000000204460072674642500154270ustar 00000000000000use std::f32::NAN; use std::cmp; use crate::decoders::*; use crate::decoders::tiff::*; use crate::decoders::basics::*; use crate::decoders::ljpeg::*; use crate::decoders::cfa::*; #[derive(Debug, Clone)] pub struct DngDecoder<'a> { buffer: &'a [u8], rawloader: &'a RawLoader, tiff: TiffIFD<'a>, } impl<'a> DngDecoder<'a> { pub fn new(buf: &'a [u8], tiff: TiffIFD<'a>, rawloader: &'a RawLoader) -> DngDecoder<'a> { DngDecoder { buffer: buf, tiff: tiff, rawloader: rawloader, } } } impl<'a> Decoder for DngDecoder<'a> { fn image(&self, dummy: bool) -> Result { let ifds = self.tiff.find_ifds_with_tag(Tag::Compression).into_iter().filter(|ifd| { let compression = (**ifd).find_entry(Tag::Compression).unwrap().get_u32(0); let subsampled = match (**ifd).find_entry(Tag::NewSubFileType) { Some(e) => e.get_u32(0) & 1 != 0, None => false, }; !subsampled && (compression == 7 || compression == 1 || compression == 0x884c) }).collect::>(); let raw = ifds[0]; let width = fetch_tag!(raw, Tag::ImageWidth).get_usize(0); let height = fetch_tag!(raw, Tag::ImageLength).get_usize(0); let cpp = fetch_tag!(raw, Tag::SamplesPerPixel).get_usize(0); let linear = fetch_tag!(raw, Tag::PhotometricInt).get_usize(0) == 34892; let image = match fetch_tag!(raw, Tag::Compression).get_u32(0) { 1 => self.decode_uncompressed(raw, width*cpp, height, dummy)?, 7 => self.decode_compressed(raw, width*cpp, height, cpp, dummy)?, c => return Err(format!("Don't know how to read DNGs with compression {}", c).to_string()), }; let (make, model, clean_make, clean_model, orientation) = { match self.rawloader.check_supported(&self.tiff) { Ok(cam) => { (cam.make.clone(), cam.model.clone(), cam.clean_make.clone(), cam.clean_model.clone(), cam.orientation) }, Err(_) => { let make = fetch_tag!(self.tiff, Tag::Make).get_str(); let model = fetch_tag!(self.tiff, Tag::Model).get_str(); let orientation = Orientation::from_tiff(&self.tiff); (make.to_string(), model.to_string(), make.to_string(), model.to_string(), orientation) }, } }; Ok(RawImage { make: make, model: model, clean_make: clean_make, clean_model: clean_model, width: width, height: height, cpp: cpp, wb_coeffs: self.get_wb()?, data: RawImageData::Integer(image), blacklevels: self.get_blacklevels(raw)?, whitelevels: self.get_whitelevels(raw)?, xyz_to_cam: self.get_color_matrix()?, cfa: if linear {CFA::new("")} else {self.get_cfa(raw)?}, crops: self.get_crops(raw, width, height)?, blackareas: self.get_masked_areas(raw), orientation: orientation, }) } } impl<'a> DngDecoder<'a> { fn get_wb(&self) -> Result<[f32;4], String> { if let Some(levels) = self.tiff.find_entry(Tag::AsShotNeutral) { Ok([1.0/levels.get_f32(0),1.0/levels.get_f32(1),1.0/levels.get_f32(2),NAN]) } else { Ok([NAN,NAN,NAN,NAN]) } } fn get_blacklevels(&self, raw: &TiffIFD) -> Result<[u16;4], String> { if let Some(levels) = raw.find_entry(Tag::BlackLevels) { if levels.count() < 4 { let black = levels.get_f32(0) as u16; Ok([black, black, black, black]) } else { Ok([levels.get_f32(0) as u16,levels.get_f32(1) as u16, levels.get_f32(2) as u16,levels.get_f32(3) as u16]) } } else { Ok([0,0,0,0]) } } fn get_whitelevels(&self, raw: &TiffIFD) -> Result<[u16;4], String> { let level = fetch_tag!(raw, Tag::WhiteLevel).get_u32(0) as u16; Ok([level,level,level,level]) } fn get_cfa(&self, raw: &TiffIFD) -> Result { let pattern = fetch_tag!(raw, Tag::CFAPattern); Ok(CFA::new_from_tag(pattern)) } fn get_crops(&self, raw: &TiffIFD, width: usize, height: usize) -> Result<[usize;4],String> { if let Some(crops) = raw.find_entry(Tag::ActiveArea) { Ok([crops.get_usize(0), width - crops.get_usize(3), height - crops.get_usize(2), crops.get_usize(1)]) } else { // Ignore missing crops, at least some pentax DNGs don't have it Ok([0,0,0,0]) } } fn get_masked_areas(&self, raw: &TiffIFD) -> Vec<(u64, u64, u64, u64)> { let mut areas = Vec::new(); if let Some(masked_area) = raw.find_entry(Tag::MaskedAreas) { for x in (0..masked_area.count()).step_by(4) { areas.push(( masked_area.get_u32(x).into(), masked_area.get_u32(x + 1).into(), masked_area.get_u32(x + 2).into(), masked_area.get_u32(x + 3).into() )); } } areas } fn get_color_matrix(&self) -> Result<[[f32;3];4],String> { let mut matrix: [[f32;3];4] = [[0.0;3];4]; let cmatrix = { if let Some(c) = self.tiff.find_entry(Tag::ColorMatrix2) { c } else if let Some(c) = self.tiff.find_entry(Tag::ColorMatrix1) { c } else { return Ok([ // sRGB D65 [ 0.412453, 0.357580, 0.180423 ], [ 0.212671, 0.715160, 0.072169 ], [ 0.019334, 0.119193, 0.950227 ], [ 0.0, 0.0, 0.0], ]) } }; if cmatrix.count() > 12 { Err(format!("color matrix supposedly has {} components",cmatrix.count()).to_string()) } else { for i in 0..cmatrix.count() { matrix[i/3][i%3] = cmatrix.get_f32(i); } Ok(matrix) } } pub fn decode_uncompressed(&self, raw: &TiffIFD, width: usize, height: usize, dummy: bool) -> Result,String> { let offset = fetch_tag!(raw, Tag::StripOffsets).get_usize(0); let src = &self.buffer[offset..]; match fetch_tag!(raw, Tag::BitsPerSample).get_u32(0) { 16 => Ok(decode_16le(src, width, height, dummy)), 12 => Ok(decode_12be(src, width, height, dummy)), 10 => Ok(decode_10le(src, width, height, dummy)), 8 => { // It's 8 bit so there will be linearization involved surely! let linearization = fetch_tag!(self.tiff, Tag::Linearization); let curve = { let mut points = vec![0 as u16; 256]; for i in 0..256 { points[i] = linearization.get_u32(i) as u16; } LookupTable::new(&points) }; Ok(decode_8bit_wtable(src, &curve, width, height, dummy)) }, bps => Err(format!("DNG: Don't know about {} bps images", bps).to_string()), } } pub fn decode_compressed(&self, raw: &TiffIFD, width: usize, height: usize, cpp: usize, dummy: bool) -> Result,String> { if let Some(offsets) = raw.find_entry(Tag::StripOffsets) { // We're in a normal offset situation if offsets.count() != 1 { return Err("DNG: files with more than one slice not supported yet".to_string()) } let offset = offsets.get_usize(0); let src = &self.buffer[offset..]; let mut out = alloc_image_ok!(width, height, dummy); let decompressor = LjpegDecompressor::new(src)?; decompressor.decode(&mut out, 0, width, width, height, dummy)?; Ok(out) } else if let Some(offsets) = raw.find_entry(Tag::TileOffsets) { // They've gone with tiling let twidth = fetch_tag!(raw, Tag::TileWidth).get_usize(0)*cpp; let tlength = fetch_tag!(raw, Tag::TileLength).get_usize(0); let coltiles = (width-1)/twidth + 1; let rowtiles = (height-1)/tlength + 1; if coltiles*rowtiles != offsets.count() { return Err(format!("DNG: trying to decode {} tiles from {} offsets", coltiles*rowtiles, offsets.count()).to_string()) } Ok(decode_threaded_multiline(width, height, tlength, dummy, &(|strip: &mut [u16], row| { let row = row / tlength; for col in 0..coltiles { let offset = offsets.get_usize(row*coltiles+col); let src = &self.buffer[offset..]; let decompressor = LjpegDecompressor::new(src).unwrap(); let bwidth = cmp::min(width, (col+1)*twidth) - col*twidth; let blength = cmp::min(height, (row+1)*tlength) - row*tlength; // FIXME: instead of unwrap() we need to propagate the error decompressor.decode(strip, col*twidth, width, bwidth, blength, dummy).unwrap(); } }))) } else { Err("DNG: didn't find tiles or strips".to_string()) } } } rawloader-0.37.1/src/decoders/erf.rs000064400000000000000000000026370072674642500154350ustar 00000000000000use std::f32::NAN; use crate::decoders::*; use crate::decoders::tiff::*; use crate::decoders::basics::*; #[derive(Debug, Clone)] pub struct ErfDecoder<'a> { buffer: &'a [u8], rawloader: &'a RawLoader, tiff: TiffIFD<'a>, } impl<'a> ErfDecoder<'a> { pub fn new(buf: &'a [u8], tiff: TiffIFD<'a>, rawloader: &'a RawLoader) -> ErfDecoder<'a> { ErfDecoder { buffer: buf, tiff: tiff, rawloader: rawloader, } } } impl<'a> Decoder for ErfDecoder<'a> { fn image(&self, dummy: bool) -> Result { let camera = self.rawloader.check_supported(&self.tiff)?; let raw = fetch_ifd!(&self.tiff, Tag::CFAPattern); let width = fetch_tag!(raw, Tag::ImageWidth).get_usize(0); let height = fetch_tag!(raw, Tag::ImageLength).get_usize(0); let offset = fetch_tag!(raw, Tag::StripOffsets).get_usize(0); let src = &self.buffer[offset..]; let image = decode_12be_wcontrol(src, width, height, dummy); ok_image(camera, width, height, self.get_wb()?, image) } } impl<'a> ErfDecoder<'a> { fn get_wb(&self) -> Result<[f32;4], String> { let levels = fetch_tag!(self.tiff, Tag::EpsonWB); if levels.count() != 256 { Err("ERF: Levels count is off".to_string()) } else { let r = BEu16(levels.get_data(), 48) as f32; let b = BEu16(levels.get_data(), 50) as f32; Ok([r * 508.0 * 1.078 / 65536.0, 1.0, b * 382.0 * 1.173 / 65536.0, NAN]) } } } rawloader-0.37.1/src/decoders/iiq.rs000064400000000000000000000057470072674642500154500ustar 00000000000000use std::f32::NAN; use crate::decoders::*; use crate::decoders::tiff::*; use crate::decoders::basics::*; #[derive(Debug, Clone)] pub struct IiqDecoder<'a> { buffer: &'a [u8], rawloader: &'a RawLoader, tiff: TiffIFD<'a>, } impl<'a> IiqDecoder<'a> { pub fn new(buf: &'a [u8], tiff: TiffIFD<'a>, rawloader: &'a RawLoader) -> IiqDecoder<'a> { IiqDecoder { buffer: buf, tiff: tiff, rawloader: rawloader, } } } impl<'a> Decoder for IiqDecoder<'a> { fn image(&self, dummy: bool) -> Result { let camera = self.rawloader.check_supported(&self.tiff)?; let off = LEu32(self.buffer, 16) as usize + 8; let entries = LEu32(self.buffer, off); let mut pos = 8; let mut wb_offset: usize = 0; let mut width: usize = 0; let mut height: usize = 0; let mut data_offset: usize = 0; let mut strip_offset: usize = 0; let mut black: u16 = 0; for _ in 0..entries { let tag = LEu32(self.buffer, off+pos); let data = LEu32(self.buffer, off+pos+12) as usize; pos += 16; match tag { 0x107 => wb_offset = data+8, 0x108 => width = data, 0x109 => height = data, 0x10f => data_offset = data+8, 0x21c => strip_offset = data+8, 0x21d => black = (data>>2) as u16, _ => {}, } } if width <= 0 || height <= 0 { return Err("IIQ: couldn't find width and height".to_string()) } let image = Self::decode_compressed(self.buffer, data_offset, strip_offset, width, height, dummy); ok_image_with_blacklevels(camera, width, height, self.get_wb(wb_offset)?, [black, black, black, black], image) } } impl<'a> IiqDecoder<'a> { fn get_wb(&self, wb_offset: usize) -> Result<[f32;4], String> { Ok([LEf32(self.buffer, wb_offset), LEf32(self.buffer, wb_offset+4), LEf32(self.buffer, wb_offset+8), NAN]) } pub(crate) fn decode_compressed(buffer: &[u8], data_offset: usize, strip_offset: usize, width: usize, height: usize, dummy: bool) -> Vec{ let lens: [u32; 10] = [8,7,6,9,11,10,5,12,14,13]; decode_threaded(width, height, dummy, &(|out: &mut [u16], row| { let offset = data_offset + LEu32(buffer, strip_offset+row*4) as usize; let mut pump = BitPumpMSB32::new(&buffer[offset..]); let mut pred = [0 as u32; 2]; let mut len = [0 as u32; 2]; for (col, pixout) in out.chunks_exact_mut(1).enumerate() { if col >= (width & 0xfffffff8) { len[0] = 14; len[1] = 14; } else if col&7 == 0 { for i in 0..2 { let mut j: usize = 0; while j < 5 && pump.get_bits(1) == 0 {j += 1} if j > 0 { len[i] = lens[(j-1)*2 + pump.get_bits(1) as usize]; } } } let i = len[col & 1]; pred[col & 1] = if i == 14 { pump.get_bits(16) } else { pred[col & 1] + pump.get_bits(i) + 1 - (1 << (i-1)) }; pixout[0] = pred[col & 1] as u16; } })) } } rawloader-0.37.1/src/decoders/image.rs000064400000000000000000000155700072674642500157430ustar 00000000000000use crate::decoders::*; use crate::decoders::cfa::*; /// All the data needed to process this raw image, including the image data itself as well /// as all the needed metadata #[derive(Debug, Clone)] pub struct RawImage { /// camera make as encoded in the file pub make: String, /// camera model as encoded in the file pub model: String, /// make cleaned up to be consistent and short pub clean_make: String, /// model cleaned up to be consistent and short pub clean_model: String, /// width of the full image pub width: usize, /// height of the full image pub height: usize, /// number of components per pixel (1 for bayer, 3 for RGB images) pub cpp: usize, /// whitebalance coefficients encoded in the file in RGBE order pub wb_coeffs: [f32;4], /// image whitelevels in RGBE order pub whitelevels: [u16;4], /// image blacklevels in RGBE order pub blacklevels: [u16;4], /// matrix to convert XYZ to camera RGBE pub xyz_to_cam: [[f32;3];4], /// color filter array pub cfa: CFA, /// how much to crop the image to get all the usable area, order is top, right, bottom, left pub crops: [usize;4], /// Areas of the sensor that is masked to prevent it from receiving light. Used to calculate /// black levels and noise. Each tuple represents a masked rectangle's top, right, bottom, left pub blackareas: Vec<(u64,u64,u64,u64)>, /// orientation of the image as indicated by the image metadata pub orientation: Orientation, /// image data itself, has `width`\*`height`\*`cpp` elements pub data: RawImageData, } /// The actual image data, after decoding #[derive(Debug, Clone)] pub enum RawImageData { /// The most usual u16 output of almost all formats Integer(Vec), /// Some formats are directly encoded as f32, most notably some DNGs Float(Vec), } impl RawImage { #[doc(hidden)] pub fn new(camera: Camera, width: usize, height: usize, wb_coeffs: [f32;4], image: Vec, dummy: bool) -> RawImage { let blacks = if !dummy && (camera.blackareah.1 != 0 || camera.blackareav.1 != 0) { let mut avg = [0 as f32; 4]; let mut count = [0 as f32; 4]; for row in camera.blackareah.0 .. camera.blackareah.0+camera.blackareah.1 { for col in 0..width { let color = camera.cfa.color_at(row,col); avg[color] += image[row*width+col] as f32; count[color] += 1.0; } } for row in 0..height { for col in camera.blackareav.0 .. camera.blackareav.0+camera.blackareav.1 { let color = camera.cfa.color_at(row,col); avg[color] += image[row*width+col] as f32; count[color] += 1.0; } } [(avg[0]/count[0]) as u16, (avg[1]/count[1]) as u16, (avg[2]/count[2]) as u16, (avg[3]/count[3]) as u16] } else { camera.blacklevels }; // tuple format is top, right, bottom left let mut blackareas: Vec<(u64,u64,u64,u64)> = Vec::new(); if camera.blackareah.1 != 0 { blackareas.push((camera.blackareah.0 as u64, width as u64, (camera.blackareah.0 + camera.blackareah.1) as u64, 0)); } if camera.blackareav.1 != 0 { blackareas.push((0, (camera.blackareav.0 + camera.blackareav.1) as u64, height as u64, camera.blackareav.0 as u64)) } RawImage { make: camera.make.clone(), model: camera.model.clone(), clean_make: camera.clean_make.clone(), clean_model: camera.clean_model.clone(), width: width, height: height, cpp: 1, wb_coeffs: wb_coeffs, data: RawImageData::Integer(image), blacklevels: blacks, whitelevels: camera.whitelevels, xyz_to_cam: camera.xyz_to_cam, cfa: camera.cfa.clone(), crops: camera.crops, blackareas: blackareas, orientation: camera.orientation, } } /// Outputs the inverted matrix that converts pixels in the camera colorspace into /// XYZ components. pub fn cam_to_xyz(&self) -> [[f32;4];3] { Self::pseudoinverse(self.xyz_to_cam) } /// Outputs the inverted matrix that converts pixels in the camera colorspace into /// XYZ components normalized to be easily used to convert to Lab or a RGB output space pub fn cam_to_xyz_normalized(&self) -> [[f32;4];3] { Self::normalized_pseudoinverse(self.xyz_to_cam) } /// Not all cameras encode a whitebalance so in those cases just using a 6500K neutral one /// is a good compromise pub fn neutralwb(&self) -> [f32;4] { let rgb_to_xyz = [ // sRGB D65 [ 0.412453, 0.357580, 0.180423 ], [ 0.212671, 0.715160, 0.072169 ], [ 0.019334, 0.119193, 0.950227 ], ]; // Multiply RGB matrix let mut rgb_to_cam = [[0.0;3];4]; for i in 0..4 { for j in 0..3 { rgb_to_cam[i][j] = 0.0; for k in 0..3 { rgb_to_cam[i][j] += self.xyz_to_cam[i][k] * rgb_to_xyz[k][j]; } } } let mut neutralwb = [0 as f32; 4]; for i in 0..4 { let mut num = 0.0; for j in 0..3 { num += rgb_to_cam[i][j]; } neutralwb[i] = 1.0 / num; } [neutralwb[0]/neutralwb[1], neutralwb[1]/neutralwb[1], neutralwb[2]/neutralwb[1], neutralwb[3]/neutralwb[1]] } /// Normalize matrix so that inm * (1,1,1) is (1,1,1,1) and then invert pub fn normalized_pseudoinverse(inm: [[f32;3];4]) -> [[f32;4];3] { let mut xyz_to_cam = inm; // Normalize xyz_to_cam so that xyz_to_cam * (1,1,1) is (1,1,1,1) for i in 0..4 { let mut num = 0.0; for j in 0..3 { num += xyz_to_cam[i][j]; } for j in 0..3 { xyz_to_cam[i][j] = if num == 0.0 { 0.0 } else { xyz_to_cam[i][j] / num }; } } Self::pseudoinverse(xyz_to_cam) } /// Matrix inversion that deals with 4x3 matrices pub fn pseudoinverse(inm: [[f32;3];4]) -> [[f32;4];3] { let mut temp: [[f32;6];3] = [[0.0; 6];3]; for i in 0..3 { for j in 0..6 { temp[i][j] = if j == i+3 { 1.0 } else { 0.0 }; } for j in 0..3 { for k in 0..4 { temp[i][j] += inm[k][i] * inm[k][j]; } } } for i in 0..3 { let mut num = temp[i][i]; for j in 0..6 { temp[i][j] /= num; } for k in 0..3 { if k == i { continue } num = temp[k][i]; for j in 0..6 { temp[k][j] -= temp[i][j] * num; } } } let mut out: [[f32;4];3] = [[0.0; 4];3]; for i in 0..4 { for j in 0..3 { out[j][i] = 0.0; for k in 0..3 { out[j][i] += temp[j][k+3] * inm[i][k]; } } } out } /// Returns the CFA pattern after the crop has been applied (and thus the pattern /// potentially shifted) pub fn cropped_cfa(&self) -> CFA { self.cfa.shift(self.crops[3], self.crops[0]) } /// Checks if the image is monochrome pub fn is_monochrome(&self) -> bool { self.cpp == 1 && !self.cfa.is_valid() } } rawloader-0.37.1/src/decoders/kdc.rs000064400000000000000000000060060072674642500154140ustar 00000000000000use std::f32::NAN; use crate::decoders::*; use crate::decoders::tiff::*; use crate::decoders::basics::*; #[derive(Debug, Clone)] pub struct KdcDecoder<'a> { buffer: &'a [u8], rawloader: &'a RawLoader, tiff: TiffIFD<'a>, } impl<'a> KdcDecoder<'a> { pub fn new(buf: &'a [u8], tiff: TiffIFD<'a>, rawloader: &'a RawLoader) -> KdcDecoder<'a> { KdcDecoder { buffer: buf, tiff: tiff, rawloader: rawloader, } } } impl<'a> Decoder for KdcDecoder<'a> { fn image(&self, dummy: bool) -> Result { let camera = self.rawloader.check_supported(&self.tiff)?; if camera.model == "Kodak DC120 ZOOM Digital Camera" { let width = 848; let height = 976; let raw = self.tiff.find_ifds_with_tag(Tag::CFAPattern)[0]; let off = fetch_tag!(raw, Tag::StripOffsets).get_usize(0); let src = &self.buffer[off..]; let image = match fetch_tag!(raw, Tag::Compression).get_usize(0) { 1 => Self::decode_dc120(src, width, height, dummy), c => return Err(format!("KDC: DC120: Don't know how to handle compression type {}", c).to_string()) }; return ok_image(camera, width, height, [NAN, NAN, NAN, NAN], image) } let width = fetch_tag!(self.tiff, Tag::KdcWidth).get_usize(0)+80; let height = fetch_tag!(self.tiff, Tag::KdcLength).get_usize(0)+70; let offset = fetch_tag!(self.tiff, Tag::KdcOffset); if offset.count() < 13 { panic!("KDC Decoder: Couldn't find the KDC offset"); } let mut off = offset.get_usize(4) + offset.get_usize(12); // Offset hardcoding gotten from dcraw if camera.find_hint("easyshare_offset_hack") { off = if off < 0x15000 {0x15000} else {0x17000}; } let src = &self.buffer[off..]; let image = decode_12be(src, width, height, dummy); ok_image(camera, width, height, self.get_wb()?, image) } } impl<'a> KdcDecoder<'a> { fn get_wb(&self) -> Result<[f32;4], String> { match self.tiff.find_entry(Tag::KdcWB) { Some(levels) => { if levels.count() != 3 { Err("KDC: Levels count is off".to_string()) } else { Ok([levels.get_f32(0), levels.get_f32(1), levels.get_f32(2), NAN]) } }, None => { let levels = fetch_tag!(self.tiff, Tag::KodakWB); if levels.count() != 734 && levels.count() != 1502 { Err("KDC: Levels count is off".to_string()) } else { let r = BEu16(levels.get_data(), 148) as f32; let b = BEu16(levels.get_data(), 150) as f32; Ok([r / 256.0, 1.0, b / 256.0, NAN]) } }, } } pub(crate) fn decode_dc120(src: &[u8], width: usize, height: usize, dummy: bool) -> Vec { let mut out = alloc_image!(width, height, dummy); let mul: [usize;4] = [162, 192, 187, 92]; let add: [usize;4] = [ 0, 636, 424, 212]; for row in 0..height { let shift = row * mul[row & 3] + add[row & 3]; for col in 0..width { out[row*width+col] = src[row*width + ((col + shift) % 848)] as u16; } } out } } rawloader-0.37.1/src/decoders/ljpeg/decompressors.rs000064400000000000000000000304010072674642500206400ustar 00000000000000use crate::decoders::basics::*; use crate::decoders::ljpeg::LjpegDecompressor; use crate::decoders::ljpeg::huffman::*; pub fn decode_ljpeg_2components(ljpeg: &LjpegDecompressor, out: &mut [u16], x: usize, stripwidth:usize, width: usize, height: usize) -> Result<(),String> { if ljpeg.sof.width*2 < width || ljpeg.sof.height < height { return Err(format!("ljpeg: trying to decode {}x{} into {}x{}", ljpeg.sof.width*2, ljpeg.sof.height, width, height).to_string()) } let ref htable1 = ljpeg.dhts[ljpeg.sof.components[0].dc_tbl_num]; let ref htable2 = ljpeg.dhts[ljpeg.sof.components[1].dc_tbl_num]; let mut pump = BitPumpJPEG::new(ljpeg.buffer); let base_prediction = 1 << (ljpeg.sof.precision - ljpeg.point_transform -1); out[x] = (base_prediction + htable1.huff_decode(&mut pump)?) as u16; out[x+1] = (base_prediction + htable2.huff_decode(&mut pump)?) as u16; let skip_x = ljpeg.sof.width - width/2; for row in 0..height { let startcol = if row == 0 {x+2} else {x}; for col in (startcol..(width+x)).step_by(2) { let (p1,p2) = if col == x { // At start of line predictor starts with start of previous line (out[(row-1)*stripwidth+x],out[(row-1)*stripwidth+1+x]) } else { // All other cases use the two previous pixels in the same line (out[row*stripwidth+col-2], out[row*stripwidth+col-1]) }; let diff1 = htable1.huff_decode(&mut pump)?; let diff2 = htable2.huff_decode(&mut pump)?; out[row*stripwidth+col] = ((p1 as i32) + diff1) as u16; out[row*stripwidth+col+1] = ((p2 as i32) + diff2) as u16; } // Skip extra encoded differences if the ljpeg frame is wider than the output for _ in 0..skip_x { htable1.huff_decode(&mut pump)?; htable2.huff_decode(&mut pump)?; } } Ok(()) } pub fn decode_ljpeg_3components(ljpeg: &LjpegDecompressor, out: &mut [u16], x: usize, stripwidth:usize, width: usize, height: usize) -> Result<(),String> { if ljpeg.sof.width*3 < width || ljpeg.sof.height < height { return Err(format!("ljpeg: trying to decode {}x{} into {}x{}", ljpeg.sof.width*3, ljpeg.sof.height, width, height).to_string()) } let ref htable1 = ljpeg.dhts[ljpeg.sof.components[0].dc_tbl_num]; let ref htable2 = ljpeg.dhts[ljpeg.sof.components[1].dc_tbl_num]; let ref htable3 = ljpeg.dhts[ljpeg.sof.components[2].dc_tbl_num]; let mut pump = BitPumpJPEG::new(ljpeg.buffer); let base_prediction = 1 << (ljpeg.sof.precision - ljpeg.point_transform -1); out[x] = (base_prediction + htable1.huff_decode(&mut pump)?) as u16; out[x+1] = (base_prediction + htable2.huff_decode(&mut pump)?) as u16; out[x+2] = (base_prediction + htable3.huff_decode(&mut pump)?) as u16; let skip_x = ljpeg.sof.width - width/3; for row in 0..height { let startcol = if row == 0 {x+3} else {x}; for col in (startcol..(width+x)).step_by(3) { let pos = if col == x { // At start of line predictor starts with start of previous line (row-1)*stripwidth+x } else { // All other cases use the two previous pixels in the same line row*stripwidth+col-3 }; let (p1,p2,p3) = (out[pos],out[pos+1],out[pos+2]); let diff1 = htable1.huff_decode(&mut pump)?; let diff2 = htable2.huff_decode(&mut pump)?; let diff3 = htable3.huff_decode(&mut pump)?; out[row*stripwidth+col] = ((p1 as i32) + diff1) as u16; out[row*stripwidth+col+1] = ((p2 as i32) + diff2) as u16; out[row*stripwidth+col+2] = ((p3 as i32) + diff3) as u16; } // Skip extra encoded differences if the ljpeg frame is wider than the output for _ in 0..skip_x { htable1.huff_decode(&mut pump)?; htable2.huff_decode(&mut pump)?; htable3.huff_decode(&mut pump)?; } } Ok(()) } pub fn decode_ljpeg_4components(ljpeg: &LjpegDecompressor, out: &mut [u16], width: usize, height: usize) -> Result<(),String> { if ljpeg.sof.width*4 < width || ljpeg.sof.height < height { return Err(format!("ljpeg: trying to decode {}x{} into {}x{}", ljpeg.sof.width*4, ljpeg.sof.height, width, height).to_string()) } let ref htable1 = ljpeg.dhts[ljpeg.sof.components[0].dc_tbl_num]; let ref htable2 = ljpeg.dhts[ljpeg.sof.components[1].dc_tbl_num]; let ref htable3 = ljpeg.dhts[ljpeg.sof.components[2].dc_tbl_num]; let ref htable4 = ljpeg.dhts[ljpeg.sof.components[3].dc_tbl_num]; let mut pump = BitPumpJPEG::new(ljpeg.buffer); let base_prediction = 1 << (ljpeg.sof.precision - ljpeg.point_transform -1); out[0] = (base_prediction + htable1.huff_decode(&mut pump)?) as u16; out[1] = (base_prediction + htable2.huff_decode(&mut pump)?) as u16; out[2] = (base_prediction + htable3.huff_decode(&mut pump)?) as u16; out[3] = (base_prediction + htable4.huff_decode(&mut pump)?) as u16; let skip_x = ljpeg.sof.width - width/4; for row in 0..height { let startcol = if row == 0 {4} else {0}; for col in (startcol..width).step_by(4) { let pos = if col == 0 { // At start of line predictor starts with start of previous line (row-1)*width } else { // All other cases use the two previous pixels in the same line row*width+col-4 }; let (p1,p2,p3,p4) = (out[pos],out[pos+1],out[pos+2],out[pos+3]); let diff1 = htable1.huff_decode(&mut pump)?; let diff2 = htable2.huff_decode(&mut pump)?; let diff3 = htable3.huff_decode(&mut pump)?; let diff4 = htable4.huff_decode(&mut pump)?; out[row*width+col] = ((p1 as i32) + diff1) as u16; out[row*width+col+1] = ((p2 as i32) + diff2) as u16; out[row*width+col+2] = ((p3 as i32) + diff3) as u16; out[row*width+col+3] = ((p4 as i32) + diff4) as u16; } // Skip extra encoded differences if the ljpeg frame is wider than the output for _ in 0..skip_x { htable1.huff_decode(&mut pump)?; htable2.huff_decode(&mut pump)?; htable3.huff_decode(&mut pump)?; htable4.huff_decode(&mut pump)?; } } Ok(()) } fn set_yuv_420(out: &mut [u16], row: usize, col: usize, width: usize, y1: i32, y2: i32, y3: i32, y4: i32, cb: i32, cr: i32) { let pix1 = row*width+col; let pix2 = pix1+3; let pix3 = (row+1)*width+col; let pix4 = pix3+3; out[pix1+0] = y1 as u16; out[pix1+1] = cb as u16; out[pix1+2] = cr as u16; out[pix2+0] = y2 as u16; out[pix2+1] = cb as u16; out[pix2+2] = cr as u16; out[pix3+0] = y3 as u16; out[pix3+1] = cb as u16; out[pix3+2] = cr as u16; out[pix4+0] = y4 as u16; out[pix4+1] = cb as u16; out[pix4+2] = cr as u16; } pub fn decode_ljpeg_420(ljpeg: &LjpegDecompressor, out: &mut [u16], width: usize, height: usize) -> Result<(),String> { if ljpeg.sof.width*3 != width || ljpeg.sof.height != height { return Err(format!("ljpeg: trying to decode {}x{} into {}x{}", ljpeg.sof.width*3, ljpeg.sof.height, width, height).to_string()) } let ref htable1 = ljpeg.dhts[ljpeg.sof.components[0].dc_tbl_num]; let ref htable2 = ljpeg.dhts[ljpeg.sof.components[1].dc_tbl_num]; let ref htable3 = ljpeg.dhts[ljpeg.sof.components[2].dc_tbl_num]; let mut pump = BitPumpJPEG::new(ljpeg.buffer); let base_prediction = 1 << (ljpeg.sof.precision - ljpeg.point_transform -1); let y1 = base_prediction + htable1.huff_decode(&mut pump)?; let y2 = y1 + htable1.huff_decode(&mut pump)?; let y3 = y2 + htable1.huff_decode(&mut pump)?; let y4 = y3 + htable1.huff_decode(&mut pump)?; let cb = base_prediction + htable2.huff_decode(&mut pump)?; let cr = base_prediction + htable3.huff_decode(&mut pump)?; set_yuv_420(out, 0, 0, width, y1, y2, y3, y4, cb, cr); for row in (0..height).step_by(2) { let startcol = if row == 0 {6} else {0}; for col in (startcol..width).step_by(6) { let pos = if col == 0 { // At start of line predictor starts with first pixel of start of previous line (row-2)*width } else { // All other cases use the last pixel in the same two lines (row+1)*width+col-3 }; let (py,pcb,pcr) = (out[pos],out[pos+1],out[pos+2]); let y1 = (py as i32) + htable1.huff_decode(&mut pump)?; let y2 = (y1 as i32) + htable1.huff_decode(&mut pump)?; let y3 = (y2 as i32) + htable1.huff_decode(&mut pump)?; let y4 = (y3 as i32) + htable1.huff_decode(&mut pump)?; let cb = (pcb as i32) + htable2.huff_decode(&mut pump)?; let cr = (pcr as i32) + htable3.huff_decode(&mut pump)?; set_yuv_420(out, row, col, width, y1, y2, y3, y4, cb, cr); } } Ok(()) } fn set_yuv_422(out: &mut [u16], row: usize, col: usize, width: usize, y1: i32, y2: i32, cb: i32, cr: i32) { let pix1 = row*width+col; let pix2 = pix1+3; out[pix1+0] = y1 as u16; out[pix1+1] = cb as u16; out[pix1+2] = cr as u16; out[pix2+0] = y2 as u16; out[pix2+1] = cb as u16; out[pix2+2] = cr as u16; } pub fn decode_ljpeg_422(ljpeg: &LjpegDecompressor, out: &mut [u16], width: usize, height: usize) -> Result<(),String> { if ljpeg.sof.width*3 != width || ljpeg.sof.height != height { return Err(format!("ljpeg: trying to decode {}x{} into {}x{}", ljpeg.sof.width*3, ljpeg.sof.height, width, height).to_string()) } let ref htable1 = ljpeg.dhts[ljpeg.sof.components[0].dc_tbl_num]; let ref htable2 = ljpeg.dhts[ljpeg.sof.components[1].dc_tbl_num]; let ref htable3 = ljpeg.dhts[ljpeg.sof.components[2].dc_tbl_num]; let mut pump = BitPumpJPEG::new(ljpeg.buffer); let base_prediction = 1 << (ljpeg.sof.precision - ljpeg.point_transform -1); let y1 = base_prediction + htable1.huff_decode(&mut pump)?; let y2 = y1 + htable1.huff_decode(&mut pump)?; let cb = base_prediction + htable2.huff_decode(&mut pump)?; let cr = base_prediction + htable3.huff_decode(&mut pump)?; set_yuv_422(out, 0, 0, width, y1, y2, cb, cr); for row in 0..height { let startcol = if row == 0 {6} else {0}; for col in (startcol..width).step_by(6) { let pos = if col == 0 { // At start of line predictor starts with first pixel of start of previous line (row-1)*width } else { // All other cases use the last pixel in the same two lines row*width+col-3 }; let (py,pcb,pcr) = (out[pos],out[pos+1],out[pos+2]); let y1 = (py as i32) + htable1.huff_decode(&mut pump)?; let y2 = (y1 as i32) + htable1.huff_decode(&mut pump)?; let cb = (pcb as i32) + htable2.huff_decode(&mut pump)?; let cr = (pcr as i32) + htable3.huff_decode(&mut pump)?; set_yuv_422(out, row, col, width, y1, y2, cb, cr); } } Ok(()) } pub fn decode_hasselblad(ljpeg: &LjpegDecompressor, out: &mut [u16], width: usize) -> Result<(),String> { // Pixels are packed two at a time, not like LJPEG: // [p1_length_as_huffman][p2_length_as_huffman][p0_diff_with_length][p1_diff_with_length]|NEXT PIXELS let mut pump = BitPumpMSB32::new(ljpeg.buffer); let ref htable = ljpeg.dhts[ljpeg.sof.components[0].dc_tbl_num]; for line in out.chunks_exact_mut(width) { let mut p1: i32 = 0x8000; let mut p2: i32 = 0x8000; for o in line.chunks_exact_mut(2) { let len1 = htable.huff_len(&mut pump); let len2 = htable.huff_len(&mut pump); p1 += htable.huff_diff(&mut pump, len1); p2 += htable.huff_diff(&mut pump, len2); o[0] = p1 as u16; o[1] = p2 as u16; } } Ok(()) } pub fn decode_leaf_strip(src: &[u8], out: &mut [u16], width: usize, height: usize, htable1: &HuffTable, htable2: &HuffTable, bpred: i32) -> Result<(),String> { let mut pump = BitPumpJPEG::new(src); out[0] = (bpred + htable1.huff_decode(&mut pump)?) as u16; out[1] = (bpred + htable2.huff_decode(&mut pump)?) as u16; for row in 0..height { let startcol = if row == 0 {2} else {0}; for col in (startcol..width).step_by(2) { let pos = if col == 0 { // At start of line predictor starts with start of previous line (row-1)*width } else { // All other cases use the two previous pixels in the same line row*width+col-2 }; let (p1,p2) = (out[pos],out[pos+1]); let diff1 = htable1.huff_decode(&mut pump)?; let diff2 = htable2.huff_decode(&mut pump)?; out[row*width+col] = ((p1 as i32) + diff1) as u16; out[row*width+col+1] = ((p2 as i32) + diff2) as u16; } } Ok(()) } rawloader-0.37.1/src/decoders/ljpeg/huffman.rs000064400000000000000000000132350072674642500174020ustar 00000000000000use std::fmt; use crate::decoders::basics::*; const DECODE_CACHE_BITS: u32 = 13; pub struct HuffTable { // These two fields directly represent the contents of a JPEG DHT marker pub bits: [u32;17], pub huffval: [u32;256], // Represent the weird shifts that are needed for some NEF files pub shiftval: [u32;256], // Enable the workaround for 16 bit decodes in DNG that need to consume those // bits instead of the value being implied pub dng_bug: bool, // In CRW we only use the len code so the cache is not needed pub disable_cache: bool, // The remaining fields are computed from the above to allow more // efficient coding and decoding and thus private // The max number of bits in a huffman code and the table that converts those // bits into how many bits to consume and the decoded length and shift nbits: u32, hufftable: Vec<(u8,u8,u8)>, // A pregenerated table that goes straight to decoding a diff without first // finding a length, fetching bits, and sign extending them. The table is // sized by DECODE_CACHE_BITS and can have 99%+ hit rate with 13 bits decodecache: [Option<(u8,i16)>; 1<< DECODE_CACHE_BITS], initialized: bool, } struct MockPump { bits: u64, nbits: u32, } impl MockPump { pub fn empty() -> Self { MockPump { bits: 0, nbits: 0, } } pub fn set(&mut self, bits: u32, nbits: u32) { self.bits = (bits as u64) << 32; self.nbits = nbits + 32; } pub fn validbits(&self) -> i32 { self.nbits as i32 - 32 } } impl BitPump for MockPump { fn peek_bits(&mut self, num: u32) -> u32 { (self.bits >> (self.nbits-num)) as u32 } fn consume_bits(&mut self, num: u32) { self.nbits -= num; self.bits &= (1 << self.nbits) - 1; } } impl HuffTable { pub fn empty() -> HuffTable { HuffTable { bits: [0;17], huffval: [0;256], shiftval: [0;256], dng_bug: false, disable_cache: false, nbits: 0, hufftable: Vec::new(), decodecache: [None; 1 << DECODE_CACHE_BITS], initialized: false, } } pub fn new(bits: [u32;17], huffval: [u32;256], dng_bug: bool) -> Result { let mut tbl = HuffTable { bits: bits, huffval: huffval, shiftval: [0;256], dng_bug: dng_bug, disable_cache: false, nbits: 0, hufftable: Vec::new(), decodecache: [None; 1 << DECODE_CACHE_BITS], initialized: false, }; tbl.initialize()?; Ok(tbl) } pub fn initialize(&mut self) -> Result<(), String> { // Find out the max code length and allocate a table with that size self.nbits = 16; for i in 0..16 { if self.bits[16-i] != 0 { break; } self.nbits -= 1; } self.hufftable = vec![(0,0,0); 1 << self.nbits]; // Fill in the table itself let mut h = 0; let mut pos = 0; for len in 0..self.nbits { for _ in 0..self.bits[len as usize + 1] { for _ in 0..(1 << (self.nbits-len-1)) { self.hufftable[h] = (len as u8 + 1, self.huffval[pos] as u8, self.shiftval[pos] as u8); h += 1; } pos += 1; } } // Create the decode cache by running the slow code over all the possible // values DECODE_CACHE_BITS wide if !self.disable_cache { let mut pump = MockPump::empty(); let mut i = 0; loop { pump.set(i, DECODE_CACHE_BITS); let (bits, decode) = self.huff_decode_slow(&mut pump); if pump.validbits() >= 0 { self.decodecache[i as usize] = Some((bits, decode as i16)); } i += 1; if i >= 1 << DECODE_CACHE_BITS { break; } } } self.initialized = true; Ok(()) } #[inline(always)] pub fn huff_decode(&self, pump: &mut dyn BitPump) -> Result { let code = pump.peek_bits(DECODE_CACHE_BITS) as usize; if let Some((bits,decode)) = self.decodecache[code] { pump.consume_bits(bits as u32); Ok(decode as i32) } else { let decode = self.huff_decode_slow(pump); Ok(decode.1) } } #[inline(always)] pub fn huff_decode_slow(&self, pump: &mut dyn BitPump) -> (u8,i32) { let len = self.huff_len(pump); (len.0+len.1, self.huff_diff(pump, len)) } #[inline(always)] pub fn huff_len(&self, pump: &mut dyn BitPump) -> (u8,u8,u8) { let code = pump.peek_bits(self.nbits) as usize; let (bits, len, shift) = self.hufftable[code]; pump.consume_bits(bits as u32); (bits, len, shift) } #[inline(always)] pub fn huff_get_bits(&self, pump: &mut dyn BitPump) -> u32 { let code = pump.peek_bits(self.nbits) as usize; let (bits, len, _) = self.hufftable[code]; pump.consume_bits(bits as u32); len as u32 } #[inline(always)] pub fn huff_diff(&self, pump: &mut dyn BitPump, input: (u8,u8,u8)) -> i32 { let (_, len, shift) = input; match len { 0 => 0, 16 => { if self.dng_bug { pump.get_bits(16); // consume can fail because we haven't peeked yet } -32768 }, len => { // decode the difference and extend sign bit let fulllen: i32 = len as i32 + shift as i32; let shift: i32 = shift as i32; let bits = pump.get_bits(len as u32) as i32; let mut diff: i32 = ((bits << 1) + 1) << shift >> 1; if (diff & (1 << (fulllen - 1))) == 0 { diff -= (1 << fulllen) - ((shift == 0) as i32); } diff }, } } } impl fmt::Debug for HuffTable { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { if self.initialized { write!(f, "HuffTable {{ bits: {:?} huffval: {:?} }}", self.bits, &self.huffval[..]) } else { write!(f, "HuffTable {{ uninitialized }}") } } } rawloader-0.37.1/src/decoders/ljpeg/mod.rs000064400000000000000000000227620072674642500165420ustar 00000000000000use crate::decoders::basics::*; use crate::decoders::ljpeg::huffman::*; use crate::decoders::ljpeg::decompressors::*; pub mod huffman; mod decompressors; enum Marker { Stuff = 0x00, SOF3 = 0xc3, // lossless DHT = 0xc4, // huffman tables SOI = 0xd8, // start of image EOI = 0xd9, // end of image SOS = 0xda, // start of scan DQT = 0xdb, // quantization tables Fill = 0xff, } fn m(marker: Marker) -> u8 { marker as u8 } #[derive(Debug, Copy, Clone)] struct JpegComponentInfo { // These values are fixed over the whole image, read from the SOF marker. id: usize, // identifier for this component (0..255) //index: usize, // its index in SOF or cPtr->compInfo[] // Huffman table selector (0..3). The value may vary between scans. // It is read from the SOS marker. dc_tbl_num: usize, super_h: usize, // Horizontal Supersampling super_v: usize, // Vertical Supersampling } #[derive(Debug, Clone)] struct SOFInfo { width: usize, height: usize, cps: usize, precision: usize, components: Vec, csfix: bool, } impl SOFInfo { fn empty(csfix: bool) -> SOFInfo { SOFInfo { width: 0, height: 0, cps: 0, precision: 0, components: Vec::new(), csfix: csfix, } } fn parse_sof(&mut self, input: &mut ByteStream) -> Result<(), String> { let header_length = input.get_u16() as usize; self.precision = input.get_u8() as usize; self.height = input.get_u16() as usize; self.width = input.get_u16() as usize; self.cps = input.get_u8() as usize; if self.precision > 16 { return Err("ljpeg: More than 16 bits per channel is not supported.".to_string()) } if self.cps > 4 || self.cps < 1 { return Err("ljpeg: Only from 1 to 4 components are supported.".to_string()) } if header_length != 8 + self.cps*3 { return Err("ljpeg: Header size mismatch.".to_string()) } for _ in 0..self.cps { let id = input.get_u8() as usize; let subs = input.get_u8() as usize; input.get_u8(); // Skip info about quantized self.components.push(JpegComponentInfo { id: id, //index: i, dc_tbl_num: 0, super_v: subs & 0xf, super_h: subs >> 4, }); } Ok(()) } fn parse_sos(&mut self, input: &mut ByteStream) -> Result<(usize, usize), String> { if self.width == 0 { return Err("ljpeg: Trying to parse SOS before SOF".to_string()) } input.get_u16(); //skip header length let soscps = input.get_u8() as usize; if self.cps != soscps { return Err("ljpeg: component number mismatch in SOS".to_string()) } for cs in 0..self.cps { // At least some MOS cameras have this broken let readcs = input.get_u8() as usize; let cs = if self.csfix {cs} else {readcs}; let component = match self.components.iter_mut().find(|&&mut c| c.id == cs) { Some(val) => val, None => return Err(format!("ljpeg: invalid component selector {}", cs).to_string()) }; let td = (input.get_u8() as usize) >> 4; if td > 3 { return Err("ljpeg: Invalid Huffman table selection".to_string()) } component.dc_tbl_num = td; } let pred = input.get_u8() as usize; input.get_u8(); // Se + Ah Not used in LJPEG let pt = (input.get_u8() as usize) & 0xf; // Point Transform Ok((pred, pt)) } } #[derive(Debug)] pub struct LjpegDecompressor<'a> { buffer: &'a [u8], sof: SOFInfo, predictor: usize, point_transform: usize, dhts: Vec, } impl<'a> LjpegDecompressor<'a> { pub fn new(src: &'a [u8]) -> Result { LjpegDecompressor::new_full(src, false, false) } pub fn new_full(src: &'a [u8], dng_bug: bool, csfix: bool) -> Result { let mut input = ByteStream::new(src, BIG_ENDIAN); if LjpegDecompressor::get_next_marker(&mut input, false)? != m(Marker::SOI) { return Err("ljpeg: Image did not start with SOI. Probably not LJPEG".to_string()) } let mut sof = SOFInfo::empty(csfix); let mut dht_init = [false;4]; let mut dht_bits = [[0 as u32;17];4]; let mut dht_huffval = [[0 as u32;256];4]; let pred; let pt; loop { let marker = LjpegDecompressor::get_next_marker(&mut input, true)?; if marker == m(Marker::SOF3) { // Start of the frame, giving us the basic info sof.parse_sof(&mut input)?; if sof.precision > 16 || sof.precision < 12 { return Err(format!("ljpeg: sof.precision {}", sof.precision).to_string()) } } else if marker == m(Marker::DHT) { // Huffman table settings LjpegDecompressor::parse_dht(&mut input, &mut dht_init, &mut dht_bits, &mut dht_huffval)?; } else if marker == m(Marker::SOS) { // Start of the actual stream, we can decode after this let (a, b) = sof.parse_sos(&mut input)?; pred = a; pt = b; break; } else if marker == m(Marker::EOI) { // Should never be reached as we stop at SOS return Err("ljpeg: reached EOI before SOS".to_string()) } else if marker == m(Marker::DQT) { return Err("ljpeg: not a valid raw file, found DQT".to_string()) } } let mut dhts = Vec::new(); for i in 0..4 { dhts.push(if dht_init[i] { HuffTable::new(dht_bits[i], dht_huffval[i], dng_bug)? } else { HuffTable::empty() }); } let offset = input.get_pos(); Ok(LjpegDecompressor { buffer: &src[offset..], sof: sof, predictor: pred, point_transform: pt, dhts: dhts, }) } fn get_next_marker(input: &mut ByteStream, allowskip:bool) -> Result { if !allowskip { if input.get_u8() != 0xff { return Err("ljpeg: (noskip) expected marker not found".to_string()) } let mark = input.get_u8(); if mark == m(Marker::Stuff) || mark == m(Marker::Fill) { return Err("ljpeg: (noskip) expected marker but found stuff or fill".to_string()) } return Ok(mark) } input.skip_to_marker()?; Ok(input.get_u8()) } fn parse_dht(input: &mut ByteStream, init: &mut [bool;4], bits: &mut [[u32;17];4], huffval: &mut [[u32;256];4]) -> Result<(), String> { let mut length = (input.get_u16() as usize) - 2; while length > 0 { let b = input.get_u8() as usize; let tc = b >> 4; let th = b & 0xf; if tc != 0 { return Err("ljpeg: unsuported table class in DHT".to_string()) } if th > 3 { return Err(format!("ljpeg: unsuported table id {}", th).to_string()) } let mut acc: usize = 0; for i in 0..16 { bits[th][i+1] = input.get_u8() as u32; acc += bits[th][i+1] as usize; } bits[th][0] = 0; if acc > 256 { return Err("ljpeg: invalid DHT table".to_string()) } if length < 1+16+acc { return Err("ljpeg: invalid DHT table length".to_string()) } for i in 0..acc { huffval[th][i] = input.get_u8() as u32; } init[th] = true; length -= 1 + 16 + acc; } Ok(()) } pub fn decode(&self, out: &mut [u16], x: usize, stripwidth: usize, width: usize, height: usize, dummy: bool) -> Result<(),String> { if dummy { return Ok(()); } if self.sof.components[0].super_h == 2 && self.sof.components[0].super_v == 2 { return decode_ljpeg_420(self, out, width, height) } else if self.sof.components[0].super_h == 2 && self.sof.components[0].super_v == 1 { return decode_ljpeg_422(self, out, width, height) } match self.predictor { 1 => { match self.sof.cps { 2 => decode_ljpeg_2components(self, out, x, stripwidth, width, height), 3 => decode_ljpeg_3components(self, out, x, stripwidth, width, height), 4 => decode_ljpeg_4components(self, out, width, height), c => return Err(format!("ljpeg: {} component files not supported", c).to_string()), } }, 8 => decode_hasselblad(self, out, width), p => return Err(format!("ljpeg: predictor {} not supported", p).to_string()), } } pub fn decode_leaf(&self, width: usize, height: usize) -> Result,String> { let mut offsets = vec![0 as usize; 1]; let mut input = ByteStream::new(self.buffer, BIG_ENDIAN); loop { match LjpegDecompressor::get_next_marker(&mut input, true) { Ok(marker) => { if marker == m(Marker::EOI) { break; } offsets.push(input.get_pos()); }, Err(_) => { break }, } } let nstrips = (height-1)/8 + 1; if offsets.len() != nstrips { return Err(format!("MOS: expecting {} strips found {}", nstrips, offsets.len()).to_string()) } let ref htable1 = self.dhts[self.sof.components[0].dc_tbl_num]; let ref htable2 = self.dhts[self.sof.components[1].dc_tbl_num]; let bpred = 1 << (self.sof.precision - self.point_transform -1); Ok(decode_threaded_multiline(width, height, 8, false, &(|strip: &mut [u16], block| { let block = block / 8; let offset = offsets[block]; let nlines = strip.len()/width; decode_leaf_strip(&self.buffer[offset..], strip, width, nlines, htable1, htable2, bpred).unwrap(); }))) } pub fn width(&self) -> usize { self.sof.width * self.sof.cps } pub fn height(&self) -> usize { self.sof.height } pub fn super_v(&self) -> usize { self.sof.components[0].super_v } pub fn super_h(&self) -> usize { self.sof.components[0].super_h } } rawloader-0.37.1/src/decoders/mef.rs000064400000000000000000000017700072674642500154250ustar 00000000000000use crate::decoders::*; use crate::decoders::tiff::*; use crate::decoders::basics::*; use std::f32::NAN; #[derive(Debug, Clone)] pub struct MefDecoder<'a> { buffer: &'a [u8], rawloader: &'a RawLoader, tiff: TiffIFD<'a>, } impl<'a> MefDecoder<'a> { pub fn new(buf: &'a [u8], tiff: TiffIFD<'a>, rawloader: &'a RawLoader) -> MefDecoder<'a> { MefDecoder { buffer: buf, tiff: tiff, rawloader: rawloader, } } } impl<'a> Decoder for MefDecoder<'a> { fn image(&self, dummy: bool) -> Result { let camera = self.rawloader.check_supported(&self.tiff)?; let raw = fetch_ifd!(&self.tiff, Tag::CFAPattern); let width = fetch_tag!(raw, Tag::ImageWidth).get_usize(0); let height = fetch_tag!(raw, Tag::ImageLength).get_usize(0); let offset = fetch_tag!(raw, Tag::StripOffsets).get_usize(0); let src = &self.buffer[offset..]; let image = decode_12be(src, width, height, dummy); ok_image(camera, width, height, [NAN,NAN,NAN,NAN], image) } } rawloader-0.37.1/src/decoders/mod.rs000064400000000000000000000455150072674642500154420ustar 00000000000000use std::collections::HashMap; use std::io::{Read, BufReader}; use std::fs::File; use std::panic; use std::path::Path; use toml::Value; macro_rules! fetch_tag { ($tiff:expr, $tag:expr) => ( $tiff.find_entry($tag).ok_or( format!("Couldn't find tag {}",stringify!($tag)).to_string() )? ); } macro_rules! fetch_ifd { ($tiff:expr, $tag:expr) => ( $tiff.find_first_ifd($tag).ok_or( format!("Couldn't find ifd with tag {}",stringify!($tag)).to_string() )? ); } macro_rules! alloc_image_plain { ($width:expr, $height:expr, $dummy: expr) => ( { if $width * $height > 500000000 || $width > 50000 || $height > 50000 { panic!("rawloader: surely there's no such thing as a >500MP or >50000 px wide/tall image!"); } if $dummy { vec![0] } else { vec![0; $width * $height] } } ); } macro_rules! alloc_image { ($width:expr, $height:expr, $dummy: expr) => ( { let out = alloc_image_plain!($width, $height, $dummy); if $dummy { return out } out } ); } macro_rules! alloc_image_ok { ($width:expr, $height:expr, $dummy: expr) => ( { let out = alloc_image_plain!($width, $height, $dummy); if $dummy { return Ok(out) } out } ); } mod image; mod basics; mod packed; mod pumps; mod ljpeg; pub mod cfa; mod tiff; mod ciff; mod mrw; mod arw; mod mef; mod orf; mod srw; mod erf; mod kdc; mod dcs; mod rw2; mod raf; mod dcr; mod dng; mod pef; mod crw; mod nkd; mod mos; mod iiq; mod tfr; mod nef; mod nrw; mod cr2; mod ari; mod x3f; use self::tiff::*; pub use self::image::*; mod unwrapped; pub static CAMERAS_TOML: &'static str = include_str!(concat!(env!("OUT_DIR"), "/all.toml")); pub static SAMPLE: &'static str = "\nPlease submit samples at https://raw.pixls.us/"; pub static BUG: &'static str = "\nPlease file a bug with a sample file at https://github.com/pedrocr/rawloader/issues/new"; pub trait Decoder { fn image(&self, dummy: bool) -> Result; } /// Buffer to hold an image in memory with enough extra space at the end for speed optimizations #[derive(Debug, Clone)] pub struct Buffer { buf: Vec, size: usize, } impl Buffer { /// Creates a new buffer from anything that can be read pub fn new(reader: &mut dyn Read) -> Result { let mut buffer = Vec::new(); if let Err(err) = reader.read_to_end(&mut buffer) { return Err(format!("IOError: {}", err).to_string()) } let size = buffer.len(); buffer.extend([0;16].iter().cloned()); Ok(Buffer { buf: buffer, size: size, }) } } /// Contains sanitized information about the raw image's properties #[derive(Debug, Clone)] pub struct Camera { pub make: String, pub model: String, pub mode: String, pub clean_make: String, pub clean_model: String, pub filesize: usize, pub raw_width: usize, pub raw_height: usize, pub orientation: Orientation, whitelevels: [u16;4], blacklevels: [u16;4], blackareah: (usize, usize), blackareav: (usize, usize), xyz_to_cam: [[f32;3];4], cfa: cfa::CFA, crops: [usize;4], bps: usize, wb_offset: usize, highres_width: usize, hints: Vec, } impl Camera { pub fn find_hint(&self, hint: &str) -> bool { self.hints.contains(&(hint.to_string())) } pub fn update_from_toml(&mut self, ct: &toml::value::Table) { for (name, val) in ct { match name.as_ref() { "make" => {self.make = val.as_str().unwrap().to_string().clone();}, "model" => {self.model = val.as_str().unwrap().to_string().clone();}, "mode" => {self.mode = val.as_str().unwrap().to_string().clone();}, "clean_make" => {self.clean_make = val.as_str().unwrap().to_string().clone();}, "clean_model" => {self.clean_model = val.as_str().unwrap().to_string().clone();}, "whitepoint" => {let white = val.as_integer().unwrap() as u16; self.whitelevels = [white, white, white, white];}, "blackpoint" => {let black = val.as_integer().unwrap() as u16; self.blacklevels = [black, black, black, black];}, "blackareah" => { let vals = val.as_array().unwrap(); self.blackareah = (vals[0].as_integer().unwrap() as usize, vals[1].as_integer().unwrap() as usize); }, "blackareav" => { let vals = val.as_array().unwrap(); self.blackareav = (vals[0].as_integer().unwrap() as usize, vals[1].as_integer().unwrap() as usize); }, "color_matrix" => { let matrix = val.as_array().unwrap(); for (i, val) in matrix.into_iter().enumerate() { self.xyz_to_cam[i/3][i%3] = val.as_integer().unwrap() as f32; } }, "crops" => { let crop_vals = val.as_array().unwrap(); for (i, val) in crop_vals.into_iter().enumerate() { self.crops[i] = val.as_integer().unwrap() as usize; } }, "color_pattern" => {self.cfa = cfa::CFA::new(&val.as_str().unwrap().to_string());}, "bps" => {self.bps = val.as_integer().unwrap() as usize;}, "wb_offset" => {self.wb_offset = val.as_integer().unwrap() as usize;}, "filesize" => {self.filesize = val.as_integer().unwrap() as usize;}, "raw_width" => {self.raw_width = val.as_integer().unwrap() as usize;}, "raw_height" => {self.raw_height = val.as_integer().unwrap() as usize;}, "highres_width" => {self.highres_width = val.as_integer().unwrap() as usize;}, "hints" => { self.hints = Vec::new(); for hint in val.as_array().unwrap() { self.hints.push(hint.as_str().unwrap().to_string()); } }, _ => {}, } } } pub fn new() -> Camera { Camera { make: "".to_string(), model: "".to_string(), mode: "".to_string(), clean_make: "".to_string(), clean_model: "".to_string(), filesize: 0, raw_width: 0, raw_height: 0, whitelevels: [0;4], blacklevels: [0;4], blackareah: (0,0), blackareav: (0,0), xyz_to_cam : [[0.0;3];4], cfa: cfa::CFA::new(""), crops: [0,0,0,0], bps: 0, wb_offset: 0, highres_width: usize::max_value(), hints: Vec::new(), orientation: Orientation::Unknown, } } } /// Possible orientations of an image /// /// Values are taken from the IFD tag Orientation (0x0112) in most cases but they can be /// obtained from other metadata in the file. #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] #[allow(missing_docs)] pub enum Orientation { Normal, HorizontalFlip, Rotate180, VerticalFlip, Transpose, Rotate90, Transverse, Rotate270, Unknown, } impl Orientation { /// Convert a u16 from the IFD tag Orientation (0x0112) into its corresponding /// enum value pub fn from_u16(orientation: u16) -> Orientation { match orientation { 1 => Orientation::Normal, 2 => Orientation::HorizontalFlip, 3 => Orientation::Rotate180, 4 => Orientation::VerticalFlip, 5 => Orientation::Transpose, 6 => Orientation::Rotate90, 7 => Orientation::Transverse, 8 => Orientation::Rotate270, _ => Orientation::Unknown, } } /// Extract orienation from a TiffIFD. If the given TiffIFD has an invalid /// value or contains no orientation data `Orientation::Unknown` is returned fn from_tiff(tiff: &TiffIFD) -> Orientation { match tiff.find_entry(Tag::Orientation) { Some(entry) => Orientation::from_u16(entry.get_usize(0) as u16), None => Orientation::Unknown, } } /// Convert orientation to an image flip operation tuple. The first field is /// if x and y coordinates should be swapped (transposed). The second and /// third field is horizontal and vertical flipping respectively. For a /// correct result, flipping must be done before transposing. pub fn to_flips(&self) -> (bool, bool, bool) { match *self { Orientation::Normal | Orientation::Unknown => (false, false, false), Orientation::VerticalFlip => (false, false, true), Orientation::HorizontalFlip => (false, true, false), Orientation::Rotate180 => (false, true, true), Orientation::Transpose => (true, false, false), Orientation::Rotate90 => (true, false, true), Orientation::Rotate270 => (true, true, false), Orientation::Transverse => (true, true, true), } } /// Does the opposite of to_flips() pub fn from_flips(flips: (bool, bool, bool)) -> Self { match flips { (false, false, false) => Orientation::Normal, (false, false, true) => Orientation::VerticalFlip, (false, true, false) => Orientation::HorizontalFlip, (false, true, true) => Orientation::Rotate180, (true, false, false) => Orientation::Transpose, (true, false, true) => Orientation::Rotate90, (true, true, false) => Orientation::Rotate270, (true, true, true) => Orientation::Transverse, } } /// Convert orientation to the Tiff Orientation value pub fn to_u16(&self) -> u16 { match *self { Orientation::Unknown => 0, Orientation::Normal => 1, Orientation::HorizontalFlip => 2, Orientation::Rotate180 => 3, Orientation::VerticalFlip => 4, Orientation::Transpose => 5, Orientation::Rotate90 => 6, Orientation::Transverse => 7, Orientation::Rotate270 => 8, } } } pub fn ok_image(camera: Camera, width: usize, height: usize, wb_coeffs: [f32;4], image: Vec) -> Result { Ok(RawImage::new(camera, width, height, wb_coeffs, image, false)) } pub fn ok_image_with_blacklevels(camera: Camera, width: usize, height: usize, wb_coeffs: [f32;4], blacks: [u16;4], image: Vec) -> Result { let mut img = RawImage::new(camera, width, height, wb_coeffs, image, false); img.blacklevels = blacks; Ok(img) } pub fn ok_image_with_black_white(camera: Camera, width: usize, height: usize, wb_coeffs: [f32;4], black: u16, white: u16, image: Vec) -> Result { let mut img = RawImage::new(camera, width, height, wb_coeffs, image, false); img.blacklevels = [black, black, black, black]; img.whitelevels = [white, white, white, white]; Ok(img) } /// The struct that holds all the info about the cameras and is able to decode a file #[derive(Debug, Clone)] pub struct RawLoader { cameras: HashMap<(String,String,String),Camera>, naked: HashMap, } impl RawLoader { /// Creates a new raw loader using the camera information included in the library pub fn new() -> RawLoader { let toml = match CAMERAS_TOML.parse::() { Ok(val) => val, Err(e) => panic!("Error parsing all.toml: {:?}", e), }; let mut cams = Vec::new(); for camera in toml.get("cameras").unwrap().as_array().unwrap() { // Create a list of all the camera modes including the base one let mut cammodes = Vec::new(); let ct = camera.as_table().unwrap(); cammodes.push(ct); if let Some(val) = ct.get("modes") { for mode in val.as_array().unwrap() { cammodes.push(mode.as_table().unwrap()); } } // Start with the basic camera let mut cam = Camera::new(); cam.update_from_toml(cammodes[0]); // Create a list of alias names including the base one let mut camnames = Vec::new(); camnames.push((cam.model.clone(), cam.clean_model.clone())); if let Some(val) = ct.get("model_aliases") { for alias in val.as_array().unwrap() { camnames.push((alias[0].as_str().unwrap().to_string().clone(), alias[1].as_str().unwrap().to_string().clone())); } } // For each combination of alias and mode (including the base ones) create Camera for (model, clean_model) in camnames { for ct in cammodes.clone() { let mut mcam = cam.clone(); mcam.update_from_toml(ct); mcam.model = model.clone(); mcam.clean_model = clean_model.clone(); cams.push(mcam); } } } let mut map = HashMap::new(); let mut naked = HashMap::new(); for cam in cams { map.insert((cam.make.clone(),cam.model.clone(),cam.mode.clone()), cam.clone()); if cam.filesize > 0 { naked.insert(cam.filesize, cam); } } RawLoader{ cameras: map, naked: naked, } } /// Returns a decoder for a given buffer pub fn get_decoder<'b>(&'b self, buf: &'b Buffer) -> Result, String> { let buffer = &buf.buf; if mrw::is_mrw(buffer) { let dec = Box::new(mrw::MrwDecoder::new(buffer, &self)); return Ok(dec as Box); } if ciff::is_ciff(buffer) { let ciff = ciff::CiffIFD::new_file(buf)?; let dec = Box::new(crw::CrwDecoder::new(buffer, ciff, &self)); return Ok(dec as Box); } if ari::is_ari(buffer) { let dec = Box::new(ari::AriDecoder::new(buffer, &self)); return Ok(dec as Box); } if x3f::is_x3f(buffer) { let dec = Box::new(x3f::X3fDecoder::new(buf, &self)); return Ok(dec as Box); } if let Ok(tiff) = TiffIFD::new_file(buffer) { if tiff.has_entry(Tag::DNGVersion) { return Ok(Box::new(dng::DngDecoder::new(buffer, tiff, self))) } // The DCS560C is really a CR2 camera so we just special case it here if tiff.has_entry(Tag::Model) && fetch_tag!(tiff, Tag::Model).get_str() == "DCS560C" { return Ok(Box::new(cr2::Cr2Decoder::new(buffer, tiff, self))) } if tiff.has_entry(Tag::Make) { macro_rules! use_decoder { ($dec:ty, $buf:ident, $tiff:ident, $rawdec:ident) => (Ok(Box::new(<$dec>::new($buf, $tiff, $rawdec)) as Box)); } return match fetch_tag!(tiff, Tag::Make).get_str().to_string().as_ref() { "SONY" => use_decoder!(arw::ArwDecoder, buffer, tiff, self), "Mamiya-OP Co.,Ltd." => use_decoder!(mef::MefDecoder, buffer, tiff, self), "OLYMPUS IMAGING CORP." => use_decoder!(orf::OrfDecoder, buffer, tiff, self), "OLYMPUS CORPORATION" => use_decoder!(orf::OrfDecoder, buffer, tiff, self), "OLYMPUS OPTICAL CO.,LTD" => use_decoder!(orf::OrfDecoder, buffer, tiff, self), "SAMSUNG" => use_decoder!(srw::SrwDecoder, buffer, tiff, self), "SEIKO EPSON CORP." => use_decoder!(erf::ErfDecoder, buffer, tiff, self), "EASTMAN KODAK COMPANY" => use_decoder!(kdc::KdcDecoder, buffer, tiff, self), "Eastman Kodak Company" => use_decoder!(kdc::KdcDecoder, buffer, tiff, self), "KODAK" => use_decoder!(dcs::DcsDecoder, buffer, tiff, self), "Kodak" => use_decoder!(dcr::DcrDecoder, buffer, tiff, self), "Panasonic" => use_decoder!(rw2::Rw2Decoder, buffer, tiff, self), "LEICA" => use_decoder!(rw2::Rw2Decoder, buffer, tiff, self), "FUJIFILM" => use_decoder!(raf::RafDecoder, buffer, tiff, self), "PENTAX Corporation" => use_decoder!(pef::PefDecoder, buffer, tiff, self), "RICOH IMAGING COMPANY, LTD." => use_decoder!(pef::PefDecoder, buffer, tiff, self), "PENTAX" => use_decoder!(pef::PefDecoder, buffer, tiff, self), "Leaf" => use_decoder!(iiq::IiqDecoder, buffer, tiff, self), "Hasselblad" => use_decoder!(tfr::TfrDecoder, buffer, tiff, self), "NIKON CORPORATION" => use_decoder!(nef::NefDecoder, buffer, tiff, self), "NIKON" => use_decoder!(nrw::NrwDecoder, buffer, tiff, self), "Canon" => use_decoder!(cr2::Cr2Decoder, buffer, tiff, self), "Phase One A/S" => use_decoder!(iiq::IiqDecoder, buffer, tiff, self), make => Err(format!("Couldn't find a decoder for make \"{}\".{}", make, SAMPLE).to_string()), }; } else if tiff.has_entry(Tag::Software) { // Last ditch effort to identify Leaf cameras without Make and Model if fetch_tag!(tiff, Tag::Software).get_str() == "Camera Library" { return Ok(Box::new(mos::MosDecoder::new(buffer, tiff, self))) } } } // If all else fails see if we match by filesize to one of those CHDK style files if let Some(cam) = self.naked.get(&buf.size) { return Ok(Box::new(nkd::NakedDecoder::new(buffer, cam.clone(), self))) } Err(format!("Couldn't find a decoder for this file.{}", SAMPLE).to_string()) } fn check_supported_with_everything<'a>(&'a self, make: &str, model: &str, mode: &str) -> Result { match self.cameras.get(&(make.to_string(),model.to_string(),mode.to_string())) { Some(cam) => Ok(cam.clone()), None => Err(format!("Couldn't find camera \"{}\" \"{}\" mode \"{}\".{}", make, model, mode, SAMPLE)), } } fn check_supported_with_mode<'a>(&'a self, tiff: &'a TiffIFD, mode: &str) -> Result { let make = fetch_tag!(tiff, Tag::Make).get_str(); let model = fetch_tag!(tiff, Tag::Model).get_str(); // Get a default instance to modify let mut camera = self.check_supported_with_everything(make, model, mode)?; // Lookup the orientation of the image for later image rotation camera.orientation = Orientation::from_tiff(tiff); Ok(camera) } fn check_supported<'a>(&'a self, tiff: &'a TiffIFD) -> Result { self.check_supported_with_mode(tiff, "") } fn decode_unsafe(&self, buffer: &Buffer, dummy: bool) -> Result { let decoder = self.get_decoder(&buffer)?; decoder.image(dummy) } /// Decodes an input into a RawImage pub fn decode(&self, reader: &mut dyn Read, dummy: bool) -> Result { let buffer = Buffer::new(reader)?; match panic::catch_unwind(|| { self.decode_unsafe(&buffer, dummy) }) { Ok(val) => val, Err(_) => Err(format!("Caught a panic while decoding.{}", BUG).to_string()), } } /// Decodes a file into a RawImage pub fn decode_file(&self, path: &Path) -> Result { let file = match File::open(path) { Ok(val) => val, Err(e) => {return Err(e.to_string())}, }; let mut buffered_file = BufReader::new(file); self.decode(&mut buffered_file, false) } // Decodes an unwrapped input (just the image data with minimal metadata) into a RawImage // This is only useful for fuzzing really #[doc(hidden)] pub fn decode_unwrapped(&self, reader: &mut dyn Read) -> Result { let buffer = Buffer::new(reader)?; match panic::catch_unwind(|| { unwrapped::decode_unwrapped(&buffer) }) { Ok(val) => val, Err(_) => Err(format!("Caught a panic while decoding.{}", BUG).to_string()), } } } rawloader-0.37.1/src/decoders/mos.rs000064400000000000000000000072720072674642500154570ustar 00000000000000use std::f32::NAN; use crate::decoders::*; use crate::decoders::tiff::*; use crate::decoders::basics::*; use crate::decoders::ljpeg::*; #[derive(Debug, Clone)] pub struct MosDecoder<'a> { buffer: &'a [u8], rawloader: &'a RawLoader, tiff: TiffIFD<'a>, } impl<'a> MosDecoder<'a> { pub fn new(buf: &'a [u8], tiff: TiffIFD<'a>, rawloader: &'a RawLoader) -> MosDecoder<'a> { MosDecoder { buffer: buf, tiff: tiff, rawloader: rawloader, } } } impl<'a> Decoder for MosDecoder<'a> { fn image(&self, dummy: bool) -> Result { let make = self.xmp_tag("Make")?; let model_full = self.xmp_tag("Model")?.to_string(); let model = model_full.split_terminator("(").next().unwrap(); let camera = self.rawloader.check_supported_with_everything(&make, &model, "")?; let raw = fetch_ifd!(&self.tiff, Tag::TileOffsets); let width = fetch_tag!(raw, Tag::ImageWidth).get_usize(0); let height = fetch_tag!(raw, Tag::ImageLength).get_usize(0); let offset = fetch_tag!(raw, Tag::TileOffsets).get_usize(0); let src = &self.buffer[offset..]; let image = match fetch_tag!(raw, Tag::Compression).get_usize(0) { 1 => { if self.tiff.little_endian() { decode_16le(src, width, height, dummy) } else { decode_16be(src, width, height, dummy) } }, 7 | 99 => { self.decode_compressed(&camera, src, width, height, dummy)? }, x => return Err(format!("MOS: unsupported compression {}", x).to_string()) }; ok_image(camera, width, height, self.get_wb()?, image) } } impl<'a> MosDecoder<'a> { fn get_wb(&self) -> Result<[f32;4], String> { let meta = fetch_tag!(self.tiff, Tag::LeafMetadata).get_data(); let mut pos = 0; // We need at least 16+45+10 bytes for the NeutObj_neutrals section itself while pos + 70 < meta.len() { if meta[pos..pos+16] == b"NeutObj_neutrals"[..] { let data = &meta[pos+44..]; if let Some(endpos) = data.iter().position(|&x| x == 0) { let nums = String::from_utf8_lossy(&data[0..endpos]) .split_terminator("\n") .map(|x| x.parse::().unwrap_or(NAN)) .collect::>(); if nums.len() == 4 { return Ok([nums[0]/nums[1], nums[0]/nums[2], nums[0]/nums[3], NAN]) } } break; } pos += 1; } Ok([NAN,NAN,NAN,NAN]) } fn xmp_tag(&self, tag: &str) -> Result { let xmp = fetch_tag!(self.tiff, Tag::Xmp).get_str(); let error = format!("MOS: Couldn't find XMP tag {}", tag).to_string(); let start = xmp.find(&format!("",tag)).ok_or(error.clone())?; let end = xmp.find(&format!("",tag)).ok_or(error.clone())?; Ok(xmp[start+tag.len()+7..end].to_string()) } pub fn decode_compressed(&self, cam: &Camera, src: &[u8], width: usize, height: usize, dummy: bool) -> Result,String> { let interlaced = cam.find_hint("interlaced"); Self::do_decode(src, interlaced, width, height, dummy) } pub(crate) fn do_decode(src: &[u8], interlaced:bool, width: usize, height: usize, dummy: bool) -> Result,String> { if dummy { return Ok(vec![0]); } let decompressor = LjpegDecompressor::new_full(src, true, true)?; let ljpegout = decompressor.decode_leaf(width, height)?; if interlaced { let mut out = alloc_image_ok!(width, height, dummy); for (row,line) in ljpegout.chunks_exact(width).enumerate() { let orow = if row & 1 == 1 {height-1-row/2} else {row/2}; out[orow*width .. (orow+1)*width].copy_from_slice(line); } Ok(out) } else { Ok(ljpegout) } } } rawloader-0.37.1/src/decoders/mrw.rs000064400000000000000000000050670072674642500154660ustar 00000000000000use std::f32; use crate::decoders::*; use crate::decoders::tiff::*; use crate::decoders::basics::*; pub fn is_mrw(buf: &[u8]) -> bool { BEu32(buf,0) == 0x004D524D } #[derive(Debug, Clone)] pub struct MrwDecoder<'a> { buffer: &'a [u8], rawloader: &'a RawLoader, data_offset: usize, raw_width: usize, raw_height: usize, packed: bool, wb_vals: [u16;4], tiff: TiffIFD<'a>, } impl<'a> MrwDecoder<'a> { pub fn new(buf: &'a [u8], rawloader: &'a RawLoader) -> MrwDecoder<'a> { let data_offset: usize = (BEu32(buf, 4) + 8) as usize; let mut raw_height: usize = 0; let mut raw_width: usize = 0; let mut packed = false; let mut wb_vals: [u16;4] = [0;4]; let mut tiffpos: usize = 0; let mut currpos: usize = 8; // At most we read 20 bytes from currpos so check we don't step outside that while currpos+20 < data_offset { let tag: u32 = BEu32(buf,currpos); let len: u32 = BEu32(buf,currpos+4); match tag { 0x505244 => { // PRD raw_height = BEu16(buf,currpos+16) as usize; raw_width = BEu16(buf,currpos+18) as usize; packed = buf[currpos+24] == 12; } 0x574247 => { // WBG for i in 0..4 { wb_vals[i] = BEu16(buf, currpos+12+i*2); } } 0x545457 => { // TTW // Base value for offsets needs to be at the beginning of the // TIFF block, not the file tiffpos = currpos+8; } _ => {} } currpos += (len+8) as usize; } MrwDecoder { buffer: buf, data_offset: data_offset, raw_width: raw_width, raw_height: raw_height, packed: packed, wb_vals: wb_vals, tiff: TiffIFD::new(&buf[tiffpos..], 8, 0, 0, 0, BIG_ENDIAN).unwrap(), rawloader: rawloader, } } } impl<'a> Decoder for MrwDecoder<'a> { fn image(&self, dummy: bool) -> Result { let camera = self.rawloader.check_supported(&self.tiff)?; let src = &self.buffer[self.data_offset..]; let buffer = if self.packed { decode_12be(src, self.raw_width, self.raw_height, dummy) } else { decode_12be_unpacked(src, self.raw_width, self.raw_height, dummy) }; let wb_coeffs = if camera.find_hint("swapped_wb") { [self.wb_vals[2] as f32, self.wb_vals[0] as f32, self.wb_vals[1] as f32, f32::NAN] } else { [self.wb_vals[0] as f32, self.wb_vals[1] as f32, self.wb_vals[3] as f32, f32::NAN] }; ok_image(camera, self.raw_width, self.raw_height, wb_coeffs, buffer) } } rawloader-0.37.1/src/decoders/nef.rs000064400000000000000000000343740072674642500154340ustar 00000000000000use std::f32::NAN; use crate::decoders::*; use crate::decoders::tiff::*; use crate::decoders::basics::*; use crate::decoders::ljpeg::huffman::*; // NEF Huffman tables in order. First two are the normal huffman definitions. // Third one are weird shifts that are used in the lossy split encodings only // Values are extracted from dcraw with the shifts unmangled out. const NIKON_TREE: [[[u8;16];3];6] = [ [ // 12-bit lossy [0,0,1,5,1,1,1,1,1,1,2,0,0,0,0,0], [5,4,3,6,2,7,1,0,8,9,11,10,12,0,0,0], [0,0,0,0,0,0,0,0,0,0, 0, 0, 0,0,0,0], ], [ // 12-bit lossy after split [0,0,1,5,1,1,1,1,1,1,2,0,0,0,0,0], [6,5,5,5,5,5,4,3,2,1,0,11,12,12,0,0], [3,5,3,2,1,0,0,0,0,0, 0, 0, 0,0,0,0], ], [ // 12-bit lossless [0,0,1,4,2,3,1,2,0,0,0,0,0,0,0,0], [5,4,6,3,7,2,8,1,9,0,10,11,12,0,0,0], [0,0,0,0,0,0,0,0,0,0, 0, 0, 0,0,0,0], ], [ // 14-bit lossy [0,0,1,4,3,1,1,1,1,1,2,0,0,0,0,0], [5,6,4,7,8,3,9,2,1,0,10,11,12,13,14,0], [0,0,0,0,0,0,0,0,0,0, 0, 0, 0, 0, 0,0], ], [ // 14-bit lossy after split [0,0,1,5,1,1,1,1,1,1,1,2,0,0,0,0], [8,7,7,7,7,7,6,5,4,3,2,1,0,13,14,0], [0,5,4,3,2,0,0,0,0,0,0,0,0, 0, 0,0], ], [ // 14-bit lossless [0,0,1,4,2,2,3,1,2,0,0,0,0,0,0,0], [7,6,8,5,9,4,10,3,11,12,2,0,1,13,14,0], [0,0,0,0,0,0, 0,0, 0, 0,0,0,0, 0, 0,0], ], ]; // We use this for the D50 and D2X whacky WB "encryption" const WB_SERIALMAP: [u8;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 ]; const WB_KEYMAP: [u8;256] = [ 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 ]; #[derive(Debug, Clone)] pub struct NefDecoder<'a> { buffer: &'a [u8], rawloader: &'a RawLoader, tiff: TiffIFD<'a>, } impl<'a> NefDecoder<'a> { pub fn new(buf: &'a [u8], tiff: TiffIFD<'a>, rawloader: &'a RawLoader) -> NefDecoder<'a> { NefDecoder { buffer: buf, tiff: tiff, rawloader: rawloader, } } } impl<'a> Decoder for NefDecoder<'a> { fn image(&self, dummy: bool) -> Result { let raw = fetch_ifd!(&self.tiff, Tag::CFAPattern); let mut width = fetch_tag!(raw, Tag::ImageWidth).get_usize(0); let height = fetch_tag!(raw, Tag::ImageLength).get_usize(0); let bps = fetch_tag!(raw, Tag::BitsPerSample).get_usize(0); let compression = fetch_tag!(raw, Tag::Compression).get_usize(0); // Make sure we always use a 12/14 bit mode to get correct white/blackpoints let mode = format!("{}bit", bps).to_string(); let camera = self.rawloader.check_supported_with_mode(&self.tiff, &mode)?; let offset = fetch_tag!(raw, Tag::StripOffsets).get_usize(0); let size = fetch_tag!(raw, Tag::StripByteCounts).get_usize(0); let src = &self.buffer[offset..]; let mut cpp = 1; let coeffs = self.get_wb()?; let image = if camera.model == "NIKON D100" { width = 3040; decode_12be_wcontrol(src, width, height, dummy) } else { if compression == 1 || size == width*height*bps/8 { match bps { 14 => if self.tiff.little_endian() { decode_14le_unpacked(src, width, height, dummy) } else { decode_14be_unpacked(src, width, height, dummy) }, 12 => if self.tiff.little_endian() { decode_12le(src, width, height, dummy) } else { decode_12be(src, width, height, dummy) }, x => return Err(format!("Don't know uncompressed bps {}", x).to_string()), } } else if size == width*height*3 { cpp = 3; Self::decode_snef_compressed(src, coeffs, width, height, dummy) } else if compression == 34713 { self.decode_compressed(src, width, height, bps, dummy)? } else { return Err(format!("NEF: Don't know compression {}", compression).to_string()) } }; let mut img = RawImage::new(camera, width, height, coeffs, image, false); if cpp == 3 { img.cpp = 3; img.blacklevels = [0,0,0,0]; img.whitelevels = [65535,65535,65535,65535]; } Ok(img) } } impl<'a> NefDecoder<'a> { fn get_wb(&self) -> Result<[f32;4], String> { if let Some(levels) = self.tiff.find_entry(Tag::NefWB0) { Ok([levels.get_f32(0), 1.0, levels.get_f32(1), NAN]) } else if let Some(levels) = self.tiff.find_entry(Tag::NefWB1) { let mut version: u32 = 0; for i in 0..4 { version = (version << 4) + (levels.get_data()[i]-b'0') as u32; } match version { 0x100 => Ok([levels.get_force_u16(36) as f32, levels.get_force_u16(38) as f32, levels.get_force_u16(37) as f32, NAN]), 0x103 => Ok([levels.get_force_u16(10) as f32, levels.get_force_u16(11) as f32, levels.get_force_u16(12) as f32, NAN]), 0x204 | 0x205 => { let serial = fetch_tag!(self.tiff, Tag::NefSerial); let data = serial.get_data(); let mut serialno = 0 as usize; for i in 0..serial.count() { if data[i] == 0 { break } serialno = serialno*10 + if data[i] >= 48 && data[i] <= 57 { // "0" to "9" (data[i]-48) as usize } else { (data[i]%10) as usize }; } // Get the "decryption" key let keydata = fetch_tag!(self.tiff, Tag::NefKey).get_data(); let keyno = (keydata[0]^keydata[1]^keydata[2]^keydata[3]) as usize; let src = if version == 0x204 { &levels.get_data()[284..] } else { &levels.get_data()[4..] }; let ci = WB_SERIALMAP[serialno & 0xff] as u32; let mut cj = WB_KEYMAP[keyno & 0xff] as u32; let mut ck = 0x60 as u32; let mut buf = [0 as u8; 280]; for i in 0..280 { cj += ci * ck; ck += 1; buf[i] = src[i] ^ (cj as u8); } let off = if version == 0x204 { 6 } else { 14 }; Ok([BEu16(&buf, off) as f32, BEu16(&buf, off+2) as f32, BEu16(&buf, off+6) as f32, NAN]) }, x => Err(format!("NEF: Don't know about WB version 0x{:x}", x).to_string()), } } else { Err("NEF: Don't know how to fetch WB".to_string()) } } fn create_hufftable(num: usize) -> Result { let mut htable = HuffTable::empty(); for i in 0..15 { htable.bits[i] = NIKON_TREE[num][0][i] as u32; htable.huffval[i] = NIKON_TREE[num][1][i] as u32; htable.shiftval[i] = NIKON_TREE[num][2][i] as u32; } htable.initialize()?; Ok(htable) } fn decode_compressed(&self, src: &[u8], width: usize, height: usize, bps: usize, dummy: bool) -> Result, String> { let metaifd = fetch_ifd!(self.tiff, Tag::NefMeta1); let meta = if let Some(meta) = metaifd.find_entry(Tag::NefMeta2) {meta} else { fetch_tag!(metaifd, Tag::NefMeta1) }; Self::do_decode(src, meta.get_data(), metaifd.get_endian(), width, height, bps, dummy) } pub(crate) fn do_decode(src: &[u8], meta: &[u8], endian: Endian, width: usize, height: usize, bps: usize, dummy: bool) -> Result, String> { let mut out = alloc_image_ok!(width, height, dummy); let mut stream = ByteStream::new(meta, endian); let v0 = stream.get_u8(); let v1 = stream.get_u8(); //println!("Nef version v0:{}, v1:{}", v0, v1); let mut huff_select = 0; if v0 == 73 || v1 == 88 { stream.consume_bytes(2110); } if v0 == 70 { huff_select = 2; } if bps == 14 { huff_select += 3; } // Create the huffman table used to decode let mut htable = Self::create_hufftable(huff_select)?; // Setup the predictors let mut pred_up1: [i32;2] = [stream.get_u16() as i32, stream.get_u16() as i32]; let mut pred_up2: [i32;2] = [stream.get_u16() as i32, stream.get_u16() as i32]; // Get the linearization curve let mut points = [0 as u16; 1<<16]; for i in 0..points.len() { points[i] = i as u16; } let mut max = 1 << bps; let csize = stream.get_u16() as usize; let mut split = 0 as usize; let step = if csize > 1 { max / (csize - 1) } else { 0 }; if v0 == 68 && v1 == 32 && step > 0 { for i in 0..csize { points[i*step] = stream.get_u16(); } for i in 0..max { points[i] = ((points[i-i%step] as usize * (step - i % step) + points[i-i%step+step] as usize * (i%step)) / step) as u16; } split = endian.ru16(meta, 562) as usize; } else if v0 != 70 && csize <= 0x4001 { for i in 0..csize { points[i] = stream.get_u16(); } max = csize; } let curve = LookupTable::new(&points[0..max]); let mut pump = BitPumpMSB::new(src); let mut random = pump.peek_bits(24); let bps: u32 = bps as u32; for row in 0..height { if split > 0 && row == split { htable = Self::create_hufftable(huff_select+1)?; } pred_up1[row&1] += htable.huff_decode(&mut pump)?; pred_up2[row&1] += htable.huff_decode(&mut pump)?; let mut pred_left1 = pred_up1[row&1]; let mut pred_left2 = pred_up2[row&1]; for col in (0..width).step_by(2) { if col > 0 { pred_left1 += htable.huff_decode(&mut pump)?; pred_left2 += htable.huff_decode(&mut pump)?; } out[row*width+col+0] = curve.dither(clampbits(pred_left1,bps), &mut random); out[row*width+col+1] = curve.dither(clampbits(pred_left2,bps), &mut random); } } Ok(out) } // Decodes 12 bit data in an YUY2-like pattern (2 Luma, 1 Chroma per 2 pixels). // We un-apply the whitebalance, so output matches lossless. pub(crate) fn decode_snef_compressed(src: &[u8], coeffs: [f32; 4], width: usize, height: usize, dummy: bool) -> Vec { let inv_wb_r = (1024.0 / coeffs[0]) as i32; let inv_wb_b = (1024.0 / coeffs[2]) as i32; //println!("Got invwb {} {}", inv_wb_r, inv_wb_b); let snef_curve = { let g: f32 = 2.4; let f: f32 = 0.055; let min: f32 = 0.04045; let mul: f32 = 12.92; let curve = (0..4096).map(|i| { let v = (i as f32) / 4095.0; let res = if v <= min { v / mul } else { ((v+f)/(1.0+f)).powf(g) }; clampbits((res*65535.0*4.0) as i32, 16) }).collect::>(); LookupTable::new(&curve) }; decode_threaded(width*3, height, dummy, &(|out: &mut [u16], row| { let inb = &src[row*width*3..]; let mut random = BEu32(inb, 0); for (o, i) in out.chunks_exact_mut(6).zip(inb.chunks_exact(6)) { let g1: u16 = i[0] as u16; let g2: u16 = i[1] as u16; let g3: u16 = i[2] as u16; let g4: u16 = i[3] as u16; let g5: u16 = i[4] as u16; let g6: u16 = i[5] as u16; let y1 = (g1 | ((g2 & 0x0f) << 8)) as f32; let y2 = ((g2 >> 4) | (g3 << 4)) as f32; let cb = (g4 | ((g5 & 0x0f) << 8)) as f32 - 2048.0; let cr = ((g5 >> 4) | (g6 << 4)) as f32 - 2048.0; let r = snef_curve.dither(clampbits((y1 + 1.370705 * cr) as i32, 12), &mut random); let g = snef_curve.dither(clampbits((y1 - 0.337633 * cb - 0.698001 * cr) as i32, 12), &mut random); let b = snef_curve.dither(clampbits((y1 + 1.732446 * cb) as i32, 12), &mut random); // invert the white balance o[0] = clampbits((inv_wb_r * r as i32 + (1<<9)) >> 10, 15); o[1] = g; o[2] = clampbits((inv_wb_b * b as i32 + (1<<9)) >> 10, 15); let r = snef_curve.dither(clampbits((y2 + 1.370705 * cr) as i32, 12), &mut random); let g = snef_curve.dither(clampbits((y2 - 0.337633 * cb - 0.698001 * cr) as i32, 12), &mut random); let b = snef_curve.dither(clampbits((y2 + 1.732446 * cb) as i32, 12), &mut random); // invert the white balance o[3] = clampbits((inv_wb_r * r as i32 + (1<<9)) >> 10, 15); o[4] = g; o[5] = clampbits((inv_wb_b * b as i32 + (1<<9)) >> 10, 15); } })) } } rawloader-0.37.1/src/decoders/nkd.rs000064400000000000000000000021240072674642500154240ustar 00000000000000use crate::decoders::*; use crate::decoders::basics::*; use std::f32::NAN; //#[derive(Debug, Clone)] pub struct NakedDecoder<'a> { buffer: &'a [u8], camera: Camera, } impl<'a> NakedDecoder<'a> { pub fn new(buf: &'a [u8], cam: Camera, _rawloader: &'a RawLoader) -> NakedDecoder<'a> { NakedDecoder { buffer: buf, camera: cam, } } } impl<'a> Decoder for NakedDecoder<'a> { fn image(&self, dummy: bool) -> Result { let width = self.camera.raw_width; let height = self.camera.raw_height; let size = self.camera.filesize; let bits = size*8 / width / height; let image = if self.camera.find_hint("12le_16bitaligned") { decode_12le_16bitaligned(self.buffer, width, height, dummy) } else { match bits { 10 => decode_10le_lsb16(self.buffer, width, height, dummy), 12 => decode_12be_msb16(self.buffer, width, height, dummy), _ => return Err(format!("Naked: Don't know about {} bps images", bits).to_string()), } }; ok_image(self.camera.clone(), width, height, [NAN,NAN,NAN,NAN], image) } } rawloader-0.37.1/src/decoders/nrw.rs000064400000000000000000000045010072674642500154570ustar 00000000000000use std::f32::NAN; use crate::decoders::*; use crate::decoders::tiff::*; use crate::decoders::basics::*; #[derive(Debug, Clone)] pub struct NrwDecoder<'a> { buffer: &'a [u8], rawloader: &'a RawLoader, tiff: TiffIFD<'a>, } impl<'a> NrwDecoder<'a> { pub fn new(buf: &'a [u8], tiff: TiffIFD<'a>, rawloader: &'a RawLoader) -> NrwDecoder<'a> { NrwDecoder { buffer: buf, tiff: tiff, rawloader: rawloader, } } } impl<'a> Decoder for NrwDecoder<'a> { fn image(&self, dummy: bool) -> Result { let camera = self.rawloader.check_supported(&self.tiff)?; let data = self.tiff.find_ifds_with_tag(Tag::CFAPattern); let raw = data.iter().find(|&&ifd| { ifd.find_entry(Tag::ImageWidth).unwrap().get_u32(0) > 1000 }).unwrap(); let width = fetch_tag!(raw, Tag::ImageWidth).get_usize(0); let height = fetch_tag!(raw, Tag::ImageLength).get_usize(0); let offset = fetch_tag!(raw, Tag::StripOffsets).get_usize(0); let src = &self.buffer[offset..]; let image = if camera.find_hint("coolpixsplit") { decode_12be_interlaced_unaligned(src, width, height, dummy) } else if camera.find_hint("msb32") { decode_12be_msb32(src, width, height, dummy) } else if camera.find_hint("unpacked") { decode_16be(src, width, height, dummy) } else { decode_12be(src, width, height, dummy) }; let wb = self.get_wb(&camera)?; ok_image(camera, width, height, wb, image) } } impl<'a> NrwDecoder<'a> { fn get_wb(&self, cam: &Camera) -> Result<[f32;4], String> { if cam.find_hint("nowb") { Ok([NAN,NAN,NAN,NAN]) } else if let Some(levels) = self.tiff.find_entry(Tag::NefWB0) { Ok([levels.get_f32(0), 1.0, levels.get_f32(1), NAN]) } else if let Some(levels) = self.tiff.find_entry(Tag::NrwWB) { let data = levels.get_data(); if data[0..3] == b"NRW"[..] { let offset = if data[4..8] == b"0100"[..] { 1556 } else { 56 }; Ok([(LEu32(data, offset) << 2) as f32, (LEu32(data, offset+4) + LEu32(data, offset+8)) as f32, (LEu32(data, offset+12) << 2) as f32, NAN]) } else { Ok([BEu16(data,1248) as f32, 256.0, BEu16(data,1250) as f32, NAN]) } } else { Err("NRW: Don't know how to fetch WB".to_string()) } } } rawloader-0.37.1/src/decoders/orf.rs000064400000000000000000000141610072674642500154420ustar 00000000000000use std::f32::NAN; use std::cmp; use crate::decoders::*; use crate::decoders::tiff::*; use crate::decoders::basics::*; #[derive(Debug, Clone)] pub struct OrfDecoder<'a> { buffer: &'a [u8], rawloader: &'a RawLoader, tiff: TiffIFD<'a>, } impl<'a> OrfDecoder<'a> { pub fn new(buf: &'a [u8], tiff: TiffIFD<'a>, rawloader: &'a RawLoader) -> OrfDecoder<'a> { OrfDecoder { buffer: buf, tiff: tiff, rawloader: rawloader, } } } impl<'a> Decoder for OrfDecoder<'a> { fn image(&self, dummy: bool) -> Result { let camera = self.rawloader.check_supported(&self.tiff)?; let raw = fetch_ifd!(&self.tiff, Tag::StripOffsets); let width = fetch_tag!(raw, Tag::ImageWidth).get_usize(0); let height = fetch_tag!(raw, Tag::ImageLength).get_usize(0); let offset = fetch_tag!(raw, Tag::StripOffsets).get_usize(0); let counts = fetch_tag!(raw, Tag::StripByteCounts); let mut size: usize = 0; for i in 0..counts.count() { size += counts.get_u32(i as usize) as usize; } let camera = if width >= camera.highres_width { self.rawloader.check_supported_with_mode(&self.tiff, "highres")? } else { camera }; let src = &self.buffer[offset..]; let image = if size >= width*height*2 { if self.tiff.little_endian() { decode_12le_unpacked_left_aligned(src, width, height, dummy) } else { decode_12be_unpacked_left_aligned(src, width, height, dummy) } } else if size >= width*height/10*16 { decode_12le_wcontrol(src, width, height, dummy) } else if size >= width*height*12/8 { if width < 3500 { // The interlaced stuff is all old and smaller decode_12be_interlaced(src, width, height, dummy) } else { decode_12be_msb32(src, width, height, dummy) } } else { OrfDecoder::decode_compressed(src, width, height, dummy) }; match self.get_blacks() { Ok(val) => ok_image_with_blacklevels(camera, width, height, self.get_wb()?, val, image), Err(_) => ok_image(camera, width, height, self.get_wb()?, image), } } } impl<'a> OrfDecoder<'a> { /* This is probably the slowest decoder of them all. * I cannot see any way to effectively speed up the prediction * phase, which is by far the slowest part of this algorithm. * Also there is no way to multithread this code, since prediction * is based on the output of all previous pixel (bar the first four) */ pub fn decode_compressed(buf: &'a [u8], width: usize, height: usize, dummy: bool) -> Vec { let mut out: Vec = alloc_image!(width, height, dummy); /* Build a table to quickly look up "high" value */ let mut bittable: [u8; 4096] = [0; 4096]; for i in 0..4096 { let mut b = 12; for high in 0..12 { if ((i >> (11-high))&1) != 0 { b = high; break } } bittable[i] = b; } let mut left: [i32; 2] = [0; 2]; let mut nw: [i32; 2] = [0; 2]; let mut pump = BitPumpMSB::new(&buf[7..]); for row in 0..height { let mut acarry: [[i32; 3];2] = [[0; 3];2]; for c in 0..width/2 { let col: usize = c * 2; for s in 0..2 { // Run twice for odd and even pixels let i = if acarry[s][2] < 3 {2} else {0}; let mut nbits = 2 + i; while ((acarry[s][0] >> (nbits + i)) & 0xffff) > 0 { nbits += 1 } nbits = cmp::min(nbits, 16); let b = pump.peek_ibits(15); let sign: i32 = (b >> 14) * -1; let low: i32 = (b >> 12) & 3; let mut high: i32 = bittable[(b&4095) as usize] as i32; // Skip bytes used above or read bits if high == 12 { pump.consume_bits(15); high = pump.get_ibits(16 - nbits) >> 1; } else { pump.consume_bits((high + 4) as u32); } acarry[s][0] = ((high << nbits) | pump.get_ibits(nbits)) as i32; let diff = (acarry[s][0] ^ sign) + acarry[s][1]; acarry[s][1] = (diff * 3 + acarry[s][1]) >> 5; acarry[s][2] = if acarry[s][0] > 16 { 0 } else { acarry[s][2] + 1 }; if row < 2 || col < 2 { // We're in a border, special care is needed let pred = if row < 2 && col < 2 { // We're in the top left corner 0 } else if row < 2 { // We're going along the top border left[s] } else { // col < 2, we're at the start of a line nw[s] = out[(row-2) * width + (col+s)] as i32; nw[s] }; left[s] = pred + ((diff << 2) | low); out[row*width + (col+s)] = left[s] as u16; } else { let up: i32 = out[(row-2) * width + (col+s)] as i32; let left_minus_nw: i32 = left[s] - nw[s]; let up_minus_nw: i32 = up - nw[s]; // Check if sign is different, and one is not zero let pred = if left_minus_nw * up_minus_nw < 0 { if left_minus_nw.abs() > 32 || up_minus_nw.abs() > 32 { left[s] + up_minus_nw } else { (left[s] + up) >> 1 } } else { if left_minus_nw.abs() > up_minus_nw.abs() { left[s] } else { up } }; left[s] = pred + ((diff << 2) | low); nw[s] = up; out[row*width + (col+s)] = left[s] as u16; } } } } out } fn get_blacks(&self) -> Result<[u16;4], String> { let blacks = fetch_tag!(self.tiff, Tag::OrfBlackLevels); Ok([blacks.get_u16(0), blacks.get_u16(1), blacks.get_u16(2), blacks.get_u16(3)]) } fn get_wb(&self) -> Result<[f32;4],String> { let redmul = self.tiff.find_entry(Tag::OlympusRedMul); let bluemul = self.tiff.find_entry(Tag::OlympusBlueMul); if redmul.is_some() && bluemul.is_some() { Ok([redmul.unwrap().get_u32(0) as f32,256.0,bluemul.unwrap().get_u32(0) as f32,NAN]) } else { let ifd = self.tiff.find_ifds_with_tag(Tag::OrfBlackLevels); if ifd.len() == 0 { return Err("ORF: Couldn't find ImgProc IFD".to_string()); } let wbs = fetch_tag!(ifd[0], Tag::ImageWidth); Ok([wbs.get_f32(0), 256.0, wbs.get_f32(1),NAN]) } } } rawloader-0.37.1/src/decoders/packed.rs000064400000000000000000000240620072674642500161040ustar 00000000000000use crate::decoders::basics::*; pub fn decode_8bit_wtable(buf: &[u8], tbl: &LookupTable, width: usize, height: usize, dummy: bool) -> Vec { decode_threaded(width, height, dummy,&(|out: &mut [u16], row| { let inb = &buf[(row*width)..]; let mut random = LEu32(inb, 0); for (o, i) in out.chunks_exact_mut(1).zip(inb.chunks_exact(1)) { o[0] = tbl.dither(i[0] as u16, &mut random); } })) } pub fn decode_10le_lsb16(buf: &[u8], width: usize, height: usize, dummy: bool) -> Vec { decode_threaded(width, height, dummy,&(|out: &mut [u16], row| { let inb = &buf[(row*width*10/8)..]; for (o, i) in out.chunks_exact_mut(8).zip(inb.chunks_exact(10)) { let g1: u16 = i[0] as u16; let g2: u16 = i[1] as u16; let g3: u16 = i[2] as u16; let g4: u16 = i[3] as u16; let g5: u16 = i[4] as u16; let g6: u16 = i[5] as u16; let g7: u16 = i[6] as u16; let g8: u16 = i[7] as u16; let g9: u16 = i[8] as u16; let g10: u16 = i[9] as u16; o[0] = g2 << 2 | g1 >> 6; o[1] = (g1 & 0x3f) << 4 | g4 >> 4; o[2] = (g4 & 0x0f) << 6 | g3 >> 2; o[3] = (g3 & 0x03) << 8 | g6; o[4] = g5 << 2 | g8 >> 6; o[5] = (g8 & 0x3f) << 4 | g7 >> 4; o[6] = (g7 & 0x0f) << 6 | g10 >> 2; o[7] = (g10 & 0x03) << 8 | g9; } })) } pub fn decode_10le(buf: &[u8], width: usize, height: usize, dummy: bool) -> Vec { decode_threaded(width, height, dummy,&(|out: &mut [u16], row| { let inb = &buf[(row*width*10/8)..]; for (o, i) in out.chunks_exact_mut(4).zip(inb.chunks_exact(5)) { let g1: u16 = i[0] as u16; let g2: u16 = i[1] as u16; let g3: u16 = i[2] as u16; let g4: u16 = i[3] as u16; let g5: u16 = i[4] as u16; o[0] = g1 << 2 | g2 >> 6; o[1] = (g2 & 0x3f) << 4 | g3 >> 4; o[2] = (g3 & 0x0f) << 6 | g3 >> 2; o[3] = (g4 & 0x03) << 8 | g5; } })) } pub fn decode_12be(buf: &[u8], width: usize, height: usize, dummy: bool) -> Vec { decode_threaded(width, height, dummy,&(|out: &mut [u16], row| { let inb = &buf[(row*width*12/8)..]; for (o, i) in out.chunks_exact_mut(2).zip(inb.chunks_exact(3)) { let g1: u16 = i[0] as u16; let g2: u16 = i[1] as u16; let g3: u16 = i[2] as u16; o[0] = (g1 << 4) | (g2 >> 4); o[1] = ((g2 & 0x0f) << 8) | g3; } })) } pub fn decode_12be_msb16(buf: &[u8], width: usize, height: usize, dummy: bool) -> Vec { let mut out: Vec = alloc_image!(width, height, dummy); for (o, i) in out.chunks_exact_mut(4).zip(buf.chunks_exact(6)) { let g1: u16 = i[ 0] as u16; let g2: u16 = i[ 1] as u16; let g3: u16 = i[ 2] as u16; let g4: u16 = i[ 3] as u16; let g5: u16 = i[ 4] as u16; let g6: u16 = i[ 5] as u16; o[0] = (g2 << 4) | (g1 >> 4); o[1] = ((g1 & 0x0f) << 8) | g4; o[2] = (g3 << 4) | (g6 >> 4); o[3] = ((g6 & 0x0f) << 8) | g5; } out } pub fn decode_12le_16bitaligned(buf: &[u8], width: usize, height: usize, dummy: bool) -> Vec { let stride = ((width*12/8+1) >> 1) << 1; decode_threaded(width, height, dummy,&(|out: &mut [u16], row| { let inb = &buf[row*stride..]; for (o, i) in out.chunks_exact_mut(2).zip(inb.chunks_exact(3)) { let g1: u16 = i[ 0] as u16; let g2: u16 = i[ 1] as u16; let g3: u16 = i[ 2] as u16; o[0] = (g1 << 4) | (g2 >> 4); o[1] = (g2 & 0x0f) << 8 | g3; } })) } pub fn decode_12be_msb32(buf: &[u8], width: usize, height: usize, dummy: bool) -> Vec { let mut out: Vec = alloc_image!(width, height, dummy); for (o, i) in out.chunks_exact_mut(8).zip(buf.chunks_exact(12)) { let g1: u16 = i[ 0] as u16; let g2: u16 = i[ 1] as u16; let g3: u16 = i[ 2] as u16; let g4: u16 = i[ 3] as u16; let g5: u16 = i[ 4] as u16; let g6: u16 = i[ 5] as u16; let g7: u16 = i[ 6] as u16; let g8: u16 = i[ 7] as u16; let g9: u16 = i[ 8] as u16; let g10: u16 = i[ 9] as u16; let g11: u16 = i[10] as u16; let g12: u16 = i[11] as u16; o[0] = (g4 << 4) | (g3 >> 4); o[1] = ((g3 & 0x0f) << 8) | g2; o[2] = (g1 << 4) | (g8 >> 4); o[3] = ((g8 & 0x0f) << 8) | g7; o[4] = (g6 << 4) | (g5 >> 4); o[5] = ((g5 & 0x0f) << 8) | g12; o[6] = (g11 << 4) | (g10 >> 4); o[7] = ((g10 & 0x0f) << 8) | g9; } out } pub fn decode_12le_wcontrol(buf: &[u8], width: usize, height: usize, dummy: bool) -> Vec { // Calulate expected bytes per line. let perline = width * 12 / 8 + ((width+2) / 10); decode_threaded(width, height, dummy,&(|out: &mut [u16], row| { let inb = &buf[(row*perline)..]; for (oc, ic) in out.chunks_exact_mut(10).zip(inb.chunks_exact(16)) { for (o, i) in oc.chunks_exact_mut(2).zip(ic.chunks_exact(3)) { let g1: u16 = i[0] as u16; let g2: u16 = i[1] as u16; let g3: u16 = i[2] as u16; o[0] = ((g2 & 0x0f) << 8) | g1; o[1] = (g3 << 4) | (g2 >> 4); } } })) } pub fn decode_12be_wcontrol(buf: &[u8], width: usize, height: usize, dummy: bool) -> Vec { // Calulate expected bytes per line. let perline = width * 12 / 8 + ((width+2) / 10); decode_threaded(width, height, dummy,&(|out: &mut [u16], row| { let inb = &buf[(row*perline)..]; for (oc, ic) in out.chunks_exact_mut(10).zip(inb.chunks_exact(16)) { for (o, i) in oc.chunks_exact_mut(2).zip(ic.chunks_exact(3)) { let g1: u16 = i[0] as u16; let g2: u16 = i[1] as u16; let g3: u16 = i[2] as u16; o[0] = (g1 << 4) | (g2 >> 4); o[1] = ((g2 & 0x0f) << 8) | g3; } } })) } pub fn decode_12be_interlaced(buf: &[u8], width: usize, height: usize, dummy: bool) -> Vec { let half = (height+1) >> 1; // Second field is 2048 byte aligned let second_field_offset = ((half*width*3/2 >> 11) + 1) << 11; let second_field = &buf[second_field_offset..]; decode_threaded(width, height, dummy,&(|out: &mut [u16], row| { let off = row/2*width*12/8; let inb = if (row % 2) == 0 { &buf[off..] } else { &second_field[off..] }; for (o, i) in out.chunks_exact_mut(2).zip(inb.chunks_exact(3)) { let g1: u16 = i[0] as u16; let g2: u16 = i[1] as u16; let g3: u16 = i[2] as u16; o[0] = (g1 << 4) | (g2 >> 4); o[1] = ((g2 & 0x0f) << 8) | g3; } })) } pub fn decode_12be_interlaced_unaligned(buf: &[u8], width: usize, height: usize, dummy: bool) -> Vec { let half = (height+1) >> 1; let second_field = &buf[half*width*12/8..]; decode_threaded(width, height, dummy,&(|out: &mut [u16], row| { let off = row/2*width*12/8; let inb = if (row % 2) == 0 { &buf[off..] } else { &second_field[off..] }; for (o, i) in out.chunks_exact_mut(2).zip(inb.chunks_exact(3)) { let g1: u16 = i[0] as u16; let g2: u16 = i[1] as u16; let g3: u16 = i[2] as u16; o[0] = (g1 << 4) | (g2 >> 4); o[1] = ((g2 & 0x0f) << 8) | g3; } })) } pub fn decode_12le(buf: &[u8], width: usize, height: usize, dummy: bool) -> Vec { decode_threaded(width, height, dummy,&(|out: &mut [u16], row| { let inb = &buf[(row*width*12/8)..]; for (o, i) in out.chunks_exact_mut(2).zip(inb.chunks_exact(3)) { let g1: u16 = i[0] as u16; let g2: u16 = i[1] as u16; let g3: u16 = i[2] as u16; o[0] = ((g2 & 0x0f) << 8) | g1; o[1] = (g3 << 4) | (g2 >> 4); } })) } pub fn decode_12le_unpacked(buf: &[u8], width: usize, height: usize, dummy: bool) -> Vec { decode_threaded(width, height, dummy,&(|out: &mut [u16], row| { let inb = &buf[(row*width*2)..]; for (i, bytes) in (0..width).zip(inb.chunks_exact(2)) { out[i] = LEu16(bytes, 0) & 0x0fff; } })) } pub fn decode_12be_unpacked(buf: &[u8], width: usize, height: usize, dummy: bool) -> Vec { decode_threaded(width, height, dummy,&(|out: &mut [u16], row| { let inb = &buf[(row*width*2)..]; for (i, bytes) in (0..width).zip(inb.chunks_exact(2)) { out[i] = BEu16(bytes, 0) & 0x0fff; } })) } pub fn decode_12be_unpacked_left_aligned(buf: &[u8], width: usize, height: usize, dummy: bool) -> Vec { decode_threaded(width, height, dummy,&(|out: &mut [u16], row| { let inb = &buf[(row*width*2)..]; for (i, bytes) in (0..width).zip(inb.chunks_exact(2)) { out[i] = BEu16(bytes, 0) >> 4; } })) } pub fn decode_12le_unpacked_left_aligned(buf: &[u8], width: usize, height: usize, dummy: bool) -> Vec { decode_threaded(width, height, dummy,&(|out: &mut [u16], row| { let inb = &buf[(row*width*2)..]; for (i, bytes) in (0..width).zip(inb.chunks_exact(2)) { out[i] = LEu16(bytes, 0) >> 4; } })) } pub fn decode_14le_unpacked(buf: &[u8], width: usize, height: usize, dummy: bool) -> Vec { decode_threaded(width, height, dummy,&(|out: &mut [u16], row| { let inb = &buf[(row*width*2)..]; for (i, bytes) in (0..width).zip(inb.chunks_exact(2)) { out[i] = LEu16(bytes, 0) & 0x3fff; } })) } pub fn decode_14be_unpacked(buf: &[u8], width: usize, height: usize, dummy: bool) -> Vec { decode_threaded(width, height, dummy,&(|out: &mut [u16], row| { let inb = &buf[(row*width*2)..]; for (i, bytes) in (0..width).zip(inb.chunks_exact(2)) { out[i] = BEu16(bytes, 0) & 0x3fff; } })) } pub fn decode_16le(buf: &[u8], width: usize, height: usize, dummy: bool) -> Vec { decode_threaded(width, height, dummy,&(|out: &mut [u16], row| { let inb = &buf[(row*width*2)..]; for (i, bytes) in (0..width).zip(inb.chunks_exact(2)) { out[i] = LEu16(bytes, 0); } })) } pub fn decode_16le_skiplines(buf: &[u8], width: usize, height: usize, dummy: bool) -> Vec { decode_threaded(width, height, dummy,&(|out: &mut [u16], row| { let inb = &buf[(row*width*4)..]; for (i, bytes) in (0..width).zip(inb.chunks_exact(2)) { out[i] = LEu16(bytes, 0); } })) } pub fn decode_16be(buf: &[u8], width: usize, height: usize, dummy: bool) -> Vec { decode_threaded(width, height, dummy,&(|out: &mut [u16], row| { let inb = &buf[(row*width*2)..]; for (i, bytes) in (0..width).zip(inb.chunks_exact(2)) { out[i] = BEu16(bytes, 0); } })) } rawloader-0.37.1/src/decoders/pef.rs000064400000000000000000000113350072674642500154260ustar 00000000000000use std::f32::NAN; use crate::decoders::*; use crate::decoders::tiff::*; use crate::decoders::basics::*; use crate::decoders::ljpeg::huffman::*; #[derive(Debug, Clone)] pub struct PefDecoder<'a> { buffer: &'a [u8], rawloader: &'a RawLoader, tiff: TiffIFD<'a>, } impl<'a> PefDecoder<'a> { pub fn new(buf: &'a [u8], tiff: TiffIFD<'a>, rawloader: &'a RawLoader) -> PefDecoder<'a> { PefDecoder { buffer: buf, tiff: tiff, rawloader: rawloader, } } } impl<'a> Decoder for PefDecoder<'a> { fn image(&self, dummy: bool) -> Result { let camera = self.rawloader.check_supported(&self.tiff)?; let raw = fetch_ifd!(&self.tiff, Tag::StripOffsets); let width = fetch_tag!(raw, Tag::ImageWidth).get_usize(0); let height = fetch_tag!(raw, Tag::ImageLength).get_usize(0); let offset = fetch_tag!(raw, Tag::StripOffsets).get_usize(0); let src = &self.buffer[offset..]; let image = match fetch_tag!(raw, Tag::Compression).get_u32(0) { 1 => decode_16be(src, width, height, dummy), 32773 => decode_12be(src, width, height, dummy), 65535 => self.decode_compressed(src, width, height, dummy)?, c => return Err(format!("PEF: Don't know how to read compression {}", c).to_string()), }; let blacklevels = self.get_blacklevels().unwrap_or(camera.blacklevels); ok_image_with_blacklevels(camera, width, height, self.get_wb()?, blacklevels, image) } } impl<'a> PefDecoder<'a> { fn get_wb(&self) -> Result<[f32;4], String> { let levels = fetch_tag!(self.tiff, Tag::PefWB); Ok([levels.get_f32(0), levels.get_f32(1), levels.get_f32(3), NAN]) } fn get_blacklevels(&self) -> Option<[u16;4]> { match self.tiff.find_entry(Tag::PefBlackLevels) { Some(levels) => { Some([levels.get_f32(0) as u16,levels.get_f32(1) as u16, levels.get_f32(2) as u16,levels.get_f32(3) as u16]) }, None => None, } } fn decode_compressed(&self, src: &[u8], width: usize, height: usize, dummy: bool) -> Result,String> { if let Some(huff) = self.tiff.find_entry(Tag::PefHuffman) { Self::do_decode(src, Some((huff.get_data(), self.tiff.get_endian())), width, height, dummy) } else { Self::do_decode(src, None, width, height, dummy) } } pub(crate) fn do_decode(src: &[u8], huff: Option<(&[u8], Endian)>, width: usize, height: usize, dummy: bool) -> Result,String> { let mut out = alloc_image_ok!(width, height, dummy); let mut htable = HuffTable::empty(); /* Attempt to read huffman table, if found in makernote */ if let Some((huff, endian)) = huff { let mut stream = ByteStream::new(huff, endian); let depth: usize = (stream.get_u16() as usize + 12) & 0xf; stream.consume_bytes(12); let mut v0: [u32;16] = [0;16]; for i in 0..depth { v0[i] = stream.get_u16() as u32; } let mut v1: [u32;16] = [0;16]; for i in 0..depth { v1[i] = stream.get_u8() as u32; } // Calculate codes and store bitcounts let mut v2: [u32;16] = [0;16]; for c in 0..depth { v2[c] = v0[c] >> (12 - v1[c]); htable.bits[v1[c] as usize] += 1; } // Find smallest for i in 0..depth { let mut sm_val: u32 = 0xfffffff; let mut sm_num: u32 = 0xff; for j in 0..depth { if v2[j] <= sm_val { sm_num = j as u32; sm_val = v2[j]; } } htable.huffval[i] = sm_num; v2[sm_num as usize]=0xffffffff; } } else { // Initialize with legacy data let pentax_tree: [u8; 29] = [ 0, 2, 3, 1, 1, 1, 1, 1, 1, 2, 0, 0, 0, 0, 0, 0, 3, 4, 2, 5, 1, 6, 0, 7, 8, 9, 10, 11, 12 ]; let mut acc: usize = 0; for i in 0..16 { htable.bits[i+1] = pentax_tree[i] as u32; acc += htable.bits[i+1] as usize; } for i in 0..acc { htable.huffval[i] = pentax_tree[i+16] as u32; } } htable.initialize()?; let mut pump = BitPumpMSB::new(src); let mut pred_up1: [i32;2] = [0, 0]; let mut pred_up2: [i32;2] = [0, 0]; let mut pred_left1: i32; let mut pred_left2: i32; for row in 0..height { pred_up1[row & 1] += htable.huff_decode(&mut pump)?; pred_up2[row & 1] += htable.huff_decode(&mut pump)?; pred_left1 = pred_up1[row & 1]; pred_left2 = pred_up2[row & 1]; out[row*width+0] = pred_left1 as u16; out[row*width+1] = pred_left2 as u16; for col in (2..width).step_by(2) { pred_left1 += htable.huff_decode(&mut pump)?; pred_left2 += htable.huff_decode(&mut pump)?; out[row*width+col+0] = pred_left1 as u16; out[row*width+col+1] = pred_left2 as u16; } } Ok(out) } } rawloader-0.37.1/src/decoders/pumps.rs000064400000000000000000000150610072674642500160200ustar 00000000000000use crate::decoders::basics::*; #[derive(Debug, Copy, Clone)] pub struct BitPumpLSB<'a> { buffer: &'a [u8], pos: usize, bits: u64, nbits: u32, } impl<'a> BitPumpLSB<'a> { pub fn new(src: &'a [u8]) -> BitPumpLSB { BitPumpLSB { buffer: src, pos: 0, bits: 0, nbits: 0, } } } #[derive(Debug, Copy, Clone)] pub struct BitPumpMSB<'a> { buffer: &'a [u8], pos: usize, bits: u64, nbits: u32, } impl<'a> BitPumpMSB<'a> { pub fn new(src: &'a [u8]) -> BitPumpMSB { BitPumpMSB { buffer: src, pos: 0, bits: 0, nbits: 0, } } } #[derive(Debug, Copy, Clone)] pub struct BitPumpMSB32<'a> { buffer: &'a [u8], pos: usize, bits: u64, nbits: u32, } impl<'a> BitPumpMSB32<'a> { pub fn new(src: &'a [u8]) -> BitPumpMSB32 { BitPumpMSB32 { buffer: src, pos: 0, bits: 0, nbits: 0, } } #[inline(always)] pub fn get_pos(&self) -> usize { self.pos - ((self.nbits >> 3) as usize) } } #[derive(Debug, Copy, Clone)] pub struct BitPumpJPEG<'a> { buffer: &'a [u8], pos: usize, bits: u64, nbits: u32, finished: bool, } impl<'a> BitPumpJPEG<'a> { pub fn new(src: &'a [u8]) -> BitPumpJPEG { BitPumpJPEG { buffer: src, pos: 0, bits: 0, nbits: 0, finished: false, } } } pub trait BitPump { fn peek_bits(&mut self, num: u32) -> u32; fn consume_bits(&mut self, num: u32); #[inline(always)] fn get_bits(&mut self, num: u32) -> u32 { if num == 0 { return 0 } let val = self.peek_bits(num); self.consume_bits(num); val } #[inline(always)] fn peek_ibits(&mut self, num: u32) -> i32 { self.peek_bits(num) as i32 } #[inline(always)] fn get_ibits(&mut self, num: u32) -> i32 { self.get_bits(num) as i32 } // Sign extend ibits #[inline(always)] fn get_ibits_sextended(&mut self, num: u32) -> i32 { let val = self.get_ibits(num); val.wrapping_shl(32 - num).wrapping_shr(32 - num) } } impl<'a> BitPump for BitPumpLSB<'a> { #[inline(always)] fn peek_bits(&mut self, num: u32) -> u32 { if num > self.nbits { let inbits: u64 = LEu32(self.buffer, self.pos) as u64; self.bits = ((inbits << 32) | (self.bits << (32-self.nbits))) >> (32-self.nbits); self.pos += 4; self.nbits += 32; } (self.bits & (0x0ffffffffu64 >> (32-num))) as u32 } #[inline(always)] fn consume_bits(&mut self, num: u32) { self.nbits -= num; self.bits >>= num; } } impl<'a> BitPump for BitPumpMSB<'a> { #[inline(always)] fn peek_bits(&mut self, num: u32) -> u32 { if num > self.nbits { let inbits: u64 = BEu32(self.buffer, self.pos) as u64; self.bits = (self.bits << 32) | inbits; self.pos += 4; self.nbits += 32; } (self.bits >> (self.nbits-num)) as u32 } #[inline(always)] fn consume_bits(&mut self, num: u32) { self.nbits -= num; self.bits &= (1 << self.nbits) - 1; } } impl<'a> BitPump for BitPumpMSB32<'a> { #[inline(always)] fn peek_bits(&mut self, num: u32) -> u32 { if num > self.nbits { let inbits: u64 = LEu32(self.buffer, self.pos) as u64; self.bits = (self.bits << 32) | inbits; self.pos += 4; self.nbits += 32; } (self.bits >> (self.nbits-num)) as u32 } #[inline(always)] fn consume_bits(&mut self, num: u32) { self.nbits -= num; self.bits &= (1 << self.nbits) - 1; } } impl<'a> BitPump for BitPumpJPEG<'a> { #[inline(always)] fn peek_bits(&mut self, num: u32) -> u32 { if num > self.nbits && !self.finished { if self.pos < self.buffer.len()-4 && self.buffer[self.pos+0] != 0xff && self.buffer[self.pos+1] != 0xff && self.buffer[self.pos+2] != 0xff && self.buffer[self.pos+3] != 0xff { let inbits: u64 = BEu32(self.buffer, self.pos) as u64; self.bits = (self.bits << 32) | inbits; self.pos += 4; self.nbits += 32; } else { // Read 32 bits the hard way let mut read_bytes = 0; while read_bytes < 4 && !self.finished { let byte = { if self.pos >= self.buffer.len() { self.finished = true; 0 } else { let nextbyte = self.buffer[self.pos]; if nextbyte != 0xff { nextbyte } else if self.buffer[self.pos+1] == 0x00 { self.pos += 1; // Skip the extra byte used to mark 255 nextbyte } else { self.finished = true; 0 } } }; self.bits = (self.bits << 8) | (byte as u64); self.pos += 1; self.nbits += 8; read_bytes += 1; } } } if num > self.nbits && self.finished { // Stuff with zeroes to not fail to read self.bits <<= 32; self.nbits += 32; } (self.bits >> (self.nbits-num)) as u32 } #[inline(always)] fn consume_bits(&mut self, num: u32) { self.nbits -= num; self.bits &= (1 << self.nbits) - 1; } } #[derive(Debug, Copy, Clone)] pub struct ByteStream<'a> { buffer: &'a [u8], pos: usize, endian: Endian, } impl<'a> ByteStream<'a> { pub fn new(src: &'a [u8], endian: Endian) -> ByteStream { ByteStream { buffer: src, pos: 0, endian: endian, } } #[inline(always)] pub fn get_pos(&self) -> usize { self.pos } #[inline(always)] pub fn peek_u8(&self) -> u8 { self.buffer[self.pos] } #[inline(always)] pub fn get_u8(&mut self) -> u8 { let val = self.peek_u8(); self.pos += 1; val } #[inline(always)] pub fn peek_u16(&self) -> u16 { self.endian.ru16(self.buffer, self.pos) } #[inline(always)] pub fn get_u16(&mut self) -> u16 { let val = self.peek_u16(); self.pos += 2; val } // #[inline(always)] // pub fn peek_u32(&self) -> u32 { self.endian.ru32(self.buffer, self.pos) } // #[inline(always)] // pub fn get_u32(&mut self) -> u32 { // let val = self.peek_u32(); // self.pos += 4; // val // } #[inline(always)] pub fn consume_bytes(&mut self, num: usize) { self.pos += num } #[inline(always)] pub fn skip_to_marker(&mut self) -> Result { let mut skip_count = 0; while !(self.buffer[self.pos] == 0xFF && self.buffer[self.pos+1] != 0 && self.buffer[self.pos+1] != 0xFF) { self.pos += 1; skip_count += 1; if self.pos >= self.buffer.len() { return Err("No marker found inside rest of buffer".to_string()) } } self.pos += 1; // Make the next byte the marker Ok(skip_count+1) } } rawloader-0.37.1/src/decoders/raf.rs000064400000000000000000000115340072674642500154250ustar 00000000000000use std::f32::NAN; use crate::decoders::*; use crate::decoders::tiff::*; use crate::decoders::basics::*; #[derive(Debug, Clone)] pub struct RafDecoder<'a> { buffer: &'a [u8], rawloader: &'a RawLoader, tiff: TiffIFD<'a>, } impl<'a> RafDecoder<'a> { pub fn new(buf: &'a [u8], tiff: TiffIFD<'a>, rawloader: &'a RawLoader) -> RafDecoder<'a> { RafDecoder { buffer: buf, tiff: tiff, rawloader: rawloader, } } } impl<'a> Decoder for RafDecoder<'a> { fn image(&self, dummy: bool) -> Result { let camera = self.rawloader.check_supported(&self.tiff)?; let raw = fetch_ifd!(&self.tiff, Tag::RafOffsets); let (width,height) = if raw.has_entry(Tag::RafImageWidth) { (fetch_tag!(raw, Tag::RafImageWidth).get_usize(0), fetch_tag!(raw, Tag::RafImageLength).get_usize(0)) } else { let sizes = fetch_tag!(raw, Tag::ImageWidth); (sizes.get_usize(1), sizes.get_usize(0)) }; let offset = fetch_tag!(raw, Tag::RafOffsets).get_usize(0) + raw.start_offset(); let bps = match raw.find_entry(Tag::RafBitsPerSample) { Some(val) => val.get_u32(0) as usize, None => 16, }; let src = &self.buffer[offset..]; let image = if camera.find_hint("double_width") { // Some fuji SuperCCD cameras include a second raw image next to the first one // that is identical but darker to the first. The two combined can produce // a higher dynamic range image. Right now we're ignoring it. decode_16le_skiplines(src, width, height, dummy) } else if camera.find_hint("jpeg32") { decode_12be_msb32(src, width, height, dummy) } else { if src.len() < bps*width*height/8 { return Err("RAF: Don't know how to decode compressed yet".to_string()) } match bps { 12 => decode_12le(src, width, height, dummy), 14 => decode_14le_unpacked(src, width, height, dummy), 16 => { if self.tiff.little_endian() { decode_16le(src, width, height, dummy) } else { decode_16be(src, width, height, dummy) } }, _ => {return Err(format!("RAF: Don't know how to decode bps {}", bps).to_string());}, } }; if camera.find_hint("fuji_rotation") || camera.find_hint("fuji_rotation_alt") { let (width, height, image) = RafDecoder::rotate_image(&image, &camera, width, height, dummy); Ok(RawImage { make: camera.make.clone(), model: camera.model.clone(), clean_make: camera.clean_make.clone(), clean_model: camera.clean_model.clone(), width: width, height: height, cpp: 1, wb_coeffs: self.get_wb()?, data: RawImageData::Integer(image), blacklevels: camera.blacklevels, whitelevels: camera.whitelevels, xyz_to_cam: camera.xyz_to_cam, cfa: camera.cfa.clone(), crops: [0,0,0,0], blackareas: Vec::new(), orientation: camera.orientation, }) } else { ok_image(camera, width, height, self.get_wb()?, image) } } } impl<'a> RafDecoder<'a> { fn get_wb(&self) -> Result<[f32;4], String> { match self.tiff.find_entry(Tag::RafWBGRB) { Some(levels) => Ok([levels.get_f32(1), levels.get_f32(0), levels.get_f32(2), NAN]), None => { let levels = fetch_tag!(self.tiff, Tag::RafOldWB); Ok([levels.get_f32(1), levels.get_f32(0), levels.get_f32(3), NAN]) }, } } fn rotate_image(src: &[u16], camera: &Camera, width: usize, height: usize, dummy: bool) -> (usize, usize, Vec) { let x = camera.crops[3]; let y = camera.crops[0]; let cropwidth = width - camera.crops[1] - x; let cropheight = height - camera.crops[2] - y; if camera.find_hint("fuji_rotation_alt") { let rotatedwidth = cropheight + cropwidth/2; let rotatedheight = rotatedwidth-1; let mut out: Vec = alloc_image_plain!(rotatedwidth, rotatedheight, dummy); if !dummy { for row in 0..cropheight { let inb = &src[(row+y)*width+x..]; for col in 0..cropwidth { let out_row = rotatedwidth - (cropheight + 1 - row + (col >> 1)); let out_col = ((col+1) >> 1) + row; out[out_row*rotatedwidth+out_col] = inb[col]; } } } (rotatedwidth, rotatedheight, out) } else { let rotatedwidth = cropwidth + cropheight/2; let rotatedheight = rotatedwidth-1; let mut out: Vec = alloc_image_plain!(rotatedwidth, rotatedheight, dummy); if !dummy { for row in 0..cropheight { let inb = &src[(row+y)*width+x..]; for col in 0..cropwidth { let out_row = cropwidth - 1 - col + (row>>1); let out_col = ((row+1) >> 1) + col; out[out_row*rotatedwidth+out_col] = inb[col]; } } } (rotatedwidth, rotatedheight, out) } } } rawloader-0.37.1/src/decoders/rw2.rs000064400000000000000000000115430072674642500153670ustar 00000000000000use std::f32::NAN; use crate::decoders::*; use crate::decoders::tiff::*; use crate::decoders::basics::*; #[derive(Debug, Clone)] pub struct Rw2Decoder<'a> { buffer: &'a [u8], rawloader: &'a RawLoader, tiff: TiffIFD<'a>, } impl<'a> Rw2Decoder<'a> { pub fn new(buf: &'a [u8], tiff: TiffIFD<'a>, rawloader: &'a RawLoader) -> Rw2Decoder<'a> { Rw2Decoder { buffer: buf, tiff: tiff, rawloader: rawloader, } } } impl<'a> Decoder for Rw2Decoder<'a> { fn image(&self, dummy: bool) -> Result { let width: usize; let height: usize; let image = { let data = self.tiff.find_ifds_with_tag(Tag::PanaOffsets); if data.len() > 0 { let raw = data[0]; width = fetch_tag!(raw, Tag::PanaWidth).get_usize(0); height = fetch_tag!(raw, Tag::PanaLength).get_usize(0); let offset = fetch_tag!(raw, Tag::PanaOffsets).get_usize(0); let src = &self.buffer[offset..]; Rw2Decoder::decode_panasonic(src, width, height, true, dummy) } else { let raw = fetch_ifd!(&self.tiff, Tag::StripOffsets); width = fetch_tag!(raw, Tag::PanaWidth).get_usize(0); height = fetch_tag!(raw, Tag::PanaLength).get_usize(0); let offset = fetch_tag!(raw, Tag::StripOffsets).get_usize(0); let src = &self.buffer[offset..]; if src.len() >= width*height*2 { decode_12le_unpacked_left_aligned(src, width, height, dummy) } else if src.len() >= width*height*3/2 { decode_12le_wcontrol(src, width, height, dummy) } else { Rw2Decoder::decode_panasonic(src, width, height, false, dummy) } } }; let mode = { let ratio = width*100/height; if ratio < 125 { "1:1" } else if ratio < 145 { "4:3" } else if ratio < 165 { "3:2" } else { "16:9" } }; let camera = self.rawloader.check_supported_with_mode(&self.tiff, mode)?; ok_image(camera, width, height, self.get_wb()?, image) } } impl<'a> Rw2Decoder<'a> { fn get_wb(&self) -> Result<[f32;4], String> { if self.tiff.has_entry(Tag::PanaWBsR) && self.tiff.has_entry(Tag::PanaWBsB) { let r = fetch_tag!(self.tiff, Tag::PanaWBsR).get_u32(0) as f32; let b = fetch_tag!(self.tiff, Tag::PanaWBsB).get_u32(0) as f32; Ok([r, 256.0, b, NAN]) } else if self.tiff.has_entry(Tag::PanaWBs2R) && self.tiff.has_entry(Tag::PanaWBs2G) && self.tiff.has_entry(Tag::PanaWBs2B) { let r = fetch_tag!(self.tiff, Tag::PanaWBs2R).get_u32(0) as f32; let g = fetch_tag!(self.tiff, Tag::PanaWBs2G).get_u32(0) as f32; let b = fetch_tag!(self.tiff, Tag::PanaWBs2B).get_u32(0) as f32; Ok([r, g, b, NAN]) } else { Err("Couldn't find WB".to_string()) } } pub(crate) fn decode_panasonic(buf: &[u8], width: usize, height: usize, split: bool, dummy: bool) -> Vec { decode_threaded_multiline(width, height, 5, dummy, &(|out: &mut [u16], row| { let skip = ((width * row * 9) + (width/14 * 2 * row)) / 8; let blocks = skip / 0x4000; let src = &buf[blocks*0x4000..]; let mut pump = BitPumpPanasonic::new(src, split); for _ in 0..(skip % 0x4000) { pump.get_bits(8); } let mut sh: i32 = 0; for out in out.chunks_exact_mut(14) { let mut pred: [i32;2] = [0,0]; let mut nonz: [i32;2] = [0,0]; for i in 0..14 { if (i % 3) == 2 { sh = 4 >> (3 - pump.get_bits(2)); } if nonz[i & 1] != 0 { let j = pump.get_bits(8) as i32; if j != 0 { pred[i & 1] -= 0x80 << sh; if pred[i & 1] < 0 || sh == 4 { pred[i & 1] &= !(-1 << sh); } pred[i & 1] += j << sh; } } else { nonz[i & 1] = pump.get_bits(8) as i32; if nonz[i & 1] != 0 || i > 11 { pred[i & 1] = nonz[i & 1] << 4 | (pump.get_bits(4) as i32); } } out[i] = pred[i & 1] as u16; } } })) } } pub struct BitPumpPanasonic<'a> { buffer: &'a [u8], pos: usize, nbits: u32, split: bool, } impl<'a> BitPumpPanasonic<'a> { pub fn new(src: &'a [u8], split: bool) -> BitPumpPanasonic { BitPumpPanasonic { buffer: src, pos: 0, nbits: 0, split: split, } } } impl<'a> BitPump for BitPumpPanasonic<'a> { fn peek_bits(&mut self, num: u32) -> u32 { if num > self.nbits { self.nbits += 0x4000 * 8; self.pos += 0x4000; } let mut byte = (self.nbits-num) >> 3 ^ 0x3ff0; if self.split { byte = (byte + 0x4000 - 0x2008) % 0x4000; } let bits = LEu16(self.buffer, byte as usize + self.pos - 0x4000) as u32; (bits >> ((self.nbits-num) & 7)) & (0x0ffffffffu32 >> (32-num)) } fn consume_bits(&mut self, num: u32) { self.nbits -= num; } } rawloader-0.37.1/src/decoders/srw.rs000064400000000000000000000351760072674642500155000ustar 00000000000000use std::f32::NAN; use std::cmp; use crate::decoders::*; use crate::decoders::tiff::*; use crate::decoders::basics::*; #[derive(Debug, Clone)] pub struct SrwDecoder<'a> { buffer: &'a [u8], rawloader: &'a RawLoader, tiff: TiffIFD<'a>, } impl<'a> SrwDecoder<'a> { pub fn new(buf: &'a [u8], tiff: TiffIFD<'a>, rawloader: &'a RawLoader) -> SrwDecoder<'a> { SrwDecoder { buffer: buf, tiff: tiff, rawloader: rawloader, } } } impl<'a> Decoder for SrwDecoder<'a> { fn image(&self, dummy: bool) -> Result { let camera = self.rawloader.check_supported(&self.tiff)?; let raw = fetch_ifd!(&self.tiff, Tag::StripOffsets); let width = fetch_tag!(raw, Tag::ImageWidth).get_usize(0); let height = fetch_tag!(raw, Tag::ImageLength).get_usize(0); let offset = fetch_tag!(raw, Tag::StripOffsets).get_usize(0); let compression = fetch_tag!(raw, Tag::Compression).get_u32(0); let bits = fetch_tag!(raw, Tag::BitsPerSample).get_u32(0); let src = &self.buffer[offset..]; let image = match compression { 32769 => match bits { 12 => decode_12le_unpacked(src, width, height, dummy), 14 => decode_14le_unpacked(src, width, height, dummy), x => return Err(format!("SRW: Don't know how to handle bps {}", x).to_string()), }, 32770 => { match raw.find_entry(Tag::SrwSensorAreas) { None => match bits { 12 => { if camera.find_hint("little_endian") { decode_12le(src, width, height, dummy) } else { decode_12be(src, width, height, dummy) } }, 14 => decode_14le_unpacked(src, width, height, dummy), x => return Err(format!("SRW: Don't know how to handle bps {}", x).to_string()), }, Some(x) => { let coffset = x.get_usize(0); let loffsets = &self.buffer[coffset..]; SrwDecoder::decode_srw1(src, loffsets, width, height, dummy) } } } 32772 => { SrwDecoder::decode_srw2(src, width, height, dummy) } 32773 => { SrwDecoder::decode_srw3(src, width, height, dummy) } x => return Err(format!("SRW: Don't know how to handle compression {}", x).to_string()), }; ok_image(camera, width, height, self.get_wb()?, image) } } impl<'a> SrwDecoder<'a> { pub fn decode_srw1(buf: &[u8], loffsets: &[u8], width: usize, height: usize, dummy: bool) -> Vec { let mut out: Vec = alloc_image!(width, height, dummy); for row in 0..height { let mut len: [u32; 4] = [if row < 2 {7} else {4}; 4]; let loffset = LEu32(loffsets, row*4) as usize; let mut pump = BitPumpMSB32::new(&buf[loffset..]); let img = width*row; let img_up = width*(cmp::max(1, row)-1); let img_up2 = width*(cmp::max(2, row)-2); // Image is arranged in groups of 16 pixels horizontally for col in (0..width).step_by(16) { let dir = pump.get_bits(1) == 1; let ops = [pump.get_bits(2), pump.get_bits(2), pump.get_bits(2), pump.get_bits(2)]; for (i, op) in ops.iter().enumerate() { match *op { 3 => {len[i] = pump.get_bits(4);}, 2 => {len[i] -= 1;}, 1 => {len[i] += 1;}, _ => {}, } } // First decode even pixels for c in (0..16).step_by(2) { let l = len[(c >> 3)]; let adj = pump.get_ibits_sextended(l); let predictor = if dir { // Upward prediction out[img_up+col+c] } else { // Left to right prediction if col == 0 { 128 } else { out[img+col-2] } }; if col+c < width { // No point in decoding pixels outside the image out[img+col+c] = ((predictor as i32) + adj) as u16; } } // Now decode odd pixels for c in (1..16).step_by(2) { let l = len[2 | (c >> 3)]; let adj = pump.get_ibits_sextended(l); let predictor = if dir { // Upward prediction out[img_up2+col+c] } else { // Left to right prediction if col == 0 { 128 } else { out[img+col-1] } }; if col+c < width { // No point in decoding pixels outside the image out[img+col+c] = ((predictor as i32) + adj) as u16; } } } } // SRW1 apparently has red and blue swapped, just changing the CFA pattern to // match causes color fringing in high contrast areas because the actual pixel // locations would not match the CFA pattern for row in (0..height).step_by(2) { for col in (0..width).step_by(2) { out.swap(row*width+col+1, (row+1)*width+col); } } out } pub fn decode_srw2(buf: &[u8], width: usize, height: usize, dummy: bool) -> Vec { let mut out: Vec = alloc_image!(width, height, dummy); // This format has a variable length encoding of how many bits are needed // to encode the difference between pixels, we use a table to process it // that has two values, the first the number of bits that were used to // encode, the second the number of bits that come after with the difference // The table has 14 entries because the difference can have between 0 (no // difference) and 13 bits (differences between 12 bits numbers can need 13) let tab: [[u32;2];14] = [[3,4], [3,7], [2,6], [2,5], [4,3], [6,0], [7,9], [8,10], [9,11], [10,12], [10,13], [5,1], [4,8], [4,2]]; // We generate a 1024 entry table (to be addressed by reading 10 bits) by // consecutively filling in 2^(10-N) positions where N is the variable number of // bits of the encoding. So for example 4 is encoded with 3 bits so the first // 2^(10-3)=128 positions are set with 3,4 so that any time we read 000 we // know the next 4 bits are the difference. We read 10 bits because that is // the maximum number of bits used in the variable encoding (for the 12 and // 13 cases) let mut tbl: [[u32;2];1024] = [[0,0];1024]; let mut n: usize = 0; for i in 0..14 { let mut c = 0; while c < (1024 >> tab[i][0]) { tbl[n][0] = tab[i][0]; tbl[n][1] = tab[i][1]; n += 1; c += 1; } } let mut vpred: [[i32;2];2] = [[0,0],[0,0]]; let mut hpred: [i32;2] = [0,0]; let mut pump = BitPumpMSB::new(buf); for row in 0..height { for col in 0..width { let diff = SrwDecoder::srw2_diff(&mut pump, &tbl); if col < 2 { vpred[row & 1][col] += diff; hpred[col] = vpred[row & 1][col]; } else { hpred[col & 1] += diff; } out[row*width+col] = hpred[col & 1] as u16; } } out } pub fn srw2_diff(pump: &mut BitPumpMSB, tbl: &[[u32;2];1024]) -> i32{ // We read 10 bits to index into our table let c = pump.peek_bits(10); // Skip the bits that were used to encode this case pump.consume_bits(tbl[c as usize][0]); // Read the number of bits the table tells me let len = tbl[c as usize][1]; let mut diff = pump.get_bits(len) as i32; // If the first bit is 0 we need to turn this into a negative number if len != 0 && (diff & (1 << (len-1))) == 0 { diff -= (1 << len) - 1; } diff } pub fn decode_srw3(buf: &[u8], width: usize, height: usize, dummy: bool) -> Vec { // Decoder for third generation compressed SRW files (NX1) // Seriously Samsung just use lossless jpeg already, it compresses better too :) // Thanks to Michael Reichmann (Luminous Landscape) for putting me in contact // and Loring von Palleske (Samsung) for pointing to the open-source code of // Samsung's DNG converter at http://opensource.samsung.com/ let mut out: Vec = alloc_image!(width, height, dummy); let mut pump = BitPumpMSB32::new(buf); // Process the initial metadata bits, we only really use initVal, width and // height (the last two match the TIFF values anyway) pump.get_bits(16); // NLCVersion pump.get_bits(4); // ImgFormat let bit_depth = pump.get_bits(4)+1; pump.get_bits(4); // NumBlkInRCUnit pump.get_bits(4); // CompressionRatio pump.get_bits(16); // Width; pump.get_bits(16); // Height; pump.get_bits(16); // TileWidth pump.get_bits(4); // reserved // The format includes an optimization code that sets 3 flags to change the // decoding parameters let optflags = pump.get_bits(4); static OPT_SKIP: u32 = 1; // Skip checking if we need differences from previous line static OPT_MV : u32 = 2; // Simplify motion vector definition static OPT_QP : u32 = 4; // Don't scale the diff values pump.get_bits(8); // OverlapWidth pump.get_bits(8); // reserved pump.get_bits(8); // Inc pump.get_bits(2); // reserved let init_val = pump.get_bits(14) as u16; // The format is relatively straightforward. Each line gets encoded as a set // of differences from pixels from another line. Pixels are grouped in blocks // of 16 (8 green, 8 red or blue). Each block is encoded in three sections. // First 1 or 4 bits to specify which reference pixels to use, then a section // that specifies for each pixel the number of bits in the difference, then // the actual difference bits let mut line_offset = 0; for row in 0..height { line_offset += pump.get_pos(); // Align pump to 16byte boundary if (line_offset & 0x0f) != 0 { line_offset += 16 - (line_offset & 0xf); } pump = BitPumpMSB32::new(&buf[line_offset..]); let img = width*row; let img_up = width*(cmp::max(1, row)-1); let img_up2 = width*(cmp::max(2, row)-2); // Initialize the motion and diff modes at the start of the line let mut motion: usize = 7; // By default we are not scaling values at all let mut scale: i32 = 0; let mut diff_bits_mode: [[u32;2];3] = [[0;2];3]; for i in 0..3 { let init: u32 = if row < 2 {7} else {4}; diff_bits_mode[i][0] = init; diff_bits_mode[i][1] = init; } for col in (0..width).step_by(16) { // Calculate how much scaling the final values will need scale = if (optflags & OPT_QP) == 0 && (col & 63) == 0 { let scalevals: [i32;3] = [0,-2,2]; let i = pump.get_bits(2) as usize; if i < 3 { scale+scalevals[i] } else { pump.get_bits(12) as i32 } } else { 0 }; // First we figure out which reference pixels mode we're in if (optflags & OPT_MV) != 0 { motion = if pump.get_bits(1) != 0 {3} else {7}; } else if pump.get_bits(1) == 0 { motion = pump.get_bits(3) as usize; } if row < 2 && motion != 7 { panic!("SRW Decoder: At start of image and motion isn't 7. File corrupted?") } if motion == 7 { // The base case, just set all pixels to the previous ones on the same line // If we're at the left edge we just start at the initial value for i in 0..16 { out[img+col+i] = if col == 0 {init_val} else {out[img+col+i-2]}; } } else { // The complex case, we now need to actually lookup one or two lines above if row < 2 { panic!("SRW: Got a previous line lookup on first two lines. File corrupted?"); } let motion_offset: [isize;7] = [-4,-2,-2,0,0,2,4]; let motion_average: [i32;7] = [ 0, 0, 1,0,1,0,0]; let slide_offset = motion_offset[motion]; for i in 0..16 { let refpixel: usize = if ((row+i) & 0x1) != 0 { // Red or blue pixels use same color two lines up ((img_up2 + col + i) as isize + slide_offset) as usize } else { // Green pixel N uses Green pixel N from row above (top left or top right) if (i % 2) != 0 { ((img_up + col + i - 1) as isize + slide_offset) as usize } else { ((img_up + col + i + 1) as isize + slide_offset) as usize } }; // In some cases we use as reference interpolation of this pixel and the next out[img+col+i] = if motion_average[motion] != 0 { (out[refpixel] + out[refpixel+2] + 1) >> 1 } else { out[refpixel] } } } // Figure out how many difference bits we have to read for each pixel let mut diff_bits: [u32; 4] = [0;4]; if (optflags & OPT_SKIP) != 0 || pump.get_bits(1) == 0 { let flags: [u32; 4] = [pump.get_bits(2), pump.get_bits(2), pump.get_bits(2), pump.get_bits(2)]; for i in 0..4 { // The color is 0-Green 1-Blue 2-Red let colornum: usize = if row % 2 != 0 {i>>1} else {((i>>1)+2) % 3}; match flags[i] { 0 => {diff_bits[i] = diff_bits_mode[colornum][0];}, 1 => {diff_bits[i] = diff_bits_mode[colornum][0]+1;}, 2 => {diff_bits[i] = diff_bits_mode[colornum][0]-1;}, 3 => {diff_bits[i] = pump.get_bits(4);}, _ => {}, } diff_bits_mode[colornum][0] = diff_bits_mode[colornum][1]; diff_bits_mode[colornum][1] = diff_bits[i]; if diff_bits[i] > bit_depth+1 { panic!("SRW Decoder: Too many difference bits. File corrupted?"); } } } // Actually read the differences and write them to the pixels for i in 0..16 { let len = diff_bits[i>>2]; let mut diff = pump.get_ibits_sextended(len); diff = diff * (scale*2+1) + scale; // Apply the diff to pixels 0 2 4 6 8 10 12 14 1 3 5 7 9 11 13 15 let pos = if row % 2 != 0 { ((i&0x7) << 1) + 1 - (i>>3) } else { ((i&0x7) << 1) + (i>>3) } + img + col; out[pos] = clampbits((out[pos] as i32) + diff, bit_depth); } } } out } fn get_wb(&self) -> Result<[f32;4], String> { let rggb_levels = fetch_tag!(self.tiff, Tag::SrwRGGBLevels); let rggb_blacks = fetch_tag!(self.tiff, Tag::SrwRGGBBlacks); if rggb_levels.count() != 4 || rggb_blacks.count() != 4 { Err("SRW: RGGB Levels and Blacks don't have 4 elements".to_string()) } else { let nlevels = &rggb_levels.copy_offset_from_parent(&self.buffer); let nblacks = &rggb_blacks.copy_offset_from_parent(&self.buffer); Ok([nlevels.get_u32(0) as f32 - nblacks.get_u32(0) as f32, nlevels.get_u32(1) as f32 - nblacks.get_u32(1) as f32, nlevels.get_u32(3) as f32 - nblacks.get_u32(3) as f32, NAN]) } } } rawloader-0.37.1/src/decoders/tfr.rs000064400000000000000000000032610072674642500154460ustar 00000000000000use std::f32::NAN; use crate::decoders::*; use crate::decoders::tiff::*; use crate::decoders::ljpeg::*; use crate::decoders::basics::*; #[derive(Debug, Clone)] pub struct TfrDecoder<'a> { buffer: &'a [u8], rawloader: &'a RawLoader, tiff: TiffIFD<'a>, } impl<'a> TfrDecoder<'a> { pub fn new(buf: &'a [u8], tiff: TiffIFD<'a>, rawloader: &'a RawLoader) -> TfrDecoder<'a> { TfrDecoder { buffer: buf, tiff: tiff, rawloader: rawloader, } } } impl<'a> Decoder for TfrDecoder<'a> { fn image(&self, dummy: bool) -> Result { let camera = self.rawloader.check_supported(&self.tiff)?; let raw = fetch_ifd!(&self.tiff, Tag::WhiteLevel); let width = fetch_tag!(raw, Tag::ImageWidth).get_usize(0); let height = fetch_tag!(raw, Tag::ImageLength).get_usize(0); let offset = fetch_tag!(raw, Tag::StripOffsets).get_usize(0); let src = &self.buffer[offset..]; let image = if camera.find_hint("uncompressed") { decode_16le(src, width, height, dummy) } else { self.decode_compressed(src, width, height, dummy)? }; ok_image(camera, width, height, self.get_wb()?, image) } } impl<'a> TfrDecoder<'a> { fn get_wb(&self) -> Result<[f32;4], String> { let levels = fetch_tag!(self.tiff, Tag::AsShotNeutral); Ok([1.0/levels.get_f32(0),1.0/levels.get_f32(1),1.0/levels.get_f32(2),NAN]) } fn decode_compressed(&self, src: &[u8], width: usize, height: usize, dummy: bool) -> Result,String> { let mut out = alloc_image_ok!(width, height, dummy); let decompressor = LjpegDecompressor::new_full(src, true, false)?; decompressor.decode(&mut out, 0, width, width, height, dummy)?; Ok(out) } } rawloader-0.37.1/src/decoders/tiff.rs000064400000000000000000000335200072674642500156040ustar 00000000000000use std::collections::HashMap; use std::str; use crate::decoders::basics::*; #[derive(Debug, Copy, Clone, PartialEq, enumn::N)] #[repr(u16)] pub enum Tag { PanaWidth = 0x0002, PanaLength = 0x0003, NefWB0 = 0x000C, PanaWBsR = 0x0011, PanaWBsB = 0x0012, NrwWB = 0x0014, NefSerial = 0x001d, PanaWBs2R = 0x0024, PanaWBs2G = 0x0025, PanaWBs2B = 0x0026, Cr2PowerShotWB = 0x0029, NewSubFileType = 0x00FE, Cr2OldOffset = 0x0081, NefMeta1 = 0x008c, NefMeta2 = 0x0096, NefWB1 = 0x0097, Cr2OldWB = 0x00A4, NefKey = 0x00a7, ImageWidth = 0x0100, ImageLength = 0x0101, BitsPerSample = 0x0102, Compression = 0x0103, PhotometricInt = 0x0106, Make = 0x010F, Model = 0x0110, StripOffsets = 0x0111, Orientation = 0x0112, SamplesPerPixel = 0x0115, StripByteCounts = 0x0117, PanaOffsets = 0x0118, GrayResponse = 0x0123, Software = 0x0131, TileWidth = 0x0142, TileLength = 0x0143, TileOffsets = 0x0144, SubIFDs = 0x014A, PefBlackLevels = 0x0200, PefWB = 0x0201, PefHuffman = 0x0220, Xmp = 0x02BC, DcrWB = 0x03FD, OrfBlackLevels = 0x0600, DcrLinearization = 0x090D, EpsonWB = 0x0E80, KodakWB = 0x0F00, OlympusRedMul = 0x1017, OlympusBlueMul = 0x1018, OlympusImgProc = 0x2040, RafOldWB = 0x2ff0, Cr2ColorData = 0x4001, SonyCurve = 0x7010, SonyOffset = 0x7200, SonyLength = 0x7201, SonyKey = 0x7221, SonyGRBG = 0x7303, SonyRGGB = 0x7313, CFAPattern = 0x828E, KodakIFD = 0x8290, LeafMetadata = 0x8606, ExifIFDPointer = 0x8769, Makernote = 0x927C, SrwSensorAreas = 0xA010, SrwRGGBLevels = 0xA021, SrwRGGBBlacks = 0xA028, Cr2Id = 0xc5d8, DNGVersion = 0xC612, Linearization = 0xC618, BlackLevels = 0xC61A, WhiteLevel = 0xC61D, ColorMatrix1 = 0xC621, ColorMatrix2 = 0xC622, AsShotNeutral = 0xC628, DNGPrivateArea = 0xC634, Cr2StripeWidths = 0xC640, ActiveArea = 0xC68D, MaskedAreas = 0xC68E, RafRawSubIFD = 0xF000, RafImageWidth = 0xF001, RafImageLength = 0xF002, RafBitsPerSample = 0xF003, RafOffsets = 0xF007, RafWBGRB = 0xF00E, KdcWB = 0xFA2A, KdcWidth = 0xFD00, KdcLength = 0xFD01, KdcOffset = 0xFD04, KdcIFD = 0xFE00, } // 0-1-2-3-4-5-6-7-8-9-10-11-12-13 const DATASHIFTS: [u8;14] = [0,0,0,1,2,3,0,0,1,2, 3, 2, 3, 2]; fn t (tag: Tag) -> u16 { tag as u16 } #[derive(Debug, Copy, Clone)] pub struct TiffEntry<'a> { tag: u16, typ: u16, count: usize, parent_offset: usize, doffset: usize, data: &'a [u8], endian: Endian, } #[derive(Debug, Clone)] pub struct TiffIFD<'a> { entries: HashMap>, subifds: Vec>, nextifd: usize, start_offset: usize, endian: Endian, } impl<'a> TiffIFD<'a> { pub fn new_file(buf: &'a[u8]) -> Result, String> { if buf[0..8] == b"FUJIFILM"[..] { let ifd1 = TiffIFD::new_root(buf, (BEu32(buf, 84)+12) as usize)?; let endian = ifd1.get_endian(); let mut subifds = vec![ifd1]; let mut entries = HashMap::new(); let ioffset = BEu32(buf, 100) as usize; match TiffIFD::new_root(buf, ioffset) { Ok(val) => {subifds.push(val);} Err(_) => { entries.insert(Tag::RafOffsets as u16, TiffEntry{ tag: t(Tag::RafOffsets), typ: 4, // Long count: 1, parent_offset: 0, doffset: 100, data: &buf[100..104], endian: BIG_ENDIAN, }); }, } match TiffIFD::new_fuji(buf, BEu32(buf, 92) as usize) { Ok(val) => subifds.push(val), Err(_) => {} } Ok(TiffIFD { entries: entries, subifds: subifds, nextifd: 0, start_offset: 0, endian: endian, }) } else { TiffIFD::new_root(buf, 0) } } pub fn new_root(buf: &'a[u8], offset: usize) -> Result, String> { let mut subifds = Vec::new(); let endian = match LEu16(buf, offset) { 0x4949 => LITTLE_ENDIAN, 0x4d4d => BIG_ENDIAN, x => {return Err(format!("TIFF: don't know marker 0x{:x}", x).to_string())}, }; let mut nextifd = endian.ru32(buf, offset+4) as usize; for _ in 0..100 { // Never read more than 100 IFDs let ifd = TiffIFD::new(&buf[offset..], nextifd, 0, offset, 0, endian)?; nextifd = ifd.nextifd; subifds.push(ifd); if nextifd == 0 { break } } Ok(TiffIFD { entries: HashMap::new(), subifds: subifds, nextifd: 0, start_offset: offset, endian: endian, }) } pub fn new(buf: &'a[u8], offset: usize, base_offset: usize, start_offset: usize, depth: u32, e: Endian) -> Result, String> { let mut entries = HashMap::new(); let mut subifds = Vec::new(); let num = e.ru16(buf, offset); // Directory entries in this IFD if num > 4000 { return Err(format!("too many entries in IFD ({})", num).to_string()) } for i in 0..num { let entry_offset: usize = offset + 2 + (i as usize)*12; if Tag::n(e.ru16(buf, entry_offset)).is_none() { // Skip entries we don't know about to speedup decoding continue; } let entry = TiffEntry::new(buf, entry_offset, base_offset, offset, e); if entry.tag == t(Tag::SubIFDs) || entry.tag == t(Tag::ExifIFDPointer) || entry.tag == t(Tag::RafRawSubIFD) || entry.tag == t(Tag::KodakIFD) || entry.tag == t(Tag::KdcIFD) { if depth < 10 { // Avoid infinite looping IFDs for i in 0..entry.count { let ifd = TiffIFD::new(buf, entry.get_u32(i as usize) as usize, base_offset, start_offset, depth+1, e); match ifd { Ok(val) => {subifds.push(val);}, Err(_) => {entries.insert(entry.tag, entry);}, // Ignore unparsable IFDs } } } } else if entry.tag == t(Tag::Makernote) { if depth < 10 { // Avoid infinite looping IFDs let ifd = TiffIFD::new_makernote(buf, entry.doffset(), base_offset, depth+1, e); match ifd { Ok(val) => {subifds.push(val);}, Err(_) => {entries.insert(entry.tag, entry);}, // Ignore unparsable IFDs } } } else { entries.insert(entry.tag, entry); } } Ok(TiffIFD { entries: entries, subifds: subifds, nextifd: e.ru32(buf, offset + (2+num*12) as usize) as usize, start_offset: start_offset, endian: e, }) } pub fn new_makernote(buf: &'a[u8], offset: usize, base_offset: usize, depth: u32, e: Endian) -> Result, String> { let mut off = 0; let data = &buf[offset..]; let mut endian = e; // Olympus starts the makernote with their own name, sometimes truncated if data[0..5] == b"OLYMP"[..] { off += 8; if data[0..7] == b"OLYMPUS"[..] { off += 4; } let mut mainifd = TiffIFD::new(buf, offset+off, base_offset, 0, depth, endian)?; if off == 12 { // Parse the Olympus ImgProc section if it exists let ioff = if let Some(entry) = mainifd.find_entry(Tag::OlympusImgProc) { entry.get_usize(0) } else { 0 }; if ioff != 0 { let iprocifd = TiffIFD::new(&buf[offset+ioff..], 0, ioff, 0, depth, endian)?; mainifd.subifds.push(iprocifd); } } return Ok(mainifd) } // Epson starts the makernote with its own name if data[0..5] == b"EPSON"[..] { off += 8; } // Pentax makernote starts with AOC\0 - If it's there, skip it if data[0..4] == b"AOC\0"[..] { off +=4; } // Pentax can also start with PENTAX and in that case uses different offsets if data[0..6] == b"PENTAX"[..] { off += 8; let endian = if data[off..off+2] == b"II"[..] {LITTLE_ENDIAN} else {BIG_ENDIAN}; return TiffIFD::new(&buf[offset..], 10, base_offset, 0, depth, endian) } if data[0..7] == b"Nikon\0\x02"[..] { off += 10; let endian = if data[off..off+2] == b"II"[..] {LITTLE_ENDIAN} else {BIG_ENDIAN}; return TiffIFD::new(&buf[off+offset..], 8, base_offset, 0, depth, endian) } // Some have MM or II to indicate endianness - read that if data[off..off+2] == b"II"[..] { off +=2; endian = LITTLE_ENDIAN; } if data[off..off+2] == b"MM"[..] { off +=2; endian = BIG_ENDIAN; } TiffIFD::new(buf, offset+off, base_offset, 0, depth, endian) } pub fn new_fuji(buf: &'a[u8], offset: usize) -> Result, String> { let mut entries = HashMap::new(); let num = BEu32(buf, offset); // Directory entries in this IFD if num > 4000 { return Err(format!("too many entries in IFD ({})", num).to_string()) } let mut off = offset+4; for _ in 0..num { let tag = BEu16(buf, off); let len = BEu16(buf, off+2); if tag == t(Tag::ImageWidth) { entries.insert(t(Tag::ImageWidth), TiffEntry { tag: t(Tag::ImageWidth), typ: 3, // Short count: 2, parent_offset: 0, doffset: off+4, data: &buf[off+4..off+8], endian: BIG_ENDIAN, }); } else if tag == t(Tag::RafOldWB) { entries.insert(t(Tag::RafOldWB), TiffEntry { tag: t(Tag::RafOldWB), typ: 3, // Short count: 4, parent_offset: 0, doffset: off+4, data: &buf[off+4..off+12], endian: BIG_ENDIAN, }); } off += (len+4) as usize; } Ok(TiffIFD { entries: entries, subifds: Vec::new(), nextifd: 0, start_offset: 0, endian: BIG_ENDIAN, }) } pub fn find_entry(&self, tag: Tag) -> Option<&TiffEntry> { if self.entries.contains_key(&t(tag)) { self.entries.get(&t(tag)) } else { for ifd in &self.subifds { match ifd.find_entry(tag) { Some(x) => return Some(x), None => {}, } } None } } pub fn has_entry(&self, tag: Tag) -> bool { self.find_entry(tag).is_some() } pub fn find_ifds_with_tag(&self, tag: Tag) -> Vec<&TiffIFD> { let mut ifds = Vec::new(); if self.entries.contains_key(&t(tag)) { ifds.push(self); } for ifd in &self.subifds { if ifd.entries.contains_key(&t(tag)) { ifds.push(ifd); } ifds.extend(ifd.find_ifds_with_tag(tag)); } ifds } pub fn find_first_ifd(&self, tag: Tag) -> Option<&TiffIFD> { let ifds = self.find_ifds_with_tag(tag); if ifds.len() == 0 { None } else { Some(ifds[0]) } } pub fn get_endian(&self) -> Endian { self.endian } pub fn little_endian(&self) -> bool { self.endian.little() } pub fn start_offset(&self) -> usize { self.start_offset } } impl<'a> TiffEntry<'a> { pub fn new(buf: &'a[u8], offset: usize, base_offset: usize, parent_offset: usize, e: Endian) -> TiffEntry<'a> { let tag = e.ru16(buf, offset); let mut typ = e.ru16(buf, offset+2); let count = e.ru32(buf, offset+4) as usize; // If we don't know the type assume byte data if typ == 0 || typ > 13 { typ = 1; } let bytesize: usize = count << DATASHIFTS[typ as usize]; let doffset: usize = if bytesize <= 4 { offset + 8 } else { (e.ru32(buf, offset+8) as usize) - base_offset }; TiffEntry { tag: tag, typ: typ, count: count, parent_offset: parent_offset, doffset: doffset, data: &buf[doffset .. doffset+bytesize], endian: e, } } pub fn copy_with_new_data(&self, data: &'a[u8]) -> TiffEntry<'a> { let mut copy = self.clone(); copy.data = data; copy } pub fn copy_offset_from_parent(&self, buffer: &'a[u8]) -> TiffEntry<'a> { self.copy_with_new_data(&buffer[self.parent_offset+self.doffset..]) } pub fn doffset(&self) -> usize { self.doffset } pub fn parent_offset(&self) -> usize { self.parent_offset } pub fn count(&self) -> usize { self.count } //pub fn typ(&self) -> u16 { self.typ } pub fn get_u16(&self, idx: usize) -> u16 { match self.typ { 1 => self.data[idx] as u16, 3 | 8 => self.get_force_u16(idx), _ => panic!("Trying to read typ {} for a u32", self.typ), } } pub fn get_u32(&self, idx: usize) -> u32 { match self.typ { 1 | 3 | 8 => self.get_u16(idx) as u32, 4 | 7 | 9 | 13 => self.get_force_u32(idx), _ => panic!("Trying to read typ {} for a u32", self.typ), } } pub fn get_usize(&self, idx: usize) -> usize { self.get_u32(idx) as usize } pub fn get_force_u32(&self, idx: usize) -> u32 { self.endian.ru32(self.data, idx*4) } pub fn get_force_u16(&self, idx: usize) -> u16 { self.endian.ru16(self.data, idx*2) } pub fn get_f32(&self, idx: usize) -> f32 { if self.typ == 5 { // Rational let a = self.endian.ru32(self.data, idx*8) as f32; let b = self.endian.ru32(self.data, idx*8+4) as f32; a / b } else if self.typ == 10 { // Signed Rational let a = self.endian.ri32(self.data, idx*8) as f32; let b = self.endian.ri32(self.data, idx*8+4) as f32; a / b } else { self.get_u32(idx) as f32 } } pub fn get_str(&self) -> &str { // Truncate the string when there are \0 bytes let len = match self.data.iter().position(|&x| x == 0) { Some(p) => p, None => self.data.len(), }; match str::from_utf8(&self.data[0..len]) { Ok(val) => val.trim(), Err(err) => std::panic::panic_any(err), } } pub fn get_data(&self) -> &[u8] { self.data } } rawloader-0.37.1/src/decoders/unwrapped.rs000064400000000000000000000161740072674642500166670ustar 00000000000000use crate::decoders::*; use crate::decoders::basics::*; pub fn decode_unwrapped(buffer: &Buffer) -> Result { let decoder = LEu16(&buffer.buf, 0); let width = LEu16(&buffer.buf, 2) as usize; let height = LEu16(&buffer.buf, 4) as usize; let data = &buffer.buf[6..]; if width > 64 || height > 64 { panic!("Trying an image larger than 64x64"); } match decoder { 0 => { let table = { let mut t: [u16;256] = [0;256]; for i in 0..256 { t[i] = LEu16(data, i*2); } LookupTable::new(&t) }; let data = &data[512..]; Ok(RawImageData::Integer(decode_8bit_wtable(data, &table, width, height, false))) }, 1 => Ok(RawImageData::Integer(decode_10le_lsb16(data, width, height, false))), 2 => Ok(RawImageData::Integer(decode_10le(data, width, height, false))), 3 => Ok(RawImageData::Integer(decode_12be(data, width, height, false))), 4 => Ok(RawImageData::Integer(decode_12be_msb16(data, width, height, false))), 5 => Ok(RawImageData::Integer(decode_12le_16bitaligned(data, width, height, false))), 6 => Ok(RawImageData::Integer(decode_12be_msb32(data, width, height, false))), 7 => Ok(RawImageData::Integer(decode_12le_wcontrol(data, width, height, false))), 8 => Ok(RawImageData::Integer(decode_12be_wcontrol(data, width, height, false))), 9 => Ok(RawImageData::Integer(decode_12be_interlaced(data, width, height, false))), 10 => Ok(RawImageData::Integer(decode_12be_interlaced_unaligned(data, width, height, false))), 11 => Ok(RawImageData::Integer(decode_12le(data, width, height, false))), 12 => Ok(RawImageData::Integer(decode_12le_unpacked(data, width, height, false))), 13 => Ok(RawImageData::Integer(decode_12be_unpacked(data, width, height, false))), 14 => Ok(RawImageData::Integer(decode_12be_unpacked_left_aligned(data, width, height, false))), 15 => Ok(RawImageData::Integer(decode_12le_unpacked_left_aligned(data, width, height, false))), 16 => Ok(RawImageData::Integer(decode_14le_unpacked(data, width, height, false))), 17 => Ok(RawImageData::Integer(decode_14be_unpacked(data, width, height, false))), 18 => Ok(RawImageData::Integer(decode_16le(data, width, height, false))), 19 => Ok(RawImageData::Integer(decode_16le_skiplines(data, width, height, false))), 20 => Ok(RawImageData::Integer(decode_16be(data, width, height, false))), 21 => Ok(RawImageData::Integer(arw::ArwDecoder::decode_arw1(data, width, height, false))), 22 => { let mut curve: [usize;6] = [ 0, 0, 0, 0, 0, 4095 ]; for i in 0..4 { curve[i+1] = (LEu16(data, i*2) & 0xfff) as usize; } let curve = arw::ArwDecoder::calculate_curve(curve); let data = &data[8..]; Ok(RawImageData::Integer(arw::ArwDecoder::decode_arw2(data, width, height, &curve, false))) }, 23 => { let key = LEu32(data, 0); let length = LEu16(data, 4) as usize; let data = &data[10..]; if length > 5000 { panic!("Trying an SRF style image that's too big"); } let image_data = arw::ArwDecoder::sony_decrypt(data, 0, length, key); Ok(RawImageData::Integer(decode_16be(&image_data, width, height, false))) }, 24 => Ok(RawImageData::Integer(orf::OrfDecoder::decode_compressed(data, width, height, false))), 25 => { let loffsets = data; let data = &data[height*4..]; Ok(RawImageData::Integer(srw::SrwDecoder::decode_srw1(data, loffsets, width, height, false))) }, 26 => Ok(RawImageData::Integer(srw::SrwDecoder::decode_srw2(data, width, height, false))), 27 => Ok(RawImageData::Integer(srw::SrwDecoder::decode_srw3(data, width, height, false))), 28 => Ok(RawImageData::Integer(kdc::KdcDecoder::decode_dc120(data, width, height, false))), 29 => Ok(RawImageData::Integer(rw2::Rw2Decoder::decode_panasonic(data, width, height, false, false))), 30 => Ok(RawImageData::Integer(rw2::Rw2Decoder::decode_panasonic(data, width, height, true, false))), 31 => { let table = { let mut t = [0u16;1024]; for i in 0..1024 { t[i] = LEu16(data, i*2); } LookupTable::new(&t) }; let data = &data[2048..]; Ok(RawImageData::Integer(dcr::DcrDecoder::decode_kodak65000(data, &table, width, height, false))) }, 32 => decode_ljpeg(data, width, height, false, false), 33 => decode_ljpeg(data, width, height, false, true), 34 => decode_ljpeg(data, width, height, true, false), 35 => decode_ljpeg(data, width, height, true, true), 36 => Ok(RawImageData::Integer(pef::PefDecoder::do_decode(data, None, width, height, false).unwrap())), 37 => { let huff = data; let data = &data[64..]; Ok(RawImageData::Integer( pef::PefDecoder::do_decode(data, Some((huff, LITTLE_ENDIAN)), width, height, false).unwrap() )) }, 38 => { let huff = data; let data = &data[64..]; Ok(RawImageData::Integer( pef::PefDecoder::do_decode(data, Some((huff, BIG_ENDIAN)), width, height, false).unwrap() )) }, 39 => Ok(RawImageData::Integer(crw::CrwDecoder::do_decode(data, false, 0, width, height, false))), 40 => Ok(RawImageData::Integer(crw::CrwDecoder::do_decode(data, false, 1, width, height, false))), 41 => Ok(RawImageData::Integer(crw::CrwDecoder::do_decode(data, false, 2, width, height, false))), 42 => Ok(RawImageData::Integer(crw::CrwDecoder::do_decode(data, true, 0, width, height, false))), 43 => Ok(RawImageData::Integer(crw::CrwDecoder::do_decode(data, true, 1, width, height, false))), 44 => Ok(RawImageData::Integer(crw::CrwDecoder::do_decode(data, true, 2, width, height, false))), 45 => Ok(RawImageData::Integer(mos::MosDecoder::do_decode(data, false, width, height, false).unwrap())), 46 => Ok(RawImageData::Integer(mos::MosDecoder::do_decode(data, true, width, height, false).unwrap())), 47 => Ok(RawImageData::Integer(iiq::IiqDecoder::decode_compressed(data, height*4, 0, width, height, false))), 48 => decode_nef(data, width, height, LITTLE_ENDIAN, 12), 49 => decode_nef(data, width, height, LITTLE_ENDIAN, 14), 50 => decode_nef(data, width, height, BIG_ENDIAN, 12), 51 => decode_nef(data, width, height, BIG_ENDIAN, 14), 52 => { let coeffs = [LEf32(data,0), LEf32(data,4), LEf32(data,8), LEf32(data,12)]; let data = &data[16..]; Ok(RawImageData::Integer(nef::NefDecoder::decode_snef_compressed(data, coeffs, width, height, false))) }, _ => Err("No such decoder".to_string()), } } fn decode_ljpeg(src: &[u8], width: usize, height: usize, dng_bug: bool, csfix: bool) -> Result { let mut out = vec![0u16; width*height]; let decompressor = ljpeg::LjpegDecompressor::new_full(src, dng_bug, csfix)?; decompressor.decode(&mut out, 0, width, width, height, false)?; Ok(RawImageData::Integer(out)) } fn decode_nef(data: &[u8], width: usize, height: usize, endian: Endian, bps: usize) -> Result { let meta = data; let data = &data[4096..]; Ok(RawImageData::Integer(nef::NefDecoder::do_decode(data, meta, endian, width, height, bps, false).unwrap())) } rawloader-0.37.1/src/decoders/x3f.rs000064400000000000000000000072740072674642500153630ustar 00000000000000use std::f32::NAN; use crate::decoders::*; use crate::decoders::tiff::*; use crate::decoders::basics::*; pub fn is_x3f(buf: &[u8]) -> bool { buf[0..4] == b"FOVb"[..] } //#[derive(Debug, Clone)] struct X3fFile { //dirs: Vec, images: Vec, } //#[derive(Debug, Clone)] struct X3fDirectory { offset: usize, //len: usize, id: String, } //#[derive(Debug, Clone)] struct X3fImage { typ: usize, format: usize, width: usize, height: usize, //pitch: usize, doffset: usize, } impl X3fFile { fn new(buf: &Buffer) -> Result { let offset = LEu32(&buf.buf, buf.size-4) as usize; let data = &buf.buf[offset..]; let version = LEu32(data, 4); if version < 0x00020000 { return Err(format!("X3F: Directory version too old {}", version).to_string()) } let entries = LEu32(data, 8) as usize; let mut dirs = Vec::new(); let mut images = Vec::new(); for i in 0..entries { let dir = X3fDirectory::new(data, 12+i*12)?; if dir.id == "IMA2" { let img = X3fImage::new(&buf.buf, dir.offset)?; images.push(img); } dirs.push(dir); } Ok(X3fFile{ //dirs: dirs, images: images, }) } } impl X3fDirectory { fn new(buf: &[u8], offset: usize) -> Result { let data = &buf[offset..]; let off = LEu32(data, 0) as usize; //let len = LEu32(data, 4) as usize; let name = String::from_utf8_lossy(&data[8..12]).to_string(); Ok(X3fDirectory { offset: off, //len: len, id: name, }) } } impl X3fImage { fn new(buf: &[u8], offset: usize) -> Result { let data = &buf[offset..]; Ok(X3fImage { typ: LEu32(data, 8) as usize, format: LEu32(data, 12) as usize, width: LEu32(data, 16) as usize, height: LEu32(data, 20) as usize, //pitch: LEu32(data, 24) as usize, doffset: offset+28, }) } } //#[derive(Debug, Clone)] pub struct X3fDecoder<'a> { buffer: &'a [u8], rawloader: &'a RawLoader, dir: X3fFile, } impl<'a> X3fDecoder<'a> { pub fn new(buf: &'a Buffer, rawloader: &'a RawLoader) -> X3fDecoder<'a> { let dir = X3fFile::new(buf).unwrap(); X3fDecoder { buffer: &buf.buf, rawloader: rawloader, dir: dir, } } } impl<'a> Decoder for X3fDecoder<'a> { fn image(&self, dummy: bool) -> Result { let caminfo = self.dir.images .iter() .find(|i| i.typ == 2 && i.format == 0x12) .ok_or("X3F: Couldn't find camera info".to_string())?; let data = &self.buffer[caminfo.doffset+6..]; if data[0..4] != b"Exif"[..] { return Err("X3F: Couldn't find EXIF info".to_string()) } let tiff = TiffIFD::new_root(self.buffer, caminfo.doffset+12)?; let camera = self.rawloader.check_supported(&tiff)?; let imginfo = self.dir.images .iter() .find(|i| i.typ == 1 || i.typ == 3) .ok_or("X3F: Couldn't find image".to_string())?; let width = imginfo.width; let height = imginfo.height; let offset = imginfo.doffset; let src = &self.buffer[offset..]; let image = match imginfo.format { 35 => self.decode_compressed(src, width, height, dummy)?, x => return Err(format!("X3F Don't know how to decode format {}", x).to_string()) }; let mut img = RawImage::new(camera, width, height, self.get_wb()?, image, dummy); img.cpp = 3; Ok(img) } } impl<'a> X3fDecoder<'a> { fn get_wb(&self) -> Result<[f32;4], String> { Ok([NAN,NAN,NAN,NAN]) } fn decode_compressed(&self, _buf: &[u8], _width: usize, _height: usize, _dummy: bool) -> Result, String> { return Err("X3F decoding not implemented yet".to_string()) } } rawloader-0.37.1/src/lib.rs000064400000000000000000000077340072674642500136420ustar 00000000000000//! Library to extract the raw data and some metadata from digital camera //! images. Given an image in a supported format and camera you will be able to get //! everything needed to process the image //! //! # Example //! ```rust,no_run //! use std::env; //! use std::fs::File; //! use std::io::prelude::*; //! use std::io::BufWriter; //! //! fn main() { //! let args: Vec<_> = env::args().collect(); //! if args.len() != 2 { //! println!("Usage: {} ", args[0]); //! std::process::exit(2); //! } //! let file = &args[1]; //! let image = rawloader::decode_file(file).unwrap(); //! //! // Write out the image as a grayscale PPM //! let mut f = BufWriter::new(File::create(format!("{}.ppm",file)).unwrap()); //! let preamble = format!("P6 {} {} {}\n", image.width, image.height, 65535).into_bytes(); //! f.write_all(&preamble).unwrap(); //! if let rawloader::RawImageData::Integer(data) = image.data { //! for pix in data { //! // Do an extremely crude "demosaic" by setting R=G=B //! let pixhigh = (pix>>8) as u8; //! let pixlow = (pix&0x0f) as u8; //! f.write_all(&[pixhigh, pixlow, pixhigh, pixlow, pixhigh, pixlow]).unwrap() //! } //! } else { //! eprintln!("Don't know how to process non-integer raw files"); //! } //! } //! ``` #![deny( missing_docs, missing_debug_implementations, missing_copy_implementations, unsafe_code, unstable_features, unused_import_braces, unused_qualifications )] use lazy_static::lazy_static; mod decoders; pub use decoders::RawImage; pub use decoders::RawImageData; pub use decoders::Orientation; pub use decoders::cfa::CFA; #[doc(hidden)] pub use decoders::Buffer; #[doc(hidden)] pub use decoders::RawLoader; lazy_static! { static ref LOADER: RawLoader = decoders::RawLoader::new(); } use std::path::Path; use std::error::Error; use std::fmt; use std::io::Read; /// Error type for any reason for the decode to fail #[derive(Debug)] pub struct RawLoaderError { msg: String, } impl fmt::Display for RawLoaderError { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "RawLoaderError: \"{}\"", self.msg) } } impl Error for RawLoaderError { // Implement description so that older versions of rust still work fn description(&self) -> &str { "description() is deprecated; use Display" } } impl RawLoaderError { fn new(msg: String) -> Self { Self { msg, } } } /// Take a path to a raw file and return a decoded image or an error /// /// # Example /// ```rust,ignore /// let image = match rawloader::decode_file("path/to/your/file.RAW") { /// Ok(val) => val, /// Err(e) => ... some appropriate action when the file is unreadable ... /// }; /// ``` pub fn decode_file>(path: P) -> Result { LOADER.decode_file(path.as_ref()).map_err(|err| RawLoaderError::new(err)) } /// Take a readable source and return a decoded image or an error /// /// # Example /// ```rust,ignore /// let mut file = match File::open(path).unwrap(); /// let image = match rawloader::decode(&mut file) { /// Ok(val) => val, /// Err(e) => ... some appropriate action when the file is unreadable ... /// }; /// ``` pub fn decode(reader: &mut dyn Read) -> Result { LOADER.decode(reader, false).map_err(|err| RawLoaderError::new(err)) } // Used to force lazy_static initializations. Useful for fuzzing. #[doc(hidden)] pub fn force_initialization() { lazy_static::initialize(&LOADER); } // Used for fuzzing targets that just want to test the actual decoders instead of the full formats // with all their TIFF and other crazyness #[doc(hidden)] pub fn decode_unwrapped(reader: &mut dyn Read) -> Result { LOADER.decode_unwrapped(reader).map_err(|err| RawLoaderError::new(err)) } // Used for fuzzing everything but the decoders themselves #[doc(hidden)] pub fn decode_dummy(reader: &mut dyn Read) -> Result { LOADER.decode(reader, true).map_err(|err| RawLoaderError::new(err)) }