niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. |
| 3 | * |
| 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 |
| 6 | * tree. An additional intellectual property rights grant can be found |
| 7 | * in the file PATENTS. All contributing project authors may |
| 8 | * be found in the AUTHORS file in the root of the source tree. |
| 9 | */ |
| 10 | |
| 11 | /* |
| 12 | * deflickering.h |
| 13 | */ |
| 14 | |
| 15 | #ifndef VPM_DEFLICKERING_H |
| 16 | #define VPM_DEFLICKERING_H |
| 17 | |
| 18 | #include "typedefs.h" |
| 19 | #include "video_processing.h" |
| 20 | |
| 21 | #include <cstring> // NULL |
| 22 | |
| 23 | namespace webrtc { |
| 24 | |
| 25 | class VPMDeflickering |
| 26 | { |
| 27 | public: |
| 28 | VPMDeflickering(); |
| 29 | ~VPMDeflickering(); |
| 30 | |
| 31 | WebRtc_Word32 ChangeUniqueId(WebRtc_Word32 id); |
| 32 | |
| 33 | void Reset(); |
| 34 | |
mikhal@webrtc.org | 9fedff7 | 2012-10-24 18:33:04 +0000 | [diff] [blame^] | 35 | WebRtc_Word32 ProcessFrame(I420VideoFrame* frame, |
mikhal@webrtc.org | 0e196e1 | 2012-10-19 15:43:31 +0000 | [diff] [blame] | 36 | VideoProcessingModule::FrameStats* stats); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 37 | private: |
| 38 | WebRtc_Word32 PreDetection(WebRtc_UWord32 timestamp, |
mikhal@webrtc.org | 0e196e1 | 2012-10-19 15:43:31 +0000 | [diff] [blame] | 39 | const VideoProcessingModule::FrameStats& stats); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 40 | |
| 41 | WebRtc_Word32 DetectFlicker(); |
| 42 | |
| 43 | enum { kMeanBufferLength = 32 }; |
| 44 | enum { kFrameHistorySize = 15 }; |
| 45 | enum { kNumProbs = 12 }; |
| 46 | enum { kNumQuants = kNumProbs + 2 }; |
| 47 | enum { kMaxOnlyLength = 5 }; |
| 48 | |
| 49 | WebRtc_Word32 _id; |
| 50 | |
| 51 | WebRtc_UWord32 _meanBufferLength; |
| 52 | WebRtc_UWord8 _detectionState; // 0: No flickering |
| 53 | // 1: Flickering detected |
| 54 | // 2: In flickering |
| 55 | WebRtc_Word32 _meanBuffer[kMeanBufferLength]; |
| 56 | WebRtc_UWord32 _timestampBuffer[kMeanBufferLength]; |
| 57 | WebRtc_UWord32 _frameRate; |
| 58 | static const WebRtc_UWord16 _probUW16[kNumProbs]; |
| 59 | static const WebRtc_UWord16 _weightUW16[kNumQuants - kMaxOnlyLength]; |
| 60 | WebRtc_UWord8 _quantHistUW8[kFrameHistorySize][kNumQuants]; |
| 61 | }; |
| 62 | |
| 63 | } //namespace |
| 64 | |
| 65 | #endif // VPM_DEFLICKERING_H |
| 66 | |