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

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

?? uvlc.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 uvlc.c
 *
 * \brief
 *    UVLC support functions
 *
 * \author
 *    Main contributors (see contributors.h for copyright, address and affiliation details)
 *    - Inge Lille-Lang鴜                <inge.lille-langoy@telenor.com>
 *    - Detlev Marpe                     <marpe@hhi.de>
 *    - Gabi Blaettermann             <blaetter@hhi.de>
 ************************************************************************
 */
#include "contributors.h"

#include <math.h>
#include <memory.h>
#include <string.h>

#include "global.h"
#include "uvlc.h"
#include "elements.h"
#include "bitsbuf.h"
#include "header.h"


// A little trick to avoid those horrible #if TRACE all over the source code
#if TRACE
#define SYMTRACESTRING(s) strncpy(sym.tracestring,s,TRACESTRING_SIZE)
#else
#define SYMTRACESTRING(s) // do nothing
#endif

extern void tracebits(const char *trace_str,  int len,  int info,int value1,
    int value2) ;

/*!
 ************************************************************************
 * \brief
 *    linfo
 * \par Input:
 *    lenght and info
 * \par Output:
 *    number in the code table
 ************************************************************************
 */
void linfo(int len, int info, int *value1, int *dummy)
{
  *value1 = (int)pow(2,(len/2))+info-1; // *value1 = (int)(2<<(len>>1))+info-1;
}

/*!
 ************************************************************************
 * \par Input:
 *    lenght and info
 * \par Output:
 *    signed mvd
 ************************************************************************
 */
void linfo_mvd(int len, int info, int *signed_mvd, int *dummy)
{
  int n;
  n = (int)pow(2,(len/2))+info-1;
  *signed_mvd = (n+1)/2;
  if((n & 0x01)==0)                           // lsb is signed bit
    *signed_mvd = -*signed_mvd;
}

/*!
 ************************************************************************
 * \par Input:
 *    lenght and info
 * \par Output:
 *    cbp (intra)
 ************************************************************************
 */
void linfo_cbp_intra(int len,int info,int *cbp, int *dummy)
{
  extern const byte NCBP[48][2];
    int cbp_idx;
  linfo(len,info,&cbp_idx,dummy);
    *cbp=NCBP[cbp_idx][0];
}

/*!
 ************************************************************************
 * \par Input:
 *    lenght and info
 * \par Output:
 *    cbp (inter)
 ************************************************************************
 */
void linfo_cbp_inter(int len,int info,int *cbp, int *dummy)
{
  extern const byte NCBP[48][2];
  int cbp_idx;
  linfo(len,info,&cbp_idx,dummy);
    *cbp=NCBP[cbp_idx][1];
}

/*!
 ************************************************************************
 * \par Input:
 *    lenght and info
 * \par Output:
 *    signed mvd
 ************************************************************************
 */
void linfo_dquant(int len,  int info, int *signed_dquant, int *dummy)
{
  int n;
  n = (int)pow(2,(len/2))+info-1;
  *signed_dquant = (n+1)/2;
  if((n & 0x01)==0)                           // lsb is signed bit
    *signed_dquant = -*signed_dquant;
}

/*!
 ************************************************************************
 * \par Input:
 *    lenght and info
 * \par Output:
 *    level, run
 ************************************************************************
 */
void linfo_levrun_inter(int len, int info, int *level, int *irun)
{
  int l2;
  int inf;
  if (len<=9)
  {
    l2=mmax(0,len/2-1);
    inf=info/2;
    *level=NTAB1[l2][inf][0];
    *irun=NTAB1[l2][inf][1];
    if ((info&0x01)==1)
      *level=-*level;                   // make sign
  }
  else                                  // if len > 9, skip using the array
  {
    *irun=(info&0x1e)>>1;
    *level = LEVRUN1[*irun] + info/32 + (int)pow(2,len/2 - 5);
    if ((info&0x01)==1)
      *level=-*level;
  }
    if (len == 1) // EOB
        *level = 0;
}

/*!
 ************************************************************************
 * \par Input:
 *    lenght and info
 * \par Output:
 *    level, run
 ************************************************************************
 */
void linfo_levrun_intra(int len, int info, int *level,  int *irun)
{
  int l2;
  int inf;

  if (len<=9)
  {
    l2=mmax(0,len/2-1);
    inf=info/2;
    *level=NTAB2[l2][inf][0];
    *irun=NTAB2[l2][inf][1];
    if ((info&0x01)==1)
      *level=-*level;                 // make sign
  }
  else                                  // if len > 9, skip using the array
  {
    *irun=(info&0x0e)>>1;
    *level = LEVRUN2[*irun] + info/16 + (int)pow(2,len/2-4) -1;
    if ((info&0x01)==1)
      *level=-*level;
  }
    if (len == 1) // EOB
        *level = 0;
}


