[go: nahoru, domu]

blob: bbe17de16d12482f1782caf41adc610c5755a240 [file] [log] [blame]
posciakd94b2b082015-09-18 04:03:401// Copyright 2015 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
markdittmer6e70beb82016-05-02 05:40:475#include "media/gpu/vp9_decoder.h"
mostynb6682b1c42016-04-19 10:17:306
7#include <memory>
8
posciak77118c92016-08-28 13:18:399#include "base/bind.h"
Hirokazu Honda10df95d2019-07-19 19:31:4310#include "base/feature_list.h"
mostynb6682b1c42016-04-19 10:17:3011#include "base/logging.h"
Hirokazu Honda967b9192019-08-27 00:59:4212#include "build/build_config.h"
Yuta Hijikata29f67812020-10-24 01:15:4413#include "build/chromeos_buildflags.h"
posciakd94b2b082015-09-18 04:03:4014#include "media/base/limits.h"
Hirokazu Honda10df95d2019-07-19 19:31:4315#include "media/base/media_switches.h"
markdittmer6e70beb82016-05-02 05:40:4716#include "media/gpu/vp9_decoder.h"
posciakd94b2b082015-09-18 04:03:4017
markdittmer6e70beb82016-05-02 05:40:4718namespace media {
posciakd94b2b082015-09-18 04:03:4019
Hirokazu Honda10df95d2019-07-19 19:31:4320namespace {
21std::vector<uint32_t> GetSpatialLayerFrameSize(
22 const DecoderBuffer& decoder_buffer) {
Yuta Hijikata3893688a2020-12-17 01:46:2323#if defined(ARCH_CPU_X86_FAMILY) && BUILDFLAG(IS_CHROMEOS_ASH)
Hirokazu Honda10df95d2019-07-19 19:31:4324 const uint32_t* cue_data =
25 reinterpret_cast<const uint32_t*>(decoder_buffer.side_data());
Jose Lopes24d1cda82020-02-21 13:22:3626 if (!cue_data) {
Hirokazu Honda10df95d2019-07-19 19:31:4327 return {};
Jose Lopes24d1cda82020-02-21 13:22:3628 }
Hirokazu Honda10df95d2019-07-19 19:31:4329 if (!base::FeatureList::IsEnabled(media::kVp9kSVCHWDecoding)) {
30 DLOG(ERROR) << "Vp9Parser doesn't support parsing SVC stream";
31 return {};
32 }
33
34 size_t num_of_layers = decoder_buffer.side_data_size() / sizeof(uint32_t);
35 if (num_of_layers > 3u) {
36 DLOG(WARNING) << "The maximum number of spatial layers in VP9 is three";
37 return {};
38 }
39 return std::vector<uint32_t>(cue_data, cue_data + num_of_layers);
Yuta Hijikata3893688a2020-12-17 01:46:2340#endif // defined(ARCH_CPU_X86_FAMILY) && BUILDFLAG(IS_CHROMEOS_ASH)
Hirokazu Honda967b9192019-08-27 00:59:4241 return {};
Hirokazu Honda10df95d2019-07-19 19:31:4342}
Hirokazu Honda7ec32652019-11-22 09:40:2143
44VideoCodecProfile VP9ProfileToVideoCodecProfile(uint8_t profile) {
45 switch (profile) {
46 case 0:
47 return VP9PROFILE_PROFILE0;
48 case 1:
49 return VP9PROFILE_PROFILE1;
50 case 2:
51 return VP9PROFILE_PROFILE2;
52 case 3:
53 return VP9PROFILE_PROFILE3;
54 default:
55 return VIDEO_CODEC_PROFILE_UNKNOWN;
56 }
57}
58
Hirokazu Honda963303782020-12-03 05:57:0459bool IsValidBitDepth(uint8_t bit_depth, VideoCodecProfile profile) {
60 // Spec 7.2.
61 switch (profile) {
62 case VP9PROFILE_PROFILE0:
63 case VP9PROFILE_PROFILE1:
64 return bit_depth == 8u;
65 case VP9PROFILE_PROFILE2:
66 case VP9PROFILE_PROFILE3:
67 return bit_depth == 10u || bit_depth == 12u;
68 default:
69 NOTREACHED();
70 return false;
71 }
72}
Hirokazu Honda790d98e2020-12-04 03:41:4873
74bool IsYUV420Sequence(const Vp9FrameHeader& frame_header) {
75 // Spec 7.2.2
76 return frame_header.subsampling_x == 1u && frame_header.subsampling_y == 1u;
77}
Hirokazu Honda10df95d2019-07-19 19:31:4378} // namespace
79
posciakd94b2b082015-09-18 04:03:4080VP9Decoder::VP9Accelerator::VP9Accelerator() {}
81
82VP9Decoder::VP9Accelerator::~VP9Accelerator() {}
83
Fredrik Hubinette3cebc622018-10-27 01:01:1284VP9Decoder::VP9Decoder(std::unique_ptr<VP9Accelerator> accelerator,
Hirokazu Honda7ec32652019-11-22 09:40:2185 VideoCodecProfile profile,
Fredrik Hubinette3cebc622018-10-27 01:01:1286 const VideoColorSpace& container_color_space)
posciak77118c92016-08-28 13:18:3987 : state_(kNeedStreamMetadata),
Fredrik Hubinette3cebc622018-10-27 01:01:1288 container_color_space_(container_color_space),
Hirokazu Honda7ec32652019-11-22 09:40:2189 // TODO(hiroh): Set profile to UNKNOWN.
90 profile_(profile),
Miguel Casas2d5ecad82018-02-22 19:03:0591 accelerator_(std::move(accelerator)),
Hirokazu Honda7ec32652019-11-22 09:40:2192 parser_(accelerator_->IsFrameContextRequired()) {}
posciakd94b2b082015-09-18 04:03:4093
Miguel Casas2d5ecad82018-02-22 19:03:0594VP9Decoder::~VP9Decoder() = default;
posciakd94b2b082015-09-18 04:03:4095
Hirokazu Honda23132c32019-07-09 14:31:2096void VP9Decoder::SetStream(int32_t id, const DecoderBuffer& decoder_buffer) {
97 const uint8_t* ptr = decoder_buffer.data();
98 const size_t size = decoder_buffer.data_size();
99 const DecryptConfig* decrypt_config = decoder_buffer.decrypt_config();
100
posciakd94b2b082015-09-18 04:03:40101 DCHECK(ptr);
102 DCHECK(size);
Pawel Osciakec6e21b2018-03-19 09:13:06103 DVLOG(4) << "New input stream id: " << id << " at: " << (void*)ptr
104 << " size: " << size;
105 stream_id_ = id;
Ted Meyer0b35c5fd2018-11-27 22:29:29106 if (decrypt_config) {
Hirokazu Honda10df95d2019-07-19 19:31:43107 parser_.SetStream(ptr, size, GetSpatialLayerFrameSize(decoder_buffer),
108 decrypt_config->Clone());
Ted Meyer0b35c5fd2018-11-27 22:29:29109 } else {
Hirokazu Honda10df95d2019-07-19 19:31:43110 parser_.SetStream(ptr, size, GetSpatialLayerFrameSize(decoder_buffer),
111 nullptr);
Ted Meyer0b35c5fd2018-11-27 22:29:29112 }
posciakd94b2b082015-09-18 04:03:40113}
114
115bool VP9Decoder::Flush() {
116 DVLOG(2) << "Decoder flush";
117 Reset();
118 return true;
119}
120
121void VP9Decoder::Reset() {
122 curr_frame_hdr_ = nullptr;
Jeffrey Kardatzke48ebdb692021-01-11 22:05:02123 decrypt_config_.reset();
Jeffrey Kardatzke5e36baf2020-11-20 22:17:13124 pending_pic_.reset();
Sreerenj Balachandran1beb5482019-04-03 03:40:05125
126 ref_frames_.Clear();
posciakd94b2b082015-09-18 04:03:40127
128 parser_.Reset();
129
Jose Lopes24d1cda82020-02-21 13:22:36130 if (state_ == kDecoding) {
posciakd94b2b082015-09-18 04:03:40131 state_ = kAfterReset;
Jose Lopes24d1cda82020-02-21 13:22:36132 }
posciakd94b2b082015-09-18 04:03:40133}
134
135VP9Decoder::DecodeResult VP9Decoder::Decode() {
Jeffrey Kardatzke5e36baf2020-11-20 22:17:13136 while (true) {
137 // If we have a pending picture to decode, try that first.
138 if (pending_pic_) {
Jeffrey Kardatzke4ed4e332020-12-05 00:32:15139 VP9Accelerator::Status status =
140 DecodeAndOutputPicture(std::move(pending_pic_));
Jeffrey Kardatzke5e36baf2020-11-20 22:17:13141 if (status == VP9Accelerator::Status::kFail) {
Jeffrey Kardatzke5e36baf2020-11-20 22:17:13142 SetError();
143 return kDecodeError;
144 }
145 if (status == VP9Accelerator::Status::kTryAgain)
146 return kTryAgain;
Jeffrey Kardatzke5e36baf2020-11-20 22:17:13147 }
148
posciakd94b2b082015-09-18 04:03:40149 // Read a new frame header if one is not awaiting decoding already.
150 if (!curr_frame_hdr_) {
Hirokazu Honda10df95d2019-07-19 19:31:43151 gfx::Size allocate_size;
xhwang60f96672016-06-14 21:47:53152 std::unique_ptr<Vp9FrameHeader> hdr(new Vp9FrameHeader());
Ted Meyer0b35c5fd2018-11-27 22:29:29153 Vp9Parser::Result res =
Jeffrey Kardatzke48ebdb692021-01-11 22:05:02154 parser_.ParseNextFrame(hdr.get(), &allocate_size, &decrypt_config_);
posciakd94b2b082015-09-18 04:03:40155 switch (res) {
xhwang60f96672016-06-14 21:47:53156 case Vp9Parser::kOk:
brusi_roy8e7155962016-09-14 18:22:58157 curr_frame_hdr_ = std::move(hdr);
Hirokazu Honda10df95d2019-07-19 19:31:43158 curr_frame_size_ = allocate_size;
posciakd94b2b082015-09-18 04:03:40159 break;
160
xhwang60f96672016-06-14 21:47:53161 case Vp9Parser::kEOStream:
posciakd94b2b082015-09-18 04:03:40162 return kRanOutOfStreamData;
163
xhwang60f96672016-06-14 21:47:53164 case Vp9Parser::kInvalidStream:
posciakd94b2b082015-09-18 04:03:40165 DVLOG(1) << "Error parsing stream";
166 SetError();
167 return kDecodeError;
kcwue5a9a6292016-08-17 03:40:02168
169 case Vp9Parser::kAwaitingRefresh:
posciak77118c92016-08-28 13:18:39170 DVLOG(4) << "Awaiting context update";
171 return kNeedContextUpdate;
posciakd94b2b082015-09-18 04:03:40172 }
173 }
174
175 if (state_ != kDecoding) {
176 // Not kDecoding, so we need a resume point (a keyframe), as we are after
177 // reset or at the beginning of the stream. Drop anything that is not
178 // a keyframe in such case, and continue looking for a keyframe.
Sreerenj Balachandran57163302018-11-28 02:45:57179 // Only exception is when the stream/sequence starts with an Intra only
180 // frame.
181 if (curr_frame_hdr_->IsKeyframe() ||
182 (curr_frame_hdr_->IsIntra() && pic_size_.IsEmpty())) {
posciakd94b2b082015-09-18 04:03:40183 state_ = kDecoding;
184 } else {
185 curr_frame_hdr_.reset();
Jeffrey Kardatzke48ebdb692021-01-11 22:05:02186 decrypt_config_.reset();
posciakd94b2b082015-09-18 04:03:40187 continue;
188 }
189 }
190
191 if (curr_frame_hdr_->show_existing_frame) {
192 // This frame header only instructs us to display one of the
193 // previously-decoded frames, but has no frame data otherwise. Display
194 // and continue decoding subsequent frames.
kcwue5a9a6292016-08-17 03:40:02195 size_t frame_to_show = curr_frame_hdr_->frame_to_show_map_idx;
Sreerenj Balachandran1beb5482019-04-03 03:40:05196 if (frame_to_show >= kVp9NumRefFrames ||
197 !ref_frames_.GetFrame(frame_to_show)) {
posciakd94b2b082015-09-18 04:03:40198 DVLOG(1) << "Request to show an invalid frame";
199 SetError();
200 return kDecodeError;
201 }
202
Chih-Yu Huangcd5181e2018-10-23 06:33:06203 // Duplicate the VP9Picture and set the current bitstream id to keep the
204 // correct timestamp.
Sreerenj Balachandran1beb5482019-04-03 03:40:05205 scoped_refptr<VP9Picture> pic =
206 ref_frames_.GetFrame(frame_to_show)->Duplicate();
Chih-Yu Huangcd5181e2018-10-23 06:33:06207 if (pic == nullptr) {
208 DVLOG(1) << "Failed to duplicate the VP9Picture.";
209 SetError();
210 return kDecodeError;
211 }
212 pic->set_bitstream_id(stream_id_);
213 if (!accelerator_->OutputPicture(std::move(pic))) {
posciakd94b2b082015-09-18 04:03:40214 SetError();
215 return kDecodeError;
216 }
217
218 curr_frame_hdr_.reset();
Jeffrey Kardatzke48ebdb692021-01-11 22:05:02219 decrypt_config_.reset();
posciakd94b2b082015-09-18 04:03:40220 continue;
221 }
222
Hirokazu Honda10df95d2019-07-19 19:31:43223 gfx::Size new_pic_size = curr_frame_size_;
Hirokazu Honda436cf27b2019-05-21 10:44:39224 gfx::Rect new_render_rect(curr_frame_hdr_->render_width,
225 curr_frame_hdr_->render_height);
Hirokazu Hondacffd0ef2020-02-28 03:32:31226 // For safety, check the validity of render size or leave it as pic size.
Hirokazu Honda436cf27b2019-05-21 10:44:39227 if (!gfx::Rect(new_pic_size).Contains(new_render_rect)) {
228 DVLOG(1) << "Render size exceeds picture size. render size: "
229 << new_render_rect.ToString()
230 << ", picture size: " << new_pic_size.ToString();
Hirokazu Hondacffd0ef2020-02-28 03:32:31231 new_render_rect = gfx::Rect(new_pic_size);
Hirokazu Honda436cf27b2019-05-21 10:44:39232 }
Hirokazu Honda7ec32652019-11-22 09:40:21233 VideoCodecProfile new_profile =
234 VP9ProfileToVideoCodecProfile(curr_frame_hdr_->profile);
235 if (new_profile == VIDEO_CODEC_PROFILE_UNKNOWN) {
236 VLOG(1) << "Invalid profile: " << curr_frame_hdr_->profile;
237 return kDecodeError;
238 }
Hirokazu Honda963303782020-12-03 05:57:04239 if (!IsValidBitDepth(curr_frame_hdr_->bit_depth, new_profile)) {
240 DVLOG(1) << "Invalid bit depth="
241 << base::strict_cast<int>(curr_frame_hdr_->bit_depth)
242 << ", profile=" << GetProfileName(new_profile);
243 return kDecodeError;
244 }
Hirokazu Honda790d98e2020-12-04 03:41:48245 if (!IsYUV420Sequence(*curr_frame_hdr_)) {
246 DVLOG(1) << "Only YUV 4:2:0 is supported";
247 return kDecodeError;
248 }
posciakd94b2b082015-09-18 04:03:40249
Hirokazu Honda436cf27b2019-05-21 10:44:39250 DCHECK(!new_pic_size.IsEmpty());
Hirokazu Honda963303782020-12-03 05:57:04251 if (new_pic_size != pic_size_ || new_profile != profile_ ||
252 curr_frame_hdr_->bit_depth != bit_depth_) {
Hirokazu Honda7ec32652019-11-22 09:40:21253 DVLOG(1) << "New profile: " << GetProfileName(new_profile)
Hirokazu Honda963303782020-12-03 05:57:04254 << ", New resolution: " << new_pic_size.ToString()
255 << ", New bit depth: "
256 << base::strict_cast<int>(curr_frame_hdr_->bit_depth);
posciakd94b2b082015-09-18 04:03:40257
Sreerenj Balachandran57163302018-11-28 02:45:57258 if (!curr_frame_hdr_->IsKeyframe() &&
Hirokazu Honda7ec32652019-11-22 09:40:21259 !(curr_frame_hdr_->IsIntra() && pic_size_.IsEmpty())) {
posciakd94b2b082015-09-18 04:03:40260 // TODO(posciak): This is doable, but requires a few modifications to
261 // VDA implementations to allow multiple picture buffer sets in flight.
Dongseong Hwang4f20ebb2018-06-07 00:28:20262 // http://crbug.com/832264
Sreerenj Balachandran57163302018-11-28 02:45:57263 DVLOG(1) << "Resolution change currently supported for keyframes and "
264 "sequence begins with Intra only when there is no prior "
265 "frames in the context";
Dongseong Hwang4f20ebb2018-06-07 00:28:20266 if (++size_change_failure_counter_ > kVPxMaxNumOfSizeChangeFailures) {
267 SetError();
268 return kDecodeError;
269 }
270
271 curr_frame_hdr_.reset();
Jeffrey Kardatzke48ebdb692021-01-11 22:05:02272 decrypt_config_.reset();
Dongseong Hwang4f20ebb2018-06-07 00:28:20273 return kRanOutOfStreamData;
posciakd94b2b082015-09-18 04:03:40274 }
275
276 // TODO(posciak): This requires us to be on a keyframe (see above) and is
277 // required, because VDA clients expect all surfaces to be returned before
Hirokazu Honda7ec32652019-11-22 09:40:21278 // they can cycle surface sets after receiving kConfigChange.
posciakd94b2b082015-09-18 04:03:40279 // This is only an implementation detail of VDAs and can be improved.
Sreerenj Balachandran1beb5482019-04-03 03:40:05280 ref_frames_.Clear();
posciakd94b2b082015-09-18 04:03:40281
282 pic_size_ = new_pic_size;
Hirokazu Honda436cf27b2019-05-21 10:44:39283 visible_rect_ = new_render_rect;
Hirokazu Honda7ec32652019-11-22 09:40:21284 profile_ = new_profile;
Hirokazu Honda963303782020-12-03 05:57:04285 bit_depth_ = curr_frame_hdr_->bit_depth;
Dongseong Hwang4f20ebb2018-06-07 00:28:20286 size_change_failure_counter_ = 0;
Hirokazu Honda7ec32652019-11-22 09:40:21287 return kConfigChange;
posciakd94b2b082015-09-18 04:03:40288 }
289
Jeffrey Kardatzke4ed4e332020-12-05 00:32:15290 scoped_refptr<VP9Picture> pic = accelerator_->CreateVP9Picture();
291 if (!pic) {
posciakd94b2b082015-09-18 04:03:40292 return kRanOutOfSurfaces;
Jose Lopes24d1cda82020-02-21 13:22:36293 }
johnylin74410872017-06-19 13:05:30294 DVLOG(2) << "Render resolution: " << new_render_rect.ToString();
295
Jeffrey Kardatzke4ed4e332020-12-05 00:32:15296 pic->set_visible_rect(new_render_rect);
297 pic->set_bitstream_id(stream_id_);
Fredrik Hubinette3cebc622018-10-27 01:01:12298
Jeffrey Kardatzke48ebdb692021-01-11 22:05:02299 pic->set_decrypt_config(std::move(decrypt_config_));
Ted Meyer0b35c5fd2018-11-27 22:29:29300
Fredrik Hubinette3cebc622018-10-27 01:01:12301 // For VP9, container color spaces override video stream color spaces.
Jeffrey Kardatzke5e36baf2020-11-20 22:17:13302 if (container_color_space_.IsSpecified())
Jeffrey Kardatzke4ed4e332020-12-05 00:32:15303 pic->set_colorspace(container_color_space_);
Jeffrey Kardatzke5e36baf2020-11-20 22:17:13304 else if (curr_frame_hdr_)
Jeffrey Kardatzke4ed4e332020-12-05 00:32:15305 pic->set_colorspace(curr_frame_hdr_->GetColorSpace());
posciakd94b2b082015-09-18 04:03:40306
Jeffrey Kardatzke4ed4e332020-12-05 00:32:15307 pic->frame_hdr = std::move(curr_frame_hdr_);
Jeffrey Kardatzke5e36baf2020-11-20 22:17:13308
Jeffrey Kardatzke4ed4e332020-12-05 00:32:15309 VP9Accelerator::Status status = DecodeAndOutputPicture(std::move(pic));
Jeffrey Kardatzke5e36baf2020-11-20 22:17:13310 if (status == VP9Accelerator::Status::kFail) {
posciakd94b2b082015-09-18 04:03:40311 SetError();
312 return kDecodeError;
313 }
Jeffrey Kardatzke5e36baf2020-11-20 22:17:13314 if (status == VP9Accelerator::Status::kTryAgain)
315 return kTryAgain;
posciakd94b2b082015-09-18 04:03:40316 }
317}
318
posciak77118c92016-08-28 13:18:39319void VP9Decoder::UpdateFrameContext(
Ted Meyer4fac4f62019-05-08 22:57:15320 scoped_refptr<VP9Picture> pic,
Jose Lopes24d1cda82020-02-21 13:22:36321 Vp9Parser::ContextRefreshCallback context_refresh_cb) {
Dale Curtise25163812018-09-21 22:13:39322 DCHECK(context_refresh_cb);
posciak77118c92016-08-28 13:18:39323 Vp9FrameContext frame_ctx;
324 memset(&frame_ctx, 0, sizeof(frame_ctx));
325
Ted Meyer4fac4f62019-05-08 22:57:15326 if (!accelerator_->GetFrameContext(std::move(pic), &frame_ctx)) {
posciak77118c92016-08-28 13:18:39327 SetError();
328 return;
329 }
330
Jose Lopes24d1cda82020-02-21 13:22:36331 std::move(context_refresh_cb).Run(frame_ctx);
posciak77118c92016-08-28 13:18:39332}
333
Jeffrey Kardatzke5e36baf2020-11-20 22:17:13334VP9Decoder::VP9Accelerator::Status VP9Decoder::DecodeAndOutputPicture(
335 scoped_refptr<VP9Picture> pic) {
posciakd94b2b082015-09-18 04:03:40336 DCHECK(!pic_size_.IsEmpty());
337 DCHECK(pic->frame_hdr);
338
Chih-Yu Huangcc6b1b92019-12-19 08:57:16339 base::OnceClosure done_cb;
Jose Lopes24d1cda82020-02-21 13:22:36340 Vp9Parser::ContextRefreshCallback context_refresh_cb =
posciak77118c92016-08-28 13:18:39341 parser_.GetContextRefreshCb(pic->frame_hdr->frame_context_idx);
Jose Lopes24d1cda82020-02-21 13:22:36342 if (context_refresh_cb) {
343 done_cb =
344 base::BindOnce(&VP9Decoder::UpdateFrameContext, base::Unretained(this),
345 pic, std::move(context_refresh_cb));
346 }
posciak77118c92016-08-28 13:18:39347
348 const Vp9Parser::Context& context = parser_.context();
Jeffrey Kardatzke5e36baf2020-11-20 22:17:13349 VP9Accelerator::Status status = accelerator_->SubmitDecode(
350 pic, context.segmentation(), context.loop_filter(), ref_frames_,
351 std::move(done_cb));
Jeffrey Kardatzke4ed4e332020-12-05 00:32:15352 if (status != VP9Accelerator::Status::kOk) {
353 if (status == VP9Accelerator::Status::kTryAgain)
354 pending_pic_ = std::move(pic);
Jeffrey Kardatzke5e36baf2020-11-20 22:17:13355 return status;
Jeffrey Kardatzke4ed4e332020-12-05 00:32:15356 }
posciakd94b2b082015-09-18 04:03:40357
358 if (pic->frame_hdr->show_frame) {
Jeffrey Kardatzke5e36baf2020-11-20 22:17:13359 if (!accelerator_->OutputPicture(pic))
360 return VP9Accelerator::Status::kFail;
posciakd94b2b082015-09-18 04:03:40361 }
362
Ted Meyer4fac4f62019-05-08 22:57:15363 ref_frames_.Refresh(std::move(pic));
Jeffrey Kardatzke5e36baf2020-11-20 22:17:13364 return status;
posciakd94b2b082015-09-18 04:03:40365}
366
367void VP9Decoder::SetError() {
368 Reset();
369 state_ = kError;
370}
371
372gfx::Size VP9Decoder::GetPicSize() const {
373 return pic_size_;
374}
375
Hirokazu Honda436cf27b2019-05-21 10:44:39376gfx::Rect VP9Decoder::GetVisibleRect() const {
377 return visible_rect_;
378}
379
Hirokazu Honda7ec32652019-11-22 09:40:21380VideoCodecProfile VP9Decoder::GetProfile() const {
381 return profile_;
382}
383
Hirokazu Honda963303782020-12-03 05:57:04384uint8_t VP9Decoder::GetBitDepth() const {
385 return bit_depth_;
386}
387
posciakd94b2b082015-09-18 04:03:40388size_t VP9Decoder::GetRequiredNumOfPictures() const {
Miguel Casas477a7062019-01-04 19:13:45389 constexpr size_t kPicsInPipeline = limits::kMaxVideoFrames + 1;
390 return kPicsInPipeline + GetNumReferenceFrames();
391}
392
393size_t VP9Decoder::GetNumReferenceFrames() const {
Miguel Casas3dd7e562019-02-14 17:38:46394 // Maximum number of reference frames
395 return kVp9NumRefFrames;
posciakd94b2b082015-09-18 04:03:40396}
397
markdittmer6e70beb82016-05-02 05:40:47398} // namespace media