Line data Source code
1 : /*
2 : * Copyright (c) 2016, Alliance for Open Media. All rights reserved
3 : *
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.
10 : */
11 :
12 : #ifndef AV1_COMMON_SEG_COMMON_H_
13 : #define AV1_COMMON_SEG_COMMON_H_
14 :
15 : #include "aom_dsp/prob.h"
16 :
17 : #ifdef __cplusplus
18 : extern "C" {
19 : #endif
20 :
21 : #define SEGMENT_DELTADATA 0
22 : #define SEGMENT_ABSDATA 1
23 :
24 : #define MAX_SEGMENTS 8
25 : #define SEG_TREE_PROBS (MAX_SEGMENTS - 1)
26 :
27 : #define PREDICTION_PROBS 3
28 :
29 : // Segment level features.
30 : typedef enum {
31 : SEG_LVL_ALT_Q = 0, // Use alternate Quantizer ....
32 : SEG_LVL_ALT_LF = 1, // Use alternate loop filter value...
33 : SEG_LVL_REF_FRAME = 2, // Optional Segment reference frame
34 : SEG_LVL_SKIP = 3, // Optional Segment (0,0) + skip mode
35 : SEG_LVL_MAX = 4 // Number of features supported
36 : } SEG_LVL_FEATURES;
37 :
38 : struct segmentation {
39 : uint8_t enabled;
40 : uint8_t update_map;
41 : uint8_t update_data;
42 : uint8_t abs_delta;
43 : uint8_t temporal_update;
44 :
45 : int16_t feature_data[MAX_SEGMENTS][SEG_LVL_MAX];
46 : unsigned int feature_mask[MAX_SEGMENTS];
47 : };
48 :
49 : struct segmentation_probs {
50 : aom_prob tree_probs[SEG_TREE_PROBS];
51 : aom_cdf_prob tree_cdf[CDF_SIZE(MAX_SEGMENTS)];
52 : aom_prob pred_probs[PREDICTION_PROBS];
53 : };
54 :
55 0 : static INLINE int segfeature_active(const struct segmentation *seg,
56 : int segment_id,
57 : SEG_LVL_FEATURES feature_id) {
58 0 : return seg->enabled && (seg->feature_mask[segment_id] & (1 << feature_id));
59 : }
60 :
61 : void av1_clearall_segfeatures(struct segmentation *seg);
62 :
63 : void av1_enable_segfeature(struct segmentation *seg, int segment_id,
64 : SEG_LVL_FEATURES feature_id);
65 :
66 : int av1_seg_feature_data_max(SEG_LVL_FEATURES feature_id);
67 :
68 : int av1_is_segfeature_signed(SEG_LVL_FEATURES feature_id);
69 :
70 : void av1_set_segdata(struct segmentation *seg, int segment_id,
71 : SEG_LVL_FEATURES feature_id, int seg_data);
72 :
73 0 : static INLINE int get_segdata(const struct segmentation *seg, int segment_id,
74 : SEG_LVL_FEATURES feature_id) {
75 0 : return seg->feature_data[segment_id][feature_id];
76 : }
77 :
78 : extern const aom_tree_index av1_segment_tree[TREE_SIZE(MAX_SEGMENTS)];
79 :
80 : #ifdef __cplusplus
81 : } // extern "C"
82 : #endif
83 :
84 : #endif // AV1_COMMON_SEG_COMMON_H_
|