Go to the documentation of this file.
37 int off, start_pos,
type, temporal_id, spatial_id;
43 }
state = START_NOT_FOUND;
48 &
type, &temporal_id, &spatial_id);
57 if (
state == START_FOUND)
61 if (
state == START_NOT_FOUND) {
64 }
else if (
state == END_FOUND) {
65 state = OFFSET_IMPOSSIBLE;
125 int leading_zeros = 0;
133 if (leading_zeros >= 32)
146 seq_params->
bitdepth = 8 + (high_bitdepth * 2) + (twelve_bit * 2);
208 int reduced_still_picture_header;
209 int frame_width_bits_minus_1, frame_height_bits_minus_1;
220 memset(seq_params, 0,
sizeof(*seq_params));
225 reduced_still_picture_header =
get_bits1(&gb);
227 if (reduced_still_picture_header) {
229 seq_params->
tier = 0;
231 int initial_display_delay_present_flag, operating_points_cnt_minus_1;
232 int decoder_model_info_present_flag, buffer_delay_length_minus_1;
241 decoder_model_info_present_flag =
get_bits1(&gb);
242 if (decoder_model_info_present_flag) {
243 buffer_delay_length_minus_1 =
get_bits(&gb, 5);
249 decoder_model_info_present_flag = 0;
251 initial_display_delay_present_flag =
get_bits1(&gb);
253 operating_points_cnt_minus_1 =
get_bits(&gb, 5);
254 for (
int i = 0;
i <= operating_points_cnt_minus_1;
i++) {
255 int seq_level_idx, seq_tier;
260 if (seq_level_idx > 7)
265 if (decoder_model_info_present_flag) {
273 if (initial_display_delay_present_flag) {
279 seq_params->
level = seq_level_idx;
280 seq_params->
tier = seq_tier;
285 frame_width_bits_minus_1 =
get_bits(&gb, 4);
286 frame_height_bits_minus_1 =
get_bits(&gb, 4);
288 skip_bits(&gb, frame_width_bits_minus_1 + 1);
289 skip_bits(&gb, frame_height_bits_minus_1 + 1);
291 if (!reduced_still_picture_header) {
298 if (!reduced_still_picture_header) {
299 int enable_order_hint, seq_force_screen_content_tools;
305 if (enable_order_hint)
309 seq_force_screen_content_tools = 2;
311 seq_force_screen_content_tools =
get_bits1(&gb);
313 if (seq_force_screen_content_tools) {
318 if (enable_order_hint)
337 int start_pos,
type, temporal_id, spatial_id;
344 &
type, &temporal_id, &spatial_id);
372 int start_pos,
type, temporal_id, spatial_id;
373 int ret, nb_seq = 0, seq_size, meta_size;
387 &
type, &temporal_id, &spatial_id);
396 if (!obu_size || nb_seq > 1) {
static int parse_sequence_header(AV1SequenceParameters *seq_params, const uint8_t *buf, int size)
static void skip_bits_long(GetBitContext *s, int n)
Skips the specified number of bits.
@ AV1_OBU_REDUNDANT_FRAME_HEADER
static int get_bits_left(GetBitContext *gb)
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
static void init_put_bits(PutBitContext *s, uint8_t *buffer, int buffer_size)
Initialize the PutBitContext s.
static av_cold int end(AVCodecContext *avctx)
static void put_bits(Jpeg2000EncoderContext *s, int val, int n)
put n times val bit
@ AVCOL_SPC_RGB
order of coefficients is actually GBR, also IEC 61966-2-1 (sRGB)
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.
@ AV1_OBU_TEMPORAL_DELIMITER
int avio_get_dyn_buf(AVIOContext *s, uint8_t **pbuffer)
Return the written size and a pointer to the buffer.
static int init_get_bits(GetBitContext *s, const uint8_t *buffer, int bit_size)
Initialize GetBitContext.
uint8_t chroma_subsampling_y
static void skip_bits(GetBitContext *s, int n)
static int av1_filter_obus(AVIOContext *pb, const uint8_t *buf, int size, int *offset)
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
@ AVCOL_TRC_IEC61966_2_1
IEC 61966-2-1 (sRGB or sYCC)
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf type
uint8_t color_description_present_flag
int avio_open_dyn_buf(AVIOContext **s)
Open a write only memory stream.
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)
int ff_av1_filter_obus_buf(const uint8_t *in, uint8_t **out, int *size, int *offset)
Filter out AV1 OBUs not meant to be present in ISOBMFF sample data and return the result in a data bu...
uint8_t chroma_sample_position
static void uvlc(GetBitContext *gb)
@ AVCOL_PRI_BT709
also ITU-R BT1361 / IEC 61966-2-4 / SMPTE RP177 Annex B
static unsigned int get_bits1(GetBitContext *s)
uint8_t transfer_characteristics
int ffio_init_context(AVIOContext *s, unsigned char *buffer, int buffer_size, int write_flag, void *opaque, int(*read_packet)(void *opaque, uint8_t *buf, int buf_size), int(*write_packet)(void *opaque, uint8_t *buf, int buf_size), int64_t(*seek)(void *opaque, int64_t offset, int whence))
#define FF_PROFILE_AV1_MAIN
uint8_t matrix_coefficients
static int get_obu_bit_length(const uint8_t *buf, int size, int type)
@ AV1_OBU_SEQUENCE_HEADER
static const uint8_t header[24]
void avio_write(AVIOContext *s, const unsigned char *buf, int size)
static int parse_color_config(AV1SequenceParameters *seq_params, GetBitContext *gb)
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf offset
static void skip_bits1(GetBitContext *s)
uint8_t pi<< 24) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_U8, uint8_t,(*(const uint8_t *) pi - 0x80) *(1.0f/(1<< 7))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_U8, uint8_t,(*(const uint8_t *) pi - 0x80) *(1.0/(1<< 7))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S16, int16_t,(*(const int16_t *) pi >> 8)+0x80) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S16, int16_t, *(const int16_t *) pi *(1.0f/(1<< 15))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S16, int16_t, *(const int16_t *) pi *(1.0/(1<< 15))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S32, int32_t,(*(const int32_t *) pi >> 24)+0x80) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S32, int32_t, *(const int32_t *) pi *(1.0f/(1U<< 31))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S32, int32_t, *(const int32_t *) pi *(1.0/(1U<< 31))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_FLT, float, av_clip_uint8(lrintf(*(const float *) pi *(1<< 7))+0x80)) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_FLT, float, av_clip_int16(lrintf(*(const float *) pi *(1<< 15)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_FLT, float, av_clipl_int32(llrintf(*(const float *) pi *(1U<< 31)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_DBL, double, av_clip_uint8(lrint(*(const double *) pi *(1<< 7))+0x80)) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_DBL, double, av_clip_int16(lrint(*(const double *) pi *(1<< 15)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_DBL, double, av_clipl_int32(llrint(*(const double *) pi *(1U<< 31)))) #define SET_CONV_FUNC_GROUP(ofmt, ifmt) static void set_generic_function(AudioConvert *ac) { } void ff_audio_convert_free(AudioConvert **ac) { if(! *ac) return;ff_dither_free(&(*ac) ->dc);av_freep(ac);} AudioConvert *ff_audio_convert_alloc(AVAudioResampleContext *avr, enum AVSampleFormat out_fmt, enum AVSampleFormat in_fmt, int channels, int sample_rate, int apply_map) { AudioConvert *ac;int in_planar, out_planar;ac=av_mallocz(sizeof(*ac));if(!ac) return NULL;ac->avr=avr;ac->out_fmt=out_fmt;ac->in_fmt=in_fmt;ac->channels=channels;ac->apply_map=apply_map;if(avr->dither_method !=AV_RESAMPLE_DITHER_NONE &&av_get_packed_sample_fmt(out_fmt)==AV_SAMPLE_FMT_S16 &&av_get_bytes_per_sample(in_fmt) > 2) { ac->dc=ff_dither_alloc(avr, out_fmt, in_fmt, channels, sample_rate, apply_map);if(!ac->dc) { av_free(ac);return NULL;} return ac;} in_planar=ff_sample_fmt_is_planar(in_fmt, channels);out_planar=ff_sample_fmt_is_planar(out_fmt, channels);if(in_planar==out_planar) { ac->func_type=CONV_FUNC_TYPE_FLAT;ac->planes=in_planar ? ac->channels :1;} else if(in_planar) ac->func_type=CONV_FUNC_TYPE_INTERLEAVE;else ac->func_type=CONV_FUNC_TYPE_DEINTERLEAVE;set_generic_function(ac);if(ARCH_AARCH64) ff_audio_convert_init_aarch64(ac);if(ARCH_ARM) ff_audio_convert_init_arm(ac);if(ARCH_X86) ff_audio_convert_init_x86(ac);return ac;} int ff_audio_convert(AudioConvert *ac, AudioData *out, AudioData *in) { int use_generic=1;int len=in->nb_samples;int p;if(ac->dc) { av_log(ac->avr, AV_LOG_TRACE, "%d samples - audio_convert: %s to %s (dithered)\n", len, av_get_sample_fmt_name(ac->in_fmt), av_get_sample_fmt_name(ac->out_fmt));return ff_convert_dither(ac-> in
#define i(width, name, range_min, range_max)
#define av_assert1(cond)
assert() equivalent, that does not lie in speed critical code.
#define FF_PROFILE_AV1_PROFESSIONAL
int ff_av1_parse_seq_header(AV1SequenceParameters *seq, const uint8_t *buf, int size)
Parses a Sequence Header from the the provided buffer.
void ffio_free_dyn_buf(AVIOContext **s)
Free a dynamic buffer.
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 ...
#define AV_INPUT_BUFFER_PADDING_SIZE
uint8_t chroma_subsampling_x
static void flush_put_bits(PutBitContext *s)
Pad the end of the output stream with zeros.
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
#define FF_PROFILE_AV1_HIGH