[Libva] [Libva-intel-driver PATCH 11/27] HEVC: Set the default flat IQ matrix

Xiang, Haihao haihao.xiang at intel.com
Wed Nov 19 07:05:26 PST 2014


Signed-off-by: Xiang, Haihao <haihao.xiang at intel.com>
---
 src/gen9_mfd.c           | 17 +++++++++++++++++
 src/gen9_mfd.h           |  2 ++
 src/i965_decoder.h       |  1 +
 src/i965_decoder_utils.c | 22 ++++++++++++++++++++++
 src/i965_decoder_utils.h |  3 +++
 5 files changed, 45 insertions(+)

diff --git a/src/gen9_mfd.c b/src/gen9_mfd.c
index 43a38a2..c025a96 100644
--- a/src/gen9_mfd.c
+++ b/src/gen9_mfd.c
@@ -418,6 +418,13 @@ gen9_hcpd_context_destroy(void *hw_context)
     free(gen9_hcpd_context);
 }
 
+static void
+gen9_hcpd_hevc_context_init(VADriverContextP ctx,
+                            struct gen9_hcpd_context *gen9_hcpd_context)
+{
+    hevc_gen_default_iq_matrix(&gen9_hcpd_context->iq_matrix_hevc);
+}
+
 static struct hw_context *
 gen9_hcpd_context_init(VADriverContextP ctx, struct object_config *object_config)
 {
@@ -438,6 +445,16 @@ gen9_hcpd_context_init(VADriverContextP ctx, struct object_config *object_config
         gen9_hcpd_context->reference_surfaces[i].obj_surface = NULL;
     }
 
+    switch (object_config->profile) {
+    case VAProfileHEVCMain:
+    case VAProfileHEVCMain10:
+        gen9_hcpd_hevc_context_init(ctx, gen9_hcpd_context);
+        break;
+
+    default:
+        break;
+    }
+
     return (struct hw_context *)gen9_hcpd_context;
 }
 
diff --git a/src/gen9_mfd.h b/src/gen9_mfd.h
index bcf7cf7..6cf6db3 100644
--- a/src/gen9_mfd.h
+++ b/src/gen9_mfd.h
@@ -43,6 +43,8 @@ struct gen9_hcpd_context
 
     GenFrameStore reference_surfaces[MAX_GEN_HCP_REFERENCE_FRAMES];
 
+    VAIQMatrixBufferHEVC  iq_matrix_hevc;
+
     uint16_t picture_width_in_pixels;
     uint16_t picture_height_in_pixels;
     uint16_t picture_width_in_ctbs;
diff --git a/src/i965_decoder.h b/src/i965_decoder.h
index 843d2e4..9ef0349 100644
--- a/src/i965_decoder.h
+++ b/src/i965_decoder.h
@@ -30,6 +30,7 @@
 
 #include <va/va.h>
 #include <va/va_dec_vp8.h>
+#include <va/va_dec_hevc.h>
 #include <intel_bufmgr.h>
 
 #define MAX_GEN_REFERENCE_FRAMES 16
diff --git a/src/i965_decoder_utils.c b/src/i965_decoder_utils.c
index e7a4322..6cf9604 100644
--- a/src/i965_decoder_utils.c
+++ b/src/i965_decoder_utils.c
@@ -1203,3 +1203,25 @@ intel_ensure_vp8_segmentation_buffer(VADriverContextP ctx, GenBuffer *buf,
     buf->valid = buf->bo != NULL;
     return buf->valid;
 }
+
+void
+hevc_gen_default_iq_matrix(VAIQMatrixBufferHEVC *iq_matrix)
+{
+    /* Flat_4x4_16 */
+    memset(&iq_matrix->ScalingList4x4, 16, sizeof(iq_matrix->ScalingList4x4));
+
+    /* Flat_8x8_16 */
+    memset(&iq_matrix->ScalingList8x8, 16, sizeof(iq_matrix->ScalingList8x8));
+
+    /* Flat_16x16_16 */
+    memset(&iq_matrix->ScalingList16x16, 16, sizeof(iq_matrix->ScalingList16x16));
+
+    /* Flat_32x32_16 */
+    memset(&iq_matrix->ScalingList32x32, 16, sizeof(iq_matrix->ScalingList32x32));
+
+    /* Flat_16x16_dc_16 */
+    memset(&iq_matrix->ScalingListDC16x16, 16, sizeof(iq_matrix->ScalingListDC16x16));
+
+    /* Flat_32x32_dc_16 */
+    memset(&iq_matrix->ScalingListDC32x32, 16, sizeof(iq_matrix->ScalingListDC32x32));
+}
diff --git a/src/i965_decoder_utils.h b/src/i965_decoder_utils.h
index 48ef814..856f4c4 100644
--- a/src/i965_decoder_utils.h
+++ b/src/i965_decoder_utils.h
@@ -153,4 +153,7 @@ bool
 intel_ensure_vp8_segmentation_buffer(VADriverContextP ctx, GenBuffer *buf,
     unsigned int mb_width, unsigned int mb_height);
 
+void
+hevc_gen_default_iq_matrix(VAIQMatrixBufferHEVC *iq_matrix);
+
 #endif /* I965_DECODER_UTILS_H */
-- 
1.9.1



More information about the Libva mailing list