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

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

?? cabadecoder.cpp

?? JMVM MPEG MVC/3DAV 測試平臺 國際通用標準
?? CPP
字號:
/*
********************************************************************************

NOTE - One of the two copyright statements below may be chosen
       that applies for the software.

********************************************************************************

This software module was originally developed by

Heiko Schwarz    (Fraunhofer HHI),
Tobias Hinz      (Fraunhofer HHI),
Karsten Suehring (Fraunhofer HHI)

in the course of development of the ISO/IEC 14496-10:2005 Amd.1 (Scalable Video
Coding) for reference purposes and its performance may not have been optimized.
This software module is an implementation of one or more tools as specified by
the ISO/IEC 14496-10:2005 Amd.1 (Scalable Video Coding).

Those intending to use this software module in products are advised that its
use may infringe existing patents. ISO/IEC have no liability for use of this
software module or modifications thereof.

Assurance that the originally developed software module can be used
(1) in the ISO/IEC 14496-10:2005 Amd.1 (Scalable Video Coding) once the
ISO/IEC 14496-10:2005 Amd.1 (Scalable Video Coding) has been adopted; and
(2) to develop the ISO/IEC 14496-10:2005 Amd.1 (Scalable Video Coding): 

To the extent that Fraunhofer HHI owns patent rights that would be required to
make, use, or sell the originally developed software module or portions thereof
included in the ISO/IEC 14496-10:2005 Amd.1 (Scalable Video Coding) in a
conforming product, Fraunhofer HHI will assure the ISO/IEC that it is willing
to negotiate licenses under reasonable and non-discriminatory terms and
conditions with applicants throughout the world.

Fraunhofer HHI retains full right to modify and use the code for its own
purpose, assign or donate the code to a third party and to inhibit third
parties from using the code for products that do not conform to MPEG-related
ITU Recommendations and/or ISO/IEC International Standards. 

This copyright notice must be included in all copies or derivative works.
Copyright (c) ISO/IEC 2005. 

********************************************************************************

COPYRIGHT AND WARRANTY INFORMATION

Copyright 2005, International Telecommunications Union, Geneva

The Fraunhofer HHI hereby donate this source code to the ITU, with the following
understanding:
    1. Fraunhofer HHI retain the right to do whatever they wish with the
       contributed source code, without limit.
    2. Fraunhofer HHI retain full patent rights (if any exist) in the technical
       content of techniques and algorithms herein.
    3. The ITU shall make this code available to anyone, free of license or
       royalty fees.

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.

********************************************************************************
*/




#include "H264AVCDecoderLib.h"
#include "H264AVCCommonLib/CabacTables.h"
#include "H264AVCCommonLib/TraceFile.h"
#include "H264AVCCommonLib/CabacContextModel.h"
#include "BitReadBuffer.h"
#include "CabaDecoder.h"
#include "DecError.h"


#if 0 // FAST_CABAC
#define RNOKCABAC( exp ) exp
#define ROTRSCABAC( exp, err ) ROTVS(exp)
#define ROFRSCABAC( exp, err ) ROFVS(exp)
#else
#define RNOKCABAC( exp )       RNOK(exp)
#define ROTRSCABAC( exp, err ) ROTRS(exp,err)
#define ROFRSCABAC( exp, err ) ROFRS(exp,err)
#endif


H264AVC_NAMESPACE_BEGIN


CabaDecoder::CabaDecoder() :
  m_pcBitReadBuffer( NULL ),
  m_uiRange( 0 ),
  m_uiValue( 0 ),
  m_uiWord( 0 ),
  m_uiBitsLeft( 0 )
{
}


CabaDecoder::~CabaDecoder()
{

}


ErrVal CabaDecoder::init( BitReadBuffer* pcBitReadBuffer )
{
  ROT( NULL == pcBitReadBuffer )

  m_pcBitReadBuffer = pcBitReadBuffer;
  return Err::m_nOK;
}



