Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add crf ratecontrol support #70

Open
wants to merge 106 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 76 commits
Commits
Show all changes
106 commits
Select commit Hold shift + click to select a range
e2e977b
Add crf ratecontrol support
kirithika7 Jan 9, 2019
ac871ee
Merge branch 'master' into master
kirithika7 Jan 17, 2019
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
07c3947
Fix for deadlock when vbv is not enabled
kirithika7 Mar 29, 2019
3df55f3
Fix compiler warnings
kirithika7 Mar 29, 2019
e3b304d
Fix for Final Bitrate is greater than TBR in Strict CBR
dinesh0603 Apr 4, 2019
603afa8
Fix:Remove the duplicated use of current frame bits for lookahead bas…
kirithika7 Apr 15, 2019
aa3d3f6
Add support for vbv-end and vbv-end-fr-adj
kirithika7 Apr 5, 2019
c82520c
Add proxy entropy coding call into Encdec process to support block le…
kirithika7 Feb 6, 2019
1397357
Create and initialize row stats structure
kirithika7 Feb 11, 2019
742a38e
Add code to assign baseqp for each LCU
kirithika7 Feb 12, 2019
6926341
Update rowstats based on the CU history
kirithika7 Feb 12, 2019
1d6bce7
Add code for Low level RC
kirithika7 Feb 26, 2019
c977220
Add code to estimate frame size at vbv checkpoints
kirithika7 Feb 13, 2019
9234146
Code clean up & removed warnings
dinesh0603 Mar 1, 2019
0560e9c
Add code to predict bits for each LCU
kirithika7 Mar 11, 2019
9703118
Fix Buffer Fill based on the lookahead buffer Fill for the current frame
kirithika7 Apr 22, 2019
01d52a4
Fix exception due to null frame rate
kirithika7 Apr 22, 2019
501e5a4
Move the low-level QP calculation after MD Fix the confromant part fo…
anaghdin Mar 12, 2019
037d7c2
Add cli support to enable/disable low level vbv
kirithika7 Mar 19, 2019
d1b7dea
Add additional checks for -low-level-vbv introduced
kirithika7 Mar 19, 2019
5a8dc53
Fix the run time error "No RC interval found" when
kirithika7 Apr 29, 2019
d55a18b
Fix: Reset encodedBitsSoFar to 0 before recomputing frame size
kirithika7 Apr 29, 2019
e337b62
Merge branch with Master (Commit:97eafda)
dinesh0603 May 30, 2019
f7ebfc3
-Modified code as per review comments and coding guidelines
dinesh0603 May 30, 2019
c5cdcfe
Fix for Deadlock
dinesh0603 May 31, 2019
beda1ec
Remove the macro PACK_FEEDBACK
anaghdin Mar 27, 2019
d1386a6
Implement 16x16 SATD C and AVX2 functions.
LuanZhanKuangGe Jun 6, 2019
2442880
Fix compiler errors on Linux.
LuanZhanKuangGe Jun 6, 2019
c8e2fcd
Fixed hrd 1 crash issues caused by writeUvlc long bits, memmove and S…
Jun 11, 2019
20e2bf9
Merge CRF branch with master
dinesh0603 Jun 13, 2019
6431e5c
Merge CRF with Master Tip(commit:054b1bf)
dinesh0603 Jun 13, 2019
80d1d8a
Modifed code as per coding guidelines
dinesh0603 Jun 14, 2019
8997bc3
Merge branch VBV Code with CRF
dinesh0603 Jun 20, 2019
8570171
Merge branch 'master' into master
tianjunwork Jun 25, 2019
ceb6347
Fix linux build errors
kavithasampath Jun 27, 2019
5bb446b
Merge branch 'master' of https://github.com/OpenVisualCloud/SVT-HEVC
kirithika7 Jul 10, 2019
c9ce68b
Cleanup unused variables
kirithika7 Jul 10, 2019
5f95710
Update CMakeLists.txt
kirithika7 Jul 10, 2019
015a2bc
Merge branch 'master' of https://github.com/OpenVisualCloud/SVT-HEVC
kirithika7 Jul 10, 2019
1165741
Revert "Update CMakeLists.txt "
kirithika7 Jul 10, 2019
5e6e924
Fix make error caught while linking math library
kirithika7 Jul 15, 2019
d3d530c
Fix SVT-HEVC ffmpeg integration error
kirithika7 Jul 15, 2019
85a36e2
Fix license header in newly added files
kirithika7 Jul 30, 2019
c5bd916
Fix initialization of Neighbor arrays in EstimateLcu()
kirithika7 Aug 1, 2019
e393fd0
Update Estimatelcu() to that of master
kirithika7 Aug 8, 2019
d499b4f
Fix the Encoder crash when Frames exceeds the CircularQueue length
kirithika7 Aug 9, 2019
c710fc5
Remove reassignment of lcu qp by Entropy process
kirithika7 Aug 9, 2019
84979ba
Fix reset of Row stats once per picture
kirithika7 Aug 9, 2019
b6ae721
Use Sad Interval Index updated by Motion Estimation Process for LCU b…
kirithika7 Aug 9, 2019
ce88bc4
Clean up
kirithika7 Aug 9, 2019
b07731f
Revert vbv-end and vbv end frame adjust option
kirithika7 Aug 10, 2019
1e85639
Merge branch 'master' of https://github.com/OpenVisualCloud/SVT-HEVC
kirithika7 Aug 10, 2019
ef9c29a
Cleanup unneccesary file changes
kirithika7 Aug 10, 2019
c849c55
Merge branch 'master' of https://github.com/OpenVisualCloud/SVT-HEVC
kirithika7 Aug 12, 2019
72a99e9
Cleanup the usage of a udeclared variable
kirithika7 Aug 12, 2019
c16092c
Enable Low level VBV only if frame level VBV is enabled and remove re…
kirithika7 Aug 12, 2019
c0b0ece
Fix inconsistent line endings in EbEncDecProcess.c
kirithika7 Aug 12, 2019
1335e73
Remove the SATD asm implementation
kirithika7 Aug 12, 2019
40a5f97
Move PredictBits() to a new file to remove redundant copy of it as Pr…
kirithika7 Aug 12, 2019
ce4672c
Remove unused variable rowIndex+Move tempCoeffPtr assignment after
kirithika7 Aug 13, 2019
3ee527f
Add Macro for Rc Tolerance and Step size values + Add VBV control to…
kirithika7 Aug 14, 2019
a5d6a00
Add code for planning VBV Buffer Fullness after lookahead VBV to use …
kirithika7 Aug 14, 2019
a984744
Restrict low level vbv when lookahead predictions are not done + enab…
kirithika7 Aug 14, 2019
8c2612f
Merge branch 'master' of https://github.com/OpenVisualCloud/SVT-HEVC
kirithika7 Aug 14, 2019
2e231e2
Fix build error + update BKC for frame level VBV
kirithika7 Aug 14, 2019
a218fa7
Remove -DPIC as it is not needed for SATD C implementation
kirithika7 Aug 15, 2019
93f6794
Merge branch 'master' into master
tianjunwork Oct 17, 2019
e93b4e9
Fixed the compiling errors/warnings for rebasing PR #70.
Austin-Hu Oct 17, 2019
b7effc8
Refined the CRF usage.
Austin-Hu Oct 17, 2019
8ba809c
Update EbEncHandle.c
Austin-Hu Oct 18, 2019
7135294
Fixed some rebasing errors in EbEncDecProcess.c
Austin-Hu Oct 24, 2019
79f187c
Merge branch 'master' into master
Austin-Hu Nov 4, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON)
if(WIN32)
set(CMAKE_ASM_NASM_FLAGS "${CMAKE_ASM_NASM_FLAGS} -DWIN64")
else()
set(CMAKE_ASM_NASM_FLAGS "${CMAKE_ASM_NASM_FLAGS} -DUNIX64")
set(CMAKE_ASM_NASM_FLAGS "${CMAKE_ASM_NASM_FLAGS} -DUNIX64 -DPIC")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this needed ?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was added to fix the linux build error while building SATD assembly.It is not needed now as we removed the SATD assembly implementation and so we removed -DPIC flag .

