| OLD | NEW |
| 1 /* | 1 /* |
| 2 * H.26L/H.264/AVC/JVT/14496-10/... parameter set decoding | 2 * H.26L/H.264/AVC/JVT/14496-10/... parameter set decoding |
| 3 * Copyright (c) 2003 Michael Niedermayer <michaelni@gmx.at> | 3 * Copyright (c) 2003 Michael Niedermayer <michaelni@gmx.at> |
| 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 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 | 169 |
| 170 if(get_bits1(&s->gb)){ /* chroma_location_info_present_flag */ | 170 if(get_bits1(&s->gb)){ /* chroma_location_info_present_flag */ |
| 171 s->avctx->chroma_sample_location = get_ue_golomb(&s->gb)+1; /* chroma_s
ample_location_type_top_field */ | 171 s->avctx->chroma_sample_location = get_ue_golomb(&s->gb)+1; /* chroma_s
ample_location_type_top_field */ |
| 172 get_ue_golomb(&s->gb); /* chroma_sample_location_type_bottom_field */ | 172 get_ue_golomb(&s->gb); /* chroma_sample_location_type_bottom_field */ |
| 173 } | 173 } |
| 174 | 174 |
| 175 sps->timing_info_present_flag = get_bits1(&s->gb); | 175 sps->timing_info_present_flag = get_bits1(&s->gb); |
| 176 if(sps->timing_info_present_flag){ | 176 if(sps->timing_info_present_flag){ |
| 177 sps->num_units_in_tick = get_bits_long(&s->gb, 32); | 177 sps->num_units_in_tick = get_bits_long(&s->gb, 32); |
| 178 sps->time_scale = get_bits_long(&s->gb, 32); | 178 sps->time_scale = get_bits_long(&s->gb, 32); |
| 179 if(sps->num_units_in_tick-1 > 0x7FFFFFFEU || sps->time_scale-1 > 0x7FFFF
FFEU){ | 179 if(!sps->num_units_in_tick || !sps->time_scale){ |
| 180 av_log(h->s.avctx, AV_LOG_ERROR, "time_scale/num_units_in_tick inval
id or unsupported (%d/%d)\n", sps->time_scale, sps->num_units_in_tick); | 180 av_log(h->s.avctx, AV_LOG_ERROR, "time_scale/num_units_in_tick inval
id or unsupported (%d/%d)\n", sps->time_scale, sps->num_units_in_tick); |
| 181 return -1; | 181 return -1; |
| 182 } | 182 } |
| 183 sps->fixed_frame_rate_flag = get_bits1(&s->gb); | 183 sps->fixed_frame_rate_flag = get_bits1(&s->gb); |
| 184 } | 184 } |
| 185 | 185 |
| 186 sps->nal_hrd_parameters_present_flag = get_bits1(&s->gb); | 186 sps->nal_hrd_parameters_present_flag = get_bits1(&s->gb); |
| 187 if(sps->nal_hrd_parameters_present_flag) | 187 if(sps->nal_hrd_parameters_present_flag) |
| 188 if(decode_hrd_parameters(h, sps) < 0) | 188 if(decode_hrd_parameters(h, sps) < 0) |
| 189 return -1; | 189 return -1; |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 340 goto fail; | 340 goto fail; |
| 341 } | 341 } |
| 342 | 342 |
| 343 sps->frame_mbs_only_flag= get_bits1(&s->gb); | 343 sps->frame_mbs_only_flag= get_bits1(&s->gb); |
| 344 if(!sps->frame_mbs_only_flag) | 344 if(!sps->frame_mbs_only_flag) |
| 345 sps->mb_aff= get_bits1(&s->gb); | 345 sps->mb_aff= get_bits1(&s->gb); |
| 346 else | 346 else |
| 347 sps->mb_aff= 0; | 347 sps->mb_aff= 0; |
| 348 | 348 |
| 349 sps->direct_8x8_inference_flag= get_bits1(&s->gb); | 349 sps->direct_8x8_inference_flag= get_bits1(&s->gb); |
| 350 if(!sps->frame_mbs_only_flag && !sps->direct_8x8_inference_flag){ |
| 351 av_log(h->s.avctx, AV_LOG_ERROR, "This stream was generated by a broken
encoder, invalid 8x8 inference\n"); |
| 352 goto fail; |
| 353 } |
| 350 | 354 |
| 351 #ifndef ALLOW_INTERLACE | 355 #ifndef ALLOW_INTERLACE |
| 352 if(sps->mb_aff) | 356 if(sps->mb_aff) |
| 353 av_log(h->s.avctx, AV_LOG_ERROR, "MBAFF support not included; enable it
at compile-time.\n"); | 357 av_log(h->s.avctx, AV_LOG_ERROR, "MBAFF support not included; enable it
at compile-time.\n"); |
| 354 #endif | 358 #endif |
| 355 sps->crop= get_bits1(&s->gb); | 359 sps->crop= get_bits1(&s->gb); |
| 356 if(sps->crop){ | 360 if(sps->crop){ |
| 357 sps->crop_left = get_ue_golomb(&s->gb); | 361 sps->crop_left = get_ue_golomb(&s->gb); |
| 358 sps->crop_right = get_ue_golomb(&s->gb); | 362 sps->crop_right = get_ue_golomb(&s->gb); |
| 359 sps->crop_top = get_ue_golomb(&s->gb); | 363 sps->crop_top = get_ue_golomb(&s->gb); |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 518 ); | 522 ); |
| 519 } | 523 } |
| 520 | 524 |
| 521 av_free(h->pps_buffers[pps_id]); | 525 av_free(h->pps_buffers[pps_id]); |
| 522 h->pps_buffers[pps_id]= pps; | 526 h->pps_buffers[pps_id]= pps; |
| 523 return 0; | 527 return 0; |
| 524 fail: | 528 fail: |
| 525 av_free(pps); | 529 av_free(pps); |
| 526 return -1; | 530 return -1; |
| 527 } | 531 } |
| OLD | NEW |