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

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

Issue 2229353002: V4L2SVDA: Add a VP9Accelerator implementation utilizing the V4L2 VP9 frame API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: compilation fixes Created 4 years, 3 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 | « media/gpu/v4l2_device.cc ('k') | media/gpu/v4l2_slice_video_decode_accelerator.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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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_V4L2_SLICE_VIDEO_DECODE_ACCELERATOR_H_ 5 #ifndef MEDIA_GPU_V4L2_SLICE_VIDEO_DECODE_ACCELERATOR_H_
6 #define MEDIA_GPU_V4L2_SLICE_VIDEO_DECODE_ACCELERATOR_H_ 6 #define MEDIA_GPU_V4L2_SLICE_VIDEO_DECODE_ACCELERATOR_H_
7 7
8 #include <linux/videodev2.h> 8 #include <linux/videodev2.h>
9 #include <stddef.h> 9 #include <stddef.h>
10 #include <stdint.h> 10 #include <stdint.h>
11 11
12 #include <memory> 12 #include <memory>
13 #include <queue> 13 #include <queue>
14 #include <utility> 14 #include <utility>
15 #include <vector> 15 #include <vector>
16 16
17 #include "base/macros.h" 17 #include "base/macros.h"
18 #include "base/memory/linked_ptr.h" 18 #include "base/memory/linked_ptr.h"
19 #include "base/memory/ref_counted.h" 19 #include "base/memory/ref_counted.h"
20 #include "base/memory/weak_ptr.h" 20 #include "base/memory/weak_ptr.h"
21 #include "base/synchronization/waitable_event.h" 21 #include "base/synchronization/waitable_event.h"
22 #include "base/threading/thread.h" 22 #include "base/threading/thread.h"
23 #include "media/gpu/gpu_video_decode_accelerator_helpers.h" 23 #include "media/gpu/gpu_video_decode_accelerator_helpers.h"
24 #include "media/gpu/h264_decoder.h" 24 #include "media/gpu/h264_decoder.h"
25 #include "media/gpu/media_gpu_export.h" 25 #include "media/gpu/media_gpu_export.h"
26 #include "media/gpu/v4l2_device.h" 26 #include "media/gpu/v4l2_device.h"
27 #include "media/gpu/vp8_decoder.h" 27 #include "media/gpu/vp8_decoder.h"
28 #include "media/gpu/vp9_decoder.h"
28 #include "media/video/video_decode_accelerator.h" 29 #include "media/video/video_decode_accelerator.h"
29 30
30 namespace media { 31 namespace media {
31 32
32 // An implementation of VideoDecodeAccelerator that utilizes the V4L2 slice 33 // An implementation of VideoDecodeAccelerator that utilizes the V4L2 slice
33 // level codec API for decoding. The slice level API provides only a low-level 34 // level codec API for decoding. The slice level API provides only a low-level
34 // decoding functionality and requires userspace to provide support for parsing 35 // decoding functionality and requires userspace to provide support for parsing
35 // the input stream and managing decoder state across frames. 36 // the input stream and managing decoder state across frames.
36 class MEDIA_GPU_EXPORT V4L2SliceVideoDecodeAccelerator 37 class MEDIA_GPU_EXPORT V4L2SliceVideoDecodeAccelerator
37 : public VideoDecodeAccelerator { 38 : public VideoDecodeAccelerator {
(...skipping 21 matching lines...) Expand all
59 bool TryToSetupDecodeOnSeparateThread( 60 bool TryToSetupDecodeOnSeparateThread(
60 const base::WeakPtr<Client>& decode_client, 61 const base::WeakPtr<Client>& decode_client,
61 const scoped_refptr<base::SingleThreadTaskRunner>& decode_task_runner) 62 const scoped_refptr<base::SingleThreadTaskRunner>& decode_task_runner)
62 override; 63 override;
63 64
64 static VideoDecodeAccelerator::SupportedProfiles GetSupportedProfiles(); 65 static VideoDecodeAccelerator::SupportedProfiles GetSupportedProfiles();
65 66
66 private: 67 private:
67 class V4L2H264Accelerator; 68 class V4L2H264Accelerator;
68 class V4L2VP8Accelerator; 69 class V4L2VP8Accelerator;
70 class V4L2VP9Accelerator;
69 71
70 // Record for input buffers. 72 // Record for input buffers.
71 struct InputRecord { 73 struct InputRecord {
72 InputRecord(); 74 InputRecord();
73 int32_t input_id; 75 int32_t input_id;
74 void* address; 76 void* address;
75 size_t length; 77 size_t length;
76 size_t bytes_used; 78 size_t bytes_used;
77 bool at_device; 79 bool at_device;
78 }; 80 };
(...skipping 25 matching lines...) Expand all
104 // Below methods are used by accelerator implementations. 106 // Below methods are used by accelerator implementations.
105 // 107 //
106 // Append slice data in |data| of size |size| to pending hardware 108 // Append slice data in |data| of size |size| to pending hardware
107 // input buffer with |index|. This buffer will be submitted for decode 109 // input buffer with |index|. This buffer will be submitted for decode
108 // on the next DecodeSurface(). Return true on success. 110 // on the next DecodeSurface(). Return true on success.
109 bool SubmitSlice(int index, const uint8_t* data, size_t size); 111 bool SubmitSlice(int index, const uint8_t* data, size_t size);
110 112
111 // Submit controls in |ext_ctrls| to hardware. Return true on success. 113 // Submit controls in |ext_ctrls| to hardware. Return true on success.
112 bool SubmitExtControls(struct v4l2_ext_controls* ext_ctrls); 114 bool SubmitExtControls(struct v4l2_ext_controls* ext_ctrls);
113 115
116 // Gets current control values for controls in |ext_ctrls| from the driver.
117 // Return true on success.
118 bool GetExtControls(struct v4l2_ext_controls* ext_ctrls);
119
120 // Return true if the driver exposes V4L2 control |ctrl_id|, false otherwise.
121 bool IsCtrlExposed(uint32_t ctrl_id);
122
114 // Decode of |dec_surface| is ready to be submitted and all codec-specific 123 // Decode of |dec_surface| is ready to be submitted and all codec-specific
115 // settings are set in hardware. 124 // settings are set in hardware.
116 void DecodeSurface(const scoped_refptr<V4L2DecodeSurface>& dec_surface); 125 void DecodeSurface(const scoped_refptr<V4L2DecodeSurface>& dec_surface);
117 126
118 // |dec_surface| is ready to be outputted once decode is finished. 127 // |dec_surface| is ready to be outputted once decode is finished.
119 // This can be called before decode is actually done in hardware, and this 128 // This can be called before decode is actually done in hardware, and this
120 // method is responsible for maintaining the ordering, i.e. the surfaces will 129 // method is responsible for maintaining the ordering, i.e. the surfaces will
121 // be outputted in the same order as SurfaceReady calls. To do so, the 130 // be outputted in the same order as SurfaceReady calls. To do so, the
122 // surfaces are put on decoder_display_queue_ and sent to output in that 131 // surfaces are put on decoder_display_queue_ and sent to output in that
123 // order once all preceding surfaces are sent. 132 // order once all preceding surfaces are sent.
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
417 // all previously-queued frames, so we can finish the flush/reset/surface 426 // all previously-queued frames, so we can finish the flush/reset/surface
418 // change flows. These can stack. 427 // change flows. These can stack.
419 bool decoder_flushing_; 428 bool decoder_flushing_;
420 bool decoder_resetting_; 429 bool decoder_resetting_;
421 bool surface_set_change_pending_; 430 bool surface_set_change_pending_;
422 431
423 // Hardware accelerators. 432 // Hardware accelerators.
424 // TODO(posciak): Try to have a superclass here if possible. 433 // TODO(posciak): Try to have a superclass here if possible.
425 std::unique_ptr<V4L2H264Accelerator> h264_accelerator_; 434 std::unique_ptr<V4L2H264Accelerator> h264_accelerator_;
426 std::unique_ptr<V4L2VP8Accelerator> vp8_accelerator_; 435 std::unique_ptr<V4L2VP8Accelerator> vp8_accelerator_;
436 std::unique_ptr<V4L2VP9Accelerator> vp9_accelerator_;
427 437
428 // Codec-specific software decoder in use. 438 // Codec-specific software decoder in use.
429 std::unique_ptr<AcceleratedVideoDecoder> decoder_; 439 std::unique_ptr<AcceleratedVideoDecoder> decoder_;
430 440
431 // Surfaces queued to device to keep references to them while decoded. 441 // Surfaces queued to device to keep references to them while decoded.
432 using V4L2DecodeSurfaceByOutputId = 442 using V4L2DecodeSurfaceByOutputId =
433 std::map<int, scoped_refptr<V4L2DecodeSurface>>; 443 std::map<int, scoped_refptr<V4L2DecodeSurface>>;
434 V4L2DecodeSurfaceByOutputId surfaces_at_device_; 444 V4L2DecodeSurfaceByOutputId surfaces_at_device_;
435 445
436 // Surfaces sent to client to keep references to them while displayed. 446 // Surfaces sent to client to keep references to them while displayed.
(...skipping 18 matching lines...) Expand all
455 MakeGLContextCurrentCallback make_context_current_cb_; 465 MakeGLContextCurrentCallback make_context_current_cb_;
456 466
457 // The WeakPtrFactory for |weak_this_|. 467 // The WeakPtrFactory for |weak_this_|.
458 base::WeakPtrFactory<V4L2SliceVideoDecodeAccelerator> weak_this_factory_; 468 base::WeakPtrFactory<V4L2SliceVideoDecodeAccelerator> weak_this_factory_;
459 469
460 DISALLOW_COPY_AND_ASSIGN(V4L2SliceVideoDecodeAccelerator); 470 DISALLOW_COPY_AND_ASSIGN(V4L2SliceVideoDecodeAccelerator);
461 }; 471 };
462 472
463 class V4L2H264Picture; 473 class V4L2H264Picture;
464 class V4L2VP8Picture; 474 class V4L2VP8Picture;
475 class V4L2VP9Picture;
465 476
466 } // namespace media 477 } // namespace media
467 478
468 #endif // MEDIA_GPU_V4L2_SLICE_VIDEO_DECODE_ACCELERATOR_H_ 479 #endif // MEDIA_GPU_V4L2_SLICE_VIDEO_DECODE_ACCELERATOR_H_
OLDNEW
« no previous file with comments | « media/gpu/v4l2_device.cc ('k') | media/gpu/v4l2_slice_video_decode_accelerator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698