segmentation.c (1633B)
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 #include <limits.h> 13 14 #include "aom_mem/aom_mem.h" 15 16 #include "av1/common/pred_common.h" 17 #include "av1/common/tile_common.h" 18 19 #include "av1/encoder/cost.h" 20 #include "av1/encoder/segmentation.h" 21 22 void av1_enable_segmentation(struct segmentation *seg) { 23 seg->enabled = 1; 24 seg->update_map = 1; 25 seg->update_data = 1; 26 seg->temporal_update = 0; 27 } 28 29 void av1_disable_segmentation(struct segmentation *seg) { 30 seg->enabled = 0; 31 seg->update_map = 0; 32 seg->update_data = 0; 33 seg->temporal_update = 0; 34 } 35 36 void av1_disable_segfeature(struct segmentation *seg, int segment_id, 37 SEG_LVL_FEATURES feature_id) { 38 seg->feature_mask[segment_id] &= ~(1u << feature_id); 39 } 40 41 void av1_clear_segdata(struct segmentation *seg, int segment_id, 42 SEG_LVL_FEATURES feature_id) { 43 seg->feature_data[segment_id][feature_id] = 0; 44 } 45 46 void av1_reset_segment_features(AV1_COMMON *cm) { 47 struct segmentation *seg = &cm->seg; 48 49 // Set up default state for MB feature flags 50 seg->enabled = 0; 51 seg->update_map = 0; 52 seg->update_data = 0; 53 av1_clearall_segfeatures(seg); 54 }