Commit da6c4aa6 authored by Fredrik Hubinette's avatar Fredrik Hubinette Committed by Commit Bot

Prefer the color spaces from the frames in AOM codec

Frames have more granular information than the container,
so let's use the color space from the frames rather than
from the container.

BUG=870050

Cq-Include-Trybots: luci.chromium.try:android_optional_gpu_tests_rel;luci.chromium.try:linux_optional_gpu_tests_rel;luci.chromium.try:mac_optional_gpu_tests_rel;luci.chromium.try:win_optional_gpu_tests_rel
Change-Id: I4dd972561dd85f8ddce3ca55a01e34dc3a8cf386
Reviewed-on: https://chromium-review.googlesource.com/1155785
Commit-Queue: Fredrik Hubinette <hubbe@chromium.org>
Reviewed-by: default avatarTom Finegan <tomfinegan@chromium.org>
Reviewed-by: default avatarDale Curtis <dalecurtis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#579991}
parent cfbfa60d
......@@ -108,15 +108,6 @@ static VideoPixelFormat AomImgFmtToVideoPixelFormat(const aom_image_t* img) {
static void SetColorSpaceForFrame(const aom_image_t* img,
const VideoDecoderConfig& config,
VideoFrame* frame) {
// Default to the color space from the config, but if the bistream specifies
// one, prefer that instead.
if (config.color_space_info() != VideoColorSpace()) {
// config_.color_space_info() comes from the color tag which is more
// expressive than the bitstream, so prefer it over the bitstream data
// below.
frame->set_color_space(config.color_space_info().ToGfxColorSpace());
return;
}
gfx::ColorSpace::RangeID range = img->range == AOM_CR_FULL_RANGE
? gfx::ColorSpace::RangeID::FULL
......@@ -125,9 +116,14 @@ static void SetColorSpaceForFrame(const aom_image_t* img,
// AOM color space defines match ISO 23001-8:2016 via ISO/IEC 23091-4/ITU-T
// H.273.
// http://av1-spec.argondesign.com/av1-spec/av1-spec.html#color-config-semantics
frame->set_color_space(
media::VideoColorSpace(img->cp, img->tc, img->mc, range)
.ToGfxColorSpace());
media::VideoColorSpace color_space(img->cp, img->tc, img->mc, range);
// If the bitstream doesn't specify a color space, use the one
// from the container.
if (!color_space.IsSpecified())
color_space = config.color_space_info();
frame->set_color_space(color_space.ToGfxColorSpace());
}
// Copies plane of 8-bit pixels out of a 16-bit values.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment