Re: [libav-devel] [PATCH 05/15] lavc: Add coded bitstream read/write support for H.264

2017-07-23 Thread Anton Khirnov
Quoting Mark Thompson (2017-06-24 01:39:11)
> ---
>  libavcodec/cbs.c |1 +
>  libavcodec/cbs_h264.h|  426 +++
>  libavcodec/cbs_h2645.c   |  800 +++
>  libavcodec/cbs_h2645.h   |   42 ++
>  libavcodec/cbs_h264_syntax.c | 1224 
> ++
>  libavcodec/cbs_internal.h|3 +
>  6 files changed, 2496 insertions(+)
>  create mode 100644 libavcodec/cbs_h264.h
>  create mode 100644 libavcodec/cbs_h2645.c
>  create mode 100644 libavcodec/cbs_h2645.h
>  create mode 100644 libavcodec/cbs_h264_syntax.c

Ok

-- 
Anton Khirnov
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

[libav-devel] [PATCH 05/15] lavc: Add coded bitstream read/write support for H.264

2017-06-23 Thread Mark Thompson
---
 libavcodec/cbs.c |1 +
 libavcodec/cbs_h264.h|  426 +++
 libavcodec/cbs_h2645.c   |  800 +++
 libavcodec/cbs_h2645.h   |   42 ++
 libavcodec/cbs_h264_syntax.c | 1224 ++
 libavcodec/cbs_internal.h|3 +
 6 files changed, 2496 insertions(+)
 create mode 100644 libavcodec/cbs_h264.h
 create mode 100644 libavcodec/cbs_h2645.c
 create mode 100644 libavcodec/cbs_h2645.h
 create mode 100644 libavcodec/cbs_h264_syntax.c

diff --git a/libavcodec/cbs.c b/libavcodec/cbs.c
index ff12bfabf..2619b38dd 100644
--- a/libavcodec/cbs.c
+++ b/libavcodec/cbs.c
@@ -27,6 +27,7 @@
 
 
 static const CodedBitstreamType *cbs_type_table[] = {
+_cbs_type_h264,
 };
 
 int ff_cbs_init(CodedBitstreamContext *ctx,
diff --git a/libavcodec/cbs_h264.h b/libavcodec/cbs_h264.h
new file mode 100644
index 0..bcceacc83
--- /dev/null
+++ b/libavcodec/cbs_h264.h
@@ -0,0 +1,426 @@
+/*
+ * This file is part of Libav.
+ *
+ * Libav is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * Libav is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with Libav; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef AVCODEC_CBS_H264_H
+#define AVCODEC_CBS_H264_H
+
+#include 
+
+#include "cbs_h2645.h"
+#include "h264.h"
+
+
+enum {
+// This limit is arbitrary - it is sufficient for one message of each
+// type plus some repeats, and will therefore easily cover all sane
+// streams.  However, it is possible to make technically-valid streams
+// for which it will fail (for example, by including a large number of
+// user-data-unregistered messages).
+H264_MAX_SEI_PAYLOADS = 64,
+};
+
+
+typedef struct H264RawNALUnitHeader {
+uint8_t forbidden_zero_bit;
+uint8_t nal_ref_idc;
+uint8_t nal_unit_type;
+
+uint8_t svc_extension_flag;
+uint8_t avc_3d_extension_flag;
+} H264RawNALUnitHeader;
+
+typedef struct H264RawScalingList {
+int8_t delta_scale[64];
+} H264RawScalingList;
+
+typedef struct H264RawHRD {
+uint8_t cpb_cnt_minus1;
+uint8_t bit_rate_scale;
+uint8_t cpb_size_scale;
+
+uint32_t bit_rate_value_minus1[H264_MAX_CPB_CNT];
+uint32_t cpb_size_value_minus1[H264_MAX_CPB_CNT];
+uint8_t cbr_flag[H264_MAX_CPB_CNT];
+
+uint8_t initial_cpb_removal_delay_length_minus1;
+uint8_t cpb_removal_delay_length_minus1;
+uint8_t dpb_output_delay_length_minus1;
+uint8_t time_offset_length;
+} H264RawHRD;
+
+typedef struct H264RawVUI {
+uint8_t aspect_ratio_info_present_flag;
+uint8_t aspect_ratio_idc;
+uint16_t sar_width;
+uint16_t sar_height;
+
+uint8_t overscan_info_present_flag;
+uint8_t overscan_appropriate_flag;
+
+uint8_t video_signal_type_present_flag;
+uint8_t video_format;
+uint8_t video_full_range_flag;
+uint8_t colour_description_present_flag;
+uint8_t colour_primaries;
+uint8_t transfer_characteristics;
+uint8_t matrix_coefficients;
+
+uint8_t chroma_loc_info_present_flag;
+uint8_t chroma_sample_loc_type_top_field;
+uint8_t chroma_sample_loc_type_bottom_field;
+
+uint8_t timing_info_present_flag;
+uint32_t num_units_in_tick;
+uint32_t time_scale;
+uint8_t fixed_frame_rate_flag;
+
+uint8_t nal_hrd_parameters_present_flag;
+H264RawHRD nal_hrd_parameters;
+uint8_t vcl_hrd_parameters_present_flag;
+H264RawHRD vcl_hrd_parameters;
+uint8_t low_delay_hrd_flag;
+
+uint8_t pic_struct_present_flag;
+
+uint8_t bitstream_restriction_flag;
+uint8_t motion_vectors_over_pic_boundaries_flag;
+uint8_t max_bytes_per_pic_denom;
+uint8_t max_bits_per_mb_denom;
+uint8_t log2_max_mv_length_horizontal;
+uint8_t log2_max_mv_length_vertical;
+uint8_t max_num_reorder_frames;
+uint8_t max_dec_frame_buffering;
+} H264RawVUI;
+
+typedef struct H264RawSPS {
+H264RawNALUnitHeader nal_unit_header;
+
+uint8_t profile_idc;
+uint8_t constraint_set0_flag;
+uint8_t constraint_set1_flag;
+uint8_t constraint_set2_flag;
+uint8_t constraint_set3_flag;
+uint8_t constraint_set4_flag;
+uint8_t constraint_set5_flag;
+uint8_t reserved_zero_2bits;
+uint8_t level_idc;
+
+uint8_t seq_parameter_set_id;
+
+uint8_t chroma_format_idc;
+uint8_t separate_colour_plane_flag;
+uint8_t bit_depth_luma_minus8;
+uint8_t bit_depth_chroma_minus8;
+uint8_t