⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mbmvdata.h

📁 JVT-S203 contains the JSVM 6 reference software. It corresponds to CVS tag “JSVM_5_12_1”. For obt
💻 H
📖 第 1 页 / 共 2 页
字号:
/*
********************************************************************************

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.

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






#if !defined(AFX_MBMVDATA_H__06960F25_0FB8_4A65_935D_B06282FFDF6E__INCLUDED_)
#define AFX_MBMVDATA_H__06960F25_0FB8_4A65_935D_B06282FFDF6E__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000


H264AVC_NAMESPACE_BEGIN

class H264AVCCOMMONLIB_API MbMvData
{
public:
  Void copyFrom( const MbMvData& rcMbMvData, const ParIdx8x8 eParIdx );
  Void copyFrom( const MbMvData& rcMbMvData );

  MbMvData()
  {
    clear();  
  }

  Void clear()
  {
    m_acMv[ 0 ].setZero();
    m_acMv[ 1 ].setZero();
    m_acMv[ 2 ].setZero();
    m_acMv[ 3 ].setZero();
    m_acMv[ 4 ].setZero();
    m_acMv[ 5 ].setZero();
    m_acMv[ 6 ].setZero();
    m_acMv[ 7 ].setZero();
    m_acMv[ 8 ].setZero();
    m_acMv[ 9 ].setZero();
    m_acMv[10 ].setZero();
    m_acMv[11 ].setZero();
    m_acMv[12 ].setZero();
    m_acMv[13 ].setZero();
    m_acMv[14 ].setZero();
    m_acMv[15 ].setZero();
  }

  Void clear( ParIdx8x8 eParIdx )
  {
    Mv* pcMv = &m_acMv[ eParIdx ];
    pcMv[ 0 ].setZero();
    pcMv[ 1 ].setZero();
    pcMv[ 4 ].setZero();
    pcMv[ 5 ].setZero();
  }

  Void  setFirstMv( const Mv& rcMv )                                          { m_acMv[ 0 ] = rcMv; }
  Void  setFirstMv( const Mv& rcMv, ParIdx16x8 eParIdx  )                     { m_acMv[ eParIdx ] = rcMv; }
  Void  setFirstMv( const Mv& rcMv, ParIdx8x16 eParIdx  )                     { m_acMv[ eParIdx ] = rcMv; }
  Void  setFirstMv( const Mv& rcMv, ParIdx8x8  eParIdx  )                     { m_acMv[ eParIdx ] = rcMv; }
  Void  setFirstMv( const Mv& rcMv, ParIdx8x8  eParIdx, SParIdx8x4 eSParIdx ) { m_acMv[ eParIdx+eSParIdx ] = rcMv; }
  Void  setFirstMv( const Mv& rcMv, ParIdx8x8  eParIdx, SParIdx4x8 eSParIdx ) { m_acMv[ eParIdx+eSParIdx ] = rcMv; }
  Void  setFirstMv( const Mv& rcMv, ParIdx8x8  eParIdx, SParIdx4x4 eSParIdx ) { m_acMv[ eParIdx+eSParIdx ] = rcMv; }

  Void  setAllMv( const Mv& rcMv );
  Void  setAllMv( const Mv& rcMv, ParIdx16x8 eParIdx  );
  Void  setAllMv( const Mv& rcMv, ParIdx8x16 eParIdx  );
  Void  setAllMv( const Mv& rcMv, ParIdx8x8  eParIdx  );
  Void  setAllMv( const Mv& rcMv, ParIdx8x8  eParIdx, SParIdx8x4 eSParIdx );
  Void  setAllMv( const Mv& rcMv, ParIdx8x8  eParIdx, SParIdx4x8 eSParIdx );
  Void  setAllMv( const Mv& rcMv, ParIdx8x8  eParIdx, SParIdx4x4 eSParIdx );

  Void  setMv( const Mv& rcMv, LumaIdx cIdx );

  const Mv& getMv()                                           const { return m_acMv[ 0 ]; }
  const Mv& getMv( ParIdx16x8 eParIdx   )                     const { return m_acMv[ eParIdx ]; }
  const Mv& getMv( ParIdx8x16 eParIdx   )                     const { return m_acMv[ eParIdx ]; }
  const Mv& getMv( ParIdx8x8  eParIdx   )                     const { return m_acMv[ eParIdx ]; }
  const Mv& getMv( ParIdx8x8  eParIdx, SParIdx8x4 eSParIdx )  const { return m_acMv[ eParIdx + eSParIdx ]; }
  const Mv& getMv( ParIdx8x8  eParIdx, SParIdx4x8 eSParIdx )  const { return m_acMv[ eParIdx + eSParIdx ]; }
  const Mv& getMv( ParIdx8x8  eParIdx, SParIdx4x4 eSParIdx )  const { return m_acMv[ eParIdx + eSParIdx ]; }
  const Mv& getMv( LumaIdx cIdx )                             const { return m_acMv[ cIdx.b4x4() ]; }


  ErrVal  save( FILE* pFile );
  ErrVal  load( FILE* pFile );

  ErrVal  upsampleMotion( const MbMvData& rcMbMvData, Par8x8 ePar8x8 );

private:
  MbMvData( const MbMvData& )                   {}

public:
  Mv  m_acMv[16];
};


#if defined( WIN32 )
# pragma warning( disable: 4251 )
#endif

class H264AVCCOMMONLIB_API MbMotionData :
public MbMvData
{
public:
  Void copyFrom( const MbMotionData& rcMbMotionData, const ParIdx8x8  eParIdx  );
  Void copyFrom( const MbMotionData& rcMbMotionData );

  MbMotionData()
    : MbMvData        (        ),
      m_usMotPredFlags( 0x0000 )
  {
    m_ascRefIdx[ 0 ] = m_ascRefIdx[ 1 ] = m_ascRefIdx[ 2 ] = m_ascRefIdx[ 3 ] = BLOCK_NOT_AVAILABLE;
    m_usMotPredFlags=0; 
  
    m_acRefPic[ 0 ].setFrame( NULL ); 
    m_acRefPic[ 1 ].setFrame( NULL );
    m_acRefPic[ 2 ].setFrame( NULL );
    m_acRefPic[ 3 ].setFrame( NULL );
  }


  Void reset()
  {
    clear( BLOCK_NOT_AVAILABLE );
    m_acRefPic[ 0 ].setFrame( NULL );
    m_acRefPic[ 1 ].setFrame( NULL );
    m_acRefPic[ 2 ].setFrame( NULL );
    m_acRefPic[ 3 ].setFrame( NULL );
  }

  Void clear( RefIdxValues eRefIdxValues )
  {
    MbMvData::clear();
    m_usMotPredFlags = 0x0000;
    m_ascRefIdx[ 0 ] = m_ascRefIdx[ 1 ] = m_ascRefIdx[ 2 ] = m_ascRefIdx[ 3 ] = eRefIdxValues;
  }

  Void  setRefIdx( SChar scRefIdx );
  Void  setRefIdx( SChar scRefIdx, ParIdx16x8 eParIdx  );
  Void  setRefIdx( SChar scRefIdx, ParIdx8x16 eParIdx  );
  Void  setRefIdx( SChar scRefIdx, ParIdx8x8  eParIdx  );
  
  SChar getRefIdx()                      const  { return m_ascRefIdx[ 0         ]; }
  SChar getRefIdx( ParIdx16x8 eParIdx  ) const  { return m_ascRefIdx[ m_auiBlk2Part[ eParIdx ] ]; }
  SChar getRefIdx( ParIdx8x16 eParIdx  ) const  { return m_ascRefIdx[ m_auiBlk2Part[ eParIdx ] ]; }
  SChar getRefIdx( ParIdx8x8  eParIdx  ) const  { return m_ascRefIdx[ m_auiBlk2Part[ eParIdx ] ]; }
  SChar getRefIdx( LumaIdx cIdx )        const  { return m_ascRefIdx[ m_auiBlk2Part[ cIdx.b4x4() ] ]; }
  SChar getRefIdx( Par8x8 ePar8x8 )      const  { return m_ascRefIdx[ ePar8x8]; }


  Bool  getMotPredFlag()                     const  { return xGetMotPredFlag( 0 ); }
  Bool  getMotPredFlag( ParIdx16x8 eParIdx ) const  { return xGetMotPredFlag( eParIdx ); }
  Bool  getMotPredFlag( ParIdx8x16 eParIdx ) const  { return xGetMotPredFlag( eParIdx ); }
  Bool  getMotPredFlag( ParIdx8x8  eParIdx ) const  { return xGetMotPredFlag( eParIdx ); }
  Bool  getMotPredFlag( LumaIdx    cIdx    ) const  { return xGetMotPredFlag( cIdx.b4x4() ); }

  Void  setMotPredFlag( Bool bFlag );
  Void  setMotPredFlag( Bool bFlag, ParIdx16x8 eParIdx );
  Void  setMotPredFlag( Bool bFlag, ParIdx8x16 eParIdx );
  Void  setMotPredFlag( Bool bFlag, ParIdx8x8  eParIdx );
  Void  setMotPredFlag( Bool bFlag, LumaIdx    cIdx    );



  Void  setRefPic( const Frame* pcRefFrame )
  {
    m_acRefPic[ 0 ].setFrame( pcRefFrame );
    m_acRefPic[ 1 ].setFrame( pcRefFrame );
    m_acRefPic[ 2 ].setFrame( pcRefFrame );
    m_acRefPic[ 3 ].setFrame( pcRefFrame );
  }
  Void  setRefPic( const Frame* pcRefFrame, ParIdx16x8 eParIdx  )
  {
    UInt uiOffset = m_auiBlk2Part[ eParIdx ];
    m_acRefPic[ uiOffset     ].setFrame( pcRefFrame );
    m_acRefPic[ uiOffset + 1 ].setFrame( pcRefFrame );
  }
  Void  setRefPic( const Frame* pcRefFrame, ParIdx8x16 eParIdx  )
  {
    UInt uiOffset = m_auiBlk2Part[ eParIdx ];
    m_acRefPic[ uiOffset     ].setFrame( pcRefFrame );
    m_acRefPic[ uiOffset + 2 ].setFrame( pcRefFrame );
  }
  Void  setRefPic( const Frame* pcRefFrame, ParIdx8x8  eParIdx  )
  {

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -