summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLeo Liu <[email protected]>2017-08-15 11:52:26 -0400
committerLeo Liu <[email protected]>2017-08-21 10:09:09 -0400
commit8e9175744e9c5528f9c44836b43381181976ce13 (patch)
tree379ebf2084c79b73825425930ac1e654dce2b1e6
parent93577e608150b016c794dcc0db5aebc29cb9a89c (diff)
st/va: add huffman table handling for MJPEG
Signed-off-by: Leo Liu <[email protected]> Reviewed-by: Christian König <[email protected]>
-rw-r--r--src/gallium/state_trackers/va/picture_mjpeg.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/src/gallium/state_trackers/va/picture_mjpeg.c b/src/gallium/state_trackers/va/picture_mjpeg.c
index 09b2efc21b4..17f077962e6 100644
--- a/src/gallium/state_trackers/va/picture_mjpeg.c
+++ b/src/gallium/state_trackers/va/picture_mjpeg.c
@@ -63,7 +63,24 @@ void vlVaHandleIQMatrixBufferMJPEG(vlVaContext *context, vlVaBuffer *buf)
void vlVaHandleHuffmanTableBufferType(vlVaContext *context, vlVaBuffer *buf)
{
- /* TODO */
+ VAHuffmanTableBufferJPEGBaseline *mjpeg = buf->data;
+ int i;
+
+ assert(buf->size >= sizeof(VASliceParameterBufferJPEGBaseline) && buf->num_elements == 1);
+
+ for (i = 0; i < 2; ++i) {
+ context->desc.mjpeg.huffman_table.load_huffman_table[i] = mjpeg->load_huffman_table[i];
+
+ memcpy(&context->desc.mjpeg.huffman_table.table[i].num_dc_codes,
+ mjpeg->huffman_table[i].num_dc_codes, 16);
+ memcpy(&context->desc.mjpeg.huffman_table.table[i].dc_values,
+ mjpeg->huffman_table[i].dc_values, 12);
+ memcpy(&context->desc.mjpeg.huffman_table.table[i].num_ac_codes,
+ mjpeg->huffman_table[i].num_ac_codes, 16);
+ memcpy(&context->desc.mjpeg.huffman_table.table[i].ac_values,
+ mjpeg->huffman_table[i].ac_values, 162);
+ memcpy(&context->desc.mjpeg.huffman_table.table[i].pad, mjpeg->huffman_table[i].pad, 2);
+ }
}
void vlVaHandleSliceParameterBufferMJPEG(vlVaContext *context, vlVaBuffer *buf)