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

📄 encodercodingparameter.h

📁 jsvm开发代码包括抽样,编码,抽取,解码等一系列功能,可以做工具或研究用
💻 H
📖 第 1 页 / 共 5 页
字号:
    }
    //JVT-P031
    if( equals( pcCom, "-ds", 3) )
    {
     ROTS( NULL == argv[n] );
     ROTS( NULL == argv[n+1] );
     UInt uiLayer = atoi(argv[n]);
     CodingParameter::getLayerParameters(uiLayer).setUseDiscardable(true);
     Double dRate = atof(argv[n+1]);
     CodingParameter::getLayerParameters(uiLayer).setPredFGSRate(dRate);
     n+=1;
     continue;
    }
    //~JVT-P031
	
	//S051{
	if( equals( pcCom, "-encsip", 7 ) )
    {
		ROTS( NULL == argv[n  ] );
		ROTS( NULL == argv[n+1] );
		
		UInt    uiLayer = atoi( argv[n  ] );
		CodingParameter::getLayerParameters( uiLayer ).setEncSIP(true);
		CodingParameter::getLayerParameters( uiLayer ).setInSIPFileName(argv[n+1]);
		n += 1;
		continue;
    }
	if( equals( pcCom, "-anasip", 7 ) )
    {
		ROTS( NULL == argv[n  ] );
		ROTS( NULL == argv[n+1] );
		ROTS( NULL == argv[n+2] );
		
		UInt    uiLayer = atoi( argv[n  ] );
		UInt	uiMode = atoi( argv[n+1] );
		
		if(uiMode!=0)
			CodingParameter::getLayerParameters( uiLayer ).setAnaSIP(2);
		else
			CodingParameter::getLayerParameters( uiLayer ).setAnaSIP(1);
		
		CodingParameter::getLayerParameters( uiLayer ).setOutSIPFileName(argv[n+2]);
		n += 2;
		continue;
    }
	//S051}
    // JVT-U116 LMI {
    if( equals( pcCom, "-tlidx", 6 ) )
    {
      ROTS( NULL == argv[n] );
      UInt uiTl0PicIdxPresentFlag = atoi( argv[n] );
      CodingParameter::setTl0PicIdxPresentFlag( uiTl0PicIdxPresentFlag );
      continue;
    }
    // JVT-U116 LMI }

    // JVT-U085 LMI {
    if( equals( pcCom, "-tlnest", 7 ) )
    {
      ROTS( NULL == argv[n] );
      UInt uiTlNestFlag = atoi( argv[n] );
      CodingParameter::setTlevelNestingFlag( uiTlNestFlag );
      continue;
    }
    // JVT-U085 LMI }
	
    if( equals( pcCom, "-fgsmot", 7 ) )
    {
      ROTS( NULL == argv[n  ] );
      ROTS( NULL == argv[n+1] );
      UInt uiLayer         = atoi( argv[n  ] );
      UInt uiFGSMotionMode = atoi( argv[n+1] );
      CodingParameter::getLayerParameters( uiLayer ).setFGSMotionMode( uiFGSMotionMode );
      n += 1;
      continue;
    }

    if( equals( pcCom, "-org", 4 ) )
    {
      ROTS( NULL == argv[n  ] );
      ROTS( NULL == argv[n+1] );
      UInt    uiLayer = atoi( argv[n  ] );
      ROF(    uiLayer < MAX_LAYERS );
      CodingParameter::getLayerParameters( uiLayer ).setInputFilename( argv[n+1] );
      n += 1;
      continue;      
    }
    if( equals( pcCom, "-rec", 4 ) )
    {
      ROTS( NULL == argv[n  ] );
      ROTS( NULL == argv[n+1] );
      UInt    uiLayer = atoi( argv[n  ] );
      ROF(    uiLayer < MAX_LAYERS );
      CodingParameter::getLayerParameters( uiLayer ).setOutputFilename( argv[n+1] );
      n += 1;
      continue;      
    }
    if( equals( pcCom, "-ec", 3 ) )
    {
      ROTS( NULL == argv[n  ] );
      ROTS( NULL == argv[n+1] );
      UInt    uiLayer  = atoi( argv[n  ] );
      ROF(    uiLayer < MAX_LAYERS );
      UInt    uiECmode = atoi( argv[n+1] );
      CodingParameter::getLayerParameters( uiLayer ).setEntropyCodingModeFlag( uiECmode != 0 );
      n += 1;
      continue;      
    }
    if( equals( pcCom, "-vlc", 4 ) )
    {
      n--;
      ROTS( NULL == argv[n] );
      for( UInt uiLayer = 0; uiLayer < MAX_LAYERS; uiLayer++ )
      {
        CodingParameter::getLayerParameters( uiLayer ).setEntropyCodingModeFlag( false );
      }
      continue;
    }
    if( equals( pcCom, "-cabac", 6 ) )
    {
      n--;
      ROTS( NULL == argv[n] );
      for( UInt uiLayer = 0; uiLayer < MAX_LAYERS; uiLayer++ )
      {
        CodingParameter::getLayerParameters( uiLayer ).setEntropyCodingModeFlag( true );
      }
      continue;
    }
	//JVT-U106 Behaviour at slice boundaries{
	if( equals( pcCom, "-ciu", 3 ) )
	{
		ROTS( NULL == argv[n] );
		UInt flag = atoi( argv[n] );
		CodingParameter::setCIUFlag( flag );
		continue;
	}
    //JVT-U106 Behaviour at slice boundaries}
    if( equals( pcCom, "-pd", 3 ) )
    {
      ROTS( NULL == argv[n] );
      Bool bFlag = atoi( argv[n] ) != 0;
      CodingParameter::setFGSParallelDecodingFlag( bFlag );
      continue;
    }

    if( equals( pcCom, "-h", 2) )
    {
      printHelp();
      return Err::m_nOK;
    }

    return Err::m_nERR;
  }


  RNOKS( check() );
  
  return Err::m_nOK;
}


