Home | History | Annotate | only in /external/webp
Up to higher level directory
NameDateSize
Android.mk06-Dec-201637
ChangeLog06-Dec-2016713
COPYING06-Dec-20161.5K
include/06-Dec-2016
MODULE_LICENSE_BSD06-Dec-20160
NOTICE06-Dec-20161.5K
PATENTS06-Dec-20161.4K
README06-Dec-201624.4K
README.android06-Dec-20161K
README.version06-Dec-2016108
src/06-Dec-2016

README

      1           __   __  ____  ____  ____
      2          /  \\/  \/  _ \/  _ )/  _ \
      3          \       /   __/  _  \   __/
      4           \__\__/\____/\_____/__/ ____  ___
      5                 / _/ /    \    \ /  _ \/ _/
      6                /  \_/   / /   \ \   __/  \__
      7                \____/____/\_____/_____/____/v0.5.0
      8 
      9 Description:
     10 ============
     11 
     12 WebP codec: library to encode and decode images in WebP format. This package
     13 contains the library that can be used in other programs to add WebP support,
     14 as well as the command line tools 'cwebp' and 'dwebp'.
     15 
     16 See http://developers.google.com/speed/webp
     17 
     18 The latest source tree is available at
     19 https://chromium.googlesource.com/webm/libwebp
     20 
     21 It is released under the same license as the WebM project.
     22 See http://www.webmproject.org/license/software/ or the
     23 file "COPYING" file for details. An additional intellectual
     24 property rights grant can be found in the file PATENTS.
     25 
     26 Building:
     27 =========
     28 
     29 Windows build:
     30 --------------
     31 
     32 By running:
     33 
     34   nmake /f Makefile.vc CFG=release-static RTLIBCFG=static OBJDIR=output
     35 
     36 the directory output\release-static\(x64|x86)\bin will contain the tools
     37 cwebp.exe and dwebp.exe. The directory output\release-static\(x64|x86)\lib will
     38 contain the libwebp static library.
     39 The target architecture (x86/x64) is detected by Makefile.vc from the Visual
     40 Studio compiler (cl.exe) available in the system path.
     41 
     42 Unix build using makefile.unix:
     43 -------------------------------
     44 
     45 On platforms with GNU tools installed (gcc and make), running
     46 
     47   make -f makefile.unix
     48 
     49 will build the binaries examples/cwebp and examples/dwebp, along
     50 with the static library src/libwebp.a. No system-wide installation
     51 is supplied, as this is a simple alternative to the full installation
     52 system based on the autoconf tools (see below).
     53 Please refer to makefile.unix for additional details and customizations.
     54 
     55 Using autoconf tools:
     56 ---------------------
     57 Prerequisites:
     58 A compiler (e.g., gcc), make, autoconf, automake, libtool.
     59 On a Debian-like system the following should install everything you need for a
     60 minimal build:
     61 $ sudo apt-get install gcc make autoconf automake libtool
     62 
     63 When building from git sources, you will need to run autogen.sh to generate the
     64 configure script.
     65 
     66 ./configure
     67 make
     68 make install
     69 
     70 should be all you need to have the following files
     71 
     72 /usr/local/include/webp/decode.h
     73 /usr/local/include/webp/encode.h
     74 /usr/local/include/webp/types.h
     75 /usr/local/lib/libwebp.*
     76 /usr/local/bin/cwebp
     77 /usr/local/bin/dwebp
     78 
     79 installed.
     80 
     81 Note: A decode-only library, libwebpdecoder, is available using the
     82 '--enable-libwebpdecoder' flag. The encode library is built separately and can
     83 be installed independently using a minor modification in the corresponding
     84 Makefile.am configure files (see comments there). See './configure --help' for
     85 more options.
     86 
     87 SWIG bindings:
     88 --------------
     89 
     90 To generate language bindings from swig/libwebp.swig at least swig-1.3
     91 (http://www.swig.org) is required.
     92 
     93 Currently the following functions are mapped:
     94 Decode:
     95   WebPGetDecoderVersion
     96   WebPGetInfo
     97   WebPDecodeRGBA
     98   WebPDecodeARGB
     99   WebPDecodeBGRA
    100   WebPDecodeBGR
    101   WebPDecodeRGB
    102 
    103 Encode:
    104   WebPGetEncoderVersion
    105   WebPEncodeRGBA
    106   WebPEncodeBGRA
    107   WebPEncodeRGB
    108   WebPEncodeBGR
    109   WebPEncodeLosslessRGBA
    110   WebPEncodeLosslessBGRA
    111   WebPEncodeLosslessRGB
    112   WebPEncodeLosslessBGR
    113 
    114 See swig/README for more detailed build instructions.
    115 
    116 Java bindings:
    117 
    118 To build the swig-generated JNI wrapper code at least JDK-1.5 (or equivalent)
    119 is necessary for enum support. The output is intended to be a shared object /
    120 DLL that can be loaded via System.loadLibrary("webp_jni").
    121 
    122 Python bindings:
    123 
    124 To build the swig-generated Python extension code at least Python 2.6 is
    125 required. Python < 2.6 may build with some minor changes to libwebp.swig or the
    126 generated code, but is untested.
    127 
    128 Encoding tool:
    129 ==============
    130 
    131 The examples/ directory contains tools for encoding (cwebp) and
    132 decoding (dwebp) images.
    133 
    134 The easiest use should look like:
    135   cwebp input.png -q 80 -o output.webp
    136 which will convert the input file to a WebP file using a quality factor of 80
    137 on a 0->100 scale (0 being the lowest quality, 100 being the best. Default
    138 value is 75).
    139 You might want to try the -lossless flag too, which will compress the source
    140 (in RGBA format) without any loss. The -q quality parameter will in this case
    141 control the amount of processing time spent trying to make the output file as
    142 small as possible.
    143 
    144 A longer list of options is available using the -longhelp command line flag:
    145 
    146 > cwebp -longhelp
    147 Usage:
    148  cwebp [-preset <...>] [options] in_file [-o out_file]
    149 
    150 If input size (-s) for an image is not specified, it is
    151 assumed to be a PNG, JPEG, TIFF or WebP file.
    152 
    153 Options:
    154   -h / -help  ............ short help
    155   -H / -longhelp  ........ long help
    156   -q <float> ............. quality factor (0:small..100:big)
    157   -alpha_q <int> ......... transparency-compression quality (0..100)
    158   -preset <string> ....... preset setting, one of:
    159                             default, photo, picture,
    160                             drawing, icon, text
    161      -preset must come first, as it overwrites other parameters
    162   -z <int> ............... activates lossless preset with given
    163                            level in [0:fast, ..., 9:slowest]
    164 
    165   -m <int> ............... compression method (0=fast, 6=slowest)
    166   -segments <int> ........ number of segments to use (1..4)
    167   -size <int> ............ target size (in bytes)
    168   -psnr <float> .......... target PSNR (in dB. typically: 42)
    169 
    170   -s <int> <int> ......... input size (width x height) for YUV
    171   -sns <int> ............. spatial noise shaping (0:off, 100:max)
    172   -f <int> ............... filter strength (0=off..100)
    173   -sharpness <int> ....... filter sharpness (0:most .. 7:least sharp)
    174   -strong ................ use strong filter instead of simple (default)
    175   -nostrong .............. use simple filter instead of strong
    176   -partition_limit <int> . limit quality to fit the 512k limit on
    177                            the first partition (0=no degradation ... 100=full)
    178   -pass <int> ............ analysis pass number (1..10)
    179   -crop <x> <y> <w> <h> .. crop picture with the given rectangle
    180   -resize <w> <h> ........ resize picture (after any cropping)
    181   -mt .................... use multi-threading if available
    182   -low_memory ............ reduce memory usage (slower encoding)
    183   -map <int> ............. print map of extra info
    184   -print_psnr ............ prints averaged PSNR distortion
    185   -print_ssim ............ prints averaged SSIM distortion
    186   -print_lsim ............ prints local-similarity distortion
    187   -d <file.pgm> .......... dump the compressed output (PGM file)
    188   -alpha_method <int> .... transparency-compression method (0..1)
    189   -alpha_filter <string> . predictive filtering for alpha plane,
    190                            one of: none, fast (default) or best
    191   -exact ................. preserve RGB values in transparent area
    192   -blend_alpha <hex> ..... blend colors against background color
    193                            expressed as RGB values written in
    194                            hexadecimal, e.g. 0xc0e0d0 for red=0xc0
    195                            green=0xe0 and blue=0xd0
    196   -noalpha ............... discard any transparency information
    197   -lossless .............. encode image losslessly
    198   -near_lossless <int> ... use near-lossless image
    199                            preprocessing (0..100=off)
    200   -hint <string> ......... specify image characteristics hint,
    201                            one of: photo, picture or graph
    202 
    203   -metadata <string> ..... comma separated list of metadata to
    204                            copy from the input to the output if present.
    205                            Valid values: all, none (default), exif, icc, xmp
    206 
    207   -short ................. condense printed message
    208   -quiet ................. don't print anything
    209   -version ............... print version number and exit
    210   -noasm ................. disable all assembly optimizations
    211   -v ..................... verbose, e.g. print encoding/decoding times
    212   -progress .............. report encoding progress
    213 
    214 Experimental Options:
    215   -jpeg_like ............. roughly match expected JPEG size
    216   -af .................... auto-adjust filter strength
    217   -pre <int> ............. pre-processing filter
    218 
    219 The main options you might want to try in order to further tune the
    220 visual quality are:
    221  -preset
    222  -sns
    223  -f
    224  -m
    225 
    226 Namely:
    227   * 'preset' will set up a default encoding configuration targeting a
    228      particular type of input. It should appear first in the list of options,
    229      so that subsequent options can take effect on top of this preset.
    230      Default value is 'default'.
    231   * 'sns' will progressively turn on (when going from 0 to 100) some additional
    232      visual optimizations (like: segmentation map re-enforcement). This option
    233      will balance the bit allocation differently. It tries to take bits from the
    234      "easy" parts of the picture and use them in the "difficult" ones instead.
    235      Usually, raising the sns value (at fixed -q value) leads to larger files,
    236      but with better quality.
    237      Typical value is around '75'.
    238   * 'f' option directly links to the filtering strength used by the codec's
    239      in-loop processing. The higher the value, the smoother the
    240      highly-compressed area will look. This is particularly useful when aiming
    241      at very small files. Typical values are around 20-30. Note that using the
    242      option -strong/-nostrong will change the type of filtering. Use "-f 0" to
    243      turn filtering off.
    244   * 'm' controls the trade-off between encoding speed and quality. Default is 4.
    245      You can try -m 5 or -m 6 to explore more (time-consuming) encoding
    246      possibilities. A lower value will result in faster encoding at the expense
    247      of quality.
    248 
    249 Decoding tool:
    250 ==============
    251 
    252 There is a decoding sample in examples/dwebp.c which will take
    253 a .webp file and decode it to a PNG image file (amongst other formats).
    254 This is simply to demonstrate the use of the API. You can verify the
    255 file test.webp decodes to exactly the same as test_ref.ppm by using:
    256 
    257  cd examples
    258  ./dwebp test.webp -ppm -o test.ppm
    259  diff test.ppm test_ref.ppm
    260 
    261 The full list of options is available using -h:
    262 
    263 > dwebp -h
    264 Usage: dwebp in_file [options] [-o out_file]
    265 
    266 Decodes the WebP image file to PNG format [Default]
    267 Use following options to convert into alternate image formats:
    268   -pam ......... save the raw RGBA samples as a color PAM
    269   -ppm ......... save the raw RGB samples as a color PPM
    270   -bmp ......... save as uncompressed BMP format
    271   -tiff ........ save as uncompressed TIFF format
    272   -pgm ......... save the raw YUV samples as a grayscale PGM
    273                  file with IMC4 layout
    274   -yuv ......... save the raw YUV samples in flat layout
    275 
    276  Other options are:
    277   -version  .... print version number and exit
    278   -nofancy ..... don't use the fancy YUV420 upscaler
    279   -nofilter .... disable in-loop filtering
    280   -nodither .... disable dithering
    281   -dither <d> .. dithering strength (in 0..100)
    282   -alpha_dither  use alpha-plane dithering if needed
    283   -mt .......... use multi-threading
    284   -crop <x> <y> <w> <h> ... crop output with the given rectangle
    285   -resize <w> <h> ......... scale the output (*after* any cropping)
    286   -flip ........ flip the output vertically
    287   -alpha ....... only save the alpha plane
    288   -incremental . use incremental decoding (useful for tests)
    289   -h     ....... this help message
    290   -v     ....... verbose (e.g. print encoding/decoding times)
    291   -quiet ....... quiet mode, don't print anything
    292   -noasm ....... disable all assembly optimizations
    293 
    294 Visualization tool:
    295 ===================
    296 
    297 There's a little self-serve visualization tool called 'vwebp' under the
    298 examples/ directory. It uses OpenGL to open a simple drawing window and show
    299 a decoded WebP file. It's not yet integrated in the automake build system, but
    300 you can try to manually compile it using the recommendations below.
    301 
    302 Usage: vwebp in_file [options]
    303 
    304 Decodes the WebP image file and visualize it using OpenGL
    305 Options are:
    306   -version  .... print version number and exit
    307   -noicc ....... don't use the icc profile if present
    308   -nofancy ..... don't use the fancy YUV420 upscaler
    309   -nofilter .... disable in-loop filtering
    310   -dither <int>  dithering strength (0..100), default=50
    311   -noalphadither disable alpha plane dithering
    312   -mt .......... use multi-threading
    313   -info ........ print info
    314   -h     ....... this help message
    315 
    316 Keyboard shortcuts:
    317   'c' ................ toggle use of color profile
    318   'i' ................ overlay file information
    319   'q' / 'Q' / ESC .... quit
    320 
    321 Building:
    322 ---------
    323 
    324 Prerequisites:
    325 1) OpenGL & OpenGL Utility Toolkit (GLUT)
    326   Linux:
    327     $ sudo apt-get install freeglut3-dev mesa-common-dev
    328   Mac + XCode:
    329     - These libraries should be available in the OpenGL / GLUT frameworks.
    330   Windows:
    331     http://freeglut.sourceforge.net/index.php#download
    332 
    333 2) (Optional) qcms (Quick Color Management System)
    334   i. Download qcms from Mozilla / Chromium:
    335     http://hg.mozilla.org/mozilla-central/file/0e7639e3bdfb/gfx/qcms
    336     http://src.chromium.org/viewvc/chrome/trunk/src/third_party/qcms
    337   ii. Build and archive the source files as libqcms.a / qcms.lib
    338   iii. Update makefile.unix / Makefile.vc
    339     a) Define WEBP_HAVE_QCMS
    340     b) Update include / library paths to reference the qcms directory.
    341 
    342 Build using makefile.unix / Makefile.vc:
    343 $ make -f makefile.unix examples/vwebp
    344 > nmake /f Makefile.vc CFG=release-static \
    345     ../obj/x64/release-static/bin/vwebp.exe
    346 
    347 Animated GIF conversion:
    348 ========================
    349 Animated GIF files can be converted to WebP files with animation using the
    350 gif2webp utility available under examples/. The files can then be viewed using
    351 vwebp.
    352 
    353 Usage:
    354  gif2webp [options] gif_file -o webp_file
    355 Options:
    356   -h / -help  ............ this help
    357   -lossy ................. encode image using lossy compression
    358   -mixed ................. for each frame in the image, pick lossy
    359                            or lossless compression heuristically
    360   -q <float> ............. quality factor (0:small..100:big)
    361   -m <int> ............... compression method (0=fast, 6=slowest)
    362   -min_size .............. minimize output size (default:off)
    363                            lossless compression by default; can be
    364                            combined with -q, -m, -lossy or -mixed
    365                            options
    366   -kmin <int> ............ min distance between key frames
    367   -kmax <int> ............ max distance between key frames
    368   -f <int> ............... filter strength (0=off..100)
    369   -metadata <string> ..... comma separated list of metadata to
    370                            copy from the input to the output if present
    371                            Valid values: all, none, icc, xmp (default)
    372   -mt .................... use multi-threading if available
    373 
    374   -version ............... print version number and exit
    375   -v ..................... verbose
    376   -quiet ................. don't print anything
    377 
    378 Building:
    379 ---------
    380 With the libgif development files installed, gif2webp can be built using
    381 makefile.unix:
    382 $ make -f makefile.unix examples/gif2webp
    383 
    384 or using autoconf:
    385 $ ./configure --enable-everything
    386 $ make
    387 
    388 Comparison of animated images:
    389 ==============================
    390 Test utility anim_diff under examples/ can be used to compare two animated
    391 images (each can be GIF or WebP).
    392 
    393 Usage: anim_diff <image1> <image2> [options]
    394 
    395 Options:
    396   -dump_frames <folder> dump decoded frames in PAM format
    397   -min_psnr <float> ... minimum per-frame PSNR
    398   -raw_comparison ..... if this flag is not used, RGB is
    399                         premultiplied before comparison
    400 
    401 Building:
    402 ---------
    403 With the libgif development files and a C++ compiler installed, anim_diff can
    404 be built using makefile.unix:
    405 $ make -f makefile.unix examples/anim_diff
    406 
    407 or using autoconf:
    408 $ ./configure --enable-everything
    409 $ make
    410 
    411 Encoding API:
    412 =============
    413 
    414 The main encoding functions are available in the header src/webp/encode.h
    415 The ready-to-use ones are:
    416 size_t WebPEncodeRGB(const uint8_t* rgb, int width, int height, int stride,
    417                      float quality_factor, uint8_t** output);
    418 size_t WebPEncodeBGR(const uint8_t* bgr, int width, int height, int stride,
    419                      float quality_factor, uint8_t** output);
    420 size_t WebPEncodeRGBA(const uint8_t* rgba, int width, int height, int stride,
    421                       float quality_factor, uint8_t** output);
    422 size_t WebPEncodeBGRA(const uint8_t* bgra, int width, int height, int stride,
    423                       float quality_factor, uint8_t** output);
    424 
    425 They will convert raw RGB samples to a WebP data. The only control supplied
    426 is the quality factor.
    427 
    428 There are some variants for using the lossless format:
    429 
    430 size_t WebPEncodeLosslessRGB(const uint8_t* rgb, int width, int height,
    431                              int stride, uint8_t** output);
    432 size_t WebPEncodeLosslessBGR(const uint8_t* bgr, int width, int height,
    433                              int stride, uint8_t** output);
    434 size_t WebPEncodeLosslessRGBA(const uint8_t* rgba, int width, int height,
    435                               int stride, uint8_t** output);
    436 size_t WebPEncodeLosslessBGRA(const uint8_t* bgra, int width, int height,
    437                               int stride, uint8_t** output);
    438 
    439 Of course in this case, no quality factor is needed since the compression
    440 occurs without loss of the input values, at the expense of larger output sizes.
    441 
    442 Advanced encoding API:
    443 ----------------------
    444 
    445 A more advanced API is based on the WebPConfig and WebPPicture structures.
    446 
    447 WebPConfig contains the encoding settings and is not tied to a particular
    448 picture.
    449 WebPPicture contains input data, on which some WebPConfig will be used for
    450 compression.
    451 The encoding flow looks like:
    452 
    453 -------------------------------------- BEGIN PSEUDO EXAMPLE
    454 
    455 #include <webp/encode.h>
    456 
    457   // Setup a config, starting form a preset and tuning some additional
    458   // parameters
    459   WebPConfig config;
    460   if (!WebPConfigPreset(&config, WEBP_PRESET_PHOTO, quality_factor))
    461     return 0;   // version error
    462   }
    463   // ... additional tuning
    464   config.sns_strength = 90;
    465   config.filter_sharpness = 6;
    466   config_error = WebPValidateConfig(&config);  // not mandatory, but useful
    467 
    468   // Setup the input data
    469   WebPPicture pic;
    470   if (!WebPPictureInit(&pic)) {
    471     return 0;  // version error
    472   }
    473   pic.width = width;
    474   pic.height = height;
    475   // allocated picture of dimension width x height
    476   if (!WebPPictureAllocate(&pic)) {
    477     return 0;   // memory error
    478   }
    479   // at this point, 'pic' has been initialized as a container,
    480   // and can receive the Y/U/V samples.
    481   // Alternatively, one could use ready-made import functions like
    482   // WebPPictureImportRGB(), which will take care of memory allocation.
    483   // In any case, past this point, one will have to call
    484   // WebPPictureFree(&pic) to reclaim memory.
    485 
    486   // Set up a byte-output write method. WebPMemoryWriter, for instance.
    487   WebPMemoryWriter wrt;
    488   WebPMemoryWriterInit(&wrt);     // initialize 'wrt'
    489 
    490   pic.writer = MyFileWriter;
    491   pic.custom_ptr = my_opaque_structure_to_make_MyFileWriter_work;
    492 
    493   // Compress!
    494   int ok = WebPEncode(&config, &pic);   // ok = 0 => error occurred!
    495   WebPPictureFree(&pic);  // must be called independently of the 'ok' result.
    496 
    497   // output data should have been handled by the writer at that point.
    498   // -> compressed data is the memory buffer described by wrt.mem / wrt.size
    499 
    500   // deallocate the memory used by compressed data
    501   WebPMemoryWriterClear(&wrt);
    502 
    503 -------------------------------------- END PSEUDO EXAMPLE
    504 
    505 Decoding API:
    506 =============
    507 
    508 This is mainly just one function to call:
    509 
    510 #include "webp/decode.h"
    511 uint8_t* WebPDecodeRGB(const uint8_t* data, size_t data_size,
    512                        int* width, int* height);
    513 
    514 Please have a look at the file src/webp/decode.h for the details.
    515 There are variants for decoding in BGR/RGBA/ARGB/BGRA order, along with
    516 decoding to raw Y'CbCr samples. One can also decode the image directly into a
    517 pre-allocated buffer.
    518 
    519 To detect a WebP file and gather the picture's dimensions, the function:
    520   int WebPGetInfo(const uint8_t* data, size_t data_size,
    521                   int* width, int* height);
    522 is supplied. No decoding is involved when using it.
    523 
    524 Incremental decoding API:
    525 =========================
    526 
    527 In the case when data is being progressively transmitted, pictures can still
    528 be incrementally decoded using a slightly more complicated API. Decoder state
    529 is stored into an instance of the WebPIDecoder object. This object can be
    530 created with the purpose of decoding either RGB or Y'CbCr samples.
    531 For instance:
    532 
    533   WebPDecBuffer buffer;
    534   WebPInitDecBuffer(&buffer);
    535   buffer.colorspace = MODE_BGR;
    536   ...
    537   WebPIDecoder* idec = WebPINewDecoder(&buffer);
    538 
    539 As data is made progressively available, this incremental-decoder object
    540 can be used to decode the picture further. There are two (mutually exclusive)
    541 ways to pass freshly arrived data:
    542 
    543 either by appending the fresh bytes:
    544 
    545   WebPIAppend(idec, fresh_data, size_of_fresh_data);
    546 
    547 or by just mentioning the new size of the transmitted data:
    548 
    549   WebPIUpdate(idec, buffer, size_of_transmitted_buffer);
    550 
    551 Note that 'buffer' can be modified between each call to WebPIUpdate, in
    552 particular when the buffer is resized to accommodate larger data.
    553 
    554 These functions will return the decoding status: either VP8_STATUS_SUSPENDED if
    555 decoding is not finished yet or VP8_STATUS_OK when decoding is done. Any other
    556 status is an error condition.
    557 
    558 The 'idec' object must always be released (even upon an error condition) by
    559 calling: WebPDelete(idec).
    560 
    561 To retrieve partially decoded picture samples, one must use the corresponding
    562 method: WebPIDecGetRGB or WebPIDecGetYUVA.
    563 It will return the last displayable pixel row.
    564 
    565 Lastly, note that decoding can also be performed into a pre-allocated pixel
    566 buffer. This buffer must be passed when creating a WebPIDecoder, calling
    567 WebPINewRGB() or WebPINewYUVA().
    568 
    569 Please have a look at the src/webp/decode.h header for further details.
    570 
    571 Advanced Decoding API:
    572 ======================
    573 
    574 WebP decoding supports an advanced API which provides on-the-fly cropping and
    575 rescaling, something of great usefulness on memory-constrained environments like
    576 mobile phones. Basically, the memory usage will scale with the output's size,
    577 not the input's, when one only needs a quick preview or a zoomed in portion of
    578 an otherwise too-large picture. Some CPU can be saved too, incidentally.
    579 
    580 -------------------------------------- BEGIN PSEUDO EXAMPLE
    581      // A) Init a configuration object
    582      WebPDecoderConfig config;
    583      CHECK(WebPInitDecoderConfig(&config));
    584 
    585      // B) optional: retrieve the bitstream's features.
    586      CHECK(WebPGetFeatures(data, data_size, &config.input) == VP8_STATUS_OK);
    587 
    588      // C) Adjust 'config' options, if needed
    589      config.options.no_fancy_upsampling = 1;
    590      config.options.use_scaling = 1;
    591      config.options.scaled_width = scaledWidth();
    592      config.options.scaled_height = scaledHeight();
    593      // etc.
    594 
    595      // D) Specify 'config' output options for specifying output colorspace.
    596      // Optionally the external image decode buffer can also be specified.
    597      config.output.colorspace = MODE_BGRA;
    598      // Optionally, the config.output can be pointed to an external buffer as
    599      // well for decoding the image. This externally supplied memory buffer
    600      // should be big enough to store the decoded picture.
    601      config.output.u.RGBA.rgba = (uint8_t*) memory_buffer;
    602      config.output.u.RGBA.stride = scanline_stride;
    603      config.output.u.RGBA.size = total_size_of_the_memory_buffer;
    604      config.output.is_external_memory = 1;
    605 
    606      // E) Decode the WebP image. There are two variants w.r.t decoding image.
    607      // The first one (E.1) decodes the full image and the second one (E.2) is
    608      // used to incrementally decode the image using small input buffers.
    609      // Any one of these steps can be used to decode the WebP image.
    610 
    611      // E.1) Decode full image.
    612      CHECK(WebPDecode(data, data_size, &config) == VP8_STATUS_OK);
    613 
    614      // E.2) Decode image incrementally.
    615      WebPIDecoder* const idec = WebPIDecode(NULL, NULL, &config);
    616      CHECK(idec != NULL);
    617      while (bytes_remaining > 0) {
    618        VP8StatusCode status = WebPIAppend(idec, input, bytes_read);
    619        if (status == VP8_STATUS_OK || status == VP8_STATUS_SUSPENDED) {
    620          bytes_remaining -= bytes_read;
    621        } else {
    622          break;
    623        }
    624      }
    625      WebPIDelete(idec);
    626 
    627      // F) Decoded image is now in config.output (and config.output.u.RGBA).
    628      // It can be saved, displayed or otherwise processed.
    629 
    630      // G) Reclaim memory allocated in config's object. It's safe to call
    631      // this function even if the memory is external and wasn't allocated
    632      // by WebPDecode().
    633      WebPFreeDecBuffer(&config.output);
    634 
    635 -------------------------------------- END PSEUDO EXAMPLE
    636 
    637 Bugs:
    638 =====
    639 
    640 Please report all bugs to our issue tracker:
    641     https://bugs.chromium.org/p/webp
    642 Patches welcome! See this page to get started:
    643     http://www.webmproject.org/code/contribute/submitting-patches/
    644 
    645 Discuss:
    646 ========
    647 
    648 Email: webp-discuss (a] webmproject.org
    649 Web: http://groups.google.com/a/webmproject.org/group/webp-discuss
    650 