endif()

if(UNIX)
Expand Down
11 changes: 9 additions & 2 deletions Config/Sample.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,20 @@ SearchAreaHeight : 7 # Number of search posit
ConstrainedIntra : 0 # Enable the use of Constrained Intra which results in sending two PPSs (0: OFF, 1: ON)

# ====================== Rate Control ===============================
RateControlMode : 0 # Rate control mode (0: OFF(CQP), 1: VBR)
RateControlMode : 0 # Rate control mode (0: OFF(CQP), 1: VBR, 2: CRF)
TargetBitRate : 7000000 # Target Bit Rate (in bits per second)
lowLevelVbv : 0 # Enables loeLevelVBV Algorithm (0: OFF, 1: ON)
vbvMaxrate : 0 # VBV MaxRate (in bits per second)
vbvBufsize : 0 # VBV Bufsize (in bits per second)
vbvBufInit : 90 # Sets how full the VBV buffer to be - [0 - 100]
vbvBufEnd : 0 # VBV BufEnd [0 - 100]
vbvEndFrameAdjust : 0 # VBV EndFrameAdjust [0 - 100]
hrdFlag : 0 # hrdflag (When hrdFlag is set to 1 it requires vbvMaxrate and vbvBufsize to be greater than 0)(0: disable , 1: enable)
MaxQpAllowed : 48 # maximum allowed QP when rate control is on - [0-51]
MinQpAllowed : 10 # minimum allowed QP when rate control is on - [0-51]
LookAheadDistance : 17 # Enable Look Ahead [0-250]
SceneChangeDetection : 1 # Enable Scene Change Detection (0: OFF, 1: ON)

