Skip to content
This repository was archived by the owner on Jul 29, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
808457f
Add CLI support for vbv
bhavnahariMCW Dec 11, 2018
de97249
Enable vbv for abr mode
bhavnahariMCW Dec 18, 2018
488721b
Added VBV frame level support
dinesh0603 Jan 8, 2019
8f74ea2
1. Fixed Index comparision to compare with current Index + lookAheadD…
dinesh0603 Jan 22, 2019
8f3b2a4
Enforce vbv buffer update to happen in decode order
kirithika7 Jan 23, 2019
f1e1a17
Add new cli -hrd (default 0) + enable flags to signal hrd
kirithika7 Jan 23, 2019
8c2f324
Add support for HRD SEI signalling
kirithika7 Jan 24, 2019
bfd35f2
Add support for Active Parameter Set SEI
kirithika7 Jan 30, 2019
38b744d
Control VBV bufferFill access using mutex
arunaMathes Jan 25, 2019
853a45e
Add cli -vbv-init and remove hard-coded vbv buffer initialization
arunaMathes Jan 31, 2019
87f7729
If rate control is ON, base layer picture will not be processed until…
anaghdin Jan 27, 2019
708bd26
VBV Code clean up and made VBV as function call
dinesh0603 Feb 18, 2019
32dc411
Fix for the deadlock encoding frames fewer than 48
anaghdin Feb 18, 2019
88d1bef
Move vbv algorithm before using picture Qp for other RC context updates
kirithika7 Feb 22, 2019
f4d19b8
Fix Warning: When NAL Unit is non-VCL NAL, TemporalId shall be greate…
kirithika7 Feb 22, 2019
cddec5a
Fix bug:The value of rbsp_stop_one_bit shall be equal to 1 in vps
kirithika7 Feb 25, 2019
96524c4
Fix cbr signalling
kirithika7 Feb 26, 2019
a199b68
Fix Hrd Issue
kirithika7 Feb 27, 2019
e692a04
Fix uninitialized BPnumber value error when hrd is disabled
kirithika7 Feb 28, 2019
c8a7166
Fix Hrd signalling for fixed GOP length
kirithika7 Feb 28, 2019
54eceb4
-Fix 1. encoded bitrate will be within target Bitrate limit 2. previo…
dinesh0603 Mar 5, 2019
429edb5
Add code to copy the pcs context into the Packetization Reorder Queue…
kirithika7 Mar 12, 2019
d857190
Add code to splice the bitstream and insert pic timing SEI
kirithika7 Mar 12, 2019
0d74be5
Fix bugs and cleanup
kirithika7 Mar 12, 2019
22f80ea
Refactor byte shifting code with memcpy+cleanup
kirithika7 Mar 13, 2019
5f52a2f
Add support for strict cbr to prevent hrd buffer overflow
kirithika7 Mar 13, 2019
dd24050
Add code to consider filler bits for RC
kirithika7 Mar 13, 2019
713643e
Merged Master to VBV-DEV branch
dinesh0603 Mar 19, 2019
6311c66
Merge branch 'master' tip into vbv_dev
dinesh0603 Mar 20, 2019
f268574
Update the filler bit error in the packetization feedback to rate con…
kirithika7 Mar 21, 2019
f1cd4c5
Added feedback from packetization to picturemanager to address a dead…
anaghdin Mar 26, 2019
0b1103a
Fix the demux port
anaghdin Mar 27, 2019
494cb24
update the pictureDemuxResultsProducerFifoPtrArray ports
anaghdin Mar 27, 2019
7b70491
Revert the feedback of filler bits error to GOP's virtual Buffer level
kirithika7 Mar 27, 2019
ac9484a
Remove the macro PACK_FEEDBACK
anaghdin Mar 27, 2019
07c3947
Fix for deadlock when vbv is not enabled
kirithika7 Mar 29, 2019
3df55f3
Fix compiler warnings
kirithika7 Mar 29, 2019
707e8fd
Merge branch 'vbv_dev' of https://bitbucket.org/multicoreware/svt-hev…
dinesh0603 Apr 1, 2019
e3b304d
Fix for Final Bitrate is greater than TBR in Strict CBR
dinesh0603 Apr 4, 2019
c009338
Merge branch 'vbv_dev' of https://bitbucket.org/multicoreware/svt-hev…
dinesh0603 Apr 4, 2019
28ae9ae
1.Removed Duplicte code
dinesh0603 Apr 22, 2019
3854916
Merge branch 'master' (Till commit : 2bdfb22) into vbv_dev
dinesh0603 Apr 23, 2019
9db1593
- Updated Sample.cfg for added cli's and Readme
dinesh0603 Apr 24, 2019
0caa1cc
-Modified code as per review comments & coding guidelines
dinesh0603 Apr 25, 2019
5f6db73
Merge branch 'master' into vbv_dev
tianjunwork Apr 30, 2019
5d0af0f
-Modified code as per coding Guidelines
dinesh0603 May 8, 2019
3ad1f46
Merge branch 'master' into vbv_dev
dinesh0603 May 9, 2019
f6482fd
Fix for Deadlock
May 9, 2019
67f68d8
-Modified code as per review comments and coding guidelines
dinesh0603 May 13, 2019
742f9ca
-Removed Duplicate code (encMode) in EbAppConfig.c and Modified code …
dinesh0603 May 13, 2019
a0bceeb
Fixed hrd 1 crash issues caused by writeUvlc long bits, memmove and
Jun 11, 2019
575a4b8
Merge pull request #1 from kelvin412/vbv_dev_crash
dinesh0603 Jun 11, 2019
0acc25b
Fix HRD initialization in packetization
kavithasampath Jun 26, 2019
3b9a0fc
Fix encoder crash with intra period 0
snehaa8 Jun 26, 2019
40bbea8
Merge branch 'master' of https://github.com/OpenVisualCloud/SVT-HEVC …
kirithika7 Jul 19, 2019
2f9c396
Cleanup
kirithika7 Jul 19, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Added feedback from packetization to picturemanager to address a dead…
…lock. Deadlock was due to base layer pictures waiting for the previous one.

