[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.19, Thu Nov 13 22:35:30 2003 UTC revision 1.49.2.25, Sat Dec 13 13:52:25 2003 UTC
# Line 41  Line 41 
41  #include "bitstream/mbcoding.h"  #include "bitstream/mbcoding.h"
42    
43  #include "quant/quant.h"  #include "quant/quant.h"
44    #include "quant/quant_matrix.h"
45  #include "dct/idct.h"  #include "dct/idct.h"
46  #include "dct/fdct.h"  #include "dct/fdct.h"
47  #include "utils/mem_transfer.h"  #include "utils/mem_transfer.h"
# Line 57  Line 58 
58    
59  #include "image/image.h"  #include "image/image.h"
60  #include "image/colorspace.h"  #include "image/colorspace.h"
61    #include "image/postprocessing.h"
62  #include "utils/mem_align.h"  #include "utils/mem_align.h"
63    
64  static int  static int
# Line 175  Line 177 
177          if (dec == NULL) {          if (dec == NULL) {
178                  return XVID_ERR_MEMORY;                  return XVID_ERR_MEMORY;
179          }          }
180    
181          memset(dec, 0, sizeof(DECODER));          memset(dec, 0, sizeof(DECODER));
182    
183            dec->mpeg_quant_matrices = xvid_malloc(sizeof(uint16_t) * 64 * 8, CACHE_LINE);
184            if (dec->mpeg_quant_matrices == NULL) {
185                    xvid_free(dec);
186                    return XVID_ERR_MEMORY;
187            }
188    
189          create->handle = dec;          create->handle = dec;
190    
191          dec->width = create->width;          dec->width = create->width;
# Line 196  Line 205 
205          dec->last_mbs = NULL;          dec->last_mbs = NULL;
206    
207          init_timer();          init_timer();
208            init_mpeg_matrix(dec->mpeg_quant_matrices);
209    
210          /* For B-frame support (used to save reference frame's time */          /* For B-frame support (used to save reference frame's time */
211          dec->frames = 0;          dec->frames = 0;
# Line 226  Line 236 
236          image_destroy(&dec->tmp, dec->edged_width, dec->edged_height);          image_destroy(&dec->tmp, dec->edged_width, dec->edged_height);
237          image_destroy(&dec->qtmp, dec->edged_width, dec->edged_height);          image_destroy(&dec->qtmp, dec->edged_width, dec->edged_height);
238          image_destroy(&dec->cur, dec->edged_width, dec->edged_height);          image_destroy(&dec->cur, dec->edged_width, dec->edged_height);
239            xvid_free(dec->mpeg_quant_matrices);
240          xvid_free(dec);          xvid_free(dec);
241    
242          write_timer();          write_timer();
# Line 321  Line 332 
332    
333                  start_timer();                  start_timer();
334                  if (dec->quant_type == 0) {                  if (dec->quant_type == 0) {
335                          dequant_h263_intra(&data[i * 64], &block[i * 64], iQuant, iDcScaler);                          dequant_h263_intra(&data[i * 64], &block[i * 64], iQuant, iDcScaler, dec->mpeg_quant_matrices);
336                  } else {                  } else {
337                          dequant_mpeg_intra(&data[i * 64], &block[i * 64], iQuant, iDcScaler);                          dequant_mpeg_intra(&data[i * 64], &block[i * 64], iQuant, iDcScaler, dec->mpeg_quant_matrices);
338                  }                  }
339                  stop_iquant_timer();                  stop_iquant_timer();
340    
# Line 392  Line 403 
403                          stop_coding_timer();                          stop_coding_timer();
404    
405                          start_timer();                          start_timer();
406                          dequant(&data[i * 64], block, iQuant);                          dequant(&data[i * 64], block, iQuant, dec->mpeg_quant_matrices);
407                          stop_iquant_timer();                          stop_iquant_timer();
408    
409                          start_timer();                          start_timer();
# Line 1306  Line 1317 
1317  void decoder_output(DECODER * dec, IMAGE * img, MACROBLOCK * mbs,  void decoder_output(DECODER * dec, IMAGE * img, MACROBLOCK * mbs,
1318                                          xvid_dec_frame_t * frame, xvid_dec_stats_t * stats, int coding_type)                                          xvid_dec_frame_t * frame, xvid_dec_stats_t * stats, int coding_type)
1319  {  {
1320            if (frame->general & (XVID_DEBLOCKY|XVID_DEBLOCKUV) && mbs != NULL)     /* post process */
1321            {
1322                    /* note: image is stored to tmp */
1323                    image_copy(&dec->tmp, img, dec->edged_width, dec->height);
1324                    image_deblock(&dec->tmp, dec->edged_width,
1325                                              mbs, dec->mb_width, dec->mb_height, dec->mb_width,
1326                                              frame->general);
1327                    img = &dec->tmp;
1328            }
1329    
1330          image_output(img, dec->width, dec->height,          image_output(img, dec->width, dec->height,
1331                                   dec->edged_width, (uint8_t**)frame->output.plane, frame->output.stride,                                   dec->edged_width, (uint8_t**)frame->output.plane, frame->output.stride,
1332                                   frame->output.csp, dec->interlacing);                                   frame->output.csp, dec->interlacing);
# Line 1440  Line 1461 
1461                          /* XXX: not_coded vops are not used for forward prediction */                          /* XXX: not_coded vops are not used for forward prediction */
1462                          /* we should not swap(last_mbs,mbs) */                          /* we should not swap(last_mbs,mbs) */
1463                          image_copy(&dec->cur, &dec->refn[0], dec->edged_width, dec->height);                          image_copy(&dec->cur, &dec->refn[0], dec->edged_width, dec->height);
1464                            SWAP(MACROBLOCK *, dec->mbs, dec->last_mbs); /* it will be swapped back */
1465                          break;                          break;
1466                  }                  }
1467    
# Line 1481  Line 1503 
1503                          /* attemping to decode a bvop without atleast 2 reference frames */                          /* attemping to decode a bvop without atleast 2 reference frames */
1504                          image_printf(&dec->cur, dec->edged_width, dec->height, 16, 16,                          image_printf(&dec->cur, dec->edged_width, dec->height, 16, 16,
1505                                                  "broken b-frame, mising ref frames");                                                  "broken b-frame, mising ref frames");
1506                            stats->type = XVID_TYPE_NOTHING;
1507                  } else if (dec->time_pp <= dec->time_bp) {                  } else if (dec->time_pp <= dec->time_bp) {
1508                          /* this occurs when dx50_bvop_compatibility==0 sequences are                          /* this occurs when dx50_bvop_compatibility==0 sequences are
1509                          decoded in vfw. */                          decoded in vfw. */
1510                          image_printf(&dec->cur, dec->edged_width, dec->height, 16, 16,                          image_printf(&dec->cur, dec->edged_width, dec->height, 16, 16,
1511                                                  "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);
1512                            stats->type = XVID_TYPE_NOTHING;
1513                  } else {                  } else {
1514                          decoder_bframe(dec, &bs, quant, fcode_forward, fcode_backward);                          decoder_bframe(dec, &bs, quant, fcode_forward, fcode_backward);
1515                            decoder_output(dec, &dec->cur, dec->mbs, frame, stats, coding_type);
1516                  }                  }
1517    
                 decoder_output(dec, &dec->cur, dec->mbs, frame, stats, coding_type);  
1518                  output = 1;                  output = 1;
1519                  dec->frames++;                  dec->frames++;
1520          }          }

Legend:
Removed from v.1.49.2.19  
changed lines
  Added in v.1.49.2.25

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