Commit 37d93803 authored by Robert Sprowson's avatar Robert Sprowson

Fix for unaligned load processing 48 bit image data

In mappix (2 occurrences) for 48 bit data when step24=6 ChangeFSI relied on the unaligned load rotate, this is now split out for machines that can't do that.
Don't bother looking for jcompmod in ChangeFSI$Dir - it's never been supplied there.
Line 6934: fix stack imbalance.
Rehomed a few comments with the lines to which they refer, added a few comments.
Built, but not tested.

Version 1.41. Tagged as 'ChangeFSI-1_41'
parent 120c1721
/* (1.40)
/* (1.41)
*
* This file is automatically maintained by srccommit, do not edit manually.
* Last processed by srccommit version: 1.1.
*
*/
#define Module_MajorVersion_CMHG 1.40
#define Module_MajorVersion_CMHG 1.41
#define Module_MinorVersion_CMHG
#define Module_Date_CMHG 11 Aug 2013
#define Module_Date_CMHG 12 Dec 2013
#define Module_MajorVersion "1.40"
#define Module_Version 140
#define Module_MajorVersion "1.41"
#define Module_Version 141
#define Module_MinorVersion ""
#define Module_Date "11 Aug 2013"
#define Module_Date "12 Dec 2013"
#define Module_ApplicationDate "11-Aug-13"
#define Module_ApplicationDate "12-Dec-13"
#define Module_ComponentName "ChangeFSI"
#define Module_ComponentPath "mixed/RiscOS/Sources/Apps/ChangeFSI"
#define Module_FullVersion "1.40"
#define Module_HelpVersion "1.40 (11 Aug 2013)"
#define Module_LibraryVersionInfo "1:40"
#define Module_FullVersion "1.41"
#define Module_HelpVersion "1.41 (12 Dec 2013)"
#define Module_LibraryVersionInfo "1:41"
......@@ -1511,10 +1511,7 @@ DEF FNChangeFSI(A$,spritearea%,workspace%,worklimit%,oksave%,okinfo%,RETURN ram%
max%=64*1024*1024
bright%=15
lock%= FALSE
rwt=.299
gwt=.587
bwt=.114
REM CIE Y weightings for R, G, B
rwt=.299 : gwt=.587 : bwt=.114 : REM CIE Y weightings for R, G, B
IF ARG%<3 THEN
PRINT "ChangeFSI interactive input (read FSIinfo for command line details)"
INPUT "Source file: "s$,"Destination file: "f$,"Output mode: "m$
......@@ -4066,8 +4063,8 @@ DEF FNChangeFSI(A$,spritearea%,workspace%,worklimit%,oksave%,okinfo%,RETURN ram%
SYS "Hourglass_On",1
hour%=&406c4
IF m=-9 OR m=-10 THEN
REM Mono or colour JPEG output
SYS "XOS_CLI","rmensure CompressJPEG 0 rmload System:Modules.jcompmod"
SYS "XOS_CLI","rmensure CompressJPEG 0 IF ""<ChangeFSI$Dir>"" <> """" THEN rmload <ChangeFSI$Dir>.jcompmod"
OSCLI"rmensure CompressJPEG 0 ERROR ChangeFSI requires the CompressJPEG module to perform this operation"
ENDIF
IF invert% r%()=F-r%():g%()=F-g%():b%()=F-b%()
......@@ -4092,6 +4089,7 @@ DEF FNChangeFSI(A$,spritearea%,workspace%,worklimit%,oksave%,okinfo%,RETURN ram%
y%=sy%
ncol=2^24-1
WHEN -9,-10
REM JPEG mono or colour
x%=sx%
y%=sy%
ncol=2^24-1
......@@ -4223,8 +4221,7 @@ DEF FNChangeFSI(A$,spritearea%,workspace%,worklimit%,oksave%,okinfo%,RETURN ram%
x%=sx%*xmul%/xdiv%+.9999
y%=sy%*ymul%/ydiv%+.9999
rows%=sy%
order%=x%*y%>sx%*sy%
REM TRUE if scaling up
order%=x%*y%>sx%*sy%:REM TRUE if scaling up
code%=FNdim(8192)
SP=13
IF cache% THEN
......@@ -4615,12 +4612,9 @@ DEF FNChangeFSI(A$,spritearea%,workspace%,worklimit%,oksave%,okinfo%,RETURN ram%
ENDIF
ENDIF
IF hist% OR equal% DIM vals%(256,col)
DIM nl%(x%+7,col)
REM next line additive errors
totvals%=x%*(col+1)
REM total number of elements in a scaled line
totvals2%=sx%*(col+1)
REM total number of elements in an input line
DIM nl%(x%+7,col) : REM next line additive errors
totvals%=x%*(col+1) : REM total number of elements in a scaled line
totvals2%=sx%*(col+1) : REM total number of elements in an input line
FOR Z=0 TO 2 STEP 2
P%=code%
CASE ncol OF
......@@ -6450,12 +6444,18 @@ DEF FNChangeFSI(A$,spritearea%,workspace%,worklimit%,oksave%,okinfo%,RETURN ram%
MOV r11,#colourindex AND 255
ADD r11,r11,#colourindex AND &ff00
.mappixlp
LDR R8,[R1],#step24
LDR R9,[R2],#step24
LDR R10,[R3],#step24
AND r8,r8,r11
AND r9,r9,r11
AND r10,r10,r11
LDRB R14,[R1,#1]
LDRB R8,[R1],#step24
ORR R8,R8,R14,LSL #8
AND R8,R8,R11
LDRB R14,[R2,#1]
LDRB R9,[R2],#step24
ORR R9,R9,R14,LSL #8
AND R9,R9,R11
LDRB R14,[R3,#1]
LDRB R10,[R3],#step24
ORR R10,R10,R14,LSL #8
AND R10,R10,R11
LDR R8,[R4,R8,LSL #2]
LDR R9,[R5,R9,LSL #2]
LDR R10,[R6,R10,LSL #2]
......@@ -6928,16 +6928,22 @@ DEF FNChangeFSI(A$,spritearea%,workspace%,worklimit%,oksave%,okinfo%,RETURN ram%
LDR R6,[R9,#3*8] REM base of b array
LDR R7,[R9,#6*8] REM base of z array
FNcpsr_to_r(11)
STMFD SP !,{R14}
STMFD SP !,{R11,R14}
MOV r11,#colourindex AND 255
ADD r11,r11,#colourindex AND &ff00
.mappixlp
LDR R8,[R1],#step24
LDR R9,[R2],#step24
LDR R10,[R3],#step24
AND r8,r8,r11
AND r9,r9,r11
AND r10,r10,r11
LDRB R14,[R1,#1]
LDRB R8,[R1],#step24
ORR R8,R8,R14,LSL #8
AND R8,R8,R11
LDRB R14,[R2,#1]
LDRB R9,[R2],#step24
ORR R9,R9,R14,LSL #8
AND R9,R9,R11
LDRB R14,[R3,#1]
LDRB R10,[R3],#step24
ORR R10,R10,R14,LSL #8
AND R10,R10,R11
LDR R8,[R4,R8,LSL #2]
LDR R9,[R5,R9,LSL #2]
LDR R10,[R6,R10,LSL #2]
......@@ -8177,8 +8183,7 @@ DEF FNChangeFSI(A$,spritearea%,workspace%,worklimit%,oksave%,okinfo%,RETURN ram%
STRB R0,[R2],#1
SUBS R3,R3,#1
BNE multibytefromcachel
LDMFD SP !,{R0,R14}
MOV PC,R14
LDMFD SP !,{R0,PC}
]
ENDIF
IF planar%<0 THEN
......@@ -9469,7 +9474,7 @@ DEF PROCSave
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
SYS "Hourglass_Off"
ENDPROC
:
......@@ -10290,6 +10295,7 @@ DEF FN3600(z%())
:
REM
DEF FN3708(z%())
REM Greyscale output R=G=B (8bpp)
A%=jpegspace%
jpegy%-=1
B%=jpegy%
......@@ -10299,6 +10305,7 @@ DEF FN3708(z%())
:
REM
DEF FN3724(z%())
REM Colour output (24bpp)
A%=jpegspace%
jpegy%-=1
B%=jpegy%
......@@ -10498,12 +10505,12 @@ DEF PROCAssemble_Shell
CMP R6,R4
BCC Shell_Copy
MOV R0,#1 REM Selective flush
MOV R0,#1 REM Selective flush
SUB R2,R5,#4
MOV R1,R9
SWI &2006E REM XOS_SynchroniseCodeAreas
SWI &2006E REM XOS_SynchroniseCodeAreas
MOV PC,R9 REM Call copied shell code
MOV PC,R9 REM Call copied shell code
.Shell_Job
LDR R2,[R3,#-4]! REM Now copy BASIC's workspace upstairs
STR R2,[R9,#-4]!
......
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