Mercurial > libavcodec.hg
changeset 5705:c08c9340c7ca libavcodec
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
author | gpoirier |
---|---|
date | Mon, 24 Sep 2007 13:01:15 +0000 |
parents | cf77b8588f15 |
children | 3e8764a25c53 |
files | h264.c |
diffstat | 1 files changed, 8 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/h264.c Mon Sep 24 03:32:24 2007 +0000 +++ b/h264.c Mon Sep 24 13:01:15 2007 +0000 @@ -5586,6 +5586,7 @@ 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_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 @@ 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 @@ 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 );