Android-x86
Fork
Donation

  • R/O
  • HTTP
  • SSH
  • HTTPS

hardware-intel-common-vaapi: Commit

hardware/intel/common/vaapi


Commit MetaInfo

Revision449c6f91b38417d0baa0e463338760cb118ce9a5 (tree)
Time2019-01-08 11:19:19
AuthorHaihao Xiang <haihao.xiang@inte...>
CommiterXiang, Haihao

Log Message

HEVC encoder: correct the minimal bitrate for VBR

This fixes https://github.com/intel/intel-vaapi-driver/issues/430

Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
Tested-by: U. Artie Eoff <ullysses.a.eoff@intel.com>

Change Summary

Incremental Difference

--- a/src/gen9_hevc_encoder.c
+++ b/src/gen9_hevc_encoder.c
@@ -1760,26 +1760,25 @@ gen9_hevc_brc_prepare(struct encode_state *encode_state,
17601760 else
17611761 priv_state->lcu_brc_enabled = 0;
17621762
1763+ priv_state->max_bit_rate_in_kbs =
1764+ ALIGN(encoder_context->brc.bits_per_second[0], HEVC_BRC_KBPS) /
1765+ HEVC_BRC_KBPS;
1766+
17631767 if (brc_method == HEVC_BRC_CBR) {
1764- priv_state->target_bit_rate_in_kbs =
1765- ALIGN(encoder_context->brc.bits_per_second[0], HEVC_BRC_KBPS) /
1766- HEVC_BRC_KBPS;
1767- priv_state->max_bit_rate_in_kbs = priv_state->target_bit_rate_in_kbs;
1768- priv_state->min_bit_rate_in_kbs = priv_state->target_bit_rate_in_kbs;
1768+ priv_state->target_bit_rate_in_kbs = priv_state->max_bit_rate_in_kbs;
1769+ priv_state->min_bit_rate_in_kbs = priv_state->max_bit_rate_in_kbs;
17691770 } else {
1770- if (encoder_context->brc.target_percentage[0] > HEVC_BRC_MIN_TARGET_PERCENTAGE) {
1771- priv_state->target_bit_rate_in_kbs =
1772- ALIGN(encoder_context->brc.bits_per_second[0], HEVC_BRC_KBPS) /
1773- HEVC_BRC_KBPS;
1774- priv_state->max_bit_rate_in_kbs = priv_state->target_bit_rate_in_kbs;
1775- priv_state->min_bit_rate_in_kbs = priv_state->target_bit_rate_in_kbs *
1771+ if (encoder_context->brc.target_percentage[0] > HEVC_BRC_MIN_TARGET_PERCENTAGE)
1772+ priv_state->min_bit_rate_in_kbs = priv_state->max_bit_rate_in_kbs *
17761773 (2 * encoder_context->brc.target_percentage[0] - 100) /
17771774 100;
1778- priv_state->target_bit_rate_in_kbs = priv_state->max_bit_rate_in_kbs *
1779- encoder_context->brc.target_percentage[0] / 100;
1775+ else
1776+ priv_state->min_bit_rate_in_kbs = 0;
17801777
1781- brc_reset = 1;
1782- }
1778+ priv_state->target_bit_rate_in_kbs = priv_state->max_bit_rate_in_kbs *
1779+ encoder_context->brc.target_percentage[0] / 100;
1780+
1781+ brc_reset = 1;
17831782 }
17841783
17851784 if (encoder_context->brc.framerate[0].den)
Show on old repository browser