Atmel Software Framework

jdmarker.c File Reference
#include "jinclude.h"
#include "jpeglib.h"

Data Structures

struct  my_marker_reader
 

Macros

#define APP0_DATA_LEN   14 /* Length of interesting data in APP0 */
 
#define APP14_DATA_LEN   12 /* Length of interesting data in APP14 */
 
#define APPN_DATA_LEN   14 /* Must be the largest of the above!! */
 
#define get_dac(cinfo)   skip_variable(cinfo)
 
#define INPUT_2BYTES(cinfo, V, action)
 
#define INPUT_BYTE(cinfo, V, action)
 
#define INPUT_RELOAD(cinfo)
 
#define INPUT_SYNC(cinfo)
 
#define INPUT_VARS(cinfo)
 
#define JPEG_INTERNALS
 
#define MAKE_BYTE_AVAIL(cinfo, action)
 

Typedefs

typedef my_marker_readermy_marker_ptr
 

Enumerations

enum  JPEG_MARKER {
  M_SOF0 = 0xc0,
  M_SOF1 = 0xc1,
  M_SOF2 = 0xc2,
  M_SOF3 = 0xc3,
  M_SOF5 = 0xc5,
  M_SOF6 = 0xc6,
  M_SOF7 = 0xc7,
  M_JPG = 0xc8,
  M_SOF9 = 0xc9,
  M_SOF10 = 0xca,
  M_SOF11 = 0xcb,
  M_SOF13 = 0xcd,
  M_SOF14 = 0xce,
  M_SOF15 = 0xcf,
  M_DHT = 0xc4,
  M_DAC = 0xcc,
  M_RST0 = 0xd0,
  M_RST1 = 0xd1,
  M_RST2 = 0xd2,
  M_RST3 = 0xd3,
  M_RST4 = 0xd4,
  M_RST5 = 0xd5,
  M_RST6 = 0xd6,
  M_RST7 = 0xd7,
  M_SOI = 0xd8,
  M_EOI = 0xd9,
  M_SOS = 0xda,
  M_DQT = 0xdb,
  M_DNL = 0xdc,
  M_DRI = 0xdd,
  M_DHP = 0xde,
  M_EXP = 0xdf,
  M_APP0 = 0xe0,
  M_APP1 = 0xe1,
  M_APP2 = 0xe2,
  M_APP3 = 0xe3,
  M_APP4 = 0xe4,
  M_APP5 = 0xe5,
  M_APP6 = 0xe6,
  M_APP7 = 0xe7,
  M_APP8 = 0xe8,
  M_APP9 = 0xe9,
  M_APP10 = 0xea,
  M_APP11 = 0xeb,
  M_APP12 = 0xec,
  M_APP13 = 0xed,
  M_APP14 = 0xee,
  M_APP15 = 0xef,
  M_JPG0 = 0xf0,
  M_JPG13 = 0xfd,
  M_COM = 0xfe,
  M_TEM = 0x01,
  M_ERROR = 0x100,
  M_SOF0 = 0xc0,
  M_SOF1 = 0xc1,
  M_SOF2 = 0xc2,
  M_SOF3 = 0xc3,
  M_SOF5 = 0xc5,
  M_SOF6 = 0xc6,
  M_SOF7 = 0xc7,
  M_JPG = 0xc8,
  M_SOF9 = 0xc9,
  M_SOF10 = 0xca,
  M_SOF11 = 0xcb,
  M_SOF13 = 0xcd,
  M_SOF14 = 0xce,
  M_SOF15 = 0xcf,
  M_DHT = 0xc4,
  M_DAC = 0xcc,
  M_RST0 = 0xd0,
  M_RST1 = 0xd1,
  M_RST2 = 0xd2,
  M_RST3 = 0xd3,
  M_RST4 = 0xd4,
  M_RST5 = 0xd5,
  M_RST6 = 0xd6,
  M_RST7 = 0xd7,
  M_SOI = 0xd8,
  M_EOI = 0xd9,
  M_SOS = 0xda,
  M_DQT = 0xdb,
  M_DNL = 0xdc,
  M_DRI = 0xdd,
  M_DHP = 0xde,
  M_EXP = 0xdf,
  M_APP0 = 0xe0,
  M_APP1 = 0xe1,
  M_APP2 = 0xe2,
  M_APP3 = 0xe3,
  M_APP4 = 0xe4,
  M_APP5 = 0xe5,
  M_APP6 = 0xe6,
  M_APP7 = 0xe7,
  M_APP8 = 0xe8,
  M_APP9 = 0xe9,
  M_APP10 = 0xea,
  M_APP11 = 0xeb,
  M_APP12 = 0xec,
  M_APP13 = 0xed,
  M_APP14 = 0xee,
  M_APP15 = 0xef,
  M_JPG0 = 0xf0,
  M_JPG13 = 0xfd,
  M_COM = 0xfe,
  M_TEM = 0x01,
  M_ERROR = 0x100
}
 

