- BLOCK_SIZE bsize, int use_rd,
- int64_t rate_sb) {
- if (use_rd) {
- MV mv = mbmi->mv[0].as_mv;
- // If projected rate is below the thresh_rate (well below target,
- // so undershoot expected), accept it for lower-qp coding.
- if (rate_sb < cr->thresh_rate_sb)
- return 1;
- // Otherwise, reject the block for lower-qp coding if any of the following:
- // 1) mode uses large mv
- // 2) mode is an intra-mode (we may want to allow some of this under
- // another thresh_dist)
- else if (mv.row > 32 || mv.row < -32 ||
- mv.col > 32 || mv.col < -32 || !is_inter_block(mbmi))
- return 0;
- else
- return 1;
- } else {
- // Rate/distortion not used for update.
- if (bsize < cr->min_block_size ||
- mbmi->mv[0].as_int != 0 ||
- !is_inter_block(mbmi))
- return 0;
- else
- return 1;
- }
+ int64_t rate,
+ int64_t dist) {
+ MV mv = mbmi->mv[0].as_mv;
+ // If projected rate is below the thresh_rate accept it for lower-qp coding.
+ // Otherwise, reject the block for lower-qp coding if projected distortion
+ // is above the threshold, and any of the following is true:
+ // 1) mode uses large mv
+ // 2) mode is an intra-mode
+ if (rate < cr->thresh_rate_sb)
+ return 1;
+ else if (dist > cr->thresh_dist_sb &&
+ (mv.row > cr->motion_thresh || mv.row < -cr->motion_thresh ||
+ mv.col > cr->motion_thresh || mv.col < -cr->motion_thresh ||
+ !is_inter_block(mbmi)))
+ return 0;
+ else
+ return 1;