CSC 161 Schedule Readings Labs & Projects Homework Deadlines Resources

Project: Movie Editing

Summary
You compose and play a movie using linked lists
Objectives
  • Apply the linked list data structure in an appropriate task
  • Learn to use dynamic memory management
  • Sharpen pointer manipulation skills
  • Practice writing list operations
  • Utilize separate compilation and program decomposition
  • Experience reading an existing code base

Introduction

When movies are composed, we may not know exactly how long they will be. Moreover, they are typically comprised of several scenes. The ability to dynamically expand and insert into a linked list efficiently suggests this will be an ideal data structure for us to store a movie built by Scribbler robots and their human drivers.

We will use our knowledge of program management to divide programs into libraries with interfaces provided via header files and other program code in separate C files.

Some of the functionality and has been implemented, but several important pieces remain for you to complete.

Data Structures

To store a movie as a sequence of pictures, we will need a node_t type to store the nodes of a linked list.

typedef struct node node_t;

struct node {
  Picture frame;
  node_t * next;
};

To track the parts of movie and efficiently add newly capture frames at the end, we create a movie_t type hold pointers to the first and last nodes in the list.

typedef struct {
  node_t * first;
  node_t * last;
} movie_t;

The resulting data structure would then appear as follows.

An List Implementation of a Movie
List Implementation of a Movie

When a movie has no frames, both the first and last fields of the movie_t struct would be NULL. As an important invariant to test in your program, note that both of these pointers should be null, or neither should be null.

Program Structure

The structures above suggest the following decomposition of our program files.

File Dependencies for a Movie Composer
File Dependencies for a Movie Composer

The starting code for your project is available here:

Project Work

As you may have noted, several programming tasks have already been completed for you. These are listed in blue in the decomposition below.

  1. Create a Makefile to compile and link the various program parts
  2. Movie list operations
    1. Creating a new list
    2. Identifying an empty list
    3. Determining the size of a list
    4. Appending a frame to the end of a list
    5. Inserting a movie within another movie
    6. Apply generic processing to each movie frame
    7. Clear a movie's memory allocation from the heap
  3. Composer operations
    1. Prompt for and read user input selection
    2. Dispatch processing for user choice
    3. Show individual frames to play a movie
    4. Capture and insert a new scene
      1. Prompt the user for a number of new frames to capture
      2. Verify the user input is valid
      3. Prompt the user for an insertion point into the movie
      4. Verify the user input is valid
      5. Create a new (sub)movie for the scene
      6. Set the robot in motion
      7. Repeatedly add frames to the scene
      8. Stop the robot
      9. Insert the scene into the movie
    5. Add a fun extra filter to the movie

Additional Notes

Robot motion for capture

You may choose how the robot moves for capturing images. You may also add or modify global constants naming/controlling the motion.

Image filter

The extra filter may be any reasonable image manipulation of your own choosing, such as an image complement (255 minus the channel brightness for each channel and pixel) or one of the procedures from your previous project, (so long as the source is appropriately attributed in the project references).

Makefile

In addition to completing the functionality above, you will need to define a Makefile to compile and link the various parts of your program. To make use of the MyroC library, you may need to

Address Sanitizer

Your transcript should demonstrate that all of the operations of your program run cleanly through Address Sanitizer, without errors or warnings arising from your code. (Some issues may be present within the MyroC library; you are not responsible for these.)

In order to use Address Sanitizer, note that both compiling (clang -c) and linking (clang -o) commands must contain the -fsanitize=address flag.

Grading

In addition to the general grading guidelines for evaluation, the project is worth 30 points.

A five point penalty will apply to any submission that includes personally identifying information anywhere other than the references/honesty file.