summaryrefslogtreecommitdiffstats
path: root/third_party
diff options
context:
space:
mode:
authorfbarchard@chromium.org <fbarchard@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-11-01 23:35:59 +0000
committerfbarchard@chromium.org <fbarchard@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-11-01 23:35:59 +0000
commit6da3e2ef7aa3b9efd321204bfeb26dc908b78d19 (patch)
tree25019f329bdf4ddd24489da15e433973ba0bb472 /third_party
parentf2333df090cf3f00846d2ce3ffe41119718d3cc8 (diff)
downloadchromium_src-6da3e2ef7aa3b9efd321204bfeb26dc908b78d19.zip
chromium_src-6da3e2ef7aa3b9efd321204bfeb26dc908b78d19.tar.gz
chromium_src-6da3e2ef7aa3b9efd321204bfeb26dc908b78d19.tar.bz2
webp minor cleanups and sync to git
BUG=none TEST=none Review URL: http://codereview.chromium.org/4248001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@64683 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'third_party')
-rw-r--r--third_party/libwebp/frame.c72
-rw-r--r--third_party/libwebp/vp8.c2
2 files changed, 35 insertions, 39 deletions
diff --git a/third_party/libwebp/frame.c b/third_party/libwebp/frame.c
index 1e1aadc..b7bb16a 100644
--- a/third_party/libwebp/frame.c
+++ b/third_party/libwebp/frame.c
@@ -9,7 +9,6 @@
//
// Author: Skal (pascal.massimino@gmail.com)
-#include <stddef.h>
#include <stdlib.h>
#include "vp8i.h"
@@ -224,52 +223,49 @@ void VP8StoreBlock(VP8Decoder* const dec) {
}
void VP8FilterRow(VP8Decoder* const dec, VP8Io* io) {
+ const int extra_y_rows = kFilterExtraRows[dec->filter_type_];
+ const int ysize = extra_y_rows * dec->cache_y_stride_;
+ const int uvsize = (extra_y_rows / 2) * dec->cache_uv_stride_;
+ const int first_row = (dec->mb_y_ == 0);
+ const int last_row = (dec->mb_y_ >= dec->mb_h_ - 1);
+ uint8_t* const ydst = dec->cache_y_ - ysize;
+ uint8_t* const udst = dec->cache_u_ - uvsize;
+ uint8_t* const vdst = dec->cache_v_ - uvsize;
int mb_x;
for (mb_x = 0; mb_x < dec->mb_w_; ++mb_x) {
DoFilter(dec, mb_x, dec->mb_y_);
}
- {
- const int extra_y_rows = kFilterExtraRows[dec->filter_type_];
- const int ysize = extra_y_rows * dec->cache_y_stride_;
- const int uvsize = (extra_y_rows / 2) * dec->cache_uv_stride_;
- uint8_t* const ydst = dec->cache_y_ - ysize;
- uint8_t* const udst = dec->cache_u_ - uvsize;
- uint8_t* const vdst = dec->cache_v_ - uvsize;
- if (io->put) {
- int y_end;
- if (dec->mb_y_ > 0) {
- io->mb_y = dec->mb_y_ * 16 - extra_y_rows;
- io->y = ydst;
- io->u = udst;
- io->v = vdst;
- if (dec->mb_y_ < dec->mb_h_ - 1) {
- y_end = io->mb_y + 16;
- } else {
- y_end = io->height; // last macroblock row.
- }
- } else { // first macroblock row.
- io->mb_y = 0;
- y_end = 16 - extra_y_rows;
- io->y = dec->cache_y_;
- io->u = dec->cache_u_;
- io->v = dec->cache_v_;
- }
- if (y_end > io->height) {
- y_end = io->height;
- }
- io->mb_h = y_end - io->mb_y;
- io->put(io);
+ if (io->put) {
+ int y_start = dec->mb_y_ * 16;
+ int y_end = y_start + 16;
+ if (!first_row) {
+ y_start -= extra_y_rows;
+ io->y = ydst;
+ io->u = udst;
+ io->v = vdst;
+ } else {
+ io->y = dec->cache_y_;
+ io->u = dec->cache_u_;
+ io->v = dec->cache_v_;
}
- // rotate top samples
- if (dec->mb_y_ < dec->mb_h_ - 1) {
- memcpy(ydst, ydst + 16 * dec->cache_y_stride_, ysize);
- memcpy(udst, udst + 8 * dec->cache_uv_stride_, uvsize);
- memcpy(vdst, vdst + 8 * dec->cache_uv_stride_, uvsize);
+ if (!last_row) {
+ y_end -= extra_y_rows;
+ }
+ if (y_end > io->height) {
+ y_end = io->height;
}
+ io->mb_y = y_start;
+ io->mb_h = y_end - y_start;
+ io->put(io);
+ }
+ // rotate top samples
+ if (!last_row) {
+ memcpy(ydst, ydst + 16 * dec->cache_y_stride_, ysize);
+ memcpy(udst, udst + 8 * dec->cache_uv_stride_, uvsize);
+ memcpy(vdst, vdst + 8 * dec->cache_uv_stride_, uvsize);
}
}
-
//-----------------------------------------------------------------------------
// Main reconstruction function.
diff --git a/third_party/libwebp/vp8.c b/third_party/libwebp/vp8.c
index 76fc74e..234f361 100644
--- a/third_party/libwebp/vp8.c
+++ b/third_party/libwebp/vp8.c
@@ -223,7 +223,7 @@ int VP8GetHeaders(VP8Decoder* const dec, VP8Io* const io) {
// Paragraph 9.1
{
const uint32_t bits = buf[0] | (buf[1] << 8) | (buf[2] << 16);
- frm_hdr = &dec->frm_hdr_;
+ frm_hdr = &dec->frm_hdr_;
frm_hdr->key_frame_ = !(bits & 1);
frm_hdr->profile_ = (bits >> 1) & 7;
frm_hdr->show_ = (bits >> 4) & 1;