#! perl # # copyright P KENT SEPTEMBER 2000 # version 1.4 public release - only outputs mode 4 files # # written as a service to the QL community # no responsibility will be assumed for anything this program does # use at your own risk # # converts to QL video dump from raw format # Note: QL video is encoded as 2-byte chunks # msb->lsb (Green Red) # mode 4: GGGGGGGG RRRRRRRR # R+G=White # # input file must be called ql4.raw # now performs internal diffusion/stochastic dithering if (! -e "ql4.raw" ) { print("\nNO INPUT\n");exit(0); } else { print("\n\nNEW RUN\n"); } open(RAW,"ql4.raw"); open(CNV,"> img_ql4"); $line=0; $thresh=254.99; while ( $line < 256 ) { print("$line\n"); $px=0; while ( $px < 64 ) { read RAW,$n,24; @twpix = split(//,$n); $ga = ((ord $twpix[1]) > rand($thresh) ) * 128; $gb = ((ord $twpix[4]) > rand($thresh) ) * 64; $gc = ((ord $twpix[7]) > rand($thresh) ) * 32; $gd = ((ord $twpix[10]) > rand($thresh) ) * 16; $ge = ((ord $twpix[13]) > rand($thresh) ) * 8; $gf = ((ord $twpix[16]) > rand($thresh) ) * 4; $gg = ((ord $twpix[19]) > rand($thresh) ) * 2; $gh = ((ord $twpix[22]) > rand($thresh) ) * 1; $ra = ((ord $twpix[0]) > rand($thresh) ) * 128; $rb = ((ord $twpix[3]) > rand($thresh) ) * 64; $rc = ((ord $twpix[6]) > rand($thresh) ) * 32; $rd = ((ord $twpix[9]) > rand($thresh) ) * 16; $re = ((ord $twpix[12]) > rand($thresh) ) * 8; $rf = ((ord $twpix[15]) > rand($thresh) ) * 4; $rg = ((ord $twpix[18]) > rand($thresh) ) * 2; $rh = ((ord $twpix[21]) > rand($thresh) ) * 1; $byteone = chr($ga + $gb + $gc + $gd + $ge + $gf + $gg + $gh); $bytetwo = chr($ra + $rb + $rc + $rd + $re + $rf + $rg + $rh); print(CNV "$byteone$bytetwo"); $px++; } $line++; } close(RAW); close(CNV); exit(0);