Lines Matching refs:it

229   // should be prob[VP8EncBands[n]], but it's equivalent for n=0 or 1
299 static void CodeResiduals(VP8BitWriter* const bw, VP8EncIterator* const it,
304 const int i16 = (it->mb_->type_ == 1);
305 const int segment = it->mb_->segment_;
306 VP8Encoder* const enc = it->enc_;
308 VP8IteratorNzToBytes(it);
314 it->top_nz_[8] = it->left_nz_[8] =
315 PutCoeffs(bw, it->top_nz_[8] + it->left_nz_[8], &res);
324 const int ctx = it->top_nz_[x] + it->left_nz_[y];
326 it->top_nz_[x] = it->left_nz_[y] = PutCoeffs(bw, ctx, &res);
336 const int ctx = it->top_nz_[4 + ch + x] + it->left_nz_[4 + ch + y];
338 it->top_nz_[4 + ch + x] = it->left_nz_[4 + ch + y] =
344 it->luma_bits_ = pos2 - pos1;
345 it->uv_bits_ = pos3 - pos2;
346 it->bit_count_[segment][i16] += it->luma_bits_;
347 it->bit_count_[segment][2] += it->uv_bits_;
348 VP8IteratorBytesToNz(it);
352 // Instead, it just records the event distribution.
353 static void RecordResiduals(VP8EncIterator* const it,
357 VP8Encoder* const enc = it->enc_;
359 VP8IteratorNzToBytes(it);
361 if (it->mb_->type_ == 1) { // i16x16
364 it->top_nz_[8] = it->left_nz_[8] =
365 VP8RecordCoeffs(it->top_nz_[8] + it->left_nz_[8], &res);
374 const int ctx = it->top_nz_[x] + it->left_nz_[y];
376 it->top_nz_[x] = it->left_nz_[y] = VP8RecordCoeffs(ctx, &res);
385 const int ctx = it->top_nz_[4 + ch + x] + it->left_nz_[4 + ch + y];
387 it->top_nz_[4 + ch + x] = it->left_nz_[4 + ch + y] =
393 VP8IteratorBytesToNz(it);
401 static int RecordTokens(VP8EncIterator* const it, const VP8ModeScore* const rd,
405 VP8Encoder* const enc = it->enc_;
407 VP8IteratorNzToBytes(it);
408 if (it->mb_->type_ == 1) { // i16x16
409 const int ctx = it->top_nz_[8] + it->left_nz_[8];
412 it->top_nz_[8] = it->left_nz_[8] =
424 const int ctx = it->top_nz_[x] + it->left_nz_[y];
426 it->top_nz_[x] = it->left_nz_[y] =
438 const int ctx = it->top_nz_[4 + ch + x] + it->left_nz_[4 + ch + y];
440 it->top_nz_[4 + ch + x] = it->left_nz_[4 + ch + y] =
447 VP8IteratorBytesToNz(it);
474 static void StoreSSE(const VP8EncIterator* const it) {
475 VP8Encoder* const enc = it->enc_;
476 const uint8_t* const in = it->yuv_in_;
477 const uint8_t* const out = it->yuv_out_;
485 static void StoreSideInfo(const VP8EncIterator* const it) {
486 VP8Encoder* const enc = it->enc_;
487 const VP8MBInfo* const mb = it->mb_;
491 StoreSSE(it);
498 uint8_t* const info = &pic->extra_info[it->x_ + it->y_ * enc->mb_w_];
503 case 4: *info = (mb->type_ == 1) ? it->preds_[0] : 0xff; break;
506 const int b = (int)((it->luma_bits_ + it->uv_bits_ + 7) >> 3);
514 SetBlock(it->yuv_out_ + Y_OFF, mb->segment_ * 64, 16);
515 SetBlock(it->yuv_out_ + U_OFF, it->preds_[0] * 64, 8);
516 SetBlock(it->yuv_out_ + V_OFF, mb->uv_mode_ * 64, 8);
543 VP8EncIterator it;
549 VP8IteratorInit(enc, &it);
553 VP8IteratorImport(&it, NULL);
554 if (VP8Decimate(&it, &info, rd_opt)) {
558 RecordResiduals(&it, &info);
562 if (percent_delta && !VP8IteratorProgress(&it, percent_delta))
564 VP8IteratorSaveBoundary(&it);
565 } while (VP8IteratorNext(&it) && --nb_mbs > 0);
631 // Need to finalize probas now, since it wasn't done during the search.
662 static int PostLoopFinalize(VP8EncIterator* const it, int ok) {
663 VP8Encoder* const enc = it->enc_;
677 enc->residual_bytes_[i][s] = (int)((it->bit_count_[s][i] + 7) >> 3);
681 VP8AdjustFilterStrength(it); // ...and store filter stats.
692 static void ResetAfterSkip(VP8EncIterator* const it) {
693 if (it->mb_->type_ == 1) {
694 *it->nz_ = 0; // reset all predictors
695 it->left_nz_[8] = 0;
697 *it->nz_ &= (1 << 24); // preserve the dc_nz bit
702 VP8EncIterator it;
708 VP8IteratorInit(enc, &it);
709 VP8InitFilter(&it);
715 VP8IteratorImport(&it, NULL);
718 if (!VP8Decimate(&it, &info, rd_opt) || dont_use_skip) {
719 CodeResiduals(it.bw_, &it, &info);
721 ResetAfterSkip(&it);
723 StoreSideInfo(&it);
724 VP8StoreFilterStats(&it);
725 VP8IteratorExport(&it);
726 ok = VP8IteratorProgress(&it, 20);
727 VP8IteratorSaveBoundary(&it);
728 } while (ok && VP8IteratorNext(&it));
730 return PostLoopFinalize(&it, ok);
745 VP8EncIterator it;
771 VP8IteratorInit(enc, &it);
775 VP8InitFilter(&it); // don't collect stats until last pass (too costly)
780 VP8IteratorImport(&it, NULL);
786 VP8Decimate(&it, &info, rd_opt);
787 ok = RecordTokens(&it, &info, &enc->tokens_);
795 StoreSideInfo(&it);
796 VP8StoreFilterStats(&it);
797 VP8IteratorExport(&it);
798 ok = VP8IteratorProgress(&it, 20);
800 VP8IteratorSaveBoundary(&it);
801 } while (ok && VP8IteratorNext(&it));
841 return PostLoopFinalize(&it, ok);