--- decoder.c 2002/07/15 23:50:31 1.30 +++ decoder.c 2002/07/21 23:34:07 1.33 @@ -55,7 +55,7 @@ * 22.12.2001 lock based interpolation * 01.12.2001 inital version; (c)2001 peter ross * - * $Id: decoder.c,v 1.30 2002/07/15 23:50:31 chenm001 Exp $ + * $Id: decoder.c,v 1.33 2002/07/21 23:34:07 chl Exp $ * *************************************************************************/ @@ -493,6 +493,9 @@ decoder_mbintra(dec, mb, x, y, acpred_flag, cbp, bs, quant, intra_dc_threshold, bound); } + if(dec->out_frm) + output_slice(&dec->cur, dec->edged_width,dec->width,dec->out_frm,0,y,dec->mb_width); + } } @@ -556,6 +559,7 @@ uint32_t x, y; uint32_t bound; + int cp_mb, st_mb; start_timer(); image_setedges(&dec->refn[0], dec->edged_width, dec->edged_height, @@ -565,6 +569,7 @@ bound = 0; for (y = 0; y < dec->mb_height; y++) { + cp_mb = st_mb = 0; for (x = 0; x < dec->mb_width; x++) { MACROBLOCK *mb; @@ -592,6 +597,7 @@ uint32_t cbp; uint32_t intra; + cp_mb++; mcbpc = get_mcbpc_inter(bs); mb->mode = mcbpc & 7; cbpc = (mcbpc >> 4); @@ -718,10 +724,16 @@ dec->refn[0].v + (8 * y) * dec->edged_width / 2 + (8 * x), dec->edged_width / 2); - stop_transfer_timer(); + if(dec->out_frm && cp_mb > 0) { + output_slice(&dec->cur, dec->edged_width,dec->width,dec->out_frm,st_mb,y,cp_mb); + cp_mb = 0; + } + st_mb = x+1; } } + if(dec->out_frm && cp_mb > 0) + output_slice(&dec->cur, dec->edged_width,dec->width,dec->out_frm,st_mb,y,cp_mb); } } @@ -1176,12 +1188,13 @@ #ifdef BFRAMES_DEC_DEBUG BFRAME_DEBUG #endif + switch (mb->mb_type) { case MODE_DIRECT: get_b_motion_vector(dec, bs, x, y, &mv, 1, zeromv); case MODE_DIRECT_NONE_MV: - { // Because this file is a C file not C++ so I use '{' to define var + { const int64_t TRB = dec->time_pp - dec->time_bp, TRD = dec->time_pp; int i; @@ -1241,10 +1254,18 @@ break; default: - //DEBUG1("Not support B-frame mb_type =", mb->mb_type); + DEBUG1("Not support B-frame mb_type =", mb->mb_type); ; } + if ( (x==19) && (y==8) ) + { + fprintf(stderr,"D %d %d %d %d %d %d \n",0, mb->mb_type, + mb->mvs[0].x, mb->mvs[0].y,mb->b_mvs[0].x, mb->b_mvs[0].y ); + } + + + } // end of FOR } #ifdef BFRAMES_DEC_DEBUG @@ -1282,6 +1303,8 @@ start_global_timer(); + dec->out_frm = (frame->colorspace == XVID_CSP_EXTERN) ? frame->image : NULL; + BitstreamInit(&bs, frame->bitstream, frame->length); // add by chenm001 @@ -1367,8 +1390,16 @@ if (vop_type == I_VOP || vop_type == P_VOP) { image_swap(&dec->refn[0], &dec->refn[1]); image_swap(&dec->cur, &dec->refn[0]); + // swap MACROBLOCK - if (!dec->low_delay && vop_type == P_VOP) + // the Divx will not set the low_delay flage some times + // so follow code will wrong to not swap at that time + // this will broken bitstream! so I'm change it, + // But that is not the best way! can anyone tell me how + // to do another way? + // 18-07-2002 MinChen + //if (!dec->low_delay && vop_type == P_VOP) + if (vop_type == P_VOP) mb_swap(&dec->mbs, &dec->last_mbs); }