#if CONFIG_SUPERTX
#include "vp10/encoder/cost.h"
#endif
+#if CONFIG_GLOBAL_MOTION
+#include "vp10/encoder/global_motion.h"
+#endif
#include "vp10/encoder/encodeframe.h"
#include "vp10/encoder/encodemb.h"
#include "vp10/encoder/encodemv.h"
}
}
#endif
+#if CONFIG_GLOBAL_MOTION
+static void update_global_motion_used(PREDICTION_MODE mode,
+ const MB_MODE_INFO *mbmi,
+ VP10_COMP *cpi) {
+ if (mode == ZEROMV) {
+ ++cpi->global_motion_used[mbmi->ref_frame[0]];
+ if (has_second_ref(mbmi))
+ ++cpi->global_motion_used[mbmi->ref_frame[1]];
+ }
+}
+#endif // CONFIG_GLOBAL_MOTION
static void update_state(VP10_COMP *cpi, ThreadData *td,
PICK_MODE_CONTEXT *ctx,
if (!frame_is_intra_only(cm)) {
if (is_inter_block(mbmi)) {
vp10_update_mv_count(td);
+#if CONFIG_GLOBAL_MOTION
+ if (bsize >= BLOCK_8X8) {
+ update_global_motion_used(mbmi->mode, mbmi, cpi);
+ } else {
+ const int num_4x4_w = num_4x4_blocks_wide_lookup[bsize];
+ const int num_4x4_h = num_4x4_blocks_high_lookup[bsize];
+ int idx, idy;
+ for (idy = 0; idy < 2; idy += num_4x4_h) {
+ for (idx = 0; idx < 2; idx += num_4x4_w) {
+ const int j = idy * 2 + idx;
+ update_global_motion_used(mi->bmi[j].as_mode, mbmi, cpi);
+ }
+ }
+ }
+#endif // CONFIG_GLOBAL_MOTION
if (cm->interp_filter == SWITCHABLE
#if CONFIG_EXT_INTERP
&& vp10_is_interp_needed(xd)
#if CONFIG_GLOBAL_MOTION
#define MIN_TRANS_THRESH 8
+#define GLOBAL_MOTION_MODEL ROTZOOM
static void convert_to_params(double *H, TransformationType type,
Global_Motion_Params *model) {
int i;
vpx_clear_system_state();
vp10_zero(cpi->global_motion_used);
if (cpi->common.frame_type == INTER_FRAME && cpi->Source) {
+ YV12_BUFFER_CONFIG *ref_buf;
int frame;
double H[9] = {0, 0, 0, 0, 0, 0, 0, 0, 1};
- for (frame = LAST_FRAME; frame <= ALTREF_FRAME; ++frame)
- convert_model_to_params(H, AFFINE, &cm->global_motion[frame]);
+ for (frame = LAST_FRAME; frame <= ALTREF_FRAME; ++frame) {
+ ref_buf = get_ref_frame_buffer(cpi, frame);
+ if (ref_buf) {
+ if (compute_global_motion_feature_based(
+ cpi, GLOBAL_MOTION_MODEL, cpi->Source, ref_buf,
+ 0.5, H))
+ convert_model_to_params(H, GLOBAL_MOTION_MODEL,
+ &cm->global_motion[frame]);
+ }
+ }
}
#endif // CONFIG_GLOBAL_MOTION
--- /dev/null
+/*
+ * Copyright (c) 2010 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 <stdio.h>
+#include <stdlib.h>
+#include <memory.h>
+#include <math.h>
+#include <assert.h>
+
+#include "vp10/common/warped_motion.h"
+
+#include "vp10/encoder/segmentation.h"
+#include "vp10/encoder/global_motion.h"
+
+int compute_global_motion_feature_based(struct VP10_COMP *cpi,
+ TransformationType type,
+ YV12_BUFFER_CONFIG *frm,
+ YV12_BUFFER_CONFIG *ref,
+ double inlier_prob, double *H) {
+ (void) cpi;
+ (void) type;
+ (void) frm;
+ (void) ref;
+ (void) inlier_prob;
+ (void) H;
+ return 0;
+}
--- /dev/null
+/*
+ * Copyright (c) 2010 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.
+ */
+
+
+#ifndef VP10_ENCODER_GLOBAL_MOTION_H_
+#define VP10_ENCODER_GLOBAL_MOTION_H_
+
+#include "vpx/vpx_integer.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int compute_global_motion_feature_based(struct VP10_COMP *cpi,
+ TransformationType type,
+ YV12_BUFFER_CONFIG *frm,
+ YV12_BUFFER_CONFIG *ref,
+ double inlier_prob, double *H);
+#ifdef __cplusplus
+} // extern "C"
+#endif
+#endif // VP10_ENCODER_GLOBAL_MOTION_H_
+