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

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

?? loopfilter.c

?? TML的參考源代碼
?? C
字號:
/*
***********************************************************************
* COPYRIGHT AND WARRANTY INFORMATION
*
* Copyright 2001, International Telecommunications Union, Geneva
*
* DISCLAIMER OF WARRANTY
*
* These software programs are available to the user without any
* license fee or royalty on an "as is" basis. The ITU disclaims
* any and all warranties, whether express, implied, or
* statutory, including any implied warranties of merchantability
* or of fitness for a particular purpose.  In no event shall the
* contributor or the ITU be liable for any incidental, punitive, or
* consequential damages of any kind whatsoever arising from the
* use of these programs.
*
* This disclaimer of warranty extends to the user of these programs
* and user's customers, employees, agents, transferees, successors,
* and assigns.
*
* The ITU does not represent or warrant that the programs furnished
* hereunder are free of infringement of any third-party patents.
* Commercial implementations of ITU-T Recommendations, including
* shareware, may be subject to royalty fees to patent holders.
* Information regarding the ITU-T patent policy is available from
* the ITU Web site at http://www.itu.int.
*
* THIS IS NOT A GRANT OF PATENT RIGHTS - SEE THE ITU-T PATENT POLICY.
************************************************************************
*/

/*!
 *************************************************************************************
 * \file loopFilter.c
 *
 * \brief
 *    Filter to reduce blocking artifacts on a macroblock level.
 *    The filter strengh is QP dependent.
 *
 * \author
 *    Contributors:
 *    - Peter List      Peter.List@t-systems.de:  Original code                             (13.8.2001)
 *    - Jani Lainema    Jani.Lainema@nokia.com:   Some bug fixing, removal of recusiveness  (16.8.2001)
 *************************************************************************************
 */

#include <stdlib.h>
#include <string.h>

#include "global.h"


#define  Clip( Min, Max, Val) (((Val)<(Min))? (Min):(((Val)>(Max))? (Max):(Val)))

int ALPHA_TABLE[32]  = {128,128,128,128,128,128,128,128,128,128,122, 96, 75, 59, 47, 37,
                         29, 23, 18, 15, 13, 11,  9,  8,  7,  6,  5,  4,  3,  3,  2,  2 } ;
int  BETA_TABLE[32]  = {  0,  0,  0,  0,  0,  0,  0,  0,  3,  3,  3,  4,  4,  4,  6,  6,
                          6,  7,  8,  8,  9,  9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14  } ;
byte CLIP_TBL[3][32] = {{0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0},
                        {0,0,0,0,0,0,0,0, 0,0,0,1,1,1,1,1, 1,1,1,1,1,2,2,2, 2,3,3,3,3,4,5,5},
                        {0,0,0,0,0,0,0,0, 0,1,1,1,1,1,1,1, 1,2,2,2,2,3,3,3, 4,4,5,5,5,7,8,9}} ;

byte MASK_L[2][16]   = {{3,0,1,2,  7,4,5,6,  11,8,9,10,  15,12,13,14}, {12,13,14,15,  0,1,2,3, 4,5,6,7, 8,9,10,11}} ;
byte MASK_C[2][ 4]   = {{1,0,3,2}, {2,3,0,1}} ;


/*!
 *****************************************************************************************
 * \brief
 *    Filters one edge of 4 (luma) or 2 (chroma) pel
 *****************************************************************************************
 */
