Revision 7604246d

View differences:

libavcodec/dv.c
76 76
{
77 77
    DVVideoDecodeContext *s = avctx->priv_data;
78 78
    MpegEncContext s2;
79
    static int done;
79
    static int done=0;
80 80

  
81 81
    if (!done) {
82 82
        int i;
libavcodec/h263.c
73 73
static inline int mpeg4_decode_block(MpegEncContext * s, DCTELEM * block,
74 74
                              int n, int coded, int intra);
75 75
static int h263_pred_dc(MpegEncContext * s, int n, uint16_t **dc_val_ptr);
76
#ifdef CONFIG_ENCODERS
76 77
static void mpeg4_inv_pred_ac(MpegEncContext * s, DCTELEM *block, int n,
77 78
                              int dir);
79
#endif //CONFIG_ENCODERS
78 80
static void mpeg4_decode_sprite_trajectory(MpegEncContext * s);
79 81
static inline int ff_mpeg4_pred_dc(MpegEncContext * s, int n, uint16_t **dc_val_ptr, int *dir_ptr);
80 82

  
81 83
extern uint32_t inverse[256];
82 84

  
85
#ifdef CONFIG_ENCODERS
83 86
static uint8_t uni_DCtab_lum_len[512];
84 87
static uint8_t uni_DCtab_chrom_len[512];
85 88
static uint16_t uni_DCtab_lum_bits[512];
86 89
static uint16_t uni_DCtab_chrom_bits[512];
87 90

  
88
#ifdef CONFIG_ENCODERS
89 91
static uint16_t (*mv_penalty)[MAX_MV*2+1]= NULL;
90 92
static uint8_t fcode_tab[MAX_MV*2+1];
91 93
static uint8_t umv_fcode_tab[MAX_MV*2+1];
......
129 131
    return format;
130 132
}
131 133

  
134
#ifdef CONFIG_ENCODERS
135

  
132 136
static void float_aspect_to_info(MpegEncContext * s, float aspect){
133 137
    int i;
134 138

  
......
397 401
    }
398 402
}
399 403

  
404
#endif //CONFIG_ENCODERS
405

  
400 406
void ff_mpeg4_set_direct_mv(MpegEncContext *s, int mx, int my){
401 407
    const int mb_index= s->mb_x + s->mb_y*s->mb_width;
402 408
    int xy= s->block_index[0];
......
1010 1016
    return pred_dc;
1011 1017
}
1012 1018

  
1013

  
1014 1019
static void h263_pred_acdc(MpegEncContext * s, DCTELEM *block, int n)
1015 1020
{
1016 1021
    int x, y, wrap, a, c, pred_dc, scale, i;
......
1290 1295
}
1291 1296
#endif
1292 1297

  
1298
#ifdef CONFIG_ENCODERS
1299

  
1293 1300
static void init_uni_dc_tab(void)
1294 1301
{
1295 1302
    int level, uni_code, uni_len;
......
1342 1349
    }
1343 1350
}
1344 1351

  
1352
#endif //CONFIG_ENCODERS
1353

  
1345 1354
#ifdef CONFIG_ENCODERS
1346 1355
static void init_uni_mpeg4_rl_tab(RLTable *rl, uint32_t *bits_tab, uint8_t *len_tab){
1347 1356
    int slevel, run, last;
......
1549 1558
}
1550 1559
#endif
1551 1560

  
1561
#ifdef CONFIG_ENCODERS
1562

  
1552 1563
/***************************************************/
1553 1564
/**
1554 1565
 * add mpeg4 stuffing bits (01...1)
......
1798 1809
     s->v_edge_pos= s->height;
1799 1810
}
1800 1811

  
1812
#endif //CONFIG_ENCODERS
1813

  
1801 1814
/**
1802 1815
 * change qscale by given dquant and update qscale dependant variables.
1803 1816
 */
......
1938 1951

  
1939 1952
}
1940 1953

  
1954
#ifdef CONFIG_ENCODERS
1955

  
1941 1956
static void mpeg4_inv_pred_ac(MpegEncContext * s, DCTELEM *block, int n,
1942 1957
                              int dir)
