2
0

onyxd_int.h 4.4 KB

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