Commit e20288dd authored by Robert Sprowson's avatar Robert Sprowson Committed by ROOL
Browse files

Raise the image line/area limits to 8k

Increase the max next slot to process lines to > 8k.
Increase the max work area for internal images to allow 8k x 8k.
Given a choice of creating a large dynamic area or using the app slot, prefer the latter.
Fix bug reusing a stale area address when trying to process an image > max work area:
1. ChangeFSI switches to buffer via file mode
2. On completion of processing the buffer is freed, but the area address returned anyway
3. Desktop front end tries to read the sprite name from the (now absent) area,
   leading to an abort in ReturnName in the kernel's sprite handler
this would complete correctly if done via the command line.

Tested with a 7200x5400 PNG. Now loads correctly on a large memory machine, and reports "Can't get enough memory to process image" on a 64MB Risc PC.
Fixes https://www.riscosopen.org/forum/forums/1/topics/3977?page=5#posts-125179

Version 1.66. Tagged as 'ChangeFSI-1_66'
parent 16c77b96
......@@ -15,7 +15,7 @@ Set Alias$ChangeFSI Run <ChangeFSI$Dir>.ChangeFSI %%*0
| The size of the slot affects the horizontal picture size only!
| Drag next to <=320K if you are short of memory before running.
| Drag Next to >=500K if you want to convert a wide (eg 3072 pixels) image.
WimpSlot -min 320K -max 508K
| Drag Next to >=832K if you want to convert a wide (eg 8192 pixels) image.
WimpSlot -min 320K -max 832K
Run <ChangeFSI$Dir>.ChangeFSI -wimp %*0
/* (1.65)
/* (1.66)
*
* This file is automatically maintained by srccommit, do not edit manually.
*
*/
#define Module_MajorVersion_CMHG 1.65
#define Module_MajorVersion_CMHG 1.66
#define Module_MinorVersion_CMHG
#define Module_Date_CMHG 13 Mar 2021
#define Module_Date_CMHG 27 Sep 2021
#define Module_MajorVersion "1.65"
#define Module_Version 165
#define Module_MajorVersion "1.66"
#define Module_Version 166
#define Module_MinorVersion ""
#define Module_Date "13 Mar 2021"
#define Module_Date "27 Sep 2021"
#define Module_ApplicationDate "13-Mar-21"
#define Module_ApplicationDate "27-Sep-21"
#define Module_ComponentName "ChangeFSI"
#define Module_FullVersion "1.65"
#define Module_HelpVersion "1.65 (13 Mar 2021)"
#define Module_LibraryVersionInfo "1:65"
#define Module_FullVersion "1.66"
#define Module_HelpVersion "1.66 (27 Sep 2021)"
#define Module_LibraryVersionInfo "1:66"
......@@ -83,10 +83,11 @@ DEF FNChangeFSI(A$,spritearea%,workspace%,worklimit%,oksave%,okinfo%,RETURN ram%
scrapf%= FALSE
gamma=1
rotate%= FALSE
max%=64*1024*1024
bright%=15
lock%= FALSE
rwt=.299 : gwt=.587 : bwt=.114 : REM CIE Y weightings for R, G, B
REM Default max size in bytes for intermediate image (8kx8k @ 32bpp)
max%=256*1024*1024
REM Default PNG output settings
pngparamcomp%=5
pngparamint%=0
......@@ -8187,6 +8188,7 @@ ENDPROC
:
REM
DEF PROCgetoutput(A%,E%,B%,RETURN C%)
LOCAL limit%
IF A%>max% AND rotate%= FALSE AND vflip%= FALSE THEN
C%=max% DIV B%+1
A%=xwords%*C%+E%
......@@ -8195,8 +8197,11 @@ DEF PROCgetoutput(A%,E%,B%,RETURN C%)
A%+=E%
ENDIF
IF spritearea%=-1 THEN
ram%=FNcreatearea(A%)
IF ram%=-1 ram%=FNdim(A%)
REM Prefer to use the application slot rather than exceed the area clamp
SYS &20066,8 TO,,limit%;V%
IF V% AND 1 THEN limit%=A%
IF A%<=limit% THEN ram%=FNcreatearea(A%) ELSE ram%=-1
IF ram%=-1 THEN ram%=FNdim(A%)
ELSE
ram%=spritearea%
ENDIF
......@@ -8206,8 +8211,11 @@ ENDPROC
REM
DEF PROCgetoutputjp(RETURN A%)
IF spritearea%=-1 THEN
ram%=FNcreateareajp(A%)
IF ram%=-1 ram%=FNdimjp(A%)
REM Prefer to use the application slot rather than exceed the area clamp
SYS &20066,8 TO,,limit%;V%
IF V% AND 1 THEN limit%=A%
IF A%<=limit% THEN ram%=FNcreateareajp(A%) ELSE ram%=-1
IF ram%=-1 THEN ram%=FNdimjp(A%)
ELSE
ram%=spritearea%
ENDIF
......@@ -8424,7 +8432,7 @@ DEF PROCSave(fail%)
IF o% PROCflushoutput ELSE SYS &2E,&10c,ram%,f$
ENDIF
ENDCASE
IF o% CLOSE#o%:o%=0:OSCLI"Settype "+f$+" &ff9":PROCremovearea
IF o% CLOSE#o%:o%=0:OSCLI"Settype "+f$+" &ff9":PROCremovearea:ram%=-1
SYS "Hourglass_Off"
ENDPROC
:
......
......@@ -83,7 +83,7 @@ IF task% THEN
ENDIF
scrap%= FALSE
sprite%= FALSE
sar%= FALSE
sar%= -1
saved%= TRUE
isopen%= FALSE
lastm%= 0
......@@ -565,7 +565,7 @@ DEF PROCcallFSI
A%=FNChangeFSI(A$,-1,-1,nextlocation%,FALSE,FALSE,sar%,FALSE)
IF fast% SYS "OS_UpdateMEMC",oldmemc,&700
IF scrap% scrap%= FALSE :SYS "OS_File",6,F$
IF A%<2 AND sar%<>0 THEN
IF A%<2 AND sar%<>-1 THEN
$adsx%= STR$xsp%
$adsy%= STR$ysp%
CASE imgsave% OF
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment