Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 1 | /* |
Yaowu Xu | 2ab7ff0 | 2016-09-02 12:04:54 -0700 | [diff] [blame] | 2 | * Copyright (c) 2016, Alliance for Open Media. All rights reserved |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 3 | * |
Yaowu Xu | 2ab7ff0 | 2016-09-02 12:04:54 -0700 | [diff] [blame] | 4 | * 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 Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 10 | */ |
| 11 | |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 12 | #ifndef AV1_ENCODER_CONTEXT_TREE_H_ |
| 13 | #define AV1_ENCODER_CONTEXT_TREE_H_ |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 14 | |
| 15 | #include "av1/common/blockd.h" |
| 16 | #include "av1/encoder/block.h" |
| 17 | |
| 18 | #ifdef __cplusplus |
| 19 | extern "C" { |
| 20 | #endif |
| 21 | |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 22 | struct AV1_COMP; |
| 23 | struct AV1Common; |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 24 | struct ThreadData; |
| 25 | |
| 26 | // Structure to hold snapshot of coding context during the mode picking process |
| 27 | typedef 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 Zern | 7b9407a | 2016-05-18 23:48:05 -0700 | [diff] [blame^] | 61 | InterpFilter pred_interp_filter; |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 62 | #if CONFIG_EXT_PARTITION_TYPES |
| 63 | PARTITION_TYPE partition; |
| 64 | #endif |
| 65 | } PICK_MODE_CONTEXT; |
| 66 | |
| 67 | typedef 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 Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 97 | void av1_setup_pc_tree(struct AV1Common *cm, struct ThreadData *td); |
| 98 | void av1_free_pc_tree(struct ThreadData *td); |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 99 | |
| 100 | #ifdef __cplusplus |
| 101 | } // extern "C" |
| 102 | #endif |
| 103 | |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 104 | #endif /* AV1_ENCODER_CONTEXT_TREE_H_ */ |