[Libva] [HEVC10bit ENC V2 1/5] HEVC10bit ENC: add driver context member and internal NV12 surface in VME
Pengfei Qu
Pengfei.Qu at intel.com
Fri Sep 2 07:01:38 UTC 2016
Signed-off-by: Pengfei Qu <Pengfei.Qu at intel.com>
---
src/gen6_vme.c | 17 +++++++++++++++++
src/gen6_vme.h | 8 ++++++++
src/gen7_vme.c | 2 ++
src/gen8_vme.c | 12 +++++++++++-
4 files changed, 38 insertions(+), 1 deletion(-)
diff --git a/src/gen6_vme.c b/src/gen6_vme.c
index 45cc30e..1f4f001 100644
--- a/src/gen6_vme.c
+++ b/src/gen6_vme.c
@@ -611,6 +611,7 @@ static void
gen6_vme_context_destroy(void *context)
{
struct gen6_vme_context *vme_context = context;
+ int i = 0;
i965_gpe_context_destroy(&vme_context->gpe_context);
@@ -626,6 +627,20 @@ gen6_vme_context_destroy(void *context)
free(vme_context->qp_per_mb);
vme_context->qp_per_mb = NULL;
+ if (vme_context->input_yuv_object_internal) {
+ i965_DestroySurfaces(vme_context->driver_context, &vme_context->input_yuv_surface_internal, 1);
+ vme_context->input_yuv_surface_internal = VA_INVALID_SURFACE;
+ vme_context->input_yuv_object_internal = NULL;
+ }
+
+ for(i = 0 ; i < 16 ; i++) {
+ if (vme_context->reference_objects_internal[i]) {
+ i965_DestroySurfaces(vme_context->driver_context, &vme_context->reference_surface_internal[i], 1);
+ vme_context->reference_surface_internal[i] = VA_INVALID_SURFACE;
+ vme_context->reference_objects_internal[i] = NULL;
+ }
+ }
+
free(vme_context);
}
@@ -672,5 +687,7 @@ Bool gen6_vme_context_init(VADriverContextP ctx, struct intel_encoder_context *e
encoder_context->vme_context = vme_context;
encoder_context->vme_context_destroy = gen6_vme_context_destroy;
+ vme_context->driver_context = ctx;
+
return True;
}
diff --git a/src/gen6_vme.h b/src/gen6_vme.h
index e8f4742..8aeced0 100644
--- a/src/gen6_vme.h
+++ b/src/gen6_vme.h
@@ -107,6 +107,14 @@ struct gen6_vme_context
bool roi_enabled;
char *qp_per_mb;
int saved_width_mbs, saved_height_mbs;
+
+ //Encoding HEVC10:internal surface keep for P010->NV12 , this is only for hevc10 to save the P010->NV12
+ struct object_surface *input_yuv_object_internal;
+ struct object_surface *reference_objects_internal[16];
+ VASurfaceID input_yuv_surface_internal;
+ VASurfaceID reference_surface_internal[16];
+ VADriverContextP driver_context;
+
};
#define MPEG2_PIC_WIDTH_HEIGHT 30
diff --git a/src/gen7_vme.c b/src/gen7_vme.c
index 897d169..7f8dc5e 100644
--- a/src/gen7_vme.c
+++ b/src/gen7_vme.c
@@ -1167,5 +1167,7 @@ Bool gen7_vme_context_init(VADriverContextP ctx, struct intel_encoder_context *e
encoder_context->vme_context_destroy = gen7_vme_context_destroy;
vme_context->vme_state_message = malloc(VME_MSG_LENGTH * sizeof(int));
+ vme_context->driver_context = ctx;
+
return True;
}
diff --git a/src/gen8_vme.c b/src/gen8_vme.c
index 2a93d1e..f6b3318 100644
--- a/src/gen8_vme.c
+++ b/src/gen8_vme.c
@@ -1335,7 +1335,7 @@ Bool gen8_vme_context_init(VADriverContextP ctx, struct intel_encoder_context *e
{
struct gen6_vme_context *vme_context = NULL;
struct i965_kernel *vme_kernel_list = NULL;
- int i965_kernel_num;
+ int i965_kernel_num,i;
switch (encoder_context->codec) {
case CODEC_H264:
@@ -1404,6 +1404,16 @@ Bool gen8_vme_context_init(VADriverContextP ctx, struct intel_encoder_context *e
encoder_context->vme_context_destroy = gen8_vme_context_destroy;
vme_context->vme_state_message = malloc(VME_MSG_LENGTH * sizeof(int));
+
+ vme_context->driver_context = ctx;
+
+ // HEVC 10bit
+ vme_context->input_yuv_surface_internal = VA_INVALID_SURFACE;
+ vme_context->input_yuv_object_internal = NULL;
+ for(i = 0 ; i < 16 ; i++) {
+ vme_context->reference_surface_internal[i] = VA_INVALID_SURFACE;
+ vme_context->reference_objects_internal[i] = NULL;
+ }
}
return True;
--
2.7.4
More information about the Libva
mailing list