/* The copyright in this software is being made available under the BSD * License, included below. This software may be subject to other third party * and contributor rights, including patent rights, and no such rights are * granted under this license. * * Copyright (c) 2010-2014, ITU/ISO/IEC * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * Neither the name of the ITU/ISO/IEC nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ /** \file TEncSbac.h \brief Context-adaptive entropy encoder class (header) */ #ifndef __TENCSBAC__ #define __TENCSBAC__ #if _MSC_VER > 1000 #pragma once #endif // _MSC_VER > 1000 #include "TLibCommon/TComBitStream.h" #include "TLibCommon/ContextTables.h" #include "TLibCommon/ContextModel.h" #include "TLibCommon/ContextModel3DBuffer.h" #include "TEncEntropy.h" #include "TEncBinCoder.h" #include "TEncBinCoderCABAC.h" #if FAST_BIT_EST #include "TEncBinCoderCABACCounter.h" #endif class TEncTop; //! \ingroup TLibEncoder //! \{ // ==================================================================================================================== // Class definition // ==================================================================================================================== /// SBAC encoder class class TEncSbac : public TEncEntropyIf { public: TEncSbac(); virtual ~TEncSbac(); Void init ( TEncBinIf* p ) { m_pcBinIf = p; } Void uninit () { m_pcBinIf = 0; } // Virtual list Void resetEntropy (); Void determineCabacInitIdx (); Void setBitstream ( TComBitIf* p ) { m_pcBitIf = p; m_pcBinIf->init( p ); } Void setSlice ( TComSlice* p ) { m_pcSlice = p; } Void load ( const TEncSbac* pSrc ); Void loadIntraDirMode ( const TEncSbac* pScr, const ChannelType chType ); Void store ( TEncSbac* pDest ) const; Void loadContexts ( const TEncSbac* pSrc ); Void resetBits () { m_pcBinIf->resetBits(); m_pcBitIf->resetBits(); } UInt getNumberOfWrittenBits () { return m_pcBinIf->getNumWrittenBits(); } //--SBAC RD Void codeVPS ( TComVPS* pcVPS ); Void codeSPS ( TComSPS* pcSPS ); Void codePPS ( TComPPS* pcPPS #if Q0048_CGS_3D_ASYMLUT , TEnc3DAsymLUT * pc3DAsymLUT #endif ); Void codeSliceHeader ( TComSlice* pcSlice ); Void codeTilesWPPEntryPoint ( TComSlice* pSlice ); Void codeTerminatingBit ( UInt uilsLast ); Void codeSliceFinish (); Void codeSaoMaxUvlc ( UInt code, UInt maxSymbol ); Void codeSaoMerge ( UInt uiCode ); Void codeSaoTypeIdx ( UInt uiCode); Void codeSaoUflc ( UInt uiLength, UInt uiCode ); Void codeSAOSign ( UInt uiCode); //