ref: 7ec4a4b3eb3b9927ea84e8d3710bfb450cdf5931
parent: 1358fdf2cb3ff608fa71ab273e980bef57e61408
author: Jingning Han <[email protected]>
date: Mon Dec 17 09:24:35 EST 2018
Add frame header control to turn on PSNR_AQ mode Change-Id: I46f695b15153c8c508f525a5673db24326371977
--- a/vp9/encoder/vp9_encoder.c
+++ b/vp9/encoder/vp9_encoder.c
@@ -4142,6 +4142,8 @@
vp9_setup_in_frame_q_adj(cpi);
} else if (oxcf->aq_mode == LOOKAHEAD_AQ) {
vp9_alt_ref_aq_setup_map(cpi->alt_ref_aq, cpi);
+ } else if (oxcf->aq_mode == PSNR_AQ) {
+ vp9_psnr_aq_mode_setup(&cm->seg);
}
vp9_encode_frame(cpi);
--- a/vp9/encoder/vp9_segmentation.c
+++ b/vp9/encoder/vp9_segmentation.c
@@ -46,6 +46,19 @@
seg->feature_data[segment_id][feature_id] = 0;
}
+void vp9_psnr_aq_mode_setup(struct segmentation *seg) {
+ int i;
+
+ vp9_enable_segmentation(seg);
+ vp9_clearall_segfeatures(seg);
+ seg->abs_delta = SEGMENT_DELTADATA;
+
+ for (i = 0; i < MAX_SEGMENTS; ++i) {
+ vp9_set_segdata(seg, i, SEG_LVL_ALT_Q, 2 * (i - (MAX_SEGMENTS / 2)));
+ vp9_enable_segfeature(seg, i, SEG_LVL_ALT_Q);
+ }
+}
+
// Based on set of segment counts calculate a probability tree
static void calc_segtree_probs(int *segcounts, vpx_prob *segment_tree_probs) {
// Work out probabilities of each segment
--- a/vp9/encoder/vp9_segmentation.h
+++ b/vp9/encoder/vp9_segmentation.h
@@ -26,6 +26,8 @@
void vp9_clear_segdata(struct segmentation *seg, int segment_id,
SEG_LVL_FEATURES feature_id);
+void vp9_psnr_aq_mode_setup(struct segmentation *seg);
+
// The values given for each segment can be either deltas (from the default
// value chosen for the frame) or absolute values.
//