Revision 5bbad3eb libavcodec/h261.c

View differences:

libavcodec/h261.c
325 325
        i = 1;
326 326
    } else if((block[0]==1 || block[0] == -1) && (s->block_last_index[n] > -1)){
327 327
        //special case
328
        put_bits(&s->pb,1,1);
329
        put_bits(&s->pb,1,block[0]>0 ? 0 : 1 );
328
        put_bits(&s->pb,2,block[0]>0 ? 2 : 3 );
330 329
        i = 1;
331 330
    } else {
332 331
        i = 0;
......
354 353
            if (code == rl->n) {
355 354
                put_bits(&s->pb, 6, run);
356 355
                assert(slevel != 0);
357
                if(slevel < -127){
358
                    slevel = -127;
359
                }
360
                else if(slevel > 127){
361
                    slevel = 127;
362
                }
356
                assert(level <= 127);
363 357
                put_bits(&s->pb, 8, slevel & 0xff);
364 358
            } else {
365 359
                put_bits(&s->pb, 1, sign);
......
742 736
            /* escape */
743 737
            // The remaining combinations of (run, level) are encoded with a 20-bit word consisting of 6 bits escape, 6 bits run and 8 bits level.
744 738
            run = get_bits(&s->gb, 6);
745
            level = (int8_t)get_bits(&s->gb, 8);
739
            level = get_sbits(&s->gb, 8);
746 740
        }else if(code == 0){
747 741
            break;
748 742
        }else{

Also available in: Unified diff