summaryrefslogtreecommitdiff
path: root/vp8/encoder
diff options
context:
space:
mode:
authorJim Bankoski <jimbankoski@google.com>2012-01-23 09:55:23 -0800
committerJim Bankoski <jimbankoski@google.com>2012-01-24 11:20:13 -0800
commit91325b8fe75e2a0935e067df53f486ec5fe08d6a (patch)
treecfe2d3ed1a581c2e0e34208b6ed66d1e7abb6cd3 /vp8/encoder
parent5aab0c3fb736929762f4f082536a1691fe9941d8 (diff)
downloadlibvpx-91325b8fe75e2a0935e067df53f486ec5fe08d6a.tar
libvpx-91325b8fe75e2a0935e067df53f486ec5fe08d6a.tar.gz
libvpx-91325b8fe75e2a0935e067df53f486ec5fe08d6a.tar.bz2
libvpx-91325b8fe75e2a0935e067df53f486ec5fe08d6a.zip
vpn common -> implicit segmentation
This introduces base functions for introducing implicit segmentation. The code that actually stores the results to the segment map isn't here yet. This just prints out the segmentation map results if you call it. Uses connected component labeling technique on mbmi info so that only if 2 mbs are horizontally or vertically touching do they get the same segment. vp8next - plumbing for rotation code to produce taps for rotation ( tapify. py ), code for predicting using rotation ( predict_rotated.c ) , code for finding the best rotation find_rotation.c. didn't checkin code that uses this in the codec. still work in progress. Fixed copyright notice Change-Id: I450c13cfa41ab2fcb699f3897760370b4935fdf8
Diffstat (limited to 'vp8/encoder')
-rw-r--r--vp8/encoder/find_rotation.c58
1 files changed, 58 insertions, 0 deletions
diff --git a/vp8/encoder/find_rotation.c b/vp8/encoder/find_rotation.c
new file mode 100644
index 000000000..742c0ba81
--- /dev/null
+++ b/vp8/encoder/find_rotation.c
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2012 The WebM project authors. All Rights Reserved.
+ *
+ * Use of this source code is governed by a BSD-style license
+ * that can be found in the LICENSE file in the root of the source
+ * tree. An additional intellectual property rights grant can be found
+ * in the file PATENTS. All contributing project authors may
+ * be found in the AUTHORS file in the root of the source tree.
+ */
+
+#include "block.h"
+#include "variance.h"
+
+#if CONFIG_ROTATION
+
+int vp8_find_best_rotation(MACROBLOCK *x, BLOCK *b, BLOCKD *d, int_mv *bestmv,
+ int_mv *ref_mv, int *bri, int error_per_bit,
+ const vp8_variance_fn_ptr_t *vfp, int *mvcost[2],
+ int *distortion, unsigned int *sse1)
+{
+ unsigned char *z = (*(b->base_src) + b->src);
+
+ int ri;
+
+ int y_stride;
+
+ unsigned int besterr;
+ int br = bestmv->as_mv.row;
+ int bc = bestmv->as_mv.col;
+ unsigned char *y = *(d->base_pre) + d->pre + br * d->pre_stride + bc;
+ y_stride = d->pre_stride;
+
+ // calculate central point error
+ besterr = vfp->vf(y, y_stride, z, b->src_stride, sse1);
+ *distortion = besterr;
+
+ // find the best matching rotation
+ *bri = 5;
+ for (ri = 0; ri < ROTATIONS; ri++)
+ {
+ unsigned int this_err;
+ unsigned char pb[256];
+ predict_rotated_16x16(ri, y, y_stride, pb, 16);
+ this_err = vfp->vf(pb, 16, z, b->src_stride, sse1);
+
+ if (this_err < besterr)
+ {
+ *bri = ri;
+ besterr = this_err;
+ }
+ }
+ *sse1 = besterr;
+ *distortion = besterr;
+
+ return 0;
+}
+
+#endif