| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | /* | ||
| 2 | * HEVC Supplementary Enhancement Information messages | ||
| 3 | * | ||
| 4 | * This file is part of FFmpeg. | ||
| 5 | * | ||
| 6 | * FFmpeg is free software; you can redistribute it and/or | ||
| 7 | * modify it under the terms of the GNU Lesser General Public | ||
| 8 | * License as published by the Free Software Foundation; either | ||
| 9 | * version 2.1 of the License, or (at your option) any later version. | ||
| 10 | * | ||
| 11 | * FFmpeg is distributed in the hope that it will be useful, | ||
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| 14 | * Lesser General Public License for more details. | ||
| 15 | * | ||
| 16 | * You should have received a copy of the GNU Lesser General Public | ||
| 17 | * License along with FFmpeg; if not, write to the Free Software | ||
| 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||
| 19 | */ | ||
| 20 | |||
| 21 | #ifndef AVCODEC_HEVC_SEI_H | ||
| 22 | #define AVCODEC_HEVC_SEI_H | ||
| 23 | |||
| 24 | #include <stdint.h> | ||
| 25 | |||
| 26 | #include "libavutil/buffer.h" | ||
| 27 | |||
| 28 | #include "libavcodec/get_bits.h" | ||
| 29 | #include "libavcodec/h2645_sei.h" | ||
| 30 | #include "libavcodec/sei.h" | ||
| 31 | |||
| 32 | #include "hevc.h" | ||
| 33 | |||
| 34 | |||
| 35 | typedef enum { | ||
| 36 | HEVC_SEI_PIC_STRUCT_FRAME_DOUBLING = 7, | ||
| 37 | HEVC_SEI_PIC_STRUCT_FRAME_TRIPLING = 8 | ||
| 38 | } HEVC_SEI_PicStructType; | ||
| 39 | |||
| 40 | typedef struct HEVCSEIPictureHash { | ||
| 41 | uint8_t md5[3][16]; | ||
| 42 | uint8_t is_md5; | ||
| 43 | } HEVCSEIPictureHash; | ||
| 44 | |||
| 45 | typedef struct HEVCSEIFramePacking { | ||
| 46 | int present; | ||
| 47 | int arrangement_type; | ||
| 48 | int content_interpretation_type; | ||
| 49 | int quincunx_subsampling; | ||
| 50 | int current_frame_is_frame0_flag; | ||
| 51 | } HEVCSEIFramePacking; | ||
| 52 | |||
| 53 | typedef struct HEVCSEIPictureTiming { | ||
| 54 | int picture_struct; | ||
| 55 | } HEVCSEIPictureTiming; | ||
| 56 | |||
| 57 | typedef struct HEVCSEIAlternativeTransfer { | ||
| 58 | int present; | ||
| 59 | int preferred_transfer_characteristics; | ||
| 60 | } HEVCSEIAlternativeTransfer; | ||
| 61 | |||
| 62 | typedef struct HEVCSEITimeCode { | ||
| 63 | int present; | ||
| 64 | uint8_t num_clock_ts; | ||
| 65 | uint8_t clock_timestamp_flag[3]; | ||
| 66 | uint8_t units_field_based_flag[3]; | ||
| 67 | uint8_t counting_type[3]; | ||
| 68 | uint8_t full_timestamp_flag[3]; | ||
| 69 | uint8_t discontinuity_flag[3]; | ||
| 70 | uint8_t cnt_dropped_flag[3]; | ||
| 71 | uint16_t n_frames[3]; | ||
| 72 | uint8_t seconds_value[3]; | ||
| 73 | uint8_t minutes_value[3]; | ||
| 74 | uint8_t hours_value[3]; | ||
| 75 | uint8_t seconds_flag[3]; | ||
| 76 | uint8_t minutes_flag[3]; | ||
| 77 | uint8_t hours_flag[3]; | ||
| 78 | uint8_t time_offset_length[3]; | ||
| 79 | int32_t time_offset_value[3]; | ||
| 80 | } HEVCSEITimeCode; | ||
| 81 | |||
| 82 | typedef struct HEVCSEITDRDI { | ||
| 83 | uint8_t prec_ref_display_width; | ||
| 84 | uint8_t ref_viewing_distance_flag; | ||
| 85 | uint8_t prec_ref_viewing_dist; | ||
| 86 | uint8_t num_ref_displays; | ||
| 87 | uint16_t left_view_id[32]; | ||
| 88 | uint16_t right_view_id[32]; | ||
| 89 | uint8_t exponent_ref_display_width[32]; | ||
| 90 | uint8_t mantissa_ref_display_width[32]; | ||
| 91 | uint8_t exponent_ref_viewing_distance[32]; | ||
| 92 | uint8_t mantissa_ref_viewing_distance[32]; | ||
| 93 | uint8_t additional_shift_present_flag[32]; | ||
| 94 | int16_t num_sample_shift[32]; | ||
| 95 | uint8_t three_dimensional_reference_displays_extension_flag; | ||
| 96 | int present; | ||
| 97 | } HEVCSEITDRDI; | ||
| 98 | |||
| 99 | typedef struct HEVCSEIRecoveryPoint { | ||
| 100 | int16_t recovery_poc_cnt; | ||
| 101 | uint8_t exact_match_flag; | ||
| 102 | uint8_t broken_link_flag; | ||
| 103 | uint8_t has_recovery_poc; | ||
| 104 | } HEVCSEIRecoveryPoint; | ||
| 105 | |||
| 106 | typedef struct HEVCSEI { | ||
| 107 | H2645SEI common; | ||
| 108 | HEVCSEIPictureHash picture_hash; | ||
| 109 | HEVCSEIPictureTiming picture_timing; | ||
| 110 | int active_seq_parameter_set_id; | ||
| 111 | HEVCSEITimeCode timecode; | ||
| 112 | HEVCSEITDRDI tdrdi; | ||
| 113 | HEVCSEIRecoveryPoint recovery_point; | ||
| 114 | } HEVCSEI; | ||
| 115 | |||
| 116 | struct HEVCParamSets; | ||
| 117 | |||
| 118 | int ff_hevc_decode_nal_sei(GetBitContext *gb, void *logctx, HEVCSEI *s, | ||
| 119 | const struct HEVCParamSets *ps, enum HEVCNALUnitType type); | ||
| 120 | |||
| 121 | /** | ||
| 122 | * Reset SEI values that are stored on the Context. | ||
| 123 | * e.g. Caption data that was extracted during NAL | ||
| 124 | * parsing. | ||
| 125 | * | ||
| 126 | * @param sei HEVCSEI. | ||
| 127 | */ | ||
| 128 | 13823 | static inline void ff_hevc_reset_sei(HEVCSEI *sei) | |
| 129 | { | ||
| 130 | 13823 | sei->timecode.present = 0; | |
| 131 | 13823 | sei->tdrdi.present = 0; | |
| 132 | 13823 | ff_h2645_sei_reset(&sei->common); | |
| 133 | 13823 | } | |
| 134 | |||
| 135 | #endif /* AVCODEC_HEVC_SEI_H */ | ||
| 136 |