34 int start_pos,
type, temporal_id, spatial_id;
39 &type, &temporal_id, &spatial_id);
93 int leading_zeros = 0;
101 if (leading_zeros >= 32)
122 transfer_characteristics =
get_bits(gb, 8);
123 matrix_coefficients =
get_bits(gb, 8);
174 int reduced_still_picture_header;
175 int frame_width_bits_minus_1, frame_height_bits_minus_1;
186 memset(seq_params, 0,
sizeof(*seq_params));
191 reduced_still_picture_header =
get_bits1(&gb);
193 if (reduced_still_picture_header) {
197 int initial_display_delay_present_flag, operating_points_cnt_minus_1;
198 int decoder_model_info_present_flag, buffer_delay_length_minus_1;
207 decoder_model_info_present_flag =
get_bits1(&gb);
208 if (decoder_model_info_present_flag) {
209 buffer_delay_length_minus_1 =
get_bits(&gb, 5);
215 decoder_model_info_present_flag = 0;
217 initial_display_delay_present_flag =
get_bits1(&gb);
219 operating_points_cnt_minus_1 =
get_bits(&gb, 5);
220 for (
int i = 0; i <= operating_points_cnt_minus_1; i++) {
221 int seq_level_idx, seq_tier;
226 if (seq_level_idx > 7)
231 if (decoder_model_info_present_flag) {
239 if (initial_display_delay_present_flag) {
251 frame_width_bits_minus_1 =
get_bits(&gb, 4);
252 frame_height_bits_minus_1 =
get_bits(&gb, 4);
254 skip_bits(&gb, frame_width_bits_minus_1 + 1);
255 skip_bits(&gb, frame_height_bits_minus_1 + 1);
257 if (!reduced_still_picture_header) {
264 if (!reduced_still_picture_header) {
265 int enable_order_hint, seq_force_screen_content_tools;
271 if (enable_order_hint)
275 seq_force_screen_content_tools = 2;
277 seq_force_screen_content_tools =
get_bits1(&gb);
279 if (seq_force_screen_content_tools) {
284 if (enable_order_hint)
308 int start_pos,
type, temporal_id, spatial_id;
309 int ret, nb_seq = 0, seq_size, meta_size;
323 &type, &temporal_id, &spatial_id);
332 if (!obu_size || nb_seq > 1) {
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
int avio_close_dyn_buf(AVIOContext *s, uint8_t **pbuffer)
Return the written size and a pointer to the buffer.
static void put_bits(Jpeg2000EncoderContext *s, int val, int n)
put n times val bit
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
Memory handling functions.
static void skip_bits_long(GetBitContext *s, int n)
Skips the specified number of bits.
int ff_av1_filter_obus(AVIOContext *pb, const uint8_t *buf, int size)
Filter out AV1 OBUs not meant to be present in ISOBMFF sample data and write the resulting bitstream ...
int avio_open_dyn_buf(AVIOContext **s)
Open a write only memory stream.
order of coefficients is actually GBR, also IEC 61966-2-1 (sRGB)
uint8_t chroma_sample_position
uint8_t chroma_subsampling_x
static av_cold int end(AVCodecContext *avctx)
int ff_isom_write_av1c(AVIOContext *pb, const uint8_t *buf, int size)
Writes AV1 extradata (Sequence Header and Metadata OBUs) to the provided AVIOContext.
static const uint8_t header[24]
void avio_write(AVIOContext *s, const unsigned char *buf, int size)
static int get_bits_left(GetBitContext *gb)
also ITU-R BT1361 / IEC 61966-2-4 / SMPTE RP177 Annex B
static int parse_sequence_header(AV1SequenceParameters *seq_params, const uint8_t *buf, int size)
static const struct TransferCharacteristics transfer_characteristics[AVCOL_TRC_NB]
static int parse_obu_header(const uint8_t *buf, int buf_size, int64_t *obu_size, int *start_pos, int *type, int *temporal_id, int *spatial_id)
static const struct ColorPrimaries color_primaries[AVCOL_PRI_NB]
static void uvlc(GetBitContext *gb)
int ff_av1_filter_obus_buf(const uint8_t *buf, uint8_t **out, int *size)
Filter out AV1 OBUs not meant to be present in ISOBMFF sample data and write the resulting bitstream ...
static unsigned int get_bits1(GetBitContext *s)
static void skip_bits1(GetBitContext *s)
static void skip_bits(GetBitContext *s, int n)
#define FF_PROFILE_AV1_PROFESSIONAL
#define FF_PROFILE_AV1_MAIN
static int init_get_bits(GetBitContext *s, const uint8_t *buffer, int bit_size)
Initialize GetBitContext.
static int parse_color_config(AV1SequenceParameters *seq_params, GetBitContext *gb)
IEC 61966-2-1 (sRGB or sYCC)
static void flush_put_bits(PutBitContext *s)
Pad the end of the output stream with zeros.
static int get_obu_bit_length(const uint8_t *buf, int size, int type)
uint8_t chroma_subsampling_y
static void init_put_bits(PutBitContext *s, uint8_t *buffer, int buffer_size)
Initialize the PutBitContext s.
#define FF_PROFILE_AV1_HIGH