Пример #1
0
decode_mcu_DC_first (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
{
  phuff_entropy_ptr entropy = (phuff_entropy_ptr) cinfo->entropy;
  int Al = cinfo->Al;
  register int s, r;
  int blkn, ci;
  JBLOCKROW block;
  BITREAD_STATE_VARS;
  savable_state state;
  d_derived_tbl * tbl;
  jpeg_component_info * compptr;

  /* Process restart marker if needed; may have to suspend */
  if (cinfo->restart_interval) {
    if (entropy->restarts_to_go == 0)
      if (! process_restart(cinfo))
        return FALSE;
  }

  /* If we've run out of data, just leave the MCU set to zeroes.
   * This way, we return uniform gray for the remainder of the segment.
   */
  if (! entropy->pub.insufficient_data) {

    /* Load up working state */
    BITREAD_LOAD_STATE(cinfo,entropy->bitstate);
    ASSIGN_STATE(state, entropy->saved);

    /* Outer loop handles each block in the MCU */

    for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) {
      block = MCU_data[blkn];
      ci = cinfo->MCU_membership[blkn];
      compptr = cinfo->cur_comp_info[ci];
      tbl = entropy->derived_tbls[compptr->dc_tbl_no];

      /* Decode a single block's worth of coefficients */

      /* Section F.2.2.1: decode the DC coefficient difference */
      HUFF_DECODE(s, br_state, tbl, return FALSE, label1);
      if (s) {
        CHECK_BIT_BUFFER(br_state, s, return FALSE);
        r = GET_BITS(s);
        s = HUFF_EXTEND(r, s);
      }

      /* Convert DC difference to actual value, update last_dc_val */
      s += state.last_dc_val[ci];
      state.last_dc_val[ci] = s;
      /* Scale and output the coefficient (assumes jpeg_natural_order[0]=0) */
      (*block)[0] = (JCOEF) LEFT_SHIFT(s, Al);
    }

    /* Completed MCU, so update state */
    BITREAD_SAVE_STATE(cinfo,entropy->bitstate);
    ASSIGN_STATE(entropy->saved, state);
  }
Пример #2
0
jpeg_fdct_islow (DCTELEM * data)
{
  INT32 tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7;
  INT32 tmp10, tmp11, tmp12, tmp13;
  INT32 z1, z2, z3, z4, z5;
  DCTELEM *dataptr;
  int ctr;
  SHIFT_TEMPS

  /* Pass 1: process rows. */
  /* Note results are scaled up by sqrt(8) compared to a true DCT; */
  /* furthermore, we scale the results by 2**PASS1_BITS. */

  dataptr = data;
  for (ctr = DCTSIZE-1; ctr >= 0; ctr--) {
    tmp0 = dataptr[0] + dataptr[7];
    tmp7 = dataptr[0] - dataptr[7];
    tmp1 = dataptr[1] + dataptr[6];
    tmp6 = dataptr[1] - dataptr[6];
    tmp2 = dataptr[2] + dataptr[5];
    tmp5 = dataptr[2] - dataptr[5];
    tmp3 = dataptr[3] + dataptr[4];
    tmp4 = dataptr[3] - dataptr[4];

    /* Even part per LL&M figure 1 --- note that published figure is faulty;
     * rotator "sqrt(2)*c1" should be "sqrt(2)*c6".
     */

    tmp10 = tmp0 + tmp3;
    tmp13 = tmp0 - tmp3;
    tmp11 = tmp1 + tmp2;
    tmp12 = tmp1 - tmp2;

    dataptr[0] = (DCTELEM) LEFT_SHIFT(tmp10 + tmp11, PASS1_BITS);
    dataptr[4] = (DCTELEM) LEFT_SHIFT(tmp10 - tmp11, PASS1_BITS);

    z1 = MULTIPLY(tmp12 + tmp13, FIX_0_541196100);
    dataptr[2] = (DCTELEM) DESCALE(z1 + MULTIPLY(tmp13, FIX_0_765366865),
                                   CONST_BITS-PASS1_BITS);
    dataptr[6] = (DCTELEM) DESCALE(z1 + MULTIPLY(tmp12, - FIX_1_847759065),
                                   CONST_BITS-PASS1_BITS);

    /* Odd part per figure 8 --- note paper omits factor of sqrt(2).
     * cK represents cos(K*pi/16).
     * i0..i3 in the paper are tmp4..tmp7 here.
     */

    z1 = tmp4 + tmp7;
    z2 = tmp5 + tmp6;
    z3 = tmp4 + tmp6;
    z4 = tmp5 + tmp7;
    z5 = MULTIPLY(z3 + z4, FIX_1_175875602); /* sqrt(2) * c3 */

    tmp4 = MULTIPLY(tmp4, FIX_0_298631336); /* sqrt(2) * (-c1+c3+c5-c7) */
    tmp5 = MULTIPLY(tmp5, FIX_2_053119869); /* sqrt(2) * ( c1+c3-c5+c7) */
    tmp6 = MULTIPLY(tmp6, FIX_3_072711026); /* sqrt(2) * ( c1+c3+c5-c7) */
    tmp7 = MULTIPLY(tmp7, FIX_1_501321110); /* sqrt(2) * ( c1+c3-c5-c7) */
    z1 = MULTIPLY(z1, - FIX_0_899976223); /* sqrt(2) * (c7-c3) */
    z2 = MULTIPLY(z2, - FIX_2_562915447); /* sqrt(2) * (-c1-c3) */
    z3 = MULTIPLY(z3, - FIX_1_961570560); /* sqrt(2) * (-c3-c5) */
    z4 = MULTIPLY(z4, - FIX_0_390180644); /* sqrt(2) * (c5-c3) */

    z3 += z5;
    z4 += z5;

    dataptr[7] = (DCTELEM) DESCALE(tmp4 + z1 + z3, CONST_BITS-PASS1_BITS);
    dataptr[5] = (DCTELEM) DESCALE(tmp5 + z2 + z4, CONST_BITS-PASS1_BITS);
    dataptr[3] = (DCTELEM) DESCALE(tmp6 + z2 + z3, CONST_BITS-PASS1_BITS);
    dataptr[1] = (DCTELEM) DESCALE(tmp7 + z1 + z4, CONST_BITS-PASS1_BITS);

    dataptr += DCTSIZE;         /* advance pointer to next row */
  }

  /* Pass 2: process columns.
   * We remove the PASS1_BITS scaling, but leave the results scaled up
   * by an overall factor of 8.
   */

  dataptr = data;
  for (ctr = DCTSIZE-1; ctr >= 0; ctr--) {
    tmp0 = dataptr[DCTSIZE*0] + dataptr[DCTSIZE*7];
    tmp7 = dataptr[DCTSIZE*0] - dataptr[DCTSIZE*7];
    tmp1 = dataptr[DCTSIZE*1] + dataptr[DCTSIZE*6];
    tmp6 = dataptr[DCTSIZE*1] - dataptr[DCTSIZE*6];
    tmp2 = dataptr[DCTSIZE*2] + dataptr[DCTSIZE*5];
    tmp5 = dataptr[DCTSIZE*2] - dataptr[DCTSIZE*5];
    tmp3 = dataptr[DCTSIZE*3] + dataptr[DCTSIZE*4];
    tmp4 = dataptr[DCTSIZE*3] - dataptr[DCTSIZE*4];

    /* Even part per LL&M figure 1 --- note that published figure is faulty;
     * rotator "sqrt(2)*c1" should be "sqrt(2)*c6".
     */

    tmp10 = tmp0 + tmp3;
    tmp13 = tmp0 - tmp3;
    tmp11 = tmp1 + tmp2;
    tmp12 = tmp1 - tmp2;

    dataptr[DCTSIZE*0] = (DCTELEM) DESCALE(tmp10 + tmp11, PASS1_BITS);
    dataptr[DCTSIZE*4] = (DCTELEM) DESCALE(tmp10 - tmp11, PASS1_BITS);

    z1 = MULTIPLY(tmp12 + tmp13, FIX_0_541196100);
    dataptr[DCTSIZE*2] = (DCTELEM) DESCALE(z1 + MULTIPLY(tmp13, FIX_0_765366865),
                                           CONST_BITS+PASS1_BITS);
    dataptr[DCTSIZE*6] = (DCTELEM) DESCALE(z1 + MULTIPLY(tmp12, - FIX_1_847759065),
                                           CONST_BITS+PASS1_BITS);

    /* Odd part per figure 8 --- note paper omits factor of sqrt(2).
     * cK represents cos(K*pi/16).
     * i0..i3 in the paper are tmp4..tmp7 here.
     */

    z1 = tmp4 + tmp7;
    z2 = tmp5 + tmp6;
    z3 = tmp4 + tmp6;
    z4 = tmp5 + tmp7;
    z5 = MULTIPLY(z3 + z4, FIX_1_175875602); /* sqrt(2) * c3 */

    tmp4 = MULTIPLY(tmp4, FIX_0_298631336); /* sqrt(2) * (-c1+c3+c5-c7) */
    tmp5 = MULTIPLY(tmp5, FIX_2_053119869); /* sqrt(2) * ( c1+c3-c5+c7) */
    tmp6 = MULTIPLY(tmp6, FIX_3_072711026); /* sqrt(2) * ( c1+c3+c5-c7) */
    tmp7 = MULTIPLY(tmp7, FIX_1_501321110); /* sqrt(2) * ( c1+c3-c5-c7) */
    z1 = MULTIPLY(z1, - FIX_0_899976223); /* sqrt(2) * (c7-c3) */
    z2 = MULTIPLY(z2, - FIX_2_562915447); /* sqrt(2) * (-c1-c3) */
    z3 = MULTIPLY(z3, - FIX_1_961570560); /* sqrt(2) * (-c3-c5) */
    z4 = MULTIPLY(z4, - FIX_0_390180644); /* sqrt(2) * (c5-c3) */

    z3 += z5;
    z4 += z5;

    dataptr[DCTSIZE*7] = (DCTELEM) DESCALE(tmp4 + z1 + z3,
                                           CONST_BITS+PASS1_BITS);
    dataptr[DCTSIZE*5] = (DCTELEM) DESCALE(tmp5 + z2 + z4,
                                           CONST_BITS+PASS1_BITS);
    dataptr[DCTSIZE*3] = (DCTELEM) DESCALE(tmp6 + z2 + z3,
                                           CONST_BITS+PASS1_BITS);
    dataptr[DCTSIZE*1] = (DCTELEM) DESCALE(tmp7 + z1 + z4,
                                           CONST_BITS+PASS1_BITS);

    dataptr++;                  /* advance pointer to next column */
  }
}
Пример #3
0
jpeg_idct_2x2 (j_decompress_ptr cinfo, jpeg_component_info * compptr,
               JCOEFPTR coef_block,
               JSAMPARRAY output_buf, JDIMENSION output_col)
{
    JLONG tmp0, tmp10, z1;
    JCOEFPTR inptr;
    ISLOW_MULT_TYPE * quantptr;
    int * wsptr;
    JSAMPROW outptr;
    JSAMPLE *range_limit = IDCT_range_limit(cinfo);
    int ctr;
    int workspace[DCTSIZE*2];     /* buffers data between passes */
    SHIFT_TEMPS

    /* Pass 1: process columns from input, store into work array. */

    inptr = coef_block;
    quantptr = (ISLOW_MULT_TYPE *) compptr->dct_table;
    wsptr = workspace;
    for (ctr = DCTSIZE; ctr > 0; inptr++, quantptr++, wsptr++, ctr--) {
        /* Don't bother to process columns 2,4,6 */
        if (ctr == DCTSIZE-2 || ctr == DCTSIZE-4 || ctr == DCTSIZE-6)
            continue;
        if (inptr[DCTSIZE*1] == 0 && inptr[DCTSIZE*3] == 0 &&
                inptr[DCTSIZE*5] == 0 && inptr[DCTSIZE*7] == 0) {
            /* AC terms all zero; we need not examine terms 2,4,6 for 2x2 output */
            int dcval = LEFT_SHIFT(DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]),
                                   PASS1_BITS);

            wsptr[DCTSIZE*0] = dcval;
            wsptr[DCTSIZE*1] = dcval;

            continue;
        }

        /* Even part */

        z1 = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]);
        tmp10 = LEFT_SHIFT(z1, CONST_BITS+2);

        /* Odd part */

        z1 = DEQUANTIZE(inptr[DCTSIZE*7], quantptr[DCTSIZE*7]);
        tmp0 = MULTIPLY(z1, - FIX_0_720959822); /* sqrt(2) * (c7-c5+c3-c1) */
        z1 = DEQUANTIZE(inptr[DCTSIZE*5], quantptr[DCTSIZE*5]);
        tmp0 += MULTIPLY(z1, FIX_0_850430095); /* sqrt(2) * (-c1+c3+c5+c7) */
        z1 = DEQUANTIZE(inptr[DCTSIZE*3], quantptr[DCTSIZE*3]);
        tmp0 += MULTIPLY(z1, - FIX_1_272758580); /* sqrt(2) * (-c1+c3-c5-c7) */
        z1 = DEQUANTIZE(inptr[DCTSIZE*1], quantptr[DCTSIZE*1]);
        tmp0 += MULTIPLY(z1, FIX_3_624509785); /* sqrt(2) * (c1+c3+c5+c7) */

        /* Final output stage */

        wsptr[DCTSIZE*0] = (int) DESCALE(tmp10 + tmp0, CONST_BITS-PASS1_BITS+2);
        wsptr[DCTSIZE*1] = (int) DESCALE(tmp10 - tmp0, CONST_BITS-PASS1_BITS+2);
    }

    /* Pass 2: process 2 rows from work array, store into output array. */

    wsptr = workspace;
    for (ctr = 0; ctr < 2; ctr++) {
        outptr = output_buf[ctr] + output_col;
        /* It's not clear whether a zero row test is worthwhile here ... */

#ifndef NO_ZERO_ROW_TEST
        if (wsptr[1] == 0 && wsptr[3] == 0 && wsptr[5] == 0 && wsptr[7] == 0) {
            /* AC terms all zero */
            JSAMPLE dcval = range_limit[(int) DESCALE((JLONG) wsptr[0], PASS1_BITS+3)
                                        & RANGE_MASK];

            outptr[0] = dcval;
            outptr[1] = dcval;

            wsptr += DCTSIZE;         /* advance pointer to next row */
            continue;
        }
#endif

        /* Even part */

        tmp10 = LEFT_SHIFT((JLONG) wsptr[0], CONST_BITS+2);

        /* Odd part */

        tmp0 = MULTIPLY((JLONG) wsptr[7], - FIX_0_720959822) /* sqrt(2) * (c7-c5+c3-c1) */
               + MULTIPLY((JLONG) wsptr[5], FIX_0_850430095) /* sqrt(2) * (-c1+c3+c5+c7) */
               + MULTIPLY((JLONG) wsptr[3], - FIX_1_272758580) /* sqrt(2) * (-c1+c3-c5-c7) */
               + MULTIPLY((JLONG) wsptr[1], FIX_3_624509785); /* sqrt(2) * (c1+c3+c5+c7) */

        /* Final output stage */

        outptr[0] = range_limit[(int) DESCALE(tmp10 + tmp0,
                                              CONST_BITS+PASS1_BITS+3+2)
                                & RANGE_MASK];
        outptr[1] = range_limit[(int) DESCALE(tmp10 - tmp0,
                                              CONST_BITS+PASS1_BITS+3+2)
                                & RANGE_MASK];

        wsptr += DCTSIZE;           /* advance pointer to next row */
    }
}
void testLeftShift() {
	LEFT_SHIFT("ACGT","ACGT",0);
	LEFT_SHIFT("ACGT", "CGTA",1);
	LEFT_SHIFT("ACGT", "GTAA",2);
	LEFT_SHIFT("ACGT", "TAAA",3);

	LEFT_SHIFT("AAAAAAAA", "AAAAAAAA",0);
	LEFT_SHIFT("AAAAAAAA", "AAAAAAAA",1);
	LEFT_SHIFT("AAAAAAAA", "AAAAAAAA",2);
	LEFT_SHIFT("AAAAAAAA", "AAAAAAAA",3);

	LEFT_SHIFT("CCCCCCCC", "CCCCCCCA",1);
	LEFT_SHIFT("CCCCCCCC", "CCCCCCAA",2);
	LEFT_SHIFT("CCCCCCCC", "CCCCCAAA",3);

	LEFT_SHIFT("CCCCCCC",  "CCCCCCA",1);
	LEFT_SHIFT("CCCCCCC",  "CCCCCAA",2);
	LEFT_SHIFT("CCCCCCC",  "CCCCAAA",3);

	LEFT_SHIFT("CCCCCC",  "CCCCCA",1);
	LEFT_SHIFT("CCCCCC",  "CCCCAA",2);
	LEFT_SHIFT("CCCCCC",  "CCCAAA",3);

	LEFT_SHIFT("CCCCC",  "CCCCA",1);
	LEFT_SHIFT("CCCCC",  "CCCAA",2);
	LEFT_SHIFT("CCCCC",  "CCAAA",3);

	LEFT_SHIFT("ACGTACGT","CGTACGTA",1);
	LEFT_SHIFT("ACGTACGT", "GTACGTAA",2);
	LEFT_SHIFT("ACGTACGT", "TACGTAAA",3);

	LEFT_SHIFT("TACGTACGT","ACGTACGTA",1);
	LEFT_SHIFT("TACGTACGT", "CGTACGTAA",2);
	LEFT_SHIFT("TACGTACGT", "GTACGTAAA",3);

	LEFT_SHIFT("GTACGTACGT","TACGTACGTA",1);
	LEFT_SHIFT("GTACGTACGT", "ACGTACGTAA",2);
	LEFT_SHIFT("GTACGTACGT", "CGTACGTAAA",3);

	LEFT_SHIFT("CGTACGTACGT","GTACGTACGTA",1);
	LEFT_SHIFT("CGTACGTACGT", "TACGTACGTAA",2);
	LEFT_SHIFT("CGTACGTACGT", "ACGTACGTAAA",3);

}
Пример #5
0
jpeg_idct_4x4 (j_decompress_ptr cinfo, jpeg_component_info * compptr,
               JCOEFPTR coef_block,
               JSAMPARRAY output_buf, JDIMENSION output_col)
{
    JLONG tmp0, tmp2, tmp10, tmp12;
    JLONG z1, z2, z3, z4;
    JCOEFPTR inptr;
    ISLOW_MULT_TYPE * quantptr;
    int * wsptr;
    JSAMPROW outptr;
    JSAMPLE *range_limit = IDCT_range_limit(cinfo);
    int ctr;
    int workspace[DCTSIZE*4];     /* buffers data between passes */
    SHIFT_TEMPS

    /* Pass 1: process columns from input, store into work array. */

    inptr = coef_block;
    quantptr = (ISLOW_MULT_TYPE *) compptr->dct_table;
    wsptr = workspace;
    for (ctr = DCTSIZE; ctr > 0; inptr++, quantptr++, wsptr++, ctr--) {
        /* Don't bother to process column 4, because second pass won't use it */
        if (ctr == DCTSIZE-4)
            continue;
        if (inptr[DCTSIZE*1] == 0 && inptr[DCTSIZE*2] == 0 &&
                inptr[DCTSIZE*3] == 0 && inptr[DCTSIZE*5] == 0 &&
                inptr[DCTSIZE*6] == 0 && inptr[DCTSIZE*7] == 0) {
            /* AC terms all zero; we need not examine term 4 for 4x4 output */
            int dcval = LEFT_SHIFT(DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]),
                                   PASS1_BITS);

            wsptr[DCTSIZE*0] = dcval;
            wsptr[DCTSIZE*1] = dcval;
            wsptr[DCTSIZE*2] = dcval;
            wsptr[DCTSIZE*3] = dcval;

            continue;
        }

        /* Even part */

        tmp0 = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]);
        tmp0 = LEFT_SHIFT(tmp0, CONST_BITS+1);

        z2 = DEQUANTIZE(inptr[DCTSIZE*2], quantptr[DCTSIZE*2]);
        z3 = DEQUANTIZE(inptr[DCTSIZE*6], quantptr[DCTSIZE*6]);

        tmp2 = MULTIPLY(z2, FIX_1_847759065) + MULTIPLY(z3, - FIX_0_765366865);

        tmp10 = tmp0 + tmp2;
        tmp12 = tmp0 - tmp2;

        /* Odd part */

        z1 = DEQUANTIZE(inptr[DCTSIZE*7], quantptr[DCTSIZE*7]);
        z2 = DEQUANTIZE(inptr[DCTSIZE*5], quantptr[DCTSIZE*5]);
        z3 = DEQUANTIZE(inptr[DCTSIZE*3], quantptr[DCTSIZE*3]);
        z4 = DEQUANTIZE(inptr[DCTSIZE*1], quantptr[DCTSIZE*1]);

        tmp0 = MULTIPLY(z1, - FIX_0_211164243) /* sqrt(2) * (c3-c1) */
               + MULTIPLY(z2, FIX_1_451774981) /* sqrt(2) * (c3+c7) */
               + MULTIPLY(z3, - FIX_2_172734803) /* sqrt(2) * (-c1-c5) */
               + MULTIPLY(z4, FIX_1_061594337); /* sqrt(2) * (c5+c7) */

        tmp2 = MULTIPLY(z1, - FIX_0_509795579) /* sqrt(2) * (c7-c5) */
               + MULTIPLY(z2, - FIX_0_601344887) /* sqrt(2) * (c5-c1) */
               + MULTIPLY(z3, FIX_0_899976223) /* sqrt(2) * (c3-c7) */
               + MULTIPLY(z4, FIX_2_562915447); /* sqrt(2) * (c1+c3) */

        /* Final output stage */

        wsptr[DCTSIZE*0] = (int) DESCALE(tmp10 + tmp2, CONST_BITS-PASS1_BITS+1);
        wsptr[DCTSIZE*3] = (int) DESCALE(tmp10 - tmp2, CONST_BITS-PASS1_BITS+1);
        wsptr[DCTSIZE*1] = (int) DESCALE(tmp12 + tmp0, CONST_BITS-PASS1_BITS+1);
        wsptr[DCTSIZE*2] = (int) DESCALE(tmp12 - tmp0, CONST_BITS-PASS1_BITS+1);
    }

    /* Pass 2: process 4 rows from work array, store into output array. */

    wsptr = workspace;
    for (ctr = 0; ctr < 4; ctr++) {
        outptr = output_buf[ctr] + output_col;
        /* It's not clear whether a zero row test is worthwhile here ... */

#ifndef NO_ZERO_ROW_TEST
        if (wsptr[1] == 0 && wsptr[2] == 0 && wsptr[3] == 0 &&
                wsptr[5] == 0 && wsptr[6] == 0 && wsptr[7] == 0) {
            /* AC terms all zero */
            JSAMPLE dcval = range_limit[(int) DESCALE((JLONG) wsptr[0], PASS1_BITS+3)
                                        & RANGE_MASK];

            outptr[0] = dcval;
            outptr[1] = dcval;
            outptr[2] = dcval;
            outptr[3] = dcval;

            wsptr += DCTSIZE;         /* advance pointer to next row */
            continue;
        }
#endif

        /* Even part */

        tmp0 = LEFT_SHIFT((JLONG) wsptr[0], CONST_BITS+1);

        tmp2 = MULTIPLY((JLONG) wsptr[2], FIX_1_847759065)
               + MULTIPLY((JLONG) wsptr[6], - FIX_0_765366865);

        tmp10 = tmp0 + tmp2;
        tmp12 = tmp0 - tmp2;

        /* Odd part */

        z1 = (JLONG) wsptr[7];
        z2 = (JLONG) wsptr[5];
        z3 = (JLONG) wsptr[3];
        z4 = (JLONG) wsptr[1];

        tmp0 = MULTIPLY(z1, - FIX_0_211164243) /* sqrt(2) * (c3-c1) */
               + MULTIPLY(z2, FIX_1_451774981) /* sqrt(2) * (c3+c7) */
               + MULTIPLY(z3, - FIX_2_172734803) /* sqrt(2) * (-c1-c5) */
               + MULTIPLY(z4, FIX_1_061594337); /* sqrt(2) * (c5+c7) */

        tmp2 = MULTIPLY(z1, - FIX_0_509795579) /* sqrt(2) * (c7-c5) */
               + MULTIPLY(z2, - FIX_0_601344887) /* sqrt(2) * (c5-c1) */
               + MULTIPLY(z3, FIX_0_899976223) /* sqrt(2) * (c3-c7) */
               + MULTIPLY(z4, FIX_2_562915447); /* sqrt(2) * (c1+c3) */

        /* Final output stage */

        outptr[0] = range_limit[(int) DESCALE(tmp10 + tmp2,
                                              CONST_BITS+PASS1_BITS+3+1)
                                & RANGE_MASK];
        outptr[3] = range_limit[(int) DESCALE(tmp10 - tmp2,
                                              CONST_BITS+PASS1_BITS+3+1)
                                & RANGE_MASK];
        outptr[1] = range_limit[(int) DESCALE(tmp12 + tmp0,
                                              CONST_BITS+PASS1_BITS+3+1)
                                & RANGE_MASK];
        outptr[2] = range_limit[(int) DESCALE(tmp12 - tmp0,
                                              CONST_BITS+PASS1_BITS+3+1)
                                & RANGE_MASK];

        wsptr += DCTSIZE;           /* advance pointer to next row */
    }
}