schroparams

schroparams

Synopsis




                    SchroVideoFormat;
                    SchroParams;
                    SchroSubband;
                    SchroMotionVector;
                    SchroMotionField;
                    SchroGlobalMotion;
struct              SchroProfile;
void                schro_params_calculate_iwt_sizes    (SchroParams *params);
void                schro_params_calculate_mc_sizes     (SchroParams *params);
int                 schro_params_validate               (SchroVideoFormat *format);
void                schro_params_set_video_format       (SchroVideoFormat *format,
                                                         SchroVideoFormatEnum index);
SchroVideoFormatEnum schro_params_get_video_format      (SchroVideoFormat *format);
void                schro_params_set_frame_rate         (SchroVideoFormat *format,
                                                         int index);
int                 schro_params_get_frame_rate         (SchroVideoFormat *format);
void                schro_params_set_aspect_ratio       (SchroVideoFormat *format,
                                                         int index);
int                 schro_params_get_aspect_ratio       (SchroVideoFormat *format);
void                schro_params_set_signal_range       (SchroVideoFormat *format,
                                                         int index);
int                 schro_params_get_signal_range       (SchroVideoFormat *format);
void                schro_params_set_colour_spec        (SchroVideoFormat *format,
                                                         int index);
int                 schro_params_get_colour_spec        (SchroVideoFormat *format);
void                schro_params_set_block_params       (SchroParams *params,
                                                         int index);
void                schro_params_set_default_codeblock  (SchroParams *params);

Description

Details

SchroVideoFormat

typedef struct {
  int width;
  int height;
  int chroma_format;
  int video_depth;
    
  int interlaced;
  int top_field_first;
  int sequential_fields;
  
  int frame_rate_numerator;
  int frame_rate_denominator;
  int aspect_ratio_numerator;
  int aspect_ratio_denominator;
    
  int clean_width;
  int clean_height;
  int left_offset;
  int top_offset;
    
  int luma_offset;
  int luma_excursion;
  int chroma_offset;
  int chroma_excursion;
    
  int colour_primaries;
  int colour_matrix;
  int transfer_function;

  /* calculated values */

  int chroma_h_shift;
  int chroma_v_shift;
  int chroma_width;
  int chroma_height;
} SchroVideoFormat;


SchroParams

typedef struct {
  SchroVideoFormat *video_format;

  /* transform parameters */
  int wavelet_filter_index;
  int transform_depth;
  int spatial_partition_flag;
  int nondefault_partition_flag;
  int horiz_codeblocks[SCHRO_MAX_TRANSFORM_DEPTH + 1];
  int vert_codeblocks[SCHRO_MAX_TRANSFORM_DEPTH + 1];
  int codeblock_mode_index;

  /* motion prediction parameters */
  int num_refs;
  int have_global_motion;
  int xblen_luma;
  int yblen_luma;
  int xbsep_luma;
  int ybsep_luma;
  int mv_precision;
  SchroGlobalMotion global_motion[2];
  int picture_pred_mode;
  int picture_weight_bits;
  int picture_weight_1;
  int picture_weight_2;

  /* calculated sizes */
  int iwt_chroma_width;
  int iwt_chroma_height;
  int iwt_luma_width;
  int iwt_luma_height;
  int mc_chroma_width;
  int mc_chroma_height;
  int mc_luma_width;
  int mc_luma_height;
  int x_num_blocks;
  int y_num_blocks;
} SchroParams;


SchroSubband

typedef struct {
  int x;
  int y;
  int w;
  int h;
  int offset;
  int stride;
  int chroma_w;
  int chroma_h;
  int chroma_offset;
  int chroma_stride;
  int has_parent;
  int scale_factor_shift;
  int horizontally_oriented;
  int vertically_oriented;
  int quant_index;
} SchroSubband;


SchroMotionVector

typedef struct {
  unsigned int pred_mode : 2;
  unsigned int using_global : 1;
  unsigned int split : 2;
  unsigned int unused : 3;
  unsigned int scan : 8;
  unsigned int metric : 16;
  int16_t x1;
  int16_t y1;
  int16_t x2;
  int16_t y2;
} SchroMotionVector;


SchroMotionField

typedef struct {
  int x_num_blocks;
  int y_num_blocks;
  SchroMotionVector *motion_vectors;
} SchroMotionField;


SchroGlobalMotion

typedef struct {
  int shift;
  int b0;
  int b1;
  int a_exp;
  int a00;
  int a01;
  int a10;
  int a11;
  int c_exp;
  int c0;
  int c1;
} SchroGlobalMotion;


struct SchroProfile

struct SchroProfile {
  int max_pixels_per_second;
  int max_blocks_per_second;
  int max_arith_ops_per_second;

  int max_transform_depth;

  int allow_global_motion;
  int allow_spatial_partition;
  int allow_inter;
};


