| 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 #include "webrtc/modules/video_coding/codecs/vp9/vp9_impl.h" | 12 #include "webrtc/modules/video_coding/codecs/vp9/vp9_impl.h" |
| 13 | 13 |
| 14 #include <stdlib.h> | 14 #include <stdlib.h> |
| 15 #include <string.h> | 15 #include <string.h> |
| 16 #include <time.h> | 16 #include <time.h> |
| 17 #include <vector> | 17 #include <vector> |
| 18 | 18 |
| 19 #include "vpx/vpx_encoder.h" | 19 #include "vpx/vpx_encoder.h" |
| 20 #include "vpx/vpx_decoder.h" | 20 #include "vpx/vpx_decoder.h" |
| 21 #include "vpx/vp8cx.h" | 21 #include "vpx/vp8cx.h" |
| 22 #include "vpx/vp8dx.h" | 22 #include "vpx/vp8dx.h" |
| 23 | 23 |
| 24 #include "webrtc/base/checks.h" | 24 #include "webrtc/base/checks.h" |
| 25 #include "webrtc/base/timeutils.h" |
| 25 #include "webrtc/base/keep_ref_until_done.h" | 26 #include "webrtc/base/keep_ref_until_done.h" |
| 26 #include "webrtc/base/logging.h" | 27 #include "webrtc/base/logging.h" |
| 27 #include "webrtc/base/trace_event.h" | 28 #include "webrtc/base/trace_event.h" |
| 28 #include "webrtc/common_video/libyuv/include/webrtc_libyuv.h" | 29 #include "webrtc/common_video/libyuv/include/webrtc_libyuv.h" |
| 29 #include "webrtc/modules/include/module_common_types.h" | 30 #include "webrtc/modules/include/module_common_types.h" |
| 30 #include "webrtc/modules/video_coding/codecs/vp9/screenshare_layers.h" | 31 #include "webrtc/modules/video_coding/codecs/vp9/screenshare_layers.h" |
| 31 #include "webrtc/system_wrappers/include/tick_util.h" | |
| 32 | 32 |
| 33 namespace webrtc { | 33 namespace webrtc { |
| 34 | 34 |
| 35 // Only positive speeds, range for real-time coding currently is: 5 - 8. | 35 // Only positive speeds, range for real-time coding currently is: 5 - 8. |
| 36 // Lower means slower/better quality, higher means fastest/lower quality. | 36 // Lower means slower/better quality, higher means fastest/lower quality. |
| 37 int GetCpuSpeed(int width, int height) { | 37 int GetCpuSpeed(int width, int height) { |
| 38 #if defined(WEBRTC_ARCH_ARM) || defined(WEBRTC_ARCH_ARM64) || defined(ANDROID) | 38 #if defined(WEBRTC_ARCH_ARM) || defined(WEBRTC_ARCH_ARM64) || defined(ANDROID) |
| 39 return 8; | 39 return 8; |
| 40 #else | 40 #else |
| 41 // For smaller resolutions, use lower speed setting (get some coding gain at | 41 // For smaller resolutions, use lower speed setting (get some coding gain at |
| (...skipping 28 matching lines...) Expand all Loading... |
| 70 raw_(NULL), | 70 raw_(NULL), |
| 71 input_image_(NULL), | 71 input_image_(NULL), |
| 72 tl0_pic_idx_(0), | 72 tl0_pic_idx_(0), |
| 73 frames_since_kf_(0), | 73 frames_since_kf_(0), |
| 74 num_temporal_layers_(0), | 74 num_temporal_layers_(0), |
| 75 num_spatial_layers_(0), | 75 num_spatial_layers_(0), |
| 76 frames_encoded_(0), | 76 frames_encoded_(0), |
| 77 // Use two spatial when screensharing with flexible mode. | 77 // Use two spatial when screensharing with flexible mode. |
| 78 spatial_layer_(new ScreenshareLayersVP9(2)) { | 78 spatial_layer_(new ScreenshareLayersVP9(2)) { |
| 79 memset(&codec_, 0, sizeof(codec_)); | 79 memset(&codec_, 0, sizeof(codec_)); |
| 80 uint32_t seed = static_cast<uint32_t>(TickTime::MillisecondTimestamp()); | 80 uint32_t seed = rtc::Time32(); |
| 81 srand(seed); | 81 srand(seed); |
| 82 } | 82 } |
| 83 | 83 |
| 84 VP9EncoderImpl::~VP9EncoderImpl() { | 84 VP9EncoderImpl::~VP9EncoderImpl() { |
| 85 Release(); | 85 Release(); |
| 86 } | 86 } |
| 87 | 87 |
| 88 int VP9EncoderImpl::Release() { | 88 int VP9EncoderImpl::Release() { |
| 89 if (encoded_image_._buffer != NULL) { | 89 if (encoded_image_._buffer != NULL) { |
| 90 delete[] encoded_image_._buffer; | 90 delete[] encoded_image_._buffer; |
| (...skipping 889 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 980 frame_buffer_pool_.ClearPool(); | 980 frame_buffer_pool_.ClearPool(); |
| 981 inited_ = false; | 981 inited_ = false; |
| 982 return WEBRTC_VIDEO_CODEC_OK; | 982 return WEBRTC_VIDEO_CODEC_OK; |
| 983 } | 983 } |
| 984 | 984 |
| 985 const char* VP9DecoderImpl::ImplementationName() const { | 985 const char* VP9DecoderImpl::ImplementationName() const { |
| 986 return "libvpx"; | 986 return "libvpx"; |
| 987 } | 987 } |
| 988 | 988 |
| 989 } // namespace webrtc | 989 } // namespace webrtc |
| OLD | NEW |