1943 1958
{
......
2025 2040
    }
2026 2041
#endif
2027 2042
}
2028
#ifdef CONFIG_ENCODERS
2043

  
2029 2044
/**
2030 2045
 * encodes a 8x8 block
2031 2046
 * @param n block index (0-3 are luma, 4-5 are chroma)
......
2363 2378
        tab[i] = val;
2364 2379
}
2365 2380

  
2381
#ifdef CONFIG_ENCODERS
2382

  
2366 2383
void ff_mpeg4_init_partitions(MpegEncContext *s)
2367 2384
{
2368 2385
    init_put_bits(&s->tex_pb, s->tex_pb_buffer, PB_BUFFER_SIZE, NULL, NULL);
......
2394 2411
    s->last_bits= get_bit_count(&s->pb);
2395 2412
}
2396 2413

  
2414
#endif //CONFIG_ENCODERS
2415

  
2397 2416
int ff_mpeg4_get_video_packet_prefix_length(MpegEncContext *s){
2398 2417
    switch(s->pict_type){
2399 2418
        case I_TYPE:
......
2408 2427
    }
2409 2428
}
2410 2429

  
2430
#ifdef CONFIG_ENCODERS
2431

  
2411 2432
void ff_mpeg4_encode_video_packet_header(MpegEncContext *s)
2412 2433
{
2413 2434
    int mb_num_bits= av_log2(s->mb_num - 1) + 1;
......
2421 2442
    put_bits(&s->pb, 1, 0); /* no HEC */
2422 2443
}
2423 2444

  
2445
#endif //CONFIG_ENCODERS
2446

  
2424 2447
/**
2425 2448
 * check if the next stuff is a resync marker or the end.
2426 2449
 * @return 0 if not
libavcodec/mpeg12.c
325 325
    s->c_dc_scale_table= ff_mpeg1_dc_scale_table;
326 326
}
327 327

  
328
#ifdef CONFIG_ENCODERS
328 329
void mpeg1_encode_picture_header(MpegEncContext *s, int picture_number)
329 330
{
330 331
    mpeg1_encode_sequence_header(s);
......
511 512
                else
512 513
                    {    // No coded bloc pattern
513 514
                    if (s->mv_dir == (MV_DIR_FORWARD | MV_DIR_BACKWARD))
514
                        {    // Bi-directional motion
515
                        {    // Bi-directional motion 
515 516
                        put_bits(&s->pb, 2, 2); /* backward & forward motion */
516 517
                        mpeg1_encode_motion(s, s->mv[0][0][0] - s->last_mv[0][0][0], s->f_code);
517 518
                        mpeg1_encode_motion(s, s->mv[0][0][1] - s->last_mv[0][0][1], s->f_code);
......
792 793
    /* end of block */
793 794
    put_bits(&s->pb, 2, 0x2);
794 795
}
796
#endif //CONFIG_ENCODERS
795 797

  
796 798
/******************************************/
797 799
/* decoding */
libavcodec/mpegvideo.c
33 33
//#undef NDEBUG
34 34
//#include <assert.h>
35 35

  
36
#ifdef CONFIG_ENCODERS
36 37
static void encode_picture(MpegEncContext *s, int picture_number);
38
#endif //CONFIG_ENCODERS
37 39
static void dct_unquantize_mpeg1_c(MpegEncContext *s, 
38 40
                                   DCTELEM *block, int n, int qscale);
39 41
static void dct_unquantize_mpeg2_c(MpegEncContext *s,
......
41 43
static void dct_unquantize_h263_c(MpegEncContext *s, 
42 44
                                  DCTELEM *block, int n, int qscale);
43 45
static void draw_edges_c(uint8_t *buf, int wrap, int width, int height, int w);
46
#ifdef CONFIG_ENCODERS
44 47
static int dct_quantize_c(MpegEncContext *s, DCTELEM *block, int n, int qscale, int *overflow);
45 48
static int dct_quantize_trellis_c(MpegEncContext *s, DCTELEM *block, int n, int qscale, int *overflow);
49
#endif //CONFIG_ENCODERS
46 50

  
47 51
void (*draw_edges)(uint8_t *buf, int wrap, int width, int height, int w)= draw_edges_c;
48 52

  
......
85 89
    0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2,
86 90
};
87 91

  
92
#ifdef CONFIG_ENCODERS
88 93
static uint16_t (*default_mv_penalty)[MAX_MV*2+1]=NULL;
89 94
static uint8_t default_fcode_tab[MAX_MV*2+1];
90 95

  
......
137 142
        }
