Doxygen Source Code Documentation
idct.c File Reference
#include "config.h"#include <stdlib.h>#include <inttypes.h>#include "mpeg2.h"#include "mpeg2_internal.h"#include "attributes.h"Go to the source code of this file.
| Defines | |
| #define | W1 2841 | 
| #define | W2 2676 | 
| #define | W3 2408 | 
| #define | W5 1609 | 
| #define | W6 1108 | 
| #define | W7 565 | 
| #define | CLIP(i) ((clip_lut+384)[(i)]) | 
| #define | BUTTERFLY(t0, t1, W0, W1, d0, d1) | 
| Functions | |
| void | idct_row (int16_t *const block) | 
| void | idct_col (int16_t *const block) | 
| void | mpeg2_idct_copy_c (int16_t *block, uint8_t *dest, const int stride) | 
| void | mpeg2_idct_add_c (const int last, int16_t *block, uint8_t *dest, const int stride) | 
| void | mpeg2_idct_init (uint32_t accel) | 
| Variables | |
| void(* | mpeg2_idct_copy )(int16_t *block, uint8_t *dest, int stride) | 
| void(* | mpeg2_idct_add )(int last, int16_t *block, uint8_t *dest, int stride) | 
| uint8_t | clip_lut [1024] | 
Define Documentation
| 
 | 
| Value: do { \ int tmp = W0 * (d0 + d1); \ t0 = tmp + (W1 - W0) * d1; \ t1 = tmp - (W1 + W0) * d0; \ } while (0) Definition at line 55 of file idct.c. Referenced by idct_col(), and idct_row(). | 
| 
 | 
| 
 Definition at line 46 of file idct.c. Referenced by mpeg2_idct_add_c(), mpeg2_idct_copy_c(), mri_warp3D_cubic(), mri_warp3D_linear(), mri_warp3D_NN(), and mri_warp3D_quintic(). | 
| 
 | 
| 
 Definition at line 33 of file idct.c. Referenced by idct_col(), and idct_row(). | 
| 
 | 
| 
 Definition at line 34 of file idct.c. Referenced by idct_col(), and idct_row(). | 
| 
 | 
| 
 Definition at line 35 of file idct.c. Referenced by idct_col(), and idct_row(). | 
| 
 | 
| 
 Definition at line 36 of file idct.c. Referenced by idct_col(), and idct_row(). | 
| 
 | 
| 
 Definition at line 37 of file idct.c. Referenced by idct_col(), and idct_row(). | 
| 
 | 
| 
 Definition at line 38 of file idct.c. Referenced by idct_col(), and idct_row(). | 
Function Documentation
| 
 | 
| 
 Definition at line 116 of file idct.c. References a2, BUTTERFLY, W1, W2, W3, W5, W6, and W7. Referenced by mpeg2_idct_add_c(), and mpeg2_idct_copy_c(). 
 00117 {
00118     int d0, d1, d2, d3;
00119     int a0, a1, a2, a3, b0, b1, b2, b3;
00120     int t0, t1, t2, t3;
00121 
00122     d0 = (block[8*0] << 11) + 65536;
00123     d1 = block[8*1];
00124     d2 = block[8*2] << 11;
00125     d3 = block[8*3];
00126     t0 = d0 + d2;
00127     t1 = d0 - d2;
00128     BUTTERFLY (t2, t3, W6, W2, d3, d1);
00129     a0 = t0 + t2;
00130     a1 = t1 + t3;
00131     a2 = t1 - t3;
00132     a3 = t0 - t2;
00133 
00134     d0 = block[8*4];
00135     d1 = block[8*5];
00136     d2 = block[8*6];
00137     d3 = block[8*7];
00138     BUTTERFLY (t0, t1, W7, W1, d3, d0);
00139     BUTTERFLY (t2, t3, W3, W5, d1, d2);
00140     b0 = t0 + t2;
00141     b3 = t1 + t3;
00142     t0 = (t0 - t2) >> 8;
00143     t1 = (t1 - t3) >> 8;
00144     b1 = (t0 + t1) * 181;
00145     b2 = (t0 - t1) * 181;
00146 
00147     block[8*0] = (a0 + b0) >> 17;
00148     block[8*1] = (a1 + b1) >> 17;
00149     block[8*2] = (a2 + b2) >> 17;
00150     block[8*3] = (a3 + b3) >> 17;
00151     block[8*4] = (a3 - b3) >> 17;
00152     block[8*5] = (a2 - b2) >> 17;
00153     block[8*6] = (a1 - b1) >> 17;
00154     block[8*7] = (a0 - b0) >> 17;
00155 }
 | 
| 
 | 
