OLD | NEW |
1 /* | 1 /* |
2 * Chinese AVS video (AVS1-P2, JiZhun profile) decoder. | 2 * Chinese AVS video (AVS1-P2, JiZhun profile) decoder. |
3 * Copyright (c) 2006 Stefan Gehrer <stefan.gehrer@gmx.de> | 3 * Copyright (c) 2006 Stefan Gehrer <stefan.gehrer@gmx.de> |
4 * | 4 * |
5 * This file is part of FFmpeg. | 5 * This file is part of FFmpeg. |
6 * | 6 * |
7 * FFmpeg is free software; you can redistribute it and/or | 7 * FFmpeg is free software; you can redistribute it and/or |
8 * modify it under the terms of the GNU Lesser General Public | 8 * modify it under the terms of the GNU Lesser General Public |
9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
10 * version 2.1 of the License, or (at your option) any later version. | 10 * version 2.1 of the License, or (at your option) any later version. |
(...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
476 return -1; | 476 return -1; |
477 } | 477 } |
478 /* make sure we have the reference frames we need */ | 478 /* make sure we have the reference frames we need */ |
479 if(!h->DPB[0].data[0] || | 479 if(!h->DPB[0].data[0] || |
480 (!h->DPB[1].data[0] && h->pic_type == FF_B_TYPE)) | 480 (!h->DPB[1].data[0] && h->pic_type == FF_B_TYPE)) |
481 return -1; | 481 return -1; |
482 } else { | 482 } else { |
483 h->pic_type = FF_I_TYPE; | 483 h->pic_type = FF_I_TYPE; |
484 if(get_bits1(&s->gb)) | 484 if(get_bits1(&s->gb)) |
485 skip_bits(&s->gb,24);//time_code | 485 skip_bits(&s->gb,24);//time_code |
| 486 /* old sample clips were all progressive and no low_delay, |
| 487 bump stream revision if detected otherwise */ |
| 488 if((s->low_delay) || !(show_bits(&s->gb,9) & 1)) |
| 489 h->stream_revision = 1; |
| 490 /* similarly test top_field_first and repeat_first_field */ |
| 491 else if(show_bits(&s->gb,11) & 3) |
| 492 h->stream_revision = 1; |
| 493 if(h->stream_revision > 0) |
| 494 skip_bits(&s->gb,1); //marker_bit |
486 } | 495 } |
487 /* release last B frame */ | 496 /* release last B frame */ |
488 if(h->picture.data[0]) | 497 if(h->picture.data[0]) |
489 s->avctx->release_buffer(s->avctx, (AVFrame *)&h->picture); | 498 s->avctx->release_buffer(s->avctx, (AVFrame *)&h->picture); |
490 | 499 |
491 s->avctx->get_buffer(s->avctx, (AVFrame *)&h->picture); | 500 s->avctx->get_buffer(s->avctx, (AVFrame *)&h->picture); |
492 ff_cavs_init_pic(h); | 501 ff_cavs_init_pic(h); |
493 h->picture.poc = get_bits(&s->gb,8)*2; | 502 h->picture.poc = get_bits(&s->gb,8)*2; |
494 | 503 |
495 /* get temporal distances and MV scaling factors */ | 504 /* get temporal distances and MV scaling factors */ |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
706 CODEC_ID_CAVS, | 715 CODEC_ID_CAVS, |
707 sizeof(AVSContext), | 716 sizeof(AVSContext), |
708 ff_cavs_init, | 717 ff_cavs_init, |
709 NULL, | 718 NULL, |
710 ff_cavs_end, | 719 ff_cavs_end, |
711 cavs_decode_frame, | 720 cavs_decode_frame, |
712 CODEC_CAP_DR1 | CODEC_CAP_DELAY, | 721 CODEC_CAP_DR1 | CODEC_CAP_DELAY, |
713 .flush= cavs_flush, | 722 .flush= cavs_flush, |
714 .long_name= NULL_IF_CONFIG_SMALL("Chinese AVS video (AVS1-P2, JiZhun profile
)"), | 723 .long_name= NULL_IF_CONFIG_SMALL("Chinese AVS video (AVS1-P2, JiZhun profile
)"), |
715 }; | 724 }; |
OLD | NEW |