mtklein | 7d10b9f | 2016-07-27 11:17:18 -0700 | [diff] [blame] | 1 | # Copyright 2016 Google Inc. |
| 2 | # |
| 3 | # Use of this source code is governed by a BSD-style license that can be |
| 4 | # found in the LICENSE file. |
| 5 | |
| 6 | declare_args() { |
Mike Klein | e459afd | 2017-03-03 09:21:30 -0500 | [diff] [blame] | 7 | skia_use_system_libjpeg_turbo = is_official_build |
mtklein | 7d10b9f | 2016-07-27 11:17:18 -0700 | [diff] [blame] | 8 | } |
| 9 | |
| 10 | import("../third_party.gni") |
| 11 | |
Mike Klein | 10d665d | 2016-11-01 11:46:10 -0400 | [diff] [blame] | 12 | if (skia_use_system_libjpeg_turbo) { |
| 13 | system("libjpeg") { |
| 14 | libs = [ "jpeg" ] |
| 15 | } |
| 16 | } else { |
| 17 | third_party("libjpeg") { |
Leon Scroggins III | 4f498fc | 2017-12-06 16:21:01 -0500 | [diff] [blame] | 18 | public_include_dirs = [ |
| 19 | ".", |
| 20 | "../externals/libjpeg-turbo", |
| 21 | ] |
mtklein | 7d10b9f | 2016-07-27 11:17:18 -0700 | [diff] [blame] | 22 | |
Leon Scroggins III | 21706f1 | 2020-08-14 16:58:20 -0400 | [diff] [blame] | 23 | defines = [ |
| 24 | "TURBO_FOR_WINDOWS", |
| 25 | |
| 26 | # Add support for arithmetic encoding (C_) and decoding (D_). |
| 27 | # This matches Android. Note that such JPEGs are likely rare, given lack of |
| 28 | # support by major browsers. |
| 29 | "C_ARITH_CODING_SUPPORTED=1", |
| 30 | "D_ARITH_CODING_SUPPORTED=1", |
| 31 | ] |
| 32 | |
Mike Klein | d2da6a7 | 2020-01-02 11:39:40 -0600 | [diff] [blame] | 33 | if (!is_win || is_clang) { |
| 34 | defines += [ "USE_CLZ_INTRINSIC" ] # Cuts a 64K table. |
| 35 | } |
mtklein | 7a1f45f | 2016-08-04 06:19:33 -0700 | [diff] [blame] | 36 | |
Mike Klein | 10d665d | 2016-11-01 11:46:10 -0400 | [diff] [blame] | 37 | sources = [ |
Matt Sarett | 9119de6 | 2017-02-10 17:47:51 -0500 | [diff] [blame] | 38 | "../externals/libjpeg-turbo/jaricom.c", |
Mike Klein | 10d665d | 2016-11-01 11:46:10 -0400 | [diff] [blame] | 39 | "../externals/libjpeg-turbo/jcapimin.c", |
| 40 | "../externals/libjpeg-turbo/jcapistd.c", |
Matt Sarett | 9119de6 | 2017-02-10 17:47:51 -0500 | [diff] [blame] | 41 | "../externals/libjpeg-turbo/jcarith.c", |
Mike Klein | 10d665d | 2016-11-01 11:46:10 -0400 | [diff] [blame] | 42 | "../externals/libjpeg-turbo/jccoefct.c", |
| 43 | "../externals/libjpeg-turbo/jccolor.c", |
| 44 | "../externals/libjpeg-turbo/jcdctmgr.c", |
| 45 | "../externals/libjpeg-turbo/jchuff.c", |
| 46 | "../externals/libjpeg-turbo/jcinit.c", |
| 47 | "../externals/libjpeg-turbo/jcmainct.c", |
| 48 | "../externals/libjpeg-turbo/jcmarker.c", |
| 49 | "../externals/libjpeg-turbo/jcmaster.c", |
| 50 | "../externals/libjpeg-turbo/jcomapi.c", |
| 51 | "../externals/libjpeg-turbo/jcparam.c", |
| 52 | "../externals/libjpeg-turbo/jcphuff.c", |
| 53 | "../externals/libjpeg-turbo/jcprepct.c", |
| 54 | "../externals/libjpeg-turbo/jcsample.c", |
| 55 | "../externals/libjpeg-turbo/jdapimin.c", |
| 56 | "../externals/libjpeg-turbo/jdapistd.c", |
Matt Sarett | 9119de6 | 2017-02-10 17:47:51 -0500 | [diff] [blame] | 57 | "../externals/libjpeg-turbo/jdarith.c", |
Mike Klein | 10d665d | 2016-11-01 11:46:10 -0400 | [diff] [blame] | 58 | "../externals/libjpeg-turbo/jdcoefct.c", |
| 59 | "../externals/libjpeg-turbo/jdcolor.c", |
| 60 | "../externals/libjpeg-turbo/jddctmgr.c", |
| 61 | "../externals/libjpeg-turbo/jdhuff.c", |
| 62 | "../externals/libjpeg-turbo/jdinput.c", |
| 63 | "../externals/libjpeg-turbo/jdmainct.c", |
| 64 | "../externals/libjpeg-turbo/jdmarker.c", |
| 65 | "../externals/libjpeg-turbo/jdmaster.c", |
| 66 | "../externals/libjpeg-turbo/jdmerge.c", |
| 67 | "../externals/libjpeg-turbo/jdphuff.c", |
| 68 | "../externals/libjpeg-turbo/jdpostct.c", |
| 69 | "../externals/libjpeg-turbo/jdsample.c", |
| 70 | "../externals/libjpeg-turbo/jerror.c", |
| 71 | "../externals/libjpeg-turbo/jfdctflt.c", |
| 72 | "../externals/libjpeg-turbo/jfdctfst.c", |
| 73 | "../externals/libjpeg-turbo/jfdctint.c", |
| 74 | "../externals/libjpeg-turbo/jidctflt.c", |
| 75 | "../externals/libjpeg-turbo/jidctfst.c", |
| 76 | "../externals/libjpeg-turbo/jidctint.c", |
| 77 | "../externals/libjpeg-turbo/jidctred.c", |
| 78 | "../externals/libjpeg-turbo/jmemmgr.c", |
| 79 | "../externals/libjpeg-turbo/jmemnobs.c", |
Leon Scroggins III | 21706f1 | 2020-08-14 16:58:20 -0400 | [diff] [blame] | 80 | "../externals/libjpeg-turbo/jpeg_nbits_table.c", |
Mike Klein | 10d665d | 2016-11-01 11:46:10 -0400 | [diff] [blame] | 81 | "../externals/libjpeg-turbo/jquant1.c", |
| 82 | "../externals/libjpeg-turbo/jquant2.c", |
Mike Klein | 10d665d | 2016-11-01 11:46:10 -0400 | [diff] [blame] | 83 | "../externals/libjpeg-turbo/jutils.c", |
| 84 | ] |
Mike Klein | e7bd81d | 2016-11-13 08:52:07 -0500 | [diff] [blame] | 85 | |
Mike Klein | 07fea19 | 2021-02-02 11:34:22 -0600 | [diff] [blame] | 86 | if (current_cpu == "arm" && !is_win) { |
Mike Klein | e7bd81d | 2016-11-13 08:52:07 -0500 | [diff] [blame] | 87 | sources += [ |
Leon Scroggins III | 21706f1 | 2020-08-14 16:58:20 -0400 | [diff] [blame] | 88 | "../externals/libjpeg-turbo/simd/arm/arm/jsimd.c", |
| 89 | "../externals/libjpeg-turbo/simd/arm/arm/jsimd_neon.S", |
| 90 | "../externals/libjpeg-turbo/simd/arm/common/jcsample-neon.c", |
| 91 | "../externals/libjpeg-turbo/simd/arm/common/jdcolor-neon.c", |
| 92 | "../externals/libjpeg-turbo/simd/arm/common/jdmerge-neon.c", |
| 93 | "../externals/libjpeg-turbo/simd/arm/common/jdsample-neon.c", |
| 94 | "../externals/libjpeg-turbo/simd/arm/common/jidctfst-neon.c", |
| 95 | "../externals/libjpeg-turbo/simd/arm/common/jidctint-neon.c", |
| 96 | "../externals/libjpeg-turbo/simd/arm/common/jidctred-neon.c", |
Mike Klein | e7bd81d | 2016-11-13 08:52:07 -0500 | [diff] [blame] | 97 | ] |
Mike Klein | 07fea19 | 2021-02-02 11:34:22 -0600 | [diff] [blame] | 98 | } else if (current_cpu == "arm64" && !is_win) { |
Mike Klein | e7bd81d | 2016-11-13 08:52:07 -0500 | [diff] [blame] | 99 | sources += [ |
Leon Scroggins III | 21706f1 | 2020-08-14 16:58:20 -0400 | [diff] [blame] | 100 | "../externals/libjpeg-turbo/simd/arm/arm64/jsimd.c", |
| 101 | "../externals/libjpeg-turbo/simd/arm/arm64/jsimd_neon.S", |
| 102 | "../externals/libjpeg-turbo/simd/arm/common/jcsample-neon.c", |
| 103 | "../externals/libjpeg-turbo/simd/arm/common/jdcolor-neon.c", |
| 104 | "../externals/libjpeg-turbo/simd/arm/common/jdmerge-neon.c", |
| 105 | "../externals/libjpeg-turbo/simd/arm/common/jdsample-neon.c", |
| 106 | "../externals/libjpeg-turbo/simd/arm/common/jidctfst-neon.c", |
| 107 | "../externals/libjpeg-turbo/simd/arm/common/jidctint-neon.c", |
| 108 | "../externals/libjpeg-turbo/simd/arm/common/jidctred-neon.c", |
Mike Klein | e7bd81d | 2016-11-13 08:52:07 -0500 | [diff] [blame] | 109 | ] |
| 110 | } else { |
| 111 | sources += [ "../externals/libjpeg-turbo/jsimd_none.c" ] |
| 112 | } |
Mike Klein | 10d665d | 2016-11-01 11:46:10 -0400 | [diff] [blame] | 113 | } |
mtklein | 7d10b9f | 2016-07-27 11:17:18 -0700 | [diff] [blame] | 114 | } |