blob: 67954126c69f140580935a91296f129f45807f08 [file] [log] [blame]
Yaowu Xuc27fc142016-08-22 16:08:15 -07001/*
Yaowu Xu2ab7ff02016-09-02 12:04:54 -07002 * Copyright (c) 2016, Alliance for Open Media. All rights reserved
Yaowu Xuc27fc142016-08-22 16:08:15 -07003 *
Yaowu Xu2ab7ff02016-09-02 12:04:54 -07004 * This source code is subject to the terms of the BSD 2 Clause License and
5 * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
6 * was not distributed with this source code in the LICENSE file, you can
7 * obtain it at www.aomedia.org/license/software. If the Alliance for Open
8 * Media Patent License 1.0 was not distributed with this source code in the
9 * PATENTS file, you can obtain it at www.aomedia.org/license/patent.
Yaowu Xuc27fc142016-08-22 16:08:15 -070010 */
11
Yaowu Xuf883b422016-08-30 14:01:10 -070012#ifndef AV1_ENCODER_CONTEXT_TREE_H_
13#define AV1_ENCODER_CONTEXT_TREE_H_
Yaowu Xuc27fc142016-08-22 16:08:15 -070014
15#include "av1/common/blockd.h"
16#include "av1/encoder/block.h"
17
18#ifdef __cplusplus
19extern "C" {
20#endif
21
Yaowu Xuf883b422016-08-30 14:01:10 -070022struct AV1_COMP;
23struct AV1Common;
Yaowu Xuc27fc142016-08-22 16:08:15 -070024struct ThreadData;
25
26// Structure to hold snapshot of coding context during the mode picking process
27typedef struct {
28 MODE_INFO mic;
29 MB_MODE_INFO_EXT mbmi_ext;
Urvang Joshib100db72016-10-12 16:28:56 -070030#if CONFIG_PALETTE
Yaowu Xuc27fc142016-08-22 16:08:15 -070031 uint8_t *color_index_map[2];
Urvang Joshib100db72016-10-12 16:28:56 -070032#endif // CONFIG_PALETTE
Yaowu Xuc27fc142016-08-22 16:08:15 -070033#if CONFIG_VAR_TX
34 uint8_t *blk_skip[MAX_MB_PLANE];
35#endif
36
37 // dual buffer pointers, 0: in use, 1: best in store
Brennan Shacklette0b5ae82016-11-07 17:25:20 -080038 tran_low_t *coeff[MAX_MB_PLANE];
39 tran_low_t *qcoeff[MAX_MB_PLANE];
40 tran_low_t *dqcoeff[MAX_MB_PLANE];
Yushin Cho77bba8d2016-11-04 16:36:56 -070041#if CONFIG_PVQ
42 tran_low_t *pvq_ref_coeff[MAX_MB_PLANE];
43#endif
Brennan Shacklette0b5ae82016-11-07 17:25:20 -080044 uint16_t *eobs[MAX_MB_PLANE];
Angie Chiang74e23072017-03-24 14:54:23 -070045#if CONFIG_LV_MAP
46 uint8_t *txb_entropy_ctx[MAX_MB_PLANE];
47#endif
Yaowu Xuc27fc142016-08-22 16:08:15 -070048
Yaowu Xuc27fc142016-08-22 16:08:15 -070049 int num_4x4_blk;
50 int skip;
51 int pred_pixel_ready;
52 // For current partition, only if all Y, U, and V transform blocks'
53 // coefficients are quantized to 0, skippable is set to 0.
54 int skippable;
55 int best_mode_index;
56 int hybrid_pred_diff;
57 int comp_pred_diff;
58 int single_pred_diff;
59
60 // TODO(jingning) Use RD_COST struct here instead. This involves a boarder
61 // scope of refactoring.
62 int rate;
63 int64_t dist;
64
65 // motion vector cache for adaptive motion search control in partition
66 // search loop
67 MV pred_mv[TOTAL_REFS_PER_FRAME];
James Zern7b9407a2016-05-18 23:48:05 -070068 InterpFilter pred_interp_filter;
Yaowu Xuc27fc142016-08-22 16:08:15 -070069#if CONFIG_EXT_PARTITION_TYPES
70 PARTITION_TYPE partition;
71#endif
72} PICK_MODE_CONTEXT;
73
74typedef struct PC_TREE {
75 int index;
76 PARTITION_TYPE partitioning;
77 BLOCK_SIZE block_size;
78 PICK_MODE_CONTEXT none;
79 PICK_MODE_CONTEXT horizontal[2];
80 PICK_MODE_CONTEXT vertical[2];
81#if CONFIG_EXT_PARTITION_TYPES
82 PICK_MODE_CONTEXT horizontala[3];
83 PICK_MODE_CONTEXT horizontalb[3];
84 PICK_MODE_CONTEXT verticala[3];
85 PICK_MODE_CONTEXT verticalb[3];
86#endif
87 union {
88 struct PC_TREE *split[4];
89 PICK_MODE_CONTEXT *leaf_split[4];
90 };
91#ifdef CONFIG_SUPERTX
92 PICK_MODE_CONTEXT horizontal_supertx;
93 PICK_MODE_CONTEXT vertical_supertx;
94 PICK_MODE_CONTEXT split_supertx;
95#if CONFIG_EXT_PARTITION_TYPES
96 PICK_MODE_CONTEXT horizontala_supertx;
97 PICK_MODE_CONTEXT horizontalb_supertx;
98 PICK_MODE_CONTEXT verticala_supertx;
99 PICK_MODE_CONTEXT verticalb_supertx;
100#endif
101#endif
102} PC_TREE;
103
Yaowu Xuf883b422016-08-30 14:01:10 -0700104void av1_setup_pc_tree(struct AV1Common *cm, struct ThreadData *td);
105void av1_free_pc_tree(struct ThreadData *td);
Yaowu Xuc27fc142016-08-22 16:08:15 -0700106
107#ifdef __cplusplus
108} // extern "C"
109#endif
110
Yaowu Xuf883b422016-08-30 14:01:10 -0700111#endif /* AV1_ENCODER_CONTEXT_TREE_H_ */