void EdgeLoop( struct img_par *img, byte* ptrOut, int* ptrIn, Macroblock *MbP, Macroblock *MbQ, int VecDif, int dir, int CbpMaskP, int CbpMaskQ, int widthOut, int widthIn, int luma )
{
  int      StrengthP, StrengthQ ;
  int      alpha, beta  ;

  int      pel, ap, aq;
  int      incIn, incIn2, incIn3, incIn4 ;
  int      incOut, incOut2, incOut3 ;
  int      C0, Cq, Cp, c0, n, delta, strong, dif ;
  int      lastPel = luma ? 4 : 2;


  StrengthQ = ((MbQ->intraOrInter != INTER_MB) || (img->type == SP_IMG_1) || (img->type == SP_IMG_MULT))?
               2: ((MbQ->cbp_blk & CbpMaskQ) != 0)? 1:0 ;
  StrengthP = ((MbP->intraOrInter != INTER_MB) || (img->type == SP_IMG_1) || (img->type == SP_IMG_MULT))?
               2: ((MbP->cbp_blk & CbpMaskP) != 0)? 1:0 ;        // if not INTRA: has this  4x4 block coeffs?

  if( StrengthP || StrengthQ || VecDif )
  {
    alpha   = ALPHA_TABLE[ MbQ->qp ] ;
    beta    = BETA_TABLE [ MbQ->qp ] ;
    Cq      = CLIP_TBL[ StrengthQ ][ MbQ->qp ] ;
    Cp      = CLIP_TBL[ StrengthP ][ MbQ->qp ] ;
    C0      = Cq + Cp ;
    incIn   = dir ?  widthIn : 1 ;                     // vertical filtering increment to next pixel is 1 else width
    incIn2  = incIn<<1 ;
    incIn3  = incIn + incIn2 ;
    incIn4  = incIn<<2 ;
    incOut  = dir ?  widthOut : 1 ;                    // vertical filtering increment to next pixel is 1 else width
    incOut2 = incOut<<1 ;
    incOut3 = incOut + incOut2 ;
    strong  = (MbP != MbQ ) && ((StrengthQ == 2) || (StrengthP == 2)) ; // stronger filtering possible if Macroblock
                                                                                // boundary and one of MB's is Intra
    for( pel=0 ; pel<lastPel ; pel++ )
    {
      delta = abs( ptrIn[0] - ptrIn[-incIn] ) ;
      n     = min( 3, 4-(delta*alpha >> 7) ) ;

      for( aq=1 ; aq<n ; aq++ )
        if( abs(ptrIn[     0] - ptrIn[     aq*incIn]) > beta)
          break ;
      for( ap=1 ; ap<n  ; ap++ )
        if( abs(ptrIn[-incIn] - ptrIn[(-1-ap)*incIn]) > beta)
          break ;

      if( strong & (ap+aq == 6) & (delta < MbQ->qp>>2) & (delta >= 2) )                   // INTRA strong filtering
      {
        ptrOut[ -incOut]   = (25*( ptrIn[-incIn3] +  ptrIn[  incIn]) + 26*( ptrIn[-incIn2] + ptrIn[-incIn ] +  ptrIn[      0 ]) + 64) >> 7 ;
        ptrOut[-incOut2]   = (25*( ptrIn[-incIn4] +  ptrIn[      0]) + 26*( ptrIn[-incIn3] + ptrIn[-incIn2] + ptrOut[ -incOut]) + 64) >> 7 ;
        ptrOut[       0]   = (25*( ptrIn[-incIn2] +  ptrIn[ incIn2]) + 26*( ptrIn[ -incIn] + ptrIn[      0] +  ptrIn[  incIn ]) + 64) >> 7 ;
        ptrOut[  incOut]   = (25*( ptrIn[-incIn ] +  ptrIn[ incIn3]) + 26*(ptrOut[      0] + ptrIn[ incIn ] +  ptrIn[  incIn2]) + 64) >> 7 ;

        if( luma )                                                                  // For luma do two more pixels
        {
          ptrOut[-incOut3] = (25*( ptrIn[-incIn3] + ptrOut[-incOut]) + 26*( ptrIn[-incIn4] + ptrIn[-incIn3] + ptrOut[-incOut2]) + 64) >> 7 ;
          ptrOut[ incOut2] = (25*(ptrOut[      0] +  ptrIn[ incIn2]) + 26*(ptrOut[ incOut] + ptrIn[ incIn2] +  ptrIn[  incIn3]) + 64) >> 7 ;
        }
      }
      else
      {
        if( (ap > 1) && (aq > 1) )                                                             // normal filtering
        {
          c0                 = (C0 + ap + aq) >> 1 ;
          dif                = Clip( -c0,  c0, (((ptrIn[0] - ptrIn[-incIn]) << 2) + (ptrIn[-incIn2] - ptrIn[incIn]) + 4) >> 3 ) ;
          ptrOut[-incOut ]   = Clip(   0, 255, ptrIn[-incIn] + dif ) ;
          ptrOut[      0 ]   = Clip(   0, 255, ptrIn[    0 ] - dif ) ;

          if( ap == 3)
          {
            dif              = Clip( -Cp,  Cp, (ptrIn[-incIn3] + ptrIn[-incIn] - (ptrIn[-incIn2]<<1)) >> 1 ) ;
            ptrOut[-incOut2] = ptrIn[-incIn2] + dif;
          }
          if( aq == 3)
          {
            dif              = Clip( -Cq,  Cq, (ptrIn[ incIn2] + ptrIn[     0] - (ptrIn[  incIn]<<1)) >> 1 ) ;
            ptrOut[  incOut] = ptrIn[  incIn] + dif;
          }
        }
      }

      ptrOut += dir?  1:widthOut ;      // Increment to next set of pixel
      ptrIn  += dir?  1:widthIn  ;
    }
  }
}


