Methods and apparatuses for variable length encoding using a vector
processing unit. In one aspect of the invention, a method for execution
by a microprocessor to perform variable length encoding includes:
receiving a plurality of parameters, each of the plurality of parameters
corresponding to one of a plurality of symbols to be variable length
encoded; generating concurrently a plurality of first codewords from the
plurality of parameters to represent respectively the plurality of
symbols; generating a plurality of lengths representing respectively bit
lengths of the plurality of first codewords; and outputting the plurality
of first codewords and the plurality of lengths; where the above
operations are performed in response to the microprocessor receiving a
single instruction.