static void vc1TOOLS_PadComponent(
vc1_sComponent * pC,
vc1_sImagePosition *pIP,
int Field)
{
vc1_sRectangle * pPadFromRect = &pIP->sPadFromRectangle;
vc1_sRectangle * pPadToRect = &pIP->sPadToRectangle;
int X, Y;
int IXMin = pPadFromRect->XMin;
int IXMax = pPadFromRect->XMax;
int IYMin = pPadFromRect->YMin;
int IYMax = pPadFromRect->YMax;
int PXMin = pPadToRect->XMin;
int PXMax = pPadToRect->XMax;
int PYMin = pPadToRect->YMin;
int PYMax = pPadToRect->YMax;
int Bpl = pC->Bpl;
UBYTE8 *pData = pC->pData;
UBYTE8 *pPixels;
UBYTE8 Pixel;
if (Field<2)
{
if (Field==1)
{
/* Bottom field */
pData += Bpl;
}
/* Interlace */
IYMin = IYMin/2;
IYMax = IYMax/2;
PYMin = PYMin/2;
PYMax = PYMax/2;
Bpl = Bpl*2;
}
/* Pad left and right edges */
pPixels = &pData[IYMin * Bpl];
for (Y = IYMin; Y <= IYMax; Y++)
{
/* left edge */
Pixel = pPixels[IXMin];
for (X = PXMin; X < IXMin; X++)
{
pPixels[X] = Pixel;
}
/* right edge */
Pixel = pPixels[IXMax];
for (X = IXMax + 1; X <= PXMax; X++)
{
pPixels[X] = Pixel;
}
pPixels += Bpl;
}
/* Pad top and bottom edges */
pPixels = &pData[PXMin];
for (X = PXMin; X <= PXMax; X++)
{
/* pad top */
Pixel = pPixels[IYMin * Bpl];
for (Y = PYMin; Y < IYMin; Y++)
{
pPixels[Y*Bpl] = Pixel;
}
/* pad bottom */
Pixel = pPixels[IYMax * Bpl];
for (Y = IYMax+1; Y <= PYMax; Y++)
{
pPixels[Y*Bpl] = Pixel;
}
pPixels++;
}
}
这个代码怎么优化?