diff options
author | Marco Paniconi <marpan@google.com> | 2014-03-14 14:35:47 -0700 |
---|---|---|
committer | Marco Paniconi <marpan@google.com> | 2014-03-18 10:59:21 -0700 |
commit | 6b83884ba995640bf6d348173fdd299d95e3c1aa (patch) | |
tree | c04c7a48cecd9a6886ead802712ab4499c95c925 /vp9/encoder/vp9_onyx_if.c | |
parent | c9a0309f132ffbdfd0566f4a83558057c70a562f (diff) | |
download | libvpx-6b83884ba995640bf6d348173fdd299d95e3c1aa.tar libvpx-6b83884ba995640bf6d348173fdd299d95e3c1aa.tar.gz libvpx-6b83884ba995640bf6d348173fdd299d95e3c1aa.tar.bz2 libvpx-6b83884ba995640bf6d348173fdd299d95e3c1aa.zip |
In-frame q adjustment for cyclic background refresh.
Activated using aq_mode=3.
Change-Id: Ied628b9e7bd0e88b0c75790276bca75b19eb5c07
Diffstat (limited to 'vp9/encoder/vp9_onyx_if.c')
-rw-r--r-- | vp9/encoder/vp9_onyx_if.c | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/vp9/encoder/vp9_onyx_if.c b/vp9/encoder/vp9_onyx_if.c index c3acd2e56..b0e5e1a5d 100644 --- a/vp9/encoder/vp9_onyx_if.c +++ b/vp9/encoder/vp9_onyx_if.c @@ -28,6 +28,7 @@ #include "vp9/common/vp9_tile_common.h" #include "vp9/encoder/vp9_bitstream.h" +#include "vp9/encoder/vp9_craq.h" #include "vp9/encoder/vp9_encodeframe.h" #include "vp9/encoder/vp9_encodemv.h" #include "vp9/encoder/vp9_firstpass.h" @@ -173,6 +174,8 @@ static void dealloc_compressor_data(VP9_COMP *cpi) { vpx_free(cpi->complexity_map); cpi->complexity_map = 0; + vpx_free(cpi->cyclic_refresh.map); + cpi->cyclic_refresh.map = 0; vpx_free(cpi->active_map); cpi->active_map = 0; @@ -200,8 +203,7 @@ static void dealloc_compressor_data(VP9_COMP *cpi) { } // Computes a q delta (in "q index" terms) to get from a starting q value -// to a target value -// target q value +// to a target q value int vp9_compute_qdelta(const VP9_COMP *cpi, double qstart, double qtarget) { const RATE_CONTROL *const rc = &cpi->rc; int start_index = rc->worst_quality; @@ -226,10 +228,9 @@ int vp9_compute_qdelta(const VP9_COMP *cpi, double qstart, double qtarget) { } // Computes a q delta (in "q index" terms) to get from a starting q value -// to a value that should equate to thegiven rate ratio. - -static int compute_qdelta_by_rate(VP9_COMP *cpi, int base_q_index, - double rate_target_ratio) { +// to a value that should equate to the given rate ratio. +int vp9_compute_qdelta_by_rate(VP9_COMP *cpi, int base_q_index, + double rate_target_ratio) { int i; int target_index = cpi->rc.worst_quality; @@ -282,8 +283,10 @@ static void setup_in_frame_q_adj(VP9_COMP *cpi) { // Use some of the segments for in frame Q adjustment for (segment = 1; segment < 2; segment++) { - const int qindex_delta = compute_qdelta_by_rate(cpi, cm->base_qindex, - in_frame_q_adj_ratio[segment]); + const int qindex_delta = + vp9_compute_qdelta_by_rate(cpi, + cm->base_qindex, + in_frame_q_adj_ratio[segment]); vp9_enable_segfeature(seg, segment, SEG_LVL_ALT_Q); vp9_set_segdata(seg, segment, SEG_LVL_ALT_Q, qindex_delta); } @@ -1648,6 +1651,9 @@ VP9_COMP *vp9_create_compressor(VP9_CONFIG *oxcf) { CHECK_MEM_ERROR(cm, cpi->complexity_map, vpx_calloc(cm->mi_rows * cm->mi_cols, 1)); + // Create a map used for cyclic background refresh. + CHECK_MEM_ERROR(cm, cpi->cyclic_refresh.map, + vpx_calloc(cm->mi_rows * cm->mi_cols, 1)); // And a place holder structure is the coding context // for use if we want to save and restore it @@ -2707,6 +2713,8 @@ static void encode_without_recode_loop(VP9_COMP *cpi, vp9_vaq_frame_setup(cpi); } else if (cpi->oxcf.aq_mode == COMPLEXITY_AQ) { setup_in_frame_q_adj(cpi); + } else if (cpi->oxcf.aq_mode == CYCLIC_REFRESH_AQ) { + vp9_setup_cyclic_refresh_aq(cpi); } // transform / motion compensation build reconstruction frame vp9_encode_frame(cpi); |