Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(288)

Side by Side Diff: ui/gfx/color_space_win.cc

Issue 2503063002: media: Inform VideoBlit/MFTransform of video color information (Closed)
Patch Set: flag controlled, updated dx11 path Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "ui/gfx/color_space_win.h"
6
7 namespace gfx {
8
9 DXVA2_ExtendedFormat ColorSpaceWin::GetExtendedFormat(
10 const ColorSpace& color_space) {
11 DXVA2_ExtendedFormat format;
12 memset(&format, 0, sizeof(format));
13 format.SampleFormat = DXVA2_SampleProgressiveFrame;
14 format.VideoLighting = DXVA2_VideoLighting_dim;
15 format.NominalRange = DXVA2_NominalRange_16_235;
16 format.VideoTransferMatrix = DXVA2_VideoTransferMatrix_BT709;
17 format.VideoPrimaries = DXVA2_VideoPrimaries_BT709;
18 format.VideoTransferFunction = DXVA2_VideoTransFunc_709;
19
20 switch (color_space.range_) {
21 case gfx::ColorSpace::RangeID::LIMITED:
22 format.NominalRange = DXVA2_NominalRange_16_235;
23 break;
24 case gfx::ColorSpace::RangeID::FULL:
25 format.NominalRange = DXVA2_NominalRange_0_255;
26 break;
27 }
28
29 switch (color_space.transfer_) {
30 case gfx::ColorSpace::MatrixID::BT709:
31 format.VideoTransferMatrix = DXVA2_VideoTransferMatrix_BT709;
32 break;
33 case gfx::ColorSpace::MatrixID::BT470BG:
34 case gfx::ColorSpace::MatrixID::SMPTE170M:
35 format.VideoTransferMatrix = DXVA2_VideoTransferMatrix_BT601;
36 break;
37 case gfx::ColorSpace::MatrixID::SMPTE240M:
38 format.VideoTransferMatrix = DXVA2_VideoTransferMatrix_SMPTE240M;
39 break;
40 }
41
42 switch (color_space.primaries_) {
43 case gfx::ColorSpace::PrimaryID::BT709:
44 format.VideoPrimaries = DXVA2_VideoPrimaries_BT709;
45 break;
46 case gfx::ColorSpace::PrimaryID::BT470M:
47 format.VideoPrimaries = DXVA2_VideoPrimaries_BT470_2_SysM;
48 break;
49 case gfx::ColorSpace::PrimaryID::BT470BG:
50 format.VideoPrimaries = DXVA2_VideoPrimaries_BT470_2_SysBG;
51 break;
52 case gfx::ColorSpace::PrimaryID::SMPTE170M:
53 format.VideoPrimaries = DXVA2_VideoPrimaries_SMPTE170M;
54 break;
55 case gfx::ColorSpace::PrimaryID::SMPTE240M:
56 format.VideoPrimaries = DXVA2_VideoPrimaries_SMPTE240M;
57 break;
58 }
59
60 switch (color_space.transfer_) {
61 case gfx::ColorSpace::TransferID::BT709:
62 case gfx::ColorSpace::TransferID::SMPTE170M:
63 format.VideoTransferFunction = DXVA2_VideoTransFunc_709;
64 break;
65 case gfx::ColorSpace::TransferID::SMPTE240M:
66 format.VideoTransferFunction = DXVA2_VideoTransFunc_240M;
67 break;
68 case gfx::ColorSpace::TransferID::GAMMA22:
69 format.VideoTransferFunction = DXVA2_VideoTransFunc_22;
70 break;
71 case gfx::ColorSpace::TransferID::GAMMA28:
72 format.VideoTransferFunction = DXVA2_VideoTransFunc_28;
73 break;
74 case gfx::ColorSpace::TransferID::LINEAR:
75 format.VideoTransferFunction = DXVA2_VideoTransFunc_10;
76 break;
77 case gfx::ColorSpace::TransferID::IEC61966_2_1:
78 format.VideoTransferFunction = DXVA2_VideoTransFunc_sRGB;
79 break;
80 }
81
82 return format;
83 }
84
85 } // namespace gfx
OLDNEW
« media/gpu/dxva_video_decode_accelerator_win.cc ('K') | « ui/gfx/color_space_win.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698