/*!
 ************************************************************************
 * \par Input:
 *    lenght and info
 * \par Output:
 *    level, run
 ************************************************************************
 */
void linfo_levrun_c2x2(int len, int info, int *level, int *irun)
{
  int l2;
  int inf;

  if (len<=5)
  {
    l2=mmax(0,len/2-1);
    inf=info/2;
    *level=NTAB3[l2][inf][0];
    *irun=NTAB3[l2][inf][1];
    if ((info&0x01)==1)
      *level=-*level;                 // make sign
  }
  else                                  // if len > 5, skip using the array
  {
    *irun=(info&0x06)>>1;
    *level = LEVRUN3[*irun] + info/8 + (int)pow(2,len/2 - 3);
    if ((info&0x01)==1)
      *level=-*level;
  }
  if (len == 1) // EOB
    *level = 0;
}


/*!
 ************************************************************************
 * \brief
 *    readSliceUVLC
 *
 * \par
 *    Slice Headers can start on every byte aligned position, provided zero-stuffing.
 *    This is implemented here in such a way that a slice header can be trailed by
 *    any number of 0 bits.
 *
 * \return
 *    readSliceUVLC returns -1 in case of problems, or oen of SOP, SOS, EOS in case of success
 ************************************************************************
 */
int readSliceUVLC(struct img_par *img, struct inp_par *inp)
{
  Slice *currSlice = img->currentSlice;
  DataPartition *dP;
  Bitstream *currStream = currSlice->partArr[0].bitstream;
  int *partMap = assignSE2partition[currSlice->dp_mode];
  int frame_bitoffset = currStream->frame_bitoffset = 0;
  SyntaxElement sym;
  int dummy;
  byte *buf = currStream->streamBuffer;

  int len, info;
  int newframe = 0;   //WYK: Oct. 8, 2001, change the method to find a new frame

  memset (buf, 0xff, MAX_CODED_FRAME_SIZE);   // this prevents a buffer full with zeros
  currStream->bitstream_length = GetOneSliceIntoSourceBitBuffer(img, inp, buf);
  if (currStream->bitstream_length > 4)  // More than just a start code
  {
    sym.type = SE_HEADER;
#if TRACE
    strncpy(sym.tracestring, "\nHeaderinfo", TRACESTRING_SIZE);
#endif
    if(img->type == B_IMG_1 || img->type == B_IMG_MULT)
      dP = &(currSlice->partArr[partMap[SE_BFRAME]]);
    else
      dP = &(currSlice->partArr[partMap[sym.type]]);
    len =  GetVLCSymbol (buf, frame_bitoffset, &info, currStream->bitstream_length);
#if TRACE
    tracebits("Startcode", len, info, 0, 0);
#endif

    currStream->frame_bitoffset +=len;

    // read the slice header
    dummy = SliceHeader(img,inp);

    //WYK: Oct. 8, 2001, change the method to find a new frame
    if(img->tr != img->tr_old)
      newframe = 1;
    else 
      newframe = 0;
    img->tr_old = img->tr;
    
    // if the TR of current slice is not identical to the TR  of previous received slice, we have a new frame
    if(newframe)
      return SOP;
    else
      return SOS;

  }
  else    // less than four bytes in file -> cannot be a slice
    return EOS;
  return 0;
}


/*!
 ************************************************************************
 * \brief
 *    read next UVLC codeword from UVLC-partition and
 *    map it to the corresponding syntax element
 ************************************************************************
 */
int readSyntaxElement_UVLC(SyntaxElement *sym, struct img_par *img, struct inp_par *inp, struct datapartition *dP)
{
  Bitstream   *currStream = dP->bitstream;
  int frame_bitoffset = currStream->frame_bitoffset;
  byte *buf = currStream->streamBuffer;
  int BitstreamLengthInBytes = currStream->bitstream_length;

  sym->len =  GetVLCSymbol (buf, frame_bitoffset, &(sym->inf), BitstreamLengthInBytes);
  if (sym->len == -1)
    return -1;
  currStream->frame_bitoffset += sym->len;
  sym->mapping(sym->len,sym->inf,&(sym->value1),&(sym->value2));

#if TRACE
  tracebits(sym->tracestring, sym->len, sym->inf, sym->value1, sym->value2);
#endif

  return 1;
}

/*!
 ************************************************************************
 * \brief
 *    Check if there are symbols for the next MB
 ************************************************************************
 */
int uvlc_startcode_follows(struct img_par *img, struct inp_par *inp)
{
  Slice *currSlice = img->currentSlice;
  int dp_Nr = assignSE2partition[currSlice->dp_mode][SE_MBTYPE];
  DataPartition *dP = &(currSlice->partArr[dp_Nr]);
  Bitstream   *currStream = dP->bitstream;
  byte *buf = currStream->streamBuffer;
  int frame_bitoffset = currStream->frame_bitoffset;
  int info;

  if (-1 == GetVLCSymbol (buf, frame_bitoffset, &info, currStream->bitstream_length))
    return TRUE;
  else
    return FALSE;
}


