[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.49.2.26, Wed Dec 17 17:07:38 2003 UTC revision 1.67, Mon Aug 16 22:38:06 2004 UTC
# Line 4  Line 4 
4   *  - Decoder Module -   *  - Decoder Module -
5   *   *
6   *  Copyright(C) 2002      MinChen <chenm001@163.com>   *  Copyright(C) 2002      MinChen <chenm001@163.com>
7   *               2002-2003 Peter Ross <pross@xvid.org>   *               2002-2004 Peter Ross <pross@xvid.org>
8   *   *
9   *  This program is free software ; you can redistribute it and/or modify   *  This program is free software ; you can redistribute it and/or modify
10   *  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
# Line 48  Line 48 
48  #include "image/interpolate8x8.h"  #include "image/interpolate8x8.h"
49  #include "image/reduced.h"  #include "image/reduced.h"
50  #include "image/font.h"  #include "image/font.h"
51    #include "image/qpel.h"
52    
53  #include "bitstream/mbcoding.h"  #include "bitstream/mbcoding.h"
54  #include "prediction/mbprediction.h"  #include "prediction/mbprediction.h"
# Line 77  Line 78 
78                  xvid_free(dec->last_mbs);                  xvid_free(dec->last_mbs);
79          if (dec->mbs)          if (dec->mbs)
80                  xvid_free(dec->mbs);                  xvid_free(dec->mbs);
81            if (dec->qscale)
82                    xvid_free(dec->qscale);
83    
84          /* realloc */          /* realloc */
85          dec->mb_width = (dec->width + 15) / 16;          dec->mb_width = (dec->width + 15) / 16;
# Line 161  Line 164 
164    
165          memset(dec->last_mbs, 0, sizeof(MACROBLOCK) * dec->mb_width * dec->mb_height);          memset(dec->last_mbs, 0, sizeof(MACROBLOCK) * dec->mb_width * dec->mb_height);
166    
167            /* nothing happens if that fails */
168            dec->qscale =
169                    xvid_malloc(sizeof(int) * dec->mb_width * dec->mb_height, CACHE_LINE);
170    
171            if (dec->qscale)
172                    memset(dec->qscale, 0, sizeof(int) * dec->mb_width * dec->mb_height);
173    
174          return 0;          return 0;
175  }  }
176    
# Line 200  Line 210 
210          /* image based GMC */          /* image based GMC */
211          image_null(&dec->gmc);          image_null(&dec->gmc);
212    
   
