Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
michael@0 | 1 | /* |
michael@0 | 2 | * Copyright (c) 2010 The WebM project authors. All Rights Reserved. |
michael@0 | 3 | * |
michael@0 | 4 | * Use of this source code is governed by a BSD-style license |
michael@0 | 5 | * that can be found in the LICENSE file in the root of the source |
michael@0 | 6 | * tree. An additional intellectual property rights grant can be found |
michael@0 | 7 | * in the file PATENTS. All contributing project authors may |
michael@0 | 8 | * be found in the AUTHORS file in the root of the source tree. |
michael@0 | 9 | */ |
michael@0 | 10 | |
michael@0 | 11 | |
michael@0 | 12 | #ifndef ONYXD_INT_H_ |
michael@0 | 13 | #define ONYXD_INT_H_ |
michael@0 | 14 | |
michael@0 | 15 | #include "vpx_config.h" |
michael@0 | 16 | #include "vp8/common/onyxd.h" |
michael@0 | 17 | #include "treereader.h" |
michael@0 | 18 | #include "vp8/common/onyxc_int.h" |
michael@0 | 19 | #include "vp8/common/threading.h" |
michael@0 | 20 | |
michael@0 | 21 | #if CONFIG_ERROR_CONCEALMENT |
michael@0 | 22 | #include "ec_types.h" |
michael@0 | 23 | #endif |
michael@0 | 24 | |
michael@0 | 25 | typedef struct |
michael@0 | 26 | { |
michael@0 | 27 | int ithread; |
michael@0 | 28 | void *ptr1; |
michael@0 | 29 | void *ptr2; |
michael@0 | 30 | } DECODETHREAD_DATA; |
michael@0 | 31 | |
michael@0 | 32 | typedef struct |
michael@0 | 33 | { |
michael@0 | 34 | MACROBLOCKD mbd; |
michael@0 | 35 | } MB_ROW_DEC; |
michael@0 | 36 | |
michael@0 | 37 | |
michael@0 | 38 | typedef struct |
michael@0 | 39 | { |
michael@0 | 40 | int enabled; |
michael@0 | 41 | unsigned int count; |
michael@0 | 42 | const unsigned char *ptrs[MAX_PARTITIONS]; |
michael@0 | 43 | unsigned int sizes[MAX_PARTITIONS]; |
michael@0 | 44 | } FRAGMENT_DATA; |
michael@0 | 45 | |
michael@0 | 46 | #define MAX_FB_MT_DEC 32 |
michael@0 | 47 | |
michael@0 | 48 | struct frame_buffers |
michael@0 | 49 | { |
michael@0 | 50 | /* |
michael@0 | 51 | * this struct will be populated with frame buffer management |
michael@0 | 52 | * info in future commits. */ |
michael@0 | 53 | |
michael@0 | 54 | /* enable/disable frame-based threading */ |
michael@0 | 55 | int use_frame_threads; |
michael@0 | 56 | |
michael@0 | 57 | /* decoder instances */ |
michael@0 | 58 | struct VP8D_COMP *pbi[MAX_FB_MT_DEC]; |
michael@0 | 59 | |
michael@0 | 60 | }; |
michael@0 | 61 | |
michael@0 | 62 | typedef struct VP8D_COMP |
michael@0 | 63 | { |
michael@0 | 64 | DECLARE_ALIGNED(16, MACROBLOCKD, mb); |
michael@0 | 65 | |
michael@0 | 66 | YV12_BUFFER_CONFIG *dec_fb_ref[NUM_YV12_BUFFERS]; |
michael@0 | 67 | |
michael@0 | 68 | DECLARE_ALIGNED(16, VP8_COMMON, common); |
michael@0 | 69 | |
michael@0 | 70 | /* the last partition will be used for the modes/mvs */ |
michael@0 | 71 | vp8_reader mbc[MAX_PARTITIONS]; |
michael@0 | 72 | |
michael@0 | 73 | VP8D_CONFIG oxcf; |
michael@0 | 74 | |
michael@0 | 75 | FRAGMENT_DATA fragments; |
michael@0 | 76 | |
michael@0 | 77 | #if CONFIG_MULTITHREAD |
michael@0 | 78 | /* variable for threading */ |
michael@0 | 79 | |
michael@0 | 80 | volatile int b_multithreaded_rd; |
michael@0 | 81 | int max_threads; |
michael@0 | 82 | int current_mb_col_main; |
michael@0 | 83 | unsigned int decoding_thread_count; |
michael@0 | 84 | int allocated_decoding_thread_count; |
michael@0 | 85 | |
michael@0 | 86 | int mt_baseline_filter_level[MAX_MB_SEGMENTS]; |
michael@0 | 87 | int sync_range; |
michael@0 | 88 | int *mt_current_mb_col; /* Each row remembers its already decoded column. */ |
michael@0 | 89 | |
michael@0 | 90 | unsigned char **mt_yabove_row; /* mb_rows x width */ |
michael@0 | 91 | unsigned char **mt_uabove_row; |
michael@0 | 92 | unsigned char **mt_vabove_row; |
michael@0 | 93 | unsigned char **mt_yleft_col; /* mb_rows x 16 */ |
michael@0 | 94 | unsigned char **mt_uleft_col; /* mb_rows x 8 */ |
michael@0 | 95 | unsigned char **mt_vleft_col; /* mb_rows x 8 */ |
michael@0 | 96 | |
michael@0 | 97 | MB_ROW_DEC *mb_row_di; |
michael@0 | 98 | DECODETHREAD_DATA *de_thread_data; |
michael@0 | 99 | |
michael@0 | 100 | pthread_t *h_decoding_thread; |
michael@0 | 101 | sem_t *h_event_start_decoding; |
michael@0 | 102 | sem_t h_event_end_decoding; |
michael@0 | 103 | /* end of threading data */ |
michael@0 | 104 | #endif |
michael@0 | 105 | |
michael@0 | 106 | int64_t last_time_stamp; |
michael@0 | 107 | int ready_for_new_data; |
michael@0 | 108 | |
michael@0 | 109 | vp8_prob prob_intra; |
michael@0 | 110 | vp8_prob prob_last; |
michael@0 | 111 | vp8_prob prob_gf; |
michael@0 | 112 | vp8_prob prob_skip_false; |
michael@0 | 113 | |
michael@0 | 114 | #if CONFIG_ERROR_CONCEALMENT |
michael@0 | 115 | MB_OVERLAP *overlaps; |
michael@0 | 116 | /* the mb num from which modes and mvs (first partition) are corrupt */ |
michael@0 | 117 | unsigned int mvs_corrupt_from_mb; |
michael@0 | 118 | #endif |
michael@0 | 119 | int ec_enabled; |
michael@0 | 120 | int ec_active; |
michael@0 | 121 | int decoded_key_frame; |
michael@0 | 122 | int independent_partitions; |
michael@0 | 123 | int frame_corrupt_residual; |
michael@0 | 124 | |
michael@0 | 125 | vp8_decrypt_cb *decrypt_cb; |
michael@0 | 126 | void *decrypt_state; |
michael@0 | 127 | } VP8D_COMP; |
michael@0 | 128 | |
michael@0 | 129 | int vp8_decode_frame(VP8D_COMP *cpi); |
michael@0 | 130 | |
michael@0 | 131 | int vp8_create_decoder_instances(struct frame_buffers *fb, VP8D_CONFIG *oxcf); |
michael@0 | 132 | int vp8_remove_decoder_instances(struct frame_buffers *fb); |
michael@0 | 133 | |
michael@0 | 134 | #if CONFIG_DEBUG |
michael@0 | 135 | #define CHECK_MEM_ERROR(lval,expr) do {\ |
michael@0 | 136 | lval = (expr); \ |
michael@0 | 137 | if(!lval) \ |
michael@0 | 138 | vpx_internal_error(&pbi->common.error, VPX_CODEC_MEM_ERROR,\ |
michael@0 | 139 | "Failed to allocate "#lval" at %s:%d", \ |
michael@0 | 140 | __FILE__,__LINE__);\ |
michael@0 | 141 | } while(0) |
michael@0 | 142 | #else |
michael@0 | 143 | #define CHECK_MEM_ERROR(lval,expr) do {\ |
michael@0 | 144 | lval = (expr); \ |
michael@0 | 145 | if(!lval) \ |
michael@0 | 146 | vpx_internal_error(&pbi->common.error, VPX_CODEC_MEM_ERROR,\ |
michael@0 | 147 | "Failed to allocate "#lval);\ |
michael@0 | 148 | } while(0) |
michael@0 | 149 | #endif |
michael@0 | 150 | |
michael@0 | 151 | #endif // ONYXD_INT_H_ |