Coverage Report

Created: 2024-05-15 07:07

/src/libjpeg-turbo.main/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
 * For conditions of distribution and use, see the accompanying README.ijg
7
 * file.
8
 */
9
10
#define JPEG_INTERNALS
11
#include "jpeglib.h"
12
#include "jpegcomp.h"
13
14
15
/* Private buffer controller object */
16
17
typedef struct {
18
  struct jpeg_d_main_controller pub; /* public fields */
19
20
  /* Pointer to allocated workspace (M or M+2 row groups). */
21
  JSAMPARRAY buffer[MAX_COMPONENTS];
22
23
  boolean buffer_full;          /* Have we gotten an iMCU row from decoder? */
24
  JDIMENSION rowgroup_ctr;      /* counts row groups output to postprocessor */
25
26
  /* Remaining fields are only used in the context case. */
27
28
  /* These are the master pointers to the funny-order pointer lists. */
29
  JSAMPIMAGE xbuffer[2];        /* pointers to weird pointer lists */
30
31
  int whichptr;                 /* indicates which pointer set is now in use */
32
  int context_state;            /* process_data state machine status */
33
  JDIMENSION rowgroups_avail;   /* row groups available to postprocessor */
34
  JDIMENSION iMCU_row_ctr;      /* counts iMCU rows to detect image top/bot */
35
} my_main_controller;
36
37
typedef my_main_controller *my_main_ptr;
38
39
40
/* context_state values: */
41
1.10M
#define CTX_PREPARE_FOR_IMCU    0       /* need to prepare for MCU row */
42
2.66M
#define CTX_PROCESS_IMCU        1       /* feeding iMCU to postprocessor */
43
1.07M
#define CTX_POSTPONED_ROW       2       /* feeding postponed row group */
44
45
46
LOCAL(void)
47
set_wraparound_pointers(j_decompress_ptr cinfo)
48
/* Set up the "wraparound" pointers at top and bottom of the pointer lists.
49
 * This changes the pointer list state from top-of-image to the normal state.
50
 */
51
19.2k
{
52
19.2k
  my_main_ptr main_ptr = (my_main_ptr)cinfo->main;
53
19.2k
  int ci, i, rgroup;
54
19.2k
  int M = cinfo->_min_DCT_scaled_size;
55
19.2k
  jpeg_component_info *compptr;
56
19.2k
  JSAMPARRAY xbuf0, xbuf1;
57
58
78.5k
  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
59
59.2k
       ci++, compptr++) {
60
59.2k
    rgroup = (compptr->v_samp_factor * compptr->_DCT_scaled_size) /
61
59.2k
      cinfo->_min_DCT_scaled_size; /* height of a row group of component */
62
59.2k
    xbuf0 = main_ptr->xbuffer[0][ci];
63
59.2k
    xbuf1 = main_ptr->xbuffer[1][ci];
64
189k
    for (i = 0; i < rgroup; i++) {
65
129k
      xbuf0[i - rgroup] = xbuf0[rgroup * (M + 1) + i];
66
129k
      xbuf1[i - rgroup] = xbuf1[rgroup * (M + 1) + i];
67
129k
      xbuf0[rgroup * (M + 2) + i] = xbuf0[i];
68
129k
      xbuf1[rgroup * (M + 2) + i] = xbuf1[i];
69
129k
    }
70
59.2k
  }
71
19.2k
}
Unexecuted instantiation: jdapistd.c:set_wraparound_pointers
jdmainct.c:set_wraparound_pointers
Line
Count
Source
51
19.2k
{
52
19.2k
  my_main_ptr main_ptr = (my_main_ptr)cinfo->main;
53
19.2k
  int ci, i, rgroup;
54
19.2k
  int M = cinfo->_min_DCT_scaled_size;
55
19.2k
  jpeg_component_info *compptr;
56
19.2k
  JSAMPARRAY xbuf0, xbuf1;
57
58
78.5k
  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
59
59.2k
       ci++, compptr++) {
60
59.2k
    rgroup = (compptr->v_samp_factor * compptr->_DCT_scaled_size) /
61
59.2k
      cinfo->_min_DCT_scaled_size; /* height of a row group of component */
62
59.2k
    xbuf0 = main_ptr->xbuffer[0][ci];
63
59.2k
    xbuf1 = main_ptr->xbuffer[1][ci];
64
189k
    for (i = 0; i < rgroup; i++) {
65
129k
      xbuf0[i - rgroup] = xbuf0[rgroup * (M + 1) + i];
66
129k
      xbuf1[i - rgroup] = xbuf1[rgroup * (M + 1) + i];
67
129k
      xbuf0[rgroup * (M + 2) + i] = xbuf0[i];
68
129k
      xbuf1[rgroup * (M + 2) + i] = xbuf1[i];
69
129k
    }
70
59.2k
  }
71
19.2k
}