Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix: macroblock memory allocation was bigger than needed.
  • Loading branch information
bsmiles32 committed Dec 1, 2013
1 parent ff2ab7f commit 60ecc0d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/jpeg.c
Expand Up @@ -250,7 +250,7 @@ static void jpeg_decode_std(const char * const version, const std_macroblock_dec
}

subblock_count = mode + 4;
macroblock_size = 2*subblock_count*SUBBLOCK_SIZE;
macroblock_size = subblock_count*SUBBLOCK_SIZE;

rdram_read_many_u16((uint16_t*)qtables[0], qtableY_ptr, SUBBLOCK_SIZE);
rdram_read_many_u16((uint16_t*)qtables[1], qtableU_ptr, SUBBLOCK_SIZE);
Expand All @@ -265,7 +265,7 @@ static void jpeg_decode_std(const char * const version, const std_macroblock_dec

for (mb = 0; mb < macroblock_count; ++mb)
{
rdram_read_many_u16((uint16_t*)macroblock, address, macroblock_size >> 1);
rdram_read_many_u16((uint16_t*)macroblock, address, macroblock_size);
decode_mb(macroblock, subblock_count, (const int16_t (*)[SUBBLOCK_SIZE])qtables);

if (mode == 0)
Expand All @@ -277,7 +277,7 @@ static void jpeg_decode_std(const char * const version, const std_macroblock_dec
EmitTilesMode2(emit_line, macroblock, address);
}

address += macroblock_size;
address += 2*macroblock_size;
}
free(macroblock);
}
Expand Down

0 comments on commit 60ecc0d

Please sign in to comment.