diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2014-04-23 21:06:50 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2014-04-23 22:34:31 +0200 |
commit | 23cd5cb18f55c84bae48b08ff6563d5301c451d9 (patch) | |
tree | f67c3cd8d23b546c1a05d22b50f4012ca47454d7 /libavcodec/fic.c | |
parent | c26b4b6f55b005f60ce992b9b3d7c55b711bc0c0 (diff) | |
download | ffmpeg-23cd5cb18f55c84bae48b08ff6563d5301c451d9.tar.gz |
avcodec/fic: avoid 2 additions per idct row
before:
5225 decicycles in IDCT, 32756 runs, 12 skips
after:
5057 decicycles in IDCT, 32765 runs, 3 skips
Reviewed-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/fic.c')
-rw-r--r-- | libavcodec/fic.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/libavcodec/fic.c b/libavcodec/fic.c index ec200839d0..d08d240efe 100644 --- a/libavcodec/fic.c +++ b/libavcodec/fic.c @@ -79,7 +79,7 @@ static const uint8_t fic_header[7] = { 0, 0, 1, 'F', 'I', 'C', 'V' }; #define FIC_HEADER_SIZE 27 -static av_always_inline void fic_idct(int16_t *blk, int step, int shift) +static av_always_inline void fic_idct(int16_t *blk, int step, int shift, int rnd) { const int t0 = 27246 * blk[3 * step] + 18405 * blk[5 * step]; const int t1 = 27246 * blk[5 * step] - 18405 * blk[3 * step]; @@ -91,8 +91,8 @@ static av_always_inline void fic_idct(int16_t *blk, int step, int shift) const int t7 = t3 - t1; const int t8 = 17734 * blk[2 * step] - 42813 * blk[6 * step]; const int t9 = 17734 * blk[6 * step] + 42814 * blk[2 * step]; - const int tA = (blk[0 * step] - blk[4 * step] << 15) + (1 << shift - 1); - const int tB = (blk[0 * step] + blk[4 * step] << 15) + (1 << shift - 1); + const int tA = (blk[0 * step] - blk[4 * step] << 15) + rnd; + const int tB = (blk[0 * step] + blk[4 * step] << 15) + rnd; blk[0 * step] = ( t4 + t9 + tB) >> shift; blk[1 * step] = ( t6 + t7 + t8 + tA) >> shift; blk[2 * step] = ( t6 - t7 - t8 + tA) >> shift; @@ -109,14 +109,15 @@ static void fic_idct_put(uint8_t *dst, int stride, int16_t *block) int16_t *ptr; ptr = block; - for (i = 0; i < 8; i++) { - fic_idct(ptr, 8, 13); + fic_idct(ptr++, 8, 13, (1 << 12) + (1 << 17)); + for (i = 1; i < 8; i++) { + fic_idct(ptr, 8, 13, 1 << 12); ptr++; } ptr = block; for (i = 0; i < 8; i++) { - fic_idct(ptr, 1, 20); + fic_idct(ptr, 1, 20, 0); ptr += 8; } |