OpenJPH
Open-source implementation of JPEG2000 Part-15
ojph_resolution.cpp
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_resolution.cpp
34// Author: Aous Naman
35// Date: 28 August 2019
36//***************************************************************************/
37
38
39#include <climits>
40#include <cmath>
41
42#include "ojph_mem.h"
43#include "ojph_params.h"
45#include "ojph_resolution.h"
46#include "ojph_tile_comp.h"
47#include "ojph_tile.h"
48#include "ojph_subband.h"
49#include "ojph_precinct.h"
50
51#include "../transform/ojph_transform.h"
52
53namespace ojph {
54
55 namespace local
56 {
57
59 static void rotate_buffers(line_buf* line1, line_buf* line2,
60 line_buf* line3, line_buf* line4)
61 {
62 assert(line1->size == line2->size &&
63 line1->pre_size == line2->pre_size &&
64 line1->size == line3->size &&
65 line1->pre_size == line3->pre_size &&
66 line1->size == line4->size &&
67 line1->pre_size == line4->pre_size);
68 si32* p = line4->i32;
69 line4->i32 = line3->i32;
70 line3->i32 = line2->i32;
71 line2->i32 = line1->i32;
72 line1->i32 = p;
73 }
74
76 static void rotate_buffers(line_buf* line1, line_buf* line2,
77 line_buf* line3, line_buf* line4,
78 line_buf* line5, line_buf* line6)
79 {
80 assert(line1->size == line2->size &&
81 line1->pre_size == line2->pre_size &&
82 line1->size == line3->size &&
83 line1->pre_size == line3->pre_size &&
84 line1->size == line4->size &&
85 line1->pre_size == line4->pre_size &&
86 line1->size == line5->size &&
87 line1->pre_size == line5->pre_size &&
88 line1->size == line6->size &&
89 line1->pre_size == line6->pre_size);
90 si32* p = line6->i32;
91 line6->i32 = line5->i32;
92 line5->i32 = line4->i32;
93 line4->i32 = line3->i32;
94 line3->i32 = line2->i32;
95 line2->i32 = line1->i32;
96 line1->i32 = p;
97 }
98
101 const rect& recon_res_rect, ui32 res_num)
102 {
104 const param_cod* cdp = codestream->get_cod();
108
109 //create next resolution
110 if (res_num > 0)
111 {
112 //allocate a resolution
113 allocator->pre_alloc_obj<resolution>(1);
114 ui32 trx0 = ojph_div_ceil(res_rect.org.x, 2);
115 ui32 try0 = ojph_div_ceil(res_rect.org.y, 2);
118 rect next_res_rect;
119 next_res_rect.org.x = trx0;
120 next_res_rect.org.y = try0;
121 next_res_rect.siz.w = trx1 - trx0;
122 next_res_rect.siz.h = try1 - try0;
123
124 resolution::pre_alloc(codestream, next_res_rect,
125 skipped_res_for_recon ? recon_res_rect : next_res_rect, res_num - 1);
126 }
127
128 //allocate subbands
129 ui32 trx0 = res_rect.org.x;
130 ui32 try0 = res_rect.org.y;
131 ui32 trx1 = res_rect.org.x + res_rect.siz.w;
132 ui32 try1 = res_rect.org.y + res_rect.siz.h;
133 allocator->pre_alloc_obj<subband>(4);
134 if (res_num > 0)
135 {
136 for (ui32 i = 1; i < 4; ++i)
137 {
138 ui32 tbx0 = (trx0 - (i & 1) + 1) >> 1;
139 ui32 tbx1 = (trx1 - (i & 1) + 1) >> 1;
140 ui32 tby0 = (try0 - (i >> 1) + 1) >> 1;
141 ui32 tby1 = (try1 - (i >> 1) + 1) >> 1;
142
143 rect band_rect;
144 band_rect.org.x = tbx0;
145 band_rect.org.y = tby0;
146 band_rect.siz.w = tbx1 - tbx0;
147 band_rect.siz.h = tby1 - tby0;
149 }
150 }
151 else
153
154 //prealloc precincts
157 if (trx0 != trx1 && try0 != try1)
158 {
159 num_precincts.w = (trx1 + (1 << log_PP.w) - 1) >> log_PP.w;
160 num_precincts.w -= trx0 >> log_PP.w;
161 num_precincts.h = (try1 + (1 << log_PP.h) - 1) >> log_PP.h;
162 num_precincts.h -= try0 >> log_PP.h;
163 allocator->pre_alloc_obj<precinct>((size_t)num_precincts.area());
164 }
165
166 //allocate lines
167 if (skipped_res_for_recon == false)
168 {
169 bool reversible = cdp->is_reversible();
170 ui32 num_lines = reversible ? 4 : 6;
171 allocator->pre_alloc_obj<line_buf>(num_lines);
172
173 ui32 width = res_rect.siz.w + 1;
174 for (ui32 i = 0; i < num_lines; ++i)
175 allocator->pre_alloc_data<si32>(width, 1);
176 }
177 }
178
181 const rect& res_rect,
182 const rect& recon_res_rect,
183 ui32 comp_num, ui32 res_num,
184 point comp_downsamp,
185 tile_comp* parent_tile_comp,
186 resolution* parent_res)
187 {
190 ui32 t, num_decomps = codestream->get_cod()->get_num_decompositions();
191 t = num_decomps - codestream->get_skipped_res_for_recon();
193 t = num_decomps - codestream->get_skipped_res_for_read();
195 const param_cod* cdp = codestream->get_cod();
196
197 this->comp_downsamp = comp_downsamp;
198 this->parent_comp = parent_tile_comp;
199 this->parent_res = parent_res;
200 this->res_rect = res_rect;
201 this->comp_num = comp_num;
202 this->res_num = res_num;
203 this->num_bytes = 0;
204 //finalize next resolution
205 if (res_num > 0)
206 {
207 //allocate a resolution
208 child_res = allocator->post_alloc_obj<resolution>(1);
209 ui32 trx0 = ojph_div_ceil(res_rect.org.x, 2);
210 ui32 try0 = ojph_div_ceil(res_rect.org.y, 2);
213 rect next_res_rect;
214 next_res_rect.org.x = trx0;
215 next_res_rect.org.y = try0;
216 next_res_rect.siz.w = trx1 - trx0;
217 next_res_rect.siz.h = try1 - try0;
218
219 child_res->finalize_alloc(codestream, next_res_rect,
220 skipped_res_for_recon ? recon_res_rect : next_res_rect, comp_num,
221 res_num - 1, comp_downsamp, parent_tile_comp, this);
222 }
223 else
224 child_res = NULL;
225
226 //allocate subbands
227 ui32 trx0 = res_rect.org.x;
228 ui32 try0 = res_rect.org.y;
229 ui32 trx1 = res_rect.org.x + res_rect.siz.w;
230 ui32 try1 = res_rect.org.y + res_rect.siz.h;
231 bands = allocator->post_alloc_obj<subband>(4);
232 if (res_num > 0)
233 {
234 this->num_bands = 3;
235 for (ui32 i = 1; i < 4; ++i)
236 {
237 ui32 tbx0 = (trx0 - (i & 1) + 1) >> 1;
238 ui32 tbx1 = (trx1 - (i & 1) + 1) >> 1;
239 ui32 tby0 = (try0 - (i >> 1) + 1) >> 1;
240 ui32 tby1 = (try1 - (i >> 1) + 1) >> 1;
241
242 rect band_rect;
243 band_rect.org.x = tbx0;
244 band_rect.org.y = tby0;
245 band_rect.siz.w = tbx1 - tbx0;
246 band_rect.siz.h = tby1 - tby0;
247 bands[i].finalize_alloc(codestream, band_rect, this, res_num, i);
248 }
249 }
250 else {
251 this->num_bands = 1;
252 bands[0].finalize_alloc(codestream, res_rect, this, res_num, 0);
253 }
254
255 //finalize precincts
258 precincts = NULL;
259 if (trx0 != trx1 && try0 != try1)
260 {
261 num_precincts.w = (trx1 + (1 << log_PP.w) - 1) >> log_PP.w;
262 num_precincts.w -= trx0 >> log_PP.w;
263 num_precincts.h = (try1 + (1 << log_PP.h) - 1) >> log_PP.h;
264 num_precincts.h -= try0 >> log_PP.h;
265 precincts =
266 allocator->post_alloc_obj<precinct>((size_t)num_precincts.area());
267 ui64 num = num_precincts.area();
268 for (ui64 i = 0; i < num; ++i)
269 precincts[i] = precinct();
270 }
271 // precincts will be initialized in full shortly
272
273 ui32 x_lower_bound = (trx0 >> log_PP.w) << log_PP.w;
274 ui32 y_lower_bound = (try0 >> log_PP.h) << log_PP.h;
275
276 point proj_factor;
277 proj_factor.x = comp_downsamp.x * (1 << (num_decomps - res_num));
278 proj_factor.y = comp_downsamp.y * (1 << (num_decomps - res_num));
279 precinct* pp = precincts;
280
281 point tile_top_left = parent_tile_comp->get_tile()->get_tile_rect().org;
282 for (ui32 y = 0; y < num_precincts.h; ++y)
283 {
284 ui32 ppy0 = y_lower_bound + (y << log_PP.h);
285 for (ui32 x = 0; x < num_precincts.w; ++x, ++pp)
286 {
287 ui32 ppx0 = x_lower_bound + (x << log_PP.w);
288 point t(proj_factor.x * ppx0, proj_factor.y * ppy0);
289 t.x = t.x > tile_top_left.x ? t.x : tile_top_left.x;
290 t.y = t.y > tile_top_left.y ? t.y : tile_top_left.y;
291 pp->img_point = t;
292 pp->num_bands = num_bands;
293 pp->bands = bands;
294 pp->may_use_sop = cdp->packets_may_use_sop();
295 pp->uses_eph = cdp->packets_use_eph();
297 pp->coded = NULL;
298 }
299 }
300 if (num_bands == 1)
302 else
303 for (int i = 1; i < 4; ++i)
304 bands[i].get_cb_indices(num_precincts, precincts);
305
306 size log_cb = cdp->get_log_block_dims();
307 log_PP.w -= (res_num ? 1 : 0);
308 log_PP.h -= (res_num ? 1 : 0);
309 size ratio;
310 ratio.w = log_PP.w - ojph_min(log_cb.w, log_PP.w);
311 ratio.h = log_PP.h - ojph_min(log_cb.h, log_PP.h);
312 max_num_levels = ojph_max(ratio.w, ratio.h);
313 ui32 val = 1u << (max_num_levels << 1);
314 tag_tree_size = (int)((val * 4 + 2) / 3);
316 level_index[0] = 0;
317 for (ui32 i = 1; i <= max_num_levels; ++i, val >>= 2)
318 level_index[i] = level_index[i - 1] + val;
319 cur_precinct_loc = point(0, 0);
320
321 //allocate lines
322 if (skipped_res_for_recon == false)
323 {
324 this->reversible = cdp->is_reversible();
325 this->num_lines = this->reversible ? 4 : 6;
326 lines = allocator->post_alloc_obj<line_buf>(num_lines);
327
328 ui32 width = res_rect.siz.w + 1;
329 for (ui32 i = 0; i < num_lines; ++i)
330 lines[i].wrap(allocator->post_alloc_data<si32>(width, 1), width, 1);
331 cur_line = 0;
332 vert_even = (res_rect.org.y & 1) == 0;
333 horz_even = (res_rect.org.x & 1) == 0;
334 }
335 }
336
339 {
340 if (res_num == 0)
341 {
342 assert(num_bands == 1 && child_res == NULL);
343 bands[0].exchange_buf(lines + 0);//line at location 0
344 bands[0].push_line();
345 return;
346 }
347
348 ui32 width = res_rect.siz.w;
349 if (width == 0)
350 return;
351 if (reversible)
352 {
353 //vertical transform
354 assert(num_lines >= 4);
355 if (vert_even)
356 {
358 cur_line > 1 ? lines + 2 : lines,
359 lines + 1, width);
361 cur_line > 2 ? lines + 3 : lines + 1,
362 lines + 2, width);
363
364 // push to horizontal transform lines[2](L) and lines[1] (H)
365 if (cur_line >= 1)
366 {
368 bands[3].get_line(), width, horz_even);
369 bands[2].push_line();
370 bands[3].push_line();
371 }
372 if (cur_line >= 2)
373 {
375 bands[1].get_line(), width, horz_even);
376 bands[1].push_line();
378 }
379 }
380
381 if (cur_line >= res_rect.siz.h - 1)
382 { //finished, so we need to process any lines left
383 if (cur_line)
384 {
385 if (vert_even)
386 {
388 lines, width);
389 //push lines[0] to L
391 bands[1].get_line(), width, horz_even);
392 bands[1].push_line();
394 }
395 else
396 {
398 lines, width);
400 cur_line > 1 ? lines + 2 : lines,
401 lines + 1, width);
402
403 // push to horizontal transform lines[1](L) and line[0] (H)
404 //line[0] to H
406 bands[3].get_line(), width, horz_even);
407 bands[2].push_line();
408 bands[3].push_line();
409 //line[1] to L
411 bands[1].get_line(), width, horz_even);
412 bands[1].push_line();
414 }
415 }
416 else
417 { //only one line
418 if (vert_even)
419 {
420 //push to L
422 bands[1].get_line(), width, horz_even);
423 bands[1].push_line();
425 }
426 else
427 {
428 si32* sp = lines[0].i32;
429 for (ui32 i = width; i > 0; --i)
430 *sp++ <<= 1;
431 //push to H
433 bands[3].get_line(), width, horz_even);
434 bands[2].push_line();
435 bands[3].push_line();
436 }
437 }
438 }
439
440 rotate_buffers(lines, lines + 1, lines + 2, lines + 3);
441
442 ++cur_line;
444 }
445 else
446 {
447 //vertical transform
448 assert(num_lines >= 6);
449 if (vert_even)
450 {
452 cur_line > 1 ? lines + 2 : lines,
453 lines + 1, 0, width);
455 cur_line > 2 ? lines + 3 : lines + 1,
456 lines + 2, 1, width);
458 cur_line > 3 ? lines + 4 : lines + 2,
459 lines + 3, 2, width);
461 cur_line > 4 ? lines + 5 : lines + 3,
462 lines + 4, 3, width);
463
464 // push to horizontal transform lines[4](L) and lines[3] (H)
465 if (cur_line >= 3)
466 {
468 false, width);
470 bands[3].get_line(), width, horz_even);
471 bands[2].push_line();
472 bands[3].push_line();
473 }
474 if (cur_line >= 4)
475 {
477 true, width);
479 bands[1].get_line(), width, horz_even);
480 bands[1].push_line();
482 }
483 }
484
485 if (cur_line >= res_rect.siz.h - 1)
486 { //finished, so we need to process any left line
487 if (cur_line)
488 {
489 if (vert_even)
490 {
492 lines, 1, width);
494 cur_line > 1 ? lines + 2 : lines,
495 lines + 1, 2, width);
497 cur_line > 2 ? lines + 3 : lines + 1,
498 lines + 2, 3, width);
500 lines, 3, width);
501 //push lines[2] to L, lines[1] to H, and lines[0] to L
502 if (cur_line >= 2)
503 {
505 true, width);
508 width, horz_even);
509 bands[1].push_line();
511 }
513 false, width);
515 bands[3].get_line(), width, horz_even);
516 bands[2].push_line();
517 bands[3].push_line();
519 true, width);
521 bands[1].get_line(), width, horz_even);
522 bands[1].push_line();
524 }
525 else
526 {
528 lines, 0, width);
530 cur_line > 1 ? lines + 2 : lines,
531 lines + 1, 1, width);
533 cur_line > 2 ? lines + 3 : lines + 1,
534 lines + 2, 2, width);
536 cur_line > 3 ? lines + 4 : lines + 2,
537 lines + 3, 3, width);
538
540 lines, 2, width);
542 cur_line > 1 ? lines + 2 : lines,
543 lines + 1, 3, width);
544
545 //push lines[3] L, lines[2] H, lines[1] L, and lines[0] H
546 if (cur_line >= 3)
547 {
549 true, width);
552 width, horz_even);
553 bands[1].push_line();
555 }
557 false, width);
559 bands[3].get_line(), width, horz_even);
560 bands[2].push_line();
561 bands[3].push_line();
563 true, width);
565 bands[1].get_line(), width, horz_even);
566 bands[1].push_line();
569 false, width);
571 bands[3].get_line(), width, horz_even);
572 bands[2].push_line();
573 bands[3].push_line();
574 }
575 }
576 else
577 { //only one line
578 if (vert_even)
579 {
580 //push to L
582 bands[1].get_line(), width, horz_even);
583 bands[1].push_line();
585 }
586 else
587 {
588 //push to H
590 bands[3].get_line(), width, horz_even);
591 bands[2].push_line();
592 bands[3].push_line();
593 }
594 }
595 }
596
597 rotate_buffers(lines, lines + 1, lines + 2, lines + 3, lines + 4,
598 lines + 5);
599
600 ++cur_line;
602 }
603 }
604
607 {
608 if (res_num == 0)
609 {
610 assert(num_bands == 1 && child_res == NULL);
611 return bands[0].pull_line();
612 }
613
614 if (skipped_res_for_recon == true)
615 return child_res->pull_line();
616
617 ui32 width = res_rect.siz.w;
618 if (width == 0)
619 return lines;
620 if (reversible)
621 {
622 assert(num_lines >= 4);
623 if (res_rect.siz.h > 1)
624 {
625 do
626 {
627 //horizontal transform
628 if (cur_line < res_rect.siz.h)
629 {
630 if (vert_even)
633 width, horz_even);
634 else
636 bands[2].pull_line(), bands[3].pull_line(),
637 width, horz_even);
638 }
639
640 //vertical transform
641 if (!vert_even)
642 {
644 cur_line > 1 ? lines + 2 : lines,
645 cur_line < res_rect.siz.h ? lines : lines + 2,
646 lines + 1, width);
648 cur_line > 2 ? lines + 3 : lines + 1,
649 cur_line < res_rect.siz.h + 1 ? lines + 1 : lines + 3,
650 lines + 2, width);
651 }
652
654 rotate_buffers(lines, lines + 1, lines + 2, lines + 3);
655 ++cur_line;
656 } while (cur_line < 3);
657 memcpy(lines[0].i32, lines[3].i32, res_rect.siz.w * sizeof(si32));
658 return lines;
659 }
660 else if (res_rect.siz.h == 1)
661 {
662 if (vert_even)
663 {
665 bands[1].pull_line(), width, horz_even);
666 }
667 else
668 {
670 bands[3].pull_line(), width, horz_even);
671 if (width)
672 {
673 si32* sp = lines[0].i32;
674 for (ui32 i = width; i > 0; --i)
675 *sp++ >>= 1;
676 }
677 }
678 return lines;
679 }
680 else
681 return lines;
682 }
683 else
684 {
685 assert(num_lines >= 6);
686 if (res_rect.siz.h > 1)
687 {
688 do
689 {
690 //horizontal transform
691 if (cur_line < res_rect.siz.h)
692 {
693 if (vert_even)
694 {
697 width, horz_even);
698 irrev_vert_wvlt_K(lines, lines, false, width);
699 }
700 else
701 {
703 bands[2].pull_line(), bands[3].pull_line(),
704 width, horz_even);
705 irrev_vert_wvlt_K(lines, lines, true, width);
706 }
707 }
708
709 //vertical transform
710 if (!vert_even)
711 {
713 cur_line > 1 ? lines + 2 : lines,
714 cur_line < res_rect.siz.h ? lines : lines + 2,
715 lines + 1, 7, width);
717 cur_line > 2 ? lines + 3 : lines + 1,
718 cur_line < res_rect.siz.h + 1 ? lines + 1 : lines + 3,
719 lines + 2, 6, width);
721 cur_line > 3 ? lines + 4 : lines + 2,
722 cur_line < res_rect.siz.h + 2 ? lines + 2 : lines + 4,
723 lines + 3, 5, width);
725 cur_line > 4 ? lines + 5 : lines + 3,
726 cur_line < res_rect.siz.h + 3 ? lines + 3 : lines + 5,
727 lines + 4, 4, width);
728 }
729
731 rotate_buffers(lines, lines + 1, lines + 2, lines + 3, lines + 4,
732 lines + 5);
733 ++cur_line;
734 } while (cur_line < 5);
735 memcpy(lines[0].f32, lines[5].f32, res_rect.siz.w * sizeof(float));
736 return lines;
737 }
738 else if (res_rect.siz.h == 1)
739 {
740 if (vert_even)
741 {
743 bands[1].pull_line(), width, horz_even);
744 }
745 else
746 {
748 bands[3].pull_line(), width, horz_even);
749 if (width)
750 {
751 float* sp = lines[0].f32;
752 for (ui32 i = width; i > 0; --i)
753 *sp++ *= 0.5f;
754 }
755 }
756 return lines;
757 }
758 else
759 return lines;
760 }
761 }
762
765 {
766 ui32 lower_resolutions_bytes = 0;
767 if (res_num != 0)
768 lower_resolutions_bytes = child_res->prepare_precinct();
769
770 this->num_bytes = 0;
771 si32 repeat = (si32)num_precincts.area();
772 for (si32 i = 0; i < repeat; ++i)
775 return this->num_bytes + lower_resolutions_bytes;
776 }
777
780 {
781 precinct* p = precincts;
782 for (si32 i = 0; i < (si32)num_precincts.area(); ++i)
783 p[i].write(file);
784 }
785
788 {
790 if (idx < num_precincts.area())
791 {
792 top_left = precincts[idx].img_point;
793 return true;
794 }
795 return false;
796 }
797
800 {
802 assert(idx < num_precincts.area());
803 precincts[idx].write(file);
804
806 {
809 }
810 }
811
814 {
815 precinct* p = precincts;
817 for (ui32 i = idx; i < num_precincts.area(); ++i)
818 {
819 if (data_left == 0)
820 break;
821 p[i].parse(tag_tree_size, level_index, elastic, data_left, file,
824 {
827 }
828 }
829 }
830
833 {
835 assert(idx < num_precincts.area());
836
837 if (data_left == 0)
838 return;
839 precinct* p = precincts + idx;
840 p->parse(tag_tree_size, level_index, elastic, data_left, file,
843 {
846 }
847 }
848
850 ui32 resolution::get_num_bytes(ui32 resolution_num) const
851 {
852 if (this->res_num == resolution_num)
853 return get_num_bytes();
854 else {
855 if (child_res)
856 return child_res->get_num_bytes(resolution_num);
857 else
858 return 0;
859 }
860
861 }
862 }
863}
mem_elastic_allocator * get_elastic_alloc()
mem_fixed_allocator * get_allocator()
const param_cod * get_cod()
bool get_top_left_precinct(point &top_left)
void parse_one_precinct(ui32 &data_left, infile_base *file)
mem_elastic_allocator * elastic
void write_precincts(outfile_base *file)
void finalize_alloc(codestream *codestream, const rect &res_rect, const rect &recon_res_rect, ui32 comp_num, ui32 res_num, point comp_downsamp, tile_comp *parent_tile_comp, resolution *parent_res)
void parse_all_precincts(ui32 &data_left, infile_base *file)
static void pre_alloc(codestream *codestream, const rect &res_rect, const rect &recon_res_rect, ui32 res_num)
void write_one_precinct(outfile_base *file)
void exchange_buf(line_buf *l)
line_buf * get_line()
Definition: ojph_subband.h:72
void get_cb_indices(const size &num_precincts, precinct *precincts)
static void pre_alloc(codestream *codestream, const rect &band_rect, ui32 res_num)
void finalize_alloc(codestream *codestream, const rect &band_rect, resolution *res, ui32 res_num, ui32 subband_num)
line_buf * pull_line()
rect get_tile_rect()
Definition: ojph_tile.h:76
void pre_alloc_data(size_t num_ele, ui32 pre_size)
Definition: ojph_mem.h:66
void pre_alloc_obj(size_t num_ele)
Definition: ojph_mem.h:72
T * post_alloc_data(size_t num_ele, ui32 pre_size)
Definition: ojph_mem.h:89
T * post_alloc_obj(size_t num_ele)
Definition: ojph_mem.h:96
void(* irrev_horz_wvlt_fwd_tx)(line_buf *src, line_buf *ldst, line_buf *hdst, ui32 width, bool even)
void(* rev_horz_wvlt_bwd_tx)(line_buf *dst, line_buf *lsrc, line_buf *hsrc, ui32 width, bool even)
static void rotate_buffers(line_buf *line1, line_buf *line2, line_buf *line3, line_buf *line4)
void(* rev_vert_wvlt_fwd_update)(const line_buf *src1, const line_buf *src2, line_buf *dst, ui32 repeat)
void(* rev_horz_wvlt_fwd_tx)(line_buf *src, line_buf *ldst, line_buf *hdst, ui32 width, bool even)
void(* irrev_vert_wvlt_step)(const line_buf *src1, const line_buf *src2, line_buf *dst, int step_num, ui32 repeat)
void(* rev_vert_wvlt_bwd_update)(const line_buf *src1, const line_buf *src2, line_buf *dst, ui32 repeat)
void(* rev_vert_wvlt_bwd_predict)(const line_buf *src1, const line_buf *src2, line_buf *dst, ui32 repeat)
void(* rev_vert_wvlt_fwd_predict)(const line_buf *src1, const line_buf *src2, line_buf *dst, ui32 repeat)
void(* irrev_horz_wvlt_bwd_tx)(line_buf *src, line_buf *ldst, line_buf *hdst, ui32 width, bool even)
void(* irrev_vert_wvlt_K)(const line_buf *src, line_buf *dst, bool L_analysis_or_H_synthesis, ui32 repeat)
uint64_t ui64
Definition: ojph_defs.h:56
int32_t si32
Definition: ojph_defs.h:55
uint32_t ui32
Definition: ojph_defs.h:54
#define ojph_max(a, b)
Definition: ojph_defs.h:73
#define ojph_div_ceil(a, b)
Definition: ojph_defs.h:70
#define ojph_min(a, b)
Definition: ojph_defs.h:76
size_t size
Definition: ojph_mem.h:152
float * f32
Definition: ojph_mem.h:156
si32 * i32
Definition: ojph_mem.h:155
size get_log_precinct_size(ui32 res_num) const
ui8 get_num_decompositions() const
bool packets_may_use_sop() const
void write(outfile_base *file)
coded_lists * coded
Definition: ojph_precinct.h:75
void parse(int tag_tree_size, ui32 *lev_idx, mem_elastic_allocator *elastic, ui32 &data_left, infile_base *file, bool skipped)
size siz
Definition: ojph_base.h:67
point org
Definition: ojph_base.h:66
ui64 area() const
Definition: ojph_base.h:53
ui32 w
Definition: ojph_base.h:50
ui32 h
Definition: ojph_base.h:51