Coverage Report

Created: 2025-10-13 06:04

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libjpeg-turbo.dev/src/jdmrgext.c
Line
Count
Source
1
/*
2
 * jdmrgext.c
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) 2011, 2015, 2020, 2022-2023, 2025, D. R. Commander.
8
 * For conditions of distribution and use, see the accompanying README.ijg
9
 * file.
10
 *
11
 * This file contains code for merged upsampling/color conversion.
12
 */
13
14
15
/* This file is included by jdmerge.c */
16
17
18
/*
19
 * Upsample and color convert for the case of 2:1 horizontal and 1:1 vertical.
20
 */
21
22
INLINE
23
LOCAL(void)
24
h2v1_merged_upsample(j_decompress_ptr cinfo, _JSAMPIMAGE input_buf,
25
                     JDIMENSION in_row_group_ctr, _JSAMPARRAY output_buf)
26
0
{
27
0
  my_merged_upsample_ptr upsample = (my_merged_upsample_ptr)cinfo->upsample;
28
0
  register int y, cred, cgreen, cblue;
29
0
  int cb, cr;
30
0
  register _JSAMPROW outptr;
31
0
  _JSAMPROW inptr0, inptr1, inptr2;
32
0
  JDIMENSION col;
33
  /* copy these pointers into registers if possible */
34
0
  register _JSAMPLE *range_limit = (_JSAMPLE *)cinfo->sample_range_limit;
35
0
  int *Crrtab = upsample->Cr_r_tab;
36
0
  int *Cbbtab = upsample->Cb_b_tab;
37
0
  JLONG *Crgtab = upsample->Cr_g_tab;
38
0
  JLONG *Cbgtab = upsample->Cb_g_tab;
39
0
  SHIFT_TEMPS
40
41
0
  inptr0 = input_buf[0][in_row_group_ctr];
42
0
  inptr1 = input_buf[1][in_row_group_ctr];
43
0
  inptr2 = input_buf[2][in_row_group_ctr];
44
0
  outptr = output_buf[0];
45
  /* Loop for each pair of output pixels */
46
0
  for (col = cinfo->output_width >> 1; col > 0; col--) {
47
    /* Do the chroma part of the calculation */
48
0
    cb = *inptr1++;
49
0
    cr = *inptr2++;
50
0
    cred = Crrtab[cr];
51
0
    cgreen = (int)RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], SCALEBITS);
52
0
    cblue = Cbbtab[cb];
53
    /* Fetch 2 Y values and emit 2 pixels */
54
0
    y  = *inptr0++;
55
0
    outptr[RGB_RED] =   range_limit[y + cred];
56
0
    outptr[RGB_GREEN] = range_limit[y + cgreen];
57
0
    outptr[RGB_BLUE] =  range_limit[y + cblue];
58
#ifdef RGB_ALPHA
59
0
    outptr[RGB_ALPHA] = _MAXJSAMPLE;
60
#endif
61
0
    outptr += RGB_PIXELSIZE;
62
0
    y  = *inptr0++;
63
0
    outptr[RGB_RED] =   range_limit[y + cred];
64
0
    outptr[RGB_GREEN] = range_limit[y + cgreen];
65
0
    outptr[RGB_BLUE] =  range_limit[y + cblue];
66
#ifdef RGB_ALPHA
67
0
    outptr[RGB_ALPHA] = _MAXJSAMPLE;
68
#endif
69
0
    outptr += RGB_PIXELSIZE;
70
0
  }
71
  /* If image width is odd, do the last output column separately */
72
0
  if (cinfo->output_width & 1) {
73
0
    cb = *inptr1;
74
0
    cr = *inptr2;
75
0
    cred = Crrtab[cr];
76
0
    cgreen = (int)RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], SCALEBITS);
77
0
    cblue = Cbbtab[cb];
78
0
    y  = *inptr0;
79
0
    outptr[RGB_RED] =   range_limit[y + cred];
80
0
    outptr[RGB_GREEN] = range_limit[y + cgreen];
81
0
    outptr[RGB_BLUE] =  range_limit[y + cblue];