ConstantRateFactor : 28 # CRF value allowed for rate control use - [0-51]
# ====================== Tune ===============================
Tune : 1 # Tune (0=SQ - visually optimized mode, 1=OQ - PSNR / SSIM optimized mode, 2=VMAF - VMAF optimized mode)

Expand Down
25 changes: 24 additions & 1 deletion Docs/svt-hevc_encoder_user_guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -294,8 +294,16 @@ The encoder parameters present in the Sample.cfg file are listed in this table b
| **SearchAreaWidth** | -search-w | [1 - 256] | Depends on input resolution | Search Area in Width |
| **SearchAreaHeight** | -search-h | [1 - 256] | Depends on input resolution | Search Area in Height |
| **ConstrainedIntra** | -constrd-intra | [0,1] | 0 | Allow the use of Constrained Intra, when enabled, this features yields to sending two PPSs in the HEVC Elementary streams <br>0 = OFF, 1 = ON |
| **RateControlMode** | -rc | [0,1] | 0 | 0 : CQP , 1 : VBR |
| **RateControlMode** | -rc | [0,1] | 0 | 0 : CQP , 1 : VBR , 2 : CRF |
| **ConstantRateFactor** | -crf | [0 - 51] | 28 | CRF value allowed for rate control use, only apllicable when RateControlMode is set to 2 |
| **TargetBitRate** | -tbr | Any Number | 7000000 | Target bitrate in bits / second. Only used when RateControlMode is set to 1 |
| **lowLevelVbv** | -low-level-vbv | [0,1] | 0 | Enable lowLevelVBV algorithm. 0 = OFF, 1 = ON |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These params should be part of #155

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR has Frame level and low level VBV related changes also in addition to CRF.

