parset.c File Reference

Picture and Sequence Parameter set generation and handling. More...

#include <time.h>
#include <limits.h>
#include "global.h"
#include "contributors.h"
#include "nal.h"
#include "mbuffer.h"
#include "parset.h"
#include "vlc.h"
#include "q_matrix.h"

Include dependency graph for parset.c:

Go to the source code of this file.

Functions

static int IdentifyProfile (InputParameters *p_Inp)
static int IdentifyLevel (InputParameters *p_Inp)
static int GenerateVUI_parameters_rbsp (seq_parameter_set_rbsp_t *sps, Bitstream *bitstream)
void GenerateParameterSets (ImageParameters *p_Img, InputParameters *p_Inp)
void FreeParameterSets (ImageParameters *p_Img)
NALU_tGenerateSeq_parameter_set_NALU (ImageParameters *p_Img)
NALU_tGeneratePic_parameter_set_NALU (ImageParameters *p_Img, InputParameters *p_Inp, int PPS_id)
void GenerateSequenceParameterSet (seq_parameter_set_rbsp_t *sps, ImageParameters *p_Img, InputParameters *p_Inp, int SPS_id)
void GeneratePictureParameterSet (pic_parameter_set_rbsp_t *pps, seq_parameter_set_rbsp_t *sps, ImageParameters *p_Img, InputParameters *p_Inp, int PPS_id, int WeightedPrediction, int WeightedBiprediction, int cb_qp_index_offset, int cr_qp_index_offset)
int Scaling_List (short *scalingListinput, short *scalingList, int sizeOfScalingList, short *UseDefaultScalingMatrix, Bitstream *bitstream)
int GenerateSeq_parameter_set_rbsp (ImageParameters *p_Img, seq_parameter_set_rbsp_t *sps, byte *rbsp)
int GeneratePic_parameter_set_rbsp (ImageParameters *p_Img, InputParameters *p_Inp, pic_parameter_set_rbsp_t *pps, byte *rbsp)
NALU_tGenerateSEImessage_NALU (InputParameters *p_Inp)
int GenerateSEImessage_rbsp (InputParameters *p_Inp, int id, byte *rbsp)
int WriteHRDParameters (seq_parameter_set_rbsp_t *sps, Bitstream *bitstream)
void GenerateVUIParameters (seq_parameter_set_rbsp_t *sps, InputParameters *p_Inp)

Variables

static const byte ZZ_SCAN [16]
static const byte ZZ_SCAN8 [64]


Detailed Description

Picture and Sequence Parameter set generation and handling.

parset.c

Date:
25 November 2002
Author:
Main contributors (see contributors.h for copyright, address and affiliation details)

Definition in file parset.c.


Function Documentation

void FreeParameterSets ( ImageParameters p_Img  ) 

frees global parameter sets active_sps and active_pps

Returns:
A NALU containing the Sequence ParameterSet

Definition at line 116 of file parset.c.

References FreePPS(), and FreeSPS().

Referenced by free_encoder_memory().

Here is the call graph for this function:

void GenerateParameterSets ( ImageParameters p_Img,
InputParameters p_Inp 
)

generates a sequence and picture parameter set and stores these in global active_sps and active_pps

Returns:
A NALU containing the Sequence ParameterSet

Definition at line 57 of file parset.c.

References AllocPPS(), AllocSPS(), GeneratePictureParameterSet(), GenerateSequenceParameterSet(), inp_par_enc::WeightedBiprediction, and inp_par_enc::WeightedPrediction.

Referenced by init_encoder().

Here is the call graph for this function:

NALU_t* GeneratePic_parameter_set_NALU ( ImageParameters p_Img,
InputParameters p_Inp,
int  PPS_id 
)

NALU_t *GeneratePic_parameter_set_NALU (ImageParameters *p_Img, InputParameters *p_Inp, int PPS_id);.

Note:
Uses the global variables through GenerateSequenceParameterSet() and GeneratePictureParameterSet
Returns:
A NALU containing the Picture Parameter Set

Definition at line 176 of file parset.c.

References AllocNALU(), GeneratePic_parameter_set_rbsp(), RBSPtoNALU(), and nalu_t::startcodeprefix_len.

Referenced by write_PPS().

Here is the call graph for this function:

int GeneratePic_parameter_set_rbsp ( ImageParameters p_Img,
InputParameters p_Inp,
pic_parameter_set_rbsp_t *  pps,
byte rbsp 
)

int GeneratePic_parameter_set_rbsp (ImageParameters *p_Img, InputParameters *p_Inp, pic_parameter_set_rbsp_t *pps, char *rbsp);

Parameters:
p_Img picture parameter structure
p_Inp InputParameters
pps picture parameter structure
rbsp buffer to be filled with the rbsp, size should be at least MAXIMUMPARSETRBSPSIZE
Returns:
size of the RBSP in bytes, negative in case of an error
Note:
Picture Parameter VUI function is called, but the function implements an exit (-1)

