Ignore:
Timestamp:
8 Oct 2013, 11:25:37 (11 years ago)
Author:
sony
Message:

IL_SL_SIGNALLING_N0371

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/SHM-3.1-dev/source/Lib/TLibEncoder/TEncCavlc.cpp

    r411 r414  
    221221  }
    222222  WRITE_FLAG( pcPPS->getScalingListPresentFlag() ? 1 : 0,                          "pps_scaling_list_data_present_flag" );
     223
     224#if IL_SL_SIGNALLING_N0371
     225  pcPPS->setPPS( pcPPS->getLayerId(), pcPPS ); 
     226#endif
     227
    223228  if( pcPPS->getScalingListPresentFlag() )
    224229  {
     
    226231    printf("PPS\n");
    227232#endif
     233
     234#if IL_SL_SIGNALLING_N0371
     235    m_pcSlice->getScalingList()->setLayerId( pcPPS->getLayerId() );
     236
     237    if( pcPPS->getLayerId() > 0 )
     238    {
     239      WRITE_FLAG( pcPPS->getPredScalingListFlag() ? 1 : 0,                          "pps_pred_scaling_list_flag" );
     240      m_pcSlice->getScalingList()->setPredScalingListFlag( pcPPS->getPredScalingListFlag() );
     241
     242      if( pcPPS->getPredScalingListFlag() )
     243      {
     244        // The value of pps_scaling_list_ref_layer_id shall be in the range of 0 to 62, inclusive
     245        assert( pcPPS->getScalingListRefLayerId() >= 0 && pcPPS->getScalingListRefLayerId() <= 62 );
     246
     247        // When avc_base_layer_flag is equal to 1, it is a requirement of bitstream conformance that the value of pps_scaling_list_ref_layer_id shall be greater than 0
     248        if( pcPPS->getSPS()->getVPS()->getAvcBaseLayerFlag() )
     249        {
     250          assert( pcPPS->getScalingListRefLayerId() > 0 );
     251        }
     252
     253        // It is a requirement of bitstream conformance that, when a PPS with nuh_layer_id equal to nuhLayerIdA is active for a layer with nuh_layer_id equal to nuhLayerIdB and
     254        // pps_infer_scaling_list_flag in the PPS is equal to 1, pps_infer_scaling_list_flag shall be equal to 0 for the PPS that is active for the layer with nuh_layer_id equal to pps_scaling_list_ref_layer_id
     255        assert( pcPPS->getPPS( pcPPS->getScalingListRefLayerId() )->getPredScalingListFlag() == false );
     256
     257        // It is a requirement of bitstream conformance that, when a PPS with nuh_layer_id equal to nuhLayerIdA is active for a layer with nuh_layer_id equal to nuhLayerIdB,
     258        // the layer with nuh_layer_id equal to pps_scaling_list_ref_layer_id shall be a direct or indirect reference layer of the layer with nuh_layer_id equal to nuhLayerIdB
     259        assert( pcPPS->getSPS()->getVPS()->getScalingListLayerDependency( pcPPS->getLayerId(), pcPPS->getScalingListRefLayerId() ) == true );
     260       
     261        WRITE_UVLC( pcPPS->getScalingListRefLayerId(),                            "scaling_list_pps_ref_layer_id" );
     262        m_pcSlice->getScalingList()->setScalingListRefLayerId( pcPPS->getScalingListRefLayerId() );
     263        codeScalingList( m_pcSlice->getScalingList() );
     264      }
     265      else
     266      {
     267        codeScalingList( m_pcSlice->getScalingList() );
     268      }
     269    }
     270    else
     271    {
     272      codeScalingList( m_pcSlice->getScalingList() );
     273    }
     274#else
    228275    codeScalingList( m_pcSlice->getScalingList() );
     276#endif
     277
    229278  }
    230279  WRITE_FLAG( pcPPS->getListsModificationPresentFlag(), "lists_modification_present_flag");
     
    489538  WRITE_UVLC( pcSPS->getQuadtreeTUMaxDepthIntra() - 1,                               "max_transform_hierarchy_depth_intra" );
    490539  WRITE_FLAG( pcSPS->getScalingListFlag() ? 1 : 0,                                   "scaling_list_enabled_flag" );
     540
     541#if IL_SL_SIGNALLING_N0371
     542  pcSPS->setSPS( pcSPS->getLayerId(), pcSPS );
     543#endif
     544
    491545  if(pcSPS->getScalingListFlag())
    492546  {
     
    497551    printf("SPS\n");
    498552#endif
     553
     554#if IL_SL_SIGNALLING_N0371
     555    m_pcSlice->getScalingList()->setLayerId( pcSPS->getLayerId() );
     556
     557    if( pcSPS->getLayerId() > 0 )
     558    {
     559      WRITE_FLAG( pcSPS->getPredScalingListFlag() ? 1 : 0,                          "sps_pred_scaling_list_flag" );
     560      m_pcSlice->getScalingList()->setPredScalingListFlag( pcSPS->getPredScalingListFlag() );
     561
     562      if( pcSPS->getPredScalingListFlag() )
     563      {
     564
     565        // The value of sps_scaling_list_ref_layer_id shall be in the range of 0 to 62, inclusive
     566        assert( pcSPS->getScalingListRefLayerId() >= 0 && pcSPS->getScalingListRefLayerId() <= 62 );
     567       
     568        // When avc_base_layer_flag is equal to 1, it is a requirement of bitstream conformance that the value of sps_scaling_list_ref_layer_id shall be greater than 0
     569        if( pcSPS->getVPS()->getAvcBaseLayerFlag() )
     570        {
     571          assert( pcSPS->getScalingListRefLayerId() > 0 );
     572        }
     573
     574        // It is a requirement of bitstream conformance that, when an SPS with nuh_layer_id equal to nuhLayerIdA is active for a layer with nuh_layer_id equal to nuhLayerIdB and
     575        // sps_infer_scaling_list_flag in the SPS is equal to 1, sps_infer_scaling_list_flag shall be equal to 0 for the SPS that is active for the layer with nuh_layer_id equal to sps_scaling_list_ref_layer_id
     576        assert( pcSPS->getSPS( pcSPS->getScalingListRefLayerId() )->getPredScalingListFlag() == false );
     577
     578        // It is a requirement of bitstream conformance that, when an SPS with nuh_layer_id equal to nuhLayerIdA is active for a layer with nuh_layer_id equal to nuhLayerIdB,
     579        // the layer with nuh_layer_id equal to sps_scaling_list_ref_layer_id shall be a direct or indirect reference layer of the layer with nuh_layer_id equal to nuhLayerIdB
     580        assert( pcSPS->getVPS()->getScalingListLayerDependency( pcSPS->getLayerId(), pcSPS->getScalingListRefLayerId() ) == true );
     581
     582        WRITE_UVLC( pcSPS->getScalingListRefLayerId(),                            "scaling_list_sps_ref_layer_id" );
     583        m_pcSlice->getScalingList()->setScalingListRefLayerId( pcSPS->getScalingListRefLayerId() );
     584        codeScalingList( m_pcSlice->getScalingList() );
     585      }
     586      else
     587      {
     588        codeScalingList( m_pcSlice->getScalingList() );
     589      }
     590    }
     591    else
     592    {
    499593      codeScalingList( m_pcSlice->getScalingList() );
     594    }
     595#else
     596      codeScalingList( m_pcSlice->getScalingList() );
     597#endif
     598
    500599    }
    501600  }
     
    517616  TComRPSList* rpsList = pcSPS->getRPSList();
    518617  TComReferencePictureSet*      rps;
    519 
     618 
    520619  WRITE_UVLC(rpsList->getNumberOfReferencePictureSets(), "num_short_term_ref_pic_sets" );
    521620  for(Int i=0; i < rpsList->getNumberOfReferencePictureSets(); i++)
     
    9491048    }
    9501049  }
     1050
     1051#if IL_SL_SIGNALLING_N0371
     1052  for(i = 1; i < vps->getMaxLayers(); i++)
     1053  {
     1054    for(j = 0; j < i; j++)
     1055    {
     1056      vps->setScalingListLayerDependency( i, j, vps->checkLayerDependency( i,j ) );
     1057    }
     1058  }
     1059#endif
     1060
    9511061#endif
    9521062#if M0040_ADAPTIVE_RESOLUTION_CHANGE
     
    19012011        startBit = m_pcBitIf->getNumberOfWrittenBits();
    19022012#endif
     2013
     2014#if IL_SL_SIGNALLING_N0371
     2015        if( scalingList->getLayerId() > 0 && scalingList->getPredScalingListFlag() )
     2016        {
     2017          scalingListPredModeFlag = scalingList->checkPredMode( sizeId, listId );
     2018          WRITE_FLAG( scalingListPredModeFlag, "scaling_list_pred_mode_flag" );
     2019          if(!scalingListPredModeFlag)// Copy Mode
     2020          {
     2021            WRITE_UVLC( (Int)listId - (Int)scalingList->getRefMatrixId (sizeId,listId), "scaling_list_pred_matrix_id_delta");
     2022          }
     2023          else// DPCM Mode
     2024          {
     2025            xCodeScalingList(scalingList, sizeId, listId);
     2026          }
     2027        }
     2028        else
     2029        {
     2030          scalingListPredModeFlag = scalingList->checkPredMode( sizeId, listId );
     2031          WRITE_FLAG( scalingListPredModeFlag, "scaling_list_pred_mode_flag" );
     2032          if(!scalingListPredModeFlag)// Copy Mode
     2033          {
     2034            WRITE_UVLC( (Int)listId - (Int)scalingList->getRefMatrixId (sizeId,listId), "scaling_list_pred_matrix_id_delta");
     2035          }
     2036          else// DPCM Mode
     2037          {
     2038            xCodeScalingList(scalingList, sizeId, listId);
     2039          }
     2040        }
     2041#else
    19032042        scalingListPredModeFlag = scalingList->checkPredMode( sizeId, listId );
    19042043        WRITE_FLAG( scalingListPredModeFlag, "scaling_list_pred_mode_flag" );
     
    19112050          xCodeScalingList(scalingList, sizeId, listId);
    19122051        }
     2052#endif
     2053
    19132054#if SCALING_LIST_OUTPUT_RESULT
    19142055        printf("Matrix [%d][%d] Bit %d\n",sizeId,listId,m_pcBitIf->getNumberOfWrittenBits() - startBit);
    19152056#endif
     2057
    19162058      }
    19172059    }
     
    19332075  Int data;
    19342076  Int *src = scalingList->getScalingListAddress(sizeId, listId);
     2077
    19352078    if( sizeId > SCALING_LIST_8x8 )
    19362079    {
     2080#if IL_SL_SIGNALLING_N0371
     2081      if( scalingList->getLayerId() > 0 && scalingList->getPredScalingListFlag() )
     2082      {
     2083        ref_scalingListDC[scalingList->getLayerId()][sizeId][listId] = scalingList->getScalingListDC(sizeId,listId);
     2084        scalingList->setScalingListDC(sizeId,listId,ref_scalingListDC[scalingList->getScalingListRefLayerId()][sizeId][listId]);
     2085      }
     2086      else
     2087      {
     2088        WRITE_SVLC( scalingList->getScalingListDC(sizeId,listId) - 8, "scaling_list_dc_coef_minus8");
     2089        nextCoef = scalingList->getScalingListDC(sizeId,listId);
     2090        ref_scalingListDC[scalingList->getLayerId()][sizeId][listId] = scalingList->getScalingListDC(sizeId,listId);
     2091      }
     2092#else
    19372093      WRITE_SVLC( scalingList->getScalingListDC(sizeId,listId) - 8, "scaling_list_dc_coef_minus8");
    19382094      nextCoef = scalingList->getScalingListDC(sizeId,listId);
     2095#endif
    19392096    }
    19402097    for(Int i=0;i<coefNum;i++)
    19412098    {
     2099#if IL_SL_SIGNALLING_N0371
     2100      if( scalingList->getLayerId() > 0 && scalingList->getPredScalingListFlag() )
     2101      {
     2102        ref_scalingListCoef[scalingList->getLayerId()][sizeId][listId][i] = src[scan[i]];
     2103        src[scan[i]] = ref_scalingListCoef[scalingList->getScalingListRefLayerId()][sizeId][listId][i];
     2104      }
     2105      else
     2106      {
     2107        data = src[scan[i]] - nextCoef;
     2108        ref_scalingListCoef[scalingList->getLayerId()][sizeId][listId][i] = src[scan[i]];
     2109        nextCoef = src[scan[i]];
     2110        if(data > 127)
     2111        {
     2112          data = data - 256;
     2113        }
     2114        if(data < -128)
     2115        {
     2116          data = data + 256;
     2117        }
     2118
     2119        WRITE_SVLC( data,  "scaling_list_delta_coef");
     2120      }
     2121#else
    19422122      data = src[scan[i]] - nextCoef;
    19432123      nextCoef = src[scan[i]];
     
    19522132
    19532133      WRITE_SVLC( data,  "scaling_list_delta_coef");
     2134#endif
    19542135    }
    19552136}
Note: See TracChangeset for help on using the changeset viewer.