Move consts to internal header format_constants.h

Change-Id: Ic6180c16d0b4245680738992925e4608c593fbe8
This commit is contained in:
Urvang Joshi
2012-05-24 14:51:37 +05:30
parent 7f2dfc92dc
commit c13f663261
17 changed files with 105 additions and 101 deletions

View File

@ -21,7 +21,7 @@ libwebpdecodeinclude_HEADERS =
libwebpdecodeinclude_HEADERS += ../webp/decode.h
libwebpdecodeinclude_HEADERS += ../webp/decode_vp8.h
libwebpdecodeinclude_HEADERS += ../webp/types.h
noinst_HEADERS = ../webp/mux.h
noinst_HEADERS = ../webp/format_constants.h
libwebpdecode_la_CPPFLAGS = $(USE_EXPERIMENTAL_CODE)
libwebpdecodeincludedir = $(includedir)/webp

View File

@ -14,17 +14,12 @@
#include "./vp8li.h"
#include "../utils/filters.h"
#include "../utils/quant_levels.h"
#include "../webp/format_constants.h"
#if defined(__cplusplus) || defined(c_plusplus)
extern "C" {
#endif
// TODO(skal): find a common place between enc/ and dec/ for these:
#define ALPHA_HEADER_LEN 1
#define ALPHA_NO_COMPRESSION 0
#define ALPHA_LOSSLESS_COMPRESSION 1
#define ALPHA_PREPROCESSED_LEVELS 1
// TODO(skal): move to dsp/ ?
static void CopyPlane(const uint8_t* src, int src_stride,
uint8_t* dst, int dst_stride, int width, int height) {

View File

@ -20,19 +20,14 @@
extern "C" {
#endif
static const size_t kHeaderBytes = 5;
static const int kImageSizeBits = 14;
#define NUM_ARGB_CACHE_ROWS 16
static const size_t kHeaderBytes = 5;
static const int kCodeLengthLiterals = 16;
static const int kCodeLengthRepeatCode = 16;
static const int kCodeLengthExtraBits[3] = { 2, 3, 7 };
static const int kCodeLengthRepeatOffsets[3] = { 3, 3, 11 };
#define NUM_LENGTH_CODES 24
#define NUM_DISTANCE_CODES 40
#define DEFAULT_CODE_LENGTH 8
#define MAX_CACHE_BITS 11
// -----------------------------------------------------------------------------
// Five Huffman codes are used at each meta code:
// 1. green + length prefix codes + color cache codes,
@ -86,12 +81,12 @@ static int DecodeImageStream(int xsize, int ysize,
static int ReadImageSize(VP8LBitReader* const br,
int* const width, int* const height) {
const int signature = VP8LReadBits(br, 8);
if (signature != LOSSLESS_MAGIC_BYTE &&
signature != LOSSLESS_MAGIC_BYTE_RSVD) {
if (signature != VP8L_MAGIC_BYTE &&
signature != VP8L_MAGIC_BYTE_RSVD) {
return 0;
}
*width = VP8LReadBits(br, kImageSizeBits) + 1;
*height = VP8LReadBits(br, kImageSizeBits) + 1;
*width = VP8LReadBits(br, VP8L_IMAGE_SIZE_BITS) + 1;
*height = VP8LReadBits(br, VP8L_IMAGE_SIZE_BITS) + 1;
return 1;
}

View File

@ -18,32 +18,18 @@
#include "../utils/bit_reader.h"
#include "../utils/color_cache.h"
#include "../utils/huffman.h"
#include "../webp/format_constants.h"
#if defined(__cplusplus) || defined(c_plusplus)
extern "C" {
#endif
#define NUM_TRANSFORMS 4
#define HUFFMAN_CODES_PER_META_CODE 5
#define ARGB_BLACK 0xff000000
#define NUM_LITERAL_CODES 256
#define NUM_ARGB_CACHE_ROWS 16
#define LOSSLESS_MAGIC_BYTE 0x64
#define LOSSLESS_MAGIC_BYTE_RSVD 0x65
typedef enum {
READ_DATA = 0,
READ_HDR = 1,
READ_DIM = 2
} VP8LDecodeState;
typedef enum {
PREDICTOR_TRANSFORM = 0,
CROSS_COLOR_TRANSFORM = 1,
SUBTRACT_GREEN = 2,
COLOR_INDEXING_TRANSFORM = 3
} VP8LImageTransformType;
typedef struct VP8LTransform VP8LTransform;
struct VP8LTransform {
VP8LImageTransformType type_; // transform type.

View File

@ -14,8 +14,7 @@
#include "./vp8i.h"
#include "./vp8li.h"
#include "./webpi.h"
#include "../mux/muxi.h" // For MAX_CHUNK_PAYLOAD.
#include "../webp/mux.h" // For 'ALPHA_FLAG'.
#include "../webp/format_constants.h"
#if defined(__cplusplus) || defined(c_plusplus)
extern "C" {
@ -552,7 +551,7 @@ static VP8StatusCode GetFeatures(const uint8_t* data, size_t data_size,
if (status != VP8_STATUS_OK) {
return status; // Wrong VP8X / insufficient data.
}
features->has_alpha = !!(flags & ALPHA_FLAG);
features->has_alpha = !!(flags & ALPHA_FLAG_BIT);
if (found_vp8x) {
return VP8_STATUS_OK; // Return features from VP8X header.
}

View File

@ -16,8 +16,8 @@
extern "C" {
#endif
#include "../webp/decode_vp8.h"
#include "../utils/rescaler.h"
#include "../webp/decode_vp8.h"
//------------------------------------------------------------------------------
// WebPDecParams: Decoding output parameters. Transient internal object.
@ -45,15 +45,6 @@ void WebPResetDecParams(WebPDecParams* const params);
//------------------------------------------------------------------------------
// Header parsing helpers
#define TAG_SIZE 4
#define CHUNK_HEADER_SIZE 8
#define RIFF_HEADER_SIZE 12
#define FRAME_CHUNK_SIZE 20
#define LOOP_CHUNK_SIZE 4
#define TILE_CHUNK_SIZE 8
#define VP8X_CHUNK_SIZE 12
#define VP8_FRAME_HEADER_SIZE 10 // Size of the frame header within VP8 data.
// Structure storing a description of the RIFF headers.
typedef struct {
const uint8_t* data; // input buffer