IMG_quantize


Detailed Description


Functions

void IMG_quantize (short *data, unsigned short num_blks, unsigned short blk_size, const short *recip_tbl, int q_pt)


Function Documentation

void IMG_quantize ( short *  data,
unsigned short  num_blks,
unsigned short  blk_size,
const short *  recip_tbl,
int  q_pt 
)

Description:
The function quantize() quantizes matrices by multiplying their contents with a second matrix that contains reciprocals of the quantization terms. This step corresponds to the quantization that is performed in 2-D DCT-based compression techniques, although quantize() may be used on any signed 16-bit data using signed 16-bit quantization terms.
quantize() multiplies the contents of the quantization matrix with the data being quantized. Therefore, it may be used for inverse quantization as well, by setting the Q-point appropriately.
The assembly code does not explicitly disable interrupts. On entry to the function, interrupts are masked by branch delay slots for a maximum of 16 cycles.
Parameters:
data Data to be quantized
num_blks Number of blocks to process
blk_size Block size (multiple of 16)
recip_tbl Quant. values (reciprocals)
q_pt Q-point of Quant values
Algorithm:
The outer loop is unrolled 16 times to allow greater amounts of work to be performed in the inner loop. The resulting loop- nest was then collapsed and pipelined as a single loop, since the code is not bottlenecked on bandwidth.
Reciprocals and data terms are loaded in groups of four using double-word loads, making best use of the available memory bandwidth.
Assumptions:
  • The recip_tbl[] and data[] must be double-word aligned
  • The block size, blk_size, must be a multiple of 16 and at least 32
  • The number of blocks, num_blks, may be zero
  • The Q-point, q_pt, must be in the range 0 <= q_pt <= 31.
  • The data[] array must be 'num_blks * blk_size' elements
  • The recip_tbl[] array must be 'blk_size' elements
Implementation Notes:
  • This code is fully interruptible and fully reentrant
  • This code is compatible with C66x processors (though not optimized)
  • Twin stack pointers have been used to speed up stack accesses
  • SSHVR is used in the M-unit to avoid an S-unit bottleneck
  • No bank conflicts occur regardless of the relative orientation of recip_tbl[] and data[]
  • Six words of stack frame are used for Save-On-Entry registers
Benchmarks:
See IMGLIB_Test_Report.html for cycle and memory information.


Copyright 2012, Texas Instruments Incorporated