OLD | NEW |
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_VP9_DECODER_H_ | 5 #ifndef MEDIA_GPU_VP9_DECODER_H_ |
6 #define MEDIA_GPU_VP9_DECODER_H_ | 6 #define MEDIA_GPU_VP9_DECODER_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 // |ref_pictures| for reference. | 52 // |ref_pictures| for reference. |
53 // | 53 // |
54 // Note that returning from this method does not mean that the decode | 54 // Note that returning from this method does not mean that the decode |
55 // process is finished, but the caller may drop its references to |pic| | 55 // process is finished, but the caller may drop its references to |pic| |
56 // and |ref_pictures| immediately, and the data in |seg| and |lf| does not | 56 // and |ref_pictures| immediately, and the data in |seg| and |lf| does not |
57 // need to remain valid after this method returns. | 57 // need to remain valid after this method returns. |
58 // | 58 // |
59 // Return true when successful, false otherwise. | 59 // Return true when successful, false otherwise. |
60 virtual bool SubmitDecode( | 60 virtual bool SubmitDecode( |
61 const scoped_refptr<VP9Picture>& pic, | 61 const scoped_refptr<VP9Picture>& pic, |
62 const media::Vp9Segmentation& seg, | 62 const Vp9Segmentation& seg, |
63 const media::Vp9LoopFilter& lf, | 63 const Vp9LoopFilter& lf, |
64 const std::vector<scoped_refptr<VP9Picture>>& ref_pictures) = 0; | 64 const std::vector<scoped_refptr<VP9Picture>>& ref_pictures) = 0; |
65 | 65 |
66 // Schedule output (display) of |pic|. | 66 // Schedule output (display) of |pic|. |
67 // | 67 // |
68 // Note that returning from this method does not mean that |pic| has already | 68 // Note that returning from this method does not mean that |pic| has already |
69 // been outputted (displayed), but guarantees that all pictures will be | 69 // been outputted (displayed), but guarantees that all pictures will be |
70 // outputted in the same order as this method was called for them, and that | 70 // outputted in the same order as this method was called for them, and that |
71 // they are decoded before outputting (assuming SubmitDecode() has been | 71 // they are decoded before outputting (assuming SubmitDecode() has been |
72 // called for them beforehand). Decoder may drop its references to |pic| | 72 // called for them beforehand). Decoder may drop its references to |pic| |
73 // immediately after calling this method. | 73 // immediately after calling this method. |
74 // | 74 // |
75 // Return true when successful, false otherwise. | 75 // Return true when successful, false otherwise. |
76 virtual bool OutputPicture(const scoped_refptr<VP9Picture>& pic) = 0; | 76 virtual bool OutputPicture(const scoped_refptr<VP9Picture>& pic) = 0; |
77 | 77 |
78 private: | 78 private: |
79 DISALLOW_COPY_AND_ASSIGN(VP9Accelerator); | 79 DISALLOW_COPY_AND_ASSIGN(VP9Accelerator); |
80 }; | 80 }; |
81 | 81 |
82 VP9Decoder(VP9Accelerator* accelerator); | 82 VP9Decoder(VP9Accelerator* accelerator); |
83 ~VP9Decoder() override; | 83 ~VP9Decoder() override; |
84 | 84 |
85 // media::AcceleratedVideoDecoder implementation. | 85 // AcceleratedVideoDecoder implementation. |
86 void SetStream(const uint8_t* ptr, size_t size) override; | 86 void SetStream(const uint8_t* ptr, size_t size) override; |
87 bool Flush() override WARN_UNUSED_RESULT; | 87 bool Flush() override WARN_UNUSED_RESULT; |
88 void Reset() override; | 88 void Reset() override; |
89 DecodeResult Decode() override WARN_UNUSED_RESULT; | 89 DecodeResult Decode() override WARN_UNUSED_RESULT; |
90 gfx::Size GetPicSize() const override; | 90 gfx::Size GetPicSize() const override; |
91 size_t GetRequiredNumOfPictures() const override; | 91 size_t GetRequiredNumOfPictures() const override; |
92 | 92 |
93 private: | 93 private: |
94 // Update ref_frames_ based on the information in current frame header. | 94 // Update ref_frames_ based on the information in current frame header. |
95 void RefreshReferenceFrames(const scoped_refptr<VP9Picture>& pic); | 95 void RefreshReferenceFrames(const scoped_refptr<VP9Picture>& pic); |
(...skipping 10 matching lines...) Expand all Loading... |
106 kNeedStreamMetadata, // After initialization, need a keyframe. | 106 kNeedStreamMetadata, // After initialization, need a keyframe. |
107 kDecoding, // Ready to decode from any point. | 107 kDecoding, // Ready to decode from any point. |
108 kAfterReset, // After Reset(), need a resume point. | 108 kAfterReset, // After Reset(), need a resume point. |
109 kError, // Error in decode, can't continue. | 109 kError, // Error in decode, can't continue. |
110 }; | 110 }; |
111 | 111 |
112 // Current decoder state. | 112 // Current decoder state. |
113 State state_; | 113 State state_; |
114 | 114 |
115 // Current frame header to be used in decoding the next picture. | 115 // Current frame header to be used in decoding the next picture. |
116 std::unique_ptr<media::Vp9FrameHeader> curr_frame_hdr_; | 116 std::unique_ptr<Vp9FrameHeader> curr_frame_hdr_; |
117 | 117 |
118 // Reference frames currently in use. | 118 // Reference frames currently in use. |
119 std::vector<scoped_refptr<VP9Picture>> ref_frames_; | 119 std::vector<scoped_refptr<VP9Picture>> ref_frames_; |
120 | 120 |
121 // Current coded resolution. | 121 // Current coded resolution. |
122 gfx::Size pic_size_; | 122 gfx::Size pic_size_; |
123 | 123 |
124 media::Vp9Parser parser_; | 124 Vp9Parser parser_; |
125 | 125 |
126 // VP9Accelerator instance owned by the client. | 126 // VP9Accelerator instance owned by the client. |
127 VP9Accelerator* accelerator_; | 127 VP9Accelerator* accelerator_; |
128 | 128 |
129 DISALLOW_COPY_AND_ASSIGN(VP9Decoder); | 129 DISALLOW_COPY_AND_ASSIGN(VP9Decoder); |
130 }; | 130 }; |
131 | 131 |
132 } // namespace media | 132 } // namespace media |
133 | 133 |
134 #endif // MEDIA_GPU_VP9_DECODER_H_ | 134 #endif // MEDIA_GPU_VP9_DECODER_H_ |
OLD | NEW |