示例#1
0
int main(int argc, char* argv[])
{
  TAppEncTop  cTAppEncTop;

  // print information
  fprintf( stdout, "\n" );
  fprintf( stdout, "HM software: Encoder Version [%s] (including RExt)", NV_VERSION );
  fprintf( stdout, NVM_ONOS );
  fprintf( stdout, NVM_COMPILEDBY );
  fprintf( stdout, NVM_BITS );
  fprintf( stdout, "\n\n" );

  // create application encoder class
  cTAppEncTop.create();

  // parse configuration
  try
  {
    if(!cTAppEncTop.parseCfg( argc, argv ))
    {
      cTAppEncTop.destroy();
#if ENVIRONMENT_VARIABLE_DEBUG_AND_TEST
      EnvVar::printEnvVar();
#endif
      return 1;
    }
  }
  catch (df::program_options_lite::ParseFailure &e)
  {
    std::cerr << "Error parsing option \""<< e.arg <<"\" with argument \""<< e.val <<"\"." << std::endl;
    return 1;
  }

#if PRINT_MACRO_VALUES
  printMacroSettings();
#endif

#if ENVIRONMENT_VARIABLE_DEBUG_AND_TEST
  EnvVar::printEnvVarInUse();
#endif

  // starting time
  Double dResult;
  clock_t lBefore = clock();

  // call encoding function
  cTAppEncTop.encode();

  // ending time
  dResult = (Double)(clock()-lBefore) / CLOCKS_PER_SEC;
  printf("\n Total Time: %12.3f sec.\n", dResult);

  // destroy application encoder class
  cTAppEncTop.destroy();

  return 0;
}
示例#2
0
int main(int argc, char* argv[])
{
  TAppEncTop  cTAppEncTop;

  // print information
  fprintf( stdout, "\n" );
  fprintf( stdout, "HM software: Encoder Version [%s]", NV_VERSION );
  fprintf( stdout, NVM_ONOS );
  fprintf( stdout, NVM_COMPILEDBY );
  fprintf( stdout, NVM_BITS );
  fprintf( stdout, "\n" );

  // create application encoder class
  cTAppEncTop.create();
  

  // parse configuration
  try
  {
    if(!cTAppEncTop.parseCfg( argc, argv ))
    {
      cTAppEncTop.destroy();
      return 1;
    }
  }
  catch (po::ParseFailure& e)
  {
    cerr << "Error parsing option \""<< e.arg <<"\" with argument \""<< e.val <<"\"." << endl;
    return 1;
  }
  
  //Felipe: static classes initialization

  
  // starting time
  double dResult;
  long lBefore = clock();

  // call encoding function
  cTAppEncTop.encode();

  // ending time
  dResult = (double)(clock()-lBefore) / CLOCKS_PER_SEC;
  printf("\n Total Time: %12.3f sec.\n", dResult);
  
  //Felipe
  finalizeStaticClasses();

  // destroy application encoder class
  cTAppEncTop.destroy();

  return 0;
}
示例#3
0
int main(int argc, char* argv[])
{
  TAppEncTop  cTAppEncTop;

  // print information
  fprintf( stdout, "\n" );
  fprintf( stdout, "HM software: Encoder Version [%s]", NV_VERSION );
  fprintf( stdout, NVM_ONOS );
  fprintf( stdout, NVM_COMPILEDBY );
  fprintf( stdout, NVM_BITS );
  fprintf( stdout, "\n" );

  //FELIPE BEGIN
  FileWriter::init(PU_CHOICES_FILE, "outputs/pu_choices.txt");
  FileWriter::init(PU_DECISION_PARAMS_FILE, "outputs/pu_params.txt");
  StatsManager::init();

  // create application encoder class
  cTAppEncTop.create();

  // parse configuration
  if(!cTAppEncTop.parseCfg( argc, argv ))
  {
    cTAppEncTop.destroy();
    return 1;
  }

  // starting time
  double dResult;
  long lBefore = clock();

  // call encoding function
  cTAppEncTop.encode();

  // ending time
  dResult = (double)(clock()-lBefore) / CLOCKS_PER_SEC;
  printf("\n Total Time: %12.3f sec.\n", dResult);

  // destroy application encoder class
  cTAppEncTop.destroy();

  //FELIPE BEGIN
  FileWriter::print(PU_CHOICES_FILE,"%s", StatsManager::reportPUChoices().c_str());
  FileWriter::close(PU_CHOICES_FILE);
  FileWriter::close(PU_DECISION_PARAMS_FILE);

  return 0;
}
示例#4
0
int main(int argc, char* argv[])
{
  TAppEncTop  cTAppEncTop;

  // print information
  fprintf( stdout, "\n" );
  fprintf( stdout, "HM software: Encoder Version [%s]", NV_VERSION );
  fprintf( stdout, NVM_ONOS );
  fprintf( stdout, NVM_COMPILEDBY );
  fprintf( stdout, NVM_BITS );
  fprintf( stdout, "\n" );

  // create application encoder class
  cTAppEncTop.create();

  // parse configuration
  if(!cTAppEncTop.parseCfg( argc, argv ))
  {
    cTAppEncTop.destroy();
    return 1;
  }

  // starting time
  double dResult;
  long lBefore = clock();

  // call encoding function
  cTAppEncTop.encode();

  // ending time
  dResult = (double)(clock()-lBefore) / CLOCKS_PER_SEC;
  printf("\n Total Time: %12.3f sec.\n", dResult);

  // destroy application encoder class
  cTAppEncTop.destroy();

  return 0;
}
示例#5
0
int main(int argc, char* argv[])
{
  TAppEncTop  cTAppEncTop;
  nameFile = argv[9];

  // print information
  fprintf( stdout, "\n" );
  fprintf( stdout, "HM software: Encoder Version [%s] (including RExt)", NV_VERSION );
  fprintf( stdout, NVM_ONOS );
  fprintf( stdout, NVM_COMPILEDBY );
  fprintf( stdout, NVM_BITS );
  fprintf( stdout, "\n\n" );

   ofstream outfile;
   outfile.open((nameFile + ".txt").c_str(),ios::out);
   outfile.close();
  // create application encoder class
  cTAppEncTop.create();

  // parse configuration
  try
  {
    if(!cTAppEncTop.parseCfg( argc, argv ))
    {
      cTAppEncTop.destroy();
#if ENVIRONMENT_VARIABLE_DEBUG_AND_TEST
      EnvVar::printEnvVar();
#endif
      return 1;
    }
  }
  catch (df::program_options_lite::ParseFailure &e)
  {
    std::cerr << "Error parsing option \""<< e.arg <<"\" with argument \""<< e.val <<"\"." << std::endl;
    return 1;
  }

#if PRINT_MACRO_VALUES
  printMacroSettings();
#endif

#if ENVIRONMENT_VARIABLE_DEBUG_AND_TEST
  EnvVar::printEnvVarInUse();
#endif

  // starting time
  Double dResult;
  clock_t lBefore = clock();

  // call encoding function
  cTAppEncTop.encode();

  // ending time
  dResult = (Double)(clock()-lBefore) / CLOCKS_PER_SEC;
  printf("\n Total Time: %12.3f sec.\n", dResult);

  ofstream timeTabs,countTabs;
  timeTabs.open(("time_" + nameFile +  ".csv").c_str(),ios::out);
  countTabs.open(("count_" + nameFile +  ".csv").c_str(),ios::out);
  
  dResult = (Double)(clock()-lBefore) / CLOCKS_PER_SEC;
  printf("\n Total Time: %12.3f sec.\n", dResult);
  
//  timeTabs << "Tempo;" << ((Double)(totalCount)) << endl;
//  timeTabs << "Tempo intra;" << ((Double)(intraCount)) << endl;
//  timeTabs << "Tempo intraCSC;" << ((Double)(intraCSCount)) << endl;
//  timeTabs << "Tempo intraPCM;" << ((Double)(intraPCMCount)) << endl;
//  timeTabs << "Tempo inter;" << ((Double)(interCount)) << endl;
//  timeTabs << "Tempo intraBC;" << ((Double)(intraBCCount)) << endl;
//  timeTabs << "Tempo hash inter;" << ((Double)(HashInterCount)) << endl;
//  timeTabs << "Tempo palette;" <<((Double)(PalletMCount)) << endl;
    
  timeTabs << ((Double)(totalCount)) << ";" << ((Double)(intraCount)) << ";"  << ((Double)(interCount)) << ";" << ((Double)(intraBCCount)) << ";" << ((Double)(HashInterCount)) << ";" << ((Double)(PalletMCount));
  
  //timeTabs << endl;
  
//  countTabs << "Total CUs;" << totalCuCount << endl;
//  countTabs << "Intra CUs;" << intraCuCount << endl;
//  countTabs << "IntraBC CUs;" << ibcCuCount << endl;
//  countTabs << "Palette CUs;" << pltCuCount << endl;
//  countTabs << "Skip CUs;" << skipCount << endl;
//  countTabs << "??? CUs;" << unIdCount << endl;
  
  countTabs << totalCuCount << ";" << intraCuCount << ";" << ibcCuCount << ";" << pltCuCount << ";" << skipCount  << ";" << unIdCount;
  // destroy application encoder class
  
  // destroy application encoder class
  cTAppEncTop.destroy();

  return 0;
}
示例#6
0
文件: jctvc_glue.cpp 项目: 8l/libbpg
/* return the encoded data in *pbuf and the size. Return < 0 if error */
int jctvc_encode_picture(uint8_t **pbuf, Image *img, 
                         const HEVCEncodeParams *params)
{
    TAppEncTop  cTAppEncTop;
    int argc;
    char *argv[ARGV_MAX + 1];
    char buf[1024], infilename[1024], outfilename[1024];
    const char *str;
    FILE *f;
    uint8_t *out_buf;
    int out_buf_len, i;
    
#ifdef WIN32
    if (GetTempPath(sizeof(buf), buf) > sizeof(buf) - 1) {
        fprintf(stderr, "Temporary path too long\n");
        return -1;
    }
#else
    strcpy(buf, "/tmp/");
#endif
    snprintf(infilename, sizeof(infilename), "%sout%d.yuv", buf, getpid());
    snprintf(outfilename, sizeof(outfilename), "%sout%d.bin", buf, getpid());

    save_yuv(img, infilename);

    m_gcAnalyzeAll.clear();
    m_gcAnalyzeI.clear();
    m_gcAnalyzeP.clear();
    m_gcAnalyzeB.clear();
    m_gcAnalyzeAll_in.clear();
    
    cTAppEncTop.create();

    argc = 0;
    add_opt(&argc, argv, "jctvc"); /* dummy executable name */

    snprintf(buf, sizeof(buf),"--InputFile=%s", infilename);
    add_opt(&argc, argv, buf);
    snprintf(buf, sizeof(buf),"--BitstreamFile=%s", outfilename);
    add_opt(&argc, argv, buf);

    snprintf(buf, sizeof(buf),"--SourceWidth=%d", img->w);
    add_opt(&argc, argv, buf);

    snprintf(buf, sizeof(buf),"--SourceWidth=%d", img->w);
    add_opt(&argc, argv, buf);
    snprintf(buf, sizeof(buf),"--SourceHeight=%d", img->h);
    add_opt(&argc, argv, buf);
    snprintf(buf, sizeof(buf),"--InputBitDepth=%d", img->bit_depth);
    add_opt(&argc, argv, buf);

    switch(img->format) {
    case BPG_FORMAT_GRAY:
        str = "400";
        break;
    case BPG_FORMAT_420:
        str = "420";
        break;
    case BPG_FORMAT_422:
        str = "422";
        break;
    case BPG_FORMAT_444:
        str = "444";
        break;
    default:
        abort();
    }
    snprintf(buf, sizeof(buf),"--InputChromaFormat=%s", str);
    add_opt(&argc, argv, buf);

    snprintf(buf, sizeof(buf),"--QP=%d", params->qp);
    add_opt(&argc, argv, buf);
    
    snprintf(buf, sizeof(buf),"--SEIDecodedPictureHash=%d", 
             params->sei_decoded_picture_hash);
    add_opt(&argc, argv, buf);
    
    if (!params->verbose)
      add_opt(&argc, argv, "--Verbose=0");
      
    /* single frame */
    add_opt(&argc, argv, "--FramesToBeEncoded=1");
    
    /* no padding necessary (it is done before) */
    add_opt(&argc, argv, "--ConformanceWindowMode=0");
    
    /* dummy frame rate */
    add_opt(&argc, argv, "--FrameRate=25");

    /* general config */
    add_opt(&argc, argv, "--Profile=main_444_16_intra");

    add_opt(&argc, argv, "--QuadtreeTULog2MaxSize=5");
    add_opt(&argc, argv, "--QuadtreeTUMaxDepthIntra=3");

    add_opt(&argc, argv, "--IntraPeriod=1");
    add_opt(&argc, argv, "--GOPSize=1");
    add_opt(&argc, argv, "--TransformSkip=1");
    add_opt(&argc, argv, "--TransformSkipFast=1");

    /* Note: Format Range extension */
    if (img->format == BPG_FORMAT_444) {
        add_opt(&argc, argv, "--CrossComponentPrediction=1");
    }

    if (params->lossless) {
        add_opt(&argc, argv, "--CostMode=lossless");
        add_opt(&argc, argv, "--SAO=0");
        add_opt(&argc, argv, "--LoopFilterDisable");
        add_opt(&argc, argv, "--TransquantBypassEnableFlag");
        add_opt(&argc, argv, "--CUTransquantBypassFlagForce");
        add_opt(&argc, argv, "--ImplicitResidualDPCM");
        add_opt(&argc, argv, "--GolombRiceParameterAdaptation");
        add_opt(&argc, argv, "--HadamardME=0");
    }

    /* trailing NULL */
    argv[argc] = NULL;

    if (params->verbose >= 2) {
        int i;
        printf("Encode options:");
        for(i = 0; i < argc; i++) {
            printf(" %s", argv[i]);
        }
        printf("\n");
    }
    
    if(!cTAppEncTop.parseCfg( argc, argv )) {
        fprintf(stderr, "Error while parsing options\n");
        cTAppEncTop.destroy();
        return -1;
    }
    
    cTAppEncTop.encode();
    
    cTAppEncTop.destroy();
    
    for(i = 0; i < argc; i++)
        free(argv[i]);
    unlink(infilename);

    /* read output bitstream */
    f = fopen(outfilename, "rb");
    if (!f) {
        fprintf(stderr, "Could not open '%s'\n", outfilename);
        return -1;
    }
    
    fseek(f, 0, SEEK_END);
    out_buf_len = ftell(f);
    fseek(f, 0, SEEK_SET);
    out_buf = (uint8_t *)malloc(out_buf_len);
    if (fread(out_buf, 1, out_buf_len, f) != out_buf_len) {
        fprintf(stderr, "read error\n");
        fclose(f);
        free(out_buf);
        return -1;
    }
    fclose(f);
    unlink(outfilename);
    *pbuf = out_buf;
    return out_buf_len;
}
示例#7
0
//DANIEL END
int main(int argc, char* argv[])
{
  TAppEncTop  cTAppEncTop;

  // print information
  fprintf( stdout, "\n" );
  fprintf( stdout, "HM software: Encoder Version [%s]", NV_VERSION );
  fprintf( stdout, NVM_ONOS );
  fprintf( stdout, NVM_COMPILEDBY );
  fprintf( stdout, NVM_BITS );
  fprintf( stdout, "\n" );

  // create application encoder class
  cTAppEncTop.create();

  // parse configuration
  if(!cTAppEncTop.parseCfg( argc, argv ))
  {
    cTAppEncTop.destroy();
    return 1;
  }

  //DANIEL BEGIN
  int file;
  modes = fopen("modes", "w");
  results = fopen("results","w");
  if (mySearch)
  {
    input_modes = fopen("input_modes","r");
    file = fscanf(input_modes,"%d",&level8);
    file = fscanf(input_modes,"%d",&level16);
    file = fscanf(input_modes,"%d",&level32);
    file = fscanf(input_modes,"%d",&level64);
  }
  //DANIEL END

  // starting time
  double dResult;
  long lBefore = clock();
  //DANIEL BEGIN
  double diff_time;
  static struct timeval timer_start, timer_end;
  gettimeofday(&timer_start, NULL);
  //DANIEL END

  // call encoding function
  cTAppEncTop.encode();

  // ending time
  dResult = (double)(clock()-lBefore) / CLOCKS_PER_SEC;
  printf("\n Total Time: %12.3f sec.\n", dResult);
  //DANIEL BEGIN
  gettimeofday(&timer_end,NULL);
  diff_time = timer_end.tv_sec - timer_start.tv_sec + (timer_end.tv_usec - timer_start.tv_usec) / 1000000.0;

  // destroy application encoder class
  cTAppEncTop.destroy();

  //DANIEL BEGIN
  fprintf(results,"%.3f\n",diff_time);
  fclose(modes);
  fclose(results);
  if(mySearch)
    fclose(input_modes);
  //DANIEL END

  return 0;
}
示例#8
0
int main(int argc, char* argv[])
{
  TAppEncTop  cTAppEncTop;
  
  //DI BEGIN
  floatingClass acessAppEncTop;
  //DI END
  
  //DANIEL BEGIN
  time_perCU = fopen("time_perCU.txt","w");
  time_perTile = fopen("time_perTile.csv","w");
  //DANIEL END

  // print information
  fprintf( stdout, "\n" );
  fprintf( stdout, "HM software: Encoder Version [%s] (including RExt)", NV_VERSION );
  fprintf( stdout, NVM_ONOS );
  fprintf( stdout, NVM_COMPILEDBY );
  fprintf( stdout, NVM_BITS );
  fprintf( stdout, "\n\n" );

  // create application encoder class
  cTAppEncTop.create();

  // parse configuration
  try
  {
    if(!cTAppEncTop.parseCfg( argc, argv ))
    {
      cTAppEncTop.destroy();
#if RExt__ENVIRONMENT_VARIABLE_DEBUG_AND_TEST
      EnvVar::printEnvVar();
#endif
      return 1;
    }
  }
  catch (df::program_options_lite::ParseFailure &e)
  {
    std::cerr << "Error parsing option \""<< e.arg <<"\" with argument \""<< e.val <<"\"." << std::endl;
    return 1;
  }

#if RExt__PRINT_MACRO_VALUES
  printRExtMacroSettings();
#endif

#if RExt__ENVIRONMENT_VARIABLE_DEBUG_AND_TEST
  EnvVar::printEnvVarInUse();
#endif

  // starting time
  Double dResult;
  clock_t lBefore = clock();

  // call encoding function
  //DI BEGIN
  //Adicionando parametros no encode
  cTAppEncTop.encode(&acessAppEncTop);
  
  printf("Dado TAppEncTop_v2: %d\n", acessAppEncTop.getMaxTlayer());
  printf("Dado TEncTop_v2: %d\n", acessAppEncTop.getTestEncTop());
  printf("Dado TEncGOP_v2: %d\n", acessAppEncTop.getTestGOP());
  //DI END
  
  // ending time
  dResult = (Double)(clock()-lBefore) / CLOCKS_PER_SEC;
  printf("\n Total Time: %12.3f sec.\n", dResult);

  // destroy application encoder class
  cTAppEncTop.destroy();

  
    if(!flagUniformSpc) //Cauane
  {
    inputTileInfo.close();
  }
  return 0;
}