Patent ID: 8634474

Claim:
A computer implemented method of encoding video data into a compressed form, comprising the steps of: encoding a next macroblock in a frame of the video data including storing Context based Adaptive Binary Arithmetic Coding (CABAC) data in CABAC engine registers for a current macroblock and a macroblock immediately previous to said current macroblock; classifying said current macroblock as a first type having recoverable CABAC engine registers or a second type having non-recoverable CABAC engine registers; determining whether adding said current macroblock to a current slice would exceed a slice data size limit; if adding said current macroblock to said current slice would not exceed said slice data size limit, repeating said encoding, determining and classifying steps for successive next macroblocks until adding said current macroblock to said current slice exceeds said slice data size limit; if adding said current macroblock to said current slice would exceed said slice data size limit if a macroblock immediately previous to said current macroblock is said first type, then restoring the CABAC engine registers for said immediately previous macroblock, setting a pointer to point to said immediately previous macroblock and ending said current slice following said immediately previous macroblock, if a macroblock immediately previous to said current macroblock is said second type, then if a macroblock immediately before said macroblock immediately previous to said current macroblock is said first type, then restoring the CABAC engine registers for said macroblock immediately before said immediately previous macroblock, setting a pointer to point to macroblock immediately before said immediately previous macroblock and ending said current slice following macroblock immediately before said immediately previous macroblock, and if a macroblock immediately before said macroblock immediately previous to said current macroblock is said second type, then restoring the CABAC engine registers for said macroblock immediately before said immediately previous macroblock by re-encoding said immediately previous macroblock, setting a pointer to point to said immediately previous macroblock and ending said current slice following said immediately previous macroblock.