20 |
* along with this program ; if not, write to the Free Software |
* along with this program ; if not, write to the Free Software |
21 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
22 |
* |
* |
23 |
* $Id: decoder.c,v 1.49.2.18 2003-10-22 09:47:52 edgomez Exp $ |
* $Id: decoder.c,v 1.49.2.19 2003-11-13 22:35:30 edgomez Exp $ |
24 |
* |
* |
25 |
****************************************************************************/ |
****************************************************************************/ |
26 |
|
|
1164 |
const int64_t TRB = dec->time_pp - dec->time_bp, TRD = dec->time_pp; |
const int64_t TRB = dec->time_pp - dec->time_bp, TRD = dec->time_pp; |
1165 |
int i; |
int i; |
1166 |
|
|
|
#ifdef BFRAMES_DEC_DEBUG |
|
|
FILE *fp; |
|
|
static char first=0; |
|
|
#define BFRAME_DEBUG |
|
|
if (!first && fp) { \ |
|
|
fprintf(fp,"Y=%3d X=%3d MB=%2d CBP=%02X\n",y,x,mb->mode,mb->cbp); \ |
|
|
} |
|
|
#endif |
|
|
|
|
1167 |
start_timer(); |
start_timer(); |
1168 |
image_setedges(&dec->refn[0], dec->edged_width, dec->edged_height, |
image_setedges(&dec->refn[0], dec->edged_width, dec->edged_height, |
1169 |
dec->width, dec->height); |
dec->width, dec->height); |
1171 |
dec->width, dec->height); |
dec->width, dec->height); |
1172 |
stop_edges_timer(); |
stop_edges_timer(); |
1173 |
|
|
|
#ifdef BFRAMES_DEC_DEBUG |
|
|
if (!first){ |
|
|
fp=fopen("C:\\XVIDDBG.TXT","w"); |
|
|
} |
|
|
#endif |
|
|
|
|
1174 |
for (y = 0; y < dec->mb_height; y++) { |
for (y = 0; y < dec->mb_height; y++) { |
1175 |
/* Initialize Pred Motion Vector */ |
/* Initialize Pred Motion Vector */ |
1176 |
dec->p_fmv = dec->p_bmv = zeromv; |
dec->p_fmv = dec->p_bmv = zeromv; |
1177 |
for (x = 0; x < dec->mb_width; x++) { |
for (x = 0; x < dec->mb_width; x++) { |
1178 |
MACROBLOCK *mb = &dec->mbs[y * dec->mb_width + x]; |
MACROBLOCK *mb = &dec->mbs[y * dec->mb_width + x]; |
1179 |
MACROBLOCK *last_mb = &dec->last_mbs[y * dec->mb_width + x]; |
MACROBLOCK *last_mb = &dec->last_mbs[y * dec->mb_width + x]; |
1180 |
|
const int fcode_max = (fcode_forward>fcode_backward) ? fcode_forward : fcode_backward; |
1181 |
|
uint32_t intra_dc_threshold; /* fake variable */ |
1182 |
|
|
1183 |
|
if (check_resync_marker(bs, fcode_max - 1)) { |
1184 |
|
int bound = read_video_packet_header(bs, dec, fcode_max - 1, &quant, |
1185 |
|
&fcode_forward, &fcode_backward, &intra_dc_threshold); |
1186 |
|
x = bound % dec->mb_width; |
1187 |
|
y = bound / dec->mb_width; |
1188 |
|
/* reset predicted macroblocks */ |
1189 |
|
dec->p_fmv = dec->p_bmv = zeromv; |
1190 |
|
} |
1191 |
|
|
1192 |
mv = |
mv = |
1193 |
mb->b_mvs[0] = mb->b_mvs[1] = mb->b_mvs[2] = mb->b_mvs[3] = |
mb->b_mvs[0] = mb->b_mvs[1] = mb->b_mvs[2] = mb->b_mvs[3] = |
1300 |
} |
} |
1301 |
} /* End of for */ |
} /* End of for */ |
1302 |
} |
} |
|
|
|
|
#ifdef BFRAMES_DEC_DEBUG |
|
|
if (!first){ |
|
|
first=1; |
|
|
if (fp) |
|
|
fclose(fp); |
|
|
} |
|
|
#endif |
|
1303 |
} |
} |
1304 |
|
|
1305 |
/* perform post processing if necessary, and output the image */ |
/* perform post processing if necessary, and output the image */ |