Functions

 ERREXIT (cinfo, JERR_SOI_DUPLICATE)
 
 ERREXIT (cinfo, JERR_SOF_DUPLICATE)
 
 ERREXIT (cinfo, JERR_BAD_LENGTH)
 
 ERREXIT (cinfo, JERR_SOS_NO_SOF)
 
 ERREXIT2 (cinfo, JERR_NO_SOI, c, c2)
 
 examine_app0 (j_decompress_ptr cinfo, JOCTET FAR *data, unsigned int datalen, INT32 remaining)
 
 examine_app14 (j_decompress_ptr cinfo, JOCTET FAR *data, unsigned int datalen, INT32 remaining)
 
 for (i=0;i< NUM_ARITH_TBLS;i++)
 
 for (ci=0, compptr=cinfo->comp_info;ci< cinfo->num_components;ci++, compptr++)
 
 if (cinfo->image_height<=0||cinfo->image_width<=0||cinfo->num_components<=0) ERREXIT(cinfo
 
 if (cinfo->comp_info==NULL) cinfo-> comp_info=(jpeg_component_info *)(*cinfo->mem->alloc_small)((j_common_ptr) cinfo, JPOOL_IMAGE, cinfo->num_components *SIZEOF(jpeg_component_info))
 
else if (length, elsenumtoread=0)
 
 if (cur_marker==NULL)
 
 if (cur_marker!=NULL)
 
 INPUT_2BYTES (cinfo, length, return FALSE)
 
 INPUT_2BYTES (cinfo, cinfo->image_height, return FALSE)
 
 INPUT_2BYTES (cinfo, tmp, return FALSE)
 
 INPUT_BYTE (cinfo, cinfo->data_precision, return FALSE)
 
 INPUT_BYTE (cinfo, n, return FALSE)
 
 INPUT_BYTE (cinfo, c, return FALSE)
 
 INPUT_BYTE (cinfo, c2, return FALSE)
 
 jinit_marker_reader (j_decompress_ptr cinfo)
 
 jpeg_resync_to_restart (j_decompress_ptr cinfo, int desired)
 
 jpeg_save_markers (j_decompress_ptr cinfo, int marker_code, unsigned int length_limit)
 
 jpeg_set_marker_processor (j_decompress_ptr cinfo, int marker_code, jpeg_marker_parser_method routine)
 
 next_marker (j_decompress_ptr cinfo)
 
 read_markers (j_decompress_ptr cinfo)
 
 read_restart_marker (j_decompress_ptr cinfo)
 
 reset_marker_reader (j_decompress_ptr cinfo)
 
 switch (cinfo->unread_marker)
 
 TRACEMS (cinfo, 1, JTRC_SOI)
 
 TRACEMS1 (cinfo, 1, JTRC_SOS, n)
 
 TRACEMS1 (cinfo, 1, JTRC_DRI, tmp)
 
 TRACEMS2 (cinfo, 1, JTRC_MISC_MARKER, cinfo->unread_marker,(int) length)
 
 TRACEMS4 (cinfo, 1, JTRC_SOF, cinfo->unread_marker,(int) cinfo->image_width,(int) cinfo->image_height, cinfo->num_components)
 
 TRACEMS4 (cinfo, 1, JTRC_SOS_PARAMS, cinfo->Ss, cinfo->Se, cinfo->Ah, cinfo->Al)
 
 while (length > 16)
 
 while (length > 0)
 
 while (bytes_read< data_length)
 

Variables

cinfo Adobe_transform = 0
 
cinfo Ah = (c >> 4) & 15
 
cinfo Al = (c ) & 15
 
cinfo arith_code = is_arith
 
JOCTET b [APPN_DATA_LEN]
 
UINT8 bits [17]
 
unsigned int bytes_read
 
int c
 
int cc
 
cinfo CCIR601_sampling = FALSE
 
int ci
 
(* cinfo )(cinfo,(long) length)
 
jpeg_component_infocompptr
 
cinfo comps_in_scan = n
 
int count
 
jpeg_saved_marker_ptr cur_marker = marker->cur_marker
 
JOCTET FARdata = cur_marker->data + bytes_read
 
unsigned int data_length = cur_marker->data_length
 
cinfo density_unit = 0
 
 else
 
JHUFF_TBL ** htblptr
 
UINT8 huffval [256]
 
int i
 
int index
 
cinfo input_scan_number
 
 JERR_EMPTY_IMAGE
 
cinfo JFIF_major_version = 1
 
cinfo JFIF_minor_version = 1
 
cinfo jpeg_color_space = JCS_UNKNOWN
 
 length = 8
 
int n
 
cinfo marker next_restart_num = 0
 
unsigned int numtoread = APPN_DATA_LEN
 
int prec
 
cinfo progressive_mode = is_prog
 
JQUANT_TBLquant_ptr
 
cinfo restart_interval = 0
 
cinfo saw_Adobe_marker = FALSE
 
cinfo saw_JFIF_marker = FALSE
 
cinfo marker saw_SOF = TRUE
 
cinfo marker saw_SOI = TRUE
 
cinfo Se = c
 
cinfo Ss = c
 
unsigned int tmp
 
return TRUE
 
cinfo unread_marker = c2
 
cinfo X_density = 1
 
cinfo Y_density = 1
 

#define APP0_DATA_LEN   14 /* Length of interesting data in APP0 */

Referenced by examine_app0(), and jpeg_save_markers().

#define APP14_DATA_LEN   12 /* Length of interesting data in APP14 */

Referenced by examine_app14(), and jpeg_save_markers().

#define APPN_DATA_LEN   14 /* Must be the largest of the above!! */
#define get_dac (   cinfo)    skip_variable(cinfo)

Referenced by read_markers().

#define INPUT_2BYTES (   cinfo,
  V,
  action 
)
Value:
bytes_in_buffer--; \
V = ((unsigned int) GETJOCTET(*next_input_byte++)) << 8; \
bytes_in_buffer--; \
V += GETJOCTET(*next_input_byte++); )
#define GETJOCTET(value)
Definition: jmorecfg.h:119
(* cinfo)(cinfo,(long) length)
Definition: jdmarker.c:730
#define MAKESTMT(stuff)
Definition: jerror.h:235
#define MAKE_BYTE_AVAIL(cinfo, action)
Definition: jdmarker.c:138

