125#define jpeg_writer_emit_byte(buffer, value) *(buffer)++ = (uint8_t) (value);
126#define jpeg_writer_emit_2byte(buffer, value) \
128 *(buffer)++ = (uint8_t) (((value) >> 8) & 0xFF); \
129 *(buffer)++ = (uint8_t) ((value) & 0xFF); \
132#define jpeg_writer_emit_marker(buffer, marker) \
134 *(buffer)++ = 0xFF; \
135 *(buffer)++ = (uint8_t) (marker); \
190 *buffer += MARKER_LEN;
191 *buffer += LENGTH_LEN;
209 unsigned char qval = (
unsigned char) ((
char) (dqt[i]));
233 for (
int comp_index = 0; comp_index <
COMP_COUNT; comp_index++) {
242 int sampling_factor_horizontal = comp_index == 0 ? 2 : 1;
243 int sampling_factor_vertical = 1;
244 if (comp_index == 0 &&
subsampling == JPEG_WRITER_SUBS_420) {
245 sampling_factor_vertical = 2;
248 (sampling_factor_horizontal << 4) +
249 sampling_factor_vertical);
252 if (comp_index == 0) {
263 for (
int table = 0; table < 4; table++) {
267 for (
int i = 0; i < 16; i++) {
290 for (
int i = 0; i < 16; i++) {
296 for (
int i = 0; i < length; i++) {
328 for (
int comp_index = 0; comp_index <
COMP_COUNT; comp_index++) {
333 if (comp_index == 0) {
364 info->dqt_marker_start = *buffer;
365 for (
int i = 0; i < 2; i++) {
373 if (info->restart_interval > 0) {
386 for (
int i = 0; i < 2; i++) {
const struct huffman_table default_huffman_tables[4]
@ LUM_DC
order of tables in default_huffman_tables
static void jpeg_writer_write_dqt(char **buffer, int type, const uint8_t *dqt)
void jpeg_writer_fill_dqt(char *buffer, uint8_t quant_table[2][JPEG_QUANT_SIZE])
void jpeg_writer_write_eoi(char **buffer)
void jpeg_writer_write_headers(char **buffer, struct jpeg_writer_data *info)
writes JPEG/JFIF headers up to the scan (including SOS header)
static void gpujpeg_writer_write_scan_header(char **buffer)
#define jpeg_writer_emit_byte(buffer, value)
static void jpeg_writer_write_dhts(char **buffer)
static void jpeg_writer_write_app0(char **buffer)
static void jpeg_writer_allocate_dqt(char **buffer)
#define jpeg_writer_emit_marker(buffer, marker)
static void jpeg_writer_write_dri(char **buffer, unsigned restart_interval)
#define jpeg_writer_emit_2byte(buffer, value)
static void jpeg_writer_write_sof0(char **buffer, unsigned width, unsigned height, enum gpujpeg_writer_subsasmpling subsampling)
static void jpeg_writer_write_soi(char **buffer)
@ JPEG_QUANT_SIZE
items, bytes (for precision=0)