PredictIntra_4x4_H264

Performs intra prediction for a 4x4 luma component.

Syntax

IppStatus ippiPredictIntra_4x4_H264_8u_C1IR(Ipp8u* pSrcDst, Ipp32s srcdstStep, IppIntra4x4PredMode predMode, Ipp32s availability);

Parameters

pSrcDst

Pointer to the source and destination array.

srcdstStep

Distance in bytes between starts of the consecutive lines in the source and destination arrays. (Y-frame width in bytes).

predMode

Prediction mode of the Intra_4x4 prediction process for luma samples.

availability

Flag that specifies availability of the samples used for prediction.

Description

The function ippiPredictIntra_4x4_H264_8u_C1IR is declared in the ippvc.h file. This function performs intra prediction for a 4x4 luma component in accordance with 8.3.1.2 of [JVTG050] in a given prediction mode predMode (See enumeration IppIntra4x4PredMode).

The flag availability is computed as follows:

B1*IPP_LEFT + B2*IPP_UPPER_LEFT + B3*IPP_UPPER + B4*IPP_UPPER_RIGHT,

where the constants IPP_LEFT, IPP_UPPER_LEFT, IPP_UPPER, IPP_UPPER_RIGHT are from IppLayoutFlag and the variables B1, B2, B3, B4 may take the values of

0 -

if the block is unavailable for 4x4 prediction,

1 -

if the block is available for 4x4 prediction.

Layout of Blocks Used for Prediction



PredictIntra_4x4_H264 Usage Example 

// declare block parameters structure
typedef struct H264Block4x4Info_t
{
    Ipp32s x;
    Ipp32s y;
    Ipp32s existNeighbour;
    Ipp32s absentNeighbour;
} H264Block4x4Info_t;

// define parameters for all 16 blocks of a macroblock
static
H264Block4x4Info_t H264Block4x4Info[16] =
{
    { 0,  0,  0,  0},
    { 4,  0,  IPP_LEFT,  0},
    { 0,  4,  IPP_UPPER | IPP_UPPER_RIGHT,  0},
    { 4,  4,  IPP_UPPER | IPP_UPPER_LEFT,  IPP_UPPER_RIGHT},

    { 8,  0,  IPP_LEFT,  0},
    {12,  0,  IPP_LEFT,  0},
    { 8,  4,  IPP_UPPER | IPP_UPPER_LEFT | IPP_UPPER_RIGHT,  0},
    {12,  4,  IPP_UPPER | IPP_UPPER_LEFT,  IPP_UPPER_RIGHT},

    { 0,  8,  IPP_UPPER | IPP_UPPER_RIGHT,  0},
    { 4,  8,  IPP_UPPER | IPP_UPPER_LEFT | IPP_UPPER_RIGHT,  0},
    { 0, 12,  IPP_UPPER | IPP_UPPER_RIGHT,  0},
    { 4, 12,  IPP_UPPER | IPP_UPPER_LEFT,  IPP_UPPER_RIGHT},

    { 8,  8,  IPP_UPPER | IPP_UPPER_LEFT | IPP_UPPER_RIGHT,  0},
    {12,  8,  IPP_UPPER | IPP_UPPER_LEFT,  IPP_UPPER_RIGHT},
    { 8, 12,  IPP_UPPER | IPP_UPPER_LEFT | IPP_UPPER_RIGHT,  0},
    {12, 12,  IPP_UPPER | IPP_UPPER_LEFT,  IPP_UPPER_RIGHT}
};

void DoIntraPrediction4x4Granulation(void)
{
    // given variables
    Ipp32s mbX, mbY, mbWidth;
    Ipp8u* pMb;
    Ipp32s imageStep;
    // working variables
    Ipp32u luma4x4BlkIdx;
    Ipp32s edgeType;
    Ipp32s mbAvailability;

    //...

   // calculate neighbouring macroblock availability
    edgeType = 0;
    if (mbX)
    {
        if (left_block_belongs_the_same_slice)
            edgeType |= IPP_LEFT;
    }
    if (mbY)
    {
        if ((mbX - 1 < mbWidth) &&
            (top_right_block_belongs_the_same_slice))
            mbAvailability |= IPP_UPPER_RIGHT;
        if (top_block_belongs_the_same_slice)
            mbAvailability |= IPP_UPPER;
        if ((mbX) &&
            (top_left_block_belongs_the_same_slice))
            mbAvailability |= IPP_UPPER_LEFT;
    }

    // main working cycle
    for (luma4x4BlkIdx = 0; luma4x4BlkIdx < 16; luma4x4BlkIdx += 1)
    {
        IppIntra4x4PredMode_H264 predMode;
        Ipp32s blockAvailability;
        Ipp8u* pBlock4x4;

        // get intra prediction mode
        predMode = (IppIntra4x4PredMode_H264) 
Intra4x4PredMode[luma4x4BlkIdx];

        // get block parameters
        {
            H264Block4x4Info_t blockInfo = 
H264Block4x4Info[luma4x4BlkIdx];

            // get block pointer
            pBlock4x4 = pMb + blockInfo.y*  imageStep + blockInfo.x;

            // get block neighbours
            blockAvailability = mbAvailability &
 ~(blockInfo.absentNeighbour);
            blockAvailability |= blockInfo.existNeighbour;
        }

        // do intra prediction
        ippiPredictIntra_4x4_H264_8u_C1IR(pBlock4x4,
                                          imageStep,
                                          predMode,
                                          blockAvailability);

        // do block reconstruction
        // ...
    }

} // void DoIntraPrediction4x4Granulation(void)

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 srcdstStep value is less than 4.

ippStsOutOfRangeErr

Indicates an error condition if predMode value falls outside [0,8].

ippStsResFloor

Indicates a warning condition if predMode is not allowed for this block.


Submit feedback on this help topic

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