/src/avm/av2/common/entropymv.h
Line | Count | Source |
1 | | /* |
2 | | * Copyright (c) 2021, Alliance for Open Media. All rights reserved |
3 | | * |
4 | | * This source code is subject to the terms of the BSD 3-Clause Clear License |
5 | | * and the Alliance for Open Media Patent License 1.0. If the BSD 3-Clause Clear |
6 | | * License was not distributed with this source code in the LICENSE file, you |
7 | | * can obtain it at aomedia.org/license/software-license/bsd-3-c-c/. If the |
8 | | * Alliance for Open Media Patent License 1.0 was not distributed with this |
9 | | * source code in the PATENTS file, you can obtain it at |
10 | | * aomedia.org/license/patent-license/. |
11 | | */ |
12 | | |
13 | | #ifndef AVM_AV2_COMMON_ENTROPYMV_H_ |
14 | | #define AVM_AV2_COMMON_ENTROPYMV_H_ |
15 | | |
16 | | #include "config/avm_config.h" |
17 | | |
18 | | #include "avm_dsp/prob.h" |
19 | | |
20 | | #include "av2/common/mv.h" |
21 | | |
22 | | #ifdef __cplusplus |
23 | | extern "C" { |
24 | | #endif |
25 | | |
26 | | struct AV2Common; |
27 | | |
28 | | void av2_init_mv_probs(struct AV2Common *cm); |
29 | | |
30 | | /* Symbols for coding which components are zero jointly */ |
31 | | #define MV_JOINTS 4 |
32 | | enum { |
33 | | MV_JOINT_ZERO = 0, /* Zero vector */ |
34 | | MV_JOINT_HNZVZ = 1, /* Vert zero, hor nonzero */ |
35 | | MV_JOINT_HZVNZ = 2, /* Hor zero, vert nonzero */ |
36 | | MV_JOINT_HNZVNZ = 3, /* Both components nonzero */ |
37 | | } UENUM1BYTE(MV_JOINT_TYPE); |
38 | | |
39 | 0 | static INLINE int mv_joint_vertical(MV_JOINT_TYPE type) { |
40 | 0 | return type == MV_JOINT_HZVNZ || type == MV_JOINT_HNZVNZ; |
41 | 0 | } Unexecuted instantiation: av2_dx_iface.c:mv_joint_vertical Unexecuted instantiation: annexF.c:mv_joint_vertical Unexecuted instantiation: decodeframe.c:mv_joint_vertical Unexecuted instantiation: decodemv.c:mv_joint_vertical Unexecuted instantiation: decoder.c:mv_joint_vertical Unexecuted instantiation: decodetxb.c:mv_joint_vertical Unexecuted instantiation: detokenize.c:mv_joint_vertical Unexecuted instantiation: obu_fgm.c:mv_joint_vertical Unexecuted instantiation: obu.c:mv_joint_vertical Unexecuted instantiation: obu_ci.c:mv_joint_vertical Unexecuted instantiation: obu_atlas.c:mv_joint_vertical Unexecuted instantiation: obu_lcr.c:mv_joint_vertical Unexecuted instantiation: obu_ops.c:mv_joint_vertical Unexecuted instantiation: obu_buf.c:mv_joint_vertical Unexecuted instantiation: avm_dsp_rtcd.c:mv_joint_vertical Unexecuted instantiation: av2_rtcd.c:mv_joint_vertical Unexecuted instantiation: blend_a64_hmask.c:mv_joint_vertical Unexecuted instantiation: blend_a64_mask.c:mv_joint_vertical Unexecuted instantiation: blend_a64_vmask.c:mv_joint_vertical Unexecuted instantiation: loopfilter.c:mv_joint_vertical Unexecuted instantiation: binary_codes_reader.c:mv_joint_vertical Unexecuted instantiation: bitreader.c:mv_joint_vertical Unexecuted instantiation: avm_convolve_copy_sse2.c:mv_joint_vertical Unexecuted instantiation: avm_asm_stubs.c:mv_joint_vertical Unexecuted instantiation: highbd_convolve_sse2.c:mv_joint_vertical Unexecuted instantiation: highbd_convolve_ssse3.c:mv_joint_vertical Unexecuted instantiation: blend_a64_hmask_sse4.c:mv_joint_vertical Unexecuted instantiation: blend_a64_mask_sse4.c:mv_joint_vertical Unexecuted instantiation: blend_a64_vmask_sse4.c:mv_joint_vertical Unexecuted instantiation: loopfilter_sse4.c:mv_joint_vertical Unexecuted instantiation: avm_convolve_copy_avx2.c:mv_joint_vertical Unexecuted instantiation: highbd_convolve_avx2.c:mv_joint_vertical Unexecuted instantiation: intrapred_avx2.c:mv_joint_vertical Unexecuted instantiation: blend_a64_mask_avx2.c:mv_joint_vertical Unexecuted instantiation: entdec_avx2.c:mv_joint_vertical Unexecuted instantiation: annexA.c:mv_joint_vertical Unexecuted instantiation: alloccommon.c:mv_joint_vertical Unexecuted instantiation: av2_loopfilter.c:mv_joint_vertical Unexecuted instantiation: av2_txfm.c:mv_joint_vertical Unexecuted instantiation: blockd.c:mv_joint_vertical Unexecuted instantiation: cdef.c:mv_joint_vertical Unexecuted instantiation: gdf.c:mv_joint_vertical Unexecuted instantiation: gdf_block.c:mv_joint_vertical Unexecuted instantiation: cdef_block.c:mv_joint_vertical Unexecuted instantiation: cfl.c:mv_joint_vertical Unexecuted instantiation: convolve.c:mv_joint_vertical Unexecuted instantiation: entropy.c:mv_joint_vertical Unexecuted instantiation: entropymode.c:mv_joint_vertical Unexecuted instantiation: entropymv.c:mv_joint_vertical Unexecuted instantiation: idct.c:mv_joint_vertical Unexecuted instantiation: level.c:mv_joint_vertical Unexecuted instantiation: mvref_common.c:mv_joint_vertical Unexecuted instantiation: pred_common.c:mv_joint_vertical Unexecuted instantiation: quant_common.c:mv_joint_vertical Unexecuted instantiation: reconinter.c:mv_joint_vertical Unexecuted instantiation: reconintra.c:mv_joint_vertical Unexecuted instantiation: restoration.c:mv_joint_vertical Unexecuted instantiation: scale.c:mv_joint_vertical Unexecuted instantiation: scan.c:mv_joint_vertical Unexecuted instantiation: seg_common.c:mv_joint_vertical Unexecuted instantiation: thread_common.c:mv_joint_vertical Unexecuted instantiation: tile_common.c:mv_joint_vertical Unexecuted instantiation: timing.c:mv_joint_vertical Unexecuted instantiation: tip.c:mv_joint_vertical Unexecuted instantiation: txb_common.c:mv_joint_vertical Unexecuted instantiation: warped_motion.c:mv_joint_vertical Unexecuted instantiation: hr_coding.c:mv_joint_vertical Unexecuted instantiation: intra_matrix.c:mv_joint_vertical Unexecuted instantiation: intra_dip.cc:mv_joint_vertical(unsigned char) Unexecuted instantiation: ccso.c:mv_joint_vertical Unexecuted instantiation: bru.c:mv_joint_vertical Unexecuted instantiation: obu_qm.c:mv_joint_vertical Unexecuted instantiation: cdef_block_sse2.c:mv_joint_vertical Unexecuted instantiation: cfl_sse2.c:mv_joint_vertical Unexecuted instantiation: cdef_block_ssse3.c:mv_joint_vertical Unexecuted instantiation: cfl_ssse3.c:mv_joint_vertical Unexecuted instantiation: highbd_convolve_2d_ssse3.c:mv_joint_vertical Unexecuted instantiation: highbd_wiener_convolve_ssse3.c:mv_joint_vertical Unexecuted instantiation: reconinter_ssse3.c:mv_joint_vertical Unexecuted instantiation: cdef_block_sse4.c:mv_joint_vertical Unexecuted instantiation: av2_convolve_horiz_rs_sse4.c:mv_joint_vertical Unexecuted instantiation: av2_convolve_scale_sse4.c:mv_joint_vertical Unexecuted instantiation: highbd_convolve_2d_sse4.c:mv_joint_vertical Unexecuted instantiation: highbd_inv_txfm_sse4.c:mv_joint_vertical Unexecuted instantiation: highbd_jnt_convolve_sse4.c:mv_joint_vertical Unexecuted instantiation: highbd_warp_plane_sse4.c:mv_joint_vertical Unexecuted instantiation: intra_edge_sse4.c:mv_joint_vertical Unexecuted instantiation: optflow_refine_sse4.c:mv_joint_vertical Unexecuted instantiation: reconinter_sse4.c:mv_joint_vertical Unexecuted instantiation: cdef_block_avx2.c:mv_joint_vertical Unexecuted instantiation: affine_optflow_refine_avx2.c:mv_joint_vertical Unexecuted instantiation: bawp_avx2.c:mv_joint_vertical Unexecuted instantiation: cfl_avx2.c:mv_joint_vertical Unexecuted instantiation: highbd_ccso_avx2.c:mv_joint_vertical Unexecuted instantiation: highbd_convolve_2d_avx2.c:mv_joint_vertical Unexecuted instantiation: highbd_inv_txfm_avx2.c:mv_joint_vertical Unexecuted instantiation: highbd_jnt_convolve_avx2.c:mv_joint_vertical Unexecuted instantiation: highbd_wiener_convolve_avx2.c:mv_joint_vertical Unexecuted instantiation: highbd_warp_affine_avx2.c:mv_joint_vertical Unexecuted instantiation: reconinter_avx2.c:mv_joint_vertical Unexecuted instantiation: gdf_block_avx2.c:mv_joint_vertical Unexecuted instantiation: avm_convolve.c:mv_joint_vertical Unexecuted instantiation: intrapred.c:mv_joint_vertical Unexecuted instantiation: sad.c:mv_joint_vertical Unexecuted instantiation: highbd_intrapred_sse2.c:mv_joint_vertical Unexecuted instantiation: av2_inv_txfm2d.c:mv_joint_vertical |
42 | | |
43 | 0 | static INLINE int mv_joint_horizontal(MV_JOINT_TYPE type) { |
44 | 0 | return type == MV_JOINT_HNZVZ || type == MV_JOINT_HNZVNZ; |
45 | 0 | } Unexecuted instantiation: av2_dx_iface.c:mv_joint_horizontal Unexecuted instantiation: annexF.c:mv_joint_horizontal Unexecuted instantiation: decodeframe.c:mv_joint_horizontal Unexecuted instantiation: decodemv.c:mv_joint_horizontal Unexecuted instantiation: decoder.c:mv_joint_horizontal Unexecuted instantiation: decodetxb.c:mv_joint_horizontal Unexecuted instantiation: detokenize.c:mv_joint_horizontal Unexecuted instantiation: obu_fgm.c:mv_joint_horizontal Unexecuted instantiation: obu.c:mv_joint_horizontal Unexecuted instantiation: obu_ci.c:mv_joint_horizontal Unexecuted instantiation: obu_atlas.c:mv_joint_horizontal Unexecuted instantiation: obu_lcr.c:mv_joint_horizontal Unexecuted instantiation: obu_ops.c:mv_joint_horizontal Unexecuted instantiation: obu_buf.c:mv_joint_horizontal Unexecuted instantiation: avm_dsp_rtcd.c:mv_joint_horizontal Unexecuted instantiation: av2_rtcd.c:mv_joint_horizontal Unexecuted instantiation: blend_a64_hmask.c:mv_joint_horizontal Unexecuted instantiation: blend_a64_mask.c:mv_joint_horizontal Unexecuted instantiation: blend_a64_vmask.c:mv_joint_horizontal Unexecuted instantiation: loopfilter.c:mv_joint_horizontal Unexecuted instantiation: binary_codes_reader.c:mv_joint_horizontal Unexecuted instantiation: bitreader.c:mv_joint_horizontal Unexecuted instantiation: avm_convolve_copy_sse2.c:mv_joint_horizontal Unexecuted instantiation: avm_asm_stubs.c:mv_joint_horizontal Unexecuted instantiation: highbd_convolve_sse2.c:mv_joint_horizontal Unexecuted instantiation: highbd_convolve_ssse3.c:mv_joint_horizontal Unexecuted instantiation: blend_a64_hmask_sse4.c:mv_joint_horizontal Unexecuted instantiation: blend_a64_mask_sse4.c:mv_joint_horizontal Unexecuted instantiation: blend_a64_vmask_sse4.c:mv_joint_horizontal Unexecuted instantiation: loopfilter_sse4.c:mv_joint_horizontal Unexecuted instantiation: avm_convolve_copy_avx2.c:mv_joint_horizontal Unexecuted instantiation: highbd_convolve_avx2.c:mv_joint_horizontal Unexecuted instantiation: intrapred_avx2.c:mv_joint_horizontal Unexecuted instantiation: blend_a64_mask_avx2.c:mv_joint_horizontal Unexecuted instantiation: entdec_avx2.c:mv_joint_horizontal Unexecuted instantiation: annexA.c:mv_joint_horizontal Unexecuted instantiation: alloccommon.c:mv_joint_horizontal Unexecuted instantiation: av2_loopfilter.c:mv_joint_horizontal Unexecuted instantiation: av2_txfm.c:mv_joint_horizontal Unexecuted instantiation: blockd.c:mv_joint_horizontal Unexecuted instantiation: cdef.c:mv_joint_horizontal Unexecuted instantiation: gdf.c:mv_joint_horizontal Unexecuted instantiation: gdf_block.c:mv_joint_horizontal Unexecuted instantiation: cdef_block.c:mv_joint_horizontal Unexecuted instantiation: cfl.c:mv_joint_horizontal Unexecuted instantiation: convolve.c:mv_joint_horizontal Unexecuted instantiation: entropy.c:mv_joint_horizontal Unexecuted instantiation: entropymode.c:mv_joint_horizontal Unexecuted instantiation: entropymv.c:mv_joint_horizontal Unexecuted instantiation: idct.c:mv_joint_horizontal Unexecuted instantiation: level.c:mv_joint_horizontal Unexecuted instantiation: mvref_common.c:mv_joint_horizontal Unexecuted instantiation: pred_common.c:mv_joint_horizontal Unexecuted instantiation: quant_common.c:mv_joint_horizontal Unexecuted instantiation: reconinter.c:mv_joint_horizontal Unexecuted instantiation: reconintra.c:mv_joint_horizontal Unexecuted instantiation: restoration.c:mv_joint_horizontal Unexecuted instantiation: scale.c:mv_joint_horizontal Unexecuted instantiation: scan.c:mv_joint_horizontal Unexecuted instantiation: seg_common.c:mv_joint_horizontal Unexecuted instantiation: thread_common.c:mv_joint_horizontal Unexecuted instantiation: tile_common.c:mv_joint_horizontal Unexecuted instantiation: timing.c:mv_joint_horizontal Unexecuted instantiation: tip.c:mv_joint_horizontal Unexecuted instantiation: txb_common.c:mv_joint_horizontal Unexecuted instantiation: warped_motion.c:mv_joint_horizontal Unexecuted instantiation: hr_coding.c:mv_joint_horizontal Unexecuted instantiation: intra_matrix.c:mv_joint_horizontal Unexecuted instantiation: intra_dip.cc:mv_joint_horizontal(unsigned char) Unexecuted instantiation: ccso.c:mv_joint_horizontal Unexecuted instantiation: bru.c:mv_joint_horizontal Unexecuted instantiation: obu_qm.c:mv_joint_horizontal Unexecuted instantiation: cdef_block_sse2.c:mv_joint_horizontal Unexecuted instantiation: cfl_sse2.c:mv_joint_horizontal Unexecuted instantiation: cdef_block_ssse3.c:mv_joint_horizontal Unexecuted instantiation: cfl_ssse3.c:mv_joint_horizontal Unexecuted instantiation: highbd_convolve_2d_ssse3.c:mv_joint_horizontal Unexecuted instantiation: highbd_wiener_convolve_ssse3.c:mv_joint_horizontal Unexecuted instantiation: reconinter_ssse3.c:mv_joint_horizontal Unexecuted instantiation: cdef_block_sse4.c:mv_joint_horizontal Unexecuted instantiation: av2_convolve_horiz_rs_sse4.c:mv_joint_horizontal Unexecuted instantiation: av2_convolve_scale_sse4.c:mv_joint_horizontal Unexecuted instantiation: highbd_convolve_2d_sse4.c:mv_joint_horizontal Unexecuted instantiation: highbd_inv_txfm_sse4.c:mv_joint_horizontal Unexecuted instantiation: highbd_jnt_convolve_sse4.c:mv_joint_horizontal Unexecuted instantiation: highbd_warp_plane_sse4.c:mv_joint_horizontal Unexecuted instantiation: intra_edge_sse4.c:mv_joint_horizontal Unexecuted instantiation: optflow_refine_sse4.c:mv_joint_horizontal Unexecuted instantiation: reconinter_sse4.c:mv_joint_horizontal Unexecuted instantiation: cdef_block_avx2.c:mv_joint_horizontal Unexecuted instantiation: affine_optflow_refine_avx2.c:mv_joint_horizontal Unexecuted instantiation: bawp_avx2.c:mv_joint_horizontal Unexecuted instantiation: cfl_avx2.c:mv_joint_horizontal Unexecuted instantiation: highbd_ccso_avx2.c:mv_joint_horizontal Unexecuted instantiation: highbd_convolve_2d_avx2.c:mv_joint_horizontal Unexecuted instantiation: highbd_inv_txfm_avx2.c:mv_joint_horizontal Unexecuted instantiation: highbd_jnt_convolve_avx2.c:mv_joint_horizontal Unexecuted instantiation: highbd_wiener_convolve_avx2.c:mv_joint_horizontal Unexecuted instantiation: highbd_warp_affine_avx2.c:mv_joint_horizontal Unexecuted instantiation: reconinter_avx2.c:mv_joint_horizontal Unexecuted instantiation: gdf_block_avx2.c:mv_joint_horizontal Unexecuted instantiation: avm_convolve.c:mv_joint_horizontal Unexecuted instantiation: intrapred.c:mv_joint_horizontal Unexecuted instantiation: sad.c:mv_joint_horizontal Unexecuted instantiation: highbd_intrapred_sse2.c:mv_joint_horizontal Unexecuted instantiation: av2_inv_txfm2d.c:mv_joint_horizontal |
46 | | |
47 | | /* Symbols for coding magnitude class of nonzero components */ |
48 | | enum { |
49 | | /* Class specifies the integer pel range */ |
50 | | MV_CLASS_0 = 0, /* When AMVD is applied:(0, 1], {2}. Otherwise:(0, 2] */ |
51 | | MV_CLASS_1 = 1, /* When AMVD is applied:{4}. Otherwise:(2, 4] */ |
52 | | MV_CLASS_2 = 2, /* When AMVD is applied:{8}. Otherwise:(4, 8] */ |
53 | | MV_CLASS_3 = 3, /* When AMVD is applied:{16}. Otherwise:(8, 16] */ |
54 | | MV_CLASS_4 = 4, /* When AMVD is applied:{32}. Otherwise:(16, 32] */ |
55 | | MV_CLASS_5 = 5, /* When AMVD is applied:{64}. Otherwise:(32, 64] */ |
56 | | MV_CLASS_6 = 6, /* When AMVD is applied:{128}. Otherwise:(64, 128] */ |
57 | | MV_CLASS_7 = 7, /* When AMVD is applied:{256}. Otherwise:(128, 256] */ |
58 | | MV_CLASS_8 = 8, /* When AMVD is applied:{512}. Otherwise:(256, 512] */ |
59 | | MV_CLASS_9 = 9, /* When AMVD is applied:{1024}. Otherwise:(512, 1024] */ |
60 | | MV_CLASS_10 = 10, /* When AMVD is applied:{2048}. Otherwise:(1024, 2048] */ |
61 | | MV_CLASS_11 = 11, /* When AMVD is applied:{2048}. Otherwise:(2048, 4096] */ |
62 | | MV_CLASS_12 = 12, /* When AMVD is applied:{4096}. Otherwise:(4096, 8192] */ |
63 | | MV_CLASSES, /* Maximum MV class */ |
64 | | } UENUM1BYTE(MV_CLASS_TYPE); |
65 | | |
66 | | #define CLASS0_BITS 1 /* bits at integer precision for class 0 */ |
67 | | #define CLASS0_SIZE (1 << CLASS0_BITS) |
68 | | #define MV_MAX_BITS (MV_CLASSES + CLASS0_BITS + 2) |
69 | | #define MV_MAX ((1 << MV_MAX_BITS) - 1) |
70 | | #define SHELL_INT_OFFSET_BIT (MAX_NUM_SHELL_CLASS - 1) |
71 | 1.93k | #define MAX_COL_TRUNCATED_UNARY_VAL 2 |
72 | 1.63k | #define NUM_CTX_COL_MV_GTX 2 |
73 | 2.34k | #define NUM_CTX_COL_MV_INDEX 4 |
74 | 160 | #define NUM_CTX_CLASS_OFFSETS 1 |
75 | | |
76 | | typedef struct { |
77 | | avm_cdf_prob amvd_indices_cdf[CDF_SIZE(MAX_AMVD_INDEX)]; |
78 | | } nmv_component; |
79 | | |
80 | | typedef struct { |
81 | | /*The joint_shell_set is first decoded. Depending on the shell set index, the |
82 | | * joint_shell_class is decoded.*/ |
83 | | avm_cdf_prob joint_shell_set_cdf[CDF_SIZE(2)]; |
84 | | avm_cdf_prob joint_shell_class_cdf_0[NUM_MV_PRECISIONS] |
85 | | [CDF_SIZE(FIRST_SHELL_CLASS)]; |
86 | | avm_cdf_prob joint_shell_class_cdf_1[NUM_MV_PRECISIONS] |
87 | | [CDF_SIZE(SECOND_SHELL_CLASS)]; |
88 | | |
89 | | // Only MV_PRECISION_ONE_EIGHTH_PEL has shell class 15 and class 16. |
90 | | // For MV_PRECISION_ONE_EIGHTH_PEL, class 15 and 16 are coded as a |
91 | | // single class, then another flag to distinguish them |
92 | | avm_cdf_prob joint_shell_last_two_classes_cdf[CDF_SIZE(2)]; |
93 | | |
94 | | avm_cdf_prob shell_offset_low_class_cdf[2][CDF_SIZE(2)]; |
95 | | |
96 | | avm_cdf_prob |
97 | | shell_offset_class2_cdf[CDF_SIZE(2)]; // First bin for truncated unary |
98 | | |
99 | | avm_cdf_prob shell_offset_other_class_cdf[NUM_CTX_CLASS_OFFSETS] |
100 | | [SHELL_INT_OFFSET_BIT][CDF_SIZE(2)]; |
101 | | avm_cdf_prob col_mv_greater_flags_cdf[NUM_CTX_COL_MV_GTX][CDF_SIZE(2)]; |
102 | | avm_cdf_prob col_mv_index_cdf[NUM_CTX_COL_MV_INDEX][CDF_SIZE(2)]; |
103 | | avm_cdf_prob amvd_joints_cdf[CDF_SIZE(MV_JOINTS)]; |
104 | | nmv_component comps[2]; |
105 | | } nmv_context; |
106 | | |
107 | | #ifdef __cplusplus |
108 | | } // extern "C" |
109 | | #endif |
110 | | |
111 | | #endif // AVM_AV2_COMMON_ENTROPYMV_H_ |