mirror of
https://github.com/webmproject/libwebp.git
synced 2025-07-13 14:34:33 +02:00
add a -partition_limit option to limit the number of bits used by intra4x4
Although it degrades quality, this option is useful to avoid the 512k limit for partition #0. If not enough to reach the lower bound of 4bits per macroblock header, one should also limit the number of segments used (down to -segments 1) See the man file for extra details. Change-Id: Ia59ffac13176c85b809ddd6340d37b54ee9487ea
This commit is contained in:
@ -757,8 +757,13 @@ static int PickBestIntra4(VP8EncIterator* const it, VP8ModeScore* const rd) {
|
||||
const int tlambda = dqm->tlambda_;
|
||||
const uint8_t* const src0 = it->yuv_in_ + Y_OFF;
|
||||
uint8_t* const best_blocks = it->yuv_out2_ + Y_OFF;
|
||||
int total_header_bits = 0;
|
||||
VP8ModeScore rd_best;
|
||||
|
||||
if (enc->max_i4_header_bits_ == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
InitScore(&rd_best);
|
||||
rd_best.score = 211; // '211' is the value of VP8BitCost(0, 145)
|
||||
VP8IteratorStartI4(it);
|
||||
@ -799,7 +804,9 @@ static int PickBestIntra4(VP8EncIterator* const it, VP8ModeScore* const rd) {
|
||||
}
|
||||
SetRDScore(dqm->lambda_mode_, &rd_i4);
|
||||
AddScore(&rd_best, &rd_i4);
|
||||
if (rd_best.score >= rd->score) {
|
||||
total_header_bits += mode_costs[best_mode];
|
||||
if (rd_best.score >= rd->score ||
|
||||
total_header_bits > enc->max_i4_header_bits_) {
|
||||
return 0;
|
||||
}
|
||||
// Copy selected samples if not in the right place already.
|
||||
|
Reference in New Issue
Block a user