st/va: add picture parameter handling for MJPEG
authorLeo Liu <leo.liu@amd.com>
Tue, 15 Aug 2017 14:53:22 +0000 (10:53 -0400)
committerLeo Liu <leo.liu@amd.com>
Mon, 21 Aug 2017 14:09:09 +0000 (10:09 -0400)
Signed-off-by: Leo Liu <leo.liu@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
src/gallium/state_trackers/va/picture_mjpeg.c

index b0276e80dc53d17481e2cd77699fa2fc564d290b..50f339eebfbd5bda626bd95141214ce19688bf26 100644 (file)
 
 void vlVaHandlePictureParameterBufferMJPEG(vlVaDriver *drv, vlVaContext *context, vlVaBuffer *buf)
 {
-   /* TODO */
+   VAPictureParameterBufferJPEGBaseline *mjpeg = buf->data;
+   int i;
+
+   assert(buf->size >= sizeof(VAPictureParameterBufferJPEGBaseline) && buf->num_elements == 1);
+
+   context->desc.mjpeg.picture_parameter.picture_width = mjpeg->picture_width;
+   context->desc.mjpeg.picture_parameter.picture_height = mjpeg->picture_height;
+
+   for (i = 0; i < mjpeg->num_components; ++i) {
+      context->desc.mjpeg.picture_parameter.components[i].component_id =
+         mjpeg->components[i].component_id;
+      context->desc.mjpeg.picture_parameter.components[i].h_sampling_factor =
+         mjpeg->components[i].h_sampling_factor;
+      context->desc.mjpeg.picture_parameter.components[i].v_sampling_factor =
+         mjpeg->components[i].v_sampling_factor;
+      context->desc.mjpeg.picture_parameter.components[i].quantiser_table_selector =
+         mjpeg->components[i].quantiser_table_selector;
+   }
+
+   context->desc.mjpeg.picture_parameter.num_components = mjpeg->num_components;
 }
 
 void vlVaHandleIQMatrixBufferMJPEG(vlVaContext *context, vlVaBuffer *buf)