82
#ifdef RGB_ALPHA
83
0
    outptr[RGB_ALPHA] = _MAXJSAMPLE;
84
#endif
85
0
  }
86
0
}
Unexecuted instantiation: jdmerge-8.c:extrgb_h2v1_merged_upsample
Unexecuted instantiation: jdmerge-8.c:extrgbx_h2v1_merged_upsample
Unexecuted instantiation: jdmerge-8.c:extbgr_h2v1_merged_upsample
Unexecuted instantiation: jdmerge-8.c:extbgrx_h2v1_merged_upsample
Unexecuted instantiation: jdmerge-8.c:extxbgr_h2v1_merged_upsample
Unexecuted instantiation: jdmerge-8.c:extxrgb_h2v1_merged_upsample
Unexecuted instantiation: jdmerge-8.c:h2v1_merged_upsample
Unexecuted instantiation: jdmerge-12.c:extrgb_h2v1_merged_upsample
Unexecuted instantiation: jdmerge-12.c:extrgbx_h2v1_merged_upsample
Unexecuted instantiation: jdmerge-12.c:extbgr_h2v1_merged_upsample
Unexecuted instantiation: jdmerge-12.c:extbgrx_h2v1_merged_upsample
Unexecuted instantiation: jdmerge-12.c:extxbgr_h2v1_merged_upsample
Unexecuted instantiation: jdmerge-12.c:extxrgb_h2v1_merged_upsample
Unexecuted instantiation: jdmerge-12.c:h2v1_merged_upsample
87
88
89
/*
90
 * Upsample and color convert for the case of 2:1 horizontal and 2:1 vertical.
91
 */
92
93
INLINE
94
LOCAL(void)
95
h2v2_merged_upsample(j_decompress_ptr cinfo, _JSAMPIMAGE input_buf,
96
                     JDIMENSION in_row_group_ctr, _JSAMPARRAY output_buf)
97
0
{
98
0
  my_merged_upsample_ptr upsample = (my_merged_upsample_ptr)cinfo->upsample;
99
0
  register int y, cred, cgreen, cblue;
100
0
  int cb, cr;
101
0
  register _JSAMPROW outptr0, outptr1;
102
0
  _JSAMPROW inptr00, inptr01, inptr1, inptr2;
103
0
  JDIMENSION col;
104
  /* copy these pointers into registers if possible */
105
0
  register _JSAMPLE *range_limit = (_JSAMPLE *)cinfo->sample_range_limit;
106
0
  int *Crrtab = upsample->Cr_r_tab;
107
0
  int *Cbbtab = upsample->Cb_b_tab;
108
0
  JLONG *Crgtab = upsample->Cr_g_tab;
109
0
  JLONG *Cbgtab = upsample->Cb_g_tab;
110
0
  SHIFT_TEMPS
111
112
0
  inptr00 = input_buf[0][in_row_group_ctr * 2];
113
0
  inptr01 = input_buf[0][in_row_group_ctr * 2 + 1];
114
0
  inptr1 = input_buf[1][in_row_group_ctr];
115
0
  inptr2 = input_buf[2][in_row_group_ctr];
116
0
  outptr0 = output_buf[0];
117
0
  outptr1 = output_buf[1];
118
  /* Loop for each group of output pixels */
119
0
  for (col = cinfo->output_width >> 1; col > 0; col--) {
120
    /* Do the chroma part of the calculation */
121
0
    cb = *inptr1++;
122
0
    cr = *inptr2++;
123
0
    cred = Crrtab[cr];
124
0
    cgreen = (int)RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], SCALEBITS);
125
0
    cblue = Cbbtab[cb];
126
    /* Fetch 4 Y values and emit 4 pixels */
127
0
    y  = *inptr00++;
128
0
    outptr0[RGB_RED] =   range_limit[y + cred];
129
0
    outptr0[RGB_GREEN] = range_limit[y + cgreen];
130
0
    outptr0[RGB_BLUE] =  range_limit[y + cblue];
131
#ifdef RGB_ALPHA
132
0
    outptr0[RGB_ALPHA] = _MAXJSAMPLE;
