[go: nahoru, domu]

blob: 3db79cf8629073e2b1f9eb48c17cd83503cdaaa8 [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 {
Hirokazu Hondafb2681c2021-10-29 03:53:5921bool GetSpatialLayerFrameSize(const DecoderBuffer& decoder_buffer,
22 std::vector<uint32_t>& frame_sizes) {
23 frame_sizes.clear();
24
Hirokazu Honda10df95d2019-07-19 19:31:4325 const uint32_t* cue_data =
26 reinterpret_cast<const uint32_t*>(decoder_buffer.side_data());
Hirokazu Hondafb2681c2021-10-29 03:53:5927 if (!cue_data)
28 return true;
29
30 if (!base::FeatureList::IsEnabled(media::kVp9kSVCHWDecoding)) {
31 DLOG(ERROR) << "Vp9 k-SVC hardware decoding is disabled";
32 return false;
Hirokazu Honda10df95d2019-07-19 19:31:4333 }
34
35 size_t num_of_layers = decoder_buffer.side_data_size() / sizeof(uint32_t);
36 if (num_of_layers > 3u) {
37 DLOG(WARNING) << "The maximum number of spatial layers in VP9 is three";
Hirokazu Hondafb2681c2021-10-29 03:53:5938 return false;
Hirokazu Honda10df95d2019-07-19 19:31:4339 }
Hirokazu Hondafb2681c2021-10-29 03:53:5940
41 frame_sizes = std::vector<uint32_t>(cue_data, cue_data + num_of_layers);
42 return true;
Hirokazu Honda10df95d2019-07-19 19:31:4343}
Hirokazu Honda7ec32652019-11-22 09:40:2144
45VideoCodecProfile VP9ProfileToVideoCodecProfile(uint8_t profile) {
46 switch (profile) {
47 case 0:
48 return VP9PROFILE_PROFILE0;
49 case 1:
50 return VP9PROFILE_PROFILE1;
51 case 2:
52 return VP9PROFILE_PROFILE2;
53 case 3:
54 return VP9PROFILE_PROFILE3;
55 default:
56 return VIDEO_CODEC_PROFILE_UNKNOWN;
57 }
58}
59
Hirokazu Honda963303782020-12-03 05:57:0460bool IsValidBitDepth(uint8_t bit_depth, VideoCodecProfile profile) {
61 // Spec 7.2.
62 switch (profile) {
63 case VP9PROFILE_PROFILE0:
64 case VP9PROFILE_PROFILE1:
65 return bit_depth == 8u;
66 case VP9PROFILE_PROFILE2:
67 case VP9PROFILE_PROFILE3:
68 return bit_depth == 10u || bit_depth == 12u;
69 default:
70 NOTREACHED();
71 return false;
72 }
73}
Hirokazu Honda790d98e2020-12-04 03:41:4874
75bool IsYUV420Sequence(const Vp9FrameHeader& frame_header) {
76 // Spec 7.2.2
77 return frame_header.subsampling_x == 1u && frame_header.subsampling_y == 1u;
78}
Hirokazu Honda10df95d2019-07-19 19:31:4379} // namespace
80
posciakd94b2b082015-09-18 04:03:4081VP9Decoder::VP9Accelerator::VP9Accelerator() {}
82
83VP9Decoder::VP9Accelerator::~VP9Accelerator() {}
84
Fredrik Hubinette3cebc622018-10-27 01:01:1285VP9Decoder::VP9Decoder(std::unique_ptr<VP9Accelerator> accelerator,
Hirokazu Honda7ec32652019-11-22 09:40:2186 VideoCodecProfile profile,
Fredrik Hubinette3cebc622018-10-27 01:01:1287 const VideoColorSpace& container_color_space)
posciak77118c92016-08-28 13:18:3988 : state_(kNeedStreamMetadata),
Fredrik Hubinette3cebc622018-10-27 01:01:1289 container_color_space_(container_color_space),
Hirokazu Honda7ec32652019-11-22 09:40:2190 // TODO(hiroh): Set profile to UNKNOWN.
91 profile_(profile),
Miguel Casas2d5ecad82018-02-22 19:03:0592 accelerator_(std::move(accelerator)),
Hirokazu Honda7ec32652019-11-22 09:40:2193 parser_(accelerator_->IsFrameContextRequired()) {}
posciakd94b2b082015-09-18 04:03:4094
Miguel Casas2d5ecad82018-02-22 19:03:0595VP9Decoder::~VP9Decoder() = default;
posciakd94b2b082015-09-18 04:03:4096
Hirokazu Honda23132c32019-07-09 14:31:2097void VP9Decoder::SetStream(int32_t id, const DecoderBuffer& decoder_buffer) {
98 const uint8_t* ptr = decoder_buffer.data();
99 const size_t size = decoder_buffer.data_size();
100 const DecryptConfig* decrypt_config = decoder_buffer.decrypt_config();
101
posciakd94b2b082015-09-18 04:03:40102 DCHECK(ptr);
103 DCHECK(size);
Pawel Osciakec6e21b2018-03-19 09:13:06104 DVLOG(4) << "New input stream id: " << id << " at: " << (void*)ptr
105 << " size: " << size;
106 stream_id_ = id;
Hirokazu Hondafb2681c2021-10-29 03:53:59107 std::vector<uint32_t> frame_sizes;
108 if (!GetSpatialLayerFrameSize(decoder_buffer, frame_sizes)) {
109 SetError();
110 return;
Ted Meyer0b35c5fd2018-11-27 22:29:29111 }
Hirokazu Hondafb2681c2021-10-29 03:53:59112
113 parser_.SetStream(ptr, size, frame_sizes,
114 decrypt_config ? decrypt_config->Clone() : nullptr);
posciakd94b2b082015-09-18 04:03:40115}
116
117bool VP9Decoder::Flush() {
118 DVLOG(2) << "Decoder flush";
119 Reset();
120 return true;
121}
122
123void VP9Decoder::Reset() {
124 curr_frame_hdr_ = nullptr;
Jeffrey Kardatzke48ebdb692021-01-11 22:05:02125 decrypt_config_.reset();
Jeffrey Kardatzke5e36baf2020-11-20 22:17:13126 pending_pic_.reset();
Sreerenj Balachandran1beb5482019-04-03 03:40:05127
128 ref_frames_.Clear();
posciakd94b2b082015-09-18 04:03:40129
130 parser_.Reset();
131
Jose Lopes24d1cda82020-02-21 13:22:36132 if (state_ == kDecoding) {
posciakd94b2b082015-09-18 04:03:40133 state_ = kAfterReset;
Jose Lopes24d1cda82020-02-21 13:22:36134 }
posciakd94b2b082015-09-18 04:03:40135}
136
137VP9Decoder::DecodeResult VP9Decoder::Decode() {
Jeffrey Kardatzke5e36baf2020-11-20 22:17:13138 while (true) {
Hirokazu Hondafb2681c2021-10-29 03:53:59139 if (state_ == kError)
140 return kDecodeError;
141
Jeffrey Kardatzke5e36baf2020-11-20 22:17:13142 // If we have a pending picture to decode, try that first.
143 if (pending_pic_) {
Jeffrey Kardatzke4ed4e332020-12-05 00:32:15144 VP9Accelerator::Status status =
145 DecodeAndOutputPicture(std::move(pending_pic_));
Jeffrey Kardatzke5e36baf2020-11-20 22:17:13146 if (status == VP9Accelerator::Status::kFail) {
Jeffrey Kardatzke5e36baf2020-11-20 22:17:13147 SetError();
148 return kDecodeError;
149 }
150 if (status == VP9Accelerator::Status::kTryAgain)
151 return kTryAgain;
Jeffrey Kardatzke5e36baf2020-11-20 22:17:13152 }
153
posciakd94b2b082015-09-18 04:03:40154 // Read a new frame header if one is not awaiting decoding already.
155 if (!curr_frame_hdr_) {
Hirokazu Honda10df95d2019-07-19 19:31:43156 gfx::Size allocate_size;
xhwang60f96672016-06-14 21:47:53157 std::unique_ptr<Vp9FrameHeader> hdr(new Vp9FrameHeader());
Ted Meyer0b35c5fd2018-11-27 22:29:29158 Vp9Parser::Result res =
Jeffrey Kardatzke48ebdb692021-01-11 22:05:02159 parser_.ParseNextFrame(hdr.get(), &allocate_size, &decrypt_config_);
posciakd94b2b082015-09-18 04:03:40160 switch (res) {
xhwang60f96672016-06-14 21:47:53161 case Vp9Parser::kOk:
brusi_roy8e7155962016-09-14 18:22:58162 curr_frame_hdr_ = std::move(hdr);
Hirokazu Honda10df95d2019-07-19 19:31:43163 curr_frame_size_ = allocate_size;
posciakd94b2b082015-09-18 04:03:40164 break;
165
xhwang60f96672016-06-14 21:47:53166 case Vp9Parser::kEOStream:
posciakd94b2b082015-09-18 04:03:40167 return kRanOutOfStreamData;
168
xhwang60f96672016-06-14 21:47:53169 case Vp9Parser::kInvalidStream:
posciakd94b2b082015-09-18 04:03:40170 DVLOG(1) << "Error parsing stream";
171 SetError();
172 return kDecodeError;
kcwue5a9a6292016-08-17 03:40:02173
174 case Vp9Parser::kAwaitingRefresh:
posciak77118c92016-08-28 13:18:39175 DVLOG(4) << "Awaiting context update";
176 return kNeedContextUpdate;
posciakd94b2b082015-09-18 04:03:40177 }
178 }
179
180 if (state_ != kDecoding) {
181 // Not kDecoding, so we need a resume point (a keyframe), as we are after
182 // reset or at the beginning of the stream. Drop anything that is not
183 // a keyframe in such case, and continue looking for a keyframe.
Sreerenj Balachandran57163302018-11-28 02:45:57184 // Only exception is when the stream/sequence starts with an Intra only
185 // frame.
186 if (curr_frame_hdr_->IsKeyframe() ||
187 (curr_frame_hdr_->IsIntra() && pic_size_.IsEmpty())) {
posciakd94b2b082015-09-18 04:03:40188 state_ = kDecoding;
189 } else {
190 curr_frame_hdr_.reset();
Jeffrey Kardatzke48ebdb692021-01-11 22:05:02191 decrypt_config_.reset();
posciakd94b2b082015-09-18 04:03:40192 continue;
193 }
194 }
195
196 if (curr_frame_hdr_->show_existing_frame) {
197 // This frame header only instructs us to display one of the
198 // previously-decoded frames, but has no frame data otherwise. Display
199 // and continue decoding subsequent frames.
kcwue5a9a6292016-08-17 03:40:02200 size_t frame_to_show = curr_frame_hdr_->frame_to_show_map_idx;
Sreerenj Balachandran1beb5482019-04-03 03:40:05201 if (frame_to_show >= kVp9NumRefFrames ||
202 !ref_frames_.GetFrame(frame_to_show)) {
posciakd94b2b082015-09-18 04:03:40203 DVLOG(1) << "Request to show an invalid frame";
204 SetError();
205 return kDecodeError;
206 }
207
Chih-Yu Huangcd5181e2018-10-23 06:33:06208 // Duplicate the VP9Picture and set the current bitstream id to keep the
209 // correct timestamp.
Sreerenj Balachandran1beb5482019-04-03 03:40:05210 scoped_refptr<VP9Picture> pic =
211 ref_frames_.GetFrame(frame_to_show)->Duplicate();
Chih-Yu Huangcd5181e2018-10-23 06:33:06212 if (pic == nullptr) {
213 DVLOG(1) << "Failed to duplicate the VP9Picture.";
214 SetError();
215 return kDecodeError;
216 }
217 pic->set_bitstream_id(stream_id_);
218 if (!accelerator_->OutputPicture(std::move(pic))) {
posciakd94b2b082015-09-18 04:03:40219 SetError();
220 return kDecodeError;
221 }
222
223 curr_frame_hdr_.reset();
Jeffrey Kardatzke48ebdb692021-01-11 22:05:02224 decrypt_config_.reset();
posciakd94b2b082015-09-18 04:03:40225 continue;
226 }
227
Hirokazu Honda10df95d2019-07-19 19:31:43228 gfx::Size new_pic_size = curr_frame_size_;
Hirokazu Honda436cf27b2019-05-21 10:44:39229 gfx::Rect new_render_rect(curr_frame_hdr_->render_width,
230 curr_frame_hdr_->render_height);
Hirokazu Hondacffd0ef2020-02-28 03:32:31231 // For safety, check the validity of render size or leave it as pic size.
Hirokazu Honda436cf27b2019-05-21 10:44:39232 if (!gfx::Rect(new_pic_size).Contains(new_render_rect)) {
233 DVLOG(1) << "Render size exceeds picture size. render size: "
234 << new_render_rect.ToString()
235 << ", picture size: " << new_pic_size.ToString();
Hirokazu Hondacffd0ef2020-02-28 03:32:31236 new_render_rect = gfx::Rect(new_pic_size);
Hirokazu Honda436cf27b2019-05-21 10:44:39237 }
Hirokazu Honda7ec32652019-11-22 09:40:21238 VideoCodecProfile new_profile =
239 VP9ProfileToVideoCodecProfile(curr_frame_hdr_->profile);
240 if (new_profile == VIDEO_CODEC_PROFILE_UNKNOWN) {
241 VLOG(1) << "Invalid profile: " << curr_frame_hdr_->profile;
242 return kDecodeError;
243 }
Hirokazu Honda963303782020-12-03 05:57:04244 if (!IsValidBitDepth(curr_frame_hdr_->bit_depth, new_profile)) {
245 DVLOG(1) << "Invalid bit depth="
246 << base::strict_cast<int>(curr_frame_hdr_->bit_depth)
247 << ", profile=" << GetProfileName(new_profile);
248 return kDecodeError;
249 }
Hirokazu Honda790d98e2020-12-04 03:41:48250 if (!IsYUV420Sequence(*curr_frame_hdr_)) {
251 DVLOG(1) << "Only YUV 4:2:0 is supported";
252 return kDecodeError;
253 }
posciakd94b2b082015-09-18 04:03:40254
Hirokazu Honda436cf27b2019-05-21 10:44:39255 DCHECK(!new_pic_size.IsEmpty());
Hirokazu Honda963303782020-12-03 05:57:04256 if (new_pic_size != pic_size_ || new_profile != profile_ ||
257 curr_frame_hdr_->bit_depth != bit_depth_) {
Hirokazu Honda7ec32652019-11-22 09:40:21258 DVLOG(1) << "New profile: " << GetProfileName(new_profile)
Hirokazu Honda963303782020-12-03 05:57:04259 << ", New resolution: " << new_pic_size.ToString()
260 << ", New bit depth: "
261 << base::strict_cast<int>(curr_frame_hdr_->bit_depth);
posciakd94b2b082015-09-18 04:03:40262
Sreerenj Balachandran57163302018-11-28 02:45:57263 if (!curr_frame_hdr_->IsKeyframe() &&
Hirokazu Honda7ec32652019-11-22 09:40:21264 !(curr_frame_hdr_->IsIntra() && pic_size_.IsEmpty())) {
posciakd94b2b082015-09-18 04:03:40265 // TODO(posciak): This is doable, but requires a few modifications to
266 // VDA implementations to allow multiple picture buffer sets in flight.
Dongseong Hwang4f20ebb2018-06-07 00:28:20267 // http://crbug.com/832264
Sreerenj Balachandran57163302018-11-28 02:45:57268 DVLOG(1) << "Resolution change currently supported for keyframes and "
269 "sequence begins with Intra only when there is no prior "
270 "frames in the context";
Dongseong Hwang4f20ebb2018-06-07 00:28:20271 if (++size_change_failure_counter_ > kVPxMaxNumOfSizeChangeFailures) {
272 SetError();
273 return kDecodeError;
274 }
275
276 curr_frame_hdr_.reset();
Jeffrey Kardatzke48ebdb692021-01-11 22:05:02277 decrypt_config_.reset();
Dongseong Hwang4f20ebb2018-06-07 00:28:20278 return kRanOutOfStreamData;
posciakd94b2b082015-09-18 04:03:40279 }
280
281 // TODO(posciak): This requires us to be on a keyframe (see above) and is
282 // required, because VDA clients expect all surfaces to be returned before
Hirokazu Honda7ec32652019-11-22 09:40:21283 // they can cycle surface sets after receiving kConfigChange.
posciakd94b2b082015-09-18 04:03:40284 // This is only an implementation detail of VDAs and can be improved.
Sreerenj Balachandran1beb5482019-04-03 03:40:05285 ref_frames_.Clear();
posciakd94b2b082015-09-18 04:03:40286
287 pic_size_ = new_pic_size;
Hirokazu Honda436cf27b2019-05-21 10:44:39288 visible_rect_ = new_render_rect;
Hirokazu Honda7ec32652019-11-22 09:40:21289 profile_ = new_profile;
Hirokazu Honda963303782020-12-03 05:57:04290 bit_depth_ = curr_frame_hdr_->bit_depth;
Dongseong Hwang4f20ebb2018-06-07 00:28:20291 size_change_failure_counter_ = 0;
Hirokazu Honda7ec32652019-11-22 09:40:21292 return kConfigChange;
posciakd94b2b082015-09-18 04:03:40293 }
294
Jeffrey Kardatzke4ed4e332020-12-05 00:32:15295 scoped_refptr<VP9Picture> pic = accelerator_->CreateVP9Picture();
296 if (!pic) {
posciakd94b2b082015-09-18 04:03:40297 return kRanOutOfSurfaces;
Jose Lopes24d1cda82020-02-21 13:22:36298 }
johnylin74410872017-06-19 13:05:30299 DVLOG(2) << "Render resolution: " << new_render_rect.ToString();
300
Jeffrey Kardatzke4ed4e332020-12-05 00:32:15301 pic->set_visible_rect(new_render_rect);
302 pic->set_bitstream_id(stream_id_);
Fredrik Hubinette3cebc622018-10-27 01:01:12303
Jeffrey Kardatzke48ebdb692021-01-11 22:05:02304 pic->set_decrypt_config(std::move(decrypt_config_));
Ted Meyer0b35c5fd2018-11-27 22:29:29305
Fredrik Hubinette3cebc622018-10-27 01:01:12306 // For VP9, container color spaces override video stream color spaces.
Jeffrey Kardatzke5e36baf2020-11-20 22:17:13307 if (container_color_space_.IsSpecified())
Jeffrey Kardatzke4ed4e332020-12-05 00:32:15308 pic->set_colorspace(container_color_space_);
Jeffrey Kardatzke5e36baf2020-11-20 22:17:13309 else if (curr_frame_hdr_)
Jeffrey Kardatzke4ed4e332020-12-05 00:32:15310 pic->set_colorspace(curr_frame_hdr_->GetColorSpace());
posciakd94b2b082015-09-18 04:03:40311
Jeffrey Kardatzke4ed4e332020-12-05 00:32:15312 pic->frame_hdr = std::move(curr_frame_hdr_);
Jeffrey Kardatzke5e36baf2020-11-20 22:17:13313
Jeffrey Kardatzke4ed4e332020-12-05 00:32:15314 VP9Accelerator::Status status = DecodeAndOutputPicture(std::move(pic));
Jeffrey Kardatzke5e36baf2020-11-20 22:17:13315 if (status == VP9Accelerator::Status::kFail) {
posciakd94b2b082015-09-18 04:03:40316 SetError();
317 return kDecodeError;
318 }
Jeffrey Kardatzke5e36baf2020-11-20 22:17:13319 if (status == VP9Accelerator::Status::kTryAgain)
320 return kTryAgain;
posciakd94b2b082015-09-18 04:03:40321 }
322}
323
posciak77118c92016-08-28 13:18:39324void VP9Decoder::UpdateFrameContext(
Ted Meyer4fac4f62019-05-08 22:57:15325 scoped_refptr<VP9Picture> pic,
Jose Lopes24d1cda82020-02-21 13:22:36326 Vp9Parser::ContextRefreshCallback context_refresh_cb) {
Dale Curtise25163812018-09-21 22:13:39327 DCHECK(context_refresh_cb);
posciak77118c92016-08-28 13:18:39328 Vp9FrameContext frame_ctx;
329 memset(&frame_ctx, 0, sizeof(frame_ctx));
330
Ted Meyer4fac4f62019-05-08 22:57:15331 if (!accelerator_->GetFrameContext(std::move(pic), &frame_ctx)) {
posciak77118c92016-08-28 13:18:39332 SetError();
333 return;
334 }
335
Jose Lopes24d1cda82020-02-21 13:22:36336 std::move(context_refresh_cb).Run(frame_ctx);
posciak77118c92016-08-28 13:18:39337}
338
Jeffrey Kardatzke5e36baf2020-11-20 22:17:13339VP9Decoder::VP9Accelerator::Status VP9Decoder::DecodeAndOutputPicture(
340 scoped_refptr<VP9Picture> pic) {
posciakd94b2b082015-09-18 04:03:40341 DCHECK(!pic_size_.IsEmpty());
342 DCHECK(pic->frame_hdr);
343
Chih-Yu Huangcc6b1b92019-12-19 08:57:16344 base::OnceClosure done_cb;
Jose Lopes24d1cda82020-02-21 13:22:36345 Vp9Parser::ContextRefreshCallback context_refresh_cb =
posciak77118c92016-08-28 13:18:39346 parser_.GetContextRefreshCb(pic->frame_hdr->frame_context_idx);
Jose Lopes24d1cda82020-02-21 13:22:36347 if (context_refresh_cb) {
348 done_cb =
349 base::BindOnce(&VP9Decoder::UpdateFrameContext, base::Unretained(this),
350 pic, std::move(context_refresh_cb));
351 }
posciak77118c92016-08-28 13:18:39352
353 const Vp9Parser::Context& context = parser_.context();
Jeffrey Kardatzke5e36baf2020-11-20 22:17:13354 VP9Accelerator::Status status = accelerator_->SubmitDecode(
355 pic, context.segmentation(), context.loop_filter(), ref_frames_,
356 std::move(done_cb));
Jeffrey Kardatzke4ed4e332020-12-05 00:32:15357 if (status != VP9Accelerator::Status::kOk) {
358 if (status == VP9Accelerator::Status::kTryAgain)
359 pending_pic_ = std::move(pic);
Jeffrey Kardatzke5e36baf2020-11-20 22:17:13360 return status;
Jeffrey Kardatzke4ed4e332020-12-05 00:32:15361 }
posciakd94b2b082015-09-18 04:03:40362
363 if (pic->frame_hdr->show_frame) {
Jeffrey Kardatzke5e36baf2020-11-20 22:17:13364 if (!accelerator_->OutputPicture(pic))
365 return VP9Accelerator::Status::kFail;
posciakd94b2b082015-09-18 04:03:40366 }
367
Ted Meyer4fac4f62019-05-08 22:57:15368 ref_frames_.Refresh(std::move(pic));
Jeffrey Kardatzke5e36baf2020-11-20 22:17:13369 return status;
posciakd94b2b082015-09-18 04:03:40370}
371
372void VP9Decoder::SetError() {
373 Reset();
374 state_ = kError;
375}
376
377gfx::Size VP9Decoder::GetPicSize() const {
378 return pic_size_;
379}
380
Hirokazu Honda436cf27b2019-05-21 10:44:39381gfx::Rect VP9Decoder::GetVisibleRect() const {
382 return visible_rect_;
383}
384
Hirokazu Honda7ec32652019-11-22 09:40:21385VideoCodecProfile VP9Decoder::GetProfile() const {
386 return profile_;
387}
388
Hirokazu Honda963303782020-12-03 05:57:04389uint8_t VP9Decoder::GetBitDepth() const {
390 return bit_depth_;
391}
392
posciakd94b2b082015-09-18 04:03:40393size_t VP9Decoder::GetRequiredNumOfPictures() const {
Miguel Casas477a7062019-01-04 19:13:45394 constexpr size_t kPicsInPipeline = limits::kMaxVideoFrames + 1;
395 return kPicsInPipeline + GetNumReferenceFrames();
396}
397
398size_t VP9Decoder::GetNumReferenceFrames() const {
Miguel Casas3dd7e562019-02-14 17:38:46399 // Maximum number of reference frames
400 return kVp9NumRefFrames;
posciakd94b2b082015-09-18 04:03:40401}
402
markdittmer6e70beb82016-05-02 05:40:47403} // namespace media