Commit 430c57c4 authored by Karl Sharman's avatar Karl Sharman
Browse files

Fish-eye SEI message support

Based upon a patch from LGE, after significant review by software
coordinator.

The implementation follows the current text.

The two checks region_left+region_width < pic_width and
region_top+region_height < pic_height probably need to be changed.
parent 31f9f4d8
......@@ -750,6 +750,26 @@ Bool TAppEncCfg::parseCfg( Int argc, TChar* argv[] )
SMultiValueInput<UInt> cfg_rwpSEIRwpBottomGuardBandHeight (0, std::numeric_limits<UChar>::max(), 0, std::numeric_limits<UChar>::max());
SMultiValueInput<Bool> cfg_rwpSEIRwpGuardBandNotUsedForPredFlag (0, 1, 0, std::numeric_limits<UChar>::max());
SMultiValueInput<UInt> cfg_rwpSEIRwpGuardBandType (0, 7, 0, 4*std::numeric_limits<UChar>::max());
#endif
#if FVI_SEI_MESSAGE
SMultiValueInput<UInt> cfg_fviSEIFisheyeCircularRegionCentreX (0, std::numeric_limits<UInt>::max(), 0, 4); // CONFIRM: all the '3's have been changed to '4's since "The value of fisheye_num_active_areas_minus1 shall be in the range of 0 to 3, inclusive", so up to 4 entries.
SMultiValueInput<UInt> cfg_fviSEIFisheyeCircularRegionCentreY (0, std::numeric_limits<UInt>::max(), 0, 4);
SMultiValueInput<UInt> cfg_fviSEIFisheyeRectRegionTop (0, std::numeric_limits<UInt>::max(), 0, 4); // do not know the height of the picture at this point, so cannot limit region top.
SMultiValueInput<UInt> cfg_fviSEIFisheyeRectRegionLeft (0, std::numeric_limits<UInt>::max(), 0, 4);
SMultiValueInput<UInt> cfg_fviSEIFisheyeRectRegionWidth (1, std::numeric_limits<UInt>::max(), 0, 4);
SMultiValueInput<UInt> cfg_fviSEIFisheyeRectRegionHeight (1, std::numeric_limits<UInt>::max(), 0, 4);
SMultiValueInput<UInt> cfg_fviSEIFisheyeCircularRegionRadius (0, std::numeric_limits<UInt>::max(), 0, 4);
SMultiValueInput<UInt> cfg_fviSEIFisheyeSceneRadius (0, std::numeric_limits<UInt>::max(), 0, 4);
SMultiValueInput<Int> cfg_fviSEIFisheyeCameraCentreAzimuth (-180*65536, 180*65536-1, 0, 4);
SMultiValueInput<Int> cfg_fviSEIFisheyeCameraCentreElevation ( -90*65536, 90*65536 , 0, 4);
SMultiValueInput<Int> cfg_fviSEIFisheyeCameraCentreTilt (-180*65536, 180*65536-1, 0, 4);
SMultiValueInput<UInt> cfg_fviSEIFisheyeCameraCentreOffsetX (0, std::numeric_limits<UInt>::max(), 0, 4);
SMultiValueInput<UInt> cfg_fviSEIFisheyeCameraCentreOffsetY (0, std::numeric_limits<UInt>::max(), 0, 4);
SMultiValueInput<UInt> cfg_fviSEIFisheyeCameraCentreOffsetZ (0, std::numeric_limits<UInt>::max(), 0, 4);
SMultiValueInput<UInt> cfg_fviSEIFisheyeFieldOfView (0, 360*65536, 0, 4);
SMultiValueInput<UInt> cfg_fviSEIFisheyeNumPolynomialCoeffs (0, 8, 0, 4);
SMultiValueInput<Int> cfg_fviSEIFisheyePolynomialCoeff (std::numeric_limits<Int>::min(), std::numeric_limits<Int>::max(), 0, 4*8);
UInt cfg_fviSEIFisheyeNumActiveAreasMinus1=0;
#endif
Int warnUnknowParameter = 0;
po::Options opts;
......@@ -1255,6 +1275,30 @@ Bool TAppEncCfg::parseCfg( Int argc, TChar* argv[] )
("SEIRwpGuardBandNotUsedForPredFlag", cfg_rwpSEIRwpGuardBandNotUsedForPredFlag, cfg_rwpSEIRwpGuardBandNotUsedForPredFlag, "Specifies if the guard bands is used in the inter prediction process.")
("SEIRwpGuardBandType", cfg_rwpSEIRwpGuardBandType, cfg_rwpSEIRwpGuardBandType, "Specifies the type of the guard bands for the i-th packed region.")
#endif
#if FVI_SEI_MESSAGE
("SEIFviEnabled", m_fisheyeVIdeoInfoSEIEnabled, false, "Controls if fisheye video information SEI message enabled")
("SEIFviCancelFlag", m_fisheyeVideoInfoSEI.m_fisheyeCancelFlag, true, "Specifies the persistence of any previous fisheye video information SEI message in output order.")
("SEIFviPersistenceFlag", m_fisheyeVideoInfoSEI.m_fisheyePersistenceFlag, false, "Specifies the persistence of the fisheye video information SEI message for the current layer.")
("SEIFviViewDimensionIdc", m_fisheyeVideoInfoSEI.m_fisheyeViewDimensionIdc, 0u, "Specifies the alignment and viewing direction of a fisheye lens")
("SEIFviNumActiveAreasMinus1", cfg_fviSEIFisheyeNumActiveAreasMinus1, 0u, "Specifies the number of active areas in the coded picture minus 1")
("SEIFviCircularRegionCentreX", cfg_fviSEIFisheyeCircularRegionCentreX, cfg_fviSEIFisheyeCircularRegionCentreX, "Specifies the horizontal coordinates of the centre of the circular region that contains the i-th active area in the coded picture")
("SEIFviCircularRegionCentreY", cfg_fviSEIFisheyeCircularRegionCentreY, cfg_fviSEIFisheyeCircularRegionCentreY, "Specifies the vertical coordinates of the centre of the circular region that contains the i-th active area in the coded picture")
("SEIFviRectRegionTop", cfg_fviSEIFisheyeRectRegionTop, cfg_fviSEIFisheyeRectRegionTop, "Specifies the vertical coordinates of the top-left corner of the i-th rectangular region that contains the i-th active area")
("SEIFviRectRegionLeft", cfg_fviSEIFisheyeRectRegionLeft, cfg_fviSEIFisheyeRectRegionLeft, "Specifies the horizontal coordinates of the top-left corner of the i-th rectangular region that contains the i-th active area")
("SEIFviRectRegionWidth", cfg_fviSEIFisheyeRectRegionWidth, cfg_fviSEIFisheyeRectRegionWidth, "Specifies the width of the i-th rectangular region that contains the i-th active area")
("SEIFviRectRegionHeight", cfg_fviSEIFisheyeRectRegionHeight, cfg_fviSEIFisheyeRectRegionHeight, "Specifies the height of the i-th rectangular region that contains the i-th active area")
("SEIFviCircularRegionRadius", cfg_fviSEIFisheyeCircularRegionRadius, cfg_fviSEIFisheyeCircularRegionRadius, "Specifies the radius of the circular region that contains the i-th active area that is defined as a length from the centre of the circular region to the outermost pixel boundary of the circular region, that corresponds to the maximum field of view of the i-th fisheye lens")
("SEIFviSceneRadius", cfg_fviSEIFisheyeSceneRadius, cfg_fviSEIFisheyeSceneRadius, "Specifies the radius of a circular region within the i-th active area where the obstruction is not included in the region")
("SEIFviCameraCentreAzimuth", cfg_fviSEIFisheyeCameraCentreAzimuth, cfg_fviSEIFisheyeCameraCentreAzimuth, "Indicates the spherical coordinates that correspond to the centre of the circular region that contains the i-th active area")
("SEIFviCameraCentreElevation", cfg_fviSEIFisheyeCameraCentreElevation, cfg_fviSEIFisheyeCameraCentreElevation, "Indicates the spherical coordinates that correspond to the centre of the circular region that contains the i-th active area")
("SEIFviCameraCentreTilt", cfg_fviSEIFisheyeCameraCentreTilt, cfg_fviSEIFisheyeCameraCentreTilt, "Indicates the spherical coordinates that correspond to the centre of the circular region that contains the i-th active area")
("SEIFviCameraCentreOffsetX", cfg_fviSEIFisheyeCameraCentreOffsetX, cfg_fviSEIFisheyeCameraCentreOffsetX, "Indicates the XYZ offset values of the focal centre of the fisheye camera lens corresponding to the i-th active area from the focal centre origin of the overall fisheye camera configuration.")
("SEIFviCameraCentreOffsetY", cfg_fviSEIFisheyeCameraCentreOffsetY, cfg_fviSEIFisheyeCameraCentreOffsetY, "Indicates the XYZ offset values of the focal centre of the fisheye camera lens corresponding to the i-th active area from the focal centre origin of the overall fisheye camera configuration.")
("SEIFviCameraCenterOffsetZ", cfg_fviSEIFisheyeCameraCentreOffsetZ, cfg_fviSEIFisheyeCameraCentreOffsetZ, "Indicates the XYZ offset values of the focal centre of the fisheye camera lens corresponding to the i-th active area from the focal centre origin of the overall fisheye camera configuration.")
("SEIFviFieldOfView", cfg_fviSEIFisheyeFieldOfView, cfg_fviSEIFisheyeFieldOfView, "Specifies the field of view of the lens that corresponds to the i-th active area")
("SEIFviNumPolynomialCoeffs", cfg_fviSEIFisheyeNumPolynomialCoeffs, cfg_fviSEIFisheyeNumPolynomialCoeffs, "Specifies the number of polynomial coefficients for the circular region")
("SEIFviPolynomialCoeff", cfg_fviSEIFisheyePolynomialCoeff, cfg_fviSEIFisheyePolynomialCoeff, "Specifies the j-th polynomial coefficient value of the curve function that maps the normalized distance of a luma sample from the centre of the circular region corresponding to the i-th active area to the angular value of a sphere coordinate from the normal vector of a nominal imaging plane that passes through the centre of the sphere coordinate system for the i-th active region.")
#endif
#if RNSEI
("SEIRegionalNestingFileRoot,-rns", m_regionalNestingSEIFileRoot, string(""), "Regional nesting SEI parameters root file name (wo num ext); only the file name base is to be added. Underscore and POC would be automatically addded to . E.g. \"-rns rns\" will search for files rns_0.txt, rns_1.txt, ...")
#endif
......@@ -1918,6 +1962,68 @@ Bool TAppEncCfg::parseCfg( Int argc, TChar* argv[] )
}
}
}
#endif
#if FVI_SEI_MESSAGE
if (!m_fisheyeVideoInfoSEI.m_fisheyeCancelFlag && m_fisheyeVIdeoInfoSEIEnabled)
{
if (cfg_fviSEIFisheyeNumActiveAreasMinus1 < 0 || cfg_fviSEIFisheyeNumActiveAreasMinus1 > 3) { fprintf(stderr, "Bad number of FVI active areas\n"); exit(EXIT_FAILURE); }
if (cfg_fviSEIFisheyeCircularRegionCentreX.values.size() != cfg_fviSEIFisheyeNumActiveAreasMinus1 + 1) { fprintf(stderr, "Bad number of FVI circular region centre X entries\n"); exit(EXIT_FAILURE); }
if (cfg_fviSEIFisheyeCircularRegionCentreY.values.size() != cfg_fviSEIFisheyeNumActiveAreasMinus1 + 1) { fprintf(stderr, "Bad number of FVI circular region centre Y entries\n"); exit(EXIT_FAILURE); }
if (cfg_fviSEIFisheyeRectRegionTop.values.size() != cfg_fviSEIFisheyeNumActiveAreasMinus1 + 1) { fprintf(stderr, "Bad number of FVI rect region top entries\n"); exit(EXIT_FAILURE); }
if (cfg_fviSEIFisheyeRectRegionLeft.values.size() != cfg_fviSEIFisheyeNumActiveAreasMinus1 + 1) { fprintf(stderr, "Bad number of FVI rect region left entries\n"); exit(EXIT_FAILURE); }
if (cfg_fviSEIFisheyeRectRegionWidth.values.size() != cfg_fviSEIFisheyeNumActiveAreasMinus1 + 1) { fprintf(stderr, "Bad number of FVI rect region width entries\n"); exit(EXIT_FAILURE); }
if (cfg_fviSEIFisheyeRectRegionHeight.values.size() != cfg_fviSEIFisheyeNumActiveAreasMinus1 + 1) { fprintf(stderr, "Bad number of FVI rect region height entries\n"); exit(EXIT_FAILURE); }
if (cfg_fviSEIFisheyeCircularRegionRadius.values.size() != cfg_fviSEIFisheyeNumActiveAreasMinus1 + 1) { fprintf(stderr, "Bad number of FVI circular region radius entries\n"); exit(EXIT_FAILURE); }
if (cfg_fviSEIFisheyeSceneRadius.values.size() != cfg_fviSEIFisheyeNumActiveAreasMinus1 + 1) { fprintf(stderr, "Bad number of FVI scene radius entries\n"); exit(EXIT_FAILURE); }
if (cfg_fviSEIFisheyeCameraCentreAzimuth.values.size() != cfg_fviSEIFisheyeNumActiveAreasMinus1 + 1) { fprintf(stderr, "Bad number of FVI camera centre azimuth entries\n"); exit(EXIT_FAILURE); }
if (cfg_fviSEIFisheyeCameraCentreElevation.values.size() != cfg_fviSEIFisheyeNumActiveAreasMinus1 + 1) { fprintf(stderr, "Bad number of FVI camera centre elevation entries\n"); exit(EXIT_FAILURE); }
if (cfg_fviSEIFisheyeCameraCentreTilt.values.size() != cfg_fviSEIFisheyeNumActiveAreasMinus1 + 1) { fprintf(stderr, "Bad number of FVI camera centre tilt entries\n"); exit(EXIT_FAILURE); }
if (cfg_fviSEIFisheyeCameraCentreOffsetX.values.size() != cfg_fviSEIFisheyeNumActiveAreasMinus1 + 1) { fprintf(stderr, "Bad number of FVI camera centre offsetX entries\n"); exit(EXIT_FAILURE); }
if (cfg_fviSEIFisheyeCameraCentreOffsetY.values.size() != cfg_fviSEIFisheyeNumActiveAreasMinus1 + 1) { fprintf(stderr, "Bad number of FVI camera centre offsetY entries\n"); exit(EXIT_FAILURE); }
if (cfg_fviSEIFisheyeCameraCentreOffsetZ.values.size() != cfg_fviSEIFisheyeNumActiveAreasMinus1 + 1) { fprintf(stderr, "Bad number of FVI camera centre offsetZ entries\n"); exit(EXIT_FAILURE); }
if (cfg_fviSEIFisheyeFieldOfView.values.size() != cfg_fviSEIFisheyeNumActiveAreasMinus1 + 1) { fprintf(stderr, "Bad number of FVI field of view entries\n"); exit(EXIT_FAILURE); }
m_fisheyeVideoInfoSEI.m_fisheyeActiveAreas.resize(cfg_fviSEIFisheyeNumActiveAreasMinus1 + 1);
for (std::size_t i = 0, extractPolynomialIdx = 0; i < m_fisheyeVideoInfoSEI.m_fisheyeActiveAreas.size(); i++)
{
TComSEIFisheyeVideoInfo::ActiveAreaInfo &info=m_fisheyeVideoInfoSEI.m_fisheyeActiveAreas[i];
info.m_fisheyeCircularRegionCentreX = cfg_fviSEIFisheyeCircularRegionCentreX.values[i];
info.m_fisheyeCircularRegionCentreY = cfg_fviSEIFisheyeCircularRegionCentreY.values[i];
info.m_fisheyeRectRegionTop = cfg_fviSEIFisheyeRectRegionTop.values[i];
info.m_fisheyeRectRegionLeft = cfg_fviSEIFisheyeRectRegionLeft.values[i];
info.m_fisheyeRectRegionWidth = cfg_fviSEIFisheyeRectRegionWidth.values[i];
info.m_fisheyeRectRegionHeight = cfg_fviSEIFisheyeRectRegionHeight.values[i];
info.m_fisheyeCircularRegionRadius = cfg_fviSEIFisheyeCircularRegionRadius.values[i];
info.m_fisheyeSceneRadius = cfg_fviSEIFisheyeSceneRadius.values[i];
// check rectangular region is within the conformance window.
if ( (!( info.m_fisheyeRectRegionHeight >= 1 && m_confWinTop <= info.m_fisheyeRectRegionTop && info.m_fisheyeRectRegionTop + info.m_fisheyeRectRegionHeight < m_iSourceHeight -m_confWinBottom ) ) ||
(!( info.m_fisheyeRectRegionWidth >= 1 && m_confWinLeft <= info.m_fisheyeRectRegionLeft && info.m_fisheyeRectRegionLeft + info.m_fisheyeRectRegionWidth < m_iSourceWidth -m_confWinRight ) ) )
{
fprintf(stderr, "Fisheye region is not within visible area\n");
exit (EXIT_FAILURE);
}
info.m_fisheyeCameraCentreAzimuth = cfg_fviSEIFisheyeCameraCentreAzimuth.values[i];
info.m_fisheyeCameraCentreElevation = cfg_fviSEIFisheyeCameraCentreElevation.values[i];
info.m_fisheyeCameraCentreTilt = cfg_fviSEIFisheyeCameraCentreTilt.values[i];
info.m_fisheyeCameraCentreOffsetX = cfg_fviSEIFisheyeCameraCentreOffsetX.values[i];
info.m_fisheyeCameraCentreOffsetY = cfg_fviSEIFisheyeCameraCentreOffsetY.values[i];
info.m_fisheyeCameraCentreOffsetZ = cfg_fviSEIFisheyeCameraCentreOffsetZ.values[i];
info.m_fisheyeFieldOfView = cfg_fviSEIFisheyeFieldOfView.values[i];
assert(cfg_fviSEIFisheyeNumPolynomialCoeffs.values[i] >= 0 && cfg_fviSEIFisheyeNumPolynomialCoeffs.values[i] <= 8);
info.m_fisheyePolynomialCoeff.resize(cfg_fviSEIFisheyeNumPolynomialCoeffs.values[i]);
for (Int j = 0; j < info.m_fisheyePolynomialCoeff.size(); j++)
{
assert(cfg_fviSEIFisheyePolynomialCoeff.values.size() > extractPolynomialIdx);
info.m_fisheyePolynomialCoeff[j] = cfg_fviSEIFisheyePolynomialCoeff.values[extractPolynomialIdx++];
}
}
}
#endif
if(m_timeCodeSEIEnabled)
{
......
......@@ -438,6 +438,10 @@ protected:
#if AR_SEI_MESSAGE
std::string m_arSEIFileRoot;
#endif
#if FVI_SEI_MESSAGE
Bool m_fisheyeVIdeoInfoSEIEnabled;
TComSEIFisheyeVideoInfo m_fisheyeVideoInfoSEI;
#endif
// weighted prediction
Bool m_useWeightedPred; ///< Use of weighted prediction in P slices
......
......@@ -439,6 +439,16 @@ Void TAppEncTop::xInitLibCfg()
m_cTEncTop.setRwpSEIRwpBottomGuardBandHeight (m_rwpSEIRwpBottomGuardBandHeight);
m_cTEncTop.setRwpSEIRwpGuardBandNotUsedForPredFlag (m_rwpSEIRwpGuardBandNotUsedForPredFlag);
m_cTEncTop.setRwpSEIRwpGuardBandType (m_rwpSEIRwpGuardBandType);
#endif
#if FVI_SEI_MESSAGE
if (m_fisheyeVIdeoInfoSEIEnabled)
{
m_cTEncTop.setFviSEIEnabled(m_fisheyeVideoInfoSEI);
}
else
{
m_cTEncTop.setFviSEIDisabled();
}
#endif
m_cTEncTop.setColourRemapInfoSEIFileRoot ( m_colourRemapSEIFileRoot );
m_cTEncTop.setMasteringDisplaySEI ( m_masteringDisplay );
......
......@@ -91,6 +91,9 @@ const std::vector<SEI::PayloadType> SEI::prefix_sei_messages({
#if RWP_SEI_MESSAGE
, SEI::REGION_WISE_PACKING
#endif
#if FVI_SEI_MESSAGE
, SEI::FISHEYE_VIDEO_INFO
#endif
#if RNSEI
, SEI::REGIONAL_NESTING
#endif
......@@ -318,6 +321,9 @@ const TChar *SEI::getSEIMessageString(SEI::PayloadType payloadType)
#if RWP_SEI_MESSAGE
case SEI::REGION_WISE_PACKING: return "Region wise packing information";
#endif
#if FVI_SEI_MESSAGE
case SEI::FISHEYE_VIDEO_INFO: return "Fisheye video information";
#endif
#if RNSEI
case SEI::REGIONAL_NESTING: return "Regional nesting";
#endif
......
......@@ -104,6 +104,9 @@ public:
#if CMP_SEI_MESSAGE
CUBEMAP_PROJECTION = 151,
#endif
#if FVI_SEI_MESSAGE
FISHEYE_VIDEO_INFO = 152,
#endif
#if RWP_SEI_MESSAGE
REGION_WISE_PACKING = 155,
#endif
......@@ -961,6 +964,17 @@ public:
};
#endif
#if FVI_SEI_MESSAGE
class SEIFisheyeVideoInfo : public SEI
{
public:
PayloadType payloadType() const { return FISHEYE_VIDEO_INFO; }
SEIFisheyeVideoInfo() {}
virtual ~SEIFisheyeVideoInfo() {}
TComSEIFisheyeVideoInfo values;
};
#endif
class SEIColourRemappingInfo : public SEI
{
public:
......
......@@ -107,6 +107,8 @@
#define CMP_SEI_MESSAGE 1 // cubemap projection SEI message
#define ERP_SR_OV_SEI_MESSAGE 1 // equirectangular projection, sphere rotation, and omni viewport SEI message
#define FVI_SEI_MESSAGE 1 // Fisheye Video Information SEI message
#define RNSEI 1 ///< Support for signalling regional nesting SEI message
#define AR_SEI_MESSAGE 1 ///< Annotated Region SEI message
......@@ -917,6 +919,38 @@ struct WCGChromaQPControl
Double chromaQpOffset; ///< Chroma QP Offset (0.0:default)
};
#if FVI_SEI_MESSAGE
struct TComSEIFisheyeVideoInfo
{
struct ActiveAreaInfo
{
UInt m_fisheyeCircularRegionCentreX;
UInt m_fisheyeCircularRegionCentreY;
UInt m_fisheyeRectRegionTop;
UInt m_fisheyeRectRegionLeft;
UInt m_fisheyeRectRegionWidth;
UInt m_fisheyeRectRegionHeight;
UInt m_fisheyeCircularRegionRadius;
UInt m_fisheyeSceneRadius;
Int m_fisheyeCameraCentreAzimuth;
Int m_fisheyeCameraCentreElevation;
Int m_fisheyeCameraCentreTilt;
UInt m_fisheyeCameraCentreOffsetX;
UInt m_fisheyeCameraCentreOffsetY;
UInt m_fisheyeCameraCentreOffsetZ;
UInt m_fisheyeFieldOfView;
std::vector<Int> m_fisheyePolynomialCoeff;
};
Bool m_fisheyeCancelFlag;
Bool m_fisheyePersistenceFlag;
UInt m_fisheyeViewDimensionIdc;
std::vector<ActiveAreaInfo> m_fisheyeActiveAreas;
TComSEIFisheyeVideoInfo() : m_fisheyeCancelFlag(false), m_fisheyePersistenceFlag(false), m_fisheyeViewDimensionIdc(0), m_fisheyeActiveAreas() { }
};
#endif
class Window
{
private:
......
......@@ -385,6 +385,12 @@ Void SEIReader::xReadSEIPayloadData(Int const payloadType, Int const payloadSize
xParseSEIAnnotatedRegions((SEIAnnotatedRegions&)*sei, payloadSize, pDecodedMessageOutputStream);
break;
#endif
#if FVI_SEI_MESSAGE
case SEI::FISHEYE_VIDEO_INFO:
sei = new SEIFisheyeVideoInfo;
xParseSEIFisheyeVideoInfo((SEIFisheyeVideoInfo&)*sei, payloadSize, pDecodedMessageOutputStream);
break;
#endif
#if RNSEI
case SEI::REGIONAL_NESTING:
sei = new SEIRegionalNesting;
......@@ -1840,6 +1846,59 @@ Void SEIReader::xParseSEIRegionWisePacking(SEIRegionWisePacking& sei, UInt paylo
}
#endif
#if FVI_SEI_MESSAGE
Void SEIReader::xParseSEIFisheyeVideoInfo(SEIFisheyeVideoInfo& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream)
{
UInt val;
output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize);
sei.values = TComSEIFisheyeVideoInfo();
TComSEIFisheyeVideoInfo &info=sei.values;
sei_read_flag(pDecodedMessageOutputStream, val, "fisheye_cancel_flag"); info.m_fisheyeCancelFlag = val;
if (!info.m_fisheyeCancelFlag)
{
Int sval;
sei_read_flag(pDecodedMessageOutputStream, val, "fisheye_persistence_flag"); info.m_fisheyePersistenceFlag = val;
sei_read_code(pDecodedMessageOutputStream, 3, val, "fisheye_view_dimension_idc"); info.m_fisheyeViewDimensionIdc = val;
sei_read_code(pDecodedMessageOutputStream, 3, val, "fisheye_reserved_zero_3bits");
sei_read_code(pDecodedMessageOutputStream, 8, val, "fisheye_num_active_area_minus1");
info.m_fisheyeActiveAreas.resize(val+1);
for (std::size_t i = 0; i < info.m_fisheyeActiveAreas.size(); i++)
{
TComSEIFisheyeVideoInfo::ActiveAreaInfo &area=info.m_fisheyeActiveAreas[i];
sei_read_code(pDecodedMessageOutputStream, 32, val, "fisheye_circular_region_centre_x[i]"); area.m_fisheyeCircularRegionCentreX = val;
sei_read_code(pDecodedMessageOutputStream, 32, val, "fisheye_circular_region_centre_y[i]"); area.m_fisheyeCircularRegionCentreY = val;
sei_read_code(pDecodedMessageOutputStream, 32, val, "fisheye_rect_region_top[i]"); area.m_fisheyeRectRegionTop = val;
sei_read_code(pDecodedMessageOutputStream, 32, val, "fisheye_rect_region_left[i]"); area.m_fisheyeRectRegionLeft = val;
sei_read_code(pDecodedMessageOutputStream, 32, val, "fisheye_rect_region_width[i]"); area.m_fisheyeRectRegionWidth = val;
sei_read_code(pDecodedMessageOutputStream, 32, val, "fisheye_rect_region_Height[i]"); area.m_fisheyeRectRegionHeight = val;
sei_read_code(pDecodedMessageOutputStream, 32, val, "fisheye_circular_region_radius[i]"); area.m_fisheyeCircularRegionRadius = val;
sei_read_code(pDecodedMessageOutputStream, 32, val, "fisheye_scene_radius[i]"); area.m_fisheyeSceneRadius = val;
sei_read_scode(pDecodedMessageOutputStream, 32, sval, "fisheye_camera_centre_azimuth[i]"); area.m_fisheyeCameraCentreAzimuth = sval;
sei_read_scode(pDecodedMessageOutputStream, 32, sval, "fisheye_camera_centre_elevation[i]"); area.m_fisheyeCameraCentreElevation = sval;
sei_read_scode(pDecodedMessageOutputStream, 32, sval, "fisheye_camera_centre_tilt[i]"); area.m_fisheyeCameraCentreTilt = sval;
sei_read_code(pDecodedMessageOutputStream, 32, val, "fisheye_camera_centre_offset_x[i]"); area.m_fisheyeCameraCentreOffsetX = val;
sei_read_code(pDecodedMessageOutputStream, 32, val, "fisheye_camera_centre_offset_y[i]"); area.m_fisheyeCameraCentreOffsetY = val;
sei_read_code(pDecodedMessageOutputStream, 32, val, "fisheye_camera_centre_offset_z[i]"); area.m_fisheyeCameraCentreOffsetZ = val;
sei_read_code(pDecodedMessageOutputStream, 32, val, "fisheye_field_of_view[i]"); area.m_fisheyeFieldOfView = val;
sei_read_code(pDecodedMessageOutputStream, 16, val, "fisheye_num_polynomial_coeffs[i]");
area.m_fisheyePolynomialCoeff.resize(val);
for (std::size_t j = 0; j < area.m_fisheyePolynomialCoeff.size(); j++)
{
sei_read_scode(pDecodedMessageOutputStream, 32, sval, "fisheye_polynomial_coeff[i][j]"); area.m_fisheyePolynomialCoeff[j] = sval;
}
}
}
}
#endif
Void SEIReader::xParseSEIColourRemappingInfo(SEIColourRemappingInfo& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream)
{
UInt uiVal;
......
......@@ -110,6 +110,9 @@ protected:
#endif
#if RWP_SEI_MESSAGE
Void xParseSEIRegionWisePacking (SEIRegionWisePacking& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream);
#endif
#if FVI_SEI_MESSAGE
Void xParseSEIFisheyeVideoInfo(SEIFisheyeVideoInfo& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream);
#endif
Void xParseSEIColourRemappingInfo (SEIColourRemappingInfo& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream);
Void xParseSEIDeinterlaceFieldIdentification(SEIDeinterlaceFieldIdentification& sei,UInt payLoadSize, std::ostream *pDecodedMessageOutputStream);
......
......@@ -682,6 +682,15 @@ Void SEIEncoder::initSEIRegionWisePacking(SEIRegionWisePacking *seiRegionWisePac
}
#endif
#if FVI_SEI_MESSAGE
Void SEIEncoder::initSEIFisheyeVideoInfo(SEIFisheyeVideoInfo *seiFisheyeVideoInfo)
{
assert(m_isInitialized);
assert(seiFisheyeVideoInfo != NULL);
seiFisheyeVideoInfo->values = m_pcCfg->getFviSEIData();
}
#endif
#if AR_SEI_MESSAGE
template <typename T>
static Void readTokenValue(T &returnedValue, /// value returned
......
......@@ -94,6 +94,9 @@ public:
#endif
#if RWP_SEI_MESSAGE
Void initSEIRegionWisePacking(SEIRegionWisePacking *sei);
#endif
#if FVI_SEI_MESSAGE
Void initSEIFisheyeVideoInfo(SEIFisheyeVideoInfo *sei);
#endif
Void initSEIChromaResamplingFilterHint(SEIChromaResamplingFilterHint *sei, Int iHorFilterIndex, Int iVerFilterIndex);
Void initSEITimeCode(SEITimeCode *sei);
......
......@@ -202,6 +202,11 @@ Void SEIWriter::xWriteSEIpayloadData(TComBitIf& bs, const SEI& sei, const TComSP
xWriteSEIRegionWisePacking(*static_cast<const SEIRegionWisePacking*>(&sei));
break;
#endif
#if FVI_SEI_MESSAGE
case SEI::FISHEYE_VIDEO_INFO:
xWriteSEIFisheyeVideoInfo(*static_cast<const SEIFisheyeVideoInfo*>(&sei));
break;
#endif
#if RNSEI
case SEI::REGIONAL_NESTING:
xWriteSEIRegionalNesting(bs, *static_cast<const SEIRegionalNesting*>(&sei), sps);
......@@ -1241,6 +1246,51 @@ Void SEIWriter::xWriteSEIRegionWisePacking(const SEIRegionWisePacking &sei)
}
#endif
#if FVI_SEI_MESSAGE
Void SEIWriter::xWriteSEIFisheyeVideoInfo(const SEIFisheyeVideoInfo &sei)
{
const TComSEIFisheyeVideoInfo &info=sei.values;
WRITE_FLAG(info.m_fisheyeCancelFlag, "fisheye_cancel_flag");
if (!info.m_fisheyeCancelFlag)
{
WRITE_FLAG(info.m_fisheyePersistenceFlag, "fisheye_persistence_flag");
WRITE_CODE((UInt)info.m_fisheyeViewDimensionIdc, 3, "fisheye_view_dimension_idc");
WRITE_CODE(0, 3, "fisheye_reserved_zero_3bits");
assert(info.m_fisheyeActiveAreas.size());
WRITE_CODE((UInt)info.m_fisheyeActiveAreas.size()-1, 8, "fisheye_num_active_area_minus1");
for (std::size_t i = 0; i < info.m_fisheyeActiveAreas.size(); i++)
{
const TComSEIFisheyeVideoInfo::ActiveAreaInfo &area=info.m_fisheyeActiveAreas[i];
WRITE_CODE((UInt)area.m_fisheyeCircularRegionCentreX, 32, "fisheye_circular_region_centre_x[i]");
WRITE_CODE((UInt)area.m_fisheyeCircularRegionCentreY, 32, "fisheye_circular_region_centre_y[i]");
WRITE_CODE((UInt)area.m_fisheyeRectRegionTop, 32, "fisheye_rect_region_top[i]");
WRITE_CODE((UInt)area.m_fisheyeRectRegionLeft, 32, "fisheye_rect_region_left[i]");
WRITE_CODE((UInt)area.m_fisheyeRectRegionWidth, 32, "fisheye_rect_region_width[i]");
WRITE_CODE((UInt)area.m_fisheyeRectRegionHeight, 32, "fisheye_rect_region_Height[i]");
WRITE_CODE((UInt)area.m_fisheyeCircularRegionRadius, 32, "fisheye_circular_region_radius[i]");
WRITE_CODE((UInt)area.m_fisheyeSceneRadius, 32, "fisheye_scene_radius[i]");
WRITE_SCODE((Int)area.m_fisheyeCameraCentreAzimuth, 32, "fisheye_camera_centre_azimuth[i]");
WRITE_SCODE((Int)area.m_fisheyeCameraCentreElevation, 32, "fisheye_camera_centre_elevation[i]");
WRITE_SCODE((Int)area.m_fisheyeCameraCentreTilt, 32, "fisheye_camera_centre_tilt[i]");
WRITE_CODE((UInt)area.m_fisheyeCameraCentreOffsetX, 32, "fisheye_camera_centre_offset_x[i]");
WRITE_CODE((UInt)area.m_fisheyeCameraCentreOffsetY, 32, "fisheye_camera_centre_offset_x[i]");
WRITE_CODE((UInt)area.m_fisheyeCameraCentreOffsetZ, 32, "fisheye_camera_centre_offset_z[i]");
WRITE_CODE((UInt)area.m_fisheyeFieldOfView, 32, "fisheye_field_of_view[i]");
WRITE_CODE((UInt)area.m_fisheyePolynomialCoeff.size(), 16, "fisheye_num_polynomial_coeffs[i]");
for (std::size_t j = 0; j < area.m_fisheyePolynomialCoeff.size(); j++)
{
WRITE_SCODE((Int)area.m_fisheyePolynomialCoeff[j], 32, "fisheye_polynomial_coeff[i][j]");
}
}
}
}
#endif
Void SEIWriter::xWriteSEIColourRemappingInfo(const SEIColourRemappingInfo& sei)
{
WRITE_UVLC( sei.m_colourRemapId, "colour_remap_id" );
......
......@@ -101,6 +101,9 @@ protected:
#endif
#if RWP_SEI_MESSAGE
Void xWriteSEIRegionWisePacking (const SEIRegionWisePacking &sei);
#endif
#if FVI_SEI_MESSAGE
Void xWriteSEIFisheyeVideoInfo (const SEIFisheyeVideoInfo &sei);
#endif
Void xWriteSEIColourRemappingInfo (const SEIColourRemappingInfo& sei);
Void xWriteSEIDeinterlaceFieldIdentification (const SEIDeinterlaceFieldIdentification& sei);
......
......@@ -454,6 +454,10 @@ protected:
#if AR_SEI_MESSAGE
std::string m_arSEIFileRoot; // Annotated region SEI - initialized from external file
#endif
#if FVI_SEI_MESSAGE
Bool m_fviSEIEnabled;
TComSEIFisheyeVideoInfo m_fisheyeVideoInfo;
#endif
#if RNSEI
std::string m_regionalNestingSEIFileRoot; // Regional nesting SEI - initialized from external file
#endif
......@@ -1117,6 +1121,12 @@ public:
Bool getRwpSEIRwpGuardBandNotUsedForPredFlag(UInt idx) const { return m_rwpSEIRwpGuardBandNotUsedForPredFlag[idx]; }
Void setRwpSEIRwpGuardBandType(const std::vector<UChar>& rwpGuardBandType) { m_rwpSEIRwpGuardBandType = rwpGuardBandType; }
UChar getRwpSEIRwpGuardBandType(UInt idx) const { return m_rwpSEIRwpGuardBandType[idx]; }
#endif
#if FVI_SEI_MESSAGE
Void setFviSEIDisabled() { m_fviSEIEnabled = false; }
Void setFviSEIEnabled(const TComSEIFisheyeVideoInfo& fvi) { m_fisheyeVideoInfo=fvi; m_fviSEIEnabled=true; }
Bool getFviSEIEnabled() const { return m_fviSEIEnabled; }
const TComSEIFisheyeVideoInfo& getFviSEIData() const { return m_fisheyeVideoInfo; }
#endif
Void setColourRemapInfoSEIFileRoot( const std::string &s ) { m_colourRemapSEIFileRoot = s; }
const std::string &getColourRemapInfoSEIFileRoot() const { return m_colourRemapSEIFileRoot; }
......
......@@ -531,6 +531,14 @@ Void TEncGOP::xCreateIRAPLeadingSEIMessages (SEIMessages& seiMessages, const TCo
seiMessages.push_back(seiRegionWisePacking);
}
#endif
#if FVI_SEI_MESSAGE
if (m_pcCfg->getFviSEIEnabled())
{
SEIFisheyeVideoInfo *sei = new SEIFisheyeVideoInfo;
m_seiEncoder.initSEIFisheyeVideoInfo(sei);
seiMessages.push_back(sei);
}
#endif
if(m_pcCfg->getMasteringDisplaySEI().colourVolumeSEIEnabled)
{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment