| # Copyright 2014 The Chromium Authors. All rights reserved. |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| |
| import("//build/config/arm.gni") |
| |
| config("libwebp_config") { |
| include_dirs = [ "." ] |
| } |
| |
| use_dsp_neon = (cpu_arch == "arm64" || |
| (cpu_arch == "arm" && arm_version >= 7 && |
| (arm_use_neon || arm_optionally_use_neon))) |
| |
| source_set("libwebp_dec") { |
| sources = [ |
| "dec/alpha.c", |
| "dec/buffer.c", |
| "dec/frame.c", |
| "dec/idec.c", |
| "dec/io.c", |
| "dec/quant.c", |
| "dec/tree.c", |
| "dec/vp8.c", |
| "dec/vp8l.c", |
| "dec/webp.c", |
| ] |
| |
| configs -= [ "//build/config/compiler:chromium_code" ] |
| configs += [ "//build/config/compiler:no_chromium_code" ] |
| |
| deps = [ |
| ":libwebp_dsp", |
| ":libwebp_utils", |
| ] |
| all_dependent_configs = [ |
| ":libwebp_config" |
| ] |
| if (use_dsp_neon) { |
| deps += [ ":libwebp_dsp_neon"] |
| } |
| } |
| |
| source_set("libwebp_demux") { |
| sources = [ |
| "demux/demux.c", |
| ] |
| all_dependent_configs = [ |
| ":libwebp_config" |
| ] |
| configs -= [ "//build/config/compiler:chromium_code" ] |
| configs += [ "//build/config/compiler:no_chromium_code" ] |
| } |
| |
| |
| source_set("libwebp_dsp") { |
| sources = [ |
| "dsp/alpha_processing.c", |
| "dsp/cpu.c", |
| "dsp/dec.c", |
| "dsp/dec_clip_tables.c", |
| "dsp/dec_mips32.c", |
| "dsp/dec_sse2.c", |
| "dsp/enc.c", |
| "dsp/enc_avx2.c", |
| "dsp/enc_mips32.c", |
| "dsp/enc_sse2.c", |
| "dsp/lossless.c", |
| "dsp/lossless_mips32.c", |
| "dsp/lossless_sse2.c", |
| "dsp/upsampling.c", |
| "dsp/upsampling_sse2.c", |
| "dsp/yuv.c", |
| "dsp/yuv_mips32.c", |
| "dsp/yuv_sse2.c", |
| ] |
| configs -= [ "//build/config/compiler:chromium_code" ] |
| configs += [ "//build/config/compiler:no_chromium_code" ] |
| |
| all_dependent_configs = [ |
| ":libwebp_config" |
| ] |
| deps = [] |
| if (is_android) { |
| deps += [ "//third_party/android_tools:cpu_features" ] |
| } |
| # TODO(GYP): |
| # 'conditions': [ |
| # ['order_profiling != 0', { |
| # 'target_conditions' : [ |
| # ['_toolset=="target"', { |
| # 'cflags!': [ '-finstrument-functions' ], |
| # }], |
| # ], |
| # }], |
| # ], |
| } |
| |
| if (use_dsp_neon) { |
| |
| source_set("libwebp_dsp_neon") { |
| sources = [ |
| "dsp/dec_neon.c", |
| "dsp/enc_neon.c", |
| "dsp/lossless_neon.c", |
| "dsp/upsampling_neon.c", |
| ] |
| |
| include_dirs = [ "." ] |
| |
| if (cpu_arch == "arm") { |
| # behavior similar to *.c.neon in an Android.mk |
| configs -= [ "//build/config/compiler:compiler_arm_fpu" ] |
| cflags = [ "-mfpu=neon" ] |
| } else if (cpu_arch == "arm64") { |
| # avoid an ICE with gcc-4.9: b/15574841 |
| cflags = [ "-frename-registers" ] |
| } |
| |
| # TODO(GYP): |
| # ['order_profiling != 0', { |
| # 'target_conditions' : [ |
| # ['_toolset=="target"', { |
| # 'cflags!': [ '-finstrument-functions' ], |
| # }], |
| # ], |
| # }], |
| # ], |
| # } |
| } |
| |
| } # use_dsp_neon |
| |
| source_set("libwebp_enc") { |
| sources = [ |
| "enc/alpha.c", |
| "enc/analysis.c", |
| "enc/backward_references.c", |
| "enc/config.c", |
| "enc/cost.c", |
| "enc/filter.c", |
| "enc/frame.c", |
| "enc/histogram.c", |
| "enc/iterator.c", |
| "enc/picture.c", |
| "enc/picture_csp.c", |
| "enc/picture_psnr.c", |
| "enc/picture_rescale.c", |
| "enc/picture_tools.c", |
| "enc/quant.c", |
| "enc/syntax.c", |
| "enc/token.c", |
| "enc/tree.c", |
| "enc/vp8l.c", |
| "enc/webpenc.c", |
| ] |
| configs -= [ "//build/config/compiler:chromium_code" ] |
| configs += [ "//build/config/compiler:no_chromium_code" ] |
| |
| all_dependent_configs = [ |
| ":libwebp_config" |
| ] |
| } |
| |
| source_set("libwebp_utils") { |
| sources = [ |
| "utils/bit_reader.c", |
| "utils/bit_writer.c", |
| "utils/color_cache.c", |
| "utils/filters.c", |
| "utils/huffman.c", |
| "utils/huffman_encode.c", |
| "utils/quant_levels.c", |
| "utils/quant_levels_dec.c", |
| "utils/random.c", |
| "utils/rescaler.c", |
| "utils/thread.c", |
| "utils/utils.c", |
| ] |
| configs -= [ "//build/config/compiler:chromium_code" ] |
| configs += [ "//build/config/compiler:no_chromium_code" ] |
| |
| all_dependent_configs = [ |
| ":libwebp_config" |
| ] |
| } |
| |
| group("libwebp") { |
| deps = [ |
| ":libwebp_dec", |
| ":libwebp_demux", |
| ":libwebp_dsp", |
| ":libwebp_enc", |
| ":libwebp_utils", |
| ] |
| public_configs = [ |
| ":libwebp_config" |
| ] |
| if (use_dsp_neon) { |
| deps += [ ":libwebp_dsp_neon" ] |
| } |
| } |