diff options
author | James Almer <jamrial@gmail.com> | 2017-03-23 14:27:48 -0300 |
---|---|---|
committer | James Almer <jamrial@gmail.com> | 2017-03-23 14:27:48 -0300 |
commit | 6397815be0bee10948387fcb90ead36ec2834ef7 (patch) | |
tree | e616efad05f1147821dd80f88dae04707d795193 /libavcodec/hevcdec.c | |
parent | a1a80a6c9ce5309632a8b5c0241fa5ffcd09b5fc (diff) | |
parent | c359d624d3efc3fd1d83210d78c4152bd329b765 (diff) |
Merge commit 'c359d624d3efc3fd1d83210d78c4152bd329b765'
* commit 'c359d624d3efc3fd1d83210d78c4152bd329b765':
hevcdec: move decoder-independent declarations into a separate header
Merged-by: James Almer <jamrial@gmail.com>
Diffstat (limited to 'libavcodec/hevcdec.c')
-rw-r--r-- | libavcodec/hevcdec.c | 83 |
1 files changed, 42 insertions, 41 deletions
diff --git a/libavcodec/hevcdec.c b/libavcodec/hevcdec.c index 8893648e0a..aa54142da2 100644 --- a/libavcodec/hevcdec.c +++ b/libavcodec/hevcdec.c @@ -37,6 +37,7 @@ #include "bytestream.h" #include "cabac_functions.h" #include "golomb.h" +#include "hevc.h" #include "hevcdec.h" #include "profiles.h" @@ -443,7 +444,7 @@ static int hls_slice_header(HEVCContext *s) sh->no_output_of_prior_pics_flag = get_bits1(gb); sh->pps_id = get_ue_golomb_long(gb); - if (sh->pps_id >= MAX_PPS_COUNT || !s->ps.pps_list[sh->pps_id]) { + if (sh->pps_id >= HEVC_MAX_PPS_COUNT || !s->ps.pps_list[sh->pps_id]) { av_log(s->avctx, AV_LOG_ERROR, "PPS id out of range: %d\n", sh->pps_id); return AVERROR_INVALIDDATA; } @@ -453,13 +454,13 @@ static int hls_slice_header(HEVCContext *s) return AVERROR_INVALIDDATA; } s->ps.pps = (HEVCPPS*)s->ps.pps_list[sh->pps_id]->data; - if (s->nal_unit_type == NAL_CRA_NUT && s->last_eos == 1) + if (s->nal_unit_type == HEVC_NAL_CRA_NUT && s->last_eos == 1) sh->no_output_of_prior_pics_flag = 1; if (s->ps.sps != (HEVCSPS*)s->ps.sps_list[s->ps.pps->sps_id]->data) { const HEVCSPS* last_sps = s->ps.sps; s->ps.sps = (HEVCSPS*)s->ps.sps_list[s->ps.pps->sps_id]->data; - if (last_sps && IS_IRAP(s) && s->nal_unit_type != NAL_CRA_NUT) { + if (last_sps && IS_IRAP(s) && s->nal_unit_type != HEVC_NAL_CRA_NUT) { if (s->ps.sps->width != last_sps->width || s->ps.sps->height != last_sps->height || s->ps.sps->temporal_layer[s->ps.sps->max_sub_layers - 1].max_dec_pic_buffering != last_sps->temporal_layer[last_sps->max_sub_layers - 1].max_dec_pic_buffering) @@ -584,13 +585,13 @@ static int hls_slice_header(HEVCContext *s) /* 8.3.1 */ if (s->temporal_id == 0 && - s->nal_unit_type != NAL_TRAIL_N && - s->nal_unit_type != NAL_TSA_N && - s->nal_unit_type != NAL_STSA_N && - s->nal_unit_type != NAL_RADL_N && - s->nal_unit_type != NAL_RADL_R && - s->nal_unit_type != NAL_RASL_N && - s->nal_unit_type != NAL_RASL_R) + s->nal_unit_type != HEVC_NAL_TRAIL_N && + s->nal_unit_type != HEVC_NAL_TSA_N && + s->nal_unit_type != HEVC_NAL_STSA_N && + s->nal_unit_type != HEVC_NAL_RADL_N && + s->nal_unit_type != HEVC_NAL_RADL_R && + s->nal_unit_type != HEVC_NAL_RASL_N && + s->nal_unit_type != HEVC_NAL_RASL_R) s->pocTid0 = s->poc; if (s->ps.sps->sao_enabled) { @@ -824,7 +825,7 @@ static int hls_slice_header(HEVCContext *s) s->HEVClc->tu.cu_qp_offset_cb = 0; s->HEVClc->tu.cu_qp_offset_cr = 0; - s->no_rasl_output_flag = IS_IDR(s) || IS_BLA(s) || (s->nal_unit_type == NAL_CRA_NUT && s->last_eos); + s->no_rasl_output_flag = IS_IDR(s) || IS_BLA(s) || (s->nal_unit_type == HEVC_NAL_CRA_NUT && s->last_eos); return 0; } @@ -2727,50 +2728,50 @@ static int decode_nal_unit(HEVCContext *s, const H2645NAL *nal) s->temporal_id = nal->temporal_id; switch (s->nal_unit_type) { - case NAL_VPS: + case HEVC_NAL_VPS: ret = ff_hevc_decode_nal_vps(gb, s->avctx, &s->ps); if (ret < 0) goto fail; break; - case NAL_SPS: + case HEVC_NAL_SPS: ret = ff_hevc_decode_nal_sps(gb, s->avctx, &s->ps, s->apply_defdispwin); if (ret < 0) goto fail; break; - case NAL_PPS: + case HEVC_NAL_PPS: ret = ff_hevc_decode_nal_pps(gb, s->avctx, &s->ps); if (ret < 0) goto fail; break; - case NAL_SEI_PREFIX: - case NAL_SEI_SUFFIX: + case HEVC_NAL_SEI_PREFIX: + case HEVC_NAL_SEI_SUFFIX: ret = ff_hevc_decode_nal_sei(s); if (ret < 0) goto fail; break; - case NAL_TRAIL_R: - case NAL_TRAIL_N: - case NAL_TSA_N: - case NAL_TSA_R: - case NAL_STSA_N: - case NAL_STSA_R: - case NAL_BLA_W_LP: - case NAL_BLA_W_RADL: - case NAL_BLA_N_LP: - case NAL_IDR_W_RADL: - case NAL_IDR_N_LP: - case NAL_CRA_NUT: - case NAL_RADL_N: - case NAL_RADL_R: - case NAL_RASL_N: - case NAL_RASL_R: + case HEVC_NAL_TRAIL_R: + case HEVC_NAL_TRAIL_N: + case HEVC_NAL_TSA_N: + case HEVC_NAL_TSA_R: + case HEVC_NAL_STSA_N: + case HEVC_NAL_STSA_R: + case HEVC_NAL_BLA_W_LP: + case HEVC_NAL_BLA_W_RADL: + case HEVC_NAL_BLA_N_LP: + case HEVC_NAL_IDR_W_RADL: + case HEVC_NAL_IDR_N_LP: + case HEVC_NAL_CRA_NUT: + case HEVC_NAL_RADL_N: + case HEVC_NAL_RADL_R: + case HEVC_NAL_RASL_N: + case HEVC_NAL_RASL_R: ret = hls_slice_header(s); if (ret < 0) return ret; if (s->max_ra == INT_MAX) { - if (s->nal_unit_type == NAL_CRA_NUT || IS_BLA(s)) { + if (s->nal_unit_type == HEVC_NAL_CRA_NUT || IS_BLA(s)) { s->max_ra = s->poc; } else { if (IS_IDR(s)) @@ -2778,12 +2779,12 @@ static int decode_nal_unit(HEVCContext *s, const H2645NAL *nal) } } - if ((s->nal_unit_type == NAL_RASL_R || s->nal_unit_type == NAL_RASL_N) && + if ((s->nal_unit_type == HEVC_NAL_RASL_R || s->nal_unit_type == HEVC_NAL_RASL_N) && s->poc <= s->max_ra) { s->is_decoded = 0; break; } else { - if (s->nal_unit_type == NAL_RASL_R && s->poc > s->max_ra) + if (s->nal_unit_type == HEVC_NAL_RASL_R && s->poc > s->max_ra) s->max_ra = INT_MIN; } @@ -2838,13 +2839,13 @@ static int decode_nal_unit(HEVCContext *s, const H2645NAL *nal) } } break; - case NAL_EOS_NUT: - case NAL_EOB_NUT: + case HEVC_NAL_EOS_NUT: + case HEVC_NAL_EOB_NUT: s->seq_decode = (s->seq_decode + 1) & 0xff; s->max_ra = INT_MAX; break; - case NAL_AUD: - case NAL_FD_NUT: + case HEVC_NAL_AUD: + case HEVC_NAL_FD_NUT: break; default: av_log(s->avctx, AV_LOG_INFO, @@ -2877,8 +2878,8 @@ static int decode_nal_units(HEVCContext *s, const uint8_t *buf, int length) } for (i = 0; i < s->pkt.nb_nals; i++) { - if (s->pkt.nals[i].type == NAL_EOB_NUT || - s->pkt.nals[i].type == NAL_EOS_NUT) + if (s->pkt.nals[i].type == HEVC_NAL_EOB_NUT || + s->pkt.nals[i].type == HEVC_NAL_EOS_NUT) s->eos = 1; } |