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_VP8D_INT_H 13 #define __INC_VP8D_INT_H 14 #include "vpx_config.h" 15 #include "vp8/common/onyxd.h" 16 #include "treereader.h" 17 #include "vp8/common/onyxc_int.h" 18 #include "vp8/common/threading.h" 19 20 #if CONFIG_ERROR_CONCEALMENT 21 #include "ec_types.h" 22 #endif 23 24 typedef struct 25 { 26 int ithread; 27 void *ptr1; 28 void *ptr2; 29 } DECODETHREAD_DATA; 30 31 typedef struct 32 { 33 MACROBLOCKD mbd; 34 } MB_ROW_DEC; 35 36 typedef struct VP8D_COMP 37 { 38 DECLARE_ALIGNED(16, MACROBLOCKD, mb); 39 40 YV12_BUFFER_CONFIG *dec_fb_ref[NUM_YV12_BUFFERS]; 41 42 DECLARE_ALIGNED(16, VP8_COMMON, common); 43 44 /* the last partition will be used for the modes/mvs */ 45 vp8_reader mbc[MAX_PARTITIONS]; 46 47 VP8D_CONFIG oxcf; 48 49 50 const unsigned char *fragments[MAX_PARTITIONS]; 51 unsigned int fragment_sizes[MAX_PARTITIONS]; 52 unsigned int num_fragments; 53 54 #if CONFIG_MULTITHREAD 55 /* variable for threading */ 56 57 volatile int b_multithreaded_rd; 58 int max_threads; 59 int current_mb_col_main; 60 unsigned int decoding_thread_count; 61 int allocated_decoding_thread_count; 62 63 int mt_baseline_filter_level[MAX_MB_SEGMENTS]; 64 int sync_range; 65 int *mt_current_mb_col; /* Each row remembers its already decoded column. */ 66 67 unsigned char **mt_yabove_row; /* mb_rows x width */ 68 unsigned char **mt_uabove_row; 69 unsigned char **mt_vabove_row; 70 unsigned char **mt_yleft_col; /* mb_rows x 16 */ 71 unsigned char **mt_uleft_col; /* mb_rows x 8 */ 72 unsigned char **mt_vleft_col; /* mb_rows x 8 */ 73 74 MB_ROW_DEC *mb_row_di; 75 DECODETHREAD_DATA *de_thread_data; 76 77 pthread_t *h_decoding_thread; 78 sem_t *h_event_start_decoding; 79 sem_t h_event_end_decoding; 80 /* end of threading data */ 81 #endif 82 83 int64_t last_time_stamp; 84 int ready_for_new_data; 85 86 vp8_prob prob_intra; 87 vp8_prob prob_last; 88 vp8_prob prob_gf; 89 vp8_prob prob_skip_false; 90 91 #if CONFIG_ERROR_CONCEALMENT 92 MB_OVERLAP *overlaps; 93 /* the mb num from which modes and mvs (first partition) are corrupt */ 94 unsigned int mvs_corrupt_from_mb; 95 #endif 96 int ec_enabled; 97 int ec_active; 98 int input_fragments; 99 int decoded_key_frame; 100 int independent_partitions; 101 int frame_corrupt_residual; 102 103 } VP8D_COMP; 104 105 int vp8_decode_frame(VP8D_COMP *cpi); 106 107 #if CONFIG_DEBUG 108 #define CHECK_MEM_ERROR(lval,expr) do {\ 109 lval = (expr); \ 110 if(!lval) \ 111 vpx_internal_error(&pbi->common.error, VPX_CODEC_MEM_ERROR,\ 112 "Failed to allocate "#lval" at %s:%d", \ 113 __FILE__,__LINE__);\ 114 } while(0) 115 #else 116 #define CHECK_MEM_ERROR(lval,expr) do {\ 117 lval = (expr); \ 118 if(!lval) \ 119 vpx_internal_error(&pbi->common.error, VPX_CODEC_MEM_ERROR,\ 120 "Failed to allocate "#lval);\ 121 } while(0) 122 #endif 123 124 #endif 125