mediaframe.mpeg1
Class motion_data

java.lang.Object
  |
  +--mediaframe.mpeg1.motion_data

public class motion_data
extends java.lang.Object

The motion_data class is used to store and compute the motion information. Two objects of this class are created: One for forward and one for backward prediction.


Field Summary
private  int col_y_incr
          The increment for the luminance line, equals to pixel_per_col_line - 8.
private  boolean down_half_x
          True, if the fractional part > 0 of the vertical part of the motion vector for the luminance blocks.
private  boolean down_half_x_col
          True, if the fractional part > 0 of the vertical part of the motion vector for the chrominance blocks.
private  int down_x
          The integer part of the vertical part of the motion vector for the luminance blocks.
private  int down_x_col
          The integer part of the vertical part of the motion vector for the chrominance blocks.
private  int error_count
          The current number of printed errors in motion_data.
private  boolean Full_pel_x_vector
          Equals true if full pixel accuracy is used, equals false, if half pixel accuracy is used.
private  int lum_y_incr
          The increment for the luminance line, equals to pixel_per_lum_line - 8.
private  int max
          The max value of the motion vector.
private  int min
          The min value of the motion vector.
private  int pixel_per_col_line
          The number of pixels per colour line.
private  int pixel_per_lum_line
          The number of pixels per luminance line.
private  int range
          The range (equals to max - min) of the motion vector.
private  int recon_down_x
          The value of the vertical part of the motion vector.
private  int recon_down_x_prev
          The value of the vertical part of the previous motion vector.
private  int recon_right_x
          The value of the horizontal part value of the motion vector.
private  int recon_right_x_prev
          The value of the horizontal part of the previous motion vector.
private  boolean right_half_x
          True, if the fractional part > 0 of the horizontal part of the motion vector for the luminance blocks.
private  boolean right_half_x_col
          True, if the fractional part > 0 of the horizontal part of the motion vector for the chrominance blocks.
private  int right_x
          The integer part of the horizontal part of the motion vector for the luminance blocks.
private  int right_x_col
          The integer part of the horizontal part of the motion vector for the chrominance blocks.
private  int x_ward_f
          The size of the motion data.
 
Constructor Summary
motion_data()
           
 
Method Summary
 void compute_motion_vector(int motion_horiz_x_code, int motion_verti_x_code, int motion_horiz_x_r, int motion_verti_x_r)
          The method "compute_motion_vector" computes the motion vector according to the values supplied by the "MPEG_video".
 void copy_area(int mb_row, int mb_column, int[][] src, int[][] dst)
          The method "copy_area" grabs the area determined by the motion vector from "src" and puts it to the destination storage "dst".
 void copy_unchanged(int mb_row, int mb_column, int[][] src, int[][] dst)
          The method "copy_unchanged" grabs the "src" and puts it to the same position in "dst".
 void get_area(int mb_row, int mb_column, int[][] src, int[] dst)
          The method "get_area" grabs the area determined by the motion vector from "src" and puts it to the temporary storage "dst".
 void init(int f_pixel_per_lum_line, int f_pixel_per_col_line, int f_lum_y_incr, int f_col_y_incr)
          The method "init" is called by the "MPEG_video" as soon as the MPEG dimensions are known.
private  int motion_displacement(int motion_code, int PMD, int motion_r)
          The internal method "motion_displacement" computes the difference of the actual motion vector in respect to the last motion vector.
 void put_area(int mb_row, int mb_column, int[] src, int[][] dst)
          The method "put_area" gets the pixels from temporary storage "src" and adds them to the macroblock addressed by "mb_row" and "mb_column"
 void put_area(int mb_row, int mb_column, int[] src1, int[] src2, int[][] dst)
          The method "put_area(2)" is called if both, a forward and a backward motion vector is supplied.
 void reset_prev()
          In some situations it is necessary to reset the motion data.
 void set_pic_data(int f, boolean Full)
          The method "set_pic_data" is called from "MPEG_video" as soon as the size of the motion data is given.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

recon_right_x_prev

private int recon_right_x_prev
The value of the horizontal part of the previous motion vector.


recon_down_x_prev

private int recon_down_x_prev
The value of the vertical part of the previous motion vector.


recon_right_x

private int recon_right_x
The value of the horizontal part value of the motion vector.


recon_down_x

private int recon_down_x
The value of the vertical part of the motion vector.


right_x

private int right_x
The integer part of the horizontal part of the motion vector for the luminance blocks.


down_x

private int down_x
The integer part of the vertical part of the motion vector for the luminance blocks.


right_half_x

private boolean right_half_x
True, if the fractional part > 0 of the horizontal part of the motion vector for the luminance blocks.


down_half_x

private boolean down_half_x
True, if the fractional part > 0 of the vertical part of the motion vector for the luminance blocks.


right_x_col

private int right_x_col
The integer part of the horizontal part of the motion vector for the chrominance blocks.


down_x_col

private int down_x_col
The integer part of the vertical part of the motion vector for the chrominance blocks.


right_half_x_col

private boolean right_half_x_col
True, if the fractional part > 0 of the horizontal part of the motion vector for the chrominance blocks.


down_half_x_col

private boolean down_half_x_col
True, if the fractional part > 0 of the vertical part of the motion vector for the chrominance blocks.


x_ward_f

