--- decoder.c 2002/09/04 03:23:23 1.37 +++ decoder.c 2002/11/16 23:38:15 1.43 @@ -3,17 +3,13 @@ * XVID MPEG-4 VIDEO CODEC * - Decoder main module - * - * This program is an implementation of a part of one or more MPEG-4 - * Video tools as specified in ISO/IEC 14496-2 standard. Those intending - * to use this software module in hardware or software products are - * advised that its use may infringe existing patents or copyrights, and - * any such use would be at such party's own risk. The original - * developer of this software module and his/her company, and subsequent - * editors and their companies, will have no liability for use of this - * software or modifications or derivatives thereof. + * Copyright(C) 2002 MinChen + * 2002 Peter Ross * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * This file is part of XviD, a free MPEG-4 video encoder/decoder + * + * XviD is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * @@ -26,36 +22,36 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * - *************************************************************************/ - -/************************************************************************** + * Under section 8 of the GNU General Public License, the copyright + * holders of XVID explicitly forbid distribution in the following + * countries: * - * History: + * - Japan + * - United States of America * - * 15.07.2002 fix a bug in B-frame decode at DIRECT mode - * MinChen - * 10.07.2002 added BFRAMES_DEC_DEBUG support - * Fix a little bug for low_delay flage - * MinChen - * 28.06.2002 added basic resync support to iframe/pframe_decode() - * 22.06.2002 added primative N_VOP support - * #define BFRAMES_DEC now enables Minchen's bframe decoder - * 08.05.2002 add low_delay support for B_VOP decode - * MinChen - * 05.05.2002 fix some B-frame decode problem - * 02.05.2002 add B-frame decode support(have some problem); - * MinChen - * 22.04.2002 add some B-frame decode support; chenm001 - * 29.03.2002 interlacing fix - compensated block wasn't being used when - * reconstructing blocks, thus artifacts - * interlacing speedup - used transfers to re-interlace - * interlaced decoding should be as fast as progressive now - * 26.03.2002 interlacing support - moved transfers outside decode loop - * 26.12.2001 decoder_mbinter: dequant/idct moved within if(coded) block - * 22.12.2001 lock based interpolation - * 01.12.2001 inital version; (c)2001 peter ross + * Linking XviD statically or dynamically with other modules is making a + * combined work based on XviD. Thus, the terms and conditions of the + * GNU General Public License cover the whole combination. * - * $Id: decoder.c,v 1.37 2002/09/04 03:23:23 h Exp $ + * As a special exception, the copyright holders of XviD give you + * permission to link XviD with independent modules that communicate with + * XviD solely through the VFW1.1 and DShow interfaces, regardless of the + * license terms of these independent modules, and to copy and distribute + * the resulting combined work under terms of your choice, provided that + * every copy of the combined work is accompanied by a complete copy of + * the source code of XviD (the version of XviD used to produce the + * combined work), being distributed under the terms of the GNU General + * Public License plus this exception. An independent module is a module + * which is not derived from or based on XviD. + * + * Note that people who make modified versions of XviD are not obligated + * to grant this special exception for their modified versions; it is + * their choice whether to do so. The GNU General Public License gives + * permission to release a modified version without this exception; this + * exception also makes it possible to release a modified version which + * carries forward this exception. + * + * $Id: decoder.c,v 1.43 2002/11/16 23:38:15 edgomez Exp $ * *************************************************************************/ @@ -379,7 +375,7 @@ start_timer(); if(dec->quarterpel) { - DEBUG("QUARTERPEL"); + DPRINTF(DPRINTF_DEBUG, "QUARTERPEL\n"); interpolate8x8_quarterpel(dec->cur.y, dec->refn[0].y, 16*x_pos, 16*y_pos, pMB->mvs[0].x, pMB->mvs[0].y, stride, rounding); interpolate8x8_quarterpel(dec->cur.y, dec->refn[0].y, 16*x_pos + 8, 16*y_pos, @@ -509,7 +505,7 @@ if (dec->interlacing) { mb->field_dct = BitstreamGetBit(bs); - DEBUG1("deci: field_dct: ", mb->field_dct); + DPRINTF(DPRINTF_DEBUG, "deci: field_dct: %d", mb->field_dct); } decoder_mbintra(dec, mb, x, y, acpred_flag, cbp, bs, quant, @@ -585,7 +581,7 @@ start_timer(); image_setedges(&dec->refn[0], dec->edged_width, dec->edged_height, - dec->width, dec->height, dec->interlacing); + dec->width, dec->height); stop_edges_timer(); bound = 0; @@ -655,18 +651,18 @@ if (dec->interlacing) { if (cbp || intra) { mb->field_dct = BitstreamGetBit(bs); - DEBUG1("decp: field_dct: ", mb->field_dct); + DPRINTF(DPRINTF_DEBUG, "decp: field_dct: %d", mb->field_dct); } if (mb->mode == MODE_INTER || mb->mode == MODE_INTER_Q) { mb->field_pred = BitstreamGetBit(bs); - DEBUG1("decp: field_pred: ", mb->field_pred); + DPRINTF(DPRINTF_DEBUG, "decp: field_pred: %d", mb->field_pred); if (mb->field_pred) { mb->field_for_top = BitstreamGetBit(bs); - DEBUG1("decp: field_for_top: ", mb->field_for_top); + DPRINTF(DPRINTF_DEBUG, "decp: field_for_top: %d", mb->field_for_top); mb->field_for_bot = BitstreamGetBit(bs); - DEBUG1("decp: field_for_bot: ", mb->field_for_bot); + DPRINTF(DPRINTF_DEBUG, "decp: field_for_bot: %d", mb->field_for_bot); } } } @@ -706,7 +702,8 @@ rounding); } else // not coded { - DEBUG2("P-frame MB at (X,Y)=",x,y); + DPRINTF(DPRINTF_DEBUG, "P-frame MB at (X,Y)=(%d,%d)", x, y); + mb->mode = MODE_NOT_CODED; mb->mvs[0].x = mb->mvs[1].x = mb->mvs[2].x = mb->mvs[3].x = 0; mb->mvs[0].y = mb->mvs[1].y = mb->mvs[2].y = mb->mvs[3].y = 0; @@ -1142,9 +1139,9 @@ start_timer(); image_setedges(&dec->refn[0], dec->edged_width, dec->edged_height, - dec->width, dec->height, dec->interlacing); + dec->width, dec->height); image_setedges(&dec->refn[1], dec->edged_width, dec->edged_height, - dec->width, dec->height, dec->interlacing); + dec->width, dec->height); stop_edges_timer(); #ifdef BFRAMES_DEC_DEBUG @@ -1278,7 +1275,7 @@ break; default: - DEBUG1("Not support B-frame mb_type =", mb->mb_type); + DPRINTF(DPRINTF_ERROR, "Not support B-frame mb_type = %d", mb->mb_type); } } // end of FOR @@ -1336,24 +1333,24 @@ decoder_pframe(dec, &bs, rounding, quant, fcode_forward, intra_dc_threshold); #ifdef BFRAMES_DEC - DEBUG1("P_VOP Time=", dec->time); + DPRINTF(DPRINTF_DEBUG, "P_VOP Time=%d", dec->time); #endif break; case I_VOP: decoder_iframe(dec, &bs, quant, intra_dc_threshold); #ifdef BFRAMES_DEC - DEBUG1("I_VOP Time=", dec->time); + DPRINTF(DPRINTF_DEBUG, "I_VOP Time=%d", dec->time); #endif break; case B_VOP: #ifdef BFRAMES_DEC if (dec->time_pp > dec->time_bp) { - DEBUG1("B_VOP Time=", dec->time); + DPRINTF(DPRINTF_DEBUG, "B_VOP Time=%d", dec->time); decoder_bframe(dec, &bs, quant, fcode_forward, fcode_backward); } else { - DEBUG("broken B-frame!"); + DPRINTF(DPRINTF_DEBUG, "Broken B_VOP"); } #else image_copy(&dec->cur, &dec->refn[0], dec->edged_width, dec->height); @@ -1371,7 +1368,7 @@ #ifdef BFRAMES_DEC_DEBUG if (frame->length != BitstreamPos(&bs) / 8){ - DEBUG2("InLen/UseLen",frame->length, BitstreamPos(&bs) / 8); + DPRINTF(DPRINTF_DEBUG, "InLen: %d / UseLen: %d", frame->length, BitstreamPos(&bs) / 8); } #endif frame->length = BitstreamPos(&bs) / 8;