vp9_seg_common.h 2.35 KB
Newer Older
1 2 3 4 5 6 7 8 9 10
/*
 *  Copyright (c) 2012 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.
 */

11 12
#ifndef VP9_COMMON_VP9_SEG_COMMON_H_
#define VP9_COMMON_VP9_SEG_COMMON_H_
13

14
#include "vp9/common/vp9_prob.h"
15

16 17 18 19
#ifdef __cplusplus
extern "C" {
#endif

20 21 22
#define SEGMENT_DELTADATA   0
#define SEGMENT_ABSDATA     1

Paul Wilkins's avatar
Paul Wilkins committed
23 24
#define MAX_SEGMENTS     8
#define SEG_TREE_PROBS   (MAX_SEGMENTS-1)
25 26 27 28 29 30 31 32 33

#define PREDICTION_PROBS 3

// Segment level features.
typedef enum {
  SEG_LVL_ALT_Q = 0,               // Use alternate Quantizer ....
  SEG_LVL_ALT_LF = 1,              // Use alternate loop filter value...
  SEG_LVL_REF_FRAME = 2,           // Optional Segment reference frame
  SEG_LVL_SKIP = 3,                // Optional Segment (0,0) + skip mode
Paul Wilkins's avatar
Paul Wilkins committed
34
  SEG_LVL_MAX = 4                  // Number of features supported
35 36 37 38 39 40 41 42 43 44
} SEG_LVL_FEATURES;


struct segmentation {
  uint8_t enabled;
  uint8_t update_map;
  uint8_t update_data;
  uint8_t abs_delta;
  uint8_t temporal_update;

Paul Wilkins's avatar
Paul Wilkins committed
45
  vp9_prob tree_probs[SEG_TREE_PROBS];
46 47
  vp9_prob pred_probs[PREDICTION_PROBS];

Paul Wilkins's avatar
Paul Wilkins committed
48 49
  int16_t feature_data[MAX_SEGMENTS][SEG_LVL_MAX];
  unsigned int feature_mask[MAX_SEGMENTS];
50 51 52
};

int vp9_segfeature_active(const struct segmentation *seg,
53 54
                          int segment_id,
                          SEG_LVL_FEATURES feature_id);
55

56
void vp9_clearall_segfeatures(struct segmentation *seg);
57

58
void vp9_enable_segfeature(struct segmentation *seg,
59 60
                           int segment_id,
                           SEG_LVL_FEATURES feature_id);
61

John Koleszar's avatar
John Koleszar committed
62
int vp9_seg_feature_data_max(SEG_LVL_FEATURES feature_id);
63

64
int vp9_is_segfeature_signed(SEG_LVL_FEATURES feature_id);
65

66
void vp9_set_segdata(struct segmentation *seg,
67 68 69
                     int segment_id,
                     SEG_LVL_FEATURES feature_id,
                     int seg_data);
John Koleszar's avatar
John Koleszar committed
70

71
int vp9_get_segdata(const struct segmentation *seg,
72 73
                    int segment_id,
                    SEG_LVL_FEATURES feature_id);
74

75
extern const vp9_tree_index vp9_segment_tree[TREE_SIZE(MAX_SEGMENTS)];
76

77 78 79 80
#ifdef __cplusplus
}  // extern "C"
#endif

81
#endif  // VP9_COMMON_VP9_SEG_COMMON_H_
82