Additions to overview document.
Added / fixed some references.
Added file rc_utils.h to doxygen search list.
Remove loop_at_this_size as this just mirrors loop count.
Added doxygen function header for recode_loop_update_q()
Using \ref with encode_with_recode_loop and
recode_loop_update_q() causes problems as these are not
included in all builds.
Change-Id: I2f69e6c2ffa6fc2b7170002a3da94669267e4530
diff --git a/av1/encoder/encoder.c b/av1/encoder/encoder.c
index 57891b1..7cbecb1 100644
--- a/av1/encoder/encoder.c
+++ b/av1/encoder/encoder.c
@@ -3066,7 +3066,6 @@
// Loop variables
int loop = 0;
int loop_count = 0;
- int loop_at_this_size = 0;
int overshoot_seen = 0;
int undershoot_seen = 0;
int low_cr_seen = 0;
@@ -3212,7 +3211,7 @@
// Update q and decide whether to do a recode loop
recode_loop_update_q(cpi, &loop, &q, &q_low, &q_high, top_index,
bottom_index, &undershoot_seen, &overshoot_seen,
- &low_cr_seen, loop_at_this_size);
+ &low_cr_seen, loop_count);
}
// Special case for overlay frame.
@@ -3230,7 +3229,6 @@
if (loop) {
++loop_count;
- ++loop_at_this_size;
#if CONFIG_INTERNAL_STATS
++cpi->tot_recode_hits;
diff --git a/av1/encoder/rc_utils.h b/av1/encoder/rc_utils.h
index 790ab09..b2377ca 100644
--- a/av1/encoder/rc_utils.h
+++ b/av1/encoder/rc_utils.h
@@ -182,15 +182,33 @@
return q_regulated;
}
-// Called after encode_with_recode_loop() has just encoded a frame and packed
-// its bitstream. This function works out whether we under- or over-shot
-// our bitrate target and adjusts q as appropriate. Also decides whether
-// or not we should do another recode loop, indicated by *loop
+/*!\brief Called after encode_with_recode_loop() has just encoded a frame
+ * and packed its bitstream. This function works out whether we under-
+ * or over-shot our bitrate target and adjusts q as appropriate. It also
+ * decides whether or not we should do another recode loop.
+ *
+ * \ingroup rate_control
+ *
+ * \param[in] cpi Top-level encoder structure
+ * \param[out] loop Should we go around the recode loop again
+ * \param[in,out] q New q index value
+ * \param[in,out] q_low Low q index limit for this loop itteration
+ * \param[in,out] q_high High q index limit for this loop itteration
+ * \param[in] top_index Max permited new value for q index
+ * \param[in] bottom_index Min permited new value for q index
+ * \param[in,out] undershoot_seen Have we seen undershoot on this frame
+ * \param[in,out] overshoot_seen Have we seen overshoot on this frame
+ * \param[in,out] low_cr_seen Have we previously trriggered recode
+ * because the compression ration was less
+ * than a given minimum threshold.
+ * \param[in] loop_count Loop itterations so far.
+ *
+ */
static AOM_INLINE void recode_loop_update_q(
AV1_COMP *const cpi, int *const loop, int *const q, int *const q_low,
int *const q_high, const int top_index, const int bottom_index,
int *const undershoot_seen, int *const overshoot_seen,
- int *const low_cr_seen, const int loop_at_this_size) {
+ int *const low_cr_seen, const int loop_count) {
AV1_COMMON *const cm = &cpi->common;
RATE_CONTROL *const rc = &cpi->rc;
const RateControlCfg *const rc_cfg = &cpi->oxcf.rc_cfg;
@@ -296,17 +314,17 @@
// Raise Qlow as to at least the current value
*q_low = AOMMIN(*q + 1, *q_high);
- if (*undershoot_seen || loop_at_this_size > 2 ||
- (loop_at_this_size == 2 && !frame_is_intra_only(cm))) {
+ if (*undershoot_seen || loop_count > 2 ||
+ (loop_count == 2 && !frame_is_intra_only(cm))) {
av1_rc_update_rate_correction_factors(cpi, cm->width, cm->height);
*q = (*q_high + *q_low + 1) / 2;
- } else if (loop_at_this_size == 2 && frame_is_intra_only(cm)) {
+ } else if (loop_count == 2 && frame_is_intra_only(cm)) {
const int q_mid = (*q_high + *q_low + 1) / 2;
const int q_regulated = get_regulated_q_overshoot(
cpi, *q_low, *q_high, top_index, bottom_index);
// Get 'q' in-between 'q_mid' and 'q_regulated' for a smooth
- // transition between loop_at_this_size < 2 and loop_at_this_size > 2.
+ // transition between loop_count < 2 and loop_count > 2.
*q = (q_mid + q_regulated + 1) / 2;
} else {
*q = get_regulated_q_overshoot(cpi, *q_low, *q_high, top_index,
@@ -318,16 +336,16 @@
// Frame is too small
*q_high = AOMMAX(*q - 1, *q_low);
- if (*overshoot_seen || loop_at_this_size > 2 ||
- (loop_at_this_size == 2 && !frame_is_intra_only(cm))) {
+ if (*overshoot_seen || loop_count > 2 ||
+ (loop_count == 2 && !frame_is_intra_only(cm))) {
av1_rc_update_rate_correction_factors(cpi, cm->width, cm->height);
*q = (*q_high + *q_low) / 2;
- } else if (loop_at_this_size == 2 && frame_is_intra_only(cm)) {
+ } else if (loop_count == 2 && frame_is_intra_only(cm)) {
const int q_mid = (*q_high + *q_low) / 2;
const int q_regulated =
get_regulated_q_undershoot(cpi, *q_high, top_index, bottom_index);
// Get 'q' in-between 'q_mid' and 'q_regulated' for a smooth
- // transition between loop_at_this_size < 2 and loop_at_this_size > 2.
+ // transition between loop_count < 2 and loop_count > 2.
*q = (q_mid + q_regulated) / 2;
// Special case reset for qlow for constrained quality.
diff --git a/doc/dev_guide/av1_encoder.dox b/doc/dev_guide/av1_encoder.dox
index f6311e8..f8b9f93 100644
--- a/doc/dev_guide/av1_encoder.dox
+++ b/doc/dev_guide/av1_encoder.dox
@@ -483,8 +483,9 @@
For more information the reader is directed to the following functions:
-- (TODO REF) encode_with_recode_loop()
-- (TODO REF) recode_loop_update_q()
+- encode_with_recode_loop()
+- \ref encode_without_recode()
+- recode_loop_update_q()
- (TODO REF) av1_set_speed_features_framesize_independent()
- (TODO REF) av1_set_speed_features_framesize_dependent()
diff --git a/docs.cmake b/docs.cmake
index 608e90e..b842976 100644
--- a/docs.cmake
+++ b/docs.cmake
@@ -136,6 +136,7 @@
"${AOM_ROOT}/av1/encoder/pickrst.h"
"${AOM_ROOT}/av1/encoder/ratectrl.c"
"${AOM_ROOT}/av1/encoder/ratectrl.h"
+ "${AOM_ROOT}/av1/encoder/rc_utils.h"
"${AOM_ROOT}/av1/encoder/rdopt.h"
"${AOM_ROOT}/av1/encoder/rdopt.c"
"${AOM_ROOT}/av1/encoder/speed_features.h"