Ignore:
Timestamp:
11 May 2012, 21:20:17 (12 years ago)
Author:
hschwarz
Message:

updated trunk (move to HM6.1)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/Lib/TLibCommon/ContextModel3DBuffer.h

    r5 r56  
    22 * License, included below. This software may be subject to other third party
    33 * and contributor rights, including patent rights, and no such rights are
    4  * granted under this license.
     4 * granted under this license. 
    55 *
    6  * Copyright (c) 2010-2011, ISO/IEC
     6 * Copyright (c) 2010-2012, ITU/ISO/IEC
    77 * All rights reserved.
    88 *
     
    1515 *    this list of conditions and the following disclaimer in the documentation
    1616 *    and/or other materials provided with the distribution.
    17  *  * Neither the name of the ISO/IEC nor the names of its contributors may
     17 *  * Neither the name of the ITU/ISO/IEC nor the names of its contributors may
    1818 *    be used to endorse or promote products derived from this software without
    1919 *    specific prior written permission.
     
    3232 */
    3333
    34 
    35 
    3634/** \file     ContextModel3DBuffer.h
    3735    \brief    context model 3D buffer class (header)
    3836*/
    3937
    40 #ifndef __CONTEXT_MODEL_3DBUFFER__
    41 #define __CONTEXT_MODEL_3DBUFFER__
    42 
    43 #if _MSC_VER > 1000
    44 #pragma once
    45 #endif // _MSC_VER > 1000
     38#ifndef _HM_CONTEXT_MODEL_3DBUFFER_H_
     39#define _HM_CONTEXT_MODEL_3DBUFFER_H_
    4640
    4741#include <stdio.h>
     
    5145#include "CommonDef.h"
    5246#include "ContextModel.h"
     47
     48//! \ingroup TLibCommon
     49//! \{
    5350
    5451// ====================================================================================================================
     
    6057{
    6158protected:
    62   ContextModel* m_pcContextModel;                                        ///< array of context models
    63   const UInt    m_uiSizeX;                                                ///< X size of 3D buffer
    64   const UInt    m_uiSizeY;                                                ///< Y size of 3D buffer
    65   const UInt    m_uiSizeZ;                                                ///< Z size of 3D buffer
     59  ContextModel* m_contextModel; ///< array of context models
     60  const UInt    m_sizeX;        ///< X size of 3D buffer
     61  const UInt    m_sizeXY;       ///< X times Y size of 3D buffer
     62  const UInt    m_sizeXYZ;      ///< total size of 3D buffer
    6663 
    6764public:
    68   ContextModel3DBuffer  ( UInt uiSizeZ, UInt uiSizeY, UInt uiSizeX );
    69   ~ContextModel3DBuffer ();
     65  ContextModel3DBuffer  ( UInt uiSizeZ, UInt uiSizeY, UInt uiSizeX, ContextModel *basePtr, Int &count );
     66  ~ContextModel3DBuffer () {}
    7067 
    7168  // access functions
    7269  ContextModel& get( UInt uiZ, UInt uiY, UInt uiX )
    7370  {
    74     return  m_pcContextModel[ ( uiZ * m_uiSizeY + uiY ) * m_uiSizeX + uiX ];
     71    return  m_contextModel[ uiZ * m_sizeXY + uiY * m_sizeX + uiX ];
    7572  }
    7673  ContextModel* get( UInt uiZ, UInt uiY )
    7774  {
    78     return &m_pcContextModel[ ( uiZ * m_uiSizeY + uiY ) * m_uiSizeX      ];
     75    return &m_contextModel[ uiZ * m_sizeXY + uiY * m_sizeX ];
    7976  }
    8077  ContextModel* get( UInt uiZ )
    8178  {
    82     return &m_pcContextModel[ ( uiZ * m_uiSizeY       ) * m_uiSizeX      ];
     79    return &m_contextModel[ uiZ * m_sizeXY ];
    8380  }
    8481 
    8582  // initialization & copy functions
    86   Void initBuffer( SliceType eSliceType, Int iQp, Short* psCtxModel );          ///< initialize 3D buffer by slice type & QP
    87   Void copyFrom  ( ContextModel3DBuffer* pSrc                       );          ///< copy from given 3D buffer
     83  Void initBuffer( SliceType eSliceType, Int iQp, UChar* ctxModel );          ///< initialize 3D buffer by slice type & QP
     84 
     85#if CABAC_INIT_FLAG
     86  UInt calcCost( SliceType sliceType, Int qp, UChar* ctxModel );      ///< determine cost of choosing a probability table based on current probabilities
     87#endif
     88  /** copy from another buffer
     89   * \param src buffer to copy from
     90   */
     91  Void copyFrom( ContextModel3DBuffer* src )
     92  {
     93    assert( m_sizeXYZ == src->m_sizeXYZ );
     94    ::memcpy( m_contextModel, src->m_contextModel, sizeof(ContextModel) * m_sizeXYZ );
     95  }
    8896};
    8997
    90 #endif
     98//! \}
    9199
     100#endif // _HM_CONTEXT_MODEL_3DBUFFER_H_
Note: See TracChangeset for help on using the changeset viewer.