Changeset 240428 in webkit


Ignore:
Timestamp:
Jan 24, 2019 2:02:33 AM (5 years ago)
Author:
Carlos Garcia Campos
Message:

[GTK][WPE] Support JPEG 2000 images
https://bugs.webkit.org/show_bug.cgi?id=186272

Reviewed by Žan Doberšek.

.:

Add USE_OPENJPEG build option.

  • Source/cmake/OptionsGTK.cmake:
  • Source/cmake/OptionsWPE.cmake:

Source/WebCore:

Add JPEG2000ImageDecoder to support JPEG2000 images using OpenJPEG. For now only SRGB and SYCC color spaces are
supported.

  • platform/ImageDecoders.cmake:
  • platform/MIMETypeRegistry.cpp:

(WebCore::MIMETypeRegistry::supportedImageMIMETypes):

  • platform/image-decoders/ScalableImageDecoder.cpp:

(WebCore::ScalableImageDecoder::create):

  • platform/image-decoders/jpeg2000/JPEG2000ImageDecoder.cpp: Added.

(WebCore::syccToRGB):
(WebCore::sycc444ToRGB):
(WebCore::sycc422ToRGB):
(WebCore::sycc420ToRGB):
(WebCore::JPEG2000ImageDecoder::JPEG2000ImageDecoder):
(WebCore::JPEG2000ImageDecoder::frameBufferAtIndex):
(WebCore::JPEG2000ImageDecoder::decode):

  • platform/image-decoders/jpeg2000/JPEG2000ImageDecoder.h: Added.

Tools:

Add OpenJPEG to jhbuild since 2.2.0 version is required and it's not available in debian stable.

  • gtk/jhbuild.modules:
  • wpe/jhbuild.modules:
