31.8.3 mips_h264_mc_luma

Description

This function computes 1/4-pixel motion compensation for luma blocks as specified by the H.264 video compression standard. The function performs all necessary interpolations depending on the fractional offset of the desired block as specified by the dx and dy input parameters. Note, however, that there is no special handling of cases that cross the picture edge. It is expected that the image will be enlarged by four pixels in each direction and the pixels along the edges of the image will be replicated to the expanded borders.

Include

dsplib_video.h

Prototype

void
mips_h264_mc_luma
(
       uint8 b[4][4],
       uint8 *src,
       int ystride,
       int dx,
       int dy
);

Argument

b: Output 4x4-pixel array in 8-bit unsigned integer format.

src: Pointer to the top-left pixel of the source image block.

ystride: Vertical stride, i.e., distance in bytes between corresponding pixels on adjacent rows.

dx, dy: Fractional pixel offsets multiplied by four, e.g., dx = 1 specifies a 1/4-pixel offset.

Return Value

None.

Remarks:

The offsets dx and dy must have values between 0 and 3 inclusive.

Example

uint8 b[4][4];
uint8 luma[HEIGHT][WIDTH];

int ystride = WIDTH;

...

// obtain 1/4-pixel coordinates of desired block
int x4 = ...;
int y4 = ...;

// compute the integer and fractional parts
int x = x4 >> 2;
int y = y4 >> 2;
int dx4 = x4 & 0x03;
int dy4 = y4 & 0x03;

mips_h264_mc_luma(b, &luma[y][x], ystride, dx4, dy4);