diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2002-10-23 15:11:07 +0000 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2002-10-23 15:11:07 +0000 |
commit | 7801d21d13dcf442d92614534c312d1e69df2467 (patch) | |
tree | 674f462ac87392e4bf3547d59f97035f0cec3b3a /libavcodec/dsputil.c | |
parent | 4a3d7fbcbcd38ae9684ee4bda92f293070710740 (diff) | |
download | ffmpeg-7801d21d13dcf442d92614534c312d1e69df2467.tar.gz |
optimize block_permute()
optimize dct_quantize_c()
dont permute s->q_inter/intra_matrix
Originally committed as revision 1067 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/dsputil.c')
-rw-r--r-- | libavcodec/dsputil.c | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/libavcodec/dsputil.c b/libavcodec/dsputil.c index 8fcfd1d020..a8578b5c7b 100644 --- a/libavcodec/dsputil.c +++ b/libavcodec/dsputil.c @@ -1553,16 +1553,25 @@ int pix_abs8x8_xy2_c(UINT8 *pix1, UINT8 *pix2, int line_size) return s; } -/* permute block according so that it corresponds to the MMX idct - order */ -void block_permute(INT16 *block, UINT8 *permutation) +void ff_block_permute(INT16 *block, UINT8 *permutation, const UINT8 *scantable, int last) { - int i; - INT16 temp[64]; - - for(i=0; i<64; i++) temp[ permutation[i] ] = block[i]; + int i; + INT16 temp[64]; + + if(last<=0) return; + if(permutation[1]==1) return; //FIXME its ok but not clean and might fail for some perms - for(i=0; i<64; i++) block[i] = temp[i]; + for(i=0; i<=last; i++){ + const int j= scantable[i]; + temp[j]= block[j]; + block[j]=0; + } + + for(i=0; i<=last; i++){ + const int j= scantable[i]; + const int perm_j= permutation[j]; + block[perm_j]= temp[j]; + } } void clear_blocks_c(DCTELEM *blocks) |