encodeframe.c 66.9 KB
Newer Older
                second_ref_fb_idx = cpi->common.alt_fb_idx;

            xd->second_pre.y_buffer = cpi->common.yv12_fb[second_ref_fb_idx].y_buffer +
                                            recon_yoffset;
            xd->second_pre.u_buffer = cpi->common.yv12_fb[second_ref_fb_idx].u_buffer +
                                            recon_uvoffset;
            xd->second_pre.v_buffer = cpi->common.yv12_fb[second_ref_fb_idx].v_buffer +
                                            recon_uvoffset;
        }
#endif /* CONFIG_DUALPRED */

Scott LaVarnway's avatar
Scott LaVarnway committed
        if (!x->skip)
John Koleszar's avatar
John Koleszar committed
        {
            vp8_encode_inter16x16(IF_RTCD(&cpi->rtcd), x);

            // Clear mb_skip_coeff if mb_no_coeff_skip is not set
            if (!cpi->common.mb_no_coeff_skip)
                xd->mode_info_context->mbmi.mb_skip_coeff = 0;
            vp8_build_inter16x16_predictors_mb(xd, xd->dst.y_buffer,
                                           xd->dst.u_buffer, xd->dst.v_buffer,
                                           xd->dst.y_stride, xd->dst.uv_stride);
John Koleszar's avatar
John Koleszar committed
    }
#if CONFIG_T8X8
    if ( get_seg_tx_type( xd, *segment_id ) == TX_8X8 )
    {
        cpi->t8x8_count++;
    else
        cpi->t4x4_count++;
#endif
John Koleszar's avatar
John Koleszar committed

    if (!x->skip)
    {
#ifdef ENC_DEBUG
        if (enc_debug)
        {
          int i;
            printf("Segment=%d [%d, %d]: %d %d:\n", x->e_mbd.mode_info_context->mbmi.segment_id, mb_col_debug, mb_row_debug, xd->mb_to_left_edge, xd->mb_to_top_edge);
            for (i =0; i<400; i++) {
              printf("%3d ", xd->qcoeff[i]);
              if (i%16 == 15) printf("\n");
            }
            printf("\n");
            printf("eobs = ");
            for (i=0;i<25;i++)
              printf("%d:%d ", i, xd->block[i].eob);
            printf("\n");
            fflush(stdout);
        }
#endif
John Koleszar's avatar
John Koleszar committed
        vp8_tokenize_mb(cpi, xd, t);
#ifdef ENC_DEBUG
        if (enc_debug) {
          printf("Tokenized\n");
          fflush(stdout);
        }
#endif
    }
John Koleszar's avatar
John Koleszar committed
    else
    {
        if (cpi->common.mb_no_coeff_skip)
        {
            xd->mode_info_context->mbmi.mb_skip_coeff = 1;
John Koleszar's avatar
John Koleszar committed
            cpi->skip_true_count ++;
            vp8_fix_contexts(xd);
John Koleszar's avatar
John Koleszar committed
        }
        else
        {
            vp8_stuff_mb(cpi, xd, t);
            xd->mode_info_context->mbmi.mb_skip_coeff = 0;
John Koleszar's avatar
John Koleszar committed
            cpi->skip_false_count ++;
        }
    }

    return rate;
}