Debian Codegraph @

Modules/ThirdParty/GDCM/src/gdcm/Utilities/gdcmrle/rle.h

raw symbols SCIP
1 /*=========================================================================
2
3 Program: librle, a minimal RLE library for DICOM
4
5 Copyright (c) 2014 Mathieu Malaterre
6 All rights reserved.
7 See Copyright.txt for details.
8
9 This software is distributed WITHOUT ANY WARRANTY; without even
10 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
11 PURPOSE. See the above copyright notice for more information.
12
13 =========================================================================*/
14 #pragma once
15
16 #include "info.h"cxx . . $ `<file>/Modules/ThirdParty/GDCM/src/gdcm/Utilities/gdcmrle/info.h`/
17 #include "io.h"cxx . . $ `<file>/Modules/ThirdParty/GDCM/src/gdcm/Utilities/gdcmrle/io.h`/
18
19 namespace rlecxx . . $ rle/
20 {
21 // main encoder class
22 class rle_encodercxx . . $ rle/rle_encoder#
23 {
24 public:
25 /// main encoder function. only a single row at a time
26 /// return number of bytes written
27 int encode_rowcxx . . $ rle/rle_encoder#encode_row(416672b79ea26283).( destcxx . . $ rle/dest# & d );
28
29 /// compute and write header to dest `d`
30 /// this call is actually the main design of the encoder. since we are
31 /// encoding on a per line basis (well this apply for the general case where
32 /// bpp != 8 actually). The underlying implementation will parse once the
33 /// whole input to be able to compute offsets. Those offsets will then be used
34 /// later on to actually store the data. The RLE encoder is thus a two passes
35 /// process (repeats)
36 bool write_headercxx . . $ rle/rle_encoder#write_header(782f0d6fc9f01c35).( destcxx . . $ rle/dest# & d );
37
38 /// cstor
39 rle_encodercxx . . $ rle/rle_encoder#rle_encoder(cdc35fd263c0d658).(sourcecxx . . $ rle/source# & s, image_infocxx . . $ rle/image_info# const & ii);
40 ~cxx . . $ rle/rle_encoder#`~rle_encoder`(ced63f7c635d850d).rle_encodercxx . . $ rle/rle_encoder#();
41 private:
42 typedef char bytecxx . . $ rle/rle_encoder#byte#;
43 int compute_compressed_lengthcxx . . $ rle/rle_encoder#compute_compressed_length(cb7559238bb26814).( const bytecxx . . $ rle/rle_encoder#byte# * source, int sourcelen );
44 int encode_row_internalcxx . . $ rle/rle_encoder#encode_row_internal(aa1d56f47ee9ef77).( bytecxx . . $ rle/rle_encoder#byte# * dest, int destlen, const bytecxx . . $ rle/rle_encoder#byte# * source, int sourcelen );
45
46 struct internalcxx . . $ rle/rle_encoder#internal#;
47 internalcxx . . $ rle/rle_encoder#internal# *internalscxx . . $ rle/rle_encoder#internals.;
48 };
49
50 // this is a limited implementation this decoder is only capable of generating
51 // Planar Configuration = 0 output.
52 class rle_decodercxx . . $ rle/rle_decoder#
53 {
54 public:
55 typedef char bytecxx . . $ rle/rle_decoder#byte#;
56 typedef unsigned int streamsize_tcxx . . $ rle/rle_decoder#streamsize_t#; // need an integer capable of storing 32bits (unsigned)
57
58 /// decode all the scanlines of the image. The code simply call decode_row on
59 /// all scanlines.
60 /// return the size of bytes written ( = height * get_row_nbytes() )
61 streamsize_tcxx . . $ rle/rle_decoder#streamsize_t# decode_framecxx . . $ rle/rle_decoder#decode_frame(9428801968873d74).( destcxx . . $ rle/dest# & d );
62
63 /// Instead of decoding an entire row, simply skip it. May return an error
64 /// that indicate the stream is not valid or not does not respect row
65 /// boundaries crossing.
66 bool skip_rowcxx . . $ rle/rle_decoder#skip_row(c9857a73d68e59ba).();
67
68 /// Only decompress a single row at a time. returns number of bytes written.
69 /// some malformed RLE stream may cross the row-boundaries in which case it
70 /// makes it hard to decode a single row at a time.
71 /// an extra memory will be used to handle those cases.
72 int decode_rowcxx . . $ rle/rle_decoder#decode_row(416672b79ea26283).( destcxx . . $ rle/dest# & d );
73
74 /// Read the RLE header.
75 /// return true on success / false on error. Upon success the value nc / bpp
76 /// will contains the number of components and number of bits per pixel used to
77 /// encode the stream
78 bool read_headercxx . . $ rle/rle_decoder#read_header(b7e26af5e6615ecd).(pixel_infocxx . . $ rle/pixel_info# & pi);
79
80 /// Compute the actual number of bytes a single row should hold
81 /// return: width * sizeof( pixel )
82 int get_row_nbytescxx . . $ rle/rle_decoder#get_row_nbytes(455f465bc33b4cdf).() const;
83
84 /// initializer. cstor may throw upon invalid input
85 rle_decodercxx . . $ rle/rle_decoder#rle_decoder(cdc35fd263c0d658).(sourcecxx . . $ rle/source# & s, image_infocxx . . $ rle/image_info# const & ii);
86 ~cxx . . $ rle/rle_decoder#`~rle_decoder`(49f6e7a06ebc5aa8).rle_decodercxx . . $ rle/rle_decoder#();
87 private:
88 struct internalcxx . . $ rle/rle_decoder#internal#;
89 internalcxx . . $ rle/rle_decoder#internal# *internalscxx . . $ rle/rle_decoder#internals.;
90 };
91
92 } // end namespace rle