| 
 Definition at line 63 of file idct.c. References a2, BUTTERFLY, likely, uint32_t, W1, W2, W3, W5, W6, and W7. Referenced by mpeg2_idct_add_c(), and mpeg2_idct_copy_c(). 
 00064 {
00065     int d0, d1, d2, d3;
00066     int a0, a1, a2, a3, b0, b1, b2, b3;
00067     int t0, t1, t2, t3;
00068 
00069     /* shortcut */
00070     if (likely (!(block[1] | ((int32_t *)block)[1] | ((int32_t *)block)[2] |
00071                   ((int32_t *)block)[3]))) {
00072         uint32_t tmp = (uint16_t) (block[0] << 3);
00073         tmp |= tmp << 16;
00074         ((int32_t *)block)[0] = tmp;
00075         ((int32_t *)block)[1] = tmp;
00076         ((int32_t *)block)[2] = tmp;
00077         ((int32_t *)block)[3] = tmp;
00078         return;
00079     }
00080 
00081     d0 = (block[0] << 11) + 128;
00082     d1 = block[1];
00083     d2 = block[2] << 11;
00084     d3 = block[3];
00085     t0 = d0 + d2;
00086     t1 = d0 - d2;
00087     BUTTERFLY (t2, t3, W6, W2, d3, d1);
00088     a0 = t0 + t2;
00089     a1 = t1 + t3;
00090     a2 = t1 - t3;
00091     a3 = t0 - t2;
00092 
00093     d0 = block[4];
00094     d1 = block[5];
00095     d2 = block[6];
00096     d3 = block[7];
00097     BUTTERFLY (t0, t1, W7, W1, d3, d0);
00098     BUTTERFLY (t2, t3, W3, W5, d1, d2);
00099     b0 = t0 + t2;
00100     b3 = t1 + t3;
00101     t0 -= t2;
00102     t1 -= t3;
00103     b1 = ((t0 + t1) * 181) >> 8;
00104     b2 = ((t0 - t1) * 181) >> 8;
00105 
00106     block[0] = (a0 + b0) >> 8;
00107     block[1] = (a1 + b1) >> 8;
00108     block[2] = (a2 + b2) >> 8;
00109     block[3] = (a3 + b3) >> 8;
00110     block[4] = (a3 - b3) >> 8;
00111     block[5] = (a2 - b2) >> 8;
00112     block[6] = (a1 - b1) >> 8;
00113     block[7] = (a0 - b0) >> 8;
00114 }
 | 
| 
 | ||||||||||||||||||||
| 
 Definition at line 184 of file idct.c. References CLIP, i, idct_col(), idct_row(), stride, and uint8_t. Referenced by mpeg2_idct_init(). 
 00186 {
00187     int i;
00188 
00189     if (last != 129 || (block[0] & 7) == 4) {
00190         for (i = 0; i < 8; i++)
00191             idct_row (block + 8 * i);
00192         for (i = 0; i < 8; i++)
00193             idct_col (block + i);
00194         do {
00195             dest[0] = CLIP (block[0] + dest[0]);
00196             dest[1] = CLIP (block[1] + dest[1]);
00197             dest[2] = CLIP (block[2] + dest[2]);
00198             dest[3] = CLIP (block[3] + dest[3]);
00199             dest[4] = CLIP (block[4] + dest[4]);
00200             dest[5] = CLIP (block[5] + dest[5]);
00201             dest[6] = CLIP (block[6] + dest[6]);
00202             dest[7] = CLIP (block[7] + dest[7]);
00203 
00204             block[0] = 0;       block[1] = 0;   block[2] = 0;   block[3] = 0;
00205             block[4] = 0;       block[5] = 0;   block[6] = 0;   block[7] = 0;
00206 
00207             dest += stride;
00208             block += 8;
00209         } while (--i);
00210     } else {
00211         int DC;
00212 
00213         DC = (block[0] + 4) >> 3;
00214         block[0] = block[63] = 0;
00215         i = 8;
00216         do {
00217             dest[0] = CLIP (DC + dest[0]);
00218             dest[1] = CLIP (DC + dest[1]);
00219             dest[2] = CLIP (DC + dest[2]);
00220             dest[3] = CLIP (DC + dest[3]);
00221             dest[4] = CLIP (DC + dest[4]);
00222             dest[5] = CLIP (DC + dest[5]);
00223             dest[6] = CLIP (DC + dest[6]);
00224             dest[7] = CLIP (DC + dest[7]);
00225             dest += stride;
00226         } while (--i);
00227     }
00228 }
 | 
| 
 | ||||||||||||||||
| 
 Definition at line 157 of file idct.c. References CLIP, i, idct_col(), idct_row(), stride, and uint8_t. Referenced by mpeg2_idct_init(). 
 00159 {
00160     int i;
00161 
00162     for (i = 0; i < 8; i++)
00163         idct_row (block + 8 * i);
00164     for (i = 0; i < 8; i++)
00165         idct_col (block + i);
00166     do {
00167         dest[0] = CLIP (block[0]);
00168         dest[1] = CLIP (block[1]);
00169         dest[2] = CLIP (block[2]);
00170         dest[3] = CLIP (block[3]);
00171         dest[4] = CLIP (block[4]);
00172         dest[5] = CLIP (block[5]);
00173         dest[6] = CLIP (block[6]);
00174         dest[7] = CLIP (block[7]);
00175 
00176         block[0] = 0;   block[1] = 0;   block[2] = 0;   block[3] = 0;
00177         block[4] = 0;   block[5] = 0;   block[6] = 0;   block[7] = 0;
00178 
00179         dest += stride;
00180         block += 8;
00181     } while (--i);
00182 }
 | 
| 
 | 
Variable Documentation
| 
 | 
| 
 Definition at line 45 of file idct.c. Referenced by mpeg2_idct_init(). | 
| 
 | 
| 
 Definition at line 42 of file idct.c. Referenced by mpeg2_idct_init(), and slice_non_intra_DCT(). | 
| 
 | 
| 
 Definition at line 41 of file idct.c. Referenced by mpeg2_idct_init(), and slice_intra_DCT(). | 
 
                             
                             
                             
                             
                             
                             
                             
                             
                             
                             
                             
                             
 
 
 
 
       
	   
	   
	   
	  