diff --git a/CMakeLists.txt b/CMakeLists.txt index 712206462..bb9f8ffc5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,10 +10,10 @@ if( NOT CMAKE_VERSION VERSION_LESS 3.13.0 ) endif() # project name -project( vvenc VERSION 1.12.0 ) +project( vvenc VERSION 1.12.1 ) # set alternative version numbering for release candidates -#set( PROJECT_VERSION_RC rc1 ) +set( PROJECT_VERSION_RC rc1 ) if( PROJECT_VERSION_RC ) set( PROJECT_VERSION "${PROJECT_VERSION}-${PROJECT_VERSION_RC}" ) endif() diff --git a/changelog.txt b/changelog.txt index ab1fc816f..96e9b5b8e 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,3 +1,31 @@ +///////////////////////////////////////// +tag 1.12.1 + +* libvvenc: + - changed parameters (vvenc_config::) for proper VUI signalization: + - m_aspectRatioIdc=1 per default (sar 1x1) + - m_chromaLocInfoPresent=-1 and m_chromaSampleLocType=-1 per default (auto behavior depending on HDR/SDR mode) + m_chromaSampleLocType is auto set, depending on m_horCollocatedChromaFlag and m_verCollocatedChromaFlag + m_chromaLocInfoPresent=1 and m_chromaSampleLocType=2 for VVENC_HDR_PQ, VVENC_HDR_PQ_BT2020, + VVENC_HDR_HLG, VVENC_HDR_HLG_BT2020, VVENC_SDR_BT2020 + else m_chromaLocInfoPresent=0 and m_chromaSampleLocType=0 + - m_aspectRatioInfoPresent flag is auto on, if m_aspectRatioIdc>0 or non-default Sar is given + - m_overscanInfoPresent flag is auto on, when m_overscanAppropriateFlag is enabled + - m_chromaSampleLocTypeTopField and m_chromaSampleLocTypeBottomField unused now (will be removed in next major release) + - VUI defaults changed: + - progressiveSourceFlag=1 + - nonPackedFlag=1 + - nonProjectedFlag=1 + +* vvencFFapp: + - added parameters: + - Sar: specify Sample aspect ratio - ratio of width to height (WidthxHeight) + - removed unused parameter: ChromaSampleLocTypeTopField, ChromaSampleLocTypeBottomField + - changed parameter section: + - cleanup section "VUI and SEI options" into separate sections: + "HDR/SDR and Color Options", "SEI and auxiliary options", "VUI options" + - "ChromaLocInfoPresent" is now auto behavior "Signals whether chroma_sample_loc_type is present (-1: auto, 0: off, 1: on)") + ///////////////////////////////////////// tag 1.12.0 diff --git a/include/vvenc/vvencCfg.h b/include/vvenc/vvencCfg.h index 85d7fb7ac..5e4e92f95 100644 --- a/include/vvenc/vvencCfg.h +++ b/include/vvenc/vvencCfg.h @@ -682,7 +682,7 @@ typedef struct vvenc_config int m_colourPrimaries; // Indicates chromaticity coordinates of the source primaries int m_transferCharacteristics; // Indicates the opto-electronic transfer characteristics of the source int m_matrixCoefficients; // Describes the matrix coefficients used in deriving luma and chroma from RGB primaries - bool m_chromaLocInfoPresent; // Signals whether chroma_sample_loc_type_top_field and chroma_sample_loc_type_bottom_field are present + int8_t m_chromaLocInfoPresent; // Signals whether chroma_sample_loc_type_top_field and chroma_sample_loc_type_bottom_field are present int m_chromaSampleLocTypeTopField; // Specifies the location of chroma samples for top field int m_chromaSampleLocTypeBottomField; // Specifies the location of chroma samples for bottom field int m_chromaSampleLocType; // Specifies the location of chroma samples for progressive content diff --git a/source/Lib/CommonLib/Slice.h b/source/Lib/CommonLib/Slice.h index 8e0001979..5d2b117d9 100644 --- a/source/Lib/CommonLib/Slice.h +++ b/source/Lib/CommonLib/Slice.h @@ -612,10 +612,10 @@ struct VUI uint32_t chromaSampleLocType; VUI() - : progressiveSourceFlag (false) + : progressiveSourceFlag (true) , interlacedSourceFlag (false) - , nonPackedFlag (false) - , nonProjectedFlag (false) + , nonPackedFlag (true) + , nonProjectedFlag (true) , aspectRatioInfoPresent (false) //TODO: This initialiser list contains magic numbers , aspectRatioConstantFlag (false) , aspectRatioIdc (0) diff --git a/source/Lib/EncoderLib/EncGOP.cpp b/source/Lib/EncoderLib/EncGOP.cpp index 63f4e1e04..817d69bbd 100644 --- a/source/Lib/EncoderLib/EncGOP.cpp +++ b/source/Lib/EncoderLib/EncGOP.cpp @@ -1016,9 +1016,9 @@ void EncGOP::xInitSPS(SPS &sps) const vui.transferCharacteristics = m_pcEncCfg->m_transferCharacteristics; vui.matrixCoefficients = m_pcEncCfg->m_matrixCoefficients; vui.chromaLocInfoPresent = m_pcEncCfg->m_chromaLocInfoPresent; - vui.chromaSampleLocTypeTopField = m_pcEncCfg->m_chromaSampleLocTypeTopField; - vui.chromaSampleLocTypeBottomField= m_pcEncCfg->m_chromaSampleLocTypeBottomField; vui.chromaSampleLocType = m_pcEncCfg->m_chromaSampleLocType; + vui.chromaSampleLocTypeTopField = 0; + vui.chromaSampleLocTypeBottomField= 0; vui.overscanInfoPresent = m_pcEncCfg->m_overscanInfoPresent; vui.overscanAppropriateFlag = m_pcEncCfg->m_overscanAppropriateFlag; vui.videoFullRangeFlag = m_pcEncCfg->m_videoFullRangeFlag; diff --git a/source/Lib/apputils/VVEncAppCfg.h b/source/Lib/apputils/VVEncAppCfg.h index eaea36aaa..478adfc2b 100644 --- a/source/Lib/apputils/VVEncAppCfg.h +++ b/source/Lib/apputils/VVEncAppCfg.h @@ -515,6 +515,7 @@ int parse( int argc, char* argv[], vvenc_config* c, std::ostream& rcOstr ) IStreamToFunc toPreset ( setPresets, this, c, &PresetToEnumMap,vvencPresetMode::VVENC_MEDIUM); IStreamToRefVec toSourceSize ( { &c->m_SourceWidth, &c->m_SourceHeight }, true, 'x' ); IStreamToRefVec toMaxPicSize ( { &c->m_maxPicWidth, &c->m_maxPicHeight }, true, 'x' ); + IStreamToRefVec toSarSize ( { &c->m_sarWidth, &c->m_sarHeight }, true, 'x' ); IStreamToRefVec toFps ( { &c->m_FrameRate, &c->m_FrameScale }, false, '/' ); IStreamToEnum toProfile ( &c->m_profile, &ProfileToEnumMap ); @@ -576,6 +577,7 @@ int parse( int argc, char* argv[], vvenc_config* c, std::ostream& rcOstr ) IStreamToEnum toUseWpp ( &c->m_entropyCodingSyncEnabled, &FlagToIntMap ); IStreamToEnum toUseIfp ( &c->m_ifp, &FlagToIntMap ); + IStreamToEnum toChromaLocInfo ( &c->m_chromaLocInfoPresent, &FlagToIntMap ); IStreamToEnum toMtProfile ( &c->m_mtProfile, &MtAbrevToIntMap ); po::Options opts; @@ -720,9 +722,9 @@ int parse( int argc, char* argv[], vvenc_config* c, std::ostream& rcOstr ) ("Tier", toLevelTier, "tier for interpretation of level (main, high)") ; + opts.setSubSection("HDR/SDR and Color Options"); if( m_easyMode ) { - opts.setSubSection("HDR/SDR and Color Options"); opts.addOptions() ("sdr", toSDRMode, "set SDR mode + BT.709, BT.2020, BT.470 color space. " "use: off, sdr|sdr_709, sdr_2020, sdr_470bg") @@ -732,13 +734,15 @@ int parse( int argc, char* argv[], vvenc_config* c, std::ostream& rcOstr ) } else { - opts.setSubSection("VUI and SEI options"); opts.addOptions() ("Sdr", toSDRMode, "set SDR mode + BT.709, BT.2020, BT.470 color space. " "use: off, sdr|sdr_709, sdr_2020, sdr_470bg") ("Hdr", toHDRMode, "set HDR mode + BT.709 or BT.2020 color space (+SEI messages for hlg) " "If maxcll or masteringdisplay is set, HDR10/PQ is enabled. use: off, pq|hdr10, pq_2020|hdr10_2020, hlg, hlg_2020") ; + + opts.setSubSection("SEI and auxiliary options"); + opts.setSubSection("VUI options"); } @@ -996,20 +1000,35 @@ int parse( int argc, char* argv[], vvenc_config* c, std::ostream& rcOstr ) ("SaoChromaOffsetBitShift", c->m_saoOffsetBitShift[ 1 ], "Specify the chroma SAO bit-shift. If negative, automatically calculate a suitable value based upon bit depth and initial QP") ; - opts.setSubSection("VUI and SEI options"); + opts.setSubSection("SEI and auxiliary options"); opts.addOptions() ("SEIDecodedPictureHash,-dph", toHashType, "Control generation of decode picture hash SEI messages, (0:off, 1:md5, 2:crc, 3:checksum)" ) ("SEIBufferingPeriod", c->m_bufferingPeriodSEIEnabled, "Control generation of buffering period SEI messages") ("SEIPictureTiming", c->m_pictureTimingSEIEnabled, "Control generation of picture timing SEI messages") ("SEIDecodingUnitInfo", c->m_decodingUnitInfoSEIEnabled, "Control generation of decoding unit information SEI message.") + ("MasteringDisplayColourVolume", toMasteringDisplay, "SMPTE ST 2086 mastering display colour volume info SEI (HDR), " + "vec(uint) size 10, x,y,x,y,x,y,x,y,max,min where: \"G(x,y)B(x,y)R(x,y)WP(x,y)L(max,min)\"" + "range: 0 <= GBR,WP <= 50000, 0 <= L <= uint; GBR xy coordinates in increment of 1/50000, min/max luminance in units of 1/10000 cd/m2" ) + ("MaxContentLightLevel", toContentLightLevel, "Specify content light level info SEI as \"cll,fall\" (HDR) max. content light level, " + "max. frame average light level, range: 1 <= cll,fall <= 65535'") + ("PreferredTransferCharacteristics", toPrefTransferCharacteristics, "Specify preferred transfer characteristics SEI and overwrite transfer entry in VUI (0-18): reserved, bt709, unknown, empty, bt470m, bt470bg, smpte170m, " + "smpte240m, linear, log100, log316, iec61966-2-4, bt1361e, iec61966-2-1, " + "bt2020-10, bt2020-12, smpte2084, smpte428, arib-std-b67") + ("AccessUnitDelimiter,-aud", toAud, "Enable Access Unit Delimiter NALUs (-1: auto, 0: off, 1: on; default: auto - enable only if needed by dependent options)" , true) + ("HrdParametersPresent,-hrd", c->m_hrdParametersPresent, "Enable generation of hrd_parameters() (0: off, 1: on)") ("EnableDecodingParameterSet", c->m_decodingParameterSetEnabled, "Enable writing of Decoding Parameter Set") - ("AccessUnitDelimiter,-aud", toAud, "Enable Access Unit Delimiter NALUs, (default: auto - enable only if needed by dependent options)" , true) - ("VuiParametersPresent,-vui", toVui, "Enable generation of vui_parameters(), (default: auto - enable only if needed by dependent options)", true) - ("HrdParametersPresent,-hrd", c->m_hrdParametersPresent, "Enable generation of hrd_parameters(), (0: off, 1: on; default: 1)") + ; + + opts.setSubSection("VUI options"); + opts.addOptions() + ("VuiParametersPresent,-vui", toVui, "Enable generation of vui_parameters() (-1: auto, 0: off, 1: on; default: auto - enable only if needed by dependent options)", true) ("AspectRatioInfoPresent", c->m_aspectRatioInfoPresent, "Signals whether aspect_ratio_idc is present") - ("AspectRatioIdc", c->m_aspectRatioIdc, "aspect_ratio_idc") + ("AspectRatioIdc", c->m_aspectRatioIdc, "Aspect ratio idc (0-16,255) 0=undef, 1=1:1, 2=12:11, 3=10:11, 4=16:11, 5=40:33, 6=24:11, 7=20:11, 8=32:11, 9=80:33, 10=18:11, 11=15:11, 12=64:33, " + "13=160:99, 14=4:3, 15=3:2, 16=2:1") + ("Sar", toSarSize, "Sample aspect ratio - ratio of width to height (WidthxHeight)") ("SarWidth", c->m_sarWidth, "horizontal size of the sample aspect ratio") ("SarHeight", c->m_sarHeight, "vertical size of the sample aspect ratio") + ("ColourDescriptionPresent", c->m_colourDescriptionPresent, "Signals whether colour_primaries, transfer_characteristics and matrix_coefficients are present") ("ColourPrimaries", toColorPrimaries, "Specify color primaries (0-13): reserved, bt709, unknown, empty, bt470m, bt470bg, smpte170m, " "smpte240m, film, bt2020, smpte428, smpte431, smpte432") @@ -1020,23 +1039,11 @@ int parse( int argc, char* argv[], vvenc_config* c, std::ostream& rcOstr ) ("MatrixCoefficients", toColorMatrix, "Specify color matrix setting to derive luma/chroma from RGB primaries (0-14): gbr, bt709, unknown, empty, fcc, bt470bg, smpte170m, " "smpte240m, ycgco, bt2020nc, bt2020c, smpte2085, chroma-derived-nc, chroma-derived-c, ictcp") - ("ChromaLocInfoPresent", c->m_chromaLocInfoPresent, "Signals whether chroma_sample_loc_type_top_field and chroma_sample_loc_type_bottom_field are present") - ("ChromaSampleLocTypeTopField", c->m_chromaSampleLocTypeTopField, "Specifies the location of chroma samples for top field") - ("ChromaSampleLocTypeBottomField", c->m_chromaSampleLocTypeBottomField, "Specifies the location of chroma samples for bottom field") - ("ChromaSampleLocType", c->m_chromaSampleLocType, "Specifies the location of chroma samples for progressive content") + ("ChromaLocInfoPresent", toChromaLocInfo, "Signals whether chroma_sample_loc_type is present (-1: auto, 0: off, 1: on)") + ("ChromaSampleLocType", c->m_chromaSampleLocType, "Specifies the location of chroma samples for progressive content(-1 auto, 0-5 Chroma420LocType)") ("OverscanInfoPresent", c->m_overscanInfoPresent, "Indicates whether conformant decoded pictures are suitable for display using overscan") ("OverscanAppropriate", c->m_overscanAppropriateFlag, "Indicates whether conformant decoded pictures are suitable for display using overscan") ("VideoFullRange", c->m_videoFullRangeFlag, "Indicates the black level and range of luma and chroma signals") - - - ("MasteringDisplayColourVolume", toMasteringDisplay, "SMPTE ST 2086 mastering display colour volume info SEI (HDR), " - "vec(uint) size 10, x,y,x,y,x,y,x,y,max,min where: \"G(x,y)B(x,y)R(x,y)WP(x,y)L(max,min)\"" - "range: 0 <= GBR,WP <= 50000, 0 <= L <= uint; GBR xy coordinates in increment of 1/50000, min/max luminance in units of 1/10000 cd/m2" ) - ("MaxContentLightLevel", toContentLightLevel, "Specify content light level info SEI as \"cll,fall\" (HDR) max. content light level, " - "max. frame average light level, range: 1 <= cll,fall <= 65535'") - ("PreferredTransferCharacteristics", toPrefTransferCharacteristics, "Specify preferred transfer characteristics SEI and overwrite transfer entry in VUI (0-18): reserved, bt709, unknown, empty, bt470m, bt470bg, smpte170m, " - "smpte240m, linear, log100, log316, iec61966-2-4, bt1361e, iec61966-2-1, " - "bt2020-10, bt2020-12, smpte2084, smpte428, arib-std-b67") ; opts.setSubSection("Summary options (debugging)"); diff --git a/source/Lib/vvenc/vvencCfg.cpp b/source/Lib/vvenc/vvencCfg.cpp index 33ecaac42..bfbb3f3bf 100644 --- a/source/Lib/vvenc/vvencCfg.cpp +++ b/source/Lib/vvenc/vvencCfg.cpp @@ -622,17 +622,15 @@ VVENC_DECL void vvenc_config_default(vvenc_config *c ) c->m_vuiParametersPresent = -1; c->m_hrdParametersPresent = true; c->m_aspectRatioInfoPresent = false; - c->m_aspectRatioIdc = 0; + c->m_aspectRatioIdc = 1; c->m_sarWidth = 0; c->m_sarHeight = 0; c->m_colourDescriptionPresent = false; c->m_colourPrimaries = 2; c->m_transferCharacteristics = 2; c->m_matrixCoefficients = 2; - c->m_chromaLocInfoPresent = false; - c->m_chromaSampleLocTypeTopField = 0; - c->m_chromaSampleLocTypeBottomField = 0; - c->m_chromaSampleLocType = 0; + c->m_chromaLocInfoPresent = -1; + c->m_chromaSampleLocType = -1; c->m_overscanInfoPresent = false; c->m_overscanAppropriateFlag = false; c->m_videoFullRangeFlag = false; @@ -1120,6 +1118,7 @@ VVENC_DECL bool vvenc_init_config_parameter( vvenc_config *c ) c->m_transferCharacteristics = 14; // bt2020-10 c->m_colourPrimaries = 9; // bt2020nc c->m_matrixCoefficients = 9; // bt2020nc + c->m_verCollocatedChromaFlag = true; } else if( c->m_HdrMode == VVENC_SDR_BT470BG ) { @@ -1143,6 +1142,39 @@ VVENC_DECL bool vvenc_init_config_parameter( vvenc_config *c ) c->m_vuiParametersPresent = 0; } + if( !c->m_aspectRatioInfoPresent && ( c->m_aspectRatioIdc > 0 || (c->m_sarWidth > 0 && c->m_sarHeight > 0 ))) + { + c->m_aspectRatioInfoPresent = true; + } + + if( !c->m_overscanInfoPresent && c->m_overscanAppropriateFlag) + { + c->m_overscanInfoPresent = true; + } + + if( c->m_chromaSampleLocType < 0 ) + { + if( c->m_horCollocatedChromaFlag ) + { + if ( c->m_verCollocatedChromaFlag) + c->m_chromaSampleLocType = 2; + else + c->m_chromaSampleLocType = 0; + } + else + { + if ( c->m_verCollocatedChromaFlag) + c->m_chromaSampleLocType = 3; + else + c->m_chromaSampleLocType = 1; + } + } + + if ( c->m_chromaLocInfoPresent < 0 ) + { + c->m_chromaLocInfoPresent = c->m_verCollocatedChromaFlag ? 1 : 0; + } + switch ( c->m_conformanceWindowMode) { case 0: