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 
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 
68 };
69 
71  PJPEG_STRICT = 1, // Don't try to recover from errors.
72  PJPEG_MJPEG = 2, // Support JPGs with missing DHT segments.
73 };
74 
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 
95 
96 #ifdef __cplusplus
97 }
98 #endif
99 
100 #endif
uint32_t stride
Definition: pjpeg.h:41
image_u8x3_t * pjpeg_to_u8x3_baseline(pjpeg_t *pj)
Definition: pjpeg.c:730
uint8_t id
Definition: pjpeg.h:49
uint32_t width
Definition: pjpeg.h:64
uint8_t scaley
Definition: pjpeg.h:51
void pjpeg_destroy(pjpeg_t *pj)
Definition: pjpeg.c:681
pjpeg_t * pjpeg_create_from_file(const char *path, uint32_t flags, int *error)
Definition: pjpeg.c:817
uint32_t width
Definition: pjpeg.h:37
pjpeg_component_t * components
Definition: pjpeg.h:67
PJPEG_ERROR
Definition: pjpeg.h:75
Definition: pjpeg.h:59
int error
Definition: pjpeg.h:62
pjpeg_t * pjpeg_create_from_buffer(uint8_t *buf, int buflen, uint32_t flags, int *error)
Definition: pjpeg.c:843
uint32_t height
Definition: pjpeg.h:37
uint8_t hv
Definition: pjpeg.h:50
uint8_t * data
Definition: pjpeg.h:44
uint8_t tda
Definition: pjpeg.h:55
int ncomponents
Definition: pjpeg.h:66
PJPEG_FLAGS
Definition: pjpeg.h:70
uint8_t scalex
Definition: pjpeg.h:51
uint8_t tq
Definition: pjpeg.h:52
image_u8_t * pjpeg_to_u8_baseline(pjpeg_t *pj)
Definition: pjpeg.c:695


apriltags2
Author(s): Danylo Malyuta
autogenerated on Fri Oct 19 2018 04:02:32