diff options
author | Clément Bœsch <u@pkh.me> | 2016-06-18 14:04:17 +0200 |
---|---|---|
committer | Clément Bœsch <u@pkh.me> | 2016-06-18 14:04:55 +0200 |
commit | 5584f019b5ebb943cd45f848e88f9e59c03f2b41 (patch) | |
tree | 1ada491eab70f85d6df4c594a7d2a262b1735f5d /libavcodec/h264_parser.c | |
parent | 403a53c60e7c6046467ca078ca78210312879e14 (diff) | |
parent | 728d90a0c1973661a9e73da697bf4f90c9d19577 (diff) | |
download | ffmpeg-5584f019b5ebb943cd45f848e88f9e59c03f2b41.tar.gz |
Merge commit '728d90a0c1973661a9e73da697bf4f90c9d19577'
* commit '728d90a0c1973661a9e73da697bf4f90c9d19577':
h264: decouple h264_sei from the h264 decoder
Main changes:
- SEI decoding doesn't have access to the debug flag in the codec context so a
few logging are dropped.
- naming of quincunx_sampling_flag and frame_packing_arrangement_type are kept
as they are in FFmpeg instead of respectively quincunx_subsampling and
arrangement_type used in Libav because the former match the specifications.
- don't reset the x264 build info once read in order to fix
fate-h264-lossless (change by Hendrik)
- H264Context.has_recovery_point and deprecated
AVCodecContext.dtg_active_format are set after ff_h264_sei_decode()
based on the SEI state since ff_h264_sei_decode() doesn't have access
to H264Context anymore.
- frame_packing_arrangement_type is not checked against <= 0 in
decode_postinit() since it is always read as a positive value with
get_bits(). This fixes a -Wtype-limits warning by GCC spotted by
Michael.
Side Notes:
- tested that ffprobe on the file from ticket #3652 still returns 4
keyframes
- tested that playback from ticket #3063 still works
Merged-by: Clément Bœsch <clement@stupeflix.com>
Signed-off-by: Hendrik Leppkes <h.leppkes@gmail.com>
Diffstat (limited to 'libavcodec/h264_parser.c')
-rw-r--r-- | libavcodec/h264_parser.c | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/libavcodec/h264_parser.c b/libavcodec/h264_parser.c index e0977ea785..9fccdc98bc 100644 --- a/libavcodec/h264_parser.c +++ b/libavcodec/h264_parser.c @@ -39,6 +39,7 @@ #include "get_bits.h" #include "golomb.h" #include "h264.h" +#include "h264_sei.h" #include "h264data.h" #include "internal.h" #include "mpegutils.h" @@ -50,6 +51,7 @@ typedef struct H264ParseContext { H264ParamSets ps; H264DSPContext h264dsp; H264POCContext poc; + H264SEIContext sei; int got_first; } H264ParseContext; @@ -249,8 +251,8 @@ static inline int parse_nal_units(AVCodecParserContext *s, s->picture_structure = AV_PICTURE_STRUCTURE_UNKNOWN; h->avctx = avctx; - ff_h264_reset_sei(h); - h->sei_fpa.frame_packing_arrangement_cancel_flag = -1; + ff_h264_sei_uninit(&p->sei); + h->sei.frame_packing.frame_packing_arrangement_cancel_flag = -1; if (!buf_size) return 0; @@ -318,12 +320,7 @@ static inline int parse_nal_units(AVCodecParserContext *s, nal.size_bits); break; case NAL_SEI: - { - H264ParamSets ps = h->ps; - h->ps = p->ps; - ff_h264_decode_sei(h); - h->ps = ps; - } + ff_h264_sei_decode(&p->sei, &nal.gb, &p->ps, avctx); break; case NAL_IDR_SLICE: s->key_frame = 1; @@ -337,7 +334,7 @@ static inline int parse_nal_units(AVCodecParserContext *s, get_ue_golomb_long(&nal.gb); // skip first_mb_in_slice slice_type = get_ue_golomb_31(&nal.gb); s->pict_type = ff_h264_golomb_to_pict_type[slice_type % 5]; - if (h->sei_recovery_frame_cnt >= 0) { + if (p->sei.recovery_point.recovery_frame_cnt >= 0) { /* key frame, since recovery_frame_cnt is set */ s->key_frame = 1; } @@ -462,7 +459,7 @@ static inline int parse_nal_units(AVCodecParserContext *s, } if (sps->pic_struct_present_flag) { - switch (h->sei_pic_struct) { + switch (p->sei.picture_timing.pic_struct) { case SEI_PIC_STRUCT_TOP_FIELD: case SEI_PIC_STRUCT_BOTTOM_FIELD: s->repeat_pict = 0; @@ -493,7 +490,7 @@ static inline int parse_nal_units(AVCodecParserContext *s, if (h->picture_structure == PICT_FRAME) { s->picture_structure = AV_PICTURE_STRUCTURE_FRAME; if (sps->pic_struct_present_flag) { - switch (h->sei_pic_struct) { + switch (p->sei.picture_timing.pic_struct) { case SEI_PIC_STRUCT_TOP_BOTTOM: case SEI_PIC_STRUCT_TOP_BOTTOM_TOP: s->field_order = AV_FIELD_TT; @@ -603,10 +600,10 @@ static int h264_parse(AVCodecParserContext *s, if (avctx->framerate.num) avctx->time_base = av_inv_q(av_mul_q(avctx->framerate, (AVRational){avctx->ticks_per_frame, 1})); - if (h->sei_cpb_removal_delay >= 0) { - s->dts_sync_point = h->sei_buffering_period_present; - s->dts_ref_dts_delta = h->sei_cpb_removal_delay; - s->pts_dts_delta = h->sei_dpb_output_delay; + if (p->sei.picture_timing.cpb_removal_delay >= 0) { + s->dts_sync_point = p->sei.buffering_period.present; + s->dts_ref_dts_delta = p->sei.picture_timing.cpb_removal_delay; + s->pts_dts_delta = p->sei.picture_timing.dpb_output_delay; } else { s->dts_sync_point = INT_MIN; s->dts_ref_dts_delta = INT_MIN; @@ -669,6 +666,8 @@ static void h264_close(AVCodecParserContext *s) av_freep(&pc->buffer); ff_h264_free_context(h); + ff_h264_sei_uninit(&p->sei); + for (i = 0; i < FF_ARRAY_ELEMS(p->ps.sps_list); i++) av_buffer_unref(&p->ps.sps_list[i]); |