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.
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.
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.
-
Create a
Makefile
to compile and link the various program parts -
Movie list operations
- Creating a new list
- Identifying an empty list
- Determining the size of a list
- Appending a frame to the end of a list
- Inserting a movie within another movie
- Apply generic processing to each movie frame
- Clear a movie's memory allocation from the heap
-
Composer operations
- Prompt for and read user input selection
- Dispatch processing for user choice
- Show individual frames to play a movie
- Capture and insert a new scene
- Prompt the user for a number of new frames to capture
- Verify the user input is valid
- Prompt the user for an insertion point into the movie
- Verify the user input is valid
- Create a new (sub)movie for the scene
- Set the robot in motion
- Repeatedly add frames to the scene
- Stop the robot
- Insert the scene into the movie
- 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
-
Copy the
CFLAGS
,CPPFLAGS
, andLDFLAGS
variables from yourstandard
Makefile
, -
include
CFLAGS
andCPPFLAGS
in the command line whenever you compile a C file into an object file, and -
include
LDFLAGS
in the command line when you link object files into an executable.
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.
-
[10 points] Correctly implements functions in
movie.c
- [1 point]
is_empty
- [1 point]
size
- [2 points]
add
- [3 points]
insert
- [1 points]
apply
- [2 points]
clear
- [1 point]
-
[10 points] Correctly implements
captureScene
function inmovie-composer.c
- [1 point] Prompts and verifies user input for number of frames
- [1 point] Prompts and verifies user input for insertion index
- [3 points] Correctly captures scene in helper function
- [2 points] Scene capture moves and stops robot
- [1 point] Inserts scene into movie at given index
- [2 points] Implements a movie filter operation
-
[10 points] Completes build and test frameworks
-
[4 points] Completes
Makefile
for compiling and linking - [4 points] Provides complete testing plan and commentary
- [2 points] Transcript shows compilation and complete program testing with a clean report from Address Sanitizer
-
[4 points] Completes
-
Comments on Program Format, Comments, Readability, Testing, etc.
(Points not given, but points can be deducted.)
A five point penalty will apply to any submission that includes personally identifying information anywhere other than the references/honesty file.