jpeg: mark default Huffman table as valid.
authorGwenole Beauchesne <gwenole.beauchesne@intel.com>
Mon, 18 Jun 2012 11:54:06 +0000 (13:54 +0200)
committerGwenole Beauchesne <gwenole.beauchesne@intel.com>
Mon, 18 Jun 2012 14:25:16 +0000 (16:25 +0200)
When no Huffman table is defined in the JPEG segments, then the default
Huffman tables are used, but values were not marked as valid. Fixed this
to notify HW decoder that it needs to load the default tables.

Note: this is not specifically needed to be handled at the application
level. The driver also ought to generate default tables, should the HW
decoder require so and no table was provided from the application.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
test/decode/tinyjpeg.c

index fe9435b..1d3205f 100644 (file)
@@ -158,8 +158,10 @@ static int build_default_huffman_tables(struct jdec_private *priv)
                return 0;
 
     for (i = 0; i < 4; i++) {
+        priv->HTDC_valid[i] = 1;
         memcpy(priv->HTDC[i].bits, default_huffman_table_param.huffman_table[i].num_dc_codes, 16);
         memcpy(priv->HTDC[i].values, default_huffman_table_param.huffman_table[i].dc_values, 16);
+        priv->HTAC_valid[i] = 1;
         memcpy(priv->HTAC[i].bits, default_huffman_table_param.huffman_table[i].num_ac_codes, 16);
         memcpy(priv->HTAC[i].values, default_huffman_table_param.huffman_table[i].ac_values, 256);
     }