Index: media/gpu/h264_decoder.cc |
diff --git a/content/common/gpu/media/h264_decoder.cc b/media/gpu/h264_decoder.cc |
similarity index 96% |
rename from content/common/gpu/media/h264_decoder.cc |
rename to media/gpu/h264_decoder.cc |
index 46ffa2a45085f0b554898ad149ef551696e38bc9..84a9830ab1d8b96356181d49981ec6ee28853626 100644 |
--- a/content/common/gpu/media/h264_decoder.cc |
+++ b/media/gpu/h264_decoder.cc |
@@ -11,15 +11,13 @@ |
#include "base/macros.h" |
#include "base/numerics/safe_conversions.h" |
#include "base/stl_util.h" |
-#include "content/common/gpu/media/h264_decoder.h" |
+#include "media/gpu/h264_decoder.h" |
-namespace content { |
+namespace media { |
-H264Decoder::H264Accelerator::H264Accelerator() { |
-} |
+H264Decoder::H264Accelerator::H264Accelerator() {} |
-H264Decoder::H264Accelerator::~H264Accelerator() { |
-} |
+H264Decoder::H264Accelerator::~H264Accelerator() {} |
H264Decoder::H264Decoder(H264Accelerator* accelerator) |
: max_frame_num_(0), |
@@ -32,8 +30,7 @@ H264Decoder::H264Decoder(H264Accelerator* accelerator) |
state_ = kNeedStreamMetadata; |
} |
-H264Decoder::~H264Decoder() { |
-} |
+H264Decoder::~H264Decoder() {} |
void H264Decoder::Reset() { |
curr_pic_ = nullptr; |
@@ -174,7 +171,7 @@ bool H264Decoder::InitCurrPicture(const media::H264SliceHeader* slice_hdr) { |
// purpose. |
if (slice_hdr->adaptive_ref_pic_marking_mode_flag) { |
static_assert(sizeof(curr_pic_->ref_pic_marking) == |
- sizeof(slice_hdr->ref_pic_marking), |
+ sizeof(slice_hdr->ref_pic_marking), |
"Array sizes of ref pic marking do not match."); |
memcpy(curr_pic_->ref_pic_marking, slice_hdr->ref_pic_marking, |
sizeof(curr_pic_->ref_pic_marking)); |
@@ -271,13 +268,13 @@ bool H264Decoder::CalculatePicOrderCounts(scoped_refptr<H264Picture> pic) { |
return false; |
} |
- int pic_order_cnt_cycle_cnt = (abs_frame_num - 1) / |
- sps->num_ref_frames_in_pic_order_cnt_cycle; |
- int frame_num_in_pic_order_cnt_cycle = (abs_frame_num - 1) % |
- sps->num_ref_frames_in_pic_order_cnt_cycle; |
+ int pic_order_cnt_cycle_cnt = |
+ (abs_frame_num - 1) / sps->num_ref_frames_in_pic_order_cnt_cycle; |
+ int frame_num_in_pic_order_cnt_cycle = |
+ (abs_frame_num - 1) % sps->num_ref_frames_in_pic_order_cnt_cycle; |
expected_pic_order_cnt = pic_order_cnt_cycle_cnt * |
- sps->expected_delta_per_pic_order_cnt_cycle; |
+ sps->expected_delta_per_pic_order_cnt_cycle; |
// frame_num_in_pic_order_cnt_cycle is verified < 255 in parser |
for (int i = 0; i <= frame_num_in_pic_order_cnt_cycle; ++i) |
expected_pic_order_cnt += sps->offset_for_ref_frame[i]; |
@@ -537,14 +534,12 @@ bool H264Decoder::ModifyReferencePicList( |
if (list == 0) { |
ref_pic_list_modification_flag_lX = |
slice_hdr->ref_pic_list_modification_flag_l0; |
- num_ref_idx_lX_active_minus1 = |
- slice_hdr->num_ref_idx_l0_active_minus1; |
+ num_ref_idx_lX_active_minus1 = slice_hdr->num_ref_idx_l0_active_minus1; |
list_mod = slice_hdr->ref_list_l0_modifications; |
} else { |
ref_pic_list_modification_flag_lX = |
slice_hdr->ref_pic_list_modification_flag_l1; |
- num_ref_idx_lX_active_minus1 = |
- slice_hdr->num_ref_idx_l1_active_minus1; |
+ num_ref_idx_lX_active_minus1 = slice_hdr->num_ref_idx_l1_active_minus1; |
list_mod = slice_hdr->ref_list_l1_modifications; |
} |
@@ -574,7 +569,8 @@ bool H264Decoder::ModifyReferencePicList( |
// Modify short reference picture position. |
if (list_mod->modification_of_pic_nums_idc == 0) { |
// Subtract given value from predicted PicNum. |
- pic_num_lx_no_wrap = pic_num_lx_pred - |
+ pic_num_lx_no_wrap = |
+ pic_num_lx_pred - |
(static_cast<int>(list_mod->abs_diff_pic_num_minus1) + 1); |
// Wrap around max_pic_num_ if it becomes < 0 as result |
// of subtraction. |
@@ -582,7 +578,8 @@ bool H264Decoder::ModifyReferencePicList( |
pic_num_lx_no_wrap += max_pic_num_; |
} else { |
// Add given value to predicted PicNum. |
- pic_num_lx_no_wrap = pic_num_lx_pred + |
+ pic_num_lx_no_wrap = |
+ pic_num_lx_pred + |
(static_cast<int>(list_mod->abs_diff_pic_num_minus1) + 1); |
// Wrap around max_pic_num_ if it becomes >= max_pic_num_ as result |
// of the addition. |
@@ -646,8 +643,8 @@ bool H264Decoder::ModifyReferencePicList( |
default: |
// May be recoverable. |
DVLOG(1) << "Invalid modification_of_pic_nums_idc=" |
- << list_mod->modification_of_pic_nums_idc |
- << " in position " << i; |
+ << list_mod->modification_of_pic_nums_idc << " in position " |
+ << i; |
break; |
} |
@@ -672,8 +669,8 @@ void H264Decoder::OutputPic(scoped_refptr<H264Picture> pic) { |
} |
DVLOG_IF(1, pic->pic_order_cnt < last_output_poc_) |
- << "Outputting out of order, likely a broken stream: " |
- << last_output_poc_ << " -> " << pic->pic_order_cnt; |
+ << "Outputting out of order, likely a broken stream: " << last_output_poc_ |
+ << " -> " << pic->pic_order_cnt; |
last_output_poc_ = pic->pic_order_cnt; |
DVLOG(4) << "Posting output task for POC: " << pic->pic_order_cnt; |
@@ -1007,22 +1004,33 @@ bool H264Decoder::FinishPicture(scoped_refptr<H264Picture> pic) { |
static int LevelToMaxDpbMbs(int level) { |
// See table A-1 in spec. |
switch (level) { |
- case 10: return 396; |
- case 11: return 900; |
- case 12: // fallthrough |
- case 13: // fallthrough |
- case 20: return 2376; |
- case 21: return 4752; |
- case 22: // fallthrough |
- case 30: return 8100; |
- case 31: return 18000; |
- case 32: return 20480; |
- case 40: // fallthrough |
- case 41: return 32768; |
- case 42: return 34816; |
- case 50: return 110400; |
- case 51: // fallthrough |
- case 52: return 184320; |
+ case 10: |
+ return 396; |
+ case 11: |
+ return 900; |
+ case 12: // fallthrough |
+ case 13: // fallthrough |
+ case 20: |
+ return 2376; |
+ case 21: |
+ return 4752; |
+ case 22: // fallthrough |
+ case 30: |
+ return 8100; |
+ case 31: |
+ return 18000; |
+ case 32: |
+ return 20480; |
+ case 40: // fallthrough |
+ case 41: |
+ return 32768; |
+ case 42: |
+ return 34816; |
+ case 50: |
+ return 110400; |
+ case 51: // fallthrough |
+ case 52: |
+ return 184320; |
default: |
DVLOG(1) << "Invalid codec level (" << level << ")"; |
return 0; |
@@ -1304,7 +1312,7 @@ H264Decoder::DecodeResult H264Decoder::Decode() { |
// We can't resume from a non-IDR slice. |
if (state_ != kDecoding) |
break; |
- // else fallthrough |
+ // else fallthrough |
Pawel Osciak
2016/04/19 09:22:55
I believe the indent here was correct.
Mark Dittmer
2016/05/02 03:51:23
Done.
|
case media::H264NALU::kIDRSlice: { |
// TODO(posciak): the IDR may require an SPS that we don't have |
// available. For now we'd fail if that happens, but ideally we'd like |
@@ -1420,4 +1428,4 @@ size_t H264Decoder::GetRequiredNumOfPictures() const { |
return dpb_.max_num_pics() + kPicsInPipeline; |
} |
-} // namespace content |
+} // namespace media |