Mercurial > libavcodec.hg
comparison mpeg12.c @ 1325:1cbc2380d172 libavcodec
CONFIG_ENCODERS cleanup
author | michaelni |
---|---|
date | Sun, 22 Jun 2003 11:08:22 +0000 |
parents | e9da5a651eab |
children | 6cdd3b8f4fd3 |
comparison
equal
deleted
inserted
replaced
1324:7d328fd9d8a5 | 1325:1cbc2380d172 |
---|---|
71 static uint8_t (*mv_penalty)[MAX_MV*2+1]= NULL; | 71 static uint8_t (*mv_penalty)[MAX_MV*2+1]= NULL; |
72 static uint8_t fcode_tab[MAX_MV*2+1]; | 72 static uint8_t fcode_tab[MAX_MV*2+1]; |
73 | 73 |
74 static uint32_t uni_mpeg1_ac_vlc_bits[64*64*2]; | 74 static uint32_t uni_mpeg1_ac_vlc_bits[64*64*2]; |
75 static uint8_t uni_mpeg1_ac_vlc_len [64*64*2]; | 75 static uint8_t uni_mpeg1_ac_vlc_len [64*64*2]; |
76 | |
77 /* simple include everything table for dc, first byte is bits number next 3 are code*/ | |
78 static uint32_t mpeg1_lum_dc_uni[512]; | |
79 static uint32_t mpeg1_chr_dc_uni[512]; | |
80 | |
81 static uint8_t mpeg1_index_run[2][64]; | |
82 static int8_t mpeg1_max_level[2][64]; | |
76 #endif | 83 #endif |
77 | 84 |
78 static void init_2d_vlc_rl(RLTable *rl) | 85 static void init_2d_vlc_rl(RLTable *rl) |
79 { | 86 { |
80 int i; | 87 int i; |
112 rl->rl_vlc[0][i].level= level; | 119 rl->rl_vlc[0][i].level= level; |
113 rl->rl_vlc[0][i].run= run; | 120 rl->rl_vlc[0][i].run= run; |
114 } | 121 } |
115 } | 122 } |
116 | 123 |
124 #ifdef CONFIG_ENCODERS | |
117 static void init_uni_ac_vlc(RLTable *rl, uint32_t *uni_ac_vlc_bits, uint8_t *uni_ac_vlc_len){ | 125 static void init_uni_ac_vlc(RLTable *rl, uint32_t *uni_ac_vlc_bits, uint8_t *uni_ac_vlc_len){ |
118 int i; | 126 int i; |
119 | 127 |
120 for(i=0; i<128; i++){ | 128 for(i=0; i<128; i++){ |
121 int level= i-64; | 129 int level= i-64; |
307 | 315 |
308 /* zero motion x & y */ | 316 /* zero motion x & y */ |
309 put_bits(&s->pb, 1, 1); | 317 put_bits(&s->pb, 1, 1); |
310 put_bits(&s->pb, 1, 1); | 318 put_bits(&s->pb, 1, 1); |
311 } | 319 } |
320 #endif | |
312 | 321 |
313 static void common_init(MpegEncContext *s) | 322 static void common_init(MpegEncContext *s) |
314 { | 323 { |
315 s->y_dc_scale_table= | 324 s->y_dc_scale_table= |
316 s->c_dc_scale_table= ff_mpeg1_dc_scale_table; | 325 s->c_dc_scale_table= ff_mpeg1_dc_scale_table; |
317 } | |
318 | |
319 #ifdef CONFIG_ENCODERS | |
320 | |
321 void ff_mpeg1_encode_slice_header(MpegEncContext *s){ | |
322 put_header(s, SLICE_MIN_START_CODE + s->mb_y); | |
323 put_bits(&s->pb, 5, s->qscale); /* quantizer scale */ | |
324 put_bits(&s->pb, 1, 0); /* slice extra information */ | |
325 } | 326 } |
326 | 327 |
327 void ff_mpeg1_clean_buffers(MpegEncContext *s){ | 328 void ff_mpeg1_clean_buffers(MpegEncContext *s){ |
328 s->last_dc[0] = 1 << (7 + s->intra_dc_precision); | 329 s->last_dc[0] = 1 << (7 + s->intra_dc_precision); |
329 s->last_dc[1] = s->last_dc[0]; | 330 s->last_dc[1] = s->last_dc[0]; |
330 s->last_dc[2] = s->last_dc[0]; | 331 s->last_dc[2] = s->last_dc[0]; |
331 memset(s->last_mv, 0, sizeof(s->last_mv)); | 332 memset(s->last_mv, 0, sizeof(s->last_mv)); |
333 } | |
334 | |
335 #ifdef CONFIG_ENCODERS | |
336 | |
337 void ff_mpeg1_encode_slice_header(MpegEncContext *s){ | |
338 put_header(s, SLICE_MIN_START_CODE + s->mb_y); | |
339 put_bits(&s->pb, 5, s->qscale); /* quantizer scale */ | |
340 put_bits(&s->pb, 1, 0); /* slice extra information */ | |
332 } | 341 } |
333 | 342 |
334 void mpeg1_encode_picture_header(MpegEncContext *s, int picture_number) | 343 void mpeg1_encode_picture_header(MpegEncContext *s, int picture_number) |
335 { | 344 { |
336 mpeg1_encode_sequence_header(s); | 345 mpeg1_encode_sequence_header(s); |