skia2/gyp/codec.gyp

142 lines
4.3 KiB
Plaintext
Raw Normal View History

# Copyright 2015 Google Inc.
#
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# Copyright 2015 Google Inc.
#
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# GYP file for codec project.
{
'targets': [
{
'target_name': 'codec',
'product_name': 'skia_codec',
'type': 'static_library',
'standalone_static_library': 1,
'dependencies': [
'core.gyp:*',
'giflib.gyp:giflib',
'libjpeg-turbo-selector.gyp:libjpeg-turbo-selector',
'libpng.gyp:libpng',
'libwebp.gyp:libwebp',
],
'cflags':[
# FIXME: This gets around a warning: "Argument might be clobbered by longjmp".
'-Wno-clobbered -Wno-error',
],
'include_dirs': [
'../include/codec',
'../include/private',
'../src/codec',
'../src/core',
'../src/utils',
],
'sources': [
'../src/codec/SkAndroidCodec.cpp',
'../src/codec/SkBmpCodec.cpp',
'../src/codec/SkBmpMaskCodec.cpp',
'../src/codec/SkBmpRLECodec.cpp',
'../src/codec/SkBmpStandardCodec.cpp',
'../src/codec/SkCodec.cpp',
'../src/codec/SkGifCodec.cpp',
'../src/codec/SkIcoCodec.cpp',
'../src/codec/SkJpegCodec.cpp',
'../src/codec/SkJpegDecoderMgr.cpp',
'../src/codec/SkJpegUtility_codec.cpp',
'../src/codec/SkMaskSwizzler.cpp',
'../src/codec/SkMasks.cpp',
'../src/codec/SkPngCodec.cpp',
sketch hooking into PNG_FILTER_OPTIMIZATIONS Local timing says this 4-byte Paeth function takes about 0.3x the time the serial libpng code does, dropping from ~10 cycles per byte to ~2.9. bpp=4 is mainly an easy demo. This approach can work for any bpp up to 16, 1 pixel at a time, at roughly the same cost per pixel. Doing more than 1 pixel at a time is a tricky math problem I have yet to attempt to solve. Everything here can be trivially downgraded to MMX, supporting bpp up to 8. It seems to be a little slower (~3.5 cycles per byte), but it would make the code compatible with every x86 that can still power on. I've tried four approaches: - this way; - doing things naively in 16-bit; - a 16-bit version that requires division by 3 (i.e. mulhi_epu16(..., 0x5580) ); - a mostly 8-bit version of the same. They're all fine, but this one is consistently the fastest I've measured. I'd be happy to settle on the naive 16-bit version too, which would have a very clear implementation that's only minorly slower than this version. The other two are way more complicated, and would require us to draw some serious ASCII diagrams to explain. I have learned that the .skp serialization tests (serialize-8888) have a nice side effect of testing the correctness of these filters! (Since writing the description above, I've bumped things up to {Paeth,Sub,Avg} x { 3 bpp, 4 bpp }.) BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1573943002 Review URL: https://codereview.chromium.org/1573943002
2016-01-27 21:01:41 +00:00
'../src/codec/SkPngFilters.cpp',
'../src/codec/SkSampler.cpp',
'../src/codec/SkSampledCodec.cpp',
'../src/codec/SkSwizzler.cpp',
'../src/codec/SkWbmpCodec.cpp',
'../src/codec/SkWebpAdapterCodec.cpp',
'../src/codec/SkWebpCodec.cpp',
'../src/codec/SkCodecImageGenerator.cpp',
'../src/ports/SkImageGenerator_skia.cpp',
],
'direct_dependent_settings': {
'include_dirs': [
'../include/codec',
],
},
'defines': [
# Turn on all of the codecs, since we know that we have all of the
# necessary dependencies. Clients that are missing some of the
# required decoding libraries may choose to turn the codecs on or
# off individually.
'SK_CODEC_DECODES_GIF',
'SK_CODEC_DECODES_JPEG',
'SK_CODEC_DECODES_PNG',
'SK_CODEC_DECODES_WEBP',
# Turn on libjpeg-turbo optimizations since we know that the
# appropriate version of libjpeg-turbo is present.
'TURBO_HAS_SKIP',
'TURBO_HAS_565',
],
'conditions': [
['skia_codec_decodes_raw', {
'dependencies': [
'raw_codec',
],
},],
],
}, {
# RAW codec needs exceptions. Due to that, it is a separate target. Its usage can be
# controlled by skia_codec_decodes_raw flag.
'target_name': 'raw_codec',
'product_name': 'raw_codec',
'type': 'static_library',
'dependencies': [
'core.gyp:*',
'dng_sdk.gyp:dng_sdk-selector',
'libjpeg-turbo-selector.gyp:libjpeg-turbo-selector',
'piex.gyp:piex-selector',
],
'cflags':[
'-fexceptions',
],
'msvs_settings': {
'VCCLCompilerTool': {
# Need this because we are handling exception in SkRawCodec, which will trigger warning
# C4530. Add this flag as suggested by the compiler.
'AdditionalOptions': ['/EHsc', ],
},
},
'include_dirs': [
'../include/codec',
'../include/private',
'../src/codec',
'../src/core',
],
'sources': [
'../src/codec/SkRawAdapterCodec.cpp',
'../src/codec/SkRawCodec.cpp',
],
'direct_dependent_settings': {
'include_dirs': [
'../include/codec',
],
},
'conditions': [
['skia_arch_type == "x86" or skia_arch_type == "arm"', {
'defines': [
'qDNGBigEndian=0',
],
}],
['skia_os == "ios" or skia_os == "mac"', {
'xcode_settings': {
'OTHER_CFLAGS': ['-fexceptions'],
'OTHER_CPLUSPLUSFLAGS': ['-fexceptions'],
},
}],
],
},
],
}