-
Notifications
You must be signed in to change notification settings - Fork 250
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Only cap overflow if it's actually a danger.
In the normal case (when we're not in danger of wasting bits because we have not used enough), soft_limit is negative. As a result, log_soft_limit was being set to -1. Normally this is fine, since we then compare it against (log_scale_pixels - log_q_exp), the log of the estimated number of bits that will be used, which is usually positive. However, when the number of pixels is very small (e.g., for a 1x1 video), it is possible for (log_scale_pixels - log_q_exp) to be negative, and we will try to enforce the limit anyway. This results in very bad things (integer overflows) when we try. This commit also corrects a parentheses error that was introduced when porting the original implementation to rav1e (the division by margin should happen before the multiply, which can also cause overflows).
- Loading branch information
Showing
2 changed files
with
77 additions
and
15 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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