InterpolateChroma_H264

Performs interpolation for motion estimation of the chroma component using fractional part of motion vector.

Syntax

IppStatus ippiInterpolateChroma_H264_8u_C1R(const Ipp8u* pSrc, Ipp32s srcStep, Ipp8u* pDst, Ipp32s dstStep, Ipp32s dx, Ipp32s dy, IppiSize roiSize);

IppStatus ippiInterpolateChroma_H264_8u_C2P2R(const Ipp8u* pSrcUV, Ipp32s srcStep, Ipp8u* pDstU, Ipp8u* pDstV, Ipp32s dstStep, Ipp32s dx, Ipp32s dy, IppiSize roi);

IppStatus ippiInterpolateChroma_H264_16u_C1R(const IppVCInterpolate_16u* interpolateInfo);

Parameters

pSrc

Pointer to the source

pSrcUV

Pointer to the source block (chrominance part of NV12 plane)

0 UV UV UV UV UV UV UV UV 1 UV UV UV UV UV UV UV UV ... 7 UV UV UV UV UV UV UV UV

srcStep

Distance in items between starts of the consecutive lines in the source image

pDst

Pointer to the destination buffer

pDstU

Pointer to the destination buffer for interpolated U coefficients

pDstV

Pointer to the destination buffer for interpolated V coefficients

dstStep

Distance in items between starts of the consecutive lines in the destination image

dx, dy

Fractional parts of the motion vector in 1/8 pel units (0, 1, ..., 7)

roiSize

Flag that specifies the dimensions of the region of interest (could be 16, 8, 4 or 2 in height dimension and 8, 4 or 2 in width dimension). See structure IppiSize.

roi

Size value that specifies the dimensions of the ROI; could be 16, 8 or 4 in each dimansion)

interpolateInfo

Pointer to the IppVCInterpolate_16u structure

Description

The functions ippiInterpolateChroma_H264_8u_C1R, ippiInterpolateChroma_H264_8u_C2P2R, and ippiInterpolateChroma_H264_16u_C1R are declared in the ippvc.h file. These functions perform interpolation for motion estimation of the chroma component in accordance with 8.4.2.2.2 of [JVTG050].

The functions use only the fractional part of the motion vector. The integer part is used when finding the position (pointed to by pSrc) in the source frame.

Interpolation for Motion Estimation of Chroma Component



Note iconNote

Make sure all samples that are used for interpolation are within the boundaries of the source frame. To solve the problem, enlarge the source frame by using boundary samples or use InterpolateChromaTop_H264 or InterpolateChromaBottom_H264 functions.

ippiInterpolateChroma_H264_8u_C2P2R is a clone of ippiInterpolateChroma_H264_8u_C1R but the source image is a chrominance part of an NV12 plane:


YY YY YY YY YY YY YY YY UV UV UV UV - chrominance part of NV12 plane
.

Usage of ippiInterpolateChroma_H264_8u_C1R

Ipp32s iHVector, iVVector;
IppiSize roi_chroma = {width_of_chroma_block, height_of_chroma_block};
Ipp32s iChromaXPos = x_position_of_current_chroma_block;
Ipp32s iChromaYPos = y_position_of_current_chroma_block;
Ipp8u* pRefUPlane = corresponding_u_block_of_reference_u_frame;
Ipp8u* pRefVPlane = corresponding_v_block_of_reference_v_frame;
Ipp32s iPitch = reference_chroma_frame_pitch;
Ipp8u* pDstU = destination_u_block;
Ipp8u* pDstV = destination_v_block;
Ipp32s iDstPitch = destination_chroma_frame_pitch;

// create motion vectors
iHVector = horizontal_motion_vector;
iVVector = vertical_motion_vector;

