Main Page
Classes
Files
File List
File Members
include
common
pjpeg.h
Go to the documentation of this file.
1
/* Copyright (C) 2013-2016, The Regents of The University of Michigan.
2
All rights reserved.
3
4
This software was developed in the APRIL Robotics Lab under the
5
direction of Edwin Olson, ebolson@umich.edu. This software may be
6
available under alternative licensing terms; contact the address above.
7
8
This library is free software; you can redistribute it and/or
9
modify it under the terms of the GNU Lesser General Public
10
License as published by the Free Software Foundation; either
11
version 2.1 of the License, or (at your option) any later version.
12
13
This library is distributed in the hope that it will be useful,
14
but WITHOUT ANY WARRANTY; without even the implied warranty of
15
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16
Lesser General Public License for more details.
17
18
You should have received a copy of the GNU Lesser General Public
19
License along with this library; if not, see <http://www.gnu.org/licenses/>.
20
*/
21
22
#ifndef _PJPEG_H
23
#define _PJPEG_H
24
25
#include "
image_u8.h
"
26
#include "
image_u8x3.h
"
27
28
#ifdef __cplusplus
29
extern
"C"
{
30
#endif
31
32
typedef
struct
pjpeg_component
pjpeg_component_t
;
33
struct
pjpeg_component
34
{
35
// resolution of this component (which is smaller than the
36
// dimensions of the image if the channel has been sub-sampled.)
37
uint32_t
width
,
height
;
38
39
// number of bytes per row. May be larger than width for alignment
40
// reasons.
41
uint32_t
stride
;
42
43
// data[y*stride + x]
44
uint8_t *
data
;
45
47
// These items probably not of great interest to most
48
// applications.
49
uint8_t
id
;
// the identifier associated with this component
50
uint8_t
hv
;
// horiz scale (high 4 bits) / vert scale (low 4 bits)
51
uint8_t
scalex
,
scaley
;
// derived from hv above
52
uint8_t
tq
;
// quantization table index
53
54
// this filled in at the last moment by SOS
55
uint8_t
tda
;
// which huff tables will we use for DC (high 4 bits) and AC (low 4 bits)
56
};
57
58
typedef
struct
pjpeg
pjpeg_t
;
59
struct
pjpeg
60
{
61
// status of the decode is put here. Non-zero means error.
62
int
error
;
63
64
uint32_t
width
,
height
;
// pixel dimensions
65
66
int
ncomponents
;
67
pjpeg_component_t
*
components
;
68
};
69
70
enum
PJPEG_FLAGS
{
71
PJPEG_STRICT
= 1,
// Don't try to recover from errors.
72
PJPEG_MJPEG
= 2,
// Support JPGs with missing DHT segments.
73
};
74
75
enum
PJPEG_ERROR
{
76
PJPEG_OKAY
= 0,
77
PJPEG_ERR_FILE
,
// something wrong reading file
78
PJPEG_ERR_DQT
,
// something wrong with DQT marker
79
PJPEG_ERR_SOF
,
// something wrong with SOF marker
80
PJPEG_ERR_DHT
,
// something wrong with DHT marker
81
PJPEG_ERR_SOS
,
// something wrong with SOS marker
82
PJPEG_ERR_MISSING_DHT
,
// missing a necessary huffman table
83
PJPEG_ERR_DRI
,
// something wrong with DRI marker
84
PJPEG_ERR_RESET
,
// didn't get a reset marker where we expected. Corruption?
85
PJPEG_ERR_EOF
,
// ran out of bytes while decoding
86
PJEPG_ERR_UNSUPPORTED
,
// an unsupported format
87
};
88
89
pjpeg_t
*
pjpeg_create_from_file
(
const
char
*path, uint32_t flags,
int
*error);
90
pjpeg_t
*
pjpeg_create_from_buffer
(uint8_t *buf,
int
buflen, uint32_t flags,
int
*error);
91
void
pjpeg_destroy
(
pjpeg_t
*pj);
92
93
image_u8_t
*
pjpeg_to_u8_baseline
(
pjpeg_t
*pj);
94
image_u8x3_t
*
pjpeg_to_u8x3_baseline
(
pjpeg_t
*pj);
95
96
#ifdef __cplusplus
97
}
98
#endif
99
100
#endif
pjpeg_component::stride
uint32_t stride
Definition:
pjpeg.h:41
pjpeg_to_u8x3_baseline
image_u8x3_t * pjpeg_to_u8x3_baseline(pjpeg_t *pj)
Definition:
pjpeg.c:730
image_u8x3.h
pjpeg_component::id
uint8_t id
Definition:
pjpeg.h:49
pjpeg::width
uint32_t width
Definition:
pjpeg.h:64
pjpeg_component::scaley
uint8_t scaley
Definition:
pjpeg.h:51
pjpeg_destroy
void pjpeg_destroy(pjpeg_t *pj)
Definition:
pjpeg.c:681
pjpeg_create_from_file
pjpeg_t * pjpeg_create_from_file(const char *path, uint32_t flags, int *error)
Definition:
pjpeg.c:817
pjpeg_component::width
uint32_t width
Definition:
pjpeg.h:37
PJPEG_STRICT
Definition:
pjpeg.h:71
PJPEG_ERR_EOF
Definition:
pjpeg.h:85
PJPEG_ERR_DQT
Definition:
pjpeg.h:78
PJPEG_ERR_MISSING_DHT
Definition:
pjpeg.h:82
pjpeg::components
pjpeg_component_t * components
Definition:
pjpeg.h:67
PJPEG_ERROR
PJPEG_ERROR
Definition:
pjpeg.h:75
PJPEG_ERR_SOS
Definition:
pjpeg.h:81
pjpeg
Definition:
pjpeg.h:59
pjpeg::error
int error
Definition:
pjpeg.h:62
pjpeg_create_from_buffer
pjpeg_t * pjpeg_create_from_buffer(uint8_t *buf, int buflen, uint32_t flags, int *error)
Definition:
pjpeg.c:843
pjpeg_component::height
uint32_t height
Definition:
pjpeg.h:37
PJPEG_ERR_FILE
Definition:
pjpeg.h:77
pjpeg_component
Definition:
pjpeg.h:33
image_u8
Definition:
image_types.h:11
PJPEG_ERR_RESET
Definition:
pjpeg.h:84
PJEPG_ERR_UNSUPPORTED
Definition:
pjpeg.h:86
PJPEG_MJPEG
Definition:
pjpeg.h:72
image_u8x3
Definition:
image_types.h:21
pjpeg_component::hv
uint8_t hv
Definition:
pjpeg.h:50
PJPEG_ERR_SOF
Definition:
pjpeg.h:79
pjpeg_component::data
uint8_t * data
Definition:
pjpeg.h:44
PJPEG_OKAY
Definition:
pjpeg.h:76
pjpeg_component::tda
uint8_t tda
Definition:
pjpeg.h:55
pjpeg::ncomponents
int ncomponents
Definition:
pjpeg.h:66
PJPEG_FLAGS
PJPEG_FLAGS
Definition:
pjpeg.h:70
pjpeg_component::scalex
uint8_t scalex
Definition:
pjpeg.h:51
PJPEG_ERR_DHT
Definition:
pjpeg.h:80
pjpeg_component::tq
uint8_t tq
Definition:
pjpeg.h:52
pjpeg_to_u8_baseline
image_u8_t * pjpeg_to_u8_baseline(pjpeg_t *pj)
Definition:
pjpeg.c:695
image_u8.h
PJPEG_ERR_DRI
Definition:
pjpeg.h:83
apriltags2
Author(s): Danylo Malyuta
autogenerated on Fri Oct 19 2018 04:02:32