| **vbvMaxrate** | -vbv-maxrate | Any Number | 0 | VBVMaxrate in bits / second. Only used when RateControlMode is set to 1 |
| **vbvBufsize** | -vbv-bufsize | Any Number | 0 | VBV BufferSize in bits / second. Only used when RateControlMode is set to 1 |
| **vbvBufInit** | -vbv-init | [0 - 100] | 90 | Sets how full the VBV buffer to be|
| **vbvBufEnd** | -vbv-end | [0 - 100] | 0 | Sets how VBV Buffer ends|
| **vbvEndFrameAdjust** | -vbv-end-fr-adj | [0 - 100] | 0 | Sets vbvEndFrameAdjust|
| **hrdFlag** | -hrd | [0,1] | 0 | HRD Flag, 0 = OFF, 1 = ON |When hrdFlag is set to 1 it requires vbvMaxrate and vbvBufsize to be greater than 0 |
| **MaxQpAllowed** | -max-qp | [0 - 51] | 48 | Maximum QP value allowed for rate control use. Only used when RateControlMode is set to 1. Has to be >= MinQpAllowed |
| **MinQpAllowed** | -min-qp | [0 - 50] | 10 | Minimum QP value allowed for rate control use. Only used when RateControlMode is set to 1. Has to be < MaxQpAllowed |
| **LookAheadDistance** | -lad | [0 - 250] | Depending on BRC mode | When RateControlMode is set to 1 it&#39;s best to set this parameter to be equal to the Intra period value (such is the default set by the encoder), When CQP is chosen, then a (2 \* minigopsize +1) look ahead is recommended. |
Expand Down Expand Up @@ -427,6 +435,21 @@ Similarly, in order to run a 2-stream 8kp50 simultaneous encode on a Xeon Platin

>taskset 0xFFFFFFF0000000FFFFFFF0000000./SvtHevcEncApp -encMode 12 -tune 0 -w 7680 -h 4320 -bit-depth 10 -compressed-ten-bit-format 1 -i in.yuv -rc 1 –tbr 20000000 -fps 50 -b out1.bin -n 5000 –nb 500 &amp;

<br>
Similarly, in order to enable VBV and run a 2-stream 8kp50 simultaneous encode on a Xeon Platinum 8180 system the following command lines should be used:

#### *Running Windows\* Server 2016:*

>start /node 0 SvtHevcEncApp.exe -encMode 12 -tune 0 -w 3840 -h 2160 -bit-depth 10 -compressed-ten-bit-format 1 -i in.yuv -rc 1 –tbr 10000000 -vbv-maxrate 10000000 -vbv-bufsize 10000000 -fps 50 -b out1.bin -n 5000 –nb 500
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest making the bufsize 2x tbr as it is the BKC for now

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have made this change and pushed.


>start /node 1 SvtHevcEncApp.exe -encMode 12 -tune 0 -w 3840 -h 2160 -bit-depth 10 -compressed-ten-bit-format 1 -i in.yuv -rc 1 –tbr 10000000 -vbv-maxrate 10000000 -vbv-bufsize 10000000 -fps 50 -b out3.bin -n 5000 –nb 500

#### *Running Ubuntu\* 18.04:*

>taskset 0x0000000FFFFFFF0000000FFFFFFF ./SvtHevcEncApp -encMode 12 -tune 0 -w 3840 -h 2160 -bit-depth 10 -compressed-ten-bit-format 1 -i in.yuv -rc 1 –tbr 10000000 -vbv-maxrate 10000000 -vbv-bufsize 10000000 -fps 50 -b out3.bin -n 5000 –nb 500 &amp;

>taskset 0xFFFFFFF0000000FFFFFFF0000000 ./SvtHevcEncApp -encMode 12 -tune 0 -w 3840 -h 2160 -bit-depth 10 -compressed-ten-bit-format 1 -i in.yuv -rc 1 –tbr 10000000 -vbv-maxrate 10000000 -vbv-bufsize 10000000 -fps 50 -b out3.bin -n 5000 –nb 500 &amp;

<br>
Where 0x0000000FFFFFFF0000000FFFFFFF and 0xFFFFFFF0000000FFFFFFF0000000 are masks for sockets 0 and 1 respectively on a dual 8180 system.

