OLD | NEW |
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 <string.h> | 5 #include <string.h> |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
11 #include "content/common/gpu/media/h264_dpb.h" | 11 #include "media/gpu/h264_dpb.h" |
12 | 12 |
13 namespace content { | 13 namespace media { |
14 | 14 |
15 H264Picture::H264Picture() | 15 H264Picture::H264Picture() |
16 : pic_order_cnt_type(0), | 16 : pic_order_cnt_type(0), |
17 top_field_order_cnt(0), | 17 top_field_order_cnt(0), |
18 bottom_field_order_cnt(0), | 18 bottom_field_order_cnt(0), |
19 pic_order_cnt(0), | 19 pic_order_cnt(0), |
20 pic_order_cnt_msb(0), | 20 pic_order_cnt_msb(0), |
21 pic_order_cnt_lsb(0), | 21 pic_order_cnt_lsb(0), |
22 delta_pic_order_cnt_bottom(0), | 22 delta_pic_order_cnt_bottom(0), |
23 delta_pic_order_cnt0(0), | 23 delta_pic_order_cnt0(0), |
(...skipping 13 matching lines...) Expand all Loading... |
37 outputted(false), | 37 outputted(false), |
38 mem_mgmt_5(false), | 38 mem_mgmt_5(false), |
39 nonexisting(false), | 39 nonexisting(false), |
40 field(FIELD_NONE), | 40 field(FIELD_NONE), |
41 long_term_reference_flag(false), | 41 long_term_reference_flag(false), |
42 adaptive_ref_pic_marking_mode_flag(false), | 42 adaptive_ref_pic_marking_mode_flag(false), |
43 dpb_position(0) { | 43 dpb_position(0) { |
44 memset(&ref_pic_marking, 0, sizeof(ref_pic_marking)); | 44 memset(&ref_pic_marking, 0, sizeof(ref_pic_marking)); |
45 } | 45 } |
46 | 46 |
47 H264Picture::~H264Picture() { | 47 H264Picture::~H264Picture() {} |
48 } | |
49 | 48 |
50 V4L2H264Picture* H264Picture::AsV4L2H264Picture() { | 49 V4L2H264Picture* H264Picture::AsV4L2H264Picture() { |
51 return nullptr; | 50 return nullptr; |
52 } | 51 } |
53 | 52 |
54 VaapiH264Picture* H264Picture::AsVaapiH264Picture() { | 53 VaapiH264Picture* H264Picture::AsVaapiH264Picture() { |
55 return nullptr; | 54 return nullptr; |
56 } | 55 } |
57 | 56 |
58 H264DPB::H264DPB() : max_num_pics_(0) {} | 57 H264DPB::H264DPB() : max_num_pics_(0) {} |
(...skipping 12 matching lines...) Expand all Loading... |
71 | 70 |
72 void H264DPB::UpdatePicPositions() { | 71 void H264DPB::UpdatePicPositions() { |
73 size_t i = 0; | 72 size_t i = 0; |
74 for (auto& pic : pics_) { | 73 for (auto& pic : pics_) { |
75 pic->dpb_position = i; | 74 pic->dpb_position = i; |
76 ++i; | 75 ++i; |
77 } | 76 } |
78 } | 77 } |
79 | 78 |
80 void H264DPB::DeleteByPOC(int poc) { | 79 void H264DPB::DeleteByPOC(int poc) { |
81 for (H264Picture::Vector::iterator it = pics_.begin(); | 80 for (H264Picture::Vector::iterator it = pics_.begin(); it != pics_.end(); |
82 it != pics_.end(); ++it) { | 81 ++it) { |
83 if ((*it)->pic_order_cnt == poc) { | 82 if ((*it)->pic_order_cnt == poc) { |
84 pics_.erase(it); | 83 pics_.erase(it); |
85 UpdatePicPositions(); | 84 UpdatePicPositions(); |
86 return; | 85 return; |
87 } | 86 } |
88 } | 87 } |
89 NOTREACHED() << "Missing POC: " << poc; | 88 NOTREACHED() << "Missing POC: " << poc; |
90 } | 89 } |
91 | 90 |
92 void H264DPB::DeleteUnused() { | 91 void H264DPB::DeleteUnused() { |
93 for (H264Picture::Vector::iterator it = pics_.begin(); it != pics_.end(); ) { | 92 for (H264Picture::Vector::iterator it = pics_.begin(); it != pics_.end();) { |
94 if ((*it)->outputted && !(*it)->ref) | 93 if ((*it)->outputted && !(*it)->ref) |
95 it = pics_.erase(it); | 94 it = pics_.erase(it); |
96 else | 95 else |
97 ++it; | 96 ++it; |
98 } | 97 } |
99 UpdatePicPositions(); | 98 UpdatePicPositions(); |
100 } | 99 } |
101 | 100 |
102 void H264DPB::StorePic(const scoped_refptr<H264Picture>& pic) { | 101 void H264DPB::StorePic(const scoped_refptr<H264Picture>& pic) { |
103 DCHECK_LT(pics_.size(), max_num_pics_); | 102 DCHECK_LT(pics_.size(), max_num_pics_); |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 } | 164 } |
166 } | 165 } |
167 | 166 |
168 void H264DPB::GetLongTermRefPicsAppending(H264Picture::Vector* out) { | 167 void H264DPB::GetLongTermRefPicsAppending(H264Picture::Vector* out) { |
169 for (const auto& pic : pics_) { | 168 for (const auto& pic : pics_) { |
170 if (pic->ref && pic->long_term) | 169 if (pic->ref && pic->long_term) |
171 out->push_back(pic); | 170 out->push_back(pic); |
172 } | 171 } |
173 } | 172 } |
174 | 173 |
175 } // namespace content | 174 } // namespace media |
OLD | NEW |