213          dec->mbs = NULL;          dec->mbs = NULL;
214          dec->last_mbs = NULL;          dec->last_mbs = NULL;
215            dec->qscale = NULL;
216    
217          init_timer();          init_timer();
218          init_postproc();          init_postproc(&dec->postproc);
219          init_mpeg_matrix(dec->mpeg_quant_matrices);          init_mpeg_matrix(dec->mpeg_quant_matrices);
220    
221          /* For B-frame support (used to save reference frame's time */          /* For B-frame support (used to save reference frame's time */
# Line 213  Line 223 
223          dec->time = dec->time_base = dec->last_time_base = 0;          dec->time = dec->time_base = dec->last_time_base = 0;
224          dec->low_delay = 0;          dec->low_delay = 0;
225          dec->packed_mode = 0;          dec->packed_mode = 0;
226            dec->time_inc_resolution = 1; /* until VOL header says otherwise */
227    
228          dec->fixed_dimensions = (dec->width > 0 && dec->height > 0);          dec->fixed_dimensions = (dec->width > 0 && dec->height > 0);
229    
# Line 228  Line 239 
239  {  {
240          xvid_free(dec->last_mbs);          xvid_free(dec->last_mbs);
241          xvid_free(dec->mbs);          xvid_free(dec->mbs);
242            xvid_free(dec->qscale);
243    
244          /* image based GMC */          /* image based GMC */
245          image_destroy(&dec->gmc, dec->edged_width, dec->edged_height);          image_destroy(&dec->gmc, dec->edged_width, dec->edged_height);
# Line 328  Line 340 
340                  stop_coding_timer();                  stop_coding_timer();
341    
342                  start_timer();                  start_timer();
343                  add_acdc(pMB, i, &block[i * 64], iDcScaler, predictors);                  add_acdc(pMB, i, &block[i * 64], iDcScaler, predictors, dec->bs_version);
344                  stop_prediction_timer();                  stop_prediction_timer();
345    
346                  start_timer();                  start_timer();
# Line 379  Line 391 
391                                  uint8_t * pY_Cur,                                  uint8_t * pY_Cur,
392                                  uint8_t * pU_Cur,                                  uint8_t * pU_Cur,
393                                  uint8_t * pV_Cur,                                  uint8_t * pV_Cur,
394                                  const int reduced_resolution,                                  int reduced_resolution,
395                                  const MACROBLOCK * pMB)                                  const MACROBLOCK * pMB)
396  {  {
397          DECLARE_ALIGNED_MATRIX(block, 1, 64, int16_t, CACHE_LINE);          DECLARE_ALIGNED_MATRIX(data, 1, 64, int16_t, CACHE_LINE);
         DECLARE_ALIGNED_MATRIX(data, 6, 64, int16_t, CACHE_LINE);  
398    
399          int stride = dec->edged_width;          int stride = dec->edged_width;
400          int next_block = stride * (reduced_resolution ? 16 : 8);          int next_block = stride * (reduced_resolution ? 16 : 8);
         const int stride2 = stride/2;  
401          int i;          int i;
402          const uint32_t iQuant = pMB->quant;          const uint32_t iQuant = pMB->quant;
403          const int direction = dec->alternate_vertical_scan ? 2 : 0;          const int direction = dec->alternate_vertical_scan ? 2 : 0;
404          const quant_interFuncPtr dequant = dec->quant_type == 0 ? dequant_h263_inter : dequant_mpeg_inter;          typedef void (*get_inter_block_function_t)(
405                            Bitstream * bs,
406                            int16_t * block,
407                            int direction,
408                            const int quant,
409                            const uint16_t *matrix);
410            typedef void (*add_residual_function_t)(
411                            uint8_t *predicted_block,
412                            const int16_t *residual,
413                            int stride);
414    
415            const get_inter_block_function_t get_inter_block = (dec->quant_type == 0)
416                    ? (get_inter_block_function_t)get_inter_block_h263
417                    : (get_inter_block_function_t)get_inter_block_mpeg;
418    
419            const add_residual_function_t add_residual = (reduced_resolution)
420                    ? (add_residual_function_t)add_upsampled_8x8_16to8
421                    : (add_residual_function_t)transfer_16to8add;
422    
423            uint8_t *dst[6];
424            int strides[6];
425    
         for (i = 0; i < 6; i++) {  
426    
427                  if (cbp & (1 << (5 - i))) {     /* coded */          if (dec->interlacing && pMB->field_dct) {
428                    next_block = stride;
429                    stride *= 2;
430            }
431    
432                          memset(block, 0, 64 * sizeof(int16_t)); /* clear */          reduced_resolution = !!reduced_resolution;
433            dst[0] = pY_Cur;
434            dst[2] = pY_Cur + next_block;
435            dst[1] = dst[0] + (8<<reduced_resolution);
436            dst[3] = dst[2] + (8<<reduced_resolution);
437            dst[4] = pU_Cur;
438            dst[5] = pV_Cur;
439            strides[0] = strides[1] = strides[2] = strides[3] = stride;
440            strides[4] = stride/2;
441            strides[5] = stride/2;
442    
443            for (i = 0; i < 6; i++) {
444                    /* Process only coded blocks */
445                    if (cbp & (1 << (5 - i))) {
446    
447                            /* Clear the block */
448                            memset(&data[0], 0, 64*sizeof(int16_t));
449    
450                            /* Decode coeffs and dequantize on the fly */
451                          start_timer();                          start_timer();
452                          get_inter_block(bs, block, direction);                          get_inter_block(bs, &data[0], direction, iQuant, get_inter_matrix(dec->mpeg_quant_matrices));
453                          stop_coding_timer();                          stop_coding_timer();
454    
455                            /* iDCT */
456                          start_timer();                          start_timer();
457                          dequant(&data[i * 64], block, iQuant, dec->mpeg_quant_matrices);                          idct(&data[0]);
458                          stop_iquant_timer();                          stop_idct_timer();
459    
460                            /* Add this residual to the predicted block */
461                          start_timer();                          start_timer();
462                          idct(&data[i * 64]);                          add_residual(dst[i], &data[0], strides[i]);
463                          stop_idct_timer();                          stop_transfer_timer();
464                  }                  }
465          }          }
   
         if (dec->interlacing && pMB->field_dct) {  
                 next_block = stride;  
                 stride *= 2;  
466          }          }
467    
468          start_timer();  static void __inline
469          if (reduced_resolution) {  validate_vector(VECTOR * mv, unsigned int x_pos, unsigned int y_pos, const DECODER * dec)
470                  if (cbp & 32)  {
471                          add_upsampled_8x8_16to8(pY_Cur, &data[0 * 64], stride);          /* clip a vector to valid range
472                  if (cbp & 16)             prevents crashes if bitstream is broken
473                          add_upsampled_8x8_16to8(pY_Cur + 16, &data[1 * 64], stride);          */
474                  if (cbp & 8)          int shift = 5 + dec->quarterpel;
475                          add_upsampled_8x8_16to8(pY_Cur + next_block, &data[2 * 64], stride);          int xborder_high = (int)(dec->mb_width - x_pos) << shift;
476                  if (cbp & 4)          int xborder_low = (-(int)x_pos-1) << shift;
477                          add_upsampled_8x8_16to8(pY_Cur + 16 + next_block, &data[3 * 64], stride);          int yborder_high = (int)(dec->mb_height - y_pos) << shift;
478                  if (cbp & 2)          int yborder_low = (-(int)y_pos-1) << shift;
479                          add_upsampled_8x8_16to8(pU_Cur, &data[4 * 64], stride2);  
480                  if (cbp & 1)  #define CHECK_MV(mv) \
481                          add_upsampled_8x8_16to8(pV_Cur, &data[5 * 64], stride2);          do { \
482          } else {          if ((mv).x > xborder_high) { \
483                  if (cbp & 32)                  DPRINTF(XVID_DEBUG_MV, "mv.x > max -- %d > %d, MB %d, %d", (mv).x, xborder_high, x_pos, y_pos); \
484                          transfer_16to8add(pY_Cur, &data[0 * 64], stride);                  (mv).x = xborder_high; \
485                  if (cbp & 16)          } else if ((mv).x < xborder_low) { \
486                          transfer_16to8add(pY_Cur + 8, &data[1 * 64], stride);                  DPRINTF(XVID_DEBUG_MV, "mv.x < min -- %d < %d, MB %d, %d", (mv).x, xborder_low, x_pos, y_pos); \
487                  if (cbp & 8)                  (mv).x = xborder_low; \
488                          transfer_16to8add(pY_Cur + next_block, &data[2 * 64], stride);          } \
489                  if (cbp & 4)          if ((mv).y > yborder_high) { \
490                          transfer_16to8add(pY_Cur + 8 + next_block, &data[3 * 64], stride);                  DPRINTF(XVID_DEBUG_MV, "mv.y > max -- %d > %d, MB %d, %d", (mv).y, yborder_high, x_pos, y_pos); \
491                  if (cbp & 2)                  (mv).y = yborder_high; \
492                          transfer_16to8add(pU_Cur, &data[4 * 64], stride2);          } else if ((mv).y < yborder_low) { \
493                  if (cbp & 1)                  DPRINTF(XVID_DEBUG_MV, "mv.y < min -- %d < %d, MB %d, %d", (mv).y, yborder_low, x_pos, y_pos); \
494                          transfer_16to8add(pV_Cur, &data[5 * 64], stride2);                  (mv).y = yborder_low; \
495          }          } \
496          stop_transfer_timer();          } while (0)
497    
498            CHECK_MV(mv[0]);
499            CHECK_MV(mv[1]);
500            CHECK_MV(mv[2]);
501            CHECK_MV(mv[3]);
502  }  }
503    
504  /* decode an inter macroblock */  /* decode an inter macroblock */
# Line 486  Line 538 
538                          mv[i] = pMB->mvs[i];                          mv[i] = pMB->mvs[i];
539          }          }
540    
541            validate_vector(mv, x_pos, y_pos, dec);
542    
543          start_timer();          start_timer();
544    
545          if (pMB->mode != MODE_INTER4V) { /* INTER, INTER_Q, NOT_CODED, FORWARD, BACKWARD */          if (pMB->mode != MODE_INTER4V) { /* INTER, INTER_Q, NOT_CODED, FORWARD, BACKWARD */
# Line 777  Line 831 
831                  mb_height = (dec->height + 31) / 32;                  mb_height = (dec->height + 31) / 32;
832          }          }
833    
834            if (!dec->is_edged[0]) {
835          start_timer();          start_timer();
836          image_setedges(&dec->refn[0], dec->edged_width, dec->edged_height,          image_setedges(&dec->refn[0], dec->edged_width, dec->edged_height,
837                                          dec->width, dec->height);                                                  dec->width, dec->height, dec->bs_version);
838                    dec->is_edged[0] = 1;
839          stop_edges_timer();          stop_edges_timer();
840            }
841    
842          if (gmc_warp) {          if (gmc_warp) {
843                  /* accuracy: 0==1/2, 1=1/4, 2=1/8, 3=1/16 */                  /* accuracy: 0==1/2, 1=1/4, 2=1/8, 3=1/16 */
# Line 851  Line 908 
908                                  mb->quant = quant;                                  mb->quant = quant;
909    
910                                  if (dec->interlacing) {                                  if (dec->interlacing) {
911                                          if ((cbp || intra) && !mcsel) {                                          if (cbp || intra) {
912                                                  mb->field_dct = BitstreamGetBit(bs);                                                  mb->field_dct = BitstreamGetBit(bs);
913                                                  DPRINTF(XVID_DEBUG_MB,"decp: field_dct: %i\n", mb->field_dct);                                                  DPRINTF(XVID_DEBUG_MB,"decp: field_dct: %i\n", mb->field_dct);
914                                          }                                          }
915    
916                                          if (mb->mode == MODE_INTER || mb->mode == MODE_INTER_Q) {                                          if ((mb->mode == MODE_INTER || mb->mode == MODE_INTER_Q) && !mcsel) {
917                                                  mb->field_pred = BitstreamGetBit(bs);                                                  mb->field_pred = BitstreamGetBit(bs);
918                                                  DPRINTF(XVID_DEBUG_MB, "decp: field_pred: %i\n", mb->field_pred);                                                  DPRINTF(XVID_DEBUG_MB, "decp: field_pred: %i\n", mb->field_pred);
919    
# Line 900  Line 957 
957    
958                          } else if (gmc_warp) {  /* a not coded S(GMC)-VOP macroblock */                          } else if (gmc_warp) {  /* a not coded S(GMC)-VOP macroblock */
959                                  mb->mode = MODE_NOT_CODED_GMC;                                  mb->mode = MODE_NOT_CODED_GMC;
960                                    mb->quant = quant;
961                                  decoder_mbgmc(dec, mb, x, y, fcode, 0x00, bs, rounding);                                  decoder_mbgmc(dec, mb, x, y, fcode, 0x00, bs, rounding);
962    
963                                  if(dec->out_frm && cp_mb > 0) {                                  if(dec->out_frm && cp_mb > 0) {
# Line 909  Line 967 
967                                  st_mb = x+1;                                  st_mb = x+1;
968                          } else {        /* not coded P_VOP macroblock */                          } else {        /* not coded P_VOP macroblock */
969                                  mb->mode = MODE_NOT_CODED;                                  mb->mode = MODE_NOT_CODED;
970                                    mb->quant = quant;
971    
972                                  mb->mvs[0].x = mb->mvs[1].x = mb->mvs[2].x = mb->mvs[3].x = 0;                                  mb->mvs[0].x = mb->mvs[1].x = mb->mvs[2].x = mb->mvs[3].x = 0;
973                                  mb->mvs[0].y = mb->mvs[1].y = mb->mvs[2].y = mb->mvs[3].y = 0;                                  mb->mvs[0].y = mb->mvs[1].y = mb->mvs[2].y = mb->mvs[3].y = 0;
# Line 935  Line 994 
994  get_b_motion_vector(Bitstream * bs,  get_b_motion_vector(Bitstream * bs,
995                                          VECTOR * mv,                                          VECTOR * mv,
996                                          int fcode,                                          int fcode,
997                                          const VECTOR pmv)                                          const VECTOR pmv,
998                                            const DECODER * const dec,
999                                            const int x, const int y)
1000  {  {
1001          const int scale_fac = 1 << (fcode - 1);          const int scale_fac = 1 << (fcode - 1);
1002          const int high = (32 * scale_fac) - 1;          const int high = (32 * scale_fac) - 1;
# Line 967  Line 1028 
1028  decoder_bf_interpolate_mbinter(DECODER * dec,  decoder_bf_interpolate_mbinter(DECODER * dec,
1029                                                                  IMAGE forward,                                                                  IMAGE forward,
1030                                                                  IMAGE backward,                                                                  IMAGE backward,
1031                                                                  const MACROBLOCK * pMB,                                                                  MACROBLOCK * pMB,
1032                                                                  const uint32_t x_pos,                                                                  const uint32_t x_pos,
1033                                                                  const uint32_t y_pos,                                                                  const uint32_t y_pos,
1034                                                                  Bitstream * bs,                                                                  Bitstream * bs,
# Line 984  Line 1045 
1045          pU_Cur = dec->cur.u + (y_pos << 3) * stride2 + (x_pos << 3);          pU_Cur = dec->cur.u + (y_pos << 3) * stride2 + (x_pos << 3);
1046          pV_Cur = dec->cur.v + (y_pos << 3) * stride2 + (x_pos << 3);          pV_Cur = dec->cur.v + (y_pos << 3) * stride2 + (x_pos << 3);
1047    
1048            validate_vector(pMB->mvs, x_pos, y_pos, dec);
1049            validate_vector(pMB->b_mvs, x_pos, y_pos, dec);
1050    
1051          if (!direct) {          if (!direct) {
1052                  uv_dx = pMB->mvs[0].x;                  uv_dx = pMB->mvs[0].x;
1053                  uv_dy = pMB->mvs[0].y;                  uv_dy = pMB->mvs[0].y;
   
1054                  b_uv_dx = pMB->b_mvs[0].x;                  b_uv_dx = pMB->b_mvs[0].x;
1055                  b_uv_dy = pMB->b_mvs[0].y;                  b_uv_dy = pMB->b_mvs[0].y;
1056    
# Line 1000  Line 1063 
1063    
1064                  uv_dx = (uv_dx >> 1) + roundtab_79[uv_dx & 0x3];                  uv_dx = (uv_dx >> 1) + roundtab_79[uv_dx & 0x3];
1065                  uv_dy = (uv_dy >> 1) + roundtab_79[uv_dy & 0x3];                  uv_dy = (uv_dy >> 1) + roundtab_79[uv_dy & 0x3];
   
1066                  b_uv_dx = (b_uv_dx >> 1) + roundtab_79[b_uv_dx & 0x3];                  b_uv_dx = (b_uv_dx >> 1) + roundtab_79[b_uv_dx & 0x3];
1067                  b_uv_dy = (b_uv_dy >> 1) + roundtab_79[b_uv_dy & 0x3];                  b_uv_dy = (b_uv_dy >> 1) + roundtab_79[b_uv_dy & 0x3];
1068    
1069          } else {          } else {
                 if(dec->quarterpel) {  
                         uv_dx = (pMB->mvs[0].x / 2) + (pMB->mvs[1].x / 2) + (pMB->mvs[2].x / 2) + (pMB->mvs[3].x / 2);  
                         uv_dy = (pMB->mvs[0].y / 2) + (pMB->mvs[1].y / 2) + (pMB->mvs[2].y / 2) + (pMB->mvs[3].y / 2);  
                         b_uv_dx = (pMB->b_mvs[0].x / 2) + (pMB->b_mvs[1].x / 2) + (pMB->b_mvs[2].x / 2) + (pMB->b_mvs[3].x / 2);  
                         b_uv_dy = (pMB->b_mvs[0].y / 2) + (pMB->b_mvs[1].y / 2) + (pMB->b_mvs[2].y / 2) + (pMB->b_mvs[3].y / 2);  
                 } else {  
1070                          uv_dx = pMB->mvs[0].x + pMB->mvs[1].x + pMB->mvs[2].x + pMB->mvs[3].x;                          uv_dx = pMB->mvs[0].x + pMB->mvs[1].x + pMB->mvs[2].x + pMB->mvs[3].x;
1071                          uv_dy = pMB->mvs[0].y + pMB->mvs[1].y + pMB->mvs[2].y + pMB->mvs[3].y;                          uv_dy = pMB->mvs[0].y + pMB->mvs[1].y + pMB->mvs[2].y + pMB->mvs[3].y;
1072                          b_uv_dx = pMB->b_mvs[0].x + pMB->b_mvs[1].x + pMB->b_mvs[2].x + pMB->b_mvs[3].x;                          b_uv_dx = pMB->b_mvs[0].x + pMB->b_mvs[1].x + pMB->b_mvs[2].x + pMB->b_mvs[3].x;
1073                          b_uv_dy = pMB->b_mvs[0].y + pMB->b_mvs[1].y + pMB->b_mvs[2].y + pMB->b_mvs[3].y;                          b_uv_dy = pMB->b_mvs[0].y + pMB->b_mvs[1].y + pMB->b_mvs[2].y + pMB->b_mvs[3].y;
1074    
1075                    if (dec->quarterpel) {
1076                            uv_dx /= 2;
1077                            uv_dy /= 2;
1078                            b_uv_dx /= 2;
1079                            b_uv_dy /= 2;
1080                  }                  }
1081    
1082                  uv_dx = (uv_dx >> 3) + roundtab_76[uv_dx & 0xf];                  uv_dx = (uv_dx >> 3) + roundtab_76[uv_dx & 0xf];
# Line 1050  Line 1112 
1112                                                          pMB->mvs[1].x, pMB->mvs[1].y, stride, 0);                                                          pMB->mvs[1].x, pMB->mvs[1].y, stride, 0);
1113                  interpolate8x8_switch(dec->cur.y, forward.y, 16 * x_pos, 16 * y_pos + 8,                  interpolate8x8_switch(dec->cur.y, forward.y, 16 * x_pos, 16 * y_pos + 8,
1114                                                          pMB->mvs[2].x, pMB->mvs[2].y, stride, 0);                                                          pMB->mvs[2].x, pMB->mvs[2].y, stride, 0);
1115                  interpolate8x8_switch(dec->cur.y, forward.y, 16 * x_pos + 8,                  interpolate8x8_switch(dec->cur.y, forward.y, 16 * x_pos + 8, 16 * y_pos + 8,
1116                                                          16 * y_pos + 8, pMB->mvs[3].x, pMB->mvs[3].y, stride, 0);                                                          pMB->mvs[3].x, pMB->mvs[3].y, stride, 0);
1117          }          }
1118    
1119          interpolate8x8_switch(dec->cur.u, forward.u, 8 * x_pos, 8 * y_pos, uv_dx,          interpolate8x8_switch(dec->cur.u, forward.u, 8 * x_pos, 8 * y_pos, uv_dx,
# Line 1062  Line 1124 
1124    
1125          if(dec->quarterpel) {          if(dec->quarterpel) {
1126                  if(!direct) {                  if(!direct) {
1127                          interpolate16x16_quarterpel(dec->tmp.y, backward.y, dec->qtmp.y, dec->qtmp.y + 64,                          interpolate16x16_add_quarterpel(dec->cur.y, backward.y, dec->qtmp.y, dec->qtmp.y + 64,
1128                                                                                  dec->qtmp.y + 128, 16*x_pos, 16*y_pos,                                                                                  dec->qtmp.y + 128, 16*x_pos, 16*y_pos,
1129                                                                                  pMB->b_mvs[0].x, pMB->b_mvs[0].y, stride, 0);                                                                                  pMB->b_mvs[0].x, pMB->b_mvs[0].y, stride, 0);
1130                  } else {                  } else {
1131                          interpolate8x8_quarterpel(dec->tmp.y, backward.y, dec->qtmp.y, dec->qtmp.y + 64,                          interpolate8x8_add_quarterpel(dec->cur.y, backward.y, dec->qtmp.y, dec->qtmp.y + 64,
1132                                                                                  dec->qtmp.y + 128, 16*x_pos, 16*y_pos,                                                                                  dec->qtmp.y + 128, 16*x_pos, 16*y_pos,
1133                                                                                  pMB->b_mvs[0].x, pMB->b_mvs[0].y, stride, 0);                                                                                  pMB->b_mvs[0].x, pMB->b_mvs[0].y, stride, 0);
1134                          interpolate8x8_quarterpel(dec->tmp.y, backward.y, dec->qtmp.y, dec->qtmp.y + 64,                          interpolate8x8_add_quarterpel(dec->cur.y, backward.y, dec->qtmp.y, dec->qtmp.y + 64,
1135                                                                                  dec->qtmp.y + 128, 16*x_pos + 8, 16*y_pos,                                                                                  dec->qtmp.y + 128, 16*x_pos + 8, 16*y_pos,
1136                                                                                  pMB->b_mvs[1].x, pMB->b_mvs[1].y, stride, 0);                                                                                  pMB->b_mvs[1].x, pMB->b_mvs[1].y, stride, 0);
1137                          interpolate8x8_quarterpel(dec->tmp.y, backward.y, dec->qtmp.y, dec->qtmp.y + 64,                          interpolate8x8_add_quarterpel(dec->cur.y, backward.y, dec->qtmp.y, dec->qtmp.y + 64,
1138                                                                                  dec->qtmp.y + 128, 16*x_pos, 16*y_pos + 8,                                                                                  dec->qtmp.y + 128, 16*x_pos, 16*y_pos + 8,
1139                                                                                  pMB->b_mvs[2].x, pMB->b_mvs[2].y, stride, 0);                                                                                  pMB->b_mvs[2].x, pMB->b_mvs[2].y, stride, 0);
1140                          interpolate8x8_quarterpel(dec->tmp.y, backward.y, dec->qtmp.y, dec->qtmp.y + 64,                          interpolate8x8_add_quarterpel(dec->cur.y, backward.y, dec->qtmp.y, dec->qtmp.y + 64,
1141                                                                                  dec->qtmp.y + 128, 16*x_pos + 8, 16*y_pos + 8,                                                                                  dec->qtmp.y + 128, 16*x_pos + 8, 16*y_pos + 8,
1142                                                                                  pMB->b_mvs[3].x, pMB->b_mvs[3].y, stride, 0);                                                                                  pMB->b_mvs[3].x, pMB->b_mvs[3].y, stride, 0);
1143                  }                  }
1144          } else {          } else {
1145                  interpolate8x8_switch(dec->tmp.y, backward.y, 16 * x_pos, 16 * y_pos,                  interpolate8x8_add_switch(dec->cur.y, backward.y, 16 * x_pos, 16 * y_pos,
1146                                                          pMB->b_mvs[0].x, pMB->b_mvs[0].y, stride, 0);                                                          pMB->b_mvs[0].x, pMB->b_mvs[0].y, stride, 0);
1147                  interpolate8x8_switch(dec->tmp.y, backward.y, 16 * x_pos + 8,                  interpolate8x8_add_switch(dec->cur.y, backward.y, 16 * x_pos + 8,
1148                                                          16 * y_pos, pMB->b_mvs[1].x, pMB->b_mvs[1].y, stride, 0);                                                          16 * y_pos, pMB->b_mvs[1].x, pMB->b_mvs[1].y, stride, 0);
1149                  interpolate8x8_switch(dec->tmp.y, backward.y, 16 * x_pos,                  interpolate8x8_add_switch(dec->cur.y, backward.y, 16 * x_pos,
1150                                                          16 * y_pos + 8, pMB->b_mvs[2].x, pMB->b_mvs[2].y, stride, 0);                                                          16 * y_pos + 8, pMB->b_mvs[2].x, pMB->b_mvs[2].y, stride, 0);
1151                  interpolate8x8_switch(dec->tmp.y, backward.y, 16 * x_pos + 8,                  interpolate8x8_add_switch(dec->cur.y, backward.y, 16 * x_pos + 8,
1152                                                          16 * y_pos + 8, pMB->b_mvs[3].x, pMB->b_mvs[3].y, stride, 0);                                                          16 * y_pos + 8, pMB->b_mvs[3].x, pMB->b_mvs[3].y, stride, 0);
1153          }          }
1154    
1155          interpolate8x8_switch(dec->tmp.u, backward.u, 8 * x_pos, 8 * y_pos,          interpolate8x8_add_switch(dec->cur.u, backward.u, 8 * x_pos, 8 * y_pos,
1156                                                  b_uv_dx, b_uv_dy, stride2, 0);                                                  b_uv_dx, b_uv_dy, stride2, 0);
1157          interpolate8x8_switch(dec->tmp.v, backward.v, 8 * x_pos, 8 * y_pos,          interpolate8x8_add_switch(dec->cur.v, backward.v, 8 * x_pos, 8 * y_pos,
1158                                                  b_uv_dx, b_uv_dy, stride2, 0);                                                  b_uv_dx, b_uv_dy, stride2, 0);
1159    
         interpolate8x8_avg2(dec->cur.y + (16 * y_pos * stride) + 16 * x_pos,  
                                                 dec->cur.y + (16 * y_pos * stride) + 16 * x_pos,  
                                                 dec->tmp.y + (16 * y_pos * stride) + 16 * x_pos,  
                                                 stride, 1, 8);  
   
         interpolate8x8_avg2(dec->cur.y + (16 * y_pos * stride) + 16 * x_pos + 8,  
                                                 dec->cur.y + (16 * y_pos * stride) + 16 * x_pos + 8,  
                                                 dec->tmp.y + (16 * y_pos * stride) + 16 * x_pos + 8,  
                                                 stride, 1, 8);  
   
         interpolate8x8_avg2(dec->cur.y + ((16 * y_pos + 8) * stride) + 16 * x_pos,  
                                                 dec->cur.y + ((16 * y_pos + 8) * stride) + 16 * x_pos,  
                                                 dec->tmp.y + ((16 * y_pos + 8) * stride) + 16 * x_pos,  
                                                 stride, 1, 8);  
   
         interpolate8x8_avg2(dec->cur.y + ((16 * y_pos + 8) * stride) + 16 * x_pos + 8,  
                                                 dec->cur.y + ((16 * y_pos + 8) * stride) + 16 * x_pos + 8,  
                                                 dec->tmp.y + ((16 * y_pos + 8) * stride) + 16 * x_pos + 8,  
                                                 stride, 1, 8);  
   
         interpolate8x8_avg2(dec->cur.u + (8 * y_pos * stride2) + 8 * x_pos,  
                                                 dec->cur.u + (8 * y_pos * stride2) + 8 * x_pos,  
                                                 dec->tmp.u + (8 * y_pos * stride2) + 8 * x_pos,  
                                                 stride2, 1, 8);  
   
         interpolate8x8_avg2(dec->cur.v + (8 * y_pos * stride2) + 8 * x_pos,  
                                                 dec->cur.v + (8 * y_pos * stride2) + 8 * x_pos,  
                                                 dec->tmp.v + (8 * y_pos * stride2) + 8 * x_pos,  
                                                 stride2, 1, 8);  
   
1160          stop_comp_timer();          stop_comp_timer();
1161    
1162          if (cbp)          if (cbp)
# Line 1173  Line 1205 
1205          uint32_t x, y;          uint32_t x, y;
1206          VECTOR mv;          VECTOR mv;
1207          const VECTOR zeromv = {0,0};          const VECTOR zeromv = {0,0};
         const int64_t TRB = dec->time_pp - dec->time_bp, TRD = dec->time_pp;  
1208          int i;          int i;
1209    
1210            if (!dec->is_edged[0]) {
1211          start_timer();          start_timer();
1212          image_setedges(&dec->refn[0], dec->edged_width, dec->edged_height,          image_setedges(&dec->refn[0], dec->edged_width, dec->edged_height,
1213                                          dec->width, dec->height);                                                  dec->width, dec->height, dec->bs_version);
1214                    dec->is_edged[0] = 1;
1215                    stop_edges_timer();
1216            }
1217    
1218            if (!dec->is_edged[1]) {
1219                    start_timer();
1220          image_setedges(&dec->refn[1], dec->edged_width, dec->edged_height,          image_setedges(&dec->refn[1], dec->edged_width, dec->edged_height,
1221                                          dec->width, dec->height);                                                  dec->width, dec->height, dec->bs_version);
1222                    dec->is_edged[1] = 1;
1223          stop_edges_timer();          stop_edges_timer();
1224            }
1225    
1226          for (y = 0; y < dec->mb_height; y++) {          for (y = 0; y < dec->mb_height; y++) {
1227                  /* Initialize Pred Motion Vector */                  /* Initialize Pred Motion Vector */
# Line 1264  Line 1304 
1304    
1305                          switch (mb->mode) {                          switch (mb->mode) {
1306                          case MODE_DIRECT:                          case MODE_DIRECT:
1307                                  get_b_motion_vector(bs, &mv, 1, zeromv);                                  get_b_motion_vector(bs, &mv, 1, zeromv, dec, x, y);
1308    
1309                          case MODE_DIRECT_NONE_MV:                          case MODE_DIRECT_NONE_MV:
1310                                  for (i = 0; i < 4; i++) {                                  for (i = 0; i < 4; i++) {
1311                                          mb->mvs[i].x = (int32_t) ((TRB * last_mb->mvs[i].x) / TRD + mv.x);                                          mb->mvs[i].x = last_mb->mvs[i].x*dec->time_bp/dec->time_pp + mv.x;
1312                                          mb->b_mvs[i].x = (int32_t) ((mv.x == 0)                                          mb->mvs[i].y = last_mb->mvs[i].y*dec->time_bp/dec->time_pp + mv.y;
1313                                                                          ? ((TRB - TRD) * last_mb->mvs[i].x) / TRD  
1314                                                                          : mb->mvs[i].x - last_mb->mvs[i].x);                                          mb->b_mvs[i].x = (mv.x)
1315                                          mb->mvs[i].y = (int32_t) ((TRB * last_mb->mvs[i].y) / TRD + mv.y);                                                  ?  mb->mvs[i].x - last_mb->mvs[i].x
1316                                          mb->b_mvs[i].y = (int32_t) ((mv.y == 0)                                                  : last_mb->mvs[i].x*(dec->time_bp - dec->time_pp)/dec->time_pp;
1317                                                                          ? ((TRB - TRD) * last_mb->mvs[i].y) / TRD                                          mb->b_mvs[i].y = (mv.y)
1318                                                                          : mb->mvs[i].y - last_mb->mvs[i].y);                                                  ? mb->mvs[i].y - last_mb->mvs[i].y
1319                                                    : last_mb->mvs[i].y*(dec->time_bp - dec->time_pp)/dec->time_pp;
1320                                  }                                  }
1321    
1322                                  decoder_bf_interpolate_mbinter(dec, dec->refn[1], dec->refn[0],                                  decoder_bf_interpolate_mbinter(dec, dec->refn[1], dec->refn[0],
# Line 1283  Line 1324 
1324                                  break;                                  break;
1325    
1326                          case MODE_INTERPOLATE:                          case MODE_INTERPOLATE:
1327                                  get_b_motion_vector(bs, &mb->mvs[0], fcode_forward, dec->p_fmv);                                  get_b_motion_vector(bs, &mb->mvs[0], fcode_forward, dec->p_fmv, dec, x, y);
1328                                  dec->p_fmv = mb->mvs[1] = mb->mvs[2] = mb->mvs[3] =     mb->mvs[0];                                  dec->p_fmv = mb->mvs[1] = mb->mvs[2] = mb->mvs[3] =     mb->mvs[0];
1329    
1330                                  get_b_motion_vector(bs, &mb->b_mvs[0], fcode_backward, dec->p_bmv);                                  get_b_motion_vector(bs, &mb->b_mvs[0], fcode_backward, dec->p_bmv, dec, x, y);
1331                                  dec->p_bmv = mb->b_mvs[1] = mb->b_mvs[2] = mb->b_mvs[3] = mb->b_mvs[0];                                  dec->p_bmv = mb->b_mvs[1] = mb->b_mvs[2] = mb->b_mvs[3] = mb->b_mvs[0];
1332    
1333                                  decoder_bf_interpolate_mbinter(dec, dec->refn[1], dec->refn[0],                                  decoder_bf_interpolate_mbinter(dec, dec->refn[1], dec->refn[0],
# Line 1294  Line 1335 
1335                                  break;                                  break;
1336    
1337                          case MODE_BACKWARD:                          case MODE_BACKWARD:
1338                                  get_b_motion_vector(bs, &mb->mvs[0], fcode_backward, dec->p_bmv);                                  get_b_motion_vector(bs, &mb->mvs[0], fcode_backward, dec->p_bmv, dec, x, y);
1339                                  dec->p_bmv = mb->mvs[1] = mb->mvs[2] = mb->mvs[3] =     mb->mvs[0];                                  dec->p_bmv = mb->mvs[1] = mb->mvs[2] = mb->mvs[3] =     mb->mvs[0];
1340    
1341                                  decoder_mbinter(dec, mb, x, y, mb->cbp, bs, 0, 0, 0);                                  decoder_mbinter(dec, mb, x, y, mb->cbp, bs, 0, 0, 0);
1342                                  break;                                  break;
1343    
1344                          case MODE_FORWARD:                          case MODE_FORWARD:
1345                                  get_b_motion_vector(bs, &mb->mvs[0], fcode_forward, dec->p_fmv);                                  get_b_motion_vector(bs, &mb->mvs[0], fcode_forward, dec->p_fmv, dec, x, y);
1346                                  dec->p_fmv = mb->mvs[1] = mb->mvs[2] = mb->mvs[3] =     mb->mvs[0];                                  dec->p_fmv = mb->mvs[1] = mb->mvs[2] = mb->mvs[3] =     mb->mvs[0];
1347    
1348                                  decoder_mbinter(dec, mb, x, y, mb->cbp, bs, 0, 0, 1);                                  decoder_mbinter(dec, mb, x, y, mb->cbp, bs, 0, 0, 1);
# Line 1316  Line 1357 
1357    
1358  /* perform post processing if necessary, and output the image */  /* perform post processing if necessary, and output the image */
1359  void decoder_output(DECODER * dec, IMAGE * img, MACROBLOCK * mbs,  void decoder_output(DECODER * dec, IMAGE * img, MACROBLOCK * mbs,
1360                                          xvid_dec_frame_t * frame, xvid_dec_stats_t * stats, int coding_type)                                          xvid_dec_frame_t * frame, xvid_dec_stats_t * stats,
1361                                            int coding_type, int quant)
1362  {  {
1363          if (frame->general & (XVID_DEBLOCKY|XVID_DEBLOCKUV) && mbs != NULL)     /* post process */          const int brightness = XVID_VERSION_MINOR(frame->version) >= 1 ? frame->brightness : 0;
1364    
1365            if (dec->cartoon_mode)
1366                    frame->general &= ~XVID_FILMEFFECT;
1367    
1368            if ((frame->general & (XVID_DEBLOCKY|XVID_DEBLOCKUV|XVID_FILMEFFECT) || brightness!=0)
1369                    && mbs != NULL) /* post process */
1370          {          {
1371                  /* note: image is stored to tmp */                  /* note: image is stored to tmp */
1372                  image_copy(&dec->tmp, img, dec->edged_width, dec->height);                  image_copy(&dec->tmp, img, dec->edged_width, dec->height);
1373                  image_postproc(&dec->tmp, dec->edged_width,                  image_postproc(&dec->postproc, &dec->tmp, dec->edged_width,
1374                                             mbs, dec->mb_width, dec->mb_height, dec->mb_width,                                             mbs, dec->mb_width, dec->mb_height, dec->mb_width,
1375                                             frame->general, dec->frames);                                             frame->general, brightness, dec->frames, (coding_type == B_VOP));
1376                  img = &dec->tmp;                  img = &dec->tmp;
1377          }          }
1378    
# Line 1336  Line 1384 
1384                  stats->type = coding2type(coding_type);                  stats->type = coding2type(coding_type);
1385                  stats->data.vop.time_base = (int)dec->time_base;                  stats->data.vop.time_base = (int)dec->time_base;
1386                  stats->data.vop.time_increment = 0;     /* XXX: todo */                  stats->data.vop.time_increment = 0;     /* XXX: todo */
1387                    stats->data.vop.qscale_stride = dec->mb_width;
1388                    stats->data.vop.qscale = dec->qscale;
1389                    if (stats->data.vop.qscale != NULL && mbs != NULL) {
1390                            int i;
1391                            for (i = 0; i < dec->mb_width*dec->mb_height; i++)
1392                                    stats->data.vop.qscale[i] = mbs[i].quant;
1393                    } else
1394                            stats->data.vop.qscale = NULL;
1395          }          }
1396  }  }
1397    
   
1398  int  int
1399  decoder_decode(DECODER * dec,  decoder_decode(DECODER * dec,
1400                                  xvid_dec_frame_t * frame, xvid_dec_stats_t * stats)                                  xvid_dec_frame_t * frame, xvid_dec_stats_t * stats)
# Line 1348  Line 1403 
1403          Bitstream bs;          Bitstream bs;
1404          uint32_t rounding;          uint32_t rounding;
1405          uint32_t reduced_resolution;          uint32_t reduced_resolution;
1406          uint32_t quant;          uint32_t quant = 2;
1407          uint32_t fcode_forward;          uint32_t fcode_forward;
1408          uint32_t fcode_backward;          uint32_t fcode_backward;
1409          uint32_t intra_dc_threshold;          uint32_t intra_dc_threshold;
# Line 1371  Line 1426 
1426                  /* if not decoding "low_delay/packed", and this isn't low_delay and                  /* if not decoding "low_delay/packed", and this isn't low_delay and
1427                          we have a reference frame, then outout the reference frame */                          we have a reference frame, then outout the reference frame */
1428                  if (!(dec->low_delay_default && dec->packed_mode) && !dec->low_delay && dec->frames>0) {                  if (!(dec->low_delay_default && dec->packed_mode) && !dec->low_delay && dec->frames>0) {
1429                          decoder_output(dec, &dec->refn[0], dec->last_mbs, frame, stats, dec->last_coding_type);                          decoder_output(dec, &dec->refn[0], dec->last_mbs, frame, stats, dec->last_coding_type, quant);
1430                          dec->frames = 0;                          dec->frames = 0;
1431                          ret = 0;                          ret = 0;
1432                  } else {                  } else {
# Line 1436  Line 1491 
1491                  goto repeat;                  goto repeat;
1492          }          }
1493    
1494            if(dec->frames == 0 && coding_type != I_VOP) {
1495                    /* 1st frame is not an i-vop */
1496                    goto repeat;
1497            }
1498    
1499          dec->p_bmv.x = dec->p_bmv.y = dec->p_fmv.y = dec->p_fmv.y = 0;  /* init pred vector to 0 */          dec->p_bmv.x = dec->p_bmv.y = dec->p_fmv.y = dec->p_fmv.y = 0;  /* init pred vector to 0 */
1500    
1501          /* packed_mode: special-N_VOP treament */          /* packed_mode: special-N_VOP treament */
1502          if (dec->packed_mode && coding_type == N_VOP) {          if (dec->packed_mode && coding_type == N_VOP) {
1503                  if (dec->low_delay_default && dec->frames > 0) {                  if (dec->low_delay_default && dec->frames > 0) {
1504                          decoder_output(dec, &dec->refn[0], dec->last_mbs, frame, stats, dec->last_coding_type);                          decoder_output(dec, &dec->refn[0], dec->last_mbs, frame, stats, dec->last_coding_type, quant);
1505                          output = 1;                          output = 1;
1506                  }                  }
1507                  /* ignore otherwise */                  /* ignore otherwise */
# Line 1475  Line 1535 
1535                  /* note: for packed_mode, output is performed when the special-N_VOP is decoded */                  /* note: for packed_mode, output is performed when the special-N_VOP is decoded */
1536                  if (!(dec->low_delay_default && dec->packed_mode)) {                  if (!(dec->low_delay_default && dec->packed_mode)) {
1537                          if (dec->low_delay) {                          if (dec->low_delay) {
1538                                  decoder_output(dec, &dec->cur, dec->mbs, frame, stats, coding_type);                                  decoder_output(dec, &dec->cur, dec->mbs, frame, stats, coding_type, quant);
1539                                  output = 1;                                  output = 1;
1540                          } else if (dec->frames > 0)     { /* is the reference frame valid? */                          } else if (dec->frames > 0)     { /* is the reference frame valid? */
1541                                  /* output the reference frame */                                  /* output the reference frame */
1542                                  decoder_output(dec, &dec->refn[0], dec->last_mbs, frame, stats, dec->last_coding_type);                                  decoder_output(dec, &dec->refn[0], dec->last_mbs, frame, stats, dec->last_coding_type, quant);
1543                                  output = 1;                                  output = 1;
1544                          }                          }
1545                  }                  }
1546    
1547                  image_swap(&dec->refn[0], &dec->refn[1]);                  image_swap(&dec->refn[0], &dec->refn[1]);
1548                    dec->is_edged[1] = dec->is_edged[0];
1549                  image_swap(&dec->cur, &dec->refn[0]);                  image_swap(&dec->cur, &dec->refn[0]);
1550                    dec->is_edged[0] = 0;
1551                  SWAP(MACROBLOCK *, dec->mbs, dec->last_mbs);                  SWAP(MACROBLOCK *, dec->mbs, dec->last_mbs);
1552                  dec->last_reduced_resolution = reduced_resolution;                  dec->last_reduced_resolution = reduced_resolution;
1553                  dec->last_coding_type = coding_type;                  dec->last_coding_type = coding_type;
# Line 1497  Line 1559 
1559    
1560                  if (dec->low_delay) {                  if (dec->low_delay) {
1561                          DPRINTF(XVID_DEBUG_ERROR, "warning: bvop found in low_delay==1 stream\n");                          DPRINTF(XVID_DEBUG_ERROR, "warning: bvop found in low_delay==1 stream\n");
1562                          dec->low_delay = 1;                          dec->low_delay = 0;
1563                  }                  }
1564    
1565                  if (dec->frames < 2) {                  if (dec->frames < 2) {
1566                          /* attemping to decode a bvop without atleast 2 reference frames */                          /* attemping to decode a bvop without atleast 2 reference frames */
1567                          image_printf(&dec->cur, dec->edged_width, dec->height, 16, 16,                          image_printf(&dec->cur, dec->edged_width, dec->height, 16, 16,
1568                                                  "broken b-frame, mising ref frames");                                                  "broken b-frame, mising ref frames");
1569                          stats->type = XVID_TYPE_NOTHING;                          if (stats) stats->type = XVID_TYPE_NOTHING;
1570                  } else if (dec->time_pp <= dec->time_bp) {                  } else if (dec->time_pp <= dec->time_bp) {
1571                          /* this occurs when dx50_bvop_compatibility==0 sequences are                          /* this occurs when dx50_bvop_compatibility==0 sequences are
1572                          decoded in vfw. */                          decoded in vfw. */
1573                          image_printf(&dec->cur, dec->edged_width, dec->height, 16, 16,                          image_printf(&dec->cur, dec->edged_width, dec->height, 16, 16,
1574                                                  "broken b-frame, tpp=%i tbp=%i", dec->time_pp, dec->time_bp);                                                  "broken b-frame, tpp=%i tbp=%i", dec->time_pp, dec->time_bp);
1575                          stats->type = XVID_TYPE_NOTHING;                          if (stats) stats->type = XVID_TYPE_NOTHING;
1576                  } else {                  } else {
1577                          decoder_bframe(dec, &bs, quant, fcode_forward, fcode_backward);                          decoder_bframe(dec, &bs, quant, fcode_forward, fcode_backward);
1578                          decoder_output(dec, &dec->cur, dec->mbs, frame, stats, coding_type);                          decoder_output(dec, &dec->cur, dec->mbs, frame, stats, coding_type, quant);
1579                  }                  }
1580    
1581                  output = 1;                  output = 1;
1582                  dec->frames++;                  dec->frames++;
1583          }          }
1584    
1585    #if 0 /* Avoids to read to much data because of 32bit reads in our BS functions */
1586          BitstreamByteAlign(&bs);          BitstreamByteAlign(&bs);
1587    #endif
1588    
1589          /* low_delay_default mode: repeat in packed_mode */          /* low_delay_default mode: repeat in packed_mode */
1590          if (dec->low_delay_default && dec->packed_mode && output == 0 && success == 0) {          if (dec->low_delay_default && dec->packed_mode && output == 0 && success == 0) {
# Line 1535  Line 1599 
1599          if (dec->low_delay_default && output == 0) {          if (dec->low_delay_default && output == 0) {
1600                  if (dec->packed_mode && seen_something) {                  if (dec->packed_mode && seen_something) {
1601                          /* output the recently decoded frame */                          /* output the recently decoded frame */
1602                          decoder_output(dec, &dec->refn[0], dec->last_mbs, frame, stats, dec->last_coding_type);                          decoder_output(dec, &dec->refn[0], dec->last_mbs, frame, stats, dec->last_coding_type, quant);
1603                  } else {                  } else {
1604                          image_clear(&dec->cur, dec->width, dec->height, dec->edged_width, 0, 128, 128);                          image_clear(&dec->cur, dec->width, dec->height, dec->edged_width, 0, 128, 128);
1605                          image_printf(&dec->cur, dec->edged_width, dec->height, 16, 16,                          image_printf(&dec->cur, dec->edged_width, dec->height, 16, 16,
# Line 1543  Line 1607 
1607                          image_printf(&dec->cur, dec->edged_width, dec->height, 16, 64,                          image_printf(&dec->cur, dec->edged_width, dec->height, 16, 64,
1608                                  "bframe decoder lag");                                  "bframe decoder lag");
1609    
1610                          decoder_output(dec, &dec->cur, NULL, frame, stats, P_VOP);                          decoder_output(dec, &dec->cur, NULL, frame, stats, P_VOP, quant);
1611                          if (stats) stats->type = XVID_TYPE_NOTHING;                          if (stats) stats->type = XVID_TYPE_NOTHING;
1612                  }                  }
1613          }          }
# Line 1551  Line 1615 
1615          emms();          emms();
1616          stop_global_timer();          stop_global_timer();
1617    
1618          return BitstreamPos(&bs) / 8;   /* number of bytes consumed */          return (BitstreamPos(&bs) + 7) / 8;     /* number of bytes consumed */
1619  }  }

Legend:
Removed from v.1.49.2.26  
changed lines
  Added in v.1.67

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