Originally committed as revision 2543 to svn://svn.ffmpeg.org/ffmpeg/trunk
Michael Niedermayer authored on 2003/11/30 23:35:35... | ... |
@@ -90,6 +90,7 @@ void avcodec_register_all(void) |
90 | 90 |
register_avcodec(&h263i_decoder); |
91 | 91 |
register_avcodec(&flv_decoder); |
92 | 92 |
register_avcodec(&rv10_decoder); |
93 |
+ register_avcodec(&rv20_decoder); |
|
93 | 94 |
register_avcodec(&svq1_decoder); |
94 | 95 |
register_avcodec(&svq3_decoder); |
95 | 96 |
register_avcodec(&wmav1_decoder); |
... | ... |
@@ -33,6 +33,7 @@ enum CodecID { |
33 | 33 |
CODEC_ID_MPEG2VIDEO_XVMC, |
34 | 34 |
CODEC_ID_H263, |
35 | 35 |
CODEC_ID_RV10, |
36 |
+ CODEC_ID_RV20, |
|
36 | 37 |
CODEC_ID_MP2, |
37 | 38 |
CODEC_ID_MP3, /* prefered ID for MPEG Audio layer 1, 2 or3 decoding */ |
38 | 39 |
CODEC_ID_VORBIS, |
... | ... |
@@ -1502,6 +1503,7 @@ extern AVCodec h263_encoder; |
1502 | 1502 |
extern AVCodec h263p_encoder; |
1503 | 1503 |
extern AVCodec flv_encoder; |
1504 | 1504 |
extern AVCodec rv10_encoder; |
1505 |
+extern AVCodec rv20_encoder; |
|
1505 | 1506 |
extern AVCodec mjpeg_encoder; |
1506 | 1507 |
extern AVCodec ljpeg_encoder; |
1507 | 1508 |
extern AVCodec mpeg4_encoder; |
... | ... |
@@ -1532,6 +1534,7 @@ extern AVCodec mpeg_xvmc_decoder; |
1532 | 1532 |
extern AVCodec h263i_decoder; |
1533 | 1533 |
extern AVCodec flv_decoder; |
1534 | 1534 |
extern AVCodec rv10_decoder; |
1535 |
+extern AVCodec rv20_decoder; |
|
1535 | 1536 |
extern AVCodec svq1_decoder; |
1536 | 1537 |
extern AVCodec svq3_decoder; |
1537 | 1538 |
extern AVCodec dvvideo_decoder; |
... | ... |
@@ -185,7 +185,7 @@ void ff_flv_encode_picture_header(MpegEncContext * s, int picture_number) |
185 | 185 |
|
186 | 186 |
if(s->h263_aic){ |
187 | 187 |
s->y_dc_scale_table= |
188 |
- s->c_dc_scale_table= h263_aic_dc_scale_table; |
|
188 |
+ s->c_dc_scale_table= ff_aic_dc_scale_table; |
|
189 | 189 |
}else{ |
190 | 190 |
s->y_dc_scale_table= |
191 | 191 |
s->c_dc_scale_table= ff_mpeg1_dc_scale_table; |
... | ... |
@@ -288,7 +288,7 @@ void h263_encode_picture_header(MpegEncContext * s, int picture_number) |
288 | 288 |
|
289 | 289 |
if(s->h263_aic){ |
290 | 290 |
s->y_dc_scale_table= |
291 |
- s->c_dc_scale_table= h263_aic_dc_scale_table; |
|
291 |
+ s->c_dc_scale_table= ff_aic_dc_scale_table; |
|
292 | 292 |
}else{ |
293 | 293 |
s->y_dc_scale_table= |
294 | 294 |
s->c_dc_scale_table= ff_mpeg1_dc_scale_table; |
... | ... |
@@ -1139,11 +1139,12 @@ void h263_encode_mb(MpegEncContext * s, |
1139 | 1139 |
} |
1140 | 1140 |
} else { |
1141 | 1141 |
int li = s->h263_aic ? 0 : 1; |
1142 |
+ assert(s->mb_intra); |
|
1142 | 1143 |
|
1143 | 1144 |
cbp = 0; |
1144 | 1145 |
for(i=0; i<6; i++) { |
1145 | 1146 |
/* Predict DC */ |
1146 |
- if (s->h263_aic && s->mb_intra) { |
|
1147 |
+ if (s->h263_aic) { |
|
1147 | 1148 |
int16_t level = block[i][0]; |
1148 | 1149 |
|
1149 | 1150 |
pred_dc = h263_pred_dc(s, i, &dc_ptr[i]); |
... | ... |
@@ -1286,7 +1287,7 @@ static void h263_pred_acdc(MpegEncContext * s, DCTELEM *block, int n) |
1286 | 1286 |
/* find prediction */ |
1287 | 1287 |
if (n < 4) { |
1288 | 1288 |
x = 2 * s->mb_x + 1 + (n & 1); |
1289 |
- y = 2 * s->mb_y + 1 + ((n & 2) >> 1); |
|
1289 |
+ y = 2 * s->mb_y + 1 + (n>> 1); |
|
1290 | 1290 |
wrap = s->mb_width * 2 + 2; |
1291 | 1291 |
dc_val = s->dc_val[0]; |
1292 | 1292 |
ac_val = s->ac_val[0][0]; |
... | ... |
@@ -1310,10 +1311,13 @@ static void h263_pred_acdc(MpegEncContext * s, DCTELEM *block, int n) |
1310 | 1310 |
c = dc_val[(x) + (y - 1) * wrap]; |
1311 | 1311 |
|
1312 | 1312 |
/* No prediction outside GOB boundary */ |
1313 |
- if (s->first_slice_line && ((n < 2) || (n > 3))) |
|
1314 |
- c = 1024; |
|
1315 |
- pred_dc = 1024; |
|
1313 |
+ if(s->first_slice_line && n!=3){ |
|
1314 |
+ if(n!=2) c= 1024; |
|
1315 |
+ if(n!=1 && s->mb_x == s->resync_mb_x) a= 1024; |
|
1316 |
+ } |
|
1317 |
+ |
|
1316 | 1318 |
if (s->ac_pred) { |
1319 |
+ pred_dc = 1024; |
|
1317 | 1320 |
if (s->h263_aic_dir) { |
1318 | 1321 |
/* left prediction */ |
1319 | 1322 |
if (a != 1024) { |
... | ... |
@@ -1348,8 +1352,8 @@ static void h263_pred_acdc(MpegEncContext * s, DCTELEM *block, int n) |
1348 | 1348 |
|
1349 | 1349 |
if (block[0] < 0) |
1350 | 1350 |
block[0] = 0; |
1351 |
- else if (!(block[0] & 1)) |
|
1352 |
- block[0]++; |
|
1351 |
+ else |
|
1352 |
+ block[0] |= 1; |
|
1353 | 1353 |
|
1354 | 1354 |
/* Update AC/DC tables */ |
1355 | 1355 |
dc_val[(x) + (y) * wrap] = block[0]; |
... | ... |
@@ -3517,7 +3521,14 @@ int ff_h263_decode_mb(MpegEncContext *s, |
3517 | 3517 |
|
3518 | 3518 |
cbp = (cbpc & 3) | (cbpy << 2); |
3519 | 3519 |
if (dquant) { |
3520 |
- change_qscale(s, quant_tab[get_bits(&s->gb, 2)]); |
|
3520 |
+ if(s->modified_quant){ |
|
3521 |
+ if(get_bits1(&s->gb)) |
|
3522 |
+ s->qscale= modified_quant_tab[get_bits1(&s->gb)][ s->qscale ]; |
|
3523 |
+ else |
|
3524 |
+ s->qscale= get_bits(&s->gb, 5); |
|
3525 |
+ }else |
|
3526 |
+ s->qscale += quant_tab[get_bits(&s->gb, 2)]; |
|
3527 |
+ change_qscale(s, 0); |
|
3521 | 3528 |
} |
3522 | 3529 |
if((!s->progressive_sequence) && (cbp || (s->workaround_bugs&FF_BUG_XVID_ILACE))) |
3523 | 3530 |
s->interlaced_dct= get_bits1(&s->gb); |
... | ... |
@@ -3772,7 +3783,14 @@ intra: |
3772 | 3772 |
} |
3773 | 3773 |
cbp = (cbpc & 3) | (cbpy << 2); |
3774 | 3774 |
if (dquant) { |
3775 |
- change_qscale(s, quant_tab[get_bits(&s->gb, 2)]); |
|
3775 |
+ if(s->modified_quant){ |
|
3776 |
+ if(get_bits1(&s->gb)) |
|
3777 |
+ s->qscale= modified_quant_tab[get_bits1(&s->gb)][ s->qscale ]; |
|
3778 |
+ else |
|
3779 |
+ s->qscale= get_bits(&s->gb, 5); |
|
3780 |
+ }else |
|
3781 |
+ s->qscale += quant_tab[get_bits(&s->gb, 2)]; |
|
3782 |
+ change_qscale(s, 0); |
|
3776 | 3783 |
} |
3777 | 3784 |
|
3778 | 3785 |
if(!s->progressive_sequence) |
... | ... |
@@ -4459,9 +4477,7 @@ int h263_decode_picture_header(MpegEncContext *s) |
4459 | 4459 |
av_log(s->avctx, AV_LOG_ERROR, "Independent Segment Decoding not supported\n"); |
4460 | 4460 |
} |
4461 | 4461 |
s->alt_inter_vlc= get_bits1(&s->gb); |
4462 |
- if (get_bits1(&s->gb) != 0) { |
|
4463 |
- av_log(s->avctx, AV_LOG_ERROR, "Modified Quantization not supported\n"); |
|
4464 |
- } |
|
4462 |
+ s->modified_quant= get_bits1(&s->gb); |
|
4465 | 4463 |
|
4466 | 4464 |
skip_bits(&s->gb, 1); /* Prevent start code emulation */ |
4467 | 4465 |
|
... | ... |
@@ -4532,14 +4548,14 @@ int h263_decode_picture_header(MpegEncContext *s) |
4532 | 4532 |
|
4533 | 4533 |
if(s->h263_aic){ |
4534 | 4534 |
s->y_dc_scale_table= |
4535 |
- s->c_dc_scale_table= h263_aic_dc_scale_table; |
|
4535 |
+ s->c_dc_scale_table= ff_aic_dc_scale_table; |
|
4536 | 4536 |
}else{ |
4537 | 4537 |
s->y_dc_scale_table= |
4538 | 4538 |
s->c_dc_scale_table= ff_mpeg1_dc_scale_table; |
4539 | 4539 |
} |
4540 | 4540 |
|
4541 | 4541 |
if(s->avctx->debug&FF_DEBUG_PICT_INFO){ |
4542 |
- av_log(s->avctx, AV_LOG_DEBUG, "qp:%d %c size:%d rnd:%d%s%s%s%s%s%s\n", |
|
4542 |
+ av_log(s->avctx, AV_LOG_DEBUG, "qp:%d %c size:%d rnd:%d%s%s%s%s%s%s%s\n", |
|
4543 | 4543 |
s->qscale, av_get_pict_type_char(s->pict_type), |
4544 | 4544 |
s->gb.size_in_bits, 1-s->no_rounding, |
4545 | 4545 |
s->obmc ? " AP" : "", |
... | ... |
@@ -4547,7 +4563,8 @@ int h263_decode_picture_header(MpegEncContext *s) |
4547 | 4547 |
s->h263_long_vectors ? " LONG" : "", |
4548 | 4548 |
s->h263_plus ? " +" : "", |
4549 | 4549 |
s->h263_aic ? " AIC" : "", |
4550 |
- s->alt_inter_vlc ? " AIV" : "" |
|
4550 |
+ s->alt_inter_vlc ? " AIV" : "", |
|
4551 |
+ s->modified_quant ? " MQ" : "" |
|
4551 | 4552 |
); |
4552 | 4553 |
} |
4553 | 4554 |
#if 1 |
... | ... |
@@ -208,8 +208,29 @@ static const uint16_t h263_format[8][2] = { |
208 | 208 |
{ 1408, 1152 }, |
209 | 209 |
}; |
210 | 210 |
|
211 |
-static uint8_t h263_aic_dc_scale_table[32]={ |
|
211 |
+uint8_t ff_aic_dc_scale_table[32]={ |
|
212 | 212 |
// 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 |
213 | 213 |
0, 2, 4, 6, 8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52,54,56,58,60,62 |
214 | 214 |
}; |
215 | 215 |
|
216 |
+static const uint8_t modified_quant_tab[2][32]={ |
|
217 |
+// 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 |
|
218 |
+{ |
|
219 |
+ 0, 3, 1, 2, 3, 4, 5, 6, 7, 8, 9, 9,10,11,12,13,14,15,16,17,18,18,19,20,21,22,23,24,25,26,27,28 |
|
220 |
+},{ |
|
221 |
+ 0, 2, 3, 4, 5, 6, 7, 8, 9,10,11,13,14,15,16,17,18,19,20,21,22,24,25,26,27,28,29,30,31,31,31,26 |
|
222 |
+} |
|
223 |
+}; |
|
224 |
+ |
|
225 |
+static const uint8_t chroma_qscale_tab[32]={ |
|
226 |
+// 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 |
|
227 |
+ 0, 1, 2, 3, 4, 5, 6, 6, 7, 8, 9, 9,10,10,11,11,12,12,12,13,13,13,14,14,14,14,14,15,15,15,15,15 |
|
228 |
+}; |
|
229 |
+ |
|
230 |
+const uint16_t ff_mba_max[6]={ |
|
231 |
+ 47, 98, 395,1583,6335,9215 |
|
232 |
+}; |
|
233 |
+ |
|
234 |
+const uint8_t ff_mba_length[6]={ |
|
235 |
+ 6, 7, 9, 11, 13, 14 |
|
236 |
+}; |
... | ... |
@@ -526,6 +526,7 @@ typedef struct MpegEncContext { |
526 | 526 |
int h263_aic; ///< Advanded INTRA Coding (AIC) |
527 | 527 |
int h263_aic_dir; ///< AIC direction: 0 = left, 1 = top |
528 | 528 |
int alt_inter_vlc; ///< alternative inter vlc |
529 |
+ int modified_quant; |
|
529 | 530 |
|
530 | 531 |
/* mpeg4 specific */ |
531 | 532 |
int time_increment_resolution; |
... | ... |
@@ -814,8 +815,12 @@ static inline int get_rl_index(const RLTable *rl, int last, int run, int level) |
814 | 814 |
|
815 | 815 |
extern uint8_t ff_mpeg4_y_dc_scale_table[32]; |
816 | 816 |
extern uint8_t ff_mpeg4_c_dc_scale_table[32]; |
817 |
+extern uint8_t ff_aic_dc_scale_table[32]; |
|
817 | 818 |
extern const int16_t ff_mpeg4_default_intra_matrix[64]; |
818 | 819 |
extern const int16_t ff_mpeg4_default_non_intra_matrix[64]; |
820 |
+extern const uint16_t ff_mba_max[6]; |
|
821 |
+extern const uint8_t ff_mba_length[6]; |
|
822 |
+ |
|
819 | 823 |
int ff_h263_decode_init(AVCodecContext *avctx); |
820 | 824 |
int ff_h263_decode_frame(AVCodecContext *avctx, |
821 | 825 |
void *data, int *data_size, |
... | ... |
@@ -337,6 +337,55 @@ static int rv10_decode_picture_header(MpegEncContext *s) |
337 | 337 |
return mb_count; |
338 | 338 |
} |
339 | 339 |
|
340 |
+static int rv20_decode_picture_header(MpegEncContext *s) |
|
341 |
+{ |
|
342 |
+ int pb_frame, seq, mb_pos; |
|
343 |
+ int i; |
|
344 |
+ |
|
345 |
+ if (get_bits(&s->gb, 1)) |
|
346 |
+ s->pict_type = P_TYPE; |
|
347 |
+ else |
|
348 |
+ s->pict_type = I_TYPE; |
|
349 |
+ |
|
350 |
+ pb_frame = get_bits(&s->gb, 2); |
|
351 |
+ |
|
352 |
+ if (pb_frame){ |
|
353 |
+ av_log(s->avctx, AV_LOG_ERROR, "pb frame not supported\n"); |
|
354 |
+ return -1; |
|
355 |
+ } |
|
356 |
+ |
|
357 |
+ s->qscale = get_bits(&s->gb, 5); |
|
358 |
+ if(s->qscale==0){ |
|
359 |
+ av_log(s->avctx, AV_LOG_ERROR, "error, qscale:0\n"); |
|
360 |
+ return -1; |
|
361 |
+ } |
|
362 |
+ |
|
363 |
+ seq= get_bits(&s->gb, 8); |
|
364 |
+ |
|
365 |
+ for(i=0; i<6; i++){ |
|
366 |
+ if(s->mb_width*s->mb_height < ff_mba_max[i]) break; |
|
367 |
+ } |
|
368 |
+ mb_pos= get_bits(&s->gb, ff_mba_length[i]); |
|
369 |
+ s->mb_x= mb_pos % s->mb_width; |
|
370 |
+ s->mb_y= mb_pos / s->mb_width; |
|
371 |
+ s->no_rounding= get_bits1(&s->gb); |
|
372 |
+ |
|
373 |
+ s->f_code = 1; |
|
374 |
+ s->unrestricted_mv = 1; |
|
375 |
+ s->h263_aic= s->pict_type == I_TYPE; |
|
376 |
+// s->alt_inter_vlc=1; |
|
377 |
+// s->obmc=1; |
|
378 |
+// s->umvplus=1; |
|
379 |
+// s->modified_quant=1; |
|
380 |
+ |
|
381 |
+ if(s->avctx->debug & FF_DEBUG_PICT_INFO){ |
|
382 |
+ av_log(s->avctx, AV_LOG_INFO, "num:%3d x:%2d y:%2d type:%d qscale:%2d rnd:%d\n", |
|
383 |
+ seq, s->mb_x, s->mb_y, s->pict_type, s->qscale, s->no_rounding); |
|
384 |
+ } |
|
385 |
+ |
|
386 |
+ return s->mb_width*s->mb_height - mb_pos; |
|
387 |
+} |
|
388 |
+ |
|
340 | 389 |
static int rv10_decode_init(AVCodecContext *avctx) |
341 | 390 |
{ |
342 | 391 |
MpegEncContext *s = avctx->priv_data; |
... | ... |
@@ -348,20 +397,26 @@ static int rv10_decode_init(AVCodecContext *avctx) |
348 | 348 |
s->width = avctx->width; |
349 | 349 |
s->height = avctx->height; |
350 | 350 |
|
351 |
- s->h263_rv10 = 1; |
|
352 | 351 |
switch(avctx->sub_id){ |
353 | 352 |
case 0x10000000: |
354 | 353 |
s->rv10_version= 0; |
355 | 354 |
s->h263_long_vectors=0; |
355 |
+ s->h263_rv10 = 1; |
|
356 | 356 |
break; |
357 | 357 |
case 0x10003000: |
358 | 358 |
s->rv10_version= 3; |
359 | 359 |
s->h263_long_vectors=1; |
360 |
+ s->h263_rv10 = 1; |
|
360 | 361 |
break; |
361 | 362 |
case 0x10003001: |
362 | 363 |
s->rv10_version= 3; |
363 | 364 |
s->h263_long_vectors=0; |
365 |
+ s->h263_rv10 = 1; |
|
364 | 366 |
break; |
367 |
+ case 0x20001000: |
|
368 |
+ case 0x20100001: |
|
369 |
+ case 0x20200002: |
|
370 |
+ case 0x20101001: //added |
|
365 | 371 |
default: |
366 | 372 |
av_log(s->avctx, AV_LOG_ERROR, "unknown header %X\n", avctx->sub_id); |
367 | 373 |
} |
... | ... |
@@ -373,8 +428,6 @@ static int rv10_decode_init(AVCodecContext *avctx) |
373 | 373 |
|
374 | 374 |
h263_decode_init_vlc(s); |
375 | 375 |
|
376 |
- s->y_dc_scale_table= |
|
377 |
- s->c_dc_scale_table= ff_mpeg1_dc_scale_table; |
|
378 | 376 |
s->progressive_sequence=1; |
379 | 377 |
|
380 | 378 |
/* init rv vlc */ |
... | ... |
@@ -408,8 +461,16 @@ static int rv10_decode_packet(AVCodecContext *avctx, |
408 | 408 |
int i, mb_count, mb_pos, left; |
409 | 409 |
|
410 | 410 |
init_get_bits(&s->gb, buf, buf_size*8); |
411 |
- |
|
412 |
- mb_count = rv10_decode_picture_header(s); |
|
411 |
+#if 0 |
|
412 |
+ for(i=0; i<buf_size*8 && i<100; i++) |
|
413 |
+ printf("%d", get_bits1(&s->gb)); |
|
414 |
+ printf("\n"); |
|
415 |
+ return 0; |
|
416 |
+#endif |
|
417 |
+ if(s->codec_id ==CODEC_ID_RV10) |
|
418 |
+ mb_count = rv10_decode_picture_header(s); |
|
419 |
+ else |
|
420 |
+ mb_count = rv20_decode_picture_header(s); |
|
413 | 421 |
if (mb_count < 0) { |
414 | 422 |
av_log(s->avctx, AV_LOG_ERROR, "HEADER ERROR\n"); |
415 | 423 |
return -1; |
... | ... |
@@ -426,6 +487,7 @@ static int rv10_decode_packet(AVCodecContext *avctx, |
426 | 426 |
av_log(s->avctx, AV_LOG_ERROR, "COUNT ERROR\n"); |
427 | 427 |
return -1; |
428 | 428 |
} |
429 |
+//if(s->pict_type == P_TYPE) return 0; |
|
429 | 430 |
|
430 | 431 |
if (s->mb_x == 0 && s->mb_y == 0) { |
431 | 432 |
if(MPV_frame_start(s, avctx) < 0) |
... | ... |
@@ -437,14 +499,27 @@ static int rv10_decode_packet(AVCodecContext *avctx, |
437 | 437 |
#endif |
438 | 438 |
|
439 | 439 |
/* default quantization values */ |
440 |
- s->y_dc_scale = 8; |
|
441 |
- s->c_dc_scale = 8; |
|
440 |
+ if(s->codec_id== CODEC_ID_RV10){ |
|
441 |
+ if(s->mb_y==0) s->first_slice_line=1; |
|
442 |
+ }else{ |
|
443 |
+ s->first_slice_line=1; |
|
444 |
+ s->resync_mb_x= s->mb_x; |
|
445 |
+ s->resync_mb_y= s->mb_y; |
|
446 |
+ } |
|
447 |
+ if(s->h263_aic){ |
|
448 |
+ s->y_dc_scale_table= |
|
449 |
+ s->c_dc_scale_table= ff_aic_dc_scale_table; |
|
450 |
+ }else{ |
|
451 |
+ s->y_dc_scale_table= |
|
452 |
+ s->c_dc_scale_table= ff_mpeg1_dc_scale_table; |
|
453 |
+ } |
|
454 |
+ s->y_dc_scale= s->y_dc_scale_table[ s->qscale ]; |
|
455 |
+ s->c_dc_scale= s->c_dc_scale_table[ s->qscale ]; |
|
456 |
+ |
|
442 | 457 |
s->rv10_first_dc_coded[0] = 0; |
443 | 458 |
s->rv10_first_dc_coded[1] = 0; |
444 | 459 |
s->rv10_first_dc_coded[2] = 0; |
445 | 460 |
|
446 |
- if(s->mb_y==0) s->first_slice_line=1; |
|
447 |
- |
|
448 | 461 |
s->block_wrap[0]= |
449 | 462 |
s->block_wrap[1]= |
450 | 463 |
s->block_wrap[2]= |
... | ... |
@@ -454,6 +529,7 @@ static int rv10_decode_packet(AVCodecContext *avctx, |
454 | 454 |
ff_init_block_index(s); |
455 | 455 |
/* decode each macroblock */ |
456 | 456 |
for(i=0;i<mb_count;i++) { |
457 |
+ int ret; |
|
457 | 458 |
ff_update_block_index(s); |
458 | 459 |
#ifdef DEBUG |
459 | 460 |
printf("**mb x=%d y=%d\n", s->mb_x, s->mb_y); |
... | ... |
@@ -462,7 +538,9 @@ static int rv10_decode_packet(AVCodecContext *avctx, |
462 | 462 |
s->dsp.clear_blocks(s->block[0]); |
463 | 463 |
s->mv_dir = MV_DIR_FORWARD; |
464 | 464 |
s->mv_type = MV_TYPE_16X16; |
465 |
- if (ff_h263_decode_mb(s, s->block) == SLICE_ERROR) { |
|
465 |
+ ret=ff_h263_decode_mb(s, s->block); |
|
466 |
+ |
|
467 |
+ if (ret == SLICE_ERROR) { |
|
466 | 468 |
av_log(s->avctx, AV_LOG_ERROR, "ERROR at MB %d %d\n", s->mb_x, s->mb_y); |
467 | 469 |
return -1; |
468 | 470 |
} |
... | ... |
@@ -472,8 +550,10 @@ static int rv10_decode_packet(AVCodecContext *avctx, |
472 | 472 |
s->mb_x = 0; |
473 | 473 |
s->mb_y++; |
474 | 474 |
ff_init_block_index(s); |
475 |
- s->first_slice_line=0; |
|
476 | 475 |
} |
476 |
+ if(s->mb_x == s->resync_mb_x) |
|
477 |
+ s->first_slice_line=0; |
|
478 |
+ if(ret == SLICE_END) break; |
|
477 | 479 |
} |
478 | 480 |
|
479 | 481 |
return buf_size; |
... | ... |
@@ -539,3 +619,15 @@ AVCodec rv10_decoder = { |
539 | 539 |
rv10_decode_frame, |
540 | 540 |
CODEC_CAP_DR1 |
541 | 541 |
}; |
542 |
+ |
|
543 |
+AVCodec rv20_decoder = { |
|
544 |
+ "rv20", |
|
545 |
+ CODEC_TYPE_VIDEO, |
|
546 |
+ CODEC_ID_RV20, |
|
547 |
+ sizeof(MpegEncContext), |
|
548 |
+ rv10_decode_init, |
|
549 |
+ NULL, |
|
550 |
+ rv10_decode_end, |
|
551 |
+ rv10_decode_frame, |
|
552 |
+ CODEC_CAP_DR1 |
|
553 |
+}; |