Skip to content

Commit

Permalink
Revert the libjpeg-turbo update and roll back to 2.1.5.1 (#115)
Browse files Browse the repository at this point in the history
* Revert "Update libjpeg-turbo to 3.0.0 (#105)"

This reverts commit 7cdb539.

* Update libjpeg-turbo to 2.1.5.1
  • Loading branch information
mattleibow authored Jan 10, 2024
1 parent 83c17a6 commit 9124c2d
Show file tree
Hide file tree
Showing 6 changed files with 91 additions and 390 deletions.
2 changes: 1 addition & 1 deletion DEPS
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ deps = {
"third_party/externals/imgui" : "https://skia.googlesource.com/external/github.com/ocornut/imgui.git@55d35d8387c15bf0cfd71861df67af8cfbda7456",
"third_party/externals/libavif" : "https://github.com/AOMediaCodec/libavif.git@f49462dc93784bf34148715eee36ab6697ca0b35",
"third_party/externals/libgav1" : "https://chromium.googlesource.com/codecs/libgav1.git@0fb779c1e169fe6c229cd1fa9cc6ea6feeb441da",
"third_party/externals/libjpeg-turbo" : "https://github.com/libjpeg-turbo/libjpeg-turbo.git@6c87537f60941f3c265c339fe60d1e31d2a42ccf",
"third_party/externals/libjpeg-turbo" : "https://chromium.googlesource.com/chromium/deps/libjpeg_turbo.git@9b894306ec3b28cea46e84c32b56773a98c483da",
"third_party/externals/libjxl" : "https://chromium.googlesource.com/external/gitlab.com/wg1/jpeg-xl.git@a205468bc5d3a353fb15dae2398a101dff52f2d3",
"third_party/externals/libpng" : "https://skia.googlesource.com/third_party/libpng.git@f135775ad4e5d4408d2e12ffcc71bb36e6b48551",
"third_party/externals/libwebp" : "https://github.com/webmproject/libwebp.git@ca332209cb5567c9b249c86788cb2dbf8847e760",
Expand Down
229 changes: 90 additions & 139 deletions third_party/libjpeg-turbo/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -14,155 +14,106 @@ if (skia_use_system_libjpeg_turbo) {
libs = [ "jpeg" ]
}
} else {
use_simd_optimizations = false
if (!is_win && (current_cpu == "arm" || current_cpu == "arm64")) {
use_simd_optimizations = true
}

libjpeg_include_dirs = [
".",
"../externals/libjpeg-turbo",
]
libjpeg16_sources = [
"../externals/libjpeg-turbo/jcapistd.c",
"../externals/libjpeg-turbo/jccolor.c",
"../externals/libjpeg-turbo/jcdiffct.c",
"../externals/libjpeg-turbo/jclossls.c",
"../externals/libjpeg-turbo/jcmainct.c",
"../externals/libjpeg-turbo/jcprepct.c",
"../externals/libjpeg-turbo/jcsample.c",
"../externals/libjpeg-turbo/jdapistd.c",
"../externals/libjpeg-turbo/jdcolor.c",
"../externals/libjpeg-turbo/jddiffct.c",
"../externals/libjpeg-turbo/jdlossls.c",
"../externals/libjpeg-turbo/jdmainct.c",
"../externals/libjpeg-turbo/jdpostct.c",
"../externals/libjpeg-turbo/jdsample.c",
"../externals/libjpeg-turbo/jutils.c",
]
libjpeg12_sources = [
"../externals/libjpeg-turbo/jccoefct.c",
"../externals/libjpeg-turbo/jcdctmgr.c",
"../externals/libjpeg-turbo/jdcoefct.c",
"../externals/libjpeg-turbo/jddctmgr.c",
"../externals/libjpeg-turbo/jdmerge.c",
"../externals/libjpeg-turbo/jfdctfst.c",
"../externals/libjpeg-turbo/jfdctint.c",
"../externals/libjpeg-turbo/jidctflt.c",
"../externals/libjpeg-turbo/jidctfst.c",
"../externals/libjpeg-turbo/jidctint.c",
"../externals/libjpeg-turbo/jidctred.c",
"../externals/libjpeg-turbo/jquant1.c",
"../externals/libjpeg-turbo/jquant2.c",
]
libjpeg_sources = [
"../externals/libjpeg-turbo/jcapimin.c",
"../externals/libjpeg-turbo/jchuff.c",
"../externals/libjpeg-turbo/jcicc.c",
"../externals/libjpeg-turbo/jcinit.c",
"../externals/libjpeg-turbo/jclhuff.c",
"../externals/libjpeg-turbo/jcmarker.c",
"../externals/libjpeg-turbo/jcmaster.c",
"../externals/libjpeg-turbo/jcomapi.c",
"../externals/libjpeg-turbo/jcparam.c",
"../externals/libjpeg-turbo/jcphuff.c",
"../externals/libjpeg-turbo/jctrans.c",
"../externals/libjpeg-turbo/jdapimin.c",
"../externals/libjpeg-turbo/jdatadst.c",
"../externals/libjpeg-turbo/jdatasrc.c",
"../externals/libjpeg-turbo/jdhuff.c",
"../externals/libjpeg-turbo/jdicc.c",
"../externals/libjpeg-turbo/jdinput.c",
"../externals/libjpeg-turbo/jdlhuff.c",
"../externals/libjpeg-turbo/jdmarker.c",
"../externals/libjpeg-turbo/jdmaster.c",
"../externals/libjpeg-turbo/jdphuff.c",
"../externals/libjpeg-turbo/jdtrans.c",
"../externals/libjpeg-turbo/jerror.c",
"../externals/libjpeg-turbo/jfdctflt.c",
"../externals/libjpeg-turbo/jmemmgr.c",
"../externals/libjpeg-turbo/jmemnobs.c",
"../externals/libjpeg-turbo/jaricom.c", # WITH_ARITH_ENC or WITH_ARITH_DEC
"../externals/libjpeg-turbo/jcarith.c", # WITH_ARITH_ENC
"../externals/libjpeg-turbo/jdarith.c", # WITH_ARITH_DEC
]

source_set("libjpeg16") {
visibility = [ ":*" ]
defines = [ "BITS_IN_JSAMPLE=16" ]
if (!use_simd_optimizations) {
defines += [ "CPU_NO_SIMD" ]
}
include_dirs = libjpeg_include_dirs
sources = libjpeg16_sources
}
third_party("libjpeg") {
public_include_dirs = [
".",
"../externals/libjpeg-turbo",
]

source_set("libjpeg12") {
visibility = [ ":*" ]
defines = [ "BITS_IN_JSAMPLE=12" ]
if (!use_simd_optimizations) {
defines += [ "CPU_NO_SIMD" ]
}
include_dirs = libjpeg_include_dirs
sources = libjpeg16_sources + libjpeg12_sources
}
defines = [
"TURBO_FOR_WINDOWS",

source_set("libjpegsimd") {
visibility = [ ":*" ]
defines = [ "NEON_INTRINSICS" ]
include_dirs = libjpeg_include_dirs
include_dirs += [
"../externals/libjpeg-turbo/simd/arm",
# Add support for arithmetic encoding (C_) and decoding (D_).
# This matches Android. Note that such JPEGs are likely rare, given lack of
# support by major browsers.
"C_ARITH_CODING_SUPPORTED=1",
"D_ARITH_CODING_SUPPORTED=1",
]
sources = [
"../externals/libjpeg-turbo/simd/arm/jccolor-neon.c",
"../externals/libjpeg-turbo/simd/arm/jcgray-neon.c",
"../externals/libjpeg-turbo/simd/arm/jcphuff-neon.c",
"../externals/libjpeg-turbo/simd/arm/jcsample-neon.c",
"../externals/libjpeg-turbo/simd/arm/jdcolor-neon.c",
"../externals/libjpeg-turbo/simd/arm/jdmerge-neon.c",
"../externals/libjpeg-turbo/simd/arm/jdsample-neon.c",
"../externals/libjpeg-turbo/simd/arm/jfdctfst-neon.c",
"../externals/libjpeg-turbo/simd/arm/jfdctint-neon.c",
"../externals/libjpeg-turbo/simd/arm/jidctfst-neon.c",
"../externals/libjpeg-turbo/simd/arm/jidctint-neon.c",
"../externals/libjpeg-turbo/simd/arm/jidctred-neon.c",
"../externals/libjpeg-turbo/simd/arm/jquanti-neon.c",
]
if (current_cpu == "arm") {
sources += [
"../externals/libjpeg-turbo/simd/arm/aarch32/jchuff-neon.c",
"../externals/libjpeg-turbo/simd/arm/aarch32/jsimd.c",
]
} else if (current_cpu == "arm64") {
sources += [
"../externals/libjpeg-turbo/simd/arm/aarch64/jchuff-neon.c",
"../externals/libjpeg-turbo/simd/arm/aarch64/jsimd.c",
]
}
}

third_party("libjpeg") {
public_include_dirs = libjpeg_include_dirs

defines = []
if (!is_win || is_clang) {
defines += [ "USE_CLZ_INTRINSIC" ] # Cuts a 64K table.
}
if (!use_simd_optimizations) {
defines += [ "CPU_NO_SIMD" ]
}

sources = libjpeg16_sources + libjpeg12_sources + libjpeg_sources

deps = [
":libjpeg16",
":libjpeg12",
sources = [
"../externals/libjpeg-turbo/jaricom.c",
"../externals/libjpeg-turbo/jcapimin.c",
"../externals/libjpeg-turbo/jcapistd.c",
"../externals/libjpeg-turbo/jcarith.c",
"../externals/libjpeg-turbo/jccoefct.c",
"../externals/libjpeg-turbo/jccolor.c",
"../externals/libjpeg-turbo/jcdctmgr.c",
"../externals/libjpeg-turbo/jchuff.c",
"../externals/libjpeg-turbo/jcinit.c",
"../externals/libjpeg-turbo/jcmainct.c",
"../externals/libjpeg-turbo/jcmarker.c",
"../externals/libjpeg-turbo/jcmaster.c",
"../externals/libjpeg-turbo/jcomapi.c",
"../externals/libjpeg-turbo/jcparam.c",
"../externals/libjpeg-turbo/jcphuff.c",
"../externals/libjpeg-turbo/jcprepct.c",
"../externals/libjpeg-turbo/jcsample.c",
"../externals/libjpeg-turbo/jdapimin.c",
"../externals/libjpeg-turbo/jdapistd.c",
"../externals/libjpeg-turbo/jdarith.c",
"../externals/libjpeg-turbo/jdcoefct.c",
"../externals/libjpeg-turbo/jdcolor.c",
"../externals/libjpeg-turbo/jddctmgr.c",
"../externals/libjpeg-turbo/jdhuff.c",
"../externals/libjpeg-turbo/jdinput.c",
"../externals/libjpeg-turbo/jdmainct.c",
"../externals/libjpeg-turbo/jdmarker.c",
"../externals/libjpeg-turbo/jdmaster.c",
"../externals/libjpeg-turbo/jdmerge.c",
"../externals/libjpeg-turbo/jdphuff.c",
"../externals/libjpeg-turbo/jdpostct.c",
"../externals/libjpeg-turbo/jdsample.c",
"../externals/libjpeg-turbo/jerror.c",
"../externals/libjpeg-turbo/jfdctflt.c",
"../externals/libjpeg-turbo/jfdctfst.c",
"../externals/libjpeg-turbo/jfdctint.c",
"../externals/libjpeg-turbo/jidctflt.c",
"../externals/libjpeg-turbo/jidctfst.c",
"../externals/libjpeg-turbo/jidctint.c",
"../externals/libjpeg-turbo/jidctred.c",
"../externals/libjpeg-turbo/jmemmgr.c",
"../externals/libjpeg-turbo/jmemnobs.c",
"../externals/libjpeg-turbo/jpeg_nbits_table.c",
"../externals/libjpeg-turbo/jquant1.c",
"../externals/libjpeg-turbo/jquant2.c",
"../externals/libjpeg-turbo/jutils.c",
]
if (use_simd_optimizations) {
deps += [
":libjpegsimd",

if (!is_win && (current_cpu == "arm" || current_cpu == "arm64")) {
defines += [ "NEON_INTRINSICS" ]
sources += [
"../externals/libjpeg-turbo/simd/arm/jccolor-neon.c",
"../externals/libjpeg-turbo/simd/arm/jcgray-neon.c",
"../externals/libjpeg-turbo/simd/arm/jcphuff-neon.c",
"../externals/libjpeg-turbo/simd/arm/jcsample-neon.c",
"../externals/libjpeg-turbo/simd/arm/jdcolor-neon.c",
"../externals/libjpeg-turbo/simd/arm/jdmerge-neon.c",
"../externals/libjpeg-turbo/simd/arm/jdsample-neon.c",
"../externals/libjpeg-turbo/simd/arm/jfdctfst-neon.c",
"../externals/libjpeg-turbo/simd/arm/jfdctint-neon.c",
"../externals/libjpeg-turbo/simd/arm/jidctfst-neon.c",
"../externals/libjpeg-turbo/simd/arm/jidctint-neon.c",
"../externals/libjpeg-turbo/simd/arm/jidctred-neon.c",
"../externals/libjpeg-turbo/simd/arm/jquanti-neon.c",
]
include_dirs = [ "../externals/libjpeg-turbo/simd/arm" ]
if (current_cpu == "arm") {
sources += [
"../externals/libjpeg-turbo/simd/arm/aarch32/jchuff-neon.c",
"../externals/libjpeg-turbo/simd/arm/aarch32/jsimd.c",
]
} else if (current_cpu == "arm64") {
sources += [
"../externals/libjpeg-turbo/simd/arm/aarch64/jchuff-neon.c",
"../externals/libjpeg-turbo/simd/arm/aarch64/jsimd.c",
]
}
} else {
sources += [ "../externals/libjpeg-turbo/jsimd_none.c" ]
}
}
}
62 changes: 0 additions & 62 deletions third_party/libjpeg-turbo/jconfig.h

This file was deleted.

Loading

0 comments on commit 9124c2d

Please sign in to comment.