diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2003-10-13 19:38:34 +0000 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2003-10-13 19:38:34 +0000 |
commit | a003ee9a44eca32707eaa049171bc752ba3a9fde (patch) | |
tree | 24a77130290d6d414f36e6a202166f2a9b5bd944 | |
parent | 7674347b64c8b870b5e0482db175ab382f66febb (diff) | |
download | ffmpeg-a003ee9a44eca32707eaa049171bc752ba3a9fde.tar.gz |
fix the case where all vlc codes are 8 bits long (repeat=256)
Originally committed as revision 2374 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r-- | libavcodec/huffyuv.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/libavcodec/huffyuv.c b/libavcodec/huffyuv.c index 7f3e4617b1..e5e492b9b3 100644 --- a/libavcodec/huffyuv.c +++ b/libavcodec/huffyuv.c @@ -438,14 +438,13 @@ static void store_table(HYuvContext *s, uint8_t *len){ int index= s->avctx->extradata_size; for(i=0; i<256;){ - int cur=i; int val= len[i]; - int repeat; + int repeat=0; - for(; i<256 && len[i]==val; i++); - - repeat= i - cur; + for(; i<256 && len[i]==val && repeat<255; i++) + repeat++; + assert(val < 32 && val >0 && repeat<256 && repeat>0); if(repeat>7){ ((uint8_t*)s->avctx->extradata)[index++]= val; ((uint8_t*)s->avctx->extradata)[index++]= repeat; |