Index: source/libvpx/vp9/encoder/vp9_aq_cyclicrefresh.c |
diff --git a/source/libvpx/vp9/encoder/vp9_aq_cyclicrefresh.c b/source/libvpx/vp9/encoder/vp9_aq_cyclicrefresh.c |
index 813c339823c3633faf8dd50c128e10568901e4aa..ebef1a202172123407872536bbd6e4ae69aafe58 100644 |
--- a/source/libvpx/vp9/encoder/vp9_aq_cyclicrefresh.c |
+++ b/source/libvpx/vp9/encoder/vp9_aq_cyclicrefresh.c |
@@ -11,6 +11,7 @@ |
#include <limits.h> |
#include <math.h> |
+#include "vpx_dsp/vpx_dsp_common.h" |
#include "vpx_ports/system_state.h" |
#include "vp9/encoder/vp9_aq_cyclicrefresh.h" |
@@ -20,44 +21,6 @@ |
#include "vp9/encoder/vp9_ratectrl.h" |
#include "vp9/encoder/vp9_segmentation.h" |
-struct CYCLIC_REFRESH { |
- // Percentage of blocks per frame that are targeted as candidates |
- // for cyclic refresh. |
- int percent_refresh; |
- // Maximum q-delta as percentage of base q. |
- int max_qdelta_perc; |
- // Superblock starting index for cycling through the frame. |
- int sb_index; |
- // Controls how long block will need to wait to be refreshed again, in |
- // excess of the cycle time, i.e., in the case of all zero motion, block |
- // will be refreshed every (100/percent_refresh + time_for_refresh) frames. |
- int time_for_refresh; |
- // Target number of (8x8) blocks that are set for delta-q. |
- int target_num_seg_blocks; |
- // Actual number of (8x8) blocks that were applied delta-q. |
- int actual_num_seg1_blocks; |
- int actual_num_seg2_blocks; |
- // RD mult. parameters for segment 1. |
- int rdmult; |
- // Cyclic refresh map. |
- signed char *map; |
- // Map of the last q a block was coded at. |
- uint8_t *last_coded_q_map; |
- // Thresholds applied to the projected rate/distortion of the coding block, |
- // when deciding whether block should be refreshed. |
- int64_t thresh_rate_sb; |
- int64_t thresh_dist_sb; |
- // Threshold applied to the motion vector (in units of 1/8 pel) of the |
- // coding block, when deciding whether block should be refreshed. |
- int16_t motion_thresh; |
- // Rate target ratio to set q delta. |
- double rate_ratio_qdelta; |
- // Boost factor for rate target ratio, for segment CR_SEGMENT_ID_BOOST2. |
- int rate_boost_fac; |
- double low_content_avg; |
- int qindex_delta[3]; |
-}; |
- |
CYCLIC_REFRESH *vp9_cyclic_refresh_alloc(int mi_rows, int mi_cols) { |
size_t last_coded_q_map_size; |
CYCLIC_REFRESH *const cr = vpx_calloc(1, sizeof(*cr)); |
@@ -272,6 +235,12 @@ void vp9_cyclic_refresh_update_segment(VP9_COMP *const cpi, |
if (!is_inter_block(mbmi) || !skip) |
cr->last_coded_q_map[map_offset] = clamp( |
cm->base_qindex + cr->qindex_delta[mbmi->segment_id], 0, MAXQ); |
+ else if (is_inter_block(mbmi) && skip) { |
+ cr->last_coded_q_map[map_offset] = VPXMIN( |
+ clamp(cm->base_qindex + cr->qindex_delta[mbmi->segment_id], |
+ 0, MAXQ), |
+ cr->last_coded_q_map[map_offset]); |
+ } |
} |
} |