138 143
    }
139 144
}
145
#endif //CONFIG_ENCODERS
146

  
140 147
// move into common.c perhaps 
141 148
#define CHECKED_ALLOCZ(p, size)\
142 149
{\
......
198 205
    s->dct_unquantize_h263 = dct_unquantize_h263_c;
199 206
    s->dct_unquantize_mpeg1 = dct_unquantize_mpeg1_c;
200 207
    s->dct_unquantize_mpeg2 = dct_unquantize_mpeg2_c;
208
#ifdef CONFIG_ENCODERS
201 209
    s->dct_quantize= dct_quantize_c;
202 210

  
203 211
    if(s->avctx->dct_algo==FF_DCT_FASTINT)
204 212
        s->fdct = fdct_ifast;
205 213
    else
206 214
        s->fdct = ff_jpeg_fdct_islow; //slow/accurate/default
215
#endif //CONFIG_ENCODERS
207 216

  
208 217
    if(s->avctx->idct_algo==FF_IDCT_INT){
209 218
        s->idct_put= ff_jref_idct_put;
......
234 243
    MPV_common_init_ppc(s);
235 244
#endif
236 245

  
246
#ifdef CONFIG_ENCODERS
237 247
    s->fast_dct_quantize= s->dct_quantize;
238 248

  
239 249
    if(s->flags&CODEC_FLAG_TRELLIS_QUANT){
240 250
        s->dct_quantize= dct_quantize_trellis_c; //move before MPV_common_init_*
241 251
    }
242 252

  
253
#endif //CONFIG_ENCODERS
254

  
243 255
    switch(s->idct_permutation_type){
244 256
    case FF_NO_IDCT_PERM:
245 257
        for(i=0; i<64; i++)
......
544 556
    s->context_initialized = 0;
545 557
}
546 558

  
559
#ifdef CONFIG_ENCODERS
560

  
547 561
/* init video encoder */
548 562
int MPV_encode_init(AVCodecContext *avctx)
549 563
{
......
810 824
    return 0;
811 825
}
812 826

  
827
#endif //CONFIG_ENCODERS
828

  
813 829
void init_rl(RLTable *rl)
814 830
{
815 831
    int8_t max_level[MAX_RUN+1], max_run[MAX_LEVEL+1];
......
1019 1035
    }
1020 1036
}
1021 1037

  
1038
#ifdef CONFIG_ENCODERS
1039

  
1022 1040
static int get_sae(uint8_t *src, int ref, int stride){
1023 1041
    int x,y;
1024 1042
    int acc=0;
......
1323 1341
    return pbBufPtr(&s->pb) - s->pb.buf;
1324 1342
}
1325 1343

  
1344
#endif //CONFIG_ENCODERS
1345

  
1326 1346
static inline void gmc1_motion(MpegEncContext *s,
1327 1347
                               uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr,
1328 1348
                               int dest_offset,
......
2188 2208
    }
2189 2209
}
2190 2210

  
2211
#ifdef CONFIG_ENCODERS
2212

  
2191 2213
static inline void dct_single_coeff_elimination(MpegEncContext *s, int n, int threshold)
2192 2214
{
2193 2215
    static const char tab[64]=
......
2391 2413

  
2392 2414
#endif
2393 2415

  
2416
#endif //CONFIG_ENCODERS
2417

  
2394 2418
void ff_draw_horiz_band(MpegEncContext *s){
2395 2419
    if (    s->avctx->draw_horiz_band 
2396 2420
        && (s->last_picture.data[0] || s->low_delay) ) {
......
2422 2446
    }
2423 2447
}
2424 2448

  
2449
#ifdef CONFIG_ENCODERS
2450

  
2425 2451
static void encode_mb(MpegEncContext *s, int motion_x, int motion_y)
2426 2452
{
2427 2453
    const int mb_x= s->mb_x;
......
2658 2684
        s->block[5][0]= (1024 + s->c_dc_scale/2)/ s->c_dc_scale;
2659 2685
    }
2660 2686

  
2661
#ifdef CONFIG_ENCODERS
2662 2687
    /* huffman encode */
2663 2688
    switch(s->codec_id){ //FIXME funct ptr could be slightly faster
2664 2689
    case CODEC_ID_MPEG1VIDEO:
......
2682 2707
    default:
2683 2708
        assert(0);
2684 2709
    }
2685
#endif
2686 2710
}
2687 2711

  
2712
#endif //CONFIG_ENCODERS
2713

  
2688 2714
/**
2689 2715
 * combines the (truncated) bitstream to a complete frame
2690 2716
 * @returns -1 if no complete frame could be created
......
2714 2740
    return 0;
2715 2741
}
2716 2742

  
2743
#ifdef CONFIG_ENCODERS
2717 2744
void ff_copy_bits(PutBitContext *pb, uint8_t *src, int length)
2718 2745
{
2719 2746
    int bytes= length>>4;
......
3819 3846
    return last_non_zero;
3820 3847
}
3821 3848

  
3849
#endif //CONFIG_ENCODERS
3850

  
3822 3851
static void dct_unquantize_mpeg1_c(MpegEncContext *s, 
3823 3852
                                   DCTELEM *block, int n, int qscale)
3824 3853
{
......
3988 4017
    }
3989 4018
}
3990 4019

  
4020

  
3991 4021
char ff_get_pict_type_char(int pict_type){
3992 4022
    switch(pict_type){
3993 4023
    case I_TYPE: return 'I'; 
......
4022 4052
    AVOPTION_END()
4023 4053
};
4024 4054

  
4055
#ifdef CONFIG_ENCODERS
4056

  
4025 4057
AVCodec mpeg1video_encoder = {
4026 4058
    "mpeg1video",
4027 4059
    CODEC_TYPE_VIDEO,
......
4126 4158
    MPV_encode_picture,
4127 4159
    MPV_encode_end,
4128 4160
};
4161

  
4162
#endif //CONFIG_ENCODERS
4163

  
libavcodec/msmpeg4.c
53 53
static uint32_t v2_dc_lum_table[512][2];
54 54
static uint32_t v2_dc_chroma_table[512][2];
55 55

  
56
#ifdef CONFIG_ENCODERS
56 57
static inline void msmpeg4_encode_block(MpegEncContext * s, DCTELEM * block, int n);
58
#endif //CONFIG_ENCODERS
57 59
static inline int msmpeg4_decode_block(MpegEncContext * s, DCTELEM * block,
58 60
                                       int n, int coded, const uint8_t *scantable);
59 61
static int msmpeg4_decode_dc(MpegEncContext * s, int n, int *dir_ptr);
60 62
static int msmpeg4_decode_motion(MpegEncContext * s, 
61 63
                                 int *mx_ptr, int *my_ptr);
64
#ifdef CONFIG_ENCODERS
62 65
static void msmpeg4v2_encode_motion(MpegEncContext * s, int val);
66
#endif //CONFIG_ENCODERS
63 67
static void init_h263_dc_for_msmpeg4(void);
64 68
static inline void msmpeg4_memsetw(short *tab, int val, int n);
69
#ifdef CONFIG_ENCODERS
65 70
static int get_size_of_code(MpegEncContext * s, RLTable *rl, int last, int run, int level, int intra);
71
#endif //CONFIG_ENCODERS
66 72
static int msmpeg4v12_decode_mb(MpegEncContext *s, DCTELEM block[6][64]);
67 73
static int msmpeg4v34_decode_mb(MpegEncContext *s, DCTELEM block[6][64]);
68 74
static int wmv2_decode_mb(MpegEncContext *s, DCTELEM block[6][64]);
......
185 191
    }
186 192
}
187 193

  
194
#ifdef CONFIG_ENCODERS
195

  
188 196
/* build the table which associate a (x,y) motion vector to a vlc */
189 197
static void init_mv_table(MVTable *tab)
190 198
{
......
433 441
        }
