summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGwenole Beauchesne <gwenole.beauchesne@intel.com>2012-07-31 11:04:24 +0200
committerGwenole Beauchesne <gwenole.beauchesne@intel.com>2012-08-01 10:31:30 +0200
commit656ffb504de10f2e95fc0d4cf4ea83cc8a11c225 (patch)
tree83a2bb6bb75e24317a905e01175db7b6e93a7bef
parentcc2863e834cf135fa88c459aa081c478852134e8 (diff)
downloadlibva-656ffb504de10f2e95fc0d4cf4ea83cc8a11c225.tar.gz
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)
-rw-r--r--test/decode/tinyjpeg.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/test/decode/tinyjpeg.c b/test/decode/tinyjpeg.c
index e9bcc1b..420fc52 100644
--- a/test/decode/tinyjpeg.c
+++ b/test/decode/tinyjpeg.c
@@ -325,11 +325,9 @@ static int parse_DHT(struct jdec_private *priv, const unsigned char *stream)
Th = index & 0x0f;
if (Tc) {
memcpy(priv->HTAC[index & 0xf].bits, stream, 16);
- priv->HTAC_valid[index & 0xf] = 1;
}
else {
- memcpy(priv->HTDC[index & 0xf].bits, stream, 12);
- priv->HTDC_valid[index & 0xf] = 1;
+ memcpy(priv->HTDC[index & 0xf].bits, stream, 16);
}
count = 0;
@@ -347,9 +345,11 @@ static int parse_DHT(struct jdec_private *priv, const unsigned char *stream)
if (Tc) {
memcpy(priv->HTAC[index & 0xf].values, stream, count);
+ priv->HTAC_valid[index & 0xf] = 1;
}
else {
memcpy(priv->HTDC[index & 0xf].values, stream, count);
+ priv->HTDC_valid[index & 0xf] = 1;
}
length -= 1;
@@ -663,6 +663,8 @@ int tinyjpeg_decode(struct jdec_private *priv)
sizeof(huffman_table.huffman_table[i].num_ac_codes));
memcpy(huffman_table.huffman_table[i].ac_values, priv->HTAC[i].values,
sizeof(huffman_table.huffman_table[i].ac_values));
+ memset(huffman_table.huffman_table[i].pad, 0,
+ sizeof(huffman_table.huffman_table[i].pad));
}
va_status = vaCreateBuffer(va_dpy, context_id,