133
#endif
134
0
    outptr0 += RGB_PIXELSIZE;
135
0
    y  = *inptr00++;
136
0
    outptr0[RGB_RED] =   range_limit[y + cred];
137
0
    outptr0[RGB_GREEN] = range_limit[y + cgreen];
138
0
    outptr0[RGB_BLUE] =  range_limit[y + cblue];
139
#ifdef RGB_ALPHA
140
0
    outptr0[RGB_ALPHA] = _MAXJSAMPLE;
141
#endif
142
0
    outptr0 += RGB_PIXELSIZE;
143
0
    y  = *inptr01++;
144
0
    outptr1[RGB_RED] =   range_limit[y + cred];
145
0
    outptr1[RGB_GREEN] = range_limit[y + cgreen];
146
0
    outptr1[RGB_BLUE] =  range_limit[y + cblue];
147
#ifdef RGB_ALPHA
148
0
    outptr1[RGB_ALPHA] = _MAXJSAMPLE;
149
#endif
150
0
    outptr1 += RGB_PIXELSIZE;
151
0
    y  = *inptr01++;
152
0
    outptr1[RGB_RED] =   range_limit[y + cred];
153
0
    outptr1[RGB_GREEN] = range_limit[y + cgreen];
154
0
    outptr1[RGB_BLUE] =  range_limit[y + cblue];
155
#ifdef RGB_ALPHA
156
0
    outptr1[RGB_ALPHA] = _MAXJSAMPLE;
157
#endif
158
0
    outptr1 += RGB_PIXELSIZE;
159
0
  }
160
  /* If image width is odd, do the last output column separately */
161
0
  if (cinfo->output_width & 1) {
162
0
    cb = *inptr1;
163
0
    cr = *inptr2;
164
0
    cred = Crrtab[cr];
165
0
    cgreen = (int)RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], SCALEBITS);
166
0
    cblue = Cbbtab[cb];
167
0
    y  = *inptr00;
168
0
    outptr0[RGB_RED] =   range_limit[y + cred];
169
0
    outptr0[RGB_GREEN] = range_limit[y + cgreen];
170
0
    outptr0[RGB_BLUE] =  range_limit[y + cblue];
171
#ifdef RGB_ALPHA
172
0
    outptr0[RGB_ALPHA] = _MAXJSAMPLE;
173
#endif
174
0
    y  = *inptr01;
175
0
    outptr1[RGB_RED] =   range_limit[y + cred];
176
0
    outptr1[RGB_GREEN] = range_limit[y + cgreen];
177
0
    outptr1[RGB_BLUE] =  range_limit[y + cblue];
178
#ifdef RGB_ALPHA
179
0
    outptr1[RGB_ALPHA] = _MAXJSAMPLE;
180
#endif
181
0
  }
182
0
}
Unexecuted instantiation: jdmerge-8.c:extrgb_h2v2_merged_upsample
Unexecuted instantiation: jdmerge-8.c:extrgbx_h2v2_merged_upsample
Unexecuted instantiation: jdmerge-8.c:extbgr_h2v2_merged_upsample
Unexecuted instantiation: jdmerge-8.c:extbgrx_h2v2_merged_upsample
Unexecuted instantiation: jdmerge-8.c:extxbgr_h2v2_merged_upsample
Unexecuted instantiation: jdmerge-8.c:extxrgb_h2v2_merged_upsample
Unexecuted instantiation: jdmerge-8.c:h2v2_merged_upsample
Unexecuted instantiation: jdmerge-12.c:extrgb_h2v2_merged_upsample
Unexecuted instantiation: jdmerge-12.c:extrgbx_h2v2_merged_upsample
Unexecuted instantiation: jdmerge-12.c:extbgr_h2v2_merged_upsample
Unexecuted instantiation: jdmerge-12.c:extbgrx_h2v2_merged_upsample
Unexecuted instantiation: jdmerge-12.c:extxbgr_h2v2_merged_upsample
Unexecuted instantiation: jdmerge-12.c:extxrgb_h2v2_merged_upsample
Unexecuted instantiation: jdmerge-12.c:h2v2_merged_upsample