private int x_ward_f
The size of the motion data.


min

private int min
The min value of the motion vector.


max

private int max
The max value of the motion vector.


range

private int range
The range (equals to max - min) of the motion vector.


Full_pel_x_vector

private boolean Full_pel_x_vector
Equals true if full pixel accuracy is used, equals false, if half pixel accuracy is used.


error_count

private int error_count
The current number of printed errors in motion_data.


pixel_per_lum_line

private int pixel_per_lum_line
The number of pixels per luminance line.


pixel_per_col_line

private int pixel_per_col_line
The number of pixels per colour line.


lum_y_incr

private int lum_y_incr
The increment for the luminance line, equals to pixel_per_lum_line - 8.


col_y_incr

private int col_y_incr
The increment for the luminance line, equals to pixel_per_col_line - 8.

Constructor Detail

motion_data

public motion_data()
Method Detail

init

public final void init(int f_pixel_per_lum_line,
                       int f_pixel_per_col_line,
                       int f_lum_y_incr,
                       int f_col_y_incr)
The method "init" is called by the "MPEG_video" as soon as the MPEG dimensions are known.

Parameters:
f_pixel_per_lum_line - the number of pixels per luminance line.
f_pixel_per_col_line - the number of pixels per colour line.
f_lum_y_incr - the increment for the luminance line, equals to f_pixel_per_lum_line - 8.
f_col_y_incr - the increment for the luminance line, equals to f_pixel_per_col_line - 8.

set_pic_data

public final void set_pic_data(int f,
                               boolean Full)
The method "set_pic_data" is called from "MPEG_video" as soon as the size of the motion data is given.

Parameters:
f - the size of the motion data.
Full - equals true if full pixel accuracy is used, equals false, if half pixel accuracy is used.

reset_prev

public final void reset_prev()
In some situations it is necessary to reset the motion data. Therefore a method "reset_prev" is implemented.


motion_displacement

private final int motion_displacement(int motion_code,
                                      int PMD,
                                      int motion_r)
The internal method "motion_displacement" computes the difference of the actual motion vector in respect to the last motion vector.

Parameters:
motion_code - the motion code value for prediction.
PMD - the motion displacement value of the previous motion vector.
motion_r - the motion residual value.
Returns:
the motion vector value.

compute_motion_vector

public final void compute_motion_vector(int motion_horiz_x_code,
                                        int motion_verti_x_code,
                                        int motion_horiz_x_r,
                                        int motion_verti_x_r)
The method "compute_motion_vector" computes the motion vector according to the values supplied by the "MPEG_video". It uses the method "motion_displacement". The result are the motion vectors for the luminance and the chrominance blocks.

Parameters:
motion_horiz_x_code - the motion code value of horizontal part for prediction.
motion_verti_x_code - the motion code value of vertial part for prediction.
motion_horiz_x_r - the motion residual value of horizontal part for prediction.
motion_verti_x_r - the motion residual value of vertial part for prediction.

get_area

public final void get_area(int mb_row,
                           int mb_column,
                           int[][] src,
                           int[] dst)
The method "get_area" grabs the area determined by the motion vector from "src" and puts it to the temporary storage "dst". If the motion vectors define half steps the method follows the instructions given in ISO 11172-2.

Parameters:
mb_row - the row of the left top corner of the area to grab.
mb_column - the column of the left top corner of the area to grab.
src - the source YUV frame.
dst - the destination YUV frame.

copy_area

public final void copy_area(int mb_row,
                            int mb_column,
                            int[][] src,
                            int[][] dst)
The method "copy_area" grabs the area determined by the motion vector from "src" and puts it to the destination storage "dst". If the motion vectors define half steps the method follows the instructions given in ISO 11172-2.

Parameters:
mb_row - the row of the left top corner of the area to grab.
mb_column - the column of the left top corner of the area to grab.
src - the source YUV frame.
dst - the destination YUV frame.

copy_unchanged

public final void copy_unchanged(int mb_row,
                                 int mb_column,
                                 int[][] src,
                                 int[][] dst)
The method "copy_unchanged" grabs the "src" and puts it to the same position in "dst".

Parameters:
mb_row - the row of the left top corner of the area to grab.
mb_column - the column of the left top corner of the area to grab.
src - the source YUV frame.
dst - the destination YUV frame.

put_area

public final void put_area(int mb_row,
                           int mb_column,
                           int[] src,
                           int[][] dst)
The method "put_area" gets the pixels from temporary storage "src" and adds them to the macroblock addressed by "mb_row" and "mb_column"

Parameters:
mb_row - the row of the left top corner of the area to grab.
mb_column - the column of the left top corner of the area to grab.
src - the source YUV frame.
dst - the destination YUV frame.

put_area

public final void put_area(int mb_row,
                           int mb_column,
                           int[] src1,
                           int[] src2,
                           int[][] dst)
The method "put_area(2)" is called if both, a forward and a backward motion vector is supplied. In this case the method computes the average color of the 2 given areas "src1" and "src2" and adds the result(s) to the macro block addressed by "mb_row" and "mb_column".

Parameters:
mb_row - the row of the left top corner of the area to grab.
mb_column - the column of the left top corner of the area to grab.
src1 - first source YUV frame.
src2 - second source YUV frame.
dst - the destination YUV frame.