Changeset 652 in SHVCSoftware for branches/SHM-6-dev/source/Lib/TLibEncoder
- Timestamp:
- 7 Apr 2014, 23:08:52 (12 years ago)
- Location:
- branches/SHM-6-dev/source/Lib/TLibEncoder
- Files:
-
- 12 edited
-
AnnexBwrite.h (modified) (1 diff)
-
NALwrite.cpp (modified) (1 diff)
-
SEIwrite.cpp (modified) (3 diffs)
-
TEncCavlc.cpp (modified) (1 diff)
-
TEncCfg.h (modified) (2 diffs)
-
TEncGOP.cpp (modified) (14 diffs)
-
TEncGOP.h (modified) (1 diff)
-
TEncSampleAdaptiveOffset.cpp (modified) (15 diffs)
-
TEncSbac.h (modified) (2 diffs)
-
TEncSearch.cpp (modified) (3 diffs)
-
TEncSlice.cpp (modified) (6 diffs)
-
TEncTop.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/SHM-6-dev/source/Lib/TLibEncoder/AnnexBwrite.h
r595 r652 58 58 59 59 static const Char start_code_prefix[] = {0,0,0,1}; 60 if (it == au.begin() || nalu.m_nalUnitType == NAL_UNIT_ SPS || nalu.m_nalUnitType == NAL_UNIT_PPS)60 if (it == au.begin() || nalu.m_nalUnitType == NAL_UNIT_VPS || nalu.m_nalUnitType == NAL_UNIT_SPS || nalu.m_nalUnitType == NAL_UNIT_PPS) 61 61 { 62 62 /* From AVC, When any of the following conditions are fulfilled, the -
branches/SHM-6-dev/source/Lib/TLibEncoder/NALwrite.cpp
r595 r652 91 91 vector<uint8_t>& rbsp = nalu.m_Bitstream.getFIFO(); 92 92 93 #if P0130_EOB 94 if (rbsp.size() == 0) return; 95 #endif 93 if (rbsp.size() == 0) 94 { 95 return; 96 } 96 97 97 98 for (vector<uint8_t>::iterator it = rbsp.begin(); it != rbsp.end();) -
branches/SHM-6-dev/source/Lib/TLibEncoder/SEIwrite.cpp
r644 r652 333 333 Void SEIWriter::xWriteSEIActiveParameterSets(const SEIActiveParameterSets& sei) 334 334 { 335 WRITE_CODE(sei.activeVPSId, 4, "active_vps_id");336 WRITE_FLAG(sei.m_ fullRandomAccessFlag, "full_random_access_flag");337 WRITE_FLAG(sei.m_noParam SetUpdateFlag, "no_param_set_update_flag");335 WRITE_CODE(sei.activeVPSId, 4, "active_video_parameter_set_id"); 336 WRITE_FLAG(sei.m_selfContainedCvsFlag, "self_contained_cvs_flag"); 337 WRITE_FLAG(sei.m_noParameterSetUpdateFlag, "no_parameter_set_update_flag"); 338 338 WRITE_UVLC(sei.numSpsIdsMinus1, "num_sps_ids_minus1"); 339 339 340 assert (sei.activeSeqParamSetId.size() == (sei.numSpsIdsMinus1 + 1)); 341 342 for (Int i = 0; i < sei.activeSeqParamSetId.size(); i++) 343 { 344 WRITE_UVLC(sei.activeSeqParamSetId[i], "active_seq_param_set_id"); 345 } 346 347 UInt uiBits = m_pcBitIf->getNumberOfWrittenBits(); 348 UInt uiAlignedBits = ( 8 - (uiBits&7) ) % 8; 349 if(uiAlignedBits) 350 { 351 WRITE_FLAG(1, "alignment_bit" ); 352 uiAlignedBits--; 353 while(uiAlignedBits--) 354 { 355 WRITE_FLAG(0, "alignment_bit" ); 356 } 357 } 340 assert (sei.activeSeqParameterSetId.size() == (sei.numSpsIdsMinus1 + 1)); 341 342 for (Int i = 0; i < sei.activeSeqParameterSetId.size(); i++) 343 { 344 WRITE_UVLC(sei.activeSeqParameterSetId[i], "active_seq_parameter_set_id"); 345 } 346 xWriteByteAlign(); 358 347 } 359 348 … … 550 539 { 551 540 WRITE_CODE( sei.m_cameraIsoSpeedValue, 32, "camera_iso_speed_value" ); 541 } 542 WRITE_CODE( sei.m_exposureIndexIdc, 8, "exposure_index_idc" ); 543 if( sei.m_exposureIndexIdc == 255) //Extended_ISO 544 { 545 WRITE_CODE( sei.m_exposureIndexValue, 32, "exposure_index_value" ); 552 546 } 553 547 WRITE_FLAG( sei.m_exposureCompensationValueSignFlag, "exposure_compensation_value_sign_flag" ); … … 633 627 for (UInt i = (sei.m_defaultOpFlag ? 1 : 0); i <= sei.m_nestingNumOpsMinus1; i++) 634 628 { 629 WRITE_CODE( sei.m_nestingNoOpMaxTemporalIdPlus1, 3, "nesting_no_op_max_temporal_id" ); 635 630 WRITE_CODE( sei.m_nestingMaxTemporalIdPlus1[i], 3, "nesting_max_temporal_id" ); 636 631 WRITE_UVLC( sei.m_nestingOpIdx[i], "nesting_op_idx" ); -
branches/SHM-6-dev/source/Lib/TLibEncoder/TEncCavlc.cpp
r649 r652 1612 1612 if ( pcSlice->getRapPicFlag() ) 1613 1613 { 1614 #if NO_OUTPUT_OF_PRIOR_PICS1615 WRITE_FLAG( pcSlice->getNoOutput OfPriorPicsFlag(), "no_output_of_prior_pics_flag" );1614 #if SETTING_NO_OUT_PIC_PRIOR 1615 WRITE_FLAG( pcSlice->getNoOutputPriorPicsFlag() ? 1 : 0, "no_output_of_prior_pics_flag" ); 1616 1616 #else 1617 1617 WRITE_FLAG( 0, "no_output_of_prior_pics_flag" ); -
branches/SHM-6-dev/source/Lib/TLibEncoder/TEncCfg.h
r644 r652 235 235 Int m_cameraIsoSpeedIdc; 236 236 Int m_cameraIsoSpeedValue; 237 Int m_exposureIndexIdc; 238 Int m_exposureIndexValue; 237 239 Int m_exposureCompensationValueSignFlag; 238 240 Int m_exposureCompensationValueNumerator; … … 639 641 Void setTMISEICameraIsoSpeedValue(Int b) { m_cameraIsoSpeedValue = b; } 640 642 Int getTMISEICameraIsoSpeedValue() { return m_cameraIsoSpeedValue; } 643 Void setTMISEIExposureIndexIdc(Int b) { m_exposureIndexIdc = b; } 644 Int getTMISEIExposurIndexIdc() { return m_exposureIndexIdc; } 645 Void setTMISEIExposureIndexValue(Int b) { m_exposureIndexValue = b; } 646 Int getTMISEIExposurIndexValue() { return m_exposureIndexValue; } 641 647 Void setTMISEIExposureCompensationValueSignFlag(Int b) { m_exposureCompensationValueSignFlag = b; } 642 648 Int getTMISEIExposureCompensationValueSignFlag() { return m_exposureCompensationValueSignFlag; } -
branches/SHM-6-dev/source/Lib/TLibEncoder/TEncGOP.cpp
r644 r652 75 75 m_iNumPicCoded = 0; //Niko 76 76 m_bFirst = true; 77 #if ALLOW_RECOVERY_POINT_AS_RAP 78 m_iLastRecoveryPicPOC = 0; 79 #endif 77 80 78 81 m_pcCfg = NULL; … … 163 166 SEIActiveParameterSets *seiActiveParameterSets = new SEIActiveParameterSets(); 164 167 seiActiveParameterSets->activeVPSId = m_pcCfg->getVPS()->getVPSId(); 165 seiActiveParameterSets->m_ fullRandomAccessFlag = false;166 seiActiveParameterSets->m_noParam SetUpdateFlag = false;168 seiActiveParameterSets->m_selfContainedCvsFlag = false; 169 seiActiveParameterSets->m_noParameterSetUpdateFlag = false; 167 170 seiActiveParameterSets->numSpsIdsMinus1 = 0; 168 seiActiveParameterSets->activeSeqParam SetId.resize(seiActiveParameterSets->numSpsIdsMinus1 + 1);169 seiActiveParameterSets->activeSeqParam SetId[0] = sps->getSPSId();171 seiActiveParameterSets->activeSeqParameterSetId.resize(seiActiveParameterSets->numSpsIdsMinus1 + 1); 172 seiActiveParameterSets->activeSeqParameterSetId[0] = sps->getSPSId(); 170 173 return seiActiveParameterSets; 171 174 } 172 173 175 174 176 SEIFramePacking* TEncGOP::xCreateSEIFramePacking() … … 271 273 seiToneMappingInfo->m_cameraIsoSpeedValue = m_pcCfg->getTMISEICameraIsoSpeedValue(); 272 274 assert( seiToneMappingInfo->m_cameraIsoSpeedValue !=0 ); 275 seiToneMappingInfo->m_exposureIndexIdc = m_pcCfg->getTMISEIExposurIndexIdc(); 276 seiToneMappingInfo->m_exposureIndexValue = m_pcCfg->getTMISEIExposurIndexValue(); 277 assert( seiToneMappingInfo->m_exposureIndexValue !=0 ); 273 278 seiToneMappingInfo->m_exposureCompensationValueSignFlag = m_pcCfg->getTMISEIExposureCompensationValueSignFlag(); 274 279 seiToneMappingInfo->m_exposureCompensationValueNumerator = m_pcCfg->getTMISEIExposureCompensationValueNumerator(); … … 435 440 UInt *accumNalsDU = NULL; 436 441 SEIDecodingUnitInfo decodingUnitInfoSEI; 442 #if EFFICIENT_FIELD_IRAP 443 Int IRAPGOPid = -1; 444 Bool IRAPtoReorder = false; 445 Bool swapIRAPForward = false; 446 if(isField) 447 { 448 Int pocCurr; 449 #if SVC_EXTENSION 450 for ( Int iGOPid=iPicIdInGOP; iGOPid < iPicIdInGOP+1; iGOPid++ ) 451 #else 452 for ( Int iGOPid=0; iGOPid < m_iGopSize; iGOPid++ ) 453 #endif 454 { 455 // determine actual POC 456 if(iPOCLast == 0) //case first frame or first top field 457 { 458 pocCurr=0; 459 } 460 else if(iPOCLast == 1 && isField) //case first bottom field, just like the first frame, the poc computation is not right anymore, we set the right value 461 { 462 pocCurr = 1; 463 } 464 else 465 { 466 pocCurr = iPOCLast - iNumPicRcvd + m_pcCfg->getGOPEntry(iGOPid).m_POC - isField; 467 } 468 469 // check if POC corresponds to IRAP 470 NalUnitType tmpUnitType = getNalUnitType(pocCurr, m_iLastIDR, isField); 471 if(tmpUnitType >= NAL_UNIT_CODED_SLICE_BLA_W_LP && tmpUnitType <= NAL_UNIT_CODED_SLICE_CRA) // if picture is an IRAP 472 { 473 if(pocCurr%2 == 0 && iGOPid < m_iGopSize-1 && m_pcCfg->getGOPEntry(iGOPid).m_POC == m_pcCfg->getGOPEntry(iGOPid+1).m_POC-1) 474 { // if top field and following picture in enc order is associated bottom field 475 IRAPGOPid = iGOPid; 476 IRAPtoReorder = true; 477 swapIRAPForward = true; 478 break; 479 } 480 if(pocCurr%2 != 0 && iGOPid > 0 && m_pcCfg->getGOPEntry(iGOPid).m_POC == m_pcCfg->getGOPEntry(iGOPid-1).m_POC+1) 481 { 482 // if picture is an IRAP remember to process it first 483 IRAPGOPid = iGOPid; 484 IRAPtoReorder = true; 485 swapIRAPForward = false; 486 break; 487 } 488 } 489 } 490 } 491 #endif 437 492 #if SVC_EXTENSION 438 493 for ( Int iGOPid=iPicIdInGOP; iGOPid < iPicIdInGOP+1; iGOPid++ ) … … 441 496 #endif 442 497 { 498 #if EFFICIENT_FIELD_IRAP 499 if(IRAPtoReorder) 500 { 501 if(swapIRAPForward) 502 { 503 if(iGOPid == IRAPGOPid) 504 { 505 iGOPid = IRAPGOPid +1; 506 } 507 else if(iGOPid == IRAPGOPid +1) 508 { 509 iGOPid = IRAPGOPid; 510 } 511 } 512 else 513 { 514 if(iGOPid == IRAPGOPid -1) 515 { 516 iGOPid = IRAPGOPid; 517 } 518 else if(iGOPid == IRAPGOPid) 519 { 520 iGOPid = IRAPGOPid -1; 521 } 522 } 523 } 524 #endif 443 525 UInt uiColDir = 1; 444 526 //-- For time output for each slice … … 510 592 if(pocCurr>=m_pcCfg->getFramesToBeEncoded()) 511 593 { 594 #if EFFICIENT_FIELD_IRAP 595 if(IRAPtoReorder) 596 { 597 if(swapIRAPForward) 598 { 599 if(iGOPid == IRAPGOPid) 600 { 601 iGOPid = IRAPGOPid +1; 602 IRAPtoReorder = false; 603 } 604 else if(iGOPid == IRAPGOPid +1) 605 { 606 iGOPid --; 607 } 608 } 609 else 610 { 611 if(iGOPid == IRAPGOPid) 612 { 613 iGOPid = IRAPGOPid -1; 614 } 615 else if(iGOPid == IRAPGOPid -1) 616 { 617 iGOPid = IRAPGOPid; 618 IRAPtoReorder = false; 619 } 620 } 621 } 622 #endif 512 623 continue; 513 624 } … … 932 1043 } 933 1044 934 // Do decoding refresh marking if any 935 #if NO_CLRAS_OUTPUT_FLAG 936 pcSlice->decodingRefreshMarking(m_pocCRA, m_bRefreshPending, rcListPic, m_pcEncTop->getNoClrasOutputFlag()); 937 #else 938 pcSlice->decodingRefreshMarking(m_pocCRA, m_bRefreshPending, rcListPic); 939 #endif 940 m_pcEncTop->selectReferencePictureSet(pcSlice, pocCurr, iGOPid); 941 pcSlice->getRPS()->setNumberOfLongtermPictures(0); 1045 #if EFFICIENT_FIELD_IRAP 942 1046 #if FIX1172 943 1047 if ( pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_LP … … 954 1058 pcSlice->setAssociatedIRAPPOC(m_associatedIRAPPOC); 955 1059 #endif 956 1060 #endif 1061 // Do decoding refresh marking if any 1062 #if NO_CLRAS_OUTPUT_FLAG 1063 pcSlice->decodingRefreshMarking(m_pocCRA, m_bRefreshPending, rcListPic, m_pcEncTop->getNoClrasOutputFlag()); 1064 #else 1065 pcSlice->decodingRefreshMarking(m_pocCRA, m_bRefreshPending, rcListPic); 1066 #endif 1067 m_pcEncTop->selectReferencePictureSet(pcSlice, pocCurr, iGOPid); 1068 pcSlice->getRPS()->setNumberOfLongtermPictures(0); 1069 #if EFFICIENT_FIELD_IRAP 1070 #else 1071 #if FIX1172 1072 if ( pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_LP 1073 || pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_RADL 1074 || pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_N_LP 1075 || pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_W_RADL 1076 || pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_N_LP 1077 || pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA ) // IRAP picture 1078 { 1079 m_associatedIRAPType = pcSlice->getNalUnitType(); 1080 m_associatedIRAPPOC = pocCurr; 1081 } 1082 pcSlice->setAssociatedIRAPType(m_associatedIRAPType); 1083 pcSlice->setAssociatedIRAPPOC(m_associatedIRAPPOC); 1084 #endif 1085 #endif 1086 1087 #if ALLOW_RECOVERY_POINT_AS_RAP 1088 if ((pcSlice->checkThatAllRefPicsAreAvailable(rcListPic, pcSlice->getRPS(), false, m_iLastRecoveryPicPOC, m_pcCfg->getDecodingRefreshType() == 3) != 0) || (pcSlice->isIRAP()) 1089 #if EFFICIENT_FIELD_IRAP 1090 || (isField && pcSlice->getAssociatedIRAPType() >= NAL_UNIT_CODED_SLICE_BLA_W_LP && pcSlice->getAssociatedIRAPType() <= NAL_UNIT_CODED_SLICE_CRA && pcSlice->getAssociatedIRAPPOC() == pcSlice->getPOC()+1) 1091 #endif 1092 ) 1093 { 1094 pcSlice->createExplicitReferencePictureSetFromReference(rcListPic, pcSlice->getRPS(), pcSlice->isIRAP(), m_iLastRecoveryPicPOC, m_pcCfg->getDecodingRefreshType() == 3); 1095 } 1096 #else 957 1097 if ((pcSlice->checkThatAllRefPicsAreAvailable(rcListPic, pcSlice->getRPS(), false) != 0) || (pcSlice->isIRAP())) 958 1098 { 959 1099 pcSlice->createExplicitReferencePictureSetFromReference(rcListPic, pcSlice->getRPS(), pcSlice->isIRAP()); 960 1100 } 1101 #endif 961 1102 #if ALIGNED_BUMPING 962 1103 pcSlice->checkLeadingPictureRestrictions(rcListPic); … … 1849 1990 pictureTimingSEI.m_auCpbRemovalDelay = std::min<Int>(std::max<Int>(1, m_totalCoded - m_lastBPSEI), static_cast<Int>(pow(2, static_cast<double>(pcSlice->getSPS()->getVuiParameters()->getHrdParameters()->getCpbRemovalDelayLengthMinus1()+1)))); // Syntax element signalled as minus, hence the . 1850 1991 #if POC_RESET_FLAG 1851 pictureTimingSEI.m_picDpbOutputDelay = pcSlice->getSPS()->getNumReorderPics(0) + pocCurr - m_totalCoded; 1852 #else 1853 pictureTimingSEI.m_picDpbOutputDelay = pcSlice->getSPS()->getNumReorderPics(0) + pcSlice->getPOC() - m_totalCoded; 1992 pictureTimingSEI.m_picDpbOutputDelay = pcSlice->getSPS()->getNumReorderPics(pcSlice->getSPS()->getMaxTLayers()-1) + pocCurr - m_totalCoded; 1993 #else 1994 pictureTimingSEI.m_picDpbOutputDelay = pcSlice->getSPS()->getNumReorderPics(pcSlice->getSPS()->getMaxTLayers()-1) + pcSlice->getPOC() - m_totalCoded; 1995 #endif 1996 #if EFFICIENT_FIELD_IRAP 1997 if(IRAPGOPid > 0 && IRAPGOPid < m_iGopSize) 1998 { 1999 // if pictures have been swapped there is likely one more picture delay on their tid. Very rough approximation 2000 pictureTimingSEI.m_picDpbOutputDelay ++; 2001 } 1854 2002 #endif 1855 2003 Int factor = pcSlice->getSPS()->getVuiParameters()->getHrdParameters()->getTickDivisorMinus2() + 2; … … 1975 2123 #endif 1976 2124 sei_recovery_point.m_brokenLinkFlag = false; 2125 #if ALLOW_RECOVERY_POINT_AS_RAP 2126 if(m_pcCfg->getDecodingRefreshType() == 3) 2127 { 2128 m_iLastRecoveryPicPOC = pocCurr; 2129 } 2130 #endif 1977 2131 1978 2132 #if O0164_MULTI_LAYER_HRD … … 2110 2264 } 2111 2265 m_pcEntropyCoder->setBitstream(&nalu.m_Bitstream); 2266 2267 #if SETTING_NO_OUT_PIC_PRIOR 2268 if (pcSlice->isIRAP()) 2269 { 2270 if (pcSlice->getNalUnitType() >= NAL_UNIT_CODED_SLICE_BLA_W_LP && pcSlice->getNalUnitType() <= NAL_UNIT_CODED_SLICE_IDR_N_LP) 2271 { 2272 pcSlice->setNoRaslOutputFlag(true); 2273 } 2274 //the inference for NoOutputPriorPicsFlag 2275 if (!m_bFirst && pcSlice->isIRAP() && pcSlice->getNoRaslOutputFlag()) 2276 { 2277 if (pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA) 2278 { 2279 pcSlice->setNoOutputPriorPicsFlag(true); 2280 } 2281 } 2282 } 2283 #endif 2284 2112 2285 tmpBitsBeforeWriting = m_pcEntropyCoder->getNumberOfWrittenBits(); 2113 2286 m_pcEntropyCoder->encodeSliceHeader(pcSlice); … … 2657 2830 2658 2831 delete[] pcSubstreamsOut; 2832 2833 #if EFFICIENT_FIELD_IRAP 2834 if(IRAPtoReorder) 2835 { 2836 if(swapIRAPForward) 2837 { 2838 if(iGOPid == IRAPGOPid) 2839 { 2840 iGOPid = IRAPGOPid +1; 2841 IRAPtoReorder = false; 2842 } 2843 else if(iGOPid == IRAPGOPid +1) 2844 { 2845 iGOPid --; 2846 } 2847 } 2848 else 2849 { 2850 if(iGOPid == IRAPGOPid) 2851 { 2852 iGOPid = IRAPGOPid -1; 2853 } 2854 else if(iGOPid == IRAPGOPid -1) 2855 { 2856 iGOPid = IRAPGOPid; 2857 IRAPtoReorder = false; 2858 } 2859 } 2860 } 2861 #endif 2659 2862 } 2660 2863 delete pcBitstreamRedirect; … … 2918 3121 case NAL_UNIT_CODED_SLICE_CRA: return "CRA"; 2919 3122 case NAL_UNIT_CODED_SLICE_RADL_R: return "RADL_R"; 3123 case NAL_UNIT_CODED_SLICE_RADL_N: return "RADL_N"; 2920 3124 case NAL_UNIT_CODED_SLICE_RASL_R: return "RASL_R"; 3125 case NAL_UNIT_CODED_SLICE_RASL_N: return "RASL_N"; 2921 3126 case NAL_UNIT_VPS: return "VPS"; 2922 3127 case NAL_UNIT_SPS: return "SPS"; … … 3316 3521 return NAL_UNIT_CODED_SLICE_IDR_W_RADL; 3317 3522 } 3523 #if EFFICIENT_FIELD_IRAP 3524 if(isField && pocCurr == 1) 3525 { 3526 // to avoid the picture becoming an IRAP 3527 return NAL_UNIT_CODED_SLICE_TRAIL_R; 3528 } 3529 #endif 3530 3531 #if ALLOW_RECOVERY_POINT_AS_RAP 3532 if(m_pcCfg->getDecodingRefreshType() != 3 && (pocCurr - isField) % m_pcCfg->getIntraPeriod() == 0) 3533 #else 3318 3534 if ((pocCurr - isField) % m_pcCfg->getIntraPeriod() == 0) 3535 #endif 3319 3536 { 3320 3537 if (m_pcCfg->getDecodingRefreshType() == 1) -
branches/SHM-6-dev/source/Lib/TLibEncoder/TEncGOP.h
r644 r652 82 82 Int m_iNumPicCoded; 83 83 Bool m_bFirst; 84 #if ALLOW_RECOVERY_POINT_AS_RAP 85 Int m_iLastRecoveryPicPOC; 86 #endif 84 87 85 88 // Access channel -
branches/SHM-6-dev/source/Lib/TLibEncoder/TEncSampleAdaptiveOffset.cpp
r644 r652 952 952 for (y=0; y<endY; y++) 953 953 { 954 #if SAO_SGN_FUNC 955 signLeft = (Char)sgn(srcLine[startX] - srcLine[startX-1]); 956 #else 954 957 signLeft = (Char)m_sign[srcLine[startX] - srcLine[startX-1]]; 958 #endif 955 959 for (x=startX; x<endX; x++) 956 960 { 961 #if SAO_SGN_FUNC 962 signRight = (Char)sgn(srcLine[x] - srcLine[x+1]); 963 #else 957 964 signRight = (Char)m_sign[srcLine[x] - srcLine[x+1]]; 965 #endif 958 966 edgeType = signRight + signLeft; 959 967 signLeft = -signRight; … … 975 983 for(y=0; y<skipLinesB[typeIdx]; y++) 976 984 { 985 #if SAO_SGN_FUNC 986 signLeft = (Char)sgn(srcLine[startX] - srcLine[startX-1]); 987 #else 977 988 signLeft = (Char)m_sign[srcLine[startX] - srcLine[startX-1]]; 989 #endif 978 990 for (x=startX; x<endX; x++) 979 991 { 992 #if SAO_SGN_FUNC 993 signRight = (Char)sgn(srcLine[x] - srcLine[x+1]); 994 #else 980 995 signRight = (Char)m_sign[srcLine[x] - srcLine[x+1]]; 996 #endif 981 997 edgeType = signRight + signLeft; 982 998 signLeft = -signRight; … … 1026 1042 #endif 1027 1043 { 1044 #if SAO_SGN_FUNC 1045 signUpLine[x] = (Char)sgn(srcLine[x] - srcLineAbove[x]); 1046 #else 1028 1047 signUpLine[x] = (Char)m_sign[srcLine[x] - srcLineAbove[x]]; 1048 #endif 1029 1049 } 1030 1050 … … 1040 1060 #endif 1041 1061 { 1062 #if SAO_SGN_FUNC 1063 signDown = (Char)sgn(srcLine[x] - srcLineBelow[x]); 1064 #else 1042 1065 signDown = (Char)m_sign[srcLine[x] - srcLineBelow[x]]; 1066 #endif 1043 1067 edgeType = signDown + signUpLine[x]; 1044 1068 signUpLine[x]= -signDown; … … 1065 1089 for (x=startX; x<endX; x++) 1066 1090 { 1091 #if SAO_SGN_FUNC 1092 edgeType = sgn(srcLine[x] - srcLineBelow[x]) + sgn(srcLine[x] - srcLineAbove[x]); 1093 #else 1067 1094 edgeType = m_sign[srcLine[x] - srcLineBelow[x]] + m_sign[srcLine[x] - srcLineAbove[x]]; 1095 #endif 1068 1096 diff [edgeType] += (orgLine[x] - srcLine[x]); 1069 1097 count[edgeType] ++; … … 1108 1136 for (x=startX; x<endX+1; x++) 1109 1137 { 1138 #if SAO_SGN_FUNC 1139 signUpLine[x] = (Char)sgn(srcLineBelow[x] - srcLine[x-1]); 1140 #else 1110 1141 signUpLine[x] = (Char)m_sign[srcLineBelow[x] - srcLine[x-1]]; 1142 #endif 1111 1143 } 1112 1144 … … 1122 1154 for(x=firstLineStartX; x<firstLineEndX; x++) 1123 1155 { 1156 #if SAO_SGN_FUNC 1157 edgeType = sgn(srcLine[x] - srcLineAbove[x-1]) - signUpLine[x+1]; 1158 #else 1124 1159 edgeType = m_sign[srcLine[x] - srcLineAbove[x-1]] - signUpLine[x+1]; 1160 #endif 1125 1161 diff [edgeType] += (orgLine[x] - srcLine[x]); 1126 1162 count[edgeType] ++; … … 1137 1173 for (x=startX; x<endX; x++) 1138 1174 { 1175 #if SAO_SGN_FUNC 1176 signDown = (Char)sgn(srcLine[x] - srcLineBelow[x+1]); 1177 #else 1139 1178 signDown = (Char)m_sign[srcLine[x] - srcLineBelow[x+1]] ; 1179 #endif 1140 1180 edgeType = signDown + signUpLine[x]; 1141 1181 diff [edgeType] += (orgLine[x] - srcLine[x]); … … 1144 1184 signDownLine[x+1] = -signDown; 1145 1185 } 1186 #if SAO_SGN_FUNC 1187 signDownLine[startX] = (Char)sgn(srcLineBelow[startX] - srcLine[startX-1]); 1188 #else 1146 1189 signDownLine[startX] = (Char)m_sign[srcLineBelow[startX] - srcLine[startX-1]]; 1190 #endif 1147 1191 1148 1192 signTmpLine = signUpLine; … … 1168 1212 for (x=startX; x< endX; x++) 1169 1213 { 1214 #if SAO_SGN_FUNC 1215 edgeType = sgn(srcLine[x] - srcLineBelow[x+1]) + sgn(srcLine[x] - srcLineAbove[x-1]); 1216 #else 1170 1217 edgeType = m_sign[srcLine[x] - srcLineBelow[x+1]] + m_sign[srcLine[x] - srcLineAbove[x-1]]; 1218 #endif 1171 1219 diff [edgeType] += (orgLine[x] - srcLine[x]); 1172 1220 count[edgeType] ++; … … 1206 1254 for (x=startX-1; x<endX; x++) 1207 1255 { 1256 #if SAO_SGN_FUNC 1257 signUpLine[x] = (Char)sgn(srcLineBelow[x] - srcLine[x+1]); 1258 #else 1208 1259 signUpLine[x] = (Char)m_sign[srcLineBelow[x] - srcLine[x+1]]; 1260 #endif 1209 1261 } 1210 1262 … … 1225 1277 for(x=firstLineStartX; x<firstLineEndX; x++) 1226 1278 { 1279 #if SAO_SGN_FUNC 1280 edgeType = sgn(srcLine[x] - srcLineAbove[x+1]) - signUpLine[x-1]; 1281 #else 1227 1282 edgeType = m_sign[srcLine[x] - srcLineAbove[x+1]] - signUpLine[x-1]; 1283 #endif 1228 1284 diff [edgeType] += (orgLine[x] - srcLine[x]); 1229 1285 count[edgeType] ++; … … 1240 1296 for(x=startX; x<endX; x++) 1241 1297 { 1298 #if SAO_SGN_FUNC 1299 signDown = (Char)sgn(srcLine[x] - srcLineBelow[x-1]); 1300 #else 1242 1301 signDown = (Char)m_sign[srcLine[x] - srcLineBelow[x-1]] ; 1302 #endif 1243 1303 edgeType = signDown + signUpLine[x]; 1244 1304 … … 1248 1308 signUpLine[x-1] = -signDown; 1249 1309 } 1310 #if SAO_SGN_FUNC 1311 signUpLine[endX-1] = (Char)sgn(srcLineBelow[endX-1] - srcLine[endX]); 1312 #else 1250 1313 signUpLine[endX-1] = (Char)m_sign[srcLineBelow[endX-1] - srcLine[endX]]; 1314 #endif 1251 1315 srcLine += srcStride; 1252 1316 orgLine += orgStride; … … 1267 1331 for (x=startX; x<endX; x++) 1268 1332 { 1333 #if SAO_SGN_FUNC 1334 edgeType = sgn(srcLine[x] - srcLineBelow[x-1]) + sgn(srcLine[x] - srcLineAbove[x+1]); 1335 #else 1269 1336 edgeType = m_sign[srcLine[x] - srcLineBelow[x-1]] + m_sign[srcLine[x] - srcLineAbove[x+1]]; 1337 #endif 1270 1338 diff [edgeType] += (orgLine[x] - srcLine[x]); 1271 1339 count[edgeType] ++; -
branches/SHM-6-dev/source/Lib/TLibEncoder/TEncSbac.h
r644 r652 95 95 Void codeSliceHeader ( TComSlice* pcSlice ); 96 96 Void codeTilesWPPEntryPoint( TComSlice* pSlice ); 97 #if POC_RESET_IDC_SIGNALLING98 Void codeSliceHeaderExtn ( TComSlice* pSlice, Int shBitsWrittenTillNow );99 #endif100 97 Void codeTerminatingBit ( UInt uilsLast ); 101 98 Void codeSliceFinish (); … … 108 105 109 106 #if SVC_EXTENSION 107 #if POC_RESET_IDC_SIGNALLING 108 Void codeSliceHeaderExtn ( TComSlice* pSlice, Int shBitsWrittenTillNow ); 109 #endif 110 110 Void codeSAOOffsetParam(Int compIdx, SAOOffset& ctbParam, Bool sliceEnabled, UInt* saoMaxOffsetQVal); 111 111 Void codeSAOBlkParam(SAOBlkParam& saoBlkParam -
branches/SHM-6-dev/source/Lib/TLibEncoder/TEncSearch.cpp
r595 r652 2398 2398 { 2399 2399 UInt uiDepth = pcCU->getDepth(0); 2400 UInt uiNumPU = pcCU->getNumPart Inter();2400 UInt uiNumPU = pcCU->getNumPartitions(); 2401 2401 UInt uiInitTrDepth = pcCU->getPartitionSize(0) == SIZE_2Nx2N ? 0 : 1; 2402 2402 UInt uiWidth = pcCU->getWidth (0) >> uiInitTrDepth; … … 3130 3130 TComMv cMvTemp[2][33]; 3131 3131 3132 Int iNumPart = pcCU->getNumPart Inter();3132 Int iNumPart = pcCU->getNumPartitions(); 3133 3133 Int iNumPredDir = pcCU->getSlice()->isInterP() ? 1 : 2; 3134 3134 … … 4612 4612 4613 4613 m_pcRDGoOnSbacCoder->load( m_pppcRDSbacCoder[pcCU->getDepth(0)][CI_CURR_BEST] ); 4614 #if 0 // check 4615 { 4616 m_pcEntropyCoder->resetBits(); 4617 m_pcEntropyCoder->encodeCoeff( pcCU, 0, pcCU->getDepth(0), pcCU->getWidth(0), pcCU->getHeight(0) ); 4618 const UInt uiBitsForCoeff = m_pcEntropyCoder->getNumberOfWrittenBits(); 4619 m_pcRDGoOnSbacCoder->load( m_pppcRDSbacCoder[pcCU->getDepth(0)][CI_CURR_BEST] ); 4620 if( uiBitsForCoeff != uiBits ) 4621 assert( 0 ); 4622 } 4623 #endif 4614 4624 4615 uiBits = 0; 4625 4616 { -
branches/SHM-6-dev/source/Lib/TLibEncoder/TEncSlice.cpp
r644 r652 225 225 Int depth; 226 226 { 227 #if FIX_FIELD_DEPTH 228 Int poc = rpcSlice->getPOC(); 229 if(isField) 230 { 231 poc = (poc/2)%(m_pcCfg->getGOPSize()/2); 232 } 233 else 234 { 235 poc = poc%m_pcCfg->getGOPSize(); 236 } 237 #else 227 238 Int poc = rpcSlice->getPOC()%m_pcCfg->getGOPSize(); 239 #endif 228 240 if ( poc == 0 ) 229 241 { … … 248 260 } 249 261 } 262 #if FIX_FIELD_DEPTH 263 #if HARMONIZE_GOP_FIRST_FIELD_COUPLE 264 if(poc != 0) 265 { 266 #endif 267 if(isField && rpcSlice->getPOC()%2 == 1) 268 { 269 depth ++; 270 } 271 #if HARMONIZE_GOP_FIRST_FIELD_COUPLE 272 } 273 #endif 274 #endif 250 275 } 251 276 … … 254 279 255 280 eSliceType=B_SLICE; 281 #if EFFICIENT_FIELD_IRAP 282 if(!(isField && pocLast == 1)) 283 { 284 #endif // EFFICIENT_FIELD_IRAP 285 #if ALLOW_RECOVERY_POINT_AS_RAP 286 if(m_pcCfg->getDecodingRefreshType() == 3) 287 { 288 eSliceType = (pocLast == 0 || pocCurr % m_pcCfg->getIntraPeriod() == 0 || m_pcGOPEncoder->getGOPSize() == 0) ? I_SLICE : eSliceType; 289 } 290 else 291 { 256 292 eSliceType = (pocLast == 0 || (pocCurr - isField) % m_pcCfg->getIntraPeriod() == 0 || m_pcGOPEncoder->getGOPSize() == 0) ? I_SLICE : eSliceType; 293 } 294 #else 295 eSliceType = (pocLast == 0 || (pocCurr - isField) % m_pcCfg->getIntraPeriod() == 0 || m_pcGOPEncoder->getGOPSize() == 0) ? I_SLICE : eSliceType; 296 #endif 297 #if EFFICIENT_FIELD_IRAP 298 } 299 #endif 257 300 258 301 rpcSlice->setSliceType ( eSliceType ); … … 423 466 #if HB_LAMBDA_FOR_LDC 424 467 // restore original slice type 468 469 #if EFFICIENT_FIELD_IRAP 470 if(!(isField && pocLast == 1)) 471 { 472 #endif // EFFICIENT_FIELD_IRAP 473 #if ALLOW_RECOVERY_POINT_AS_RAP 474 if(m_pcCfg->getDecodingRefreshType() == 3) 475 { 476 eSliceType = (pocLast == 0 || (pocCurr) % m_pcCfg->getIntraPeriod() == 0 || m_pcGOPEncoder->getGOPSize() == 0) ? I_SLICE : eSliceType; 477 478 } 479 else 480 { 425 481 eSliceType = (pocLast == 0 || (pocCurr - isField) % m_pcCfg->getIntraPeriod() == 0 || m_pcGOPEncoder->getGOPSize() == 0) ? I_SLICE : eSliceType; 482 } 483 #else 484 eSliceType = (pocLast == 0 || (pocCurr - isField) % m_pcCfg->getIntraPeriod() == 0 || m_pcGOPEncoder->getGOPSize() == 0) ? I_SLICE : eSliceType; 485 #endif 486 #if EFFICIENT_FIELD_IRAP 487 } 488 #endif // EFFICIENT_FIELD_IRAP 426 489 427 490 #if SVC_EXTENSION … … 544 607 // store lambda 545 608 slice->setSliceQp( sliceQP ); 609 #if ADAPTIVE_QP_SELECTION 546 610 slice->setSliceQpBase ( sliceQP ); 611 #endif 547 612 m_pcRdCost ->setLambda( lambda ); 548 613 // for RDO … … 1041 1106 1042 1107 m_pcRateCtrl->setRCQP( estQP ); 1108 #if ADAPTIVE_QP_SELECTION 1043 1109 pcCU->getSlice()->setSliceQpBase( estQP ); 1110 #endif 1044 1111 } 1045 1112 -
branches/SHM-6-dev/source/Lib/TLibEncoder/TEncTop.h
r644 r652 273 273 274 274 /// encode several number of pictures until end-of-sequence 275 Void encode( bool bEos, TComPicYuv* pcPicYuvOrg, TComList<TComPicYuv*>& rcListPicYuvRecOut,275 Void encode( Bool bEos, TComPicYuv* pcPicYuvOrg, TComList<TComPicYuv*>& rcListPicYuvRecOut, 276 276 std::list<AccessUnit>& accessUnitsOut, Int& iNumEncoded, Bool isTff); 277 277
Note: See TracChangeset for help on using the changeset viewer.