diff options
author | Laurent Aimar <fenrir@videolan.org> | 2011-10-04 22:13:57 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2011-10-05 00:07:39 +0200 |
commit | 253d18b352d917a0f2c1fbaa902fec45b19392ee (patch) | |
tree | 7ae21ec4d775f6bb0aa313165613a9bf8339831a /libavcodec/h264.c | |
parent | a51fbb56bb9352476affaef1fc6773c8b059db91 (diff) | |
download | ffmpeg-253d18b352d917a0f2c1fbaa902fec45b19392ee.tar.gz |
h264: bit depth/chroma idc changes must go through a full format negociation.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/h264.c')
-rw-r--r-- | libavcodec/h264.c | 38 |
1 files changed, 20 insertions, 18 deletions
diff --git a/libavcodec/h264.c b/libavcodec/h264.c index 718b12832c..5aac84d8b5 100644 --- a/libavcodec/h264.c +++ b/libavcodec/h264.c @@ -2624,9 +2624,11 @@ static int decode_slice_header(H264Context *h, H264Context *h0){ if (s->context_initialized && ( s->width != s->avctx->width || s->height != s->avctx->height + || s->avctx->bits_per_raw_sample != h->sps.bit_depth_luma + || h->cur_chroma_format_idc != h->sps.chroma_format_idc || av_cmp_q(h->sps.sar, s->avctx->sample_aspect_ratio))) { if(h != h0) { - av_log_missing_feature(s->avctx, "Width/height changing with threads is", 0); + av_log_missing_feature(s->avctx, "Width/height/bit depth/chroma idc changing with threads is", 0); return -1; // width / height changed during parallelized decoding } free_tables(h, 0); @@ -2643,6 +2645,23 @@ static int decode_slice_header(H264Context *h, H264Context *h0){ s->avctx->sample_aspect_ratio= h->sps.sar; av_assert0(s->avctx->sample_aspect_ratio.den); + if (s->avctx->bits_per_raw_sample != h->sps.bit_depth_luma || + h->cur_chroma_format_idc != h->sps.chroma_format_idc) { + if (h->sps.bit_depth_luma >= 8 && h->sps.bit_depth_luma <= 10) { + s->avctx->bits_per_raw_sample = h->sps.bit_depth_luma; + h->cur_chroma_format_idc = h->sps.chroma_format_idc; + h->pixel_shift = h->sps.bit_depth_luma > 8; + + ff_h264dsp_init(&h->h264dsp, h->sps.bit_depth_luma, h->sps.chroma_format_idc); + ff_h264_pred_init(&h->hpc, s->codec_id, h->sps.bit_depth_luma, h->sps.chroma_format_idc); + s->dsp.dct_bits = h->sps.bit_depth_luma > 8 ? 32 : 16; + dsputil_init(&s->dsp, s->avctx); + } else { + av_log(s->avctx, AV_LOG_DEBUG, "Unsupported bit depth: %d\n", h->sps.bit_depth_luma); + return -1; + } + } + if(h->sps.video_signal_type_present_flag){ s->avctx->color_range = h->sps.full_range ? AVCOL_RANGE_JPEG : AVCOL_RANGE_MPEG; if(h->sps.colour_description_present_flag){ @@ -3839,23 +3858,6 @@ static int decode_nal_units(H264Context *h, const uint8_t *buf, int buf_size){ if(avctx->has_b_frames < 2) avctx->has_b_frames= !s->low_delay; - - if (avctx->bits_per_raw_sample != h->sps.bit_depth_luma || - h->cur_chroma_format_idc != h->sps.chroma_format_idc) { - if (h->sps.bit_depth_luma >= 8 && h->sps.bit_depth_luma <= 10) { - avctx->bits_per_raw_sample = h->sps.bit_depth_luma; - h->cur_chroma_format_idc = h->sps.chroma_format_idc; - h->pixel_shift = h->sps.bit_depth_luma > 8; - - ff_h264dsp_init(&h->h264dsp, h->sps.bit_depth_luma, h->sps.chroma_format_idc); - ff_h264_pred_init(&h->hpc, s->codec_id, h->sps.bit_depth_luma, h->sps.chroma_format_idc); - s->dsp.dct_bits = h->sps.bit_depth_luma > 8 ? 32 : 16; - dsputil_init(&s->dsp, s->avctx); - } else { - av_log(avctx, AV_LOG_DEBUG, "Unsupported bit depth: %d\n", h->sps.bit_depth_luma); - return -1; - } - } break; case NAL_PPS: init_get_bits(&s->gb, ptr, bit_length); |