26#include <aom/aom_decoder.h>
47 const struct aom_codec_iface *iface)
50 struct aom_codec_dec_cfg deccfg = {
57 if (aom_codec_dec_init(&
ctx->decoder, iface, &deccfg, 0) != AOM_CODEC_OK) {
58 const char *
error = aom_codec_error(&
ctx->decoder);
74 if (
img->cp != AOM_CICP_CP_UNSPECIFIED)
76 if (
img->mc != AOM_CICP_MC_UNSPECIFIED)
78 if (
img->tc != AOM_CICP_TC_UNSPECIFIED)
82 case AOM_IMG_FMT_I420:
83 case AOM_IMG_FMT_I42016:
84 if (
img->bit_depth == 8) {
89 }
else if (
img->bit_depth == 10) {
94 }
else if (
img->bit_depth == 12) {
102 case AOM_IMG_FMT_I422:
103 case AOM_IMG_FMT_I42216:
104 if (
img->bit_depth == 8) {
108 }
else if (
img->bit_depth == 10) {
112 }
else if (
img->bit_depth == 12) {
119 case AOM_IMG_FMT_I444:
120 case AOM_IMG_FMT_I44416:
121 if (
img->bit_depth == 8) {
126 }
else if (
img->bit_depth == 10) {
132 }
else if (
img->bit_depth == 12) {
147 const uint8_t *
buffer,
size_t buffer_size)
167 const struct aom_image *
img)
169 const size_t num_metadata = aom_img_num_metadata(
img);
170 for (
size_t i = 0;
i < num_metadata; ++
i) {
171 const aom_metadata_t *
metadata = aom_img_get_metadata(
img,
i);
176 case OBU_METADATA_TYPE_ITUT_T35: {
193 const void *iter =
NULL;
194 struct aom_image *
img;
199 const char *
error = aom_codec_error(&
ctx->decoder);
200 const char *detail = aom_codec_error_detail(&
ctx->decoder);
209 if ((
img = aom_codec_get_frame(&
ctx->decoder, &iter))) {
218 img->fmt,
img->bit_depth);
232#ifdef AOM_CTRL_AOMD_GET_FRAME_FLAGS
234 aom_codec_frame_flags_t
flags;
235 ret = aom_codec_control(&
ctx->decoder, AOMD_GET_FRAME_FLAGS, &
flags);
236 if (ret == AOM_CODEC_OK) {
237 if (
flags & AOM_FRAME_IS_KEY)
241 if (
flags & (AOM_FRAME_IS_KEY | AOM_FRAME_IS_INTRAONLY))
243 else if (
flags & AOM_FRAME_IS_SWITCH)
258 if ((
img->fmt & AOM_IMG_FMT_HIGHBITDEPTH) &&
img->bit_depth == 8)
261 const uint8_t *
planes[4] = {
img->planes[0],
img->planes[1],
img->planes[2] };
262 const int stride[4] = {
img->stride[0],
img->stride[1],
img->stride[2] };
280 aom_codec_destroy(&
ctx->decoder);
286 return aom_init(avctx, aom_codec_av1_dx());
290 .p.name =
"libaom-av1",
302 .p.wrapper_name =
"libaom",
const FFCodec ff_libaom_av1_decoder
static AVFormatContext * ctx
static av_cold void close(AVCodecParserContext *s)
Libavcodec external API header.
static int FUNC metadata(CodedBitstreamContext *ctx, RWContext *rw, APVRawMetadata *current)
#define flags(name, subs,...)
#define i(width, name, range_min, range_max)
#define FF_CODEC_CAP_NOT_INIT_THREADSAFE
The codec is not known to be init-threadsafe (i.e.
#define FF_CODEC_DECODE_CB(func)
#define CODEC_LONG_NAME(str)
#define FF_CODEC_CAP_AUTO_THREADS
Codec handles avctx->thread_count == 0 (auto) internally.
common internal and external API header
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
Get a buffer for a frame.
int ff_set_sar(AVCodecContext *avctx, AVRational sar)
Check that the provided sample aspect ratio is valid and set it on the codec context.
int ff_set_dimensions(AVCodecContext *s, int width, int height)
#define AV_PROFILE_AV1_HIGH
#define AV_PROFILE_AV1_MAIN
#define AV_PROFILE_AV1_PROFESSIONAL
int(* init)(AVBSFContext *ctx)
#define AV_CODEC_CAP_OTHER_THREADS
Codec supports multithreading through a method other than slice- or frame-level multithreading.
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators.
#define AVERROR_EXTERNAL
Generic error in an external library.
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
#define AV_FRAME_FLAG_KEY
A flag to mark frames that are keyframes.
#define AV_LOG_VERBOSE
Detailed information.
#define AV_LOG_INFO
Standard information.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
int av_reduce(int *dst_num, int *dst_den, int64_t num, int64_t den, int64_t max)
Reduce a fraction.
void av_image_copy(uint8_t *const dst_data[4], const int dst_linesizes[4], const uint8_t *const src_data[4], const int src_linesizes[4], enum AVPixelFormat pix_fmt, int width, int height)
Copy image in src_data to dst_data.
@ AV_PICTURE_TYPE_I
Intra.
@ AV_PICTURE_TYPE_SP
Switching Predicted.
@ AV_PICTURE_TYPE_P
Predicted.
int ff_itut_t35_parse_buffer(FFITUTT35 *const itut_t35, const uint8_t *buf, size_t buf_size, int flags)
Parse a raw ITU-T T35 buffer to get the country code, provider code, and set them plus the pointer an...
int ff_itut_t35_parse_payload_to_frame(FFITUTT35 *const itut_t35, FFITUTT35Aux *const aux, AVCodecContext *const avctx, AVFrame *const frame)
Parse a pre-processed ITU-T T35 payload to fill a frame's side data.
void ff_aom_image_copy_16_to_8(AVFrame *pic, struct aom_image *img)
static int set_pix_fmt(AVCodecContext *avctx, struct aom_image *img)
static av_cold int av1_init(AVCodecContext *avctx)
static int decode_metadata_itu_t_t35(AVCodecContext *avctx, AVFrame *frame, const uint8_t *buffer, size_t buffer_size)
static av_cold int aom_free(AVCodecContext *avctx)
static av_cold int aom_init(AVCodecContext *avctx, const struct aom_codec_iface *iface)
static int decode_metadata(AVCodecContext *avctx, AVFrame *frame, const struct aom_image *img)
static int aom_decode(AVCodecContext *avctx, AVFrame *picture, int *got_frame, AVPacket *avpkt)
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
static const struct @257111027162314367033347246032313251342043035002 planes[]
#define AV_PIX_FMT_YUV444P12
#define AV_PIX_FMT_YUV420P10
AVColorRange
Visual content value range.
@ AVCOL_RANGE_MPEG
Narrow or limited range content.
@ AVCOL_RANGE_JPEG
Full range content.
#define AV_PIX_FMT_YUV420P12
#define AV_PIX_FMT_YUV422P12
#define AV_PIX_FMT_GBRP10
#define AV_PIX_FMT_YUV422P10
#define AV_PIX_FMT_GRAY12
#define AV_PIX_FMT_GBRP12
@ AV_PIX_FMT_YUV420P
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
@ AV_PIX_FMT_YUV422P
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
@ AV_PIX_FMT_GRAY8
Y , 8bpp.
@ AV_PIX_FMT_YUV444P
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
@ AV_PIX_FMT_GBRP
planar GBR 4:4:4 24bpp
#define AV_PIX_FMT_GRAY10
AVColorPrimaries
Chromaticity coordinates of the source primaries.
AVColorTransferCharacteristic
Color Transfer Characteristic.
#define AV_PIX_FMT_YUV444P10
AVColorSpace
YUV colorspace type.
@ AVCOL_SPC_RGB
order of coefficients is actually GBR, also IEC 61966-2-1 (sRGB), YZX and ST 428-1
const AVProfile ff_av1_profiles[]
struct aom_codec_ctx decoder
main external API structure.
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
int width
picture width / height.
enum AVColorRange color_range
MPEG vs JPEG YUV range.
enum AVColorPrimaries color_primaries
Chromaticity coordinates of the source primaries.
enum AVColorSpace colorspace
YUV colorspace type.
int thread_count
thread count is used to decide how many independent tasks should be passed to execute()
enum AVColorTransferCharacteristic color_trc
Color Transfer Characteristic.
This structure describes decoded (raw) audio or video data.
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
int flags
Frame flags, a combination of AV_FRAME_FLAGS.
AVRational sample_aspect_ratio
Sample aspect ratio for the video frame, 0/1 if unknown/unspecified.
int linesize[AV_NUM_DATA_POINTERS]
For video, a positive or negative value, which is typically indicating the size in bytes of each pict...
enum AVPictureType pict_type
Picture type of the frame.
This structure stores compressed data.
static void error(const char *err)