OLD | NEW |
1 /* | 1 /* |
2 * MPEG4 decoder. | 2 * MPEG4 decoder. |
3 * Copyright (c) 2000,2001 Fabrice Bellard | 3 * Copyright (c) 2000,2001 Fabrice Bellard |
4 * Copyright (c) 2002-2010 Michael Niedermayer <michaelni@gmx.at> | 4 * Copyright (c) 2002-2010 Michael Niedermayer <michaelni@gmx.at> |
5 * | 5 * |
6 * This file is part of FFmpeg. | 6 * This file is part of FFmpeg. |
7 * | 7 * |
8 * FFmpeg is free software; you can redistribute it and/or | 8 * FFmpeg is free software; you can redistribute it and/or |
9 * modify it under the terms of the GNU Lesser General Public | 9 * modify it under the terms of the GNU Lesser General Public |
10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
(...skipping 2076 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2087 int load_backward_shape= get_bits1(gb); | 2087 int load_backward_shape= get_bits1(gb); |
2088 if(load_backward_shape){ | 2088 if(load_backward_shape){ |
2089 av_log(s->avctx, AV_LOG_ERROR, "load backward shape isn't s
upported\n"); | 2089 av_log(s->avctx, AV_LOG_ERROR, "load backward shape isn't s
upported\n"); |
2090 } | 2090 } |
2091 } | 2091 } |
2092 skip_bits(gb, 2); //ref_select_code | 2092 skip_bits(gb, 2); //ref_select_code |
2093 } | 2093 } |
2094 } | 2094 } |
2095 /* detect buggy encoders which don't set the low_delay flag (divx4/xvid/ope
ndivx)*/ | 2095 /* detect buggy encoders which don't set the low_delay flag (divx4/xvid/ope
ndivx)*/ |
2096 // note we cannot detect divx5 without b-frames easily (although it's buggy
too) | 2096 // note we cannot detect divx5 without b-frames easily (although it's buggy
too) |
2097 if(s->vo_type==0 && s->vol_control_parameters==0 && s->divx_version==0 && s
->picture_number==0){ | 2097 if(s->vo_type==0 && s->vol_control_parameters==0 && s->divx_version==-1 &&
s->picture_number==0){ |
2098 av_log(s->avctx, AV_LOG_ERROR, "looks like this file was encoded with (
divx4/(old)xvid/opendivx) -> forcing low_delay flag\n"); | 2098 av_log(s->avctx, AV_LOG_ERROR, "looks like this file was encoded with (
divx4/(old)xvid/opendivx) -> forcing low_delay flag\n"); |
2099 s->low_delay=1; | 2099 s->low_delay=1; |
2100 } | 2100 } |
2101 | 2101 |
2102 s->picture_number++; // better than pic number==0 always ;) | 2102 s->picture_number++; // better than pic number==0 always ;) |
2103 | 2103 |
2104 s->y_dc_scale_table= ff_mpeg4_y_dc_scale_table; //FIXME add short header su
pport | 2104 s->y_dc_scale_table= ff_mpeg4_y_dc_scale_table; //FIXME add short header su
pport |
2105 s->c_dc_scale_table= ff_mpeg4_c_dc_scale_table; | 2105 s->c_dc_scale_table= ff_mpeg4_c_dc_scale_table; |
2106 | 2106 |
2107 if(s->workaround_bugs&FF_BUG_EDGE){ | 2107 if(s->workaround_bugs&FF_BUG_EDGE){ |
(...skipping 18 matching lines...) Expand all Loading... |
2126 | 2126 |
2127 if(s->codec_tag == AV_RL32("WV1F") && show_bits(gb, 24) == 0x575630){ | 2127 if(s->codec_tag == AV_RL32("WV1F") && show_bits(gb, 24) == 0x575630){ |
2128 skip_bits(gb, 24); | 2128 skip_bits(gb, 24); |
2129 if(get_bits(gb, 8) == 0xF0) | 2129 if(get_bits(gb, 8) == 0xF0) |
2130 goto end; | 2130 goto end; |
2131 } | 2131 } |
2132 | 2132 |
2133 startcode = 0xff; | 2133 startcode = 0xff; |
2134 for(;;) { | 2134 for(;;) { |
2135 if(get_bits_count(gb) >= gb->size_in_bits){ | 2135 if(get_bits_count(gb) >= gb->size_in_bits){ |
2136 if(gb->size_in_bits==8 && (s->divx_version || s->xvid_build)){ | 2136 if(gb->size_in_bits==8 && (s->divx_version>=0 || s->xvid_build>=0)){ |
2137 av_log(s->avctx, AV_LOG_ERROR, "frame skip %d\n", gb->size_in_bi
ts); | 2137 av_log(s->avctx, AV_LOG_ERROR, "frame skip %d\n", gb->size_in_bi
ts); |
2138 return FRAME_SKIPPED; //divx bug | 2138 return FRAME_SKIPPED; //divx bug |
2139 }else | 2139 }else |
2140 return -1; //end of stream | 2140 return -1; //end of stream |
2141 } | 2141 } |
2142 | 2142 |
2143 /* use the bits after the test */ | 2143 /* use the bits after the test */ |
2144 v = get_bits(gb, 8); | 2144 v = get_bits(gb, 8); |
2145 startcode = ((startcode << 8) | v) & 0xffffffff; | 2145 startcode = ((startcode << 8) | v) & 0xffffffff; |
2146 | 2146 |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2202 s->avctx->has_b_frames= !s->low_delay; | 2202 s->avctx->has_b_frames= !s->low_delay; |
2203 return decode_vop_header(s, gb); | 2203 return decode_vop_header(s, gb); |
2204 } | 2204 } |
2205 | 2205 |
2206 static av_cold int decode_init(AVCodecContext *avctx) | 2206 static av_cold int decode_init(AVCodecContext *avctx) |
2207 { | 2207 { |
2208 MpegEncContext *s = avctx->priv_data; | 2208 MpegEncContext *s = avctx->priv_data; |
2209 int ret; | 2209 int ret; |
2210 static int done = 0; | 2210 static int done = 0; |
2211 | 2211 |
| 2212 s->divx_version= |
| 2213 s->divx_build= |
| 2214 s->xvid_build= |
| 2215 s->lavc_build= -1; |
| 2216 |
2212 if((ret=ff_h263_decode_init(avctx)) < 0) | 2217 if((ret=ff_h263_decode_init(avctx)) < 0) |
2213 return ret; | 2218 return ret; |
2214 | 2219 |
2215 if (!done) { | 2220 if (!done) { |
2216 done = 1; | 2221 done = 1; |
2217 | 2222 |
2218 init_rl(&ff_mpeg4_rl_intra, ff_mpeg4_static_rl_table_store[0]); | 2223 init_rl(&ff_mpeg4_rl_intra, ff_mpeg4_static_rl_table_store[0]); |
2219 init_rl(&rvlc_rl_inter, ff_mpeg4_static_rl_table_store[1]); | 2224 init_rl(&rvlc_rl_inter, ff_mpeg4_static_rl_table_store[1]); |
2220 init_rl(&rvlc_rl_intra, ff_mpeg4_static_rl_table_store[2]); | 2225 init_rl(&rvlc_rl_intra, ff_mpeg4_static_rl_table_store[2]); |
2221 INIT_VLC_RL(ff_mpeg4_rl_intra, 554); | 2226 INIT_VLC_RL(ff_mpeg4_rl_intra, 554); |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2269 sizeof(MpegEncContext), | 2274 sizeof(MpegEncContext), |
2270 decode_init, | 2275 decode_init, |
2271 NULL, | 2276 NULL, |
2272 ff_h263_decode_end, | 2277 ff_h263_decode_end, |
2273 ff_h263_decode_frame, | 2278 ff_h263_decode_frame, |
2274 CODEC_CAP_DR1 | CODEC_CAP_TRUNCATED | CODEC_CAP_DELAY | CODEC_CAP_HWACCEL_VD
PAU, | 2279 CODEC_CAP_DR1 | CODEC_CAP_TRUNCATED | CODEC_CAP_DELAY | CODEC_CAP_HWACCEL_VD
PAU, |
2275 .long_name= NULL_IF_CONFIG_SMALL("MPEG-4 part 2 (VDPAU)"), | 2280 .long_name= NULL_IF_CONFIG_SMALL("MPEG-4 part 2 (VDPAU)"), |
2276 .pix_fmts= (const enum PixelFormat[]){PIX_FMT_VDPAU_MPEG4, PIX_FMT_NONE}, | 2281 .pix_fmts= (const enum PixelFormat[]){PIX_FMT_VDPAU_MPEG4, PIX_FMT_NONE}, |
2277 }; | 2282 }; |
2278 #endif | 2283 #endif |
OLD | NEW |