st/va: add slice parameter handling for MJPEG
authorLeo Liu <leo.liu@amd.com>
Tue, 15 Aug 2017 15:54:22 +0000 (11:54 -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 17f077962e6357d76c9b9682f3667213ff5e8dc1..326c890c8809c5a4fcc8b78e60f7a4340e937cc1 100644 (file)
@@ -85,5 +85,27 @@ void vlVaHandleHuffmanTableBufferType(vlVaContext *context, vlVaBuffer *buf)
 
 void vlVaHandleSliceParameterBufferMJPEG(vlVaContext *context, vlVaBuffer *buf)
 {
-   /* TODO */
+   VASliceParameterBufferJPEGBaseline *mjpeg = buf->data;
+   int i;
+
+   assert(buf->size >= sizeof(VASliceParameterBufferJPEGBaseline) && buf->num_elements == 1);
+
+   context->desc.mjpeg.slice_parameter.slice_data_size = mjpeg->slice_data_size;
+   context->desc.mjpeg.slice_parameter.slice_data_offset = mjpeg->slice_data_offset;
+   context->desc.mjpeg.slice_parameter.slice_data_flag = mjpeg->slice_data_flag;
+   context->desc.mjpeg.slice_parameter.slice_horizontal_position = mjpeg->slice_horizontal_position;
+   context->desc.mjpeg.slice_parameter.slice_vertical_position = mjpeg->slice_vertical_position;
+
+   for (i = 0; i < mjpeg->num_components; ++i) {
+      context->desc.mjpeg.slice_parameter.components[i].component_selector =
+         mjpeg->components[i].component_selector;
+      context->desc.mjpeg.slice_parameter.components[i].dc_table_selector =
+         mjpeg->components[i].dc_table_selector;
+      context->desc.mjpeg.slice_parameter.components[i].ac_table_selector =
+         mjpeg->components[i].ac_table_selector;
+   }
+
+   context->desc.mjpeg.slice_parameter.num_components = mjpeg->num_components;
+   context->desc.mjpeg.slice_parameter.restart_interval = mjpeg->restart_interval;
+   context->desc.mjpeg.slice_parameter.num_mcus = mjpeg->num_mcus;
 }