File ColorSampling.str.pre
Version 1.0


This file contains functions that allow one to downsample from 4:4:4 to 4:2:0 or upsample from 4:2:0 or 4:2:2 to 4:4:4.


Component Summary
int->int ChannelUpsample_Vert_and_Horz
          Upsamples from 4:2:0 to 4:4:4asdf
int->int ChannelUpsample_Vertical
          Upsample from 4:2:2 to 4:4:4 (in the vertical direction)asdf
int->int ChannelUpsample_Horizontal
          Upsample from 4:2:2 to 4:4:4 (in the horizontal direction)asdf
int->int ChannelUpsample_1D
          Performs a one dimensional upsampling, doubling the pixel count Each pixel is computed from a weighted average of its two neighbors with the closer neighbor getting weight1 and the further neighbor getting weight2.
int->int DropSecond
          This drops every second value from a data stream, essentially performing a very simple downsampling (used for the horizontal downsampling in color channel downsampling.
int->int ChannelDownsample_1D
          This cuts a data stream in half by combining two pixels into one.
int->int ChannelDownsample
          Downsample from 4:4:4 to 4:2:0asdf

Component Detail

ChannelUpsample_Vert_and_Horz

int->int ChannelUpsample_Vert_and_Horz(int sourcewidth, int sourceheight)
Upsamples from 4:2:0 to 4:4:4

Input:
<int> - A 4:2:0 downsampled image
Output:
<int> - A 4:4:4 upsampled image
Parameters:
sourcewidth - The width of the downsampled image
sourceheight - The height of the downsampled image

ChannelUpsample_Vertical

int->int ChannelUpsample_Vertical(int sourcewidth, int sourceheight)
Upsample from 4:2:2 to 4:4:4 (in the vertical direction)

Input:
<int> - A 4:2:2 downsampled in the vertical direction
Output:
<int> - A 4:4:4 upsampled image
Parameters:
sourcewidth - The width of the downsampled image
sourceheight - The height of the downsampled image

ChannelUpsample_Horizontal

int->int ChannelUpsample_Horizontal(int sourcewidth, int sourceheight)
Upsample from 4:2:2 to 4:4:4 (in the horizontal direction)

Input:
<int> - A 4:2:2 downsampled in the horizontal direction
Output:
<int> - A 4:4:4 upsampled image
Parameters:
sourcewidth - The width of the downsampled image
sourceheight - The height of the downsampled image

ChannelUpsample_1D

int->int ChannelUpsample_1D
Performs a one dimensional upsampling, doubling the pixel count Each pixel is computed from a weighted average of its two neighbors with the closer neighbor getting weight1 and the further neighbor getting weight2.

Input:
<int> - The downsampled data stream
Output:
<int> - The reconstructed upsampled data stream
Parameters:
sourcelen - The length of the downsampled data stream
weight1 - The weight of the closer neighbor
weight2 - The weight of the further neighbor

DropSecond

int->int DropSecond
This drops every second value from a data stream, essentially performing a very simple downsampling (used for the horizontal downsampling in color channel downsampling.

Input:
<int> - A data stream
Output:
<int> - A downsampled data stream

ChannelDownsample_1D

int->int ChannelDownsample_1D(float weight1, float weight2)
This cuts a data stream in half by combining two pixels into one. Each new pixel's value is based on a weighting.

Input:
<int> - A data stream
Output:
<int> - A data stream
Parameters:
weight1 - The weighting used for the antecedent pixel
weight2 - The weighting used for the subsequent pixel

ChannelDownsample

int->int ChannelDownsample()
Downsample from 4:4:4 to 4:2:0

Input:
<int> - A 4:4:4 upsampled image
Output:
<int> - A 4:2:0 downsampled image

Please contact the author (Matthew Drake) for more information.