Coverage Report

Created: 2026-11-12 07:19

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/dcmtk/dcmjpeg/libijg8/jdlossls.c
Line
Count
Source
1
/*
2
 * jdlossls.c
3
 *
4
 * Copyright (C) 1998, Thomas G. Lane.
5
 * This file is part of the Independent JPEG Group's software.
6
 * For conditions of distribution and use, see the accompanying README file.
7
 *
8
 * This file contains the control logic for the lossless JPEG decompressor.
9
 */
10
11
#define JPEG_INTERNALS
12
#include "jinclude8.h"
13
#include "jpeglib8.h"
14
#include "jlossls8.h"
15
16
17
#ifdef D_LOSSLESS_SUPPORTED
18
19
/*
20
 * Compute output image dimensions and related values.
21
 */
22
23
METHODDEF(void)
24
calc_output_dimensions (j_decompress_ptr cinfo)
25
0
{
26
  /* Hardwire it to "no scaling" */
27
0
  cinfo->output_width = cinfo->image_width;
28
0
  cinfo->output_height = cinfo->image_height;
29
  /* jdinput.c has already initialized codec_data_unit to 1,
30
   * and has computed unscaled downsampled_width and downsampled_height.
31
   */
32
0
}
33
34
35
/*
36
 * Initialize for an input processing pass.
37
 */
38
39
METHODDEF(void)
40
start_input_pass (j_decompress_ptr cinfo)
41
0
{
42
0
  j_lossless_d_ptr losslsd = (j_lossless_d_ptr) cinfo->codec;
43
44
0
  (*losslsd->entropy_start_pass) (cinfo);
45
0
  (*losslsd->predict_start_pass) (cinfo);
46
0
  (*losslsd->scaler_start_pass) (cinfo);
47
0
  (*losslsd->diff_start_input_pass) (cinfo);
48
0
}
49
50
51
/*
52
 * Initialize the lossless decompression codec.
53
 * This is called only once, during master selection.
54
 */
55
56
GLOBAL(void) 
57
jinit_lossless_d_codec(j_decompress_ptr cinfo)
58
0
{
59
0
  j_lossless_d_ptr losslsd;
60
0
  boolean use_c_buffer;
61
62
  /* Create subobject in permanent pool */
63
0
  losslsd = (j_lossless_d_ptr)
64
0
    (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT,
65
0
        SIZEOF(jpeg_lossless_d_codec));
66
0
  cinfo->codec = (struct jpeg_d_codec *) losslsd;
67
68
  /* Initialize sub-modules */
69
  /* Entropy decoding: either Huffman or arithmetic coding. */
70
0
  if (cinfo->arith_code) {
71
#ifdef WITH_ARITHMETIC_PATCH
72
    jinit_arith_decoder(cinfo);
73
#else
74
0
    ERREXIT(cinfo, JERR_ARITH_NOTIMPL);
75
0
#endif
76
0
  } else {
77
0
    jinit_lhuff_decoder(cinfo);
78
0
  }
79
80
  /* Undifferencer */
81
0
  jinit_undifferencer(cinfo);
82
83
  /* Scaler */
84
0
  jinit_d_scaler(cinfo);
85
86
0
  use_c_buffer = cinfo->inputctl->has_multiple_scans || cinfo->buffered_image;
87
0
  jinit_d_diff_controller(cinfo, use_c_buffer);
88
89
  /* Initialize method pointers.
90
   *
91
   * Note: consume_data, start_output_pass and decompress_data are
92
   * assigned in jddiffct.c.
93
   */
94
0
  losslsd->pub.calc_output_dimensions = calc_output_dimensions;
95
0
  losslsd->pub.start_input_pass = start_input_pass;
96
0
}
97
98
#endif /* D_LOSSLESS_SUPPORTED */