| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2010 The WebM project authors. All Rights Reserved. | 2 * Copyright (c) 2010 The WebM project authors. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 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 | 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 | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| 11 #ifndef VP9_ENCODER_VP9_BLOCK_H_ | 11 #ifndef VP9_ENCODER_VP9_BLOCK_H_ |
| 12 #define VP9_ENCODER_VP9_BLOCK_H_ | 12 #define VP9_ENCODER_VP9_BLOCK_H_ |
| 13 | 13 |
| 14 #include "vp9/common/vp9_entropymv.h" | 14 #include "vp9/common/vp9_entropymv.h" |
| 15 #include "vp9/common/vp9_entropy.h" | 15 #include "vp9/common/vp9_entropy.h" |
| 16 #include "vpx_ports/mem.h" | 16 #include "vpx_ports/mem.h" |
| 17 #include "vp9/common/vp9_onyxc_int.h" | 17 #include "vp9/common/vp9_onyxc_int.h" |
| 18 | 18 |
| 19 #ifdef __cplusplus | 19 #ifdef __cplusplus |
| 20 extern "C" { | 20 extern "C" { |
| 21 #endif | 21 #endif |
| 22 | 22 |
| 23 // Structure to hold snapshot of coding context during the mode picking process | |
| 24 typedef struct { | |
| 25 MODE_INFO mic; | |
| 26 uint8_t *zcoeff_blk; | |
| 27 int16_t *coeff[MAX_MB_PLANE][3]; | |
| 28 int16_t *qcoeff[MAX_MB_PLANE][3]; | |
| 29 int16_t *dqcoeff[MAX_MB_PLANE][3]; | |
| 30 uint16_t *eobs[MAX_MB_PLANE][3]; | |
| 31 | |
| 32 // dual buffer pointers, 0: in use, 1: best in store | |
| 33 int16_t *coeff_pbuf[MAX_MB_PLANE][3]; | |
| 34 int16_t *qcoeff_pbuf[MAX_MB_PLANE][3]; | |
| 35 int16_t *dqcoeff_pbuf[MAX_MB_PLANE][3]; | |
| 36 uint16_t *eobs_pbuf[MAX_MB_PLANE][3]; | |
| 37 | |
| 38 int is_coded; | |
| 39 int num_4x4_blk; | |
| 40 int skip; | |
| 41 int_mv best_ref_mv[2]; | |
| 42 int_mv ref_mvs[MAX_REF_FRAMES][MAX_MV_REF_CANDIDATES]; | |
| 43 int rate; | |
| 44 int distortion; | |
| 45 int best_mode_index; | |
| 46 int rddiv; | |
| 47 int rdmult; | |
| 48 int hybrid_pred_diff; | |
| 49 int comp_pred_diff; | |
| 50 int single_pred_diff; | |
| 51 int64_t tx_rd_diff[TX_MODES]; | |
| 52 int64_t best_filter_diff[SWITCHABLE_FILTER_CONTEXTS]; | |
| 53 | |
| 54 // motion vector cache for adaptive motion search control in partition | |
| 55 // search loop | |
| 56 int_mv pred_mv[MAX_REF_FRAMES]; | |
| 57 INTERP_FILTER pred_interp_filter; | |
| 58 } PICK_MODE_CONTEXT; | |
| 59 | |
| 60 struct macroblock_plane { | 23 struct macroblock_plane { |
| 61 DECLARE_ALIGNED(16, int16_t, src_diff[64 * 64]); | 24 DECLARE_ALIGNED(16, int16_t, src_diff[64 * 64]); |
| 62 int16_t *qcoeff; | 25 int16_t *qcoeff; |
| 63 int16_t *coeff; | 26 int16_t *coeff; |
| 64 uint16_t *eobs; | 27 uint16_t *eobs; |
| 65 struct buf_2d src; | 28 struct buf_2d src; |
| 66 | 29 |
| 67 // Quantizer setings | 30 // Quantizer setings |
| 31 int16_t *quant_fp; |
| 68 int16_t *quant; | 32 int16_t *quant; |
| 69 int16_t *quant_shift; | 33 int16_t *quant_shift; |
| 70 int16_t *zbin; | 34 int16_t *zbin; |
| 71 int16_t *round; | 35 int16_t *round; |
| 72 | 36 |
| 73 // Zbin Over Quant value | 37 // Zbin Over Quant value |
| 74 int16_t zbin_extra; | 38 int16_t zbin_extra; |
| 75 }; | 39 }; |
| 76 typedef struct PC_TREE { | |
| 77 int index; | |
| 78 PARTITION_TYPE partitioning; | |
| 79 BLOCK_SIZE block_size; | |
| 80 PICK_MODE_CONTEXT none; | |
| 81 PICK_MODE_CONTEXT horizontal[2]; | |
| 82 PICK_MODE_CONTEXT vertical[2]; | |
| 83 union { | |
| 84 struct PC_TREE *split[4]; | |
| 85 PICK_MODE_CONTEXT *leaf_split[4]; | |
| 86 }; | |
| 87 } PC_TREE; | |
| 88 | 40 |
| 89 /* The [2] dimension is for whether we skip the EOB node (i.e. if previous | 41 /* The [2] dimension is for whether we skip the EOB node (i.e. if previous |
| 90 * coefficient in this block was zero) or not. */ | 42 * coefficient in this block was zero) or not. */ |
| 91 typedef unsigned int vp9_coeff_cost[PLANE_TYPES][REF_TYPES][COEF_BANDS][2] | 43 typedef unsigned int vp9_coeff_cost[PLANE_TYPES][REF_TYPES][COEF_BANDS][2] |
| 92 [COEFF_CONTEXTS][ENTROPY_TOKENS]; | 44 [COEFF_CONTEXTS][ENTROPY_TOKENS]; |
| 93 | 45 |
| 94 typedef struct macroblock MACROBLOCK; | 46 typedef struct macroblock MACROBLOCK; |
| 95 struct macroblock { | 47 struct macroblock { |
| 96 struct macroblock_plane plane[MAX_MB_PLANE]; | 48 struct macroblock_plane plane[MAX_MB_PLANE]; |
| 97 | 49 |
| 98 MACROBLOCKD e_mbd; | 50 MACROBLOCKD e_mbd; |
| 99 int skip_block; | 51 int skip_block; |
| 100 int select_txfm_size; | 52 int select_tx_size; |
| 101 int skip_recode; | 53 int skip_recode; |
| 102 int skip_optimize; | 54 int skip_optimize; |
| 103 int q_index; | 55 int q_index; |
| 104 | 56 |
| 105 int errorperbit; | 57 int errorperbit; |
| 106 int sadperbit16; | 58 int sadperbit16; |
| 107 int sadperbit4; | 59 int sadperbit4; |
| 108 int rddiv; | 60 int rddiv; |
| 109 int rdmult; | 61 int rdmult; |
| 110 unsigned int mb_energy; | 62 unsigned int mb_energy; |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 vp9_coeff_cost token_costs[TX_SIZES]; | 99 vp9_coeff_cost token_costs[TX_SIZES]; |
| 148 | 100 |
| 149 int in_static_area; | 101 int in_static_area; |
| 150 | 102 |
| 151 int optimize; | 103 int optimize; |
| 152 | 104 |
| 153 // indicate if it is in the rd search loop or encoding process | 105 // indicate if it is in the rd search loop or encoding process |
| 154 int use_lp32x32fdct; | 106 int use_lp32x32fdct; |
| 155 int skip_encode; | 107 int skip_encode; |
| 156 | 108 |
| 109 // skip forward transform and quantization |
| 110 int skip_txfm; |
| 111 |
| 157 // Used to store sub partition's choices. | 112 // Used to store sub partition's choices. |
| 158 int_mv pred_mv[MAX_REF_FRAMES]; | 113 MV pred_mv[MAX_REF_FRAMES]; |
| 159 | |
| 160 PICK_MODE_CONTEXT *leaf_tree; | |
| 161 PC_TREE *pc_tree; | |
| 162 PC_TREE *pc_root; | |
| 163 int partition_cost[PARTITION_CONTEXTS][PARTITION_TYPES]; | |
| 164 | 114 |
| 165 void (*fwd_txm4x4)(const int16_t *input, int16_t *output, int stride); | 115 void (*fwd_txm4x4)(const int16_t *input, int16_t *output, int stride); |
| 116 void (*itxm_add)(const int16_t *input, uint8_t *dest, int stride, int eob); |
| 166 }; | 117 }; |
| 167 | 118 |
| 168 | |
| 169 #ifdef __cplusplus | 119 #ifdef __cplusplus |
| 170 } // extern "C" | 120 } // extern "C" |
| 171 #endif | 121 #endif |
| 172 | 122 |
| 173 #endif // VP9_ENCODER_VP9_BLOCK_H_ | 123 #endif // VP9_ENCODER_VP9_BLOCK_H_ |
| OLD | NEW |