diff options
author | Fabrice Bellard <fabrice@bellard.org> | 2001-08-07 22:43:37 +0000 |
---|---|---|
committer | Fabrice Bellard <fabrice@bellard.org> | 2001-08-07 22:43:37 +0000 |
commit | dc541ee74b2fbf147685e254d50b72903cb66527 (patch) | |
tree | d4c59a330652d10102a0fd121ecbdaf1e3841d76 /libavcodec/fdctref.c | |
parent | e0eac44e826faa010ebf6f48b0d4e9e11d50cd9b (diff) | |
download | ffmpeg-dc541ee74b2fbf147685e254d50b72903cb66527.tar.gz |
added idct reference code
Originally committed as revision 46 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/fdctref.c')
-rw-r--r-- | libavcodec/fdctref.c | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/libavcodec/fdctref.c b/libavcodec/fdctref.c index b90a2e52ee..245492496f 100644 --- a/libavcodec/fdctref.c +++ b/libavcodec/fdctref.c @@ -116,3 +116,39 @@ short *block; */ } } + +/* perform IDCT matrix multiply for 8x8 coefficient block */ + +void idct(block) +short *block; +{ + int i, j, k, v; + double partial_product; + double tmp[64]; + + for (i=0; i<8; i++) + for (j=0; j<8; j++) + { + partial_product = 0.0; + + for (k=0; k<8; k++) + partial_product+= c[k][j]*block[8*i+k]; + + tmp[8*i+j] = partial_product; + } + + /* Transpose operation is integrated into address mapping by switching + loop order of i and j */ + + for (j=0; j<8; j++) + for (i=0; i<8; i++) + { + partial_product = 0.0; + + for (k=0; k<8; k++) + partial_product+= c[k][i]*tmp[8*k+j]; + + v = (int) floor(partial_product+0.5); + block[8*i+j] = v; + } +} |