summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZhao Yakui <yakui.zhao@intel.com>2013-05-09 13:52:28 +0800
committerYakui Zhao <yakui.zhao@intel.com>2013-05-09 13:52:28 +0800
commit2008184e0c1d50f420af8a0f53cdfc59602149cd (patch)
tree2f36c3f96972567c38423cb8e53afd847596be5d
parent5bd630d4ea732818728b0a464f45739c86e08be3 (diff)
downloadlibva-intel-driver-2008184e0c1d50f420af8a0f53cdfc59602149cd.tar.gz
libva-intel-driver-2008184e0c1d50f420af8a0f53cdfc59602149cd.tar.bz2
libva-intel-driver-2008184e0c1d50f420af8a0f53cdfc59602149cd.zip
VME uses reference frame parsed from slice_param instead of hacked DPB
Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
-rw-r--r--src/gen6_vme.c51
-rw-r--r--src/gen75_vme.c49
-rw-r--r--src/gen7_vme.c51
3 files changed, 119 insertions, 32 deletions
diff --git a/src/gen6_vme.c b/src/gen6_vme.c
index 57311dc..69c667d 100644
--- a/src/gen6_vme.c
+++ b/src/gen6_vme.c
@@ -204,6 +204,7 @@ gen6_vme_surface_setup(VADriverContextP ctx,
struct intel_encoder_context *encoder_context)
{
struct object_surface *obj_surface;
+ struct i965_driver_data *i965 = i965_driver_data(ctx);
/*Setup surfaces state*/
/* current picture for encoding */
@@ -212,17 +213,45 @@ gen6_vme_surface_setup(VADriverContextP ctx,
gen6_vme_media_source_surface_state(ctx, 4, obj_surface, encoder_context);
if (!is_intra) {
- /* reference 0 */
- obj_surface = encode_state->reference_objects[0];
-
- if (obj_surface && obj_surface->bo)
- gen6_vme_source_surface_state(ctx, 1, obj_surface, encoder_context);
-
- /* reference 1 */
- obj_surface = encode_state->reference_objects[1];
-
- if (obj_surface && obj_surface->bo)
- gen6_vme_source_surface_state(ctx, 2, obj_surface, encoder_context);
+ VAEncSliceParameterBufferH264 *slice_param = (VAEncSliceParameterBufferH264 *)encode_state->slice_params_ext[0]->buffer;
+ int slice_type;
+ struct object_surface *slice_obj_surface;
+ int ref_surface_id;
+
+ slice_type = intel_avc_enc_slice_type_fixup(slice_param->slice_type);
+
+ if (slice_type == SLICE_TYPE_P || slice_type == SLICE_TYPE_B) {
+ slice_obj_surface = NULL;
+ ref_surface_id = slice_param->RefPicList0[0].picture_id;
+ if (ref_surface_id != 0 && ref_surface_id != VA_INVALID_SURFACE) {
+ slice_obj_surface = SURFACE(ref_surface_id);
+ }
+ if (slice_obj_surface && slice_obj_surface->bo) {
+ obj_surface = slice_obj_surface;
+ } else {
+ obj_surface = encode_state->reference_objects[0];
+ }
+ /* reference 0 */
+ if (obj_surface && obj_surface->bo)
+ gen6_vme_source_surface_state(ctx, 1, obj_surface, encoder_context);
+ }
+ if (slice_type == SLICE_TYPE_B) {
+ /* reference 1 */
+ slice_obj_surface = NULL;
+ ref_surface_id = slice_param->RefPicList1[0].picture_id;
+ if (ref_surface_id != 0 && ref_surface_id != VA_INVALID_SURFACE) {
+ slice_obj_surface = SURFACE(ref_surface_id);
+ }
+ if (slice_obj_surface && slice_obj_surface->bo) {
+ obj_surface = slice_obj_surface;
+ } else {
+ obj_surface = encode_state->reference_objects[0];
+ }
+
+ obj_surface = encode_state->reference_objects[1];
+ if (obj_surface && obj_surface->bo)
+ gen6_vme_source_surface_state(ctx, 2, obj_surface, encoder_context);
+ }
}
/* VME output */
diff --git a/src/gen75_vme.c b/src/gen75_vme.c
index 7d13ec3..b796505 100644
--- a/src/gen75_vme.c
+++ b/src/gen75_vme.c
@@ -264,6 +264,7 @@ gen75_vme_surface_setup(VADriverContextP ctx,
struct intel_encoder_context *encoder_context)
{
struct object_surface *obj_surface;
+ struct i965_driver_data *i965 = i965_driver_data(ctx);
/*Setup surfaces state*/
/* current picture for encoding */
@@ -273,17 +274,45 @@ gen75_vme_surface_setup(VADriverContextP ctx,
gen75_vme_media_chroma_source_surface_state(ctx, 6, obj_surface, encoder_context);
if (!is_intra) {
- /* reference 0 */
- obj_surface = encode_state->reference_objects[0];
-
- if (obj_surface && obj_surface->bo)
- gen75_vme_source_surface_state(ctx, 1, obj_surface, encoder_context);
-
- /* reference 1 */
- obj_surface = encode_state->reference_objects[1];
+ VAEncSliceParameterBufferH264 *slice_param = (VAEncSliceParameterBufferH264 *)encode_state->slice_params_ext[0]->buffer;
+ int slice_type;
+ struct object_surface *slice_obj_surface;
+ int ref_surface_id;
+
+ slice_type = intel_avc_enc_slice_type_fixup(slice_param->slice_type);
+
+ if (slice_type == SLICE_TYPE_P || slice_type == SLICE_TYPE_B) {
+ slice_obj_surface = NULL;
+ ref_surface_id = slice_param->RefPicList0[0].picture_id;
+ if (ref_surface_id != 0 && ref_surface_id != VA_INVALID_SURFACE) {
+ slice_obj_surface = SURFACE(ref_surface_id);
+ }
+ if (slice_obj_surface && slice_obj_surface->bo) {
+ obj_surface = slice_obj_surface;
+ } else {
+ obj_surface = encode_state->reference_objects[0];
+ }
+ /* reference 0 */
+ if (obj_surface && obj_surface->bo)
+ gen75_vme_source_surface_state(ctx, 1, obj_surface, encoder_context);
+ }
+ if (slice_type == SLICE_TYPE_B) {
+ /* reference 1 */
+ slice_obj_surface = NULL;
+ ref_surface_id = slice_param->RefPicList1[0].picture_id;
+ if (ref_surface_id != 0 && ref_surface_id != VA_INVALID_SURFACE) {
+ slice_obj_surface = SURFACE(ref_surface_id);
+ }
+ if (slice_obj_surface && slice_obj_surface->bo) {
+ obj_surface = slice_obj_surface;
+ } else {
+ obj_surface = encode_state->reference_objects[0];
+ }
- if (obj_surface && obj_surface->bo)
- gen75_vme_source_surface_state(ctx, 2, obj_surface, encoder_context);
+ obj_surface = encode_state->reference_objects[1];
+ if (obj_surface && obj_surface->bo)
+ gen75_vme_source_surface_state(ctx, 2, obj_surface, encoder_context);
+ }
}
/* VME output */
diff --git a/src/gen7_vme.c b/src/gen7_vme.c
index 24a22c5..88eb484 100644
--- a/src/gen7_vme.c
+++ b/src/gen7_vme.c
@@ -250,6 +250,7 @@ gen7_vme_surface_setup(VADriverContextP ctx,
struct intel_encoder_context *encoder_context)
{
struct object_surface *obj_surface;
+ struct i965_driver_data *i965 = i965_driver_data(ctx);
/*Setup surfaces state*/
/* current picture for encoding */
@@ -258,17 +259,45 @@ gen7_vme_surface_setup(VADriverContextP ctx,
gen7_vme_media_source_surface_state(ctx, 4, obj_surface, encoder_context);
if (!is_intra) {
- /* reference 0 */
- obj_surface = encode_state->reference_objects[0];
-
- if (obj_surface && obj_surface->bo)
- gen7_vme_source_surface_state(ctx, 1, obj_surface, encoder_context);
-
- /* reference 1 */
- obj_surface = encode_state->reference_objects[1];
-
- if (obj_surface && obj_surface->bo)
- gen7_vme_source_surface_state(ctx, 2, obj_surface, encoder_context);
+ VAEncSliceParameterBufferH264 *slice_param = (VAEncSliceParameterBufferH264 *)encode_state->slice_params_ext[0]->buffer;
+ int slice_type;
+ struct object_surface *slice_obj_surface;
+ int ref_surface_id;
+
+ slice_type = intel_avc_enc_slice_type_fixup(slice_param->slice_type);
+
+ if (slice_type == SLICE_TYPE_P || slice_type == SLICE_TYPE_B) {
+ slice_obj_surface = NULL;
+ ref_surface_id = slice_param->RefPicList0[0].picture_id;
+ if (ref_surface_id != 0 && ref_surface_id != VA_INVALID_SURFACE) {
+ slice_obj_surface = SURFACE(ref_surface_id);
+ }
+ if (slice_obj_surface && slice_obj_surface->bo) {
+ obj_surface = slice_obj_surface;
+ } else {
+ obj_surface = encode_state->reference_objects[0];
+ }
+ /* reference 0 */
+ if (obj_surface && obj_surface->bo)
+ gen7_vme_source_surface_state(ctx, 1, obj_surface, encoder_context);
+ }
+ if (slice_type == SLICE_TYPE_B) {
+ /* reference 1 */
+ slice_obj_surface = NULL;
+ ref_surface_id = slice_param->RefPicList1[0].picture_id;
+ if (ref_surface_id != 0 && ref_surface_id != VA_INVALID_SURFACE) {
+ slice_obj_surface = SURFACE(ref_surface_id);
+ }
+ if (slice_obj_surface && slice_obj_surface->bo) {
+ obj_surface = slice_obj_surface;
+ } else {
+ obj_surface = encode_state->reference_objects[0];
+ }
+
+ obj_surface = encode_state->reference_objects[1];
+ if (obj_surface && obj_surface->bo)
+ gen7_vme_source_surface_state(ctx, 2, obj_surface, encoder_context);
+ }
}
/* VME output */