Commit 2707cca7 authored by Mickaël Raulet's avatar Mickaël Raulet Committed by Michael Niedermayer

hevc: cosmetic change(cherry picked from commit 3b57513b3f39c04337801fb9d159c7ca8dfa9deb)

Decreases the difference to Anton Khirnovs patch v5
Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent 3106cbd3
This diff is collapsed.
......@@ -838,22 +838,6 @@ int ff_hevc_decode_nal_sps(HEVCContext *s)
goto err;
}
/* if an SPS with this id but different dimensions already exists, remove
* all PPSes that depend on it */
#define DIFF(x) (sps->x != ((HEVCSPS*)s->sps_list[sps_id]->data)->x)
if (s->sps_list[sps_id] &&
(DIFF(width) || DIFF(height) || DIFF(chroma_format_idc) ||
DIFF(bit_depth) || DIFF(ctb_width) || DIFF(ctb_height))) {
for (i = 0; i < FF_ARRAY_ELEMS(s->pps_list); i++) {
if (s->pps_list[i] && ((HEVCPPS*)s->pps_list[i]->data)->sps_id == sps_id)
av_buffer_unref(&s->pps_list[i]);
}
}
#undef DIFF
av_buffer_unref(&s->sps_list[sps_id]);
s->sps_list[sps_id] = sps_buf;
if (s->avctx->debug & FF_DEBUG_BITSTREAM) {
av_log(s->avctx, AV_LOG_DEBUG, "Parsed SPS: id %d; coded wxh: %dx%d; "
"cropped wxh: %dx%d; pix_fmt: %s.\n",
......@@ -862,6 +846,21 @@ int ff_hevc_decode_nal_sps(HEVCContext *s)
av_get_pix_fmt_name(sps->pix_fmt));
}
/* check if this is a repeat of an already parsed SPS, then keep the
* original one.
* otherwise drop all PPSes that depend on it */
if (s->sps_list[sps_id] &&
!memcmp(s->sps_list[sps_id]->data, sps_buf->data, sps_buf->size)) {
av_buffer_unref(&sps_buf);
} else {
for (i = 0; i < FF_ARRAY_ELEMS(s->pps_list); i++) {
if (s->pps_list[i] && ((HEVCPPS*)s->pps_list[i]->data)->sps_id == sps_id)
av_buffer_unref(&s->pps_list[i]);
}
av_buffer_unref(&s->sps_list[sps_id]);
s->sps_list[sps_id] = sps_buf;
}
return 0;
err:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment