diff --git a/cfg/sei_vui/alpha_channel_info.cfg b/cfg/sei_vui/alpha_channel_info.cfg new file mode 100644 index 0000000000000000000000000000000000000000..de33a96649d834a3b4e6e0078b5889fa497cd295 --- /dev/null +++ b/cfg/sei_vui/alpha_channel_info.cfg @@ -0,0 +1,10 @@ +#======== Alpha Channel Information SEI message ===================== +SEIACIEnabled : 1 +SEIACICancelFlag : 0 +SEIACIUseIdc : 0 +SEIACIBitDepthMinus8 : 0 +SEIACITransparentValue : 0 +SEIACIOpaqueValue : 255 +SEIACIIncrFlag : 0 +SEIACIClipFlag : 0 +SEIACIClipTypeFlag : 0 diff --git a/cfg/sei_vui/depth_representation_info.cfg b/cfg/sei_vui/depth_representation_info.cfg new file mode 100644 index 0000000000000000000000000000000000000000..74d2eac3559566f634f899ec864ab2f0ec873d1e --- /dev/null +++ b/cfg/sei_vui/depth_representation_info.cfg @@ -0,0 +1,14 @@ +#======== Depth Representation Information SEI message ===================== +SEIDRIEnabled : 1 +SEIDRIZNearFlag : 1 +SEIDRIZFarFlag : 1 +SEIDRIDMinFlag : 1 +SEIDRIDMaxFlag : 1 +SEIDRIDepthRepresentationType : 3 +SEIDRIDisparityRefViewId : 0 +SEIDRIZNear : 448.251214 +SEIDRIZFar : 11206.280350 +SEIDRIDMin : 1.891 +SEIDRIDMax : 16.28 +SEIDRINonlinearNumMinus1 : 4 +SEIDRINonlinearModel : 1 3 4 12 5 \ No newline at end of file diff --git a/cfg/sei_vui/multiview_acquisition_info.cfg b/cfg/sei_vui/multiview_acquisition_info.cfg new file mode 100644 index 0000000000000000000000000000000000000000..cfde992c55e6ee557b76d5a4611a1146668e5445 --- /dev/null +++ b/cfg/sei_vui/multiview_acquisition_info.cfg @@ -0,0 +1,26 @@ +#======== Multiview Acquisition Information SEI message ===================== +SEIMAIEnabled : 1 +SEIMAIIntrinsicParamFlag : 1 +SEIMAIExtrinsicParamFlag : 1 # see software manual for list format +SEIMAINumViewsMinus1 : 0 +SEIMAIIntrinsicParamsEqualFlag : 1 +SEIMAIPrecFocalLength : 31 +SEIMAIPrecPrincipalPoint : 31 +SEIMAIPrecSkewFactor : 31 +SEIMAISignFocalLengthX : 0 +SEIMAIExponentFocalLengthX : 0 +SEIMAIMantissaFocalLengthX : 0 +SEIMAISignFocalLengthY : 0 +SEIMAIExponentFocalLengthY : 0 +SEIMAIMantissaFocalLengthY : 0 +SEIMAISignPrincipalPointX : 0 +SEIMAIExponentPrincipalPointX : 0 +SEIMAIMantissaPrincipalPointX : 0 +SEIMAISignPrincipalPointY : 0 +SEIMAIExponentPrincipalPointY : 0 +SEIMAIMantissaPrincipalPointY : 0 +SEIMAISignSkewFactor : 0 +SEIMAIExponentSkewFactor : 0 +SEIMAIMantissaSkewFactor : 0 +SEIMAIPrecRotationParam : 31 +SEIMAIPrecTranslationParam : 31 \ No newline at end of file diff --git a/cfg/sei_vui/scalability_dimension_info.cfg b/cfg/sei_vui/scalability_dimension_info.cfg new file mode 100644 index 0000000000000000000000000000000000000000..17701479fd6dccc68949b17db8bfbb629cbcf8b9 --- /dev/null +++ b/cfg/sei_vui/scalability_dimension_info.cfg @@ -0,0 +1,10 @@ +#======== Scalability Dimension Information SEI message ===================== +SEISDIEnabled : 1 +SEISDIMaxLayersMinus1 : 1 +SEISDIAuxiliaryInfoFlag : 1 +SEISDIMultiviewInfoFlag : 1 +SEISDIViewIdLenMinus1 : 3 +SEISDILayerId : 0 1 +SEISDIViewIdVal : 0 1 +SEISDIAuxId : 0 1 +SEISDINumAssociatedPrimaryLayersMinus1 : 0 1 \ No newline at end of file diff --git a/doc/software-manual.tex b/doc/software-manual.tex index ae298489c372d6264303014209e1fcb8baf2a5a0..e6c8246acfd7eea828820e180a57d5e82c8dd448 100644 --- a/doc/software-manual.tex +++ b/doc/software-manual.tex @@ -3533,10 +3533,14 @@ The table below lists the SEI messages defined for Version 1 and Range-Extension 154 & Sphere rotation & Table \ref{tab:sei-sphere-rotation} \\ 155 & Region-wise packing & Table \ref{tab:sei-rwp} \\ 156 & Omni viewport & Table \ref{tab:sei-omni-viewport} \\ + 165 & Alpha Channel Information & Table \ref{tab:sei-aci} \\ 168 & Frame-field information & Table \ref{tab:sei-frame-field} \\ + 177 & Depth Representation Information & Table \ref{tab:sei-dri} \\ + 179 & Multiview Acquisition Information & Table \ref{tab:sei-mai} \\ 202 & Annotated regions information & Table \ref{tab:sei-annotated-regions} \\ 203 & Subpicture Level Information & Table \ref{tab:sei-subpic-level} \\ 204 & Sample Aspect Ratio Information & Table \ref{tab:sei-sari} \\ + 205 & Scalability Dimension Information & Table \ref{tab:sei-sdi} \\ \end{SEIListTable} %% %% SEI messages @@ -4548,6 +4552,242 @@ Specifies the vertical size of the sample aspect ratio, if SEISARIAspectRatioIdc \\ \end{OptionTableNoShorthand} +\begin{OptionTableNoShorthand}{Scalability Dimension Information SEI message encoder parameters}{tab:sei-sdi} +\Option{SEISDIEnabled} & +\Default{false} & +Enables (true) or disables (false) the insertion of Scalability Dimension Information SEI message. +\\ +\Option{SEISDIMaxLayersMinus1} & +\Default{0} & +Specifies the maximum number of layers minus 1 in the current CVS. +\\ +\Option{SEISDIMultiviewInfoFlag} & +\Default{false} & +Specifies the current CVS may have multiple views and the sdi_view_id_val[ ] syntax elements are present in the scalaibility dimension information SEI message. +\\ +\Option{SEISDIAuxiliaryInfoFlag} & +\Default{false} & +Specifies that one or more layers in the current CVS may be auxiliary layers, which carry auxiliary information, and the sdi_aux_id[ ] syntax elements are present in the scalaibility dimension information SEI message. +\\ +\Option{SEISDIViewIdLenMinus1} & +\Default{0} & +Specifies the length, in bits, of the sdi_view_id_val[ i ] syntax element minus 1 in the scalaibility dimension information SEI message. +\\ +\Option{SEISDILayerId} & +\Default{""} & +List of the layer identifiers that may be present in the scalaibility dimension information SEI message in the current CVS. +\\ +\Option{SEISDIViewIdVal} & +\Default{""} & +List of the view identifiers in the scalaibility dimension information SEI message. +\\ +\Option{SEISDIAuxId} & +\Default{""} & +List of the auxiliary identifiers in the scalaibility dimension information SEI message. +\\ +\Option{SEISDINumAssociatedPrimaryLayersMinus1} & +\Default{""} & +List of the numbers of associated primary layers of i-th layer, which is an auxiliary layer. +\\ +\end{OptionTableNoShorthand} + +\begin{OptionTableNoShorthand}{Alpha Channel Information SEI message encoder parameters}{tab:sei-aci} +\Option{SEIACIEnabled} & +\Default{false} & +Enables (true) or disables (false) the insertion of Alpha Channel Information SEI message. +\\ +\Option{SEIACICancelFlag} & +\Default{false} & +Specifies the persistence of any previous alpha channel information SEI message in output order. +\\ +\Option{SEIACIUseIdc} & +\Default{0} & +Specifies the usage of the auxiliary picture in the alpha channel information SEI message. +\\ +\Option{SEIACIBitDepthMinus8} & +\Default{0} & +Specifies the bit depth of the samples of the auxiliary picture in the alpha channel information SEI message. +\\ +\Option{SEIACITransparentValue} & +\Default{0} & +Specifies the interpretation sample value of an auxiliary coded picture luma sample for which the associated luma and chroma samples of the primary coded picture are considered transparent for purposes of alpha blending in the alpha channel information SEI message. +\\ +\Option{SEIACIOpaqueValue} & +\Default{0} & +Specifies the interpretation sample value of an auxiliary coded picture luma sample for which the associated luma and chroma samples of the primary coded picture are considered opaque for purposes of alpha blending in the alpha channel information SEI message. +\\ +\Option{SEIACIIncrFlag} & +\Default{false} & +Specifies the interpretation sample value for each decoded auxiliary picture luma sample value is equal to the decoded auxiliary picture sample value for purposes of alpha blending in the alpha channel information SEI message. +\\ +\Option{SEIACIClipFlag} & +\Default{false} & +Specifies whether clipping operation is applied in the alpha channel information SEI message. +\\ +\Option{SEIACIClipTypeFlag} & +\Default{false} & +Specifies the type of clipping operation in the alpha channel information SEI message. +\\ +\end{OptionTableNoShorthand} + +\begin{OptionTableNoShorthand}{Depth Representation Information SEI message encoder parameters}{tab:sei-dri} +\Option{SEIDRIEnabled} & +\Default{false} & +Enables (true) or disables (false) the insertion of Depth Representation Information SEI message. +\\ +\Option{SEIDRIZNearFlag} & +\Default{false} & +Specifies the presence of the nearest depth value in the depth representation information SEI message. +\\ +\Option{SEIDRIZFarFlag} & +\Default{false} & +Specifies the presence of the farthest depth value in the depth representation information SEI message. +\\ +\Option{SEIDRIDMinFlag} & +\Default{false} & +Specifies the presence of the minimum disparity value in the depth representation information SEI message. +\\ +\Option{SEIDRIDMaxFlag} & +\Default{false} & +Specifies the presence of the maximum disparity value in the depth representation information SEI message. +\\ +\Option{SEIDRIZNear} & +\Default{0.0} & +Specifies the nearest depth value in the depth representation information SEI message. +\\ +\Option{SEIDRIZFar} & +\Default{0.0} & +Specifies the farest depth value in the depth representation information SEI message. +\\ +\Option{SEIDRIDMin} & +\Default{0.0} & +Specifies the minimum disparity value in the depth representation information SEI message. +\\ +\Option{SEIDRIDMax} & +\Default{0.0} & +Specifies the maximum disparity value in the depth representation information SEI message. +\\ +\Option{SEIDRIDepthRepresentationType} & +\Default{0} & +Specifies the the representation definition of decoded luma samples of auxiliary pictures in the depth representation information SEI message. +\\ +\Option{SEIDRIDisparityRefViewId} & +\Default{0} & +Specifies the ViewId value against which the disparity values are derived in the depth representation information SEI message. +\\ +\Option{SEIDRINonlinearNumMinus1} & +\Default{0} & +Specifies the number of piece-wise linear segments minus 2 for mapping of depth values to a scale that is uniformly quantized in terms of disparity in the depth representation information SEI message. +\\ +\Option{SEIDRINonlinearModel} & +\Default{""} & +List of the piece-wise linear segments for mapping of decoded luma sample values of an auxiliary picture to a scale that is uniformly quantized in terms of disparity in the depth representation information SEI message. +\\ +\end{OptionTableNoShorthand} + +\begin{OptionTableNoShorthand}{Multiview Acquisition Information SEI message encoder parameters}{tab:sei-mai} +\Option{SEIMAIEnabled} & +\Default{false} & +Enables (true) or disables (false) the insertion of Multiview Acquisition Information SEI message. +\\ +\Option{SEIMAIIntrinsicParamFlag} & +\Default{false} & +Specifies the presence of intrinsic camera parameters in the multiview acquisition information SEI message. +\\ +\Option{SEIMAIExtrinsicParamFlag} & +\Default{false} & +Specifies the presence of extrinsic camera parameters in the multiview acquisition information SEI message. +\\ +\Option{SEIMAINumViewsMinus1} & +\Default{0} & +Specifies the number of views minus 1 in the multiview acquisition information SEI message. +\\ +\Option{SEIMAIIntrinsicParamsEqualFlag} & +\Default{false} & +Specifies the intrinsic camera parameters are equal for all cameras in the multiview acquisition information SEI message. +\\ +\Option{SEIMAIPrecFocalLength} & +\Default{0} & +Specifies the exponent of the maximum allowable truncation error for focal_length_x[i] and focal_length_y[i] in the multiview acquisition information SEI message. +\\ +\Option{SEIMAIPrecPrincipalPoint} & +\Default{0} & +Specifies the exponent of the maximum allowable truncation error for principal_point_x[i] and principal_point_y[i] in the multiview acquisition information SEI message. +\\ +\Option{SEIMAIPrecSkewFactor} & +\Default{0} & +Specifies the exponent of the maximum allowable truncation error for skew factor in the multiview acquisition information SEI message. +\\ +\Option{SEIMAISignFocalLengthX} & +\Default{""} & +List of the signs of the focal length of the camera in the horizontal direction in the multiview acquisition information SEI message. +\\ +\Option{SEIMAIExponentFocalLengthX} & +\Default{""} & +List of the exponent parts of the focal length of the camera in the horizontal direction. in the multiview acquisition information SEI message. +\\ +\Option{SEIMAIMantissaFocalLengthX} & +\Default{""} & +List of the mantissa parts of the focal length of the camera in the horizontal direction in the multiview acquisition information SEI message. +\\ +\Option{SEIMAISignFocalLengthY} & +\Default{""} & +List of the signs of the focal length of the camera in the vertical direction in the multiview acquisition information SEI message. +\\ +\Option{SEIMAIExponentFocalLengthY} & +\Default{""} & +List of the exponent parts of the focal length of the camera in the vertical direction in the multiview acquisition information SEI message. +\\ +\Option{SEIMAIMantissaFocalLengthY} & +\Default{""} & +List of the mantissa parts of the focal length of the camera in the vertical direction in the multiview acquisition information SEI message. +\\ +\Option{SEIMAISignPrincipalPointX} & +\Default{""} & +List of the signs of the principal point of the camera in the horizontal direction in the multiview acquisition information SEI message. +\\ +\Option{SEIMAIExponentPrincipalPointX} & +\Default{""} & +List of the exponent parts of the principal point of the camera in the horizontal direction in the multiview acquisition information SEI message. +\\ +\Option{SEIMAIMantissaPrincipalPointX} & +\Default{""} & +List of the mantissa parts of the principal point of the camera in the horizontal direction in the multiview acquisition information SEI message. +\\ +\Option{SEIMAISignPrincipalPointY} & +\Default{""} & +List of the signs of the principal point of the camera in the vertical direction in the multiview acquisition information SEI message. +\\ +\Option{SEIMAIExponentPrincipalPointY} & +\Default{""} & +List of the exponent parts of the principal point of the camera in the vertical direction in the multiview acquisition information SEI message. +\\ +\Option{SEIMAIMantissaPrincipalPointY} & +\Default{""} & +List of the mantissa parts of the principal point of the camera in the vertical direction in the multiview acquisition information SEI message. +\\ +\Option{SEIMAISignSkewFactor} & +\Default{""} & +List of the signs of the skew factor of the camera in the multiview acquisition information SEI message. +\\ +\Option{SEIMAIExponentSkewFactor} & +\Default{""} & +List of the exponent parts of the skew factor of the camera in the multiview acquisition information SEI message. +\\ +\Option{SEIMAIMantissaSkewFactor} & +\Default{""} & +List of the mantissa parts of the skew factor of the camera in the multiview acquisition information SEI message. +\\ +\Option{SEIMAIPrecRotationParam} & +\Default{0} & +Specifies the exponent of the maximum allowable truncation error for rotation in the multiview acquisition information SEI message. +\\ +\Option{SEIMAIPrecTranslationParam} & +\Default{0} & +Specifies the exponent of the maximum allowable truncation error for translation in the multiview acquisition information SEI message. +\\ +\end{OptionTableNoShorthand} + \begin{OptionTableNoShorthand}{Frame-Field Information SEI message encoder parameters}{tab:sei-frame-field} \Option{SEIFrameFieldInfo} & \Default{false} & diff --git a/source/App/EncoderApp/EncApp.cpp b/source/App/EncoderApp/EncApp.cpp index 8df3683c4fbb4de09e7a3d450730aa5d62ed99a7..e66809b6daebd8106f3f64572d419ed3fa0fbaa8 100644 --- a/source/App/EncoderApp/EncApp.cpp +++ b/source/App/EncoderApp/EncApp.cpp @@ -1002,6 +1002,68 @@ void EncApp::xInitLibCfg() m_cEncLib.setCcvSEIMinLuminanceValue (m_ccvSEIMinLuminanceValue); m_cEncLib.setCcvSEIMaxLuminanceValue (m_ccvSEIMaxLuminanceValue); m_cEncLib.setCcvSEIAvgLuminanceValue (m_ccvSEIAvgLuminanceValue); +#if JVET_U0082_SDI_MAI_ACI_DRI + // scalability dimension information sei + m_cEncLib.setSdiSEIEnabled (m_sdiSEIEnabled); + m_cEncLib.setSdiSEIMaxLayersMinus1 (m_sdiSEIMaxLayersMinus1); + m_cEncLib.setSdiSEIMultiviewInfoFlag (m_sdiSEIMultiviewInfoFlag); + m_cEncLib.setSdiSEIAuxiliaryInfoFlag (m_sdiSEIAuxiliaryInfoFlag); + m_cEncLib.setSdiSEIViewIdLenMinus1 (m_sdiSEIViewIdLenMinus1); + m_cEncLib.setSdiSEILayerId (m_sdiSEILayerId); + m_cEncLib.setSdiSEIViewIdVal (m_sdiSEIViewIdVal); + m_cEncLib.setSdiSEIAuxId (m_sdiSEIAuxId); + m_cEncLib.setSdiSEINumAssociatedPrimaryLayersMinus1 (m_sdiSEINumAssociatedPrimaryLayersMinus1); + // multiview acquisition information sei + m_cEncLib.setMaiSEIEnabled (m_maiSEIEnabled); + m_cEncLib.setMaiSEIIntrinsicParamFlag (m_maiSEIIntrinsicParamFlag); + m_cEncLib.setMaiSEIExtrinsicParamFlag (m_maiSEIExtrinsicParamFlag); + m_cEncLib.setMaiSEINumViewsMinus1 (m_maiSEINumViewsMinus1); + m_cEncLib.setMaiSEIIntrinsicParamsEqualFlag (m_maiSEIIntrinsicParamsEqualFlag); + m_cEncLib.setMaiSEIPrecFocalLength (m_maiSEIPrecFocalLength); + m_cEncLib.setMaiSEIPrecPrincipalPoint (m_maiSEIPrecPrincipalPoint); + m_cEncLib.setMaiSEIPrecSkewFactor (m_maiSEIPrecSkewFactor); + m_cEncLib.setMaiSEISignFocalLengthX (m_maiSEISignFocalLengthX); + m_cEncLib.setMaiSEIExponentFocalLengthX (m_maiSEIExponentFocalLengthX); + m_cEncLib.setMaiSEIMantissaFocalLengthX (m_maiSEIMantissaFocalLengthX); + m_cEncLib.setMaiSEISignFocalLengthY (m_maiSEISignFocalLengthY); + m_cEncLib.setMaiSEIExponentFocalLengthY (m_maiSEIExponentFocalLengthY); + m_cEncLib.setMaiSEIMantissaFocalLengthY (m_maiSEIMantissaFocalLengthY); + m_cEncLib.setMaiSEISignPrincipalPointX (m_maiSEISignPrincipalPointX); + m_cEncLib.setMaiSEIExponentPrincipalPointX (m_maiSEIExponentPrincipalPointX); + m_cEncLib.setMaiSEIMantissaPrincipalPointX (m_maiSEIMantissaPrincipalPointX); + m_cEncLib.setMaiSEISignPrincipalPointY (m_maiSEISignPrincipalPointY); + m_cEncLib.setMaiSEIExponentPrincipalPointY (m_maiSEIExponentPrincipalPointY); + m_cEncLib.setMaiSEIMantissaPrincipalPointY (m_maiSEIMantissaPrincipalPointY); + m_cEncLib.setMaiSEISignSkewFactor (m_maiSEISignSkewFactor); + m_cEncLib.setMaiSEIExponentSkewFactor (m_maiSEIExponentSkewFactor); + m_cEncLib.setMaiSEIMantissaSkewFactor (m_maiSEIMantissaSkewFactor); + m_cEncLib.setMaiSEIPrecRotationParam (m_maiSEIPrecRotationParam); + m_cEncLib.setMaiSEIPrecTranslationParam (m_maiSEIPrecTranslationParam); + // alpha channel information sei + m_cEncLib.setAciSEIEnabled (m_aciSEIEnabled); + m_cEncLib.setAciSEICancelFlag (m_aciSEICancelFlag); + m_cEncLib.setAciSEIUseIdc (m_aciSEIUseIdc); + m_cEncLib.setAciSEIBitDepthMinus8 (m_aciSEIBitDepthMinus8); + m_cEncLib.setAciSEITransparentValue (m_aciSEITransparentValue); + m_cEncLib.setAciSEIOpaqueValue (m_aciSEIOpaqueValue); + m_cEncLib.setAciSEIIncrFlag (m_aciSEIIncrFlag); + m_cEncLib.setAciSEIClipFlag (m_aciSEIClipFlag); + m_cEncLib.setAciSEIClipTypeFlag (m_aciSEIClipTypeFlag); + // depth representation information sei + m_cEncLib.setDriSEIEnabled (m_driSEIEnabled); + m_cEncLib.setDriSEIZNearFlag (m_driSEIZNearFlag); + m_cEncLib.setDriSEIZFarFlag (m_driSEIZFarFlag); + m_cEncLib.setDriSEIDMinFlag (m_driSEIDMinFlag); + m_cEncLib.setDriSEIDMaxFlag (m_driSEIDMaxFlag); + m_cEncLib.setDriSEIZNear (m_driSEIZNear); + m_cEncLib.setDriSEIZFar (m_driSEIZFar); + m_cEncLib.setDriSEIDMin (m_driSEIDMin); + m_cEncLib.setDriSEIDMax (m_driSEIDMax); + m_cEncLib.setDriSEIDepthRepresentationType (m_driSEIDepthRepresentationType); + m_cEncLib.setDriSEIDisparityRefViewId (m_driSEIDisparityRefViewId); + m_cEncLib.setDriSEINonlinearNumMinus1 (m_driSEINonlinearNumMinus1); + m_cEncLib.setDriSEINonlinearModel (m_driSEINonlinearModel); +#endif m_cEncLib.setEntropyCodingSyncEnabledFlag ( m_entropyCodingSyncEnabledFlag ); m_cEncLib.setEntryPointPresentFlag ( m_entryPointPresentFlag ); m_cEncLib.setTMVPModeId ( m_TMVPModeId ); diff --git a/source/App/EncoderApp/EncAppCfg.cpp b/source/App/EncoderApp/EncAppCfg.cpp index 7b048780bc5289f4b0a76075added4c819120312..cc4c25665cb61f99c859e153d9d9bad9cce0461c 100644 --- a/source/App/EncoderApp/EncAppCfg.cpp +++ b/source/App/EncoderApp/EncAppCfg.cpp @@ -665,6 +665,28 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) SMultiValueInput<uint32_t> cfg_gcmpSEIFunctionUAffectedByVFlag (0, 1, 5, 6); SMultiValueInput<double> cfg_gcmpSEIFunctionCoeffV (0.0, 1.0, 5, 6); SMultiValueInput<uint32_t> cfg_gcmpSEIFunctionVAffectedByUFlag (0, 1, 5, 6); +#if JVET_U0082_SDI_MAI_ACI_DRI + SMultiValueInput<uint32_t> cfg_sdiSEILayerId (0, 63, 0, 63); + SMultiValueInput<uint32_t> cfg_sdiSEIViewIdVal (0, 63, 0, std::numeric_limits<uint32_t>::max()); + SMultiValueInput<uint32_t> cfg_sdiSEIAuxId (0, 255, 0, 63); + SMultiValueInput<uint32_t> cfg_sdiSEINumAssociatedPrimaryLayersMinus1 (0, 63, 0, 63); + SMultiValueInput<bool> cfg_maiSEISignFocalLengthX (0, 1, 0, std::numeric_limits<uint32_t>::max()); + SMultiValueInput<uint32_t> cfg_maiSEIExponentFocalLengthX (0, 63, 0, std::numeric_limits<uint32_t>::max()); + SMultiValueInput<uint32_t> cfg_maiSEIMantissaFocalLengthX (0, std::numeric_limits<uint32_t>::max(), 0, std::numeric_limits<uint32_t>::max()); + SMultiValueInput<bool> cfg_maiSEISignFocalLengthY (0, 1, 0, std::numeric_limits<uint32_t>::max()); + SMultiValueInput<uint32_t> cfg_maiSEIExponentFocalLengthY (0, 63, 0, std::numeric_limits<uint32_t>::max()); + SMultiValueInput<uint32_t> cfg_maiSEIMantissaFocalLengthY (0, std::numeric_limits<uint32_t>::max(), 0, std::numeric_limits<uint32_t>::max()); + SMultiValueInput<bool> cfg_maiSEISignPrincipalPointX (0, 1, 0, std::numeric_limits<uint32_t>::max()); + SMultiValueInput<uint32_t> cfg_maiSEIExponentPrincipalPointX (0, 63, 0, std::numeric_limits<uint32_t>::max()); + SMultiValueInput<uint32_t> cfg_maiSEIMantissaPrincipalPointX (0, std::numeric_limits<uint32_t>::max(), 0, std::numeric_limits<uint32_t>::max()); + SMultiValueInput<bool> cfg_maiSEISignPrincipalPointY (0, 1, 0, std::numeric_limits<uint32_t>::max()); + SMultiValueInput<uint32_t> cfg_maiSEIExponentPrincipalPointY (0, 63, 0, std::numeric_limits<uint32_t>::max()); + SMultiValueInput<uint32_t> cfg_maiSEIMantissaPrincipalPointY (0, std::numeric_limits<uint32_t>::max(), 0, std::numeric_limits<uint32_t>::max()); + SMultiValueInput<bool> cfg_maiSEISignSkewFactor (0, 1, 0, std::numeric_limits<uint32_t>::max()); + SMultiValueInput<uint32_t> cfg_maiSEIExponentSkewFactor (0, 63, 0, std::numeric_limits<uint32_t>::max()); + SMultiValueInput<uint32_t> cfg_maiSEIMantissaSkewFactor (0, std::numeric_limits<uint32_t>::max(), 0, std::numeric_limits<uint32_t>::max()); + SMultiValueInput<uint32_t> cfg_driSEINonlinearModel (0, 31, 0, std::numeric_limits<uint32_t>::max()); +#endif #if LUMA_ADAPTIVE_DEBLOCKING_FILTER_QP_OFFSET const int defaultLadfQpOffset[3] = { 1, 0, 1 }; const int defaultLadfIntervalLowerBound[2] = { 350, 833 }; @@ -1408,6 +1430,68 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) ("SEICCVMaxLuminanceValue", m_ccvSEIMaxLuminanceValue, 0.1, "specifies the CCV max luminance value in the content colour volume SEI message") ("SEICCVAvgLuminanceValuePresent", m_ccvSEIAvgLuminanceValuePresentFlag, true, "Specifies whether the CCV avg luminance value is present in the content colour volume SEI message") ("SEICCVAvgLuminanceValue", m_ccvSEIAvgLuminanceValue, 0.01, "specifies the CCV avg luminance value in the content colour volume SEI message") +#if JVET_U0082_SDI_MAI_ACI_DRI + // scalability dimension information SEI + ("SEISDIEnabled", m_sdiSEIEnabled, false, "Control generation of scalaibility dimension information SEI message") + ("SEISDIMaxLayersMinus1", m_sdiSEIMaxLayersMinus1, 0, "Specifies the maximum number of layers minus 1 in the current CVS") + ("SEISDIMultiviewInfoFlag", m_sdiSEIMultiviewInfoFlag, false, "Specifies the current CVS may have multiple views and the sdi_view_id_val[ ] syntax elements are present in the scalaibility dimension information SEI message") + ("SEISDIAuxiliaryInfoFlag", m_sdiSEIAuxiliaryInfoFlag, false, "Specifies that one or more layers in the current CVS may be auxiliary layers, which carry auxiliary information, and the sdi_aux_id[ ] syntax elements are present in the scalaibility dimension information SEI message") + ("SEISDIViewIdLenMinus1", m_sdiSEIViewIdLenMinus1, 0, "Specifies the length, in bits, of the sdi_view_id_val[ i ] syntax element minus 1 in the scalaibility dimension information SEI message") + ("SEISDILayerId", cfg_sdiSEILayerId, cfg_sdiSEILayerId, "List of the layer identifiers that may be present in the scalaibility dimension information SEI message in the current CVS") + ("SEISDIViewIdVal", cfg_sdiSEIViewIdVal, cfg_sdiSEIViewIdVal, "List of the view identifiers in the scalaibility dimension information SEI message") + ("SEISDIAuxId", cfg_sdiSEIAuxId, cfg_sdiSEIAuxId, "List of the auxiliary identifiers in the scalaibility dimension information SEI message") + ("SEISDINumAssociatedPrimaryLayersMinus1", cfg_sdiSEINumAssociatedPrimaryLayersMinus1, cfg_sdiSEINumAssociatedPrimaryLayersMinus1, "List of the numbers of associated primary layers of i-th layer, which is an auxiliary layer.") + // multiview acquisition information SEI + ("SEIMAIEnabled", m_maiSEIEnabled, false, "Control generation of multiview acquisition information SEI message") + ("SEIMAIIntrinsicParamFlag", m_maiSEIIntrinsicParamFlag, false, "Specifies the presence of intrinsic camera parameters in the multiview acquisition information SEI message") + ("SEIMAIExtrinsicParamFlag", m_maiSEIExtrinsicParamFlag, false, "Specifies the presence of extrinsic camera parameters in the multiview acquisition information SEI message") + ("SEIMAINumViewsMinus1", m_maiSEINumViewsMinus1, 0, "Specifies the number of views minus 1 in the multiview acquisition information SEI message") + ("SEIMAIIntrinsicParamsEqualFlag", m_maiSEIIntrinsicParamsEqualFlag, false, "Specifies the intrinsic camera parameters are equal for all cameras in the multiview acquisition information SEI message") + ("SEIMAIPrecFocalLength", m_maiSEIPrecFocalLength, 0, "Specifies the exponent of the maximum allowable truncation error for focal_length_x[i] and focal_length_y[i] in the multiview acquisition information SEI message") + ("SEIMAIPrecPrincipalPoint", m_maiSEIPrecPrincipalPoint, 0, "Specifies the exponent of the maximum allowable truncation error for principal_point_x[i] and principal_point_y[i] in the multiview acquisition information SEI message") + ("SEIMAIPrecSkewFactor", m_maiSEIPrecSkewFactor, 0, "Specifies the exponent of the maximum allowable truncation error for skew factor in the multiview acquisition information SEI message") + ("SEIMAISignFocalLengthX", cfg_maiSEISignFocalLengthX, cfg_maiSEISignFocalLengthX, "List of the signs of the focal length of the camera in the horizontal direction in the multiview acquisition information SEI message") + ("SEIMAIExponentFocalLengthX", cfg_maiSEIExponentFocalLengthX, cfg_maiSEIExponentFocalLengthX, "List of the exponent parts of the focal length of the camera in the horizontal direction. in the multiview acquisition information SEI message") + ("SEIMAIMantissaFocalLengthX", cfg_maiSEIMantissaFocalLengthX, cfg_maiSEIMantissaFocalLengthX, "List of the mantissa parts of the focal length of the camera in the horizontal direction in the multiview acquisition information SEI message") + ("SEIMAISignFocalLengthY", cfg_maiSEISignFocalLengthY, cfg_maiSEISignFocalLengthY, "List of the signs of the focal length of the camera in the vertical direction in the multiview acquisition information SEI message") + ("SEIMAIExponentFocalLengthY", cfg_maiSEIExponentFocalLengthY, cfg_maiSEIExponentFocalLengthY, "List of the exponent parts of the focal length of the camera in the vertical direction in the multiview acquisition information SEI message") + ("SEIMAIMantissaFocalLengthY", cfg_maiSEIMantissaFocalLengthY, cfg_maiSEIMantissaFocalLengthY, "List of the mantissa parts of the focal length of the camera in the vertical direction in the multiview acquisition information SEI message") + ("SEIMAISignPrincipalPointX", cfg_maiSEISignPrincipalPointX, cfg_maiSEISignPrincipalPointX, "List of the signs of the principal point of the camera in the horizontal direction in the multiview acquisition information SEI message") + ("SEIMAIExponentPrincipalPointX", cfg_maiSEIExponentPrincipalPointX, cfg_maiSEIExponentPrincipalPointX, "List of the exponent parts of the principal point of the camera in the horizontal direction in the multiview acquisition information SEI message") + ("SEIMAIMantissaPrincipalPointX", cfg_maiSEIMantissaPrincipalPointX, cfg_maiSEIMantissaPrincipalPointX, "List of the mantissa parts of the principal point of the camera in the horizontal direction in the multiview acquisition information SEI message") + ("SEIMAISignPrincipalPointY", cfg_maiSEISignPrincipalPointY, cfg_maiSEISignPrincipalPointY, "List of the signs of the principal point of the camera in the vertical direction in the multiview acquisition information SEI message") + ("SEIMAIExponentPrincipalPointY", cfg_maiSEIExponentPrincipalPointY, cfg_maiSEIExponentPrincipalPointY, "List of the exponent parts of the principal point of the camera in the vertical direction in the multiview acquisition information SEI message") + ("SEIMAIMantissaPrincipalPointY", cfg_maiSEIMantissaPrincipalPointY, cfg_maiSEIMantissaPrincipalPointY, "List of the mantissa parts of the principal point of the camera in the vertical direction in the multiview acquisition information SEI message") + ("SEIMAISignSkewFactor", cfg_maiSEISignSkewFactor, cfg_maiSEISignSkewFactor, "List of the signs of the skew factor of the camera in the multiview acquisition information SEI message") + ("SEIMAIExponentSkewFactor", cfg_maiSEIExponentSkewFactor, cfg_maiSEIExponentSkewFactor, "List of the exponent parts of the skew factor of the camera in the multiview acquisition information SEI message") + ("SEIMAIMantissaSkewFactor", cfg_maiSEIMantissaSkewFactor, cfg_maiSEIMantissaSkewFactor, "List of the mantissa parts of the skew factor of the camera in the multiview acquisition information SEI message") + ("SEIMAIPrecRotationParam", m_maiSEIPrecRotationParam, 0, "Specifies the exponent of the maximum allowable truncation error for rotation in the multiview acquisition information SEI message") + ("SEIMAIPrecTranslationParam", m_maiSEIPrecTranslationParam, 0, "Specifies the exponent of the maximum allowable truncation error for translation in the multiview acquisition information SEI message") + // alpha channel information SEI + ("SEIACIEnabled", m_aciSEIEnabled, false, "Control generation of alpha channel information SEI message") + ("SEIACICancelFlag", m_aciSEICancelFlag, false, "Specifies the persistence of any previous alpha channel information SEI message in output order") + ("SEIACIUseIdc", m_aciSEIUseIdc, 0, "Specifies the usage of the auxiliary picture in the alpha channel information SEI message") + ("SEIACIBitDepthMinus8", m_aciSEIBitDepthMinus8, 0, "Specifies the bit depth of the samples of the auxiliary picture in the alpha channel information SEI message") + ("SEIACITransparentValue", m_aciSEITransparentValue, 0, "Specifies the interpretation sample value of an auxiliary coded picture luma sample for which the associated luma and chroma samples of the primary coded picture are considered transparent for purposes of alpha blending in the alpha channel information SEI message") + ("SEIACIOpaqueValue", m_aciSEIOpaqueValue, 0, "Specifies the interpretation sample value of an auxiliary coded picture luma sample for which the associated luma and chroma samples of the primary coded picture are considered opaque for purposes of alpha blending in the alpha channel information SEI message") + ("SEIACIIncrFlag", m_aciSEIIncrFlag, false, "Specifies the interpretation sample value for each decoded auxiliary picture luma sample value is equal to the decoded auxiliary picture sample value for purposes of alpha blending in the alpha channel information SEI message") + ("SEIACIClipFlag", m_aciSEIClipFlag, false, "Specifies whether clipping operation is applied in the alpha channel information SEI message") + ("SEIACIClipTypeFlag", m_aciSEIClipTypeFlag, false, "Specifies the type of clipping operation in the alpha channel information SEI message") + // depth representation information SEI + ("SEIDRIEnabled", m_driSEIEnabled, false, "Control generation of depth representation information SEI message") + ("SEIDRIZNearFlag", m_driSEIZNearFlag, false, "Specifies the presence of the nearest depth value in the depth representation information SEI message") + ("SEIDRIZFarFlag", m_driSEIZFarFlag, false, "Specifies the presence of the farthest depth value in the depth representation information SEI message") + ("SEIDRIDMinFlag", m_driSEIDMinFlag, false, "Specifies the presence of the minimum disparity value in the depth representation information SEI message") + ("SEIDRIDMaxFlag", m_driSEIDMaxFlag, false, "Specifies the presence of the maximum disparity value in the depth representation information SEI message") + ("SEIDRIZNear", m_driSEIZNear, 0.0, "Specifies the nearest depth value in the depth representation information SEI message") + ("SEIDRIZFar", m_driSEIZFar, 0.0, "Specifies the farest depth value in the depth representation information SEI message") + ("SEIDRIDMin", m_driSEIDMin, 0.0, "Specifies the minimum disparity value in the depth representation information SEI message") + ("SEIDRIDMax", m_driSEIDMax, 0.0, "Specifies the maximum disparity value in the depth representation information SEI message") + ("SEIDRIDepthRepresentationType", m_driSEIDepthRepresentationType, 0, "Specifies the the representation definition of decoded luma samples of auxiliary pictures in the depth representation information SEI message") + ("SEIDRIDisparityRefViewId", m_driSEIDisparityRefViewId, 0, "Specifies the ViewId value against which the disparity values are derived in the depth representation information SEI message") + ("SEIDRINonlinearNumMinus1", m_driSEINonlinearNumMinus1, 0, "Specifies the number of piece-wise linear segments minus 2 for mapping of depth values to a scale that is uniformly quantized in terms of disparity in the depth representation information SEI message") + ("SEIDRINonlinearModel", cfg_driSEINonlinearModel, cfg_driSEINonlinearModel, "List of the piece-wise linear segments for mapping of decoded luma sample values of an auxiliary picture to a scale that is uniformly quantized in terms of disparity in the depth representation information SEI message") +#endif ("DebugBitstream", m_decodeBitstreams[0], string( "" ), "Assume the frames up to POC DebugPOC will be the same as in this bitstream. Load those frames from the bitstream instead of encoding them." ) ("DebugPOC", m_switchPOC, -1, "If DebugBitstream is present, load frames up to this POC from this bitstream. Starting with DebugPOC, return to normal encoding." ) @@ -2503,6 +2587,82 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) } } } +#if JVET_U0082_SDI_MAI_ACI_DRI + if ( m_sdiSEIEnabled ) + { + if (m_sdiSEIMultiviewInfoFlag || m_sdiSEIAuxiliaryInfoFlag) + { + m_sdiSEILayerId.resize(m_sdiSEIMaxLayersMinus1 + 1); + m_sdiSEIViewIdVal.resize(m_sdiSEIMaxLayersMinus1 + 1); + m_sdiSEIAuxId.resize(m_sdiSEIMaxLayersMinus1 + 1); + m_sdiSEINumAssociatedPrimaryLayersMinus1.resize(m_sdiSEIMaxLayersMinus1 + 1); + for (int i = 0; i <= m_sdiSEIMaxLayersMinus1; i++) + { + m_sdiSEILayerId[i] = cfg_sdiSEILayerId.values[i]; + if (m_sdiSEIMultiviewInfoFlag) + { + m_sdiSEIViewIdVal[i] = cfg_sdiSEIViewIdVal.values[i]; + } + if (m_sdiSEIAuxiliaryInfoFlag) + { + m_sdiSEIAuxId[i] = cfg_sdiSEIAuxId.values[i]; + if (m_sdiSEIAuxId[i] > 0) + { + m_sdiSEINumAssociatedPrimaryLayersMinus1[i] = cfg_sdiSEINumAssociatedPrimaryLayersMinus1.values[i]; + } + } + } + } + } + if ( m_maiSEIEnabled ) + { + if (m_maiSEIIntrinsicParamFlag) + { + int numViews = m_maiSEIIntrinsicParamsEqualFlag ? 1 : m_maiSEINumViewsMinus1 + 1; + m_maiSEISignFocalLengthX .resize( numViews ); + m_maiSEIExponentFocalLengthX .resize( numViews ); + m_maiSEIMantissaFocalLengthX .resize( numViews ); + m_maiSEISignFocalLengthY .resize( numViews ); + m_maiSEIExponentFocalLengthY .resize( numViews ); + m_maiSEIMantissaFocalLengthY .resize( numViews ); + m_maiSEISignPrincipalPointX .resize( numViews ); + m_maiSEIExponentPrincipalPointX.resize( numViews ); + m_maiSEIMantissaPrincipalPointX.resize( numViews ); + m_maiSEISignPrincipalPointY .resize( numViews ); + m_maiSEIExponentPrincipalPointY.resize( numViews ); + m_maiSEIMantissaPrincipalPointY.resize( numViews ); + m_maiSEISignSkewFactor .resize( numViews ); + m_maiSEIExponentSkewFactor .resize( numViews ); + m_maiSEIMantissaSkewFactor .resize( numViews ); + for( int i = 0; i <= ( m_maiSEIIntrinsicParamsEqualFlag ? 0 : m_maiSEINumViewsMinus1 ); i++ ) + { + m_maiSEISignFocalLengthX [i] = cfg_maiSEISignFocalLengthX.values[i]; + m_maiSEIExponentFocalLengthX [i] = cfg_maiSEIExponentFocalLengthX.values[i]; + m_maiSEIMantissaFocalLengthX [i] = cfg_maiSEIMantissaFocalLengthX.values[i]; + m_maiSEISignFocalLengthY [i] = cfg_maiSEISignFocalLengthY.values[i]; + m_maiSEIExponentFocalLengthY [i] = cfg_maiSEIExponentFocalLengthY.values[i]; + m_maiSEIMantissaFocalLengthY [i] = cfg_maiSEIMantissaFocalLengthY.values[i]; + m_maiSEISignPrincipalPointX [i] = cfg_maiSEISignPrincipalPointX.values[i]; + m_maiSEIExponentPrincipalPointX[i] = cfg_maiSEIExponentPrincipalPointX.values[i]; + m_maiSEIMantissaPrincipalPointX[i] = cfg_maiSEIMantissaPrincipalPointX.values[i]; + m_maiSEISignPrincipalPointY [i] = cfg_maiSEISignPrincipalPointY.values[i]; + m_maiSEIExponentPrincipalPointY[i] = cfg_maiSEIExponentPrincipalPointY.values[i]; + m_maiSEIMantissaPrincipalPointY[i] = cfg_maiSEIMantissaPrincipalPointY.values[i]; + m_maiSEISignSkewFactor [i] = cfg_maiSEISignSkewFactor.values[i]; + m_maiSEIExponentSkewFactor [i] = cfg_maiSEIExponentSkewFactor.values[i]; + m_maiSEIMantissaSkewFactor [i] = cfg_maiSEIMantissaSkewFactor.values[i]; + } + } + } + if ( m_driSEIEnabled ) + { + m_driSEINonlinearModel.resize(m_driSEINonlinearNumMinus1+1); + for(int i=0; i<(m_driSEINonlinearNumMinus1+1); i++) + { + m_driSEINonlinearModel[i] = cfg_driSEINonlinearModel.values.size() > i ? cfg_driSEINonlinearModel.values[i] : 0; + } + } +#endif m_reshapeCW.binCW.resize(3); m_reshapeCW.rspFps = m_iFrameRate; m_reshapeCW.rspPicSize = m_sourceWidth*m_sourceHeight; diff --git a/source/App/EncoderApp/EncAppCfg.h b/source/App/EncoderApp/EncAppCfg.h index c45b7413b0758e6cc2c5051dd4fe2a150d5b6e00..f4d024bef6856dfa21c8d43948703bb946605bb4 100644 --- a/source/App/EncoderApp/EncAppCfg.h +++ b/source/App/EncoderApp/EncAppCfg.h @@ -559,6 +559,68 @@ protected: double m_ccvSEIMinLuminanceValue; double m_ccvSEIMaxLuminanceValue; double m_ccvSEIAvgLuminanceValue; +#if JVET_U0082_SDI_MAI_ACI_DRI + // scalability dimension information sei + bool m_sdiSEIEnabled; + int m_sdiSEIMaxLayersMinus1; + bool m_sdiSEIMultiviewInfoFlag; + bool m_sdiSEIAuxiliaryInfoFlag; + int m_sdiSEIViewIdLenMinus1; + std::vector<uint32_t> m_sdiSEILayerId; + std::vector<uint32_t> m_sdiSEIViewIdVal; + std::vector<uint32_t> m_sdiSEIAuxId; + std::vector<uint32_t> m_sdiSEINumAssociatedPrimaryLayersMinus1; + // multiview acquisition information sei + bool m_maiSEIEnabled; + bool m_maiSEIIntrinsicParamFlag; + bool m_maiSEIExtrinsicParamFlag; + int m_maiSEINumViewsMinus1; + bool m_maiSEIIntrinsicParamsEqualFlag; + int m_maiSEIPrecFocalLength; + int m_maiSEIPrecPrincipalPoint; + int m_maiSEIPrecSkewFactor; + std::vector<bool> m_maiSEISignFocalLengthX; + std::vector<uint32_t> m_maiSEIExponentFocalLengthX; + std::vector<uint32_t> m_maiSEIMantissaFocalLengthX; + std::vector<bool> m_maiSEISignFocalLengthY; + std::vector<uint32_t> m_maiSEIExponentFocalLengthY; + std::vector<uint32_t> m_maiSEIMantissaFocalLengthY; + std::vector<bool> m_maiSEISignPrincipalPointX; + std::vector<uint32_t> m_maiSEIExponentPrincipalPointX; + std::vector<uint32_t> m_maiSEIMantissaPrincipalPointX; + std::vector<bool> m_maiSEISignPrincipalPointY; + std::vector<uint32_t> m_maiSEIExponentPrincipalPointY; + std::vector<uint32_t> m_maiSEIMantissaPrincipalPointY; + std::vector<bool> m_maiSEISignSkewFactor; + std::vector<uint32_t> m_maiSEIExponentSkewFactor; + std::vector<uint32_t> m_maiSEIMantissaSkewFactor; + int m_maiSEIPrecRotationParam; + int m_maiSEIPrecTranslationParam; + // alpha channel information sei + bool m_aciSEIEnabled; + bool m_aciSEICancelFlag; + int m_aciSEIUseIdc; + int m_aciSEIBitDepthMinus8; + int m_aciSEITransparentValue; + int m_aciSEIOpaqueValue; + bool m_aciSEIIncrFlag; + bool m_aciSEIClipFlag; + bool m_aciSEIClipTypeFlag; + // depth representation information sei + bool m_driSEIEnabled; + bool m_driSEIZNearFlag; + bool m_driSEIZFarFlag; + bool m_driSEIDMinFlag; + bool m_driSEIDMaxFlag; + double m_driSEIZNear; + double m_driSEIZFar; + double m_driSEIDMin; + double m_driSEIDMax; + int m_driSEIDepthRepresentationType; + int m_driSEIDisparityRefViewId; + int m_driSEINonlinearNumMinus1; + std::vector<uint32_t> m_driSEINonlinearModel; +#endif bool m_erpSEIEnabled; bool m_erpSEICancelFlag; diff --git a/source/Lib/CommonLib/SEI.cpp b/source/Lib/CommonLib/SEI.cpp index 0946e9bc95ecc39d792138cd0e47565ea62821ab..d0767ebb64714ed13ee6c6eae781e2fc6444d220 100644 --- a/source/Lib/CommonLib/SEI.cpp +++ b/source/Lib/CommonLib/SEI.cpp @@ -149,6 +149,273 @@ void SEIPictureTiming::copyTo (SEIPictureTiming& target) const target.m_vclCpbDelayOffset = m_vclCpbDelayOffset; } +#if JVET_U0082_SDI_MAI_ACI_DRI +bool SEIScalabilityDimensionInfo::isSDISameContent(SEIScalabilityDimensionInfo* sdiB) +{ + if (!sdiB) + { + return false; + } + if (m_sdiNumViews != sdiB->m_sdiNumViews) + { + return false; + } + if (m_sdiMaxLayersMinus1 != sdiB->m_sdiMaxLayersMinus1) + { + return false; + } + if (m_sdiMultiviewInfoFlag != sdiB->m_sdiMultiviewInfoFlag) + { + return false; + } + if (m_sdiAuxiliaryInfoFlag != sdiB->m_sdiAuxiliaryInfoFlag) + { + return false; + } + if (m_sdiMultiviewInfoFlag || m_sdiAuxiliaryInfoFlag) + { + if (m_sdiMultiviewInfoFlag) + { + if (m_sdiViewIdLenMinus1 != sdiB->m_sdiViewIdLenMinus1) + { + return false; + } + } + for (int i = 0; i <= m_sdiMaxLayersMinus1; i++) + { + if (m_sdiMultiviewInfoFlag) + { + if (m_sdiViewIdVal[i] != sdiB->m_sdiViewIdVal[i]) + { + return false; + } + } + if (m_sdiAuxiliaryInfoFlag) + { + if (m_sdiAuxId[i] != sdiB->m_sdiAuxId[i]) + { + return false; + } + if (m_sdiAuxId[i] > 0) + { + if (m_sdiNumAssociatedPrimaryLayersMinus1[i] != sdiB->m_sdiNumAssociatedPrimaryLayersMinus1[i]) + { + return false; + } + for (int j = 0; j <= m_sdiNumAssociatedPrimaryLayersMinus1[i]; j++) + { + if (m_sdiAssociatedPrimaryLayerIdx[i][j] != sdiB->m_sdiAssociatedPrimaryLayerIdx[i][j]) + { + return false; + } + } + } + } + } + } + return true; +} + +uint32_t SEIMultiviewAcquisitionInfo::getMantissaFocalLengthXLen( int i ) const +{ + return xGetSyntaxElementLen( m_maiExponentFocalLengthX[i], m_maiPrecFocalLength, m_maiMantissaFocalLengthX[ i ] ); +} + +uint32_t SEIMultiviewAcquisitionInfo::getMantissaFocalLengthYLen( int i ) const +{ + return xGetSyntaxElementLen( m_maiExponentFocalLengthY[i], m_maiPrecFocalLength, m_maiMantissaFocalLengthY[ i ] ); +} + + +uint32_t SEIMultiviewAcquisitionInfo::getMantissaPrincipalPointXLen( int i ) const +{ + return xGetSyntaxElementLen( m_maiExponentPrincipalPointX[i], m_maiPrecPrincipalPoint, m_maiMantissaPrincipalPointX[ i ] ); +} + +uint32_t SEIMultiviewAcquisitionInfo::getMantissaPrincipalPointYLen( int i ) const +{ + return xGetSyntaxElementLen( m_maiExponentPrincipalPointY[i], m_maiPrecPrincipalPoint, m_maiMantissaPrincipalPointY[ i ] ); +} + +uint32_t SEIMultiviewAcquisitionInfo::getMantissaSkewFactorLen( int i ) const +{ + return xGetSyntaxElementLen( m_maiExponentSkewFactor[ i ], m_maiPrecSkewFactor, m_maiMantissaSkewFactor[ i ] ); +} + +uint32_t SEIMultiviewAcquisitionInfo::getMantissaRLen( int i, int j, int k ) const +{ + return xGetSyntaxElementLen( m_maiExponentR[ i ][ j ][ k ], m_maiPrecRotationParam, m_maiMantissaR[ i ][ j] [ k ] ); +} + +uint32_t SEIMultiviewAcquisitionInfo::getMantissaTLen( int i, int j ) const +{ + return xGetSyntaxElementLen( m_maiExponentT[ i ][ j ], m_maiPrecTranslationParam, m_maiMantissaT[ i ][ j ] ); +} +uint32_t SEIMultiviewAcquisitionInfo::xGetSyntaxElementLen( int expo, int prec, int val ) const +{ + uint32_t len; + if( expo == 0 ) + { + len = std::max(0, prec - 30 ); + } + else + { + len = std::max( 0, expo + prec - 31 ); + } + + assert( val >= 0 ); + assert( val <= ( ( 1 << len )- 1) ); + return len; +} + +bool SEIMultiviewAcquisitionInfo::isMAISameContent(SEIMultiviewAcquisitionInfo *maiB) +{ + if (!maiB) + { + return false; + } + if (m_maiIntrinsicParamFlag != maiB->m_maiIntrinsicParamFlag) + { + return false; + } + if (m_maiExtrinsicParamFlag != maiB->m_maiExtrinsicParamFlag) + { + return false; + } + if (m_maiNumViewsMinus1 != maiB->m_maiNumViewsMinus1) + { + return false; + } + if (m_maiIntrinsicParamFlag) + { + if (m_maiIntrinsicParamsEqualFlag != maiB->m_maiIntrinsicParamsEqualFlag) + { + return false; + } + if (m_maiPrecFocalLength != maiB->m_maiPrecFocalLength) + { + return false; + } + if (m_maiPrecPrincipalPoint != maiB->m_maiPrecPrincipalPoint) + { + return false; + } + if (m_maiPrecSkewFactor != maiB->m_maiPrecSkewFactor) + { + return false; + } + for (int i = 0; i <= (m_maiIntrinsicParamsEqualFlag ? 0 : m_maiNumViewsMinus1); i++) + { + if (m_maiSignFocalLengthX[i] != maiB->m_maiSignFocalLengthX[i]) + { + return false; + } + if (m_maiExponentFocalLengthX[i] != maiB->m_maiExponentFocalLengthX[i]) + { + return false; + } + if (m_maiMantissaFocalLengthX[i] != maiB->m_maiMantissaFocalLengthX[i]) + { + return false; + } + if (m_maiSignFocalLengthY[i] != maiB->m_maiSignFocalLengthY[i]) + { + return false; + } + if (m_maiExponentFocalLengthY[i] != maiB->m_maiExponentFocalLengthY[i]) + { + return false; + } + if (m_maiMantissaFocalLengthY[i] != maiB->m_maiMantissaFocalLengthY[i]) + { + return false; + } + if (m_maiSignPrincipalPointX[i] != maiB->m_maiSignPrincipalPointX[i]) + { + return false; + } + if (m_maiExponentPrincipalPointX[i] != maiB->m_maiExponentPrincipalPointX[i]) + { + return false; + } + if (m_maiMantissaPrincipalPointX[i] != maiB->m_maiMantissaPrincipalPointX[i]) + { + return false; + } + if (m_maiSignPrincipalPointY[i] != maiB->m_maiSignPrincipalPointY[i]) + { + return false; + } + if (m_maiExponentPrincipalPointY[i] != maiB->m_maiExponentPrincipalPointY[i]) + { + return false; + } + if (m_maiMantissaPrincipalPointY[i] != maiB->m_maiMantissaPrincipalPointY[i]) + { + return false; + } + if (m_maiSignSkewFactor[i] != maiB->m_maiSignSkewFactor[i]) + { + return false; + } + if (m_maiExponentSkewFactor[i] != maiB->m_maiExponentSkewFactor[i]) + { + return false; + } + if (m_maiMantissaSkewFactor[i] != maiB->m_maiMantissaSkewFactor[i]) + { + return false; + } + } + } + if (m_maiExtrinsicParamFlag) + { + if (m_maiPrecRotationParam != maiB->m_maiPrecRotationParam) + { + return false; + } + if (m_maiPrecTranslationParam != maiB->m_maiPrecTranslationParam) + { + return false; + } + for (int i = 0; i <= m_maiNumViewsMinus1; i++) + { + for (int j = 0; j < 3; j++) + { + for (int k = 0; k < 3; k++) + { + if (m_maiSignR[i][j][k] != maiB->m_maiSignR[i][j][k]) + { + return false; + } + if (m_maiExponentR[i][j][k] != maiB->m_maiExponentR[i][j][k]) + { + return false; + } + if (m_maiMantissaR[i][j][k] != maiB->m_maiMantissaR[i][j][k]) + { + return false; + } + } + if (m_maiSignT[i][j] != maiB->m_maiSignT[i][j]) + { + return false; + } + if (m_maiExponentT[i][j] != maiB->m_maiExponentT[i][j]) + { + return false; + } + if (m_maiMantissaT[i][j] != maiB->m_maiMantissaT[i][j]) + { + return false; + } + } + } + } + return true; +} +#endif + // Static member const char *SEI::getSEIMessageString(SEI::PayloadType payloadType) { @@ -181,9 +448,17 @@ const char *SEI::getSEIMessageString(SEI::PayloadType payloadType) case SEI::REGION_WISE_PACKING: return "Region wise packing information"; case SEI::OMNI_VIEWPORT: return "Omni viewport"; case SEI::GENERALIZED_CUBEMAP_PROJECTION: return "Generalized cubemap projection"; +#if JVET_U0082_SDI_MAI_ACI_DRI + case SEI::ALPHA_CHANNEL_INFO: return "Alpha channel information"; + case SEI::DEPTH_REPRESENTATION_INFO: return "Depth representation information"; + case SEI::MULTIVIEW_ACQUISITION_INFO: return "Multiview acquisition information"; +#endif case SEI::SAMPLE_ASPECT_RATIO_INFO: return "Sample aspect ratio information"; case SEI::SUBPICTURE_LEVEL_INFO: return "Subpicture level information"; case SEI::ANNOTATED_REGIONS: return "Annotated Region"; +#if JVET_U0082_SDI_MAI_ACI_DRI + case SEI::SCALABILITY_DIMENSION_INFO: return "Scalability dimension information"; +#endif #if JVET_U0084_EDRAP case SEI::EXTENDED_DRAP_INDICATION: return "Extended DRAP indication"; #endif diff --git a/source/Lib/CommonLib/SEI.h b/source/Lib/CommonLib/SEI.h index d30cc9db7f891e34aabc5467c7ddaf0f476dabe0..7c42f62e5fc024ca65315910a015c2fb350cc4ca 100644 --- a/source/Lib/CommonLib/SEI.h +++ b/source/Lib/CommonLib/SEI.h @@ -75,7 +75,16 @@ public: REGION_WISE_PACKING = 155, OMNI_VIEWPORT = 156, GENERALIZED_CUBEMAP_PROJECTION = 153, +#if JVET_U0082_SDI_MAI_ACI_DRI + ALPHA_CHANNEL_INFO = 165, +#endif FRAME_FIELD_INFO = 168, +#if JVET_U0082_SDI_MAI_ACI_DRI + DEPTH_REPRESENTATION_INFO = 177, +#endif +#if JVET_U0082_SDI_MAI_ACI_DRI + MULTIVIEW_ACQUISITION_INFO = 179, +#endif SUBPICTURE_LEVEL_INFO = 203, SAMPLE_ASPECT_RATIO_INFO = 204, CONTENT_LIGHT_LEVEL_INFO = 144, @@ -83,6 +92,9 @@ public: AMBIENT_VIEWING_ENVIRONMENT = 148, CONTENT_COLOUR_VOLUME = 149, ANNOTATED_REGIONS = 202, +#if JVET_U0082_SDI_MAI_ACI_DRI + SCALABILITY_DIMENSION_INFO = 205, +#endif #if JVET_U0084_EDRAP EXTENDED_DRAP_INDICATION = 206, #endif @@ -208,6 +220,189 @@ public: uint8_t m_gcmpGuardBandSamplesMinus1; }; +#if JVET_U0082_SDI_MAI_ACI_DRI +class SEIScalabilityDimensionInfo : public SEI +{ +public: + PayloadType payloadType() const { return SCALABILITY_DIMENSION_INFO; } + SEIScalabilityDimensionInfo() + : m_sdiNumViews (0) + , m_sdiMaxLayersMinus1 (0) + , m_sdiMultiviewInfoFlag (false) + , m_sdiAuxiliaryInfoFlag (false) + , m_sdiViewIdLenMinus1 (0) + { + } + virtual ~SEIScalabilityDimensionInfo() {} + bool isSDISameContent(SEIScalabilityDimensionInfo* sdiB); + + int m_sdiNumViews; + int m_sdiMaxLayersMinus1; + bool m_sdiMultiviewInfoFlag; + bool m_sdiAuxiliaryInfoFlag; + int m_sdiViewIdLenMinus1; + std::vector<int> m_sdiLayerId; + std::vector<int> m_sdiViewIdVal; + std::vector<int> m_sdiAuxId; + std::vector<int> m_sdiNumAssociatedPrimaryLayersMinus1; + std::vector<std::vector<int>> m_sdiAssociatedPrimaryLayerIdx; +}; + +class SEIMultiviewAcquisitionInfo : public SEI +{ +public: + PayloadType payloadType( ) const { return MULTIVIEW_ACQUISITION_INFO; } + SEIMultiviewAcquisitionInfo ( ) { }; + ~SEIMultiviewAcquisitionInfo( ) { }; + SEI* getCopy( ) const { return new SEIMultiviewAcquisitionInfo(*this); }; + bool isMAISameContent(SEIMultiviewAcquisitionInfo* maiB); + + void resizeArrays( ) + { + int numViews = m_maiIntrinsicParamsEqualFlag ? 1 : m_maiNumViewsMinus1 + 1; + m_maiSignFocalLengthX .resize( numViews ); + m_maiExponentFocalLengthX .resize( numViews ); + m_maiMantissaFocalLengthX .resize( numViews ); + m_maiSignFocalLengthY .resize( numViews ); + m_maiExponentFocalLengthY .resize( numViews ); + m_maiMantissaFocalLengthY .resize( numViews ); + m_maiSignPrincipalPointX .resize( numViews ); + m_maiExponentPrincipalPointX.resize( numViews ); + m_maiMantissaPrincipalPointX.resize( numViews ); + m_maiSignPrincipalPointY .resize( numViews ); + m_maiExponentPrincipalPointY.resize( numViews ); + m_maiMantissaPrincipalPointY.resize( numViews ); + m_maiSignSkewFactor .resize( numViews ); + m_maiExponentSkewFactor .resize( numViews ); + m_maiMantissaSkewFactor .resize( numViews ); + + m_maiSignR .resize( m_maiNumViewsMinus1 + 1 ); + m_maiExponentR .resize( m_maiNumViewsMinus1 + 1 ); + m_maiMantissaR .resize( m_maiNumViewsMinus1 + 1 ); + m_maiSignT .resize( m_maiNumViewsMinus1 + 1 ); + m_maiExponentT .resize( m_maiNumViewsMinus1 + 1 ); + m_maiMantissaT .resize( m_maiNumViewsMinus1 + 1 ); + + for( int i = 0; i <= m_maiNumViewsMinus1 ; i++ ) + { + m_maiSignR [i].resize( 3 ); + m_maiExponentR[i].resize( 3 ); + m_maiMantissaR[i].resize( 3 ); + m_maiSignT [i].resize( 3 ); + m_maiExponentT[i].resize( 3 ); + m_maiMantissaT[i].resize( 3 ); + + for (int j = 0; j < 3; j++) + { + m_maiSignR [i][j].resize( 3 ); + m_maiExponentR[i][j].resize( 3 ); + m_maiMantissaR[i][j].resize( 3 ); + } + } + } + + uint32_t getMantissaFocalLengthXLen (int i) const; + uint32_t getMantissaFocalLengthYLen (int i) const; + uint32_t getMantissaPrincipalPointXLen(int i) const; + uint32_t getMantissaPrincipalPointYLen(int i) const; + uint32_t getMantissaSkewFactorLen (int i) const; + uint32_t getMantissaRLen (int i, int j, int k ) const; + uint32_t getMantissaTLen (int i, int j ) const; + + bool m_maiIntrinsicParamFlag; + bool m_maiExtrinsicParamFlag; + int m_maiNumViewsMinus1; + bool m_maiIntrinsicParamsEqualFlag; + int m_maiPrecFocalLength; + int m_maiPrecPrincipalPoint; + int m_maiPrecSkewFactor; + std::vector<bool> m_maiSignFocalLengthX; + std::vector<int> m_maiExponentFocalLengthX; + std::vector<int> m_maiMantissaFocalLengthX; + std::vector<bool> m_maiSignFocalLengthY; + std::vector<int> m_maiExponentFocalLengthY; + std::vector<int> m_maiMantissaFocalLengthY; + std::vector<bool> m_maiSignPrincipalPointX; + std::vector<int> m_maiExponentPrincipalPointX; + std::vector<int> m_maiMantissaPrincipalPointX; + std::vector<bool> m_maiSignPrincipalPointY; + std::vector<int> m_maiExponentPrincipalPointY; + std::vector<int> m_maiMantissaPrincipalPointY; + std::vector<bool> m_maiSignSkewFactor; + std::vector<int> m_maiExponentSkewFactor; + std::vector<int> m_maiMantissaSkewFactor; + int m_maiPrecRotationParam; + int m_maiPrecTranslationParam; + std::vector< std::vector<std::vector<bool>>> m_maiSignR; + std::vector< std::vector<std::vector<int>>> m_maiExponentR; + std::vector< std::vector<std::vector<int>>> m_maiMantissaR; + std::vector< std::vector<bool>> m_maiSignT; + std::vector< std::vector<int>> m_maiExponentT; + std::vector< std::vector<int>> m_maiMantissaT; +private: + uint32_t xGetSyntaxElementLen( int expo, int prec, int val ) const; +}; + +class SEIAlphaChannelInfo : public SEI +{ +public: + PayloadType payloadType() const { return ALPHA_CHANNEL_INFO; } + SEIAlphaChannelInfo() + : m_aciCancelFlag (false) + , m_aciUseIdc (0) + , m_aciBitDepthMinus8 (0) + , m_aciTransparentValue (0) + , m_aciOpaqueValue (255) + , m_aciIncrFlag (false) + , m_aciClipFlag (false) + , m_aciClipTypeFlag (false) + {}; + virtual ~SEIAlphaChannelInfo() {}; + + bool m_aciCancelFlag; + int m_aciUseIdc; + int m_aciBitDepthMinus8; + int m_aciTransparentValue; + int m_aciOpaqueValue; + bool m_aciIncrFlag; + bool m_aciClipFlag; + bool m_aciClipTypeFlag; +}; + +class SEIDepthRepresentationInfo : public SEI +{ +public: + PayloadType payloadType() const { return DEPTH_REPRESENTATION_INFO; } + SEIDepthRepresentationInfo() + : m_driZNearFlag (false) + , m_driZFarFlag (false) + , m_driDMinFlag (false) + , m_driDMaxFlag (false) + , m_driZNear (0.0) + , m_driZFar (0.0) + , m_driDMin (0.0) + , m_driDMax (0.0) + , m_driDepthRepresentationType (0) + , m_driDisparityRefViewId (0) + , m_driDepthNonlinearRepresentationNumMinus1 (0) + {}; + virtual ~SEIDepthRepresentationInfo() {}; + + bool m_driZNearFlag; + bool m_driZFarFlag; + bool m_driDMinFlag; + bool m_driDMaxFlag; + double m_driZNear; + double m_driZFar; + double m_driDMin; + double m_driDMax; + int m_driDepthRepresentationType; + int m_driDisparityRefViewId; + int m_driDepthNonlinearRepresentationNumMinus1; + std::vector<int> m_driDepthNonlinearRepresentationModel; +}; +#endif + class SEISampleAspectRatioInfo : public SEI { public: diff --git a/source/Lib/CommonLib/TypeDef.h b/source/Lib/CommonLib/TypeDef.h index d30447eb19773fdac2ba68076109a6755f46359d..4a3e499a5e68e7f8c8c535ffd983ccee73805e6b 100644 --- a/source/Lib/CommonLib/TypeDef.h +++ b/source/Lib/CommonLib/TypeDef.h @@ -50,6 +50,8 @@ #include <assert.h> #include <cassert> +#define JVET_U0082_SDI_MAI_ACI_DRI 1 // scalability dimension information SEI and other three SEIs: Alpha channel information, Depth representation information, and Multiview acquisition information + #define JVET_U0084_EDRAP 1 // EDRAP indication SEI message #define JVET_V0106_RRC_RICE 1 // JVET_V0106: Extension of the RRC rice derivation for high bit depth profile (VVCv2). diff --git a/source/Lib/DecoderLib/DecLib.cpp b/source/Lib/DecoderLib/DecLib.cpp index 24daa8f62537ef6c55d35c88efd02aa8ebaa5402..dc03f42529129de836e897899d9e25fe3b8b5ad7 100644 --- a/source/Lib/DecoderLib/DecLib.cpp +++ b/source/Lib/DecoderLib/DecLib.cpp @@ -406,6 +406,10 @@ DecLib::DecLib() , m_parameterSetManager() , m_apcSlicePilot(NULL) , m_SEIs() +#if JVET_U0082_SDI_MAI_ACI_DRI + , m_sdiSEIInFirstAU(NULL) + , m_maiSEIInFirstAU(NULL) +#endif , m_cIntraPred() , m_cInterPred() , m_cTrQuant() @@ -1165,6 +1169,10 @@ void DecLib::checkTidLayerIdInAccessUnit() void DecLib::checkSEIInAccessUnit() { +#if JVET_U0082_SDI_MAI_ACI_DRI + bool bSdiPresentInAu = false; + bool bAuxSEIsBeforeSdiSEIPresent[3] = {false, false, false}; +#endif for (auto &sei : m_accessUnitSeiPayLoadTypes) { enum NalUnitType naluType = std::get<0>(sei); @@ -1197,7 +1205,30 @@ void DecLib::checkSEIInAccessUnit() } CHECK(!olsIncludeAllLayersFind, "When there is no OLS that includes all layers in the current CVS in the entire bitstream, there shall be no non-scalable-nested SEI message with payloadType equal to 0 (BP), 1 (PT), 130 (DUI), or 203 (SLI)"); } +#if JVET_U0082_SDI_MAI_ACI_DRI + if (payloadType == SEI::SCALABILITY_DIMENSION_INFO) + { + bSdiPresentInAu = true; + } + else if (payloadType == SEI::MULTIVIEW_ACQUISITION_INFO && !bSdiPresentInAu) + { + bAuxSEIsBeforeSdiSEIPresent[0] = true; + } + else if (payloadType == SEI::ALPHA_CHANNEL_INFO && !bSdiPresentInAu) + { + bAuxSEIsBeforeSdiSEIPresent[1] = true; + } + else if (payloadType == SEI::DEPTH_REPRESENTATION_INFO && !bSdiPresentInAu) + { + bAuxSEIsBeforeSdiSEIPresent[2] = true; + } +#endif } +#if JVET_U0082_SDI_MAI_ACI_DRI + CHECK(bSdiPresentInAu && bAuxSEIsBeforeSdiSEIPresent[0], "When an AU contains both an SDI SEI message and an MAI SEI message, the SDI SEI message shall precede the MAI SEI message in decoding order."); + CHECK(bSdiPresentInAu && bAuxSEIsBeforeSdiSEIPresent[1], "When an AU contains both an SDI SEI message with sdi_aux_id[i] equal to 1 for at least one value of i and an ACI SEI message, the SDI SEI message shall precede the ACI SEI message in decoding order."); + CHECK(bSdiPresentInAu && bAuxSEIsBeforeSdiSEIPresent[2], "When an AU contains both an SDI SEI message with sdi_aux_id[i] equal to 2 for at least one value of i and a DRI SEI message, the SDI SEI message shall precede the DRI SEI message in decoding order."); +#endif } #define SEI_REPETITION_CONSTRAINT_LIST_SIZE 21 @@ -2124,6 +2155,78 @@ void DecLib::xCheckPrefixSEIMessages( SEIMessages& prefixSEIs ) msg( WARNING, "Warning: ffi_display_elemental_periods_minus1 is different in picture timing and frame field information SEI messages!"); } } +#if JVET_U0082_SDI_MAI_ACI_DRI + if ((getVPS()->getMaxLayers() == 1 || m_audIrapOrGdrAuFlag) && (m_isFirstAuInCvs || m_accessUnitPicInfo.begin()->m_nalUnitType == NAL_UNIT_CODED_SLICE_IDR_N_LP || m_accessUnitPicInfo.begin()->m_nalUnitType == NAL_UNIT_CODED_SLICE_IDR_W_RADL || ((m_accessUnitPicInfo.begin()->m_nalUnitType == NAL_UNIT_CODED_SLICE_CRA || m_accessUnitPicInfo.begin()->m_nalUnitType == NAL_UNIT_CODED_SLICE_GDR) && m_lastNoOutputBeforeRecoveryFlag[m_accessUnitPicInfo.begin()->m_nuhLayerId])) && m_accessUnitPicInfo.size() == 1) + { + m_sdiSEIInFirstAU = NULL; + m_maiSEIInFirstAU = NULL; + SEIMessages sdiSEIs = getSeisByType(prefixSEIs, SEI::SCALABILITY_DIMENSION_INFO); + if (!sdiSEIs.empty()) + { + SEIScalabilityDimensionInfo *sdi = (SEIScalabilityDimensionInfo*)sdiSEIs.front(); + m_sdiSEIInFirstAU = new SEIScalabilityDimensionInfo(*sdi); + if (sdiSEIs.size() > 1) + { + for (SEIMessages::const_iterator it=sdiSEIs.begin(); it!=sdiSEIs.end(); it++) + { + CHECK(!m_sdiSEIInFirstAU->isSDISameContent((SEIScalabilityDimensionInfo*)*it), "All SDI SEI messages in a CVS shall have the same content.") + } + } + } + SEIMessages maiSEIs = getSeisByType(prefixSEIs, SEI::MULTIVIEW_ACQUISITION_INFO); + if (!maiSEIs.empty()) + { + SEIMultiviewAcquisitionInfo *mai = (SEIMultiviewAcquisitionInfo*)maiSEIs.front(); + m_maiSEIInFirstAU = new SEIMultiviewAcquisitionInfo(*mai); + if (maiSEIs.size() > 1) + { + for (SEIMessages::const_iterator it=maiSEIs.begin(); it!=maiSEIs.end(); it++) + { + CHECK(!m_maiSEIInFirstAU->isMAISameContent((SEIMultiviewAcquisitionInfo*)*it), "All MAI SEI messages in a CVS shall have the same content.") + } + } + } + } + else + { + SEIMessages sdiSEIs = getSeisByType(prefixSEIs, SEI::SCALABILITY_DIMENSION_INFO); + CHECK(!m_sdiSEIInFirstAU && !sdiSEIs.empty(), "When an SDI SEI message is present in any AU of a CVS, an SDI SEI message shall be present for the first AU of the CVS."); + if (!sdiSEIs.empty()) + { + for (SEIMessages::const_iterator it=sdiSEIs.begin(); it!=sdiSEIs.end(); it++) + { + CHECK(!m_sdiSEIInFirstAU->isSDISameContent((SEIScalabilityDimensionInfo*)*it), "All SDI SEI messages in a CVS shall have the same content.") + } + } + SEIMessages maiSEIs = getSeisByType(prefixSEIs, SEI::MULTIVIEW_ACQUISITION_INFO); + CHECK(!m_maiSEIInFirstAU && !maiSEIs.empty(), "When an MAI SEI message is present in any AU of a CVS, an MAI SEI message shall be present for the first AU of the CVS."); + if (!maiSEIs.empty()) + { + for (SEIMessages::const_iterator it=maiSEIs.begin(); it!=maiSEIs.end(); it++) + { + CHECK(!m_maiSEIInFirstAU->isMAISameContent((SEIMultiviewAcquisitionInfo*)*it), "All MAI SEI messages in a CVS shall have the same content.") + } + } + } + + for (SEIMessages::const_iterator it=prefixSEIs.begin(); it!=prefixSEIs.end(); it++) + { + if ((*it)->payloadType() == SEI::MULTIVIEW_ACQUISITION_INFO) + { + CHECK(!m_sdiSEIInFirstAU, "When a CVS does not contain an SDI SEI message, the CVS shall not contain an MAI SEI message."); + SEIMultiviewAcquisitionInfo *maiSei = (SEIMultiviewAcquisitionInfo*)*it; + CHECK(m_sdiSEIInFirstAU->m_sdiNumViews - 1 != maiSei->m_maiNumViewsMinus1, "The value of num_views_minus1 shall be equal to NumViews - 1"); + } + else if ((*it)->payloadType() == SEI::ALPHA_CHANNEL_INFO) + { + CHECK(!m_sdiSEIInFirstAU, "When a CVS does not contain an SDI SEI message with sdi_aux_id[i] equal to 1 for at least one value of i, no picture in the CVS shall be associated with an ACI SEI message."); + } + else if ((*it)->payloadType() == SEI::DEPTH_REPRESENTATION_INFO) + { + CHECK(!m_sdiSEIInFirstAU, "When a CVS does not contain an SDI SEI message with sdi_aux_id[i] equal to 2 for at least one value of i, no picture in the CVS shall be associated with a DRI SEI message."); + } + } +#endif } void DecLib::xDecodePicHeader( InputNALUnit& nalu ) diff --git a/source/Lib/DecoderLib/DecLib.h b/source/Lib/DecoderLib/DecLib.h index d95f4a7603aac39bc7bf535e3b3ebfe1ae9994fc..95137fbf6696de55044efa51c2116429739240ff 100644 --- a/source/Lib/DecoderLib/DecLib.h +++ b/source/Lib/DecoderLib/DecLib.h @@ -95,6 +95,10 @@ private: SEIMessages m_SEIs; ///< List of SEI messages that have been received before the first slice and between slices, excluding prefix SEIs... +#if JVET_U0082_SDI_MAI_ACI_DRI + SEIScalabilityDimensionInfo* m_sdiSEIInFirstAU; + SEIMultiviewAcquisitionInfo* m_maiSEIInFirstAU; +#endif // functional classes diff --git a/source/Lib/DecoderLib/SEIread.cpp b/source/Lib/DecoderLib/SEIread.cpp index 0105be6725d9d58db03efb7c725b77542a1e1017..67141f6cc5a5f0473b20d5c8c6b6f3637021c054 100644 --- a/source/Lib/DecoderLib/SEIread.cpp +++ b/source/Lib/DecoderLib/SEIread.cpp @@ -284,6 +284,24 @@ void SEIReader::xReadSEImessage(SEIMessages& seis, const NalUnitType nalUnitType sei = new SEIGeneralizedCubemapProjection; xParseSEIGeneralizedCubemapProjection((SEIGeneralizedCubemapProjection&) *sei, payloadSize, pDecodedMessageOutputStream); break; +#if JVET_U0082_SDI_MAI_ACI_DRI + case SEI::SCALABILITY_DIMENSION_INFO: + sei = new SEIScalabilityDimensionInfo; + xParseSEIScalabilityDimensionInfo((SEIScalabilityDimensionInfo&) *sei, payloadSize, pDecodedMessageOutputStream ); + break; + case SEI::MULTIVIEW_ACQUISITION_INFO: + sei = new SEIMultiviewAcquisitionInfo; + xParseSEIMultiviewAcquisitionInfo((SEIMultiviewAcquisitionInfo&) *sei, payloadSize, pDecodedMessageOutputStream ); + break; + case SEI::ALPHA_CHANNEL_INFO: + sei = new SEIAlphaChannelInfo; + xParseSEIAlphaChannelInfo((SEIAlphaChannelInfo&) *sei, payloadSize, pDecodedMessageOutputStream ); + break; + case SEI::DEPTH_REPRESENTATION_INFO: + sei = new SEIDepthRepresentationInfo; + xParseSEIDepthRepresentationInfo((SEIDepthRepresentationInfo&) *sei, payloadSize, pDecodedMessageOutputStream ); + break; +#endif case SEI::SUBPICTURE_LEVEL_INFO: sei = new SEISubpicureLevelInfo; xParseSEISubpictureLevelInfo((SEISubpicureLevelInfo&) *sei, payloadSize, pDecodedMessageOutputStream); @@ -605,6 +623,11 @@ void SEIReader::xCheckScalableNestingConstraints(const SEIScalableNesting& sei, for (auto nestedsei : sei.m_nestedSEIs) { CHECK(nestedsei->payloadType() == SEI::FILLER_PAYLOAD || nestedsei->payloadType() == SEI::SCALABLE_NESTING, "An SEI message that has payloadType equal to filler payload or scalable nesting shall not be contained in a scalable nesting SEI message"); + +#if JVET_U0082_SDI_MAI_ACI_DRI + CHECK(nestedsei->payloadType() == SEI::SCALABILITY_DIMENSION_INFO, "A scalability dimension information SEI message shall not be contained in a scalable nesting SEI message"); + CHECK(nestedsei->payloadType() == SEI::MULTIVIEW_ACQUISITION_INFO, "A multiview acquisition information SEI message shall not be contained in a scalable nesting SEI message"); +#endif CHECK(nestedsei->payloadType() != SEI::FILLER_PAYLOAD && nestedsei->payloadType() != SEI::DECODED_PICTURE_HASH && nalUnitType != NAL_UNIT_PREFIX_SEI, "When a scalable nesting SEI message contains an SEI message that has payloadType not equal to filler payload or decoded picture hash, the SEI NAL unit containing the scalable nesting SEI message shall have nal_unit_type equal to PREFIX_SEI_NUT"); @@ -1563,6 +1586,233 @@ void SEIReader::xParseSEIGeneralizedCubemapProjection(SEIGeneralizedCubemapProje } } +#if JVET_U0082_SDI_MAI_ACI_DRI +void SEIReader::xParseSEIScalabilityDimensionInfo(SEIScalabilityDimensionInfo& sei, uint32_t payloadSize, std::ostream *pDecodedMessageOutputStream) +{ + output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize); + uint32_t val; + sei_read_code( pDecodedMessageOutputStream, 6, val, "sdi_max_layers_minus1" ); sei.m_sdiMaxLayersMinus1 = val; + sei_read_flag( pDecodedMessageOutputStream, val, "sdi_multiview_info_flag" ); sei.m_sdiMultiviewInfoFlag = val; + sei_read_flag( pDecodedMessageOutputStream, val, "sdi_auxiliary_info_flag" ); sei.m_sdiAuxiliaryInfoFlag = val; + if (sei.m_sdiMultiviewInfoFlag || sei.m_sdiAuxiliaryInfoFlag) + { + if (sei.m_sdiMultiviewInfoFlag) + { + sei_read_code( pDecodedMessageOutputStream, 4, val, "sdi_view_id_len_minus1" ); sei.m_sdiViewIdLenMinus1 = val; + } + for (int i = 0; i <= sei.m_sdiMaxLayersMinus1; i++) + { + sei.m_sdiLayerId.resize(sei.m_sdiViewIdLenMinus1 + 1); + sei_read_code( pDecodedMessageOutputStream, 6, val, "sdi_layer_id" ); sei.m_sdiLayerId[i] = val; + if (sei.m_sdiMultiviewInfoFlag) + { + sei.m_sdiViewIdVal.resize(sei.m_sdiViewIdLenMinus1 + 1); + sei_read_code( pDecodedMessageOutputStream, sei.m_sdiViewIdLenMinus1 + 1, val, "sdi_view_id_val" ); sei.m_sdiViewIdVal[i] = val; + } + if (sei.m_sdiAuxiliaryInfoFlag) + { + sei.m_sdiAuxId.resize(sei.m_sdiViewIdLenMinus1 + 1); + sei.m_sdiNumAssociatedPrimaryLayersMinus1.resize(sei.m_sdiViewIdLenMinus1 + 1); + sei.m_sdiAssociatedPrimaryLayerIdx.resize(sei.m_sdiViewIdLenMinus1 + 1); + sei_read_code( pDecodedMessageOutputStream, 8, val, "sdi_aux_id" ); sei.m_sdiAuxId[i] = val; + if (sei.m_sdiAuxId[i] > 0) + { + sei_read_code( pDecodedMessageOutputStream, 6, val, "sdi_num_associated_primary_layers_minus1" ); sei.m_sdiNumAssociatedPrimaryLayersMinus1[i] = val; + sei.m_sdiAssociatedPrimaryLayerIdx[i].resize(sei.m_sdiNumAssociatedPrimaryLayersMinus1[i] + 1); + for (int j = 0; j <= sei.m_sdiNumAssociatedPrimaryLayersMinus1[i]; j++) + { + sei_read_code( pDecodedMessageOutputStream, 6, val, "sdi_associated_primary_layer_idx" ); + sei.m_sdiAssociatedPrimaryLayerIdx[i][j] = val; + } + } + } + } + sei.m_sdiNumViews = 1; + if (sei.m_sdiMultiviewInfoFlag) + { + for (int i = 1; i <= sei.m_sdiMaxLayersMinus1; i++) + { + bool newViewFlag = true; + for (int j = 0; j < i; j++) + { + if (sei.m_sdiViewIdVal[i] == sei.m_sdiViewIdVal[j]) + newViewFlag = false; + } + if (newViewFlag) + sei.m_sdiNumViews++; + } + } + } +} + +void SEIReader::xParseSEIMultiviewAcquisitionInfo(SEIMultiviewAcquisitionInfo& sei, uint32_t payloadSize, std::ostream *pDecodedMessageOutputStream) +{ + output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize); + uint32_t val; + + sei_read_flag( pDecodedMessageOutputStream, val, "intrinsic_param_flag" ); sei.m_maiIntrinsicParamFlag = (val == 1); + sei_read_flag( pDecodedMessageOutputStream, val, "extrinsic_param_flag" ); sei.m_maiExtrinsicParamFlag = (val == 1); + sei_read_uvlc( pDecodedMessageOutputStream, val, "num_views_minus1" ); sei.m_maiNumViewsMinus1 = val ; + sei.resizeArrays( ); + if( sei.m_maiIntrinsicParamFlag ) + { + sei_read_flag( pDecodedMessageOutputStream, val, "intrinsic_params_equal_flag" ); sei.m_maiIntrinsicParamsEqualFlag = (val == 1); + sei_read_uvlc( pDecodedMessageOutputStream, val, "prec_focal_length" ); sei.m_maiPrecFocalLength = val ; + sei_read_uvlc( pDecodedMessageOutputStream, val, "prec_principal_point" ); sei.m_maiPrecPrincipalPoint = val ; + sei_read_uvlc( pDecodedMessageOutputStream, val, "prec_skew_factor" ); sei.m_maiPrecSkewFactor = val ; + + for( int i = 0; i <= ( sei.m_maiIntrinsicParamsEqualFlag ? 0 : sei.m_maiNumViewsMinus1 ); i++ ) + { + sei_read_flag( pDecodedMessageOutputStream, val, "sign_focal_length_x" ); sei.m_maiSignFocalLengthX [i] = (val == 1); + sei_read_code( pDecodedMessageOutputStream, 6, val, "exponent_focal_length_x" ); sei.m_maiExponentFocalLengthX [i] = val ; + sei_read_code( pDecodedMessageOutputStream, sei.getMantissaFocalLengthXLen ( i ), val, "mantissa_focal_length_x" ); sei.m_maiMantissaFocalLengthX [i] = val ; + sei_read_flag( pDecodedMessageOutputStream, val, "sign_focal_length_y" ); sei.m_maiSignFocalLengthY [i] = (val == 1); + sei_read_code( pDecodedMessageOutputStream, 6, val, "exponent_focal_length_y" ); sei.m_maiExponentFocalLengthY [i] = val ; + sei_read_code( pDecodedMessageOutputStream, sei.getMantissaFocalLengthYLen ( i ), val, "mantissa_focal_length_y" ); sei.m_maiMantissaFocalLengthY [i] = val ; + sei_read_flag( pDecodedMessageOutputStream, val, "sign_principal_point_x" ); sei.m_maiSignPrincipalPointX [i] = (val == 1); + sei_read_code( pDecodedMessageOutputStream, 6, val, "exponent_principal_point_x" ); sei.m_maiExponentPrincipalPointX[i] = val ; + sei_read_code( pDecodedMessageOutputStream, sei.getMantissaPrincipalPointXLen( i ), val, "mantissa_principal_point_x" ); sei.m_maiMantissaPrincipalPointX[i] = val ; + sei_read_flag( pDecodedMessageOutputStream, val, "sign_principal_point_y" ); sei.m_maiSignPrincipalPointY [i] = (val == 1); + sei_read_code( pDecodedMessageOutputStream, 6, val, "exponent_principal_point_y" ); sei.m_maiExponentPrincipalPointY[i] = val ; + sei_read_code( pDecodedMessageOutputStream, sei.getMantissaPrincipalPointYLen( i ), val, "mantissa_principal_point_y" ); sei.m_maiMantissaPrincipalPointY[i] = val ; + sei_read_flag( pDecodedMessageOutputStream, val, "sign_skew_factor" ); sei.m_maiSignSkewFactor [i] = (val == 1); + sei_read_code( pDecodedMessageOutputStream, 6, val, "exponent_skew_factor" ); sei.m_maiExponentSkewFactor [i] = val ; + sei_read_code( pDecodedMessageOutputStream, sei.getMantissaSkewFactorLen ( i ), val, "mantissa_skew_factor" ); sei.m_maiMantissaSkewFactor [i] = val ; + } + } + if( sei.m_maiExtrinsicParamFlag ) + { + sei_read_uvlc( pDecodedMessageOutputStream, val, "prec_rotation_param" ); sei.m_maiPrecRotationParam = val; + sei_read_uvlc( pDecodedMessageOutputStream, val, "prec_translation_param" ); sei.m_maiPrecTranslationParam = val; + + for( int i = 0; i <= sei.m_maiNumViewsMinus1; i++ ) + { + for( int j = 0; j <= 2; j++ ) /* row */ + { + for( int k = 0; k <= 2; k++ ) /* column */ + { + sei_read_flag( pDecodedMessageOutputStream, val, "sign_r" ); sei.m_maiSignR [i][j][k] = (val == 1); + sei_read_code( pDecodedMessageOutputStream, 6, val, "exponent_r" ); sei.m_maiExponentR[i][j][k] = val ; + sei_read_code( pDecodedMessageOutputStream, sei.getMantissaRLen( i, j, k ), val, "mantissa_r" ); sei.m_maiMantissaR[i][j][k] = val ; + } + sei_read_flag( pDecodedMessageOutputStream, val, "sign_t" ); sei.m_maiSignT [i][j] = (val == 1); + sei_read_code( pDecodedMessageOutputStream, 6, val, "exponent_t" ); sei.m_maiExponentT[i][j] = val ; + sei_read_code( pDecodedMessageOutputStream, sei.getMantissaTLen( i, j ), val, "mantissa_t" ); sei.m_maiMantissaT[i][j] = val ; + } + } + } +}; + +void SEIReader::xParseSEIAlphaChannelInfo(SEIAlphaChannelInfo& sei, uint32_t payloadSize, std::ostream *pDecodedMessageOutputStream) +{ + uint32_t val; + output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize); + + sei_read_flag( pDecodedMessageOutputStream, val, "alpha_channel_cancel_flag" ); sei.m_aciCancelFlag = (val == 1); + if( !sei.m_aciCancelFlag ) + { + sei_read_code( pDecodedMessageOutputStream, 3, val, "alpha_channel_use_idc" ); sei.m_aciUseIdc = val; + sei_read_code( pDecodedMessageOutputStream, 3, val, "alpha_channel_bit_depth_minus8" ); sei.m_aciBitDepthMinus8 = val; + sei_read_code( pDecodedMessageOutputStream, sei.m_aciBitDepthMinus8 + 9, val, "alpha_transparent_value" ); sei.m_aciTransparentValue = val; + sei_read_code( pDecodedMessageOutputStream, sei.m_aciBitDepthMinus8 + 9, val, "alpha_opaque_value" ); sei.m_aciOpaqueValue = val; + sei_read_flag( pDecodedMessageOutputStream, val, "alpha_channel_incr_flag" ); sei.m_aciIncrFlag = (val == 1); + sei_read_flag( pDecodedMessageOutputStream, val, "alpha_channel_clip_flag" ); sei.m_aciClipFlag = (val == 1); + if( sei.m_aciClipFlag ) + { + sei_read_flag( pDecodedMessageOutputStream, val, "alpha_channel_clip_type_flag" ); sei.m_aciClipTypeFlag = (val == 1); + } + } +}; + +void SEIReader::xParseSEIDepthRepresentationInfo(SEIDepthRepresentationInfo& sei, uint32_t payloadSize, std::ostream *pDecodedMessageOutputStream) +{ + uint32_t val; + double zNear,zFar,dMin,dMax; + std::vector<int> DepthNonlinearRepresentationModel; + + output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize); + + sei_read_flag( pDecodedMessageOutputStream, val, "z_near_flag" ); sei.m_driZNearFlag = (val == 1); + sei_read_flag( pDecodedMessageOutputStream, val, "z_far_flag" ); sei.m_driZFarFlag = (val == 1); + sei_read_flag( pDecodedMessageOutputStream, val, "d_min_flag" ); sei.m_driDMinFlag = (val == 1); + sei_read_flag( pDecodedMessageOutputStream, val, "d_max_flag" ); sei.m_driDMaxFlag = (val == 1); + sei_read_uvlc( pDecodedMessageOutputStream, val, "depth_representation_type" ); sei.m_driDepthRepresentationType = val; + if( sei.m_driDMinFlag || sei.m_driDMaxFlag ) + { + sei_read_uvlc( pDecodedMessageOutputStream, val, "disparity_ref_view_id" ); sei.m_driDisparityRefViewId = val; + } + if( sei.m_driZNearFlag ) + { + xParseSEIDepthRepInfoElement(zNear, pDecodedMessageOutputStream); + sei.m_driZNear = zNear; + } + if( sei.m_driZFarFlag ) + { + xParseSEIDepthRepInfoElement(zFar, pDecodedMessageOutputStream); + sei.m_driZFar = zFar; + } + if( sei.m_driDMinFlag ) + { + xParseSEIDepthRepInfoElement(dMin, pDecodedMessageOutputStream); + sei.m_driDMin = dMin; + } + if( sei.m_driDMaxFlag ) + { + xParseSEIDepthRepInfoElement(dMax, pDecodedMessageOutputStream); + sei.m_driDMax = dMax; + } + + if( sei.m_driDepthRepresentationType == 3 ) + { + sei_read_uvlc( pDecodedMessageOutputStream, val, "depth_nonlinear_representation_num_minus1" ); sei.m_driDepthNonlinearRepresentationNumMinus1 = val; + for( int i = 1; i <= sei.m_driDepthNonlinearRepresentationNumMinus1 + 1; i++ ) + { + sei_read_uvlc(pDecodedMessageOutputStream,val,"DepthNonlinearRepresentationModel" ) ; + sei.m_driDepthNonlinearRepresentationModel.push_back(val); + } + } +} + +void SEIReader::xParseSEIDepthRepInfoElement(double& f,std::ostream *pDecodedMessageOutputStream) +{ + uint32_t val; + uint32_t x_sign,x_mantissa_len,x_mantissa; + int x_exp; + + sei_read_flag(pDecodedMessageOutputStream, val,"da_sign_flag"); x_sign = val ? 1 : 0 ; + sei_read_code(pDecodedMessageOutputStream, 7, val, "da_exponent" ); x_exp = val-31; + sei_read_code(pDecodedMessageOutputStream, 5, val, "da_mantissa_len_minus1" ); x_mantissa_len = val+1; + sei_read_code(pDecodedMessageOutputStream, x_mantissa_len, val, "da_mantissa" ); x_mantissa = val; + if (x_mantissa_len>=16) + { + f =1.0 + (x_mantissa*1.0)/(1u<<(x_mantissa_len-16))/(256.0*256.0 ); + }else + { + f =1.0 + (x_mantissa*1.0)/(1u<<x_mantissa_len); + } + double m=1.0; + int i; + if (x_exp<0) + { + for(i=0;i<-x_exp;i++) + m = m * 2; + + f = f/m; + } + else + { + for(i=0;i<x_exp;i++) + m = m * 2; + + f= f * m; + } + if (x_sign==1) + { + f= -f; + } +}; +#endif + void SEIReader::xParseSEISubpictureLevelInfo(SEISubpicureLevelInfo& sei, uint32_t payloadSize, std::ostream *pDecodedMessageOutputStream) { output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize); diff --git a/source/Lib/DecoderLib/SEIread.h b/source/Lib/DecoderLib/SEIread.h index 191db398ed5a6ebc27f398f9c213d04ca918eaf3..3efec65081bfc21cf669e908b9312a11a090b026 100644 --- a/source/Lib/DecoderLib/SEIread.h +++ b/source/Lib/DecoderLib/SEIread.h @@ -83,6 +83,13 @@ protected: void xParseSEIOmniViewport (SEIOmniViewport& sei, uint32_t payloadSize, std::ostream *pDecodedMessageOutputStream); void xParseSEIRegionWisePacking (SEIRegionWisePacking& sei, uint32_t payloadSize, std::ostream *pDecodedMessageOutputStream); void xParseSEIGeneralizedCubemapProjection (SEIGeneralizedCubemapProjection &sei, uint32_t payloadSize, std::ostream *pDecodedMessageOutputStream); +#if JVET_U0082_SDI_MAI_ACI_DRI + void xParseSEIScalabilityDimensionInfo (SEIScalabilityDimensionInfo& sei, uint32_t payloadSize, std::ostream *pDecodedMessageOutputStream); + void xParseSEIMultiviewAcquisitionInfo (SEIMultiviewAcquisitionInfo& sei, uint32_t payloadSize, std::ostream *pDecodedMessageOutputStream); + void xParseSEIAlphaChannelInfo (SEIAlphaChannelInfo& sei, uint32_t payloadSize, std::ostream *pDecodedMessageOutputStream); + void xParseSEIDepthRepresentationInfo (SEIDepthRepresentationInfo& sei, uint32_t payloadSize, std::ostream *pDecodedMessageOutputStream); + void xParseSEIDepthRepInfoElement (double &f,std::ostream *pDecodedMessageOutputStream); +#endif void xParseSEISubpictureLevelInfo (SEISubpicureLevelInfo& sei, uint32_t payloadSize, std::ostream *pDecodedMessageOutputStream); void xParseSEISampleAspectRatioInfo (SEISampleAspectRatioInfo& sei, uint32_t payloadSize, std::ostream *pDecodedMessageOutputStream); void xParseSEIUserDataRegistered (SEIUserDataRegistered& sei, uint32_t payloadSize, std::ostream *pDecodedMessageOutputStream); diff --git a/source/Lib/EncoderLib/EncCfg.h b/source/Lib/EncoderLib/EncCfg.h index 3a65c925aeeeb9da1d57d552c7f787e456a223fe..b5268b8db5fe7360d4ba03b1d3130e0e9323850e 100644 --- a/source/Lib/EncoderLib/EncCfg.h +++ b/source/Lib/EncoderLib/EncCfg.h @@ -673,6 +673,68 @@ protected: double m_ccvSEIMinLuminanceValue; double m_ccvSEIMaxLuminanceValue; double m_ccvSEIAvgLuminanceValue; +#if JVET_U0082_SDI_MAI_ACI_DRI + // sdi sei + bool m_sdiSEIEnabled; + int m_sdiSEIMaxLayersMinus1; + bool m_sdiSEIMultiviewInfoFlag; + bool m_sdiSEIAuxiliaryInfoFlag; + int m_sdiSEIViewIdLenMinus1; + std::vector<uint32_t> m_sdiSEILayerId; + std::vector<uint32_t> m_sdiSEIViewIdVal; + std::vector<uint32_t> m_sdiSEIAuxId; + std::vector<uint32_t> m_sdiSEINumAssociatedPrimaryLayersMinus1; + // mai sei + bool m_maiSEIEnabled; + bool m_maiSEIIntrinsicParamFlag; + bool m_maiSEIExtrinsicParamFlag; + int m_maiSEINumViewsMinus1; + bool m_maiSEIIntrinsicParamsEqualFlag; + int m_maiSEIPrecFocalLength; + int m_maiSEIPrecPrincipalPoint; + int m_maiSEIPrecSkewFactor; + std::vector<bool> m_maiSEISignFocalLengthX; + std::vector<uint32_t> m_maiSEIExponentFocalLengthX; + std::vector<uint32_t> m_maiSEIMantissaFocalLengthX; + std::vector<bool> m_maiSEISignFocalLengthY; + std::vector<uint32_t> m_maiSEIExponentFocalLengthY; + std::vector<uint32_t> m_maiSEIMantissaFocalLengthY; + std::vector<bool> m_maiSEISignPrincipalPointX; + std::vector<uint32_t> m_maiSEIExponentPrincipalPointX; + std::vector<uint32_t> m_maiSEIMantissaPrincipalPointX; + std::vector<bool> m_maiSEISignPrincipalPointY; + std::vector<uint32_t> m_maiSEIExponentPrincipalPointY; + std::vector<uint32_t> m_maiSEIMantissaPrincipalPointY; + std::vector<bool> m_maiSEISignSkewFactor; + std::vector<uint32_t> m_maiSEIExponentSkewFactor; + std::vector<uint32_t> m_maiSEIMantissaSkewFactor; + int m_maiSEIPrecRotationParam; + int m_maiSEIPrecTranslationParam; + // aci sei + bool m_aciSEIEnabled; + bool m_aciSEICancelFlag; + int m_aciSEIUseIdc; + int m_aciSEIBitDepthMinus8; + int m_aciSEITransparentValue; + int m_aciSEIOpaqueValue; + bool m_aciSEIIncrFlag; + bool m_aciSEIClipFlag; + bool m_aciSEIClipTypeFlag; + // dri sei + bool m_driSEIEnabled; + bool m_driSEIZNearFlag; + bool m_driSEIZFarFlag; + bool m_driSEIDMinFlag; + bool m_driSEIDMaxFlag; + double m_driSEIZNear; + double m_driSEIZFar; + double m_driSEIDMin; + double m_driSEIDMax; + int m_driSEIDepthRepresentationType; + int m_driSEIDisparityRefViewId; + int m_driSEINonlinearNumMinus1; + std::vector<uint32_t> m_driSEINonlinearModel; +#endif std::string m_arSEIFileRoot; // Annotated region SEI - initialized from external file //====== Weighted Prediction ======== bool m_useWeightedPred; //< Use of Weighting Prediction (P_SLICE) @@ -1817,6 +1879,124 @@ public: double getCcvSEIMaxLuminanceValue () { return m_ccvSEIMaxLuminanceValue; } void setCcvSEIAvgLuminanceValue (double dValue) { m_ccvSEIAvgLuminanceValue = dValue; } double getCcvSEIAvgLuminanceValue () { return m_ccvSEIAvgLuminanceValue; } +#if JVET_U0082_SDI_MAI_ACI_DRI + // scalability dimension information SEI + void setSdiSEIEnabled(bool b) { m_sdiSEIEnabled = b; } + bool getSdiSEIEnabled() const { return m_sdiSEIEnabled; } + void setSdiSEIMaxLayersMinus1(int i) { m_sdiSEIMaxLayersMinus1 = i; } + int getSdiSEIMaxLayersMinus1() const { return m_sdiSEIMaxLayersMinus1; } + void setSdiSEIMultiviewInfoFlag(bool b) { m_sdiSEIMultiviewInfoFlag = b; } + bool getSdiSEIMultiviewInfoFlag() const { return m_sdiSEIMultiviewInfoFlag; } + void setSdiSEIAuxiliaryInfoFlag(bool b) { m_sdiSEIAuxiliaryInfoFlag = b; } + bool getSdiSEIAuxiliaryInfoFlag() const { return m_sdiSEIAuxiliaryInfoFlag; } + void setSdiSEIViewIdLenMinus1(int i) { m_sdiSEIViewIdLenMinus1 = i; } + int getSdiSEIViewIdLenMinus1() const { return m_sdiSEIViewIdLenMinus1; } + void setSdiSEILayerId(const std::vector<uint32_t>& sdiSEILayerId) { m_sdiSEILayerId = sdiSEILayerId; } + uint32_t getSdiSEILayerId(int idx) const { return m_sdiSEILayerId[idx]; } + void setSdiSEIViewIdVal(const std::vector<uint32_t>& sdiSEIViewIdVal) { m_sdiSEIViewIdVal = sdiSEIViewIdVal; } + uint32_t getSdiSEIViewIdVal(int idx) const { return m_sdiSEIViewIdVal[idx]; } + void setSdiSEIAuxId(const std::vector<uint32_t>& sdiSEIAuxId) { m_sdiSEIAuxId = sdiSEIAuxId; } + uint32_t getSdiSEIAuxId(int idx) const { return m_sdiSEIAuxId[idx]; } + void setSdiSEINumAssociatedPrimaryLayersMinus1(const std::vector<uint32_t>& sdiSEINumAssociatedPrimaryLayersMinus1) { m_sdiSEINumAssociatedPrimaryLayersMinus1 = sdiSEINumAssociatedPrimaryLayersMinus1; } + uint32_t getSdiSEINumAssociatedPrimaryLayersMinus1(int idx) const { return m_sdiSEINumAssociatedPrimaryLayersMinus1[idx]; } + // multiview acquisition information SEI + void setMaiSEIEnabled(bool b) { m_maiSEIEnabled = b; } + bool getMaiSEIEnabled() const { return m_maiSEIEnabled; } + void setMaiSEIIntrinsicParamFlag(bool b) { m_maiSEIIntrinsicParamFlag = b; } + bool getMaiSEIIntrinsicParamFlag() const { return m_maiSEIIntrinsicParamFlag; } + void setMaiSEIExtrinsicParamFlag(bool b) { m_maiSEIExtrinsicParamFlag = b; } + bool getMaiSEIExtrinsicParamFlag() const { return m_maiSEIExtrinsicParamFlag; } + void setMaiSEINumViewsMinus1(int i) { m_maiSEINumViewsMinus1 = i; } + int getMaiSEINumViewsMinus1() const { return m_maiSEINumViewsMinus1; } + void setMaiSEIIntrinsicParamsEqualFlag(bool b) { m_maiSEIIntrinsicParamsEqualFlag = b; } + bool getMaiSEIIntrinsicParamsEqualFlag() const { return m_maiSEIIntrinsicParamsEqualFlag; } + void setMaiSEIPrecFocalLength(int i) { m_maiSEIPrecFocalLength= i; } + int getMaiSEIPrecFocalLength() const { return m_maiSEIPrecFocalLength; } + void setMaiSEIPrecPrincipalPoint(int i) { m_maiSEIPrecPrincipalPoint = i; } + int getMaiSEIPrecPrincipalPoint() const { return m_maiSEIPrecPrincipalPoint; } + void setMaiSEIPrecSkewFactor(int i) { m_maiSEIPrecSkewFactor = i; } + int getMaiSEIPrecSkewFactor() const { return m_maiSEIPrecSkewFactor; } + void setMaiSEISignFocalLengthX(const std::vector<bool>& maiSEISignFocalLengthX) { m_maiSEISignFocalLengthX = maiSEISignFocalLengthX; } + bool getMaiSEISignFocalLengthX(int idx) const { return m_maiSEISignFocalLengthX[idx]; } + void setMaiSEIExponentFocalLengthX(const std::vector<uint32_t>& maiSEIExponentFocalLengthX) { m_maiSEIExponentFocalLengthX = maiSEIExponentFocalLengthX; } + uint32_t getMaiSEIExponentFocalLengthX(int idx) const { return m_maiSEIExponentFocalLengthX[idx]; } + void setMaiSEIMantissaFocalLengthX(const std::vector<uint32_t>& maiSEIMantissaFocalLengthX) { m_maiSEIMantissaFocalLengthX = maiSEIMantissaFocalLengthX; } + uint32_t getMaiSEIMantissaFocalLengthX(int idx) const { return m_maiSEIMantissaFocalLengthX[idx]; } + void setMaiSEISignFocalLengthY(const std::vector<bool>& maiSEISignFocalLengthY) { m_maiSEISignFocalLengthY = maiSEISignFocalLengthY; } + bool getMaiSEISignFocalLengthY(int idx) const { return m_maiSEISignFocalLengthY[idx]; } + void setMaiSEIExponentFocalLengthY(const std::vector<uint32_t>& maiSEIExponentFocalLengthY) { m_maiSEIExponentFocalLengthY = maiSEIExponentFocalLengthY; } + uint32_t getMaiSEIExponentFocalLengthY(int idx) const { return m_maiSEIExponentFocalLengthY[idx]; } + void setMaiSEIMantissaFocalLengthY(const std::vector<uint32_t>& maiSEIMantissaFocalLengthY) { m_maiSEIMantissaFocalLengthY = maiSEIMantissaFocalLengthY; } + uint32_t getMaiSEIMantissaFocalLengthY(int idx) const { return m_maiSEIMantissaFocalLengthY[idx]; } + void setMaiSEISignPrincipalPointX(const std::vector<bool>& maiSEISignPrincipalPointX) { m_maiSEISignPrincipalPointX = maiSEISignPrincipalPointX; } + bool getMaiSEISignPrincipalPointX(int idx) const { return m_maiSEISignPrincipalPointX[idx]; } + void setMaiSEIExponentPrincipalPointX(const std::vector<uint32_t>& maiSEIExponentPrincipalPointX) { m_maiSEIExponentPrincipalPointX = maiSEIExponentPrincipalPointX; } + uint32_t getMaiSEIExponentPrincipalPointX(int idx) const { return m_maiSEIExponentPrincipalPointX[idx]; } + void setMaiSEIMantissaPrincipalPointX(const std::vector<uint32_t>& maiSEIMantissaPrincipalPointX) { m_maiSEIMantissaPrincipalPointX = maiSEIMantissaPrincipalPointX; } + uint32_t getMaiSEIMantissaPrincipalPointX(int idx) const { return m_maiSEIMantissaPrincipalPointX[idx]; } + void setMaiSEISignPrincipalPointY(const std::vector<bool>& maiSEISignPrincipalPointY) { m_maiSEISignPrincipalPointY = maiSEISignPrincipalPointY; } + bool getMaiSEISignPrincipalPointY(int idx) const { return m_maiSEISignPrincipalPointY[idx]; } + void setMaiSEIExponentPrincipalPointY(const std::vector<uint32_t>& maiSEIExponentPrincipalPointY) { m_maiSEIExponentPrincipalPointY = maiSEIExponentPrincipalPointY; } + uint32_t getMaiSEIExponentPrincipalPointY(int idx) const { return m_maiSEIExponentPrincipalPointY[idx]; } + void setMaiSEIMantissaPrincipalPointY(const std::vector<uint32_t>& maiSEIMantissaPrincipalPointY) { m_maiSEIMantissaPrincipalPointY = maiSEIMantissaPrincipalPointY; } + uint32_t getMaiSEIMantissaPrincipalPointY(int idx) const { return m_maiSEIMantissaPrincipalPointY[idx]; } + void setMaiSEISignSkewFactor(const std::vector<bool>& maiSEISignSkewFactor) { m_maiSEISignSkewFactor = maiSEISignSkewFactor; } + bool getMaiSEISignSkewFactor(int idx) const { return m_maiSEISignSkewFactor[idx]; } + void setMaiSEIExponentSkewFactor(const std::vector<uint32_t>& maiSEIExponentSkewFactor) { m_maiSEIExponentSkewFactor = maiSEIExponentSkewFactor; } + uint32_t getMaiSEIExponentSkewFactor(int idx) const { return m_maiSEIExponentSkewFactor[idx]; } + void setMaiSEIMantissaSkewFactor(const std::vector<uint32_t>& maiSEIMantissaSkewFactor) { m_maiSEIMantissaSkewFactor = maiSEIMantissaSkewFactor; } + uint32_t getMaiSEIMantissaSkewFactor(int idx) const { return m_maiSEIMantissaSkewFactor[idx]; } + void setMaiSEIPrecRotationParam(int i) { m_maiSEIPrecRotationParam = i; } + int getMaiSEIPrecRotationParam() const { return m_maiSEIPrecRotationParam; } + void setMaiSEIPrecTranslationParam(int i) { m_maiSEIPrecTranslationParam = i; } + int getMaiSEIPrecTranslationParam() const { return m_maiSEIPrecTranslationParam; } + // alpha channel information SEI + void setAciSEIEnabled(bool b) { m_aciSEIEnabled = b; } + bool getAciSEIEnabled() const { return m_aciSEIEnabled; } + void setAciSEICancelFlag(bool b) { m_aciSEICancelFlag = b; } + bool getAciSEICancelFlag() const { return m_aciSEICancelFlag; } + void setAciSEIUseIdc(int value) { m_aciSEIUseIdc = value; } + int getAciSEIUseIdc() const { return m_aciSEIUseIdc; } + void setAciSEIBitDepthMinus8(int value) { m_aciSEIBitDepthMinus8 = value; } + int getAciSEIBitDepthMinus8() const { return m_aciSEIBitDepthMinus8; } + void setAciSEITransparentValue(int value) { m_aciSEITransparentValue = value; } + int getAciSEITransparentValue() const { return m_aciSEITransparentValue; } + void setAciSEIOpaqueValue(int value) { m_aciSEIOpaqueValue = value; } + int getAciSEIOpaqueValue() const { return m_aciSEIOpaqueValue; } + void setAciSEIIncrFlag(bool b) { m_aciSEIIncrFlag = b; } + bool getAciSEIIncrFlag() const { return m_aciSEIIncrFlag; } + void setAciSEIClipFlag(bool b) { m_aciSEIClipFlag = b; } + bool getAciSEIClipFlag() const { return m_aciSEIClipFlag; } + void setAciSEIClipTypeFlag(bool b) { m_aciSEIClipTypeFlag = b; } + bool getAciSEIClipTypeFlag() const { return m_aciSEIClipTypeFlag; } + // depth representation information SEI + void setDriSEIEnabled(bool b) { m_driSEIEnabled = b; } + bool getDriSEIEnabled() const { return m_driSEIEnabled; } + void setDriSEIZNearFlag(bool b) { m_driSEIZNearFlag = b; } + bool getDriSEIZNearFlag() const { return m_driSEIZNearFlag; } + void setDriSEIZFarFlag(bool b) { m_driSEIZFarFlag = b; } + bool getDriSEIZFarFlag() const { return m_driSEIZFarFlag; } + void setDriSEIDMinFlag(bool b) { m_driSEIDMinFlag = b; } + bool getDriSEIDMinFlag() const { return m_driSEIDMinFlag; } + void setDriSEIDMaxFlag(bool b) { m_driSEIDMaxFlag = b; } + bool getDriSEIDMaxFlag() const { return m_driSEIDMaxFlag; } + void setDriSEIZNear(double d) { m_driSEIZNear = d; } + double getDriSEIZNear() const { return m_driSEIZNear; } + void setDriSEIZFar(double d) { m_driSEIZFar = d; } + double getDriSEIZFar() const { return m_driSEIZFar; } + void setDriSEIDMin(double d) { m_driSEIDMin = d; } + double getDriSEIDMin() const { return m_driSEIDMin; } + void setDriSEIDMax(double d) { m_driSEIDMax = d; } + double getDriSEIDMax() const { return m_driSEIDMax; } + void setDriSEIDepthRepresentationType(int i) { m_driSEIDepthRepresentationType = i; } + int getDriSEIDepthRepresentationType() const { return m_driSEIDepthRepresentationType; } + void setDriSEIDisparityRefViewId(int i) { m_driSEIDisparityRefViewId = i; } + int getDriSEIDisparityRefViewId() const { return m_driSEIDisparityRefViewId; } + void setDriSEINonlinearNumMinus1(int i) { m_driSEINonlinearNumMinus1 = i; } + int getDriSEINonlinearNumMinus1() const { return m_driSEINonlinearNumMinus1; } + void setDriSEINonlinearModel(const std::vector<uint32_t>& driSEINonLinearModel) { m_driSEINonlinearModel = driSEINonLinearModel; } + uint32_t getDriSEINonlinearModel(int idx) const { return m_driSEINonlinearModel[idx]; } +#endif void setUseWP ( bool b ) { m_useWeightedPred = b; } void setWPBiPred ( bool b ) { m_useWeightedBiPred = b; } bool getUseWP () { return m_useWeightedPred; } diff --git a/source/Lib/EncoderLib/EncGOP.cpp b/source/Lib/EncoderLib/EncGOP.cpp index a6acdc59c291390ecb435604437d57656fff117d..cf74366bf4cb270d242543c94f357b38e6a6b14d 100644 --- a/source/Lib/EncoderLib/EncGOP.cpp +++ b/source/Lib/EncoderLib/EncGOP.cpp @@ -776,6 +776,36 @@ void EncGOP::xCreateIRAPLeadingSEIMessages (SEIMessages& seiMessages, const SPS m_seiEncoder.initSEIContentColourVolume(seiContentColourVolume); seiMessages.push_back(seiContentColourVolume); } + +#if JVET_U0082_SDI_MAI_ACI_DRI + if (m_pcCfg->getSdiSEIEnabled()) + { + SEIScalabilityDimensionInfo *seiScalabilityDimensionInfo = new SEIScalabilityDimensionInfo; + m_seiEncoder.initSEIScalabilityDimensionInfo(seiScalabilityDimensionInfo); + seiMessages.push_back(seiScalabilityDimensionInfo); + } + // multiview acquisition information + if (m_pcCfg->getMaiSEIEnabled()) + { + SEIMultiviewAcquisitionInfo *seiMultiviewAcquisitionInfo = new SEIMultiviewAcquisitionInfo; + m_seiEncoder.initSEIMultiviewAcquisitionInfo(seiMultiviewAcquisitionInfo); + seiMessages.push_back(seiMultiviewAcquisitionInfo); + } + // alpha channel information + if (m_pcCfg->getAciSEIEnabled()) + { + SEIAlphaChannelInfo *seiAlphaChannelInfo = new SEIAlphaChannelInfo; + m_seiEncoder.initSEIAlphaChannelInfo(seiAlphaChannelInfo); + seiMessages.push_back(seiAlphaChannelInfo); + } + // depth representation information + if (m_pcCfg->getDriSEIEnabled()) + { + SEIDepthRepresentationInfo *seiDepthRepresentationInfo = new SEIDepthRepresentationInfo; + m_seiEncoder.initSEIDepthRepresentationInfo(seiDepthRepresentationInfo); + seiMessages.push_back(seiDepthRepresentationInfo); + } +#endif } void EncGOP::xCreatePerPictureSEIMessages (int picInGOP, SEIMessages& seiMessages, SEIMessages& nestedSeiMessages, Slice *slice) diff --git a/source/Lib/EncoderLib/SEIEncoder.cpp b/source/Lib/EncoderLib/SEIEncoder.cpp index de1bde9b834dfd706bfa3970190920b3fb7e2c2e..a887248307d122bac9e3f1a217a9316c9552840a 100644 --- a/source/Lib/EncoderLib/SEIEncoder.cpp +++ b/source/Lib/EncoderLib/SEIEncoder.cpp @@ -813,6 +813,191 @@ void SEIEncoder::initSEIContentColourVolume(SEIContentColourVolume *seiContentCo seiContentColourVolume->m_ccvAvgLuminanceValue = (uint32_t)(10000000 * m_pcCfg->getCcvSEIAvgLuminanceValue()); } } + +#if JVET_U0082_SDI_MAI_ACI_DRI +void SEIEncoder::initSEIScalabilityDimensionInfo(SEIScalabilityDimensionInfo *sei) +{ + CHECK(!(m_isInitialized), "Scalability dimension information SEI already initialized"); + CHECK(!(sei != NULL), "Need a seiScalabilityDimensionInfo for initialization (got nullptr)"); + sei->m_sdiMaxLayersMinus1 = m_pcCfg->getSdiSEIMaxLayersMinus1(); + sei->m_sdiMultiviewInfoFlag = m_pcCfg->getSdiSEIMultiviewInfoFlag(); + sei->m_sdiAuxiliaryInfoFlag = m_pcCfg->getSdiSEIAuxiliaryInfoFlag(); + if (sei->m_sdiMultiviewInfoFlag || sei->m_sdiAuxiliaryInfoFlag) + { + if (sei->m_sdiMultiviewInfoFlag) + { + sei->m_sdiViewIdLenMinus1 = m_pcCfg->getSdiSEIViewIdLenMinus1(); + } + sei->m_sdiLayerId.resize(sei->m_sdiMaxLayersMinus1 + 1); + for (int i = 0; i <= sei->m_sdiMaxLayersMinus1; i++) + { + sei->m_sdiLayerId[i] = m_pcCfg->getSdiSEILayerId(i); + sei->m_sdiViewIdVal.resize(sei->m_sdiMaxLayersMinus1 + 1); + if (sei->m_sdiMultiviewInfoFlag) + { + sei->m_sdiViewIdVal[i] = m_pcCfg->getSdiSEIViewIdVal(i); + } + sei->m_sdiAuxId.resize(sei->m_sdiMaxLayersMinus1 + 1); + if (sei->m_sdiAuxiliaryInfoFlag) + { + sei->m_sdiAuxId[i] = m_pcCfg->getSdiSEIAuxId(i); + sei->m_sdiNumAssociatedPrimaryLayersMinus1.resize(sei->m_sdiMaxLayersMinus1 + 1); + sei->m_sdiAssociatedPrimaryLayerIdx.resize(sei->m_sdiMaxLayersMinus1 + 1); + if (sei->m_sdiAuxId[i] > 0) + { + sei->m_sdiNumAssociatedPrimaryLayersMinus1[i] = m_pcCfg->getSdiSEINumAssociatedPrimaryLayersMinus1(i); + sei->m_sdiAssociatedPrimaryLayerIdx[i].resize(sei->m_sdiNumAssociatedPrimaryLayersMinus1[i] + 1); + for (int j = 0; j <= sei->m_sdiNumAssociatedPrimaryLayersMinus1[i]; j++) + { + sei->m_sdiAssociatedPrimaryLayerIdx[i][j] = 0; + } + } + } + } + sei->m_sdiNumViews = 1; + if (sei->m_sdiMultiviewInfoFlag) + { + for (int i = 1; i <= sei->m_sdiMaxLayersMinus1; i++) + { + bool newViewFlag = true; + for (int j = 0; j < i; j++) + { + if (sei->m_sdiViewIdVal[i] == sei->m_sdiViewIdVal[j]) + { + newViewFlag = false; + } + } + if (newViewFlag) + { + sei->m_sdiNumViews++; + } + } + } + } +} + +void SEIEncoder::initSEIMultiviewAcquisitionInfo(SEIMultiviewAcquisitionInfo *sei) +{ + CHECK(!(m_isInitialized), "Multiview acquisition information SEI already initialized"); + CHECK(!(sei != NULL), "Need a seiMultiviewAcquisitionInfo for initialization (got nullptr)"); + sei->m_maiIntrinsicParamFlag = m_pcCfg->getMaiSEIIntrinsicParamFlag(); + sei->m_maiExtrinsicParamFlag = m_pcCfg->getMaiSEIExtrinsicParamFlag(); + sei->m_maiNumViewsMinus1 = m_pcCfg->getMaiSEINumViewsMinus1(); + if (sei->m_maiIntrinsicParamFlag) + { + sei->m_maiIntrinsicParamsEqualFlag = m_pcCfg->getMaiSEIIntrinsicParamsEqualFlag(); + sei->m_maiPrecFocalLength = m_pcCfg->getMaiSEIPrecFocalLength(); + sei->m_maiPrecPrincipalPoint = m_pcCfg->getMaiSEIPrecPrincipalPoint(); + sei->m_maiPrecSkewFactor = m_pcCfg->getMaiSEIPrecSkewFactor(); + int numViews = sei->m_maiIntrinsicParamsEqualFlag ? 1 : sei->m_maiNumViewsMinus1 + 1; + sei->m_maiSignFocalLengthX .resize( numViews ); + sei->m_maiExponentFocalLengthX .resize( numViews ); + sei->m_maiMantissaFocalLengthX .resize( numViews ); + sei->m_maiSignFocalLengthY .resize( numViews ); + sei->m_maiExponentFocalLengthY .resize( numViews ); + sei->m_maiMantissaFocalLengthY .resize( numViews ); + sei->m_maiSignPrincipalPointX .resize( numViews ); + sei->m_maiExponentPrincipalPointX.resize( numViews ); + sei->m_maiMantissaPrincipalPointX.resize( numViews ); + sei->m_maiSignPrincipalPointY .resize( numViews ); + sei->m_maiExponentPrincipalPointY.resize( numViews ); + sei->m_maiMantissaPrincipalPointY.resize( numViews ); + sei->m_maiSignSkewFactor .resize( numViews ); + sei->m_maiExponentSkewFactor .resize( numViews ); + sei->m_maiMantissaSkewFactor .resize( numViews ); + for( int i = 0; i <= ( sei->m_maiIntrinsicParamsEqualFlag ? 0 : sei->m_maiNumViewsMinus1 ); i++ ) + { + sei->m_maiSignFocalLengthX [i] = m_pcCfg->getMaiSEISignFocalLengthX(i); + sei->m_maiExponentFocalLengthX [i] = m_pcCfg->getMaiSEIExponentFocalLengthX(i); + sei->m_maiMantissaFocalLengthX [i] = m_pcCfg->getMaiSEIMantissaFocalLengthX(i); + sei->m_maiSignFocalLengthY [i] = m_pcCfg->getMaiSEISignFocalLengthY(i); + sei->m_maiExponentFocalLengthY [i] = m_pcCfg->getMaiSEIExponentFocalLengthY(i); + sei->m_maiMantissaFocalLengthY [i] = m_pcCfg->getMaiSEIMantissaFocalLengthY(i); + sei->m_maiSignPrincipalPointX [i] = m_pcCfg->getMaiSEISignPrincipalPointX(i); + sei->m_maiExponentPrincipalPointX[i] = m_pcCfg->getMaiSEIExponentPrincipalPointX(i); + sei->m_maiMantissaPrincipalPointX[i] = m_pcCfg->getMaiSEIMantissaPrincipalPointX(i); + sei->m_maiSignPrincipalPointY [i] = m_pcCfg->getMaiSEISignPrincipalPointY(i); + sei->m_maiExponentPrincipalPointY[i] = m_pcCfg->getMaiSEIExponentPrincipalPointY(i); + sei->m_maiMantissaPrincipalPointY[i] = m_pcCfg->getMaiSEIMantissaPrincipalPointY(i); + sei->m_maiSignSkewFactor [i] = m_pcCfg->getMaiSEISignSkewFactor(i); + sei->m_maiExponentSkewFactor [i] = m_pcCfg->getMaiSEIExponentSkewFactor(i); + sei->m_maiMantissaSkewFactor [i] = m_pcCfg->getMaiSEIMantissaSkewFactor(i); + } + } + if (sei->m_maiExtrinsicParamFlag) + { + sei->m_maiPrecRotationParam = m_pcCfg->getMaiSEIPrecRotationParam(); + sei->m_maiPrecTranslationParam = m_pcCfg->getMaiSEIPrecTranslationParam(); + sei->m_maiSignR.resize(sei->m_maiNumViewsMinus1 + 1); + sei->m_maiExponentR.resize(sei->m_maiNumViewsMinus1 + 1); + sei->m_maiMantissaR.resize(sei->m_maiNumViewsMinus1 + 1); + sei->m_maiSignT.resize(sei->m_maiNumViewsMinus1 + 1); + sei->m_maiExponentT.resize(sei->m_maiNumViewsMinus1 + 1); + sei->m_maiMantissaT.resize(sei->m_maiNumViewsMinus1 + 1); + for (int i = 0; i <= sei->m_maiNumViewsMinus1; i++) + { + sei->m_maiSignR[i].resize(3); + sei->m_maiExponentR[i].resize(3); + sei->m_maiMantissaR[i].resize(3); + sei->m_maiSignT[i].resize(3); + sei->m_maiExponentT[i].resize(3); + sei->m_maiMantissaT[i].resize(3); + for (int j = 0; j < 3; j++) + { + sei->m_maiSignR[i][j].resize(3); + sei->m_maiExponentR[i][j].resize(3); + sei->m_maiMantissaR[i][j].resize(3); + for (int k = 0; k < 3; k++) + { + sei->m_maiSignR[i][j][k] = 0; + sei->m_maiExponentR[i][j][k] = 0; + sei->m_maiMantissaR[i][j][k] = 0; + } + sei->m_maiSignT[i][j] = 0; + sei->m_maiExponentT[i][j] = 0; + sei->m_maiMantissaT[i][j] = 0; + } + } + } +} + +void SEIEncoder::initSEIAlphaChannelInfo(SEIAlphaChannelInfo *sei) +{ + CHECK(!(m_isInitialized), "Alpha channel information SEI already initialized"); + CHECK(!(sei != NULL), "Need a seiAlphaChannelInfo for initialization (got nullptr)"); + sei->m_aciCancelFlag = m_pcCfg->getAciSEICancelFlag(); + sei->m_aciUseIdc = m_pcCfg->getAciSEIUseIdc(); + sei->m_aciBitDepthMinus8 = m_pcCfg->getAciSEIBitDepthMinus8(); + sei->m_aciTransparentValue = m_pcCfg->getAciSEITransparentValue(); + sei->m_aciOpaqueValue = m_pcCfg->getAciSEIOpaqueValue(); + sei->m_aciIncrFlag = m_pcCfg->getAciSEIIncrFlag(); + sei->m_aciClipFlag = m_pcCfg->getAciSEIClipFlag(); + sei->m_aciClipTypeFlag = m_pcCfg->getAciSEIClipTypeFlag(); +} + +void SEIEncoder::initSEIDepthRepresentationInfo(SEIDepthRepresentationInfo *sei) +{ + CHECK(!(m_isInitialized), "Depth representation information SEI already initialized"); + CHECK(!(sei != NULL), "Need a seiDepthRepresentationInfo for initialization (got nullptr)"); + sei->m_driZNearFlag = m_pcCfg->getDriSEIZNearFlag(); + sei->m_driZFarFlag = m_pcCfg->getDriSEIZFarFlag(); + sei->m_driDMinFlag = m_pcCfg->getDriSEIDMinFlag(); + sei->m_driDMaxFlag = m_pcCfg->getDriSEIDMaxFlag(); + sei->m_driZNear = m_pcCfg->getDriSEIZNear(); + sei->m_driZFar = m_pcCfg->getDriSEIZFar(); + sei->m_driDMin = m_pcCfg->getDriSEIDMin(); + sei->m_driDMax = m_pcCfg->getDriSEIDMax(); + sei->m_driDisparityRefViewId = m_pcCfg->getDriSEIDisparityRefViewId(); + sei->m_driDepthRepresentationType = m_pcCfg->getDriSEIDepthRepresentationType(); + sei->m_driDepthNonlinearRepresentationNumMinus1 = m_pcCfg->getDriSEINonlinearNumMinus1(); + sei->m_driDepthNonlinearRepresentationModel.resize(sei->m_driDepthNonlinearRepresentationNumMinus1 + 1); + for(int i = 0; i < (sei->m_driDepthNonlinearRepresentationNumMinus1 + 1); i++) + { + sei->m_driDepthNonlinearRepresentationModel[i] = m_pcCfg->getDriSEINonlinearModel(i); + } +} +#endif + void SEIEncoder::initSEISubpictureLevelInfo(SEISubpicureLevelInfo *sei, const SPS *sps) { const EncCfgParam::CfgSEISubpictureLevel &cfgSubPicLevel = m_pcCfg->getSubpicureLevelInfoSEICfg(); diff --git a/source/Lib/EncoderLib/SEIEncoder.h b/source/Lib/EncoderLib/SEIEncoder.h index dac2a2cbc8ae1ddad52fa93bee0d5d006f701d40..6534b2a554b38a5dd53eeb6049ae2e0cac1c4635 100644 --- a/source/Lib/EncoderLib/SEIEncoder.h +++ b/source/Lib/EncoderLib/SEIEncoder.h @@ -89,6 +89,12 @@ public: void initSEIContentLightLevel(SEIContentLightLevelInfo *sei); void initSEIAmbientViewingEnvironment(SEIAmbientViewingEnvironment *sei); void initSEIContentColourVolume(SEIContentColourVolume *sei); +#if JVET_U0082_SDI_MAI_ACI_DRI + void initSEIScalabilityDimensionInfo(SEIScalabilityDimensionInfo *sei); + void initSEIMultiviewAcquisitionInfo(SEIMultiviewAcquisitionInfo *sei); + void initSEIAlphaChannelInfo(SEIAlphaChannelInfo *sei); + void initSEIDepthRepresentationInfo(SEIDepthRepresentationInfo *sei); +#endif bool initSEIAnnotatedRegions(SEIAnnotatedRegions *sei, int currPOC); void readAnnotatedRegionSEI(std::istream &fic, SEIAnnotatedRegions *seiAnnoRegion, bool &failed); private: diff --git a/source/Lib/EncoderLib/SEIwrite.cpp b/source/Lib/EncoderLib/SEIwrite.cpp index 9f23982617f31d05518765159d623c93a30a92b3..c0e834c4c11eab3b7a804da699eab8949be9f22d 100644 --- a/source/Lib/EncoderLib/SEIwrite.cpp +++ b/source/Lib/EncoderLib/SEIwrite.cpp @@ -116,6 +116,20 @@ void SEIWriter::xWriteSEIpayloadData(OutputBitstream &bs, const SEI& sei, HRD &h case SEI::GENERALIZED_CUBEMAP_PROJECTION: xWriteSEIGeneralizedCubemapProjection(*static_cast<const SEIGeneralizedCubemapProjection*>(&sei)); break; +#if JVET_U0082_SDI_MAI_ACI_DRI + case SEI::SCALABILITY_DIMENSION_INFO: + xWriteSEIScalabilityDimensionInfo(*static_cast<const SEIScalabilityDimensionInfo*>(&sei)); + break; + case SEI::MULTIVIEW_ACQUISITION_INFO: + xWriteSEIMultiviewAcquisitionInfo(*static_cast<const SEIMultiviewAcquisitionInfo*>(&sei)); + break; + case SEI::ALPHA_CHANNEL_INFO: + xWriteSEIAlphaChannelInfo(*static_cast<const SEIAlphaChannelInfo*>(&sei)); + break; + case SEI::DEPTH_REPRESENTATION_INFO: + xWriteSEIDepthRepresentationInfo(*static_cast<const SEIDepthRepresentationInfo*>(&sei)); + break; +#endif case SEI::USER_DATA_REGISTERED_ITU_T_T35: xWriteSEIUserDataRegistered(*static_cast<const SEIUserDataRegistered*>(&sei)); break; @@ -873,6 +887,236 @@ void SEIWriter::xWriteSEIGeneralizedCubemapProjection(const SEIGeneralizedCubema } } +#if JVET_U0082_SDI_MAI_ACI_DRI +void SEIWriter::xWriteSEIScalabilityDimensionInfo(const SEIScalabilityDimensionInfo &sei) +{ + WRITE_CODE(sei.m_sdiMaxLayersMinus1, 6, "sdi_max_layers_minus1"); + WRITE_FLAG(sei.m_sdiMultiviewInfoFlag, "sdi_multiview_info_flag"); + WRITE_FLAG(sei.m_sdiAuxiliaryInfoFlag, "sdi_auxiliary_info_flag"); + if (sei.m_sdiMultiviewInfoFlag || sei.m_sdiAuxiliaryInfoFlag) + { + if (sei.m_sdiMultiviewInfoFlag) + { + WRITE_CODE(sei.m_sdiViewIdLenMinus1, 4, "sdi_view_id_len_minus1"); + } + for (int i = 0; i <= sei.m_sdiMaxLayersMinus1; i++) + { + WRITE_CODE(sei.m_sdiLayerId[i], 6, "sdi_layer_id"); + if (sei.m_sdiMultiviewInfoFlag) + { + WRITE_CODE(sei.m_sdiViewIdVal[i], sei.m_sdiViewIdLenMinus1 + 1, "sdi_view_id_val"); + } + if (sei.m_sdiAuxiliaryInfoFlag) + { + WRITE_CODE(sei.m_sdiAuxId[i], 8, "sdi_aux_id"); + if (sei.m_sdiAuxId[i] > 0) + { + WRITE_CODE(sei.m_sdiNumAssociatedPrimaryLayersMinus1[i], 6, "sdi_num_associated_primary_layers_minus1"); + for (int j = 0; j <= sei.m_sdiNumAssociatedPrimaryLayersMinus1[i]; j++) + { + WRITE_CODE(sei.m_sdiAssociatedPrimaryLayerIdx[i][j], 6, "sdi_associated_primary_layer_idx"); + } + } + } + } + } +} + +void SEIWriter::xWriteSEIMultiviewAcquisitionInfo(const SEIMultiviewAcquisitionInfo& sei) +{ + WRITE_FLAG( ( sei.m_maiIntrinsicParamFlag ? 1 : 0 ), "intrinsic_param_flag" ); + WRITE_FLAG( ( sei.m_maiExtrinsicParamFlag ? 1 : 0 ), "extrinsic_param_flag" ); + WRITE_UVLC( sei.m_maiNumViewsMinus1 , "num_views_minus1" ); + if( sei.m_maiIntrinsicParamFlag ) + { + WRITE_FLAG( ( sei.m_maiIntrinsicParamsEqualFlag ? 1 : 0 ), "intrinsic_params_equal_flag" ); + WRITE_UVLC( sei.m_maiPrecFocalLength , "prec_focal_length" ); + WRITE_UVLC( sei.m_maiPrecPrincipalPoint , "prec_principal_point" ); + WRITE_UVLC( sei.m_maiPrecSkewFactor , "prec_skew_factor" ); + + for( int i = 0; i <= ( sei.m_maiIntrinsicParamsEqualFlag ? 0 : sei.m_maiNumViewsMinus1 ); i++ ) + { + WRITE_FLAG( ( sei.m_maiSignFocalLengthX [i] ? 1 : 0 ), "sign_focal_length_x" ); + WRITE_CODE( sei.m_maiExponentFocalLengthX [i] , 6 , "exponent_focal_length_x" ); + WRITE_CODE( sei.m_maiMantissaFocalLengthX [i] , sei.getMantissaFocalLengthXLen( i ), "mantissa_focal_length_x" ); + WRITE_FLAG( ( sei.m_maiSignFocalLengthY [i] ? 1 : 0 ), "sign_focal_length_y" ); + WRITE_CODE( sei.m_maiExponentFocalLengthY [i] , 6 , "exponent_focal_length_y" ); + WRITE_CODE( sei.m_maiMantissaFocalLengthY [i] , sei.getMantissaFocalLengthYLen( i ), "mantissa_focal_length_y" ); + WRITE_FLAG( ( sei.m_maiSignPrincipalPointX [i] ? 1 : 0 ), "sign_principal_point_x" ); + WRITE_CODE( sei.m_maiExponentPrincipalPointX[i] , 6, "exponent_principal_point_x" ); + WRITE_CODE( sei.m_maiMantissaPrincipalPointX[i] , sei.getMantissaPrincipalPointXLen( i ), "mantissa_principal_point_x" ); + WRITE_FLAG( ( sei.m_maiSignPrincipalPointY [i] ? 1 : 0 ), "sign_principal_point_y" ); + WRITE_CODE( sei.m_maiExponentPrincipalPointY[i] , 6, "exponent_principal_point_y" ); + WRITE_CODE( sei.m_maiMantissaPrincipalPointY[i] , sei.getMantissaPrincipalPointYLen( i ), "mantissa_principal_point_y" ); + WRITE_FLAG( ( sei.m_maiSignSkewFactor [i] ? 1 : 0 ), "sign_skew_factor" ); + WRITE_CODE( sei.m_maiExponentSkewFactor [i] , 6, "exponent_skew_factor" ); + WRITE_CODE( sei.m_maiMantissaSkewFactor [i] , sei.getMantissaSkewFactorLen( i ) , "mantissa_skew_factor" ); + } + } + if( sei.m_maiExtrinsicParamFlag ) + { + WRITE_UVLC( sei.m_maiPrecRotationParam , "prec_rotation_param" ); + WRITE_UVLC( sei.m_maiPrecTranslationParam, "prec_translation_param" ); + for( int i = 0; i <= sei.m_maiNumViewsMinus1; i++ ) + { + for( int j = 0; j <= 2; j++ ) /* row */ + { + for( int k = 0; k <= 2; k++ ) /* column */ + { + WRITE_FLAG( ( sei.m_maiSignR [i][j][k] ? 1 : 0 ), "sign_r" ); + WRITE_CODE( sei.m_maiExponentR[i][j][k] , 6, "exponent_r" ); + WRITE_CODE( sei.m_maiMantissaR[i][j][k] , sei.getMantissaRLen( i,j,k ) , "mantissa_r" ); + } + WRITE_FLAG( ( sei.m_maiSignT [i][j] ? 1 : 0 ), "sign_t" ); + WRITE_CODE( sei.m_maiExponentT[i][j] , 6, "exponent_t" ); + WRITE_CODE( sei.m_maiMantissaT[i][j] , sei.getMantissaTLen( i,j ),"mantissa_t" ); + } + } + } +}; + +void SEIWriter::xWriteSEIAlphaChannelInfo( const SEIAlphaChannelInfo& sei) +{ + WRITE_FLAG( ( sei.m_aciCancelFlag ? 1 : 0 ), "alpha_channel_cancel_flag" ); + if( !sei.m_aciCancelFlag ) + { + WRITE_CODE( sei.m_aciUseIdc, 3, "alpha_channel_use_idc" ); + WRITE_CODE( sei.m_aciBitDepthMinus8, 3, "alpha_channel_bit_depth_minus8" ); + WRITE_CODE( sei.m_aciTransparentValue, sei.m_aciBitDepthMinus8+9, "alpha_transparent_value" ); + WRITE_CODE( sei.m_aciOpaqueValue, sei.m_aciBitDepthMinus8+9, "alpha_opaque_value" ); + WRITE_FLAG( ( sei.m_aciIncrFlag ? 1 : 0 ), "alpha_channel_incr_flag" ); + WRITE_FLAG( ( sei.m_aciClipFlag ? 1 : 0 ), "alpha_channel_clip_flag" ); + if( sei.m_aciClipFlag ) + { + WRITE_FLAG( ( sei.m_aciClipTypeFlag ? 1 : 0 ), "alpha_channel_clip_type_flag" ); + } + } +}; + +void SEIWriter::xWriteSEIDepthRepresentationInfo( const SEIDepthRepresentationInfo& sei) +{ + WRITE_FLAG( ( sei.m_driZNearFlag ? 1 : 0 ), "z_near_flag" ); + WRITE_FLAG( ( sei.m_driZFarFlag ? 1 : 0 ), "z_far_flag" ); + WRITE_FLAG( ( sei.m_driDMinFlag ? 1 : 0 ), "d_min_flag" ); + WRITE_FLAG( ( sei.m_driDMaxFlag ? 1 : 0 ), "d_max_flag" ); + WRITE_UVLC( sei.m_driDepthRepresentationType, "depth_representation_type" ); + if( sei.m_driDMinFlag || sei.m_driDMaxFlag ) + { + WRITE_UVLC( sei.m_driDisparityRefViewId, "disparity_ref_view_id" ); + } + if( sei.m_driZNearFlag ) + { + xWriteSEIDepthRepInfoElement(sei.m_driZNear); + } + if( sei.m_driZFarFlag ) + { + xWriteSEIDepthRepInfoElement(sei.m_driZFar); + } + if( sei.m_driDMinFlag ) + { + xWriteSEIDepthRepInfoElement(sei.m_driDMin); + } + if( sei.m_driDMaxFlag ) + { + xWriteSEIDepthRepInfoElement(sei.m_driDMax); + } + + if (sei.m_driDepthRepresentationType == 3) + { + WRITE_UVLC( sei.m_driDepthNonlinearRepresentationNumMinus1, "depth_nonlinear_representation_num_minus1" ); + for( int i = 1; i <= sei.m_driDepthNonlinearRepresentationNumMinus1 + 1; i++ ) + { + WRITE_UVLC(sei.m_driDepthNonlinearRepresentationModel.at(i - 1),"depth_nonlinear_representation_model[ i ]"); + } + } +} + +void SEIWriter::xWriteSEIDepthRepInfoElement( double f ) +{ + uint32_t x_sign, x_exp, x_mantissa,x_mantissa_len; + if (f < 0) + { + f = f * (-1); + x_sign = 1; + } + else + { + x_sign = 0; + } + int exponent=0; + if(f >= 1) + { + while(f>=2) + { + exponent++; + f = f/2; + } + } + else + { + while (f<1) + { + exponent++; + f = f*2; + } + exponent=-exponent; + } + + int i; + f = f -1; + double s = 1; + char s_mantissa[32]; + double thr=1.0/(4.0*(1<<30)); + + if (f>=thr) + { + for(i=0;i<32;i++) + { + s /= 2; + if(f>=s) + { + f = f-s; + s_mantissa[i]=1; + + if (f<thr) + break; + } + else + { + s_mantissa[i]=0; + } + } + + if (i<32) + x_mantissa_len=i+1; + else + x_mantissa_len=32; + + x_mantissa=0; + + for(i=0;i<x_mantissa_len;i++) + { + if (s_mantissa[i]==1) + x_mantissa += (1u)<<(x_mantissa_len-1-i) ; + } + + } + else + { + x_mantissa=0; + x_mantissa_len=1; + } + + assert(exponent>=-31 && exponent<= (1<<7)-32); + x_exp=exponent+31; + + WRITE_FLAG( x_sign, "da_sign_flag" ); + WRITE_CODE( x_exp, 7 , "da_exponent" ); + WRITE_CODE( x_mantissa_len-1, 5 , "da_mantissa_len_minus1" ); + WRITE_CODE( x_mantissa, x_mantissa_len , "da_mantissa" ); +}; +#endif + void SEIWriter::xWriteSEISubpictureLevelInfo(const SEISubpicureLevelInfo &sei) { CHECK(sei.m_numRefLevels < 1, "SEISubpicureLevelInfo: numRefLevels must be greater than zero"); diff --git a/source/Lib/EncoderLib/SEIwrite.h b/source/Lib/EncoderLib/SEIwrite.h index df59df0576cf15c61faa8caa0e9c4a4dac5827b1..f4cf84af5ea4659f6dfe9f7b5c6f2a772a36dd2e 100644 --- a/source/Lib/EncoderLib/SEIwrite.h +++ b/source/Lib/EncoderLib/SEIwrite.h @@ -77,6 +77,13 @@ protected: void xWriteSEIOmniViewport (const SEIOmniViewport& sei); void xWriteSEIRegionWisePacking (const SEIRegionWisePacking &sei); void xWriteSEIGeneralizedCubemapProjection (const SEIGeneralizedCubemapProjection &sei); +#if JVET_U0082_SDI_MAI_ACI_DRI + void xWriteSEIScalabilityDimensionInfo (const SEIScalabilityDimensionInfo& sei); + void xWriteSEIMultiviewAcquisitionInfo (const SEIMultiviewAcquisitionInfo& sei); + void xWriteSEIAlphaChannelInfo (const SEIAlphaChannelInfo& sei); + void xWriteSEIDepthRepresentationInfo (const SEIDepthRepresentationInfo& sei); + void xWriteSEIDepthRepInfoElement (double f); +#endif void xWriteSEISubpictureLevelInfo (const SEISubpicureLevelInfo &sei); void xWriteSEISampleAspectRatioInfo (const SEISampleAspectRatioInfo &sei);