michael@0: /* michael@0: * Copyright (c) 2010 The WebM project authors. All Rights Reserved. michael@0: * michael@0: * Use of this source code is governed by a BSD-style license michael@0: * that can be found in the LICENSE file in the root of the source michael@0: * tree. An additional intellectual property rights grant can be found michael@0: * in the file PATENTS. All contributing project authors may michael@0: * be found in the AUTHORS file in the root of the source tree. michael@0: */ michael@0: michael@0: michael@0: #ifndef ONYXD_INT_H_ michael@0: #define ONYXD_INT_H_ michael@0: michael@0: #include "vpx_config.h" michael@0: #include "vp8/common/onyxd.h" michael@0: #include "treereader.h" michael@0: #include "vp8/common/onyxc_int.h" michael@0: #include "vp8/common/threading.h" michael@0: michael@0: #if CONFIG_ERROR_CONCEALMENT michael@0: #include "ec_types.h" michael@0: #endif michael@0: michael@0: typedef struct michael@0: { michael@0: int ithread; michael@0: void *ptr1; michael@0: void *ptr2; michael@0: } DECODETHREAD_DATA; michael@0: michael@0: typedef struct michael@0: { michael@0: MACROBLOCKD mbd; michael@0: } MB_ROW_DEC; michael@0: michael@0: michael@0: typedef struct michael@0: { michael@0: int enabled; michael@0: unsigned int count; michael@0: const unsigned char *ptrs[MAX_PARTITIONS]; michael@0: unsigned int sizes[MAX_PARTITIONS]; michael@0: } FRAGMENT_DATA; michael@0: michael@0: #define MAX_FB_MT_DEC 32 michael@0: michael@0: struct frame_buffers michael@0: { michael@0: /* michael@0: * this struct will be populated with frame buffer management michael@0: * info in future commits. */ michael@0: michael@0: /* enable/disable frame-based threading */ michael@0: int use_frame_threads; michael@0: michael@0: /* decoder instances */ michael@0: struct VP8D_COMP *pbi[MAX_FB_MT_DEC]; michael@0: michael@0: }; michael@0: michael@0: typedef struct VP8D_COMP michael@0: { michael@0: DECLARE_ALIGNED(16, MACROBLOCKD, mb); michael@0: michael@0: YV12_BUFFER_CONFIG *dec_fb_ref[NUM_YV12_BUFFERS]; michael@0: michael@0: DECLARE_ALIGNED(16, VP8_COMMON, common); michael@0: michael@0: /* the last partition will be used for the modes/mvs */ michael@0: vp8_reader mbc[MAX_PARTITIONS]; michael@0: michael@0: VP8D_CONFIG oxcf; michael@0: michael@0: FRAGMENT_DATA fragments; michael@0: michael@0: #if CONFIG_MULTITHREAD michael@0: /* variable for threading */ michael@0: michael@0: volatile int b_multithreaded_rd; michael@0: int max_threads; michael@0: int current_mb_col_main; michael@0: unsigned int decoding_thread_count; michael@0: int allocated_decoding_thread_count; michael@0: michael@0: int mt_baseline_filter_level[MAX_MB_SEGMENTS]; michael@0: int sync_range; michael@0: int *mt_current_mb_col; /* Each row remembers its already decoded column. */ michael@0: michael@0: unsigned char **mt_yabove_row; /* mb_rows x width */ michael@0: unsigned char **mt_uabove_row; michael@0: unsigned char **mt_vabove_row; michael@0: unsigned char **mt_yleft_col; /* mb_rows x 16 */ michael@0: unsigned char **mt_uleft_col; /* mb_rows x 8 */ michael@0: unsigned char **mt_vleft_col; /* mb_rows x 8 */ michael@0: michael@0: MB_ROW_DEC *mb_row_di; michael@0: DECODETHREAD_DATA *de_thread_data; michael@0: michael@0: pthread_t *h_decoding_thread; michael@0: sem_t *h_event_start_decoding; michael@0: sem_t h_event_end_decoding; michael@0: /* end of threading data */ michael@0: #endif michael@0: michael@0: int64_t last_time_stamp; michael@0: int ready_for_new_data; michael@0: michael@0: vp8_prob prob_intra; michael@0: vp8_prob prob_last; michael@0: vp8_prob prob_gf; michael@0: vp8_prob prob_skip_false; michael@0: michael@0: #if CONFIG_ERROR_CONCEALMENT michael@0: MB_OVERLAP *overlaps; michael@0: /* the mb num from which modes and mvs (first partition) are corrupt */ michael@0: unsigned int mvs_corrupt_from_mb; michael@0: #endif michael@0: int ec_enabled; michael@0: int ec_active; michael@0: int decoded_key_frame; michael@0: int independent_partitions; michael@0: int frame_corrupt_residual; michael@0: michael@0: vp8_decrypt_cb *decrypt_cb; michael@0: void *decrypt_state; michael@0: } VP8D_COMP; michael@0: michael@0: int vp8_decode_frame(VP8D_COMP *cpi); michael@0: michael@0: int vp8_create_decoder_instances(struct frame_buffers *fb, VP8D_CONFIG *oxcf); michael@0: int vp8_remove_decoder_instances(struct frame_buffers *fb); michael@0: michael@0: #if CONFIG_DEBUG michael@0: #define CHECK_MEM_ERROR(lval,expr) do {\ michael@0: lval = (expr); \ michael@0: if(!lval) \ michael@0: vpx_internal_error(&pbi->common.error, VPX_CODEC_MEM_ERROR,\ michael@0: "Failed to allocate "#lval" at %s:%d", \ michael@0: __FILE__,__LINE__);\ michael@0: } while(0) michael@0: #else michael@0: #define CHECK_MEM_ERROR(lval,expr) do {\ michael@0: lval = (expr); \ michael@0: if(!lval) \ michael@0: vpx_internal_error(&pbi->common.error, VPX_CODEC_MEM_ERROR,\ michael@0: "Failed to allocate "#lval);\ michael@0: } while(0) michael@0: #endif michael@0: michael@0: #endif // ONYXD_INT_H_