cpi->static_mb_pct = 0;
cpi->seg0_cnt = ncnt[0];
- vp9_enable_segmentation((VP9_PTR)cpi);
+ vp9_enable_segmentation(&cm->seg);
} else {
cpi->static_mb_pct = 0;
- vp9_disable_segmentation((VP9_PTR)cpi);
+ vp9_disable_segmentation(&cm->seg);
}
// Free localy allocated storage
// Clear down the complexity map used for rd
vpx_memset(cpi->complexity_map, 0, cm->mi_rows * cm->mi_cols);
- vp9_enable_segmentation((VP9_PTR)cpi);
+ vp9_enable_segmentation(seg);
vp9_clearall_segfeatures(seg);
// Select delta coding method
cpi->static_mb_pct = 0;
// Disable segmentation
- vp9_disable_segmentation((VP9_PTR)cpi);
+ vp9_disable_segmentation(seg);
// Clear down the segment features.
vp9_clearall_segfeatures(seg);
cpi->static_mb_pct = 0;
// Disable segmentation and individual segment features by default
- vp9_disable_segmentation((VP9_PTR)cpi);
+ vp9_disable_segmentation(seg);
vp9_clearall_segfeatures(seg);
// Scan frames from current to arf frame.
// Disable segmentation and clear down features if alt ref
// is not active for this group
- vp9_disable_segmentation((VP9_PTR)cpi);
+ vp9_disable_segmentation(seg);
vpx_memset(cpi->segmentation_map, 0, cm->mi_rows * cm->mi_cols);
return -1;
if (!map) {
- vp9_disable_segmentation((VP9_PTR)cpi);
+ vp9_disable_segmentation(seg);
return 0;
}
// Set the segmentation Map
- vp9_set_segmentation_map((VP9_PTR)cpi, map);
+ vp9_set_segmentation_map(cpi, map);
// Activate segmentation.
- vp9_enable_segmentation((VP9_PTR)cpi);
+ vp9_enable_segmentation(seg);
// Set up the quant, LF and breakout threshold segment data
for (i = 0; i < MAX_SEGMENTS; i++) {
// Initialize the feature data structure
// SEGMENT_DELTADATA 0, SEGMENT_ABSDATA 1
- vp9_set_segment_data((VP9_PTR)cpi, &feature_data[0][0], SEGMENT_DELTADATA);
+ vp9_set_segment_data(seg, &feature_data[0][0], SEGMENT_DELTADATA);
return 0;
}
#include <limits.h>
+
#include "vpx_mem/vpx_mem.h"
-#include "vp9/encoder/vp9_segmentation.h"
+
#include "vp9/common/vp9_pred_common.h"
#include "vp9/common/vp9_tile_common.h"
-void vp9_enable_segmentation(VP9_PTR ptr) {
- VP9_COMP *cpi = (VP9_COMP *)ptr;
- struct segmentation *const seg = &cpi->common.seg;
+#include "vp9/encoder/vp9_segmentation.h"
+void vp9_enable_segmentation(struct segmentation *seg) {
seg->enabled = 1;
seg->update_map = 1;
seg->update_data = 1;
}
-void vp9_disable_segmentation(VP9_PTR ptr) {
- VP9_COMP *cpi = (VP9_COMP *)ptr;
- struct segmentation *const seg = &cpi->common.seg;
+void vp9_disable_segmentation(struct segmentation *seg) {
seg->enabled = 0;
}
-void vp9_set_segmentation_map(VP9_PTR ptr,
- unsigned char *segmentation_map) {
- VP9_COMP *cpi = (VP9_COMP *)ptr;
+void vp9_set_segmentation_map(VP9_COMP *cpi, unsigned char *segmentation_map) {
struct segmentation *const seg = &cpi->common.seg;
// Copy in the new segmentation map
seg->update_data = 1;
}
-void vp9_set_segment_data(VP9_PTR ptr,
+void vp9_set_segment_data(struct segmentation *seg,
signed char *feature_data,
unsigned char abs_delta) {
- VP9_COMP *cpi = (VP9_COMP *)ptr;
- struct segmentation *const seg = &cpi->common.seg;
-
seg->abs_delta = abs_delta;
vpx_memcpy(seg->feature_data, feature_data, sizeof(seg->feature_data));
extern "C" {
#endif
-void vp9_enable_segmentation(VP9_PTR ptr);
-void vp9_disable_segmentation(VP9_PTR ptr);
+void vp9_enable_segmentation(struct segmentation *seg);
+void vp9_disable_segmentation(struct segmentation *seg);
void vp9_disable_segfeature(struct segmentation *seg,
int segment_id,
SEG_LVL_FEATURES feature_id);
// Valid values for a segment are 0 to 3
// Segmentation map is arrange as [Rows][Columns]
-void vp9_set_segmentation_map(VP9_PTR ptr, unsigned char *segmentation_map);
+void vp9_set_segmentation_map(VP9_COMP *cpi, unsigned char *segmentation_map);
// The values given for each segment can be either deltas (from the default
// value chosen for the frame) or absolute values.
//
// abs_delta = SEGMENT_DELTADATA (deltas) abs_delta = SEGMENT_ABSDATA (use
// the absolute values given).
-void vp9_set_segment_data(VP9_PTR ptr, signed char *feature_data,
+void vp9_set_segment_data(struct segmentation *seg, signed char *feature_data,
unsigned char abs_delta);
void vp9_choose_segmap_coding_method(VP9_COMP *cpi);
if (cm->frame_type == KEY_FRAME ||
cpi->refresh_alt_ref_frame ||
(cpi->refresh_golden_frame && !cpi->rc.is_src_frame_alt_ref)) {
- vp9_enable_segmentation((VP9_PTR)cpi);
+ vp9_enable_segmentation(seg);
vp9_clearall_segfeatures(seg);
seg->abs_delta = SEGMENT_DELTADATA;