/src/libjpeg-turbo.dev/src/jdmainct.h
Line | Count | Source |
1 | | /* |
2 | | * jdmainct.h |
3 | | * |
4 | | * This file was part of the Independent JPEG Group's software: |
5 | | * Copyright (C) 1994-1996, Thomas G. Lane. |
6 | | * libjpeg-turbo Modifications: |
7 | | * Copyright (C) 2022, D. R. Commander. |
8 | | * For conditions of distribution and use, see the accompanying README.ijg |
9 | | * file. |
10 | | */ |
11 | | |
12 | | #define JPEG_INTERNALS |
13 | | #include "jpeglib.h" |
14 | | #include "jpegapicomp.h" |
15 | | #include "jsamplecomp.h" |
16 | | |
17 | | |
18 | | #if BITS_IN_JSAMPLE != 16 || defined(D_LOSSLESS_SUPPORTED) |
19 | | |
20 | | /* Private buffer controller object */ |
21 | | |
22 | | typedef struct { |
23 | | struct jpeg_d_main_controller pub; /* public fields */ |
24 | | |
25 | | /* Pointer to allocated workspace (M or M+2 row groups). */ |
26 | | _JSAMPARRAY buffer[MAX_COMPONENTS]; |
27 | | |
28 | | boolean buffer_full; /* Have we gotten an iMCU row from decoder? */ |
29 | | JDIMENSION rowgroup_ctr; /* counts row groups output to postprocessor */ |
30 | | |
31 | | /* Remaining fields are only used in the context case. */ |
32 | | |
33 | | /* These are the master pointers to the funny-order pointer lists. */ |
34 | | _JSAMPIMAGE xbuffer[2]; /* pointers to weird pointer lists */ |
35 | | |
36 | | int whichptr; /* indicates which pointer set is now in use */ |
37 | | int context_state; /* process_data state machine status */ |
38 | | JDIMENSION rowgroups_avail; /* row groups available to postprocessor */ |
39 | | JDIMENSION iMCU_row_ctr; /* counts iMCU rows to detect image top/bot */ |
40 | | } my_main_controller; |
41 | | |
42 | | typedef my_main_controller *my_main_ptr; |
43 | | |
44 | | |
45 | | /* context_state values: */ |
46 | 259k | #define CTX_PREPARE_FOR_IMCU 0 /* need to prepare for MCU row */ |
47 | 688k | #define CTX_PROCESS_IMCU 1 /* feeding iMCU to postprocessor */ |
48 | 258k | #define CTX_POSTPONED_ROW 2 /* feeding postponed row group */ |
49 | | |
50 | | |
51 | | LOCAL(void) |
52 | | set_wraparound_pointers(j_decompress_ptr cinfo) |
53 | | /* Set up the "wraparound" pointers at top and bottom of the pointer lists. |
54 | | * This changes the pointer list state from top-of-image to the normal state. |
55 | | */ |
56 | 593 | { |
57 | 593 | my_main_ptr main_ptr = (my_main_ptr)cinfo->main; |
58 | 593 | int ci, i, rgroup; |
59 | 593 | int M = cinfo->_min_DCT_scaled_size; |
60 | 593 | jpeg_component_info *compptr; |
61 | 593 | _JSAMPARRAY xbuf0, xbuf1; |
62 | | |
63 | 2.38k | for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; |
64 | 1.79k | ci++, compptr++) { |
65 | 1.79k | rgroup = (compptr->v_samp_factor * compptr->_DCT_scaled_size) / |
66 | 1.79k | cinfo->_min_DCT_scaled_size; /* height of a row group of component */ |
67 | 1.79k | xbuf0 = main_ptr->xbuffer[0][ci]; |
68 | 1.79k | xbuf1 = main_ptr->xbuffer[1][ci]; |
69 | 5.40k | for (i = 0; i < rgroup; i++) { |
70 | 3.61k | xbuf0[i - rgroup] = xbuf0[rgroup * (M + 1) + i]; |
71 | 3.61k | xbuf1[i - rgroup] = xbuf1[rgroup * (M + 1) + i]; |
72 | 3.61k | xbuf0[rgroup * (M + 2) + i] = xbuf0[i]; |
73 | 3.61k | xbuf1[rgroup * (M + 2) + i] = xbuf1[i]; |
74 | 3.61k | } |
75 | 1.79k | } |
76 | 593 | } jdapistd-8.c:set_wraparound_pointers Line | Count | Source | 56 | 6 | { | 57 | 6 | my_main_ptr main_ptr = (my_main_ptr)cinfo->main; | 58 | 6 | int ci, i, rgroup; | 59 | 6 | int M = cinfo->_min_DCT_scaled_size; | 60 | 6 | jpeg_component_info *compptr; | 61 | 6 | _JSAMPARRAY xbuf0, xbuf1; | 62 | | | 63 | 24 | for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; | 64 | 18 | ci++, compptr++) { | 65 | 18 | rgroup = (compptr->v_samp_factor * compptr->_DCT_scaled_size) / | 66 | 18 | cinfo->_min_DCT_scaled_size; /* height of a row group of component */ | 67 | 18 | xbuf0 = main_ptr->xbuffer[0][ci]; | 68 | 18 | xbuf1 = main_ptr->xbuffer[1][ci]; | 69 | 42 | for (i = 0; i < rgroup; i++) { | 70 | 24 | xbuf0[i - rgroup] = xbuf0[rgroup * (M + 1) + i]; | 71 | 24 | xbuf1[i - rgroup] = xbuf1[rgroup * (M + 1) + i]; | 72 | 24 | xbuf0[rgroup * (M + 2) + i] = xbuf0[i]; | 73 | 24 | xbuf1[rgroup * (M + 2) + i] = xbuf1[i]; | 74 | 24 | } | 75 | 18 | } | 76 | 6 | } |
jdapistd-12.c:set_wraparound_pointers Line | Count | Source | 56 | 11 | { | 57 | 11 | my_main_ptr main_ptr = (my_main_ptr)cinfo->main; | 58 | 11 | int ci, i, rgroup; | 59 | 11 | int M = cinfo->_min_DCT_scaled_size; | 60 | 11 | jpeg_component_info *compptr; | 61 | 11 | _JSAMPARRAY xbuf0, xbuf1; | 62 | | | 63 | 44 | for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; | 64 | 33 | ci++, compptr++) { | 65 | 33 | rgroup = (compptr->v_samp_factor * compptr->_DCT_scaled_size) / | 66 | 33 | cinfo->_min_DCT_scaled_size; /* height of a row group of component */ | 67 | 33 | xbuf0 = main_ptr->xbuffer[0][ci]; | 68 | 33 | xbuf1 = main_ptr->xbuffer[1][ci]; | 69 | 77 | for (i = 0; i < rgroup; i++) { | 70 | 44 | xbuf0[i - rgroup] = xbuf0[rgroup * (M + 1) + i]; | 71 | 44 | xbuf1[i - rgroup] = xbuf1[rgroup * (M + 1) + i]; | 72 | 44 | xbuf0[rgroup * (M + 2) + i] = xbuf0[i]; | 73 | 44 | xbuf1[rgroup * (M + 2) + i] = xbuf1[i]; | 74 | 44 | } | 75 | 33 | } | 76 | 11 | } |
jdmainct-8.c:set_wraparound_pointers Line | Count | Source | 56 | 348 | { | 57 | 348 | my_main_ptr main_ptr = (my_main_ptr)cinfo->main; | 58 | 348 | int ci, i, rgroup; | 59 | 348 | int M = cinfo->_min_DCT_scaled_size; | 60 | 348 | jpeg_component_info *compptr; | 61 | 348 | _JSAMPARRAY xbuf0, xbuf1; | 62 | | | 63 | 1.39k | for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; | 64 | 1.04k | ci++, compptr++) { | 65 | 1.04k | rgroup = (compptr->v_samp_factor * compptr->_DCT_scaled_size) / | 66 | 1.04k | cinfo->_min_DCT_scaled_size; /* height of a row group of component */ | 67 | 1.04k | xbuf0 = main_ptr->xbuffer[0][ci]; | 68 | 1.04k | xbuf1 = main_ptr->xbuffer[1][ci]; | 69 | 3.35k | for (i = 0; i < rgroup; i++) { | 70 | 2.31k | xbuf0[i - rgroup] = xbuf0[rgroup * (M + 1) + i]; | 71 | 2.31k | xbuf1[i - rgroup] = xbuf1[rgroup * (M + 1) + i]; | 72 | 2.31k | xbuf0[rgroup * (M + 2) + i] = xbuf0[i]; | 73 | 2.31k | xbuf1[rgroup * (M + 2) + i] = xbuf1[i]; | 74 | 2.31k | } | 75 | 1.04k | } | 76 | 348 | } |
jdmainct-12.c:set_wraparound_pointers Line | Count | Source | 56 | 228 | { | 57 | 228 | my_main_ptr main_ptr = (my_main_ptr)cinfo->main; | 58 | 228 | int ci, i, rgroup; | 59 | 228 | int M = cinfo->_min_DCT_scaled_size; | 60 | 228 | jpeg_component_info *compptr; | 61 | 228 | _JSAMPARRAY xbuf0, xbuf1; | 62 | | | 63 | 919 | for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; | 64 | 691 | ci++, compptr++) { | 65 | 691 | rgroup = (compptr->v_samp_factor * compptr->_DCT_scaled_size) / | 66 | 691 | cinfo->_min_DCT_scaled_size; /* height of a row group of component */ | 67 | 691 | xbuf0 = main_ptr->xbuffer[0][ci]; | 68 | 691 | xbuf1 = main_ptr->xbuffer[1][ci]; | 69 | 1.92k | for (i = 0; i < rgroup; i++) { | 70 | 1.23k | xbuf0[i - rgroup] = xbuf0[rgroup * (M + 1) + i]; | 71 | 1.23k | xbuf1[i - rgroup] = xbuf1[rgroup * (M + 1) + i]; | 72 | 1.23k | xbuf0[rgroup * (M + 2) + i] = xbuf0[i]; | 73 | 1.23k | xbuf1[rgroup * (M + 2) + i] = xbuf1[i]; | 74 | 1.23k | } | 75 | 691 | } | 76 | 228 | } |
Unexecuted instantiation: jdmainct-16.c:set_wraparound_pointers |
77 | | |
78 | | #endif /* BITS_IN_JSAMPLE != 16 || defined(D_LOSSLESS_SUPPORTED) */ |