{
    Ipp32s iHFraction, iVFraction;
    Ipp32s width, height;

    width = width_of_chroma_frame;
    height = height_of_chroma_frame;

    // prepare the horizontal vector, extract an interpolation fraction
    iHVector <<= ((Ipp32s) (3 <= color_format));
    iHFraction = iHVector & 7;
    iHVector >>= 3;

    // saturate the horizontal vector
    if (((unsigned) (width - 1 - roi_chroma.width)) <
        ((unsigned) (iHVector + iChromaXPos)))
    {
        // saturate to the left bound
        if (- 1 - roi_chroma.width >
            iHVector + iChromaXPos)
        {
            iHVector = - iChromaXPos - roi_chroma.width - 1;
        }
        // saturate to the right bound
        else if (width <
                iHVector + iChromaXPos)
        {
            iHVector = width - iChromaXPos;
        }
    }

    // prepare the vertical vector, extract an interpolation factor
    iVVector <<=((Ipp32s) (2 <= color_format));
    iVFraction = iVVector & 7;
    iVVector >>= 3;

    // most usual prediction
    // NOTE: we decrement the height to avoid factor's influence
    if (((unsigned) (height - 1 - roi_chroma.height)) >=
        ((unsigned) (iVVector + iChromaYPos)))
    {
        ippiInterpolateChroma_H264_8u_C1R(pRefVPlane + iVVector*  iPitch + iHVector,
                                          iPitch,
                                          pDstV,
                                          iDstPitch,
                                          iHFraction,
                                          iVFraction,
                                          roi_chroma);

        ippiInterpolateChroma_H264_8u_C1R(pRefUPlane + iVVector*  iPitch + iHVector,
                                          iPitch,
                                          pDstU,
                                          iDstPitch,
                                          iHFraction,
                                          iVFraction,
                                          roi_chroma);
    }
    // prediction from the top of the frame
    else if (0 > iVVector)
    {
        // sometimes the vector points nothing
        ippiInterpolateChromaTop_H264_8u_C1R(pRefVPlane + iVVector*  iPitch + iHVector,
                                             iPitch,
                                             pDstV,
                                             iDstPitch,
                                             iHFraction,
                                             iVFraction,
                                             - iVVector - iChromaYPos,
                                             roi_chroma);

        ippiInterpolateChromaTop_H264_8u_C1R(pRefUPlane + iVVector*  iPitch + iHVector,
                                             iPitch,
                                             pDstU,
                                             iDstPitch,
                                             iHFraction,
                                             iVFraction,
                                             - iVVector - iChromaYPos,
                                             roi_chroma);

    }
    // prediction from the bottom of the frame
    else
    {
        // sometimes the vector points nothing
        ippiInterpolateChromaBottom_H264_8u_C1R(pRefVPlane + iVVector*  iPitch + iHVector,
                                                iPitch,
                                                pDstV,
                                                iDstPitch,
                                                iHFraction,
                                                iVFraction,
                                                iVVector + roi_chroma.height +
                                                iChromaYPos - height,
                                                roi_chroma);

        ippiInterpolateChromaBottom_H264_8u_C1R(pRefUPlane + iVVector*  iPitch + iHVector,
                                                iPitch,
                                                pDstU,
                                                iDstPitch,
                                                iHFraction,
                                                iVFraction,
                                                iVVector + roi_chroma.height +
                                                iChromaYPos - height,
                                                roi_chroma);
    }
}

Usage of ippiInterpolateChroma_H264_8u_C2P2R

Ipp32s iHVector, iVVector;
IppiSize roi_chroma = {width_of_chroma_block, height_of_chroma_block};
Ipp32s iChromaXPos = x_position_of_current_chroma_block;
Ipp32s iChromaYPos = y_position_of_current_chroma_block;
Ipp8u* pRefUVPlane = corresponding_uv_block_of_reference_uv_frame;
Ipp32s iPitch = reference_chroma_frame_pitch;
Ipp8u* pDstU = destination_u_block;
Ipp8u* pDstV = destination_v_block;
Ipp32s iDstUVPitch = destination_uv_block_pitch;

// create motion vectors
iHVector = horizontal_motion_vector;
iVVector = vertical_motion_vector;

{
    Ipp32s iHFraction, iVFraction;
    Ipp32s width, height;

    width = width_of_chroma_frame;
    height = height_of_chroma_frame;

    // prepare the horizontal vector, extract an interpolation fraction
    iHVector <<= ((Ipp32s) (3 <= color_format));
    iHFraction = iHVector & 7;
    iHVector >>= 3;

    // saturate the horizontal vector
    if (((unsigned) (width - 1 - roi_chroma.width)) <
        ((unsigned) (iHVector + iChromaXPos)))
    {
        // saturate to the left bound
        if (- 1 - roi_chroma.width >
            iHVector + iChromaXPos)
        {
            iHVector = - iChromaXPos - roi_chroma.width - 1;
        }
        // saturate to the right bound
        else if (width <
                iHVector + iChromaXPos)
        {
            iHVector = width - iChromaXPos;
        }
    }
			
    // prepare the vertical vector, extract an interpolation factor
    iVVector <<=((Ipp32s) (2 <= color_format));
    iVFraction = iVVector & 7;
    iVVector >>= 3;
			
    // most usual prediction
    // NOTE: we decrement the height to avoid factor's influence
    if (((unsigned) (height - 1 - roi_chroma.height)) >=
        ((unsigned) (iVVector + iChromaYPos)))
    {
        ippiInterpolateChroma_H264_8u_C2P2R(pRefUVPlane + iVVector*  iPitch + 2*iHVector,
                                          iPitch,
                                          pDstU,
                                          pDstV,
                                          iDstUVPitch,
                                          iHFraction,
                                          iVFraction,
                                          roi_chroma);
    }
    // prediction from the top of the frame
    else if (0 > iVVector)
    {
        // ....
    }
}

These functions are used in the H.264 decoder and encoder included into Intel IPP Samples. See introduction to H.264.

Return Values

ippStsNoErr

Indicates no error.

ippStsNullPtrErr

Indicates an error condition if at least one of the specified pointers is NULL.

ippStsStepErr

Indicates an error condition if srcStep value is less than 8.

ippStsBadArgErr

Indicates an error condition if dx or dy values fall outside [0,7].

ippStsSizeErr

Indicates an error condition if roi.width or roi.height take values other than 16, 8, 4 or 2.


Submit feedback on this help topic

Copyright © 2000 - 2010, Intel Corporation. All rights reserved.