ee554.c file documentation page
*
* -- alloc_image --
*
* Author : Noel O'Connor
*
*
* Created : 02/08/2000
*
*
* Description : Allocates memory for an image data structure
*
*
* Arguments in : int width - width of image in pixels
* int height - height of image in pixels
*
* Arguments in/out : None
*
*
* Arguments out : None
*
*
* Return values : pointer to the allocated image structure
*
*
* Side effects : Sets the width and height elements of image
* data structure
*
*
* See also : free_image(), clone_image()
*
*
* Modified :
*
*
*
* -- clone_image --
*
* Author : Vivien Chappelier
*
*
* Created : 12/07/2001
*
*
* Description : Creates another instance of the image.
*
*
* Arguments in : image *img - a pointer to the image to be cloned
*
*
* Arguments in/out : None
*
*
* Arguments out : None
*
*
* Return values : A pointer to the clone of the original image
*
*
* Side effects : None
*
*
* See also : alloc_image(), free_image()
*
*
* Modified :
*
*
*
* -- free_image --
*
* Author : Noel O'Connor
*
*
* Created : 02/08/2000
*
*
* Description : Deallocates the memory associated with an image
* data structure
*
*
* Arguments in : image *img - a pointer to the image to be deallocated
*
*
* Arguments in/out : None
*
*
* Arguments out : None
*
*
* Return values : None
*
*
* Side effects : None
*
*
* See also : alloc_image(), clone_image()
*
*
* Modified :
*
*
*
* -- get_image_width --
*
* Author : Noel O'Connor
*
*
* Created : 02/08/2000
*
*
* Description : Returns the value of the width element of
* an image data structure.
*
* *** n.b. ***
* These functions should be used to access an image
* data structure rather than the usual
* pointer operator: img->width
*
*
* Arguments in : image *img - a pointer to the image data structure
*
*
* Arguments in/out : None
*
*
* Arguments out : None
*
*
* Return values : The image width as an integer (int) value
*
*
* Side effects : None
*
*
* See also :
*
*
* Modified :
*
*
*
* -- get_image_height --
*
* Author : Noel O'Connor
*
*
* Created : 02/08/2000
*
*
* Description : Returns the value of the height element of
* an image data structure.
*
* *** n.b. ***
* These functions should be used to access an image
* data structure rather than the usual
* pointer operator: img->height.
*
*
* Arguments in : image *img - a pointer to the image data structure
*
*
* Arguments in/out : None
*
*
* Arguments out : None
*
*
* Return values : The image height as an integer (int) value
*
*
* Side effects : None
*
*
* See also :
*
*
* Modified :
*
*
*
* -- pgm_load_image --
*
* Author : Vivien Chappelier
*
*
* Created : 12/07/2001
*
*
* Description : Loads an image from a file.
*
*
* Arguments in : char *filename - name of the image file to be loaded
*
*
* Arguments in/out : None
*
*
* Arguments out : None
*
*
* Return values : A pointer to the image
*
*
* Side effects : None
*
*
* See also : pgm_write_image(), free_image()
*
*
* Modified :
*
*
*
* -- pgm_write_image --
*
* Author : Noel O'Connor
*
*
* Created : 02/08/2000
*
*
* Description : Writes the contents of an image data structure to
* disk as a PGM file (of type P5).
*
* Note: Allocates a temporary byte buffer and copies
* pels to buffer, before buffer is written. This
* effectively decouples pel data type and PGM format.
* As a consequence, currently only 8-bit PGM byte
* format is supported.
*
*
* Arguments in : image *img - pointer to image data structure to be
* written
* char *filename - file name of PGM format image file
* on disk
*
*
* Arguments in/out : None
*
*
* Arguments out : None
*
*
* Return values : None
*
*
* Side effects : None
*
*
* See also : pgm_load_image()
*
*
* Modified :
*
*
*
* -- load_sequence --
*
* Author : Vivien Chappelier
*
*
* Created : 12/07/2001
*
*
* Description : Loads a sequence of images from a set of PGM image
* files. The filename of the image set should be the
* name of the sequence followed by a 3-digit number
* indicating the order of the image sequence. For
* example: mad000.pgm, mad001.pgm, ...
*
*
* Arguments in : char * seqname - sequence name (e.g. "mad")
*
*
* Arguments in/out : None
*
*
* Arguments out : None
*
*
* Return values : A pointer to the sequence of images
*
*
* Side effects : None
*
*
* See also : free_sequence()
*
*
* Modified :
*
*
*
* -- free_sequence --
*
* Author : Vivien Chappelier
*
*
* Created : 12/07/2001
*
*
* Description : Deallocates the memory associated with an sequence
* data structure
*
*
* Arguments in : sequence * seq - a pointer to the sequence
*
*
* Arguments in/out : None
*
*
* Arguments out : None
*
*
* Return values : None
*
*
* Side effects : None
*
*
* See also : load_sequence()
*
*
* Modified :
*
*
*
* -- get_sequence_width --
*
* Author : Vivien Chappelier
*
*
* Created : 12/07/2001
*
*
* Description : Returns the width of the images in the sequence.
*
* *** n.b. ***
* This function should be used to access a sequence
* data structure rather than the usual
* pointer operator: seq->images[0]->width
*
*
* Arguments in : sequence * seq - a pointer to the sequence
*
*
* Arguments in/out : None
*
*
* Arguments out : None
*
*
* Return values : The width of images in the sequence.
*
*
* Side effects : None
*
*
* See also : get_sequence_height(),
* get_sequence_length(), get_sequence_images()
*
*
* Modified :
*
*
*
* -- get_sequence_height --
*
* Author : Vivien Chappelier
*
*
* Created : 12/07/2001
*
*
* Description : Returns the height of the images in the sequence.
*
* *** n.b. ***
* This function should be used to access a sequence
* data structure rather than the usual
* pointer operator: seq->images[0]->height
*
*
* Arguments in : sequence * seq - a pointer to the sequence
*
*
* Arguments in/out : None
*
*
* Arguments out : None
*
*
* Return values : The height of images in the sequence.
*
*
* Side effects : None
*
*
* See also : get_sequence_width(),
* get_sequence_length(), get_sequence_images()
*
*
* Modified :
*
*
*
* -- get_sequence_length --
*
* Author : Vivien Chappelier
*
*
* Created : 12/07/2001
*
*
* Description : Returns the number of images in the sequence.
*
* *** n.b. ***
* This function should be used to access a sequence
* data structure rather than the usual
* pointer operator: seq->length
*
*
* Arguments in : sequence * seq - a pointer to the sequence
*
*
* Arguments in/out : None
*
*
* Arguments out : None
*
*
* Return values : The number of frames contained in the sequence
*
*
* Side effects : None
*
*
* See also : get_sequence_width(), get_sequence_height(),
* get_sequence_images()
*
*
* Modified :
*
*
*
* -- get_sequence_images --
*
* Author : Vivien Chappelier
*
*
* Created : 12/07/2001
*
*
* Description : Returns a pointer to the images of the sequence.
*
* *** n.b. ***
* This function should be used to access a sequence
* data structure rather than the usual
* pointer operator: seq->images
*
*
* Arguments in : sequence * seq - a pointer to the sequence
*
*
* Arguments in/out : None
*
*
* Arguments out : None
*
*
* Return values : A pointer to the array of images contained in
* the sequence
*
*
* Side effects : None
*
*
* See also : get_sequence_width(), get_sequence_height(),
* get_sequence_length()
*
*
* Modified :
*
*
*
* -- calc_PSNR_image --
*
* Author : Noel O'Connor
*
*
* Created : 02/08/2000
*
*
* Description : Calculates the Peak Signal to Noise Ratio (PSNR)
* in dB between two images
*
*
* Arguments in : image *img1 - pointer to the first image
* image *img2 - pointer to the second image
*
* Arguments in/out : None
*
*
* Arguments out : None
*
*
* Return values : The PSNR as a double value
*
*
* Side effects : None
*
*
* See also :
*
*
* Modified :
*
*
*
* -- calc_entropy_image --
*
* Author : Noel O'Connor
*
*
* Created : 02/08/2000
*
*
* Description : Calculates the entropy in bits/symbol of a image
*
*
* Arguments in : image *img - a pointer to the image
* int minus - flag indicating whether or not img is a
* difference image (or prediction
* residual) or an original image
* 1/TRUE/+ve => difference image
* 0/FALSE/-ve => original image
*
* Arguments in/out : None
*
*
* Arguments out : None
*
*
* Return values : double entropy - the entopy in bits/symbol
*
*
* Side effects : None
*
*
* See also :
*
*
* Modified :
*
*
*
* -- sub_image --
*
* Author : Noel O'Connor
*
*
* Created : 02/08/2000
*
*
* Description : Subtracts two images
*
*
* Arguments in : image *img1 - a pointer to the first image
* image *img2 - a pointer to the second image
*
*
* Arguments in/out : None
*
*
* Arguments out : image *out - a pointer to the output image
* (stores the difference between
* img1 and img2)
*
*
* Return values : None
*
*
* Side effects : None
*
*
* See also :
*
*
* Modified :
*
*
*
* -- abs_sub_image --
*
* Author : Noel O'Connor
*
*
* Created : 02/08/2000
*
*
* Description : Calculates the absolute difference between two
* images
*
*
* Arguments in : image *img1 - a pointer to the first image
* image *img2 - a pointer to the second image
*
*
* Arguments in/out : None
*
*
* Arguments out : image *out - a pointer to the output image
* (stores the absolute difference between
* img1 and img2)
*
*
* Return values : None
*
*
* Side effects : None
*
*
* See also :
*
*
* Modified :
*
*
*
* -- create_diff_image --
*
* Author : Noel O'Connor
*
*
* Created : 02/08/2000
*
*
* Description : Calculates the *difference* image between two
* images. To form the difference image, the
* differences between each pixel in the input images
* is scaled by: (2 * diff) + 128. This produces
* an image which when viewed, clearly illustrates the
* differences.
*
*
* Arguments in : image *img1 - a pointer to the first image
* image *img2 - a pointer to the second image
*
*
* Arguments in/out : None
*
*
* Arguments out : image *imgout - a pointer to the output difference
* image
*
*
* Return values : None
*
*
* Side effects : None
*
*
* See also :
*
*
* Modified :
*
*
*
* -- get_block --
*
* Author : Vivien Chappelier
*
*
* Created : 12/07/2001
*
*
* Description : Extracts one 8x8 block from an image.
*
*
* Arguments in : image *img - a pointer to the image
* int x - x coordinate of the upper left corner of
* the block in pixels
* int y - y coordinate of the upper left corner of
* the block in pixels
*
*
* Arguments in/out : None
*
*
* Arguments out : block_t block - the extracted 8x8 block
*
*
* Return values : None
*
*
* Side effects : None
*
*
* See also : put_block()
*
*
* Modified :
*
*
*
* -- put_block --
*
* Author : Vivien Chappelier
*
*
* Created : 12/07/2001
*
*
* Description : Puts an 8x8 block into an image.
*
*
* Arguments in : int x - x coordinate of the upper left corner of
* the block in pixels
* int y - y coordinate of the upper left corner of
* the block in pixels
* block_t block - the 8x8 block to be written in
* the image
*
* Arguments in/out : None
*
*
* Arguments out : image *img - a pointer to the image
*
*
* Return values : None
*
*
* Side effects : None
*
*
* See also : get_block()
*
*
* Modified :
*
*
*
* -- get_mblock --
*
* Author : Vivien Chappelier
*
*
* Created : 12/07/2001
*
*
* Description : Extracts one 16x16 block from an image.
*
*
* Arguments in : image *img - a pointer to the image
* int x - x coordinate of the upper left corner of
* the macroblock in pixels
* int y - y coordinate of the upper left corner of
* the macroblock in pixels
*
*
* Arguments in/out : None
*
*
* Arguments out : mblock_t mb - the extracted 16x16 block
*
*
* Return values : None
*
*
* Side effects : None
*
*
* See also : put_mblock()
*
*
* Modified :
*
*
*
* -- put_mblock --
*
* Author : Vivien Chappelier
*
*
* Created : 12/07/2001
*
*
* Description : Puts an 16x16 block into an image.
*
*
* Arguments in : int x - x coordinate of the upper left corner of
* the macroblock in pixels
* int y - y coordinate of the upper left corner of
* the macroblock in pixels
* mblock_t mb - the 8x8 macroblock to be written in
* the image
*
* Arguments in/out : None
*
*
* Arguments out : image *img - a pointer to the image
*
*
* Return values : None
*
*
* Side effects : None
*
*
* See also : get_mblock()
*
*
* Modified :
*
*
*
* -- print_block --
*
* Author : Vivien Chappelier
*
*
* Created : 12/07/2001
*
*
* Description : Prints formated 8x8 block data on the console.
*
*
* Arguments in : block_t block - block to be printed
*
*
* Arguments in/out : None
*
*
* Arguments out : None
*
*
* Return values : None
*
*
* Side effects : None
*
*
* See also :
*
*
* Modified :
*
*
Last edited: 16-Aug-2001