int QccIMGImageSequenceInitialize(QccIMGImageSequence
*image_sequence);
int QccIMGImageSequenceAlloc(QccIMGImageSequence *image_sequence);
void QccIMGImageSequenceFree(QccIMGImageSequence *image_sequence);
int
QccIMGImageSequenceLength(const QccIMGImageSequence *image_sequence);
int QccIMGImageSequenceSetCurrentFilename(QccIMGImageSequence *image_sequence);
int QccIMGImageSequenceIncrementFrameNum(QccIMGImageSequence *image_sequence);
int QccIMGImageSequenceFindFrameNums(QccIMGImageSequence *image_sequence);
int QccIMGImageSequenceReadFrame(QccIMGImageSequence *image_sequence);
int QccIMGImageSequenceWriteFrame(QccIMGImageSequence *image_sequence);
int QccIMGImageSequenceStartRead(QccIMGImageSequence *image_sequence);
The main component of a QccIMGImageSequence structure is a QccIMGImage(3) structure that holds the current frame of the image sequence.
typedef struct
{
QccString filename;
int start_frame_num;
int end_frame_num;
int current_frame_num;
QccString current_filename;
QccIMGImage current_frame;
} QccIMGImageSequence;
The fields of QccIMGImageSequence are as follows:
filename: NULL string
start_frame_num: 0
end_frame_num: 0
current_frame_num: 0
current_filename: NULL string
QccIMGImageSequenceAlloc() allocates storage space for image_sequence->current_frame by calling QccIMGImageAlloc(3) . The size of image_sequence->current_frame must be set via a call to QccIMGImageSetSize(3) or QccIMGImageSetSizeYUV(3) prior to calling QccIMGImageSequenceAlloc().
QccIMGImageSequenceFree() frees image_sequence->current_frame via a call to QccIMGImageFree(3) .
QccIMGImageSequenceLength() calculates the number of frames of image_sequence. It is assumed that no frames are skipped between the starting frame and the ending frame, so the number of frames isa image_sequence->end_frame_num - image_sequence->start_frame_num + 1.
QccIMGImageSequenceSetCurrentFilename() updates image_sequence->current_filename by placing the current frame number, image_sequence->current_frame_num, into the filename template, image_sequence->filename. This is done by having image_sequence->current_filename be the output of a call to QccStringSprintf(3) wherein image_sequence->filename is the format string.
QccIMGImageSequenceIncrementFrameNum() increments image_sequence->current_frame_num and then calls QccIMGImageSequenceSetCurrentFilename() to update the current filename.
QccIMGImageSequenceFindFrameNums() determines the starting and ending frame numbers for the specified image sequence. Using the filename template, image_sequence->filename, QccIMGImageSequenceFindFrameNums() scans all the frame numbers matching the template, checking for the existence of a file with that frame number. image_sequence->start_frame_num is set to the first frame number for which a file exists. image_sequence->end_frame_num is set to the last frame number for which a file exists, such that all frame numbers between image_sequence->start_frame_num and image_sequence->end_frame_num correspond to existing files; i.e., the sequence of frames from the starting frame number to the ending frame number is consecutive with no skipped frames.
QccIMGImageSequenceReadFrame() calls QccIMGImageSequenceSetCurrentFilename() to update the current filename, and then QccIMGImageRead(3) to read the current frame, with the current frame being returned in image_sequence->current_frame.
QccIMGImageSequenceWriteFrame() calls QccIMGImageSequenceSetCurrentFilename() to update the current filename, and then QccIMGImageWrite(3) to write image_sequence->current_frame to the current filename.
QccIMGImageSequenceStartRead() calls QccIMGImageSequenceReadFrame() to read the first frame of the sequence, i.e., the one with frame number image_sequence->start_frame_num.