blob: c798cdfb45b80f5777482111c7dfd8d75db282a5 [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;
30 uint8_t *color_index_map[2];
31#if CONFIG_VAR_TX
32 uint8_t *blk_skip[MAX_MB_PLANE];
33#endif
34
35 // dual buffer pointers, 0: in use, 1: best in store
36 tran_low_t *coeff[MAX_MB_PLANE][3];
37 tran_low_t *qcoeff[MAX_MB_PLANE][3];
38 tran_low_t *dqcoeff[MAX_MB_PLANE][3];
39 uint16_t *eobs[MAX_MB_PLANE][3];
40
41 int is_coded;
42 int num_4x4_blk;
43 int skip;
44 int pred_pixel_ready;
45 // For current partition, only if all Y, U, and V transform blocks'
46 // coefficients are quantized to 0, skippable is set to 0.
47 int skippable;
48 int best_mode_index;
49 int hybrid_pred_diff;
50 int comp_pred_diff;
51 int single_pred_diff;
52
53 // TODO(jingning) Use RD_COST struct here instead. This involves a boarder
54 // scope of refactoring.
55 int rate;
56 int64_t dist;
57
58 // motion vector cache for adaptive motion search control in partition
59 // search loop
60 MV pred_mv[TOTAL_REFS_PER_FRAME];
James Zern7b9407a2016-05-18 23:48:05 -070061 InterpFilter pred_interp_filter;
Yaowu Xuc27fc142016-08-22 16:08:15 -070062#if CONFIG_EXT_PARTITION_TYPES
63 PARTITION_TYPE partition;
64#endif
65} PICK_MODE_CONTEXT;
66
67typedef struct PC_TREE {
68 int index;
69 PARTITION_TYPE partitioning;
70 BLOCK_SIZE block_size;
71 PICK_MODE_CONTEXT none;
72 PICK_MODE_CONTEXT horizontal[2];
73 PICK_MODE_CONTEXT vertical[2];
74#if CONFIG_EXT_PARTITION_TYPES
75 PICK_MODE_CONTEXT horizontala[3];
76 PICK_MODE_CONTEXT horizontalb[3];
77 PICK_MODE_CONTEXT verticala[3];
78 PICK_MODE_CONTEXT verticalb[3];
79#endif
80 union {
81 struct PC_TREE *split[4];
82 PICK_MODE_CONTEXT *leaf_split[4];
83 };
84#ifdef CONFIG_SUPERTX
85 PICK_MODE_CONTEXT horizontal_supertx;
86 PICK_MODE_CONTEXT vertical_supertx;
87 PICK_MODE_CONTEXT split_supertx;
88#if CONFIG_EXT_PARTITION_TYPES
89 PICK_MODE_CONTEXT horizontala_supertx;
90 PICK_MODE_CONTEXT horizontalb_supertx;
91 PICK_MODE_CONTEXT verticala_supertx;
92 PICK_MODE_CONTEXT verticalb_supertx;
93#endif
94#endif
95} PC_TREE;
96
Yaowu Xuf883b422016-08-30 14:01:10 -070097void av1_setup_pc_tree(struct AV1Common *cm, struct ThreadData *td);
98void av1_free_pc_tree(struct ThreadData *td);
Yaowu Xuc27fc142016-08-22 16:08:15 -070099
100#ifdef __cplusplus
101} // extern "C"
102#endif
103
Yaowu Xuf883b422016-08-30 14:01:10 -0700104#endif /* AV1_ENCODER_CONTEXT_TREE_H_ */