Changeset 806 in SHVCSoftware


Ignore:
Timestamp:
20 Jun 2014, 21:17:30 (11 years ago)
Author:
seregin
Message:

code formatting

Location:
branches/SHM-6-dev/source
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • branches/SHM-6-dev/source/App/TAppEncoder/TAppEncCfg.cpp

    r804 r806  
    10181018#if Q0108_TSA_STSA
    10191019  for (Int i=1; i<MAX_LAYERS; i++)
    1020   for(Int j=1; j<MAX_GOP+1; j++){
    1021     std::ostringstream cOSS;
    1022     cOSS<<"Layer"<<i<<"Frame"<<j;
    1023     opts.addOptions()(cOSS.str(), m_EH_GOPList[i][j-1], GOPEntry());
     1020  {
     1021    for(Int j=1; j<MAX_GOP+1; j++)
     1022    {
     1023      std::ostringstream cOSS;
     1024      cOSS<<"Layer"<<i<<"Frame"<<j;
     1025      opts.addOptions()(cOSS.str(), m_EhGOPList[i][j-1], GOPEntry());
     1026    }
    10241027  }
    10251028#endif
     
    10351038      for(Int j=1; j<MAX_GOP+1; j++)
    10361039      {
    1037         m_EH_GOPList[i][j-1] = m_GOPList[j-1];
     1040        m_EhGOPList[i][j-1] = m_GOPList[j-1];
    10381041      }
    10391042    }
     
    10421045      for(Int j=1; j<MAX_GOP+1; j++)
    10431046      {
    1044         m_EH_GOPList[i][j-1] = m_EH_GOPList[m_inheritCodingStruct[i]][j-1];
     1047        m_EhGOPList[i][j-1] = m_EhGOPList[m_inheritCodingStruct[i]][j-1];
    10451048      }
    10461049    }
     
    18871890  }
    18881891#endif
    1889  
    18901892
    18911893  Bool verifiedGOP=false;
     
    19201922  xConfirmPara( m_numLayers > MAX_LAYERS , "Number of layers in config file is greater than MAX_LAYERS" );
    19211923  m_numLayers = m_numLayers > MAX_LAYERS ? MAX_LAYERS : m_numLayers;
    1922 
    19231924 
    19241925  // it can be updated after AVC BL support will be added to the WD
     
    19601961   m_extraRPSs = 0;                                     
    19611962#else
    1962    for (Int i = 0; i< MAX_LAYERS; i++)
    1963    {
    1964      m_extraRPSs[i] = 0;
    1965    }
     1963  memset( m_extraRPSs, 0, sizeof( m_extraRPSs ) );
    19661964#endif
    19671965  //start looping through frames in coding order until we can verify that the GOP structure is correct.
     
    22312229  xConfirmPara(errorGOP,"Invalid GOP structure given");
    22322230
    2233 #if Q0108_TSA_STSA
    2234   for ( Int layer_index = 1; layer_index<m_numLayers; layer_index++)
     2231#if SVC_EXTENSION && Q0108_TSA_STSA
     2232  for ( Int layerId = 1; layerId < m_numLayers; layerId++ )
    22352233  {
    22362234    verifiedGOP=false;
     
    22392237    numRefs = m_isField ? 2 : 1;
    22402238    refList[0]=0;
     2239
    22412240    if(m_isField)
    22422241    {
    22432242      refList[1] = 1;
    22442243    }
    2245     for(Int i=0; i<MAX_GOP; i++)
    2246     {
    2247       isOK[i]=false;
    2248     }
     2244
     2245    memset( isOK, 0, sizeof( isOK ) );
    22492246    numOK=0;
    2250 #if !SVC_EXTENSION
    2251     xConfirmPara( m_iIntraPeriod >=0&&(m_iIntraPeriod%m_iGOPSize!=0), "Intra period must be a multiple of GOPSize, or -1" );
    2252 #endif
    2253 
    2254   for(Int i=0; i<m_iGOPSize; i++)
    2255   {
    2256     if(m_EH_GOPList[layer_index][i].m_POC==m_iGOPSize)
    2257     {
    2258       xConfirmPara( m_EH_GOPList[layer_index][i].m_temporalId!=0 , "The last frame in each GOP must have temporal ID = 0 " );
    2259     }
    2260   }
    2261 
    2262 #if SVC_EXTENSION
    2263   xConfirmPara( m_numLayers > MAX_LAYERS , "Number of layers in config file is greater than MAX_LAYERS" );
    2264   m_numLayers = m_numLayers > MAX_LAYERS ? MAX_LAYERS : m_numLayers;
    2265 
    2266   // verify layer configuration parameters
    2267   for(UInt layer=0; layer<m_numLayers; layer++)
    2268   {
    2269     Int m_iIntraPeriod = m_acLayerCfg[layer].m_iIntraPeriod;
    2270 #endif
    2271   if ( (m_iIntraPeriod != 1) && !m_loopFilterOffsetInPPS && m_DeblockingFilterControlPresent && (!m_bLoopFilterDisable) )
    2272   {
     2247
    22732248    for(Int i=0; i<m_iGOPSize; i++)
    22742249    {
    2275       xConfirmPara( (m_EH_GOPList[layer_index][i].m_betaOffsetDiv2 + m_loopFilterBetaOffsetDiv2) < -6 || (m_EH_GOPList[layer_index][i].m_betaOffsetDiv2 + m_loopFilterBetaOffsetDiv2) > 6, "Loop Filter Beta Offset div. 2 for one of the GOP entries exceeds supported range (-6 to 6)" );
    2276       xConfirmPara( (m_EH_GOPList[layer_index][i].m_tcOffsetDiv2 + m_loopFilterTcOffsetDiv2) < -6 || (m_EH_GOPList[layer_index][i].m_tcOffsetDiv2 + m_loopFilterTcOffsetDiv2) > 6, "Loop Filter Tc Offset div. 2 for one of the GOP entries exceeds supported range (-6 to 6)" );
    2277     }
    2278   }
    2279 #if SVC_EXTENSION
    2280   }
    2281 #endif
    2282 
    2283   //start looping through frames in coding order until we can verify that the GOP structure is correct.
    2284   while(!verifiedGOP&&!errorGOP)
    2285   {
    2286     Int curGOP = (checkGOP-1)%m_iGOPSize;
    2287     Int curPOC = ((checkGOP-1)/m_iGOPSize)*m_iGOPSize + m_EH_GOPList[layer_index][curGOP].m_POC;   
    2288     if(m_EH_GOPList[layer_index][curGOP].m_POC<0)
    2289     {
    2290       printf("\nError: found fewer Reference Picture Sets than GOPSize\n");
    2291       errorGOP=true;
    2292     }
    2293     else
    2294     {
    2295       //check that all reference pictures are available, or have a POC < 0 meaning they might be available in the next GOP.
    2296       Bool beforeI = false;
    2297       for(Int i = 0; i< m_EH_GOPList[layer_index][curGOP].m_numRefPics; i++)
    2298       {
    2299         Int absPOC = curPOC+m_EH_GOPList[layer_index][curGOP].m_referencePics[i];
    2300         if(absPOC < 0)
    2301         {
    2302           beforeI=true;
    2303         }
    2304         else
    2305         {
    2306           Bool found=false;
    2307           for(Int j=0; j<numRefs; j++)
     2250      if(m_EhGOPList[layerId][i].m_POC==m_iGOPSize)
     2251      {
     2252        xConfirmPara( m_EhGOPList[layerId][i].m_temporalId!=0 , "The last frame in each GOP must have temporal ID = 0 " );
     2253      }
     2254    }
     2255
     2256    xConfirmPara( m_numLayers > MAX_LAYERS , "Number of layers in config file is greater than MAX_LAYERS" );
     2257    m_numLayers = m_numLayers > MAX_LAYERS ? MAX_LAYERS : m_numLayers;
     2258
     2259    // verify layer configuration parameters
     2260    for(UInt layer=0; layer<m_numLayers; layer++)
     2261    {
     2262      Int m_iIntraPeriod = m_acLayerCfg[layer].m_iIntraPeriod;
     2263      if ( (m_iIntraPeriod != 1) && !m_loopFilterOffsetInPPS && m_DeblockingFilterControlPresent && (!m_bLoopFilterDisable) )
     2264      {
     2265        for(Int i=0; i<m_iGOPSize; i++)
     2266        {
     2267          xConfirmPara( (m_EhGOPList[layerId][i].m_betaOffsetDiv2 + m_loopFilterBetaOffsetDiv2) < -6 || (m_EhGOPList[layerId][i].m_betaOffsetDiv2 + m_loopFilterBetaOffsetDiv2) > 6, "Loop Filter Beta Offset div. 2 for one of the GOP entries exceeds supported range (-6 to 6)" );
     2268          xConfirmPara( (m_EhGOPList[layerId][i].m_tcOffsetDiv2 + m_loopFilterTcOffsetDiv2) < -6 || (m_EhGOPList[layerId][i].m_tcOffsetDiv2 + m_loopFilterTcOffsetDiv2) > 6, "Loop Filter Tc Offset div. 2 for one of the GOP entries exceeds supported range (-6 to 6)" );
     2269        }
     2270      }
     2271    }
     2272
     2273    //start looping through frames in coding order until we can verify that the GOP structure is correct.
     2274    while(!verifiedGOP&&!errorGOP)
     2275    {
     2276      Int curGOP = (checkGOP-1)%m_iGOPSize;
     2277      Int curPOC = ((checkGOP-1)/m_iGOPSize)*m_iGOPSize + m_EhGOPList[layerId][curGOP].m_POC;   
     2278      if(m_EhGOPList[layerId][curGOP].m_POC<0)
     2279      {
     2280        printf("\nError: found fewer Reference Picture Sets than GOPSize\n");
     2281        errorGOP=true;
     2282      }
     2283      else
     2284      {
     2285        //check that all reference pictures are available, or have a POC < 0 meaning they might be available in the next GOP.
     2286        Bool beforeI = false;
     2287        for(Int i = 0; i< m_EhGOPList[layerId][curGOP].m_numRefPics; i++)
     2288        {
     2289          Int absPOC = curPOC+m_EhGOPList[layerId][curGOP].m_referencePics[i];
     2290          if(absPOC < 0)
    23082291          {
    2309             if(refList[j]==absPOC)
     2292            beforeI=true;
     2293          }
     2294          else
     2295          {
     2296            Bool found=false;
     2297            for(Int j=0; j<numRefs; j++)
    23102298            {
    2311               found=true;
    2312               for(Int k=0; k<m_iGOPSize; k++)
     2299              if(refList[j]==absPOC)
    23132300              {
    2314                 if(absPOC%m_iGOPSize == m_EH_GOPList[layer_index][k].m_POC%m_iGOPSize)
     2301                found=true;
     2302                for(Int k=0; k<m_iGOPSize; k++)
    23152303                {
    2316                   if(m_EH_GOPList[layer_index][k].m_temporalId==m_EH_GOPList[layer_index][curGOP].m_temporalId)
     2304                  if(absPOC%m_iGOPSize == m_EhGOPList[layerId][k].m_POC%m_iGOPSize)
    23172305                  {
    2318                     m_EH_GOPList[layer_index][k].m_refPic = true;
     2306                    if(m_EhGOPList[layerId][k].m_temporalId==m_EhGOPList[layerId][curGOP].m_temporalId)
     2307                    {
     2308                      m_EhGOPList[layerId][k].m_refPic = true;
     2309                    }
     2310                    m_EhGOPList[layerId][curGOP].m_usedByCurrPic[i]=m_EhGOPList[layerId][k].m_temporalId<=m_EhGOPList[layerId][curGOP].m_temporalId;
    23192311                  }
    2320                   m_EH_GOPList[layer_index][curGOP].m_usedByCurrPic[i]=m_EH_GOPList[layer_index][k].m_temporalId<=m_EH_GOPList[layer_index][curGOP].m_temporalId;
    23212312                }
    23222313              }
    23232314            }
     2315            if(!found)
     2316            {
     2317              printf("\nError: ref pic %d is not available for GOP frame %d\n",m_EhGOPList[layerId][curGOP].m_referencePics[i],curGOP+1);
     2318              errorGOP=true;
     2319            }
    23242320          }
    2325           if(!found)
     2321        }
     2322        if(!beforeI&&!errorGOP)
     2323        {
     2324          //all ref frames were present
     2325          if(!isOK[curGOP])
    23262326          {
    2327             printf("\nError: ref pic %d is not available for GOP frame %d\n",m_EH_GOPList[layer_index][curGOP].m_referencePics[i],curGOP+1);
    2328             errorGOP=true;
     2327            numOK++;
     2328            isOK[curGOP]=true;
     2329            if(numOK==m_iGOPSize)
     2330            {
     2331              verifiedGOP=true;
     2332            }
    23292333          }
    23302334        }
    2331       }
    2332       if(!beforeI&&!errorGOP)
    2333       {
    2334         //all ref frames were present
    2335         if(!isOK[curGOP])
    2336         {
    2337           numOK++;
    2338           isOK[curGOP]=true;
    2339           if(numOK==m_iGOPSize)
     2335        else
     2336        {
     2337          //create a new GOPEntry for this frame containing all the reference pictures that were available (POC > 0)
     2338
     2339          m_EhGOPList[layerId][m_iGOPSize+m_extraRPSs[layerId]]=m_EhGOPList[layerId][curGOP];
     2340          Int newRefs=0;
     2341          for(Int i = 0; i< m_EhGOPList[layerId][curGOP].m_numRefPics; i++)
    23402342          {
    2341             verifiedGOP=true;
    2342           }
    2343         }
    2344       }
    2345       else
    2346       {
    2347         //create a new GOPEntry for this frame containing all the reference pictures that were available (POC > 0)
    2348  
    2349         m_EH_GOPList[layer_index][m_iGOPSize+m_extraRPSs[layer_index]]=m_EH_GOPList[layer_index][curGOP];
    2350         Int newRefs=0;
    2351         for(Int i = 0; i< m_EH_GOPList[layer_index][curGOP].m_numRefPics; i++)
    2352         {
    2353           Int absPOC = curPOC+m_EH_GOPList[layer_index][curGOP].m_referencePics[i];
    2354           if(absPOC>=0)
    2355           {
    2356             m_EH_GOPList[layer_index][m_iGOPSize+m_extraRPSs[layer_index]].m_referencePics[newRefs]=m_EH_GOPList[layer_index][curGOP].m_referencePics[i];
    2357             m_EH_GOPList[layer_index][m_iGOPSize+m_extraRPSs[layer_index]].m_usedByCurrPic[newRefs]=m_EH_GOPList[layer_index][curGOP].m_usedByCurrPic[i];
    2358             newRefs++;
    2359           }
    2360         }
    2361         Int numPrefRefs = m_EH_GOPList[layer_index][curGOP].m_numRefPicsActive;
    2362        
    2363         for(Int offset = -1; offset>-checkGOP; offset--)
    2364         {
    2365           //step backwards in coding order and include any extra available pictures we might find useful to replace the ones with POC < 0.
    2366           Int offGOP = (checkGOP-1+offset)%m_iGOPSize;
    2367           Int offPOC = ((checkGOP-1+offset)/m_iGOPSize)*m_iGOPSize + m_EH_GOPList[layer_index][offGOP].m_POC;
    2368           if(offPOC>=0&&m_EH_GOPList[layer_index][offGOP].m_temporalId<=m_EH_GOPList[layer_index][curGOP].m_temporalId)
    2369           {
    2370             Bool newRef=false;
    2371             for(Int i=0; i<numRefs; i++)
     2343            Int absPOC = curPOC+m_EhGOPList[layerId][curGOP].m_referencePics[i];
     2344            if(absPOC>=0)
    23722345            {
    2373               if(refList[i]==offPOC)
    2374               {
    2375                 newRef=true;
    2376               }
    2377             }
    2378             for(Int i=0; i<newRefs; i++)
    2379             {
    2380               if(m_EH_GOPList[layer_index][m_iGOPSize+m_extraRPSs[layer_index]].m_referencePics[i]==offPOC-curPOC)
    2381               {
    2382                 newRef=false;
    2383               }
    2384             }
    2385             if(newRef)
    2386             {
    2387               Int insertPoint=newRefs;
    2388               //this picture can be added, find appropriate place in list and insert it.
    2389               if(m_EH_GOPList[layer_index][offGOP].m_temporalId==m_EH_GOPList[layer_index][curGOP].m_temporalId)
    2390               {
    2391                 m_EH_GOPList[layer_index][offGOP].m_refPic = true;
    2392               }
    2393               for(Int j=0; j<newRefs; j++)
    2394               {
    2395                 if(m_EH_GOPList[layer_index][m_iGOPSize+m_extraRPSs[layer_index]].m_referencePics[j]<offPOC-curPOC||m_EH_GOPList[layer_index][m_iGOPSize+m_extraRPSs[layer_index]].m_referencePics[j]>0)
    2396                 {
    2397                   insertPoint = j;
    2398                   break;
    2399                 }
    2400               }
    2401               Int prev = offPOC-curPOC;
    2402               Int prevUsed = m_EH_GOPList[layer_index][offGOP].m_temporalId<=m_EH_GOPList[layer_index][curGOP].m_temporalId;
    2403               for(Int j=insertPoint; j<newRefs+1; j++)
    2404               {
    2405                 Int newPrev = m_EH_GOPList[layer_index][m_iGOPSize+m_extraRPSs[layer_index]].m_referencePics[j];
    2406                 Int newUsed = m_EH_GOPList[layer_index][m_iGOPSize+m_extraRPSs[layer_index]].m_usedByCurrPic[j];
    2407                 m_EH_GOPList[layer_index][m_iGOPSize+m_extraRPSs[layer_index]].m_referencePics[j]=prev;
    2408                 m_EH_GOPList[layer_index][m_iGOPSize+m_extraRPSs[layer_index]].m_usedByCurrPic[j]=prevUsed;
    2409                 prevUsed=newUsed;
    2410                 prev=newPrev;
    2411               }
     2346              m_EhGOPList[layerId][m_iGOPSize+m_extraRPSs[layerId]].m_referencePics[newRefs]=m_EhGOPList[layerId][curGOP].m_referencePics[i];
     2347              m_EhGOPList[layerId][m_iGOPSize+m_extraRPSs[layerId]].m_usedByCurrPic[newRefs]=m_EhGOPList[layerId][curGOP].m_usedByCurrPic[i];
    24122348              newRefs++;
    24132349            }
    24142350          }
    2415           if(newRefs>=numPrefRefs)
     2351          Int numPrefRefs = m_EhGOPList[layerId][curGOP].m_numRefPicsActive;
     2352
     2353          for(Int offset = -1; offset>-checkGOP; offset--)
    24162354          {
    2417             break;
    2418           }
    2419         }
    2420         m_EH_GOPList[layer_index][m_iGOPSize+m_extraRPSs[layer_index]].m_numRefPics=newRefs;
    2421         m_EH_GOPList[layer_index][m_iGOPSize+m_extraRPSs[layer_index]].m_POC = curPOC;
    2422         if (m_extraRPSs[layer_index] == 0)
    2423         {
    2424           m_EH_GOPList[layer_index][m_iGOPSize+m_extraRPSs[layer_index]].m_interRPSPrediction = 0;
    2425           m_EH_GOPList[layer_index][m_iGOPSize+m_extraRPSs[layer_index]].m_numRefIdc = 0;
    2426         }
    2427         else
    2428         {
    2429           Int rIdx =  m_iGOPSize + m_extraRPSs[layer_index] - 1;
    2430           Int refPOC = m_EH_GOPList[layer_index][rIdx].m_POC;
    2431           Int refPics = m_EH_GOPList[layer_index][rIdx].m_numRefPics;
    2432           Int newIdc=0;
    2433           for(Int i = 0; i<= refPics; i++)
    2434           {
    2435             Int deltaPOC = ((i != refPics)? m_EH_GOPList[layer_index][rIdx].m_referencePics[i] : 0);  // check if the reference abs POC is >= 0
    2436             Int absPOCref = refPOC+deltaPOC;
    2437             Int refIdc = 0;
    2438             for (Int j = 0; j < m_EH_GOPList[layer_index][m_iGOPSize+m_extraRPSs[layer_index]].m_numRefPics; j++)
     2355            //step backwards in coding order and include any extra available pictures we might find useful to replace the ones with POC < 0.
     2356            Int offGOP = (checkGOP-1+offset)%m_iGOPSize;
     2357            Int offPOC = ((checkGOP-1+offset)/m_iGOPSize)*m_iGOPSize + m_EhGOPList[layerId][offGOP].m_POC;
     2358            if(offPOC>=0&&m_EhGOPList[layerId][offGOP].m_temporalId<=m_EhGOPList[layerId][curGOP].m_temporalId)
    24392359            {
    2440               if ( (absPOCref - curPOC) == m_EH_GOPList[layer_index][m_iGOPSize+m_extraRPSs[layer_index]].m_referencePics[j])
     2360              Bool newRef=false;
     2361              for(Int i=0; i<numRefs; i++)
    24412362              {
    2442                 if (m_EH_GOPList[layer_index][m_iGOPSize+m_extraRPSs[layer_index]].m_usedByCurrPic[j])
     2363                if(refList[i]==offPOC)
    24432364                {
    2444                   refIdc = 1;
    2445                 }
    2446                 else
    2447                 {
    2448                   refIdc = 2;
     2365                  newRef=true;
    24492366                }
    24502367              }
     2368              for(Int i=0; i<newRefs; i++)
     2369              {
     2370                if(m_EhGOPList[layerId][m_iGOPSize+m_extraRPSs[layerId]].m_referencePics[i]==offPOC-curPOC)
     2371                {
     2372                  newRef=false;
     2373                }
     2374              }
     2375              if(newRef)
     2376              {
     2377                Int insertPoint=newRefs;
     2378                //this picture can be added, find appropriate place in list and insert it.
     2379                if(m_EhGOPList[layerId][offGOP].m_temporalId==m_EhGOPList[layerId][curGOP].m_temporalId)
     2380                {
     2381                  m_EhGOPList[layerId][offGOP].m_refPic = true;
     2382                }
     2383                for(Int j=0; j<newRefs; j++)
     2384                {
     2385                  if(m_EhGOPList[layerId][m_iGOPSize+m_extraRPSs[layerId]].m_referencePics[j]<offPOC-curPOC||m_EhGOPList[layerId][m_iGOPSize+m_extraRPSs[layerId]].m_referencePics[j]>0)
     2386                  {
     2387                    insertPoint = j;
     2388                    break;
     2389                  }
     2390                }
     2391                Int prev = offPOC-curPOC;
     2392                Int prevUsed = m_EhGOPList[layerId][offGOP].m_temporalId<=m_EhGOPList[layerId][curGOP].m_temporalId;
     2393                for(Int j=insertPoint; j<newRefs+1; j++)
     2394                {
     2395                  Int newPrev = m_EhGOPList[layerId][m_iGOPSize+m_extraRPSs[layerId]].m_referencePics[j];
     2396                  Int newUsed = m_EhGOPList[layerId][m_iGOPSize+m_extraRPSs[layerId]].m_usedByCurrPic[j];
     2397                  m_EhGOPList[layerId][m_iGOPSize+m_extraRPSs[layerId]].m_referencePics[j]=prev;
     2398                  m_EhGOPList[layerId][m_iGOPSize+m_extraRPSs[layerId]].m_usedByCurrPic[j]=prevUsed;
     2399                  prevUsed=newUsed;
     2400                  prev=newPrev;
     2401                }
     2402                newRefs++;
     2403              }
    24512404            }
    2452             m_EH_GOPList[layer_index][m_iGOPSize+m_extraRPSs[layer_index]].m_refIdc[newIdc]=refIdc;
    2453             newIdc++;
     2405            if(newRefs>=numPrefRefs)
     2406            {
     2407              break;
     2408            }
    24542409          }
    2455           m_EH_GOPList[layer_index][m_iGOPSize+m_extraRPSs[layer_index]].m_interRPSPrediction = 1; 
    2456           m_EH_GOPList[layer_index][m_iGOPSize+m_extraRPSs[layer_index]].m_numRefIdc = newIdc;
    2457           m_EH_GOPList[layer_index][m_iGOPSize+m_extraRPSs[layer_index]].m_deltaRPS = refPOC - m_EH_GOPList[layer_index][m_iGOPSize+m_extraRPSs[layer_index]].m_POC;
    2458         }
    2459         curGOP=m_iGOPSize+m_extraRPSs[layer_index];
    2460         m_extraRPSs[layer_index]++;
    2461       }
    2462       numRefs=0;
    2463       for(Int i = 0; i< m_EH_GOPList[layer_index][curGOP].m_numRefPics; i++)
    2464       {
    2465         Int absPOC = curPOC+m_EH_GOPList[layer_index][curGOP].m_referencePics[i];
    2466         if(absPOC >= 0)
    2467         {
    2468           refList[numRefs]=absPOC;
    2469           numRefs++;
    2470         }
    2471       }
    2472       refList[numRefs]=curPOC;
    2473       numRefs++;
    2474     }
    2475     checkGOP++;
    2476   }
    2477   xConfirmPara(errorGOP,"Invalid GOP structure given");
     2410          m_EhGOPList[layerId][m_iGOPSize+m_extraRPSs[layerId]].m_numRefPics=newRefs;
     2411          m_EhGOPList[layerId][m_iGOPSize+m_extraRPSs[layerId]].m_POC = curPOC;
     2412          if (m_extraRPSs[layerId] == 0)
     2413          {
     2414            m_EhGOPList[layerId][m_iGOPSize+m_extraRPSs[layerId]].m_interRPSPrediction = 0;
     2415            m_EhGOPList[layerId][m_iGOPSize+m_extraRPSs[layerId]].m_numRefIdc = 0;
     2416          }
     2417          else
     2418          {
     2419            Int rIdx =  m_iGOPSize + m_extraRPSs[layerId] - 1;
     2420            Int refPOC = m_EhGOPList[layerId][rIdx].m_POC;
     2421            Int refPics = m_EhGOPList[layerId][rIdx].m_numRefPics;
     2422            Int newIdc=0;
     2423            for(Int i = 0; i<= refPics; i++)
     2424            {
     2425              Int deltaPOC = ((i != refPics)? m_EhGOPList[layerId][rIdx].m_referencePics[i] : 0);  // check if the reference abs POC is >= 0
     2426              Int absPOCref = refPOC+deltaPOC;
     2427              Int refIdc = 0;
     2428              for (Int j = 0; j < m_EhGOPList[layerId][m_iGOPSize+m_extraRPSs[layerId]].m_numRefPics; j++)
     2429              {
     2430                if ( (absPOCref - curPOC) == m_EhGOPList[layerId][m_iGOPSize+m_extraRPSs[layerId]].m_referencePics[j])
     2431                {
     2432                  if (m_EhGOPList[layerId][m_iGOPSize+m_extraRPSs[layerId]].m_usedByCurrPic[j])
     2433                  {
     2434                    refIdc = 1;
     2435                  }
     2436                  else
     2437                  {
     2438                    refIdc = 2;
     2439                  }
     2440                }
     2441              }
     2442              m_EhGOPList[layerId][m_iGOPSize+m_extraRPSs[layerId]].m_refIdc[newIdc]=refIdc;
     2443              newIdc++;
     2444            }
     2445            m_EhGOPList[layerId][m_iGOPSize+m_extraRPSs[layerId]].m_interRPSPrediction = 1; 
     2446            m_EhGOPList[layerId][m_iGOPSize+m_extraRPSs[layerId]].m_numRefIdc = newIdc;
     2447            m_EhGOPList[layerId][m_iGOPSize+m_extraRPSs[layerId]].m_deltaRPS = refPOC - m_EhGOPList[layerId][m_iGOPSize+m_extraRPSs[layerId]].m_POC;
     2448          }
     2449          curGOP=m_iGOPSize+m_extraRPSs[layerId];
     2450          m_extraRPSs[layerId]++;
     2451        }
     2452        numRefs=0;
     2453        for(Int i = 0; i< m_EhGOPList[layerId][curGOP].m_numRefPics; i++)
     2454        {
     2455          Int absPOC = curPOC+m_EhGOPList[layerId][curGOP].m_referencePics[i];
     2456          if(absPOC >= 0)
     2457          {
     2458            refList[numRefs]=absPOC;
     2459            numRefs++;
     2460          }
     2461        }
     2462        refList[numRefs]=curPOC;
     2463        numRefs++;
     2464      }
     2465      checkGOP++;
     2466    }
     2467    xConfirmPara(errorGOP,"Invalid GOP structure given");
    24782468  }
    24792469#endif
    2480 
    24812470
    24822471  m_maxTempLayer = 1;
     
    24912480
    24922481#if Q0108_TSA_STSA
    2493   for ( Int layer_index = 1; layer_index<m_numLayers; layer_index++)
    2494   {
    2495     m_EH_maxTempLayer[layer_index] = 1;
     2482  for ( Int layerId = 1; layerId < m_numLayers; layerId++)
     2483  {
     2484    m_EhMaxTempLayer[layerId] = 1;
    24962485    for(Int i=0; i<m_iGOPSize; i++)
    24972486    {
    2498       if(m_EH_GOPList[layer_index][i].m_temporalId >= m_EH_maxTempLayer[layer_index] )
    2499       {
    2500         m_EH_maxTempLayer[layer_index] = m_EH_GOPList[layer_index][i].m_temporalId;
     2487      if(m_EhGOPList[layerId][i].m_temporalId >= m_EhMaxTempLayer[layerId] )
     2488      {
     2489        m_EhMaxTempLayer[layerId] = m_EhGOPList[layerId][i].m_temporalId;
    25012490      }
    25022491      xConfirmPara(m_GOPList[i].m_sliceType!='B'&&m_GOPList[i].m_sliceType!='P'&&m_GOPList[i].m_sliceType!='I', "Slice type must be equal to B or P or I");
  • branches/SHM-6-dev/source/App/TAppEncoder/TAppEncCfg.h

    r804 r806  
    129129  Int       m_extraRPSs;                                      ///< extra RPSs added to handle CRA
    130130#else
    131   Int       m_extraRPSs[MAX_LAYERS];                                      ///< extra RPSs added to handle CRA
     131  Int       m_extraRPSs[MAX_LAYERS];                          ///< extra RPSs added to handle CRA
    132132#endif
    133133
    134134  GOPEntry  m_GOPList[MAX_GOP];                               ///< the coding structure entries from the config file
    135135#if Q0108_TSA_STSA
    136   GOPEntry  m_EH_GOPList[MAX_LAYERS][MAX_GOP];                ///< the enhancement layer coding structure entries from the config file
     136  GOPEntry  m_EhGOPList[MAX_LAYERS][MAX_GOP];                 ///< the enhancement layer coding structure entries from the config file
    137137  Int       m_inheritCodingStruct[MAX_LAYERS];
    138138#endif
     
    166166  Int       m_maxTempLayer;                                  ///< Max temporal layer
    167167#if Q0108_TSA_STSA
    168   Int       m_EH_maxTempLayer[MAX_LAYERS];                                  ///< Max temporal layer
     168  Int       m_EhMaxTempLayer[MAX_LAYERS];                    ///< Max temporal layer
    169169#endif
    170170
  • branches/SHM-6-dev/source/App/TAppEncoder/TAppEncTop.cpp

    r805 r806  
    241241    m_acTEncTop[layer].setGOPSize                      ( m_iGOPSize );
    242242#if Q0108_TSA_STSA
    243     if(layer == 0)
    244       m_acTEncTop[layer].setGopList                      ( m_GOPList );
    245     else
    246       m_acTEncTop[layer].setGopList                      ( m_EH_GOPList[layer] );
     243    m_acTEncTop[layer].setGopList                      ( layer ? m_EhGOPList[layer] : m_GOPList );
    247244#else
    248245    m_acTEncTop[layer].setGopList                      ( m_GOPList );
     
    275272    else
    276273    {
    277       m_acTEncTop[layer].setMaxTempLayer                 ( m_EH_maxTempLayer[layer] );
     274      m_acTEncTop[layer].setMaxTempLayer                 ( m_EhMaxTempLayer[layer] );
    278275    }
    279276#endif
  • branches/SHM-6-dev/source/Lib/TLibCommon/TypeDef.h

    r805 r806  
    4141#define SVC_EXTENSION                    1
    4242
    43 #define Q0108_TSA_STSA                   1     
    44 
    45 #define SYNTAX_BYTES                     10      ///< number of bytes taken by syntaxes per 4x4 block [RefIdxL0(1byte), RefIdxL1(1byte), MVxL0(2bytes), MVyL0(2bytes), MVxL1(2bytes), MVyL1(2bytes)]
     43#define SYNTAX_BYTES                     10     ///< number of bytes taken by syntaxes per 4x4 block [RefIdxL0(1byte), RefIdxL1(1byte), MVxL0(2bytes), MVyL0(2bytes), MVxL1(2bytes), MVyL1(2bytes)]
    4644#if SVC_EXTENSION
    4745#define MAX_LAYERS                       8      ///< max number of layers the codec is supposed to handle
     
    5048#define O0137_MAX_LAYERID                1      ///< JCTVC-O0137, JCTVC-O0200, JCTVC-O0223: restrict nuh_layer_id and vps_max_layers_minus1
    5149
     50#define Q0108_TSA_STSA                   1      ///< JCTVC-Q0108, Remove cross-layer alignment constraints of TSA and STSA pictures, enable to have different prediction structures in different layers
    5251#define Q0177_SPS_TEMP_NESTING_FIX       1      ///< JCTVC-Q0177; Fix the inference value of sps_temporal_id_nesting_flag when it is not present
    5352#define Q0177_EOS_CHECKS                 1      ///< JCTVC-Q0177; Put checks on handling EOS
     
    5554#define Q0146_SSH_EXT_DATA_BIT           1      ///< JCTVC-Q0146; Bug-fix -- the SSH_EXT_DATA_BIT can have any value -- not required to be 1
    5655
    57 #define Q0200_CONFORMANCE_BL_SIZE        1       ///< JCTVC-Q0200; use conformance picture size in re-sampling processs
     56#define Q0200_CONFORMANCE_BL_SIZE        1      ///< JCTVC-Q0200; use conformance picture size in re-sampling processs
    5857#define P0312_VERT_PHASE_ADJ             1      ///< JCTVC-P0312: vertical phase adjustment in re-sampling process (BoG report)
    5958#if P0312_VERT_PHASE_ADJ
     
    105104#define POC_RESET_IDC_ENCODER            1      ///< JCTVC-P0041: Include support of enabling POC reset at the encoder
    106105#define POC_RESET_IDC_DECODER            1      ///< JCTVC-P0041: Include support of enabling POC reset at the decoder
    107 #define ALIGN_IRAP_BUGFIX               1
    108 #define UNAVAILABLE_PIC_BUGFIX          1
     106#define ALIGN_IRAP_BUGFIX                1
     107#define UNAVAILABLE_PIC_BUGFIX           1
    109108#endif
    110109#define POC_MSB_VAL_PRESENT_FLAG_SEM     1      ///< JCTVC-Q0146: Inference of poc_msb_val_present_flag
     
    169168#define Q0060_MAX_TID_REF_EQUAL_TO_ZERO  1      ///< JCTVC-Q0060 handling the case max_tid_il_ref_pics_plus1 is equal to 0.
    170169
    171 #define O0223_PICTURE_TYPES_ALIGN_FLAG   1  ///< a flag to indicatate whether picture types are aligned across layers.
     170#define O0223_PICTURE_TYPES_ALIGN_FLAG   1      ///< a flag to indicatate whether picture types are aligned across layers.
    172171
    173172#define P0068_CROSS_LAYER_ALIGNED_IDR_ONLY_FOR_IRAP_FLAG   1  ///< a flag to indicatate whether picture types for IRAP are IDR across layers.
    174173
    175 #define IRAP_ALIGN_FLAG_IN_VPS_VUI       1       ///< Move IRAP align flag to VPS VUI
     174#define IRAP_ALIGN_FLAG_IN_VPS_VUI       1      ///< Move IRAP align flag to VPS VUI
    176175
    177176#define VIEW_ID_RELATED_SIGNALING        1      ///< Introduce syntax elements view_id and view_id_val
  • branches/SHM-6-dev/source/Lib/TLibDecoder/NALread.cpp

    r804 r806  
    114114  if ( nalu.m_temporalId )
    115115  {
    116 #if    !Q0108_TSA_STSA
     116#if !Q0108_TSA_STSA
    117117    assert( nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_BLA_W_LP
    118118         && nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_BLA_W_RADL
     
    139139  else
    140140  {
    141 #if    !Q0108_TSA_STSA
     141#if !Q0108_TSA_STSA
    142142    assert( nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_TSA_R
    143143         && nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_TSA_N
  • branches/SHM-6-dev/source/Lib/TLibEncoder/TEncGOP.cpp

    r804 r806  
    610610  TComOutputBitstream* pcSubstreamsOut = NULL;
    611611#if Q0108_TSA_STSA
    612   Int b_TSTA_flag = 0;
     612  Int flagTSTA = 0;
    613613#endif
    614614
     
    15591559      }
    15601560    }
    1561 #if    Q0108_TSA_STSA
     1561#if Q0108_TSA_STSA
    15621562    else if( ( pcSlice->getTLayer() == 0 && pcSlice->getLayerId() > 0)    // only for enhancement layer and with temporal layer 0
    15631563       && !( pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_RADL_N     
     
    15721572    {
    15731573        Bool isSTSA=true;
    1574         for(Int ii=iGOPid+1;(ii<m_pcCfg->getGOPSize() && isSTSA==true);ii++)
     1574        for(Int ii=iGOPid+1; ii < m_pcCfg->getGOPSize() && isSTSA; ii++)
    15751575        {
    15761576          Int lTid= m_pcCfg->getGOPEntry(ii).m_temporalId;
     
    15781578          {
    15791579            TComReferencePictureSet* nRPS = pcSlice->getSPS()->getRPSList()->getReferencePictureSet(ii);
    1580             for(Int jj=0;jj<nRPS->getNumberOfPictures();jj++)
     1580            for(Int jj=0; jj<nRPS->getNumberOfPictures(); jj++)
    15811581            {
    15821582              if(nRPS->getUsed(jj))
     
    15841584                Int tPoc=m_pcCfg->getGOPEntry(ii).m_POC+nRPS->getDeltaPOC(jj);
    15851585                Int kk=0;
    1586                 for(kk=0;kk<m_pcCfg->getGOPSize();kk++)
     1586                for(kk=0; kk<m_pcCfg->getGOPSize(); kk++)
    15871587                {
    15881588                  if(m_pcCfg->getGOPEntry(kk).m_POC==tPoc)
     1589                  {
    15891590                    break;
     1591                  }
    15901592                }
    15911593                Int tTid=m_pcCfg->getGOPEntry(kk).m_temporalId;
    15921594                if(tTid >= pcSlice->getTLayer())
    15931595                {
    1594                   isSTSA=false;
     1596                  isSTSA = false;
    15951597                  break;
    15961598                }
     
    16611663          {
    16621664            pcSlice->setNalUnitType(NAL_UNIT_CODED_SLICE_STSA_N);
    1663             b_TSTA_flag = 1;
     1665            flagTSTA = 1;
    16641666          }
    16651667          else
    16661668          {
    16671669            pcSlice->setNalUnitType(NAL_UNIT_CODED_SLICE_STSA_R);
    1668             b_TSTA_flag = 1;
     1670            flagTSTA = 1;
    16691671          }
    16701672#endif
     
    16841686    {
    16851687#if POC_RESET_FLAG || POC_RESET_IDC_ENCODER
    1686       if ( pocCurr > 0          && pcSlice->isRADL() && pcPic->getSlice(0)->getBaseColPic(pcPic->getSlice(0)->getInterLayerPredLayerIdc(0))->getSlice(0)->isRASL())
     1688      if ( pocCurr > 0 && pcSlice->isRADL() && pcPic->getSlice(0)->getBaseColPic(pcPic->getSlice(0)->getInterLayerPredLayerIdc(0))->getSlice(0)->isRASL())
    16871689#else
    16881690      if (pcSlice->getPOC()>0  && pcSlice->isRADL() && pcPic->getSlice(0)->getBaseColPic(pcPic->getSlice(0)->getInterLayerPredLayerIdc(0))->getSlice(0)->isRASL())
     
    16921694        pcSlice->setInterLayerPredEnabledFlag(0);
    16931695      }
    1694 #if   Q0108_TSA_STSA
    1695      if( (pcSlice->getNalUnitType() >= NAL_UNIT_CODED_SLICE_BLA_W_LP && pcSlice->getNalUnitType() <= NAL_UNIT_CODED_SLICE_CRA ) || b_TSTA_flag == 1)
     1696#if Q0108_TSA_STSA
     1697     if( ( pcSlice->getNalUnitType() >= NAL_UNIT_CODED_SLICE_BLA_W_LP && pcSlice->getNalUnitType() <= NAL_UNIT_CODED_SLICE_CRA ) || flagTSTA == 1 )
    16961698#else
    16971699     if( pcSlice->getNalUnitType() >= NAL_UNIT_CODED_SLICE_BLA_W_LP && pcSlice->getNalUnitType() <= NAL_UNIT_CODED_SLICE_CRA )
Note: See TracChangeset for help on using the changeset viewer.