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

Side by Side Diff: media/gpu/h264_decoder.cc

Issue 2926593002: V4L2SVDA/VAAPIVDA: use visible size from decoder and pass to client (Closed)
Patch Set: V4L2SVDA/VAAPIVDA: use visible size from decoder and pass to client Created 3 years, 6 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 unified diff | Download patch
« no previous file with comments | « media/gpu/h264_decoder.h ('k') | media/gpu/h264_dpb.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <algorithm> 5 #include <algorithm>
6 #include <limits> 6 #include <limits>
7 7
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/bind_helpers.h" 9 #include "base/bind_helpers.h"
10 #include "base/callback_helpers.h" 10 #include "base/callback_helpers.h"
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 // process after this picture is decoded, store required data for that 170 // process after this picture is decoded, store required data for that
171 // purpose. 171 // purpose.
172 if (slice_hdr->adaptive_ref_pic_marking_mode_flag) { 172 if (slice_hdr->adaptive_ref_pic_marking_mode_flag) {
173 static_assert(sizeof(curr_pic_->ref_pic_marking) == 173 static_assert(sizeof(curr_pic_->ref_pic_marking) ==
174 sizeof(slice_hdr->ref_pic_marking), 174 sizeof(slice_hdr->ref_pic_marking),
175 "Array sizes of ref pic marking do not match."); 175 "Array sizes of ref pic marking do not match.");
176 memcpy(curr_pic_->ref_pic_marking, slice_hdr->ref_pic_marking, 176 memcpy(curr_pic_->ref_pic_marking, slice_hdr->ref_pic_marking,
177 sizeof(curr_pic_->ref_pic_marking)); 177 sizeof(curr_pic_->ref_pic_marking));
178 } 178 }
179 179
180 curr_pic_->visible_rect = visible_rect_;
181
180 return true; 182 return true;
181 } 183 }
182 184
183 bool H264Decoder::CalculatePicOrderCounts(scoped_refptr<H264Picture> pic) { 185 bool H264Decoder::CalculatePicOrderCounts(scoped_refptr<H264Picture> pic) {
184 const H264SPS* sps = parser_.GetSPS(curr_sps_id_); 186 const H264SPS* sps = parser_.GetSPS(curr_sps_id_);
185 if (!sps) 187 if (!sps)
186 return false; 188 return false;
187 189
188 switch (pic->pic_order_cnt_type) { 190 switch (pic->pic_order_cnt_type) {
189 case 0: { 191 case 0: {
(...skipping 927 matching lines...) Expand 10 before | Expand all | Expand 10 after
1117 if ((pic_size_ != new_pic_size) || (dpb_.max_num_pics() != max_dpb_size)) { 1119 if ((pic_size_ != new_pic_size) || (dpb_.max_num_pics() != max_dpb_size)) {
1118 if (!Flush()) 1120 if (!Flush())
1119 return false; 1121 return false;
1120 DVLOG(1) << "Codec level: " << level << ", DPB size: " << max_dpb_size 1122 DVLOG(1) << "Codec level: " << level << ", DPB size: " << max_dpb_size
1121 << ", Picture size: " << new_pic_size.ToString(); 1123 << ", Picture size: " << new_pic_size.ToString();
1122 *need_new_buffers = true; 1124 *need_new_buffers = true;
1123 pic_size_ = new_pic_size; 1125 pic_size_ = new_pic_size;
1124 dpb_.set_max_num_pics(max_dpb_size); 1126 dpb_.set_max_num_pics(max_dpb_size);
1125 } 1127 }
1126 1128
1129 gfx::Rect new_visible_rect = sps->GetVisibleRect().value_or(gfx::Rect());
1130 if (visible_rect_ != new_visible_rect) {
1131 DVLOG(2) << "New visible rect: " << new_visible_rect.ToString();
1132 visible_rect_ = new_visible_rect;
1133 }
1134
1127 if (!UpdateMaxNumReorderFrames(sps)) 1135 if (!UpdateMaxNumReorderFrames(sps))
1128 return false; 1136 return false;
1129 DVLOG(1) << "max_num_reorder_frames: " << max_num_reorder_frames_; 1137 DVLOG(1) << "max_num_reorder_frames: " << max_num_reorder_frames_;
1130 1138
1131 return true; 1139 return true;
1132 } 1140 }
1133 1141
1134 bool H264Decoder::FinishPrevFrameIfPresent() { 1142 bool H264Decoder::FinishPrevFrameIfPresent() {
1135 // If we already have a frame waiting to be decoded, decode it and finish. 1143 // If we already have a frame waiting to be decoded, decode it and finish.
1136 if (curr_pic_) { 1144 if (curr_pic_) {
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after
1427 1435
1428 gfx::Size H264Decoder::GetPicSize() const { 1436 gfx::Size H264Decoder::GetPicSize() const {
1429 return pic_size_; 1437 return pic_size_;
1430 } 1438 }
1431 1439
1432 size_t H264Decoder::GetRequiredNumOfPictures() const { 1440 size_t H264Decoder::GetRequiredNumOfPictures() const {
1433 return dpb_.max_num_pics() + kPicsInPipeline; 1441 return dpb_.max_num_pics() + kPicsInPipeline;
1434 } 1442 }
1435 1443
1436 } // namespace media 1444 } // namespace media
OLDNEW
« no previous file with comments | « media/gpu/h264_decoder.h ('k') | media/gpu/h264_dpb.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698