onyxd_int.h 4.2 KB

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