Void EncoderCodingParameter::printHelp()
{
  printf("\n supported options:\n\n");
  printf("  -pf     Parameter File Name\n\n");

  printf("  -bf     BitStreamFile\n");
  printf("  -frms   Number of total frames\n");
	printf("  -gop    GOPSize - GOP size (2,4,8,16,32,64, default: 1)\n");
	printf("  -iper   Intra period (default: -1) : must be a power of 2 of GOP size (or -1)\n");
  printf("  -numl   Number Of Layers\n");
  printf("  -cabac  CABAC for all layers as entropy coding mode\n");
  printf("  -vlc    VLC for all layers as entropy coding mode\n");
	printf("  -ecmf   (Layer) (entropy_coding_mod_flag)\n");
  printf("  -org    (Layer) (original file)\n");
  printf("  -rec    (Layer) (reconstructed file)\n");
  printf("  -ec     (Layer) (entropy coding mode)\n");
  printf("  -rqp    (Layer) (ResidualQP)\n");
  printf("  -mqp    (Layer) (Stage) (MotionQP)\n");
  printf("  -lqp    (Layer) (ResidualAndMotionQP)\n");
  printf("  -meqplp (Layer) (MotionQPLowpass)\n");
  printf("  -ilpred (Layer) (InterLayerPredictionMode)\n");
	printf("  -blid   (Layer) (BaseLayerId)\n");
  printf("  -mfile  (Layer) (Mode) (MotionInfoFile)\n");
  printf("  -anafgs (Layer) (NumFGSLayers) (File for storing FGS parameters)\n");
  printf("  -encfgs (Layer) (bit-rate in kbps) (File with stored FGS parameters)\n");
  printf("  -cl     (Layer) (ClosedLoopParameter)\n");
  printf("  -ds     (Layer) (Rate for inter-layer prediction)\n");
  printf("  -fgsmot (Layer) (FGSMotionRefinementMode) [0: no, 1: HP only, 2: all]\n");
  printf("  -bcip   Constrained intra prediction for base layer (needed for single-loop) in scripts\n");
  //S051{
  printf("  -anasip (Layer) (SIP Analysis Mode)[0: persists all inter-predictions, 1: forbids all inter-prediction.] (File for storing bits information)\n");
  printf("  -encsip (Layer) (File with stored SIP information)\n");
  //S051}
   //JVT-U085 LMI
  printf("  -tlnest (TlevelNestingFlag)[0: temporal level nesting constraint is not applied, 1: the nesting constraint is applied.]\n");
  //JVT-U116 JVT-V088 LMI
  printf("  -tlidx (Tl0PicIdxPresentFlag)[0: tl0_pic_idx is not present, 1: tl0_pic_idx is present.]\n");
  //JVT-U106 Behaviour at slice boundaries{
  printf("  -ciu    (Constrained intra upsampling)[0: no, 1: yes]\n");
  //JVT-U106 Behaviour at slice boundaries}
  printf("  -ref    (enhRef)    Enhancement reference weighting for ME [default: 0.0]\n");
  printf("  -fs     (encStruct) FGS coding structure selection [0: Optimized FGS syntax structure 1: Standard structure]\n");
  printf("  -ar     (wZBlock) (wZCoeff) Zero block and zero coefficient weightings [default: 32 32]\n");
  printf("  -pd     (mode)      Cycle aligned fragments (CAF) is used [0: no, 1: yes]\n");

  printf("  -rcdo-bs   (value)  RDCO block size restriction     (0:off,1:ELonly,2:on)\n" );
  printf("  -rcdo-mc-y (value)  RDCO motion compensation luma   (0:off,1:ELonly,2:on)\n" );
  printf("  -rcdo-mc-c (value)  RDCO motion compensation chroma (0:off,1:ELonly,2:on)\n" );
  printf("  -rcdo-mc   (value)  RDCO motion compensation        (0:off,1:ELonly,2:on)\n" );
  printf("  -rcdo-db   (value)  RDCO deblocking                 (0:off,1:ELonly,2:on)\n" );
  printf("  -rcdo      (value)  RDCO (all components)           (0:off,1:ELonly,2:on)\n" );

  printf("  -4tap-mc-y (value)  4-tap motion compensation luma   (0:off,1:ELonly,2:on)\n" );  // V090

  printf("  -kpm       (mode) [0:only for FGS(default), 1:FGS&MGS, 2:always]\n");
  printf("  -mgsctrl   (mode) [0:normal encoding(default), 1:EL ME, 2:EL ME+MC]\n");
  printf("  -mgsmotr   (mode) [0:no MGS mot ref, 1:normal mot ref (default)\n");
  
  printf("  -eqpc   (layer) (value)         sets explicit QP cascading mode for given layer [0: no, 1: yes]\n");
  printf("  -dqp    (layer) (level) (value) sets delta QP for given layer and temporal level (in explicit mode)\n");
  printf("  -aeqpc  (value)                 sets explicit QP cascading mode for all layers  [0: no, 1: yes]\n");
  printf("  -adqp   (level) (value)         sets delta QP for all layers and given temporal level (in explicit mode)\n");
  printf("  -xdqp   (DQP0) (DDQP1) (DDQPN)  sets delta QP for all layers (in explicit mode)\n");

  printf("  -h       Print Option List \n");
  printf("\n");
}