Referenced by if(), and while().

#define INPUT_BYTE (   cinfo,
  V,
  action 
)
Value:
bytes_in_buffer--; \
V = GETJOCTET(*next_input_byte++); )
#define GETJOCTET(value)
Definition: jmorecfg.h:119
(* cinfo)(cinfo,(long) length)
Definition: jdmarker.c:730
#define MAKESTMT(stuff)
Definition: jerror.h:235
#define MAKE_BYTE_AVAIL(cinfo, action)
Definition: jdmarker.c:138

Referenced by for(), next_marker(), and while().

#define INPUT_RELOAD (   cinfo)
Value:
( next_input_byte = datasrc->next_input_byte, \
bytes_in_buffer = datasrc->bytes_in_buffer )
INPUT_SYNC (   cinfo)
Value:
( datasrc->next_input_byte = next_input_byte, \
datasrc->bytes_in_buffer = bytes_in_buffer )

Referenced by next_marker(), and while().

INPUT_VARS (   cinfo)
Value:
struct jpeg_source_mgr * datasrc = (cinfo)->src; \
const JOCTET * next_input_byte = datasrc->next_input_byte; \
size_t bytes_in_buffer = datasrc->bytes_in_buffer
size_t bytes_in_buffer
Definition: jpeglib.h:728
Definition: jpeglib.h:726
(* cinfo)(cinfo,(long) length)
Definition: jdmarker.c:730
char JOCTET
Definition: jmorecfg.h:115
const JOCTET * next_input_byte
Definition: jpeglib.h:727

