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

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

Issue 2229353002: V4L2SVDA: Add a VP9Accelerator implementation utilizing the V4L2 VP9 frame API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: compilation fixes Created 4 years, 3 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/v4l2_slice_video_decode_accelerator.cc ('k') | media/gpu/vp9_decoder.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 "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 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 class VaapiVideoDecodeAccelerator::VaapiVP9Accelerator 238 class VaapiVideoDecodeAccelerator::VaapiVP9Accelerator
239 : public VP9Decoder::VP9Accelerator { 239 : public VP9Decoder::VP9Accelerator {
240 public: 240 public:
241 VaapiVP9Accelerator(VaapiVideoDecodeAccelerator* vaapi_dec, 241 VaapiVP9Accelerator(VaapiVideoDecodeAccelerator* vaapi_dec,
242 VaapiWrapper* vaapi_wrapper); 242 VaapiWrapper* vaapi_wrapper);
243 ~VaapiVP9Accelerator() override; 243 ~VaapiVP9Accelerator() override;
244 244
245 // VP9Decoder::VP9Accelerator implementation. 245 // VP9Decoder::VP9Accelerator implementation.
246 scoped_refptr<VP9Picture> CreateVP9Picture() override; 246 scoped_refptr<VP9Picture> CreateVP9Picture() override;
247 247
248 bool SubmitDecode( 248 bool SubmitDecode(const scoped_refptr<VP9Picture>& pic,
249 const scoped_refptr<VP9Picture>& pic, 249 const Vp9SegmentationParams& seg,
250 const Vp9SegmentationParams& seg, 250 const Vp9LoopFilterParams& lf,
251 const Vp9LoopFilterParams& lf, 251 const std::vector<scoped_refptr<VP9Picture>>& ref_pictures,
252 const std::vector<scoped_refptr<VP9Picture>>& ref_pictures) override; 252 const base::Closure& done_cb) override;
253 253
254 bool OutputPicture(const scoped_refptr<VP9Picture>& pic) override; 254 bool OutputPicture(const scoped_refptr<VP9Picture>& pic) override;
255 255
256 bool IsFrameContextRequired() const override { return false; }
257
258 bool GetFrameContext(const scoped_refptr<VP9Picture>& pic,
259 Vp9FrameContext* frame_ctx) override;
260
256 private: 261 private:
257 scoped_refptr<VaapiDecodeSurface> VP9PictureToVaapiDecodeSurface( 262 scoped_refptr<VaapiDecodeSurface> VP9PictureToVaapiDecodeSurface(
258 const scoped_refptr<VP9Picture>& pic); 263 const scoped_refptr<VP9Picture>& pic);
259 264
260 VaapiWrapper* vaapi_wrapper_; 265 VaapiWrapper* vaapi_wrapper_;
261 VaapiVideoDecodeAccelerator* vaapi_dec_; 266 VaapiVideoDecodeAccelerator* vaapi_dec_;
262 267
263 DISALLOW_COPY_AND_ASSIGN(VaapiVP9Accelerator); 268 DISALLOW_COPY_AND_ASSIGN(VaapiVP9Accelerator);
264 }; 269 };
265 270
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after
612 break; 617 break;
613 618
614 case AcceleratedVideoDecoder::kRanOutOfSurfaces: 619 case AcceleratedVideoDecoder::kRanOutOfSurfaces:
615 // No more output buffers in the decoder, try getting more or go to 620 // No more output buffers in the decoder, try getting more or go to
616 // sleep waiting for them. 621 // sleep waiting for them.
617 if (!WaitForSurfaces_Locked()) 622 if (!WaitForSurfaces_Locked())
618 return; 623 return;
619 624
620 break; 625 break;
621 626
627 case AcceleratedVideoDecoder::kNeedContextUpdate:
628 // This should not happen as we return false from
629 // IsFrameContextRequired().
630 NOTREACHED() << "Context updates not supported";
631 return;
632
622 case AcceleratedVideoDecoder::kDecodeError: 633 case AcceleratedVideoDecoder::kDecodeError:
623 RETURN_AND_NOTIFY_ON_FAILURE(false, "Error decoding stream", 634 RETURN_AND_NOTIFY_ON_FAILURE(false, "Error decoding stream",
624 PLATFORM_FAILURE, ); 635 PLATFORM_FAILURE, );
625 return; 636 return;
626 } 637 }
627 } 638 }
628 } 639 }
629 640
630 void VaapiVideoDecodeAccelerator::InitiateSurfaceSetChange(size_t num_pics, 641 void VaapiVideoDecodeAccelerator::InitiateSurfaceSetChange(size_t num_pics,
631 gfx::Size size) { 642 gfx::Size size) {
(...skipping 1080 matching lines...) Expand 10 before | Expand all | Expand 10 after
1712 if (!va_surface) 1723 if (!va_surface)
1713 return nullptr; 1724 return nullptr;
1714 1725
1715 return new VaapiVP9Picture(va_surface); 1726 return new VaapiVP9Picture(va_surface);
1716 } 1727 }
1717 1728
1718 bool VaapiVideoDecodeAccelerator::VaapiVP9Accelerator::SubmitDecode( 1729 bool VaapiVideoDecodeAccelerator::VaapiVP9Accelerator::SubmitDecode(
1719 const scoped_refptr<VP9Picture>& pic, 1730 const scoped_refptr<VP9Picture>& pic,
1720 const Vp9SegmentationParams& seg, 1731 const Vp9SegmentationParams& seg,
1721 const Vp9LoopFilterParams& lf, 1732 const Vp9LoopFilterParams& lf,
1722 const std::vector<scoped_refptr<VP9Picture>>& ref_pictures) { 1733 const std::vector<scoped_refptr<VP9Picture>>& ref_pictures,
1734 const base::Closure& done_cb) {
1735 // TODO(posciak): We don't currently have the ability to know when the surface
1736 // is decoded, as we submit both the decode job and output independently and
1737 // don't wait for just the decode to be finished, instead relying on the
1738 // driver to execute them in correct order.
1739 DCHECK(!done_cb.is_null());
1740
1723 VADecPictureParameterBufferVP9 pic_param; 1741 VADecPictureParameterBufferVP9 pic_param;
1724 memset(&pic_param, 0, sizeof(pic_param)); 1742 memset(&pic_param, 0, sizeof(pic_param));
1725 1743
1726 const Vp9FrameHeader* frame_hdr = pic->frame_hdr.get(); 1744 const Vp9FrameHeader* frame_hdr = pic->frame_hdr.get();
1727 DCHECK(frame_hdr); 1745 DCHECK(frame_hdr);
1728 1746
1729 if (frame_hdr->profile != 0) { 1747 if (frame_hdr->profile != 0) {
1730 DVLOG(1) << "Unsupported profile" << frame_hdr->profile; 1748 DVLOG(1) << "Unsupported profile" << frame_hdr->profile;
1731 return false; 1749 return false;
1732 } 1750 }
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
1841 1859
1842 bool VaapiVideoDecodeAccelerator::VaapiVP9Accelerator::OutputPicture( 1860 bool VaapiVideoDecodeAccelerator::VaapiVP9Accelerator::OutputPicture(
1843 const scoped_refptr<VP9Picture>& pic) { 1861 const scoped_refptr<VP9Picture>& pic) {
1844 scoped_refptr<VaapiDecodeSurface> dec_surface = 1862 scoped_refptr<VaapiDecodeSurface> dec_surface =
1845 VP9PictureToVaapiDecodeSurface(pic); 1863 VP9PictureToVaapiDecodeSurface(pic);
1846 1864
1847 vaapi_dec_->SurfaceReady(dec_surface); 1865 vaapi_dec_->SurfaceReady(dec_surface);
1848 return true; 1866 return true;
1849 } 1867 }
1850 1868
1869 bool VaapiVideoDecodeAccelerator::VaapiVP9Accelerator::GetFrameContext(
1870 const scoped_refptr<VP9Picture>& pic,
1871 Vp9FrameContext* frame_ctx) {
1872 NOTIMPLEMENTED() << "Frame context update not supported";
1873 return false;
1874 }
1875
1851 scoped_refptr<VaapiVideoDecodeAccelerator::VaapiDecodeSurface> 1876 scoped_refptr<VaapiVideoDecodeAccelerator::VaapiDecodeSurface>
1852 VaapiVideoDecodeAccelerator::VaapiVP9Accelerator:: 1877 VaapiVideoDecodeAccelerator::VaapiVP9Accelerator::
1853 VP9PictureToVaapiDecodeSurface(const scoped_refptr<VP9Picture>& pic) { 1878 VP9PictureToVaapiDecodeSurface(const scoped_refptr<VP9Picture>& pic) {
1854 VaapiVP9Picture* vaapi_pic = pic->AsVaapiVP9Picture(); 1879 VaapiVP9Picture* vaapi_pic = pic->AsVaapiVP9Picture();
1855 CHECK(vaapi_pic); 1880 CHECK(vaapi_pic);
1856 return vaapi_pic->dec_surface(); 1881 return vaapi_pic->dec_surface();
1857 } 1882 }
1858 1883
1859 // static 1884 // static
1860 VideoDecodeAccelerator::SupportedProfiles 1885 VideoDecodeAccelerator::SupportedProfiles
1861 VaapiVideoDecodeAccelerator::GetSupportedProfiles() { 1886 VaapiVideoDecodeAccelerator::GetSupportedProfiles() {
1862 return VaapiWrapper::GetSupportedDecodeProfiles(); 1887 return VaapiWrapper::GetSupportedDecodeProfiles();
1863 } 1888 }
1864 1889
1865 } // namespace media 1890 } // namespace media
OLDNEW
« no previous file with comments | « media/gpu/v4l2_slice_video_decode_accelerator.cc ('k') | media/gpu/vp9_decoder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698