diff options
author | Mark Thompson <sw@jkqxz.net> | 2018-02-21 22:41:00 +0000 |
---|---|---|
committer | Mark Thompson <sw@jkqxz.net> | 2018-02-21 22:41:00 +0000 |
commit | ab6edb173b365d9a787c2df3a45e3a018d7843d7 (patch) | |
tree | be0599167db492596c55418f0b2e841b50efab7d | |
parent | 7386b4ff39506b7a34b3689cc4b05993ed9b4a4f (diff) | |
parent | 7157d959264f3729da463725c6faa580d9394d19 (diff) | |
download | ffmpeg-ab6edb173b365d9a787c2df3a45e3a018d7843d7.tar.gz |
Merge commit '7157d959264f3729da463725c6faa580d9394d19'
* commit '7157d959264f3729da463725c6faa580d9394d19':
cbs_h264: Move slice_group_id array out of PPS structure
Merged-by: Mark Thompson <sw@jkqxz.net>
-rw-r--r-- | libavcodec/cbs_h264.h | 4 | ||||
-rw-r--r-- | libavcodec/cbs_h2645.c | 10 | ||||
-rw-r--r-- | libavcodec/cbs_h264_syntax_template.c | 3 |
3 files changed, 15 insertions, 2 deletions
diff --git a/libavcodec/cbs_h264.h b/libavcodec/cbs_h264.h index ae39fc7040..11dce87103 100644 --- a/libavcodec/cbs_h264.h +++ b/libavcodec/cbs_h264.h @@ -195,7 +195,9 @@ typedef struct H264RawPPS { uint8_t slice_group_change_direction_flag; uint16_t slice_group_change_rate_minus1; uint16_t pic_size_in_map_units_minus1; - uint8_t slice_group_id[H264_MAX_MB_PIC_SIZE]; + + uint8_t *slice_group_id; + AVBufferRef *slice_group_id_ref; uint8_t num_ref_idx_l0_default_active_minus1; uint8_t num_ref_idx_l1_default_active_minus1; diff --git a/libavcodec/cbs_h2645.c b/libavcodec/cbs_h2645.c index 8c3705b6e1..b717937e4a 100644 --- a/libavcodec/cbs_h2645.c +++ b/libavcodec/cbs_h2645.c @@ -394,6 +394,13 @@ static int cbs_h2645_read_more_rbsp_data(GetBitContext *gbc) #undef allocate +static void cbs_h264_free_pps(void *unit, uint8_t *content) +{ + H264RawPPS *pps = (H264RawPPS*)content; + av_buffer_unref(&pps->slice_group_id_ref); + av_freep(&content); +} + static void cbs_h264_free_sei_payload(H264RawSEIPayload *payload) { switch (payload->payload_type) { @@ -725,7 +732,8 @@ static int cbs_h264_read_nal_unit(CodedBitstreamContext *ctx, { H264RawPPS *pps; - err = ff_cbs_alloc_unit_content(ctx, unit, sizeof(*pps), NULL); + err = ff_cbs_alloc_unit_content(ctx, unit, sizeof(*pps), + &cbs_h264_free_pps); if (err < 0) return err; pps = unit->content; diff --git a/libavcodec/cbs_h264_syntax_template.c b/libavcodec/cbs_h264_syntax_template.c index 267f35ccb7..05370b81fa 100644 --- a/libavcodec/cbs_h264_syntax_template.c +++ b/libavcodec/cbs_h264_syntax_template.c @@ -404,6 +404,9 @@ static int FUNC(pps)(CodedBitstreamContext *ctx, RWContext *rw, ue(slice_group_change_rate_minus1, 0, pic_size - 1); } else if (current->slice_group_map_type == 6) { ue(pic_size_in_map_units_minus1, pic_size - 1, pic_size - 1); + + allocate(current->slice_group_id, + current->pic_size_in_map_units_minus1 + 1); for (i = 0; i <= current->pic_size_in_map_units_minus1; i++) u(av_log2(2 * current->num_slice_groups_minus1 + 1), slice_group_id[i], 0, current->num_slice_groups_minus1); |