Referenced by next_marker().

#define JPEG_INTERNALS
#define MAKE_BYTE_AVAIL (   cinfo,
  action 
)
Value:
if (bytes_in_buffer == 0) { \
if (! (*datasrc->fill_input_buffer) (cinfo)) \
{ action; } \
}
if(Is_usb_id_transition()&&Is_usb_id_interrupt_enabled())
Definition: applications/uc3-audio-player/usb_task.c:395
size_t bytes_in_buffer
Definition: jpeglib.h:728
(* cinfo)(cinfo,(long) length)
Definition: jdmarker.c:730
#define INPUT_RELOAD(cinfo)
Definition: jdmarker.c:130

Referenced by while().

Enumerator
M_SOF0 
M_SOF1 
M_SOF2 
M_SOF3 
M_SOF5 
M_SOF6 
M_SOF7 
M_JPG 
M_SOF9 
M_SOF10 
M_SOF11 
M_SOF13 
M_SOF14 
M_SOF15 
M_DHT 
M_DAC 
M_RST0 
M_RST1 
M_RST2 
M_RST3 
M_RST4 
M_RST5 
M_RST6 
M_RST7 
M_SOI 
M_EOI 
M_SOS 
M_DQT 
M_DNL 
M_DRI 
M_DHP 
M_EXP 
M_APP0 
M_APP1 
M_APP2 
M_APP3 
M_APP4 
M_APP5 
M_APP6 
M_APP7 
M_APP8 
M_APP9 
M_APP10 
M_APP11 
M_APP12 
M_APP13 
M_APP14 
M_APP15 
M_JPG0 
M_JPG13 
M_COM 
M_TEM 
M_ERROR 
M_SOF0 
M_SOF1 
M_SOF2 
M_SOF3 
M_SOF5 
M_SOF6 
M_SOF7 
M_JPG 
M_SOF9 
M_SOF10 
M_SOF11 
M_SOF13 
M_SOF14 
M_SOF15 
M_DHT 
M_DAC 
M_RST0 
M_RST1 
M_RST2 
M_RST3 
M_RST4 
M_RST5 
M_RST6 
M_RST7 
M_SOI 
M_EOI 
M_SOS 
M_DQT 
M_DNL 
M_DRI 
M_DHP 
M_EXP 
M_APP0 
M_APP1 
M_APP2 
M_APP3 
M_APP4 
M_APP5 
M_APP6 
M_APP7 
M_APP8 
M_APP9 
M_APP10 
M_APP11 
M_APP12 
M_APP13 
M_APP14 
M_APP15 
M_JPG0 
M_JPG13 
M_COM 
M_TEM 
M_ERROR 

