Logo Search packages:      
Sourcecode: libjpeg-turbo version File versions  Download package

DLLEXPORT unsigned long DLLCALL tjBufSizeYUV ( int  width,
int  height,
int  subsamp 

The size of the buffer (in bytes) required to hold a YUV planar image with the given parameters.

widthwidth of the image (in pixels)
heightheight of the image (in pixels)
subsamplevel of chrominance subsampling in the image (see Chrominance subsampling options.)
the size of the buffer (in bytes) required to hold the image, or -1 if the arguments are out of bounds.

Definition at line 373 of file turbojpeg.c.

References tjMCUHeight, tjMCUWidth, and TJSAMP_GRAY.

Referenced by tjEncodeYUV2().

      unsigned long retval=0;
      int pw, ph, cw, ch;
      if(width<1 || height<1 || subsamp<0 || subsamp>=NUMSUBOPT)
            _throw("tjBufSizeYUV(): Invalid argument");
      pw=PAD(width, tjMCUWidth[subsamp]/8);
      ph=PAD(height, tjMCUHeight[subsamp]/8);
      cw=pw*8/tjMCUWidth[subsamp];  ch=ph*8/tjMCUHeight[subsamp];
      retval=PAD(pw, 4)*ph + (subsamp==TJSAMP_GRAY? 0:PAD(cw, 4)*ch*2);

      return retval;

Here is the caller graph for this function:

Generated by  Doxygen 1.6.0   Back to index