OLD | NEW |
1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 import("//build/config/arm.gni") | 5 import("//build/config/arm.gni") |
6 | 6 |
7 config("libwebp_config") { | 7 config("libwebp_config") { |
8 include_dirs = [ "." ] | 8 include_dirs = [ "." ] |
9 } | 9 } |
10 | 10 |
11 use_dsp_neon = (cpu_arch == "arm64" || | 11 use_dsp_neon = |
12 (cpu_arch == "arm" && arm_version >= 7 && | 12 cpu_arch == "arm64" || (cpu_arch == "arm" && arm_version >= 7 && |
13 (arm_use_neon || arm_optionally_use_neon))) | 13 (arm_use_neon || arm_optionally_use_neon)) |
14 | 14 |
15 source_set("libwebp_dec") { | 15 source_set("libwebp_dec") { |
16 sources = [ | 16 sources = [ |
17 "dec/alpha.c", | 17 "dec/alpha.c", |
18 "dec/buffer.c", | 18 "dec/buffer.c", |
19 "dec/frame.c", | 19 "dec/frame.c", |
20 "dec/idec.c", | 20 "dec/idec.c", |
21 "dec/io.c", | 21 "dec/io.c", |
22 "dec/quant.c", | 22 "dec/quant.c", |
23 "dec/tree.c", | 23 "dec/tree.c", |
24 "dec/vp8.c", | 24 "dec/vp8.c", |
25 "dec/vp8l.c", | 25 "dec/vp8l.c", |
26 "dec/webp.c", | 26 "dec/webp.c", |
27 ] | 27 ] |
28 | 28 |
29 configs -= [ "//build/config/compiler:chromium_code" ] | 29 configs -= [ "//build/config/compiler:chromium_code" ] |
30 configs += [ "//build/config/compiler:no_chromium_code" ] | 30 configs += [ "//build/config/compiler:no_chromium_code" ] |
31 | 31 |
32 deps = [ | 32 deps = [ |
33 ":libwebp_dsp", | 33 ":libwebp_dsp", |
34 ":libwebp_utils", | 34 ":libwebp_utils", |
35 ] | 35 ] |
36 all_dependent_configs = [ | 36 all_dependent_configs = [ ":libwebp_config" ] |
37 ":libwebp_config" | |
38 ] | |
39 if (use_dsp_neon) { | 37 if (use_dsp_neon) { |
40 deps += [ ":libwebp_dsp_neon"] | 38 deps += [ ":libwebp_dsp_neon" ] |
41 } | 39 } |
42 } | 40 } |
43 | 41 |
44 source_set("libwebp_demux") { | 42 source_set("libwebp_demux") { |
45 sources = [ | 43 sources = [ |
46 "demux/demux.c", | 44 "demux/demux.c", |
47 ] | 45 ] |
48 all_dependent_configs = [ | 46 all_dependent_configs = [ ":libwebp_config" ] |
49 ":libwebp_config" | |
50 ] | |
51 configs -= [ "//build/config/compiler:chromium_code" ] | 47 configs -= [ "//build/config/compiler:chromium_code" ] |
52 configs += [ "//build/config/compiler:no_chromium_code" ] | 48 configs += [ "//build/config/compiler:no_chromium_code" ] |
53 } | 49 } |
54 | 50 |
55 | |
56 source_set("libwebp_dsp") { | 51 source_set("libwebp_dsp") { |
57 sources = [ | 52 sources = [ |
58 "dsp/alpha_processing.c", | 53 "dsp/alpha_processing.c", |
59 "dsp/alpha_processing_sse2.c", | 54 "dsp/alpha_processing_sse2.c", |
60 "dsp/cpu.c", | 55 "dsp/cpu.c", |
61 "dsp/dec.c", | 56 "dsp/dec.c", |
62 "dsp/dec_clip_tables.c", | 57 "dsp/dec_clip_tables.c", |
63 "dsp/dec_mips32.c", | 58 "dsp/dec_mips32.c", |
64 "dsp/dec_sse2.c", | 59 "dsp/dec_sse2.c", |
65 "dsp/enc.c", | 60 "dsp/enc.c", |
66 "dsp/enc_avx2.c", | 61 "dsp/enc_avx2.c", |
67 "dsp/enc_mips32.c", | 62 "dsp/enc_mips32.c", |
68 "dsp/enc_sse2.c", | 63 "dsp/enc_sse2.c", |
69 "dsp/lossless.c", | 64 "dsp/lossless.c", |
70 "dsp/lossless_mips32.c", | 65 "dsp/lossless_mips32.c", |
71 "dsp/lossless_sse2.c", | 66 "dsp/lossless_sse2.c", |
72 "dsp/upsampling.c", | 67 "dsp/upsampling.c", |
73 "dsp/upsampling_sse2.c", | 68 "dsp/upsampling_sse2.c", |
74 "dsp/yuv.c", | 69 "dsp/yuv.c", |
75 "dsp/yuv_mips32.c", | 70 "dsp/yuv_mips32.c", |
76 "dsp/yuv_sse2.c", | 71 "dsp/yuv_sse2.c", |
77 ] | 72 ] |
78 configs -= [ "//build/config/compiler:chromium_code" ] | 73 configs -= [ "//build/config/compiler:chromium_code" ] |
79 configs += [ "//build/config/compiler:no_chromium_code" ] | 74 configs += [ "//build/config/compiler:no_chromium_code" ] |
80 | 75 |
81 all_dependent_configs = [ | 76 all_dependent_configs = [ ":libwebp_config" ] |
82 ":libwebp_config" | |
83 ] | |
84 deps = [] | 77 deps = [] |
85 if (is_android) { | 78 if (is_android) { |
86 deps += [ "//third_party/android_tools:cpu_features" ] | 79 deps += [ "//third_party/android_tools:cpu_features" ] |
87 } | 80 } |
88 # TODO(GYP): | 81 |
89 # 'conditions': [ | 82 # TODO(GYP): |
90 # ['order_profiling != 0', { | 83 # 'conditions': [ |
91 # 'target_conditions' : [ | 84 # ['order_profiling != 0', { |
92 # ['_toolset=="target"', { | 85 # 'target_conditions' : [ |
93 # 'cflags!': [ '-finstrument-functions' ], | 86 # ['_toolset=="target"', { |
94 # }], | 87 # 'cflags!': [ '-finstrument-functions' ], |
95 # ], | 88 # }], |
96 # }], | 89 # ], |
97 # ], | 90 # }], |
| 91 # ], |
98 } | 92 } |
99 | 93 |
100 if (use_dsp_neon) { | 94 if (use_dsp_neon) { |
| 95 source_set("libwebp_dsp_neon") { |
| 96 sources = [ |
| 97 "dsp/dec_neon.c", |
| 98 "dsp/enc_neon.c", |
| 99 "dsp/lossless_neon.c", |
| 100 "dsp/upsampling_neon.c", |
| 101 ] |
101 | 102 |
102 source_set("libwebp_dsp_neon") { | 103 include_dirs = [ "." ] |
103 sources = [ | |
104 "dsp/dec_neon.c", | |
105 "dsp/enc_neon.c", | |
106 "dsp/lossless_neon.c", | |
107 "dsp/upsampling_neon.c", | |
108 ] | |
109 | 104 |
110 include_dirs = [ "." ] | 105 if (cpu_arch == "arm") { |
| 106 # behavior similar to *.c.neon in an Android.mk |
| 107 configs -= [ "//build/config/compiler:compiler_arm_fpu" ] |
| 108 cflags = [ "-mfpu=neon" ] |
| 109 } else if (cpu_arch == "arm64") { |
| 110 # avoid an ICE with gcc-4.9: b/15574841 |
| 111 cflags = [ "-frename-registers" ] |
| 112 } |
111 | 113 |
112 if (cpu_arch == "arm") { | 114 # TODO(GYP): |
113 # behavior similar to *.c.neon in an Android.mk | 115 # ['order_profiling != 0', { |
114 configs -= [ "//build/config/compiler:compiler_arm_fpu" ] | 116 # 'target_conditions' : [ |
115 cflags = [ "-mfpu=neon" ] | 117 # ['_toolset=="target"', { |
116 } else if (cpu_arch == "arm64") { | 118 # 'cflags!': [ '-finstrument-functions' ], |
117 # avoid an ICE with gcc-4.9: b/15574841 | 119 # }], |
118 cflags = [ "-frename-registers" ] | 120 # ], |
| 121 # }], |
| 122 # ], |
| 123 # } |
119 } | 124 } |
120 | |
121 # TODO(GYP): | |
122 # ['order_profiling != 0', { | |
123 # 'target_conditions' : [ | |
124 # ['_toolset=="target"', { | |
125 # 'cflags!': [ '-finstrument-functions' ], | |
126 # }], | |
127 # ], | |
128 # }], | |
129 # ], | |
130 # } | |
131 } | |
132 | |
133 } # use_dsp_neon | 125 } # use_dsp_neon |
134 | 126 |
135 source_set("libwebp_enc") { | 127 source_set("libwebp_enc") { |
136 sources = [ | 128 sources = [ |
137 "enc/alpha.c", | 129 "enc/alpha.c", |
138 "enc/analysis.c", | 130 "enc/analysis.c", |
139 "enc/backward_references.c", | 131 "enc/backward_references.c", |
140 "enc/config.c", | 132 "enc/config.c", |
141 "enc/cost.c", | 133 "enc/cost.c", |
142 "enc/filter.c", | 134 "enc/filter.c", |
143 "enc/frame.c", | 135 "enc/frame.c", |
144 "enc/histogram.c", | 136 "enc/histogram.c", |
145 "enc/iterator.c", | 137 "enc/iterator.c", |
146 "enc/picture.c", | 138 "enc/picture.c", |
147 "enc/picture_csp.c", | 139 "enc/picture_csp.c", |
148 "enc/picture_psnr.c", | 140 "enc/picture_psnr.c", |
149 "enc/picture_rescale.c", | 141 "enc/picture_rescale.c", |
150 "enc/picture_tools.c", | 142 "enc/picture_tools.c", |
151 "enc/quant.c", | 143 "enc/quant.c", |
152 "enc/syntax.c", | 144 "enc/syntax.c", |
153 "enc/token.c", | 145 "enc/token.c", |
154 "enc/tree.c", | 146 "enc/tree.c", |
155 "enc/vp8l.c", | 147 "enc/vp8l.c", |
156 "enc/webpenc.c", | 148 "enc/webpenc.c", |
157 ] | 149 ] |
158 configs -= [ "//build/config/compiler:chromium_code" ] | 150 configs -= [ "//build/config/compiler:chromium_code" ] |
159 configs += [ "//build/config/compiler:no_chromium_code" ] | 151 configs += [ "//build/config/compiler:no_chromium_code" ] |
160 | 152 |
161 all_dependent_configs = [ | 153 all_dependent_configs = [ ":libwebp_config" ] |
162 ":libwebp_config" | |
163 ] | |
164 } | 154 } |
165 | 155 |
166 source_set("libwebp_utils") { | 156 source_set("libwebp_utils") { |
167 sources = [ | 157 sources = [ |
168 "utils/bit_reader.c", | 158 "utils/bit_reader.c", |
169 "utils/bit_writer.c", | 159 "utils/bit_writer.c", |
170 "utils/color_cache.c", | 160 "utils/color_cache.c", |
171 "utils/filters.c", | 161 "utils/filters.c", |
172 "utils/huffman.c", | 162 "utils/huffman.c", |
173 "utils/huffman_encode.c", | 163 "utils/huffman_encode.c", |
174 "utils/quant_levels.c", | 164 "utils/quant_levels.c", |
175 "utils/quant_levels_dec.c", | 165 "utils/quant_levels_dec.c", |
176 "utils/random.c", | 166 "utils/random.c", |
177 "utils/rescaler.c", | 167 "utils/rescaler.c", |
178 "utils/thread.c", | 168 "utils/thread.c", |
179 "utils/utils.c", | 169 "utils/utils.c", |
180 ] | 170 ] |
181 configs -= [ "//build/config/compiler:chromium_code" ] | 171 configs -= [ "//build/config/compiler:chromium_code" ] |
182 configs += [ "//build/config/compiler:no_chromium_code" ] | 172 configs += [ "//build/config/compiler:no_chromium_code" ] |
183 | 173 |
184 all_dependent_configs = [ | 174 all_dependent_configs = [ ":libwebp_config" ] |
185 ":libwebp_config" | |
186 ] | |
187 } | 175 } |
188 | 176 |
189 group("libwebp") { | 177 group("libwebp") { |
190 deps = [ | 178 deps = [ |
191 ":libwebp_dec", | 179 ":libwebp_dec", |
192 ":libwebp_demux", | 180 ":libwebp_demux", |
193 ":libwebp_dsp", | 181 ":libwebp_dsp", |
194 ":libwebp_enc", | 182 ":libwebp_enc", |
195 ":libwebp_utils", | 183 ":libwebp_utils", |
196 ] | 184 ] |
197 public_configs = [ | 185 public_configs = [ ":libwebp_config" ] |
198 ":libwebp_config" | |
199 ] | |
200 if (use_dsp_neon) { | 186 if (use_dsp_neon) { |
201 deps += [ ":libwebp_dsp_neon" ] | 187 deps += [ ":libwebp_dsp_neon" ] |
202 } | 188 } |
203 } | 189 } |
OLD | NEW |