#! perl # # copyright P KENT SEPTEMBER 2000 # version 1.4 public release - only outputs mode 8 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 Flash Red Blue) # mode 8: GFGFGFGF RBRBRBRB # # input file must be called ql8.raw # now performs internal diffusion/stochastic dithering if (! -e "ql8.raw" ) { print("\nNO INPUT\n");exit(0); } else { print("\n\nNEW RUN\n"); } open(RAW,"ql8.raw"); open(CNV,"> img_ql8"); $line=0; $thresh=254.99; while ( $line < 256 ) { print("$line\n"); $px=0; while ( $px < 64 ) { read RAW,$n,12; @twpix = split(//,$n); $ga = ((ord $twpix[1]) > rand($thresh) ) * 128; $gb = ((ord $twpix[4]) > rand($thresh) ) * 32; $gc = ((ord $twpix[7]) > rand($thresh) ) * 8; $gd = ((ord $twpix[10]) > rand($thresh) ) * 2; $ra = ((ord $twpix[0]) > rand($thresh) ) * 128; $rb = ((ord $twpix[3]) > rand($thresh) ) * 32; $rc = ((ord $twpix[6]) > rand($thresh) ) * 8; $rd = ((ord $twpix[9]) > rand($thresh) ) * 2; $ba = ((ord $twpix[2]) > rand($thresh) ) * 64; $bb = ((ord $twpix[5]) > rand($thresh) ) * 16; $bc = ((ord $twpix[8]) > rand($thresh) ) * 4; $bd = ((ord $twpix[11]) > rand($thresh) ) * 1; $byteone = chr($ga + $gb + $gc + $gd); $bytetwo = chr($ra + $rb + $rc + $rd + $ba + $bb + $bc + $bd); print(CNV "$byteone$bytetwo"); $px++; } $line++; } close(RAW); close(CNV); exit(0);