pImage->pImgbuf->iAlphabitdepth = pData->iJHDRalphabitdepth;
pImage->pImgbuf->iAlphabitdepth    = pData->iJHDRalphabitdepth; pImage->pImgbuf->iJHDRcompression  = pData->iJHDRimgcompression; pImage->pImgbuf->iJHDRinterlace    = pData->iJHDRimginterlace; pImage->pImgbuf->iAlphasampledepth = pData->iJHDRalphabitdepth;
mng_retcode process_display_jhdr (mng_datap pData){                                      /* address the current "object" if any */  mng_imagep  pImage   = (mng_imagep)pData->pCurrentobj;  mng_retcode iRetcode = MNG_NOERROR;#ifdef MNG_SUPPORT_TRACE  MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_JHDR, MNG_LC_START)#endif  if (!pData->bHasDHDR)  {    pData->fInitrowproc  = 0;          /* do nothing by default */    pData->fDisplayrow   = 0;    pData->fCorrectrow   = 0;    pData->fStorerow     = 0;    pData->fProcessrow   = 0;    pData->fStorerow2    = 0;    pData->pStoreobj     = MNG_NULL;   /* initialize important work-parms */    pData->iJPEGrow      = 0;    pData->iJPEGalpharow = 0;    pData->iJPEGrgbrow   = 0;    pData->iRowmax       = 0;          /* so init_rowproc does the right thing ! */  }  if (!pData->iBreakpoint)             /* not previously broken ? */  {    if (pData->bHasDHDR)               /* delta-image ? */    {      if (pData->iDeltatype == MNG_DELTATYPE_REPLACE)      {        iRetcode = reset_object_details (pData, (mng_imagep)pData->pDeltaImage,                                         pData->iDatawidth, pData->iDataheight,                                         pData->iJHDRimgbitdepth, pData->iJHDRcolortype,                                         pData->iJHDRalphacompression, pData->iJHDRalphafilter,                                         pData->iJHDRalphainterlace, MNG_TRUE);        ((mng_imagep)pData->pDeltaImage)->pImgbuf->iAlphabitdepth = pData->iJHDRalphabitdepth;      }    }    else    {      if (pImage)                      /* update object buffer ? */      {        iRetcode = reset_object_details (pData, pImage,                                         pData->iDatawidth, pData->iDataheight,                                         pData->iJHDRimgbitdepth, pData->iJHDRcolortype,                                         pData->iJHDRalphacompression, pData->iJHDRalphafilter,                                         pData->iJHDRalphainterlace, MNG_TRUE);        pImage->pImgbuf->iAlphabitdepth = pData->iJHDRalphabitdepth;      }      else                             /* update object 0 */      {        iRetcode = reset_object_details (pData, (mng_imagep)pData->pObjzero,                                         pData->iDatawidth, pData->iDataheight,                                         pData->iJHDRimgbitdepth, pData->iJHDRcolortype,                                         pData->iJHDRalphacompression, pData->iJHDRalphafilter,                                         pData->iJHDRalphainterlace, MNG_TRUE);        ((mng_imagep)pData->pObjzero)->pImgbuf->iAlphabitdepth = pData->iJHDRalphabitdepth;      }    }    if (iRetcode)                      /* on error bail out */      return iRetcode;  }  if (!pData->bHasDHDR)  {                                    /* we're always storing a JPEG */    if (pImage)                        /* real object ? */      pData->pStoreobj = pImage;       /* tell the row routines */    else                               /* otherwise use object 0 */      pData->pStoreobj = pData->pObjzero;                                       /* display "on-the-fly" ? */    if ( (pData->bDisplaying) && (pData->bRunning) && (!pData->bFreezing) &&         ( (pData->eImagetype == mng_it_jng         ) ||           (((mng_imagep)pData->pStoreobj)->bVisible)    )                   )    {      next_layer (pData);              /* that's a new layer then ! */      if (pData->bTimerset)            /* timer break ? */        pData->iBreakpoint = 7;      else      {        pData->iBreakpoint = 0;                                       /* anything to display ? */        if ((pData->iDestr > pData->iDestl) && (pData->iDestb > pData->iDestt))        {          set_display_routine (pData); /* then determine display routine */                                       /* display from the object we store in */          pData->pRetrieveobj = pData->pStoreobj;        }      }    }  }  if (!pData->bTimerset)               /* no timer break ? */  {    if ((!pData->bHasDHDR) || (pData->iDeltatype == MNG_DELTATYPE_REPLACE))    {                                  /* 8-bit JPEG ? */      if (pData->iJHDRimgbitdepth == 8)      {                                /* intermediate row is 8-bit deep */        pData->bIsRGBA16   = MNG_FALSE;        pData->iRowsamples = pData->iDatawidth;        switch (pData->iJHDRcolortype) /* determine pixel processing routines */        {          case MNG_COLORTYPE_JPEGGRAY :               {                 pData->fStorerow2   = (mng_ptr)store_jpeg_g8;                 pData->fRetrieverow = (mng_ptr)retrieve_g8;                 pData->bIsOpaque    = MNG_TRUE;                 break;               }          case MNG_COLORTYPE_JPEGCOLOR :               {                 pData->fStorerow2   = (mng_ptr)store_jpeg_rgb8;                 pData->fRetrieverow = (mng_ptr)retrieve_rgb8;                 pData->bIsOpaque    = MNG_TRUE;                 break;               }          case MNG_COLORTYPE_JPEGGRAYA :               {                 pData->fStorerow2   = (mng_ptr)store_jpeg_ga8;                 pData->fRetrieverow = (mng_ptr)retrieve_ga8;                 pData->bIsOpaque    = MNG_FALSE;                 break;               }          case MNG_COLORTYPE_JPEGCOLORA :               {                 pData->fStorerow2   = (mng_ptr)store_jpeg_rgba8;                 pData->fRetrieverow = (mng_ptr)retrieve_rgba8;                 pData->bIsOpaque    = MNG_FALSE;                 break;               }        }      }      else      {        pData->bIsRGBA16 = MNG_TRUE;   /* intermediate row is 16-bit deep */        /* TODO: 12-bit JPEG */        /* TODO: 8- + 12-bit JPEG (eg. type=20) */      }                                       /* determine alpha processing routine */      switch (pData->iJHDRalphabitdepth)      {        case  1 : { pData->fInitrowproc = (mng_ptr)init_jpeg_a1_ni;  break; }        case  2 : { pData->fInitrowproc = (mng_ptr)init_jpeg_a2_ni;  break; }        case  4 : { pData->fInitrowproc = (mng_ptr)init_jpeg_a4_ni;  break; }        case  8 : { pData->fInitrowproc = (mng_ptr)init_jpeg_a8_ni;  break; }        case 16 : { pData->fInitrowproc = (mng_ptr)init_jpeg_a16_ni; break; }      }                                       /* initialize JPEG library */      iRetcode = mngjpeg_initialize (pData);      if (iRetcode)                    /* on error bail out */        return iRetcode;    }    else    {                                  /* must be alpha add/replace !! */      if ((pData->iDeltatype != MNG_DELTATYPE_BLOCKALPHAADD    ) &&          (pData->iDeltatype != MNG_DELTATYPE_BLOCKALPHAREPLACE)    )        MNG_ERROR (pData, MNG_INVDELTATYPE)                                       /* determine alpha processing routine */      switch (pData->iJHDRalphabitdepth)      {        case  1 : { pData->fInitrowproc = (mng_ptr)init_g1_ni;  break; }        case  2 : { pData->fInitrowproc = (mng_ptr)init_g2_ni;  break; }        case  4 : { pData->fInitrowproc = (mng_ptr)init_g4_ni;  break; }        case  8 : { pData->fInitrowproc = (mng_ptr)init_g8_ni;  break; }        case 16 : { pData->fInitrowproc = (mng_ptr)init_g16_ni; break; }      }    }  }#ifdef MNG_SUPPORT_TRACE  MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_JHDR, MNG_LC_END)#endif  return MNG_NOERROR;}