LCOV - code coverage report
Current view: directory - media/libvpx/vp8/common - findnearmv.h (source / functions) Found Hit Coverage
Test: app.info Lines: 69 0 0.0 %
Date: 2012-06-02 Functions: 8 0 0.0 %

       1                 : /*
       2                 :  *  Copyright (c) 2010 The WebM project authors. All Rights Reserved.
       3                 :  *
       4                 :  *  Use of this source code is governed by a BSD-style license
       5                 :  *  that can be found in the LICENSE file in the root of the source
       6                 :  *  tree. An additional intellectual property rights grant can be found
       7                 :  *  in the file PATENTS.  All contributing project authors may
       8                 :  *  be found in the AUTHORS file in the root of the source tree.
       9                 :  */
      10                 : 
      11                 : 
      12                 : #ifndef __INC_FINDNEARMV_H
      13                 : #define __INC_FINDNEARMV_H
      14                 : 
      15                 : #include "mv.h"
      16                 : #include "blockd.h"
      17                 : #include "modecont.h"
      18                 : #include "treecoder.h"
      19                 : 
      20                 : 
      21               0 : static void mv_bias(int refmb_ref_frame_sign_bias, int refframe, int_mv *mvp, const int *ref_frame_sign_bias)
      22                 : {
      23                 :     MV xmv;
      24               0 :     xmv = mvp->as_mv;
      25                 : 
      26               0 :     if (refmb_ref_frame_sign_bias != ref_frame_sign_bias[refframe])
      27                 :     {
      28               0 :         xmv.row *= -1;
      29               0 :         xmv.col *= -1;
      30                 :     }
      31                 : 
      32               0 :     mvp->as_mv = xmv;
      33               0 : }
      34                 : 
      35                 : #define LEFT_TOP_MARGIN (16 << 3)
      36                 : #define RIGHT_BOTTOM_MARGIN (16 << 3)
      37               0 : static void vp8_clamp_mv2(int_mv *mv, const MACROBLOCKD *xd)
      38                 : {
      39               0 :     if (mv->as_mv.col < (xd->mb_to_left_edge - LEFT_TOP_MARGIN))
      40               0 :         mv->as_mv.col = xd->mb_to_left_edge - LEFT_TOP_MARGIN;
      41               0 :     else if (mv->as_mv.col > xd->mb_to_right_edge + RIGHT_BOTTOM_MARGIN)
      42               0 :         mv->as_mv.col = xd->mb_to_right_edge + RIGHT_BOTTOM_MARGIN;
      43                 : 
      44               0 :     if (mv->as_mv.row < (xd->mb_to_top_edge - LEFT_TOP_MARGIN))
      45               0 :         mv->as_mv.row = xd->mb_to_top_edge - LEFT_TOP_MARGIN;
      46               0 :     else if (mv->as_mv.row > xd->mb_to_bottom_edge + RIGHT_BOTTOM_MARGIN)
      47               0 :         mv->as_mv.row = xd->mb_to_bottom_edge + RIGHT_BOTTOM_MARGIN;
      48               0 : }
      49                 : 
      50               0 : static void vp8_clamp_mv(int_mv *mv, int mb_to_left_edge, int mb_to_right_edge,
      51                 :                          int mb_to_top_edge, int mb_to_bottom_edge)
      52                 : {
      53               0 :     mv->as_mv.col = (mv->as_mv.col < mb_to_left_edge) ?
      54               0 :         mb_to_left_edge : mv->as_mv.col;
      55               0 :     mv->as_mv.col = (mv->as_mv.col > mb_to_right_edge) ?
      56               0 :         mb_to_right_edge : mv->as_mv.col;
      57               0 :     mv->as_mv.row = (mv->as_mv.row < mb_to_top_edge) ?
      58               0 :         mb_to_top_edge : mv->as_mv.row;
      59               0 :     mv->as_mv.row = (mv->as_mv.row > mb_to_bottom_edge) ?
      60               0 :         mb_to_bottom_edge : mv->as_mv.row;
      61               0 : }
      62               0 : static unsigned int vp8_check_mv_bounds(int_mv *mv, int mb_to_left_edge,
      63                 :                                 int mb_to_right_edge, int mb_to_top_edge,
      64                 :                                 int mb_to_bottom_edge)
      65                 : {
      66                 :     unsigned int need_to_clamp;
      67               0 :     need_to_clamp = (mv->as_mv.col < mb_to_left_edge) ? 1 : 0;
      68               0 :     need_to_clamp |= (mv->as_mv.col > mb_to_right_edge) ? 1 : 0;
      69               0 :     need_to_clamp |= (mv->as_mv.row < mb_to_top_edge) ? 1 : 0;
      70               0 :     need_to_clamp |= (mv->as_mv.row > mb_to_bottom_edge) ? 1 : 0;
      71               0 :     return need_to_clamp;
      72                 : }
      73                 : 
      74                 : void vp8_find_near_mvs
      75                 : (
      76                 :     MACROBLOCKD *xd,
      77                 :     const MODE_INFO *here,
      78                 :     int_mv *nearest, int_mv *nearby, int_mv *best,
      79                 :     int near_mv_ref_cts[4],
      80                 :     int refframe,
      81                 :     int *ref_frame_sign_bias
      82                 : );
      83                 : 
      84                 : vp8_prob *vp8_mv_ref_probs(
      85                 :     vp8_prob p[VP8_MVREFS-1], const int near_mv_ref_ct[4]
      86                 : );
      87                 : 
      88                 : extern const unsigned char vp8_mbsplit_offset[4][16];
      89                 : 
      90                 : 
      91               0 : static int left_block_mv(const MODE_INFO *cur_mb, int b)
      92                 : {
      93               0 :     if (!(b & 3))
      94                 :     {
      95                 :         /* On L edge, get from MB to left of us */
      96               0 :         --cur_mb;
      97                 : 
      98               0 :         if(cur_mb->mbmi.mode != SPLITMV)
      99               0 :             return cur_mb->mbmi.mv.as_int;
     100               0 :         b += 4;
     101                 :     }
     102                 : 
     103               0 :     return (cur_mb->bmi + b - 1)->mv.as_int;
     104                 : }
     105                 : 
     106               0 : static int above_block_mv(const MODE_INFO *cur_mb, int b, int mi_stride)
     107                 : {
     108               0 :     if (!(b >> 2))
     109                 :     {
     110                 :         /* On top edge, get from MB above us */
     111               0 :         cur_mb -= mi_stride;
     112                 : 
     113               0 :         if(cur_mb->mbmi.mode != SPLITMV)
     114               0 :             return cur_mb->mbmi.mv.as_int;
     115               0 :         b += 16;
     116                 :     }
     117                 : 
     118               0 :     return (cur_mb->bmi + b - 4)->mv.as_int;
     119                 : }
     120               0 : static B_PREDICTION_MODE left_block_mode(const MODE_INFO *cur_mb, int b)
     121                 : {
     122               0 :     if (!(b & 3))
     123                 :     {
     124                 :         /* On L edge, get from MB to left of us */
     125               0 :         --cur_mb;
     126               0 :         switch (cur_mb->mbmi.mode)
     127                 :         {
     128                 :             case B_PRED:
     129               0 :               return (cur_mb->bmi + b + 3)->as_mode;
     130                 :             case DC_PRED:
     131               0 :                 return B_DC_PRED;
     132                 :             case V_PRED:
     133               0 :                 return B_VE_PRED;
     134                 :             case H_PRED:
     135               0 :                 return B_HE_PRED;
     136                 :             case TM_PRED:
     137               0 :                 return B_TM_PRED;
     138                 :             default:
     139               0 :                 return B_DC_PRED;
     140                 :         }
     141                 :     }
     142                 : 
     143               0 :     return (cur_mb->bmi + b - 1)->as_mode;
     144                 : }
     145                 : 
     146               0 : static B_PREDICTION_MODE above_block_mode(const MODE_INFO *cur_mb, int b, int mi_stride)
     147                 : {
     148               0 :     if (!(b >> 2))
     149                 :     {
     150                 :         /* On top edge, get from MB above us */
     151               0 :         cur_mb -= mi_stride;
     152                 : 
     153               0 :         switch (cur_mb->mbmi.mode)
     154                 :         {
     155                 :             case B_PRED:
     156               0 :               return (cur_mb->bmi + b + 12)->as_mode;
     157                 :             case DC_PRED:
     158               0 :                 return B_DC_PRED;
     159                 :             case V_PRED:
     160               0 :                 return B_VE_PRED;
     161                 :             case H_PRED:
     162               0 :                 return B_HE_PRED;
     163                 :             case TM_PRED:
     164               0 :                 return B_TM_PRED;
     165                 :             default:
     166               0 :                 return B_DC_PRED;
     167                 :         }
     168                 :     }
     169                 : 
     170               0 :     return (cur_mb->bmi + b - 4)->as_mode;
     171                 : }
     172                 : 
     173                 : #endif

Generated by: LCOV version 1.7