Location:
trunk
Files:
3 added
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/ChangeLog

    r240176 r240428  
     12019-01-24  Carlos Garcia Campos  <cgarcia@igalia.com>
     2
     3        [GTK][WPE] Support JPEG 2000 images
     4        https://bugs.webkit.org/show_bug.cgi?id=186272
     5
     6        Reviewed by Žan Doberšek.
     7
     8        Add USE_OPENJPEG build option.
     9
     10        * Source/cmake/OptionsGTK.cmake:
     11        * Source/cmake/OptionsWPE.cmake:
     12
    1132019-01-18  Jer Noble  <jer.noble@apple.com>
    214
  • trunk/Source/WebCore/ChangeLog

    r240407 r240428  
     12019-01-24  Carlos Garcia Campos  <cgarcia@igalia.com>
     2
     3        [GTK][WPE] Support JPEG 2000 images
     4        https://bugs.webkit.org/show_bug.cgi?id=186272
     5
     6        Reviewed by Žan Doberšek.
     7
     8        Add JPEG2000ImageDecoder to support JPEG2000 images using OpenJPEG. For now only SRGB and SYCC color spaces are
     9        supported.
     10
     11        * platform/ImageDecoders.cmake:
     12        * platform/MIMETypeRegistry.cpp:
     13        (WebCore::MIMETypeRegistry::supportedImageMIMETypes):
     14        * platform/image-decoders/ScalableImageDecoder.cpp:
     15        (WebCore::ScalableImageDecoder::create):
     16        * platform/image-decoders/jpeg2000/JPEG2000ImageDecoder.cpp: Added.
     17        (WebCore::syccToRGB):
     18        (WebCore::sycc444ToRGB):
     19        (WebCore::sycc422ToRGB):
     20        (WebCore::sycc420ToRGB):
     21        (WebCore::JPEG2000ImageDecoder::JPEG2000ImageDecoder):
     22        (WebCore::JPEG2000ImageDecoder::frameBufferAtIndex):
     23        (WebCore::JPEG2000ImageDecoder::decode):
     24        * platform/image-decoders/jpeg2000/JPEG2000ImageDecoder.h: Added.
     25
    1262019-01-23  Simon Fraser  <simon.fraser@apple.com>
    227
  • trunk/Source/WebCore/platform/ImageDecoders.cmake

    r230522 r240428  
    55    "${WEBCORE_DIR}/platform/image-decoders/ico"
    66    "${WEBCORE_DIR}/platform/image-decoders/jpeg"
     7    "${WEBCORE_DIR}/platform/image-decoders/jpeg2000"
    78    "${WEBCORE_DIR}/platform/image-decoders/png"
    89    "${WEBCORE_DIR}/platform/image-decoders/webp"
     
    2324    platform/image-decoders/jpeg/JPEGImageDecoder.cpp
    2425
     26    platform/image-decoders/jpeg2000/JPEG2000ImageDecoder.cpp
     27
    2528    platform/image-decoders/png/PNGImageDecoder.cpp
    2629
     
    3639    ${PNG_LIBRARIES}
    3740)
     41
     42if (OpenJPEG_FOUND)
     43    list(APPEND WebCore_SYSTEM_INCLUDE_DIRECTORIES
     44        ${OPENJPEG_INCLUDE_DIRS}
     45    )
     46    list(APPEND WebCore_LIBRARIES
     47      ${OPENJPEG_LIBRARIES}
     48    )
     49endif ()
    3850
    3951if (WEBP_FOUND)
  • trunk/Source/WebCore/platform/MIMETypeRegistry.cpp

    r239758 r240428  
    126126        "image/x-icon"_s, // ico
    127127        "image/x-xbitmap"_s, // xbm
     128#if USE(OPENJPEG)
     129        "image/jp2"_s,
     130        "image/jpeg2000"_s,
     131#endif
    128132#if USE(WEBP)
    129133        "image/webp"_s,
  • trunk/Source/WebCore/platform/image-decoders/ScalableImageDecoder.cpp

    r240215 r240428  
    3030#include "PNGImageDecoder.h"
    3131#include "SharedBuffer.h"
     32#if USE(OPENJPEG)
     33#include "JPEG2000ImageDecoder.h"
     34#endif
    3235#if USE(WEBP)
    3336#include "WEBPImageDecoder.h"
     
    7477}
    7578
     79#if USE(OPENJPEG)
     80bool matchesJP2Signature(char* contents)
     81{
     82    return !memcmp(contents, "\x00\x00\x00\x0C\x6A\x50\x20\x20\x0D\x0A\x87\x0A", 12)
     83        || !memcmp(contents, "\x0D\x0A\x87\x0A", 4);
     84}
     85
     86bool matchesJ2KSignature(char* contents)
     87{
     88    return !memcmp(contents, "\xFF\x4F\xFF\x51", 4);
     89}
     90#endif
     91
    7692#if USE(WEBP)
    7793bool matchesWebPSignature(char* contents)
     
    117133    if (matchesJPEGSignature(contents))
    118134        return JPEGImageDecoder::create(alphaOption, gammaAndColorProfileOption);
     135
     136#if USE(OPENJPEG)
     137    if (matchesJP2Signature(contents))
     138        return JPEG2000ImageDecoder::create(JPEG2000ImageDecoder::Format::JP2, alphaOption, gammaAndColorProfileOption);
     139
     140    if (matchesJ2KSignature(contents))
     141        return JPEG2000ImageDecoder::create(JPEG2000ImageDecoder::Format::J2K, alphaOption, gammaAndColorProfileOption);
     142#endif
    119143
    120144#if USE(WEBP)
  • trunk/Source/cmake/OptionsGTK.cmake

    r239917 r240428  
    8484WEBKIT_OPTION_DEFINE(USE_LIBHYPHEN "Whether to enable the default automatic hyphenation implementation." PUBLIC ON)
    8585WEBKIT_OPTION_DEFINE(USE_LIBSECRET "Whether to enable the persistent credential storage using libsecret." PUBLIC ON)
     86WEBKIT_OPTION_DEFINE(USE_OPENJPEG "Whether to enable support for JPEG2000 images." PUBLIC ON)
    8687WEBKIT_OPTION_DEFINE(USE_WOFF2 "Whether to enable support for WOFF2 Web Fonts." PUBLIC ON)
    8788
     
    387388    if (NOT HYPHEN_FOUND)
    388389       message(FATAL_ERROR "libhyphen is needed for USE_LIBHYPHEN.")
     390    endif ()
     391endif ()
     392
     393if (USE_OPENJPEG)
     394    find_package(OpenJPEG)
     395    if (NOT OpenJPEG_FOUND)
     396        message(FATAL_ERROR "libopenjpeg is needed for USE_OPENJPEG.")
     397    endif ()
     398    if ("${OPENJPEG_MAJOR_VERSION}.${OPENJPEG_MINOR_VERSION}.${OPENJPEG_BUILD_VERSION}" VERSION_LESS "2.2.0")
     399        message(FATAL_ERROR "libopenjpeg 2.2.0 is required for USE_OPENJPEG.")
    389400    endif ()
    390401endif ()
  • trunk/Source/cmake/OptionsWPE.cmake

    r240141 r240428  
    4545# and the option is not relevant to any other WebKit ports.
    4646WEBKIT_OPTION_DEFINE(ENABLE_GTKDOC "Whether or not to use generate gtkdoc." PUBLIC OFF)
     47WEBKIT_OPTION_DEFINE(USE_OPENJPEG "Whether to enable support for JPEG2000 images." PUBLIC ON)
    4748WEBKIT_OPTION_DEFINE(USE_WOFF2 "Whether to enable support for WOFF2 Web Fonts." PUBLIC ON)
    4849WEBKIT_OPTION_DEFINE(ENABLE_WPE_QT_API "Whether to enable support for the Qt5/QML plugin" PUBLIC OFF)
     
    8687find_package(WPE REQUIRED)
    8788find_package(ZLIB REQUIRED)
     89
     90if (USE_OPENJPEG)
     91    find_package(OpenJPEG)
     92    if (NOT OpenJPEG_FOUND)
     93        message(FATAL_ERROR "libopenjpeg is needed for USE_OPENJPEG.")
     94    endif ()
     95    if ("${OPENJPEG_MAJOR_VERSION}.${OPENJPEG_MINOR_VERSION}.${OPENJPEG_BUILD_VERSION}" VERSION_LESS "2.2.0")
     96        message(FATAL_ERROR "libopenjpeg 2.2.0 is required for USE_OPENJPEG.")
     97    endif ()
     98endif ()
    8899
    89100if (USE_WOFF2)
  • trunk/Tools/ChangeLog

    r240402 r240428  
     12019-01-24  Carlos Garcia Campos  <cgarcia@igalia.com>
     2
     3        [GTK][WPE] Support JPEG 2000 images
     4        https://bugs.webkit.org/show_bug.cgi?id=186272
     5
     6        Reviewed by Žan Doberšek.
     7
     8        Add OpenJPEG to jhbuild since 2.2.0 version is required and it's not available in debian stable.
     9
     10        * gtk/jhbuild.modules:
     11        * wpe/jhbuild.modules:
     12
    1132019-01-23  David Kilzer  <ddkilzer@apple.com>
    214
  • trunk/Tools/gtk/jhbuild.modules

    r240245 r240428  
    3232      <dep package="libgpg-error"/>
    3333      <dep package="libgcrypt"/>
     34      <dep package="openjpeg"/>
    3435      <if condition-set="linux">
    3536          <dep package="xdg-dbus-proxy"/>
     
    457458  </autotools>
    458459
     460  <cmake id="openjpeg">
     461    <branch repo="github-tarball"
     462            module="uclouvain/openjpeg/archive/v${version}.tar.gz"
     463            checkoutdir="openjpeg-${version}"
     464            version="2.3.0"
     465            hash="sha256:3dc787c1bb6023ba846c2a0d9b1f6e179f1cd255172bde9eb75b01f1e6c7d71a"/>
     466  </cmake>
     467
    459468  <!-- Dependencies listed below this point are not thought to affect test results, and are only
    460469       included because they themselves depend on other dependencies built by jhbuild. -->
  • trunk/Tools/wpe/jhbuild.modules

    r240245 r240428  
    2525      <dep package="libepoxy"/>
    2626      <dep package="wayland-protocols"/>
     27      <dep package="openjpeg"/>
    2728    </dependencies>
    2829  </metamodule>
     
    227228  </meson>
    228229
     230  <cmake id="openjpeg">
     231    <branch repo="github-tarball"
     232            module="uclouvain/openjpeg/archive/v${version}.tar.gz"
     233            checkoutdir="openjpeg-${version}"
     234            version="2.3.0"
     235            hash="sha256:3dc787c1bb6023ba846c2a0d9b1f6e179f1cd255172bde9eb75b01f1e6c7d71a"/>
     236  </cmake>
     237
    229238  <distutils id="meson" python3="1">
    230239    <branch repo="github-tarball"
Note: See TracChangeset for help on using the changeset viewer.