Image Component Library (ICL)
JPEGHandle.h
Go to the documentation of this file.
1 /********************************************************************
2 ** Image Component Library (ICL) **
3 ** **
4 ** Copyright (C) 2006-2013 CITEC, University of Bielefeld **
5 ** Neuroinformatics Group **
6 ** Website: www.iclcv.org and **
7 ** http://opensource.cit-ec.de/projects/icl **
8 ** **
9 ** File : ICLIO/src/ICLIO/JPEGHandle.h **
10 ** Module : ICLIO **
11 ** Authors: Christof Elbrechter **
12 ** **
13 ** **
14 ** GNU LESSER GENERAL PUBLIC LICENSE **
15 ** This file may be used under the terms of the GNU Lesser General **
16 ** Public License version 3.0 as published by the **
17 ** **
18 ** Free Software Foundation and appearing in the file LICENSE.LGPL **
19 ** included in the packaging of this file. Please review the **
20 ** following information to ensure the license requirements will **
21 ** be met: http://www.gnu.org/licenses/lgpl-3.0.txt **
22 ** **
23 ** The development of this software was supported by the **
24 ** Excellence Cluster EXC 277 Cognitive Interaction Technology. **
25 ** The Excellence Cluster EXC 277 is a grant of the Deutsche **
26 ** Forschungsgemeinschaft (DFG) in the context of the German **
27 ** Excellence Initiative. **
28 ** **
29 ********************************************************************/
30 
31 #pragma once
32 
33 #ifdef ICL_HAVE_LIBJPEG
34 
35 #include <ICLUtils/CompatMacros.h>
36 #include <stdio.h>
37 #include <jerror.h>
38 #include <jpeglib.h>
39 #include <setjmp.h>
40 
41 
43 namespace icl{
44  namespace io{
45 
46  // returns controll to the caller
47  struct icl_jpeg_error_mgr : jpeg_error_mgr {
48  jmp_buf setjmp_buffer;
49  };
50 
51  // passes controll back to the caller
52  ICLIO_API void icl_jpeg_error_exit(j_common_ptr cinfo);
53 
54  // }}}
55 
56 
58  struct ICLIO_API JPEGDataHandle{
59  inline JPEGDataHandle(){
60  info.err = jpeg_std_error(&em);
61  em.error_exit = icl_jpeg_error_exit;
62  }
63  struct jpeg_decompress_struct info;
64  struct icl_jpeg_error_mgr em;
65  };
66 
67  } // namespace io
68 }// namespace icl
69 
72 #else // not ICL_HAVE_LIBJPEG
73 namespace icl{
74  namespace io{
76  struct JPEGDataHandle{};
78  } // namespace io
79 }
80 #endif // not ICL_HAVE_LIBJPEG
undocument this line if you encounter any issues!
Definition: Any.h:37
#define ICLIO_API
Definition: CompatMacros.h:176