summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXiang, Haihao <haihao.xiang@intel.com>2013-08-08 09:52:33 +0800
committerXiang, Haihao <haihao.xiang@intel.com>2013-09-06 15:30:02 +0800
commit496bd7f47f93ad4ac4f3510aa1c088c027bfe762 (patch)
treeff4fb7569bdcf5c6d99ba4e52eb8923eb88d53b2
parentf08afbabeade7403557413f4858548d9a91b0d3e (diff)
Cleanup profile tracking in encoder
Signed-off-by: Xiang, Haihao <haihao.xiang@intel.com> (cherry picked from commit edd25a94e92b9cec23594dc978691506a1c8cfab)
-rw-r--r--src/gen6_mfc_common.c2
-rw-r--r--src/gen6_vme.c4
-rw-r--r--src/gen75_mfc.c2
-rw-r--r--src/gen75_vme.c22
-rw-r--r--src/gen7_mfc.c2
-rw-r--r--src/gen7_vme.c9
-rw-r--r--src/i965_encoder.c19
-rw-r--r--src/i965_encoder.h2
8 files changed, 33 insertions, 29 deletions
diff --git a/src/gen6_mfc_common.c b/src/gen6_mfc_common.c
index ba56c1a..c2ec080 100644
--- a/src/gen6_mfc_common.c
+++ b/src/gen6_mfc_common.c
@@ -642,7 +642,7 @@ VAStatus intel_mfc_avc_prepare(VADriverContextP ctx,
dri_bo_map(bo, 1);
coded_buffer_segment = (struct i965_coded_buffer_segment *)bo->virtual;
coded_buffer_segment->mapped = 0;
- coded_buffer_segment->codec = CODEC_H264;
+ coded_buffer_segment->codec = encoder_context->codec;
dri_bo_unmap(bo);
return vaStatus;
diff --git a/src/gen6_vme.c b/src/gen6_vme.c
index 69c667d..443dda8 100644
--- a/src/gen6_vme.c
+++ b/src/gen6_vme.c
@@ -649,9 +649,7 @@ Bool gen6_vme_context_init(VADriverContextP ctx, struct intel_encoder_context *e
{
struct gen6_vme_context *vme_context = NULL;
- if (encoder_context->profile != VAProfileH264Baseline &&
- encoder_context->profile != VAProfileH264Main &&
- encoder_context->profile != VAProfileH264High) {
+ if (encoder_context->codec != CODEC_H264) {
/* Never get here */
assert(0);
return False;
diff --git a/src/gen75_mfc.c b/src/gen75_mfc.c
index 3fdae21..d2201e3 100644
--- a/src/gen75_mfc.c
+++ b/src/gen75_mfc.c
@@ -2439,7 +2439,7 @@ intel_mfc_mpeg2_prepare(VADriverContextP ctx,
dri_bo_map(bo, 1);
coded_buffer_segment = (struct i965_coded_buffer_segment *)bo->virtual;
coded_buffer_segment->mapped = 0;
- coded_buffer_segment->codec = CODEC_MPEG2;
+ coded_buffer_segment->codec = encoder_context->codec;
dri_bo_unmap(bo);
return vaStatus;
diff --git a/src/gen75_vme.c b/src/gen75_vme.c
index b796505..231ffc6 100644
--- a/src/gen75_vme.c
+++ b/src/gen75_vme.c
@@ -374,17 +374,14 @@ static VAStatus gen75_vme_constant_setup(VADriverContextP ctx,
vme_state_message = (unsigned int *)vme_context->vme_state_message;
- if (encoder_context->profile == VAProfileH264Baseline ||
- encoder_context->profile == VAProfileH264Main ||
- encoder_context->profile == VAProfileH264High) {
+ if (encoder_context->codec == CODEC_H264) {
if (vme_context->h264_level >= 30) {
mv_num = 16;
if (vme_context->h264_level >= 31)
mv_num = 8;
}
- } else if (encoder_context->profile == VAProfileMPEG2Simple ||
- encoder_context->profile == VAProfileMPEG2Main) {
+ } else if (encoder_context->codec == CODEC_MPEG2) {
mv_num = 2;
}
@@ -501,10 +498,8 @@ static VAStatus gen75_vme_vme_state_setup(VADriverContextP ctx,
vme_state_message[i] = 0;
}
- switch (encoder_context->profile) {
- case VAProfileH264Baseline:
- case VAProfileH264Main:
- case VAProfileH264High:
+ switch (encoder_context->codec) {
+ case CODEC_H264:
gen75_vme_state_setup_fixup(ctx, encode_state, encoder_context, vme_state_message);
break;
@@ -1009,17 +1004,14 @@ Bool gen75_vme_context_init(VADriverContextP ctx, struct intel_encoder_context *
struct i965_kernel *vme_kernel_list = NULL;
int i965_kernel_num;
- switch (encoder_context->profile) {
- case VAProfileH264Baseline:
- case VAProfileH264Main:
- case VAProfileH264High:
+ switch (encoder_context->codec) {
+ case CODEC_H264:
vme_kernel_list = gen75_vme_kernels;
encoder_context->vme_pipeline = gen75_vme_pipeline;
i965_kernel_num = sizeof(gen75_vme_kernels) / sizeof(struct i965_kernel);
break;
- case VAProfileMPEG2Simple:
- case VAProfileMPEG2Main:
+ case CODEC_MPEG2:
vme_kernel_list = gen75_vme_mpeg2_kernels;
encoder_context->vme_pipeline = gen75_vme_mpeg2_pipeline;
i965_kernel_num = sizeof(gen75_vme_mpeg2_kernels) / sizeof(struct i965_kernel);
diff --git a/src/gen7_mfc.c b/src/gen7_mfc.c
index d1eb9a6..dda8f91 100644
--- a/src/gen7_mfc.c
+++ b/src/gen7_mfc.c
@@ -1069,7 +1069,7 @@ gen7_mfc_mpeg2_prepare(VADriverContextP ctx,
dri_bo_map(bo, 1);
coded_buffer_segment = (struct i965_coded_buffer_segment *)bo->virtual;
coded_buffer_segment->mapped = 0;
- coded_buffer_segment->codec = CODEC_MPEG2;
+ coded_buffer_segment->codec = encoder_context->codec;
dri_bo_unmap(bo);
return vaStatus;
diff --git a/src/gen7_vme.c b/src/gen7_vme.c
index 88eb484..11af9e5 100644
--- a/src/gen7_vme.c
+++ b/src/gen7_vme.c
@@ -1092,21 +1092,18 @@ Bool gen7_vme_context_init(VADriverContextP ctx, struct intel_encoder_context *e
gen7_vme_scoreboard_init(ctx, vme_context);
- if(encoder_context->profile == VAProfileH264Baseline ||
- encoder_context->profile == VAProfileH264Main ||
- encoder_context->profile == VAProfileH264High ){
+ if (encoder_context->codec == CODEC_H264) {
vme_kernel_list = gen7_vme_kernels;
vme_context->video_coding_type = VIDEO_CODING_AVC;
vme_context->vme_kernel_sum = AVC_VME_KERNEL_SUM;
encoder_context->vme_pipeline = gen7_vme_pipeline;
- } else if (encoder_context->profile == VAProfileMPEG2Simple ||
- encoder_context->profile == VAProfileMPEG2Main ){
+ } else if (encoder_context->codec == CODEC_MPEG2) {
vme_kernel_list = gen7_vme_mpeg2_kernels;
vme_context->video_coding_type = VIDEO_CODING_MPEG2;
vme_context->vme_kernel_sum = MPEG2_VME_KERNEL_SUM;
encoder_context->vme_pipeline = gen7_vme_mpeg2_pipeline;
} else {
- /* Unsupported encoding profile */
+ /* Unsupported codec */
assert(0);
}
diff --git a/src/i965_encoder.c b/src/i965_encoder.c
index 4384619..73cd3e3 100644
--- a/src/i965_encoder.c
+++ b/src/i965_encoder.c
@@ -345,7 +345,24 @@ intel_enc_hw_context_init(VADriverContextP ctx,
encoder_context->input_yuv_surface = VA_INVALID_SURFACE;
encoder_context->is_tmp_id = 0;
encoder_context->rate_control_mode = VA_RC_NONE;
- encoder_context->profile = obj_config->profile;
+
+ switch (obj_config->profile) {
+ case VAProfileMPEG2Simple:
+ case VAProfileMPEG2Main:
+ encoder_context->codec = CODEC_MPEG2;
+ break;
+
+ case VAProfileH264Baseline:
+ case VAProfileH264Main:
+ case VAProfileH264High:
+ encoder_context->codec = CODEC_H264;
+ break;
+
+ default:
+ /* Never get here */
+ assert(0);
+ break;
+ }
for (i = 0; i < obj_config->num_attribs; i++) {
if (obj_config->attrib_list[i].type == VAConfigAttribRateControl) {
diff --git a/src/i965_encoder.h b/src/i965_encoder.h
index d9d6511..29bd702 100644
--- a/src/i965_encoder.h
+++ b/src/i965_encoder.h
@@ -39,7 +39,7 @@
struct intel_encoder_context
{
struct hw_context base;
- VAProfile profile;
+ int codec;
VASurfaceID input_yuv_surface;
int is_tmp_id;
unsigned int rate_control_mode;