s->sao_pixel_buffer_v[c_idx] =
av_malloc((h * 2 * sps->ctb_width) <<
sps->pixel_shift);
+ if (!s->sao_pixel_buffer_h[c_idx] ||
+ !s->sao_pixel_buffer_v[c_idx])
+ goto fail;
}
}
fail:
pic_arrays_free(s);
+ for (i = 0; i < 3; i++) {
+ av_freep(&s->sao_pixel_buffer_h[i]);
+ av_freep(&s->sao_pixel_buffer_v[i]);
+ }
s->ps.sps = NULL;
return ret;
}
y_ctb = (ctb_addr_rs / ((s->ps.sps->width + ctb_size - 1) >> s->ps.sps->log2_ctb_size)) << s->ps.sps->log2_ctb_size;
hls_decode_neighbour(s, x_ctb, y_ctb, ctb_addr_ts);
- ret = ff_hevc_cabac_init(s, ctb_addr_ts);
+ ret = ff_hevc_cabac_init(s, ctb_addr_ts, 0);
if (ret < 0) {
s->tab_slice_address[ctb_addr_rs] = -1;
return ret;
return 0;
}
- ret = ff_hevc_cabac_init(s, ctb_addr_ts);
+ ret = ff_hevc_cabac_init(s, ctb_addr_ts, thread);
if (ret < 0)
goto error;
hls_sao_param(s, x_ctb >> s->ps.sps->log2_ctb_size, y_ctb >> s->ps.sps->log2_ctb_size);
ff_alloc_entries(s->avctx, s->sh.num_entry_point_offsets + 1);
- if (!s->sList[1]) {
- for (i = 1; i < s->threads_number; i++) {
- s->sList[i] = av_malloc(sizeof(HEVCContext));
- memcpy(s->sList[i], s, sizeof(HEVCContext));
- s->HEVClcList[i] = av_mallocz(sizeof(HEVCLocalContext));
- s->sList[i]->HEVClc = s->HEVClcList[i];
+ for (i = 1; i < s->threads_number; i++) {
+ if (s->sList[i] && s->HEVClcList[i])
+ continue;
+ av_freep(&s->sList[i]);
+ av_freep(&s->HEVClcList[i]);
+ s->sList[i] = av_malloc(sizeof(HEVCContext));
+ s->HEVClcList[i] = av_mallocz(sizeof(HEVCLocalContext));
+ if (!s->sList[i] || !s->HEVClcList[i]) {
+ res = AVERROR(ENOMEM);
+ goto error;
}
+ memcpy(s->sList[i], s, sizeof(HEVCContext));
+ s->sList[i]->HEVClc = s->HEVClcList[i];
}
offset = (lc->gb.index >> 3);
AVPacket *avpkt)
{
int ret;
- int new_extradata_size;
+ size_t new_extradata_size;
uint8_t *new_extradata;
HEVCContext *s = avctx->priv_data;
av_freep(&s->sh.offset);
av_freep(&s->sh.size);
- for (i = 1; i < s->threads_number; i++) {
- HEVCLocalContext *lc = s->HEVClcList[i];
- if (lc) {
+ if (s->HEVClcList && s->sList) {
+ for (i = 1; i < s->threads_number; i++) {
av_freep(&s->HEVClcList[i]);
av_freep(&s->sList[i]);
}
}
- if (s->HEVClc == s->HEVClcList[0])
- s->HEVClc = NULL;
- av_freep(&s->HEVClcList[0]);
+ av_freep(&s->HEVClc);
av_freep(&s->HEVClcList);
av_freep(&s->sList);
if (avctx->extradata_size > 0 && avctx->extradata) {
ret = hevc_decode_extradata(s, avctx->extradata, avctx->extradata_size, 1);
if (ret < 0) {
- hevc_decode_free(avctx);
return ret;
}
}
.version = LIBAVUTIL_VERSION_INT,
};
-AVCodec ff_hevc_decoder = {
+const AVCodec ff_hevc_decoder = {
.name = "hevc",
.long_name = NULL_IF_CONFIG_SMALL("HEVC (High Efficiency Video Coding)"),
.type = AVMEDIA_TYPE_VIDEO,
.capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_DELAY |
AV_CODEC_CAP_SLICE_THREADS | AV_CODEC_CAP_FRAME_THREADS,
.caps_internal = FF_CODEC_CAP_INIT_THREADSAFE | FF_CODEC_CAP_EXPORTS_CROPPING |
- FF_CODEC_CAP_ALLOCATE_PROGRESS,
+ FF_CODEC_CAP_ALLOCATE_PROGRESS | FF_CODEC_CAP_INIT_CLEANUP,
.profiles = NULL_IF_CONFIG_SMALL(ff_hevc_profiles),
- .hw_configs = (const AVCodecHWConfigInternal*[]) {
+ .hw_configs = (const AVCodecHWConfigInternal *const []) {
#if CONFIG_HEVC_DXVA2_HWACCEL
HWACCEL_DXVA2(hevc),
#endif