hardware/intel/libva
Revision | 69078e8190a9a202168a6e380e4405fd9a3afa46 (tree) |
---|---|
Time | 2012-08-01 17:31:02 |
Author | Gwenole Beauchesne <gwenole.beauchesne@inte...> |
Commiter | Gwenole Beauchesne |
tests: fix JPEG decoding test to match the latest API.
Fix bug in parsing Huffman DC table and also sync the code to match
the latest API change. In particular, pad the Huffman table with
zero to suit 4-byte boundaries.
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
(cherry picked from commit d4c88950dafefead1a775c0ae6636917e23339fd)
@@ -325,11 +325,9 @@ static int parse_DHT(struct jdec_private *priv, const unsigned char *stream) | ||
325 | 325 | Th = index & 0x0f; |
326 | 326 | if (Tc) { |
327 | 327 | memcpy(priv->HTAC[index & 0xf].bits, stream, 16); |
328 | - priv->HTAC_valid[index & 0xf] = 1; | |
329 | 328 | } |
330 | 329 | else { |
331 | - memcpy(priv->HTDC[index & 0xf].bits, stream, 12); | |
332 | - priv->HTDC_valid[index & 0xf] = 1; | |
330 | + memcpy(priv->HTDC[index & 0xf].bits, stream, 16); | |
333 | 331 | } |
334 | 332 | |
335 | 333 | count = 0; |
@@ -347,9 +345,11 @@ static int parse_DHT(struct jdec_private *priv, const unsigned char *stream) | ||
347 | 345 | |
348 | 346 | if (Tc) { |
349 | 347 | memcpy(priv->HTAC[index & 0xf].values, stream, count); |
348 | + priv->HTAC_valid[index & 0xf] = 1; | |
350 | 349 | } |
351 | 350 | else { |
352 | 351 | memcpy(priv->HTDC[index & 0xf].values, stream, count); |
352 | + priv->HTDC_valid[index & 0xf] = 1; | |
353 | 353 | } |
354 | 354 | |
355 | 355 | length -= 1; |
@@ -663,6 +663,8 @@ int tinyjpeg_decode(struct jdec_private *priv) | ||
663 | 663 | sizeof(huffman_table.huffman_table[i].num_ac_codes)); |
664 | 664 | memcpy(huffman_table.huffman_table[i].ac_values, priv->HTAC[i].values, |
665 | 665 | sizeof(huffman_table.huffman_table[i].ac_values)); |
666 | + memset(huffman_table.huffman_table[i].pad, 0, | |
667 | + sizeof(huffman_table.huffman_table[i].pad)); | |
666 | 668 | } |
667 | 669 | |
668 | 670 | va_status = vaCreateBuffer(va_dpy, context_id, |