/*
* jidctint.c
*
* Copyright (C) 1991-1998, Thomas G. Lane.
* Modification developed 2002-2016 by Guido Vollbeding.
* This file is part of the Independent JPEG Group's software.
* For conditions of distribution and use, see the accompanying README file.
*
* This file contains a slow-but-accurate integer implementation of the
* inverse DCT (Discrete Cosine Transform). In the IJG code, this routine
* must also perform dequantization of the input coefficients.
*
* A 2-D IDCT can be done by 1-D IDCT on each column followed by 1-D IDCT
* on each row (or vice versa, but it's more convenient to emit a row at
* a time). Direct algorithms are also available, but they are much more
* complex and seem not to be any faster when reduced to code.
*
* This implementation is based on an algorithm described in
* C. Loeffler, A. Ligtenberg and G. Moschytz, "Practical Fast 1-D DCT
* Algorithms with 11 Multiplications", Proc. Int'l. Conf. on Acoustics,
* Speech, and Signal Processing 1989 (ICASSP '89), pp. 988-991.
* The primary algorithm described there uses 11 multiplies and 29 adds.
* We use their alternate method with 12 multiplies and 32 adds.
* The advantage of this method is that no data path contains more than one
* multiplication; this allows a very simple and accurate implementation in
* scaled fixed-point arithmetic, with a minimal number of shifts.
*
* We also provide IDCT routines with various output sample block sizes for
* direct resolution reduction or enlargement and for direct resolving the
* common 2x1 and 1x2 subsampling cases without additional resampling: NxN
* (N=1...16), 2NxN, and Nx2N (N=1...8) pixels for one 8x8 input DCT block.
*
* For N<8 we simply take the corresponding low-frequency coefficients of
* the 8x8 input DCT block and apply an NxN point IDCT on the sub-block
* to yield the downscaled outputs.
* This can be seen as direct low-pass downsampling from the DCT domain
* point of view rather than the usual spatial domain point of view,
* yielding significant computational savings and results at least
* as good as common bilinear (averaging) spatial downsampling.
*
* For N>8 we apply a partial NxN IDCT on the 8 input coefficients as
* lower frequencies and higher frequencies assumed to be zero.
* It turns out that the computational effort is similar to the 8x8 IDCT
* regarding the output size.
* Furthermore, the scaling and descaling is the same for all IDCT sizes.
*
* CAUTION: We rely on the FIX() macro except for the N=1,2,4,8 cases
* since there would be too many additional constants to pre-calculate.
*/
#define JPEG_INTERNALS
#include "jinclude.h"
#include "jpeglib.h"
#include "jdct.h" /* Private declarations for DCT subsystem */
#ifdef DCT_ISLOW_SUPPORTED
/*
* This module is specialized to the case DCTSIZE = 8.
*/
#if DCTSIZE != 8
Sorry, this code only copes with 8x8 DCT blocks. /* deliberate syntax err */
#endif
/*
* The poop on this scaling stuff is as follows:
*
* Each 1-D IDCT step produces outputs which are a factor of sqrt(N)
* larger than the true IDCT outputs. The final outputs are therefore
* a factor of N larger than desired; since N=8 this can be cured by
* a simple right shift at the end of the algorithm. The advantage of
* this arrangement is that we save two multiplications per 1-D IDCT,
* because the y0 and y4 inputs need not be divided by sqrt(N).
*
* We have to do addition and subtraction of the integer inputs, which
* is no problem, and multiplication by fractional constants, which is
* a problem to do in integer arithmetic. We multiply all the constants
* by CONST_SCALE and convert them to integer constants (thus retaining
* CONST_BITS bits of precision in the constants). After doing a
* multiplication we have to divide the product by CONST_SCALE, with proper
* rounding, to produce the correct output. This division can be done
* cheaply as a right shift of CONST_BITS bits. We postpone shifting
* as long as possible so that partial sums can be added together with
* full fractional precision.
*
* The outputs of the first pass are scaled up by PASS1_BITS bits so that
* they are represented to better-than-integral precision. These outputs
* require BITS_IN_JSAMPLE + PASS1_BITS + 3 bits; this fits in a 16-bit word
* with the recommended scaling. (To scale up 12-bit sample data further, an
* intermediate INT32 array would be needed.)
*
* To avoid overflow of the 32-bit intermediate results in pass 2, we must
* have BITS_IN_JSAMPLE + CONST_BITS + PASS1_BITS <= 26. Error analysis
* shows that the values given below are the most effective.
*/
#if BITS_IN_JSAMPLE == 8
#define CONST_BITS 13
#define PASS1_BITS 2
#else
#define CONST_BITS 13
#define PASS1_BITS 1 /* lose a little precision to avoid overflow */
#endif
/* Some C compilers fail to reduce "FIX(constant)" at compile time, thus
* causing a lot of useless floating-point operations at run time.
* To get around this we use the following pre-calculated constants.
* If you change CONST_BITS you may want to add appropriate values.
* (With a reasonable C compiler, you can just rely on the FIX() macro...)
*/
#if CONST_BITS == 13
#define FIX_0_298631336 ((INT32) 2446) /* FIX(0.298631336) */
#define FIX_0_390180644 ((INT32) 3196) /* FIX(0.390180644) */
#define FIX_0_541196100 ((INT32) 4433) /* FIX(0.541196100) */
#define FIX_0_765366865 ((INT32) 6270) /* FIX(0.765366865) */
#define FIX_0_899976223 ((INT32) 7373) /* FIX(0.899976223) */
#define FIX_1_175875602 ((INT32) 9633) /* FIX(1.175875602) */
#define FIX_1_501321110 ((INT32) 12299) /* FIX(1.501321110) */
#define FIX_1_847759065 ((INT32) 15137) /* FIX(1.847759065) */
#define FIX_1_961570560 ((INT32) 16069) /* FIX(1.961570560) */
#define FIX_2_053119869 ((INT32) 16819) /* FIX(2.053119869) */
#define FIX_2_562915447 ((INT32) 20995) /* FIX(2.562915447) */
#define FIX_3_072711026 ((INT32) 25172) /* FIX(3.072711026) */
#else
#define FIX_0_298631336 FIX(0.298631336)
#define FIX_0_390180644 FIX(0.390180644)
#define FIX_0_541196100 FIX(0.541196100)
#define FIX_0_765366865 FIX(0.765366865)
#define FIX_0_899976223 FIX(0.899976223)
#define FIX_1_175875602 FIX(1.175875602)
#define FIX_1_501321110 FIX(1.501321110)
#define FIX_1_847759065 FIX(1.847759065)
#define FIX_1_961570560 FIX(1.961570560)
#define FIX_2_053119869 FIX(2.053119869)
#define FIX_2_562915447 FIX(2.562915447)
#define FIX_3_072711026 FIX(3.072711026)
#endif
/* Multiply an INT32 variable by an INT32 constant to yield an INT32 result.
* For 8-bit samples with the recommended scaling, all the variable
* and constant values involved are no more than 16 bits wide, so a
* 16x16->32 bit multiply can be used instead of a full 32x32 multiply.
* For 12-bit samples, a full 32-bit multiplication will be needed.
*/
#if BITS_IN_JSAMPLE == 8
#define MULTIPLY(var,const) MULTIPLY16C16(var,const)
#else
#define MULTIPLY(var,const) ((var) * (const))
#endif
/* Dequantize a coefficient by multiplying it by the multiplier-table
* entry; produce an int result. In this module, both inputs and result
* are 16 bits or less, so either int or short multiply will work.
*/
#define DEQUANTIZE(coef,quantval) (((ISLOW_MULT_TYPE) (coef)) * (quantval))
/*
* Perform dequantization and inverse DCT on one block of coefficients.
*
* Optimized algorithm with 12 multiplications in the 1-D kernel.
* cK represents sqrt(2) * cos(K*pi/16).
*/
GLOBAL(void)
jpeg_idct_islow (j_decompress_ptr cinfo, jpeg_component_info * compptr,
JCOEFPTR coef_block,
JSAMPARRAY output_buf, JDIMENSION output_col)
{
INT32 tmp0, tmp1, tmp2, tmp3;
INT32 tmp10, tmp11, tmp12, tmp13;
INT32 z1, z2, z3;
JCOEFPTR inptr;
ISLOW_MULT_TYPE * quantptr;
int * wsptr;
JSAMPROW o
没有合适的资源?快使用搜索试试~ 我知道了~
libjpeg9c的VC2017静态库工程
共86个文件
c:70个
h:12个
cfg:1个
4星 · 超过85%的资源 需积分: 9 15 下载量 91 浏览量
2018-01-17
16:40:56
上传
评论
收藏 395KB RAR 举报
温馨提示
libjpeg9c是2018年发布的jpeg第三方库。 自己新建了libjpeg9c的VC2017工程,支持Windows 10 SDK,不像网上贴的,一定需要先安装老版本的WinSDK才能编译通过。 由于不允许我上传超过13M的文件,测试工程被去掉了,还不得不去掉了部份东西,需要你有一点动手能力,做下环境配置,才能build通过。
资源推荐
资源详情
资源评论
收起资源包目录
libjpeg9c.rar (86个子文件)
libjpeg9c
libjpeg9c.sln 3KB
libjpeg9c
jcomapi.c 3KB
jdmaster.c 19KB
jcdctmgr.c 16KB
jdmerge.c 16KB
jaricom.c 5KB
jerror.h 15KB
jmorecfg.h 15KB
jccolor.c 20KB
jmemnobs.c 3KB
jdsample.c 12KB
jidctfst.c 13KB
rdbmp.c 16KB
jidctint.c 186KB
jmemmgr.c 41KB
jdcoefct.c 26KB
wrbmp.c 14KB
jchuff.c 48KB
libjpeg9c.vcxproj.filters 6KB
jinclude.h 4KB
cdjpeg.c 5KB
example.c 17KB
jdpostct.c 10KB
jfdctfst.c 8KB
jfdctflt.c 6KB
libjpeg9c.vcxproj 8KB
rdtarga.c 15KB
wrrle.c 9KB
jcprepct.c 12KB
jcinit.c 11KB
jpegint.h 18KB
jquant2.c 49KB
wrjpgcom.c 17KB
wrtarga.c 8KB
transupp.h 10KB
jmemname.c 8KB
jcarith.c 28KB
jddctmgr.c 12KB
jerror.c 8KB
jccoefct.c 17KB
jconfig.h 2KB
rdswitch.c 11KB
cdjpeg.h 6KB
jmemdos.c 19KB
jquant1.c 31KB
ckconfig.c 12KB
jdatasrc.c 9KB
jdapimin.c 13KB
jidctflt.c 8KB
jfdctint.c 159KB
jdmarker.c 46KB
jcsample.c 20KB
jmemsys.h 8KB
rdrle.c 12KB
rdjpgcom.c 15KB
jutils.c 7KB
jdinput.c 25KB
rdppm.c 16KB
jpegtran.c 19KB
jdtrans.c 5KB
rdcolmap.c 7KB
jdcolor.c 23KB
jcmaster.c 23KB
jdarith.c 24KB
jmemmac.c 10KB
jcparam.c 24KB
jconfig.cfg 2KB
wrppm.c 8KB
cjpeg.c 22KB
rdgif.c 1KB
jctrans.c 15KB
jversion.h 410B
jcapimin.c 9KB
jpeglib.h 49KB
jcapistd.c 6KB
transupp.c 66KB
jdhuff.c 49KB
jcmarker.c 19KB
jdatadst.c 9KB
jmemansi.c 5KB
cderror.h 5KB
jdct.h 18KB
jdmainct.c 20KB
wrgif.c 13KB
jcmainct.c 10KB
jdapistd.c 9KB
共 86 条
- 1
资源评论
- 漫巻西風2020-03-11可以用,工程配置稍微调整了一下没有遇到太大障碍,32位64位都能编译
- sgz0072019-03-23很好!可以使用,谢谢!
kagula086
- 粉丝: 344
- 资源: 31
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功