vp9_onyxd_int.h 2.56 KB
Newer Older
John Koleszar's avatar
John Koleszar committed
1
/*
2
 *  Copyright (c) 2010 The WebM project authors. All Rights Reserved.
John Koleszar's avatar
John Koleszar committed
3
 *
4
 *  Use of this source code is governed by a BSD-style license
5
6
 *  that can be found in the LICENSE file in the root of the source
 *  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.
John Koleszar's avatar
John Koleszar committed
9
10
11
 */


12
13
#ifndef VP9_DECODER_VP9_ONYXD_INT_H_
#define VP9_DECODER_VP9_ONYXD_INT_H_
John Koleszar's avatar
John Koleszar committed
14
#include "vpx_ports/config.h"
15
#include "vp9/common/vp9_onyxd.h"
16
#include "vp9/decoder/vp9_treereader.h"
17
#include "vp9/common/vp9_onyxc_int.h"
18
#include "vp9/decoder/vp9_dequantize.h"
John Koleszar's avatar
John Koleszar committed
19

John Koleszar's avatar
John Koleszar committed
20
// #define DEC_DEBUG
21

John Koleszar's avatar
John Koleszar committed
22
23
24
25
typedef struct {
  int ithread;
  void *ptr1;
  void *ptr2;
John Koleszar's avatar
John Koleszar committed
26
27
} DECODETHREAD_DATA;

John Koleszar's avatar
John Koleszar committed
28
29
30
31
32
typedef struct {
  MACROBLOCKD  mbd;
  int mb_row;
  int current_mb_col;
  short *coef_ptr;
John Koleszar's avatar
John Koleszar committed
33
34
} MB_ROW_DEC;

John Koleszar's avatar
John Koleszar committed
35
36
37
38
typedef struct {
  int const *scan;
  int const *scan_8x8;
  UINT8 const *ptr_block2leftabove;
39
  vp9_tree_index const *vp9_coef_tree_ptr;
John Koleszar's avatar
John Koleszar committed
40
41
42
  unsigned char *norm_ptr;
  UINT8 *ptr_coef_bands_x;
  UINT8 *ptr_coef_bands_x_8x8;
John Koleszar's avatar
John Koleszar committed
43

John Koleszar's avatar
John Koleszar committed
44
45
  ENTROPY_CONTEXT_PLANES *A;
  ENTROPY_CONTEXT_PLANES *L;
John Koleszar's avatar
John Koleszar committed
46

John Koleszar's avatar
John Koleszar committed
47
  INT16 *qcoeff_start_ptr;
John Koleszar's avatar
John Koleszar committed
48

49
50
51
  vp9_prob const *coef_probs[BLOCK_TYPES];
  vp9_prob const *coef_probs_8x8[BLOCK_TYPES_8X8];
  vp9_prob const *coef_probs_16X16[BLOCK_TYPES_16X16];
John Koleszar's avatar
John Koleszar committed
52

John Koleszar's avatar
John Koleszar committed
53
  UINT8 eob[25];
John Koleszar's avatar
John Koleszar committed
54
55
56

} DETOK;

57
typedef struct VP9Decompressor {
John Koleszar's avatar
John Koleszar committed
58
  DECLARE_ALIGNED(16, MACROBLOCKD, mb);
John Koleszar's avatar
John Koleszar committed
59

60
  DECLARE_ALIGNED(16, VP9_COMMON, common);
John Koleszar's avatar
John Koleszar committed
61

62
  VP9D_CONFIG oxcf;
John Koleszar's avatar
John Koleszar committed
63
64


John Koleszar's avatar
John Koleszar committed
65
66
  const unsigned char *Source;
  unsigned int   source_sz;
67

68
  vp9_reader *mbc;
John Koleszar's avatar
John Koleszar committed
69
70
  int64_t last_time_stamp;
  int   ready_for_new_data;
John Koleszar's avatar
John Koleszar committed
71

John Koleszar's avatar
John Koleszar committed
72
  DETOK detoken;
John Koleszar's avatar
John Koleszar committed
73

74
75
76
77
78
  vp9_dequant_idct_add_fn_t            idct_add;
  vp9_dequant_dc_idct_add_fn_t         dc_idct_add;
  vp9_dequant_dc_idct_add_y_block_fn_t dc_idct_add_y_block;
  vp9_dequant_idct_add_y_block_fn_t    idct_add_y_block;
  vp9_dequant_idct_add_uv_block_fn_t   idct_add_uv_block;
John Koleszar's avatar
John Koleszar committed
79

80
  vp9_prob prob_skip_false;
Scott LaVarnway's avatar
Scott LaVarnway committed
81

John Koleszar's avatar
John Koleszar committed
82
  int decoded_key_frame;
83

84
} VP9D_COMP;
John Koleszar's avatar
John Koleszar committed
85

86
int vp9_decode_frame(VP9D_COMP *cpi, const unsigned char **p_data_end);
John Koleszar's avatar
John Koleszar committed
87
88
89
90


#if CONFIG_DEBUG
#define CHECK_MEM_ERROR(lval,expr) do {\
John Koleszar's avatar
John Koleszar committed
91
92
93
94
95
96
    lval = (expr); \
    if(!lval) \
      vpx_internal_error(&pbi->common.error, VPX_CODEC_MEM_ERROR,\
                         "Failed to allocate "#lval" at %s:%d", \
                         __FILE__,__LINE__);\
  } while(0)
John Koleszar's avatar
John Koleszar committed
97
98
#else
#define CHECK_MEM_ERROR(lval,expr) do {\
John Koleszar's avatar
John Koleszar committed
99
100
101
102
103
    lval = (expr); \
    if(!lval) \
      vpx_internal_error(&pbi->common.error, VPX_CODEC_MEM_ERROR,\
                         "Failed to allocate "#lval);\
  } while(0)
John Koleszar's avatar
John Koleszar committed
104
105
#endif

106
#endif  // __INC_ONYXD_INT_H