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

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

?? mc_prediction.c

?? h.264 影像壓縮 必須在 .net 的環境 下操作
?? 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];
/*!
 ************************************************************************
 * \brief
 *    block single list prediction
 ************************************************************************
 */
static inline 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][joff];

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

/*!
 ************************************************************************
 * \brief
 *    block single list weighted prediction
 ************************************************************************
 */
static inline 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;
  static imgpel *mpr, *b0;
  
  for(jj=0;jj<ver_block_size;jj++)
  {
    mpr = &img->mpr[yuv][jj + joff][ioff];
    b0 = block[jj];
    for(ii=0;ii<hor_block_size;ii++)
      *(mpr++) = iClip1(color_clip, 
      (rshift_rnd((wp_scale *  *(b0++)), weight_denom)  + wp_offset ));
  }
}


/*!
 ************************************************************************
 * \brief
 *    block biprediction
 ************************************************************************
 */
static inline 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;
  static imgpel *mpr, *b0, *b1;

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

/*!
 ************************************************************************
 * \brief
 *    block weighted biprediction
 ************************************************************************
 */
static inline 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;
  static imgpel *mpr, *b0, *b1;
  
  for(jj=0;jj<ver_block_size;jj++)
  {
    mpr = &img->mpr[yuv][jj + joff][ioff];    
    b0 = block_l0[jj];
    b1 = block_l1[jj];
    for(ii=0;ii<hor_block_size;ii++)
      *(mpr++) = (int)iClip1(color_clip, 
      (rshift_rnd((wp_scale_l0 * *(b0++) + wp_scale_l1 * *(b1++)), weight_denom) + wp_offset));
  }
}

/*!
 ************************************************************************
 * \brief
 *    Interpolation of 1/4 subpixel
 ************************************************************************
 */ 
