hardware/intel/common/vaapi
Revisión | 449c6f91b38417d0baa0e463338760cb118ce9a5 (tree) |
---|---|
Tiempo | 2019-01-08 11:19:19 |
Autor | Haihao Xiang <haihao.xiang@inte...> |
Commiter | Xiang, Haihao |
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>
@@ -1760,26 +1760,25 @@ gen9_hevc_brc_prepare(struct encode_state *encode_state, | ||
1760 | 1760 | else |
1761 | 1761 | priv_state->lcu_brc_enabled = 0; |
1762 | 1762 | |
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 | + | |
1763 | 1767 | 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; | |
1769 | 1770 | } 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 * | |
1776 | 1773 | (2 * encoder_context->brc.target_percentage[0] - 100) / |
1777 | 1774 | 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; | |
1780 | 1777 | |
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; | |
1783 | 1782 | } |
1784 | 1783 | |
1785 | 1784 | if (encoder_context->brc.framerate[0].den) |