~ubuntu-branches/ubuntu/saucy/libjpeg-turbo/saucy-security

« back to all changes in this revision

Viewing changes to jdinput.c

  • Committer: Package Import Robot
  • Author(s): Fathi Boudra
  • Date: 2013-07-28 16:52:51 UTC
  • mfrom: (1.1.3) (9.1.1 saucy-proposed)
  • Revision ID: package-import@ubuntu.com-20130728165251-7vg6wszhm941kdej
Tags: 1.3.0-0ubuntu1
* New upstream release.
  - drop debian/patches/branch-updates.diff
  - refresh tjunittest.patch (now renamed to install-tjunittest.patch)
* Update debian/control:
  - add myself to Uploaders.
* Update debian/copyright:
  - add RSA Data Security copyright (md5).
* Update debian/libturbojpeg.install:
  - install libturbojpeg.so.0* (needed by tjunittest and tjbench).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
2
 * jdinput.c
3
3
 *
 
4
 * This file was part of the Independent JPEG Group's software:
4
5
 * Copyright (C) 1991-1997, Thomas G. Lane.
5
 
 * Modified 2002-2009 by Guido Vollbeding.
 
6
 * Modifications:
6
7
 * Copyright (C) 2010, D. R. Commander.
7
 
 * This file is part of the Independent JPEG Group's software.
8
8
 * For conditions of distribution and use, see the accompanying README file.
9
9
 *
10
10
 * This file contains input control logic for the JPEG decompressor.
38
38
 * Routines to calculate various quantities related to the size of the image.
39
39
 */
40
40
 
41
 
 
42
 
#if JPEG_LIB_VERSION >= 80
43
 
/*
44
 
 * Compute output image dimensions and related values.
45
 
 * NOTE: this is exported for possible use by application.
46
 
 * Hence it mustn't do anything that can't be done twice.
47
 
 */
48
 
 
49
 
GLOBAL(void)
50
 
jpeg_core_output_dimensions (j_decompress_ptr cinfo)
51
 
/* Do computations that are needed before master selection phase.
52
 
 * This function is used for transcoding and full decompression.
53
 
 */
54
 
{
55
 
#ifdef IDCT_SCALING_SUPPORTED
56
 
  int ci;
57
 
  jpeg_component_info *compptr;
58
 
 
59
 
  /* Compute actual output image dimensions and DCT scaling choices. */
60
 
  if (cinfo->scale_num * cinfo->block_size <= cinfo->scale_denom) {
61
 
    /* Provide 1/block_size scaling */
62
 
    cinfo->output_width = (JDIMENSION)
63
 
      jdiv_round_up((long) cinfo->image_width, (long) cinfo->block_size);
64
 
    cinfo->output_height = (JDIMENSION)
65
 
      jdiv_round_up((long) cinfo->image_height, (long) cinfo->block_size);
66
 
    cinfo->min_DCT_h_scaled_size = 1;
67
 
    cinfo->min_DCT_v_scaled_size = 1;
68
 
  } else if (cinfo->scale_num * cinfo->block_size <= cinfo->scale_denom * 2) {
69
 
    /* Provide 2/block_size scaling */
70
 
    cinfo->output_width = (JDIMENSION)
71
 
      jdiv_round_up((long) cinfo->image_width * 2L, (long) cinfo->block_size);
72
 
    cinfo->output_height = (JDIMENSION)
73
 
      jdiv_round_up((long) cinfo->image_height * 2L, (long) cinfo->block_size);
74
 
    cinfo->min_DCT_h_scaled_size = 2;
75
 
    cinfo->min_DCT_v_scaled_size = 2;
76
 
  } else if (cinfo->scale_num * cinfo->block_size <= cinfo->scale_denom * 4) {
77
 
    /* Provide 4/block_size scaling */
78
 
    cinfo->output_width = (JDIMENSION)
79
 
      jdiv_round_up((long) cinfo->image_width * 4L, (long) cinfo->block_size);
80
 
    cinfo->output_height = (JDIMENSION)
81
 
      jdiv_round_up((long) cinfo->image_height * 4L, (long) cinfo->block_size);
82
 
    cinfo->min_DCT_h_scaled_size = 4;
83
 
    cinfo->min_DCT_v_scaled_size = 4;
84
 
  } else if (cinfo->scale_num * cinfo->block_size <= cinfo->scale_denom * 8) {
85
 
    /* Provide 8/block_size scaling */
86
 
    cinfo->output_width = (JDIMENSION)
87
 
      jdiv_round_up((long) cinfo->image_width * 8L, (long) cinfo->block_size);
88
 
    cinfo->output_height = (JDIMENSION)
89
 
      jdiv_round_up((long) cinfo->image_height * 8L, (long) cinfo->block_size);
90
 
    cinfo->min_DCT_h_scaled_size = 8;
91
 
    cinfo->min_DCT_v_scaled_size = 8;
92
 
  }
93
 
  /* Recompute dimensions of components */
94
 
  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
95
 
       ci++, compptr++) {
96
 
    compptr->DCT_h_scaled_size = cinfo->min_DCT_h_scaled_size;
97
 
    compptr->DCT_v_scaled_size = cinfo->min_DCT_v_scaled_size;
98
 
  }
99
 
 
100
 
#else /* !IDCT_SCALING_SUPPORTED */
101
 
 
102
 
  /* Hardwire it to "no scaling" */
103
 
  cinfo->output_width = cinfo->image_width;
104
 
  cinfo->output_height = cinfo->image_height;
105
 
  /* jdinput.c has already initialized DCT_scaled_size,
106
 
   * and has computed unscaled downsampled_width and downsampled_height.
107
 
   */
108
 
 
109
 
#endif /* IDCT_SCALING_SUPPORTED */
110
 
}
111
 
#endif
112
 
 
113
 
 
114
41
LOCAL(void)
115
42
initial_setup (j_decompress_ptr cinfo)
116
43
/* Called once, when first SOS marker is reached */