-
Notifications
You must be signed in to change notification settings - Fork 168
Vbv dev #155
Vbv dev #155
Changes from 45 commits
808457f
de97249
488721b
8f74ea2
8f3b2a4
f1e1a17
8c2f324
bfd35f2
38b744d
853a45e
87f7729
708bd26
32dc411
88d1bef
f4d19b8
cddec5a
96524c4
a199b68
e692a04
c8a7166
54eceb4
429edb5
d857190
0d74be5
22f80ea
5f52a2f
dd24050
713643e
6311c66
f268574
f1cd4c5
0b1103a
494cb24
7b70491
ac9484a
07c3947
3df55f3
707e8fd
e3b304d
c009338
28ae9ae
3854916
9db1593
0caa1cc
5f6db73
5d0af0f
3ad1f46
f6482fd
67f68d8
742f9ca
a0bceeb
575a4b8
0acc25b
3b9a0fc
40bbea8
2f9c396
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -84,6 +84,10 @@ | |
| #define NALU_FILE_TOKEN "-nalu-file" | ||
| #define RATE_CONTROL_ENABLE_TOKEN "-rc" | ||
| #define TARGET_BIT_RATE_TOKEN "-tbr" | ||
| #define VBV_MAX_RATE_TOKEN "-vbv-maxrate" | ||
| #define VBV_BUFFER_SIZE_TOKEN "-vbv-bufsize" | ||
| #define VBV_BUFFER_INIT_TOKEN "-vbv-init" | ||
| #define HRD_TOKEN "-hrd" | ||
| #define MAX_QP_TOKEN "-max-qp" | ||
| #define MIN_QP_TOKEN "-min-qp" | ||
| #define TEMPORAL_ID "-temporal-id" // no Eval | ||
|
|
@@ -204,6 +208,10 @@ static void SetEnableConstrainedIntra (const char *value, EbConfig_t * | |
| static void SetCfgTune (const char *value, EbConfig_t *cfg) {cfg->tune = (uint8_t)strtoul(value, NULL, 0); }; | ||
| static void SetBitRateReduction (const char *value, EbConfig_t *cfg) {cfg->bitRateReduction = (EB_BOOL)strtol(value, NULL, 0); }; | ||
| static void SetImproveSharpness (const char *value, EbConfig_t *cfg) {cfg->improveSharpness = (EB_BOOL)strtol(value, NULL, 0);}; | ||
| static void SetVbvMaxrate (const char *value, EbConfig_t *cfg) { cfg->vbvMaxRate = strtoul(value, NULL, 0);}; | ||
| static void SetVbvBufsize (const char *value, EbConfig_t *cfg) { cfg->vbvBufsize = strtoul(value, NULL, 0);}; | ||
| static void SetVbvBufInit (const char *value, EbConfig_t *cfg) { cfg->vbvBufInit = strtoul(value, NULL, 0);}; | ||
| static void SetHrdFlag (const char *value, EbConfig_t *cfg) { cfg->hrdFlag = strtoul(value, NULL, 0);}; | ||
| static void SetVideoUsabilityInfo (const char *value, EbConfig_t *cfg) {cfg->videoUsabilityInfo = strtol(value, NULL, 0);}; | ||
| static void SetHighDynamicRangeInput (const char *value, EbConfig_t *cfg) {cfg->highDynamicRangeInput = strtol(value, NULL, 0);}; | ||
| static void SetAccessUnitDelimiter (const char *value, EbConfig_t *cfg) {cfg->accessUnitDelimiter = strtol(value, NULL, 0);}; | ||
|
|
@@ -321,7 +329,18 @@ config_entry_t config_entry[] = { | |
|
|
||
| // Quantization | ||
| { SINGLE_INPUT, QP_TOKEN, "QP", SetCfgQp }, | ||
| { SINGLE_INPUT, USE_QP_FILE_TOKEN, "UseQpFile", SetCfgUseQpFile }, | ||
|
||
| { SINGLE_INPUT, RATE_CONTROL_ENABLE_TOKEN, "RateControlMode", SetRateControlMode }, | ||
| { SINGLE_INPUT, LOOK_AHEAD_DIST_TOKEN, "LookAheadDistance", SetLookAheadDistance}, | ||
| { SINGLE_INPUT, TARGET_BIT_RATE_TOKEN, "TargetBitRate", SetTargetBitRate }, | ||
|
||
| { SINGLE_INPUT, MAX_QP_TOKEN, "MaxQpAllowed", SetMaxQpAllowed }, | ||
| { SINGLE_INPUT, MIN_QP_TOKEN, "MinQpAllowed", SetMinQpAllowed }, | ||
| { SINGLE_INPUT, VBV_MAX_RATE_TOKEN, "vbvMaxRate", SetVbvMaxrate }, | ||
| { SINGLE_INPUT, VBV_BUFFER_SIZE_TOKEN, "vbvBufsize", SetVbvBufsize }, | ||
| { SINGLE_INPUT, HRD_TOKEN, "hrd", SetHrdFlag }, | ||
| { SINGLE_INPUT, VBV_BUFFER_INIT_TOKEN, "vbvBufInit", SetVbvBufInit}, | ||
|
|
||
|
|
||
| // Deblock Filter | ||
| { SINGLE_INPUT, LOOP_FILTER_DISABLE_TOKEN, "LoopFilterDisable", SetDisableDlfFlag }, | ||
|
|
||
|
|
@@ -424,6 +443,10 @@ void EbConfigCtor(EbConfig_t *configPtr) | |
| configPtr->minQpAllowed = 10; | ||
| configPtr->baseLayerSwitchMode = 0; | ||
| configPtr->encMode = 9; | ||
| configPtr->vbvMaxRate = 0; | ||
| configPtr->vbvBufsize = 0; | ||
| configPtr->vbvBufInit = 90; | ||
| configPtr->hrdFlag = 0; | ||
| configPtr->intraPeriod = -2; | ||
| configPtr->intraRefreshType = 1; | ||
| configPtr->hierarchicalLevels = 3; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1120,7 +1120,7 @@ EB_API EB_ERRORTYPE EbInitEncoder(EB_COMPONENTTYPE *h265EncComponent) | |
| return_error = EbSystemResourceCtor( | ||
| &encHandlePtr->pictureDemuxResultsResourcePtr, | ||
| encHandlePtr->sequenceControlSetInstanceArray[0]->sequenceControlSetPtr->pictureDemuxFifoInitCount, | ||
| encHandlePtr->sequenceControlSetInstanceArray[0]->sequenceControlSetPtr->sourceBasedOperationsProcessInitCount + encHandlePtr->sequenceControlSetInstanceArray[0]->sequenceControlSetPtr->encDecProcessInitCount, | ||
| encHandlePtr->sequenceControlSetInstanceArray[0]->sequenceControlSetPtr->sourceBasedOperationsProcessInitCount + encHandlePtr->sequenceControlSetInstanceArray[0]->sequenceControlSetPtr->encDecProcessInitCount + 1, // 1 for packetization | ||
| EB_PictureManagerProcessInitCount, | ||
| &encHandlePtr->pictureDemuxResultsProducerFifoPtrArray, | ||
| &encHandlePtr->pictureDemuxResultsConsumerFifoPtrArray, | ||
|
|
@@ -1412,7 +1412,7 @@ EB_API EB_ERRORTYPE EbInitEncoder(EB_COMPONENTTYPE *h265EncComponent) | |
| encHandlePtr->encDecTasksConsumerFifoPtrArray[processIndex], | ||
| encHandlePtr->encDecResultsProducerFifoPtrArray[processIndex], | ||
| encHandlePtr->encDecTasksProducerFifoPtrArray[EncDecPortLookup(ENCDEC_INPUT_PORT_ENCDEC, processIndex)], | ||
| encHandlePtr->pictureDemuxResultsProducerFifoPtrArray[1 + processIndex], // Add port lookup logic here JMJ | ||
| encHandlePtr->pictureDemuxResultsProducerFifoPtrArray[encHandlePtr->sequenceControlSetInstanceArray[0]->sequenceControlSetPtr->sourceBasedOperationsProcessInitCount + processIndex], // Add port lookup logic here JMJ | ||
| is16bit, | ||
| (EB_COLOR_FORMAT)encHandlePtr->sequenceControlSetInstanceArray[0]->sequenceControlSetPtr->chromaFormatIdc); | ||
| if (return_error == EB_ErrorInsufficientResources){ | ||
|
|
@@ -1439,7 +1439,9 @@ EB_API EB_ERRORTYPE EbInitEncoder(EB_COMPONENTTYPE *h265EncComponent) | |
| return_error = PacketizationContextCtor( | ||
| (PacketizationContext_t**) &encHandlePtr->packetizationContextPtr, | ||
| encHandlePtr->entropyCodingResultsConsumerFifoPtrArray[0], | ||
| encHandlePtr->rateControlTasksProducerFifoPtrArray[RateControlPortLookup(RATE_CONTROL_INPUT_PORT_PACKETIZATION, 0)]); | ||
| encHandlePtr->rateControlTasksProducerFifoPtrArray[RateControlPortLookup(RATE_CONTROL_INPUT_PORT_PACKETIZATION, 0)], | ||
| encHandlePtr->pictureDemuxResultsProducerFifoPtrArray[encHandlePtr->sequenceControlSetInstanceArray[0]->sequenceControlSetPtr->sourceBasedOperationsProcessInitCount + encHandlePtr->sequenceControlSetInstanceArray[0]->sequenceControlSetPtr->encDecProcessInitCount] // Add port lookup logic here JMJ | ||
| ); | ||
|
|
||
| if (return_error == EB_ErrorInsufficientResources){ | ||
| return EB_ErrorInsufficientResources; | ||
|
|
@@ -2107,6 +2109,9 @@ void CopyApiFromApp( | |
| // Rate Control | ||
| sequenceControlSetPtr->staticConfig.sceneChangeDetection = ((EB_H265_ENC_CONFIGURATION*)pComponentParameterStructure)->sceneChangeDetection; | ||
| sequenceControlSetPtr->staticConfig.rateControlMode = ((EB_H265_ENC_CONFIGURATION*)pComponentParameterStructure)->rateControlMode; | ||
| sequenceControlSetPtr->staticConfig.vbvMaxrate = ((EB_H265_ENC_CONFIGURATION*)pComponentParameterStructure)->vbvMaxrate; | ||
| sequenceControlSetPtr->staticConfig.vbvBufsize = ((EB_H265_ENC_CONFIGURATION*)pComponentParameterStructure)->vbvBufsize; | ||
| sequenceControlSetPtr->staticConfig.vbvBufInit = ((EB_H265_ENC_CONFIGURATION*)pComponentParameterStructure)->vbvBufInit; | ||
| sequenceControlSetPtr->staticConfig.lookAheadDistance = ((EB_H265_ENC_CONFIGURATION*)pComponentParameterStructure)->lookAheadDistance; | ||
| sequenceControlSetPtr->staticConfig.framesToBeEncoded = ((EB_H265_ENC_CONFIGURATION*)pComponentParameterStructure)->framesToBeEncoded; | ||
|
|
||
|
|
@@ -2161,9 +2166,9 @@ void CopyApiFromApp( | |
| sequenceControlSetPtr->staticConfig.frameRateDenominator = ((EB_H265_ENC_CONFIGURATION*)pComponentParameterStructure)->frameRateDenominator; | ||
| sequenceControlSetPtr->staticConfig.frameRateNumerator = ((EB_H265_ENC_CONFIGURATION*)pComponentParameterStructure)->frameRateNumerator; | ||
| sequenceControlSetPtr->staticConfig.reconEnabled = ((EB_H265_ENC_CONFIGURATION*)pComponentParameterStructure)->reconEnabled; | ||
| sequenceControlSetPtr->staticConfig.hrdFlag = ((EB_H265_ENC_CONFIGURATION*)pComponentParameterStructure)->hrdFlag; | ||
| sequenceControlSetPtr->staticConfig.unrestrictedMotionVector = ((EB_H265_ENC_CONFIGURATION*)pComponentParameterStructure)->unrestrictedMotionVector; | ||
| sequenceControlSetPtr->enableTmvpSps = sequenceControlSetPtr->staticConfig.unrestrictedMotionVector; | ||
|
|
||
| sequenceControlSetPtr->staticConfig.maxCLL = ((EB_H265_ENC_CONFIGURATION*)pComponentParameterStructure)->maxCLL; | ||
| sequenceControlSetPtr->staticConfig.maxFALL = ((EB_H265_ENC_CONFIGURATION*)pComponentParameterStructure)->maxFALL; | ||
|
|
||
|
|
@@ -2218,9 +2223,15 @@ void CopyApiFromApp( | |
| sequenceControlSetPtr->staticConfig.lookAheadDistance = ComputeDefaultLookAhead(&sequenceControlSetPtr->staticConfig); | ||
| } | ||
|
|
||
|
|
||
|
|
||
|
|
||
| //Set required flags to signal vbv status when hrd is enabled | ||
| if (sequenceControlSetPtr->staticConfig.hrdFlag == 1) { | ||
| sequenceControlSetPtr->staticConfig.videoUsabilityInfo = 1; | ||
|
||
| sequenceControlSetPtr->videoUsabilityInfoPtr->vuiHrdParametersPresentFlag = 1; | ||
| sequenceControlSetPtr->staticConfig.bufferingPeriodSEI = 1; | ||
| sequenceControlSetPtr->staticConfig.pictureTimingSEI = 1; | ||
| sequenceControlSetPtr->videoUsabilityInfoPtr->hrdParametersPtr->nalHrdParametersPresentFlag = 1; | ||
| sequenceControlSetPtr->videoUsabilityInfoPtr->hrdParametersPtr->cpbDpbDelaysPresentFlag = 1; | ||
| } | ||
| return; | ||
| } | ||
|
|
||
|
|
@@ -2507,6 +2518,16 @@ static EB_ERRORTYPE VerifySettings(\ | |
| return_error = EB_ErrorBadParameter; | ||
| } | ||
|
|
||
| if (config->hrdFlag > 1) { | ||
| SVT_LOG("SVT [Error]: Instance %u: hrdFlag must be [0 - 1]\n", channelNumber + 1); | ||
| return_error = EB_ErrorBadParameter; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. please use "SVT_LOG("SVT [Error]:"
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please follow the coding style here.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Modified and pushed (Commit: 9db1593) |
||
| } | ||
|
|
||
| if (config->hrdFlag == 1 && ((config->vbvBufsize <= 0) || (config->vbvMaxrate <= 0))) { | ||
| SVT_LOG("SVT [Error]: Instance %u: hrd requires vbv max rate and vbv bufsize to be greater than 0 ", channelNumber + 1); | ||
| return_error = EB_ErrorBadParameter; | ||
| } | ||
|
|
||
| if ( config->enableSaoFlag > 1) { | ||
| SVT_LOG("SVT [Error]: Instance %u: Invalid SAO. SAO range must be [0 - 1]\n",channelNumber+1); | ||
| return_error = EB_ErrorBadParameter; | ||
|
|
@@ -2522,13 +2543,11 @@ static EB_ERRORTYPE VerifySettings(\ | |
| if ((config->searchAreaWidth > 256) || (config->searchAreaWidth == 0)){ | ||
| SVT_LOG("SVT [Error]: Instance %u: Invalid SearchAreaWidth. SearchAreaWidth must be [1 - 256]\n",channelNumber+1); | ||
| return_error = EB_ErrorBadParameter; | ||
|
|
||
| } | ||
|
|
||
| if((config->searchAreaHeight > 256) || (config->searchAreaHeight == 0)) { | ||
| SVT_LOG("SVT [Error]: Instance %u: Invalid SearchAreaHeight. SearchAreaHeight must be [1 - 256]\n",channelNumber+1); | ||
| return_error = EB_ErrorBadParameter; | ||
|
|
||
| } | ||
|
|
||
| if (levelIdx < 13) { | ||
|
|
@@ -2700,27 +2719,27 @@ static EB_ERRORTYPE VerifySettings(\ | |
| } | ||
|
|
||
| if ((config->maxCLL && !config->highDynamicRangeInput) || (config->maxFALL && !config->highDynamicRangeInput)) { | ||
| SVT_LOG("Error Instance %u: maxCLL or maxFALL should be used only with high dynamic range input; set highDynamicRangeInput to 1\n", channelNumber); | ||
| SVT_LOG("SVT [Error]: Instance %u: maxCLL or maxFALL should be used only with high dynamic range input; set highDynamicRangeInput to 1\n", channelNumber); | ||
| return_error = EB_ErrorBadParameter; | ||
| } | ||
|
|
||
| if (config->useMasteringDisplayColorVolume && !config->highDynamicRangeInput) { | ||
| SVT_LOG("Error Instance %u: MasterDisplay should be used only with high dynamic range input; set highDynamicRangeInput to 1\n", channelNumber); | ||
| SVT_LOG("SVT [Error]: Instance %u: MasterDisplay should be used only with high dynamic range input; set highDynamicRangeInput to 1\n", channelNumber); | ||
| return_error = EB_ErrorBadParameter; | ||
| } | ||
|
|
||
| if (config->dolbyVisionProfile != 0 && config->dolbyVisionProfile != 81) { | ||
| SVT_LOG("Error Instance %u: Only Dolby Vision Profile 8.1 is supported \n", channelNumber); | ||
| SVT_LOG("SVT [Error]: Instance %u: Only Dolby Vision Profile 8.1 is supported \n", channelNumber); | ||
| return_error = EB_ErrorBadParameter; | ||
| } | ||
|
|
||
| if (config->dolbyVisionProfile == 81 && config->encoderBitDepth != 10) { | ||
| SVT_LOG("Error Instance %u: Dolby Vision Profile 8.1 work only with main10 input \n", channelNumber); | ||
| SVT_LOG("SVT [Error]: Instance %u: Dolby Vision Profile 8.1 work only with main10 input \n", channelNumber); | ||
| return_error = EB_ErrorBadParameter; | ||
| } | ||
|
|
||
| if (config->dolbyVisionProfile == 81 && !config->useMasteringDisplayColorVolume) { | ||
| SVT_LOG("Error Instance %u: Dolby Vision Profile 8.1 requires mastering display color volume information \n", channelNumber); | ||
| SVT_LOG("SVT [Error]: Instance %u: Dolby Vision Profile 8.1 requires mastering display color volume information \n", channelNumber); | ||
| return_error = EB_ErrorBadParameter; | ||
| } | ||
|
|
||
|
|
@@ -2746,8 +2765,7 @@ static EB_ERRORTYPE VerifySettings(\ | |
| return_error = EB_ErrorBadParameter; | ||
| } | ||
|
|
||
| if (config->compressedTenBitFormat > 1) | ||
| { | ||
| if (config->compressedTenBitFormat > 1) { | ||
| SVT_LOG("SVT [Error]: Instance %u: Invalid Compressed Ten Bit Format shall be only [0 - 1] \n", channelNumber + 1); | ||
| return_error = EB_ErrorBadParameter; | ||
| } | ||
|
|
@@ -2782,6 +2800,11 @@ static EB_ERRORTYPE VerifySettings(\ | |
| return_error = EB_ErrorBadParameter; | ||
| } | ||
|
|
||
| if (config->vbvBufInit > 100) { | ||
| SVT_LOG("SVT [Error]: Instance %u: Invalid vbvBufInit [0 - 100]\n", channelNumber + 1); | ||
| return_error = EB_ErrorBadParameter; | ||
| } | ||
|
|
||
| if (config->tileColumnCount < 1) { | ||
| SVT_LOG("SVT [Error]: Instance %u : Invalid tile column count\n", channelNumber + 1); | ||
| return_error = EB_ErrorBadParameter; | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you also update sample.cfg? Thx.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated and pushed (Commit : 9db1593)