Dirac Research Encoder Stages

From DiracWiki

Jump to: navigation, search

The Dirac Research encoder main loop is located in the SequenceCompressor class, inside the CompressNextPicture() function. This function returns a pointer to an EncPicture object, containing reconstructed data, original data, wavelet coefficients and motion data. The class is constructed with a pointer to the output bitstream and stores the compressed picture data in Dirac format, which is then pushed onto the bitstream when coding is finished.

The stages in the Dirac Research encoder currently are as follows:

Contents

[edit] Set picture type and references

Loop through the encoder queue, setting the picture type and references for all pictures whose type hasn't already been determined. This is done based on the GOP parameters. These picture types can be changed later as the GOP is adapted.

[edit] Pixel motion estimation

Loop over the queue and do pixel accurate motion estimation according to the references set in Stage 1.

[edit] Subpixel ME and mode decision

For the current picture, refine the pel-accurate motion field to subpel accuracy and then do mode decision.

[edit] Subgroup reconfiguration

If the current picture is a scheduled P picture, check the motion information to see if the subgroup needs reconfiguring. This is currently done by the number of intra blocks - if this is greater than a threshold the subgroup becomes PPP rather than PBB. This means that the current picture then changes: re-do subpixel ME and mode decision in this case (since every scheduled B picture is already predicted from the previous picture there is no need to redo pel ME).

[edit] Intra insertion

If the current picture is inter and is still not satisfactory, recode as Intra. This decision is also based on the proportion of intra blocks. If the current picture was a scheduled P picture, then the GOP is restarted i.e. the picture type and references are all recomputed relative to this picture.

[edit] Motion compensate

If inter, motion compensate the current picture.

[edit] Code motion data

[edit] Prefilter, wavelet transform, quantise and code residue

Prefiltering is an encoder option, and the degree of prefiltering may depend on the lambda/QF being used for the picture

[edit] Output data

Output the Dirac formatted data to the Dirac byte stream.

[edit] Reconstruction

For reference pictures, do IDWT on the quantised and reconstructed coefficients and motion compensated addition from reconstructed references. Clip the reconstructed data to keep it in range.

[edit] Remove expired pictures

Remove non-reference pictures that have been output and expired reference pictures.

[edit] CBR model update

Update the CBR model with the statistics of the current picture. At the end of each subgroup, or in case the predicted and actual picture bitrates disagree badly, this will set a new lambda for the next picture to be encoded.

Personal tools