├── doc ├── 139-orig.png ├── apt_sync.png ├── 139-color-a.png ├── 139-color-b.png ├── apt_frame.png ├── DecodedTestImage.jpg ├── SourceTestAudio.ogg ├── SourceTestImage.jpg ├── apt_line_format.png ├── 139-color-decoded.png └── test-space-4k-lines.png ├── img-table ├── imgc.make ├── img-table.pro └── img.c ├── apt-colorm ├── apt-colorm.make ├── apt-colorm.pro └── apt-colorm.c ├── .gitignore ├── apt-encoder ├── apt_audio.make ├── wavwrite.h ├── apt-encoder.pro ├── audioset.c ├── audioset.h ├── main.h ├── wavwrite.c └── main.c ├── aptcode ├── aptcode.pro ├── aptcode.h └── aptcode.c ├── image ├── image.pro ├── image.h ├── image.c ├── imgtable_apt.h └── imgtable.h ├── apt-encoder.pro ├── README.md ├── COPYING └── apt-encoder.pro.user /doc/139-orig.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tom2238/apt-encoder/HEAD/doc/139-orig.png -------------------------------------------------------------------------------- /doc/apt_sync.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tom2238/apt-encoder/HEAD/doc/apt_sync.png -------------------------------------------------------------------------------- /doc/139-color-a.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tom2238/apt-encoder/HEAD/doc/139-color-a.png -------------------------------------------------------------------------------- /doc/139-color-b.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tom2238/apt-encoder/HEAD/doc/139-color-b.png -------------------------------------------------------------------------------- /doc/apt_frame.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tom2238/apt-encoder/HEAD/doc/apt_frame.png -------------------------------------------------------------------------------- /img-table/imgc.make: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | gcc image.c img.c aptcode.c -Wall -o imgc -std=c99 -lm 3 | -------------------------------------------------------------------------------- /apt-colorm/apt-colorm.make: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | gcc apt-colorm.c image.c -Wall -o apt-colorm -std=c99 3 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.tga 2 | *.jpg 3 | *.plist 4 | images/ 5 | Debug/ 6 | .codelite/ 7 | mtrace-output.txt 8 | -------------------------------------------------------------------------------- /doc/DecodedTestImage.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tom2238/apt-encoder/HEAD/doc/DecodedTestImage.jpg -------------------------------------------------------------------------------- /doc/SourceTestAudio.ogg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tom2238/apt-encoder/HEAD/doc/SourceTestAudio.ogg -------------------------------------------------------------------------------- /doc/SourceTestImage.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tom2238/apt-encoder/HEAD/doc/SourceTestImage.jpg -------------------------------------------------------------------------------- /doc/apt_line_format.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tom2238/apt-encoder/HEAD/doc/apt_line_format.png -------------------------------------------------------------------------------- /doc/139-color-decoded.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tom2238/apt-encoder/HEAD/doc/139-color-decoded.png -------------------------------------------------------------------------------- /apt-encoder/apt_audio.make: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | gcc main.c image.c aptcode.c audioset.c -lm -lpthread -o apt_audio 3 | -------------------------------------------------------------------------------- /doc/test-space-4k-lines.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tom2238/apt-encoder/HEAD/doc/test-space-4k-lines.png -------------------------------------------------------------------------------- /aptcode/aptcode.pro: -------------------------------------------------------------------------------- 1 | TEMPLATE = lib 2 | INCLUDEPATH += ../image 3 | CONFIG = staticlib 4 | SOURCES = \ 5 | aptcode.c 6 | HEADERS = \ 7 | aptcode.h 8 | -------------------------------------------------------------------------------- /image/image.pro: -------------------------------------------------------------------------------- 1 | TEMPLATE = lib 2 | INCLUDEPATH += ../aptcode 3 | CONFIG = staticlib 4 | SOURCES = \ 5 | image.c 6 | HEADERS = \ 7 | image.h \ 8 | imgtable.h \ 9 | imgtable_apt.h 10 | -------------------------------------------------------------------------------- /apt-encoder/wavwrite.h: -------------------------------------------------------------------------------- 1 | #ifndef _WAV_WRITE_APT 2 | #define _WAV_WRITE_APT 3 | 4 | //Write wav file header 5 | unsigned int wav_head(double tdur, unsigned int fs,unsigned int bits, FILE *filename); 6 | //Create and open new wav file 7 | FILE *wav_open(char *filename); 8 | 9 | #endif 10 | -------------------------------------------------------------------------------- /img-table/img-table.pro: -------------------------------------------------------------------------------- 1 | TARGET = img-table 2 | INCLUDEPATH += ../image 3 | INCLUDEPATH += ../aptcode 4 | LIBS += -L../image -limage 5 | LIBS += -L../aptcode -laptcode 6 | 7 | CONFIG += console 8 | CONFIG -= app_bundle 9 | CONFIG -= qt 10 | 11 | SOURCES += \ 12 | img.c 13 | 14 | -------------------------------------------------------------------------------- /apt-colorm/apt-colorm.pro: -------------------------------------------------------------------------------- 1 | TARGET = apt-colorm 2 | INCLUDEPATH += ../image 3 | INCLUDEPATH += ../aptcode 4 | LIBS += -L../image -limage 5 | LIBS += -L../aptcode -laptcode 6 | 7 | CONFIG += console 8 | CONFIG -= app_bundle 9 | CONFIG -= qt 10 | 11 | SOURCES += \ 12 | apt-colorm.c 13 | 14 | -------------------------------------------------------------------------------- /apt-encoder.pro: -------------------------------------------------------------------------------- 1 | TEMPLATE = subdirs 2 | SUBDIRS = image apt-encoder apt-colorm img-table aptcode 3 | 4 | image.subdir = image 5 | apt-encoder.subdir = apt-encoder 6 | apt-colorm.subdir = apt-colorm 7 | img-table.subdir = img-table 8 | aptcode.subdir = aptcode 9 | 10 | apt-encoder.depends = image aptcode 11 | apt-colorm.depends = image aptcode 12 | img-table.depends = image aptcode 13 | image.depends = aptcode 14 | -------------------------------------------------------------------------------- /apt-encoder/apt-encoder.pro: -------------------------------------------------------------------------------- 1 | TARGET = apt-encoder 2 | INCLUDEPATH += ../image 3 | INCLUDEPATH += ../aptcode 4 | LIBS += -L../image -limage 5 | LIBS += -L../aptcode -laptcode 6 | LIBS += -lpthread -lm -lreadline -ltermcap 7 | 8 | CONFIG += console 9 | CONFIG -= app_bundle 10 | CONFIG -= qt 11 | 12 | SOURCES += \ 13 | main.c \ 14 | audioset.c \ 15 | wavwrite.c 16 | 17 | HEADERS += \ 18 | main.h \ 19 | audioset.h \ 20 | wavwrite.h 21 | -------------------------------------------------------------------------------- /apt-encoder/audioset.c: -------------------------------------------------------------------------------- 1 | #include "main.h" 2 | #include "audioset.h" 3 | 4 | int InitAudioDevice(char *device) { 5 | //Open Sound Device 6 | if(!strncmp(device,_APT_AUDIO_STDOUT,sizeof(_APT_AUDIO_STDOUT))) { 7 | return 1; 8 | } 9 | else { 10 | int fd = open(device, O_WRONLY); 11 | char msg[512]; 12 | if(fd < 0) { 13 | snprintf(msg,sizeof(msg),"Open of %s failed",device); 14 | perror(msg); 15 | return fd; 16 | } 17 | 18 | //Configure Sound Device 19 | ioset(SOUND_PCM_WRITE_BITS, WF_SAMPLEBITS); 20 | ioset(SOUND_PCM_WRITE_CHANNELS, WF_CHANNELS); 21 | ioset(SOUND_PCM_WRITE_RATE, WF_SAMPLE_RATE); 22 | 23 | return fd; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /apt-encoder/audioset.h: -------------------------------------------------------------------------------- 1 | #ifndef NA_AUDIO_SETUP_H_ 2 | #define NA_AUDIO_SETUP_H_ 3 | 4 | //Math 5 | #define WF_TPI 6.283185307 6 | //Device Parameters 7 | #define WF_SAMPLE_RATE 24000 //24khz 8 | #define WF_CHANNELS 1 //mono 9 | #define WF_SAMPLEBITS 16 //16bits 10 | #define WF_BUFFER_DIV 2 //buffer divider 11 | 12 | //Set Device Parameter with error checking 13 | #define ioset(field, argument)\ 14 | {\ 15 | int arg = argument;\ 16 | if(ioctl(fd, field, &arg)<0)\ 17 | perror(#field "ioctl failed");\ 18 | else if(arg!=argument)\ 19 | perror(#argument "was not set in ioctl");\ 20 | } 21 | 22 | int16_t audio_buffer[WF_SAMPLE_RATE/WF_BUFFER_DIV]; 23 | 24 | int InitAudioDevice(char *device); 25 | /* 26 | // else\ 27 | // printf(#argument "\t:= %d\n", arg);\ 28 | */ 29 | #endif 30 | -------------------------------------------------------------------------------- /apt-encoder/main.h: -------------------------------------------------------------------------------- 1 | #ifndef NA_MAIN_H_ 2 | #define NA_MAIN_H_ 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | 20 | #define _APT_FILE_NO_SET "σame" 21 | #define _APT_AUDIO_DEVICE "/dev/dsp" 22 | #define _APT_AUDIO_STDOUT "io://stdout/" 23 | #define _APT_AUDIO_STDIN "io://stdin/" 24 | 25 | typedef struct { 26 | char *device; // Audio device 27 | char filename[1024]; // First image 28 | char secondfile[1024];// Second image 29 | uint8_t loop; // Images loop 30 | uint8_t console; // User console 31 | uint8_t datab; // First image data channel B mode 32 | uint8_t isfile; // Write to WAV file 33 | uint8_t chdev; // Custom audio device 34 | uint8_t usestdin; // Read image data from STDIN 35 | uint8_t usestdout; // Write audio to STDOUT 36 | uint8_t multistdin; // Multi mode on STDIN 37 | }AptOptSettings; 38 | 39 | typedef struct { 40 | int device; 41 | FILE *file; 42 | }AptAudioSettings; 43 | 44 | void *SoundThread(void *vargp); //Audio thread 45 | int AudioDevice; //audio device descriptor 46 | // Print help and usage of application 47 | void Usage(char *p_name); 48 | // Close image 49 | void CloseImageFile(FILE *reg, FILE *alt); 50 | // Clear Readline console 51 | void ClearConsole(); 52 | // Signal handler 53 | void SignalHandler(int number); 54 | // DEBUG !!! 55 | FILE *logfile; 56 | 57 | #endif 58 | -------------------------------------------------------------------------------- /apt-encoder/wavwrite.c: -------------------------------------------------------------------------------- 1 | #include "main.h" 2 | #include "image.h" 3 | #include "audioset.h" 4 | #include "wavwrite.h" 5 | 6 | unsigned int wav_head(double tdur, unsigned int fs, unsigned int bits, FILE *filename){ 7 | unsigned int numsa = (unsigned int)(tdur*fs); // overall number of samples 8 | unsigned int subchunk2 = (numsa * WF_CHANNELS * bits)/8; // 9 | unsigned int blockAlign = (WF_CHANNELS*bits)/8; //block size 10 | unsigned int byteRate = (fs * WF_CHANNELS * bits)/8; //byte rate per sample 11 | // chunk id RIFF 12 | fwrite("RIFF", 4, 1, filename); 13 | // chunk size 14 | fwrite_int(36 + subchunk2, 4, filename); 15 | // spec. RIFF form for WAV 16 | fwrite("WAVE", 4, 1, filename); 17 | // subchunk1 id format description 18 | fwrite("fmt ", 4, 1, filename); 19 | // subchunk1 size: 16 for PCM 20 | fwrite_int(16, 4, filename); 21 | // audio_format: 1 = PCM 22 | fwrite_int(1, 2, filename); 23 | // channels: mono 24 | fwrite_int(WF_CHANNELS, 2, filename); 25 | // sample rate 26 | fwrite_int(fs, 4, filename); 27 | // byte rate 28 | fwrite_int(byteRate, 4, filename); 29 | // block align, byte rate 30 | fwrite_int(blockAlign, 2, filename); 31 | // bits per sample, 16 bits 32 | fwrite_int(bits, 2, filename); 33 | // subchunk2 id data content 34 | fwrite("data", 4, 1, filename); 35 | // subchunk2 size 36 | fwrite_int(subchunk2, 4, filename); 37 | return numsa; 38 | } 39 | 40 | FILE *wav_open(char *filename) { 41 | char msg[255]; 42 | FILE *result; 43 | if((result = fopen(filename, "wb")) == NULL){ 44 | strcpy(msg, "Error opening "); 45 | strcat(msg, filename); 46 | perror(msg); 47 | return NULL; 48 | } 49 | return result; 50 | } 51 | 52 | -------------------------------------------------------------------------------- /image/image.h: -------------------------------------------------------------------------------- 1 | #ifndef NA_IMAGE_R_H_ 2 | #define NA_IMAGE_R_H_ 3 | 4 | #include "imgtable.h" 5 | #include "imgtable_apt.h" 6 | #define IMG_TGA_HEAD_SIZE 18 7 | 8 | typedef struct { 9 | uint8_t IDLength; 10 | uint8_t ColorMapType; 11 | uint8_t ImageType; 12 | uint16_t CMapStart; 13 | uint16_t CMapLength; 14 | uint8_t CMapDepth; 15 | uint16_t XOffset; 16 | uint16_t YOffset; 17 | uint16_t Width; 18 | uint16_t Height; 19 | uint8_t PixelDepth; 20 | uint8_t ImageDescriptor; 21 | FILE *File; 22 | }TgaImageHead; 23 | 24 | typedef struct { 25 | uint8_t r; 26 | uint8_t g; 27 | uint8_t b; 28 | }RgbColor; 29 | 30 | typedef struct { 31 | uint8_t h; 32 | uint8_t s; 33 | uint8_t v; 34 | }HsvColor; 35 | 36 | typedef struct { 37 | uint8_t h; // Hue 38 | uint8_t sv; // Reduced saturation and value 39 | }AptColor; 40 | 41 | //Write test image 42 | int TestTGAImage(FILE *fp); 43 | //Write one 24 bit pixel 44 | int WriteTGAPixel(uint8_t R, uint8_t G, uint8_t B, FILE *fp); 45 | //Read one 24bit pixel 46 | unsigned int ReadTGAPixel(FILE *fp); 47 | //Get colours from pixel 48 | uint8_t GetRedSubPixel(unsigned int pixel); 49 | uint8_t GetGreenSubPixel(unsigned int pixel); 50 | uint8_t GetBlueSubPixel(unsigned int pixel); 51 | //Write integer, little endian 52 | int fwrite_int(int val, char len, FILE *p); 53 | //Read integer, little endian 54 | unsigned int fread_int(char len, FILE *p); 55 | //Open image for transmit 56 | TgaImageHead OpenTgaImage(char *filename); 57 | //Write transmitted image 58 | TgaImageHead WriteTgaImage(char *filename, TgaImageHead WriteImage); 59 | //Convert RGB to HSV color space 60 | HsvColor RgbToHsv(RgbColor rgb); 61 | //Convert HSV to RGB color space 62 | RgbColor HsvToRgb(HsvColor hsv); 63 | //Convert HSV to APT color space 64 | AptColor HsvToApt(HsvColor hsv, uint8_t bits); 65 | //Convert APT to HSV color space 66 | HsvColor AptToHsv(AptColor apt, uint8_t bits); 67 | AptColor RgbToApt(RgbColor rgb); 68 | RgbColor AptToRgb(AptColor apt); 69 | #endif 70 | -------------------------------------------------------------------------------- /apt-colorm/apt-colorm.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include "image.h" 9 | #include "aptcode.h" 10 | 11 | #define _APT_FILE_NO_SET "σame" 12 | 13 | void Usage(char *p_name); 14 | 15 | int main(int argc, char *argv[]) { 16 | if(argc == 1){ 17 | Usage(argv[0]); 18 | return 0; 19 | } 20 | char channel_a[1024]=_APT_FILE_NO_SET; 21 | char channel_b[1024]=_APT_FILE_NO_SET; 22 | char output[1024]=_APT_FILE_NO_SET; 23 | int opt = 0; 24 | while ((opt = getopt(argc, argv, "a:b:o:h")) != -1){ 25 | switch (opt) { 26 | case 'h': //Help 27 | Usage(argv[0]); 28 | return 0; 29 | break; 30 | case 'a': //Channel A TGA image 31 | strncpy(channel_a,optarg,sizeof(channel_a)-1); 32 | break; 33 | case 'b': //Channel B TGA image 34 | strncpy(channel_b,optarg,sizeof(channel_b)-1); 35 | break; 36 | case 'o': //Output TGA image 37 | strncpy(output,optarg,sizeof(output)-1); 38 | break; 39 | default: 40 | Usage(argv[0]); 41 | return 0; 42 | } 43 | } 44 | if(strncmp(channel_a,_APT_FILE_NO_SET,4) == 0) { 45 | printf("%s: required argument and option -- '-a '\n",argv[0]); 46 | exit(2); 47 | } 48 | if(strncmp(channel_b,_APT_FILE_NO_SET,4) == 0) { 49 | printf("%s: required argument and option -- '-b '\n",argv[0]); 50 | exit(2); 51 | } 52 | if(strncmp(output,_APT_FILE_NO_SET,4) == 0) { 53 | printf("%s: required argument and option -- '-o '\n",argv[0]); 54 | exit(2); 55 | } 56 | TgaImageHead ChannelA, ChannelB, OutputColor; 57 | ChannelA = OpenTgaImage(channel_a); 58 | ChannelB = OpenTgaImage(channel_b); 59 | OutputColor = ChannelA; 60 | OutputColor = WriteTgaImage(output, OutputColor); 61 | if(ChannelA.File == NULL) { // On error 62 | exit(1); 63 | } 64 | if(ChannelB.File == NULL) { // On error 65 | exit(1); 66 | } 67 | if(OutputColor.File == NULL) { // On error 68 | exit(1); 69 | } 70 | 71 | int i,j; 72 | unsigned int pix_a; 73 | unsigned int pix_b; 74 | HsvColor hsvc; 75 | AptColor aptc; 76 | RgbColor rgbc; 77 | // 24 bit RGB, but in grayscale expected 78 | for(i=0;i -b -o -h\n",p_name); 99 | printf(" -a Input channel A TGA image (909px width, 24bit RGB)\n"); 100 | printf(" -b Input channel B TGA image (909px width, 24bit RGB)\n"); 101 | printf(" -o Output color TGA image \n"); 102 | printf(" -h Show this help\n"); 103 | printf(" Build: %s %s, GCC %s\n", __TIME__, __DATE__, __VERSION__); 104 | } 105 | 106 | -------------------------------------------------------------------------------- /aptcode/aptcode.h: -------------------------------------------------------------------------------- 1 | #ifndef NOAA_APT_GEN_H_ 2 | #define NOAA_APT_GEN_H_ 3 | #include "image.h" 4 | // A channel 5 | #define APT_SYNC_A 39 6 | #define APT_MARKER_A 47 7 | #define APT_TELEMETRY_A 45 8 | #define APT_VIDEO_A 909 9 | // B channel 10 | #define APT_SYNC_B 39 11 | #define APT_MARKER_B 47 12 | #define APT_TELEMETRY_B 45 13 | #define APT_VIDEO_B 909 14 | // Common 15 | #define APT_CARRIER_F 2400 16 | #define APT_SYNC_LOW 11 17 | #define APT_SYNC_HIGH 244 18 | #define APT_WORD_LEN 1/4160 19 | // SampleRate * AptWordLen ~ 5.769230769 = 75/13 20 | #define APT_WORD_MUL 5.7696 21 | #define APT_MARKER_LOW 0 22 | #define APT_MARKER_HIGH 255 23 | #define APT_LINE_SIZE 2080 24 | #define APT_FRAME_SIZE 128 25 | #define APT_MARKER_SIZE 120 26 | 27 | typedef struct { 28 | uint8_t Wedge1; 29 | uint8_t Wedge2; 30 | uint8_t Wedge3; 31 | uint8_t Wedge4; 32 | uint8_t Wedge5; 33 | uint8_t Wedge6; 34 | uint8_t Wedge7; 35 | uint8_t Wedge8; 36 | uint8_t ZeroModRef; 37 | uint8_t Temp1; 38 | uint8_t Temp2; 39 | uint8_t Temp3; 40 | uint8_t Temp4; 41 | uint8_t PatchTemp; 42 | uint8_t BackScan; 43 | uint8_t ChannelID; 44 | }AptTelemetry; 45 | 46 | typedef struct { 47 | uint8_t SyncA[APT_SYNC_A]; 48 | uint8_t MarkerA[APT_MARKER_A]; 49 | uint8_t VideoA[APT_VIDEO_A]; 50 | uint8_t TelemetryA[APT_TELEMETRY_A]; 51 | uint8_t SyncB[APT_SYNC_B]; 52 | uint8_t MarkerB[APT_MARKER_B]; 53 | uint8_t VideoB[APT_VIDEO_B]; 54 | uint8_t TelemetryB[APT_TELEMETRY_B]; 55 | }AptLine; 56 | 57 | enum AptTelemetryData { 58 | APT_TEL_WEDGE1 = 31, // Calibration values 59 | APT_TEL_WEDGE2 = 63, // 60 | APT_TEL_WEDGE3 = 95, // 61 | APT_TEL_WEDGE4 = 127, // 62 | APT_TEL_WEDGE5 = 159, // 63 | APT_TEL_WEDGE6 = 191, // 64 | APT_TEL_WEDGE7 = 223, // 65 | APT_TEL_WEDGE8 = 255, // 66 | APT_TEL_ZEROMODREF = 0, // End calibration 67 | APT_TEL_TEMP1 = 105, // Black body temperatures 68 | APT_TEL_TEMP2 = 105, // 69 | APT_TEL_TEMP3 = 105, // 70 | APT_TEL_TEMP4 = 105, // End temperatures 71 | APT_TEL_PATCHTEMP = 120, // 105 Kelvin 72 | APT_TEL_BACKSCAN = 150, // IR CH 3,4,5 73 | APT_TEL_CHANNELID = 31 // Channel 1 74 | }; 75 | 76 | #define APT_CHANNELID_1 APT_TEL_WEDGE1 // Visible, 0.58 – 0.68 μm 77 | #define APT_CHANNELID_2 APT_TEL_WEDGE2 // Near Infrared, 0.325 – 1.10 μm 78 | #define APT_CHANNELID_3A APT_TEL_WEDGE3 // Thermal Infrared, 1.58 – 1.64 μm 79 | #define APT_CHANNELID_3B APT_TEL_WEDGE6 // Thermal Infrared, 3.55 – 3.93 μm 80 | #define APT_CHANNELID_4 APT_TEL_WEDGE4 // Thermal Infrared, 10.30 – 11.30 μm 81 | #define APT_CHANNELID_5 APT_TEL_WEDGE5 // Thermal Infrared, 11.50 – 12.50 μm 82 | 83 | typedef struct { 84 | uint8_t Value[APT_LINE_SIZE]; 85 | }AptLineAr; 86 | // Single or multi image set 87 | uint8_t AptImageSet; 88 | //Generate A channel sync pulses 89 | uint8_t AptSyncA(uint8_t word); 90 | //Generate B channel sync pulses 91 | uint8_t AptSyncB(uint8_t word); 92 | //Marker A channel 93 | uint8_t AptMarkerA(uint8_t word, uint8_t minute); 94 | //Marker B channel 95 | uint8_t AptMarkerB(uint8_t word, uint8_t minute); 96 | //Create one line of apt, frame is number in 0 to 127, Seperate telemetry info for each channel 97 | AptLine CreateAptLine(uint8_t frame, uint8_t currentline, AptTelemetry ChanA, AptTelemetry ChanB, FILE *image, FILE *secimage, uint8_t DataB); 98 | //Concat AptLine to AptLineAr 99 | AptLineAr ConcatAptLine(AptLine Apt); 100 | //Load one image line 101 | AptLineAr AptTransImageLine(uint8_t frame, uint8_t currentline, TgaImageHead firstHead, TgaImageHead secHead, AptTelemetry telemA, AptTelemetry telemB, uint8_t DataB); 102 | //Create telemetry frame 103 | AptTelemetry CreateTelemetry(uint8_t temp1, uint8_t temp2, uint8_t temp3, uint8_t temp4, uint8_t backscan, uint8_t channel); 104 | #endif 105 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | NOAA APT encoder 2 | ================== 3 | 4 | Load TGA image (24bit, RGB) and encode it to APT (Automatic Picture Transmission) signal. 5 | 6 | Information and description: 7 | * https://www.sigidwiki.com/wiki/Automatic_Picture_Transmission_%28APT%29 8 | * https://noaasis.noaa.gov/NOAASIS/pubs/Users_Guide-Building_Receive_Stations_March_2009.pdf 9 | 10 | 11 | ``` 12 | NOAA automatic picture transmission (APT) encoder 13 | Usage: Debug/noaa_apt (-i [-s ] | -I) [(-d | -O) -m -lcrM] 14 | -i Input TGA image (909px width, 24bit RGB) 15 | -s Second input TGA image (B channel, mode ignored) 16 | -d OSS audio device (default /dev/dsp) or file 17 | -m Channel B data mode (R,G,B,N,Y,C) 18 | -I Read image data from stdin 19 | -O Write audio data to stdout 20 | -M Multi image reading from stdin 21 | -l Enable infinite image loop 22 | -c Enable user console 23 | -r Device is regular file (write WAV audio file) 24 | -h Show this help 25 | Build: 21:52:59 Aug 18 2019, GCC 5.3.0 26 | ``` 27 | 28 | * Transmit one image and exit: ```guest@porteus:~$ padsp ./apt-encoder -i SourceTestImage.tga``` 29 | * Single mode with loop and console: ```guest@porteus:~$ padsp ./apt-encoder -lci SourceTestImage.tga``` 30 | * Multi mode with loop and console: ```guest@porteus:~$ padsp ./apt-encoder -lci SourceTestImage.tga -s 139.tga``` 31 | * Write WAV audio file using color mode: ```guest@porteus:~$ ./apt-encoder -i SourceTestImage.tga -m C -rd audio.wav``` 32 | * Read from stdin and write to stdout: ```guest@porteus:~$ cat SourceTestImage.tga | ./apt-encoder -OI | aplay -r 24000 -f S16_LE``` 33 | * Transmit some noise: ```guest@porteus:~$ cat /dev/urandom | ./apt-encoder -OIM | aplay -r 24000 -f S16_LE``` 34 | * Run as: ```guest@porteus:~$ padsp noaa_apt -lci SourceTestImage.tga``` 35 | * Showing all modes (without C): 36 | Sync only -> Negative -> Red -> Green -> Blue -> Y -> Negative -> Red -> Green -> Blue -> Y (reload image) -> Negative -> Sync only -> Blue 37 | 38 | 39 | 40 | 41 | 42 |
Source image
Decoded image
Source audio Sample
43 | 44 | ### Special mode C - color 45 | 46 | Mode use 12bit (4096 colors, square root of 4096 is 64) look up table. Each color have 4 bit resolution (16 values). Channel A contain Y-pos values and channel B contain X-pos values (position in LUT). Image quality depends on LUT (color position in table). Current LUT is not ideal. Only X-pos is good. For decoding use apt-colorm and for better image quality disable gamma correction in WxToImg. 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 |
Look up table (64x64, upscaled 4x)
Original image
Channel A image
Channel B image
Decoded color image
55 | 56 | ### TODO 57 | 58 | * Add support to ALSA/Portaudio 59 | 60 | ### APT 61 | 62 | APT means Automatic Picture Transmission. It is a system, developed in the 1960s, made to transmit low-resolution analog image for weather satellites. A complete APT image takes around 12 minutes to be built up at a rate of 2 lines per second. The data is broadcasted by the satellite. The stream is obtained by the AVHRR/3 instrument. Two channels with a low resolution are emitting all the time using VHF signals at reduced rates (around 120 lines/minutes). 63 | The two channels are composed of : 64 | * Channel A: A visible frequency range channel providing APT imagery during the day. 65 | * Channel B: An IR channel providing APT imagery at any time of the day and the night. 66 | 67 | #### APT Frame format: 68 | 69 | The broadcasted transmission is made of two channels for the image, synchronization and telemetry information. A complete APT Video Line Time is 2080 pixels long (990 pixels for each image). One APT line is composed of one line for Channel A video followed by one line for Channel B video. 70 |
71 | 72 | * Telemetry frame: 73 | Each video channel A and B have their own telemetry frame 74 | Each telemetry frames consists of 16 points (wedges): height of 128 video lines 75 | Telemetry frame rate is 1 frame per 64 seconds 76 | Each telemetry point is repeated on 8 successive APT lines 77 | 78 | * Space and minute marker: 79 | Time between two successive markers is one minute 80 | Minute markers are repeated on 4 successive lines, with 2 lines black and 2 lines white 81 | B video is always an IR channel (Ch. 4 usually), so spaces are white and minute markers black 82 | When A Video is a visible channel, spaces are black and minute markers white; otherwise it appears like B video 83 |
84 | 85 | 86 | 87 | _APT frame_
88 | 89 | #### APT Modulations 90 | 91 | The systems uses Amplitude Modulation and Frequency Modulation. Each 8-bit word of APT data (256 levels) is then amplitude modulated with a 2.4kHz sub-carrier which results in an analog signal with a 34kHz bandwidth. This signal is frequency modulated such that one amplitude corresponds to one frequency on a 137-138Mhz carrier (depending on the satellite). 92 | 93 | 94 | 95 | _APT Synchronization_
96 | 97 | * Sync A precedes Channel A data. Is a 1040 Hz square wave - 7 cycles 98 | * Sync B precedes Channel B data. Is an 832 pps pulse train - 7 pulses 99 | 100 | #### APT Video line format 101 | 102 | 103 | 104 | _APT Video Format_
105 | 106 | 107 | 108 | -------------------------------------------------------------------------------- /aptcode/aptcode.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include "aptcode.h" 8 | 9 | uint8_t AptSyncA(uint8_t word) { 10 | //word in range 0 to 38 , total 39 values 11 | if((word==4) || (word==5) || (word==8) || (word==9) || (word==12) || (word==13) || (word==16)) { 12 | return APT_SYNC_HIGH; 13 | } 14 | else if((word==17) || (word==20) || (word==21) || (word==24) || (word==25) || (word==28) || (word==29)) { 15 | return APT_SYNC_HIGH; 16 | } 17 | else { 18 | return APT_SYNC_LOW; 19 | } 20 | } 21 | 22 | uint8_t AptSyncB(uint8_t word) { 23 | //word in range 0 to 38 , total 39 values 24 | if((word==4) || (word==5) || (word==6) || (word==9) || (word==10) || (word==11) || (word==14)) { 25 | return APT_SYNC_HIGH; 26 | } 27 | else if((word==15) || (word==16) || (word==19) || (word==20) || (word==21) || (word==24) || (word==25)) { 28 | return APT_SYNC_HIGH; 29 | } 30 | else if((word==26) || (word==29) || (word==30) || (word==31) || (word==34) || (word==35) || (word==36)) { 31 | return APT_SYNC_HIGH; 32 | } 33 | else { 34 | return APT_SYNC_LOW; 35 | } 36 | } 37 | 38 | uint8_t AptMarkerA(uint8_t word, uint8_t minute) { 39 | //word in range 0 to 46 , total 47 values 40 | //minute is O no mark, 1 mark 41 | if(minute==1) { 42 | return APT_MARKER_HIGH; 43 | } 44 | else { 45 | return APT_MARKER_LOW; 46 | } 47 | } 48 | 49 | uint8_t AptMarkerB(uint8_t word, uint8_t minute) { 50 | //word in range 0 to 46 , total 47 values 51 | //minute is O no mark, 1 mark 52 | if(minute==1) { 53 | return APT_MARKER_LOW; 54 | } 55 | else { 56 | return APT_MARKER_HIGH; 57 | } 58 | } 59 | 60 | AptLine CreateAptLine(uint8_t frame, uint8_t currentline, AptTelemetry ChanA, AptTelemetry ChanB, FILE *image, FILE *secimage, uint8_t DataB) { 61 | //frame, number in range 1 to 128, current line in frame 62 | //currentline, number in range 1 to 120 63 | //image is pointer to file, transmitted image 64 | //ChanA and ChanB are telemetry data 65 | AptLine NewLine; 66 | uint8_t minute; 67 | uint8_t telemetryA=0; 68 | uint8_t telemetryB=0; 69 | uint8_t i; 70 | uint16_t j; 71 | uint8_t Rval = 0; 72 | uint8_t Gval = 0; 73 | uint8_t Bval = 0; 74 | RgbColor pixel_r; 75 | AptColor pixel_a; 76 | unsigned int pix; 77 | // Sync A and Sync B 78 | for(i=0;i 0) && (frame <= 8)) { 165 | telemetryA = ChanA.Wedge1; 166 | telemetryB = ChanB.Wedge1; 167 | } 168 | else if((frame > 8) && (frame <= 16)) { 169 | telemetryA = ChanA.Wedge2; 170 | telemetryB = ChanB.Wedge2; 171 | } 172 | else if((frame > 16) && (frame <= 24)) { 173 | telemetryA = ChanA.Wedge3; 174 | telemetryB = ChanB.Wedge3; 175 | } 176 | else if((frame > 24) && (frame <= 32)) { 177 | telemetryA = ChanA.Wedge4; 178 | telemetryB = ChanB.Wedge4; 179 | } 180 | else if((frame > 32) && (frame <= 40)) { 181 | telemetryA = ChanA.Wedge5; 182 | telemetryB = ChanB.Wedge5; 183 | } 184 | else if((frame > 40) && (frame <= 48)) { 185 | telemetryA = ChanA.Wedge6; 186 | telemetryB = ChanB.Wedge6; 187 | } 188 | else if((frame > 48) && (frame <= 56)) { 189 | telemetryA = ChanA.Wedge7; 190 | telemetryB = ChanB.Wedge7; 191 | } 192 | else if((frame > 56) && (frame <= 64)) { 193 | telemetryA = ChanA.Wedge8; 194 | telemetryB = ChanB.Wedge8; 195 | } 196 | else if((frame > 64) && (frame <= 72)) { 197 | telemetryA = ChanA.ZeroModRef; 198 | telemetryB = ChanB.ZeroModRef; 199 | } 200 | else if((frame > 72) && (frame <= 80)) { 201 | telemetryA = ChanA.Temp1; 202 | telemetryB = ChanB.Temp1; 203 | } 204 | else if((frame > 80) && (frame <= 88)) { 205 | telemetryA = ChanA.Temp2; 206 | telemetryB = ChanB.Temp2; 207 | } 208 | else if((frame > 88) && (frame <= 96)) { 209 | telemetryA = ChanA.Temp3; 210 | telemetryB = ChanB.Temp3; 211 | } 212 | else if((frame > 96) && (frame <= 104)) { 213 | telemetryA = ChanA.Temp4; 214 | telemetryB = ChanB.Temp4; 215 | } 216 | else if((frame > 104) && (frame <= 112)) { 217 | telemetryA = ChanA.PatchTemp; 218 | telemetryB = ChanB.PatchTemp; 219 | } 220 | else if((frame > 112) && (frame <= 120)) { 221 | telemetryA = ChanA.BackScan; 222 | telemetryB = ChanB.BackScan; 223 | } 224 | else if((frame > 120) && (frame <= 128)) { 225 | telemetryA = ChanA.ChannelID; 226 | telemetryB = ChanB.ChannelID; 227 | } 228 | for(i=0;i 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include "image.h" 10 | #include "aptcode.h" 11 | 12 | int TestTGAImage(FILE *fp){ 13 | TgaImageHead TgaHead; 14 | // 24 bpp, true color without alfa 15 | TgaHead.IDLength = 0x00; //no ID array 16 | TgaHead.ColorMapType = 0x00; //no palete 17 | TgaHead.ImageType = 0x02; //true color 18 | TgaHead.CMapStart = 0x0000; //zero 19 | TgaHead.CMapLength = 0x0000; //zero 20 | TgaHead.CMapDepth = 0x00; //zero 21 | TgaHead.XOffset = 0x0000; //zero 22 | TgaHead.YOffset = 0x0000; //zero 23 | TgaHead.Width = 0x0100; //256 pixels 24 | TgaHead.Height = 0x0100; //256 pixels 25 | TgaHead.PixelDepth = 0x18; // 24 bits per pixel 26 | TgaHead.ImageDescriptor = 0x20; //up to down 27 | //write header 28 | fwrite_int(TgaHead.IDLength,1,fp); 29 | fwrite_int(TgaHead.ColorMapType,1,fp); 30 | fwrite_int(TgaHead.ImageType,1,fp); 31 | fwrite_int(TgaHead.CMapStart,2,fp); 32 | fwrite_int(TgaHead.CMapLength,2,fp); 33 | fwrite_int(TgaHead.CMapDepth,1,fp); 34 | fwrite_int(TgaHead.XOffset,2,fp); 35 | fwrite_int(TgaHead.YOffset,2,fp); 36 | fwrite_int(TgaHead.Width,2,fp); 37 | fwrite_int(TgaHead.Height,2,fp); 38 | fwrite_int(TgaHead.PixelDepth,1,fp); 39 | fwrite_int(TgaHead.ImageDescriptor,1,fp); 40 | // Test image 41 | int i,j; 42 | for(i=0;i<256;i++) { 43 | for(j=0;j<256;j++) { 44 | WriteTGAPixel(i, i, j, fp); 45 | } 46 | } 47 | return 0; 48 | } 49 | 50 | int WriteTGAPixel(uint8_t R, uint8_t G, uint8_t B, FILE *fp){ 51 | uint32_t RR = R << 16; //8 bit 52 | uint32_t GG = G << 8; //8 bit 53 | uint32_t BB = B; //8 bit 54 | uint32_t data = BB + GG + RR; 55 | return fwrite_int(data,3,fp); 56 | } 57 | 58 | unsigned int ReadTGAPixel(FILE *fp){ 59 | return fread_int(3,fp); 60 | } 61 | 62 | uint8_t GetRedSubPixel(unsigned int pixel) { 63 | unsigned int pix = pixel & 0x00FF0000; 64 | return pix >> 16; 65 | } 66 | 67 | uint8_t GetGreenSubPixel(unsigned int pixel) { 68 | unsigned int pix = pixel & 0x0000FF00; 69 | return pix >> 8; 70 | } 71 | 72 | uint8_t GetBlueSubPixel(unsigned int pixel) { 73 | unsigned int pix = pixel & 0x000000FF; 74 | return pix >> 0; 75 | } 76 | 77 | int fwrite_int(int val, char len, FILE *p){ 78 | unsigned int byte; 79 | while (len-- > 0) { 80 | byte = val & 0xFF; 81 | fwrite(&byte, 1, 1, p); 82 | val >>= 8; 83 | } 84 | return 0; 85 | } 86 | 87 | unsigned int fread_int(char len, FILE *p){ 88 | unsigned int byte=0; 89 | unsigned int val=0; 90 | unsigned int pc=0; 91 | while (len-- > 0) { 92 | fread(&byte, 1, 1, p); 93 | val = val + (byte << 8*pc); 94 | pc++; 95 | } 96 | return val; 97 | } 98 | 99 | TgaImageHead OpenTgaImage(char *filename) { 100 | FILE *filein=NULL; 101 | char msg[255]; 102 | TgaImageHead TgaImage = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL}; 103 | if((filein = fopen(filename, "rb")) == NULL){ 104 | strcpy(msg, "Error opening "); 105 | strcat(msg, filename); 106 | perror(msg); 107 | return TgaImage; 108 | } 109 | // read header 110 | TgaImage.IDLength = fread_int(1,filein); 111 | TgaImage.ColorMapType = fread_int(1,filein); 112 | TgaImage.ImageType = fread_int(1,filein); 113 | TgaImage.CMapStart = fread_int(2,filein); 114 | TgaImage.CMapLength = fread_int(2,filein); 115 | TgaImage.CMapDepth = fread_int(1,filein); 116 | TgaImage.XOffset = fread_int(2,filein); 117 | TgaImage.YOffset = fread_int(2,filein); 118 | TgaImage.Width = fread_int(2,filein); 119 | TgaImage.Height = fread_int(2,filein); 120 | TgaImage.PixelDepth = fread_int(1,filein); 121 | TgaImage.ImageDescriptor = fread_int(1,filein); 122 | if (TgaImage.Width != APT_VIDEO_A) { 123 | printf("%s : Image width is %d px\n",filename,TgaImage.Width); 124 | printf("Only %d px width images are supported\n",APT_VIDEO_A); 125 | fclose(filein); 126 | return TgaImage; 127 | } 128 | TgaImage.File = filein; 129 | //printf("X: %d, Y:%d Z: %d\n",TgaImage.Width,TgaImage.Height,TgaImage.PixelDepth); 130 | return TgaImage; //now ready to read image data 131 | } 132 | 133 | TgaImageHead WriteTgaImage(char *filename, TgaImageHead WriteImage) { 134 | FILE *fileout=NULL; 135 | char msg[255]; 136 | WriteImage.File = NULL; 137 | if((fileout = fopen(filename, "wb")) == NULL){ 138 | strcpy(msg, "Error opening "); 139 | strcat(msg, filename); 140 | perror(msg); 141 | return WriteImage; 142 | } 143 | WriteImage.File = fileout; 144 | fwrite_int(WriteImage.IDLength,1,fileout); 145 | fwrite_int(WriteImage.ColorMapType,1,fileout); 146 | fwrite_int(WriteImage.ImageType,1,fileout); 147 | fwrite_int(WriteImage.CMapStart,2,fileout); 148 | fwrite_int(WriteImage.CMapLength,2,fileout); 149 | fwrite_int(WriteImage.CMapDepth,1,fileout); 150 | fwrite_int(WriteImage.XOffset,2,fileout); 151 | fwrite_int(WriteImage.YOffset,2,fileout); 152 | fwrite_int(WriteImage.Width,2,fileout); 153 | fwrite_int(WriteImage.Height,2,fileout); 154 | fwrite_int(WriteImage.PixelDepth,1,fileout); 155 | fwrite_int(WriteImage.ImageDescriptor,1,fileout); 156 | return WriteImage; //now ready to write image data 157 | } 158 | 159 | HsvColor RgbToHsv(RgbColor rgb) { 160 | HsvColor hsv; 161 | uint8_t rgbMin, rgbMax; 162 | // Get min/max 163 | rgbMin = rgb.r < rgb.g ? (rgb.r < rgb.b ? rgb.r : rgb.b) : (rgb.g < rgb.b ? rgb.g : rgb.b); 164 | rgbMax = rgb.r > rgb.g ? (rgb.r > rgb.b ? rgb.r : rgb.b) : (rgb.g > rgb.b ? rgb.g : rgb.b); 165 | // Value 166 | hsv.v = rgbMax; 167 | if (hsv.v == 0) { 168 | hsv.h = 0; 169 | hsv.s = 0; 170 | return hsv; 171 | } 172 | // Saturation 173 | hsv.s = 255 * (long)(rgbMax - rgbMin) / hsv.v; 174 | if (hsv.s == 0) { 175 | hsv.h = 0; 176 | return hsv; 177 | } 178 | // Hue 179 | if (rgbMax == rgb.r) { 180 | hsv.h = 0 + 43 * (rgb.g - rgb.b) / (rgbMax - rgbMin); 181 | } 182 | else if (rgbMax == rgb.g) { 183 | hsv.h = 85 + 43 * (rgb.b - rgb.r) / (rgbMax - rgbMin); 184 | } 185 | else { 186 | hsv.h = 171 + 43 * (rgb.r - rgb.g) / (rgbMax - rgbMin); 187 | } 188 | return hsv; 189 | } 190 | 191 | RgbColor HsvToRgb(HsvColor hsv) { 192 | RgbColor rgb; 193 | uint8_t region, remainder, p, q, t; 194 | // Grayscale 195 | if (hsv.s == 0) { 196 | rgb.r = hsv.v; 197 | rgb.g = hsv.v; 198 | rgb.b = hsv.v; 199 | return rgb; 200 | } 201 | // 60 degrees region 202 | region = hsv.h / 43; 203 | remainder = (hsv.h - (region * 43)) * 6; 204 | 205 | p = (hsv.v * (255 - hsv.s)) >> 8; 206 | q = (hsv.v * (255 - ((hsv.s * remainder) >> 8))) >> 8; 207 | t = (hsv.v * (255 - ((hsv.s * (255 - remainder)) >> 8))) >> 8; 208 | 209 | switch (region) { 210 | case 0: 211 | rgb.r = hsv.v; rgb.g = t; rgb.b = p; 212 | break; 213 | case 1: 214 | rgb.r = q; rgb.g = hsv.v; rgb.b = p; 215 | break; 216 | case 2: 217 | rgb.r = p; rgb.g = hsv.v; rgb.b = t; 218 | break; 219 | case 3: 220 | rgb.r = p; rgb.g = q; rgb.b = hsv.v; 221 | break; 222 | case 4: 223 | rgb.r = t; rgb.g = p; rgb.b = hsv.v; 224 | break; 225 | default: 226 | rgb.r = hsv.v; rgb.g = p; rgb.b = q; 227 | break; 228 | } 229 | 230 | return rgb; 231 | } 232 | 233 | AptColor HsvToApt(HsvColor hsv, uint8_t bits) { 234 | AptColor apt; 235 | apt.h = hsv.h; 236 | switch (bits) { 237 | case 0: 238 | apt.sv = (hsv.s & 0x00)+(hsv.v >> 0); 239 | break; 240 | case 1: 241 | apt.sv = (hsv.s & 0x80)+(hsv.v >> 1); 242 | break; 243 | case 2: 244 | apt.sv = (hsv.s & 0xC0)+(hsv.v >> 2); 245 | break; 246 | case 4: 247 | apt.sv = (hsv.s & 0xF0)+(hsv.v >> 4); 248 | break; 249 | case 5: 250 | apt.sv = (hsv.s & 0xF8)+(hsv.v >> 5); 251 | break; 252 | case 6: 253 | apt.sv = (hsv.s & 0xFC)+(hsv.v >> 6); 254 | break; 255 | case 7: 256 | apt.sv = (hsv.s & 0xFE)+(hsv.v >> 7); 257 | break; 258 | case 8: 259 | apt.sv = (hsv.s & 0xFF)+(hsv.v >> 8); 260 | break; 261 | case 3: 262 | default: 263 | apt.sv = (hsv.s & 0xE0)+(hsv.v >> 3); 264 | break; 265 | } 266 | 267 | return apt; 268 | } 269 | 270 | HsvColor AptToHsv(AptColor apt, uint8_t bits) { 271 | HsvColor hsv; 272 | hsv.h = apt.h; 273 | switch (bits) { 274 | case 0: 275 | hsv.s = (apt.sv & 0x00); 276 | hsv.v = (apt.sv & 0xFF) << 0; 277 | break; 278 | case 1: 279 | hsv.s = (apt.sv & 0x80); 280 | hsv.v = (apt.sv & 0x7F) << 1; 281 | break; 282 | case 2: 283 | hsv.s = (apt.sv & 0xC0); 284 | hsv.v = (apt.sv & 0x3F) << 2; 285 | break; 286 | case 4: 287 | hsv.s = (apt.sv & 0xF0); 288 | hsv.v = (apt.sv & 0x0F) << 4; 289 | break; 290 | case 5: 291 | hsv.s = (apt.sv & 0xF8); 292 | hsv.v = (apt.sv & 0x07) << 5; 293 | break; 294 | case 6: 295 | hsv.s = (apt.sv & 0xFC); 296 | hsv.v = (apt.sv & 0x03) << 6; 297 | break; 298 | case 7: 299 | hsv.s = (apt.sv & 0xFE); 300 | hsv.v = (apt.sv & 0x01) << 7; 301 | break; 302 | case 8: 303 | hsv.s = (apt.sv & 0xFF); 304 | hsv.v = (apt.sv & 0x00) << 8; 305 | break; 306 | case 3: 307 | default: 308 | hsv.s = (apt.sv & 0xE0); 309 | hsv.v = (apt.sv & 0x1F) << 3; 310 | break; 311 | } 312 | 313 | return hsv; 314 | } 315 | 316 | AptColor RgbToApt(RgbColor rgb) { 317 | AptColor apt; 318 | uint8_t R = (rgb.r >> 4) & 0xF; 319 | uint8_t G = (rgb.g >> 4) & 0xF; 320 | uint8_t B = (rgb.b >> 4) & 0xF; 321 | uint16_t val = (R << 8) + (G << 4) + B; 322 | uint16_t pos = LUTFromRgb[val]; 323 | uint16_t y_val = pos % 64; 324 | uint16_t x_val = (pos - y_val) / 64; 325 | apt.h = (x_val & 0x3F) * 4; 326 | apt.sv = (y_val & 0x3F) * 4; 327 | return apt; 328 | } 329 | 330 | RgbColor AptToRgb(AptColor apt) { 331 | RgbColor rgb; 332 | uint8_t x_val = (apt.h+2)/4; 333 | uint8_t y_val = (apt.sv+2)/4; 334 | if(x_val > 255) {x_val = 255;} 335 | if(y_val > 255) {y_val = 255;} 336 | uint16_t val = LUTFromApt[x_val][y_val]; 337 | uint8_t R = (val >> 8) & 0xF; 338 | uint8_t G = (val >> 4) & 0xF; 339 | uint8_t B = (val >> 0) & 0xF; 340 | rgb.r = R * 17; rgb.g = G * 17; rgb.b = B * 17; 341 | return rgb; 342 | } 343 | -------------------------------------------------------------------------------- /img-table/img.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include "image.h" 8 | #include "aptcode.h" 9 | #include "imgtable.h" 10 | #include "imgtable_apt.h" 11 | #include 12 | #define IMG_COL_STEP 4.2666666 13 | #define IMG_COL_STEP_42 6.071428 14 | #define IMG_COL_STEP_43 5.930232 15 | 16 | typedef struct { 17 | uint8_t x[16]; 18 | uint8_t y[16]; 19 | }ColorMap; 20 | 21 | typedef struct { 22 | uint8_t x[16]; 23 | uint8_t y[4]; 24 | }ColorMap16; 25 | 26 | void CallColorTable(FILE *zf, int16_t luma); 27 | 28 | float ctruncate(float value); 29 | void OpenTgaRaw(); 30 | void LUTToApt(); 31 | RgbColor From2DApt(AptColor apt); 32 | void TestRGB(); 33 | void WriteGLine(ColorMap16 cmap, uint8_t B,FILE *zp); 34 | void Write4CLine(ColorMap Square2D, uint8_t Bcol, FILE *zp); 35 | 36 | 37 | int main() { 38 | printf("Start\n"); 39 | //FILE *fp; 40 | //FILE *ts; 41 | //FILE *col; 42 | //FILE *col2; 43 | //FILE *APT; 44 | 45 | //fp = fopen("8bit_pal.tga", "rb"); 46 | //ts = fopen("fileC1.tga", "wb"); 47 | //col = fopen("fileC2.tga", "wb"); 48 | //col2 = fopen("fileC3.tga", "wb"); 49 | //APT = fopen("fileAPT.tga","wb"); 50 | printf("Write\n"); 51 | //TestTGAImage(fp); 52 | //unsigned int data=0; 53 | int i,j; 54 | 55 | TgaImageHead ReadTga = OpenTgaImage("139.tga"); 56 | if(ReadTga.File == NULL) { 57 | printf("Error\n"); 58 | exit(1); 59 | } 60 | 61 | TgaImageHead APTTga,SecTga,ThirdTga; 62 | APTTga = ReadTga; 63 | SecTga = ReadTga; 64 | ThirdTga = ReadTga; 65 | APTTga = WriteTgaImage("file_col_1.tga", APTTga); 66 | if(APTTga.File==NULL) {printf("Error\n"); exit(1);} 67 | SecTga = WriteTgaImage("file_col_2.tga", SecTga); 68 | if(SecTga.File==NULL) {printf("Error\n"); exit(1);} 69 | ThirdTga = WriteTgaImage("file_col_3.tga", ThirdTga); 70 | if(ThirdTga.File==NULL) {printf("Error\n"); exit(1);} 71 | 72 | //AptLine AptTrans; 73 | //uint8_t frame=1; 74 | //uint32_t currentline = 1; 75 | //uint8_t APTdata = 0; 76 | //AptLineAr ConvLine; 77 | //AptTelemetry TelemetryA = {16, 32, 48, 64, 80, 96, 112, 128, 144, 160, 176, 192, 208, 224, 240, 255}; 78 | //AptTelemetry TelemetryB = {16, 32, 48, 64, 80, 96, 112, 128, 144, 160, 176, 192, 208, 224, 240, 255}; 79 | 80 | /*for(j=0;j APT_FRAME_SIZE) { 85 | frame = 1; 86 | } 87 | ConvLine = ConcatAptLine(AptTrans); 88 | for(i=0;i255) {G=255;} 200 | radius++; 201 | } 202 | for(i=0;i<43;i++) { 203 | //printf("%d:%d,%d,%d\n",radius,(uint8_t)R,(uint8_t)G,(uint8_t)B); 204 | WriteTGAPixel((uint8_t)ctruncate(R+luma)&0xF0,(uint8_t)ctruncate(G+luma)&0xF0,(uint8_t)ctruncate(B+luma)&0xF0, zf); 205 | R -= IMG_COL_STEP_43; 206 | if(R<0) {R=0;} 207 | radius++; 208 | } 209 | for(i=0;i<43;i++) { 210 | //printf("%d:%d,%d,%d\n",radius,(uint8_t)R,(uint8_t)G,(uint8_t)B); 211 | WriteTGAPixel((uint8_t)ctruncate(R+luma)&0xF0,(uint8_t)ctruncate(G+luma)&0xF0,(uint8_t)ctruncate(B+luma)&0xF0, zf); 212 | B += IMG_COL_STEP_43; 213 | if(B>255) {B=255;} 214 | radius++; 215 | } 216 | for(i=0;i<42;i++) { 217 | //printf("%d:%d,%d,%d\n",radius,(uint8_t)R,(uint8_t)G,(uint8_t)B); 218 | WriteTGAPixel((uint8_t)ctruncate(R+luma)&0xF0,(uint8_t)ctruncate(G+luma)&0xF0,(uint8_t)ctruncate(B+luma)&0xF0, zf); 219 | G -= IMG_COL_STEP_42; 220 | if(G<0) {G=0;} 221 | radius++; 222 | } 223 | for(i=0;i<43;i++) { 224 | //printf("%d:%d,%d,%d\n",radius,(uint8_t)R,(uint8_t)G,(uint8_t)B); 225 | WriteTGAPixel((uint8_t)ctruncate(R+luma)&0xF0,(uint8_t)ctruncate(G+luma)&0xF0,(uint8_t)ctruncate(B+luma)&0xF0, zf); 226 | R += IMG_COL_STEP_43; 227 | if(R>255) {R=255;} 228 | radius++; 229 | } 230 | for(i=0;i<43;i++) { 231 | //printf("%d:%d,%d,%d\n",radius,(uint8_t)R,(uint8_t)G,(uint8_t)B); 232 | WriteTGAPixel((uint8_t)ctruncate(R+luma)&0xF0,(uint8_t)ctruncate(G+luma)&0xF0,(uint8_t)ctruncate(B+luma)&0xF0, zf); 233 | B -= IMG_COL_STEP_43; 234 | if(B<0) {B=0;} 235 | radius++; 236 | } 237 | 238 | } 239 | 240 | float ctruncate(float value) { 241 | if(value < 0) return 0; 242 | if(value > 255) return 255; 243 | 244 | return value; 245 | } 246 | 247 | void OpenTgaRaw() { 248 | FILE *fp; 249 | FILE *zp; 250 | zp = fopen("test-space-4k-moved.tga","rb"); 251 | fp = fopen("imgtable.h","wt"); 252 | if(fp==NULL) { 253 | return; 254 | } 255 | if(zp==NULL) { 256 | return; 257 | } 258 | int i,j; 259 | uint8_t Rval,Gval,Bval; 260 | unsigned int pix, cval; 261 | fseek(zp,IMG_TGA_HEAD_SIZE,SEEK_SET); 262 | fputs("#ifndef NA_IMAGE_TABLE_H_ \n", fp); 263 | fputs("#define NA_IMAGE_TABLE_H_ \n", fp); 264 | fputs("#define IMG_LUT_WIDTH 64 \n", fp); 265 | fputs("#define IMG_LUT_HEIGHT 64 \n", fp); 266 | fputs("static const uint16_t LUTFromApt[64][64] = {\n", fp); 267 | for(i=0;i<64;i++) { 268 | for(j=0;j<64;j++) { 269 | pix = ReadTGAPixel(zp); 270 | Rval = GetRedSubPixel(pix) & 0xF; 271 | Gval = GetGreenSubPixel(pix) & 0xF; 272 | Bval = GetBlueSubPixel(pix) & 0xF; 273 | cval = (Rval << 8)+(Gval << 4)+Bval; 274 | if(i==63 && j==63) { 275 | fprintf(fp,"%d",cval); 276 | } 277 | else { 278 | fprintf(fp,"%d,",cval); 279 | } 280 | } 281 | fputs("\n",fp); 282 | } 283 | 284 | fputs("};\n", fp); 285 | fputs("#endif\n", fp); 286 | fclose(zp); 287 | fclose(fp); 288 | } 289 | 290 | void LUTToApt() { 291 | FILE *fp; 292 | FILE *zp; 293 | zp = fopen("test-space-4k-moved.tga","rb"); 294 | fp = fopen("imgtable_apt.h","wt"); 295 | if(fp==NULL) { 296 | return; 297 | } 298 | if(zp==NULL) { 299 | return; 300 | } 301 | int i,j; 302 | uint8_t Rval,Gval,Bval; 303 | unsigned int pix, cval,val; 304 | uint16_t RGBArray[4096]; 305 | uint16_t counter = 0; 306 | fseek(zp,IMG_TGA_HEAD_SIZE,SEEK_SET); 307 | fputs("#ifndef NA_IMAGE_RGB_TABLE_H_ \n", fp); 308 | fputs("#define NA_IMAGE_RGB_TABLE_H_ \n", fp); 309 | fputs("#define IMG_LUT_RGB_WIDTH 1 \n", fp); 310 | fputs("#define IMG_LUT_RGB_HEIGHT 4096 \n", fp); 311 | fputs("static const uint16_t LUTFromRgb[4096] = {\n", fp); 312 | for(i=0;i<64;i++) { 313 | for(j=0;j<64;j++) { 314 | pix = ReadTGAPixel(zp); 315 | Rval = GetRedSubPixel(pix) & 0xF; 316 | Gval = GetGreenSubPixel(pix) & 0xF; 317 | Bval = GetBlueSubPixel(pix) & 0xF; 318 | cval = (Rval << 8)+(Gval << 4)+Bval; 319 | RGBArray[cval]=counter; 320 | counter++; 321 | } 322 | } 323 | 324 | for(i=0;i<4096;i++) { 325 | if(i==4095) { 326 | fprintf(fp,"%d",RGBArray[i]); 327 | } 328 | else { 329 | fprintf(fp,"%d,",RGBArray[i]); 330 | } 331 | } 332 | 333 | fputs("\n",fp); 334 | fputs("};\n", fp); 335 | fputs("#endif\n", fp); 336 | fclose(zp); 337 | fclose(fp); 338 | } 339 | 340 | RgbColor From2DApt(AptColor apt) { 341 | RgbColor rgb; 342 | uint8_t x = apt.h; 343 | uint8_t y = apt.sv; 344 | unsigned int pix; 345 | //unsigned int pix = LUTFromApt[x][y]; 346 | uint8_t r = (pix >> 16) & 0xFF; 347 | uint8_t g = (pix >> 8) & 0xFF; 348 | uint8_t b = pix & 0xFF; 349 | rgb.r = r; 350 | rgb.g = g; 351 | rgb.b = b; 352 | return rgb; 353 | } 354 | 355 | void TestRGB() { 356 | TgaImageHead test; 357 | test.IDLength = 0; 358 | test.ColorMapType = 0; 359 | test.ImageType = 0x02; 360 | test.CMapDepth = 0; 361 | test.CMapLength = 0; 362 | test.CMapStart = 0; 363 | test.XOffset = 0; 364 | test.YOffset = 0; 365 | test.Width = 64; 366 | test.Height = 64; 367 | test.PixelDepth = 0x18; 368 | test.ImageDescriptor = 0x20; 369 | //uint8_t R=0,G=0,B=0; 370 | test = WriteTgaImage("test-space-4k.tga",test); 371 | uint32_t val = 0; 372 | int i,j,k; 373 | ColorMap Square2D[16]; 374 | 375 | for(i=0;i<16;i++) { 376 | for(j=0;j<16;j++) { 377 | for(k=0;k<16;k++) { 378 | Square2D[k].x[i]=i; 379 | Square2D[k].y[j]=j; 380 | } 381 | } 382 | } 383 | for(i=0;i<16;i++) { 384 | Write4CLine(Square2D[i], i, test.File); 385 | } 386 | 387 | 388 | /* 389 | for(i=0;i<60;i++) { 390 | for(j=0;j<64;j++) { 391 | /*R = (val >> 8) & 0x0F; 392 | G = (val >> 4) & 0x0F; 393 | B = (val >> 0) & 0x0F;*/ 394 | 395 | /* WriteTGAPixel(((i*4) & 0xF0)*255/240,((j*4) & 0xF0)*255/240,255,test.File); 396 | val++; 397 | } 398 | }*/ 399 | fclose(test.File); 400 | } 401 | 402 | /*RgbColor AptToRgb(AptColor apt) { 403 | RgbColor rgb; 404 | uint16_t val = (apt.sv/4) * 64 + (apt.h/4); 405 | uint8_t R = (val >> 8) & 0xF; 406 | uint8_t G = (val >> 4) & 0xF; 407 | uint8_t B = (val >> 0) & 0xF; 408 | rgb.r = R << 4; rgb.g = G << 4; rgb.b = B << 4; 409 | return rgb; 410 | }*/ 411 | 412 | /*AptColor RgbToApt(RgbColor rgb) { 413 | AptColor apt; 414 | uint8_t R = rgb.r >> 4; 415 | uint8_t G = rgb.g >> 4; 416 | uint8_t B = rgb.b >> 4; 417 | uint16_t val = (R << 8) + (G << 4) + B; 418 | uint16_t x_val = val % 64; 419 | uint16_t y_val = (val - x_val) / 64; 420 | apt.h = (x_val & 0x3F) * 4; 421 | apt.sv = (y_val & 0x3F) * 4; 422 | return apt; 423 | }*/ 424 | 425 | void WriteGLine(ColorMap16 cmap, uint8_t B,FILE *zp) { 426 | int i,j; 427 | for(j=0;j<16;j++) { 428 | for(i=0;i<4;i++) { 429 | WriteTGAPixel(cmap.y[i],cmap.x[j],B,zp); 430 | } 431 | } 432 | } 433 | 434 | void Write4CLine(ColorMap Square2D, uint8_t Bcol, FILE *zp) { 435 | int i,j; 436 | uint8_t R,G,B; 437 | ColorMap16 MapLine[4]; 438 | for(i=0;i<16;i++) { 439 | for(j=0;j<16;j++) { 440 | R = Square2D.x[i] * 255/15; 441 | G = Square2D.y[j] * 255/15; 442 | B = Bcol*255/15; 443 | if((i<4) && (j<=16)) { 444 | MapLine[0].y[i]=R; 445 | MapLine[0].x[j]=G; 446 | } 447 | if(((i<8) && (i>=4)) && (j<=16)) { 448 | MapLine[1].y[i-4]=R; 449 | MapLine[1].x[j]=G; 450 | } 451 | if(((i<12) && (i>=8)) && (j<=16)) { 452 | MapLine[2].y[i-8]=R; 453 | MapLine[2].x[j]=G; 454 | } 455 | if(((i<16) && (i>=12)) && (j<=16)) { 456 | MapLine[3].y[i-12]=R; 457 | MapLine[3].x[j]=G; 458 | } 459 | } 460 | } 461 | WriteGLine(MapLine[0],B,zp); 462 | WriteGLine(MapLine[1],B,zp); 463 | WriteGLine(MapLine[2],B,zp); 464 | WriteGLine(MapLine[3],B,zp); 465 | 466 | 467 | } 468 | -------------------------------------------------------------------------------- /apt-encoder/main.c: -------------------------------------------------------------------------------- 1 | #include "main.h" 2 | #include "aptcode.h" 3 | #include "image.h" 4 | #include "audioset.h" 5 | #include "wavwrite.h" 6 | 7 | AptTelemetry TelemetryA; 8 | AptTelemetry TelemetryB; 9 | 10 | double time_taken; 11 | TgaImageHead ReadTga; 12 | TgaImageHead SecondTga; 13 | AptOptSettings aptoptions = {_APT_AUDIO_DEVICE,_APT_FILE_NO_SET,_APT_FILE_NO_SET,0,0,'N',0,0,0,0,0}; // Common APT settings 14 | FILE *RGfile=NULL; 15 | FILE *WAVfile=NULL; 16 | uint16_t imageline = 0; 17 | uint16_t imageline_second = 0; 18 | uint16_t transmitted_images = 0; 19 | uint32_t transmitted_frame = 0; 20 | uint32_t transmitted_minutes = 0; 21 | 22 | void *SoundThread(void *vargp) { 23 | //Sound Buffer 24 | TgaImageHead NullTga; 25 | unsigned int i = 0; 26 | int16_t carrier = 0; 27 | int16_t aptdata = 0; 28 | uint8_t frame = 1; 29 | uint8_t currentline = 1; 30 | uint8_t waittime = 0; 31 | AptLineAr ConvLine; 32 | double carrier_phase=0; // current phase 33 | double carrier_delta = WF_TPI*APT_CARRIER_F/WF_SAMPLE_RATE; // delta phase of carrier 2400 Hz 34 | //uint8_t AptDataBuffer[WF_SAMPLE_RATE/WF_BUFFER_DIV]; 35 | NullTga.File = NULL; 36 | clock_t t; 37 | while(1) { 38 | t = clock(); 39 | if(waittime<10) { // 5 seconds, 10 empty lines, No data (because NullTga) 40 | ConvLine = AptTransImageLine(frame, currentline, NullTga, NullTga, TelemetryA, TelemetryB, aptoptions.datab); 41 | waittime++; 42 | } 43 | else { 44 | ConvLine = AptTransImageLine(frame, currentline, ReadTga, SecondTga, TelemetryA, TelemetryB, aptoptions.datab); 45 | } 46 | frame++; 47 | currentline++; 48 | if(frame > APT_FRAME_SIZE) { 49 | frame = 1; 50 | transmitted_frame++; 51 | } 52 | if(currentline > APT_MARKER_SIZE) { 53 | currentline = 1; 54 | transmitted_minutes++; 55 | } 56 | //0.5s One line wave syntheis 57 | for(i=0; i= ReadTga.Height)&&(!aptoptions.usestdin)) { // Ignore in STDIN 93 | if(aptoptions.loop) { 94 | //printf("End of image. Another loop.\n"); 95 | transmitted_images++; 96 | if(ReadTga.File!=NULL) { 97 | fseek(ReadTga.File, IMG_TGA_HEAD_SIZE, SEEK_SET); 98 | imageline = 0; 99 | } 100 | } 101 | else { 102 | CloseImageFile(ReadTga.File, RGfile); 103 | if(aptoptions.console) { 104 | ClearConsole(); 105 | } 106 | exit(0); 107 | } 108 | } 109 | if((imageline_second >= SecondTga.Height)&&(AptImageSet==2)&&(!aptoptions.usestdin)) { // Ignore in STDIN 110 | if(aptoptions.loop) { 111 | transmitted_images++; 112 | if(SecondTga.File!=NULL) { 113 | fseek(SecondTga.File, IMG_TGA_HEAD_SIZE, SEEK_SET); 114 | imageline_second = 0; 115 | } 116 | } 117 | else { 118 | fclose(SecondTga.File); 119 | if(aptoptions.console) { 120 | ClearConsole(); 121 | } 122 | exit(0); 123 | } 124 | } 125 | 126 | t = clock() - t; 127 | time_taken = ((double)t)/CLOCKS_PER_SEC; // in seconds 128 | 129 | } 130 | return NULL; 131 | } 132 | 133 | int main(int argc, char *argv[]) { 134 | signal(SIGINT, SignalHandler); 135 | signal(SIGTERM, SignalHandler); 136 | 137 | if(argc == 1){ 138 | Usage(argv[0]); 139 | return 0; 140 | } 141 | /*logfile = fopen("imgerror.log", "at"); 142 | fprintf(logfile,"(II) APT log file\n"); 143 | fflush(logfile);*/ 144 | int opt = 0; 145 | while ((opt = getopt(argc, argv, "hi:s:d:lcm:rIOM")) != -1){ 146 | switch (opt) { 147 | case 'h': //Help 148 | Usage(argv[0]); 149 | return 0; 150 | break; 151 | case 'i': //Input TGA image 152 | strncpy(aptoptions.filename,optarg,sizeof(aptoptions.filename)-1); 153 | break; 154 | case 's': //Second input TGA image 155 | strncpy(aptoptions.secondfile,optarg,sizeof(aptoptions.secondfile)-1); 156 | break; 157 | case 'd': //Device 158 | aptoptions.device = optarg; 159 | aptoptions.chdev = 1; 160 | break; 161 | case 'l': //Infinite loop 162 | aptoptions.loop = 1; 163 | break; 164 | case 'c': //User console 165 | aptoptions.console = 1; 166 | break; 167 | case 'm': //Channel B data mode 168 | switch (optarg[0]) { 169 | case 'R': //Red 170 | case 'G': //Green 171 | case 'B': //Blue 172 | case 'N': //Negative 173 | case 'Y': //Yb 174 | case 'C': //Color 175 | aptoptions.datab = optarg[0]; 176 | break; 177 | default: 178 | printf("Bad mode: %c , ",optarg[0]); 179 | printf("Set to N\n"); 180 | } 181 | break; 182 | case 'r': // Regular file 183 | aptoptions.isfile=1; 184 | break; 185 | case 'I': // Use STDIN for image data 186 | aptoptions.usestdin = 1; 187 | break; 188 | case 'O': // User STDOUT for audio 189 | aptoptions.usestdout = 1; 190 | break; 191 | case 'M': // Multi mode on STDIN for image data 192 | aptoptions.multistdin = 1; 193 | break; 194 | case '?': //Unknown option 195 | //printf(" Error: %c\n", optopt); 196 | return 1; 197 | default: 198 | Usage(argv[0]); 199 | return 0; 200 | } 201 | } 202 | // Set telemetry for A and B channels 203 | TelemetryA = CreateTelemetry(APT_TEL_TEMP1, APT_TEL_TEMP2, APT_TEL_TEMP3, APT_TEL_TEMP4,0,APT_CHANNELID_1); 204 | TelemetryB = CreateTelemetry(APT_TEL_TEMP1, APT_TEL_TEMP2, APT_TEL_TEMP3, APT_TEL_TEMP4,APT_TEL_BACKSCAN,APT_CHANNELID_1); 205 | // Check argument 206 | if(strncmp(aptoptions.filename,_APT_FILE_NO_SET,4) == 0) { 207 | if(!aptoptions.usestdin) { 208 | printf("%s: required argument and option -- '-i '\n",argv[0]); 209 | exit(2); 210 | } 211 | } 212 | // Open input images 213 | if(!aptoptions.usestdin) { 214 | ReadTga = OpenTgaImage(aptoptions.filename); 215 | } 216 | else { 217 | ReadTga.File = stdin; 218 | } 219 | AptImageSet = 1; 220 | if(ReadTga.File == NULL) { // On error 221 | exit(1); 222 | } 223 | if(strncmp(aptoptions.secondfile,_APT_FILE_NO_SET,4)) { 224 | if(!aptoptions.usestdin) { 225 | SecondTga = OpenTgaImage(aptoptions.secondfile); 226 | } 227 | else { 228 | SecondTga.File = stdin; 229 | } 230 | AptImageSet = 2; 231 | if(SecondTga.File == NULL) { // On error 232 | exit(1); 233 | } 234 | } 235 | if(aptoptions.usestdout) { // Use STD OUT 236 | aptoptions.isfile=0; 237 | aptoptions.console=0; 238 | aptoptions.loop=0; 239 | aptoptions.device=_APT_AUDIO_STDOUT; 240 | } 241 | if(aptoptions.usestdin) { // Use STD IN 242 | aptoptions.isfile=0; 243 | aptoptions.console=0; 244 | aptoptions.loop=0; 245 | if(aptoptions.multistdin) { 246 | AptImageSet = 2; 247 | SecondTga.File = stdin; 248 | } 249 | strncpy(aptoptions.filename,_APT_AUDIO_STDIN,sizeof(_APT_AUDIO_STDIN)-1); 250 | if(AptImageSet==2) { 251 | strncpy(aptoptions.secondfile,_APT_AUDIO_STDIN,sizeof(_APT_AUDIO_STDIN)-1); 252 | } 253 | if(fcntl(STDIN_FILENO, F_SETFL, fcntl(0, F_GETFL) | O_NONBLOCK) < 0) { // Non-blocking STDIN 254 | printf("Error calling fcntl, non-blocking stdin\n"); 255 | } 256 | } 257 | if(aptoptions.isfile) { // Write to WAV file 258 | aptoptions.console=0; 259 | aptoptions.loop=0; 260 | if(aptoptions.chdev) { 261 | WAVfile=wav_open(aptoptions.device); 262 | if(WAVfile==NULL){ 263 | exit(1); 264 | } 265 | wav_head(ReadTga.Height/2,WF_SAMPLE_RATE,WF_SAMPLEBITS,WAVfile); 266 | } 267 | else { 268 | printf("Cannot use %s as regular file\n",_APT_AUDIO_DEVICE); 269 | exit(1); 270 | } 271 | } 272 | else{ 273 | AudioDevice = InitAudioDevice(aptoptions.device); 274 | if(AudioDevice < 0) { 275 | exit(1); 276 | } 277 | } 278 | pthread_t sound_buf; 279 | if(pthread_create(&sound_buf, NULL, SoundThread, NULL)!=0){ 280 | perror("Error creating thread\n"); 281 | exit(1); 282 | } 283 | if(pthread_detach(sound_buf)!=0){ 284 | perror("Error detaching thread\n"); 285 | exit(1); 286 | } 287 | 288 | RGfile = ReadTga.File; 289 | 290 | if(aptoptions.console) { 291 | char *consoleinput; 292 | printf("Type help to show commands\n"); 293 | while(1) { 294 | consoleinput = readline("APT> "); 295 | if(!consoleinput){ 296 | CloseImageFile(ReadTga.File, RGfile); 297 | printf("\n"); 298 | exit(0); 299 | } 300 | add_history(consoleinput); 301 | if(!strncmp(consoleinput,"exit",4)){ 302 | if(strncmp(aptoptions.secondfile,_APT_FILE_NO_SET,4) == 0) { 303 | CloseImageFile(ReadTga.File, RGfile); 304 | } 305 | else { 306 | fclose(ReadTga.File); 307 | fclose(SecondTga.File); 308 | } 309 | exit(0); 310 | } 311 | else if(!strncmp(consoleinput,"help",4)){ 312 | printf("help - print help\n"); 313 | printf("empty - encode empty data (only in single)\n"); 314 | printf("image - encode image data (only in single)\n"); 315 | printf("info - show information\n"); 316 | printf("load1 - load new first image\n"); 317 | printf("load2 - load new second image (only in multi)\n"); 318 | printf("mode - channel B data mode (R,G,B,N,Y,C) (only in single)\n"); 319 | printf("exit - exit from APT\n") ; 320 | } 321 | else if(!strncmp(consoleinput,"empty",5)) { 322 | if((ReadTga.File!=NULL)&&(AptImageSet == 1)) { 323 | RGfile = ReadTga.File; 324 | ReadTga.File = NULL; 325 | } else { 326 | printf("empty function is available only in single image mode!\n"); 327 | } 328 | } 329 | else if(!strncmp(consoleinput,"image",5)) { 330 | if((RGfile!=NULL)&&(AptImageSet == 1)) { 331 | ReadTga.File = RGfile; 332 | RGfile = NULL; 333 | } else { 334 | printf("image function is available only in single image mode!\n"); 335 | } 336 | } 337 | else if(!strncmp(consoleinput,"mode R",6)) { 338 | aptoptions.datab = 'R'; 339 | } 340 | else if(!strncmp(consoleinput,"mode G",6)) { 341 | aptoptions.datab = 'G'; 342 | } 343 | else if(!strncmp(consoleinput,"mode B",6)) { 344 | aptoptions.datab = 'B'; 345 | } 346 | else if(!strncmp(consoleinput,"mode N",6)) { 347 | aptoptions.datab = 'N'; 348 | } 349 | else if(!strncmp(consoleinput,"mode Y",6)) { 350 | aptoptions.datab = 'Y'; 351 | } 352 | else if(!strncmp(consoleinput,"mode C",6)) { 353 | aptoptions.datab = 'C'; 354 | } 355 | else if(!strncmp(consoleinput,"load1",5)) { 356 | char newimage[1024]; 357 | printf("New first image filename: "); 358 | scanf("%s",newimage); 359 | TgaImageHead NewTgaFile = OpenTgaImage(newimage); 360 | if(NewTgaFile.File != NULL) { 361 | strncpy(aptoptions.filename,newimage,sizeof(newimage)-1); 362 | imageline = 0; 363 | if(AptImageSet==1) { 364 | CloseImageFile(ReadTga.File, RGfile); 365 | if(ReadTga.File == NULL) { 366 | ReadTga = NewTgaFile; 367 | RGfile = NewTgaFile.File; 368 | ReadTga.File = NULL; 369 | } 370 | else { 371 | ReadTga = NewTgaFile; 372 | RGfile = NULL; 373 | } 374 | } 375 | if(AptImageSet==2){ 376 | fclose(ReadTga.File); 377 | ReadTga = NewTgaFile; 378 | } 379 | } 380 | } 381 | else if(!strncmp(consoleinput,"load2",5)) { 382 | if(AptImageSet == 2) { 383 | char newimage[1024]; 384 | printf("New second image filename: "); 385 | scanf("%s",newimage); 386 | TgaImageHead NewTgaFile = OpenTgaImage(newimage); 387 | if(NewTgaFile.File != NULL) { 388 | strncpy(aptoptions.secondfile,newimage,sizeof(newimage)-1); 389 | imageline_second = 0; 390 | fclose(SecondTga.File); 391 | SecondTga = NewTgaFile; 392 | } 393 | } else { 394 | printf("load2 function is available only in multi image mode!\n"); 395 | } 396 | } 397 | else if(!strncmp(consoleinput,"info",4)) { 398 | printf("Sound thread loop time: %lf sec\n",time_taken); 399 | printf("Output audio device: %s, ",aptoptions.device); 400 | printf("Sample rate: %d Hz, Bits: %d, Channels: %d\n",WF_SAMPLE_RATE,WF_SAMPLEBITS,WF_CHANNELS); 401 | printf("Image set: "); 402 | if(AptImageSet==1) { 403 | printf("single - load2 function has no effect\n"); 404 | } 405 | else if (AptImageSet==2) { 406 | printf("multi - mode, empty and image functions has no effect\n"); 407 | } 408 | if(AptImageSet==1) { 409 | printf("Input image: %s , ",aptoptions.filename); 410 | printf("Width: %dpx, Height: %dpx, ",ReadTga.Width, ReadTga.Height); 411 | printf("Transmiting - "); 412 | if(ReadTga.File==NULL){ 413 | printf("no\n"); 414 | } 415 | else { 416 | printf("yes\n"); 417 | } 418 | printf("Time to transmit: %d sec, ",ReadTga.Height/2); 419 | printf("Current line: %d (%d%%), ",imageline,(int)(100*imageline/ReadTga.Height)); 420 | printf("Channel B data mode: %c\n",aptoptions.datab); 421 | } 422 | if(AptImageSet==2) { 423 | printf("First image: %s",aptoptions.filename); 424 | printf(" Width: %dpx, Height: %dpx, ", ReadTga.Width, ReadTga.Height); 425 | printf("Time to transmit: %d sec\n",ReadTga.Height/2); 426 | printf("Second image: %s",aptoptions.secondfile); 427 | printf(" Width: %dpx, Height: %dpx, ", SecondTga.Width, SecondTga.Height); 428 | printf("Time to transmit: %d sec\n",SecondTga.Height/2); 429 | printf("Current line: %d (%d%%) + ",imageline,(int)(100*imageline/ReadTga.Height)); 430 | printf("%d (%d%%), ",imageline_second,(int)(100*imageline_second/SecondTga.Height)); 431 | } 432 | printf("Total transmitted frames: %d, ",transmitted_frame); 433 | printf("Total transmitted minutes: %d, ",transmitted_minutes); 434 | printf("Image loops: %d\n",transmitted_images); 435 | } 436 | else { 437 | printf("Bad command\n"); 438 | } 439 | } 440 | } 441 | else { 442 | //if(!aptoptions.isfile) { 443 | while(1) { 444 | sleep(1); 445 | } 446 | //} 447 | } 448 | return 0; 449 | } 450 | 451 | void Usage(char *p_name) { 452 | printf("NOAA automatic picture transmission (APT) encoder\n"); 453 | printf("Usage: %s (-i [-s ] | -I) [(-d | -O) -m -lcrM]\n",p_name); 454 | printf(" -i Input TGA image (909px width, 24bit RGB)\n"); 455 | printf(" -s Second input TGA image (B channel, mode ignored)\n"); 456 | printf(" -d OSS audio device (default /dev/dsp) or file\n"); 457 | printf(" -m Channel B data mode (R,G,B,N,Y,C)\n"); 458 | printf(" -I Read image data from stdin\n"); 459 | printf(" -O Write audio data to stdout\n"); 460 | printf(" -M Multi image reading from stdin\n"); 461 | printf(" -l Enable infinite image loop\n"); 462 | printf(" -c Enable user console\n"); 463 | printf(" -r Device is regular file (write WAV audio file)\n"); 464 | printf(" -h Show this help\n"); 465 | printf(" Build: %s %s, GCC %s\n", __TIME__, __DATE__, __VERSION__); 466 | } 467 | 468 | void CloseImageFile(FILE *reg, FILE *alt) { 469 | if(AptImageSet==1) { 470 | if(reg==NULL) { 471 | fclose(alt); 472 | } 473 | else { 474 | fclose(reg); 475 | } 476 | } 477 | else if (AptImageSet==2) { 478 | fclose(reg); 479 | } 480 | } 481 | 482 | void ClearConsole() { 483 | rl_free_line_state(); 484 | rl_cleanup_after_signal(); 485 | RL_UNSETSTATE(RL_STATE_ISEARCH|RL_STATE_NSEARCH|RL_STATE_VIMOTION|RL_STATE_NUMERICARG|RL_STATE_MULTIKEY); 486 | rl_line_buffer[rl_point = rl_end = rl_mark = 0] = 0; 487 | printf("\n"); 488 | } 489 | 490 | void SignalHandler(int number) { 491 | printf("\nCaught signal %d ... ", number); 492 | if(AptImageSet==1) { 493 | CloseImageFile(ReadTga.File, RGfile); 494 | } 495 | else if(AptImageSet==2){ 496 | fclose(ReadTga.File); 497 | } 498 | printf("abort\n"); 499 | exit(-1); 500 | } 501 | -------------------------------------------------------------------------------- /image/imgtable_apt.h: -------------------------------------------------------------------------------- 1 | #ifndef NA_IMAGE_RGB_TABLE_H_ 2 | #define NA_IMAGE_RGB_TABLE_H_ 3 | #define IMG_LUT_RGB_WIDTH 1 4 | #define IMG_LUT_RGB_HEIGHT 4096 5 | static const uint16_t LUTFromRgb[4096] = { 6 | 0,448,512,960,1024,1472,1536,1984,2048,2496,2560,3008,3072,3520,3584,4032,4,452,516,964,1028,1476,1540,1988,2052,2500,2564,3012,3076,3524,3588,4036,8,456,520,968,1032,1480,1544,1992,2056,2504,2568,3016,3080,3528,3592,4040,12,460,524,972,1036,1484,1548,1996,2060,2508,2572,3020,3084,3532,3596,4044,16,464,528,976,1040,1488,1552,2000,2064,2512,2576,3024,3088,3536,3600,4048,20,468,532,980,1044,1492,1556,2004,2068,2516,2580,3028,3092,3540,3604,4052,24,472,536,984,1048,1496,1560,2008,2072,2520,2584,3032,3096,3544,3608,4056,28,476,540,988,1052,1500,1564,2012,2076,2524,2588,3036,3100,3548,3612,4060,32,480,544,992,1056,1504,1568,2016,2080,2528,2592,3040,3104,3552,3616,4064,36,484,548,996,1060,1508,1572,2020,2084,2532,2596,3044,3108,3556,3620,4068,40,488,552,1000,1064,1512,1576,2024,2088,2536,2600,3048,3112,3560,3624,4072,44,492,556,1004,1068,1516,1580,2028,2092,2540,2604,3052,3116,3564,3628,4076,48,496,560,1008,1072,1520,1584,2032,2096,2544,2608,3056,3120,3568,3632,4080,52,500,564,1012,1076,1524,1588,2036,2100,2548,2612,3060,3124,3572,3636,4084,56,504,568,1016,1080,1528,1592,2040,2104,2552,2616,3064,3128,3576,3640,4088,60,508,572,1020,1084,1532,1596,2044,2108,2556,2620,3068,3132,3580,3644,4092,1,449,513,961,1025,1473,1537,1985,2049,2497,2561,3009,3073,3521,3585,4033,5,453,517,965,1029,1477,1541,1989,2053,2501,2565,3013,3077,3525,3589,4037,9,457,521,969,1033,1481,1545,1993,2057,2505,2569,3017,3081,3529,3593,4041,13,461,525,973,1037,1485,1549,1997,2061,2509,2573,3021,3085,3533,3597,4045,17,465,529,977,1041,1489,1553,2001,2065,2513,2577,3025,3089,3537,3601,4049,21,469,533,981,1045,1493,1557,2005,2069,2517,2581,3029,3093,3541,3605,4053,25,473,537,985,1049,1497,1561,2009,2073,2521,2585,3033,3097,3545,3609,4057,29,477,541,989,1053,1501,1565,2013,2077,2525,2589,3037,3101,3549,3613,4061,33,481,545,993,1057,1505,1569,2017,2081,2529,2593,3041,3105,3553,3617,4065,37,485,549,997,1061,1509,1573,2021,2085,2533,2597,3045,3109,3557,3621,4069,41,489,553,1001,1065,1513,1577,2025,2089,2537,2601,3049,3113,3561,3625,4073,45,493,557,1005,1069,1517,1581,2029,2093,2541,2605,3053,3117,3565,3629,4077,49,497,561,1009,1073,1521,1585,2033,2097,2545,2609,3057,3121,3569,3633,4081,53,501,565,1013,1077,1525,1589,2037,2101,2549,2613,3061,3125,3573,3637,4085,57,505,569,1017,1081,1529,1593,2041,2105,2553,2617,3065,3129,3577,3641,4089,61,509,573,1021,1085,1533,1597,2045,2109,2557,2621,3069,3133,3581,3645,4093,2,450,514,962,1026,1474,1538,1986,2050,2498,2562,3010,3074,3522,3586,4034,6,454,518,966,1030,1478,1542,1990,2054,2502,2566,3014,3078,3526,3590,4038,10,458,522,970,1034,1482,1546,1994,2058,2506,2570,3018,3082,3530,3594,4042,14,462,526,974,1038,1486,1550,1998,2062,2510,2574,3022,3086,3534,3598,4046,18,466,530,978,1042,1490,1554,2002,2066,2514,2578,3026,3090,3538,3602,4050,22,470,534,982,1046,1494,1558,2006,2070,2518,2582,3030,3094,3542,3606,4054,26,474,538,986,1050,1498,1562,2010,2074,2522,2586,3034,3098,3546,3610,4058,30,478,542,990,1054,1502,1566,2014,2078,2526,2590,3038,3102,3550,3614,4062,34,482,546,994,1058,1506,1570,2018,2082,2530,2594,3042,3106,3554,3618,4066,38,486,550,998,1062,1510,1574,2022,2086,2534,2598,3046,3110,3558,3622,4070,42,490,554,1002,1066,1514,1578,2026,2090,2538,2602,3050,3114,3562,3626,4074,46,494,558,1006,1070,1518,1582,2030,2094,2542,2606,3054,3118,3566,3630,4078,50,498,562,1010,1074,1522,1586,2034,2098,2546,2610,3058,3122,3570,3634,4082,54,502,566,1014,1078,1526,1590,2038,2102,2550,2614,3062,3126,3574,3638,4086,58,506,570,1018,1082,1530,1594,2042,2106,2554,2618,3066,3130,3578,3642,4090,62,510,574,1022,1086,1534,1598,2046,2110,2558,2622,3070,3134,3582,3646,4094,3,451,515,963,1027,1475,1539,1987,2051,2499,2563,3011,3075,3523,3587,4035,7,455,519,967,1031,1479,1543,1991,2055,2503,2567,3015,3079,3527,3591,4039,11,459,523,971,1035,1483,1547,1995,2059,2507,2571,3019,3083,3531,3595,4043,15,463,527,975,1039,1487,1551,1999,2063,2511,2575,3023,3087,3535,3599,4047,19,467,531,979,1043,1491,1555,2003,2067,2515,2579,3027,3091,3539,3603,4051,23,471,535,983,1047,1495,1559,2007,2071,2519,2583,3031,3095,3543,3607,4055,27,475,539,987,1051,1499,1563,2011,2075,2523,2587,3035,3099,3547,3611,4059,31,479,543,991,1055,1503,1567,2015,2079,2527,2591,3039,3103,3551,3615,4063,35,483,547,995,1059,1507,1571,2019,2083,2531,2595,3043,3107,3555,3619,4067,39,487,551,999,1063,1511,1575,2023,2087,2535,2599,3047,3111,3559,3623,4071,43,491,555,1003,1067,1515,1579,2027,2091,2539,2603,3051,3115,3563,3627,4075,47,495,559,1007,1071,1519,1583,2031,2095,2543,2607,3055,3119,3567,3631,4079,51,499,563,1011,1075,1523,1587,2035,2099,2547,2611,3059,3123,3571,3635,4083,55,503,567,1015,1079,1527,1591,2039,2103,2551,2615,3063,3127,3575,3639,4087,59,507,571,1019,1083,1531,1595,2043,2107,2555,2619,3067,3131,3579,3643,4091,63,511,575,1023,1087,1535,1599,2047,2111,2559,2623,3071,3135,3583,3647,4095,64,384,576,896,1088,1408,1600,1920,2112,2432,2624,2944,3136,3456,3648,3968,68,388,580,900,1092,1412,1604,1924,2116,2436,2628,2948,3140,3460,3652,3972,72,392,584,904,1096,1416,1608,1928,2120,2440,2632,2952,3144,3464,3656,3976,76,396,588,908,1100,1420,1612,1932,2124,2444,2636,2956,3148,3468,3660,3980,80,400,592,912,1104,1424,1616,1936,2128,2448,2640,2960,3152,3472,3664,3984,84,404,596,916,1108,1428,1620,1940,2132,2452,2644,2964,3156,3476,3668,3988,88,408,600,920,1112,1432,1624,1944,2136,2456,2648,2968,3160,3480,3672,3992,92,412,604,924,1116,1436,1628,1948,2140,2460,2652,2972,3164,3484,3676,3996,96,416,608,928,1120,1440,1632,1952,2144,2464,2656,2976,3168,3488,3680,4000,100,420,612,932,1124,1444,1636,1956,2148,2468,2660,2980,3172,3492,3684,4004,104,424,616,936,1128,1448,1640,1960,2152,2472,2664,2984,3176,3496,3688,4008,108,428,620,940,1132,1452,1644,1964,2156,2476,2668,2988,3180,3500,3692,4012,112,432,624,944,1136,1456,1648,1968,2160,2480,2672,2992,3184,3504,3696,4016,116,436,628,948,1140,1460,1652,1972,2164,2484,2676,2996,3188,3508,3700,4020,120,440,632,952,1144,1464,1656,1976,2168,2488,2680,3000,3192,3512,3704,4024,124,444,636,956,1148,1468,1660,1980,2172,2492,2684,3004,3196,3516,3708,4028,65,385,577,897,1089,1409,1601,1921,2113,2433,2625,2945,3137,3457,3649,3969,69,389,581,901,1093,1413,1605,1925,2117,2437,2629,2949,3141,3461,3653,3973,73,393,585,905,1097,1417,1609,1929,2121,2441,2633,2953,3145,3465,3657,3977,77,397,589,909,1101,1421,1613,1933,2125,2445,2637,2957,3149,3469,3661,3981,81,401,593,913,1105,1425,1617,1937,2129,2449,2641,2961,3153,3473,3665,3985,85,405,597,917,1109,1429,1621,1941,2133,2453,2645,2965,3157,3477,3669,3989,89,409,601,921,1113,1433,1625,1945,2137,2457,2649,2969,3161,3481,3673,3993,93,413,605,925,1117,1437,1629,1949,2141,2461,2653,2973,3165,3485,3677,3997,97,417,609,929,1121,1441,1633,1953,2145,2465,2657,2977,3169,3489,3681,4001,101,421,613,933,1125,1445,1637,1957,2149,2469,2661,2981,3173,3493,3685,4005,105,425,617,937,1129,1449,1641,1961,2153,2473,2665,2985,3177,3497,3689,4009,109,429,621,941,1133,1453,1645,1965,2157,2477,2669,2989,3181,3501,3693,4013,113,433,625,945,1137,1457,1649,1969,2161,2481,2673,2993,3185,3505,3697,4017,117,437,629,949,1141,1461,1653,1973,2165,2485,2677,2997,3189,3509,3701,4021,121,441,633,953,1145,1465,1657,1977,2169,2489,2681,3001,3193,3513,3705,4025,125,445,637,957,1149,1469,1661,1981,2173,2493,2685,3005,3197,3517,3709,4029,66,386,578,898,1090,1410,1602,1922,2114,2434,2626,2946,3138,3458,3650,3970,70,390,582,902,1094,1414,1606,1926,2118,2438,2630,2950,3142,3462,3654,3974,74,394,586,906,1098,1418,1610,1930,2122,2442,2634,2954,3146,3466,3658,3978,78,398,590,910,1102,1422,1614,1934,2126,2446,2638,2958,3150,3470,3662,3982,82,402,594,914,1106,1426,1618,1938,2130,2450,2642,2962,3154,3474,3666,3986,86,406,598,918,1110,1430,1622,1942,2134,2454,2646,2966,3158,3478,3670,3990,90,410,602,922,1114,1434,1626,1946,2138,2458,2650,2970,3162,3482,3674,3994,94,414,606,926,1118,1438,1630,1950,2142,2462,2654,2974,3166,3486,3678,3998,98,418,610,930,1122,1442,1634,1954,2146,2466,2658,2978,3170,3490,3682,4002,102,422,614,934,1126,1446,1638,1958,2150,2470,2662,2982,3174,3494,3686,4006,106,426,618,938,1130,1450,1642,1962,2154,2474,2666,2986,3178,3498,3690,4010,110,430,622,942,1134,1454,1646,1966,2158,2478,2670,2990,3182,3502,3694,4014,114,434,626,946,1138,1458,1650,1970,2162,2482,2674,2994,3186,3506,3698,4018,118,438,630,950,1142,1462,1654,1974,2166,2486,2678,2998,3190,3510,3702,4022,122,442,634,954,1146,1466,1658,1978,2170,2490,2682,3002,3194,3514,3706,4026,126,446,638,958,1150,1470,1662,1982,2174,2494,2686,3006,3198,3518,3710,4030,67,387,579,899,1091,1411,1603,1923,2115,2435,2627,2947,3139,3459,3651,3971,71,391,583,903,1095,1415,1607,1927,2119,2439,2631,2951,3143,3463,3655,3975,75,395,587,907,1099,1419,1611,1931,2123,2443,2635,2955,3147,3467,3659,3979,79,399,591,911,1103,1423,1615,1935,2127,2447,2639,2959,3151,3471,3663,3983,83,403,595,915,1107,1427,1619,1939,2131,2451,2643,2963,3155,3475,3667,3987,87,407,599,919,1111,1431,1623,1943,2135,2455,2647,2967,3159,3479,3671,3991,91,411,603,923,1115,1435,1627,1947,2139,2459,2651,2971,3163,3483,3675,3995,95,415,607,927,1119,1439,1631,1951,2143,2463,2655,2975,3167,3487,3679,3999,99,419,611,931,1123,1443,1635,1955,2147,2467,2659,2979,3171,3491,3683,4003,103,423,615,935,1127,1447,1639,1959,2151,2471,2663,2983,3175,3495,3687,4007,107,427,619,939,1131,1451,1643,1963,2155,2475,2667,2987,3179,3499,3691,4011,111,431,623,943,1135,1455,1647,1967,2159,2479,2671,2991,3183,3503,3695,4015,115,435,627,947,1139,1459,1651,1971,2163,2483,2675,2995,3187,3507,3699,4019,119,439,631,951,1143,1463,1655,1975,2167,2487,2679,2999,3191,3511,3703,4023,123,443,635,955,1147,1467,1659,1979,2171,2491,2683,3003,3195,3515,3707,4027,127,447,639,959,1151,1471,1663,1983,2175,2495,2687,3007,3199,3519,3711,4031,128,320,640,832,1152,1344,1664,1856,2176,2368,2688,2880,3200,3392,3712,3904,132,324,644,836,1156,1348,1668,1860,2180,2372,2692,2884,3204,3396,3716,3908,136,328,648,840,1160,1352,1672,1864,2184,2376,2696,2888,3208,3400,3720,3912,140,332,652,844,1164,1356,1676,1868,2188,2380,2700,2892,3212,3404,3724,3916,144,336,656,848,1168,1360,1680,1872,2192,2384,2704,2896,3216,3408,3728,3920,148,340,660,852,1172,1364,1684,1876,2196,2388,2708,2900,3220,3412,3732,3924,152,344,664,856,1176,1368,1688,1880,2200,2392,2712,2904,3224,3416,3736,3928,156,348,668,860,1180,1372,1692,1884,2204,2396,2716,2908,3228,3420,3740,3932,160,352,672,864,1184,1376,1696,1888,2208,2400,2720,2912,3232,3424,3744,3936,164,356,676,868,1188,1380,1700,1892,2212,2404,2724,2916,3236,3428,3748,3940,168,360,680,872,1192,1384,1704,1896,2216,2408,2728,2920,3240,3432,3752,3944,172,364,684,876,1196,1388,1708,1900,2220,2412,2732,2924,3244,3436,3756,3948,176,368,688,880,1200,1392,1712,1904,2224,2416,2736,2928,3248,3440,3760,3952,180,372,692,884,1204,1396,1716,1908,2228,2420,2740,2932,3252,3444,3764,3956,184,376,696,888,1208,1400,1720,1912,2232,2424,2744,2936,3256,3448,3768,3960,188,380,700,892,1212,1404,1724,1916,2236,2428,2748,2940,3260,3452,3772,3964,129,321,641,833,1153,1345,1665,1857,2177,2369,2689,2881,3201,3393,3713,3905,133,325,645,837,1157,1349,1669,1861,2181,2373,2693,2885,3205,3397,3717,3909,137,329,649,841,1161,1353,1673,1865,2185,2377,2697,2889,3209,3401,3721,3913,141,333,653,845,1165,1357,1677,1869,2189,2381,2701,2893,3213,3405,3725,3917,145,337,657,849,1169,1361,1681,1873,2193,2385,2705,2897,3217,3409,3729,3921,149,341,661,853,1173,1365,1685,1877,2197,2389,2709,2901,3221,3413,3733,3925,153,345,665,857,1177,1369,1689,1881,2201,2393,2713,2905,3225,3417,3737,3929,157,349,669,861,1181,1373,1693,1885,2205,2397,2717,2909,3229,3421,3741,3933,161,353,673,865,1185,1377,1697,1889,2209,2401,2721,2913,3233,3425,3745,3937,165,357,677,869,1189,1381,1701,1893,2213,2405,2725,2917,3237,3429,3749,3941,169,361,681,873,1193,1385,1705,1897,2217,2409,2729,2921,3241,3433,3753,3945,173,365,685,877,1197,1389,1709,1901,2221,2413,2733,2925,3245,3437,3757,3949,177,369,689,881,1201,1393,1713,1905,2225,2417,2737,2929,3249,3441,3761,3953,181,373,693,885,1205,1397,1717,1909,2229,2421,2741,2933,3253,3445,3765,3957,185,377,697,889,1209,1401,1721,1913,2233,2425,2745,2937,3257,3449,3769,3961,189,381,701,893,1213,1405,1725,1917,2237,2429,2749,2941,3261,3453,3773,3965,130,322,642,834,1154,1346,1666,1858,2178,2370,2690,2882,3202,3394,3714,3906,134,326,646,838,1158,1350,1670,1862,2182,2374,2694,2886,3206,3398,3718,3910,138,330,650,842,1162,1354,1674,1866,2186,2378,2698,2890,3210,3402,3722,3914,142,334,654,846,1166,1358,1678,1870,2190,2382,2702,2894,3214,3406,3726,3918,146,338,658,850,1170,1362,1682,1874,2194,2386,2706,2898,3218,3410,3730,3922,150,342,662,854,1174,1366,1686,1878,2198,2390,2710,2902,3222,3414,3734,3926,154,346,666,858,1178,1370,1690,1882,2202,2394,2714,2906,3226,3418,3738,3930,158,350,670,862,1182,1374,1694,1886,2206,2398,2718,2910,3230,3422,3742,3934,162,354,674,866,1186,1378,1698,1890,2210,2402,2722,2914,3234,3426,3746,3938,166,358,678,870,1190,1382,1702,1894,2214,2406,2726,2918,3238,3430,3750,3942,170,362,682,874,1194,1386,1706,1898,2218,2410,2730,2922,3242,3434,3754,3946,174,366,686,878,1198,1390,1710,1902,2222,2414,2734,2926,3246,3438,3758,3950,178,370,690,882,1202,1394,1714,1906,2226,2418,2738,2930,3250,3442,3762,3954,182,374,694,886,1206,1398,1718,1910,2230,2422,2742,2934,3254,3446,3766,3958,186,378,698,890,1210,1402,1722,1914,2234,2426,2746,2938,3258,3450,3770,3962,190,382,702,894,1214,1406,1726,1918,2238,2430,2750,2942,3262,3454,3774,3966,131,323,643,835,1155,1347,1667,1859,2179,2371,2691,2883,3203,3395,3715,3907,135,327,647,839,1159,1351,1671,1863,2183,2375,2695,2887,3207,3399,3719,3911,139,331,651,843,1163,1355,1675,1867,2187,2379,2699,2891,3211,3403,3723,3915,143,335,655,847,1167,1359,1679,1871,2191,2383,2703,2895,3215,3407,3727,3919,147,339,659,851,1171,1363,1683,1875,2195,2387,2707,2899,3219,3411,3731,3923,151,343,663,855,1175,1367,1687,1879,2199,2391,2711,2903,3223,3415,3735,3927,155,347,667,859,1179,1371,1691,1883,2203,2395,2715,2907,3227,3419,3739,3931,159,351,671,863,1183,1375,1695,1887,2207,2399,2719,2911,3231,3423,3743,3935,163,355,675,867,1187,1379,1699,1891,2211,2403,2723,2915,3235,3427,3747,3939,167,359,679,871,1191,1383,1703,1895,2215,2407,2727,2919,3239,3431,3751,3943,171,363,683,875,1195,1387,1707,1899,2219,2411,2731,2923,3243,3435,3755,3947,175,367,687,879,1199,1391,1711,1903,2223,2415,2735,2927,3247,3439,3759,3951,179,371,691,883,1203,1395,1715,1907,2227,2419,2739,2931,3251,3443,3763,3955,183,375,695,887,1207,1399,1719,1911,2231,2423,2743,2935,3255,3447,3767,3959,187,379,699,891,1211,1403,1723,1915,2235,2427,2747,2939,3259,3451,3771,3963,191,383,703,895,1215,1407,1727,1919,2239,2431,2751,2943,3263,3455,3775,3967,192,256,704,768,1216,1280,1728,1792,2240,2304,2752,2816,3264,3328,3776,3840,196,260,708,772,1220,1284,1732,1796,2244,2308,2756,2820,3268,3332,3780,3844,200,264,712,776,1224,1288,1736,1800,2248,2312,2760,2824,3272,3336,3784,3848,204,268,716,780,1228,1292,1740,1804,2252,2316,2764,2828,3276,3340,3788,3852,208,272,720,784,1232,1296,1744,1808,2256,2320,2768,2832,3280,3344,3792,3856,212,276,724,788,1236,1300,1748,1812,2260,2324,2772,2836,3284,3348,3796,3860,216,280,728,792,1240,1304,1752,1816,2264,2328,2776,2840,3288,3352,3800,3864,220,284,732,796,1244,1308,1756,1820,2268,2332,2780,2844,3292,3356,3804,3868,224,288,736,800,1248,1312,1760,1824,2272,2336,2784,2848,3296,3360,3808,3872,228,292,740,804,1252,1316,1764,1828,2276,2340,2788,2852,3300,3364,3812,3876,232,296,744,808,1256,1320,1768,1832,2280,2344,2792,2856,3304,3368,3816,3880,236,300,748,812,1260,1324,1772,1836,2284,2348,2796,2860,3308,3372,3820,3884,240,304,752,816,1264,1328,1776,1840,2288,2352,2800,2864,3312,3376,3824,3888,244,308,756,820,1268,1332,1780,1844,2292,2356,2804,2868,3316,3380,3828,3892,248,312,760,824,1272,1336,1784,1848,2296,2360,2808,2872,3320,3384,3832,3896,252,316,764,828,1276,1340,1788,1852,2300,2364,2812,2876,3324,3388,3836,3900,193,257,705,769,1217,1281,1729,1793,2241,2305,2753,2817,3265,3329,3777,3841,197,261,709,773,1221,1285,1733,1797,2245,2309,2757,2821,3269,3333,3781,3845,201,265,713,777,1225,1289,1737,1801,2249,2313,2761,2825,3273,3337,3785,3849,205,269,717,781,1229,1293,1741,1805,2253,2317,2765,2829,3277,3341,3789,3853,209,273,721,785,1233,1297,1745,1809,2257,2321,2769,2833,3281,3345,3793,3857,213,277,725,789,1237,1301,1749,1813,2261,2325,2773,2837,3285,3349,3797,3861,217,281,729,793,1241,1305,1753,1817,2265,2329,2777,2841,3289,3353,3801,3865,221,285,733,797,1245,1309,1757,1821,2269,2333,2781,2845,3293,3357,3805,3869,225,289,737,801,1249,1313,1761,1825,2273,2337,2785,2849,3297,3361,3809,3873,229,293,741,805,1253,1317,1765,1829,2277,2341,2789,2853,3301,3365,3813,3877,233,297,745,809,1257,1321,1769,1833,2281,2345,2793,2857,3305,3369,3817,3881,237,301,749,813,1261,1325,1773,1837,2285,2349,2797,2861,3309,3373,3821,3885,241,305,753,817,1265,1329,1777,1841,2289,2353,2801,2865,3313,3377,3825,3889,245,309,757,821,1269,1333,1781,1845,2293,2357,2805,2869,3317,3381,3829,3893,249,313,761,825,1273,1337,1785,1849,2297,2361,2809,2873,3321,3385,3833,3897,253,317,765,829,1277,1341,1789,1853,2301,2365,2813,2877,3325,3389,3837,3901,194,258,706,770,1218,1282,1730,1794,2242,2306,2754,2818,3266,3330,3778,3842,198,262,710,774,1222,1286,1734,1798,2246,2310,2758,2822,3270,3334,3782,3846,202,266,714,778,1226,1290,1738,1802,2250,2314,2762,2826,3274,3338,3786,3850,206,270,718,782,1230,1294,1742,1806,2254,2318,2766,2830,3278,3342,3790,3854,210,274,722,786,1234,1298,1746,1810,2258,2322,2770,2834,3282,3346,3794,3858,214,278,726,790,1238,1302,1750,1814,2262,2326,2774,2838,3286,3350,3798,3862,218,282,730,794,1242,1306,1754,1818,2266,2330,2778,2842,3290,3354,3802,3866,222,286,734,798,1246,1310,1758,1822,2270,2334,2782,2846,3294,3358,3806,3870,226,290,738,802,1250,1314,1762,1826,2274,2338,2786,2850,3298,3362,3810,3874,230,294,742,806,1254,1318,1766,1830,2278,2342,2790,2854,3302,3366,3814,3878,234,298,746,810,1258,1322,1770,1834,2282,2346,2794,2858,3306,3370,3818,3882,238,302,750,814,1262,1326,1774,1838,2286,2350,2798,2862,3310,3374,3822,3886,242,306,754,818,1266,1330,1778,1842,2290,2354,2802,2866,3314,3378,3826,3890,246,310,758,822,1270,1334,1782,1846,2294,2358,2806,2870,3318,3382,3830,3894,250,314,762,826,1274,1338,1786,1850,2298,2362,2810,2874,3322,3386,3834,3898,254,318,766,830,1278,1342,1790,1854,2302,2366,2814,2878,3326,3390,3838,3902,195,259,707,771,1219,1283,1731,1795,2243,2307,2755,2819,3267,3331,3779,3843,199,263,711,775,1223,1287,1735,1799,2247,2311,2759,2823,3271,3335,3783,3847,203,267,715,779,1227,1291,1739,1803,2251,2315,2763,2827,3275,3339,3787,3851,207,271,719,783,1231,1295,1743,1807,2255,2319,2767,2831,3279,3343,3791,3855,211,275,723,787,1235,1299,1747,1811,2259,2323,2771,2835,3283,3347,3795,3859,215,279,727,791,1239,1303,1751,1815,2263,2327,2775,2839,3287,3351,3799,3863,219,283,731,795,1243,1307,1755,1819,2267,2331,2779,2843,3291,3355,3803,3867,223,287,735,799,1247,1311,1759,1823,2271,2335,2783,2847,3295,3359,3807,3871,227,291,739,803,1251,1315,1763,1827,2275,2339,2787,2851,3299,3363,3811,3875,231,295,743,807,1255,1319,1767,1831,2279,2343,2791,2855,3303,3367,3815,3879,235,299,747,811,1259,1323,1771,1835,2283,2347,2795,2859,3307,3371,3819,3883,239,303,751,815,1263,1327,1775,1839,2287,2351,2799,2863,3311,3375,3823,3887,243,307,755,819,1267,1331,1779,1843,2291,2355,2803,2867,3315,3379,3827,3891,247,311,759,823,1271,1335,1783,1847,2295,2359,2807,2871,3319,3383,3831,3895,251,315,763,827,1275,1339,1787,1851,2299,2363,2811,2875,3323,3387,3835,3899,255,319,767,831,1279,1343,1791,1855,2303,2367,2815,2879,3327,3391,3839,3903 7 | }; 8 | #endif 9 | -------------------------------------------------------------------------------- /image/imgtable.h: -------------------------------------------------------------------------------- 1 | #ifndef NA_IMAGE_TABLE_H_ 2 | #define NA_IMAGE_TABLE_H_ 3 | #define IMG_LUT_WIDTH 64 4 | #define IMG_LUT_HEIGHT 64 5 | static const uint16_t LUTFromApt[64][64] = { 6 | 0,256,512,768,16,272,528,784,32,288,544,800,48,304,560,816,64,320,576,832,80,336,592,848,96,352,608,864,112,368,624,880,128,384,640,896,144,400,656,912,160,416,672,928,176,432,688,944,192,448,704,960,208,464,720,976,224,480,736,992,240,496,752,1008, 7 | 1024,1280,1536,1792,1040,1296,1552,1808,1056,1312,1568,1824,1072,1328,1584,1840,1088,1344,1600,1856,1104,1360,1616,1872,1120,1376,1632,1888,1136,1392,1648,1904,1152,1408,1664,1920,1168,1424,1680,1936,1184,1440,1696,1952,1200,1456,1712,1968,1216,1472,1728,1984,1232,1488,1744,2000,1248,1504,1760,2016,1264,1520,1776,2032, 8 | 2048,2304,2560,2816,2064,2320,2576,2832,2080,2336,2592,2848,2096,2352,2608,2864,2112,2368,2624,2880,2128,2384,2640,2896,2144,2400,2656,2912,2160,2416,2672,2928,2176,2432,2688,2944,2192,2448,2704,2960,2208,2464,2720,2976,2224,2480,2736,2992,2240,2496,2752,3008,2256,2512,2768,3024,2272,2528,2784,3040,2288,2544,2800,3056, 9 | 3072,3328,3584,3840,3088,3344,3600,3856,3104,3360,3616,3872,3120,3376,3632,3888,3136,3392,3648,3904,3152,3408,3664,3920,3168,3424,3680,3936,3184,3440,3696,3952,3200,3456,3712,3968,3216,3472,3728,3984,3232,3488,3744,4000,3248,3504,3760,4016,3264,3520,3776,4032,3280,3536,3792,4048,3296,3552,3808,4064,3312,3568,3824,4080, 10 | 3073,3329,3585,3841,3089,3345,3601,3857,3105,3361,3617,3873,3121,3377,3633,3889,3137,3393,3649,3905,3153,3409,3665,3921,3169,3425,3681,3937,3185,3441,3697,3953,3201,3457,3713,3969,3217,3473,3729,3985,3233,3489,3745,4001,3249,3505,3761,4017,3265,3521,3777,4033,3281,3537,3793,4049,3297,3553,3809,4065,3313,3569,3825,4081, 11 | 2049,2305,2561,2817,2065,2321,2577,2833,2081,2337,2593,2849,2097,2353,2609,2865,2113,2369,2625,2881,2129,2385,2641,2897,2145,2401,2657,2913,2161,2417,2673,2929,2177,2433,2689,2945,2193,2449,2705,2961,2209,2465,2721,2977,2225,2481,2737,2993,2241,2497,2753,3009,2257,2513,2769,3025,2273,2529,2785,3041,2289,2545,2801,3057, 12 | 1025,1281,1537,1793,1041,1297,1553,1809,1057,1313,1569,1825,1073,1329,1585,1841,1089,1345,1601,1857,1105,1361,1617,1873,1121,1377,1633,1889,1137,1393,1649,1905,1153,1409,1665,1921,1169,1425,1681,1937,1185,1441,1697,1953,1201,1457,1713,1969,1217,1473,1729,1985,1233,1489,1745,2001,1249,1505,1761,2017,1265,1521,1777,2033, 13 | 1,257,513,769,17,273,529,785,33,289,545,801,49,305,561,817,65,321,577,833,81,337,593,849,97,353,609,865,113,369,625,881,129,385,641,897,145,401,657,913,161,417,673,929,177,433,689,945,193,449,705,961,209,465,721,977,225,481,737,993,241,497,753,1009, 14 | 2,258,514,770,18,274,530,786,34,290,546,802,50,306,562,818,66,322,578,834,82,338,594,850,98,354,610,866,114,370,626,882,130,386,642,898,146,402,658,914,162,418,674,930,178,434,690,946,194,450,706,962,210,466,722,978,226,482,738,994,242,498,754,1010, 15 | 1026,1282,1538,1794,1042,1298,1554,1810,1058,1314,1570,1826,1074,1330,1586,1842,1090,1346,1602,1858,1106,1362,1618,1874,1122,1378,1634,1890,1138,1394,1650,1906,1154,1410,1666,1922,1170,1426,1682,1938,1186,1442,1698,1954,1202,1458,1714,1970,1218,1474,1730,1986,1234,1490,1746,2002,1250,1506,1762,2018,1266,1522,1778,2034, 16 | 2050,2306,2562,2818,2066,2322,2578,2834,2082,2338,2594,2850,2098,2354,2610,2866,2114,2370,2626,2882,2130,2386,2642,2898,2146,2402,2658,2914,2162,2418,2674,2930,2178,2434,2690,2946,2194,2450,2706,2962,2210,2466,2722,2978,2226,2482,2738,2994,2242,2498,2754,3010,2258,2514,2770,3026,2274,2530,2786,3042,2290,2546,2802,3058, 17 | 3074,3330,3586,3842,3090,3346,3602,3858,3106,3362,3618,3874,3122,3378,3634,3890,3138,3394,3650,3906,3154,3410,3666,3922,3170,3426,3682,3938,3186,3442,3698,3954,3202,3458,3714,3970,3218,3474,3730,3986,3234,3490,3746,4002,3250,3506,3762,4018,3266,3522,3778,4034,3282,3538,3794,4050,3298,3554,3810,4066,3314,3570,3826,4082, 18 | 3075,3331,3587,3843,3091,3347,3603,3859,3107,3363,3619,3875,3123,3379,3635,3891,3139,3395,3651,3907,3155,3411,3667,3923,3171,3427,3683,3939,3187,3443,3699,3955,3203,3459,3715,3971,3219,3475,3731,3987,3235,3491,3747,4003,3251,3507,3763,4019,3267,3523,3779,4035,3283,3539,3795,4051,3299,3555,3811,4067,3315,3571,3827,4083, 19 | 2051,2307,2563,2819,2067,2323,2579,2835,2083,2339,2595,2851,2099,2355,2611,2867,2115,2371,2627,2883,2131,2387,2643,2899,2147,2403,2659,2915,2163,2419,2675,2931,2179,2435,2691,2947,2195,2451,2707,2963,2211,2467,2723,2979,2227,2483,2739,2995,2243,2499,2755,3011,2259,2515,2771,3027,2275,2531,2787,3043,2291,2547,2803,3059, 20 | 1027,1283,1539,1795,1043,1299,1555,1811,1059,1315,1571,1827,1075,1331,1587,1843,1091,1347,1603,1859,1107,1363,1619,1875,1123,1379,1635,1891,1139,1395,1651,1907,1155,1411,1667,1923,1171,1427,1683,1939,1187,1443,1699,1955,1203,1459,1715,1971,1219,1475,1731,1987,1235,1491,1747,2003,1251,1507,1763,2019,1267,1523,1779,2035, 21 | 3,259,515,771,19,275,531,787,35,291,547,803,51,307,563,819,67,323,579,835,83,339,595,851,99,355,611,867,115,371,627,883,131,387,643,899,147,403,659,915,163,419,675,931,179,435,691,947,195,451,707,963,211,467,723,979,227,483,739,995,243,499,755,1011, 22 | 4,260,516,772,20,276,532,788,36,292,548,804,52,308,564,820,68,324,580,836,84,340,596,852,100,356,612,868,116,372,628,884,132,388,644,900,148,404,660,916,164,420,676,932,180,436,692,948,196,452,708,964,212,468,724,980,228,484,740,996,244,500,756,1012, 23 | 1028,1284,1540,1796,1044,1300,1556,1812,1060,1316,1572,1828,1076,1332,1588,1844,1092,1348,1604,1860,1108,1364,1620,1876,1124,1380,1636,1892,1140,1396,1652,1908,1156,1412,1668,1924,1172,1428,1684,1940,1188,1444,1700,1956,1204,1460,1716,1972,1220,1476,1732,1988,1236,1492,1748,2004,1252,1508,1764,2020,1268,1524,1780,2036, 24 | 2052,2308,2564,2820,2068,2324,2580,2836,2084,2340,2596,2852,2100,2356,2612,2868,2116,2372,2628,2884,2132,2388,2644,2900,2148,2404,2660,2916,2164,2420,2676,2932,2180,2436,2692,2948,2196,2452,2708,2964,2212,2468,2724,2980,2228,2484,2740,2996,2244,2500,2756,3012,2260,2516,2772,3028,2276,2532,2788,3044,2292,2548,2804,3060, 25 | 3076,3332,3588,3844,3092,3348,3604,3860,3108,3364,3620,3876,3124,3380,3636,3892,3140,3396,3652,3908,3156,3412,3668,3924,3172,3428,3684,3940,3188,3444,3700,3956,3204,3460,3716,3972,3220,3476,3732,3988,3236,3492,3748,4004,3252,3508,3764,4020,3268,3524,3780,4036,3284,3540,3796,4052,3300,3556,3812,4068,3316,3572,3828,4084, 26 | 3077,3333,3589,3845,3093,3349,3605,3861,3109,3365,3621,3877,3125,3381,3637,3893,3141,3397,3653,3909,3157,3413,3669,3925,3173,3429,3685,3941,3189,3445,3701,3957,3205,3461,3717,3973,3221,3477,3733,3989,3237,3493,3749,4005,3253,3509,3765,4021,3269,3525,3781,4037,3285,3541,3797,4053,3301,3557,3813,4069,3317,3573,3829,4085, 27 | 2053,2309,2565,2821,2069,2325,2581,2837,2085,2341,2597,2853,2101,2357,2613,2869,2117,2373,2629,2885,2133,2389,2645,2901,2149,2405,2661,2917,2165,2421,2677,2933,2181,2437,2693,2949,2197,2453,2709,2965,2213,2469,2725,2981,2229,2485,2741,2997,2245,2501,2757,3013,2261,2517,2773,3029,2277,2533,2789,3045,2293,2549,2805,3061, 28 | 1029,1285,1541,1797,1045,1301,1557,1813,1061,1317,1573,1829,1077,1333,1589,1845,1093,1349,1605,1861,1109,1365,1621,1877,1125,1381,1637,1893,1141,1397,1653,1909,1157,1413,1669,1925,1173,1429,1685,1941,1189,1445,1701,1957,1205,1461,1717,1973,1221,1477,1733,1989,1237,1493,1749,2005,1253,1509,1765,2021,1269,1525,1781,2037, 29 | 5,261,517,773,21,277,533,789,37,293,549,805,53,309,565,821,69,325,581,837,85,341,597,853,101,357,613,869,117,373,629,885,133,389,645,901,149,405,661,917,165,421,677,933,181,437,693,949,197,453,709,965,213,469,725,981,229,485,741,997,245,501,757,1013, 30 | 6,262,518,774,22,278,534,790,38,294,550,806,54,310,566,822,70,326,582,838,86,342,598,854,102,358,614,870,118,374,630,886,134,390,646,902,150,406,662,918,166,422,678,934,182,438,694,950,198,454,710,966,214,470,726,982,230,486,742,998,246,502,758,1014, 31 | 1030,1286,1542,1798,1046,1302,1558,1814,1062,1318,1574,1830,1078,1334,1590,1846,1094,1350,1606,1862,1110,1366,1622,1878,1126,1382,1638,1894,1142,1398,1654,1910,1158,1414,1670,1926,1174,1430,1686,1942,1190,1446,1702,1958,1206,1462,1718,1974,1222,1478,1734,1990,1238,1494,1750,2006,1254,1510,1766,2022,1270,1526,1782,2038, 32 | 2054,2310,2566,2822,2070,2326,2582,2838,2086,2342,2598,2854,2102,2358,2614,2870,2118,2374,2630,2886,2134,2390,2646,2902,2150,2406,2662,2918,2166,2422,2678,2934,2182,2438,2694,2950,2198,2454,2710,2966,2214,2470,2726,2982,2230,2486,2742,2998,2246,2502,2758,3014,2262,2518,2774,3030,2278,2534,2790,3046,2294,2550,2806,3062, 33 | 3078,3334,3590,3846,3094,3350,3606,3862,3110,3366,3622,3878,3126,3382,3638,3894,3142,3398,3654,3910,3158,3414,3670,3926,3174,3430,3686,3942,3190,3446,3702,3958,3206,3462,3718,3974,3222,3478,3734,3990,3238,3494,3750,4006,3254,3510,3766,4022,3270,3526,3782,4038,3286,3542,3798,4054,3302,3558,3814,4070,3318,3574,3830,4086, 34 | 3079,3335,3591,3847,3095,3351,3607,3863,3111,3367,3623,3879,3127,3383,3639,3895,3143,3399,3655,3911,3159,3415,3671,3927,3175,3431,3687,3943,3191,3447,3703,3959,3207,3463,3719,3975,3223,3479,3735,3991,3239,3495,3751,4007,3255,3511,3767,4023,3271,3527,3783,4039,3287,3543,3799,4055,3303,3559,3815,4071,3319,3575,3831,4087, 35 | 2055,2311,2567,2823,2071,2327,2583,2839,2087,2343,2599,2855,2103,2359,2615,2871,2119,2375,2631,2887,2135,2391,2647,2903,2151,2407,2663,2919,2167,2423,2679,2935,2183,2439,2695,2951,2199,2455,2711,2967,2215,2471,2727,2983,2231,2487,2743,2999,2247,2503,2759,3015,2263,2519,2775,3031,2279,2535,2791,3047,2295,2551,2807,3063, 36 | 1031,1287,1543,1799,1047,1303,1559,1815,1063,1319,1575,1831,1079,1335,1591,1847,1095,1351,1607,1863,1111,1367,1623,1879,1127,1383,1639,1895,1143,1399,1655,1911,1159,1415,1671,1927,1175,1431,1687,1943,1191,1447,1703,1959,1207,1463,1719,1975,1223,1479,1735,1991,1239,1495,1751,2007,1255,1511,1767,2023,1271,1527,1783,2039, 37 | 7,263,519,775,23,279,535,791,39,295,551,807,55,311,567,823,71,327,583,839,87,343,599,855,103,359,615,871,119,375,631,887,135,391,647,903,151,407,663,919,167,423,679,935,183,439,695,951,199,455,711,967,215,471,727,983,231,487,743,999,247,503,759,1015, 38 | 8,264,520,776,24,280,536,792,40,296,552,808,56,312,568,824,72,328,584,840,88,344,600,856,104,360,616,872,120,376,632,888,136,392,648,904,152,408,664,920,168,424,680,936,184,440,696,952,200,456,712,968,216,472,728,984,232,488,744,1000,248,504,760,1016, 39 | 1032,1288,1544,1800,1048,1304,1560,1816,1064,1320,1576,1832,1080,1336,1592,1848,1096,1352,1608,1864,1112,1368,1624,1880,1128,1384,1640,1896,1144,1400,1656,1912,1160,1416,1672,1928,1176,1432,1688,1944,1192,1448,1704,1960,1208,1464,1720,1976,1224,1480,1736,1992,1240,1496,1752,2008,1256,1512,1768,2024,1272,1528,1784,2040, 40 | 2056,2312,2568,2824,2072,2328,2584,2840,2088,2344,2600,2856,2104,2360,2616,2872,2120,2376,2632,2888,2136,2392,2648,2904,2152,2408,2664,2920,2168,2424,2680,2936,2184,2440,2696,2952,2200,2456,2712,2968,2216,2472,2728,2984,2232,2488,2744,3000,2248,2504,2760,3016,2264,2520,2776,3032,2280,2536,2792,3048,2296,2552,2808,3064, 41 | 3080,3336,3592,3848,3096,3352,3608,3864,3112,3368,3624,3880,3128,3384,3640,3896,3144,3400,3656,3912,3160,3416,3672,3928,3176,3432,3688,3944,3192,3448,3704,3960,3208,3464,3720,3976,3224,3480,3736,3992,3240,3496,3752,4008,3256,3512,3768,4024,3272,3528,3784,4040,3288,3544,3800,4056,3304,3560,3816,4072,3320,3576,3832,4088, 42 | 3081,3337,3593,3849,3097,3353,3609,3865,3113,3369,3625,3881,3129,3385,3641,3897,3145,3401,3657,3913,3161,3417,3673,3929,3177,3433,3689,3945,3193,3449,3705,3961,3209,3465,3721,3977,3225,3481,3737,3993,3241,3497,3753,4009,3257,3513,3769,4025,3273,3529,3785,4041,3289,3545,3801,4057,3305,3561,3817,4073,3321,3577,3833,4089, 43 | 2057,2313,2569,2825,2073,2329,2585,2841,2089,2345,2601,2857,2105,2361,2617,2873,2121,2377,2633,2889,2137,2393,2649,2905,2153,2409,2665,2921,2169,2425,2681,2937,2185,2441,2697,2953,2201,2457,2713,2969,2217,2473,2729,2985,2233,2489,2745,3001,2249,2505,2761,3017,2265,2521,2777,3033,2281,2537,2793,3049,2297,2553,2809,3065, 44 | 1033,1289,1545,1801,1049,1305,1561,1817,1065,1321,1577,1833,1081,1337,1593,1849,1097,1353,1609,1865,1113,1369,1625,1881,1129,1385,1641,1897,1145,1401,1657,1913,1161,1417,1673,1929,1177,1433,1689,1945,1193,1449,1705,1961,1209,1465,1721,1977,1225,1481,1737,1993,1241,1497,1753,2009,1257,1513,1769,2025,1273,1529,1785,2041, 45 | 9,265,521,777,25,281,537,793,41,297,553,809,57,313,569,825,73,329,585,841,89,345,601,857,105,361,617,873,121,377,633,889,137,393,649,905,153,409,665,921,169,425,681,937,185,441,697,953,201,457,713,969,217,473,729,985,233,489,745,1001,249,505,761,1017, 46 | 10,266,522,778,26,282,538,794,42,298,554,810,58,314,570,826,74,330,586,842,90,346,602,858,106,362,618,874,122,378,634,890,138,394,650,906,154,410,666,922,170,426,682,938,186,442,698,954,202,458,714,970,218,474,730,986,234,490,746,1002,250,506,762,1018, 47 | 1034,1290,1546,1802,1050,1306,1562,1818,1066,1322,1578,1834,1082,1338,1594,1850,1098,1354,1610,1866,1114,1370,1626,1882,1130,1386,1642,1898,1146,1402,1658,1914,1162,1418,1674,1930,1178,1434,1690,1946,1194,1450,1706,1962,1210,1466,1722,1978,1226,1482,1738,1994,1242,1498,1754,2010,1258,1514,1770,2026,1274,1530,1786,2042, 48 | 2058,2314,2570,2826,2074,2330,2586,2842,2090,2346,2602,2858,2106,2362,2618,2874,2122,2378,2634,2890,2138,2394,2650,2906,2154,2410,2666,2922,2170,2426,2682,2938,2186,2442,2698,2954,2202,2458,2714,2970,2218,2474,2730,2986,2234,2490,2746,3002,2250,2506,2762,3018,2266,2522,2778,3034,2282,2538,2794,3050,2298,2554,2810,3066, 49 | 3082,3338,3594,3850,3098,3354,3610,3866,3114,3370,3626,3882,3130,3386,3642,3898,3146,3402,3658,3914,3162,3418,3674,3930,3178,3434,3690,3946,3194,3450,3706,3962,3210,3466,3722,3978,3226,3482,3738,3994,3242,3498,3754,4010,3258,3514,3770,4026,3274,3530,3786,4042,3290,3546,3802,4058,3306,3562,3818,4074,3322,3578,3834,4090, 50 | 3083,3339,3595,3851,3099,3355,3611,3867,3115,3371,3627,3883,3131,3387,3643,3899,3147,3403,3659,3915,3163,3419,3675,3931,3179,3435,3691,3947,3195,3451,3707,3963,3211,3467,3723,3979,3227,3483,3739,3995,3243,3499,3755,4011,3259,3515,3771,4027,3275,3531,3787,4043,3291,3547,3803,4059,3307,3563,3819,4075,3323,3579,3835,4091, 51 | 2059,2315,2571,2827,2075,2331,2587,2843,2091,2347,2603,2859,2107,2363,2619,2875,2123,2379,2635,2891,2139,2395,2651,2907,2155,2411,2667,2923,2171,2427,2683,2939,2187,2443,2699,2955,2203,2459,2715,2971,2219,2475,2731,2987,2235,2491,2747,3003,2251,2507,2763,3019,2267,2523,2779,3035,2283,2539,2795,3051,2299,2555,2811,3067, 52 | 1035,1291,1547,1803,1051,1307,1563,1819,1067,1323,1579,1835,1083,1339,1595,1851,1099,1355,1611,1867,1115,1371,1627,1883,1131,1387,1643,1899,1147,1403,1659,1915,1163,1419,1675,1931,1179,1435,1691,1947,1195,1451,1707,1963,1211,1467,1723,1979,1227,1483,1739,1995,1243,1499,1755,2011,1259,1515,1771,2027,1275,1531,1787,2043, 53 | 11,267,523,779,27,283,539,795,43,299,555,811,59,315,571,827,75,331,587,843,91,347,603,859,107,363,619,875,123,379,635,891,139,395,651,907,155,411,667,923,171,427,683,939,187,443,699,955,203,459,715,971,219,475,731,987,235,491,747,1003,251,507,763,1019, 54 | 12,268,524,780,28,284,540,796,44,300,556,812,60,316,572,828,76,332,588,844,92,348,604,860,108,364,620,876,124,380,636,892,140,396,652,908,156,412,668,924,172,428,684,940,188,444,700,956,204,460,716,972,220,476,732,988,236,492,748,1004,252,508,764,1020, 55 | 1036,1292,1548,1804,1052,1308,1564,1820,1068,1324,1580,1836,1084,1340,1596,1852,1100,1356,1612,1868,1116,1372,1628,1884,1132,1388,1644,1900,1148,1404,1660,1916,1164,1420,1676,1932,1180,1436,1692,1948,1196,1452,1708,1964,1212,1468,1724,1980,1228,1484,1740,1996,1244,1500,1756,2012,1260,1516,1772,2028,1276,1532,1788,2044, 56 | 2060,2316,2572,2828,2076,2332,2588,2844,2092,2348,2604,2860,2108,2364,2620,2876,2124,2380,2636,2892,2140,2396,2652,2908,2156,2412,2668,2924,2172,2428,2684,2940,2188,2444,2700,2956,2204,2460,2716,2972,2220,2476,2732,2988,2236,2492,2748,3004,2252,2508,2764,3020,2268,2524,2780,3036,2284,2540,2796,3052,2300,2556,2812,3068, 57 | 3084,3340,3596,3852,3100,3356,3612,3868,3116,3372,3628,3884,3132,3388,3644,3900,3148,3404,3660,3916,3164,3420,3676,3932,3180,3436,3692,3948,3196,3452,3708,3964,3212,3468,3724,3980,3228,3484,3740,3996,3244,3500,3756,4012,3260,3516,3772,4028,3276,3532,3788,4044,3292,3548,3804,4060,3308,3564,3820,4076,3324,3580,3836,4092, 58 | 3085,3341,3597,3853,3101,3357,3613,3869,3117,3373,3629,3885,3133,3389,3645,3901,3149,3405,3661,3917,3165,3421,3677,3933,3181,3437,3693,3949,3197,3453,3709,3965,3213,3469,3725,3981,3229,3485,3741,3997,3245,3501,3757,4013,3261,3517,3773,4029,3277,3533,3789,4045,3293,3549,3805,4061,3309,3565,3821,4077,3325,3581,3837,4093, 59 | 2061,2317,2573,2829,2077,2333,2589,2845,2093,2349,2605,2861,2109,2365,2621,2877,2125,2381,2637,2893,2141,2397,2653,2909,2157,2413,2669,2925,2173,2429,2685,2941,2189,2445,2701,2957,2205,2461,2717,2973,2221,2477,2733,2989,2237,2493,2749,3005,2253,2509,2765,3021,2269,2525,2781,3037,2285,2541,2797,3053,2301,2557,2813,3069, 60 | 1037,1293,1549,1805,1053,1309,1565,1821,1069,1325,1581,1837,1085,1341,1597,1853,1101,1357,1613,1869,1117,1373,1629,1885,1133,1389,1645,1901,1149,1405,1661,1917,1165,1421,1677,1933,1181,1437,1693,1949,1197,1453,1709,1965,1213,1469,1725,1981,1229,1485,1741,1997,1245,1501,1757,2013,1261,1517,1773,2029,1277,1533,1789,2045, 61 | 13,269,525,781,29,285,541,797,45,301,557,813,61,317,573,829,77,333,589,845,93,349,605,861,109,365,621,877,125,381,637,893,141,397,653,909,157,413,669,925,173,429,685,941,189,445,701,957,205,461,717,973,221,477,733,989,237,493,749,1005,253,509,765,1021, 62 | 14,270,526,782,30,286,542,798,46,302,558,814,62,318,574,830,78,334,590,846,94,350,606,862,110,366,622,878,126,382,638,894,142,398,654,910,158,414,670,926,174,430,686,942,190,446,702,958,206,462,718,974,222,478,734,990,238,494,750,1006,254,510,766,1022, 63 | 1038,1294,1550,1806,1054,1310,1566,1822,1070,1326,1582,1838,1086,1342,1598,1854,1102,1358,1614,1870,1118,1374,1630,1886,1134,1390,1646,1902,1150,1406,1662,1918,1166,1422,1678,1934,1182,1438,1694,1950,1198,1454,1710,1966,1214,1470,1726,1982,1230,1486,1742,1998,1246,1502,1758,2014,1262,1518,1774,2030,1278,1534,1790,2046, 64 | 2062,2318,2574,2830,2078,2334,2590,2846,2094,2350,2606,2862,2110,2366,2622,2878,2126,2382,2638,2894,2142,2398,2654,2910,2158,2414,2670,2926,2174,2430,2686,2942,2190,2446,2702,2958,2206,2462,2718,2974,2222,2478,2734,2990,2238,2494,2750,3006,2254,2510,2766,3022,2270,2526,2782,3038,2286,2542,2798,3054,2302,2558,2814,3070, 65 | 3086,3342,3598,3854,3102,3358,3614,3870,3118,3374,3630,3886,3134,3390,3646,3902,3150,3406,3662,3918,3166,3422,3678,3934,3182,3438,3694,3950,3198,3454,3710,3966,3214,3470,3726,3982,3230,3486,3742,3998,3246,3502,3758,4014,3262,3518,3774,4030,3278,3534,3790,4046,3294,3550,3806,4062,3310,3566,3822,4078,3326,3582,3838,4094, 66 | 3087,3343,3599,3855,3103,3359,3615,3871,3119,3375,3631,3887,3135,3391,3647,3903,3151,3407,3663,3919,3167,3423,3679,3935,3183,3439,3695,3951,3199,3455,3711,3967,3215,3471,3727,3983,3231,3487,3743,3999,3247,3503,3759,4015,3263,3519,3775,4031,3279,3535,3791,4047,3295,3551,3807,4063,3311,3567,3823,4079,3327,3583,3839,4095, 67 | 2063,2319,2575,2831,2079,2335,2591,2847,2095,2351,2607,2863,2111,2367,2623,2879,2127,2383,2639,2895,2143,2399,2655,2911,2159,2415,2671,2927,2175,2431,2687,2943,2191,2447,2703,2959,2207,2463,2719,2975,2223,2479,2735,2991,2239,2495,2751,3007,2255,2511,2767,3023,2271,2527,2783,3039,2287,2543,2799,3055,2303,2559,2815,3071, 68 | 1039,1295,1551,1807,1055,1311,1567,1823,1071,1327,1583,1839,1087,1343,1599,1855,1103,1359,1615,1871,1119,1375,1631,1887,1135,1391,1647,1903,1151,1407,1663,1919,1167,1423,1679,1935,1183,1439,1695,1951,1199,1455,1711,1967,1215,1471,1727,1983,1231,1487,1743,1999,1247,1503,1759,2015,1263,1519,1775,2031,1279,1535,1791,2047, 69 | 15,271,527,783,31,287,543,799,47,303,559,815,63,319,575,831,79,335,591,847,95,351,607,863,111,367,623,879,127,383,639,895,143,399,655,911,159,415,671,927,175,431,687,943,191,447,703,959,207,463,719,975,223,479,735,991,239,495,751,1007,255,511,767,1023 70 | }; 71 | #endif 72 | -------------------------------------------------------------------------------- /COPYING: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 2, June 1991 3 | 4 | Copyright (C) 1989, 1991 Free Software Foundation, Inc. 5 | 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA 6 | Everyone is permitted to copy and distribute verbatim copies 7 | of this license document, but changing it is not allowed. 8 | 9 | Preamble 10 | 11 | The licenses for most software are designed to take away your 12 | freedom to share and change it. By contrast, the GNU General Public 13 | License is intended to guarantee your freedom to share and change free 14 | software--to make sure the software is free for all its users. This 15 | General Public License applies to most of the Free Software 16 | Foundation's software and to any other program whose authors commit to 17 | using it. (Some other Free Software Foundation software is covered by 18 | the GNU Library General Public License instead.) You can apply it to 19 | your programs, too. 20 | 21 | When we speak of free software, we are referring to freedom, not 22 | price. Our General Public Licenses are designed to make sure that you 23 | have the freedom to distribute copies of free software (and charge for 24 | this service if you wish), that you receive source code or can get it 25 | if you want it, that you can change the software or use pieces of it 26 | in new free programs; and that you know you can do these things. 27 | 28 | To protect your rights, we need to make restrictions that forbid 29 | anyone to deny you these rights or to ask you to surrender the rights. 30 | These restrictions translate to certain responsibilities for you if you 31 | distribute copies of the software, or if you modify it. 32 | 33 | For example, if you distribute copies of such a program, whether 34 | gratis or for a fee, you must give the recipients all the rights that 35 | you have. You must make sure that they, too, receive or can get the 36 | source code. And you must show them these terms so they know their 37 | rights. 38 | 39 | We protect your rights with two steps: (1) copyright the software, and 40 | (2) offer you this license which gives you legal permission to copy, 41 | distribute and/or modify the software. 42 | 43 | Also, for each author's protection and ours, we want to make certain 44 | that everyone understands that there is no warranty for this free 45 | software. If the software is modified by someone else and passed on, we 46 | want its recipients to know that what they have is not the original, so 47 | that any problems introduced by others will not reflect on the original 48 | authors' reputations. 49 | 50 | Finally, any free program is threatened constantly by software 51 | patents. We wish to avoid the danger that redistributors of a free 52 | program will individually obtain patent licenses, in effect making the 53 | program proprietary. To prevent this, we have made it clear that any 54 | patent must be licensed for everyone's free use or not licensed at all. 55 | 56 | The precise terms and conditions for copying, distribution and 57 | modification follow. 58 | 59 | GNU GENERAL PUBLIC LICENSE 60 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 61 | 62 | 0. This License applies to any program or other work which contains 63 | a notice placed by the copyright holder saying it may be distributed 64 | under the terms of this General Public License. The "Program", below, 65 | refers to any such program or work, and a "work based on the Program" 66 | means either the Program or any derivative work under copyright law: 67 | that is to say, a work containing the Program or a portion of it, 68 | either verbatim or with modifications and/or translated into another 69 | language. (Hereinafter, translation is included without limitation in 70 | the term "modification".) Each licensee is addressed as "you". 71 | 72 | Activities other than copying, distribution and modification are not 73 | covered by this License; they are outside its scope. The act of 74 | running the Program is not restricted, and the output from the Program 75 | is covered only if its contents constitute a work based on the 76 | Program (independent of having been made by running the Program). 77 | Whether that is true depends on what the Program does. 78 | 79 | 1. You may copy and distribute verbatim copies of the Program's 80 | source code as you receive it, in any medium, provided that you 81 | conspicuously and appropriately publish on each copy an appropriate 82 | copyright notice and disclaimer of warranty; keep intact all the 83 | notices that refer to this License and to the absence of any warranty; 84 | and give any other recipients of the Program a copy of this License 85 | along with the Program. 86 | 87 | You may charge a fee for the physical act of transferring a copy, and 88 | you may at your option offer warranty protection in exchange for a fee. 89 | 90 | 2. You may modify your copy or copies of the Program or any portion 91 | of it, thus forming a work based on the Program, and copy and 92 | distribute such modifications or work under the terms of Section 1 93 | above, provided that you also meet all of these conditions: 94 | 95 | a) You must cause the modified files to carry prominent notices 96 | stating that you changed the files and the date of any change. 97 | 98 | b) You must cause any work that you distribute or publish, that in 99 | whole or in part contains or is derived from the Program or any 100 | part thereof, to be licensed as a whole at no charge to all third 101 | parties under the terms of this License. 102 | 103 | c) If the modified program normally reads commands interactively 104 | when run, you must cause it, when started running for such 105 | interactive use in the most ordinary way, to print or display an 106 | announcement including an appropriate copyright notice and a 107 | notice that there is no warranty (or else, saying that you provide 108 | a warranty) and that users may redistribute the program under 109 | these conditions, and telling the user how to view a copy of this 110 | License. (Exception: if the Program itself is interactive but 111 | does not normally print such an announcement, your work based on 112 | the Program is not required to print an announcement.) 113 | 114 | These requirements apply to the modified work as a whole. If 115 | identifiable sections of that work are not derived from the Program, 116 | and can be reasonably considered independent and separate works in 117 | themselves, then this License, and its terms, do not apply to those 118 | sections when you distribute them as separate works. But when you 119 | distribute the same sections as part of a whole which is a work based 120 | on the Program, the distribution of the whole must be on the terms of 121 | this License, whose permissions for other licensees extend to the 122 | entire whole, and thus to each and every part regardless of who wrote it. 123 | 124 | Thus, it is not the intent of this section to claim rights or contest 125 | your rights to work written entirely by you; rather, the intent is to 126 | exercise the right to control the distribution of derivative or 127 | collective works based on the Program. 128 | 129 | In addition, mere aggregation of another work not based on the Program 130 | with the Program (or with a work based on the Program) on a volume of 131 | a storage or distribution medium does not bring the other work under 132 | the scope of this License. 133 | 134 | 3. You may copy and distribute the Program (or a work based on it, 135 | under Section 2) in object code or executable form under the terms of 136 | Sections 1 and 2 above provided that you also do one of the following: 137 | 138 | a) Accompany it with the complete corresponding machine-readable 139 | source code, which must be distributed under the terms of Sections 140 | 1 and 2 above on a medium customarily used for software interchange; or, 141 | 142 | b) Accompany it with a written offer, valid for at least three 143 | years, to give any third party, for a charge no more than your 144 | cost of physically performing source distribution, a complete 145 | machine-readable copy of the corresponding source code, to be 146 | distributed under the terms of Sections 1 and 2 above on a medium 147 | customarily used for software interchange; or, 148 | 149 | c) Accompany it with the information you received as to the offer 150 | to distribute corresponding source code. (This alternative is 151 | allowed only for noncommercial distribution and only if you 152 | received the program in object code or executable form with such 153 | an offer, in accord with Subsection b above.) 154 | 155 | The source code for a work means the preferred form of the work for 156 | making modifications to it. For an executable work, complete source 157 | code means all the source code for all modules it contains, plus any 158 | associated interface definition files, plus the scripts used to 159 | control compilation and installation of the executable. However, as a 160 | special exception, the source code distributed need not include 161 | anything that is normally distributed (in either source or binary 162 | form) with the major components (compiler, kernel, and so on) of the 163 | operating system on which the executable runs, unless that component 164 | itself accompanies the executable. 165 | 166 | If distribution of executable or object code is made by offering 167 | access to copy from a designated place, then offering equivalent 168 | access to copy the source code from the same place counts as 169 | distribution of the source code, even though third parties are not 170 | compelled to copy the source along with the object code. 171 | 172 | 4. You may not copy, modify, sublicense, or distribute the Program 173 | except as expressly provided under this License. Any attempt 174 | otherwise to copy, modify, sublicense or distribute the Program is 175 | void, and will automatically terminate your rights under this License. 176 | However, parties who have received copies, or rights, from you under 177 | this License will not have their licenses terminated so long as such 178 | parties remain in full compliance. 179 | 180 | 5. You are not required to accept this License, since you have not 181 | signed it. However, nothing else grants you permission to modify or 182 | distribute the Program or its derivative works. These actions are 183 | prohibited by law if you do not accept this License. Therefore, by 184 | modifying or distributing the Program (or any work based on the 185 | Program), you indicate your acceptance of this License to do so, and 186 | all its terms and conditions for copying, distributing or modifying 187 | the Program or works based on it. 188 | 189 | 6. Each time you redistribute the Program (or any work based on the 190 | Program), the recipient automatically receives a license from the 191 | original licensor to copy, distribute or modify the Program subject to 192 | these terms and conditions. You may not impose any further 193 | restrictions on the recipients' exercise of the rights granted herein. 194 | You are not responsible for enforcing compliance by third parties to 195 | this License. 196 | 197 | 7. If, as a consequence of a court judgment or allegation of patent 198 | infringement or for any other reason (not limited to patent issues), 199 | conditions are imposed on you (whether by court order, agreement or 200 | otherwise) that contradict the conditions of this License, they do not 201 | excuse you from the conditions of this License. If you cannot 202 | distribute so as to satisfy simultaneously your obligations under this 203 | License and any other pertinent obligations, then as a consequence you 204 | may not distribute the Program at all. For example, if a patent 205 | license would not permit royalty-free redistribution of the Program by 206 | all those who receive copies directly or indirectly through you, then 207 | the only way you could satisfy both it and this License would be to 208 | refrain entirely from distribution of the Program. 209 | 210 | If any portion of this section is held invalid or unenforceable under 211 | any particular circumstance, the balance of the section is intended to 212 | apply and the section as a whole is intended to apply in other 213 | circumstances. 214 | 215 | It is not the purpose of this section to induce you to infringe any 216 | patents or other property right claims or to contest validity of any 217 | such claims; this section has the sole purpose of protecting the 218 | integrity of the free software distribution system, which is 219 | implemented by public license practices. Many people have made 220 | generous contributions to the wide range of software distributed 221 | through that system in reliance on consistent application of that 222 | system; it is up to the author/donor to decide if he or she is willing 223 | to distribute software through any other system and a licensee cannot 224 | impose that choice. 225 | 226 | This section is intended to make thoroughly clear what is believed to 227 | be a consequence of the rest of this License. 228 | 229 | 8. If the distribution and/or use of the Program is restricted in 230 | certain countries either by patents or by copyrighted interfaces, the 231 | original copyright holder who places the Program under this License 232 | may add an explicit geographical distribution limitation excluding 233 | those countries, so that distribution is permitted only in or among 234 | countries not thus excluded. In such case, this License incorporates 235 | the limitation as if written in the body of this License. 236 | 237 | 9. The Free Software Foundation may publish revised and/or new versions 238 | of the General Public License from time to time. Such new versions will 239 | be similar in spirit to the present version, but may differ in detail to 240 | address new problems or concerns. 241 | 242 | Each version is given a distinguishing version number. If the Program 243 | specifies a version number of this License which applies to it and "any 244 | later version", you have the option of following the terms and conditions 245 | either of that version or of any later version published by the Free 246 | Software Foundation. If the Program does not specify a version number of 247 | this License, you may choose any version ever published by the Free Software 248 | Foundation. 249 | 250 | 10. If you wish to incorporate parts of the Program into other free 251 | programs whose distribution conditions are different, write to the author 252 | to ask for permission. For software which is copyrighted by the Free 253 | Software Foundation, write to the Free Software Foundation; we sometimes 254 | make exceptions for this. Our decision will be guided by the two goals 255 | of preserving the free status of all derivatives of our free software and 256 | of promoting the sharing and reuse of software generally. 257 | 258 | NO WARRANTY 259 | 260 | 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY 261 | FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN 262 | OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES 263 | PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED 264 | OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 265 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS 266 | TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE 267 | PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, 268 | REPAIR OR CORRECTION. 269 | 270 | 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 271 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR 272 | REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, 273 | INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING 274 | OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED 275 | TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY 276 | YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER 277 | PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE 278 | POSSIBILITY OF SUCH DAMAGES. 279 | 280 | END OF TERMS AND CONDITIONS 281 | 282 | Appendix: How to Apply These Terms to Your New Programs 283 | 284 | If you develop a new program, and you want it to be of the greatest 285 | possible use to the public, the best way to achieve this is to make it 286 | free software which everyone can redistribute and change under these terms. 287 | 288 | To do so, attach the following notices to the program. It is safest 289 | to attach them to the start of each source file to most effectively 290 | convey the exclusion of warranty; and each file should have at least 291 | the "copyright" line and a pointer to where the full notice is found. 292 | 293 | 294 | Copyright (C) 19yy 295 | 296 | This program is free software; you can redistribute it and/or modify 297 | it under the terms of the GNU General Public License as published by 298 | the Free Software Foundation; either version 2 of the License, or 299 | any later version. 300 | 301 | This program is distributed in the hope that it will be useful, 302 | but WITHOUT ANY WARRANTY; without even the implied warranty of 303 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 304 | GNU General Public License for more details. 305 | 306 | You should have received a copy of the GNU General Public License 307 | along with this program; if not, write to the Free Software 308 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 309 | 310 | Also add information on how to contact you by electronic and paper mail. 311 | 312 | If the program is interactive, make it output a short notice like this 313 | when it starts in an interactive mode: 314 | 315 | Gnomovision version 69, Copyright (C) 19yy name of author 316 | Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 317 | This is free software, and you are welcome to redistribute it 318 | under certain conditions; type `show c' for details. 319 | 320 | The hypothetical commands `show w' and `show c' should show the appropriate 321 | parts of the General Public License. Of course, the commands you use may 322 | be called something other than `show w' and `show c'; they could even be 323 | mouse-clicks or menu items--whatever suits your program. 324 | 325 | You should also get your employer (if you work as a programmer) or your 326 | school, if any, to sign a "copyright disclaimer" for the program, if 327 | necessary. Here is a sample; alter the names: 328 | 329 | Yoyodyne, Inc., hereby disclaims all copyright interest in the program 330 | `Gnomovision' (which makes passes at compilers) written by James Hacker. 331 | 332 | , 1 April 1989 333 | Ty Coon, President of Vice 334 | 335 | This General Public License does not permit incorporating your program into 336 | proprietary programs. If your program is a subroutine library, you may 337 | consider it more useful to permit linking proprietary applications with the 338 | library. If this is what you want to do, use the GNU Library General 339 | Public License instead of this License. 340 | 341 | -------------------------------------------------------------------------------- /apt-encoder.pro.user: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | EnvironmentId 7 | {983cb205-be13-4b43-8437-f45eebc99c6f} 8 | 9 | 10 | ProjectExplorer.Project.ActiveTarget 11 | 0 12 | 13 | 14 | ProjectExplorer.Project.EditorSettings 15 | 16 | true 17 | false 18 | true 19 | 20 | Cpp 21 | 22 | CppGlobal 23 | 24 | 25 | 26 | QmlJS 27 | 28 | QmlJSGlobal 29 | 30 | 31 | 2 32 | UTF-8 33 | false 34 | 4 35 | false 36 | 80 37 | true 38 | true 39 | 1 40 | true 41 | false 42 | 0 43 | true 44 | true 45 | 0 46 | 8 47 | true 48 | 1 49 | true 50 | true 51 | true 52 | false 53 | 54 | 55 | 56 | ProjectExplorer.Project.PluginSettings 57 | 58 | 59 | 60 | ProjectExplorer.Project.Target.0 61 | 62 | Desktop 63 | Desktop 64 | {ca6c9c0b-0394-4ffc-b1b8-2fda04b8ec96} 65 | 0 66 | 1 67 | 1 68 | 69 | /home/guest/Dokumenty/C code/build-apt-encoder-Desktop-Ladu011bnu00ed 70 | 71 | 72 | true 73 | qmake 74 | 75 | QtProjectManager.QMakeBuildStep 76 | false 77 | 78 | false 79 | false 80 | false 81 | 82 | 83 | true 84 | Make 85 | 86 | Qt4ProjectManager.MakeStep 87 | 88 | false 89 | 90 | 91 | false 92 | 93 | 2 94 | Build 95 | 96 | ProjectExplorer.BuildSteps.Build 97 | 98 | 99 | 100 | true 101 | Make 102 | 103 | Qt4ProjectManager.MakeStep 104 | 105 | true 106 | clean 107 | 108 | false 109 | 110 | 1 111 | Clean 112 | 113 | ProjectExplorer.BuildSteps.Clean 114 | 115 | 2 116 | false 117 | 118 | Ladění 119 | Ladění 120 | Qt4ProjectManager.Qt4BuildConfiguration 121 | 2 122 | true 123 | 124 | 125 | /home/guest/Dokumenty/C code/build-apt-encoder-Desktop-Vydu00e1nu00ed 126 | 127 | 128 | true 129 | qmake 130 | 131 | QtProjectManager.QMakeBuildStep 132 | false 133 | 134 | false 135 | false 136 | false 137 | 138 | 139 | true 140 | Make 141 | 142 | Qt4ProjectManager.MakeStep 143 | 144 | false 145 | 146 | 147 | false 148 | 149 | 2 150 | Build 151 | 152 | ProjectExplorer.BuildSteps.Build 153 | 154 | 155 | 156 | true 157 | Make 158 | 159 | Qt4ProjectManager.MakeStep 160 | 161 | true 162 | clean 163 | 164 | false 165 | 166 | 1 167 | Clean 168 | 169 | ProjectExplorer.BuildSteps.Clean 170 | 171 | 2 172 | false 173 | 174 | Vydání 175 | Vydání 176 | Qt4ProjectManager.Qt4BuildConfiguration 177 | 0 178 | true 179 | 180 | 2 181 | 182 | 183 | 0 184 | Nasazení 185 | 186 | ProjectExplorer.BuildSteps.Deploy 187 | 188 | 1 189 | Deploy Configuration 190 | 191 | ProjectExplorer.DefaultDeployConfiguration 192 | 193 | 194 | 195 | 0 196 | Nasazení 197 | 198 | ProjectExplorer.BuildSteps.Deploy 199 | 200 | 1 201 | Deploy Configuration 202 | Deploy Configuration2 203 | ProjectExplorer.DefaultDeployConfiguration 204 | 205 | 2 206 | 207 | 208 | dwarf 209 | 210 | cpu-cycles 211 | 212 | 213 | 250 214 | -F 215 | true 216 | 4096 217 | false 218 | false 219 | 1000 220 | 221 | true 222 | 223 | false 224 | false 225 | false 226 | false 227 | true 228 | 0.01 229 | 10 230 | true 231 | kcachegrind 232 | 1 233 | 25 234 | 235 | 1 236 | true 237 | false 238 | true 239 | valgrind 240 | 241 | 0 242 | 1 243 | 2 244 | 3 245 | 4 246 | 5 247 | 6 248 | 7 249 | 8 250 | 9 251 | 10 252 | 11 253 | 12 254 | 13 255 | 14 256 | 257 | 2 258 | 259 | apt-colorm 260 | 261 | Qt4ProjectManager.Qt4RunConfiguration:/home/guest/Dokumenty/C code/apt-encoder/apt-colorm/apt-colorm.pro 262 | 263 | 3768 264 | false 265 | true 266 | true 267 | false 268 | false 269 | true 270 | 271 | /home/guest/Dokumenty/C code/build-apt-encoder-Desktop-Ladu011bnu00ed/apt-colorm 272 | 273 | 274 | dwarf 275 | 276 | cpu-cycles 277 | 278 | 279 | 250 280 | -F 281 | true 282 | 4096 283 | false 284 | false 285 | 1000 286 | 287 | true 288 | 289 | false 290 | false 291 | false 292 | false 293 | true 294 | 0.01 295 | 10 296 | true 297 | kcachegrind 298 | 1 299 | 25 300 | 301 | 1 302 | true 303 | false 304 | true 305 | valgrind 306 | 307 | 0 308 | 1 309 | 2 310 | 3 311 | 4 312 | 5 313 | 6 314 | 7 315 | 8 316 | 9 317 | 10 318 | 11 319 | 12 320 | 13 321 | 14 322 | 323 | 2 324 | 325 | apt-encoder 326 | 327 | Qt4ProjectManager.Qt4RunConfiguration:/home/guest/Dokumenty/C code/apt-encoder/apt-encoder/apt-encoder.pro 328 | -lci QFH.tga 329 | 3768 330 | false 331 | true 332 | true 333 | false 334 | false 335 | true 336 | 337 | /home/guest/Dokumenty/C code/build-apt-encoder-Desktop-Ladu011bnu00ed/apt-encoder 338 | 339 | 340 | dwarf 341 | 342 | cpu-cycles 343 | 344 | 345 | 250 346 | -F 347 | true 348 | 4096 349 | false 350 | false 351 | 1000 352 | 353 | true 354 | 355 | false 356 | false 357 | false 358 | false 359 | true 360 | 0.01 361 | 10 362 | true 363 | kcachegrind 364 | 1 365 | 25 366 | 367 | 1 368 | true 369 | false 370 | true 371 | valgrind 372 | 373 | 0 374 | 1 375 | 2 376 | 3 377 | 4 378 | 5 379 | 6 380 | 7 381 | 8 382 | 9 383 | 10 384 | 11 385 | 12 386 | 13 387 | 14 388 | 389 | 2 390 | 391 | img-table 392 | 393 | Qt4ProjectManager.Qt4RunConfiguration:/home/guest/Dokumenty/C code/apt-encoder/img-table/img-table.pro 394 | 395 | 3768 396 | false 397 | true 398 | true 399 | false 400 | false 401 | true 402 | 403 | /home/guest/Dokumenty/C code/build-apt-encoder-Desktop-Ladu011bnu00ed/img-table 404 | 405 | 3 406 | 407 | 408 | 409 | ProjectExplorer.Project.TargetCount 410 | 1 411 | 412 | 413 | ProjectExplorer.Project.Updater.FileVersion 414 | 21 415 | 416 | 417 | Version 418 | 21 419 | 420 | 421 | --------------------------------------------------------------------------------