| 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 // 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 MEDIA_GPU_H264_DPB_H_ |
| 9 #define CONTENT_COMMON_GPU_MEDIA_H264_DPB_H_ | 9 #define MEDIA_GPU_H264_DPB_H_ |
| 10 | 10 |
| 11 #include <stddef.h> | 11 #include <stddef.h> |
| 12 | 12 |
| 13 #include <vector> | 13 #include <vector> |
| 14 | 14 |
| 15 #include "base/macros.h" | 15 #include "base/macros.h" |
| 16 #include "base/memory/ref_counted.h" | 16 #include "base/memory/ref_counted.h" |
| 17 #include "media/filters/h264_parser.h" | 17 #include "media/filters/h264_parser.h" |
| 18 | 18 |
| 19 namespace content { | 19 namespace media { |
| 20 | 20 |
| 21 class V4L2H264Picture; | 21 class V4L2H264Picture; |
| 22 class VaapiH264Picture; | 22 class VaapiH264Picture; |
| 23 | 23 |
| 24 // A picture (a frame or a field) in the H.264 spec sense. | 24 // A picture (a frame or a field) in the H.264 spec sense. |
| 25 // See spec at http://www.itu.int/rec/T-REC-H.264 | 25 // See spec at http://www.itu.int/rec/T-REC-H.264 |
| 26 class H264Picture : public base::RefCounted<H264Picture> { | 26 class H264Picture : public base::RefCounted<H264Picture> { |
| 27 public: | 27 public: |
| 28 using Vector = std::vector<scoped_refptr<H264Picture>>; | 28 using Vector = std::vector<scoped_refptr<H264Picture>>; |
| 29 | 29 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 53 | 53 |
| 54 int pic_num; | 54 int pic_num; |
| 55 int long_term_pic_num; | 55 int long_term_pic_num; |
| 56 int frame_num; // from slice header | 56 int frame_num; // from slice header |
| 57 int frame_num_offset; | 57 int frame_num_offset; |
| 58 int frame_num_wrap; | 58 int frame_num_wrap; |
| 59 int long_term_frame_idx; | 59 int long_term_frame_idx; |
| 60 | 60 |
| 61 media::H264SliceHeader::Type type; | 61 media::H264SliceHeader::Type type; |
| 62 int nal_ref_idc; | 62 int nal_ref_idc; |
| 63 bool idr; // IDR picture? | 63 bool idr; // IDR picture? |
| 64 int idr_pic_id; // Valid only if idr == true. | 64 int idr_pic_id; // Valid only if idr == true. |
| 65 bool ref; // reference picture? | 65 bool ref; // reference picture? |
| 66 bool long_term; // long term reference picture? | 66 bool long_term; // long term reference picture? |
| 67 bool outputted; | 67 bool outputted; |
| 68 // Does memory management op 5 needs to be executed after this | 68 // Does memory management op 5 needs to be executed after this |
| 69 // picture has finished decoding? | 69 // picture has finished decoding? |
| 70 bool mem_mgmt_5; | 70 bool mem_mgmt_5; |
| 71 | 71 |
| 72 // Created by the decoding process for gaps in frame_num. | 72 // Created by the decoding process for gaps in frame_num. |
| 73 // Not for decode or output. | 73 // Not for decode or output. |
| 74 bool nonexisting; | 74 bool nonexisting; |
| 75 | 75 |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 return pics_.rbegin(); | 153 return pics_.rbegin(); |
| 154 } | 154 } |
| 155 H264Picture::Vector::const_reverse_iterator rend() const { | 155 H264Picture::Vector::const_reverse_iterator rend() const { |
| 156 return pics_.rend(); | 156 return pics_.rend(); |
| 157 } | 157 } |
| 158 | 158 |
| 159 size_t size() const { return pics_.size(); } | 159 size_t size() const { return pics_.size(); } |
| 160 bool IsFull() const { return pics_.size() == max_num_pics_; } | 160 bool IsFull() const { return pics_.size() == max_num_pics_; } |
| 161 | 161 |
| 162 // Per H264 spec, increase to 32 if interlaced video is supported. | 162 // Per H264 spec, increase to 32 if interlaced video is supported. |
| 163 enum { kDPBMaxSize = 16, }; | 163 enum { |
| 164 kDPBMaxSize = 16, |
| 165 }; |
| 164 | 166 |
| 165 private: | 167 private: |
| 166 void UpdatePicPositions(); | 168 void UpdatePicPositions(); |
| 167 | 169 |
| 168 H264Picture::Vector pics_; | 170 H264Picture::Vector pics_; |
| 169 size_t max_num_pics_; | 171 size_t max_num_pics_; |
| 170 | 172 |
| 171 DISALLOW_COPY_AND_ASSIGN(H264DPB); | 173 DISALLOW_COPY_AND_ASSIGN(H264DPB); |
| 172 }; | 174 }; |
| 173 | 175 |
| 174 } // namespace content | 176 } // namespace media |
| 175 | 177 |
| 176 #endif // CONTENT_COMMON_GPU_MEDIA_H264_DPB_H_ | 178 #endif // MEDIA_GPU_H264_DPB_H_ |
| OLD | NEW |