home *** CD-ROM | disk | FTP | other *** search
/ Geek 6 / Geek-006.iso / linux / video / xmovie-1.5.3.tar.gz / xmovie-1.5.3.tar / xmovie-1.5.3 / quicktime / jpeg.h.bak < prev    next >
Text File  |  2000-11-29  |  3KB  |  117 lines

  1. #ifndef QUICKTIME_JPEG_H
  2. #define QUICKTIME_JPEG_H
  3.  
  4. #define QUICKTIME_JPEG_MARKSIZE 40
  5. #define QUICKTIME_JPEG_TAG 0x6d6a7067
  6. #define TOTAL_MJPA_COMPRESSORS 2
  7.  
  8.  
  9. #ifdef __cplusplus
  10. extern "C" {
  11. #endif
  12.  
  13.  
  14. #include "jpeg/jpeglib.h"
  15. #include <png.h>       /* Need setjmp.h included by png.h */
  16. #include "pthread.h"
  17.  
  18. struct my_error_mgr {
  19.   struct jpeg_error_mgr pub;    /* "public" fields */
  20.  
  21.   jmp_buf setjmp_buffer;    /* for return to caller */
  22. };
  23.  
  24. typedef struct my_error_mgr* my_error_ptr;
  25.  
  26. typedef struct
  27. {
  28.     int field_size;
  29.     int padded_field_size;
  30.     int next_offset;
  31.     int quant_offset;
  32.     int huffman_offset;
  33.     int image_offset;
  34.     int scan_offset;
  35.     int data_offset;
  36.     char mjpeg_marker[QUICKTIME_JPEG_MARKSIZE];
  37.     int mjpg_kludge;
  38. } quicktime_mjpeg_hdr;
  39.  
  40. typedef struct
  41. {
  42.     char *output_buffer;    /* Buffer for MJPEG output */
  43.     long output_size;     /* Size of image stored in buffer */
  44.     int output_allocated;    /* Allocated size of output buffer */
  45.     struct jpeg_compress_struct jpeg_compress;
  46.     struct jpeg_error_mgr jpeg_error;
  47.     unsigned char **row_pointers;
  48.     int row_offset;
  49.     int mjpg_kludge;
  50.     int is_mjpa;
  51.     quicktime_mjpeg_hdr mjpeg_hdr;
  52.     int width;   /* Total dimensions of the frame */
  53.     int height;
  54.     int interlaced;
  55.     int write_next_offset;
  56.  
  57.     pthread_t tid;   /* ID of thread */
  58.     pthread_mutex_t input_lock, output_lock;
  59.     int done;     /* Flag to end */
  60. } mjpa_compress_engine;
  61.  
  62. typedef struct
  63. {
  64.     struct jpeg_decompress_struct jpeg_decompress;
  65.     struct my_error_mgr jpeg_error;
  66.     int is_mjpa;
  67.     unsigned char **row_pointers;
  68.     char *input_ptr;
  69.     long input_size;
  70.     void *codec;
  71.     long field_offset;     /* offset of next field read by the first field */
  72.     int markers_only;    /* Get the field offset and wait */
  73.     quicktime_mjpeg_hdr mjpeg_hdr;
  74.     int interlaced;
  75.     int width;   /* Total dimensions of the frame */
  76.     int height;
  77.  
  78.     pthread_t tid;   /* ID of thread */
  79.     pthread_mutex_t input_lock, output_lock;
  80.     int done;     /* Flag to end */
  81. } mjpa_decompress_engine;
  82.  
  83. typedef struct
  84. {
  85.     int quality;
  86.     int use_float;
  87.     int jpeg_type;     /* 0 - QUICKTIME_JPEG, 1 - QUICKTIME_MJPA, 2 - QUICKTIME_MJPB */
  88.     char *input_buffer;    /* Buffer for MJPEG output */
  89.     long output_size;     /* Size of image stored in buffer */
  90.     int buffer_size;    /* Allocated size of input buffer */
  91.     mjpa_compress_engine *compressors[TOTAL_MJPA_COMPRESSORS];
  92.     mjpa_decompress_engine *decompressors[TOTAL_MJPA_COMPRESSORS];
  93.     int total_compressors; /* Number of compressors created */
  94.     int total_decompressors; /* Number of decompressors created */
  95. } quicktime_jpeg_codec_t;
  96.  
  97. /* These functions are called from Broadcast 2000 directly to achieve */
  98. /* massively parallel compression. */
  99.  
  100. mjpa_compress_engine* quicktime_jpeg_new_compress_engine(int width, 
  101.                         int height, 
  102.                         int quality, 
  103.                         int use_float,
  104.                         int interlaced,
  105.                         int is_mjpa,
  106.                         int field_number);
  107. void quicktime_jpeg_delete_compress_engine(mjpa_compress_engine *compressor);
  108. /* This returns the output buffer. */
  109. unsigned char* quicktime_compress_jpeg(mjpa_compress_engine *engine, unsigned char **row_pointers, long *image_size, int write_next_offset);
  110. int quicktime_fixmarker_jpeg(quicktime_mjpeg_hdr *mjpeg_hdr, char *buffer, long output_size, int write_next_offset);
  111.  
  112. #ifdef __cplusplus
  113. }
  114. #endif
  115.  
  116. #endif
  117.