From 67ce3b2352fe1f7511edbfed74ec6960e41e97dc Mon Sep 17 00:00:00 2001 From: DRC Date: Mon, 19 Dec 2011 02:21:03 +0000 Subject: [PATCH] Added new alpha channel colorspace constants/pixel formats, so applications can specify that they need the unused byte in a 4-component RGB output buffer set to 0xFF when decompressing. git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/trunk@732 632fc199-4ca6-4c93-a231-07263d6284db --- ChangeLog.txt | 5 + README-turbo.txt | 18 ++- doc/html/annotated.html | 2 +- doc/html/classes.html | 2 +- doc/html/functions.html | 2 +- doc/html/functions_vars.html | 2 +- doc/html/group___turbo_j_p_e_g.html | 33 +++++- doc/html/index.html | 2 +- doc/html/modules.html | 2 +- doc/html/structtjregion.html | 2 +- doc/html/structtjscalingfactor.html | 2 +- doc/html/structtjtransform.html | 2 +- java/TJUnitTest.java | 16 ++- java/doc/allclasses-frame.html | 4 +- java/doc/allclasses-noframe.html | 4 +- java/doc/constant-values.html | 30 ++++- java/doc/deprecated-list.html | 4 +- java/doc/help-doc.html | 4 +- java/doc/index-all.html | 16 ++- java/doc/index.html | 2 +- java/doc/org/libjpegturbo/turbojpeg/TJ.html | 104 +++++++++++++++++- .../libjpegturbo/turbojpeg/TJCompressor.html | 4 +- .../turbojpeg/TJCustomFilter.html | 4 +- .../turbojpeg/TJDecompressor.html | 4 +- .../turbojpeg/TJScalingFactor.html | 4 +- .../libjpegturbo/turbojpeg/TJTransform.html | 4 +- .../libjpegturbo/turbojpeg/TJTransformer.html | 4 +- .../libjpegturbo/turbojpeg/package-frame.html | 4 +- .../turbojpeg/package-summary.html | 4 +- .../libjpegturbo/turbojpeg/package-tree.html | 4 +- java/doc/overview-tree.html | 4 +- java/doc/serialized-form.html | 4 +- java/org/libjpegturbo/turbojpeg/TJ.java | 46 ++++++-- .../turbojpeg/TJDecompressor.java | 9 +- java/org_libjpegturbo_turbojpeg_TJ.h | 10 +- jccolor.c | 28 ++++- jcparam.c | 6 +- jdcolor.c | 12 ++ jdmaster.c | 12 +- jdmerge.c | 8 ++ jmorecfg.h | 16 ++- jpeglib.h | 18 ++- simd/jsimd_arm.c | 8 ++ simd/jsimd_i386.c | 20 ++++ simd/jsimd_x86_64.c | 20 ++++ tjunittest.c | 10 +- turbojpeg.c | 18 ++- turbojpeg.h | 48 ++++++-- 48 files changed, 487 insertions(+), 104 deletions(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index 0776105..083a0a4 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -14,6 +14,11 @@ valgrind. See http://crbug.com/72399 for more information. [3] Added a compile-time macro (LIBJPEG_TURBO_VERSION) that can be used to check the version of libjpeg-turbo against which an application was compiled. +[4] Added new RGBA/BGRA/ABGR/ARGB colorspace extension constants (libjpeg API) +and pixel formats (TurboJPEG API), which allow applications to specify that, +when decompressing to a 4-component RGB buffer, the unused byte should be set +to 0xFF so that it can be interpreted as an opaque alpha channel. + 1.1.90 (1.2 beta1) ================== diff --git a/README-turbo.txt b/README-turbo.txt index b1ed218..8b18d4c 100755 --- a/README-turbo.txt +++ b/README-turbo.txt @@ -210,7 +210,7 @@ Colorspace Extensions libjpeg-turbo includes extensions that allow JPEG images to be compressed directly from (and decompressed directly to) buffers that use BGR, BGRX, -RGBX, XBGR, and XRGB pixel ordering. This is implemented with six new +RGBX, XBGR, and XRGB pixel ordering. This is implemented with ten new colorspace constants: JCS_EXT_RGB /* red/green/blue */ @@ -219,6 +219,10 @@ colorspace constants: JCS_EXT_BGRX /* blue/green/red/x */ JCS_EXT_XBGR /* x/blue/green/red */ JCS_EXT_XRGB /* x/red/green/blue */ + JCS_EXT_RGBA /* red/green/blue/alpha */ + JCS_EXT_BGRA /* blue/green/red/alpha */ + JCS_EXT_ABGR /* alpha/blue/green/red */ + JCS_EXT_ARGB /* alpha/red/green/blue */ Setting cinfo.in_color_space (compression) or cinfo.out_color_space (decompression) to one of these values will cause libjpeg-turbo to read the @@ -233,6 +237,18 @@ time with: At run time, attempting to use these extensions with a version of libjpeg that doesn't support them will result in a "Bogus input colorspace" error. +When using the RGBX, BGRX, XBGR, and XRGB colorspaces during decompression, the +X byte is undefined, and in order to ensure the best performance, libjpeg-turbo +can set that byte to whatever value it wishes. If an application expects the X +byte to be used as an alpha channel, then it should use JCS_EXT_RGBA, +JCS_EXT_BGRA, JCS_EXT_ABGR, or JCS_EXT_ARGB. When these colorspace constants +are used, the X byte is guaranteed to be 0xFF, which is interpreted as opaque. + +Your application can check for the existence of the alpha channel colorspace +extensions at compile time with: + + #ifdef JCS_ALPHA_EXTENSIONS + ================================= libjpeg v7 and v8 API/ABI support ================================= diff --git a/doc/html/annotated.html b/doc/html/annotated.html index a089c5a..b7d3b54 100644 --- a/doc/html/annotated.html +++ b/doc/html/annotated.html @@ -81,7 +81,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); -