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

Unified Diff: content/common/gpu/media/h264_dpb.cc

Issue 813693006: Add accelerated video decoder interface, VP8 and H.264 implementations and hook up to V4L2SVDA (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/common/gpu/media/h264_dpb.h ('k') | content/common/gpu/media/tegra_v4l2_video_device.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/common/gpu/media/h264_dpb.cc
diff --git a/content/common/gpu/media/h264_dpb.cc b/content/common/gpu/media/h264_dpb.cc
index 371d61283139a4df1084b653d6e645ae9edd8a8e..dfefc18f65445440dd51cdd6504f1d6d09aaa9a0 100644
--- a/content/common/gpu/media/h264_dpb.cc
+++ b/content/common/gpu/media/h264_dpb.cc
@@ -10,6 +10,20 @@
namespace content {
+H264PictureBase::H264PictureBase() {
+ memset(this, 0, sizeof(*this));
+}
+
+H264Picture::H264Picture() {
+}
+
+H264Picture::~H264Picture() {
+}
+
+V4L2H264Picture* H264Picture::AsV4L2H264Picture() {
+ return nullptr;
+}
+
H264DPB::H264DPB() : max_num_pics_(0) {}
H264DPB::~H264DPB() {}
@@ -24,10 +38,20 @@ void H264DPB::set_max_num_pics(size_t max_num_pics) {
pics_.resize(max_num_pics_);
}
+void H264DPB::UpdatePicPositions() {
+ size_t i = 0;
+ for (auto& pic : pics_) {
+ pic->dpb_position = i;
+ ++i;
+ }
+}
+
void H264DPB::DeleteByPOC(int poc) {
- for (Pictures::iterator it = pics_.begin(); it != pics_.end(); ++it) {
+ for (H264Picture::Vector::iterator it = pics_.begin();
+ it != pics_.end(); ++it) {
if ((*it)->pic_order_cnt == poc) {
pics_.erase(it);
+ UpdatePicPositions();
return;
}
}
@@ -35,18 +59,20 @@ void H264DPB::DeleteByPOC(int poc) {
}
void H264DPB::DeleteUnused() {
- for (Pictures::iterator it = pics_.begin(); it != pics_.end(); ) {
+ for (H264Picture::Vector::iterator it = pics_.begin(); it != pics_.end(); ) {
if ((*it)->outputted && !(*it)->ref)
it = pics_.erase(it);
else
++it;
}
+ UpdatePicPositions();
}
-void H264DPB::StorePic(H264Picture* pic) {
+void H264DPB::StorePic(const scoped_refptr<H264Picture>& pic) {
DCHECK_LT(pics_.size(), max_num_pics_);
DVLOG(3) << "Adding PicNum: " << pic->pic_num << " ref: " << (int)pic->ref
<< " longterm: " << (int)pic->long_term << " to DPB";
+ pic->dpb_position = pics_.size();
pics_.push_back(pic);
}
@@ -64,32 +90,29 @@ void H264DPB::MarkAllUnusedForRef() {
pics_[i]->ref = false;
}
-H264Picture* H264DPB::GetShortRefPicByPicNum(int pic_num) {
- for (size_t i = 0; i < pics_.size(); ++i) {
- H264Picture* pic = pics_[i];
+scoped_refptr<H264Picture> H264DPB::GetShortRefPicByPicNum(int pic_num) {
+ for (const auto& pic : pics_) {
if (pic->ref && !pic->long_term && pic->pic_num == pic_num)
return pic;
}
DVLOG(1) << "Missing short ref pic num: " << pic_num;
- return NULL;
+ return nullptr;
}
-H264Picture* H264DPB::GetLongRefPicByLongTermPicNum(int pic_num) {
- for (size_t i = 0; i < pics_.size(); ++i) {
- H264Picture* pic = pics_[i];
+scoped_refptr<H264Picture> H264DPB::GetLongRefPicByLongTermPicNum(int pic_num) {
+ for (const auto& pic : pics_) {
if (pic->ref && pic->long_term && pic->long_term_pic_num == pic_num)
return pic;
}
DVLOG(1) << "Missing long term pic num: " << pic_num;
- return NULL;
+ return nullptr;
}
-H264Picture* H264DPB::GetLowestFrameNumWrapShortRefPic() {
- H264Picture* ret = NULL;
- for (size_t i = 0; i < pics_.size(); ++i) {
- H264Picture* pic = pics_[i];
+scoped_refptr<H264Picture> H264DPB::GetLowestFrameNumWrapShortRefPic() {
+ scoped_refptr<H264Picture> ret;
+ for (const auto& pic : pics_) {
if (pic->ref && !pic->long_term &&
(!ret || pic->frame_num_wrap < ret->frame_num_wrap))
ret = pic;
@@ -97,27 +120,24 @@ H264Picture* H264DPB::GetLowestFrameNumWrapShortRefPic() {
return ret;
}
-void H264DPB::GetNotOutputtedPicsAppending(H264Picture::PtrVector& out) {
- for (size_t i = 0; i < pics_.size(); ++i) {
- H264Picture* pic = pics_[i];
+void H264DPB::GetNotOutputtedPicsAppending(H264Picture::Vector* out) {
+ for (const auto& pic : pics_) {
if (!pic->outputted)
- out.push_back(pic);
+ out->push_back(pic);
}
}
-void H264DPB::GetShortTermRefPicsAppending(H264Picture::PtrVector& out) {
- for (size_t i = 0; i < pics_.size(); ++i) {
- H264Picture* pic = pics_[i];
+void H264DPB::GetShortTermRefPicsAppending(H264Picture::Vector* out) {
+ for (const auto& pic : pics_) {
if (pic->ref && !pic->long_term)
- out.push_back(pic);
+ out->push_back(pic);
}
}
-void H264DPB::GetLongTermRefPicsAppending(H264Picture::PtrVector& out) {
- for (size_t i = 0; i < pics_.size(); ++i) {
- H264Picture* pic = pics_[i];
+void H264DPB::GetLongTermRefPicsAppending(H264Picture::Vector* out) {
+ for (const auto& pic : pics_) {
if (pic->ref && pic->long_term)
- out.push_back(pic);
+ out->push_back(pic);
}
}
« no previous file with comments | « content/common/gpu/media/h264_dpb.h ('k') | content/common/gpu/media/tegra_v4l2_video_device.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698