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/filters/vpx_video_decoder.h

Issue 1561703002: media/vpx: Add support for VP9 alpha channel (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: move alpha decoding to its own function Created 4 years, 11 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
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 #ifndef MEDIA_FILTERS_VPX_VIDEO_DECODER_H_ 5 #ifndef MEDIA_FILTERS_VPX_VIDEO_DECODER_H_
6 #define MEDIA_FILTERS_VPX_VIDEO_DECODER_H_ 6 #define MEDIA_FILTERS_VPX_VIDEO_DECODER_H_
7 7
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/threading/thread_checker.h" 10 #include "base/threading/thread_checker.h"
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 48
49 private: 49 private:
50 enum DecoderState { 50 enum DecoderState {
51 kUninitialized, 51 kUninitialized,
52 kNormal, 52 kNormal,
53 kFlushCodec, 53 kFlushCodec,
54 kDecodeFinished, 54 kDecodeFinished,
55 kError 55 kError
56 }; 56 };
57 57
58 // Return values for decoding alpha plane.
59 enum AlphaDecodeStatus { kOk, kNoAlphaPlaneData, kError };
60
58 // Handles (re-)initializing the decoder with a (new) config. 61 // Handles (re-)initializing the decoder with a (new) config.
59 // Returns true when initialization was successful. 62 // Returns true when initialization was successful.
60 bool ConfigureDecoder(const VideoDecoderConfig& config); 63 bool ConfigureDecoder(const VideoDecoderConfig& config);
61 64
62 void CloseDecoder(); 65 void CloseDecoder();
63 66
64 // Try to decode |buffer| into |video_frame|. Return true if all decoding 67 // Try to decode |buffer| into |video_frame|. Return true if all decoding
65 // succeeded. Note that decoding can succeed and still |video_frame| be 68 // succeeded. Note that decoding can succeed and still |video_frame| be
66 // nullptr if there has been a partial decoding. 69 // nullptr if there has been a partial decoding.
67 bool VpxDecode(const scoped_refptr<DecoderBuffer>& buffer, 70 bool VpxDecode(const scoped_refptr<DecoderBuffer>& buffer,
68 scoped_refptr<VideoFrame>* video_frame); 71 scoped_refptr<VideoFrame>* video_frame);
69 72
70 bool CopyVpxImageToVideoFrame(const struct vpx_image* vpx_image, 73 bool CopyVpxImageToVideoFrame(const struct vpx_image* vpx_image,
74 const struct vpx_image* vpx_image_alpha,
71 scoped_refptr<VideoFrame>* video_frame); 75 scoped_refptr<VideoFrame>* video_frame);
72 76
77 AlphaDecodeStatus DecodeAlphaPlane(
78 const struct vpx_image* vpx_image,
79 const struct vpx_image** vpx_image_alpha,
80 const scoped_refptr<DecoderBuffer>& buffer);
81
73 base::ThreadChecker thread_checker_; 82 base::ThreadChecker thread_checker_;
74 83
75 DecoderState state_; 84 DecoderState state_;
76 85
77 OutputCB output_cb_; 86 OutputCB output_cb_;
78 87
79 VideoDecoderConfig config_; 88 VideoDecoderConfig config_;
80 89
81 vpx_codec_ctx* vpx_codec_; 90 vpx_codec_ctx* vpx_codec_;
82 vpx_codec_ctx* vpx_codec_alpha_; 91 vpx_codec_ctx* vpx_codec_alpha_;
83 92
84 // |memory_pool_| is a single-threaded memory pool used for VP9 decoding 93 // |memory_pool_| is a single-threaded memory pool used for VP9 decoding
85 // with no alpha. |frame_pool_| is used for all other cases. 94 // with no alpha. |frame_pool_| is used for all other cases.
86 class MemoryPool; 95 class MemoryPool;
87 scoped_refptr<MemoryPool> memory_pool_; 96 scoped_refptr<MemoryPool> memory_pool_;
88 97
89 VideoFramePool frame_pool_; 98 VideoFramePool frame_pool_;
90 99
91 DISALLOW_COPY_AND_ASSIGN(VpxVideoDecoder); 100 DISALLOW_COPY_AND_ASSIGN(VpxVideoDecoder);
92 }; 101 };
93 102
94 } // namespace media 103 } // namespace media
95 104
96 #endif // MEDIA_FILTERS_VPX_VIDEO_DECODER_H_ 105 #endif // MEDIA_FILTERS_VPX_VIDEO_DECODER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698