Ignore:
Timestamp:
11 Aug 2015, 20:47:57 (9 years ago)
Author:
seregin
Message:

port rev 4588

File:
1 edited

Legend:

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

    r1379 r1434  
    140140#endif
    141141    break;
    142   case SEI::CHROMA_SAMPLING_FILTER_HINT:
    143     xWriteSEIChromaSamplingFilterHint(*static_cast<const SEIChromaSamplingFilterHint*>(&sei)/*, sps*/);
     142  case SEI::CHROMA_RESAMPLING_FILTER_HINT:
     143    xWriteSEIChromaResamplingFilterHint(*static_cast<const SEIChromaResamplingFilterHint*>(&sei));
    144144    break;
    145145  case SEI::TEMP_MOTION_CONSTRAINED_TILE_SETS:
     
    206206#endif //SVC_EXTENSION
    207207  default:
    208     assert(!"Unhandled SEI message");
     208    assert(!"Trying to write unhandled SEI message");
    209209    break;
    210210  }
     
    922922}
    923923
    924 Void SEIWriter::xWriteSEIChromaSamplingFilterHint(const SEIChromaSamplingFilterHint &sei/*, TComSPS* sps*/)
     924Void SEIWriter::xWriteSEIChromaResamplingFilterHint(const SEIChromaResamplingFilterHint &sei)
    925925{
    926926  WRITE_CODE(sei.m_verChromaFilterIdc, 8, "ver_chroma_filter_idc");
    927927  WRITE_CODE(sei.m_horChromaFilterIdc, 8, "hor_chroma_filter_idc");
    928   WRITE_FLAG(sei.m_verFilteringProcessFlag, "ver_filtering_process_flag");
     928  WRITE_FLAG(sei.m_verFilteringFieldProcessingFlag, "ver_filtering_field_processing_flag");
    929929  if(sei.m_verChromaFilterIdc == 1 || sei.m_horChromaFilterIdc == 1)
    930930  {
    931     writeUserDefinedCoefficients(sei);
    932   }
    933 }
    934 
    935 // write hardcoded chroma filter coefficients in the SEI messages
    936 Void SEIWriter::writeUserDefinedCoefficients(const SEIChromaSamplingFilterHint &sei)
    937 {
    938   Int const iNumVerticalFilters = 3;
    939   Int verticalTapLength_minus1[iNumVerticalFilters] = {5,3,3};
    940   Int* userVerticalCoefficients[iNumVerticalFilters];
    941   for(Int i = 0; i < iNumVerticalFilters; i ++)
    942   {
    943     userVerticalCoefficients[i] = (Int*)malloc( (verticalTapLength_minus1[i]+1) * sizeof(Int));
    944   }
    945   userVerticalCoefficients[0][0] = -3;
    946   userVerticalCoefficients[0][1] = 13;
    947   userVerticalCoefficients[0][2] = 31;
    948   userVerticalCoefficients[0][3] = 23;
    949   userVerticalCoefficients[0][4] = 3;
    950   userVerticalCoefficients[0][5] = -3;
    951 
    952   userVerticalCoefficients[1][0] = -1;
    953   userVerticalCoefficients[1][1] = 25;
    954   userVerticalCoefficients[1][2] = 247;
    955   userVerticalCoefficients[1][3] = -15;
    956 
    957   userVerticalCoefficients[2][0] = -20;
    958   userVerticalCoefficients[2][1] = 186;
    959   userVerticalCoefficients[2][2] = 100;
    960   userVerticalCoefficients[2][3] = -10;
    961  
    962   Int const iNumHorizontalFilters = 1;
    963   Int horizontalTapLength_minus1[iNumHorizontalFilters] = {3};
    964   Int* userHorizontalCoefficients[iNumHorizontalFilters];
    965   for(Int i = 0; i < iNumHorizontalFilters; i ++)
    966   {
    967     userHorizontalCoefficients[i] = (Int*)malloc( (horizontalTapLength_minus1[i]+1) * sizeof(Int));
    968   }
    969   userHorizontalCoefficients[0][0] = 1;
    970   userHorizontalCoefficients[0][1] = 6;
    971   userHorizontalCoefficients[0][2] = 1;
    972 
    973   WRITE_UVLC(3, "target_format_idc");
    974   if(sei.m_verChromaFilterIdc == 1)
    975   {
    976     WRITE_UVLC(iNumVerticalFilters, "num_vertical_filters");
    977     if(iNumVerticalFilters > 0)
    978     {
    979       for(Int i = 0; i < iNumVerticalFilters; i ++)
    980       {
    981         WRITE_UVLC(verticalTapLength_minus1[i], "ver_tap_length_minus_1");
    982         for(Int j = 0; j < verticalTapLength_minus1[i]; j ++)
    983         {
    984           WRITE_SVLC(userVerticalCoefficients[i][j], "ver_filter_coeff");
    985         }
    986       }
    987     }
    988   }
    989   if(sei.m_horChromaFilterIdc == 1)
    990   {
    991     WRITE_UVLC(iNumHorizontalFilters, "num_horizontal_filters");
    992     if(iNumHorizontalFilters > 0)
    993     {
    994       for(Int i = 0; i < iNumHorizontalFilters; i ++)
    995       {
    996         WRITE_UVLC(horizontalTapLength_minus1[i], "hor_tap_length_minus_1");
    997         for(Int j = 0; j < horizontalTapLength_minus1[i]; j ++)
    998         {
    999           WRITE_SVLC(userHorizontalCoefficients[i][j], "hor_filter_coeff");
     931    WRITE_UVLC(sei.m_targetFormatIdc, "target_format_idc");
     932    if(sei.m_verChromaFilterIdc == 1)
     933    {
     934      const Int numVerticalFilter = (Int)sei.m_verFilterCoeff.size();
     935      WRITE_UVLC(numVerticalFilter, "num_vertical_filters");
     936      if(numVerticalFilter > 0)
     937      {
     938        for(Int i = 0; i < numVerticalFilter; i ++)
     939        {
     940          const Int verTapLengthMinus1 = (Int) sei.m_verFilterCoeff[i].size() - 1;
     941          WRITE_UVLC(verTapLengthMinus1, "ver_tap_length_minus_1");
     942          for(Int j = 0; j < (verTapLengthMinus1 + 1); j ++)
     943          {
     944            WRITE_SVLC(sei.m_verFilterCoeff[i][j], "ver_filter_coeff");
     945          }
     946        }
     947      }
     948    }
     949    if(sei.m_horChromaFilterIdc == 1)
     950    {
     951      const Int numHorizontalFilter = (Int) sei.m_horFilterCoeff.size();
     952      WRITE_UVLC(numHorizontalFilter, "num_horizontal_filters");
     953      if(numHorizontalFilter > 0)
     954      {
     955        for(Int i = 0; i < numHorizontalFilter; i ++)
     956        {
     957          const Int horTapLengthMinus1 = (Int) sei.m_horFilterCoeff[i].size() - 1;
     958          WRITE_UVLC(horTapLengthMinus1, "hor_tap_length_minus_1");
     959          for(Int j = 0; j < (horTapLengthMinus1 + 1); j ++)
     960          {
     961            WRITE_SVLC(sei.m_horFilterCoeff[i][j], "hor_filter_coeff");
     962          }
    1000963        }
    1001964      }
Note: See TracChangeset for help on using the changeset viewer.