summaryrefslogtreecommitdiffstats
path: root/libvpx/vp9/encoder/vp9_segmentation.c
diff options
context:
space:
mode:
authorVignesh Venkatasubramanian <vigneshv@google.com>2014-03-10 09:50:31 -0700
committerVignesh Venkatasubramanian <vigneshv@google.com>2014-03-11 10:04:38 -0700
commitb08e2e23eec181e9951df33cd704ac294c5407b6 (patch)
tree8efc1ca8af18169b44e505ea3ac1d224c1d777ab /libvpx/vp9/encoder/vp9_segmentation.c
parentf0ceed9d146017d218d64ca946d5c2b31356389b (diff)
downloadandroid_external_libvpx-b08e2e23eec181e9951df33cd704ac294c5407b6.tar.gz
android_external_libvpx-b08e2e23eec181e9951df33cd704ac294c5407b6.tar.bz2
android_external_libvpx-b08e2e23eec181e9951df33cd704ac294c5407b6.zip
libvpx: Roll latest libvpx and enable VP9 Encoder
Rolling latest libvpx from upstream and generating configurations with VP9 Encoder enabled. Updating a mistake in UPDATING file. Upstream Hash: 1f08824d6db735e4cacb0419785a789395e42b2b Change-Id: Ie2c45e2253ade4a9ce88ca640cae39a7ece2d8f4
Diffstat (limited to 'libvpx/vp9/encoder/vp9_segmentation.c')
-rw-r--r--libvpx/vp9/encoder/vp9_segmentation.c42
1 files changed, 27 insertions, 15 deletions
diff --git a/libvpx/vp9/encoder/vp9_segmentation.c b/libvpx/vp9/encoder/vp9_segmentation.c
index 24f011f..fd8fa53 100644
--- a/libvpx/vp9/encoder/vp9_segmentation.c
+++ b/libvpx/vp9/encoder/vp9_segmentation.c
@@ -10,29 +10,26 @@
#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_cost.h"
+#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 +41,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));
@@ -58,6 +52,15 @@ void vp9_set_segment_data(VP9_PTR ptr,
// vpx_memcpy(cpi->mb.e_mbd.segment_feature_mask, 0,
// sizeof(cpi->mb.e_mbd.segment_feature_mask));
}
+void vp9_disable_segfeature(struct segmentation *seg, int segment_id,
+ SEG_LVL_FEATURES feature_id) {
+ seg->feature_mask[segment_id] &= ~(1 << feature_id);
+}
+
+void vp9_clear_segdata(struct segmentation *seg, int segment_id,
+ SEG_LVL_FEATURES feature_id) {
+ seg->feature_data[segment_id][feature_id] = 0;
+}
// Based on set of segment counts calculate a probability tree
static void calc_segtree_probs(int *segcounts, vp9_prob *segment_tree_probs) {
@@ -149,7 +152,7 @@ static void count_segs(VP9_COMP *cpi, const TileInfo *const tile,
// Store the prediction status for this mb and update counts
// as appropriate
- vp9_set_pred_flag_seg_id(xd, pred_flag);
+ xd->mi_8x8[0]->mbmi.seg_id_predicted = pred_flag;
temporal_predictor_count[pred_context][pred_flag]++;
if (!pred_flag)
@@ -287,3 +290,12 @@ void vp9_choose_segmap_coding_method(VP9_COMP *cpi) {
vpx_memcpy(seg->tree_probs, no_pred_tree, sizeof(no_pred_tree));
}
}
+
+void vp9_reset_segment_features(struct segmentation *seg) {
+ // Set up default state for MB feature flags
+ seg->enabled = 0;
+ seg->update_map = 0;
+ seg->update_data = 0;
+ vpx_memset(seg->tree_probs, 255, sizeof(seg->tree_probs));
+ vp9_clearall_segfeatures(seg);
+}