-
Notifications
You must be signed in to change notification settings - Fork 169
Add crf ratecontrol support #70
base: master
Are you sure you want to change the base?
Changes from 76 commits
e2e977b
ac871ee
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
07c3947
3df55f3
e3b304d
603afa8
aa3d3f6
c82520c
1397357
742a38e
6926341
1d6bce7
c977220
9234146
0560e9c
9703118
01d52a4
501e5a4
037d7c2
d1b7dea
5a8dc53
d55a18b
e337b62
f7ebfc3
c5cdcfe
beda1ec
d1386a6
2442880
c8e2fcd
20e2bf9
6431e5c
80d1d8a
8997bc3
8570171
ceb6347
5bb446b
c9ce68b
5f95710
015a2bc
1165741
5e6e924
d3d530c
85a36e2
c5bd916
e393fd0
d499b4f
c710fc5
84979ba
b6ae721
ce88bc4
b07731f
1e85639
ef9c29a
c849c55
72a99e9
c16092c
c0b0ece
1335e73
40a5f97
ce4672c
3ee527f
a5d6a00
a984744
8c2612f
2e231e2
a218fa7
93f6794
e93b4e9
b7effc8
8ba809c
7135294
79f187c
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 |
---|---|---|
|
@@ -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 | | ||
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. These params should be part of #155 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. 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'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. | | ||
|
@@ -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 & | ||
|
||
<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 | ||
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. I suggest making the bufsize 2x tbr as it is the BKC for now 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. 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 & | ||
|
||
>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 & | ||
|
||
<br> | ||
Where 0x0000000FFFFFFF0000000FFFFFFF and 0xFFFFFFF0000000FFFFFFF0000000 are masks for sockets 0 and 1 respectively on a dual 8180 system. | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||
|
@@ -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; | ||
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. 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 | ||
|
||
|
@@ -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. | ||
* | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,7 +32,7 @@ target_link_libraries(SvtHevcEncApp | |
|
||
if(UNIX) | ||
target_link_libraries(SvtHevcEncApp | ||
pthread) | ||
pthread m) | ||
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. needed ? 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. It is included as CRF algorithm uses pow and log from math lib |
||
if(NOT APPLE) | ||
target_link_libraries(SvtHevcEncApp | ||
rt) | ||
|
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.
is this needed ?
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.
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 .