| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 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 |
| (...skipping 1004 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1015 Release(); | 1015 Release(); |
| 1016 } | 1016 } |
| 1017 | 1017 |
| 1018 int VP8DecoderImpl::InitDecode(const VideoCodec* inst, int number_of_cores) { | 1018 int VP8DecoderImpl::InitDecode(const VideoCodec* inst, int number_of_cores) { |
| 1019 int ret_val = Release(); | 1019 int ret_val = Release(); |
| 1020 if (ret_val < 0) { | 1020 if (ret_val < 0) { |
| 1021 return ret_val; | 1021 return ret_val; |
| 1022 } | 1022 } |
| 1023 if (decoder_ == NULL) { | 1023 if (decoder_ == NULL) { |
| 1024 decoder_ = new vpx_codec_ctx_t; | 1024 decoder_ = new vpx_codec_ctx_t; |
| 1025 memset(decoder_, 0, sizeof(*decoder_)); |
| 1025 } | 1026 } |
| 1026 if (inst && inst->codecType == kVideoCodecVP8) { | 1027 if (inst && inst->codecType == kVideoCodecVP8) { |
| 1027 feedback_mode_ = inst->VP8().feedbackModeOn; | 1028 feedback_mode_ = inst->VP8().feedbackModeOn; |
| 1028 } | 1029 } |
| 1029 vpx_codec_dec_cfg_t cfg; | 1030 vpx_codec_dec_cfg_t cfg; |
| 1030 // Setting number of threads to a constant value (1) | 1031 // Setting number of threads to a constant value (1) |
| 1031 cfg.threads = 1; | 1032 cfg.threads = 1; |
| 1032 cfg.h = cfg.w = 0; // set after decode | 1033 cfg.h = cfg.w = 0; // set after decode |
| 1033 | 1034 |
| 1034 vpx_codec_flags_t flags = 0; | 1035 vpx_codec_flags_t flags = 0; |
| 1035 #if !defined(WEBRTC_ARCH_ARM) && !defined(WEBRTC_ARCH_ARM64) && \ | 1036 #if !defined(WEBRTC_ARCH_ARM) && !defined(WEBRTC_ARCH_ARM64) && \ |
| 1036 !defined(ANDROID) | 1037 !defined(ANDROID) |
| 1037 flags = VPX_CODEC_USE_POSTPROC; | 1038 flags = VPX_CODEC_USE_POSTPROC; |
| 1038 #endif | 1039 #endif |
| 1039 | 1040 |
| 1040 if (vpx_codec_dec_init(decoder_, vpx_codec_vp8_dx(), &cfg, flags)) { | 1041 if (vpx_codec_dec_init(decoder_, vpx_codec_vp8_dx(), &cfg, flags)) { |
| 1042 delete decoder_; |
| 1043 decoder_ = nullptr; |
| 1041 return WEBRTC_VIDEO_CODEC_MEMORY; | 1044 return WEBRTC_VIDEO_CODEC_MEMORY; |
| 1042 } | 1045 } |
| 1043 | 1046 |
| 1044 // Save VideoCodec instance for later; mainly for duplicating the decoder. | 1047 // Save VideoCodec instance for later; mainly for duplicating the decoder. |
| 1045 if (&codec_ != inst) | 1048 if (&codec_ != inst) |
| 1046 codec_ = *inst; | 1049 codec_ = *inst; |
| 1047 propagation_cnt_ = -1; | 1050 propagation_cnt_ = -1; |
| 1048 | 1051 |
| 1049 inited_ = true; | 1052 inited_ = true; |
| 1050 | 1053 |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1276 return -1; | 1279 return -1; |
| 1277 } | 1280 } |
| 1278 if (vpx_codec_control(copy->decoder_, VP8_SET_REFERENCE, ref_frame_) != | 1281 if (vpx_codec_control(copy->decoder_, VP8_SET_REFERENCE, ref_frame_) != |
| 1279 VPX_CODEC_OK) { | 1282 VPX_CODEC_OK) { |
| 1280 return -1; | 1283 return -1; |
| 1281 } | 1284 } |
| 1282 return 0; | 1285 return 0; |
| 1283 } | 1286 } |
| 1284 | 1287 |
| 1285 } // namespace webrtc | 1288 } // namespace webrtc |
| OLD | NEW |