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

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

Issue 2696963002: Replace IMFTransform with ID3D11VideoProcessor (Closed)
Patch Set: fixed all comments except one... Created 3 years, 10 months 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
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/gfx/color_space_win.h" 5 #include "ui/gfx/color_space_win.h"
6 6
7 namespace gfx { 7 namespace gfx {
8 8
9 DXVA2_ExtendedFormat ColorSpaceWin::GetExtendedFormat( 9 DXVA2_ExtendedFormat ColorSpaceWin::GetExtendedFormat(
10 const ColorSpace& color_space) { 10 const ColorSpace& color_space) {
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 case gfx::ColorSpace::TransferID::GAMMA24: 127 case gfx::ColorSpace::TransferID::GAMMA24:
128 case gfx::ColorSpace::TransferID::SMPTEST2084_NON_HDR: 128 case gfx::ColorSpace::TransferID::SMPTEST2084_NON_HDR:
129 case gfx::ColorSpace::TransferID::CUSTOM: 129 case gfx::ColorSpace::TransferID::CUSTOM:
130 // Not handled 130 // Not handled
131 break; 131 break;
132 } 132 }
133 133
134 return format; 134 return format;
135 } 135 }
136 136
137 DXGI_COLOR_SPACE_TYPE ColorSpaceWin::GetDXGIColorSpace(
138 const ColorSpace& color_space) {
139 if (color_space.matrix_ == gfx::ColorSpace::MatrixID::RGB) {
140 // For RGB, we default to FULL
141 if (color_space.range_ == gfx::ColorSpace::RangeID::LIMITED) {
142 if (color_space.primaries_ == gfx::ColorSpace::PrimaryID::BT2020) {
143 if (color_space.transfer_ == gfx::ColorSpace::TransferID::SMPTEST2084) {
144 return DXGI_COLOR_SPACE_RGB_STUDIO_G2084_NONE_P2020;
145 } else {
146 return DXGI_COLOR_SPACE_RGB_STUDIO_G22_NONE_P2020;
147 }
148 } else {
149 return DXGI_COLOR_SPACE_RGB_STUDIO_G22_NONE_P709;
150 }
151 } else {
152 if (color_space.primaries_ == gfx::ColorSpace::PrimaryID::BT2020) {
153 if (color_space.transfer_ == gfx::ColorSpace::TransferID::SMPTEST2084) {
154 return DXGI_COLOR_SPACE_RGB_FULL_G2084_NONE_P2020;
155 } else {
156 return DXGI_COLOR_SPACE_RGB_FULL_G22_NONE_P2020;
157 }
158 } else {
159 if (color_space.transfer_ == gfx::ColorSpace::TransferID::LINEAR) {
160 return DXGI_COLOR_SPACE_RGB_FULL_G10_NONE_P709;
161 } else {
162 return DXGI_COLOR_SPACE_RGB_FULL_G22_NONE_P709;
163 }
164 }
165 }
166 } else {
167 if (color_space.primaries_ == gfx::ColorSpace::PrimaryID::BT2020) {
168 if (color_space.transfer_ == gfx::ColorSpace::TransferID::SMPTEST2084) {
169 return DXGI_COLOR_SPACE_YCBCR_STUDIO_G2084_LEFT_P2020;
170 // Could also be:
171 // DXGI_COLOR_SPACE_YCBCR_STUDIO_G2084_TOPLEFT_P2020
172 } else {
173 // For YUV, we default to LIMITED
174 if (color_space.range_ == gfx::ColorSpace::RangeID::FULL) {
175 return DXGI_COLOR_SPACE_YCBCR_FULL_G22_LEFT_P2020;
176
177 } else {
178 return DXGI_COLOR_SPACE_YCBCR_STUDIO_G22_LEFT_P2020;
179 // Could also be:
180 // DXGI_COLOR_SPACE_YCBCR_STUDIO_G22_TOPLEFT_P2020
181 }
182 }
183 } else if (color_space.primaries_ == gfx::ColorSpace::PrimaryID::BT470BG ||
184 color_space.primaries_ ==
185 gfx::ColorSpace::PrimaryID::SMPTE170M) {
186 // For YUV, we default to LIMITED
187 if (color_space.range_ == gfx::ColorSpace::RangeID::FULL) {
188 return DXGI_COLOR_SPACE_YCBCR_FULL_G22_LEFT_P601;
189 } else {
190 return DXGI_COLOR_SPACE_YCBCR_STUDIO_G22_LEFT_P601;
191 }
192 } else {
193 // For YUV, we default to LIMITED
194 if (color_space.range_ == gfx::ColorSpace::RangeID::FULL) {
195 // TODO(hubbe): Check if this is correct.
196 if (color_space.transfer_ == gfx::ColorSpace::TransferID::SMPTE170M) {
197 return DXGI_COLOR_SPACE_YCBCR_FULL_G22_NONE_P709_X601;
198 } else {
199 return DXGI_COLOR_SPACE_YCBCR_FULL_G22_LEFT_P709;
200 }
201 } else {
202 return DXGI_COLOR_SPACE_YCBCR_STUDIO_G22_LEFT_P709;
203 }
204 }
205 }
206 }
207
137 } // namespace gfx 208 } // 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