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_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
42 const unsigned char *ptrs[MAX_PARTITIONS];
43 unsigned int sizes[MAX_PARTITIONS];
46 #define MAX_FB_MT_DEC 32
51 * this struct will be populated with frame buffer management
52 * info in future commits. */
54 /* enable/disable frame-based threading */
55 int use_frame_threads;
57 /* decoder instances */
58 struct VP8D_COMP *pbi[MAX_FB_MT_DEC];
62 typedef struct VP8D_COMP
64 DECLARE_ALIGNED(16, MACROBLOCKD, mb);
66 YV12_BUFFER_CONFIG *dec_fb_ref[NUM_YV12_BUFFERS];
68 DECLARE_ALIGNED(16, VP8_COMMON, common);
70 /* the last partition will be used for the modes/mvs */
71 vp8_reader mbc[MAX_PARTITIONS];
75 FRAGMENT_DATA fragments;
77 #if CONFIG_MULTITHREAD
78 /* variable for threading */
80 volatile int b_multithreaded_rd;
82 int current_mb_col_main;
83 unsigned int decoding_thread_count;
84 int allocated_decoding_thread_count;
86 int mt_baseline_filter_level[MAX_MB_SEGMENTS];
88 int *mt_current_mb_col; /* Each row remembers its already decoded column. */
90 unsigned char **mt_yabove_row; /* mb_rows x width */
91 unsigned char **mt_uabove_row;
92 unsigned char **mt_vabove_row;
93 unsigned char **mt_yleft_col; /* mb_rows x 16 */
94 unsigned char **mt_uleft_col; /* mb_rows x 8 */
95 unsigned char **mt_vleft_col; /* mb_rows x 8 */
97 MB_ROW_DEC *mb_row_di;
98 DECODETHREAD_DATA *de_thread_data;
100 pthread_t *h_decoding_thread;
101 sem_t *h_event_start_decoding;
102 sem_t h_event_end_decoding;
103 /* end of threading data */
106 int64_t last_time_stamp;
107 int ready_for_new_data;
112 vp8_prob prob_skip_false;
114 #if CONFIG_ERROR_CONCEALMENT
115 MB_OVERLAP *overlaps;
116 /* the mb num from which modes and mvs (first partition) are corrupt */
117 unsigned int mvs_corrupt_from_mb;
121 int decoded_key_frame;
122 int independent_partitions;
123 int frame_corrupt_residual;
125 vp8_decrypt_cb *decrypt_cb;
129 int vp8_decode_frame(VP8D_COMP *cpi);
131 int vp8_create_decoder_instances(struct frame_buffers *fb, VP8D_CONFIG *oxcf);
132 int vp8_remove_decoder_instances(struct frame_buffers *fb);
135 #define CHECK_MEM_ERROR(lval,expr) do {\
138 vpx_internal_error(&pbi->common.error, VPX_CODEC_MEM_ERROR,\
139 "Failed to allocate "#lval" at %s:%d", \
143 #define CHECK_MEM_ERROR(lval,expr) do {\
146 vpx_internal_error(&pbi->common.error, VPX_CODEC_MEM_ERROR,\
147 "Failed to allocate "#lval);\
151 #endif // VP8_DECODER_ONYXD_INT_H_