[Libva] [Libva-intel-driver][PATCH 12/18] Use arrays to store bitrate and framerate
Xiang, Haihao
haihao.xiang at intel.com
Tue Sep 6 15:45:59 UTC 2016
Currently only the first element is used
Signed-off-by: Xiang, Haihao <haihao.xiang at intel.com>
---
src/gen6_mfc_common.c | 6 +++---
src/i965_encoder.c | 18 +++++++++---------
src/i965_encoder.h | 4 ++--
3 files changed, 14 insertions(+), 14 deletions(-)
diff --git a/src/gen6_mfc_common.c b/src/gen6_mfc_common.c
index dc4bc3b..edeaef9 100644
--- a/src/gen6_mfc_common.c
+++ b/src/gen6_mfc_common.c
@@ -94,8 +94,8 @@ static void intel_mfc_brc_init(struct encode_state *encode_state,
struct intel_encoder_context* encoder_context)
{
struct gen6_mfc_context *mfc_context = encoder_context->mfc_context;
- double bitrate = encoder_context->brc.bits_per_second;
- double framerate = (double)encoder_context->brc.framerate_per_100s / 100.0;
+ double bitrate = encoder_context->brc.bits_per_second[0];
+ double framerate = (double)encoder_context->brc.framerate_per_100s[0] / 100.0;
int inum = encoder_context->brc.num_iframes_in_gop,
pnum = encoder_context->brc.num_pframes_in_gop,
bnum = encoder_context->brc.num_bframes_in_gop; /* Gop structure: number of I, P, B frames in the Gop. */
@@ -296,7 +296,7 @@ static void intel_mfc_hrd_context_init(struct encode_state *encode_state,
{
struct gen6_mfc_context *mfc_context = encoder_context->mfc_context;
unsigned int rate_control_mode = encoder_context->rate_control_mode;
- int target_bit_rate = encoder_context->brc.bits_per_second;
+ int target_bit_rate = encoder_context->brc.bits_per_second[0];
// current we only support CBR mode.
if (rate_control_mode == VA_RC_CBR) {
diff --git a/src/i965_encoder.c b/src/i965_encoder.c
index 1ba24e6..7bb369a 100644
--- a/src/i965_encoder.c
+++ b/src/i965_encoder.c
@@ -333,12 +333,12 @@ intel_encoder_check_brc_h264_sequence_parameter(VADriverContextP ctx,
if (num_pframes_in_gop != encoder_context->brc.num_pframes_in_gop ||
num_bframes_in_gop != encoder_context->brc.num_bframes_in_gop ||
- bits_per_second != encoder_context->brc.bits_per_second ||
- framerate_per_100s != encoder_context->brc.framerate_per_100s) {
+ bits_per_second != encoder_context->brc.bits_per_second[0] ||
+ framerate_per_100s != encoder_context->brc.framerate_per_100s[0]) {
encoder_context->brc.num_pframes_in_gop = num_pframes_in_gop;
encoder_context->brc.num_bframes_in_gop = num_bframes_in_gop;
- encoder_context->brc.bits_per_second = bits_per_second;
- encoder_context->brc.framerate_per_100s = framerate_per_100s;
+ encoder_context->brc.bits_per_second[0] = bits_per_second;
+ encoder_context->brc.framerate_per_100s[0] = framerate_per_100s;
encoder_context->brc.need_reset = 1;
}
@@ -373,8 +373,8 @@ intel_encoder_check_rate_control_parameter(VADriverContextP ctx,
VAEncMiscParameterRateControl *misc)
{
// TODO: for VBR
- if (encoder_context->brc.bits_per_second != misc->bits_per_second) {
- encoder_context->brc.bits_per_second = misc->bits_per_second;
+ if (encoder_context->brc.bits_per_second[0] != misc->bits_per_second) {
+ encoder_context->brc.bits_per_second[0] = misc->bits_per_second;
encoder_context->brc.need_reset = 1;
}
}
@@ -404,8 +404,8 @@ intel_encoder_check_framerate_parameter(VADriverContextP ctx,
else
framerate_per_100s = misc->framerate * 100;
- if (encoder_context->brc.framerate_per_100s != framerate_per_100s) {
- encoder_context->brc.framerate_per_100s = framerate_per_100s;
+ if (encoder_context->brc.framerate_per_100s[0] != framerate_per_100s) {
+ encoder_context->brc.framerate_per_100s[0] = framerate_per_100s;
encoder_context->brc.need_reset = 1;
}
}
@@ -486,7 +486,7 @@ intel_encoder_check_temporal_layer_structure(VADriverContextP ctx,
if (tls_paramter->number_of_layers <= 1)
return VA_STATUS_SUCCESS;
- if (tls_paramter->number_of_layers >= MAX_TEMPORAL_LAYERS)
+ if (tls_paramter->number_of_layers > MAX_TEMPORAL_LAYERS)
return VA_STATUS_ERROR_INVALID_PARAMETER;
if (tls_paramter->periodicity > 32 || tls_paramter->periodicity <= 1)
diff --git a/src/i965_encoder.h b/src/i965_encoder.h
index 66d3d1d..2fe959c 100644
--- a/src/i965_encoder.h
+++ b/src/i965_encoder.h
@@ -77,8 +77,8 @@ struct intel_encoder_context
unsigned short num_iframes_in_gop;
unsigned short num_pframes_in_gop;
unsigned short num_bframes_in_gop;
- unsigned int bits_per_second;
- unsigned int framerate_per_100s;
+ unsigned int bits_per_second[MAX_TEMPORAL_LAYERS];
+ unsigned int framerate_per_100s[MAX_TEMPORAL_LAYERS];
unsigned int hrd_buffer_size;
unsigned int hrd_initial_buffer_fullness;
unsigned int need_reset;
--
1.9.1
More information about the Libva
mailing list