2008-07-24 Bean <bean123ch@gmail.com>
* video/reader/png.c (DELFATE_HLIT_MAX): Change value. (grub_png_init_fixed_block): New function. (grub_png_decode_image_data): Handle fixed huffman code compression.
This commit is contained in:
parent
2a8a80e4f4
commit
42290e17c5
2 changed files with 45 additions and 3 deletions
|
@ -1,3 +1,9 @@
|
|||
2008-07-24 Bean <bean123ch@gmail.com>
|
||||
|
||||
* video/reader/png.c (DELFATE_HLIT_MAX): Change value.
|
||||
(grub_png_init_fixed_block): New function.
|
||||
(grub_png_decode_image_data): Handle fixed huffman code compression.
|
||||
|
||||
2008-07-24 Bean <bean123ch@gmail.com>
|
||||
|
||||
* common.rmk (bin_UTILITIES): Add grub-pe2elf.
|
||||
|
|
|
@ -68,7 +68,7 @@
|
|||
#define DEFLATE_HCLEN_BASE 4
|
||||
#define DEFLATE_HCLEN_MAX 19
|
||||
#define DEFLATE_HLIT_BASE 257
|
||||
#define DEFLATE_HLIT_MAX 286
|
||||
#define DEFLATE_HLIT_MAX 288
|
||||
#define DEFLATE_HDIST_BASE 1
|
||||
#define DEFLATE_HDIST_MAX 30
|
||||
|
||||
|
@ -390,6 +390,41 @@ grub_png_get_huff_code (struct grub_png_data *data, struct huff_table *ht)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static grub_err_t
|
||||
grub_png_init_fixed_block (struct grub_png_data *data)
|
||||
{
|
||||
int i;
|
||||
|
||||
grub_png_init_huff_table (&data->code_table, DEFLATE_HUFF_LEN,
|
||||
data->code_values, data->code_maxval,
|
||||
data->code_offset);
|
||||
|
||||
for (i = 0; i < 144; i++)
|
||||
grub_png_insert_huff_item (&data->code_table, i, 8);
|
||||
|
||||
for (; i < 256; i++)
|
||||
grub_png_insert_huff_item (&data->code_table, i, 9);
|
||||
|
||||
for (; i < 280; i++)
|
||||
grub_png_insert_huff_item (&data->code_table, i, 7);
|
||||
|
||||
for (; i < DEFLATE_HLIT_MAX; i++)
|
||||
grub_png_insert_huff_item (&data->code_table, i, 8);
|
||||
|
||||
grub_png_build_huff_table (&data->code_table);
|
||||
|
||||
grub_png_init_huff_table (&data->dist_table, DEFLATE_HUFF_LEN,
|
||||
data->dist_values, data->dist_maxval,
|
||||
data->dist_offset);
|
||||
|
||||
for (i = 0; i < DEFLATE_HDIST_MAX; i++)
|
||||
grub_png_insert_huff_item (&data->dist_table, i, 5);
|
||||
|
||||
grub_png_build_huff_table (&data->dist_table);
|
||||
|
||||
return grub_errno;
|
||||
}
|
||||
|
||||
static grub_err_t
|
||||
grub_png_init_dynamic_block (struct grub_png_data *data)
|
||||
{
|
||||
|
@ -699,8 +734,9 @@ grub_png_decode_image_data (struct grub_png_data *data)
|
|||
}
|
||||
|
||||
case INFLATE_FIXED:
|
||||
return grub_error (GRUB_ERR_BAD_FILE_TYPE,
|
||||
"png: block type fixed not supported");
|
||||
grub_png_init_fixed_block (data);
|
||||
grub_png_read_dynamic_block (data);
|
||||
break;
|
||||
|
||||
case INFLATE_DYNAMIC:
|
||||
grub_png_init_dynamic_block (data);
|
||||
|
|
Loading…
Reference in a new issue