diff options
Diffstat (limited to 'src/enc/syntax.c')
-rw-r--r-- | src/enc/syntax.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/src/enc/syntax.c b/src/enc/syntax.c index 4b20c1aa..99c21fec 100644 --- a/src/enc/syntax.c +++ b/src/enc/syntax.c @@ -11,9 +11,8 @@ #include <assert.h> -#include "../utils/utils.h" -#include "webp/format_constants.h" #include "./vp8enci.h" +#include "webp/format_constants.h" #if defined(__cplusplus) || defined(c_plusplus) extern "C" { @@ -22,6 +21,18 @@ extern "C" { //------------------------------------------------------------------------------ // Helper functions +// TODO(later): Move to webp/format_constants.h? +static void PutLE24(uint8_t* const data, uint32_t val) { + data[0] = (val >> 0) & 0xff; + data[1] = (val >> 8) & 0xff; + data[2] = (val >> 16) & 0xff; +} + +static void PutLE32(uint8_t* const data, uint32_t val) { + PutLE24(data, val); + data[3] = (val >> 24) & 0xff; +} + static int IsVP8XNeeded(const VP8Encoder* const enc) { return !!enc->has_alpha_; // Currently the only case when VP8X is needed. // This could change in the future. @@ -62,7 +73,7 @@ static WebPEncodingError PutVP8XHeader(const VP8Encoder* const enc) { assert(pic->width <= MAX_CANVAS_SIZE && pic->height <= MAX_CANVAS_SIZE); if (enc->has_alpha_) { - flags |= ALPHA_FLAG; + flags |= ALPHA_FLAG_BIT; } PutLE32(vp8x + TAG_SIZE, VP8X_CHUNK_SIZE); |