Khronos Data Format Specification
Total Page:16
File Type:pdf, Size:1020Kb
Khronos Data Format Specification Andrew Garrard Version 1.2, Revision 1 2019-03-31 1 / 207 Khronos Data Format Specification License Information Copyright (C) 2014-2019 The Khronos Group Inc. All Rights Reserved. This specification is protected by copyright laws and contains material proprietary to the Khronos Group, Inc. It or any components may not be reproduced, republished, distributed, transmitted, displayed, broadcast, or otherwise exploited in any manner without the express prior written permission of Khronos Group. You may use this specification for implementing the functionality therein, without altering or removing any trademark, copyright or other notice from the specification, but the receipt or possession of this specification does not convey any rights to reproduce, disclose, or distribute its contents, or to manufacture, use, or sell anything that it may describe, in whole or in part. This version of the Data Format Specification is published and copyrighted by Khronos, but is not a Khronos ratified specification. Accordingly, it does not fall within the scope of the Khronos IP policy, except to the extent that sections of it are normatively referenced in ratified Khronos specifications. Such references incorporate the referenced sections into the ratified specifications, and bring those sections into the scope of the policy for those specifications. Khronos Group grants express permission to any current Promoter, Contributor or Adopter member of Khronos to copy and redistribute UNMODIFIED versions of this specification in any fashion, provided that NO CHARGE is made for the specification and the latest available update of the specification for any version of the API is used whenever possible. Such distributed specification may be reformatted AS LONG AS the contents of the specification are not changed in any way. The specification may be incorporated into a product that is sold as long as such product includes significant independent work developed by the seller. A link to the current version of this specification on the Khronos Group website should be included whenever possible with specification distributions. Khronos Group makes no, and expressly disclaims any, representations or warranties, express or implied, regarding this specification, including, without limitation, any implied warranties of merchantability or fitness for a particular purpose or non-infringement of any intellectual property. Khronos Group makes no, and expressly disclaims any, warranties, express or implied, regarding the correctness, accuracy, completeness, timeliness, and reliability of the specification. Under no circumstances will the Khronos Group, or any of its Promoters, Contributors or Members or their respective partners, officers, directors, employees, agents, or representatives be liable for any damages, whether direct, indirect, special or consequential damages for lost revenues, lost profits, or otherwise, arising from or in connection with these materials. Khronos, SYCL, SPIR, WebGL, EGL, COLLADA, StreamInput, OpenVX, OpenKCam, glTF, OpenKODE, OpenVG, OpenWF, OpenSL ES, OpenMAX, OpenMAX AL, OpenMAX IL and OpenMAX DL are trademarks and WebCL is a certification mark of the Khronos Group Inc. OpenCL is a trademark of Apple Inc. and OpenGL and OpenML are registered trademarks and the OpenGL ES and OpenGL SC logos are trademarks of Silicon Graphics International used under license by Khronos. All other product names, trademarks, and/or company names are used solely for identification and belong to their respective owners. 2 / 207 Revision number Date Release Info Author 0.1 Jan 2015 Initial sharing AG 0.2 Feb 2015 Added clarification, tables, examples AG 0.3 Feb 2015 Further cleanup AG 0.4 Apr 2015 Channel ordering standardized AG 0.5 Apr 2015 Typos and clarification AG 1.0 May 2015 Submission for 1.0 release AG 1.0 rev 2 Jun 2015 Clarifications for 1.0 release AG 1.0 rev 3 Jul 2015 Added KHR_DF_SAMPLE_DATATYPE_LINEAR AG 1.0 rev 4 Jul 2015 Clarified KHR_DF_SAMPLE_DATATYPE_LINEAR AG 1.0 rev 5 Mar 2019 Clarification and typography AG 1.1 Nov 2015 Added definitions of compressed texture formats AG 1.1 rev 2 Jan 2016 Added definitions of floating point formats AG 1.1 rev 3 Feb 2016 Fixed typo in sRGB conversion (thank you, Tom Grim!) AG 1.1 rev 4 Mar 2016 Fixed typo/clarified sRGB in ASTC, typographical improvements AG 1.1 rev 5 Mar 2016 Switch to official Khronos logo, removed scripts, restored title AG 1.1 rev 6 Jun 2016 ASTC "block footprint" note, fixed credits/changelog/contents AG 1.1 rev 7 Sep 2016 ASTC multi-point "part" and quint decode typo fixes AG 1.1 rev 8 Jun 2017 ETC2 legibility and table typo fix AG 1.1 rev 9 Mar 2019 Typo fixes and much reformatting AG 1.2 rev 0 Sep 2017 Added color conversion formulae and extra options AG 1.2 rev 1 Mar 2019 Typo fixes and much reformatting AG 3 / 207 Contents 1 Introduction 3 2 Overview 4 2.1 Glossary . .5 3 Required concepts not in the “format”8 4 Translation to API-specific representations 10 5 Data format descriptor 11 6 Descriptor block 12 7 Khronos Basic Data Format Descriptor Block 14 7.1 vendorId ................................................... 15 7.2 descriptorType ................................................ 15 7.3 versionNumber ............................................... 15 7.4 descriptorBlockSize ............................................. 15 7.5 colorModel ................................................. 16 7.5.1 KHR_DF_MODEL_UNSPECIFIED (=0) ............................ 16 7.5.2 KHR_DF_MODEL_RGBSDA (=1) ................................ 16 7.5.3 KHR_DF_MODEL_YUVSDA (=2) ................................ 17 7.5.4 KHR_DF_MODEL_YIQSDA (=3) ................................ 17 7.5.5 KHR_DF_MODEL_LABSDA (=4) ................................ 18 7.5.6 KHR_DF_MODEL_CMYKA (=5) ................................. 18 7.5.7 KHR_DF_MODEL_XYZW (=6).................................. 18 7.5.8 KHR_DF_MODEL_HSVA_ANG (=7)............................... 19 7.5.9 KHR_DF_MODEL_HSLA_ANG (=8)............................... 19 7.5.10 KHR_DF_MODEL_HSVA_HEX (=9)............................... 20 7.5.11 KHR_DF_MODEL_HSLA_HEX (= 10) . 20 7.5.12 KHR_DF_MODEL_YCGCOA (= 11) . 20 7.5.13 KHR_DF_MODEL_YCCBCCRC (= 12) . 21 7.5.14 KHR_DF_MODEL_ICTCP (= 13) . 21 7.5.15 KHR_DF_MODEL_CIEXYZ (= 14) . 22 7.5.16 KHR_DF_MODEL_CIEXYY (= 15) . 22 7.6 colorModel for compressed formats . 23 7.6.1 KHR_DF_MODEL_DXT1A/KHR_DF_MODEL_BC1A (= 128) . 23 7.6.2 KHR_DF_MODEL_DXT2/3/KHR_DF_MODEL_BC2 (= 129) . 23 7.6.3 KHR_DF_MODEL_DXT4/5/KHR_DF_MODEL_BC3 (= 130) . 23 7.6.4 KHR_DF_MODEL_BC4 (= 131) . 23 4 / 207 7.6.5 KHR_DF_MODEL_BC5 (= 132) . 23 7.6.6 KHR_DF_MODEL_BC6H (= 133) . 23 7.6.7 KHR_DF_MODEL_BC7 (= 134) . 24 7.6.8 KHR_DF_MODEL_ETC1 (= 160) . 24 7.6.9 KHR_DF_MODEL_ETC2 (= 161) . 24 7.6.10 KHR_DF_MODEL_ASTC (= 162) . 24 7.7 colorPrimaries ................................................ 25 7.7.1 KHR_DF_PRIMARIES_UNSPECIFIED (= 0) . 25 7.7.2 KHR_DF_PRIMARIES_BT709 (=1).............................. 25 7.7.3 KHR_DF_PRIMARIES_BT601_EBU (=2)........................... 25 7.7.4 KHR_DF_PRIMARIES_BT601_SMPTE (= 3) . 25 7.7.5 KHR_DF_PRIMARIES_BT2020 (=4) ............................. 25 7.7.6 KHR_DF_PRIMARIES_CIEXYZ (=5) ............................. 25 7.7.7 KHR_DF_PRIMARIES_ACES (=6)............................... 26 7.7.8 KHR_DF_PRIMARIES_ACESCC (=7) ............................. 26 7.7.9 KHR_DF_PRIMARIES_NTSC1953 (=8)............................ 26 7.7.10 KHR_DF_PRIMARIES_PAL525 (=9) ............................. 26 7.7.11 KHR_DF_PRIMARIES_DISPLAYP3 (= 10) . 26 7.7.12 KHR_DF_PRIMARIES_ADOBERGB (= 11) . 26 7.8 transferFunction .............................................. 27 7.8.1 KHR_DF_TRANSFER_UNSPECIFIED (= 0) . 27 7.8.2 KHR_DF_TRANSFER_LINEAR (=1).............................. 27 7.8.3 KHR_DF_TRANSFER_SRGB (=2)................................ 27 7.8.4 KHR_DF_TRANSFER_ITU (=3) ................................ 27 7.8.5 KHR_DF_TRANSFER_NTSC (=4)................................ 27 7.8.6 KHR_DF_TRANSFER_SLOG (=5)................................ 28 7.8.7 KHR_DF_TRANSFER_SLOG2 (=6)............................... 28 7.8.8 KHR_DF_TRANSFER_BT1886 (=7).............................. 28 7.8.9 KHR_DF_TRANSFER_HLG_OETF (=8) ............................ 28 7.8.10 KHR_DF_TRANSFER_HLG_EOTF (=9) ............................ 28 7.8.11 KHR_DF_TRANSFER_PQ_EOTF (= 10) . 28 7.8.12 KHR_DF_TRANSFER_PQ_OETF (= 11) . 28 7.8.13 KHR_DF_TRANSFER_DCIP3 (= 12) . 28 7.8.14 KHR_DF_TRANSFER_PAL_OETF (= 13) . 28 7.8.15 KHR_DF_TRANSFER_PAL625_EOTF (= 14) . 28 7.8.16 KHR_DF_TRANSFER_ST240 (= 15) . 28 7.8.17 KHR_DF_TRANSFER_ACESCC (= 16) . 29 7.8.18 KHR_DF_TRANSFER_ACESCCT (= 17) . 29 7.8.19 KHR_DF_TRANSFER_ADOBERGB (= 18) . 29 7.9 flags ..................................................... 29 7.9.1 KHR_DF_FLAG_ALPHA_PREMULTIPLIED (= 1) . 29 7.10 texelBlockDimension[0..3] ......................................... 30 7.11 bytesPlane[0..7] ............................................... 31 7.12 Sample information . 32 7.12.1 bitOffset .............................................. 32 7.12.2 bitLength ............................................. 32 7.12.3 channelType ............................................ 33 7.12.4 samplePosition[0..3] ....................................... 33 7.12.5 sampleLower ........................................... 34 7.12.6 sampleUpper ........................................... 35 5 / 207 8 Extension for more complex formats 36 9 Frequently Asked Questions 38 9.1 Why have a binary format rather than a human-readable one? . 38 9.2 Why not use an existing representation