diff options
Diffstat (limited to 'av1/common/mv.h')
-rw-r--r-- | av1/common/mv.h | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/av1/common/mv.h b/av1/common/mv.h index c7eaf76d0..a61287b02 100644 --- a/av1/common/mv.h +++ b/av1/common/mv.h @@ -17,6 +17,7 @@ #include "av1/common/common.h" #include "av1/common/common_data.h" #include "aom_dsp/aom_filter.h" +#include "aom_dsp/flow_estimation/flow_estimation.h" #ifdef __cplusplus extern "C" { @@ -107,16 +108,6 @@ static AOM_INLINE void convert_fullmv_to_mv(int_mv *mv) { #define WARPEDDIFF_PREC_BITS (WARPEDMODEL_PREC_BITS - WARPEDPIXEL_PREC_BITS) -/* clang-format off */ -enum { - IDENTITY = 0, // identity transformation, 0-parameter - TRANSLATION = 1, // translational motion 2-parameter - ROTZOOM = 2, // simplified affine with rotation + zoom only, 4-parameter - AFFINE = 3, // affine, 6-parameter - TRANS_TYPES, -} UENUM1BYTE(TransformationType); -/* clang-format on */ - // Number of types used for global motion (must be >= 3 and <= TRANS_TYPES) // The following can be useful: // GLOBAL_TRANS_TYPES 3 - up to rotation-zoom @@ -130,9 +121,6 @@ typedef struct { int local_warp_allowed; } WarpTypesAllowed; -// number of parameters used by each transformation in TransformationTypes -static const int trans_model_params[TRANS_TYPES] = { 0, 2, 4, 6 }; - // The order of values in the wmmat matrix below is best described // by the homography: // [x' (m2 m3 m0 [x @@ -282,6 +270,17 @@ static INLINE int_mv gm_get_motion_vector(const WarpedMotionParams *gm, // After the right shifts, there are 3 fractional bits of precision. If // allow_hp is false, the bottom bit is always zero (so we don't need a // call to convert_to_trans_prec here) + // + // Note: There is an AV1 specification bug here: + // + // gm->wmmat[0] is supposed to be the horizontal translation, and so should + // go into res.as_mv.col, and gm->wmmat[1] is supposed to be the vertical + // translation and so should go into res.as_mv.row + // + // However, in the spec, these assignments are accidentally reversed, and so + // we must keep this incorrect logic to match the spec. + // + // See also: https://crbug.com/aomedia/3328 res.as_mv.row = gm->wmmat[0] >> GM_TRANS_ONLY_PREC_DIFF; res.as_mv.col = gm->wmmat[1] >> GM_TRANS_ONLY_PREC_DIFF; assert(IMPLIES(1 & (res.as_mv.row | res.as_mv.col), allow_hp)); |