Expand Down
47 changes: 45 additions & 2 deletions Source/API/EbApi.h
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,11 @@ typedef struct EB_H265_ENC_CONFIGURATION
*
* Default is 10. */
uint32_t minQpAllowed;
/* CRF value allowed for rate control use, only apllicable when rate
* control mode is set to 2.
*
* Default is 28. */
uint32_t crf;


// bitstream options
Expand Down Expand Up @@ -508,15 +513,52 @@ 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 0. */
uint32_t vbvMaxrate;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

again part of #155


/* Sets the size of the VBV buffer in bits.
*
* Default is 0. */
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;
/* Sets how full the VBV buffer must be end.
*
* Default is 0. */
uint64_t vbvBufEnd;
/* Sets vbvEndFrameAdjust.
*
* Default is 0. */
uint64_t vbvEndFrameAdjust;
/* Enables the buffering period SEI and picture timing SEI to signal the HRD
* parameters.
*
* 0 = disable.
* 1 = enable.
*
* Default is 0. */
uint32_t hrdFlag;

/* ID assigned to each channel when multiple instances are running within the
* same application. */
uint32_t channelId;

/* Active channel count. */
uint32_t activeChannelCount;

/* Enables lowLevelVBV Algorithm
*
* 0 = disable.
* 1 = enable.
*
* Default is 0. */
uint8_t lowLevelVbv;

// Threads management

Expand All @@ -535,6 +577,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.
*
Expand Down
2 changes: 1 addition & 1 deletion Source/App/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ target_link_libraries(SvtHevcEncApp

if(UNIX)
target_link_libraries(SvtHevcEncApp
pthread)
pthread m)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

needed ?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is included as CRF algorithm uses pow and log from math lib

if(NOT APPLE)
target_link_libraries(SvtHevcEncApp
rt)
Expand Down
65 changes: 57 additions & 8 deletions Source/App/EbAppConfig.c
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,14 @@
#define NALU_FILE_TOKEN "-nalu-file"
#define RATE_CONTROL_ENABLE_TOKEN "-rc"
#define TARGET_BIT_RATE_TOKEN "-tbr"
#define CRF_TOKEN "-crf"
#define VBV_MAX_RATE_TOKEN "-vbv-maxrate"
#define VBV_BUFFER_SIZE_TOKEN "-vbv-bufsize"
#define VBV_BUFFER_INIT_TOKEN "-vbv-init"
#define VBV_BUFFER_END_TOKEN "-vbv-end"
#define VBV_END_FRAME_ADJUST_TOKEN "-vbv-end-fr-adj"
#define ENABLE_LOW_LEVEL_VBV_TOKEN "-low-level-vbv"
#define HRD_TOKEN "-hrd"
#define MAX_QP_TOKEN "-max-qp"
#define MIN_QP_TOKEN "-min-qp"
#define TEMPORAL_ID "-temporal-id" // no Eval
Expand Down Expand Up @@ -181,6 +189,7 @@ static void SetFrameRate (const char *value, EbConfig_t *
cfg->frameRate = cfg->frameRate << 16;
}
}

