| Index: ui/gfx/color_space_win.cc
|
| diff --git a/ui/gfx/color_space_win.cc b/ui/gfx/color_space_win.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..b723dde2ee3b0778fc2669961ea475e11e228bf6
|
| --- /dev/null
|
| +++ b/ui/gfx/color_space_win.cc
|
| @@ -0,0 +1,85 @@
|
| +// Copyright (c) 2012 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#include "ui/gfx/color_space_win.h"
|
| +
|
| +namespace gfx {
|
| +
|
| +DXVA2_ExtendedFormat ColorSpaceWin::GetExtendedFormat(
|
| + const ColorSpace& color_space) {
|
| + DXVA2_ExtendedFormat format;
|
| + memset(&format, 0, sizeof(format));
|
| + format.SampleFormat = DXVA2_SampleProgressiveFrame;
|
| + format.VideoLighting = DXVA2_VideoLighting_dim;
|
| + format.NominalRange = DXVA2_NominalRange_16_235;
|
| + format.VideoTransferMatrix = DXVA2_VideoTransferMatrix_BT709;
|
| + format.VideoPrimaries = DXVA2_VideoPrimaries_BT709;
|
| + format.VideoTransferFunction = DXVA2_VideoTransFunc_709;
|
| +
|
| + switch (color_space.range_) {
|
| + case gfx::ColorSpace::RangeID::LIMITED:
|
| + format.NominalRange = DXVA2_NominalRange_16_235;
|
| + break;
|
| + case gfx::ColorSpace::RangeID::FULL:
|
| + format.NominalRange = DXVA2_NominalRange_0_255;
|
| + break;
|
| + }
|
| +
|
| + switch (color_space.transfer_) {
|
| + case gfx::ColorSpace::MatrixID::BT709:
|
| + format.VideoTransferMatrix = DXVA2_VideoTransferMatrix_BT709;
|
| + break;
|
| + case gfx::ColorSpace::MatrixID::BT470BG:
|
| + case gfx::ColorSpace::MatrixID::SMPTE170M:
|
| + format.VideoTransferMatrix = DXVA2_VideoTransferMatrix_BT601;
|
| + break;
|
| + case gfx::ColorSpace::MatrixID::SMPTE240M:
|
| + format.VideoTransferMatrix = DXVA2_VideoTransferMatrix_SMPTE240M;
|
| + break;
|
| + }
|
| +
|
| + switch (color_space.primaries_) {
|
| + case gfx::ColorSpace::PrimaryID::BT709:
|
| + format.VideoPrimaries = DXVA2_VideoPrimaries_BT709;
|
| + break;
|
| + case gfx::ColorSpace::PrimaryID::BT470M:
|
| + format.VideoPrimaries = DXVA2_VideoPrimaries_BT470_2_SysM;
|
| + break;
|
| + case gfx::ColorSpace::PrimaryID::BT470BG:
|
| + format.VideoPrimaries = DXVA2_VideoPrimaries_BT470_2_SysBG;
|
| + break;
|
| + case gfx::ColorSpace::PrimaryID::SMPTE170M:
|
| + format.VideoPrimaries = DXVA2_VideoPrimaries_SMPTE170M;
|
| + break;
|
| + case gfx::ColorSpace::PrimaryID::SMPTE240M:
|
| + format.VideoPrimaries = DXVA2_VideoPrimaries_SMPTE240M;
|
| + break;
|
| + }
|
| +
|
| + switch (color_space.transfer_) {
|
| + case gfx::ColorSpace::TransferID::BT709:
|
| + case gfx::ColorSpace::TransferID::SMPTE170M:
|
| + format.VideoTransferFunction = DXVA2_VideoTransFunc_709;
|
| + break;
|
| + case gfx::ColorSpace::TransferID::SMPTE240M:
|
| + format.VideoTransferFunction = DXVA2_VideoTransFunc_240M;
|
| + break;
|
| + case gfx::ColorSpace::TransferID::GAMMA22:
|
| + format.VideoTransferFunction = DXVA2_VideoTransFunc_22;
|
| + break;
|
| + case gfx::ColorSpace::TransferID::GAMMA28:
|
| + format.VideoTransferFunction = DXVA2_VideoTransFunc_28;
|
| + break;
|
| + case gfx::ColorSpace::TransferID::LINEAR:
|
| + format.VideoTransferFunction = DXVA2_VideoTransFunc_10;
|
| + break;
|
| + case gfx::ColorSpace::TransferID::IEC61966_2_1:
|
| + format.VideoTransferFunction = DXVA2_VideoTransFunc_sRGB;
|
| + break;
|
| + }
|
| +
|
| + return format;
|
| +}
|
| +
|
| +} // namespace gfx
|
|
|