• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2025 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 ROSEN_MODULE_RS_FRAME_BLUR_PREDICT_H
17 #define ROSEN_MODULE_RS_FRAME_BLUR_PREDICT_H
18 
19 #include <string>
20 
21 #include "pipeline/rs_render_node.h"
22 #include "variable_frame_rate/rs_variable_frame_rate.h"
23 
24 namespace OHOS {
25 namespace Rosen {
26 
27 class RsFrameBlurPredict {
28 public:
29     static RsFrameBlurPredict& GetInstance();
30     void AdjustCurrentFrameDrawLargeAreaBlurFrequencyPredictively();
31     void TakeEffectBlurScene(const EventInfo& eventInfo);
32     void UpdateCurrentFrameDrawLargeAreaBlurFrequencyPrecisely();
33     void PredictDrawLargeAreaBlur(RSRenderNode& node);
34 
35 private:
36     RsFrameBlurPredict();
37     ~RsFrameBlurPredict();
38     void GetCurrentFrameDrawLargeAreaBlurPredictively();
39     void GetCurrentFrameDrawLargeAreaBlurPrecisely();
40     void ResetPredictDrawLargeAreaBlur();
41 
42     const std::string RS_BLUR_PREDICT_INVALID = "0";
43     const std::string RS_BLUR_PREDICT_LONG = "1";
44     const std::string RS_BLUR_PREDICT_SHORT = "2";
45     std::atomic<bool> isValidBlurFrame_{false};
46     std::atomic<bool> predictBegin_{false};
47     std::pair<bool, bool> predictDrawLargeAreaBlur_ = {false, false};
48 };
49 } // namespace Rosen
50 } // namespace OHOS
51 #endif // ROSEN_MODULE_RS_FRAME_BLUR_PREDICT_H
52