| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2012 The WebM project authors. All Rights Reserved. | 2 * Copyright (c) 2012 The WebM project authors. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| 11 | 11 |
| 12 #include <limits.h> | 12 #include <limits.h> |
| 13 |
| 13 #include "vpx_mem/vpx_mem.h" | 14 #include "vpx_mem/vpx_mem.h" |
| 14 #include "vp9/encoder/vp9_segmentation.h" | 15 |
| 15 #include "vp9/common/vp9_pred_common.h" | 16 #include "vp9/common/vp9_pred_common.h" |
| 16 #include "vp9/common/vp9_tile_common.h" | 17 #include "vp9/common/vp9_tile_common.h" |
| 17 | 18 |
| 18 void vp9_enable_segmentation(VP9_PTR ptr) { | 19 #include "vp9/encoder/vp9_segmentation.h" |
| 19 VP9_COMP *cpi = (VP9_COMP *)ptr; | |
| 20 struct segmentation *const seg = &cpi->common.seg; | |
| 21 | 20 |
| 21 void vp9_enable_segmentation(struct segmentation *seg) { |
| 22 seg->enabled = 1; | 22 seg->enabled = 1; |
| 23 seg->update_map = 1; | 23 seg->update_map = 1; |
| 24 seg->update_data = 1; | 24 seg->update_data = 1; |
| 25 } | 25 } |
| 26 | 26 |
| 27 void vp9_disable_segmentation(VP9_PTR ptr) { | 27 void vp9_disable_segmentation(struct segmentation *seg) { |
| 28 VP9_COMP *cpi = (VP9_COMP *)ptr; | |
| 29 struct segmentation *const seg = &cpi->common.seg; | |
| 30 seg->enabled = 0; | 28 seg->enabled = 0; |
| 31 } | 29 } |
| 32 | 30 |
| 33 void vp9_set_segmentation_map(VP9_PTR ptr, | 31 void vp9_set_segmentation_map(VP9_COMP *cpi, unsigned char *segmentation_map) { |
| 34 unsigned char *segmentation_map) { | |
| 35 VP9_COMP *cpi = (VP9_COMP *)ptr; | |
| 36 struct segmentation *const seg = &cpi->common.seg; | 32 struct segmentation *const seg = &cpi->common.seg; |
| 37 | 33 |
| 38 // Copy in the new segmentation map | 34 // Copy in the new segmentation map |
| 39 vpx_memcpy(cpi->segmentation_map, segmentation_map, | 35 vpx_memcpy(cpi->segmentation_map, segmentation_map, |
| 40 (cpi->common.mi_rows * cpi->common.mi_cols)); | 36 (cpi->common.mi_rows * cpi->common.mi_cols)); |
| 41 | 37 |
| 42 // Signal that the map should be updated. | 38 // Signal that the map should be updated. |
| 43 seg->update_map = 1; | 39 seg->update_map = 1; |
| 44 seg->update_data = 1; | 40 seg->update_data = 1; |
| 45 } | 41 } |
| 46 | 42 |
| 47 void vp9_set_segment_data(VP9_PTR ptr, | 43 void vp9_set_segment_data(struct segmentation *seg, |
| 48 signed char *feature_data, | 44 signed char *feature_data, |
| 49 unsigned char abs_delta) { | 45 unsigned char abs_delta) { |
| 50 VP9_COMP *cpi = (VP9_COMP *)ptr; | |
| 51 struct segmentation *const seg = &cpi->common.seg; | |
| 52 | |
| 53 seg->abs_delta = abs_delta; | 46 seg->abs_delta = abs_delta; |
| 54 | 47 |
| 55 vpx_memcpy(seg->feature_data, feature_data, sizeof(seg->feature_data)); | 48 vpx_memcpy(seg->feature_data, feature_data, sizeof(seg->feature_data)); |
| 56 | 49 |
| 57 // TBD ?? Set the feature mask | 50 // TBD ?? Set the feature mask |
| 58 // vpx_memcpy(cpi->mb.e_mbd.segment_feature_mask, 0, | 51 // vpx_memcpy(cpi->mb.e_mbd.segment_feature_mask, 0, |
| 59 // sizeof(cpi->mb.e_mbd.segment_feature_mask)); | 52 // sizeof(cpi->mb.e_mbd.segment_feature_mask)); |
| 60 } | 53 } |
| 61 void vp9_disable_segfeature(struct segmentation *seg, int segment_id, | 54 void vp9_disable_segfeature(struct segmentation *seg, int segment_id, |
| 62 SEG_LVL_FEATURES feature_id) { | 55 SEG_LVL_FEATURES feature_id) { |
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 298 } | 291 } |
| 299 | 292 |
| 300 void vp9_reset_segment_features(struct segmentation *seg) { | 293 void vp9_reset_segment_features(struct segmentation *seg) { |
| 301 // Set up default state for MB feature flags | 294 // Set up default state for MB feature flags |
| 302 seg->enabled = 0; | 295 seg->enabled = 0; |
| 303 seg->update_map = 0; | 296 seg->update_map = 0; |
| 304 seg->update_data = 0; | 297 seg->update_data = 0; |
| 305 vpx_memset(seg->tree_probs, 255, sizeof(seg->tree_probs)); | 298 vpx_memset(seg->tree_probs, 255, sizeof(seg->tree_probs)); |
| 306 vp9_clearall_segfeatures(seg); | 299 vp9_clearall_segfeatures(seg); |
| 307 } | 300 } |
| OLD | NEW |