Revision 7604246d libavcodec/mpegvideo.c

View differences:

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

  

Also available in: Unified diff