Horus Doc || C++ Reference || Class Overview   Pixels   Images   Detector   Geometry   Registry || Doxygen's quick Index  

cpicdeco.h

00001 // cpicdedo.h : interface of MPEG-2/1 Video picture, slice, 
00002 //                     macroblock block layer decoder;
00003 //
00004 // This class provides a set of MPEG picture decode functions
00005 //
00006 //*****************************************************************************
00007 // 
00008 //                  MPEG Developing Classes
00009 //
00010 // Copyright (C) 1998, Vision and Neural Networks Laboratory, Computer Science 
00011 // Department, Wayne State University, All Rights Reserved; 
00012 //
00013 //                  Disclaimer of Warranty
00014 //
00015 // MPEG Developing Classes, both binary and source (hereafter, Software)
00016 // is copyrighted by Vision and Neural Networks Laboratory, Computer Science 
00017 // Department, Wayne State University (WSU), and ownership remains with WSU.
00018 //
00019 // Permission is hereby granted, free of charge, to any person obtaining
00020 // a copy of this software and associated documentation files to use, copy,
00021 // and distribute the software, provided that no charge is associated with 
00022 // such copies and that the copyright notice and this statement appears on 
00023 // all copies.
00024 //
00025 // THE SOFTWARE IS AVAILABLE TO THE USER ON AN "AS IS" BASIS, WITHOUT WARRANTY
00026 // OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, WITHOUT LIMITATION, THE 
00027 // IMPLIED WARRANTIES OR MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
00028 // IN NO EVENT SHALL THE COPYRIGHT-HOLDER BE LIABLE FOR ANY CLAIMS, DAMAGES, OR
00029 // OTHER LIABILITIES OF ANY KIND WHATSOEVER ARISING FROM, OUT OF OR IN CONNECTION
00030 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. THIS 
00031 // DISCLAIMAER OF WARRANTY EXTENDS TO THE USER OF THIS SOFTWARE. ALSO THE WSU 
00032 // DOES NOT REPRESENT OR WARRANT THAT THE SOFTWARE FURNISHED HEREUNDER ARE FREE OF
00033 // INFRINGMENT OF ANY THIRD-PARTY PATENTS.
00034 //
00035 // Many patents of MPEG-1 and MPEG-2 are general enough such that commercial
00036 // implementations, including shareware, are unavoidable subject to royalty fees to
00037 // patent holders, regardless of implementation design.
00038 //
00039 //
00040 // Vision and Neural Networks Laboratory,
00041 // Computer Science Department,
00042 // Wayne State University,
00043 // Detroit, MI 48202.
00044 // Dongge Li(dil@cs.wayne.edu) and Ishwar K. Sethi(sethi@cs.wayne.edu).
00045 //
00047 
00048 #if !defined CPICDECODER_H
00049 #define CPICDECODER_H
00050 
00051 #include <memory.h>
00052 #include <string.h>
00053 #include "datatype.h"
00054 #include "mpegdata.h"
00055 #include "cstrmbuf.h"
00056 #include "mpvdata.h"
00057 #include "clayerpa.h"
00058 
00059 
00060 const BYTE TABLE_6_20[3] = {6,8,12};
00061 const BYTE STWC_TABLE[3][4] = { {6,3,7,4}, {2,1,5,4}, {2,5,7,4} };
00062 const BYTE STWCLASS_TABLE[9] = {0, 1, 2, 1, 1, 2, 3, 3, 4};
00063 
00064 class CPicDecoder
00065 {
00066 // constructor and destructor
00067 public:
00068     CPicDecoder();
00069     ~CPicDecoder();
00070 
00071 // attributes
00072 protected:
00073     LAYERTYPE CurLayerType;
00074     DECODERINFO PicDecoderInfo;
00075     CStreamBuf *pStreamBuf[MAX_LAYER_NUM];
00076     const HEADERDATA *pHeaderData[MAX_LAYER_NUM];
00077     const PICTUREINFO *pCurPicInfo[MAX_LAYER_NUM];
00078 
00079     // pointers to picture buffer;
00080     BYTE *pnBackRefFrame[3];
00081     BYTE *pnFwdRefFrame[3];
00082     BYTE *pnAuxFrame[3];
00083     BYTE *pnCurFrame[3];
00084     // pointers for temporal data buffer;
00085     BYTE *pnComTempBuf[3];//used by several functions, and will be reallocated whenever a larger buffer needed;
00086     DWORD dwCurTempBufSize[3];
00087     // pointers for spatial scalability picture buffer
00088     short *pshLowerLayerTemp;
00089     // variables derived from normative elements
00090     WORD wCodedFrameWidth;
00091     WORD wCodedFrameHeight;
00092     WORD wCodedChromaWidth;
00093     WORD wCodedChromaHeight;
00094     bool bMpeg2[MAX_LAYER_NUM]; // get from LayerParser during initialization;
00095     // normative derived variables
00096     BYTE nMBBlockNum;
00097     WORD wMBWidth;
00098     WORD wMBHeight;
00099     DWORD dwMBMaxNum;  //Max MB Num for frame picture, it will be one half of this number for field picture;
00100     // IDCT coefficients;
00101     double dfIDCTCoef[BLOCK_SIZE][BLOCK_SIZE]; // for reference IDCT, cosine transform matrix for 8x1 IDCT
00102     short *pshFastIDCTCoef;  // for fast IDCT;
00103     // buffer for multiuse purposes
00104     BYTE *pnClip;
00105     // exception variable
00106     bool bWarningFlag;
00107 
00108 private:
00109     BYTE pnBuf[1024];
00110     short pshFastIDCTBuf[FAST_IDCT_COEF_NUM];
00111     // slice data;
00112     BYTE nSliceVerticalPositionExtension;
00113     // slice/block data;
00114     BYTE nMBType[MAX_LAYER_NUM];
00115     BYTE nPriorityBreakpoint[MAX_LAYER_NUM];
00116     BYTE nQuantizerScale[MAX_LAYER_NUM];
00117     BYTE nIntraSlice[MAX_LAYER_NUM];
00118     short shBlock[MAX_LAYER_NUM][12][64];
00119     // block data;
00120     short shPMV[2][2][2];
00121 
00122 // operation
00123 public:
00124     int Initialize(CLayerParser *pBaseLayerParser, CLayerParser *pEnhanLayerParser);
00125     void Reset(void);
00126     int GetStatus(void) { return PicDecoderInfo.iStatus; };
00127     inline void ClearStatus(void);
00128     inline void SetSpeed(bool bIsHighSpeed) { PicDecoderInfo.bSpeedFlag=bIsHighSpeed; };
00129     // decode picture;
00130     int DecodePicture(void);
00131     int DecodePicture(BYTE *pnBaseFrameData[3], WORD wYRowIncr, WORD wChromaRowIncr);
00132     // get information;
00133     inline void GetCodingPicPara(CODINGPICPARA *pCodingPicPara);
00134     long GetCurFrame(BYTE *pnOutData,WORD *pwOutPicWidth,WORD *pwOutPicHeight,BYTE nOutputType);
00135     long GetCurPic(BYTE *pnOutData,WORD *pwOutPicWidth,WORD *pwOutPicHeight,BYTE nOutputType);
00136     int StoreCurPic(const char *psOutFileName, BYTE nOutputType);
00137     int StoreCurFrame(const char *psOutFileName, BYTE nOutputType);
00138     inline int GetCurYUV(BYTE *pnOutData[3],WORD pwOutPicWidth[3],WORD pwOutPicHeight[3], bool bFrameOnly);
00139     inline int GetCurRGB(BYTE *pnOutData[3],WORD *pwOutPicWidth,WORD *pwOutPicHeight, bool bFrameOnly);
00140 
00141     // other facilities
00142     inline void RelocateBuf(bool bSwapRefBuf);
00143     void DataSequential(BYTE *pnSourceData, WORD wDataWidth, WORD wDataHeight,
00144                         long lIncreasement, BYTE *pnTargetData);
00145     int HorizontalInterpolation(BYTE *pnSourceData, WORD wDataWidth, WORD wDataHeight,
00146                         long lIncreasement, BYTE *pnTargetData, BYTE nWorkMode);
00147     int VerticalInterpolation(BYTE *pnSourceData, WORD wDataWidth, WORD wDataHeight,
00148                         long lIncreasement, BYTE *pnTargetData, BYTE nWorkMode);
00149     
00150     //compressed information;
00151     int GetMBBlockPic(MBBLOCK *pOutMBBlockPic,WORD *pwOutWidth,WORD *pwOutHeight);
00152     int GetCompressedPic(COMPRESSEDPIC *pOutCompressedPic);
00153 
00154 protected: //call by above functions, CurLayerType must be set properly for them;
00155     void SetDefaultStatus(void);  //only for constructor and reset;
00156     int CompareTwoStreamInfo(void);
00157     void NextStartCode(CStreamBuf *pStreamBuf);
00158     inline int PrepareComTempBuf(BYTE nComponent, DWORD dwNewSize);
00159     // fast IDCT
00160     void InitializeFastIDCT(void);
00161     void FastIDCT(short *pshBlock);
00162     void IDCTRow(short *pshBlock);
00163     void IDCTCol(short *pshBlock);
00164     // reference IDCT
00165     void InitializeReferenceIDCT(void);
00166     void ReferenceIDCT(short *pshBlock);
00167     //Read header; all use CurLayerType!!!! 
00168     int ReadSliceHeader(void);
00169     inline void ReadExtraBitInfo(void);
00170     inline void MarkerBit(void);
00171     // spatial scalability
00172     void SpatialPrediction(BYTE *pnBaseFrameData[3], WORD wYRowIncr, WORD wChromaRowIncr, BYTE *pnDestFrame[3]);
00173     void MakeSpatialPredictionFrame(BYTE *pSourceFrm, WORD wSourceWidth,
00174                                     BYTE *pnTempFrm, short *pshTemp, BYTE *pnDestination,
00175                                     short shHOffset, short shVOffset, WORD wPredWidth,
00176                                     WORD wPredHeight, WORD wPicWidth, WORD wPicHeight,
00177                                     BYTE nAperture);
00178     void Deinterlace(BYTE *pnSource, WORD wSourceWidth, BYTE nFieldValue,
00179                               BYTE *pnDest, WORD wDestWidth, WORD wDestHeight, BYTE nAperture);
00180     void SubsampleVertical(BYTE *pnSource, WORD wSourceWidth, WORD wSourceHeight,
00181                                     short *pshDestination, WORD wDestWidth, WORD wDestHeight,
00182                                     BYTE nFactorM, BYTE nFactorN, BYTE nFieldValue,
00183                                     BYTE nIncLineNum);
00184     void SubsampleHorizontal(short *pshSource, BYTE *pnDestination, WORD wHOffset, 
00185                                     WORD wWidth, WORD wSourceWidth, WORD wDestWidth,
00186                                     WORD wHeight, BYTE nFactorM, BYTE nFactorN);
00187     // picture decoding
00188     void DecodePictureData(void);
00189     int MoveToNextSlice(DWORD &dwMBA, DWORD &dwMBAInc, short shDctDcPred[3]);
00190     int DecodeSlice(DWORD dwPicMBMaxNum,DWORD dwMBA,DWORD dwMBAInc,short shDctDcPred[3]);
00191     void MacroblockModes(BYTE *pnStwType, BYTE *pnStwClass, char *pcMotionType,
00192                 BYTE *pnMotionVectorCount,BYTE *pnMvFormat,bool *pbDmv,bool *pbMvScale,char *pcDctType);
00193     void MacroblockModes(BYTE *pnStwType, char *pcDctType);
00194     void AddBlock(BYTE nComponent,WORD wMBCol,WORD wMBRow,char cDctType,bool bAddFlag);
00195     void DecodeSNRMacroblock(DWORD *pdwSNRMBA,DWORD *pdwSNRMBAInc,DWORD dwMBA,
00196                             DWORD dwPicMBMaxNum,char *pcDctType);
00197     inline void ClearBlock(BYTE nComponent);
00198     void SumBlock(BYTE nComponent);
00199     void Saturate(short *pshCurBlock);
00200     void MotionCompensation(DWORD dwMBA,char cMotionType,BYTE nMotionVerticalFieldSelect[2][2],
00201                             char cDmVector[2],BYTE nStwType,char cDctType);
00202     void SkipMacroblock(short shDctDcPred[3],char *pcMotionType,
00203                             BYTE nMotionVerticalFieldSelect[2][2],BYTE *pnStwType);
00204     int DecodeMacroblock(BYTE *pnStwType, BYTE *pnStwClass, char *pcMotionType, 
00205                             char *pcDctType,short *shDctDcPred, BYTE nMotionVerticalFieldSelect[2][2],
00206                             char cDmVector[2]);
00207 
00208     // generic picture macroblock type processing functions
00209     BYTE GetIMBType(void);
00210     BYTE GetPMBType(void);
00211     BYTE GetBMBType(void);
00212     BYTE GetDMBType(void);
00213     // spatial picture macroblock type processing functions
00214     BYTE GetISpatialMBType(void);
00215     BYTE GetPSpatialMBType(void);
00216     BYTE GetBSpatialMBType(void);
00217     BYTE GetSNRMBType(void);
00218 
00219     void GetMacroblockType(void);
00220     char GetMotionCode(void);
00221     char GetDmVector(void);
00222     BYTE GetCodedBlockPattern(void);
00223     DWORD GetMacroblockAddressIncrement(void);
00224     short GetLumaDctDcDiff(void);
00225     short GetChromaDctDcDiff(void);
00226 
00227     //block decoding
00228     void DecodeMPEG1IntraBlock(BYTE nComponent, short shDctDcPred[]);
00229     void DecodeMPEG1NonIntraBlock(BYTE nComponent);
00230     void DecodeMPEG2IntraBlock(BYTE nComponent,short shDctDcPred[]);
00231     void DecodeMPEG2NonIntraBlock(BYTE nComponent);
00232     
00233     // motion
00234     void DecodeMPEG2MotionVector(char cDmVector[2],BYTE nMotionVerticalFieldSelect[2][2],
00235                     BYTE nPredDirection,BYTE nMotionVectorCount,BYTE nMvFormat,BYTE nHorizontalRSize,
00236                     BYTE nVerticalRSize,bool bDmv,bool bMvScale);
00237     void DecodeMPEG1MotionVector(short *pshPMVVector, char *pcDmVector, BYTE nHorizontalRSize,
00238                     BYTE nVerticalRSize, bool bDmv, bool bMvScale, BYTE nFullPelVector);
00239     void DecodeMotionVector(short *pshPMVValue, BYTE nRSize, char cMotionCode,
00240                     WORD wMotionResidual, BYTE nFullPelVector);
00241     void DualPrimeArithmetic(short shDMV[][2],char *pcDmVector,short shHorizontalMV,short shVerticalMV);
00242     void GetPredictionPic(WORD wMBCol, WORD wMBRow, char cMotionType,
00243                     BYTE nMotionVerticalFieldSelect[2][2], char cDmVector[2], BYTE nStwType);
00244     void FormPrediction(BYTE *pnRefSource[],BYTE nSourceFieldValue,BYTE *pnDestination[],
00245                     BYTE nDstFieldValue,WORD wPicIncreasement,WORD wBlkIncreasement,
00246                     BYTE nPredBlkWidth,BYTE nPredBlkHeight,WORD wCol,WORD wRow,short shDH,
00247                     short shDV,BYTE nAverageFlag);
00248     void FormComponentPrediction(BYTE *pnRefSource,BYTE *pnDestination,WORD wPicIncreasement,
00249                     WORD wBlkIncreasement,BYTE nPredBlkWidth,BYTE nPredBlkHeight,
00250                     WORD wCol,WORD wRow,short shDH,short shDV,BYTE nAverageFlag);
00251     //picture output
00252     long GetBMPPic(BYTE *pnOutData,WORD *pwOutPicWidth,WORD *pwOutPicHeight,
00253                     BYTE *pnSourceData[3], bool bFrameOnly=false);
00254     long GetTGAPic(BYTE *pnOutData,WORD *pwOutPicWidth,WORD *pwOutPicHeight,
00255                     BYTE *pnSourceData[3], bool bFrameOnly=false);
00256     long GetSIFPic(BYTE *pnOutData,WORD *pwOutPicWidth,WORD *pwOutPicHeight,
00257                     BYTE *pnSourceData[3], bool bFrameOnly=false);
00258     long GetPPMPic(BYTE *pnOutData,WORD *pwOutPicWidth,WORD *pwOutPicHeight,
00259                     BYTE *pnSourceData[3], bool bFrameOnly=false);
00260     int StoreYUVPic(const char *psOutFileName,BYTE *pnSourceData[3], bool bFrameOnly=false);
00261     int StoreComponent(const char *psOutFileName,BYTE *pnSourceData,WORD wStoredPicWidth,
00262                     WORD wStoredPicHeight,long lIncreasement);
00263     int GetYUVPic(BYTE *pnOutData[3],WORD pwOutPicWidth[3],WORD pwOutPicHeight[3],
00264                     BYTE *pnSourceData[3], bool bFrameOnly=false);
00265     int GetRGBPic(BYTE *pnOutData[3],WORD *pwOutPicWidth,WORD *pwOutPicHeight,
00266                     BYTE *pnSourceData[3], bool bFrameOnly=false);
00267     // get compressed information;
00268     int GetMBBlock(DWORD dwPicMBMaxNum,DWORD dwMBA,DWORD dwMBAInc,short shDctDcPred[3],
00269                                  MBBLOCK *pOutMBBlockPic);
00270     int GetCompressedBlock(DWORD dwPicMBMaxNum,DWORD dwMBA,DWORD dwMBAInc,short shDctDcPred[3],
00271                                  COMPRESSEDPIC *pOutCompressedPic);
00272 
00273 // only for advanced users 
00274 public:
00275     inline BYTE * GetCurFrameBuf(BYTE nComponent);
00276     inline BYTE *GetBackRefFrameBuf(BYTE nComponent);
00277     inline BYTE *GetFwdRefFrameBuf(BYTE nComponent);
00278 };
00279 
00281 //inline public functions:
00282 
00283 inline void CPicDecoder::ClearStatus(void)
00284 {
00285     if (PicDecoderInfo.iStatus!=NOT_USED)  // NOT_USED CAN NOT be erased;
00286         PicDecoderInfo.iStatus=MDC_SUCCESS;
00287 }
00288 
00289 inline void CPicDecoder::GetCodingPicPara(CODINGPICPARA *pCodingPicPara)
00290 {
00291     pCodingPicPara->wCodedFrameWidth=wCodedFrameWidth;
00292     pCodingPicPara->wCodedFrameHeight=wCodedFrameHeight;
00293     pCodingPicPara->wCodedChromaWidth=wCodedChromaWidth;
00294     pCodingPicPara->wCodedChromaHeight=wCodedChromaHeight;
00295     pCodingPicPara->wMBWidth=wMBWidth;
00296     pCodingPicPara->wMBHeight=wMBHeight;
00297 }
00298 
00299 inline int CPicDecoder::GetCurYUV(BYTE *pnOutData[3],WORD pwOutPicWidth[3],WORD pwOutPicHeight[3], bool bFrameOnly)
00300 {
00301     BYTE *pnCurDataBuf[3];
00302 
00303     if (bFrameOnly)
00304     {
00305         pnCurDataBuf[0]=GetCurFrameBuf(0);
00306         pnCurDataBuf[1]=GetCurFrameBuf(1);
00307         pnCurDataBuf[2]=GetCurFrameBuf(2);
00308         return GetYUVPic(pnOutData,pwOutPicWidth,pwOutPicHeight,pnCurDataBuf,true);
00309     }
00310     else
00311         return GetYUVPic(pnOutData,pwOutPicWidth,pwOutPicHeight,pnCurFrame);
00312 }
00313 
00314 inline int CPicDecoder::GetCurRGB(BYTE *pnOutData[3],WORD *pwOutPicWidth,WORD *pwOutPicHeight, bool bFrameOnly)
00315 {
00316     BYTE *pnCurDataBuf[3];
00317 
00318     if (bFrameOnly)
00319     {
00320         pnCurDataBuf[0]=GetCurFrameBuf(0);
00321         pnCurDataBuf[1]=GetCurFrameBuf(1);
00322         pnCurDataBuf[2]=GetCurFrameBuf(2);
00323         return GetRGBPic(pnOutData,pwOutPicWidth,pwOutPicHeight,pnCurDataBuf,true);
00324     }
00325     else
00326         return GetRGBPic(pnOutData,pwOutPicWidth,pwOutPicHeight,pnCurFrame);
00327 }
00328 
00329 // other facilities
00330 
00331 inline void CPicDecoder::RelocateBuf(bool bSwapRefBuf)
00332 {
00333     BYTE nCount;
00334     BYTE *pnBufTemp;
00335 
00336     if (bSwapRefBuf)
00337     { // swap forward and backward reference buffer;
00338         for (nCount=0; nCount<3; nCount++)
00339         {
00340             pnBufTemp=pnFwdRefFrame[nCount];
00341             pnFwdRefFrame[nCount]=pnBackRefFrame[nCount];
00342             pnBackRefFrame[nCount]=pnBufTemp;//pnCurFrame never points to pnFwdRefFrame;
00343         }
00344     }
00345     // restore buffer pointers for current pictures;
00346     if (pHeaderData[BASELAYER]->PictureHeader.nPictureCodingType==B_TYPE)
00347     { // B pictures do not need to be saved for future reference;
00348         for (nCount=0; nCount<3; nCount++)
00349             pnCurFrame[nCount]=pnAuxFrame[nCount];
00350     }
00351     else  //I, P or D frame
00352     { //reset pointers of current frame to the start position of backward reference;
00353         for (nCount=0; nCount<3; nCount++)
00354             pnCurFrame[nCount]=pnBackRefFrame[nCount];
00355     }
00356     if (pHeaderData[BASELAYER]->PictureExtension.nPictureStructure==BOTTOM_FIELD)
00357     {
00358         pnCurFrame[0]+=wCodedFrameWidth;
00359         pnCurFrame[1]+=wCodedChromaWidth;
00360         pnCurFrame[2]+=wCodedChromaWidth;
00361     }
00362 }
00363 
00364 // Get data pointers, for advanced user
00365 inline BYTE *CPicDecoder::GetCurFrameBuf(BYTE nComponent)
00366 {
00367     if (nComponent>=3)
00368     {
00369         PicDecoderInfo.iStatus=USE_ERROR;
00370         return NULL;
00371     }
00372     if (pHeaderData[BASELAYER]->PictureHeader.nPictureCodingType==B_TYPE)
00373         return pnAuxFrame[nComponent];
00374     else
00375         return pnBackRefFrame[nComponent];
00376 }
00377 
00378 inline BYTE *CPicDecoder::GetBackRefFrameBuf(BYTE nComponent)
00379 {
00380     if (nComponent>=3)
00381     {
00382         PicDecoderInfo.iStatus=USE_ERROR;
00383         return NULL;
00384     }
00385     return pnBackRefFrame[nComponent];
00386 }
00387 
00388 inline BYTE *CPicDecoder::GetFwdRefFrameBuf(BYTE nComponent)
00389 {
00390     if (nComponent>=3)
00391     {
00392         PicDecoderInfo.iStatus=USE_ERROR;
00393         return NULL;
00394     }
00395     return pnFwdRefFrame[nComponent];
00396 }
00397 
00399 // inline protected functions:
00400 
00401 // decode extra bit information, ISO/IEC 13818-2 section 6.2.3.4.
00402 inline void CPicDecoder::ReadExtraBitInfo(void)
00403 {
00404     while (pStreamBuf[CurLayerType]->GetByteBits(1))
00405         pStreamBuf[CurLayerType]->GetByteBits(8);
00406 }
00407 
00408 inline void CPicDecoder::MarkerBit(void)
00409 {
00410 #ifdef ERR_INFO
00411     if (!pStreamBuf[CurLayerType]->GetByteBits(1))  // must be 1;
00412     {
00413         PicDecoderInfo.iStatus=STREAM_ERROR;
00414     }
00415 #else
00416     pStreamBuf[CurLayerType]->GetByteBits(1); //'1'
00417 #endif
00418 }
00419 
00420 // set scratch pad macroblock to zero;
00421 inline void CPicDecoder::ClearBlock(BYTE nComponent)
00422 {
00423     memset(shBlock[CurLayerType][nComponent],0,64*sizeof(short));
00424 }
00425 
00426 // prepare shared temp buf;
00427 inline int CPicDecoder::PrepareComTempBuf(BYTE nComponent, DWORD dwNewSize)
00428 {
00429 #ifdef DEBUG
00430     if (nComponent>=3)
00431     {
00432         PicDecoderInfo.iStatus=USE_ERROR;
00433         return UNSUCCESS;
00434     }
00435 #endif
00436     if (dwCurTempBufSize[nComponent]<dwNewSize)
00437     { // need to allocate a larger buffer;
00438         if (pnComTempBuf[nComponent]!=NULL)
00439             delete [] pnComTempBuf[nComponent];
00440         pnComTempBuf[nComponent]=new BYTE [dwNewSize];
00441         if (pnComTempBuf[nComponent]==NULL)
00442         { // allocation failed;
00443             dwCurTempBufSize[nComponent]=0;
00444             PicDecoderInfo.iStatus=MEM_ERROR;
00445             return UNSUCCESS;
00446         }
00447         dwCurTempBufSize[nComponent]=dwNewSize;
00448     }
00449     return MDC_SUCCESS;
00450 }
00451 
00452 #endif  //CPICDECODER_H

Generated on Tue Feb 3 14:18:31 2004 for C++Reference by doxygen1.2.12 written by Dimitri van Heesch, © 1997-2001