Definition at line 722 of file parset.c.

References Bitstream::bits_to_go, Bitstream::byte_pos, IdentifyProfile(), no_mem_exit(), Scaling_List(), se_v(), SODBtoRBSP(), Bitstream::streamBuffer, u_1(), u_v(), and ue_v().

Referenced by GeneratePic_parameter_set_NALU().

Here is the call graph for this function:

void GeneratePictureParameterSet ( pic_parameter_set_rbsp_t *  pps,
seq_parameter_set_rbsp_t *  sps,
ImageParameters p_Img,
InputParameters p_Inp,
int  PPS_id,
int  WeightedPrediction,
int  WeightedBiprediction,
int  cb_qp_index_offset,
int  cr_qp_index_offset 
)

GeneratePictureParameterSet: Generates a Picture Parameter Set structure.

Regarding the QP The previous software versions coded the absolute QP only in the slice header. This is kept, and the offset in the PPS is coded even if we could save bits by intelligently using this field.

Following set the parameter for different slice group types

Parameters:
pps Picture Parameter Set to be filled
sps used Sequence Parameter Set
p_Img the image pointer
p_Inp Input configuration parameters
PPS_id PPS ID
WeightedPrediction value of weighted_pred_flag
WeightedBiprediction value of weighted_bipred_idc
cb_qp_index_offset value of cb_qp_index_offset
cr_qp_index_offset value of cr_qp_index_offset

Definition at line 376 of file parset.c.

References FREXT_CAVLC444, FREXT_Hi10P, FREXT_Hi422, FREXT_Hi444, FREXT_HP, IdentifyProfile(), no_mem_exit(), inp_par_enc::num_slice_groups_minus1, inp_par_enc::output, inp_par_enc::run_length_minus1, inp_par_enc::slice_group_id, inp_par_enc::symbol_mode, inp_par_enc::top_left, inp_par_enc::UseConstrainedIntraPred, and YUV444.

Referenced by GenerateParameterSets().

Here is the call graph for this function:

NALU_t* GenerateSEImessage_NALU ( InputParameters p_Inp  ) 

Function body for SEI message NALU generation.

Returns:
A NALU containing the SEI messages

Definition at line 989 of file parset.c.

References AllocNALU(), GenerateSEImessage_rbsp(), RBSPtoNALU(), and nalu_t::startcodeprefix_len.

Referenced by rewrite_paramsets(), and start_sequence().

Here is the call graph for this function:

int GenerateSEImessage_rbsp ( InputParameters p_Inp,
int  id,
byte rbsp 
)

int GenerateSEImessage_rbsp (int, bufferingperiod_information_struct*, char*)

Returns:
size of the RBSP in bytes, negative in case of an error
Note:

Definition at line 1016 of file parset.c.

References Bitstream::bits_to_go, Bitstream::byte_pos, no_mem_exit(), SODBtoRBSP(), Bitstream::streamBuffer, and u_v().

Referenced by GenerateSEImessage_NALU().

Here is the call graph for this function:

NALU_t* GenerateSeq_parameter_set_NALU ( ImageParameters p_Img  ) 

int GenerateSeq_parameter_set_NALU (ImageParameters *p_Img);

Note:
Uses the global variables through GenerateSequenceParameterSet() and GeneratePictureParameterSet
Parameters:
p_Img ImageParameters structure
Returns:
A NALU containing the Sequence ParameterSet

Definition at line 146 of file parset.c.

References AllocNALU(), GenerateSeq_parameter_set_rbsp(), RBSPtoNALU(), and nalu_t::startcodeprefix_len.

Referenced by rewrite_paramsets(), and start_sequence().

Here is the call graph for this function:

int GenerateSeq_parameter_set_rbsp ( ImageParameters p_Img,
seq_parameter_set_rbsp_t *  sps,
byte rbsp 
)

int GenerateSeq_parameter_set_rbsp (ImageParameters *p_Img, seq_parameter_set_rbsp_t *sps, char *rbsp);

Parameters:
p_Img Image parameters structure
sps sequence parameter structure
rbsp buffer to be filled with the rbsp, size should be at least MAXIMUMPARSETRBSPSIZE
Returns:
size of the RBSP in bytes
Note:
Sequence Parameter VUI function is called, but the function implements an exit (-1)

Definition at line 592 of file parset.c.

References Bitstream::bits_to_go, Bitstream::byte_pos, GenerateVUI_parameters_rbsp(), no_mem_exit(), Scaling_List(), se_v(), SODBtoRBSP(), Bitstream::streamBuffer, u_1(), u_v(), ue_v(), and YUV444.

Referenced by GenerateSeq_parameter_set_NALU().

Here is the call graph for this function:

void GenerateSequenceParameterSet ( seq_parameter_set_rbsp_t *  sps,
ImageParameters p_Img,
InputParameters p_Inp,
int  SPS_id 
)

