-
Notifications
You must be signed in to change notification settings - Fork 168
Vbv dev #155
Vbv dev #155
Changes from 41 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 |
|---|---|---|
| @@ -1,7 +1,9 @@ | ||
| # Scalable Video Technology for HEVC Encoder (SVT-HEVC Encoder) | ||
| [](https://ci.appveyor.com/project/openvisualcloud/SVT-HEVC) | ||
| [](https://travis-ci.com/OpenVisualCloud/SVT-HEVC) | ||
| [](https://coveralls.io/github/openvisualcloud/SVT-HEVC?branch=master) | ||
|
|
||
| [](https://ci.appveyor.com/project/intel/SVT-HEVC) | ||
|
||
| [](https://travis-ci.com/intel/SVT-HEVC) | ||
| [](https://coveralls.io/github/intel/SVT-HEVC?branch=master) | ||
|
|
||
|
|
||
| The Scalable Video Technology for HEVC Encoder (SVT-HEVC Encoder) is an HEVC-compliant encoder library core that achieves excellent density-quality tradeoffs, and is highly optimized for Intel® Xeon™ Scalable Processor and Xeon™ D processors. | ||
|
|
||
|
|
@@ -43,7 +45,9 @@ Scalable Video Technology is licensed under the OSI-approved BSD+Patent license. | |
| # Documentation | ||
|
|
||
| More details about the encoder usage can be found under: | ||
| - [svt-hevc-encoder-user-guide](Docs/svt-hevc_encoder_user_guide.md) | ||
|
|
||
| - [SVT-HEVC Encoder User Guide](Docs/svt-hevc_encoder_user_guide.md) | ||
|
|
||
|
||
|
|
||
| # System Requirements | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -505,7 +505,24 @@ typedef struct EB_H265_ENC_CONFIGURATION | |
| uint8_t fpsInVps; | ||
|
|
||
|
|
||
| // Application Specific parameters | ||
| // VBV Parameters | ||
| /* Sets the maximum rate the VBV buffer should be assumed to refill at | ||
| * Default is zero */ | ||
|
||
| uint32_t vbvMaxrate; | ||
| /* Sets the size of the VBV buffer in bits. | ||
| * Default is zero */ | ||
| uint32_t vbvBufsize; | ||
| /* Sets how full the VBV buffer must be before playback starts. If picture | ||
| * number is 0, then the initial fill is vbv-init * vbvBufferSize. | ||
| * Otherwise, it is interpreted as the initial fill in bits. | ||
| * Default is 90 */ | ||
| uint64_t vbvBufInit; | ||
|
|
||
| /* Enables the buffering period SEI and picture timing SEI to signal the HRD | ||
| * parameters. | ||
| *Default is disabled */ | ||
| uint32_t hrdFlag; | ||
|
|
||
|
|
||
| /* ID assigned to each channel when multiple instances are running within the | ||
| * same application. */ | ||
|
|
@@ -532,6 +549,7 @@ typedef struct EB_H265_ENC_CONFIGURATION | |
| * Default is -1. */ | ||
| int32_t targetSocket; | ||
|
|
||
|
|
||
|
||
| /* Flag to enable threads to real time priority. Running with sudo privilege | ||
| * utilizes full resource. Only applicable to Linux. | ||
| * | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -80,6 +80,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 | ||
|
|
@@ -195,6 +199,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);}; | ||
|
|
@@ -302,6 +310,10 @@ config_entry_t config_entry[] = { | |
| { 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}, | ||
|
|
||
| // DLF | ||
| { SINGLE_INPUT, LOOP_FILTER_DISABLE_TOKEN, "LoopFilterDisable", SetDisableDlfFlag }, | ||
|
|
@@ -410,6 +422,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 |
|---|---|---|
|
|
@@ -1127,7 +1127,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, | ||
|
|
@@ -1419,7 +1419,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){ | ||
|
|
@@ -1446,7 +1446,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; | ||
|
|
@@ -2091,6 +2093,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; | ||
|
|
||
|
|
@@ -2145,7 +2150,8 @@ 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.maxCLL = ((EB_H265_ENC_CONFIGURATION*)pComponentParameterStructure)->maxCLL; | ||
| sequenceControlSetPtr->staticConfig.maxFALL = ((EB_H265_ENC_CONFIGURATION*)pComponentParameterStructure)->maxFALL; | ||
|
|
||
|
|
@@ -2200,6 +2206,16 @@ 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; | ||
| } | ||
|
|
||
|
|
||
|
|
||
|
|
@@ -2489,6 +2505,18 @@ static EB_ERRORTYPE VerifySettings(\ | |
| return_error = EB_ErrorBadParameter; | ||
| } | ||
|
|
||
| if (config->hrdFlag > 1) | ||
| { | ||
| printf("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))) | ||
| { | ||
| printf("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; | ||
|
|
@@ -2764,6 +2792,10 @@ static EB_ERRORTYPE VerifySettings(\ | |
| return_error = EB_ErrorBadParameter; | ||
| } | ||
|
|
||
| if (config->vbvBufInit > 100) { | ||
| printf("Error instance %u: Invalid vbvBufInit [0 - 100]\n", channelNumber + 1); | ||
|
||
| return_error = EB_ErrorBadParameter; | ||
| } | ||
| return return_error; | ||
| } | ||
|
|
||
|
|
||
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)