Merge "Proper fix of a msvc complier warning"
[aom.git] / vp8 / decoder / onyxd_int.h
blobaa2cc57f7b18d3c180dacd83be3a417746192b95
1 /*
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.
9 */
12 #ifndef VP8_DECODER_ONYXD_INT_H_
13 #define VP8_DECODER_ONYXD_INT_H_
15 #include "vpx_config.h"
16 #include "vp8/common/onyxd.h"
17 #include "treereader.h"
18 #include "vp8/common/onyxc_int.h"
19 #include "vp8/common/threading.h"
21 #if CONFIG_ERROR_CONCEALMENT
22 #include "ec_types.h"
23 #endif
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
29 typedef struct
31 int ithread;
32 void *ptr1;
33 void *ptr2;
34 } DECODETHREAD_DATA;
36 typedef struct
38 MACROBLOCKD mbd;
39 } MB_ROW_DEC;
42 typedef struct
44 int enabled;
45 unsigned int count;
46 const unsigned char *ptrs[MAX_PARTITIONS];
47 unsigned int sizes[MAX_PARTITIONS];
48 } FRAGMENT_DATA;
50 #define MAX_FB_MT_DEC 32
52 struct frame_buffers
55 * this struct will be populated with frame buffer management
56 * info in future commits. */
58 /* enable/disable frame-based threading */
59 int use_frame_threads;
61 /* decoder instances */
62 struct VP8D_COMP *pbi[MAX_FB_MT_DEC];
66 typedef struct VP8D_COMP
68 DECLARE_ALIGNED(16, MACROBLOCKD, mb);
70 YV12_BUFFER_CONFIG *dec_fb_ref[NUM_YV12_BUFFERS];
72 DECLARE_ALIGNED(16, VP8_COMMON, common);
74 /* the last partition will be used for the modes/mvs */
75 vp8_reader mbc[MAX_PARTITIONS];
77 VP8D_CONFIG oxcf;
79 FRAGMENT_DATA fragments;
81 #if CONFIG_MULTITHREAD
82 /* variable for threading */
84 volatile int b_multithreaded_rd;
85 int max_threads;
86 int current_mb_col_main;
87 unsigned int decoding_thread_count;
88 int allocated_decoding_thread_count;
90 int mt_baseline_filter_level[MAX_MB_SEGMENTS];
91 int sync_range;
92 int *mt_current_mb_col; /* Each row remembers its already decoded column. */
94 unsigned char **mt_yabove_row; /* mb_rows x width */
95 unsigned char **mt_uabove_row;
96 unsigned char **mt_vabove_row;
97 unsigned char **mt_yleft_col; /* mb_rows x 16 */
98 unsigned char **mt_uleft_col; /* mb_rows x 8 */
99 unsigned char **mt_vleft_col; /* mb_rows x 8 */
101 MB_ROW_DEC *mb_row_di;
102 DECODETHREAD_DATA *de_thread_data;
104 pthread_t *h_decoding_thread;
105 sem_t *h_event_start_decoding;
106 sem_t h_event_end_decoding;
107 /* end of threading data */
108 #endif
110 int64_t last_time_stamp;
111 int ready_for_new_data;
113 vp8_prob prob_intra;
114 vp8_prob prob_last;
115 vp8_prob prob_gf;
116 vp8_prob prob_skip_false;
118 #if CONFIG_ERROR_CONCEALMENT
119 MB_OVERLAP *overlaps;
120 /* the mb num from which modes and mvs (first partition) are corrupt */
121 unsigned int mvs_corrupt_from_mb;
122 #endif
123 int ec_enabled;
124 int ec_active;
125 int decoded_key_frame;
126 int independent_partitions;
127 int frame_corrupt_residual;
129 vpx_decrypt_cb decrypt_cb;
130 void *decrypt_state;
131 } VP8D_COMP;
133 int vp8_decode_frame(VP8D_COMP *cpi);
135 int vp8_create_decoder_instances(struct frame_buffers *fb, VP8D_CONFIG *oxcf);
136 int vp8_remove_decoder_instances(struct frame_buffers *fb);
138 #if CONFIG_DEBUG
139 #define CHECK_MEM_ERROR(lval,expr) do {\
140 lval = (expr); \
141 if(!lval) \
142 vpx_internal_error(&pbi->common.error, VPX_CODEC_MEM_ERROR,\
143 "Failed to allocate "#lval" at %s:%d", \
144 __FILE__,__LINE__);\
145 } while(0)
146 #else
147 #define CHECK_MEM_ERROR(lval,expr) do {\
148 lval = (expr); \
149 if(!lval) \
150 vpx_internal_error(&pbi->common.error, VPX_CODEC_MEM_ERROR,\
151 "Failed to allocate "#lval);\
152 } while(0)
153 #endif
155 #ifdef __cplusplus
156 } // extern "C"
157 #endif
159 #endif // VP8_DECODER_ONYXD_INT_H_