From f691f0e46108d93076e08ca28e78e387c94686ab Mon Sep 17 00:00:00 2001 From: Pascal Massimino Date: Fri, 6 Sep 2013 02:11:16 -0700 Subject: [PATCH] simplify VP8IteratorSaveBoundary() arg passing we only need to save yuv_out_, so no need for the arg Change-Id: I7bad5d910e81ed2eda5c9787821fd1cfe905bd92 --- src/enc/frame.c | 6 +++--- src/enc/iterator.c | 13 ++++++------- src/enc/vp8enci.h | 6 ++---- 3 files changed, 11 insertions(+), 14 deletions(-) diff --git a/src/enc/frame.c b/src/enc/frame.c index 4624d913..33e18c65 100644 --- a/src/enc/frame.c +++ b/src/enc/frame.c @@ -731,7 +731,7 @@ static int OneStatPass(VP8Encoder* const enc, float q, VP8RDLevel rd_opt, distortion += info.D; if (percent_delta && !VP8IteratorProgress(&it, percent_delta)) return 0; - VP8IteratorSaveBoundary(&it, it.yuv_out_); + VP8IteratorSaveBoundary(&it); } while (VP8IteratorNext(&it) && --nb_mbs > 0); size += FinalizeSkipProba(enc); size += FinalizeTokenProbas(&enc->proba_); @@ -895,7 +895,7 @@ int VP8EncLoop(VP8Encoder* const enc) { VP8StoreFilterStats(&it); VP8IteratorExport(&it); ok = VP8IteratorProgress(&it, 20); - VP8IteratorSaveBoundary(&it, it.yuv_out_); + VP8IteratorSaveBoundary(&it); } while (ok && VP8IteratorNext(&it)); return PostLoopFinalize(&it, ok); @@ -958,7 +958,7 @@ int VP8EncTokenLoop(VP8Encoder* const enc) { VP8IteratorExport(&it); ok = VP8IteratorProgress(&it, 20); } - VP8IteratorSaveBoundary(&it, it.yuv_out_); + VP8IteratorSaveBoundary(&it); } while (ok && VP8IteratorNext(&it)); } ok = ok && WebPReportProgress(enc->pic_, enc->percent_ + 20, &enc->percent_); diff --git a/src/enc/iterator.c b/src/enc/iterator.c index 6ad14aa5..ed71423a 100644 --- a/src/enc/iterator.c +++ b/src/enc/iterator.c @@ -287,20 +287,19 @@ void VP8IteratorBytesToNz(VP8EncIterator* const it) { //------------------------------------------------------------------------------ // Advance to the next position, doing the bookeeping. -void VP8IteratorSaveBoundary(VP8EncIterator* const it, - const uint8_t* const block_to_save) { +void VP8IteratorSaveBoundary(VP8EncIterator* const it) { VP8Encoder* const enc = it->enc_; const int x = it->x_, y = it->y_; - const uint8_t* const ysrc = block_to_save + Y_OFF; - const uint8_t* const usrc = block_to_save + U_OFF; + const uint8_t* const ysrc = it->yuv_out_ + Y_OFF; + const uint8_t* const uvsrc = it->yuv_out_ + U_OFF; if (x < enc->mb_w_ - 1) { // left int i; for (i = 0; i < 16; ++i) { it->y_left_[i] = ysrc[15 + i * BPS]; } for (i = 0; i < 8; ++i) { - it->u_left_[i] = usrc[7 + i * BPS]; - it->v_left_[i] = usrc[15 + i * BPS]; + it->u_left_[i] = uvsrc[7 + i * BPS]; + it->v_left_[i] = uvsrc[15 + i * BPS]; } // top-left (before 'top'!) it->y_left_[-1] = it->y_top_[15]; @@ -309,7 +308,7 @@ void VP8IteratorSaveBoundary(VP8EncIterator* const it, } if (y < enc->mb_h_ - 1) { // top memcpy(it->y_top_, ysrc + 15 * BPS, 16); - memcpy(it->uv_top_, usrc + 7 * BPS, 8 + 8); + memcpy(it->uv_top_, uvsrc + 7 * BPS, 8 + 8); } } diff --git a/src/enc/vp8enci.h b/src/enc/vp8enci.h index 9f4cf27f..45d0a558 100644 --- a/src/enc/vp8enci.h +++ b/src/enc/vp8enci.h @@ -326,10 +326,8 @@ void VP8IteratorImport(VP8EncIterator* const it, uint8_t* tmp_32); void VP8IteratorExport(const VP8EncIterator* const it); // go to next macroblock. Returns false if not finished. int VP8IteratorNext(VP8EncIterator* const it); -// save the boundary values to top_/left_ arrays for next iterations. -// block_to_save can be it->yuv_out_ or it->yuv_in_. -void VP8IteratorSaveBoundary(VP8EncIterator* const it, - const uint8_t* const block_to_save); +// save the yuv_out_ boundary values to top_/left_ arrays for next iterations. +void VP8IteratorSaveBoundary(VP8EncIterator* const it); // Report progression based on macroblock rows. Return 0 for user-abort request. int VP8IteratorProgress(const VP8EncIterator* const it, int final_delta_percent);