Unified · Split
| @@ -293,6 +293,26 @@ typedef struct H264RawFilmGrainCharacteristics { · 292 unmodified lines | ||
| 293 | 293 | uint8_t film_grain_characteristics_repetition_period; |
| 294 | 294 | } H264RawFilmGrainCharacteristics; |
| 295 | 295 | |
| 296 | +typedef struct H264RawSEIFramePackingArrangement { | |
| 297 | + uint32_t frame_packing_arrangement_id; | |
| 298 | + uint8_t frame_packing_arrangement_cancel_flag; | |
| 299 | + uint8_t frame_packing_arrangement_type; | |
| 300 | + uint8_t quincunx_sampling_flag; | |
| 301 | + uint8_t content_interpretation_type; | |
| 302 | + uint8_t spatial_flipping_flag; | |
| 303 | + uint8_t frame0_flipped_flag; | |
| 304 | + uint8_t field_views_flag; | |
| 305 | + uint8_t current_frame_is_frame0_flag; | |
| 306 | + uint8_t frame0_self_contained_flag; | |
| 307 | + uint8_t frame1_self_contained_flag; | |
| 308 | + uint8_t frame0_grid_position_x; | |
| 309 | + uint8_t frame0_grid_position_y; | |
| 310 | + uint8_t frame1_grid_position_x; | |
| 311 | + uint8_t frame1_grid_position_y; | |
| 312 | + uint16_t frame_packing_arrangement_repetition_period; | |
| 313 | + uint8_t frame_packing_arrangement_extension_flag; | |
| 314 | +} H264RawSEIFramePackingArrangement; | |
| 315 | + | |
| 296 | 316 | typedef struct H264RawSEIDisplayOrientation { |
| 297 | 317 | uint8_t display_orientation_cancel_flag; |
| 298 | 318 | uint8_t hor_flip; |
| @@ -2128,6 +2128,12 @@ static const SEIMessageTypeDescriptor cbs_sei_common_types[] = { · 2127 unmodified lines | ||
| 2128 | 2128 | sizeof(SEIRawUserDataUnregistered), |
| 2129 | 2129 | SEI_MESSAGE_RW(sei, user_data_unregistered), |
| 2130 | 2130 | }, |
| 2131 | + { | |
| 2132 | + SEI_TYPE_FRAME_PACKING_ARRANGEMENT, | |
| 2133 | + 1, 0, | |
| 2134 | + sizeof(SEIRawFramePackingArrangement), | |
| 2135 | + SEI_MESSAGE_RW(sei, frame_packing_arrangement), | |
| 2136 | + }, | |
| 2131 | 2137 | { |
| 2132 | 2138 | SEI_TYPE_MASTERING_DISPLAY_COLOUR_VOLUME, |
| 2133 | 2139 | 1, 0, |
| @@ -2186,6 +2192,12 @@ static const SEIMessageTypeDescriptor cbs_sei_h264_types[] = { · 52 unmodified lines | ||
| 2186 | 2192 | sizeof(H264RawFilmGrainCharacteristics), |
| 2187 | 2193 | SEI_MESSAGE_RW(h264, film_grain_characteristics), |
| 2188 | 2194 | }, |
| 2195 | + { | |
| 2196 | + SEI_TYPE_FRAME_PACKING_ARRANGEMENT, | |
| 2197 | + 1, 0, | |
| 2198 | + sizeof(H264RawSEIFramePackingArrangement), | |
| 2199 | + SEI_MESSAGE_RW(h264, sei_frame_packing_arrangement), | |
| 2200 | + }, | |
| 2189 | 2201 | { |
| 2190 | 2202 | SEI_TYPE_DISPLAY_ORIENTATION, |
| 2191 | 2203 | 1, 0, |
| @@ -2275,11 +2287,6 @@ const SEIMessageTypeDescriptor *ff_cbs_sei_find_type(CodedBitstreamContext *ctx, · 83 unmodified lines | ||
| 2275 | 2287 | const SEIMessageTypeDescriptor *codec_list; |
| 2276 | 2288 | int i; |
| 2277 | 2289 | |
| 2278 | − for (i = 0; cbs_sei_common_types[i].type >= 0; i++) { | |
| 2279 | − if (cbs_sei_common_types[i].type == payload_type) | |
| 2280 | − return &cbs_sei_common_types[i]; | |
| 2281 | − } | |
| 2282 | − | |
| 2283 | 2290 | switch (ctx->codec->codec_id) { |
| 2284 | 2291 | case AV_CODEC_ID_H264: |
| 2285 | 2292 | codec_list = cbs_sei_h264_types; |
| @@ -2299,5 +2306,10 @@ const SEIMessageTypeDescriptor *ff_cbs_sei_find_type(CodedBitstreamContext *ctx, · 13 unmodified lines | ||
| 2299 | 2306 | return &codec_list[i]; |
| 2300 | 2307 | } |
| 2301 | 2308 | |
| 2309 | + for (i = 0; cbs_sei_common_types[i].type >= 0; i++) { | |
| 2310 | + if (cbs_sei_common_types[i].type == payload_type) | |
| 2311 | + return &cbs_sei_common_types[i]; | |
| 2312 | + } | |
| 2313 | + | |
| 2302 | 2314 | return NULL; |
| 2303 | 2315 | } |
| @@ -801,6 +801,40 @@ SEI_FUNC(film_grain_characteristics, (CodedBitstreamContext *ctx, RWContext *rw, · 800 unmodified lines | ||
| 801 | 801 | return 0; |
| 802 | 802 | } |
| 803 | 803 | |
| 804 | +SEI_FUNC(sei_frame_packing_arrangement, (CodedBitstreamContext *ctx, RWContext *rw, | |
| 805 | + H264RawSEIFramePackingArrangement *current, | |
| 806 | + SEIMessageState *sei)) | |
| 807 | +{ | |
| 808 | + int err; | |
| 809 | + | |
| 810 | + HEADER("Frame Packing Arrangement"); | |
| 811 | + | |
| 812 | + ue(frame_packing_arrangement_id, 0, MAX_UINT_BITS(31)); | |
| 813 | + flag(frame_packing_arrangement_cancel_flag); | |
| 814 | + if (!current->frame_packing_arrangement_cancel_flag) { | |
| 815 | + u(7, frame_packing_arrangement_type, 0, 7); | |
| 816 | + flag(quincunx_sampling_flag); | |
| 817 | + u(6, content_interpretation_type, 0, 2); | |
| 818 | + flag(spatial_flipping_flag); | |
| 819 | + flag(frame0_flipped_flag); | |
| 820 | + flag(field_views_flag); | |
| 821 | + flag(current_frame_is_frame0_flag); | |
| 822 | + flag(frame0_self_contained_flag); | |
| 823 | + flag(frame1_self_contained_flag); | |
| 824 | + if (!current->quincunx_sampling_flag && current->frame_packing_arrangement_type != 5) { | |
| 825 | + ub(4, frame0_grid_position_x); | |
| 826 | + ub(4, frame0_grid_position_y); | |
| 827 | + ub(4, frame1_grid_position_x); | |
| 828 | + ub(4, frame1_grid_position_y); | |
| 829 | + } | |
| 830 | + fixed(8, frame_packing_arrangement_reserved_byte, 0); | |
| 831 | + ue(frame_packing_arrangement_repetition_period, 0, 16384); | |
| 832 | + } | |
| 833 | + flag(frame_packing_arrangement_extension_flag); | |
| 834 | + | |
| 835 | + return 0; | |
| 836 | +} | |
| 837 | + | |
| 804 | 838 | SEI_FUNC(sei_display_orientation, (CodedBitstreamContext *ctx, RWContext *rw, |
| 805 | 839 | H264RawSEIDisplayOrientation *current, |
| 806 | 840 | SEIMessageState *sei)) |
| @@ -43,6 +43,26 @@ typedef struct SEIRawUserDataUnregistered { · 42 unmodified lines | ||
| 43 | 43 | size_t data_length; |
| 44 | 44 | } SEIRawUserDataUnregistered; |
| 45 | 45 | |
| 46 | +typedef struct SEIRawFramePackingArrangement { | |
| 47 | + uint32_t fp_arrangement_id; | |
| 48 | + uint8_t fp_arrangement_cancel_flag; | |
| 49 | + uint8_t fp_arrangement_type; | |
| 50 | + uint8_t fp_quincunx_sampling_flag; | |
| 51 | + uint8_t fp_content_interpretation_type; | |
| 52 | + uint8_t fp_spatial_flipping_flag; | |
| 53 | + uint8_t fp_frame0_flipped_flag; | |
| 54 | + uint8_t fp_field_views_flag; | |
| 55 | + uint8_t fp_current_frame_is_frame0_flag; | |
| 56 | + uint8_t fp_frame0_self_contained_flag; | |
| 57 | + uint8_t fp_frame1_self_contained_flag; | |
| 58 | + uint8_t fp_frame0_grid_position_x; | |
| 59 | + uint8_t fp_frame0_grid_position_y; | |
| 60 | + uint8_t fp_frame1_grid_position_x; | |
| 61 | + uint8_t fp_frame1_grid_position_y; | |
| 62 | + uint8_t fp_arrangement_persistence_flag; | |
| 63 | + uint8_t fp_upsampled_aspect_ratio_flag; | |
| 64 | +} SEIRawFramePackingArrangement; | |
| 65 | + | |
| 46 | 66 | typedef struct SEIRawMasteringDisplayColourVolume { |
| 47 | 67 | uint16_t display_primaries_x[3]; |
| 48 | 68 | uint16_t display_primaries_y[3]; |
| @@ -94,6 +94,40 @@ SEI_FUNC(user_data_unregistered, (CodedBitstreamContext *ctx, RWContext *rw, · 93 unmodified lines | ||
| 94 | 94 | return 0; |
| 95 | 95 | } |
| 96 | 96 | |
| 97 | +SEI_FUNC(frame_packing_arrangement, (CodedBitstreamContext *ctx, RWContext *rw, | |
| 98 | + SEIRawFramePackingArrangement *current, | |
| 99 | + SEIMessageState *unused)) | |
| 100 | +{ | |
| 101 | + int err; | |
| 102 | + | |
| 103 | + HEADER("Frame Packing Arrangement"); | |
| 104 | + | |
| 105 | + ue(fp_arrangement_id, 0, MAX_UINT_BITS(31)); | |
| 106 | + flag(fp_arrangement_cancel_flag); | |
| 107 | + if (!current->fp_arrangement_cancel_flag) { | |
| 108 | + u(7, fp_arrangement_type, 3, 5); | |
| 109 | + flag(fp_quincunx_sampling_flag); | |
| 110 | + u(6, fp_content_interpretation_type, 0, 2); | |
| 111 | + flag(fp_spatial_flipping_flag); | |
| 112 | + flag(fp_frame0_flipped_flag); | |
| 113 | + flag(fp_field_views_flag); | |
| 114 | + flag(fp_current_frame_is_frame0_flag); | |
| 115 | + flag(fp_frame0_self_contained_flag); | |
| 116 | + flag(fp_frame1_self_contained_flag); | |
| 117 | + if (!current->fp_quincunx_sampling_flag && current->fp_arrangement_type != 5) { | |
| 118 | + ub(4, fp_frame0_grid_position_x); | |
| 119 | + ub(4, fp_frame0_grid_position_y); | |
| 120 | + ub(4, fp_frame1_grid_position_x); | |
| 121 | + ub(4, fp_frame1_grid_position_y); | |
| 122 | + } | |
| 123 | + fixed(8, fp_arrangement_reserved_byte, 0); | |
| 124 | + flag(fp_arrangement_persistence_flag); | |
| 125 | + } | |
| 126 | + flag(fp_upsampled_aspect_ratio_flag); | |
| 127 | + | |
| 128 | + return 0; | |
| 129 | +} | |
| 130 | + | |
| 97 | 131 | SEI_FUNC(mastering_display_colour_volume, |
| 98 | 132 | (CodedBitstreamContext *ctx, RWContext *rw, |
| 99 | 133 | SEIRawMasteringDisplayColourVolume *current, |