pWorkrow = pData->pWorkrow + 1;
pWorkrow = pData->pWorkrow + pData->iPixelofs;
mng_retcode delta_g4 (mng_datap pData){  mng_imagedatap pBuf = ((mng_imagep)pData->pDeltaImage)->pImgbuf;  mng_uint8p     pWorkrow;  mng_uint8p     pOutrow;  mng_int32      iX;  mng_uint8      iB;  mng_uint8      iM;  mng_uint32     iS;  mng_uint8      iQ;#ifdef MNG_SUPPORT_TRACE  MNG_TRACE (pData, MNG_FN_DELTA_G4, MNG_LC_START)#endif  pWorkrow = pData->pWorkrow + 1;      /* temporary work pointers */  pOutrow  = pBuf->pImgdata + (pData->iRow         * pBuf->iRowsize   ) +                              (pData->iDeltaBlocky * pBuf->iRowsize   ) +                              (pData->iCol         * pBuf->iSamplesize) +                              (pData->iDeltaBlockx * pBuf->iSamplesize);  iM       = 0;                        /* start at pixel 0 */  iB       = 0;  iS       = 0;                                       /* pixel replace ? */  if (pData->iDeltatype == MNG_DELTATYPE_BLOCKPIXELREPLACE)  {    for (iX = 0; iX < pData->iRowsamples; iX++)    {      if (!iM)                         /* mask underflow ? */      {        iB = *pWorkrow;                /* get next input-byte */        pWorkrow++;        iM = 0xF0;        iS = 4;      }                                       /* get the gray level */      iQ = (mng_uint8)((iB & iM) >> iS);                                       /* expand to 8-bit by replication */      iQ = (mng_uint8)(iQ + (iQ << 4));      *pOutrow = iQ;                   /* put in object buffer */      pOutrow += pData->iColinc;       /* next pixel */      iM >>= 4;      iS -= 4;    }  }  else  {                                    /* pixel add ! */    for (iX = 0; iX < pData->iRowsamples; iX++)    {      if (!iM)                         /* mask underflow ? */      {        iB = *pWorkrow;                /* get next input-byte */        pWorkrow++;        iM = 0xF0;        iS = 4;      }                                       /* get the gray level */      iQ = (mng_uint8)(((*pOutrow >> 4) + ((iB & iM) >> iS)) & 0x0F);                                       /* expand to 8-bit by replication */      iQ = (mng_uint8)(iQ + (iQ << 4));      *pOutrow = iQ;                   /* put in object buffer */      pOutrow += pData->iColinc;       /* next pixel */      iM >>= 4;      iS -= 4;    }  }#ifdef MNG_SUPPORT_TRACE  MNG_TRACE (pData, MNG_FN_DELTA_G4, MNG_LC_END)#endif  return store_g4 (pData);}