[cvs] / xvidcore / src / utils / mbtransquant.c Repository:
ViewVC logotype

Diff of /xvidcore/src/utils/mbtransquant.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.8, Fri Aug 9 19:58:41 2002 UTC revision 1.13, Sat Sep 21 03:07:56 2002 UTC
# Line 1  Line 1 
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 Michael Militzer <isibaar@xvid.org>
7    *  software module in hardware or software products are advised that its     *   *               2002-2001 Peter Ross <pross@xvid.org>
8    *  use may infringe existing patents or copyrights, and any such use         *   *
9    *  would be at such party's own risk.  The original developer of this        *   *  This program is an implementation of a part of one or more MPEG-4
10    *  software module and his/her company, and subsequent editors and their     *   *  Video tools as specified in ISO/IEC 14496-2 standard.  Those intending
11    *  companies, will have no liability for use of this software or             *   *  to use this software module in hardware or software products are
12    *  modifications or derivatives thereof.                                     *   *  advised that its use may infringe existing patents or copyrights, and
13    *                                                                            *   *  any such use would be at such party's own risk.  The original
14    *  XviD is free software; you can redistribute it and/or modify it           *   *  developer of this software module and his/her company, and subsequent
15    *  under the terms of the GNU General Public License as published by         *   *  editors and their companies, will have no liability for use of this
16    *  the Free Software Foundation; either version 2 of the License, or         *   *  software or modifications or derivatives thereof.
17    *  (at your option) any later version.                                       *   *
18    *                                                                            *   *  This program is free software; you can redistribute it and/or modify
19    *  XviD is distributed in the hope that it will be useful, but               *   *  it under the terms of the GNU General Public License as published by
20    *  WITHOUT ANY WARRANTY; without even the implied warranty of                *   *  the Free Software Foundation; either version 2 of the License, or
21    *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the             *   *  (at your option) any later version.
22    *  GNU General Public License for more details.                              *   *
23    *                                                                            *   *  This program is distributed in the hope that it will be useful,
24    *  You should have received a copy of the GNU General Public License         *   *  but WITHOUT ANY WARRANTY; without even the implied warranty of
25    *  along with this program; if not, write to the Free Software               *   *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
26    *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA  *   *  GNU General Public License for more details.
27    *                                                                            *   *
28    ******************************************************************************/   *  You should have received a copy of the GNU General Public License
29     *  along with this program; if not, write to the Free Software
30   /******************************************************************************   *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
31    *                                                                            *   *
32    *  mbtransquant.c                                                            *   * $Id$
33    *                                                                            *   *
34    *  Copyright (C) 2001 - Peter Ross <pross@cs.rmit.edu.au>                    *   ****************************************************************************/
   *  Copyright (C) 2001 - Michael Militzer <isibaar@xvid.org>                  *  
   *                                                                            *  
   *  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                                                *  
   *                                                                            *  
   ******************************************************************************/  
35    
36  #include <string.h>  #include <string.h>
37    
# Line 68  Line 50 
50  #define MIN(X, Y) ((X)<(Y)?(X):(Y))  #define MIN(X, Y) ((X)<(Y)?(X):(Y))
51  #define MAX(X, Y) ((X)>(Y)?(X):(Y))  #define MAX(X, Y) ((X)>(Y)?(X):(Y))
52    
53  #define TOOSMALL_LIMIT 1                /* skip blocks having a coefficient sum below this value */  #define TOOSMALL_LIMIT 3                /* skip blocks having a coefficient sum below this value */
54    
55  /* this isnt pretty, but its better than 20 ifdefs */  /* this isnt pretty, but its better than 20 ifdefs */
56    
# Line 105  Line 87 
87    
88          start_timer();          start_timer();
89          pMB->field_dct = 0;          pMB->field_dct = 0;
90          if ((frame->global_flags & XVID_INTERLACING)) {          if ((frame->global_flags & XVID_INTERLACING) &&
91                    (x_pos>0) && (x_pos<pParam->mb_width-1) &&
92                    (y_pos>0) && (y_pos<pParam->mb_height-1)) {
93                  pMB->field_dct = MBDecideFieldDCT(data);                  pMB->field_dct = MBDecideFieldDCT(data);
94          }          }
95          stop_interlacing_timer();          stop_interlacing_timer();
# Line 183  Line 167 
167    
168          start_timer();          start_timer();
169          pMB->field_dct = 0;          pMB->field_dct = 0;
170          if ((frame->global_flags & XVID_INTERLACING)) {          if ((frame->global_flags & XVID_INTERLACING) &&
171                    (x_pos>0) && (x_pos<pParam->mb_width-1) &&
172                    (y_pos>0) && (y_pos<pParam->mb_height-1)) {
173                  pMB->field_dct = MBDecideFieldDCT(data);                  pMB->field_dct = MBDecideFieldDCT(data);
174          }          }
175          stop_interlacing_timer();          stop_interlacing_timer();
# Line 207  Line 193 
193                          stop_quant_timer();                          stop_quant_timer();
194                  }                  }
195    
196                  if (sum >= TOOSMALL_LIMIT) {    // skip block ?                  if ((sum >= TOOSMALL_LIMIT) || (qcoeff[i*64] != 0) ||
197                            (qcoeff[i*64+1] != 0) || (qcoeff[i*64+8] != 0)) {
198    
199                          if (pParam->m_quant_type == H263_QUANT) {                          if (pParam->m_quant_type == H263_QUANT) {
200                                  start_timer();                                  start_timer();
# Line 295  Line 282 
282  MBTransQuantInterBVOP(const MBParam * pParam,  MBTransQuantInterBVOP(const MBParam * pParam,
283                                    FRAMEINFO * frame,                                    FRAMEINFO * frame,
284                                    MACROBLOCK * pMB,                                    MACROBLOCK * pMB,
                                   const uint32_t x_pos,  
                                   const uint32_t y_pos,  
285                                    int16_t data[6 * 64],                                    int16_t data[6 * 64],
286                                    int16_t qcoeff[6 * 64])                                    int16_t qcoeff[6 * 64])
287  {  {

Legend:
Removed from v.1.8  
changed lines
  Added in v.1.13

No admin address has been configured
ViewVC Help
Powered by ViewVC 1.0.4