diff --git a/vp9/encoder/vp9_mbgraph.c b/vp9/encoder/vp9_mbgraph.c index 44c1f9078..a16b6f35c 100644 --- a/vp9/encoder/vp9_mbgraph.c +++ b/vp9/encoder/vp9_mbgraph.c @@ -374,10 +374,10 @@ static void separate_arf_mbs(VP9_COMP *cpi) { 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 diff --git a/vp9/encoder/vp9_onyx_if.c b/vp9/encoder/vp9_onyx_if.c index 3921ea8eb..b4107cf98 100644 --- a/vp9/encoder/vp9_onyx_if.c +++ b/vp9/encoder/vp9_onyx_if.c @@ -263,7 +263,7 @@ static void setup_in_frame_q_adj(VP9_COMP *cpi) { // 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 @@ -297,7 +297,7 @@ static void configure_static_seg_features(VP9_COMP *cpi) { 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); @@ -310,7 +310,7 @@ static void configure_static_seg_features(VP9_COMP *cpi) { 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. @@ -363,7 +363,7 @@ static void configure_static_seg_features(VP9_COMP *cpi) { // 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); @@ -3885,15 +3885,15 @@ int vp9_set_roimap(VP9_PTR comp, unsigned char *map, unsigned int rows, 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++) { @@ -3917,7 +3917,7 @@ int vp9_set_roimap(VP9_PTR comp, unsigned char *map, unsigned int rows, // 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; } diff --git a/vp9/encoder/vp9_segmentation.c b/vp9/encoder/vp9_segmentation.c index 509717e0a..49fd7bb48 100644 --- a/vp9/encoder/vp9_segmentation.c +++ b/vp9/encoder/vp9_segmentation.c @@ -10,29 +10,25 @@ #include + #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 @@ -44,12 +40,9 @@ void vp9_set_segmentation_map(VP9_PTR ptr, 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)); diff --git a/vp9/encoder/vp9_segmentation.h b/vp9/encoder/vp9_segmentation.h index 8238892e2..66c51a21b 100644 --- a/vp9/encoder/vp9_segmentation.h +++ b/vp9/encoder/vp9_segmentation.h @@ -19,8 +19,8 @@ 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, @@ -30,7 +30,7 @@ void vp9_clear_segdata(struct segmentation *seg, 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. @@ -42,7 +42,7 @@ void vp9_set_segmentation_map(VP9_PTR ptr, unsigned char *segmentation_map); // // 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); diff --git a/vp9/encoder/vp9_vaq.c b/vp9/encoder/vp9_vaq.c index 600029b19..c71c171bb 100644 --- a/vp9/encoder/vp9_vaq.c +++ b/vp9/encoder/vp9_vaq.c @@ -83,7 +83,7 @@ void vp9_vaq_frame_setup(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;