Revision ca32f7f2 libavcodec/h264idct.c

View differences:

libavcodec/h264idct.c
34 34
    block[0] += 1<<(shift-1);
35 35

  
36 36
    for(i=0; i<4; i++){
37
        const int z0=  block[0 + block_stride*i]     +  block[2 + block_stride*i];
38
        const int z1=  block[0 + block_stride*i]     -  block[2 + block_stride*i];
39
        const int z2= (block[1 + block_stride*i]>>1) -  block[3 + block_stride*i];
40
        const int z3=  block[1 + block_stride*i]     + (block[3 + block_stride*i]>>1);
41

  
42
        block[0 + block_stride*i]= z0 + z3;
43
        block[1 + block_stride*i]= z1 + z2;
44
        block[2 + block_stride*i]= z1 - z2;
45
        block[3 + block_stride*i]= z0 - z3;
46
    }
47

  
48
    for(i=0; i<4; i++){
49 37
        const int z0=  block[i + block_stride*0]     +  block[i + block_stride*2];
50 38
        const int z1=  block[i + block_stride*0]     -  block[i + block_stride*2];
51 39
        const int z2= (block[i + block_stride*1]>>1) -  block[i + block_stride*3];
52 40
        const int z3=  block[i + block_stride*1]     + (block[i + block_stride*3]>>1);
53 41

  
42
        block[i + block_stride*0]= z0 + z3;
43
        block[i + block_stride*1]= z1 + z2;
44
        block[i + block_stride*2]= z1 - z2;
45
        block[i + block_stride*3]= z0 - z3;
46
    }
47

  
48
    for(i=0; i<4; i++){
49
        const int z0=  block[0 + block_stride*i]     +  block[2 + block_stride*i];
50
        const int z1=  block[0 + block_stride*i]     -  block[2 + block_stride*i];
51
        const int z2= (block[1 + block_stride*i]>>1) -  block[3 + block_stride*i];
52
        const int z3=  block[1 + block_stride*i]     + (block[3 + block_stride*i]>>1);
53

  
54 54
        dst[i + 0*stride]= cm[ add*dst[i + 0*stride] + ((z0 + z3) >> shift) ];
55 55
        dst[i + 1*stride]= cm[ add*dst[i + 1*stride] + ((z1 + z2) >> shift) ];
56 56
        dst[i + 2*stride]= cm[ add*dst[i + 2*stride] + ((z1 - z2) >> shift) ];
......
78 78

  
79 79
    for( i = 0; i < 8; i++ )
80 80
    {
81
        const int a0 =  block[0+i*8] + block[4+i*8];
82
        const int a2 =  block[0+i*8] - block[4+i*8];
83
        const int a4 = (block[2+i*8]>>1) - block[6+i*8];
84
        const int a6 = (block[6+i*8]>>1) + block[2+i*8];
81
        const int a0 =  block[i+0*8] + block[i+4*8];
82
        const int a2 =  block[i+0*8] - block[i+4*8];
83
        const int a4 = (block[i+2*8]>>1) - block[i+6*8];
84
        const int a6 = (block[i+6*8]>>1) + block[i+2*8];
85 85

  
86 86
        const int b0 = a0 + a6;
87 87
        const int b2 = a2 + a4;
88 88
        const int b4 = a2 - a4;
89 89
        const int b6 = a0 - a6;
90 90

  
91
        const int a1 = -block[3+i*8] + block[5+i*8] - block[7+i*8] - (block[7+i*8]>>1);
92
        const int a3 =  block[1+i*8] + block[7+i*8] - block[3+i*8] - (block[3+i*8]>>1);
93
        const int a5 = -block[1+i*8] + block[7+i*8] + block[5+i*8] + (block[5+i*8]>>1);
94
        const int a7 =  block[3+i*8] + block[5+i*8] + block[1+i*8] + (block[1+i*8]>>1);
91
        const int a1 = -block[i+3*8] + block[i+5*8] - block[i+7*8] - (block[i+7*8]>>1);
92
        const int a3 =  block[i+1*8] + block[i+7*8] - block[i+3*8] - (block[i+3*8]>>1);
93
        const int a5 = -block[i+1*8] + block[i+7*8] + block[i+5*8] + (block[i+5*8]>>1);
94
        const int a7 =  block[i+3*8] + block[i+5*8] + block[i+1*8] + (block[i+1*8]>>1);
95 95

  
96 96
        const int b1 = (a7>>2) + a1;
97 97
        const int b3 =  a3 + (a5>>2);
98 98
        const int b5 = (a3>>2) - a5;
99 99
        const int b7 =  a7 - (a1>>2);
100 100

  
101
        block[0+i*8] = b0 + b7;
102
        block[7+i*8] = b0 - b7;
103
        block[1+i*8] = b2 + b5;
104
        block[6+i*8] = b2 - b5;
105
        block[2+i*8] = b4 + b3;
106
        block[5+i*8] = b4 - b3;
107
        block[3+i*8] = b6 + b1;
108
        block[4+i*8] = b6 - b1;
101
        block[i+0*8] = b0 + b7;
102
        block[i+7*8] = b0 - b7;
103
        block[i+1*8] = b2 + b5;
104
        block[i+6*8] = b2 - b5;
105
        block[i+2*8] = b4 + b3;
106
        block[i+5*8] = b4 - b3;
107
        block[i+3*8] = b6 + b1;
108
        block[i+4*8] = b6 - b1;
109 109
    }
110 110
    for( i = 0; i < 8; i++ )
111 111
    {
112
        const int a0 =  block[i+0*8] + block[i+4*8];
113
        const int a2 =  block[i+0*8] - block[i+4*8];
114
        const int a4 = (block[i+2*8]>>1) - block[i+6*8];
115
        const int a6 = (block[i+6*8]>>1) + block[i+2*8];
112
        const int a0 =  block[0+i*8] + block[4+i*8];
113
        const int a2 =  block[0+i*8] - block[4+i*8];
114
        const int a4 = (block[2+i*8]>>1) - block[6+i*8];
115
        const int a6 = (block[6+i*8]>>1) + block[2+i*8];
116 116

  
117 117
        const int b0 = a0 + a6;
118 118
        const int b2 = a2 + a4;
119 119
        const int b4 = a2 - a4;
120 120
        const int b6 = a0 - a6;
121 121

  
122
        const int a1 = -block[i+3*8] + block[i+5*8] - block[i+7*8] - (block[i+7*8]>>1);
123
        const int a3 =  block[i+1*8] + block[i+7*8] - block[i+3*8] - (block[i+3*8]>>1);
124
        const int a5 = -block[i+1*8] + block[i+7*8] + block[i+5*8] + (block[i+5*8]>>1);
125
        const int a7 =  block[i+3*8] + block[i+5*8] + block[i+1*8] + (block[i+1*8]>>1);
122
        const int a1 = -block[3+i*8] + block[5+i*8] - block[7+i*8] - (block[7+i*8]>>1);
123
        const int a3 =  block[1+i*8] + block[7+i*8] - block[3+i*8] - (block[3+i*8]>>1);
124
        const int a5 = -block[1+i*8] + block[7+i*8] + block[5+i*8] + (block[5+i*8]>>1);
125
        const int a7 =  block[3+i*8] + block[5+i*8] + block[1+i*8] + (block[1+i*8]>>1);
126 126

  
127 127
        const int b1 = (a7>>2) + a1;
128 128
        const int b3 =  a3 + (a5>>2);

Also available in: Unified diff