• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #include "image_system_properties.h"
17 
18 #if !defined(IOS_PLATFORM) &&!defined(A_PLATFORM)
19 #include <string>
20 
21 #include <parameter.h>
22 #include <parameters.h>
23 #endif
24 
25 extern "C" {
26 extern char* __progname;
27 }
28 namespace OHOS {
29 namespace Media {
GetSkiaEnabled()30 bool ImageSystemProperties::GetSkiaEnabled()
31 {
32 #if !defined(IOS_PLATFORM) &&!defined(A_PLATFORM)
33     return system::GetBoolParameter("persist.multimedia.image.skdecode.enabled", true);
34 #else
35     return true;
36 #endif
37 }
38 
39 // surfacebuffer tmp switch, only used for test
GetSurfaceBufferEnabled()40 bool ImageSystemProperties::GetSurfaceBufferEnabled()
41 {
42 #if !defined(IOS_PLATFORM) &&!defined(A_PLATFORM)
43     return system::GetBoolParameter("persist.multimedia.image.surfacebuffer.enabled", false);
44 #else
45     return false;
46 #endif
47 }
48 
GetDmaEnabled()49 bool ImageSystemProperties::GetDmaEnabled()
50 {
51 #if !defined(IOS_PLATFORM) &&!defined(A_PLATFORM)
52     static bool isPhone = system::GetParameter("const.product.devicetype", "pc") == "phone";
53     return system::GetBoolParameter("persist.multimedia.image.dma.enabled", true) && isPhone;
54 #else
55     return false;
56 #endif
57 }
58 
GetAntiAliasingEnabled()59 bool ImageSystemProperties::GetAntiAliasingEnabled()
60 {
61 #if !defined(IOS_PLATFORM) &&!defined(A_PLATFORM)
62     static bool isDeviceSupportsAA =
63         system::GetParameter("const.product.devicetype", "pc") == "pc" ||
64         system::GetParameter("const.product.devicetype", "pc") == "tablet";
65     return isDeviceSupportsAA && system::GetBoolParameter("persist.multimedia.image.AntiAliasing.enabled", true);
66 #else
67     return false;
68 #endif
69 }
70 
GetDumpImageEnabled()71 bool ImageSystemProperties::GetDumpImageEnabled()
72 {
73 #if !defined(IOS_PLATFORM) &&!defined(A_PLATFORM)
74     return system::GetBoolParameter("persist.multimedia.image.dumpimage.enabled", false);
75 #else
76     return false;
77 #endif
78 }
79 
GetHardWareDecodeEnabled()80 bool ImageSystemProperties::GetHardWareDecodeEnabled()
81 {
82 #if !defined(IOS_PLATFORM) &&!defined(A_PLATFORM)
83     return system::GetBoolParameter("persist.multimedia.image.hardwaredecode.enabled", false);
84 #else
85     return false;
86 #endif
87 }
88 
GetAstcHardWareEncodeEnabled()89 bool ImageSystemProperties::GetAstcHardWareEncodeEnabled()
90 {
91 #if !defined(IOS_PLATFORM) &&!defined(A_PLATFORM)
92     return system::GetBoolParameter("persist.multimedia.image.AstcHardWareEncode.enabled", false);
93 #else
94     return false;
95 #endif
96 }
97 
GetMediaLibraryAstcEnabled()98 bool ImageSystemProperties::GetMediaLibraryAstcEnabled()
99 {
100 #if !defined(IOS_PLATFORM) &&!defined(A_PLATFORM)
101     return system::GetBoolParameter("persist.multimedia.image.GenAstc.enabled", true);
102 #else
103     return false;
104 #endif
105 }
106 } // namespace Media
107 } // namespace OHOS
108