Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
SDK
/
exoplayer
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
aa0d7d73
authored
Apr 19, 2023
by
tofunmi
Committed by
Rohit Singh
Apr 24, 2023
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Add srgb color transfer
PiperOrigin-RevId: 525467798
parent
9406410c
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
5 deletions
libraries/common/src/main/java/androidx/media3/common/C.java
libraries/common/src/main/java/androidx/media3/common/ColorInfo.java
libraries/common/src/main/java/androidx/media3/common/util/MediaFormatUtil.java
libraries/common/src/main/java/androidx/media3/common/C.java
View file @
aa0d7d73
...
...
@@ -1111,9 +1111,9 @@ public final class C {
// LINT.IfChange(color_transfer)
/**
* Video color transfer characteristics. One of {@link Format#NO_VALUE}, {@link
* #COLOR_TRANSFER_LINEAR}, {@link #COLOR_TRANSFER_SDR}, {@link #COLOR_TRANSFER_
GAMMA_2_2}
{@link
* #COLOR_TRANSFER_ST2084} or {@link #COLOR_TRANSFER_HLG}.
* Video
/image
color transfer characteristics. One of {@link Format#NO_VALUE}, {@link
* #COLOR_TRANSFER_LINEAR}, {@link #COLOR_TRANSFER_SDR}, {@link #COLOR_TRANSFER_
SRGB},
{@link
* #COLOR_TRANSFER_
GAMMA_2_2}, {@link #COLOR_TRANSFER_
ST2084} or {@link #COLOR_TRANSFER_HLG}.
*/
@UnstableApi
@Documented
...
...
@@ -1123,6 +1123,7 @@ public final class C {
Format
.
NO_VALUE
,
COLOR_TRANSFER_LINEAR
,
COLOR_TRANSFER_SDR
,
COLOR_TRANSFER_SRGB
,
COLOR_TRANSFER_GAMMA_2_2
,
COLOR_TRANSFER_ST2084
,
COLOR_TRANSFER_HLG
...
...
@@ -1133,6 +1134,13 @@ public final class C {
/** See {@link MediaFormat#COLOR_TRANSFER_SDR_VIDEO}. The SMPTE 170M transfer function. */
@UnstableApi
public
static
final
int
COLOR_TRANSFER_SDR
=
MediaFormat
.
COLOR_TRANSFER_SDR_VIDEO
;
/**
* See {@link android.hardware.DataSpace#TRANSFER_SRGB}. The standard RGB transfer function, used
* for some SDR use-cases like image input.
*/
// Value sourced from ordering here:
// https://cs.android.com/android/platform/superproject/+/master:frameworks/native/headers/media_plugin/media/hardware/VideoAPI.h;drc=55e9bd7c487ee235631f302ab8626776547ac913;l=138.
@UnstableApi
public
static
final
int
COLOR_TRANSFER_SRGB
=
2
;
/**
* See {@link android.hardware.DataSpace#TRANSFER_GAMMA2_2}. The Gamma 2.2 transfer function, used
* for some SDR use-cases like tone-mapping.
*/
...
...
libraries/common/src/main/java/androidx/media3/common/ColorInfo.java
View file @
aa0d7d73
...
...
@@ -131,6 +131,17 @@ public final class ColorInfo implements Bundleable {
/* hdrStaticInfo= */
null
);
/**
* Color info representing SDR sRGB in accordance with {@link
* android.hardware.DataSpace#DATASPACE_SRGB}, which is a common SDR image color format.
*/
public
static
final
ColorInfo
SRGB_FULL
=
new
ColorInfo
.
Builder
()
.
setColorSpace
(
C
.
COLOR_SPACE_BT709
)
.
setColorRange
(
C
.
COLOR_RANGE_FULL
)
.
setColorTransfer
(
C
.
COLOR_TRANSFER_SRGB
)
.
build
();
/**
* Returns the {@link C.ColorSpace} corresponding to the given ISO color primary code, as per
* table A.7.21.1 in Rec. ITU-T T.832 (03/2009), or {@link Format#NO_VALUE} if no mapping can be
* made.
...
...
@@ -165,6 +176,10 @@ public final class ColorInfo implements Bundleable {
case
6
:
// SMPTE 170M.
case
7
:
// SMPTE 240M.
return
C
.
COLOR_TRANSFER_SDR
;
case
4
:
return
C
.
COLOR_TRANSFER_GAMMA_2_2
;
case
13
:
return
C
.
COLOR_TRANSFER_SRGB
;
case
16
:
return
C
.
COLOR_TRANSFER_ST2084
;
case
18
:
...
...
@@ -308,6 +323,8 @@ public final class ColorInfo implements Bundleable {
return
"Linear"
;
case
C
.
COLOR_TRANSFER_SDR
:
return
"SDR SMPTE 170M"
;
case
C
.
COLOR_TRANSFER_SRGB
:
return
"sRGB"
;
case
C
.
COLOR_TRANSFER_GAMMA_2_2
:
return
"Gamma 2.2"
;
case
C
.
COLOR_TRANSFER_ST2084
:
...
...
libraries/common/src/main/java/androidx/media3/common/util/MediaFormatUtil.java
View file @
aa0d7d73
...
...
@@ -366,8 +366,8 @@ public final class MediaFormatUtil {
/** Whether this is a valid {@link C.ColorTransfer} instance. */
private
static
boolean
isValidColorTransfer
(
int
colorTransfer
)
{
// LINT.IfChange(color_transfer)
// C.COLOR_TRANSFER_GAMMA_2_2
isn't valid because MediaCodec, and hence MediaFormat, does not
//
support it
.
// C.COLOR_TRANSFER_GAMMA_2_2
& C.COLOR_TRANSFER_SRGB aren't valid because MediaCodec, and
//
hence MediaFormat, do not support them
.
return
colorTransfer
==
C
.
COLOR_TRANSFER_LINEAR
||
colorTransfer
==
C
.
COLOR_TRANSFER_SDR
||
colorTransfer
==
C
.
COLOR_TRANSFER_ST2084
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment