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) {
52 const char *
error = aom_codec_error(&
ctx->decoder);
66 for (
i = 0;
i <
desc->nb_components;
i++) {
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) {
104 }
else if (
img->bit_depth == 10) {
109 }
else if (
img->bit_depth == 12) {
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;
168 const char *
error = aom_codec_error(&
ctx->decoder);
169 const char *detail = aom_codec_error_detail(&
ctx->decoder);
178 if ((
img = aom_codec_get_frame(&
ctx->decoder, &iter))) {
187 img->fmt,
img->bit_depth);
208 if ((
img->fmt & AOM_IMG_FMT_HIGHBITDEPTH) &&
img->bit_depth == 8)
221 aom_codec_destroy(&
ctx->decoder);
227 return aom_init(avctx, &aom_codec_av1_dx_algo);
231 .
name =
"libaom-av1",
242 .wrapper_name =
"libaom",
Libavcodec external API header.
#define FF_PROFILE_AV1_HIGH
#define FF_PROFILE_AV1_MAIN
#define FF_PROFILE_AV1_PROFESSIONAL
static av_cold int init(AVCodecContext *avctx)
common internal and external API header
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
Get a buffer for a frame.
static void decode(AVCodecContext *dec_ctx, AVPacket *pkt, AVFrame *frame, FILE *outfile)
#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_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 *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.
static void 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 aom_decode(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
AVCodec ff_libaom_av1_decoder
static av_cold int aom_free(AVCodecContext *avctx)
static av_cold int aom_init(AVCodecContext *avctx, const struct aom_codec_iface *iface)
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)
Check that the provided frame dimensions are valid and set them on the codec context.
#define FF_CODEC_CAP_AUTO_THREADS
Codec handles avctx->thread_count == 0 (auto) internally.
common internal API header
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
static const AVProfile profiles[]
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
#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_YUV422P10
#define AV_PIX_FMT_GRAY12
@ 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)
#define AV_PIX_FMT_GRAY10
#define AV_PIX_FMT_YUV444P10
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.
const char * name
Name of the codec implementation.
This structure describes decoded (raw) audio or video data.
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
AVRational sample_aspect_ratio
Sample aspect ratio for the video frame, 0/1 if unknown/unspecified.
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
int format
format of the frame, -1 if unknown or unset Values correspond to enum AVPixelFormat for video frames,...
This structure stores compressed data.
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
static void error(const char *err)