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
Add support for HRD SEI signalling
  • Loading branch information
kirithika7 committed Jan 31, 2019
commit 8c2f324e346b400bb827d6fdc8ca142a8cb34b6b
3 changes: 3 additions & 0 deletions Source/Lib/Codec/EbDefinitions.h
Original file line number Diff line number Diff line change
Expand Up @@ -1045,6 +1045,9 @@ typedef enum EB_SEI {
#define LOW_LCU_VARIANCE 10
#define MEDIUM_LCU_VARIANCE 50

//HRD constants
#define BR_SHIFT 6
#define CPB_SHIFT 4

// INTRA restriction for global motion
#define INTRA_GLOBAL_MOTION_NON_MOVING_INDEX_TH 2
Expand Down
5 changes: 3 additions & 2 deletions Source/Lib/Codec/EbEntropyCoding.c
Original file line number Diff line number Diff line change
Expand Up @@ -7983,7 +7983,7 @@ EB_ERRORTYPE CodeBufferingPeriodSEI(
WriteCodeCavlc(
bitstreamPtr,
bufferingPeriodPtr->auCpbRemovalDelayDeltaMinus1,
vuiPtr->hrdParametersPtr->initialCpbRemovalDelayLengthMinus1 + 1);
vuiPtr->hrdParametersPtr->auCpbRemovalDelayLengthMinus1 + 1);

if (bufferingPeriodPtr->rapCpbParamsPresentFlag){
// cpb_delay_offset
Expand Down Expand Up @@ -8055,6 +8055,7 @@ EB_ERRORTYPE CodeBufferingPeriodSEI(
}



EB_ERRORTYPE CodePictureTimingSEI(
OutputBitstreamUnit_t *bitstreamPtr,
AppPictureTimingSei_t *picTimingSeiPtr,
Expand Down Expand Up @@ -8092,7 +8093,7 @@ EB_ERRORTYPE CodePictureTimingSEI(
WriteCodeCavlc(
bitstreamPtr,
picTimingSeiPtr->auCpbRemovalDelayMinus1,
vuiPtr->hrdParametersPtr->duCpbRemovalDelayLengthMinus1 + 1);
vuiPtr->hrdParametersPtr->auCpbRemovalDelayLengthMinus1 + 1);

// pic_dpb_output_delay
WriteCodeCavlc(
Expand Down
95 changes: 94 additions & 1 deletion Source/Lib/Codec/EbPacketizationProcess.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,78 @@
#include "EbRateControlProcess.h"
#include "EbTime.h"

void HrdFullness(SequenceControlSet_t *sequenceControlSetPtr, PictureControlSet_t *pictureControlSetptr, AppBufferingPeriodSei_t *seiBP)
{
EB_U32 i;
const AppVideoUsabilityInfo_t* vui = sequenceControlSetPtr->videoUsabilityInfoPtr;
const AppHrdParameters_t* hrd = vui->hrdParametersPtr;
EB_U32 num = 90000;
EB_U32 denom = (hrd->bitRateValueMinus1[pictureControlSetptr->temporalLayerIndex][0][hrd->cpbCountMinus1[0]] + 1) << (hrd->bitRateScale + BR_SHIFT);
EB_U64 cpbState = sequenceControlSetPtr->encodeContextPtr->bufferFill;
EB_U64 cpbSize = (hrd->cpbSizeValueMinus1[pictureControlSetptr->temporalLayerIndex][0][hrd->cpbCountMinus1[0]] + 1) << (hrd->cpbSizeScale + CPB_SHIFT);

for (i = 0; i < hrd->cpbCountMinus1[0]+1; i++)
{
seiBP->initialCpbRemovalDelay[0][i] = (EB_U32)(num * cpbState / denom);
seiBP->initialCpbRemovalDelayOffset[0][i] = (EB_U32)(num * cpbSize / denom - seiBP->initialCpbRemovalDelay[0][i]);
}
}

static inline EB_S32 calcScale(EB_U32 x)
{
EB_U8 lut[16] = { 4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0 };
EB_S32 y, z = (((x & 0xffff) - 1) >> 27) & 16;
x >>= z;
z += y = (((x & 0xff) - 1) >> 28) & 8;
x >>= y;
z += y = (((x & 0xf) - 1) >> 29) & 4;
x >>= y;
return z + lut[x & 0xf];
}

static inline EB_S32 calcLength(EB_U32 x)
{
EB_U8 lut[16] = { 4, 3, 2, 2, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0 };
EB_S32 y, z = (((x >> 16) - 1) >> 27) & 16;
x >>= z ^ 16;
z += y = ((x - 0x100) >> 28) & 8;
x >>= y ^ 8;
z += y = ((x - 0x10) >> 29) & 4;
x >>= y ^ 4;
return z + lut[x];
}

void InitHRD(SequenceControlSet_t *scsPtr)
{
EB_U32 i, j, k;
AppHrdParameters_t *hrd = scsPtr->videoUsabilityInfoPtr->hrdParametersPtr;

// normalize HRD size and rate to the value / scale notation
hrd->bitRateScale = (EB_U32)CLIP3(0, 15, calcScale(scsPtr->staticConfig.vbvMaxrate) - BR_SHIFT);
hrd->cpbSizeScale = (EB_U32)CLIP3(0, 15, calcScale(scsPtr->staticConfig.vbvBufsize) - CPB_SHIFT);
for (i = 0; i < MAX_TEMPORAL_LAYERS; i++)
for (j = 0; j < 2; j++)
for (k = 0; k < MAX_CPB_COUNT; k++)
{
hrd->bitRateValueMinus1[i][j][k] = (scsPtr->staticConfig.vbvMaxrate >> (hrd->bitRateScale + BR_SHIFT))-1;
hrd->cpbSizeValueMinus1[i][j][k] = (scsPtr->staticConfig.vbvBufsize >> (hrd->cpbSizeScale + CPB_SHIFT))-1;
}
EB_U32 bitRateUnscale = ((scsPtr->staticConfig.vbvMaxrate >> (hrd->bitRateScale + BR_SHIFT)) << (hrd->bitRateScale + BR_SHIFT));
EB_U32 cpbSizeUnscale = ((scsPtr->staticConfig.vbvBufsize >> (hrd->cpbSizeScale + CPB_SHIFT)) << (hrd->cpbSizeScale + CPB_SHIFT));

// arbitrary
#define MAX_DURATION 0.5

EB_U32 maxCpbOutputDelay = (EB_U32)MIN((EB_U32)scsPtr->staticConfig.intraPeriodLength* MAX_DURATION *scsPtr->videoUsabilityInfoPtr->vuiTimeScale / scsPtr->videoUsabilityInfoPtr->vuiNumUnitsInTick, MAX_UNSIGNED_VALUE);
EB_U32 maxDpbOutputDelay = (EB_U32)(scsPtr->maxDpbSize* MAX_DURATION *scsPtr->videoUsabilityInfoPtr->vuiTimeScale / scsPtr->videoUsabilityInfoPtr->vuiNumUnitsInTick);
EB_U32 maxDelay = (EB_U32)(90000.0 * cpbSizeUnscale / bitRateUnscale + 0.5);
hrd->initialCpbRemovalDelayLengthMinus1 = (EB_U32)((2 + CLIP3(4, 22, 32 - calcLength(maxDelay)))-1);
hrd->auCpbRemovalDelayLengthMinus1 = (EB_U32)((CLIP3(4, 31, 32 - calcLength(maxCpbOutputDelay)))-1);
hrd->dpbOutputDelayLengthMinus1 = (EB_U32)((CLIP3(4, 31, 32 - calcLength(maxDpbOutputDelay)))-1);

#undef MAX_DURATION
}

EB_ERRORTYPE PacketizationContextCtor(
PacketizationContext_t **contextDblPtr,
EbFifo_t *entropyCodingInputFifoPtr,
Expand Down Expand Up @@ -74,6 +146,7 @@ void* PacketizationKernel(void *inputPtr)

EB_PICTURE sliceType;

EB_U64 prevBPpictureNumber =0;
for(;;) {

// Get EntropyCoding Results
Expand Down Expand Up @@ -144,6 +217,9 @@ void* PacketizationKernel(void *inputPtr)
ComputeMaxDpbBuffer(
sequenceControlSetPtr);

if (sequenceControlSetPtr->staticConfig.hrdFlag == 1)
InitHRD(sequenceControlSetPtr);

// Code the VPS
EncodeVPS(
pictureControlSetPtr->bitstreamPtr,
Expand Down Expand Up @@ -435,7 +511,13 @@ void* PacketizationKernel(void *inputPtr)
pictureControlSetPtr->sliceType == EB_I_PICTURE &&
sequenceControlSetPtr->staticConfig.videoUsabilityInfo &&
(sequenceControlSetPtr->videoUsabilityInfoPtr->hrdParametersPtr->nalHrdParametersPresentFlag || sequenceControlSetPtr->videoUsabilityInfoPtr->hrdParametersPtr->vclHrdParametersPresentFlag))
{
{
//Calculating the hrdfullness based on the vbv buffer fill status
if (sequenceControlSetPtr->staticConfig.hrdFlag == 1)
{
HrdFullness(sequenceControlSetPtr, pictureControlSetPtr, &sequenceControlSetPtr->bufferingPeriod);
prevBPpictureNumber = pictureControlSetPtr->ParentPcsPtr->decodeOrder;
}
EncodeBufferingPeriodSEI(
pictureControlSetPtr->bitstreamPtr,
&sequenceControlSetPtr->bufferingPeriod,
Expand All @@ -444,6 +526,17 @@ void* PacketizationKernel(void *inputPtr)
}

if(sequenceControlSetPtr->staticConfig.pictureTimingSEI) {
if (sequenceControlSetPtr->staticConfig.hrdFlag == 1)
{
// The aucpbremoval delay specifies how many clock ticks the
// access unit associated with the picture timing SEI message has to
// wait after removal of the access unit with the most recent
// buffering period SEI message
const AppVideoUsabilityInfo_t* vui = sequenceControlSetPtr->videoUsabilityInfoPtr;
const AppHrdParameters_t* hrd = vui->hrdParametersPtr;
sequenceControlSetPtr->picTimingSei.auCpbRemovalDelayMinus1 = (EB_U32)((MIN(MAX(1, (EB_S32)pictureControlSetPtr->ParentPcsPtr->decodeOrder - (EB_S32)prevBPpictureNumber), (1 << hrd->auCpbRemovalDelayLengthMinus1)))-1);
sequenceControlSetPtr->picTimingSei.picDpbOutputDelay = (EB_U32)(sequenceControlSetPtr->maxDpbSize + pictureControlSetPtr->pictureNumber - pictureControlSetPtr->ParentPcsPtr->decodeOrder);
}

EncodePictureTimingSEI(
pictureControlSetPtr->bitstreamPtr,
Expand Down
4 changes: 2 additions & 2 deletions Source/Lib/Codec/EbSei.c
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ EB_U32 GetPictureTimingSEILength(

if(vuiPtr->hrdParametersPtr->cpbDpbDelaysPresentFlag) {
// au_cpb_removal_delay_minus1
seiLength += vuiPtr->hrdParametersPtr->duCpbRemovalDelayLengthMinus1 + 1;
seiLength += vuiPtr->hrdParametersPtr->auCpbRemovalDelayLengthMinus1 + 1;

// pic_dpb_output_delay
seiLength += vuiPtr->hrdParametersPtr->dpbOutputDelayLengthMinus1 + 1;
Expand Down Expand Up @@ -400,7 +400,7 @@ EB_U32 GetBufPeriodSEILength(
seiLength += 1;

// au_cpb_removal_delay_delta_minus1
seiLength += vuiPtr->hrdParametersPtr->initialCpbRemovalDelayLengthMinus1 + 1;
seiLength += vuiPtr->hrdParametersPtr->auCpbRemovalDelayLengthMinus1 + 1;

if(bufferingPeriodPtr->rapCpbParamsPresentFlag) {
// cpb_delay_offset
Expand Down