This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
haas:fall2017:discrete:projects:dcf2 [2017/10/15 21:40] – [Objective] wedge | haas:fall2017:discrete:projects:dcf2 [2017/10/21 12:01] (current) – [This week's algorithm: RLE+control_sequences] wedge | ||
---|---|---|---|
Line 36: | Line 36: | ||
Encoding with our new algorithm, we would get the following (our control sequence byte will be a 2A, then followed by the count byte, then the stride byte, then the encoded data): | Encoding with our new algorithm, we would get the following (our control sequence byte will be a 2A, then followed by the count byte, then the stride byte, then the encoded data): | ||
- | * 2A 06 01 61 62 63 64 62 63 64 62 63 2A 07 01 64 65 66 67 68 69 6A 6B 6C 6D 2A 06 6E 6F 77 78 79 7A | + | * 2A 06 01 61 62 63 64 62 63 64 62 63 2A 07 01 64 65 66 67 68 69 6A 6B 6C 6D 2A 06 01 6E 6F 77 78 79 7A |
* 34 bytes | * 34 bytes | ||
Line 45: | Line 45: | ||
====Header==== | ====Header==== | ||
- | It is actually **identical** to the specifications of last week, save for three changes: | + | It is actually **identical** to the specifications of **dcf1**, save for three changes: |
- we're hard-coding a 00 in the stride byte (byte 10) | - we're hard-coding a 00 in the stride byte (byte 10) | ||
- we're placing a 3 in the version byte (byte 9) | - we're placing a 3 in the version byte (byte 9) | ||
Line 75: | Line 75: | ||
Your program should: | Your program should: | ||
- | * for encode, obtain | + | * for encode, obtain |
- | * argv[1]: name of source file | + | * argv[1]: name of path + source file |
* this should be a file that exists, but you should do appropriate error checking and bail out if the file cannot be accessed | * this should be a file that exists, but you should do appropriate error checking and bail out if the file cannot be accessed | ||
- | * argv[2]: stride | + | * argv[2]: path of destination location (NOT file NAME, just PATH). The destination file name will be generated, based on the source file and whether we are encoding or decoding: |
- | * this is a value between | + | * if encoding, destination is argv[2] + argv[1] (minus source path) + " |
- | * argv[3]: control byte | + | * if decoding, destination is argv[2] + embedded file name (which shouldn' |
+ | * argv[3]: stride | ||
+ | * this is a value between | ||
+ | * be sure to do error checking to make sure it is in this range. | ||
+ | * argv[4]: control byte | ||
* this is a value between 0 and 255 (inclusive). | * this is a value between 0 and 255 (inclusive). | ||
* for **encode**, the output file will be the filename specified in argv[1] will an " | * for **encode**, the output file will be the filename specified in argv[1] will an " | ||
- | * for **decode**, only accept | + | * for **decode**, only accept |
* the output file name will be obtained from parsing the file's header data. | * the output file name will be obtained from parsing the file's header data. | ||
* be sure to perform appropriate error checking and bail out as needed. | * be sure to perform appropriate error checking and bail out as needed. | ||
Line 130: | Line 134: | ||
<cli> | <cli> | ||
lab46: | lab46: | ||
- | make: Entering directory '/ | ||
- | |||
- | ‘/ | ||
- | ‘/ | ||
- | ‘/ | ||
- | ‘/ | ||
- | ‘/ | ||
- | ‘/ | ||
- | ‘/ | ||
- | ‘/ | ||
- | ‘/ | ||
- | ‘/ | ||
- | ‘/ | ||
- | |||
- | make: Leaving directory '/ | ||
- | lab46: | ||
- | lab46: | ||
- | Makefile | ||
- | lab46: | ||
</ | </ | ||
Line 180: | Line 165: | ||
* argv[0]: program invocation (path + program name) | * argv[0]: program invocation (path + program name) | ||
* argv[1]: our input file | * argv[1]: our input file | ||
- | * argv[2]: our control sequence byte (0-255) | + | * argv[2]: our output path |
+ | * argv[3]: our stride value (1-255) | ||
+ | * argv[4]: our control sequence byte (0-255) | ||
====Simple argument checks==== | ====Simple argument checks==== | ||
Line 199: | Line 186: | ||
<cli> | <cli> | ||
- | lab46: | + | lab46: |
dcfX v3 encode details | dcfX v3 encode details | ||
================================== | ================================== | ||
input name length: 11 bytes | input name length: 11 bytes | ||
input filename: sample2.bmp | input filename: sample2.bmp | ||
- | output filename: sample2.bmp.rle | + | output filename: |
| | ||
| | ||
Line 217: | Line 204: | ||
<cli> | <cli> | ||
- | lab46: | + | lab46: |
input filename: sample5.txt.rle | input filename: sample5.txt.rle | ||
output name length: 11 bytes | output name length: 11 bytes | ||
- | | + | |
| | ||
control byte: 0x29 | control byte: 0x29 |