OLD | NEW |
(Empty) | |
| 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 |
| 12 #ifndef VP9_ENCODER_VP9_BLOCK_H_ |
| 13 #define VP9_ENCODER_VP9_BLOCK_H_ |
| 14 |
| 15 #include "vp9/common/vp9_onyx.h" |
| 16 #include "vp9/common/vp9_entropymv.h" |
| 17 #include "vp9/common/vp9_entropy.h" |
| 18 #include "vpx_ports/mem.h" |
| 19 #include "vp9/common/vp9_onyxc_int.h" |
| 20 |
| 21 // motion search site |
| 22 typedef struct { |
| 23 MV mv; |
| 24 int offset; |
| 25 } search_site; |
| 26 |
| 27 typedef struct block { |
| 28 // 16 Y blocks, 4 U blocks, 4 V blocks each with 16 entries |
| 29 short *src_diff; |
| 30 short *coeff; |
| 31 |
| 32 // 16 Y blocks, 4 U blocks, 4 V blocks each with 16 entries |
| 33 short *quant; |
| 34 short *quant_fast; // fast quant deprecated for now |
| 35 unsigned char *quant_shift; |
| 36 short *zbin; |
| 37 short *zbin_8x8; |
| 38 short *zbin_16x16; |
| 39 short *zrun_zbin_boost; |
| 40 short *zrun_zbin_boost_8x8; |
| 41 short *zrun_zbin_boost_16x16; |
| 42 short *round; |
| 43 |
| 44 // Zbin Over Quant value |
| 45 short zbin_extra; |
| 46 |
| 47 unsigned char **base_src; |
| 48 unsigned char **base_second_src; |
| 49 int src; |
| 50 int src_stride; |
| 51 |
| 52 int eob_max_offset; |
| 53 int eob_max_offset_8x8; |
| 54 int eob_max_offset_16x16; |
| 55 } BLOCK; |
| 56 |
| 57 typedef struct { |
| 58 int count; |
| 59 struct { |
| 60 B_PREDICTION_MODE mode; |
| 61 int_mv mv; |
| 62 int_mv second_mv; |
| 63 } bmi[16]; |
| 64 } PARTITION_INFO; |
| 65 |
| 66 // Structure to hold snapshot of coding context during the mode picking process |
| 67 // TODO Do we need all of these? |
| 68 typedef struct { |
| 69 MODE_INFO mic; |
| 70 PARTITION_INFO partition_info; |
| 71 int_mv best_ref_mv; |
| 72 int_mv second_best_ref_mv; |
| 73 int_mv ref_mvs[MAX_REF_FRAMES][MAX_MV_REFS]; |
| 74 int rate; |
| 75 int distortion; |
| 76 int64_t intra_error; |
| 77 int best_mode_index; |
| 78 int rddiv; |
| 79 int rdmult; |
| 80 int hybrid_pred_diff; |
| 81 int comp_pred_diff; |
| 82 int single_pred_diff; |
| 83 int64_t txfm_rd_diff[NB_TXFM_MODES]; |
| 84 } PICK_MODE_CONTEXT; |
| 85 |
| 86 typedef struct macroblock { |
| 87 DECLARE_ALIGNED(16, short, src_diff[400]); // 16x16 Y 8x8 U 8x8 V 4x4 2nd Y |
| 88 DECLARE_ALIGNED(16, short, coeff[400]); // 16x16 Y 8x8 U 8x8 V 4x4 2nd Y |
| 89 #if !CONFIG_SUPERBLOCKS |
| 90 DECLARE_ALIGNED(16, unsigned char, thismb[256]); // 16x16 Y |
| 91 |
| 92 unsigned char *thismb_ptr; |
| 93 #endif |
| 94 // 16 Y blocks, 4 U blocks, 4 V blocks, |
| 95 // 1 DC 2nd order block each with 16 entries |
| 96 BLOCK block[25]; |
| 97 |
| 98 YV12_BUFFER_CONFIG src; |
| 99 |
| 100 MACROBLOCKD e_mbd; |
| 101 PARTITION_INFO *partition_info; /* work pointer */ |
| 102 PARTITION_INFO *pi; /* Corresponds to upper left visible macroblock */ |
| 103 PARTITION_INFO *pip; /* Base of allocated array */ |
| 104 |
| 105 search_site *ss; |
| 106 int ss_count; |
| 107 int searches_per_step; |
| 108 |
| 109 int errorperbit; |
| 110 int sadperbit16; |
| 111 int sadperbit4; |
| 112 int rddiv; |
| 113 int rdmult; |
| 114 unsigned int *mb_activity_ptr; |
| 115 int *mb_norm_activity_ptr; |
| 116 signed int act_zbin_adj; |
| 117 |
| 118 int nmvjointcost[MV_JOINTS]; |
| 119 int nmvcosts[2][MV_VALS]; |
| 120 int *nmvcost[2]; |
| 121 int nmvcosts_hp[2][MV_VALS]; |
| 122 int *nmvcost_hp[2]; |
| 123 int **mvcost; |
| 124 |
| 125 int nmvjointsadcost[MV_JOINTS]; |
| 126 int nmvsadcosts[2][MV_VALS]; |
| 127 int *nmvsadcost[2]; |
| 128 int nmvsadcosts_hp[2][MV_VALS]; |
| 129 int *nmvsadcost_hp[2]; |
| 130 int **mvsadcost; |
| 131 |
| 132 int mbmode_cost[2][MB_MODE_COUNT]; |
| 133 int intra_uv_mode_cost[2][MB_MODE_COUNT]; |
| 134 int bmode_costs[VP9_KF_BINTRAMODES][VP9_KF_BINTRAMODES][VP9_KF_BINTRAMODES]; |
| 135 int i8x8_mode_costs[MB_MODE_COUNT]; |
| 136 int inter_bmode_costs[B_MODE_COUNT]; |
| 137 int switchable_interp_costs[VP9_SWITCHABLE_FILTERS + 1] |
| 138 [VP9_SWITCHABLE_FILTERS]; |
| 139 |
| 140 // These define limits to motion vector components to prevent them |
| 141 // from extending outside the UMV borders |
| 142 int mv_col_min; |
| 143 int mv_col_max; |
| 144 int mv_row_min; |
| 145 int mv_row_max; |
| 146 |
| 147 int skip; |
| 148 |
| 149 int encode_breakout; |
| 150 |
| 151 // char * gf_active_ptr; |
| 152 signed char *gf_active_ptr; |
| 153 |
| 154 unsigned char *active_ptr; |
| 155 |
| 156 unsigned int token_costs[TX_SIZE_MAX][BLOCK_TYPES][COEF_BANDS] |
| 157 [PREV_COEF_CONTEXTS][MAX_ENTROPY_TOKENS]; |
| 158 unsigned int hybrid_token_costs[TX_SIZE_MAX][BLOCK_TYPES][COEF_BANDS] |
| 159 [PREV_COEF_CONTEXTS][MAX_ENTROPY_TOKENS]; |
| 160 |
| 161 int optimize; |
| 162 |
| 163 // Structure to hold context for each of the 4 MBs within a SB: |
| 164 // when encoded as 4 independent MBs: |
| 165 PICK_MODE_CONTEXT mb_context[4]; |
| 166 #if CONFIG_SUPERBLOCKS |
| 167 // when 4 MBs share coding parameters: |
| 168 PICK_MODE_CONTEXT sb_context[4]; |
| 169 #endif |
| 170 |
| 171 void (*vp9_short_fdct4x4)(short *input, short *output, int pitch); |
| 172 void (*vp9_short_fdct8x4)(short *input, short *output, int pitch); |
| 173 void (*short_walsh4x4)(short *input, short *output, int pitch); |
| 174 void (*quantize_b_4x4)(BLOCK *b, BLOCKD *d); |
| 175 void (*quantize_b_4x4_pair)(BLOCK *b1, BLOCK *b2, BLOCKD *d0, BLOCKD *d1); |
| 176 void (*vp9_short_fdct8x8)(short *input, short *output, int pitch); |
| 177 void (*vp9_short_fdct16x16)(short *input, short *output, int pitch); |
| 178 void (*short_fhaar2x2)(short *input, short *output, int pitch); |
| 179 void (*quantize_b_16x16)(BLOCK *b, BLOCKD *d); |
| 180 void (*quantize_b_8x8)(BLOCK *b, BLOCKD *d); |
| 181 void (*quantize_b_2x2)(BLOCK *b, BLOCKD *d); |
| 182 |
| 183 } MACROBLOCK; |
| 184 |
| 185 |
| 186 #endif |
OLD | NEW |