| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2011 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 #ifndef WEBRTC_MODULES_VIDEO_PROCESSING_DEFLICKERING_H_ | 11 #ifndef WEBRTC_MODULES_VIDEO_PROCESSING_DEFLICKERING_H_ |
| 12 #define WEBRTC_MODULES_VIDEO_PROCESSING_DEFLICKERING_H_ | 12 #define WEBRTC_MODULES_VIDEO_PROCESSING_DEFLICKERING_H_ |
| 13 | 13 |
| 14 #include <string.h> // NULL | 14 #include <string.h> // NULL |
| 15 | 15 |
| 16 #include "webrtc/modules/video_processing/include/video_processing.h" | 16 #include "webrtc/modules/video_processing/include/video_processing.h" |
| 17 #include "webrtc/typedefs.h" | 17 #include "webrtc/typedefs.h" |
| 18 | 18 |
| 19 namespace webrtc { | 19 namespace webrtc { |
| 20 | 20 |
| 21 class VPMDeflickering { | 21 class VPMDeflickering { |
| 22 public: | 22 public: |
| 23 VPMDeflickering(); | 23 VPMDeflickering(); |
| 24 ~VPMDeflickering(); | 24 ~VPMDeflickering(); |
| 25 | 25 |
| 26 void Reset(); | 26 void Reset(); |
| 27 int32_t ProcessFrame(VideoFrame* frame, | 27 int32_t ProcessFrame(VideoFrame* frame, VideoProcessing::FrameStats* stats); |
| 28 VideoProcessingModule::FrameStats* stats); | |
| 29 | 28 |
| 30 private: | 29 private: |
| 31 int32_t PreDetection(uint32_t timestamp, | 30 int32_t PreDetection(uint32_t timestamp, |
| 32 const VideoProcessingModule::FrameStats& stats); | 31 const VideoProcessing::FrameStats& stats); |
| 33 | 32 |
| 34 int32_t DetectFlicker(); | 33 int32_t DetectFlicker(); |
| 35 | 34 |
| 36 enum { kMeanBufferLength = 32 }; | 35 enum { kMeanBufferLength = 32 }; |
| 37 enum { kFrameHistory_size = 15 }; | 36 enum { kFrameHistory_size = 15 }; |
| 38 enum { kNumProbs = 12 }; | 37 enum { kNumProbs = 12 }; |
| 39 enum { kNumQuants = kNumProbs + 2 }; | 38 enum { kNumQuants = kNumProbs + 2 }; |
| 40 enum { kMaxOnlyLength = 5 }; | 39 enum { kMaxOnlyLength = 5 }; |
| 41 | 40 |
| 42 uint32_t mean_buffer_length_; | 41 uint32_t mean_buffer_length_; |
| 43 uint8_t detection_state_; // 0: No flickering | 42 uint8_t detection_state_; // 0: No flickering |
| 44 // 1: Flickering detected | 43 // 1: Flickering detected |
| 45 // 2: In flickering | 44 // 2: In flickering |
| 46 int32_t mean_buffer_[kMeanBufferLength]; | 45 int32_t mean_buffer_[kMeanBufferLength]; |
| 47 uint32_t timestamp_buffer_[kMeanBufferLength]; | 46 uint32_t timestamp_buffer_[kMeanBufferLength]; |
| 48 uint32_t frame_rate_; | 47 uint32_t frame_rate_; |
| 49 static const uint16_t prob_uw16_[kNumProbs]; | 48 static const uint16_t prob_uw16_[kNumProbs]; |
| 50 static const uint16_t weight_uw16_[kNumQuants - kMaxOnlyLength]; | 49 static const uint16_t weight_uw16_[kNumQuants - kMaxOnlyLength]; |
| 51 uint8_t quant_hist_uw8_[kFrameHistory_size][kNumQuants]; | 50 uint8_t quant_hist_uw8_[kFrameHistory_size][kNumQuants]; |
| 52 }; | 51 }; |
| 53 | 52 |
| 54 } // namespace webrtc | 53 } // namespace webrtc |
| 55 | 54 |
| 56 #endif // WEBRTC_MODULES_VIDEO_PROCESSING_DEFLICKERING_H_ | 55 #endif // WEBRTC_MODULES_VIDEO_PROCESSING_DEFLICKERING_H_ |
| OLD | NEW |