Changeset 1191 in 3DVCSoftware


Ignore:
Timestamp:
15 Apr 2015, 11:36:33 (9 years ago)
Author:
tech
Message:

Removed 3D-HEVC.

Location:
branches/HTM-14.0-MV-draft-3/source
Files:
89 edited

Legend:

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

    r1179 r1191  
    6868  string cfg_ReconFile;
    6969  string cfg_TargetDecLayerIdSetFile;
    70 #if H_3D
    71   string cfg_ScaleOffsetFile;
    72 #endif
    7370
    7471  po::Options opts;
     
    7875  ("ReconFile,o",     cfg_ReconFile,     string(""), "reconstructed YUV output file name\n"
    7976                                                     "YUV writing is skipped if omitted")
    80 #if H_3D
    81   ("ScaleOffsetFile,p", cfg_ScaleOffsetFile, string(""), "file with coded scales and offsets")
    82 #endif
    8377  ("SkipFrames,s", m_iSkipFrame, 0, "number of frames to skip before random access")
    8478  ("OutputBitDepth,d", m_outputBitDepthY, 0, "bit depth of YUV output luma component (default: use 0 for native depth)")
     
    116110  m_pchReconFile = cfg_ReconFile.empty() ? NULL : strdup(cfg_ReconFile.c_str());
    117111
    118 #if H_3D
    119   m_pchScaleOffsetFile = cfg_ScaleOffsetFile.empty() ? NULL : strdup(cfg_ScaleOffsetFile.c_str());
    120 #endif
    121112  if (!m_pchBitstreamFile)
    122113  {
  • branches/HTM-14.0-MV-draft-3/source/App/TAppDecoder/TAppDecCfg.h

    r1179 r1191  
    6363#endif
    6464  Char*         m_pchReconFile;                       ///< output reconstruction file name
    65 #if H_3D
    66   Char*         m_pchScaleOffsetFile;                 ///< output coded scale and offset parameters
    67 #endif
    6865  Int           m_iSkipFrame;                         ///< counter for frames prior to the random access point to skip
    6966  Int           m_outputBitDepthY;                    ///< bit depth used for writing output (luma)
  • branches/HTM-14.0-MV-draft-3/source/App/TAppDecoder/TAppDecTop.cpp

    r1179 r1191  
    6767  }
    6868#endif
    69 #if H_3D
    70     m_pScaleOffsetFile  = 0;
    71 #endif
    7269
    7370#if H_MV
     
    103100    m_pchReconFile = NULL;
    104101  }
    105 #if H_3D
    106   if (m_pchScaleOffsetFile)
    107   {
    108     free (m_pchScaleOffsetFile);
    109     m_pchScaleOffsetFile = NULL;
    110   }
    111 #endif
    112102}
    113103
     
    139129  }
    140130
    141 #if H_3D
    142   if( m_pchScaleOffsetFile )
    143   {
    144     m_pScaleOffsetFile = ::fopen( m_pchScaleOffsetFile, "wt" );
    145     AOF( m_pScaleOffsetFile );
    146   }
    147 #endif
    148131  InputByteStream bytestream(bitstreamFile);
    149132
     
    248231            {
    249232              m_tDecTop[decIdx]->setTargetOptLayerSetIdx( m_targetOptLayerSetIdx );
    250 #if H_3D_ANNEX_SELECTION_FIX
    251               m_tDecTop[decIdx]->setProfileIdc( );
    252 #endif
    253233            }
    254234
     
    268248          }
    269249        }
    270 #if H_3D
    271         if (nalu.m_nalUnitType == NAL_UNIT_VPS )
    272         {                 
    273           m_cCamParsCollector.init( m_pScaleOffsetFile, m_tDecTop[decIdx]->getPrefetchedVPS() );
    274         }       
    275 #endif
    276250        bNewPicture       = ( newSliceDiffLayer || newSliceDiffPoc ) && !sliceSkippedFlag;
    277251        if ( nalu.isSlice() && firstSlice && !sliceSkippedFlag )       
     
    349323#endif
    350324#endif
    351 #if H_3D
    352     if ( allLayersDecoded || !bitstreamFile )
    353     {
    354       for( Int dI = 0; dI < m_numDecoders; dI++ )
    355       {
    356         TComPic* picLastCoded = m_ivPicLists.getPic( m_tDecTop[dI]->getLayerId(), pocLastPic );
    357         assert( picLastCoded != NULL );       
    358         picLastCoded->compressMotion(1);
    359       }
    360     }
    361 #endif
    362325
    363326    if( pcListPic )
     
    472435  }
    473436#if H_MV
    474 #if H_3D
    475   if( m_cCamParsCollector.isInitialized() )
    476   {
    477     m_cCamParsCollector.setSlice( 0 );
    478   }
    479 #endif
    480437  for(UInt decIdx = 0; decIdx < m_numDecoders; decIdx++)
    481438  {
     
    501458  // initialize global variables
    502459  initROM(); 
    503 #if H_3D_DIM_DMM
    504   initWedgeLists();
    505 #endif
    506460#else
    507461  // create decoder class
     
    541495  // destroy decoder class
    542496  m_cTDecTop.destroy();
    543 #endif
    544 #if H_3D
    545   m_cCamParsCollector.uninit();
    546   if( m_pScaleOffsetFile )
    547   {
    548     ::fclose( m_pScaleOffsetFile );
    549   }
    550497#endif
    551498}
     
    10531000    m_tDecTop[ decIdx ]->setLayerInitilizedFlags( m_layerInitilizedFlags );
    10541001    m_tDecTop[ decIdx ]->setTargetOptLayerSetIdx( m_targetOptLayerSetIdx );   
    1055 #if H_3D_ANNEX_SELECTION_FIX
    1056     m_tDecTop[ decIdx ]->setProfileIdc           ( );   
    1057 #endif
    1058 
    1059 #if H_3D
    1060    m_tDecTop[ decIdx ]->setCamParsCollector( &m_cCamParsCollector );
    1061 #endif
     1002
    10621003
    10631004    // append pic list of new decoder to PicLists
  • branches/HTM-14.0-MV-draft-3/source/App/TAppDecoder/TAppDecTop.h

    r1179 r1191  
    8282#endif
    8383
    84 #if H_3D
    85   FILE*                           m_pScaleOffsetFile;
    86   CamParsCollector                m_cCamParsCollector;
    87 #endif
    8884public:
    8985  TAppDecTop();
  • branches/HTM-14.0-MV-draft-3/source/App/TAppEncoder/TAppEncCfg.cpp

    r1179 r1191  
    148148  }
    149149#endif
    150 #if H_3D
    151 #if H_3D_VSO
    152   if (  m_pchVSOConfig != NULL)
    153     free (  m_pchVSOConfig );
    154 #endif
    155   if ( m_pchCameraParameterFile != NULL )
    156     free ( m_pchCameraParameterFile );
    157 
    158   if ( m_pchBaseViewCameraNumbers != NULL )
    159     free ( m_pchBaseViewCameraNumbers );
    160 #endif
    161150}
    162151
     
    225214  }
    226215#endif
    227 #if HHI_INTER_COMP_PRED_K0052
    228 #if H_3D
    229   in>>entry.m_interCompPredFlag;
    230 #endif
    231 #endif
    232216  return in;
    233217}
     
    243227#if H_MV
    244228  {"multiview-main", Profile::MULTIVIEWMAIN},
    245 #if H_3D
    246   {"3d-main"       , Profile::MAIN3D},
    247 #endif
    248229
    249230#endif
     
    337318  string        cfg_levels;
    338319  string        cfg_tiers;
    339 #if H_3D
    340   cfg_dimensionLength.push_back( 2  );  // depth
    341   cfg_dimensionLength.push_back( 32 );  // texture
    342 #else
    343320  cfg_dimensionLength.push_back( 64 );
    344 #endif
    345321#endif
    346322  string cfg_dQPFile;
     
    370346#if H_MV
    371347  ("NumberOfLayers",        m_numberOfLayers     , 1,                     "Number of layers")
    372 #if !H_3D
    373348  ("ScalabilityMask",       m_scalabilityMask    , 2                    , "Scalability Mask: 2: Multiview, 8: Auxiliary, 10: Multiview + Auxiliary")   
    374 #else
    375   ("ScalabilityMask",       m_scalabilityMask    , 3                    , "Scalability Mask, 1: Texture 3: Texture + Depth ")   
    376 #endif 
    377349  ("DimensionIdLen",        m_dimensionIdLen     , cfg_dimensionLength  , "Number of bits used to store dimensions Id")
    378350  ("ViewOrderIndex",        m_viewOrderIndex     , std::vector<Int>(1,0), "View Order Index per layer")
    379351  ("ViewId",                m_viewId             , std::vector<Int>(1,0), "View Id per View Order Index")
    380352  ("AuxId",                 m_auxId              , std::vector<Int>(1,0), "AuxId per layer")
    381 #if H_3D
    382   ("DepthFlag",             m_depthFlag          , std::vector<Int>(1,0), "Depth Flag")
    383 #if H_3D_DIM
    384   ("DLT",                   m_useDLT,           true,  "Depth lookup table")
    385 #endif
    386 #if H_3D
    387 #endif
    388 #endif
    389353  ("TargetEncLayerIdList",  m_targetEncLayerIdList, std::vector<Int>(0,0), "LayerIds in Nuh to be encoded") 
    390354  ("LayerIdInNuh",          m_layerIdInNuh       , std::vector<Int>(1,0), "LayerId in Nuh") 
     
    535499  ("DeblockingFilterMetric",         m_DeblockingFilterMetric,         false )
    536500
    537 #if H_3D_IC
    538   ("IlluCompEnable",           m_abUseIC, true, "Enable illumination compensation")
    539   ("IlluCompLowLatencyEnc",    m_bUseLowLatencyICEnc, false, "Enable low-latency illumination compensation encoding")
    540 #endif
    541501  // Coding tools
    542502  ("AMP",                      m_enableAMP,                 true,  "Enable asymmetric motion partitions")
     
    754714  ("OutputVpsInfo",                           m_outputVpsInfo,                false                     ,"Output information about the layer dependencies and layer sets")
    755715#endif
    756 #if H_3D
    757   ("CameraParameterFile,cpf", m_pchCameraParameterFile,    (Char *) 0, "Camera Parameter File Name")
    758   ("BaseViewCameraNumbers" ,  m_pchBaseViewCameraNumbers,  (Char *) 0, "Numbers of base views")
    759   ("CodedCamParsPrecision",   m_iCodedCamParPrecision,  STD_CAM_PARAMETERS_PRECISION, "precision for coding of camera parameters (in units of 2^(-x) luma samples)" )
    760 /* View Synthesis Optimization */
    761 
    762 #if H_3D_VSO
    763   ("VSOConfig",                       m_pchVSOConfig            , (Char *) 0    , "VSO configuration")
    764   ("VSO",                             m_bUseVSO                 , false         , "Use VSO" )   
    765   ("VSOMode",                         m_uiVSOMode               , (UInt)   4    , "VSO Mode")
    766   ("LambdaScaleVSO",                  m_dLambdaScaleVSO         , (Double) 1    , "Lambda Scaling for VSO")
    767   ("VSOLSTable",                      m_bVSOLSTable             , true          , "Depth QP dependent video/depth rate allocation by Lagrange multiplier" )     
    768   ("ForceLambdaScaleVSO",             m_bForceLambdaScaleVSO    , false         , "Force using Lambda Scale VSO also in non-VSO-Mode")
    769   ("AllowNegDist",                    m_bAllowNegDist           , true          , "Allow negative Distortion in VSO")
    770  
    771   ("UseEstimatedVSD",                 m_bUseEstimatedVSD        , true          , "Model based VSD estimation instead of rendering based for some encoder decisions" )     
    772   ("VSOEarlySkip",                    m_bVSOEarlySkip           , true          , "Early skip of VSO computation if synthesis error assumed to be zero" )     
    773  
    774   ("WVSO",                            m_bUseWVSO                , true          , "Use depth fidelity term for VSO" )
    775   ("VSOWeight",                       m_iVSOWeight              , 10            , "Synthesized View Distortion Change weight" )
    776   ("VSDWeight",                       m_iVSDWeight              , 1             , "View Synthesis Distortion estimate weight" )
    777   ("DWeight",                         m_iDWeight                , 1             , "Depth Distortion weight" )
    778 
    779 #endif //HHI_VSO
    780   ("QTL",                             m_bUseQTL                 , true          , "Use depth quad tree limitation (encoder only)" )
    781 
    782   ("IvMvPredFlag"          , m_ivMvPredFlag          , std::vector< Bool >(2,true)                    , "Inter-view motion prediction"              )
    783   ("IvMvScalingFlag"       , m_ivMvScalingFlag       , std::vector< Bool >(2,true)                    , "Inter-view motion vector scaling"          )
    784   ("Log2SubPbSizeMinus3"   , m_log2SubPbSizeMinus3   , 0                                              , "Log2 minus 3 of sub Pb size"               )
    785   ("IvResPredFlag"         , m_ivResPredFlag         , true                                           , "Inter-view residual prediction"            )
    786   ("DepthRefinementFlag"   , m_depthRefinementFlag   , true                                           , "Depth to refine disparity"                 )
    787   ("ViewSynthesisPredFlag" , m_viewSynthesisPredFlag , true                                           , "View synthesis prediction"                 )
    788   ("DepthBasedBlkPartFlag" , m_depthBasedBlkPartFlag , true                                           , "Depth base block partitioning"             )
    789   ("MpiFlag"               , m_mpiFlag               , true                                           , "Motion inheritance from texture to depth"  )
    790   ("Log2MpiSubPbSizeMinus3", m_log2MpiSubPbSizeMinus3, 0                                              , "Log2 minus 3 of sub Pb size for MPI"       )
    791   ("IntraContourFlag"      , m_intraContourFlag      , true                                           , "Intra contour mode"                        )
    792   ("IntraWedgeFlag"        , m_intraWedgeFlag        , true                                           , "Intra wedge mode and segmental depth DCs"  )
    793   ("IntraSdcFlag"          , m_intraSdcFlag          , true                                           , "Intra depth DCs"                           )
    794   ("QtPredFlag"            , m_qtPredFlag            , true                                           , "Quad tree prediction from texture to depth")
    795   ("InterSdcFlag"          , m_interSdcFlag          , true                                           , "Inter depth DCs"                           )
    796 #if SEC_DEPTH_INTRA_SKIP_MODE_K0033
    797   ("DepthIntraSkip"        , m_depthIntraSkipFlag    , true                                           , "Depth intra skip mode"                     )
    798 #else
    799   ("IntraSingleFlag"       , m_intraSingleFlag       , true                                           , "Intra single mode"                         )
    800 #endif
    801 #endif //H_3D
    802716  ;
    803717
     
    1047961  xResizeVector( m_auxId );
    1048962
    1049 #if H_3D
    1050   xResizeVector( m_depthFlag );
    1051 #endif
    1052963  xResizeVector( m_fQP );
    1053964
     
    11951106  if( cfg_profiles.empty() )
    11961107  {
    1197 #if H_3D
    1198     cfg_profiles = string("main main 3d-main");
    1199 #else
    12001108    cfg_profiles = string("main main multiview-main");   
    1201 #endif
    12021109    fprintf(stderr, "\nWarning: No profiles given, using defaults: %s", cfg_profiles.c_str() );
    12031110    anyEmpty = true;
     
    12381145  xReadStrToEnum( cfg_tiers ,   m_levelTier );
    12391146#endif
    1240 #if H_3D
     1147  // check validity of input parameters
     1148  xCheckParameter();
     1149
    12411150  // set global varibles
    12421151  xSetGlobal();
    1243 #if H_3D_VSO
    1244 // Table base optimization
    1245   // Q&D
    1246   Double adLambdaScaleTable[] =
    1247   {  0.031250, 0.031639, 0.032029, 0.032418, 0.032808, 0.033197, 0.033586, 0.033976, 0.034365, 0.034755,
    1248      0.035144, 0.035533, 0.035923, 0.036312, 0.036702, 0.037091, 0.037480, 0.037870, 0.038259, 0.038648,
    1249      0.039038, 0.039427, 0.039817, 0.040206, 0.040595, 0.040985, 0.041374, 0.041764, 0.042153, 0.042542,
    1250      0.042932, 0.043321, 0.043711, 0.044100, 0.044194, 0.053033, 0.061872, 0.070711, 0.079550, 0.088388,
    1251      0.117851, 0.147314, 0.176777, 0.235702, 0.294628, 0.353553, 0.471405, 0.589256, 0.707107, 0.707100,
    1252      0.753550, 0.800000 
    1253   };
    1254   if ( m_bUseVSO && m_bVSOLSTable )
    1255   {
    1256     Int firstDepthLayer = -1;
    1257     for (Int layer = 0; layer < m_numberOfLayers; layer++ )
    1258     {
    1259       if ( m_depthFlag[ layer ])
    1260       {
    1261         firstDepthLayer = layer;
    1262         break;
    1263       }
    1264     }
    1265     AOT( firstDepthLayer == -1 );
    1266     AOT( (m_iQP[firstDepthLayer] < 0) || (m_iQP[firstDepthLayer] > 51));
    1267     m_dLambdaScaleVSO *= adLambdaScaleTable[m_iQP[firstDepthLayer]];
    1268   }
    1269 #endif
    1270 #if H_3D_VSO
    1271 if ( m_bUseVSO && m_uiVSOMode == 4)
    1272 {
    1273   m_cRenModStrParser.setString( m_iNumberOfViews, m_pchVSOConfig );
    1274   m_cCameraData     .init     ( ((UInt) m_iNumberOfViews ),
    1275                                       g_bitDepthY,
    1276                                 (UInt)m_iCodedCamParPrecision,
    1277                                       m_FrameSkip,
    1278                                 (UInt)m_framesToBeEncoded,
    1279                                       m_pchCameraParameterFile,
    1280                                       m_pchBaseViewCameraNumbers,
    1281                                       NULL,
    1282                                       m_cRenModStrParser.getSynthViews(),
    1283                                       LOG2_DISP_PREC_LUT );
    1284 }
    1285 else if ( m_bUseVSO && m_uiVSOMode != 4 )
    1286 {
    1287   m_cCameraData     .init     ( ((UInt) m_iNumberOfViews ),
    1288                                       g_bitDepthY,
    1289                                 (UInt)m_iCodedCamParPrecision,
    1290                                       m_FrameSkip,
    1291                                 (UInt)m_framesToBeEncoded,
    1292                                       m_pchCameraParameterFile,
    1293                                       m_pchBaseViewCameraNumbers,
    1294                                       m_pchVSOConfig,
    1295                                       NULL,
    1296                                       LOG2_DISP_PREC_LUT );
    1297 }
    1298 else
    1299 {
    1300   m_cCameraData     .init     ( ((UInt) m_iNumberOfViews ),
    1301     g_bitDepthY,
    1302     (UInt) m_iCodedCamParPrecision,
    1303     m_FrameSkip,
    1304     (UInt) m_framesToBeEncoded,
    1305     m_pchCameraParameterFile,
    1306     m_pchBaseViewCameraNumbers,
    1307     NULL,
    1308     NULL,
    1309     LOG2_DISP_PREC_LUT );
    1310 }
    1311 #else
    1312   m_cCameraData     .init     ( ((UInt) m_iNumberOfViews ),
    1313     g_bitDepthY,
    1314     (UInt) m_iCodedCamParPrecision,
    1315     m_FrameSkip,
    1316     (UInt) m_framesToBeEncoded,
    1317     m_pchCameraParameterFile,
    1318     m_pchBaseViewCameraNumbers,
    1319     NULL,
    1320     NULL,
    1321     LOG2_DISP_PREC_LUT );
    1322 #endif
    1323   m_cCameraData.check( false, true );
    1324 #endif
    1325   // check validity of input parameters
    1326   xCheckParameter();
    1327 
    1328 #if !H_3D
    1329   // set global varibles
    1330   xSetGlobal();
    1331 #endif
    13321152 
    13331153  // print-out parameters
     
    13831203  xConfirmPara( (m_layerIdInNuh.size()!=1) && (m_layerIdInNuh.size() < m_numberOfLayers) , "LayerIdInNuh must be given for all layers. ");
    13841204 
    1385 #if H_3D
    1386   xConfirmPara( m_scalabilityMask != 2 && m_scalabilityMask != 3, "Scalability Mask must be equal to 2 or 3. ");
    1387 #else
    13881205  xConfirmPara( m_scalabilityMask != 2 && m_scalabilityMask != 8 && m_scalabilityMask != 10, "Scalability Mask must be equal to 2, 8 or 10");
    1389 #endif
    1390 
    1391 #if H_3D
    1392   if ( m_scalabilityMask & ( 1 << DEPTH_ID ) )
    1393   {
    1394     m_dimIds.push_back( m_depthFlag );
    1395   }
    1396 #endif
     1206
    13971207
    13981208  m_dimIds.push_back( m_viewOrderIndex );   
     
    14611271     xConfirmPara( allEqual , "Each layer shall have a different position in scalability space." );
    14621272
    1463 #if !H_3D_FCO
    14641273     if ( numDiff  == 1 )
    14651274     {
     
    14721281       xConfirmPara( shallBeButIsNotIncreasing,  "DimensionIds shall be increasing within one dimension. " );
    14731282     }
    1474 #endif
    14751283   }
    14761284 }
     
    15591367    {
    15601368      xConfirmPara( m_directRefLayers[i][j] < 0 || m_directRefLayers[i][j] >= i , "Reference layer id shall be greater than or equal to 0 and less than dependent layer id");
    1561 #if H_3D_DIRECT_DEP_TYPE
    1562       xConfirmPara( m_dependencyTypes[i][j] < 0 || m_dependencyTypes[i][j] >  6 , "Dependency type shall be greater than or equal to 0 and less than 7");
    1563 #else
    15641369      xConfirmPara( m_dependencyTypes[i][j] < 0 || m_dependencyTypes[i][j] >  2 , "Dependency type shall be greater than or equal to 0 and less than 3");
    1565 #endif
    15661370    }       
    15671371  } 
     
    16461450  xConfirmPara(  m_maxNumMergeCand > 5,  "MaxNumMergeCand must be 5 or smaller.");
    16471451
    1648 #if H_3D_ARP
    1649 #endif
    1650 #if H_3D_SPIVMP
    1651   xConfirmPara( m_log2SubPbSizeMinus3 < 0,                                        "Log2SubPbSizeMinus3 must be equal to 0 or greater.");
    1652   xConfirmPara( m_log2SubPbSizeMinus3 > 3,                                        "Log2SubPbSizeMinus3 must be equal to 3 or smaller.");
    1653   xConfirmPara( (1<< ( m_log2SubPbSizeMinus3 + 3) ) > m_uiMaxCUWidth,              "Log2SubPbSizeMinus3 must be  equal to log2(maxCUSize)-3 or smaller.");
    1654  
    1655   xConfirmPara( m_log2MpiSubPbSizeMinus3 < 0,                                        "Log2MpiSubPbSizeMinus3 must be equal to 0 or greater.");
    1656   xConfirmPara( m_log2MpiSubPbSizeMinus3 > 3,                                        "Log2MpiSubPbSizeMinus3 must be equal to 3 or smaller.");
    1657   xConfirmPara( (1<< (m_log2MpiSubPbSizeMinus3 + 3)) > m_uiMaxCUWidth,               "Log2MpiSubPbSizeMinus3 must be equal to log2(maxCUSize)-3 or smaller.");
    1658 #endif
    16591452#if ADAPTIVE_QP_SELECTION
    16601453#if H_MV
     
    17131506  }
    17141507
    1715 #if H_3D
    1716   xConfirmPara( m_pchCameraParameterFile    == 0                ,   "CameraParameterFile must be given");
    1717   xConfirmPara( m_pchBaseViewCameraNumbers  == 0                ,   "BaseViewCameraNumbers must be given" );
    1718 #if BUG_FIX_TK65
    1719 #if HHI_CAM_PARA_K0052
    1720   xConfirmPara( m_iNumberOfViews != m_cCameraData.getBaseViewNumbers().size() ,   "Number of Views in BaseViewCameraNumbers must be equal to NumberOfViews" );
    1721 #else
    1722   xConfirmPara( ( ((UInt) m_numberOfLayers >> 1 ) != m_cCameraData.getBaseViewNumbers().size() ) && ( m_numberOfLayers != m_cCameraData.getBaseViewNumbers().size() ),   "Number of Views in BaseViewCameraNumbers must be equal to NumberOfViews" );
    1723 #endif
    1724 #else
    1725   xConfirmPara( ((UInt) m_numberOfLayers >> 1 ) != m_cCameraData.getBaseViewNumbers().size(),   "Number of Views in BaseViewCameraNumbers must be equal to NumberOfViews" );
    1726 #endif
    1727   xConfirmPara    ( m_iCodedCamParPrecision < 0 || m_iCodedCamParPrecision > 5,       "CodedCamParsPrecision must be in range of 0..5" );
    1728 #if H_3D_VSO
    1729     if( m_bUseVSO )
    1730     {
    1731       xConfirmPara(   m_pchVSOConfig            == 0                             ,   "VSO Setup string must be given");
    1732       xConfirmPara( m_uiVSOMode > 4 ,                                                "VSO Mode must be less than 5");
    1733     }
    1734 #endif
    1735 #endif
    17361508  // max CU width and height should be power of 2
    17371509  UInt ui = m_uiMaxCUWidth;
     
    24422214  xPrintParaVector( "AuxId", m_auxId );
    24432215#endif
    2444 #if H_3D
    2445   xPrintParaVector( "DepthFlag", m_depthFlag );
    2446   printf("Coded Camera Param. Precision: %d\n", m_iCodedCamParPrecision);
    2447 #endif
    24482216#if H_MV 
    24492217  xPrintParaVector( "QP"               , m_fQP                );
     
    25292297  }
    25302298  printf("Max Num Merge Candidates     : %d\n", m_maxNumMergeCand);
    2531 #if H_3D
    2532   printf("BaseViewCameraNumbers        : %s\n", m_pchBaseViewCameraNumbers );
    2533   printf("Coded Camera Param. Precision: %d\n", m_iCodedCamParPrecision);
    2534 #if H_3D_VSO
    2535   printf("Force use of Lambda Scale    : %d\n", m_bForceLambdaScaleVSO );
    2536 
    2537   if ( m_bUseVSO )
    2538   {   
    2539     printf("VSO Lambda Scale             : %5.2f\n", m_dLambdaScaleVSO );
    2540     printf("VSO Mode                     : %d\n",    m_uiVSOMode       );
    2541     printf("VSO Config                   : %s\n",    m_pchVSOConfig    );
    2542     printf("VSO Negative Distortion      : %d\n",    m_bAllowNegDist ? 1 : 0);
    2543     printf("VSO LS Table                 : %d\n",    m_bVSOLSTable ? 1 : 0);
    2544     printf("VSO Estimated VSD            : %d\n",    m_bUseEstimatedVSD ? 1 : 0);
    2545     printf("VSO Early Skip               : %d\n",    m_bVSOEarlySkip ? 1 : 0);   
    2546     if ( m_bUseWVSO )
    2547     printf("Dist. Weights (VSO/VSD/SAD)  : %d/%d/%d\n ", m_iVSOWeight, m_iVSDWeight, m_iDWeight );
    2548   }
    2549 #endif //HHI_VSO
    2550 #endif //H_3D
    25512299  printf("\n");
    25522300#if H_MV
     
    26062354  printf(" SignBitHidingFlag:%d ", m_signHideFlag);
    26072355  printf("RecalQP:%d ", m_recalculateQPAccordingToLambda ? 1 : 0 );
    2608 #if H_3D_VSO
    2609   printf("VSO:%d ", m_bUseVSO   );
    2610   printf("WVSO:%d ", m_bUseWVSO ); 
    2611 #endif
    2612 #if H_3D
    2613   printf( "QTL:%d "                  , m_bUseQTL);
    2614   printf( "IlluCompEnable:%d "       , m_abUseIC);
    2615   printf( "IlluCompLowLatencyEnc:%d ",  m_bUseLowLatencyICEnc);
    2616   printf( "DLT:%d ", m_useDLT );
    2617 
    2618 
    2619   printf( "IvMvPred:%d %d "            , m_ivMvPredFlag[0] ? 1 : 0, m_ivMvPredFlag[1]  ? 1 : 0);
    2620   printf( "IvMvScaling:%d %d "         , m_ivMvScalingFlag[0] ? 1 : 0 , m_ivMvScalingFlag[1]  ? 1 : 0);
    2621 
    2622   printf( "Log2SubPbSizeMinus3:%d "    , m_log2SubPbSizeMinus3            );
    2623   printf( "IvResPred:%d "              , m_ivResPredFlag          ? 1 : 0 );
    2624   printf( "DepthRefinement:%d "        , m_depthRefinementFlag    ? 1 : 0 );
    2625   printf( "ViewSynthesisPred:%d "      , m_viewSynthesisPredFlag  ? 1 : 0 );
    2626   printf( "DepthBasedBlkPart:%d "      , m_depthBasedBlkPartFlag  ? 1 : 0 );
    2627   printf( "Mpi:%d "                    , m_mpiFlag                ? 1 : 0 );
    2628   printf( "Log2MpiSubPbSizeMinus3:%d " , m_log2MpiSubPbSizeMinus3         );
    2629   printf( "IntraContour:%d "           , m_intraContourFlag       ? 1 : 0 );
    2630   printf( "IntraWedge:%d "             , m_intraWedgeFlag         ? 1 : 0 );
    2631   printf( "IntraSdc:%d "               , m_intraSdcFlag           ? 1 : 0 );
    2632   printf( "QtPred:%d "                 , m_qtPredFlag             ? 1 : 0 );
    2633   printf( "InterSdc:%d "               , m_interSdcFlag           ? 1 : 0 );
    2634 #if SEC_DEPTH_INTRA_SKIP_MODE_K0033
    2635   printf( "DepthIntraSkip:%d "         , m_depthIntraSkipFlag     ? 1 : 0 );
    2636 #else
    2637   printf( "IntraSingle:%d "            , m_intraSingleFlag        ? 1 : 0 );
    2638 #endif
    2639 #endif
    26402356
    26412357  printf("\n\n"); 
  • branches/HTM-14.0-MV-draft-3/source/App/TAppEncoder/TAppEncCfg.h

    r1179 r1191  
    4444#include <sstream>
    4545#include <vector>
    46 #if H_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 H_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 H_3D_IC
    136   Bool   m_abUseIC;
    137   Bool   m_bUseLowLatencyICEnc;
    138 #endif
    139127
    140128#endif
     
    437425  Bool              m_outputVpsInfo;
    438426#endif
    439 #if H_3D
    440   // Camera parameters
    441   Char*     m_pchCameraParameterFile;                         ///< camera parameter file
    442   Char*     m_pchBaseViewCameraNumbers;
    443   TAppComCamPara m_cCameraData;
    444   Int       m_iCodedCamParPrecision;                          ///< precision for coding of camera parameters
    445 #if H_3D_VSO
    446   Char*     m_pchVSOConfig;
    447   Bool      m_bUseVSO;                                    ///< flag for using View Synthesis Optimization
    448   Bool      m_bVSOLSTable;                                ///< Depth QP dependent Lagrange parameter optimization (m23714)
    449   Bool      m_bVSOEarlySkip;                              ///< Early skip of VSO computation (JCT3V-A0093 modification 4)
    450 
    451   //// Used for development by GT, might be removed later
    452   Double    m_dLambdaScaleVSO;                            ///< Scaling factor for Lambda in VSO mode
    453   Bool      m_bForceLambdaScaleVSO;                       ///< Use Lambda Scale for depth even if VSO is turned off
    454   Bool      m_bAllowNegDist;                              ///< Allow negative distortion in VSO
    455   UInt      m_uiVSOMode;                                  ///< Number of VSO Mode, 1 = , 2 = simple, org vs. ren, 3 = simple, ren vs. ren, 4 = full 
    456 
    457   // SAIT_VSO_EST_A0033
    458   Bool      m_bUseEstimatedVSD;                           ///< Flag for using model based VSD estimation instead of VSO for some encoder decisions (JCT3V-A0033 modification 3) 
    459 
    460   // LGE_WVSO_A0119
    461   Bool      m_bUseWVSO;                                    ///< flag for using View Synthesis Optimization 
    462   Int       m_iVSOWeight;
    463   Int       m_iVSDWeight;
    464   Int       m_iDWeight;
    465 
    466   // Ren Model String
    467   TRenModSetupStrParser       m_cRenModStrParser;
    468 #endif
    469 #if H_3D_DIM
    470   Bool      m_useDLT;                                        ///< flag for using DLT
    471 #endif
    472 #if H_3D_QTLPC
    473   Bool      m_bUseQTL;                                        ///< flag for using depth QuadTree Limitation
    474 #endif
    475 
    476   std::vector< Bool >    m_ivMvPredFlag;
    477   std::vector< Bool >    m_ivMvScalingFlag;
    478   Int                    m_log2SubPbSizeMinus3;
    479   Bool                   m_ivResPredFlag;
    480   Bool                   m_depthRefinementFlag;
    481   Bool                   m_viewSynthesisPredFlag;
    482   Bool                   m_depthBasedBlkPartFlag;
    483   Bool                   m_mpiFlag;
    484   Int                    m_log2MpiSubPbSizeMinus3;
    485   Bool                   m_intraContourFlag;
    486   Bool                   m_intraWedgeFlag;
    487   Bool                   m_intraSdcFlag;
    488   Bool                   m_qtPredFlag;
    489   Bool                   m_interSdcFlag;
    490 #if SEC_DEPTH_INTRA_SKIP_MODE_K0033
    491   Bool                   m_depthIntraSkipFlag;
    492 #else
    493   Bool                   m_intraSingleFlag;
    494 #endif
    495 #endif
    496427  // internal member functions
    497428  Void  xSetGlobal      ();                                   ///< set global variables
  • branches/HTM-14.0-MV-draft-3/source/App/TAppEncoder/TAppEncTop.cpp

    r1179 r1191  
    8686#endif
    8787 
    88 #if H_3D
    89   vps.createCamPars(m_iNumberOfViews);
    90   TComDLT& dlt = m_dlt;
    91 #endif
    9288
    9389#if H_MV
     
    139135  xSetDpbSize              ( vps );
    140136  xSetVPSVUI               ( vps );
    141 #if H_3D
    142 #if HHI_CAM_PARA_K0052
    143   xSetCamPara              ( vps );
    144 #endif
    145 #endif
    146 #if H_3D
    147   m_ivPicLists.setVPS      ( &vps );
    148   xDeriveDltArray          ( vps, dlt );
    149 #endif
    150137  if ( m_targetEncLayerIdList.size() == 0 )
    151138  {
     
    178165  }
    179166
    180 #if H_3D
    181   // Set 3d tool parameters
    182 
    183   for (Int d = 0; d < 2; d++)
    184   { 
    185     m_sps3dExtension.setIvMvPredFlag          ( d, m_ivMvPredFlag[d]       );
    186     m_sps3dExtension.setIvMvScalingFlag       ( d, m_ivMvScalingFlag[d]    );
    187     if (d == 0 )
    188     {   
    189       m_sps3dExtension.setLog2SubPbSizeMinus3   ( d, m_log2SubPbSizeMinus3   );
    190       m_sps3dExtension.setIvResPredFlag         ( d, m_ivResPredFlag         );
    191       m_sps3dExtension.setDepthRefinementFlag   ( d, m_depthRefinementFlag   );
    192       m_sps3dExtension.setViewSynthesisPredFlag ( d, m_viewSynthesisPredFlag );
    193       m_sps3dExtension.setDepthBasedBlkPartFlag ( d, m_depthBasedBlkPartFlag );
    194     }
    195     else
    196     {   
    197       m_sps3dExtension.setMpiFlag               ( d, m_mpiFlag               );
    198       m_sps3dExtension.setLog2MpiSubPbSizeMinus3( d, m_log2MpiSubPbSizeMinus3);
    199       m_sps3dExtension.setIntraContourFlag      ( d, m_intraContourFlag      );
    200       m_sps3dExtension.setIntraSdcWedgeFlag     ( d, m_intraSdcFlag || m_intraWedgeFlag     );
    201       m_sps3dExtension.setQtPredFlag            ( d, m_qtPredFlag            );
    202       m_sps3dExtension.setInterSdcFlag          ( d, m_interSdcFlag          );
    203 #if SEC_DEPTH_INTRA_SKIP_MODE_K0033
    204       m_sps3dExtension.setDepthIntraSkipFlag    ( d, m_depthIntraSkipFlag    ); 
    205 #else
    206       m_sps3dExtension.setIntraSingleFlag       ( d, m_intraSingleFlag       ); 
    207 #endif
    208     }
    209   }
    210 #endif
    211167  for(Int layerIdInVps = 0; layerIdInVps < m_numberOfLayers; layerIdInVps++)
    212168  {
     
    224180    m_cTEncTop.setViewId                       ( vps.getViewId      (  layerId ) );
    225181    m_cTEncTop.setViewIndex                    ( vps.getViewIndex   (  layerId ) );
    226 #if H_3D
    227     Bool isDepth = ( vps.getDepthId     ( layerId ) != 0 ) ;
    228     m_cTEncTop.setIsDepth                      ( isDepth );
    229     //====== Camera Parameters =========
    230     m_cTEncTop.setCameraParameters             ( &m_cCameraData );     
    231 #if !HHI_CAM_PARA_K0052
    232     m_cTEncTop.setCamParPrecision              ( m_cCameraData.getCamParsCodedPrecision  () );
    233     m_cTEncTop.setCamParInSliceHeader          ( m_cCameraData.getVaryingCameraParameters() );
    234 
    235     m_cTEncTop.setCodedScale                   ( m_cCameraData.getCodedScale             () );
    236     m_cTEncTop.setCodedOffset                  ( m_cCameraData.getCodedOffset            () );
    237 #endif
    238 #if H_3D_VSO
    239     //====== VSO =========
    240     m_cTEncTop.setRenderModelParameters        ( &m_cRenModStrParser );
    241     m_cTEncTop.setForceLambdaScaleVSO          ( isDepth ? m_bForceLambdaScaleVSO : false );
    242     m_cTEncTop.setLambdaScaleVSO               ( isDepth ? m_dLambdaScaleVSO      : 1     );
    243     m_cTEncTop.setVSOMode                      ( isDepth ? m_uiVSOMode            : 0     );
    244 
    245     m_cTEncTop.setAllowNegDist                 ( isDepth ? m_bAllowNegDist        : false );
    246 
    247     // SAIT_VSO_EST_A0033
    248     m_cTEncTop.setUseEstimatedVSD              ( isDepth ? m_bUseEstimatedVSD     : false );
    249 
    250     // LGE_WVSO_A0119
    251     m_cTEncTop.setUseWVSO                      ( isDepth ? m_bUseWVSO             : false );   
    252     m_cTEncTop.setVSOWeight                    ( isDepth ? m_iVSOWeight           : 0     );
    253     m_cTEncTop.setVSDWeight                    ( isDepth ? m_iVSDWeight           : 0     );
    254     m_cTEncTop.setDWeight                      ( isDepth ? m_iDWeight             : 0     );
    255 #endif // H_3D_VSO
    256 #if H_3D_IC
    257     m_cTEncTop.setUseIC                        ( vps.getViewIndex( layerId ) == 0 || isDepth ? false : m_abUseIC );
    258     m_cTEncTop.setUseICLowLatencyEnc           ( m_bUseLowLatencyICEnc );
    259 #endif
    260 
    261    
    262     m_cTEncTop.setUseDMM                       ( isDepth ? m_intraWedgeFlag   : false );
    263     m_cTEncTop.setUseSDC                       ( isDepth ? m_intraSdcFlag     : false );
    264     m_cTEncTop.setUseDLT                       ( isDepth ? m_useDLT   : false );
    265     m_cTEncTop.setUseQTL                       ( isDepth ? m_bUseQTL  : false );
    266 
    267 
    268   m_cTEncTop.setSps3dExtension                 ( m_sps3dExtension );
    269 #endif // H_3D
    270182
    271183    m_cTEncTop.setIvPicLists                   ( &m_ivPicLists );
     
    273185  m_cTEncTop.setVPS(&vps);
    274186
    275 #if H_3D
    276   m_cTEncTop.setDLT(&dlt);
    277 #endif
    278187
    279188#if H_MV
     
    651560  }
    652561#endif
    653 #if H_3D_ANNEX_SELECTION_FIX
    654 #if H_3D
    655  /// SET Profiles
    656   for(Int layerIdInVps = 0; layerIdInVps < m_numberOfLayers; layerIdInVps++)
    657   {
    658     Int profileIdc = -1;
    659     for (Int olsIdx = 0; olsIdx < vps.getNumOutputLayerSets(); olsIdx++ )
    660     {   
    661       Int lsIdx = vps.olsIdxToLsIdx( olsIdx );
    662       for(Int i = 0; i < vps.getNumLayersInIdList( lsIdx ); i++ )
    663       {
    664         if( vps.getLayerIdInNuh( layerIdInVps) == vps.getLayerSetLayerIdList(lsIdx, i) )
    665         {
    666           Int ptlIdx = vps.getProfileTierLevelIdx( olsIdx, i );
    667           if ( ptlIdx != -1 )
    668           {
    669             Int curProfileIdc = vps.getPTL(ptlIdx)->getGeneralPTL()->getProfileIdc();
    670             if (profileIdc == -1)   
    671             {
    672               profileIdc = curProfileIdc;
    673             }
    674             else
    675             {   
    676               if ( profileIdc != curProfileIdc )
    677               {             
    678                 fprintf(stderr, "Error: ProfileIdc for layer with index %d in VPS not equal in all OLSs. \n", layerIdInVps );
    679                 exit(EXIT_FAILURE);
    680               }
    681             }
    682           }
    683         }
    684       }
    685     }
    686     if (profileIdc == -1 )
    687     {
    688       fprintf(stderr, "Error: No profile given for layer with index %d in VPS not equal in all OLS. \n", layerIdInVps );
    689       exit(EXIT_FAILURE);
    690     }
    691     m_acTEncTopList[ layerIdInVps ]->setProfileIdc( profileIdc );
    692   }
    693 #endif
    694 #endif
    695 #if H_3D_VSO
    696   if ( m_bUseVSO )
    697   {
    698     if ( m_uiVSOMode == 4 )
    699     {
    700 #if H_3D_VSO_EARLY_SKIP
    701       m_cRendererModel.create( m_cRenModStrParser.getNumOfBaseViews(), m_cRenModStrParser.getNumOfModels(), m_iSourceWidth, g_uiMaxCUHeight , LOG2_DISP_PREC_LUT, 0, m_bVSOEarlySkip );
    702 #else
    703       m_cRendererModel.create( m_cRenModStrParser.getNumOfBaseViews(), m_cRenModStrParser.getNumOfModels(), m_iSourceWidth, g_uiMaxCUHeight , LOG2_DISP_PREC_LUT, 0 );
    704 #endif
    705       for ( Int layer = 0; layer < m_numberOfLayers ; layer++ )
    706       {
    707         TEncTop* pcEncTop =  m_acTEncTopList[ layer ];
    708         Int iViewNum      = pcEncTop->getViewIndex();
    709         Int iContent      = pcEncTop->getIsDepth() ? 1 : 0;
    710         Int iNumOfModels  = m_cRenModStrParser.getNumOfModelsForView(iViewNum, iContent);
    711 
    712         Bool bUseVSO      = (iNumOfModels != 0);
    713 
    714         pcEncTop->setUseVSO( bUseVSO );
    715         pcEncTop->getRdCost()->setRenModel( bUseVSO ? &m_cRendererModel : NULL );
    716 
    717         for (Int iCurModel = 0; iCurModel < iNumOfModels; iCurModel++ )
    718         {
    719           Int iModelNum; Int iLeftViewNum; Int iRightViewNum; Int iDump; Int iOrgRefNum; Int iBlendMode;
    720 
    721           m_cRenModStrParser.getSingleModelData  ( iViewNum, iContent, iCurModel, iModelNum, iBlendMode, iLeftViewNum, iRightViewNum, iOrgRefNum, iDump ) ;
    722           m_cRendererModel  .createSingleModel   ( iViewNum, iContent, iModelNum, iLeftViewNum, iRightViewNum, (iOrgRefNum != -1), iBlendMode );
    723         }           
    724       }
    725     }
    726     else
    727     {
    728       AOT(true);
    729     }
    730   }
    731 #endif
    732562}
    733563
     
    737567  // initialize global variables
    738568  initROM();
    739 #if H_3D_DIM_DMM
    740   initWedgeLists( true );
    741 #endif
    742569
    743570  for( Int layer=0; layer < m_numberOfLayers; layer++)
     
    798625Void TAppEncTop::xInitLib(Bool isFieldCoding)
    799626{
    800 #if H_3D
    801 #if !HHI_CAM_PARA_K0052
    802   for ( Int viewIndex = 0; viewIndex < m_vps->getNumViews(); viewIndex++ )
    803   {
    804     m_vps->initCamParaVPS( viewIndex, true, m_cCameraData.getCamParsCodedPrecision(),
    805       m_cCameraData.getVaryingCameraParameters(), m_cCameraData.getCodedScale(), m_cCameraData.getCodedOffset() );
    806   }
    807 #endif
    808 #endif
    809627
    810628#if H_MV
     
    923741    for ( Int gopId=0; gopId < gopSize; gopId++ )
    924742    {
    925 #if H_3D
    926       UInt iNextPoc = m_acTEncTopList[0] -> getFrameId( gopId );
    927       if ( iNextPoc < m_framesToBeEncoded )
    928       {
    929         m_cCameraData.update( iNextPoc );
    930       }
    931 #endif
    932743      for(Int layer=0; layer < m_numberOfLayers; layer++ )
    933744      {
     
    937748        }
    938749
    939 #if H_3D_VSO       
    940           if( m_bUseVSO && m_bUseEstimatedVSD && iNextPoc < m_framesToBeEncoded )
    941           {
    942             m_cCameraData.setDispCoeff( iNextPoc, m_acTEncTopList[layer]->getViewIndex() );
    943             m_acTEncTopList[layer]  ->setDispCoeff( m_cCameraData.getDispCoeff() );
    944           }
    945 #endif
    946750
    947751        Int   iNumEncoded = 0;
     
    1025829  printRateSummary();
    1026830
    1027 #if H_3D_REN_MAX_DEV_OUT
    1028   Double dMaxDispDiff = m_cCameraData.getMaxShiftDeviation();
    1029 
    1030   if ( !(dMaxDispDiff < 0) )
    1031   { 
    1032     printf("\n Max. possible shift error: %12.3f samples.\n", dMaxDispDiff );
    1033   }
    1034 #endif
    1035831
    1036832  return;
     
    12861082}
    12871083
    1288 #if H_3D_DIM_DLT
    1289 Void TAppEncTop::xAnalyzeInputBaseDepth(UInt layer, UInt uiNumFrames, TComVPS* vps, TComDLT* dlt)
    1290 {
    1291   TComPicYuv*       pcDepthPicYuvOrg = new TComPicYuv;
    1292   // allocate original YUV buffer
    1293   pcDepthPicYuvOrg->create( m_iSourceWidth, m_iSourceHeight, m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth );
    1294  
    1295   TVideoIOYuv* depthVideoFile = new TVideoIOYuv;
    1296  
    1297   UInt uiMaxDepthValue = ((1 << g_bitDepthY)-1);
    1298  
    1299   Bool abValidDepths[256];
    1300  
    1301   depthVideoFile->open( m_pchInputFileList[layer], false, m_inputBitDepthY, m_inputBitDepthC, m_internalBitDepthY, m_internalBitDepthC );  // read  mode
    1302  
    1303   // initialize boolean array
    1304   for(Int p=0; p<=uiMaxDepthValue; p++)
    1305     abValidDepths[p] = false;
    1306  
    1307   Int iHeight   = pcDepthPicYuvOrg->getHeight();
    1308   Int iWidth    = pcDepthPicYuvOrg->getWidth();
    1309   Int iStride   = pcDepthPicYuvOrg->getStride();
    1310  
    1311   Pel* pInDM    = pcDepthPicYuvOrg->getLumaAddr();
    1312  
    1313   for(Int uiFrame=0; uiFrame < uiNumFrames; uiFrame++ )
    1314   {
    1315     depthVideoFile->read( pcDepthPicYuvOrg, m_aiPad );
    1316    
    1317     // check all pixel values
    1318     for (Int i=0; i<iHeight; i++)
    1319     {
    1320       Int rowOffset = i*iStride;
    1321      
    1322       for (Int j=0; j<iWidth; j++)
    1323       {
    1324         Pel depthValue = pInDM[rowOffset+j];
    1325         abValidDepths[depthValue] = true;
    1326       }
    1327     }
    1328   }
    1329  
    1330   depthVideoFile->close();
    1331   delete depthVideoFile;
    1332  
    1333   pcDepthPicYuvOrg->destroy();
    1334   delete pcDepthPicYuvOrg;
    1335  
    1336   // convert boolean array to idx2Depth LUT
    1337   Int* aiIdx2DepthValue = (Int*) calloc(uiMaxDepthValue, sizeof(Int));
    1338   Int iNumDepthValues = 0;
    1339   for(Int p=0; p<=uiMaxDepthValue; p++)
    1340   {
    1341     if( abValidDepths[p] == true)
    1342     {
    1343       aiIdx2DepthValue[iNumDepthValues++] = p;
    1344     }
    1345   }
    1346  
    1347   if( uiNumFrames == 0 || numBitsForValue(iNumDepthValues) == g_bitDepthY )
    1348   {
    1349     dlt->setUseDLTFlag(layer, false);
    1350   }
    1351  
    1352   // assign LUT
    1353   if( dlt->getUseDLTFlag(layer) )
    1354   {
    1355     dlt->setDepthLUTs(layer, aiIdx2DepthValue, iNumDepthValues);
    1356   }
    1357  
    1358   // free temporary memory
    1359   free(aiIdx2DepthValue);
    1360 }
    1361 #endif
    13621084
    13631085#if H_MV
     
    13901112
    13911113
    1392 #if HHI_INTER_COMP_PRED_K0052
    1393 #if H_3D
    1394   vps.initViewCompLayer( );
    1395 #endif
    1396 #endif
    13971114}
    13981115
     
    14121129  Bool defaultDirectDependencyFlag = false;
    14131130
    1414 #if H_3D_DIRECT_DEP_TYPE
    1415   Int directDepTypeLenMinus2 = 0; 
    1416 #endif
    14171131  for( Int depLayer = 1; depLayer < m_numberOfLayers; depLayer++ )
    14181132  {
     
    14241138      vps.setDirectDependencyFlag( depLayer, refLayer, true);
    14251139      Int curDirectDependencyType = m_dependencyTypes[depLayer][i];
    1426 #if H_3D_DIRECT_DEP_TYPE       
    1427       directDepTypeLenMinus2 = std::max( directDepTypeLenMinus2, gCeilLog2( curDirectDependencyType + 1  ) - 2 ); 
    1428 #endif
    14291140      if ( defaultDirectDependencyType != -1 )   
    14301141      {
     
    14441155  vps.setDefaultDirectDependencyType( defaultDirectDependencyFlag ? defaultDirectDependencyType : -1 );       
    14451156
    1446 #if H_3D_DIRECT_DEP_TYPE       
    1447   assert( directDepTypeLenMinus2 <= 1 );
    1448   vps.setDirectDepTypeLenMinus2( directDepTypeLenMinus2 );
    1449 #endif
    14501157
    14511158
     
    14771184      Int curLayerIdInNuh = vps.getLayerIdInNuh( curLayerIdInVps );     
    14781185      Int maxTid = -1;
    1479 #if H_3D
    1480       if ( vps.getDirectDependencyFlag( curLayerIdInVps, refLayerIdInVps ) )
    1481       {
    1482         if ( m_depthFlag[ curLayerIdInVps] == m_depthFlag[ refLayerIdInVps ] )
    1483         {
    1484 #endif
    14851186          for( Int i = 0; i < ( getGOPSize() + 1); i++ )
    14861187          {       
     
    14891190            for (Int j = 0; j < geCur.m_numActiveRefLayerPics; j++)
    14901191            {
    1491 #if H_3D
    1492               if ( vps.getIdRefListLayer( curLayerIdInNuh, geCur.m_interLayerPredLayerIdc[ j ] ) == refLayerIdInNuh )
    1493 #else
    14941192              if ( vps.getIdDirectRefLayer( curLayerIdInNuh, geCur.m_interLayerPredLayerIdc[ j ] ) == refLayerIdInNuh )
    1495 #endif
    14961193              {
    1497 #if !HHI_INTER_COMP_PRED_K0052               
    14981194                Bool refAlwaysIntra = ( i == getGOPSize() ) && ( m_iIntraPeriod[ curLayerIdInVps ] % m_iIntraPeriod[ refLayerIdInVps ] == 0 );
    1499 #endif
    15001195                Bool refLayerZero   = ( i == getGOPSize() ) && ( refLayerIdInVps == 0 );
    1501 #if HHI_INTER_COMP_PRED_K0052
    1502                 // refAlwaysIntra actually not needed, since TemporalIds need to be aligned within an AU.
    1503                 // Thus, reference pictures of IRAP pictures have TemporalId equal to 0.
    1504                 maxTid = std::max( maxTid, refLayerZero ? 0 : geRef.m_temporalId );
    1505 #else
    15061196                maxTid = std::max( maxTid, ( refAlwaysIntra || refLayerZero ) ? 0 : geRef.m_temporalId );
    1507 #endif
    15081197              }
    15091198            }
    15101199          }             
    1511 #if H_3D
    1512         }
    1513         else
    1514         {       
    1515 #if HHI_INTER_COMP_PRED_K0052
    1516           if( m_depthFlag[ curLayerIdInVps ] && ( m_mpiFlag|| m_qtPredFlag || m_intraContourFlag ) )
    1517           {         
    1518             Int nuhLayerIdTex = vps.getLayerIdInNuh( vps.getViewIndex( curLayerIdInNuh ), false );
    1519             if ( nuhLayerIdTex == refLayerIdInNuh )
    1520             {
    1521               for( Int i = 0; i < ( getGOPSize() + 1); i++ )
    1522               {       
    1523                 GOPEntry geCur =  m_GOPListMvc[curLayerIdInVps][( i < getGOPSize()  ? i : MAX_GOP )];
    1524                 GOPEntry geRef =  m_GOPListMvc[refLayerIdInVps][( i < getGOPSize()  ? i : MAX_GOP )];
    1525                 if ( geCur.m_interCompPredFlag )
    1526                 {
    1527                   Bool refLayerZero   = ( i == getGOPSize() ) && ( refLayerIdInVps == 0 );
    1528                   maxTid = std::max( maxTid, refLayerZero ? 0 : geRef.m_temporalId );
    1529                 }
    1530               }
    1531             }
    1532           }
    1533           if( !m_depthFlag[ curLayerIdInVps ] && vps.getNumRefListLayers( curLayerIdInNuh) > 0  && ( m_depthRefinementFlag || m_viewSynthesisPredFlag || m_depthBasedBlkPartFlag ) )
    1534           {             
    1535             for( Int i = 0; i < ( getGOPSize() + 1); i++ )
    1536             {       
    1537               GOPEntry geCur =  m_GOPListMvc[curLayerIdInVps][( i < getGOPSize()  ? i : MAX_GOP )];
    1538               GOPEntry geRef =  m_GOPListMvc[refLayerIdInVps][( i < getGOPSize()  ? i : MAX_GOP )];
    1539 
    1540               if ( geCur.m_interCompPredFlag )
    1541               {
    1542                 for (Int j = 0; j < geCur.m_numActiveRefLayerPics; j++ )
    1543                 {
    1544                   Int nuhLayerIdDep = vps.getLayerIdInNuh( vps.getViewIndex( vps.getIdRefListLayer( curLayerIdInNuh, geCur.m_interLayerPredLayerIdc[j] ) ), true );
    1545                   if ( nuhLayerIdDep == refLayerIdInNuh )
    1546                   {
    1547                     Bool refLayerZero   = ( i == getGOPSize() ) && ( refLayerIdInVps == 0 );
    1548                     maxTid = std::max( maxTid, refLayerZero ? 0 : geRef.m_temporalId );
    1549                   }
    1550                 }
    1551               }
    1552             }
    1553           }       
    1554 #else
    1555           if( m_depthFlag[ curLayerIdInVps ] && ( m_mpiFlag|| m_qtPredFlag || m_intraContourFlag ) )
    1556           {         
    1557             Int nuhLayerIdTex = vps.getLayerIdInNuh( vps.getViewIndex( curLayerIdInNuh ), false );
    1558             if ( nuhLayerIdTex == refLayerIdInNuh )
    1559             {
    1560               maxTid = std::max( maxTid, vps.getSubLayersVpsMaxMinus1( refLayerIdInVps) + 1 );
    1561             }
    1562           }
    1563           if( !m_depthFlag[ curLayerIdInVps ] && vps.getNumRefListLayers( curLayerIdInNuh) > 0  && ( m_depthRefinementFlag || m_viewSynthesisPredFlag || m_depthBasedBlkPartFlag ) )
    1564           { 
    1565             Int maxPresentTid =-1;
    1566             Bool allPresent = true;
    1567             for (Int i = 0; i < vps.getNumRefListLayers( curLayerIdInNuh); i++ )
    1568             {
    1569               Int nuhLayerIdDep = vps.getLayerIdInNuh( vps.getViewIndex( vps.getIdRefListLayer(curLayerIdInNuh, i ) ), true );
    1570               if ( nuhLayerIdDep== refLayerIdInNuh )
    1571               {
    1572                 maxPresentTid= std::max( maxTid, vps.getSubLayersVpsMaxMinus1( refLayerIdInVps) + 1 );             
    1573               }
    1574               else
    1575               {
    1576                 allPresent = false;
    1577               }
    1578             }
    1579 
    1580             if ( allPresent )
    1581             {
    1582               maxTid= std::max( maxTid, maxPresentTid );             
    1583             }
    1584           }       
    1585 #endif
    1586         }
    1587       } // if ( vps.getDirectDependencyFlag( curLayerIdInVps, refLayerIdInVps ) )
    1588       vps.setMaxTidIlRefPicsPlus1( refLayerIdInVps, curLayerIdInVps, maxTid + 1 );
    1589 #endif
    15901200    }  // Loop curLayerIdInVps
    15911201  } // Loop refLayerIdInVps
     
    16361246     
    16371247      // check if all reference layers when allRefLayerActiveFlag is equal to 1 are reference layer pictures specified in the gop entry
    1638 #if H_3D
    1639       for (Int k = 0; k < vps.getNumRefListLayers( layerIdInNuh ) && allRefLayersActiveFlag; k++ )
    1640       {
    1641         Int refLayerIdInVps = vps.getLayerIdInVps( vps.getIdRefListLayer( layerIdInNuh , k ) );
    1642 #else
    16431248      for (Int k = 0; k < vps.getNumDirectRefLayers( layerIdInNuh ) && allRefLayersActiveFlag; k++ )
    16441249      {
    16451250        Int refLayerIdInVps = vps.getLayerIdInVps( vps.getIdDirectRefLayer( layerIdInNuh , k ) );
    1646 #endif
    16471251        if ( vps.getSubLayersVpsMaxMinus1(refLayerIdInVps) >= tId  && ( tId == 0 || vps.getMaxTidIlRefPicsPlus1(refLayerIdInVps,layerIdInVps) > tId )  )
    16481252        {
     
    16621266      {   
    16631267        Bool referenceLayerFoundFlag = false;
    1664 #if H_3D
    1665         for (Int k = 0; k < vps.getNumRefListLayers( layerIdInNuh ); k++ )
    1666         {
    1667           Int refLayerIdInVps = vps.getLayerIdInVps( vps.getIdRefListLayer( layerIdInNuh, k) );
    1668 #else
    16691268        for (Int k = 0; k < vps.getNumDirectRefLayers( layerIdInNuh ); k++ )
    16701269        {
    16711270          Int refLayerIdInVps = vps.getLayerIdInVps( vps.getIdDirectRefLayer( layerIdInNuh, k) );
    1672 #endif
    16731271          if ( vps.getSubLayersVpsMaxMinus1(refLayerIdInVps) >= tId  && ( tId == 0 || vps.getMaxTidIlRefPicsPlus1(refLayerIdInVps,layerIdInVps) > tId )  )
    16741272          {         
     
    17771375    break;
    17781376  case Profile::MULTIVIEWMAIN:
    1779 #if H_3D
    1780   case Profile::MAIN3D:
    1781 #endif
    17821377    ptl->setMax12bitConstraintFlag      ( true  );
    17831378    ptl->setMax12bitConstraintFlag      ( true  );
     
    18001395{
    18011396
    1802 #if H_3D_DISABLE_CHROMA
    1803   Bool anyDepth = false;
    1804   for ( Int i = 0; i < m_numberOfLayers; i++ )
    1805   {
    1806     vps.setVpsRepFormatIdx( i, m_depthFlag[ i ] ? 1 : 0 );
    1807     anyDepth = anyDepth || m_depthFlag[ i ];
    1808   } 
    1809 
    1810   vps.setRepFormatIdxPresentFlag( anyDepth );
    1811   vps.setVpsNumRepFormatsMinus1 ( anyDepth ? 1 : 0  );
    1812 
    1813   for ( Int j = 0; j <= vps.getVpsNumRepFormatsMinus1(); j++ )
    1814   {
    1815     TComRepFormat* repFormat = new TComRepFormat;
    1816 
    1817     repFormat->setBitDepthVpsChromaMinus8   ( g_bitDepthC - 8 );
    1818     repFormat->setBitDepthVpsLumaMinus8     ( g_bitDepthY - 8 );
    1819     repFormat->setChromaFormatVpsIdc        ( j == 1 ? CHROMA_400 : CHROMA_420 );
    1820     repFormat->setPicHeightVpsInLumaSamples ( m_iSourceHeight );
    1821     repFormat->setPicWidthVpsInLumaSamples  ( m_iSourceWidth  );   
    1822     repFormat->setChromaAndBitDepthVpsPresentFlag( true );   
    1823     // ToDo not supported yet.
    1824     //repFormat->setSeparateColourPlaneVpsFlag( );
    1825 #if H_MV_FIX_CONF_WINDOW
    1826     Bool conformanceWindowVpsFlag = ( m_confWinBottom != 0 ) || ( m_confWinRight != 0 ) || ( m_confWinTop != 0 ) || ( m_confWinBottom != 0 );
    1827     repFormat->setConformanceWindowVpsFlag( conformanceWindowVpsFlag );
    1828     if ( conformanceWindowVpsFlag )
    1829     {   
    1830       repFormat->setConfWinVpsLeftOffset    ( m_confWinLeft   / TComSPS::getWinUnitX( repFormat->getChromaFormatVpsIdc() ) );
    1831       repFormat->setConfWinVpsRightOffset   ( m_confWinRight  / TComSPS::getWinUnitX( repFormat->getChromaFormatVpsIdc() )  );
    1832       repFormat->setConfWinVpsTopOffset     ( m_confWinTop    / TComSPS::getWinUnitY( repFormat->getChromaFormatVpsIdc() )  );
    1833       repFormat->setConfWinVpsBottomOffset  ( m_confWinBottom / TComSPS::getWinUnitY( repFormat->getChromaFormatVpsIdc() ) );
    1834     }
    1835 #else
    1836     repFormat->setConformanceWindowVpsFlag( true );
    1837     repFormat->setConfWinVpsLeftOffset    ( m_confWinLeft   / TComSPS::getWinUnitX( repFormat->getChromaFormatVpsIdc() ) );
    1838     repFormat->setConfWinVpsRightOffset   ( m_confWinRight  / TComSPS::getWinUnitX( repFormat->getChromaFormatVpsIdc() )  );
    1839     repFormat->setConfWinVpsTopOffset     ( m_confWinTop    / TComSPS::getWinUnitY( repFormat->getChromaFormatVpsIdc() )  );
    1840     repFormat->setConfWinVpsBottomOffset  ( m_confWinBottom / TComSPS::getWinUnitY( repFormat->getChromaFormatVpsIdc() ) );
    1841 #endif
    1842     assert( vps.getRepFormat( j ) == NULL );
    1843     vps.setRepFormat( j , repFormat );
    1844   };
    1845 
    1846 
    1847 #else
    18481397  vps.setRepFormatIdxPresentFlag( false );
    18491398  vps.setVpsNumRepFormatsMinus1 ( 0    );
     
    18741423  assert( vps.getRepFormat( 0 ) == NULL );
    18751424  vps.setRepFormat( 0 , repFormat );
    1876 #endif
    18771425}
    18781426
     
    22501798}
    22511799
    2252 #if HHI_CAM_PARA_K0052
    2253 #if H_3D
    2254 Void TAppEncTop::xSetCamPara                ( TComVPS& vps )
    2255 {
    2256   vps.setCpPrecision( m_cCameraData.getCamParsCodedPrecision());
    2257 
    2258   for ( Int n = 1; n < vps.getNumViews(); n++ )
    2259   { 
    2260     Int i      = vps.getViewOIdxList( n );
    2261     Int iInVps = vps.getVoiInVps    ( i );
    2262     vps.setNumCp( iInVps,  n);   
    2263 
    2264     if ( vps.getNumCp( iInVps ) > 0 )
    2265     {
    2266       vps.setCpInSliceSegmentHeaderFlag( iInVps, m_cCameraData.getVaryingCameraParameters() );
    2267 
    2268       for( Int m = 0; m < vps.getNumCp( iInVps ); m++ )
    2269       {
    2270         vps.setCpRefVoi( iInVps, m, vps.getViewOIdxList( m ) );
    2271         if( !vps.getCpInSliceSegmentHeaderFlag( iInVps ) )
    2272         {
    2273           Int j = vps.getCpRefVoi( iInVps, m );
    2274           Int jInVps = vps.getVoiInVps( j );         
    2275 
    2276           vps.setVpsCpScale   ( iInVps, jInVps, m_cCameraData.getCodedScale() [ jInVps ][ iInVps ] ) ;
    2277           vps.setVpsCpInvScale( iInVps, jInVps, m_cCameraData.getCodedScale() [ iInVps ][ jInVps ] ) ;
    2278           vps.setVpsCpOff     ( iInVps, jInVps, m_cCameraData.getCodedOffset()[ jInVps ][ iInVps ] ) ;
    2279           vps.setVpsCpInvOff  ( iInVps, jInVps, m_cCameraData.getCodedOffset()[ iInVps ][ jInVps ] ) ;
    2280         }
    2281       }
    2282     }
    2283   }
    2284   vps.deriveCpPresentFlag();
    2285 }
    2286 #endif
    2287 #endif
    22881800
    22891801
     
    22971809
    22981810
    2299 #if H_3D
    2300 
    2301 Void TAppEncTop::xDeriveDltArray( TComVPS& vps, TComDLT& dlt )
    2302 {
    2303   Int  iNumDepthViews  = 0;
    2304   Bool bDltPresentFlag = false;
    2305 
    2306   for ( Int layer = 0; layer <= vps.getMaxLayersMinus1(); layer++ )
    2307   {
    2308     Bool isDepth = ( vps.getDepthId( layer ) == 1 );
    2309 
    2310     if ( isDepth )
    2311     {
    2312       iNumDepthViews++;
    2313     }
    2314 
    2315     dlt.setUseDLTFlag( layer , isDepth && m_useDLT );
    2316     if( dlt.getUseDLTFlag( layer ) )
    2317     {
    2318       xAnalyzeInputBaseDepth(layer, max(m_iIntraPeriod[layer], 24), &vps, &dlt);
    2319       bDltPresentFlag = bDltPresentFlag || dlt.getUseDLTFlag(layer);
    2320       dlt.setInterViewDltPredEnableFlag(layer, (dlt.getUseDLTFlag(layer) && (layer>1)));
    2321     }
    2322   }
    2323 
    2324   dlt.setDltPresentFlag( bDltPresentFlag );
    2325   dlt.setNumDepthViews ( iNumDepthViews  );
    2326 }
    2327 #endif
    23281811//! \}
  • branches/HTM-14.0-MV-draft-3/source/App/TAppEncoder/TAppEncTop.h

    r1179 r1191  
    4646#include "TLibCommon/AccessUnit.h"
    4747#include "TAppEncCfg.h"
    48 #if H_3D
    49 #include "../../Lib/TLibRenderer/TRenTop.h"
    50 #endif
    5148
    5249#if KWU_RC_MADPRED_E0227
     
    9087#endif
    9188
    92 #if H_3D
    93   TComDLT                    m_dlt;                         ///< dlt
    94   TComSps3dExtension         m_sps3dExtension;              ///< Currently all layers share the same sps 3D Extension 
    95 #endif
    9689
    9790  UInt m_essentialBytes;
    9891  UInt m_totalBytes;
    99 #if H_3D_VSO
    100   TRenTop                     m_cRendererTop;
    101   TRenModel                   m_cRendererModel;   
    102 #endif
    10392protected:
    10493  // initialization
     
    142131  Void xSetDpbSize                ( TComVPS& vps );
    143132  Void xSetVPSVUI                 ( TComVPS& vps );
    144 #if HHI_CAM_PARA_K0052
    145 #if H_3D
    146   Void xSetCamPara                ( TComVPS& vps );
    147 #endif
    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 H_3D
    154   Void xDeriveDltArray( TComVPS& vps, TComDLT& dlt );
    155 #endif
    156 #if H_3D_DIM_DLT
    157   Void  xAnalyzeInputBaseDepth(UInt layer, UInt uiNumFrames, TComVPS* vps, TComDLT* dlt);
    158136#endif
    159137public:
  • branches/HTM-14.0-MV-draft-3/source/App/TAppRenderer/RendererMain.cpp

    r1179 r1191  
    3535#include <time.h>
    3636#include "../../Lib/TLibCommon/TypeDef.h"
    37 #if H_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 // H_3D
    9245
  • branches/HTM-14.0-MV-draft-3/source/App/TAppRenderer/TAppRendererCfg.cpp

    r1179 r1191  
    4444#include "../../Lib/TAppCommon/program_options_lite.h"
    4545
    46 #if H_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_inputBitDepthY,                     8, "Bit-depth of input file")
    134     ("OutputBitDepth",          m_outputBitDepthY,                    0, "Bit-depth of output file (default:InternalBitDepth)")
    135     ("InternalBitDepth",        m_internalBitDepthY,                  0, "Bit-depth the renderer operates at. (default:InputBitDepth)"                                                                          "If different to InputBitDepth, source data will be converted")
    136 
    137     ("InputBitDepthC",        m_inputBitDepthC,    0, "As per InputBitDepth but for chroma component. (default:InputBitDepth)")
    138     ("OutputBitDepthC",       m_outputBitDepthC,   0, "As per OutputBitDepth but for chroma component. (default:InternalBitDepthC)")
    139     ("InternalBitDepthC",     m_internalBitDepthC, 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_internalBitDepthY) { m_internalBitDepthY = m_inputBitDepthY; }
    189   if (!m_internalBitDepthC) { m_internalBitDepthC = m_internalBitDepthY; }
    190   if (!m_inputBitDepthC)    { m_inputBitDepthC    = m_inputBitDepthY; }
    191   if (!m_outputBitDepthY)   { m_outputBitDepthY   = m_internalBitDepthY; }
    192   if (!m_outputBitDepthC)   { m_outputBitDepthC   = m_internalBitDepthC; }
    193 
    194   xSetGlobal();
    195 
    196   UInt  uiInputBitDepth   = 8;
    197   UInt  uiCamParPrecision = 5;
    198 
    199   m_bUseSetupString = ( m_pchViewConfig != NULL ) && ( m_iRenderMode != 0);
    200 
    201   if ( m_iRenderMode == 10 )
    202   {
    203     m_cCameraData.init( MAX_INPUT_VIEW_NUM, uiInputBitDepth, uiCamParPrecision, (UInt)m_iFrameSkip, (UInt)m_iFramesToBeRendered,
    204       m_pchCameraParameterFile, m_pchBaseViewCameraNumbers, NULL, NULL, m_iLog2SamplingFactor+m_iShiftPrecision );
    205     m_iNumberOfInputViews  = (Int) m_cCameraData.getBaseViewNumbers() .size();
    206     m_iNumberOfOutputViews = m_iNumberOfInputViews - 1;
    207     m_iRenderDirection     = 1;
    208   }
    209   else
    210   {
    211   if ( m_bUseSetupString )
    212   {
    213     std::vector<Int>  iaTempViews;
    214     std::vector<Int>* piaTempViews;
    215     m_cCameraData     .convertNumberString( m_pchBaseViewCameraNumbers, iaTempViews, VIEW_NUM_PREC );
    216     m_cRenModStrParser.setString( (Int) iaTempViews.size(), m_pchViewConfig );
    217     piaTempViews               = m_cRenModStrParser.getSynthViews();
    218     m_iNumberOfOutputViews     = (Int) m_cRenModStrParser.getNumOfModels();
    219     m_iNumberOfInputViews      = (Int) m_cRenModStrParser.getNumOfBaseViews();
    220     m_bContOutputFileNumbering = true;
    221 
    222   m_cCameraData.init( MAX_INPUT_VIEW_NUM, uiInputBitDepth, uiCamParPrecision, (UInt)m_iFrameSkip, (UInt)m_iFramesToBeRendered,
    223       m_pchCameraParameterFile, m_pchBaseViewCameraNumbers, NULL, piaTempViews, m_iLog2SamplingFactor+m_iShiftPrecision );
    224   }
    225   else
    226   {
    227   m_cCameraData.init( MAX_INPUT_VIEW_NUM, uiInputBitDepth, uiCamParPrecision, (UInt)m_iFrameSkip, (UInt)m_iFramesToBeRendered,
    228       m_pchCameraParameterFile, m_pchBaseViewCameraNumbers, m_pchSynthViewCameraNumbers, NULL, m_iLog2SamplingFactor+m_iShiftPrecision );
    229   m_iNumberOfOutputViews = (Int) m_cCameraData.getSynthViewNumbers().size();
    230   m_iNumberOfInputViews  = (Int) m_cCameraData.getBaseViewNumbers() .size();
    231   }
    232   }
    233 
    234   if (m_pchSynthOutputFileBaseName != NULL)
    235     xConfirmParameter( strrchr(m_pchSynthOutputFileBaseName,'$')  == 0, "'$' must be a character in SynthOutputFileBaseName");
    236 
    237   if (m_pchDepthInputFileBaseName != NULL)
    238     xConfirmParameter( strrchr(m_pchDepthInputFileBaseName, '$')  == 0, "'$' must be a character in DepthInputFileBaseName" );
    239 
    240   if (m_pchVideoInputFileBaseName != NULL)
    241     xConfirmParameter( strrchr(m_pchVideoInputFileBaseName, '$')  == 0, "'$' must be a character in VideoInputFileBaseName" );
    242 
    243   xCreateFileNames();
    244 
    245   /*
    246   * check validity of input parameters
    247   */
    248   xCheckParameter();
    249   m_cCameraData.check( m_iRenderDirection == 0, m_iFramesToBeRendered != 0 );
    250 
    251   // print-out parameters
    252   xPrintParameter();
    253 
    254   return true;
    255 }
    256 
    257 
    258 // ====================================================================================================================
    259 // Private member functions
    260 // ====================================================================================================================
    261 
    262 Void TAppRendererCfg::xCheckParameter()
    263 {
    264   bool check_failed = false; /* abort if there is a fatal configuration problem */
    265 #define xConfirmPara(a,b) check_failed |= xConfirmParameter(a,b)
    266   // check range of parameters
    267 
    268   /// File I/O
    269 
    270   // source specification
    271   xConfirmPara( m_iSourceWidth        <= 0,                   "Source width  must be greater than 0" );
    272   xConfirmPara( m_iSourceHeight       <= 0,                   "Source height must be greater than 0" );
    273   xConfirmPara( m_iFrameSkip          <  0,                   "Frame Skipping must be more than or equal to 0" );
    274   xConfirmPara( m_iFramesToBeRendered <  0,                   "Total Number Of Frames rendered must be more than 1" );
    275 
    276   // bit depth
    277   xConfirmPara( m_internalBitDepthC != m_internalBitDepthY,  "InternalBitDepth for luma and chroma must be equal. ");
    278   xConfirmPara( m_inputBitDepthY < 8,                        "InputBitDepth must be at least 8" );
    279   xConfirmPara( m_inputBitDepthC < 8,                        "InputBitDepthC must be at least 8" );
    280 
    281   // camera specification
    282   xConfirmPara( m_iNumberOfInputViews  > MAX_INPUT_VIEW_NUM , "NumberOfInputViews must be less than of equal to MAX_INPUT_VIEW_NUM");
    283   xConfirmPara( m_iNumberOfOutputViews > MAX_OUTPUT_VIEW_NUM, "NumberOfOutputViews must be less than of equal to MAX_OUTPUT_VIEW_NUM");
    284 
    285 
    286   xConfirmPara( m_iRenderDirection < 0 || m_iRenderDirection > 2  , "RenderDirection must be greater than or equal to 0 and less than 3");
    287   xConfirmPara(m_iNumberOfOutputViews < 1,                    "Number of OutputViews must be greater or equal to 1");
    288   if ( m_iRenderDirection == 0 )
    289   {
    290     xConfirmPara( m_iNumberOfInputViews < 2,                  "Number of InputViews must be more than or equal to 2");
    291   }
    292   else
    293   {
    294     xConfirmPara( m_iNumberOfInputViews < 1,                  "Number of InputViews must be more than or equal to 1");
    295   }
    296 
    297   xConfirmPara( m_iLog2SamplingFactor < 0 || m_iLog2SamplingFactor >  4, "Log2SamplingFactor must be more than or equal to 0 and less than 5"  );
    298   xConfirmPara( m_iPreProcMode        < 0 || m_iPreProcMode        >  1, "PreProcMode        must be more than or equal to 0 and less than 2"  );
    299 
    300 
    301   xConfirmPara( m_iPreFilterSize      < 0 || m_iPreFilterSize      >  3, "PreFilterSize      must be more than or equal to 0 and less than 4" );
    302   xConfirmPara( m_iBlendMode          < 0 || m_iBlendMode          >  3, "BlendMode          must be more than or equal to 0 and less than 4"  );
    303   xConfirmPara( m_iBlendZThresPerc    < 0 || m_iBlendZThresPerc    > 100,"BlendZThresPerc    must be more than or equal to 0 and less than 101"  );
    304   xConfirmPara( m_iBlendHoleMargin    < 0 || m_iBlendHoleMargin    >  20,"BlendHoleMargin    must be more than or equal to 0 and less than 19"  );
    305   xConfirmPara( m_iInterpolationMode  < 0 || m_iInterpolationMode  >  4, "InterpolationMode  must be more than or equal to 0 and less than 5"  );
    306   xConfirmPara( m_iHoleFillingMode    < 0 || m_iHoleFillingMode    >  1, "HoleFillingMode    must be more than or equal to 0 and less than 2"  );
    307   xConfirmPara( m_iPostProcMode       < 0 || m_iPostProcMode       >  2, "PostProcMode       must be more than or equal to 0 and less than 3"  );
    308 
    309   Int iNumNonNULL;
    310   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" );
    311   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" );
    312 
    313 
    314   if ( !m_bSweep )
    315   {
    316   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" );
    317   }
    318   else
    319   {
    320       xConfirmPara( iNumNonNULL < 1, "Number of SynthOutputFiles must be equal to or more than 1" );
    321   }
    322 
    323 #undef xConfirmPara
    324   if ( check_failed )
    325   {
    326     exit(EXIT_FAILURE);
    327   }
    328 
    329 }
    330 
    331 
    332 
    333 Void TAppRendererCfg::xPrintParameter()
    334 {
    335   printf("\n");
    336   for( Int iCounter = 0; iCounter < m_iNumberOfInputViews; iCounter++)
    337   {
    338     printf("InputVideoFile_%i        : %s\n", iCounter, m_pchVideoInputFileList[iCounter]);
    339   }
    340   for( Int iCounter = 0; iCounter < m_iNumberOfInputViews; iCounter++)
    341   {
    342     printf("InputDepthFile_%i        : %s\n", iCounter, m_pchDepthInputFileList[iCounter]);
    343   }
    344 
    345   for( Int iCounter = 0; iCounter < m_iNumberOfOutputViews; iCounter++)
    346   {
    347     printf("SynthOutputFile_%i       : %s\n", iCounter, m_pchSynthOutputFileList[iCounter]);
    348   }
    349 
    350   printf("Format                  : %dx%d \n", m_iSourceWidth, m_iSourceHeight );
    351   printf("Frame index             : %d - %d (%d frames)\n", m_iFrameSkip, m_iFrameSkip+m_iFramesToBeRendered-1, m_iFramesToBeRendered);
    352   printf("CameraParameterFile     : %s\n", m_pchCameraParameterFile );
    353   printf("BaseViewNumbers         : %s  (%d views) \n", m_pchBaseViewCameraNumbers , m_iNumberOfInputViews  );
    354   printf("Sweep                   : %d\n", m_bSweep               );
    355 
    356   if ( m_bUseSetupString )
    357   {
    358     printf("ViewConfig              : %s\n", m_pchViewConfig );
    359   }
    360   else
    361   {
    362   printf("SynthViewNumbers        : %s  (%d views) \n", m_pchSynthViewCameraNumbers, m_iNumberOfOutputViews );
    363   }
    364 
    365   printf("Log2SamplingFactor      : %d\n", m_iLog2SamplingFactor );
    366   printf("UVUp                    : %d\n", m_bUVUp               );
    367   printf("PreProcMode             : %d\n", m_iPreProcMode        );
    368   printf("PreFilterSize           : %d\n", m_iPreFilterSize      );
    369   printf("SimEnhance              : %d\n", m_bSimEnhance         );
    370   printf("BlendMode               : %d\n", m_iBlendMode          );
    371   printf("BlendZThresPerc         : %d\n", m_iBlendZThresPerc    );
    372   printf("BlendUseDistWeight      : %d\n", m_bBlendUseDistWeight );
    373   printf("BlendHoleMargin         : %d\n", m_iBlendHoleMargin    );
    374   printf("InterpolationMode       : %d\n", m_iInterpolationMode  );
    375   printf("HoleFillingMode         : %d\n", m_iHoleFillingMode    );
    376   printf("PostProcMode            : %d\n", m_iPostProcMode       );
    377   printf("ShiftPrecision          : %d\n", m_iShiftPrecision     );
    378   printf("TemporalDepthFilter     : %d\n", m_bTempDepthFilter    );
    379   printf("RenderMode              : %d\n", m_iRenderMode         );
    380   printf("RendererDirection       : %d\n", m_iRenderDirection       );
    381 
    382   if (m_iRenderMode == 10 )
    383   {
    384     printf("UsedPelMapMarExt        : %d\n", m_iUsedPelMapMarExt );
    385   }
    386 
    387   printf("\n");
    388 
    389   //  printf("TOOL CFG: ");
    390   //  printf("ALF:%d ", m_bUseALF             );
    391   //  printf("\n");
    392 
    393   fflush(stdout);
    394 }
    395 
    396 Void TAppRendererCfg::xPrintUsage()
    397 {
    398   printf( "\n" );
    399   printf( "  Example: TAppRenderer.exe -c test.cfg\n\n");
    400 }
    401 
    402 Bool TAppRendererCfg::xConfirmParameter(Bool bflag, const char* message)
    403 {
    404   if (!bflag)
    405     return false;
    406 
    407   printf("Error: %s\n",message);
    408   return true;
    409 }
    410 
    411 
    412 Void TAppRendererCfg::xCreateFileNames()
    413 {
    414   if ( m_iRenderMode == 10 )
    415     return;
    416 
    417   Int iPrecBefore;
    418   Int iPrecAfter;
    419 
    420   xGetMaxPrecision( m_cCameraData.getSynthViewNumbers(), iPrecBefore, iPrecAfter );
    421 
    422 
    423   if (iPrecBefore > LOG10_VIEW_NUM_PREC )
    424   {
    425     std::cerr << "Error: View Numbers with more than " << LOG10_VIEW_NUM_PREC << " digits are not supported" << std::endl;
    426     exit(EXIT_FAILURE);
    427   }
    428 
    429   AOT( !m_bContOutputFileNumbering && (m_cCameraData.getSynthViewNumbers().size() != m_iNumberOfOutputViews ));
    430   for(Int iIdx = 0; iIdx < m_iNumberOfOutputViews; iIdx++)
    431   {
    432     //GT; Create ReconFileNames
    433     if (m_pchSynthOutputFileList[iIdx] == NULL )
    434     {
    435       if ( m_bContOutputFileNumbering )
    436       {
    437         xAddNumberToFileName( m_pchSynthOutputFileBaseName, m_pchSynthOutputFileList[iIdx], (Int) ((iIdx+1) * VIEW_NUM_PREC) , 2, 0  );
    438       }
    439       else
    440       {
    441         xAddNumberToFileName( m_pchSynthOutputFileBaseName, m_pchSynthOutputFileList[iIdx], m_cCameraData.getSynthViewNumbers()[iIdx], iPrecBefore, iPrecAfter  );
    442       }
    443     }
    444   }
    445 
    446   xGetMaxPrecision( m_cCameraData.getBaseViewNumbers(), iPrecBefore, iPrecAfter );
    447   for(Int iIdx = 0; iIdx < m_cCameraData.getBaseViewNumbers().size() ; iIdx++)
    448   {
    449     //GT; Create ReconFileNames
    450     if (m_pchVideoInputFileList[iIdx] == NULL )
    451     {
    452       xAddNumberToFileName( m_pchVideoInputFileBaseName, m_pchVideoInputFileList[iIdx], m_cCameraData.getBaseViewNumbers()[iIdx], iPrecBefore, iPrecAfter  );
    453     }
    454 
    455     if (m_pchDepthInputFileList[iIdx] == NULL )
    456     {
    457       xAddNumberToFileName( m_pchDepthInputFileBaseName, m_pchDepthInputFileList[iIdx], m_cCameraData.getBaseViewNumbers()[iIdx], iPrecBefore, iPrecAfter  );
    458     }
    459   }
    460 }
    461 
    462 Void TAppRendererCfg::xAddNumberToFileName( Char* pchSourceFileName, Char*& rpchTargetFileName, Int iNumberToAdd, UInt uiPrecBefore, UInt uiPrecAfter )
    463 {
    464 
    465   if ( pchSourceFileName == NULL )
    466   {
    467     std::cerr << "No BaseName for file name generation given." << std::endl;
    468     AOT(true);
    469     exit(EXIT_FAILURE);
    470   }
    471 
    472   Char pchNumberBuffer[2* LOG10_VIEW_NUM_PREC + 2];
    473   Char pchPrintBuffer[10];
    474 
    475   Double dNumberToAdd = ( (Double) iNumberToAdd ) / VIEW_NUM_PREC;
    476 
    477   UInt uiWidth = uiPrecBefore;
    478 
    479   if (uiPrecAfter != 0)
    480   {
    481     uiWidth += uiPrecAfter + 1;
    482   }
    483 
    484   sprintf( pchPrintBuffer, "%%0%d.%df", uiWidth, uiPrecAfter );
    485   sprintf( pchNumberBuffer, pchPrintBuffer, dNumberToAdd );
    486 
    487   if ( uiPrecAfter > 0 ) pchNumberBuffer[ uiPrecBefore ] = '_';
    488 
    489   size_t iInLength  = strlen(pchSourceFileName);
    490   size_t iAddLength = strlen(pchNumberBuffer);
    491 
    492   rpchTargetFileName = (Char*) malloc(iInLength+iAddLength+1);
    493 
    494   Char* pchPlaceHolder = strrchr(pchSourceFileName,'$');
    495   assert( pchPlaceHolder );
    496 
    497   size_t iCharsToPlaceHolder = pchPlaceHolder - pchSourceFileName;
    498   size_t iCharsToEnd         = iInLength      - iCharsToPlaceHolder;
    499 
    500   strncpy(rpchTargetFileName                               , pchSourceFileName                      , iCharsToPlaceHolder);
    501   strncpy(rpchTargetFileName+iCharsToPlaceHolder           , pchNumberBuffer                        , iAddLength         );
    502   strncpy(rpchTargetFileName+iCharsToPlaceHolder+iAddLength, pchSourceFileName+iCharsToPlaceHolder+1, iCharsToEnd-1      );
    503   rpchTargetFileName[iInLength+iAddLength-1] = '\0';
    504 }
    505 
    506 Void TAppRendererCfg::xGetMaxPrecision( std::vector< Int > aiIn, Int& iPrecBefore, Int& iPrecAfter )
    507 {
    508   iPrecBefore = 0;
    509   iPrecAfter  = 0;
    510 
    511   for (UInt uiK = 0; uiK < aiIn.size(); uiK ++ )
    512   {
    513     if ( aiIn[uiK] == 0 ) continue;
    514 
    515     Int iCurPrec;
    516     iCurPrec = 0;
    517     for ( Int iCur = aiIn[uiK]; iCur != 0; iCur /= 10, iCurPrec++ );
    518     iPrecBefore = max(iPrecBefore, iCurPrec - LOG10_VIEW_NUM_PREC );
    519 
    520     iCurPrec = 0;
    521     for ( Int iCur = 1;  aiIn[uiK] % iCur == 0; iCur *= 10, iCurPrec++);
    522     iCurPrec = LOG10_VIEW_NUM_PREC - std::min((Int) LOG10_VIEW_NUM_PREC, iCurPrec-1 );
    523     iPrecAfter = max(iPrecAfter, iCurPrec );
    524   }
    525 }
    526 
    527 Void TAppRendererCfg::xSetGlobal()
    528 {
    529   // set max CU width & height 
    530   g_uiMaxCUWidth   = 0;
    531   g_uiMaxCUHeight  = 0; 
    532 }
    533 
    534 #endif
  • branches/HTM-14.0-MV-draft-3/source/App/TAppRenderer/TAppRendererCfg.h

    r1179 r1191  
    4747#include <vector>
    4848
    49 #if H_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 interal luma and chroma bit-depth are required to be equal. )
    69   Int                m_inputBitDepthY;                 ///< bit-depth of input file (luma component)
    70   Int                m_inputBitDepthC;                 ///< bit-depth of input file (chroma component)
    71   Int                m_outputBitDepthY;                ///< bit-depth of output file (luma component)
    72   Int                m_outputBitDepthC;                ///< bit-depth of output file (chroma component)
    73   Int                m_internalBitDepthY;              ///< bit-depth renderer operates at in luma (input/output files will be converted)
    74   Int                m_internalBitDepthC;              ///< bit-depth renderer operates at in chroma (input/output files will be converted)
    75 
    76 
    77   // derived
    78   std::vector<Char*> m_pchVideoInputFileList;          ///< source file names
    79   std::vector<Char*> m_pchDepthInputFileList;          ///< source depth file names
    80   std::vector<Char*> m_pchSynthOutputFileList;         ///< output reconstruction file names
    81 
    82   //// source specification ////
    83   Int                m_iSourceWidth;                   ///< source width in pixel
    84   Int                m_iSourceHeight;                  ///< source height in pixel
    85   Int                m_iFrameSkip;                     ///< number of skipped frames from the beginning
    86   Int                m_iFramesToBeRendered;            ///< number of rendered frames
    87 
    88   ////camera specification ////
    89   Char*               m_pchCameraParameterFile;         ///< camera parameter file
    90   Char*               m_pchSynthViewCameraNumbers;      ///< numbers of views to synthesize
    91   Char*               m_pchViewConfig;                  ///< String to setup renderer
    92   Char*               m_pchBaseViewCameraNumbers;       ///< numbers of base views
    93 
    94   // derived
    95   TAppComCamPara      m_cCameraData;                    ///< class to store camera parameters
    96   TRenModSetupStrParser m_cRenModStrParser;             ///< class to manage View to be rendered
    97   Bool                m_bUseSetupString;                ///< true if setup string is used
    98 
    99   Int                 m_iNumberOfInputViews;            ///< number of input Views
    100   Int                 m_iNumberOfOutputViews;           ///< number views to synthesize
    101 
    102   //// renderer Modes ////
    103   Int                 m_iRenderDirection;               ///< 0: interpolate, 1: extrapolate from left, 2: extrapolate from right
    104 
    105   Int                 m_iLog2SamplingFactor;            ///< factor for horizontal upsampling before processing
    106   Bool                m_bUVUp;                          ///< upsampling of chroma planes before processing
    107   Int                 m_iPreProcMode;                   ///< depth pre-processing: 0 = none, 1 = binominal filtering
    108   Int                 m_iPreFilterSize;                 ///< for PreProcMode = 1: size of filter kernel
    109   Bool                m_bSimEnhance;                    ///< Similarity enhancement before blending
    110   Int                 m_iBlendMode;                     ///< merging of left and right image: 0 = average, 1 = only holes from right, 2 = only holes from left
    111   Int                 m_iBlendZThresPerc;               ///< z-difference threshold for blending in percent of total z-range
    112   Bool                m_bBlendUseDistWeight;            ///< 0: blend using average; 1: blend factor depends on view distance
    113   Int                 m_iBlendHoleMargin;               ///< Margin around boundaries
    114   Bool                m_bTempDepthFilter;               ///< Zheijang temporal enhancement filter
    115   Int                 m_iInterpolationMode;             ///< 0: NN, 1: linear, 2: cspline
    116   Int                 m_iHoleFillingMode;               ///< 0: none, 1: line wise background extension
    117   Int                 m_iPostProcMode;                  ///< 0: none, 1: horizontal 3-tap median
    118   Int                 m_iRenderMode;                      ///< 0: use renderer
    119   Int                 m_iShiftPrecision;                ///< Precision used for Interpolation Mode 4
    120   Int                 m_iUsedPelMapMarExt;              ///< Used Pel map extra margin
    121 
    122   Void xCheckParameter ();                              ///< check validity of configuration values
    123   Void xPrintParameter ();                              ///< print configuration values
    124   Void xPrintUsage     ();                              ///< print usage
    125   Void xSetGlobal();
    126 
    127   Void xCreateFileNames();
    128   Void xGetMaxPrecision( std::vector< Int > adIn, Int& iPrecBefore, Int& iPrecAfter );
    129   Void xAddNumberToFileName( Char* pchSourceFileName, Char*& rpchTargetFileName, Int iNumberToAdd, UInt uiPrecBefore, UInt uiPrecAfter );
    130 public:
    131   TAppRendererCfg();
    132   virtual ~TAppRendererCfg();
    133 
    134 public:
    135   Void  create    ();                                         ///< create option handling class
    136   Void  destroy   ();                                         ///< destroy option handling class
    137   Bool  parseCfg  ( Int argc, Char* argv[] );                 ///< parse configuration file to fill member variables
    138   Bool  xConfirmParameter(Bool bflag, const Char* message);
    139 
    140 
    141 };// END CLASS DEFINITION TAppRendererCfg
    142 
    143 #endif // __TAppRENDERERCFG__
    14449#endif // H_3D
  • branches/HTM-14.0-MV-draft-3/source/App/TAppRenderer/TAppRendererTop.cpp

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

    r1179 r1191  
    4040#define __TAppRendererTOP__
    4141#include "../../Lib/TLibCommon/TypeDef.h"
    42 #if H_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 H_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 H_3D_VSO
    81   Void  renderModel ();
    82 #endif
    83   Void  go          ();
    84   Void  renderUsedPelsMap();
    85 
    86 };// END CLASS DEFINITION TAppRendererTop
    87 
    88 
    89 #endif // H_3D
    9042#endif // __TAppRendererTOP__
  • branches/HTM-14.0-MV-draft-3/source/Lib/TAppCommon/TAppComCamPara.cpp

    r1179 r1191  
    4949#include <functional>
    5050#include <string>
    51 #if H_3D
    52 
    53 
    54 Void
    55 TAppComCamPara::xCreateLUTs( UInt uiNumberSourceViews, UInt uiNumberTargetViews, Double****& radLUT, Int****& raiLUT, Double***& radShiftParams, Int64***& raiShiftParams )
    56 {
    57   AOF( m_uiBitDepthForLUT == 8 );
    58   AOF( radShiftParams == NULL && raiShiftParams == NULL && radLUT == NULL && raiLUT == NULL );
    59 
    60   uiNumberSourceViews = std::max( (UInt) 1, uiNumberSourceViews );
    61   uiNumberTargetViews = std::max( (UInt) 1, uiNumberTargetViews );
    62 
    63   radShiftParams = new Double** [ uiNumberSourceViews ];
    64   raiShiftParams = new Int64 ** [ uiNumberSourceViews ];
    65   radLUT         = new Double***[ uiNumberSourceViews ];
    66   raiLUT         = new Int   ***[ uiNumberSourceViews ];
    67 
    68   for( UInt uiSourceView = 0; uiSourceView < uiNumberSourceViews; uiSourceView++ )
    69   {
    70     radShiftParams[ uiSourceView ] = new Double* [ uiNumberTargetViews ];
    71     raiShiftParams[ uiSourceView ] = new Int64 * [ uiNumberTargetViews ];
    72     radLUT        [ uiSourceView ] = new Double**[ uiNumberTargetViews ];
    73     raiLUT        [ uiSourceView ] = new Int   **[ uiNumberTargetViews ];
    74 
    75     for( UInt uiTargetView = 0; uiTargetView < uiNumberTargetViews; uiTargetView++ )
    76     {
    77       radShiftParams[ uiSourceView ][ uiTargetView ]      = new Double [ 2 ];
    78       raiShiftParams[ uiSourceView ][ uiTargetView ]      = new Int64  [ 2 ];
    79 
    80       radLUT        [ uiSourceView ][ uiTargetView ]      = new Double*[ 2 ];
    81       radLUT        [ uiSourceView ][ uiTargetView ][ 0 ] = new Double [ 257 ];
    82       radLUT        [ uiSourceView ][ uiTargetView ][ 1 ] = new Double [ 257 ];
    83 
    84       raiLUT        [ uiSourceView ][ uiTargetView ]      = new Int*   [ 2 ];
    85       raiLUT        [ uiSourceView ][ uiTargetView ][ 0 ] = new Int    [ 257 ];
    86       raiLUT        [ uiSourceView ][ uiTargetView ][ 1 ] = new Int    [ 257 ];
    87     }
    88   }
    89 }
    90 
    91 Void
    92 TAppComCamPara::xCreate2dArray( UInt uiNum1Ids, UInt uiNum2Ids, Int**& raaiArray )
    93 {
    94   AOT( raaiArray || uiNum1Ids == 0 || uiNum2Ids == 0 );
    95   raaiArray = new Int* [ uiNum1Ids ];
    96   for( UInt uiId1 = 0; uiId1 < uiNum1Ids; uiId1++ )
    97   {
    98     raaiArray[ uiId1 ] = new Int [ uiNum2Ids ];
    99   }
    100 }
    101 
    102 
    103 Void
    104 TAppComCamPara::xInit2dArray( UInt uiNum1Ids, UInt uiNum2Ids, Int**& raaiArray, Int iValue )
    105 {
    106   for( UInt uiId1 = 0; uiId1 < uiNum1Ids; uiId1++ )
    107   {
    108     for( UInt uiId2 = 0; uiId2 < uiNum2Ids; uiId2++ )
    109     {
    110       raaiArray[ uiId1 ][ uiId2 ] = iValue;
    111     }
    112   }
    113 }
    114 
    115 
    116 Void
    117 TAppComCamPara::convertNumberString( Char* pchViewNumberString, std::vector<Int>& raiViewNumbers, Double dViewNumPrec )
    118 {
    119   Bool bStringIsRange = false;
    120   Int  iIdx           = 0;
    121   std::vector<Double> adViewNumbers;
    122 
    123   while( pchViewNumberString != 0 && pchViewNumberString[ iIdx ] != 0 )
    124   {
    125     if( pchViewNumberString[ iIdx ] == ':' )
    126     {
    127       bStringIsRange              = true;
    128       pchViewNumberString[ iIdx ] = ' ';
    129     }
    130     iIdx++;
    131   }
    132 
    133   Char* pcNextStart = pchViewNumberString;
    134   Char* pcEnd       = pcNextStart + iIdx;
    135   Char* pcOldStart  = 0;
    136 
    137   while( pcNextStart < pcEnd )
    138   {
    139     errno = 0;
    140     adViewNumbers.push_back( ( strtod( pcNextStart, &pcNextStart ) ) );
    141 
    142     if( errno == ERANGE || pcNextStart == pcOldStart )
    143     {
    144       std::cerr << "Error Parsing View Number String: `" << pchViewNumberString << "'" << std::endl;
    145       AOT(true);
    146       exit( EXIT_FAILURE );
    147     };
    148 
    149     while( pcNextStart < pcEnd && ( *pcNextStart == ' ' || *pcNextStart == '\t' || *pcNextStart == '\r' ) ) pcNextStart++;
    150 
    151     pcOldStart = pcNextStart;
    152   }
    153 
    154   if( bStringIsRange )
    155   {
    156     if( adViewNumbers.size() != 3 )
    157     {
    158       std::cerr << "Error Parsing SynthViewNumbers: `" << pchViewNumberString << "'" << std::endl;
    159       AOT(true);
    160       exit( EXIT_FAILURE );
    161     }
    162 
    163     Double dRangeBegin = adViewNumbers[0];
    164     Double dRangeStep  = adViewNumbers[1];
    165     Double dRangeEnd   = adViewNumbers[2];
    166 
    167     if( ( ( dRangeEnd - dRangeBegin > 0 ) != ( dRangeStep > 0 ) ) || dRangeStep == 0 )
    168     {
    169       std::cerr << "Error Parsing SynthViewNumbers: `" << pchViewNumberString << "'" << std::endl;
    170       AOT(true);
    171       exit( EXIT_FAILURE );
    172     }
    173 
    174     raiViewNumbers.clear();
    175 
    176     Double dFac = ( dRangeBegin > dRangeEnd ? -1 : 1 );
    177 
    178     for( Double dViewNumber = dRangeBegin; ( dViewNumber - dRangeEnd ) * dFac <= 0; dViewNumber += dRangeStep )
    179     {
    180       raiViewNumbers.push_back( (Int)( dViewNumber * dViewNumPrec ) );
    181     }
    182   }
    183   else
    184   {
    185     for( UInt uiViewNum = 0; uiViewNum < adViewNumbers.size(); uiViewNum++ )
    186     {
    187       raiViewNumbers.push_back( (Int)( adViewNumbers[ uiViewNum ] * dViewNumPrec ) );
    188     }
    189   }
    190 }
    191 
    192 
    193 Void
    194 TAppComCamPara::xReadCameraParameterFile( Char* pchCfgFileName )
    195 {
    196   std::ifstream cCfgStream( pchCfgFileName, std::ifstream::in );
    197   if( !cCfgStream )
    198   {
    199     std::cerr << "Failed to open camera parameter file: `" << pchCfgFileName << "'" << std::endl;
    200     exit( EXIT_FAILURE );
    201   }
    202 
    203   Int iLineNumber = 0;
    204   do
    205   {
    206     std::string cLine;
    207     getline( cCfgStream, cLine );
    208     iLineNumber++;
    209 
    210     size_t iStart = cLine.find_first_not_of( " \t\n\r" );
    211 
    212     if( iStart == std::string::npos )
    213     {
    214       continue;
    215     }
    216 
    217     if( cLine[iStart] == '#' )
    218     {
    219       continue;
    220     }
    221 
    222     Char* pcNextStart = (Char*) cLine.data();
    223     Char* pcEnd = pcNextStart + cLine.length();
    224 
    225     std::vector<Double> caNewLine;
    226     caNewLine.clear();
    227 
    228     Char* pcOldStart = 0;
    229     while( pcNextStart < pcEnd )
    230     {
    231       errno = 0;
    232       caNewLine.push_back( strtod( pcNextStart, &pcNextStart ) ) ;
    233 
    234       if( errno == ERANGE || ( pcNextStart == pcOldStart ) )
    235       {
    236         std::cerr << "Failed reading config file: `" << pchCfgFileName << "' Error parsing double values in Line: " << iLineNumber << ' ' << std::endl;
    237         assert( 0 );
    238         exit( EXIT_FAILURE );
    239       };
    240       pcOldStart = pcNextStart;
    241 
    242       while( ( pcNextStart < pcEnd ) && ( *pcNextStart == ' ' || *pcNextStart == '\t' || *pcNextStart == '\r' ) ) pcNextStart++;
    243     }
    244 
    245     if ( ( caNewLine.size() != 2 ) && ( caNewLine.size() != 7 ) && ( caNewLine.size() != 6 ) && ( caNewLine.size() != 8 ) )
    246     {
    247       std::cerr << "Failed reading config file: `" << pchCfgFileName << "'" << std::endl;
    248       std::cerr << "Invalid number of entries" << std::endl;
    249       AOF(false);
    250       exit( EXIT_FAILURE );
    251     }
    252     m_aadCameraParameters.push_back( caNewLine );
    253   }
    254   while( cCfgStream );
    255 }
    256 
    257 Void
    258 TAppComCamPara::xGetCodedCameraData( UInt uiSourceView, UInt uiTargetView, Bool bByIdx,  UInt uiFrame, Int& riScale, Int& riOffset, Int& riPrecision )
    259 {
    260   if( bByIdx )
    261   {
    262     uiSourceView = m_aiBaseViews[ uiSourceView ];
    263     uiTargetView = m_aiBaseViews[ uiTargetView ];
    264   }
    265 
    266   Int iFoundLine = -1;
    267   for( UInt uiCurViewLine = 0; uiCurViewLine < m_aadCameraParameters.size(); uiCurViewLine++ )
    268   {
    269     if ( m_aadCameraParameters[uiCurViewLine].size() == 2 )
    270       continue;
    271 
    272     if(      ( (Int)( m_aadCameraParameters[ uiCurViewLine ][ 3 ] * m_dViewNumPrec ) == uiSourceView )
    273           && ( (Int)( m_aadCameraParameters[ uiCurViewLine ][ 2 ] * m_dViewNumPrec ) == uiTargetView )
    274       )
    275     {
    276       if( ( (UInt)m_aadCameraParameters[ uiCurViewLine ][ 0 ] <= uiFrame ) && ( (UInt)m_aadCameraParameters[ uiCurViewLine ][ 1 ] >= uiFrame ) )
    277       {
    278         if( iFoundLine != -1 )
    279         {
    280           std::cerr << "Error CameraParameters for SourceView " << (Double) uiSourceView / m_dViewNumPrec << " and Target View " << (Double) uiTargetView / m_dViewNumPrec << " and Frame " << uiFrame << " given multiple times."  << std::endl;
    281           AOT(true);
    282           exit( EXIT_FAILURE );
    283         }
    284         else
    285         {
    286           iFoundLine = uiCurViewLine;
    287         }
    288       }
    289     }
    290   }
    291 
    292   if ( iFoundLine == -1 )
    293   {
    294     std::cerr << "Error CameraParameters for SourceView " << (Double) uiSourceView / m_dViewNumPrec << " and Target View " << (Double) uiTargetView / m_dViewNumPrec << " and Frame " << uiFrame << " not found."  << std::endl;
    295     AOT(true);
    296     exit( EXIT_FAILURE );
    297   }
    298 
    299   riScale     = (Int)( m_aadCameraParameters[ iFoundLine ][ 4 ] );
    300   riOffset    = (Int)( m_aadCameraParameters[ iFoundLine ][ 5 ] );
    301   riPrecision = (Int)( m_aadCameraParameters[ iFoundLine ][ 6 ] );
    302 }
    303 
    304 Bool
    305 TAppComCamPara::xGetCameraDataRow( Int iView, UInt uiFrame, UInt& ruiFoundLine )
    306 {
    307   ruiFoundLine = -1;
    308   for( UInt uiCurViewLine = 0; uiCurViewLine < m_aadCameraParameters.size(); uiCurViewLine++ )
    309   {
    310     if( (Int)( m_aadCameraParameters[ uiCurViewLine ][ 0 ] * m_dViewNumPrec ) == iView )
    311     {
    312       if( ( (UInt)m_aadCameraParameters[ uiCurViewLine ][ 1 ] <= uiFrame ) && ( (UInt)m_aadCameraParameters[ uiCurViewLine ][ 2 ] >= uiFrame ) )
    313       {
    314         if( ruiFoundLine != -1 )
    315         {
    316           std::cerr << "Error CameraParameters for View " << (Double) iView / m_dViewNumPrec << " and Frame " << uiFrame << " given multiple times."  << std::endl;
    317           exit( EXIT_FAILURE );
    318         }
    319         else
    320         {
    321           ruiFoundLine = uiCurViewLine;
    322         }
    323       }
    324     }
    325   }
    326   return ( ruiFoundLine == -1 );
    327 }
    328 
    329 
    330 Void
    331 TAppComCamPara::xGetSortedViewList( const std::vector<Int>& raiViews, std::vector<Int>& raiSortedViews, std::vector<Int>& raiId2SortedId, std::vector<Int>& raiSortedId2Id )
    332 {
    333   AOF( raiViews.size() > 0 );
    334   Int iNumViews   = (Int)raiViews.size();
    335   raiId2SortedId  = std::vector<Int>( raiViews.size(), -1 );
    336   raiSortedId2Id.clear();
    337   raiSortedViews.clear();
    338   for( Int iSortId = 0; iSortId < iNumViews; iSortId++ )
    339   {
    340     Int  iLeftMostBaseId = -1;
    341     for( Int iBaseId = 0; iLeftMostBaseId == -1 && iBaseId < iNumViews; iBaseId++ )
    342     {
    343       if( raiId2SortedId[ iBaseId ] == -1 )
    344       {
    345         UInt   uiFoundLine   = -1;
    346         xGetCameraDataRow( raiViews[ iBaseId ], 0, uiFoundLine );
    347         AOT(   uiFoundLine  == -1 ); // something wrong
    348         Double dXPos         = m_aadCameraParameters[ uiFoundLine ][ 4 ];
    349         Double dZNear        = m_aadCameraParameters[ uiFoundLine ][ 6 ];
    350         Double dZFar         = m_aadCameraParameters[ uiFoundLine ][ 7 ];
    351         Double dSign         = ( dZFar > 0 ? 1.0 : -1.0 );
    352         Bool   bLeftMost     = true;
    353         AOF( dZNear * dZFar  > 0.0 ); // otherwise, z parameters are not correct
    354 
    355         for( Int iTestBaseId = 0; bLeftMost && iTestBaseId < iNumViews; iTestBaseId++ )
    356         {
    357           if( iTestBaseId != iBaseId && raiId2SortedId[ iTestBaseId ] == -1 )
    358           {
    359             UInt   uiFoundLineTest  = -1;
    360             xGetCameraDataRow( raiViews[ iTestBaseId ], 0, uiFoundLineTest );
    361             AOT(   uiFoundLineTest == -1 ); // something wrong
    362             Double dXPosTest        = m_aadCameraParameters[ uiFoundLineTest ][ 4 ];
    363             Double dZNearTest       = m_aadCameraParameters[ uiFoundLineTest ][ 6 ];
    364             Double dZFarTest        = m_aadCameraParameters[ uiFoundLineTest ][ 7 ];
    365             AOF( dZNearTest * dZFarTest > 0.0 ); // otherwise, z parameters are not correct
    366             AOF( dZNearTest * dSign     > 0.0 ); // otherwise, z parameters are not consistent
    367             Double dDeltaXPos       = dSign * ( dXPosTest - dXPos );
    368             bLeftMost               = ( bLeftMost && dDeltaXPos > 0.0 );
    369           }
    370         }
    371         if( bLeftMost )
    372         {
    373           iLeftMostBaseId = iBaseId;
    374         }
    375       }
    376     }
    377     AOT( iLeftMostBaseId == -1 ); // something wrong
    378     raiId2SortedId[ iLeftMostBaseId ] = iSortId;
    379     raiSortedId2Id.push_back( iLeftMostBaseId );
    380     raiSortedViews.push_back( raiViews[ iLeftMostBaseId ] );
    381   }
    382 
    383   // sanity check
    384   if( iNumViews > 2 )
    385   {
    386     Int   iDeltaView  = gSign( raiSortedViews[ 1 ] - raiSortedViews[ 0 ] );
    387     Bool  bOutOfOrder = false;
    388     for(  Int  iSIdx  = 2; iSIdx < iNumViews; iSIdx++ )
    389     {
    390       bOutOfOrder = ( bOutOfOrder || iDeltaView * gSign( raiSortedViews[ iSIdx ] - raiSortedViews[ iSIdx - 1 ] ) < 0 );
    391     }
    392     if( bOutOfOrder )
    393     {
    394       std::cerr << "ERROR: View numbering must be strictly increasing or decreasing from left to right" << std::endl;
    395       exit(EXIT_FAILURE);
    396     }
    397   }
    398 }
    399 
    400 
    401 #if !HHI_CAM_PARA_K0052
    402 Void
    403 TAppComCamPara::xGetViewOrderIndices( const std::vector<Int>& raiId2SortedId, std::vector<Int>& raiVOIdx )
    404 {
    405   AOF( raiId2SortedId.size() );
    406   raiVOIdx  =      raiId2SortedId;
    407   Int iSize = (Int)raiId2SortedId.size();
    408   Int iOffs =      raiId2SortedId[ 0 ];
    409   for( Int iIdx = 0; iIdx < iSize; iIdx++ )
    410   {
    411     raiVOIdx[ iIdx ] -= iOffs;
    412   }
    413 }
    414 #endif
    415 
    416 
    417 Bool
    418 TAppComCamPara::xGetCamParsChangeFlag()
    419 {
    420   Bool bChangeDetected = false;
    421   for( Int iBaseViewId = 0; !bChangeDetected && iBaseViewId < m_iNumberOfBaseViews; iBaseViewId++ )
    422   {
    423     if ( m_bSetupFromCoded )
    424     {
    425       for( Int iTargetViewId = 0; !bChangeDetected && iTargetViewId < m_iNumberOfBaseViews; iTargetViewId++ )
    426       {
    427         Int iTargetView = m_aiBaseViews[iTargetViewId];
    428         Int iSourceView = m_aiBaseViews[iBaseViewId  ];
    429 
    430         Int iS1 ,iSX;
    431         Int iO1 ,iOX;
    432         Int iP1 ,iPX;
    433 
    434         if ( iSourceView == iTargetView )
    435           continue;
    436 
    437         xGetCodedCameraData( iSourceView, iTargetView, false, 0, iS1, iO1, iP1 );
    438         for( UInt uiFrameId = m_uiFirstFrameId + 1; !bChangeDetected && uiFrameId <= m_uiLastFrameId; uiFrameId++ )
    439         {
    440           xGetCodedCameraData( iSourceView, iTargetView, false, uiFrameId, iSX, iOX, iPX );
    441 
    442           if( iS1 != iSX || iO1 != iOX || iP1 != iPX )
    443           {
    444             bChangeDetected = true;
    445           }
    446         }
    447       }
    448     }
    449     else
    450     {
    451       Int     iBaseView  = m_aiBaseViews[ iBaseViewId ];
    452       Double  dFL1, dFLX;
    453       Double  dCP1, dCPX;
    454       Double  dCS1, dCSX;
    455       Double  dZN1, dZNX;
    456       Double  dZF1, dZFX;
    457       Bool    bInterpolated;
    458       xGetGeometryData( iBaseView, m_uiFirstFrameId, dFL1, dCP1, dCS1, bInterpolated );  AOT( bInterpolated );
    459       xGetZNearZFar   ( iBaseView, m_uiFirstFrameId, dZN1, dZF1 );
    460 
    461       for( UInt uiFrameId = m_uiFirstFrameId + 1; !bChangeDetected && uiFrameId <= m_uiLastFrameId; uiFrameId++ )
    462       {
    463         xGetGeometryData( iBaseView, uiFrameId, dFLX, dCPX, dCSX, bInterpolated );  AOT( bInterpolated );
    464         xGetZNearZFar   ( iBaseView, uiFrameId, dZNX, dZFX );
    465 
    466         if( dFL1 != dFLX || dCP1 != dCPX || dCS1 != dCSX || dZN1 != dZNX || dZF1 != dZFX )
    467         {
    468           bChangeDetected = true;
    469         }
    470       }
    471     }
    472   }
    473   return bChangeDetected;
    474 }
    475 
    476 Int
    477 TAppComCamPara::xGetViewId( std::vector<Int> aiViewList, Int iBaseView )
    478 {
    479   Int  iViewId = -1;
    480   for( Int iId = 0; iId < (Int)aiViewList.size(); iId++ )
    481   {
    482     if( aiViewList[ iId ] == iBaseView )
    483     {
    484       iViewId = iId;
    485       break;
    486     }
    487   }
    488   AOT(   iViewId == -1 );
    489   return iViewId;
    490 }
    491 
    492 Int
    493 TAppComCamPara::xGetBaseViewId( Int iBaseView )
    494 {
    495   return xGetViewId( m_aiBaseViews, iBaseView );
    496 }
    497 
    498 
    499 Bool
    500 TAppComCamPara::xGetLeftRightView( Int iView, std::vector<Int> aiSortedViews, Int& riLeftView, Int& riRightView, Int& riLeftSortedViewIdx, Int& riRightSortedViewIdx )
    501 {
    502   Bool bFoundLRView  = false;
    503   Int  iLeftView     = -1;
    504   Int  iRightView    = -1;
    505   Int  iLeftViewIdx  = -1;
    506   Int  iRightViewIdx = -1;
    507   Bool bDecencdingVN = ( aiSortedViews.size() >= 2 && aiSortedViews[ 0 ] > aiSortedViews[ 1 ] );
    508   Int  iFactor       = ( bDecencdingVN ? -1 : 1 );
    509 
    510   for( Int iIdx = -1; iIdx < (Int)aiSortedViews.size(); iIdx++ )
    511   {
    512     if( iIdx == -1 )
    513     {
    514       if( ( aiSortedViews[ iIdx + 1 ] - iView ) * iFactor > 0  )
    515       {
    516         bFoundLRView  = false;
    517         iLeftView     = -1;
    518         iRightView    = aiSortedViews[ iIdx + 1 ];
    519         iLeftViewIdx  = -1;
    520         iRightViewIdx = iIdx + 1;
    521         break;
    522       }
    523     }
    524     else if ( iIdx == (Int)aiSortedViews.size() - 1 )
    525     {
    526       if( ( aiSortedViews[ iIdx ] - iView ) * iFactor < 0  )
    527       {
    528         bFoundLRView  = false;
    529         iLeftView     = aiSortedViews[ iIdx ];
    530         iRightView    = -1;
    531         iLeftViewIdx  = iIdx;
    532         iRightViewIdx = -1;
    533         break;
    534       }
    535     }
    536     else
    537     {
    538       if( ( ( aiSortedViews[ iIdx ] - iView ) * iFactor <= 0 ) && ( ( aiSortedViews[ iIdx + 1 ] - iView ) * iFactor >= 0 ) )
    539       {
    540         bFoundLRView  = true;
    541         iLeftView     = aiSortedViews[ iIdx ];
    542         iRightView    = aiSortedViews[ iIdx + 1 ];
    543         iLeftViewIdx  = iIdx;
    544         iRightViewIdx = iIdx + 1;
    545         break;
    546       }
    547     }
    548   }
    549 
    550   if ( ( iView == iLeftView ) || ( iView == iRightView ) )
    551   {
    552     iLeftViewIdx  = ( iView == iLeftView ) ? iLeftViewIdx : iRightViewIdx;
    553     iRightViewIdx = iLeftViewIdx;
    554     iLeftView     = iView;
    555     iRightView    = iView;
    556     bFoundLRView  = false;
    557   }
    558 
    559   riLeftView           = iLeftView;
    560   riRightView          = iRightView;
    561   riLeftSortedViewIdx  = iLeftViewIdx;
    562   riRightSortedViewIdx = iRightViewIdx;
    563 
    564   return bFoundLRView;
    565 }
    566 
    567 
    568 Void
    569 TAppComCamPara::xGetPrevAndNextBaseView( Int iSourceViewNum, Int iTargetViewNum, Int& riPrevBaseViewNum, Int& riNextBaseViewNum )
    570 {
    571   Int iLeftView;
    572   Int iRightView;
    573   Int iDummy;
    574   xGetLeftRightView( iTargetViewNum, m_aiSortedBaseViews, iLeftView, iRightView, iDummy, iDummy );
    575 
    576   if( iLeftView == iRightView )
    577   {
    578     riPrevBaseViewNum = iLeftView;
    579     riNextBaseViewNum = iLeftView;
    580   }
    581   else
    582   {
    583     Bool bDecencdingVN   = ( m_aiSortedBaseViews.size() >= 2 && m_aiSortedBaseViews[ 0 ] > m_aiSortedBaseViews[ 1 ] );
    584     Bool bNextViewIsLeft = ( bDecencdingVN ? ( iSourceViewNum < iTargetViewNum ) : ( iSourceViewNum > iTargetViewNum ) );
    585     if ( bNextViewIsLeft )
    586     {
    587       riPrevBaseViewNum = iRightView;
    588       riNextBaseViewNum = iLeftView;
    589     }
    590     else
    591     {
    592       riPrevBaseViewNum = iLeftView;
    593       riNextBaseViewNum = iRightView;
    594     }
    595   }
    596 }
    597 
    598 
    599 Void
    600 TAppComCamPara::xGetZNearZFar( Int iView, UInt uiFrame, Double& rdZNear, Double& rdZFar )
    601 {
    602   UInt uiFoundLine = -1;
    603   if( !xGetCameraDataRow( iView, uiFrame, uiFoundLine ) || !( m_aadCameraParameters[ uiFoundLine ].size() < 8 ) )
    604   {
    605     rdZNear = m_aadCameraParameters[ uiFoundLine ][ 6 ];
    606     rdZFar  = m_aadCameraParameters[ uiFoundLine ][ 7 ];
    607   }
    608   else
    609   {
    610     std::cerr << "No ZNear or no ZFar for View " << (Double)iView / m_dViewNumPrec << " and Frame " << uiFrame << " given in CameraParameterFile" << std::endl;
    611     exit( EXIT_FAILURE );
    612   }
    613 }
    614 
    615 Void
    616 TAppComCamPara::xGetGeometryData( Int iView, UInt uiFrame, Double& rdFocalLength, Double& rdPosition, Double& rdCameraShift, Bool& rbInterpolated )
    617 {
    618   UInt uiFoundLine = -1;
    619   if ( !xGetCameraDataRow( iView, uiFrame, uiFoundLine ) && xIsIn( m_aiSortedBaseViews, iView ))
    620   {
    621     AOT( m_aadCameraParameters[ uiFoundLine ].size() < 6 );
    622     rbInterpolated = false;
    623     rdFocalLength =  m_aadCameraParameters[ uiFoundLine ][ 3 ];
    624     rdPosition    =  m_aadCameraParameters[ uiFoundLine ][ 4 ];
    625     rdCameraShift =  m_aadCameraParameters[ uiFoundLine ][ 5 ];
    626   }
    627   else
    628   {
    629     UInt uiLeftViewLine;
    630     UInt uiRightViewLine;
    631     Int  iLeftView;
    632     Int  iRightView;
    633     Int  iDummy;
    634 
    635     if( !xGetLeftRightView( iView, m_aiSortedBaseViews, iLeftView, iRightView, iDummy, iDummy ) ||
    636          xGetCameraDataRow( iLeftView,  uiFrame, uiLeftViewLine  )                             ||
    637          xGetCameraDataRow( iRightView, uiFrame, uiRightViewLine )
    638       )
    639     {
    640       std::cerr << "No left or no right base view next to view " << (Double)iView / m_dViewNumPrec << " for Frame " << uiFrame << " given in CameraParameterFile" << std::endl;
    641       AOT(true);
    642       exit( EXIT_FAILURE );
    643     }
    644     AOT( m_aadCameraParameters[ uiLeftViewLine  ].size() < 6 );
    645     AOT( m_aadCameraParameters[ uiRightViewLine ].size() < 6 );
    646 
    647     // Linear Interpolation
    648     Double dFactor = ( (Double)( iView - iLeftView ) ) / ( (Double)( iRightView - iLeftView ) );
    649     rdFocalLength  = m_aadCameraParameters[ uiLeftViewLine ][ 3 ] + dFactor * ( m_aadCameraParameters[ uiRightViewLine ][ 3 ] - m_aadCameraParameters[ uiLeftViewLine ][ 3 ] );
    650     rdPosition     = m_aadCameraParameters[ uiLeftViewLine ][ 4 ] + dFactor * ( m_aadCameraParameters[ uiRightViewLine ][ 4 ] - m_aadCameraParameters[ uiLeftViewLine ][ 4 ] );
    651     rdCameraShift  = m_aadCameraParameters[ uiLeftViewLine ][ 5 ] + dFactor * ( m_aadCameraParameters[ uiRightViewLine ][ 5 ] - m_aadCameraParameters[ uiLeftViewLine ][ 5 ] );
    652     rbInterpolated = true;
    653   }
    654 }
    655 
    656 Bool
    657 TAppComCamPara::xGetShiftParameterReal( UInt uiSourceView, UInt uiTargetView, UInt uiFrame, Bool bExternal, Bool bByIdx, Double& rdScale, Double& rdOffset )
    658 {
    659   AOT( m_bSetupFromCoded );
    660 
    661   Bool   bInterpolatedSource;
    662   Double dMinDepthSource;
    663   Double dMaxDepthSource;
    664   Double dFocalLengthSource;
    665   Double dPositionSource;
    666   Double dIntersectionSource;
    667 
    668   Bool   bInterpolatedTarget;
    669   Double dPositionTarget;
    670   Double dIntersectionTarget;
    671   Double dFocalLengthTarget;
    672 
    673   Int    iTargetViewNum;
    674   Int    iSourceViewNum;
    675 
    676   if( bByIdx )
    677   {
    678     iSourceViewNum = m_aiBaseViews[ uiSourceView ];
    679     iTargetViewNum = ( bExternal ? m_aiSynthViews[ uiTargetView ] : m_aiBaseViews[ uiTargetView ] );
    680   }
    681   else
    682   {
    683     iSourceViewNum = (Int) uiSourceView;
    684     iTargetViewNum = (Int) uiTargetView;
    685   }
    686 
    687   xGetGeometryData( iSourceViewNum, uiFrame, dFocalLengthSource, dPositionSource, dIntersectionSource, bInterpolatedSource );
    688   xGetZNearZFar   ( iSourceViewNum, uiFrame, dMinDepthSource,    dMaxDepthSource );
    689   xGetGeometryData( iTargetViewNum, uiFrame, dFocalLengthTarget, dPositionTarget, dIntersectionTarget, bInterpolatedTarget );
    690 
    691   Double dFactor = dFocalLengthSource * ( dPositionTarget - dPositionSource );
    692   rdScale        = dFactor * ( 1.0 / dMinDepthSource - 1.0 / dMaxDepthSource ) / (Double)( ( 1 << m_uiInputBitDepth ) - 1 );
    693   rdOffset       = dFactor / dMaxDepthSource - dIntersectionTarget + dIntersectionSource;
    694 
    695   return ( bInterpolatedSource || bInterpolatedTarget );
    696 }
    697 
    698 
    699 Void
    700 TAppComCamPara::xGetShiftParameterCoded( UInt uiSourceView, UInt uiTargetView, UInt uiFrame, Bool bByIdx, Int& riScale, Int& riOffset )
    701 {
    702   if ( m_bSetupFromCoded )
    703   {
    704     if ( uiSourceView == uiTargetView )
    705     {
    706       riScale  = 0;
    707       riOffset = 0;
    708       return;
    709     }
    710     Int iCamParsCodedPrecision;
    711     xGetCodedCameraData( uiSourceView, uiTargetView,  bByIdx, uiFrame, riScale, riOffset, iCamParsCodedPrecision );
    712 
    713     if ( m_bCamParsCodedPrecSet )
    714     {
    715       AOT( m_uiCamParsCodedPrecision != (UInt) iCamParsCodedPrecision );
    716     }
    717     else
    718     {
    719       m_uiCamParsCodedPrecision = (UInt) iCamParsCodedPrecision;
    720       m_bCamParsCodedPrecSet    = true;
    721     }
    722   }
    723   else
    724   {
    725     Double  dScale, dOffset;
    726     Bool    bInterpolated = xGetShiftParameterReal( uiSourceView, uiTargetView, uiFrame, false, bByIdx, dScale, dOffset );
    727     AOT(    bInterpolated ); // must be base view
    728 
    729     Double  dMultOffset   = (Double)( 1 << ( m_uiCamParsCodedPrecision + 1 ) );
    730     Double  dMultScale    = (Double)( 1 << ( m_uiCamParsCodedPrecision + 1 + m_uiInputBitDepth ) );
    731     riOffset              = (Int)floor( dMultOffset * dOffset + .5 );
    732     riScale               = (Int)floor( dMultScale  * dScale  + .5 );
    733   }
    734 }
    735 
    736 
    737 Void
    738 TAppComCamPara::xGetShiftParameterInt( UInt uiSourceView, UInt uiTargetView, UInt uiFrame, Bool bExternal, Bool bByIdx, Int64& riScale, Int64& riOffset )
    739 {
    740   Int    iTargetViewNum;
    741   Int    iSourceViewNum;
    742   Int    iPrevBaseViewNum;
    743   Int    iNextBaseViewNum;
    744   Int    iTargetViewRelNum;
    745 
    746   if( bByIdx )
    747   {
    748 
    749     iSourceViewNum = m_aiBaseViews[ uiSourceView ];
    750 
    751     if ( bExternal )
    752     {
    753       iTargetViewNum    = m_aiSynthViews      [ uiTargetView ];
    754       iTargetViewRelNum = m_aiRelSynthViewsNum[ uiTargetView ];
    755     }
    756     else
    757     {
    758       iTargetViewNum    = m_aiBaseViews       [ uiTargetView ];
    759       iTargetViewRelNum = m_aiBaseId2SortedId [ uiTargetView ] * ((Int) m_dViewNumPrec );
    760     }
    761   }
    762   else
    763   {
    764     iSourceViewNum = (Int) uiSourceView;
    765     iTargetViewNum = (Int) uiTargetView;
    766 
    767     if ( bExternal )
    768     {
    769       iTargetViewRelNum = m_aiRelSynthViewsNum[ xGetViewId( m_aiSynthViews, (Int) uiTargetView )];
    770     }
    771     else
    772     {
    773       iTargetViewRelNum = m_aiBaseId2SortedId[ xGetBaseViewId( uiTargetView) ] * ((Int) m_dViewNumPrec );
    774     }
    775   }
    776   xGetPrevAndNextBaseView( iSourceViewNum, iTargetViewNum, iPrevBaseViewNum, iNextBaseViewNum );
    777   AOT( iPrevBaseViewNum == -1 ); // should not happen
    778   AOT( iNextBaseViewNum == -1 ); // should not happen
    779 
    780   Int iSrcId    = xGetBaseViewId( iSourceViewNum   );
    781   Int iPrevId   = xGetBaseViewId( iPrevBaseViewNum );
    782   Int iNextId   = xGetBaseViewId( iNextBaseViewNum );
    783   AOF( m_aaiScaleAndOffsetSet[ iSrcId ][ iPrevId ] ); // coded scale and offset must be set
    784   AOF( m_aaiScaleAndOffsetSet[ iSrcId ][ iNextId ] ); // coded scale and offset must be set
    785 
    786   Int iNextBaseViewRelNum = m_aiBaseId2SortedId[ iNextId ] * ((Int) m_dViewNumPrec );
    787   Int iPrevBaseViewRelNum = m_aiBaseId2SortedId[ iPrevId ] * ((Int) m_dViewNumPrec );
    788 
    789   Int64 iPrevScale  = (Int64)m_aaiCodedScale [ iSrcId ][ iPrevId ];
    790   Int64 iNextScale  = (Int64)m_aaiCodedScale [ iSrcId ][ iNextId ];
    791   Int64 iPrevOffset = (Int64)m_aaiCodedOffset[ iSrcId ][ iPrevId ] << m_uiBitDepthForLUT;
    792   Int64 iNextOffset = (Int64)m_aaiCodedOffset[ iSrcId ][ iNextId ] << m_uiBitDepthForLUT;
    793 
    794   if( iPrevBaseViewNum == iNextBaseViewNum )
    795   {
    796     riScale   = iNextScale;
    797     riOffset  = iNextOffset;
    798   }
    799   else
    800   {
    801     riScale   = Int64( iTargetViewRelNum    - iPrevBaseViewRelNum ) * iNextScale;
    802     riScale  += Int64( iNextBaseViewRelNum  - iTargetViewRelNum   ) * iPrevScale;
    803     riOffset  = Int64( iTargetViewRelNum   - iPrevBaseViewRelNum ) * iNextOffset;
    804     riOffset += Int64( iNextBaseViewRelNum - iTargetViewRelNum   ) * iPrevOffset;
    805     Int64 iD  = Int64( iNextBaseViewRelNum - iPrevBaseViewRelNum );
    806     Int64 iSA = ( riScale  > 0 ? iD / 2 : -iD / 2 );
    807     Int64 iOA = ( riOffset > 0 ? iD / 2 : -iD / 2 );
    808     riScale   = ( riScale  + iSA  ) / iD;
    809     riOffset  = ( riOffset + iOA  ) / iD;
    810   }
    811 }
    812 
    813 
    814 Void
    815 TAppComCamPara::xSetCodedScaleOffset( UInt uiFrame )
    816 {
    817   for( UInt uiSourceId = 0; uiSourceId < m_iNumberOfBaseViews; uiSourceId++ )
    818   {
    819     for( UInt uiTargetId = 0; uiTargetId < m_iNumberOfBaseViews; uiTargetId++ )
    820     {
    821       Int iScale, iOffset;
    822       xGetShiftParameterCoded( uiSourceId, uiTargetId, uiFrame, true, iScale, iOffset );
    823       m_aaiCodedScale        [ uiSourceId ][ uiTargetId ] = iScale;
    824       m_aaiCodedOffset       [ uiSourceId ][ uiTargetId ] = iOffset;
    825       m_aaiScaleAndOffsetSet [ uiSourceId ][ uiTargetId ] = 1;
    826     }
    827   }
    828 }
    829 
    830 
    831 Void
    832 TAppComCamPara::xSetShiftParametersAndLUT( UInt uiNumberSourceViews, UInt uiNumberTargetViews, UInt uiFrame, Bool bExternalReference , Double****& radLUT, Int****& raiLUT, Double***& radShiftParams, Int64***& raiShiftParams )
    833 {
    834   if( uiNumberSourceViews <= 1 || uiNumberTargetViews == 0 )
    835   {
    836     return;
    837   }
    838   AOF( radShiftParams != NULL && raiShiftParams != NULL && radLUT != NULL && raiLUT != NULL );
    839   AOF( m_uiBitDepthForLUT == 8 );
    840 
    841   Int     iLog2DivLuma   = m_uiBitDepthForLUT + m_uiCamParsCodedPrecision + 1 - m_iLog2Precision;   AOF( iLog2DivLuma > 0 );
    842   Int     iLog2DivChroma = iLog2DivLuma + 1;
    843 
    844   Double  dMaxDispDev    = 0.0;
    845   Double  dMaxRndDispDvL = 0.0;
    846   Double  dMaxRndDispDvC = 0.0;
    847 
    848   for( UInt uiSourceView = 0; uiSourceView < uiNumberSourceViews; uiSourceView++ )
    849   {
    850     for( UInt uiTargetView = 0; uiTargetView < uiNumberTargetViews; uiTargetView++ )
    851     {
    852 
    853       // integer-valued scale and offset
    854       Int64 iScale, iOffset;
    855       xGetShiftParameterInt ( uiSourceView, uiTargetView, uiFrame, bExternalReference, true, iScale, iOffset );
    856       raiShiftParams[ uiSourceView][ uiTargetView ][ 0 ] = iScale;
    857       raiShiftParams[ uiSourceView][ uiTargetView ][ 1 ] = iOffset;
    858 
    859       // offsets including rounding offsets
    860       Int64 iOffsetLuma   = iOffset + ( ( 1 << iLog2DivLuma   ) >> 1 );
    861       Int64 iOffsetChroma = iOffset + ( ( 1 << iLog2DivChroma ) >> 1 );
    862 
    863       // real-valued scale and offset
    864       Double dScale, dOffset;
    865 
    866       if ( m_bSetupFromCoded )
    867       {
    868         dScale  = (Double) iScale  / (( Double ) ( 1 << iLog2DivLuma ));
    869         dOffset = (Double) iOffset / (( Double ) ( 1 << iLog2DivLuma ));
    870       }
    871       else
    872       {
    873         xGetShiftParameterReal( uiSourceView, uiTargetView, uiFrame, bExternalReference, true, dScale, dOffset );
    874       }
    875 
    876       radShiftParams[ uiSourceView][ uiTargetView ][ 0 ] = dScale;
    877       radShiftParams[ uiSourceView][ uiTargetView ][ 1 ] = dOffset;
    878 
    879       for( UInt uiDepthValue = 0; uiDepthValue < 256; uiDepthValue++ )
    880       {
    881         // real-valued look-up tables
    882         Double  dShiftLuma      = ( (Double)uiDepthValue * dScale + dOffset ) * Double( 1 << m_iLog2Precision );
    883         Double  dShiftChroma    = dShiftLuma / 2;
    884         radLUT[ uiSourceView ][ uiTargetView ][ 0 ][ uiDepthValue ] = dShiftLuma;
    885         radLUT[ uiSourceView ][ uiTargetView ][ 1 ][ uiDepthValue ] = dShiftChroma;
    886 
    887         // integer-valued look-up tables
    888         Int64   iTempScale      = (Int64)uiDepthValue * iScale;
    889         Int64   iTestScale      = ( iTempScale + iOffset       );   // for checking accuracy of camera parameters
    890         Int64   iShiftLuma      = ( iTempScale + iOffsetLuma   ) >> iLog2DivLuma;
    891         Int64   iShiftChroma    = ( iTempScale + iOffsetChroma ) >> iLog2DivChroma;
    892         raiLUT[ uiSourceView ][ uiTargetView ][ 0 ][ uiDepthValue ] = (Int)iShiftLuma;
    893         raiLUT[ uiSourceView ][ uiTargetView ][ 1 ][ uiDepthValue ] = (Int)iShiftChroma;
    894 
    895         // maximum deviation
    896 #if H_3D_REN_MAX_DEV_OUT
    897         m_dMaxShiftDeviation = std::max( m_dMaxShiftDeviation, fabs( Double( (Int) iShiftLuma   ) - dShiftLuma   ) / Double( 1 << m_iLog2Precision ) );       
    898 #endif
    899         dMaxDispDev     = std::max( dMaxDispDev,    fabs( Double( (Int) iTestScale   ) - dShiftLuma * Double( 1 << iLog2DivLuma ) ) / Double( 1 << iLog2DivLuma ) );
    900         dMaxRndDispDvL  = std::max( dMaxRndDispDvL, fabs( Double( (Int) iShiftLuma   ) - dShiftLuma   ) );
    901         dMaxRndDispDvC  = std::max( dMaxRndDispDvC, fabs( Double( (Int) iShiftChroma ) - dShiftChroma ) );
    902       }
    903 
    904       radLUT[ uiSourceView ][ uiTargetView ][ 0 ][ 256 ] = radLUT[ uiSourceView ][ uiTargetView ][ 0 ][ 255 ];
    905       radLUT[ uiSourceView ][ uiTargetView ][ 1 ][ 256 ] = radLUT[ uiSourceView ][ uiTargetView ][ 1 ][ 255 ];
    906       raiLUT[ uiSourceView ][ uiTargetView ][ 0 ][ 256 ] = raiLUT[ uiSourceView ][ uiTargetView ][ 0 ][ 255 ];
    907       raiLUT[ uiSourceView ][ uiTargetView ][ 1 ][ 256 ] = raiLUT[ uiSourceView ][ uiTargetView ][ 1 ][ 255 ];
    908     }
    909   }
    910 
    911   // check maximum deviation
    912   Double  dMaxAllowedDispDev    =       Double( 1 << m_iLog2Precision ) / Double( 1 << m_uiCamParsCodedPrecision );       //  counting only the impact of camera parameter rounding
    913   Double  dMaxAllowedRndDispDvL = 0.5 + Double( 1 << m_iLog2Precision ) / Double( 1 << m_uiCamParsCodedPrecision );       // final rounding and impact of camera parameter rounding
    914   Double  dMaxAllowedRndDispDvC = 0.5 + Double( 1 << m_iLog2Precision ) / Double( 1 << m_uiCamParsCodedPrecision ) / 2.0; // final rounding and impact of camera parameter rounding
    915 
    916   if( ( dMaxDispDev >= dMaxAllowedDispDev || dMaxRndDispDvL >= dMaxAllowedRndDispDvL || dMaxRndDispDvC >= dMaxAllowedRndDispDvC ) && !m_bSetupFromCoded )
    917   {
    918     std::cout << "Warning: Something wrong with the accuracy of coded camera parameters:" << std::endl;
    919     if( dMaxDispDev    >= dMaxAllowedDispDev    )
    920     {
    921       std::cout << "   max disparity difference is " << dMaxDispDev    << " (allowed: " << dMaxAllowedDispDev    << ")" << std::endl;
    922     }
    923     if( dMaxRndDispDvL >= dMaxAllowedRndDispDvL )
    924     {
    925       std::cout << "   max rnd luma   disp diff is " << dMaxRndDispDvL << " (allowed: " << dMaxAllowedRndDispDvL << ")" << std::endl;
    926     }
    927     if( dMaxRndDispDvC >= dMaxAllowedRndDispDvC )
    928     {
    929       std::cout << "   max rnd chroma disp diff is " << dMaxRndDispDvC << " (allowed: " << dMaxAllowedRndDispDvC << ")" << std::endl;
    930     }
    931   }
    932 }
    933 
    934 Void
    935 TAppComCamPara::xSetShiftParametersAndLUT( UInt uiFrame )
    936 {
    937   xInit2dArray             ( (UInt)m_iNumberOfBaseViews, (UInt)m_iNumberOfBaseViews,  m_aaiScaleAndOffsetSet, 0 );
    938   xSetCodedScaleOffset     (                                                          uiFrame );
    939   xSetShiftParametersAndLUT( (UInt)m_iNumberOfBaseViews, (UInt)m_iNumberOfBaseViews,  uiFrame, false, m_adBaseViewShiftLUT,  m_aiBaseViewShiftLUT,  m_adBaseViewShiftParameter,  m_aiBaseViewShiftParameter  );
    940   xSetShiftParametersAndLUT( (UInt)m_iNumberOfBaseViews, (UInt)m_iNumberOfSynthViews, uiFrame, true,  m_adSynthViewShiftLUT, m_aiSynthViewShiftLUT, m_adSynthViewShiftParameter, m_aiSynthViewShiftParameter );
    941 };
    942 
    943 
    944 Void
    945 TAppComCamPara::xGetCameraShifts( UInt uiSourceView, UInt uiTargetView, UInt uiFrame, Double& rdCamPosShift, Double& rdPicPosShift )
    946 {
    947   Double  dDummy, dCamPosSource, dCamPosTarget, dPicPosSource, dPicPosTarget;
    948   Bool    bInterpolatedSource, bInterpolatedTarget;
    949   Int     iTargetViewNum = m_aiBaseViews[ uiTargetView ];
    950   Int     iSourceViewNum = m_aiBaseViews[ uiSourceView ];
    951 
    952   xGetGeometryData( iSourceViewNum, uiFrame, dDummy, dCamPosSource, dPicPosSource, bInterpolatedSource );
    953   xGetGeometryData( iTargetViewNum, uiFrame, dDummy, dCamPosTarget, dPicPosTarget, bInterpolatedTarget );
    954   AOT( bInterpolatedSource || bInterpolatedTarget );
    955 
    956   rdCamPosShift =  ( dCamPosTarget - dCamPosSource );
    957   rdPicPosShift = -( dPicPosTarget - dPicPosSource ); // to be consistent
    958 }
    959 
    960 
    961 
    962 #if !HHI_CAM_PARA_K0052
    963 Void
    964 TAppComCamPara::xSetPdmConversionParams()
    965 {
    966   AOF( m_aiViewOrderIndex[ 0 ] == 0 );
    967   if ( m_bSetupFromCoded || m_iNumberOfBaseViews    <  2 )
    968   {
    969     return;
    970   }
    971 
    972   //--- determine (virtual) camera parameter shift between view order index 1 and base view (view order index 0) ---
    973   Double        dCamPosShift, dPicPosShift;
    974   Int           iMinAbsVOI    = (1<<30);
    975   Int           iMinAbsVOIId  = 0;
    976   for( Int iBaseId = 1; iBaseId < m_iNumberOfBaseViews; iBaseId++ )
    977   {
    978     Int iAbsVOI = ( m_aiViewOrderIndex[ iBaseId ] < 0 ? -m_aiViewOrderIndex[ iBaseId ] : m_aiViewOrderIndex[ iBaseId ] );
    979     if( iAbsVOI < iMinAbsVOI )
    980     {
    981       iMinAbsVOI   = iAbsVOI;
    982       iMinAbsVOIId = iBaseId;
    983     }
    984   }
    985   AOF( iMinAbsVOIId != 0 && iMinAbsVOI != 0 );
    986   xGetCameraShifts( 0, iMinAbsVOIId, m_uiFirstFrameId, dCamPosShift, dPicPosShift );
    987 
    988   //--- determine maximum absolute camera position shift, precision, and base scale ---
    989   Double  dMaxAbsCamPosShift = 0.0;
    990   for( Int iTargetId = 1; iTargetId < m_iNumberOfBaseViews; iTargetId++ )
    991   {
    992     for( Int iBaseId = 0; iBaseId < iTargetId; iBaseId++ )
    993     {
    994       xGetCameraShifts( (UInt)iBaseId, (UInt)iTargetId, m_uiFirstFrameId, dCamPosShift, dPicPosShift );
    995       dCamPosShift        = ( dCamPosShift < 0.0                ? -dCamPosShift : dCamPosShift       );
    996       dMaxAbsCamPosShift  = ( dCamPosShift > dMaxAbsCamPosShift ?  dCamPosShift : dMaxAbsCamPosShift );
    997     }
    998   }
    999 }
    1000 #endif
    1001 
    1002 
    1003 
    1004 TAppComCamPara::TAppComCamPara()
    1005 {
    1006   m_dViewNumPrec              = VIEW_NUM_PREC;  // fixed
    1007   m_iLog2Precision            = -1;
    1008   m_uiInputBitDepth           = 0;
    1009   m_uiBitDepthForLUT          = 8;              // fixed
    1010   m_uiFirstFrameId            = 0;
    1011   m_uiLastFrameId             = 0;
    1012 
    1013   m_iNumberOfBaseViews        = -1;
    1014   m_iNumberOfSynthViews       = -1;
    1015 
    1016   m_uiCamParsCodedPrecision   = 0;
    1017   m_bCamParsVaryOverTime      = true;
    1018 
    1019   m_aaiCodedScale             = 0;
    1020   m_aaiCodedOffset            = 0;
    1021   m_aaiScaleAndOffsetSet      = 0;
    1022 
    1023   m_adBaseViewShiftParameter  = 0;
    1024   m_aiBaseViewShiftParameter  = 0;
    1025   m_adSynthViewShiftParameter = 0;
    1026   m_aiSynthViewShiftParameter = 0;
    1027 
    1028   m_adBaseViewShiftLUT        = 0;
    1029   m_aiBaseViewShiftLUT        = 0;
    1030   m_adSynthViewShiftLUT       = 0;
    1031   m_aiSynthViewShiftLUT       = 0;
    1032 
    1033   m_bSetupFromCoded           = false;
    1034   m_bCamParsCodedPrecSet      = false;
    1035 
    1036 #if H_3D_REN_MAX_DEV_OUT
    1037   m_dMaxShiftDeviation        = -1;
    1038 #endif
    1039 
    1040 }
    1041 
    1042 
    1043 TAppComCamPara::~TAppComCamPara()
    1044 {
    1045   xDeleteArray( m_adBaseViewShiftParameter,  m_iNumberOfBaseViews, m_iNumberOfBaseViews     );
    1046   xDeleteArray( m_aiBaseViewShiftParameter,  m_iNumberOfBaseViews, m_iNumberOfBaseViews     );
    1047   xDeleteArray( m_adBaseViewShiftLUT,        m_iNumberOfBaseViews, m_iNumberOfBaseViews,  2 );
    1048   xDeleteArray( m_aiBaseViewShiftLUT,        m_iNumberOfBaseViews, m_iNumberOfBaseViews,  2 );
    1049 
    1050   xDeleteArray( m_adSynthViewShiftParameter, m_iNumberOfBaseViews, std::max((Int) 1 ,m_iNumberOfSynthViews));
    1051   xDeleteArray( m_aiSynthViewShiftParameter, m_iNumberOfBaseViews, std::max((Int) 1 ,m_iNumberOfSynthViews));
    1052   xDeleteArray( m_adSynthViewShiftLUT,       m_iNumberOfBaseViews, std::max((Int) 1 ,m_iNumberOfSynthViews), 2 );
    1053   xDeleteArray( m_aiSynthViewShiftLUT,       m_iNumberOfBaseViews, std::max( (Int)1 ,m_iNumberOfSynthViews), 2 );
    1054 
    1055   xDeleteArray( m_aaiCodedScale,             m_iNumberOfBaseViews );
    1056   xDeleteArray( m_aaiCodedOffset,            m_iNumberOfBaseViews );
    1057   xDeleteArray( m_aaiScaleAndOffsetSet,      m_iNumberOfBaseViews );
    1058 
    1059 }
    1060 
    1061 Void
    1062 TAppComCamPara::xSetupBaseViewsFromCoded()
    1063 {
    1064   //===== get and sort views given in camera parameter file and set list of base views and related arrays =====
    1065   // get left-right order and coding order from cfg-file
    1066   std::vector<Int> aiViewOrderIdx;   // Left Right Order
    1067   std::vector<Int> aiViewId ;        // Coding     Order
    1068 
    1069   Int iMinViewOrderIdx = MAX_INT;
    1070   for( UInt uiRow = 0; uiRow < m_aadCameraParameters.size(); uiRow++ )
    1071   {
    1072     if (m_aadCameraParameters[uiRow].size() != 2 )
    1073       break;
    1074 
    1075     Int iViewOrderIdx  = (Int)( m_aadCameraParameters[ uiRow ][ 1 ] );
    1076     iMinViewOrderIdx   = std::min( iViewOrderIdx, iMinViewOrderIdx );
    1077 
    1078     aiViewOrderIdx     .push_back( iViewOrderIdx );
    1079     aiViewId           .push_back( (Int) m_aadCameraParameters[ uiRow ][ 0 ]  );
    1080   }
    1081 
    1082   // create base view numbers
    1083   AOT( aiViewId.size() != aiViewOrderIdx.size() );
    1084   m_iNumberOfBaseViews = (Int) aiViewId.size();
    1085   for (Int iCurBaseView = 0; iCurBaseView < m_iNumberOfBaseViews; iCurBaseView++ )
    1086   {
    1087     aiViewOrderIdx[iCurBaseView] = ( aiViewOrderIdx[iCurBaseView] - iMinViewOrderIdx);
    1088     m_aiBaseViews      .push_back(  aiViewOrderIdx[iCurBaseView] * ( (Int) m_dViewNumPrec) );
    1089     m_aiBaseId2SortedId.push_back( iCurBaseView );
    1090     m_aiBaseSortedId2Id.push_back( iCurBaseView );
    1091   }
    1092 
    1093   m_iNumberOfBaseViews = (Int) m_aiBaseViews.size();
    1094 
    1095   std::vector<Int> aiSortedViewOrderIdx = aiViewOrderIdx;
    1096 
    1097   // sort base views according to View Order Idx
    1098   m_aiSortedBaseViews = m_aiBaseViews;
    1099   for (Int iCurBaseView = 1; iCurBaseView < m_iNumberOfBaseViews; iCurBaseView++ )
    1100   {
    1101     Int iCurViewOrder = aiSortedViewOrderIdx[iCurBaseView];
    1102     for (Int iCurSearchPos = iCurBaseView; iCurSearchPos >= 0; iCurSearchPos-- )
    1103     {
    1104       if ( iCurViewOrder < aiSortedViewOrderIdx[iCurSearchPos] )
    1105       {
    1106         Int iTempViewId = m_aiSortedBaseViews[iCurSearchPos];
    1107         m_aiSortedBaseViews[iCurSearchPos] = m_aiSortedBaseViews[iCurBaseView];
    1108         m_aiSortedBaseViews[iCurBaseView ] = iTempViewId;
    1109 
    1110         Int iTempViewOrderIdx = aiSortedViewOrderIdx[iCurSearchPos];
    1111         aiSortedViewOrderIdx[iCurSearchPos] = aiSortedViewOrderIdx[iCurBaseView];
    1112         aiSortedViewOrderIdx[iCurBaseView ] = iTempViewOrderIdx;
    1113 
    1114         Int iTempPos = m_aiBaseSortedId2Id[iCurSearchPos];
    1115         m_aiBaseSortedId2Id[iCurSearchPos] = m_aiBaseSortedId2Id[iCurBaseView];
    1116         m_aiBaseSortedId2Id[iCurBaseView] = iTempPos;
    1117         iCurBaseView--;
    1118       }
    1119     }
    1120   }
    1121 
    1122   for (Int iCurBaseView = 0; iCurBaseView < m_iNumberOfBaseViews; iCurBaseView++ )
    1123   {
    1124     m_aiBaseId2SortedId[m_aiBaseSortedId2Id[iCurBaseView]] = iCurBaseView;
    1125   }
    1126 
    1127   m_aiViewsInCfgFile = m_aiSortedBaseViews;
    1128 
    1129   // check
    1130   if( m_aiViewsInCfgFile.size() < 2 )
    1131   {
    1132     std::cerr << "Failed reading camera parameter file" << std::endl;
    1133     std::cerr << "At least two views must be given" << std::endl;
    1134     AOT(true);
    1135     exit( EXIT_FAILURE );
    1136   }
    1137 
    1138   // translate coding order to view order
    1139   for( UInt uiRow = 0; uiRow < m_aadCameraParameters.size(); uiRow++ )
    1140 {
    1141     if (m_aadCameraParameters[uiRow].size() == 2 )
    1142       continue;
    1143 
    1144     m_aadCameraParameters[ uiRow ][ 2 ] = (Double) aiViewOrderIdx[ xGetViewId( aiViewId, (Int) m_aadCameraParameters[ uiRow ][ 2 ] ) ];
    1145     m_aadCameraParameters[ uiRow ][ 3 ] = (Double) aiViewOrderIdx[ xGetViewId( aiViewId, (Int) m_aadCameraParameters[ uiRow ][ 3 ] ) ];
    1146   }
    1147 }
    1148 
    1149 Void TAppComCamPara::xSetupBaseViews( Char* pchBaseViewNumbers, UInt uiNumBaseViews )
    1150   {
    1151     // init list
    1152     std::vector<Int> aiViewsInCfg;
    1153     for( UInt uiRow = 0; uiRow < m_aadCameraParameters.size(); uiRow++ )
    1154     {
    1155       aiViewsInCfg.push_back( (Int)( m_aadCameraParameters[ uiRow ][ 0 ] * m_dViewNumPrec ) );
    1156     }
    1157     // remove duplicated items
    1158     std::sort( aiViewsInCfg.begin(), aiViewsInCfg.end() );
    1159     std::vector<Int>::iterator cIterNewEnd = std::unique( aiViewsInCfg.begin(), aiViewsInCfg.end() );
    1160     aiViewsInCfg.erase( cIterNewEnd, aiViewsInCfg.end() );
    1161     // sort (from left to right)
    1162     std::vector<Int> aiDummyI2SI, aiDummySI2I;
    1163     xGetSortedViewList( aiViewsInCfg, m_aiViewsInCfgFile, aiDummyI2SI, aiDummySI2I );
    1164     // check
    1165     if( m_aiViewsInCfgFile.size() < 2 )
    1166     {
    1167       std::cerr << "Failed reading config file" << std::endl;
    1168       std::cerr << "At least two views must be given" << std::endl;
    1169       exit( EXIT_FAILURE );
    1170     }
    1171 
    1172 
    1173 
    1174   //===== set list of base views and related arrays =====
    1175   if( pchBaseViewNumbers == 0 )
    1176   {
    1177     std::cerr << "BaseViewCameraNumbers must be given" << std::endl;
    1178     exit( EXIT_FAILURE );
    1179   };
    1180 
    1181   convertNumberString( pchBaseViewNumbers, m_aiBaseViews, m_dViewNumPrec  );
    1182   while( (UInt)m_aiBaseViews.size() > uiNumBaseViews )
    1183   {
    1184     m_aiBaseViews.pop_back();
    1185   }
    1186   xGetSortedViewList( m_aiBaseViews, m_aiSortedBaseViews, m_aiBaseId2SortedId, m_aiBaseSortedId2Id );
    1187   m_iNumberOfBaseViews = (Int)m_aiBaseViews.size();
    1188 }
    1189 
    1190 
    1191 Void
    1192 TAppComCamPara::init( UInt   uiNumBaseViews,
    1193                       UInt   uiInputBitDepth,
    1194                       UInt   uiCodedCamParsPrecision,
    1195                       UInt   uiStartFrameId,
    1196                       UInt   uiNumFrames,
    1197                       Char*  pchCfgFileName,
    1198                       Char*  pchBaseViewNumbers,
    1199                       Char*  pchSynthViewNumbers,
    1200                       std::vector<Int>* paiSynthViewNumbers,
    1201                       Int    iLog2Precision )
    1202 {
    1203   //===== set miscellaneous variables =====
    1204   m_uiInputBitDepth         = uiInputBitDepth;
    1205   m_uiFirstFrameId          = uiStartFrameId;
    1206   m_uiLastFrameId           = uiStartFrameId + uiNumFrames - 1;
    1207   m_uiCamParsCodedPrecision = uiCodedCamParsPrecision;
    1208   m_iLog2Precision          = iLog2Precision;
    1209 
    1210   xReadCameraParameterFile( pchCfgFileName );
    1211 
    1212   m_bSetupFromCoded         = ( m_aadCameraParameters[ 0 ].size() == 2 );
    1213 
    1214   if ( m_bSetupFromCoded )
    1215   {
    1216     std::cout << "Detected decoded camera parameter file. Overwriting base view settings from cfg file. " << std::endl;
    1217     xSetupBaseViewsFromCoded();
    1218   }
    1219   else
    1220   {
    1221     xSetupBaseViews( pchBaseViewNumbers, uiNumBaseViews );
    1222   }
    1223 
    1224   //===== set list of external (virtual) views =====
    1225   m_aiSynthViews.clear();
    1226 
    1227   if( pchSynthViewNumbers != 0 || paiSynthViewNumbers != 0)
    1228   {
    1229     std::vector<Int> aiTmpSynthViews;
    1230 
    1231     AOT( ( pchSynthViewNumbers != NULL ) && ( paiSynthViewNumbers != NULL ) );
    1232 
    1233     if ( pchSynthViewNumbers != NULL )
    1234     {
    1235       convertNumberString( pchSynthViewNumbers, aiTmpSynthViews, m_dViewNumPrec );
    1236     }
    1237     else
    1238     {
    1239       aiTmpSynthViews = (*paiSynthViewNumbers);
    1240     }
    1241 
    1242     for( UInt uiSId = 0; uiSId < (UInt)aiTmpSynthViews.size(); uiSId++ )
    1243     {
    1244 
    1245       Int iViewNumPrec        = (Int) m_dViewNumPrec;
    1246       Int iLeftBaseViewIdx    =   aiTmpSynthViews[ uiSId ]                        / iViewNumPrec;
    1247       Int iRightBaseViewIdx   = ( aiTmpSynthViews[ uiSId ] + (iViewNumPrec - 1) ) / iViewNumPrec;
    1248 
    1249       if ( iLeftBaseViewIdx < 0 || iRightBaseViewIdx >= m_iNumberOfBaseViews )
    1250       {
    1251         std::cerr << "SynthViewCameraNumbers must be greater and equal to 0 and smaller than number of base views" << std::endl;
    1252         AOT(true);
    1253         exit( EXIT_FAILURE );
    1254       }
    1255 
    1256       Int64  iLeftBaseViewRelNum = iLeftBaseViewIdx  * iViewNumPrec;
    1257       Int64 iRightBaseViewRelNum = iRightBaseViewIdx * iViewNumPrec;
    1258 
    1259       Int64 iDiffBaseViewRelNum  = iRightBaseViewRelNum - iLeftBaseViewRelNum;
    1260 
    1261       Int64 iSynthViewRelNum     = aiTmpSynthViews[ uiSId ];
    1262       Int64 iLeftBaseNum         = m_aiSortedBaseViews[ iLeftBaseViewIdx  ];
    1263       Int64 iRightBaseNum        = m_aiSortedBaseViews[ iRightBaseViewIdx ];
    1264       Int64 iDiffBaseNum         = iRightBaseNum - iLeftBaseNum;
    1265       Int64 iSynthViewNum;
    1266 
    1267       if ( iDiffBaseViewRelNum != 0)
    1268       {
    1269         AOT( (Int) iDiffBaseViewRelNum != iViewNumPrec );
    1270         Int iFact = iDiffBaseNum > 0 ? 1 : -1;
    1271         iSynthViewNum = iLeftBaseNum + ( iDiffBaseNum * ( iSynthViewRelNum - iLeftBaseViewRelNum ) + (iViewNumPrec >> 1) * iFact ) / ( iViewNumPrec );
    1272       }
    1273       else
    1274       {
    1275         iSynthViewNum = iLeftBaseNum;
    1276       }
    1277 
    1278       m_aiRelSynthViewsNum.push_back(  aiTmpSynthViews[ uiSId ] );
    1279       m_aiSynthViews      .push_back(  (Int) iSynthViewNum  );
    1280     }
    1281   }
    1282   m_iNumberOfSynthViews = (Int)m_aiSynthViews.size();
    1283 
    1284 
    1285   //===== set derived parameters =====
    1286 #if !HHI_CAM_PARA_K0052
    1287   xGetViewOrderIndices( m_aiBaseId2SortedId, m_aiViewOrderIndex );
    1288 #endif
    1289   m_bCamParsVaryOverTime = xGetCamParsChangeFlag();
    1290 
    1291 
    1292   //===== create arrays =====
    1293   xCreateLUTs   ( (UInt)m_iNumberOfBaseViews, (UInt)m_iNumberOfBaseViews,  m_adBaseViewShiftLUT,  m_aiBaseViewShiftLUT,  m_adBaseViewShiftParameter,  m_aiBaseViewShiftParameter  );
    1294   xCreateLUTs   ( (UInt)m_iNumberOfBaseViews, (UInt)m_iNumberOfSynthViews, m_adSynthViewShiftLUT, m_aiSynthViewShiftLUT, m_adSynthViewShiftParameter, m_aiSynthViewShiftParameter );
    1295   xCreate2dArray( (UInt)m_iNumberOfBaseViews, (UInt)m_iNumberOfBaseViews,  m_aaiCodedScale           );
    1296   xCreate2dArray( (UInt)m_iNumberOfBaseViews, (UInt)m_iNumberOfBaseViews,  m_aaiCodedOffset          );
    1297   xCreate2dArray( (UInt)m_iNumberOfBaseViews, (UInt)m_iNumberOfBaseViews,  m_aaiScaleAndOffsetSet    );
    1298   xInit2dArray  ( (UInt)m_iNumberOfBaseViews, (UInt)m_iNumberOfBaseViews,  m_aaiScaleAndOffsetSet, 0 );
    1299 
    1300   //===== init arrays for first frame =====
    1301   xSetShiftParametersAndLUT( m_uiFirstFrameId );
    1302 }
    1303 
    1304 
    1305 Void
    1306 TAppComCamPara::check( Bool bCheckViewRange, Bool bCheckFrameRange )
    1307 {
    1308   if( bCheckFrameRange )
    1309   {
    1310     Double dDummy;
    1311 
    1312     for( UInt uiBaseView = 0; uiBaseView < m_aiBaseViews.size(); uiBaseView++ )
    1313     {
    1314       if ( m_bSetupFromCoded )
    1315       {
    1316         for( UInt uiTargetView = 0; uiTargetView < m_aiBaseViews.size(); uiTargetView++ )
    1317         {
    1318           if ( uiTargetView == uiBaseView )
    1319             continue;
    1320 
    1321           for( UInt uiFrame = m_uiFirstFrameId; uiFrame <= m_uiLastFrameId; uiFrame++ )
    1322           {
    1323             Int iDummy;
    1324 
    1325             xGetCodedCameraData( uiBaseView, uiTargetView, true , uiFrame, iDummy, iDummy, iDummy );
    1326           }
    1327         }
    1328       }
    1329       else
    1330       {
    1331         for( UInt uiFrame = m_uiFirstFrameId; uiFrame <= m_uiLastFrameId; uiFrame++ )
    1332         {
    1333           Bool bInterpolatedCur;
    1334           xGetGeometryData( m_aiBaseViews[ uiBaseView ], uiFrame, dDummy, dDummy, dDummy, bInterpolatedCur );
    1335           xGetZNearZFar   ( m_aiBaseViews[ uiBaseView ], uiFrame, dDummy, dDummy );
    1336 
    1337           if( bInterpolatedCur )
    1338           {
    1339             std::cerr << "Error: CameraParameters for BaseView " << (Double)m_aiBaseViews[ uiBaseView ] / m_dViewNumPrec << " and Frame " << uiFrame << " not defined. "  << std::endl;
    1340             exit( EXIT_FAILURE );
    1341           }
    1342         }
    1343       }
    1344     }
    1345 
    1346     Bool bIgnoreFirst = true;     
    1347     for( UInt uiERView = 0; uiERView < m_aiSynthViews.size() && !m_bSetupFromCoded; uiERView++ )
    1348     {
    1349       if ( xIsIn(m_aiViewsInCfgFile, m_aiSynthViews[ uiERView ] ) )
    1350       {
    1351         if ( bIgnoreFirst )
    1352         {
    1353           std::cout << "Ignoring CameraParameterFile entries for virtual view(s): " ;
    1354           //GT: Integer precision virtual view camera parameters are always interpolated from coded views camera parameters.
    1355           bIgnoreFirst = false;
    1356         }
    1357         std::cout << (Double)m_aiSynthViews[ uiERView ] / m_dViewNumPrec << " " ;
    1358       }
    1359     }
    1360     if ( !bIgnoreFirst )
    1361     {
    1362       std::cout << std::endl;
    1363     }
    1364 
    1365     Bool bInterpolateFirst = true;
    1366     Bool bAnyInterpolated  = false;
    1367     for( UInt uiERView = 0; uiERView < m_aiSynthViews.size() && !m_bSetupFromCoded; uiERView++ )
    1368     {
    1369       Bool bInterpolated = false;
    1370       for( UInt uiFrame = m_uiFirstFrameId; uiFrame <= m_uiLastFrameId; uiFrame++ )
    1371       {
    1372         Bool bInterpolatedCur;
    1373         xGetGeometryData( m_aiSynthViews[ uiERView ], uiFrame, dDummy, dDummy, dDummy, bInterpolatedCur );
    1374         bInterpolated |= bInterpolatedCur;
    1375       }
    1376      
    1377       if( bInterpolated )
    1378       {
    1379         bAnyInterpolated = true;
    1380         if ( bInterpolateFirst )
    1381         {
    1382           std::cout << "Interpolating camera parameters      for virtual view(s): " ;
    1383             bInterpolateFirst = false;
    1384         }         
    1385         std::cout << (Double)m_aiSynthViews[ uiERView ] / m_dViewNumPrec << " " ;
    1386       }
    1387     }
    1388     if ( bAnyInterpolated )
    1389       std::cout << std::endl;
    1390   }
    1391 
    1392   if( bCheckViewRange )
    1393   {
    1394     Bool bAllExist = true;
    1395     for( Int iSynthViewIdx = 0; iSynthViewIdx < m_iNumberOfSynthViews; iSynthViewIdx++ )
    1396     {
    1397       Bool bIsBaseView;
    1398       Int  iDummy;
    1399       Bool bExist = getLeftRightBaseView( iSynthViewIdx, iDummy, iDummy, iDummy, bIsBaseView );
    1400       bAllExist  &= ( bExist || bIsBaseView );
    1401     }
    1402     if( !bAllExist )
    1403     {
    1404       std::cerr << "SynthViewNumbers must be within the range of BaseViewNumbers"  << std::endl;
    1405       exit( EXIT_FAILURE );
    1406     }
    1407   }
    1408 }
    1409 
    1410 
    1411 Void
    1412 TAppComCamPara::update( UInt uiFrameId )
    1413 {
    1414 
    1415   m_iCurrentFrameId = uiFrameId;
    1416   m_bCamParsCodedPrecSet = false;
    1417 
    1418   if ( m_bCamParsVaryOverTime )
    1419   {
    1420     xSetShiftParametersAndLUT( m_uiFirstFrameId + uiFrameId );
    1421   }
    1422 }
    1423 
    1424 #if H_3D_VSO
    1425 Void
    1426 TAppComCamPara::setDispCoeff( UInt uiFrameId, Int iViewIdx )
    1427 {
    1428   UInt uiFrame = m_uiFirstFrameId + uiFrameId;
    1429   Int  iSourceViewNum = m_aiBaseViews[ iViewIdx ];
    1430   Double dBaseLine = 0.0;
    1431   Double dFL1, dCS1, dCP1, dZN1, dZF1;
    1432   Bool bInterpolated;
    1433   double dPos[3];
    1434 
    1435   if( m_iNumberOfBaseViews == 3 )
    1436   {
    1437     xGetGeometryData( m_aiBaseViews[0], uiFrame, dFL1, dPos[0], dCS1, bInterpolated );
    1438     xGetGeometryData( m_aiBaseViews[1], uiFrame, dFL1, dPos[1], dCS1, bInterpolated );
    1439     xGetGeometryData( m_aiBaseViews[2], uiFrame, dFL1, dPos[2], dCS1, bInterpolated );
    1440 
    1441     xGetGeometryData( iSourceViewNum, uiFrame, dFL1, dCP1, dCS1, bInterpolated );
    1442     xGetZNearZFar   ( iSourceViewNum, uiFrame, dZN1, dZF1 );
    1443 
    1444     dBaseLine = ( std::max( dPos[0], std::max( dPos[1], dPos[2] ) ) - std::min( dPos[0], std::min( dPos[1], dPos[2] ) ) ) / 2.0;
    1445   }
    1446   else if( m_iNumberOfBaseViews == 2 )
    1447   {
    1448     xGetGeometryData( m_aiBaseViews[0], uiFrame, dFL1, dPos[0], dCS1, bInterpolated );
    1449     xGetGeometryData( m_aiBaseViews[1], uiFrame, dFL1, dPos[1], dCS1, bInterpolated );
    1450 
    1451     xGetGeometryData( iSourceViewNum, uiFrame, dFL1, dCP1, dCS1, bInterpolated );
    1452     xGetZNearZFar   ( iSourceViewNum, uiFrame, dZN1, dZF1 );
    1453 
    1454     dBaseLine = dPos[0] - dPos[1];
    1455   }
    1456 
    1457   m_dDispCoeff = fabs( dFL1 * ( dBaseLine / 2.0 ) / 255.0 * ( 1.0/dZN1 - 1.0/dZF1 ) );
    1458 }
    1459 #endif
    1460 
    1461 Bool
    1462 TAppComCamPara::getLeftRightBaseView( Int iSynthViewIdx, Int &riLeftViewIdx, Int &riRightViewIdx, Int &riRelDistToLeft, Bool& rbIsBaseView )
    1463 {
    1464   Int    iLeftSortedViewIdx, iRightSortedViewIdx, iDummy;
    1465   Bool   bExist  = xGetLeftRightView( m_aiSynthViews[ iSynthViewIdx ], m_aiSortedBaseViews, iDummy, iDummy, iLeftSortedViewIdx, iRightSortedViewIdx );
    1466   rbIsBaseView   = ( iLeftSortedViewIdx == iRightSortedViewIdx && iLeftSortedViewIdx != -1 );
    1467 
    1468   Int iLeftViewIdx  = ( iLeftSortedViewIdx  != -1 ? m_aiBaseSortedId2Id[ iLeftSortedViewIdx  ] : -1 );
    1469   Int iRightViewIdx = ( iRightSortedViewIdx != -1 ? m_aiBaseSortedId2Id[ iRightSortedViewIdx ] : -1 );
    1470 
    1471   if ( iLeftSortedViewIdx != -1 && iRightSortedViewIdx != -1 )
    1472   {
    1473     riRelDistToLeft = getRelDistLeft(  iSynthViewIdx, iLeftViewIdx, iRightViewIdx);
    1474   }
    1475   else
    1476   {
    1477     riRelDistToLeft = -1;
    1478   }
    1479 
    1480   riLeftViewIdx  = iLeftViewIdx;
    1481   riRightViewIdx = iRightViewIdx;
    1482 
    1483   return bExist;
    1484 }
    1485 
    1486 Bool
    1487   TAppComCamPara::xIsIn( std::vector<Int>& rVec, Int iElem)
    1488 {
    1489   Bool bFound = false;
    1490   for (Int idx = 0; idx < rVec.size() && !bFound; idx++)
    1491   {
    1492     bFound = bFound || rVec[idx] == iElem;
    1493   }
    1494   return bFound;
    1495 }
    1496 
    1497 Int TAppComCamPara::getRelDistLeft( Int iSynthViewIdx, Int iLeftViewIdx, Int iRightViewIdx )
    1498 {
    1499   //GT: Get normalized distance
    1500   Int iLeftViewDist  = abs ( m_aiBaseId2SortedId[ iLeftViewIdx  ] * ((Int) m_dViewNumPrec) - m_aiRelSynthViewsNum [ iSynthViewIdx ]);
    1501   Int iRightViewDist = abs ( m_aiBaseId2SortedId[ iRightViewIdx ] * ((Int) m_dViewNumPrec) - m_aiRelSynthViewsNum [ iSynthViewIdx ]);
    1502   Int64 iDistSum = iLeftViewDist + iRightViewDist;
    1503   return (iDistSum == 0) ? (1 << (REN_VDWEIGHT_PREC -1) ) : (Int) (( (((Int64) iLeftViewDist ) << REN_VDWEIGHT_PREC ) + (iDistSum >> 1) )  / iDistSum );
    1504 }
    1505 
    1506 Int
    1507 TAppComCamPara::synthRelNum2Idx( Int iRelNum )
    1508 {
    1509   return xGetViewId(m_aiRelSynthViewsNum, iRelNum );
    1510 }
    1511 #endif
  • branches/HTM-14.0-MV-draft-3/source/Lib/TAppCommon/TAppComCamPara.h

    r1179 r1191  
    6767  Bool                m_bCamParsCodedPrecSet;                 ///< Coded Cam Para precision set for current frame;
    6868 
    69 #if H_3D_REN_MAX_DEV_OUT
    70   Double              m_dMaxShiftDeviation;                   ///< Maximum deviation of shifts with integer precision compare to double precision
    71 #endif
    7269  //SAIT_VSO_EST_A0033
    7370  Double              m_dDispCoeff;
     
    8582
    8683  // SPS and slice header related variables
    87 #if !HHI_CAM_PARA_K0052
    8884  std::vector<Int>    m_aiViewOrderIndex;                     ///< list of view order indices
    89 #endif
    9085  UInt                m_uiCamParsCodedPrecision;              ///< precision for coding of camera parameters (x: max error in disparity is 2^(-x) luma samples)
    9186  Bool                m_bCamParsVaryOverTime;                 ///< flag specifying whether camera parameters vary for given frame numbers
     
    147142  // getting conversion parameters for disparity to virtual depth conversion
    148143  Void  xGetCameraShifts          ( UInt uiSourceView, UInt uiTargetView, UInt uiFrame, Double& rdCamPosShift, Double& rdPicPosShift );
    149 #if !HHI_CAM_PARA_K0052
    150144  Void  xSetPdmConversionParams   ();
    151 #endif
    152145
    153146public:
     
    190183  UInt                getCurFrameId             ()  { return m_iCurrentFrameId;   }
    191184  static Void         convertNumberString       ( Char* pchViewNumberString, std::vector<Int>& raiViewNumbers, Double dViewNumPrec );
    192 #if H_3D_REN_MAX_DEV_OUT
    193   Double              getMaxShiftDeviation      () { return m_dMaxShiftDeviation; };
    194 #endif
    195 
    196 #if H_3D_VSO
    197   // SAIT_VSO_EST_A033
    198   Void                setDispCoeff              ( UInt uiStartFrameId, Int iViewIdx );
    199   Double              getDispCoeff              () { return m_dDispCoeff; }
    200 #endif
     185
    201186
    202187  // function for getting parameters and parameter arrays
     
    220205  Bool                getVaryingCameraParameters()  { return m_bCamParsVaryOverTime;    }
    221206  UInt                getCamParsCodedPrecision  ()  { return m_uiCamParsCodedPrecision; }
    222 #if !HHI_CAM_PARA_K0052
    223207  std::vector<Int>&   getViewOrderIndex         ()  { return m_aiViewOrderIndex;        }
    224 #endif
    225208  Int**               getCodedScale             ()  { return m_aaiCodedScale;           }
    226209  Int**               getCodedOffset            ()  { return m_aaiCodedOffset;          }
  • branches/HTM-14.0-MV-draft-3/source/Lib/TLibCommon/CommonDef.h

    r1180 r1191  
    208208// MERGE
    209209#define MRG_MAX_NUM_CANDS           5
    210 #if H_3D_IV_MERGE
    211 #define MRG_MAX_NUM_CANDS_MEM       (MRG_MAX_NUM_CANDS+1) // one extra for inter-view motion prediction
    212 #endif
    213210// Reference memory management
    214211#define DYN_REF_FREE                0           ///< dynamic free of reference memories
     
    318315};
    319316
    320 #if H_3D
    321 //PICYUV
    322 #define PICYUV_PAD         16
    323 
    324 //RENDERER
    325 #define REN_LUMA_MARGIN   ( g_uiMaxCUWidth + PICYUV_PAD )
    326 #define REN_VDWEIGHT_PREC  8
    327 #define REN_IS_FILLED     ( 1 << REN_VDWEIGHT_PREC )
    328 #define REN_USED_PEL       ( (1 << g_bitDepthY) - 1 )
    329 #define REN_UNUSED_PEL     0
    330 #define REN_IS_HOLE        0
    331 
    332 
    333 // CAMERA PARAMETERS
    334 #define LOG2_DISP_PREC_LUT           2           ///< log2 of disparity precision used in integer disparity LUTs
    335 #define STD_CAM_PARAMETERS_PRECISION 5        ///< quarter luma sample accuarcy for derived disparities (as default)
    336 
    337 #endif // end of H_3D
    338317//! \}
    339318
  • branches/HTM-14.0-MV-draft-3/source/Lib/TLibCommon/ContextTables.h

    r1179 r1191  
    5151#define NUM_SPLIT_FLAG_CTX            3       ///< number of context models for split flag
    5252#define NUM_SKIP_FLAG_CTX             3       ///< number of context models for skip flag
    53 #if SEC_DEPTH_INTRA_SKIP_MODE_K0033
    54 #define NUM_DIS_FLAG_CTX              1
    55 #define NUM_DIS_TYPE_CTX              1       
    56 #else
    57 #if H_3D_SINGLE_DEPTH
    58 #define NUM_SINGLEDEPTH_FLAG_CTX                     1
    59 #define NUM_SINGLE_DEPTH_VALUE_DATA_CTX              1       
    60 #endif
    61 #endif
    6253#define NUM_MERGE_FLAG_EXT_CTX        1       ///< number of context models for merge flag of merge extended
    6354#define NUM_MERGE_IDX_EXT_CTX         1       ///< number of context models for merge index of merge extended
     
    10192#define NUM_CU_TRANSQUANT_BYPASS_FLAG_CTX  1
    10293
    103 #if H_3D_ARP
    104 #define NUM_ARPW_CTX                  3       ///< number of context models for weighting factor index used by advanced residual prediction
    105 #endif
    106 
    107 #if H_3D_IC
    108 #define NUM_IC_FLAG_CTX               1       ///< number of context models for illumination compensation flag
    109 #endif
     94
    11095
    11196#define CNU                          154      ///< dummy initialization value for unused context models 'Context model Not Used'
    11297
    113 #if H_3D_DIM
    114 #define NUM_DEPTH_INTRA_MODE_CTX      1       ///< number of context models for depth intra modes
    115 #define NUM_DDC_FLAG_CTX              2       ///< number of context models for deltaDC flag (DMM or RBC)
    116 #define NUM_DDC_DATA_CTX              1       ///< number of context models for deltaDC data (DMM or RBC)
    117 #if H_3D_DIM_DMM
    118 #define NUM_DMM1_DATA_CTX             1       ///< number of context models for DMM1 data
    119 #endif
    120 #define NUM_ANGLE_FLAG_CTX            1
    121 #endif
    122 
    123 #if H_3D_DIM_SDC
    124 #define SDC_NUM_RESIDUAL_FLAG_CTX     1
    125 #define SDC_NUM_RESIDUAL_CTX          1
    126 #define NUM_SDC_FLAG_CTX              1      ///< number of context
    127 #endif
    128 #if H_3D_DBBP
    129 #define DBBP_NUM_FLAG_CTX                 1
    130 #endif
     98
    13199// ====================================================================================================================
    132100// Tables
     
    158126  { CNU,  CNU,  CNU, },
    159127};
    160 #if SEC_DEPTH_INTRA_SKIP_MODE_K0033
    161 static const UChar
    162 INIT_DIS_FLAG[3][NUM_DIS_FLAG_CTX] = 
    163 {
    164     { 185 },
    165     { 185 },
    166     { 185 },
    167 };
    168 static const UChar
    169 INIT_DIS_TYPE[3][NUM_DIS_TYPE_CTX] =
    170 {
    171     { 137 },
    172     { 137 },
    173     { 137 },
    174 };
    175 #else
    176 #if H_3D_SINGLE_DEPTH
    177 static const UChar
    178 INIT_SINGLEDEPTH_FLAG[3][NUM_SINGLEDEPTH_FLAG_CTX] = 
    179 {
    180   { 185 },
    181   { 185 },
    182   { 185 },
    183 };
    184 static const UChar
    185 INIT_SINGLE_DEPTH_VALUE_DATA[3][NUM_SINGLE_DEPTH_VALUE_DATA_CTX] =
    186 {
    187   { 137 },
    188   { 137 },
    189   { 137 },
    190 };
    191 #endif
    192 #endif
    193128static const UChar
    194129INIT_MERGE_FLAG_EXT[3][NUM_MERGE_FLAG_EXT_CTX] =
     
    379314};
    380315
    381 #if H_3D_ARP
    382 static const UChar
    383 INIT_ARPW[3][NUM_ARPW_CTX] =
    384 {
    385     { 162, 153, 162 },
    386     { 162, 153, 162 },
    387     { 162, 153, 162 },
    388 };
     316
     317
     318//! \}
     319
    389320
    390321#endif
    391 #if H_3D_IC
    392 static const UChar
    393 INIT_IC_FLAG[3][NUM_IC_FLAG_CTX] = 
    394 {
    395     { 154 },
    396     { 154 },
    397     { 154 },
    398 };
    399 
    400 #endif
    401 #if H_3D_DIM
    402 static const UChar
    403 INIT_DEPTH_INTRA_MODE[3][NUM_DEPTH_INTRA_MODE_CTX] =
    404 {
    405   { 154, },
    406   { 154, },
    407   { 154, }
    408 };
    409 
    410 static const UChar
    411 INIT_ANGLE_FLAG[3][NUM_ANGLE_FLAG_CTX] =
    412 {
    413   { 154 },
    414   { 141 },
    415   { 155 },
    416 };
    417 
    418 static const UChar
    419 INIT_DDC_FLAG[3][NUM_DDC_FLAG_CTX] =
    420 {
    421   {0 , CNU},
    422   {0 , CNU},
    423   {64, CNU}
    424 };
    425 static const UChar
    426 INIT_DDC_DATA[3][NUM_DDC_DATA_CTX] =
    427 {
    428   { 154 },
    429   { 154 },
    430   { 154 },
    431 };
    432 #if H_3D_DIM_DMM
    433 static const UChar
    434 INIT_DMM1_DATA[3][NUM_DMM1_DATA_CTX] =
    435 {
    436   { CNU },
    437   { CNU },
    438   { CNU },
    439 };
    440 #endif
    441 #if H_3D_DIM_SDC
    442 static const UChar
    443 INIT_SDC_RESIDUAL_FLAG[3][SDC_NUM_RESIDUAL_FLAG_CTX] =
    444 {
    445   { CNU },
    446   { CNU },
    447   { CNU },
    448 };
    449 static const UChar
    450 INIT_SDC_RESIDUAL[3][SDC_NUM_RESIDUAL_CTX] =
    451 {
    452   { 155 },
    453   { 155 },
    454   { 155 },
    455 };
    456 #endif
    457 #endif
    458 
    459 
    460 //! \}
    461 #if H_3D_DIM_SDC
    462 static const UChar
    463 INIT_SDC_FLAG[3][NUM_SDC_FLAG_CTX] =
    464 {
    465   { 154 }, 
    466   { 154 },
    467   { 154 },
    468 };
    469 #endif
    470 
    471 #if H_3D_DBBP
    472 static const UChar INIT_DBBP_FLAG[3][DBBP_NUM_FLAG_CTX] =
    473 {
    474   { CNU },
    475   { CNU },
    476   { CNU },
    477 };
    478 #endif
    479 
    480 #endif
  • branches/HTM-14.0-MV-draft-3/source/Lib/TLibCommon/TComDataCU.cpp

    r1179 r1191  
    6060 
    6161  m_skipFlag           = NULL;
    62 #if SEC_DEPTH_INTRA_SKIP_MODE_K0033
    63   m_bDISFlag           = NULL;
    64   m_uiDISType          = NULL;
    65 #else
    66 #if H_3D_SINGLE_DEPTH
    67   m_singleDepthFlag     = NULL;
    68   m_apSingleDepthValue  = NULL;
    69 #endif
    70 #endif
    7162  m_pePartSize         = NULL;
    7263  m_pePredMode         = NULL;
     
    117108  m_apiMVPNum[1]       = NULL;
    118109
    119 #if H_3D_DIM
    120   for( Int i = 0; i < DIM_NUM_TYPE; i++ )
    121   {
    122     m_dimDeltaDC[i][0] = NULL;
    123     m_dimDeltaDC[i][1] = NULL;
    124   }
    125 #if H_3D_DIM_DMM
    126   for( Int i = 0; i < DMM_NUM_TYPE; i++ )
    127   {
    128     m_dmmWedgeTabIdx[i] = NULL;
    129   }
    130 #endif
    131 #if H_3D_DIM_SDC
    132   m_pbSDCFlag             = NULL;
    133   m_apSegmentDCOffset[0]  = NULL;
    134   m_apSegmentDCOffset[1]  = NULL;
    135 #endif
    136 #endif
    137110  m_bDecSubCu          = false;
    138111  m_sliceStartCU        = 0;
    139112  m_sliceSegmentStartCU = 0;
    140 #if H_3D_NBDV
    141   m_pDvInfo              = NULL;
    142 #endif
    143 #if H_3D_VSP
    144   m_piVSPFlag            = NULL;
    145 #endif
    146 #if H_3D_SPIVMP
    147   m_pbSPIVMPFlag         = NULL;
    148 #endif
    149 #if H_3D_ARP
    150   m_puhARPW              = NULL;
    151 #endif
    152 #if H_3D_IC
    153   m_pbICFlag             = NULL;
    154 #endif
    155 #if H_3D_INTER_SDC
    156 #endif
    157 #if H_3D_DBBP
    158   m_pbDBBPFlag         = NULL;
    159 #endif
    160113
    161114}
     
    186139
    187140    m_skipFlag           = new Bool[ uiNumPartition ];
    188 #if SEC_DEPTH_INTRA_SKIP_MODE_K0033
    189     m_bDISFlag           = new Bool[ uiNumPartition ];
    190     m_uiDISType          = (UInt*)xMalloc(UInt, uiNumPartition);
    191 #else
    192 #if H_3D_SINGLE_DEPTH
    193     m_singleDepthFlag     = new Bool[ uiNumPartition ];
    194     m_apSingleDepthValue  = (Pel*)xMalloc(Pel, uiNumPartition);
    195 #endif
    196 #endif
    197141    m_pePartSize         = new Char[ uiNumPartition ];
    198142    memset( m_pePartSize, SIZE_NONE,uiNumPartition * sizeof( *m_pePartSize ) );
     
    201145    m_pbMergeFlag        = (Bool*  )xMalloc(Bool,   uiNumPartition);
    202146    m_puhMergeIndex      = (UChar* )xMalloc(UChar,  uiNumPartition);
    203 #if H_3D_VSP
    204     m_piVSPFlag          = (Char*  )xMalloc(Char,   uiNumPartition);
    205 #endif
    206 #if H_3D_SPIVMP
    207     m_pbSPIVMPFlag       = (Bool*  )xMalloc(Bool,   uiNumPartition);
    208 #endif
    209147    m_puhLumaIntraDir    = (UChar* )xMalloc(UChar,  uiNumPartition);
    210148    m_puhChromaIntraDir  = (UChar* )xMalloc(UChar,  uiNumPartition);
     
    230168    m_pcTrCoeffCb        = (TCoeff*)xMalloc(TCoeff, uiWidth*uiHeight/4);
    231169    m_pcTrCoeffCr        = (TCoeff*)xMalloc(TCoeff, uiWidth*uiHeight/4);
    232 #if H_3D_NBDV
    233     m_pDvInfo            = (DisInfo* )xMalloc(DisInfo,  uiNumPartition);
    234 #endif
    235170    memset( m_pcTrCoeffY, 0,uiWidth*uiHeight * sizeof( TCoeff ) );
    236171    memset( m_pcTrCoeffCb, 0,uiWidth*uiHeight/4 * sizeof( TCoeff ) );
     
    266201    m_acCUMvField[1].create( uiNumPartition );
    267202   
    268 #if H_3D_ARP
    269     m_puhARPW            = new UChar[ uiNumPartition];
    270 #endif
    271 #if H_3D_IC
    272     m_pbICFlag           = (Bool* )xMalloc(Bool,   uiNumPartition);
    273 #endif
    274 #if H_3D_DIM
    275     for( Int i = 0; i < DIM_NUM_TYPE; i++ )
    276     {
    277       m_dimDeltaDC[i][0] = (Pel* )xMalloc(Pel, uiNumPartition);
    278       m_dimDeltaDC[i][1] = (Pel* )xMalloc(Pel, uiNumPartition);
    279     }
    280 #if H_3D_DIM_DMM
    281     for( Int i = 0; i < DMM_NUM_TYPE; i++ )
    282     {
    283       m_dmmWedgeTabIdx[i]    = (UInt*)xMalloc(UInt, uiNumPartition);
    284     }
    285 #endif
    286 #if H_3D_DIM_SDC
    287     m_pbSDCFlag             = (Bool*)xMalloc(Bool, uiNumPartition);
    288     m_apSegmentDCOffset[0]  = (Pel*)xMalloc(Pel, uiNumPartition);
    289     m_apSegmentDCOffset[1]  = (Pel*)xMalloc(Pel, uiNumPartition);
    290 #endif
    291 #endif
    292 #if H_3D_DBBP
    293     m_pbDBBPFlag         = (Bool*  )xMalloc(Bool,   uiNumPartition);
    294 #endif
    295203  }
    296204  else
     
    337245
    338246    if ( m_skipFlag           ) { delete[] m_skipFlag;          m_skipFlag          = NULL; }
    339 #if SEC_DEPTH_INTRA_SKIP_MODE_K0033
    340     if ( m_bDISFlag           ) { delete[] m_bDISFlag;   m_bDISFlag     = NULL; }
    341     if ( m_uiDISType         ) { xFree(m_uiDISType);  m_uiDISType    = NULL; }
    342 #else
    343 #if H_3D_SINGLE_DEPTH
    344     if ( m_singleDepthFlag    ) { delete[] m_singleDepthFlag;   m_singleDepthFlag     = NULL; }
    345     if ( m_apSingleDepthValue ) { xFree(m_apSingleDepthValue);  m_apSingleDepthValue  = NULL; }
    346 #endif
    347 #endif
    348247    if ( m_pePartSize         ) { delete[] m_pePartSize;        m_pePartSize        = NULL; }
    349248    if ( m_pePredMode         ) { delete[] m_pePredMode;        m_pePredMode        = NULL; }
     
    355254    if ( m_pbMergeFlag        ) { xFree(m_pbMergeFlag);         m_pbMergeFlag       = NULL; }
    356255    if ( m_puhMergeIndex      ) { xFree(m_puhMergeIndex);       m_puhMergeIndex     = NULL; }
    357 #if H_3D_VSP
    358     if ( m_piVSPFlag          ) { xFree(m_piVSPFlag);           m_piVSPFlag         = NULL; }
    359 #endif
    360 #if H_3D_SPIVMP
    361     if ( m_pbSPIVMPFlag       ) { xFree(m_pbSPIVMPFlag);           m_pbSPIVMPFlag         = NULL; }
    362 #endif
    363256    if ( m_puhLumaIntraDir    ) { xFree(m_puhLumaIntraDir);     m_puhLumaIntraDir   = NULL; }
    364257    if ( m_puhChromaIntraDir  ) { xFree(m_puhChromaIntraDir);   m_puhChromaIntraDir = NULL; }
     
    389282    if ( m_apiMVPNum[0]       ) { delete[] m_apiMVPNum[0];      m_apiMVPNum[0]      = NULL; }
    390283    if ( m_apiMVPNum[1]       ) { delete[] m_apiMVPNum[1];      m_apiMVPNum[1]      = NULL; }
    391 #if H_3D_NBDV
    392     if ( m_pDvInfo            ) { xFree(m_pDvInfo);             m_pDvInfo           = NULL; }
    393 #endif
    394 
    395 
    396 #if H_3D_ARP
    397     if ( m_puhARPW            ) { delete[] m_puhARPW;           m_puhARPW           = NULL; }
    398 #endif
    399 #if H_3D_IC
    400     if ( m_pbICFlag           ) { xFree(m_pbICFlag);            m_pbICFlag          = NULL; }
    401 #endif
     284
     285
    402286    m_acCUMvField[0].destroy();
    403287    m_acCUMvField[1].destroy();
    404288
    405 #if H_3D_DIM
    406     for( Int i = 0; i < DIM_NUM_TYPE; i++ )
    407     {
    408       if ( m_dimDeltaDC[i][0] ) { xFree( m_dimDeltaDC[i][0] ); m_dimDeltaDC[i][0] = NULL; }
    409       if ( m_dimDeltaDC[i][1] ) { xFree( m_dimDeltaDC[i][1] ); m_dimDeltaDC[i][1] = NULL; }
    410     }
    411 #if H_3D_DIM_DMM
    412     for( Int i = 0; i < DMM_NUM_TYPE; i++ )
    413     {
    414       if ( m_dmmWedgeTabIdx[i] ) { xFree( m_dmmWedgeTabIdx[i] ); m_dmmWedgeTabIdx[i] = NULL; }
    415     }
    416 #endif
    417 #if H_3D_DIM_SDC
    418     if ( m_pbSDCFlag            ) { xFree(m_pbSDCFlag);             m_pbSDCFlag             = NULL; }
    419     if ( m_apSegmentDCOffset[0] ) { xFree(m_apSegmentDCOffset[0]);  m_apSegmentDCOffset[0]  = NULL; }
    420     if ( m_apSegmentDCOffset[1] ) { xFree(m_apSegmentDCOffset[1]);  m_apSegmentDCOffset[1]  = NULL; }
    421 #endif   
    422 #endif   
    423 #if H_3D_DBBP
    424     if ( m_pbDBBPFlag         ) { xFree(m_pbDBBPFlag);          m_pbDBBPFlag        = NULL; }
    425 #endif
    426289  }
    427290  m_pcCUAboveLeft       = NULL;
     
    506369    TComDataCU * pcFrom = pcPic->getCU(getAddr());
    507370    m_skipFlag[ui]   = pcFrom->getSkipFlag(ui);
    508 #if SEC_DEPTH_INTRA_SKIP_MODE_K0033
    509     m_bDISFlag[ui]   = pcFrom->getDISFlag(ui);
    510     m_uiDISType[ui]  = pcFrom->getDISType(ui);
    511 #else
    512 #if H_3D_SINGLE_DEPTH
    513     m_singleDepthFlag[ui]    = pcFrom->getSingleDepthFlag(ui);
    514     m_apSingleDepthValue[ui] = pcFrom->getSingleDepthValue(ui);
    515 #endif
    516 #endif
    517371    m_pePartSize[ui] = pcFrom->getPartitionSize(ui);
    518372    m_pePredMode[ui] = pcFrom->getPredictionMode(ui);
    519373    m_CUTransquantBypass[ui] = pcFrom->getCUTransquantBypass(ui);
    520374    m_puhDepth[ui] = pcFrom->getDepth(ui);
    521 #if H_3D_ARP
    522     m_puhARPW   [ui] = pcFrom->getARPW( ui );
    523 #endif
    524 #if H_3D_IC
    525     m_pbICFlag[ui]   =  pcFrom->m_pbICFlag[ui];
    526 #endif
    527375
    528376    m_puhWidth  [ui] = pcFrom->getWidth(ui);
     
    539387    m_pbMergeFlag[ui]=pcFrom->m_pbMergeFlag[ui];
    540388    m_puhMergeIndex[ui]=pcFrom->m_puhMergeIndex[ui];
    541 #if H_3D_VSP
    542     m_piVSPFlag[ui] = pcFrom->m_piVSPFlag[ui];
    543 #endif
    544 #if H_3D_SPIVMP
    545     m_pbSPIVMPFlag[ui] = pcFrom->m_pbSPIVMPFlag[ui];
    546 #endif
    547389    m_puhLumaIntraDir[ui]=pcFrom->m_puhLumaIntraDir[ui];
    548390    m_puhChromaIntraDir[ui]=pcFrom->m_puhChromaIntraDir[ui];
     
    552394    m_puhCbf[2][ui]=pcFrom->m_puhCbf[2][ui];
    553395    m_pbIPCMFlag[ui] = pcFrom->m_pbIPCMFlag[ui];
    554 #if H_3D_DIM_SDC
    555     m_pbSDCFlag[ui] = pcFrom->m_pbSDCFlag[ui];
    556 #endif
    557 #if H_3D_DBBP
    558     m_pbDBBPFlag[ui] = pcFrom->m_pbDBBPFlag[ui];
    559 #endif
    560396  }
    561397 
     
    566402  {
    567403    memset( m_skipFlag          + firstElement, false,                    numElements * sizeof( *m_skipFlag ) );
    568 #if SEC_DEPTH_INTRA_SKIP_MODE_K0033
    569     memset( m_bDISFlag          + firstElement, false,                    numElements * sizeof( *m_bDISFlag ) );
    570     memset( m_uiDISType         + firstElement,     0,                    numElements * sizeof( *m_uiDISType) );
    571 #else
    572 #if H_3D_SINGLE_DEPTH
    573     memset( m_singleDepthFlag     + firstElement, false,                  numElements * sizeof( *m_singleDepthFlag ) );
    574     memset( m_apSingleDepthValue  + firstElement,     0,                  numElements * sizeof( *m_apSingleDepthValue ) );
    575 #endif
    576 #endif
    577404    memset( m_pePartSize        + firstElement, SIZE_NONE,                numElements * sizeof( *m_pePartSize ) );
    578405    memset( m_pePredMode        + firstElement, MODE_NONE,                numElements * sizeof( *m_pePredMode ) );
     
    592419    memset( m_pbMergeFlag       + firstElement, false,                    numElements * sizeof( *m_pbMergeFlag ) );
    593420    memset( m_puhMergeIndex     + firstElement, 0,                        numElements * sizeof( *m_puhMergeIndex ) );
    594 #if H_3D_VSP
    595     memset( m_piVSPFlag         + firstElement, 0,                        numElements * sizeof( *m_piVSPFlag ) );
    596 #endif
    597 #if H_3D_SPIVMP
    598     memset( m_pbSPIVMPFlag      + firstElement, 0,                        numElements * sizeof( *m_pbSPIVMPFlag ) );
    599 #endif
    600421    memset( m_puhLumaIntraDir   + firstElement, DC_IDX,                   numElements * sizeof( *m_puhLumaIntraDir ) );
    601422    memset( m_puhChromaIntraDir + firstElement, 0,                        numElements * sizeof( *m_puhChromaIntraDir ) );
     
    605426    memset( m_puhCbf[2]         + firstElement, 0,                        numElements * sizeof( *m_puhCbf[2] ) );
    606427    memset( m_pbIPCMFlag        + firstElement, false,                    numElements * sizeof( *m_pbIPCMFlag ) );
    607 #if H_3D_ARP
    608     memset( m_puhARPW           + firstElement, 0,                        numElements * sizeof( UChar )         );
    609 #endif
    610 #if H_3D_IC
    611     memset( m_pbICFlag          + firstElement, false,                    numElements * sizeof( *m_pbICFlag )   );
    612 #endif
    613 
    614 
    615 #if H_3D_DIM
    616     for( Int i = 0; i < DIM_NUM_TYPE; i++ )
    617     {
    618       memset( m_dimDeltaDC[i][0] + firstElement, 0,                       numElements * sizeof( *m_dimDeltaDC[i][0] ) );
    619       memset( m_dimDeltaDC[i][1] + firstElement, 0,                       numElements * sizeof( *m_dimDeltaDC[i][1] ) );
    620     }
    621 #if H_3D_DIM_DMM
    622     for( Int i = 0; i < DMM_NUM_TYPE; i++ )
    623     {
    624       memset( m_dmmWedgeTabIdx[i] + firstElement, 0,                      numElements * sizeof( *m_dmmWedgeTabIdx[i] ) );
    625     }
    626 #endif
    627 #if H_3D_DIM_SDC
    628     memset( m_pbSDCFlag             + firstElement,     0,                numElements * sizeof( *m_pbSDCFlag            ) );
    629     memset( m_apSegmentDCOffset[0]  + firstElement,     0,                numElements * sizeof( *m_apSegmentDCOffset[0] ) );
    630     memset( m_apSegmentDCOffset[1]  + firstElement,     0,                numElements * sizeof( *m_apSegmentDCOffset[1] ) );
    631 #endif
    632     m_apDmmPredictor[0] = 0;
    633     m_apDmmPredictor[1] = 0;
    634 #endif
    635 #if H_3D_DBBP
    636     memset( m_pbDBBPFlag        + firstElement, false,                    numElements * sizeof( *m_pbDBBPFlag ) );
    637 #endif
     428
     429
    638430  }
    639431 
     
    758550      m_puhTransformSkip[2][ui] = 0;
    759551      m_skipFlag[ui]   = false;
    760 #if SEC_DEPTH_INTRA_SKIP_MODE_K0033
    761       m_bDISFlag[ui]   = false;
    762       m_uiDISType[ui]  = 0;
    763 #else
    764 #if H_3D_SINGLE_DEPTH
    765       m_singleDepthFlag[ui]     = false;
    766       m_apSingleDepthValue[ui]  = 0;
    767 #endif
    768 #endif
    769552      m_pePartSize[ui] = SIZE_NONE;
    770553      m_pePredMode[ui] = MODE_NONE;
     
    774557      m_pbMergeFlag[ui] = 0;
    775558      m_puhMergeIndex[ui] = 0;
    776 #if H_3D_VSP
    777       m_piVSPFlag[ui] = 0;
    778 #endif
    779 #if H_3D_SPIVMP
    780       m_pbSPIVMPFlag[ui] = 0;
    781 #endif
    782559      m_puhLumaIntraDir[ui] = DC_IDX;
    783560      m_puhChromaIntraDir[ui] = 0;
     
    786563      m_puhCbf[1][ui] = 0;
    787564      m_puhCbf[2][ui] = 0;
    788 #if H_3D_ARP
    789       m_puhARPW[ui] = 0;
    790 #endif
    791 #if H_3D_IC
    792       m_pbICFlag[ui]  = false;
    793 #endif
    794 
    795 
    796 #if H_3D_DIM
    797       for( Int i = 0; i < DIM_NUM_TYPE; i++ )
    798       {
    799         m_dimDeltaDC[i][0] [ui] = 0;
    800         m_dimDeltaDC[i][1] [ui] = 0;
    801       }
    802 #if H_3D_DIM_DMM
    803       for( Int i = 0; i < DMM_NUM_TYPE; i++ )
    804       {
    805         m_dmmWedgeTabIdx[i] [ui] = 0;
    806       }
    807 #endif
    808 #if H_3D_DIM_SDC
    809       m_pbSDCFlag           [ui] = false;
    810       m_apSegmentDCOffset[0][ui] = 0;
    811       m_apSegmentDCOffset[1][ui] = 0;
    812 #endif
    813       m_apDmmPredictor[0] = 0;
    814       m_apDmmPredictor[1] = 0;
    815 #endif
    816 #if H_3D_DBBP
    817       m_pbDBBPFlag[ui] = false;
    818 #endif
     565
     566
    819567    }
    820568  }
     
    874622  memset( m_pbMergeFlag,        0, iSizeInBool  );
    875623  memset( m_puhMergeIndex,      0, iSizeInUchar );
    876 #if H_3D_VSP
    877   memset( m_piVSPFlag,          0, sizeof( Char  ) * m_uiNumPartition );
    878 #endif
    879 #if H_3D_SPIVMP
    880   memset( m_pbSPIVMPFlag,       0, sizeof( Bool  ) * m_uiNumPartition );
    881 #endif
    882624  memset( m_puhLumaIntraDir,    DC_IDX, iSizeInUchar );
    883625  memset( m_puhChromaIntraDir,  0, iSizeInUchar );
     
    891633  memset( m_puhCbf[2],          0, iSizeInUchar );
    892634  memset( m_puhDepth,     uiDepth, iSizeInUchar );
    893 #if H_3D_NBDV && !SEC_ARP_REM_ENC_RESTRICT_K0035
    894   m_pDvInfo->bDV = false;
    895 #endif
    896 #if H_3D_ARP
    897   memset( m_puhARPW,            0, iSizeInUchar  );
    898 #endif
    899635
    900636
     
    904640  memset( m_puhHeight,         uhHeight, iSizeInUchar );
    905641  memset( m_pbIPCMFlag,        0, iSizeInBool  );
    906 #if H_3D_IC
    907   memset( m_pbICFlag,          0, iSizeInBool  );
    908 #endif
    909 #if H_3D_DIM
    910   for( Int i = 0; i < DIM_NUM_TYPE; i++ )
    911   {
    912     memset( m_dimDeltaDC[i][0], 0, sizeof(Pel ) * m_uiNumPartition );
    913     memset( m_dimDeltaDC[i][1], 0, sizeof(Pel ) * m_uiNumPartition );
    914   }
    915 #if H_3D_DIM_DMM
    916   for( Int i = 0; i < DMM_NUM_TYPE; i++ )
    917   {
    918     memset( m_dmmWedgeTabIdx[i], 0, sizeof(UInt) * m_uiNumPartition );
    919   }
    920 #endif
    921 #if H_3D_DIM_SDC
    922   memset( m_pbSDCFlag,            0, sizeof(Bool) * m_uiNumPartition  );
    923   memset( m_apSegmentDCOffset[0], 0, sizeof(Pel) * m_uiNumPartition   );
    924   memset( m_apSegmentDCOffset[1], 0, sizeof(Pel) * m_uiNumPartition   );
    925 #endif
    926   m_apDmmPredictor[0] = 0;
    927   m_apDmmPredictor[1] = 0;
    928 #endif
    929 #if H_3D_DBBP
    930   memset( m_pbDBBPFlag,         0, iSizeInBool  );
    931 #endif
    932642
    933643  for (UInt ui = 0; ui < m_uiNumPartition; ui++)
    934644  {
    935645    m_skipFlag[ui]   = false;
    936 #if SEC_DEPTH_INTRA_SKIP_MODE_K0033
    937     m_bDISFlag[ui]   = false;
    938     m_uiDISType[ui]  = 0;
    939 #else
    940 #if H_3D_SINGLE_DEPTH
    941     m_singleDepthFlag[ui]   = false;
    942     m_apSingleDepthValue[ui]= 0;
    943 #endif
    944 #endif
    945646    m_pePartSize[ui] = SIZE_NONE;
    946647    m_pePredMode[ui] = MODE_NONE;
     
    964665      m_puhTransformSkip[2][ui] = pcCU->getTransformSkip(uiPartOffset+ui,TEXT_CHROMA_V);
    965666      m_skipFlag[ui]   = pcCU->getSkipFlag(uiPartOffset+ui);
    966 #if SEC_DEPTH_INTRA_SKIP_MODE_K0033
    967       m_bDISFlag[ui]    = pcCU->getDISFlag(uiPartOffset+ui);
    968       m_uiDISType[ui]   = pcCU->getDISType(uiPartOffset+ui);
    969 #else
    970 #if H_3D_SINGLE_DEPTH
    971       m_singleDepthFlag[ui]    = pcCU->getSingleDepthFlag(uiPartOffset+ui);
    972       m_apSingleDepthValue[ui] = pcCU->getSingleDepthValue(uiPartOffset+ui);
    973 #endif
    974 #endif
    975667      m_pePartSize[ui] = pcCU->getPartitionSize(uiPartOffset+ui);
    976668      m_pePredMode[ui] = pcCU->getPredictionMode(uiPartOffset+ui);
     
    980672      m_pbMergeFlag[ui]=pcCU->m_pbMergeFlag[uiPartOffset+ui];
    981673      m_puhMergeIndex[ui]=pcCU->m_puhMergeIndex[uiPartOffset+ui];
    982 #if H_3D_VSP
    983       m_piVSPFlag[ui]=pcCU->m_piVSPFlag[uiPartOffset+ui];
    984       m_pDvInfo[ ui ] = pcCU->m_pDvInfo[uiPartOffset+ui];
    985 #endif
    986 #if H_3D_SPIVMP
    987       m_pbSPIVMPFlag[ui]=pcCU->m_pbSPIVMPFlag[uiPartOffset+ui];
    988 #endif
    989674      m_puhLumaIntraDir[ui]=pcCU->m_puhLumaIntraDir[uiPartOffset+ui];
    990675      m_puhChromaIntraDir[ui]=pcCU->m_puhChromaIntraDir[uiPartOffset+ui];
     
    994679      m_puhCbf[2][ui]=pcCU->m_puhCbf[2][uiPartOffset+ui];
    995680
    996 #if H_3D_ARP
    997       m_puhARPW           [ui] = pcCU->getARPW( uiPartOffset+ui );
    998 #endif
    999 #if H_3D_IC
    1000       m_pbICFlag          [ui] = pcCU->m_pbICFlag[uiPartOffset+ui];
    1001 #endif
    1002 
    1003 
    1004 #if H_3D_DIM
    1005       for( Int i = 0; i < DIM_NUM_TYPE; i++ )
    1006       {
    1007         m_dimDeltaDC[i][0] [ui] = pcCU->m_dimDeltaDC[i][0] [uiPartOffset+ui];
    1008         m_dimDeltaDC[i][1] [ui] = pcCU->m_dimDeltaDC[i][1] [uiPartOffset+ui];
    1009       }
    1010 #if H_3D_DIM_DMM
    1011       for( Int i = 0; i < DMM_NUM_TYPE; i++ )
    1012       {
    1013         m_dmmWedgeTabIdx[i] [ui] = pcCU->m_dmmWedgeTabIdx[i] [uiPartOffset+ui];
    1014       }
    1015 #endif
    1016 #if H_3D_DIM_SDC
    1017       m_pbSDCFlag           [ui] = pcCU->m_pbSDCFlag            [ uiPartOffset + ui ];
    1018       m_apSegmentDCOffset[0][ui] = pcCU->m_apSegmentDCOffset[0] [ uiPartOffset + ui ];
    1019       m_apSegmentDCOffset[1][ui] = pcCU->m_apSegmentDCOffset[1] [ uiPartOffset + ui ];
    1020 #endif
    1021 #endif
    1022 #if H_3D_DBBP
    1023       m_pbDBBPFlag[ui]=pcCU->m_pbDBBPFlag[uiPartOffset+ui];
    1024 #endif
     681
     682
    1025683    }
    1026684  }
     
    1118776 
    1119777  m_skipFlag=pcCU->getSkipFlag()          + uiPart;
    1120 #if SEC_DEPTH_INTRA_SKIP_MODE_K0033
    1121   m_bDISFlag     = pcCU->getDISFlag()     + uiPart;
    1122   m_uiDISType    = pcCU->getDISType()     + uiPart;
    1123 #else
    1124 #if H_3D_SINGLE_DEPTH
    1125   m_singleDepthFlag     = pcCU->getSingleDepthFlag()   + uiPart;
    1126   m_apSingleDepthValue  = pcCU->getSingleDepthValue()  + uiPart;
    1127 #endif
    1128 #endif
    1129778  m_phQP=pcCU->getQP()                    + uiPart;
    1130779  m_pePartSize = pcCU->getPartitionSize() + uiPart;
     
    1132781  m_CUTransquantBypass  = pcCU->getCUTransquantBypass()+uiPart;
    1133782 
    1134 #if H_3D_NBDV
    1135   m_pDvInfo             = pcCU->getDvInfo()           + uiPart;
    1136 #endif
    1137783  m_pbMergeFlag         = pcCU->getMergeFlag()        + uiPart;
    1138784  m_puhMergeIndex       = pcCU->getMergeIndex()       + uiPart;
    1139 #if H_3D_VSP
    1140   m_piVSPFlag           = pcCU->getVSPFlag()          + uiPart;
    1141 #endif
    1142 #if H_3D_SPIVMP
    1143   m_pbSPIVMPFlag        = pcCU->getSPIVMPFlag()          + uiPart;
    1144 #endif
    1145 
    1146 #if H_3D_ARP
    1147   m_puhARPW             = pcCU->getARPW()             + uiPart;
    1148 #endif
    1149 #if H_3D_IC
    1150   m_pbICFlag            = pcCU->getICFlag()           + uiPart;
    1151 #endif
     785
    1152786
    1153787
     
    1163797  m_puhCbf[1]= pcCU->getCbf(TEXT_CHROMA_U)        + uiPart;
    1164798  m_puhCbf[2]= pcCU->getCbf(TEXT_CHROMA_V)        + uiPart;
    1165 #if H_3D_DIM
    1166   for( Int i = 0; i < DIM_NUM_TYPE; i++ )
    1167   {
    1168     m_dimDeltaDC[i][0] = pcCU->getDimDeltaDC( i, 0 ) + uiPart;
    1169     m_dimDeltaDC[i][1] = pcCU->getDimDeltaDC( i, 1 ) + uiPart;
    1170   }
    1171 #if H_3D_DIM_DMM
    1172   for( Int i = 0; i < DMM_NUM_TYPE; i++ )
    1173   {
    1174     m_dmmWedgeTabIdx[i] = pcCU->getDmmWedgeTabIdx( i ) + uiPart;
    1175   }
    1176 #endif
    1177 #if H_3D_DIM_SDC
    1178   m_pbSDCFlag               = pcCU->getSDCFlag()              + uiPart;
    1179   m_apSegmentDCOffset[0]    = pcCU->getSDCSegmentDCOffset(0)  + uiPart;
    1180   m_apSegmentDCOffset[1]    = pcCU->getSDCSegmentDCOffset(1)  + uiPart;
    1181 #endif 
    1182 #endif 
    1183 #if H_3D_DBBP
    1184   m_pbDBBPFlag              = pcCU->getDBBPFlag()         + uiPart;
    1185 #endif
    1186799  m_puhDepth=pcCU->getDepth()                     + uiPart;
    1187800  m_puhWidth=pcCU->getWidth()                     + uiPart;
     
    1229842  memcpy(m_sliceSegmentStartCU,pcCU->m_sliceSegmentStartCU+uiPart,sizeof(UInt)*m_uiNumPartition);
    1230843}
    1231 #if H_3D_NBDV
    1232 Void TComDataCU::copyDVInfoFrom (TComDataCU* pcCU, UInt uiAbsPartIdx)
    1233 {
    1234   m_pDvInfo            = pcCU->getDvInfo()                + uiAbsPartIdx;
    1235 }
    1236 #endif
    1237844// Copy inter prediction info from the biggest CU
    1238845Void TComDataCU::copyInterPredInfoFrom    ( TComDataCU* pcCU, UInt uiAbsPartIdx, RefPicList eRefPicList
    1239 #if H_3D_NBDV
    1240   , Bool bNBDV
    1241 #endif
    1242846  )
    1243847{
     
    1260864 
    1261865  m_skipFlag           = pcCU->getSkipFlag ()             + uiAbsPartIdx;
    1262 #if SEC_DEPTH_INTRA_SKIP_MODE_K0033
    1263   m_bDISFlag           = pcCU->getDISFlag ()              + uiAbsPartIdx;
    1264   m_uiDISType          = pcCU->getDISType()               + uiAbsPartIdx;
    1265 #else
    1266 #if H_3D_SINGLE_DEPTH
    1267   m_singleDepthFlag     = pcCU->getSingleDepthFlag ()             + uiAbsPartIdx;
    1268   m_apSingleDepthValue  = pcCU->getSingleDepthValue ()            + uiAbsPartIdx;
    1269 #endif
    1270 #endif
    1271866  m_pePartSize         = pcCU->getPartitionSize ()        + uiAbsPartIdx;
    1272 #if H_3D_NBDV
    1273   if(bNBDV == true)
    1274   {
    1275     m_puhWidth           = pcCU->getWidth ()                + uiAbsPartIdx;
    1276     m_puhHeight          = pcCU->getHeight()                + uiAbsPartIdx;
    1277     m_puhDepth           = pcCU->getDepth ()                + uiAbsPartIdx;
    1278   }
    1279   else
    1280   {
    1281 #endif
    1282867  m_pePredMode         = pcCU->getPredictionMode()        + uiAbsPartIdx;
    1283868  m_CUTransquantBypass = pcCU->getCUTransquantBypass()    + uiAbsPartIdx;
     
    1290875  m_pbMergeFlag        = pcCU->getMergeFlag()             + uiAbsPartIdx;
    1291876  m_puhMergeIndex      = pcCU->getMergeIndex()            + uiAbsPartIdx;
    1292 #if H_3D_VSP
    1293   m_piVSPFlag          = pcCU->getVSPFlag()               + uiAbsPartIdx;
    1294   m_pDvInfo            = pcCU->getDvInfo()                + uiAbsPartIdx;
    1295 #endif
    1296 #if H_3D_SPIVMP
    1297   m_pbSPIVMPFlag       = pcCU->getSPIVMPFlag()               + uiAbsPartIdx;
    1298 #endif
    1299877
    1300878  m_apiMVPIdx[eRefPicList] = pcCU->getMVPIdx(eRefPicList) + uiAbsPartIdx;
    1301879  m_apiMVPNum[eRefPicList] = pcCU->getMVPNum(eRefPicList) + uiAbsPartIdx;
    1302880 
    1303 #if H_3D_ARP
    1304   m_puhARPW            = pcCU->getARPW()                  + uiAbsPartIdx;
    1305 #endif
    1306881
    1307882   
    1308 #if H_3D_DBBP
    1309   m_pbDBBPFlag       = pcCU->getDBBPFlag()              + uiAbsPartIdx;
    1310 #endif
    1311883
    1312884  m_acCUMvField[ eRefPicList ].linkToWithOffset( pcCU->getCUMvField(eRefPicList), uiAbsPartIdx );
     
    1314886  memcpy(m_sliceStartCU,pcCU->m_sliceStartCU+uiAbsPartIdx,sizeof(UInt)*m_uiNumPartition);
    1315887  memcpy(m_sliceSegmentStartCU,pcCU->m_sliceSegmentStartCU+uiAbsPartIdx,sizeof(UInt)*m_uiNumPartition);
    1316 #if H_3D_NBDV
    1317   }
    1318 #endif
    1319 #if H_3D_IC
    1320   m_pbICFlag           = pcCU->getICFlag()                + uiAbsPartIdx;
    1321 #endif
    1322888}
    1323889
     
    1340906  Int sizeInChar  = sizeof( Char ) * uiNumPartition;
    1341907  memcpy( m_skipFlag   + uiOffset, pcCU->getSkipFlag(),       sizeof( *m_skipFlag )   * uiNumPartition );
    1342 #if SEC_DEPTH_INTRA_SKIP_MODE_K0033
    1343   memcpy( m_bDISFlag   + uiOffset, pcCU->getDISFlag(),       sizeof( *m_bDISFlag )   * uiNumPartition );
    1344   memcpy( m_uiDISType  + uiOffset, pcCU->getDISType(),       sizeof( *m_uiDISType )  * uiNumPartition);
    1345 #else
    1346 #if H_3D_SINGLE_DEPTH
    1347   memcpy( m_singleDepthFlag     + uiOffset, pcCU->getSingleDepthFlag(),       sizeof( *m_singleDepthFlag )   * uiNumPartition );
    1348   memcpy( m_apSingleDepthValue  + uiOffset, pcCU->getSingleDepthValue(),      sizeof( *m_apSingleDepthValue ) * uiNumPartition);
    1349 #endif
    1350 #endif
    1351908  memcpy( m_phQP       + uiOffset, pcCU->getQP(),             sizeInChar                        );
    1352909  memcpy( m_pePartSize + uiOffset, pcCU->getPartitionSize(),  sizeof( *m_pePartSize ) * uiNumPartition );
     
    1355912  memcpy( m_pbMergeFlag         + uiOffset, pcCU->getMergeFlag(),         iSizeInBool  );
    1356913  memcpy( m_puhMergeIndex       + uiOffset, pcCU->getMergeIndex(),        iSizeInUchar );
    1357 #if H_3D_VSP
    1358   memcpy( m_piVSPFlag           + uiOffset, pcCU->getVSPFlag(),           sizeof( Char ) * uiNumPartition );
    1359   memcpy( m_pDvInfo             + uiOffset, pcCU->getDvInfo(),            sizeof( *m_pDvInfo ) * uiNumPartition );
    1360 
    1361 #endif
    1362 #if H_3D_SPIVMP
    1363   memcpy( m_pbSPIVMPFlag        + uiOffset, pcCU->getSPIVMPFlag(),        sizeof( Bool ) * uiNumPartition );
    1364 #endif
    1365914  memcpy( m_puhLumaIntraDir     + uiOffset, pcCU->getLumaIntraDir(),      iSizeInUchar );
    1366915  memcpy( m_puhChromaIntraDir   + uiOffset, pcCU->getChromaIntraDir(),    iSizeInUchar );
     
    1377926
    1378927
    1379 #if H_3D_DIM
    1380   for( Int i = 0; i < DIM_NUM_TYPE; i++ )
    1381   {
    1382     memcpy( m_dimDeltaDC[i][0] + uiOffset, pcCU->getDimDeltaDC( i, 0 ), sizeof(Pel ) * uiNumPartition );
    1383     memcpy( m_dimDeltaDC[i][1] + uiOffset, pcCU->getDimDeltaDC( i, 1 ), sizeof(Pel ) * uiNumPartition );
    1384   }
    1385 #if H_3D_DIM_DMM
    1386   for( Int i = 0; i < DMM_NUM_TYPE; i++ )
    1387   {
    1388     memcpy( m_dmmWedgeTabIdx[i] + uiOffset, pcCU->getDmmWedgeTabIdx( i ), sizeof(UInt) * uiNumPartition );
    1389   }
    1390 #endif
    1391 #if H_3D_DIM_SDC
    1392   memcpy( m_pbSDCFlag             + uiOffset, pcCU->getSDCFlag(),             iSizeInBool  );
    1393   memcpy( m_apSegmentDCOffset[0]  + uiOffset, pcCU->getSDCSegmentDCOffset(0), sizeof( Pel ) * uiNumPartition);
    1394   memcpy( m_apSegmentDCOffset[1]  + uiOffset, pcCU->getSDCSegmentDCOffset(1), sizeof( Pel ) * uiNumPartition);
    1395 #endif
    1396 #endif
    1397 #if H_3D_DBBP
    1398   memcpy( m_pbDBBPFlag          + uiOffset, pcCU->getDBBPFlag(),          iSizeInBool  );
    1399 #endif
    1400928
    1401929  memcpy( m_puhDepth  + uiOffset, pcCU->getDepth(),  iSizeInUchar );
     
    1441969  memcpy( m_sliceStartCU        + uiOffset, pcCU->m_sliceStartCU,        sizeof( UInt ) * uiNumPartition  );
    1442970  memcpy( m_sliceSegmentStartCU + uiOffset, pcCU->m_sliceSegmentStartCU, sizeof( UInt ) * uiNumPartition  );
    1443 #if H_3D_ARP
    1444   memcpy( m_puhARPW             + uiOffset, pcCU->getARPW(),              iSizeInUchar );
    1445 #endif
    1446 #if H_3D_IC
    1447   memcpy( m_pbICFlag            + uiOffset, pcCU->getICFlag(),            iSizeInBool );
    1448 #endif
    1449971}
    1450972
     
    1465987
    1466988  memcpy( rpcCU->getSkipFlag() + m_uiAbsIdxInLCU, m_skipFlag, sizeof( *m_skipFlag ) * m_uiNumPartition );
    1467 #if SEC_DEPTH_INTRA_SKIP_MODE_K0033
    1468   memcpy( rpcCU->getDISFlag()  + m_uiAbsIdxInLCU, m_bDISFlag,    sizeof( *m_bDISFlag )  * m_uiNumPartition );
    1469   memcpy( rpcCU->getDISType()  + m_uiAbsIdxInLCU, m_uiDISType,   sizeof( *m_uiDISType ) * m_uiNumPartition );
    1470 #else
    1471 #if H_3D_SINGLE_DEPTH
    1472   memcpy( rpcCU->getSingleDepthFlag()  + m_uiAbsIdxInLCU, m_singleDepthFlag,    sizeof( *m_singleDepthFlag ) * m_uiNumPartition );
    1473   memcpy( rpcCU->getSingleDepthValue() + m_uiAbsIdxInLCU, m_apSingleDepthValue, sizeof( *m_apSingleDepthValue ) * m_uiNumPartition);
    1474 #endif
    1475 #endif
    1476989  memcpy( rpcCU->getQP() + m_uiAbsIdxInLCU, m_phQP, sizeInChar  );
    1477 #if H_3D_NBDV
    1478   memcpy( rpcCU->getDvInfo()         + m_uiAbsIdxInLCU, m_pDvInfo,    sizeof(* m_pDvInfo)     * m_uiNumPartition );
    1479 #endif
    1480990
    1481991
     
    1485995  memcpy( rpcCU->getMergeFlag()         + m_uiAbsIdxInLCU, m_pbMergeFlag,         iSizeInBool  );
    1486996  memcpy( rpcCU->getMergeIndex()        + m_uiAbsIdxInLCU, m_puhMergeIndex,       iSizeInUchar );
    1487 #if H_3D_VSP
    1488   memcpy( rpcCU->getVSPFlag()           + m_uiAbsIdxInLCU, m_piVSPFlag,           sizeof( Char ) * m_uiNumPartition );
    1489   memcpy( rpcCU->getDvInfo()            + m_uiAbsIdxInLCU, m_pDvInfo,             sizeof( *m_pDvInfo ) * m_uiNumPartition );
    1490 #endif
    1491 #if H_3D_SPIVMP
    1492   memcpy( rpcCU->getSPIVMPFlag()        + m_uiAbsIdxInLCU, m_pbSPIVMPFlag,        sizeof( Bool ) * m_uiNumPartition );
    1493 #endif
    1494997  memcpy( rpcCU->getLumaIntraDir()      + m_uiAbsIdxInLCU, m_puhLumaIntraDir,     iSizeInUchar );
    1495998  memcpy( rpcCU->getChromaIntraDir()    + m_uiAbsIdxInLCU, m_puhChromaIntraDir,   iSizeInUchar );
     
    15041007  memcpy( rpcCU->getCbf(TEXT_CHROMA_V) + m_uiAbsIdxInLCU, m_puhCbf[2], iSizeInUchar );
    15051008 
    1506 #if H_3D_DIM
    1507   for( Int i = 0; i < DIM_NUM_TYPE; i++ )
    1508   {
    1509     memcpy( rpcCU->getDimDeltaDC( i, 0 ) + m_uiAbsIdxInLCU, m_dimDeltaDC[i][0], sizeof(Pel ) * m_uiNumPartition );
    1510     memcpy( rpcCU->getDimDeltaDC( i, 1 ) + m_uiAbsIdxInLCU, m_dimDeltaDC[i][1], sizeof(Pel ) * m_uiNumPartition );
    1511   }
    1512 #if H_3D_DIM_DMM
    1513   for( Int i = 0; i < DMM_NUM_TYPE; i++ )
    1514   {
    1515     memcpy( rpcCU->getDmmWedgeTabIdx( i ) + m_uiAbsIdxInLCU, m_dmmWedgeTabIdx[i], sizeof(UInt) * m_uiNumPartition );
    1516   }
    1517 #endif
    1518 #if H_3D_DIM_SDC
    1519   memcpy( rpcCU->getSDCFlag()             + m_uiAbsIdxInLCU, m_pbSDCFlag,      iSizeInBool  );
    1520   memcpy( rpcCU->getSDCSegmentDCOffset(0) + m_uiAbsIdxInLCU, m_apSegmentDCOffset[0], sizeof( Pel ) * m_uiNumPartition);
    1521   memcpy( rpcCU->getSDCSegmentDCOffset(1) + m_uiAbsIdxInLCU, m_apSegmentDCOffset[1], sizeof( Pel ) * m_uiNumPartition);
    1522 #endif
    1523 #endif
    1524 #if H_3D_DBBP
    1525   memcpy( rpcCU->getDBBPFlag()          + m_uiAbsIdxInLCU, m_pbDBBPFlag,          iSizeInBool  );
    1526 #endif
    15271009 
    15281010  memcpy( rpcCU->getDepth()  + m_uiAbsIdxInLCU, m_puhDepth,  iSizeInUchar );
     
    15601042  memcpy( rpcCU->m_sliceStartCU        + m_uiAbsIdxInLCU, m_sliceStartCU,        sizeof( UInt ) * m_uiNumPartition  );
    15611043  memcpy( rpcCU->m_sliceSegmentStartCU + m_uiAbsIdxInLCU, m_sliceSegmentStartCU, sizeof( UInt ) * m_uiNumPartition  );
    1562 #if H_3D_ARP
    1563   memcpy( rpcCU->getARPW()             + m_uiAbsIdxInLCU, m_puhARPW,             iSizeInUchar );
    1564 #endif
    1565 #if H_3D_IC
    1566   memcpy( rpcCU->getICFlag()           + m_uiAbsIdxInLCU, m_pbICFlag,            iSizeInBool );
    1567 #endif
    15681044}
    15691045
     
    15851061  Int sizeInChar  = sizeof( Char ) * uiQNumPart;
    15861062  memcpy( rpcCU->getSkipFlag()       + uiPartOffset, m_skipFlag,   sizeof( *m_skipFlag )   * uiQNumPart );
    1587 #if SEC_DEPTH_INTRA_SKIP_MODE_K0033
    1588   memcpy( rpcCU->getDISFlag()  + uiPartOffset, m_bDISFlag,    sizeof( *m_bDISFlag )   * uiQNumPart );
    1589   memcpy( rpcCU->getDISType()  + uiPartOffset, m_uiDISType,   sizeof( *m_uiDISType )  * uiQNumPart );
    1590 #else
    1591 #if H_3D_SINGLE_DEPTH
    1592   memcpy( rpcCU->getSingleDepthFlag()  + uiPartOffset, m_singleDepthFlag,    sizeof( *m_singleDepthFlag )   * uiQNumPart );
    1593   memcpy( rpcCU->getSingleDepthValue() + uiPartOffset, m_apSingleDepthValue, sizeof( *m_apSingleDepthValue ) * uiQNumPart);
    1594 #endif
    1595 #endif
    15961063  memcpy( rpcCU->getQP() + uiPartOffset, m_phQP, sizeInChar );
    15971064  memcpy( rpcCU->getPartitionSize()  + uiPartOffset, m_pePartSize, sizeof( *m_pePartSize ) * uiQNumPart );
     
    16001067  memcpy( rpcCU->getMergeFlag()         + uiPartOffset, m_pbMergeFlag,         iSizeInBool  );
    16011068  memcpy( rpcCU->getMergeIndex()        + uiPartOffset, m_puhMergeIndex,       iSizeInUchar );
    1602 #if H_3D_VSP
    1603   memcpy( rpcCU->getVSPFlag()           + uiPartOffset, m_piVSPFlag,           sizeof(Char) * uiQNumPart );
    1604 #endif
    1605 #if H_3D_SPIVMP
    1606   memcpy( rpcCU->getSPIVMPFlag()        + uiPartOffset, m_pbSPIVMPFlag,        sizeof(Bool) * uiQNumPart );
    1607 #endif
    16081069  memcpy( rpcCU->getLumaIntraDir()      + uiPartOffset, m_puhLumaIntraDir,     iSizeInUchar );
    16091070  memcpy( rpcCU->getChromaIntraDir()    + uiPartOffset, m_puhChromaIntraDir,   iSizeInUchar );
     
    16181079
    16191080
    1620 #if H_3D_DIM
    1621   for( Int i = 0; i < DMM_NUM_TYPE; i++ )
    1622   {
    1623     memcpy( rpcCU->getDimDeltaDC( i, 0 ) + uiPartOffset, m_dimDeltaDC[i][0], sizeof(Pel ) * uiQNumPart );
    1624     memcpy( rpcCU->getDimDeltaDC( i, 1 ) + uiPartOffset, m_dimDeltaDC[i][1], sizeof(Pel ) * uiQNumPart );
    1625   }
    1626 #if H_3D_DIM_DMM
    1627   for( Int i = 0; i < DMM_NUM_TYPE; i++ )
    1628   {
    1629     memcpy( rpcCU->getDmmWedgeTabIdx( i ) + uiPartOffset, m_dmmWedgeTabIdx[i], sizeof(UInt) * uiQNumPart );
    1630   }
    1631 #endif
    1632 #if H_3D_DIM_SDC
    1633   memcpy( rpcCU->getSDCFlag()             + uiPartOffset, m_pbSDCFlag,      iSizeInBool  );
    1634   memcpy( rpcCU->getSDCSegmentDCOffset(0) + uiPartOffset, m_apSegmentDCOffset[0], sizeof( Pel ) * uiQNumPart);
    1635   memcpy( rpcCU->getSDCSegmentDCOffset(1) + uiPartOffset, m_apSegmentDCOffset[1], sizeof( Pel ) * uiQNumPart);
    1636 #endif
    1637 #endif
    1638 #if H_3D_DBBP
    1639   memcpy( rpcCU->getDBBPFlag()          + uiPartOffset, m_pbDBBPFlag,          iSizeInBool  );
    1640 #endif
    16411081 
    16421082  memcpy( rpcCU->getDepth()  + uiPartOffset, m_puhDepth,  iSizeInUchar );
     
    16751115  memcpy( rpcCU->m_sliceStartCU        + uiPartOffset, m_sliceStartCU,        sizeof( UInt ) * uiQNumPart  );
    16761116  memcpy( rpcCU->m_sliceSegmentStartCU + uiPartOffset, m_sliceSegmentStartCU, sizeof( UInt ) * uiQNumPart  );
    1677 #if H_3D_ARP
    1678   memcpy( rpcCU->getARPW()             + uiPartOffset, m_puhARPW,             iSizeInUchar );
    1679 #endif
    1680 #if H_3D_IC
    1681   memcpy( rpcCU->getICFlag()           + uiPartOffset, m_pbICFlag,            iSizeInBool );
    1682 #endif
    16831117}
    16841118
     
    22011635 
    22021636  iLeftIntraDir  = pcTempCU ? ( pcTempCU->isIntra( uiTempPartIdx ) ? pcTempCU->getLumaIntraDir( uiTempPartIdx ) : DC_IDX ) : DC_IDX;
    2203 #if H_3D_DIM
    2204   mapDepthModeToIntraDir( iLeftIntraDir );
    2205 #endif
    22061637 
    22071638  // Get intra direction of above PU
     
    22091640 
    22101641  iAboveIntraDir = pcTempCU ? ( pcTempCU->isIntra( uiTempPartIdx ) ? pcTempCU->getLumaIntraDir( uiTempPartIdx ) : DC_IDX ) : DC_IDX;
    2211 #if H_3D_DIM
    2212   mapDepthModeToIntraDir( iAboveIntraDir );
    2213 #endif
    22141642 
    22151643  uiPredNum = 3;
     
    23291757}
    23301758
    2331 #if H_3D_ARP
    2332 UInt TComDataCU::getCTXARPWFlag( UInt uiAbsPartIdx )
    2333 {
    2334   TComDataCU* pcTempCU;
    2335   UInt        uiTempPartIdx;
    2336   UInt        uiCtx = 0;
    2337  
    2338   pcTempCU = getPULeft( uiTempPartIdx, m_uiAbsIdxInLCU + uiAbsPartIdx );
    2339   uiCtx    = ( pcTempCU ) ? ((pcTempCU->getARPW( uiTempPartIdx )==0)?0:1) : 0;
    2340     return uiCtx;
    2341 }
    2342 #endif
    2343 #if H_3D_DBBP
    2344 Pel* TComDataCU::getVirtualDepthBlock(UInt uiAbsPartIdx, UInt uiWidth, UInt uiHeight, UInt& uiDepthStride)
    2345 {
    2346   // get coded and reconstructed depth view
    2347   TComPicYuv* depthPicYuv = NULL;
    2348   Pel* pDepthPels = NULL;
    2349  
    2350   // DBBP is a texture coding tool
    2351   if( getSlice()->getIsDepth() )
    2352   {
    2353     return NULL;
    2354   }
    2355  
    2356 #if H_3D_FCO
    2357   TComPic* depthPic = getSlice()->getIvPic(true, getSlice()->getViewIndex() );
    2358  
    2359   if( depthPic && depthPic->getPicYuvRec() != NULL && depthPic->getIsDepth() )  // depth first
    2360   {
    2361     depthPicYuv = depthPic->getPicYuvRec();
    2362     depthPicYuv->extendPicBorder();
    2363    
    2364     // get collocated depth block for current CU
    2365     uiDepthStride = depthPicYuv->getStride();
    2366     pDepthPels    = depthPicYuv->getLumaAddr( getAddr(), uiAbsPartIdx );
    2367   }
    2368   else  // texture first
    2369 #else
    2370   {
    2371     DisInfo DvInfo = getDvInfo(uiAbsPartIdx);
    2372    
    2373     TComPic* baseDepthPic = getSlice()->getIvPic (true, DvInfo.m_aVIdxCan);
    2374    
    2375     if( baseDepthPic == NULL || baseDepthPic->getPicYuvRec() == NULL )
    2376     {
    2377       return NULL;
    2378     }
    2379    
    2380     depthPicYuv   = baseDepthPic->getPicYuvRec();
    2381     depthPicYuv->extendPicBorder();
    2382     uiDepthStride = depthPicYuv->getStride();
    2383    
    2384     Int iBlkX = ( getAddr() % baseDepthPic->getFrameWidthInCU() ) * g_uiMaxCUWidth  + g_auiRasterToPelX[ g_auiZscanToRaster[ getZorderIdxInCU()+uiAbsPartIdx ] ];
    2385     Int iBlkY = ( getAddr() / baseDepthPic->getFrameWidthInCU() ) * g_uiMaxCUHeight + g_auiRasterToPelY[ g_auiZscanToRaster[ getZorderIdxInCU()+uiAbsPartIdx ] ];
    2386    
    2387     Int iPictureWidth  = depthPicYuv->getWidth();
    2388     Int iPictureHeight = depthPicYuv->getHeight();
    2389    
    2390 #if !HS_DBBP_CLEAN_K0048
    2391     Int iWidth  = uiWidth;
    2392     Int iHeight = uiHeight;
    2393 #endif
    2394    
    2395     Bool depthRefineFlag = false;
    2396 #if H_3D_NBDV_REF
    2397     depthRefineFlag = m_pcSlice->getDepthRefinementFlag(  );
    2398 #endif // H_3D_NBDV_REF
    2399    
    2400     TComMv cDv = depthRefineFlag ? DvInfo.m_acDoNBDV : DvInfo.m_acNBDV;
    2401     if( depthRefineFlag )
    2402     {
    2403       cDv.setVer(0);
    2404     }
    2405    
    2406 #if HS_DBBP_CLEAN_K0048
    2407