void get_block_luma(ColorPlane pl, 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, jj;
  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;

  static int tmp_res[21][21];
  static int *tmp_line;
  static imgpel *p0, *p1, *p2, *p3, *p4, *p5;
  static int    *x0, *x1, *x2, *x3, *x4, *x5;
  static const int COEF[6] = { 1, -5, 20, 20, -5, 1 };
  StorablePicture *curr_ref = list[ref_frame];
  static imgpel **cur_imgY, *cur_lineY;
  int tmp_pos;
  static int ipos_m2, ipos_m1, ipos, ipos_p1, ipos_p2, ipos_p3;
  static imgpel *orig_line;

  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 if (pl==PLANE_Y)
  {
    cur_imgY = curr_ref->imgY;
  }
  else
  {
    cur_imgY = curr_ref->imgUV[pl-1]; 
  }

  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 */
        for (j = 0; j < ver_block_size; j++)
        {
          p0 = &cur_imgY[y_pos + j][x_pos - 2];
          p1 = p0 + 1;
          p2 = p1 + 1;
          p3 = p2 + 1;
          p4 = p3 + 1;
          p5 = p4 + 1;
          orig_line = block[j];

          for (i = 0; i < hor_block_size; i++)
          {        
            result  = (*(p0++) + *(p5++)) * COEF[0]
                    + (*(p1++) + *(p4++)) * COEF[1]
                    + (*(p2++) + *(p3++)) * COEF[2];

            *orig_line++ = iClip1(img->max_imgpel_value, ((result + 16)>>5));
          }
        }

        if ((dx&1) == 1)
        {          
          jj = y_pos;
          for (j = 0; j < ver_block_size; j++)
          {
            cur_lineY = &(cur_imgY[ jj++ ][x_pos + (dx >> 1)]);
            orig_line = block[j];
            for (i = 0; i < hor_block_size; i++)
            {
              *orig_line = (*orig_line + *(cur_lineY++) + 1 )>>1;
              orig_line++;
            }
          }
        }
      }
      else if (dx == 0)
      {  /* No horizontal interpolation */        
        p0 = &(cur_imgY[y_pos - 2][x_pos]);
        for (j = 0; j < ver_block_size; j++)
        {                  
          p1 = p0 + shift_x;          
          p2 = p1 + shift_x;
          p3 = p2 + shift_x;
          p4 = p3 + shift_x;
          p5 = p4 + shift_x;
          orig_line = block[j];

          for (i = 0; i < hor_block_size; i++)
          {
            result  = (*(p0++) + *(p5++)) * COEF[0]
                    + (*(p1++) + *(p4++)) * COEF[1]
                    + (*(p2++) + *(p3++)) * COEF[2];

            *orig_line++ = iClip1(img->max_imgpel_value, ((result + 16)>>5));
          }
          p0 = p1 - hor_block_size;
        }

        if ((dy&1) == 1)
        {
          jj = y_pos + (dy >> 1);
          for (j = 0; j < ver_block_size; j++)
          {
            cur_lineY = &(cur_imgY[jj++][x_pos]);
            orig_line = block[j];
            for (i = 0; i < hor_block_size; i++)
            {
              *orig_line = (*orig_line + *(cur_lineY++) + 1 )>>1;
              orig_line++;
            }
          }
        }
      }
      else if (dx == 2)
      {  /* Vertical & horizontal interpolation */
        jj = y_pos - 2;
        for (j = 0; j < ver_block_size + 5; j++)
        {
          p0 = &cur_imgY[jj++][x_pos - 2];
          p1 = p0 + 1;
          p2 = p1 + 1;
          p3 = p2 + 1;
          p4 = p3 + 1;
          p5 = p4 + 1;
          orig_line = block[j];
          tmp_line  = tmp_res[j];

          for (i = 0; i < hor_block_size; i++)
          {        
            *(tmp_line++) = (*(p0++) + *(p5++)) * COEF[0]
                          + (*(p1++) + *(p4++)) * COEF[1]
                          + (*(p2++) + *(p3++)) * COEF[2];
          }
        }

        for (j = 0; j < ver_block_size; j++)
        {
          x0 = tmp_res[j    ];
          x1 = tmp_res[j + 1];
          x2 = tmp_res[j + 2];
          x3 = tmp_res[j + 3];
          x4 = tmp_res[j + 4];
          x5 = tmp_res[j + 5];
          orig_line = block[j];

          for (i = 0; i < hor_block_size; i++)
          {
            result  = (*x0++ + *x5++) * COEF[0]
                    + (*x1++ + *x4++) * COEF[1]
                    + (*x2++ + *x3++) * COEF[2];

            *(orig_line++) = iClip1(img->max_imgpel_value, ((result+512)>>10));
          }
        }

        if ((dy&1) == 1)
        {
          jj = 2 + (dy>>1);
          for (j = 0; j < ver_block_size; j++)
          {            
            tmp_line  = tmp_res[jj++];
            orig_line = block[j];
            for (i = 0; i < hor_block_size; i++)
            {
              *orig_line = (*orig_line + iClip1(img->max_imgpel_value, ((*(tmp_line++) + 16) >> 5)) + 1 )>>1;
              orig_line++;
            }
          }
        }
      }
      else if (dy == 2)
      {  /* Horizontal & vertical interpolation */
        p0 = &(cur_imgY[y_pos - 2][x_pos - 2]);
        for (j = 0; j < ver_block_size; j++)
        {                    
          p1 = p0 + shift_x;
          p2 = p1 + shift_x;
          p3 = p2 + shift_x;
          p4 = p3 + shift_x;
          p5 = p4 + shift_x;
          tmp_line  = tmp_res[j];

          for (i = 0; i < hor_block_size + 5; i++)
          {
            *(tmp_line++)  = (*(p0++) + *(p5++)) * COEF[0]
                           + (*(p1++) + *(p4++)) * COEF[1]
                           + (*(p2++) + *(p3++)) * COEF[2];
          }
          p0 = p1 - (hor_block_size + 5);
        }

        for (j = 0; j < ver_block_size; j++)
        {
          orig_line = block[j];
          x0 = tmp_res[j];
          x1 = x0 + 1;
          x2 = x1 + 1;
          x3 = x2 + 1;
          x4 = x3 + 1;
          x5 = x4 + 1;

          for (i = 0; i < hor_block_size; i++)
          {
            result  = (*(x0++) + *(x5++)) * COEF[0]
                    + (*(x1++) + *(x4++)) * COEF[1]
                    + (*(x2++) + *(x3++)) * COEF[2];

            *(orig_line++) = iClip1(img->max_imgpel_value, ((result + 512)>>10));
          }
        }

        if ((dx&1) == 1)
        {
          for (j = 0; j < ver_block_size; j++)
          {
            tmp_line  = &tmp_res[j][2 + (dx>>1)];
            orig_line = block[j];
            for (i = 0; i < hor_block_size; i++)
            {
              *orig_line = (*orig_line + iClip1(img->max_imgpel_value, ((*(tmp_line++) + 16)>>5))+1)>>1;
              orig_line ++;
            }
          }
        }
      }
      else
      {  /* Diagonal interpolation */
        jj = (dy == 1 ? y_pos : y_pos + 1);

        for (j = 0; j < ver_block_size; j++)
        {
          p0 = &cur_imgY[jj++][x_pos - 2];
          p1 = p0 + 1;
          p2 = p1 + 1;
          p3 = p2 + 1;
          p4 = p3 + 1;
          p5 = p4 + 1;

          orig_line = block[j];

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
男人的j进女人的j一区| 亚洲va天堂va国产va久| 色婷婷激情综合| 久草在线在线精品观看| 亚洲一级二级在线| 欧美激情中文不卡| 欧美成人一级视频| 欧美日韩国产美| 99久久国产综合精品色伊| 久久99国产精品尤物| 亚洲va国产va欧美va观看| 中文字幕日韩欧美一区二区三区| 欧美电视剧免费全集观看| 欧美三级一区二区| 色综合久久天天| 99免费精品在线观看| 国产精品一区二区果冻传媒| 午夜免费欧美电影| 亚洲一区二区免费视频| 亚洲欧洲精品一区二区精品久久久 | 亚洲视频一区二区在线观看| 2021国产精品久久精品| 日韩一级二级三级| 在线播放中文一区| 欧美视频在线一区二区三区| 91免费国产在线| 丰满岳乱妇一区二区三区| 国产真实乱对白精彩久久| 免费在线观看不卡| 日韩精品乱码av一区二区| 亚洲一区影音先锋| 亚洲国产精品一区二区www| 一区二区三区久久久| 亚洲欧美另类久久久精品| 亚洲欧洲日韩av| 中文字幕日韩av资源站| 国产精品久久久久婷婷| 国产欧美日韩久久| 久久精品免视看| 中文字幕不卡在线播放| 国产午夜精品一区二区| 国产精品情趣视频| 亚洲情趣在线观看| 亚洲尤物视频在线| 日韩电影在线一区二区三区| 午夜av一区二区三区| 午夜精品久久久久影视| 蜜臀av亚洲一区中文字幕| 激情综合五月婷婷| 国产成人av电影在线播放| 懂色av一区二区三区免费观看| www.视频一区| 91黄色免费观看| 欧美视频第二页| 91精品国产手机| 久久久久久黄色| 亚洲天堂免费在线观看视频| 一区二区三区鲁丝不卡| 日本欧美在线观看| 国产经典欧美精品| 91亚洲大成网污www| 91精品福利在线| 欧美一区二区福利视频| 精品乱码亚洲一区二区不卡| 欧美精品一区二区三区蜜桃| 国产精品色眯眯| 亚洲午夜精品网| 国产原创一区二区| 97se亚洲国产综合自在线| 欧美日韩国产综合久久| 久久综合资源网| 依依成人精品视频| 日本麻豆一区二区三区视频| 国产乱一区二区| 色猫猫国产区一区二在线视频| 欧美日韩另类一区| 国产日产欧美一区二区视频| 亚洲精品国产品国语在线app| 日韩专区一卡二卡| 成人亚洲一区二区一| 欧美午夜在线观看| 久久蜜桃av一区二区天堂 | 国产精品成人在线观看| 亚洲高清免费观看| 国产一区在线看| 色老综合老女人久久久| www久久精品| 亚洲va天堂va国产va久| 成人免费视频视频| 欧美美女直播网站| 国产精品国产三级国产| 麻豆传媒一区二区三区| 色综合久久综合中文综合网| 久久一区二区三区四区| 亚洲18女电影在线观看| 成人一二三区视频| 日韩精品专区在线| 亚洲综合图片区| 成人avav影音| 久久精品欧美一区二区三区不卡| 香蕉加勒比综合久久| 91在线小视频| 精品国产污污免费网站入口| 一级中文字幕一区二区| 岛国av在线一区| 精品国产91久久久久久久妲己| 亚洲一区中文在线| 99re这里只有精品首页| 欧美激情一区二区在线| 黄色精品一二区| 制服丝袜激情欧洲亚洲| 亚洲夂夂婷婷色拍ww47| 色综合久久88色综合天天6 | 日韩精品五月天| 欧美在线播放高清精品| 中文字幕在线不卡视频| 国产乱码精品1区2区3区| 日韩视频不卡中文| 午夜影视日本亚洲欧洲精品| 色94色欧美sute亚洲13| 中文字幕制服丝袜一区二区三区| 国产在线播放一区三区四| 日韩欧美国产成人一区二区| 日日嗨av一区二区三区四区| 欧美日韩一级黄| 亚洲第一搞黄网站| 欧美视频完全免费看| 亚洲视频精选在线| av电影一区二区| 国产精品免费aⅴ片在线观看| 国内精品视频一区二区三区八戒| 欧美成人在线直播| 国产一区二区三区香蕉| 久久久久亚洲综合| 国产成人精品aa毛片| 国产欧美日韩不卡免费| 国产91高潮流白浆在线麻豆| 国产日韩欧美精品综合| 成人免费高清在线观看| 中文字幕日本乱码精品影院| 99久久综合精品| 亚洲精品高清在线| 欧美日韩高清不卡| 免费国产亚洲视频| 精品国精品自拍自在线| 国产真实乱对白精彩久久| 日本一区二区免费在线观看视频| 成人免费视频网站在线观看| 中文字幕亚洲电影| 欧美三级中文字| 久久福利资源站| 中国色在线观看另类| 色综合久久精品| 日韩黄色在线观看| 久久久亚洲高清| 成人国产一区二区三区精品| 亚洲男帅同性gay1069| 欧美日韩中文精品| 琪琪久久久久日韩精品| 久久久久久麻豆| 本田岬高潮一区二区三区| 一区二区欧美在线观看| 精品视频色一区| 久久成人免费电影| 亚洲色图第一区| 欧美精品一卡二卡| 国产伦精品一区二区三区视频青涩| 国产亚洲精品中文字幕| 欧美影视一区在线| 捆绑紧缚一区二区三区视频| 久久精品视频一区二区| 欧美伊人久久久久久久久影院| 日韩精品1区2区3区| 国产欧美一区二区精品仙草咪| 色综合天天性综合| 老色鬼精品视频在线观看播放| 亚洲国产精品精华液ab| 欧美日韩亚洲不卡| 国产盗摄女厕一区二区三区| **欧美大码日韩| 精品国产一区二区三区久久久蜜月| 成人综合在线观看| 亚洲大片在线观看| 中文字幕第一区二区| 欧美一区二区视频在线观看2022| 国产成人精品免费视频网站| 亚洲成av人影院| 国产精品欧美久久久久一区二区 | 色婷婷久久综合| 国产在线观看一区二区| 亚洲大片精品永久免费| 国产精品久久久久四虎| 欧美一区二区视频在线观看| 91免费国产在线观看| 国产不卡视频一区二区三区| 天天爽夜夜爽夜夜爽精品视频| 中文无字幕一区二区三区| 欧美一区二区三区四区视频 | 日韩欧美一级片| 91福利视频网站|