Changeset 1325 in 3DVCSoftware for branches/HTM-15.1-MV-draft-4/source/App


Ignore:
Timestamp:
7 Sep 2015, 18:40:35 (10 years ago)
Author:
tech
Message:

Removed 3D-HEVC.

Location:
branches/HTM-15.1-MV-draft-4/source/App
Files:
13 edited

Legend:

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

    r1321 r1325  
    6868  string cfg_ReconFile;
    6969  string cfg_TargetDecLayerIdSetFile;
    70 #if NH_3D
    71   string cfg_ScaleOffsetFile;
    72 #endif
    7370  string outputColourSpaceConvert;
    7471  Int warnUnknowParameter = 0;
     
    8279  ("ReconFile,o",               cfg_ReconFile,                         string(""), "reconstructed YUV output file name\n"
    8380                                                                                   "YUV writing is skipped if omitted")
    84 #if NH_3D
    85   ("ScaleOffsetFile,p",         cfg_ScaleOffsetFile,                   string(""), "file with coded scales and offsets")
    86   ("Depth420OutputFlag",        m_depth420OutputFlag,                  true      , "Output depth layers in 4:2:0 ")
    87 #endif
    8881  ("WarnUnknowParameter,w",     warnUnknowParameter,                                  0, "warn for unknown configuration parameters instead of failing")
    8982  ("SkipFrames,s",              m_iSkipFrame,                          0,          "number of frames to skip before random access")
     
    148141  m_pchReconFile = cfg_ReconFile.empty() ? NULL : strdup(cfg_ReconFile.c_str());
    149142
    150 #if NH_3D
    151   m_pchScaleOffsetFile = cfg_ScaleOffsetFile.empty() ? NULL : strdup(cfg_ScaleOffsetFile.c_str());
    152 #endif
    153143
    154144  if (!m_pchBitstreamFile)
  • branches/HTM-15.1-MV-draft-4/source/App/TAppDecoder/TAppDecCfg.h

    r1321 r1325  
    9393  Bool          m_printPicOutput;                     ///< Print information on picture output
    9494  Bool          m_printReceivedNalus;                 ///< Print information on received NAL units
    95 #if NH_3D
    96   Char*         m_pchScaleOffsetFile;                   ///< output coded scale and offset parameters
    97   Bool          m_depth420OutputFlag;                   ///< output depth layers in 4:2:0
    98 #endif
    9995
    10096  Void xAppendToFileNameEnd( Char* pchInputFileName, const Char* pchStringToAppend, Char*& rpchOutputFileName); ///< create filenames
  • branches/HTM-15.1-MV-draft-4/source/App/TAppDecoder/TAppDecTop.cpp

    r1321 r1325  
    9393  m_cvsStartFound                   = false;
    9494#endif
    95 #if NH_3D
    96     m_pScaleOffsetFile              = 0;
    97 #endif
    9895}
    9996
     
    139136    m_pchReconFile = NULL;
    140137  }
    141 #if NH_3D
    142   if (m_pchScaleOffsetFile)
    143   {
    144     free (m_pchScaleOffsetFile);
    145     m_pchScaleOffsetFile = NULL;
    146   }
    147 #endif
    148138}
    149139
     
    401391  // initialize global variables
    402392  initROM();
    403 #if NH_3D_DMM
    404   initWedgeLists();
    405 #endif
    406393#else
    407394  // create decoder class
     
    444431  m_cTDecTop.destroy();
    445432#endif
    446 #if NH_3D
    447   m_cCamParsCollector.uninit();
    448   if( m_pScaleOffsetFile )
    449   {
    450     ::fclose( m_pScaleOffsetFile );
    451   }
    452 #endif
    453433}
    454434
     
    456436{
    457437
    458 #if NH_3D
    459   m_cCamParsCollector.setCodeScaleOffsetFile( m_pScaleOffsetFile );
    460 #endif
    461438#if NH_MV
    462439  m_dpb.setPrintPicOutput(m_printPicOutput);
     
    10351012    xFinalizeAU ( );
    10361013
    1037 #if NH_3D
    1038   if( m_cCamParsCollector.isInitialized() )
    1039   {
    1040     m_cCamParsCollector.setSlice( 0 );
    1041   }
    1042 #endif
    10431014   xFlushOutput();
    10441015   m_dpb.emptyAllSubDpbs();
     
    10681039    m_newVpsActivatedbyCurAu  = true; //TBD
    10691040    m_newVpsActivatedbyCurPic = true;
    1070 #if NH_3D
    1071     m_dpb.setVPS( m_vps );
    1072 #endif
    10731041  }
    10741042
     
    11921160Void TAppDecTop::xFinalizeAU()
    11931161{
    1194 #if NH_3D
    1195   if ( !m_curAu.empty())
    1196   {
    1197     for (TComList<TComPic*>::iterator it = m_curAu.begin(); it != m_curAu.end(); it++)
    1198     {
    1199       TComPic* pic = (*it);
    1200       if ( !pic->getHasGeneratedRefPics() )
    1201       {
    1202         pic->compressMotion(1);
    1203       }
    1204     }
    1205   }
    1206 #endif
    12071162}
    12081163
     
    26642619      m_tDecTop[ decIdx ]->setDecodedSEIMessageOutputStream(&os);
    26652620    }
    2666 #if NH_3D
    2667    m_tDecTop[ decIdx ]->setCamParsCollector( &m_cCamParsCollector );
    2668 #endif
    26692621
    26702622    // append pic list of new decoder to PicLists
     
    28882840  }
    28892841
    2890 #if NH_3D
    2891   if( m_pchScaleOffsetFile )
    2892   {
    2893     m_pScaleOffsetFile = ::fopen( m_pchScaleOffsetFile, "wt" );
    2894     if (!m_pScaleOffsetFile)
    2895     {
    2896       fprintf(stderr, "\nUnable to open file `%s' for writing decoded Camera Parameters messages\n", m_pchScaleOffsetFile);
    2897       exit(EXIT_FAILURE);
    2898     }
    2899   }
    2900 #endif
    29012842}
    29022843
     
    29872928      conf.getWindowTopOffset()    + defDisp.getWindowTopOffset(),
    29882929      conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset(),
    2989 #if NH_3D
    2990       m_depth420OutputFlag && curPic->getIsDepth() ? CHROMA_420 : NUM_CHROMA_FORMAT
    2991 #else
    29922930      NUM_CHROMA_FORMAT
    2993 #endif
    29942931      , m_bClipOutputVideoToRec709Range);
    29952932  }
  • branches/HTM-15.1-MV-draft-4/source/App/TAppDecoder/TAppDecTop.h

    r1321 r1325  
    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-15.1-MV-draft-4/source/App/TAppEncoder/TAppEncCfg.cpp

    r1313 r1325  
    7373#if NH_MV
    7474  MULTIVIEWMAIN = 6,
    75 #if NH_3D
    76   MAIN3D = 8,
    77 #endif
    7875#endif
    7976  MONOCHROME_8      = 1008,
     
    129126  m_targetPivotValue = NULL;
    130127
    131 #if KWU_RC_MADPRED_E0227
    132   m_depthMADPred = 0;
    133 #endif
    134128}
    135129
     
    194188      m_GOPListMvc[i] = NULL;
    195189    }
    196   }
    197 #endif
    198 #if NH_3D
    199 #if NH_3D_VSO
    200   if (  m_pchVSOConfig != NULL)
    201   {
    202     free (  m_pchVSOConfig );
    203   }
    204 #endif
    205   if ( m_pchCameraParameterFile != NULL )
    206   {
    207     free ( m_pchCameraParameterFile );
    208   }
    209 
    210   if ( m_pchBaseViewCameraNumbers != NULL )
    211   {
    212     free ( m_pchBaseViewCameraNumbers );
    213190  }
    214191#endif
     
    267244  }
    268245#endif
    269 #if NH_3D
    270   in>>entry.m_interCompPredFlag;
    271 #endif
    272246
    273247  return in;
     
    303277#if NH_MV
    304278  ,{"multiview-main"     , Profile::MULTIVIEWMAIN      },
    305 #if NH_3D
    306    {"3d-main"            , Profile::MAIN3D             }
    307 #endif
    308279#endif
    309280
     
    332303#if NH_MV
    333304    {"multiview-main"     , MULTIVIEWMAIN   },
    334 #if NH_3D
    335     {"3d-main"            , MAIN3D          },
    336 #endif
    337305#endif
    338306    {"monochrome",         MONOCHROME_8     },
     
    774742  string        cfg_levels;
    775743  string        cfg_tiers;
    776 #if NH_3D
    777   cfg_dimensionLength.push_back( 2  );  // depth
    778   cfg_dimensionLength.push_back( 32 );  // texture
    779 #else
    780744  cfg_dimensionLength.push_back( 64 );
    781 #endif
    782745#endif
    783746  string cfg_dQPFile;
     
    848811#if NH_MV
    849812  ("NumberOfLayers",        m_numberOfLayers     , 1,                     "Number of layers")
    850 #if !NH_3D
    851813  ("ScalabilityMask",       m_scalabilityMask    , 2                    , "Scalability Mask: 2: Multiview, 8: Auxiliary, 10: Multiview + Auxiliary")   
    852 #else
    853   ("ScalabilityMask",       m_scalabilityMask    , 3                    , "Scalability Mask, 1: Texture 3: Texture + Depth ")   
    854 #endif 
    855814  ("DimensionIdLen",        m_dimensionIdLen     , cfg_dimensionLength  , "Number of bits used to store dimensions Id")
    856815  ("ViewOrderIndex",        m_viewOrderIndex     , std::vector<Int>(1,0), "View Order Index per layer")
    857816  ("ViewId",                m_viewId             , std::vector<Int>(1,0), "View Id per View Order Index")
    858817  ("AuxId",                 m_auxId              , std::vector<Int>(1,0), "AuxId per layer")
    859 #if NH_3D
    860   ("DepthFlag",             m_depthFlag          , std::vector<Int>(1,0), "Depth Flag")
    861 #endif
    862818  ("TargetEncLayerIdList",  m_targetEncLayerIdList, std::vector<Int>(0,0), "LayerIds in Nuh to be encoded") 
    863819  ("LayerIdInNuh",          m_layerIdInNuh        , std::vector<Int>(1,0), "LayerId in Nuh") 
     
    11251081  ( "RCForceIntraQP",                                 m_RCForceIntraQP,                                 false, "Rate control: force intra QP to be equal to initial QP" )
    11261082
    1127 #if KWU_RC_VIEWRC_E0227
    1128   ("ViewWiseTargetBits, -vtbr" ,  m_viewTargetBits,  std::vector<Int>(1, 32), "View-wise target bit-rate setting")
    1129   ("TargetBitAssign, -ta", m_viewWiseRateCtrl, false, "View-wise rate control on/off")
    1130 #endif
    1131 #if KWU_RC_MADPRED_E0227
    1132   ("DepthMADPred, -dm", m_depthMADPred, (UInt)0, "Depth based MAD prediction on/off")
    1133 #endif
    11341083#if NH_MV
    11351084// A lot of this stuff could should actually be derived by the encoder.
     
    13151264  ("OutputVpsInfo",                                   m_outputVpsInfo,                false                     ,"Output information about the layer dependencies and layer sets")
    13161265#endif
    1317 #if NH_3D
    1318 /* Camera parameters */ 
    1319   ("Depth420OutputFlag",                              m_depth420OutputFlag,           true                     , "Output depth layers in 4:2:0 ")
    1320   ("CameraParameterFile,cpf",                         m_pchCameraParameterFile,    (Char *) 0,                    "Camera Parameter File Name")
    1321   ("BaseViewCameraNumbers",                           m_pchBaseViewCameraNumbers,  (Char *) 0,                    "Numbers of base views")
    1322   ("CodedCamParsPrecision",                           m_iCodedCamParPrecision,      STD_CAM_PARAMETERS_PRECISION, "precision for coding of camera parameters (in units of 2^(-x) luma samples)" )
    1323 
    1324 #if NH_3D_VSO
    1325   /* View Synthesis Optimization */
    1326   ("VSOConfig",                                       m_pchVSOConfig            , (Char *) 0                    ,"VSO configuration")
    1327   ("VSO",                                             m_bUseVSO                 , false                         ,"Use VSO" )   
    1328   ("VSOMode",                                         m_uiVSOMode               , (UInt)   4                    ,"VSO Mode")
    1329   ("LambdaScaleVSO",                                  m_dLambdaScaleVSO         , (Double) 1                    ,"Lambda Scaling for VSO")
    1330   ("VSOLSTable",                                      m_bVSOLSTable             , true                          ,"Depth QP dependent video/depth rate allocation by Lagrange multiplier" )     
    1331   ("ForceLambdaScaleVSO",                             m_bForceLambdaScaleVSO    , false                         ,"Force using Lambda Scale VSO also in non-VSO-Mode")
    1332   ("AllowNegDist",                                    m_bAllowNegDist           , true                          ,"Allow negative Distortion in VSO")
    1333                                                                                                              
    1334   ("UseEstimatedVSD",                                 m_bUseEstimatedVSD        , true                          ,"Model based VSD estimation instead of rendering based for some encoder decisions" )     
    1335   ("VSOEarlySkip",                                    m_bVSOEarlySkip           , true                          ,"Early skip of VSO computation if synthesis error assumed to be zero" )     
    1336                                                                                                                
    1337   ("WVSO",                                            m_bUseWVSO                , true                          ,"Use depth fidelity term for VSO" )
    1338   ("VSOWeight",                                       m_iVSOWeight              , 10                            ,"Synthesized View Distortion Change weight" )
    1339   ("VSDWeight",                                       m_iVSDWeight              , 1                             ,"View Synthesis Distortion estimate weight" )
    1340   ("DWeight",                                         m_iDWeight                , 1                             ,"Depth Distortion weight" )
    1341 #endif //HHI_VSO
    1342 /* 3D- HEVC Tools */                                                           
    1343   ("QTL"                   ,                          m_bUseQTL                 , true                          , "Use depth quad tree limitation (encoder only)" )
    1344   ("IvMvPredFlag"          ,                          m_ivMvPredFlag            , BoolAry1d(2,true)             , "Inter-view motion prediction"              )
    1345   ("IvMvScalingFlag"       ,                          m_ivMvScalingFlag         , BoolAry1d(2,true)             , "Inter-view motion vector scaling"          )
    1346   ("Log2SubPbSizeMinus3"   ,                          m_log2SubPbSizeMinus3     , 0                             , "Log2 minus 3 of sub Pb size"               )
    1347   ("IvResPredFlag"         ,                          m_ivResPredFlag           , true                          , "Inter-view residual prediction"            )
    1348   ("DepthRefinementFlag"   ,                          m_depthRefinementFlag     , true                          , "Depth to refine disparity"                 )
    1349   ("ViewSynthesisPredFlag" ,                          m_viewSynthesisPredFlag   , true                          , "View synthesis prediction"                 )
    1350   ("DepthBasedBlkPartFlag" ,                          m_depthBasedBlkPartFlag   , true                          , "Depth base block partitioning"             )
    1351   ("MpiFlag"               ,                          m_mpiFlag                 , true                          , "Motion inheritance from texture to depth"  )
    1352   ("Log2MpiSubPbSizeMinus3",                          m_log2MpiSubPbSizeMinus3  , 0                             , "Log2 minus 3 of sub Pb size for MPI"       )
    1353   ("IntraContourFlag"      ,                          m_intraContourFlag        , true                          , "Intra contour mode"                        )
    1354   ("IntraWedgeFlag"        ,                          m_intraWedgeFlag          , true                          , "Intra wedge mode and segmental depth DCs"  )
    1355   ("IntraSdcFlag"          ,                          m_intraSdcFlag            , true                          , "Intra depth DCs"                           )
    1356   ("QtPredFlag"            ,                          m_qtPredFlag              , true                          , "Quad tree prediction from texture to depth")
    1357   ("InterSdcFlag"          ,                          m_interSdcFlag            , true                          , "Inter depth DCs"                           )
    1358   ("DepthIntraSkip"        ,                          m_depthIntraSkipFlag      , true                          , "Depth intra skip mode"                     )
    1359   ("DLT"                   ,                          m_useDLT                  , true                          , "Depth lookup table"                        )
    1360   ("IlluCompEnable"        ,                          m_abUseIC                 , true                          , "Enable illumination compensation"          )
    1361   ("IlluCompLowLatencyEnc" ,                          m_bUseLowLatencyICEnc     , false                         , "Enable low-latency illumination compensation encoding")
    1362 #endif //NH_3D
    13631266   
    13641267  ;
     
    15551458  if( cfg_profiles.empty() )
    15561459  {
    1557 #if NH_3D
    1558     cfg_profiles = string("main main 3d-main");
    1559 #else
    15601460    cfg_profiles = string("main main multiview-main");   
    1561 #endif
    15621461    fprintf(stderr, "\nWarning: No profiles given, using defaults: %s", cfg_profiles.c_str() );
    15631462    anyEmpty = true;
     
    17981697  xResizeVector( m_auxId );
    17991698
    1800 #if NH_3D
    1801   xResizeVector( m_depthFlag );
    1802 #endif
    18031699  xResizeVector( m_fQP );
    18041700
     
    20041900  }
    20051901
    2006 #if NH_3D
    2007 #if NH_3D_VSO
    2008   // Table base optimization
    2009   // Q&D
    2010   Double adLambdaScaleTable[] =
    2011   {  0.031250, 0.031639, 0.032029, 0.032418, 0.032808, 0.033197, 0.033586, 0.033976, 0.034365, 0.034755,
    2012   0.035144, 0.035533, 0.035923, 0.036312, 0.036702, 0.037091, 0.037480, 0.037870, 0.038259, 0.038648,
    2013   0.039038, 0.039427, 0.039817, 0.040206, 0.040595, 0.040985, 0.041374, 0.041764, 0.042153, 0.042542,
    2014   0.042932, 0.043321, 0.043711, 0.044100, 0.044194, 0.053033, 0.061872, 0.070711, 0.079550, 0.088388,
    2015   0.117851, 0.147314, 0.176777, 0.235702, 0.294628, 0.353553, 0.471405, 0.589256, 0.707107, 0.707100,
    2016   0.753550, 0.800000 
    2017   };
    2018   if ( m_bUseVSO && m_bVSOLSTable )
    2019   {
    2020     Int firstDepthLayer = -1;
    2021     for (Int layer = 0; layer < m_numberOfLayers; layer++ )
    2022     {
    2023       if ( m_depthFlag[ layer ])
    2024       {
    2025         firstDepthLayer = layer;
    2026         break;
    2027       }
    2028     }
    2029     AOT( firstDepthLayer == -1 );
    2030     AOT( (m_iQP[firstDepthLayer] < 0) || (m_iQP[firstDepthLayer] > 51));
    2031     m_dLambdaScaleVSO *= adLambdaScaleTable[m_iQP[firstDepthLayer]];
    2032   }
    2033   if ( m_bUseVSO && m_uiVSOMode == 4)
    2034   {
    2035     m_cRenModStrParser.setString( m_iNumberOfViews, m_pchVSOConfig );
    2036     m_cCameraData     .init     ( ((UInt) m_iNumberOfViews ),
    2037       m_internalBitDepth[ CHANNEL_TYPE_LUMA],
    2038       (UInt)m_iCodedCamParPrecision,
    2039       m_FrameSkip,
    2040       (UInt)m_framesToBeEncoded,
    2041       m_pchCameraParameterFile,
    2042       m_pchBaseViewCameraNumbers,
    2043       NULL,
    2044       m_cRenModStrParser.getSynthViews(),
    2045       LOG2_DISP_PREC_LUT );
    2046   }
    2047   else if ( m_bUseVSO && m_uiVSOMode != 4 )
    2048   {
    2049     m_cCameraData     .init     ( ((UInt) m_iNumberOfViews ),
    2050       m_internalBitDepth[ CHANNEL_TYPE_LUMA],
    2051       (UInt)m_iCodedCamParPrecision,
    2052       m_FrameSkip,
    2053       (UInt)m_framesToBeEncoded,
    2054       m_pchCameraParameterFile,
    2055       m_pchBaseViewCameraNumbers,
    2056       m_pchVSOConfig,
    2057       NULL,
    2058       LOG2_DISP_PREC_LUT );
    2059   }
    2060   else
    2061   {
    2062     m_cCameraData     .init     ( ((UInt) m_iNumberOfViews ),
    2063       m_internalBitDepth[ CHANNEL_TYPE_LUMA],
    2064       (UInt) m_iCodedCamParPrecision,
    2065       m_FrameSkip,
    2066       (UInt) m_framesToBeEncoded,
    2067       m_pchCameraParameterFile,
    2068       m_pchBaseViewCameraNumbers,
    2069       NULL,
    2070       NULL,
    2071       LOG2_DISP_PREC_LUT );
    2072   }
    2073 #else
    2074   m_cCameraData     .init     ( ((UInt) m_iNumberOfViews ),
    2075     m_internalBitDepth[ CHANNEL_TYPE_LUMA],
    2076     (UInt) m_iCodedCamParPrecision,
    2077     m_FrameSkip,
    2078     (UInt) m_framesToBeEncoded,
    2079     m_pchCameraParameterFile,
    2080     m_pchBaseViewCameraNumbers,
    2081     NULL,
    2082     NULL,
    2083     LOG2_DISP_PREC_LUT );
    2084 #endif
    2085   m_cCameraData.check( false, true );
    2086 #endif
    20871902
    20881903  // check validity of input parameters
     
    22622077  xConfirmPara( (m_layerIdInNuh.size()!=1) && (m_layerIdInNuh.size() < m_numberOfLayers) , "LayerIdInNuh must be given for all layers. ");
    22632078
    2264 #if NH_3D
    2265   xConfirmPara( m_scalabilityMask != 2 && m_scalabilityMask != 3, "Scalability Mask must be equal to 2 or 3. ");
    2266 #else
    22672079  xConfirmPara( m_scalabilityMask != 2 && m_scalabilityMask != 8 && m_scalabilityMask != 10, "Scalability Mask must be equal to 2, 8 or 10");
    2268 #endif
    2269 
    2270 #if NH_3D
    2271   if ( m_scalabilityMask & ( 1 << DEPTH_ID ) )
    2272   {
    2273     m_dimIds.push_back( m_depthFlag );
    2274   }
    2275 #endif
     2080
    22762081
    22772082  m_dimIds.push_back( m_viewOrderIndex );   
     
    23402145      xConfirmPara( allEqual , "Each layer shall have a different position in scalability space." );
    23412146
    2342 #if !H_3D_FCO
    23432147      if ( numDiff  == 1 )
    23442148      {
     
    23512155        xConfirmPara( shallBeButIsNotIncreasing,  "DimensionIds shall be increasing within one dimension. " );
    23522156      }
    2353 #endif
    23542157    }
    23552158  }
     
    25582361  xConfirmPara(  m_maxNumMergeCand < 1,  "MaxNumMergeCand must be 1 or greater.");
    25592362  xConfirmPara(  m_maxNumMergeCand > 5,  "MaxNumMergeCand must be 5 or smaller.");
    2560 #if NH_3D
    2561   xConfirmPara( m_log2SubPbSizeMinus3 < 0,                                        "Log2SubPbSizeMinus3 must be equal to 0 or greater.");
    2562   xConfirmPara( m_log2SubPbSizeMinus3 > 3,                                        "Log2SubPbSizeMinus3 must be equal to 3 or smaller.");
    2563   xConfirmPara( (1<< ( m_log2SubPbSizeMinus3 + 3) ) > m_uiMaxCUWidth,              "Log2SubPbSizeMinus3 must be  equal to log2(maxCUSize)-3 or smaller.");
    2564  
    2565   xConfirmPara( m_log2MpiSubPbSizeMinus3 < 0,                                        "Log2MpiSubPbSizeMinus3 must be equal to 0 or greater.");
    2566   xConfirmPara( m_log2MpiSubPbSizeMinus3 > 3,                                        "Log2MpiSubPbSizeMinus3 must be equal to 3 or smaller.");
    2567   xConfirmPara( (1<< (m_log2MpiSubPbSizeMinus3 + 3)) > m_uiMaxCUWidth,               "Log2MpiSubPbSizeMinus3 must be equal to log2(maxCUSize)-3 or smaller.");
    2568 #endif
    25692363#if ADAPTIVE_QP_SELECTION
    25702364#if NH_MV
     
    26292423  }
    26302424
    2631 #if NH_3D
    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 NH_3D_VSO
    2637     if( m_bUseVSO )
    2638     {
    2639       xConfirmPara(   m_pchVSOConfig            == 0                             ,   "VSO Setup string must be given");
    2640       xConfirmPara( m_uiVSOMode > 4 ,                                                "VSO Mode must be less than 5");
    2641     }
    2642 #endif
    2643 #endif
    26442425  // max CU width and height should be power of 2
    26452426  UInt ui = m_uiMaxCUWidth;
     
    33863167  xPrintParaVector( "AuxId", m_auxId );
    33873168#endif
    3388 #if NH_3D
    3389   xPrintParaVector( "DepthLayerFlag", m_depthFlag );
    3390   printf("Coded Camera Param. Precision     : %d\n", m_iCodedCamParPrecision); 
    3391 #endif
    33923169#if NH_MV 
    33933170  xPrintParaVector( "QP"               , m_fQP                );
     
    35563333    printf("ForceIntraQP                      : %d\n", m_RCForceIntraQP );
    35573334
    3558 #if KWU_RC_MADPRED_E0227
    3559     printf("Depth based MAD prediction   : %d\n", m_depthMADPred);
    3560 #endif
    3561 #if KWU_RC_VIEWRC_E0227
    3562     printf("View-wise Rate control       : %d\n", m_viewWiseRateCtrl);
    3563     if(m_viewWiseRateCtrl)
    3564     {
    3565 
    3566       printf("ViewWiseTargetBits           : ");
    3567       for (Int i = 0 ; i < m_iNumberOfViews ; i++)
    3568         printf("%d ", m_viewTargetBits[i]);
    3569       printf("\n");
    3570     }
    3571     else
    3572     {
    3573       printf("TargetBitrate                : %d\n", m_RCTargetBitrate );
    3574     }
    3575 #endif
    35763335
    35773336  }
    35783337
    35793338  printf("Max Num Merge Candidates          : %d\n", m_maxNumMergeCand);
    3580 #if NH_3D
    3581   printf("BaseViewCameraNumbers             : %s\n", m_pchBaseViewCameraNumbers );
    3582   printf("Coded Camera Param. Precision     : %d\n", m_iCodedCamParPrecision);
    3583 #if NH_3D_VSO
    3584   printf("Force use of Lambda Scale         : %d\n", m_bForceLambdaScaleVSO );
    3585 
    3586   if ( m_bUseVSO )
    3587   {   
    3588     printf("VSO Lambda Scale                  : %5.2f\n", m_dLambdaScaleVSO );
    3589     printf("VSO Mode                          : %d\n",    m_uiVSOMode       );
    3590     printf("VSO Config                        : %s\n",    m_pchVSOConfig    );
    3591     printf("VSO Negative Distortion           : %d\n",    m_bAllowNegDist ? 1 : 0);
    3592     printf("VSO LS Table                      : %d\n",    m_bVSOLSTable ? 1 : 0);
    3593     printf("VSO Estimated VSD                 : %d\n",    m_bUseEstimatedVSD ? 1 : 0);
    3594     printf("VSO Early Skip                    : %d\n",    m_bVSOEarlySkip ? 1 : 0);   
    3595     if ( m_bUseWVSO )
    3596     {
    3597       printf("Dist. Weights (VSO/VSD/SAD)       : %d/%d/%d\n ", m_iVSOWeight, m_iVSDWeight, m_iDWeight );   
    3598     }   
    3599   }
    3600 #endif //HHI_VSO
    3601 #endif //NH_3D
    36023339  printf("\n");
    36033340#if NH_MV
     
    36613398  printf(" SignBitHidingFlag:%d ", m_signHideFlag);
    36623399  printf("RecalQP:%d", m_recalculateQPAccordingToLambda ? 1 : 0 );
    3663 #if NH_3D_VSO
    3664   printf(" VSO:%d ", m_bUseVSO   );
    3665   printf("WVSO:%d ", m_bUseWVSO ); 
    3666 #endif
    3667 #if NH_3D
    3668   printf( "QTL:%d "                  , m_bUseQTL);
    3669   printf( "IlluCompEnable:%d "       , m_abUseIC);
    3670   printf( "IlluCompLowLatencyEnc:%d ",  m_bUseLowLatencyICEnc);
    3671   printf( "DLT:%d ", m_useDLT );
    3672 
    3673 
    3674   printf( "IvMvPred:%d %d "            , m_ivMvPredFlag[0] ? 1 : 0, m_ivMvPredFlag[1]  ? 1 : 0);
    3675   printf( "IvMvScaling:%d %d "         , m_ivMvScalingFlag[0] ? 1 : 0 , m_ivMvScalingFlag[1]  ? 1 : 0);
    3676 
    3677   printf( "Log2SubPbSizeMinus3:%d "    , m_log2SubPbSizeMinus3            );
    3678   printf( "IvResPred:%d "              , m_ivResPredFlag          ? 1 : 0 );
    3679   printf( "DepthRefinement:%d "        , m_depthRefinementFlag    ? 1 : 0 );
    3680   printf( "ViewSynthesisPred:%d "      , m_viewSynthesisPredFlag  ? 1 : 0 );
    3681   printf( "DepthBasedBlkPart:%d "      , m_depthBasedBlkPartFlag  ? 1 : 0 );
    3682   printf( "Mpi:%d "                    , m_mpiFlag                ? 1 : 0 );
    3683   printf( "Log2MpiSubPbSizeMinus3:%d " , m_log2MpiSubPbSizeMinus3         );
    3684   printf( "IntraContour:%d "           , m_intraContourFlag       ? 1 : 0 );
    3685   printf( "IntraWedge:%d "             , m_intraWedgeFlag         ? 1 : 0 );
    3686   printf( "IntraSdc:%d "               , m_intraSdcFlag           ? 1 : 0 );
    3687   printf( "QtPred:%d "                 , m_qtPredFlag             ? 1 : 0 );
    3688   printf( "InterSdc:%d "               , m_interSdcFlag           ? 1 : 0 );
    3689   printf( "DepthIntraSkip:%d "         , m_depthIntraSkipFlag     ? 1 : 0 );
    3690 #endif
    36913400
    36923401  printf("\n\n");
  • branches/HTM-15.1-MV-draft-4/source/App/TAppEncoder/TAppEncCfg.h

    r1313 r1325  
    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  std::vector<Int>       m_viewOrderIndex;                    ///< view order index 
    8176  std::vector<Int>       m_auxId;                             ///< auxiliary id
    82 #if NH_3D
    83   std::vector<Int>       m_depthFlag;                         ///< depth flag
    84 #endif
    8577  std::vector<Int>       m_targetEncLayerIdList;              ///< layer Ids in Nuh to be encoded
    8678  std::vector<Int>       m_layerIdInNuh;                      ///< layer Id in Nuh for each layer
     
    133125
    134126
    135 #if NH_3D
    136   Bool      m_abUseIC;
    137   Bool      m_bUseLowLatencyICEnc;
    138 #endif
    139127
    140128#endif
     
    452440  Bool      m_RCForceIntraQP;                     ///< force all intra picture to use initial QP or not
    453441 
    454 #if KWU_RC_VIEWRC_E0227
    455   vector<Int>     m_viewTargetBits;
    456   Bool      m_viewWiseRateCtrl;                              ///< Flag for using view-wise rate control
    457 #endif
    458 #if KWU_RC_MADPRED_E0227
    459   UInt       m_depthMADPred;
    460 #endif
    461442
    462443ScalingListMode m_useScalingListId;                         ///< using quantization matrix
     
    518499  Bool              m_outputVpsInfo;
    519500#endif
    520 #if NH_3D
    521   // Output Format
    522   Bool      m_depth420OutputFlag;                             ///< Output depth layers in 4:2:0 format
    523   // Camera parameters
    524   Char*     m_pchCameraParameterFile;                         ///< camera parameter file
    525   Char*     m_pchBaseViewCameraNumbers;
    526   TAppComCamPara m_cCameraData;
    527   Int       m_iCodedCamParPrecision;                          ///< precision for coding of camera parameters
    528 #if NH_3D_VSO
    529   Char*     m_pchVSOConfig;
    530   Bool      m_bUseVSO;                                        ///< flag for using View Synthesis Optimization
    531   Bool      m_bVSOLSTable;                                    ///< Depth QP dependent Lagrange parameter optimization (m23714)
    532   Bool      m_bVSOEarlySkip;                                  ///< Early skip of VSO computation (JCT3V-A0093 modification 4)
    533                                                              
    534   //// Used for development by GT, might be removed later     
    535   Double    m_dLambdaScaleVSO;                                ///< Scaling factor for Lambda in VSO mode
    536   Bool      m_bForceLambdaScaleVSO;                           ///< Use Lambda Scale for depth even if VSO is turned off
    537   Bool      m_bAllowNegDist;                                  ///< Allow negative distortion in VSO
    538   UInt      m_uiVSOMode;                                      ///< Number of VSO Mode, 1 = , 2 = simple, org vs. ren, 3 = simple, ren vs. ren, 4 = full 
    539                                                              
    540   // SAIT_VSO_EST_A0033                                       
    541   Bool      m_bUseEstimatedVSD;                               ///< Flag for using model based VSD estimation instead of VSO for some encoder decisions (JCT3V-A0033 modification 3) 
    542                                                              
    543   // LGE_WVSO_A0119                                           
    544   Bool      m_bUseWVSO;                                       ///< flag for using View Synthesis Optimization 
    545   Int       m_iVSOWeight;
    546   Int       m_iVSDWeight;
    547   Int       m_iDWeight;
    548 
    549   // Ren Model String
    550   TRenModSetupStrParser       m_cRenModStrParser;
    551 #endif
    552 
    553   Bool       m_useDLT;                                        ///< flag for using DLT
    554   Bool       m_bUseQTL;                                        ///< flag for using depth QuadTree Limitation
    555   BoolAry1d  m_ivMvPredFlag;
    556   BoolAry1d  m_ivMvScalingFlag;
    557   Int        m_log2SubPbSizeMinus3;
    558   Bool       m_ivResPredFlag;
    559   Bool       m_depthRefinementFlag;
    560   Bool       m_viewSynthesisPredFlag;
    561   Bool       m_depthBasedBlkPartFlag;
    562   Bool       m_mpiFlag;
    563   Int        m_log2MpiSubPbSizeMinus3;
    564   Bool       m_intraContourFlag;
    565   Bool       m_intraWedgeFlag;
    566   Bool       m_intraSdcFlag;
    567   Bool       m_qtPredFlag;
    568   Bool       m_interSdcFlag;
    569   Bool       m_depthIntraSkipFlag;
    570 #endif
    571501  // internal member functions
    572502  Void  xCheckParameter ();                                   ///< check validity of configuration values
  • branches/HTM-15.1-MV-draft-4/source/App/TAppEncoder/TAppEncTop.cpp

    r1321 r1325  
    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   m_ivPicLists.setVPS      ( &vps );
    150 #endif
    151 #if NH_3D_DLT
    152   xDeriveDltArray          ( vps, &dlt );
    153 #endif
    154141  if ( m_targetEncLayerIdList.size() == 0 )
    155142  {
     
    182169  }
    183170
    184 #if NH_3D
    185   // Set 3d tool parameters
    186   for (Int d = 0; d < 2; d++)
    187   { 
    188     m_sps3dExtension.setIvMvPredFlag          ( d, m_ivMvPredFlag[d]       );
    189     m_sps3dExtension.setIvMvScalingFlag       ( d, m_ivMvScalingFlag[d]    );
    190     if (d == 0 )
    191     {   
    192       m_sps3dExtension.setLog2SubPbSizeMinus3   ( d, m_log2SubPbSizeMinus3   );
    193       m_sps3dExtension.setIvResPredFlag         ( d, m_ivResPredFlag         );
    194       m_sps3dExtension.setDepthRefinementFlag   ( d, m_depthRefinementFlag   );
    195       m_sps3dExtension.setViewSynthesisPredFlag ( d, m_viewSynthesisPredFlag );
    196       m_sps3dExtension.setDepthBasedBlkPartFlag ( d, m_depthBasedBlkPartFlag );
    197     }
    198     else
    199     {   
    200       m_sps3dExtension.setMpiFlag               ( d, m_mpiFlag               );
    201       m_sps3dExtension.setLog2MpiSubPbSizeMinus3( d, m_log2MpiSubPbSizeMinus3);
    202       m_sps3dExtension.setIntraContourFlag      ( d, m_intraContourFlag      );
    203       m_sps3dExtension.setIntraSdcWedgeFlag     ( d, m_intraSdcFlag || m_intraWedgeFlag     );
    204       m_sps3dExtension.setQtPredFlag            ( d, m_qtPredFlag            );
    205       m_sps3dExtension.setInterSdcFlag          ( d, m_interSdcFlag          );
    206       m_sps3dExtension.setDepthIntraSkipFlag    ( d, m_depthIntraSkipFlag    ); 
    207     }
    208   }
    209 #endif
    210171
    211172
     
    217178    m_acTVideoIOYuvInputFileList.push_back(new TVideoIOYuv);
    218179    m_acTVideoIOYuvReconFileList.push_back(new TVideoIOYuv);
    219 #if NH_3D   
    220     Int profileIdc = -1;
    221     for (Int olsIdx = 0; olsIdx < vps.getNumOutputLayerSets(); olsIdx++ )
    222     {   
    223       Int lsIdx = vps.olsIdxToLsIdx( olsIdx );
    224       for(Int i = 0; i < vps.getNumLayersInIdList( lsIdx ); i++ )
    225       {
    226         if( vps.getLayerIdInNuh( layerIdInVps) == vps.getLayerSetLayerIdList(lsIdx, i) )
    227         {
    228           Int ptlIdx = vps.getProfileTierLevelIdx( olsIdx, i );
    229           if ( ptlIdx != -1 )
    230           {
    231             Int curProfileIdc = vps.getPTL(ptlIdx)->getGeneralPTL()->getProfileIdc();
    232             if (profileIdc == -1)   
    233             {
    234               profileIdc = curProfileIdc;
    235             }
    236             else
    237             {   
    238               if ( profileIdc != curProfileIdc )
    239               {             
    240                 fprintf(stderr, "Error: ProfileIdc for layer with index %d in VPS not equal in all OLSs. \n", layerIdInVps );
    241                 exit(EXIT_FAILURE);
    242               }
    243             }
    244           }
    245         }
    246       }
    247     }
    248 
    249     if (profileIdc == -1 )
    250     {
    251       fprintf(stderr, "Error: No profile given for layer with index %d in VPS not equal in all OLS. \n", layerIdInVps );
    252       exit(EXIT_FAILURE);
    253     }
    254     m_acTEncTopList[ layerIdInVps ]->setProfileIdc( profileIdc );
    255 #endif
    256180  }
    257181
     
    276200    m_cTEncTop.setViewId                       ( vps.getViewId      (  layerId ) );
    277201    m_cTEncTop.setViewIndex                    ( vps.getViewIndex   (  layerId ) );
    278 #if NH_3D
    279     Bool isDepth = ( vps.getDepthId     ( layerId ) != 0 ) ;
    280     m_cTEncTop.setIsDepth                      ( isDepth );
    281     //====== Camera Parameters =========
    282     m_cTEncTop.setCameraParameters             ( &m_cCameraData );     
    283 #if NH_3D_VSO
    284     //====== VSO =========
    285     m_cTEncTop.setRenderModelParameters        ( &m_cRenModStrParser );
    286     m_cTEncTop.setForceLambdaScaleVSO          ( isDepth ? m_bForceLambdaScaleVSO : false );
    287     m_cTEncTop.setLambdaScaleVSO               ( isDepth ? m_dLambdaScaleVSO      : 1     );
    288     m_cTEncTop.setVSOMode                      ( isDepth ? m_uiVSOMode            : 0     );
    289 
    290     m_cTEncTop.setAllowNegDist                 ( isDepth ? m_bAllowNegDist        : false );
    291 
    292     // SAIT_VSO_EST_A0033
    293     m_cTEncTop.setUseEstimatedVSD              ( isDepth ? m_bUseEstimatedVSD     : false );
    294 
    295     // LGE_WVSO_A0119
    296     m_cTEncTop.setUseWVSO                      ( isDepth ? m_bUseWVSO             : false );   
    297     m_cTEncTop.setVSOWeight                    ( isDepth ? m_iVSOWeight           : 0     );
    298     m_cTEncTop.setVSDWeight                    ( isDepth ? m_iVSDWeight           : 0     );
    299     m_cTEncTop.setDWeight                      ( isDepth ? m_iDWeight             : 0     );
    300 #endif // H_3D_VSO
    301 #if NH_3D_IC
    302     m_cTEncTop.setUseIC                        ( vps.getViewIndex( layerId ) == 0 || isDepth ? false : m_abUseIC );
    303     m_cTEncTop.setUseICLowLatencyEnc           ( m_bUseLowLatencyICEnc );
    304 #endif
    305 
    306    
    307     m_cTEncTop.setUseDMM                       ( isDepth ? m_intraWedgeFlag   : false );
    308     m_cTEncTop.setUseSDC                       ( isDepth ? m_intraSdcFlag     : false );
    309     m_cTEncTop.setUseDLT                       ( isDepth ? m_useDLT   : false );
    310     m_cTEncTop.setUseQTL                       ( isDepth ? m_bUseQTL  : false );
    311     m_cTEncTop.setSps3dExtension               ( m_sps3dExtension );
    312 #endif // NH_3D
    313202
    314203    m_cTEncTop.setIvPicLists                   ( &m_ivPicLists );
     
    316205  m_cTEncTop.setVPS(&vps);
    317206
    318 #if NH_3D_DLT
    319   m_cTEncTop.setDLT(dlt);
    320 #endif
    321207
    322208#if NH_MV
     
    425311  m_cTEncTop.setChromaCrQpOffset                                  ( m_crQpOffset  );
    426312
    427 #if NH_3D
    428   m_cTEncTop.setChromaFormatIdc                                   ( isDepth ? CHROMA_400 : m_chromaFormatIDC );
    429 #else
    430313  m_cTEncTop.setChromaFormatIdc                                   ( m_chromaFormatIDC  );
    431 #endif
    432314
    433315#if ADAPTIVE_QP_SELECTION
     
    643525  m_cTEncTop.setScalingListFile                                   ( m_scalingListFile   );
    644526  m_cTEncTop.setSignHideFlag                                      ( m_signHideFlag);
    645 #if KWU_RC_VIEWRC_E0227 || KWU_RC_MADPRED_E0227
    646   if(!m_cTEncTop.getIsDepth())    //only for texture
    647   {
    648     m_cTEncTop.setUseRateCtrl                                     ( m_RCEnableRateControl );
    649   }                                                         
    650   else                                                       
    651   {                                                         
    652     m_cTEncTop.setUseRateCtrl                                     ( 0 );
    653   }
    654 #else
    655527  m_cTEncTop.setUseRateCtrl                                       ( m_RCEnableRateControl );
    656 #endif
    657 #if !KWU_RC_VIEWRC_E0227
    658528  m_cTEncTop.setTargetBitrate                                     ( m_RCTargetBitrate );
    659 #endif
    660529  m_cTEncTop.setKeepHierBit                                       ( m_RCKeepHierarchicalBit );
    661530  m_cTEncTop.setLCULevelRC                                        ( m_RCLCULevelRC );
     
    663532  m_cTEncTop.setInitialQP                                         ( m_RCInitialQP );
    664533  m_cTEncTop.setForceIntraQP                                      ( m_RCForceIntraQP );
    665 #if KWU_RC_MADPRED_E0227
    666   if(m_cTEncTop.getUseRateCtrl() && !m_cTEncTop.getIsDepth())
    667   {
    668     m_cTEncTop.setUseDepthMADPred(layerIdInVps ? m_depthMADPred       : 0);
    669     if(m_cTEncTop.getUseDepthMADPred())
    670     {
    671       m_cTEncTop.setCamParam(&m_cCameraData);
    672     }
    673   }
    674 #endif
    675 #if KWU_RC_VIEWRC_E0227
    676   if(m_cTEncTop.getUseRateCtrl() && !m_cTEncTop.getIsDepth())
    677   {
    678     m_cTEncTop.setUseViewWiseRateCtrl(m_viewWiseRateCtrl);
    679     if(m_iNumberOfViews == 1)
    680     {
    681       if(m_viewWiseRateCtrl)
    682       {
    683         m_cTEncTop.setTargetBitrate(m_viewTargetBits[layerIdInVps>>1]);
    684       }
    685       else
    686       {
    687         m_cTEncTop.setTargetBitrate       ( m_RCTargetBitrate );
    688       }
    689     }
    690     else
    691     {
    692       if(m_viewWiseRateCtrl)
    693       {
    694         m_cTEncTop.setTargetBitrate(m_viewTargetBits[layerIdInVps>>1]);
    695       }
    696       else
    697       {
    698         if(m_iNumberOfViews == 2)
    699         {
    700           if(m_cTEncTop.getViewId() == 0)
    701           {
    702             m_cTEncTop.setTargetBitrate              ( (m_RCTargetBitrate*80)/100 );
    703           }
    704           else if(m_cTEncTop.getViewId() == 1)
    705           {
    706             m_cTEncTop.setTargetBitrate              ( (m_RCTargetBitrate*20)/100 );
    707           }
    708         }
    709         else if(m_iNumberOfViews == 3)
    710         {
    711           if(m_cTEncTop.getViewId() == 0)
    712           {
    713             m_cTEncTop.setTargetBitrate              ( (m_RCTargetBitrate*66)/100 );
    714           }
    715           else if(m_cTEncTop.getViewId() == 1)
    716           {
    717             m_cTEncTop.setTargetBitrate              ( (m_RCTargetBitrate*17)/100 );
    718           }
    719           else if(m_cTEncTop.getViewId() == 2)
    720           {
    721             m_cTEncTop.setTargetBitrate              ( (m_RCTargetBitrate*17)/100 );
    722           }
    723         }
    724         else
    725         {
    726           m_cTEncTop.setTargetBitrate              ( m_RCTargetBitrate );
    727         }
    728       }
    729     }
    730   }
    731 #endif
    732534  m_cTEncTop.setTransquantBypassEnableFlag                        ( m_TransquantBypassEnableFlag );
    733535  m_cTEncTop.setCUTransquantBypassFlagForceValue                  ( m_CUTransquantBypassFlagForce );
     
    776578  }
    777579#endif
    778 #if NH_3D_VSO
    779   if ( m_bUseVSO )
    780   {
    781     if ( m_uiVSOMode == 4 )
    782     {
    783 #if H_3D_VSO_EARLY_SKIP
    784       m_cRendererModel.create( m_cRenModStrParser.getNumOfBaseViews(), m_cRenModStrParser.getNumOfModels(), m_iSourceWidth, m_uiMaxCUHeight , LOG2_DISP_PREC_LUT, 0, m_bVSOEarlySkip );
    785 #else
    786       m_cRendererModel.create( m_cRenModStrParser.getNumOfBaseViews(), m_cRenModStrParser.getNumOfModels(), m_iSourceWidth, m_uiMaxCUHeight , LOG2_DISP_PREC_LUT, 0 );
    787 #endif
    788       for ( Int layer = 0; layer < m_numberOfLayers ; layer++ )
    789       {
    790         TEncTop* pcEncTop =  m_acTEncTopList[ layer ];
    791         Int iViewNum      = pcEncTop->getViewIndex();
    792         Int iContent      = pcEncTop->getIsDepth() ? 1 : 0;
    793         Int iNumOfModels  = m_cRenModStrParser.getNumOfModelsForView(iViewNum, iContent);
    794 
    795         Bool bUseVSO      = (iNumOfModels != 0);
    796 
    797         pcEncTop->setUseVSO( bUseVSO );
    798         pcEncTop->getRdCost()->setRenModel( bUseVSO ? &m_cRendererModel : NULL );
    799 
    800         for (Int iCurModel = 0; iCurModel < iNumOfModels; iCurModel++ )
    801         {
    802           Int iModelNum; Int iLeftViewNum; Int iRightViewNum; Int iDump; Int iOrgRefNum; Int iBlendMode;
    803 
    804           m_cRenModStrParser.getSingleModelData  ( iViewNum, iContent, iCurModel, iModelNum, iBlendMode, iLeftViewNum, iRightViewNum, iOrgRefNum, iDump ) ;
    805           m_cRendererModel  .createSingleModel   ( iViewNum, iContent, iModelNum, iLeftViewNum, iRightViewNum, (iOrgRefNum != -1), iBlendMode );
    806         }           
    807       }
    808     }
    809     else
    810     {
    811       AOT(true);
    812     }
    813   }
    814 #endif
    815580}
    816581
     
    820585  // initialize global variables
    821586  initROM();
    822 #if NH_3D_DMM
    823   initWedgeLists( true );
    824 #endif
    825587
    826588  for( Int layer=0; layer < m_numberOfLayers; layer++)
     
    886648  for(Int layer=0; layer<m_numberOfLayers; layer++)
    887649  {
    888 #if KWU_RC_MADPRED_E0227
    889     m_acTEncTopList[layer]->init( isFieldCoding, this );
    890 #else
    891650    m_acTEncTopList[layer]->init( isFieldCoding );
    892 #endif
    893651  }
    894652#else
     
    918676  }
    919677
    920 #if !NH_3D
    921678  TComPicYuv*       pcPicYuvOrg = new TComPicYuv;
    922 #endif
    923679  TComPicYuv*       pcPicYuvRec = NULL;
    924680
     
    954710  list<AccessUnit> outputAccessUnits; ///< list of access units to write out.  is populated by the encoding process
    955711 
    956 #if NH_3D
    957   TComPicYuv* picYuvOrg[2];
    958   TComPicYuv  picYuvTrueOrg[2];
    959   for (Int d = 0; d < 2 ; d++)
    960   {
    961     picYuvOrg[d] = new TComPicYuv;
    962     picYuvOrg[d]   ->create( m_iSourceWidth, m_isField ? m_iSourceHeightOrg : m_iSourceHeight, ( d > 0 ) ? CHROMA_400 : m_chromaFormatIDC, m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxTotalCUDepth, true );
    963     picYuvTrueOrg[d].create( m_iSourceWidth, m_isField ? m_iSourceHeightOrg : m_iSourceHeight, ( d > 0 ) ? CHROMA_400 : m_chromaFormatIDC, m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxTotalCUDepth, true );
    964   }
    965 #else
    966712  TComPicYuv cPicYuvTrueOrg;
    967713
     
    977723    cPicYuvTrueOrg.create(m_iSourceWidth, m_iSourceHeight, m_chromaFormatIDC, m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxTotalCUDepth, true );
    978724  }
    979 #endif
    980725#if NH_MV
    981726  while ( (m_targetEncLayerIdList.size() != 0 ) && !allEos )
     
    983728    for(Int layer=0; layer < m_numberOfLayers; layer++ )
    984729    {
    985 #if NH_3D
    986       TComPicYuv* pcPicYuvOrg    =  picYuvOrg    [ m_depthFlag[layer] ];
    987       TComPicYuv& cPicYuvTrueOrg =  picYuvTrueOrg[ m_depthFlag[layer] ];
    988 #endif
    989730      if (!xLayerIdInTargetEncLayerIdList( m_vps->getLayerIdInNuh( layer ) ))
    990731      {
     
    1022763    for ( Int gopId=0; gopId < gopSize; gopId++ )
    1023764    {
    1024 #if NH_3D
    1025       UInt iNextPoc = m_acTEncTopList[0] -> getFrameId( gopId );
    1026       if ( iNextPoc < m_framesToBeEncoded )
    1027       {
    1028         m_cCameraData.update( iNextPoc );
    1029       }
    1030 #endif
    1031765      for(Int layer=0; layer < m_numberOfLayers; layer++ )
    1032766      {
    1033 #if NH_3D
    1034         TComPicYuv* pcPicYuvOrg    =  picYuvOrg    [ m_depthFlag[layer] ];
    1035         TComPicYuv& cPicYuvTrueOrg =  picYuvTrueOrg[ m_depthFlag[layer] ];
    1036 #endif
    1037767        if (!xLayerIdInTargetEncLayerIdList( m_vps->getLayerIdInNuh( layer ) ))
    1038768        {
     
    1040770        }
    1041771
    1042 #if NH_3D_VSO       
    1043           if( m_bUseVSO && m_bUseEstimatedVSD && iNextPoc < m_framesToBeEncoded )
    1044           {
    1045             m_cCameraData.setDispCoeff( iNextPoc, m_acTEncTopList[layer]->getViewIndex() );
    1046             m_acTEncTopList[layer]  ->setDispCoeff( m_cCameraData.getDispCoeff() );
    1047           }
    1048 #endif
    1049772
    1050773        Int   iNumEncoded = 0;
     
    1113836#endif
    1114837
    1115 #if NH_3D
    1116   // delete original YUV buffer
    1117   for (Int d = 0; d < 2; d++)
    1118   {
    1119     picYuvOrg[d]->destroy();
    1120     delete picYuvOrg[d];
    1121     picYuvOrg[d] = NULL;
    1122 
    1123     picYuvTrueOrg[d].destroy();
    1124   }
    1125 #else
    1126838  // delete original YUV buffer
    1127839  pcPicYuvOrg->destroy();
    1128840  delete pcPicYuvOrg;
    1129841  pcPicYuvOrg = NULL;
    1130 #endif
    1131842
    1132843#if !NH_MV
     
    1134845  m_cTEncTop.deletePicBuffer();
    1135846#endif
    1136 #if !NH_3D
    1137847  cPicYuvTrueOrg.destroy();
    1138 #endif
    1139848
    1140849  // delete buffers & classes
     
    1144853  printRateSummary();
    1145854
    1146 #if H_3D_REN_MAX_DEV_OUT
    1147   Double dMaxDispDiff = m_cCameraData.getMaxShiftDeviation();
    1148 
    1149   if ( !(dMaxDispDiff < 0) )
    1150   { 
    1151     printf("\n Max. possible shift error: %12.3f samples.\n", dMaxDispDiff );
    1152   }
    1153 #endif
    1154855
    1155856  return;
     
    1188889  {
    1189890    rpcPicYuvRec = new TComPicYuv;
    1190 #if NH_3D
    1191     rpcPicYuvRec->create( m_iSourceWidth, m_iSourceHeight, m_depthFlag[layer] > 0 ? CHROMA_400 : m_chromaFormatIDC, m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxTotalCUDepth, true );
    1192 #else
    1193891    rpcPicYuvRec->create( m_iSourceWidth, m_iSourceHeight, m_chromaFormatIDC, m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxTotalCUDepth, true );
    1194 #endif
    1195892
    1196893  }
     
    1270967      if (m_pchReconFileList[layerIdx])
    1271968      {
    1272 #if NH_3D
    1273         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 );
    1274 #else
    1275969        m_acTVideoIOYuvReconFileList[layerIdx]->write( pcPicYuvRecTop, pcPicYuvRecBottom, ipCSC, m_confWinLeft, m_confWinRight, m_confWinTop, m_confWinBottom, NUM_CHROMA_FORMAT, m_isTopFieldFirst );
    1276 #endif
    1277970      }
    1278971    }
     
    13271020      if (m_pchReconFileList[layerIdx])
    13281021      {
    1329 #if NH_3D
    1330         m_acTVideoIOYuvReconFileList[layerIdx]->write( pcPicYuvRec, ipCSC, m_confWinLeft, m_confWinRight, m_confWinTop, m_confWinBottom, m_depth420OutputFlag && m_depthFlag[layerIdx ] ? CHROMA_420 : NUM_CHROMA_FORMAT  );
    1331 #else
    13321022        m_acTVideoIOYuvReconFileList[layerIdx]->write( pcPicYuvRec, ipCSC, m_confWinLeft, m_confWinRight, m_confWinTop, m_confWinBottom );
    1333 #endif
    13341023
    13351024      }   
     
    14561145}
    14571146
    1458 #if NH_3D_DLT
    1459 Void TAppEncTop::xAnalyzeInputBaseDepth(UInt layer, UInt uiNumFrames, TComVPS* vps, TComDLT* dlt)
    1460 {
    1461   TComPicYuv*       pcDepthPicYuvOrg = new TComPicYuv;
    1462   TComPicYuv*       pcDepthPicYuvTrueOrg = new TComPicYuv;
    1463   // allocate original YUV buffer
    1464   pcDepthPicYuvOrg->create( m_iSourceWidth, m_iSourceHeight, CHROMA_420, m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxTotalCUDepth, false );
    1465   pcDepthPicYuvTrueOrg->create( m_iSourceWidth, m_iSourceHeight, CHROMA_420, m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxTotalCUDepth, false );
    1466  
    1467   TVideoIOYuv* depthVideoFile = new TVideoIOYuv;
    1468  
    1469   UInt uiMaxDepthValue = ((1 << m_inputBitDepth[CHANNEL_TYPE_LUMA])-1);
    1470  
    1471   std::vector<Bool> abValidDepths(256, false);
    1472  
    1473   depthVideoFile->open( m_pchInputFileList[layer], false, m_inputBitDepth, m_MSBExtendedBitDepth, m_internalBitDepth );
    1474  
    1475   Int iHeight   = pcDepthPicYuvOrg->getHeight(COMPONENT_Y);
    1476   Int iWidth    = pcDepthPicYuvOrg->getWidth(COMPONENT_Y);
    1477   Int iStride   = pcDepthPicYuvOrg->getStride(COMPONENT_Y);
    1478  
    1479   Pel* pInDM    = pcDepthPicYuvOrg->getAddr(COMPONENT_Y);
    1480  
    1481   for(Int uiFrame=0; uiFrame < uiNumFrames; uiFrame++ )
    1482   {
    1483     depthVideoFile->read( pcDepthPicYuvOrg, pcDepthPicYuvTrueOrg, IPCOLOURSPACE_UNCHANGED, m_aiPad, m_InputChromaFormatIDC, m_bClipInputVideoToRec709Range );
    1484    
    1485     // check all pixel values
    1486     for (Int i=0; i<iHeight; i++)
    1487     {
    1488       Int rowOffset = i*iStride;
    1489      
    1490       for (Int j=0; j<iWidth; j++)
    1491       {
    1492         Pel depthValue = pInDM[rowOffset+j];
    1493         abValidDepths[depthValue] = true;
    1494       }
    1495     }
    1496   }
    1497  
    1498   depthVideoFile->close();
    1499   delete depthVideoFile;
    1500  
    1501   pcDepthPicYuvOrg->destroy();
    1502   delete pcDepthPicYuvOrg;
    1503   pcDepthPicYuvTrueOrg->destroy();
    1504   delete pcDepthPicYuvTrueOrg;
    1505  
    1506   // convert boolean array to idx2Depth LUT
    1507   std::vector<Int> aiIdx2DepthValue(256, 0);
    1508   Int iNumDepthValues = 0;
    1509   for(Int p=0; p<=uiMaxDepthValue; p++)
    1510   {
    1511     if( abValidDepths[p] == true)
    1512     {
    1513       aiIdx2DepthValue[iNumDepthValues++] = p;
    1514     }
    1515   }
    1516  
    1517   if( uiNumFrames == 0 || gCeilLog2(iNumDepthValues) == m_inputBitDepth[CHANNEL_TYPE_LUMA] )
    1518   {
    1519     dlt->setUseDLTFlag(layer, false);
    1520   }
    1521  
    1522   // assign LUT
    1523   if( dlt->getUseDLTFlag(layer) )
    1524   {
    1525     dlt->setDepthLUTs(layer, aiIdx2DepthValue, iNumDepthValues);
    1526   }
    1527 }
    1528 #endif
    15291147
    15301148#if NH_MV
     
    15561174
    15571175
    1558 #if NH_3D
    1559   vps.initViewCompLayer( );
    1560 #endif
    15611176}
    15621177
     
    16351250      Int curLayerIdInNuh = vps.getLayerIdInNuh( curLayerIdInVps );     
    16361251      Int maxTid = -1;
    1637 #if NH_3D
    1638       if ( vps.getDirectDependencyFlag( curLayerIdInVps, refLayerIdInVps ) )
    1639       {
    1640         if ( m_depthFlag[ curLayerIdInVps] == m_depthFlag[ refLayerIdInVps ] )
    1641         {
    1642 #endif
    16431252          for( Int i = 0; i < ( getGOPSize() + 1); i++ )
    16441253          {       
     
    16471256            for (Int j = 0; j < geCur.m_numActiveRefLayerPics; j++)
    16481257            {
    1649 #if NH_3D
    1650               if ( vps.getIdRefListLayer( curLayerIdInNuh, geCur.m_interLayerPredLayerIdc[ j ] ) == refLayerIdInNuh )
    1651 #else
    16521258              if ( vps.getIdDirectRefLayer( curLayerIdInNuh, geCur.m_interLayerPredLayerIdc[ j ] ) == refLayerIdInNuh )
    1653 #endif
    16541259              {
    16551260                Bool refLayerZero   = ( i == getGOPSize() ) && ( refLayerIdInVps == 0 );
     
    16581263            }
    16591264          }             
    1660 #if NH_3D
    1661         }
    1662         else
    1663         {       
    1664           if( m_depthFlag[ curLayerIdInVps ] && ( m_mpiFlag|| m_qtPredFlag || m_intraContourFlag ) )
    1665           {         
    1666             Int nuhLayerIdTex = vps.getLayerIdInNuh( vps.getViewIndex( curLayerIdInNuh ), false );
    1667             if ( nuhLayerIdTex == refLayerIdInNuh )
    1668             {
    1669               for( Int i = 0; i < ( getGOPSize() + 1); i++ )
    1670               {       
    1671                 GOPEntry geCur =  m_GOPListMvc[curLayerIdInVps][( i < getGOPSize()  ? i : MAX_GOP )];
    1672                 GOPEntry geRef =  m_GOPListMvc[refLayerIdInVps][( i < getGOPSize()  ? i : MAX_GOP )];
    1673                 if ( geCur.m_interCompPredFlag )
    1674                 {
    1675                   Bool refLayerZero   = ( i == getGOPSize() ) && ( refLayerIdInVps == 0 );
    1676                   maxTid = std::max( maxTid, refLayerZero ? 0 : geRef.m_temporalId );
    1677                 }
    1678               }
    1679             }
    1680           }
    1681           if( !m_depthFlag[ curLayerIdInVps ] && vps.getNumRefListLayers( curLayerIdInNuh) > 0  && ( m_depthRefinementFlag || m_viewSynthesisPredFlag || m_depthBasedBlkPartFlag ) )
    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 
    1688               if ( geCur.m_interCompPredFlag )
    1689               {
    1690                 for (Int j = 0; j < geCur.m_numActiveRefLayerPics; j++ )
    1691                 {
    1692                   Int nuhLayerIdDep = vps.getLayerIdInNuh( vps.getViewIndex( vps.getIdRefListLayer( curLayerIdInNuh, geCur.m_interLayerPredLayerIdc[j] ) ), true );
    1693                   if ( nuhLayerIdDep == refLayerIdInNuh )
    1694                   {
    1695                     Bool refLayerZero   = ( i == getGOPSize() ) && ( refLayerIdInVps == 0 );
    1696                     maxTid = std::max( maxTid, refLayerZero ? 0 : geRef.m_temporalId );
    1697                   }
    1698                 }
    1699               }
    1700             }
    1701           }       
    1702         }
    1703       } // if ( vps.getDirectDependencyFlag( curLayerIdInVps, refLayerIdInVps ) )
    1704       vps.setMaxTidIlRefPicsPlus1( refLayerIdInVps, curLayerIdInVps, maxTid + 1 );
    1705 #endif
    17061265    }  // Loop curLayerIdInVps
    17071266  } // Loop refLayerIdInVps
     
    17521311     
    17531312      // check if all reference layers when allRefLayerActiveFlag is equal to 1 are reference layer pictures specified in the gop entry
    1754 #if NH_3D
    1755       for (Int k = 0; k < vps.getNumRefListLayers( layerIdInNuh ) && allRefLayersActiveFlag; k++ )
    1756       {
    1757         Int refLayerIdInVps = vps.getLayerIdInVps( vps.getIdRefListLayer( layerIdInNuh , k ) );
    1758 #else
    17591313      for (Int k = 0; k < vps.getNumDirectRefLayers( layerIdInNuh ) && allRefLayersActiveFlag; k++ )
    17601314      {
    17611315        Int refLayerIdInVps = vps.getLayerIdInVps( vps.getIdDirectRefLayer( layerIdInNuh , k ) );
    1762 #endif
    17631316        if ( vps.getSubLayersVpsMaxMinus1(refLayerIdInVps) >= tId  && ( tId == 0 || vps.getMaxTidIlRefPicsPlus1(refLayerIdInVps,layerIdInVps) > tId )  )
    17641317        {
     
    17781331      {   
    17791332        Bool referenceLayerFoundFlag = false;
    1780 #if NH_3D
    1781         for (Int k = 0; k < vps.getNumRefListLayers( layerIdInNuh ); k++ )
    1782         {
    1783           Int refLayerIdInVps = vps.getLayerIdInVps( vps.getIdRefListLayer( layerIdInNuh, k) );
    1784 #else
    17851333        for (Int k = 0; k < vps.getNumDirectRefLayers( layerIdInNuh ); k++ )
    17861334        {
    17871335          Int refLayerIdInVps = vps.getLayerIdInVps( vps.getIdDirectRefLayer( layerIdInNuh, k) );
    1788 #endif
    17891336          if ( vps.getSubLayersVpsMaxMinus1(refLayerIdInVps) >= tId  && ( tId == 0 || vps.getMaxTidIlRefPicsPlus1(refLayerIdInVps,layerIdInVps) > tId )  )
    17901337          {         
     
    19151462    break;
    19161463  case Profile::MULTIVIEWMAIN:
    1917 #if NH_3D
    1918   case Profile::MAIN3D:
    1919 #endif
    19201464    ptl->setMax12bitConstraintFlag      ( true  );
    19211465    ptl->setMax12bitConstraintFlag      ( true  );
     
    19391483
    19401484  Bool anyDepth = false;
    1941 #if NH_3D
    1942   for ( Int i = 0; i < m_numberOfLayers; i++ )
    1943   {
    1944     vps.setVpsRepFormatIdx( i, m_depthFlag[ i ] ? 1 : 0 );
    1945     anyDepth = anyDepth || m_depthFlag[ i ];
    1946   }
    1947 #endif
    19481485
    19491486  vps.setRepFormatIdxPresentFlag( anyDepth );
     
    23501887}
    23511888
    2352 #if NH_3D
    2353 Void TAppEncTop::xSetCamPara                ( TComVPS& vps )
    2354 {
    2355   vps.setCpPrecision( m_cCameraData.getCamParsCodedPrecision());
    2356 
    2357   for ( Int n = 1; n < vps.getNumViews(); n++ )
    2358   { 
    2359     Int i      = vps.getViewOIdxList( n );
    2360     Int iInVps = vps.getVoiInVps    ( i );
    2361     vps.setNumCp( iInVps,  n);   
    2362 
    2363     if ( vps.getNumCp( iInVps ) > 0 )
    2364     {
    2365       vps.setCpInSliceSegmentHeaderFlag( iInVps, m_cCameraData.getVaryingCameraParameters() );
    2366 
    2367       for( Int m = 0; m < vps.getNumCp( iInVps ); m++ )
    2368       {
    2369         vps.setCpRefVoi( iInVps, m, vps.getViewOIdxList( m ) );
    2370         if( !vps.getCpInSliceSegmentHeaderFlag( iInVps ) )
    2371         {
    2372           Int j = vps.getCpRefVoi( iInVps, m );
    2373           Int jInVps = vps.getVoiInVps( j );         
    2374 
    2375           vps.setVpsCpScale   ( iInVps, jInVps, m_cCameraData.getCodedScale() [ jInVps ][ iInVps ] ) ;
    2376           vps.setVpsCpInvScale( iInVps, jInVps, m_cCameraData.getCodedScale() [ iInVps ][ jInVps ] ) ;
    2377           vps.setVpsCpOff     ( iInVps, jInVps, m_cCameraData.getCodedOffset()[ jInVps ][ iInVps ] ) ;
    2378           vps.setVpsCpInvOff  ( iInVps, jInVps, m_cCameraData.getCodedOffset()[ iInVps ][ jInVps ] ) ;
    2379         }
    2380       }
    2381     }
    2382   }
    2383   vps.deriveCpPresentFlag();
    2384 }
    2385 #endif
    23861889
    23871890
     
    23951898
    23961899
    2397 #if NH_3D_DLT
    2398 Void TAppEncTop::xDeriveDltArray( TComVPS& vps, TComDLT* dlt )
    2399 {
    2400   Int  iNumDepthViews  = 0;
    2401   Bool bDltPresentFlag = false;
    2402 
    2403   for ( Int layer = 0; layer <= vps.getMaxLayersMinus1(); layer++ )
    2404   {
    2405     Bool isDepth = ( vps.getDepthId( layer ) == 1 );
    2406 
    2407     if ( isDepth )
    2408     {
    2409       iNumDepthViews++;
    2410     }
    2411 
    2412     dlt->setUseDLTFlag( layer , isDepth && m_useDLT );
    2413     if( dlt->getUseDLTFlag( layer ) )
    2414     {
    2415       xAnalyzeInputBaseDepth(layer, max(m_iIntraPeriod[layer], 24), &vps, dlt);
    2416       bDltPresentFlag = bDltPresentFlag || dlt->getUseDLTFlag(layer);
    2417       dlt->setInterViewDltPredEnableFlag(layer, (dlt->getUseDLTFlag(layer) && (layer>1)));
    2418      
    2419       // ----------------------------- determine whether to use bit-map -----------------------------
    2420       Bool bDltBitMapRepFlag       = false;
    2421       UInt uiNumBitsNonBitMap      = 0;
    2422       UInt uiNumBitsBitMap         = 0;
    2423      
    2424       UInt uiMaxDiff               = 0;
    2425       UInt uiMinDiff               = MAX_INT;
    2426       UInt uiLengthMinDiff         = 0;
    2427       UInt uiLengthDltDiffMinusMin = 0;
    2428      
    2429       std::vector<Int> aiIdx2DepthValue_coded(256, 0);
    2430       UInt uiNumDepthValues_coded = 0;
    2431      
    2432       uiNumDepthValues_coded = dlt->getNumDepthValues(layer);
    2433       for( UInt ui = 0; ui<uiNumDepthValues_coded; ui++ )
    2434       {
    2435         aiIdx2DepthValue_coded[ui] = dlt->idx2DepthValue(layer, ui);
    2436       }
    2437      
    2438       if( dlt->getInterViewDltPredEnableFlag( layer ) )
    2439       {
    2440         AOF( vps.getDepthId( 1 ) == 1 );
    2441         AOF( layer > 1 );
    2442         // assumes ref layer id to be 1
    2443         std::vector<Int> piRefDLT = dlt->idx2DepthValue( 1 );
    2444         UInt uiRefNum = dlt->getNumDepthValues( 1 );
    2445         dlt->getDeltaDLT(layer, piRefDLT, uiRefNum, aiIdx2DepthValue_coded, uiNumDepthValues_coded);
    2446       }
    2447      
    2448       std::vector<UInt> puiDltDiffValues(uiNumDepthValues_coded, 0);
    2449      
    2450       for (UInt d = 1; d < uiNumDepthValues_coded; d++)
    2451       {
    2452         puiDltDiffValues[d] = aiIdx2DepthValue_coded[d] - aiIdx2DepthValue_coded[d-1];
    2453        
    2454         if ( uiMaxDiff < puiDltDiffValues[d] )
    2455         {
    2456           uiMaxDiff = puiDltDiffValues[d];
    2457         }
    2458        
    2459         if ( uiMinDiff > puiDltDiffValues[d] )
    2460         {
    2461           uiMinDiff = puiDltDiffValues[d];
    2462         }
    2463       }
    2464      
    2465       // counting bits
    2466       // diff coding branch
    2467       uiNumBitsNonBitMap += 8;                          // u(v) bits for num_depth_values_in_dlt[layerId] (i.e. num_entry[ layerId ])
    2468      
    2469       if ( uiNumDepthValues_coded > 1 )
    2470       {
    2471         uiNumBitsNonBitMap += 8;                        // u(v) bits for max_diff[ layerId ]
    2472       }
    2473      
    2474       if ( uiNumDepthValues_coded > 2 )
    2475       {
    2476         uiLengthMinDiff    = (UInt) gCeilLog2(uiMaxDiff + 1);
    2477         uiNumBitsNonBitMap += uiLengthMinDiff;          // u(v)  bits for min_diff[ layerId ]
    2478       }
    2479      
    2480       uiNumBitsNonBitMap += 8;                          // u(v) bits for dlt_depth_value0[ layerId ]
    2481      
    2482       if (uiMaxDiff > uiMinDiff)
    2483       {
    2484         uiLengthDltDiffMinusMin = (UInt) gCeilLog2(uiMaxDiff - uiMinDiff + 1);
    2485         uiNumBitsNonBitMap += uiLengthDltDiffMinusMin * (uiNumDepthValues_coded - 1);  // u(v) bits for dlt_depth_value_diff_minus_min[ layerId ][ j ]
    2486       }
    2487      
    2488       // bit map branch
    2489       uiNumBitsBitMap = 1 << m_inputBitDepth[CHANNEL_TYPE_LUMA];
    2490      
    2491       // determine bDltBitMapFlag
    2492       bDltBitMapRepFlag = (uiNumBitsBitMap > uiNumBitsNonBitMap) ? false : true;
    2493      
    2494       dlt->setUseBitmapRep(layer, bDltBitMapRepFlag);
    2495     }
    2496   }
    2497 
    2498   dlt->setDltPresentFlag( bDltPresentFlag );
    2499   dlt->setNumDepthViews ( iNumDepthViews  );
    2500   dlt->setDepthViewBitDepth( m_inputBitDepth[CHANNEL_TYPE_LUMA] );
    2501 }
    2502 #endif
    25031900//! \}
  • branches/HTM-15.1-MV-draft-4/source/App/TAppEncoder/TAppEncTop.h

    r1313 r1325  
    4646#include "TLibCommon/AccessUnit.h"
    4747#include "TAppEncCfg.h"
    48 #if NH_3D
    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-15.1-MV-draft-4/source/App/TAppRenderer/RendererMain.cpp

    r1313 r1325  
    3535#include <time.h>
    3636#include "../../Lib/TLibCommon/CommonDef.h"
    37 #if NH_3D
    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-15.1-MV-draft-4/source/App/TAppRenderer/TAppRendererCfg.cpp

    r1313 r1325  
    4444#include "../../Lib/TAppCommon/program_options_lite.h"
    4545
    46 #if NH_3D
    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, Char* 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,  (Char*) 0, "Basename to generate video input file names")
    124     ("DepthInputFileBaseName,d",  m_pchDepthInputFileBaseName,  (Char*) 0, "Basename to generate depth input file names")
    125     ("SynthOutputFileBaseName,s", m_pchSynthOutputFileBaseName, (Char*) 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 ,    (Char *) 0, MAX_INPUT_VIEW_NUM , "Original Yuv video input file name %d")
    130     ("DepthInputFile_%d,d_%d",  m_pchDepthInputFileList ,    (Char *) 0, MAX_INPUT_VIEW_NUM , "Original Yuv depth input file name %d")
    131     ("SynthOutputFile_%d,s_%d", m_pchSynthOutputFileList,    (Char *) 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,          (Char *) 0, "Camera Parameter File Name")
    149     ("BaseViewCameraNumbers"  , m_pchBaseViewCameraNumbers,        (Char *) 0, "Numbers of base views")
    150     ("SynthViewCameraNumbers" , m_pchSynthViewCameraNumbers,       (Char *) 0, "Numbers of views to synthesis")
    151     ("ViewConfig"             , m_pchViewConfig,                   (Char *) 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( Char* pchSourceFileName, Char*& 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   Char pchNumberBuffer[2* LOG10_VIEW_NUM_PREC + 2];
    471   Char 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 = (Char*) malloc(iInLength+iAddLength+1);
    491 
    492   Char* 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-15.1-MV-draft-4/source/App/TAppRenderer/TAppRendererCfg.h

    r1313 r1325  
    4747#include <vector>
    4848
    49 #if NH_3D
    50 
    51 // ====================================================================================================================
    52 // Class definition
    53 // ====================================================================================================================
    54 
    55 /// encoder configuration class
    56 class TAppRendererCfg
    57 {
    58 protected:
    59 
    60   //// file I/O ////
    61   Char*              m_pchVideoInputFileBaseName;      ///< input video  file base name, placeholder for numbering $$
    62   Char*              m_pchDepthInputFileBaseName;      ///< input depth  file base name, placeholder for numbering $$
    63   Char*              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<Char*> m_pchVideoInputFileList;          ///< source file names
    76   std::vector<Char*> m_pchDepthInputFileList;          ///< source depth file names
    77   std::vector<Char*> 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   Char*               m_pchCameraParameterFile;         ///< camera parameter file
    87   Char*               m_pchSynthViewCameraNumbers;      ///< numbers of views to synthesize
    88   Char*               m_pchViewConfig;                  ///< String to setup renderer
    89   Char*               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( Char* pchSourceFileName, Char*& 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, Char* argv[] );                 ///< parse configuration file to fill member variables
    134   Bool  xConfirmParameter(Bool bflag, const Char* message);
    135 
    136 
    137 };// END CLASS DEFINITION TAppRendererCfg
    138 
    139 #endif // __TAppRENDERERCFG__
    14049#endif // NH_3D
  • branches/HTM-15.1-MV-draft-4/source/App/TAppRenderer/TAppRendererTop.cpp

    r1313 r1325  
    4141#include "TAppRendererTop.h"
    4242
    43 #if NH_3D
    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 H_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-15.1-MV-draft-4/source/App/TAppRenderer/TAppRendererTop.h

    r1313 r1325  
    4040#define __TAppRendererTOP__
    4141#include "../../Lib/TLibCommon/CommonDef.h"
    42 #if NH_3D
    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.