434 442
}
435 443

  
444
#endif //CONFIG_ENCODERS
445

  
436 446
/* predict coded block */
437 447
static inline int coded_block_pred(MpegEncContext * s, int n, uint8_t **coded_block_ptr)
438 448
{
......
460 470
    return pred;
461 471
}
462 472

  
473
#ifdef CONFIG_ENCODERS
474

  
463 475
static void msmpeg4_encode_motion(MpegEncContext * s, 
464 476
                                  int mx, int my)
465 477
{
......
624 636
    }
625 637
}
626 638

  
639
#endif //CONFIG_ENCODERS
640

  
627 641
/* old ffmpeg msmpeg4v3 mode */
628 642
static void ff_old_msmpeg4_dc_scale(MpegEncContext * s)
629 643
{
......
817 831

  
818 832
#define DC_MAX 119
819 833

  
834
#ifdef CONFIG_ENCODERS
835

  
820 836
static void msmpeg4_encode_dc(MpegEncContext * s, int level, int n, int *dir_ptr)
821 837
{
822 838
    int sign, code;
......
1009 1025
    }
1010 1026
}
1011 1027

  
1028
#endif //CONFIG_ENCODERS
1029

  
1012 1030
/****************************************/
1013 1031
/* decoding stuff */
1014 1032

  
......
1391 1409
        tab[i] = val;