/*!
 ************************************************************************
 * \brief
 *  Moves the read pointer of the partition forward by one symbol
 *
 * \param byte buffer[]
 *    containing VLC-coded data bits
 * \param int totbitoffset
 *    bit offset from start of partition
 * \param int type
 *    expected data type (Partiotion ID)
 * \return  int info, len
 *    Length and Value of the next symbol
 *
 * \note
 *    As in both nal_bits.c and nal_part.c all data of one partition, slice,
 *    picture was already read into a buffer, there is no need to read any data
 *    here again.
 * \par
 *    GetVLCInfo was extracted because there should be only one place in the
 *    source code that has knowledge about symbol extraction, regardless of
 *    the number of different NALs.
 * \par
 *    This function could (and should) be optimized considerably
 * \par
 *    If it is ever decided to have different VLC tables for different symbol
 *    types, then this would be the place for the implementation
 ************************************************************************
 */
int GetVLCSymbol (byte buffer[],int totbitoffset,int *info, int bytecount)
{

  register int inf;
  long byteoffset;      // byte from start of buffer
  int bitoffset;      // bit from start of byte
  int ctr_bit=0;      // control bit for current bit posision
  int bitcounter=1;

  byteoffset= totbitoffset/8;
  bitoffset= 7-(totbitoffset%8);
  ctr_bit = (buffer[byteoffset] & (0x01<<bitoffset));   // set up control bit

  inf=0;                          // shortest possible code is 1, then info is always 0

  while (ctr_bit==0)
  {                 // repeate until next 0, ref. VLC
    bitoffset-=2;           // from MSB to LSB
    if (bitoffset<0)
    {                 // finish with current byte ?
      bitoffset=bitoffset+8;
      byteoffset++;
    }

    ctr_bit=buffer[byteoffset] & (0x01<<(bitoffset));

    // make infoword

    if(bitoffset>=7)                  // first bit in new byte
      if (buffer[byteoffset-1] & (0x01))        // check last (info)bit of last byte
        inf = ((inf << 1) | 0x01);          // multiply with 2 and add 1, ref VLC
      else
        inf = (inf << 1);             // multiply with 2

    else
      if (buffer[byteoffset] & (0x01<<(bitoffset+1))) // check infobit
        inf = ((inf << 1) | 0x01);
      else
        inf = (inf << 1);
    bitcounter+=2;
    if (byteoffset > bytecount)
    {
      return -1;
    }
  }
  *info = inf;
  return bitcounter;           // return absolute offset in bit from start of frame
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
91精品福利在线| 在线观看日韩电影| 欧美丝袜丝nylons| 在线观看亚洲专区| 偷窥少妇高潮呻吟av久久免费| 国产欧美日韩另类一区| 这里只有精品视频在线观看| 精品一区二区久久久| 国产欧美精品区一区二区三区 | 成人精品在线视频观看| 欧美亚洲免费在线一区| 香蕉久久夜色精品国产使用方法| 91在线视频免费观看| 国产精品视频观看| 麻豆精品视频在线观看视频| 在线一区二区观看| 洋洋av久久久久久久一区| 91丨九色丨黑人外教| 亚洲女子a中天字幕| 国产a视频精品免费观看| 国产亚洲1区2区3区| 26uuu久久天堂性欧美| 欧美一二三区在线| 日本网站在线观看一区二区三区| 色综合婷婷久久| 欧美日韩免费在线视频| 午夜不卡在线视频| 欧美高清激情brazzers| 91精品国产色综合久久不卡电影| 亚洲激情图片qvod| 色国产综合视频| 国产老妇另类xxxxx| 蜜臀av国产精品久久久久| 性做久久久久久免费观看欧美| 日韩理论片网站| 一区二区三区欧美日| 亚洲一区二区3| 综合久久综合久久| 欧美一区2区视频在线观看| 欧美军同video69gay| 56国语精品自产拍在线观看| 日韩欧美一区二区三区在线| 精品久久久久久久久久久院品网 | 国产成人午夜99999| 一区二区三区在线观看动漫| 日韩精品视频网| 一区二区三区在线观看网站| 91高清视频免费看| 亚洲色图制服丝袜| 欧洲av一区二区嗯嗯嗯啊| 亚洲综合网站在线观看| 欧美浪妇xxxx高跟鞋交| 日韩电影在线一区| 亚洲激情欧美激情| 国产欧美一区二区在线| 国产女同性恋一区二区| 国产亚洲欧美日韩日本| 国产精品久久午夜夜伦鲁鲁| 精品久久久久久久久久久久久久久久久 | 在线免费观看一区| 欧美特级限制片免费在线观看| 欧美日本韩国一区二区三区视频 | 国产乱淫av一区二区三区| 国产在线播放一区| 不卡一二三区首页| 在线一区二区三区四区| ●精品国产综合乱码久久久久| 欧美变态口味重另类| 成人av电影在线| 精品在线你懂的| 亚洲欧美另类久久久精品2019| 欧美日韩精品一区视频| 91视频一区二区三区| 久久se这里有精品| 国产mv日韩mv欧美| 免费看欧美美女黄的网站| 国产精品久久夜| 日本一区二区三区dvd视频在线| 国产精品素人视频| 国产精品网站在线播放| 亚洲欧洲国产日韩| 国产精品网站在线播放| 国产午夜精品一区二区| 亚洲欧美日韩国产一区二区三区 | 久久成人精品无人区| 粉嫩嫩av羞羞动漫久久久| 99国产一区二区三精品乱码| 7777精品伊人久久久大香线蕉超级流畅| 8x8x8国产精品| ●精品国产综合乱码久久久久 | 欧美一区日韩一区| 久久久久久久一区| 久久99精品久久只有精品| 欧美无人高清视频在线观看| 国产精品电影院| 国产麻豆精品在线| 久久综合久久鬼色| 亚洲小说春色综合另类电影| 色综合久久六月婷婷中文字幕| 国产日韩欧美在线一区| 奇米影视7777精品一区二区| 欧美日韩一区在线| 亚洲国产人成综合网站| 精品视频全国免费看| 亚洲激情图片qvod| 欧美精选一区二区| 奇米色777欧美一区二区| 欧美一级黄色录像| 久久不见久久见免费视频1| 久久综合九色综合久久久精品综合| 免费人成黄页网站在线一区二区 | 91免费在线播放| 亚洲网友自拍偷拍| 在线看日韩精品电影| 亚洲妇女屁股眼交7| 777奇米四色成人影色区| 日韩不卡一区二区三区| 精品少妇一区二区三区日产乱码 | 91久久线看在观草草青青 | 国产午夜久久久久| 一本色道久久综合狠狠躁的推荐| 亚洲午夜久久久久久久久电影院| 欧美日韩成人在线| 国产精品夜夜爽| 午夜精品一区二区三区免费视频| 欧美xxxxx牲另类人与| av电影在线观看不卡| 日日欢夜夜爽一区| 亚洲手机成人高清视频| 欧美一卡二卡在线| 91在线观看成人| 国产成人在线视频播放| 五月天欧美精品| 亚洲日本va在线观看| 久久一区二区视频| 日韩一区二区电影网| 色天天综合色天天久久| 国产成人精品一区二区三区四区 | 国产成人在线电影| 日韩在线一区二区三区| 亚洲激情自拍视频| 国产精品三级视频| 日韩精品一区二区三区中文不卡 | 久久精品一区四区| 欧美日韩国产影片| 午夜精品一区二区三区免费视频| 国产91对白在线观看九色| 国内欧美视频一区二区 | 91在线看国产| 一区二区三区国产| 色94色欧美sute亚洲线路一久 | 久久免费视频色| 成人av电影在线| 大陆成人av片| 91色乱码一区二区三区| 国产91精品一区二区麻豆网站| 看电影不卡的网站| 蜜乳av一区二区| 国产在线播放一区二区三区| 国产精品一二三四五| 不卡av免费在线观看| 不卡av在线免费观看| 欧美性受极品xxxx喷水| 91精品国产91综合久久蜜臀| 欧美大胆一级视频| 国产精品美女一区二区| 亚洲综合免费观看高清完整版在线| 亚洲一二三四区不卡| 激情欧美一区二区三区在线观看| 韩国成人在线视频| 色婷婷av一区二区三区gif| 91精品国产91久久久久久一区二区| 日韩一卡二卡三卡| 国产精品三级电影| 亚洲国产精品天堂| 国产呦精品一区二区三区网站| 成人网男人的天堂| 欧美午夜宅男影院| 国产欧美一区二区精品忘忧草| 亚洲chinese男男1069| 成人免费黄色在线| 精品成人私密视频| 亚洲国产精品一区二区久久| jizzjizzjizz欧美| 精品久久久久久亚洲综合网 | 欧美性xxxxxxxx| 国产嫩草影院久久久久| 热久久国产精品| 欧美色图片你懂的| 成人欧美一区二区三区| 成人在线一区二区三区| 欧美精品一区二区三区很污很色的| 亚洲三级在线免费观看| 成人动漫在线一区| 国产欧美中文在线| 成人精品免费视频| 欧美激情一区二区三区在线| 国产九九视频一区二区三区| 26uuu久久综合| 风间由美性色一区二区三区|