README.android

      1 URL: https://chromium.googlesource.com/webm/libwebp
      2 Version: v0.5.0
      3 License: Google BSD like
      4 
      5 Local modifications:
      6 - Rewrite Android.mk to remove duplicate definitions and set module name
      7   in a consistent way with other external libraries
      8 - Copy public headers from src/webp to include/webp, so path to headers
      9   may be appended into CFLAGS without risk for other private headers
     10   (e.g. bits.h) to leak into
     11 - Removed build files necessary for building via autoconf/automake tools
     12   These files are not required to build via Android.mk
     13 - Added a local copy of cpu-features.[hc] to src/dsp
     14 - Removed WEBP_ANDROID_NEON check in dsp.h to avoid breaking non-NEON builds
     15   where the flags in Android.mk are not set correctly currently.
     16 - Marked variable "status" in WebPParseHeaders as volatile to work around
     17   b/25845393
     18 
     19 The Android.mk file creates WebP decoder and encoder static libraries which
     20 can be added to any application by adding to LOCAL_STATIC_LIBRARIES
     21 libwebp-decode libwebp-encode:
     22 
     23   LOCAL_STATIC_LIBRARIES += libwebp-decode libwebp-encode
     24 
     25 

README.version

      1 URL: http://downloads.webmproject.org/releases/webp/libwebp-0.4.1.tar.gz
      2 Version: 0.4.1
      3 BugComponent: 20174
      4