We can do QP compensation per layer.
Signed-off-by: Xiang, Haihao <[email protected]>
---
src/gen6_mfc.h | 2 +-
src/gen6_mfc_common.c | 10 +++++-----
src/gen8_mfc.c | 10 +++++-----
3 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/src/gen6_mfc.h b/src/gen6_mfc.h
index 02591a3..e0972bb 100644
--- a/src/gen6_mfc.h
+++ b/src/gen6_mfc.h
@@ -232,7 +232,7 @@ struct gen6_mfc_context
int target_frame_size[MAX_TEMPORAL_LAYERS][3]; // I,P,B
int qp_prime_y[MAX_TEMPORAL_LAYERS][3];
double bits_per_frame[MAX_TEMPORAL_LAYERS];
- double qpf_rounding_accumulator;
+ double qpf_rounding_accumulator[MAX_TEMPORAL_LAYERS];
double saved_bps;
double saved_fps;
diff --git a/src/gen6_mfc_common.c b/src/gen6_mfc_common.c
index 33226a5..fbce493 100644
--- a/src/gen6_mfc_common.c
+++ b/src/gen6_mfc_common.c
@@ -254,13 +254,13 @@ int intel_mfc_brc_postpack(struct encode_state
*encode_state,
if (qpn == qp) {
/* setting qpn we round qpf making mistakes: now we are trying to
compensate this */
- mfc_context->brc.qpf_rounding_accumulator += qpf - qpn;
- if (mfc_context->brc.qpf_rounding_accumulator > 1.0) {
+ mfc_context->brc.qpf_rounding_accumulator[next_frame_layer_id] += qpf
- qpn;
+ if (mfc_context->brc.qpf_rounding_accumulator[next_frame_layer_id] >
1.0) {
qpn++;
- mfc_context->brc.qpf_rounding_accumulator = 0.;
- } else if (mfc_context->brc.qpf_rounding_accumulator < -1.0) {
+ mfc_context->brc.qpf_rounding_accumulator[next_frame_layer_id] =
0.;
+ } else if
(mfc_context->brc.qpf_rounding_accumulator[next_frame_layer_id] < -1.0) {
qpn--;
- mfc_context->brc.qpf_rounding_accumulator = 0.;
+ mfc_context->brc.qpf_rounding_accumulator[next_frame_layer_id] =
0.;
}
}
/* making sure that QP is not changing too fast */
diff --git a/src/gen8_mfc.c b/src/gen8_mfc.c
index e4506b6..6576950 100644
--- a/src/gen8_mfc.c
+++ b/src/gen8_mfc.c
@@ -3412,13 +3412,13 @@ static int gen8_mfc_vp8_brc_postpack(struct
encode_state *encode_state,
if (qpn == qp) {
/* setting qpn we round qpf making mistakes: now we are trying to
compensate this */
- mfc_context->brc.qpf_rounding_accumulator += qpf - qpn;
- if (mfc_context->brc.qpf_rounding_accumulator > 1.0) {
+ mfc_context->brc.qpf_rounding_accumulator[0] += qpf - qpn;
+ if (mfc_context->brc.qpf_rounding_accumulator[0] > 1.0) {
qpn++;
- mfc_context->brc.qpf_rounding_accumulator = 0.;
- } else if (mfc_context->brc.qpf_rounding_accumulator < -1.0) {
+ mfc_context->brc.qpf_rounding_accumulator[0] = 0.;
+ } else if (mfc_context->brc.qpf_rounding_accumulator[0] < -1.0) {
qpn--;
- mfc_context->brc.qpf_rounding_accumulator = 0.;
+ mfc_context->brc.qpf_rounding_accumulator[0] = 0.;
}
}
--
1.9.1
_______________________________________________
Libva mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/libva