DSPRelated.com
Forums

IMG_LIB MPEG 2 VLD

Started by mosh...@imagine-com.com April 10, 2007
I have a question regarding Mpeg2 VLD function of the TI IMG_LIB.
The API of the intra function is:

void IMG_mpeg2_vld_intra_

(

const short *RESTRICT Wptr, // quantization matrix

short *RESTRICT outi, // IDCT coefficients output array

IMG_mpeg2_vld *RESTRICT Mpeg2v, // bitstream context structure

int dc_pred[3], // DC prediction array

int mode_12Q4, // if !=0 returns coeffs in 12Q4 format

int num_blocks, // number of blocks in the MB

int bsbuf_words // bitstream buffer size

)

I see in the manual, that the bsbuf field in the IMG_mpeg2_vld struct, which contains the bits of the decoded DCT coeffs, should be word aligned to the size of bsbuf_words.
TI uses in their example a buffer of 512 words, 2048 bytes.
I guess it's because of loop unrolling.

The problem is that in the m2v bitstream, the DCT coeffs decoded bits are obviously not aligned. I am familiar with the mechanism of word0, word1 and word2 which create top0 and top1. This is ok.
But should I also copy the data to a 2048 bytes buffer before each calling to the VLD function?
This is obviously time consuming.

So what am I missing?

Thanks a lot,

Moshe