/*!
 *****************************************************************************************
 * \brief
 *    returns VecDiff for different Frame types
 *****************************************************************************************
 */
int GetVecDif( struct img_par *img, int dir, int blk_y, int blk_x )
{

  if( (img->type == B_IMG_1)  || (img->type == B_IMG_MULT) )
  {
    if( img->imod != B_Direct )
      return (abs( img->fw_mv[blk_x+4][blk_y][0] - img->fw_mv[blk_x+4-!dir][blk_y-dir][0]) >= 4) |
             (abs( img->fw_mv[blk_x+4][blk_y][1] - img->fw_mv[blk_x+4-!dir][blk_y-dir][1]) >= 4) |
             (abs( img->bw_mv[blk_x+4][blk_y][0] - img->bw_mv[blk_x+4-!dir][blk_y-dir][0]) >= 4) |
             (abs( img->bw_mv[blk_x+4][blk_y][1] - img->bw_mv[blk_x+4-!dir][blk_y-dir][1]) >= 4)  ;
    else
      return (abs( img->dfMV[blk_x+4][blk_y][0] - img->dfMV[blk_x+4-!dir][blk_y- dir][0]) >= 4) |
             (abs( img->dfMV[blk_x+4][blk_y][1] - img->dfMV[blk_x+4-!dir][blk_y- dir][1]) >= 4) |
             (abs( img->dbMV[blk_x+4][blk_y][0] - img->dbMV[blk_x+4-!dir][blk_y- dir][0]) >= 4) |
             (abs( img->dbMV[blk_x+4][blk_y][1] - img->dbMV[blk_x+4-!dir][blk_y- dir][1]) >= 4)  ;
  }
  else
    return (abs( img->mv[blk_x+4][blk_y][0] -   img->mv[blk_x+4-!dir][blk_y- dir][0]) >= 4 ) |
           (abs( img->mv[blk_x+4][blk_y][1] -   img->mv[blk_x+4-!dir][blk_y- dir][1]) >= 4 ) |
           (refFrArr[blk_y][blk_x]   !=  refFrArr[blk_y  - dir][blk_x-!dir]);
}

/*!
 *****************************************************************************************
 * \brief
 *    The main MB-filtering function
 *****************************************************************************************
 */
