aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/h264.c
diff options
context:
space:
mode:
authorAndreas Öman <andreas@olebyn.nu>2007-09-24 13:01:15 +0000
committerGuillaume Poirier <gpoirier@mplayerhq.hu>2007-09-24 13:01:15 +0000
commit1136d34a44bba555601dda248b2d09f6c35394d3 (patch)
tree73983d49119869b0eb2ea2b97cede1a4295246a3 /libavcodec/h264.c
parent0ebecca52cf43fa37e88474c8063c2fdeefc05d2 (diff)
downloadffmpeg-1136d34a44bba555601dda248b2d09f6c35394d3.tar.gz
factor out dequant table lookup outside loops, gives a 1-2% speed-up
patch by Andreas Öman %andreas A olebyn P nu% original thread: Date: Sep 24, 2007 12:59 PM Subject: [FFmpeg-devel] [PATCH] h264: factor out dequant table lookup outside loops Originally committed as revision 10564 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/h264.c')
-rw-r--r--libavcodec/h264.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/libavcodec/h264.c b/libavcodec/h264.c
index 90338fc18f..16258afff0 100644
--- a/libavcodec/h264.c
+++ b/libavcodec/h264.c
@@ -5586,6 +5586,7 @@ decode_intra_mb:
if( cbp || IS_INTRA16x16( mb_type ) ) {
const uint8_t *scan, *scan8x8, *dc_scan;
+ const uint32_t *qmul;
int dqp;
if(IS_INTERLACED(mb_type)){
@@ -5617,9 +5618,10 @@ decode_intra_mb:
decode_cabac_residual( h, h->mb, 0, 0, dc_scan, NULL, 16);
if( cbp&15 ) {
+ qmul = h->dequant4_coeff[0][s->qscale];
for( i = 0; i < 16; i++ ) {
//av_log( s->avctx, AV_LOG_ERROR, "INTRA16x16 AC:%d\n", i );
- decode_cabac_residual(h, h->mb + 16*i, 1, i, scan + 1, h->dequant4_coeff[0][s->qscale], 15);
+ decode_cabac_residual(h, h->mb + 16*i, 1, i, scan + 1, qmul, 15);
}
} else {
fill_rectangle(&h->non_zero_count_cache[scan8[0]], 4, 4, 8, 0, 1);
@@ -5631,14 +5633,16 @@ decode_intra_mb:
if( IS_8x8DCT(mb_type) ) {
decode_cabac_residual(h, h->mb + 64*i8x8, 5, 4*i8x8,
scan8x8, h->dequant8_coeff[IS_INTRA( mb_type ) ? 0:1][s->qscale], 64);
- } else
+ } else {
+ qmul = h->dequant4_coeff[IS_INTRA( mb_type ) ? 0:3][s->qscale];
for( i4x4 = 0; i4x4 < 4; i4x4++ ) {
const int index = 4*i8x8 + i4x4;
//av_log( s->avctx, AV_LOG_ERROR, "Luma4x4: %d\n", index );
//START_TIMER
- decode_cabac_residual(h, h->mb + 16*index, 2, index, scan, h->dequant4_coeff[IS_INTRA( mb_type ) ? 0:3][s->qscale], 16);
+ decode_cabac_residual(h, h->mb + 16*index, 2, index, scan, qmul, 16);
//STOP_TIMER("decode_residual")
}
+ }
} else {
uint8_t * const nnz= &h->non_zero_count_cache[ scan8[4*i8x8] ];
nnz[0] = nnz[1] = nnz[8] = nnz[9] = 0;
@@ -5657,7 +5661,7 @@ decode_intra_mb:
if( cbp&0x20 ) {
int c, i;
for( c = 0; c < 2; c++ ) {
- const uint32_t *qmul = h->dequant4_coeff[c+1+(IS_INTRA( mb_type ) ? 0:3)][h->chroma_qp[c]];
+ qmul = h->dequant4_coeff[c+1+(IS_INTRA( mb_type ) ? 0:3)][h->chroma_qp[c]];
for( i = 0; i < 4; i++ ) {
const int index = 16 + 4 * c + i;
//av_log( s->avctx, AV_LOG_ERROR, "INTRA C%d-AC %d\n",c, index - 16 );