亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? mc_prediction.c

?? This program can encode the YUV vdieo format to H.264 and decode it.
?? C
?? 第 1 頁 / 共 3 頁
字號:

/*!
 *************************************************************************************
 * \file mc_prediction.c
 *
 * \brief
 *    Functions for motion compensated prediction
 *
 * \author
 *      Main contributors (see contributors.h for copyright, 
 *                         address and affiliation details)
 *      - Alexis Michael Tourapis  <alexismt@ieee.org>
 *
 *************************************************************************************
 */
#include <assert.h>
#include <string.h>

#include "global.h"
#include "block.h"
#include "mc_prediction.h"
#include "mbuffer.h"
#include "mb_access.h"

extern StorablePicture *no_reference_picture;
extern const unsigned char subblk_offset_y[3][8][4];
extern const unsigned char subblk_offset_x[3][8][4];
extern const unsigned char cofuv_blk_y[3][8][4];
extern const unsigned char cofuv_blk_x[3][8][4];
/*!
 ************************************************************************
 * \brief
 *    block single list prediction
 ************************************************************************
 */
static void mc_prediction(struct img_par *img, 
                    int yuv,
                    int ver_block_size, 
                    int hor_block_size,
                    int joff,
                    int ioff,
                    imgpel block[MB_BLOCK_SIZE][MB_BLOCK_SIZE])
{
  static int jj;
  imgpel (*mpr) [16] = img->mpr[yuv];

  for(jj = 0; jj < ver_block_size; jj++)
  {
    memcpy(&(mpr[jj + joff][ioff]), &(block[jj][0]), hor_block_size * sizeof(imgpel));
  }
}

/*!
 ************************************************************************
 * \brief
 *    block single list weighted prediction
 ************************************************************************
 */
static void weighted_mc_prediction(struct img_par *img,
                            int yuv, 
                            int ver_block_size, 
                            int hor_block_size,
                            int joff,
                            int ioff,
                            imgpel block[MB_BLOCK_SIZE][MB_BLOCK_SIZE], 
                            int wp_scale,
                            int wp_offset,
                            int weight_denom,
                            int color_clip)
{
  static int ii, jj;
  imgpel *mpr;
  
  for(jj=0;jj<ver_block_size;jj++)
  {
    mpr = img->mpr[yuv][jj + joff];
    for(ii=0;ii<hor_block_size;ii++)
      mpr[ii+ioff] = iClip1(color_clip, 
      (rshift_rnd((wp_scale *  block[jj][ii]), weight_denom)  + wp_offset ));
  }
}


/*!
 ************************************************************************
 * \brief
 *    block biprediction
 ************************************************************************
 */
static void bi_prediction(struct img_par *img, 
                    int yuv,
                    int ver_block_size, 
                    int hor_block_size,
                    int joff,
                    int ioff,
                    imgpel block_l0[MB_BLOCK_SIZE][MB_BLOCK_SIZE], 
                    imgpel block_l1[MB_BLOCK_SIZE][MB_BLOCK_SIZE])
{
  static int ii, jj;
  imgpel *mpr;

  for(jj = 0;jj < ver_block_size;jj++)
  {
    mpr = img->mpr[yuv][jj + joff];    
    for(ii = 0; ii < hor_block_size;ii++)
      mpr[ii + ioff] = rshift_rnd_sf(block_l0[jj][ii] + block_l1[jj][ii], 1);
  }
}

/*!
 ************************************************************************
 * \brief
 *    block weighted biprediction
 ************************************************************************
 */
static void weighted_bi_prediction(struct img_par *img, 
                            int yuv,
                            int ver_block_size, 
                            int hor_block_size,
                            int joff,
                            int ioff,
                            imgpel block_l0[MB_BLOCK_SIZE][MB_BLOCK_SIZE], 
                            imgpel block_l1[MB_BLOCK_SIZE][MB_BLOCK_SIZE],
                            int wp_scale_l0,
                            int wp_scale_l1,
                            int wp_offset,
                            int weight_denom,
                            int color_clip)
{
  static int ii, jj;
  imgpel *mpr;
  
  for(jj=0;jj<ver_block_size;jj++)
  {
    mpr = img->mpr[yuv][jj + joff];    
    for(ii=0;ii<hor_block_size;ii++)
      mpr[ii+ioff] = (int)iClip1(color_clip, 
      (rshift_rnd((wp_scale_l0 * block_l0[jj][ii] + wp_scale_l1 * block_l1[jj][ii]), 
      weight_denom) + wp_offset));
  }
}

