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

Var-boost v6 + rc2 version bump #29

Merged
merged 3 commits into from
Feb 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ endif()
project(svt-av1 VERSION 2.0.0
LANGUAGES C CXX)

set(VERSION_TAG "rc1")
set(VERSION_TAG "rc2")

if(POLICY CMP0063)
cmake_policy(SET CMP0063 NEW)
Expand Down
5 changes: 3 additions & 2 deletions Docs/Parameters.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,9 @@ For more information on valid values for specific keys, refer to the [EbEncSetti
| **MaxQpAllowed** | --max-qp | [1-63] | 63 | Maximum (highest) quantizer, only applicable for VBR and CBR |
| **MinQpAllowed** | --min-qp | [1-62] | 1 | Minimum (lowest) quantizer with the max value being max QP value allowed - 1, only applicable for VBR and CBR |
| **AdaptiveQuantization** | --aq-mode | [0-2] | 2 | Set adaptive QP level [0: off, 1: variance base using AV1 segments, 2: deltaq pred efficiency] |
| **VarianceBoostStrength** | --variance-boost-strength | [0-4] | 2 | Set variance curve strength for AQ mode 2 [0: disabled, 1: mild, 2: gentle [Default], 3: medium, 4: aggressive] |
| **NewVarianceOctile** | --new-variance-octile | [0-8] | 6 | Set 8x8 variance algorithm boost level [0: disabled (use 64x64 variance algorithm instead), 1: enabled (1st octile), 4: enabled (median), 8: enabled (maximum)]|
| **VarianceBoostStrength** | --variance-boost-strength | [0-4] | 2 | Set variance curve strength for variance boost feature[0: disabled, 1: mild, 2: gentle [Default], 3: medium, 4: aggressive] |
| **VarianceOctile** | --variance-octile | [0-8] | 6 | Set variance algorithm 8x8 block selectivity level [1: 1st octile, 4: enabled (median), 8: enabled (maximum)]|
| **EnableAltCurve** | --enable-alt-curve | [0-1] | 0 | Enable alternative variance boost curve |
| **UseFixedQIndexOffsets** | --use-fixed-qindex-offsets | [0-2] | 0 | Overwrite the encoder default hierarchical layer based QP assignment and use fixed Q index offsets |
| **KeyFrameQIndexOffset** | --key-frame-qindex-offset | [-64-63] | 0 | Overwrite the encoder default keyframe Q index assignment |
| **KeyFrameChromaQIndexOffset** | --key-frame-chroma-qindex-offset | [-64-63] | 0 | Overwrite the encoder default chroma keyframe Q index assignment |
Expand Down
12 changes: 8 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,17 @@ SVT-AV1-PSY is the Scalable Video Technology for AV1 (SVT-AV1 Encoder and Decode

- `--variance-boost-strength` *1 to 4*

Provides control over our augmented AQ Mode 2 which can utilize variance information in each frame for more consistent quality under high/low contrast scenes. Five curve options are provided, and the default is curve 2. 1: mild, 2: gentle, 3: medium, 4: aggressive
Provides control over our augmented AQ Modes 0 and 2 which can utilize variance information in each frame for more consistent quality under high/low contrast scenes. Four curve options are provided, and the default is curve 2. 1: mild, 2: gentle, 3: medium, 4: aggressive

- `--new-variance-octile` *0 to 8*
- `--variance-octile` *1 to 8*

Enables a new 8x8 variance algorithm and picks a variance value per superblock to use as a boost. Lower values enable detecting more false negatives, at the expense of false positives (bitrate increase). 0: partial (64x64 only), 1-8: enabled (8x8). The default value is 6.
Controls how "selective" the algorithm is when boosting superblocks, based on their low/high 8x8 variance ratio. A value of 1 is the least selective, and will readily boost a superblock if only 1/8th of the superblock is low variance. Conversely, a value of 8 will only boost if the *entire* superblock is low variance. Lower values increase bitrate. The default value is 6.

- `Preset -2 & -3`
- `--enable-alt-curve` *0 and 1*

Enable an alternative variance boost curve, with different bit allocation and visual characteristics. The default is 0.

- `Presets -2 & -3`

Terrifically slow encoding modes for research purposes.

Expand Down
1 change: 1 addition & 0 deletions Source/API/EbDebugMacros.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ extern "C" {
// Variance boost debugging code
#define DEBUG_VAR_BOOST 0
#define DEBUG_VAR_BOOST_QP 0
#define DEBUG_VAR_BOOST_STATS 0

// Quantization matrices
#define DEBUG_QM_LEVEL 0
Expand Down
30 changes: 15 additions & 15 deletions Source/API/EbSvtAv1Enc.h
Original file line number Diff line number Diff line change
Expand Up @@ -936,24 +936,24 @@ typedef struct EbSvtAv1EncConfiguration {
AomFilmGrain *fgs_table;

uint8_t padding[64 - sizeof(Bool) - sizeof(AomFilmGrain *)];
/* @brief Boost low variance regions according to a fast-growing formula
0: no boost
1: mild boost
2: gentle boost
3: medium boost
4: aggressive boost
Default is 2 (gentle curve) */
/* @brief Selects the curve strength to boost low variance regions according to a fast-growing formula
Default is 2 */
uint8_t variance_boost_strength;

/* @brief Enables the new 8x8-based variance algorithm, and picks an 8x8 variance value per superblock to determine boost
/* @brief Picks a set of eight 8x8 variance values per superblock to determine boost
Lower values enable detecting more blocks that need boosting, at the expense of more possible false positives (overall bitrate increase)
0: disabled, uses classic 64x64 based variance algorithm instead
1: enabled, 1st octile
4: enabled, median
8: enabled, maximum
Default is 6
*/
uint8_t new_variance_octile;
1: 1st octile
4: 4th octile
8: 8th octile
Default is 6 */
uint8_t variance_octile;

/* @brief Enable the use of an alternative curve for variance boost
which emphasizes boosting low-medium contrast regions, at a modest bitrate increase over the regular curve
0: disable alt curve
1: enable alt curve (i.e. use regular curve)
Default is 0 */
uint8_t enable_alt_curve;

/* @brief Affects loopfilter deblock sharpness and rate distortion
*
Expand Down
14 changes: 10 additions & 4 deletions Source/App/EncApp/EbAppConfig.c
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,8 @@
#define ROI_MAP_FILE_TOKEN "--roi-map-file"

#define VARIANCE_BOOST_STRENGTH_TOKEN "--variance-boost-strength"
#define NEW_VARIANCE_OCTILE_TOKEN "--new-variance-octile"
#define VARIANCE_OCTILE_TOKEN "--variance-octile"
#define ENABLE_ALT_CURVE_TOKEN "--enable-alt-curve"

#define SHARPNESS_TOKEN "--sharpness"

Expand Down Expand Up @@ -1217,8 +1218,12 @@ ConfigEntry config_entry_psy[] = {
"[PSY] Variance boost strength, default is 2 [0-4]",
set_cfg_generic_token},
{SINGLE_INPUT,
NEW_VARIANCE_OCTILE_TOKEN,
"[PSY] Octile for new 8x8 variance algorithm. Set to 0 to use 64x64 variance algorithm, default is 6 [0-8]",
VARIANCE_OCTILE_TOKEN,
"[PSY] Octile for variance boost, default is 6 [0-8]",
set_cfg_generic_token},
{SINGLE_INPUT,
ENABLE_ALT_CURVE_TOKEN,
"[PSY] Enable alternative curve for variance boost (different boosting trade-offs), default is 0 [0-1]",
set_cfg_generic_token},
// Sharpness
{SINGLE_INPUT,
Expand Down Expand Up @@ -1407,7 +1412,8 @@ ConfigEntry config_entry[] = {

// Variance boost
{SINGLE_INPUT, VARIANCE_BOOST_STRENGTH_TOKEN, "VarianceBoostStrength", set_cfg_generic_token},
{SINGLE_INPUT, NEW_VARIANCE_OCTILE_TOKEN, "NewVarianceOctile", set_cfg_generic_token},
{SINGLE_INPUT, VARIANCE_OCTILE_TOKEN, "VarianceOctile", set_cfg_generic_token},
{SINGLE_INPUT, ENABLE_ALT_CURVE_TOKEN, "EnableAltCurve", set_cfg_generic_token},

// Sharpness
{SINGLE_INPUT, SHARPNESS_TOKEN, "Sharpness", set_cfg_generic_token},
Expand Down
2 changes: 1 addition & 1 deletion Source/Lib/Encoder/Codec/EbPictureAnalysisProcess.c
Original file line number Diff line number Diff line change
Expand Up @@ -1145,7 +1145,7 @@ static EbErrorType compute_block_mean_compute_variance(
mean_of32x32_squared_values_blocks[3]) >>
2;
// 8x8 variances
if (scs->static_config.enable_adaptive_quantization == 1 || scs->static_config.new_variance_octile) {
if (scs->static_config.enable_adaptive_quantization == 1 || scs->static_config.variance_octile) {
pcs->variance[sb_index][ME_TIER_ZERO_PU_8x8_0] = (uint16_t)((mean_of_8x8_squared_values_blocks[0] -
(mean_of8x8_blocks[0] * mean_of8x8_blocks[0])) >>
VARIANCE_PRECISION);
Expand Down
2 changes: 1 addition & 1 deletion Source/Lib/Encoder/Codec/EbPictureControlSet.c
Original file line number Diff line number Diff line change
Expand Up @@ -1304,7 +1304,7 @@ static EbErrorType picture_parent_control_set_ctor(PictureParentControlSet *obje

if (init_data_ptr->calculate_variance) {
uint8_t block_count;
if (init_data_ptr->enable_adaptive_quantization == 1 || init_data_ptr->new_variance_octile)
if (init_data_ptr->enable_adaptive_quantization == 1 || init_data_ptr->variance_octile)
block_count = 85;
else
block_count = 1;
Expand Down
3 changes: 2 additions & 1 deletion Source/Lib/Encoder/Codec/EbPictureControlSet.h
Original file line number Diff line number Diff line change
Expand Up @@ -1201,7 +1201,8 @@ typedef struct PictureControlSetInitData {
Bool is_scale;
bool rtc_tune;
uint8_t variance_boost_strength;
uint8_t new_variance_octile;
uint8_t variance_octile;
Bool enable_alt_curve;
int8_t sharpness;
} PictureControlSetInitData;

Expand Down
Loading