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

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

?? bitsbuf.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 bitsbuf.c
 *
 * \brief
 *    Bit Stream Buffer Management
 *
 *  This module is introduced to facilitate the handling of the bit stream
 *  reading.  It assumes a start code taht is a UVLC code word with len 31
 *  and info 0 for Picture Start code, and info = 1 for Slice start code.
 *  The module should be used for all entropy coding schemes, including UVLC
 *  and CABAC.
 *
 * \author
 *    Stephan Wenger   stewe@cs,tu-berlin.de
 *************************************************************************************
 */

#include <stdlib.h>
#include <assert.h>

#include "global.h"
#include "bitsbuf.h"

static int SourceBitBufferPtr;    //!< the position for the next byte-write into the bit buffer
FILE *bits;                //!< the bit stream file


/*!
 ************************************************************************
 * \brief
 *    return the byte position of the bitstream file
 ************************************************************************
 */
int getBitsPos()
{
  return ftell(bits);
}
/*!
 ************************************************************************
 * \brief
 *    set the position of the bitsream file
 ************************************************************************
 */
int setBitsPos(int offset)
{
printf ("in setBitsPos (%d)\n", offset);
  return fseek(bits, offset, SEEK_SET);
}


/*!
 ************************************************************************
 * \brief
 *    Initializes the Source Bit Buffer
 ************************************************************************
 */
void InitializeSourceBitBuffer()
{
  SourceBitBufferPtr = 0;
}


/*!
 ************************************************************************
 * \brief
 *    returns the type of the start code at byte aligned position buf.
 *
 *  \return
 *     the info field of a start code (len == 31) or                      \n
 *     -1, indicating that there is no start code here
 *
 *  This function could be optimized considerably by checking for zero bytes first,
 *  but the current implementation gives us more freedom to define what a
 *  start code actually is
 *  Note that this function could be easily extended to search for non
 *  byte aligned start codes, by simply checking all 8 bit positions
 *  (and not only the zero position
 ************************************************************************
 */
static int TypeOfStartCode (byte *Buf)
{
  int info;

  // A bit of optimization first: a start code starts always with 3 zero bytes
  if ((Buf[0] != 0) || (Buf[1] != 0) || (Buf[2] != 0))
    return -1;

  if (31 != GetVLCSymbol (Buf, 0, &info, MAX_CODED_FRAME_SIZE))
  {
    return -1;
  }
  if (info != 0 && info != 1)   // the only two start codes currently allowed
    return -1;
  return info;
}

/*!
 ************************************************************************
 * \brief
 *    Returns the number of bytes in copied into the buffer
 *    The buffer includes the own start code, but excludes the
 *    next slice's start code
 * \return
 *     0 if there is nothing any more to read (EOF)                         \n
 *    -1 in case of any error
 *
 * \note
 *   GetOneSliceIntoSourceBitBuffer() expects start codes as follows:       \n
 *   Slice start code: UVLC, len == 31, info == 1                           \n
 *   Picture Start code: UVLC, len == 31, info == 0                         \n
 * \note
 *   getOneSliceIntoSourceBitBuffer expects Slice and Picture start codes
 *   at byte aligned positions in the file
 *
 ************************************************************************
 */
int GetOneSliceIntoSourceBitBuffer(struct img_par *img, struct inp_par *inp, byte *Buf)
{
  int info, pos;
  int StartCodeFound;
  Slice *currSlice = img->currentSlice;

  InitializeSourceBitBuffer(); // WYK: Useless, can be erased. Why use this?
  // read the first 32 bits (which MUST contain a start code, or eof)
  if (4 != fread (Buf, 1, 4, bits))
  {
    return 0;
  }
  info = TypeOfStartCode (Buf);
  if (info < 0)
  {
    printf ("GetOneSliceIntoSourceBitBuffer: no Start Code at the begin of the slice, return -1\n");
    return -1;
  }
  if (info != 0 && info != 1)
  {
    printf ("GetOneSliceIntoSourceBitBuffer: found start code with invalid info %d, return -1\n", info);
    return -1;
  }
  pos = 4;
  StartCodeFound = 0;

  while (!StartCodeFound)
  {
    if (feof (bits))
    // WYK: Oct. 8, 2001. for detection of frame and slice loss.
    {
      currSlice->next_header = EOS;
      return pos-1; // modified to "pos-1" instead of "pos" 
    }
    Buf[pos++] = fgetc (bits);

    info = TypeOfStartCode(&Buf[pos-4]);
    StartCodeFound = (info == 0 || info == 1);
  }

  // Here, we have found another start code (and read four bytes more than we should
  // have.  Hence, go back in the file

  if (0 != fseek (bits, -4, SEEK_CUR))
  {
    snprintf (errortext, ET_SIZE, "GetOneSliceIntoSourceBitBuffer: Cannot fseek -4 in the bit stream file");
    error(errortext, 600);
  }

  return (pos-4);
}




