Revision 3bf43d42

View differences:

libavcodec/dsputil.c
47 47

  
48 48
extern UINT16 default_intra_matrix[64];
49 49
extern UINT16 default_non_intra_matrix[64];
50
extern UINT16 ff_mpeg4_default_intra_matrix[64];
51
extern UINT16 ff_mpeg4_default_non_intra_matrix[64];
50 52

  
51 53
UINT8 zigzag_direct[64] = {
52 54
    0, 1, 8, 16, 9, 2, 3, 10,
......
953 955
        }
954 956
        block_permute(default_intra_matrix);
955 957
        block_permute(default_non_intra_matrix);
958
        block_permute(ff_mpeg4_default_intra_matrix);
959
        block_permute(ff_mpeg4_default_non_intra_matrix);
956 960
    }
957 961
    
958 962
    build_zigzag_end();
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;
libavcodec/i386/mpegvideo_mmx.c
440 440
void MPV_common_init_mmx(MpegEncContext *s)
441 441
{
442 442
    if (mm_flags & MM_MMX) {
443
        if (s->out_format == FMT_H263)
444
        	s->dct_unquantize = dct_unquantize_h263_mmx;
445
	else
446
        	s->dct_unquantize = dct_unquantize_mpeg1_mmx;
447
	
443
       	s->dct_unquantize_h263 = dct_unquantize_h263_mmx;
444
       	s->dct_unquantize_mpeg = dct_unquantize_mpeg1_mmx;
445

  
448 446
	draw_edges = draw_edges_mmx;
449 447

  
450 448
	if(mm_flags & MM_MMXEXT){
libavcodec/mpeg4data.h
122 122
 {0, 0},
123 123
 {0, 0},
124 124
};
125

  
126
/* these matrixes will be permuted for the idct */
127
INT16 ff_mpeg4_default_intra_matrix[64] = {
128
  8, 17, 18, 19, 21, 23, 25, 27,
129
 17, 18, 19, 21, 23, 25, 27, 28,
130
 20, 21, 22, 23, 24, 26, 28, 30,
131
 21, 22, 23, 24, 26, 28, 30, 32,
132
 22, 23, 24, 26, 28, 30, 32, 35,
133
 23, 24, 26, 28, 30, 32, 35, 38,
134
 25, 26, 28, 30, 32, 35, 38, 41,
135
 27, 28, 30, 32, 35, 38, 41, 45, 
136
};
137

  
138
INT16 ff_mpeg4_default_non_intra_matrix[64] = {
139
 16, 17, 18, 19, 20, 21, 22, 23,
140
 17, 18, 19, 20, 21, 22, 23, 24,
141
 18, 19, 20, 21, 22, 23, 24, 25,
142
 19, 20, 21, 22, 23, 24, 26, 27,
143
 20, 21, 22, 23, 25, 26, 27, 28,
144
 21, 22, 23, 24, 26, 27, 28, 30,
145
 22, 23, 24, 26, 27, 28, 30, 31,
146
 23, 24, 25, 27, 28, 30, 31, 33,
147
};
148

  
libavcodec/mpegvideo.c
110 110
    int c_size, i;
111 111
    UINT8 *pict;
112 112

  
113
    if (s->out_format == FMT_H263) 
114
        s->dct_unquantize = dct_unquantize_h263_c;
115
    else
116
        s->dct_unquantize = dct_unquantize_mpeg1_c;
113
    s->dct_unquantize_h263 = dct_unquantize_h263_c;
114
    s->dct_unquantize_mpeg = dct_unquantize_mpeg1_c;
117 115
        
118 116
#ifdef HAVE_MMX
119 117
    MPV_common_init_mmx(s);
120 118
#endif
119
    //setup default unquantizers (mpeg4 might change it later)
120
    if(s->out_format == FMT_H263)
121
        s->dct_unquantize = s->dct_unquantize_h263;
122
    else
123
        s->dct_unquantize = s->dct_unquantize_mpeg;
124
    
121 125
    s->mb_width = (s->width + 15) / 16;
122 126
    s->mb_height = (s->height + 15) / 16;
123 127
    s->mb_num = s->mb_width * s->mb_height;
libavcodec/mpegvideo.h
309 309
    DCTELEM intra_block[6][64] __align8;
310 310
    DCTELEM inter_block[6][64] __align8;
311 311
    DCTELEM inter4v_block[6][64] __align8;
312
    void (*dct_unquantize)(struct MpegEncContext *s, 
312
    void (*dct_unquantize_mpeg)(struct MpegEncContext *s, 
313
                           DCTELEM *block, int n, int qscale);
314
    void (*dct_unquantize_h263)(struct MpegEncContext *s, 
315
                           DCTELEM *block, int n, int qscale);
316
    void (*dct_unquantize)(struct MpegEncContext *s, // unquantizer to use (mpeg4 can use both)
313 317
                           DCTELEM *block, int n, int qscale);
314 318
} MpegEncContext;
315 319

  

Also available in: Unified diff