1392 1410
}
1393 1411

  
1412
#ifdef CONFIG_ENCODERS
1413

  
1394 1414
static void msmpeg4v2_encode_motion(MpegEncContext * s, int val)
1395 1415
{
1396 1416
    int range, bit_size, sign, code, bits;
......
1424 1444
    }
1425 1445
}
1426 1446

  
1447
#endif //CONFIG_ENCODERS
1448

  
1427 1449
/* this is identical to h263 except that its range is multiplied by 2 */
1428 1450
static int msmpeg4v2_decode_motion(MpegEncContext * s, int pred, int f_code)
1429 1451
{
libavcodec/rv10.c
220 220
    return -code;
221 221
}
222 222

  
223
#ifdef CONFIG_ENCODERS
224

  
223 225
/* write RV 1.0 compatible frame header */
224 226
void rv10_encode_picture_header(MpegEncContext *s, int picture_number)
225 227
{
......
262 264
    }
263 265
}
264 266

  
267
#endif //CONFIG_ENCODERS
268

  
265 269
/* read RV 1.0 compatible frame header */
266 270
static int rv10_decode_picture_header(MpegEncContext *s)
267 271
{
......
330 334
static int rv10_decode_init(AVCodecContext *avctx)
331 335
{
332 336
    MpegEncContext *s = avctx->priv_data;
333
    static int done;
337
    static int done=0;
334 338

  
335 339
    s->avctx= avctx;
336 340
    s->out_format = FMT_H263;
libavcodec/wmv2.c
79 79
    return 0;
80 80
}
81 81

  
82
#ifdef CONFIG_ENCODERS
82 83
static int wmv2_encode_init(AVCodecContext *avctx){
83 84
    Wmv2Context * const w= avctx->priv_data;
84 85
    
......
255 256
        msmpeg4_encode_block(s, block[i], i);
256 257
    }
257 258
}
259
#endif //CONFIG_ENCODERS
258 260

  
259 261
static void parse_mb_skip(Wmv2Context * w){
260 262
    int mb_x, mb_y;
......
828 830
    CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1,
829 831
};
830 832

  
833
#ifdef CONFIG_ENCODERS
831 834
AVCodec wmv2_encoder = {
832 835
    "wmv2",
833 836
    CODEC_TYPE_VIDEO,
......
837 840
    MPV_encode_picture,
838 841
    MPV_encode_end,
839 842
};
840

  
843
#endif

Also available in: Unified diff