/*!
 ************************************************************************
 * \brief
 *    Attempts to open the bit stream file named fn
 * \return
 *    0 on success,                                                    \n
 *    -1 in case of error
 ************************************************************************
 */
int OpenBitstreamFile (char *fn)
{
  if (NULL == (bits=fopen(fn, "rb")))
    return -1;
  return 0;
}


/*!
 ************************************************************************
 * \brief
 *    Closes the bit stream file
 ************************************************************************
 */
void CloseBitstreamFile()
{
  fclose (bits);
}

/*!
 ************************************************************************
 * \brief
 *    read bytes from input
 * \return
 *    Number of bytes read from partition
 ************************************************************************
 */
int GetOnePartitionIntoSourceBitBuffer(int PartitionSize, byte *Buf)
{
  int pos;
  InitializeSourceBitBuffer();
  for (pos=0; pos<PartitionSize; pos++)
  {
    if (feof (bits))
      return pos;
    Buf[pos] = fgetc (bits);
  }
  return pos;
}


?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
91日韩精品一区| 国产精品动漫网站| 日韩一级高清毛片| 欧美区一区二区三区| 欧美日韩激情在线| 欧美日韩国产片| 欧美日韩精品一区视频| 欧美日韩不卡一区二区| 欧美日韩高清一区二区| 91精品婷婷国产综合久久 | 欧美人狂配大交3d怪物一区 | 亚洲欧洲成人精品av97| 国产精品久久久久久久久动漫| 欧美国产激情一区二区三区蜜月 | 国产在线精品一区二区夜色 | 韩国三级电影一区二区| 国产一区不卡视频| 丰满放荡岳乱妇91ww| 99re这里只有精品6| 欧美少妇性性性| 欧美一区二区啪啪| 久久精品男人的天堂| 国产精品乱码一区二区三区软件 | 中文字幕免费不卡在线| 中文字幕一区二区三区av| 亚洲激情av在线| 视频一区免费在线观看| 久草精品在线观看| 成人黄色国产精品网站大全在线免费观看| 99国产精品久久久久久久久久久| 欧美日韩一区二区在线观看 | 亚洲日本中文字幕区| 亚洲综合精品久久| 精品一区二区三区日韩| 93久久精品日日躁夜夜躁欧美| 欧美性淫爽ww久久久久无| 日韩欧美国产电影| 中文字幕亚洲在| 秋霞午夜鲁丝一区二区老狼| 国产a区久久久| 欧美午夜不卡视频| 久久夜色精品国产噜噜av| ...av二区三区久久精品| 午夜婷婷国产麻豆精品| 国产不卡视频一区二区三区| 欧美午夜精品免费| 国产亚洲一区二区三区在线观看 | 国产成人亚洲综合a∨婷婷| 在线免费观看视频一区| 久久亚洲二区三区| 亚洲一区精品在线| 国产一区久久久| 在线观看免费亚洲| 国产视频一区不卡| 亚洲h动漫在线| 成人h动漫精品一区二| 日韩欧美精品在线视频| 亚洲一二三四区不卡| 国产成人av影院| 91精品婷婷国产综合久久性色 | 偷拍日韩校园综合在线| 成人免费高清在线| 欧美电视剧在线观看完整版| 亚洲免费观看在线观看| 国产真实乱对白精彩久久| 欧美日韩一区二区三区视频| 亚洲国产精品传媒在线观看| 免费在线观看日韩欧美| 欧洲一区二区三区在线| 国产精品日产欧美久久久久| 精品在线一区二区三区| 欧美中文字幕一二三区视频| 国产色婷婷亚洲99精品小说| 蜜桃视频免费观看一区| 欧美在线免费视屏| 综合激情成人伊人| 国产白丝网站精品污在线入口| 欧美成人在线直播| 亚洲电影一区二区三区| 色综合激情五月| 国产精品成人免费在线| 国产成人精品影视| 欧美xxxxxxxx| 免费不卡在线观看| 在线播放亚洲一区| 亚洲成人午夜影院| 欧美在线观看一区| 一区二区在线观看免费| 99riav一区二区三区| 国产精品女同一区二区三区| 国产不卡视频在线观看| 国产午夜精品久久| 极品少妇一区二区三区精品视频 | 欧美一级高清片在线观看| 亚洲国产一区视频| 欧美主播一区二区三区美女| 又紧又大又爽精品一区二区| 97aⅴ精品视频一二三区| 国产精品色在线观看| 成人国产精品免费观看动漫| 国产亚洲一区二区三区| 国产成人一区二区精品非洲| 国产日韩欧美制服另类| 风间由美性色一区二区三区| 国产欧美一区二区精品久导航| 国产精品自产自拍| 精品粉嫩aⅴ一区二区三区四区| 久久国产视频网| 欧美变态口味重另类| 激情综合网天天干| 久久久不卡网国产精品一区| 国产成人aaa| 国产精品视频九色porn| 色综合天天综合在线视频| 亚洲精品高清在线| 欧美日韩在线播放三区| 麻豆高清免费国产一区| 欧美精品一区二区蜜臀亚洲| 粉嫩在线一区二区三区视频| 亚洲视频在线观看一区| 精品视频在线视频| 免费在线观看成人| 国产色爱av资源综合区| 99国产一区二区三精品乱码| 亚洲一区二区三区自拍| 91精品国产91久久综合桃花| 韩国v欧美v亚洲v日本v| 国产精品理论片| 在线视频你懂得一区二区三区| 日韩av一级电影| 久久精品欧美日韩| 日本高清不卡视频| 日产国产欧美视频一区精品| 久久精品亚洲乱码伦伦中文| 色婷婷综合久久久中文字幕| 视频一区中文字幕国产| 国产三级精品在线| 91豆麻精品91久久久久久| 日本美女一区二区三区| 欧美韩日一区二区三区四区| 97久久久精品综合88久久| 日韩在线播放一区二区| 26uuuu精品一区二区| 91美女片黄在线观看| 日本女优在线视频一区二区| 中文字幕电影一区| 欧美日韩精品一二三区| 国产电影精品久久禁18| 亚洲国产你懂的| 欧美韩国一区二区| 欧美肥妇毛茸茸| 韩国三级中文字幕hd久久精品| 亚洲美腿欧美偷拍| 26uuu另类欧美| 欧美色中文字幕| 久久国产麻豆精品| 亚洲精品v日韩精品| 久久久夜色精品亚洲| 欧美日韩精品一区二区三区四区| 国产69精品久久777的优势| 天天综合天天做天天综合| 国产精品无遮挡| 日韩欧美激情四射| 欧美在线观看一区| 成人性视频网站| 久久成人羞羞网站| 亚洲激情五月婷婷| 国产精品情趣视频| 日韩欧美在线网站| 在线观看亚洲a| 99久久综合99久久综合网站| 国产一区二区毛片| 久久99精品久久久久久久久久久久| 亚洲人一二三区| 久久看人人爽人人| 欧美成人性战久久| 3d动漫精品啪啪1区2区免费| 99久久国产综合精品色伊| 国产福利视频一区二区三区| 日韩国产在线一| 一区二区三区在线观看视频| 国产精品久久久久影院| 2023国产精品| 欧美电影免费观看高清完整版在| 欧美日韩国产系列| 在线观看视频欧美| 一本久道中文字幕精品亚洲嫩| 成人综合在线网站| 国产精品白丝jk白祙喷水网站| 精品一区精品二区高清| 美女视频网站久久| 日韩精品一二三四| 亚洲国产aⅴ天堂久久| 亚洲综合无码一区二区| 综合自拍亚洲综合图不卡区| 亚洲欧洲美洲综合色网| 国产精品美女久久久久久久网站| 国产亚洲精品aa| 久久久不卡网国产精品二区| 久久精品人人做人人综合|