static Status parseAPP14(DataReader *pReader, JPEGAPP14Header *pHeader)
{
    BitstreamReader bs;

    Ipp8u  iMarker[5];
    size_t iSize = 5;

    pReader->Get16uSwap(&pHeader->iLength);

    pReader->CacheData(&iMarker[0], iSize);
    if(iMarker[0] == 'a' && iMarker[1] == 'd' && iMarker[2] == 'o' && iMarker[3] == 'b' && iMarker[4] == 'e')
    {
        pReader->MovePosition(5);
        bs.Init(pReader);

        pHeader->bAdobeDetected  = true;
        pHeader->iAdobeVersion   = bs.GetBits(16);
        pHeader->iAdobeFlags0    = bs.GetBits(16);
        pHeader->iAdobeFlags1    = bs.GetBits(16);
        pHeader->iAdobeTransform = bs.GetBits(8);

        bs.AlignReader();
    }

    return UMC_OK;
}
static Status parseAPP0(DataReader *pReader, JPEGAPP0Header *pHeader)
{
    BitstreamReader bs;

    Ipp8u  iMarker[5];
    size_t iSize = 5;

    pReader->Get16uSwap(&pHeader->iLength);

    pReader->CacheData(&iMarker[0], iSize);
    if(iMarker[0] == 'J' && iMarker[1] == 'F' && iMarker[2] == 'I' && iMarker[3] == 'F' && iMarker[4] == 0)
    {
        pReader->MovePosition(5);
        bs.Init(pReader);

        pHeader->bJfifDetected    = true;
        pHeader->iJfifVerMajor    = bs.GetBits(8);
        pHeader->iJfifVerMinor    = bs.GetBits(8);
        pHeader->iJfifUnits       = bs.GetBits(8);
        pHeader->iJfifXDensity    = bs.GetBits(16);
        pHeader->iJfifYDensity    = bs.GetBits(16);
        pHeader->iJfifThumbWidth  = bs.GetBits(8);
        pHeader->iJfifThumbHeight = bs.GetBits(8);

        bs.AlignReader();
    }

    pReader->CacheData(&iMarker[0], iSize);
    if(iMarker[0] == 'J' && iMarker[1] == 'F' && iMarker[2] == 'X' && iMarker[3] == 'X' && iMarker[4] == 0)
    {
        pReader->MovePosition(5);
        bs.Init(pReader);

        pHeader->bJfxxDetected       = true;
        pHeader->iJfxxThumbnailsType = bs.GetBits(8);

        bs.AlignReader();
    }

    pReader->CacheData(&iMarker[0], iSize);
    if(iMarker[0] == 'A' && iMarker[1] == 'V' && iMarker[2] == 'I' && iMarker[3] == '1')
    {
        pReader->MovePosition(4);
        bs.Init(pReader);

        pHeader->bAvi1Detected   = true;
        pHeader->iAvi1Polarity   = bs.GetBits(8);
        pHeader->iAvi1Reserved   = bs.GetBits(8);
        pHeader->iAvi1FiledSize1 = bs.GetBits(32);
        pHeader->iAvi1FiledSize2 = bs.GetBits(32);

        bs.AlignReader();
    }

    return UMC_OK;
}
Ejemplo n.º 3
0
Status Mpeg2FrameConstructor::ParsePictureHeader(Ipp8u *buf, Ipp32s iLen, Mpeg2TrackInfo *pInfo) {
    BitstreamReader bs;
    bs.SkipBits(32 + 4 + 4 + 4 + 4 + 4 + 2);
    bs.SkipBits(1 + 1 + 1 + 1 + 1 + 1 + 1);
    bs.SkipBits(5);
    bs.SkipBits(3);
    Ipp8u source_format;
    bs.SkipBits(22);
    bs.SkipBits(8);
    if (7 == source_format)     {
	Ipp8u ufep = (Ipp8u)bs.GetBits(3);
	if (0x01 == ufep)         {
	    bs.SkipBits(10);
	}
    }
    return Status();
}
static Status parseSOF(DataReader *pReader, JPEGSOFHeader *pHeader)
{
    BitstreamReader bs;
    bs.Init(pReader);

    pHeader->iLength    = bs.GetBits(16);
    pHeader->iPrecision = bs.GetBits(8);
    pHeader->iHeight    = bs.GetBits(16);
    pHeader->iWidth     = bs.GetBits(16);
    pHeader->iComonents = bs.GetBits(8);

    for(Ipp32u i = 0; i < pHeader->iComonents; i++)
    {
        pHeader->comonent[i].iID        = bs.GetBits(8);
        pHeader->comonent[i].iHSampling = bs.GetBits(4);
        pHeader->comonent[i].iVSampling = bs.GetBits(4);
        pHeader->comonent[i].iQSelector = bs.GetBits(8);
    }
    bs.AlignReader();

    return UMC_OK;
}