__inline Void CabaDecoder::xReadBit( UInt& ruiValue )
{
  if( 0 == m_uiBitsLeft-- )
  {
    m_pcBitReadBuffer->get( m_uiWord, 8 );
    m_uiBitsLeft = 7;
  }
  ruiValue += ruiValue + ((m_uiWord >> 7)&1);
  m_uiWord <<= 1;
}



ErrVal CabaDecoder::finish()
{
  return Err::m_nOK;
}

ErrVal CabaDecoder::start()
{
  m_uiRange     = HALF-2;
  m_uiValue     = 0;
  m_uiWord      = 0;
  m_uiBitsLeft  = 0;


  RNOK( m_pcBitReadBuffer->flush( m_pcBitReadBuffer->getBitsUntilByteAligned() ) );
  m_pcBitReadBuffer->setModeCabac();

  while( ! m_pcBitReadBuffer->isWordAligned() && ( 8 > m_uiBitsLeft) )
  {
    UInt uiByte;
    m_pcBitReadBuffer->get( uiByte, 8 );
    m_uiWord <<= 8;
    m_uiWord += uiByte;
    m_uiBitsLeft += 8;
  }

  m_uiWord <<= 8-m_uiBitsLeft;

  for( UInt n = 0; n < B_BITS-1; n++ )
  {
    xReadBit( m_uiValue );
  }

  return Err::m_nOK;
}



ErrVal CabaDecoder::getTerminateBufferBit( UInt& ruiBit )
{
  UInt uiRange = m_uiRange-2;
  UInt uiValue = m_uiValue;

  DTRACE_V (g_nSymbolCounter[g_nLayer]++);
  DTRACE_T ("  ");
  DTRACE_X (m_uiRange);


  if( uiValue >= uiRange )
  {
    ruiBit = 1;
  }
  else
  {
    ruiBit = 0;

	  while( uiRange < QUARTER )
	  {
		  uiRange += uiRange;
      xReadBit( uiValue );
	  }

    m_uiRange = uiRange;
    m_uiValue = uiValue;
  }

  DTRACE_T ("  -  ");
  DTRACE_V (ruiBit);
  DTRACE_N;
  return Err::m_nOK;
}


ErrVal CabaDecoder::uninit()
{
  m_pcBitReadBuffer = NULL;
  m_uiRange = 0;
  m_uiValue = 0;
  return Err::m_nOK;
}




ErrVal CabaDecoder::getSymbol( UInt& ruiSymbol, CabacContextModel& rcCCModel )
{
  UInt uiRange = m_uiRange;
  UInt uiValue = m_uiValue;

  DTRACE_V (g_nSymbolCounter[g_nLayer]++);
  DTRACE_T ("  ");
  DTRACE_X (m_uiRange);
  DTRACE_T ("  ");
  DTRACE_V (rcCCModel.getState());
  DTRACE_T ("  ");
  DTRACE_V (rcCCModel.getMps());

  {

    UInt uiLPS;

    uiLPS = g_aucLPSTable64x4[rcCCModel.getState()][(uiRange>>6) & 0x03];
		uiRange -= uiLPS;

		if( uiValue < uiRange )
    {
			ruiSymbol = rcCCModel.getMps();
  		rcCCModel.setState( g_aucACNextStateMPS64[ rcCCModel.getState() ] );
    }
    else
    {
      uiValue -= uiRange;
      uiRange  = uiLPS;

			ruiSymbol = 1 - rcCCModel.getMps();

      if( ! rcCCModel.getState() )
      {
				rcCCModel.toggleMps();
      }

			rcCCModel.setState( g_aucACNextStateLPS64[ rcCCModel.getState() ] );
    }
  }

  DTRACE_T ("  -  ");
  DTRACE_V (ruiSymbol);
  DTRACE_N;

  while( uiRange < QUARTER )
  {
    uiRange += uiRange;
    xReadBit( uiValue );
  }

  m_uiRange = uiRange;
  m_uiValue = uiValue;

  return Err::m_nOK;
}


