17ec681f3Smrg/* 27ec681f3Smrg * Copyright 2018 The Android Open Source Project 37ec681f3Smrg * 47ec681f3Smrg * Licensed under the Apache License, Version 2.0 (the "License"); 57ec681f3Smrg * you may not use this file except in compliance with the License. 67ec681f3Smrg * You may obtain a copy of the License at 77ec681f3Smrg * 87ec681f3Smrg * http://www.apache.org/licenses/LICENSE-2.0 97ec681f3Smrg * 107ec681f3Smrg * Unless required by applicable law or agreed to in writing, software 117ec681f3Smrg * distributed under the License is distributed on an "AS IS" BASIS, 127ec681f3Smrg * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 137ec681f3Smrg * See the License for the specific language governing permissions and 147ec681f3Smrg * limitations under the License. 157ec681f3Smrg */ 167ec681f3Smrg 177ec681f3Smrg/** 187ec681f3Smrg * @file data_space.h 197ec681f3Smrg */ 207ec681f3Smrg 217ec681f3Smrg#ifndef ANDROID_DATA_SPACE_H 227ec681f3Smrg#define ANDROID_DATA_SPACE_H 237ec681f3Smrg 247ec681f3Smrg#include <inttypes.h> 257ec681f3Smrg 267ec681f3Smrg#include <sys/cdefs.h> 277ec681f3Smrg 287ec681f3Smrg__BEGIN_DECLS 297ec681f3Smrg 307ec681f3Smrg/** 317ec681f3Smrg * ADataSpace. 327ec681f3Smrg */ 337ec681f3Smrgenum ADataSpace { 347ec681f3Smrg /** 357ec681f3Smrg * Default-assumption data space, when not explicitly specified. 367ec681f3Smrg * 377ec681f3Smrg * It is safest to assume the buffer is an image with sRGB primaries and 387ec681f3Smrg * encoding ranges, but the consumer and/or the producer of the data may 397ec681f3Smrg * simply be using defaults. No automatic gamma transform should be 407ec681f3Smrg * expected, except for a possible display gamma transform when drawn to a 417ec681f3Smrg * screen. 427ec681f3Smrg */ 437ec681f3Smrg ADATASPACE_UNKNOWN = 0, 447ec681f3Smrg 457ec681f3Smrg /** 467ec681f3Smrg * scRGB linear encoding: 477ec681f3Smrg * 487ec681f3Smrg * The red, green, and blue components are stored in extended sRGB space, 497ec681f3Smrg * but are linear, not gamma-encoded. 507ec681f3Smrg * The RGB primaries and the white point are the same as BT.709. 517ec681f3Smrg * 527ec681f3Smrg * The values are floating point. 537ec681f3Smrg * A pixel value of 1.0, 1.0, 1.0 corresponds to sRGB white (D65) at 80 nits. 547ec681f3Smrg * Values beyond the range [0.0 - 1.0] would correspond to other colors 557ec681f3Smrg * spaces and/or HDR content. 567ec681f3Smrg */ 577ec681f3Smrg ADATASPACE_SCRGB_LINEAR = 406913024, // STANDARD_BT709 | TRANSFER_LINEAR | RANGE_EXTENDED 587ec681f3Smrg 597ec681f3Smrg /** 607ec681f3Smrg * sRGB gamma encoding: 617ec681f3Smrg * 627ec681f3Smrg * The red, green and blue components are stored in sRGB space, and 637ec681f3Smrg * converted to linear space when read, using the SRGB transfer function 647ec681f3Smrg * for each of the R, G and B components. When written, the inverse 657ec681f3Smrg * transformation is performed. 667ec681f3Smrg * 677ec681f3Smrg * The alpha component, if present, is always stored in linear space and 687ec681f3Smrg * is left unmodified when read or written. 697ec681f3Smrg * 707ec681f3Smrg * Use full range and BT.709 standard. 717ec681f3Smrg */ 727ec681f3Smrg ADATASPACE_SRGB = 142671872, // STANDARD_BT709 | TRANSFER_SRGB | RANGE_FULL 737ec681f3Smrg 747ec681f3Smrg /** 757ec681f3Smrg * scRGB: 767ec681f3Smrg * 777ec681f3Smrg * The red, green, and blue components are stored in extended sRGB space, 787ec681f3Smrg * and gamma-encoded using the SRGB transfer function. 797ec681f3Smrg * The RGB primaries and the white point are the same as BT.709. 807ec681f3Smrg * 817ec681f3Smrg * The values are floating point. 827ec681f3Smrg * A pixel value of 1.0, 1.0, 1.0 corresponds to sRGB white (D65) at 80 nits. 837ec681f3Smrg * Values beyond the range [0.0 - 1.0] would correspond to other colors 847ec681f3Smrg * spaces and/or HDR content. 857ec681f3Smrg */ 867ec681f3Smrg ADATASPACE_SCRGB = 411107328, // STANDARD_BT709 | TRANSFER_SRGB | RANGE_EXTENDED 877ec681f3Smrg 887ec681f3Smrg /** 897ec681f3Smrg * Display P3 907ec681f3Smrg * 917ec681f3Smrg * Use same primaries and white-point as DCI-P3 927ec681f3Smrg * but sRGB transfer function. 937ec681f3Smrg */ 947ec681f3Smrg ADATASPACE_DISPLAY_P3 = 143261696, // STANDARD_DCI_P3 | TRANSFER_SRGB | RANGE_FULL 957ec681f3Smrg 967ec681f3Smrg /** 977ec681f3Smrg * ITU-R Recommendation 2020 (BT.2020) 987ec681f3Smrg * 997ec681f3Smrg * Ultra High-definition television 1007ec681f3Smrg * 1017ec681f3Smrg * Use full range, SMPTE 2084 (PQ) transfer and BT2020 standard 1027ec681f3Smrg */ 1037ec681f3Smrg ADATASPACE_BT2020_PQ = 163971072, // STANDARD_BT2020 | TRANSFER_ST2084 | RANGE_FULL 1047ec681f3Smrg 1057ec681f3Smrg /** 1067ec681f3Smrg * Adobe RGB 1077ec681f3Smrg * 1087ec681f3Smrg * Use full range, gamma 2.2 transfer and Adobe RGB primaries 1097ec681f3Smrg * Note: Application is responsible for gamma encoding the data as 1107ec681f3Smrg * a 2.2 gamma encoding is not supported in HW. 1117ec681f3Smrg */ 1127ec681f3Smrg ADATASPACE_ADOBE_RGB = 151715840, // STANDARD_ADOBE_RGB | TRANSFER_GAMMA2_2 | RANGE_FULL 1137ec681f3Smrg 1147ec681f3Smrg /** 1157ec681f3Smrg * ITU-R Recommendation 2020 (BT.2020) 1167ec681f3Smrg * 1177ec681f3Smrg * Ultra High-definition television 1187ec681f3Smrg * 1197ec681f3Smrg * Use full range, BT.709 transfer and BT2020 standard 1207ec681f3Smrg */ 1217ec681f3Smrg ADATASPACE_BT2020 = 147193856, // STANDARD_BT2020 | TRANSFER_SMPTE_170M | RANGE_FULL 1227ec681f3Smrg 1237ec681f3Smrg /** 1247ec681f3Smrg * ITU-R Recommendation 709 (BT.709) 1257ec681f3Smrg * 1267ec681f3Smrg * High-definition television 1277ec681f3Smrg * 1287ec681f3Smrg * Use limited range, BT.709 transfer and BT.709 standard. 1297ec681f3Smrg */ 1307ec681f3Smrg ADATASPACE_BT709 = 281083904, // STANDARD_BT709 | TRANSFER_SMPTE_170M | RANGE_LIMITED 1317ec681f3Smrg 1327ec681f3Smrg /** 1337ec681f3Smrg * SMPTE EG 432-1 and SMPTE RP 431-2. 1347ec681f3Smrg * 1357ec681f3Smrg * Digital Cinema DCI-P3 1367ec681f3Smrg * 1377ec681f3Smrg * Use full range, gamma 2.6 transfer and D65 DCI-P3 standard 1387ec681f3Smrg * Note: Application is responsible for gamma encoding the data as 1397ec681f3Smrg * a 2.6 gamma encoding is not supported in HW. 1407ec681f3Smrg */ 1417ec681f3Smrg ADATASPACE_DCI_P3 = 155844608, // STANDARD_DCI_P3 | TRANSFER_GAMMA2_6 | RANGE_FULL 1427ec681f3Smrg 1437ec681f3Smrg /** 1447ec681f3Smrg * sRGB linear encoding: 1457ec681f3Smrg * 1467ec681f3Smrg * The red, green, and blue components are stored in sRGB space, but 1477ec681f3Smrg * are linear, not gamma-encoded. 1487ec681f3Smrg * The RGB primaries and the white point are the same as BT.709. 1497ec681f3Smrg * 1507ec681f3Smrg * The values are encoded using the full range ([0,255] for 8-bit) for all 1517ec681f3Smrg * components. 1527ec681f3Smrg */ 1537ec681f3Smrg ADATASPACE_SRGB_LINEAR = 138477568, // STANDARD_BT709 | TRANSFER_LINEAR | RANGE_FULL 1547ec681f3Smrg}; 1557ec681f3Smrg 1567ec681f3Smrg__END_DECLS 1577ec681f3Smrg 1587ec681f3Smrg#endif // ANDROID_DATA_SPACE_H 159