vp9_context_tree.h 2.74 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13
/*
 *  Copyright (c) 2014 The WebM project authors. All Rights Reserved.
 *
 *  Use of this source code is governed by a BSD-style license
 *  that can be found in the LICENSE file in the root of the source
 *  tree. An additional intellectual property rights grant can be found
 *  in the file PATENTS.  All contributing project authors may
 *  be found in the AUTHORS file in the root of the source tree.
 */

#ifndef VP9_ENCODER_VP9_CONTEXT_TREE_H_
#define VP9_ENCODER_VP9_CONTEXT_TREE_H_

14
#include "vp9/common/vp9_blockd.h"
15
#include "vp9/encoder/vp9_block.h"
16

James Zern's avatar
James Zern committed
17 18 19 20
#ifdef __cplusplus
extern "C" {
#endif

21
struct VP9_COMP;
22
struct VP9Common;
23
struct ThreadData;
24 25 26 27

// Structure to hold snapshot of coding context during the mode picking process
typedef struct {
  MODE_INFO mic;
28
  MB_MODE_INFO_EXT mbmi_ext;
29
  uint8_t *zcoeff_blk;
30 31 32
  tran_low_t *coeff[MAX_MB_PLANE][3];
  tran_low_t *qcoeff[MAX_MB_PLANE][3];
  tran_low_t *dqcoeff[MAX_MB_PLANE][3];
33 34 35
  uint16_t *eobs[MAX_MB_PLANE][3];

  // dual buffer pointers, 0: in use, 1: best in store
36 37 38
  tran_low_t *coeff_pbuf[MAX_MB_PLANE][3];
  tran_low_t *qcoeff_pbuf[MAX_MB_PLANE][3];
  tran_low_t *dqcoeff_pbuf[MAX_MB_PLANE][3];
39 40 41 42 43
  uint16_t *eobs_pbuf[MAX_MB_PLANE][3];

  int is_coded;
  int num_4x4_blk;
  int skip;
44
  int pred_pixel_ready;
45 46 47
  // For current partition, only if all Y, U, and V transform blocks'
  // coefficients are quantized to 0, skippable is set to 0.
  int skippable;
48
  uint8_t skip_txfm[MAX_MB_PLANE << 2];
49 50 51 52 53 54
  int best_mode_index;
  int hybrid_pred_diff;
  int comp_pred_diff;
  int single_pred_diff;
  int64_t best_filter_diff[SWITCHABLE_FILTER_CONTEXTS];

55 56 57 58 59
  // TODO(jingning) Use RD_COST struct here instead. This involves a boarder
  // scope of refactoring.
  int rate;
  int64_t dist;

60
#if CONFIG_VP9_TEMPORAL_DENOISING
61 62
  unsigned int newmv_sse;
  unsigned int zeromv_sse;
63
  unsigned int zeromv_lastref_sse;
64 65 66 67
  PREDICTION_MODE best_sse_inter_mode;
  int_mv best_sse_mv;
  MV_REFERENCE_FRAME best_reference_frame;
  MV_REFERENCE_FRAME best_zeromv_reference_frame;
68
  int sb_skip_denoising;
69 70
#endif

71 72
  // motion vector cache for adaptive motion search control in partition
  // search loop
Dmitry Kovalev's avatar
Dmitry Kovalev committed
73
  MV pred_mv[MAX_REF_FRAMES];
74
  INTERP_FILTER pred_interp_filter;
75 76

  // Used for the machine learning-based early termination
77
  int32_t sum_y_eobs;
78 79 80 81 82 83 84 85 86 87 88 89 90 91 92
} PICK_MODE_CONTEXT;

typedef struct PC_TREE {
  int index;
  PARTITION_TYPE partitioning;
  BLOCK_SIZE block_size;
  PICK_MODE_CONTEXT none;
  PICK_MODE_CONTEXT horizontal[2];
  PICK_MODE_CONTEXT vertical[2];
  union {
    struct PC_TREE *split[4];
    PICK_MODE_CONTEXT *leaf_split[4];
  };
} PC_TREE;

93 94
void vp9_setup_pc_tree(struct VP9Common *cm, struct ThreadData *td);
void vp9_free_pc_tree(struct ThreadData *td);
95

James Zern's avatar
James Zern committed
96 97 98 99
#ifdef __cplusplus
}  // extern "C"
#endif

100
#endif /* VP9_ENCODER_VP9_CONTEXT_TREE_H_ */