ErrVal CabaDecoder::getEpSymbol( UInt& ruiSymbol )
{
  DTRACE_V (g_nSymbolCounter[g_nLayer]++);
  DTRACE_T ("  ");
  DTRACE_X (m_uiRange);

  UInt uiValue = m_uiValue;

  xReadBit( uiValue );

	if( uiValue >= m_uiRange )
	{
		ruiSymbol = 1;
		uiValue -= m_uiRange;
	}
	else
  {
		ruiSymbol = 0;
  }

  DTRACE_T ("  -  ");
  DTRACE_V (ruiSymbol);
  DTRACE_N;

  m_uiValue = uiValue;

  return Err::m_nOK;
}




ErrVal CabaDecoder::getExGolombLevel( UInt& ruiSymbol, CabacContextModel& rcCCModel  )
{
  UInt uiSymbol;
  UInt uiCount = 0;
  do
  {
    RNOKCABAC( getSymbol( uiSymbol, rcCCModel ) );
    uiCount++;
  }
  while( uiSymbol && (uiCount != 13));

  ruiSymbol = uiCount-1;

	if( uiSymbol )
  {
    RNOKCABAC( getEpExGolomb( uiSymbol, 0 ) );
    ruiSymbol += uiSymbol+1;
  }

  return Err::m_nOK;
}



ErrVal CabaDecoder::getExGolombMvd( UInt& ruiSymbol, CabacContextModel* pcCCModel, UInt uiMaxBin )
{
  UInt uiSymbol;

  RNOKCABAC( getSymbol( ruiSymbol, pcCCModel[0] ) );

  ROTRSCABAC( 0 == ruiSymbol, Err::m_nOK );

  RNOKCABAC( getSymbol( uiSymbol, pcCCModel[1] ) );

  ruiSymbol = 1;

  ROTRSCABAC( 0 == uiSymbol, Err::m_nOK );

  pcCCModel += 2;
  UInt uiCount = 2;

  do
  {
    if( uiMaxBin == uiCount )
    {
      pcCCModel++;
    }
    RNOKCABAC( getSymbol( uiSymbol, *pcCCModel ) );
    uiCount++;
  }
  while( uiSymbol && (uiCount != 8));

  ruiSymbol = uiCount-1;

	if( uiSymbol )
  {
    RNOKCABAC( getEpExGolomb( uiSymbol, 3 ) );
    ruiSymbol += uiSymbol+1;
  }

  return Err::m_nOK;
}


ErrVal CabaDecoder::getEpExGolomb( UInt& ruiSymbol, UInt uiCount )
{
  UInt uiSymbol = 0;
  UInt uiBit = 1;


  while( uiBit )
  {
    RNOKCABAC( getEpSymbol( uiBit ) );
    uiSymbol += uiBit << uiCount++;
  }

  uiCount--;
	while( uiCount-- )
  {
    RNOKCABAC( getEpSymbol( uiBit ) );
  	uiSymbol += uiBit << uiCount;
  }

  ruiSymbol = uiSymbol;
  return Err::m_nOK;
}

#if JMVM_ONLY //JVT-Z021

ErrVal CabaDecoder::getMSuOffset( UInt& ruiSymbol, CabacContextModel* pcCCModel, Int iOffset, UInt uiMaxSymbol ) {



	RNOKCABAC( getSymbol( ruiSymbol, *pcCCModel/*[0]*/ ) );

	ROTRSCABAC( 0 == ruiSymbol, Err::m_nOK );

	ROTRSCABAC( 1 == uiMaxSymbol, Err::m_nOK );



	UInt uiSymbol = 0;

	UInt uiCont;



	do

	{

		pcCCModel++;

		RNOKCABAC( getSymbol( uiCont, pcCCModel[ iOffset ] ) );

		uiSymbol++;

	}

	while( uiCont && (uiSymbol < uiMaxSymbol-1) );



	if( uiCont && (uiSymbol == uiMaxSymbol-1) )

	{

		//pcCCModel++; //linsx temp

		uiSymbol++;

	}



	ruiSymbol = uiSymbol;

	return Err::m_nOK;

}

#endif 