ErrVal EncoderCodingParameter::xReadLine( FILE* hFile, std::string* pacTag )
  {
  ROF( pacTag );

    Int  n;
    UInt uiTagNum = 0;
  Bool          bComment  = false;
  std::string*  pcTag     = &pacTag[0];

    for( n = 0; n < 4; n++ )
    {
      pacTag[n] = "";
    }

  for( n = 0; ; n++ )
    {
      Char cChar = (Char) fgetc( hFile );
    ROTRS( cChar == '\n' || feof( hFile ), Err::m_nOK );  // end of line
    if   ( cChar == '#' )
      {
      bComment = true;
      }
    if( ! bComment )
      {
      if ( cChar == '\t' || cChar == ' ' ) // white space
        {
          ROTR( uiTagNum == 3, Err::m_nERR );
        if( ! pcTag->empty() )
          {
            uiTagNum++;
          pcTag = &pacTag[uiTagNum]; 
          }
  }
      else
  {
        *pcTag += cChar;
  }
}
  }

 }

ErrVal EncoderCodingParameter::xReadFromFile( std::string& rcFilename, std::string& rcBitstreamFile )
{
  std::string acLayerConfigName[MAX_LAYERS];
  std::string acTags[4];
  UInt        uiLayerCnt   = 0;
  UInt        uiParLnCount = 0;

  FILE *f = fopen( rcFilename.c_str(), "r");
  if( NULL == f )
  { 
    printf( "failed to open %s parameter file\n", rcFilename.c_str() );
    return Err::m_nERR;
  } 

  m_pEncoderLines[uiParLnCount++] = new EncoderConfigLineStr ("OutputFile",              &rcBitstreamFile,                                      "test.264");
  m_pEncoderLines[uiParLnCount++] = new EncoderConfigLineDbl ("FrameRate",               &m_dMaximumFrameRate,                                  60.0      );
  m_pEncoderLines[uiParLnCount++] = new EncoderConfigLineDbl ("MaxDelay",                &m_dMaximumDelay,                                      1200.0    );
  m_pEncoderLines[uiParLnCount++] = new EncoderConfigLineUInt("FramesToBeEncoded",       &m_uiTotalFrames,                                      1 );
  m_pEncoderLines[uiParLnCount++] = new EncoderConfigLineUInt("GOPSize",                 &m_uiGOPSize,                                          1 );
  m_pEncoderLines[uiParLnCount++] = new EncoderConfigLineUInt("IntraPeriod",             &m_uiIntraPeriod,                                      MSYS_UINT_MAX );
  m_pEncoderLines[uiParLnCount++] = new EncoderConfigLineUInt("NumberReferenceFrames",   &m_uiNumRefFrames,                                     1 );

⌨️ 快捷键说明

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