GenerateSequenceParameterSet: extracts info from global variables and generates sequence parameter set structure.

Parameters:
sps Sequence Parameter Set to be filled
p_Img ImageParameters for encoding
p_Inp InputParameters
SPS_id SPS ID
Function reads all kinds of values from several global variables, including p_Inp-> and image-> and fills in the sps. Many values are current hard-coded to defaults.

POC stuff: The following values are hard-coded in init_poc(). Apparently, the poc implementation covers only a subset of the poc functionality. Here, the same subset is implemented. Changes in the POC stuff have also to be reflected here

Parameters:
sps Sequence Parameter Set to be filled
p_Img ImageParameters for encoding
p_Inp Input configuration parameters
SPS_id SPS ID

Definition at line 213 of file parset.c.

References inp_par_enc::directInferenceFlag, error(), FREXT_CAVLC444, FREXT_Hi10P, FREXT_Hi422, FREXT_Hi444, FREXT_HP, GenerateVUIParameters(), IdentifyLevel(), IdentifyProfile(), inp_par_enc::IntraProfile, inp_par_enc::MbInterlace, inp_par_enc::num_ref_frames, inp_par_enc::output, inp_par_enc::pic_order_cnt_type, inp_par_enc::PicInterlace, and YUV444.

Referenced by GenerateParameterSets().

Here is the call graph for this function:

static int GenerateVUI_parameters_rbsp ( seq_parameter_set_rbsp_t *  sps,
Bitstream bitstream 
) [static]

Function body for VUI Parameter generation (to be done).

Returns:
exits with error message

Definition at line 894 of file parset.c.

References u_1(), u_v(), ue_v(), and WriteHRDParameters().

Referenced by GenerateSeq_parameter_set_rbsp().

Here is the call graph for this function:

void GenerateVUIParameters ( seq_parameter_set_rbsp_t *  sps,
InputParameters p_Inp 
)

int IdentifyLevel ( InputParameters p_Inp  )  [static]

Returns the Level.

Returns:
Level according to Annex A
Note:
This function is currently a dummy, but should calculate the level out of the config file parameters (primarily the picture size)

Definition at line 879 of file parset.c.

References inp_par_enc::LevelIDC.

Referenced by GenerateSequenceParameterSet().

int IdentifyProfile ( InputParameters p_Inp  )  [static]

Returns the Profile.

Returns:
Profile according to Annex A
Note:
Function is currently a dummy. Should "calculate" the profile from those config file parameters. E.g.
Profile = Baseline; if (CABAC Used || Interlace used) Profile=Main; if (!Cabac Used) && (Bframes | SPframes) Profile = Streaming;

Definition at line 861 of file parset.c.

References inp_par_enc::ProfileIDC.

Referenced by GeneratePic_parameter_set_rbsp(), GeneratePictureParameterSet(), and GenerateSequenceParameterSet().

int Scaling_List ( short *  scalingListinput,
short *  scalingList,
int  sizeOfScalingList,
short *  UseDefaultScalingMatrix,
Bitstream bitstream 
)

syntax for scaling list matrix values

Parameters:
scalingListinput input scaling list
scalingList scaling list to be used
sizeOfScalingList size of the scaling list
UseDefaultScalingMatrix usage of default Scaling Matrix
bitstream target bitstream for writing syntax
Returns:
size of the RBSP in bytes

Definition at line 539 of file parset.c.

References se_v().

Referenced by GeneratePic_parameter_set_rbsp(), and GenerateSeq_parameter_set_rbsp().

Here is the call graph for this function:

int WriteHRDParameters ( seq_parameter_set_rbsp_t *  sps,
Bitstream bitstream 
)

int WriteHRDParameters((seq_parameter_set_rbsp_t *sps, Bitstream *bitstream)

Returns:
size of the RBSP in bytes, negative in case of an error
Note:

Definition at line 1090 of file parset.c.

References u_1(), u_v(), and ue_v().

Referenced by GenerateVUI_parameters_rbsp().

Here is the call graph for this function:


Variable Documentation

const byte ZZ_SCAN[16] [static]

Initial value:

{  
  0,  1,  4,  8,  5,  2,  3,  6,  9, 12, 13, 10,  7, 11, 14, 15
}

Definition at line 33 of file parset.c.

const byte ZZ_SCAN8[64] [static]

Initial value:

{  0,  1,  8, 16,  9,  2,  3, 10, 17, 24, 32, 25, 18, 11,  4,  5,
   12, 19, 26, 33, 40, 48, 41, 34, 27, 20, 13,  6,  7, 14, 21, 28,
   35, 42, 49, 56, 57, 50, 43, 36, 29, 22, 15, 23, 30, 37, 44, 51,
   58, 59, 52, 45, 38, 31, 39, 46, 53, 60, 61, 54, 47, 55, 62, 63
}

Definition at line 38 of file parset.c.


Documentation generated with DoxyGen