comparison huffyuv.c @ 1529:cb523a2ca00f libavcodec

fix the case where all vlc codes are 8 bits long (repeat=256)
author michael
date Mon, 13 Oct 2003 19:38:34 +0000
parents ca634e47065c
children 932d306bf1dc
comparison
equal deleted inserted replaced
1528:ca634e47065c 1529:cb523a2ca00f
436 static void store_table(HYuvContext *s, uint8_t *len){ 436 static void store_table(HYuvContext *s, uint8_t *len){
437 int i; 437 int i;
438 int index= s->avctx->extradata_size; 438 int index= s->avctx->extradata_size;
439 439
440 for(i=0; i<256;){ 440 for(i=0; i<256;){
441 int cur=i;
442 int val= len[i]; 441 int val= len[i];
443 int repeat; 442 int repeat=0;
444 443
445 for(; i<256 && len[i]==val; i++); 444 for(; i<256 && len[i]==val && repeat<255; i++)
446 445 repeat++;
447 repeat= i - cur; 446
448 447 assert(val < 32 && val >0 && repeat<256 && repeat>0);
449 if(repeat>7){ 448 if(repeat>7){
450 ((uint8_t*)s->avctx->extradata)[index++]= val; 449 ((uint8_t*)s->avctx->extradata)[index++]= val;
451 ((uint8_t*)s->avctx->extradata)[index++]= repeat; 450 ((uint8_t*)s->avctx->extradata)[index++]= repeat;
452 }else{ 451 }else{
453 ((uint8_t*)s->avctx->extradata)[index++]= val | (repeat<<5); 452 ((uint8_t*)s->avctx->extradata)[index++]= val | (repeat<<5);