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

Side by Side Diff: media/gpu/dxva_video_decode_accelerator_win.cc

Issue 2768643002: Suport for hybrid-log-gamma in DXVA (Closed)
Patch Set: Created 3 years, 9 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "media/gpu/dxva_video_decode_accelerator_win.h" 5 #include "media/gpu/dxva_video_decode_accelerator_win.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #if !defined(OS_WIN) 9 #if !defined(OS_WIN)
10 #error This file should only be built on Windows. 10 #error This file should only be built on Windows.
(...skipping 2819 matching lines...) Expand 10 before | Expand all | Expand 10 after
2830 dx11_converter_output_color_space_ = gfx::ColorSpace::CreateSRGB(); 2830 dx11_converter_output_color_space_ = gfx::ColorSpace::CreateSRGB();
2831 if (use_color_info_ || use_fp16_) { 2831 if (use_color_info_ || use_fp16_) {
2832 base::win::ScopedComPtr<ID3D11VideoContext1> video_context1; 2832 base::win::ScopedComPtr<ID3D11VideoContext1> video_context1;
2833 HRESULT hr = video_context_.QueryInterface(video_context1.Receive()); 2833 HRESULT hr = video_context_.QueryInterface(video_context1.Receive());
2834 if (SUCCEEDED(hr)) { 2834 if (SUCCEEDED(hr)) {
2835 if (use_fp16_ && base::CommandLine::ForCurrentProcess()->HasSwitch( 2835 if (use_fp16_ && base::CommandLine::ForCurrentProcess()->HasSwitch(
2836 switches::kEnableHDR)) { 2836 switches::kEnableHDR)) {
2837 dx11_converter_output_color_space_ = 2837 dx11_converter_output_color_space_ =
2838 gfx::ColorSpace::CreateSCRGBLinear(); 2838 gfx::ColorSpace::CreateSCRGBLinear();
2839 } 2839 }
2840 video_context1->VideoProcessorSetStreamColorSpace1( 2840 // Since the video processor doesn't support HLG, let's just do the
2841 d3d11_processor_.get(), 0, 2841 // YUV->RGB conversion and let the output color space be HLG.
2842 gfx::ColorSpaceWin::GetDXGIColorSpace(color_space)); 2842 // This won't work well unless color management is on, but if color
2843 video_context1->VideoProcessorSetOutputColorSpace1( 2843 // management is off we don't support HLG anyways.
2844 d3d11_processor_.get(), gfx::ColorSpaceWin::GetDXGIColorSpace( 2844 if (color_space ==
2845 dx11_converter_output_color_space_)); 2845 gfx::ColorSpace(gfx::ColorSpace::PrimaryID::BT2020,
2846 gfx::ColorSpace::TransferID::ARIB_STD_B67,
2847 gfx::ColorSpace::MatrixID::BT709,
2848 gfx::ColorSpace::RangeID::LIMITED)) {
ccameron 2017/03/22 18:39:33 Might make sense to add a ::CreateXXXX if this is
2849 video_context1->VideoProcessorSetStreamColorSpace1(
2850 d3d11_processor_.get(), 0,
2851 DXGI_COLOR_SPACE_YCBCR_STUDIO_G2084_LEFT_P2020);
2852 video_context1->VideoProcessorSetOutputColorSpace1(
2853 d3d11_processor_.get(),
2854 DXGI_COLOR_SPACE_RGB_FULL_G2084_NONE_P2020);
2855 dx11_converter_output_color_space_ = color_space.GetAsFullRangeRGB();
2856 } else {
2857 video_context1->VideoProcessorSetStreamColorSpace1(
2858 d3d11_processor_.get(), 0,
2859 gfx::ColorSpaceWin::GetDXGIColorSpace(color_space));
2860 video_context1->VideoProcessorSetOutputColorSpace1(
2861 d3d11_processor_.get(), gfx::ColorSpaceWin::GetDXGIColorSpace(
2862 dx11_converter_output_color_space_));
2863 }
2846 } else { 2864 } else {
2847 D3D11_VIDEO_PROCESSOR_COLOR_SPACE d3d11_color_space = 2865 D3D11_VIDEO_PROCESSOR_COLOR_SPACE d3d11_color_space =
2848 gfx::ColorSpaceWin::GetD3D11ColorSpace(color_space); 2866 gfx::ColorSpaceWin::GetD3D11ColorSpace(color_space);
2849 video_context_->VideoProcessorSetStreamColorSpace( 2867 video_context_->VideoProcessorSetStreamColorSpace(
2850 d3d11_processor_.get(), 0, &d3d11_color_space); 2868 d3d11_processor_.get(), 0, &d3d11_color_space);
2851 d3d11_color_space = gfx::ColorSpaceWin::GetD3D11ColorSpace( 2869 d3d11_color_space = gfx::ColorSpaceWin::GetD3D11ColorSpace(
2852 dx11_converter_output_color_space_); 2870 dx11_converter_output_color_space_);
2853 video_context_->VideoProcessorSetOutputColorSpace( 2871 video_context_->VideoProcessorSetOutputColorSpace(
2854 d3d11_processor_.get(), &d3d11_color_space); 2872 d3d11_processor_.get(), &d3d11_color_space);
2855 } 2873 }
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
2956 base::Bind(&DXVAVideoDecodeAccelerator::DecodePendingInputBuffers, 2974 base::Bind(&DXVAVideoDecodeAccelerator::DecodePendingInputBuffers,
2957 base::Unretained(this))); 2975 base::Unretained(this)));
2958 } 2976 }
2959 2977
2960 uint32_t DXVAVideoDecodeAccelerator::GetTextureTarget() const { 2978 uint32_t DXVAVideoDecodeAccelerator::GetTextureTarget() const {
2961 bool provide_nv12_textures = share_nv12_textures_ || copy_nv12_textures_; 2979 bool provide_nv12_textures = share_nv12_textures_ || copy_nv12_textures_;
2962 return provide_nv12_textures ? GL_TEXTURE_EXTERNAL_OES : GL_TEXTURE_2D; 2980 return provide_nv12_textures ? GL_TEXTURE_EXTERNAL_OES : GL_TEXTURE_2D;
2963 } 2981 }
2964 2982
2965 } // namespace media 2983 } // namespace media
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698