@realsee/hdr-toolbox 1.1.0 → 1.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.txt +119 -0
- package/README.md +12 -7
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +10 -1
- package/dist/cli.js.map +1 -1
- package/dist/convert.d.ts +15 -0
- package/dist/convert.d.ts.map +1 -1
- package/dist/convert.js +16 -33
- package/dist/convert.js.map +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/tonemap.d.ts +46 -0
- package/dist/tonemap.d.ts.map +1 -0
- package/dist/tonemap.js +369 -0
- package/dist/tonemap.js.map +1 -0
- package/package.json +13 -4
package/LICENSE.txt
ADDED
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
Realsee SDK License Agreement
|
|
2
|
+
|
|
3
|
+
Last updated: 2026-09-22
|
|
4
|
+
|
|
5
|
+
THIS LICENSE AGREEMENT BETWEEN YOU AND BEIKE REALSEE TECHNOLOGY (HK) LIMITED (“Realsee”) FORMS A LEGALLY BINDING CONTRACT BETWEEN YOU AND REALSEE IN RELATION TO YOUR USE OF THE SDK. This License Agreement accompanies the Realsee Software Development Kit(s) for the software and related explanatory materials (the "SDK") and includes any upgrades, modified versions, updates, additions, and copies of the SDK licensed to You by Realsee.
|
|
6
|
+
|
|
7
|
+
BY DOWNLOADING, INSTALLING, OR OTHERWISE ACCESSING OR USING THE SDK, YOU AGREE THAT YOU HAVE READ, UNDERSTOOD, AND AGREE TO BE BOUND BY THIS AGREEMENT. YOU ARE AGREEING ON YOUR OWN BEHALF AND/OR ON BEHALF OF YOUR COMPANY OR ORGANIZATION TO THE TERMS AND CONDITIONS STATED BELOW.
|
|
8
|
+
|
|
9
|
+
This Agreement applies to Your use of the SDK in the country in which You legally install it (“Territory”) and is subject to the laws of such Territory and further subject to Section 12 below. Different terms, conditions, and limitations may apply to the use of the SDK in any additional countries.
|
|
10
|
+
|
|
11
|
+
1. DEFINITIONS.
|
|
12
|
+
|
|
13
|
+
“Agreement” means this Realsee SDK License Agreement.
|
|
14
|
+
|
|
15
|
+
“Developer”, “You” and “Your” means the person(s) or entity acquiring or using the SDK or otherwise exercising rights under the terms of this Agreement.
|
|
16
|
+
|
|
17
|
+
“Documentation” means the technical or other specifications or documentation that Realsee may provide to You for use in connection with the SDK.
|
|
18
|
+
|
|
19
|
+
“Integrated Product” means any software, website, or on-line service developed by You based on or using the SDK (collectively, the “Integrated Product”).
|
|
20
|
+
|
|
21
|
+
“Intellectual Property” means any patents, patent rights, trademarks, service marks, registered and unregistered designs, applications for any of the foregoing, copyright, and any other similar protected rights in any country and to the extent recognised by any relevant jurisdiction as intellectual property, trade secrets, know-how and confidential information. Realsee reserves all rights not expressly granted to You.
|
|
22
|
+
|
|
23
|
+
“Realsee” means [Beike Realsee Technology (HK) Limited, a company incorporated and validly existing under the laws of Hong Kong].
|
|
24
|
+
|
|
25
|
+
“SDK” means the Realsee-proprietary Software Development Kits (SDK) provided hereunder, includes all development tools (including any compiler and debugger), application programming interfaces (“APIs”), libraries, binary utilities, header files, Documentation, content, data, code samples, and other materials provided to You in connection with this Agreement, whether delivered through a download, or any other media or form, and is licensed, not sold, to You by Realsee for use only under the terms of this Agreement. The terms of this Agreement will govern any updates provided by Realsee that replace and/or supplement the original SDK delivered to You, unless such update is accompanied by a separate license, in which case the terms of such license will govern.
|
|
26
|
+
|
|
27
|
+
“Term” means the period commencing on the date You first download, install, access, or use the SDK, and continuing until this Agreement is terminated in accordance with Section 6.
|
|
28
|
+
|
|
29
|
+
2. LICENSED USES AND RESTRICTIONS.
|
|
30
|
+
|
|
31
|
+
2.1 Subject to the restrictions contained in this Section 2, Realsee grants to You during the Term, a limited, non-exclusive, revocable, non-sublicensable, non-transferable license to install, use, and integrate the SDK within the Territory only for the purpose of developing, testing, operating and supporting Integrated Products.
|
|
32
|
+
|
|
33
|
+
2.2 Restrictions. You acknowledge and agree that, You shall not, and shall ensure that Your affiliates, employees, agents, representatives, officers, and subcontractors do not (directly or indirectly):
|
|
34
|
+
|
|
35
|
+
2.2.1 decompile, reverse engineer, disassemble or attempt to derive the source code of, those components of the SDK provided in object code form, or any part thereof;
|
|
36
|
+
|
|
37
|
+
2.2.2 remove, alter, or obscure any copyright notice or other proprietary rights notice on any part of the SDK;
|
|
38
|
+
|
|
39
|
+
2.2.3 sell, assign, pledge, rent, lease, lend, upload to or host on any website or server for use by any third party except You, redistribute, or sublicense the SDK (or any part thereof), or operate the SDK (or any part thereof) in the capacity of a service bureau or other hosted services provider, in whole or in part, nor may You enable others to do so;
|
|
40
|
+
|
|
41
|
+
2.2.4 alter, modify, customize or improve the SDK, or any part thereof;
|
|
42
|
+
|
|
43
|
+
2.2.5 use the SDK (or any part thereof) for any illegal purpose, in any manner that is inconsistent with the terms of this Agreement, or to engage in any illegal activity;
|
|
44
|
+
|
|
45
|
+
2.2.6 use the SDK (or any part thereof) in any manner that may damage the operation of Realsee’s products or services; or
|
|
46
|
+
|
|
47
|
+
2.2.7 use the SDK or any non-public information provided by Realsee for the primary purpose of developing products or services that substantially replicate the core functionality of Realsee proprietary SDK offerings;
|
|
48
|
+
|
|
49
|
+
2.2.8 distribute, re-sell, or make available the SDK (or any part thereof) as a standalone product, library, or development toolkit to any third party.
|
|
50
|
+
|
|
51
|
+
2.3 Realsee has the right to impose reasonable conditions such as a reasonable fee for use of the SDK in Integrated Product in the future.
|
|
52
|
+
|
|
53
|
+
2.4 You may make a limited number of copies of the SDK to be used by Your employees or consultants as provided herein, and not for general business purposes, and such employees or consultants shall be subject to the obligations and restrictions in this Agreement.
|
|
54
|
+
|
|
55
|
+
2.5 All licenses not expressly granted in this Agreement are reserved and no other licenses, immunity, or rights, express or implied, are granted by Realsee, by implication, estoppel, or otherwise.
|
|
56
|
+
|
|
57
|
+
3. CONFIDENTIALITY.
|
|
58
|
+
|
|
59
|
+
The SDK and all source code, Documentation, specifications, engineering details, and related information pertaining to the SDK, whether in oral, written, graphic, or electronic form, are and shall remain the confidential and proprietary information of Realsee or its licensors (collectively, the “Confidential Information”). You shall (i) disclose Confidential Information to only those directors and employees (collectively, “Affiliates”) whose duties justify their need to know such information and who have been clearly informed of their obligation to maintain the confidential, proprietary, and/or trade secret status of such Confidential Information; and (ii) use Confidential Information solely in accordance with the license granted hereunder. In any event, You and Your Affiliates shall treat Confidential Information as strictly confidential and shall use the same care to prevent disclosure of such information as You use with respect to Your own similar confidential and/or proprietary information, which shall not be less than the care a reasonable person would use under similar circumstances. All Confidential Information, and any copies thereof, shall be returned promptly to Realsee upon request. You shall ensure that Your Affiliates comply with the provisions of this Section 3, and You shall be liable for any breach of this Section 3 resulting from the act or omission of any of Your Affiliates. You shall not disclose Confidential Information to any third party, including, without limitation, any of Your subcontractors.
|
|
60
|
+
|
|
61
|
+
4. PROPRIETARY RIGHTS.
|
|
62
|
+
|
|
63
|
+
4.1 As between You and Realsee, Realsee and/or its licensors retain ownership of all right, title, and interest in, to, and under the SDK, including, without limitation, all patents, copyrights, trade secrets, trademarks and other intellectual property and other proprietary rights therein, and reserve all rights not expressly granted to You.
|
|
64
|
+
|
|
65
|
+
4.2 The items contained in the SDK are the intellectual property of Realsee and its licensors and are protected by PRC copyright and patent law, international treaty provisions and applicable laws of the country in which it is being used. You agree to protect all copyright and other ownership interests of Realsee and/or its licensors in all items in the SDK supplied under this License Agreement. You agree that all copies of the items in the SDK, reproduced for any reason by You, contain the same copyright notices, and other proprietary notices as appropriate, as appear on or in the original items delivered by Realsee in the SDK. Realsee and/or its licensors retain title and ownership of the items in the SDK, the media on which it is loaded, and all subsequent copies, regardless of the form or media in or on which the original and other copies may exist. Except as stated above, this Agreement does not grant You any rights to patents, copyrights, trade secrets, trademarks or any other rights in respect to the items in the SDK.
|
|
66
|
+
|
|
67
|
+
5. DATA PRIVACY AND PROTECTION
|
|
68
|
+
|
|
69
|
+
5.1 In connection with Your use of the SDK and any Integrated Product, You shall comply with all applicable privacy, data protection, cybersecurity, and cross-border data transfer laws and regulations. To the extent Your use of the SDK involves the collection, processing, transmission, disclosure, or storage of personal data or personal information, You shall be solely responsible for: (i) ensuring that You have a valid legal basis for such processing; (ii) providing all required notices and obtaining all necessary consents or authorisations; and (iii) implementing reasonable and appropriate technical and organisational measures to protect such data against unauthorised access, use, disclosure, alteration, or destruction.
|
|
70
|
+
|
|
71
|
+
5.2 You shall promptly notify Realsee of any material security incident relating to the SDK or Integrated Product that may materially affect Realsee, the SDK, or any personal data processed in connection with the SDK.
|
|
72
|
+
|
|
73
|
+
5.3 Developer shall be solely responsible for Developer’s compliance with applicable privacy, data protection, and cybersecurity laws in connection with the Integrated Product.
|
|
74
|
+
|
|
75
|
+
6. TERM AND TERMINATION.
|
|
76
|
+
|
|
77
|
+
6.1 This Agreement is effective until terminated. Realsee has the right to terminate this Agreement immediately, without judicial intervention, if You fail to comply with any term herein. Upon any such termination You must remove all full and partial copies of the items in the SDK from Your computer and discontinue the use of the items in the SDK.
|
|
78
|
+
|
|
79
|
+
6.2 Realsee may at any time, terminate the Agreement with You if: (A) You have breached any provision of the Agreement; or (B) Realsee is required to do so by law; or (C) Realsee decides to no longer provide the SDK or certain parts of the SDK to users in the country in which You are resident or from which You use the service, or the provision of the SDK or certain SDK services to You by Realsee is, in Realsee's sole discretion, no longer legally or commercially viable.
|
|
80
|
+
|
|
81
|
+
6.3 When the Agreement comes to an end, all of the legal rights, obligations and liabilities that You and Realsee have benefited from, been subject to (or which have accrued over time whilst the Agreement has been in force) or which are expressed to continue indefinitely, shall be unaffected by this cessation, and the provisions of Sections 3, 4, 5, 7, 8, 9, 10, and 11 shall continue to apply to such rights, obligations and liabilities indefinitely.
|
|
82
|
+
|
|
83
|
+
7. DISCLAIMER OF WARRANTY.
|
|
84
|
+
|
|
85
|
+
YOU EXPRESSLY ACKNOWLEDGE AND AGREE THAT, TO THE EXTENT PERMITTED BY APPLICABLE LAW, USE OF THE SDK (OR ANY PART THEREOF) IS AT YOUR SOLE RISK AND THAT THE ENTIRE RISK AS TO SATISFACTORY QUALITY, PERFORMANCE, ACCURACY, AND EFFORT IS WITH YOU. REALSEE LICENSES THE SDK TO YOU ONLY ON AN "AS-IS" BASIS. REALSEE MAKES NO REPRESENTATION WITH RESPECT TO THE ADEQUACY OF ANY ITEMS IN THE SDK, WHETHER OR NOT USED BY YOU IN THE DEVELOPMENT OF INTEGRATED PRODUCT, FOR ANY PARTICULAR PURPOSE OR WITH RESPECT TO THEIR ADEQUACY TO PRODUCE ANY PARTICULAR RESULT. REALSEE AND ITS LICENSORS SHALL NOT BE LIABLE FOR LOSS OR DAMAGE ARISING OUT OF THIS AGREEMENT OR FROM THE DISTRIBUTION OR USE OF INTEGRATED PRODUCT CONTAINING PORTIONS OF THE SDK. REALSEE AND ITS LICENSORS DISCLAIM ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO IMPLIED CONDITIONS OR WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT OF ANY THIRD PARTY RIGHT IN RESPECT OF THE ITEMS IN THE SDK OR ANY SERVICES RELATED TO THE SDK.
|
|
86
|
+
|
|
87
|
+
REALSEE IS UNDER NO OBLIGATION TO PROVIDE ANY SUPPORT UNDER THIS LICENSE AGREEMENT, INCLUDING UPGRADES OR FUTURE VERSIONS OF THE SDK OR ANY PORTIONS THEREOF, TO YOU, END USER OR TO ANY OTHER PARTY.
|
|
88
|
+
|
|
89
|
+
8. LIMITATION OF LIABILITY.
|
|
90
|
+
|
|
91
|
+
TO THE EXTENT NOT PROHIBITED BY APPLICABLE LAW, IN NO EVENT WILL REALSEE OR ITS LICENSORS BE LIABLE FOR ANY DIRECT, INCIDENTAL, SPECIAL, INDIRECT, OR CONSEQUENTIAL DAMAGES, INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF USE, LOSS OF BUSINESS, REVENUE, OR PROFITS, LOSS OF OPPORTUNITY (WHETHER DIRECT OR INDIRECT), CORRUPTION OR LOSS OF DATA, LOSS OF REPUTATION OR SAVINGS, DOWNTIME, OR DAMAGE TO, LOSS OF OR REPLACEMENT OF DATA OR TRANSACTIONS, COST OF PROCUREMENT OF SUBSTITUTE SERVICES, BUSINESS INTERRUPTION, OR ANY OTHER COMMERCIAL DAMAGES OR LOSSES, ARISING OUT OF OR RELATED TO YOUR USE OR INABILITY TO USE THE SDK (OR ANY PART THEREOF), ANY INTEGRATED PRODUCT, OR ANY THIRD PARTY SOFTWARE, APPLICATIONS, OR SERVICES IN CONJUNCTION WITH THE SDK (OR ANY PART THEREOF), HOWEVER CAUSED, REGARDLESS OF THE THEORY OF LIABILITY (CONTRACT, TORT, OR OTHERWISE) AND EVEN IF REALSEE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. IN NO EVENT WILL REALSEE’S TOTAL LIABILITY TO YOU FOR ALL DAMAGES EXCEED ONE HUNDRED DOLLARS ($100.00). THE FOREGOING LIMITATIONS WILL APPLY EVEN IF THE ABOVE STATED REMEDY FAILS OF ITS ESSENTIAL PURPOSE. THE LIMITATIONS CONTAINED IN SECTION 7 AND THIS SECTION 8 ARE A FUNDAMENTAL PART OF THE BASIS OF REALSEE’S BARGAIN HEREUNDER, AND REALSEE WOULD NOT ENTER INTO THIS AGREEMENT OR PROVIDE YOU WITH ACCESS TO THE SDK ABSENT SUCH LIMITATIONS.
|
|
92
|
+
|
|
93
|
+
9. INDEMNIFICATION.
|
|
94
|
+
|
|
95
|
+
To the extent permitted by applicable law, You agree to indemnify, defend and hold harmless Realsee, its affiliates and each of their directors, officers, employees, independent contractors, and agents (each a “Realsee Indemnified Party”) from any and all claims, losses, liabilities, damages, expenses, and costs (including without limitation attorneys’ fees and court costs) incurred by a Realsee Indemnified Party as a result of: (i) Your non-compliance with any terms of this Agreement; (ii) Your use of the SDK (or any part thereof); or (iii) Your use of any Integrated Product, including any claim that Integrated Product infringes the copyright, trademark, trade secret or other intellectual property right of a third party.
|
|
96
|
+
|
|
97
|
+
10. ACKNOWLEDGEMENTS.
|
|
98
|
+
|
|
99
|
+
Portions of the SDK may utilize or include third party software and other copyrighted material. Acknowledgments, licensing terms, and disclaimers for such material are contained in Documentation for the SDK or may otherwise accompany such material, and Your use of such materials governed by their respective terms. In the event of conflict between the terms of this Agreement and an applicable open source or third party agreement, the open source or third party agreement will control solely with respect to the open source software or third party software. Moreover, You shall not subject any items (including not limited to source code, object code, and any software) included in the SDK to any open source license.
|
|
100
|
+
|
|
101
|
+
11. NON-BLOCKING OF REALSEE DEVELOPMENT.
|
|
102
|
+
|
|
103
|
+
You acknowledge that Realsee is currently developing or may develop technologies and products in the future that have or may have design and/or functionality similar to Integrated Product that You may develop based on Your license herein. Nothing in this Agreement shall impair, limit or curtail Realsee's right to continue with its development, maintenance and/or distribution of Realsee's technology or products.
|
|
104
|
+
|
|
105
|
+
12. GENERAL.
|
|
106
|
+
|
|
107
|
+
12.1 Export Control. You may not use or otherwise export or re-export the SDK (or any part thereof) except as authorized by United States law and the laws of the jurisdiction(s) in which the SDK (or any part thereof) was obtained. In particular, but without limitation, the SDK may not be exported or re-exported (i) into any U.S. embargoed countries or (ii) to anyone on the U.S. Treasury Department's list of Specially Designated Nationals or the U.S. Department of Commerce Denied Person's List or Entity List. By using the SDK (or any part thereof), You represent and warrant that You are not located in any such country or on any such list.
|
|
108
|
+
|
|
109
|
+
12.2 Governing Law and Dispute Resolution.
|
|
110
|
+
|
|
111
|
+
This Agreement shall be governed by the laws of the Hong Kong Special Administrative Region of the People's Republic of China, without regard to its conflict of laws principles. Any dispute arising out of or in connection with this Agreement, including its existence, validity, interpretation, performance, breach, or termination, shall first be submitted to thirty (30) days of good faith consultation, and if unresolved, to final and binding arbitration administered by the HKIAC in Hong Kong in English under the HKIAC Administered Arbitration Rules in force at the time of submission, with one (1) arbitrator unless the amount in dispute exceeds USD 1,000,000, in which case three (3) arbitrators shall be appointed. Either party may seek interim or injunctive relief from any court of competent jurisdiction notwithstanding the foregoing.
|
|
112
|
+
|
|
113
|
+
12.3 Severability. If any provision of this Agreement is held by a court of competent jurisdiction to be unenforceable for any reason, the remaining provisions hereof will be unaffected and remain in full force and effect.
|
|
114
|
+
|
|
115
|
+
12.4 Modifications. Realsee reserves the right, from time to time, with or without notice to You, to make revisions to this Agreement in our sole and absolute discretion. The most current version of this Agreement will supersede all previous versions and shall be made available on the website where the SDK is made available, or by such other means as Realsee may determine in its discretion. Any modified versions of this Agreement hereto shall take effect from the time that it is made available. You shall be responsible for regularly checking for notice of any such modifications. You agree that Your continued use of the SDK constitutes Your agreement to the modified Agreement.
|
|
116
|
+
|
|
117
|
+
12.5 Relationship of the Parties. This Agreement will not be construed as creating an agency, partnership, joint venture, fiduciary duty, or any other form of legal association between You and Realsee, and You will not represent to the contrary, whether expressly, by implication, appearance, or otherwise.
|
|
118
|
+
|
|
119
|
+
12.6 Entire Agreement; Governing Language. This Agreement constitutes the entire agreement between You and Realsee with respect to the use of the SDK licensed hereunder and supersedes all prior understandings regarding such subject matter. No amendment to or modification of this Agreement will be binding unless in writing and signed by Realsee. You and Realsee hereto confirm that this Agreement and all related documents shall be drafted in English.
|
package/README.md
CHANGED
|
@@ -110,13 +110,18 @@ hdr-toolbox convert --input output/ultra-hdr.hdr --output output/from-hdr.uhdr.j
|
|
|
110
110
|
|
|
111
111
|
`Ultra HDR → 线性 HDR` 按 Adobe/Android 增益图恢复公式逐像素重建,在满显示余量(weight = 1)下还原完整 HDR 意图:`hdr = (sdr_linear + offset_sdr) * 2^lerp(log2(min), log2(max), gain^(1/gamma)) - offset_hdr`。
|
|
112
112
|
|
|
113
|
-
`线性 HDR → Ultra HDR`
|
|
114
|
-
|
|
115
|
-
| 选项 | 说明
|
|
116
|
-
| --------------------- |
|
|
117
|
-
| `--
|
|
118
|
-
| `--
|
|
119
|
-
| `--
|
|
113
|
+
`线性 HDR → Ultra HDR` 先把线性 HDR 色调映射成 SDR 基图,再把 `HDR/SDR` 比值编码成增益图。默认用**曝光融合**(`fusion`):从单张 HDR 合成多档虚拟曝光,按 Mertens 权重(对比度 × 饱和度 × 曝光适中度)在拉普拉斯金字塔上融合——这是一种隐式的局部色调映射,能同时保住暗部和高光细节且不产生光晕。也可切回全局 `reinhard` 曲线。可选项(仅此方向生效):
|
|
114
|
+
|
|
115
|
+
| 选项 | 说明 |
|
|
116
|
+
| --------------------- | --------------------------------------------------------- |
|
|
117
|
+
| `--tone-map` | SDR 色调映射:`fusion`(默认,局部)或 `reinhard`(全局) |
|
|
118
|
+
| `--ev-step` | 曝光融合的档间距(stops,默认 2) |
|
|
119
|
+
| `--exposure-count` | 曝光融合的合成曝光数,奇数(默认 5) |
|
|
120
|
+
| `--max-content-boost` | 要编码的线性 HDR 余量,默认取输入中的最大线性值 |
|
|
121
|
+
| `--sdr-quality` | SDR 基图 JPEG 质量(1-100,默认 95) |
|
|
122
|
+
| `--gainmap-quality` | 增益图 JPEG 质量(1-100,默认 95) |
|
|
123
|
+
|
|
124
|
+
> 曝光融合是全图金字塔运算,对大图(如 8K 全景)内存和耗时都明显高于 `reinhard`;离线转换可接受,追求速度可用 `--tone-map reinhard`。
|
|
120
125
|
|
|
121
126
|
### 5. equirect Ultra HDR → cubemap
|
|
122
127
|
|
package/dist/cli.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAYpC,wBAAgB,aAAa,IAAI,OAAO,
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAYpC,wBAAgB,aAAa,IAAI,OAAO,CAkJvC"}
|
package/dist/cli.js
CHANGED
|
@@ -14,7 +14,7 @@ export function createProgram() {
|
|
|
14
14
|
program
|
|
15
15
|
.name("hdr-toolbox")
|
|
16
16
|
.description("Compose, extract, and convert Android Ultra HDR JPEG images")
|
|
17
|
-
.version("1.1.
|
|
17
|
+
.version("1.1.1");
|
|
18
18
|
program
|
|
19
19
|
.command("compose")
|
|
20
20
|
.description("Compose an SDR image, gain map image (avif/png/jpg/jpeg), and JSON/XMP config into Ultra HDR")
|
|
@@ -81,18 +81,27 @@ export function createProgram() {
|
|
|
81
81
|
.option("--max-content-boost <ratio>", "HDR→Ultra HDR: linear HDR headroom to encode")
|
|
82
82
|
.option("--sdr-quality <quality>", "HDR→Ultra HDR: SDR base JPEG quality (1-100)")
|
|
83
83
|
.option("--gainmap-quality <quality>", "HDR→Ultra HDR: gain map JPEG quality (1-100)")
|
|
84
|
+
.option("--tone-map <operator>", "HDR→Ultra HDR: SDR tone map (fusion | aces | agx | reinhard; default fusion)")
|
|
85
|
+
.option("--ev-step <stops>", "HDR→Ultra HDR: exposure-fusion EV spacing (default 2)")
|
|
86
|
+
.option("--exposure-count <n>", "HDR→Ultra HDR: exposure-fusion exposure count, odd (default 5)")
|
|
84
87
|
.action(async (options) => {
|
|
85
88
|
const inputIsLinearHdr = isLinearHdrPath(options.input);
|
|
86
89
|
const outputIsLinearHdr = isLinearHdrPath(options.output);
|
|
87
90
|
if (inputIsLinearHdr === outputIsLinearHdr)
|
|
88
91
|
throw new Error("convert needs exactly one linear HDR side: use a .exr/.hdr input with an Ultra HDR JPEG output, or vice versa.");
|
|
89
92
|
if (inputIsLinearHdr) {
|
|
93
|
+
if (options.toneMap !== undefined &&
|
|
94
|
+
!["fusion", "aces", "agx", "reinhard"].includes(options.toneMap))
|
|
95
|
+
throw new Error(`Unsupported tone map "${options.toneMap}". Use "fusion", "aces", "agx" or "reinhard".`);
|
|
90
96
|
await linearHdrToUltraHdr({
|
|
91
97
|
input: options.input,
|
|
92
98
|
output: options.output,
|
|
93
99
|
maxContentBoost: options.maxContentBoost === undefined ? undefined : Number(options.maxContentBoost),
|
|
94
100
|
sdrQuality: options.sdrQuality === undefined ? undefined : Number(options.sdrQuality),
|
|
95
101
|
gainMapQuality: options.gainmapQuality === undefined ? undefined : Number(options.gainmapQuality),
|
|
102
|
+
toneMap: options.toneMap,
|
|
103
|
+
evStep: options.evStep === undefined ? undefined : Number(options.evStep),
|
|
104
|
+
exposureCount: options.exposureCount === undefined ? undefined : Number(options.exposureCount),
|
|
96
105
|
});
|
|
97
106
|
}
|
|
98
107
|
else {
|
package/dist/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACxE,OAAO,EAAE,sBAAsB,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AAC/E,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAEjE,qEAAqE;AACrE,SAAS,eAAe,CAAC,IAAY;IACnC,OAAO,mBAAmB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACxC,CAAC;AAED,MAAM,UAAU,aAAa;IAC3B,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE,CAAC;IAC9B,OAAO;SACJ,IAAI,CAAC,aAAa,CAAC;SACnB,WAAW,CAAC,6DAA6D,CAAC;SAC1E,OAAO,CAAC,OAAO,CAAC,CAAC;IAEpB,OAAO;SACJ,OAAO,CAAC,SAAS,CAAC;SAClB,WAAW,CACV,8FAA8F,CAC/F;SACA,cAAc,CAAC,cAAc,EAAE,0CAA0C,CAAC;SAC1E,cAAc,CAAC,kBAAkB,EAAE,uCAAuC,CAAC;SAC3E,cAAc,CAAC,qBAAqB,EAAE,iCAAiC,CAA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AY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;QAC9D,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;IACvB,CAAC,CAAC,CAAC;AACP,CAAC"}
|
package/dist/convert.d.ts
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
/** Linear HDR float container formats that `convert` reads and writes. */
|
|
2
2
|
export type LinearHdrFormat = "exr" | "hdr";
|
|
3
|
+
/**
|
|
4
|
+
* SDR tone-mapping operator for the Ultra HDR base image.
|
|
5
|
+
* - `"fusion"` (default): exposure-fusion local tone map; keeps shadow and
|
|
6
|
+
* highlight detail at once with no halos.
|
|
7
|
+
* - `"aces"`: global ACES Filmic curve (high contrast, cinematic).
|
|
8
|
+
* - `"agx"`: global AgX curve (gentle, neutral highlight roll-off).
|
|
9
|
+
* - `"reinhard"`: cheap global Reinhard curve.
|
|
10
|
+
*/
|
|
11
|
+
export type ToneMapOperator = "fusion" | "aces" | "agx" | "reinhard";
|
|
3
12
|
export interface UltraHdrToLinearHdrOptions {
|
|
4
13
|
input: string;
|
|
5
14
|
output: string;
|
|
@@ -17,6 +26,12 @@ export interface LinearHdrToUltraHdrOptions {
|
|
|
17
26
|
gainMapQuality?: number;
|
|
18
27
|
/** Linear ratio of HDR headroom to encode (max_content_boost, default auto). */
|
|
19
28
|
maxContentBoost?: number;
|
|
29
|
+
/** SDR tone-mapping operator (default "fusion"). */
|
|
30
|
+
toneMap?: ToneMapOperator;
|
|
31
|
+
/** Exposure fusion: spacing between synthetic exposures in stops (default 2). */
|
|
32
|
+
evStep?: number;
|
|
33
|
+
/** Exposure fusion: number of synthetic exposures, odd (default 5). */
|
|
34
|
+
exposureCount?: number;
|
|
20
35
|
}
|
|
21
36
|
/** Back-compat alias for {@link UltraHdrToLinearHdrOptions}. */
|
|
22
37
|
export type UltraHdrToExrOptions = UltraHdrToLinearHdrOptions;
|
package/dist/convert.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"convert.d.ts","sourceRoot":"","sources":["../src/convert.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"convert.d.ts","sourceRoot":"","sources":["../src/convert.ts"],"names":[],"mappings":"AAWA,0EAA0E;AAC1E,MAAM,MAAM,eAAe,GAAG,KAAK,GAAG,KAAK,CAAC;AAE5C;;;;;;;GAOG;AACH,MAAM,MAAM,eAAe,GAAG,QAAQ,GAAG,MAAM,GAAG,KAAK,GAAG,UAAU,CAAC;AAErE,MAAM,WAAW,0BAA0B;IACzC,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,uEAAuE;IACvE,MAAM,CAAC,EAAE,eAAe,CAAC;CAC1B;AAED,MAAM,WAAW,0BAA0B;IACzC,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,qEAAqE;IACrE,MAAM,CAAC,EAAE,eAAe,CAAC;IACzB,yEAAyE;IACzE,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,yEAAyE;IACzE,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,gFAAgF;IAChF,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,oDAAoD;IACpD,OAAO,CAAC,EAAE,eAAe,CAAC;IAC1B,iFAAiF;IACjF,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,uEAAuE;IACvE,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,gEAAgE;AAChE,MAAM,MAAM,oBAAoB,GAAG,0BAA0B,CAAC;AAC9D,gEAAgE;AAChE,MAAM,MAAM,oBAAoB,GAAG,0BAA0B,CAAC;AAE9D,qFAAqF;AACrF,wBAAgB,sBAAsB,CACpC,QAAQ,EAAE,eAAe,GAAG,SAAS,EACrC,IAAI,EAAE,MAAM,GACX,eAAe,CAQjB;AAwBD;;;;;;;;;GASG;AACH,wBAAsB,mBAAmB,CAAC,OAAO,EAAE,0BAA0B,GAAG,OAAO,CAAC,IAAI,CAAC,CAqC5F;AAED;;;;;GAKG;AACH,wBAAsB,mBAAmB,CAAC,OAAO,EAAE,0BAA0B,GAAG,OAAO,CAAC,IAAI,CAAC,CAuE5F;AAED,+EAA+E;AAC/E,eAAO,MAAM,aAAa,4BAAsB,CAAC;AACjD,+EAA+E;AAC/E,eAAO,MAAM,aAAa,4BAAsB,CAAC"}
|
package/dist/convert.js
CHANGED
|
@@ -3,6 +3,7 @@ import { dirname, extname } from "node:path";
|
|
|
3
3
|
import sharp from "sharp";
|
|
4
4
|
import { readExr, writeExr } from "./exr.js";
|
|
5
5
|
import { readHdr, writeHdr } from "./hdr.js";
|
|
6
|
+
import { acesSdr, agxSdr, exposureFusion, reinhardSdr } from "./tonemap.js";
|
|
6
7
|
import { composeUltraHdrBuffers, extractUltraHdrBuffers } from "./ultrahdr.js";
|
|
7
8
|
import { normalizeGainMapConfig } from "./xmp.js";
|
|
8
9
|
/** Resolves a linear HDR format from an explicit option, then the path extension. */
|
|
@@ -26,24 +27,6 @@ function encodeLinearHdr(image, format) {
|
|
|
26
27
|
function srgbToLinear(value) {
|
|
27
28
|
return value <= 0.04045 ? value / 12.92 : ((value + 0.055) / 1.055) ** 2.4;
|
|
28
29
|
}
|
|
29
|
-
/** Encode linear light (0-1) back to an 8-bit sRGB value (0-1). */
|
|
30
|
-
function linearToSrgb(value) {
|
|
31
|
-
const clamped = value < 0 ? 0 : value > 1 ? 1 : value;
|
|
32
|
-
return clamped <= 0.0031308 ? clamped * 12.92 : 1.055 * clamped ** (1 / 2.4) - 0.055;
|
|
33
|
-
}
|
|
34
|
-
/** Rec. 709 relative luminance of a linear RGB triple. */
|
|
35
|
-
function luminance(r, g, b) {
|
|
36
|
-
return 0.2126 * r + 0.7152 * g + 0.0722 * b;
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* Reinhard tone map: `x / (1 + x)`. Simple and reversible, it maps any linear
|
|
40
|
-
* luminance into [0, 1) without hard clipping. It compresses bright highlights
|
|
41
|
-
* aggressively, so the SDR base favours a well-exposed midrange; the full HDR
|
|
42
|
-
* detail is preserved in the gain map and recovered on HDR displays.
|
|
43
|
-
*/
|
|
44
|
-
function reinhard(value) {
|
|
45
|
-
return value / (1 + value);
|
|
46
|
-
}
|
|
47
30
|
async function decodeRgb(jpeg) {
|
|
48
31
|
const { data, info } = await sharp(jpeg)
|
|
49
32
|
.toColorspace("srgb")
|
|
@@ -114,27 +97,27 @@ export async function linearHdrToUltraHdr(options) {
|
|
|
114
97
|
}
|
|
115
98
|
const maxContentBoost = Math.max(1.0001, options.maxContentBoost ?? Math.min(peak, 2 ** 14));
|
|
116
99
|
const logMax = Math.log2(maxContentBoost);
|
|
117
|
-
|
|
100
|
+
// Build the SDR base with the chosen tone map. Both operators return
|
|
101
|
+
// interleaved 8-bit sRGB; the gain map is then derived from this quantised
|
|
102
|
+
// base so HDR reconstruction stays consistent with what actually ships.
|
|
103
|
+
const toneMap = options.toneMap ?? "fusion";
|
|
104
|
+
const sdrPixels = toneMap === "reinhard"
|
|
105
|
+
? reinhardSdr(data, width, height)
|
|
106
|
+
: toneMap === "aces"
|
|
107
|
+
? acesSdr(data, width, height)
|
|
108
|
+
: toneMap === "agx"
|
|
109
|
+
? agxSdr(data, width, height)
|
|
110
|
+
: exposureFusion(data, width, height, {
|
|
111
|
+
evStep: options.evStep,
|
|
112
|
+
exposureCount: options.exposureCount,
|
|
113
|
+
});
|
|
118
114
|
const gainPixels = Buffer.alloc(width * height * 3);
|
|
119
115
|
const offset = 0.015625;
|
|
120
116
|
for (let pixel = 0; pixel < width * height; pixel++) {
|
|
121
117
|
const base = pixel * 3;
|
|
122
|
-
const r = Math.max(0, data[base]);
|
|
123
|
-
const g = Math.max(0, data[base + 1]);
|
|
124
|
-
const b = Math.max(0, data[base + 2]);
|
|
125
|
-
// Drive the Reinhard compression by luminance and scale the chroma by the
|
|
126
|
-
// same factor, so hue and saturation survive tone mapping (a per-channel
|
|
127
|
-
// curve would desaturate bright, saturated highlights).
|
|
128
|
-
const y = luminance(r, g, b);
|
|
129
|
-
const ySdr = reinhard(y);
|
|
130
|
-
const scale = y > 1e-6 ? ySdr / y : 0;
|
|
131
118
|
for (let channel = 0; channel < 3; channel++) {
|
|
132
119
|
const hdr = Math.max(0, data[base + channel]);
|
|
133
|
-
|
|
134
|
-
// from the exact SDR light it decodes to, keeping reconstruction consistent.
|
|
135
|
-
const code = Math.round(linearToSrgb(Math.min(1, hdr * scale)) * 255);
|
|
136
|
-
sdrPixels[base + channel] = code;
|
|
137
|
-
const sdrLinear = srgbToLinear(code / 255);
|
|
120
|
+
const sdrLinear = srgbToLinear(sdrPixels[base + channel] / 255);
|
|
138
121
|
// Gain is the ratio of HDR to SDR light, encoded in log2 space and
|
|
139
122
|
// normalised to [0,1] against the chosen max boost.
|
|
140
123
|
const ratio = (hdr + offset) / (sdrLinear + offset);
|
package/dist/convert.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"convert.js","sourceRoot":"","sources":["../src/convert.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,EAAE,sBAAsB,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AAE/E,OAAO,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"convert.js","sourceRoot":"","sources":["../src/convert.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;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AAc,EAAE,CAAC;aACjC,QAAQ,EAAE;KACd,CAAC,CAAC;IAEH,MAAM,MAAM,GAAkB;QAC5B,eAAe;QACf,eAAe,EAAE,CAAC;QAClB,KAAK,EAAE,CAAC;QACR,SAAS,EAAE,MAAM;QACjB,SAAS,EAAE,MAAM;QACjB,cAAc,EAAE,CAAC;QACjB,cAAc,EAAE,eAAe;QAC/B,iBAAiB,EAAE,IAAI;KACxB,CAAC;IAEF,MAAM,SAAS,GAAG,MAAM,sBAAsB,CAAC,OAAO,EAAE,WAAW,EAAE,MAAM,CAAC,CAAC;IAC7E,MAAM,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAC1D,MAAM,SAAS,CAAC,OAAO,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;AAC7C,CAAC;AAED,+EAA+E;AAC/E,MAAM,CAAC,MAAM,aAAa,GAAG,mBAAmB,CAAC;AACjD,+EAA+E;AAC/E,MAAM,CAAC,MAAM,aAAa,GAAG,mBAAmB,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
export type { ComposeUltraHdrOptions, ExtractUltraHdrOptions } from "./ultrahdr.js";
|
|
2
2
|
export { composeUltraHdr, composeUltraHdrBuffers, extractUltraHdr, extractUltraHdrBuffers, } from "./ultrahdr.js";
|
|
3
|
-
export type { ExrToUltraHdrOptions, LinearHdrFormat, LinearHdrToUltraHdrOptions, UltraHdrToExrOptions, UltraHdrToLinearHdrOptions, } from "./convert.js";
|
|
3
|
+
export type { ExrToUltraHdrOptions, LinearHdrFormat, LinearHdrToUltraHdrOptions, ToneMapOperator, UltraHdrToExrOptions, UltraHdrToLinearHdrOptions, } from "./convert.js";
|
|
4
4
|
export { exrToUltraHdr, linearHdrToUltraHdr, resolveLinearHdrFormat, ultraHdrToExr, ultraHdrToLinearHdr, } from "./convert.js";
|
|
5
5
|
export type { ExrImage, LinearHdrImage } from "./exr.js";
|
|
6
6
|
export { readExr, writeExr } from "./exr.js";
|
|
7
7
|
export { readHdr, writeHdr } from "./hdr.js";
|
|
8
|
+
export type { ExposureFusionOptions } from "./tonemap.js";
|
|
9
|
+
export { acesSdr, agxSdr, exposureFusion, reinhardSdr } from "./tonemap.js";
|
|
8
10
|
export type { CubeToEquirectOptions, EquirectToCubeOptions } from "./panorama.js";
|
|
9
11
|
export { cubeToEquirectUltraHdr, equirectUltraHdrToCube } from "./panorama.js";
|
|
10
12
|
export type { CubeFaceKey, CubeManifest, GainMapConfig } from "./types.js";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,sBAAsB,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AACpF,OAAO,EACL,eAAe,EACf,sBAAsB,EACtB,eAAe,EACf,sBAAsB,GACvB,MAAM,eAAe,CAAC;AACvB,YAAY,EACV,oBAAoB,EACpB,eAAe,EACf,0BAA0B,EAC1B,oBAAoB,EACpB,0BAA0B,GAC3B,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,aAAa,EACb,mBAAmB,EACnB,sBAAsB,EACtB,aAAa,EACb,mBAAmB,GACpB,MAAM,cAAc,CAAC;AACtB,YAAY,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AACzD,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAC7C,YAAY,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAClF,OAAO,EAAE,sBAAsB,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AAC/E,YAAY,EAAE,WAAW,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,YA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CHANGED
|
@@ -2,6 +2,7 @@ export { composeUltraHdr, composeUltraHdrBuffers, extractUltraHdr, extractUltraH
|
|
|
2
2
|
export { exrToUltraHdr, linearHdrToUltraHdr, resolveLinearHdrFormat, ultraHdrToExr, ultraHdrToLinearHdr, } from "./convert.js";
|
|
3
3
|
export { readExr, writeExr } from "./exr.js";
|
|
4
4
|
export { readHdr, writeHdr } from "./hdr.js";
|
|
5
|
+
export { acesSdr, agxSdr, exposureFusion, reinhardSdr } from "./tonemap.js";
|
|
5
6
|
export { cubeToEquirectUltraHdr, equirectUltraHdrToCube } from "./panorama.js";
|
|
6
7
|
export { createGainMapXmp, createPrimaryXmp, normalizeGainMapConfig, parseGainMapXmp, readGainMapConfig, writeGainMapConfig, } from "./xmp.js";
|
|
7
8
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,eAAe,EACf,sBAAsB,EACtB,eAAe,EACf,sBAAsB,GACvB,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,eAAe,EACf,sBAAsB,EACtB,eAAe,EACf,sBAAsB,GACvB,MAAM,eAAe,CAAC;AASvB,OAAO,EACL,aAAa,EACb,mBAAmB,EACnB,sBAAsB,EACtB,aAAa,EACb,mBAAmB,GACpB,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAE7C,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAE5E,OAAO,EAAE,sBAAsB,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AAE/E,OAAO,EACL,gBAAgB,EAChB,gBAAgB,EAChB,sBAAsB,EACtB,eAAe,EACf,iBAAiB,EACjB,kBAAkB,GACnB,MAAM,UAAU,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SDR tone mapping operators for building the Ultra HDR base image.
|
|
3
|
+
*
|
|
4
|
+
* - `exposureFusion`: an implicit local tone map that synthesises several
|
|
5
|
+
* virtual exposures from the HDR and blends them with Mertens exposure fusion
|
|
6
|
+
* over a Laplacian pyramid. It keeps shadow and highlight detail at once and
|
|
7
|
+
* stays spatially smooth (no halos), which also keeps the derived gain map
|
|
8
|
+
* easy to compress.
|
|
9
|
+
* - `acesSdr` / `agxSdr`: global filmic curves ported from three.js, each with
|
|
10
|
+
* an automatic middle-grey exposure so bright scenes do not blow out.
|
|
11
|
+
* - `reinhardSdr`: a cheap global luminance-driven Reinhard curve.
|
|
12
|
+
*
|
|
13
|
+
* All return interleaved 8-bit sRGB RGB (3 channels), ready to be the Ultra HDR
|
|
14
|
+
* SDR base; the gain map is derived from this quantised base by the caller.
|
|
15
|
+
*/
|
|
16
|
+
/**
|
|
17
|
+
* Global Reinhard tone map, luminance-driven. Compresses `luminance/(1+luminance)`
|
|
18
|
+
* and scales chroma by the same factor so hue and saturation survive.
|
|
19
|
+
* Returns interleaved 8-bit sRGB.
|
|
20
|
+
*/
|
|
21
|
+
export declare function reinhardSdr(data: Float32Array, width: number, height: number): Buffer;
|
|
22
|
+
/**
|
|
23
|
+
* ACES Filmic tone map, ported from three.js (includes its subjective 1/0.6
|
|
24
|
+
* brightening). High contrast, cinematic highlight shoulder. Applied per pixel
|
|
25
|
+
* after an automatic middle-grey exposure.
|
|
26
|
+
*/
|
|
27
|
+
export declare function acesSdr(data: Float32Array, width: number, height: number): Buffer;
|
|
28
|
+
/**
|
|
29
|
+
* AgX tone map (Filament/Blender fit), ported from three.js. Gentle, neutral
|
|
30
|
+
* highlight roll-off with low clipping. Applied per pixel after an automatic
|
|
31
|
+
* middle-grey exposure.
|
|
32
|
+
*/
|
|
33
|
+
export declare function agxSdr(data: Float32Array, width: number, height: number): Buffer;
|
|
34
|
+
export interface ExposureFusionOptions {
|
|
35
|
+
/** Spacing between synthetic exposures, in stops (default 2). */
|
|
36
|
+
evStep?: number;
|
|
37
|
+
/** Number of synthetic exposures, odd (default 5). */
|
|
38
|
+
exposureCount?: number;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Exposure fusion tone map. Synthesises `exposureCount` exposures around an
|
|
42
|
+
* auto middle-grey EV0, blends them with Mertens weights over a Laplacian
|
|
43
|
+
* pyramid, and returns interleaved 8-bit sRGB RGB.
|
|
44
|
+
*/
|
|
45
|
+
export declare function exposureFusion(data: Float32Array, width: number, height: number, options?: ExposureFusionOptions): Buffer;
|
|
46
|
+
//# sourceMappingURL=tonemap.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tonemap.d.ts","sourceRoot":"","sources":["../src/tonemap.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAeH;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAerF;AAqDD;;;;GAIG;AACH,wBAAgB,OAAO,CAAC,IAAI,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAkBjF;AAwCD;;;;GAIG;AACH,wBAAgB,MAAM,CAAC,IAAI,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CA6BhF;AAqID,MAAM,WAAW,qBAAqB;IACpC,iEAAiE;IACjE,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,sDAAsD;IACtD,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAC5B,IAAI,EAAE,YAAY,EAClB,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EACd,OAAO,GAAE,qBAA0B,GAClC,MAAM,CAmER"}
|
package/dist/tonemap.js
ADDED
|
@@ -0,0 +1,369 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SDR tone mapping operators for building the Ultra HDR base image.
|
|
3
|
+
*
|
|
4
|
+
* - `exposureFusion`: an implicit local tone map that synthesises several
|
|
5
|
+
* virtual exposures from the HDR and blends them with Mertens exposure fusion
|
|
6
|
+
* over a Laplacian pyramid. It keeps shadow and highlight detail at once and
|
|
7
|
+
* stays spatially smooth (no halos), which also keeps the derived gain map
|
|
8
|
+
* easy to compress.
|
|
9
|
+
* - `acesSdr` / `agxSdr`: global filmic curves ported from three.js, each with
|
|
10
|
+
* an automatic middle-grey exposure so bright scenes do not blow out.
|
|
11
|
+
* - `reinhardSdr`: a cheap global luminance-driven Reinhard curve.
|
|
12
|
+
*
|
|
13
|
+
* All return interleaved 8-bit sRGB RGB (3 channels), ready to be the Ultra HDR
|
|
14
|
+
* SDR base; the gain map is derived from this quantised base by the caller.
|
|
15
|
+
*/
|
|
16
|
+
const clamp01 = (v) => (v < 0 ? 0 : v > 1 ? 1 : v);
|
|
17
|
+
/** Encode linear light (0-1) to an sRGB value (0-1). */
|
|
18
|
+
function linearToSrgb(value) {
|
|
19
|
+
const c = clamp01(value);
|
|
20
|
+
return c <= 0.0031308 ? c * 12.92 : 1.055 * c ** (1 / 2.4) - 0.055;
|
|
21
|
+
}
|
|
22
|
+
/** Rec. 709 relative luminance. */
|
|
23
|
+
function luminance(r, g, b) {
|
|
24
|
+
return 0.2126 * r + 0.7152 * g + 0.0722 * b;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Global Reinhard tone map, luminance-driven. Compresses `luminance/(1+luminance)`
|
|
28
|
+
* and scales chroma by the same factor so hue and saturation survive.
|
|
29
|
+
* Returns interleaved 8-bit sRGB.
|
|
30
|
+
*/
|
|
31
|
+
export function reinhardSdr(data, width, height) {
|
|
32
|
+
const out = Buffer.alloc(width * height * 3);
|
|
33
|
+
for (let pixel = 0; pixel < width * height; pixel++) {
|
|
34
|
+
const base = pixel * 3;
|
|
35
|
+
const r = Math.max(0, data[base]);
|
|
36
|
+
const g = Math.max(0, data[base + 1]);
|
|
37
|
+
const b = Math.max(0, data[base + 2]);
|
|
38
|
+
const y = luminance(r, g, b);
|
|
39
|
+
const ySdr = y / (1 + y);
|
|
40
|
+
const scale = y > 1e-6 ? ySdr / y : 0;
|
|
41
|
+
out[base] = Math.round(linearToSrgb(Math.min(1, r * scale)) * 255);
|
|
42
|
+
out[base + 1] = Math.round(linearToSrgb(Math.min(1, g * scale)) * 255);
|
|
43
|
+
out[base + 2] = Math.round(linearToSrgb(Math.min(1, b * scale)) * 255);
|
|
44
|
+
}
|
|
45
|
+
return out;
|
|
46
|
+
}
|
|
47
|
+
/** Auto EV0 gain: geometric-mean luminance mapped to middle grey (~0.18). */
|
|
48
|
+
function middleGreyGain(data) {
|
|
49
|
+
let logSum = 0;
|
|
50
|
+
let count = 0;
|
|
51
|
+
for (let i = 0; i < data.length; i += 3) {
|
|
52
|
+
const y = luminance(data[i], data[i + 1], data[i + 2]);
|
|
53
|
+
if (y <= 0)
|
|
54
|
+
continue;
|
|
55
|
+
logSum += Math.log(y + 1e-4);
|
|
56
|
+
count++;
|
|
57
|
+
}
|
|
58
|
+
if (count === 0)
|
|
59
|
+
return 1;
|
|
60
|
+
return 0.18 / Math.max(1e-4, Math.exp(logSum / count));
|
|
61
|
+
}
|
|
62
|
+
/** Column-major 3x3 matrix multiply (three.js mat3 column vectors). */
|
|
63
|
+
function mul3(m, c) {
|
|
64
|
+
return [
|
|
65
|
+
m[0][0] * c[0] + m[1][0] * c[1] + m[2][0] * c[2],
|
|
66
|
+
m[0][1] * c[0] + m[1][1] * c[1] + m[2][1] * c[2],
|
|
67
|
+
m[0][2] * c[0] + m[1][2] * c[1] + m[2][2] * c[2],
|
|
68
|
+
];
|
|
69
|
+
}
|
|
70
|
+
const ACES_INPUT = [
|
|
71
|
+
[0.59719, 0.076, 0.0284],
|
|
72
|
+
[0.35458, 0.90834, 0.13383],
|
|
73
|
+
[0.04823, 0.01566, 0.83777],
|
|
74
|
+
];
|
|
75
|
+
const ACES_OUTPUT = [
|
|
76
|
+
[1.60475, -0.10208, -0.00327],
|
|
77
|
+
[-0.53108, 1.10813, -0.07276],
|
|
78
|
+
[-0.07367, -0.00605, 1.07602],
|
|
79
|
+
];
|
|
80
|
+
/** ACES RRT+ODT rational fit (one channel). */
|
|
81
|
+
function rrtOdt(x) {
|
|
82
|
+
const a = x * (x + 0.0245786) - 0.000090537;
|
|
83
|
+
const b = x * (0.983729 * x + 0.432951) + 0.238081;
|
|
84
|
+
return a / b;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* ACES Filmic tone map, ported from three.js (includes its subjective 1/0.6
|
|
88
|
+
* brightening). High contrast, cinematic highlight shoulder. Applied per pixel
|
|
89
|
+
* after an automatic middle-grey exposure.
|
|
90
|
+
*/
|
|
91
|
+
export function acesSdr(data, width, height) {
|
|
92
|
+
const exposure = middleGreyGain(data) / 0.6;
|
|
93
|
+
const out = Buffer.alloc(width * height * 3);
|
|
94
|
+
for (let pixel = 0; pixel < width * height; pixel++) {
|
|
95
|
+
const base = pixel * 3;
|
|
96
|
+
let c = [
|
|
97
|
+
Math.max(0, data[base]) * exposure,
|
|
98
|
+
Math.max(0, data[base + 1]) * exposure,
|
|
99
|
+
Math.max(0, data[base + 2]) * exposure,
|
|
100
|
+
];
|
|
101
|
+
c = mul3(ACES_INPUT, c);
|
|
102
|
+
c = [rrtOdt(c[0]), rrtOdt(c[1]), rrtOdt(c[2])];
|
|
103
|
+
c = mul3(ACES_OUTPUT, c);
|
|
104
|
+
out[base] = Math.round(linearToSrgb(c[0]) * 255);
|
|
105
|
+
out[base + 1] = Math.round(linearToSrgb(c[1]) * 255);
|
|
106
|
+
out[base + 2] = Math.round(linearToSrgb(c[2]) * 255);
|
|
107
|
+
}
|
|
108
|
+
return out;
|
|
109
|
+
}
|
|
110
|
+
const SRGB_TO_REC2020 = [
|
|
111
|
+
[0.6274, 0.0691, 0.0164],
|
|
112
|
+
[0.3293, 0.9195, 0.088],
|
|
113
|
+
[0.0433, 0.0113, 0.8956],
|
|
114
|
+
];
|
|
115
|
+
const REC2020_TO_SRGB = [
|
|
116
|
+
[1.6605, -0.1246, -0.0182],
|
|
117
|
+
[-0.5876, 1.1329, -0.1006],
|
|
118
|
+
[-0.0728, -0.0083, 1.1187],
|
|
119
|
+
];
|
|
120
|
+
const AGX_INSET = [
|
|
121
|
+
[0.856627153315983, 0.137318972929847, 0.11189821299995],
|
|
122
|
+
[0.0951212405381588, 0.761241990602591, 0.0767994186031903],
|
|
123
|
+
[0.0482516061458583, 0.101439036467562, 0.811302368396859],
|
|
124
|
+
];
|
|
125
|
+
const AGX_OUTSET = [
|
|
126
|
+
[1.1271005818144368, -0.1413297634984383, -0.14132976349843826],
|
|
127
|
+
[-0.11060664309660323, 1.157823702216272, -0.11060664309660294],
|
|
128
|
+
[-0.016493938717834573, -0.016493938717834257, 1.2519364065950405],
|
|
129
|
+
];
|
|
130
|
+
const AGX_MIN_EV = -12.47393;
|
|
131
|
+
const AGX_MAX_EV = 4.026069;
|
|
132
|
+
/** AgX sigmoid contrast polynomial (one channel), as in three.js. */
|
|
133
|
+
function agxContrast(x) {
|
|
134
|
+
const x2 = x * x;
|
|
135
|
+
const x4 = x2 * x2;
|
|
136
|
+
return (15.5 * x4 * x2 -
|
|
137
|
+
40.14 * x4 * x +
|
|
138
|
+
31.96 * x4 -
|
|
139
|
+
6.868 * x2 * x +
|
|
140
|
+
0.4298 * x2 +
|
|
141
|
+
0.1191 * x -
|
|
142
|
+
0.00232);
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* AgX tone map (Filament/Blender fit), ported from three.js. Gentle, neutral
|
|
146
|
+
* highlight roll-off with low clipping. Applied per pixel after an automatic
|
|
147
|
+
* middle-grey exposure.
|
|
148
|
+
*/
|
|
149
|
+
export function agxSdr(data, width, height) {
|
|
150
|
+
const exposure = middleGreyGain(data);
|
|
151
|
+
const out = Buffer.alloc(width * height * 3);
|
|
152
|
+
for (let pixel = 0; pixel < width * height; pixel++) {
|
|
153
|
+
const base = pixel * 3;
|
|
154
|
+
let c = [
|
|
155
|
+
Math.max(0, data[base]) * exposure,
|
|
156
|
+
Math.max(0, data[base + 1]) * exposure,
|
|
157
|
+
Math.max(0, data[base + 2]) * exposure,
|
|
158
|
+
];
|
|
159
|
+
c = mul3(SRGB_TO_REC2020, c);
|
|
160
|
+
c = mul3(AGX_INSET, c);
|
|
161
|
+
c = [Math.max(c[0], 1e-10), Math.max(c[1], 1e-10), Math.max(c[2], 1e-10)];
|
|
162
|
+
c = [
|
|
163
|
+
(Math.log2(c[0]) - AGX_MIN_EV) / (AGX_MAX_EV - AGX_MIN_EV),
|
|
164
|
+
(Math.log2(c[1]) - AGX_MIN_EV) / (AGX_MAX_EV - AGX_MIN_EV),
|
|
165
|
+
(Math.log2(c[2]) - AGX_MIN_EV) / (AGX_MAX_EV - AGX_MIN_EV),
|
|
166
|
+
];
|
|
167
|
+
c = [clamp01(c[0]), clamp01(c[1]), clamp01(c[2])];
|
|
168
|
+
c = [agxContrast(c[0]), agxContrast(c[1]), agxContrast(c[2])];
|
|
169
|
+
c = mul3(AGX_OUTSET, c);
|
|
170
|
+
c = [Math.max(0, c[0]) ** 2.2, Math.max(0, c[1]) ** 2.2, Math.max(0, c[2]) ** 2.2];
|
|
171
|
+
c = mul3(REC2020_TO_SRGB, c);
|
|
172
|
+
// c is now linear sRGB; apply the sRGB OETF to get display 8-bit values.
|
|
173
|
+
out[base] = Math.round(linearToSrgb(c[0]) * 255);
|
|
174
|
+
out[base + 1] = Math.round(linearToSrgb(c[1]) * 255);
|
|
175
|
+
out[base + 2] = Math.round(linearToSrgb(c[2]) * 255);
|
|
176
|
+
}
|
|
177
|
+
return out;
|
|
178
|
+
}
|
|
179
|
+
/** Synthesise one virtual exposure as an sRGB-encoded RGB plane (0-1). */
|
|
180
|
+
function synthesiseExposure(hdr, n, gain) {
|
|
181
|
+
const out = new Float32Array(n * 3);
|
|
182
|
+
for (let i = 0; i < n * 3; i++)
|
|
183
|
+
out[i] = linearToSrgb(Math.max(0, hdr[i]) * gain);
|
|
184
|
+
return out;
|
|
185
|
+
}
|
|
186
|
+
/** Mertens per-pixel weight: contrast x saturation x well-exposedness. */
|
|
187
|
+
function exposureWeights(rgb, width, height) {
|
|
188
|
+
const n = width * height;
|
|
189
|
+
const y = new Float32Array(n);
|
|
190
|
+
for (let p = 0; p < n; p++)
|
|
191
|
+
y[p] = luminance(rgb[p * 3], rgb[p * 3 + 1], rgb[p * 3 + 2]);
|
|
192
|
+
// Contrast: |Laplacian| of the luminance.
|
|
193
|
+
const sample = (x, j) => y[Math.min(height - 1, Math.max(0, j)) * width + Math.min(width - 1, Math.max(0, x))];
|
|
194
|
+
const sigma = 0.2;
|
|
195
|
+
const out = new Float32Array(n);
|
|
196
|
+
for (let j = 0; j < height; j++) {
|
|
197
|
+
for (let i = 0; i < width; i++) {
|
|
198
|
+
const p = j * width + i;
|
|
199
|
+
const lap = Math.abs(sample(i, j - 1) +
|
|
200
|
+
sample(i, j + 1) +
|
|
201
|
+
sample(i - 1, j) +
|
|
202
|
+
sample(i + 1, j) -
|
|
203
|
+
4 * sample(i, j));
|
|
204
|
+
const r = rgb[p * 3];
|
|
205
|
+
const g = rgb[p * 3 + 1];
|
|
206
|
+
const b = rgb[p * 3 + 2];
|
|
207
|
+
const mean = (r + g + b) / 3;
|
|
208
|
+
const sat = Math.sqrt(((r - mean) ** 2 + (g - mean) ** 2 + (b - mean) ** 2) / 3);
|
|
209
|
+
const well = Math.exp(-((r - 0.5) ** 2) / (2 * sigma * sigma)) *
|
|
210
|
+
Math.exp(-((g - 0.5) ** 2) / (2 * sigma * sigma)) *
|
|
211
|
+
Math.exp(-((b - 0.5) ** 2) / (2 * sigma * sigma));
|
|
212
|
+
out[p] = lap * sat * well + 1e-12;
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
return out;
|
|
216
|
+
}
|
|
217
|
+
const KERNEL = [0.0625, 0.25, 0.375, 0.25, 0.0625];
|
|
218
|
+
/** Separable 5-tap Gaussian downsample by 2 (ceil dimensions). */
|
|
219
|
+
function downsample(plane) {
|
|
220
|
+
const { width: w, height: h, data, channels } = plane;
|
|
221
|
+
const nw = Math.max(1, Math.ceil(w / 2));
|
|
222
|
+
const nh = Math.max(1, Math.ceil(h / 2));
|
|
223
|
+
const tmp = new Float32Array(nw * h * channels);
|
|
224
|
+
const clampX = (x) => Math.min(w - 1, Math.max(0, x));
|
|
225
|
+
for (let j = 0; j < h; j++) {
|
|
226
|
+
for (let i = 0; i < nw; i++) {
|
|
227
|
+
const cx = i * 2;
|
|
228
|
+
for (let c = 0; c < channels; c++) {
|
|
229
|
+
let s = 0;
|
|
230
|
+
for (let t = -2; t <= 2; t++)
|
|
231
|
+
s += KERNEL[t + 2] * data[(j * w + clampX(cx + t)) * channels + c];
|
|
232
|
+
tmp[(j * nw + i) * channels + c] = s;
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
const out = new Float32Array(nw * nh * channels);
|
|
237
|
+
const clampY = (yy) => Math.min(h - 1, Math.max(0, yy));
|
|
238
|
+
for (let j = 0; j < nh; j++) {
|
|
239
|
+
const cy = j * 2;
|
|
240
|
+
for (let i = 0; i < nw; i++) {
|
|
241
|
+
for (let c = 0; c < channels; c++) {
|
|
242
|
+
let s = 0;
|
|
243
|
+
for (let t = -2; t <= 2; t++)
|
|
244
|
+
s += KERNEL[t + 2] * tmp[(clampY(cy + t) * nw + i) * channels + c];
|
|
245
|
+
out[(j * nw + i) * channels + c] = s;
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
return { width: nw, height: nh, data: out, channels };
|
|
250
|
+
}
|
|
251
|
+
/** Bilinear upsample to a target size (adequate for pyramid reconstruction). */
|
|
252
|
+
function upsample(plane, tw, th) {
|
|
253
|
+
const { width: w, height: h, data, channels } = plane;
|
|
254
|
+
const out = new Float32Array(tw * th * channels);
|
|
255
|
+
for (let j = 0; j < th; j++) {
|
|
256
|
+
const sy = (j * h) / th;
|
|
257
|
+
const y0 = Math.min(h - 1, Math.floor(sy));
|
|
258
|
+
const y1 = Math.min(h - 1, y0 + 1);
|
|
259
|
+
const fy = sy - y0;
|
|
260
|
+
for (let i = 0; i < tw; i++) {
|
|
261
|
+
const sx = (i * w) / tw;
|
|
262
|
+
const x0 = Math.min(w - 1, Math.floor(sx));
|
|
263
|
+
const x1 = Math.min(w - 1, x0 + 1);
|
|
264
|
+
const fx = sx - x0;
|
|
265
|
+
for (let c = 0; c < channels; c++) {
|
|
266
|
+
const a = data[(y0 * w + x0) * channels + c];
|
|
267
|
+
const b = data[(y0 * w + x1) * channels + c];
|
|
268
|
+
const cc = data[(y1 * w + x0) * channels + c];
|
|
269
|
+
const dd = data[(y1 * w + x1) * channels + c];
|
|
270
|
+
out[(j * tw + i) * channels + c] =
|
|
271
|
+
a * (1 - fx) * (1 - fy) + b * fx * (1 - fy) + cc * (1 - fx) * fy + dd * fx * fy;
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
return { width: tw, height: th, data: out, channels };
|
|
276
|
+
}
|
|
277
|
+
function gaussianPyramid(plane, levels) {
|
|
278
|
+
const pyramid = [plane];
|
|
279
|
+
for (let l = 1; l < levels; l++)
|
|
280
|
+
pyramid.push(downsample(pyramid[l - 1]));
|
|
281
|
+
return pyramid;
|
|
282
|
+
}
|
|
283
|
+
function laplacianPyramid(plane, levels) {
|
|
284
|
+
const gauss = gaussianPyramid(plane, levels);
|
|
285
|
+
const laplacian = [];
|
|
286
|
+
for (let l = 0; l < levels - 1; l++) {
|
|
287
|
+
const up = upsample(gauss[l + 1], gauss[l].width, gauss[l].height);
|
|
288
|
+
const diff = new Float32Array(gauss[l].data.length);
|
|
289
|
+
for (let i = 0; i < diff.length; i++)
|
|
290
|
+
diff[i] = gauss[l].data[i] - up.data[i];
|
|
291
|
+
laplacian.push({
|
|
292
|
+
width: gauss[l].width,
|
|
293
|
+
height: gauss[l].height,
|
|
294
|
+
data: diff,
|
|
295
|
+
channels: plane.channels,
|
|
296
|
+
});
|
|
297
|
+
}
|
|
298
|
+
laplacian.push(gauss[levels - 1]);
|
|
299
|
+
return laplacian;
|
|
300
|
+
}
|
|
301
|
+
/**
|
|
302
|
+
* Exposure fusion tone map. Synthesises `exposureCount` exposures around an
|
|
303
|
+
* auto middle-grey EV0, blends them with Mertens weights over a Laplacian
|
|
304
|
+
* pyramid, and returns interleaved 8-bit sRGB RGB.
|
|
305
|
+
*/
|
|
306
|
+
export function exposureFusion(data, width, height, options = {}) {
|
|
307
|
+
const evStep = options.evStep ?? 2;
|
|
308
|
+
const count = Math.max(1, options.exposureCount ?? 5);
|
|
309
|
+
const n = width * height;
|
|
310
|
+
const ev0Gain = middleGreyGain(data);
|
|
311
|
+
const levels = Math.max(2, Math.floor(Math.log2(Math.min(width, height))) - 1);
|
|
312
|
+
const half = (count - 1) / 2;
|
|
313
|
+
// Synthesise exposures and their (unnormalised) weights.
|
|
314
|
+
const images = [];
|
|
315
|
+
const weights = [];
|
|
316
|
+
const weightSum = new Float32Array(n);
|
|
317
|
+
for (let k = 0; k < count; k++) {
|
|
318
|
+
const gain = ev0Gain * 2 ** ((k - half) * evStep);
|
|
319
|
+
const image = synthesiseExposure(data, n, gain);
|
|
320
|
+
const weight = exposureWeights(image, width, height);
|
|
321
|
+
images.push(image);
|
|
322
|
+
weights.push(weight);
|
|
323
|
+
for (let p = 0; p < n; p++)
|
|
324
|
+
weightSum[p] += weight[p];
|
|
325
|
+
}
|
|
326
|
+
for (const weight of weights)
|
|
327
|
+
for (let p = 0; p < n; p++)
|
|
328
|
+
weight[p] /= weightSum[p];
|
|
329
|
+
// Blend in the Laplacian domain: fused L = sum_k L(image_k) * G(weight_k).
|
|
330
|
+
let fused;
|
|
331
|
+
for (let k = 0; k < count; k++) {
|
|
332
|
+
const imageLaplacian = laplacianPyramid({ width, height, data: images[k], channels: 3 }, levels);
|
|
333
|
+
const weightGaussian = gaussianPyramid({ width, height, data: weights[k], channels: 1 }, levels);
|
|
334
|
+
if (!fused) {
|
|
335
|
+
fused = imageLaplacian.map((p) => ({
|
|
336
|
+
width: p.width,
|
|
337
|
+
height: p.height,
|
|
338
|
+
data: new Float32Array(p.data.length),
|
|
339
|
+
channels: 3,
|
|
340
|
+
}));
|
|
341
|
+
}
|
|
342
|
+
for (let l = 0; l < levels; l++) {
|
|
343
|
+
const laplacian = imageLaplacian[l].data;
|
|
344
|
+
const weight = weightGaussian[l].data;
|
|
345
|
+
const destination = fused[l].data;
|
|
346
|
+
const pixels = fused[l].width * fused[l].height;
|
|
347
|
+
for (let p = 0; p < pixels; p++) {
|
|
348
|
+
const w = weight[p];
|
|
349
|
+
destination[p * 3] += laplacian[p * 3] * w;
|
|
350
|
+
destination[p * 3 + 1] += laplacian[p * 3 + 1] * w;
|
|
351
|
+
destination[p * 3 + 2] += laplacian[p * 3 + 2] * w;
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
// Collapse the fused Laplacian pyramid back to full resolution.
|
|
356
|
+
let accumulator = fused[levels - 1];
|
|
357
|
+
for (let l = levels - 2; l >= 0; l--) {
|
|
358
|
+
const up = upsample(accumulator, fused[l].width, fused[l].height);
|
|
359
|
+
const sum = new Float32Array(up.data.length);
|
|
360
|
+
for (let i = 0; i < sum.length; i++)
|
|
361
|
+
sum[i] = up.data[i] + fused[l].data[i];
|
|
362
|
+
accumulator = { width: fused[l].width, height: fused[l].height, data: sum, channels: 3 };
|
|
363
|
+
}
|
|
364
|
+
const out = Buffer.alloc(n * 3);
|
|
365
|
+
for (let i = 0; i < n * 3; i++)
|
|
366
|
+
out[i] = Math.round(clamp01(accumulator.data[i]) * 255);
|
|
367
|
+
return out;
|
|
368
|
+
}
|
|
369
|
+
//# sourceMappingURL=tonemap.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tonemap.js","sourceRoot":"","sources":["../src/tonemap.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,MAAM,OAAO,GAAG,CAAC,CAAS,EAAU,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAEnE,wDAAwD;AACxD,SAAS,YAAY,CAAC,KAAa;IACjC,MAAM,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC;IACzB,OAAO,CAAC,IAAI,SAAS,CAAC,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,IAAI,CAAC,CAAC,GAAG,GAAG,CAAC,GAAG,KAAK,CAAC;AACrE,CAAC;AAED,mCAAmC;AACnC,SAAS,SAAS,CAAC,CAAS,EAAE,CAAS,EAAE,CAAS;IAChD,OAAO,MAAM,GAAG,CAAC,GAAG,MAAM,GAAG,CAAC,GAAG,MAAM,GAAG,CAAC,CAAC;AAC9C,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,WAAW,CAAC,IAAkB,EAAE,KAAa,EAAE,MAAc;IAC3E,MAAM,GAAG,GAAG,MAAM,CAAC,KAAK,CAAC,KAAK,GAAG,MAAM,GAAG,CAAC,CAAC,CAAC;IAC7C,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,KAAK,GAAG,MAAM,EAAE,KAAK,EAAE,EAAE,CAAC;QACpD,MAAM,IAAI,GAAG,KAAK,GAAG,CAAC,CAAC;QACvB,MAAM,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CA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C,CAAC,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC;IACxF,OAAO,GAAG,CAAC;AACb,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,14 +1,23 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@realsee/hdr-toolbox",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.2",
|
|
4
4
|
"description": "Compose, extract, and convert Android Ultra HDR JPEG images",
|
|
5
|
-
"
|
|
6
|
-
|
|
5
|
+
"keywords": [
|
|
6
|
+
"cli",
|
|
7
|
+
"exr",
|
|
8
|
+
"gain map",
|
|
9
|
+
"gainmap",
|
|
10
|
+
"hdr",
|
|
11
|
+
"ultra hdr"
|
|
12
|
+
],
|
|
13
|
+
"license": "SEE LICENSE IN LICENSE.txt",
|
|
14
|
+
"author": "BEIKE REALSEE TECHNOLOGY (HK) LIMITED",
|
|
7
15
|
"bin": {
|
|
8
16
|
"hdr-toolbox": "./dist/cli.js"
|
|
9
17
|
},
|
|
10
18
|
"files": [
|
|
11
19
|
"dist",
|
|
20
|
+
"LICENSE.txt",
|
|
12
21
|
"README.md"
|
|
13
22
|
],
|
|
14
23
|
"type": "module",
|
|
@@ -33,7 +42,7 @@
|
|
|
33
42
|
"prepack": "npm run build"
|
|
34
43
|
},
|
|
35
44
|
"dependencies": {
|
|
36
|
-
"@realsee/equirect-toolbox": "^1.0.
|
|
45
|
+
"@realsee/equirect-toolbox": "^1.0.7",
|
|
37
46
|
"commander": "^15.0.0",
|
|
38
47
|
"sharp": "^0.35.4"
|
|
39
48
|
},
|