Revision 0151a6f5

View differences:

libavcodec/allcodecs.c
48 48
    register_avcodec(&msmpeg4v1_encoder);
49 49
    register_avcodec(&msmpeg4v2_encoder);
50 50
    register_avcodec(&msmpeg4v3_encoder);
51
    register_avcodec(&wmv1_encoder);
52
    register_avcodec(&wmv2_encoder);
51 53
#endif /* CONFIG_ENCODERS */
52 54
    register_avcodec(&rawvideo_codec);
53 55

  
......
59 61
    register_avcodec(&msmpeg4v2_decoder);
60 62
    register_avcodec(&msmpeg4v3_decoder);
61 63
    register_avcodec(&wmv1_decoder);
64
    register_avcodec(&wmv2_decoder);
62 65
    register_avcodec(&mpeg_decoder);
63 66
    register_avcodec(&h263i_decoder);
64 67
    register_avcodec(&rv10_decoder);
libavcodec/avcodec.h
329 329
extern AVCodec msmpeg4v1_encoder;
330 330
extern AVCodec msmpeg4v2_encoder;
331 331
extern AVCodec msmpeg4v3_encoder;
332
extern AVCodec wmv1_encoder;
333
extern AVCodec wmv2_encoder;
332 334

  
333 335
extern AVCodec h263_decoder;
334 336
extern AVCodec mpeg4_decoder;
......
336 338
extern AVCodec msmpeg4v2_decoder;
337 339
extern AVCodec msmpeg4v3_decoder;
338 340
extern AVCodec wmv1_decoder;
341
extern AVCodec wmv2_decoder;
339 342
extern AVCodec mpeg_decoder;
340 343
extern AVCodec h263i_decoder;
341 344
extern AVCodec rv10_decoder;
libavcodec/mpegvideo.h
41 41
#define ME_MAP_SHIFT 3
42 42
#define ME_MAP_MV_BITS 11
43 43

  
44
/* run length table */
45
#define MAX_RUN    64
46
#define MAX_LEVEL  64
47

  
44 48
typedef struct Predictor{
45 49
    double coeff;
46 50
    double count;
......
143 147
    int last_dc[3];              /* last DC values for MPEG1 */
144 148
    INT16 *dc_val[3];            /* used for mpeg4 DC prediction, all 3 arrays must be continuous */
145 149
    int y_dc_scale, c_dc_scale;
150
    UINT8 *y_dc_scale_table;     /* qscale -> y_dc_scale table */
151
    UINT8 *c_dc_scale_table;     /* qscale -> c_dc_scale table */
146 152
    UINT8 *coded_block;          /* used for coded block pattern prediction (msmpeg4v3, wmv1)*/
147 153
    INT16 (*ac_val[3])[16];      /* used for for mpeg4 AC prediction, all 3 arrays must be continuous */
148 154
    int ac_pred;
......
376 382
    int slice_height;      /* in macroblocks */
377 383
    int first_slice_line;  /* used in mpeg4 too to handle resync markers */
378 384
    int flipflop_rounding;
379
    int msmpeg4_version;   /* 0=not msmpeg4, 1=mp41, 2=mp42, 3=mp43/divx3 */
385
    int msmpeg4_version;   /* 0=not msmpeg4, 1=mp41, 2=mp42, 3=mp43/divx3 4=wmv1/7 5=wmv2/8*/
386
    int per_mb_rl_table;
387
    int esc3_level_length;
388
    int esc3_run_length;
389
    UINT8 *inter_scantable;
390
    UINT8 *intra_scantable;
391
    UINT8 *intra_v_scantable;
392
    UINT8 *intra_h_scantable;
393
    /* [mb_intra][isChroma][level][run][last] */
394
    int ac_stats[2][2][MAX_LEVEL+1][MAX_RUN+1][2];
395
    
396

  
380 397
    /* decompression specific */
381 398
    GetBitContext gb;
382 399

  
......
452 469
/* mpeg12.c */
453 470
extern INT16 default_intra_matrix[64];
454 471
extern INT16 default_non_intra_matrix[64];
472
extern UINT8 ff_mpeg1_dc_scale_table[128];
455 473

  
456 474
void mpeg1_encode_picture_header(MpegEncContext *s, int picture_number);
457 475
void mpeg1_encode_mb(MpegEncContext *s,
458 476
                     DCTELEM block[6][64],
459 477
                     int motion_x, int motion_y);
460
void mpeg1_encode_init(MpegEncContext *s);
478
void ff_mpeg1_encode_init(MpegEncContext *s);
461 479

  
462 480
/* h263enc.c */
463 481

  
464
/* run length table */
465
#define MAX_RUN    64
466
#define MAX_LEVEL  64
467

  
468 482
typedef struct RLTable {
469 483
    int n; /* number of entries of table_vlc minus 1 */
470 484
    int last; /* number of values for last = 0 */
......
491 505
    return index + level - 1;
492 506
}
493 507

  
508
extern UINT8 ff_mpeg4_y_dc_scale_table[32];
509
extern UINT8 ff_mpeg4_c_dc_scale_table[32];
494 510
void h263_encode_mb(MpegEncContext *s, 
495 511
                    DCTELEM block[6][64],
496 512
                    int motion_x, int motion_y);
......
499 515
                    int motion_x, int motion_y);