/*!
 ************************************************************************
 * \brief
 *    Interpolation of 1/4 subpixel
 ************************************************************************
 */
void get_block_luma(int ref_frame, StorablePicture **list, int x_pos, int y_pos, int hor_block_size, int ver_block_size, struct img_par *img, imgpel block[MB_BLOCK_SIZE][MB_BLOCK_SIZE])
{
  int dx = (x_pos & 3), dy = (y_pos & 3);
  int i, j;
  int shift_x = dec_picture->size_x;
  int maxold_x = dec_picture->size_x_m1;
  int maxold_y = (dec_picture->mb_field[img->current_mb_nr]) ? (dec_picture->size_y >> 1) - 1 : dec_picture->size_y_m1;
  int result;
  int pres_x, pres_y;

  static int tmp_res[21][21];
  static const int COEF[6] = { 1, -5, 20, 20, -5, 1  };
  StorablePicture *curr_ref = list[ref_frame];
  static imgpel **cur_imgY, *cur_lineY;
  static imgpel *cur_lineY_m2, *cur_lineY_m1, *cur_lineY_p1, *cur_lineY_p2, *cur_lineY_p3;
  int tmp_pos;
  static int jpos_m2, jpos_m1, jpos, jpos_p1, jpos_p2, jpos_p3;
  static int ipos_m2, ipos_m1, ipos, ipos_p1, ipos_p2, ipos_p3;

  if (curr_ref == no_reference_picture && img->framepoc < img->recovery_poc)
  {
    printf("list[ref_frame] is equal to 'no reference picture' before RAP\n");

    /* fill the block with sample value 128 */
    for (j = 0; j < ver_block_size; j++)
      for (i = 0; i < hor_block_size; i++)
        block[j][i] = 128;
    return;
  }

  if( IS_INDEPENDENT(img) )
  {
    switch( img->colour_plane_id )
    {
    case    0:
      cur_imgY = curr_ref->imgY;
      break;
    case    1:
      cur_imgY = curr_ref->imgUV[0];
      break;
    case    2:
      cur_imgY = curr_ref->imgUV[1];
      break;
    }
  }
  else
  {
    cur_imgY = curr_ref->imgY;
  }

  x_pos = x_pos >> 2;
  y_pos = y_pos >> 2;

  if ( (y_pos > 1) && (y_pos < maxold_y - 2 - ver_block_size) && (x_pos > 1) && (x_pos < maxold_x - 2 - hor_block_size))
  {
    if (dx == 0 && dy == 0)
    {  /* fullpel position */
      for (j = 0; j < ver_block_size; j++)
      {        
        memcpy(&(block[j][0]), &(cur_imgY[ y_pos + j ][x_pos]), hor_block_size * sizeof(imgpel));
      }
    }
    else
    { /* other positions */

      if (dy == 0)
      { /* No vertical interpolation */
        tmp_pos = x_pos - 2;
        for (i = 0; i < hor_block_size; i++)
        {        
          ipos_m2 = tmp_pos++;
          ipos_m1 = tmp_pos++;
          ipos    = tmp_pos++;
          ipos_p1 = tmp_pos++;
          ipos_p2 = tmp_pos++;
          ipos_p3 = tmp_pos  ;
          tmp_pos -= 4;

          for (j = 0; j < ver_block_size; j++)
          {
            cur_lineY = cur_imgY[y_pos + j];

            result  = (cur_lineY[ipos_m2] + cur_lineY[ipos_p3]) * COEF[0];
            result += (cur_lineY[ipos_m1] + cur_lineY[ipos_p2]) * COEF[1];
            result += (cur_lineY[ipos   ] + cur_lineY[ipos_p1]) * COEF[2];

            block[j][i] = iClip1(img->max_imgpel_value, ((result + 16)>>5));
          }
        }

        if ((dx&1) == 1)
        {
          for (j = 0; j < ver_block_size; j++)
          {
            cur_lineY = &(cur_imgY[ y_pos + j ][x_pos + (dx >> 1)]);
            for (i = 0; i < hor_block_size; i++)
            {
              block[j][i] = (block[j][i] + *(cur_lineY++) + 1 )>>1;
            }
          }
        }
      }
      else if (dx == 0)
      {  /* No horizontal interpolation */        
        cur_lineY_m2 = &(cur_imgY[y_pos - 2][x_pos]);
        for (j = 0; j < ver_block_size; j++)
        {                  
          cur_lineY_m1 = cur_lineY_m2 + shift_x;          
          cur_lineY    = cur_lineY_m1 + shift_x;
          cur_lineY_p1 = cur_lineY    + shift_x;
          cur_lineY_p2 = cur_lineY_p1 + shift_x;
          cur_lineY_p3 = cur_lineY_p2 + shift_x;

          for (i = 0; i < hor_block_size; i++)
          {
            result  = (*(cur_lineY_m2++) + *(cur_lineY_p3++)) * COEF[0];
            result += (*(cur_lineY_m1++) + *(cur_lineY_p2++)) * COEF[1];
            result += (*(cur_lineY   ++) + *(cur_lineY_p1++)) * COEF[2];

            block[j][i] = iClip1(img->max_imgpel_value, ((result+16)>>5));
          }
          cur_lineY_m2 = cur_lineY_m1 - hor_block_size;
        }

        if ((dy&1) == 1)
        {
          for (j = 0; j < ver_block_size; j++)
          {
            cur_lineY = &(cur_imgY[ y_pos + j + (dy >> 1)][x_pos]);
            for (i = 0; i < hor_block_size; i++)
            {
              block[j][i] = (block[j][i] + *(cur_lineY++) + 1 )>>1;
            }
          }
        }
      }
      else if (dx == 2)
      {  /* Vertical & horizontal interpolation */
        tmp_pos = x_pos - 2;
        for (i = 0; i < hor_block_size; i++)
        {        
          ipos_m2 = tmp_pos++;
          ipos_m1 = tmp_pos++;
          ipos    = tmp_pos++;
          ipos_p1 = tmp_pos++;
          ipos_p2 = tmp_pos++;
          ipos_p3 = tmp_pos  ;
          tmp_pos -= 4;

          for (j = 0; j < ver_block_size + 5; j++)
          {
            cur_lineY = cur_imgY[y_pos + j - 2];

            tmp_res[j][i]  = (cur_lineY[ipos_m2] + cur_lineY[ipos_p3]) * COEF[0];
            tmp_res[j][i] += (cur_lineY[ipos_m1] + cur_lineY[ipos_p2]) * COEF[1];
            tmp_res[j][i] += (cur_lineY[ipos   ] + cur_lineY[ipos_p1]) * COEF[2];
          }
        }

        for (j = 0; j < ver_block_size; j++)
        {
          jpos_m2 = j    ;
          jpos_m1 = j + 1;
          jpos    = j + 2;
          jpos_p1 = j + 3;
          jpos_p2 = j + 4;
          jpos_p3 = j + 5;

          for (i = 0; i < hor_block_size; i++)
          {
            result  = (tmp_res[jpos_m2][i] + tmp_res[jpos_p3][i]) * COEF[0];
            result += (tmp_res[jpos_m1][i] + tmp_res[jpos_p2][i]) * COEF[1];
            result += (tmp_res[jpos   ][i] + tmp_res[jpos_p1][i]) * COEF[2];

            block[j][i] = iClip1(img->max_imgpel_value, ((result+512)>>10));
          }
        }

        if ((dy&1) == 1)
        {
          for (j = 0; j < ver_block_size; j++)
          {
            pres_y = j+2+(dy>>1);
            for (i = 0; i < hor_block_size; i++)
            {
              block[j][i] = (block[j][i] + iClip1(img->max_imgpel_value, ((tmp_res[pres_y][i] + 16) >> 5)) + 1 )>>1;
            }
          }
        }
      }
      else if (dy == 2)
      {  /* Horizontal & vertical interpolation */
        cur_lineY_m2 = &(cur_imgY[y_pos - 2][x_pos - 2]);
        for (j = 0; j < ver_block_size; j++)
        {                    
          cur_lineY_m1 = cur_lineY_m2 + shift_x;
          cur_lineY    = cur_lineY_m1 + shift_x;
          cur_lineY_p1 = cur_lineY    + shift_x;
          cur_lineY_p2 = cur_lineY_p1 + shift_x;
          cur_lineY_p3 = cur_lineY_p2 + shift_x;

          for (i = 0; i < hor_block_size + 5; i++)
          {
            tmp_res[j][i]  = (*(cur_lineY_m2++) + *(cur_lineY_p3++)) * COEF[0];
            tmp_res[j][i] += (*(cur_lineY_m1++) + *(cur_lineY_p2++)) * COEF[1];
            tmp_res[j][i] += (*(cur_lineY   ++) + *(cur_lineY_p1++)) * COEF[2];
          }
          cur_lineY_m2 = cur_lineY_m1 - (hor_block_size + 5);
        }

        for (j = 0; j < ver_block_size; j++)
        {
          for (i = 0; i < hor_block_size; i++)
          {
            result  = (tmp_res[j][i    ] + tmp_res[j][i + 5]) * COEF[0];
            result += (tmp_res[j][i + 1] + tmp_res[j][i + 4]) * COEF[1];
            result += (tmp_res[j][i + 2] + tmp_res[j][i + 3]) * COEF[2];
            block[j][i] = iClip1(img->max_imgpel_value, ((result+512)>>10));
          }
        }

        if ((dx&1) == 1)
        {
          for (j = 0; j < ver_block_size; j++)
          {
            for (i = 0; i < hor_block_size; i++)
            {
              block[j][i] = (block[j][i] + iClip1(img->max_imgpel_value, ((tmp_res[j][i + 2 + (dx>>1)] + 16)>>5))+1)>>1;
            }
          }
        }
      }
      else
      {  /* Diagonal interpolation */
        tmp_pos = x_pos - 2;
        for (i = 0; i < hor_block_size; i++)
        {
          ipos_m2 = tmp_pos++;
          ipos_m1 = tmp_pos++;
          ipos    = tmp_pos++;
          ipos_p1 = tmp_pos++;
          ipos_p2 = tmp_pos++;
          ipos_p3 = tmp_pos  ;
          tmp_pos -= 4;

          for (j = 0; j < ver_block_size; j++)
          {
            cur_lineY = cur_imgY[(dy == 1 ? y_pos + j : y_pos + j + 1)];

            result  = (cur_lineY[ipos_m2] + cur_lineY[ipos_p3]) * COEF[0];
            result += (cur_lineY[ipos_m1] + cur_lineY[ipos_p2]) * COEF[1];
            result += (cur_lineY[ipos   ] + cur_lineY[ipos_p1]) * COEF[2];

            block[j][i] = iClip1(img->max_imgpel_value, ((result+16)>>5));
          }
        }

        cur_lineY_m2 = &(cur_imgY[y_pos - 2][(dx == 1 ? x_pos : x_pos + 1)]);
        for (j = 0; j < ver_block_size; j++)
        {        

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
丝袜国产日韩另类美女| 欧美日韩一级二级| 国产亚洲欧洲一区高清在线观看| 免费不卡在线视频| 欧美一级高清大全免费观看| 日本视频中文字幕一区二区三区| 欧美一卡二卡三卡| 麻豆精品视频在线| 久久看人人爽人人| 成人av小说网| 亚洲一级二级三级| 91精品在线免费| 国产揄拍国内精品对白| 欧美国产激情一区二区三区蜜月| av中文一区二区三区| 夜夜嗨av一区二区三区四季av| 欧美日免费三级在线| 日本欧美久久久久免费播放网| 精品久久国产老人久久综合| 成人一区二区在线观看| 亚洲国产一区二区视频| 日韩免费高清av| 成人午夜视频在线| 亚洲综合色区另类av| 日韩美女主播在线视频一区二区三区| 国产一区二区按摩在线观看| 亚洲视频在线一区观看| 91精品在线观看入口| 丰满岳乱妇一区二区三区| 一区二区三区在线观看动漫| 日韩精品一区在线观看| aa级大片欧美| 免费在线成人网| 亚洲va韩国va欧美va精品| 日韩亚洲欧美中文三级| 99久久久国产精品| 亚洲成人777| 国产精品乱码妇女bbbb| 91精品国产综合久久香蕉的特点| 成人综合婷婷国产精品久久| 奇米色一区二区| 中文字幕一区二区三区不卡在线| 欧美色涩在线第一页| 成人亚洲精品久久久久软件| 三级在线观看一区二区| 亚洲人123区| 精品国产乱码久久久久久免费| 在线免费视频一区二区| 丁香五精品蜜臀久久久久99网站| 日韩激情视频在线观看| 亚洲免费观看高清完整版在线观看熊 | 91香蕉视频黄| 韩国视频一区二区| 丝袜国产日韩另类美女| 亚洲影视在线播放| 欧美国产精品v| 精品成人私密视频| 在线不卡中文字幕| 色欧美乱欧美15图片| 国产成人午夜视频| 精品在线观看视频| 午夜精品久久久久久久久| 日韩毛片视频在线看| 日本一区二区在线不卡| 久久奇米777| 精品三级在线观看| 日韩一区二区视频在线观看| 欧美日韩一本到| 91麻豆文化传媒在线观看| 成人短视频下载| 国产99久久久国产精品潘金网站| 精品写真视频在线观看| 日韩福利视频网| 午夜精品久久久| 香蕉乱码成人久久天堂爱免费| 亚洲免费观看高清| 中文字幕一区二区三区色视频 | 97aⅴ精品视频一二三区| 成人午夜在线播放| 成人的网站免费观看| 国产69精品久久久久毛片| 国产精品亚洲第一区在线暖暖韩国| 美女视频黄久久| 久久99精品国产.久久久久久| 日本系列欧美系列| 九九精品一区二区| 国产精品一二三在| 岛国精品在线播放| 97se亚洲国产综合自在线| 色哟哟一区二区在线观看| 欧美主播一区二区三区| 欧美日本国产视频| 欧美一区二区三区啪啪| 欧美精品一区二区精品网| 国产亚洲成年网址在线观看| 国产精品国产三级国产aⅴ原创| 国产精品色哟哟网站| 亚洲丝袜另类动漫二区| 亚洲国产成人av好男人在线观看| 午夜精品久久久久久久99水蜜桃| 毛片av中文字幕一区二区| 国产高清无密码一区二区三区| 成人少妇影院yyyy| 91福利视频网站| 555夜色666亚洲国产免| 久久久久国产精品厨房| 中文字幕在线播放不卡一区| 亚洲一区二区视频在线观看| 免费观看在线综合| 国产v日产∨综合v精品视频| 色欧美片视频在线观看| 欧美岛国在线观看| 国产精品国产三级国产aⅴ原创| 亚洲国产精品一区二区久久恐怖片| 蜜臂av日日欢夜夜爽一区| 成人自拍视频在线| 在线播放日韩导航| 国产欧美一区二区精品婷婷| 一区二区久久久久久| 精品一区二区国语对白| 91亚洲午夜精品久久久久久| 欧美一区午夜精品| 国产精品二三区| 另类综合日韩欧美亚洲| 91麻豆免费看片| 日韩无一区二区| 亚洲视频一区二区在线观看| 麻豆精品蜜桃视频网站| 色婷婷国产精品综合在线观看| 精品久久久久久亚洲综合网| 亚洲国产乱码最新视频| 国产精品影视网| 欧美酷刑日本凌虐凌虐| 最新国产成人在线观看| 狠狠色丁香婷综合久久| 欧美唯美清纯偷拍| 国产精品丝袜久久久久久app| 日韩电影在线观看网站| thepron国产精品| 精品国产乱码久久久久久老虎| 亚洲一区二区视频在线观看| www.成人网.com| 国产校园另类小说区| 日本亚洲三级在线| 在线观看日韩精品| 国产精品美女一区二区| 久久se精品一区精品二区| 欧美色电影在线| 自拍偷自拍亚洲精品播放| 狠狠色综合日日| 欧美一卡二卡在线观看| 婷婷国产v国产偷v亚洲高清| 在线亚洲高清视频| 中文字幕一区二区三区四区不卡 | 91精品欧美一区二区三区综合在| 亚洲欧美偷拍三级| 成人免费视频一区| 久久九九全国免费| 免费欧美日韩国产三级电影| 91麻豆精品国产91久久久使用方法 | 一本到不卡免费一区二区| 国产精品全国免费观看高清| 国产精品一二三四| 久久精品一区二区三区av| 韩国一区二区视频| 久久综合色一综合色88| 久久av资源站| 精品理论电影在线观看| 寂寞少妇一区二区三区| 欧美精品一区二区三区蜜桃| 久久精品国产77777蜜臀| 日韩免费观看高清完整版| 久久爱www久久做| 久久午夜老司机| 国产东北露脸精品视频| 中文一区二区在线观看| 成人ar影院免费观看视频| 国产精品美女视频| 91麻豆产精品久久久久久| 亚洲黄网站在线观看| 欧美日韩国产一区| 琪琪久久久久日韩精品| 久久综合色一综合色88| 成人免费福利片| 一区二区三区国产豹纹内裤在线| 欧美午夜理伦三级在线观看| 五月婷婷综合在线| 日韩视频在线观看一区二区| 国产一区二区三区蝌蚪| 国产亚洲综合av| 91久久久免费一区二区| 亚洲福利视频三区| 欧美精品一区二区在线观看| 国产91精品露脸国语对白| 国产精品成人免费| 欧美日产在线观看| 国内精品伊人久久久久影院对白| 欧美高清在线视频| 欧美性猛交xxxx乱大交退制版| 青青草国产精品亚洲专区无|