common_jpeg.cpp 698 Bytes
Newer Older
1
2
3
4
5
#include "common_jpeg.h"

namespace vision {
namespace image {
namespace detail {
6

7
#if JPEG_FOUND
8
9
10
11
12
13
14
15
16
17
18
19
20
21
void torch_jpeg_error_exit(j_common_ptr cinfo) {
  /* cinfo->err really points to a torch_jpeg_error_mgr struct, so coerce
   * pointer */
  torch_jpeg_error_ptr myerr = (torch_jpeg_error_ptr)cinfo->err;

  /* Always display the message. */
  /* We could postpone this until after returning, if we chose. */
  // (*cinfo->err->output_message)(cinfo);
  /* Create the message */
  (*(cinfo->err->format_message))(cinfo, myerr->jpegLastErrorMsg);

  /* Return control to the setjmp point */
  longjmp(myerr->setjmp_buffer, 1);
}
22
#endif
23
24
25
26

} // namespace detail
} // namespace image
} // namespace vision