--- decoder.c 2004/05/21 14:40:15 1.57 +++ decoder.c 2004/07/10 17:49:31 1.61 @@ -20,7 +20,7 @@ * along with this program ; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * - * $Id: decoder.c,v 1.57 2004/05/21 14:40:15 edgomez Exp $ + * $Id: decoder.c,v 1.61 2004/07/10 17:49:31 edgomez Exp $ * ****************************************************************************/ @@ -303,7 +303,7 @@ start_timer(); predict_acdc(dec->mbs, x_pos, y_pos, dec->mb_width, i, &block[i * 64], - iQuant, iDcScaler, predictors, bound, dec->bs_version); + iQuant, iDcScaler, predictors, bound); if (!acpred_flag) { pMB->acpred_directions[i] = 0; } @@ -339,7 +339,7 @@ stop_coding_timer(); start_timer(); - add_acdc(pMB, i, &block[i * 64], iDcScaler, predictors); + add_acdc(pMB, i, &block[i * 64], iDcScaler, predictors, dec->bs_version); stop_prediction_timer(); start_timer(); @@ -393,7 +393,6 @@ const int reduced_resolution, const MACROBLOCK * pMB) { - DECLARE_ALIGNED_MATRIX(block, 1, 64, int16_t, CACHE_LINE); DECLARE_ALIGNED_MATRIX(data, 6, 64, int16_t, CACHE_LINE); int stride = dec->edged_width; @@ -402,23 +401,30 @@ int i; const uint32_t iQuant = pMB->quant; const int direction = dec->alternate_vertical_scan ? 2 : 0; - const quant_interFuncPtr dequant = dec->quant_type == 0 ? dequant_h263_inter : dequant_mpeg_inter; + typedef void (*get_inter_block_function_t)( + Bitstream * bs, + int16_t * block, + int direction, + const int quant, + const uint16_t *matrix); + + const get_inter_block_function_t get_inter_block = (dec->quant_type == 0) + ? get_inter_block_h263 + : get_inter_block_mpeg; + + memset(&data[0], 0, 6*64*sizeof(int16_t)); /* clear */ for (i = 0; i < 6; i++) { if (cbp & (1 << (5 - i))) { /* coded */ - memset(block, 0, 64 * sizeof(int16_t)); /* clear */ + /* Decode coeffs and dequantize on the fly */ start_timer(); - get_inter_block(bs, block, direction); + get_inter_block(bs, &data[i*64], direction, iQuant, get_inter_matrix(dec->mpeg_quant_matrices)); stop_coding_timer(); start_timer(); - dequant(&data[i * 64], block, iQuant, dec->mpeg_quant_matrices); - stop_iquant_timer(); - - start_timer(); idct(&data[i * 64]); stop_idct_timer(); } @@ -1218,7 +1224,6 @@ uint32_t x, y; VECTOR mv; const VECTOR zeromv = {0,0}; - const int32_t TRB = dec->time_pp - dec->time_bp, TRD = dec->time_pp; int i; if (!dec->is_edged[0]) { @@ -1322,14 +1327,15 @@ case MODE_DIRECT_NONE_MV: for (i = 0; i < 4; i++) { - mb->mvs[i].x = (int32_t) ((TRB * last_mb->mvs[i].x) / TRD + mv.x); - mb->b_mvs[i].x = (int32_t) ((mv.x == 0) - ? ((TRB - TRD) * last_mb->mvs[i].x) / TRD - : mb->mvs[i].x - last_mb->mvs[i].x); - mb->mvs[i].y = (int32_t) ((TRB * last_mb->mvs[i].y) / TRD + mv.y); - mb->b_mvs[i].y = (int32_t) ((mv.y == 0) - ? ((TRB - TRD) * last_mb->mvs[i].y) / TRD - : mb->mvs[i].y - last_mb->mvs[i].y); + mb->mvs[i].x = last_mb->mvs[i].x*dec->time_bp/dec->time_pp + mv.x; + mb->mvs[i].y = last_mb->mvs[i].y*dec->time_bp/dec->time_pp + mv.y; + + mb->b_mvs[i].x = (mv.x) + ? mb->mvs[i].x - last_mb->mvs[i].x + : last_mb->mvs[i].x*(dec->time_bp - dec->time_pp)/dec->time_pp; + mb->b_mvs[i].y = (mv.y) + ? mb->mvs[i].y - last_mb->mvs[i].y + : last_mb->mvs[i].y*(dec->time_bp - dec->time_pp)/dec->time_pp; } decoder_bf_interpolate_mbinter(dec, dec->refn[1], dec->refn[0], @@ -1573,7 +1579,7 @@ if (dec->low_delay) { DPRINTF(XVID_DEBUG_ERROR, "warning: bvop found in low_delay==1 stream\n"); - dec->low_delay = 1; + dec->low_delay = 0; } if (dec->frames < 2) {