Once testing is done, I will removed the macros
  • Loading branch information
anaghdin committed Mar 26, 2019
commit f1cd4c53e18fd25ffad9b5d8a5e871e70cb38e18
2 changes: 1 addition & 1 deletion Source/Lib/Codec/EbDefinitions.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#ifdef __cplusplus
extern "C" {
#endif

#define PACK_FEEDBACK 1
// Internal Marcos
#define NON_AVX512_SUPPORT

Expand Down
10 changes: 9 additions & 1 deletion Source/Lib/Codec/EbEncHandle.c
Original file line number Diff line number Diff line change
Expand Up @@ -1127,7 +1127,11 @@ EB_API EB_ERRORTYPE EbInitEncoder(EB_COMPONENTTYPE *h265EncComponent)
return_error = EbSystemResourceCtor(
&encHandlePtr->pictureDemuxResultsResourcePtr,
encHandlePtr->sequenceControlSetInstanceArray[0]->sequenceControlSetPtr->pictureDemuxFifoInitCount,
#if PACK_FEEDBACK
encHandlePtr->sequenceControlSetInstanceArray[0]->sequenceControlSetPtr->sourceBasedOperationsProcessInitCount + encHandlePtr->sequenceControlSetInstanceArray[0]->sequenceControlSetPtr->encDecProcessInitCount + 1, // 1 for packetization
#else
encHandlePtr->sequenceControlSetInstanceArray[0]->sequenceControlSetPtr->sourceBasedOperationsProcessInitCount + encHandlePtr->sequenceControlSetInstanceArray[0]->sequenceControlSetPtr->encDecProcessInitCount,
#endif
EB_PictureManagerProcessInitCount,
&encHandlePtr->pictureDemuxResultsProducerFifoPtrArray,
&encHandlePtr->pictureDemuxResultsConsumerFifoPtrArray,
Expand Down Expand Up @@ -1446,7 +1450,11 @@ 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)]
#if PACK_FEEDBACK
,encHandlePtr->pictureDemuxResultsProducerFifoPtrArray[encHandlePtr->sequenceControlSetInstanceArray[0]->sequenceControlSetPtr->sourceBasedOperationsProcessInitCount + encHandlePtr->sequenceControlSetInstanceArray[0]->sequenceControlSetPtr->encDecProcessInitCount] // Add port lookup logic here JMJ
#endif
);

