26 #include <aom/aom_decoder.h>
27 #include <aom/aomdx.h>
41 const struct aom_codec_iface *iface)
44 struct aom_codec_dec_cfg deccfg = {
52 if (aom_codec_dec_init(&ctx->
decoder, iface, &deccfg, 0) != AOM_CODEC_OK) {
73 w = (w + img->x_chroma_shift) >> img->x_chroma_shift;
74 h = (h + img->y_chroma_shift) >> img->y_chroma_shift;
77 for (y = 0; y <
h; y++) {
78 uint16_t *
src = (uint16_t *)(img->planes[i] + y * img->stride[i]);
80 for (x = 0; x <
w; x++)
98 case AOM_IMG_FMT_I420:
99 case AOM_IMG_FMT_I42016:
100 if (img->bit_depth == 8) {
101 avctx->
pix_fmt = img->monochrome ?
105 }
else if (img->bit_depth == 10) {
106 avctx->
pix_fmt = img->monochrome ?
110 }
else if (img->bit_depth == 12) {
111 avctx->
pix_fmt = img->monochrome ?
118 case AOM_IMG_FMT_I422:
119 case AOM_IMG_FMT_I42216:
120 if (img->bit_depth == 8) {
124 }
else if (img->bit_depth == 10) {
128 }
else if (img->bit_depth == 12) {
135 case AOM_IMG_FMT_I444:
136 case AOM_IMG_FMT_I44416:
137 if (img->bit_depth == 8) {
141 }
else if (img->bit_depth == 10) {
145 }
else if (img->bit_depth == 12) {
163 const void *iter =
NULL;
164 struct aom_image *
img;
170 const char *detail = aom_codec_error_detail(&ctx->
decoder);
179 if ((img = aom_codec_get_frame(&ctx->
decoder, &iter))) {
180 if (img->d_w > img->w || img->d_h > img->h) {
182 img->d_w, img->d_h, img->w, img->h);
188 img->fmt, img->bit_depth);
192 if ((
int)img->d_w != avctx->
width || (
int)img->d_h != avctx->
height) {
201 if ((img->fmt & AOM_IMG_FMT_HIGHBITDEPTH) && img->bit_depth == 8)
205 img->stride, avctx->
pix_fmt, img->d_w, img->d_h);
214 aom_codec_destroy(&ctx->
decoder);
220 return aom_init(avctx, &aom_codec_av1_dx_algo);
224 .
name =
"libaom-av1",
234 .wrapper_name =
"libaom",
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
This structure describes decoded (raw) audio or video data.
static av_cold int aom_free(AVCodecContext *avctx)
ptrdiff_t const GLvoid * data
static av_cold int aom_init(AVCodecContext *avctx, const struct aom_codec_iface *iface)
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
int ff_set_dimensions(AVCodecContext *s, int width, int height)
Check that the provided frame dimensions are valid and set them on the codec context.
static av_cold int init(AVCodecContext *avctx)
static int aom_decode(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
enum AVColorRange color_range
MPEG vs JPEG YUV range.
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
#define AV_PIX_FMT_YUV420P12
#define AV_CODEC_CAP_AUTO_THREADS
Codec supports avctx->thread_count == 0 (auto).
struct aom_codec_ctx decoder
static void decode(AVCodecContext *dec_ctx, AVPacket *pkt, AVFrame *frame, FILE *outfile)
#define AV_PIX_FMT_GRAY10
#define AV_PIX_FMT_GRAY12
#define AV_LOG_VERBOSE
Detailed information.
AVColorRange
MPEG vs JPEG YUV range.
#define AV_PIX_FMT_YUV422P12
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
const char * name
Name of the codec implementation.
#define AV_PIX_FMT_YUV444P10
void av_image_copy(uint8_t *dst_data[4], int dst_linesizes[4], const uint8_t *src_data[4], const int src_linesizes[4], enum AVPixelFormat pix_fmt, int width, int height)
Copy image in src_data to dst_data.
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
uint8_t nb_components
The number of components each pixel has, (1-4)
int width
picture width / height.
AVCodec ff_libaom_av1_decoder
enum AVColorPrimaries color_primaries
Chromaticity coordinates of the source primaries.
static void error(const char *err)
int thread_count
thread count is used to decide how many independent tasks should be passed to execute() ...
the normal 2^n-1 "JPEG" YUV ranges
int format
format of the frame, -1 if unknown or unset Values correspond to enum AVPixelFormat for video frames...
#define AV_LOG_INFO
Standard information.
static void image_copy_16_to_8(AVFrame *pic, struct aom_image *img)
Libavcodec external API header.
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
const AVProfile ff_av1_profiles[]
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
main external API structure.
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
Get a buffer for a frame.
#define AV_PIX_FMT_YUV420P10
static const AVProfile profiles[]
#define FF_PROFILE_AV1_PROFESSIONAL
enum AVColorSpace colorspace
YUV colorspace type.
enum AVColorTransferCharacteristic color_trc
Color Transfer Characteristic.
static int set_pix_fmt(AVCodecContext *avctx, struct aom_image *img)
#define FF_PROFILE_AV1_MAIN
static av_cold int av1_init(AVCodecContext *avctx)
#define AV_PIX_FMT_YUV422P10
#define AV_PIX_FMT_YUV444P12
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
the normal 219*2^(n-8) "MPEG" YUV ranges
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
common internal api header.
common internal and external API header
#define AVERROR_EXTERNAL
Generic error in an external library.
This structure stores compressed data.
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() for allocating buffers and supports custom allocators.
#define FF_PROFILE_AV1_HIGH