1. 22 Dec, 2010 1 commit
    • Robert Sprowson's avatar
      Reorganise rojpeg. · e5be19dd
      Robert Sprowson authored
      Aside from moving blocks around and adding comments, decisions about numcomponents use switch/case statements to allow CMYK support in the future.
      Split out (some of the) Huffman decoding to allow arithmetic support in the future.
      Moved memcpy() and memset() into CSupport.
      Tested in all colour depths with 1x1; 1x2; 2x1; 2x2 sampling & ChangeFSI.
      Tighten up check on cinfo being NULL (was previously only checked in the colour decoder, not the monochrome).
      
      Version 1.37. Tagged as 'SprExtend-1_37'
      e5be19dd
  2. 17 Oct, 2010 1 commit
    • Robert Sprowson's avatar
      Change memory management strategy. · a4a91aff
      Robert Sprowson authored
      There's no need for the C code to know which pool of memory it's using, so simplify it to just use malloc() and realloc(), the assembler implementation can then select whether the RMA or a dynamic area is in use based on the 'dynamicarea' switch.
      Be more careful about area_number when it is zero, since we use that to denote the area is not yet set up but area zero is a valid dynamic area number!
      Trim out some unused workspace.
      Variable ccompiler_errptr had '# 0' bytes assigned, resulting in writes off the end of the workspace.
      Retire DUMPVAL[N]() macro.
      Remove M_SOF9 as one of the SOF markers accepted - this is allocated to arithmetic JPEGs which aren't currently supported.
      Save a few words by: changing arbitrary constants (eg. safety margins) to be a power of two so they can be register immediates; numerous loads and stores of R12 relative variables changed to not use ADRL; jpeg_fetchroutine similarly simplified.
      
      Version 1.33. Tagged as 'SprExtend-1_33'
      a4a91aff
  3. 13 Oct, 2010 1 commit
    • Robert Sprowson's avatar
      Paper and fill some JPEG cracks. · 06d6b99e
      Robert Sprowson authored
      The exit_c function was repeatedly being called with the line number argument and error code the wrong way round and since only bits 0-2 of the error code are inspected on exit any fatal exits from the ported JPEG library code would either report the wrong error or fail silently (depending on the line number) - example a 12 bits per sample JPEG would be rendered without fault into a screen full of random memory garbage.
      Assembling/compiling with the 'jpeg' switch off didn't work, fixed, and also now zeros out the SWI decode values in the module header.
      Moved include of 'yuvtabs.s' into the colour conversion code.
      Deleted panic_exit, it did nothing useful but trace a value then exit, so it now just calls exit() like everyone else.
      Removed excess call to find_image_dims(), this was needed just to get the workspace requirements when the JPEG had already been sized up by asm_find_image_dims() earlier. Side effect of removing the pilot JPEG code earlier is that this call can now only get to the JPEG code from a JPEG_ SWI. Changed to just pass the workspace requirements into 'c.PutScaled' and save a duplicate scan.
      Fatal exits from the assembler huffman decoder now report a sensible error.
      Trimmed out all the JPEG assessment code from 'c.PutScaled' and moved it into 'c.rojpeg' so the put scaled is only concerned with putting things scaled.
      Sanitised the #includes a bit.
      Fixed on last check of wp->save_mode looking at the wrong bits for the mode number.
      Resolved all the warning in the genhdr/genyuvtabs/genpalette utilities by casting a bit harder.[A[B
      Added new more descriptive error messages to the messages file (not currently used), and made the 'not supported by' ones consistent so the tokeniser might crunch the file a bit more.
      In looks_like_jpeg() changed a bitwise to logical or.
      Fixed longstanding problem of not being able to render JPEGs at a scale of less than 1/6 in any greyscale mode, because, err, there was no code to do it - only the colour case was checked for. Implemented for 8bpp grey and 32bpp grey (which gets dithered for other lower modes) by just converting the luma channel into an equally weighted RGB value or replicating it for 256 greys.
      Tested in all 8 colour depths on a Risc PC using sampling ratios of 1x1; 2x1; 1x2; 2x2 of the IJG test image scaled in !Draw by 0.16.
      
      Version 1.32. Tagged as 'SprExtend-1_32'
      06d6b99e
  4. 29 Sep, 2010 1 commit
    • Robert Sprowson's avatar
      Remove pilot JPEG code. · 1a4e51bd
      Robert Sprowson authored
      During the original development (referred to in the docs as Sprite Extend 2) JPEG data was briefly wrapped inside a sprite file before the JPEG_ swis were introduced. Within SpriteExtend some code still remained to fake a mode 20 sprite header with the JPEG output sized adjusted as though it was 4bpp, then later undo the faking by checking for a mode 20 sprite with is_it_jpeg set.
      This version removes all of the code looking out for pilot JPEGs, and rationalises the fake sprite header to just report the true X/Y size.
      Fix bug where r4 would be corrupted on exit from JPEG_PlotScaled if an error occurred, and generally rationalised the exit cases a bit more sensibly.
      Made the JPEG_ swi despatch a bit more simple to follow.
      Corrected a comment in the NSM_bpptable.
      Deleted unused 'ecfspace' from the workspace.
      Hid the 'macroword' from the C code as it's now an assembler only value.
      Cut the initial comments from c/putscaled and placed in Docs.
      Cut the debug tracing code (a notable %age) from c/putscaled and placed in tracing support file.
      Simplified the entry to putscaled_compiler() now we don't have to look out for pilot format JPEGs within sprites any more.
      Sprinkled in some block comments to make navigating the c/putscaled file a bit easier.
      
      Version 1.30. Tagged as 'SprExtend-1_30'
      1a4e51bd
  5. 05 Nov, 1996 1 commit