Repository navigation
Conversation
The "cqp" option accepts fractional QP values (quarter-QP steps) and switches rate control to constant-QP mode (aq-mode=0) instead of CRF. QP computed from "quality" is no longer rounded to an integer. Older SVT-AV1 versions keep the previous integer-QP behavior.
Contributor
Author
|
Hello @farindk |
Member
|
AV1 uses an 8-bit quantizer index. Moving from a 0-63 scale to fractional gives 4x the resolution. Not sure whether that is noticeable, but it doesn't hurt either. Setting this value through a parameter string is unnecessary (and dangerous because of potentially different locales). You can also set it through Also make sure that you do not switch the rate-control mode from CRF to CQP as your original PR does. |
farindk
added a commit
that referenced
this pull request
Sep 1, 2026
…meter string (#1867) Setting the QP through svt_av1_enc_parse_parameter("cqp", ...) has two problems: the string round-trip through snprintf/strtod depends on the process locale (LC_NUMERIC), and the "cqp" option also sets aq_mode=0, silently switching the rate control from CRF to plain CQP. For still images this makes no difference because TPL is disabled for all-intra encoding anyway, but for image sequences it would disable TPL and reduce quality. Instead, write the quarter-QP fraction directly into the public 'extended_crf_qindex_offset' configuration field, which exists since SVT-AV1 4.0.0. This also lowers the version requirement for fractional QP from 4.2.0 to 4.0.0.
Member
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When libheif is built against SVT-AV1 >= 4.2.0, the encoder QP is passed through
svt_av1_enc_parse_parameter(&config, "cqp", ...)instead of assigningsvt_config.qpdirectly. The"cqp"option (introduced in SVT-AV1 4.2.0):rate_control_mode = 0The QP derived from the
qualityparameter is no longer rounded to an integer:e.g.
quality=50now maps to CQP 31.50 instead of 32, so the 0–100 quality scale gets finer granularity. For SVT-AV1 < 4.2.0 the behavior is unchanged — the fractional value is rounded to the same integer the previous formula produced.Testing
Built against SVT-AV1 v4.2.0:
heif-enc -A -q 50→ SVT log showsBRC mode / CQP Assignment: CQP / 31.50heif-enc -A -p qp=40→CQP / 40.00,Possible follow-ups (separate PRs)
Things worth considering next, intentionally left out of this PR:
svt_av1_enc_parse_parameter()for setting the other encoder parameters as well — libheif would gain SVT-AV1's own validation of the values it sets.quality→ QP mapping; theqpparameter still accepts integers only.