ERREXIT ( cinfo  ,
JERR_SOI_DUPLICATE   
)
ERREXIT ( cinfo  ,
JERR_SOF_DUPLICATE   
)
ERREXIT ( cinfo  ,
JERR_BAD_LENGTH   
)
ERREXIT ( cinfo  ,
JERR_SOS_NO_SOF   
)
ERREXIT2 ( cinfo  ,
JERR_NO_SOI  ,
c  ,
c2   
)
examine_app0 ( j_decompress_ptr  cinfo,
JOCTET FAR data,
unsigned int  datalen,
INT32  remaining 
)

References APP0_DATA_LEN, GETJOCTET, TRACEMS1, TRACEMS2(), TRACEMS5, TRUE, and WARNMS2.

Referenced by if(), and switch().

examine_app14 ( j_decompress_ptr  cinfo,
JOCTET FAR data,
unsigned int  datalen,
INT32  remaining 
)

References APP14_DATA_LEN, GETJOCTET, TRACEMS1, TRACEMS4, TRUE, and version.

Referenced by if(), and switch().

for ( )

References i.

if ( cinfo->image_height<=0||cinfo->image_width<=0||cinfo->num_components<=  0)
else if ( length  ,
else numtoread 0 
)
if ( cur_marker!  = NULL)

References cur_marker, data, data_length, and NULL.

INPUT_2BYTES ( cinfo  ,
length  ,
return  FALSE 
)
INPUT_2BYTES ( cinfo  ,
cinfo->  image_height,
return  FALSE 
)
INPUT_2BYTES ( cinfo  ,
tmp  ,
return  FALSE 
)
INPUT_BYTE ( cinfo  ,
cinfo->  data_precision,
return  FALSE 
)
INPUT_BYTE ( cinfo  ,
n  ,
return  FALSE 
)
INPUT_BYTE ( cinfo  ,
c  ,
return  FALSE 
)
INPUT_BYTE ( cinfo  ,
c2  ,
return  FALSE 
)
jpeg_resync_to_restart ( j_decompress_ptr  cinfo,
int  desired 
)
jpeg_save_markers ( j_decompress_ptr  cinfo,
int  marker_code,
unsigned int  length_limit 
)
jpeg_set_marker_processor ( j_decompress_ptr  cinfo,
int  marker_code,
jpeg_marker_parser_method  routine 
)

References ERREXIT1, if(), M_APP0, M_APP15, and M_COM.

read_restart_marker ( j_decompress_ptr  cinfo)

References FALSE, M_RST0, next_marker(), TRACEMS1, and TRUE.

Referenced by jinit_marker_reader().

reset_marker_reader ( j_decompress_ptr  cinfo)

References NULL, and my_marker_writer::pub.

Referenced by jinit_marker_reader().

switch ( cinfo->  unread_marker)
TRACEMS ( cinfo  ,
,
JTRC_SOI   
)

Referenced by jinit_downsampler(), and read_markers().

TRACEMS1 ( cinfo  ,
,
JTRC_SOS  ,
n   
)
TRACEMS1 ( cinfo  ,
,
JTRC_DRI  ,
tmp   
)
TRACEMS2 ( cinfo  ,
,
JTRC_MISC_MARKER  ,
cinfo->  unread_marker,
(int)  length 
)
TRACEMS4 ( cinfo  ,
,
JTRC_SOF  ,
cinfo->  unread_marker,
(int) cinfo->  image_width,
(int) cinfo->  image_height,
cinfo->  num_components 
)
TRACEMS4 ( cinfo  ,
,
JTRC_SOS_PARAMS  ,
cinfo->  Ss,
cinfo->  Se,
cinfo->  Ah,
cinfo->  Al 
)
while ( )

