Home » Archimedes archive » Acorn User » AU 1998-05 A.adf » Regulars » StarInfo/Johns/c/CJPEG
StarInfo/Johns/c/CJPEG
This website contains an archive of files for the Acorn Electron, BBC Micro, Acorn Archimedes, Commodore 16 and Commodore 64 computers, which Dominic Ford has rescued from his private collection of floppy disks and cassettes.
Some of these files were originally commercial releases in the 1980s and 1990s, but they are now widely available online. I assume that copyright over them is no longer being asserted. If you own the copyright and would like files to be removed, please contact me.
Tape/disk: | Home » Archimedes archive » Acorn User » AU 1998-05 A.adf » Regulars |
Filename: | StarInfo/Johns/c/CJPEG |
Read OK: | ✔ |
File size: | 02EA bytes |
Load address: | 0000 |
Exec address: | 0000 |
File contents
// CompressJPEG // ------------ #include "cjpeg.h" #include "kernel.h" #include "swis.h" #define CompressJPEG_Start 0x4a500 #define CompressJPEG_WriteLine 0x4a501 #define CompressJPEG_Finish 0x4a502 int CJPEG_Start(void *buff,int bufsize,CJPEG_params *params) { _kernel_swi_regs r; r.r[0] = (int) buff; r.r[1] = bufsize; r.r[2] = (int) params; r.r[3] = 0; r.r[4] = 0; _kernel_swi(CompressJPEG_Start,&r,&r); return(r.r[0]); } int CJPEG_Finish(int tag) { _kernel_swi_regs r; r.r[0] = tag; _kernel_swi(CompressJPEG_Finish,&r,&r); return(r.r[0]); } /* void CJPEG_WriteLine(int tag,void *pixels) { _kernel_swi_regs r; r.r[0] = tag; r.r[1] = (int) pixels; _kernel_swi(CompressJPEG_WriteLine,&r,&r); } */
00000000 2f 2f 20 43 6f 6d 70 72 65 73 73 4a 50 45 47 0a |// CompressJPEG.| 00000010 2f 2f 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a |// ------------.| 00000020 0a 23 69 6e 63 6c 75 64 65 20 22 63 6a 70 65 67 |.#include "cjpeg| 00000030 2e 68 22 0a 23 69 6e 63 6c 75 64 65 20 22 6b 65 |.h".#include "ke| 00000040 72 6e 65 6c 2e 68 22 0a 23 69 6e 63 6c 75 64 65 |rnel.h".#include| 00000050 20 22 73 77 69 73 2e 68 22 0a 0a 23 64 65 66 69 | "swis.h"..#defi| 00000060 6e 65 20 43 6f 6d 70 72 65 73 73 4a 50 45 47 5f |ne CompressJPEG_| 00000070 53 74 61 72 74 20 20 20 20 20 20 30 78 34 61 35 |Start 0x4a5| 00000080 30 30 0a 23 64 65 66 69 6e 65 20 43 6f 6d 70 72 |00.#define Compr| 00000090 65 73 73 4a 50 45 47 5f 57 72 69 74 65 4c 69 6e |essJPEG_WriteLin| 000000a0 65 20 20 30 78 34 61 35 30 31 0a 23 64 65 66 69 |e 0x4a501.#defi| 000000b0 6e 65 20 43 6f 6d 70 72 65 73 73 4a 50 45 47 5f |ne CompressJPEG_| 000000c0 46 69 6e 69 73 68 20 20 20 20 20 30 78 34 61 35 |Finish 0x4a5| 000000d0 30 32 0a 0a 69 6e 74 20 43 4a 50 45 47 5f 53 74 |02..int CJPEG_St| 000000e0 61 72 74 28 76 6f 69 64 20 2a 62 75 66 66 2c 69 |art(void *buff,i| 000000f0 6e 74 20 62 75 66 73 69 7a 65 2c 43 4a 50 45 47 |nt bufsize,CJPEG| 00000100 5f 70 61 72 61 6d 73 20 2a 70 61 72 61 6d 73 29 |_params *params)| 00000110 0a 7b 0a 20 20 5f 6b 65 72 6e 65 6c 5f 73 77 69 |.{. _kernel_swi| 00000120 5f 72 65 67 73 20 72 3b 0a 20 20 72 2e 72 5b 30 |_regs r;. r.r[0| 00000130 5d 20 3d 20 28 69 6e 74 29 20 62 75 66 66 3b 0a |] = (int) buff;.| 00000140 20 20 72 2e 72 5b 31 5d 20 3d 20 62 75 66 73 69 | r.r[1] = bufsi| 00000150 7a 65 3b 0a 20 20 72 2e 72 5b 32 5d 20 3d 20 28 |ze;. r.r[2] = (| 00000160 69 6e 74 29 20 70 61 72 61 6d 73 3b 0a 20 20 72 |int) params;. r| 00000170 2e 72 5b 33 5d 20 3d 20 30 3b 0a 20 20 72 2e 72 |.r[3] = 0;. r.r| 00000180 5b 34 5d 20 3d 20 30 3b 0a 20 20 5f 6b 65 72 6e |[4] = 0;. _kern| 00000190 65 6c 5f 73 77 69 28 43 6f 6d 70 72 65 73 73 4a |el_swi(CompressJ| 000001a0 50 45 47 5f 53 74 61 72 74 2c 26 72 2c 26 72 29 |PEG_Start,&r,&r)| 000001b0 3b 0a 0a 20 20 72 65 74 75 72 6e 28 72 2e 72 5b |;.. return(r.r[| 000001c0 30 5d 29 3b 0a 7d 0a 0a 69 6e 74 20 43 4a 50 45 |0]);.}..int CJPE| 000001d0 47 5f 46 69 6e 69 73 68 28 69 6e 74 20 74 61 67 |G_Finish(int tag| 000001e0 29 0a 7b 0a 20 20 5f 6b 65 72 6e 65 6c 5f 73 77 |).{. _kernel_sw| 000001f0 69 5f 72 65 67 73 20 72 3b 0a 20 20 72 2e 72 5b |i_regs r;. r.r[| 00000200 30 5d 20 3d 20 74 61 67 3b 0a 20 20 5f 6b 65 72 |0] = tag;. _ker| 00000210 6e 65 6c 5f 73 77 69 28 43 6f 6d 70 72 65 73 73 |nel_swi(Compress| 00000220 4a 50 45 47 5f 46 69 6e 69 73 68 2c 26 72 2c 26 |JPEG_Finish,&r,&| 00000230 72 29 3b 0a 20 20 72 65 74 75 72 6e 28 72 2e 72 |r);. return(r.r| 00000240 5b 30 5d 29 3b 0a 7d 0a 0a 2f 2a 0a 76 6f 69 64 |[0]);.}../*.void| 00000250 20 43 4a 50 45 47 5f 57 72 69 74 65 4c 69 6e 65 | CJPEG_WriteLine| 00000260 28 69 6e 74 20 74 61 67 2c 76 6f 69 64 20 2a 70 |(int tag,void *p| 00000270 69 78 65 6c 73 29 0a 7b 0a 20 20 5f 6b 65 72 6e |ixels).{. _kern| 00000280 65 6c 5f 73 77 69 5f 72 65 67 73 20 72 3b 0a 20 |el_swi_regs r;. | 00000290 20 72 2e 72 5b 30 5d 20 3d 20 74 61 67 3b 0a 20 | r.r[0] = tag;. | 000002a0 20 72 2e 72 5b 31 5d 20 3d 20 28 69 6e 74 29 20 | r.r[1] = (int) | 000002b0 70 69 78 65 6c 73 3b 0a 20 20 5f 6b 65 72 6e 65 |pixels;. _kerne| 000002c0 6c 5f 73 77 69 28 43 6f 6d 70 72 65 73 73 4a 50 |l_swi(CompressJP| 000002d0 45 47 5f 57 72 69 74 65 4c 69 6e 65 2c 26 72 2c |EG_WriteLine,&r,| 000002e0 26 72 29 3b 0a 7d 0a 2a 2f 0a |&r);.}.*/.| 000002ea