Revision 3bf43d42 libavcodec/h263.c

View differences:

libavcodec/h263.c
624 624
        }
625 625

  
626 626
        if (val >= 0) {
627
            val--;
628
            code = (val >> bit_size) + 1;
629
            bits = val & (range - 1);
630 627
            sign = 0;
631 628
        } else {
632 629
            val = -val;
633
            val--;
634
            code = (val >> bit_size) + 1;
635
            bits = val & (range - 1);
636 630
            sign = 1;
637 631
        }
632
        val--;
633
        code = (val >> bit_size) + 1;
634
        bits = val & (range - 1);
638 635

  
639 636
        put_bits(&s->pb, mvtab[code][1] + 1, (mvtab[code][0] << 1) | sign); 
640 637
        if (bit_size > 0) {
......
728 725
{
729 726
    int level, uni_code, uni_len;
730 727

  
731
    for(level=-255; level<256; level++){
728
    for(level=-256; level<256; level++){
732 729
        int size, v, l;
733 730
        /* find number of bits */
734 731
        size = 0;
......
2509 2506
            }
2510 2507
            
2511 2508
            // FIXME a bunch of grayscale shape things
2512
            if(get_bits1(&s->gb)) printf("Quant-Type not supported\n");  /* vol_quant_type */ //FIXME
2509

  
2510
            if(get_bits1(&s->gb)){ /* vol_quant_type */
2511
                int i, j, v;
2512
                /* load default matrixes */
2513
                for(i=0; i<64; i++){
2514
                    v= ff_mpeg4_default_intra_matrix[i];
2515
                    s->intra_matrix[i]= v;
2516
                    s->chroma_intra_matrix[i]= v;
2517
                    
2518
                    v= ff_mpeg4_default_non_intra_matrix[i];
2519
                    s->non_intra_matrix[i]= v;
2520
                    s->chroma_non_intra_matrix[i]= v;
2521
                }
2522

  
2523
                /* load custom intra matrix */
2524
                if(get_bits1(&s->gb)){
2525
                    for(i=0; i<64; i++){
2526
                        v= get_bits(&s->gb, 8);
2527
                        if(v==0) break;
2528

  
2529
                        j= zigzag_direct[i];
2530
                        s->intra_matrix[j]= v;
2531
                        s->chroma_intra_matrix[j]= v;
2532
                    }
2533
                }
2534

  
2535
                /* load custom non intra matrix */
2536
                if(get_bits1(&s->gb)){
2537
                    for(i=0; i<64; i++){
2538
                        v= get_bits(&s->gb, 8);
2539
                        if(v==0) break;
2540

  
2541
                        j= zigzag_direct[i];
2542
                        s->non_intra_matrix[j]= v;
2543
                        s->chroma_non_intra_matrix[j]= v;
2544
                    }
2545

  
2546
                    /* replicate last value */
2547
                    for(; i<64; i++){
2548
                        j= zigzag_direct[i];
2549
                        s->non_intra_matrix[j]= v;
2550
                        s->chroma_non_intra_matrix[j]= v;
2551
                    }
2552
                }
2553

  
2554
                s->dct_unquantize= s->dct_unquantize_mpeg;
2555

  
2556
                // FIXME a bunch of grayscale shape things
2557
            }else
2558
                s->dct_unquantize= s->dct_unquantize_h263;
2559

  
2513 2560
            if(vo_ver_id != 1)
2514 2561
                 s->quarter_sample= get_bits1(&s->gb);
2515 2562
            else s->quarter_sample=0;

Also available in: Unified diff