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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? 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++)
        {        

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产精品一区二区在线观看网站| 免费的成人av| 国产精品久久久久久久久动漫 | 日韩一级大片在线| 99在线视频精品| 成人综合婷婷国产精品久久免费| 日韩制服丝袜先锋影音| 亚洲一区二区三区四区五区中文| 最新中文字幕一区二区三区 | 欧美国产精品劲爆| 国产人久久人人人人爽| 国产日韩欧美电影| 中文字幕一区二区不卡| 国产日韩影视精品| 亚洲日本在线视频观看| 一色屋精品亚洲香蕉网站| 欧美激情在线看| 国产精品美女久久久久久| 中文字幕在线不卡国产视频| 中文字幕在线观看一区二区| 亚洲欧美一区二区三区久本道91| 国产精品蜜臀在线观看| 一区二区三区视频在线看| 一区二区三区免费在线观看| 亚洲一区二区欧美| 日本最新不卡在线| 国产乱色国产精品免费视频| 成人一区二区三区中文字幕| 色综合天天天天做夜夜夜夜做| 欧洲在线/亚洲| 精品国产一区二区三区av性色| 国产三级精品三级| 亚洲一区二区三区精品在线| 精品在线亚洲视频| 91亚洲精华国产精华精华液| 欧美日韩免费视频| 中文字幕 久热精品 视频在线| 亚洲精品久久久久久国产精华液| 午夜精品视频在线观看| 国产综合色在线| 欧美日韩精品一区二区| 国产精品日韩精品欧美在线| 亚洲一级二级三级| 成人在线一区二区三区| 欧美老女人第四色| 国产精品视频观看| 美女爽到高潮91| 欧美日韩专区在线| 国产精品不卡视频| 国产精品亚洲а∨天堂免在线| 欧美性猛交xxxx黑人交| 中文字幕一区二区三区精华液| 美洲天堂一区二卡三卡四卡视频 | 国产成人精品免费在线| 日韩视频永久免费| 日日嗨av一区二区三区四区| 色综合天天做天天爱| 国产精品成人一区二区艾草 | 91蜜桃免费观看视频| 中文字幕乱码日本亚洲一区二区| 日韩精品一二三| 欧美一区二区在线免费观看| 亚洲一区二区三区中文字幕| 在线观看免费视频综合| 一区二区三区日本| 在线观看成人免费视频| 亚洲国产一区二区视频| 欧美区一区二区三区| 日韩 欧美一区二区三区| 日韩欧美一二三区| 国产精品 日产精品 欧美精品| 国产一区啦啦啦在线观看| 国产精品网站一区| 一区二区三区不卡视频在线观看| 日韩电影网1区2区| 国产片一区二区三区| 日本韩国一区二区三区| 高潮精品一区videoshd| 日本在线不卡视频| 亚洲一区二区三区四区在线| 久久精品男人的天堂| 国产成人午夜精品5599| 欧美激情中文字幕一区二区| 99精品视频中文字幕| 亚洲成人久久影院| 日韩三级视频在线观看| 国产一区二区在线电影| 日本一区二区三区视频视频| 色就色 综合激情| 日韩av中文字幕一区二区| 久久精品一区二区三区av | 成人免费看视频| 亚洲第一综合色| 欧美高清在线一区| 91精品国产综合久久久久久漫画| 免费人成精品欧美精品| 亚洲欧洲日产国码二区| 日韩欧美国产系列| 91在线国产福利| 欧洲激情一区二区| 国产在线一区观看| 激情文学综合丁香| 极品少妇一区二区三区精品视频 | 91麻豆精品国产自产在线观看一区 | 欧美一区二区成人| 欧美精品久久久久久久久老牛影院 | 国产亚洲一区二区三区在线观看 | 国产精品青草综合久久久久99| 91麻豆精品国产| 欧美吞精做爰啪啪高潮| 91麻豆高清视频| 色偷偷久久一区二区三区| 99久久精品免费看| av中文字幕一区| 色婷婷国产精品| 欧美日韩精品免费观看视频| 91麻豆精品久久久久蜜臀 | 国产日韩亚洲欧美综合| 中文字幕免费一区| 亚洲色图视频网| 日韩福利电影在线观看| 国产精品久久久久久久久久免费看 | 日韩欧美国产午夜精品| 亚洲色图欧洲色图婷婷| 激情小说亚洲一区| 欧美三级欧美一级| 久久综合色鬼综合色| 国产精品高潮久久久久无| 亚洲国产色一区| 国产一区二区视频在线| 99re热视频精品| 成人欧美一区二区三区视频网页| 欧美剧情电影在线观看完整版免费励志电影| 91美女福利视频| 777色狠狠一区二区三区| 欧美色电影在线| 欧美第一区第二区| 亚洲欧美日韩中文字幕一区二区三区| 亚洲欧美视频在线观看视频| 麻豆成人av在线| 色哦色哦哦色天天综合| 日韩午夜电影av| 亚洲一区二区美女| caoporn国产一区二区| 精品福利一区二区三区| 首页国产欧美久久| 色域天天综合网| 国产精品麻豆久久久| 国产精品一区二区果冻传媒| 欧美高清视频一二三区 | 美女一区二区在线观看| 欧美色图12p| 亚洲成年人网站在线观看| 国模无码大尺度一区二区三区| 欧美一区二区三区在线观看视频| 亚洲综合小说图片| 色综合欧美在线| 亚洲精品水蜜桃| 色婷婷香蕉在线一区二区| 亚洲狼人国产精品| 91亚洲国产成人精品一区二三 | 久久精品一区蜜桃臀影院| 奇米777欧美一区二区| 3atv一区二区三区| 三级久久三级久久久| 欧美日韩国产另类不卡| 性欧美大战久久久久久久久| 日本精品一级二级| 亚洲另类中文字| 欧美私模裸体表演在线观看| 亚洲超碰精品一区二区| 91精品国产aⅴ一区二区| 蜜臀久久久99精品久久久久久| 久久综合九色欧美综合狠狠| 国产福利一区二区三区在线视频| 亚洲区小说区图片区qvod| 欧美卡1卡2卡| 成人永久aaa| 午夜精品福利一区二区蜜股av | 亚洲三级在线播放| 91精品免费在线观看| 国产精品一区三区| 一区二区国产盗摄色噜噜| 日韩午夜在线观看视频| 91免费看视频| 国产精品亚洲成人| 另类专区欧美蜜桃臀第一页| 亚洲欧美一区二区视频| 欧美成人精品3d动漫h| 欧美老人xxxx18| 欧美日韩一区二区三区免费看 | 亚洲 欧美综合在线网络| 亚洲精品免费在线| 国产精品每日更新| 国产精品国产自产拍高清av王其| 亚洲精品在线观看视频| 日韩欧美一级特黄在线播放| 日韩精品一区二区三区三区免费| 69久久夜色精品国产69蝌蚪网| 不卡在线视频中文字幕|