# HG changeset patch # User kirithika <kirith...@multicorewareinc.com> # Date 1545374888 -19800 # Fri Dec 21 12:18:08 2018 +0530 # Node ID ba54a6405f5d9666eb282957fb77ae17b643a990 # Parent 1f44f1f1623d677c80469e713ed642f6673af91d Add support for Dolby Vision profile 8.1
diff -r 1f44f1f1623d -r ba54a6405f5d doc/reST/cli.rst --- a/doc/reST/cli.rst Mon Dec 17 16:49:08 2018 +0530 +++ b/doc/reST/cli.rst Fri Dec 21 12:18:08 2018 +0530 @@ -2222,7 +2222,7 @@ The value is specified as a float or as an integer with the profile times 10, for example profile 5 is specified as "5" or "5.0" or "50". - Currently only profile 5 enabled, Default 0 (disabled) + Currently only profile 5 and profile 8.1 enabled, Default 0 (disabled) .. option:: --dolby-vision-rpu <filename> diff -r 1f44f1f1623d -r ba54a6405f5d source/common/param.cpp --- a/source/common/param.cpp Mon Dec 17 16:49:08 2018 +0530 +++ b/source/common/param.cpp Fri Dec 21 12:18:08 2018 +0530 @@ -1422,14 +1422,16 @@ "Invalid refine-ctu-distortion value, must be either 0 or 1"); CHECK(param->maxAUSizeFactor < 0.5 || param->maxAUSizeFactor > 1.0, "Supported factor for controlling max AU size is from 0.5 to 1"); - CHECK((param->dolbyProfile != 0) && (param->dolbyProfile != 50), - "Unsupported Dolby Vision profile, only profile 5 enabled"); - if (param->dolbyProfile == 50) + CHECK((param->dolbyProfile != 0) && (param->dolbyProfile != 50) && (param->dolbyProfile != 81), + "Unsupported Dolby Vision profile, only profile 5 and profile 8.1 enabled"); + if (param->dolbyProfile) { - CHECK((param->rc.vbvMaxBitrate < 0 && param->rc.vbvBufferSize < 0), "Dolby Vision requires VBV settings to enable HRD.\n"); - CHECK((param->sourceWidth > 3840 || param->sourceHeight > 2160), "Maximum supported resolution for Dolby Vision profile - 5 is 4k UHD\n"); - CHECK((param->internalBitDepth != 10), "Dolby Vision profile - 5 is Main10 only\n"); - CHECK((param->internalCsp != X265_CSP_I420), "Dolby Vision profile - 5 requires YCbCr 4:2:0 color space\n"); + CHECK((param->rc.vbvMaxBitrate <= 0 || param->rc.vbvBufferSize <= 0), "Dolby Vision requires VBV settings to enable HRD.\n"); + CHECK((param->internalBitDepth != 10), "Dolby Vision profile - 5 and profile - 8.1 is Main10 only\n"); + CHECK((param->internalCsp != X265_CSP_I420), "Dolby Vision profile - 5 and profile - 8.1 requires YCbCr 4:2:0 color space\n"); + + if (param->dolbyProfile == 81) + CHECK(!(param->masteringDisplayColorVolume), "Dolby Vision profile - 8.1 requires Mastering display color volume information\n"); } #if !X86_64 CHECK(param->searchMethod == X265_SEA && (param->sourceWidth > 840 || param->sourceHeight > 480), diff -r 1f44f1f1623d -r ba54a6405f5d source/encoder/encoder.cpp --- a/source/encoder/encoder.cpp Mon Dec 17 16:49:08 2018 +0530 +++ b/source/encoder/encoder.cpp Fri Dec 21 12:18:08 2018 +0530 @@ -50,6 +50,30 @@ const char g_sliceTypeToChar[] = {'B', 'P', 'I'}; } +/* Dolby Vision profile specific settings */ +typedef struct +{ + int bEmitHRDSEI; + int bEnableVideoSignalTypePresentFlag; + int bEnableColorDescriptionPresentFlag; + int bEnableAccessUnitDelimiters; + int bAnnexB; + + /* VUI parameters specific to Dolby Vision Profile */ + int videoFormat; + int bEnableVideoFullRangeFlag; + int transferCharacteristics; + int colorPrimaries; + int matrixCoeffs; + + int doviProfileId; +}DolbyVisionProfileSpec; + +DolbyVisionProfileSpec dovi[] = +{ + { 1, 1, 1, 1, 1, 5, 1, 2, 2, 2, 50 }, + { 1, 1, 1, 1, 1, 5, 0, 16, 9, 9, 81 }, +}; /* Threshold for motion vection, based on expermental result. * TODO: come up an algorithm for adoptive threshold */ #define MVTHRESHOLD (10*10) @@ -413,7 +437,7 @@ m_nalList.m_annexB = !!m_param->bAnnexB; - m_emitCLLSEI = p->maxCLL || p->maxFALL; + m_emitCLLSEI = p->maxCLL || p->maxFALL || (p->dolbyProfile == 81); if (m_param->naluFile) { @@ -2584,6 +2608,31 @@ pps->numRefIdxDefault[1] = 1; } +void Encoder::configureDolbyVisionParams(x265_param* p) +{ + uint32_t doviProfile = 0; + + while (dovi[doviProfile].doviProfileId != p->dolbyProfile && doviProfile + 1 < sizeof(dovi) / sizeof(dovi[0])) + doviProfile++; + + p->bEmitHRDSEI = dovi[doviProfile].bEmitHRDSEI; + p->vui.bEnableVideoSignalTypePresentFlag = dovi[doviProfile].bEnableVideoSignalTypePresentFlag; + p->vui.bEnableColorDescriptionPresentFlag = dovi[doviProfile].bEnableColorDescriptionPresentFlag; + p->bEnableAccessUnitDelimiters = dovi[doviProfile].bEnableAccessUnitDelimiters; + p->bAnnexB = dovi[doviProfile].bAnnexB; + p->vui.videoFormat = dovi[doviProfile].videoFormat; + p->vui.bEnableVideoFullRangeFlag = dovi[doviProfile].bEnableVideoFullRangeFlag; + p->vui.transferCharacteristics = dovi[doviProfile].transferCharacteristics; + p->vui.colorPrimaries = dovi[doviProfile].colorPrimaries; + p->vui.matrixCoeffs = dovi[doviProfile].matrixCoeffs; + + if (dovi[doviProfile].doviProfileId == 81) + p->bEmitHDRSEI = 1; + + if (dovi[doviProfile].doviProfileId == 50 && p->noiseReductionIntra && p->noiseReductionInter) + p->crQpOffset = 4; +} + void Encoder::configure(x265_param *p) { this->m_param = p; @@ -3207,25 +3256,9 @@ p->chunkStart = p->chunkEnd = 0; x265_log(p, X265_LOG_WARNING, "chunk-end cannot be less than chunk-start. Disabling chunking.\n"); } + if (p->dolbyProfile) // Default disabled. - { - if (p->dolbyProfile == 50) - { - p->bEmitHRDSEI = true; - p->vui.bEnableVideoSignalTypePresentFlag = 1; - p->vui.bEnableColorDescriptionPresentFlag = 1; - p->vui.transferCharacteristics = 2; - p->vui.colorPrimaries = 2; - p->vui.matrixCoeffs = 2; - p->vui.bEnableVideoFullRangeFlag = 1; - p->vui.videoFormat = 5; - p->bEnableAccessUnitDelimiters = 1; - p->bAnnexB = 1; - - if (p->noiseReductionIntra && p->noiseReductionInter) // when noise reduction is enabled, preserve the film grain. - p->crQpOffset = 4; - } - } + configureDolbyVisionParams(p); } void Encoder::readAnalysisFile(x265_analysis_data* analysis, int curPoc, const x265_picture* picIn, int paramBytes) diff -r 1f44f1f1623d -r ba54a6405f5d source/encoder/encoder.h --- a/source/encoder/encoder.h Mon Dec 17 16:49:08 2018 +0530 +++ b/source/encoder/encoder.h Fri Dec 21 12:18:08 2018 +0530 @@ -310,6 +310,8 @@ void copyUserSEIMessages(Frame *frame, const x265_picture* pic_in); + void configureDolbyVisionParams(x265_param* p); + protected: void initVPS(VPS *vps); diff -r 1f44f1f1623d -r ba54a6405f5d source/x265cli.h --- a/source/x265cli.h Mon Dec 17 16:49:08 2018 +0530 +++ b/source/x265cli.h Fri Dec 21 12:18:08 2018 +0530 @@ -360,7 +360,7 @@ H0(" --dhdr10-info <filename> JSON file containing the Creative Intent Metadata to be encoded as Dynamic Tone Mapping\n"); H0(" --[no-]dhdr10-opt Insert tone mapping SEI only for IDR frames and when the tone mapping information changes. Default disabled\n"); #endif - H0(" --dolby-vision-profile <float|integer> Specifies Dolby Vision profile ID. Currently only profile 5 enabled. Specified as '5' or '50'. Default 0 (disabled).\n"); + H0(" --dolby-vision-profile <float|integer> Specifies Dolby Vision profile ID. Currently only profile 5 and profile 8.1 enabled. Specified as '5' or '50'. Default 0 (disabled).\n"); H0(" --dolby-vision-rpu <filename> File containing Dolby Vision RPU metadata.\n" " If given, x265's Dolby Vision metadata parser will fill the RPU field of input pictures with the metadata read from the file. Default NULL(disabled).\n"); H0(" --nalu-file <filename> Text file containing SEI messages in the following format : <POC><space><PREFIX><space><NAL UNIT TYPE>/<SEI TYPE><space><SEI Payload>\n");
x265-1.patch
Description: Binary data
_______________________________________________ x265-devel mailing list x265-devel@videolan.org https://mailman.videolan.org/listinfo/x265-devel