1 |
/****************************************************************************** |
/***************************************************************************** |
2 |
* * |
* |
3 |
* This file is part of XviD, a free MPEG-4 video encoder/decoder * |
* XVID MPEG-4 VIDEO CODEC |
4 |
* * |
* - MacroBlock transfer and quantization - |
5 |
* XviD is an implementation of a part of one or more MPEG-4 Video tools * |
* |
6 |
* as specified in ISO/IEC 14496-2 standard. Those intending to use this * |
* Copyright(C) 2002-2001 Christoph Lampert <gruel@web.de> |
7 |
* software module in hardware or software products are advised that its * |
* 2002-2001 Michael Militzer <isibaar@xvid.org> |
8 |
* use may infringe existing patents or copyrights, and any such use * |
* 2002-2001 Peter Ross <pross@xvid.org> |
9 |
* would be at such party's own risk. The original developer of this * |
* 2002 Daniel Smith <danielsmith@astroboymail.com> |
10 |
* software module and his/her company, and subsequent editors and their * |
* |
11 |
* companies, will have no liability for use of this software or * |
* This program is an implementation of a part of one or more MPEG-4 |
12 |
* modifications or derivatives thereof. * |
* Video tools as specified in ISO/IEC 14496-2 standard. Those intending |
13 |
* * |
* to use this software module in hardware or software products are |
14 |
* XviD is free software; you can redistribute it and/or modify it * |
* advised that its use may infringe existing patents or copyrights, and |
15 |
* under the terms of the GNU General Public License as published by * |
* any such use would be at such party's own risk. The original |
16 |
* the Free Software Foundation; either version 2 of the License, or * |
* developer of this software module and his/her company, and subsequent |
17 |
* (at your option) any later version. * |
* editors and their companies, will have no liability for use of this |
18 |
* * |
* software or modifications or derivatives thereof. |
19 |
* XviD is distributed in the hope that it will be useful, but * |
* |
20 |
* WITHOUT ANY WARRANTY; without even the implied warranty of * |
* This program is free software; you can redistribute it and/or modify |
21 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
* it under the terms of the GNU General Public License as published by |
22 |
* GNU General Public License for more details. * |
* the Free Software Foundation; either version 2 of the License, or |
23 |
* * |
* (at your option) any later version. |
24 |
* You should have received a copy of the GNU General Public License * |
* |
25 |
* along with this program; if not, write to the Free Software * |
* This program is distributed in the hope that it will be useful, |
26 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
27 |
* * |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
28 |
******************************************************************************/ |
* GNU General Public License for more details. |
29 |
|
* |
30 |
/****************************************************************************** |
* You should have received a copy of the GNU General Public License |
31 |
* * |
* along with this program; if not, write to the Free Software |
32 |
* mbtransquant.c * |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
33 |
* * |
* |
34 |
* Copyright (C) 2001 - Peter Ross <pross@cs.rmit.edu.au> * |
* $Id: mbtransquant.c,v 1.18 2002-10-19 12:20:33 edgomez Exp $ |
35 |
* Copyright (C) 2001 - Michael Militzer <isibaar@xvid.org> * |
* |
36 |
* * |
****************************************************************************/ |
|
* For more information visit the XviD homepage: http://www.xvid.org * |
|
|
* * |
|
|
******************************************************************************/ |
|
|
|
|
|
/****************************************************************************** |
|
|
* * |
|
|
* Revision history: * |
|
|
* * |
|
|
* 29.03.2002 interlacing speedup - used transfer strides instead of * |
|
|
* manual field-to-frame conversion * |
|
|
* 26.03.2002 interlacing support - moved transfers outside loops * |
|
|
* 22.12.2001 get_dc_scaler() moved to common.h * |
|
|
* 19.11.2001 introduced coefficient thresholding (Isibaar) * |
|
|
* 17.11.2001 initial version * |
|
|
* * |
|
|
******************************************************************************/ |
|
37 |
|
|
38 |
#include <string.h> |
#include <string.h> |
39 |
|
|
89 |
|
|
90 |
start_timer(); |
start_timer(); |
91 |
pMB->field_dct = 0; |
pMB->field_dct = 0; |
92 |
if ((frame->global_flags & XVID_INTERLACING)) { |
if ((frame->global_flags & XVID_INTERLACING) && |
93 |
|
(x_pos>0) && (x_pos<pParam->mb_width-1) && |
94 |
|
(y_pos>0) && (y_pos<pParam->mb_height-1)) { |
95 |
pMB->field_dct = MBDecideFieldDCT(data); |
pMB->field_dct = MBDecideFieldDCT(data); |
96 |
} |
} |
97 |
stop_interlacing_timer(); |
stop_interlacing_timer(); |
169 |
|
|
170 |
start_timer(); |
start_timer(); |
171 |
pMB->field_dct = 0; |
pMB->field_dct = 0; |
172 |
if ((frame->global_flags & XVID_INTERLACING)) { |
if ((frame->global_flags & XVID_INTERLACING) && |
173 |
|
(x_pos>0) && (x_pos<pParam->mb_width-1) && |
174 |
|
(y_pos>0) && (y_pos<pParam->mb_height-1)) { |
175 |
pMB->field_dct = MBDecideFieldDCT(data); |
pMB->field_dct = MBDecideFieldDCT(data); |
176 |
} |
} |
177 |
stop_interlacing_timer(); |
stop_interlacing_timer(); |
366 |
MBQuantIntra(const MBParam * pParam, |
MBQuantIntra(const MBParam * pParam, |
367 |
FRAMEINFO * frame, |
FRAMEINFO * frame, |
368 |
MACROBLOCK *pMB, |
MACROBLOCK *pMB, |
369 |
int16_t qcoeff[6 * 64], |
int16_t data[6 * 64], |
370 |
int16_t data[6*64]) |
int16_t qcoeff[6 * 64]) |
371 |
{ |
{ |
372 |
int i; |
int i; |
373 |
int iQuant = frame->quant; |
int iQuant = frame->quant; |
600 |
} |
} |
601 |
} |
} |
602 |
|
|
603 |
if (frame > field) { |
if (frame > (field + 350)) { |
604 |
MBFrameToField(data); |
MBFrameToField(data); |
605 |
} |
} |
606 |
|
|
607 |
return (frame > field); |
return (frame > (field + 350)); |
608 |
} |
} |
609 |
|
|
610 |
|
|