32 |
* |
* |
33 |
* History: |
* History: |
34 |
* |
* |
35 |
|
* 08.05.2002 add low_delay support for B_VOP decode |
36 |
|
* MinChen <chenm001@163.com> |
37 |
|
* 05.05.2002 fix some B-frame decode problem |
38 |
* 02.05.2002 add B-frame decode support(have some problem); |
* 02.05.2002 add B-frame decode support(have some problem); |
39 |
* MinChen <chenm001@163.com> |
* MinChen <chenm001@163.com> |
40 |
* 22.04.2002 add some B-frame decode support; chenm001 <chenm001@163.com> |
* 22.04.2002 add some B-frame decode support; chenm001 <chenm001@163.com> |
47 |
* 22.12.2001 lock based interpolation |
* 22.12.2001 lock based interpolation |
48 |
* 01.12.2001 inital version; (c)2001 peter ross <pross@cs.rmit.edu.au> |
* 01.12.2001 inital version; (c)2001 peter ross <pross@cs.rmit.edu.au> |
49 |
* |
* |
50 |
* $Id: decoder.c,v 1.16 2002-05-06 03:58:09 chenm001 Exp $ |
* $Id: decoder.c,v 1.18 2002-05-20 17:12:53 Isibaar Exp $ |
51 |
* |
* |
52 |
*************************************************************************/ |
*************************************************************************/ |
53 |
|
|
1145 |
vop_type=BitstreamReadHeaders(&bs, dec, &rounding, &quant, &fcode_forward, &fcode_backward, &intra_dc_threshold); |
vop_type=BitstreamReadHeaders(&bs, dec, &rounding, &quant, &fcode_forward, &fcode_backward, &intra_dc_threshold); |
1146 |
|
|
1147 |
dec->p_bmv.x=dec->p_bmv.y=dec->p_fmv.y=dec->p_fmv.y=0; // init pred vector to 0 |
dec->p_bmv.x=dec->p_bmv.y=dec->p_fmv.y=dec->p_fmv.y=0; // init pred vector to 0 |
1148 |
|
|
1149 |
switch (vop_type) |
switch (vop_type) |
1150 |
{ |
{ |
1151 |
case P_VOP : |
case P_VOP : |
1159 |
break; |
break; |
1160 |
|
|
1161 |
case B_VOP : |
case B_VOP : |
1162 |
|
#ifdef BFRAMES |
1163 |
if (dec->time_pp > dec->time_bp){ |
if (dec->time_pp > dec->time_bp){ |
1164 |
DEBUG1("B_VOP Time=",dec->time); |
DEBUG1("B_VOP Time=",dec->time); |
1165 |
decoder_bframe(dec, &bs, quant, fcode_forward, fcode_backward); |
decoder_bframe(dec, &bs, quant, fcode_forward, fcode_backward); |
1166 |
} else { |
} else { |
1167 |
DEBUG("broken B-frame!"); |
DEBUG("broken B-frame!"); |
1168 |
} |
} |
1169 |
|
#endif |
1170 |
break; |
break; |
1171 |
|
|
1172 |
case N_VOP : // vop not coded |
case N_VOP : // vop not coded |
1178 |
|
|
1179 |
frame->length = BitstreamPos(&bs) / 8; |
frame->length = BitstreamPos(&bs) / 8; |
1180 |
|
|
1181 |
|
#ifdef BFRAMES |
1182 |
|
// test if no B_VOP |
1183 |
|
if (dec->low_delay){ |
1184 |
|
#endif |
1185 |
|
image_output(&dec->cur, dec->width, dec->height, dec->edged_width, |
1186 |
|
frame->image, frame->stride, frame->colorspace); |
1187 |
|
#ifdef BFRAMES |
1188 |
|
} else { |
1189 |
if (dec->frames >= 1){ |
if (dec->frames >= 1){ |
1190 |
start_timer(); |
start_timer(); |
1191 |
if ((vop_type == I_VOP || vop_type == P_VOP)) |
if ((vop_type == I_VOP || vop_type == P_VOP)) |
1198 |
} |
} |
1199 |
stop_conv_timer(); |
stop_conv_timer(); |
1200 |
} |
} |
1201 |
|
} |
1202 |
|
#endif |
1203 |
|
|
1204 |
if (vop_type==I_VOP || vop_type==P_VOP){ |
if (vop_type==I_VOP || vop_type==P_VOP){ |
1205 |
image_swap(&dec->refn[0], &dec->refn[1]); |
image_swap(&dec->refn[0], &dec->refn[1]); |
1206 |
image_swap(&dec->cur, &dec->refn[0]); |
image_swap(&dec->cur, &dec->refn[0]); |
1207 |
// swap MACROBLOCK |
// swap MACROBLOCK |
1208 |
if (vop_type==P_VOP) |
if (dec->low_delay && vop_type==P_VOP) |
1209 |
mb_swap(&dec->mbs, &dec->last_mbs); |
mb_swap(&dec->mbs, &dec->last_mbs); |
1210 |
} |
} |
1211 |
|
|