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 = {
51 if (aom_codec_dec_init(&ctx->
decoder, iface, &deccfg, 0) != AOM_CODEC_OK) {
72 w = (w + img->x_chroma_shift) >> img->x_chroma_shift;
73 h = (h + img->y_chroma_shift) >> img->y_chroma_shift;
76 for (y = 0; y <
h; y++) {
77 uint16_t *
src = (uint16_t *)(img->planes[i] + y * img->stride[i]);
79 for (x = 0; x <
w; x++)
97 case AOM_IMG_FMT_I420:
98 case AOM_IMG_FMT_I42016:
99 if (img->bit_depth == 8) {
100 avctx->
pix_fmt = img->monochrome ?
104 }
else if (img->bit_depth == 10) {
105 avctx->
pix_fmt = img->monochrome ?
109 }
else if (img->bit_depth == 12) {
110 avctx->
pix_fmt = img->monochrome ?
117 case AOM_IMG_FMT_I422:
118 case AOM_IMG_FMT_I42216:
119 if (img->bit_depth == 8) {
123 }
else if (img->bit_depth == 10) {
127 }
else if (img->bit_depth == 12) {
134 case AOM_IMG_FMT_I444:
135 case AOM_IMG_FMT_I44416:
136 if (img->bit_depth == 8) {
140 }
else if (img->bit_depth == 10) {
144 }
else if (img->bit_depth == 12) {
162 const void *iter =
NULL;
163 struct aom_image *
img;
169 const char *detail = aom_codec_error_detail(&ctx->
decoder);
178 if ((img = aom_codec_get_frame(&ctx->
decoder, &iter))) {
179 if (img->d_w > img->w || img->d_h > img->h) {
181 img->d_w, img->d_h, img->w, img->h);
187 img->fmt, img->bit_depth);
191 if ((
int)img->d_w != avctx->
width || (
int)img->d_h != avctx->
height) {
200 if ((img->fmt & AOM_IMG_FMT_HIGHBITDEPTH) && img->bit_depth == 8)
204 img->stride, avctx->
pix_fmt, img->d_w, img->d_h);
213 aom_codec_destroy(&ctx->
decoder);
219 return aom_init(avctx, &aom_codec_av1_dx_algo);
223 .
name =
"libaom-av1",
233 .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