[svn] / branches / release-1_3-branch / xvidcore / src / decoder.c Repository:
ViewVC logotype

Diff of /branches/release-1_3-branch/xvidcore/src/decoder.c

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

revision 2179, Tue Nov 12 14:41:36 2019 UTC revision 2180, Tue Nov 12 14:48:35 2019 UTC
# Line 149  Line 149 
149  int  int
150  decoder_create(xvid_dec_create_t * create)  decoder_create(xvid_dec_create_t * create)
151  {  {
152      int ret = 0;
153    DECODER *dec;    DECODER *dec;
154    
155    if (XVID_VERSION_MAJOR(create->version) != 1) /* v1.x.x */    if (XVID_VERSION_MAJOR(create->version) != 1) /* v1.x.x */
# Line 169  Line 170 
170    
171    create->handle = dec;    create->handle = dec;
172    
173    dec->width = create->width;    dec->width = MAX(0, create->width);
174    dec->height = create->height;    dec->height = MAX(0, create->height);
175    
176    dec->num_threads = MAX(0, create->num_threads);    dec->num_threads = MAX(0, create->num_threads);
177    
# Line 209  Line 210 
210    
211    dec->fixed_dimensions = (dec->width > 0 && dec->height > 0);    dec->fixed_dimensions = (dec->width > 0 && dec->height > 0);
212    
213    if (dec->fixed_dimensions) {    ret = decoder_resize(dec);
     int ret = decoder_resize(dec);  
214      if (ret == XVID_ERR_MEMORY) create->handle = NULL;      if (ret == XVID_ERR_MEMORY) create->handle = NULL;
215    
216      return ret;      return ret;
217    }    }
   else  
     return 0;  
 }  
218    
219    
220  int  int
# Line 266  Line 264 
264    uint32_t stride2 = stride / 2;    uint32_t stride2 = stride / 2;
265    uint32_t next_block = stride * 8;    uint32_t next_block = stride * 8;
266    uint32_t i;    uint32_t i;
267    uint32_t iQuant = pMB->quant;    uint32_t iQuant = MAX(1, pMB->quant);
268    uint8_t *pY_Cur, *pU_Cur, *pV_Cur;    uint8_t *pY_Cur, *pU_Cur, *pV_Cur;
269    
270    pY_Cur = dec->cur.y + (y_pos << 4) * stride + (x_pos << 4);    pY_Cur = dec->cur.y + (y_pos << 4) * stride + (x_pos << 4);
# Line 363  Line 361 
361    
362    int stride = dec->edged_width;    int stride = dec->edged_width;
363    int i;    int i;
364    const uint32_t iQuant = pMB->quant;    const uint32_t iQuant = MAX(1, pMB->quant);
365    const int direction = dec->alternate_vertical_scan ? 2 : 0;    const int direction = dec->alternate_vertical_scan ? 2 : 0;
366    typedef void (*get_inter_block_function_t)(    typedef void (*get_inter_block_function_t)(
367        Bitstream * bs,        Bitstream * bs,
# Line 1540  Line 1538 
1538      img = &dec->tmp;      img = &dec->tmp;
1539    }    }
1540    
1541      if ((frame->output.plane[0] != NULL) && (frame->output.stride[0] >= dec->width)) {
1542    image_output(img, dec->width, dec->height,    image_output(img, dec->width, dec->height,
1543           dec->edged_width, (uint8_t**)frame->output.plane, frame->output.stride,           dec->edged_width, (uint8_t**)frame->output.plane, frame->output.stride,
1544           frame->output.csp, dec->interlacing);           frame->output.csp, dec->interlacing);
1545      }
1546    
1547    if (stats) {    if (stats) {
1548      stats->type = coding2type(coding_type);      stats->type = coding2type(coding_type);
# Line 1565  Line 1565 
1565  {  {
1566    
1567    Bitstream bs;    Bitstream bs;
1568    uint32_t rounding;    uint32_t rounding = 0;
1569    uint32_t quant = 2;    uint32_t quant = 2;
1570    uint32_t fcode_forward;    uint32_t fcode_forward = 0;
1571    uint32_t fcode_backward;    uint32_t fcode_backward = 0;
1572    uint32_t intra_dc_threshold;    uint32_t intra_dc_threshold = 0;
1573    WARPPOINTS gmc_warp;    WARPPOINTS gmc_warp;
1574    int coding_type;    int coding_type = -1;
1575    int success, output, seen_something;    int success, output, seen_something;
1576    
1577    if (XVID_VERSION_MAJOR(frame->version) != 1 || (stats && XVID_VERSION_MAJOR(stats->version) != 1))  /* v1.x.x */    if (XVID_VERSION_MAJOR(frame->version) != 1 || (stats && XVID_VERSION_MAJOR(stats->version) != 1))  /* v1.x.x */
1578      return XVID_ERR_VERSION;      return XVID_ERR_VERSION;
1579    
1580    start_global_timer();    start_global_timer();
1581      memset((void *)&gmc_warp, 0, sizeof(WARPPOINTS));
1582    
1583    dec->low_delay_default = (frame->general & XVID_LOWDELAY);    dec->low_delay_default = (frame->general & XVID_LOWDELAY);
1584    if ((frame->general & XVID_DISCONTINUITY))    if ((frame->general & XVID_DISCONTINUITY))
# Line 1664  Line 1665 
1665      goto repeat;      goto repeat;
1666    }    }
1667    
1668    if(dec->frames == 0 && coding_type != I_VOP) {    if((dec->frames == 0 && coding_type != I_VOP) || (!dec->width || !dec->height)) {
1669      /* 1st frame is not an i-vop */      /* 1st frame is not an i-vop */
1670      goto repeat;      goto repeat;
1671    }    }

Legend:
Removed from v.2179  
changed lines
  Added in v.2180

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