void DeblockMb(struct img_par *img )
{
  int           ofs_x, ofs_y ;
  int           blk_x, blk_y ;
  int           x, y ;
  int           VecDif ;                                    // TRUE if x or ydifference to neighboring mv is >= 4
  int           dir ;                                                         // horizontal or vertical filtering
  int           CbpMaskQ ;
  Macroblock    *MbP, *MbQ ;                                        // the current (MbQ) and neighboring (MbP) mb
  int           bufferY[20*20],  bufferU[12*12], bufferV[12*12];
  int xFirst =  img->block_x? -4:0;
  int yFirst =  img->block_y? -4:0;



  for( dir=0 ; dir<2 ; dir++ )                                           // vertical edges, than horicontal edges
  {
    for( y = yFirst ; y < 16 ; y++ )                        // Copy the original data to be filtered into buffers
       for( x = xFirst ; x < 16 ; x++ )
          bufferY[20*y+x+84] = imgY[img->pix_y+y][img->pix_x+x];

    for( y = yFirst ; y < 8 ; y++ )
      for( x = xFirst ; x < 8 ; x++ )
      {
        bufferU[12*y+x+52] = imgUV[0][img->pix_c_y+y][img->pix_c_x+x];
        bufferV[12*y+x+52] = imgUV[1][img->pix_c_y+y][img->pix_c_x+x];
      }

    for( ofs_y=(!dir || img->block_y)? 0:1 ; ofs_y<4 ; ofs_y++ )             // go  vertically through 4x4 blocks
      for( ofs_x=( dir || img->block_x)? 0:1 ; ofs_x<4 ; ofs_x++ )          // go horicontally through 4x4 blocks
      {
        blk_y    = img->block_y + ofs_y ;                                                 // absolute 4x4 address
        blk_x    = img->block_x + ofs_x ;
        MbQ      = MbP = &img->mb_data[ img->current_mb_nr ] ;                                      // current Mb
        MbP     -= ( !ofs_x && !dir)? 1 : ((!ofs_y && dir)? (img->width>>4) : 0) ;              // neighboring Mb
        VecDif   = GetVecDif( img, dir, blk_y, blk_x ) ;                 // Get Vecdiff for different frame types
        CbpMaskQ = (ofs_y<<2) + ofs_x ;
        EdgeLoop( img, imgY[blk_y<<2] + (blk_x<<2), bufferY + ((20*ofs_y+ofs_x)<<2) + 84, MbP, MbQ, VecDif, dir, 1<<MASK_L[dir][CbpMaskQ], 1<<CbpMaskQ, img->width, 20, 1 ) ;

        if( (!dir && !(ofs_x & 1)) || (dir && !(ofs_y & 1)) )                      // do the same for chrominance
          {
          CbpMaskQ = (ofs_y & 0xfe) + (ofs_x>>1) ;

          EdgeLoop( img, imgUV[0][blk_y<<1] + ((blk_x)<<1), bufferU + ((12*ofs_y+ofs_x)<<1) + 52, MbP, MbQ, VecDif, dir, 0x010000<<MASK_C[dir][CbpMaskQ], 0x010000<<CbpMaskQ, img->width_cr, 12, 0 ) ;
          EdgeLoop( img, imgUV[1][blk_y<<1] + ((blk_x)<<1), bufferV + ((12*ofs_y+ofs_x)<<1) + 52, MbP, MbQ, VecDif, dir, 0x100000<<MASK_C[dir][CbpMaskQ], 0x100000<<CbpMaskQ, img->width_cr, 12, 0 ) ;
          }
      }
  }
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久久综合狠狠综合| 91麻豆产精品久久久久久| 久久久久久黄色| 色偷偷88欧美精品久久久| 日韩精品一区第一页| 国产日韩欧美综合一区| 欧美日韩在线电影| 精品一区二区三区视频在线观看| 亚洲精品综合在线| xfplay精品久久| 欧美日韩性生活| 成人av网站免费观看| 热久久免费视频| 国产精品一二三四区| 欧美大度的电影原声| 成人av在线电影| 国产麻豆一精品一av一免费| 亚洲国产精品久久艾草纯爱| 中文乱码免费一区二区| 精品国产网站在线观看| 欧美另类一区二区三区| 99国产欧美久久久精品| 国产成人a级片| 麻豆精品在线看| 日韩国产精品久久久| 一区二区三区在线免费观看| 久久久亚洲午夜电影| 精品国产免费视频| 日韩一区二区三区在线观看| 91视频免费观看| av电影在线不卡| 成人av网址在线| 不卡一区中文字幕| 国产精品一区二区在线看| 精品一区二区三区在线播放视频| 日本中文字幕一区| 日韩国产欧美视频| 日韩二区在线观看| 午夜日韩在线电影| 亚州成人在线电影| 亚洲成人www| 五月综合激情婷婷六月色窝| 午夜视黄欧洲亚洲| 日韩成人免费看| 男女性色大片免费观看一区二区| 日韩经典中文字幕一区| 日日夜夜精品视频免费| 日韩极品在线观看| 久久99国产精品久久99果冻传媒| 秋霞电影一区二区| 老司机免费视频一区二区| 久久激五月天综合精品| 国产一区二区三区观看| 国产一区二区三区高清播放| 国产成人av一区二区| 成人精品国产一区二区4080| 成人aaaa免费全部观看| 一本久久a久久精品亚洲| 91福利视频网站| 欧美日韩极品在线观看一区| 欧美高清精品3d| 日韩视频不卡中文| 久久婷婷色综合| 国产精品天美传媒沈樵| 亚洲欧美另类在线| 一区二区三区在线看| 午夜精品久久久久久久久久久| 天天综合日日夜夜精品| 麻豆国产欧美日韩综合精品二区| 久久国产精品99久久久久久老狼| 久久电影国产免费久久电影| 国产最新精品免费| 福利电影一区二区三区| 在线观看一区日韩| 欧美大度的电影原声| 国产精品天美传媒沈樵| 亚洲宅男天堂在线观看无病毒| 三级久久三级久久| 国产成人综合亚洲网站| 成人精品gif动图一区| 欧美精品色综合| 久久网站最新地址| 夜夜精品浪潮av一区二区三区| 国产精品久久久久久亚洲伦| 亚洲成人福利片| 91精彩视频在线| 日本精品一区二区三区四区的功能| 欧美午夜在线一二页| 国产在线观看免费一区| 男女男精品视频网| 懂色av一区二区三区蜜臀| 99r精品视频| 久久天堂av综合合色蜜桃网| 欧美美女网站色| 欧美激情在线观看视频免费| 18涩涩午夜精品.www| 伦理电影国产精品| 亚洲成人av福利| 欧美日韩激情一区二区| 国产91精品露脸国语对白| 欧美专区在线观看一区| 丝袜亚洲另类欧美综合| 欧美性色黄大片手机版| 亚洲电影中文字幕在线观看| 亚洲毛片av在线| 亚洲一区二区av在线| 成人综合婷婷国产精品久久| 亚洲男同1069视频| 一区二区理论电影在线观看| 亚洲超碰精品一区二区| 日本不卡一区二区| 欧美在线观看视频一区二区三区| 色狠狠一区二区| 日韩欧美国产三级电影视频| av激情亚洲男人天堂| 91精品国产91久久综合桃花| 国产精品一区在线| 蜜桃av一区二区三区电影| 久久亚洲免费视频| 一区二区三区视频在线观看| 免费成人结看片| 欧美群妇大交群的观看方式| 国产亚洲一二三区| 人人超碰91尤物精品国产| 91久久精品国产91性色tv| 91在线国产观看| 欧美高清hd18日本| 亚洲二区在线观看| 久久久久国产成人精品亚洲午夜| 亚洲精品一区二区三区99| 懂色av中文一区二区三区| 欧美一区二区三区在线观看视频| 91精品麻豆日日躁夜夜躁| 2024国产精品视频| 日韩午夜在线影院| 亚洲第一二三四区| 99久久久久免费精品国产| 欧美日韩中文字幕一区二区| 中文字幕在线观看不卡视频| 国产精品久久久久久久久图文区 | 一区二区三区国产精品| 久久一夜天堂av一区二区三区 | 91在线看国产| 一区二区三区四区在线免费观看| 精品99一区二区三区| 国产福利一区二区| 五月婷婷激情综合网| 亚洲欧洲av一区二区三区久久| 日韩精品亚洲专区| 一区二区三区精品视频| 在线电影欧美成精品| 精品在线观看免费| 国产乱人伦偷精品视频不卡 | 国产精品传媒在线| 国产自产高清不卡| 欧美三级乱人伦电影| 久久先锋影音av| 国产精品亚洲视频| 激情另类小说区图片区视频区| 91农村精品一区二区在线| 粉嫩aⅴ一区二区三区四区五区| 国产成人精品一区二| 国产亚洲一区二区三区四区| 黄页视频在线91| 亚洲国产日韩a在线播放性色| 成人av小说网| 日韩视频一区二区三区在线播放 | 国模套图日韩精品一区二区| 欧美日韩久久不卡| 久久精品国产亚洲aⅴ| 久久影音资源网| 老司机精品视频一区二区三区| 欧美xxxxxxxx| 日本成人中文字幕在线视频 | 成人午夜在线免费| 精品1区2区在线观看| 韩国一区二区三区| 久久综合丝袜日本网| 久久不见久久见免费视频1 | 亚洲欧美一区二区三区国产精品 | 色综合天天综合色综合av | 激情图片小说一区| 欧美精品一区二区久久久| 亚洲欧洲99久久| 在线免费观看日韩欧美| 亚洲欧美一区二区久久| 国产99精品国产| 日日骚欧美日韩| 欧美人狂配大交3d怪物一区 | 欧美v日韩v国产v| 激情五月婷婷综合网| 国产精品午夜在线| 麻豆成人av在线| 一区二区高清免费观看影视大全| 欧洲另类一二三四区| 日韩国产欧美三级| av不卡免费电影| 国产农村妇女精品| 波多野洁衣一区| 日韩成人dvd|