User Tools

Site Tools


haas:fall2017:discrete:projects:dcf2

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
haas:fall2017:discrete:projects:dcf2 [2017/10/15 21:39] wedgehaas:fall2017:discrete:projects:dcf2 [2017/10/21 12:01] (current) – [This week's algorithm: RLE+control_sequences] wedge
Line 5: Line 5:
  
 ======Project: RUN-LENGTH ENCODING - DATA COMPRESSION FUN (dcf2)====== ======Project: RUN-LENGTH ENCODING - DATA COMPRESSION FUN (dcf2)======
 +
 +=====Errata=====
 +Any changes that have been made.
 +
 +  * Revision #: <description> (DATESTRING)
  
 =====Objective===== =====Objective=====
Line 31: 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 40: 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 70: Line 75:
  
 Your program should: Your program should:
-  * for encode, obtain parameters from the command-line (see **command-line arguments** section below): +  * for encode, obtain parameters from the command-line (see **command-line arguments** section below): 
-    * 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 and 255 (inclusive). +      * if encoding, destination is argv[2] + argv[1] (minus source path) + ".rle" 
-    * argv[3]: control byte+      * if decoding, destination is argv[2] + embedded file name (which shouldn't have an ".rle" per project specifications) 
 +    * argv[3]: stride value 
 +      * this is a value between and 255 (inclusive)
 +        * 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 "**.rle**" suffixed to the end. This adds a certain universal aspect to how we'll go about naming things (**tar** and **gzip** do this too).   * for **encode**, the output file will be the filename specified in argv[1] will an "**.rle**" suffixed to the end. This adds a certain universal aspect to how we'll go about naming things (**tar** and **gzip** do this too).
-  * for **decode**, only accept 1 argument; this should be an RL-encoded file.+  * for **decode**, only accept 2 arguments; this should be an RL-encoded file.
     * 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 125: Line 134:
 <cli> <cli>
 lab46:~/src/discrete$ grabit discrete dcf2 lab46:~/src/discrete$ grabit discrete dcf2
-make: Entering directory '/var/public/summer2017/discrete/dcf2' 
- 
-‘/var/public/summer2017/discrete/dcf2/Makefile’ -> ‘/home/USERNAME/src/discrete/dcf2/Makefile’ 
-‘/var/public/summer2017/discrete/dcf2/encode.c’ -> ‘/home/USERNAME/src/discrete/dcf2/encode.c’ 
-‘/var/public/summer2017/discrete/dcf2/decode.c’ -> ‘/home/USERNAME/src/discrete/dcf2/decode.c’ 
-‘/var/public/summer2017/discrete/dcf2/data/sample0.txt’ -> ‘/home/USERNAME/src/discrete/dcf2/data/sample0.txt’ 
-‘/var/public/summer2017/discrete/dcf2/data/sample1.txt’ -> ‘/home/USERNAME/src/discrete/dcf2/data/sample1.txt’ 
-‘/var/public/summer2017/discrete/dcf2/data/sample2.bmp’ -> ‘/home/USERNAME/src/discrete/dcf2/data/sample2.bmp’ 
-‘/var/public/summer2017/discrete/dcf2/data/sample3.wav’ -> ‘/home/USERNAME/src/discrete/dcf2/data/sample3.wav’ 
-‘/var/public/summer2017/discrete/dcf2/data/sample4.bmp.rle’ -> ‘/home/USERNAME/src/discrete/dcf2/data/sample4.bmp.rle’ 
-‘/var/public/summer2017/discrete/dcf2/data/sample5.txt.rle’ -> ‘/home/USERNAME/src/discrete/dcf2/data/sample5.txt.rle’ 
-‘/var/public/summer2017/discrete/dcf2/data/sample6.mp3.rle’ -> ‘/home/USERNAME/src/discrete/dcf2/data/sample6.mp3.rle’ 
-‘/var/public/summer2017/discrete/dcf2/data/sample7.txt.rle’ -> ‘/home/USERNAME/src/discrete/dcf2/data/sample7.txt.rle’ 
- 
-make: Leaving directory '/var/public/summer2017/discrete/dcf2' 
-lab46:~/src/discrete$ cd dcf2 
-lab46:~/src/discrete/dcf2$ ls 
-Makefile          data            decode.c            encode.c 
-lab46:~/src/discrete/dcf2$  
 </cli> </cli>
  
Line 175: 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 194: Line 186:
  
 <cli> <cli>
-lab46:~/src/discrete/dcf2$ ./encode sample2.bmp 3 37+lab46:~/src/discrete/dcf2$ ./encode sample2.bmp 3 37
 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: ./sample2.bmp.rle
      control byte: 0x25      control byte: 0x25
      stride value: 3 bytes      stride value: 3 bytes
Line 212: Line 204:
  
 <cli> <cli>
-lab46:~/src/discrete/dcf2$ ./decode sample5.txt.rle+lab46:~/src/discrete/dcf2$ ./decode sample5.txt.rle .
     input filename: sample5.txt.rle     input filename: sample5.txt.rle
 output name length: 11 bytes output name length: 11 bytes
-   output filename: sample5.txt+   output filename: ./sample5.txt
        header text: dcfX RLE v3        header text: dcfX RLE v3
       control byte: 0x29       control byte: 0x29
haas/fall2017/discrete/projects/dcf2.1508103599.txt.gz · Last modified: 2017/10/15 21:39 by wedge