• Show log

    Commit

  • Hash : 19c791cd
    Author : DRC
    Date : 2018-03-08T10:55:20

    Improve code formatting consistency
    
    With rare exceptions ...
    - Always separate line continuation characters by one space from
      preceding code.
    - Always use two-space indentation.  Never use tabs.
    - Always use K&R-style conditional blocks.
    - Always surround operators with spaces, except in raw assembly code.
    - Always put a space after, but not before, a comma.
    - Never put a space between type casts and variables/function calls.
    - Never put a space between the function name and the argument list in
      function declarations and prototypes.
    - Always surround braces ('{' and '}') with spaces.
    - Always surround statements (if, for, else, catch, while, do, switch)
      with spaces.
    - Always attach pointer symbols ('*' and '**') to the variable or
      function name.
    - Always precede pointer symbols ('*' and '**') by a space in type
      casts.
    - Use the MIN() macro from jpegint.h within the libjpeg and TurboJPEG
      API libraries (using min() from tjutil.h is still necessary for
      TJBench.)
    - Where it makes sense (particularly in the TurboJPEG code), put a blank
      line after variable declaration blocks.
    - Always separate statements in one-liners by two spaces.
    
    The purpose of this was to ease maintenance on my part and also to make
    it easier for contributors to figure out how to format patch
    submissions.  This was admittedly confusing (even to me sometimes) when
    we had 3 or 4 different style conventions in the same source tree.  The
    new convention is more consistent with the formatting of other OSS code
    bases.
    
    This commit corrects deviations from the chosen formatting style in the
    libjpeg API code and reformats the TurboJPEG API code such that it
    conforms to the same standard.
    
    NOTES:
    - Although it is no longer necessary for the function name in function
      declarations to begin in Column 1 (this was historically necessary
      because of the ansi2knr utility, which allowed libjpeg to be built
      with non-ANSI compilers), we retain that formatting for the libjpeg
      code because it improves readability when using libjpeg's function
      attribute macros (GLOBAL(), etc.)
    - This reformatting project was accomplished with the help of AStyle and
      Uncrustify, although neither was completely up to the task, and thus
      a great deal of manual tweaking was required.  Note to developers of
      code formatting utilities:  the libjpeg-turbo code base is an
      excellent test bed, because AFAICT, it breaks every single one of the
      utilities that are currently available.
    - The legacy (MMX, SSE, 3DNow!) assembly code for i386 has been
      formatted to match the SSE2 code (refer to
      ff5685d5344273df321eb63a005eaae19d2496e3.)  I hadn't intended to
      bother with this, but the Loongson MMI implementation demonstrated
      that there is still academic value to the MMX implementation, as an
      algorithmic model for other 64-bit vector implementations.  Thus, it
      is desirable to improve its readability in the same manner as that of
      the SSE2 implementation.
    

  • Properties

  • Git HTTP https://git.kmx.io/kc3-lang/libjpeg-turbo.git
    Git SSH git@git.kmx.io:kc3-lang/libjpeg-turbo.git
    Public access ? public
    Description

    Fork of libjpeg with SIMD

    Users
    thodg_m kc3_lang_org thodg_w www_kmx_io thodg_l thodg
    Tags

  • README

  • TurboJPEG Java Wrapper
    ======================
    
    The TurboJPEG shared library can optionally be built with a Java Native
    Interface wrapper, which allows the library to be loaded and used directly from
    Java applications.  The Java front end for this is defined in several classes
    located under org/libjpegturbo/turbojpeg.  The source code for these Java
    classes is licensed under a BSD-style license, so the files can be incorporated
    directly into both open source and proprietary projects without restriction.  A
    Java archive (JAR) file containing these classes is also shipped with the
    "official" distribution packages of libjpeg-turbo.
    
    TJExample.java, which should also be located in the same directory as this
    README file, demonstrates how to use the TurboJPEG Java API to compress and
    decompress JPEG images in memory.
    
    
    Performance Pitfalls
    --------------------
    
    The TurboJPEG Java API defines several convenience methods that can allocate
    image buffers or instantiate classes to hold the result of compress,
    decompress, or transform operations.  However, if you use these methods, then
    be mindful of the amount of new data you are creating on the heap.  It may be
    necessary to manually invoke the garbage collector to prevent heap exhaustion
    or to prevent performance degradation.  Background garbage collection can kill
    performance, particularly in a multi-threaded environment (Java pauses all
    threads when the GC runs.)
    
    The TurboJPEG Java API always gives you the option of pre-allocating your own
    source and destination buffers, which allows you to re-use those buffers for
    compressing/decompressing multiple images.  If the image sequence you are
    compressing or decompressing consists of images of the same size, then
    pre-allocating the buffers is recommended.
    
    
    Installation Directory
    ----------------------
    
    The TurboJPEG Java Wrapper will look for the TurboJPEG JNI library
    (libturbojpeg.so, libturbojpeg.jnilib, or turbojpeg.dll) in the system library
    paths or in any paths specified in LD_LIBRARY_PATH (Un*x), DYLD_LIBRARY_PATH
    (Mac), or PATH (Windows.)  Failing this, on Un*x and Mac systems, the wrapper
    will look for the JNI library under the library directory configured when
    libjpeg-turbo was built.  If that library directory is
    /opt/libjpeg-turbo/lib32, then /opt/libjpeg-turbo/lib64 is also searched, and
    vice versa.
    
    If you installed the JNI library into another directory, then you will need
    to pass an argument of -Djava.library.path={path_to_JNI_library} to java, or
    manipulate LD_LIBRARY_PATH, DYLD_LIBRARY_PATH, or PATH to include the directory
    containing the JNI library.