OpenJPH
Open-source implementation of JPEG2000 Part-15
Loading...
Searching...
No Matches
ojph_img_io.h
Go to the documentation of this file.
1//***************************************************************************/
2// This software is released under the 2-Clause BSD license, included
3// below.
4//
5// Copyright (c) 2019, Aous Naman
6// Copyright (c) 2019, Kakadu Software Pty Ltd, Australia
7// Copyright (c) 2019, The University of New South Wales, Australia
8//
9// Redistribution and use in source and binary forms, with or without
10// modification, are permitted provided that the following conditions are
11// met:
12//
13// 1. Redistributions of source code must retain the above copyright
14// notice, this list of conditions and the following disclaimer.
15//
16// 2. Redistributions in binary form must reproduce the above copyright
17// notice, this list of conditions and the following disclaimer in the
18// documentation and/or other materials provided with the distribution.
19//
20// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
21// IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
22// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
23// PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24// HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
26// TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31//***************************************************************************/
32// This file is part of the OpenJPH software implementation.
33// File: ojph_img_io.h
34// Author: Aous Naman
35// Date: 28 August 2019
36//***************************************************************************/
37
38
39#ifndef OJPH_IMG_IO_H
40#define OJPH_IMG_IO_H
41
42#include <cstdio>
43#include <cassert>
44
45#include "ojph_base.h"
46#include "ojph_defs.h"
47
48#ifdef OJPH_ENABLE_TIFF_SUPPORT
49 #include "tiffio.h"
50#endif /* OJPH_ENABLE_TIFF_SUPPORT */
51
52namespace ojph {
53
55 // defined elsewhere
57 class line_buf;
58
60 //
61 //
62 //
63 //
64 //
67 {
68 public:
69 virtual ~image_in_base() {}
70 virtual ui32 read(const line_buf* line, ui32 comp_num) = 0;
71 virtual void close() {}
72 };
73
75 //
76 //
77 //
78 //
79 //
81 class ppm_in : public image_in_base
82 {
83 public:
85 {
86 fh = 0;
87 fname = NULL;
88 alloc_p = p;
89 temp_buf = NULL;
93
94 cur_line = 0;
95 start_of_data = 0;
96 planar = false;
97
98 bit_depth[2] = bit_depth[1] = bit_depth[0] = 0;
99 is_signed[2] = is_signed[1] = is_signed[0] = false;
100 subsampling[2] = subsampling[1] = subsampling[0] = point(1,1);
101 }
102 virtual ~ppm_in()
103 {
104 close();
105 if (alloc_p == NULL && temp_buf)
106 free(temp_buf);
107 }
108
109 void open(const char* filename);
110 void finalize_alloc();
111 virtual ui32 read(const line_buf* line, ui32 comp_num);
112 void close() { if(fh) { fclose(fh); fh = NULL; } fname = NULL; }
113 void set_planar(bool planar) { this->planar = planar; }
114
115 size get_size() { assert(fh); return size(width, height); }
116 ui32 get_width() { assert(fh); return width; }
117 ui32 get_height() { assert(fh); return height; }
118 ui32 get_max_val() { assert(fh); return max_val; }
119 ui32 get_num_components() { assert(fh); return num_comps; }
121 { assert(fh && comp_num < num_comps); return bit_depth[comp_num]; }
122 bool get_is_signed(ui32 comp_num)
123 { assert(fh && comp_num < num_comps); return is_signed[comp_num]; }
125 { assert(fh && comp_num < num_comps); return subsampling[comp_num]; }
126
127 private:
128 FILE *fh;
129 const char *fname;
131 void *temp_buf;
135
138 bool planar;
140 bool is_signed[3];
142 };
143
145 //
146 //
147 //
148 //
149 //
151#ifdef OJPH_ENABLE_TIFF_SUPPORT
152 class tif_in : public image_in_base
153 {
154 public:
155 tif_in()
156 {
157 tiff_handle = NULL;
158 fname = NULL;
159 line_buffer = NULL;
160 line_buffer_for_planar_support_uint8 = NULL;
161 line_buffer_for_planar_support_uint16 = NULL;
162
163 width = height = num_comps = 0;
164 bytes_per_sample = 0;
165
166 bytes_per_line = 0;
167 planar_configuration = 0;
168
169 cur_line = 0;
170
171 bit_depth[3] = bit_depth[2] = bit_depth[1] = bit_depth[0] = 0;
172 is_signed[3] = is_signed[2] = is_signed[1] = is_signed[0] = false;
173 subsampling[3] = subsampling[2] = point(1, 1);
174 subsampling[1] = subsampling[0] = point(1, 1);
175 }
176 virtual ~tif_in()
177 {
178 close();
179 if (line_buffer)
180 free(line_buffer);
181 if (line_buffer_for_planar_support_uint8)
182 free(line_buffer_for_planar_support_uint8);
183 if (line_buffer_for_planar_support_uint16)
184 free(line_buffer_for_planar_support_uint16);
185 }
186
187 void open(const char* filename);
188 virtual ui32 read(const line_buf* line, ui32 comp_num);
189 void close() {
190 if (tiff_handle) {
191 TIFFClose(tiff_handle);
192 tiff_handle = NULL;
193 }
194 fname = NULL;
195 }
196
197 size get_size() { assert(tiff_handle); return size(width, height); }
198 ui32 get_num_components() { assert(tiff_handle); return num_comps; }
199 void set_bit_depth(ui32 num_bit_depths, ui32* bit_depth);
200 ui32 get_bit_depth(ui32 comp_num) {
201 assert(tiff_handle && comp_num < num_comps);
202 return bit_depth[comp_num];
203 }
204 bool get_is_signed(ui32 comp_num) {
205 assert(tiff_handle && comp_num < num_comps);
206 return is_signed[comp_num];
207 }
208 point get_comp_subsampling(ui32 comp_num) {
209 assert(tiff_handle && comp_num < num_comps);
210 return subsampling[comp_num];
211 }
212
213 private:
214 TIFF* tiff_handle;
215 size_t bytes_per_line;
216 ui16 planar_configuration;
217
218 const char* fname;
219 void* line_buffer;
220 ui8* line_buffer_for_planar_support_uint8;
221 ui16* line_buffer_for_planar_support_uint16;
222 ui32 width, height;
223 ui32 num_comps;
224 ui32 bytes_per_sample;
225 ui32 cur_line;
226 ui32 bit_depth[4];
227 bool is_signed[4];
228 point subsampling[4];
229 };
230#endif /* OJPH_ENABLE_TIFF_SUPPORT */
231
233 // A simple DPX file reader supporting commonly used 10bit and 16bit formats
234 // DPX is an uncompressed file format used by the motion picture industry
235 // DPX is standardized by SMPTE ST 268-1:2014
236 //
237 //
239 class dpx_in : public image_in_base
240 {
241 public:
243 {
244 file_handle = NULL;
245 fname = NULL;
246
247 line_buffer = NULL;
249
250 width = height = 0;
251 num_comps = 0;
252
254
255 cur_line = 0;
256
257 bit_depth[3] = bit_depth[2] = bit_depth[1] = bit_depth[0] = 0;
258 is_signed[3] = is_signed[2] = is_signed[1] = is_signed[0] = false;
259 subsampling[3] = subsampling[2] = point(1, 1);
260 subsampling[1] = subsampling[0] = point(1, 1);
261
263 }
264 virtual ~dpx_in()
265 {
266 close();
267 if (line_buffer)
268 free(line_buffer);
271 }
272
273 void open(const char* filename);
274 virtual ui32 read(const line_buf* line, ui32 comp_num);
275 void close() {
276 if (file_handle) {
277 fclose(file_handle);
278 file_handle = NULL;
279 }
280 fname = NULL;
281 }
282
283 size get_size() { assert(file_handle); return size(width, height); }
286 assert(file_handle && comp_num < num_comps);
287 return bit_depth[comp_num];
288 }
289 bool get_is_signed(ui32 comp_num) {
290 assert(file_handle && comp_num < num_comps);
291 return is_signed[comp_num];
292 }
294 assert(file_handle && comp_num < num_comps);
295 return subsampling[comp_num];
296 }
297
298 private:
300
301 const char* fname;
305
308 bool is_signed[4];
310
312
314
315 // DPX specific members
317 // file info header
319 char version[8];
321 // image information header
326 // image element 1
335
337
338 };
339
341 //
342 //
343 //
344 //
345 //
347 class yuv_in : public image_in_base
348 {
349 public:
351 {
352 fh = NULL;
353 fname = NULL;
354 temp_buf = NULL;
355 for (int i = 0; i < 3; ++i)
356 {
357 width[i] = height[i] = bit_depth[i] = 0;
358 subsampling[i] = point(1,1);
359 comp_address[i] = 0;
360 bytes_per_sample[i] = 0;
361 }
362 num_com = 0;
363
364 cur_line = 0;
365 last_comp = 0;
366 planar = false;
367 }
368 virtual ~yuv_in()
369 {
370 close();
371 if (temp_buf)
372 free(temp_buf);
373 }
374
375 void open(const char* filename);
376 virtual ui32 read(const line_buf* line, ui32 comp_num);
377 void close() { if(fh) { fclose(fh); fh = NULL; } fname = NULL; }
378
379 void set_bit_depth(ui32 num_bit_depths, ui32* bit_depth);
380 void set_img_props(const size& s, ui32 num_components,
381 ui32 num_downsampling, const point *downsampling);
382
383 ui32 get_num_components() { assert(fh); return num_com; }
384 ui32 *get_bit_depth() { assert(fh); return bit_depth; }
385 point *get_comp_subsampling() { assert(fh); return subsampling; }
386
387 private:
388 FILE *fh;
389 const char *fname;
390 void *temp_buf;
394
396 bool planar;
399 };
400
402 //
403 //
404 //
405 //
406 //
408 class raw_in : public image_in_base
409 {
410 public:
412 {
413 fh = NULL;
414 fname = NULL;
415 width = height = bit_depth = 0;
417 is_signed = false;
418 cur_line = 0;
419 buffer = NULL;
420 buffer_size = 0;
421 }
422 virtual ~raw_in()
423 {
424 close();
425 if (buffer)
426 free(buffer);
427 }
428
429 void open(const char* filename);
430 virtual ui32 read(const line_buf* line, ui32 comp_num = 0);
431 void close() { if(fh) { fclose(fh); fh = NULL; } fname = NULL; }
432
433 void set_img_props(const size& s, ui32 bit_depth, bool is_signed);
434
435 ui32 get_bit_depth() { assert(fh); return bit_depth; }
436 bool get_is_signed() { assert(fh); return is_signed; }
437
438 private:
439 FILE *fh;
440 const char *fname;
445 void* buffer;
447 };
448
450 //
451 //
452 //
453 //
454 //
456 class pfm_in : public image_in_base
457 {
458 public:
460 {
461 fh = 0;
462 fname = NULL;
463 alloc_p = p;
464 temp_buf = NULL;
466 bit_depth[0] = bit_depth[1] = bit_depth[2] = 32;
467 scale = 0.0f;
468 little_endian = true;
469 width = height = num_comps = 0;
470
471 cur_line = 0;
472 start_of_data = 0;
473 }
474 virtual ~pfm_in()
475 {
476 close();
477 if (alloc_p == NULL && temp_buf)
478 free(temp_buf);
479 }
480
481 void open(const char* filename);
482 void finalize_alloc();
484 assert(num_comps != 0);
485 for (ui32 c = 0; c < num_comps; ++c)
486 this->bit_depth[c] = bit_depth[c];
487 }
488 virtual ui32 read(const line_buf* line, ui32 comp_num);
489 void close() { if(fh) { fclose(fh); fh = NULL; } fname = NULL; }
490
491 size get_size() { assert(fh); return size(width, height); }
492 ui32 get_width() { assert(fh); return width; }
493 ui32 get_height() { assert(fh); return height; }
494 ui32 get_num_components() { assert(fh); return num_comps; }
495
496 private:
497 FILE *fh;
498 const char *fname;
500 float *temp_buf;
502 ui32 bit_depth[3]; // this truncates data to bit_depth in the LSB
503 float scale;
508 };
509
510
512 // Accelerators (defined in ojph_img_io_*)
513 typedef void (*conversion_fun)(const line_buf *ln0, const line_buf *ln1,
514 const line_buf *ln2, void *dp,
515 ui32 bit_depth, ui32 count);
516
517 void gen_cvrt_32b1c_to_8ub1c(const line_buf *ln0, const line_buf *ln1,
518 const line_buf *ln2, void *dp,
519 ui32 bit_depth, ui32 count);
520 void gen_cvrt_32b3c_to_8ub3c(const line_buf *ln0, const line_buf *ln1,
521 const line_buf *ln2, void *dp,
522 ui32 bit_depth, ui32 count);
523 void gen_cvrt_32b1c_to_16ub1c_le(const line_buf *ln0, const line_buf *ln1,
524 const line_buf *ln2, void *dp,
525 ui32 bit_depth, ui32 count);
526 void gen_cvrt_32b3c_to_16ub3c_le(const line_buf *ln0, const line_buf *ln1,
527 const line_buf *ln2, void *dp,
528 ui32 bit_depth, ui32 count);
529 void gen_cvrt_32b1c_to_16ub1c_be(const line_buf *ln0, const line_buf *ln1,
530 const line_buf *ln2, void *dp,
531 ui32 bit_depth, ui32 count);
532 void gen_cvrt_32b3c_to_16ub3c_be(const line_buf *ln0, const line_buf *ln1,
533 const line_buf *ln2, void *dp,
534 ui32 bit_depth, ui32 count);
535
536 void sse41_cvrt_32b1c_to_8ub1c(const line_buf *ln0, const line_buf *ln1,
537 const line_buf *ln2, void *dp,
538 ui32 bit_depth, ui32 count);
539 void sse41_cvrt_32b3c_to_8ub3c(const line_buf *ln0, const line_buf *ln1,
540 const line_buf *ln2, void *dp,
541 ui32 bit_depth, ui32 count);
542 void sse41_cvrt_32b1c_to_16ub1c_le(const line_buf *ln0, const line_buf *ln1,
543 const line_buf *ln2, void *dp,
544 ui32 bit_depth, ui32 count);
545 void sse41_cvrt_32b3c_to_16ub3c_le(const line_buf *ln0, const line_buf *ln1,
546 const line_buf *ln2, void *dp,
547 ui32 bit_depth, ui32 count);
548 void sse41_cvrt_32b1c_to_16ub1c_be(const line_buf *ln0, const line_buf *ln1,
549 const line_buf *ln2, void *dp,
550 ui32 bit_depth, ui32 count);
551 void sse41_cvrt_32b3c_to_16ub3c_be(const line_buf *ln0, const line_buf *ln1,
552 const line_buf *ln2, void *dp,
553 ui32 bit_depth, ui32 count);
554
555 void avx2_cvrt_32b1c_to_8ub1c(const line_buf *ln0, const line_buf *ln1,
556 const line_buf *ln2, void *dp,
557 ui32 bit_depth, ui32 count);
558 void avx2_cvrt_32b3c_to_8ub3c(const line_buf *ln0, const line_buf *ln1,
559 const line_buf *ln2, void *dp,
560 ui32 bit_depth, ui32 count);
561 void avx2_cvrt_32b1c_to_16ub1c_le(const line_buf *ln0, const line_buf *ln1,
562 const line_buf *ln2, void *dp,
563 ui32 bit_depth, ui32 count);
564 void avx2_cvrt_32b1c_to_16ub1c_be(const line_buf *ln0, const line_buf *ln1,
565 const line_buf *ln2, void *dp,
566 ui32 bit_depth, ui32 count);
567
569 //
570 //
571 //
572 //
573 //
576 {
577 public:
578 virtual ~image_out_base() {}
579 virtual ui32 write(const line_buf* line, ui32 comp_num) = 0;
580 virtual void close() {}
581 };
582
584 //
585 //
586 //
587 //
588 //
590 class ppm_out : public image_out_base
591 {
592 public:
594 {
595 fh = NULL;
596 fname = NULL;
597 buffer = NULL;
600 buffer_size = 0;
602 converter = NULL;
603 lptr[0] = lptr[1] = lptr[2] = 0;
604 }
605 virtual ~ppm_out()
606 {
607 close();
608 if (buffer)
609 free(buffer);
610 }
611
612 void open(char* filename);
615 virtual ui32 write(const line_buf* line, ui32 comp_num);
616 virtual void close() { if(fh) { fclose(fh); fh = NULL; } fname = NULL; }
617
618 private:
619 FILE *fh;
620 const char *fname;
627 const line_buf *lptr[3];
628 };
629
630#ifdef OJPH_ENABLE_TIFF_SUPPORT
632 //
633 //
634 //
635 //
636 //
638
639 class tif_out : public image_out_base
640 {
641 public:
642 tif_out()
643 {
644 tiff_handle = NULL;
645 fname = NULL;
646 buffer = NULL;
647 width = height = num_components = 0;
648 bytes_per_sample = 0;
649 bit_depth_of_data[0] = bit_depth_of_data[1] = 0;
650 bit_depth_of_data[2] = bit_depth_of_data[3] = 0;
651 buffer_size = 0;
652 cur_line = samples_per_line = 0;
653 bytes_per_line = 0;
654
655 planar_configuration = 0;
656 }
657 virtual ~tif_out()
658 {
659 close();
660 if (buffer)
661 free(buffer);
662 }
663
664 void open(char* filename);
665 void configure(ui32 width, ui32 height, ui32 num_components,
666 ui32 *bit_depth);
667 virtual ui32 write(const line_buf* line, ui32 comp_num);
668 virtual void close() {
669 if (tiff_handle) {
670 TIFFClose(tiff_handle);
671 tiff_handle = NULL;
672 }
673 fname = NULL;
674 }
675
676 private:
677 TIFF* tiff_handle;
678 size_t bytes_per_line;
679 unsigned short planar_configuration;
680
681 const char* fname;
682 ui32 width, height, num_components;
683 ui32 bit_depth_of_data[4];
684 ui32 bytes_per_sample;
685 ui8* buffer;
686 size_t buffer_size;
687 ui32 cur_line, samples_per_line;
688 };
689#endif /* OJPH_ENABLE_TIFF_SUPPORT */
690
691
693 //
694 //
695 //
696 //
697 //
699 class yuv_out : public image_out_base
700 {
701 public:
703 {
704 fh = NULL;
705 fname = NULL;
706 width = num_components = 0;
707 bit_depth = 0;
708 comp_width = NULL;
709 buffer = NULL;
710 buffer_size = 0;
711 }
712 virtual ~yuv_out();
713
714 void open(char* filename);
716 virtual ui32 write(const line_buf* line, ui32 comp_num);
717 virtual void close() { if(fh) { fclose(fh); fh = NULL; } fname = NULL; }
718
719 private:
720 FILE *fh;
721 const char *fname;
728 };
729
731 //
732 //
733 //
734 //
735 //
737 class raw_out : public image_out_base
738 {
739 public:
741 {
742 fh = NULL;
743 fname = NULL;
744 is_signed = false;
746 lower_val = upper_val = 0;
747 width = 0;
748 buffer = NULL;
749 buffer_size = 0;
750 }
751 virtual ~raw_out();
752
753 void open(char* filename);
755 virtual ui32 write(const line_buf* line, ui32 comp_num = 0);
756 virtual void close() { if (fh) { fclose(fh); fh = NULL; } fname = NULL; }
757
758 private:
759 FILE* fh;
760 const char* fname;
767 };
768
770 //
771 //
772 //
773 //
774 //
776 class pfm_out : public image_out_base
777 {
778 public:
780 {
781 fh = NULL;
782 fname = NULL;
783 buffer = NULL;
784 buffer_size = 0;
786 scale = -1.0f;
787 bit_depth[0] = bit_depth[1] = bit_depth[2] = 32;
788 cur_line = 0;
789 start_of_data = 0;
790 }
791 virtual ~pfm_out()
792 {
793 close();
794 if (buffer)
795 free(buffer);
796 }
797
798 void open(char* filename);
800 float scale, ui32* bit_depth);
801 virtual ui32 write(const line_buf* line, ui32 comp_num);
802 virtual void close() { if(fh) { fclose(fh); fh = NULL; } fname = NULL; }
803
804 private:
805 FILE *fh;
806 const char *fname;
807 float* buffer;
810 float scale;
814 };
815
816
817}
818
819#endif // !OJPH_IMG_IO_H
ui32 get_num_components()
void * line_buffer
bool get_is_signed(ui32 comp_num)
size_t number_of_32_bit_words_per_line
void open(const char *filename)
ui16 packing_for_image_element_1
ui8 descriptor_for_image_element_1
ui32 offset_to_data_for_image_element_1
ui32 total_image_file_size_in_bytes
FILE * file_handle
ui32 pixels_per_line
point subsampling[4]
ui16 number_of_image_elements
ui8 bitdepth_for_image_element_1
virtual ui32 read(const line_buf *line, ui32 comp_num)
ui16 * line_buffer_16bit_samples
char version[8]
ui32 offset_to_image_data_in_bytes
ui32 get_bit_depth(ui32 comp_num)
ui16 encoding_for_image_element_1
size get_size()
ui32 number_of_samples_per_line
virtual ~dpx_in()
ui8 transfer_characteristic_for_image_element_1
point get_comp_subsampling(ui32 comp_num)
ui8 colormetric_specification_for_image_element_1
ui32 lines_per_image_element
ui16 image_orientation
bool is_signed[4]
const char * fname
ui32 bit_depth[4]
bool is_byte_swapping_necessary
ui32 data_sign_for_image_element_1
virtual void close()
Definition ojph_img_io.h:71
virtual ui32 read(const line_buf *line, ui32 comp_num)=0
virtual ~image_in_base()
Definition ojph_img_io.h:69
virtual ui32 write(const line_buf *line, ui32 comp_num)=0
virtual void close()
virtual ~image_out_base()
pfm_in(mem_fixed_allocator *p=NULL)
virtual ui32 read(const line_buf *line, ui32 comp_num)
ui32 bit_depth[3]
mem_fixed_allocator * alloc_p
size get_size()
void finalize_alloc()
const char * fname
ui32 get_width()
ui32 get_height()
void open(const char *filename)
size_t temp_buf_byte_size
ui32 get_num_components()
float * temp_buf
void configure(ui32 *bit_depth)
virtual ~pfm_in()
virtual ~pfm_out()
const char * fname
void open(char *filename)
size_t buffer_size
void configure(ui32 width, ui32 height, ui32 num_components, float scale, ui32 *bit_depth)
virtual ui32 write(const line_buf *line, ui32 comp_num)
ui32 bit_depth[3]
virtual void close()
point subsampling[3]
ui32 get_height()
void open(const char *filename)
ui32 get_num_components()
void set_planar(bool planar)
size get_size()
ui32 num_ele_per_line
ui32 bytes_per_sample
ui32 get_width()
ui32 max_val_num_bits
ui32 get_bit_depth(ui32 comp_num)
const char * fname
void finalize_alloc()
ui32 temp_buf_byte_size
ppm_in(mem_fixed_allocator *p=NULL)
Definition ojph_img_io.h:84
ui32 get_max_val()
void * temp_buf
virtual ~ppm_in()
point get_comp_subsampling(ui32 comp_num)
mem_fixed_allocator * alloc_p
bool get_is_signed(ui32 comp_num)
bool is_signed[3]
ui32 bit_depth[3]
virtual ui32 read(const line_buf *line, ui32 comp_num)
const char * fname
virtual void close()
void open(char *filename)
virtual ui32 write(const line_buf *line, ui32 comp_num)
ui32 bytes_per_sample
const line_buf * lptr[3]
virtual ~ppm_out()
conversion_fun converter
void configure(ui32 width, ui32 height, ui32 num_components, ui32 bit_depth)
ui32 samples_per_line
size_t buffer_size
ui32 bytes_per_sample
virtual ~raw_in()
ui32 get_bit_depth()
void set_img_props(const size &s, ui32 bit_depth, bool is_signed)
size_t buffer_size
const char * fname
void open(const char *filename)
virtual ui32 read(const line_buf *line, ui32 comp_num=0)
bool get_is_signed()
void open(char *filename)
void configure(bool is_signed, ui32 bit_depth, ui32 width)
virtual void close()
virtual ~raw_out()
const char * fname
virtual ui32 write(const line_buf *line, ui32 comp_num=0)
ui32 bytes_per_sample
point * get_comp_subsampling()
ui32 width[3]
virtual ui32 read(const line_buf *line, ui32 comp_num)
ui32 height[3]
void open(const char *filename)
void * temp_buf
const char * fname
void set_img_props(const size &s, ui32 num_components, ui32 num_downsampling, const point *downsampling)
void set_bit_depth(ui32 num_bit_depths, ui32 *bit_depth)
virtual ~yuv_in()
ui32 bytes_per_sample[3]
ui32 * get_bit_depth()
point subsampling[3]
ui32 get_num_components()
ui32 bit_depth[3]
ui32 comp_address[3]
const char * fname
void open(char *filename)
ui32 * comp_width
void configure(ui32 bit_depth, ui32 num_components, ui32 *comp_width)
virtual void close()
virtual ~yuv_out()
virtual ui32 write(const line_buf *line, ui32 comp_num)
void sse41_cvrt_32b3c_to_8ub3c(const line_buf *ln0, const line_buf *ln1, const line_buf *ln2, void *dp, ui32 bit_depth, ui32 count)
void(* conversion_fun)(const line_buf *ln0, const line_buf *ln1, const line_buf *ln2, void *dp, ui32 bit_depth, ui32 count)
void sse41_cvrt_32b3c_to_16ub3c_le(const line_buf *ln0, const line_buf *ln1, const line_buf *ln2, void *dp, ui32 bit_depth, ui32 count)
int64_t si64
Definition ojph_defs.h:57
void gen_cvrt_32b3c_to_16ub3c_le(const line_buf *ln0, const line_buf *ln1, const line_buf *ln2, void *dp, ui32 bit_depth, ui32 count)
void avx2_cvrt_32b3c_to_8ub3c(const line_buf *ln0, const line_buf *ln1, const line_buf *ln2, void *dp, ui32 bit_depth, ui32 count)
uint16_t ui16
Definition ojph_defs.h:52
void gen_cvrt_32b1c_to_16ub1c_le(const line_buf *ln0, const line_buf *ln1, const line_buf *ln2, void *dp, ui32 bit_depth, ui32 count)
void sse41_cvrt_32b1c_to_16ub1c_be(const line_buf *ln0, const line_buf *ln1, const line_buf *ln2, void *dp, ui32 bit_depth, ui32 count)
void avx2_cvrt_32b1c_to_16ub1c_be(const line_buf *ln0, const line_buf *ln1, const line_buf *ln2, void *dp, ui32 bit_depth, ui32 count)
void sse41_cvrt_32b1c_to_8ub1c(const line_buf *ln0, const line_buf *ln1, const line_buf *ln2, void *dp, ui32 bit_depth, ui32 count)
void avx2_cvrt_32b1c_to_8ub1c(const line_buf *ln0, const line_buf *ln1, const line_buf *ln2, void *dp, ui32 bit_depth, ui32 count)
void gen_cvrt_32b3c_to_16ub3c_be(const line_buf *ln0, const line_buf *ln1, const line_buf *ln2, void *dp, ui32 bit_depth, ui32 count)
void sse41_cvrt_32b1c_to_16ub1c_le(const line_buf *ln0, const line_buf *ln1, const line_buf *ln2, void *dp, ui32 bit_depth, ui32 count)
void avx2_cvrt_32b1c_to_16ub1c_le(const line_buf *ln0, const line_buf *ln1, const line_buf *ln2, void *dp, ui32 bit_depth, ui32 count)
void gen_cvrt_32b1c_to_8ub1c(const line_buf *ln0, const line_buf *ln1, const line_buf *ln2, void *dp, ui32 bit_depth, ui32 count)
void sse41_cvrt_32b3c_to_16ub3c_be(const line_buf *ln0, const line_buf *ln1, const line_buf *ln2, void *dp, ui32 bit_depth, ui32 count)
uint32_t ui32
Definition ojph_defs.h:54
uint8_t ui8
Definition ojph_defs.h:50
void gen_cvrt_32b1c_to_16ub1c_be(const line_buf *ln0, const line_buf *ln1, const line_buf *ln2, void *dp, ui32 bit_depth, ui32 count)
void gen_cvrt_32b3c_to_8ub3c(const line_buf *ln0, const line_buf *ln1, const line_buf *ln2, void *dp, ui32 bit_depth, ui32 count)