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

Side by Side Diff: remoting/codec/video_encoder_vpx.h

Issue 261753013: Implement VP9/I444 encode support in the Chromoting host. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix CreateVP9Codec bug and unit-test build. Created 6 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « remoting/codec/video_decoder_vpx_unittest.cc ('k') | remoting/codec/video_encoder_vpx.cc » ('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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 REMOTING_CODEC_VIDEO_ENCODER_VPX_H_ 5 #ifndef REMOTING_CODEC_VIDEO_ENCODER_VPX_H_
6 #define REMOTING_CODEC_VIDEO_ENCODER_VPX_H_ 6 #define REMOTING_CODEC_VIDEO_ENCODER_VPX_H_
7 7
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/time/time.h" 9 #include "base/time/time.h"
10 #include "remoting/codec/scoped_vpx_codec.h" 10 #include "remoting/codec/scoped_vpx_codec.h"
11 #include "remoting/codec/video_encoder.h" 11 #include "remoting/codec/video_encoder.h"
12 12
13 typedef struct vpx_image vpx_image_t; 13 typedef struct vpx_image vpx_image_t;
14 14
15 namespace webrtc { 15 namespace webrtc {
16 class DesktopRegion; 16 class DesktopRegion;
17 class DesktopSize; 17 class DesktopSize;
18 } // namespace webrtc 18 } // namespace webrtc
19 19
20 namespace remoting { 20 namespace remoting {
21 21
22 class VideoEncoderVpx : public VideoEncoder { 22 class VideoEncoderVpx : public VideoEncoder {
23 public: 23 public:
24 // Create encoder for the specified protocol. 24 // Create encoder for the specified protocol.
25 static scoped_ptr<VideoEncoderVpx> CreateForVP8(); 25 static scoped_ptr<VideoEncoderVpx> CreateForVP8();
26 static scoped_ptr<VideoEncoderVpx> CreateForVP9(); 26 static scoped_ptr<VideoEncoderVpx> CreateForVP9I420();
27 static scoped_ptr<VideoEncoderVpx> CreateForVP9I444();
27 28
28 virtual ~VideoEncoderVpx(); 29 virtual ~VideoEncoderVpx();
29 30
30 // VideoEncoder interface. 31 // VideoEncoder interface.
31 virtual scoped_ptr<VideoPacket> Encode( 32 virtual scoped_ptr<VideoPacket> Encode(
32 const webrtc::DesktopFrame& frame) OVERRIDE; 33 const webrtc::DesktopFrame& frame) OVERRIDE;
33 34
34 private: 35 private:
35 typedef base::Callback<ScopedVpxCodec(const webrtc::DesktopSize&)> 36 typedef base::Callback<ScopedVpxCodec(const webrtc::DesktopSize&)>
36 InitializeCodecCallback; 37 CreateCodecCallback;
38 typedef base::Callback<void(const webrtc::DesktopSize&,
39 scoped_ptr<vpx_image_t>* out_image,
40 scoped_ptr<uint8[]>* out_image_buffer)>
41 CreateImageCallback;
37 42
38 VideoEncoderVpx(const InitializeCodecCallback& init_codec); 43 VideoEncoderVpx(const CreateCodecCallback& create_codec,
44 const CreateImageCallback& create_image);
39 45
40 // Initializes the codec for frames of |size|. Returns true if successful. 46 // Initializes the codec for frames of |size|. Returns true if successful.
41 bool Initialize(const webrtc::DesktopSize& size); 47 bool Initialize(const webrtc::DesktopSize& size);
42 48
43 // Prepares |image_| for encoding. Writes updated rectangles into 49 // Prepares |image_| for encoding. Writes updated rectangles into
44 // |updated_region|. 50 // |updated_region|.
45 void PrepareImage(const webrtc::DesktopFrame& frame, 51 void PrepareImage(const webrtc::DesktopFrame& frame,
46 webrtc::DesktopRegion* updated_region); 52 webrtc::DesktopRegion* updated_region);
47 53
48 // Updates the active map according to |updated_region|. Active map is then 54 // Updates the active map according to |updated_region|. Active map is then
49 // given to the encoder to speed up encoding. 55 // given to the encoder to speed up encoding.
50 void PrepareActiveMap(const webrtc::DesktopRegion& updated_region); 56 void PrepareActiveMap(const webrtc::DesktopRegion& updated_region);
51 57
52 InitializeCodecCallback init_codec_; 58 CreateCodecCallback create_codec_;
59 CreateImageCallback create_image_;
53 60
54 ScopedVpxCodec codec_; 61 ScopedVpxCodec codec_;
62 base::TimeTicks timestamp_base_;
63
64 // VPX image and buffer to hold the actual YUV planes.
55 scoped_ptr<vpx_image_t> image_; 65 scoped_ptr<vpx_image_t> image_;
66 scoped_ptr<uint8[]> image_buffer_;
67
68 // Active map used to optimize out processing of un-changed macroblocks.
56 scoped_ptr<uint8[]> active_map_; 69 scoped_ptr<uint8[]> active_map_;
57 int active_map_width_; 70 int active_map_width_;
58 int active_map_height_; 71 int active_map_height_;
59 base::TimeTicks timestamp_base_;
60
61 // Buffer for storing the yuv image.
62 scoped_ptr<uint8[]> yuv_image_;
63 72
64 DISALLOW_COPY_AND_ASSIGN(VideoEncoderVpx); 73 DISALLOW_COPY_AND_ASSIGN(VideoEncoderVpx);
65 }; 74 };
66 75
67 } // namespace remoting 76 } // namespace remoting
68 77
69 #endif // REMOTING_CODEC_VIDEO_ENCODER_VP8_H_ 78 #endif // REMOTING_CODEC_VIDEO_ENCODER_VP8_H_
OLDNEW
« no previous file with comments | « remoting/codec/video_decoder_vpx_unittest.cc ('k') | remoting/codec/video_encoder_vpx.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698