1/* 2 * Copyright (c) 2010 The WebM project authors. All Rights Reserved. 3 * 4 * Use of this source code is governed by a BSD-style license 5 * that can be found in the LICENSE file in the root of the source 6 * tree. An additional intellectual property rights grant can be found 7 * in the file PATENTS. All contributing project authors may 8 * be found in the AUTHORS file in the root of the source tree. 9 */ 10 11#ifndef VP9_ENCODER_VP9_BLOCK_H_ 12#define VP9_ENCODER_VP9_BLOCK_H_ 13 14#include "vp9/common/vp9_entropymv.h" 15#include "vp9/common/vp9_entropy.h" 16#include "vpx_ports/mem.h" 17#include "vp9/common/vp9_onyxc_int.h" 18 19#ifdef __cplusplus 20extern "C" { 21#endif 22 23typedef struct { 24 unsigned int sse; 25 int sum; 26 unsigned int var; 27} diff; 28 29struct macroblock_plane { 30 DECLARE_ALIGNED(16, int16_t, src_diff[64 * 64]); 31 tran_low_t *qcoeff; 32 tran_low_t *coeff; 33 uint16_t *eobs; 34 struct buf_2d src; 35 36 // Quantizer setings 37 int16_t *quant_fp; 38 int16_t *round_fp; 39 int16_t *quant; 40 int16_t *quant_shift; 41 int16_t *zbin; 42 int16_t *round; 43 44 int64_t quant_thred[2]; 45 // Zbin Over Quant value 46 int16_t zbin_extra; 47}; 48 49/* The [2] dimension is for whether we skip the EOB node (i.e. if previous 50 * coefficient in this block was zero) or not. */ 51typedef unsigned int vp9_coeff_cost[PLANE_TYPES][REF_TYPES][COEF_BANDS][2] 52 [COEFF_CONTEXTS][ENTROPY_TOKENS]; 53 54typedef struct macroblock MACROBLOCK; 55struct macroblock { 56 struct macroblock_plane plane[MAX_MB_PLANE]; 57 58 MACROBLOCKD e_mbd; 59 int skip_block; 60 int select_tx_size; 61 int skip_recode; 62 int skip_optimize; 63 int q_index; 64 65 int errorperbit; 66 int sadperbit16; 67 int sadperbit4; 68 int rddiv; 69 int rdmult; 70 int mb_energy; 71 72 int mv_best_ref_index[MAX_REF_FRAMES]; 73 unsigned int max_mv_context[MAX_REF_FRAMES]; 74 unsigned int source_variance; 75 unsigned int pred_sse[MAX_REF_FRAMES]; 76 int pred_mv_sad[MAX_REF_FRAMES]; 77 78 int nmvjointcost[MV_JOINTS]; 79 int *nmvcost[2]; 80 int *nmvcost_hp[2]; 81 int **mvcost; 82 83 int nmvjointsadcost[MV_JOINTS]; 84 int *nmvsadcost[2]; 85 int *nmvsadcost_hp[2]; 86 int **mvsadcost; 87 88 // These define limits to motion vector components to prevent them 89 // from extending outside the UMV borders 90 int mv_col_min; 91 int mv_col_max; 92 int mv_row_min; 93 int mv_row_max; 94 95 uint8_t zcoeff_blk[TX_SIZES][256]; 96 int skip; 97 98 int encode_breakout; 99 100 // note that token_costs is the cost when eob node is skipped 101 vp9_coeff_cost token_costs[TX_SIZES]; 102 103 int in_static_area; 104 105 int optimize; 106 107 // indicate if it is in the rd search loop or encoding process 108 int use_lp32x32fdct; 109 int skip_encode; 110 111 // use fast quantization process 112 int quant_fp; 113 114 // skip forward transform and quantization 115 uint8_t skip_txfm[MAX_MB_PLANE << 2]; 116 117 int64_t bsse[MAX_MB_PLANE << 2]; 118 119 // Used to store sub partition's choices. 120 MV pred_mv[MAX_REF_FRAMES]; 121 122 void (*fwd_txm4x4)(const int16_t *input, tran_low_t *output, int stride); 123 void (*itxm_add)(const tran_low_t *input, uint8_t *dest, int stride, int eob); 124#if CONFIG_VP9_HIGHBITDEPTH 125 void (*high_itxm_add)(const tran_low_t *input, uint8_t *dest, int stride, 126 int eob, int bd); 127#endif 128}; 129 130#ifdef __cplusplus 131} // extern "C" 132#endif 133 134#endif // VP9_ENCODER_VP9_BLOCK_H_ 135