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 #include "media/gpu/vaapi_video_decode_accelerator.h" | 5 #include "media/gpu/vaapi_video_decode_accelerator.h" |
6 | 6 |
7 #include <string.h> | 7 #include <string.h> |
8 | 8 |
9 #include <memory> | 9 #include <memory> |
10 | 10 |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 class VaapiVideoDecodeAccelerator::VaapiH264Accelerator | 110 class VaapiVideoDecodeAccelerator::VaapiH264Accelerator |
111 : public H264Decoder::H264Accelerator { | 111 : public H264Decoder::H264Accelerator { |
112 public: | 112 public: |
113 VaapiH264Accelerator(VaapiVideoDecodeAccelerator* vaapi_dec, | 113 VaapiH264Accelerator(VaapiVideoDecodeAccelerator* vaapi_dec, |
114 VaapiWrapper* vaapi_wrapper); | 114 VaapiWrapper* vaapi_wrapper); |
115 ~VaapiH264Accelerator() override; | 115 ~VaapiH264Accelerator() override; |
116 | 116 |
117 // H264Decoder::H264Accelerator implementation. | 117 // H264Decoder::H264Accelerator implementation. |
118 scoped_refptr<H264Picture> CreateH264Picture() override; | 118 scoped_refptr<H264Picture> CreateH264Picture() override; |
119 | 119 |
120 bool SubmitFrameMetadata(const media::H264SPS* sps, | 120 bool SubmitFrameMetadata(const H264SPS* sps, |
121 const media::H264PPS* pps, | 121 const H264PPS* pps, |
122 const H264DPB& dpb, | 122 const H264DPB& dpb, |
123 const H264Picture::Vector& ref_pic_listp0, | 123 const H264Picture::Vector& ref_pic_listp0, |
124 const H264Picture::Vector& ref_pic_listb0, | 124 const H264Picture::Vector& ref_pic_listb0, |
125 const H264Picture::Vector& ref_pic_listb1, | 125 const H264Picture::Vector& ref_pic_listb1, |
126 const scoped_refptr<H264Picture>& pic) override; | 126 const scoped_refptr<H264Picture>& pic) override; |
127 | 127 |
128 bool SubmitSlice(const media::H264PPS* pps, | 128 bool SubmitSlice(const H264PPS* pps, |
129 const media::H264SliceHeader* slice_hdr, | 129 const H264SliceHeader* slice_hdr, |
130 const H264Picture::Vector& ref_pic_list0, | 130 const H264Picture::Vector& ref_pic_list0, |
131 const H264Picture::Vector& ref_pic_list1, | 131 const H264Picture::Vector& ref_pic_list1, |
132 const scoped_refptr<H264Picture>& pic, | 132 const scoped_refptr<H264Picture>& pic, |
133 const uint8_t* data, | 133 const uint8_t* data, |
134 size_t size) override; | 134 size_t size) override; |
135 | 135 |
136 bool SubmitDecode(const scoped_refptr<H264Picture>& pic) override; | 136 bool SubmitDecode(const scoped_refptr<H264Picture>& pic) override; |
137 bool OutputPicture(const scoped_refptr<H264Picture>& pic) override; | 137 bool OutputPicture(const scoped_refptr<H264Picture>& pic) override; |
138 | 138 |
139 void Reset() override; | 139 void Reset() override; |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 : public VP8Decoder::VP8Accelerator { | 183 : public VP8Decoder::VP8Accelerator { |
184 public: | 184 public: |
185 VaapiVP8Accelerator(VaapiVideoDecodeAccelerator* vaapi_dec, | 185 VaapiVP8Accelerator(VaapiVideoDecodeAccelerator* vaapi_dec, |
186 VaapiWrapper* vaapi_wrapper); | 186 VaapiWrapper* vaapi_wrapper); |
187 ~VaapiVP8Accelerator() override; | 187 ~VaapiVP8Accelerator() override; |
188 | 188 |
189 // VP8Decoder::VP8Accelerator implementation. | 189 // VP8Decoder::VP8Accelerator implementation. |
190 scoped_refptr<VP8Picture> CreateVP8Picture() override; | 190 scoped_refptr<VP8Picture> CreateVP8Picture() override; |
191 | 191 |
192 bool SubmitDecode(const scoped_refptr<VP8Picture>& pic, | 192 bool SubmitDecode(const scoped_refptr<VP8Picture>& pic, |
193 const media::Vp8FrameHeader* frame_hdr, | 193 const Vp8FrameHeader* frame_hdr, |
194 const scoped_refptr<VP8Picture>& last_frame, | 194 const scoped_refptr<VP8Picture>& last_frame, |
195 const scoped_refptr<VP8Picture>& golden_frame, | 195 const scoped_refptr<VP8Picture>& golden_frame, |
196 const scoped_refptr<VP8Picture>& alt_frame) override; | 196 const scoped_refptr<VP8Picture>& alt_frame) override; |
197 | 197 |
198 bool OutputPicture(const scoped_refptr<VP8Picture>& pic) override; | 198 bool OutputPicture(const scoped_refptr<VP8Picture>& pic) override; |
199 | 199 |
200 private: | 200 private: |
201 scoped_refptr<VaapiDecodeSurface> VP8PictureToVaapiDecodeSurface( | 201 scoped_refptr<VaapiDecodeSurface> VP8PictureToVaapiDecodeSurface( |
202 const scoped_refptr<VP8Picture>& pic); | 202 const scoped_refptr<VP8Picture>& pic); |
203 | 203 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 public: | 238 public: |
239 VaapiVP9Accelerator(VaapiVideoDecodeAccelerator* vaapi_dec, | 239 VaapiVP9Accelerator(VaapiVideoDecodeAccelerator* vaapi_dec, |
240 VaapiWrapper* vaapi_wrapper); | 240 VaapiWrapper* vaapi_wrapper); |
241 ~VaapiVP9Accelerator() override; | 241 ~VaapiVP9Accelerator() override; |
242 | 242 |
243 // VP9Decoder::VP9Accelerator implementation. | 243 // VP9Decoder::VP9Accelerator implementation. |
244 scoped_refptr<VP9Picture> CreateVP9Picture() override; | 244 scoped_refptr<VP9Picture> CreateVP9Picture() override; |
245 | 245 |
246 bool SubmitDecode( | 246 bool SubmitDecode( |
247 const scoped_refptr<VP9Picture>& pic, | 247 const scoped_refptr<VP9Picture>& pic, |
248 const media::Vp9Segmentation& seg, | 248 const Vp9Segmentation& seg, |
249 const media::Vp9LoopFilter& lf, | 249 const Vp9LoopFilter& lf, |
250 const std::vector<scoped_refptr<VP9Picture>>& ref_pictures) override; | 250 const std::vector<scoped_refptr<VP9Picture>>& ref_pictures) override; |
251 | 251 |
252 bool OutputPicture(const scoped_refptr<VP9Picture>& pic) override; | 252 bool OutputPicture(const scoped_refptr<VP9Picture>& pic) override; |
253 | 253 |
254 private: | 254 private: |
255 scoped_refptr<VaapiDecodeSurface> VP9PictureToVaapiDecodeSurface( | 255 scoped_refptr<VaapiDecodeSurface> VP9PictureToVaapiDecodeSurface( |
256 const scoped_refptr<VP9Picture>& pic); | 256 const scoped_refptr<VP9Picture>& pic); |
257 | 257 |
258 VaapiWrapper* vaapi_wrapper_; | 258 VaapiWrapper* vaapi_wrapper_; |
259 VaapiVideoDecodeAccelerator* vaapi_dec_; | 259 VaapiVideoDecodeAccelerator* vaapi_dec_; |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
306 decoder_thread_("VaapiDecoderThread"), | 306 decoder_thread_("VaapiDecoderThread"), |
307 num_frames_at_client_(0), | 307 num_frames_at_client_(0), |
308 num_stream_bufs_at_decoder_(0), | 308 num_stream_bufs_at_decoder_(0), |
309 finish_flush_pending_(false), | 309 finish_flush_pending_(false), |
310 awaiting_va_surfaces_recycle_(false), | 310 awaiting_va_surfaces_recycle_(false), |
311 requested_num_pics_(0), | 311 requested_num_pics_(0), |
312 make_context_current_cb_(make_context_current_cb), | 312 make_context_current_cb_(make_context_current_cb), |
313 bind_image_cb_(bind_image_cb), | 313 bind_image_cb_(bind_image_cb), |
314 weak_this_factory_(this) { | 314 weak_this_factory_(this) { |
315 weak_this_ = weak_this_factory_.GetWeakPtr(); | 315 weak_this_ = weak_this_factory_.GetWeakPtr(); |
316 va_surface_release_cb_ = media::BindToCurrentLoop( | 316 va_surface_release_cb_ = BindToCurrentLoop( |
317 base::Bind(&VaapiVideoDecodeAccelerator::RecycleVASurfaceID, weak_this_)); | 317 base::Bind(&VaapiVideoDecodeAccelerator::RecycleVASurfaceID, weak_this_)); |
318 } | 318 } |
319 | 319 |
320 VaapiVideoDecodeAccelerator::~VaapiVideoDecodeAccelerator() { | 320 VaapiVideoDecodeAccelerator::~VaapiVideoDecodeAccelerator() { |
321 DCHECK_EQ(message_loop_, base::MessageLoop::current()); | 321 DCHECK_EQ(message_loop_, base::MessageLoop::current()); |
322 } | 322 } |
323 | 323 |
324 bool VaapiVideoDecodeAccelerator::Initialize(const Config& config, | 324 bool VaapiVideoDecodeAccelerator::Initialize(const Config& config, |
325 Client* client) { | 325 Client* client) { |
326 DCHECK_EQ(message_loop_, base::MessageLoop::current()); | 326 DCHECK_EQ(message_loop_, base::MessageLoop::current()); |
327 | 327 |
328 if (config.is_encrypted) { | 328 if (config.is_encrypted) { |
329 NOTREACHED() << "Encrypted streams are not supported for this VDA"; | 329 NOTREACHED() << "Encrypted streams are not supported for this VDA"; |
330 return false; | 330 return false; |
331 } | 331 } |
332 | 332 |
333 if (config.output_mode != Config::OutputMode::ALLOCATE && | 333 if (config.output_mode != Config::OutputMode::ALLOCATE && |
334 config.output_mode != Config::OutputMode::IMPORT) { | 334 config.output_mode != Config::OutputMode::IMPORT) { |
335 NOTREACHED() << "Only ALLOCATE and IMPORT OutputModes are supported"; | 335 NOTREACHED() << "Only ALLOCATE and IMPORT OutputModes are supported"; |
336 } | 336 } |
337 | 337 |
338 client_ptr_factory_.reset(new base::WeakPtrFactory<Client>(client)); | 338 client_ptr_factory_.reset(new base::WeakPtrFactory<Client>(client)); |
339 client_ = client_ptr_factory_->GetWeakPtr(); | 339 client_ = client_ptr_factory_->GetWeakPtr(); |
340 | 340 |
341 media::VideoCodecProfile profile = config.profile; | 341 VideoCodecProfile profile = config.profile; |
342 | 342 |
343 base::AutoLock auto_lock(lock_); | 343 base::AutoLock auto_lock(lock_); |
344 DCHECK_EQ(state_, kUninitialized); | 344 DCHECK_EQ(state_, kUninitialized); |
345 DVLOG(2) << "Initializing VAVDA, profile: " << profile; | 345 DVLOG(2) << "Initializing VAVDA, profile: " << profile; |
346 | 346 |
347 #if defined(USE_X11) | 347 #if defined(USE_X11) |
348 if (gl::GetGLImplementation() != gl::kGLImplementationDesktopGL) { | 348 if (gl::GetGLImplementation() != gl::kGLImplementationDesktopGL) { |
349 DVLOG(1) << "HW video decode acceleration not available without " | 349 DVLOG(1) << "HW video decode acceleration not available without " |
350 "DesktopGL (GLX)."; | 350 "DesktopGL (GLX)."; |
351 return false; | 351 return false; |
352 } | 352 } |
353 #elif defined(USE_OZONE) | 353 #elif defined(USE_OZONE) |
354 if (gl::GetGLImplementation() != gl::kGLImplementationEGLGLES2) { | 354 if (gl::GetGLImplementation() != gl::kGLImplementationEGLGLES2) { |
355 DVLOG(1) << "HW video decode acceleration not available without " | 355 DVLOG(1) << "HW video decode acceleration not available without " |
356 << "EGLGLES2."; | 356 << "EGLGLES2."; |
357 return false; | 357 return false; |
358 } | 358 } |
359 #endif // USE_X11 | 359 #endif // USE_X11 |
360 | 360 |
361 vaapi_wrapper_ = VaapiWrapper::CreateForVideoCodec( | 361 vaapi_wrapper_ = VaapiWrapper::CreateForVideoCodec( |
362 VaapiWrapper::kDecode, profile, base::Bind(&ReportToUMA, VAAPI_ERROR)); | 362 VaapiWrapper::kDecode, profile, base::Bind(&ReportToUMA, VAAPI_ERROR)); |
363 | 363 |
364 if (!vaapi_wrapper_.get()) { | 364 if (!vaapi_wrapper_.get()) { |
365 DVLOG(1) << "Failed initializing VAAPI for profile " << profile; | 365 DVLOG(1) << "Failed initializing VAAPI for profile " << profile; |
366 return false; | 366 return false; |
367 } | 367 } |
368 | 368 |
369 if (profile >= media::H264PROFILE_MIN && profile <= media::H264PROFILE_MAX) { | 369 if (profile >= H264PROFILE_MIN && profile <= H264PROFILE_MAX) { |
370 h264_accelerator_.reset( | 370 h264_accelerator_.reset( |
371 new VaapiH264Accelerator(this, vaapi_wrapper_.get())); | 371 new VaapiH264Accelerator(this, vaapi_wrapper_.get())); |
372 decoder_.reset(new H264Decoder(h264_accelerator_.get())); | 372 decoder_.reset(new H264Decoder(h264_accelerator_.get())); |
373 } else if (profile >= media::VP8PROFILE_MIN && | 373 } else if (profile >= VP8PROFILE_MIN && profile <= VP8PROFILE_MAX) { |
374 profile <= media::VP8PROFILE_MAX) { | |
375 vp8_accelerator_.reset(new VaapiVP8Accelerator(this, vaapi_wrapper_.get())); | 374 vp8_accelerator_.reset(new VaapiVP8Accelerator(this, vaapi_wrapper_.get())); |
376 decoder_.reset(new VP8Decoder(vp8_accelerator_.get())); | 375 decoder_.reset(new VP8Decoder(vp8_accelerator_.get())); |
377 } else if (profile >= media::VP9PROFILE_MIN && | 376 } else if (profile >= VP9PROFILE_MIN && profile <= VP9PROFILE_MAX) { |
378 profile <= media::VP9PROFILE_MAX) { | |
379 vp9_accelerator_.reset(new VaapiVP9Accelerator(this, vaapi_wrapper_.get())); | 377 vp9_accelerator_.reset(new VaapiVP9Accelerator(this, vaapi_wrapper_.get())); |
380 decoder_.reset(new VP9Decoder(vp9_accelerator_.get())); | 378 decoder_.reset(new VP9Decoder(vp9_accelerator_.get())); |
381 } else { | 379 } else { |
382 DLOG(ERROR) << "Unsupported profile " << profile; | 380 DLOG(ERROR) << "Unsupported profile " << profile; |
383 return false; | 381 return false; |
384 } | 382 } |
385 | 383 |
386 CHECK(decoder_thread_.Start()); | 384 CHECK(decoder_thread_.Start()); |
387 decoder_thread_task_runner_ = decoder_thread_.task_runner(); | 385 decoder_thread_task_runner_ = decoder_thread_.task_runner(); |
388 | 386 |
(...skipping 22 matching lines...) Expand all Loading... |
411 | 409 |
412 // Notify the client a picture is ready to be displayed. | 410 // Notify the client a picture is ready to be displayed. |
413 ++num_frames_at_client_; | 411 ++num_frames_at_client_; |
414 TRACE_COUNTER1("Video Decoder", "Textures at client", num_frames_at_client_); | 412 TRACE_COUNTER1("Video Decoder", "Textures at client", num_frames_at_client_); |
415 DVLOG(4) << "Notifying output picture id " << output_id | 413 DVLOG(4) << "Notifying output picture id " << output_id |
416 << " for input " << input_id << " is ready"; | 414 << " for input " << input_id << " is ready"; |
417 // TODO(posciak): Use visible size from decoder here instead | 415 // TODO(posciak): Use visible size from decoder here instead |
418 // (crbug.com/402760). Passing (0, 0) results in the client using the | 416 // (crbug.com/402760). Passing (0, 0) results in the client using the |
419 // visible size extracted from the container instead. | 417 // visible size extracted from the container instead. |
420 if (client_) | 418 if (client_) |
421 client_->PictureReady(media::Picture(output_id, input_id, gfx::Rect(0, 0), | 419 client_->PictureReady( |
422 picture->AllowOverlay())); | 420 Picture(output_id, input_id, gfx::Rect(0, 0), picture->AllowOverlay())); |
423 } | 421 } |
424 | 422 |
425 void VaapiVideoDecodeAccelerator::TryOutputSurface() { | 423 void VaapiVideoDecodeAccelerator::TryOutputSurface() { |
426 DCHECK_EQ(message_loop_, base::MessageLoop::current()); | 424 DCHECK_EQ(message_loop_, base::MessageLoop::current()); |
427 | 425 |
428 // Handle Destroy() arriving while pictures are queued for output. | 426 // Handle Destroy() arriving while pictures are queued for output. |
429 if (!client_) | 427 if (!client_) |
430 return; | 428 return; |
431 | 429 |
432 if (pending_output_cbs_.empty() || output_buffers_.empty()) | 430 if (pending_output_cbs_.empty() || output_buffers_.empty()) |
433 return; | 431 return; |
434 | 432 |
435 OutputCB output_cb = pending_output_cbs_.front(); | 433 OutputCB output_cb = pending_output_cbs_.front(); |
436 pending_output_cbs_.pop(); | 434 pending_output_cbs_.pop(); |
437 | 435 |
438 VaapiPicture* picture = PictureById(output_buffers_.front()); | 436 VaapiPicture* picture = PictureById(output_buffers_.front()); |
439 DCHECK(picture); | 437 DCHECK(picture); |
440 output_buffers_.pop(); | 438 output_buffers_.pop(); |
441 | 439 |
442 output_cb.Run(picture); | 440 output_cb.Run(picture); |
443 | 441 |
444 if (finish_flush_pending_ && pending_output_cbs_.empty()) | 442 if (finish_flush_pending_ && pending_output_cbs_.empty()) |
445 FinishFlush(); | 443 FinishFlush(); |
446 } | 444 } |
447 | 445 |
448 void VaapiVideoDecodeAccelerator::MapAndQueueNewInputBuffer( | 446 void VaapiVideoDecodeAccelerator::MapAndQueueNewInputBuffer( |
449 const media::BitstreamBuffer& bitstream_buffer) { | 447 const BitstreamBuffer& bitstream_buffer) { |
450 DCHECK_EQ(message_loop_, base::MessageLoop::current()); | 448 DCHECK_EQ(message_loop_, base::MessageLoop::current()); |
451 TRACE_EVENT1("Video Decoder", "MapAndQueueNewInputBuffer", "input_id", | 449 TRACE_EVENT1("Video Decoder", "MapAndQueueNewInputBuffer", "input_id", |
452 bitstream_buffer.id()); | 450 bitstream_buffer.id()); |
453 | 451 |
454 DVLOG(4) << "Mapping new input buffer id: " << bitstream_buffer.id() | 452 DVLOG(4) << "Mapping new input buffer id: " << bitstream_buffer.id() |
455 << " size: " << (int)bitstream_buffer.size(); | 453 << " size: " << (int)bitstream_buffer.size(); |
456 | 454 |
457 std::unique_ptr<SharedMemoryRegion> shm( | 455 std::unique_ptr<SharedMemoryRegion> shm( |
458 new SharedMemoryRegion(bitstream_buffer, true)); | 456 new SharedMemoryRegion(bitstream_buffer, true)); |
459 | 457 |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
690 | 688 |
691 VideoPixelFormat format = | 689 VideoPixelFormat format = |
692 BufferFormatToVideoPixelFormat(kOutputPictureFormat); | 690 BufferFormatToVideoPixelFormat(kOutputPictureFormat); |
693 message_loop_->PostTask( | 691 message_loop_->PostTask( |
694 FROM_HERE, base::Bind(&Client::ProvidePictureBuffers, client_, | 692 FROM_HERE, base::Bind(&Client::ProvidePictureBuffers, client_, |
695 requested_num_pics_, format, 1, requested_pic_size_, | 693 requested_num_pics_, format, 1, requested_pic_size_, |
696 VaapiPicture::GetGLTextureTarget())); | 694 VaapiPicture::GetGLTextureTarget())); |
697 } | 695 } |
698 | 696 |
699 void VaapiVideoDecodeAccelerator::Decode( | 697 void VaapiVideoDecodeAccelerator::Decode( |
700 const media::BitstreamBuffer& bitstream_buffer) { | 698 const BitstreamBuffer& bitstream_buffer) { |
701 DCHECK_EQ(message_loop_, base::MessageLoop::current()); | 699 DCHECK_EQ(message_loop_, base::MessageLoop::current()); |
702 | 700 |
703 TRACE_EVENT1("Video Decoder", "VAVDA::Decode", "Buffer id", | 701 TRACE_EVENT1("Video Decoder", "VAVDA::Decode", "Buffer id", |
704 bitstream_buffer.id()); | 702 bitstream_buffer.id()); |
705 | 703 |
706 if (bitstream_buffer.id() < 0) { | 704 if (bitstream_buffer.id() < 0) { |
707 if (base::SharedMemory::IsHandleValid(bitstream_buffer.handle())) | 705 if (base::SharedMemory::IsHandleValid(bitstream_buffer.handle())) |
708 base::SharedMemory::CloseHandle(bitstream_buffer.handle()); | 706 base::SharedMemory::CloseHandle(bitstream_buffer.handle()); |
709 LOG(ERROR) << "Invalid bitstream_buffer, id: " << bitstream_buffer.id(); | 707 LOG(ERROR) << "Invalid bitstream_buffer, id: " << bitstream_buffer.id(); |
710 NotifyError(INVALID_ARGUMENT); | 708 NotifyError(INVALID_ARGUMENT); |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
742 void VaapiVideoDecodeAccelerator::RecycleVASurfaceID( | 740 void VaapiVideoDecodeAccelerator::RecycleVASurfaceID( |
743 VASurfaceID va_surface_id) { | 741 VASurfaceID va_surface_id) { |
744 DCHECK_EQ(message_loop_, base::MessageLoop::current()); | 742 DCHECK_EQ(message_loop_, base::MessageLoop::current()); |
745 base::AutoLock auto_lock(lock_); | 743 base::AutoLock auto_lock(lock_); |
746 | 744 |
747 available_va_surfaces_.push_back(va_surface_id); | 745 available_va_surfaces_.push_back(va_surface_id); |
748 surfaces_available_.Signal(); | 746 surfaces_available_.Signal(); |
749 } | 747 } |
750 | 748 |
751 void VaapiVideoDecodeAccelerator::AssignPictureBuffers( | 749 void VaapiVideoDecodeAccelerator::AssignPictureBuffers( |
752 const std::vector<media::PictureBuffer>& buffers) { | 750 const std::vector<PictureBuffer>& buffers) { |
753 DCHECK_EQ(message_loop_, base::MessageLoop::current()); | 751 DCHECK_EQ(message_loop_, base::MessageLoop::current()); |
754 | 752 |
755 base::AutoLock auto_lock(lock_); | 753 base::AutoLock auto_lock(lock_); |
756 DCHECK(pictures_.empty()); | 754 DCHECK(pictures_.empty()); |
757 | 755 |
758 while (!output_buffers_.empty()) | 756 while (!output_buffers_.empty()) |
759 output_buffers_.pop(); | 757 output_buffers_.pop(); |
760 | 758 |
761 RETURN_AND_NOTIFY_ON_FAILURE( | 759 RETURN_AND_NOTIFY_ON_FAILURE( |
762 buffers.size() >= requested_num_pics_, | 760 buffers.size() >= requested_num_pics_, |
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1134 } | 1132 } |
1135 | 1133 |
1136 // Fill |va_pic| with default/neutral values. | 1134 // Fill |va_pic| with default/neutral values. |
1137 static void InitVAPicture(VAPictureH264* va_pic) { | 1135 static void InitVAPicture(VAPictureH264* va_pic) { |
1138 memset(va_pic, 0, sizeof(*va_pic)); | 1136 memset(va_pic, 0, sizeof(*va_pic)); |
1139 va_pic->picture_id = VA_INVALID_ID; | 1137 va_pic->picture_id = VA_INVALID_ID; |
1140 va_pic->flags = VA_PICTURE_H264_INVALID; | 1138 va_pic->flags = VA_PICTURE_H264_INVALID; |
1141 } | 1139 } |
1142 | 1140 |
1143 bool VaapiVideoDecodeAccelerator::VaapiH264Accelerator::SubmitFrameMetadata( | 1141 bool VaapiVideoDecodeAccelerator::VaapiH264Accelerator::SubmitFrameMetadata( |
1144 const media::H264SPS* sps, | 1142 const H264SPS* sps, |
1145 const media::H264PPS* pps, | 1143 const H264PPS* pps, |
1146 const H264DPB& dpb, | 1144 const H264DPB& dpb, |
1147 const H264Picture::Vector& ref_pic_listp0, | 1145 const H264Picture::Vector& ref_pic_listp0, |
1148 const H264Picture::Vector& ref_pic_listb0, | 1146 const H264Picture::Vector& ref_pic_listb0, |
1149 const H264Picture::Vector& ref_pic_listb1, | 1147 const H264Picture::Vector& ref_pic_listb1, |
1150 const scoped_refptr<H264Picture>& pic) { | 1148 const scoped_refptr<H264Picture>& pic) { |
1151 VAPictureParameterBufferH264 pic_param; | 1149 VAPictureParameterBufferH264 pic_param; |
1152 memset(&pic_param, 0, sizeof(pic_param)); | 1150 memset(&pic_param, 0, sizeof(pic_param)); |
1153 | 1151 |
1154 #define FROM_SPS_TO_PP(a) pic_param.a = sps->a | 1152 #define FROM_SPS_TO_PP(a) pic_param.a = sps->a |
1155 #define FROM_SPS_TO_PP2(a, b) pic_param.b = sps->a | 1153 #define FROM_SPS_TO_PP2(a, b) pic_param.b = sps->a |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1247 for (int j = 0; j < 64; ++j) | 1245 for (int j = 0; j < 64; ++j) |
1248 iq_matrix_buf.ScalingList8x8[i][j] = sps->scaling_list8x8[i][j]; | 1246 iq_matrix_buf.ScalingList8x8[i][j] = sps->scaling_list8x8[i][j]; |
1249 } | 1247 } |
1250 } | 1248 } |
1251 | 1249 |
1252 return vaapi_wrapper_->SubmitBuffer(VAIQMatrixBufferType, | 1250 return vaapi_wrapper_->SubmitBuffer(VAIQMatrixBufferType, |
1253 sizeof(iq_matrix_buf), &iq_matrix_buf); | 1251 sizeof(iq_matrix_buf), &iq_matrix_buf); |
1254 } | 1252 } |
1255 | 1253 |
1256 bool VaapiVideoDecodeAccelerator::VaapiH264Accelerator::SubmitSlice( | 1254 bool VaapiVideoDecodeAccelerator::VaapiH264Accelerator::SubmitSlice( |
1257 const media::H264PPS* pps, | 1255 const H264PPS* pps, |
1258 const media::H264SliceHeader* slice_hdr, | 1256 const H264SliceHeader* slice_hdr, |
1259 const H264Picture::Vector& ref_pic_list0, | 1257 const H264Picture::Vector& ref_pic_list0, |
1260 const H264Picture::Vector& ref_pic_list1, | 1258 const H264Picture::Vector& ref_pic_list1, |
1261 const scoped_refptr<H264Picture>& pic, | 1259 const scoped_refptr<H264Picture>& pic, |
1262 const uint8_t* data, | 1260 const uint8_t* data, |
1263 size_t size) { | 1261 size_t size) { |
1264 VASliceParameterBufferH264 slice_param; | 1262 VASliceParameterBufferH264 slice_param; |
1265 memset(&slice_param, 0, sizeof(slice_param)); | 1263 memset(&slice_param, 0, sizeof(slice_param)); |
1266 | 1264 |
1267 slice_param.slice_data_size = slice_hdr->nalu_size; | 1265 slice_param.slice_data_size = slice_hdr->nalu_size; |
1268 slice_param.slice_data_offset = 0; | 1266 slice_param.slice_data_offset = 0; |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1464 | 1462 |
1465 #define ARRAY_MEMCPY_CHECKED(to, from) \ | 1463 #define ARRAY_MEMCPY_CHECKED(to, from) \ |
1466 do { \ | 1464 do { \ |
1467 static_assert(sizeof(to) == sizeof(from), \ | 1465 static_assert(sizeof(to) == sizeof(from), \ |
1468 #from " and " #to " arrays must be of same size"); \ | 1466 #from " and " #to " arrays must be of same size"); \ |
1469 memcpy(to, from, sizeof(to)); \ | 1467 memcpy(to, from, sizeof(to)); \ |
1470 } while (0) | 1468 } while (0) |
1471 | 1469 |
1472 bool VaapiVideoDecodeAccelerator::VaapiVP8Accelerator::SubmitDecode( | 1470 bool VaapiVideoDecodeAccelerator::VaapiVP8Accelerator::SubmitDecode( |
1473 const scoped_refptr<VP8Picture>& pic, | 1471 const scoped_refptr<VP8Picture>& pic, |
1474 const media::Vp8FrameHeader* frame_hdr, | 1472 const Vp8FrameHeader* frame_hdr, |
1475 const scoped_refptr<VP8Picture>& last_frame, | 1473 const scoped_refptr<VP8Picture>& last_frame, |
1476 const scoped_refptr<VP8Picture>& golden_frame, | 1474 const scoped_refptr<VP8Picture>& golden_frame, |
1477 const scoped_refptr<VP8Picture>& alt_frame) { | 1475 const scoped_refptr<VP8Picture>& alt_frame) { |
1478 VAIQMatrixBufferVP8 iq_matrix_buf; | 1476 VAIQMatrixBufferVP8 iq_matrix_buf; |
1479 memset(&iq_matrix_buf, 0, sizeof(VAIQMatrixBufferVP8)); | 1477 memset(&iq_matrix_buf, 0, sizeof(VAIQMatrixBufferVP8)); |
1480 | 1478 |
1481 const media::Vp8SegmentationHeader& sgmnt_hdr = frame_hdr->segmentation_hdr; | 1479 const Vp8SegmentationHeader& sgmnt_hdr = frame_hdr->segmentation_hdr; |
1482 const media::Vp8QuantizationHeader& quant_hdr = frame_hdr->quantization_hdr; | 1480 const Vp8QuantizationHeader& quant_hdr = frame_hdr->quantization_hdr; |
1483 static_assert( | 1481 static_assert(arraysize(iq_matrix_buf.quantization_index) == kMaxMBSegments, |
1484 arraysize(iq_matrix_buf.quantization_index) == media::kMaxMBSegments, | 1482 "incorrect quantization matrix size"); |
1485 "incorrect quantization matrix size"); | 1483 for (size_t i = 0; i < kMaxMBSegments; ++i) { |
1486 for (size_t i = 0; i < media::kMaxMBSegments; ++i) { | |
1487 int q = quant_hdr.y_ac_qi; | 1484 int q = quant_hdr.y_ac_qi; |
1488 | 1485 |
1489 if (sgmnt_hdr.segmentation_enabled) { | 1486 if (sgmnt_hdr.segmentation_enabled) { |
1490 if (sgmnt_hdr.segment_feature_mode == | 1487 if (sgmnt_hdr.segment_feature_mode == |
1491 media::Vp8SegmentationHeader::FEATURE_MODE_ABSOLUTE) | 1488 Vp8SegmentationHeader::FEATURE_MODE_ABSOLUTE) |
1492 q = sgmnt_hdr.quantizer_update_value[i]; | 1489 q = sgmnt_hdr.quantizer_update_value[i]; |
1493 else | 1490 else |
1494 q += sgmnt_hdr.quantizer_update_value[i]; | 1491 q += sgmnt_hdr.quantizer_update_value[i]; |
1495 } | 1492 } |
1496 | 1493 |
1497 #define CLAMP_Q(q) std::min(std::max(q, 0), 127) | 1494 #define CLAMP_Q(q) std::min(std::max(q, 0), 127) |
1498 static_assert(arraysize(iq_matrix_buf.quantization_index[i]) == 6, | 1495 static_assert(arraysize(iq_matrix_buf.quantization_index[i]) == 6, |
1499 "incorrect quantization matrix size"); | 1496 "incorrect quantization matrix size"); |
1500 iq_matrix_buf.quantization_index[i][0] = CLAMP_Q(q); | 1497 iq_matrix_buf.quantization_index[i][0] = CLAMP_Q(q); |
1501 iq_matrix_buf.quantization_index[i][1] = CLAMP_Q(q + quant_hdr.y_dc_delta); | 1498 iq_matrix_buf.quantization_index[i][1] = CLAMP_Q(q + quant_hdr.y_dc_delta); |
1502 iq_matrix_buf.quantization_index[i][2] = CLAMP_Q(q + quant_hdr.y2_dc_delta); | 1499 iq_matrix_buf.quantization_index[i][2] = CLAMP_Q(q + quant_hdr.y2_dc_delta); |
1503 iq_matrix_buf.quantization_index[i][3] = CLAMP_Q(q + quant_hdr.y2_ac_delta); | 1500 iq_matrix_buf.quantization_index[i][3] = CLAMP_Q(q + quant_hdr.y2_ac_delta); |
1504 iq_matrix_buf.quantization_index[i][4] = CLAMP_Q(q + quant_hdr.uv_dc_delta); | 1501 iq_matrix_buf.quantization_index[i][4] = CLAMP_Q(q + quant_hdr.uv_dc_delta); |
1505 iq_matrix_buf.quantization_index[i][5] = CLAMP_Q(q + quant_hdr.uv_ac_delta); | 1502 iq_matrix_buf.quantization_index[i][5] = CLAMP_Q(q + quant_hdr.uv_ac_delta); |
1506 #undef CLAMP_Q | 1503 #undef CLAMP_Q |
1507 } | 1504 } |
1508 | 1505 |
1509 if (!vaapi_wrapper_->SubmitBuffer( | 1506 if (!vaapi_wrapper_->SubmitBuffer( |
1510 VAIQMatrixBufferType, sizeof(VAIQMatrixBufferVP8), &iq_matrix_buf)) | 1507 VAIQMatrixBufferType, sizeof(VAIQMatrixBufferVP8), &iq_matrix_buf)) |
1511 return false; | 1508 return false; |
1512 | 1509 |
1513 VAProbabilityDataBufferVP8 prob_buf; | 1510 VAProbabilityDataBufferVP8 prob_buf; |
1514 memset(&prob_buf, 0, sizeof(VAProbabilityDataBufferVP8)); | 1511 memset(&prob_buf, 0, sizeof(VAProbabilityDataBufferVP8)); |
1515 | 1512 |
1516 const media::Vp8EntropyHeader& entr_hdr = frame_hdr->entropy_hdr; | 1513 const Vp8EntropyHeader& entr_hdr = frame_hdr->entropy_hdr; |
1517 ARRAY_MEMCPY_CHECKED(prob_buf.dct_coeff_probs, entr_hdr.coeff_probs); | 1514 ARRAY_MEMCPY_CHECKED(prob_buf.dct_coeff_probs, entr_hdr.coeff_probs); |
1518 | 1515 |
1519 if (!vaapi_wrapper_->SubmitBuffer(VAProbabilityBufferType, | 1516 if (!vaapi_wrapper_->SubmitBuffer(VAProbabilityBufferType, |
1520 sizeof(VAProbabilityDataBufferVP8), | 1517 sizeof(VAProbabilityDataBufferVP8), |
1521 &prob_buf)) | 1518 &prob_buf)) |
1522 return false; | 1519 return false; |
1523 | 1520 |
1524 VAPictureParameterBufferVP8 pic_param; | 1521 VAPictureParameterBufferVP8 pic_param; |
1525 memset(&pic_param, 0, sizeof(VAPictureParameterBufferVP8)); | 1522 memset(&pic_param, 0, sizeof(VAPictureParameterBufferVP8)); |
1526 pic_param.frame_width = frame_hdr->width; | 1523 pic_param.frame_width = frame_hdr->width; |
(...skipping 18 matching lines...) Expand all Loading... |
1545 if (alt_frame) { | 1542 if (alt_frame) { |
1546 scoped_refptr<VaapiDecodeSurface> alt_frame_surface = | 1543 scoped_refptr<VaapiDecodeSurface> alt_frame_surface = |
1547 VP8PictureToVaapiDecodeSurface(alt_frame); | 1544 VP8PictureToVaapiDecodeSurface(alt_frame); |
1548 pic_param.alt_ref_frame = alt_frame_surface->va_surface()->id(); | 1545 pic_param.alt_ref_frame = alt_frame_surface->va_surface()->id(); |
1549 } else { | 1546 } else { |
1550 pic_param.alt_ref_frame = VA_INVALID_SURFACE; | 1547 pic_param.alt_ref_frame = VA_INVALID_SURFACE; |
1551 } | 1548 } |
1552 | 1549 |
1553 pic_param.out_of_loop_frame = VA_INVALID_SURFACE; | 1550 pic_param.out_of_loop_frame = VA_INVALID_SURFACE; |
1554 | 1551 |
1555 const media::Vp8LoopFilterHeader& lf_hdr = frame_hdr->loopfilter_hdr; | 1552 const Vp8LoopFilterHeader& lf_hdr = frame_hdr->loopfilter_hdr; |
1556 | 1553 |
1557 #define FHDR_TO_PP_PF(a, b) pic_param.pic_fields.bits.a = (b) | 1554 #define FHDR_TO_PP_PF(a, b) pic_param.pic_fields.bits.a = (b) |
1558 FHDR_TO_PP_PF(key_frame, frame_hdr->IsKeyframe() ? 0 : 1); | 1555 FHDR_TO_PP_PF(key_frame, frame_hdr->IsKeyframe() ? 0 : 1); |
1559 FHDR_TO_PP_PF(version, frame_hdr->version); | 1556 FHDR_TO_PP_PF(version, frame_hdr->version); |
1560 FHDR_TO_PP_PF(segmentation_enabled, sgmnt_hdr.segmentation_enabled); | 1557 FHDR_TO_PP_PF(segmentation_enabled, sgmnt_hdr.segmentation_enabled); |
1561 FHDR_TO_PP_PF(update_mb_segmentation_map, | 1558 FHDR_TO_PP_PF(update_mb_segmentation_map, |
1562 sgmnt_hdr.update_mb_segmentation_map); | 1559 sgmnt_hdr.update_mb_segmentation_map); |
1563 FHDR_TO_PP_PF(update_segment_feature_data, | 1560 FHDR_TO_PP_PF(update_segment_feature_data, |
1564 sgmnt_hdr.update_segment_feature_data); | 1561 sgmnt_hdr.update_segment_feature_data); |
1565 FHDR_TO_PP_PF(filter_type, lf_hdr.type); | 1562 FHDR_TO_PP_PF(filter_type, lf_hdr.type); |
1566 FHDR_TO_PP_PF(sharpness_level, lf_hdr.sharpness_level); | 1563 FHDR_TO_PP_PF(sharpness_level, lf_hdr.sharpness_level); |
1567 FHDR_TO_PP_PF(loop_filter_adj_enable, lf_hdr.loop_filter_adj_enable); | 1564 FHDR_TO_PP_PF(loop_filter_adj_enable, lf_hdr.loop_filter_adj_enable); |
1568 FHDR_TO_PP_PF(mode_ref_lf_delta_update, lf_hdr.mode_ref_lf_delta_update); | 1565 FHDR_TO_PP_PF(mode_ref_lf_delta_update, lf_hdr.mode_ref_lf_delta_update); |
1569 FHDR_TO_PP_PF(sign_bias_golden, frame_hdr->sign_bias_golden); | 1566 FHDR_TO_PP_PF(sign_bias_golden, frame_hdr->sign_bias_golden); |
1570 FHDR_TO_PP_PF(sign_bias_alternate, frame_hdr->sign_bias_alternate); | 1567 FHDR_TO_PP_PF(sign_bias_alternate, frame_hdr->sign_bias_alternate); |
1571 FHDR_TO_PP_PF(mb_no_coeff_skip, frame_hdr->mb_no_skip_coeff); | 1568 FHDR_TO_PP_PF(mb_no_coeff_skip, frame_hdr->mb_no_skip_coeff); |
1572 FHDR_TO_PP_PF(loop_filter_disable, lf_hdr.level == 0); | 1569 FHDR_TO_PP_PF(loop_filter_disable, lf_hdr.level == 0); |
1573 #undef FHDR_TO_PP_PF | 1570 #undef FHDR_TO_PP_PF |
1574 | 1571 |
1575 ARRAY_MEMCPY_CHECKED(pic_param.mb_segment_tree_probs, sgmnt_hdr.segment_prob); | 1572 ARRAY_MEMCPY_CHECKED(pic_param.mb_segment_tree_probs, sgmnt_hdr.segment_prob); |
1576 | 1573 |
1577 static_assert(arraysize(sgmnt_hdr.lf_update_value) == | 1574 static_assert(arraysize(sgmnt_hdr.lf_update_value) == |
1578 arraysize(pic_param.loop_filter_level), | 1575 arraysize(pic_param.loop_filter_level), |
1579 "loop filter level arrays mismatch"); | 1576 "loop filter level arrays mismatch"); |
1580 for (size_t i = 0; i < arraysize(sgmnt_hdr.lf_update_value); ++i) { | 1577 for (size_t i = 0; i < arraysize(sgmnt_hdr.lf_update_value); ++i) { |
1581 int lf_level = lf_hdr.level; | 1578 int lf_level = lf_hdr.level; |
1582 if (sgmnt_hdr.segmentation_enabled) { | 1579 if (sgmnt_hdr.segmentation_enabled) { |
1583 if (sgmnt_hdr.segment_feature_mode == | 1580 if (sgmnt_hdr.segment_feature_mode == |
1584 media::Vp8SegmentationHeader::FEATURE_MODE_ABSOLUTE) | 1581 Vp8SegmentationHeader::FEATURE_MODE_ABSOLUTE) |
1585 lf_level = sgmnt_hdr.lf_update_value[i]; | 1582 lf_level = sgmnt_hdr.lf_update_value[i]; |
1586 else | 1583 else |
1587 lf_level += sgmnt_hdr.lf_update_value[i]; | 1584 lf_level += sgmnt_hdr.lf_update_value[i]; |
1588 } | 1585 } |
1589 | 1586 |
1590 // Clamp to [0..63] range. | 1587 // Clamp to [0..63] range. |
1591 lf_level = std::min(std::max(lf_level, 0), 63); | 1588 lf_level = std::min(std::max(lf_level, 0), 63); |
1592 pic_param.loop_filter_level[i] = lf_level; | 1589 pic_param.loop_filter_level[i] = lf_level; |
1593 } | 1590 } |
1594 | 1591 |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1687 VaapiVideoDecodeAccelerator::VaapiVP9Accelerator::CreateVP9Picture() { | 1684 VaapiVideoDecodeAccelerator::VaapiVP9Accelerator::CreateVP9Picture() { |
1688 scoped_refptr<VaapiDecodeSurface> va_surface = vaapi_dec_->CreateSurface(); | 1685 scoped_refptr<VaapiDecodeSurface> va_surface = vaapi_dec_->CreateSurface(); |
1689 if (!va_surface) | 1686 if (!va_surface) |
1690 return nullptr; | 1687 return nullptr; |
1691 | 1688 |
1692 return new VaapiVP9Picture(va_surface); | 1689 return new VaapiVP9Picture(va_surface); |
1693 } | 1690 } |
1694 | 1691 |
1695 bool VaapiVideoDecodeAccelerator::VaapiVP9Accelerator::SubmitDecode( | 1692 bool VaapiVideoDecodeAccelerator::VaapiVP9Accelerator::SubmitDecode( |
1696 const scoped_refptr<VP9Picture>& pic, | 1693 const scoped_refptr<VP9Picture>& pic, |
1697 const media::Vp9Segmentation& seg, | 1694 const Vp9Segmentation& seg, |
1698 const media::Vp9LoopFilter& lf, | 1695 const Vp9LoopFilter& lf, |
1699 const std::vector<scoped_refptr<VP9Picture>>& ref_pictures) { | 1696 const std::vector<scoped_refptr<VP9Picture>>& ref_pictures) { |
1700 VADecPictureParameterBufferVP9 pic_param; | 1697 VADecPictureParameterBufferVP9 pic_param; |
1701 memset(&pic_param, 0, sizeof(pic_param)); | 1698 memset(&pic_param, 0, sizeof(pic_param)); |
1702 | 1699 |
1703 const media::Vp9FrameHeader* frame_hdr = pic->frame_hdr.get(); | 1700 const Vp9FrameHeader* frame_hdr = pic->frame_hdr.get(); |
1704 DCHECK(frame_hdr); | 1701 DCHECK(frame_hdr); |
1705 | 1702 |
1706 if (frame_hdr->profile != 0) { | 1703 if (frame_hdr->profile != 0) { |
1707 DVLOG(1) << "Unsupported profile" << frame_hdr->profile; | 1704 DVLOG(1) << "Unsupported profile" << frame_hdr->profile; |
1708 return false; | 1705 return false; |
1709 } | 1706 } |
1710 | 1707 |
1711 pic_param.frame_width = base::checked_cast<uint16_t>(frame_hdr->width); | 1708 pic_param.frame_width = base::checked_cast<uint16_t>(frame_hdr->width); |
1712 pic_param.frame_height = base::checked_cast<uint16_t>(frame_hdr->height); | 1709 pic_param.frame_height = base::checked_cast<uint16_t>(frame_hdr->height); |
1713 | 1710 |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1767 if (!vaapi_wrapper_->SubmitBuffer(VAPictureParameterBufferType, | 1764 if (!vaapi_wrapper_->SubmitBuffer(VAPictureParameterBufferType, |
1768 sizeof(pic_param), &pic_param)) | 1765 sizeof(pic_param), &pic_param)) |
1769 return false; | 1766 return false; |
1770 | 1767 |
1771 VASliceParameterBufferVP9 slice_param; | 1768 VASliceParameterBufferVP9 slice_param; |
1772 memset(&slice_param, 0, sizeof(slice_param)); | 1769 memset(&slice_param, 0, sizeof(slice_param)); |
1773 slice_param.slice_data_size = frame_hdr->frame_size; | 1770 slice_param.slice_data_size = frame_hdr->frame_size; |
1774 slice_param.slice_data_offset = 0; | 1771 slice_param.slice_data_offset = 0; |
1775 slice_param.slice_data_flag = VA_SLICE_DATA_FLAG_ALL; | 1772 slice_param.slice_data_flag = VA_SLICE_DATA_FLAG_ALL; |
1776 | 1773 |
1777 static_assert(arraysize(media::Vp9Segmentation::feature_enabled) == | 1774 static_assert(arraysize(Vp9Segmentation::feature_enabled) == |
1778 arraysize(slice_param.seg_param), | 1775 arraysize(slice_param.seg_param), |
1779 "seg_param array of incorrect size"); | 1776 "seg_param array of incorrect size"); |
1780 for (size_t i = 0; i < arraysize(slice_param.seg_param); ++i) { | 1777 for (size_t i = 0; i < arraysize(slice_param.seg_param); ++i) { |
1781 VASegmentParameterVP9& seg_param = slice_param.seg_param[i]; | 1778 VASegmentParameterVP9& seg_param = slice_param.seg_param[i]; |
1782 #define SEG_TO_SP_SF(a, b) seg_param.segment_flags.fields.a = b | 1779 #define SEG_TO_SP_SF(a, b) seg_param.segment_flags.fields.a = b |
1783 SEG_TO_SP_SF( | 1780 SEG_TO_SP_SF(segment_reference_enabled, |
1784 segment_reference_enabled, | 1781 seg.FeatureEnabled(i, Vp9Segmentation::SEG_LVL_REF_FRAME)); |
1785 seg.FeatureEnabled(i, media::Vp9Segmentation::SEG_LVL_REF_FRAME)); | |
1786 SEG_TO_SP_SF(segment_reference, | 1782 SEG_TO_SP_SF(segment_reference, |
1787 seg.FeatureData(i, media::Vp9Segmentation::SEG_LVL_REF_FRAME)); | 1783 seg.FeatureData(i, Vp9Segmentation::SEG_LVL_REF_FRAME)); |
1788 SEG_TO_SP_SF(segment_reference_skipped, | 1784 SEG_TO_SP_SF(segment_reference_skipped, |
1789 seg.FeatureEnabled(i, media::Vp9Segmentation::SEG_LVL_SKIP)); | 1785 seg.FeatureEnabled(i, Vp9Segmentation::SEG_LVL_SKIP)); |
1790 #undef SEG_TO_SP_SF | 1786 #undef SEG_TO_SP_SF |
1791 | 1787 |
1792 ARRAY_MEMCPY_CHECKED(seg_param.filter_level, lf.lvl[i]); | 1788 ARRAY_MEMCPY_CHECKED(seg_param.filter_level, lf.lvl[i]); |
1793 | 1789 |
1794 seg_param.luma_dc_quant_scale = seg.y_dequant[i][0]; | 1790 seg_param.luma_dc_quant_scale = seg.y_dequant[i][0]; |
1795 seg_param.luma_ac_quant_scale = seg.y_dequant[i][1]; | 1791 seg_param.luma_ac_quant_scale = seg.y_dequant[i][1]; |
1796 seg_param.chroma_dc_quant_scale = seg.uv_dequant[i][0]; | 1792 seg_param.chroma_dc_quant_scale = seg.uv_dequant[i][0]; |
1797 seg_param.chroma_ac_quant_scale = seg.uv_dequant[i][1]; | 1793 seg_param.chroma_ac_quant_scale = seg.uv_dequant[i][1]; |
1798 } | 1794 } |
1799 | 1795 |
(...skipping 23 matching lines...) Expand all Loading... |
1823 | 1819 |
1824 scoped_refptr<VaapiVideoDecodeAccelerator::VaapiDecodeSurface> | 1820 scoped_refptr<VaapiVideoDecodeAccelerator::VaapiDecodeSurface> |
1825 VaapiVideoDecodeAccelerator::VaapiVP9Accelerator:: | 1821 VaapiVideoDecodeAccelerator::VaapiVP9Accelerator:: |
1826 VP9PictureToVaapiDecodeSurface(const scoped_refptr<VP9Picture>& pic) { | 1822 VP9PictureToVaapiDecodeSurface(const scoped_refptr<VP9Picture>& pic) { |
1827 VaapiVP9Picture* vaapi_pic = pic->AsVaapiVP9Picture(); | 1823 VaapiVP9Picture* vaapi_pic = pic->AsVaapiVP9Picture(); |
1828 CHECK(vaapi_pic); | 1824 CHECK(vaapi_pic); |
1829 return vaapi_pic->dec_surface(); | 1825 return vaapi_pic->dec_surface(); |
1830 } | 1826 } |
1831 | 1827 |
1832 // static | 1828 // static |
1833 media::VideoDecodeAccelerator::SupportedProfiles | 1829 VideoDecodeAccelerator::SupportedProfiles |
1834 VaapiVideoDecodeAccelerator::GetSupportedProfiles() { | 1830 VaapiVideoDecodeAccelerator::GetSupportedProfiles() { |
1835 return VaapiWrapper::GetSupportedDecodeProfiles(); | 1831 return VaapiWrapper::GetSupportedDecodeProfiles(); |
1836 } | 1832 } |
1837 | 1833 |
1838 } // namespace media | 1834 } // namespace media |
OLD | NEW |