static void SetFrameRateNumerator (const char *value, EbConfig_t *cfg) {cfg->frameRateNumerator = strtoul(value, NULL, 0);};
static void SetFrameRateDenominator (const char *value, EbConfig_t *cfg) {cfg->frameRateDenominator = strtoul(value, NULL, 0);};
static void SetEncoderBitDepth (const char *value, EbConfig_t *cfg) {cfg->encoderBitDepth = strtoul(value, NULL, 0);}
Expand All @@ -193,6 +202,7 @@ static void SetCfgIntraRefreshType (const char *value, EbConfig_t *
static void SetHierarchicalLevels (const char *value, EbConfig_t *cfg) {cfg->hierarchicalLevels = strtol(value, NULL, 0); };
static void SetCfgPredStructure (const char *value, EbConfig_t *cfg) {cfg->predStructure = strtol(value, NULL, 0); };
static void SetCfgQp (const char *value, EbConfig_t *cfg) {cfg->qp = strtoul(value, NULL, 0);};
static void SetCfgCrf (const char *value, EbConfig_t *cfg) {cfg->crf = strtoul(value, NULL, 0); };
static void SetCfgUseQpFile (const char *value, EbConfig_t *cfg) {cfg->useQpFile = (EB_BOOL)strtol(value, NULL, 0); };
static void SetCfgTileColumnCount (const char *value, EbConfig_t *cfg) { cfg->tileColumnCount = (EB_BOOL)strtol(value, NULL, 0); };
static void SetCfgTileRowCount (const char *value, EbConfig_t *cfg) { cfg->tileRowCount = (EB_BOOL)strtol(value, NULL, 0); };
Expand All @@ -213,6 +223,13 @@ 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 SetVbvEndFrameAdjust (const char *value, EbConfig_t *cfg) { cfg->vbvEndFrameAdjust = strtoul(value, NULL, 0); };
static void SetVbvBufEnd (const char *value, EbConfig_t *cfg) { cfg->vbvBufEnd = strtoul(value, NULL, 0); };
static void SetLowLevelVbv (const char *value, EbConfig_t *cfg) { cfg->lowLevelVbv = (EB_BOOL)strtol(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);};
Expand Down Expand Up @@ -313,6 +330,14 @@ config_entry_t config_entry[] = {
{ SINGLE_INPUT, FRAME_RATE_TOKEN, "FrameRate", SetFrameRate },
{ SINGLE_INPUT, FRAME_RATE_NUMERATOR_TOKEN, "FrameRateNumerator", SetFrameRateNumerator },
{ SINGLE_INPUT, FRAME_RATE_DENOMINATOR_TOKEN, "FrameRateDenominator", SetFrameRateDenominator },

{ SINGLE_INPUT, ENCODER_BIT_DEPTH, "EncoderBitDepth", SetEncoderBitDepth },
{ SINGLE_INPUT, ENCODER_COLOR_FORMAT, "EncoderColorFormat", SetEncoderColorFormat},
{ SINGLE_INPUT, INPUT_COMPRESSED_TEN_BIT_FORMAT, "CompressedTenBitFormat", SetcompressedTenBitFormat },
{ SINGLE_INPUT, HIERARCHICAL_LEVELS_TOKEN, "HierarchicalLevels", SetHierarchicalLevels },

{ SINGLE_INPUT, PRED_STRUCT_TOKEN, "PredStructure", SetCfgPredStructure },

{ SINGLE_INPUT, INJECTOR_TOKEN, "Injector", SetInjector },
{ SINGLE_INPUT, INJECTOR_FRAMERATE_TOKEN, "InjectorFrameRate", SetInjectorFrameRate },

Expand All @@ -330,6 +355,22 @@ 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},
{ SINGLE_INPUT, VBV_BUFFER_END_TOKEN, "vbvBufEnd", SetVbvBufEnd},
{ SINGLE_INPUT, VBV_END_FRAME_ADJUST_TOKEN, "vbvEndFrameAdjustToken", SetVbvEndFrameAdjust},

{ SINGLE_INPUT, ENABLE_LOW_LEVEL_VBV_TOKEN,"lowLevelVbv",SetLowLevelVbv},

// Deblock Filter
{ SINGLE_INPUT, LOOP_FILTER_DISABLE_TOKEN, "LoopFilterDisable", SetDisableDlfFlag },

Expand All @@ -348,6 +389,7 @@ config_entry_t config_entry[] = {
{ SINGLE_INPUT, CONSTRAINED_INTRA_ENABLE_TOKEN, "ConstrainedIntra", SetEnableConstrainedIntra },

// Rate Control
{ SINGLE_INPUT, CRF_TOKEN, "CRF", SetCfgCrf },
{ SINGLE_INPUT, RATE_CONTROL_ENABLE_TOKEN, "RateControlMode", SetRateControlMode },
{ SINGLE_INPUT, TARGET_BIT_RATE_TOKEN, "TargetBitRate", SetTargetBitRate },
{ SINGLE_INPUT, MAX_QP_TOKEN, "MaxQpAllowed", SetMaxQpAllowed },
Expand Down Expand Up @@ -430,11 +472,18 @@ void EbConfigCtor(EbConfig_t *configPtr)
configPtr->maxQpAllowed = 48;
configPtr->minQpAllowed = 10;
configPtr->baseLayerSwitchMode = 0;
configPtr->encMode = 9;
configPtr->crf = 28;
configPtr->vbvMaxRate = 0;
configPtr->vbvBufsize = 0;
configPtr->vbvBufInit = 90;
configPtr->vbvBufEnd = 0;
configPtr->vbvEndFrameAdjust = 0;
configPtr->hrdFlag = 0;
configPtr->lowLevelVbv = 0;
configPtr->intraPeriod = -2;
configPtr->intraRefreshType = 1;
configPtr->hierarchicalLevels = 3;
configPtr->predStructure = 2;
configPtr->hierarchicalLevels = 3;
configPtr->predStructure = 2;
configPtr->disableDlfFlag = EB_FALSE;
configPtr->enableSaoFlag = EB_TRUE;
configPtr->useDefaultMeHme = EB_TRUE;
Expand All @@ -450,7 +499,7 @@ void EbConfigCtor(EbConfig_t *configPtr)
configPtr->bufferingPeriodSEI = 0;
configPtr->pictureTimingSEI = 0;

configPtr->bitRateReduction = EB_TRUE;
configPtr->bitRateReduction = EB_TRUE;
configPtr->improveSharpness = EB_TRUE;
configPtr->registeredUserDataSeiFlag = EB_FALSE;
configPtr->unregisteredUserDataSeiFlag = EB_FALSE;
Expand Down Expand Up @@ -481,7 +530,7 @@ void EbConfigCtor(EbConfig_t *configPtr)
configPtr->unrestrictedMotionVector = EB_TRUE;

// Encoding Presets
configPtr->encMode = 9;
configPtr->encMode = 9;
//configPtr->latencyMode = 0; // Deprecated
configPtr->speedControlFlag = 0;

Expand Down Expand Up @@ -513,9 +562,9 @@ void EbConfigCtor(EbConfig_t *configPtr)
configPtr->separateFields = EB_FALSE;

// Coding Structure
configPtr->hierarchicalLevels = 3;
configPtr->hierarchicalLevels = 3;
configPtr->baseLayerSwitchMode = 0;
configPtr->predStructure = 2;
configPtr->predStructure = 2;
configPtr->intraPeriod = -2;
configPtr->intraRefreshType = 1;

Expand Down Expand Up @@ -548,7 +597,7 @@ void EbConfigCtor(EbConfig_t *configPtr)
configPtr->tune = 1;

// Adaptive QP Params
configPtr->bitRateReduction = EB_TRUE;
configPtr->bitRateReduction = EB_TRUE;
configPtr->improveSharpness = EB_TRUE;

// Optional Features
Expand Down
9 changes: 8 additions & 1 deletion Source/App/EbAppConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,12 @@ typedef struct EbConfig_s
uint32_t targetBitRate;
uint32_t maxQpAllowed;
uint32_t minQpAllowed;

uint32_t crf;
uint32_t vbvMaxRate;
uint32_t vbvBufsize;
uint64_t vbvBufInit;
uint64_t vbvBufEnd;
uint64_t vbvEndFrameAdjust;
/****************************************
* TUNE
****************************************/
Expand All @@ -348,6 +353,8 @@ typedef struct EbConfig_s
uint32_t enableTemporalId;
EB_BOOL switchThreadsToRtPriority;
EB_BOOL fpsInVps;
uint32_t hrdFlag;
EB_BOOL lowLevelVbv;
EB_BOOL unrestrictedMotionVector;

/****************************************
Expand Down