ErrVal CabaDecoder::getUnaryMaxSymbol( UInt& ruiSymbol, CabacContextModel* pcCCModel, Int iOffset, UInt uiMaxSymbol )
{
  RNOKCABAC( getSymbol( ruiSymbol, pcCCModel[0] ) );

  ROTRSCABAC( 0 == ruiSymbol, Err::m_nOK );
  ROTRSCABAC( 1 == uiMaxSymbol, Err::m_nOK );

  UInt uiSymbol = 0;
  UInt uiCont;

  do
  {
    RNOKCABAC( getSymbol( uiCont, pcCCModel[ iOffset ] ) );
    uiSymbol++;
  }
  while( uiCont && (uiSymbol < uiMaxSymbol-1) );

  if( uiCont && (uiSymbol == uiMaxSymbol-1) )
  {
    uiSymbol++;
  }

  ruiSymbol = uiSymbol;
  return Err::m_nOK;
}


ErrVal CabaDecoder::getUnarySymbol( UInt& ruiSymbol, CabacContextModel* pcCCModel, Int iOffset )
{
  RNOKCABAC( getSymbol( ruiSymbol, pcCCModel[0] ) );

  ROTRSCABAC( 0 == ruiSymbol, Err::m_nOK );

  UInt uiSymbol = 0;
  UInt uiCont;

  do
  {
    RNOKCABAC( getSymbol( uiCont, pcCCModel[ iOffset ] ) );
    uiSymbol++;
  }
  while( uiCont );

  ruiSymbol = uiSymbol;
  return Err::m_nOK;
}

