Home | History | Annotate | Download | only in enc

Lines Matching refs:it

235   // should be prob[VP8EncBands[n]], but it's equivalent for n=0 or 1
306 static void CodeResiduals(VP8BitWriter* const bw, VP8EncIterator* const it,
311 const int i16 = (it->mb_->type_ == 1);
312 const int segment = it->mb_->segment_;
313 VP8Encoder* const enc = it->enc_;
315 VP8IteratorNzToBytes(it);
321 it->top_nz_[8] = it->left_nz_[8] =
322 PutCoeffs(bw, it->top_nz_[8] + it->left_nz_[8], &res);
331 const int ctx = it->top_nz_[x] + it->left_nz_[y];
333 it->top_nz_[x] = it->left_nz_[y] = PutCoeffs(bw, ctx, &res);
343 const int ctx = it->top_nz_[4 + ch + x] + it->left_nz_[4 + ch + y];
345 it->top_nz_[4 + ch + x] = it->left_nz_[4 + ch + y] =
351 it->luma_bits_ = pos2 - pos1;
352 it->uv_bits_ = pos3 - pos2;
353 it->bit_count_[segment][i16] += it->luma_bits_;
354 it->bit_count_[segment][2] += it->uv_bits_;
355 VP8IteratorBytesToNz(it);
359 // Instead, it just records the event distribution.
360 static void RecordResiduals(VP8EncIterator* const it,
364 VP8Encoder* const enc = it->enc_;
366 VP8IteratorNzToBytes(it);
368 if (it->mb_->type_ == 1) { // i16x16
371 it->top_nz_[8] = it->left_nz_[8] =
372 VP8RecordCoeffs(it->top_nz_[8] + it->left_nz_[8], &res);
381 const int ctx = it->top_nz_[x] + it->left_nz_[y];
383 it->top_nz_[x] = it->left_nz_[y] = VP8RecordCoeffs(ctx, &res);
392 const int ctx = it->top_nz_[4 + ch + x] + it->left_nz_[4 + ch + y];
394 it->top_nz_[4 + ch + x] = it->left_nz_[4 + ch + y] =
400 VP8IteratorBytesToNz(it);
408 static int RecordTokens(VP8EncIterator* const it, const VP8ModeScore* const rd,
412 VP8Encoder* const enc = it->enc_;
414 VP8IteratorNzToBytes(it);
415 if (it->mb_->type_ == 1) { // i16x16
416 const int ctx = it->top_nz_[8] + it->left_nz_[8];
419 it->top_nz_[8] = it->left_nz_[8] =
429 const int ctx = it->top_nz_[x] + it->left_nz_[y];
431 it->top_nz_[x] = it->left_nz_[y] =
441 const int ctx = it->top_nz_[4 + ch + x] + it->left_nz_[4 + ch + y];
443 it->top_nz_[4 + ch + x] = it->left_nz_[4 + ch + y] =
448 VP8IteratorBytesToNz(it);
477 static void StoreSSE(const VP8EncIterator* const it) {
478 VP8Encoder* const enc = it->enc_;
479 const uint8_t* const in = it->yuv_in_;
480 const uint8_t* const out = it->yuv_out_;
488 static void StoreSideInfo(const VP8EncIterator* const it) {
489 VP8Encoder* const enc = it->enc_;
490 const VP8MBInfo* const mb = it->mb_;
494 StoreSSE(it);
501 uint8_t* const info = &pic->extra_info[it->x_ + it->y_ * enc->mb_w_];
506 it->preds_[0] : 0xff; break;
509 const int b = (int)((it->luma_bits_ + it->uv_bits_ + 7) >> 3);
517 SetBlock(it->yuv_out_ + Y_OFF_ENC, mb->segment_ * 64, 16);
518 SetBlock(it->yuv_out_ + U_OFF_ENC, it->preds_[0] * 64, 8);
519 SetBlock(it->yuv_out_ + V_OFF_ENC, mb->uv_mode_ * 64, 8);
527 static void StoreSideInfo(const VP8EncIterator* const it) {
528 VP8Encoder* const enc = it->enc_;
543 // This is used for deciding optimal probabilities. It also modifies the
560 VP8EncIterator it;
566 VP8IteratorInit(enc, &it);
570 VP8IteratorImport(&it, NULL);
571 if (VP8Decimate(&it, &info, rd_opt)) {
575 RecordResiduals(&it, &info);
579 if (percent_delta && !VP8IteratorProgress(&it, percent_delta)) {
582 VP8IteratorSaveBoundary(&it);
583 } while (VP8IteratorNext(&it) && --nb_mbs > 0);
649 // Need to finalize probas now, since it wasn't done during the search.
680 static int PostLoopFinalize(VP8EncIterator* const it, int ok) {
681 VP8Encoder* const enc = it->enc_;
696 enc->residual_bytes_[i][s] = (int)((it->bit_count_[s][i] + 7) >> 3);
701 VP8AdjustFilterStrength(it); // ...and store filter stats.
712 static void ResetAfterSkip(VP8EncIterator* const it) {
713 if (it->mb_->type_ == 1) {
714 *it->nz_ = 0; // reset all predictors
715 it->left_nz_[8] = 0;
717 *it->nz_ &= (1 << 24); // preserve the dc_nz bit
722 VP8EncIterator it;
728 VP8IteratorInit(enc, &it);
729 VP8InitFilter(&it);
735 VP8IteratorImport(&it, NULL);
738 if (!VP8Decimate(&it, &info, rd_opt) || dont_use_skip) {
739 CodeResiduals(it.bw_, &it, &info);
741 ResetAfterSkip(&it);
743 StoreSideInfo(&it);
744 VP8StoreFilterStats(&it);
745 VP8IteratorExport(&it);
746 ok = VP8IteratorProgress(&it, 20);
747 VP8IteratorSaveBoundary(&it);
748 } while (ok && VP8IteratorNext(&it));
750 return PostLoopFinalize(&it, ok);
765 VP8EncIterator it;
791 VP8IteratorInit(enc, &it);
795 VP8InitFilter(&it); // don't collect stats until last pass (too costly)
800 VP8IteratorImport(&it, NULL);
806 VP8Decimate(&it, &info, rd_opt);
807 ok = RecordTokens(&it, &info, &enc->tokens_);
815 StoreSideInfo(&it);
816 VP8StoreFilterStats(&it);
817 VP8IteratorExport(&it);
818 ok = VP8IteratorProgress(&it, 20);
820 VP8IteratorSaveBoundary(&it);
821 } while (ok && VP8IteratorNext(&it));
861 return PostLoopFinalize(&it, ok);