ref: e869869d2220baf8755b906c1aeaac5f20095c67
parent: d6321c3e68dd675da246d8b191db142d44196d51
author: Dmitry Kovalev <dkovalev@google.com>
date: Fri Feb 28 06:59:50 EST 2014
Removing unnecessary casts from quantization code. Change-Id: I64172710654e95a90ee754d14d7104337d28010f
--- a/vp9/encoder/vp9_mbgraph.c
+++ b/vp9/encoder/vp9_mbgraph.c
@@ -374,10 +374,10 @@
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
--- a/vp9/encoder/vp9_onyx_if.c
+++ b/vp9/encoder/vp9_onyx_if.c
@@ -263,7 +263,7 @@
// 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 @@
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 @@
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 @@
// 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 @@
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 @@
// 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;
}
--- a/vp9/encoder/vp9_segmentation.c
+++ b/vp9/encoder/vp9_segmentation.c
@@ -10,29 +10,25 @@
#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
@@ -44,12 +40,9 @@
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));
--- 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 @@
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 @@
//
// 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);
--- a/vp9/encoder/vp9_vaq.c
+++ b/vp9/encoder/vp9_vaq.c
@@ -83,7 +83,7 @@
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;
--
⑨