1 /* 2 * Copyright (c) 2023 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef OHOS_DCAMERA_FEEDING_SMOOTHER_H 17 #define OHOS_DCAMERA_FEEDING_SMOOTHER_H 18 #include "ifeeding_smoother.h" 19 #include "dcamera_time_statistician.h" 20 21 namespace OHOS { 22 namespace DistributedHardware { 23 class DCameraFeedingSmoother : public IFeedingSmoother { 24 public: 25 virtual ~DCameraFeedingSmoother() override = default; 26 virtual void PrepareSmooth() override; 27 virtual void InitBaseline(const int64_t timeStampBaseline, const int64_t clockBaseline) override; 28 virtual void InitTimeStatistician() override; 29 virtual int32_t NotifySmoothFinished(const std::shared_ptr<IFeedableData>& data) override; 30 31 private: 32 constexpr static uint8_t DYNAMIC_BALANCE_THRE = 3; 33 constexpr static int32_t SMOOTH_BUFFER_TIME_US = 20000; 34 constexpr static uint32_t AVER_INTERVAL_DIFF_THRE_US = 2000; 35 constexpr static uint32_t FEED_ONCE_DIFF_THRE_US = 10000; 36 std::shared_ptr<DCameraTimeStatistician> dCameraStatistician_ = nullptr; 37 }; 38 } // namespace DistributedHardware 39 } // namespace OHOS 40 #endif // OHOS_DCAMERA_FEEDING_SMOOTHER_H