159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong/* ------------------------------------------------------------------
259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong * Copyright (C) 1998-2009 PacketVideo
359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong *
459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong * Licensed under the Apache License, Version 2.0 (the "License");
559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong * you may not use this file except in compliance with the License.
659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong * You may obtain a copy of the License at
759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong *
859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong *      http://www.apache.org/licenses/LICENSE-2.0
959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong *
1059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong * Unless required by applicable law or agreed to in writing, software
1159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong * distributed under the License is distributed on an "AS IS" BASIS,
1259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
1359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong * express or implied.
1459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong * See the License for the specific language governing permissions
1559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong * and limitations under the License.
1659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong * -------------------------------------------------------------------
1759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong */
1859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong/*
1959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
2059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong------------------------------------------------------------------------------
2159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong REVISION HISTORY
2259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong Who:   Date: July/2001
2359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong Description:   1. Optimized BlockIDCT bitmap checking.
2459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong                2. Rearranged functions.
2559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong                3. Do column IDCT first, then row IDCT.
2659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong                4. Combine motion comp and IDCT, require
2759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong                   two sets of row IDCTs one for INTRA
2859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong                   and one for INTER.
2959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong                5. Add AAN IDCT
3059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
3159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong Who:   Date: 8/16/01
3259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong                1. Increase the input precision to 8 bits, i.e. change RDCTBITS
3359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong                   to 11, have to comment out all in-line assembly since 16 bit
3459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong                    multiplication doesn't work. Try to use diffent precision with
3559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong                    32 bit mult. but hasn't finished. Turns out that without in-line
3659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong                    assembly the performance doesn't change much (only 1%).
3759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong Who:   Date: 9/04/05
3859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong                1. Replace AAN IDCT with Chen's IDCT to accommodate 16 bit data type.
3959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
4059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong*/
4159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong#include "mp4def.h"
4259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong#include "mp4enc_lib.h"
4359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong#include "mp4lib_int.h"
4459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong#include "dct.h"
4559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
4659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong#define ADD_CLIP    { \
4759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong            tmp = *rec + tmp; \
4859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        if((UInt)tmp > mask) tmp = mask&(~(tmp>>31)); \
4959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        *rec++ = tmp;   \
5059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        }
5159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
5259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong#define INTRA_CLIP  { \
5359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        if((UInt)tmp > mask) tmp = mask&(~(tmp>>31)); \
5459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        *rec++ = tmp;   \
5559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        }
5659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
5759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
5859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong#define CLIP_RESULT(x)      if((UInt)x > 0xFF){x = 0xFF & (~(x>>31));}
5959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong#define ADD_AND_CLIP1(x)    x += (pred_word&0xFF); CLIP_RESULT(x);
6059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong#define ADD_AND_CLIP2(x)    x += ((pred_word>>8)&0xFF); CLIP_RESULT(x);
6159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong#define ADD_AND_CLIP3(x)    x += ((pred_word>>16)&0xFF); CLIP_RESULT(x);
6259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong#define ADD_AND_CLIP4(x)    x += ((pred_word>>24)&0xFF); CLIP_RESULT(x);
6359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
6459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
6559f566c4ec3dfc097ad8163523e522280b27e5c3James Dongvoid idct_col0(Short *blk)
6659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong{
6759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    OSCL_UNUSED_ARG(blk);
6859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
6959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    return;
7059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong}
7159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
7259f566c4ec3dfc097ad8163523e522280b27e5c3James Dongvoid idct_col1(Short *blk)
7359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong{
7459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    blk[0] = blk[8] = blk[16] = blk[24] = blk[32] = blk[40] = blk[48] = blk[56] =
7559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong                                              blk[0] << 3;
7659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    return ;
7759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong}
7859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
7959f566c4ec3dfc097ad8163523e522280b27e5c3James Dongvoid idct_col2(Short *blk)
8059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong{
8159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    int32 x0, x1, x3, x5, x7;//, x8;
8259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
8359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    x1 = blk[8];
8459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    x0 = ((int32)blk[0] << 11) + 128;
8559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    /* both upper and lower*/
8659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
8759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    x7 = W7 * x1;
8859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    x1 = W1 * x1;
8959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
9059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    x3 = x7;
9159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    x5 = (181 * (x1 - x7) + 128) >> 8;
9259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    x7 = (181 * (x1 + x7) + 128) >> 8;
9359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
9459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    blk[0] = (x0 + x1) >> 8;
9559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    blk[8] = (x0 + x7) >> 8;
9659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    blk[16] = (x0 + x5) >> 8;
9759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    blk[24] = (x0 + x3) >> 8;
9859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    blk[56] = (x0 - x1) >> 8;
9959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    blk[48] = (x0 - x7) >> 8;
10059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    blk[40] = (x0 - x5) >> 8;
10159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    blk[32] = (x0 - x3) >> 8;
10259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    return ;
10359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong}
10459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
10559f566c4ec3dfc097ad8163523e522280b27e5c3James Dongvoid idct_col3(Short *blk)
10659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong{
10759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    int32 x0, x1, x2, x3, x4, x5, x6, x7, x8;
10859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
10959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    x2 = blk[16];
11059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    x1 = blk[8];
11159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    x0 = ((int32)blk[0] << 11) + 128;
11259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
11359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    x4 = x0;
11459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    x6 = W6 * x2;
11559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    x2 = W2 * x2;
11659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    x8 = x0 - x2;
11759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    x0 += x2;
11859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    x2 = x8;
11959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    x8 = x4 - x6;
12059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    x4 += x6;
12159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    x6 = x8;
12259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
12359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    x7 = W7 * x1;
12459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    x1 = W1 * x1;
12559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    x3 = x7;
12659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    x5 = (181 * (x1 - x7) + 128) >> 8;
12759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    x7 = (181 * (x1 + x7) + 128) >> 8;
12859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
12959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    blk[0] = (x0 + x1) >> 8;
13059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    blk[8] = (x4 + x7) >> 8;
13159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    blk[16] = (x6 + x5) >> 8;
13259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    blk[24] = (x2 + x3) >> 8;
13359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    blk[56] = (x0 - x1) >> 8;
13459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    blk[48] = (x4 - x7) >> 8;
13559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    blk[40] = (x6 - x5) >> 8;
13659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    blk[32] = (x2 - x3) >> 8;
13759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    return ;
13859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong}
13959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
14059f566c4ec3dfc097ad8163523e522280b27e5c3James Dongvoid idct_col4(Short *blk)
14159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong{
14259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    int32 x0, x1, x2, x3, x4, x5, x6, x7, x8;
14359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    x2 = blk[16];
14459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    x1 = blk[8];
14559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    x3 = blk[24];
14659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    x0 = ((int32)blk[0] << 11) + 128;
14759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
14859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    x4 = x0;
14959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    x6 = W6 * x2;
15059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    x2 = W2 * x2;
15159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    x8 = x0 - x2;
15259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    x0 += x2;
15359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    x2 = x8;
15459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    x8 = x4 - x6;
15559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    x4 += x6;
15659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    x6 = x8;
15759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
15859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    x7 = W7 * x1;
15959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    x1 = W1 * x1;
16059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    x5 = W3 * x3;
16159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    x3 = -W5 * x3;
16259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    x8 = x1 - x5;
16359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    x1 += x5;
16459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    x5 = x8;
16559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    x8 = x7 - x3;
16659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    x3 += x7;
16759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    x7 = (181 * (x5 + x8) + 128) >> 8;
16859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    x5 = (181 * (x5 - x8) + 128) >> 8;
16959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
17059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
17159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    blk[0] = (x0 + x1) >> 8;
17259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    blk[8] = (x4 + x7) >> 8;
17359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    blk[16] = (x6 + x5) >> 8;
17459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    blk[24] = (x2 + x3) >> 8;
17559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    blk[56] = (x0 - x1) >> 8;
17659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    blk[48] = (x4 - x7) >> 8;
17759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    blk[40] = (x6 - x5) >> 8;
17859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    blk[32] = (x2 - x3) >> 8;
17959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    return ;
18059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong}
18159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
18259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong#ifndef SMALL_DCT
18359f566c4ec3dfc097ad8163523e522280b27e5c3James Dongvoid idct_col0x40(Short *blk)
18459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong{
18559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    int32 x1, x3, x5, x7;//, x8;
18659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
18759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    x1 = blk[8];
18859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    /* both upper and lower*/
18959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
19059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    x7 = W7 * x1;
19159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    x1 = W1 * x1;
19259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
19359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    x3 = x7;
19459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    x5 = (181 * (x1 - x7) + 128) >> 8;
19559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    x7 = (181 * (x1 + x7) + 128) >> 8;
19659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
19759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    blk[0] = (128 + x1) >> 8;
19859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    blk[8] = (128 + x7) >> 8;
19959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    blk[16] = (128 + x5) >> 8;
20059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    blk[24] = (128 + x3) >> 8;
20159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    blk[56] = (128 - x1) >> 8;
20259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    blk[48] = (128 - x7) >> 8;
20359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    blk[40] = (128 - x5) >> 8;
20459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    blk[32] = (128 - x3) >> 8;
20559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
20659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    return ;
20759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong}
20859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
20959f566c4ec3dfc097ad8163523e522280b27e5c3James Dongvoid idct_col0x20(Short *blk)
21059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong{
21159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    int32 x0, x2, x4, x6;
21259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
21359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    x2 = blk[16];
21459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    x6 = W6 * x2;
21559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    x2 = W2 * x2;
21659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    x0 = 128 + x2;
21759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    x2 = 128 - x2;
21859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    x4 = 128 + x6;
21959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    x6 = 128 - x6;
22059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
22159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    blk[0] = (x0) >> 8;
22259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    blk[56] = (x0) >> 8;
22359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    blk[8] = (x4) >> 8;
22459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    blk[48] = (x4) >> 8;
22559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    blk[16] = (x6) >> 8;
22659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    blk[40] = (x6) >> 8;
22759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    blk[24] = (x2) >> 8;
22859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    blk[32] = (x2) >> 8;
22959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
23059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    return ;
23159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong}
23259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
23359f566c4ec3dfc097ad8163523e522280b27e5c3James Dongvoid idct_col0x10(Short *blk)
23459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong{
23559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    int32 x1, x3, x5,  x7;
23659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
23759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    x3 = blk[24];
23859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    x1 = W3 * x3;
23959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    x3 = W5 * x3;
24059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
24159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    x7 = (181 * (x3 - x1) + 128) >> 8;
24259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    x5 = (-181 * (x1 + x3) + 128) >> 8;
24359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
24459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
24559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    blk[0] = (128 + x1) >> 8;
24659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    blk[8] = (128 + x7) >> 8;
24759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    blk[16] = (128 + x5) >> 8;
24859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    blk[24] = (128 - x3) >> 8;
24959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    blk[56] = (128 - x1) >> 8;
25059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    blk[48] = (128 - x7) >> 8;
25159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    blk[40] = (128 - x5) >> 8;
25259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    blk[32] = (128 + x3) >> 8;
25359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
25459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    return ;
25559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong}
25659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
25759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong#endif /* SMALL_DCT */
25859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
25959f566c4ec3dfc097ad8163523e522280b27e5c3James Dongvoid idct_col(Short *blk)
26059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong{
26159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    int32 x0, x1, x2, x3, x4, x5, x6, x7, x8;
26259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
26359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    x1 = (int32)blk[32] << 11;
26459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    x2 = blk[48];
26559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    x3 = blk[16];
26659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    x4 = blk[8];
26759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    x5 = blk[56];
26859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    x6 = blk[40];
26959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    x7 = blk[24];
27059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    x0 = ((int32)blk[0] << 11) + 128;
27159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
27259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    /* first stage */
27359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    x8 = W7 * (x4 + x5);
27459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    x4 = x8 + (W1 - W7) * x4;
27559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    x5 = x8 - (W1 + W7) * x5;
27659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    x8 = W3 * (x6 + x7);
27759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    x6 = x8 - (W3 - W5) * x6;
27859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    x7 = x8 - (W3 + W5) * x7;
27959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
28059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    /* second stage */
28159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    x8 = x0 + x1;
28259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    x0 -= x1;
28359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    x1 = W6 * (x3 + x2);
28459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    x2 = x1 - (W2 + W6) * x2;
28559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    x3 = x1 + (W2 - W6) * x3;
28659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    x1 = x4 + x6;
28759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    x4 -= x6;
28859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    x6 = x5 + x7;
28959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    x5 -= x7;
29059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
29159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    /* third stage */
29259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    x7 = x8 + x3;
29359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    x8 -= x3;
29459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    x3 = x0 + x2;
29559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    x0 -= x2;
29659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    x2 = (181 * (x4 + x5) + 128) >> 8;
29759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    x4 = (181 * (x4 - x5) + 128) >> 8;
29859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
29959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    /* fourth stage */
30059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    blk[0]    = (x7 + x1) >> 8;
30159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    blk[8] = (x3 + x2) >> 8;
30259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    blk[16] = (x0 + x4) >> 8;
30359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    blk[24] = (x8 + x6) >> 8;
30459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    blk[32] = (x8 - x6) >> 8;
30559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    blk[40] = (x0 - x4) >> 8;
30659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    blk[48] = (x3 - x2) >> 8;
30759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    blk[56] = (x7 - x1) >> 8;
30859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
30959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    return ;
31059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong}
31159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
31259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong/* This function should not be called at all ****/
31359f566c4ec3dfc097ad8163523e522280b27e5c3James Dongvoid idct_row0Inter(Short *srce, UChar *rec, Int lx)
31459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong{
31559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    OSCL_UNUSED_ARG(srce);
31659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
31759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    OSCL_UNUSED_ARG(rec);
31859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
31959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    OSCL_UNUSED_ARG(lx);
32059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
32159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    return;
32259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong}
32359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
32459f566c4ec3dfc097ad8163523e522280b27e5c3James Dongvoid idct_row1Inter(Short *blk, UChar *rec, Int lx)
32559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong{
32659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    int tmp;
32759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    int i = 8;
32859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    uint32 pred_word, dst_word;
32959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    int res, res2;
33059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
33159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    /* preset the offset, such that we can take advantage pre-offset addressing mode   */
33259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    rec -= lx;
33359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    blk -= 8;
33459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
33559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    while (i--)
33659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    {
33759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        tmp = (*(blk += 8) + 32) >> 6;
33859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        *blk = 0;
33959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
34059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        pred_word = *((uint32*)(rec += lx)); /* read 4 bytes from pred */
34159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        res = tmp + (pred_word & 0xFF);
34259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        CLIP_RESULT(res);
34359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        res2 = tmp + ((pred_word >> 8) & 0xFF);
34459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        CLIP_RESULT(res2);
34559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        dst_word = (res2 << 8) | res;
34659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        res = tmp + ((pred_word >> 16) & 0xFF);
34759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        CLIP_RESULT(res);
34859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        dst_word |= (res << 16);
34959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        res = tmp + ((pred_word >> 24) & 0xFF);
35059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        CLIP_RESULT(res);
35159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        dst_word |= (res << 24);
35259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        *((uint32*)rec) = dst_word; /* save 4 bytes to dst */
35359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
35459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        pred_word = *((uint32*)(rec + 4)); /* read 4 bytes from pred */
35559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        res = tmp + (pred_word & 0xFF);
35659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        CLIP_RESULT(res);
35759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        res2 = tmp + ((pred_word >> 8) & 0xFF);
35859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        CLIP_RESULT(res2);
35959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        dst_word = (res2 << 8) | res;
36059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        res = tmp + ((pred_word >> 16) & 0xFF);
36159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        CLIP_RESULT(res);
36259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        dst_word |= (res << 16);
36359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        res = tmp + ((pred_word >> 24) & 0xFF);
36459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        CLIP_RESULT(res);
36559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        dst_word |= (res << 24);
36659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        *((uint32*)(rec + 4)) = dst_word; /* save 4 bytes to dst */
36759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    }
36859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    return;
36959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong}
37059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
37159f566c4ec3dfc097ad8163523e522280b27e5c3James Dongvoid idct_row2Inter(Short *blk, UChar *rec, Int lx)
37259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong{
37359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    int32 x0, x1, x2, x4, x5;
37459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    int i = 8;
37559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    uint32 pred_word, dst_word;
37659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    int res, res2;
37759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
37859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    /* preset the offset, such that we can take advantage pre-offset addressing mode   */
37959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    rec -= lx;
38059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    blk -= 8;
38159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
38259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    while (i--)
38359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    {
38459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        /* shortcut */
38559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        x4 = blk[9];
38659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        blk[9] = 0;
38759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        x0 = ((*(blk += 8)) << 8) + 8192;
38859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        *blk = 0;  /* for proper rounding in the fourth stage */
38959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
39059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        /* first stage */
39159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        x5 = (W7 * x4 + 4) >> 3;
39259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        x4 = (W1 * x4 + 4) >> 3;
39359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
39459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        /* third stage */
39559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        x2 = (181 * (x4 + x5) + 128) >> 8;
39659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        x1 = (181 * (x4 - x5) + 128) >> 8;
39759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
39859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        /* fourth stage */
39959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        pred_word = *((uint32*)(rec += lx)); /* read 4 bytes from pred */
40059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        res = (x0 + x4) >> 14;
40159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        ADD_AND_CLIP1(res);
40259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        res2 = (x0 + x2) >> 14;
40359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        ADD_AND_CLIP2(res2);
40459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        dst_word = (res2 << 8) | res;
40559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        res = (x0 + x1) >> 14;
40659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        ADD_AND_CLIP3(res);
40759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        dst_word |= (res << 16);
40859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        res = (x0 + x5) >> 14;
40959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        ADD_AND_CLIP4(res);
41059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        dst_word |= (res << 24);
41159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        *((uint32*)rec) = dst_word; /* save 4 bytes to dst */
41259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
41359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        pred_word = *((uint32*)(rec + 4)); /* read 4 bytes from pred */
41459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        res = (x0 - x5) >> 14;
41559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        ADD_AND_CLIP1(res);
41659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        res2 = (x0 - x1) >> 14;
41759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        ADD_AND_CLIP2(res2);
41859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        dst_word = (res2 << 8) | res;
41959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        res = (x0 - x2) >> 14;
42059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        ADD_AND_CLIP3(res);
42159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        dst_word |= (res << 16);
42259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        res = (x0 - x4) >> 14;
42359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        ADD_AND_CLIP4(res);
42459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        dst_word |= (res << 24);
42559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        *((uint32*)(rec + 4)) = dst_word; /* save 4 bytes to dst */
42659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    }
42759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    return ;
42859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong}
42959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
43059f566c4ec3dfc097ad8163523e522280b27e5c3James Dongvoid idct_row3Inter(Short *blk, UChar *rec, Int lx)
43159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong{
43259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    int32 x0, x1, x2, x3, x4, x5, x6, x7, x8;
43359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    int i = 8;
43459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    uint32 pred_word, dst_word;
43559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    int res, res2;
43659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
43759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    /* preset the offset, such that we can take advantage pre-offset addressing mode   */
43859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    rec -= lx;
43959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    blk -= 8;
44059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
44159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    while (i--)
44259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    {
44359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        x2 = blk[10];
44459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        blk[10] = 0;
44559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        x1 = blk[9];
44659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        blk[9] = 0;
44759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        x0 = ((*(blk += 8)) << 8) + 8192;
44859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        *blk = 0;  /* for proper rounding in the fourth stage */
44959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        /* both upper and lower*/
45059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        /* both x2orx6 and x0orx4 */
45159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
45259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        x4 = x0;
45359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        x6 = (W6 * x2 + 4) >> 3;
45459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        x2 = (W2 * x2 + 4) >> 3;
45559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        x8 = x0 - x2;
45659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        x0 += x2;
45759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        x2 = x8;
45859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        x8 = x4 - x6;
45959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        x4 += x6;
46059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        x6 = x8;
46159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
46259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        x7 = (W7 * x1 + 4) >> 3;
46359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        x1 = (W1 * x1 + 4) >> 3;
46459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        x3 = x7;
46559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        x5 = (181 * (x1 - x7) + 128) >> 8;
46659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        x7 = (181 * (x1 + x7) + 128) >> 8;
46759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
46859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        pred_word = *((uint32*)(rec += lx)); /* read 4 bytes from pred */
46959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        res = (x0 + x1) >> 14;
47059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        ADD_AND_CLIP1(res);
47159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        res2 = (x4 + x7) >> 14;
47259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        ADD_AND_CLIP2(res2);
47359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        dst_word = (res2 << 8) | res;
47459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        res = (x6 + x5) >> 14;
47559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        ADD_AND_CLIP3(res);
47659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        dst_word |= (res << 16);
47759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        res = (x2 + x3) >> 14;
47859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        ADD_AND_CLIP4(res);
47959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        dst_word |= (res << 24);
48059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        *((uint32*)rec) = dst_word; /* save 4 bytes to dst */
48159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
48259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        pred_word = *((uint32*)(rec + 4)); /* read 4 bytes from pred */
48359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        res = (x2 - x3) >> 14;
48459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        ADD_AND_CLIP1(res);
48559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        res2 = (x6 - x5) >> 14;
48659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        ADD_AND_CLIP2(res2);
48759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        dst_word = (res2 << 8) | res;
48859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        res = (x4 - x7) >> 14;
48959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        ADD_AND_CLIP3(res);
49059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        dst_word |= (res << 16);
49159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        res = (x0 - x1) >> 14;
49259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        ADD_AND_CLIP4(res);
49359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        dst_word |= (res << 24);
49459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        *((uint32*)(rec + 4)) = dst_word; /* save 4 bytes to dst */
49559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    }
49659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
49759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    return ;
49859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong}
49959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
50059f566c4ec3dfc097ad8163523e522280b27e5c3James Dongvoid idct_row4Inter(Short *blk, UChar *rec, Int lx)
50159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong{
50259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    int32 x0, x1, x2, x3, x4, x5, x6, x7, x8;
50359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    int i = 8;
50459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    uint32 pred_word, dst_word;
50559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    int res, res2;
50659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
50759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    /* preset the offset, such that we can take advantage pre-offset addressing mode   */
50859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    rec -= lx;
50959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    blk -= 8;
51059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
51159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    while (i--)
51259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    {
51359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        x2 = blk[10];
51459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        blk[10] = 0;
51559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        x1 = blk[9];
51659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        blk[9] = 0;
51759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        x3 = blk[11];
51859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        blk[11] = 0;
51959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        x0 = ((*(blk += 8)) << 8) + 8192;
52059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        *blk = 0;   /* for proper rounding in the fourth stage */
52159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
52259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        x4 = x0;
52359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        x6 = (W6 * x2 + 4) >> 3;
52459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        x2 = (W2 * x2 + 4) >> 3;
52559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        x8 = x0 - x2;
52659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        x0 += x2;
52759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        x2 = x8;
52859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        x8 = x4 - x6;
52959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        x4 += x6;
53059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        x6 = x8;
53159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
53259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        x7 = (W7 * x1 + 4) >> 3;
53359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        x1 = (W1 * x1 + 4) >> 3;
53459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        x5 = (W3 * x3 + 4) >> 3;
53559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        x3 = (- W5 * x3 + 4) >> 3;
53659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        x8 = x1 - x5;
53759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        x1 += x5;
53859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        x5 = x8;
53959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        x8 = x7 - x3;
54059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        x3 += x7;
54159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        x7 = (181 * (x5 + x8) + 128) >> 8;
54259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        x5 = (181 * (x5 - x8) + 128) >> 8;
54359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
54459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        pred_word = *((uint32*)(rec += lx)); /* read 4 bytes from pred */
54559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        res = (x0 + x1) >> 14;
54659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        ADD_AND_CLIP1(res);
54759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        res2 = (x4 + x7) >> 14;
54859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        ADD_AND_CLIP2(res2);
54959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        dst_word = (res2 << 8) | res;
55059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        res = (x6 + x5) >> 14;
55159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        ADD_AND_CLIP3(res);
55259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        dst_word |= (res << 16);
55359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        res = (x2 + x3) >> 14;
55459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        ADD_AND_CLIP4(res);
55559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        dst_word |= (res << 24);
55659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        *((uint32*)rec) = dst_word; /* save 4 bytes to dst */
55759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
55859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        pred_word = *((uint32*)(rec + 4)); /* read 4 bytes from pred */
55959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        res = (x2 - x3) >> 14;
56059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        ADD_AND_CLIP1(res);
56159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        res2 = (x6 - x5) >> 14;
56259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        ADD_AND_CLIP2(res2);
56359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        dst_word = (res2 << 8) | res;
56459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        res = (x4 - x7) >> 14;
56559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        ADD_AND_CLIP3(res);
56659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        dst_word |= (res << 16);
56759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        res = (x0 - x1) >> 14;
56859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        ADD_AND_CLIP4(res);
56959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        dst_word |= (res << 24);
57059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        *((uint32*)(rec + 4)) = dst_word; /* save 4 bytes to dst */
57159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    }
57259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    return ;
57359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong}
57459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
57559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong#ifndef SMALL_DCT
57659f566c4ec3dfc097ad8163523e522280b27e5c3James Dongvoid idct_row0x40Inter(Short *blk, UChar *rec, Int lx)
57759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong{
57859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    int32 x1, x2, x4, x5;
57959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    int i = 8;
58059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    uint32 pred_word, dst_word;
58159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    int res, res2;
58259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
58359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    /* preset the offset, such that we can take advantage pre-offset addressing mode   */
58459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    rec -= lx;
58559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
58659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    while (i--)
58759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    {
58859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        /* shortcut */
58959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        x4 = blk[1];
59059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        blk[1] = 0;
59159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        blk += 8;  /* for proper rounding in the fourth stage */
59259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
59359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        /* first stage */
59459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        x5 = (W7 * x4 + 4) >> 3;
59559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        x4 = (W1 * x4 + 4) >> 3;
59659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
59759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        /* third stage */
59859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        x2 = (181 * (x4 + x5) + 128) >> 8;
59959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        x1 = (181 * (x4 - x5) + 128) >> 8;
60059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
60159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        /* fourth stage */
60259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        pred_word = *((uint32*)(rec += lx)); /* read 4 bytes from pred */
60359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        res = (8192 + x4) >> 14;
60459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        ADD_AND_CLIP1(res);
60559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        res2 = (8192 + x2) >> 14;
60659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        ADD_AND_CLIP2(res2);
60759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        dst_word = (res2 << 8) | res;
60859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        res = (8192 + x1) >> 14;
60959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        ADD_AND_CLIP3(res);
61059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        dst_word |= (res << 16);
61159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        res = (8192 + x5) >> 14;
61259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        ADD_AND_CLIP4(res);
61359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        dst_word |= (res << 24);
61459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        *((uint32*)rec) = dst_word; /* save 4 bytes to dst */
61559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
61659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        pred_word = *((uint32*)(rec + 4)); /* read 4 bytes from pred */
61759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        res = (8192 - x5) >> 14;
61859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        ADD_AND_CLIP1(res);
61959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        res2 = (8192 - x1) >> 14;
62059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        ADD_AND_CLIP2(res2);
62159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        dst_word = (res2 << 8) | res;
62259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        res = (8192 - x2) >> 14;
62359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        ADD_AND_CLIP3(res);
62459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        dst_word |= (res << 16);
62559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        res = (8192 - x4) >> 14;
62659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        ADD_AND_CLIP4(res);
62759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        dst_word |= (res << 24);
62859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        *((uint32*)(rec + 4)) = dst_word; /* save 4 bytes to dst */
62959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    }
63059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    return ;
63159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong}
63259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
63359f566c4ec3dfc097ad8163523e522280b27e5c3James Dongvoid idct_row0x20Inter(Short *blk, UChar *rec, Int lx)
63459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong{
63559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    int32 x0, x2, x4, x6;
63659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    int i = 8;
63759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    uint32 pred_word, dst_word;
63859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    int res, res2;
63959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
64059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    /* preset the offset, such that we can take advantage pre-offset addressing mode   */
64159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    rec -= lx;
64259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
64359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    while (i--)
64459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    {
64559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        x2 = blk[2];
64659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        blk[2] = 0;
64759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        blk += 8; /* for proper rounding in the fourth stage */
64859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        /* both upper and lower*/
64959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        /* both x2orx6 and x0orx4 */
65059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        x6 = (W6 * x2 + 4) >> 3;
65159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        x2 = (W2 * x2 + 4) >> 3;
65259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        x0 = 8192 + x2;
65359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        x2 = 8192 - x2;
65459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        x4 = 8192 + x6;
65559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        x6 = 8192 - x6;
65659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
65759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        pred_word = *((uint32*)(rec += lx)); /* read 4 bytes from pred */
65859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        res = (x0) >> 14;
65959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        ADD_AND_CLIP1(res);
66059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        res2 = (x4) >> 14;
66159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        ADD_AND_CLIP2(res2);
66259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        dst_word = (res2 << 8) | res;
66359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        res = (x6) >> 14;
66459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        ADD_AND_CLIP3(res);
66559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        dst_word |= (res << 16);
66659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        res = (x2) >> 14;
66759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        ADD_AND_CLIP4(res);
66859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        dst_word |= (res << 24);
66959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        *((uint32*)rec) = dst_word; /* save 4 bytes to dst */
67059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
67159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        pred_word = *((uint32*)(rec + 4)); /* read 4 bytes from pred */
67259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        res = (x2) >> 14;
67359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        ADD_AND_CLIP1(res);
67459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        res2 = (x6) >> 14;
67559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        ADD_AND_CLIP2(res2);
67659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        dst_word = (res2 << 8) | res;
67759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        res = (x4) >> 14;
67859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        ADD_AND_CLIP3(res);
67959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        dst_word |= (res << 16);
68059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        res = (x0) >> 14;
68159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        ADD_AND_CLIP4(res);
68259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        dst_word |= (res << 24);
68359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        *((uint32*)(rec + 4)) = dst_word; /* save 4 bytes to dst */
68459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    }
68559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
68659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    return ;
68759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong}
68859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
68959f566c4ec3dfc097ad8163523e522280b27e5c3James Dongvoid idct_row0x10Inter(Short *blk, UChar *rec, Int lx)
69059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong{
69159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    int32 x1, x3, x5, x7;
69259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    int i = 8;
69359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    uint32 pred_word, dst_word;
69459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    int res, res2;
69559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
69659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    /* preset the offset, such that we can take advantage pre-offset addressing mode   */
69759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    rec -= lx;
69859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
69959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    while (i--)
70059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    {
70159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        x3 = blk[3];
70259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        blk[3] = 0;
70359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        blk += 8;
70459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
70559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        x1 = (W3 * x3 + 4) >> 3;
70659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        x3 = (-W5 * x3 + 4) >> 3;
70759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
70859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        x7 = (-181 * (x3 + x1) + 128) >> 8;
70959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        x5 = (181 * (x3 - x1) + 128) >> 8;
71059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
71159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        pred_word = *((uint32*)(rec += lx)); /* read 4 bytes from pred */
71259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        res = (8192 + x1) >> 14;
71359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        ADD_AND_CLIP1(res);
71459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        res2 = (8192 + x7) >> 14;
71559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        ADD_AND_CLIP2(res2);
71659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        dst_word = (res2 << 8) | res;
71759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        res = (8192 + x5) >> 14;
71859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        ADD_AND_CLIP3(res);
71959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        dst_word |= (res << 16);
72059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        res = (8192 + x3) >> 14;
72159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        ADD_AND_CLIP4(res);
72259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        dst_word |= (res << 24);
72359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        *((uint32*)rec) = dst_word; /* save 4 bytes to dst */
72459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
72559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        pred_word = *((uint32*)(rec + 4)); /* read 4 bytes from pred */
72659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        res = (8192 - x3) >> 14;
72759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        ADD_AND_CLIP1(res);
72859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        res2 = (8192 - x5) >> 14;
72959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        ADD_AND_CLIP2(res2);
73059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        dst_word = (res2 << 8) | res;
73159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        res = (8192 - x7) >> 14;
73259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        ADD_AND_CLIP3(res);
73359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        dst_word |= (res << 16);
73459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        res = (8192 - x1) >> 14;
73559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        ADD_AND_CLIP4(res);
73659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        dst_word |= (res << 24);
73759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        *((uint32*)(rec + 4)) = dst_word; /* save 4 bytes to dst */
73859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    }
73959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    return ;
74059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong}
74159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
74259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong#endif /* SMALL_DCT */
74359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
74459f566c4ec3dfc097ad8163523e522280b27e5c3James Dongvoid idct_rowInter(Short *blk, UChar *rec, Int lx)
74559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong{
74659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    int32 x0, x1, x2, x3, x4, x5, x6, x7, x8;
74759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    int i = 8;
74859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    uint32 pred_word, dst_word;
74959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    int res, res2;
75059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
75159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    /* preset the offset, such that we can take advantage pre-offset addressing mode   */
75259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    rec -= lx;
75359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    blk -= 8;
75459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
75559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    while (i--)
75659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    {
75759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        x1 = (int32)blk[12] << 8;
75859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        blk[12] = 0;
75959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        x2 = blk[14];
76059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        blk[14] = 0;
76159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        x3 = blk[10];
76259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        blk[10] = 0;
76359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        x4 = blk[9];
76459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        blk[9] = 0;
76559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        x5 = blk[15];
76659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        blk[15] = 0;
76759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        x6 = blk[13];
76859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        blk[13] = 0;
76959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        x7 = blk[11];
77059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        blk[11] = 0;
77159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        x0 = ((*(blk += 8)) << 8) + 8192;
77259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        *blk = 0;   /* for proper rounding in the fourth stage */
77359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
77459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        /* first stage */
77559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        x8 = W7 * (x4 + x5) + 4;
77659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        x4 = (x8 + (W1 - W7) * x4) >> 3;
77759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        x5 = (x8 - (W1 + W7) * x5) >> 3;
77859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        x8 = W3 * (x6 + x7) + 4;
77959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        x6 = (x8 - (W3 - W5) * x6) >> 3;
78059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        x7 = (x8 - (W3 + W5) * x7) >> 3;
78159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
78259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        /* second stage */
78359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        x8 = x0 + x1;
78459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        x0 -= x1;
78559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        x1 = W6 * (x3 + x2) + 4;
78659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        x2 = (x1 - (W2 + W6) * x2) >> 3;
78759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        x3 = (x1 + (W2 - W6) * x3) >> 3;
78859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        x1 = x4 + x6;
78959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        x4 -= x6;
79059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        x6 = x5 + x7;
79159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        x5 -= x7;
79259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
79359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        /* third stage */
79459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        x7 = x8 + x3;
79559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        x8 -= x3;
79659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        x3 = x0 + x2;
79759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        x0 -= x2;
79859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        x2 = (181 * (x4 + x5) + 128) >> 8;
79959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        x4 = (181 * (x4 - x5) + 128) >> 8;
80059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
80159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        /* fourth stage */
80259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        pred_word = *((uint32*)(rec += lx)); /* read 4 bytes from pred */
80359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
80459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        res = (x7 + x1) >> 14;
80559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        ADD_AND_CLIP1(res);
80659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        res2 = (x3 + x2) >> 14;
80759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        ADD_AND_CLIP2(res2);
80859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        dst_word = (res2 << 8) | res;
80959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        res = (x0 + x4) >> 14;
81059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        ADD_AND_CLIP3(res);
81159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        dst_word |= (res << 16);
81259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        res = (x8 + x6) >> 14;
81359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        ADD_AND_CLIP4(res);
81459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        dst_word |= (res << 24);
81559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        *((uint32*)rec) = dst_word; /* save 4 bytes to dst */
81659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
81759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        pred_word = *((uint32*)(rec + 4)); /* read 4 bytes from pred */
81859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
81959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        res = (x8 - x6) >> 14;
82059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        ADD_AND_CLIP1(res);
82159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        res2 = (x0 - x4) >> 14;
82259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        ADD_AND_CLIP2(res2);
82359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        dst_word = (res2 << 8) | res;
82459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        res = (x3 - x2) >> 14;
82559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        ADD_AND_CLIP3(res);
82659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        dst_word |= (res << 16);
82759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        res = (x7 - x1) >> 14;
82859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        ADD_AND_CLIP4(res);
82959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        dst_word |= (res << 24);
83059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        *((uint32*)(rec + 4)) = dst_word; /* save 4 bytes to dst */
83159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    }
83259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    return;
83359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong}
83459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
83559f566c4ec3dfc097ad8163523e522280b27e5c3James Dongvoid idct_row0Intra(Short *srce, UChar *rec, Int lx)
83659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong{
83759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    OSCL_UNUSED_ARG(srce);
83859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
83959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    OSCL_UNUSED_ARG(rec);
84059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
84159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    OSCL_UNUSED_ARG(lx);
84259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
84359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    return;
84459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong}
84559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
84659f566c4ec3dfc097ad8163523e522280b27e5c3James Dongvoid idct_row1Intra(Short *blk, UChar *rec, Int lx)
84759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong{
84859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    int32 tmp;
84959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    int i = 8;
85059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
85159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    rec -= lx;
85259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    blk -= 8;
85359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    while (i--)
85459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    {
85559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        tmp = ((*(blk += 8) + 32) >> 6);
85659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        *blk = 0;
85759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        CLIP_RESULT(tmp)
85859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
85959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        tmp |= (tmp << 8);
86059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        tmp |= (tmp << 16);
86159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        *((uint32*)(rec += lx)) = tmp;
86259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        *((uint32*)(rec + 4)) = tmp;
86359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    }
86459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    return;
86559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong}
86659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
86759f566c4ec3dfc097ad8163523e522280b27e5c3James Dongvoid idct_row2Intra(Short *blk, UChar *rec, Int lx)
86859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong{
86959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    int32 x0, x1, x2, x4, x5;
87059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    int res, res2;
87159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    uint32 dst_word;
87259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    int i = 8;
87359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
87459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    rec -= lx;
87559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    blk -= 8;
87659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    while (i--)
87759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    {
87859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        /* shortcut */
87959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        x4 = blk[9];
88059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        blk[9] = 0;
88159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        x0 = ((*(blk += 8)) << 8) + 8192;
88259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        *blk = 0;   /* for proper rounding in the fourth stage */
88359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
88459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        /* first stage */
88559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        x5 = (W7 * x4 + 4) >> 3;
88659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        x4 = (W1 * x4 + 4) >> 3;
88759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
88859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        /* third stage */
88959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        x2 = (181 * (x4 + x5) + 128) >> 8;
89059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        x1 = (181 * (x4 - x5) + 128) >> 8;
89159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
89259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        /* fourth stage */
89359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        res = ((x0 + x4) >> 14);
89459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        CLIP_RESULT(res)
89559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        res2 = ((x0 + x2) >> 14);
89659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        CLIP_RESULT(res2)
89759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        dst_word = (res2 << 8) | res;
89859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        res = ((x0 + x1) >> 14);
89959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        CLIP_RESULT(res)
90059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        dst_word |= (res << 16);
90159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        res = ((x0 + x5) >> 14);
90259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        CLIP_RESULT(res)
90359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        dst_word |= (res << 24);
90459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        *((uint32*)(rec += lx)) = dst_word;
90559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
90659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        res = ((x0 - x5) >> 14);
90759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        CLIP_RESULT(res)
90859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        res2 = ((x0 - x1) >> 14);
90959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        CLIP_RESULT(res2)
91059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        dst_word = (res2 << 8) | res;
91159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        res = ((x0 - x2) >> 14);
91259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        CLIP_RESULT(res)
91359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        dst_word |= (res << 16);
91459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        res = ((x0 - x4) >> 14);
91559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        CLIP_RESULT(res)
91659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        dst_word |= (res << 24);
91759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        *((uint32*)(rec + 4)) = dst_word;
91859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    }
91959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    return ;
92059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong}
92159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
92259f566c4ec3dfc097ad8163523e522280b27e5c3James Dongvoid idct_row3Intra(Short *blk, UChar *rec, Int lx)
92359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong{
92459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    int32 x0, x1, x2, x3, x4, x5, x6, x7, x8;
92559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    int res, res2;
92659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    uint32 dst_word;
92759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    int i = 8;
92859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
92959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    rec -= lx;
93059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    blk -= 8;
93159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    while (i--)
93259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    {
93359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        x2 = blk[10];
93459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        blk[10] = 0;
93559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        x1 = blk[9];
93659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        blk[9] = 0;
93759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        x0 = ((*(blk += 8)) << 8) + 8192;
93859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        *blk = 0;/* for proper rounding in the fourth stage */
93959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        /* both upper and lower*/
94059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        /* both x2orx6 and x0orx4 */
94159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
94259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        x4 = x0;
94359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        x6 = (W6 * x2 + 4) >> 3;
94459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        x2 = (W2 * x2 + 4) >> 3;
94559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        x8 = x0 - x2;
94659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        x0 += x2;
94759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        x2 = x8;
94859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        x8 = x4 - x6;
94959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        x4 += x6;
95059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        x6 = x8;
95159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
95259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        x7 = (W7 * x1 + 4) >> 3;
95359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        x1 = (W1 * x1 + 4) >> 3;
95459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        x3 = x7;
95559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        x5 = (181 * (x1 - x7) + 128) >> 8;
95659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        x7 = (181 * (x1 + x7) + 128) >> 8;
95759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
95859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        res = ((x0 + x1) >> 14);
95959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        CLIP_RESULT(res)
96059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        res2 = ((x4 + x7) >> 14);
96159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        CLIP_RESULT(res2)
96259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        dst_word = (res2 << 8) | res;
96359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        res = ((x6 + x5) >> 14);
96459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        CLIP_RESULT(res)
96559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        dst_word |= (res << 16);
96659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        res = ((x2 + x3) >> 14);
96759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        CLIP_RESULT(res)
96859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        dst_word |= (res << 24);
96959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        *((uint32*)(rec += lx)) = dst_word;
97059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
97159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        res = ((x2 - x3) >> 14);
97259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        CLIP_RESULT(res)
97359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        res2 = ((x6 - x5) >> 14);
97459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        CLIP_RESULT(res2)
97559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        dst_word = (res2 << 8) | res;
97659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        res = ((x4 - x7) >> 14);
97759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        CLIP_RESULT(res)
97859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        dst_word |= (res << 16);
97959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        res = ((x0 - x1) >> 14);
98059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        CLIP_RESULT(res)
98159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        dst_word |= (res << 24);
98259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        *((uint32*)(rec + 4)) = dst_word;
98359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
98459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    }
98559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    return ;
98659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong}
98759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
98859f566c4ec3dfc097ad8163523e522280b27e5c3James Dongvoid idct_row4Intra(Short *blk, UChar *rec, Int lx)
98959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong{
99059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    int32 x0, x1, x2, x3, x4, x5, x6, x7, x8;
99159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    int res, res2;
99259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    uint32 dst_word;
99359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    int i = 8;
99459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
99559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    rec -= lx;
99659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    blk -= 8;
99759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    while (i--)
99859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    {
99959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        x2 = blk[10];
100059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        blk[10] = 0;
100159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        x1 = blk[9];
100259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        blk[9] = 0;
100359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        x3 = blk[11];
100459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        blk[11] = 0;
100559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        x0 = ((*(blk += 8)) << 8) + 8192;
100659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        *blk = 0; /* for proper rounding in the fourth stage */
100759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
100859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        x4 = x0;
100959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        x6 = (W6 * x2 + 4) >> 3;
101059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        x2 = (W2 * x2 + 4) >> 3;
101159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        x8 = x0 - x2;
101259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        x0 += x2;
101359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        x2 = x8;
101459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        x8 = x4 - x6;
101559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        x4 += x6;
101659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        x6 = x8;
101759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
101859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        x7 = (W7 * x1 + 4) >> 3;
101959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        x1 = (W1 * x1 + 4) >> 3;
102059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        x5 = (W3 * x3 + 4) >> 3;
102159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        x3 = (- W5 * x3 + 4) >> 3;
102259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        x8 = x1 - x5;
102359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        x1 += x5;
102459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        x5 = x8;
102559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        x8 = x7 - x3;
102659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        x3 += x7;
102759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        x7 = (181 * (x5 + x8) + 128) >> 8;
102859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        x5 = (181 * (x5 - x8) + 128) >> 8;
102959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
103059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        res = ((x0 + x1) >> 14);
103159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        CLIP_RESULT(res)
103259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        res2 = ((x4 + x7) >> 14);
103359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        CLIP_RESULT(res2)
103459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        dst_word = (res2 << 8) | res;
103559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        res = ((x6 + x5) >> 14);
103659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        CLIP_RESULT(res)
103759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        dst_word |= (res << 16);
103859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        res = ((x2 + x3) >> 14);
103959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        CLIP_RESULT(res)
104059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        dst_word |= (res << 24);
104159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        *((uint32*)(rec += lx)) = dst_word;
104259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
104359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        res = ((x2 - x3) >> 14);
104459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        CLIP_RESULT(res)
104559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        res2 = ((x6 - x5) >> 14);
104659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        CLIP_RESULT(res2)
104759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        dst_word = (res2 << 8) | res;
104859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        res = ((x4 - x7) >> 14);
104959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        CLIP_RESULT(res)
105059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        dst_word |= (res << 16);
105159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        res = ((x0 - x1) >> 14);
105259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        CLIP_RESULT(res)
105359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        dst_word |= (res << 24);
105459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        *((uint32*)(rec + 4)) = dst_word;
105559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    }
105659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
105759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    return ;
105859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong}
105959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
106059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong#ifndef SMALL_DCT
106159f566c4ec3dfc097ad8163523e522280b27e5c3James Dongvoid idct_row0x40Intra(Short *blk, UChar *rec, Int lx)
106259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong{
106359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    int32  x1, x2, x4, x5;
106459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    int res, res2;
106559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    uint32 dst_word;
106659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    int i = 8;
106759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
106859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    rec -= lx;
106959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
107059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    while (i--)
107159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    {
107259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        /* shortcut */
107359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        x4 = blk[1];
107459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        blk[1] = 0;
107559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        blk += 8;
107659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
107759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        /* first stage */
107859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        x5 = (W7 * x4 + 4) >> 3;
107959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        x4 = (W1 * x4 + 4) >> 3;
108059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
108159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        /* third stage */
108259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        x2 = (181 * (x4 + x5) + 128) >> 8;
108359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        x1 = (181 * (x4 - x5) + 128) >> 8;
108459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
108559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        /* fourth stage */
108659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        res = ((8192 + x4) >> 14);
108759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        CLIP_RESULT(res)
108859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        res2 = ((8192 + x2) >> 14);
108959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        CLIP_RESULT(res2)
109059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        dst_word = (res2 << 8) | res;
109159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        res = ((8192 + x1) >> 14);
109259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        CLIP_RESULT(res)
109359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        dst_word |= (res << 16);
109459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        res = ((8192 + x5) >> 14);
109559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        CLIP_RESULT(res)
109659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        dst_word |= (res << 24);
109759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        *((uint32*)(rec += lx)) = dst_word;
109859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
109959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        res = ((8192 - x5) >> 14);
110059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        CLIP_RESULT(res)
110159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        res2 = ((8192 - x1) >> 14);
110259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        CLIP_RESULT(res2)
110359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        dst_word = (res2 << 8) | res;
110459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        res = ((8192 - x2) >> 14);
110559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        CLIP_RESULT(res)
110659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        dst_word |= (res << 16);
110759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        res = ((8192 - x4) >> 14);
110859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        CLIP_RESULT(res)
110959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        dst_word |= (res << 24);
111059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        *((uint32*)(rec + 4)) = dst_word;
111159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
111259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    }
111359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    return ;
111459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong}
111559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
111659f566c4ec3dfc097ad8163523e522280b27e5c3James Dongvoid idct_row0x20Intra(Short *blk, UChar *rec, Int lx)
111759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong{
111859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    int32 x0, x2, x4, x6;
111959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    int res, res2;
112059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    uint32 dst_word;
112159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    int i = 8;
112259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
112359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    rec -= lx;
112459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    while (i--)
112559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    {
112659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        x2 = blk[2];
112759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        blk[2] = 0;
112859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        blk += 8;
112959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
113059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        /* both upper and lower*/
113159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        /* both x2orx6 and x0orx4 */
113259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        x6 = (W6 * x2 + 4) >> 3;
113359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        x2 = (W2 * x2 + 4) >> 3;
113459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        x0 = 8192 + x2;
113559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        x2 = 8192 - x2;
113659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        x4 = 8192 + x6;
113759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        x6 = 8192 - x6;
113859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
113959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        res = ((x0) >> 14);
114059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        CLIP_RESULT(res)
114159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        res2 = ((x4) >> 14);
114259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        CLIP_RESULT(res2)
114359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        dst_word = (res2 << 8) | res;
114459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        res = ((x6) >> 14);
114559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        CLIP_RESULT(res)
114659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        dst_word |= (res << 16);
114759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        res = ((x2) >> 14);
114859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        CLIP_RESULT(res)
114959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        dst_word |= (res << 24);
115059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        *((uint32*)(rec += lx)) = dst_word;
115159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
115259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        res = ((x2) >> 14);
115359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        CLIP_RESULT(res)
115459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        res2 = ((x6) >> 14);
115559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        CLIP_RESULT(res2)
115659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        dst_word = (res2 << 8) | res;
115759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        res = ((x4) >> 14);
115859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        CLIP_RESULT(res)
115959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        dst_word |= (res << 16);
116059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        res = ((x0) >> 14);
116159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        CLIP_RESULT(res)
116259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        dst_word |= (res << 24);
116359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        *((uint32*)(rec + 4)) = dst_word;
116459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
116559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    }
116659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    return ;
116759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong}
116859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
116959f566c4ec3dfc097ad8163523e522280b27e5c3James Dongvoid idct_row0x10Intra(Short *blk, UChar *rec, Int lx)
117059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong{
117159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    int32 x1, x3, x5, x7;
117259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    int res, res2;
117359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    uint32 dst_word;
117459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    int i = 8;
117559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
117659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    rec -= lx;
117759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    while (i--)
117859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    {
117959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        x3 = blk[3];
118059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        blk[3] = 0 ;
118159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong        blk += 8;
118259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
1183