~alinuxninja/nginx-edge/trunk

« back to all changes in this revision

Viewing changes to debian/modules/ngx_pagespeed/psol/include/third_party/libwebp/examples/example_util.h

  • Committer: Vivian
  • Date: 2015-12-04 18:20:11 UTC
  • Revision ID: git-v1:a36f2bc32e884f7473b3a47040e5411306144d7d
* Do not extract psol.tar.gz

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
// Copyright 2012 Google Inc. All Rights Reserved.
2
 
//
3
 
// Use of this source code is governed by a BSD-style license
4
 
// that can be found in the COPYING file in the root of the source
5
 
// tree. An additional intellectual property rights grant can be found
6
 
// in the file PATENTS. All contributing project authors may
7
 
// be found in the AUTHORS file in the root of the source tree.
8
 
// -----------------------------------------------------------------------------
9
 
//
10
 
//  Utility functions used by the example programs.
11
 
//
12
 
 
13
 
#ifndef WEBP_EXAMPLES_EXAMPLE_UTIL_H_
14
 
#define WEBP_EXAMPLES_EXAMPLE_UTIL_H_
15
 
 
16
 
#include "webp/decode.h"
17
 
 
18
 
#ifdef __cplusplus
19
 
extern "C" {
20
 
#endif
21
 
 
22
 
// Allocates storage for entire file 'file_name' and returns contents and size
23
 
// in 'data' and 'data_size'. Returns 1 on success, 0 otherwise. '*data' should
24
 
// be deleted using free().
25
 
// If 'file_name' is NULL or equal to "-", input is read from stdin by calling
26
 
// the function ExUtilReadFromStdin().
27
 
int ExUtilReadFile(const char* const file_name,
28
 
                   const uint8_t** data, size_t* data_size);
29
 
 
30
 
// Same as ExUtilReadFile(), but reads until EOF from stdin instead.
31
 
int ExUtilReadFromStdin(const uint8_t** data, size_t* data_size);
32
 
 
33
 
// Write a data segment into a file named 'file_name'. Returns true if ok.
34
 
// If 'file_name' is NULL or equal to "-", output is written to stdout.
35
 
int ExUtilWriteFile(const char* const file_name,
36
 
                    const uint8_t* data, size_t data_size);
37
 
 
38
 
//------------------------------------------------------------------------------
39
 
// WebP decoding
40
 
 
41
 
// Prints an informative error message regarding decode failure of 'in_file'.
42
 
// 'status' is treated as a VP8StatusCode and if valid will be printed as a
43
 
// text string.
44
 
void ExUtilPrintWebPError(const char* const in_file, int status);
45
 
 
46
 
// Reads a WebP from 'in_file', returning the contents and size in 'data' and
47
 
// 'data_size'. If not NULL, 'bitstream' is populated using WebPGetFeatures().
48
 
// Returns true on success.
49
 
int ExUtilLoadWebP(const char* const in_file,
50
 
                   const uint8_t** data, size_t* data_size,
51
 
                   WebPBitstreamFeatures* bitstream);
52
 
 
53
 
// Decodes the WebP contained in 'data'.
54
 
// 'config' is a structure previously initialized by WebPInitDecoderConfig().
55
 
// 'config->output' should have the desired colorspace selected. 'verbose' will
56
 
// cause decode timing to be reported.
57
 
// Returns the decoder status. On success 'config->output' will contain the
58
 
// decoded picture.
59
 
VP8StatusCode ExUtilDecodeWebP(const uint8_t* const data, size_t data_size,
60
 
                               int verbose, WebPDecoderConfig* const config);
61
 
 
62
 
// Same as ExUtilDecodeWebP(), but using the incremental decoder.
63
 
VP8StatusCode ExUtilDecodeWebPIncremental(
64
 
    const uint8_t* const data, size_t data_size,
65
 
    int verbose, WebPDecoderConfig* const config);
66
 
 
67
 
#ifdef __cplusplus
68
 
}    // extern "C"
69
 
#endif
70
 
 
71
 
#endif  // WEBP_EXAMPLES_EXAMPLE_UTIL_H_