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

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

Issue 2696963002: Replace IMFTransform with ID3D11VideoProcessor (Closed)
Patch Set: fixed initialization 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
« no previous file with comments | « no previous file | media/gpu/dxva_video_decode_accelerator_win.cc » ('j') | 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 #ifndef MEDIA_GPU_DXVA_VIDEO_DECODE_ACCELERATOR_WIN_H_ 5 #ifndef MEDIA_GPU_DXVA_VIDEO_DECODE_ACCELERATOR_WIN_H_
6 #define MEDIA_GPU_DXVA_VIDEO_DECODE_ACCELERATOR_WIN_H_ 6 #define MEDIA_GPU_DXVA_VIDEO_DECODE_ACCELERATOR_WIN_H_
7 7
8 #include <d3d11.h> 8 #include <d3d11_1.h>
9 #include <d3d9.h> 9 #include <d3d9.h>
10 #include <initguid.h> 10 #include <initguid.h>
11 #include <stdint.h> 11 #include <stdint.h>
12 12
13 // Work around bug in this header by disabling the relevant warning for it. 13 // Work around bug in this header by disabling the relevant warning for it.
14 // https://connect.microsoft.com/VisualStudio/feedback/details/911260/dxva2api-h -in-win8-sdk-triggers-c4201-with-w4 14 // https://connect.microsoft.com/VisualStudio/feedback/details/911260/dxva2api-h -in-win8-sdk-triggers-c4201-with-w4
15 #pragma warning(push) 15 #pragma warning(push)
16 #pragma warning(disable : 4201) 16 #pragma warning(disable : 4201)
17 #include <dxva2api.h> 17 #include <dxva2api.h>
18 #pragma warning(pop) 18 #pragma warning(pop)
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after
310 uint64_t keyed_mutex_value, 310 uint64_t keyed_mutex_value,
311 int picture_buffer_id, 311 int picture_buffer_id,
312 int input_buffer_id, 312 int input_buffer_id,
313 const gfx::ColorSpace& color_space); 313 const gfx::ColorSpace& color_space);
314 314
315 // Copies the |video_frame| to the destination |dest_texture|. 315 // Copies the |video_frame| to the destination |dest_texture|.
316 void CopyTextureOnDecoderThread( 316 void CopyTextureOnDecoderThread(
317 ID3D11Texture2D* dest_texture, 317 ID3D11Texture2D* dest_texture,
318 base::win::ScopedComPtr<IDXGIKeyedMutex> dest_keyed_mutex, 318 base::win::ScopedComPtr<IDXGIKeyedMutex> dest_keyed_mutex,
319 uint64_t keyed_mutex_value, 319 uint64_t keyed_mutex_value,
320 base::win::ScopedComPtr<IMFSample> video_frame, 320 base::win::ScopedComPtr<IMFSample> input_sample,
321 int picture_buffer_id, 321 int picture_buffer_id,
322 int input_buffer_id); 322 int input_buffer_id);
323 323
324 // Flushes the decoder device to ensure that the decoded surface is copied 324 // Flushes the decoder device to ensure that the decoded surface is copied
325 // to the target surface. |iterations| helps to maintain an upper limit on 325 // to the target surface. |iterations| helps to maintain an upper limit on
326 // the number of times we try to complete the flush operation. 326 // the number of times we try to complete the flush operation.
327 void FlushDecoder(int iterations, 327 void FlushDecoder(int iterations,
328 IDirect3DSurface9* src_surface, 328 IDirect3DSurface9* src_surface,
329 IDirect3DSurface9* dest_surface, 329 IDirect3DSurface9* dest_surface,
330 int picture_buffer_id, 330 int picture_buffer_id,
331 int input_buffer_id); 331 int input_buffer_id);
332 332
333 // Polls to wait for GPU commands to be finished on the picture buffer 333 // Polls to wait for GPU commands to be finished on the picture buffer
334 // before reusing it. 334 // before reusing it.
335 void WaitForOutputBuffer(int32_t picture_buffer_id, int count); 335 void WaitForOutputBuffer(int32_t picture_buffer_id, int count);
336 336
337 // Initializes the DX11 Video format converter media types. 337 // Initialize the DX11 video processor.
338 // Returns true on success. 338 // Returns true on success.
339 bool InitializeDX11VideoFormatConverterMediaType( 339 bool InitializeID3D11VideoProcessor(int width,
340 int width, 340 int height,
341 int height, 341 const gfx::ColorSpace& color_space);
342 const gfx::ColorSpace& color_space);
343 342
344 // Returns the output video frame dimensions (width, height). 343 // Returns the output video frame dimensions (width, height).
345 // |sample| :- This is the output sample containing the video frame. 344 // |sample| :- This is the output sample containing the video frame.
346 // |width| :- The width is returned here. 345 // |width| :- The width is returned here.
347 // |height| :- The height is returned here. 346 // |height| :- The height is returned here.
348 // Returns true on success. 347 // Returns true on success.
349 bool GetVideoFrameDimensions(IMFSample* sample, int* width, int* height); 348 bool GetVideoFrameDimensions(IMFSample* sample, int* width, int* height);
350 349
351 // Sets the output type on the |transform| to the GUID identified by the 350 // Sets the output type on the |transform| to the GUID identified by the
352 // the |output_type| parameter. The GUID can be MFVideoFormat_RGB32, 351 // the |output_type| parameter. The GUID can be MFVideoFormat_RGB32,
(...skipping 17 matching lines...) Expand all
370 // Called when we detect a stream configuration change. We reinitialize the 369 // Called when we detect a stream configuration change. We reinitialize the
371 // decoder here. 370 // decoder here.
372 void ConfigChanged(const Config& config); 371 void ConfigChanged(const Config& config);
373 372
374 uint32_t GetTextureTarget() const; 373 uint32_t GetTextureTarget() const;
375 374
376 // To expose client callbacks from VideoDecodeAccelerator. 375 // To expose client callbacks from VideoDecodeAccelerator.
377 VideoDecodeAccelerator::Client* client_; 376 VideoDecodeAccelerator::Client* client_;
378 377
379 base::win::ScopedComPtr<IMFTransform> decoder_; 378 base::win::ScopedComPtr<IMFTransform> decoder_;
380 base::win::ScopedComPtr<IMFTransform> video_format_converter_mft_;
381 379
382 base::win::ScopedComPtr<IDirect3D9Ex> d3d9_; 380 base::win::ScopedComPtr<IDirect3D9Ex> d3d9_;
383 base::win::ScopedComPtr<IDirect3DDevice9Ex> d3d9_device_ex_; 381 base::win::ScopedComPtr<IDirect3DDevice9Ex> d3d9_device_ex_;
384 base::win::ScopedComPtr<IDirect3DDeviceManager9> device_manager_; 382 base::win::ScopedComPtr<IDirect3DDeviceManager9> device_manager_;
385 base::win::ScopedComPtr<IDirect3DQuery9> query_; 383 base::win::ScopedComPtr<IDirect3DQuery9> query_;
386 384
387 base::win::ScopedComPtr<ID3D11Device> d3d11_device_; 385 base::win::ScopedComPtr<ID3D11Device> d3d11_device_;
388 base::win::ScopedComPtr<ID3D11Device> angle_device_; 386 base::win::ScopedComPtr<ID3D11Device> angle_device_;
389 base::win::ScopedComPtr<IMFDXGIDeviceManager> d3d11_device_manager_; 387 base::win::ScopedComPtr<IMFDXGIDeviceManager> d3d11_device_manager_;
390 base::win::ScopedComPtr<ID3D10Multithread> multi_threaded_; 388 base::win::ScopedComPtr<ID3D10Multithread> multi_threaded_;
391 base::win::ScopedComPtr<ID3D11DeviceContext> d3d11_device_context_; 389 base::win::ScopedComPtr<ID3D11DeviceContext> d3d11_device_context_;
392 base::win::ScopedComPtr<ID3D11Query> d3d11_query_; 390 base::win::ScopedComPtr<ID3D11Query> d3d11_query_;
393 391
392 base::win::ScopedComPtr<ID3D11VideoDevice> video_device_;
393 base::win::ScopedComPtr<ID3D11VideoContext> video_context_;
394 base::win::ScopedComPtr<ID3D11VideoProcessorEnumerator> enumerator_;
395 base::win::ScopedComPtr<ID3D11VideoProcessor> d3d11_processor_;
396
397 int processor_width_ = 0;
398 int processor_height_ = 0;
399
394 base::win::ScopedComPtr<IDirectXVideoProcessorService> 400 base::win::ScopedComPtr<IDirectXVideoProcessorService>
395 video_processor_service_; 401 video_processor_service_;
396 base::win::ScopedComPtr<IDirectXVideoProcessor> processor_; 402 base::win::ScopedComPtr<IDirectXVideoProcessor> processor_;
397 DXVA2_ProcAmpValues default_procamp_values_; 403 DXVA2_ProcAmpValues default_procamp_values_;
398 404
399 // Ideally the reset token would be a stack variable which is used while 405 // Ideally the reset token would be a stack variable which is used while
400 // creating the device manager. However it seems that the device manager 406 // creating the device manager. However it seems that the device manager
401 // holds onto the token and attempts to access it if the underlying device 407 // holds onto the token and attempts to access it if the underlying device
402 // changes. 408 // changes.
403 // TODO(ananta): This needs to be verified. 409 // TODO(ananta): This needs to be verified.
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
519 // H/W decoding. 525 // H/W decoding.
520 bool use_dx11_; 526 bool use_dx11_;
521 527
522 // True when using Microsoft's VP9 HMFT for decoding. 528 // True when using Microsoft's VP9 HMFT for decoding.
523 bool using_ms_vp9_mft_ = false; 529 bool using_ms_vp9_mft_ = false;
524 530
525 // True if we should use DXGI keyed mutexes to synchronize between the two 531 // True if we should use DXGI keyed mutexes to synchronize between the two
526 // contexts. 532 // contexts.
527 bool use_keyed_mutex_; 533 bool use_keyed_mutex_;
528 534
529 // Set to true if the DX11 video format converter input media types need to
530 // be initialized. Defaults to true.
531 bool dx11_video_format_converter_media_type_needs_init_;
532
533 // Color spaced used when initializing the dx11 format converter. 535 // Color spaced used when initializing the dx11 format converter.
534 gfx::ColorSpace dx11_converter_color_space_; 536 gfx::ColorSpace dx11_converter_color_space_;
535 537
536 // Set to true if we are sharing ANGLE's device. 538 // Set to true if we are sharing ANGLE's device.
537 bool using_angle_device_; 539 bool using_angle_device_;
538 540
539 // Enables experimental hardware acceleration for VP8/VP9 video decoding. 541 // Enables experimental hardware acceleration for VP8/VP9 video decoding.
540 const gpu::GpuPreferences::VpxDecodeVendors enable_accelerated_vpx_decode_; 542 const gpu::GpuPreferences::VpxDecodeVendors enable_accelerated_vpx_decode_;
541 543
542 // The media foundation H.264 decoder has problems handling changes like 544 // The media foundation H.264 decoder has problems handling changes like
(...skipping 14 matching lines...) Expand all
557 559
558 // Function pointer for the MFCreateDXGIDeviceManager API. 560 // Function pointer for the MFCreateDXGIDeviceManager API.
559 static CreateDXGIDeviceManager create_dxgi_device_manager_; 561 static CreateDXGIDeviceManager create_dxgi_device_manager_;
560 562
561 DISALLOW_COPY_AND_ASSIGN(DXVAVideoDecodeAccelerator); 563 DISALLOW_COPY_AND_ASSIGN(DXVAVideoDecodeAccelerator);
562 }; 564 };
563 565
564 } // namespace media 566 } // namespace media
565 567
566 #endif // MEDIA_GPU_DXVA_VIDEO_DECODE_ACCELERATOR_WIN_H_ 568 #endif // MEDIA_GPU_DXVA_VIDEO_DECODE_ACCELERATOR_WIN_H_
OLDNEW
« no previous file with comments | « no previous file | media/gpu/dxva_video_decode_accelerator_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698