LCOV - code coverage report
Current view: top level - third_party/aom/av1/common - entropymv.h (source / functions) Hit Total Coverage
Test: output.info Lines: 0 8 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 3 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /*
       2             :  * Copyright (c) 2016, Alliance for Open Media. All rights reserved
       3             :  *
       4             :  * This source code is subject to the terms of the BSD 2 Clause License and
       5             :  * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
       6             :  * was not distributed with this source code in the LICENSE file, you can
       7             :  * obtain it at www.aomedia.org/license/software. If the Alliance for Open
       8             :  * Media Patent License 1.0 was not distributed with this source code in the
       9             :  * PATENTS file, you can obtain it at www.aomedia.org/license/patent.
      10             :  */
      11             : 
      12             : #ifndef AV1_COMMON_ENTROPYMV_H_
      13             : #define AV1_COMMON_ENTROPYMV_H_
      14             : 
      15             : #include "./aom_config.h"
      16             : 
      17             : #include "aom_dsp/prob.h"
      18             : 
      19             : #include "av1/common/mv.h"
      20             : 
      21             : #ifdef __cplusplus
      22             : extern "C" {
      23             : #endif
      24             : 
      25             : struct AV1Common;
      26             : 
      27             : void av1_init_mv_probs(struct AV1Common *cm);
      28             : 
      29             : void av1_adapt_mv_probs(struct AV1Common *cm, int usehp);
      30             : 
      31             : #define MV_UPDATE_PROB 252
      32             : 
      33             : /* Symbols for coding which components are zero jointly */
      34             : #define MV_JOINTS 4
      35             : typedef enum {
      36             :   MV_JOINT_ZERO = 0,   /* Zero vector */
      37             :   MV_JOINT_HNZVZ = 1,  /* Vert zero, hor nonzero */
      38             :   MV_JOINT_HZVNZ = 2,  /* Hor zero, vert nonzero */
      39             :   MV_JOINT_HNZVNZ = 3, /* Both components nonzero */
      40             : } MV_JOINT_TYPE;
      41             : 
      42           0 : static INLINE int mv_joint_vertical(MV_JOINT_TYPE type) {
      43           0 :   return type == MV_JOINT_HZVNZ || type == MV_JOINT_HNZVNZ;
      44             : }
      45             : 
      46           0 : static INLINE int mv_joint_horizontal(MV_JOINT_TYPE type) {
      47           0 :   return type == MV_JOINT_HNZVZ || type == MV_JOINT_HNZVNZ;
      48             : }
      49             : 
      50             : /* Symbols for coding magnitude class of nonzero components */
      51             : #define MV_CLASSES 11
      52             : typedef enum {
      53             :   MV_CLASS_0 = 0,   /* (0, 2]     integer pel */
      54             :   MV_CLASS_1 = 1,   /* (2, 4]     integer pel */
      55             :   MV_CLASS_2 = 2,   /* (4, 8]     integer pel */
      56             :   MV_CLASS_3 = 3,   /* (8, 16]    integer pel */
      57             :   MV_CLASS_4 = 4,   /* (16, 32]   integer pel */
      58             :   MV_CLASS_5 = 5,   /* (32, 64]   integer pel */
      59             :   MV_CLASS_6 = 6,   /* (64, 128]  integer pel */
      60             :   MV_CLASS_7 = 7,   /* (128, 256] integer pel */
      61             :   MV_CLASS_8 = 8,   /* (256, 512] integer pel */
      62             :   MV_CLASS_9 = 9,   /* (512, 1024] integer pel */
      63             :   MV_CLASS_10 = 10, /* (1024,2048] integer pel */
      64             : } 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_OFFSET_BITS (MV_CLASSES + CLASS0_BITS - 2)
      69             : #define MV_FP_SIZE 4
      70             : 
      71             : #define MV_MAX_BITS (MV_CLASSES + CLASS0_BITS + 2)
      72             : #define MV_MAX ((1 << MV_MAX_BITS) - 1)
      73             : #define MV_VALS ((MV_MAX << 1) + 1)
      74             : 
      75             : #define MV_IN_USE_BITS 14
      76             : #define MV_UPP ((1 << MV_IN_USE_BITS) - 1)
      77             : #define MV_LOW (-(1 << MV_IN_USE_BITS))
      78             : 
      79             : extern const aom_tree_index av1_mv_joint_tree[];
      80             : extern const aom_tree_index av1_mv_class_tree[];
      81             : extern const aom_tree_index av1_mv_class0_tree[];
      82             : extern const aom_tree_index av1_mv_fp_tree[];
      83             : 
      84             : typedef struct {
      85             :   aom_prob sign;
      86             :   aom_prob classes[MV_CLASSES - 1];
      87             :   aom_cdf_prob class_cdf[CDF_SIZE(MV_CLASSES)];
      88             :   aom_prob class0[CLASS0_SIZE - 1];
      89             :   aom_prob bits[MV_OFFSET_BITS];
      90             :   aom_prob class0_fp[CLASS0_SIZE][MV_FP_SIZE - 1];
      91             :   aom_prob fp[MV_FP_SIZE - 1];
      92             :   aom_cdf_prob class0_fp_cdf[CLASS0_SIZE][CDF_SIZE(MV_FP_SIZE)];
      93             :   aom_cdf_prob fp_cdf[CDF_SIZE(MV_FP_SIZE)];
      94             :   aom_prob class0_hp;
      95             :   aom_prob hp;
      96             : } nmv_component;
      97             : 
      98             : typedef struct {
      99             :   aom_prob joints[MV_JOINTS - 1];
     100             :   aom_cdf_prob joint_cdf[CDF_SIZE(MV_JOINTS)];
     101             :   nmv_component comps[2];
     102             : } nmv_context;
     103             : 
     104           0 : static INLINE MV_JOINT_TYPE av1_get_mv_joint(const MV *mv) {
     105           0 :   if (mv->row == 0) {
     106           0 :     return mv->col == 0 ? MV_JOINT_ZERO : MV_JOINT_HNZVZ;
     107             :   } else {
     108           0 :     return mv->col == 0 ? MV_JOINT_HZVNZ : MV_JOINT_HNZVNZ;
     109             :   }
     110             : }
     111             : 
     112             : MV_CLASS_TYPE av1_get_mv_class(int z, int *offset);
     113             : 
     114             : typedef struct {
     115             :   unsigned int sign[2];
     116             :   unsigned int classes[MV_CLASSES];
     117             :   unsigned int class0[CLASS0_SIZE];
     118             :   unsigned int bits[MV_OFFSET_BITS][2];
     119             :   unsigned int class0_fp[CLASS0_SIZE][MV_FP_SIZE];
     120             :   unsigned int fp[MV_FP_SIZE];
     121             :   unsigned int class0_hp[2];
     122             :   unsigned int hp[2];
     123             : } nmv_component_counts;
     124             : 
     125             : typedef struct {
     126             :   unsigned int joints[MV_JOINTS];
     127             :   nmv_component_counts comps[2];
     128             : } nmv_context_counts;
     129             : 
     130             : void av1_inc_mv(const MV *mv, nmv_context_counts *mvctx, const int usehp);
     131             : #if CONFIG_GLOBAL_MOTION
     132             : extern const aom_tree_index
     133             :     av1_global_motion_types_tree[TREE_SIZE(GLOBAL_TRANS_TYPES)];
     134             : #endif  // CONFIG_GLOBAL_MOTION
     135             : #if !CONFIG_EC_ADAPT
     136             : void av1_set_mv_cdfs(nmv_context *ctx);
     137             : #endif
     138             : 
     139             : #ifdef __cplusplus
     140             : }  // extern "C"
     141             : #endif
     142             : 
     143             : #endif  // AV1_COMMON_ENTROPYMV_H_

Generated by: LCOV version 1.13