r878: This is Cinelerra 2.1.
[cinelerra_cv/ct.git] / quicktime / jpeg_old.h
blob26a5556983de93e7e98a26d04ffd6186115c3783
1 #ifndef QUICKTIME_JPEG_H
2 #define QUICKTIME_JPEG_H
4 #define QUICKTIME_JPEG_MARKSIZE 40
5 #define QUICKTIME_JPEG_TAG 0x6d6a7067
6 #define TOTAL_MJPA_COMPRESSORS 2
9 #ifdef __cplusplus
10 extern "C" {
11 #endif
14 #include <jpeglib.h>
15 #include <png.h> /* Need setjmp.h included by png.h */
16 #include "pthread.h"
18 struct my_error_mgr {
19 struct jpeg_error_mgr pub; /* "public" fields */
21 jmp_buf setjmp_buffer; /* for return to caller */
24 typedef struct my_error_mgr* my_error_ptr;
26 typedef struct
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;
40 typedef struct
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;
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;
62 typedef struct
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;
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;
83 typedef struct
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;
97 /* These functions are called from Broadcast 2000 directly to achieve */
98 /* massively parallel compression. */
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);
112 #ifdef __cplusplus
114 #endif
116 #endif