summaryrefslogtreecommitdiff
path: root/libavcodec/webp.c
diff options
context:
space:
mode:
authorJustin Ruggles <justin.ruggles@gmail.com>2014-07-03 11:28:17 -0400
committerJustin Ruggles <justin.ruggles@gmail.com>2014-07-03 15:29:01 -0400
commitc6698dfe7cdbc7634f33245875488ed3fa4a8ced (patch)
treea1813360162d19304031850a2a6ca403fc932550 /libavcodec/webp.c
parent9279826008b80daad7446950a821f32033ccd33f (diff)
webpdec: Fix decoding of the huffman group indices.
Per the specification, "The red and green components of a pixel define the meta Huffman code used in a particular block of the ARGB image."
Diffstat (limited to 'libavcodec/webp.c')
-rw-r--r--libavcodec/webp.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/libavcodec/webp.c b/libavcodec/webp.c
index f9f8bfcbff..b98fa4dea4 100644
--- a/libavcodec/webp.c
+++ b/libavcodec/webp.c
@@ -476,7 +476,9 @@ static int decode_entropy_image(WebPContext *s)
max = 0;
for (y = 0; y < img->frame->height; y++) {
for (x = 0; x < img->frame->width; x++) {
- int p = GET_PIXEL_COMP(img->frame, x, y, 2);
+ int p0 = GET_PIXEL_COMP(img->frame, x, y, 1);
+ int p1 = GET_PIXEL_COMP(img->frame, x, y, 2);
+ int p = p0 << 8 | p1;
max = FFMAX(max, p);
}
}
@@ -561,7 +563,9 @@ static HuffReader *get_huffman_group(WebPContext *s, ImageContext *img,
if (gimg->size_reduction > 0) {
int group_x = x >> gimg->size_reduction;
int group_y = y >> gimg->size_reduction;
- group = GET_PIXEL_COMP(gimg->frame, group_x, group_y, 2);
+ int g0 = GET_PIXEL_COMP(gimg->frame, group_x, group_y, 1);
+ int g1 = GET_PIXEL_COMP(gimg->frame, group_x, group_y, 2);
+ group = g0 << 8 | g1;
}
return &img->huffman_groups[group * HUFFMAN_CODES_PER_META_CODE];