| OLD | NEW |
| 1 /* | 1 /* |
| 2 * jcmarker.c | 2 * jcmarker.c |
| 3 * | 3 * |
| 4 * Copyright (C) 1991-1998, Thomas G. Lane. | 4 * Copyright (C) 1991-1998, Thomas G. Lane. |
| 5 * Copyright (C) 2010, D. R. Commander. |
| 5 * This file is part of the Independent JPEG Group's software. | 6 * This file is part of the Independent JPEG Group's software. |
| 6 * For conditions of distribution and use, see the accompanying README file. | 7 * For conditions of distribution and use, see the accompanying README file. |
| 7 * | 8 * |
| 8 * This file contains routines to write JPEG datastream markers. | 9 * This file contains routines to write JPEG datastream markers. |
| 9 */ | 10 */ |
| 10 | 11 |
| 11 #define JPEG_INTERNALS | 12 #define JPEG_INTERNALS |
| 12 #include "jinclude.h" | 13 #include "jinclude.h" |
| 13 #include "jpeglib.h" | 14 #include "jpeglib.h" |
| 15 #include "jpegcomp.h" |
| 14 | 16 |
| 15 | 17 |
| 16 typedef enum { /* JPEG marker codes */ | 18 typedef enum { /* JPEG marker codes */ |
| 17 M_SOF0 = 0xc0, | 19 M_SOF0 = 0xc0, |
| 18 M_SOF1 = 0xc1, | 20 M_SOF1 = 0xc1, |
| 19 M_SOF2 = 0xc2, | 21 M_SOF2 = 0xc2, |
| 20 M_SOF3 = 0xc3, | 22 M_SOF3 = 0xc3, |
| 21 | 23 |
| 22 M_SOF5 = 0xc5, | 24 M_SOF5 = 0xc5, |
| 23 M_SOF6 = 0xc6, | 25 M_SOF6 = 0xc6, |
| (...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 278 /* Emit a SOF marker */ | 280 /* Emit a SOF marker */ |
| 279 { | 281 { |
| 280 int ci; | 282 int ci; |
| 281 jpeg_component_info *compptr; | 283 jpeg_component_info *compptr; |
| 282 | 284 |
| 283 emit_marker(cinfo, code); | 285 emit_marker(cinfo, code); |
| 284 | 286 |
| 285 emit_2bytes(cinfo, 3 * cinfo->num_components + 2 + 5 + 1); /* length */ | 287 emit_2bytes(cinfo, 3 * cinfo->num_components + 2 + 5 + 1); /* length */ |
| 286 | 288 |
| 287 /* Make sure image isn't bigger than SOF field can handle */ | 289 /* Make sure image isn't bigger than SOF field can handle */ |
| 288 if ((long) cinfo->image_height > 65535L || | 290 if ((long) cinfo->_jpeg_height > 65535L || |
| 289 (long) cinfo->image_width > 65535L) | 291 (long) cinfo->_jpeg_width > 65535L) |
| 290 ERREXIT1(cinfo, JERR_IMAGE_TOO_BIG, (unsigned int) 65535); | 292 ERREXIT1(cinfo, JERR_IMAGE_TOO_BIG, (unsigned int) 65535); |
| 291 | 293 |
| 292 emit_byte(cinfo, cinfo->data_precision); | 294 emit_byte(cinfo, cinfo->data_precision); |
| 293 emit_2bytes(cinfo, (int) cinfo->image_height); | 295 emit_2bytes(cinfo, (int) cinfo->_jpeg_height); |
| 294 emit_2bytes(cinfo, (int) cinfo->image_width); | 296 emit_2bytes(cinfo, (int) cinfo->_jpeg_width); |
| 295 | 297 |
| 296 emit_byte(cinfo, cinfo->num_components); | 298 emit_byte(cinfo, cinfo->num_components); |
| 297 | 299 |
| 298 for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; | 300 for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; |
| 299 ci++, compptr++) { | 301 ci++, compptr++) { |
| 300 emit_byte(cinfo, compptr->component_id); | 302 emit_byte(cinfo, compptr->component_id); |
| 301 emit_byte(cinfo, (compptr->h_samp_factor << 4) + compptr->v_samp_factor); | 303 emit_byte(cinfo, (compptr->h_samp_factor << 4) + compptr->v_samp_factor); |
| 302 emit_byte(cinfo, compptr->quant_tbl_no); | 304 emit_byte(cinfo, compptr->quant_tbl_no); |
| 303 } | 305 } |
| 304 } | 306 } |
| (...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 655 marker->pub.write_file_header = write_file_header; | 657 marker->pub.write_file_header = write_file_header; |
| 656 marker->pub.write_frame_header = write_frame_header; | 658 marker->pub.write_frame_header = write_frame_header; |
| 657 marker->pub.write_scan_header = write_scan_header; | 659 marker->pub.write_scan_header = write_scan_header; |
| 658 marker->pub.write_file_trailer = write_file_trailer; | 660 marker->pub.write_file_trailer = write_file_trailer; |
| 659 marker->pub.write_tables_only = write_tables_only; | 661 marker->pub.write_tables_only = write_tables_only; |
| 660 marker->pub.write_marker_header = write_marker_header; | 662 marker->pub.write_marker_header = write_marker_header; |
| 661 marker->pub.write_marker_byte = write_marker_byte; | 663 marker->pub.write_marker_byte = write_marker_byte; |
| 662 /* Initialize private state */ | 664 /* Initialize private state */ |
| 663 marker->last_restart_interval = 0; | 665 marker->last_restart_interval = 0; |
| 664 } | 666 } |
| OLD | NEW |