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

Diff of /xvidcore/src/decoder.c

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

revision 1.11, Tue Apr 23 00:04:03 2002 UTC revision 1.28, Fri Jul 12 00:49:59 2002 UTC
# Line 1  Line 1 
1  /**************************************************************************  /**************************************************************************
2   *   *
3   *      XVID MPEG-4 VIDEO CODEC   *      XVID MPEG-4 VIDEO CODEC
4   *      decoder main   *  -  Decoder main module  -
5   *   *
6   *      This program is an implementation of a part of one or more MPEG-4   *      This program is an implementation of a part of one or more MPEG-4
7   *      Video tools as specified in ISO/IEC 14496-2 standard.  Those intending   *      Video tools as specified in ISO/IEC 14496-2 standard.  Those intending
# Line 12  Line 12 
12   *      editors and their companies, will have no liability for use of this   *      editors and their companies, will have no liability for use of this
13   *      software or modifications or derivatives thereof.   *      software or modifications or derivatives thereof.
14   *   *
15   *      This program is xvid_free software; you can redistribute it and/or modify   *  This program is free software; you can redistribute it and/or modify
16   *      it under the terms of the GNU General Public License as published by   *      it under the terms of the GNU General Public License as published by
17   *      the xvid_free Software Foundation; either version 2 of the License, or   *  the Free Software Foundation; either version 2 of the License, or
18   *      (at your option) any later version.   *      (at your option) any later version.
19   *   *
20   *      This program is distributed in the hope that it will be useful,   *      This program is distributed in the hope that it will be useful,
# Line 23  Line 23 
23   *      GNU General Public License for more details.   *      GNU General Public License for more details.
24   *   *
25   *      You should have received a copy of the GNU General Public License   *      You should have received a copy of the GNU General Public License
26   *      along with this program; if not, write to the xvid_free Software   *  along with this program; if not, write to the Free Software
27   *      Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.   *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
28   *   *
29   *************************************************************************/   *************************************************************************/
30    
# Line 32  Line 32 
32   *   *
33   *      History:   *      History:
34   *   *
35     *  10.07.2002  added BFRAMES_DEC_DEBUG support
36     *              Fix a little bug for low_delay flage
37     *              MinChen <chenm001@163.com>
38     *  28.06.2002  added basic resync support to iframe/pframe_decode()
39     *  22.06.2002  added primative N_VOP support
40     *              #define BFRAMES_DEC now enables Minchen's bframe decoder
41     *  08.05.2002  add low_delay support for B_VOP decode
42     *              MinChen <chenm001@163.com>
43     *  05.05.2002  fix some B-frame decode problem
44     *  02.05.2002  add B-frame decode support(have some problem);
45     *              MinChen <chenm001@163.com>
46   *  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   *  29.03.2002  interlacing fix - compensated block wasn't being used when   *  29.03.2002  interlacing fix - compensated block wasn't being used when
48   *              reconstructing blocks, thus artifacts   *              reconstructing blocks, thus artifacts
# Line 39  Line 50 
50   *              interlaced decoding should be as fast as progressive now   *              interlaced decoding should be as fast as progressive now
51   *  26.03.2002  interlacing support - moved transfers outside decode loop   *  26.03.2002  interlacing support - moved transfers outside decode loop
52   *      26.12.2001      decoder_mbinter: dequant/idct moved within if(coded) block   *      26.12.2001      decoder_mbinter: dequant/idct moved within if(coded) block
53   *      22.12.2001      block based interpolation   *  22.12.2001  lock based interpolation
54   *      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>
55   *   *
56     *  $Id$
57     *
58   *************************************************************************/   *************************************************************************/
59    
60  #include <stdlib.h>  #include <stdlib.h>
61  #include <string.h>  // memset  #include <string.h>
62    
63    #ifdef BFRAMES_DEC_DEBUG
64            #define BFRAMES_DEC
65    #endif
66    
67  #include "xvid.h"  #include "xvid.h"
68  #include "portab.h"  #include "portab.h"
# Line 70  Line 87 
87  #include "image/colorspace.h"  #include "image/colorspace.h"
88  #include "utils/mem_align.h"  #include "utils/mem_align.h"
89    
90  int decoder_create(XVID_DEC_PARAM * param)  int
91    decoder_create(XVID_DEC_PARAM * param)
92  {  {
93          DECODER * dec;          DECODER * dec;
94    
95          dec = xvid_malloc(sizeof(DECODER), CACHE_LINE);          dec = xvid_malloc(sizeof(DECODER), CACHE_LINE);
96          if (dec == NULL)          if (dec == NULL) {
         {  
97                  return XVID_ERR_MEMORY;                  return XVID_ERR_MEMORY;
98          }          }
99          param->handle = dec;          param->handle = dec;
# Line 89  Line 106 
106    
107          dec->edged_width = 16 * dec->mb_width + 2 * EDGE_SIZE;          dec->edged_width = 16 * dec->mb_width + 2 * EDGE_SIZE;
108          dec->edged_height = 16 * dec->mb_height + 2 * EDGE_SIZE;          dec->edged_height = 16 * dec->mb_height + 2 * EDGE_SIZE;
109            dec->low_delay = 0;
110    
111          if (image_create(&dec->cur, dec->edged_width, dec->edged_height))          if (image_create(&dec->cur, dec->edged_width, dec->edged_height)) {
         {  
112                  xvid_free(dec);                  xvid_free(dec);
113                  return XVID_ERR_MEMORY;                  return XVID_ERR_MEMORY;
114          }          }
115    
116          if (image_create(&dec->refn[0], dec->edged_width, dec->edged_height))          if (image_create(&dec->refn[0], dec->edged_width, dec->edged_height)) {
         {  
117                  image_destroy(&dec->cur, dec->edged_width, dec->edged_height);                  image_destroy(&dec->cur, dec->edged_width, dec->edged_height);
118                  xvid_free(dec);                  xvid_free(dec);
119                  return XVID_ERR_MEMORY;                  return XVID_ERR_MEMORY;
120          }          }
121          // add by chenm001 <chenm001@163.com>          // add by chenm001 <chenm001@163.com>
122          // for support B-frame to reference last 2 frame          // for support B-frame to reference last 2 frame
123          if (image_create(&dec->refn[1], dec->edged_width, dec->edged_height))          if (image_create(&dec->refn[1], dec->edged_width, dec->edged_height)) {
         {  
124                  image_destroy(&dec->cur, dec->edged_width, dec->edged_height);                  image_destroy(&dec->cur, dec->edged_width, dec->edged_height);
125                  image_destroy(&dec->refn[0], dec->edged_width, dec->edged_height);                  image_destroy(&dec->refn[0], dec->edged_width, dec->edged_height);
126                  xvid_free(dec);                  xvid_free(dec);
127                  return XVID_ERR_MEMORY;                  return XVID_ERR_MEMORY;
128          }          }
129            if (image_create(&dec->refn[2], dec->edged_width, dec->edged_height)) {
130                    image_destroy(&dec->cur, dec->edged_width, dec->edged_height);
131                    image_destroy(&dec->refn[0], dec->edged_width, dec->edged_height);
132                    image_destroy(&dec->refn[1], dec->edged_width, dec->edged_height);
133                    xvid_free(dec);
134                    return XVID_ERR_MEMORY;
135            }
136    
137          dec->mbs = xvid_malloc(sizeof(MACROBLOCK) * dec->mb_width * dec->mb_height, CACHE_LINE);          dec->mbs =
138          if (dec->mbs == NULL)                  xvid_malloc(sizeof(MACROBLOCK) * dec->mb_width * dec->mb_height,
139          {                                          CACHE_LINE);
140            if (dec->mbs == NULL) {
141                  image_destroy(&dec->cur, dec->edged_width, dec->edged_height);                  image_destroy(&dec->cur, dec->edged_width, dec->edged_height);
142                    image_destroy(&dec->refn[0], dec->edged_width, dec->edged_height);
143                    image_destroy(&dec->refn[1], dec->edged_width, dec->edged_height);
144                    image_destroy(&dec->refn[2], dec->edged_width, dec->edged_height);
145                  xvid_free(dec);                  xvid_free(dec);
146                  return XVID_ERR_MEMORY;                  return XVID_ERR_MEMORY;
147          }          }
148    
149            memset(dec->mbs, 0, sizeof(MACROBLOCK) * dec->mb_width * dec->mb_height);
150    
151            // add by chenm001 <chenm001@163.com>
152            // for skip MB flag
153            dec->last_mbs =
154                    xvid_malloc(sizeof(MACROBLOCK) * dec->mb_width * dec->mb_height,
155                                            CACHE_LINE);
156            if (dec->last_mbs == NULL) {
157                    xvid_free(dec->mbs);
158                    image_destroy(&dec->cur, dec->edged_width, dec->edged_height);
159                    image_destroy(&dec->refn[0], dec->edged_width, dec->edged_height);
160                    image_destroy(&dec->refn[1], dec->edged_width, dec->edged_height);
161                    image_destroy(&dec->refn[2], dec->edged_width, dec->edged_height);
162                    xvid_free(dec);
163                    return XVID_ERR_MEMORY;
164            }
165    
166            memset(dec->last_mbs, 0, sizeof(MACROBLOCK) * dec->mb_width * dec->mb_height);
167    
168          init_timer();          init_timer();
169    
170            // add by chenm001 <chenm001@163.com>
171            // for support B-frame to save reference frame's time
172            dec->frames = -1;
173            dec->time = dec->time_base = dec->last_time_base = 0;
174    
175          return XVID_ERR_OK;          return XVID_ERR_OK;
176  }  }
177    
178    
179  int decoder_destroy(DECODER * dec)  int
180    decoder_destroy(DECODER * dec)
181  {  {
182            xvid_free(dec->last_mbs);
183          xvid_free(dec->mbs);          xvid_free(dec->mbs);
184          image_destroy(&dec->refn[0], dec->edged_width, dec->edged_height);          image_destroy(&dec->refn[0], dec->edged_width, dec->edged_height);
185            image_destroy(&dec->refn[1], dec->edged_width, dec->edged_height);
186            image_destroy(&dec->refn[2], dec->edged_width, dec->edged_height);
187          image_destroy(&dec->cur, dec->edged_width, dec->edged_height);          image_destroy(&dec->cur, dec->edged_width, dec->edged_height);
188          xvid_free(dec);          xvid_free(dec);
189    
# Line 139  Line 193 
193    
194    
195    
196  static const int32_t dquant_table[4] =  static const int32_t dquant_table[4] = {
 {  
197          -1, -2, 1, 2          -1, -2, 1, 2
198  };  };
199    
200    
201    
202    
203  // decode an intra macroblock  // decode an intra macroblock
204    
205  void decoder_mbintra(DECODER * dec,  void
206    decoder_mbintra(DECODER * dec,
207                       MACROBLOCK * pMB,                       MACROBLOCK * pMB,
208                       const uint32_t x_pos,                       const uint32_t x_pos,
209                       const uint32_t y_pos,                       const uint32_t y_pos,
# Line 155  Line 211 
211                       const uint32_t cbp,                       const uint32_t cbp,
212                       Bitstream * bs,                       Bitstream * bs,
213                       const uint32_t quant,                       const uint32_t quant,
214                       const uint32_t intra_dc_threshold)                                  const uint32_t intra_dc_threshold,
215                                    const unsigned int bound)
216  {  {
217    
218          DECLARE_ALIGNED_MATRIX(block, 6, 64, int16_t, CACHE_LINE);          DECLARE_ALIGNED_MATRIX(block, 6, 64, int16_t, CACHE_LINE);
# Line 174  Line 231 
231    
232          memset(block, 0, 6*64*sizeof(int16_t));         // clear          memset(block, 0, 6*64*sizeof(int16_t));         // clear
233    
234          for (i = 0; i < 6; i++)          for (i = 0; i < 6; i++) {
         {  
235                  uint32_t iDcScaler = get_dc_scaler(iQuant, i < 4);                  uint32_t iDcScaler = get_dc_scaler(iQuant, i < 4);
236                  int16_t predictors[8];                  int16_t predictors[8];
237                  int start_coeff;                  int start_coeff;
238    
239                  start_timer();                  start_timer();
240                  predict_acdc(dec->mbs, x_pos, y_pos, dec->mb_width, i, &block[i*64], iQuant, iDcScaler, predictors);                  predict_acdc(dec->mbs, x_pos, y_pos, dec->mb_width, i, &block[i * 64],
241                  if (!acpred_flag)                                           iQuant, iDcScaler, predictors, bound);
242                  {                  if (!acpred_flag) {
243                          pMB->acpred_directions[i] = 0;                          pMB->acpred_directions[i] = 0;
244                  }                  }
245                  stop_prediction_timer();                  stop_prediction_timer();
246    
247                  if (quant < intra_dc_threshold)                  if (quant < intra_dc_threshold) {
                 {  
248                          int dc_size;                          int dc_size;
249                          int dc_dif;                          int dc_dif;
250    
251                          dc_size = i < 4 ?  get_dc_size_lum(bs) : get_dc_size_chrom(bs);                          dc_size = i < 4 ?  get_dc_size_lum(bs) : get_dc_size_chrom(bs);
252                          dc_dif = dc_size ? get_dc_dif(bs, dc_size) : 0 ;                          dc_dif = dc_size ? get_dc_dif(bs, dc_size) : 0 ;
253    
254                          if (dc_size > 8)                          if (dc_size > 8) {
                         {  
255                                  BitstreamSkip(bs, 1);           // marker                                  BitstreamSkip(bs, 1);           // marker
256                          }                          }
257    
258                          block[i*64 + 0] = dc_dif;                          block[i*64 + 0] = dc_dif;
259                          start_coeff = 1;                          start_coeff = 1;
260                  }  
261                  else                          DPRINTF(DPRINTF_COEFF,"block[0] %i", dc_dif);
262                  {                  } else {
263                          start_coeff = 0;                          start_coeff = 0;
264                  }                  }
265    
266                  start_timer();                  start_timer();
267                  if (cbp & (1 << (5-i)))                 // coded                  if (cbp & (1 << (5-i)))                 // coded
268                  {                  {
269                          get_intra_block(bs, &block[i*64], pMB->acpred_directions[i], start_coeff);                          get_intra_block(bs, &block[i * 64], pMB->acpred_directions[i],
270                                                            start_coeff);
271                  }                  }
272                  stop_coding_timer();                  stop_coding_timer();
273    
# Line 221  Line 276 
276                  stop_prediction_timer();                  stop_prediction_timer();
277    
278                  start_timer();                  start_timer();
279                  if (dec->quant_type == 0)                  if (dec->quant_type == 0) {
                 {  
280                          dequant_intra(&data[i*64], &block[i*64], iQuant, iDcScaler);                          dequant_intra(&data[i*64], &block[i*64], iQuant, iDcScaler);
281                  }                  } else {
                 else  
                 {  
282                          dequant4_intra(&data[i*64], &block[i*64], iQuant, iDcScaler);                          dequant4_intra(&data[i*64], &block[i*64], iQuant, iDcScaler);
283                  }                  }
284                  stop_iquant_timer();                  stop_iquant_timer();
# Line 236  Line 288 
288                  stop_idct_timer();                  stop_idct_timer();
289          }          }
290    
291          if (dec->interlacing && pMB->field_dct)          if (dec->interlacing && pMB->field_dct) {
         {  
292                  next_block = stride;                  next_block = stride;
293                  stride *= 2;                  stride *= 2;
294          }          }
# Line 264  Line 315 
315    
316  // decode an inter macroblock  // decode an inter macroblock
317    
318  void decoder_mbinter(DECODER * dec,  void
319    decoder_mbinter(DECODER * dec,
320                       const MACROBLOCK * pMB,                       const MACROBLOCK * pMB,
321                       const uint32_t x_pos,                       const uint32_t x_pos,
322                       const uint32_t y_pos,                       const uint32_t y_pos,
# Line 290  Line 342 
342          pU_Cur = dec->cur.u + (y_pos << 3) * stride2 + (x_pos << 3);          pU_Cur = dec->cur.u + (y_pos << 3) * stride2 + (x_pos << 3);
343          pV_Cur = dec->cur.v + (y_pos << 3) * stride2 + (x_pos << 3);          pV_Cur = dec->cur.v + (y_pos << 3) * stride2 + (x_pos << 3);
344    
345          if (pMB->mode == MODE_INTER || pMB->mode == MODE_INTER_Q)          if (pMB->mode == MODE_INTER || pMB->mode == MODE_INTER_Q) {
         {  
346                  uv_dx = pMB->mvs[0].x;                  uv_dx = pMB->mvs[0].x;
347                  uv_dy = pMB->mvs[0].y;                  uv_dy = pMB->mvs[0].y;
348    
349                  uv_dx = (uv_dx & 3) ? (uv_dx >> 1) | 1 : uv_dx / 2;                  uv_dx = (uv_dx & 3) ? (uv_dx >> 1) | 1 : uv_dx / 2;
350                  uv_dy = (uv_dy & 3) ? (uv_dy >> 1) | 1 : uv_dy / 2;                  uv_dy = (uv_dy & 3) ? (uv_dy >> 1) | 1 : uv_dy / 2;
351          }          } else {
         else  
         {  
352                  int sum;                  int sum;
353    
354                  sum = pMB->mvs[0].x + pMB->mvs[1].x + pMB->mvs[2].x + pMB->mvs[3].x;                  sum = pMB->mvs[0].x + pMB->mvs[1].x + pMB->mvs[2].x + pMB->mvs[3].x;
355                  uv_dx = (sum == 0 ? 0 : SIGN(sum) * (roundtab[ABS(sum) % 16] + (ABS(sum) / 16) * 2) );                  uv_dx =
356                            (sum ==
357                             0 ? 0 : SIGN(sum) * (roundtab[ABS(sum) % 16] +
358                                                                      (ABS(sum) / 16) * 2));
359    
360                  sum = pMB->mvs[0].y + pMB->mvs[1].y + pMB->mvs[2].y + pMB->mvs[3].y;                  sum = pMB->mvs[0].y + pMB->mvs[1].y + pMB->mvs[2].y + pMB->mvs[3].y;
361                  uv_dy = (sum == 0 ? 0 : SIGN(sum) * (roundtab[ABS(sum) % 16] + (ABS(sum) / 16) * 2) );                  uv_dy =
362                            (sum ==
363                             0 ? 0 : SIGN(sum) * (roundtab[ABS(sum) % 16] +
364                                                                      (ABS(sum) / 16) * 2));
365          }          }
366    
367          start_timer();          start_timer();
368          interpolate8x8_switch(dec->cur.y, dec->refn[0].y, 16*x_pos,     16*y_pos    , pMB->mvs[0].x, pMB->mvs[0].y, stride,  rounding);          interpolate8x8_switch(dec->cur.y, dec->refn[0].y, 16 * x_pos, 16 * y_pos,
369          interpolate8x8_switch(dec->cur.y, dec->refn[0].y, 16*x_pos + 8, 16*y_pos    , pMB->mvs[1].x, pMB->mvs[1].y, stride,  rounding);                                                    pMB->mvs[0].x, pMB->mvs[0].y, stride, rounding);
370          interpolate8x8_switch(dec->cur.y, dec->refn[0].y, 16*x_pos,     16*y_pos + 8, pMB->mvs[2].x, pMB->mvs[2].y, stride,  rounding);          interpolate8x8_switch(dec->cur.y, dec->refn[0].y, 16 * x_pos + 8,
371          interpolate8x8_switch(dec->cur.y, dec->refn[0].y, 16*x_pos + 8, 16*y_pos + 8, pMB->mvs[3].x, pMB->mvs[3].y, stride,  rounding);                                                    16 * y_pos, pMB->mvs[1].x, pMB->mvs[1].y, stride,
372          interpolate8x8_switch(dec->cur.u, dec->refn[0].u, 8*x_pos,      8*y_pos,      uv_dx,         uv_dy,         stride2, rounding);                                                    rounding);
373          interpolate8x8_switch(dec->cur.v, dec->refn[0].v, 8*x_pos,      8*y_pos,      uv_dx,         uv_dy,         stride2, rounding);          interpolate8x8_switch(dec->cur.y, dec->refn[0].y, 16 * x_pos,
374                                                      16 * y_pos + 8, pMB->mvs[2].x, pMB->mvs[2].y, stride,
375                                                      rounding);
376            interpolate8x8_switch(dec->cur.y, dec->refn[0].y, 16 * x_pos + 8,
377                                                      16 * y_pos + 8, pMB->mvs[3].x, pMB->mvs[3].y, stride,
378                                                      rounding);
379            interpolate8x8_switch(dec->cur.u, dec->refn[0].u, 8 * x_pos, 8 * y_pos,
380                                                      uv_dx, uv_dy, stride2, rounding);
381            interpolate8x8_switch(dec->cur.v, dec->refn[0].v, 8 * x_pos, 8 * y_pos,
382                                                      uv_dx, uv_dy, stride2, rounding);
383          stop_comp_timer();          stop_comp_timer();
384    
385          for (i = 0; i < 6; i++)          for (i = 0; i < 6; i++) {
         {  
386                  if (cbp & (1 << (5-i)))                 // coded                  if (cbp & (1 << (5-i)))                 // coded
387                  {                  {
388                          memset(&block[i*64], 0, 64 * sizeof(int16_t));          // clear                          memset(&block[i*64], 0, 64 * sizeof(int16_t));          // clear
# Line 328  Line 392 
392                          stop_coding_timer();                          stop_coding_timer();
393    
394                          start_timer();                          start_timer();
395                          if (dec->quant_type == 0)                          if (dec->quant_type == 0) {
                         {  
396                                  dequant_inter(&data[i*64], &block[i*64], iQuant);                                  dequant_inter(&data[i*64], &block[i*64], iQuant);
397                          }                          } else {
                         else  
                         {  
398                                  dequant4_inter(&data[i*64], &block[i*64], iQuant);                                  dequant4_inter(&data[i*64], &block[i*64], iQuant);
399                          }                          }
400                          stop_iquant_timer();                          stop_iquant_timer();
# Line 344  Line 405 
405                  }                  }
406          }          }
407    
408          if (dec->interlacing && pMB->field_dct)          if (dec->interlacing && pMB->field_dct) {
         {  
409                  next_block = stride;                  next_block = stride;
410                  stride *= 2;                  stride *= 2;
411          }          }
# Line 367  Line 427 
427  }  }
428    
429    
430  void decoder_iframe(DECODER * dec, Bitstream * bs, int quant, int intra_dc_threshold)  void
431    decoder_iframe(DECODER * dec,
432                               Bitstream * bs,
433                               int quant,
434                               int intra_dc_threshold)
435  {  {
436            uint32_t bound;
437          uint32_t x, y;          uint32_t x, y;
438    
439          for (y = 0; y < dec->mb_height; y++)          bound = 0;
         {  
                 for (x = 0; x < dec->mb_width; x++)  
                 {  
                         MACROBLOCK * mb = &dec->mbs[y*dec->mb_width + x];  
440    
441            for (y = 0; y < dec->mb_height; y++) {
442                    for (x = 0; x < dec->mb_width; x++) {
443                            MACROBLOCK *mb;
444                          uint32_t mcbpc;                          uint32_t mcbpc;
445                          uint32_t cbpc;                          uint32_t cbpc;
446                          uint32_t acpred_flag;                          uint32_t acpred_flag;
447                          uint32_t cbpy;                          uint32_t cbpy;
448                          uint32_t cbp;                          uint32_t cbp;
449    
450                            while (BitstreamShowBits(bs, 9) == 1)
451                                    BitstreamSkip(bs, 9);
452    
453                            if (check_resync_marker(bs, 0))
454                            {
455                                    bound = read_video_packet_header(bs, 0, &quant);
456                                    x = bound % dec->mb_width;
457                                    y = bound / dec->mb_width;
458                            }
459                            mb = &dec->mbs[y * dec->mb_width + x];
460    
461                            DPRINTF(DPRINTF_MB, "macroblock (%i,%i) %08x", x, y, BitstreamShowBits(bs, 32));
462    
463                          mcbpc = get_mcbpc_intra(bs);                          mcbpc = get_mcbpc_intra(bs);
464                          mb->mode = mcbpc & 7;                          mb->mode = mcbpc & 7;
465                          cbpc = (mcbpc >> 4);                          cbpc = (mcbpc >> 4);
466    
467                          acpred_flag = BitstreamGetBit(bs);                          acpred_flag = BitstreamGetBit(bs);
468    
                         if (mb->mode == MODE_STUFFING)  
                         {  
                                 DEBUG("-- STUFFING ?");  
                                 continue;  
                         }  
   
469                          cbpy = get_cbpy(bs, 1);                          cbpy = get_cbpy(bs, 1);
470                          cbp = (cbpy << 2) | cbpc;                          cbp = (cbpy << 2) | cbpc;
471    
472                          if (mb->mode == MODE_INTRA_Q)                          if (mb->mode == MODE_INTRA_Q) {
                         {  
473                                  quant += dquant_table[BitstreamGetBits(bs,2)];                                  quant += dquant_table[BitstreamGetBits(bs,2)];
474                                  if (quant > 31)                                  if (quant > 31) {
                                 {  
475                                          quant = 31;                                          quant = 31;
476                                  }                                  } else if (quant < 1) {
                                 else if (quant < 1)  
                                 {  
477                                          quant = 1;                                          quant = 1;
478                                  }                                  }
479                          }                          }
480                          mb->quant = quant;                          mb->quant = quant;
481    
482                          if (dec->interlacing)                          if (dec->interlacing) {
                         {  
483                                  mb->field_dct = BitstreamGetBit(bs);                                  mb->field_dct = BitstreamGetBit(bs);
484                                  DEBUG1("deci: field_dct: ", mb->field_dct);                                  DEBUG1("deci: field_dct: ", mb->field_dct);
485                          }                          }
486    
487                          decoder_mbintra(dec, mb, x, y, acpred_flag, cbp, bs, quant, intra_dc_threshold);                          decoder_mbintra(dec, mb, x, y, acpred_flag, cbp, bs, quant,
488                                                            intra_dc_threshold, bound);
489                  }                  }
490          }          }
491    
492  }  }
493    
494    
495  void get_motion_vector(DECODER *dec, Bitstream *bs, int x, int y, int k, VECTOR * mv, int fcode)  void
496    get_motion_vector(DECODER * dec,
497                                      Bitstream * bs,
498                                      int x,
499                                      int y,
500                                      int k,
501                                      VECTOR * mv,
502                                      int fcode,
503                                      const int bound)
504  {  {
505    
506          int scale_fac = 1 << (fcode - 1);          int scale_fac = 1 << (fcode - 1);
# Line 434  Line 508 
508          int low = ((-32) * scale_fac);          int low = ((-32) * scale_fac);
509          int range = (64 * scale_fac);          int range = (64 * scale_fac);
510    
511          VECTOR pmv[4];          VECTOR pmv;
         uint32_t psad[4];  
   
512          int mv_x, mv_y;          int mv_x, mv_y;
         int pmv_x, pmv_y;  
   
   
         get_pmvdata(dec->mbs, x, y, dec->mb_width, k, pmv, psad);  
513    
514          pmv_x = pmv[0].x;          pmv = get_pmv2(dec->mbs, dec->mb_width, bound, x, y, k);
         pmv_y = pmv[0].y;  
515    
516          mv_x = get_mv(bs, fcode);          mv_x = get_mv(bs, fcode);
517          mv_y = get_mv(bs, fcode);          mv_y = get_mv(bs, fcode);
518    
519          mv_x += pmv_x;          DPRINTF(DPRINTF_MV,"mv_diff (%i,%i) pred (%i,%i)", mv_x, mv_y, pmv.x, pmv.y);
         mv_y += pmv_y;  
520    
521          if (mv_x < low)          mv_x += pmv.x;
522          {          mv_y += pmv.y;
523    
524            if (mv_x < low) {
525                  mv_x += range;                  mv_x += range;
526          }          } else if (mv_x > high) {
         else if (mv_x > high)  
         {  
527                  mv_x -= range;                  mv_x -= range;
528          }          }
529    
530          if (mv_y < low)          if (mv_y < low) {
         {  
531                  mv_y += range;                  mv_y += range;
532          }          } else if (mv_y > high) {
         else if (mv_y > high)  
         {  
533                  mv_y -= range;                  mv_y -= range;
534          }          }
535    
# Line 476  Line 539 
539  }  }
540    
541    
542  void decoder_pframe(DECODER * dec, Bitstream * bs, int rounding, int quant, int fcode, int intra_dc_threshold)  void
543    decoder_pframe(DECODER * dec,
544                               Bitstream * bs,
545                               int rounding,
546                               int quant,
547                               int fcode,
548                               int intra_dc_threshold)
549  {  {
550    
551          uint32_t x, y;          uint32_t x, y;
552            uint32_t bound;
553    
554          start_timer();          start_timer();
555          image_setedges(&dec->refn[0], dec->edged_width, dec->edged_height, dec->width, dec->height, dec->interlacing);          image_setedges(&dec->refn[0], dec->edged_width, dec->edged_height,
556                                       dec->width, dec->height, dec->interlacing);
557          stop_edges_timer();          stop_edges_timer();
558    
559          for (y = 0; y < dec->mb_height; y++)          bound = 0;
560          {  
561                  for (x = 0; x < dec->mb_width; x++)          for (y = 0; y < dec->mb_height; y++) {
562                    for (x = 0; x < dec->mb_width; x++) {
563                            MACROBLOCK *mb;
564    
565                            // skip stuffing
566                            while (BitstreamShowBits(bs, 10) == 1)
567                                    BitstreamSkip(bs, 10);
568    
569                            if (check_resync_marker(bs, fcode - 1))
570                  {                  {
571                          MACROBLOCK * mb = &dec->mbs[y*dec->mb_width + x];                                  bound = read_video_packet_header(bs, fcode - 1, &quant);
572                                    x = bound % dec->mb_width;
573                                    y = bound / dec->mb_width;
574                            }
575                            mb = &dec->mbs[y * dec->mb_width + x];
576    
577                            DPRINTF(DPRINTF_MB, "macroblock (%i,%i) %08x", x, y, BitstreamShowBits(bs, 32));
578    
579                          if (!BitstreamGetBit(bs))                       // not_coded                          //if (!(dec->mb_skip[y*dec->mb_width + x]=BitstreamGetBit(bs)))         // not_coded
580                            if (!(BitstreamGetBit(bs)))     // not_coded
581                          {                          {
582                                  uint32_t mcbpc;                                  uint32_t mcbpc;
583                                  uint32_t cbpc;                                  uint32_t cbpc;
# Line 503  Line 589 
589                                  mcbpc = get_mcbpc_inter(bs);                                  mcbpc = get_mcbpc_inter(bs);
590                                  mb->mode = mcbpc & 7;                                  mb->mode = mcbpc & 7;
591                                  cbpc = (mcbpc >> 4);                                  cbpc = (mcbpc >> 4);
592    
593                                    DPRINTF(DPRINTF_MB, "mode %i", mb->mode);
594                                    DPRINTF(DPRINTF_MB, "cbpc %i", cbpc);
595                                  acpred_flag = 0;                                  acpred_flag = 0;
596    
597                                  intra = (mb->mode == MODE_INTRA || mb->mode == MODE_INTRA_Q);                                  intra = (mb->mode == MODE_INTRA || mb->mode == MODE_INTRA_Q);
598    
599                                  if (intra)                                  if (intra) {
                                 {  
600                                          acpred_flag = BitstreamGetBit(bs);                                          acpred_flag = BitstreamGetBit(bs);
601                                  }                                  }
602    
                                 if (mb->mode == MODE_STUFFING)  
                                 {  
                                         DEBUG("-- STUFFING ?");  
                                         continue;  
                                 }  
   
603                                  cbpy = get_cbpy(bs, intra);                                  cbpy = get_cbpy(bs, intra);
604                                    DPRINTF(DPRINTF_MB, "cbpy %i", cbpy);
605    
606                                  cbp = (cbpy << 2) | cbpc;                                  cbp = (cbpy << 2) | cbpc;
607    
608                                  if (mb->mode == MODE_INTER_Q || mb->mode == MODE_INTRA_Q)                                  if (mb->mode == MODE_INTER_Q || mb->mode == MODE_INTRA_Q) {
609                                  {                                          int dquant = dquant_table[BitstreamGetBits(bs, 2)];
610                                          quant += dquant_table[BitstreamGetBits(bs,2)];                                          DPRINTF(DPRINTF_MB, "dquant %i", dquant);
611                                          if (quant > 31)                                          quant += dquant;
612                                          {                                          if (quant > 31) {
613                                                  quant = 31;                                                  quant = 31;
614                                          }                                          } else if (quant < 1) {
                                         else if (mb->quant < 1)  
                                         {  
615                                                  quant = 1;                                                  quant = 1;
616                                          }                                          }
617                                            DPRINTF(DPRINTF_MB, "quant %i", quant);
618                                  }                                  }
619                                  mb->quant = quant;                                  mb->quant = quant;
620    
621                                  if (dec->interlacing)                                  if (dec->interlacing) {
                                 {  
622                                          mb->field_dct = BitstreamGetBit(bs);                                          mb->field_dct = BitstreamGetBit(bs);
623                                          DEBUG1("decp: field_dct: ", mb->field_dct);                                          DEBUG1("decp: field_dct: ", mb->field_dct);
624    
625                                          if (mb->mode == MODE_INTER || mb->mode == MODE_INTER_Q)                                          if (mb->mode == MODE_INTER || mb->mode == MODE_INTER_Q) {
                                         {  
626                                                  mb->field_pred = BitstreamGetBit(bs);                                                  mb->field_pred = BitstreamGetBit(bs);
627                                                  DEBUG1("decp: field_pred: ", mb->field_pred);                                                  DEBUG1("decp: field_pred: ", mb->field_pred);
628    
629                                                  if (mb->field_pred)                                                  if (mb->field_pred) {
                                                 {  
630                                                          mb->field_for_top = BitstreamGetBit(bs);                                                          mb->field_for_top = BitstreamGetBit(bs);
631                                                          DEBUG1("decp: field_for_top: ", mb->field_for_top);                                                          DEBUG1("decp: field_for_top: ", mb->field_for_top);
632                                                          mb->field_for_bot = BitstreamGetBit(bs);                                                          mb->field_for_bot = BitstreamGetBit(bs);
# Line 555  Line 635 
635                                          }                                          }
636                                  }                                  }
637    
638                                  if (mb->mode == MODE_INTER || mb->mode == MODE_INTER_Q)                                  if (mb->mode == MODE_INTER || mb->mode == MODE_INTER_Q) {
639                                  {                                          if (dec->interlacing && mb->field_pred) {
640                                          if (dec->interlacing && mb->field_pred)                                                  get_motion_vector(dec, bs, x, y, 0, &mb->mvs[0],
641                                                                                      fcode, bound);
642                                                    get_motion_vector(dec, bs, x, y, 0, &mb->mvs[1],
643                                                                                      fcode, bound);
644                                            } else {
645                                                    get_motion_vector(dec, bs, x, y, 0, &mb->mvs[0],
646                                                                                      fcode, bound);
647                                                    mb->mvs[1].x = mb->mvs[2].x = mb->mvs[3].x =
648                                                            mb->mvs[0].x;
649                                                    mb->mvs[1].y = mb->mvs[2].y = mb->mvs[3].y =
650                                                            mb->mvs[0].y;
651                                            }
652                                    } else if (mb->mode ==
653                                                       MODE_INTER4V /* || mb->mode == MODE_INTER4V_Q */ ) {
654                                            get_motion_vector(dec, bs, x, y, 0, &mb->mvs[0], fcode, bound);
655                                            get_motion_vector(dec, bs, x, y, 1, &mb->mvs[1], fcode, bound);
656                                            get_motion_vector(dec, bs, x, y, 2, &mb->mvs[2], fcode, bound);
657                                            get_motion_vector(dec, bs, x, y, 3, &mb->mvs[3], fcode, bound);
658                                    } else                  // MODE_INTRA, MODE_INTRA_Q
659                                    {
660                                            mb->mvs[0].x = mb->mvs[1].x = mb->mvs[2].x = mb->mvs[3].x =
661                                                    0;
662                                            mb->mvs[0].y = mb->mvs[1].y = mb->mvs[2].y = mb->mvs[3].y =
663                                                    0;
664                                            decoder_mbintra(dec, mb, x, y, acpred_flag, cbp, bs, quant,
665                                                                            intra_dc_threshold, bound);
666                                            continue;
667                                    }
668    
669                                    decoder_mbinter(dec, mb, x, y, acpred_flag, cbp, bs, quant,
670                                                                    rounding);
671                            } else                          // not coded
672                                          {                                          {
673                                                  get_motion_vector(dec, bs, x, y, 0, &mb->mvs[0], fcode);                                  //DEBUG2("P-frame MB at (X,Y)=",x,y);
674                                                  get_motion_vector(dec, bs, x, y, 0, &mb->mvs[1], fcode);                                  mb->mode = MODE_NOT_CODED;
675                                    mb->mvs[0].x = mb->mvs[1].x = mb->mvs[2].x = mb->mvs[3].x = 0;
676                                    mb->mvs[0].y = mb->mvs[1].y = mb->mvs[2].y = mb->mvs[3].y = 0;
677    
678                                    // copy macroblock directly from ref to cur
679    
680                                    start_timer();
681    
682                                    transfer8x8_copy(dec->cur.y + (16 * y) * dec->edged_width +
683                                                                     (16 * x),
684                                                                     dec->refn[0].y + (16 * y) * dec->edged_width +
685                                                                     (16 * x), dec->edged_width);
686    
687                                    transfer8x8_copy(dec->cur.y + (16 * y) * dec->edged_width +
688                                                                     (16 * x + 8),
689                                                                     dec->refn[0].y + (16 * y) * dec->edged_width +
690                                                                     (16 * x + 8), dec->edged_width);
691    
692                                    transfer8x8_copy(dec->cur.y + (16 * y + 8) * dec->edged_width +
693                                                                     (16 * x),
694                                                                     dec->refn[0].y + (16 * y +
695                                                                                                       8) * dec->edged_width +
696                                                                     (16 * x), dec->edged_width);
697    
698                                    transfer8x8_copy(dec->cur.y + (16 * y + 8) * dec->edged_width +
699                                                                     (16 * x + 8),
700                                                                     dec->refn[0].y + (16 * y +
701                                                                                                       8) * dec->edged_width +
702                                                                     (16 * x + 8), dec->edged_width);
703    
704                                    transfer8x8_copy(dec->cur.u + (8 * y) * dec->edged_width / 2 +
705                                                                     (8 * x),
706                                                                     dec->refn[0].u +
707                                                                     (8 * y) * dec->edged_width / 2 + (8 * x),
708                                                                     dec->edged_width / 2);
709    
710                                    transfer8x8_copy(dec->cur.v + (8 * y) * dec->edged_width / 2 +
711                                                                     (8 * x),
712                                                                     dec->refn[0].v +
713                                                                     (8 * y) * dec->edged_width / 2 + (8 * x),
714                                                                     dec->edged_width / 2);
715    
716                                    stop_transfer_timer();
717                                          }                                          }
718                                          else                  }
719            }
720    }
721    
722    
723    // add by MinChen <chenm001@163.com>
724    // decode B-frame motion vector
725    void
726    get_b_motion_vector(DECODER * dec,
727                                            Bitstream * bs,
728                                            int x,
729                                            int y,
730                                            VECTOR * mv,
731                                            int fcode,
732                                            const VECTOR pmv)
733                                          {                                          {
734                                                  get_motion_vector(dec, bs, x, y, 0, &mb->mvs[0], fcode);          int scale_fac = 1 << (fcode - 1);
735                                                  mb->mvs[1].x = mb->mvs[2].x = mb->mvs[3].x = mb->mvs[0].x;          int high = (32 * scale_fac) - 1;
736                                                  mb->mvs[1].y = mb->mvs[2].y = mb->mvs[3].y = mb->mvs[0].y;          int low = ((-32) * scale_fac);
737            int range = (64 * scale_fac);
738    
739            int mv_x, mv_y;
740            int pmv_x, pmv_y;
741    
742            pmv_x = pmv.x;
743            pmv_y = pmv.y;
744    
745            mv_x = get_mv(bs, fcode);
746            mv_y = get_mv(bs, fcode);
747    
748            mv_x += pmv_x;
749            mv_y += pmv_y;
750    
751            if (mv_x < low) {
752                    mv_x += range;
753            } else if (mv_x > high) {
754                    mv_x -= range;
755                                          }                                          }
756    
757            if (mv_y < low) {
758                    mv_y += range;
759            } else if (mv_y > high) {
760                    mv_y -= range;
761            }
762    
763            mv->x = mv_x;
764            mv->y = mv_y;
765                                  }                                  }
766                                  else if (mb->mode == MODE_INTER4V /* || mb->mode == MODE_INTER4V_Q */)  
767    
768    // add by MinChen <chenm001@163.com>
769    // decode an B-frame forward & backward inter macroblock
770    void
771    decoder_bf_mbinter(DECODER * dec,
772                                       const MACROBLOCK * pMB,
773                                       const uint32_t x_pos,
774                                       const uint32_t y_pos,
775                                       const uint32_t cbp,
776                                       Bitstream * bs,
777                                       const uint32_t quant,
778                                       const uint8_t ref)
779                                  {                                  {
780                                          get_motion_vector(dec, bs, x, y, 0, &mb->mvs[0], fcode);  
781                                          get_motion_vector(dec, bs, x, y, 1, &mb->mvs[1], fcode);          DECLARE_ALIGNED_MATRIX(block, 6, 64, int16_t, CACHE_LINE);
782                                          get_motion_vector(dec, bs, x, y, 2, &mb->mvs[2], fcode);          DECLARE_ALIGNED_MATRIX(data, 6, 64, int16_t, CACHE_LINE);
783                                          get_motion_vector(dec, bs, x, y, 3, &mb->mvs[3], fcode);  
784            uint32_t stride = dec->edged_width;
785            uint32_t stride2 = stride / 2;
786            uint32_t next_block = stride * 8;
787            uint32_t i;
788            uint32_t iQuant = pMB->quant;
789            uint8_t *pY_Cur, *pU_Cur, *pV_Cur;
790            int uv_dx, uv_dy;
791    
792            pY_Cur = dec->cur.y + (y_pos << 4) * stride + (x_pos << 4);
793            pU_Cur = dec->cur.u + (y_pos << 3) * stride2 + (x_pos << 3);
794            pV_Cur = dec->cur.v + (y_pos << 3) * stride2 + (x_pos << 3);
795    
796            if (!(pMB->mode == MODE_INTER || pMB->mode == MODE_INTER_Q)) {
797                    uv_dx = pMB->mvs[0].x;
798                    uv_dy = pMB->mvs[0].y;
799    
800                    uv_dx = (uv_dx & 3) ? (uv_dx >> 1) | 1 : uv_dx / 2;
801                    uv_dy = (uv_dy & 3) ? (uv_dy >> 1) | 1 : uv_dy / 2;
802            } else {
803                    int sum;
804    
805                    sum = pMB->mvs[0].x + pMB->mvs[1].x + pMB->mvs[2].x + pMB->mvs[3].x;
806                    uv_dx =
807                            (sum ==
808                             0 ? 0 : SIGN(sum) * (roundtab[ABS(sum) % 16] +
809                                                                      (ABS(sum) / 16) * 2));
810    
811                    sum = pMB->mvs[0].y + pMB->mvs[1].y + pMB->mvs[2].y + pMB->mvs[3].y;
812                    uv_dy =
813                            (sum ==
814                             0 ? 0 : SIGN(sum) * (roundtab[ABS(sum) % 16] +
815                                                                      (ABS(sum) / 16) * 2));
816                                  }                                  }
817                                  else  // MODE_INTRA, MODE_INTRA_Q  
818            start_timer();
819            interpolate8x8_switch(dec->cur.y, dec->refn[ref].y, 16 * x_pos, 16 * y_pos,
820                                                      pMB->mvs[0].x, pMB->mvs[0].y, stride, 0);
821            interpolate8x8_switch(dec->cur.y, dec->refn[ref].y, 16 * x_pos + 8,
822                                                      16 * y_pos, pMB->mvs[1].x, pMB->mvs[1].y, stride, 0);
823            interpolate8x8_switch(dec->cur.y, dec->refn[ref].y, 16 * x_pos,
824                                                      16 * y_pos + 8, pMB->mvs[2].x, pMB->mvs[2].y, stride,
825                                                      0);
826            interpolate8x8_switch(dec->cur.y, dec->refn[ref].y, 16 * x_pos + 8,
827                                                      16 * y_pos + 8, pMB->mvs[3].x, pMB->mvs[3].y, stride,
828                                                      0);
829            interpolate8x8_switch(dec->cur.u, dec->refn[ref].u, 8 * x_pos, 8 * y_pos,
830                                                      uv_dx, uv_dy, stride2, 0);
831            interpolate8x8_switch(dec->cur.v, dec->refn[ref].v, 8 * x_pos, 8 * y_pos,
832                                                      uv_dx, uv_dy, stride2, 0);
833            stop_comp_timer();
834    
835            for (i = 0; i < 6; i++) {
836                    if (cbp & (1 << (5 - i)))       // coded
837                                  {                                  {
838                                          mb->mvs[0].x = mb->mvs[1].x = mb->mvs[2].x = mb->mvs[3].x = 0;                          memset(&block[i * 64], 0, 64 * sizeof(int16_t));        // clear
839                                          mb->mvs[0].y = mb->mvs[1].y = mb->mvs[2].y = mb->mvs[3].y = 0;  
840                                          decoder_mbintra(dec, mb, x, y, acpred_flag, cbp, bs, quant, intra_dc_threshold);                          start_timer();
841                                          continue;                          get_inter_block(bs, &block[i * 64]);
842                            stop_coding_timer();
843    
844                            start_timer();
845                            if (dec->quant_type == 0) {
846                                    dequant_inter(&data[i * 64], &block[i * 64], iQuant);
847                            } else {
848                                    dequant4_inter(&data[i * 64], &block[i * 64], iQuant);
849                            }
850                            stop_iquant_timer();
851    
852                            start_timer();
853                            idct(&data[i * 64]);
854                            stop_idct_timer();
855                    }
856                                  }                                  }
857    
858                                  decoder_mbinter(dec, mb, x, y, acpred_flag, cbp, bs, quant, rounding);          if (dec->interlacing && pMB->field_dct) {
859                    next_block = stride;
860                    stride *= 2;
861                          }                          }
862                          else    // not coded  
863            start_timer();
864            if (cbp & 32)
865                    transfer_16to8add(pY_Cur, &data[0 * 64], stride);
866            if (cbp & 16)
867                    transfer_16to8add(pY_Cur + 8, &data[1 * 64], stride);
868            if (cbp & 8)
869                    transfer_16to8add(pY_Cur + next_block, &data[2 * 64], stride);
870            if (cbp & 4)
871                    transfer_16to8add(pY_Cur + 8 + next_block, &data[3 * 64], stride);
872            if (cbp & 2)
873                    transfer_16to8add(pU_Cur, &data[4 * 64], stride2);
874            if (cbp & 1)
875                    transfer_16to8add(pV_Cur, &data[5 * 64], stride2);
876            stop_transfer_timer();
877    }
878    
879    
880    // add by MinChen <chenm001@163.com>
881    // decode an B-frame direct &  inter macroblock
882    void
883    decoder_bf_interpolate_mbinter(DECODER * dec,
884                                                               IMAGE forward,
885                                                               IMAGE backward,
886                                                               const MACROBLOCK * pMB,
887                                                               const uint32_t x_pos,
888                                                               const uint32_t y_pos,
889                                                               const uint32_t cbp,
890                                                               Bitstream * bs)
891                          {                          {
892    
893                                  mb->mode = MODE_NOT_CODED;          DECLARE_ALIGNED_MATRIX(block, 6, 64, int16_t, CACHE_LINE);
894                                  mb->mvs[0].x = mb->mvs[1].x = mb->mvs[2].x = mb->mvs[3].x = 0;          DECLARE_ALIGNED_MATRIX(data, 6, 64, int16_t, CACHE_LINE);
895                                  mb->mvs[0].y = mb->mvs[1].y = mb->mvs[2].y = mb->mvs[3].y = 0;  
896            uint32_t stride = dec->edged_width;
897            uint32_t stride2 = stride / 2;
898            uint32_t next_block = stride * 8;
899            uint32_t iQuant = pMB->quant;
900            int uv_dx, uv_dy;
901            int b_uv_dx, b_uv_dy;
902            uint32_t i;
903            uint8_t *pY_Cur, *pU_Cur, *pV_Cur;
904    
905            pY_Cur = dec->cur.y + (y_pos << 4) * stride + (x_pos << 4);
906            pU_Cur = dec->cur.u + (y_pos << 3) * stride2 + (x_pos << 3);
907            pV_Cur = dec->cur.v + (y_pos << 3) * stride2 + (x_pos << 3);
908    
909            if ((pMB->mode == MODE_INTER || pMB->mode == MODE_INTER_Q)) {
910                    uv_dx = pMB->mvs[0].x;
911                    uv_dy = pMB->mvs[0].y;
912    
913                    uv_dx = (uv_dx & 3) ? (uv_dx >> 1) | 1 : uv_dx / 2;
914                    uv_dy = (uv_dy & 3) ? (uv_dy >> 1) | 1 : uv_dy / 2;
915    
916                    b_uv_dx = pMB->b_mvs[0].x;
917                    b_uv_dy = pMB->b_mvs[0].y;
918    
919                    b_uv_dx = (uv_dx & 3) ? (uv_dx >> 1) | 1 : uv_dx / 2;
920                    b_uv_dy = (uv_dy & 3) ? (uv_dy >> 1) | 1 : uv_dy / 2;
921            } else {
922                    int sum;
923    
924                    sum = pMB->mvs[0].x + pMB->mvs[1].x + pMB->mvs[2].x + pMB->mvs[3].x;
925                    uv_dx =
926                            (sum ==
927                             0 ? 0 : SIGN(sum) * (roundtab[ABS(sum) % 16] +
928                                                                      (ABS(sum) / 16) * 2));
929    
930                    sum = pMB->mvs[0].y + pMB->mvs[1].y + pMB->mvs[2].y + pMB->mvs[3].y;
931                    uv_dy =
932                            (sum ==
933                             0 ? 0 : SIGN(sum) * (roundtab[ABS(sum) % 16] +
934                                                                      (ABS(sum) / 16) * 2));
935    
936                    sum =
937                            pMB->b_mvs[0].x + pMB->b_mvs[1].x + pMB->b_mvs[2].x +
938                            pMB->b_mvs[3].x;
939                    b_uv_dx =
940                            (sum ==
941                             0 ? 0 : SIGN(sum) * (roundtab[ABS(sum) % 16] +
942                                                                      (ABS(sum) / 16) * 2));
943    
944                    sum =
945                            pMB->b_mvs[0].y + pMB->b_mvs[1].y + pMB->b_mvs[2].y +
946                            pMB->b_mvs[3].y;
947                    b_uv_dy =
948                            (sum ==
949                             0 ? 0 : SIGN(sum) * (roundtab[ABS(sum) % 16] +
950                                                                      (ABS(sum) / 16) * 2));
951            }
952    
                                 // copy macroblock directly from ref to cur  
953    
954                                  start_timer();                                  start_timer();
955            interpolate8x8_switch(dec->cur.y, forward.y, 16 * x_pos, 16 * y_pos,
956                                                      pMB->mvs[0].x, pMB->mvs[0].y, stride, 0);
957            interpolate8x8_switch(dec->cur.y, forward.y, 16 * x_pos + 8, 16 * y_pos,
958                                                      pMB->mvs[1].x, pMB->mvs[1].y, stride, 0);
959            interpolate8x8_switch(dec->cur.y, forward.y, 16 * x_pos, 16 * y_pos + 8,
960                                                      pMB->mvs[2].x, pMB->mvs[2].y, stride, 0);
961            interpolate8x8_switch(dec->cur.y, forward.y, 16 * x_pos + 8,
962                                                      16 * y_pos + 8, pMB->mvs[3].x, pMB->mvs[3].y, stride,
963                                                      0);
964            interpolate8x8_switch(dec->cur.u, forward.u, 8 * x_pos, 8 * y_pos, uv_dx,
965                                                      uv_dy, stride2, 0);
966            interpolate8x8_switch(dec->cur.v, forward.v, 8 * x_pos, 8 * y_pos, uv_dx,
967                                                      uv_dy, stride2, 0);
968    
969    
970            interpolate8x8_switch(dec->refn[2].y, backward.y, 16 * x_pos, 16 * y_pos,
971                                                      pMB->b_mvs[0].x, pMB->b_mvs[0].y, stride, 0);
972            interpolate8x8_switch(dec->refn[2].y, backward.y, 16 * x_pos + 8,
973                                                      16 * y_pos, pMB->b_mvs[1].x, pMB->b_mvs[1].y, stride,
974                                                      0);
975            interpolate8x8_switch(dec->refn[2].y, backward.y, 16 * x_pos,
976                                                      16 * y_pos + 8, pMB->b_mvs[2].x, pMB->b_mvs[2].y,
977                                                      stride, 0);
978            interpolate8x8_switch(dec->refn[2].y, backward.y, 16 * x_pos + 8,
979                                                      16 * y_pos + 8, pMB->b_mvs[3].x, pMB->b_mvs[3].y,
980                                                      stride, 0);
981            interpolate8x8_switch(dec->refn[2].u, backward.u, 8 * x_pos, 8 * y_pos,
982                                                      b_uv_dx, b_uv_dy, stride2, 0);
983            interpolate8x8_switch(dec->refn[2].v, backward.v, 8 * x_pos, 8 * y_pos,
984                                                      b_uv_dx, b_uv_dy, stride2, 0);
985    
986            interpolate8x8_c(dec->cur.y, dec->refn[2].y, 16 * x_pos, 16 * y_pos,
987                                             stride);
988            interpolate8x8_c(dec->cur.y, dec->refn[2].y, 16 * x_pos + 8, 16 * y_pos,
989                                             stride);
990            interpolate8x8_c(dec->cur.y, dec->refn[2].y, 16 * x_pos, 16 * y_pos + 8,
991                                             stride);
992            interpolate8x8_c(dec->cur.y, dec->refn[2].y, 16 * x_pos + 8,
993                                             16 * y_pos + 8, stride);
994            interpolate8x8_c(dec->cur.u, dec->refn[2].u, 8 * x_pos, 8 * y_pos,
995                                             stride2);
996            interpolate8x8_c(dec->cur.v, dec->refn[2].v, 8 * x_pos, 8 * y_pos,
997                                             stride2);
998    
999                                  transfer8x8_copy(dec->cur.y + (16*y)*dec->edged_width + (16*x),          stop_comp_timer();
                                                  dec->refn[0].y + (16*y)*dec->edged_width + (16*x),  
                                                  dec->edged_width);  
   
                                 transfer8x8_copy(dec->cur.y + (16*y)*dec->edged_width + (16*x+8),  
                                                  dec->refn[0].y + (16*y)*dec->edged_width + (16*x+8),  
                                                  dec->edged_width);  
   
                                 transfer8x8_copy(dec->cur.y + (16*y+8)*dec->edged_width + (16*x),  
                                                  dec->refn[0].y + (16*y+8)*dec->edged_width + (16*x),  
                                                  dec->edged_width);  
   
                                 transfer8x8_copy(dec->cur.y + (16*y+8)*dec->edged_width + (16*x+8),  
                                                  dec->refn[0].y + (16*y+8)*dec->edged_width + (16*x+8),  
                                                  dec->edged_width);  
1000    
1001                                  transfer8x8_copy(dec->cur.u + (8*y)*dec->edged_width/2 + (8*x),          for (i = 0; i < 6; i++) {
1002                                                   dec->refn[0].u + (8*y)*dec->edged_width/2 + (8*x),                  if (cbp & (1 << (5 - i)))       // coded
1003                                                   dec->edged_width/2);                  {
1004                            memset(&block[i * 64], 0, 64 * sizeof(int16_t));        // clear
1005    
1006                                  transfer8x8_copy(dec->cur.v + (8*y)*dec->edged_width/2 + (8*x),                          start_timer();
1007                                                   dec->refn[0].v + (8*y)*dec->edged_width/2 + (8*x),                          get_inter_block(bs, &block[i * 64]);
1008                                                   dec->edged_width/2);                          stop_coding_timer();
1009    
1010                            start_timer();
1011                            if (dec->quant_type == 0) {
1012                                    dequant_inter(&data[i * 64], &block[i * 64], iQuant);
1013                            } else {
1014                                    dequant4_inter(&data[i * 64], &block[i * 64], iQuant);
1015                            }
1016                            stop_iquant_timer();
1017    
1018                            start_timer();
1019                            idct(&data[i * 64]);
1020                            stop_idct_timer();
1021                    }
1022            }
1023    
1024            if (dec->interlacing && pMB->field_dct) {
1025                    next_block = stride;
1026                    stride *= 2;
1027            }
1028    
1029            start_timer();
1030            if (cbp & 32)
1031                    transfer_16to8add(pY_Cur, &data[0 * 64], stride);
1032            if (cbp & 16)
1033                    transfer_16to8add(pY_Cur + 8, &data[1 * 64], stride);
1034            if (cbp & 8)
1035                    transfer_16to8add(pY_Cur + next_block, &data[2 * 64], stride);
1036            if (cbp & 4)
1037                    transfer_16to8add(pY_Cur + 8 + next_block, &data[3 * 64], stride);
1038            if (cbp & 2)
1039                    transfer_16to8add(pU_Cur, &data[4 * 64], stride2);
1040            if (cbp & 1)
1041                    transfer_16to8add(pV_Cur, &data[5 * 64], stride2);
1042                                  stop_transfer_timer();                                  stop_transfer_timer();
1043                          }                          }
1044    
1045    
1046    // add by MinChen <chenm001@163.com>
1047    // for decode B-frame dbquant
1048    int32_t __inline
1049    get_dbquant(Bitstream * bs)
1050    {
1051            if (!BitstreamGetBit(bs))       // '0'
1052                    return (0);
1053            else if (!BitstreamGetBit(bs))  // '10'
1054                    return (-2);
1055            else
1056                    return (2);                             // '11'
1057    }
1058    
1059    // add by MinChen <chenm001@163.com>
1060    // for decode B-frame mb_type
1061    // bit   ret_value
1062    // 1        0
1063    // 01       1
1064    // 001      2
1065    // 0001     3
1066    int32_t __inline
1067    get_mbtype(Bitstream * bs)
1068    {
1069            int32_t mb_type;
1070    
1071            for (mb_type = 0; mb_type <= 3; mb_type++) {
1072                    if (BitstreamGetBit(bs))
1073                            break;
1074            }
1075    
1076            if (mb_type <= 3)
1077                    return (mb_type);
1078            else
1079                    return (-1);
1080    }
1081    
1082    void
1083    decoder_bframe(DECODER * dec,
1084                               Bitstream * bs,
1085                               int quant,
1086                               int fcode_forward,
1087                               int fcode_backward)
1088    {
1089    
1090            uint32_t x, y;
1091            VECTOR mv, zeromv;
1092    #ifdef BFRAMES_DEC_DEBUG
1093            FILE *fp;
1094            static char first=0;
1095    #define BFRAME_DEBUG    if (!first && fp){ \
1096                    fprintf(fp,"Y=%3d   X=%3d   MB=%2d   CBP=%02X\n",y,x,mb->mb_type,mb->cbp); \
1097            }
1098    #endif
1099    
1100            start_timer();
1101            image_setedges(&dec->refn[0], dec->edged_width, dec->edged_height,
1102                                       dec->width, dec->height, dec->interlacing);
1103            //image_setedges(&dec->refn[1], dec->edged_width, dec->edged_height, dec->width, dec->height, dec->interlacing);
1104            stop_edges_timer();
1105    
1106    #ifdef BFRAMES_DEC_DEBUG
1107            if (!first){
1108                    fp=fopen("C:\\XVIDDBG.TXT","w");
1109            }
1110    #endif
1111    
1112            for (y = 0; y < dec->mb_height; y++) {
1113                    // Initialize Pred Motion Vector
1114                    dec->p_fmv.x = dec->p_fmv.y = dec->p_bmv.x = dec->p_bmv.y = 0;
1115                    for (x = 0; x < dec->mb_width; x++) {
1116                            MACROBLOCK *mb = &dec->mbs[y * dec->mb_width + x];
1117                            MACROBLOCK *last_mb = &dec->last_mbs[y * dec->mb_width + x];
1118    
1119                            mb->mvs[0].x = mb->mvs[0].y = zeromv.x = zeromv.y = mv.x = mv.y = 0;
1120    
1121                            // the last P_VOP is skip macroblock ?
1122                            if (last_mb->mode == MODE_NOT_CODED) {
1123                                    //DEBUG2("Skip MB in B-frame at (X,Y)=!",x,y);
1124                                    mb->mb_type = MODE_NOT_CODED;
1125                                    mb->cbp = 0;
1126    #ifdef BFRAMES_DEC_DEBUG
1127            BFRAME_DEBUG
1128    #endif
1129                                    mb->mb_type = MODE_FORWARD;
1130                                    mb->mvs[1].x = mb->mvs[2].x = mb->mvs[3].x = mb->mvs[0].x;
1131                                    mb->mvs[1].y = mb->mvs[2].y = mb->mvs[3].y = mb->mvs[0].y;
1132                                    mb->quant = 8;
1133    
1134                                    decoder_bf_mbinter(dec, mb, x, y, mb->cbp, bs, quant, 1);
1135                                    continue;
1136                            }
1137                            //t=BitstreamShowBits(bs,32);
1138    
1139                            if (!BitstreamGetBit(bs)) {     // modb=='0'
1140                                    const uint8_t modb2 = BitstreamGetBit(bs);
1141    
1142                                    mb->mb_type = get_mbtype(bs);
1143    
1144                                    if (!modb2) {   // modb=='00'
1145                                            mb->cbp = BitstreamGetBits(bs, 6);
1146                                    } else {
1147                                            mb->cbp = 0;
1148                                    }
1149                                    if (mb->mb_type && mb->cbp) {
1150                                            quant += get_dbquant(bs);
1151    
1152                                            if (quant > 31) {
1153                                                    quant = 31;
1154                                            } else if (quant < 1) {
1155                                                    quant = 1;
1156                                            }
1157                                    } else {
1158                                            quant = 8;
1159                                    }
1160                                    mb->quant = quant;
1161                            } else {
1162                                    mb->mb_type = MODE_DIRECT_NONE_MV;
1163                                    mb->cbp = 0;
1164                            }
1165    
1166                            mb->mode = MODE_INTER;
1167                            //DEBUG1("Switch bm_type=",mb->mb_type);
1168    
1169    #ifdef BFRAMES_DEC_DEBUG
1170            BFRAME_DEBUG
1171    #endif
1172                            switch (mb->mb_type) {
1173                            case MODE_DIRECT:
1174                                    get_b_motion_vector(dec, bs, x, y, &mb->mvs[0], 1, zeromv);
1175    
1176                            case MODE_DIRECT_NONE_MV:
1177                                    {                               // Because this file is a C file not C++ so I use '{' to define var
1178                                            const int64_t TRB = dec->time_pp - dec->time_bp, TRD =
1179                                                    dec->time_pp;
1180                                            int i;
1181    
1182                                            for (i = 0; i < 4; i++) {
1183                                                    mb->mvs[i].x =
1184                                                            (int32_t) ((TRB * last_mb->mvs[i].x) / TRD +
1185                                                                               mb->mvs[0].x);
1186                                                    mb->b_mvs[i].x =
1187                                                            (int32_t) ((mb->mvs[0].x ==
1188                                                                                    0) ? ((TRB -
1189                                                                                               TRD) * last_mb->mvs[i].x) /
1190                                                                               TRD : mb->mvs[i].x - last_mb->mvs[i].x);
1191                                                    mb->mvs[i].y =
1192                                                            (int32_t) ((TRB * last_mb->mvs[i].y) / TRD +
1193                                                                               mb->mvs[0].y);
1194                                                    mb->b_mvs[i].y =
1195                                                            (int32_t) ((mb->mvs[0].y ==
1196                                                                                    0) ? ((TRB -
1197                                                                                               TRD) * last_mb->mvs[i].y) /
1198                                                                               TRD : mb->mvs[i].y - last_mb->mvs[i].y);
1199                                            }
1200                                            //DEBUG("B-frame Direct!\n");
1201                                    }
1202                                    mb->mode = MODE_INTER4V;
1203                                    decoder_bf_interpolate_mbinter(dec, dec->refn[1], dec->refn[0],
1204                                                                                               mb, x, y, mb->cbp, bs);
1205                                    break;
1206    
1207                            case MODE_INTERPOLATE:
1208                                    get_b_motion_vector(dec, bs, x, y, &mb->mvs[0], fcode_forward,
1209                                                                            dec->p_fmv);
1210                                    dec->p_fmv.x = mb->mvs[1].x = mb->mvs[2].x = mb->mvs[3].x =
1211                                            mb->mvs[0].x;
1212                                    dec->p_fmv.y = mb->mvs[1].y = mb->mvs[2].y = mb->mvs[3].y =
1213                                            mb->mvs[0].y;
1214    
1215                                    get_b_motion_vector(dec, bs, x, y, &mb->b_mvs[0],
1216                                                                            fcode_backward, dec->p_bmv);
1217                                    dec->p_bmv.x = mb->b_mvs[1].x = mb->b_mvs[2].x =
1218                                            mb->b_mvs[3].x = mb->b_mvs[0].x;
1219                                    dec->p_bmv.y = mb->b_mvs[1].y = mb->b_mvs[2].y =
1220                                            mb->b_mvs[3].y = mb->b_mvs[0].y;
1221    
1222                                    decoder_bf_interpolate_mbinter(dec, dec->refn[1], dec->refn[0],
1223                                                                                               mb, x, y, mb->cbp, bs);
1224                                    //DEBUG("B-frame Bidir!\n");
1225                                    break;
1226    
1227                            case MODE_BACKWARD:
1228                                    get_b_motion_vector(dec, bs, x, y, &mb->mvs[0], fcode_backward,
1229                                                                            dec->p_bmv);
1230                                    dec->p_bmv.x = mb->mvs[1].x = mb->mvs[2].x = mb->mvs[3].x =
1231                                            mb->mvs[0].x;
1232                                    dec->p_bmv.y = mb->mvs[1].y = mb->mvs[2].y = mb->mvs[3].y =
1233                                            mb->mvs[0].y;
1234    
1235                                    decoder_bf_mbinter(dec, mb, x, y, mb->cbp, bs, quant, 0);
1236                                    //DEBUG("B-frame Backward!\n");
1237                                    break;
1238    
1239                            case MODE_FORWARD:
1240                                    get_b_motion_vector(dec, bs, x, y, &mb->mvs[0], fcode_forward,
1241                                                                            dec->p_fmv);
1242                                    dec->p_fmv.x = mb->mvs[1].x = mb->mvs[2].x = mb->mvs[3].x =
1243                                            mb->mvs[0].x;
1244                                    dec->p_fmv.y = mb->mvs[1].y = mb->mvs[2].y = mb->mvs[3].y =
1245                                            mb->mvs[0].y;
1246    
1247                                    decoder_bf_mbinter(dec, mb, x, y, mb->cbp, bs, quant, 1);
1248                                    //DEBUG("B-frame Forward!\n");
1249                                    break;
1250    
1251                            default:
1252                                    //DEBUG1("Not support B-frame mb_type =", mb->mb_type);
1253                                    ;
1254                            }
1255    
1256                    }                                               // end of FOR
1257            }
1258    #ifdef BFRAMES_DEC_DEBUG
1259            if (!first){
1260                    first=1;
1261                    if (fp)
1262                            fclose(fp);
1263                  }                  }
1264    #endif
1265          }          }
1266    
1267    // swap two MACROBLOCK array
1268    void
1269    mb_swap(MACROBLOCK ** mb1,
1270                    MACROBLOCK ** mb2)
1271    {
1272            MACROBLOCK *temp = *mb1;
1273    
1274            *mb1 = *mb2;
1275            *mb2 = temp;
1276  }  }
1277    
1278  int decoder_decode(DECODER * dec, XVID_DEC_FRAME * frame)  int
1279    decoder_decode(DECODER * dec,
1280                               XVID_DEC_FRAME * frame)
1281  {  {
1282    
1283          Bitstream bs;          Bitstream bs;
1284          uint32_t rounding;          uint32_t rounding;
1285          uint32_t quant;          uint32_t quant;
1286          uint32_t fcode;          uint32_t fcode_forward;
1287            uint32_t fcode_backward;
1288          uint32_t intra_dc_threshold;          uint32_t intra_dc_threshold;
1289          uint32_t vop_type;          uint32_t vop_type;
1290    
# Line 643  Line 1294 
1294    
1295          // add by chenm001 <chenm001@163.com>          // add by chenm001 <chenm001@163.com>
1296          // for support B-frame to reference last 2 frame          // for support B-frame to reference last 2 frame
1297          vop_type=BitstreamReadHeaders(&bs, dec, &rounding, &quant, &fcode, &intra_dc_threshold);          dec->frames++;
1298            vop_type =
1299                    BitstreamReadHeaders(&bs, dec, &rounding, &quant, &fcode_forward,
1300                                                             &fcode_backward, &intra_dc_threshold);
1301    
1302          if (vop_type==I_VOP || vop_type==P_VOP){          dec->p_bmv.x = dec->p_bmv.y = dec->p_fmv.y = dec->p_fmv.y = 0;  // init pred vector to 0
                 image_swap(&dec->refn[0], &dec->refn[1]);  
                 image_swap(&dec->cur, &dec->refn[0]);  
         }  
1303    
1304          switch (vop_type)          switch (vop_type) {
         {  
1305          case P_VOP :          case P_VOP :
1306                  decoder_pframe(dec, &bs, rounding, quant, fcode, intra_dc_threshold);                  decoder_pframe(dec, &bs, rounding, quant, fcode_forward,
1307                                               intra_dc_threshold);
1308    #ifdef BFRAMES_DEC
1309                    DEBUG1("P_VOP  Time=", dec->time);
1310    #endif
1311                  break;                  break;
1312    
1313          case I_VOP :          case I_VOP :
                 //DEBUG1("",intra_dc_threshold);  
1314                  decoder_iframe(dec, &bs, quant, intra_dc_threshold);                  decoder_iframe(dec, &bs, quant, intra_dc_threshold);
1315    #ifdef BFRAMES_DEC
1316                    DEBUG1("I_VOP  Time=", dec->time);
1317    #endif
1318                  break;                  break;
1319    
1320          case B_VOP :    // ignore          case B_VOP:
1321    #ifdef BFRAMES_DEC
1322                    if (dec->time_pp > dec->time_bp) {
1323                            DEBUG1("B_VOP  Time=", dec->time);
1324                            decoder_bframe(dec, &bs, quant, fcode_forward, fcode_backward);
1325                    } else {
1326                            DEBUG("broken B-frame!");
1327                    }
1328    #else
1329                    image_copy(&dec->cur, &dec->refn[0], dec->edged_width, dec->height);
1330    #endif
1331                  break;                  break;
1332    
1333          case N_VOP :    // vop not coded          case N_VOP :    // vop not coded
1334                    // when low_delay==0, N_VOP's should interpolate between the past and future frames
1335                    image_copy(&dec->cur, &dec->refn[0], dec->edged_width, dec->height);
1336                  break;                  break;
1337    
1338          default :          default :
1339                  return XVID_ERR_FAIL;                  return XVID_ERR_FAIL;
1340          }          }
1341    
1342    #ifdef BFRAMES_DEC_DEBUG
1343            if (frame->length != BitstreamPos(&bs) / 8){
1344                    DEBUG2("InLen/UseLen",frame->length, BitstreamPos(&bs) / 8);
1345            }
1346    #endif
1347          frame->length = BitstreamPos(&bs) / 8;          frame->length = BitstreamPos(&bs) / 8;
1348    
1349          start_timer();  
1350    #ifdef BFRAMES_DEC
1351            // test if no B_VOP
1352            if (dec->low_delay) {
1353    #endif
1354          image_output(&dec->cur, dec->width, dec->height, dec->edged_width,          image_output(&dec->cur, dec->width, dec->height, dec->edged_width,
1355                       frame->image, frame->stride, frame->colorspace);                       frame->image, frame->stride, frame->colorspace);
1356    
1357    #ifdef BFRAMES_DEC
1358            } else {
1359                    if (dec->frames >= 0) {
1360                            start_timer();
1361                            if ((vop_type == I_VOP || vop_type == P_VOP)) {
1362                                    image_output(&dec->refn[0], dec->width, dec->height,
1363                                                             dec->edged_width, frame->image, frame->stride,
1364                                                             frame->colorspace);
1365                            } else if (vop_type == B_VOP) {
1366                                    image_output(&dec->cur, dec->width, dec->height,
1367                                                             dec->edged_width, frame->image, frame->stride,
1368                                                             frame->colorspace);
1369                            }
1370          stop_conv_timer();          stop_conv_timer();
1371                    }
1372            }
1373    #endif
1374    
1375            if (vop_type == I_VOP || vop_type == P_VOP) {
1376                    image_swap(&dec->refn[0], &dec->refn[1]);
1377                    image_swap(&dec->cur, &dec->refn[0]);
1378                    // swap MACROBLOCK
1379                    if (!dec->low_delay && vop_type == P_VOP)
1380                            mb_swap(&dec->mbs, &dec->last_mbs);
1381            }
1382    
1383          emms();          emms();
1384    
1385          stop_global_timer();          stop_global_timer();
1386    
1387          return XVID_ERR_OK;          return XVID_ERR_OK;
   
1388  }  }

Legend:
Removed from v.1.11  
changed lines
  Added in v.1.28

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