goto fail;
s->cbf_luma = av_malloc(sps->min_tb_width * sps->min_tb_height);
- s->tab_ipm = av_malloc(min_pu_size);
+ s->tab_ipm = av_mallocz(min_pu_size);
s->is_pcm = av_malloc(min_pu_size);
if (!s->tab_ipm || !s->cbf_luma || !s->is_pcm)
goto fail;
static int set_sps(HEVCContext *s, const HEVCSPS *sps)
{
int ret;
- int num = 0, den = 0;
+ unsigned int num = 0, den = 0;
pic_arrays_free(s);
ret = pic_arrays_init(s, sps);
if (ret < 0) {
av_log(s->avctx, AV_LOG_ERROR, "Invalid NAL unit %d, skipping.\n",
s->nal_unit_type);
- if (s->avctx->err_recognition & AV_EF_EXPLODE)
- return ret;
- return 0;
+ goto fail;
} else if (!ret)
return 0;
case NAL_VPS:
ret = ff_hevc_decode_nal_vps(s);
if (ret < 0)
- return ret;
+ goto fail;
break;
case NAL_SPS:
ret = ff_hevc_decode_nal_sps(s);
if (ret < 0)
- return ret;
+ goto fail;
break;
case NAL_PPS:
ret = ff_hevc_decode_nal_pps(s);
if (ret < 0)
- return ret;
+ goto fail;
break;
case NAL_SEI_PREFIX:
case NAL_SEI_SUFFIX:
ret = ff_hevc_decode_nal_sei(s);
if (ret < 0)
- return ret;
+ goto fail;
break;
case NAL_TRAIL_R:
case NAL_TRAIL_N:
return ret;
} else if (!s->ref) {
av_log(s->avctx, AV_LOG_ERROR, "First slice in a frame missing.\n");
- return AVERROR_INVALIDDATA;
+ goto fail;
}
if (s->nal_unit_type != s->first_nal_type) {
if (ret < 0) {
av_log(s->avctx, AV_LOG_WARNING,
"Error constructing the reference lists for the current slice.\n");
- if (s->avctx->err_recognition & AV_EF_EXPLODE)
- return ret;
+ goto fail;
}
}
restore_tqb_pixels(s);
}
- if (ctb_addr_ts < 0)
- return ctb_addr_ts;
+ if (ctb_addr_ts < 0) {
+ ret = ctb_addr_ts;
+ goto fail;
+ }
break;
case NAL_EOS_NUT:
case NAL_EOB_NUT:
}
return 0;
+fail:
+ if (s->avctx->err_recognition & AV_EF_EXPLODE)
+ return ret;
+ return 0;
}
/* FIXME: This is adapted from ff_h264_decode_nal, avoiding duplication
if (ret < 0) {
av_log(s->avctx, AV_LOG_WARNING,
"Error parsing NAL unit #%d.\n", i);
- if (s->avctx->err_recognition & AV_EF_EXPLODE)
- goto fail;
+ goto fail;
}
}