vp9_context_tree.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  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 VP9_ENCODER_VP9_CONTEXT_TREE_H_
  11. #define 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. #if CONFIG_VP9_TEMPORAL_DENOISING
  52. unsigned int newmv_sse;
  53. unsigned int zeromv_sse;
  54. unsigned int zeromv_lastref_sse;
  55. PREDICTION_MODE best_sse_inter_mode;
  56. int_mv best_sse_mv;
  57. MV_REFERENCE_FRAME best_reference_frame;
  58. MV_REFERENCE_FRAME best_zeromv_reference_frame;
  59. #endif
  60. // motion vector cache for adaptive motion search control in partition
  61. // search loop
  62. MV pred_mv[MAX_REF_FRAMES];
  63. INTERP_FILTER pred_interp_filter;
  64. } PICK_MODE_CONTEXT;
  65. typedef struct PC_TREE {
  66. int index;
  67. PARTITION_TYPE partitioning;
  68. BLOCK_SIZE block_size;
  69. PICK_MODE_CONTEXT none;
  70. PICK_MODE_CONTEXT horizontal[2];
  71. PICK_MODE_CONTEXT vertical[2];
  72. union {
  73. struct PC_TREE *split[4];
  74. PICK_MODE_CONTEXT *leaf_split[4];
  75. };
  76. } PC_TREE;
  77. void vp9_setup_pc_tree(struct VP9Common *cm, struct ThreadData *td);
  78. void vp9_free_pc_tree(struct ThreadData *td);
  79. #ifdef __cplusplus
  80. } // extern "C"
  81. #endif
  82. #endif /* VP9_ENCODER_VP9_CONTEXT_TREE_H_ */