aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristophe Gisquet <christophe.gisquet@free.fr>2008-01-14 06:10:02 +0000
committerKostya Shishkov <kostya.shishkov@gmail.com>2008-01-14 06:10:02 +0000
commit750e37eb8313c1d00294c9b472b4ab15b4824811 (patch)
tree3e6512ac9dcec0bb95b35c52f0874aa0f1e91cdb
parent526e037b95e05e79d9e1452240fe8fd3129b536a (diff)
downloadffmpeg-750e37eb8313c1d00294c9b472b4ab15b4824811.tar.gz
Select scan tables for 8x4 and 4x8 blocks only once.
Patch by Christophe GISQUET ([christophe][gisquet] <whirlpool sign> free <spot> fr) Thread [PATCH] Determine once and for all zz scan tables to use in VC-1 VLD Originally committed as revision 11525 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r--libavcodec/vc1.c22
-rw-r--r--libavcodec/vc1.h2
2 files changed, 12 insertions, 12 deletions
diff --git a/libavcodec/vc1.c b/libavcodec/vc1.c
index 062dd38d47..46987c8b48 100644
--- a/libavcodec/vc1.c
+++ b/libavcodec/vc1.c
@@ -777,10 +777,14 @@ static int decode_sequence_header(AVCodecContext *avctx, GetBitContext *gb)
if (v->profile == PROFILE_ADVANCED)
{
+ v->zz_8x4 = ff_vc1_adv_progressive_8x4_zz;
+ v->zz_4x8 = ff_vc1_adv_progressive_4x8_zz;
return decode_sequence_header_adv(v, gb);
}
else
{
+ v->zz_8x4 = ff_vc1_simple_progressive_8x4_zz;
+ v->zz_4x8 = ff_vc1_simple_progressive_4x8_zz;
v->res_sm = get_bits(gb, 2); //reserved
if (v->res_sm)
{
@@ -2961,13 +2965,10 @@ static int vc1_decode_p_block(VC1Context *v, DCTELEM block[64], int n, int mquan
i += skip;
if(i > 31)
break;
- if(v->profile < PROFILE_ADVANCED)
- idx = ff_vc1_simple_progressive_8x4_zz[i++];
- else
- idx = ff_vc1_adv_progressive_8x4_zz[i++];
- block[idx + off] = value * scale;
+ idx = v->zz_8x4[i++]+off;
+ block[idx] = value * scale;
if(!v->pquantizer)
- block[idx + off] += (block[idx + off] < 0) ? -mquant : mquant;
+ block[idx] += (block[idx] < 0) ? -mquant : mquant;
}
if(!(subblkpat & (1 << (1 - j))) && !skip_block)
s->dsp.vc1_inv_trans_8x4(dst + j*4*linesize, linesize, block + off);
@@ -2983,13 +2984,10 @@ static int vc1_decode_p_block(VC1Context *v, DCTELEM block[64], int n, int mquan
i += skip;
if(i > 31)
break;
- if(v->profile < PROFILE_ADVANCED)
- idx = ff_vc1_simple_progressive_4x8_zz[i++];
- else
- idx = ff_vc1_adv_progressive_4x8_zz[i++];
- block[idx + off] = value * scale;
+ idx = v->zz_4x8[i++]+off;
+ block[idx] = value * scale;
if(!v->pquantizer)
- block[idx + off] += (block[idx + off] < 0) ? -mquant : mquant;
+ block[idx] += (block[idx] < 0) ? -mquant : mquant;
}
if(!(subblkpat & (1 << (1 - j))) && !skip_block)
s->dsp.vc1_inv_trans_4x8(dst + j*4, linesize, block + off);
diff --git a/libavcodec/vc1.h b/libavcodec/vc1.h
index bc611b30ff..12f38160bf 100644
--- a/libavcodec/vc1.h
+++ b/libavcodec/vc1.h
@@ -216,6 +216,8 @@ typedef struct VC1Context{
int k_y; ///< Number of bits for MVs (depends on MV range)
int range_x, range_y; ///< MV range
uint8_t pq, altpq; ///< Current/alternate frame quantizer scale
+ const uint8_t* zz_8x4;///< Zigzag scan table for TT_8x4 coding mode
+ const uint8_t* zz_4x8;///< Zigzag scan table for TT_4x8 coding mode
/** pquant parameters */
//@{
uint8_t dquantfrm;