2 * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
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.
12 #ifndef VP8_ENCODER_BLOCK_H_
13 #define VP8_ENCODER_BLOCK_H_
15 #include "vp8/common/onyx.h"
16 #include "vp8/common/blockd.h"
17 #include "vp8/common/entropymv.h"
18 #include "vp8/common/entropy.h"
19 #include "vpx_ports/mem.h"
26 #define MAX_ERROR_BINS 1024
28 /* motion search site */
37 /* 16 Y blocks, 4 U blocks, 4 V blocks each with 16 entries */
41 /* 16 Y blocks, 4 U blocks, 4 V blocks each with 16 entries */
46 short *zrun_zbin_boost;
49 /* Zbin Over Quant value */
52 unsigned char **base_src;
62 B_PREDICTION_MODE mode;
67 typedef struct macroblock
69 DECLARE_ALIGNED(16, short, src_diff[400]); /* 25 blocks Y,U,V,Y2 */
70 DECLARE_ALIGNED(16, short, coeff[400]); /* 25 blocks Y,U,V,Y2 */
71 DECLARE_ALIGNED(16, unsigned char, thismb[256]);
73 unsigned char *thismb_ptr;
74 /* 16 Y, 4 U, 4 V, 1 DC 2nd order block */
77 YV12_BUFFER_CONFIG src;
80 PARTITION_INFO *partition_info; /* work pointer */
81 PARTITION_INFO *pi; /* Corresponds to upper left visible macroblock */
82 PARTITION_INFO *pip; /* Base of allocated array */
84 int ref_frame_cost[MAX_REF_FRAMES];
88 int searches_per_step;
95 unsigned int * mb_activity_ptr;
96 int * mb_norm_activity_ptr;
97 signed int act_zbin_adj;
98 signed int last_act_zbin_adj;
102 int (*mbmode_cost)[MB_MODE_COUNT];
103 int (*intra_uv_mode_cost)[MB_MODE_COUNT];
104 int (*bmode_costs)[10][10];
105 int *inter_bmode_costs;
106 int (*token_costs)[COEF_BANDS][PREV_COEF_CONTEXTS]
107 [MAX_ENTROPY_TOKENS];
109 /* These define limits to motion vector components to prevent
110 * them from extending outside the UMV borders.
119 unsigned int encode_breakout;
121 signed char *gf_active_ptr;
123 unsigned char *active_ptr;
129 #if CONFIG_TEMPORAL_DENOISING
130 MB_PREDICTION_MODE best_sse_inter_mode;
132 MV_REFERENCE_FRAME best_reference_frame;
133 MV_REFERENCE_FRAME best_zeromv_reference_frame;
134 unsigned char need_to_clamp_best_mvs;
138 unsigned int coef_counts [BLOCK_TYPES] [COEF_BANDS] [PREV_COEF_CONTEXTS] [MAX_ENTROPY_TOKENS];
139 unsigned int MVcount [2] [MVvals]; /* (row,col) MV cts this frame */
140 int ymode_count [VP8_YMODES]; /* intra MB type cts this frame */
141 int uv_mode_count[VP8_UV_MODES]; /* intra MB type cts this frame */
142 int64_t prediction_error;
144 int count_mb_ref_frame_usage[MAX_REF_FRAMES];
146 int rd_thresh_mult[MAX_MODES];
147 int rd_threshes[MAX_MODES];
148 unsigned int mbs_tested_so_far;
149 unsigned int mode_test_hit_counts[MAX_MODES];
150 int zbin_mode_boost_enabled;
152 int last_zbin_mode_boost;
154 int last_zbin_over_quant;
156 int error_bins[MAX_ERROR_BINS];
158 void (*short_fdct4x4)(short *input, short *output, int pitch);
159 void (*short_fdct8x4)(short *input, short *output, int pitch);
160 void (*short_walsh4x4)(short *input, short *output, int pitch);
161 void (*quantize_b)(BLOCK *b, BLOCKD *d);
162 void (*quantize_b_pair)(BLOCK *b1, BLOCK *b2, BLOCKD *d0, BLOCKD *d1);
171 #endif // VP8_ENCODER_BLOCK_H_