media/libvpx/vp9/common/vp9_reconinter.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/media/libvpx/vp9/common/vp9_reconinter.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,103 @@
     1.4 +/*
     1.5 + *  Copyright (c) 2010 The WebM project authors. All Rights Reserved.
     1.6 + *
     1.7 + *  Use of this source code is governed by a BSD-style license
     1.8 + *  that can be found in the LICENSE file in the root of the source
     1.9 + *  tree. An additional intellectual property rights grant can be found
    1.10 + *  in the file PATENTS.  All contributing project authors may
    1.11 + *  be found in the AUTHORS file in the root of the source tree.
    1.12 + */
    1.13 +
    1.14 +#ifndef VP9_COMMON_VP9_RECONINTER_H_
    1.15 +#define VP9_COMMON_VP9_RECONINTER_H_
    1.16 +
    1.17 +#include "vpx/vpx_integer.h"
    1.18 +#include "vp9/common/vp9_onyxc_int.h"
    1.19 +
    1.20 +struct subpix_fn_table;
    1.21 +void vp9_build_inter_predictors_sby(MACROBLOCKD *xd, int mi_row, int mi_col,
    1.22 +                                    BLOCK_SIZE bsize);
    1.23 +
    1.24 +void vp9_build_inter_predictors_sbuv(MACROBLOCKD *xd, int mi_row, int mi_col,
    1.25 +                                     BLOCK_SIZE bsize);
    1.26 +
    1.27 +void vp9_build_inter_predictors_sb(MACROBLOCKD *xd, int mi_row, int mi_col,
    1.28 +                                   BLOCK_SIZE bsize);
    1.29 +
    1.30 +void vp9_setup_interp_filters(MACROBLOCKD *xd,
    1.31 +                              INTERPOLATION_TYPE filter,
    1.32 +                              VP9_COMMON *cm);
    1.33 +
    1.34 +void vp9_build_inter_predictor(const uint8_t *src, int src_stride,
    1.35 +                               uint8_t *dst, int dst_stride,
    1.36 +                               const MV *mv_q3,
    1.37 +                               const struct scale_factors *scale,
    1.38 +                               int w, int h, int do_avg,
    1.39 +                               const struct subpix_fn_table *subpix,
    1.40 +                               enum mv_precision precision);
    1.41 +
    1.42 +static int scaled_buffer_offset(int x_offset, int y_offset, int stride,
    1.43 +                                const struct scale_factors *scale) {
    1.44 +  const int x = scale ? scale->sfc->scale_value_x(x_offset, scale->sfc) :
    1.45 +      x_offset;
    1.46 +  const int y = scale ? scale->sfc->scale_value_y(y_offset, scale->sfc) :
    1.47 +      y_offset;
    1.48 +  return y * stride + x;
    1.49 +}
    1.50 +
    1.51 +static void setup_pred_plane(struct buf_2d *dst,
    1.52 +                             uint8_t *src, int stride,
    1.53 +                             int mi_row, int mi_col,
    1.54 +                             const struct scale_factors *scale,
    1.55 +                             int subsampling_x, int subsampling_y) {
    1.56 +  const int x = (MI_SIZE * mi_col) >> subsampling_x;
    1.57 +  const int y = (MI_SIZE * mi_row) >> subsampling_y;
    1.58 +  dst->buf = src + scaled_buffer_offset(x, y, stride, scale);
    1.59 +  dst->stride = stride;
    1.60 +}
    1.61 +
    1.62 +// TODO(jkoleszar): audit all uses of this that don't set mb_row, mb_col
    1.63 +static void setup_dst_planes(MACROBLOCKD *xd,
    1.64 +                             const YV12_BUFFER_CONFIG *src,
    1.65 +                             int mi_row, int mi_col) {
    1.66 +  uint8_t *buffers[4] = {src->y_buffer, src->u_buffer, src->v_buffer,
    1.67 +                         src->alpha_buffer};
    1.68 +  int strides[4] = {src->y_stride, src->uv_stride, src->uv_stride,
    1.69 +                    src->alpha_stride};
    1.70 +  int i;
    1.71 +
    1.72 +  for (i = 0; i < MAX_MB_PLANE; ++i) {
    1.73 +    struct macroblockd_plane *pd = &xd->plane[i];
    1.74 +    setup_pred_plane(&pd->dst, buffers[i], strides[i], mi_row, mi_col, NULL,
    1.75 +                     pd->subsampling_x, pd->subsampling_y);
    1.76 +  }
    1.77 +}
    1.78 +
    1.79 +static void setup_pre_planes(MACROBLOCKD *xd, int i,
    1.80 +                             const YV12_BUFFER_CONFIG *src,
    1.81 +                             int mi_row, int mi_col,
    1.82 +                             const struct scale_factors *sf) {
    1.83 +  if (src) {
    1.84 +    int j;
    1.85 +    uint8_t* buffers[4] = {src->y_buffer, src->u_buffer, src->v_buffer,
    1.86 +                           src->alpha_buffer};
    1.87 +    int strides[4] = {src->y_stride, src->uv_stride, src->uv_stride,
    1.88 +                      src->alpha_stride};
    1.89 +
    1.90 +    for (j = 0; j < MAX_MB_PLANE; ++j) {
    1.91 +      struct macroblockd_plane *pd = &xd->plane[j];
    1.92 +      setup_pred_plane(&pd->pre[i], buffers[j], strides[j],
    1.93 +                     mi_row, mi_col, sf, pd->subsampling_x, pd->subsampling_y);
    1.94 +    }
    1.95 +  }
    1.96 +}
    1.97 +
    1.98 +static void set_scale_factors(MACROBLOCKD *xd, int ref0, int ref1,
    1.99 +                              struct scale_factors sf[MAX_REF_FRAMES]) {
   1.100 +  xd->scale_factor[0] = sf[ref0 >= 0 ? ref0 : 0];
   1.101 +  xd->scale_factor[1] = sf[ref1 >= 0 ? ref1 : 0];
   1.102 +}
   1.103 +
   1.104 +void vp9_setup_scale_factors(VP9_COMMON *cm, int i);
   1.105 +
   1.106 +#endif  // VP9_COMMON_VP9_RECONINTER_H_

mercurial