Go to the documentation of this file.
35 #define NUM_CHROMA_FORMATS 4 // @see ISO_IEC_23094-1 section 6.2 table 2
62 const uint8_t *buf,
int buf_size)
124 sps =
ctx->ps.sps[
pps->pps_seq_parameter_set_id];
127 s->coded_width =
sps->pic_width_in_luma_samples;
128 s->coded_height =
sps->pic_height_in_luma_samples;
130 if (
sps->picture_cropping_flag) {
131 s->width =
sps->pic_width_in_luma_samples -
sps->picture_crop_left_offset -
sps->picture_crop_right_offset;
132 s->height =
sps->pic_height_in_luma_samples -
sps->picture_crop_top_offset -
sps->picture_crop_bottom_offset;
134 s->width =
sps->pic_width_in_luma_samples;
135 s->height =
sps->pic_height_in_luma_samples;
158 if (
sps->vui_parameters_present_flag &&
sps->vui_parameters.timing_info_present_flag) {
159 int64_t num =
sps->vui_parameters.num_units_in_tick;
160 int64_t den =
sps->vui_parameters.time_scale;
161 if (num != 0 && den != 0)
198 s->output_picture_number =
ctx->poc.PicOrderCntVal;
222 const uint8_t *
data = buf;
223 int data_size = buf_size;
225 while (data_size > 0) {
239 if (data_size < nalu_size)
249 data_size -= nalu_size;
272 int nalu_length_field_size;
285 nalu_length_field_size = (bytestream2_get_byte(&gb) & 3) + 1;
286 if( nalu_length_field_size != 1 &&
287 nalu_length_field_size != 2 &&
288 nalu_length_field_size != 4 ) {
289 av_log(avctx,
AV_LOG_ERROR,
"The length in bytes of the NALUnitLenght field in a EVC video stream has unsupported value of %d\n", nalu_length_field_size);
293 num_of_arrays = bytestream2_get_byte(&gb);
296 for (
int i = 0;
i < num_of_arrays;
i++) {
302 int nal_unit_type = bytestream2_get_byte(&gb) & 0x3f;
303 int num_nalus = bytestream2_get_be16(&gb);
305 for (
int j = 0; j < num_nalus; j++) {
307 int nal_unit_length = bytestream2_get_be16(&gb);
334 const uint8_t **poutbuf,
int *poutbuf_size,
335 const uint8_t *buf,
int buf_size)
346 ctx->parsed_extradata = 1;
360 *poutbuf_size = buf_size;
AVPixelFormat
Pixel format.
static int parse_nal_units(AVCodecParserContext *s, AVCodecContext *avctx, const uint8_t *buf, int buf_size)
Parse NAL units of found picture and decode some basic information.
int ff_evc_parse_pps(GetBitContext *gb, EVCParamSets *ps)
static enum AVPixelFormat pix_fmts_10bit[NUM_CHROMA_FORMATS]
#define AV_PIX_FMT_YUV420P10
static void bit_depth(AudioStatsContext *s, const uint64_t *const mask, uint8_t *depth)
static int parse_nal_unit(AVCodecParserContext *s, AVCodecContext *avctx, const uint8_t *buf, int buf_size)
static void skip_bits(GetBitContext *s, int n)
static av_always_inline void bytestream2_skip(GetByteContext *g, unsigned int size)
static enum AVPixelFormat pix_fmts_8bit[NUM_CHROMA_FORMATS]
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
#define AV_PIX_FMT_YUV422P9
#define AV_PIX_FMT_GRAY16
int av_reduce(int *dst_num, int *dst_den, int64_t num, int64_t den, int64_t max)
Reduce a fraction.
#define AV_PIX_FMT_YUV444P10
void ff_evc_ps_free(EVCParamSets *ps)
static enum AVPixelFormat pix_fmts_16bit[NUM_CHROMA_FORMATS]
@ AV_PICTURE_STRUCTURE_FRAME
coded as frame
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
int ff_evc_parse_sps(GetBitContext *gb, EVCParamSets *ps)
#define AV_PIX_FMT_YUV422P16
static int init_get_bits8(GetBitContext *s, const uint8_t *buffer, int byte_size)
Initialize GetBitContext.
int ff_evc_parse_slice_header(GetBitContext *gb, EVCParserSliceHeader *sh, const EVCParamSets *ps, enum EVCNALUnitType nalu_type)
#define AV_PIX_FMT_YUV444P16
#define av_assert0(cond)
assert() equivalent, that is always enabled.
#define AV_PIX_FMT_YUV420P9
#define AV_PIX_FMT_YUV420P16
#define NUM_CHROMA_FORMATS
#define AV_PIX_FMT_GRAY14
static int evc_parse(AVCodecParserContext *s, AVCodecContext *avctx, const uint8_t **poutbuf, int *poutbuf_size, const uint8_t *buf, int buf_size)
@ AV_PIX_FMT_YUV420P
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
#define AV_PIX_FMT_GRAY10
Rational number (pair of numerator and denominator).
@ AV_PICTURE_TYPE_I
Intra.
static unsigned int get_bits1(GetBitContext *s)
#define AV_PIX_FMT_YUV422P10
@ AV_PIX_FMT_GRAY8
Y , 8bpp.
const AVCodecParser ff_evc_parser
static av_always_inline int bytestream2_get_bytes_left(GetByteContext *g)
static int FUNC() pps(CodedBitstreamContext *ctx, RWContext *rw, H264RawPPS *current)
#define AV_PIX_FMT_YUV422P12
#define AV_PIX_FMT_YUV444P12
@ AV_PICTURE_TYPE_NONE
Undefined.
static void skip_bits1(GetBitContext *s)
#define EVC_NALU_LENGTH_PREFIX_SIZE
#define i(width, name, range_min, range_max)
uint8_t * extradata
some codecs need / can use extradata like Huffman tables.
static enum AVPixelFormat pix_fmts_12bit[NUM_CHROMA_FORMATS]
#define AV_PIX_FMT_YUV444P9
static int FUNC() sps(CodedBitstreamContext *ctx, RWContext *rw, H264RawSPS *current)
static enum AVPixelFormat pix_fmts_9bit[NUM_CHROMA_FORMATS]
#define AV_PIX_FMT_YUV420P12
#define AV_PIX_FMT_YUV422P14
main external API structure.
@ AV_PICTURE_TYPE_B
Bi-dir predicted.
static uint32_t evc_read_nal_unit_length(const uint8_t *bits, int bits_size, void *logctx)
@ AV_PIX_FMT_YUV444P
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
@ AV_PICTURE_TYPE_P
Predicted.
@ AV_PIX_FMT_YUV422P
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
static enum AVPixelFormat pix_fmts_14bit[NUM_CHROMA_FORMATS]
static av_always_inline void bytestream2_init(GetByteContext *g, const uint8_t *buf, int buf_size)
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
#define AV_PIX_FMT_YUV444P14
static void evc_parser_close(AVCodecParserContext *s)
#define AV_PIX_FMT_GRAY12
static int decode_extradata(AVCodecParserContext *s, AVCodecContext *avctx)
#define AV_PIX_FMT_YUV420P14
int ff_evc_derive_poc(const EVCParamSets *ps, const EVCParserSliceHeader *sh, EVCParserPoc *poc, enum EVCNALUnitType nalu_type, int tid)