Signed-off-by: Xiang, Haihao <haihao.xiang@intel.com>
struct gen6_mfc_context *mfc_context = encoder_context->mfc_context;
if (rate_control_mode == VA_RC_CBR) {
+ assert(encoder_context->codec != CODEC_MPEG2);
+
/*Programing bit rate control */
if ( mfc_context->bit_rate_control_context[SLICE_TYPE_I].MaxSizeInWord == 0 ) {
intel_mfc_bit_rate_control_context_init(encode_state, mfc_context);
case VAConfigAttribRateControl:
if (entrypoint == VAEntrypointEncSlice) {
- attrib_list[i].value = VA_RC_CBR | VA_RC_CQP;
+ attrib_list[i].value = VA_RC_CQP;
+
+ if (profile != VAProfileMPEG2Main &&
+ profile != VAProfileMPEG2Simple)
+ attrib_list[i].value |= VA_RC_CBR;
break;
}
for (i = 0; i < obj_config->num_attribs; i++) {
if (obj_config->attrib_list[i].type == VAConfigAttribRateControl) {
encoder_context->rate_control_mode = obj_config->attrib_list[i].value;
+
+ if (encoder_context->codec == CODEC_MPEG2 &&
+ encoder_context->rate_control_mode & VA_RC_CBR) {
+ WARN_ONCE("Don't support CBR for MPEG-2 encoding\n");
+ encoder_context->rate_control_mode &= ~VA_RC_CBR;
+ }
+
break;
}
}