⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 me_umhex.h

📁 H.264编码实现
💻 H
📖 第 1 页 / 共 2 页
字号:

/*!
 ************************************************************************
 *
 * \file me_umhex.h
 *
 * \brief
 *   Macro definitions and global variables for UMHEX fast
 *   integer pel motion estimation and fractional pel motion estimation
 *
 * \author
 *   Main contributors: (see contributors.h for copyright, address and affiliation details)
 *    - Zhibo Chen         <chenzhibo@tsinghua.org.cn>
 *    - JianFeng Xu        <fenax@video.mdc.tsinghua.edu.cn>
 *    - Wenfang Fu         <fwf@video.mdc.tsinghua.edu.cn>
 *    - Xiaozhong Xu       <xxz@video.mdc.tsinghua.edu.cn>
 *
 * \date
 *   2006.1
 ************************************************************************
 */

#ifndef _ME_UMHEX_H_
#define _ME_UMHEX_H_

#include "mbuffer.h"

#define EARLY_TERMINATION                                                             \
  if ((min_mcost-pred_SAD)<pred_SAD*betaFourth_2)                                     \
  goto fourth_2_step;                                                                 \
  else if((min_mcost-pred_SAD)<pred_SAD*betaFourth_1)                                 \
  goto fourth_1_step;

#define SEARCH_ONE_PIXEL                                                              \
  if(iabs(cand_x - center_x) <=search_range && iabs(cand_y - center_y)<= search_range)\
  {                                                                                   \
    if(!McostState[cand_y-center_y+search_range][cand_x-center_x+search_range])       \
    {                                                                                 \
      mcost = MV_COST (lambda_factor, mvshift, cand_x, cand_y, pred_x, pred_y);       \
      if(mcost<min_mcost)                                                             \
      {                                                                               \
        mcost += computeUniPred[dist_method](orig_pic,                                \
        blocksize_y,blocksize_x, min_mcost - mcost,                                   \
        (cand_x << 2) + IMG_PAD_SIZE_TIMES4, (cand_y << 2) + IMG_PAD_SIZE_TIMES4);    \
        McostState[cand_y-center_y+search_range][cand_x-center_x+search_range] = 1;   \
        if (mcost < min_mcost)                                                        \
        {                                                                             \
          best_x = cand_x;                                                            \
          best_y = cand_y;                                                            \
          min_mcost = mcost;                                                          \
        }                                                                             \
      }                                                                               \
    }                                                                                 \
   }

#define SEARCH_ONE_PIXEL_BIPRED                                                       \
if(iabs(cand_x - center2_x) <=search_range && iabs(cand_y - center2_y)<= search_range)\
{                                                                                     \
  if(!McostState[cand_y-center2_y+search_range][cand_x-center2_x+search_range])       \
  {                                                                                   \
    mcost  = MV_COST (lambda_factor, mvshift, center1_x, center1_y, pred_x1, pred_y1);\
    mcost += MV_COST (lambda_factor, mvshift, cand_x, cand_y, pred_x2, pred_y2);      \
  if(mcost<min_mcost)                                                                 \
  {                                                                                   \
      mcost  += computeBiPred(cur_pic, blocksize_y, blocksize_x,                      \
      min_mcost - mcost,                                                              \
      (center1_x << 2) + IMG_PAD_SIZE_TIMES4,                                         \
      (center1_y << 2) + IMG_PAD_SIZE_TIMES4,                                         \
      (cand_x << 2) + IMG_PAD_SIZE_TIMES4,                                            \
      (cand_y << 2) + IMG_PAD_SIZE_TIMES4);                                           \
      McostState[cand_y-center2_y+search_range][cand_x-center2_x+search_range] = 1;   \
      if (mcost < min_mcost)                                                          \
      {                                                                               \
        best_x = cand_x;                                                              \
        best_y = cand_y;                                                              \
        min_mcost = mcost;                                                            \
      }                                                                               \
    }                                                                                   \
  }                                                                                   \
}

byte **McostState;                          //!< state for integer pel search
byte **SearchState;                         //!< state for fractional pel search

int ****fastme_ref_cost;                    //!< store SAD information needed for forward ref-frame prediction
int ***fastme_l0_cost;                      //!< store SAD information needed for forward median and uplayer prediction
int ***fastme_l1_cost;                      //!< store SAD information needed for backward median and uplayer prediction
int ***fastme_l0_cost_bipred;               //!< store SAD information for bipred mode
int ***fastme_l1_cost_bipred;               //!< store SAD information for bipred mode
int bipred_flag;                            //!< flag for bipred
int **fastme_best_cost;                     //!< for multi ref early termination threshold
int pred_SAD;                               //!<  SAD prediction in use.
int pred_MV_ref[2], pred_MV_uplayer[2];     //!< pred motion vector by space or temporal correlation,Median is provided

int UMHEX_blocktype;                        //!< blocktype for UMHEX SetMotionVectorPredictor
int predict_point[5][2];
int SAD_a,SAD_b,SAD_c,SAD_d;
int Threshold_DSR_MB[8];                    //!<  Threshold for usage of DSR. DSR refer to JVT-Q088
//for early termination
float  Bsize[8];
float AlphaFourth_1[8];
float AlphaFourth_2[8];
byte *flag_intra;
int  flag_intra_SAD;

void UMHEX_DefineThreshold(void);
void UMHEX_DefineThresholdMB(void);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -