Changeset 41 in 3DVCSoftware for branches/0.3-poznan-univ/source/App/TAppEncoder/TAppEncCfg.cpp
- Timestamp:
- 26 Mar 2012, 09:03:21 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/0.3-poznan-univ/source/App/TAppEncoder/TAppEncCfg.cpp
r28 r41 110 110 free (m_pchBitstreamFile) ; 111 111 112 #if FLEX_CODING_ORDER 113 if (m_pchMVCJointCodingOrder != NULL) 114 { 115 free(m_pchMVCJointCodingOrder) ; 116 } 117 #endif 118 112 119 for(Int i = 0; i< m_pchDepthReconFileList.size(); i++ ) 113 120 { … … 153 160 string cfg_ReconFile; 154 161 string cfg_dQPFile; 162 163 #if FLEX_CODING_ORDER 164 string cfg_JointCodingOrdering; 165 #endif 166 155 167 po::Options opts; 156 168 opts.addOptions() … … 191 203 ("NumberOfViews", m_iNumberOfViews, 0, "Number of views") 192 204 205 #if FLEX_CODING_ORDER 206 ("3DVFlexOrder", m_b3DVFlexOrder, false, "flexible coding order flag" ) 207 ("3DVCodingOrder", cfg_JointCodingOrdering, string(""), "The coding order for joint texture-depth coding") 208 #endif 193 209 194 210 /* Unit definition parameters */ … … 367 383 #endif 368 384 #if POZNAN_NONLINEAR_DEPTH 369 ("DepthPower,-dpow", m_fDepthPower, (Double)1.0, "Depth power value (for non-linear processing)") 385 ("NonlinearDepth", m_bUseNonlinearDepth, true, "usage of non-linear depth representation") 386 ("NonlinearDepthModel", m_aiNonlinearDepthModel, std::vector<Int>(0,0), "Nodes for definition of non-linear depth representation") 387 #if POZNAN_NONLINEAR_DEPTH_THRESHOLD 388 ("NonlinearDepthThreshold", m_iNonlinearDepthThreshold, 100, "Threshold for usage of Nonlinear depth representation") 389 #endif 370 390 #endif 371 391 … … 398 418 m_pchBitstreamFile = cfg_BitstreamFile.empty() ? NULL : strdup(cfg_BitstreamFile.c_str()); 399 419 m_pchdQPFile = cfg_dQPFile.empty() ? NULL : strdup(cfg_dQPFile.c_str()); 420 421 #if FLEX_CODING_ORDER && HHI_VSO 422 m_pchMVCJointCodingOrder = cfg_JointCodingOrdering.empty()?NULL:strdup(cfg_JointCodingOrdering.c_str()); 423 // If flexible order is enabled and if depth comes before the texture for a view, disable VSO 424 Bool depthComesFirst = false; 425 if ( m_b3DVFlexOrder ) 426 { 427 for(Int iViewIdx=0; iViewIdx<m_iNumberOfViews; iViewIdx++) 428 { 429 for ( Int ii=1; ii<12; ii+=2 ) 430 { 431 Int iViewIdxCfg = (Int)(m_pchMVCJointCodingOrder[ii]-'0'); 432 if ( iViewIdxCfg == iViewIdx ) 433 { 434 if ( m_pchMVCJointCodingOrder[ii-1]=='D' ) // depth comes first for this view 435 { 436 depthComesFirst = true; 437 break; 438 } 439 else 440 { 441 assert(m_pchMVCJointCodingOrder[ii-1]=='T'); 442 } 443 } 444 } 445 } 446 } 447 if (depthComesFirst) 448 { 449 m_bUseVSO = false; 450 } 451 #endif 400 452 401 453 … … 458 510 459 511 #if POZNAN_NONLINEAR_DEPTH 460 if (m_fDepthPower<=0) 461 { 462 Float fDepthQP = m_adQP[ m_adQP.size() < 2 ? 0 : 1]; 463 m_fDepthPower = (fDepthQP-30) *0.25/20.0 + 1.25; 464 if (m_fDepthPower<=1.0) m_fDepthPower = 1.0; 465 // QP = 30 = 1.25 466 // QP = 50 = 1.5 467 if (m_fDepthPower>=1.66) m_fDepthPower = 1.66; 468 }; 469 470 #if POZNAN_NONLINEAR_DEPTH_SEND_AS_BYTE 471 m_fDepthPower = dequantizeDepthPower(quantizeDepthPower((Float)m_fDepthPower)); 472 #endif 473 512 #if POZNAN_NONLINEAR_DEPTH_THRESHOLD 513 if(m_bUseNonlinearDepth && m_iNonlinearDepthThreshold>0) 514 { 515 FILE *base_depth_file; 516 unsigned char *depth_buf; 517 int histogram[256]; 518 int i, size; 519 float weighted_avg; 520 base_depth_file = fopen(m_pchDepthInputFileList[0], "rb"); 521 if (base_depth_file) 522 { 523 size = m_iSourceWidth*m_iSourceHeight; 524 depth_buf = (unsigned char *)malloc(size); 525 fread(depth_buf, 1, size, base_depth_file); 526 fclose(base_depth_file); 527 memset(histogram, 0, sizeof(histogram)); 528 for (i=0; i<size;++i) histogram[depth_buf[i]]++; 529 weighted_avg = 0; 530 for (i=0; i<256; ++i) weighted_avg += i*histogram[i]; 531 weighted_avg /= size; 532 533 if (weighted_avg<m_iNonlinearDepthThreshold) 534 { 535 m_bUseNonlinearDepth = 0; 536 printf ("\nWeighted average of depth histogram:%f < %d, turning NonlinearDepthRepresentation OFF\n", weighted_avg, m_iNonlinearDepthThreshold); 537 } 538 } 539 } 540 #endif 541 542 if(m_bUseNonlinearDepth) 543 { 544 m_cNonlinearDepthModel.m_iNum = (Int)m_aiNonlinearDepthModel.size(); 545 m_cNonlinearDepthModel.m_aiPoints[0]=0; 546 for (int i=0; i<m_cNonlinearDepthModel.m_iNum; ++i) 547 m_cNonlinearDepthModel.m_aiPoints[i+1] = m_aiNonlinearDepthModel[i]; 548 549 m_cNonlinearDepthModel.m_aiPoints[m_cNonlinearDepthModel.m_iNum+1]=0; 550 m_cNonlinearDepthModel.Init(); 551 } 474 552 #endif 475 553 … … 555 633 LOG2_DISP_PREC_LUT 556 634 #if POZNAN_NONLINEAR_DEPTH 557 , m_fDepthPower635 ,(m_bUseNonlinearDepth ? &m_cNonlinearDepthModel : NULL) 558 636 #endif 559 637 ); … … 572 650 LOG2_DISP_PREC_LUT 573 651 #if POZNAN_NONLINEAR_DEPTH 574 , m_fDepthPower652 ,(m_bUseNonlinearDepth ? &m_cNonlinearDepthModel : NULL) 575 653 #endif 576 654 ); … … 589 667 LOG2_DISP_PREC_LUT 590 668 #if POZNAN_NONLINEAR_DEPTH 591 , m_fDepthPower669 ,(m_bUseNonlinearDepth ? &m_cNonlinearDepthModel : NULL) 592 670 #endif 593 671 ); … … 605 683 LOG2_DISP_PREC_LUT 606 684 #if POZNAN_NONLINEAR_DEPTH 607 , m_fDepthPower685 ,(m_bUseNonlinearDepth ? &m_cNonlinearDepthModel : NULL) 608 686 #endif 609 687 ); … … 1064 1142 #endif 1065 1143 #if POZNAN_NONLINEAR_DEPTH 1066 printf(" DepthPower:%f ", m_fDepthPower);1144 printf("NLDR:%d ", m_bUseNonlinearDepth ? 1 : 0); 1067 1145 #endif 1068 1146 printf("\n");
Note: See TracChangeset for help on using the changeset viewer.