📄 jidct_bin_a1.c,v
字号:
wsptr[DCTSIZE*5] = dcval; wsptr[DCTSIZE*6] = dcval; wsptr[DCTSIZE*7] = dcval; inptr++; quantptr++; wsptr++; continue; } tmp0 = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]); tmp1 = DEQUANTIZE(inptr[DCTSIZE*4], quantptr[DCTSIZE*4]); tmp2 = DEQUANTIZE(inptr[DCTSIZE*6], quantptr[DCTSIZE*6]); tmp3 = DEQUANTIZE(inptr[DCTSIZE*2], quantptr[DCTSIZE*2]); tmp4 = DEQUANTIZE(inptr[DCTSIZE*7], quantptr[DCTSIZE*7]); tmp5 = DEQUANTIZE(inptr[DCTSIZE*5], quantptr[DCTSIZE*5]); tmp6 = DEQUANTIZE(inptr[DCTSIZE*3], quantptr[DCTSIZE*3]); tmp7 = DEQUANTIZE(inptr[DCTSIZE*1], quantptr[DCTSIZE*1]); /* fprintf(stderr, "%10d", tmp0); fprintf(stderr, "%10d", tmp7); fprintf(stderr, "%10d", tmp3); fprintf(stderr, "%10d", tmp6); fprintf(stderr, "%10d", tmp1); fprintf(stderr, "%10d", tmp5); fprintf(stderr, "%10d", tmp2); fprintf(stderr, "%10d", tmp4); fprintf(stderr, "\n"); */ /* X[0] and X[4] */ tmp11 = ((tmp0 + 1) >> 1) - tmp1; tmp10 = tmp0 - tmp11; /* X[6] and X[2] */ tmp13 = tmp3 + (((tmp2 << 1) + tmp2 + 4) >> 3); tmp12 = ((tmp13 + 1) >> 1) - ((tmp13 + 8) >> 4) - tmp2; tmp0 = tmp10 + tmp13; tmp3 = tmp10 - tmp13; tmp1 = tmp11 + tmp12; tmp2 = tmp11 - tmp12; /* X[7] and X[1]: */ /* 7pi/16 = 3/16d 3/16u */ tmp13 = tmp7 + ( ((tmp4 << 1) + tmp4 + 8) >> 4 ); tmp10 = ( ((tmp13 << 1) + tmp13 + 8) >> 4 ) - tmp4; /* X[5] and X[3] */ /* 3pi/16 = 1/2d -7/8u */ /* tmp12 = tmp6 + ((tmp5 + 1) >> 1); tmp11 = tmp5 - tmp12 + ((tmp12 + 4) >> 3);*/ /* new 7/16 and -5/8*/ tmp12 = tmp6 + ((tmp5 + 1) >> 1) - ((tmp5 + 8) >> 4); tmp11 = tmp5 - ((tmp12 + 1) >> 1) - ((tmp12 + 4) >> 3); /* Butterfly */ tmp4 = tmp10 + tmp11; tmp5 = tmp10 - tmp11; tmp6 = tmp13 - tmp12; tmp7 = tmp13 + tmp12; /* pi/4 = -3/8u -11/16d 7/16u */ tmp5 = (((tmp6 << 1) + tmp6 + 4) >> 3) - tmp5; tmp6 = tmp6 - tmp5 + ((tmp5 + 2) >> 2) + ((tmp5 + 8) >> 4); tmp5 = tmp5 + ((tmp6 + 1) >> 1) - ((tmp6 + 8) >> 4); /* last stage: butterfly */ wsptr[DCTSIZE*0] = (tmp0 + tmp7); wsptr[DCTSIZE*7] = (tmp0 - tmp7); wsptr[DCTSIZE*1] = (tmp1 + tmp6); wsptr[DCTSIZE*6] = (tmp1 - tmp6); wsptr[DCTSIZE*2] = (tmp2 + tmp5); wsptr[DCTSIZE*5] = (tmp2 - tmp5); wsptr[DCTSIZE*3] = (tmp3 + tmp4); wsptr[DCTSIZE*4] = (tmp3 - tmp4); inptr++; /* advance pointers to next column */ quantptr++; wsptr++; } /* Pass 2: process rows from work array, store into output array. */ /* Note that we must descale the results by a factor of 8 == 2**3, */ /* and also undo the PASS1_BITS scaling. */ //fprintf(stderr, "\nAfter inverse DCT:\n"); wsptr = workspace; for (ctr = 0; ctr < DCTSIZE; ctr++) { outptr = output_buf[ctr] + output_col; /* Rows of zeroes can be exploited in the same way as we did with columns. * However, the column calculation has created many nonzero AC terms, so * the simplification applies less often (typically 5% to 10% of the time). * On machines with very fast multiplication, it's possible that the * test takes more time than it's worth. In that case this section * may be commented out. */ #ifndef NO_ZERO_ROW_TEST if (wsptr[1] == 0 && wsptr[2] == 0 && wsptr[3] == 0 && wsptr[4] == 0 && wsptr[5] == 0 && wsptr[6] == 0 && wsptr[7] == 0) { /* if all AC are 0, the IDCT will all equal to 1/2 DC. After that, apply the downscale caused by butterflies. */ JSAMPLE dcval = range_limit[(int) DESCALE((INT32) wsptr[0], bin_a_final_descale + 1) & RANGE_MASK]; outptr[0] = dcval; outptr[1] = dcval; outptr[2] = dcval; outptr[3] = dcval; outptr[4] = dcval; outptr[5] = dcval; outptr[6] = dcval; outptr[7] = dcval; wsptr += DCTSIZE; continue; }#endif /* Even part: reverse the even part of the forward DCT. */ /* The rotator is sqrt(2)*c(-6). */ /* Even part *//**********************//* not necessary ??? *//************************//******** tmp0 = (INT32) wsptr[0]; tmp1 = (INT32) wsptr[4]; tmp2 = (INT32) wsptr[6]; tmp3 = (INT32) wsptr[2]; tmp4 = (INT32) wsptr[7]; tmp5 = (INT32) wsptr[5]; tmp6 = (INT32) wsptr[3]; tmp7 = (INT32) wsptr[1];*********/ /* X[0] and X[4] */ tmp11 = ((wsptr[0] + 1) >> 1) - wsptr[4]; tmp10 = wsptr[0] - tmp11; /* X[6] and X[2] */ tmp13 = wsptr[2] + (((wsptr[6] << 1) + wsptr[6] + 4) >> 3); tmp12 = ((tmp13 + 1) >> 1) - ((tmp13 + 8) >> 4) - wsptr[6]; tmp0 = tmp10 + tmp13; tmp3 = tmp10 - tmp13; tmp1 = tmp11 + tmp12; tmp2 = tmp11 - tmp12; /* 7pi/16 = -3/16d 3/16u */ tmp13 = wsptr[1] +( ((wsptr[7] << 1) + wsptr[7] + 8) >> 4 ); tmp10 = ( ((tmp13 << 1) + tmp13 + 8) >> 4 ) - wsptr[7]; /* 3pi/16 = 1/2d -7/8u */ /* tmp12 = wsptr[3] + ((wsptr[5] + 1) >> 1); tmp11 = wsptr[5] - tmp12 + ((tmp12 + 4) >> 3); */ /* new 7/16 and -5/8*/ tmp12 = wsptr[3] + ((wsptr[5] + 1) >> 1) - ((wsptr[5] + 8) >> 4); tmp11 = wsptr[5] - ((tmp12 + 1) >> 1) - ((tmp12 + 4) >> 3); tmp4 = tmp10 + tmp11; tmp5 = tmp10 - tmp11; tmp6 = tmp13 - tmp12; tmp7 = tmp13 + tmp12; /* pi/4 = -3/8u -11/16d 7/16u */ tmp5 = (((tmp6 << 1) + tmp6 + 4) >> 3) - tmp5; tmp6 = tmp6 - tmp5 + ((tmp5 + 2) >> 2) + ((tmp5 + 8) >> 4); tmp5 = tmp5 + ((tmp6 + 1) >> 1) - ((tmp6 + 8) >> 4); /* last stage: butterfly */ /* Final output stage: scale down by a factor of 8 and range-limit */ tmp10=(tmp0 + tmp7); tmp11=(tmp0 - tmp7); outptr[0] = range_limit[(int)DESCALE(tmp10, bin_a_final_descale ) & RANGE_MASK]; outptr[7] = range_limit[(int)DESCALE(tmp11, bin_a_final_descale ) & RANGE_MASK]; //outptr[0] = (char)DESCALE(tmp10, 4); //outptr[7] = (char)DESCALE(tmp11,4); if (tmp10 > 2048 || tmp10 < -2048 || tmp11 > 2048 || tmp11 < -2048) { fprintf(stderr,"!\n"); } tmp10=(tmp1 + tmp6); tmp11=(tmp1 - tmp6); outptr[1] = range_limit[(int)DESCALE(tmp10, bin_a_final_descale) & RANGE_MASK]; outptr[6] = range_limit[(int)DESCALE(tmp11, bin_a_final_descale) & RANGE_MASK]; //outptr[1] = (char)DESCALE(tmp10, 4); //outptr[6] = (char)DESCALE(tmp11, 4); if (tmp10 > 2048 || tmp10 < -2048 || tmp11 > 2048 || tmp11 < -2048) { fprintf(stderr,"!\n"); } tmp10=(tmp2 + tmp5); tmp11=(tmp2 - tmp5); outptr[2] = range_limit[(int)DESCALE(tmp10, bin_a_final_descale) & RANGE_MASK]; outptr[5] = range_limit[(int)DESCALE(tmp11, bin_a_final_descale) & RANGE_MASK]; //outptr[2] = (char)DESCALE(tmp10,4); //outptr[5] = (char)DESCALE(tmp11,4); if (tmp10 > 2048 || tmp10 < -2048 || tmp11 > 2048 || tmp11 < -2048) { fprintf(stderr,"!\n"); } tmp10=(tmp3 + tmp4); tmp11=(tmp3 - tmp4); outptr[3] = range_limit[(int)DESCALE(tmp10, bin_a_final_descale) & RANGE_MASK]; outptr[4] = range_limit[(int)DESCALE(tmp11, bin_a_final_descale) & RANGE_MASK]; //outptr[3] = (char)DESCALE(tmp10,4); //outptr[4] = (char)DESCALE(tmp11,4); if (tmp10 > 2048 || tmp10 < -2048 || tmp11 > 2048 || tmp11 < -2048) { fprintf(stderr,"!\n"); } wsptr += DCTSIZE; /* advance pointer to next row *//*******************//* Jie: test code */ /* for (tmp0 = 0; tmp0 < 8; tmp0 ++) { fprintf(stderr, "%10d", outptr[tmp0]); } fprintf(stderr, "\n"); */ }}#endif /* DCT_BIN_A1_SUPPORTED */@
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -