#define SVQ1_CALC_CODEBOOK_ENTRIES(cbook)\
codebook = (const uint32_t *) cbook[level];\
- bit_cache = get_bits (bitbuf, 4*stages);\
+ if (stages > 0)\
+ bit_cache = get_bits (bitbuf, 4*stages);\
/* calculate codebook entries for this vector */\
for (j=0; j < stages; j++) {\
entries[j] = (((bit_cache >> (4*(stages - j - 1))) & 0xF) + 16*j) << (level + 1);\
/* add median of motion vector predictors and clip result */
if (i == 1)
- mv->y = ((diff + mid_pred(pmv[0]->y, pmv[1]->y, pmv[2]->y)) << 26) >> 26;
+ mv->y = sign_extend(diff + mid_pred(pmv[0]->y, pmv[1]->y, pmv[2]->y), 6);
else
- mv->x = ((diff + mid_pred(pmv[0]->x, pmv[1]->x, pmv[2]->x)) << 26) >> 26;
+ mv->x = sign_extend(diff + mid_pred(pmv[0]->x, pmv[1]->x, pmv[2]->x), 6);
}
return 0;
av_dlog(s->avctx, "Error in svq1_decode_frame_header %i\n",result);
return result;
}
+ avcodec_set_dimensions(avctx, s->width, s->height);
//FIXME this avoids some confusion for "B frames" without 2 references
//this should be removed after libavcodec can handle more flexible picture types & ordering