X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavcodec%2Fh264_slice.c;h=e24d41ca50c1ea50afc9720229b4db9dae0da1f5;hb=9d6be83085ccb1f52b923064eb93566ddbb0a1f7;hp=1c9a270fb6cb2205f72bfb7fd6d7fee0747c2927;hpb=cd8087444bb459c7c62e21913adfef5ec09675cc;p=ffmpeg diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c index 1c9a270fb6c..e24d41ca50c 100644 --- a/libavcodec/h264_slice.c +++ b/libavcodec/h264_slice.c @@ -458,12 +458,6 @@ static int h264_frame_start(H264Context *h) H264Picture *pic; int i, ret; const int pixel_shift = h->pixel_shift; - int c[4] = { - 1<<(h->ps.sps->bit_depth_luma-1), - 1<<(h->ps.sps->bit_depth_chroma-1), - 1<<(h->ps.sps->bit_depth_chroma-1), - -1 - }; if (!ff_thread_can_start_frame(h->avctx)) { av_log(h->avctx, AV_LOG_ERROR, "Attempt to start a frame outside SETUP state\n"); @@ -504,8 +498,6 @@ static int h264_frame_start(H264Context *h) if ((ret = alloc_picture(h, pic)) < 0) return ret; - if(!h->frame_recovered && !h->avctx->hwaccel) - ff_color_frame(pic->f, c); h->cur_pic_ptr = pic; ff_h264_unref_picture(h, &h->cur_pic); @@ -1092,6 +1084,12 @@ static int h264_init_ps(H264Context *h, const H264SliceContext *sl, int first_sl h->avctx->colorspace = sps->colorspace; } } + + if (h->sei.alternative_transfer.present && + av_color_transfer_name(h->sei.alternative_transfer.preferred_transfer_characteristics) && + h->sei.alternative_transfer.preferred_transfer_characteristics != AVCOL_TRC_UNSPECIFIED) { + h->avctx->color_trc = h->sei.alternative_transfer.preferred_transfer_characteristics; + } } if (!h->context_initialized || must_reinit || needs_reinit) { @@ -1332,12 +1330,6 @@ static int h264_export_frame_props(H264Context *h) h->sei.picture_timing.timecode_cnt = 0; } - if (h->sei.alternative_transfer.present && - av_color_transfer_name(h->sei.alternative_transfer.preferred_transfer_characteristics) && - h->sei.alternative_transfer.preferred_transfer_characteristics != AVCOL_TRC_UNSPECIFIED) { - h->avctx->color_trc = cur->f->color_trc = h->sei.alternative_transfer.preferred_transfer_characteristics; - } - return 0; } @@ -1582,6 +1574,13 @@ static int h264_field_start(H264Context *h, const H264SliceContext *sl, * vectors. Given we are concealing a lost frame, this probably * is not noticeable by comparison, but it should be fixed. */ if (h->short_ref_count) { + int c[4] = { + 1<<(h->ps.sps->bit_depth_luma-1), + 1<<(h->ps.sps->bit_depth_chroma-1), + 1<<(h->ps.sps->bit_depth_chroma-1), + -1 + }; + if (prev && h->short_ref[0]->f->width == prev->f->width && h->short_ref[0]->f->height == prev->f->height && @@ -1597,7 +1596,8 @@ static int h264_field_start(H264Context *h, const H264SliceContext *sl, prev->f->width, prev->f->height); h->short_ref[0]->poc = prev->poc + 2; - } + } else if (!h->frame_recovered && !h->avctx->hwaccel) + ff_color_frame(h->short_ref[0]->f, c); h->short_ref[0]->frame_num = h->poc.prev_frame_num; } }