vp9_context_tree.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. /*
  2. * Copyright (c) 2014 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_VP9_ENCODER_VP9_CONTEXT_TREE_H_
  11. #define VPX_VP9_ENCODER_VP9_CONTEXT_TREE_H_
  12. #include "vp9/common/vp9_blockd.h"
  13. #include "vp9/encoder/vp9_block.h"
  14. #ifdef __cplusplus
  15. extern "C" {
  16. #endif
  17. struct VP9_COMP;
  18. struct VP9Common;
  19. struct ThreadData;
  20. // Structure to hold snapshot of coding context during the mode picking process
  21. typedef struct {
  22. MODE_INFO mic;
  23. MB_MODE_INFO_EXT mbmi_ext;
  24. uint8_t *zcoeff_blk;
  25. tran_low_t *coeff[MAX_MB_PLANE][3];
  26. tran_low_t *qcoeff[MAX_MB_PLANE][3];
  27. tran_low_t *dqcoeff[MAX_MB_PLANE][3];
  28. uint16_t *eobs[MAX_MB_PLANE][3];
  29. // dual buffer pointers, 0: in use, 1: best in store
  30. tran_low_t *coeff_pbuf[MAX_MB_PLANE][3];
  31. tran_low_t *qcoeff_pbuf[MAX_MB_PLANE][3];
  32. tran_low_t *dqcoeff_pbuf[MAX_MB_PLANE][3];
  33. uint16_t *eobs_pbuf[MAX_MB_PLANE][3];
  34. int is_coded;
  35. int num_4x4_blk;
  36. int skip;
  37. int pred_pixel_ready;
  38. // For current partition, only if all Y, U, and V transform blocks'
  39. // coefficients are quantized to 0, skippable is set to 0.
  40. int skippable;
  41. uint8_t skip_txfm[MAX_MB_PLANE << 2];
  42. int best_mode_index;
  43. int hybrid_pred_diff;
  44. int comp_pred_diff;
  45. int single_pred_diff;
  46. int64_t best_filter_diff[SWITCHABLE_FILTER_CONTEXTS];
  47. // TODO(jingning) Use RD_COST struct here instead. This involves a boarder
  48. // scope of refactoring.
  49. int rate;
  50. int64_t dist;
  51. int64_t rdcost;
  52. #if CONFIG_VP9_TEMPORAL_DENOISING
  53. unsigned int newmv_sse;
  54. unsigned int zeromv_sse;
  55. unsigned int zeromv_lastref_sse;
  56. PREDICTION_MODE best_sse_inter_mode;
  57. int_mv best_sse_mv;
  58. MV_REFERENCE_FRAME best_reference_frame;
  59. MV_REFERENCE_FRAME best_zeromv_reference_frame;
  60. int sb_skip_denoising;
  61. #endif
  62. // motion vector cache for adaptive motion search control in partition
  63. // search loop
  64. MV pred_mv[MAX_REF_FRAMES];
  65. INTERP_FILTER pred_interp_filter;
  66. // Used for the machine learning-based early termination
  67. int32_t sum_y_eobs;
  68. // Skip certain ref frames during RD search of rectangular partitions.
  69. uint8_t skip_ref_frame_mask;
  70. } PICK_MODE_CONTEXT;
  71. typedef struct PC_TREE {
  72. int index;
  73. PARTITION_TYPE partitioning;
  74. BLOCK_SIZE block_size;
  75. PICK_MODE_CONTEXT none;
  76. PICK_MODE_CONTEXT horizontal[2];
  77. PICK_MODE_CONTEXT vertical[2];
  78. union {
  79. struct PC_TREE *split[4];
  80. PICK_MODE_CONTEXT *leaf_split[4];
  81. };
  82. // Obtained from a simple motion search. Used by the ML based partition search
  83. // speed feature.
  84. MV mv;
  85. } PC_TREE;
  86. void vp9_setup_pc_tree(struct VP9Common *cm, struct ThreadData *td);
  87. void vp9_free_pc_tree(struct ThreadData *td);
  88. #ifdef __cplusplus
  89. } // extern "C"
  90. #endif
  91. #endif // VPX_VP9_ENCODER_VP9_CONTEXT_TREE_H_