500 516
void h263_encode_picture_header(MpegEncContext *s, int picture_number);
501 517
int h263_encode_gob_header(MpegEncContext * s, int mb_line);
502
void h263_dc_scale(MpegEncContext *s);
503 518
INT16 *h263_pred_motion(MpegEncContext * s, int block, 
504 519
                        int *px, int *py);
505 520
void mpeg4_pred_ac(MpegEncContext * s, INT16 *block, int n, 
......
523 538
void ff_mpeg4_stuffing(PutBitContext * pbc);
524 539
void ff_mpeg4_init_partitions(MpegEncContext *s);
525 540
void ff_mpeg4_merge_partitions(MpegEncContext *s);
541
extern inline int ff_mpeg4_pred_dc(MpegEncContext * s, int n, UINT16 **dc_val_ptr, int *dir_ptr);
526 542

  
527 543
/* rv10.c */
528 544
void rv10_encode_picture_header(MpegEncContext *s, int picture_number);
......
538 554
int msmpeg4_decode_ext_header(MpegEncContext * s, int buf_size);
539 555
int msmpeg4_decode_mb(MpegEncContext *s, 
540 556
                      DCTELEM block[6][64]);
541
int msmpeg4_decode_init_vlc(MpegEncContext *s);
542
void ff_old_msmpeg4_dc_scale(MpegEncContext *s);
557
int ff_msmpeg4_decode_init(MpegEncContext *s);
558
void ff_msmpeg4_encode_init(MpegEncContext *s);
543 559

  
544 560
/* mjpegenc.c */
545 561

  
libavcodec/msmpeg4data.h
578 578
extern const UINT8 intra_MCBPC_code[8];
579 579
extern const UINT8 intra_MCBPC_bits[8];
580 580

  
581
extern const UINT8 inter_MCBPC_code[8];
582
extern const UINT8 inter_MCBPC_bits[8];
581
extern const UINT8 inter_MCBPC_code[25];
582
extern const UINT8 inter_MCBPC_bits[25];
583 583

  
584 584
#define NB_RL_TABLES  6
585 585

  
......
1761 1761
 34, 28, 21,
1762 1762
};
1763 1763

  
1764
/* motion vector table */
1765
typedef struct MVTable {
1766
    int n;
1767
    const UINT16 *table_mv_code;
1768
    const UINT8 *table_mv_bits;
1769
    const UINT8 *table_mvx;
1770
    const UINT8 *table_mvy;
1771
    UINT16 *table_mv_index; /* encoding: convert mv to index in table_mv */
1772
    VLC vlc;                /* decoding: vlc */
1773
} MVTable;
1774

  
1764 1775
static MVTable mv_tables[2] = {
1765 1776
    {
1766 1777
        1099,
......
1786 1797
static const UINT8 v2_intra_cbpc[4][2] = {
1787 1798
 {1, 1}, {0, 3}, {1, 3}, {1, 2},
1788 1799
};
1800

  
1801
static UINT8 wmv1_y_dc_scale_table[32]={
1802
//  0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31
1803
    0, 8, 8, 8, 8, 8, 9, 9,10,10,11,11,12,12,13,13,14,14,15,15,16,16,17,17,18,18,19,19,20,20,21,21
1804
};
1805
static UINT8 wmv1_c_dc_scale_table[32]={
1806
//  0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31
1807
    0, 8, 8, 8, 8, 9, 9,10,10,11,11,12,12,13,13,14,14,15,15,16,16,17,17,18,18,19,19,20,20,21,21,22
1808
};
1809

  
1810
static UINT8 old_ff_y_dc_scale_table[32]={
1811
//  0  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
1812
    0, 8, 8, 8, 8,10,12,14,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39
1813
};
1814
static UINT8 old_ff_c_dc_scale_table[32]={
1815
//  0  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
1816
    0, 8, 8, 8, 8, 9, 9,10,10,11,11,12,12,13,13,14,14,15,15,16,16,17,17,18,18,19,19,20,20,21,21,22
1817
};
1818

  
1819

  
1820
#define WMV1_SCANTABLE_COUNT 4
1821

  
1822
static UINT8 wmv1_scantable00[64]= {
1823
0x00, 0x08, 0x01, 0x02, 0x09, 0x10, 0x18, 0x11, 
1824
0x0A, 0x03, 0x04, 0x0B, 0x12, 0x19, 0x20, 0x28, 
1825
0x30, 0x38, 0x29, 0x21, 0x1A, 0x13, 0x0C, 0x05, 
1826
0x06, 0x0D, 0x14, 0x1B, 0x22, 0x31, 0x39, 0x3A, 
1827
0x32, 0x2A, 0x23, 0x1C, 0x15, 0x0E, 0x07, 0x0F, 
1828
0x16, 0x1D, 0x24, 0x2B, 0x33, 0x3B, 0x3C, 0x34, 
1829
0x2C, 0x25, 0x1E, 0x17, 0x1F, 0x26, 0x2D, 0x35, 
1830
0x3D, 0x3E, 0x36, 0x2E, 0x27, 0x2F, 0x37, 0x3F, 
1831
};
1832
static UINT8 wmv1_scantable01[64]= {
1833
0x00, 0x08, 0x01, 0x02, 0x09, 0x10, 0x18, 0x11, 
1834
0x0A, 0x03, 0x04, 0x0B, 0x12, 0x19, 0x20, 0x28, 
1835
0x21, 0x30, 0x1A, 0x13, 0x0C, 0x05, 0x06, 0x0D, 
1836
0x14, 0x1B, 0x22, 0x29, 0x38, 0x31, 0x39, 0x2A, 
1837
0x23, 0x1C, 0x15, 0x0E, 0x07, 0x0F, 0x16, 0x1D, 
1838
0x24, 0x2B, 0x32, 0x3A, 0x33, 0x3B, 0x2C, 0x25, 
1839
0x1E, 0x17, 0x1F, 0x26, 0x2D, 0x34, 0x3C, 0x35, 
1840
0x3D, 0x2E, 0x27, 0x2F, 0x36, 0x3E, 0x37, 0x3F, 
1841
};
1842
static UINT8 wmv1_scantable02[64]= {
1843
0x00, 0x01, 0x08, 0x02, 0x03, 0x09, 0x10, 0x18, 
1844
0x11, 0x0A, 0x04, 0x05, 0x0B, 0x12, 0x19, 0x20, 
1845
0x28, 0x30, 0x21, 0x1A, 0x13, 0x0C, 0x06, 0x07, 
1846
0x0D, 0x14, 0x1B, 0x22, 0x29, 0x38, 0x31, 0x39, 
1847
0x2A, 0x23, 0x1C, 0x15, 0x0E, 0x0F, 0x16, 0x1D, 
1848
0x24, 0x2B, 0x32, 0x3A, 0x33, 0x2C, 0x25, 0x1E, 
1849
0x17, 0x1F, 0x26, 0x2D, 0x34, 0x3B, 0x3C, 0x35, 
1850
0x2E, 0x27, 0x2F, 0x36, 0x3D, 0x3E, 0x37, 0x3F, 
1851
};
1852
static UINT8 wmv1_scantable03[64]= {
1853
0x00, 0x08, 0x10, 0x01, 0x18, 0x20, 0x28, 0x09, 
1854
0x02, 0x03, 0x0A, 0x11, 0x19, 0x30, 0x38, 0x29, 
1855
0x21, 0x1A, 0x12, 0x0B, 0x04, 0x05, 0x0C, 0x13, 
1856
0x1B, 0x22, 0x31, 0x39, 0x32, 0x2A, 0x23, 0x1C, 
1857
0x14, 0x0D, 0x06, 0x07, 0x0E, 0x15, 0x1D, 0x24, 
1858
0x2B, 0x33, 0x3A, 0x3B, 0x34, 0x2C, 0x25, 0x1E, 
1859
0x16, 0x0F, 0x17, 0x1F, 0x26, 0x2D, 0x3C, 0x35, 
1860
0x2E, 0x27, 0x2F, 0x36, 0x3D, 0x3E, 0x37, 0x3F, 
1861
};
1862

  
1863
static UINT8 *wmv1_scantable[WMV1_SCANTABLE_COUNT+1]={
1864
    wmv1_scantable00,
1865
    wmv1_scantable01,
1866
    wmv1_scantable02,
1867
    wmv1_scantable03,
1868
};
1869

  

Also available in: Unified diff