H264AVC_NAMESPACE_END

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产精品美女一区二区三区 | 精品国产麻豆免费人成网站| 亚洲午夜久久久| 色综合久久久久久久久久久| 亚洲欧美乱综合| 欧美日韩日日摸| 免费看日韩精品| 精品av综合导航| 福利91精品一区二区三区| 中文字幕精品三区| 欧美亚日韩国产aⅴ精品中极品| 美女视频黄频大全不卡视频在线播放| 欧美日韩午夜影院| 免费看黄色91| 中文字幕成人av| 欧美中文字幕一区| 精品一区二区久久久| 国产精品的网站| 欧美日韩在线播| 日韩精品成人一区二区在线| 极品少妇一区二区| 国产一区二区三区视频在线播放| 久草这里只有精品视频| 成人深夜在线观看| 欧美日韩一区二区不卡| 国产精品午夜免费| 经典一区二区三区| 欧美精品日韩一区| 国产嫩草影院久久久久| 成人午夜短视频| 丝瓜av网站精品一区二区| 久久精品人人做人人综合| 色悠悠久久综合| 国产一区在线精品| 亚洲一区在线视频观看| 欧美精品一区二区三区蜜桃| 色诱亚洲精品久久久久久| 狠狠色狠狠色综合| 亚洲风情在线资源站| 国产亚洲精品超碰| 欧美精品v国产精品v日韩精品| 国产成人精品亚洲午夜麻豆| 亚洲成在人线在线播放| 日韩视频免费观看高清完整版 | 亚洲mv在线观看| 性欧美疯狂xxxxbbbb| 91美女蜜桃在线| 午夜国产不卡在线观看视频| 久久影院电视剧免费观看| 欧美日韩免费一区二区三区视频| 国产成人午夜精品影院观看视频 | 精品国产在天天线2019| 在线观看91视频| 99久久精品99国产精品| 国产在线观看一区二区 | 奇米影视一区二区三区| 亚洲色图19p| 国产精品久线观看视频| 久久久精品免费免费| 欧美电影免费观看高清完整版在| 91亚洲精品乱码久久久久久蜜桃| 韩国在线一区二区| 亚洲r级在线视频| 午夜精彩视频在线观看不卡| 日韩视频一区二区| 97aⅴ精品视频一二三区| 国产成人av电影在线播放| 日韩专区一卡二卡| 伊人开心综合网| 亚洲视频一区二区在线| 国产精品理论在线观看| 国产精品久久久久精k8| 国产欧美一区二区精品性| 久久精品人人做| 久久精品男人天堂av| 欧美精品一区二区三区一线天视频 | 成人91在线观看| 成人黄色av电影| 91在线无精精品入口| 91一区二区三区在线播放| 一本一道久久a久久精品综合蜜臀| jizzjizzjizz欧美| 91浏览器在线视频| 在线精品视频免费播放| 欧美日本在线播放| 欧美日韩美少妇| 欧美一级淫片007| 精品福利视频一区二区三区| 欧美白人最猛性xxxxx69交| 久久综合久久综合久久| 国产欧美一区二区精品忘忧草| 一区精品在线播放| 亚洲一区在线视频观看| 日韩精品免费视频人成| 韩国理伦片一区二区三区在线播放 | 在线观看国产91| 日韩亚洲欧美一区二区三区| 精品毛片乱码1区2区3区| 国产欧美精品区一区二区三区 | 337p亚洲精品色噜噜噜| 欧美一区二区三区不卡| 久久伊99综合婷婷久久伊| 国产日韩成人精品| 午夜精品福利一区二区三区av| 天天亚洲美女在线视频| 轻轻草成人在线| 国产制服丝袜一区| 高清成人免费视频| 国产一二三精品| 99re成人在线| 欧美日韩你懂的| 国产日韩欧美不卡| 亚洲日本va在线观看| 天堂一区二区在线| 国产精品伊人色| 日本丰满少妇一区二区三区| 欧美日韩另类一区| 久久婷婷国产综合国色天香| 日韩欧美123| 国产麻豆视频一区二区| 欧美成人精精品一区二区频| 3d动漫精品啪啪一区二区竹菊 | 欧美三级一区二区| 欧美电影精品一区二区| 欧美成人一区二区三区| 在线观看欧美精品| 91久久精品网| 久久女同互慰一区二区三区| 亚洲日本免费电影| 国产一区视频导航| 欧美自拍丝袜亚洲| 中文在线资源观看网站视频免费不卡 | 亚洲国产精品视频| 国产成人精品影院| 日韩精品自拍偷拍| 亚洲大片精品永久免费| 国产91精品一区二区麻豆亚洲| 91精品国产综合久久小美女| 亚洲男人都懂的| 粉嫩久久99精品久久久久久夜| 欧美人与性动xxxx| 亚洲欧美日本韩国| caoporen国产精品视频| 2017欧美狠狠色| 日本亚洲一区二区| 亚洲影院久久精品| 这里只有精品免费| 亚洲天堂2014| 国产一区二区中文字幕| 欧美日本视频在线| 亚洲蜜臀av乱码久久精品蜜桃| 国产东北露脸精品视频| 欧美岛国在线观看| 日本午夜精品视频在线观看| 欧美特级限制片免费在线观看| 中文字幕在线视频一区| 国产精品99久久久久| 精品日韩在线一区| 日本中文在线一区| 91精品国产乱码久久蜜臀| 婷婷亚洲久悠悠色悠在线播放| 欧美日精品一区视频| 一区二区三区日本| 欧美视频在线观看一区二区| 蜜臀av国产精品久久久久| 欧美色图激情小说| 午夜久久福利影院| 91麻豆精品国产91久久久资源速度 | eeuss鲁片一区二区三区在线观看| www日韩大片| 国产伦精品一区二区三区视频青涩 | 午夜精品视频在线观看| 欧美午夜一区二区三区免费大片| 亚洲最色的网站| 欧美日韩专区在线| 亚洲精品一区二区三区99| 99vv1com这只有精品| 国产精品久久久久久久浪潮网站 | 最新欧美精品一区二区三区| 欧美成人一区二区| 中文字幕欧美三区| 无吗不卡中文字幕| 午夜电影一区二区三区| 国产一二三精品| 欧美一区二区三区免费在线看| 99国产精品99久久久久久| av一区二区三区| 日韩视频国产视频| 精品国偷自产国产一区| 国产婷婷色一区二区三区| 国产精品不卡在线| 亚洲午夜一二三区视频| 另类欧美日韩国产在线| 丰满少妇在线播放bd日韩电影| 成a人片国产精品| 欧美绝品在线观看成人午夜影视| 日韩欧美123| 一区二区三区在线视频播放| 午夜精品久久久久| 99精品视频一区|