PageRenderTime 22ms CodeModel.GetById 14ms app.highlight 5ms RepoModel.GetById 1ms app.codeStats 0ms

/media/libvpx/vp8/decoder/onyxd_int.h

http://github.com/zpao/v8monkey
C Header | 164 lines | 117 code | 35 blank | 12 comment | 2 complexity | 043750e496f2e3bb65ebcf0ddfe905a4 MD5 | raw file
  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_ports/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#include "dequantize.h"
 20#if CONFIG_ERROR_CONCEALMENT
 21#include "ec_types.h"
 22#endif
 23
 24typedef struct
 25{
 26    int ithread;
 27    void *ptr1;
 28    void *ptr2;
 29} DECODETHREAD_DATA;
 30
 31typedef struct
 32{
 33    MACROBLOCKD  mbd;
 34    int mb_row;
 35    int current_mb_col;
 36    short *coef_ptr;
 37} MB_ROW_DEC;
 38
 39typedef struct
 40{
 41    int64_t time_stamp;
 42    int size;
 43} DATARATE;
 44
 45typedef struct
 46{
 47    int const *scan;
 48    UINT8 const *ptr_block2leftabove;
 49    vp8_tree_index const *vp8_coef_tree_ptr;
 50    unsigned char *norm_ptr;
 51    UINT8 *ptr_coef_bands_x;
 52
 53    ENTROPY_CONTEXT_PLANES *A;
 54    ENTROPY_CONTEXT_PLANES *L;
 55
 56    INT16 *qcoeff_start_ptr;
 57    BOOL_DECODER *current_bc;
 58
 59    vp8_prob const *coef_probs[4];
 60
 61    UINT8 eob[25];
 62
 63} DETOK;
 64
 65typedef struct VP8Decompressor
 66{
 67    DECLARE_ALIGNED(16, MACROBLOCKD, mb);
 68
 69    DECLARE_ALIGNED(16, VP8_COMMON, common);
 70
 71    vp8_reader bc, bc2;
 72
 73    VP8D_CONFIG oxcf;
 74
 75
 76    const unsigned char *Source;
 77    unsigned int   source_sz;
 78    const unsigned char *partitions[MAX_PARTITIONS];
 79    unsigned int   partition_sizes[MAX_PARTITIONS];
 80    unsigned int   num_partitions;
 81
 82#if CONFIG_MULTITHREAD
 83    /* variable for threading */
 84
 85    volatile int b_multithreaded_rd;
 86    int max_threads;
 87    int current_mb_col_main;
 88    int decoding_thread_count;
 89    int allocated_decoding_thread_count;
 90
 91    int mt_baseline_filter_level[MAX_MB_SEGMENTS];
 92    int sync_range;
 93    int *mt_current_mb_col;                  /* Each row remembers its already decoded column. */
 94
 95    unsigned char **mt_yabove_row;           /* mb_rows x width */
 96    unsigned char **mt_uabove_row;
 97    unsigned char **mt_vabove_row;
 98    unsigned char **mt_yleft_col;            /* mb_rows x 16 */
 99    unsigned char **mt_uleft_col;            /* mb_rows x 8 */
100    unsigned char **mt_vleft_col;            /* mb_rows x 8 */
101
102    MB_ROW_DEC           *mb_row_di;
103    DECODETHREAD_DATA    *de_thread_data;
104
105    pthread_t           *h_decoding_thread;
106    sem_t               *h_event_start_decoding;
107    sem_t                h_event_end_decoding;
108    /* end of threading data */
109#endif
110
111    vp8_reader *mbc;
112    int64_t last_time_stamp;
113    int   ready_for_new_data;
114
115    DATARATE dr[16];
116
117    DETOK detoken;
118
119#if CONFIG_RUNTIME_CPU_DETECT
120    vp8_dequant_rtcd_vtable_t        dequant;
121#endif
122
123
124    vp8_prob prob_intra;
125    vp8_prob prob_last;
126    vp8_prob prob_gf;
127    vp8_prob prob_skip_false;
128
129#if CONFIG_ERROR_CONCEALMENT
130    MB_OVERLAP *overlaps;
131    /* the mb num from which modes and mvs (first partition) are corrupt */
132    unsigned int mvs_corrupt_from_mb;
133#endif
134    int ec_enabled;
135    int ec_active;
136    int input_partition;
137    int decoded_key_frame;
138    int independent_partitions;
139    int frame_corrupt_residual;
140
141} VP8D_COMP;
142
143int vp8_decode_frame(VP8D_COMP *cpi);
144void vp8_dmachine_specific_config(VP8D_COMP *pbi);
145
146
147#if CONFIG_DEBUG
148#define CHECK_MEM_ERROR(lval,expr) do {\
149        lval = (expr); \
150        if(!lval) \
151            vpx_internal_error(&pbi->common.error, VPX_CODEC_MEM_ERROR,\
152                               "Failed to allocate "#lval" at %s:%d", \
153                               __FILE__,__LINE__);\
154    } while(0)
155#else
156#define CHECK_MEM_ERROR(lval,expr) do {\
157        lval = (expr); \
158        if(!lval) \
159            vpx_internal_error(&pbi->common.error, VPX_CODEC_MEM_ERROR,\
160                               "Failed to allocate "#lval);\
161    } while(0)
162#endif
163
164#endif