schro_params_calculate_iwt_sizes ()

void                schro_params_calculate_iwt_sizes    (SchroParams *params);

Calculates the size of the array used for wavelet transformation using the current video format and transformation depth in the params structure. The params structure is updated with the new values.

The structure fields changed are: iwt_chroma_width, iwt_chroma_height, iwt_luma_width, iwt_luma_height.

params :

pointer to SchroParams structure

schro_params_calculate_mc_sizes ()

void                schro_params_calculate_mc_sizes     (SchroParams *params);

Calculates the size of the array used for motion compensation using the current video format and motion compensation paramters in the params structure. The params structure is updated with the new values.

The structure fields changed are: x_num_blocks, y_num_blocks, mc_luma_width, mc_luma_height, mc_chroma_width, mc_chroma_height.

params :

pointer to SchroParams structure

schro_params_validate ()

int                 schro_params_validate               (SchroVideoFormat *format);

format :

Returns :


schro_params_set_video_format ()

void                schro_params_set_video_format       (SchroVideoFormat *format,
                                                         SchroVideoFormatEnum index);

Initializes the video format structure pointed to by format to the standard Dirac video formats specified by index.

format :

index :


schro_params_get_video_format ()

SchroVideoFormatEnum schro_params_get_video_format      (SchroVideoFormat *format);

In Dirac streams, video formats are encoded by specifying a standard format, and then modifying that to get the desired video format. This function guesses a standard format to use as a starting point for encoding the video format pointed to by format.

FIXME: should rename this function to schro_params_get_std_video_format.

FIXME: the function that guesses the best format is poor

format :

pointer to SchroVideoFormat structure

Returns :

an index to the optimal standard format

schro_params_set_frame_rate ()

void                schro_params_set_frame_rate         (SchroVideoFormat *format,
                                                         int index);

Sets the frame rate of the video format structure pointed to by format to the Dirac standard frame specified by index.

format :

index :


schro_params_get_frame_rate ()

int                 schro_params_get_frame_rate         (SchroVideoFormat *format);

In Dirac bitstreams, frame rates can be one of several standard frame rates, encoded as an index, or the numerator and denominator of the framerate can be encoded directly. This function looks up the frame rate contained in the video format structure format in the list of standard frame rates. If the frame rate is a standard frame rate, the corresponding index is returned, otherwise 0 is returned.

format :

Returns :

index to a standard Dirac frame rate, or 0 if the frame rate is custom.

schro_params_set_aspect_ratio ()

void                schro_params_set_aspect_ratio       (SchroVideoFormat *format,
                                                         int index);

format :

index :


schro_params_get_aspect_ratio ()

int                 schro_params_get_aspect_ratio       (SchroVideoFormat *format);

format :

Returns :


schro_params_set_signal_range ()

void                schro_params_set_signal_range       (SchroVideoFormat *format,
                                                         int index);

Sets the signal range of the video format structure to one of the standard values indicated by index.

format :

index :


schro_params_get_signal_range ()

int                 schro_params_get_signal_range       (SchroVideoFormat *format);

In Dirac bitstreams, signal ranges can be one of several standard signal ranges, encoded as an index, or the extents of the signal range can be encoded directly. This function looks up the signal range contained in the video format structure format in the list of standard signal ranges. If the signal range is a standard signal range, the corresponding index is returned, otherwise 0 is returned.

format :

pointer to SchroVideoFormat structure

Returns :

index to standard signal range, or 0 if there is no corresponding standard signal range.

schro_params_set_colour_spec ()

void                schro_params_set_colour_spec        (SchroVideoFormat *format,
                                                         int index);

Sets the colour specification of the video format structure to one of the standard values indicated by index.

format :

pointer to SchroVideoFormat structure

index :

index to standard colour specification

schro_params_get_colour_spec ()

int                 schro_params_get_colour_spec        (SchroVideoFormat *format);

In Dirac bitstreams, colour specifications can be one of several standard colour specifications, encoded as an index, or the individual parts of the colour specication can be encoded. This function looks up the colour specification contained in the video format structure format in the list of standard colour specifications. If the colour specification is a standard colour specification, the corresponding index is returned, otherwise 0 is returned.

format :

pointer to SchroVideoFormat structure

Returns :

index to standard colour specification, or 0 if there is no corresponding standard colour specification.

schro_params_set_block_params ()

void                schro_params_set_block_params       (SchroParams *params,
                                                         int index);

Sets the block parameters for motion compensation in the parameters structure pointed to by params to the standard block parameters given by index.

params :

pointer to SchroParams structure

index :

index to standard block parameters

schro_params_set_default_codeblock ()

void                schro_params_set_default_codeblock  (SchroParams *params);

Sets the codeblock parameters in the parameters structure pointed to by params to the defaults.

params :

pointer to SchroParams structure