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.h | |
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.h')
-rw-r--r-- | libavcodec/h264.h | 156 |
1 files changed, 3 insertions, 153 deletions
diff --git a/libavcodec/h264.h b/libavcodec/h264.h index b156805128..ba6f43c6a2 100644 --- a/libavcodec/h264.h +++ b/libavcodec/h264.h @@ -35,6 +35,7 @@ #include "error_resilience.h" #include "get_bits.h" #include "h264_parse.h" +#include "h264_sei.h" #include "h2645_parse.h" #include "h264chroma.h" #include "h264dsp.h" @@ -131,48 +132,6 @@ enum { }; /** - * SEI message types - */ -typedef enum { - SEI_TYPE_BUFFERING_PERIOD = 0, ///< buffering period (H.264, D.1.1) - SEI_TYPE_PIC_TIMING = 1, ///< picture timing - SEI_TYPE_USER_DATA_REGISTERED = 4, ///< registered user data as specified by Rec. ITU-T T.35 - SEI_TYPE_USER_DATA_UNREGISTERED = 5, ///< unregistered user data - SEI_TYPE_RECOVERY_POINT = 6, ///< recovery point (frame # to decoder sync) - SEI_TYPE_FRAME_PACKING = 45, ///< frame packing arrangement - SEI_TYPE_DISPLAY_ORIENTATION = 47, ///< display orientation - SEI_TYPE_GREEN_METADATA = 56 ///< GreenMPEG information -} SEI_Type; - -/** - * pic_struct in picture timing SEI message - */ -typedef enum { - SEI_PIC_STRUCT_FRAME = 0, ///< 0: %frame - SEI_PIC_STRUCT_TOP_FIELD = 1, ///< 1: top field - SEI_PIC_STRUCT_BOTTOM_FIELD = 2, ///< 2: bottom field - SEI_PIC_STRUCT_TOP_BOTTOM = 3, ///< 3: top field, bottom field, in that order - SEI_PIC_STRUCT_BOTTOM_TOP = 4, ///< 4: bottom field, top field, in that order - SEI_PIC_STRUCT_TOP_BOTTOM_TOP = 5, ///< 5: top field, bottom field, top field repeated, in that order - SEI_PIC_STRUCT_BOTTOM_TOP_BOTTOM = 6, ///< 6: bottom field, top field, bottom field repeated, in that order - SEI_PIC_STRUCT_FRAME_DOUBLING = 7, ///< 7: %frame doubling - SEI_PIC_STRUCT_FRAME_TRIPLING = 8 ///< 8: %frame tripling -} SEI_PicStructType; - -/** - * frame_packing_arrangement types - */ -typedef enum { - SEI_FPA_TYPE_CHECKERBOARD = 0, - SEI_FPA_TYPE_INTERLEAVE_COLUMN = 1, - SEI_FPA_TYPE_INTERLEAVE_ROW = 2, - SEI_FPA_TYPE_SIDE_BY_SIDE = 3, - SEI_FPA_TYPE_TOP_BOTTOM = 4, - SEI_FPA_TYPE_INTERLEAVE_TEMPORAL = 5, - SEI_FPA_TYPE_2D = 6, -} SEI_FpaType; - -/** * Sequence parameter set */ typedef struct SPS { @@ -281,34 +240,6 @@ typedef struct H264ParamSets { } H264ParamSets; /** - * Frame Packing Arrangement Type - */ -typedef struct FPA { - int frame_packing_arrangement_id; - int frame_packing_arrangement_cancel_flag; ///< is previous arrangement canceled, -1 if never received - SEI_FpaType frame_packing_arrangement_type; - int frame_packing_arrangement_repetition_period; - int content_interpretation_type; - int quincunx_sampling_flag; -} FPA; - -/** - * Green MetaData Information Type - */ -typedef struct H264SEIGreenMetaData { - uint8_t green_metadata_type; - uint8_t period_type; - uint16_t num_seconds; - uint16_t num_pictures; - uint8_t percent_non_zero_macroblocks; - uint8_t percent_intra_coded_macroblocks; - uint8_t percent_six_tap_filtering; - uint8_t percent_alpha_point_deblocking_instance; - uint8_t xsd_metric_type; - uint16_t xsd_metric_value; -} H264SEIGreenMetaData; - -/** * Memory management control operation opcode. */ typedef enum MMCOOpcode { @@ -622,8 +553,6 @@ typedef struct H264Context { uint8_t field_scan8x8_q0[64]; uint8_t field_scan8x8_cavlc_q0[64]; - int x264_build; - int mb_y; int mb_height, mb_width; int mb_stride; @@ -708,11 +637,6 @@ typedef struct H264Context { /** @} */ /** - * pic_struct in picture timing SEI message - */ - SEI_PicStructType sei_pic_struct; - - /** * Complement sei_pic_struct * SEI_PIC_STRUCT_TOP_BOTTOM and SEI_PIC_STRUCT_BOTTOM_TOP indicate interlaced frames. * However, soft telecined frames may have these values. @@ -721,61 +645,10 @@ typedef struct H264Context { int prev_interlaced_frame; /** - * frame_packing_arrangment SEI message - */ - int sei_frame_packing_present; - int frame_packing_arrangement_type; - int content_interpretation_type; - int quincunx_subsampling; - - /** - * display orientation SEI message - */ - int sei_display_orientation_present; - int sei_anticlockwise_rotation; - int sei_hflip, sei_vflip; - - /** - * User data registered by Rec. ITU-T T.35 SEI - */ - int sei_reguserdata_afd_present; - uint8_t active_format_description; - int a53_caption_size; - uint8_t *a53_caption; - - /** - * Bit set of clock types for fields/frames in picture timing SEI message. - * For each found ct_type, appropriate bit is set (e.g., bit 1 for - * interlaced). - */ - int sei_ct_type; - - /** - * dpb_output_delay in picture timing SEI message, see H.264 C.2.2 - */ - int sei_dpb_output_delay; - - /** - * cpb_removal_delay in picture timing SEI message, see H.264 C.1.2 - */ - int sei_cpb_removal_delay; - - /** - * recovery_frame_cnt from SEI message - * - * Set to -1 if no recovery point SEI message found or to number of frames - * before playback synchronizes. Frames having recovery point are key - * frames. - */ - int sei_recovery_frame_cnt; - - /** * Are the SEI recovery points looking valid. */ int valid_recovery_point; - FPA sei_fpa; - /** * recovery_frame is the frame_num at which the next frame should * be fully constructed. @@ -807,10 +680,6 @@ typedef struct H264Context { * slices) anymore */ int setup_finished; - // Timestamp stuff - int sei_buffering_period_present; ///< Buffering period SEI flag - int initial_cpb_removal_delay[32]; ///< Initial timestamps for CPBs - int cur_chroma_format_idc; int cur_bit_depth_luma; int16_t slice_row[MAX_SLICES]; ///< to detect when MAX_SLICES is too low @@ -821,6 +690,8 @@ typedef struct H264Context { int enable_er; + H264SEIContext sei; + AVBufferPool *qscale_table_pool; AVBufferPool *mb_type_pool; AVBufferPool *motion_val_pool; @@ -830,19 +701,11 @@ typedef struct H264Context { qpel_mc_func (*qpel_put)[16]; qpel_mc_func (*qpel_avg)[16]; - /*Green Metadata */ - H264SEIGreenMetaData sei_green_metadata; - } H264Context; extern const uint16_t ff_h264_mb_sizes[4]; /** - * Decode SEI - */ -int ff_h264_decode_sei(H264Context *h); - -/** * Decode SPS */ int ff_h264_decode_seq_parameter_set(GetBitContext *gb, AVCodecContext *avctx, @@ -921,19 +784,6 @@ void ff_h264_filter_mb(const H264Context *h, H264SliceContext *sl, int mb_x, int uint8_t *img_y, uint8_t *img_cb, uint8_t *img_cr, unsigned int linesize, unsigned int uvlinesize); -/** - * Reset SEI values at the beginning of the frame. - * - * @param h H.264 context. - */ -void ff_h264_reset_sei(H264Context *h); - -/** - * Get stereo_mode string from the h264 frame_packing_arrangement - * @param h H.264 context. - */ -const char* ff_h264_sei_stereo_mode(H264Context *h); - /* * o-o o-o * / / / |