pic->hwaccel_picture_private = pic->hwaccel_priv_buf->data;
}
}
- if (!h->avctx->hwaccel && CONFIG_GRAY && h->flags & CODEC_FLAG_GRAY && pic->f.data[2]) {
+ if (CONFIG_GRAY && !h->avctx->hwaccel && h->flags & CODEC_FLAG_GRAY && pic->f.data[2]) {
int h_chroma_shift, v_chroma_shift;
av_pix_fmt_get_chroma_sub_sample(pic->f.format,
&h_chroma_shift, &v_chroma_shift);
h->sps.chroma_format_idc != h1->sps.chroma_format_idc ||
h->sps.colorspace != h1->sps.colorspace)) {
- /* set bits_per_raw_sample to the previous value. the check for changed
- * bit depth in h264_set_parameter_from_sps() uses it and sets it to
- * the current value */
- h->avctx->bits_per_raw_sample = h->sps.bit_depth_luma;
-
h->width = h1->width;
h->height = h1->height;
h->mb_height = h1->mb_height;
return ret;
}
+ h->enable_er = h1->enable_er;
h->workaround_bugs = h1->workaround_bugs;
h->low_delay = h1->low_delay;
h->droppable = h1->droppable;
h->slice_ctx[i].uvlinesize = h->cur_pic_ptr->f.linesize[1];
}
- if (CONFIG_ERROR_RESILIENCE) {
+ if (CONFIG_ERROR_RESILIENCE && h->enable_er) {
ff_er_frame_start(&h->slice_ctx[0].er);
ff_h264_set_erpic(&h->slice_ctx[0].er.last_pic, NULL);
ff_h264_set_erpic(&h->slice_ctx[0].er.next_pic, NULL);
first_mb_in_slice = get_ue_golomb_long(&sl->gb);
if (first_mb_in_slice == 0) { // FIXME better field boundary detection
- if (h->current_slice && h->cur_pic_ptr && FIELD_PICTURE(h)) {
- ff_h264_field_end(h, sl, 1);
+ if (h->current_slice) {
+ if (h->cur_pic_ptr && FIELD_PICTURE(h) && h->first_field) {
+ ff_h264_field_end(h, sl, 1);
+ h->current_slice = 0;
+ } else if (h->cur_pic_ptr && !FIELD_PICTURE(h) && !h->first_field && h->nal_unit_type == NAL_IDR_SLICE) {
+ av_log(h, AV_LOG_WARNING, "Broken frame packetizing\n");
+ ff_h264_field_end(h, sl, 1);
+ h->current_slice = 0;
+ ff_thread_report_progress(&h->cur_pic_ptr->tf, INT_MAX, 0);
+ ff_thread_report_progress(&h->cur_pic_ptr->tf, INT_MAX, 1);
+ h->cur_pic_ptr = NULL;
+ } else
+ return AVERROR_INVALIDDATA;
}
- h->current_slice = 0;
if (!h->first_field) {
if (h->cur_pic_ptr && !h->droppable) {
ff_thread_report_progress(&h->cur_pic_ptr->tf, INT_MAX,
if (h->mb_width != h->sps.mb_width ||
h->mb_height != h->sps.mb_height * (2 - h->sps.frame_mbs_only_flag) ||
- h->avctx->bits_per_raw_sample != h->sps.bit_depth_luma ||
+ h->cur_bit_depth_luma != h->sps.bit_depth_luma ||
h->cur_chroma_format_idc != h->sps.chroma_format_idc
)
needs_reinit = 1;
must_reinit = (h->context_initialized &&
( 16*h->sps.mb_width != h->avctx->coded_width
|| 16*h->sps.mb_height * (2 - h->sps.frame_mbs_only_flag) != h->avctx->coded_height
- || h->avctx->bits_per_raw_sample != h->sps.bit_depth_luma
+ || h->cur_bit_depth_luma != h->sps.bit_depth_luma
|| h->cur_chroma_format_idc != h->sps.chroma_format_idc
|| h->mb_width != h->sps.mb_width
|| h->mb_height != h->sps.mb_height * (2 - h->sps.frame_mbs_only_flag)
));
- if (non_j_pixfmt(h->avctx->pix_fmt) != non_j_pixfmt(get_pixel_format(h, 0)))
+ if (h->avctx->pix_fmt == AV_PIX_FMT_NONE
+ || (non_j_pixfmt(h->avctx->pix_fmt) != non_j_pixfmt(get_pixel_format(h, 0))))
must_reinit = 1;
if (first_slice && av_cmp_q(h->sps.sar, h->avctx->sample_aspect_ratio))
int startx, int starty,
int endx, int endy, int status)
{
+ if (!sl->h264->enable_er)
+ return;
+
if (CONFIG_ERROR_RESILIENCE) {
ERContext *er = &sl->er;