diff options
author | Mickaƫl Raulet <mraulet@insa-rennes.fr> | 2013-10-27 18:26:58 +0400 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2013-10-28 02:48:11 +0400 |
commit | 2707cca78f70a5c1c744dbedbcaefd5c7d7f7586 (patch) | |
tree | 1eae2234caea0e30a1d02f4e9a0cfe5fce6ce162 /libavcodec/hevc_ps.c | |
parent | 3106cbd32118b121b5ae3dbf1e586a41c2f0793f (diff) |
hevc: cosmetic change(cherry picked from commit 3b57513b3f39c04337801fb9d159c7ca8dfa9deb)
Decreases the difference to Anton Khirnovs patch v5
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/hevc_ps.c')
-rw-r--r-- | libavcodec/hevc_ps.c | 31 |
1 files changed, 15 insertions, 16 deletions
diff --git a/libavcodec/hevc_ps.c b/libavcodec/hevc_ps.c index 632d9eaf3e..4342ff2003 100644 --- a/libavcodec/hevc_ps.c +++ b/libavcodec/hevc_ps.c @@ -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: |