Changeset 345 in SHVCSoftware for trunk/source/App/TAppEncoder
- Timestamp:
- 17 Aug 2013, 06:27:19 (11 years ago)
- Location:
- trunk
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:mergeinfo changed
/branches/SHM-3.0-dev (added) merged: 315-344 /trunk (added) merged: 312-314
- Property svn:mergeinfo changed
-
trunk/source
- Property svn:mergeinfo changed
/branches/SHM-3.0-dev/source (added) merged: 316-340 /trunk/source (added) merged: 312-314
- Property svn:mergeinfo changed
-
trunk/source/App/TAppEncoder/TAppEncCfg.cpp
r313 r345 817 817 opts.addOptions()(cOSS.str(), m_GOPList[i-1], GOPEntry()); 818 818 } 819 #if FINAL_RPL_CHANGE_N0082 820 for(Int i=1; i<MAX_GOP+1; i++) { 821 std::ostringstream cOSS; 822 cOSS<<"FrameEL"<<i; 823 opts.addOptions()(cOSS.str(), m_acLayerCfg[1].m_GOPListLayer[i-1], GOPEntry()); 824 } 825 #endif 819 826 po::setDefaults(opts); 820 827 const list<const Char*>& argv_unhandled = po::scanArgv(opts, argc, (const Char**) argv); … … 1460 1467 #endif 1461 1468 1469 #if !FINAL_RPL_CHANGE_N0082 1462 1470 Bool verifiedGOP=false; 1471 #endif 1463 1472 Bool errorGOP=false; 1473 #if !FINAL_RPL_CHANGE_N0082 1464 1474 Int checkGOP=1; 1465 1475 Int numRefs = 1; 1476 #endif 1466 1477 Int refList[MAX_NUM_REF_PICS+1]; 1467 1478 refList[0]=0; … … 1471 1482 isOK[i]=false; 1472 1483 } 1484 #if !FINAL_RPL_CHANGE_N0082 1473 1485 Int numOK=0; 1486 #endif 1474 1487 #if !SVC_EXTENSION 1475 1488 xConfirmPara( m_iIntraPeriod >=0&&(m_iIntraPeriod%m_iGOPSize!=0), "Intra period must be a multiple of GOPSize, or -1" ); … … 1514 1527 } 1515 1528 #endif 1516 1529 #if FINAL_RPL_CHANGE_N0082 1530 for(UInt layer=0; layer<m_numLayers; layer++) 1531 { 1532 if (m_acLayerCfg[layer].m_GOPListLayer[0].m_POC<0){ 1533 memcpy( m_acLayerCfg[layer].m_GOPListLayer, m_GOPList, sizeof(GOPEntry)*MAX_GOP ); 1534 } 1535 errorGOP = xconfirmExtraGOP( m_acLayerCfg[layer].m_GOPListLayer ); 1536 xConfirmPara(errorGOP,"Invalid GOP structure given"); 1537 } 1538 //tentative for encoder 1539 if( m_acLayerCfg[1].m_GOPListLayer[5].m_POC == 6 && m_acLayerCfg[1].m_GOPListLayer[7].m_POC == 7 ){ 1540 //RA, POC5 1541 m_acLayerCfg[1].m_GOPListLayer[5].m_usedByCurrPic[2] = 0; 1542 m_acLayerCfg[1].m_GOPListLayer[5].m_refIdc[2] = 0; 1543 //RA, POC7 1544 m_acLayerCfg[1].m_GOPListLayer[7].m_usedByCurrPic[2] = 0; 1545 m_acLayerCfg[1].m_GOPListLayer[7].m_refIdc[2] = 0; 1546 } 1547 #else 1517 1548 m_extraRPSs=0; 1518 1549 //start looping through frames in coding order until we can verify that the GOP structure is correct. … … 1710 1741 } 1711 1742 xConfirmPara(errorGOP,"Invalid GOP structure given"); 1743 #endif 1712 1744 m_maxTempLayer = 1; 1713 1745 for(Int i=0; i<m_iGOPSize; i++) … … 1730 1762 m_maxDecPicBuffering[m_GOPList[i].m_temporalId] = m_GOPList[i].m_numRefPics + 1; 1731 1763 } 1732 1733 #if SVC_EXTENSION1734 m_maxDecPicBuffering[m_GOPList[i].m_temporalId] += 1; // it should be updated if more than 1 resampling picture is used1735 #endif1736 1764 1737 1765 Int highestDecodingNumberWithLowerPOC = 0; … … 2187 2215 printf("ENCODER_FAST_MODE: %d ", ENCODER_FAST_MODE); 2188 2216 printf("REF_IDX_MFM: %d ", REF_IDX_MFM); 2189 #elif INTRA_BL2190 printf("INTRA_BL:%d ", INTRA_BL);2191 #if !AVC_BASE2192 printf("SVC_MVP:%d ", SVC_MVP );2193 printf("SVC_BL_CAND_INTRA:%d", SVC_BL_CAND_INTRA );2194 #endif2195 2217 #endif 2196 2218 #else … … 2245 2267 } 2246 2268 #endif 2269 2270 #if FINAL_RPL_CHANGE_N0082 2271 Bool TAppEncCfg::xconfirmExtraGOP (GOPEntry * ge) 2272 { 2273 Bool verifiedGOP=false; 2274 Bool errorGOP=false; 2275 Int checkGOP=1; 2276 Int numRefs = 1; 2277 Int refList[MAX_NUM_REF_PICS+1]; 2278 refList[0]=0; 2279 Bool isOK[MAX_GOP]; 2280 for(Int i=0; i<MAX_GOP; i++) 2281 { 2282 isOK[i]=false; 2283 } 2284 Int numOK=0; 2285 2286 m_extraRPSs=0; 2287 //start looping through frames in coding order until we can verify that the GOP structure is correct. 2288 while(!verifiedGOP&&!errorGOP) 2289 { 2290 Int curGOP = (checkGOP-1)%m_iGOPSize; 2291 Int curPOC = ((checkGOP-1)/m_iGOPSize)*m_iGOPSize + ge[curGOP].m_POC; 2292 if(ge[curGOP].m_POC<0) 2293 { 2294 printf("\nError: found fewer Reference Picture Sets than GOPSize\n"); 2295 errorGOP=true; 2296 } 2297 else 2298 { 2299 //check that all reference pictures are available, or have a POC < 0 meaning they might be available in the next GOP. 2300 Bool beforeI = false; 2301 for(Int i = 0; i< ge[curGOP].m_numRefPics; i++) 2302 { 2303 Int absPOC = curPOC+ge[curGOP].m_referencePics[i]; 2304 if(absPOC < 0) 2305 { 2306 beforeI=true; 2307 } 2308 else 2309 { 2310 Bool found=false; 2311 for(Int j=0; j<numRefs; j++) 2312 { 2313 if(refList[j]==absPOC) 2314 { 2315 found=true; 2316 for(Int k=0; k<m_iGOPSize; k++) 2317 { 2318 if(absPOC%m_iGOPSize == ge[k].m_POC%m_iGOPSize) 2319 { 2320 if(ge[k].m_temporalId==ge[curGOP].m_temporalId) 2321 { 2322 ge[k].m_refPic = true; 2323 } 2324 ge[curGOP].m_usedByCurrPic[i]=ge[k].m_temporalId<=ge[curGOP].m_temporalId; 2325 } 2326 } 2327 } 2328 } 2329 if(!found) 2330 { 2331 printf("\nError: ref pic %d is not available for GOP frame %d\n",ge[curGOP].m_referencePics[i],curGOP+1); 2332 errorGOP=true; 2333 } 2334 } 2335 } 2336 if(!beforeI&&!errorGOP) 2337 { 2338 //all ref frames were present 2339 if(!isOK[curGOP]) 2340 { 2341 numOK++; 2342 isOK[curGOP]=true; 2343 if(numOK==m_iGOPSize) 2344 { 2345 verifiedGOP=true; 2346 } 2347 } 2348 } 2349 else 2350 { 2351 //create a new GOPEntry for this frame containing all the reference pictures that were available (POC > 0) 2352 ge[m_iGOPSize+m_extraRPSs]=ge[curGOP]; 2353 Int newRefs=0; 2354 for(Int i = 0; i< ge[curGOP].m_numRefPics; i++) 2355 { 2356 Int absPOC = curPOC+ge[curGOP].m_referencePics[i]; 2357 if(absPOC>=0) 2358 { 2359 ge[m_iGOPSize+m_extraRPSs].m_referencePics[newRefs]=ge[curGOP].m_referencePics[i]; 2360 ge[m_iGOPSize+m_extraRPSs].m_usedByCurrPic[newRefs]=ge[curGOP].m_usedByCurrPic[i]; 2361 newRefs++; 2362 } 2363 } 2364 Int numPrefRefs = ge[curGOP].m_numRefPicsActive; 2365 2366 for(Int offset = -1; offset>-checkGOP; offset--) 2367 { 2368 //step backwards in coding order and include any extra available pictures we might find useful to replace the ones with POC < 0. 2369 Int offGOP = (checkGOP-1+offset)%m_iGOPSize; 2370 Int offPOC = ((checkGOP-1+offset)/m_iGOPSize)*m_iGOPSize + ge[offGOP].m_POC; 2371 if(offPOC>=0&&ge[offGOP].m_temporalId<=ge[curGOP].m_temporalId) 2372 { 2373 Bool newRef=false; 2374 for(Int i=0; i<numRefs; i++) 2375 { 2376 if(refList[i]==offPOC) 2377 { 2378 newRef=true; 2379 } 2380 } 2381 for(Int i=0; i<newRefs; i++) 2382 { 2383 if(ge[m_iGOPSize+m_extraRPSs].m_referencePics[i]==offPOC-curPOC) 2384 { 2385 newRef=false; 2386 } 2387 } 2388 if(newRef) 2389 { 2390 Int insertPoint=newRefs; 2391 //this picture can be added, find appropriate place in list and insert it. 2392 if(ge[offGOP].m_temporalId==ge[curGOP].m_temporalId) 2393 { 2394 ge[offGOP].m_refPic = true; 2395 } 2396 for(Int j=0; j<newRefs; j++) 2397 { 2398 if(ge[m_iGOPSize+m_extraRPSs].m_referencePics[j]<offPOC-curPOC||ge[m_iGOPSize+m_extraRPSs].m_referencePics[j]>0) 2399 { 2400 insertPoint = j; 2401 break; 2402 } 2403 } 2404 Int prev = offPOC-curPOC; 2405 Int prevUsed = ge[offGOP].m_temporalId<=ge[curGOP].m_temporalId; 2406 for(Int j=insertPoint; j<newRefs+1; j++) 2407 { 2408 Int newPrev = ge[m_iGOPSize+m_extraRPSs].m_referencePics[j]; 2409 Int newUsed = ge[m_iGOPSize+m_extraRPSs].m_usedByCurrPic[j]; 2410 ge[m_iGOPSize+m_extraRPSs].m_referencePics[j]=prev; 2411 ge[m_iGOPSize+m_extraRPSs].m_usedByCurrPic[j]=prevUsed; 2412 prevUsed=newUsed; 2413 prev=newPrev; 2414 } 2415 newRefs++; 2416 } 2417 } 2418 if(newRefs>=numPrefRefs) 2419 { 2420 break; 2421 } 2422 } 2423 ge[m_iGOPSize+m_extraRPSs].m_numRefPics=newRefs; 2424 ge[m_iGOPSize+m_extraRPSs].m_POC = curPOC; 2425 if (m_extraRPSs == 0) 2426 { 2427 ge[m_iGOPSize+m_extraRPSs].m_interRPSPrediction = 0; 2428 ge[m_iGOPSize+m_extraRPSs].m_numRefIdc = 0; 2429 } 2430 else 2431 { 2432 Int rIdx = m_iGOPSize + m_extraRPSs - 1; 2433 Int refPOC = ge[rIdx].m_POC; 2434 Int refPics = ge[rIdx].m_numRefPics; 2435 Int newIdc=0; 2436 for(Int i = 0; i<= refPics; i++) 2437 { 2438 Int deltaPOC = ((i != refPics)? ge[rIdx].m_referencePics[i] : 0); // check if the reference abs POC is >= 0 2439 Int absPOCref = refPOC+deltaPOC; 2440 Int refIdc = 0; 2441 for (Int j = 0; j < ge[m_iGOPSize+m_extraRPSs].m_numRefPics; j++) 2442 { 2443 if ( (absPOCref - curPOC) == ge[m_iGOPSize+m_extraRPSs].m_referencePics[j]) 2444 { 2445 if (ge[m_iGOPSize+m_extraRPSs].m_usedByCurrPic[j]) 2446 { 2447 refIdc = 1; 2448 } 2449 else 2450 { 2451 refIdc = 2; 2452 } 2453 } 2454 } 2455 ge[m_iGOPSize+m_extraRPSs].m_refIdc[newIdc]=refIdc; 2456 newIdc++; 2457 } 2458 ge[m_iGOPSize+m_extraRPSs].m_interRPSPrediction = 1; 2459 ge[m_iGOPSize+m_extraRPSs].m_numRefIdc = newIdc; 2460 ge[m_iGOPSize+m_extraRPSs].m_deltaRPS = refPOC - ge[m_iGOPSize+m_extraRPSs].m_POC; 2461 } 2462 curGOP=m_iGOPSize+m_extraRPSs; 2463 m_extraRPSs++; 2464 } 2465 numRefs=0; 2466 for(Int i = 0; i< ge[curGOP].m_numRefPics; i++) 2467 { 2468 Int absPOC = curPOC+ge[curGOP].m_referencePics[i]; 2469 if(absPOC >= 0) 2470 { 2471 refList[numRefs]=absPOC; 2472 numRefs++; 2473 } 2474 } 2475 refList[numRefs]=curPOC; 2476 numRefs++; 2477 } 2478 checkGOP++; 2479 } 2480 2481 return errorGOP; //update 2482 } 2483 #endif 2247 2484 //! \} -
trunk/source/App/TAppEncoder/TAppEncCfg.h
r313 r345 348 348 Void xPrintParameter (); ///< print configuration values 349 349 Void xPrintUsage (); ///< print usage 350 #if FINAL_RPL_CHANGE_N0082 351 Bool xconfirmExtraGOP (GOPEntry * ge); 352 #endif 350 353 #if M0040_ADAPTIVE_RESOLUTION_CHANGE 351 354 Int m_adaptiveResolutionChange; ///< Indicate adaptive resolution change frame -
trunk/source/App/TAppEncoder/TAppEncLayerCfg.h
r313 r345 81 81 Int m_scaledRefLayerBottomOffset[MAX_LAYERS]; 82 82 #endif 83 #if FINAL_RPL_CHANGE_N0082 84 GOPEntry m_GOPListLayer[MAX_GOP]; ///< for layer 85 #endif 83 86 public: 84 87 TAppEncLayerCfg(); … … 141 144 Bool getRCForceIntraQP() {return m_RCForceIntraQP; } 142 145 #endif 146 #if FINAL_RPL_CHANGE_N0082 147 GOPEntry getGOPEntry(Int i ) {return m_GOPListLayer[i]; } 148 #endif 143 149 }; // END CLASS DEFINITION TAppEncLayerCfg 144 150 -
trunk/source/App/TAppEncoder/TAppEncTop.cpp
r313 r345 136 136 m_acTEncTop[layer].setDecodingRefreshType ( m_iDecodingRefreshType ); 137 137 m_acTEncTop[layer].setGOPSize ( m_iGOPSize ); 138 #if FINAL_RPL_CHANGE_N0082 139 m_acTEncTop[layer].setGopList ( m_acLayerCfg[layer].m_GOPListLayer ); 140 #else 138 141 m_acTEncTop[layer].setGopList ( m_GOPList ); 142 #endif 139 143 m_acTEncTop[layer].setExtraRPSs ( m_extraRPSs ); 140 144 for(Int i = 0; i < MAX_TLAYER; i++) … … 884 888 } 885 889 #endif 890 #if N0120_MAX_TID_REF_PRESENT_FLAG 891 vps->setMaxTidIlRefPicsPlus1PresentFlag(true); 892 if (vps->getMaxTidIlRefPicsPlus1PresentFlag()) 893 { 894 for( i = 0; i < MAX_VPS_LAYER_ID_PLUS1 - 1; i++ ) 895 { 896 vps->setMaxSublayerForIlpPlus1(i, vps->getMaxTLayers()+1); 897 } 898 } 899 else 900 { 901 for( i = 0; i < MAX_VPS_LAYER_ID_PLUS1 - 1; i++ ) 902 { 903 vps->setMaxSublayerForIlpPlus1(i, 7); 904 } 905 } 906 #endif 907 #if ILP_SSH_SIG 908 vps->setIlpSshSignalingEnabledFlag(true); 909 #endif 886 910 #if VPS_EXTN_PROFILE_INFO 887 911 vps->getPTLForExtnPtr()->resize(vps->getNumLayerSets());
Note: See TracChangeset for help on using the changeset viewer.