aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHirokazu Honda <hiroh@chromium.org>2022-11-17 16:05:28 +0900
committerHirokazu Honda <hiroh@chromium.org>2022-11-18 11:43:34 +0900
commit3fa698a6e855aad203517b8e71290b837ceda192 (patch)
tree98ec8675dfbf290f272f41906fb7838015bbb2f6
parent5245f6e9cb7e6bb68ab45fe4d8b00bc9b16857e1 (diff)
downloadlibvpx-3fa698a6e855aad203517b8e71290b837ceda192.tar.gz
vp9/rate_ctrl_rtc: Improve get cyclic refresh data
A client of the vp9 rate controller needs to know whether the segmentation is enabled and the size of delta_q. It is also nicer to know the size of map. This CL changes the interface to achieve these. Bug: b:259487065 Test: Build Change-Id: If05854530f97e1430a7b97788910f277ab673a87
-rw-r--r--vp9/ratectrl_rtc.cc16
-rw-r--r--vp9/ratectrl_rtc.h10
2 files changed, 18 insertions, 8 deletions
diff --git a/vp9/ratectrl_rtc.cc b/vp9/ratectrl_rtc.cc
index f4d7f7e9e..a9287b5a3 100644
--- a/vp9/ratectrl_rtc.cc
+++ b/vp9/ratectrl_rtc.cc
@@ -205,12 +205,16 @@ int VP9RateControlRTC::GetLoopfilterLevel() const {
return lf->filter_level;
}
-signed char *VP9RateControlRTC::GetCyclicRefreshMap() const {
- return cpi_->cyclic_refresh->map;
-}
-
-int *VP9RateControlRTC::GetDeltaQ() const {
- return cpi_->cyclic_refresh->qindex_delta;
+bool VP9RateControlRTC::GetSegmentationData(
+ VP9SegmentationData *segmentation_data) const {
+ if (!cpi_->cyclic_refresh->apply_cyclic_refresh) return false;
+
+ segmentation_data->segmentation_map = cpi_->segmentation_map;
+ segmentation_data->segmentation_map_size =
+ cpi_->common.mi_cols * cpi_->common.mi_rows;
+ segmentation_data->delta_q = cpi_->cyclic_refresh->qindex_delta;
+ segmentation_data->delta_q_size = 3u;
+ return true;
}
void VP9RateControlRTC::PostEncodeUpdate(uint64_t encoded_frame_size) {
diff --git a/vp9/ratectrl_rtc.h b/vp9/ratectrl_rtc.h
index d2b9417ae..b209e4db6 100644
--- a/vp9/ratectrl_rtc.h
+++ b/vp9/ratectrl_rtc.h
@@ -58,6 +58,13 @@ struct VP9FrameParamsQpRTC {
int temporal_layer_id;
};
+struct VP9SegmentationData {
+ const uint8_t *segmentation_map;
+ size_t segmentation_map_size;
+ const int *delta_q;
+ size_t delta_q_size;
+};
+
// This interface allows using VP9 real-time rate control without initializing
// the encoder. To use this interface, you need to link with libvpxrc.a.
//
@@ -110,8 +117,7 @@ class VP9RateControlRTC {
// GetQP() needs to be called after ComputeQP() to get the latest QP
int GetQP() const;
int GetLoopfilterLevel() const;
- signed char *GetCyclicRefreshMap() const;
- int *GetDeltaQ() const;
+ bool GetSegmentationData(VP9SegmentationData *segmentation_data) const;
void ComputeQP(const VP9FrameParamsQpRTC &frame_params);
// Feedback to rate control with the size of current encoded frame
void PostEncodeUpdate(uint64_t encoded_frame_size);