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

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

Issue 833063003: 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
Index: content/common/gpu/media/h264_dpb.h
diff --git a/content/common/gpu/media/h264_dpb.h b/content/common/gpu/media/h264_dpb.h
index 366c47a78cd298166d5cb12d12d1eff6bce6ce90..de86eb7477c68e22638d6eb8d81d3d093109e9b8 100644
--- a/content/common/gpu/media/h264_dpb.h
+++ b/content/common/gpu/media/h264_dpb.h
@@ -11,20 +11,22 @@
#include <vector>
#include "base/basictypes.h"
-#include "base/memory/scoped_vector.h"
+#include "base/memory/ref_counted.h"
#include "media/filters/h264_parser.h"
namespace content {
// A picture (a frame or a field) in the H.264 spec sense.
// See spec at http://www.itu.int/rec/T-REC-H.264
-struct H264Picture {
+struct H264PictureBase {
enum Field {
FIELD_NONE,
FIELD_TOP,
FIELD_BOTTOM,
};
+ H264PictureBase();
+
// Values calculated per H.264 specification or taken from slice header.
// See spec for more details on each (some names have been converted from
// CamelCase in spec to Chromium-style names).
@@ -59,7 +61,25 @@ struct H264Picture {
media::H264DecRefPicMarking
ref_pic_marking[media::H264SliceHeader::kRefListSize];
- typedef std::vector<H264Picture*> PtrVector;
+ // Position in DPB (i.e. index in DPB).
+ int dpb_position;
+};
+
+class V4L2H264Picture;
+
+class H264Picture : public H264PictureBase,
+ public base::RefCounted<H264Picture> {
+ public:
+ H264Picture() {}
+ virtual ~H264Picture() {}
+
+ virtual V4L2H264Picture* AsV4L2H264Picture() { return nullptr; }
+ //virtual VaapiVideoDecodeAccelerator::VaapiH264Picture* AsVaapiH264Picture()
+ //{ return NULL; }
+
+ using Vector = std::vector<scoped_refptr<H264Picture>>;
+
+ DISALLOW_COPY_AND_ASSIGN(H264Picture);
kcwu 2015/01/09 15:36:46 private:
Pawel Osciak 2015/01/12 07:18:20 Done.
};
// DPB - Decoded Picture Buffer.
@@ -84,7 +104,7 @@ class H264DPB {
void Clear();
// Store picture in DPB. DPB takes ownership of its resources.
- void StorePic(H264Picture* pic);
+ void StorePic(const scoped_refptr<H264Picture>& pic);
// Return the number of reference pictures in DPB.
int CountRefPics();
@@ -93,32 +113,33 @@ class H264DPB {
void MarkAllUnusedForRef();
// Return a short-term reference picture by its pic_num.
- H264Picture* GetShortRefPicByPicNum(int pic_num);
+ scoped_refptr<H264Picture> GetShortRefPicByPicNum(int pic_num);
// Return a long-term reference picture by its long_term_pic_num.
- H264Picture* GetLongRefPicByLongTermPicNum(int pic_num);
+ scoped_refptr<H264Picture> GetLongRefPicByLongTermPicNum(int pic_num);
// Return the short reference picture with lowest frame_num. Used for sliding
// window memory management.
- H264Picture* GetLowestFrameNumWrapShortRefPic();
+ scoped_refptr<H264Picture> GetLowestFrameNumWrapShortRefPic();
// Append all pictures that have not been outputted yet to the passed |out|
// vector, sorted by lowest pic_order_cnt (in output order).
- void GetNotOutputtedPicsAppending(H264Picture::PtrVector& out);
+ void GetNotOutputtedPicsAppending(H264Picture::Vector* out);
// Append all short term reference pictures to the passed |out| vector.
- void GetShortTermRefPicsAppending(H264Picture::PtrVector& out);
+ void GetShortTermRefPicsAppending(H264Picture::Vector* out);
// Append all long term reference pictures to the passed |out| vector.
- void GetLongTermRefPicsAppending(H264Picture::PtrVector& out);
+ void GetLongTermRefPicsAppending(H264Picture::Vector* out);
// Iterators for direct access to DPB contents.
// Will be invalidated after any of Remove* calls.
- typedef ScopedVector<H264Picture> Pictures;
- Pictures::iterator begin() { return pics_.begin(); }
- Pictures::iterator end() { return pics_.end(); }
- Pictures::reverse_iterator rbegin() { return pics_.rbegin(); }
- Pictures::reverse_iterator rend() { return pics_.rend(); }
+ H264Picture::Vector::iterator begin() { return pics_.begin(); }
+ H264Picture::Vector::iterator end() { return pics_.end(); }
+ H264Picture::Vector::const_iterator begin() const { return pics_.begin(); }
+ H264Picture::Vector::const_iterator end() const { return pics_.end(); }
+ H264Picture::Vector::reverse_iterator rbegin() { return pics_.rbegin(); }
+ H264Picture::Vector::reverse_iterator rend() { return pics_.rend(); }
size_t size() const { return pics_.size(); }
bool IsFull() const { return pics_.size() == max_num_pics_; }
@@ -127,7 +148,9 @@ class H264DPB {
enum { kDPBMaxSize = 16, };
private:
- Pictures pics_;
+ void UpdatePicPositions();
+
+ H264Picture::Vector pics_;
size_t max_num_pics_;
DISALLOW_COPY_AND_ASSIGN(H264DPB);

Powered by Google App Engine
This is Rietveld 408576698