Mercurial > libavcodec.hg
annotate h263dec.c @ 608:98e39397636b libavcodec
better scene change detection
author | michaelni |
---|---|
date | Thu, 22 Aug 2002 19:41:06 +0000 |
parents | 507e688d57b2 |
children | 0018e190cc4c |
rev | line source |
---|---|
0 | 1 /* |
2 * H263 decoder | |
429 | 3 * Copyright (c) 2001 Fabrice Bellard. |
0 | 4 * |
429 | 5 * This library is free software; you can redistribute it and/or |
6 * modify it under the terms of the GNU Lesser General Public | |
7 * License as published by the Free Software Foundation; either | |
8 * version 2 of the License, or (at your option) any later version. | |
0 | 9 * |
429 | 10 * This library is distributed in the hope that it will be useful, |
0 | 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
429 | 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 * Lesser General Public License for more details. | |
0 | 14 * |
429 | 15 * You should have received a copy of the GNU Lesser General Public |
16 * License along with this library; if not, write to the Free Software | |
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
0 | 18 */ |
396
fce0a2520551
removed useless header includes - use av memory functions
glantau
parents:
384
diff
changeset
|
19 #include "avcodec.h" |
0 | 20 #include "dsputil.h" |
21 #include "mpegvideo.h" | |
22 | |
23 //#define DEBUG | |
384 | 24 //#define PRINT_FRAME_TIME |
25 #ifdef PRINT_FRAME_TIME | |
26 static inline long long rdtsc() | |
27 { | |
28 long long l; | |
29 asm volatile( "rdtsc\n\t" | |
30 : "=A" (l) | |
31 ); | |
32 // printf("%d\n", int(l/1000)); | |
33 return l; | |
34 } | |
35 #endif | |
0 | 36 |
37 static int h263_decode_init(AVCodecContext *avctx) | |
38 { | |
39 MpegEncContext *s = avctx->priv_data; | |
60 | 40 |
67 | 41 s->avctx = avctx; |
0 | 42 s->out_format = FMT_H263; |
43 | |
44 s->width = avctx->width; | |
45 s->height = avctx->height; | |
411
5c8b3a717929
workaround dc_scale bug in old ffmpeg msmpeg4v3 encoder (set workaround_bugs=1 for this)
michaelni
parents:
396
diff
changeset
|
46 s->workaround_bugs= avctx->workaround_bugs; |
0 | 47 |
48 /* select sub codec */ | |
49 switch(avctx->codec->id) { | |
50 case CODEC_ID_H263: | |
154
f914f710b8d0
- Fixed a bug on H.263 MV prediction for MB on GOBs limits.
pulento
parents:
144
diff
changeset
|
51 s->gob_number = 0; |
454 | 52 s->first_slice_line = 0; |
0 | 53 break; |
67 | 54 case CODEC_ID_MPEG4: |
0 | 55 s->time_increment_bits = 4; /* default value for broken headers */ |
56 s->h263_pred = 1; | |
336 | 57 s->has_b_frames = 1; //default, might be overriden in the vol header during header parsing |
0 | 58 break; |
307 | 59 case CODEC_ID_MSMPEG4V1: |
0 | 60 s->h263_msmpeg4 = 1; |
61 s->h263_pred = 1; | |
307 | 62 s->msmpeg4_version=1; |
63 break; | |
64 case CODEC_ID_MSMPEG4V2: | |
65 s->h263_msmpeg4 = 1; | |
66 s->h263_pred = 1; | |
67 s->msmpeg4_version=2; | |
68 break; | |
69 case CODEC_ID_MSMPEG4V3: | |
70 s->h263_msmpeg4 = 1; | |
71 s->h263_pred = 1; | |
72 s->msmpeg4_version=3; | |
0 | 73 break; |
311 | 74 case CODEC_ID_WMV1: |
75 s->h263_msmpeg4 = 1; | |
76 s->h263_pred = 1; | |
77 s->msmpeg4_version=4; | |
78 break; | |
498 | 79 case CODEC_ID_WMV2: |
80 s->h263_msmpeg4 = 1; | |
81 s->h263_pred = 1; | |
82 s->msmpeg4_version=5; | |
83 break; | |
0 | 84 case CODEC_ID_H263I: |
85 s->h263_intel = 1; | |
86 break; | |
87 default: | |
88 return -1; | |
89 } | |
344 | 90 s->codec_id= avctx->codec->id; |
553 | 91 |
0 | 92 /* for h263, we allocate the images after having read the header */ |
274
d0c186bcf075
use the width & height from the mpeg4 header ... in the case that its complete
michaelni
parents:
273
diff
changeset
|
93 if (avctx->codec->id != CODEC_ID_H263 && avctx->codec->id != CODEC_ID_MPEG4) |
144 | 94 if (MPV_common_init(s) < 0) |
95 return -1; | |
0 | 96 |
97 if (s->h263_msmpeg4) | |
498 | 98 ff_msmpeg4_decode_init(s); |
0 | 99 else |
100 h263_decode_init_vlc(s); | |
101 | |
102 return 0; | |
103 } | |
104 | |
105 static int h263_decode_end(AVCodecContext *avctx) | |
106 { | |
107 MpegEncContext *s = avctx->priv_data; | |
108 | |
109 MPV_common_end(s); | |
110 return 0; | |
111 } | |
112 | |
113 static int h263_decode_frame(AVCodecContext *avctx, | |
114 void *data, int *data_size, | |
115 UINT8 *buf, int buf_size) | |
116 { | |
117 MpegEncContext *s = avctx->priv_data; | |
118 int ret; | |
119 AVPicture *pict = data; | |
384 | 120 #ifdef PRINT_FRAME_TIME |
121 uint64_t time= rdtsc(); | |
122 #endif | |
0 | 123 #ifdef DEBUG |
124 printf("*****frame %d size=%d\n", avctx->frame_number, buf_size); | |
125 printf("bytes=%x %x %x %x\n", buf[0], buf[1], buf[2], buf[3]); | |
126 #endif | |
345 | 127 |
128 s->hurry_up= avctx->hurry_up; | |
454 | 129 s->error_resilience= avctx->error_resilience; |
130 s->workaround_bugs= avctx->workaround_bugs; | |
485 | 131 s->flags= avctx->flags; |
454 | 132 |
0 | 133 /* no supplementary picture */ |
134 if (buf_size == 0) { | |
135 *data_size = 0; | |
136 return 0; | |
137 } | |
138 | |
465 | 139 if(s->bitstream_buffer_size && buf_size<20){ //divx 5.01+ frame reorder |
333 | 140 init_get_bits(&s->gb, s->bitstream_buffer, s->bitstream_buffer_size); |
353 | 141 }else |
333 | 142 init_get_bits(&s->gb, buf, buf_size); |
465 | 143 s->bitstream_buffer_size=0; |
0 | 144 |
145 /* let's go :-) */ | |
146 if (s->h263_msmpeg4) { | |
147 ret = msmpeg4_decode_picture_header(s); | |
148 } else if (s->h263_pred) { | |
149 ret = mpeg4_decode_picture_header(s); | |
336 | 150 s->has_b_frames= !s->low_delay; |
0 | 151 } else if (s->h263_intel) { |
152 ret = intel_h263_decode_picture_header(s); | |
153 } else { | |
154 ret = h263_decode_picture_header(s); | |
274
d0c186bcf075
use the width & height from the mpeg4 header ... in the case that its complete
michaelni
parents:
273
diff
changeset
|
155 } |
556 | 156 avctx->has_b_frames= s->has_b_frames; |
585
86ebb02c6693
dump bits per frame / qp / frame complexity support
michaelni
parents:
562
diff
changeset
|
157 #if 0 // dump bits per frame / qp / complexity |
86ebb02c6693
dump bits per frame / qp / frame complexity support
michaelni
parents:
562
diff
changeset
|
158 { |
86ebb02c6693
dump bits per frame / qp / frame complexity support
michaelni
parents:
562
diff
changeset
|
159 static FILE *f=NULL; |
86ebb02c6693
dump bits per frame / qp / frame complexity support
michaelni
parents:
562
diff
changeset
|
160 if(!f) f=fopen("rate_qp_cplx.txt", "w"); |
589
507e688d57b2
10l found by R«±mi Guyomarch <rguyom at pobox dot com>
michaelni
parents:
585
diff
changeset
|
161 fprintf(f, "%d %d %f\n", buf_size, s->qscale, buf_size*(double)s->qscale); |
585
86ebb02c6693
dump bits per frame / qp / frame complexity support
michaelni
parents:
562
diff
changeset
|
162 } |
86ebb02c6693
dump bits per frame / qp / frame complexity support
michaelni
parents:
562
diff
changeset
|
163 #endif |
553 | 164 |
274
d0c186bcf075
use the width & height from the mpeg4 header ... in the case that its complete
michaelni
parents:
273
diff
changeset
|
165 /* After H263 & mpeg4 header decode we have the height, width,*/ |
160 | 166 /* and other parameters. So then we could init the picture */ |
167 /* FIXME: By the way H263 decoder is evolving it should have */ | |
168 /* an H263EncContext */ | |
553 | 169 if (s->width != avctx->width || s->height != avctx->height) { |
170 /* H.263 could change picture size any time */ | |
171 MPV_common_end(s); | |
172 s->context_initialized=0; | |
173 } | |
274
d0c186bcf075
use the width & height from the mpeg4 header ... in the case that its complete
michaelni
parents:
273
diff
changeset
|
174 if (!s->context_initialized) { |
d0c186bcf075
use the width & height from the mpeg4 header ... in the case that its complete
michaelni
parents:
273
diff
changeset
|
175 avctx->width = s->width; |
d0c186bcf075
use the width & height from the mpeg4 header ... in the case that its complete
michaelni
parents:
273
diff
changeset
|
176 avctx->height = s->height; |
281
1fc96b02142e
mpeg4 aspect_ratio_info in AVCodecContext (requested by alex)
michaelni
parents:
274
diff
changeset
|
177 avctx->aspect_ratio_info= s->aspect_ratio_info; |
274
d0c186bcf075
use the width & height from the mpeg4 header ... in the case that its complete
michaelni
parents:
273
diff
changeset
|
178 if (MPV_common_init(s) < 0) |
d0c186bcf075
use the width & height from the mpeg4 header ... in the case that its complete
michaelni
parents:
273
diff
changeset
|
179 return -1; |
0 | 180 } |
274
d0c186bcf075
use the width & height from the mpeg4 header ... in the case that its complete
michaelni
parents:
273
diff
changeset
|
181 |
543
8f8f4885d874
return buf_size again, i hope kabi is finally happy now ;)
michaelni
parents:
532
diff
changeset
|
182 if(ret==FRAME_SKIPED) return buf_size; |
454 | 183 /* skip if the header was thrashed */ |
498 | 184 if (ret < 0){ |
185 fprintf(stderr, "header damaged\n"); | |
0 | 186 return -1; |
498 | 187 } |
341 | 188 /* skip b frames if we dont have reference frames */ |
526
cd170daf9e4c
return the number of consumed bytes instead of 0 or buf_size
michaelni
parents:
498
diff
changeset
|
189 if(s->num_available_buffers<2 && s->pict_type==B_TYPE) return buf_size; |
345 | 190 /* skip b frames if we are in a hurry */ |
526
cd170daf9e4c
return the number of consumed bytes instead of 0 or buf_size
michaelni
parents:
498
diff
changeset
|
191 if(s->hurry_up && s->pict_type==B_TYPE) return buf_size; |
454 | 192 |
193 if(s->next_p_frame_damaged){ | |
194 if(s->pict_type==B_TYPE) | |
526
cd170daf9e4c
return the number of consumed bytes instead of 0 or buf_size
michaelni
parents:
498
diff
changeset
|
195 return buf_size; |
454 | 196 else |
197 s->next_p_frame_damaged=0; | |
198 } | |
199 | |
553 | 200 MPV_frame_start(s, avctx); |
0 | 201 |
202 #ifdef DEBUG | |
203 printf("qscale=%d\n", s->qscale); | |
204 #endif | |
205 | |
454 | 206 /* init resync/ error resilience specific variables */ |
207 s->next_resync_qscale= s->qscale; | |
208 s->next_resync_gb= s->gb; | |
209 if(s->resync_marker) s->mb_num_left= 0; | |
210 else s->mb_num_left= s->mb_num; | |
211 | |
0 | 212 /* decode each macroblock */ |
266 | 213 s->block_wrap[0]= |
214 s->block_wrap[1]= | |
215 s->block_wrap[2]= | |
216 s->block_wrap[3]= s->mb_width*2 + 2; | |
217 s->block_wrap[4]= | |
218 s->block_wrap[5]= s->mb_width + 2; | |
0 | 219 for(s->mb_y=0; s->mb_y < s->mb_height; s->mb_y++) { |
162 | 220 /* Check for GOB headers on H.263 */ |
221 /* FIXME: In the future H.263+ will have intra prediction */ | |
222 /* and we are gonna need another way to detect MPEG4 */ | |
223 if (s->mb_y && !s->h263_pred) { | |
454 | 224 s->first_slice_line = h263_decode_gob_header(s); |
225 } | |
226 | |
227 if(s->msmpeg4_version==1){ | |
228 s->last_dc[0]= | |
229 s->last_dc[1]= | |
230 s->last_dc[2]= 128; | |
162 | 231 } |
296 | 232 |
498 | 233 s->y_dc_scale= s->y_dc_scale_table[ s->qscale ]; |
234 s->c_dc_scale= s->c_dc_scale_table[ s->qscale ]; | |
235 | |
266 | 236 s->block_index[0]= s->block_wrap[0]*(s->mb_y*2 + 1) - 1; |
237 s->block_index[1]= s->block_wrap[0]*(s->mb_y*2 + 1); | |
238 s->block_index[2]= s->block_wrap[0]*(s->mb_y*2 + 2) - 1; | |
239 s->block_index[3]= s->block_wrap[0]*(s->mb_y*2 + 2); | |
240 s->block_index[4]= s->block_wrap[4]*(s->mb_y + 1) + s->block_wrap[0]*(s->mb_height*2 + 2); | |
241 s->block_index[5]= s->block_wrap[4]*(s->mb_y + 1 + s->mb_height + 2) + s->block_wrap[0]*(s->mb_height*2 + 2); | |
0 | 242 for(s->mb_x=0; s->mb_x < s->mb_width; s->mb_x++) { |
266 | 243 s->block_index[0]+=2; |
244 s->block_index[1]+=2; | |
245 s->block_index[2]+=2; | |
246 s->block_index[3]+=2; | |
247 s->block_index[4]++; | |
248 s->block_index[5]++; | |
0 | 249 #ifdef DEBUG |
250 printf("**mb x=%d y=%d\n", s->mb_x, s->mb_y); | |
251 #endif | |
454 | 252 |
253 if(s->resync_marker){ | |
254 if(s->mb_num_left<=0){ | |
255 /* except the first block */ | |
256 if(s->mb_x!=0 || s->mb_y!=0){ | |
257 /* did we miss the next resync marker without noticing an error yet */ | |
258 if(((get_bits_count(&s->gb)+8)&(~7)) != s->next_resync_pos && s->decoding_error==0){ | |
259 fprintf(stderr, "slice end missmatch x:%d y:%d %d %d\n", | |
260 s->mb_x, s->mb_y, get_bits_count(&s->gb), s->next_resync_pos); | |
261 ff_conceal_past_errors(s, 1); | |
262 } | |
263 } | |
264 s->qscale= s->next_resync_qscale; | |
498 | 265 s->y_dc_scale= s->y_dc_scale_table[ s->qscale ]; |
266 s->c_dc_scale= s->c_dc_scale_table[ s->qscale ]; | |
267 | |
454 | 268 s->gb= s->next_resync_gb; |
269 s->resync_mb_x= s->mb_x; //we know that the marker is here cuz mb_num_left was the distance to it | |
270 s->resync_mb_y= s->mb_y; | |
271 s->first_slice_line=1; | |
272 | |
273 if(s->codec_id==CODEC_ID_MPEG4){ | |
274 ff_mpeg4_clean_buffers(s); | |
275 ff_mpeg4_resync(s); | |
276 } | |
277 } | |
278 | |
279 if( s->resync_mb_x==s->mb_x | |
280 && s->resync_mb_y==s->mb_y && s->decoding_error!=0){ | |
281 fprintf(stderr, "resynced at %d %d\n", s->mb_x, s->mb_y); | |
282 s->decoding_error= 0; | |
283 } | |
284 } | |
285 | |
144 | 286 //fprintf(stderr,"\nFrame: %d\tMB: %d",avctx->frame_number, (s->mb_y * s->mb_width) + s->mb_x); |
0 | 287 /* DCT & quantize */ |
454 | 288 if(s->decoding_error!=DECODING_DESYNC){ |
289 int last_error= s->decoding_error; | |
290 clear_blocks(s->block[0]); | |
296 | 291 |
454 | 292 s->mv_dir = MV_DIR_FORWARD; |
293 s->mv_type = MV_TYPE_16X16; | |
294 if (s->h263_msmpeg4) { | |
295 if (msmpeg4_decode_mb(s, s->block) < 0) { | |
296 fprintf(stderr,"Error at MB: %d\n", (s->mb_y * s->mb_width) + s->mb_x); | |
297 s->decoding_error=DECODING_DESYNC; | |
298 } | |
299 } else { | |
300 if (h263_decode_mb(s, s->block) < 0) { | |
301 fprintf(stderr,"Error at MB: %d\n", (s->mb_y * s->mb_width) + s->mb_x); | |
302 s->decoding_error=DECODING_DESYNC; | |
303 } | |
304 } | |
305 | |
306 if(s->decoding_error!=last_error){ | |
307 ff_conceal_past_errors(s, 0); | |
161 | 308 } |
0 | 309 } |
454 | 310 |
311 /* conceal errors */ | |
312 if( s->decoding_error==DECODING_DESYNC | |
313 || (s->decoding_error==DECODING_ACDC_LOST && s->mb_intra)){ | |
314 s->mv_dir = MV_DIR_FORWARD; | |
315 s->mv_type = MV_TYPE_16X16; | |
316 s->mb_skiped=0; | |
317 s->mb_intra=0; | |
318 s->mv[0][0][0]=0; //FIXME this is not optimal | |
319 s->mv[0][0][1]=0; | |
320 clear_blocks(s->block[0]); | |
321 }else if(s->decoding_error && !s->mb_intra){ | |
322 clear_blocks(s->block[0]); | |
323 } | |
324 //FIXME remove AC for intra | |
325 | |
12
4d50c7d89e0f
use block[] in structure to have it aligned on 8 bytes for mmx optimizations
glantau
parents:
0
diff
changeset
|
326 MPV_decode_mb(s, s->block); |
454 | 327 |
328 s->mb_num_left--; | |
0 | 329 } |
341 | 330 if ( avctx->draw_horiz_band |
331 && (s->num_available_buffers>=1 || (!s->has_b_frames)) ) { | |
67 | 332 UINT8 *src_ptr[3]; |
333 int y, h, offset; | |
334 y = s->mb_y * 16; | |
335 h = s->height - y; | |
336 if (h > 16) | |
337 h = 16; | |
338 offset = y * s->linesize; | |
308 | 339 if(s->pict_type==B_TYPE || (!s->has_b_frames)){ |
340 src_ptr[0] = s->current_picture[0] + offset; | |
341 src_ptr[1] = s->current_picture[1] + (offset >> 2); | |
342 src_ptr[2] = s->current_picture[2] + (offset >> 2); | |
343 } else { | |
344 src_ptr[0] = s->last_picture[0] + offset; | |
345 src_ptr[1] = s->last_picture[1] + (offset >> 2); | |
346 src_ptr[2] = s->last_picture[2] + (offset >> 2); | |
347 } | |
67 | 348 avctx->draw_horiz_band(avctx, src_ptr, s->linesize, |
349 y, s->width, h); | |
350 } | |
0 | 351 } |
208 | 352 |
311 | 353 if (s->h263_msmpeg4 && s->msmpeg4_version<4 && s->pict_type==I_TYPE) |
208 | 354 if(msmpeg4_decode_ext_header(s, buf_size) < 0) return -1; |
333 | 355 |
356 /* divx 5.01+ bistream reorder stuff */ | |
344 | 357 if(s->codec_id==CODEC_ID_MPEG4 && s->bitstream_buffer_size==0){ |
454 | 358 int current_pos= get_bits_count(&s->gb)>>3; |
359 | |
333 | 360 if( buf_size - current_pos > 5 |
361 && buf_size - current_pos < BITSTREAM_BUFFER_SIZE){ | |
454 | 362 int i; |
363 int startcode_found=0; | |
364 for(i=current_pos; i<buf_size; i++){ | |
365 if(buf[i]==0 && buf[i+1]==0 && buf[i+2]==1 && buf[i+3]==0xB6){ | |
366 startcode_found=1; | |
367 break; | |
368 } | |
369 } | |
370 if(startcode_found){ | |
371 memcpy(s->bitstream_buffer, buf + current_pos, buf_size - current_pos); | |
372 s->bitstream_buffer_size= buf_size - current_pos; | |
373 } | |
374 } | |
375 } | |
376 | |
377 if(s->bitstream_buffer_size==0 && s->error_resilience>0){ | |
378 int left= s->gb.size*8 - get_bits_count(&s->gb); | |
379 int max_extra=8; | |
380 | |
381 if(s->codec_id==CODEC_ID_MPEG4) max_extra+=32; | |
382 | |
383 if(left>max_extra){ | |
384 fprintf(stderr, "discarding %d junk bits at end, next would be %X\n", left, show_bits(&s->gb, 24)); | |
385 if(s->decoding_error==0) | |
386 ff_conceal_past_errors(s, 1); | |
387 } | |
388 if(left<0){ | |
389 fprintf(stderr, "overreading %d bits\n", -left); | |
390 if(s->decoding_error==0) | |
391 ff_conceal_past_errors(s, 1); | |
333 | 392 } |
353 | 393 } |
333 | 394 |
0 | 395 MPV_frame_end(s); |
361 | 396 #if 0 //dirty show MVs, we should export the MV tables and write a filter to show them |
397 { | |
398 int mb_y; | |
399 s->has_b_frames=1; | |
400 for(mb_y=0; mb_y<s->mb_height; mb_y++){ | |
401 int mb_x; | |
411
5c8b3a717929
workaround dc_scale bug in old ffmpeg msmpeg4v3 encoder (set workaround_bugs=1 for this)
michaelni
parents:
396
diff
changeset
|
402 int y= mb_y*16 + 8; |
361 | 403 for(mb_x=0; mb_x<s->mb_width; mb_x++){ |
411
5c8b3a717929
workaround dc_scale bug in old ffmpeg msmpeg4v3 encoder (set workaround_bugs=1 for this)
michaelni
parents:
396
diff
changeset
|
404 int x= mb_x*16 + 8; |
361 | 405 uint8_t *ptr= s->last_picture[0]; |
406 int xy= 1 + mb_x*2 + (mb_y*2 + 1)*(s->mb_width*2 + 2); | |
407 int mx= (s->motion_val[xy][0]>>1) + x; | |
408 int my= (s->motion_val[xy][1]>>1) + y; | |
409 int i; | |
410 int max; | |
411 | |
412 if(mx<0) mx=0; | |
413 if(my<0) my=0; | |
414 if(mx>=s->width) mx= s->width -1; | |
415 if(my>=s->height) my= s->height-1; | |
416 max= ABS(mx-x); | |
417 if(ABS(my-y) > max) max= ABS(my-y); | |
418 /* the ugliest linedrawing routine ... */ | |
419 for(i=0; i<max; i++){ | |
420 int x1= x + (mx-x)*i/max; | |
421 int y1= y + (my-y)*i/max; | |
422 ptr[y1*s->linesize + x1]+=100; | |
423 } | |
411
5c8b3a717929
workaround dc_scale bug in old ffmpeg msmpeg4v3 encoder (set workaround_bugs=1 for this)
michaelni
parents:
396
diff
changeset
|
424 ptr[y*s->linesize + x]+=100; |
361 | 425 s->mbskip_table[mb_x + mb_y*s->mb_width]=0; |
426 } | |
427 } | |
428 | |
429 } | |
430 #endif | |
273
34f40a0fc840
msmpeg4 bugfix (wrong frame displayed if some frames are skipped)
michaelni
parents:
266
diff
changeset
|
431 if(s->pict_type==B_TYPE || (!s->has_b_frames)){ |
262 | 432 pict->data[0] = s->current_picture[0]; |
433 pict->data[1] = s->current_picture[1]; | |
434 pict->data[2] = s->current_picture[2]; | |
435 } else { | |
436 pict->data[0] = s->last_picture[0]; | |
437 pict->data[1] = s->last_picture[1]; | |
438 pict->data[2] = s->last_picture[2]; | |
439 } | |
0 | 440 pict->linesize[0] = s->linesize; |
556 | 441 pict->linesize[1] = s->uvlinesize; |
442 pict->linesize[2] = s->uvlinesize; | |
0 | 443 |
444 avctx->quality = s->qscale; | |
231 | 445 |
446 /* Return the Picture timestamp as the frame number */ | |
447 /* we substract 1 because it is added on utils.c */ | |
448 avctx->frame_number = s->picture_number - 1; | |
449 | |
341 | 450 /* dont output the last pic after seeking |
451 note we allready added +1 for the current pix in MPV_frame_end(s) */ | |
452 if(s->num_available_buffers>=2 || (!s->has_b_frames)) | |
453 *data_size = sizeof(AVPicture); | |
384 | 454 #ifdef PRINT_FRAME_TIME |
455 printf("%Ld\n", rdtsc()-time); | |
456 #endif | |
543
8f8f4885d874
return buf_size again, i hope kabi is finally happy now ;)
michaelni
parents:
532
diff
changeset
|
457 return buf_size; |
0 | 458 } |
459 | |
67 | 460 AVCodec mpeg4_decoder = { |
461 "mpeg4", | |
0 | 462 CODEC_TYPE_VIDEO, |
67 | 463 CODEC_ID_MPEG4, |
0 | 464 sizeof(MpegEncContext), |
465 h263_decode_init, | |
466 NULL, | |
467 h263_decode_end, | |
468 h263_decode_frame, | |
553 | 469 CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1, |
0 | 470 }; |
471 | |
472 AVCodec h263_decoder = { | |
473 "h263", | |
474 CODEC_TYPE_VIDEO, | |
475 CODEC_ID_H263, | |
476 sizeof(MpegEncContext), | |
477 h263_decode_init, | |
478 NULL, | |
479 h263_decode_end, | |
480 h263_decode_frame, | |
553 | 481 CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1, |
0 | 482 }; |
483 | |
307 | 484 AVCodec msmpeg4v1_decoder = { |
485 "msmpeg4v1", | |
486 CODEC_TYPE_VIDEO, | |
487 CODEC_ID_MSMPEG4V1, | |
488 sizeof(MpegEncContext), | |
489 h263_decode_init, | |
490 NULL, | |
491 h263_decode_end, | |
492 h263_decode_frame, | |
553 | 493 CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1, |
307 | 494 }; |
495 | |
496 AVCodec msmpeg4v2_decoder = { | |
497 "msmpeg4v2", | |
498 CODEC_TYPE_VIDEO, | |
499 CODEC_ID_MSMPEG4V2, | |
500 sizeof(MpegEncContext), | |
501 h263_decode_init, | |
502 NULL, | |
503 h263_decode_end, | |
504 h263_decode_frame, | |
553 | 505 CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1, |
307 | 506 }; |
507 | |
508 AVCodec msmpeg4v3_decoder = { | |
0 | 509 "msmpeg4", |
510 CODEC_TYPE_VIDEO, | |
307 | 511 CODEC_ID_MSMPEG4V3, |
0 | 512 sizeof(MpegEncContext), |
513 h263_decode_init, | |
514 NULL, | |
515 h263_decode_end, | |
516 h263_decode_frame, | |
553 | 517 CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1, |
0 | 518 }; |
519 | |
311 | 520 AVCodec wmv1_decoder = { |
521 "wmv1", | |
522 CODEC_TYPE_VIDEO, | |
523 CODEC_ID_WMV1, | |
524 sizeof(MpegEncContext), | |
525 h263_decode_init, | |
526 NULL, | |
527 h263_decode_end, | |
528 h263_decode_frame, | |
553 | 529 CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1, |
311 | 530 }; |
531 | |
498 | 532 AVCodec wmv2_decoder = { |
533 "wmv2", | |
534 CODEC_TYPE_VIDEO, | |
535 CODEC_ID_WMV2, | |
536 sizeof(MpegEncContext), | |
537 h263_decode_init, | |
538 NULL, | |
539 h263_decode_end, | |
540 h263_decode_frame, | |
553 | 541 CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1, |
498 | 542 }; |
543 | |
0 | 544 AVCodec h263i_decoder = { |
545 "h263i", | |
546 CODEC_TYPE_VIDEO, | |
547 CODEC_ID_H263I, | |
548 sizeof(MpegEncContext), | |
549 h263_decode_init, | |
550 NULL, | |
551 h263_decode_end, | |
552 h263_decode_frame, | |
553 | 553 CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1, |
0 | 554 }; |
555 |