michael@0: /* michael@0: * Copyright (c) 2010 The WebM project authors. All Rights Reserved. michael@0: * michael@0: * Use of this source code is governed by a BSD-style license michael@0: * that can be found in the LICENSE file in the root of the source michael@0: * tree. An additional intellectual property rights grant can be found michael@0: * in the file PATENTS. All contributing project authors may michael@0: * be found in the AUTHORS file in the root of the source tree. michael@0: */ michael@0: michael@0: michael@0: #ifndef __INC_BLOCK_H michael@0: #define __INC_BLOCK_H michael@0: michael@0: #include "vp8/common/onyx.h" michael@0: #include "vp8/common/blockd.h" michael@0: #include "vp8/common/entropymv.h" michael@0: #include "vp8/common/entropy.h" michael@0: #include "vpx_ports/mem.h" michael@0: michael@0: #define MAX_MODES 20 michael@0: #define MAX_ERROR_BINS 1024 michael@0: michael@0: /* motion search site */ michael@0: typedef struct michael@0: { michael@0: MV mv; michael@0: int offset; michael@0: } search_site; michael@0: michael@0: typedef struct block michael@0: { michael@0: /* 16 Y blocks, 4 U blocks, 4 V blocks each with 16 entries */ michael@0: short *src_diff; michael@0: short *coeff; michael@0: michael@0: /* 16 Y blocks, 4 U blocks, 4 V blocks each with 16 entries */ michael@0: short *quant; michael@0: short *quant_fast; michael@0: short *quant_shift; michael@0: short *zbin; michael@0: short *zrun_zbin_boost; michael@0: short *round; michael@0: michael@0: /* Zbin Over Quant value */ michael@0: short zbin_extra; michael@0: michael@0: unsigned char **base_src; michael@0: int src; michael@0: int src_stride; michael@0: } BLOCK; michael@0: michael@0: typedef struct michael@0: { michael@0: int count; michael@0: struct michael@0: { michael@0: B_PREDICTION_MODE mode; michael@0: int_mv mv; michael@0: } bmi[16]; michael@0: } PARTITION_INFO; michael@0: michael@0: typedef struct macroblock michael@0: { michael@0: DECLARE_ALIGNED(16, short, src_diff[400]); /* 25 blocks Y,U,V,Y2 */ michael@0: DECLARE_ALIGNED(16, short, coeff[400]); /* 25 blocks Y,U,V,Y2 */ michael@0: DECLARE_ALIGNED(16, unsigned char, thismb[256]); michael@0: michael@0: unsigned char *thismb_ptr; michael@0: /* 16 Y, 4 U, 4 V, 1 DC 2nd order block */ michael@0: BLOCK block[25]; michael@0: michael@0: YV12_BUFFER_CONFIG src; michael@0: michael@0: MACROBLOCKD e_mbd; michael@0: PARTITION_INFO *partition_info; /* work pointer */ michael@0: PARTITION_INFO *pi; /* Corresponds to upper left visible macroblock */ michael@0: PARTITION_INFO *pip; /* Base of allocated array */ michael@0: michael@0: int ref_frame_cost[MAX_REF_FRAMES]; michael@0: michael@0: search_site *ss; michael@0: int ss_count; michael@0: int searches_per_step; michael@0: michael@0: int errorperbit; michael@0: int sadperbit16; michael@0: int sadperbit4; michael@0: int rddiv; michael@0: int rdmult; michael@0: unsigned int * mb_activity_ptr; michael@0: int * mb_norm_activity_ptr; michael@0: signed int act_zbin_adj; michael@0: signed int last_act_zbin_adj; michael@0: michael@0: int *mvcost[2]; michael@0: int *mvsadcost[2]; michael@0: int (*mbmode_cost)[MB_MODE_COUNT]; michael@0: int (*intra_uv_mode_cost)[MB_MODE_COUNT]; michael@0: int (*bmode_costs)[10][10]; michael@0: int *inter_bmode_costs; michael@0: int (*token_costs)[COEF_BANDS][PREV_COEF_CONTEXTS] michael@0: [MAX_ENTROPY_TOKENS]; michael@0: michael@0: /* These define limits to motion vector components to prevent michael@0: * them from extending outside the UMV borders. michael@0: */ michael@0: int mv_col_min; michael@0: int mv_col_max; michael@0: int mv_row_min; michael@0: int mv_row_max; michael@0: michael@0: int skip; michael@0: michael@0: unsigned int encode_breakout; michael@0: michael@0: signed char *gf_active_ptr; michael@0: michael@0: unsigned char *active_ptr; michael@0: MV_CONTEXT *mvc; michael@0: michael@0: int optimize; michael@0: int q_index; michael@0: michael@0: #if CONFIG_TEMPORAL_DENOISING michael@0: MB_PREDICTION_MODE best_sse_inter_mode; michael@0: int_mv best_sse_mv; michael@0: MV_REFERENCE_FRAME best_reference_frame; michael@0: MV_REFERENCE_FRAME best_zeromv_reference_frame; michael@0: unsigned char need_to_clamp_best_mvs; michael@0: #endif michael@0: michael@0: int skip_true_count; michael@0: unsigned int coef_counts [BLOCK_TYPES] [COEF_BANDS] [PREV_COEF_CONTEXTS] [MAX_ENTROPY_TOKENS]; michael@0: unsigned int MVcount [2] [MVvals]; /* (row,col) MV cts this frame */ michael@0: int ymode_count [VP8_YMODES]; /* intra MB type cts this frame */ michael@0: int uv_mode_count[VP8_UV_MODES]; /* intra MB type cts this frame */ michael@0: int64_t prediction_error; michael@0: int64_t intra_error; michael@0: int count_mb_ref_frame_usage[MAX_REF_FRAMES]; michael@0: michael@0: int rd_thresh_mult[MAX_MODES]; michael@0: int rd_threshes[MAX_MODES]; michael@0: unsigned int mbs_tested_so_far; michael@0: unsigned int mode_test_hit_counts[MAX_MODES]; michael@0: int zbin_mode_boost_enabled; michael@0: int zbin_mode_boost; michael@0: int last_zbin_mode_boost; michael@0: michael@0: int last_zbin_over_quant; michael@0: int zbin_over_quant; michael@0: int error_bins[MAX_ERROR_BINS]; michael@0: michael@0: void (*short_fdct4x4)(short *input, short *output, int pitch); michael@0: void (*short_fdct8x4)(short *input, short *output, int pitch); michael@0: void (*short_walsh4x4)(short *input, short *output, int pitch); michael@0: void (*quantize_b)(BLOCK *b, BLOCKD *d); michael@0: void (*quantize_b_pair)(BLOCK *b1, BLOCK *b2, BLOCKD *d0, BLOCKD *d1); michael@0: michael@0: } MACROBLOCK; michael@0: michael@0: michael@0: #endif