// combination that wins out.
if (cpi->sf.adaptive_rd_thresh) {
for (mode_index = 0; mode_index < MAX_MODES; ++mode_index) {
+ int *const fact = &cpi->rd_thresh_freq_fact[bsize][mode_index];
+
if (mode_index == best_mode_index) {
- cpi->rd_thresh_freq_fact[bsize][mode_index] -=
- (cpi->rd_thresh_freq_fact[bsize][mode_index] >> 3);
+ *fact -= (*fact >> 3);
} else {
- cpi->rd_thresh_freq_fact[bsize][mode_index] += RD_THRESH_INC;
- if (cpi->rd_thresh_freq_fact[bsize][mode_index] >
- (cpi->sf.adaptive_rd_thresh * RD_THRESH_MAX_FACT)) {
- cpi->rd_thresh_freq_fact[bsize][mode_index] =
- cpi->sf.adaptive_rd_thresh * RD_THRESH_MAX_FACT;
- }
+ *fact = MIN(*fact + RD_THRESH_INC,
+ cpi->sf.adaptive_rd_thresh * RD_THRESH_MAX_FACT);
}
}
}
// combination that wins out.
if (cpi->sf.adaptive_rd_thresh) {
for (mode_index = 0; mode_index < MAX_REFS; ++mode_index) {
+ int *const fact = &cpi->rd_thresh_freq_sub8x8[bsize][mode_index];
+
if (mode_index == best_mode_index) {
- cpi->rd_thresh_freq_sub8x8[bsize][mode_index] -=
- (cpi->rd_thresh_freq_sub8x8[bsize][mode_index] >> 3);
+ *fact -= (*fact >> 3);
} else {
- cpi->rd_thresh_freq_sub8x8[bsize][mode_index] += RD_THRESH_INC;
- if (cpi->rd_thresh_freq_sub8x8[bsize][mode_index] >
- (cpi->sf.adaptive_rd_thresh * RD_THRESH_MAX_FACT)) {
- cpi->rd_thresh_freq_sub8x8[bsize][mode_index] =
- cpi->sf.adaptive_rd_thresh * RD_THRESH_MAX_FACT;
- }
+ *fact = MIN(*fact + RD_THRESH_INC,
+ cpi->sf.adaptive_rd_thresh * RD_THRESH_MAX_FACT);
}
}
}