1. 06 Dec, 2014 1 commit
    • Robert Sprowson's avatar
      Fix for stack imbalance · 1c02f88c
      Robert Sprowson authored
      In revision 4.17 the extra argument in R5 changed the stack frame, but the 'file not found' error exit was missed.
      Submission from Rick Murray. Fixes ticket #398.
      
      Version 1.64. Tagged as 'SprExtend-1_64'
      1c02f88c
  2. 28 Mar, 2014 1 commit
    • Jeffrey Lee's avatar
      Fix a few long-standing mask ECF rendering bugs · a87734ee
      Jeffrey Lee authored
      Detail:
        c/PutScaled - Fix the tail end of loop_y() to update the ECF pointer when simple_y_scale() is true. Without this, unscaled sprites (which didn't fall through to the kernel routine) would have repeated the same ECF row over the whole image instead of displaying the pattern correctly
        Sources/SprOp, c/PutScaled - Rewrite calculation of initial ECF pointer, both to simplify the code and to fix the calculation of the offset to work with ECF patterns that are 8 rows tall (was previously masking off the top bit of the row number, restricting the pattern to within the first 4 rows). Also the resulting address was off by one row, so even if you had a pattern 4 rows tall then it would still be misaligned when compared to the kernel's vector graphics.
      Admin:
        Tested on BB-xM
        OS_SpriteOp 49, 50, 55 and kernel vector graphics now all seem to be in agreement for how ECF patterns should be rendered, in a variety of modes
      
      
      Version 1.63. Tagged as 'SprExtend-1_63'
      a87734ee
  3. 09 Mar, 2014 1 commit
    • Jeffrey Lee's avatar
      Add OS_SpriteOp 65 implementation. Tweak OS_SpriteOp 52 logic for passing the... · 25c47d65
      Jeffrey Lee authored
      Add OS_SpriteOp 65 implementation. Tweak OS_SpriteOp 52 logic for passing the request on to the kernel.
      
      Detail:
        Sources/SprExtend - GET Hdr:GraphicsV, add debug switch for sprite tiling
        Sources/SprOp - Add OS_SpriteOp 65 (TileSpriteScaled) implementation. Will use OS_Plot to perform hardware-accelerated copies of tiles if no special plot actions are in effect (masking, blending) and the driver indicates copies are fast. For other situations OS_SpriteOp 52 is issued in a simple loop. Also tweak OS_SpriteOp 52 implementation to pass unmasked, true colour sprites to the kernel for rendering - contrary to the old source comment, the kernel is significantly faster at this than SpriteExtend.
      Admin:
        Tested on Iyonix, BB-xM
        Requires HdrSrc-2_42
      
      
      Version 1.62. Tagged as 'SprExtend-1_62'
      25c47d65
  4. 04 Mar, 2014 1 commit
    • Jeffrey Lee's avatar
      Update to work with new "32K+" colour translation tables · eb8febb3
      Jeffrey Lee authored
      Detail:
        Sources/SWIs, Sources/SprExtend, Sources/SprOp, c/PutScaled, c/sprtrans, h/putscaled - Cache the sprite NColour value in the save_* workspace
        Sources/SprOp - Update preparettr to perform extra validation on 32K-style translation tables (old "32K." or new "32K+"). Although we could potentially accept any format table, to cut down on the number of plotter combinations we currently require that the table matches the format that ColourTrans will create when given the source sprite.
        c/PutScaled, c/sprtrans - Update comments relating to determining input format of TTRType_32K tables
      Admin:
        Tested on BB-xM
        Requires Colours-1_89
      
      
      Version 1.61. Tagged as 'SprExtend-1_61'
      eb8febb3
  5. 05 Nov, 2013 1 commit
  6. 25 Oct, 2013 1 commit
    • Jeffrey Lee's avatar
      Fix some sprite rendering issues. Add a new test app. · f9b5aa09
      Jeffrey Lee authored
      Detail:
        Bug fixes:
        - Sources/SprOp: Fixed a bug with PlotMask of old-format sprites not working correctly if the sprite is off the left edge of the screen. Fixed Log2bpp/Log2bpc confusion when plotting to double-pixel modes, caused by double pixel bodge being disabled.
        - Sources/SprTrans: Fixed transformed plotting of sprites with lefthand wastage drawing the sprite offset if a transformation matrix is used
        - c/PutScaled: Fixed another double pixel bodge related bug, when plotting double pixel sprites at certain offsets and with the two-at-a-time plotting code
        Test code:
        - Test/c/bigtest: A fairly comprehensive test app that generates lots of random sprites in every supported mode, and plots them using all APIs and options into all supported destination modes. Output is redirected to sprites (so the capabilities of the host video hardware are irrelevant), and checked against a model of what the expected output should look like. Also features some JPEG tests. A fast computer is recommended when running the tests!
        - Test/mkbigtest,fd7: Helper script to build bigtest
        - Test/bigtest2,ffb: Helper BASIC program to allow easy re-testing of failure cases
        - Test/JPEGs/*: Test JPEGs and reference sprites which are used by the JPEG test. JPEGs chosen to exercise all the output formats the JPEG code supports.
      Admin:
        Tested on BB-xM
      
      
      Version 1.60. Tagged as 'SprExtend-1_60'
      f9b5aa09
  7. 14 Oct, 2013 2 commits
    • Jeffrey Lee's avatar
      Fix plots of Y-scaled masks · 96a229b8
      Jeffrey Lee authored
      Detail:
        c/PutScaled - Update r_pixel so that it's available in the Y-loop bank if a Y-scaled mask is being drawn. In this case r_pixel is used as a temp register to help update the ECF pointer.
      Admin:
        Tested on BB-xM
        Fixes issue reported on forums with !Wget application sprite not rendering when dragging-and-dropping it via the filer:
        https://www.riscosopen.org/forum/forums/4/topics/2141
      
      
      Version 1.59. Tagged as 'SprExtend-1_59'
      96a229b8
    • Jeffrey Lee's avatar
      Fix build issues · b55e04a1
      Jeffrey Lee authored
      Detail:
        Sources/SprOp - Added an extra LTORG to fix build issues on ARMv3/4/5/6 caused by literal pools being out of range
      Admin:
        Built successfully as part of an IOMD ROM build, but untested at runtime
      
      
      Version 1.58. Retagged as 'SprExtend-1_58'
      b55e04a1
  8. 13 Oct, 2013 2 commits
    • Jeffrey Lee's avatar
      OS_SpriteOp 38 fixes & improvements · bec3eb90
      Jeffrey Lee authored
      Detail:
        Sources/SprOp:
        - OS_SpriteOp 38 implementation improved so that it will (almost) always attempt to simplify the sprite mode word (even if not performing any transformation on the data)
        - Also fixed/improved it to evaluate bit 8 of R3 with respect to the output data, not the input. So reducing from 8bpp to 1bpp with bit 8 set will now cause the mask to be discarded if all the source pixels were above the cutoff, instead of the old behaviour which would have only discarded the mask if all source pixels were 255.
        - Fixed bug in ExamineAlpha which meant that the 8bpp mask flag was always being cleared - resulting in problems for most conversions (or if the mask was to be left intact)
      Admin:
        Tested on BB-xM
      
      
      Version 1.58. Tagged as 'SprExtend-1_58'
      bec3eb90
    • Jeffrey Lee's avatar
      Add OS_SpriteOp 38 (CreateRemoveAlpha) implementation. Fix FindMaskWidth. · f6ceacd8
      Jeffrey Lee authored
      Detail:
        Sources/SprOp:
        - Implemented OS_SpriteOp 38. For RISC OS 3.5 sprite types it's effectively the same as ROL's version, allowing conversion to/from alpha masks.
        - When given a sprite with a RISC OS 5 alpha channel, it will use that as the source of the alpha/mask data, allowing RISC OS 5 alpha channels to be converted to RISC OS 3.5 1bpp masks or Select alpha masks (including converting to a RISC OS 3.5 mode word where possible)
        - An extra flag (bit 30) has also been added; settings bits 30 & 31 will attempt to convert any existing 1bpp/8bpp mask to a RISC OS 5 alpha channel (or create a default alpha channel if the sprite has no mask). The conversion will fail if the colour depth is such that no alpha channel is possible.
        - Also fixed regression in FindMaskWidth; when converting from the Kernel version it looks like I missed a couple of lines, and all RISC OS 3.5/RISC OS 5 type mode words would have handled incorrectly
        Resources/UK/Messages:
        - Add InvalidSpriteMode error message, for use by OS_SpriteOp 38
      Admin:
        Tested on BB-xM converting various sprites & masks to/from the different formats
      
      
      Version 1.57. Tagged as 'SprExtend-1_57'
      f6ceacd8
  9. 07 Oct, 2013 2 commits
    • Jeffrey Lee's avatar
      Fix rendering of alpha masked sprites when left edge is obscured · ea22c400
      Jeffrey Lee authored
      Detail:
        Sources/SprOp - Fixed the input address/offset calculation in Go_PutSpriteScaled to store the mask width (in bits) seperately from the image width (in pixels), to avoid image width being incorrectly multiplied by 8 when an alpha masked sprite is encountered
      Admin:
        Tested on BB-xM
        Fixes issue reported on forums with alpha-masked netsurf icons rendering incorrectly:
        https://www.riscosopen.org/forum/forums/3/topics/309?page=4#posts-25995
      
      
      Version 1.56. Tagged as 'SprExtend-1_56'
      ea22c400
    • Jeffrey Lee's avatar
      Add support for blended sprite & JPEG rendering - alpha masks, alpha channels, and translucency · 3a5a79f1
      Jeffrey Lee authored
      Detail:
        This big set of changes adds support for the following user-facing APIs, as per ROL's specs:
        - OS_SpriteOp 52 (PutSpriteScaled) colour mapping, translucency blending, and alpha mask/alpha channel blending
        - OS_SpriteOp 56 (PutSpriteTransformed) colour mapping, translucency blending, and alpha mask/alpha channel blending
        - JPEG_Plot[File]Scaled colourmapping & translucency blending
        - JPEG_Plot[File]Transformed colourmapping & translucency blending
        Sources/CFSI-JPEG, Sources/PutScaled:
        - Added exit_oserror exit routine for use by C code.
        - For SpriteExtend this allows the C code to cause OS_SpriteOp to exit with a given OS error block.
        - For CFSI-JPEG the error block is returned and ERROR_FATAL is returned to ChangeFSI.
        Sources/CSupport:
        - Add definitions for some error codes (matches existing definitions from h/commondefs)
        Sources/PutScaled:
        - Stripped out code to look for identity translation tables; now handled by preparettr routine in Sources/SprOp
        Sources/SWIs, Hdr/SprExtend:
        - JPEG SWIs updated to add support for alpha-blended and colour mapped JPEG rendering, following ROL's APIs
        Sources/SprExtend:
        - Stripped out lots of old build flags which haven't been touched in years.
        - Strip out assembler SprTrans code generator.
        - Add new definitions needed for blending & colour mapping.
        Sources/SprOp:
        - Updated PutScaled frontend to deal with blending and colour mapping.
        - Disabled code which was bodging coordinates when dealing with double-pixel modes - it seems to cause a few issues, and the code generator mostly had proper double-pixel support anyway.
        - Translation table verification and fiddling code rewritten and consolidated into the preparettr routine. C code is now explicitly told what table type is in use and whether it can safely be ignored in favour of using the sprite palette.
        - Removed code from CheckSpriteArea which was deliberately throwing an error upon seeing alpha-masked sprites; I think the bug that was hiding has been fixed now
        Sources/SprTrans
        - Removed the assembler version of the code generator.
        - Updated to add support for blending and colour mapping
        c/PutScaled:
        - Old test code removed.
        - Updated to add support for blending & colour mapping
        - Assorted bugs fixed.
        - A few extra architecture-specific optimisations added.
        - Some workspace setup code moved to c/asmcore to allow sharing with SprTrans.
        c/asmcore:
        - Register allocation code rewritten. Instead of allocating on a first-come, first-served basis, the code now builds a list of which logical registers are needed (and which 'banks' they fall into) and then attempts to allocate them in a more intelligent manner. It still has some failings (e.g. reusing R12 as a general purpose register is currently impossible) but it's a lot more flexible and reliable than the old code.
        - Core pixel transformation code updated to add support for blending & colour mapping
        - Added some extra architecture-specific optimisations
        c/rojpeg:
        - JPEG option handling updated to avoid trashing any colour mapping descriptor that may have been passed in
        c/sprtrans:
        - Updated to add support for blending & colour mapping
        c/tracing:
        - Debug assert messages now show filename as well as line number
        h/commondefs:
        - Removed old #define's that related to old assembler switches.
        h/putscaled:
        - Workspace definition updated to match assembler version.
        - SprTrans stack workspace structure moved here from c/sprtrans
      Admin:
        Tested on BB-xM plotting all major sprite & JPEG types into all modes with all major options
      
      
      Version 1.55. Tagged as 'SprExtend-1_55'
      3a5a79f1
  10. 10 Sep, 2013 1 commit
  11. 10 Aug, 2013 1 commit
    • Jeffrey Lee's avatar
      Make SpriteReason_CheckSpriteArea fault alpha masks · d506ee6a
      Jeffrey Lee authored
      Detail:
        Sources/SprOp - CheckSpriteArea now faults any sprite area containing alpha mask sprites. This is probably the best approach for us to take until they're fully supported.
      Admin:
        Tested in Iyonix ROM softload
        Fixes stripey netsurf icon, should hopefully fix reported crashes too.
      
      
      Version 1.53. Tagged as 'SprExtend-1_53'
      d506ee6a
  12. 07 Aug, 2013 1 commit
    • Jeffrey Lee's avatar
      Fixup CFSI-JPEG · c2535776
      Jeffrey Lee authored
      Detail:
        Sources/CFSI-JPEG - Add an extra GET for mode flag definitions used by jdcolor
        c/rojpeg - Use standard 555 TBGR colour conversion function when producing 16bpp output for CFSI-JPEG
      Admin:
        ChangeFSI JPEG output tested on RISC OS 3.7, 5.17, 5.21
        3.7 works fine, but 5.XX fails to convert JPEGs correctly for <256 colour output - to be investigated
      
      
      Version 1.52. Retagged as 'SprExtend-1_52'
      c2535776
  13. 06 Aug, 2013 1 commit
    • Jeffrey Lee's avatar
      Add support for new sprite types & screen modes · d0127bc4
      Jeffrey Lee authored
      Detail:
        Makefile - Updated to fix a couple of dependency issues and to make c/asmcore the main C file, not c/putscaled
        Sources/PutScaled - Add a utility routine that's used by the C code to get information about pixel formats
        Sources/SprAdjSize - Add support for wide masks & RISC OS 5 style sprite mode words
        Sources/SprExtend - Tidy up workspace by removing lots of unused bits and moving other bits within sight of the C code. Add flag to control whether C or assembler version of SprTrans is used. Query kernel for ECFYOffset/ECHShift locations instead of using hardcoded values in putscaled code. Add fix for garbage debug strings in softloaded debug versions of the module.
        Sources/SprOp - Add support for wide masks & RISC OS 5 style sprite mode words. Update makepalette16bpp to cope with all the new 16bpp modes. Flag_* -> ModeFlag_* renaming. Move some translation table handling code into a new routine, 'preparettr'. Update checktrans/converttrans to deal with new pixel formats.
        Sources/SprTrans - If the C version of SprTrans is enabled, disable all of these assembler bits except for the outer loop which steps over each row of the screen
        Sources/jdcolor - Updated to deal with new pixel formats. 16bpp conversion code split off into new file, Sources/jdcolor16.
        Sources/jdcolor16 - New file containing the guts of the YUV -> 16bpp conversion code. Gets included multiple times with different options to generate the different conversion routines (code is too big for a macro).
        c/asmcore - New file containing lots of common code ripped out of c/PutScaled - e.g. workspace definition, main functions for register assignment & instruction generation, and code for pixel format conversion. Pixel format conversion code rewritten to cope with new pixel formats, and code buffer key word generation rewritten to fix a couple of bugs (e.g. some issues with dithering options were observed)
        c/PutScaled - Ripped out lots of code that's now in c/asmcore. Now just deals with things that are PutScaled-specific, e.g. main plotter loop containing pixel read/write code. Code extended to cope with new pixel formats
        c/rojpeg, h/jinclude, h/jpegdata - Code extended to cope with new 16bpp conversion routines
        c/sprtrans - New C implementation of the core per-row transformed sprite plotting code generator. Allows reuse of the extensive pixel conversion code in c/asmcore, and allows for better code generation than the assembler original.
        h/putscaled - Worksapce definition updated to match assembler version
      Admin:
        Tested on BB-xM, plotting lots of different sprites in lots of different modes
        Plotting of wide mask sprites not supported yet
        C version of YUV -> 16bpp code currently only deals with traditional &BGR 555 pixel format - code is aware of this and will do conversion to desired format if applicable (although quality may be reduced)
        Part of an implementation of the Extended Framebuffer Format spec:
        http://www.riscosopen.org/wiki/documentation/show/Extended%20Framebuffer%20Format%20Specification
      
      
      Version 1.52. Tagged as 'SprExtend-1_52'
      d0127bc4
  14. 10 Aug, 2012 1 commit
  15. 28 Jul, 2012 1 commit
    • Robert Sprowson's avatar
      Adopt colour conversions from MigrateIJG8b branch · 79650dda
      Robert Sprowson authored
      Now for every colour conversion there is a corresponding C function, allowing swapping between them for test purposes.
      Here, 'ASMCOLOR' is selected and the C functions not even referenced in the makefile, see branch for use.
      Permits use of USAT, for a small 1.5% speedup and smaller code.
      Some other typedefs and comment shuffling copied over - should be harmless.
      
      Version 1.50. Tagged as 'SprExtend-1_50'
      79650dda
  16. 22 Apr, 2012 1 commit
    • Robert Sprowson's avatar
      Fix for append SpriteOp producing invalid sprite areas. · d8d11dac
      Robert Sprowson authored
      Detective work from Martin Avison, now correctly joins the following combinations
      * New format + New format (no mask) H or V
      * Old format + Old format (no mask) H or V
      * New format + New format (masked) H or V
      * Old format + Old format (masked) H or V
      
      Version 1.49. Tagged as 'SprExtend-1_49'
      d8d11dac
  17. 14 Jan, 2012 1 commit
  18. 03 Oct, 2011 1 commit
  19. 05 Aug, 2011 1 commit
    • Jeffrey Lee's avatar
      Update to work with zero page relocation · efbbc508
      Jeffrey Lee authored
      Detail:
        Sources/SprExtend - Try using OS_ReadSysInfo 6 to get ECF block addresses before falling back on legacy addresses. Store pointers in module workspace for speedy access.
        Sources/SprOp, Sources/SprTrans - Use workspace ECF block pointers
        c/rojpeg - Fix null pointer access (actually an unused variable)
      Admin:
        Tested on rev A2 BB-xM
      
      
      Version 1.46. Tagged as 'SprExtend-1_46'
      efbbc508
  20. 20 Jul, 2011 2 commits
    • Robert Sprowson's avatar
      Revise strictness of sprite area checking. · 1fcbc76a
      Robert Sprowson authored
      Those SpriteOps that modify the sprite input now
      * R0=&0-&FF R1=don't care R2=mustn't be too low down
      * R0=&100-&1FF R1=must be valid R2=mustn't be too low down
      * R0=&200-&2FF R1=must be valid R2=must be valid
      Those SpriteOps that just display but don't modify the input sprite
      * R0=&0-&FF R1=don't care R2=mustn't be too low down
      * R0=&100-&1FF R1=must be valid R2=mustn't be too low down
      * R0=&200-&2FF R1=don't care R2=must be valid
      In this context, valid means word aligned and not too low down.
      In this context, too low down is anything below &100.
      
      Version 1.45. Tagged as 'SprExtend-1_45'
      1fcbc76a
    • Robert Sprowson's avatar
      f88d011f
  21. 10 Jul, 2011 1 commit
  22. 09 Jul, 2011 1 commit
  23. 25 Jun, 2011 1 commit
    • Jeffrey Lee's avatar
      Make SpriteExtend perform sanity checks on sprite/area pointers · 25b0870e
      Jeffrey Lee authored
      Detail:
        Sources/SprExtend - Added new CheckAlignedAndSensible macro to make it easy to check pointers. Pointers which aren't word aligned or are less than 256 are considered bad.
        Sources/SprOp - Update findsprite, getspritename and getspriteaddr to check sprite/area/name pointers for validity. Sprite names are the only ones that are allowed to not be word aligned.
      Admin:
        Tested on rev A2 BB-xM.
      
      
      Version 1.43. Tagged as 'SprExtend-1_43'
      25b0870e
  24. 14 Apr, 2011 2 commits
    • Ben Avison's avatar
      Added !ptr_test demonstrator/test harness. · 1a702ba7
      Ben Avison authored
      Retagged as 'SprExtend-1_42'
      1a702ba7
    • Ben Avison's avatar
      Fixed set active coord from mask in OS_SpriteOp 36 (set pointer shape) · de25c04d
      Ben Avison authored
      Detail:
        Page 33 of the RiscOS 3 volume 3 Programmers manual states that the
        active point can be set from the sprite's mask. This was never
        implemented but it is very useful as it means that the active point
        is no longer hardwired into programs but dependant on the sprite
        used.
      
        The obvious problem is ptr_write. At present the active point is at
        the top left. If you run !ptr_test and run the pointer over the
        'standard active point position' writable icons from the bottom you
        will see that the pointer changes to an I with its top at the bottom
        of the writable icon. If you move the pointer until the top of the I
        is just inside the upper writable icon of the 2 and click, the focus
        goes into the upper writable - not what you'd expect.
      
        Similarly it's difficult to place the caret between the 2 lls in
        will. The bottom two icons shows the difference with the active
        point in the correct position in the I beam.
      
        You could change the wimp to put the caret in the correct position
        like I have in the bottom 2 writables of !Ptr_test however this
        would have the wrong active point position if the mode had
        rectangular y pixels and it wouldn't fix all instances where
        programmers had set ther own values.
      
        It also means that themes can change the pointer active point as
        well as the shape.
      
        The routine added copes with old and new type sprites of any bit depth though
        OS_SpriteOp 36 has a 8bit limit.
      Admin:
        Tested on Iyonix 5.17.
      Author:
        Colin Granville
      
      Version 1.42. Tagged as 'SprExtend-1_42'
      de25c04d
  25. 14 Mar, 2011 1 commit
  26. 13 Feb, 2011 1 commit
  27. 11 Jan, 2011 1 commit
    • Robert Sprowson's avatar
      Fix bug in JPEG vetting, tag 0xC4 was being taken as an SOF and quitting the... · c6b8eb1b
      Robert Sprowson authored
      Fix bug in JPEG vetting, tag 0xC4 was being taken as an SOF and quitting the tag scanning loop, which in turn rejected the JPEG as 0xC4 isn't a supported SOF type. In fact, it's not even an SOF type at all. See new IS_AN_SOF macro.
      
      Fix bug leaving JPEG file handle open when unknown SOF or entropy encoding encountered (spotted testing the above).
      
      Version 1.39. Tagged as 'SprExtend-1_39'
      c6b8eb1b
  28. 23 Dec, 2010 1 commit
    • Robert Sprowson's avatar
      Retire unused IJG version 4 files. · 008a1606
      Robert Sprowson authored
      Fold RISC OS specific colour conversion routines into rojpeg.
      Remove jcconv, this also highlighted there were some more unused functions.
      Should make move to IJG version 8 even easier.
      
      Version 1.38. Tagged as 'SprExtend-1_38'
      008a1606
  29. 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
  30. 14 Nov, 2010 2 commits
    • Robert Sprowson's avatar
      Obey bit 0 of JPEG_[File]Info flags. · 009a0332
      Robert Sprowson authored
      When clear, r2 and r3 are preserved per PRM documentation.
      Also BIC'd out bits 7-10 of r0 on return so they can be reused in future, previous version would always have returned &C in those bits.
      
      Version 1.36. Tagged as 'SprExtend-1_36'
      009a0332
    • Robert Sprowson's avatar
      API enhancement and space saving refactoring. · 8f1ed4bb
      Robert Sprowson authored
      Setting bit 1 of r0 in JPEG_FileInfo and JPEG_Info will now return the SOF type of the JPEG in question in bits 3-6 of the info flags in r0 on exit.
      Took this opportunity to refactor find_image_dims to take a structure pointer rather than lots of individual pointers (CFSI-JPEG ammended to match). Untangled the return codes a bit so it is only necessary to inspect r0 on exit from C to determine the outcome. Values of 1 & 2 are translated in the assembler code into more specific error messages than just "Incomplete or corrupt JPEG".
      Fix bug where unknown density marker would leave the file open in JPEG_FileInfo.
      Don't bother ADRL'ing r1 for error messages that don't have a %0 in them.
      Added all the input & output flag definitions to the exported header file so other callers can use them too.
      More functionality, fewer bugs, about 200 bytes smaller too.
      
      Version 1.35. Tagged as 'SprExtend-1_35'
      8f1ed4bb
  31. 06 Nov, 2010 1 commit
    • Robert Sprowson's avatar
      Fix infinite loop when unrecognised entropy encoding encountered. · b0a63e28
      Robert Sprowson authored
      In find_image_dims() the while loop is only exited when SOF0 or SOF1 (the two supported ones) is encountered, the other 14 possible combinations got stuck in a loop because OS_GBPB doesn't return an error at EOF.
      Check added for OS_GBPB returning nothing, plus an exit when a SOS or EOI tag is hit for the memory only check (it's not possible to know where the end truly is in that case.
      jcconv: warning supressed.
      SWIs: comment corrected.
      Tested with a bogus SOF, now gives an error message instead.
      
      Version 1.34. Tagged as 'SprExtend-1_34'
      b0a63e28
  32. 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
  33. 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
  34. 07 Oct, 2010 1 commit