DIRECTORY ColorizeViewPointBackdoor, IPScan, Rope; ColorizeViewPointDeInterleaveImpl: CEDAR PROGRAM IMPORTS ColorizeViewPointBackdoor, IPScan, Rope ~ BEGIN ROPE: TYPE ~ Rope.ROPE; DeInterleaveSamples: PUBLIC ColorizeViewPointBackdoor.Colorization ~ { InterleavedSamplesAction: IPScan.ScanProc ~ { xPixels, yPixels, samplesPerPixel: NAT; startPA, totalPixels: INT; IF ~(ip.Substr[max-2, 2].Equal["\241\302"]) --MAKEPIXELARRAY-- THEN ERROR; --System error IF ip.Substr[min+8, 2].Equal["\017\240" --0=non-interleaved--] OR (samplesPerPixel _ ORD[ip.Fetch[min+4]]*256 + ORD[ip.Fetch[min+5]] - 4000)=1 --ie, bitmap-- THEN { --flush and leave newIP _ newIP.Concat[ip.Substr[flushedTo, max-flushedTo]]; flushedTo _ max; RETURN; }; xPixels _ ORD[ip.Fetch[min]]*256 + ORD[ip.Fetch[min+1]] - 4000; yPixels _ ORD[ip.Fetch[min+2]]*256 + ORD[ip.Fetch[min+3]] - 4000; totalPixels _ xPixels*yPixels; FOR startPA _ min+10, startPA+1 WHILE startPA<=ip.Size DO SELECT TRUE FROM ip.Fetch[startPA]='\350 AND ip.Fetch[startPA+4]='\001 --header to Long sequenceLargeVector-- => { startPA _ startPA+5; EXIT }; ip.Fetch[startPA]='\310 AND ip.Fetch[startPA+2]='\001 --header to Short sequenceLargeVector-- => { startPA _ startPA+3; EXIT }; ENDCASE => NULL; ENDLOOP; newIP _ newIP.Cat[ip.Substr[flushedTo, (min+8)-flushedTo], "\017\240" --change to non-interleaved samples--, ip.Substr[min+10, startPA-(min+10)]]; --flush through PA data FOR i: NAT IN [0..samplesPerPixel) DO tLen: NAT _ MIN[totalPixels, NAT.LAST]; processedTo: INT _ startPA+i; DO scratchText: REF TEXT _ NEW[TEXT[tLen]]; scratchText.length _ tLen; { ipIndex: INT _ 0; textIndex: NAT _ 0; s1: NAT ~ samplesPerPixel; s2: NAT ~ s1+s1; s3: NAT ~ s2+s1; s4: NAT ~ s3+s1; s5: NAT ~ s4+s1; s6: NAT ~ s5+s1; s7: NAT ~ s6+s1; s8: NAT ~ s7+s1; THROUGH [0 .. tLen/8) DO scratchText[textIndex] _ ip.Fetch[processedTo+ipIndex]; scratchText[textIndex+1] _ ip.Fetch[processedTo+ipIndex+s1]; scratchText[textIndex+2] _ ip.Fetch[processedTo+ipIndex+s2]; scratchText[textIndex+3] _ ip.Fetch[processedTo+ipIndex+s3]; scratchText[textIndex+4] _ ip.Fetch[processedTo+ipIndex+s4]; scratchText[textIndex+5] _ ip.Fetch[processedTo+ipIndex+s5]; scratchText[textIndex+6] _ ip.Fetch[processedTo+ipIndex+s6]; scratchText[textIndex+7] _ ip.Fetch[processedTo+ipIndex+s7]; textIndex _ textIndex+8; ipIndex _ ipIndex+s8; ENDLOOP; FOR k: NAT IN [textIndex .. tLen) DO scratchText[k] _ ip.Fetch[processedTo+ipIndex]; ipIndex _ ipIndex+s1; ENDLOOP; }; newIP _ newIP.Concat[Rope.FromRefText[scratchText]]; IF (processedTo _ processedTo+tLen)[s: REF READONLY TEXT, start: NAT _ 0, len: NAT _ 32767]šœ4˜4Kšœ.œœœœœœ˜mKšœ˜—Kšœ˜—Kšœ2¡$˜VKšœ˜—K˜Kšœ œ˜Kšœœ4˜UKšœ+˜+K˜K˜—K˜K–^[colorization: ColorizeViewPointBackdoor.Colorization, setting: ColorizeViewPoint.Setting]šœÂœ˜ÊK˜—K˜Kšœ˜—…— (‘