Ignore:
Timestamp:
25 Sep 2015, 06:51:14 (9 years ago)
Author:
chen
Message:

Commit the integration of 3D depth representation information SEI on behalf of Nokia.

by Yi-Wen Chen (yiwen.chen@…)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/HTM-15.1-dev0-Nokia/source/Lib/TLibEncoder/SEIwrite.cpp

    r1337 r1339  
    167167     xWriteSEIThreeDimensionalReferenceDisplaysInfo(*static_cast<const SEIThreeDimensionalReferenceDisplaysInfo*>(&sei));
    168168     break;
    169  #if NH_MV_SEI_TBD
     169#if SEI_DRI_F0169
    170170   case SEI::DEPTH_REPRESENTATION_INFO:
    171      xWriteSEIDepthRepresentationInfo(*static_cast<const SEIDepthRepresentationInfo*>(&sei));
    172      break;
    173 #endif
     171       xWriteSEIDepthRepresentationInfo(*static_cast<const SEIDepthRepresentationInfo*>(&sei));
     172       break;
     173#endif 
    174174   case SEI::MULTIVIEW_SCENE_INFO:
    175175     xWriteSEIMultiviewSceneInfo(*static_cast<const SEIMultiviewSceneInfo*>(&sei));
     
    11021102};
    11031103
    1104 #if NH_MV_SEI_TBD
     1104#if SEI_DRI_F0169
    11051105Void SEIWriter::xWriteSEIDepthRepresentationInfo( const SEIDepthRepresentationInfo& sei)
    11061106{
    1107   WRITE_FLAG( ( sei.m_zNearFlag ? 1 : 0 ), "z_near_flag" );
    1108   WRITE_FLAG( ( sei.m_zFarFlag ? 1 : 0 ), "z_far_flag" );
    1109   WRITE_FLAG( ( sei.m_dMinFlag ? 1 : 0 ), "d_min_flag" );
    1110   WRITE_FLAG( ( sei.m_dMaxFlag ? 1 : 0 ), "d_max_flag" );
    1111   WRITE_UVLC( sei.m_depthRepresentationType, "depth_representation_type" );
    1112   if( sei.m_dMinFlag  | |  sei.m_dMaxFlag )
    1113   {
    1114     WRITE_UVLC( sei.m_disparityRefViewId, "disparity_ref_view_id" );
    1115   }
    1116   if( sei.m_zNearFlag )
    1117   {
    1118     DepthRepInfoElement(() ZNearSign, ZNearExp, ZNearMantissa, ZNearManLen );
    1119   }
    1120   if( sei.m_zFarFlag )
    1121   {
    1122     DepthRepInfoElement(() ZFarSign, ZFarExp, ZFarMantissa, ZFarManLen );
    1123   }
    1124   if( sei.m_dMinFlag )
    1125   {
    1126     DepthRepInfoElement(() DMinSign, DMinExp, DMinMantissa, DMinManLen );
    1127   }
    1128   if( sei.m_dMaxFlag )
    1129   {
    1130     DepthRepInfoElement(() DMaxSign, DMaxExp, DMaxMantissa, DMaxManLen );
    1131   }
    1132   if( sei.m_depthRepresentationType  ==  3 )
    1133   {
    1134     WRITE_UVLC( sei.m_depthNonlinearRepresentationNumMinus1, "depth_nonlinear_representation_num_minus1" );
    1135     for( Int i = 1; i  <=  sei.m_depthNonlinearRepresentationNumMinus1 + 1; i++ )
    1136     {
    1137       DepthNonlinearRepresentationModel( i );
    1138     }
    1139   }
     1107
     1108    assert(sei.m_currLayerID>=0);
     1109
     1110    WRITE_FLAG( ( sei.m_zNearFlag[sei.m_currLayerID] ? 1 : 0 ), "z_near_flag" );
     1111    WRITE_FLAG( ( sei.m_zFarFlag[sei.m_currLayerID] ? 1 : 0 ), "z_far_flag" );
     1112    WRITE_FLAG( ( sei.m_dMinFlag[sei.m_currLayerID] ? 1 : 0 ), "d_min_flag" );
     1113    WRITE_FLAG( ( sei.m_dMaxFlag[sei.m_currLayerID] ? 1 : 0 ), "d_max_flag" );
     1114    WRITE_UVLC( sei.m_depthRepresentationType[sei.m_currLayerID][0], "depth_representation_type" );
     1115    if( sei.m_dMinFlag[sei.m_currLayerID]  ||  sei.m_dMaxFlag[sei.m_currLayerID] )
     1116    {
     1117        WRITE_UVLC( sei.m_disparityRefViewId[sei.m_currLayerID][0], "disparity_ref_view_id" );
     1118    }
     1119    if( sei.m_zNearFlag[sei.m_currLayerID] )
     1120    {
     1121        xWriteSEIDepthRepInfoElement(sei.m_zNear[sei.m_currLayerID][0]);
     1122    }
     1123    if( sei.m_zFarFlag[sei.m_currLayerID] )
     1124    {
     1125        xWriteSEIDepthRepInfoElement(sei.m_zFar[sei.m_currLayerID][0]);
     1126    }
     1127    if( sei.m_dMinFlag[sei.m_currLayerID] )
     1128    {
     1129        xWriteSEIDepthRepInfoElement(sei.m_dMin[sei.m_currLayerID][0]);
     1130    }
     1131    if( sei.m_dMaxFlag[sei.m_currLayerID] )
     1132    {
     1133        xWriteSEIDepthRepInfoElement(sei.m_dMax[sei.m_currLayerID][0]);
     1134    }
     1135
     1136    if (sei.m_depthRepresentationType[sei.m_currLayerID][0] == 3)
     1137    {
     1138        WRITE_UVLC( sei.m_depthNonlinearRepresentationNumMinus1[sei.m_currLayerID][0], "depth_nonlinear_representation_num_minus1" );
     1139        for( Int i = 1; i  <=  sei.m_depthNonlinearRepresentationNumMinus1[sei.m_currLayerID][0] + 1; i++ )
     1140        {
     1141            WRITE_UVLC(sei.m_depth_nonlinear_representation_model[sei.m_currLayerID][i-1],"depth_nonlinear_representation_model[ i ]");
     1142        }
     1143    }
     1144}
     1145
     1146Void SEIWriter::xWriteSEIDepthRepInfoElement( double f)
     1147{
     1148    UInt x_sign, x_exp, x_mantissa,x_mantissa_len;
     1149    if (f < 0)
     1150    {
     1151        f = f * (-1);
     1152        x_sign = 1;
     1153    }
     1154    else
     1155    {
     1156        x_sign = 0;
     1157    }
     1158    int exponent=0;
     1159    if(f >= 1)
     1160    {
     1161        while(f>=2)
     1162        {
     1163            exponent++;
     1164            f = f/2;
     1165        }
     1166    }
     1167    else
     1168    {
     1169        while (f<1)
     1170        {
     1171            exponent++;
     1172            f = f*2;
     1173        }
     1174        exponent=-exponent;
     1175    }
     1176
     1177    int i;
     1178    f = f -1;
     1179    double s = 1;
     1180    char s_mantissa[32];
     1181    double thr=1.0/(4.0*(1<<30));
     1182
     1183    if (f>=thr)
     1184    {
     1185        for(i=0;i<32;i++)
     1186        {
     1187            s /= 2;
     1188            if(f>=s)
     1189            {
     1190                f = f-s;
     1191                s_mantissa[i]=1;
     1192
     1193                if (f<thr)
     1194                    break;
     1195            }else
     1196            {
     1197                s_mantissa[i]=0;
     1198            }
     1199        }
     1200
     1201        if (i<32)
     1202            x_mantissa_len=i+1;
     1203        else
     1204            x_mantissa_len=32;
     1205
     1206        x_mantissa=0;
     1207
     1208        for(i=0;i<x_mantissa_len;i++)
     1209        {
     1210            if (s_mantissa[i]==1)
     1211                x_mantissa += (1u)<<(x_mantissa_len-1-i) ;
     1212        }
     1213
     1214    }else
     1215    {
     1216        x_mantissa=0;
     1217        x_mantissa_len=1;
     1218    }
     1219
     1220    assert(exponent>=-31 && exponent<= (1<<7)-32);
     1221    x_exp=exponent+31;
     1222
     1223    WRITE_FLAG(  x_sign,                         "da_sign_flag" );
     1224    WRITE_CODE(  x_exp, 7 ,                      "da_exponent" );
     1225    WRITE_CODE( x_mantissa_len-1, 5 ,            "da_mantissa_len_minus1" );
     1226    WRITE_CODE( x_mantissa, x_mantissa_len ,     "da_mantissa" );
     1227
    11401228};
    1141 
    1142 Void SEIWriter::xWriteSEIDepthRepInfoElement( const SEIDepthRepInfoElement& sei)
    1143 {
    1144   WRITE_FLAG( ( sei.m_daSignFlag ? 1 : 0 ), "da_sign_flag" );
    1145   WRITE_CODE( sei.m_daExponent, 7, "da_exponent" );
    1146   WRITE_CODE( sei.m_daMantissaLenMinus1, 5, "da_mantissa_len_minus1" );
    1147   WRITE_CODE( sei.m_daMantissa, getDaMantissaLen ), "da_mantissa" );
    1148 };
    1149 
    1150 #endif
     1229#endif
    11511230Void SEIWriter::xWriteSEIMultiviewSceneInfo( const SEIMultiviewSceneInfo& sei)
    11521231{
Note: See TracChangeset for help on using the changeset viewer.