Merge "simplify VP8IteratorSaveBoundary() arg passing"

This commit is contained in:
James Zern 2013-09-06 14:21:42 -07:00 committed by Gerrit Code Review
commit c663bb214a
3 changed files with 11 additions and 14 deletions

View File

@ -720,7 +720,7 @@ static int OneStatPass(VP8Encoder* const enc, float q, VP8RDLevel rd_opt,
distortion += info.D; distortion += info.D;
if (percent_delta && !VP8IteratorProgress(&it, percent_delta)) if (percent_delta && !VP8IteratorProgress(&it, percent_delta))
return 0; return 0;
VP8IteratorSaveBoundary(&it, it.yuv_out_); VP8IteratorSaveBoundary(&it);
} while (VP8IteratorNext(&it) && --nb_mbs > 0); } while (VP8IteratorNext(&it) && --nb_mbs > 0);
size += FinalizeSkipProba(enc); size += FinalizeSkipProba(enc);
size += FinalizeTokenProbas(&enc->proba_); size += FinalizeTokenProbas(&enc->proba_);
@ -884,7 +884,7 @@ int VP8EncLoop(VP8Encoder* const enc) {
VP8StoreFilterStats(&it); VP8StoreFilterStats(&it);
VP8IteratorExport(&it); VP8IteratorExport(&it);
ok = VP8IteratorProgress(&it, 20); ok = VP8IteratorProgress(&it, 20);
VP8IteratorSaveBoundary(&it, it.yuv_out_); VP8IteratorSaveBoundary(&it);
} while (ok && VP8IteratorNext(&it)); } while (ok && VP8IteratorNext(&it));
return PostLoopFinalize(&it, ok); return PostLoopFinalize(&it, ok);
@ -947,7 +947,7 @@ int VP8EncTokenLoop(VP8Encoder* const enc) {
VP8IteratorExport(&it); VP8IteratorExport(&it);
ok = VP8IteratorProgress(&it, 20); ok = VP8IteratorProgress(&it, 20);
} }
VP8IteratorSaveBoundary(&it, it.yuv_out_); VP8IteratorSaveBoundary(&it);
} while (ok && VP8IteratorNext(&it)); } while (ok && VP8IteratorNext(&it));
} }
ok = ok && WebPReportProgress(enc->pic_, enc->percent_ + 20, &enc->percent_); ok = ok && WebPReportProgress(enc->pic_, enc->percent_ + 20, &enc->percent_);

View File

@ -287,20 +287,19 @@ void VP8IteratorBytesToNz(VP8EncIterator* const it) {
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// Advance to the next position, doing the bookeeping. // Advance to the next position, doing the bookeeping.
void VP8IteratorSaveBoundary(VP8EncIterator* const it, void VP8IteratorSaveBoundary(VP8EncIterator* const it) {
const uint8_t* const block_to_save) {
VP8Encoder* const enc = it->enc_; VP8Encoder* const enc = it->enc_;
const int x = it->x_, y = it->y_; const int x = it->x_, y = it->y_;
const uint8_t* const ysrc = block_to_save + Y_OFF; const uint8_t* const ysrc = it->yuv_out_ + Y_OFF;
const uint8_t* const usrc = block_to_save + U_OFF; const uint8_t* const uvsrc = it->yuv_out_ + U_OFF;
if (x < enc->mb_w_ - 1) { // left if (x < enc->mb_w_ - 1) { // left
int i; int i;
for (i = 0; i < 16; ++i) { for (i = 0; i < 16; ++i) {
it->y_left_[i] = ysrc[15 + i * BPS]; it->y_left_[i] = ysrc[15 + i * BPS];
} }
for (i = 0; i < 8; ++i) { for (i = 0; i < 8; ++i) {
it->u_left_[i] = usrc[7 + i * BPS]; it->u_left_[i] = uvsrc[7 + i * BPS];
it->v_left_[i] = usrc[15 + i * BPS]; it->v_left_[i] = uvsrc[15 + i * BPS];
} }
// top-left (before 'top'!) // top-left (before 'top'!)
it->y_left_[-1] = it->y_top_[15]; it->y_left_[-1] = it->y_top_[15];
@ -309,7 +308,7 @@ void VP8IteratorSaveBoundary(VP8EncIterator* const it,
} }
if (y < enc->mb_h_ - 1) { // top if (y < enc->mb_h_ - 1) { // top
memcpy(it->y_top_, ysrc + 15 * BPS, 16); 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);
} }
} }

View File

@ -326,10 +326,8 @@ void VP8IteratorImport(VP8EncIterator* const it, uint8_t* tmp_32);
void VP8IteratorExport(const VP8EncIterator* const it); void VP8IteratorExport(const VP8EncIterator* const it);
// go to next macroblock. Returns false if not finished. // go to next macroblock. Returns false if not finished.
int VP8IteratorNext(VP8EncIterator* const it); int VP8IteratorNext(VP8EncIterator* const it);
// save the boundary values to top_/left_ arrays for next iterations. // save the yuv_out_ 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);
void VP8IteratorSaveBoundary(VP8EncIterator* const it,
const uint8_t* const block_to_save);
// Report progression based on macroblock rows. Return 0 for user-abort request. // Report progression based on macroblock rows. Return 0 for user-abort request.
int VP8IteratorProgress(const VP8EncIterator* const it, int VP8IteratorProgress(const VP8EncIterator* const it,
int final_delta_percent); int final_delta_percent);