reconintra_mt.c 23.01 KiB
/*
 *  Copyright (c) 2010 The WebM project authors. All Rights Reserved.
 *  Use of this source code is governed by a BSD-style license
 *  that can be found in the LICENSE file in the root of the source
 *  tree. An additional intellectual property rights grant can be found
 *  in the file PATENTS.  All contributing project authors may
 *  be found in the AUTHORS file in the root of the source tree.
 */
#include "vpx_ports/config.h"
#include "vp8/common/reconintra.h"
#include "vpx_mem/vpx_mem.h"
#include "onyxd_int.h"
/* For skip_recon_mb(), add vp8_build_intra_predictors_mby_s(MACROBLOCKD *xd)
 * and vp8_build_intra_predictors_mbuv_s(MACROBLOCKD *xd).
void vp8mt_build_intra_predictors_mby(VP8D_COMP *pbi, MACROBLOCKD *xd,
                                      int mb_row, int mb_col) {
  unsigned char *yabove_row;    /* = xd->dst.y_buffer - xd->dst.y_stride; */
  unsigned char *yleft_col;
  unsigned char yleft_buf[16];
  unsigned char ytop_left;      /* = yabove_row[-1]; */
  unsigned char *ypred_ptr = xd->predictor;
  int r, c, i;
  if (pbi->common.filter_level) {
    yabove_row = pbi->mt_yabove_row[mb_row] + mb_col * 16 + 32;
    yleft_col = pbi->mt_yleft_col[mb_row];
  } else {
    yabove_row = xd->dst.y_buffer - xd->dst.y_stride;
    for (i = 0; i < 16; i++)
      yleft_buf[i] = xd->dst.y_buffer [i * xd->dst.y_stride - 1];
    yleft_col = yleft_buf;
  ytop_left = yabove_row[-1];
  /* for Y */
  switch (xd->mode_info_context->mbmi.mode) {
    case DC_PRED: {
      int expected_dc;
      int i;
      int shift;
      int average = 0;
      if (xd->up_available || xd->left_available) {
        if (xd->up_available) {
          for (i = 0; i < 16; i++) {
            average += yabove_row[i];
        if (xd->left_available) {
          for (i = 0; i < 16; i++) {
            average += yleft_col[i];
        shift = 3 + xd->up_available + xd->left_available;
        expected_dc = (average + (1 << (shift - 1))) >> shift;