* video/readers/jpeg.c: Indented.

This commit is contained in:
Vladimir 'phcoder' Serbinenko 2010-05-05 21:19:55 +02:00
parent 09ddcd11fb
commit 2bf61a980b
2 changed files with 46 additions and 42 deletions

View file

@ -1,3 +1,7 @@
2010-05-05 Vladimir Serbinenko <phcoder@gmail.com>
* video/readers/jpeg.c: Indented.
2010-05-05 Vladimir Serbinenko <phcoder@gmail.com> 2010-05-05 Vladimir Serbinenko <phcoder@gmail.com>
Various jpeg cleanups. Various jpeg cleanups.

View file

@ -182,41 +182,41 @@ grub_jpeg_decode_huff_table (struct grub_jpeg_data *data)
while (data->file->offset + sizeof (count) + 1 <= next_marker) while (data->file->offset + sizeof (count) + 1 <= next_marker)
{ {
id = grub_jpeg_get_byte (data); id = grub_jpeg_get_byte (data);
ac = (id >> 4) & 1; ac = (id >> 4) & 1;
id &= 0xF; id &= 0xF;
if (id > 1) if (id > 1)
return grub_error (GRUB_ERR_BAD_FILE_TYPE, return grub_error (GRUB_ERR_BAD_FILE_TYPE,
"jpeg: too many huffman tables"); "jpeg: too many huffman tables");
if (grub_file_read (data->file, &count, sizeof (count)) != if (grub_file_read (data->file, &count, sizeof (count)) !=
sizeof (count)) sizeof (count))
return grub_errno; return grub_errno;
n = 0; n = 0;
for (i = 0; i < ARRAY_SIZE (count); i++) for (i = 0; i < ARRAY_SIZE (count); i++)
n += count[i]; n += count[i];
id += ac * 2; id += ac * 2;
data->huff_value[id] = grub_malloc (n); data->huff_value[id] = grub_malloc (n);
if (grub_errno) if (grub_errno)
return grub_errno; return grub_errno;
if (grub_file_read (data->file, data->huff_value[id], n) != n) if (grub_file_read (data->file, data->huff_value[id], n) != n)
return grub_errno; return grub_errno;
base = 0; base = 0;
ofs = 0; ofs = 0;
for (i = 0; i < ARRAY_SIZE (count); i++) for (i = 0; i < ARRAY_SIZE (count); i++)
{ {
base += count[i]; base += count[i];
ofs += count[i]; ofs += count[i];
data->huff_maxval[id][i] = base; data->huff_maxval[id][i] = base;
data->huff_offset[id][i] = ofs - base; data->huff_offset[id][i] = ofs - base;
base <<= 1; base <<= 1;
} }
} }
if (data->file->offset != next_marker) if (data->file->offset != next_marker)
@ -234,21 +234,22 @@ grub_jpeg_decode_quan_table (struct grub_jpeg_data *data)
next_marker = data->file->offset; next_marker = data->file->offset;
next_marker += grub_jpeg_get_word (data); next_marker += grub_jpeg_get_word (data);
while (data->file->offset + sizeof (data->quan_table[id]) + 1 <= next_marker) while (data->file->offset + sizeof (data->quan_table[id]) + 1
<= next_marker)
{ {
id = grub_jpeg_get_byte (data); id = grub_jpeg_get_byte (data);
if (id >= 0x10) /* Upper 4-bit is precision. */ if (id >= 0x10) /* Upper 4-bit is precision. */
return grub_error (GRUB_ERR_BAD_FILE_TYPE, return grub_error (GRUB_ERR_BAD_FILE_TYPE,
"jpeg: only 8-bit precision is supported"); "jpeg: only 8-bit precision is supported");
if (id > 1) if (id > 1)
return grub_error (GRUB_ERR_BAD_FILE_TYPE, return grub_error (GRUB_ERR_BAD_FILE_TYPE,
"jpeg: too many quantization tables"); "jpeg: too many quantization tables");
if (grub_file_read (data->file, &data->quan_table[id], if (grub_file_read (data->file, &data->quan_table[id],
sizeof (data->quan_table[id])) sizeof (data->quan_table[id]))
!= sizeof (data->quan_table[id])) != sizeof (data->quan_table[id]))
return grub_errno; return grub_errno;
} }
@ -712,7 +713,7 @@ grub_video_reader_jpeg (struct grub_video_bitmap **bitmap,
#if defined(JPEG_DEBUG) #if defined(JPEG_DEBUG)
static grub_err_t static grub_err_t
grub_cmd_jpegtest (grub_command_t cmd __attribute__ ((unused)), grub_cmd_jpegtest (grub_command_t cmd __attribute__ ((unused)),
int argc, char **args) int argc, char **args)
{ {
struct grub_video_bitmap *bitmap = 0; struct grub_video_bitmap *bitmap = 0;
@ -747,8 +748,7 @@ GRUB_MOD_INIT (jpeg)
grub_video_bitmap_reader_register (&jpeg_reader); grub_video_bitmap_reader_register (&jpeg_reader);
#if defined(JPEG_DEBUG) #if defined(JPEG_DEBUG)
cmd = grub_register_command ("jpegtest", grub_cmd_jpegtest, cmd = grub_register_command ("jpegtest", grub_cmd_jpegtest,
"FILE", "FILE", "Tests loading of JPEG bitmap.");
"Tests loading of JPEG bitmap.");
#endif #endif
} }