From 68569dee1416593955c1570d638b3d9250b33012 Mon Sep 17 00:00:00 2001 From: trav90 Date: Mon, 15 Oct 2018 21:45:30 -0500 Subject: Import aom library This is the reference implementation for the Alliance for Open Media's av1 video code. The commit used was 4d668d7feb1f8abd809d1bca0418570a7f142a36. --- third_party/aom/av1/common/entropymv.h | 149 +++++++++++++++++++++++++++++++++ 1 file changed, 149 insertions(+) create mode 100644 third_party/aom/av1/common/entropymv.h (limited to 'third_party/aom/av1/common/entropymv.h') diff --git a/third_party/aom/av1/common/entropymv.h b/third_party/aom/av1/common/entropymv.h new file mode 100644 index 000000000..2c79d447a --- /dev/null +++ b/third_party/aom/av1/common/entropymv.h @@ -0,0 +1,149 @@ +/* + * Copyright (c) 2016, Alliance for Open Media. All rights reserved + * + * This source code is subject to the terms of the BSD 2 Clause License and + * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License + * was not distributed with this source code in the LICENSE file, you can + * obtain it at www.aomedia.org/license/software. If the Alliance for Open + * Media Patent License 1.0 was not distributed with this source code in the + * PATENTS file, you can obtain it at www.aomedia.org/license/patent. + */ + +#ifndef AV1_COMMON_ENTROPYMV_H_ +#define AV1_COMMON_ENTROPYMV_H_ + +#include "./aom_config.h" + +#include "aom_dsp/prob.h" + +#include "av1/common/mv.h" + +#ifdef __cplusplus +extern "C" { +#endif + +struct AV1Common; + +void av1_init_mv_probs(struct AV1Common *cm); + +void av1_adapt_mv_probs(struct AV1Common *cm, int usehp); + +#define MV_UPDATE_PROB 252 + +/* Symbols for coding which components are zero jointly */ +#define MV_JOINTS 4 +typedef enum { + MV_JOINT_ZERO = 0, /* Zero vector */ + MV_JOINT_HNZVZ = 1, /* Vert zero, hor nonzero */ + MV_JOINT_HZVNZ = 2, /* Hor zero, vert nonzero */ + MV_JOINT_HNZVNZ = 3, /* Both components nonzero */ +} MV_JOINT_TYPE; + +static INLINE int mv_joint_vertical(MV_JOINT_TYPE type) { + return type == MV_JOINT_HZVNZ || type == MV_JOINT_HNZVNZ; +} + +static INLINE int mv_joint_horizontal(MV_JOINT_TYPE type) { + return type == MV_JOINT_HNZVZ || type == MV_JOINT_HNZVNZ; +} + +/* Symbols for coding magnitude class of nonzero components */ +#define MV_CLASSES 11 +typedef enum { + MV_CLASS_0 = 0, /* (0, 2] integer pel */ + MV_CLASS_1 = 1, /* (2, 4] integer pel */ + MV_CLASS_2 = 2, /* (4, 8] integer pel */ + MV_CLASS_3 = 3, /* (8, 16] integer pel */ + MV_CLASS_4 = 4, /* (16, 32] integer pel */ + MV_CLASS_5 = 5, /* (32, 64] integer pel */ + MV_CLASS_6 = 6, /* (64, 128] integer pel */ + MV_CLASS_7 = 7, /* (128, 256] integer pel */ + MV_CLASS_8 = 8, /* (256, 512] integer pel */ + MV_CLASS_9 = 9, /* (512, 1024] integer pel */ + MV_CLASS_10 = 10, /* (1024,2048] integer pel */ +} MV_CLASS_TYPE; + +#define CLASS0_BITS 1 /* bits at integer precision for class 0 */ +#define CLASS0_SIZE (1 << CLASS0_BITS) +#define MV_OFFSET_BITS (MV_CLASSES + CLASS0_BITS - 2) +#define MV_FP_SIZE 4 + +#define MV_MAX_BITS (MV_CLASSES + CLASS0_BITS + 2) +#define MV_MAX ((1 << MV_MAX_BITS) - 1) +#define MV_VALS ((MV_MAX << 1) + 1) + +#define MV_IN_USE_BITS 14 +#define MV_UPP ((1 << MV_IN_USE_BITS) - 1) +#define MV_LOW (-(1 << MV_IN_USE_BITS)) + +extern const aom_tree_index av1_mv_joint_tree[]; +extern const aom_tree_index av1_mv_class_tree[]; +extern const aom_tree_index av1_mv_class0_tree[]; +extern const aom_tree_index av1_mv_fp_tree[]; + +typedef struct { + aom_prob sign; + aom_prob classes[MV_CLASSES - 1]; +#if CONFIG_EC_MULTISYMBOL + aom_cdf_prob class_cdf[CDF_SIZE(MV_CLASSES)]; +#endif + aom_prob class0[CLASS0_SIZE - 1]; + aom_prob bits[MV_OFFSET_BITS]; + aom_prob class0_fp[CLASS0_SIZE][MV_FP_SIZE - 1]; + aom_prob fp[MV_FP_SIZE - 1]; +#if CONFIG_EC_MULTISYMBOL + aom_cdf_prob class0_fp_cdf[CLASS0_SIZE][CDF_SIZE(MV_FP_SIZE)]; + aom_cdf_prob fp_cdf[CDF_SIZE(MV_FP_SIZE)]; +#endif + aom_prob class0_hp; + aom_prob hp; +} nmv_component; + +typedef struct { + aom_prob joints[MV_JOINTS - 1]; +#if CONFIG_EC_MULTISYMBOL + aom_cdf_prob joint_cdf[CDF_SIZE(MV_JOINTS)]; +#endif + nmv_component comps[2]; +} nmv_context; + +static INLINE MV_JOINT_TYPE av1_get_mv_joint(const MV *mv) { + if (mv->row == 0) { + return mv->col == 0 ? MV_JOINT_ZERO : MV_JOINT_HNZVZ; + } else { + return mv->col == 0 ? MV_JOINT_HZVNZ : MV_JOINT_HNZVNZ; + } +} + +MV_CLASS_TYPE av1_get_mv_class(int z, int *offset); + +typedef struct { + unsigned int sign[2]; + unsigned int classes[MV_CLASSES]; + unsigned int class0[CLASS0_SIZE]; + unsigned int bits[MV_OFFSET_BITS][2]; + unsigned int class0_fp[CLASS0_SIZE][MV_FP_SIZE]; + unsigned int fp[MV_FP_SIZE]; + unsigned int class0_hp[2]; + unsigned int hp[2]; +} nmv_component_counts; + +typedef struct { + unsigned int joints[MV_JOINTS]; + nmv_component_counts comps[2]; +} nmv_context_counts; + +void av1_inc_mv(const MV *mv, nmv_context_counts *mvctx, const int usehp); +#if CONFIG_GLOBAL_MOTION +extern const aom_tree_index + av1_global_motion_types_tree[TREE_SIZE(GLOBAL_TRANS_TYPES)]; +#endif // CONFIG_GLOBAL_MOTION +#if CONFIG_EC_MULTISYMBOL +void av1_set_mv_cdfs(nmv_context *ctx); +#endif + +#ifdef __cplusplus +} // extern "C" +#endif + +#endif // AV1_COMMON_ENTROPYMV_H_ -- cgit v1.2.3 From df9477dfa60ebb5d31bc142e58ce46535c17abce Mon Sep 17 00:00:00 2001 From: trav90 Date: Wed, 17 Oct 2018 05:59:08 -0500 Subject: Update aom to slightly newer commit ID --- third_party/aom/av1/common/entropymv.h | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) (limited to 'third_party/aom/av1/common/entropymv.h') diff --git a/third_party/aom/av1/common/entropymv.h b/third_party/aom/av1/common/entropymv.h index 2c79d447a..61bbbe326 100644 --- a/third_party/aom/av1/common/entropymv.h +++ b/third_party/aom/av1/common/entropymv.h @@ -84,26 +84,20 @@ extern const aom_tree_index av1_mv_fp_tree[]; typedef struct { aom_prob sign; aom_prob classes[MV_CLASSES - 1]; -#if CONFIG_EC_MULTISYMBOL aom_cdf_prob class_cdf[CDF_SIZE(MV_CLASSES)]; -#endif aom_prob class0[CLASS0_SIZE - 1]; aom_prob bits[MV_OFFSET_BITS]; aom_prob class0_fp[CLASS0_SIZE][MV_FP_SIZE - 1]; aom_prob fp[MV_FP_SIZE - 1]; -#if CONFIG_EC_MULTISYMBOL aom_cdf_prob class0_fp_cdf[CLASS0_SIZE][CDF_SIZE(MV_FP_SIZE)]; aom_cdf_prob fp_cdf[CDF_SIZE(MV_FP_SIZE)]; -#endif aom_prob class0_hp; aom_prob hp; } nmv_component; typedef struct { aom_prob joints[MV_JOINTS - 1]; -#if CONFIG_EC_MULTISYMBOL aom_cdf_prob joint_cdf[CDF_SIZE(MV_JOINTS)]; -#endif nmv_component comps[2]; } nmv_context; @@ -138,7 +132,7 @@ void av1_inc_mv(const MV *mv, nmv_context_counts *mvctx, const int usehp); extern const aom_tree_index av1_global_motion_types_tree[TREE_SIZE(GLOBAL_TRANS_TYPES)]; #endif // CONFIG_GLOBAL_MOTION -#if CONFIG_EC_MULTISYMBOL +#if !CONFIG_EC_ADAPT void av1_set_mv_cdfs(nmv_context *ctx); #endif -- cgit v1.2.3 From 7369c7d7a5eed32963d8af37658286617919f91c Mon Sep 17 00:00:00 2001 From: trav90 Date: Thu, 18 Oct 2018 06:04:57 -0500 Subject: Update aom to commit id f5bdeac22930ff4c6b219be49c843db35970b918 --- third_party/aom/av1/common/entropymv.h | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) (limited to 'third_party/aom/av1/common/entropymv.h') diff --git a/third_party/aom/av1/common/entropymv.h b/third_party/aom/av1/common/entropymv.h index 61bbbe326..bea5c6724 100644 --- a/third_party/aom/av1/common/entropymv.h +++ b/third_party/aom/av1/common/entropymv.h @@ -93,6 +93,11 @@ typedef struct { aom_cdf_prob fp_cdf[CDF_SIZE(MV_FP_SIZE)]; aom_prob class0_hp; aom_prob hp; +#if CONFIG_NEW_MULTISYMBOL + aom_cdf_prob class0_hp_cdf[CDF_SIZE(2)]; + aom_cdf_prob hp_cdf[CDF_SIZE(2)]; + aom_cdf_prob class0_cdf[CDF_SIZE(CLASS0_SIZE)]; +#endif } nmv_component; typedef struct { @@ -127,14 +132,16 @@ typedef struct { nmv_component_counts comps[2]; } nmv_context_counts; -void av1_inc_mv(const MV *mv, nmv_context_counts *mvctx, const int usehp); -#if CONFIG_GLOBAL_MOTION -extern const aom_tree_index - av1_global_motion_types_tree[TREE_SIZE(GLOBAL_TRANS_TYPES)]; -#endif // CONFIG_GLOBAL_MOTION -#if !CONFIG_EC_ADAPT -void av1_set_mv_cdfs(nmv_context *ctx); +typedef enum { +#if CONFIG_INTRABC + MV_SUBPEL_NONE = -1, #endif + MV_SUBPEL_LOW_PRECISION = 0, + MV_SUBPEL_HIGH_PRECISION, +} MvSubpelPrecision; + +void av1_inc_mv(const MV *mv, nmv_context_counts *mvctx, + MvSubpelPrecision precision); #ifdef __cplusplus } // extern "C" -- cgit v1.2.3 From ec910d81405c736a4490383a250299a7837c2e64 Mon Sep 17 00:00:00 2001 From: trav90 Date: Thu, 18 Oct 2018 21:53:44 -0500 Subject: Update aom to commit id e87fb2378f01103d5d6e477a4ef6892dc714e614 --- third_party/aom/av1/common/entropymv.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'third_party/aom/av1/common/entropymv.h') diff --git a/third_party/aom/av1/common/entropymv.h b/third_party/aom/av1/common/entropymv.h index bea5c6724..9ce089f7d 100644 --- a/third_party/aom/av1/common/entropymv.h +++ b/third_party/aom/av1/common/entropymv.h @@ -66,6 +66,9 @@ typedef enum { #define CLASS0_BITS 1 /* bits at integer precision for class 0 */ #define CLASS0_SIZE (1 << CLASS0_BITS) #define MV_OFFSET_BITS (MV_CLASSES + CLASS0_BITS - 2) +#if CONFIG_NEW_MULTISYMBOL +#define MV_BITS_CONTEXTS 6 +#endif #define MV_FP_SIZE 4 #define MV_MAX_BITS (MV_CLASSES + CLASS0_BITS + 2) @@ -97,6 +100,7 @@ typedef struct { aom_cdf_prob class0_hp_cdf[CDF_SIZE(2)]; aom_cdf_prob hp_cdf[CDF_SIZE(2)]; aom_cdf_prob class0_cdf[CDF_SIZE(CLASS0_SIZE)]; + aom_cdf_prob bits_cdf[MV_BITS_CONTEXTS][CDF_SIZE(2)]; #endif } nmv_component; @@ -133,7 +137,7 @@ typedef struct { } nmv_context_counts; typedef enum { -#if CONFIG_INTRABC +#if CONFIG_INTRABC || CONFIG_AMVR MV_SUBPEL_NONE = -1, #endif MV_SUBPEL_LOW_PRECISION = 0, -- cgit v1.2.3 From bbcc64772580c8a979288791afa02d30bc476d2e Mon Sep 17 00:00:00 2001 From: trav90 Date: Fri, 19 Oct 2018 21:52:15 -0500 Subject: Update aom to v1.0.0 Update aom to commit id d14c5bb4f336ef1842046089849dee4a301fbbf0. --- third_party/aom/av1/common/entropymv.h | 52 ++++------------------------------ 1 file changed, 6 insertions(+), 46 deletions(-) (limited to 'third_party/aom/av1/common/entropymv.h') diff --git a/third_party/aom/av1/common/entropymv.h b/third_party/aom/av1/common/entropymv.h index 9ce089f7d..02ca7b66b 100644 --- a/third_party/aom/av1/common/entropymv.h +++ b/third_party/aom/av1/common/entropymv.h @@ -12,7 +12,7 @@ #ifndef AV1_COMMON_ENTROPYMV_H_ #define AV1_COMMON_ENTROPYMV_H_ -#include "./aom_config.h" +#include "config/aom_config.h" #include "aom_dsp/prob.h" @@ -26,8 +26,6 @@ struct AV1Common; void av1_init_mv_probs(struct AV1Common *cm); -void av1_adapt_mv_probs(struct AV1Common *cm, int usehp); - #define MV_UPDATE_PROB 252 /* Symbols for coding which components are zero jointly */ @@ -66,9 +64,7 @@ typedef enum { #define CLASS0_BITS 1 /* bits at integer precision for class 0 */ #define CLASS0_SIZE (1 << CLASS0_BITS) #define MV_OFFSET_BITS (MV_CLASSES + CLASS0_BITS - 2) -#if CONFIG_NEW_MULTISYMBOL #define MV_BITS_CONTEXTS 6 -#endif #define MV_FP_SIZE 4 #define MV_MAX_BITS (MV_CLASSES + CLASS0_BITS + 2) @@ -76,37 +72,22 @@ typedef enum { #define MV_VALS ((MV_MAX << 1) + 1) #define MV_IN_USE_BITS 14 -#define MV_UPP ((1 << MV_IN_USE_BITS) - 1) +#define MV_UPP (1 << MV_IN_USE_BITS) #define MV_LOW (-(1 << MV_IN_USE_BITS)) -extern const aom_tree_index av1_mv_joint_tree[]; -extern const aom_tree_index av1_mv_class_tree[]; -extern const aom_tree_index av1_mv_class0_tree[]; -extern const aom_tree_index av1_mv_fp_tree[]; - typedef struct { - aom_prob sign; - aom_prob classes[MV_CLASSES - 1]; - aom_cdf_prob class_cdf[CDF_SIZE(MV_CLASSES)]; - aom_prob class0[CLASS0_SIZE - 1]; - aom_prob bits[MV_OFFSET_BITS]; - aom_prob class0_fp[CLASS0_SIZE][MV_FP_SIZE - 1]; - aom_prob fp[MV_FP_SIZE - 1]; + aom_cdf_prob classes_cdf[CDF_SIZE(MV_CLASSES)]; aom_cdf_prob class0_fp_cdf[CLASS0_SIZE][CDF_SIZE(MV_FP_SIZE)]; aom_cdf_prob fp_cdf[CDF_SIZE(MV_FP_SIZE)]; - aom_prob class0_hp; - aom_prob hp; -#if CONFIG_NEW_MULTISYMBOL + aom_cdf_prob sign_cdf[CDF_SIZE(2)]; aom_cdf_prob class0_hp_cdf[CDF_SIZE(2)]; aom_cdf_prob hp_cdf[CDF_SIZE(2)]; aom_cdf_prob class0_cdf[CDF_SIZE(CLASS0_SIZE)]; - aom_cdf_prob bits_cdf[MV_BITS_CONTEXTS][CDF_SIZE(2)]; -#endif + aom_cdf_prob bits_cdf[MV_OFFSET_BITS][CDF_SIZE(2)]; } nmv_component; typedef struct { - aom_prob joints[MV_JOINTS - 1]; - aom_cdf_prob joint_cdf[CDF_SIZE(MV_JOINTS)]; + aom_cdf_prob joints_cdf[CDF_SIZE(MV_JOINTS)]; nmv_component comps[2]; } nmv_context; @@ -120,33 +101,12 @@ static INLINE MV_JOINT_TYPE av1_get_mv_joint(const MV *mv) { MV_CLASS_TYPE av1_get_mv_class(int z, int *offset); -typedef struct { - unsigned int sign[2]; - unsigned int classes[MV_CLASSES]; - unsigned int class0[CLASS0_SIZE]; - unsigned int bits[MV_OFFSET_BITS][2]; - unsigned int class0_fp[CLASS0_SIZE][MV_FP_SIZE]; - unsigned int fp[MV_FP_SIZE]; - unsigned int class0_hp[2]; - unsigned int hp[2]; -} nmv_component_counts; - -typedef struct { - unsigned int joints[MV_JOINTS]; - nmv_component_counts comps[2]; -} nmv_context_counts; - typedef enum { -#if CONFIG_INTRABC || CONFIG_AMVR MV_SUBPEL_NONE = -1, -#endif MV_SUBPEL_LOW_PRECISION = 0, MV_SUBPEL_HIGH_PRECISION, } MvSubpelPrecision; -void av1_inc_mv(const MV *mv, nmv_context_counts *mvctx, - MvSubpelPrecision precision); - #ifdef __cplusplus } // extern "C" #endif -- cgit v1.2.3 From d2499ead93dc4298c0882fe98902acb1b5209f99 Mon Sep 17 00:00:00 2001 From: trav90 Date: Fri, 19 Oct 2018 23:05:00 -0500 Subject: Update libaom to commit ID 1e227d41f0616de9548a673a83a21ef990b62591 --- third_party/aom/av1/common/entropymv.h | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) (limited to 'third_party/aom/av1/common/entropymv.h') diff --git a/third_party/aom/av1/common/entropymv.h b/third_party/aom/av1/common/entropymv.h index 02ca7b66b..fa818a2c1 100644 --- a/third_party/aom/av1/common/entropymv.h +++ b/third_party/aom/av1/common/entropymv.h @@ -9,8 +9,8 @@ * PATENTS file, you can obtain it at www.aomedia.org/license/patent. */ -#ifndef AV1_COMMON_ENTROPYMV_H_ -#define AV1_COMMON_ENTROPYMV_H_ +#ifndef AOM_AV1_COMMON_ENTROPYMV_H_ +#define AOM_AV1_COMMON_ENTROPYMV_H_ #include "config/aom_config.h" @@ -91,16 +91,6 @@ typedef struct { nmv_component comps[2]; } nmv_context; -static INLINE MV_JOINT_TYPE av1_get_mv_joint(const MV *mv) { - if (mv->row == 0) { - return mv->col == 0 ? MV_JOINT_ZERO : MV_JOINT_HNZVZ; - } else { - return mv->col == 0 ? MV_JOINT_HZVNZ : MV_JOINT_HNZVNZ; - } -} - -MV_CLASS_TYPE av1_get_mv_class(int z, int *offset); - typedef enum { MV_SUBPEL_NONE = -1, MV_SUBPEL_LOW_PRECISION = 0, @@ -111,4 +101,4 @@ typedef enum { } // extern "C" #endif -#endif // AV1_COMMON_ENTROPYMV_H_ +#endif // AOM_AV1_COMMON_ENTROPYMV_H_ -- cgit v1.2.3