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

Side by Side Diff: content/common/gpu/media/h264_dpb.h

Issue 1040513003: VAVDA: Use the new, generic video decoder and accelerator infrastructure. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 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 // This file contains an implementation of an H.264 Decoded Picture Buffer 5 // This file contains an implementation of an H.264 Decoded Picture Buffer
6 // used in H264 decoders. 6 // used in H264 decoders.
7 7
8 #ifndef CONTENT_COMMON_GPU_MEDIA_H264_DPB_H_ 8 #ifndef CONTENT_COMMON_GPU_MEDIA_H264_DPB_H_
9 #define CONTENT_COMMON_GPU_MEDIA_H264_DPB_H_ 9 #define CONTENT_COMMON_GPU_MEDIA_H264_DPB_H_
10 10
11 #include <vector> 11 #include <vector>
12 12
13 #include "base/basictypes.h" 13 #include "base/basictypes.h"
14 #include "base/memory/ref_counted.h" 14 #include "base/memory/ref_counted.h"
15 #include "media/filters/h264_parser.h" 15 #include "media/filters/h264_parser.h"
16 16
17 namespace content { 17 namespace content {
18 18
19 class V4L2H264Picture; 19 class V4L2H264Picture;
20 class VaapiH264Picture;
20 21
21 // A picture (a frame or a field) in the H.264 spec sense. 22 // A picture (a frame or a field) in the H.264 spec sense.
22 // See spec at http://www.itu.int/rec/T-REC-H.264 23 // See spec at http://www.itu.int/rec/T-REC-H.264
23 struct H264PictureBase { 24 class H264Picture : public base::RefCounted<H264Picture> {
25 public:
26 H264Picture();
27
28 virtual V4L2H264Picture* AsV4L2H264Picture();
29 virtual VaapiH264Picture* AsVaapiH264Picture();
30
31 using Vector = std::vector<scoped_refptr<H264Picture>>;
kcwu1 2015/04/07 09:42:47 move this line and enum to front of ctor.
Pawel Osciak 2015/04/08 08:36:03 Done.
32
24 enum Field { 33 enum Field {
25 FIELD_NONE, 34 FIELD_NONE,
26 FIELD_TOP, 35 FIELD_TOP,
27 FIELD_BOTTOM, 36 FIELD_BOTTOM,
28 }; 37 };
29 38
30 H264PictureBase();
31
32 // Values calculated per H.264 specification or taken from slice header. 39 // Values calculated per H.264 specification or taken from slice header.
33 // See spec for more details on each (some names have been converted from 40 // See spec for more details on each (some names have been converted from
34 // CamelCase in spec to Chromium-style names). 41 // CamelCase in spec to Chromium-style names).
35 int top_field_order_cnt; 42 int top_field_order_cnt;
36 int bottom_field_order_cnt; 43 int bottom_field_order_cnt;
37 int pic_order_cnt; 44 int pic_order_cnt;
38 int pic_order_cnt_msb; 45 int pic_order_cnt_msb;
39 int pic_order_cnt_lsb; 46 int pic_order_cnt_lsb;
40 47
41 int pic_num; 48 int pic_num;
(...skipping 16 matching lines...) Expand all
58 65
59 // Values from slice_hdr to be used during reference marking and 66 // Values from slice_hdr to be used during reference marking and
60 // memory management after finishing this picture. 67 // memory management after finishing this picture.
61 bool long_term_reference_flag; 68 bool long_term_reference_flag;
62 bool adaptive_ref_pic_marking_mode_flag; 69 bool adaptive_ref_pic_marking_mode_flag;
63 media::H264DecRefPicMarking 70 media::H264DecRefPicMarking
64 ref_pic_marking[media::H264SliceHeader::kRefListSize]; 71 ref_pic_marking[media::H264SliceHeader::kRefListSize];
65 72
66 // Position in DPB (i.e. index in DPB). 73 // Position in DPB (i.e. index in DPB).
67 int dpb_position; 74 int dpb_position;
68 };
69
70 class H264Picture : public H264PictureBase,
71 public base::RefCounted<H264Picture> {
72 public:
73 H264Picture();
74
75 virtual V4L2H264Picture* AsV4L2H264Picture();
76
77 using Vector = std::vector<scoped_refptr<H264Picture>>;
78 75
79 protected: 76 protected:
80 friend class base::RefCounted<H264Picture>; 77 friend class base::RefCounted<H264Picture>;
81 virtual ~H264Picture(); 78 virtual ~H264Picture();
82 79
80 private:
83 DISALLOW_COPY_AND_ASSIGN(H264Picture); 81 DISALLOW_COPY_AND_ASSIGN(H264Picture);
84 }; 82 };
85 83
86 // DPB - Decoded Picture Buffer. 84 // DPB - Decoded Picture Buffer.
87 // Stores decoded pictures that will be used for future display 85 // Stores decoded pictures that will be used for future display
88 // and/or reference. 86 // and/or reference.
89 class H264DPB { 87 class H264DPB {
90 public: 88 public:
91 H264DPB(); 89 H264DPB();
92 ~H264DPB(); 90 ~H264DPB();
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 130
133 // Append all long term reference pictures to the passed |out| vector. 131 // Append all long term reference pictures to the passed |out| vector.
134 void GetLongTermRefPicsAppending(H264Picture::Vector* out); 132 void GetLongTermRefPicsAppending(H264Picture::Vector* out);
135 133
136 // Iterators for direct access to DPB contents. 134 // Iterators for direct access to DPB contents.
137 // Will be invalidated after any of Remove* calls. 135 // Will be invalidated after any of Remove* calls.
138 H264Picture::Vector::iterator begin() { return pics_.begin(); } 136 H264Picture::Vector::iterator begin() { return pics_.begin(); }
139 H264Picture::Vector::iterator end() { return pics_.end(); } 137 H264Picture::Vector::iterator end() { return pics_.end(); }
140 H264Picture::Vector::const_iterator begin() const { return pics_.begin(); } 138 H264Picture::Vector::const_iterator begin() const { return pics_.begin(); }
141 H264Picture::Vector::const_iterator end() const { return pics_.end(); } 139 H264Picture::Vector::const_iterator end() const { return pics_.end(); }
142 H264Picture::Vector::reverse_iterator rbegin() { return pics_.rbegin(); } 140 H264Picture::Vector::const_reverse_iterator rbegin() const {
143 H264Picture::Vector::reverse_iterator rend() { return pics_.rend(); } 141 return pics_.rbegin();
142 }
143 H264Picture::Vector::const_reverse_iterator rend() const {
144 return pics_.rend();
145 }
144 146
145 size_t size() const { return pics_.size(); } 147 size_t size() const { return pics_.size(); }
146 bool IsFull() const { return pics_.size() == max_num_pics_; } 148 bool IsFull() const { return pics_.size() == max_num_pics_; }
147 149
148 // Per H264 spec, increase to 32 if interlaced video is supported. 150 // Per H264 spec, increase to 32 if interlaced video is supported.
149 enum { kDPBMaxSize = 16, }; 151 enum { kDPBMaxSize = 16, };
150 152
151 private: 153 private:
152 void UpdatePicPositions(); 154 void UpdatePicPositions();
153 155
154 H264Picture::Vector pics_; 156 H264Picture::Vector pics_;
155 size_t max_num_pics_; 157 size_t max_num_pics_;
156 158
157 DISALLOW_COPY_AND_ASSIGN(H264DPB); 159 DISALLOW_COPY_AND_ASSIGN(H264DPB);
158 }; 160 };
159 161
160 } // namespace content 162 } // namespace content
161 163
162 #endif // CONTENT_COMMON_GPU_MEDIA_H264_DPB_H_ 164 #endif // CONTENT_COMMON_GPU_MEDIA_H264_DPB_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698