Changeset 1390 in 3DVCSoftware for branches/HTM-16.0-MV-draft-5/source/App


Ignore:
Timestamp:
13 Nov 2015, 17:00:20 (9 years ago)
Author:
tech
Message:

Removed 3D.

Location:
branches/HTM-16.0-MV-draft-5/source/App
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • branches/HTM-16.0-MV-draft-5/source/App/TAppDecoder/TAppDecCfg.cpp

    r1386 r1390  
    6666  Bool do_help = false;
    6767  string cfg_TargetDecLayerIdSetFile;
    68 #if NH_3D
    69   string cfg_ScaleOffsetFile;
    70 #endif
    7168  string outputColourSpaceConvert;
    7269  Int warnUnknowParameter = 0;
     
    8077  ("ReconFile,o",               m_reconFileName,                       string(""), "reconstructed YUV output file name\n"
    8178                                                                                   "YUV writing is skipped if omitted")
    82 #if NH_3D
    83   ("ScaleOffsetFile,p",         cfg_ScaleOffsetFile,                   string(""), "file with coded scales and offsets")
    84   ("Depth420OutputFlag",        m_depth420OutputFlag,                  true      , "Output depth layers in 4:2:0 ")
    85 #endif
    8679  ("WarnUnknowParameter,w",     warnUnknowParameter,                                  0, "warn for unknown configuration parameters instead of failing")
    8780  ("SkipFrames,s",              m_iSkipFrame,                          0,          "number of frames to skip before random access")
     
    148141  }
    149142
    150 #if NH_3D
    151   m_pchScaleOffsetFile = cfg_ScaleOffsetFile.empty() ? NULL : strdup(cfg_ScaleOffsetFile.c_str());
    152 #endif
    153143
    154144  if (m_bitstreamFileName.empty())
  • branches/HTM-16.0-MV-draft-5/source/App/TAppDecoder/TAppDecCfg.h

    r1386 r1390  
    9696  Bool          m_printPicOutput;                     ///< Print information on picture output
    9797  Bool          m_printReceivedNalus;                 ///< Print information on received NAL units
    98 #if NH_3D
    99   TChar*        m_pchScaleOffsetFile;                   ///< output coded scale and offset parameters
    100   Bool          m_depth420OutputFlag;                   ///< output depth layers in 4:2:0
    101 #endif
    10298
    10399  Void xAppendToFileNameEnd( const TChar* pchInputFileName, const TChar* pchStringToAppend, TChar*& rpchOutputFileName); ///< create filenames
     
    132128      m_outputBitDepth[channelTypeIndex] = 0;
    133129    }
    134 #if NH_3D
    135     m_pchScaleOffsetFile = NULL;
    136 #endif
    137130  }
    138131
  • branches/HTM-16.0-MV-draft-5/source/App/TAppDecoder/TAppDecTop.cpp

    r1386 r1390  
    9494  m_cvsStartFound                   = false;
    9595#endif
    96 #if NH_3D
    97     m_pScaleOffsetFile              = 0;
    98 #endif
    9996}
    10097
     
    131128#endif
    132129  m_reconFileName.clear();
    133 #if NH_3D
    134   if (m_pchScaleOffsetFile)
    135   {
    136     free (m_pchScaleOffsetFile);
    137     m_pchScaleOffsetFile = NULL;
    138   }
    139 #endif
    140130}
    141131
     
    405395  // initialize global variables
    406396  initROM();
    407 #if NH_3D_DMM
    408   initWedgeLists();
    409 #endif
    410397#else
    411398  // create decoder class
     
    453440    m_pcSeiColourRemappingInfoPrevious = NULL;
    454441  }
    455 #if NH_3D
    456   m_cCamParsCollector.uninit();
    457   if( m_pScaleOffsetFile )
    458   {
    459     ::fclose( m_pScaleOffsetFile );
    460   }
    461 #endif
    462442}
    463443
     
    465445{
    466446
    467 #if NH_3D
    468   m_cCamParsCollector.setCodeScaleOffsetFile( m_pScaleOffsetFile );
    469 #endif
    470447#if NH_MV
    471448  m_dpb.setPrintPicOutput(m_printPicOutput);
     
    10591036    xFinalizeAU ( );
    10601037
    1061 #if NH_3D
    1062   if( m_cCamParsCollector.isInitialized() )
    1063   {
    1064     m_cCamParsCollector.setSlice( 0 );
    1065   }
    1066 #endif
    10671038   xFlushOutput();
    10681039   m_dpb.emptyAllSubDpbs();
     
    10921063    m_newVpsActivatedbyCurAu  = true; //TBD
    10931064    m_newVpsActivatedbyCurPic = true;
    1094 #if NH_3D_VSO
    1095     m_dpb.setVPS( m_vps );
    1096 #endif
    10971065  }
    10981066
     
    12161184Void TAppDecTop::xFinalizeAU()
    12171185{
    1218 #if NH_3D
    1219   if ( !m_curAu.empty())
    1220   {
    1221     for (TComList<TComPic*>::iterator it = m_curAu.begin(); it != m_curAu.end(); it++)
    1222     {
    1223       TComPic* pic = (*it);
    1224       if ( !pic->getHasGeneratedRefPics() )
    1225       {
    1226         pic->compressMotion(1);
    1227       }
    1228     }
    1229   }
    1230 #endif
    12311186}
    12321187
     
    26882643      m_tDecTop[ decIdx ]->setDecodedSEIMessageOutputStream(&os);
    26892644    }
    2690 #if NH_3D
    2691    m_tDecTop[ decIdx ]->setCamParsCollector( &m_cCamParsCollector );
    2692 #endif
    26932645
    26942646    // append pic list of new decoder to PicLists
     
    29122864  }
    29132865
    2914 #if NH_3D
    2915   if( m_pchScaleOffsetFile )
    2916   {
    2917     m_pScaleOffsetFile = ::fopen( m_pchScaleOffsetFile, "wt" );
    2918     if (!m_pScaleOffsetFile)
    2919     {
    2920       fprintf(stderr, "\nUnable to open file `%s' for writing decoded Camera Parameters messages\n", m_pchScaleOffsetFile);
    2921       exit(EXIT_FAILURE);
    2922     }
    2923   }
    2924 #endif
    29252866}
    29262867
     
    30112952      conf.getWindowTopOffset()    + defDisp.getWindowTopOffset(),
    30122953      conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset(),
    3013 #if NH_3D
    3014       m_depth420OutputFlag && curPic->getIsDepth() ? CHROMA_420 : NUM_CHROMA_FORMAT
    3015 #else
    30162954      NUM_CHROMA_FORMAT
    3017 #endif
    30182955      , m_bClipOutputVideoToRec709Range);
    30192956  }
  • branches/HTM-16.0-MV-draft-5/source/App/TAppDecoder/TAppDecTop.h

    r1386 r1390  
    117117
    118118  Bool                            m_reconOpen           [ MAX_NUM_LAYERS ]; ///< reconstruction file opened
    119 #if NH_3D
    120   FILE*                           m_pScaleOffsetFile;
    121   CamParsCollector                m_cCamParsCollector;
    122 #endif
    123119#else
    124120  TDecTop                         m_cTDecTop;                     ///< decoder class
  • branches/HTM-16.0-MV-draft-5/source/App/TAppEncoder/TAppEncCfg.cpp

    r1386 r1390  
    7373#if NH_MV
    7474  MULTIVIEWMAIN = 6,
    75 #if NH_3D
    76   MAIN3D = 8,
    77 #endif
    7875#endif
    7976  MONOCHROME_8      = 1008,
     
    120117  m_targetPivotValue = NULL;
    121118
    122 #if KWU_RC_MADPRED_E0227
    123   m_depthMADPred = 0;
    124 #endif
    125119}
    126120
     
    181175  {
    182176    free ( m_pchBaseViewCameraNumbers );
    183   }
    184 #endif
    185 #if NH_3D_VSO
    186   if (  m_pchVSOConfig != NULL)
    187   {
    188     free (  m_pchVSOConfig );
    189   }
    190  
    191   if ( m_pchCameraParameterFile != NULL )
    192   {
    193     free ( m_pchCameraParameterFile );
    194177  }
    195178#endif
     
    276259  }
    277260#endif
    278 #if NH_3D
    279   in>>entry.m_interCompPredFlag;
    280 #endif
    281261
    282262  return in;
     
    312292#if NH_MV
    313293  ,{"multiview-main"     , Profile::MULTIVIEWMAIN      },
    314 #if NH_3D
    315    {"3d-main"            , Profile::MAIN3D             }
    316 #endif
    317294#endif
    318295
     
    341318#if NH_MV
    342319    {"multiview-main"     , MULTIVIEWMAIN   },
    343 #if NH_3D
    344     {"3d-main"            , MAIN3D          },
    345 #endif
    346320#endif
    347321    {"monochrome",         MONOCHROME_8     },
     
    726700  string        cfg_levels;
    727701  string        cfg_tiers;
    728 #if NH_3D
    729   cfg_dimensionLength.push_back( 2  );  // depth
    730   cfg_dimensionLength.push_back( 32 );  // texture
    731 #else
    732702  cfg_dimensionLength.push_back( 64 );
    733 #endif
    734703#endif
    735704
     
    807776#if NH_MV
    808777  ("NumberOfLayers",                 m_numberOfLayers     , 1,                     "Number of layers")
    809 #if !NH_3D                           
    810778  ("ScalabilityMask",                m_scalabilityMask    , 2                    , "Scalability Mask: 2: Multiview, 8: Auxiliary, 10: Multiview + Auxiliary")   
    811 #else                               
    812   ("ScalabilityMask",                m_scalabilityMask    , 3                    , "Scalability Mask, 1: Texture 3: Texture + Depth ")   
    813 #endif 
    814779  ("DimensionIdLen",                 m_dimensionIdLen     , cfg_dimensionLength  , "Number of bits used to store dimensions Id")
    815780  ("ViewOrderIndex",                 m_viewOrderIndex              , IntAry1d(1,0),                                 "View Order Index per layer")
    816781  ("ViewId",                         m_viewId                      , IntAry1d(1,0),                                 "View Id per View Order Index")
    817782  ("AuxId",                          m_auxId                       , IntAry1d(1,0),                                 "AuxId per layer")
    818 #if NH_3D_VSO
    819   ("DepthFlag",                      m_depthFlag                   , IntAry1d(1,0),                                 "Depth Flag")
    820 #endif
    821783  ("TargetEncLayerIdList",           m_targetEncLayerIdList        , IntAry1d(0,0),                                 "LayerIds in Nuh to be encoded") 
    822784  ("LayerIdInNuh",                   m_layerIdInNuh                , IntAry1d(1,0),                                 "LayerId in Nuh") 
     
    10951057#endif
    10961058
    1097 #if KWU_RC_VIEWRC_E0227
    1098   ("ViewWiseTargetBits, -vtbr" ,  m_viewTargetBits,  std::vector<Int>(1, 32), "View-wise target bit-rate setting")
    1099   ("TargetBitAssign, -ta", m_viewWiseRateCtrl, false, "View-wise rate control on/off")
    1100 #endif
    1101 #if KWU_RC_MADPRED_E0227
    1102   ("DepthMADPred, -dm", m_depthMADPred, (UInt)0, "Depth based MAD prediction on/off")
    1103 #endif
    11041059#if NH_MV
    11051060// A lot of this stuff could should actually be derived by the encoder.
     
    12821237  ("BaseViewCameraNumbers",                           m_pchBaseViewCameraNumbers,   (TChar *) 0                 , "Numbers of base views")
    12831238#endif
    1284 #if NH_3D
    1285   ("Depth420OutputFlag",                              m_depth420OutputFlag,           true                     , "Output depth layers in 4:2:0 ")
    1286 #endif
    1287 #if NH_3D_VSO 
    1288   ("CameraParameterFile,cpf",                         m_pchCameraParameterFile,    (TChar *) 0                 , "Camera Parameter File Name")
    1289   ("CodedCamParsPrecision",                           m_iCodedCamParPrecision,      STD_CAM_PARAMETERS_PRECISION, "precision for coding of camera parameters (in units of 2^(-x) luma samples)" )
    1290 
    1291   /* View Synthesis Optimization */
    1292   ("VSOConfig",                                       m_pchVSOConfig            , (TChar *) 0                   ,"VSO configuration")
    1293   ("VSO",                                             m_bUseVSO                 , false                         ,"Use VSO" )   
    1294   ("VSOMode",                                         m_uiVSOMode               , (UInt)   4                    ,"VSO Mode")
    1295   ("LambdaScaleVSO",                                  m_dLambdaScaleVSO         , (Double) 1                    ,"Lambda Scaling for VSO")
    1296   ("VSOLSTable",                                      m_bVSOLSTable             , true                          ,"Depth QP dependent video/depth rate allocation by Lagrange multiplier" )     
    1297   ("ForceLambdaScaleVSO",                             m_bForceLambdaScaleVSO    , false                         ,"Force using Lambda Scale VSO also in non-VSO-Mode")
    1298   ("AllowNegDist",                                    m_bAllowNegDist           , true                          ,"Allow negative Distortion in VSO")
    1299                                                                                                              
    1300   ("UseEstimatedVSD",                                 m_bUseEstimatedVSD        , true                          ,"Model based VSD estimation instead of rendering based for some encoder decisions" )     
    1301   ("VSOEarlySkip",                                    m_bVSOEarlySkip           , true                          ,"Early skip of VSO computation if synthesis error assumed to be zero" )     
    1302                                                                                                                
    1303   ("WVSO",                                            m_bUseWVSO                , true                          ,"Use depth fidelity term for VSO" )
    1304   ("VSOWeight",                                       m_iVSOWeight              , 10                            ,"Synthesized View Distortion Change weight" )
    1305   ("VSDWeight",                                       m_iVSDWeight              , 1                             ,"View Synthesis Distortion estimate weight" )
    1306   ("DWeight",                                         m_iDWeight                , 1                             ,"Depth Distortion weight" )
    1307 #endif //HHI_VSO
    13081239/* 3D- HEVC Tools */                                                           
    1309 #if NH_3D_QTL
    1310   ("QTL"                   ,                          m_bUseQTL                 , true                          , "Use depth quad tree limitation (encoder only)" )
    1311 #endif
    1312 #if NH_3D
    1313 
    1314   ("IvMvPredFlag"          ,                          m_ivMvPredFlag            , BoolAry1d(2,true)             , "Inter-view motion prediction"              )
    1315   ("IvMvScalingFlag"       ,                          m_ivMvScalingFlag         , BoolAry1d(2,true)             , "Inter-view motion vector scaling"          )
    1316   ("Log2SubPbSizeMinus3"   ,                          m_log2SubPbSizeMinus3     , 0                             , "Log2 minus 3 of sub Pb size"               )
    1317   ("IvResPredFlag"         ,                          m_ivResPredFlag           , true                          , "Inter-view residual prediction"            )
    1318   ("DepthRefinementFlag"   ,                          m_depthRefinementFlag     , true                          , "Depth to refine disparity"                 )
    1319   ("ViewSynthesisPredFlag" ,                          m_viewSynthesisPredFlag   , true                          , "View synthesis prediction"                 )
    1320   ("DepthBasedBlkPartFlag" ,                          m_depthBasedBlkPartFlag   , true                          , "Depth base block partitioning"             )
    1321   ("MpiFlag"               ,                          m_mpiFlag                 , true                          , "Motion inheritance from texture to depth"  )
    1322   ("Log2MpiSubPbSizeMinus3",                          m_log2MpiSubPbSizeMinus3  , 0                             , "Log2 minus 3 of sub Pb size for MPI"       )
    1323   ("IntraContourFlag"      ,                          m_intraContourFlag        , true                          , "Intra contour mode"                        )
    1324   ("IntraWedgeFlag"        ,                          m_intraWedgeFlag          , true                          , "Intra wedge mode and segmental depth DCs"  )
    1325   ("IntraSdcFlag"          ,                          m_intraSdcFlag            , true                          , "Intra depth DCs"                           )
    1326   ("QtPredFlag"            ,                          m_qtPredFlag              , true                          , "Quad tree prediction from texture to depth")
    1327   ("InterSdcFlag"          ,                          m_interSdcFlag            , true                          , "Inter depth DCs"                           )
    1328   ("DepthIntraSkip"        ,                          m_depthIntraSkipFlag      , true                          , "Depth intra skip mode"                     )
    1329   ("DLT"                   ,                          m_useDLT                  , true                          , "Depth lookup table"                        )
    1330   ("IlluCompEnable"        ,                          m_abUseIC                 , true                          , "Enable illumination compensation"          )
    1331   ("IlluCompLowLatencyEnc" ,                          m_bUseLowLatencyICEnc     , false                         , "Enable low-latency illumination compensation encoding")
    1332 #endif //NH_3D
    13331240   
    13341241  ;
     
    15361443  if( cfg_profiles.empty() )
    15371444  {
    1538 #if NH_3D
    1539     cfg_profiles = string("main main 3d-main");
    1540 #else
    15411445    cfg_profiles = string("main main multiview-main");   
    1542 #endif
    15431446    fprintf(stderr, "\nWarning: No profiles given, using defaults: %s", cfg_profiles.c_str() );
    15441447    anyEmpty = true;
     
    18071710  xResizeVector( m_auxId );
    18081711
    1809 #if NH_3D_VSO
    1810   xResizeVector( m_depthFlag );
    1811 #endif
    18121712  xResizeVector( m_fQP );
    18131713
     
    20171917
    20181918
    2019 #if NH_3D_VSO
    2020   // Table base optimization
    2021   // Q&D
    2022   Double adLambdaScaleTable[] =
    2023   {  0.031250, 0.031639, 0.032029, 0.032418, 0.032808, 0.033197, 0.033586, 0.033976, 0.034365, 0.034755,
    2024   0.035144, 0.035533, 0.035923, 0.036312, 0.036702, 0.037091, 0.037480, 0.037870, 0.038259, 0.038648,
    2025   0.039038, 0.039427, 0.039817, 0.040206, 0.040595, 0.040985, 0.041374, 0.041764, 0.042153, 0.042542,
    2026   0.042932, 0.043321, 0.043711, 0.044100, 0.044194, 0.053033, 0.061872, 0.070711, 0.079550, 0.088388,
    2027   0.117851, 0.147314, 0.176777, 0.235702, 0.294628, 0.353553, 0.471405, 0.589256, 0.707107, 0.707100,
    2028   0.753550, 0.800000 
    2029   };
    2030   if ( m_bUseVSO && m_bVSOLSTable )
    2031   {
    2032     Int firstDepthLayer = -1;
    2033     for (Int layer = 0; layer < m_numberOfLayers; layer++ )
    2034     {
    2035       if ( m_depthFlag[ layer ]  || m_auxId[ layer ] == 2 )
    2036       {
    2037         firstDepthLayer = layer;
    2038         break;
    2039       }
    2040     }
    2041     AOT( firstDepthLayer == -1 );
    2042     AOT( (m_iQP[firstDepthLayer] < 0) || (m_iQP[firstDepthLayer] > 51));
    2043     m_dLambdaScaleVSO *= adLambdaScaleTable[m_iQP[firstDepthLayer]];
    2044   }
    2045   if ( m_bUseVSO && m_uiVSOMode == 4)
    2046   {
    2047     m_cRenModStrParser.setString( m_iNumberOfViews, m_pchVSOConfig );
    2048     m_cCameraData     .init     ( ((UInt) m_iNumberOfViews ),
    2049       m_internalBitDepth[ CHANNEL_TYPE_LUMA],
    2050       (UInt)m_iCodedCamParPrecision,
    2051       m_FrameSkip,
    2052       (UInt)m_framesToBeEncoded,
    2053       m_pchCameraParameterFile,
    2054       m_pchBaseViewCameraNumbers,
    2055       NULL,
    2056       m_cRenModStrParser.getSynthViews(),
    2057       LOG2_DISP_PREC_LUT );
    2058   }
    2059   else if ( m_bUseVSO && m_uiVSOMode != 4 )
    2060   {
    2061     m_cCameraData     .init     ( ((UInt) m_iNumberOfViews ),
    2062       m_internalBitDepth[ CHANNEL_TYPE_LUMA],
    2063       (UInt)m_iCodedCamParPrecision,
    2064       m_FrameSkip,
    2065       (UInt)m_framesToBeEncoded,
    2066       m_pchCameraParameterFile,
    2067       m_pchBaseViewCameraNumbers,
    2068       m_pchVSOConfig,
    2069       NULL,
    2070       LOG2_DISP_PREC_LUT );
    2071   }
    2072 #if NH_3D
    2073   else
    2074   {
    2075     m_cCameraData     .init     ( ((UInt) m_iNumberOfViews ),
    2076       m_internalBitDepth[ CHANNEL_TYPE_LUMA],
    2077       (UInt) m_iCodedCamParPrecision,
    2078       m_FrameSkip,
    2079       (UInt) m_framesToBeEncoded,
    2080       m_pchCameraParameterFile,
    2081       m_pchBaseViewCameraNumbers,
    2082       NULL,
    2083       NULL,
    2084       LOG2_DISP_PREC_LUT );
    2085   }
    2086   m_cCameraData.check( false, true );
    2087 #endif
    2088 #endif
    20891919
    20901920  // check validity of input parameters
     
    22642094  xConfirmPara( (m_layerIdInNuh.size()!=1) && (m_layerIdInNuh.size() < m_numberOfLayers) , "LayerIdInNuh must be given for all layers. ");
    22652095
    2266 #if NH_3D
    2267   xConfirmPara( m_scalabilityMask != 2 && m_scalabilityMask != 3, "Scalability Mask must be equal to 2 or 3. ");
    2268 #else
    22692096  xConfirmPara( m_scalabilityMask != 2 && m_scalabilityMask != 8 && m_scalabilityMask != 10, "Scalability Mask must be equal to 2, 8 or 10");
    2270 #endif
    2271 
    2272 #if NH_3D_VSO
    2273   if ( m_scalabilityMask & ( 1 << DEPTH_ID ) )
    2274   {
    2275     m_dimIds.push_back( m_depthFlag );
    2276   }
    2277 #endif
     2097
    22782098
    22792099  m_dimIds.push_back( m_viewOrderIndex );   
     
    23422162      xConfirmPara( allEqual , "Each layer shall have a different position in scalability space." );
    23432163
    2344 #if !H_3D_FCO
    23452164      if ( numDiff  == 1 )
    23462165      {
     
    23532172        xConfirmPara( shallBeButIsNotIncreasing,  "DimensionIds shall be increasing within one dimension. " );
    23542173      }
    2355 #endif
    23562174    }
    23572175  }
     
    25602378  xConfirmPara(  m_maxNumMergeCand < 1,  "MaxNumMergeCand must be 1 or greater.");
    25612379  xConfirmPara(  m_maxNumMergeCand > 5,  "MaxNumMergeCand must be 5 or smaller.");
    2562 #if NH_3D
    2563   xConfirmPara( m_log2SubPbSizeMinus3 < 0,                                        "Log2SubPbSizeMinus3 must be equal to 0 or greater.");
    2564   xConfirmPara( m_log2SubPbSizeMinus3 > 3,                                        "Log2SubPbSizeMinus3 must be equal to 3 or smaller.");
    2565   xConfirmPara( (1<< ( m_log2SubPbSizeMinus3 + 3) ) > m_uiMaxCUWidth,              "Log2SubPbSizeMinus3 must be  equal to log2(maxCUSize)-3 or smaller.");
    2566  
    2567   xConfirmPara( m_log2MpiSubPbSizeMinus3 < 0,                                        "Log2MpiSubPbSizeMinus3 must be equal to 0 or greater.");
    2568   xConfirmPara( m_log2MpiSubPbSizeMinus3 > 3,                                        "Log2MpiSubPbSizeMinus3 must be equal to 3 or smaller.");
    2569   xConfirmPara( (1<< (m_log2MpiSubPbSizeMinus3 + 3)) > m_uiMaxCUWidth,               "Log2MpiSubPbSizeMinus3 must be equal to log2(maxCUSize)-3 or smaller.");
    2570 #endif
    25712380#if ADAPTIVE_QP_SELECTION
    25722381#if NH_MV
     
    26292438  }
    26302439
    2631 #if NH_3D_VSO
    2632   xConfirmPara( m_pchCameraParameterFile    == 0                ,   "CameraParameterFile must be given");
    2633   xConfirmPara( m_pchBaseViewCameraNumbers  == 0                ,   "BaseViewCameraNumbers must be given" );
    2634   xConfirmPara( m_iNumberOfViews != m_cCameraData.getBaseViewNumbers().size() ,   "Number of Views in BaseViewCameraNumbers must be equal to NumberOfViews" );
    2635   xConfirmPara    ( m_iCodedCamParPrecision < 0 || m_iCodedCamParPrecision > 5,       "CodedCamParsPrecision must be in range of 0..5" );
    2636     if( m_bUseVSO )
    2637     {
    2638       xConfirmPara(   m_pchVSOConfig            == 0                             ,   "VSO Setup string must be given");
    2639       xConfirmPara( m_uiVSOMode > 4 ,                                                "VSO Mode must be less than 5");
    2640     }
    2641 #endif
    26422440  // max CU width and height should be power of 2
    26432441  UInt ui = m_uiMaxCUWidth;
     
    33933191  xPrintParaVector( "AuxId", m_auxId );
    33943192#endif
    3395 #if NH_3D_VSO
    3396   xPrintParaVector( "DepthLayerFlag", m_depthFlag );
    3397   printf("Coded Camera Param. Precision     : %d\n", m_iCodedCamParPrecision); 
    3398 #endif
    33993193#if NH_MV 
    34003194  xPrintParaVector( "QP"               , m_fQP                );
     
    35733367#endif
    35743368
    3575 #if KWU_RC_MADPRED_E0227
    3576     printf("Depth based MAD prediction   : %d\n", m_depthMADPred);
    3577 #endif
    3578 #if KWU_RC_VIEWRC_E0227
    3579     printf("View-wise Rate control       : %d\n", m_viewWiseRateCtrl);
    3580     if(m_viewWiseRateCtrl)
    3581     {
    3582 
    3583       printf("ViewWiseTargetBits           : ");
    3584       for (Int i = 0 ; i < m_iNumberOfViews ; i++)
    3585         printf("%d ", m_viewTargetBits[i]);
    3586       printf("\n");
    3587     }
    3588     else
    3589     {
    3590       printf("TargetBitrate                : %d\n", m_RCTargetBitrate );
    3591     }
    3592 #endif
    35933369
    35943370  }
    35953371
    35963372  printf("Max Num Merge Candidates          : %d\n", m_maxNumMergeCand);
    3597 #if NH_3D_VSO
    3598   printf("BaseViewCameraNumbers             : %s\n", m_pchBaseViewCameraNumbers );
    3599   printf("Coded Camera Param. Precision     : %d\n", m_iCodedCamParPrecision);
    3600   printf("Force use of Lambda Scale         : %d\n", m_bForceLambdaScaleVSO );
    3601 
    3602   if ( m_bUseVSO )
    3603   {   
    3604     printf("VSO Lambda Scale                  : %5.2f\n", m_dLambdaScaleVSO );
    3605     printf("VSO Mode                          : %d\n",    m_uiVSOMode       );
    3606     printf("VSO Config                        : %s\n",    m_pchVSOConfig    );
    3607     printf("VSO Negative Distortion           : %d\n",    m_bAllowNegDist ? 1 : 0);
    3608     printf("VSO LS Table                      : %d\n",    m_bVSOLSTable ? 1 : 0);
    3609     printf("VSO Estimated VSD                 : %d\n",    m_bUseEstimatedVSD ? 1 : 0);
    3610     printf("VSO Early Skip                    : %d\n",    m_bVSOEarlySkip ? 1 : 0);   
    3611     if ( m_bUseWVSO )
    3612     {
    3613       printf("Dist. Weights (VSO/VSD/SAD)       : %d/%d/%d\n ", m_iVSOWeight, m_iVSDWeight, m_iDWeight );   
    3614     }   
    3615   }
    3616 #endif //HHI_VSO
    36173373  printf("\n");
    36183374#if NH_MV
     
    36773433  printf(" SignBitHidingFlag:%d ", m_signHideFlag);
    36783434  printf("RecalQP:%d", m_recalculateQPAccordingToLambda ? 1 : 0 );
    3679 #if NH_3D_VSO
    3680   printf(" VSO:%d ", m_bUseVSO   );
    3681   printf("WVSO:%d ", m_bUseWVSO ); 
    3682 #endif
    3683 #if NH_3D_QTL
    3684   printf( "QTL:%d "                  , m_bUseQTL);
    3685 #endif
    3686 #if NH_3D
    3687   printf( "IlluCompEnable:%d "       , m_abUseIC);
    3688   printf( "IlluCompLowLatencyEnc:%d ",  m_bUseLowLatencyICEnc);
    3689   printf( "DLT:%d ", m_useDLT );
    3690 
    3691 
    3692   printf( "IvMvPred:%d %d "            , m_ivMvPredFlag[0] ? 1 : 0, m_ivMvPredFlag[1]  ? 1 : 0);
    3693   printf( "IvMvScaling:%d %d "         , m_ivMvScalingFlag[0] ? 1 : 0 , m_ivMvScalingFlag[1]  ? 1 : 0);
    3694 
    3695   printf( "Log2SubPbSizeMinus3:%d "    , m_log2SubPbSizeMinus3            );
    3696   printf( "IvResPred:%d "              , m_ivResPredFlag          ? 1 : 0 );
    3697   printf( "DepthRefinement:%d "        , m_depthRefinementFlag    ? 1 : 0 );
    3698   printf( "ViewSynthesisPred:%d "      , m_viewSynthesisPredFlag  ? 1 : 0 );
    3699   printf( "DepthBasedBlkPart:%d "      , m_depthBasedBlkPartFlag  ? 1 : 0 );
    3700   printf( "Mpi:%d "                    , m_mpiFlag                ? 1 : 0 );
    3701   printf( "Log2MpiSubPbSizeMinus3:%d " , m_log2MpiSubPbSizeMinus3         );
    3702   printf( "IntraContour:%d "           , m_intraContourFlag       ? 1 : 0 );
    3703   printf( "IntraWedge:%d "             , m_intraWedgeFlag         ? 1 : 0 );
    3704   printf( "IntraSdc:%d "               , m_intraSdcFlag           ? 1 : 0 );
    3705   printf( "QtPred:%d "                 , m_qtPredFlag             ? 1 : 0 );
    3706   printf( "InterSdc:%d "               , m_interSdcFlag           ? 1 : 0 );
    3707   printf( "DepthIntraSkip:%d "         , m_depthIntraSkipFlag     ? 1 : 0 );
    3708 #endif
    37093435
    37103436  printf("\n\n");
  • branches/HTM-16.0-MV-draft-5/source/App/TAppEncoder/TAppEncCfg.h

    r1386 r1390  
    4444#include <sstream>
    4545#include <vector>
    46 #if NH_3D
    47 #include "TAppCommon/TAppComCamPara.h"
    48 #include "TLibRenderer/TRenModel.h"
    49 #include "TLibRenderer/TRenModSetupStrParser.h"
    50 #endif
    5146//! \ingroup TAppEncoder
    5247//! \{
     
    8075  IntAry1d               m_viewOrderIndex;                    ///< view order index 
    8176  IntAry1d               m_auxId;                             ///< auxiliary id
    82 #if NH_3D_VSO
    83   IntAry1d               m_depthFlag;                         ///< depth flag
    84 #endif
    8577  IntAry1d               m_targetEncLayerIdList;              ///< layer Ids in Nuh to be encoded
    8678  IntAry1d               m_layerIdInNuh;                      ///< layer Id in Nuh for each layer
     
    131123  Bool      m_singleLayerForNonIrapFlag;
    132124  Bool      m_higherLayerIrapSkipFlag;
    133 #if NH_3D
    134   Bool      m_abUseIC;
    135   Bool      m_bUseLowLatencyICEnc;
    136 #endif
    137125#endif
    138126  // Lambda modifiers
     
    464452#endif
    465453
    466 #if KWU_RC_VIEWRC_E0227
    467   vector<Int>     m_viewTargetBits;
    468   Bool      m_viewWiseRateCtrl;                              ///< Flag for using view-wise rate control
    469 #endif
    470 #if KWU_RC_MADPRED_E0227
    471   UInt       m_depthMADPred;
    472 #endif
    473454
    474455  ScalingListMode m_useScalingListId;                         ///< using quantization matrix
     
    527508#endif
    528509
    529 #if NH_3D
    530   // Output Format
    531   Bool      m_depth420OutputFlag;                             ///< Output depth layers in 4:2:0 format
    532 #endif
    533510    // Camera parameters
    534 #if NH_3D_VSO
    535   TChar*    m_pchCameraParameterFile;                         ///< camera parameter file
    536   TAppComCamPara m_cCameraData;
    537   Int       m_iCodedCamParPrecision;                          ///< precision for coding of camera parameters
    538   TChar*    m_pchVSOConfig;
    539   Bool      m_bUseVSO;                                        ///< flag for using View Synthesis Optimization
    540   Bool      m_bVSOLSTable;                                    ///< Depth QP dependent Lagrange parameter optimization (m23714)
    541   Bool      m_bVSOEarlySkip;                                  ///< Early skip of VSO computation (JCT3V-A0093 modification 4)
    542                                                              
    543   //// Used for development by GT, might be removed later     
    544   Double    m_dLambdaScaleVSO;                                ///< Scaling factor for Lambda in VSO mode
    545   Bool      m_bForceLambdaScaleVSO;                           ///< Use Lambda Scale for depth even if VSO is turned off
    546   Bool      m_bAllowNegDist;                                  ///< Allow negative distortion in VSO
    547   UInt      m_uiVSOMode;                                      ///< Number of VSO Mode, 1 = , 2 = simple, org vs. ren, 3 = simple, ren vs. ren, 4 = full 
    548                                                              
    549   // SAIT_VSO_EST_A0033                                       
    550   Bool      m_bUseEstimatedVSD;                               ///< Flag for using model based VSD estimation instead of VSO for some encoder decisions (JCT3V-A0033 modification 3) 
    551                                                              
    552   // LGE_WVSO_A0119                                           
    553   Bool      m_bUseWVSO;                                       ///< flag for using View Synthesis Optimization 
    554   Int       m_iVSOWeight;
    555   Int       m_iVSDWeight;
    556   Int       m_iDWeight;
    557 
    558   // Ren Model String
    559   TRenModSetupStrParser       m_cRenModStrParser;
    560 #endif
    561 #if NH_3D
    562   Bool       m_useDLT;                                        ///< flag for using DLT
    563 #endif
    564 #if NH_3D_QTL
    565   Bool       m_bUseQTL;                                        ///< flag for using depth QuadTree Limitation
    566 #endif
    567 #if NH_3D
    568   BoolAry1d  m_ivMvPredFlag;
    569   BoolAry1d  m_ivMvScalingFlag;
    570   Int        m_log2SubPbSizeMinus3;
    571   Bool       m_ivResPredFlag;
    572   Bool       m_depthRefinementFlag;
    573   Bool       m_viewSynthesisPredFlag;
    574   Bool       m_depthBasedBlkPartFlag;
    575   Bool       m_mpiFlag;
    576   Int        m_log2MpiSubPbSizeMinus3;
    577   Bool       m_intraContourFlag;
    578   Bool       m_intraWedgeFlag;
    579   Bool       m_intraSdcFlag;
    580   Bool       m_qtPredFlag;
    581   Bool       m_interSdcFlag;
    582   Bool       m_depthIntraSkipFlag;
    583 #endif
    584511  // internal member functions
    585512  Void  xCheckParameter ();                                   ///< check validity of configuration values
  • branches/HTM-16.0-MV-draft-5/source/App/TAppEncoder/TAppEncTop.cpp

    r1386 r1390  
    8787#endif
    8888 
    89 #if NH_3D
    90   vps.createCamPars(m_iNumberOfViews); 
    91 #endif
    92 
    93 #if NH_3D_DLT
    94   TComDLT dlt = TComDLT();
    95 #endif
     89
    9690
    9791#if NH_MV
     
    145139  xSetDpbSize              ( vps );
    146140  xSetVPSVUI               ( vps );
    147 #if NH_3D
    148   xSetCamPara              ( vps );
    149 #endif
    150 #if NH_3D_VSO
    151   m_ivPicLists.setVPS      ( &vps );
    152 #endif
    153 #if NH_3D_DLT
    154   xDeriveDltArray          ( vps, &dlt );
    155 #endif
    156141  if ( m_targetEncLayerIdList.size() == 0 )
    157142  {
     
    184169  }
    185170
    186 #if NH_3D
    187   // Set 3d tool parameters
    188   for (Int d = 0; d < 2; d++)
    189   { 
    190     m_sps3dExtension.setIvDiMcEnabledFlag          ( d, m_ivMvPredFlag[d]       );
    191     m_sps3dExtension.setIvMvScalEnabledFlag       ( d, m_ivMvScalingFlag[d]    );
    192     if (d == 0 )
    193     {   
    194       m_sps3dExtension.setLog2IvmcSubPbSizeMinus3   ( d, m_log2SubPbSizeMinus3   );
    195       m_sps3dExtension.setIvResPredEnabledFlag         ( d, m_ivResPredFlag         );
    196       m_sps3dExtension.setDepthRefEnabledFlag   ( d, m_depthRefinementFlag   );
    197       m_sps3dExtension.setVspMcEnabledFlag ( d, m_viewSynthesisPredFlag );
    198       m_sps3dExtension.setDbbpEnabledFlag ( d, m_depthBasedBlkPartFlag );
    199     }
    200     else
    201     {   
    202       m_sps3dExtension.setTexMcEnabledFlag               ( d, m_mpiFlag               );
    203       m_sps3dExtension.setLog2TexmcSubPbSizeMinus3( d, m_log2MpiSubPbSizeMinus3);
    204       m_sps3dExtension.setIntraContourEnabledFlag      ( d, m_intraContourFlag      );
    205       m_sps3dExtension.setIntraDcOnlyWedgeEnabledFlag     ( d, m_intraSdcFlag || m_intraWedgeFlag     );
    206       m_sps3dExtension.setCqtCuPartPredEnabledFlag            ( d, m_qtPredFlag            );
    207       m_sps3dExtension.setInterDcOnlyEnabledFlag          ( d, m_interSdcFlag          );
    208       m_sps3dExtension.setSkipIntraEnabledFlag    ( d, m_depthIntraSkipFlag    ); 
    209     }
    210   }
    211 #endif
    212171
    213172
     
    219178    m_acTVideoIOYuvInputFileList.push_back(new TVideoIOYuv);
    220179    m_acTVideoIOYuvReconFileList.push_back(new TVideoIOYuv);
    221 #if NH_3D   
    222     Int profileIdc = -1;
    223     for (Int olsIdx = 0; olsIdx < vps.getNumOutputLayerSets(); olsIdx++ )
    224     {   
    225       Int lsIdx = vps.olsIdxToLsIdx( olsIdx );
    226       for(Int i = 0; i < vps.getNumLayersInIdList( lsIdx ); i++ )
    227       {
    228         if( vps.getLayerIdInNuh( layerIdInVps) == vps.getLayerSetLayerIdList(lsIdx, i) )
    229         {
    230           Int ptlIdx = vps.getProfileTierLevelIdx( olsIdx, i );
    231           if ( ptlIdx != -1 )
    232           {
    233             Int curProfileIdc = vps.getPTL(ptlIdx)->getGeneralPTL()->getProfileIdc();
    234             if (profileIdc == -1)   
    235             {
    236               profileIdc = curProfileIdc;
    237             }
    238             else
    239             {   
    240               if ( profileIdc != curProfileIdc )
    241               {             
    242                 fprintf(stderr, "Error: ProfileIdc for layer with index %d in VPS not equal in all OLSs. \n", layerIdInVps );
    243                 exit(EXIT_FAILURE);
    244               }
    245             }
    246           }
    247         }
    248       }
    249     }
    250 
    251     if (profileIdc == -1 )
    252     {
    253       fprintf(stderr, "Error: No profile given for layer with index %d in VPS not equal in all OLS. \n", layerIdInVps );
    254       exit(EXIT_FAILURE);
    255     }
    256     m_acTEncTopList[ layerIdInVps ]->setProfileIdc( profileIdc );
    257 #endif
    258180  }
    259181
     
    278200    m_cTEncTop.setViewId                       ( vps.getViewId      (  layerId ) );
    279201    m_cTEncTop.setViewIndex                    ( vps.getViewIndex   (  layerId ) );
    280 #if NH_3D_VSO
    281     Bool isDepth    = ( vps.getDepthId     ( layerId ) != 0  ) ;
    282     Bool isAuxDepth = ( vps.getAuxId       ( layerId ) ==  2 ) ; // TBD: define 2 as AUX_DEPTH
    283     m_cTEncTop.setIsDepth                  ( isDepth    );
    284     m_cTEncTop.setIsAuxDepth               ( isAuxDepth );
    285     //====== Camera Parameters =========
    286     m_cTEncTop.setCameraParameters             ( &m_cCameraData );     
    287     //====== VSO =========
    288     m_cTEncTop.setRenderModelParameters        ( &m_cRenModStrParser );
    289     m_cTEncTop.setForceLambdaScaleVSO          ( isDepth || isAuxDepth ? m_bForceLambdaScaleVSO : false );
    290     m_cTEncTop.setLambdaScaleVSO               ( isDepth || isAuxDepth ? m_dLambdaScaleVSO      : 1     );
    291     m_cTEncTop.setVSOMode                      ( isDepth || isAuxDepth ? m_uiVSOMode            : 0     );
    292 
    293     m_cTEncTop.setAllowNegDist                 ( isDepth || isAuxDepth ? m_bAllowNegDist        : false );
    294 
    295     // SAIT_VSO_EST_A0033
    296     m_cTEncTop.setUseEstimatedVSD              ( isDepth || isAuxDepth ? m_bUseEstimatedVSD     : false );
    297 
    298     // LGE_WVSO_A0119
    299     m_cTEncTop.setUseWVSO                      ( isDepth || isAuxDepth ? m_bUseWVSO             : false );   
    300     m_cTEncTop.setVSOWeight                    ( isDepth || isAuxDepth ? m_iVSOWeight           : 0     );
    301     m_cTEncTop.setVSDWeight                    ( isDepth || isAuxDepth ? m_iVSDWeight           : 0     );
    302     m_cTEncTop.setDWeight                      ( isDepth || isAuxDepth ? m_iDWeight             : 0     );
    303 #endif // H_3D_VSO
    304 #if NH_3D
    305 #if NH_3D_IC
    306     m_cTEncTop.setUseIC                        ( vps.getViewIndex( layerId ) == 0 || isDepth ? false : m_abUseIC );
    307     m_cTEncTop.setUseICLowLatencyEnc           ( m_bUseLowLatencyICEnc );
    308 #endif
    309 
    310    
    311     m_cTEncTop.setUseDMM                       ( isDepth ? m_intraWedgeFlag   : false );
    312     m_cTEncTop.setUseSDC                       ( isDepth ? m_intraSdcFlag     : false );
    313     m_cTEncTop.setUseDLT                       ( isDepth ? m_useDLT   : false );
    314 #endif
    315 #if NH_3D_QTL
    316     m_cTEncTop.setUseQTL                       ( isDepth || isAuxDepth ? m_bUseQTL  : false );
    317 #endif
    318 #if NH_3D
    319     m_cTEncTop.setSps3dExtension               ( m_sps3dExtension );
    320 #endif // NH_3D
    321202
    322203    m_cTEncTop.setIvPicLists                   ( &m_ivPicLists );
     
    324205  m_cTEncTop.setVPS(&vps);
    325206
    326 #if NH_3D_DLT
    327   m_cTEncTop.setDLT(dlt);
    328 #endif
    329207
    330208#if NH_MV
     
    438316  m_cTEncTop.setChromaCrQpOffset                                  ( m_crQpOffset  );
    439317
    440 #if NH_3D
    441   m_cTEncTop.setChromaFormatIdc                                   ( isDepth ? CHROMA_400 : m_chromaFormatIDC );
    442 #else
    443318  m_cTEncTop.setChromaFormatIdc                                   ( m_chromaFormatIDC  );
    444 #endif
    445319
    446320#if ADAPTIVE_QP_SELECTION
     
    651525  m_cTEncTop.setScalingListFileName                               ( m_scalingListFileName );
    652526  m_cTEncTop.setSignHideFlag                                      ( m_signHideFlag);
    653 #if KWU_RC_VIEWRC_E0227 || KWU_RC_MADPRED_E0227
    654   if(!m_cTEncTop.getIsDepth())    //only for texture
    655   {
    656     m_cTEncTop.setUseRateCtrl                                     ( m_RCEnableRateControl );
    657   }                                                         
    658   else                                                       
    659   {                                                         
    660     m_cTEncTop.setUseRateCtrl                                     ( 0 );
    661   }
    662 #else
    663527  m_cTEncTop.setUseRateCtrl                                       ( m_RCEnableRateControl );
    664 #endif
    665 #if !KWU_RC_VIEWRC_E0227
    666528  m_cTEncTop.setTargetBitrate                                     ( m_RCTargetBitrate );
    667 #endif
    668529  m_cTEncTop.setKeepHierBit                                       ( m_RCKeepHierarchicalBit );
    669530  m_cTEncTop.setLCULevelRC                                        ( m_RCLCULevelRC );
     
    677538#endif
    678539
    679 #if KWU_RC_MADPRED_E0227
    680   if(m_cTEncTop.getUseRateCtrl() && !m_cTEncTop.getIsDepth())
    681   {
    682     m_cTEncTop.setUseDepthMADPred(layerIdInVps ? m_depthMADPred       : 0);
    683     if(m_cTEncTop.getUseDepthMADPred())
    684     {
    685       m_cTEncTop.setCamParam(&m_cCameraData);
    686     }
    687   }
    688 #endif
    689 #if KWU_RC_VIEWRC_E0227
    690   if(m_cTEncTop.getUseRateCtrl() && !m_cTEncTop.getIsDepth())
    691   {
    692     m_cTEncTop.setUseViewWiseRateCtrl(m_viewWiseRateCtrl);
    693     if(m_iNumberOfViews == 1)
    694     {
    695       if(m_viewWiseRateCtrl)
    696       {
    697         m_cTEncTop.setTargetBitrate(m_viewTargetBits[layerIdInVps>>1]);
    698       }
    699       else
    700       {
    701         m_cTEncTop.setTargetBitrate       ( m_RCTargetBitrate );
    702       }
    703     }
    704     else
    705     {
    706       if(m_viewWiseRateCtrl)
    707       {
    708         m_cTEncTop.setTargetBitrate(m_viewTargetBits[layerIdInVps>>1]);
    709       }
    710       else
    711       {
    712         if(m_iNumberOfViews == 2)
    713         {
    714           if(m_cTEncTop.getViewId() == 0)
    715           {
    716             m_cTEncTop.setTargetBitrate              ( (m_RCTargetBitrate*80)/100 );
    717           }
    718           else if(m_cTEncTop.getViewId() == 1)
    719           {
    720             m_cTEncTop.setTargetBitrate              ( (m_RCTargetBitrate*20)/100 );
    721           }
    722         }
    723         else if(m_iNumberOfViews == 3)
    724         {
    725           if(m_cTEncTop.getViewId() == 0)
    726           {
    727             m_cTEncTop.setTargetBitrate              ( (m_RCTargetBitrate*66)/100 );
    728           }
    729           else if(m_cTEncTop.getViewId() == 1)
    730           {
    731             m_cTEncTop.setTargetBitrate              ( (m_RCTargetBitrate*17)/100 );
    732           }
    733           else if(m_cTEncTop.getViewId() == 2)
    734           {
    735             m_cTEncTop.setTargetBitrate              ( (m_RCTargetBitrate*17)/100 );
    736           }
    737         }
    738         else
    739         {
    740           m_cTEncTop.setTargetBitrate              ( m_RCTargetBitrate );
    741         }
    742       }
    743     }
    744   }
    745 #endif
    746540  m_cTEncTop.setTransquantBypassEnableFlag                        ( m_TransquantBypassEnableFlag );
    747541  m_cTEncTop.setCUTransquantBypassFlagForceValue                  ( m_CUTransquantBypassFlagForce );
     
    790584  }
    791585#endif
    792 #if NH_3D_VSO
    793   if ( m_bUseVSO )
    794   {
    795     if ( m_uiVSOMode == 4 )
    796     {
    797 #if H_3D_VSO_EARLY_SKIP
    798       m_cRendererModel.create( m_cRenModStrParser.getNumOfBaseViews(), m_cRenModStrParser.getNumOfModels(), m_iSourceWidth, m_uiMaxCUHeight , LOG2_DISP_PREC_LUT, 0, m_bVSOEarlySkip );
    799 #else
    800       m_cRendererModel.create( m_cRenModStrParser.getNumOfBaseViews(), m_cRenModStrParser.getNumOfModels(), m_iSourceWidth, m_uiMaxCUHeight , LOG2_DISP_PREC_LUT, 0 );
    801 #endif
    802       for ( Int layer = 0; layer < m_numberOfLayers ; layer++ )
    803       {
    804         TEncTop* pcEncTop =  m_acTEncTopList[ layer ];
    805         Int iViewNum      = pcEncTop->getViewIndex();
    806         Int iContent      = pcEncTop->getIsDepth() || pcEncTop->getIsAuxDepth() ? 1 : 0;
    807         Int iNumOfModels  = m_cRenModStrParser.getNumOfModelsForView(iViewNum, iContent);
    808 
    809         Bool bUseVSO      = (iNumOfModels != 0);
    810 
    811         pcEncTop->setUseVSO( bUseVSO );
    812         pcEncTop->getRdCost()->setRenModel( bUseVSO ? &m_cRendererModel : NULL );
    813 
    814         for (Int iCurModel = 0; iCurModel < iNumOfModels; iCurModel++ )
    815         {
    816           Int iModelNum; Int iLeftViewNum; Int iRightViewNum; Int iDump; Int iOrgRefNum; Int iBlendMode;
    817 
    818           m_cRenModStrParser.getSingleModelData  ( iViewNum, iContent, iCurModel, iModelNum, iBlendMode, iLeftViewNum, iRightViewNum, iOrgRefNum, iDump ) ;
    819           m_cRendererModel  .createSingleModel   ( iViewNum, iContent, iModelNum, iLeftViewNum, iRightViewNum, (iOrgRefNum != -1), iBlendMode );
    820         }           
    821       }
    822     }
    823     else
    824     {
    825       AOT(true);
    826     }
    827   }
    828 #endif
    829586}
    830587
     
    834591  // initialize global variables
    835592  initROM();
    836 #if NH_3D_DMM
    837   initWedgeLists( true );
    838 #endif
    839593
    840594  for( Int layer=0; layer < m_numberOfLayers; layer++)
     
    900654  for(Int layer=0; layer<m_numberOfLayers; layer++)
    901655  {
    902 #if KWU_RC_MADPRED_E0227
    903     m_acTEncTopList[layer]->init( isFieldCoding, this );
    904 #else
    905656    m_acTEncTopList[layer]->init( isFieldCoding );
    906 #endif
    907657  }
    908658#else
     
    932682  }
    933683
    934 #if !NH_3D
    935684  TComPicYuv*       pcPicYuvOrg = new TComPicYuv;
    936 #endif
    937685  TComPicYuv*       pcPicYuvRec = NULL;
    938686
     
    968716  list<AccessUnit> outputAccessUnits; ///< list of access units to write out.  is populated by the encoding process
    969717 
    970 #if NH_3D
    971   TComPicYuv* picYuvOrg[2];
    972   TComPicYuv  picYuvTrueOrg[2];
    973   for (Int d = 0; d < 2 ; d++)
    974   {
    975     picYuvOrg[d] = new TComPicYuv;
    976     picYuvOrg[d]   ->create( m_iSourceWidth, m_isField ? m_iSourceHeightOrg : m_iSourceHeight, ( d > 0 ) ? CHROMA_400 : m_chromaFormatIDC, m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxTotalCUDepth, true );
    977     picYuvTrueOrg[d].create( m_iSourceWidth, m_isField ? m_iSourceHeightOrg : m_iSourceHeight, ( d > 0 ) ? CHROMA_400 : m_chromaFormatIDC, m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxTotalCUDepth, true );
    978   }
    979 #else
    980718  TComPicYuv cPicYuvTrueOrg;
    981719
     
    991729    cPicYuvTrueOrg.create(m_iSourceWidth, m_iSourceHeight, m_chromaFormatIDC, m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxTotalCUDepth, true );
    992730  }
    993 #endif
    994731#if NH_MV
    995732  while ( (m_targetEncLayerIdList.size() != 0 ) && !allEos )
     
    997734    for(Int layer=0; layer < m_numberOfLayers; layer++ )
    998735    {
    999 #if NH_3D
    1000       TComPicYuv* pcPicYuvOrg    =  picYuvOrg    [ m_depthFlag[layer] ];
    1001       TComPicYuv& cPicYuvTrueOrg =  picYuvTrueOrg[ m_depthFlag[layer] ];
    1002 #endif
    1003736      if (!xLayerIdInTargetEncLayerIdList( m_vps->getLayerIdInNuh( layer ) ))
    1004737      {
     
    1036769    for ( Int gopId=0; gopId < gopSize; gopId++ )
    1037770    {
    1038 #if NH_3D_VSO
    1039       UInt iNextPoc = m_acTEncTopList[0] -> getFrameId( gopId );
    1040       if ( iNextPoc < m_framesToBeEncoded )
    1041       {
    1042         m_cCameraData.update( iNextPoc );
    1043       }
    1044 #endif
    1045771      for(Int layer=0; layer < m_numberOfLayers; layer++ )
    1046772      {
    1047 #if NH_3D
    1048         TComPicYuv* pcPicYuvOrg    =  picYuvOrg    [ m_depthFlag[layer] ];
    1049         TComPicYuv& cPicYuvTrueOrg =  picYuvTrueOrg[ m_depthFlag[layer] ];
    1050 #endif
    1051773        if (!xLayerIdInTargetEncLayerIdList( m_vps->getLayerIdInNuh( layer ) ))
    1052774        {
     
    1054776        }
    1055777
    1056 #if NH_3D_VSO       
    1057           if( m_bUseVSO && m_bUseEstimatedVSD && iNextPoc < m_framesToBeEncoded )
    1058           {
    1059             m_cCameraData.setDispCoeff( iNextPoc, m_acTEncTopList[layer]->getViewIndex() );
    1060             m_acTEncTopList[layer]  ->setDispCoeff( m_cCameraData.getDispCoeff() );
    1061           }
    1062 #endif
    1063778
    1064779        Int   iNumEncoded = 0;
     
    1127842#endif
    1128843
    1129 #if NH_3D
    1130   // delete original YUV buffer
    1131   for (Int d = 0; d < 2; d++)
    1132   {
    1133     picYuvOrg[d]->destroy();
    1134     delete picYuvOrg[d];
    1135     picYuvOrg[d] = NULL;
    1136 
    1137     picYuvTrueOrg[d].destroy();
    1138   }
    1139 #else
    1140844  // delete original YUV buffer
    1141845  pcPicYuvOrg->destroy();
    1142846  delete pcPicYuvOrg;
    1143847  pcPicYuvOrg = NULL;
    1144 #endif
    1145848
    1146849#if !NH_MV
     
    1148851  m_cTEncTop.deletePicBuffer();
    1149852#endif
    1150 #if !NH_3D
    1151853  cPicYuvTrueOrg.destroy();
    1152 #endif
    1153854
    1154855  // delete buffers & classes
     
    1158859  printRateSummary();
    1159860
    1160 #if NH_3D_REN_MAX_DEV_OUT
    1161   Double dMaxDispDiff = m_cCameraData.getMaxShiftDeviation();
    1162 
    1163   if ( !(dMaxDispDiff < 0) )
    1164   { 
    1165     printf("\n Max. possible shift error: %12.3f samples.\n", dMaxDispDiff );
    1166   }
    1167 #endif
    1168861
    1169862  return;
     
    1202895  {
    1203896    rpcPicYuvRec = new TComPicYuv;
    1204 #if NH_3D
    1205     rpcPicYuvRec->create( m_iSourceWidth, m_iSourceHeight, m_depthFlag[layer] > 0 ? CHROMA_400 : m_chromaFormatIDC, m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxTotalCUDepth, true );
    1206 #else
    1207897    rpcPicYuvRec->create( m_iSourceWidth, m_iSourceHeight, m_chromaFormatIDC, m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxTotalCUDepth, true );
    1208 #endif
    1209898
    1210899  }
     
    1284973      if (m_pchReconFileList[layerIdx])
    1285974      {
    1286 #if NH_3D
    1287         m_acTVideoIOYuvReconFileList[layerIdx]->write( pcPicYuvRecTop, pcPicYuvRecBottom, ipCSC, m_confWinLeft, m_confWinRight, m_confWinTop, m_confWinBottom, m_depth420OutputFlag && m_depthFlag[layerIdx ] ? CHROMA_420 : NUM_CHROMA_FORMAT, m_isTopFieldFirst );
    1288 #else
    1289975        m_acTVideoIOYuvReconFileList[layerIdx]->write( pcPicYuvRecTop, pcPicYuvRecBottom, ipCSC, m_confWinLeft, m_confWinRight, m_confWinTop, m_confWinBottom, NUM_CHROMA_FORMAT, m_isTopFieldFirst );
    1290 #endif
    1291976      }
    1292977    }
     
    13411026      if (m_pchReconFileList[layerIdx])
    13421027      {
    1343 #if NH_3D
    1344         m_acTVideoIOYuvReconFileList[layerIdx]->write( pcPicYuvRec, ipCSC, m_confWinLeft, m_confWinRight, m_confWinTop, m_confWinBottom, m_depth420OutputFlag && m_depthFlag[layerIdx ] ? CHROMA_420 : NUM_CHROMA_FORMAT  );
    1345 #else
    13461028        m_acTVideoIOYuvReconFileList[layerIdx]->write( pcPicYuvRec, ipCSC, m_confWinLeft, m_confWinRight, m_confWinTop, m_confWinBottom );
    1347 #endif
    13481029
    13491030      }   
     
    14701151}
    14711152
    1472 #if NH_3D_DLT
    1473 Void TAppEncTop::xAnalyzeInputBaseDepth(UInt layer, UInt uiNumFrames, TComVPS* vps, TComDLT* dlt)
    1474 {
    1475   TComPicYuv*       pcDepthPicYuvOrg = new TComPicYuv;
    1476   TComPicYuv*       pcDepthPicYuvTrueOrg = new TComPicYuv;
    1477   // allocate original YUV buffer
    1478   pcDepthPicYuvOrg->create( m_iSourceWidth, m_iSourceHeight, CHROMA_420, m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxTotalCUDepth, false );
    1479   pcDepthPicYuvTrueOrg->create( m_iSourceWidth, m_iSourceHeight, CHROMA_420, m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxTotalCUDepth, false );
    1480  
    1481   TVideoIOYuv* depthVideoFile = new TVideoIOYuv;
    1482  
    1483   UInt uiMaxDepthValue = ((1 << m_inputBitDepth[CHANNEL_TYPE_LUMA])-1);
    1484  
    1485   std::vector<Bool> abValidDepths(256, false);
    1486  
    1487   depthVideoFile->open( m_pchInputFileList[layer], false, m_inputBitDepth, m_MSBExtendedBitDepth, m_internalBitDepth );
    1488  
    1489   Int iHeight   = pcDepthPicYuvOrg->getHeight(COMPONENT_Y);
    1490   Int iWidth    = pcDepthPicYuvOrg->getWidth(COMPONENT_Y);
    1491   Int iStride   = pcDepthPicYuvOrg->getStride(COMPONENT_Y);
    1492  
    1493   Pel* pInDM    = pcDepthPicYuvOrg->getAddr(COMPONENT_Y);
    1494  
    1495   for(Int uiFrame=0; uiFrame < uiNumFrames; uiFrame++ )
    1496   {
    1497     depthVideoFile->read( pcDepthPicYuvOrg, pcDepthPicYuvTrueOrg, IPCOLOURSPACE_UNCHANGED, m_aiPad, m_InputChromaFormatIDC, m_bClipInputVideoToRec709Range );
    1498    
    1499     // check all pixel values
    1500     for (Int i=0; i<iHeight; i++)
    1501     {
    1502       Int rowOffset = i*iStride;
    1503      
    1504       for (Int j=0; j<iWidth; j++)
    1505       {
    1506         Pel depthValue = pInDM[rowOffset+j];
    1507         abValidDepths[depthValue] = true;
    1508       }
    1509     }
    1510   }
    1511  
    1512   depthVideoFile->close();
    1513   delete depthVideoFile;
    1514  
    1515   pcDepthPicYuvOrg->destroy();
    1516   delete pcDepthPicYuvOrg;
    1517   pcDepthPicYuvTrueOrg->destroy();
    1518   delete pcDepthPicYuvTrueOrg;
    1519  
    1520   // convert boolean array to idx2Depth LUT
    1521   std::vector<Int> aiIdx2DepthValue(256, 0);
    1522   Int iNumDepthValues = 0;
    1523   for(Int p=0; p<=uiMaxDepthValue; p++)
    1524   {
    1525     if( abValidDepths[p] == true)
    1526     {
    1527       aiIdx2DepthValue[iNumDepthValues++] = p;
    1528     }
    1529   }
    1530  
    1531   if( uiNumFrames == 0 || gCeilLog2(iNumDepthValues) == m_inputBitDepth[CHANNEL_TYPE_LUMA] )
    1532   {
    1533     dlt->setUseDLTFlag(layer, false);
    1534   }
    1535  
    1536   // assign LUT
    1537   if( dlt->getUseDLTFlag(layer) )
    1538   {
    1539     dlt->setDepthLUTs(layer, aiIdx2DepthValue, iNumDepthValues);
    1540   }
    1541 }
    1542 #endif
    15431153
    15441154#if NH_MV
     
    15701180
    15711181
    1572 #if NH_3D
    1573   vps.initViewCompLayer( );
    1574 #endif
    15751182}
    15761183
     
    16491256      Int curLayerIdInNuh = vps.getLayerIdInNuh( curLayerIdInVps );     
    16501257      Int maxTid = -1;
    1651 #if NH_3D
    1652       if ( vps.getDirectDependencyFlag( curLayerIdInVps, refLayerIdInVps ) )
    1653       {
    1654         if ( m_depthFlag[ curLayerIdInVps] == m_depthFlag[ refLayerIdInVps ] )
    1655         {
    1656 #endif
    16571258          for( Int i = 0; i < ( getGOPSize() + 1); i++ )
    16581259          {       
     
    16611262            for (Int j = 0; j < geCur.m_numActiveRefLayerPics; j++)
    16621263            {
    1663 #if NH_3D
    1664               if ( vps.getIdRefListLayer( curLayerIdInNuh, geCur.m_interLayerPredLayerIdc[ j ] ) == refLayerIdInNuh )
    1665 #else
    16661264              if ( vps.getIdDirectRefLayer( curLayerIdInNuh, geCur.m_interLayerPredLayerIdc[ j ] ) == refLayerIdInNuh )
    1667 #endif
    16681265              {
    16691266                Bool refLayerZero   = ( i == getGOPSize() ) && ( refLayerIdInVps == 0 );
     
    16721269            }
    16731270          }             
    1674 #if NH_3D
    1675         }
    1676         else
    1677         {       
    1678           if( m_depthFlag[ curLayerIdInVps ] && ( m_mpiFlag|| m_qtPredFlag || m_intraContourFlag ) )
    1679           {         
    1680             Int nuhLayerIdTex = vps.getLayerIdInNuh( vps.getViewIndex( curLayerIdInNuh ), false, 0 );
    1681             if ( nuhLayerIdTex == refLayerIdInNuh )
    1682             {
    1683               for( Int i = 0; i < ( getGOPSize() + 1); i++ )
    1684               {       
    1685                 GOPEntry geCur =  m_GOPListMvc[curLayerIdInVps][( i < getGOPSize()  ? i : MAX_GOP )];
    1686                 GOPEntry geRef =  m_GOPListMvc[refLayerIdInVps][( i < getGOPSize()  ? i : MAX_GOP )];
    1687                 if ( geCur.m_interCompPredFlag )
    1688                 {
    1689                   Bool refLayerZero   = ( i == getGOPSize() ) && ( refLayerIdInVps == 0 );
    1690                   maxTid = std::max( maxTid, refLayerZero ? 0 : geRef.m_temporalId );
    1691                 }
    1692               }
    1693             }
    1694           }
    1695           if( !m_depthFlag[ curLayerIdInVps ] && vps.getNumRefListLayers( curLayerIdInNuh) > 0  && ( m_depthRefinementFlag || m_viewSynthesisPredFlag || m_depthBasedBlkPartFlag ) )
    1696           {             
    1697             for( Int i = 0; i < ( getGOPSize() + 1); i++ )
    1698             {       
    1699               GOPEntry geCur =  m_GOPListMvc[curLayerIdInVps][( i < getGOPSize()  ? i : MAX_GOP )];
    1700               GOPEntry geRef =  m_GOPListMvc[refLayerIdInVps][( i < getGOPSize()  ? i : MAX_GOP )];
    1701 
    1702               if ( geCur.m_interCompPredFlag )
    1703               {
    1704                 for (Int j = 0; j < geCur.m_numActiveRefLayerPics; j++ )
    1705                 {
    1706                   Int nuhLayerIdDep = vps.getLayerIdInNuh( vps.getViewIndex( vps.getIdRefListLayer( curLayerIdInNuh, geCur.m_interLayerPredLayerIdc[j] ) ), true, 0 );
    1707                   if ( nuhLayerIdDep == refLayerIdInNuh )
    1708                   {
    1709                     Bool refLayerZero   = ( i == getGOPSize() ) && ( refLayerIdInVps == 0 );
    1710                     maxTid = std::max( maxTid, refLayerZero ? 0 : geRef.m_temporalId );
    1711                   }
    1712                 }
    1713               }
    1714             }
    1715           }       
    1716         }
    1717       } // if ( vps.getDirectDependencyFlag( curLayerIdInVps, refLayerIdInVps ) )
    1718       vps.setMaxTidIlRefPicsPlus1( refLayerIdInVps, curLayerIdInVps, maxTid + 1 );
    1719 #endif
    17201271    }  // Loop curLayerIdInVps
    17211272  } // Loop refLayerIdInVps
     
    17661317     
    17671318      // check if all reference layers when allRefLayerActiveFlag is equal to 1 are reference layer pictures specified in the gop entry
    1768 #if NH_3D
    1769       for (Int k = 0; k < vps.getNumRefListLayers( layerIdInNuh ) && allRefLayersActiveFlag; k++ )
    1770       {
    1771         Int refLayerIdInVps = vps.getLayerIdInVps( vps.getIdRefListLayer( layerIdInNuh , k ) );
    1772 #else
    17731319      for (Int k = 0; k < vps.getNumDirectRefLayers( layerIdInNuh ) && allRefLayersActiveFlag; k++ )
    17741320      {
    17751321        Int refLayerIdInVps = vps.getLayerIdInVps( vps.getIdDirectRefLayer( layerIdInNuh , k ) );
    1776 #endif
    17771322        if ( vps.getSubLayersVpsMaxMinus1(refLayerIdInVps) >= tId  && ( tId == 0 || vps.getMaxTidIlRefPicsPlus1(refLayerIdInVps,layerIdInVps) > tId )  )
    17781323        {
     
    17921337      {   
    17931338        Bool referenceLayerFoundFlag = false;
    1794 #if NH_3D
    1795         for (Int k = 0; k < vps.getNumRefListLayers( layerIdInNuh ); k++ )
    1796         {
    1797           Int refLayerIdInVps = vps.getLayerIdInVps( vps.getIdRefListLayer( layerIdInNuh, k) );
    1798 #else
    17991339        for (Int k = 0; k < vps.getNumDirectRefLayers( layerIdInNuh ); k++ )
    18001340        {
    18011341          Int refLayerIdInVps = vps.getLayerIdInVps( vps.getIdDirectRefLayer( layerIdInNuh, k) );
    1802 #endif
    18031342          if ( vps.getSubLayersVpsMaxMinus1(refLayerIdInVps) >= tId  && ( tId == 0 || vps.getMaxTidIlRefPicsPlus1(refLayerIdInVps,layerIdInVps) > tId )  )
    18041343          {         
     
    19291468    break;
    19301469  case Profile::MULTIVIEWMAIN:
    1931 #if NH_3D
    1932   case Profile::MAIN3D:
    1933 #endif
    19341470    ptl->setMax12bitConstraintFlag      ( true  );
    19351471    ptl->setMax12bitConstraintFlag      ( true  );
     
    19531489
    19541490  Bool anyDepth = false;
    1955 #if NH_3D
    1956   for ( Int i = 0; i < m_numberOfLayers; i++ )
    1957   {
    1958     vps.setVpsRepFormatIdx( i, m_depthFlag[ i ] ? 1 : 0 );
    1959     anyDepth = anyDepth || m_depthFlag[ i ];
    1960   }
    1961 #endif
    19621491
    19631492  vps.setRepFormatIdxPresentFlag( anyDepth );
     
    23641893}
    23651894
    2366 #if NH_3D
    2367 Void TAppEncTop::xSetCamPara                ( TComVPS& vps )
    2368 {
    2369   vps.setCpPrecision( m_cCameraData.getCamParsCodedPrecision());
    2370 
    2371   for ( Int n = 1; n < vps.getNumViews(); n++ )
    2372   { 
    2373     Int i      = vps.getViewOIdxList( n );
    2374     Int iInVps = vps.getVoiInVps    ( i );
    2375     vps.setNumCp( iInVps,  n);   
    2376 
    2377     if ( vps.getNumCp( iInVps ) > 0 )
    2378     {
    2379       vps.setCpInSliceSegmentHeaderFlag( iInVps, m_cCameraData.getVaryingCameraParameters() );
    2380 
    2381       for( Int m = 0; m < vps.getNumCp( iInVps ); m++ )
    2382       {
    2383         vps.setCpRefVoi( iInVps, m, vps.getViewOIdxList( m ) );
    2384         if( !vps.getCpInSliceSegmentHeaderFlag( iInVps ) )
    2385         {
    2386           Int j = vps.getCpRefVoi( iInVps, m );
    2387           Int jInVps = vps.getVoiInVps( j );         
    2388 
    2389           vps.setVpsCpScale   ( iInVps, jInVps, m_cCameraData.getCodedScale() [ jInVps ][ iInVps ] ) ;
    2390           vps.setVpsCpInvScale( iInVps, jInVps, m_cCameraData.getCodedScale() [ iInVps ][ jInVps ] ) ;
    2391           vps.setVpsCpOff     ( iInVps, jInVps, m_cCameraData.getCodedOffset()[ jInVps ][ iInVps ] ) ;
    2392           vps.setVpsCpInvOff  ( iInVps, jInVps, m_cCameraData.getCodedOffset()[ iInVps ][ jInVps ] ) ;
    2393         }
    2394       }
    2395     }
    2396   }
    2397   vps.deriveCpPresentFlag();
    2398 }
    2399 #endif
    24001895
    24011896
     
    24091904
    24101905
    2411 #if NH_3D_DLT
    2412 Void TAppEncTop::xDeriveDltArray( TComVPS& vps, TComDLT* dlt )
    2413 {
    2414   Int  iNumDepthViews  = 0;
    2415   Bool bDltPresentFlag = false;
    2416 
    2417   for ( Int layer = 0; layer <= vps.getMaxLayersMinus1(); layer++ )
    2418   {
    2419     Bool isDepth = ( vps.getDepthId( layer ) == 1 );
    2420 
    2421     if ( isDepth )
    2422     {
    2423       iNumDepthViews++;
    2424     }
    2425 
    2426     dlt->setUseDLTFlag( layer , isDepth && m_useDLT );
    2427     if( dlt->getUseDLTFlag( layer ) )
    2428     {
    2429       xAnalyzeInputBaseDepth(layer, max(m_iIntraPeriod[layer], 24), &vps, dlt);
    2430       bDltPresentFlag = bDltPresentFlag || dlt->getUseDLTFlag(layer);
    2431       dlt->setInterViewDltPredEnableFlag(layer, (dlt->getUseDLTFlag(layer) && (layer>1)));
    2432      
    2433       // ----------------------------- determine whether to use bit-map -----------------------------
    2434       Bool bDltBitMapRepFlag       = false;
    2435       UInt uiNumBitsNonBitMap      = 0;
    2436       UInt uiNumBitsBitMap         = 0;
    2437      
    2438       UInt uiMaxDiff               = 0;
    2439       UInt uiMinDiff               = MAX_INT;
    2440       UInt uiLengthMinDiff         = 0;
    2441       UInt uiLengthDltDiffMinusMin = 0;
    2442      
    2443       std::vector<Int> aiIdx2DepthValue_coded(256, 0);
    2444       UInt uiNumDepthValues_coded = 0;
    2445      
    2446       uiNumDepthValues_coded = dlt->getNumDepthValues(layer);
    2447       for( UInt ui = 0; ui<uiNumDepthValues_coded; ui++ )
    2448       {
    2449         aiIdx2DepthValue_coded[ui] = dlt->idx2DepthValue(layer, ui);
    2450       }
    2451      
    2452       if( dlt->getInterViewDltPredEnableFlag( layer ) )
    2453       {
    2454         AOF( vps.getDepthId( 1 ) == 1 );
    2455         AOF( layer > 1 );
    2456         // assumes ref layer id to be 1
    2457         std::vector<Int> piRefDLT = dlt->idx2DepthValue( 1 );
    2458         UInt uiRefNum = dlt->getNumDepthValues( 1 );
    2459         dlt->getDeltaDLT(layer, piRefDLT, uiRefNum, aiIdx2DepthValue_coded, uiNumDepthValues_coded);
    2460       }
    2461      
    2462       std::vector<UInt> puiDltDiffValues(uiNumDepthValues_coded, 0);
    2463      
    2464       for (UInt d = 1; d < uiNumDepthValues_coded; d++)
    2465       {
    2466         puiDltDiffValues[d] = aiIdx2DepthValue_coded[d] - aiIdx2DepthValue_coded[d-1];
    2467        
    2468         if ( uiMaxDiff < puiDltDiffValues[d] )
    2469         {
    2470           uiMaxDiff = puiDltDiffValues[d];
    2471         }
    2472        
    2473         if ( uiMinDiff > puiDltDiffValues[d] )
    2474         {
    2475           uiMinDiff = puiDltDiffValues[d];
    2476         }
    2477       }
    2478      
    2479       // counting bits
    2480       // diff coding branch
    2481       uiNumBitsNonBitMap += 8;                          // u(v) bits for num_depth_values_in_dlt[layerId] (i.e. num_entry[ layerId ])
    2482      
    2483       if ( uiNumDepthValues_coded > 1 )
    2484       {
    2485         uiNumBitsNonBitMap += 8;                        // u(v) bits for max_diff[ layerId ]
    2486       }
    2487      
    2488       if ( uiNumDepthValues_coded > 2 )
    2489       {
    2490         uiLengthMinDiff    = (UInt) gCeilLog2(uiMaxDiff + 1);
    2491         uiNumBitsNonBitMap += uiLengthMinDiff;          // u(v)  bits for min_diff[ layerId ]
    2492       }
    2493      
    2494       uiNumBitsNonBitMap += 8;                          // u(v) bits for dlt_depth_value0[ layerId ]
    2495      
    2496       if (uiMaxDiff > uiMinDiff)
    2497       {
    2498         uiLengthDltDiffMinusMin = (UInt) gCeilLog2(uiMaxDiff - uiMinDiff + 1);
    2499         uiNumBitsNonBitMap += uiLengthDltDiffMinusMin * (uiNumDepthValues_coded - 1);  // u(v) bits for dlt_depth_value_diff_minus_min[ layerId ][ j ]
    2500       }
    2501      
    2502       // bit map branch
    2503       uiNumBitsBitMap = 1 << m_inputBitDepth[CHANNEL_TYPE_LUMA];
    2504      
    2505       // determine bDltBitMapFlag
    2506       bDltBitMapRepFlag = (uiNumBitsBitMap > uiNumBitsNonBitMap) ? false : true;
    2507      
    2508       dlt->setUseBitmapRep(layer, bDltBitMapRepFlag);
    2509     }
    2510   }
    2511 
    2512   dlt->setDltPresentFlag( bDltPresentFlag );
    2513   dlt->setNumDepthViews ( iNumDepthViews  );
    2514   dlt->setDepthViewBitDepth( m_inputBitDepth[CHANNEL_TYPE_LUMA] );
    2515 }
    2516 #endif
    25171906//! \}
  • branches/HTM-16.0-MV-draft-5/source/App/TAppEncoder/TAppEncTop.h

    r1386 r1390  
    4646#include "TLibCommon/AccessUnit.h"
    4747#include "TAppEncCfg.h"
    48 #if NH_3D_VSO
    49 #include "../../Lib/TLibRenderer/TRenTop.h"
    50 #endif
    5148
    52 #if KWU_RC_MADPRED_E0227
    53 class TEncTop;
    54 #endif
    5549//! \ingroup TAppEncoder
    5650//! \{
     
    9084#endif
    9185
    92 #if NH_3D
    93   TComSps3dExtension         m_sps3dExtension;              ///< Currently all layers share the same sps 3D Extension 
    94 #endif
    9586
    9687  UInt m_essentialBytes;
    9788  UInt m_totalBytes;
    98 #if NH_3D_VSO
    99   TRenTop                     m_cRendererTop;
    100   TRenModel                   m_cRendererModel;   
    101 #endif
    10289protected:
    10390  // initialization
     
    144131  Void xSetDpbSize                ( TComVPS& vps );
    145132  Void xSetVPSVUI                 ( TComVPS& vps );
    146 #if NH_3D
    147   Void xSetCamPara                ( TComVPS& vps );
    148 #endif
    149133  GOPEntry* xGetGopEntry( Int layerIdInVps, Int poc );
    150134  Int  xGetMax( std::vector<Int>& vec);
    151135  Bool xLayerIdInTargetEncLayerIdList( Int nuhLayerId );
    152 #endif
    153 #if NH_3D_DLT
    154   Void xDeriveDltArray( TComVPS& vps, TComDLT* dlt );
    155   Void xAnalyzeInputBaseDepth(UInt layer, UInt uiNumFrames, TComVPS* vps, TComDLT* dlt);
    156136#endif
    157137
  • branches/HTM-16.0-MV-draft-5/source/App/TAppRenderer/RendererMain.cpp

    r1386 r1390  
    3535#include <time.h>
    3636#include "../../Lib/TLibCommon/CommonDef.h"
    37 #if NH_3D_VSO
    38 #include "TAppRendererTop.h"
    39 // ====================================================================================================================
    40 // Main function
    41 // ====================================================================================================================
    42 
    43 int main(int argc, char* argv[])
    44   {
    45 
    46   TAppRendererTop  cTAppRendererTop;
    47 
    48   // print information
    49   fprintf( stdout, "\n" );
    50   fprintf( stdout, "3D-HTM software: Renderer Version [%s]", NV_VERSION); 
    51   fprintf( stdout, NVM_ONOS );
    52   fprintf( stdout, NVM_COMPILEDBY );
    53   fprintf( stdout, NVM_BITS );
    54   fprintf( stdout, "\n" );
    55 
    56   // create application renderer class
    57   cTAppRendererTop.create();
    58 
    59   // parse configuration
    60   if(!cTAppRendererTop.parseCfg( argc, argv ))
    61   {
    62     cTAppRendererTop.destroy();
    63     return 1;
    64   }
    65 
    66   // starting time
    67   double dResult;
    68   long lBefore = clock();
    69 
    70   // call rendering function
    71   cTAppRendererTop.go();
    72 
    73   // ending time
    74   dResult = (double)(clock()-lBefore) / CLOCKS_PER_SEC;
    75   printf("\n Total Time: %12.3f sec.\n", dResult);
    76 
    77   // destroy application renderer class
    78   cTAppRendererTop.destroy();
    79 
    80   return 0;
    81 }
    82 #else
    8337
    8438#include <iostream>
     
    8943}
    9044
    91 #endif // NH_3D
    9245
  • branches/HTM-16.0-MV-draft-5/source/App/TAppRenderer/TAppRendererCfg.cpp

    r1386 r1390  
    4444#include "../../Lib/TAppCommon/program_options_lite.h"
    4545
    46 #if NH_3D_VSO
    47 
    48 using namespace std;
    49 namespace po = df::program_options_lite;
    50 
    51 // ====================================================================================================================
    52 // Local constants
    53 // ====================================================================================================================
    54 
    55 #define MAX_INPUT_VIEW_NUM          10
    56 #define MAX_OUTPUT_VIEW_NUM         64
    57 
    58 // ====================================================================================================================
    59 // Constructor / destructor / initialization / destroy
    60 // ====================================================================================================================
    61 
    62 
    63 TAppRendererCfg::TAppRendererCfg()
    64 {
    65  
    66 }
    67 
    68 TAppRendererCfg::~TAppRendererCfg()
    69 {
    70   for(Int i = 0; i< m_pchVideoInputFileList.size(); i++ )
    71   {
    72     if ( m_pchVideoInputFileList[i] != NULL )
    73       free (m_pchVideoInputFileList[i]);
    74   }
    75 
    76   for(Int i = 0; i< m_pchDepthInputFileList.size(); i++ )
    77   {
    78     if ( m_pchDepthInputFileList[i] != NULL )
    79       free (m_pchDepthInputFileList[i]);
    80   }
    81 
    82   for(Int i = 0; i< m_pchSynthOutputFileList.size(); i++ )
    83   {
    84     if ( m_pchSynthOutputFileList[i] != NULL )
    85       free (m_pchSynthOutputFileList[i]);
    86   }
    87 
    88   if ( m_pchVideoInputFileBaseName  ) free( m_pchVideoInputFileBaseName );
    89   if ( m_pchDepthInputFileBaseName  ) free( m_pchDepthInputFileBaseName );
    90   if ( m_pchSynthOutputFileBaseName ) free( m_pchSynthOutputFileBaseName);
    91   if ( m_pchCameraParameterFile     ) free( m_pchCameraParameterFile    );
    92   if ( m_pchBaseViewCameraNumbers   ) free( m_pchBaseViewCameraNumbers  );
    93   if ( m_pchSynthViewCameraNumbers  ) free( m_pchSynthViewCameraNumbers );
    94   if ( m_pchViewConfig              ) free( m_pchViewConfig         );
    95 }
    96 
    97 Void TAppRendererCfg::create()
    98 {
    99 }
    100 
    101 Void TAppRendererCfg::destroy()
    102 {
    103 }
    104 
    105 // ====================================================================================================================
    106 // Public member functions
    107 // ====================================================================================================================
    108 
    109 /** \param  argc        number of arguments
    110 \param  argv        array of arguments
    111 \retval             true when success
    112 */
    113 Bool TAppRendererCfg::parseCfg( Int argc, TChar* argv[] )
    114 {
    115   bool do_help = false;
    116 
    117   po::Options opts;
    118   opts.addOptions()
    119     ("help", do_help, false, "this help text")
    120     ("c", po::parseConfigFile, "configuration file name")
    121 
    122     /* File I/O */
    123     ("VideoInputFileBaseName,v",  m_pchVideoInputFileBaseName,  (TChar*) 0, "Basename to generate video input file names")
    124     ("DepthInputFileBaseName,d",  m_pchDepthInputFileBaseName,  (TChar*) 0, "Basename to generate depth input file names")
    125     ("SynthOutputFileBaseName,s", m_pchSynthOutputFileBaseName, (TChar*) 0, "Basename to generate synthesized output file names")
    126     ("ContOutputFileNumbering", m_bContOutputFileNumbering  ,  false   , "Continuous Output File Numbering")
    127     ("Sweep"                  , m_bSweep                    ,  false   , "Store all views in first Output File")
    128 
    129     ("VideoInputFile_%d,v_%d",  m_pchVideoInputFileList ,    (TChar *) 0, MAX_INPUT_VIEW_NUM , "Original Yuv video input file name %d")
    130     ("DepthInputFile_%d,d_%d",  m_pchDepthInputFileList ,    (TChar *) 0, MAX_INPUT_VIEW_NUM , "Original Yuv depth input file name %d")
    131     ("SynthOutputFile_%d,s_%d", m_pchSynthOutputFileList,    (TChar *) 0, MAX_OUTPUT_VIEW_NUM, "Synthesized Yuv output file name %d")
    132 
    133     ("InputBitDepth",           m_inputBitDepth[0],                     8, "Bit-depth of input file")
    134     ("OutputBitDepth",          m_outputBitDepth[0],                    0, "Bit-depth of output file (default:InternalBitDepth)")
    135     ("InternalBitDepth",        m_internalBitDepth[0],                  0, "Bit-depth the renderer operates at. (default:InputBitDepth)"                                                                          "If different to InputBitDepth, source data will be converted")
    136 
    137     ("InputBitDepthC",        m_inputBitDepth[1],    0, "As per InputBitDepth but for chroma component. (default:InputBitDepth)")
    138     ("OutputBitDepthC",       m_outputBitDepth[1],   0, "As per OutputBitDepth but for chroma component. (default:InternalBitDepthC)")
    139     ("InternalBitDepthC",     m_internalBitDepth[1], 0, "As per InternalBitDepth but for chroma component. (default:IntrenalBitDepth)")
    140 
    141     /* Source Specification */
    142     ("SourceWidth,-wdt",        m_iSourceWidth,                       0, "Source picture width")
    143     ("SourceHeight,-hgt",       m_iSourceHeight,                      0, "Source picture height")
    144     ("FrameSkip,-fs",           m_iFrameSkip,                         0, "Number of frames to skip at start of input YUV")
    145     ("FramesToBeRendered,f",    m_iFramesToBeRendered,                0, "Number of frames to be rendered (default=all)")
    146 
    147     /* Camera Specification */
    148     ("CameraParameterFile,-cpf", m_pchCameraParameterFile,         (TChar *) 0, "Camera Parameter File Name")
    149     ("BaseViewCameraNumbers"  , m_pchBaseViewCameraNumbers,        (TChar *) 0, "Numbers of base views")
    150     ("SynthViewCameraNumbers" , m_pchSynthViewCameraNumbers,       (TChar *) 0, "Numbers of views to synthesis")
    151     ("ViewConfig"             , m_pchViewConfig,                   (TChar *) 0, "View Configuration"               )
    152 
    153     /* Renderer Modes */
    154     ("Log2SamplingFactor",      m_iLog2SamplingFactor,                0, "Factor for horizontal up sampling before processing"     )
    155     ("UVup"              ,      m_bUVUp               ,            true, "Up sampling of chroma planes before processing"          )
    156     ("PreProcMode"       ,      m_iPreProcMode        ,               0, "Depth preprocessing: 0 = None, 1 = Binomial filtering"   )
    157     ("PreFilterSize"     ,      m_iPreFilterSize      ,               0, "For PreProcMode 1: Half Size of filter kernel"           )
    158     ("SimEnhance"        ,      m_bSimEnhance         ,           true, "Similarity enhancement of video" )
    159     ("BlendMode"         ,      m_iBlendMode          ,               0, "Blending of left and right image: 0: average, 1: only holes from right, 2: only holes from left, 3: first view in BaseViewOrder as main view" )
    160     ("BlendZThresPerc"   ,      m_iBlendZThresPerc    ,              30, "Z-difference threshold for blending in percent of total Z-range"   )
    161     ("BlendUseDistWeight",      m_bBlendUseDistWeight ,            true, "0: blend using average; 1: blend factor depends on view distance"  )
    162     ("BlendHoleMargin"   ,      m_iBlendHoleMargin    ,               6, "Margin around holes to fill with other view"                       )
    163     ("InterpolationMode" ,      m_iInterpolationMode  ,               4, "0: NN, 1:linear (int), 2:linear (double) , 3:cubic Hermite spline (double), 4: 8-tap (int)" )
    164     ("HoleFillingMode"   ,      m_iHoleFillingMode    ,               1, "0: None, 1: line wise background extension"              )
    165     ("PostProcMode"      ,      m_iPostProcMode       ,               0, "0: None, 1: horizontal 3-tap median"                     )
    166     ("RenderMode"        ,      m_iRenderMode         ,               0, "0: Use renderer, 1: use model renderer, 10: create used pels map")
    167     ("ShiftPrecision"    ,      m_iShiftPrecision     ,               2, "Shift Precision for Interpolation Mode 4"                )
    168     ("TemporalDepthFilter",     m_bTempDepthFilter    ,           false, "Temporal depth filtering"                                )
    169     ("RenderDirection"   ,      m_iRenderDirection    ,               0, "0: Interpolate, 1: Extrapolate from left, 2: Extrapolate from right")
    170     ("UsedPelMapMarExt"  ,      m_iUsedPelMapMarExt   ,               0, "Margin Extension in Pels for used pels map generation"   );
    171 
    172   po::setDefaults(opts);
    173   po::scanArgv(opts, argc, (const char**) argv);
    174 
    175   if (argc == 1 || do_help)
    176   {
    177     /* argc == 1: no options have been specified */
    178     po::doHelp(cout, opts);
    179     xPrintUsage();
    180     return false;
    181   }
    182 
    183   /*
    184   * Set any derived parameters before checking
    185   */
    186 
    187   /* rules for input, output and internal bitdepths as per help text */
    188   if (!m_internalBitDepth[0]) { m_internalBitDepth[0] = m_inputBitDepth[0]; }
    189   if (!m_internalBitDepth[1]) { m_internalBitDepth[1] = m_internalBitDepth[0]; }
    190   if (!m_inputBitDepth[1])    { m_inputBitDepth[1]    = m_inputBitDepth[0]; }
    191   if (!m_outputBitDepth[0])   { m_outputBitDepth[0]   = m_internalBitDepth[0]; }
    192   if (!m_outputBitDepth[1])   { m_outputBitDepth[1]   = m_internalBitDepth[1]; }
    193 
    194   UInt  uiInputBitDepth   = 8;
    195   UInt  uiCamParPrecision = 5;
    196 
    197   m_bUseSetupString = ( m_pchViewConfig != NULL ) && ( m_iRenderMode != 0);
    198 
    199   if ( m_iRenderMode == 10 )
    200   {
    201     m_cCameraData.init( MAX_INPUT_VIEW_NUM, uiInputBitDepth, uiCamParPrecision, (UInt)m_iFrameSkip, (UInt)m_iFramesToBeRendered,
    202       m_pchCameraParameterFile, m_pchBaseViewCameraNumbers, NULL, NULL, m_iLog2SamplingFactor+m_iShiftPrecision );
    203     m_iNumberOfInputViews  = (Int) m_cCameraData.getBaseViewNumbers() .size();
    204     m_iNumberOfOutputViews = m_iNumberOfInputViews - 1;
    205     m_iRenderDirection     = 1;
    206   }
    207   else
    208   {
    209   if ( m_bUseSetupString )
    210   {
    211     std::vector<Int>  iaTempViews;
    212     std::vector<Int>* piaTempViews;
    213     m_cCameraData     .convertNumberString( m_pchBaseViewCameraNumbers, iaTempViews, VIEW_NUM_PREC );
    214     m_cRenModStrParser.setString( (Int) iaTempViews.size(), m_pchViewConfig );
    215     piaTempViews               = m_cRenModStrParser.getSynthViews();
    216     m_iNumberOfOutputViews     = (Int) m_cRenModStrParser.getNumOfModels();
    217     m_iNumberOfInputViews      = (Int) m_cRenModStrParser.getNumOfBaseViews();
    218     m_bContOutputFileNumbering = true;
    219 
    220   m_cCameraData.init( MAX_INPUT_VIEW_NUM, uiInputBitDepth, uiCamParPrecision, (UInt)m_iFrameSkip, (UInt)m_iFramesToBeRendered,
    221       m_pchCameraParameterFile, m_pchBaseViewCameraNumbers, NULL, piaTempViews, m_iLog2SamplingFactor+m_iShiftPrecision );
    222   }
    223   else
    224   {
    225   m_cCameraData.init( MAX_INPUT_VIEW_NUM, uiInputBitDepth, uiCamParPrecision, (UInt)m_iFrameSkip, (UInt)m_iFramesToBeRendered,
    226       m_pchCameraParameterFile, m_pchBaseViewCameraNumbers, m_pchSynthViewCameraNumbers, NULL, m_iLog2SamplingFactor+m_iShiftPrecision );
    227   m_iNumberOfOutputViews = (Int) m_cCameraData.getSynthViewNumbers().size();
    228   m_iNumberOfInputViews  = (Int) m_cCameraData.getBaseViewNumbers() .size();
    229   }
    230   }
    231 
    232   if (m_pchSynthOutputFileBaseName != NULL)
    233     xConfirmParameter( strrchr(m_pchSynthOutputFileBaseName,'$')  == 0, "'$' must be a character in SynthOutputFileBaseName");
    234 
    235   if (m_pchDepthInputFileBaseName != NULL)
    236     xConfirmParameter( strrchr(m_pchDepthInputFileBaseName, '$')  == 0, "'$' must be a character in DepthInputFileBaseName" );
    237 
    238   if (m_pchVideoInputFileBaseName != NULL)
    239     xConfirmParameter( strrchr(m_pchVideoInputFileBaseName, '$')  == 0, "'$' must be a character in VideoInputFileBaseName" );
    240 
    241   xCreateFileNames();
    242 
    243   /*
    244   * check validity of input parameters
    245   */
    246   xCheckParameter();
    247   m_cCameraData.check( m_iRenderDirection == 0, m_iFramesToBeRendered != 0 );
    248 
    249   // print-out parameters
    250   xPrintParameter();
    251 
    252   return true;
    253 }
    254 
    255 
    256 // ====================================================================================================================
    257 // Private member functions
    258 // ====================================================================================================================
    259 
    260 Void TAppRendererCfg::xCheckParameter()
    261 {
    262   bool check_failed = false; /* abort if there is a fatal configuration problem */
    263 #define xConfirmPara(a,b) check_failed |= xConfirmParameter(a,b)
    264   // check range of parameters
    265 
    266   /// File I/O
    267 
    268   // source specification
    269   xConfirmPara( m_iSourceWidth        <= 0,                   "Source width  must be greater than 0" );
    270   xConfirmPara( m_iSourceHeight       <= 0,                   "Source height must be greater than 0" );
    271   xConfirmPara( m_iFrameSkip          <  0,                   "Frame Skipping must be more than or equal to 0" );
    272   xConfirmPara( m_iFramesToBeRendered <  0,                   "Total Number Of Frames rendered must be more than 1" );
    273 
    274   // bit depth
    275   xConfirmPara( m_internalBitDepth[0] != m_internalBitDepth[1],  "InternalBitDepth for luma and chroma must be equal. ");
    276   xConfirmPara( m_inputBitDepth[0] < 8,                        "InputBitDepth must be at least 8" );
    277   xConfirmPara( m_inputBitDepth[1] < 8,                        "InputBitDepthC must be at least 8" );
    278 
    279   // camera specification
    280   xConfirmPara( m_iNumberOfInputViews  > MAX_INPUT_VIEW_NUM , "NumberOfInputViews must be less than of equal to MAX_INPUT_VIEW_NUM");
    281   xConfirmPara( m_iNumberOfOutputViews > MAX_OUTPUT_VIEW_NUM, "NumberOfOutputViews must be less than of equal to MAX_OUTPUT_VIEW_NUM");
    282 
    283 
    284   xConfirmPara( m_iRenderDirection < 0 || m_iRenderDirection > 2  , "RenderDirection must be greater than or equal to 0 and less than 3");
    285   xConfirmPara(m_iNumberOfOutputViews < 1,                    "Number of OutputViews must be greater or equal to 1");
    286   if ( m_iRenderDirection == 0 )
    287   {
    288     xConfirmPara( m_iNumberOfInputViews < 2,                  "Number of InputViews must be more than or equal to 2");
    289   }
    290   else
    291   {
    292     xConfirmPara( m_iNumberOfInputViews < 1,                  "Number of InputViews must be more than or equal to 1");
    293   }
    294 
    295   xConfirmPara( m_iLog2SamplingFactor < 0 || m_iLog2SamplingFactor >  4, "Log2SamplingFactor must be more than or equal to 0 and less than 5"  );
    296   xConfirmPara( m_iPreProcMode        < 0 || m_iPreProcMode        >  1, "PreProcMode        must be more than or equal to 0 and less than 2"  );
    297 
    298 
    299   xConfirmPara( m_iPreFilterSize      < 0 || m_iPreFilterSize      >  3, "PreFilterSize      must be more than or equal to 0 and less than 4" );
    300   xConfirmPara( m_iBlendMode          < 0 || m_iBlendMode          >  3, "BlendMode          must be more than or equal to 0 and less than 4"  );
    301   xConfirmPara( m_iBlendZThresPerc    < 0 || m_iBlendZThresPerc    > 100,"BlendZThresPerc    must be more than or equal to 0 and less than 101"  );
    302   xConfirmPara( m_iBlendHoleMargin    < 0 || m_iBlendHoleMargin    >  20,"BlendHoleMargin    must be more than or equal to 0 and less than 19"  );
    303   xConfirmPara( m_iInterpolationMode  < 0 || m_iInterpolationMode  >  4, "InterpolationMode  must be more than or equal to 0 and less than 5"  );
    304   xConfirmPara( m_iHoleFillingMode    < 0 || m_iHoleFillingMode    >  1, "HoleFillingMode    must be more than or equal to 0 and less than 2"  );
    305   xConfirmPara( m_iPostProcMode       < 0 || m_iPostProcMode       >  2, "PostProcMode       must be more than or equal to 0 and less than 3"  );
    306 
    307   Int iNumNonNULL;
    308   for (iNumNonNULL = 0; (iNumNonNULL < m_iNumberOfInputViews)  && m_pchDepthInputFileList[iNumNonNULL]; iNumNonNULL++) {};  xConfirmPara( iNumNonNULL < m_iNumberOfInputViews,  "Number of DepthInputFiles  must be greater than or equal to number of BaseViewNumbers" );
    309   for (iNumNonNULL = 0; (iNumNonNULL < m_iNumberOfInputViews)  && m_pchVideoInputFileList[iNumNonNULL]; iNumNonNULL++) {};  xConfirmPara( iNumNonNULL < m_iNumberOfInputViews,  "Number of DepthInputFiles  must be greater than or equal to number of BaseViewNumbers" );
    310 
    311 
    312   if ( !m_bSweep )
    313   {
    314     for (iNumNonNULL = 0; (iNumNonNULL < m_iNumberOfOutputViews) && m_pchSynthOutputFileList[iNumNonNULL]; iNumNonNULL++) {}; xConfirmPara( iNumNonNULL < m_iNumberOfOutputViews, "Number of SynthOutputFiles must be greater than or equal to number of SynthViewNumbers" );
    315   }
    316   else
    317   {
    318       xConfirmPara( iNumNonNULL < 1, "Number of SynthOutputFiles must be equal to or more than 1" );
    319   }
    320 
    321 #undef xConfirmPara
    322   if ( check_failed )
    323   {
    324     exit(EXIT_FAILURE);
    325   }
    326 
    327 }
    328 
    329 
    330 
    331 Void TAppRendererCfg::xPrintParameter()
    332 {
    333   printf("\n");
    334   for( Int iCounter = 0; iCounter < m_iNumberOfInputViews; iCounter++)
    335   {
    336     printf("InputVideoFile_%i        : %s\n", iCounter, m_pchVideoInputFileList[iCounter]);
    337   }
    338   for( Int iCounter = 0; iCounter < m_iNumberOfInputViews; iCounter++)
    339   {
    340     printf("InputDepthFile_%i        : %s\n", iCounter, m_pchDepthInputFileList[iCounter]);
    341   }
    342 
    343   for( Int iCounter = 0; iCounter < m_iNumberOfOutputViews; iCounter++)
    344   {
    345     printf("SynthOutputFile_%i       : %s\n", iCounter, m_pchSynthOutputFileList[iCounter]);
    346   }
    347 
    348   printf("Format                  : %dx%d \n", m_iSourceWidth, m_iSourceHeight );
    349   printf("Frame index             : %d - %d (%d frames)\n", m_iFrameSkip, m_iFrameSkip+m_iFramesToBeRendered-1, m_iFramesToBeRendered);
    350   printf("CameraParameterFile     : %s\n", m_pchCameraParameterFile );
    351   printf("BaseViewNumbers         : %s  (%d views) \n", m_pchBaseViewCameraNumbers , m_iNumberOfInputViews  );
    352   printf("Sweep                   : %d\n", m_bSweep               );
    353 
    354   if ( m_bUseSetupString )
    355   {
    356     printf("ViewConfig              : %s\n", m_pchViewConfig );
    357   }
    358   else
    359   {
    360   printf("SynthViewNumbers        : %s  (%d views) \n", m_pchSynthViewCameraNumbers, m_iNumberOfOutputViews );
    361   }
    362 
    363   printf("Log2SamplingFactor      : %d\n", m_iLog2SamplingFactor );
    364   printf("UVUp                    : %d\n", m_bUVUp               );
    365   printf("PreProcMode             : %d\n", m_iPreProcMode        );
    366   printf("PreFilterSize           : %d\n", m_iPreFilterSize      );
    367   printf("SimEnhance              : %d\n", m_bSimEnhance         );
    368   printf("BlendMode               : %d\n", m_iBlendMode          );
    369   printf("BlendZThresPerc         : %d\n", m_iBlendZThresPerc    );
    370   printf("BlendUseDistWeight      : %d\n", m_bBlendUseDistWeight );
    371   printf("BlendHoleMargin         : %d\n", m_iBlendHoleMargin    );
    372   printf("InterpolationMode       : %d\n", m_iInterpolationMode  );
    373   printf("HoleFillingMode         : %d\n", m_iHoleFillingMode    );
    374   printf("PostProcMode            : %d\n", m_iPostProcMode       );
    375   printf("ShiftPrecision          : %d\n", m_iShiftPrecision     );
    376   printf("TemporalDepthFilter     : %d\n", m_bTempDepthFilter    );
    377   printf("RenderMode              : %d\n", m_iRenderMode         );
    378   printf("RendererDirection       : %d\n", m_iRenderDirection       );
    379 
    380   if (m_iRenderMode == 10 )
    381   {
    382     printf("UsedPelMapMarExt        : %d\n", m_iUsedPelMapMarExt );
    383   }
    384 
    385   printf("\n");
    386 
    387   //  printf("TOOL CFG: ");
    388   //  printf("ALF:%d ", m_bUseALF             );
    389   //  printf("\n");
    390 
    391   fflush(stdout);
    392 }
    393 
    394 Void TAppRendererCfg::xPrintUsage()
    395 {
    396   printf( "\n" );
    397   printf( "  Example: TAppRenderer.exe -c test.cfg\n\n");
    398 }
    399 
    400 Bool TAppRendererCfg::xConfirmParameter(Bool bflag, const char* message)
    401 {
    402   if (!bflag)
    403     return false;
    404 
    405   printf("Error: %s\n",message);
    406   return true;
    407 }
    408 
    409 
    410 Void TAppRendererCfg::xCreateFileNames()
    411 {
    412   if ( m_iRenderMode == 10 )
    413     return;
    414 
    415   Int iPrecBefore;
    416   Int iPrecAfter;
    417 
    418   xGetMaxPrecision( m_cCameraData.getSynthViewNumbers(), iPrecBefore, iPrecAfter );
    419 
    420 
    421   if (iPrecBefore > LOG10_VIEW_NUM_PREC )
    422   {
    423     std::cerr << "Error: View Numbers with more than " << LOG10_VIEW_NUM_PREC << " digits are not supported" << std::endl;
    424     exit(EXIT_FAILURE);
    425   }
    426 
    427   AOT( !m_bContOutputFileNumbering && (m_cCameraData.getSynthViewNumbers().size() != m_iNumberOfOutputViews ));
    428   for(Int iIdx = 0; iIdx < m_iNumberOfOutputViews; iIdx++)
    429   {
    430     //GT; Create ReconFileNames
    431     if (m_pchSynthOutputFileList[iIdx] == NULL )
    432     {
    433       if ( m_bContOutputFileNumbering )
    434       {
    435         xAddNumberToFileName( m_pchSynthOutputFileBaseName, m_pchSynthOutputFileList[iIdx], (Int) ((iIdx+1) * VIEW_NUM_PREC) , 2, 0  );
    436       }
    437       else
    438       {
    439         xAddNumberToFileName( m_pchSynthOutputFileBaseName, m_pchSynthOutputFileList[iIdx], m_cCameraData.getSynthViewNumbers()[iIdx], iPrecBefore, iPrecAfter  );
    440       }
    441     }
    442   }
    443 
    444   xGetMaxPrecision( m_cCameraData.getBaseViewNumbers(), iPrecBefore, iPrecAfter );
    445   for(Int iIdx = 0; iIdx < m_cCameraData.getBaseViewNumbers().size() ; iIdx++)
    446   {
    447     //GT; Create ReconFileNames
    448     if (m_pchVideoInputFileList[iIdx] == NULL )
    449     {
    450       xAddNumberToFileName( m_pchVideoInputFileBaseName, m_pchVideoInputFileList[iIdx], m_cCameraData.getBaseViewNumbers()[iIdx], iPrecBefore, iPrecAfter  );
    451     }
    452 
    453     if (m_pchDepthInputFileList[iIdx] == NULL )
    454     {
    455       xAddNumberToFileName( m_pchDepthInputFileBaseName, m_pchDepthInputFileList[iIdx], m_cCameraData.getBaseViewNumbers()[iIdx], iPrecBefore, iPrecAfter  );
    456     }
    457   }
    458 }
    459 
    460 Void TAppRendererCfg::xAddNumberToFileName( TChar* pchSourceFileName, TChar*& rpchTargetFileName, Int iNumberToAdd, UInt uiPrecBefore, UInt uiPrecAfter )
    461 {
    462 
    463   if ( pchSourceFileName == NULL )
    464   {
    465     std::cerr << "No BaseName for file name generation given." << std::endl;
    466     AOT(true);
    467     exit(EXIT_FAILURE);
    468   }
    469 
    470   TChar pchNumberBuffer[2* LOG10_VIEW_NUM_PREC + 2];
    471   TChar pchPrintBuffer[10];
    472 
    473   Double dNumberToAdd = ( (Double) iNumberToAdd ) / VIEW_NUM_PREC;
    474 
    475   UInt uiWidth = uiPrecBefore;
    476 
    477   if (uiPrecAfter != 0)
    478   {
    479     uiWidth += uiPrecAfter + 1;
    480   }
    481 
    482   sprintf( pchPrintBuffer, "%%0%d.%df", uiWidth, uiPrecAfter );
    483   sprintf( pchNumberBuffer, pchPrintBuffer, dNumberToAdd );
    484 
    485   if ( uiPrecAfter > 0 ) pchNumberBuffer[ uiPrecBefore ] = '_';
    486 
    487   size_t iInLength  = strlen(pchSourceFileName);
    488   size_t iAddLength = strlen(pchNumberBuffer);
    489 
    490   rpchTargetFileName = (TChar*) malloc(iInLength+iAddLength+1);
    491 
    492   TChar* pchPlaceHolder = strrchr(pchSourceFileName,'$');
    493   assert( pchPlaceHolder );
    494 
    495   size_t iCharsToPlaceHolder = pchPlaceHolder - pchSourceFileName;
    496   size_t iCharsToEnd         = iInLength      - iCharsToPlaceHolder;
    497 
    498   strncpy(rpchTargetFileName                               , pchSourceFileName                      , iCharsToPlaceHolder);
    499   strncpy(rpchTargetFileName+iCharsToPlaceHolder           , pchNumberBuffer                        , iAddLength         );
    500   strncpy(rpchTargetFileName+iCharsToPlaceHolder+iAddLength, pchSourceFileName+iCharsToPlaceHolder+1, iCharsToEnd-1      );
    501   rpchTargetFileName[iInLength+iAddLength-1] = '\0';
    502 }
    503 
    504 Void TAppRendererCfg::xGetMaxPrecision( IntAry1d aiIn, Int& iPrecBefore, Int& iPrecAfter )
    505 {
    506   iPrecBefore = 0;
    507   iPrecAfter  = 0;
    508 
    509   for (UInt uiK = 0; uiK < aiIn.size(); uiK ++ )
    510   {
    511     if ( aiIn[uiK] == 0 ) continue;
    512 
    513     Int iCurPrec;
    514     iCurPrec = 0;
    515     for ( Int iCur = aiIn[uiK]; iCur != 0; iCur /= 10, iCurPrec++ );
    516     iPrecBefore = max(iPrecBefore, iCurPrec - LOG10_VIEW_NUM_PREC );
    517 
    518     iCurPrec = 0;
    519     for ( Int iCur = 1;  aiIn[uiK] % iCur == 0; iCur *= 10, iCurPrec++);
    520     iCurPrec = LOG10_VIEW_NUM_PREC - std::min((Int) LOG10_VIEW_NUM_PREC, iCurPrec-1 );
    521     iPrecAfter = max(iPrecAfter, iCurPrec );
    522   }
    523 }
    524 
    525 #endif
  • branches/HTM-16.0-MV-draft-5/source/App/TAppRenderer/TAppRendererCfg.h

    r1386 r1390  
    4747#include <vector>
    4848
    49 #if NH_3D_VSO
    50 
    51 // ====================================================================================================================
    52 // Class definition
    53 // ====================================================================================================================
    54 
    55 /// encoder configuration class
    56 class TAppRendererCfg
    57 {
    58 protected:
    59 
    60   //// file I/O ////
    61   TChar*             m_pchVideoInputFileBaseName;      ///< input video  file base name, placeholder for numbering $$
    62   TChar*             m_pchDepthInputFileBaseName;      ///< input depth  file base name, placeholder for numbering $$
    63   TChar*             m_pchSynthOutputFileBaseName;     ///< output synth file base name, placeholder for numbering $$
    64   Bool               m_bContOutputFileNumbering;       ///< use continous numbering instead of view numbering
    65   Bool               m_bSweep;                         ///< 1: Store view range in file
    66 
    67 
    68   // bit-depth      ( Currently internal, output and input luma and chroma bit-depth are required to be equal to 8 )
    69   Int                m_inputBitDepth[2];               ///< bit-depth of input file (luma/chroma component) 
    70   Int                m_outputBitDepth[2];              ///< bit-depth of output file (luma/chroma component)   
    71   Int                m_internalBitDepth[2];            ///< bit-depth renderer operates at in luma/chroma (input/output files will be converted)
    72 
    73 
    74   // derived
    75   std::vector<TChar*> m_pchVideoInputFileList;         ///< source file names
    76   std::vector<TChar*> m_pchDepthInputFileList;         ///< source depth file names
    77   std::vector<TChar*> m_pchSynthOutputFileList;        ///< output reconstruction file names
    78 
    79   //// source specification ////
    80   Int                m_iSourceWidth;                   ///< source width in pixel
    81   Int                m_iSourceHeight;                  ///< source height in pixel
    82   Int                m_iFrameSkip;                     ///< number of skipped frames from the beginning
    83   Int                m_iFramesToBeRendered;            ///< number of rendered frames
    84 
    85   ////camera specification ////
    86   TChar*             m_pchCameraParameterFile;         ///< camera parameter file
    87   TChar*             m_pchSynthViewCameraNumbers;      ///< numbers of views to synthesize
    88   TChar*             m_pchViewConfig;                  ///< String to setup renderer
    89   TChar*             m_pchBaseViewCameraNumbers;       ///< numbers of base views
    90 
    91   // derived
    92   TAppComCamPara      m_cCameraData;                    ///< class to store camera parameters
    93   TRenModSetupStrParser m_cRenModStrParser;             ///< class to manage View to be rendered
    94   Bool                m_bUseSetupString;                ///< true if setup string is used
    95 
    96   Int                 m_iNumberOfInputViews;            ///< number of input Views
    97   Int                 m_iNumberOfOutputViews;           ///< number views to synthesize
    98 
    99   //// renderer Modes ////
    100   Int                 m_iRenderDirection;               ///< 0: interpolate, 1: extrapolate from left, 2: extrapolate from right
    101 
    102   Int                 m_iLog2SamplingFactor;            ///< factor for horizontal upsampling before processing
    103   Bool                m_bUVUp;                          ///< upsampling of chroma planes before processing
    104   Int                 m_iPreProcMode;                   ///< depth pre-processing: 0 = none, 1 = binominal filtering
    105   Int                 m_iPreFilterSize;                 ///< for PreProcMode = 1: size of filter kernel
    106   Bool                m_bSimEnhance;                    ///< Similarity enhancement before blending
    107   Int                 m_iBlendMode;                     ///< merging of left and right image: 0 = average, 1 = only holes from right, 2 = only holes from left
    108   Int                 m_iBlendZThresPerc;               ///< z-difference threshold for blending in percent of total z-range
    109   Bool                m_bBlendUseDistWeight;            ///< 0: blend using average; 1: blend factor depends on view distance
    110   Int                 m_iBlendHoleMargin;               ///< Margin around boundaries
    111   Bool                m_bTempDepthFilter;               ///< Zheijang temporal enhancement filter
    112   Int                 m_iInterpolationMode;             ///< 0: NN, 1: linear, 2: cspline
    113   Int                 m_iHoleFillingMode;               ///< 0: none, 1: line wise background extension
    114   Int                 m_iPostProcMode;                  ///< 0: none, 1: horizontal 3-tap median
    115   Int                 m_iRenderMode;                      ///< 0: use renderer
    116   Int                 m_iShiftPrecision;                ///< Precision used for Interpolation Mode 4
    117   Int                 m_iUsedPelMapMarExt;              ///< Used Pel map extra margin
    118 
    119   Void xCheckParameter ();                              ///< check validity of configuration values
    120   Void xPrintParameter ();                              ///< print configuration values
    121   Void xPrintUsage     ();                              ///< print usage
    122 
    123   Void xCreateFileNames();
    124   Void xGetMaxPrecision( IntAry1d adIn, Int& iPrecBefore, Int& iPrecAfter );
    125   Void xAddNumberToFileName( TChar* pchSourceFileName, TChar*& rpchTargetFileName, Int iNumberToAdd, UInt uiPrecBefore, UInt uiPrecAfter );
    126 public:
    127   TAppRendererCfg();
    128   virtual ~TAppRendererCfg();
    129 
    130 public:
    131   Void  create    ();                                         ///< create option handling class
    132   Void  destroy   ();                                         ///< destroy option handling class
    133   Bool  parseCfg  ( Int argc, TChar* argv[] );                 ///< parse configuration file to fill member variables
    134   Bool  xConfirmParameter(Bool bflag, const TChar* message);
    135 
    136 
    137 };// END CLASS DEFINITION TAppRendererCfg
    138 
    139 #endif // __TAppRENDERERCFG__
    14049#endif // NH_3D
  • branches/HTM-16.0-MV-draft-5/source/App/TAppRenderer/TAppRendererTop.cpp

    r1386 r1390  
    4141#include "TAppRendererTop.h"
    4242
    43 #if NH_3D_VSO
    44 
    45 // ====================================================================================================================
    46 // Constructor / destructor / initialization / destroy
    47 // ====================================================================================================================
    48 
    49 TAppRendererTop::TAppRendererTop()
    50 {
    51 
    52 }
    53 
    54 TAppRendererTop::~TAppRendererTop()
    55 {
    56 
    57 }
    58 
    59 
    60 Void TAppRendererTop::xCreateLib()
    61 {
    62   m_pcRenTop = new TRenTop();
    63 
    64   for(Int iViewIdx=0; iViewIdx<m_iNumberOfInputViews; iViewIdx++)
    65   {
    66     TVideoIOYuv* pcVideoInput = new TVideoIOYuv;
    67     TVideoIOYuv* pcDepthInput = new TVideoIOYuv;
    68 
    69 //    ( Char* pchFile, Bool bWriteMode, const Int fileBitDepth[MAX_NUM_CHANNEL_TYPE], const Int MSBExtendedBitDepth[MAX_NUM_CHANNEL_TYPE], const Int internalBitDepth[MAX_NUM_CHANNEL_TYPE] )
    70 
    71     pcVideoInput->open( m_pchVideoInputFileList[iViewIdx], false, m_inputBitDepth, m_internalBitDepth, m_internalBitDepth );  // read mode
    72     pcDepthInput->open( m_pchDepthInputFileList[iViewIdx], false, m_inputBitDepth, m_internalBitDepth, m_internalBitDepth );  // read mode
    73     pcVideoInput->skipFrames(m_iFrameSkip, m_iSourceWidth, m_iSourceHeight, CHROMA_420 );
    74     pcDepthInput->skipFrames(m_iFrameSkip, m_iSourceWidth, m_iSourceHeight, CHROMA_420 );
    75 
    76     m_apcTVideoIOYuvVideoInput.push_back( pcVideoInput );
    77     m_apcTVideoIOYuvDepthInput.push_back( pcDepthInput );
    78   }
    79 
    80   for(Int iViewIdx=0; iViewIdx<m_iNumberOfOutputViews; iViewIdx++)
    81   {
    82     TVideoIOYuv* pcSynthOutput = new TVideoIOYuv;
    83     pcSynthOutput->open( m_pchSynthOutputFileList[iViewIdx], true, m_outputBitDepth, m_internalBitDepth, m_internalBitDepth );  // write mode
    84     m_apcTVideoIOYuvSynthOutput.push_back( pcSynthOutput );
    85   }
    86 }
    87 
    88 
    89 Void TAppRendererTop::xDestroyLib()
    90 {
    91   delete m_pcRenTop;
    92 
    93   for ( Int iViewIdx = 0; iViewIdx < m_iNumberOfInputViews; iViewIdx++ )
    94   {
    95     m_apcTVideoIOYuvVideoInput[iViewIdx]->close();
    96     m_apcTVideoIOYuvDepthInput[iViewIdx]->close();
    97 
    98     delete m_apcTVideoIOYuvDepthInput[iViewIdx];
    99     delete m_apcTVideoIOYuvVideoInput[iViewIdx];
    100   };
    101 
    102   for ( Int iViewIdx = 0; iViewIdx < m_iNumberOfOutputViews; iViewIdx++ )
    103   {
    104     m_apcTVideoIOYuvSynthOutput[iViewIdx]->close();
    105     delete m_apcTVideoIOYuvSynthOutput[iViewIdx];
    106   };
    107 }
    108 
    109 Void TAppRendererTop::xInitLib()
    110 {
    111     m_pcRenTop->init(
    112     m_iSourceWidth,
    113     m_iSourceHeight,
    114     (m_iRenderDirection != 0),
    115     m_iLog2SamplingFactor,
    116     m_iLog2SamplingFactor+m_iShiftPrecision,
    117     m_bUVUp,
    118     m_iPreProcMode,
    119     m_iPreFilterSize,
    120     m_iBlendMode,
    121     m_iBlendZThresPerc,
    122     m_bBlendUseDistWeight,
    123     m_iBlendHoleMargin,
    124     m_iInterpolationMode,
    125     m_iHoleFillingMode,
    126     m_iPostProcMode,
    127     m_iUsedPelMapMarExt
    128     );
    129 }
    130 
    131 // ====================================================================================================================
    132 // Public member functions
    133 // ====================================================================================================================
    134 
    135 
    136 
    137 Void TAppRendererTop::render()
    138 {
    139   xCreateLib();
    140   xInitLib();
    141 
    142   // Create Buffers Input Views;
    143   std::vector<TComPicYuv*> apcPicYuvBaseVideo;
    144   std::vector<TComPicYuv*> apcPicYuvBaseDepth;
    145 
    146   // TemporalImprovement Filter
    147   std::vector<TComPicYuv*> apcPicYuvLastBaseVideo;
    148   std::vector<TComPicYuv*> apcPicYuvLastBaseDepth;
    149 
    150   Int aiPad[2] = { 0, 0 };
    151 
    152   TComPicYuv* pcNewOrg = new TComPicYuv;
    153   pcNewOrg->create( m_iSourceWidth, m_iSourceHeight, CHROMA_420, 1, 1, 1, true );
    154 
    155   for ( UInt uiBaseView = 0; uiBaseView < m_iNumberOfInputViews; uiBaseView++ )
    156   {
    157     TComPicYuv* pcNewVideoPic = new TComPicYuv;
    158     TComPicYuv* pcNewDepthPic = new TComPicYuv;
    159 
    160     pcNewVideoPic->create( m_iSourceWidth, m_iSourceHeight, CHROMA_420, 1, 1, 1, true );
    161     apcPicYuvBaseVideo.push_back(pcNewVideoPic);
    162 
    163     pcNewDepthPic->create( m_iSourceWidth, m_iSourceHeight, CHROMA_420, 1, 1, 1, true);
    164     apcPicYuvBaseDepth.push_back(pcNewDepthPic);
    165 
    166     //Temporal improvement Filter
    167     if ( m_bTempDepthFilter )
    168     {
    169       pcNewVideoPic = new TComPicYuv;
    170       pcNewDepthPic = new TComPicYuv;
    171 
    172       pcNewVideoPic->create( m_iSourceWidth, m_iSourceHeight, CHROMA_420, 1, 1, 1, true );
    173       apcPicYuvLastBaseVideo.push_back(pcNewVideoPic);
    174 
    175       pcNewDepthPic->create( m_iSourceWidth, m_iSourceHeight, CHROMA_420, 1, 1, 1, true );
    176       apcPicYuvLastBaseDepth.push_back(pcNewDepthPic);
    177     }
    178   }
    179 
    180   // Create Buffer for synthesized View
    181   TComPicYuv* pcPicYuvSynthOut = new TComPicYuv;
    182   pcPicYuvSynthOut->create( m_iSourceWidth, m_iSourceHeight, CHROMA_420, 1, 1, 1, true );
    183 
    184   Bool bAnyEOS = false;
    185 
    186   Int iNumOfRenderedFrames = 0;
    187   Int iFrame = 0;
    188 
    189   while ( ( ( iNumOfRenderedFrames < m_iFramesToBeRendered ) || ( m_iFramesToBeRendered == 0 ) ) && !bAnyEOS )
    190   {
    191     if ( iFrame >= m_iFrameSkip )
    192     {
    193       // read in depth and video
    194       for(Int iBaseViewIdx=0; iBaseViewIdx < m_iNumberOfInputViews; iBaseViewIdx++ )
    195       {
    196         m_apcTVideoIOYuvVideoInput[iBaseViewIdx]->read( apcPicYuvBaseVideo[iBaseViewIdx],pcNewOrg, IPCOLOURSPACE_UNCHANGED, aiPad, CHROMA_420  ) ;
    197 
    198         apcPicYuvBaseVideo[iBaseViewIdx]->extendPicBorder();
    199 
    200         bAnyEOS |= m_apcTVideoIOYuvVideoInput[iBaseViewIdx]->isEof();
    201 
    202         m_apcTVideoIOYuvDepthInput[iBaseViewIdx]->read( apcPicYuvBaseDepth[iBaseViewIdx],pcNewOrg, IPCOLOURSPACE_UNCHANGED, aiPad, CHROMA_420  ) ;
    203         apcPicYuvBaseDepth[iBaseViewIdx]->extendPicBorder();
    204         bAnyEOS |= m_apcTVideoIOYuvDepthInput[iBaseViewIdx]->isEof();
    205 
    206         if ( m_bTempDepthFilter && (iFrame >= m_iFrameSkip) )
    207         {
    208           m_pcRenTop->temporalFilterVSRS( apcPicYuvBaseVideo[iBaseViewIdx], apcPicYuvBaseDepth[iBaseViewIdx], apcPicYuvLastBaseVideo[iBaseViewIdx], apcPicYuvLastBaseDepth[iBaseViewIdx], ( iFrame == m_iFrameSkip) );
    209         }
    210       }
    211     }
    212     else   
    213     {
    214       std::cout << "Skipping Frame " << iFrame << std::endl;
    215 
    216       iFrame++;
    217       continue;
    218     }
    219 
    220     m_cCameraData.update( (UInt)iFrame - m_iFrameSkip );
    221 
    222     for(Int iSynthViewIdx=0; iSynthViewIdx < m_iNumberOfOutputViews; iSynthViewIdx++ )
    223     {
    224       Int  iLeftBaseViewIdx  = -1;
    225       Int  iRightBaseViewIdx = -1;
    226 
    227       Bool bIsBaseView = false;
    228 
    229       Int iRelDistToLeft;
    230       Bool bHasLRView = m_cCameraData.getLeftRightBaseView( iSynthViewIdx, iLeftBaseViewIdx, iRightBaseViewIdx, iRelDistToLeft, bIsBaseView );
    231       Bool bHasLView = ( iLeftBaseViewIdx != -1 );
    232       Bool bHasRView = ( iRightBaseViewIdx != -1 );
    233       Bool bRender   = true;
    234 
    235       Int  iBlendMode = m_iBlendMode;
    236       Int  iSimEnhBaseView = 0;
    237 
    238       switch( m_iRenderDirection )
    239       {
    240       /// INTERPOLATION
    241       case 0:
    242         AOF( bHasLRView || bIsBaseView );
    243 
    244         if ( !bHasLRView && bIsBaseView && m_iBlendMode == 0 )
    245         {
    246           bRender = false;
    247         }
    248         else
    249         {
    250           if ( bIsBaseView )
    251           {
    252             AOF( iLeftBaseViewIdx == iRightBaseViewIdx );
    253             Int iSortedBaseViewIdx = m_cCameraData.getBaseId2SortedId() [iLeftBaseViewIdx];
    254 
    255             if ( m_iBlendMode == 1 )
    256             {
    257               if ( iSortedBaseViewIdx - 1 >= 0 )
    258               {
    259                 iLeftBaseViewIdx = m_cCameraData.getBaseSortedId2Id()[ iSortedBaseViewIdx - 1];
    260                 bRender = true;
    261               }
    262               else
    263               {
    264                 bRender = false;
    265               }
    266             }
    267             else if ( m_iBlendMode == 2 )
    268             {
    269               if ( iSortedBaseViewIdx + 1 < m_iNumberOfInputViews )
    270               {
    271                 iRightBaseViewIdx = m_cCameraData.getBaseSortedId2Id()[ iSortedBaseViewIdx + 1];
    272                 bRender = true;
    273               }
    274               else
    275               {
    276                 bRender = false;
    277               }
    278             }
    279           }
    280 
    281           if ( m_iBlendMode == 3 )
    282           {
    283             if ( bIsBaseView && (iLeftBaseViewIdx == 0) )
    284             {
    285               bRender = false;
    286             }
    287             else
    288             {
    289               Int iDistLeft  = abs( m_cCameraData.getBaseId2SortedId()[0] - m_cCameraData.getBaseId2SortedId() [iLeftBaseViewIdx ]  );
    290               Int iDistRight = abs( m_cCameraData.getBaseId2SortedId()[0] - m_cCameraData.getBaseId2SortedId() [iRightBaseViewIdx]  );
    291 
    292               Int iFillViewIdx = iDistLeft > iDistRight ? iLeftBaseViewIdx : iRightBaseViewIdx;
    293 
    294               if( m_cCameraData.getBaseId2SortedId()[0] < m_cCameraData.getBaseId2SortedId() [iFillViewIdx] )
    295               {
    296                 iBlendMode        = 1;
    297                 iLeftBaseViewIdx  = 0;
    298                 iRightBaseViewIdx = iFillViewIdx;
    299               }
    300               else
    301               {
    302                 iBlendMode        = 2;
    303                 iLeftBaseViewIdx  = iFillViewIdx;
    304                 iRightBaseViewIdx = 0;
    305               }
    306 
    307             }
    308           }
    309           else
    310           {
    311             iBlendMode = m_iBlendMode;
    312           }
    313         }
    314 
    315         if ( m_bSimEnhance )
    316         {
    317           if ( m_iNumberOfInputViews == 3 && m_cCameraData.getRelSynthViewNumbers()[ iSynthViewIdx ] < VIEW_NUM_PREC  )
    318           {
    319             iSimEnhBaseView = 2; // Take middle view
    320           }
    321           else
    322           {
    323             iSimEnhBaseView = 1; // Take left view
    324           }
    325         }
    326 
    327           if ( bRender )
    328           {
    329           std::cout << "Rendering Frame "    << iFrame
    330                     << " of View "           << (Double) m_cCameraData.getSynthViewNumbers()[iSynthViewIdx    ] / VIEW_NUM_PREC
    331                     << "   Left BaseView: "  << (Double) m_cCameraData.getBaseViewNumbers() [iLeftBaseViewIdx ] / VIEW_NUM_PREC
    332                     << "   Right BaseView: " << (Double) m_cCameraData.getBaseViewNumbers() [iRightBaseViewIdx] / VIEW_NUM_PREC
    333                     << "   BlendMode: "      << iBlendMode
    334                     << std::endl;
    335 
    336           m_pcRenTop->setShiftLUTs(
    337             m_cCameraData.getSynthViewShiftLUTD()[iLeftBaseViewIdx ][iSynthViewIdx],
    338             m_cCameraData.getSynthViewShiftLUTI()[iLeftBaseViewIdx ][iSynthViewIdx],
    339             m_cCameraData.getBaseViewShiftLUTI ()[iLeftBaseViewIdx ][iRightBaseViewIdx],
    340             m_cCameraData.getSynthViewShiftLUTD()[iRightBaseViewIdx][iSynthViewIdx],
    341             m_cCameraData.getSynthViewShiftLUTI()[iRightBaseViewIdx][iSynthViewIdx],
    342             m_cCameraData.getBaseViewShiftLUTI ()[iRightBaseViewIdx][iLeftBaseViewIdx ],
    343 
    344             iRelDistToLeft
    345           );
    346 
    347           m_pcRenTop->interpolateView(
    348             apcPicYuvBaseVideo[iLeftBaseViewIdx ],
    349             apcPicYuvBaseDepth[iLeftBaseViewIdx ],
    350             apcPicYuvBaseVideo[iRightBaseViewIdx],
    351             apcPicYuvBaseDepth[iRightBaseViewIdx],
    352             pcPicYuvSynthOut,
    353             iBlendMode,
    354             iSimEnhBaseView
    355             );
    356         }
    357         else
    358         {
    359           AOT(iLeftBaseViewIdx != iRightBaseViewIdx );
    360           apcPicYuvBaseVideo[iLeftBaseViewIdx]->copyToPic( pcPicYuvSynthOut );
    361           std::cout << "Copied    Frame " << iFrame
    362                     << " of View "        << (Double) m_cCameraData.getSynthViewNumbers()[iSynthViewIdx] / VIEW_NUM_PREC
    363                     << "   (BaseView)  "    << std::endl;
    364         }
    365 
    366         break;
    367       /// EXTRAPOLATION FROM LEFT
    368       case 1:
    369         if ( !bHasLView ) // View to render is BaseView
    370         {
    371           bRender = false;
    372         }
    373 
    374           if (  bIsBaseView )
    375           {
    376           AOF( iLeftBaseViewIdx == iRightBaseViewIdx );
    377           Int iSortedBaseViewIdx = m_cCameraData.getBaseId2SortedId() [iLeftBaseViewIdx];
    378           if ( iSortedBaseViewIdx - 1 >= 0 )
    379           {
    380             iLeftBaseViewIdx = m_cCameraData.getBaseSortedId2Id()[ iSortedBaseViewIdx - 1];
    381           }
    382           else
    383           {
    384             std::cout << "Copied    Frame " << iFrame << " of BaseView " << (Double) m_cCameraData.getSynthViewNumbers()[iSynthViewIdx] / VIEW_NUM_PREC  << std::endl;
    385             apcPicYuvBaseVideo[iLeftBaseViewIdx]->copyToPic( pcPicYuvSynthOut ); // Copy Original
    386             bRender = false;
    387           }
    388         }
    389 
    390 
    391         if (bRender)
    392         {
    393           std::cout << "Rendering Frame " << iFrame << " of View " << (Double) m_cCameraData.getSynthViewNumbers()[iSynthViewIdx] / VIEW_NUM_PREC  << std::endl;
    394           m_pcRenTop->setShiftLUTs( m_cCameraData.getSynthViewShiftLUTD()[iLeftBaseViewIdx ][iSynthViewIdx],
    395             m_cCameraData.getSynthViewShiftLUTI()[iLeftBaseViewIdx ][iSynthViewIdx], NULL, NULL, NULL, NULL, -1 );
    396           m_pcRenTop->extrapolateView( apcPicYuvBaseVideo[iLeftBaseViewIdx ], apcPicYuvBaseDepth[iLeftBaseViewIdx ], pcPicYuvSynthOut, true );
    397         }
    398         break;
    399       /// EXTRAPOLATION FROM RIGHT
    400       case 2:            // extrapolation from right
    401         if ( !bHasRView ) // View to render is BaseView
    402         {
    403           bRender = false;
    404         }
    405 
    406           if (  bIsBaseView )
    407           {
    408 
    409           AOF( iLeftBaseViewIdx == iRightBaseViewIdx );
    410           Int iSortedBaseViewIdx = m_cCameraData.getBaseId2SortedId() [iLeftBaseViewIdx];
    411           if ( iSortedBaseViewIdx + 1 < m_iNumberOfInputViews )
    412           {
    413             iRightBaseViewIdx = m_cCameraData.getBaseSortedId2Id()[ iSortedBaseViewIdx + 1];
    414           }
    415           else
    416           {
    417             std::cout << "Copied    Frame " << iFrame << " of BaseView " << (Double) m_cCameraData.getSynthViewNumbers()[iSynthViewIdx] / VIEW_NUM_PREC  << std::endl;
    418             apcPicYuvBaseVideo[iLeftBaseViewIdx]->copyToPic( pcPicYuvSynthOut ); // Copy Original
    419             bRender = false;
    420           }
    421         }
    422 
    423         if ( bRender )
    424         {
    425           std::cout << "Rendering Frame " << iFrame << " of View " << (Double) m_cCameraData.getSynthViewNumbers()[iSynthViewIdx] / VIEW_NUM_PREC  << std::endl;
    426           m_pcRenTop->setShiftLUTs( NULL, NULL,NULL, m_cCameraData.getSynthViewShiftLUTD()[iRightBaseViewIdx ][iSynthViewIdx],
    427             m_cCameraData.getSynthViewShiftLUTI()[iRightBaseViewIdx ][iSynthViewIdx],NULL, iRelDistToLeft);
    428           m_pcRenTop->extrapolateView( apcPicYuvBaseVideo[iRightBaseViewIdx ], apcPicYuvBaseDepth[iRightBaseViewIdx ], pcPicYuvSynthOut, false);
    429         }
    430         break;
    431       }
    432 
    433       // Write Output
    434 
    435       m_apcTVideoIOYuvSynthOutput[m_bSweep ? 0 : iSynthViewIdx]->write( pcPicYuvSynthOut, IPCOLOURSPACE_UNCHANGED, 0, 0, 0, 0, CHROMA_420 );
    436     }
    437     iFrame++;
    438     iNumOfRenderedFrames++;
    439   }
    440 
    441   // Delete Buffers
    442   pcNewOrg->destroy();
    443   delete pcNewOrg;
    444 
    445   for ( UInt uiBaseView = 0; uiBaseView < m_iNumberOfInputViews; uiBaseView++ )
    446   {
    447     apcPicYuvBaseVideo[uiBaseView]->destroy();
    448     delete apcPicYuvBaseVideo[uiBaseView];
    449 
    450     apcPicYuvBaseDepth[uiBaseView]->destroy();
    451     delete apcPicYuvBaseDepth[uiBaseView];
    452 
    453     // Temporal Filter
    454     if ( m_bTempDepthFilter )
    455     {
    456       apcPicYuvLastBaseVideo[uiBaseView]->destroy();
    457       delete apcPicYuvLastBaseVideo[uiBaseView];
    458 
    459       apcPicYuvLastBaseDepth[uiBaseView]->destroy();
    460       delete apcPicYuvLastBaseDepth[uiBaseView];
    461     }
    462   }
    463 
    464   pcPicYuvSynthOut->destroy();
    465   delete pcPicYuvSynthOut;
    466 
    467   xDestroyLib();
    468 
    469 }
    470 
    471 Void TAppRendererTop::go()
    472 {
    473   switch ( m_iRenderMode )
    474   {
    475   case 0:
    476     render();
    477     break;
    478 #if NH_3D_VSO
    479   case 1:
    480     renderModel();
    481     break;
    482 #endif
    483   case 10:
    484     renderUsedPelsMap( );
    485       break;
    486   default:
    487     AOT(true);
    488   }
    489 
    490 #if NH_3D_REN_MAX_DEV_OUT
    491   Double dMaxDispDiff = m_cCameraData.getMaxShiftDeviation();
    492 
    493   if ( !(dMaxDispDiff < 0) )
    494   { 
    495     printf("\n Max. possible shift error: %12.3f samples.\n", dMaxDispDiff );
    496   }
    497 #endif
    498 }
    499 
    500 #if NH_3D_VSO
    501 Void TAppRendererTop::renderModel()
    502 {
    503   if ( m_bUseSetupString )
    504   {
    505     xRenderModelFromString();
    506   }
    507   else
    508   {
    509     xRenderModelFromNums();
    510   }
    511 }
    512 
    513 
    514 
    515 Void TAppRendererTop::xRenderModelFromString()
    516 {
    517     xCreateLib();
    518     xInitLib();
    519 
    520     // Create Buffers Input Views;
    521     std::vector<TComPicYuv*> apcPicYuvBaseVideo;
    522     std::vector<TComPicYuv*> apcPicYuvBaseDepth;
    523 
    524 
    525     for ( UInt uiBaseView = 0; uiBaseView < m_iNumberOfInputViews; uiBaseView++ )
    526     {
    527       TComPicYuv* pcNewVideoPic = new TComPicYuv;
    528       TComPicYuv* pcNewDepthPic = new TComPicYuv;
    529 
    530       pcNewVideoPic->create( m_iSourceWidth, m_iSourceHeight, CHROMA_420, 1, 1, 1, true );
    531       apcPicYuvBaseVideo.push_back(pcNewVideoPic);
    532 
    533       pcNewDepthPic->create( m_iSourceWidth, m_iSourceHeight, CHROMA_420, 1, 1, 1, true );
    534       apcPicYuvBaseDepth.push_back(pcNewDepthPic);
    535     }
    536 
    537     Int aiPad[2] = { 0, 0 };
    538     TComPicYuv* pcNewOrg = new TComPicYuv;
    539     pcNewOrg->create( m_iSourceWidth, m_iSourceHeight, CHROMA_420, 1, 1, 1, true );
    540 
    541     // Init Model
    542     TRenModel cCurModel;
    543 
    544     AOT( m_iLog2SamplingFactor != 0 );
    545 #if H_3D_VSO_EARLY_SKIP
    546     cCurModel.create( m_cRenModStrParser.getNumOfBaseViews(), m_cRenModStrParser.getNumOfModels(), m_iSourceWidth, m_iSourceHeight, m_iShiftPrecision, m_iBlendHoleMargin, false );
    547 #else
    548     cCurModel.create( m_cRenModStrParser.getNumOfBaseViews(), m_cRenModStrParser.getNumOfModels(), m_iSourceWidth, m_iSourceHeight, m_iShiftPrecision, m_iBlendHoleMargin );
    549 #endif
    550 
    551     cCurModel.setupPart( 0, m_iSourceHeight  );
    552 
    553     for ( Int iViewIdx = 0; iViewIdx < m_iNumberOfInputViews; iViewIdx++ )
    554     {
    555       Int iNumOfModels   = m_cRenModStrParser.getNumOfModelsForView(iViewIdx, 1);
    556 
    557       for (Int iCurModel = 0; iCurModel < iNumOfModels; iCurModel++ )
    558       {
    559         Int iModelNum; Int iLeftViewNum; Int iRightViewNum; Int iDump; Int iOrgRefNum; Int iBlendMode;
    560         m_cRenModStrParser.getSingleModelData  ( iViewIdx, 1, iCurModel, iModelNum, iBlendMode, iLeftViewNum, iRightViewNum, iOrgRefNum, iDump ) ;
    561         cCurModel         .createSingleModel   ( iViewIdx, 1, iModelNum, iLeftViewNum, iRightViewNum, false, iBlendMode );
    562       }
    563     }
    564 
    565     // Create Buffer for synthesized View
    566     TComPicYuv* pcPicYuvSynthOut = new TComPicYuv;
    567     pcPicYuvSynthOut->create( m_iSourceWidth, m_iSourceHeight, CHROMA_420, 1, 1, 1, true );
    568 
    569     Bool bAnyEOS = false;
    570 
    571     Int iNumOfRenderedFrames = 0;
    572     Int iFrame = 0;
    573 
    574     while ( ( ( iNumOfRenderedFrames < m_iFramesToBeRendered ) || ( m_iFramesToBeRendered == 0 ) ) && !bAnyEOS )
    575     {
    576 
    577       if ( iFrame >= m_iFrameSkip )
    578       {     
    579         // read in depth and video
    580         for(Int iBaseViewIdx=0; iBaseViewIdx < m_iNumberOfInputViews; iBaseViewIdx++ )
    581         {
    582           m_apcTVideoIOYuvVideoInput[iBaseViewIdx]->read( apcPicYuvBaseVideo[iBaseViewIdx], pcNewOrg, IPCOLOURSPACE_UNCHANGED, aiPad, CHROMA_420  ) ;
    583           bAnyEOS |= m_apcTVideoIOYuvVideoInput[iBaseViewIdx]->isEof();
    584 
    585           m_apcTVideoIOYuvDepthInput[iBaseViewIdx]->read( apcPicYuvBaseDepth[iBaseViewIdx], pcNewOrg, IPCOLOURSPACE_UNCHANGED, aiPad, CHROMA_420  ) ;
    586           bAnyEOS |= m_apcTVideoIOYuvDepthInput[iBaseViewIdx]->isEof();
    587         }
    588       }
    589       else
    590       {
    591         iFrame++;
    592         continue;
    593       }
    594 
    595 
    596       for(Int iBaseViewIdx=0; iBaseViewIdx < m_iNumberOfInputViews; iBaseViewIdx++ )
    597       {
    598         TComPicYuv* pcPicYuvVideo = apcPicYuvBaseVideo[iBaseViewIdx];
    599         TComPicYuv* pcPicYuvDepth = apcPicYuvBaseDepth[iBaseViewIdx];
    600         Int iBaseViewSIdx = m_cCameraData.getBaseId2SortedId()[iBaseViewIdx ];
    601         cCurModel.setBaseView( iBaseViewSIdx, pcPicYuvVideo, pcPicYuvDepth, NULL, NULL );
    602       }
    603 
    604       m_cCameraData.update( (UInt) ( iFrame - m_iFrameSkip ));
    605 
    606       for(Int iBaseViewIdx=0; iBaseViewIdx < m_iNumberOfInputViews; iBaseViewIdx++ )
    607       {
    608         // setup virtual views
    609         Int iBaseViewSIdx = m_cCameraData.getBaseId2SortedId()[iBaseViewIdx];
    610 
    611         cCurModel.setErrorMode( iBaseViewSIdx, 1, 0 );
    612         Int iNumOfSV  = m_cRenModStrParser.getNumOfModelsForView( iBaseViewSIdx, 1);
    613         for (Int iCurView = 0; iCurView < iNumOfSV; iCurView++ )
    614         {
    615           Int iOrgRefBaseViewSIdx;
    616           Int iLeftBaseViewSIdx;
    617           Int iRightBaseViewSIdx;
    618           Int iSynthViewRelNum;
    619           Int iModelNum;
    620           Int iBlendMode;
    621 
    622           m_cRenModStrParser.getSingleModelData(iBaseViewSIdx, 1, iCurView, iModelNum, iBlendMode, iLeftBaseViewSIdx, iRightBaseViewSIdx, iOrgRefBaseViewSIdx, iSynthViewRelNum );
    623 
    624           Int iLeftBaseViewIdx    = -1;
    625           Int iRightBaseViewIdx   = -1;
    626 
    627           TComPicYuv* pcPicYuvOrgRef  = NULL;
    628           Int**      ppiShiftLUTLeft  = NULL;
    629           Int**      ppiShiftLUTRight = NULL;
    630           Int**      ppiBaseShiftLUTLeft  = NULL;
    631           Int**      ppiBaseShiftLUTRight = NULL;
    632 
    633 
    634           Int        iDistToLeft      = -1;
    635 
    636           Int iSynthViewIdx = m_cCameraData.synthRelNum2Idx( iSynthViewRelNum );
    637 
    638           if ( iLeftBaseViewSIdx != -1 )
    639           {
    640             iLeftBaseViewIdx   = m_cCameraData.getBaseSortedId2Id()   [ iLeftBaseViewSIdx ];
    641             ppiShiftLUTLeft    = m_cCameraData.getSynthViewShiftLUTI()[ iLeftBaseViewIdx  ][ iSynthViewIdx  ];
    642           }
    643 
    644           if ( iRightBaseViewSIdx != -1 )
    645           {
    646             iRightBaseViewIdx  = m_cCameraData.getBaseSortedId2Id()   [iRightBaseViewSIdx ];
    647             ppiShiftLUTRight   = m_cCameraData.getSynthViewShiftLUTI()[ iRightBaseViewIdx ][ iSynthViewIdx ];
    648           }
    649 
    650           if ( iRightBaseViewSIdx != -1 && iLeftBaseViewSIdx != -1 )
    651           {
    652 
    653             ppiBaseShiftLUTLeft  = m_cCameraData.getBaseViewShiftLUTI() [ iLeftBaseViewIdx  ][ iRightBaseViewIdx ];
    654             ppiBaseShiftLUTRight = m_cCameraData.getBaseViewShiftLUTI() [ iRightBaseViewIdx ][ iLeftBaseViewIdx  ];
    655             iDistToLeft    = m_cCameraData.getRelDistLeft(  iSynthViewIdx , iLeftBaseViewIdx, iRightBaseViewIdx);
    656           }
    657 
    658           std::cout << "Rendering Frame " << iFrame << " of View " << (Double) m_cCameraData.getSynthViewNumbers()[iSynthViewIdx] / VIEW_NUM_PREC  << std::endl;
    659 
    660           cCurModel.setSingleModel( iModelNum, ppiShiftLUTLeft, ppiBaseShiftLUTLeft, ppiShiftLUTRight, ppiBaseShiftLUTRight, iDistToLeft, pcPicYuvOrgRef );
    661 
    662           Int iViewPos;
    663           if (iLeftBaseViewSIdx != -1 && iRightBaseViewSIdx != -1)
    664           {
    665             iViewPos = VIEWPOS_MERGED;
    666           }
    667           else if ( iLeftBaseViewSIdx != -1 )
    668           {
    669             iViewPos = VIEWPOS_LEFT;
    670           }
    671           else if ( iRightBaseViewSIdx != -1 )
    672           {
    673             iViewPos = VIEWPOS_RIGHT;
    674           }
    675           else
    676           {
    677             AOT(true);
    678           }
    679 
    680           cCurModel.getSynthVideo ( iModelNum, iViewPos, pcPicYuvSynthOut );
    681 
    682           // Write Output
    683           m_apcTVideoIOYuvSynthOutput[m_bSweep ? 0 : iModelNum]->write( pcPicYuvSynthOut, IPCOLOURSPACE_UNCHANGED,  0 ,0 ,0, 0, CHROMA_420 );
    684         }
    685       }
    686       iFrame++;
    687       iNumOfRenderedFrames++;
    688   }
    689 
    690     // Delete Buffers
    691     for ( UInt uiBaseView = 0; uiBaseView < m_iNumberOfInputViews; uiBaseView++ )
    692     {
    693       apcPicYuvBaseVideo[uiBaseView]->destroy();
    694       delete apcPicYuvBaseVideo[uiBaseView];
    695 
    696       apcPicYuvBaseDepth[uiBaseView]->destroy();
    697       delete apcPicYuvBaseDepth[uiBaseView];
    698 }
    699     pcPicYuvSynthOut->destroy();
    700     delete pcPicYuvSynthOut;
    701 
    702     xDestroyLib();
    703 }
    704 
    705 
    706 Void TAppRendererTop::xRenderModelFromNums()
    707 {
    708   xCreateLib();
    709   xInitLib();
    710 
    711   // Create Buffers Input Views;
    712   std::vector<TComPicYuv*> apcPicYuvBaseVideo;
    713   std::vector<TComPicYuv*> apcPicYuvBaseDepth;
    714 
    715 
    716   Int aiPad[2] = { 0, 0 };
    717   TComPicYuv* pcNewOrg = new TComPicYuv;
    718   pcNewOrg->create( m_iSourceWidth, m_iSourceHeight, CHROMA_420, 1, 1, 1, true );
    719 
    720 
    721   // Init Model
    722   TRenModel cCurModel;
    723 
    724   AOT( m_iLog2SamplingFactor != 0 );
    725 
    726 #if H_3D_VSO_EARLY_SKIP
    727   cCurModel.create( m_iNumberOfInputViews, m_iNumberOfOutputViews, m_iSourceWidth, m_iSourceHeight, m_iShiftPrecision, m_iBlendHoleMargin, false );
    728 #else
    729   cCurModel.create( m_iNumberOfInputViews, m_iNumberOfOutputViews, m_iSourceWidth, m_iSourceHeight, m_iShiftPrecision, m_iBlendHoleMargin );
    730 #endif
    731   cCurModel.setupPart( 0, m_iSourceHeight  );
    732 
    733   for ( UInt uiBaseView = 0; uiBaseView < m_iNumberOfInputViews; uiBaseView++ )
    734   {
    735     TComPicYuv* pcNewVideoPic = new TComPicYuv;
    736     TComPicYuv* pcNewDepthPic = new TComPicYuv;
    737 
    738     pcNewVideoPic->create( m_iSourceWidth, m_iSourceHeight, CHROMA_420, 1, 1, 1, true );
    739     apcPicYuvBaseVideo.push_back(pcNewVideoPic);
    740 
    741     pcNewDepthPic->create( m_iSourceWidth, m_iSourceHeight, CHROMA_420, 1, 1, 1, true );
    742     apcPicYuvBaseDepth.push_back(pcNewDepthPic);
    743   }
    744 
    745   for(Int iSynthViewIdx=0; iSynthViewIdx < m_iNumberOfOutputViews; iSynthViewIdx++ )
    746   {
    747     Int  iLeftBaseViewIdx  = -1;
    748     Int  iRightBaseViewIdx = -1;
    749     Bool bIsBaseView = false;
    750 
    751     Int iRelDistToLeft;
    752     m_cCameraData.getLeftRightBaseView( iSynthViewIdx, iLeftBaseViewIdx, iRightBaseViewIdx, iRelDistToLeft,  bIsBaseView );
    753 
    754     if (m_iRenderDirection == 1 )
    755     {
    756       iRightBaseViewIdx = -1;
    757       AOT( iLeftBaseViewIdx == -1);
    758     }
    759 
    760     if (m_iRenderDirection == 2 )
    761     {
    762       iLeftBaseViewIdx = -1;
    763       AOT( iRightBaseViewIdx == -1);
    764     }
    765 
    766     Int iLeftBaseViewSIdx  = -1;
    767     Int iRightBaseViewSIdx = -1;
    768 
    769     if (iLeftBaseViewIdx != -1 )
    770     {
    771       iLeftBaseViewSIdx = m_cCameraData.getBaseId2SortedId()[iLeftBaseViewIdx];
    772     }
    773 
    774     if (iRightBaseViewIdx != -1 )
    775     {
    776       iRightBaseViewSIdx = m_cCameraData.getBaseId2SortedId()[iRightBaseViewIdx];
    777     }
    778     cCurModel.createSingleModel(-1, -1, iSynthViewIdx, iLeftBaseViewSIdx, iRightBaseViewSIdx, false, m_iBlendMode );
    779   }
    780 
    781   // Create Buffer for synthesized View
    782   TComPicYuv* pcPicYuvSynthOut = new TComPicYuv;
    783   pcPicYuvSynthOut->create( m_iSourceWidth, m_iSourceHeight, CHROMA_420, 1, 1, 1, true );
    784 
    785   Bool bAnyEOS = false;
    786 
    787   Int iNumOfRenderedFrames = 0;
    788   Int iFrame = 0;
    789 
    790   while ( ( ( iNumOfRenderedFrames < m_iFramesToBeRendered ) || ( m_iFramesToBeRendered == 0 ) ) && !bAnyEOS )
    791   {
    792 
    793     if ( iFrame >= m_iFrameSkip )
    794     {     
    795       // read in depth and video
    796       for(Int iBaseViewIdx=0; iBaseViewIdx < m_iNumberOfInputViews; iBaseViewIdx++ )
    797       {
    798         m_apcTVideoIOYuvVideoInput[iBaseViewIdx]->read( apcPicYuvBaseVideo[iBaseViewIdx], pcNewOrg, IPCOLOURSPACE_UNCHANGED, aiPad, CHROMA_420  ) ;
    799         bAnyEOS |= m_apcTVideoIOYuvVideoInput[iBaseViewIdx]->isEof();
    800 
    801         m_apcTVideoIOYuvDepthInput[iBaseViewIdx]->read( apcPicYuvBaseDepth[iBaseViewIdx], pcNewOrg, IPCOLOURSPACE_UNCHANGED, aiPad, CHROMA_420  ) ;
    802         bAnyEOS |= m_apcTVideoIOYuvDepthInput[iBaseViewIdx]->isEof();
    803 
    804         if ( iFrame >= m_iFrameSkip )
    805         {
    806           Int iBaseViewSIdx = m_cCameraData.getBaseId2SortedId()[iBaseViewIdx];
    807           cCurModel.setBaseView( iBaseViewSIdx, apcPicYuvBaseVideo[iBaseViewIdx], apcPicYuvBaseDepth[iBaseViewIdx], NULL, NULL );
    808         }
    809       }
    810     }
    811     else
    812     {
    813       iFrame++;
    814       continue;
    815     }
    816     m_cCameraData.update( (UInt) (iFrame - m_iFrameSkip ));
    817     for(Int iSynthViewIdx=0; iSynthViewIdx < m_iNumberOfOutputViews; iSynthViewIdx++ )
    818     {
    819 
    820       Int  iLeftBaseViewIdx  = -1;
    821       Int  iRightBaseViewIdx = -1;
    822 
    823       Bool bIsBaseView = false;
    824 
    825       Int iRelDistToLeft;
    826       Bool bHasLRView = m_cCameraData.getLeftRightBaseView( iSynthViewIdx, iLeftBaseViewIdx, iRightBaseViewIdx, iRelDistToLeft, bIsBaseView );
    827       Bool bHasLView = ( iLeftBaseViewIdx != -1 );
    828       Bool bHasRView = ( iRightBaseViewIdx != -1 );
    829 
    830       switch( m_iRenderDirection )
    831       {
    832         /// INTERPOLATION
    833       case 0:
    834         assert( bHasLRView || bIsBaseView );
    835 
    836         if ( !bHasLRView && bIsBaseView ) // View to render is BaseView
    837         {
    838           std::cout << "Copied    Frame " << iFrame << " of BaseView " << (Double) m_cCameraData.getSynthViewNumbers()[iSynthViewIdx] / VIEW_NUM_PREC  << std::endl;
    839           apcPicYuvBaseVideo[iLeftBaseViewIdx]->copyToPic( pcPicYuvSynthOut ); // Copy Original
    840         }
    841         else  // Render
    842         {
    843           std::cout << "Rendering Frame " << iFrame << " of View " << (Double) m_cCameraData.getSynthViewNumbers()[iSynthViewIdx] / VIEW_NUM_PREC  << std::endl;
    844           cCurModel.setSingleModel( iSynthViewIdx,
    845                                     m_cCameraData.getSynthViewShiftLUTI()[iLeftBaseViewIdx ][iSynthViewIdx]    ,
    846                                     m_cCameraData.getBaseViewShiftLUTI ()[iLeftBaseViewIdx ][iRightBaseViewIdx],
    847                                     m_cCameraData.getSynthViewShiftLUTI()[iRightBaseViewIdx][iSynthViewIdx]    ,
    848                                     m_cCameraData.getBaseViewShiftLUTI ()[iRightBaseViewIdx][iLeftBaseViewIdx] ,
    849                                     iRelDistToLeft,
    850                                     NULL );
    851           cCurModel.getSynthVideo ( iSynthViewIdx, VIEWPOS_MERGED, pcPicYuvSynthOut );
    852         }
    853         break;
    854         /// EXTRAPOLATION FROM LEFT
    855       case 1:
    856 
    857         if ( !bHasLView ) // View to render is BaseView
    858         {
    859           std::cout << "Copied    Frame " << iFrame << " of BaseView " << (Double) m_cCameraData.getSynthViewNumbers()[iSynthViewIdx] / VIEW_NUM_PREC  << std::endl;
    860           apcPicYuvBaseVideo[iLeftBaseViewIdx]->copyToPic( pcPicYuvSynthOut ); // Copy Original
    861         }
    862         else  // Render
    863         {
    864           std::cout << "Rendering Frame " << iFrame << " of View " << (Double) m_cCameraData.getSynthViewNumbers()[iSynthViewIdx] / VIEW_NUM_PREC  << std::endl;
    865           cCurModel.setSingleModel( iSynthViewIdx, m_cCameraData.getSynthViewShiftLUTI()[iLeftBaseViewIdx ][iSynthViewIdx], NULL, NULL, NULL, -1,  NULL);
    866           cCurModel.getSynthVideo ( iSynthViewIdx, VIEWPOS_LEFT, pcPicYuvSynthOut );
    867         }
    868         break;
    869         /// EXTRAPOLATION FROM RIGHT
    870       case 2:            // extrapolation from right
    871         if ( !bHasRView ) // View to render is BaseView
    872         {
    873           std::cout << "Copied    Frame " << iFrame << " of BaseView " << (Double) m_cCameraData.getSynthViewNumbers()[iSynthViewIdx] / VIEW_NUM_PREC  << std::endl;
    874           apcPicYuvBaseVideo[iRightBaseViewIdx]->copyToPic( pcPicYuvSynthOut ); // Copy Original
    875         }
    876         else  // Render
    877         {
    878           std::cout << "Rendering Frame " << iFrame << " of View " << (Double) m_cCameraData.getSynthViewNumbers()[iSynthViewIdx] / VIEW_NUM_PREC  << std::endl;
    879           cCurModel.setSingleModel( iSynthViewIdx, NULL , NULL, m_cCameraData.getSynthViewShiftLUTI()[iRightBaseViewIdx ][iSynthViewIdx], NULL, -1, NULL);
    880           cCurModel.getSynthVideo ( iSynthViewIdx, VIEWPOS_RIGHT, pcPicYuvSynthOut );
    881         }
    882         break;
    883       }
    884 
    885       // Write Output
    886       m_apcTVideoIOYuvSynthOutput[m_bSweep ? 0 : iSynthViewIdx]->write( pcPicYuvSynthOut, IPCOLOURSPACE_UNCHANGED,  0 ,0 ,0, 0, CHROMA_420 );
    887     }
    888     iFrame++;
    889     iNumOfRenderedFrames++;
    890   }
    891 
    892   // Delete Buffers
    893   for ( UInt uiBaseView = 0; uiBaseView < m_iNumberOfInputViews; uiBaseView++ )
    894   {
    895     apcPicYuvBaseVideo[uiBaseView]->destroy();
    896     delete apcPicYuvBaseVideo[uiBaseView];
    897 
    898     apcPicYuvBaseDepth[uiBaseView]->destroy();
    899     delete apcPicYuvBaseDepth[uiBaseView];
    900   }
    901   pcPicYuvSynthOut->destroy();
    902   delete pcPicYuvSynthOut;
    903 
    904   xDestroyLib();
    905 
    906 }
    907 #endif
    908 
    909 Void TAppRendererTop::renderUsedPelsMap( )
    910 {
    911   xCreateLib();
    912   xInitLib();
    913 
    914   // Create Buffers Input Views;
    915   std::vector<TComPicYuv*> apcPicYuvBaseVideo;
    916   std::vector<TComPicYuv*> apcPicYuvBaseDepth;
    917 
    918   // TemporalImprovement Filter
    919   std::vector<TComPicYuv*> apcPicYuvLastBaseVideo;
    920   std::vector<TComPicYuv*> apcPicYuvLastBaseDepth;
    921 
    922   Int aiPad[2] = { 0, 0 };
    923 
    924   TComPicYuv* pcNewOrg = new TComPicYuv;
    925   pcNewOrg->create( m_iSourceWidth, m_iSourceHeight, CHROMA_420, 1, 1, 1, true );
    926 
    927   for ( UInt uiBaseView = 0; uiBaseView < m_iNumberOfInputViews; uiBaseView++ )
    928   {
    929     TComPicYuv* pcNewVideoPic = new TComPicYuv;
    930     TComPicYuv* pcNewDepthPic = new TComPicYuv;
    931 
    932     pcNewVideoPic->create( m_iSourceWidth, m_iSourceHeight,CHROMA_420, 1, 1, 1, true );
    933     apcPicYuvBaseVideo.push_back(pcNewVideoPic);
    934 
    935     pcNewDepthPic->create( m_iSourceWidth, m_iSourceHeight, CHROMA_420, 1, 1, 1, true );
    936     apcPicYuvBaseDepth.push_back(pcNewDepthPic);
    937 
    938 
    939     //Temporal improvement Filter
    940     if ( m_bTempDepthFilter )
    941     {
    942       pcNewVideoPic = new TComPicYuv;
    943       pcNewDepthPic = new TComPicYuv;
    944 
    945       pcNewVideoPic->create( m_iSourceWidth, m_iSourceHeight, CHROMA_420, 1, 1, 1 , true);
    946       apcPicYuvLastBaseVideo.push_back(pcNewVideoPic);
    947 
    948       pcNewDepthPic->create( m_iSourceWidth, m_iSourceHeight,CHROMA_420, 1, 1, 1 , true);
    949       apcPicYuvLastBaseDepth.push_back(pcNewDepthPic);
    950     }
    951   }
    952 
    953   // Create Buffer for synthesized View
    954   TComPicYuv* pcPicYuvSynthOut = new TComPicYuv;
    955   pcPicYuvSynthOut->create( m_iSourceWidth, m_iSourceHeight, CHROMA_420, 1, 1 ,1, true);
    956 
    957   Bool bAnyEOS = false;
    958 
    959   Int iNumOfRenderedFrames = 0;
    960   Int iFrame = 0;
    961 
    962   while ( ( ( iNumOfRenderedFrames < m_iFramesToBeRendered ) || ( m_iFramesToBeRendered == 0 ) ) && !bAnyEOS )
    963   {
    964     if ( iFrame >= m_iFrameSkip )
    965     {     
    966       // read in depth and video
    967       for(Int iBaseViewIdx=0; iBaseViewIdx < m_iNumberOfInputViews; iBaseViewIdx++ )
    968       {
    969         m_apcTVideoIOYuvVideoInput[iBaseViewIdx]->read( apcPicYuvBaseVideo[iBaseViewIdx], pcNewOrg, IPCOLOURSPACE_UNCHANGED,  aiPad, CHROMA_420  ) ;
    970         apcPicYuvBaseVideo[iBaseViewIdx]->extendPicBorder();
    971         bAnyEOS |= m_apcTVideoIOYuvVideoInput[iBaseViewIdx]->isEof();
    972 
    973         m_apcTVideoIOYuvDepthInput[iBaseViewIdx]->read( apcPicYuvBaseDepth[iBaseViewIdx], pcNewOrg, IPCOLOURSPACE_UNCHANGED,  aiPad, CHROMA_420  ) ;
    974         apcPicYuvBaseDepth[iBaseViewIdx]->extendPicBorder();
    975         bAnyEOS |= m_apcTVideoIOYuvDepthInput[iBaseViewIdx]->isEof();
    976 
    977         if ( m_bTempDepthFilter && (iFrame >= m_iFrameSkip) )
    978         {
    979           m_pcRenTop->temporalFilterVSRS( apcPicYuvBaseVideo[iBaseViewIdx], apcPicYuvBaseDepth[iBaseViewIdx], apcPicYuvLastBaseVideo[iBaseViewIdx], apcPicYuvLastBaseDepth[iBaseViewIdx], ( iFrame == m_iFrameSkip) );
    980         }
    981       }
    982     }
    983     else
    984     {
    985       std::cout << "Skipping Frame " << iFrame << std::endl;
    986 
    987       iFrame++;
    988       continue;
    989     }
    990     m_cCameraData.update( (UInt) ( iFrame - m_iFrameSkip ) );
    991 
    992     for(Int iViewIdx=1; iViewIdx < m_iNumberOfInputViews; iViewIdx++ )
    993     {
    994       std::cout << "Rendering UsedPelsMap for Frame " << iFrame << " of View " << (Double) m_cCameraData.getBaseViewNumbers()[iViewIdx] << std::endl;
    995 
    996       Int iViewSIdx      = m_cCameraData.getBaseId2SortedId()[iViewIdx];
    997       Int iFirstViewSIdx = m_cCameraData.getBaseId2SortedId()[0];
    998 
    999       AOT( iViewSIdx == iFirstViewSIdx );
    1000 
    1001       Bool bFirstIsLeft = (iFirstViewSIdx < iViewSIdx);
    1002 
    1003       m_pcRenTop->setShiftLUTs(
    1004         m_cCameraData.getBaseViewShiftLUTD()[0][iViewIdx],
    1005         m_cCameraData.getBaseViewShiftLUTI()[0][iViewIdx],
    1006         m_cCameraData.getBaseViewShiftLUTI()[0][iViewIdx],
    1007         m_cCameraData.getBaseViewShiftLUTD()[0][iViewIdx],
    1008         m_cCameraData.getBaseViewShiftLUTI()[0][iViewIdx],
    1009         m_cCameraData.getBaseViewShiftLUTI()[0][iViewIdx],
    1010         -1
    1011         );
    1012 
    1013       m_pcRenTop->getUsedSamplesMap( apcPicYuvBaseDepth[0], pcPicYuvSynthOut, bFirstIsLeft );
    1014 
    1015       // Write Output
    1016       m_apcTVideoIOYuvSynthOutput[iViewIdx-1]->write( pcPicYuvSynthOut,  IPCOLOURSPACE_UNCHANGED, 0, 0, 0, 0, CHROMA_420 );
    1017 
    1018     }
    1019     iFrame++;
    1020     iNumOfRenderedFrames++;
    1021   }
    1022 
    1023   // Delete Buffers
    1024 
    1025   pcNewOrg->destroy();
    1026   delete pcNewOrg;
    1027 
    1028   for ( UInt uiBaseView = 0; uiBaseView < m_iNumberOfInputViews; uiBaseView++ )
    1029   {
    1030     apcPicYuvBaseVideo[uiBaseView]->destroy();
    1031     delete apcPicYuvBaseVideo[uiBaseView];
    1032 
    1033     apcPicYuvBaseDepth[uiBaseView]->destroy();
    1034     delete apcPicYuvBaseDepth[uiBaseView];
    1035 
    1036     // Temporal Filter
    1037     if ( m_bTempDepthFilter )
    1038     {
    1039       apcPicYuvLastBaseVideo[uiBaseView]->destroy();
    1040       delete apcPicYuvLastBaseVideo[uiBaseView];
    1041 
    1042       apcPicYuvLastBaseDepth[uiBaseView]->destroy();
    1043       delete apcPicYuvLastBaseDepth[uiBaseView];
    1044     }
    1045   }
    1046   pcPicYuvSynthOut->destroy();
    1047   delete pcPicYuvSynthOut;
    1048 
    1049   xDestroyLib();
    1050 
    1051 }
    1052 #endif
  • branches/HTM-16.0-MV-draft-5/source/App/TAppRenderer/TAppRendererTop.h

    r1386 r1390  
    4040#define __TAppRendererTOP__
    4141#include "../../Lib/TLibCommon/CommonDef.h"
    42 #if NH_3D_VSO
    43 #include "../../Lib/TLibRenderer/TRenTop.h"
    44 #include "../../Lib/TLibVideoIO/TVideoIOYuv.h"
    45 #include "TAppRendererCfg.h"
    46 #include "TAppRendererTop.h"
    47 #include "../../Lib/TLibRenderer/TRenModel.h"
    48 
    49 // ====================================================================================================================
    50 // Class definition
    51 // ====================================================================================================================
    52 
    53 /// encoder application class
    54 class TAppRendererTop : public TAppRendererCfg
    55 {
    56 private:
    57   // class interface
    58   std::vector<TVideoIOYuv*>     m_apcTVideoIOYuvVideoInput;
    59   std::vector<TVideoIOYuv*>    m_apcTVideoIOYuvDepthInput;
    60   std::vector<TVideoIOYuv*>     m_apcTVideoIOYuvSynthOutput;
    61 
    62   // RendererInterface
    63   TRenTop*                     m_pcRenTop;
    64 
    65 protected:
    66   // initialization
    67   Void  xCreateLib        ();                               ///< create renderer class and video io
    68   Void  xInitLib          ();                               ///< initialize renderer class
    69   Void  xDestroyLib       ();                               ///< destroy renderer class and video io
    70 #if NH_3D_VSO
    71   Void  xRenderModelFromString();                           ///< render using model using setup string
    72   Void  xRenderModelFromNums();                             ///< render using model using synth view numbers
    73 #endif
    74 
    75 public:
    76   TAppRendererTop();
    77   virtual ~TAppRendererTop();
    78 
    79   Void  render      ();                               ///< main encoding function
    80 #if NH_3D_VSO
    81   Void  renderModel ();
    82 #endif
    83   Void  go          ();
    84   Void  renderUsedPelsMap();
    85 
    86 };// END CLASS DEFINITION TAppRendererTop
    87 
    88 
    89 #endif // NH_3D
    9042#endif // __TAppRendererTOP__
Note: See TracChangeset for help on using the changeset viewer.