1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/media/libvpx/vp8/encoder/block.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,163 @@ 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 + 1.15 +#ifndef __INC_BLOCK_H 1.16 +#define __INC_BLOCK_H 1.17 + 1.18 +#include "vp8/common/onyx.h" 1.19 +#include "vp8/common/blockd.h" 1.20 +#include "vp8/common/entropymv.h" 1.21 +#include "vp8/common/entropy.h" 1.22 +#include "vpx_ports/mem.h" 1.23 + 1.24 +#define MAX_MODES 20 1.25 +#define MAX_ERROR_BINS 1024 1.26 + 1.27 +/* motion search site */ 1.28 +typedef struct 1.29 +{ 1.30 + MV mv; 1.31 + int offset; 1.32 +} search_site; 1.33 + 1.34 +typedef struct block 1.35 +{ 1.36 + /* 16 Y blocks, 4 U blocks, 4 V blocks each with 16 entries */ 1.37 + short *src_diff; 1.38 + short *coeff; 1.39 + 1.40 + /* 16 Y blocks, 4 U blocks, 4 V blocks each with 16 entries */ 1.41 + short *quant; 1.42 + short *quant_fast; 1.43 + short *quant_shift; 1.44 + short *zbin; 1.45 + short *zrun_zbin_boost; 1.46 + short *round; 1.47 + 1.48 + /* Zbin Over Quant value */ 1.49 + short zbin_extra; 1.50 + 1.51 + unsigned char **base_src; 1.52 + int src; 1.53 + int src_stride; 1.54 +} BLOCK; 1.55 + 1.56 +typedef struct 1.57 +{ 1.58 + int count; 1.59 + struct 1.60 + { 1.61 + B_PREDICTION_MODE mode; 1.62 + int_mv mv; 1.63 + } bmi[16]; 1.64 +} PARTITION_INFO; 1.65 + 1.66 +typedef struct macroblock 1.67 +{ 1.68 + DECLARE_ALIGNED(16, short, src_diff[400]); /* 25 blocks Y,U,V,Y2 */ 1.69 + DECLARE_ALIGNED(16, short, coeff[400]); /* 25 blocks Y,U,V,Y2 */ 1.70 + DECLARE_ALIGNED(16, unsigned char, thismb[256]); 1.71 + 1.72 + unsigned char *thismb_ptr; 1.73 + /* 16 Y, 4 U, 4 V, 1 DC 2nd order block */ 1.74 + BLOCK block[25]; 1.75 + 1.76 + YV12_BUFFER_CONFIG src; 1.77 + 1.78 + MACROBLOCKD e_mbd; 1.79 + PARTITION_INFO *partition_info; /* work pointer */ 1.80 + PARTITION_INFO *pi; /* Corresponds to upper left visible macroblock */ 1.81 + PARTITION_INFO *pip; /* Base of allocated array */ 1.82 + 1.83 + int ref_frame_cost[MAX_REF_FRAMES]; 1.84 + 1.85 + search_site *ss; 1.86 + int ss_count; 1.87 + int searches_per_step; 1.88 + 1.89 + int errorperbit; 1.90 + int sadperbit16; 1.91 + int sadperbit4; 1.92 + int rddiv; 1.93 + int rdmult; 1.94 + unsigned int * mb_activity_ptr; 1.95 + int * mb_norm_activity_ptr; 1.96 + signed int act_zbin_adj; 1.97 + signed int last_act_zbin_adj; 1.98 + 1.99 + int *mvcost[2]; 1.100 + int *mvsadcost[2]; 1.101 + int (*mbmode_cost)[MB_MODE_COUNT]; 1.102 + int (*intra_uv_mode_cost)[MB_MODE_COUNT]; 1.103 + int (*bmode_costs)[10][10]; 1.104 + int *inter_bmode_costs; 1.105 + int (*token_costs)[COEF_BANDS][PREV_COEF_CONTEXTS] 1.106 + [MAX_ENTROPY_TOKENS]; 1.107 + 1.108 + /* These define limits to motion vector components to prevent 1.109 + * them from extending outside the UMV borders. 1.110 + */ 1.111 + int mv_col_min; 1.112 + int mv_col_max; 1.113 + int mv_row_min; 1.114 + int mv_row_max; 1.115 + 1.116 + int skip; 1.117 + 1.118 + unsigned int encode_breakout; 1.119 + 1.120 + signed char *gf_active_ptr; 1.121 + 1.122 + unsigned char *active_ptr; 1.123 + MV_CONTEXT *mvc; 1.124 + 1.125 + int optimize; 1.126 + int q_index; 1.127 + 1.128 +#if CONFIG_TEMPORAL_DENOISING 1.129 + MB_PREDICTION_MODE best_sse_inter_mode; 1.130 + int_mv best_sse_mv; 1.131 + MV_REFERENCE_FRAME best_reference_frame; 1.132 + MV_REFERENCE_FRAME best_zeromv_reference_frame; 1.133 + unsigned char need_to_clamp_best_mvs; 1.134 +#endif 1.135 + 1.136 + int skip_true_count; 1.137 + unsigned int coef_counts [BLOCK_TYPES] [COEF_BANDS] [PREV_COEF_CONTEXTS] [MAX_ENTROPY_TOKENS]; 1.138 + unsigned int MVcount [2] [MVvals]; /* (row,col) MV cts this frame */ 1.139 + int ymode_count [VP8_YMODES]; /* intra MB type cts this frame */ 1.140 + int uv_mode_count[VP8_UV_MODES]; /* intra MB type cts this frame */ 1.141 + int64_t prediction_error; 1.142 + int64_t intra_error; 1.143 + int count_mb_ref_frame_usage[MAX_REF_FRAMES]; 1.144 + 1.145 + int rd_thresh_mult[MAX_MODES]; 1.146 + int rd_threshes[MAX_MODES]; 1.147 + unsigned int mbs_tested_so_far; 1.148 + unsigned int mode_test_hit_counts[MAX_MODES]; 1.149 + int zbin_mode_boost_enabled; 1.150 + int zbin_mode_boost; 1.151 + int last_zbin_mode_boost; 1.152 + 1.153 + int last_zbin_over_quant; 1.154 + int zbin_over_quant; 1.155 + int error_bins[MAX_ERROR_BINS]; 1.156 + 1.157 + void (*short_fdct4x4)(short *input, short *output, int pitch); 1.158 + void (*short_fdct8x4)(short *input, short *output, int pitch); 1.159 + void (*short_walsh4x4)(short *input, short *output, int pitch); 1.160 + void (*quantize_b)(BLOCK *b, BLOCKD *d); 1.161 + void (*quantize_b_pair)(BLOCK *b1, BLOCK *b2, BLOCKD *d0, BLOCKD *d1); 1.162 + 1.163 +} MACROBLOCK; 1.164 + 1.165 + 1.166 +#endif