diff options
author | Xiang, Haihao <haihao.xiang@intel.com> | 2016-09-13 16:02:41 +0800 |
---|---|---|
committer | Sean V Kelley <seanvk@posteo.de> | 2016-09-16 10:50:41 -0700 |
commit | d104402f7d1543c3e9d7bc8046e8e90b8908b0b9 (patch) | |
tree | c5d3c640873a81e5f77cf1218ac3acd9158a654f | |
parent | 0285ff9f33d6cdf28b59ca10a725870bda1e0212 (diff) |
Use arrays to store bitrate and framerate
Currently only the first element is used
v2: rebased
Signed-off-by: Xiang, Haihao <haihao.xiang@intel.com>
Tested-by: Luo, Focus <focus.luo@intel.com>
Reviewed-by: Zhao Yakui <yakui.zhao@intel.com>
-rw-r--r-- | src/gen6_mfc_common.c | 6 | ||||
-rw-r--r-- | src/i965_encoder.c | 18 | ||||
-rw-r--r-- | 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 8677ecb..1641db6 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 8db1463..cce59f2 100644 --- a/src/i965_encoder.c +++ b/src/i965_encoder.c @@ -339,12 +339,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; } @@ -379,8 +379,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; } } @@ -410,8 +410,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; } } @@ -498,7 +498,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 8058ccc..ba31364 100644 --- a/src/i965_encoder.h +++ b/src/i965_encoder.h @@ -79,8 +79,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; |