Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 * | 9 * |
| 10 */ | 10 */ |
| 11 | 11 |
| 12 #ifndef WEBRTC_MODULES_VIDEO_CODING_CODECS_VP9_IMPL_H_ | 12 #ifndef WEBRTC_MODULES_VIDEO_CODING_CODECS_VP9_IMPL_H_ |
| 13 #define WEBRTC_MODULES_VIDEO_CODING_CODECS_VP9_IMPL_H_ | 13 #define WEBRTC_MODULES_VIDEO_CODING_CODECS_VP9_IMPL_H_ |
| 14 | 14 |
| 15 #include "webrtc/modules/video_coding/codecs/vp9/include/vp9.h" | 15 #include "webrtc/modules/video_coding/codecs/vp9/include/vp9.h" |
| 16 #include "webrtc/modules/video_coding/codecs/vp9/vp9_frame_buffer_pool.h" | 16 #include "webrtc/modules/video_coding/codecs/vp9/vp9_frame_buffer_pool.h" |
| 17 | 17 |
| 18 #include "vpx/svc_context.h" | |
| 18 #include "vpx/vpx_decoder.h" | 19 #include "vpx/vpx_decoder.h" |
| 19 #include "vpx/vpx_encoder.h" | 20 #include "vpx/vpx_encoder.h" |
| 20 | 21 |
| 21 namespace webrtc { | 22 namespace webrtc { |
| 22 | 23 |
| 23 class VP9EncoderImpl : public VP9Encoder { | 24 class VP9EncoderImpl : public VP9Encoder { |
| 24 public: | 25 public: |
| 25 VP9EncoderImpl(); | 26 VP9EncoderImpl(); |
| 26 | 27 |
| 27 virtual ~VP9EncoderImpl(); | 28 virtual ~VP9EncoderImpl(); |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 48 // Determine number of encoder threads to use. | 49 // Determine number of encoder threads to use. |
| 49 int NumberOfThreads(int width, int height, int number_of_cores); | 50 int NumberOfThreads(int width, int height, int number_of_cores); |
| 50 | 51 |
| 51 // Call encoder initialize function and set control settings. | 52 // Call encoder initialize function and set control settings. |
| 52 int InitAndSetControlSettings(const VideoCodec* inst); | 53 int InitAndSetControlSettings(const VideoCodec* inst); |
| 53 | 54 |
| 54 void PopulateCodecSpecific(CodecSpecificInfo* codec_specific, | 55 void PopulateCodecSpecific(CodecSpecificInfo* codec_specific, |
| 55 const vpx_codec_cx_pkt& pkt, | 56 const vpx_codec_cx_pkt& pkt, |
| 56 uint32_t timestamp); | 57 uint32_t timestamp); |
| 57 | 58 |
| 58 int GetEncodedPartitions(const VideoFrame& input_image); | 59 int SetSvcRates(); |
| 60 virtual int GetEncodedLayerFrame(const vpx_codec_cx_pkt* pkt); | |
| 61 // Callback function for outputting packets per spatial layer. | |
|
stefan-webrtc
2015/07/09 14:48:59
Newline above.
åsapersson
2015/07/29 12:10:12
Done.
| |
| 62 static void EncocderOutputCodedPacketCb(vpx_codec_cx_pkt* pkt, | |
|
stefan-webrtc
2015/07/09 14:48:59
Cb -> Callback.
Maybe move this to the .cc file?
åsapersson
2015/07/29 12:10:12
Renamed and moved to cc-file.
| |
| 63 void* user_data) { | |
| 64 VP9EncoderImpl* enc = (VP9EncoderImpl*)(user_data); | |
| 65 enc->GetEncodedLayerFrame(pkt); | |
| 66 } | |
| 59 | 67 |
| 60 // Determine maximum target for Intra frames | 68 // Determine maximum target for Intra frames |
| 61 // | 69 // |
| 62 // Input: | 70 // Input: |
| 63 // - optimal_buffer_size : Optimal buffer size | 71 // - optimal_buffer_size : Optimal buffer size |
| 64 // Return Value : Max target size for Intra frames represented as | 72 // Return Value : Max target size for Intra frames represented as |
| 65 // percentage of the per frame bandwidth | 73 // percentage of the per frame bandwidth |
| 66 uint32_t MaxIntraTarget(uint32_t optimal_buffer_size); | 74 uint32_t MaxIntraTarget(uint32_t optimal_buffer_size); |
| 67 | 75 |
| 68 EncodedImage encoded_image_; | 76 EncodedImage encoded_image_; |
| 69 EncodedImageCallback* encoded_complete_callback_; | 77 EncodedImageCallback* encoded_complete_callback_; |
| 70 VideoCodec codec_; | 78 VideoCodec codec_; |
| 71 bool inited_; | 79 bool inited_; |
| 72 int64_t timestamp_; | 80 int64_t timestamp_; |
| 73 uint16_t picture_id_; | 81 uint16_t picture_id_; |
| 74 int cpu_speed_; | 82 int cpu_speed_; |
| 75 uint32_t rc_max_intra_target_; | 83 uint32_t rc_max_intra_target_; |
| 76 vpx_codec_ctx_t* encoder_; | 84 vpx_codec_ctx_t* encoder_; |
| 77 vpx_codec_enc_cfg_t* config_; | 85 vpx_codec_enc_cfg_t* config_; |
| 78 vpx_image_t* raw_; | 86 vpx_image_t* raw_; |
| 87 SvcInternal_t svc_internal_; | |
| 88 const VideoFrame* input_image_; | |
| 89 GofInfoVP9 gof_; // Contains each frame's temporal information for | |
| 90 // non-flexible mode. | |
| 91 uint8_t tl0_pic_idx_; // Only used in non-flexible mode. | |
| 92 uint8_t number_of_temporal_layers_; | |
| 93 uint8_t number_of_spatial_layers_; | |
|
stefan-webrtc
2015/07/09 14:48:59
num_temporal_layers_
num_spatial_layers_
åsapersson
2015/07/29 12:10:12
Done.
| |
| 79 }; | 94 }; |
| 80 | 95 |
| 81 | 96 |
| 82 class VP9DecoderImpl : public VP9Decoder { | 97 class VP9DecoderImpl : public VP9Decoder { |
| 83 public: | 98 public: |
| 84 VP9DecoderImpl(); | 99 VP9DecoderImpl(); |
| 85 | 100 |
| 86 virtual ~VP9DecoderImpl(); | 101 virtual ~VP9DecoderImpl(); |
| 87 | 102 |
| 88 int InitDecode(const VideoCodec* inst, int number_of_cores) override; | 103 int InitDecode(const VideoCodec* inst, int number_of_cores) override; |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 106 Vp9FrameBufferPool frame_buffer_pool_; | 121 Vp9FrameBufferPool frame_buffer_pool_; |
| 107 DecodedImageCallback* decode_complete_callback_; | 122 DecodedImageCallback* decode_complete_callback_; |
| 108 bool inited_; | 123 bool inited_; |
| 109 vpx_codec_ctx_t* decoder_; | 124 vpx_codec_ctx_t* decoder_; |
| 110 VideoCodec codec_; | 125 VideoCodec codec_; |
| 111 bool key_frame_required_; | 126 bool key_frame_required_; |
| 112 }; | 127 }; |
| 113 } // namespace webrtc | 128 } // namespace webrtc |
| 114 | 129 |
| 115 #endif // WEBRTC_MODULES_VIDEO_CODING_CODECS_VP9_IMPL_H_ | 130 #endif // WEBRTC_MODULES_VIDEO_CODING_CODECS_VP9_IMPL_H_ |
| OLD | NEW |