diff --git a/src/enc/frame.c b/src/enc/frame.c index 445d8570..95206185 100644 --- a/src/enc/frame.c +++ b/src/enc/frame.c @@ -901,15 +901,21 @@ int VP8EncLoop(VP8Encoder* const enc) { // Single pass using Token Buffer. #if !defined(DISABLE_TOKEN_BUFFER) + +#define MIN_COUNT 96 // minimum number of macroblocks before updating stats + int VP8EncTokenLoop(VP8Encoder* const enc) { int ok; - // refresh the proba 8 times per pass - const int max_count = (enc->mb_w_ * enc->mb_h_) >> 3; - int cnt = max_count; + // Roughly refresh the proba height times per pass + int max_count = (enc->mb_w_ * enc->mb_h_) >> 3; + int cnt; VP8EncIterator it; VP8Proba* const proba = &enc->proba_; const VP8RDLevel rd_opt = enc->rd_opt_level_; + if (max_count < MIN_COUNT) max_count = MIN_COUNT; + cnt = max_count; + assert(enc->num_parts_ == 1); assert(enc->use_tokens_); assert(proba->use_skip_proba_ == 0);