Ignore:
Timestamp:
23 May 2013, 15:40:36 (12 years ago)
Author:
tech
Message:

Integrated 3D encoder control, camera parameters, renderer and MV fixes.

Location:
branches/HTM-DEV-0.2-dev/source/Lib/TLibEncoder
Files:
18 edited

Legend:

Unmodified
Added
Removed
  • branches/HTM-DEV-0.2-dev/source/Lib/TLibEncoder/SEIwrite.cpp

    r362 r438  
    8484    fprintf( g_hTrace, "=========== Decoding Unit Information SEI message ===========\n");
    8585    break;
    86 #if J0149_TONE_MAPPING_SEI
    87   case SEI::TONE_MAPPING_INFO:
    88     fprintf( g_hTrace, "=========== Tone Mapping Info SEI message ===========\n");
    89     break;
    90 #endif
    91 #if L0208_SOP_DESCRIPTION_SEI
    92   case SEI::SOP_DESCRIPTION:
    93     fprintf( g_hTrace, "=========== SOP Description SEI message ===========\n");
    94     break;
    95 #endif
    96 #if K0180_SCALABLE_NESTING_SEI
    97   case SEI::SCALABLE_NESTING:
    98     fprintf( g_hTrace, "=========== Scalable Nesting SEI message ===========\n");
    99     break;
    100 #endif
    10186  default:
    10287    fprintf( g_hTrace, "=========== Unknown SEI message ===========\n");
     
    10691#endif
    10792
    108 #if K0180_SCALABLE_NESTING_SEI
    109 void SEIWriter::xWriteSEIpayloadData(TComBitIf& bs, const SEI& sei, TComSPS *sps)
    110 #else
    11193void SEIWriter::xWriteSEIpayloadData(const SEI& sei, TComSPS *sps)
    112 #endif
    11394{
    11495  switch (sei.payloadType())
     
    147128    xWriteSEIGradualDecodingRefreshInfo(*static_cast<const SEIGradualDecodingRefreshInfo*>(&sei));
    148129    break;
    149 #if J0149_TONE_MAPPING_SEI
    150   case SEI::TONE_MAPPING_INFO:
    151     xWriteSEIToneMappingInfo(*static_cast<const SEIToneMappingInfo*>(&sei));
    152     break;
    153 #endif
    154 #if L0208_SOP_DESCRIPTION_SEI
    155   case SEI::SOP_DESCRIPTION:
    156     xWriteSEISOPDescription(*static_cast<const SEISOPDescription*>(&sei));
    157     break;
    158 #endif
    159 #if K0180_SCALABLE_NESTING_SEI
    160   case SEI::SCALABLE_NESTING:
    161     xWriteSEIScalableNesting(bs, *static_cast<const SEIScalableNesting*>(&sei), sps);
    162     break;
    163 #endif
    164130  default:
    165131    assert(!"Unhandled SEI message");
     
    179145  setBitstream(&bs_count);
    180146
    181 
    182 #if K0180_SCALABLE_NESTING_SEI
    183 
    184 #if ENC_DEC_TRACE
    185   Bool traceEnable = g_HLSTraceEnable;
    186   g_HLSTraceEnable = false;
    187 #endif
    188   xWriteSEIpayloadData(bs_count, sei, sps);
    189 #if ENC_DEC_TRACE
    190   g_HLSTraceEnable = traceEnable;
    191 #endif
    192 
    193 #else
    194 
    195147#if ENC_DEC_TRACE
    196148  g_HLSTraceEnable = false;
     
    200152  g_HLSTraceEnable = true;
    201153#endif
    202 
    203 #endif
    204 
    205154  UInt payload_data_num_bits = bs_count.getNumberOfWrittenBits();
    206155  assert(0 == payload_data_num_bits % 8);
     
    209158
    210159#if ENC_DEC_TRACE
    211 #if K0180_SCALABLE_NESTING_SEI
    212   if (g_HLSTraceEnable)
    213 #endif
    214160  xTraceSEIHeader();
    215161#endif
     
    231177  /* payloadData */
    232178#if ENC_DEC_TRACE
    233 #if K0180_SCALABLE_NESTING_SEI
    234   if (g_HLSTraceEnable)
    235 #endif
    236179  xTraceSEIMessageType(sei.payloadType());
    237180#endif
    238181
    239 #if K0180_SCALABLE_NESTING_SEI
    240   xWriteSEIpayloadData(bs, sei, sps);
    241 #else
    242182  xWriteSEIpayloadData(sei, sps);
    243 #endif
    244183}
    245184
     
    482421  xWriteByteAlign();
    483422}
    484 
    485 #if J0149_TONE_MAPPING_SEI
    486 Void SEIWriter::xWriteSEIToneMappingInfo(const SEIToneMappingInfo& sei)
    487 {
    488   Int i;
    489   WRITE_UVLC( sei.m_toneMapId,                    "tone_map_id" );
    490   WRITE_FLAG( sei.m_toneMapCancelFlag,            "tone_map_cancel_flag" );
    491   if( !sei.m_toneMapCancelFlag )
    492   {
    493     WRITE_FLAG( sei.m_toneMapPersistenceFlag,     "tone_map_persistence_flag" );
    494     WRITE_CODE( sei.m_codedDataBitDepth,    8,    "coded_data_bit_depth" );
    495     WRITE_CODE( sei.m_targetBitDepth,       8,    "target_bit_depth" );
    496     WRITE_UVLC( sei.m_modelId,                    "model_id" );
    497     switch(sei.m_modelId)
    498     {
    499     case 0:
    500       {
    501         WRITE_CODE( sei.m_minValue,  32,        "min_value" );
    502         WRITE_CODE( sei.m_maxValue, 32,         "max_value" );
    503         break;
    504       }
    505     case 1:
    506       {
    507         WRITE_CODE( sei.m_sigmoidMidpoint, 32,  "sigmoid_midpoint" );
    508         WRITE_CODE( sei.m_sigmoidWidth,    32,  "sigmoid_width"    );
    509         break;
    510       }
    511     case 2:
    512       {
    513         UInt num = 1u << sei.m_targetBitDepth;
    514         for(i = 0; i < num; i++)
    515         {
    516           WRITE_CODE( sei.m_startOfCodedInterval[i], (( sei.m_codedDataBitDepth + 7 ) >> 3 ) << 3,  "start_of_coded_interval" );
    517         }
    518         break;
    519       }
    520     case 3:
    521       {
    522         WRITE_CODE( sei.m_numPivots, 16,          "num_pivots" );
    523         for(i = 0; i < sei.m_numPivots; i++ )
    524         {
    525           WRITE_CODE( sei.m_codedPivotValue[i], (( sei.m_codedDataBitDepth + 7 ) >> 3 ) << 3,       "coded_pivot_value" );
    526           WRITE_CODE( sei.m_targetPivotValue[i], (( sei.m_targetBitDepth + 7 ) >> 3 ) << 3,         "target_pivot_value");
    527         }
    528         break;
    529       }
    530     case 4:
    531       {
    532         WRITE_CODE( sei.m_cameraIsoSpeedIdc,    8,    "camera_iso_speed_idc" );
    533         if( sei.m_cameraIsoSpeedIdc == 255) //Extended_ISO
    534         {
    535           WRITE_CODE( sei.m_cameraIsoSpeedValue,    32,    "camera_iso_speed_value" );
    536         }
    537         WRITE_FLAG( sei.m_exposureCompensationValueSignFlag,           "exposure_compensation_value_sign_flag" );
    538         WRITE_CODE( sei.m_exposureCompensationValueNumerator,     16,  "exposure_compensation_value_numerator" );
    539         WRITE_CODE( sei.m_exposureCompensationValueDenomIdc,      16,  "exposure_compensation_value_denom_idc" );
    540         WRITE_CODE( sei.m_refScreenLuminanceWhite,                32,  "ref_screen_luminance_white" );
    541         WRITE_CODE( sei.m_extendedRangeWhiteLevel,                32,  "extended_range_white_level" );
    542         WRITE_CODE( sei.m_nominalBlackLevelLumaCodeValue,         16,  "nominal_black_level_luma_code_value" );
    543         WRITE_CODE( sei.m_nominalWhiteLevelLumaCodeValue,         16,  "nominal_white_level_luma_code_value" );
    544         WRITE_CODE( sei.m_extendedWhiteLevelLumaCodeValue,        16,  "extended_white_level_luma_code_value" );
    545         break;
    546       }
    547     default:
    548       {
    549         assert(!"Undefined SEIToneMapModelId");
    550         break;
    551       }
    552     }//switch m_modelId
    553   }//if(!sei.m_toneMapCancelFlag)
    554 
    555   xWriteByteAlign();
    556 }
    557 #endif
    558 
    559423Void SEIWriter::xWriteSEIDisplayOrientation(const SEIDisplayOrientation &sei)
    560424{
     
    591455}
    592456
    593 #if L0208_SOP_DESCRIPTION_SEI
    594 Void SEIWriter::xWriteSEISOPDescription(const SEISOPDescription& sei)
    595 {
    596   WRITE_UVLC( sei.m_sopSeqParameterSetId,           "sop_seq_parameter_set_id"               );
    597   WRITE_UVLC( sei.m_numPicsInSopMinus1,             "num_pics_in_sop_minus1"               );
    598   for (UInt i = 0; i <= sei.m_numPicsInSopMinus1; i++)
    599   {
    600     WRITE_CODE( sei.m_sopDescVclNaluType[i], 6, "sop_desc_vcl_nalu_type" );
    601     WRITE_CODE( sei.m_sopDescTemporalId[i],  3, "sop_desc_temporal_id" );
    602     if (sei.m_sopDescVclNaluType[i] != NAL_UNIT_CODED_SLICE_IDR_W_RADL && sei.m_sopDescVclNaluType[i] != NAL_UNIT_CODED_SLICE_IDR_N_LP)
    603     {
    604       WRITE_UVLC( sei.m_sopDescStRpsIdx[i],           "sop_desc_st_rps_idx"               );
    605     }
    606     if (i > 0)
    607     {
    608       WRITE_SVLC( sei.m_sopDescPocDelta[i],           "sop_desc_poc_delta"               );
    609     }
    610   }
    611 
    612   xWriteByteAlign();
    613 }
    614 #endif
    615 
    616 #if K0180_SCALABLE_NESTING_SEI
    617 Void SEIWriter::xWriteSEIScalableNesting(TComBitIf& bs, const SEIScalableNesting& sei, TComSPS *sps)
    618 {
    619   WRITE_FLAG( sei.m_bitStreamSubsetFlag,             "bitstream_subset_flag"         );
    620   WRITE_FLAG( sei.m_nestingOpFlag,                   "nesting_op_flag      "         );
    621   if (sei.m_nestingOpFlag)
    622   {
    623     WRITE_FLAG( sei.m_defaultOpFlag,                 "default_op_flag"               );
    624     WRITE_UVLC( sei.m_nestingNumOpsMinus1,           "nesting_num_ops"               );
    625     for (UInt i = (sei.m_defaultOpFlag ? 1 : 0); i <= sei.m_nestingNumOpsMinus1; i++)
    626     {
    627       WRITE_CODE( sei.m_nestingNoOpMaxTemporalIdPlus1, 3, "nesting_no_op_max_temporal_id" );
    628       WRITE_CODE( sei.m_nestingMaxTemporalIdPlus1[i], 3,  "nesting_max_temporal_id"       );
    629       WRITE_UVLC( sei.m_nestingOpIdx[i],                  "nesting_op_idx"                );
    630     }
    631   }
    632   else
    633   {
    634     WRITE_FLAG( sei.m_allLayersFlag,                      "all_layers_flag"               );
    635     if (!sei.m_allLayersFlag)
    636     {
    637       WRITE_CODE( sei.m_nestingNoOpMaxTemporalIdPlus1, 3, "nesting_no_op_max_temporal_id" );
    638       WRITE_UVLC( sei.m_nestingNumLayersMinus1,           "nesting_num_layers"            );
    639       for (UInt i = 0; i <= sei.m_nestingNumLayersMinus1; i++)
    640       {
    641         WRITE_CODE( sei.m_nestingLayerId[i], 6,           "nesting_layer_id"              );
    642       }
    643     }
    644   }
    645  
    646   // byte alignment
    647   while ( m_pcBitIf->getNumberOfWrittenBits() % 8 != 0 )
    648   {
    649     WRITE_FLAG( 0, "nesting_zero_bit" );
    650   }
    651 
    652   // write nested SEI messages
    653   for (SEIMessages::const_iterator it = sei.m_nestedSEIs.begin(); it != sei.m_nestedSEIs.end(); it++)
    654   {
    655     writeSEImessage(bs, *(*it), sps);
    656   }
    657 }
    658 #endif
    659 
    660457Void SEIWriter::xWriteByteAlign()
    661458{
  • branches/HTM-DEV-0.2-dev/source/Lib/TLibEncoder/SEIwrite.h

    r362 r438  
    5050
    5151protected:
    52 #if K0180_SCALABLE_NESTING_SEI
    53   Void xWriteSEIpayloadData(TComBitIf& bs, const SEI& sei, TComSPS *sps);
    54 #else
    5552  Void xWriteSEIpayloadData(const SEI& sei, TComSPS *sps);
    56 #endif
    5753  Void xWriteSEIuserDataUnregistered(const SEIuserDataUnregistered &sei);
    5854  Void xWriteSEIActiveParameterSets(const SEIActiveParameterSets& sei);
     
    6763  Void xWriteSEITemporalLevel0Index(const SEITemporalLevel0Index &sei);
    6864  Void xWriteSEIGradualDecodingRefreshInfo(const SEIGradualDecodingRefreshInfo &sei);
    69 #if J0149_TONE_MAPPING_SEI
    70   Void xWriteSEIToneMappingInfo(const SEIToneMappingInfo& sei);
    71 #endif
    72 #if L0208_SOP_DESCRIPTION_SEI
    73   Void xWriteSEISOPDescription(const SEISOPDescription& sei);
    74 #endif
    75 #if K0180_SCALABLE_NESTING_SEI
    76   Void xWriteSEIScalableNesting(TComBitIf& bs, const SEIScalableNesting& sei, TComSPS *sps);
    77 #endif
    7865  Void xWriteByteAlign();
    7966};
  • branches/HTM-DEV-0.2-dev/source/Lib/TLibEncoder/TEncBinCoderCABAC.cpp

    r401 r438  
    185185{
    186186  {
    187 #if !H_MV
    188187    DTRACE_CABAC_VL( g_nSymbolCounter++ )
    189188    DTRACE_CABAC_T( "\tstate=" )
     
    192191    DTRACE_CABAC_V( binValue )
    193192    DTRACE_CABAC_T( "\n" )
    194 #endif
    195193  }
    196194  m_uiBinsCoded += m_binCountIncrement;
     
    233231{
    234232  {
    235 #if !H_MV
    236233    DTRACE_CABAC_VL( g_nSymbolCounter++ )
    237234    DTRACE_CABAC_T( "\tEPsymbol=" )
    238235    DTRACE_CABAC_V( binValue )
    239236    DTRACE_CABAC_T( "\n" )
    240 #endif
    241237  }
    242238  m_uiBinsCoded += m_binCountIncrement;
     
    263259  for ( Int i = 0; i < numBins; i++ )
    264260  {
    265 #if !H_MV
    266261    DTRACE_CABAC_VL( g_nSymbolCounter++ )
    267262    DTRACE_CABAC_T( "\tEPsymbol=" )
    268263    DTRACE_CABAC_V( ( binValues >> ( numBins - 1 - i ) ) & 1 )
    269264    DTRACE_CABAC_T( "\n" )
    270 #endif
    271265  }
    272266 
  • branches/HTM-DEV-0.2-dev/source/Lib/TLibEncoder/TEncCavlc.cpp

    r401 r438  
    285285  WRITE_FLAG(pcVUI->getNeutralChromaIndicationFlag(),           "neutral_chroma_indication_flag");
    286286  WRITE_FLAG(pcVUI->getFieldSeqFlag(),                          "field_seq_flag");
     287  assert(pcVUI->getFieldSeqFlag() == 0);                        // not currently supported
    287288  WRITE_FLAG(pcVUI->getFrameFieldInfoPresentFlag(),             "frame_field_info_present_flag");
    288289
     
    473474  for(UInt i=0; i <= pcSPS->getMaxTLayers()-1; i++)
    474475  {
    475 #if L0323_DPB
    476     WRITE_UVLC( pcSPS->getMaxDecPicBuffering(i) - 1,       "sps_max_dec_pic_buffering_minus1[i]" );
    477 #else
    478476    WRITE_UVLC( pcSPS->getMaxDecPicBuffering(i),           "sps_max_dec_pic_buffering[i]" );
    479 #endif
    480477    WRITE_UVLC( pcSPS->getNumReorderPics(i),               "sps_num_reorder_pics[i]" );
    481478    WRITE_UVLC( pcSPS->getMaxLatencyIncrease(i),           "sps_max_latency_increase[i]" );
     
    487484  assert( pcSPS->getMaxCUWidth() == pcSPS->getMaxCUHeight() );
    488485 
    489   WRITE_UVLC( pcSPS->getLog2MinCodingBlockSize() - 3,                                "log2_min_coding_block_size_minus3" );
    490   WRITE_UVLC( pcSPS->getLog2DiffMaxMinCodingBlockSize(),                             "log2_diff_max_min_coding_block_size" );
     486  UInt MinCUSize = pcSPS->getMaxCUWidth() >> ( pcSPS->getMaxCUDepth()-g_uiAddCUDepth );
     487  UInt log2MinCUSize = 0;
     488  while(MinCUSize > 1)
     489  {
     490    MinCUSize >>= 1;
     491    log2MinCUSize++;
     492  }
     493
     494  WRITE_UVLC( log2MinCUSize - 3,                                                     "log2_min_coding_block_size_minus3" );
     495  WRITE_UVLC( pcSPS->getMaxCUDepth()-g_uiAddCUDepth,                                 "log2_diff_max_min_coding_block_size" );
    491496  WRITE_UVLC( pcSPS->getQuadtreeTULog2MinSize() - 2,                                 "log2_min_transform_block_size_minus2" );
    492497  WRITE_UVLC( pcSPS->getQuadtreeTULog2MaxSize() - pcSPS->getQuadtreeTULog2MinSize(), "log2_diff_max_min_transform_block_size" );
     
    549554  }
    550555
    551 #if H_MV
    552   WRITE_FLAG( 1, "sps_extension_flag" );
    553 
    554   WRITE_FLAG( pcSPS->getInterViewMvVertConstraintFlag() ? 1 : 0, "inter_view_mv_vert_constraint_flag" );
    555 #else
    556556  WRITE_FLAG( 0, "sps_extension_flag" );
    557 #endif
    558557}
    559558
     
    570569  WRITE_FLAG( pcVPS->getTemporalNestingFlag(),                "vps_temporal_id_nesting_flag" );
    571570  assert (pcVPS->getMaxTLayers()>1||pcVPS->getTemporalNestingFlag());
    572 #if H_MV
    573571  WRITE_CODE( 0xffff,                              16,        "vps_extension_offset" );
    574 #else
    575   WRITE_CODE( 0xffff,                              16,        "vps_reserved_ffff_16bits" );
    576 #endif
    577572  codePTL( pcVPS->getPTL(), true, pcVPS->getMaxTLayers() - 1 );
    578573#if SIGNAL_BITRATE_PICRATE_IN_VPS
     
    583578  for(UInt i=0; i <= pcVPS->getMaxTLayers()-1; i++)
    584579  {
    585 #if L0323_DPB
    586     WRITE_UVLC( pcVPS->getMaxDecPicBuffering(i) - 1,       "vps_max_dec_pic_buffering_minus1[i]" );
    587 #else
    588580    WRITE_UVLC( pcVPS->getMaxDecPicBuffering(i),           "vps_max_dec_pic_buffering[i]" );
    589 #endif
    590581    WRITE_UVLC( pcVPS->getNumReorderPics(i),               "vps_num_reorder_pics[i]" );
    591582    WRITE_UVLC( pcVPS->getMaxLatencyIncrease(i),           "vps_max_latency_increase[i]" );
     
    654645  }
    655646#endif
     647
    656648#if H_MV
    657649  WRITE_FLAG( 1,                                             "vps_extension_flag" );
     
    792784      WRITE_CODE( picOrderCntLSB, pcSlice->getSPS()->getBitsForPOC(), "pic_order_cnt_lsb");
    793785      TComReferencePictureSet* rps = pcSlice->getRPS();
    794      
    795 #if FIX1071
    796       // Deal with bitstream restriction stating that:
    797       // – If the current picture is a BLA or CRA picture, the value of NumPocTotalCurr shall be equal to 0.
    798       // Ideally this process should not be repeated for each slice in a picture
    799       TComReferencePictureSet altRps;
    800       Bool useAltRps = false;
    801 #if H_MV
    802       if (pcSlice->getRapPicFlag() && ( pcSlice->getLayerId() == 0 ) )
    803 #else
    804       if (pcSlice->getRapPicFlag())
    805 #endif
    806       {
    807         for (Int picIdx = 0; !useAltRps && picIdx < rps->getNumberOfPictures(); picIdx++)
    808         {
    809           useAltRps = rps->getUsed(picIdx);
    810         }
    811         if (useAltRps)
    812         {
    813           memcpy(&altRps, rps, sizeof(TComReferencePictureSet));
    814           rps = &altRps;
    815           for (Int picIdx = 0; picIdx < rps->getNumberOfPictures(); picIdx++)
    816           {
    817             rps->setUsed(picIdx, false);
    818           }
    819         }
    820       }
    821 
    822       if(pcSlice->getRPSidx() < 0 || useAltRps)
    823 #else
    824786      if(pcSlice->getRPSidx() < 0)
    825 #endif
    826787      {
    827788        WRITE_FLAG( 0, "short_term_ref_pic_set_sps_flag");
     
    14061367// ====================================================================================================================
    14071368
     1369
     1370/** Write PCM alignment bits.
     1371 * \returns Void
     1372 */
     1373Void  TEncCavlc::xWritePCMAlignZero    ()
     1374{
     1375  m_pcBitIf->writeAlignZero();
     1376}
     1377
     1378Void TEncCavlc::xWriteUnaryMaxSymbol( UInt uiSymbol, UInt uiMaxSymbol )
     1379{
     1380  if (uiMaxSymbol == 0)
     1381  {
     1382    return;
     1383  }
     1384  xWriteFlag( uiSymbol ? 1 : 0 );
     1385  if ( uiSymbol == 0 )
     1386  {
     1387    return;
     1388  }
     1389 
     1390  Bool bCodeLast = ( uiMaxSymbol > uiSymbol );
     1391 
     1392  while( --uiSymbol )
     1393  {
     1394    xWriteFlag( 1 );
     1395  }
     1396  if( bCodeLast )
     1397  {
     1398    xWriteFlag( 0 );
     1399  }
     1400  return;
     1401}
     1402
     1403Void TEncCavlc::xWriteExGolombLevel( UInt uiSymbol )
     1404{
     1405  if( uiSymbol )
     1406  {
     1407    xWriteFlag( 1 );
     1408    UInt uiCount = 0;
     1409    Bool bNoExGo = (uiSymbol < 13);
     1410   
     1411    while( --uiSymbol && ++uiCount < 13 )
     1412    {
     1413      xWriteFlag( 1 );
     1414    }
     1415    if( bNoExGo )
     1416    {
     1417      xWriteFlag( 0 );
     1418    }
     1419    else
     1420    {
     1421      xWriteEpExGolomb( uiSymbol, 0 );
     1422    }
     1423  }
     1424  else
     1425  {
     1426    xWriteFlag( 0 );
     1427  }
     1428  return;
     1429}
     1430
     1431Void TEncCavlc::xWriteEpExGolomb( UInt uiSymbol, UInt uiCount )
     1432{
     1433  while( uiSymbol >= (UInt)(1<<uiCount) )
     1434  {
     1435    xWriteFlag( 1 );
     1436    uiSymbol -= 1<<uiCount;
     1437    uiCount  ++;
     1438  }
     1439  xWriteFlag( 0 );
     1440  while( uiCount-- )
     1441  {
     1442    xWriteFlag( (uiSymbol>>uiCount) & 1 );
     1443  }
     1444  return;
     1445}
     1446
    14081447/** code explicit wp tables
    14091448 * \param TComSlice* pcSlice
  • branches/HTM-DEV-0.2-dev/source/Lib/TLibEncoder/TEncCavlc.h

    r362 r438  
    6868  TComSlice*    m_pcSlice;
    6969  UInt          m_uiCoeffCost;
     70
     71  Void  xWritePCMAlignZero    ();
     72  Void  xWriteEpExGolomb      ( UInt uiSymbol, UInt uiCount );
     73  Void  xWriteExGolombLevel    ( UInt uiSymbol );
     74  Void  xWriteUnaryMaxSymbol  ( UInt uiSymbol, UInt uiMaxSymbol );
    7075
    7176  Void codeShortTermRefPicSet              ( TComSPS* pcSPS, TComReferencePictureSet* pcRPS, Bool calledFromSliceHeader, Int idx );
  • branches/HTM-DEV-0.2-dev/source/Lib/TLibEncoder/TEncCfg.h

    r372 r438  
    7474  Int m_interViewRefPosL[2][MAX_NUM_REF_PICS]; 
    7575#endif
     76
    7677  GOPEntry()
    7778  : m_POC(-1)
     
    171172  Int       m_loopFilterTcOffsetDiv2;
    172173  Bool      m_DeblockingFilterControlPresent;
    173 #if L0386_DB_METRIC
    174   Bool      m_DeblockingFilterMetric;
    175 #endif
    176174  Bool      m_bUseSAO;
    177175  Int       m_maxNumOffsetsPerPic;
     
    204202  Bool      m_bUseASR;
    205203  Bool      m_bUseHADME;
    206 #if !L0034_COMBINED_LIST_CLEANUP
    207204  Bool      m_bUseLComb;
    208 #endif
    209205  Bool      m_useRDOQ;
    210206  Bool      m_useRDOQTS;
     
    252248  Int       m_pictureTimingSEIEnabled;
    253249  Int       m_recoveryPointSEIEnabled;
    254 #if J0149_TONE_MAPPING_SEI
    255   Bool      m_toneMappingInfoSEIEnabled;
    256   Int       m_toneMapId;
    257   Bool      m_toneMapCancelFlag;
    258   Bool      m_toneMapPersistenceFlag;
    259   Int       m_codedDataBitDepth;
    260   Int       m_targetBitDepth;
    261   Int       m_modelId;
    262   Int       m_minValue;
    263   Int       m_maxValue;
    264   Int       m_sigmoidMidpoint;
    265   Int       m_sigmoidWidth;
    266   Int       m_numPivots;
    267   Int       m_cameraIsoSpeedIdc;
    268   Int       m_cameraIsoSpeedValue;
    269   Int       m_exposureCompensationValueSignFlag;
    270   Int       m_exposureCompensationValueNumerator;
    271   Int       m_exposureCompensationValueDenomIdc;
    272   Int       m_refScreenLuminanceWhite;
    273   Int       m_extendedRangeWhiteLevel;
    274   Int       m_nominalBlackLevelLumaCodeValue;
    275   Int       m_nominalWhiteLevelLumaCodeValue;
    276   Int       m_extendedWhiteLevelLumaCodeValue;
    277   Int*      m_startOfCodedInterval;
    278   Int*      m_codedPivotValue;
    279   Int*      m_targetPivotValue;
    280 #endif
    281250  Int       m_framePackingSEIEnabled;
    282251  Int       m_framePackingSEIType;
     
    288257  Int       m_gradualDecodingRefreshInfoEnabled;
    289258  Int       m_decodingUnitInfoSEIEnabled;
    290 #if L0208_SOP_DESCRIPTION_SEI
    291   Int       m_SOPDescriptionSEIEnabled;
    292 #endif
    293 #if K0180_SCALABLE_NESTING_SEI
    294   Int       m_scalableNestingSEIEnabled;
    295 #endif
    296259  //====== Weighted Prediction ========
    297260  Bool      m_useWeightedPred;       //< Use of Weighting Prediction (P_SLICE)
     
    362325#endif
    363326#endif
     327
    364328public:
    365329  TEncCfg()
     
    407371#endif
    408372#endif
     373
    409374  //====== Coding Structure ========
    410375  Void      setIntraPeriod                  ( Int   i )      { m_uiIntraPeriod = (UInt)i; }
     
    444409  Void      setLoopFilterTcOffset           ( Int   i )      { m_loopFilterTcOffsetDiv2    = i; }
    445410  Void      setDeblockingFilterControlPresent ( Bool b ) { m_DeblockingFilterControlPresent = b; }
    446 #if L0386_DB_METRIC
    447   Void      setDeblockingFilterMetric       ( Bool  b )      { m_DeblockingFilterMetric = b; }
    448 #endif
    449411
    450412  //====== Motion search ========
     
    501463  Int       getLoopFilterTcOffset           ()      { return m_loopFilterTcOffsetDiv2; }
    502464  Bool      getDeblockingFilterControlPresent()  { return  m_DeblockingFilterControlPresent; }
    503 #if L0386_DB_METRIC
    504   Bool      getDeblockingFilterMetric       ()      { return m_DeblockingFilterMetric; }
    505 #endif
    506465
    507466  //==== Motion search ========
     
    521480  Void      setUseASR                       ( Bool  b )     { m_bUseASR     = b; }
    522481  Void      setUseHADME                     ( Bool  b )     { m_bUseHADME   = b; }
    523 #if !L0034_COMBINED_LIST_CLEANUP
    524482  Void      setUseLComb                     ( Bool  b )     { m_bUseLComb   = b; }
    525 #endif
    526483  Void      setUseRDOQ                      ( Bool  b )     { m_useRDOQ    = b; }
    527484  Void      setUseRDOQTS                    ( Bool  b )     { m_useRDOQTS  = b; }
     
    545502  Bool      getUseASR                       ()      { return m_bUseASR;     }
    546503  Bool      getUseHADME                     ()      { return m_bUseHADME;   }
    547 #if !L0034_COMBINED_LIST_CLEANUP
    548504  Bool      getUseLComb                     ()      { return m_bUseLComb;   }
    549 #endif
    550505  Bool      getUseRDOQ                      ()      { return m_useRDOQ;    }
    551506  Bool      getUseRDOQTS                    ()      { return m_useRDOQTS;  }
     
    644599  Void  setRecoveryPointSEIEnabled(Int b)                { m_recoveryPointSEIEnabled = b; }
    645600  Int   getRecoveryPointSEIEnabled()                     { return m_recoveryPointSEIEnabled; }
    646 #if J0149_TONE_MAPPING_SEI
    647   Void  setToneMappingInfoSEIEnabled(Bool b)                 {  m_toneMappingInfoSEIEnabled = b;  }
    648   Bool  getToneMappingInfoSEIEnabled()                       {  return m_toneMappingInfoSEIEnabled;  }
    649   Void  setTMISEIToneMapId(Int b)                            {  m_toneMapId = b;  }
    650   Int   getTMISEIToneMapId()                                 {  return m_toneMapId;  }
    651   Void  setTMISEIToneMapCancelFlag(Bool b)                   {  m_toneMapCancelFlag=b;  }
    652   Bool  getTMISEIToneMapCancelFlag()                         {  return m_toneMapCancelFlag;  }
    653   Void  setTMISEIToneMapPersistenceFlag(Bool b)              {  m_toneMapPersistenceFlag = b;  }
    654   Bool   getTMISEIToneMapPersistenceFlag()                   {  return m_toneMapPersistenceFlag;  }
    655   Void  setTMISEICodedDataBitDepth(Int b)                    {  m_codedDataBitDepth = b;  }
    656   Int   getTMISEICodedDataBitDepth()                         {  return m_codedDataBitDepth;  }
    657   Void  setTMISEITargetBitDepth(Int b)                       {  m_targetBitDepth = b;  }
    658   Int   getTMISEITargetBitDepth()                            {  return m_targetBitDepth;  }
    659   Void  setTMISEIModelID(Int b)                              {  m_modelId = b;  }
    660   Int   getTMISEIModelID()                                   {  return m_modelId;  }
    661   Void  setTMISEIMinValue(Int b)                             {  m_minValue = b;  }
    662   Int   getTMISEIMinValue()                                  {  return m_minValue;  }
    663   Void  setTMISEIMaxValue(Int b)                             {  m_maxValue = b;  }
    664   Int   getTMISEIMaxValue()                                  {  return m_maxValue;  }
    665   Void  setTMISEISigmoidMidpoint(Int b)                      {  m_sigmoidMidpoint = b;  }
    666   Int   getTMISEISigmoidMidpoint()                           {  return m_sigmoidMidpoint;  }
    667   Void  setTMISEISigmoidWidth(Int b)                         {  m_sigmoidWidth = b;  }
    668   Int   getTMISEISigmoidWidth()                              {  return m_sigmoidWidth;  }
    669   Void  setTMISEIStartOfCodedInterva( Int*  p )              {  m_startOfCodedInterval = p;  }
    670   Int*  getTMISEIStartOfCodedInterva()                       {  return m_startOfCodedInterval;  }
    671   Void  setTMISEINumPivots(Int b)                            {  m_numPivots = b;  }
    672   Int   getTMISEINumPivots()                                 {  return m_numPivots;  }
    673   Void  setTMISEICodedPivotValue( Int*  p )                  {  m_codedPivotValue = p;  }
    674   Int*  getTMISEICodedPivotValue()                           {  return m_codedPivotValue;  }
    675   Void  setTMISEITargetPivotValue( Int*  p )                 {  m_targetPivotValue = p;  }
    676   Int*  getTMISEITargetPivotValue()                          {  return m_targetPivotValue;  }
    677   Void  setTMISEICameraIsoSpeedIdc(Int b)                    {  m_cameraIsoSpeedIdc = b;  }
    678   Int   getTMISEICameraIsoSpeedIdc()                         {  return m_cameraIsoSpeedIdc;  }
    679   Void  setTMISEICameraIsoSpeedValue(Int b)                  {  m_cameraIsoSpeedValue = b;  }
    680   Int   getTMISEICameraIsoSpeedValue()                       {  return m_cameraIsoSpeedValue;  }
    681   Void  setTMISEIExposureCompensationValueSignFlag(Int b)    {  m_exposureCompensationValueSignFlag = b;  }
    682   Int   getTMISEIExposureCompensationValueSignFlag()         {  return m_exposureCompensationValueSignFlag;  }
    683   Void  setTMISEIExposureCompensationValueNumerator(Int b)   {  m_exposureCompensationValueNumerator = b;  }
    684   Int   getTMISEIExposureCompensationValueNumerator()        {  return m_exposureCompensationValueNumerator;  }
    685   Void  setTMISEIExposureCompensationValueDenomIdc(Int b)    {  m_exposureCompensationValueDenomIdc =b;  }
    686   Int   getTMISEIExposureCompensationValueDenomIdc()         {  return m_exposureCompensationValueDenomIdc;  }
    687   Void  setTMISEIRefScreenLuminanceWhite(Int b)              {  m_refScreenLuminanceWhite = b;  }
    688   Int   getTMISEIRefScreenLuminanceWhite()                   {  return m_refScreenLuminanceWhite;  }
    689   Void  setTMISEIExtendedRangeWhiteLevel(Int b)              {  m_extendedRangeWhiteLevel = b;  }
    690   Int   getTMISEIExtendedRangeWhiteLevel()                   {  return m_extendedRangeWhiteLevel;  }
    691   Void  setTMISEINominalBlackLevelLumaCodeValue(Int b)       {  m_nominalBlackLevelLumaCodeValue = b;  }
    692   Int   getTMISEINominalBlackLevelLumaCodeValue()            {  return m_nominalBlackLevelLumaCodeValue;  }
    693   Void  setTMISEINominalWhiteLevelLumaCodeValue(Int b)       {  m_nominalWhiteLevelLumaCodeValue = b;  }
    694   Int   getTMISEINominalWhiteLevelLumaCodeValue()            {  return m_nominalWhiteLevelLumaCodeValue;  }
    695   Void  setTMISEIExtendedWhiteLevelLumaCodeValue(Int b)      {  m_extendedWhiteLevelLumaCodeValue =b;  }
    696   Int   getTMISEIExtendedWhiteLevelLumaCodeValue()           {  return m_extendedWhiteLevelLumaCodeValue;  }
    697 #endif
    698601  Void  setFramePackingArrangementSEIEnabled(Int b)      { m_framePackingSEIEnabled = b; }
    699602  Int   getFramePackingArrangementSEIEnabled()           { return m_framePackingSEIEnabled; }
     
    714617  Void  setDecodingUnitInfoSEIEnabled(Int b)                { m_decodingUnitInfoSEIEnabled = b;    }
    715618  Int   getDecodingUnitInfoSEIEnabled()                     { return m_decodingUnitInfoSEIEnabled; }
    716 #if L0208_SOP_DESCRIPTION_SEI
    717   Void  setSOPDescriptionSEIEnabled(Int b)                { m_SOPDescriptionSEIEnabled = b; }
    718   Int   getSOPDescriptionSEIEnabled()                     { return m_SOPDescriptionSEIEnabled; }
    719 #endif
    720 #if K0180_SCALABLE_NESTING_SEI
    721   Void  setScalableNestingSEIEnabled(Int b)                { m_scalableNestingSEIEnabled = b; }
    722   Int   getScalableNestingSEIEnabled()                     { return m_scalableNestingSEIEnabled; }
    723 #endif
    724619  Void      setUseWP               ( Bool b )    { m_useWeightedPred   = b;    }
    725620  Void      setWPBiPred            ( Bool b )    { m_useWeightedBiPred = b;    }
  • branches/HTM-DEV-0.2-dev/source/Lib/TLibEncoder/TEncEntropy.cpp

    r401 r438  
    587587  if( pcCU->isIntra(uiAbsPartIdx) )
    588588  {
    589 #if !H_MV
    590589    DTRACE_CABAC_VL( g_nSymbolCounter++ )
    591590    DTRACE_CABAC_T( "\tdecodeTransformIdx()\tCUDepth=" )
    592591    DTRACE_CABAC_V( uiDepth )
    593592    DTRACE_CABAC_T( "\n" )
    594 #endif
    595593  }
    596594  else
  • branches/HTM-DEV-0.2-dev/source/Lib/TLibEncoder/TEncGOP.cpp

    r401 r438  
    9696#if L0045_NON_NESTED_SEI_RESTRICTIONS
    9797  xResetNonNestedSEIPresentFlags();
    98 #if K0180_SCALABLE_NESTING_SEI
    99   xResetNestedSEIPresentFlags();
    100 #endif
    101 #endif
     98#endif
     99
    102100#if H_MV
    103101  m_layerId      = 0;
     
    108106#endif
    109107#endif
     108
    110109  return;
    111110}
     
    212211}
    213212
    214 #if J0149_TONE_MAPPING_SEI
    215 SEIToneMappingInfo*  TEncGOP::xCreateSEIToneMappingInfo()
    216 {
    217   SEIToneMappingInfo *seiToneMappingInfo = new SEIToneMappingInfo();
    218   seiToneMappingInfo->m_toneMapId = m_pcCfg->getTMISEIToneMapId();
    219   seiToneMappingInfo->m_toneMapCancelFlag = m_pcCfg->getTMISEIToneMapCancelFlag();
    220   seiToneMappingInfo->m_toneMapPersistenceFlag = m_pcCfg->getTMISEIToneMapPersistenceFlag();
    221 
    222   seiToneMappingInfo->m_codedDataBitDepth = m_pcCfg->getTMISEICodedDataBitDepth();
    223   assert(seiToneMappingInfo->m_codedDataBitDepth >= 8 && seiToneMappingInfo->m_codedDataBitDepth <= 14);
    224   seiToneMappingInfo->m_targetBitDepth = m_pcCfg->getTMISEITargetBitDepth();
    225   assert( (seiToneMappingInfo->m_targetBitDepth >= 1 && seiToneMappingInfo->m_targetBitDepth <= 17) || (seiToneMappingInfo->m_targetBitDepth  == 255) );
    226   seiToneMappingInfo->m_modelId = m_pcCfg->getTMISEIModelID();
    227   assert(seiToneMappingInfo->m_modelId >=0 &&seiToneMappingInfo->m_modelId<=4);
    228 
    229   switch( seiToneMappingInfo->m_modelId)
    230   {
    231   case 0:
    232     {
    233       seiToneMappingInfo->m_minValue = m_pcCfg->getTMISEIMinValue();
    234       seiToneMappingInfo->m_maxValue = m_pcCfg->getTMISEIMaxValue();
    235       break;
    236     }
    237   case 1:
    238     {
    239       seiToneMappingInfo->m_sigmoidMidpoint = m_pcCfg->getTMISEISigmoidMidpoint();
    240       seiToneMappingInfo->m_sigmoidWidth = m_pcCfg->getTMISEISigmoidWidth();
    241       break;
    242     }
    243   case 2:
    244     {
    245       UInt num = 1u<<(seiToneMappingInfo->m_targetBitDepth);
    246       seiToneMappingInfo->m_startOfCodedInterval.resize(num);
    247       Int* ptmp = m_pcCfg->getTMISEIStartOfCodedInterva();
    248       if(ptmp)
    249       {
    250         for(int i=0; i<num;i++)
    251         {
    252           seiToneMappingInfo->m_startOfCodedInterval[i] = ptmp[i];
    253         }
    254       }
    255       break;
    256     }
    257   case 3:
    258     {
    259       seiToneMappingInfo->m_numPivots = m_pcCfg->getTMISEINumPivots();
    260       seiToneMappingInfo->m_codedPivotValue.resize(seiToneMappingInfo->m_numPivots);
    261       seiToneMappingInfo->m_targetPivotValue.resize(seiToneMappingInfo->m_numPivots);
    262       Int* ptmpcoded = m_pcCfg->getTMISEICodedPivotValue();
    263       Int* ptmptarget = m_pcCfg->getTMISEITargetPivotValue();
    264       if(ptmpcoded&&ptmptarget)
    265       {
    266         for(int i=0; i<(seiToneMappingInfo->m_numPivots);i++)
    267         {
    268           seiToneMappingInfo->m_codedPivotValue[i]=ptmpcoded[i];
    269           seiToneMappingInfo->m_targetPivotValue[i]=ptmptarget[i];
    270          }
    271        }
    272        break;
    273      }
    274   case 4:
    275      {
    276        seiToneMappingInfo->m_cameraIsoSpeedIdc = m_pcCfg->getTMISEICameraIsoSpeedIdc();
    277        seiToneMappingInfo->m_cameraIsoSpeedValue = m_pcCfg->getTMISEICameraIsoSpeedValue();
    278        assert( seiToneMappingInfo->m_cameraIsoSpeedValue !=0 );
    279        seiToneMappingInfo->m_exposureCompensationValueSignFlag = m_pcCfg->getTMISEIExposureCompensationValueSignFlag();
    280        seiToneMappingInfo->m_exposureCompensationValueNumerator = m_pcCfg->getTMISEIExposureCompensationValueNumerator();
    281        seiToneMappingInfo->m_exposureCompensationValueDenomIdc = m_pcCfg->getTMISEIExposureCompensationValueDenomIdc();
    282        seiToneMappingInfo->m_refScreenLuminanceWhite = m_pcCfg->getTMISEIRefScreenLuminanceWhite();
    283        seiToneMappingInfo->m_extendedRangeWhiteLevel = m_pcCfg->getTMISEIExtendedRangeWhiteLevel();
    284        assert( seiToneMappingInfo->m_extendedRangeWhiteLevel >= 100 );
    285        seiToneMappingInfo->m_nominalBlackLevelLumaCodeValue = m_pcCfg->getTMISEINominalBlackLevelLumaCodeValue();
    286        seiToneMappingInfo->m_nominalWhiteLevelLumaCodeValue = m_pcCfg->getTMISEINominalWhiteLevelLumaCodeValue();
    287        assert( seiToneMappingInfo->m_nominalWhiteLevelLumaCodeValue > seiToneMappingInfo->m_nominalBlackLevelLumaCodeValue );
    288        seiToneMappingInfo->m_extendedWhiteLevelLumaCodeValue = m_pcCfg->getTMISEIExtendedWhiteLevelLumaCodeValue();
    289        assert( seiToneMappingInfo->m_extendedWhiteLevelLumaCodeValue >= seiToneMappingInfo->m_nominalWhiteLevelLumaCodeValue );
    290        break;
    291     }
    292   default:
    293     {
    294       assert(!"Undefined SEIToneMapModelId");
    295       break;
    296     }
    297   }
    298   return seiToneMappingInfo;
    299 }
    300 #endif
    301213Void TEncGOP::xCreateLeadingSEIMessages (/*SEIMessages seiMessages,*/ AccessUnit &accessUnit, TComSPS *sps)
    302214{
    303   OutputNALUnit nalu(NAL_UNIT_PREFIX_SEI);
     215  OutputNALUnit nalu(NAL_UNIT_SEI);
    304216
    305217  if(m_pcCfg->getActiveParameterSetsSEIEnabled())
     
    322234    SEIFramePacking *sei = xCreateSEIFramePacking ();
    323235
    324     nalu = NALUnit(NAL_UNIT_PREFIX_SEI);
     236    nalu = NALUnit(NAL_UNIT_SEI);
    325237    m_pcEntropyCoder->setBitstream(&nalu.m_Bitstream);
    326238    m_seiWriter.writeSEImessage(nalu.m_Bitstream, *sei, sps);
     
    333245    SEIDisplayOrientation *sei = xCreateSEIDisplayOrientation();
    334246
    335     nalu = NALUnit(NAL_UNIT_PREFIX_SEI);
     247    nalu = NALUnit(NAL_UNIT_SEI);
    336248    m_pcEntropyCoder->setBitstream(&nalu.m_Bitstream);
    337249    m_seiWriter.writeSEImessage(nalu.m_Bitstream, *sei, sps);
     
    340252    delete sei;
    341253  }
    342 #if J0149_TONE_MAPPING_SEI
    343   if(m_pcCfg->getToneMappingInfoSEIEnabled())
    344   {
    345     SEIToneMappingInfo *sei = xCreateSEIToneMappingInfo ();
    346      
    347     nalu = NALUnit(NAL_UNIT_PREFIX_SEI);
    348     m_pcEntropyCoder->setBitstream(&nalu.m_Bitstream);
    349     m_seiWriter.writeSEImessage(nalu.m_Bitstream, *sei, sps);
    350     writeRBSPTrailingBits(nalu.m_Bitstream);
    351     accessUnit.push_back(new NALUnitEBSP(nalu));
    352     delete sei;
    353   }
    354 #endif
    355254}
    356255
     
    358257// Public member functions
    359258// ====================================================================================================================
     259
    360260#if H_MV
    361261Void TEncGOP::initGOP( Int iPOCLast, Int iNumPicRcvd, TComList<TComPic*>& rcListPic, TComList<TComPicYuv*>& rcListPicYuvRecOut, std::list<AccessUnit>& accessUnitsInGOP)
     
    365265}
    366266#endif
     267
    367268#if H_MV
    368269Void TEncGOP::compressPicInGOP( Int iPOCLast, Int iNumPicRcvd, TComList<TComPic*>& rcListPic, TComList<TComPicYuv*>& rcListPicYuvRecOut, std::list<AccessUnit>& accessUnitsInGOP, Int iGOPid)
     
    374275  TComPicYuv*     pcPicYuvRecOut;
    375276  TComSlice*      pcSlice;
    376   TComOutputBitstream  *pcBitstreamRedirect;
    377   pcBitstreamRedirect = new TComOutputBitstream;
     277  TComOutputBitstream* pcBitstreamRedirect = new TComOutputBitstream;
    378278  AccessUnit::iterator  itLocationToPushSliceHeaderNALU; // used to store location where NALU containing slice header is to be inserted
    379279  UInt                  uiOneBitstreamPerSliceLength = 0;
     
    386286  m_iNumPicCoded = 0;
    387287#endif
     288
    388289  SEIPictureTiming pictureTimingSEI;
    389 #if L0208_SOP_DESCRIPTION_SEI
    390   Bool writeSOP = m_pcCfg->getSOPDescriptionSEIEnabled();
    391 #endif
    392 #if K0180_SCALABLE_NESTING_SEI
    393   // Initialize Scalable Nesting SEI with single layer values
    394   SEIScalableNesting scalableNestingSEI;
    395   scalableNestingSEI.m_bitStreamSubsetFlag           = 1;      // If the nested SEI messages are picture buffereing SEI mesages, picure timing SEI messages or sub-picture timing SEI messages, bitstream_subset_flag shall be equal to 1
    396   scalableNestingSEI.m_nestingOpFlag                 = 0;
    397   scalableNestingSEI.m_nestingNumOpsMinus1           = 0;      //nesting_num_ops_minus1
    398   scalableNestingSEI.m_allLayersFlag                 = 0;
    399   scalableNestingSEI.m_nestingNoOpMaxTemporalIdPlus1 = 6 + 1;  //nesting_no_op_max_temporal_id_plus1
    400   scalableNestingSEI.m_nestingNumLayersMinus1        = 1 - 1;  //nesting_num_layers_minus1
    401   scalableNestingSEI.m_nestingLayerId[0]             = 0;
    402   scalableNestingSEI.m_callerOwnsSEIs                = true;
    403 #endif
    404290#if L0044_DU_DPB_OUTPUT_DELAY_HRD
    405291  Int picSptDpbOutputDuDelay = 0;
     
    408294  UInt *accumNalsDU = NULL;
    409295  SEIDecodingUnitInfo decodingUnitInfoSEI;
     296
    410297#if !H_MV
    411298  for ( Int iGOPid=0; iGOPid < m_iGopSize; iGOPid++ )
    412299#endif
     300
    413301  {
    414302    UInt uiColDir = 1;
     
    469357    if(pocCurr>=m_pcCfg->getFramesToBeEncoded())
    470358    {
     359
    471360#if H_MV
    472361      delete pcBitstreamRedirect;
     
    475364      continue;
    476365#endif
    477     }
    478 
    479     if( getNalUnitType(pocCurr, m_iLastIDR) == NAL_UNIT_CODED_SLICE_IDR_W_RADL || getNalUnitType(pocCurr, m_iLastIDR) == NAL_UNIT_CODED_SLICE_IDR_N_LP )
     366
     367    }
     368
     369    if( getNalUnitType(pocCurr) == NAL_UNIT_CODED_SLICE_IDR || getNalUnitType(pocCurr) == NAL_UNIT_CODED_SLICE_IDR_N_LP )
    480370    {
    481371      m_iLastIDR = pocCurr;
     
    495385    pcSlice->setLastIDR(m_iLastIDR);
    496386    pcSlice->setSliceIdx(0);
     387
    497388#if H_MV
    498389    pcPic  ->setLayerId     ( getLayerId() );
     
    506397#endif
    507398#endif
     399
    508400    //set default slice level flag to the same as SPS level flag
    509401    pcSlice->setLFCrossSliceBoundaryFlag(  pcSlice->getPPS()->getLoopFilterAcrossSlicesEnabledFlag()  );
     
    545437#if H_MV
    546438    // Set the nal unit type
    547     pcSlice->setNalUnitType(getNalUnitType(pocCurr, m_iLastIDR));
     439    pcSlice->setNalUnitType(getNalUnitType(pocCurr));
    548440    if( pcSlice->getSliceType() == B_SLICE )
    549441    {
     
    559451    }
    560452    // Set the nal unit type
    561     pcSlice->setNalUnitType(getNalUnitType(pocCurr, m_iLastIDR));
    562 #endif
    563     if(pcSlice->getTemporalLayerNonReferenceFlag())
    564     {
    565       if(pcSlice->getNalUnitType()==NAL_UNIT_CODED_SLICE_TRAIL_R)
     453    pcSlice->setNalUnitType(getNalUnitType(pocCurr));
     454#endif
     455    if(pcSlice->getNalUnitType()==NAL_UNIT_CODED_SLICE_TRAIL_R)
     456    {
     457      if(pcSlice->getTemporalLayerNonReferenceFlag())
    566458      {
    567459        pcSlice->setNalUnitType(NAL_UNIT_CODED_SLICE_TRAIL_N);
    568       }
    569       if(pcSlice->getNalUnitType()==NAL_UNIT_CODED_SLICE_RADL_R)
    570       {
    571         pcSlice->setNalUnitType(NAL_UNIT_CODED_SLICE_RADL_N);
    572       }
    573       if(pcSlice->getNalUnitType()==NAL_UNIT_CODED_SLICE_RASL_R)
    574       {
    575         pcSlice->setNalUnitType(NAL_UNIT_CODED_SLICE_RASL_N);
    576460      }
    577461    }
     
    598482        else
    599483        {
    600           pcSlice->setNalUnitType(NAL_UNIT_CODED_SLICE_TLA_R);
     484          pcSlice->setNalUnitType(NAL_UNIT_CODED_SLICE_TLA);
    601485        }
    602486      }
     
    684568    }
    685569#endif
    686 #if !L0034_COMBINED_LIST_CLEANUP
     570
    687571    if (pcSlice->getSliceType() != B_SLICE || !pcSlice->getSPS()->getUseLComb())
    688572    {
     
    696580      pcSlice->setNumRefIdx(REF_PIC_LIST_C, pcSlice->getNumRefIdx(REF_PIC_LIST_0));
    697581    }
    698 #endif
    699582
    700583    if (pcSlice->getSliceType() == B_SLICE)
     
    722605      pcSlice->setCheckLDC(bLowDelay); 
    723606    }
    724     else
    725     {
    726       pcSlice->setCheckLDC(true); 
    727     }
    728607
    729608    uiColDir = 1-uiColDir;
     
    732611    pcSlice->setRefPOCList();
    733612
    734 #if L0034_COMBINED_LIST_CLEANUP
    735     pcSlice->setList1IdxToList0Idx();
    736 #else
    737613    pcSlice->setNoBackPredFlag( false );
    738614    if ( pcSlice->getSliceType() == B_SLICE && !pcSlice->getRefPicListCombinationFlag())
     
    758634    }
    759635    pcSlice->generateCombinedList();
    760 #endif
    761636
    762637    if (m_pcEncTop->getTMVPModeId() == 2)
     
    1064939    Bool bLFCrossTileBoundary = pcSlice->getPPS()->getLoopFilterAcrossTilesEnabledFlag();
    1065940    m_pcLoopFilter->setCfg(bLFCrossTileBoundary);
    1066 #if L0386_DB_METRIC
    1067     if ( m_pcCfg->getDeblockingFilterMetric() )
    1068     {
    1069       dblMetric(pcPic, uiNumSlices);
    1070     }
    1071 #endif
    1072941    m_pcLoopFilter->loopFilterPic( pcPic );
    1073942
     
    11681037    }
    11691038
    1170 #if L0208_SOP_DESCRIPTION_SEI
    1171     if (writeSOP) // write SOP description SEI (if enabled) at the beginning of GOP
    1172     {
    1173       Int SOPcurrPOC = pocCurr;
    1174 
    1175       OutputNALUnit nalu(NAL_UNIT_PREFIX_SEI);
    1176       m_pcEntropyCoder->setEntropyCoder(m_pcCavlcCoder, pcSlice);
    1177       m_pcEntropyCoder->setBitstream(&nalu.m_Bitstream);
    1178 
    1179       SEISOPDescription SOPDescriptionSEI;
    1180       SOPDescriptionSEI.m_sopSeqParameterSetId = pcSlice->getSPS()->getSPSId();
    1181 
    1182       UInt i = 0;
    1183       UInt prevEntryId = iGOPid;
    1184       for (j = iGOPid; j < m_iGopSize; j++)
    1185       {
    1186         Int deltaPOC = m_pcCfg->getGOPEntry(j).m_POC - m_pcCfg->getGOPEntry(prevEntryId).m_POC;
    1187         if ((SOPcurrPOC + deltaPOC) < m_pcCfg->getFramesToBeEncoded())
    1188         {
    1189           SOPcurrPOC += deltaPOC;
    1190           SOPDescriptionSEI.m_sopDescVclNaluType[i] = getNalUnitType(SOPcurrPOC, m_iLastIDR);
    1191           SOPDescriptionSEI.m_sopDescTemporalId[i] = m_pcCfg->getGOPEntry(j).m_temporalId;
    1192           SOPDescriptionSEI.m_sopDescStRpsIdx[i] = m_pcEncTop->getReferencePictureSetIdxForSOP(pcSlice, SOPcurrPOC, j);
    1193           SOPDescriptionSEI.m_sopDescPocDelta[i] = deltaPOC;
    1194 
    1195           prevEntryId = j;
    1196           i++;
    1197         }
    1198       }
    1199 
    1200       SOPDescriptionSEI.m_numPicsInSopMinus1 = i - 1;
    1201 
    1202       m_seiWriter.writeSEImessage( nalu.m_Bitstream, SOPDescriptionSEI, pcSlice->getSPS());
    1203       writeRBSPTrailingBits(nalu.m_Bitstream);
    1204       accessUnit.push_back(new NALUnitEBSP(nalu));
    1205 
    1206       writeSOP = false;
    1207     }
    1208 #endif
    1209 
    12101039    if( ( m_pcCfg->getPictureTimingSEIEnabled() || m_pcCfg->getDecodingUnitInfoSEIEnabled() ) &&
    12111040        ( pcSlice->getSPS()->getVuiParametersPresentFlag() ) &&
     
    12531082       || ( pcSlice->getSPS()->getVuiParameters()->getHrdParameters()->getVclHrdParametersPresentFlag() ) ) )
    12541083    {
    1255       OutputNALUnit nalu(NAL_UNIT_PREFIX_SEI);
     1084      OutputNALUnit nalu(NAL_UNIT_SEI);
    12561085      m_pcEntropyCoder->setEntropyCoder(m_pcCavlcCoder, pcSlice);
    12571086      m_pcEntropyCoder->setBitstream(&nalu.m_Bitstream);
     
    12941123      writeRBSPTrailingBits(nalu.m_Bitstream);
    12951124#if L0045_NON_NESTED_SEI_RESTRICTIONS
    1296       {
    12971125      UInt seiPositionInAu = xGetFirstSeiLocation(accessUnit);
    12981126      UInt offsetPosition = m_activeParameterSetSEIPresentInAU;   // Insert BP SEI after APS SEI
     
    13041132      accessUnit.insert(it, new NALUnitEBSP(nalu));
    13051133      m_bufferingPeriodSEIPresentInAU = true;
    1306       }
    13071134#else
    13081135      accessUnit.push_back(new NALUnitEBSP(nalu));
    13091136#endif
    13101137
    1311 #if K0180_SCALABLE_NESTING_SEI
    1312       if (m_pcCfg->getScalableNestingSEIEnabled())
    1313       {
    1314         OutputNALUnit naluTmp(NAL_UNIT_PREFIX_SEI);
    1315         m_pcEntropyCoder->setEntropyCoder(m_pcCavlcCoder, pcSlice);
    1316         m_pcEntropyCoder->setBitstream(&naluTmp.m_Bitstream);
    1317         scalableNestingSEI.m_nestedSEIs.clear();
    1318         scalableNestingSEI.m_nestedSEIs.push_back(&sei_buffering_period);
    1319         m_seiWriter.writeSEImessage( naluTmp.m_Bitstream, scalableNestingSEI, pcSlice->getSPS());
    1320         writeRBSPTrailingBits(naluTmp.m_Bitstream);
    1321 #if L0045_NON_NESTED_SEI_RESTRICTIONS
    1322         UInt seiPositionInAu = xGetFirstSeiLocation(accessUnit);
    1323         UInt offsetPosition = m_activeParameterSetSEIPresentInAU + m_bufferingPeriodSEIPresentInAU + m_pictureTimingSEIPresentInAU;   // Insert BP SEI after non-nested APS, BP and PT SEIs
    1324         AccessUnit::iterator it;
    1325         for(j = 0, it = accessUnit.begin(); j < seiPositionInAu + offsetPosition; j++)
    1326         {
    1327           it++;
    1328         }
    1329         accessUnit.insert(it, new NALUnitEBSP(naluTmp));
    1330         m_nestedBufferingPeriodSEIPresentInAU = true;
    1331 #else
    1332         accessUnit.push_back(new NALUnitEBSP(naluTmp));
    1333 #endif
    1334       }
    1335 #endif
    1336 
    13371138      m_lastBPSEI = m_totalCoded;
    13381139      m_cpbRemovalDelay = 0;
     
    13441145      {
    13451146        // Gradual decoding refresh SEI
    1346         OutputNALUnit nalu(NAL_UNIT_PREFIX_SEI);
     1147        OutputNALUnit nalu(NAL_UNIT_SEI);
    13471148        m_pcEntropyCoder->setEntropyCoder(m_pcCavlcCoder, pcSlice);
    13481149        m_pcEntropyCoder->setBitstream(&nalu.m_Bitstream);
     
    13561157      }
    13571158    // Recovery point SEI
    1358       OutputNALUnit nalu(NAL_UNIT_PREFIX_SEI);
     1159      OutputNALUnit nalu(NAL_UNIT_SEI);
    13591160      m_pcEntropyCoder->setEntropyCoder(m_pcCavlcCoder, pcSlice);
    13601161      m_pcEntropyCoder->setBitstream(&nalu.m_Bitstream);
     
    15471348
    15481349          pcSlice->setTileOffstForMultES( uiOneBitstreamPerSliceLength );
     1350          if (!sliceSegment)
     1351          {
    15491352            pcSlice->setTileLocationCount ( 0 );
    1550           m_pcSliceEncoder->encodeSlice(pcPic, pcSubstreamsOut);
     1353            m_pcSliceEncoder->encodeSlice(pcPic, pcBitstreamRedirect, pcSubstreamsOut); // redirect is only used for CAVLC tile position info.
     1354          }
     1355          else
     1356          {
     1357            m_pcSliceEncoder->encodeSlice(pcPic, &nalu.m_Bitstream, pcSubstreamsOut); // nalu.m_Bitstream is only used for CAVLC tile position info.
     1358          }
    15511359
    15521360          {
     
    15801388              if (ui+1 < pcSlice->getPPS()->getNumSubstreams())
    15811389              {
    1582                 puiSubstreamSizes[ui] = pcSubstreamsOut[ui].getNumberOfWrittenBits() + (pcSubstreamsOut[ui].countStartCodeEmulations()<<3);
     1390                puiSubstreamSizes[ui] = pcSubstreamsOut[ui].getNumberOfWrittenBits();
    15831391              }
    15841392            }
     
    16121420          // If current NALU is the last NALU of slice and a NALU was buffered, then (a) Write current NALU (b) Update an write buffered NALU at approproate location in NALU list.
    16131421          Bool bNALUAlignedWrittenToList    = false; // used to ensure current NALU is not written more than once to the NALU list.
    1614           xAttachSliceDataToNalUnit(nalu, pcBitstreamRedirect);
     1422          xWriteTileLocationToSliceHeader(nalu, pcBitstreamRedirect, pcSlice);
    16151423          accessUnit.push_back(new NALUnitEBSP(nalu));
    16161424#if RATE_CONTROL_LAMBDA_DOMAIN
     
    16401448            {
    16411449              UInt numRBSPBytes_nal = UInt((*it)->m_nalUnitData.str().size());
    1642               if ((*it)->m_nalUnitType != NAL_UNIT_PREFIX_SEI && (*it)->m_nalUnitType != NAL_UNIT_SUFFIX_SEI)
     1450              if ((*it)->m_nalUnitType != NAL_UNIT_SEI && (*it)->m_nalUnitType != NAL_UNIT_SEI_SUFFIX)
    16431451              {
    16441452                numRBSPBytes += numRBSPBytes_nal;
     
    17101518      pcPic->compressMotion();
    17111519#endif
     1520
    17121521#if H_MV
    17131522      m_pocLastCoded = pcPic->getPOC();
     
    17401549          digestStr = digestToString(sei_recon_picture_digest.digest, 4);
    17411550        }
    1742         OutputNALUnit nalu(NAL_UNIT_SUFFIX_SEI, pcSlice->getTLayer());
     1551        OutputNALUnit nalu(NAL_UNIT_SEI_SUFFIX, pcSlice->getTLayer());
    17431552
    17441553        /* write the SEI messages */
     
    17641573        sei_temporal_level0_index.rapIdx = m_rapIdx;
    17651574
    1766         OutputNALUnit nalu(NAL_UNIT_PREFIX_SEI);
     1575        OutputNALUnit nalu(NAL_UNIT_SEI);
    17671576
    17681577        /* write the SEI messages */
     
    19041713        if( m_pcCfg->getPictureTimingSEIEnabled() )
    19051714        {
    1906           {
    1907             OutputNALUnit nalu(NAL_UNIT_PREFIX_SEI, pcSlice->getTLayer());
     1715          OutputNALUnit nalu(NAL_UNIT_SEI, pcSlice->getTLayer());
    19081716          m_pcEntropyCoder->setEntropyCoder(m_pcCavlcCoder, pcSlice);
    19091717          m_seiWriter.writeSEImessage(nalu.m_Bitstream, pictureTimingSEI, pcSlice->getSPS());
     
    19251733#endif
    19261734        }
    1927 #if K0180_SCALABLE_NESTING_SEI
    1928           if ( m_pcCfg->getScalableNestingSEIEnabled() ) // put picture timing SEI into scalable nesting SEI
    1929           {
    1930             OutputNALUnit nalu(NAL_UNIT_PREFIX_SEI, pcSlice->getTLayer());
    1931             m_pcEntropyCoder->setEntropyCoder(m_pcCavlcCoder, pcSlice);
    1932             scalableNestingSEI.m_nestedSEIs.clear();
    1933             scalableNestingSEI.m_nestedSEIs.push_back(&pictureTimingSEI);
    1934             m_seiWriter.writeSEImessage(nalu.m_Bitstream, scalableNestingSEI, pcSlice->getSPS());
    1935             writeRBSPTrailingBits(nalu.m_Bitstream);
    1936 #if L0045_NON_NESTED_SEI_RESTRICTIONS
    1937             UInt seiPositionInAu = xGetFirstSeiLocation(accessUnit);
    1938             UInt offsetPosition = m_activeParameterSetSEIPresentInAU
    1939               + m_bufferingPeriodSEIPresentInAU + m_pictureTimingSEIPresentInAU + m_nestedBufferingPeriodSEIPresentInAU;    // Insert PT SEI after APS and BP SEI
    1940             AccessUnit::iterator it;
    1941             for(j = 0, it = accessUnit.begin(); j < seiPositionInAu + offsetPosition; j++)
    1942             {
    1943               it++;
    1944             }
    1945             accessUnit.insert(it, new NALUnitEBSP(nalu));
    1946             m_nestedPictureTimingSEIPresentInAU = true;
    1947 #else
    1948             AccessUnit::iterator it = find_if(accessUnit.begin(), accessUnit.end(), mem_fun(&NALUnit::isSlice));
    1949             accessUnit.insert(it, new NALUnitEBSP(nalu));
    1950 #endif
    1951           }
    1952 #endif
    1953 
    1954         }
    19551735        if( m_pcCfg->getDecodingUnitInfoSEIEnabled() && hrd->getSubPicCpbParamsPresentFlag() )
    19561736        {             
     
    19581738          for( Int i = 0; i < ( pictureTimingSEI.m_numDecodingUnitsMinus1 + 1 ); i ++ )
    19591739          {
    1960             OutputNALUnit nalu(NAL_UNIT_PREFIX_SEI, pcSlice->getTLayer());
     1740            OutputNALUnit nalu(NAL_UNIT_SEI, pcSlice->getTLayer());
    19611741
    19621742            SEIDecodingUnitInfo tempSEI;
     
    20061786                  break;
    20071787                }
    2008                 if ((*it)->m_nalUnitType != NAL_UNIT_PREFIX_SEI && (*it)->m_nalUnitType != NAL_UNIT_SUFFIX_SEI)
     1788                if ((*it)->m_nalUnitType != NAL_UNIT_SEI && (*it)->m_nalUnitType != NAL_UNIT_SEI_SUFFIX)
    20091789                {
    20101790                  ctr++;
     
    20171797#if L0045_NON_NESTED_SEI_RESTRICTIONS
    20181798      xResetNonNestedSEIPresentFlags();
    2019 #if K0180_SCALABLE_NESTING_SEI
    2020       xResetNestedSEIPresentFlags();
    2021 #endif
    20221799#endif
    20231800      pcPic->getPicYuvRec()->copyToPic(pcPicYuvRecOut);
     
    20521829  assert ( m_iNumPicCoded == iNumPicRcvd );
    20531830#endif
     1831
    20541832}
    20551833
     
    22452023    case NAL_UNIT_CODED_SLICE_TRAIL_R: return "TRAIL_R";
    22462024    case NAL_UNIT_CODED_SLICE_TRAIL_N: return "TRAIL_N";
    2247     case NAL_UNIT_CODED_SLICE_TLA_R:      return "TLA_R";
     2025    case NAL_UNIT_CODED_SLICE_TLA: return "TLA";
    22482026    case NAL_UNIT_CODED_SLICE_TSA_N: return "TSA_N";
    22492027    case NAL_UNIT_CODED_SLICE_STSA_R: return "STSA_R";
    22502028    case NAL_UNIT_CODED_SLICE_STSA_N: return "STSA_N";
    2251     case NAL_UNIT_CODED_SLICE_BLA_W_LP:   return "BLA_W_LP";
    2252     case NAL_UNIT_CODED_SLICE_BLA_W_RADL: return "BLA_W_RADL";
     2029    case NAL_UNIT_CODED_SLICE_BLA: return "BLA";
     2030    case NAL_UNIT_CODED_SLICE_BLANT: return "BLANT";
    22532031    case NAL_UNIT_CODED_SLICE_BLA_N_LP: return "BLA_N_LP";
    2254     case NAL_UNIT_CODED_SLICE_IDR_W_RADL: return "IDR_W_RADL";
     2032    case NAL_UNIT_CODED_SLICE_IDR: return "IDR";
    22552033    case NAL_UNIT_CODED_SLICE_IDR_N_LP: return "IDR_N_LP";
    22562034    case NAL_UNIT_CODED_SLICE_CRA: return "CRA";
    2257     case NAL_UNIT_CODED_SLICE_RADL_R:     return "RADL_R";
    2258     case NAL_UNIT_CODED_SLICE_RASL_R:     return "RASL_R";
     2035    case NAL_UNIT_CODED_SLICE_DLP: return "DLP";
     2036    case NAL_UNIT_CODED_SLICE_TFD: return "TFD";
    22592037    case NAL_UNIT_VPS: return "VPS";
    22602038    case NAL_UNIT_SPS: return "SPS";
     
    22642042    case NAL_UNIT_EOB: return "EOB";
    22652043    case NAL_UNIT_FILLER_DATA: return "FILLER";
    2266     case NAL_UNIT_PREFIX_SEI:             return "SEI";
    2267     case NAL_UNIT_SUFFIX_SEI:             return "SEI";
     2044    case NAL_UNIT_SEI: return "SEI";
    22682045    default: return "UNK";
    22692046  }
     
    23562133    printf("*** %6s numBytesInNALunit: %u\n", nalUnitTypeToString((*it)->m_nalUnitType), numRBSPBytes_nal);
    23572134#endif
    2358     if ((*it)->m_nalUnitType != NAL_UNIT_PREFIX_SEI && (*it)->m_nalUnitType != NAL_UNIT_SUFFIX_SEI)
     2135    if ((*it)->m_nalUnitType != NAL_UNIT_SEI && (*it)->m_nalUnitType != NAL_UNIT_SEI_SUFFIX)
    23592136    {
    23602137      numRBSPBytes += numRBSPBytes_nal;
     
    23662143
    23672144  //===== add PSNR =====
     2145
    23682146#if H_MV
    23692147  m_pcEncTop->getAnalyzeAll()->addResult (dYPSNR, dUPSNR, dVPSNR, (Double)uibits);
     
    23712149  m_gcAnalyzeAll.addResult (dYPSNR, dUPSNR, dVPSNR, (Double)uibits);
    23722150#endif
     2151
    23732152  TComSlice*  pcSlice = pcPic->getSlice(0);
    23742153  if (pcSlice->isIntra())
    23752154  {
     2155
    23762156#if H_MV
    23772157    m_pcEncTop->getAnalyzeI()->addResult (dYPSNR, dUPSNR, dVPSNR, (Double)uibits);
     
    23792159    m_gcAnalyzeI.addResult (dYPSNR, dUPSNR, dVPSNR, (Double)uibits);
    23802160#endif
     2161
    23812162  }
    23822163  if (pcSlice->isInterP())
    23832164  {
     2165
    23842166#if H_MV
    23852167    m_pcEncTop->getAnalyzeP()->addResult (dYPSNR, dUPSNR, dVPSNR, (Double)uibits);
     
    23872169    m_gcAnalyzeP.addResult (dYPSNR, dUPSNR, dVPSNR, (Double)uibits);
    23882170#endif
     2171
    23892172  }
    23902173  if (pcSlice->isInterB())
    23912174  {
     2175
    23922176#if H_MV
    23932177    m_pcEncTop->getAnalyzeB()->addResult (dYPSNR, dUPSNR, dVPSNR, (Double)uibits);
     
    23952179    m_gcAnalyzeB.addResult (dYPSNR, dUPSNR, dVPSNR, (Double)uibits);
    23962180#endif
     2181
    23972182  }
    23982183
     
    24012186
    24022187#if ADAPTIVE_QP_SELECTION
     2188
    24032189#if H_MV
    24042190  printf("Layer %3d   POC %4d TId: %1d ( %c-SLICE, nQP %d QP %d ) %10d bits",
     
    24192205         uibits );
    24202206#endif
     2207
    24212208#else
     2209
    24222210#if H_MV
    24232211  printf("Layer %3d   POC %4d TId: %1d ( %c-SLICE, QP %d ) %10d bits",
     
    24362224         uibits );
    24372225#endif
     2226
    24382227#endif
    24392228
     
    24682257 * This function checks the configuration and returns the appropriate nal_unit_type for the picture.
    24692258 */
    2470 NalUnitType TEncGOP::getNalUnitType(Int pocCurr, Int lastIDR)
     2259NalUnitType TEncGOP::getNalUnitType(Int pocCurr)
    24712260{
    24722261  if (pocCurr == 0)
    24732262  {
    2474     return NAL_UNIT_CODED_SLICE_IDR_W_RADL;
     2263    return NAL_UNIT_CODED_SLICE_IDR;
    24752264  }
    24762265  if (pocCurr % m_pcCfg->getIntraPeriod() == 0)
     
    24822271    else if (m_pcCfg->getDecodingRefreshType() == 2)
    24832272    {
    2484       return NAL_UNIT_CODED_SLICE_IDR_W_RADL;
     2273      return NAL_UNIT_CODED_SLICE_IDR;
    24852274    }
    24862275  }
     
    24942283      // controlling the reference pictures used for encoding that leading picture. Such a leading
    24952284      // picture need not be marked as a TFD picture.
    2496       return NAL_UNIT_CODED_SLICE_RASL_R;
    2497     }
    2498   }
    2499   if (lastIDR>0)
    2500   {
    2501     if (pocCurr < lastIDR)
    2502     {
    2503       return NAL_UNIT_CODED_SLICE_RADL_R;
     2285      return NAL_UNIT_CODED_SLICE_TFD;
    25042286    }
    25052287  }
     
    25522334}
    25532335
    2554 /** Attaches the input bitstream to the stream in the output NAL unit
    2555     Updates rNalu to contain concatenated bitstream. rpcBitstreamRedirect is cleared at the end of this function call.
    2556  *  \param codedSliceData contains the coded slice data (bitstream) to be concatenated to rNalu
    2557  *  \param rNalu          target NAL unit
     2336/** Determine the difference between consecutive tile sizes (in bytes) and writes it to  bistream rNalu [slice header]
     2337 * \param rpcBitstreamRedirect contains the bitstream to be concatenated to rNalu. rpcBitstreamRedirect contains slice payload. rpcSlice contains tile location information.
     2338 * \returns Updates rNalu to contain concatenated bitstream. rpcBitstreamRedirect is cleared at the end of this function call.
    25582339 */
    2559 Void TEncGOP::xAttachSliceDataToNalUnit (OutputNALUnit& rNalu, TComOutputBitstream*& codedSliceData)
     2340Void TEncGOP::xWriteTileLocationToSliceHeader (OutputNALUnit& rNalu, TComOutputBitstream*& rpcBitstreamRedirect, TComSlice*& rpcSlice)
    25602341{
    25612342  // Byte-align
     
    25632344
    25642345  // Perform bitstream concatenation
    2565   if (codedSliceData->getNumberOfWrittenBits() > 0)
    2566     {
    2567     rNalu.m_Bitstream.addSubstream(codedSliceData);
     2346  if (rpcBitstreamRedirect->getNumberOfWrittenBits() > 0)
     2347  {
     2348    UInt uiBitCount  = rpcBitstreamRedirect->getNumberOfWrittenBits();
     2349    if (rpcBitstreamRedirect->getByteStreamLength()>0)
     2350    {
     2351      UChar *pucStart  =  reinterpret_cast<UChar*>(rpcBitstreamRedirect->getByteStream());
     2352      UInt uiWriteByteCount = 0;
     2353      while (uiWriteByteCount < (uiBitCount >> 3) )
     2354      {
     2355        UInt uiBits = (*pucStart);
     2356        rNalu.m_Bitstream.write(uiBits, 8);
     2357        pucStart++;
     2358        uiWriteByteCount++;
     2359      }
     2360    }
     2361    UInt uiBitsHeld = (uiBitCount & 0x07);
     2362    for (UInt uiIdx=0; uiIdx < uiBitsHeld; uiIdx++)
     2363    {
     2364      rNalu.m_Bitstream.write((rpcBitstreamRedirect->getHeldBits() & (1 << (7-uiIdx))) >> (7-uiIdx), 1);
     2365    }         
    25682366  }
    25692367
    25702368  m_pcEntropyCoder->setBitstream(&rNalu.m_Bitstream);
    25712369
    2572   codedSliceData->clear();
     2370  delete rpcBitstreamRedirect;
     2371  rpcBitstreamRedirect = new TComOutputBitstream;
    25732372}
    25742373
     
    26952494     }               
    26962495  }
    2697 //  assert(it != accessUnit.end());  // Triggers with some legit configurations
     2496  assert(it != accessUnit.end());
    26982497  return seiStartPos;
    26992498}
    27002499#endif
    27012500
    2702 #if L0386_DB_METRIC
    2703 Void TEncGOP::dblMetric( TComPic* pcPic, UInt uiNumSlices )
    2704 {
    2705   TComPicYuv* pcPicYuvRec = pcPic->getPicYuvRec();
    2706   Pel* Rec    = pcPicYuvRec->getLumaAddr( 0 );
    2707   Pel* tempRec = Rec;
    2708   Int  stride = pcPicYuvRec->getStride();
    2709   UInt log2maxTB = pcPic->getSlice(0)->getSPS()->getQuadtreeTULog2MaxSize();
    2710   UInt maxTBsize = (1<<log2maxTB);
    2711   const UInt minBlockArtSize = 8;
    2712   const UInt picWidth = pcPicYuvRec->getWidth();
    2713   const UInt picHeight = pcPicYuvRec->getHeight();
    2714   const UInt noCol = (picWidth>>log2maxTB);
    2715   const UInt noRows = (picHeight>>log2maxTB);
    2716   UInt64 *colSAD = (UInt64*)malloc(noCol*sizeof(UInt64));
    2717   UInt64 *rowSAD = (UInt64*)malloc(noRows*sizeof(UInt64));
    2718   UInt colIdx = 0;
    2719   UInt rowIdx = 0;
    2720   Pel p0, p1, p2, q0, q1, q2;
    2721  
    2722   Int qp = pcPic->getSlice(0)->getSliceQp();
    2723   Int bitdepthScale = 1 << (g_bitDepthY-8);
    2724   Int beta = TComLoopFilter::getBeta( qp ) * bitdepthScale;
    2725   const Int thr2 = (beta>>2);
    2726   const Int thr1 = 2*bitdepthScale;
    2727   UInt a = 0;
    2728  
    2729   memset(colSAD, 0, noCol*sizeof(UInt64));
    2730   memset(rowSAD, 0, noRows*sizeof(UInt64));
    2731  
    2732   if (maxTBsize > minBlockArtSize)
    2733   {
    2734     // Analyze vertical artifact edges
    2735     for(Int c = maxTBsize; c < picWidth; c += maxTBsize)
    2736     {
    2737       for(Int r = 0; r < picHeight; r++)
    2738       {
    2739         p2 = Rec[c-3];
    2740         p1 = Rec[c-2];
    2741         p0 = Rec[c-1];
    2742         q0 = Rec[c];
    2743         q1 = Rec[c+1];
    2744         q2 = Rec[c+2];
    2745         a = ((abs(p2-(p1<<1)+p0)+abs(q0-(q1<<1)+q2))<<1);
    2746         if ( thr1 < a && a < thr2)
    2747         {
    2748           colSAD[colIdx] += abs(p0 - q0);
    2749         }
    2750         Rec += stride;
    2751       }
    2752       colIdx++;
    2753       Rec = tempRec;
    2754     }
    2755    
    2756     // Analyze horizontal artifact edges
    2757     for(Int r = maxTBsize; r < picHeight; r += maxTBsize)
    2758     {
    2759       for(Int c = 0; c < picWidth; c++)
    2760       {
    2761         p2 = Rec[c + (r-3)*stride];
    2762         p1 = Rec[c + (r-2)*stride];
    2763         p0 = Rec[c + (r-1)*stride];
    2764         q0 = Rec[c + r*stride];
    2765         q1 = Rec[c + (r+1)*stride];
    2766         q2 = Rec[c + (r+2)*stride];
    2767         a = ((abs(p2-(p1<<1)+p0)+abs(q0-(q1<<1)+q2))<<1);
    2768         if (thr1 < a && a < thr2)
    2769         {
    2770           rowSAD[rowIdx] += abs(p0 - q0);
    2771         }
    2772       }
    2773       rowIdx++;
    2774     }
    2775   }
    2776  
    2777   UInt64 colSADsum = 0;
    2778   UInt64 rowSADsum = 0;
    2779   for(Int c = 0; c < noCol-1; c++)
    2780   {
    2781     colSADsum += colSAD[c];
    2782   }
    2783   for(Int r = 0; r < noRows-1; r++)
    2784   {
    2785     rowSADsum += rowSAD[r];
    2786   }
    2787  
    2788   colSADsum <<= 10;
    2789   rowSADsum <<= 10;
    2790   colSADsum /= (noCol-1);
    2791   colSADsum /= picHeight;
    2792   rowSADsum /= (noRows-1);
    2793   rowSADsum /= picWidth;
    2794  
    2795   UInt64 avgSAD = ((colSADsum + rowSADsum)>>1);
    2796   avgSAD >>= (g_bitDepthY-8);
    2797  
    2798   if ( avgSAD > 2048 )
    2799   {
    2800     avgSAD >>= 9;
    2801     Int offset = Clip3(2,6,(Int)avgSAD);
    2802     for (Int i=0; i<uiNumSlices; i++)
    2803     {
    2804       pcPic->getSlice(i)->setDeblockingFilterOverrideFlag(true);
    2805       pcPic->getSlice(i)->setDeblockingFilterDisable(false);
    2806       pcPic->getSlice(i)->setDeblockingFilterBetaOffsetDiv2( offset );
    2807       pcPic->getSlice(i)->setDeblockingFilterTcOffsetDiv2( offset );
    2808     }
    2809   }
    2810   else
    2811   {
    2812     for (Int i=0; i<uiNumSlices; i++)
    2813     {
    2814       pcPic->getSlice(i)->setDeblockingFilterOverrideFlag(false);
    2815       pcPic->getSlice(i)->setDeblockingFilterDisable(        pcPic->getSlice(i)->getPPS()->getPicDisableDeblockingFilterFlag() );
    2816       pcPic->getSlice(i)->setDeblockingFilterBetaOffsetDiv2( pcPic->getSlice(i)->getPPS()->getDeblockingFilterBetaOffsetDiv2() );
    2817       pcPic->getSlice(i)->setDeblockingFilterTcOffsetDiv2(   pcPic->getSlice(i)->getPPS()->getDeblockingFilterTcOffsetDiv2()   );
    2818     }
    2819   }
    2820  
    2821   free(colSAD);
    2822   free(rowSAD);
    2823 }
    2824 #endif
    28252501#if H_MV
    28262502Void TEncGOP::xSetRefPicListModificationsMvc( TComSlice* pcSlice, UInt uiPOCCurr, UInt iGOPid )
     
    28462522  {
    28472523    Int numModifications = 0;
    2848 
     2524   
    28492525    for( Int k = 0; k < ge.m_numInterViewRefPics; k++ )
    28502526    {
     
    28532529
    28542530    // set inter-view modifications
    2855     Bool isModified = false;
    2856     Int tempList[16];
    2857     for( Int k = 0; k < 16; k++ ) { tempList[k] = -1; }
    2858 
    28592531    if( (maxRefListSize > 1) && (numModifications > 0) )
    28602532    {
     2533      refPicListModification->setRefPicListModificationFlagL( li, true );
     2534      Int tempList[16];
     2535      for( Int k = 0; k < 16; k++ ) { tempList[k] = -1; }
     2536
     2537      Bool isModified = false;
    28612538      for( Int k = 0; k < ge.m_numInterViewRefPics; k++ )
    28622539      {
     
    28772554        }
    28782555      }
    2879     }
    2880 
    2881     refPicListModification->setRefPicListModificationFlagL( li, isModified ); 
    2882 
    2883     if( isModified )
    2884     {
    2885       Int temporalRefIdx = 0;
    2886       for( Int i = 0; i < pcSlice->getNumRefIdx( ( li == 0 ) ? REF_PIC_LIST_0 : REF_PIC_LIST_1 ); i++ )
    2887       {
    2888         if( tempList[i] >= 0 )
    2889         {
    2890           refPicListModification->setRefPicSetIdxL( li, i, tempList[i] );
    2891         }
    2892         else
    2893         {
    2894           refPicListModification->setRefPicSetIdxL( li, i, temporalRefIdx );
    2895           temporalRefIdx++;
    2896         }
    2897       }
    2898     }   
     2556      if( isModified )
     2557      {
     2558        Int temporalRefIdx = 0;
     2559        for( Int i = 0; i < pcSlice->getNumRefIdx( ( li == 0 ) ? REF_PIC_LIST_0 : REF_PIC_LIST_1 ); i++ )
     2560        {
     2561          if( tempList[i] >= 0 )
     2562          {
     2563            refPicListModification->setRefPicSetIdxL( li, i, tempList[i] );
     2564          }
     2565          else
     2566          {
     2567            refPicListModification->setRefPicSetIdxL( li, i, temporalRefIdx );
     2568            temporalRefIdx++;
     2569          }
     2570        }
     2571      }
     2572      else
     2573      {
     2574        refPicListModification->setRefPicListModificationFlagL( li, false );
     2575      }
     2576    }
    28992577  }
    29002578}
    29012579#endif
     2580
    29022581//! \}
  • branches/HTM-DEV-0.2-dev/source/Lib/TLibEncoder/TEncGOP.h

    r368 r438  
    108108#endif
    109109#endif
     110
    110111  //--Adaptive Loop filter
    111112  TEncSampleAdaptiveOffset*  m_pcSAO;
     
    131132  Bool                    m_bufferingPeriodSEIPresentInAU;
    132133  Bool                    m_pictureTimingSEIPresentInAU;
    133 #if K0180_SCALABLE_NESTING_SEI
    134   Bool                    m_nestedBufferingPeriodSEIPresentInAU;
    135   Bool                    m_nestedPictureTimingSEIPresentInAU;
    136 #endif
    137134#endif
    138135public:
     
    144141 
    145142  Void  init        ( TEncTop* pcTEncTop );
     143
    146144#if H_MV
    147145  Void  initGOP     ( Int iPOCLast, Int iNumPicRcvd, TComList<TComPic*>& rcListPic, TComList<TComPicYuv*>& rcListPicYuvRecOut, std::list<AccessUnit>& accessUnitsInGOP);
     
    150148  Void  compressGOP( Int iPOCLast, Int iNumPicRcvd, TComList<TComPic*>& rcListPic, TComList<TComPicYuv*>& rcListPicYuvRec, std::list<AccessUnit>& accessUnitsInGOP );
    151149#endif
    152   Void  xAttachSliceDataToNalUnit (OutputNALUnit& rNalu, TComOutputBitstream*& rpcBitstreamRedirect);
     150
     151  Void xWriteTileLocationToSliceHeader (OutputNALUnit& rNalu, TComOutputBitstream*& rpcBitstreamRedirect, TComSlice*& rpcSlice);
    153152
    154153#if H_MV
     
    168167  Void  printOutSummary      ( UInt uiNumAllPicCoded );
    169168#endif
     169
    170170  Void  preLoopFilterPicAll  ( TComPic* pcPic, UInt64& ruiDist, UInt64& ruiBits );
    171171 
    172172  TEncSlice*  getSliceEncoder()   { return m_pcSliceEncoder; }
    173   NalUnitType getNalUnitType( Int pocCurr, Int lastIdr );
     173  NalUnitType getNalUnitType( Int pocCurr );
    174174  Void arrangeLongtermPicturesInRPS(TComSlice *, TComList<TComPic*>& );
    175175protected:
     
    189189  SEIFramePacking*        xCreateSEIFramePacking();
    190190  SEIDisplayOrientation*  xCreateSEIDisplayOrientation();
    191 
    192 #if J0149_TONE_MAPPING_SEI
    193   SEIToneMappingInfo*     xCreateSEIToneMappingInfo();
    194 #endif
    195191
    196192  Void xCreateLeadingSEIMessages (/*SEIMessages seiMessages,*/ AccessUnit &accessUnit, TComSPS *sps);
     
    203199    m_pictureTimingSEIPresentInAU      = false;
    204200  }
    205 #if K0180_SCALABLE_NESTING_SEI
    206   Void xResetNestedSEIPresentFlags()
    207   {
    208     m_nestedBufferingPeriodSEIPresentInAU    = false;
    209     m_nestedPictureTimingSEIPresentInAU      = false;
    210   }
    211 #endif
    212 #endif
     201#endif
     202
    213203#if H_MV
    214204   Void  xSetRefPicListModificationsMvc( TComSlice* pcSlice, UInt uiPOCCurr, UInt iGOPid );
    215205#endif
    216 #if L0386_DB_METRIC
    217   Void dblMetric( TComPic* pcPic, UInt uiNumSlices );
    218 #endif
     206
    219207};// END CLASS DEFINITION TEncGOP
    220208
  • branches/HTM-DEV-0.2-dev/source/Lib/TLibEncoder/TEncSampleAdaptiveOffset.cpp

    r362 r438  
    16771677#endif
    16781678{
     1679#if SAO_CHROMA_LAMBDA
     1680  m_dLambdaLuma    = dLambdaLuma;
     1681  m_dLambdaChroma  = dLambdaChroma;
     1682#else
     1683  m_dLambdaLuma    = dLambda;
     1684  m_dLambdaChroma  = dLambda;
     1685#endif
     1686
    16791687  if(m_bUseNIF)
    16801688  {
  • branches/HTM-DEV-0.2-dev/source/Lib/TLibEncoder/TEncSampleAdaptiveOffset.h

    r362 r438  
    5757{
    5858private:
     59  Double            m_dLambdaLuma;
     60  Double            m_dLambdaChroma;
     61
    5962  TEncEntropy*      m_pcEntropyCoder;
    6063  TEncSbac***       m_pppcRDSbacCoder;              ///< for CABAC
  • branches/HTM-DEV-0.2-dev/source/Lib/TLibEncoder/TEncSbac.h

    r362 r438  
    109109  Void  xWriteEpExGolomb     ( UInt uiSymbol, UInt uiCount );
    110110  Void  xWriteCoefRemainExGolomb ( UInt symbol, UInt &rParam );
     111  Void  xWriteTerminatingBit ( UInt uiBit );
    111112 
    112113  Void  xCopyFrom            ( TEncSbac* pSrc );
  • branches/HTM-DEV-0.2-dev/source/Lib/TLibEncoder/TEncSearch.cpp

    r362 r438  
    32093209    UInt          uiBitsTempL0[MAX_NUM_REF];
    32103210
    3211 #if L0034_COMBINED_LIST_CLEANUP
    3212     TComMv        mvValidList1;
    3213     Int           refIdxValidList1 = 0;
    3214     UInt          bitsValidList1 = MAX_UINT;
    3215     UInt          costValidList1 = MAX_UINT;
    3216 #endif
    3217 
    32183211    xGetBlkBits( ePartSize, pcCU->getSlice()->isInterP(), iPartIdx, uiLastMode, uiMbBits);
    32193212   
     
    32623255        uiBitsTemp += m_auiMVPIdxCost[aaiMvpIdx[iRefList][iRefIdxTemp]][AMVP_MAX_NUM_CANDS];
    32633256#if ZERO_MVD_EST
    3264 #if L0034_COMBINED_LIST_CLEANUP
    3265         if ( iRefList == 0 || pcCU->getSlice()->getList1IdxToList0Idx( iRefIdxTemp ) < 0 )
    3266 #else
    32673257        if ((iRefList != 1 || !pcCU->getSlice()->getNoBackPredFlag()) &&
    32683258            (pcCU->getSlice()->getNumRefIdx(REF_PIC_LIST_C) <= 0 || pcCU->getSlice()->getRefIdxOfLC(eRefPicList, iRefIdxTemp)>=0))
    3269 #endif
    32703259        {
    32713260          uiZeroMvdBitsTemp = uiBitsTemp;
     
    32873276       
    32883277#if GPB_SIMPLE_UNI
    3289 #if L0034_COMBINED_LIST_CLEANUP
    3290         if ( iRefList == 1 )    // list 1
    3291         {
    3292           if ( pcCU->getSlice()->getList1IdxToList0Idx( iRefIdxTemp ) >= 0 )
    3293           {
    3294             cMvTemp[1][iRefIdxTemp] = cMvTemp[0][pcCU->getSlice()->getList1IdxToList0Idx( iRefIdxTemp )];
    3295             uiCostTemp = uiCostTempL0[pcCU->getSlice()->getList1IdxToList0Idx( iRefIdxTemp )];
    3296             /*first subtract the bit-rate part of the cost of the other list*/
    3297             uiCostTemp -= m_pcRdCost->getCost( uiBitsTempL0[pcCU->getSlice()->getList1IdxToList0Idx( iRefIdxTemp )] );
    3298             /*correct the bit-rate part of the current ref*/
    3299             m_pcRdCost->setPredictor  ( cMvPred[iRefList][iRefIdxTemp] );
    3300             uiBitsTemp += m_pcRdCost->getBits( cMvTemp[1][iRefIdxTemp].getHor(), cMvTemp[1][iRefIdxTemp].getVer() );
    3301             /*calculate the correct cost*/
    3302             uiCostTemp += m_pcRdCost->getCost( uiBitsTemp );
    3303           }
    3304           else
    3305           {
    3306             xMotionEstimation ( pcCU, pcOrgYuv, iPartIdx, eRefPicList, &cMvPred[iRefList][iRefIdxTemp], iRefIdxTemp, cMvTemp[iRefList][iRefIdxTemp], uiBitsTemp, uiCostTemp );
    3307           }
    3308         }
    3309         else
    3310         {
    3311           xMotionEstimation ( pcCU, pcOrgYuv, iPartIdx, eRefPicList, &cMvPred[iRefList][iRefIdxTemp], iRefIdxTemp, cMvTemp[iRefList][iRefIdxTemp], uiBitsTemp, uiCostTemp );
    3312         }
    3313 #else
    33143278        if ( pcCU->getSlice()->getNumRefIdx(REF_PIC_LIST_C) > 0)
    33153279        {
     
    33533317          }       
    33543318        }
    3355 #endif
    33563319#else
    33573320        xMotionEstimation ( pcCU, pcOrgYuv, iPartIdx, eRefPicList, &cMvPred[iRefList][iRefIdxTemp], iRefIdxTemp, cMvTemp[iRefList][iRefIdxTemp], uiBitsTemp, uiCostTemp );
     
    33603323        xCheckBestMVP(pcCU, eRefPicList, cMvTemp[iRefList][iRefIdxTemp], cMvPred[iRefList][iRefIdxTemp], aaiMvpIdx[iRefList][iRefIdxTemp], uiBitsTemp, uiCostTemp);
    33613324
    3362 #if L0034_COMBINED_LIST_CLEANUP
    3363         if ( iRefList == 0 )
    3364         {
    3365           uiCostTempL0[iRefIdxTemp] = uiCostTemp;
    3366           uiBitsTempL0[iRefIdxTemp] = uiBitsTemp;
    3367         }
    3368         if ( uiCostTemp < uiCost[iRefList] )
    3369         {
    3370           uiCost[iRefList] = uiCostTemp;
    3371           uiBits[iRefList] = uiBitsTemp; // storing for bi-prediction
    3372 
    3373           // set motion
    3374           cMv[iRefList]     = cMvTemp[iRefList][iRefIdxTemp];
    3375           iRefIdx[iRefList] = iRefIdxTemp;
    3376         }
    3377 
    3378         if ( iRefList == 1 && uiCostTemp < costValidList1 && pcCU->getSlice()->getList1IdxToList0Idx( iRefIdxTemp ) < 0 )
    3379         {
    3380           costValidList1 = uiCostTemp;
    3381           bitsValidList1 = uiBitsTemp;
    3382 
    3383           // set motion
    3384           mvValidList1     = cMvTemp[iRefList][iRefIdxTemp];
    3385           refIdxValidList1 = iRefIdxTemp;
    3386         }
    3387 #else
    33883325        if(pcCU->getSlice()->getNumRefIdx(REF_PIC_LIST_C) > 0 && !pcCU->getSlice()->getNoBackPredFlag())
    33893326        {
     
    34353372            }
    34363373          }
    3437 #endif
    34383374      }
    34393375    }
     
    34993435       
    35003436        Int         iRefList    = iIter % 2;
    3501 #if L0034_COMBINED_LIST_CLEANUP
    3502         if ( m_pcEncCfg->getUseFastEnc() )
    3503         {
    3504           if( uiCost[0] <= uiCost[1] )
    3505           {
    3506             iRefList = 1;
    3507           }
    3508           else
    3509           {
    3510             iRefList = 0;
    3511           }
    3512         }
    3513         else if ( iIter == 0 )
    3514         {
    3515           iRefList = 0;
    3516         }
    3517         if ( iIter == 0 && !pcCU->getSlice()->getMvdL1ZeroFlag())
    3518         {
    3519           pcCU->getCUMvField(RefPicList(1-iRefList))->setAllMv( cMv[1-iRefList], ePartSize, uiPartAddr, 0, iPartIdx );
    3520           pcCU->getCUMvField(RefPicList(1-iRefList))->setAllRefIdx( iRefIdx[1-iRefList], ePartSize, uiPartAddr, 0, iPartIdx );
    3521           TComYuv*  pcYuvPred = &m_acYuvPred[1-iRefList];
    3522           motionCompensation ( pcCU, pcYuvPred, RefPicList(1-iRefList), iPartIdx );
    3523         }
    3524 #else
    35253437        if ( m_pcEncCfg->getUseFastEnc() && (pcCU->getSlice()->getNoBackPredFlag() || (pcCU->getSlice()->getNumRefIdx(REF_PIC_LIST_C) > 0 && pcCU->getSlice()->getRefIdxOfL0FromRefIdxOfL1(0)==0 )) )
    35263438        {
    35273439          iRefList = 1;
    35283440        }
    3529 #endif
    35303441        RefPicList  eRefPicList = ( iRefList ? REF_PIC_LIST_1 : REF_PIC_LIST_0 );
    35313442
     
    36623573    UInt uiMEBits = 0;
    36633574    // Set Motion Field_
    3664 #if L0034_COMBINED_LIST_CLEANUP
    3665     cMv[1] = mvValidList1;
    3666     iRefIdx[1] = refIdxValidList1;
    3667     uiBits[1] = bitsValidList1;
    3668     uiCost[1] = costValidList1;
    3669 #else
    36703575    if ( pcCU->getSlice()->getNoBackPredFlag() || (pcCU->getSlice()->getNumRefIdx(REF_PIC_LIST_C) > 0 && pcCU->getSlice()->getRefIdxOfL0FromRefIdxOfL1(0)==0 ) )
    36713576    {
    36723577      uiCost[1] = MAX_UINT;
    36733578    }
    3674 #endif
    36753579#if AMP_MRG
    36763580    if (bTestNormalMC)
     
    46184522    while( pcCU->getWidth(0) > (pcCU->getSlice()->getSPS()->getMaxTrSize()<<uiTrLevel) ) uiTrLevel++;
    46194523  }
    4620   UInt uiMaxTrMode = 1 + uiTrLevel;
     4524  UInt uiMaxTrMode = pcCU->getSlice()->getSPS()->getMaxTrDepth() + uiTrLevel;
    46214525 
    46224526  while((uiWidth>>uiMaxTrMode) < (g_uiMaxCUWidth>>g_uiMaxCUDepth)) uiMaxTrMode--;
  • branches/HTM-DEV-0.2-dev/source/Lib/TLibEncoder/TEncSlice.cpp

    r368 r438  
    414414  eSliceType = (pocLast == 0 || pocCurr % m_pcCfg->getIntraPeriod() == 0 || m_pcGOPEncoder->getGOPSize() == 0) ? I_SLICE : eSliceType;
    415415#endif
    416 
    417416  rpcSlice->setSliceType        ( eSliceType );
    418417#endif
     
    439438#endif
    440439
    441 #if L0386_DB_METRIC
    442   if ( m_pcCfg->getDeblockingFilterMetric() )
    443   {
    444     rpcSlice->setDeblockingFilterOverrideFlag(true);
    445     rpcSlice->setDeblockingFilterDisable(false);
    446     rpcSlice->setDeblockingFilterBetaOffsetDiv2( 0 );
    447     rpcSlice->setDeblockingFilterTcOffsetDiv2( 0 );
    448   } else
    449 #endif
    450440  if (rpcSlice->getPPS()->getDeblockingFilterControlPresentFlag())
    451441  {
     
    12331223 \retval rpcBitstream  bitstream class
    12341224 */
    1235 Void TEncSlice::encodeSlice   ( TComPic*& rpcPic, TComOutputBitstream* pcSubstreams )
     1225Void TEncSlice::encodeSlice   ( TComPic*& rpcPic, TComOutputBitstream* pcBitstream, TComOutputBitstream* pcSubstreams )
    12361226{
    12371227  UInt       uiCUAddr;
     
    14131403      }
    14141404      {
    1415         UInt numStartCodeEmulations = pcSubstreams[uiSubStrm].countStartCodeEmulations();
     1405          UInt uiCounter = 0;
     1406          vector<uint8_t>& rbsp   = pcSubstreams[uiSubStrm].getFIFO();
     1407          for (vector<uint8_t>::iterator it = rbsp.begin(); it != rbsp.end();)
     1408          {
     1409            /* 1) find the next emulated 00 00 {00,01,02,03}
     1410             * 2a) if not found, write all remaining bytes out, stop.
     1411             * 2b) otherwise, write all non-emulated bytes out
     1412             * 3) insert emulation_prevention_three_byte
     1413             */
     1414            vector<uint8_t>::iterator found = it;
     1415            do
     1416            {
     1417              /* NB, end()-1, prevents finding a trailing two byte sequence */
     1418              found = search_n(found, rbsp.end()-1, 2, 0);
     1419              found++;
     1420              /* if not found, found == end, otherwise found = second zero byte */
     1421              if (found == rbsp.end())
     1422              {
     1423                break;
     1424              }
     1425              if (*(++found) <= 3)
     1426              {
     1427                break;
     1428              }
     1429            } while (true);
     1430            it = found;
     1431            if (found != rbsp.end())
     1432            {
     1433              it++;
     1434              uiCounter++;
     1435            }
     1436          }
     1437       
    14161438        UInt uiAccumulatedSubstreamLength = 0;
    14171439        for (Int iSubstrmIdx=0; iSubstrmIdx < iNumSubstreams; iSubstrmIdx++)
     
    14211443        // add bits coded in previous dependent slices + bits coded so far
    14221444        // add number of emulation prevention byte count in the tile
    1423         pcSlice->addTileLocation( ((pcSlice->getTileOffstForMultES() + uiAccumulatedSubstreamLength - uiBitsOriginallyInSubstreams) >> 3) + numStartCodeEmulations );
     1445        pcSlice->addTileLocation( ((pcSlice->getTileOffstForMultES() + uiAccumulatedSubstreamLength - uiBitsOriginallyInSubstreams) >> 3) + uiCounter );
    14241446      }
    14251447    }
  • branches/HTM-DEV-0.2-dev/source/Lib/TLibEncoder/TEncSlice.h

    r362 r438  
    122122  Void    precompressSlice    ( TComPic*& rpcPic                                );      ///< precompress slice for multi-loop opt.
    123123  Void    compressSlice       ( TComPic*& rpcPic                                );      ///< analysis stage of slice
    124   Void    encodeSlice         ( TComPic*& rpcPic, TComOutputBitstream* pcSubstreams  );
     124  Void    encodeSlice         ( TComPic*& rpcPic, TComOutputBitstream* rpcBitstream, TComOutputBitstream* pcSubstreams  );
    125125 
    126126  // misc. functions
  • branches/HTM-DEV-0.2-dev/source/Lib/TLibEncoder/TEncTop.cpp

    r368 r438  
    8181  m_pcBitCounters          = NULL;
    8282  m_pcRdCosts              = NULL;
     83
    8384#if H_MV
    8485  m_ivPicLists = NULL;
     
    9596Void TEncTop::create ()
    9697{
     98
    9799#if !H_MV
    98100  // initialize global variables
     
    286288Void TEncTop::init()
    287289{
     290
    288291  // initialize SPS
    289292  xInitSPS();
     
    345348}
    346349#endif
     350
    347351Void TEncTop::deletePicBuffer()
    348352{
     
    371375 \retval  iNumEncoded         number of encoded pictures
    372376 */
     377Void TEncTop::encode(Bool flush, TComPicYuv* pcPicYuvOrg, TComList<TComPicYuv*>& rcListPicYuvRecOut, std::list<AccessUnit>& accessUnitsOut, Int& iNumEncoded
    373378#if H_MV
    374 Void TEncTop::encode(Bool flush, TComPicYuv* pcPicYuvOrg, TComList<TComPicYuv*>& rcListPicYuvRecOut, std::list<AccessUnit>& accessUnitsOut, Int& iNumEncoded , Int gopId )
    375 {
    376 #else
    377 Void TEncTop::encode(Bool flush, TComPicYuv* pcPicYuvOrg, TComList<TComPicYuv*>& rcListPicYuvRecOut, std::list<AccessUnit>& accessUnitsOut, Int& iNumEncoded )
    378 {
    379 #endif
     379                     , Int gopId
     380#endif               
     381                     )
     382{
     383
    380384#if H_3D
    381385  TComPic* picLastCoded = getPic( getGOPEncoder()->getPocLastCoded() );
     
    385389  }
    386390#endif
     391
    387392#if H_MV
    388393  if( gopId == 0)
     
    438443  m_iNumPicRcvd       = 0;
    439444  m_uiNumAllPicCoded += iNumEncoded;
     445
    440446#if H_MV
    441447}
    442448#endif
     449
    443450}
    444451
     
    540547  m_cSPS.setMaxCUHeight   ( g_uiMaxCUHeight     );
    541548  m_cSPS.setMaxCUDepth    ( g_uiMaxCUDepth      );
    542 
    543   Int minCUSize = m_cSPS.getMaxCUWidth() >> ( m_cSPS.getMaxCUDepth()-g_uiAddCUDepth );
    544   Int log2MinCUSize = 0;
    545   while(minCUSize > 1)
    546   {
    547     minCUSize >>= 1;
    548     log2MinCUSize++;
    549   }
    550 
    551   m_cSPS.setLog2MinCodingBlockSize(log2MinCUSize);
    552   m_cSPS.setLog2DiffMaxMinCodingBlockSize(m_cSPS.getMaxCUDepth()-g_uiAddCUDepth);
     549  m_cSPS.setMinTrDepth    ( 0                   );
     550  m_cSPS.setMaxTrDepth    ( 1                   );
    553551 
    554552  m_cSPS.setPCMLog2MinSize (m_uiPCMLog2MinSize);
     
    565563
    566564  m_cSPS.setMaxTrSize   ( 1 << m_uiQuadtreeTULog2MaxSize );
    567 #if !L0034_COMBINED_LIST_CLEANUP
     565 
    568566  m_cSPS.setUseLComb    ( m_bUseLComb           );
    569 #endif
    570567 
    571568  Int i;
     
    719716  m_cPPS.setOutputFlagPresentFlag( false );
    720717  m_cPPS.setSignHideFlag(getSignHideFlag());
    721 #if L0386_DB_METRIC
    722   if ( getDeblockingFilterMetric() )
    723   {
    724     m_cPPS.setDeblockingFilterControlPresentFlag (true);
    725     m_cPPS.setDeblockingFilterOverrideEnabledFlag(true);
    726     m_cPPS.setPicDisableDeblockingFilterFlag(false);
    727     m_cPPS.setDeblockingFilterBetaOffsetDiv2(0);
    728     m_cPPS.setDeblockingFilterTcOffsetDiv2(0);
    729   }
    730   else
    731   {
    732718  m_cPPS.setDeblockingFilterControlPresentFlag (m_DeblockingFilterControlPresent );
    733   }
    734 #else
    735   m_cPPS.setDeblockingFilterControlPresentFlag (m_DeblockingFilterControlPresent );
    736 #endif
    737719  m_cPPS.setLog2ParallelMergeLevelMinus2   (m_log2ParallelMergeLevelMinus2 );
    738720  m_cPPS.setCabacInitPresentFlag(CABAC_INIT_PRESENT_FLAG);
     
    1006988  }
    1007989#endif
    1008 
    1009 }
    1010 
    1011 #if L0208_SOP_DESCRIPTION_SEI
    1012 Int TEncTop::getReferencePictureSetIdxForSOP(TComSlice* slice, Int POCCurr, Int GOPid )
    1013 {
    1014   int rpsIdx = GOPid;
    1015 
    1016   for(Int extraNum=m_iGOPSize; extraNum<m_extraRPSs+m_iGOPSize; extraNum++)
    1017   {   
    1018     if(m_uiIntraPeriod > 0 && getDecodingRefreshType() > 0)
    1019     {
    1020       Int POCIndex = POCCurr%m_uiIntraPeriod;
    1021       if(POCIndex == 0)
    1022       {
    1023         POCIndex = m_uiIntraPeriod;
    1024       }
    1025       if(POCIndex == m_GOPList[extraNum].m_POC)
    1026       {
    1027         rpsIdx = extraNum;
    1028       }
    1029     }
    1030     else
    1031     {
    1032       if(POCCurr==m_GOPList[extraNum].m_POC)
    1033       {
    1034         rpsIdx = extraNum;
    1035       }
    1036     }
    1037   }
    1038 
    1039   return rpsIdx;
    1040 }
    1041 #endif
     990}
    1042991
    1043992Void  TEncTop::xInitPPSforTiles()
     
    11201069  }
    11211070}
     1071
    11221072#if H_MV
    11231073Void TEncTop::printSummary( Int numAllPicCoded )
     
    11821132}
    11831133#endif
     1134
    11841135//! \}
  • branches/HTM-DEV-0.2-dev/source/Lib/TLibEncoder/TEncTop.h

    r368 r438  
    6363// Class definition
    6464// ====================================================================================================================
     65
     66
    6567
    6668/// encoder class
     
    131133  TEncAnalyze             m_cAnalyzeB; 
    132134#endif
     135
    133136protected:
    134137  Void  xGetNewPicBuffer  ( TComPic*& rpcPic );           ///< get picture buffer which will be processed
     
    145148  Void      create          ();
    146149  Void      destroy         ();
     150
    147151  Void      init            ();
     152
    148153#if H_MV 
    149154  TComPicLists* getIvPicLists() { return m_ivPicLists; }
    150155#endif
     156
    151157  Void      deletePicBuffer ();
    152158
     
    156162  Void      initNewPic(TComPicYuv* pcPicYuvOrg);
    157163#endif
     164
    158165  // -------------------------------------------------------------------------------------------------------------------
    159166  // member access functions
     
    188195  TComPPS*                getPPS                () { return  &m_cPPS;                 }
    189196  Void selectReferencePictureSet(TComSlice* slice, Int POCCurr, Int GOPid );
    190 #if L0208_SOP_DESCRIPTION_SEI
    191   Int getReferencePictureSetIdxForSOP(TComSlice* slice, Int POCCurr, Int GOPid );
    192 #endif
    193197  TComScalingList*        getScalingList        () { return  &m_scalingList;         }
     198
    194199#if H_MV
    195200  TEncAnalyze*            getAnalyzeAll         () { return &m_cAnalyzeAll; }
     
    205210  Void                    setIvPicLists         ( TComPicLists* picLists) { m_ivPicLists = picLists; }
    206211#endif
     212
     213
    207214  // -------------------------------------------------------------------------------------------------------------------
    208215  // encoder function
     
    210217
    211218  /// encode several number of pictures until end-of-sequence
    212 #if H_MV
    213   Void encode( Bool bEos, TComPicYuv* pcPicYuvOrg, TComList<TComPicYuv*>& rcListPicYuvRecOut, std::list<AccessUnit>& accessUnitsOut, Int& iNumEncoded  , Int gopId  ); 
    214 #else
    215219  Void encode( Bool bEos, TComPicYuv* pcPicYuvOrg, TComList<TComPicYuv*>& rcListPicYuvRecOut,
    216               std::list<AccessUnit>& accessUnitsOut, Int& iNumEncoded ); 
    217 #endif
    218 
    219 #if H_MV
    220   Void printSummary      ( Int numAllPicCoded );
     220              std::list<AccessUnit>& accessUnitsOut, Int& iNumEncoded
     221#if H_MV
     222              , Int gopId
     223#endif       
     224              ); 
     225
     226#if H_MV
     227  void printSummary      ( Int numAllPicCoded );
    221228#else
    222229  void printSummary() { m_cGOPEncoder.printOutSummary (m_uiNumAllPicCoded); }
    223230#endif
     231
    224232};
    225233
  • branches/HTM-DEV-0.2-dev/source/Lib/TLibEncoder/WeightPredAnalysis.cpp

    r362 r438  
    235235        Int offset = (Int)( ((currDC<<log2Denom) - ((Int64)weight * refDC) + (Int64)realOffset) >> realLog2Denom );
    236236
    237         // Chroma offset range limitation
     237        // Chroma offset range limination
    238238        if(comp)
    239239        {
    240           Int pred = ( 128 - ( ( 128*weight)>>(log2Denom) ) );
     240          Int shift = 1 << (g_bitDepthC - 1);
     241          Int pred = ( shift - ( ( shift*weight)>>(log2Denom) ) );
    241242          Int deltaOffset = Clip3( -512, 511, (offset - pred) );    // signed 10bit
    242243          offset = Clip3( -128, 127, (deltaOffset + pred) );        // signed 8bit
    243         }
    244         // Luma offset range limitation
    245         else
    246         {
    247           offset = Clip3( -128, 127, offset);
    248244        }
    249245
Note: See TracChangeset for help on using the changeset viewer.