vil_jpeg.h
Go to the documentation of this file.
1 // This is core/vil/file_formats/vil_jpeg.h
2 #ifndef vil_jpeg_file_format_h_
3 #define vil_jpeg_file_format_h_
4 //:
5 // \file
6 // \author fsm
7 // \date 17 Feb 2000
8 //
9 // Adapted from geoff's code in ImageClasses/JPEGImage.*
10 //
11 // \verbatim
12 // Modifications:
13 // 3 October 2001 Peter Vanroose - Implemented get_property("top_row_first")
14 // 11 Oct 2002 Ian Scott - converted to vil
15 //\endverbatim
16 
17 #include <vil/vil_file_format.h>
18 #include <vil/vil_image_resource.h>
19 
20 // seeks to 0, then checks for magic number. returns true if found.
22 
23 //: Loader for JPEG files
25 {
26  public:
27  char const *tag() const override;
30  unsigned nx,
31  unsigned ny,
32  unsigned nplanes,
33  enum vil_pixel_format) override;
34 };
35 
36 //
39 
40 //: generic_image implementation for JPEG files
42 {
43  public:
45  vil_jpeg_image (vil_stream* is, unsigned ni,
46  unsigned nj, unsigned nplanes, vil_pixel_format format);
47  ~vil_jpeg_image() override;
48 
49  //: Dimensions: planes x width x height x components
50  unsigned nplanes() const override;
51  unsigned ni() const override;
52  unsigned nj() const override;
53 
54  enum vil_pixel_format pixel_format() const override;
55 
56  //: returns "jpeg"
57  char const *file_format() const override;
58 
59  //: Create a read/write view of a copy of this data.
60  // \return 0 if unable to get view of correct size.
61  vil_image_view_base_sptr get_copy_view(unsigned i0, unsigned ni,
62  unsigned j0, unsigned nj) const override;
63 
64  //: Put the data in this view back into the image source.
65  bool put_view(const vil_image_view_base& im, unsigned i0, unsigned j0) override;
66 
67  bool get_property(char const *tag, void *prop = nullptr) const override;
68 
69  //: set the quality for compression
70  void set_quality(int quality);
71 
72  private:
76  friend class vil_jpeg_file_format;
77 };
78 
79 #endif // vil_jpeg_file_format_h_
char const * file_format() const override
returns "jpeg".
Definition: vil_jpeg.cxx:277
An abstract base class of smart pointers to actual image data in memory.
generic_image implementation for JPEG files.
Definition: vil_jpeg.h:41
vil_pixel_format
Describes the type of the concrete data.
bool put_view(const vil_image_view_base &im, unsigned i0, unsigned j0) override
Put the data in this view back into the image source.
Definition: vil_jpeg.cxx:178
enum vil_pixel_format pixel_format() const override
Pixel Format.
Definition: vil_jpeg.cxx:271
unsigned ni() const override
Dimensions: Planes x ni x nj.
Definition: vil_jpeg.cxx:249
bool vil_jpeg_file_probe(vil_stream *vs)
the file probe, as a C function.
Definition: vil_jpeg.cxx:31
vil_jpeg_compressor * jc
Definition: vil_jpeg.h:73
bool get_property(char const *tag, void *prop=nullptr) const override
Extra property information.
Definition: vil_jpeg.cxx:91
Base class for image formats.
void set_quality(int quality)
set the quality for compression.
Definition: vil_jpeg.cxx:97
Stream interface for VIL image loaders.
Definition: vil_stream.h:21
vil_jpeg_image(vil_stream *is)
Definition: vil_jpeg.cxx:83
vil_stream * stream
Definition: vil_jpeg.h:75
Abstract representation of an image source or image destination.
Loader for JPEG files.
Definition: vil_jpeg.h:24
vil_jpeg_decompressor * jd
Definition: vil_jpeg.h:74
vil_image_view_base_sptr get_copy_view() const
Create a read/write view of a copy of all the data.
unsigned nplanes() const override
Dimensions: planes x width x height x components.
Definition: vil_jpeg.cxx:263
~vil_jpeg_image() override
Definition: vil_jpeg.cxx:129
vil_image_resource_sptr make_output_image(vil_stream *vs, unsigned nx, unsigned ny, unsigned nplanes, enum vil_pixel_format) override
Make a "generic_image" on which put_section may be applied.
Definition: vil_jpeg.cxx:64
Representation of a generic image source or destination.
unsigned nj() const override
Dimensions: Planes x ni x nj.
Definition: vil_jpeg.cxx:256
char const * tag() const override
Return a character string which uniquely identifies this format.
Definition: vil_jpeg.cxx:52
Base class for image formats.
vil_image_resource_sptr make_input_image(vil_stream *vs) override
Attempt to make a generic_image which will read from vil_stream vs.
Definition: vil_jpeg.cxx:58