Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(80)

Side by Side Diff: third_party/libwebp/enc/iterator_enc.c

Issue 2651883004: libwebp-0.6.0-rc1 (Closed)
Patch Set: Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/libwebp/enc/iterator.c ('k') | third_party/libwebp/enc/near_lossless.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 Google Inc. All Rights Reserved. 1 // Copyright 2011 Google Inc. All Rights Reserved.
2 // 2 //
3 // Use of this source code is governed by a BSD-style license 3 // Use of this source code is governed by a BSD-style license
4 // that can be found in the COPYING file in the root of the source 4 // that can be found in the COPYING file in the root of the source
5 // tree. An additional intellectual property rights grant can be found 5 // tree. An additional intellectual property rights grant can be found
6 // in the file PATENTS. All contributing project authors may 6 // in the file PATENTS. All contributing project authors may
7 // be found in the AUTHORS file in the root of the source tree. 7 // be found in the AUTHORS file in the root of the source tree.
8 // ----------------------------------------------------------------------------- 8 // -----------------------------------------------------------------------------
9 // 9 //
10 // VP8Iterator: block iterator 10 // VP8Iterator: block iterator
11 // 11 //
12 // Author: Skal (pascal.massimino@gmail.com) 12 // Author: Skal (pascal.massimino@gmail.com)
13 13
14 #include <string.h> 14 #include <string.h>
15 15
16 #include "./vp8enci.h" 16 #include "./vp8i_enc.h"
17 17
18 //------------------------------------------------------------------------------ 18 //------------------------------------------------------------------------------
19 // VP8Iterator 19 // VP8Iterator
20 //------------------------------------------------------------------------------ 20 //------------------------------------------------------------------------------
21 21
22 static void InitLeft(VP8EncIterator* const it) { 22 static void InitLeft(VP8EncIterator* const it) {
23 it->y_left_[-1] = it->u_left_[-1] = it->v_left_[-1] = 23 it->y_left_[-1] = it->u_left_[-1] = it->v_left_[-1] =
24 (it->y_ > 0) ? 129 : 127; 24 (it->y_ > 0) ? 129 : 127;
25 memset(it->y_left_, 129, 16); 25 memset(it->y_left_, 129, 16);
26 memset(it->u_left_, 129, 8); 26 memset(it->u_left_, 129, 8);
(...skipping 19 matching lines...) Expand all
46 it->y_top_ = enc->y_top_; 46 it->y_top_ = enc->y_top_;
47 it->uv_top_ = enc->uv_top_; 47 it->uv_top_ = enc->uv_top_;
48 InitLeft(it); 48 InitLeft(it);
49 } 49 }
50 50
51 void VP8IteratorReset(VP8EncIterator* const it) { 51 void VP8IteratorReset(VP8EncIterator* const it) {
52 VP8Encoder* const enc = it->enc_; 52 VP8Encoder* const enc = it->enc_;
53 VP8IteratorSetRow(it, 0); 53 VP8IteratorSetRow(it, 0);
54 VP8IteratorSetCountDown(it, enc->mb_w_ * enc->mb_h_); // default 54 VP8IteratorSetCountDown(it, enc->mb_w_ * enc->mb_h_); // default
55 InitTop(it); 55 InitTop(it);
56 InitLeft(it);
57 memset(it->bit_count_, 0, sizeof(it->bit_count_)); 56 memset(it->bit_count_, 0, sizeof(it->bit_count_));
58 it->do_trellis_ = 0; 57 it->do_trellis_ = 0;
59 } 58 }
60 59
61 void VP8IteratorSetCountDown(VP8EncIterator* const it, int count_down) { 60 void VP8IteratorSetCountDown(VP8EncIterator* const it, int count_down) {
62 it->count_down_ = it->count_down0_ = count_down; 61 it->count_down_ = it->count_down0_ = count_down;
63 } 62 }
64 63
65 int VP8IteratorIsDone(const VP8EncIterator* const it) { 64 int VP8IteratorIsDone(const VP8EncIterator* const it) {
66 return (it->count_down_ <= 0); 65 return (it->count_down_ <= 0);
67 } 66 }
68 67
69 void VP8IteratorInit(VP8Encoder* const enc, VP8EncIterator* const it) { 68 void VP8IteratorInit(VP8Encoder* const enc, VP8EncIterator* const it) {
70 it->enc_ = enc; 69 it->enc_ = enc;
71 it->y_stride_ = enc->pic_->y_stride;
72 it->uv_stride_ = enc->pic_->uv_stride;
73 it->yuv_in_ = (uint8_t*)WEBP_ALIGN(it->yuv_mem_); 70 it->yuv_in_ = (uint8_t*)WEBP_ALIGN(it->yuv_mem_);
74 it->yuv_out_ = it->yuv_in_ + YUV_SIZE_ENC; 71 it->yuv_out_ = it->yuv_in_ + YUV_SIZE_ENC;
75 it->yuv_out2_ = it->yuv_out_ + YUV_SIZE_ENC; 72 it->yuv_out2_ = it->yuv_out_ + YUV_SIZE_ENC;
76 it->yuv_p_ = it->yuv_out2_ + YUV_SIZE_ENC; 73 it->yuv_p_ = it->yuv_out2_ + YUV_SIZE_ENC;
77 it->lf_stats_ = enc->lf_stats_; 74 it->lf_stats_ = enc->lf_stats_;
78 it->percent0_ = enc->percent_; 75 it->percent0_ = enc->percent_;
79 it->y_left_ = (uint8_t*)WEBP_ALIGN(it->yuv_left_mem_ + 1); 76 it->y_left_ = (uint8_t*)WEBP_ALIGN(it->yuv_left_mem_ + 1);
80 it->u_left_ = it->y_left_ + 16 + 16; 77 it->u_left_ = it->y_left_ + 16 + 16;
81 it->v_left_ = it->u_left_ + 16; 78 it->v_left_ = it->u_left_ + 16;
82 VP8IteratorReset(it); 79 VP8IteratorReset(it);
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
302 it->u_left_[-1] = it->uv_top_[0 + 7]; 299 it->u_left_[-1] = it->uv_top_[0 + 7];
303 it->v_left_[-1] = it->uv_top_[8 + 7]; 300 it->v_left_[-1] = it->uv_top_[8 + 7];
304 } 301 }
305 if (y < enc->mb_h_ - 1) { // top 302 if (y < enc->mb_h_ - 1) { // top
306 memcpy(it->y_top_, ysrc + 15 * BPS, 16); 303 memcpy(it->y_top_, ysrc + 15 * BPS, 16);
307 memcpy(it->uv_top_, uvsrc + 7 * BPS, 8 + 8); 304 memcpy(it->uv_top_, uvsrc + 7 * BPS, 8 + 8);
308 } 305 }
309 } 306 }
310 307
311 int VP8IteratorNext(VP8EncIterator* const it) { 308 int VP8IteratorNext(VP8EncIterator* const it) {
312 it->preds_ += 4; 309 if (++it->x_ == it->enc_->mb_w_) {
313 it->mb_ += 1;
314 it->nz_ += 1;
315 it->y_top_ += 16;
316 it->uv_top_ += 16;
317 it->x_ += 1;
318 if (it->x_ == it->enc_->mb_w_) {
319 VP8IteratorSetRow(it, ++it->y_); 310 VP8IteratorSetRow(it, ++it->y_);
311 } else {
312 it->preds_ += 4;
313 it->mb_ += 1;
314 it->nz_ += 1;
315 it->y_top_ += 16;
316 it->uv_top_ += 16;
320 } 317 }
321 return (0 < --it->count_down_); 318 return (0 < --it->count_down_);
322 } 319 }
323 320
324 //------------------------------------------------------------------------------ 321 //------------------------------------------------------------------------------
325 // Helper function to set mode properties 322 // Helper function to set mode properties
326 323
327 void VP8SetIntra16Mode(const VP8EncIterator* const it, int mode) { 324 void VP8SetIntra16Mode(const VP8EncIterator* const it, int mode) {
328 uint8_t* preds = it->preds_; 325 uint8_t* preds = it->preds_;
329 int y; 326 int y;
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
447 if (it->i4_ == 16) { // we're done 444 if (it->i4_ == 16) { // we're done
448 return 0; 445 return 0;
449 } 446 }
450 447
451 it->i4_top_ = it->i4_boundary_ + VP8TopLeftI4[it->i4_]; 448 it->i4_top_ = it->i4_boundary_ + VP8TopLeftI4[it->i4_];
452 return 1; 449 return 1;
453 } 450 }
454 451
455 //------------------------------------------------------------------------------ 452 //------------------------------------------------------------------------------
456 453
OLDNEW
« no previous file with comments | « third_party/libwebp/enc/iterator.c ('k') | third_party/libwebp/enc/near_lossless.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698