X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;ds=sidebyside;f=libavcodec%2Fsvq1dec.c;h=83fe07e4c7c463ac871675108e30fca1979b575a;hb=c48883163d6c7ff0806687bf3ee33ca9f8e7dede;hp=abd8adc6d174584b15d7c5f3bde3726705658c27;hpb=92afb431621c79155fcb7171d26f137eb1bee028;p=ffmpeg diff --git a/libavcodec/svq1dec.c b/libavcodec/svq1dec.c index abd8adc6d17..83fe07e4c7c 100644 --- a/libavcodec/svq1dec.c +++ b/libavcodec/svq1dec.c @@ -195,7 +195,8 @@ static const uint8_t string_table[256] = { #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);\ @@ -317,9 +318,9 @@ static int svq1_decode_motion_vector (GetBitContext *bitbuf, svq1_pmv *mv, svq1_ /* 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;