cinfo Adobe_transform = 0
cinfo Ah = (c >> 4) & 15
cinfo Al = (c ) & 15
cinfo arith_code = is_arith
UINT8 bits[17]
Initial value:
{
long INT32
Definition: jmorecfg.h:161
size_t length
Definition: host_hid.c:68

Referenced by HuffmanTree_makeFromLengths2(), and jpeg_gen_optimal_table().

unsigned int bytes_read

Referenced by bmp_get_cal_param(), and while().

int cc
cinfo CCIR601_sampling = FALSE
cinfo comps_in_scan = n
int count
marker cur_marker = marker->cur_marker

Referenced by if().

data = cur_marker->data + bytes_read
cinfo density_unit = 0
else
Initial value:
{
bytes_read = marker->bytes_read
unsigned int bytes_read
Definition: jdmarker.c:744
int marker
Definition: jpeglib.h:951
JHUFF_TBL** htblptr

Referenced by finish_pass_gather().

UINT8 huffval[256]
unsigned int i
Initial value:
{
long INT32
Definition: jmorecfg.h:161
size_t length
Definition: host_hid.c:68
cinfo input_scan_number
JERR_EMPTY_IMAGE
cinfo JFIF_major_version = 1
cinfo JFIF_minor_version = 1
cinfo jpeg_color_space = JCS_UNKNOWN
length = 8
int n
Initial value:
{
long INT32
Definition: jmorecfg.h:161
size_t length
Definition: host_hid.c:68

Referenced by Crc32_make_crc_table(), Crc32_update_crc(), dsp16_debug_printf(), dsp16_debug_sprintf(), dsp16_filt_iir(), dsp16_filt_iirpart(), dsp16_filt_interpolation_no_loop_kernel_x0(), dsp16_op_sin(), dsp16_resampling_no_loop_kernel_x0(), dsp16_sprintf(), dsp16_vect_add(), dsp16_vect_add_and_sat(), dsp16_vect_complex_abs(), dsp16_vect_complex_add(), dsp16_vect_complex_conj(), dsp16_vect_complex_sub(), dsp16_vect_dotdiv(), dsp16_vect_dotmul(), dsp16_vect_intdiv(), dsp16_vect_intmul(), dsp16_vect_max(), dsp16_vect_min(), dsp16_vect_neg(), dsp16_vect_pow(), dsp16_vect_realadd(), dsp16_vect_realdiv(), dsp16_vect_realmul(), dsp16_vect_realsub(), dsp16_vect_sub(), dsp16_win_kaiser(), dsp32_debug_printf(), dsp32_debug_sprintf(), dsp32_filt_iir(), dsp32_filt_iirpart(), dsp32_op_sin(), dsp32_sprintf(), dsp32_vect_add(), dsp32_vect_add_and_sat(), dsp32_vect_complex_abs(), dsp32_vect_complex_add(), dsp32_vect_complex_sub(), dsp32_vect_dotdiv(), dsp32_vect_dotmul(), dsp32_vect_intdiv(), dsp32_vect_intmul(), dsp32_vect_max(), dsp32_vect_min(), dsp32_vect_neg(), dsp32_vect_pow(), dsp32_vect_realadd(), dsp32_vect_realdiv(), dsp32_vect_realmul(), dsp32_vect_realsub(), dsp32_vect_sub(), dsp32_win_kaiser(), dsp_debug_sprint(), dsp_debug_sprint_after_radix(), dsp_debug_sprint_fct(), dsp_op_gcd(), dsp_sprint(), dsp_sprint_after_radix(), dsp_sprint_fct(), fixed_sqrt(), getTreeInflateDynamic(), host_get_data(), HuffmanTree_make2DTree(), HuffmanTree_makeFromLengths2(), inflateNoCompression(), median_cut(), pbuf_memcmp(), sensor_device_enum(), udi_cdc_data_received(), usb_pipe_interrupt(), and while().

cinfo marker next_restart_num = 0
numtoread = APPN_DATA_LEN
int prec
cinfo progressive_mode = is_prog
JQUANT_TBL* quant_ptr
cinfo restart_interval = 0
cinfo saw_Adobe_marker = FALSE
cinfo saw_JFIF_marker = FALSE
cinfo marker saw_SOF = TRUE
cinfo marker saw_SOI = TRUE
cinfo Se = c
cinfo Ss = c
return TRUE
cinfo unread_marker = c2
cinfo X_density = 1
cinfo Y_density = 1