sdk-remote/src/liburbi/uconversion.cc
static
  int
  convert_jpeg_to(const byte* source, size_t sourcelen,
                  UImageFormat dest_format,
                  byte** dest, size_t& size, size_t& w, size_t& h)
  {
    aver(dest_format == IMAGE_RGB || dest_format == IMAGE_YCbCr,
         dest_format);

    if (!dest)
      return 0;

    size_t sz;
    void *destination = read_jpeg((const char*) source, sourcelen,
                                  dest_format == IMAGE_RGB, sz, w, h);
    if (!destination)
    {
      size = 0;
      return 0;
    }
    if (!*dest)
    {
      *dest = (byte*) destination;
      size = sz;
      return 1;
    }
    size_t cplen = std::min(sz, size);
    memcpy(*dest, destination, cplen);
    free(destination);
    size = sz;
    return 1;
  }
/** Convert a buffer \a source, which contains a JPEG image, to a
      buffer for the \a dest, which will contain a RGB/YCrCb image
      (depending on \a dest_format).

      The \a source buffer is expected to be a pointer to a valid memory
      area of size equal to \a sourcelen.

      If \a dest buffer pointer is nul, then it will be changed to target
      the allocated RGB/YCrCb image of size \a size.  Otherwise a part of the
      RGB/YCrCb image will be copied in the buffer in the limit of the \a size
      argument.

      The property \a w and \a h respectively correspond to the width and
      the height that are retrieved during the convertion of the convertion
      of the data.

      \return 1 on success.
  */
Convert a buffer \a source, which contains a JPEG image, to a
buffer for the \a dest, which will contain a RGB/YCrCb image
(depending on \a dest_format).

The \a source buffer is expected to be a pointer to a valid memory
area of size equal to \a sourcelen.

If \a dest buffer pointer is nul, then it will be changed to target
the allocated RGB/YCrCb image of size \a size.  Otherwise a part of the
RGB/YCrCb image will be copied in the buffer in the limit of the \a size
argument.

The property \a w and \a h respectively correspond to the width and
the height that are retrieved during the convertion of the convertion
of the data.

\return 1 on success.
Convert a buffer \ a source which contains a JPEG image to a buffer for the \ a dest which will contain a RGB / YCrCb image ( depending on \ a dest_format ) . The \ a source buffer is expected to be a pointer to a valid memory area of size equal to \ a sourcelen . If \ a dest buffer pointer is nul then it will be changed to target the allocated RGB / YCrCb image of size \ a size . Otherwise a part of the RGB / YCrCb image will be copied in the buffer in the limit of the \ a size argument . The property \ a w and \ a h respectively correspond to the width and the height that are retrieved during the convertion of the convertion of the data . \ return 1 on success .
static
  int
  convert_jpeg_to(const byte* source, size_t sourcelen,
                  UImageFormat dest_format,
                  byte** dest, size_t& size, size_t& w, size_t& h)
  {
    aver(dest_format == IMAGE_RGB || dest_format == IMAGE_YCbCr,
         dest_format);
    if (!dest)
      return 0;
    size_t sz;
    void *destination = read_jpeg((const char*) source, sourcelen,
                                  dest_format == IMAGE_RGB, sz, w, h);
    if (!destination)
    {
      size = 0;
      return 0;
    }
    if (!*dest)
    {
      *dest = (byte*) destination;
      size = sz;
      return 1;
    }
    size_t cplen = std::min(sz, size);
    memcpy(*dest, destination, cplen);
    free(destination);
    size = sz;
    return 1;
  }
static int convert_jpeg_to ( const byte * source , size_t sourcelen , UImageFormat dest_format , byte * * dest , size_t & size , size_t & w , size_t & h ) { aver ( dest_format == IMAGE_RGB || dest_format == IMAGE_YCbCr , dest_format ) ; if ( ! dest ) return 0 ; size_t sz ; void * destination = read_jpeg ( ( const char * ) source , sourcelen , dest_format == IMAGE_RGB , sz , w , h ) ; if ( ! destination ) { size = 0 ; return 0 ; } if ( ! * dest ) { * dest = ( byte * ) destination ; size = sz ; return 1 ; } size_t cplen = std :: min ( sz , size ) ; memcpy ( * dest , destination , cplen ) ; free ( destination ) ; size = sz ; return 1 ; }
Convert a buffer \a source, which contains a JPEG image, to a
buffer for the \a dest, which will contain a RGB/YCrCb image
(depending on \a dest_format).
Convert a buffer \ a source which contains a JPEG image to a buffer for the \ a dest which will contain a RGB / YCrCb image ( depending on \ a dest_format ) .