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

@ -27,17 +27,9 @@
extern "C" {
#endif
#define PALETTE_KEY_RIGHT_SHIFT 22 // Key for 1K buffer.
#define MAX_HUFF_IMAGE_SIZE (32 * 1024 * 1024)
// TODO(vikas): find a common place between enc and dec for these:
#define PREDICTOR_TRANSFORM 0
#define CROSS_COLOR_TRANSFORM 1
#define SUBTRACT_GREEN 2
#define COLOR_INDEXING_TRANSFORM 3
#define TRANSFORM_PRESENT 1
#define IMAGE_SIZE_BITS 14
// -----------------------------------------------------------------------------
// Palette
@ -640,9 +632,9 @@ static void PutLE32(uint8_t* const data, uint32_t val) {
static WebPEncodingError WriteRiffHeader(const WebPPicture* const pic,
size_t riff_size, size_t vp8l_size) {
uint8_t riff[HEADER_SIZE + SIGNATURE_SIZE] = {
uint8_t riff[RIFF_HEADER_SIZE + CHUNK_HEADER_SIZE + VP8L_SIGNATURE_SIZE] = {
'R', 'I', 'F', 'F', 0, 0, 0, 0, 'W', 'E', 'B', 'P',
'V', 'P', '8', 'L', 0, 0, 0, 0, LOSSLESS_MAGIC_BYTE,
'V', 'P', '8', 'L', 0, 0, 0, 0, VP8L_MAGIC_BYTE,
};
PutLE32(riff + TAG_SIZE, (uint32_t)riff_size);
PutLE32(riff + RIFF_HEADER_SIZE + TAG_SIZE, (uint32_t)vp8l_size);
@ -658,8 +650,8 @@ static int WriteImageSize(const WebPPicture* const pic,
const int height = pic->height -1;
assert(width < WEBP_MAX_DIMENSION && height < WEBP_MAX_DIMENSION);
VP8LWriteBits(bw, IMAGE_SIZE_BITS, width);
VP8LWriteBits(bw, IMAGE_SIZE_BITS, height);
VP8LWriteBits(bw, VP8L_IMAGE_SIZE_BITS, width);
VP8LWriteBits(bw, VP8L_IMAGE_SIZE_BITS, height);
return !bw->error_;
}
@ -669,7 +661,7 @@ static WebPEncodingError WriteImage(const WebPPicture* const pic,
WebPEncodingError err = VP8_ENC_OK;
const uint8_t* const webpll_data = VP8LBitWriterFinish(bw);
const size_t webpll_size = VP8LBitWriterNumBytes(bw);
const size_t vp8l_size = SIGNATURE_SIZE + webpll_size;
const size_t vp8l_size = VP8L_SIGNATURE_SIZE + webpll_size;
const size_t pad = vp8l_size & 1;
const size_t riff_size = TAG_SIZE + CHUNK_HEADER_SIZE + vp8l_size + pad;