if (return_error == EB_ErrorInsufficientResources){
return EB_ErrorInsufficientResources;
Expand Down
43 changes: 40 additions & 3 deletions Source/Lib/Codec/EbPacketizationProcess.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
#include "EbRateControlTasks.h"
#include "EbRateControlProcess.h"
#include "EbTime.h"
#if PACK_FEEDBACK
#include "EbPictureDemuxResults.h"
#endif

void HrdFullness(SequenceControlSet_t *sequenceControlSetPtr, PictureControlSet_t *pictureControlSetptr, AppBufferingPeriodSei_t *seiBP)
{
Expand Down Expand Up @@ -95,14 +98,21 @@ void InitHRD(SequenceControlSet_t *scsPtr)
EB_ERRORTYPE PacketizationContextCtor(
PacketizationContext_t **contextDblPtr,
EbFifo_t *entropyCodingInputFifoPtr,
EbFifo_t *rateControlTasksOutputFifoPtr)
EbFifo_t *rateControlTasksOutputFifoPtr
#if PACK_FEEDBACK
,EbFifo_t *pictureManagerOutputFifoPtr
#endif
)
{
PacketizationContext_t *contextPtr;
EB_MALLOC(PacketizationContext_t*, contextPtr, sizeof(PacketizationContext_t), EB_N_PTR);
*contextDblPtr = contextPtr;

contextPtr->entropyCodingInputFifoPtr = entropyCodingInputFifoPtr;
contextPtr->rateControlTasksOutputFifoPtr = rateControlTasksOutputFifoPtr;
#if PACK_FEEDBACK
contextPtr->pictureManagerOutputFifoPtr = pictureManagerOutputFifoPtr;
#endif

EB_MALLOC(EbPPSConfig_t*, contextPtr->ppsConfig, sizeof(EbPPSConfig_t), EB_N_PTR);

Expand Down Expand Up @@ -131,7 +141,10 @@ void* PacketizationKernel(void *inputPtr)
EB_BUFFERHEADERTYPE *outputStreamPtr;
EbObjectWrapper_t *rateControlTasksWrapperPtr;
RateControlTasks_t *rateControlTasksPtr;

#if PACK_FEEDBACK
EbObjectWrapper_t *pictureManagerResultsWrapperPtr;
PictureDemuxResults_t *pictureManagerResultPtr;
#endif
// Bitstream copy to output buffer
Bitstream_t bitstream;

Expand Down Expand Up @@ -197,7 +210,25 @@ void* PacketizationKernel(void *inputPtr)
rateControlTasksPtr = (RateControlTasks_t*) rateControlTasksWrapperPtr->objectPtr;
rateControlTasksPtr->pictureControlSetWrapperPtr = pictureControlSetPtr->PictureParentControlSetWrapperPtr;
rateControlTasksPtr->taskType = RC_PACKETIZATION_FEEDBACK_RESULT;


#if PACK_FEEDBACK
if (sequenceControlSetPtr->staticConfig.rateControlMode) {
// Get Empty Results Object
EbGetEmptyObject(
contextPtr->pictureManagerOutputFifoPtr,
&pictureManagerResultsWrapperPtr);

pictureManagerResultPtr = (PictureDemuxResults_t*)pictureManagerResultsWrapperPtr->objectPtr;
pictureManagerResultPtr->pictureNumber = pictureControlSetPtr->pictureNumber;
pictureManagerResultPtr->pictureType = EB_PIC_FEEDBACK;
pictureManagerResultPtr->sequenceControlSetWrapperPtr = pictureControlSetPtr->sequenceControlSetWrapperPtr;
}
else {
pictureManagerResultsWrapperPtr = EB_NULL;
(void) pictureManagerResultPtr;
(void)pictureManagerResultsWrapperPtr;
}
#endif
sliceType = pictureControlSetPtr->sliceType;

if(pictureControlSetPtr->pictureNumber == 0 && sequenceControlSetPtr->staticConfig.codeVpsSpsPps == 1) {
Expand Down Expand Up @@ -718,6 +749,12 @@ void* PacketizationKernel(void *inputPtr)
// Post Rate Control Taks
EbPostFullObject(rateControlTasksWrapperPtr);

#if PACK_FEEDBACK
if (sequenceControlSetPtr->staticConfig.rateControlMode) {
// Post the Full Results Object
EbPostFullObject(pictureManagerResultsWrapperPtr);
}
#endif
//Release the Parent PCS then the Child PCS
EbReleaseObject(entropyCodingResultsPtr->pictureControlSetWrapperPtr);//Child

Expand Down
9 changes: 8 additions & 1 deletion Source/Lib/Codec/EbPacketizationProcess.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ typedef struct PacketizationContext_s
EbFifo_t *entropyCodingInputFifoPtr;
EbFifo_t *rateControlTasksOutputFifoPtr;
EbPPSConfig_t *ppsConfig;
#if PACK_FEEDBACK
EbFifo_t *pictureManagerOutputFifoPtr; // to picture-manager
#endif

} PacketizationContext_t;

Expand All @@ -39,7 +42,11 @@ typedef struct PacketizationContext_s
extern EB_ERRORTYPE PacketizationContextCtor(
PacketizationContext_t **contextDblPtr,
EbFifo_t *entropyCodingInputFifoPtr,
EbFifo_t *rateControlTasksOutputFifoPtr);
EbFifo_t *rateControlTasksOutputFifoPtr
#if PACK_FEEDBACK
, EbFifo_t *pictureManagerOutputFifoPtr
#endif
);


extern void* PacketizationKernel(void *inputPtr);
Expand Down
3 changes: 3 additions & 0 deletions Source/Lib/Codec/EbPictureDemuxResults.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ typedef enum EB_PIC_TYPE {
EB_PIC_INVALID = 0,
EB_PIC_INPUT = 1,
EB_PIC_REFERENCE = 2
#if PACK_FEEDBACK
,EB_PIC_FEEDBACK = 3
#endif
} EB_PIC_TYPE;

/**************************************
Expand Down
36 changes: 32 additions & 4 deletions Source/Lib/Codec/EbPictureManagerProcess.c
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,35 @@ void* PictureManagerKernel(void *inputPtr)
EbReleaseObject(inputPictureDemuxPtr->sequenceControlSetWrapperPtr);

break;

#if PACK_FEEDBACK
case EB_PIC_FEEDBACK:

sequenceControlSetPtr = (SequenceControlSet_t*)inputPictureDemuxPtr->sequenceControlSetWrapperPtr->objectPtr;
encodeContextPtr = sequenceControlSetPtr->encodeContextPtr;

referenceQueueIndex = encodeContextPtr->referencePictureQueueHeadIndex;
// Find the Reference in the Reference Queue
do {

referenceEntryPtr = encodeContextPtr->referencePictureQueue[referenceQueueIndex];

if (referenceEntryPtr->pictureNumber == inputPictureDemuxPtr->pictureNumber) {

// Set the feedback arrived
referenceEntryPtr->feedbackArrived = EB_TRUE;
}

// Increment the referenceQueueIndex Iterator
referenceQueueIndex = (referenceQueueIndex == REFERENCE_QUEUE_MAX_DEPTH - 1) ? 0 : referenceQueueIndex + 1;

} while ((referenceQueueIndex != encodeContextPtr->referencePictureQueueTailIndex) && (referenceEntryPtr->pictureNumber != inputPictureDemuxPtr->pictureNumber));

//keep the relase of SCS here because we still need the encodeContext strucutre here
// Release the Reference's SequenceControlSet
EbReleaseObject(inputPictureDemuxPtr->sequenceControlSetWrapperPtr);

break;
#endif
default:

sequenceControlSetPtr = (SequenceControlSet_t*) inputPictureDemuxPtr->sequenceControlSetWrapperPtr->objectPtr;
Expand Down Expand Up @@ -585,7 +613,7 @@ void* PictureManagerKernel(void *inputPtr)
availabilityFlag =
(availabilityFlag == EB_FALSE) ? EB_FALSE : // Don't update if already False
(refPoc > currentInputPoc) ? EB_FALSE : // The Reference has not been received as an Input Picture yet, then its availability is false
(!encodeContextPtr->terminatingSequenceFlagReceived && (sequenceControlSetPtr->staticConfig.rateControlMode && entryPictureControlSetPtr->sliceType != EB_I_PICTURE && entryPictureControlSetPtr->temporalLayerIndex == 0 && !referenceEntryPtr->feedbackArrived)) ? EB_FALSE :
(!encodeContextPtr->terminatingSequenceFlagReceived && (entrySequenceControlSetPtr->staticConfig.rateControlMode && entryPictureControlSetPtr->sliceType != EB_I_PICTURE && entryPictureControlSetPtr->temporalLayerIndex == 0 && !referenceEntryPtr->feedbackArrived)) ? EB_FALSE :
(referenceEntryPtr->referenceAvailable) ? EB_TRUE : // The Reference has been completed
EB_FALSE; // The Reference has not been completed
}
Expand Down Expand Up @@ -622,7 +650,7 @@ void* PictureManagerKernel(void *inputPtr)
availabilityFlag =
(availabilityFlag == EB_FALSE) ? EB_FALSE : // Don't update if already False
(refPoc > currentInputPoc) ? EB_FALSE : // The Reference has not been received as an Input Picture yet, then its availability is false
(!encodeContextPtr->terminatingSequenceFlagReceived && (sequenceControlSetPtr->staticConfig.rateControlMode && entryPictureControlSetPtr->sliceType != EB_I_PICTURE && entryPictureControlSetPtr->temporalLayerIndex == 0 && !referenceEntryPtr->feedbackArrived)) ? EB_FALSE :
(!encodeContextPtr->terminatingSequenceFlagReceived && (entrySequenceControlSetPtr->staticConfig.rateControlMode && entryPictureControlSetPtr->sliceType != EB_I_PICTURE && entryPictureControlSetPtr->temporalLayerIndex == 0 && !referenceEntryPtr->feedbackArrived)) ? EB_FALSE :
(referenceEntryPtr->referenceAvailable) ? EB_TRUE : // The Reference has been completed
EB_FALSE; // The Reference has not been completed
}
Expand Down Expand Up @@ -718,7 +746,7 @@ void* PictureManagerKernel(void *inputPtr)
ChildPictureControlSetPtr->useDeltaQp = (EB_U8)(entrySequenceControlSetPtr->staticConfig.improveSharpness || entrySequenceControlSetPtr->staticConfig.bitRateReduction);

// Check resolution
if (sequenceControlSetPtr->inputResolution < INPUT_SIZE_1080p_RANGE)
if (entrySequenceControlSetPtr->inputResolution < INPUT_SIZE_1080p_RANGE)
ChildPictureControlSetPtr->difCuDeltaQpDepth = 2;
else
ChildPictureControlSetPtr->difCuDeltaQpDepth = 3;
Expand Down
4 changes: 2 additions & 2 deletions Source/Lib/Codec/EbRateControlProcess.c
Original file line number Diff line number Diff line change
Expand Up @@ -2676,7 +2676,7 @@ void* RateControlKernel(void *inputPtr)

// Update feedback arrived in referencepictureQueue
// printf("RC FEEDBACK ARRIVED %d\n", (int)parentPictureControlSetPtr->pictureNumber);

#if !PACK_FEEDBACK
ReferenceQueueEntry_t *referenceEntryPtr;
EB_U32 referenceQueueIndex;
encodeContextPtr = sequenceControlSetPtr->encodeContextPtr;
Expand All @@ -2696,7 +2696,7 @@ void* RateControlKernel(void *inputPtr)
referenceQueueIndex = (referenceQueueIndex == REFERENCE_QUEUE_MAX_DEPTH - 1) ? 0 : referenceQueueIndex + 1;

} while ((referenceQueueIndex != encodeContextPtr->referencePictureQueueTailIndex) && (referenceEntryPtr->pictureNumber != parentPictureControlSetPtr->pictureNumber));

#endif
// Frame level RC
if (sequenceControlSetPtr->intraPeriodLength == -1 || sequenceControlSetPtr->staticConfig.rateControlMode == 0){
rateControlParamPtr = contextPtr->rateControlParamQueue[0];
Expand Down
18 changes: 17 additions & 1 deletion Source/Lib/Codec/EbResourceCoordinationProcess.c
Original file line number Diff line number Diff line change
Expand Up @@ -588,13 +588,29 @@ void* ResourceCoordinationKernel(void *inputPtr)

}
EbReleaseMutex(contextPtr->sequenceControlSetInstanceArray[instanceIndex]->configMutex);
#if PACK_FEEDBACK
if (sequenceControlSetPtr->staticConfig.rateControlMode) {
// Sequence Control Set is released by Rate Control after passing through MDC->MD->ENCDEC->Packetization->RateControl
// ,in the PictureManager after receiving the reference and in PictureManager after receiving the feedback
EbObjectIncLiveCount(
contextPtr->sequenceControlSetActiveArray[instanceIndex],
3);
}
else {
// Sequence Control Set is released by Rate Control after passing through MDC->MD->ENCDEC->Packetization->RateControl
// and in the PictureManager
EbObjectIncLiveCount(
contextPtr->sequenceControlSetActiveArray[instanceIndex],
2);

}
#else
// Sequence Control Set is released by Rate Control after passing through MDC->MD->ENCDEC->Packetization->RateControl
// and in the PictureManager
EbObjectIncLiveCount(
contextPtr->sequenceControlSetActiveArray[instanceIndex],
2);

#endif
// Set the current SequenceControlSet
sequenceControlSetPtr = (SequenceControlSet_t*) contextPtr->sequenceControlSetActiveArray[instanceIndex]->objectPtr;

Expand Down
1 change: 0 additions & 1 deletion Source/Lib/Codec/EbSequenceControlSet.c
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,6 @@ EB_ERRORTYPE EbSequenceControlSetCtor(
sequenceControlSetPtr->enableStrongIntraSmoothing = EB_TRUE;

// Rate Control
sequenceControlSetPtr->rateControlMode = 0;
sequenceControlSetPtr->targetBitrate = 0x1000;
sequenceControlSetPtr->availableBandwidth = 0x1000;

Expand Down
1 change: 0 additions & 1 deletion Source/Lib/Codec/EbSequenceControlSet.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ typedef struct SequenceControlSet_s
EB_U32 generalFrameOnlyConstraintFlag;

// Rate Control
EB_U32 rateControlMode;
EB_U32 targetBitrate;
EB_U32 availableBandwidth;

Expand Down