Add packaging files for Tizen
[profile/ivi/libvpx.git] / vp8 / encoder / block.h
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 __INC_BLOCK_H
13 #define __INC_BLOCK_H
14
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"
20
21 // motion search site
22 typedef struct
23 {
24     MV mv;
25     int offset;
26 } search_site;
27
28 typedef struct block
29 {
30     // 16 Y blocks, 4 U blocks, 4 V blocks each with 16 entries
31     short *src_diff;
32     short *coeff;
33
34     // 16 Y blocks, 4 U blocks, 4 V blocks each with 16 entries
35     short *quant;
36     short *quant_fast;
37     unsigned char *quant_shift;
38     short *zbin;
39     short *zrun_zbin_boost;
40     short *round;
41
42     // Zbin Over Quant value
43     short zbin_extra;
44
45     unsigned char **base_src;
46     int src;
47     int src_stride;
48 } BLOCK;
49
50 typedef struct
51 {
52     int count;
53     struct
54     {
55         B_PREDICTION_MODE mode;
56         int_mv mv;
57     } bmi[16];
58 } PARTITION_INFO;
59
60 typedef struct macroblock
61 {
62     DECLARE_ALIGNED(16, short, src_diff[400]);       // 16x16 Y 8x8 U 8x8 V 4x4 2nd Y
63     DECLARE_ALIGNED(16, short, coeff[400]);     // 16x16 Y 8x8 U 8x8 V 4x4 2nd Y
64     DECLARE_ALIGNED(16, unsigned char, thismb[256]);
65
66     unsigned char *thismb_ptr;
67     // 16 Y blocks, 4 U blocks, 4 V blocks, 1 DC 2nd order block each with 16 entries
68     BLOCK block[25];
69
70     YV12_BUFFER_CONFIG src;
71
72     MACROBLOCKD e_mbd;
73     PARTITION_INFO *partition_info; /* work pointer */
74     PARTITION_INFO *pi;   /* Corresponds to upper left visible macroblock */
75     PARTITION_INFO *pip;  /* Base of allocated array */
76
77     int ref_frame_cost[MAX_REF_FRAMES];
78
79     search_site *ss;
80     int ss_count;
81     int searches_per_step;
82
83     int errorperbit;
84     int sadperbit16;
85     int sadperbit4;
86     int rddiv;
87     int rdmult;
88     unsigned int * mb_activity_ptr;
89     int * mb_norm_activity_ptr;
90     signed int act_zbin_adj;
91     signed int last_act_zbin_adj;
92
93     int *mvcost[2];
94     int *mvsadcost[2];
95     int (*mbmode_cost)[MB_MODE_COUNT];
96     int (*intra_uv_mode_cost)[MB_MODE_COUNT];
97     int (*bmode_costs)[10][10];
98     int *inter_bmode_costs;
99     int (*token_costs)[COEF_BANDS][PREV_COEF_CONTEXTS]
100     [MAX_ENTROPY_TOKENS];
101
102     // These define limits to motion vector components to prevent
103     // them from extending outside the UMV borders
104     int mv_col_min;
105     int mv_col_max;
106     int mv_row_min;
107     int mv_row_max;
108
109     int skip;
110
111     unsigned int encode_breakout;
112
113     //char * gf_active_ptr;
114     signed char *gf_active_ptr;
115
116     unsigned char *active_ptr;
117     MV_CONTEXT *mvc;
118
119     int optimize;
120     int q_index;
121
122 #if CONFIG_TEMPORAL_DENOISING
123     MB_PREDICTION_MODE best_sse_inter_mode;
124     int_mv best_sse_mv;
125     MV_REFERENCE_FRAME best_reference_frame;
126     MV_REFERENCE_FRAME best_zeromv_reference_frame;
127     unsigned char need_to_clamp_best_mvs;
128 #endif
129
130
131
132     void (*short_fdct4x4)(short *input, short *output, int pitch);
133     void (*short_fdct8x4)(short *input, short *output, int pitch);
134     void (*short_walsh4x4)(short *input, short *output, int pitch);
135     void (*quantize_b)(BLOCK *b, BLOCKD *d);
136     void (*quantize_b_pair)(BLOCK *b1, BLOCK *b2, BLOCKD *d0, BLOCKD *d1);
137
138 } MACROBLOCK;
139
140
141 #endif