FFmpeg
libaomdec.c
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2010, Google, Inc.
3  *
4  * This file is part of FFmpeg.
5  *
6  * FFmpeg is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * FFmpeg is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with FFmpeg; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19  */
20 
21 /**
22  * @file
23  * AV1 decoder support via libaom
24  */
25 
26 #include <aom/aom_decoder.h>
27 #include <aom/aomdx.h>
28 
29 #include "libavutil/common.h"
30 #include "libavutil/cpu.h"
32 #include "libavutil/imgutils.h"
33 
34 #include "avcodec.h"
35 #include "bytestream.h"
36 #include "codec_internal.h"
37 #include "decode.h"
38 #include "itut35.h"
39 #include "libaom.h"
40 #include "profiles.h"
41 
42 typedef struct AV1DecodeContext {
43  struct aom_codec_ctx decoder;
45 
46 static av_cold int aom_init(AVCodecContext *avctx,
47  const struct aom_codec_iface *iface)
48 {
49  AV1DecodeContext *ctx = avctx->priv_data;
50  struct aom_codec_dec_cfg deccfg = {
51  .threads = FFMIN(avctx->thread_count ? avctx->thread_count : av_cpu_count(), 16)
52  };
53 
54  av_log(avctx, AV_LOG_VERBOSE, "%s\n", aom_codec_version_str());
55  av_log(avctx, AV_LOG_VERBOSE, "%s\n", aom_codec_build_config());
56 
57  if (aom_codec_dec_init(&ctx->decoder, iface, &deccfg, 0) != AOM_CODEC_OK) {
58  const char *error = aom_codec_error(&ctx->decoder);
59  av_log(avctx, AV_LOG_ERROR, "Failed to initialize decoder: %s\n",
60  error);
61  return AVERROR(EINVAL);
62  }
63 
64  return 0;
65 }
66 
67 // returns 0 on success, AVERROR_INVALIDDATA otherwise
68 static int set_pix_fmt(AVCodecContext *avctx, struct aom_image *img)
69 {
70  static const enum AVColorRange color_ranges[] = {
72  };
73  avctx->color_range = color_ranges[img->range];
74  avctx->color_primaries = img->cp;
75  avctx->colorspace = img->mc;
76  avctx->color_trc = img->tc;
77 
78  switch (img->fmt) {
79  case AOM_IMG_FMT_I420:
80  case AOM_IMG_FMT_I42016:
81  if (img->bit_depth == 8) {
82  avctx->pix_fmt = img->monochrome ?
85  return 0;
86  } else if (img->bit_depth == 10) {
87  avctx->pix_fmt = img->monochrome ?
90  return 0;
91  } else if (img->bit_depth == 12) {
92  avctx->pix_fmt = img->monochrome ?
95  return 0;
96  } else {
97  return AVERROR_INVALIDDATA;
98  }
99  case AOM_IMG_FMT_I422:
100  case AOM_IMG_FMT_I42216:
101  if (img->bit_depth == 8) {
102  avctx->pix_fmt = AV_PIX_FMT_YUV422P;
104  return 0;
105  } else if (img->bit_depth == 10) {
106  avctx->pix_fmt = AV_PIX_FMT_YUV422P10;
108  return 0;
109  } else if (img->bit_depth == 12) {
110  avctx->pix_fmt = AV_PIX_FMT_YUV422P12;
112  return 0;
113  } else {
114  return AVERROR_INVALIDDATA;
115  }
116  case AOM_IMG_FMT_I444:
117  case AOM_IMG_FMT_I44416:
118  if (img->bit_depth == 8) {
119  avctx->pix_fmt = avctx->colorspace == AVCOL_SPC_RGB ?
121  avctx->profile = AV_PROFILE_AV1_HIGH;
122  return 0;
123  } else if (img->bit_depth == 10) {
124  avctx->pix_fmt = AV_PIX_FMT_YUV444P10;
125  avctx->pix_fmt = avctx->colorspace == AVCOL_SPC_RGB ?
127  avctx->profile = AV_PROFILE_AV1_HIGH;
128  return 0;
129  } else if (img->bit_depth == 12) {
130  avctx->pix_fmt = avctx->colorspace == AVCOL_SPC_RGB ?
133  return 0;
134  } else {
135  return AVERROR_INVALIDDATA;
136  }
137 
138  default:
139  return AVERROR_INVALIDDATA;
140  }
141 }
142 
144  const uint8_t *buffer, size_t buffer_size)
145 {
146  if (buffer_size < 6)
147  return AVERROR(EINVAL);
148 
149  GetByteContext bc;
150  bytestream2_init(&bc, buffer, buffer_size);
151 
152  const int country_code = bytestream2_get_byteu(&bc);
153  const int provider_code = bytestream2_get_be16u(&bc);
154  const int provider_oriented_code = bytestream2_get_be16u(&bc);
155  const int application_identifier = bytestream2_get_byteu(&bc);
156 
157  // See "HDR10+ AV1 Metadata Handling Specification" v1.0.1, Section 2.1.
158  if (country_code == ITU_T_T35_COUNTRY_CODE_US
159  && provider_code == ITU_T_T35_PROVIDER_CODE_SAMSUNG
160  && provider_oriented_code == 0x0001
161  && application_identifier == 0x04) {
162  // HDR10+
164  if (!hdr_plus)
165  return AVERROR(ENOMEM);
166 
167  int res = av_dynamic_hdr_plus_from_t35(hdr_plus, bc.buffer,
169  if (res < 0)
170  return res;
171  }
172 
173  return 0;
174 }
175 
176 static int decode_metadata(AVFrame *frame, const struct aom_image *img)
177 {
178  const size_t num_metadata = aom_img_num_metadata(img);
179  for (size_t i = 0; i < num_metadata; ++i) {
180  const aom_metadata_t *metadata = aom_img_get_metadata(img, i);
181  if (!metadata)
182  continue;
183 
184  switch (metadata->type) {
185  case OBU_METADATA_TYPE_ITUT_T35: {
186  int res = decode_metadata_itu_t_t35(frame, metadata->payload, metadata->sz);
187  if (res < 0)
188  return res;
189  break;
190  }
191  default:
192  break;
193  }
194  }
195  return 0;
196 }
197 
198 static int aom_decode(AVCodecContext *avctx, AVFrame *picture,
199  int *got_frame, AVPacket *avpkt)
200 {
201  AV1DecodeContext *ctx = avctx->priv_data;
202  const void *iter = NULL;
203  struct aom_image *img;
204  int ret;
205 
206  if (aom_codec_decode(&ctx->decoder, avpkt->data, avpkt->size, NULL) !=
207  AOM_CODEC_OK) {
208  const char *error = aom_codec_error(&ctx->decoder);
209  const char *detail = aom_codec_error_detail(&ctx->decoder);
210 
211  av_log(avctx, AV_LOG_ERROR, "Failed to decode frame: %s\n", error);
212  if (detail)
213  av_log(avctx, AV_LOG_ERROR, " Additional information: %s\n",
214  detail);
215  return AVERROR_INVALIDDATA;
216  }
217 
218  if ((img = aom_codec_get_frame(&ctx->decoder, &iter))) {
219  if (img->d_w > img->w || img->d_h > img->h) {
220  av_log(avctx, AV_LOG_ERROR, "Display dimensions %dx%d exceed storage %dx%d\n",
221  img->d_w, img->d_h, img->w, img->h);
222  return AVERROR_EXTERNAL;
223  }
224 
225  if ((ret = set_pix_fmt(avctx, img)) < 0) {
226  av_log(avctx, AV_LOG_ERROR, "Unsupported output colorspace (%d) / bit_depth (%d)\n",
227  img->fmt, img->bit_depth);
228  return ret;
229  }
230 
231  if ((int)img->d_w != avctx->width || (int)img->d_h != avctx->height) {
232  av_log(avctx, AV_LOG_INFO, "dimension change! %dx%d -> %dx%d\n",
233  avctx->width, avctx->height, img->d_w, img->d_h);
234  ret = ff_set_dimensions(avctx, img->d_w, img->d_h);
235  if (ret < 0)
236  return ret;
237  }
238  if ((ret = ff_get_buffer(avctx, picture, 0)) < 0)
239  return ret;
240 
241 #ifdef AOM_CTRL_AOMD_GET_FRAME_FLAGS
242  {
243  aom_codec_frame_flags_t flags;
244  ret = aom_codec_control(&ctx->decoder, AOMD_GET_FRAME_FLAGS, &flags);
245  if (ret == AOM_CODEC_OK) {
246  if (flags & AOM_FRAME_IS_KEY)
247  picture->flags |= AV_FRAME_FLAG_KEY;
248  else
249  picture->flags &= ~AV_FRAME_FLAG_KEY;
250  if (flags & (AOM_FRAME_IS_KEY | AOM_FRAME_IS_INTRAONLY))
251  picture->pict_type = AV_PICTURE_TYPE_I;
252  else if (flags & AOM_FRAME_IS_SWITCH)
253  picture->pict_type = AV_PICTURE_TYPE_SP;
254  else
255  picture->pict_type = AV_PICTURE_TYPE_P;
256  }
257  }
258 #endif
259 
261  &picture->sample_aspect_ratio.den,
262  picture->height * img->r_w,
263  picture->width * img->r_h,
264  INT_MAX);
265  ff_set_sar(avctx, picture->sample_aspect_ratio);
266 
267  if ((img->fmt & AOM_IMG_FMT_HIGHBITDEPTH) && img->bit_depth == 8)
268  ff_aom_image_copy_16_to_8(picture, img);
269  else {
270  const uint8_t *planes[4] = { img->planes[0], img->planes[1], img->planes[2] };
271  const int stride[4] = { img->stride[0], img->stride[1], img->stride[2] };
272 
273  av_image_copy(picture->data, picture->linesize, planes,
274  stride, avctx->pix_fmt, img->d_w, img->d_h);
275  }
276  ret = decode_metadata(picture, img);
277  if (ret < 0) {
278  av_log(avctx, AV_LOG_ERROR, "Failed to decode metadata\n");
279  return ret;
280  }
281  *got_frame = 1;
282  }
283  return avpkt->size;
284 }
285 
286 static av_cold int aom_free(AVCodecContext *avctx)
287 {
288  AV1DecodeContext *ctx = avctx->priv_data;
289  aom_codec_destroy(&ctx->decoder);
290  return 0;
291 }
292 
293 static av_cold int av1_init(AVCodecContext *avctx)
294 {
295  return aom_init(avctx, aom_codec_av1_dx());
296 }
297 
299  .p.name = "libaom-av1",
300  CODEC_LONG_NAME("libaom AV1"),
301  .p.type = AVMEDIA_TYPE_VIDEO,
302  .p.id = AV_CODEC_ID_AV1,
303  .priv_data_size = sizeof(AV1DecodeContext),
304  .init = av1_init,
305  .close = aom_free,
307  .p.capabilities = AV_CODEC_CAP_OTHER_THREADS | AV_CODEC_CAP_DR1,
308  .caps_internal = FF_CODEC_CAP_NOT_INIT_THREADSAFE |
310  .p.profiles = NULL_IF_CONFIG_SMALL(ff_av1_profiles),
311  .p.wrapper_name = "libaom",
312 };
error
static void error(const char *err)
Definition: target_bsf_fuzzer.c:32
flags
const SwsFlags flags[]
Definition: swscale.c:61
aom_free
static av_cold int aom_free(AVCodecContext *avctx)
Definition: libaomdec.c:286
aom_init
static av_cold int aom_init(AVCodecContext *avctx, const struct aom_codec_iface *iface)
Definition: libaomdec.c:46
AVERROR
Filter the word β€œframe” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
bytestream2_get_bytes_left
static av_always_inline int bytestream2_get_bytes_left(const GetByteContext *g)
Definition: bytestream.h:158
AVCodecContext::colorspace
enum AVColorSpace colorspace
YUV colorspace type.
Definition: avcodec.h:659
GetByteContext
Definition: bytestream.h:33
metadata
Stream codec metadata
Definition: ogg-flac-chained-meta.txt:2
AVFrame
This structure describes decoded (raw) audio or video data.
Definition: frame.h:427
AVCodecContext::color_trc
enum AVColorTransferCharacteristic color_trc
Color Transfer Characteristic.
Definition: avcodec.h:652
AVFrame::width
int width
Definition: frame.h:499
AVCOL_RANGE_JPEG
@ AVCOL_RANGE_JPEG
Full range content.
Definition: pixfmt.h:767
AVPacket::data
uint8_t * data
Definition: packet.h:558
set_pix_fmt
static int set_pix_fmt(AVCodecContext *avctx, struct aom_image *img)
Definition: libaomdec.c:68
AV_PIX_FMT_YUV420P10
#define AV_PIX_FMT_YUV420P10
Definition: pixfmt.h:539
FF_CODEC_CAP_NOT_INIT_THREADSAFE
#define FF_CODEC_CAP_NOT_INIT_THREADSAFE
The codec is not known to be init-threadsafe (i.e.
Definition: codec_internal.h:34
FFCodec
Definition: codec_internal.h:127
AV_LOG_VERBOSE
#define AV_LOG_VERBOSE
Detailed information.
Definition: log.h:226
AVCOL_SPC_RGB
@ AVCOL_SPC_RGB
order of coefficients is actually GBR, also IEC 61966-2-1 (sRGB), YZX and ST 428-1
Definition: pixfmt.h:691
AVFrame::flags
int flags
Frame flags, a combination of AV_FRAME_FLAGS.
Definition: frame.h:671
AV_PROFILE_AV1_PROFESSIONAL
#define AV_PROFILE_AV1_PROFESSIONAL
Definition: defs.h:171
ff_set_dimensions
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.
Definition: utils.c:91
AVFrame::data
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
Definition: frame.h:448
close
static av_cold void close(AVCodecParserContext *s)
Definition: apv_parser.c:135
FFCodec::p
AVCodec p
The public AVCodec.
Definition: codec_internal.h:131
AVCodecContext::thread_count
int thread_count
thread count is used to decide how many independent tasks should be passed to execute()
Definition: avcodec.h:1561
AV_PIX_FMT_GBRP10
#define AV_PIX_FMT_GBRP10
Definition: pixfmt.h:558
av_reduce
int av_reduce(int *dst_num, int *dst_den, int64_t num, int64_t den, int64_t max)
Reduce a fraction.
Definition: rational.c:35
AVRational::num
int num
Numerator.
Definition: rational.h:59
AV_PIX_FMT_YUV444P10
#define AV_PIX_FMT_YUV444P10
Definition: pixfmt.h:542
AV1DecodeContext::decoder
struct aom_codec_ctx decoder
Definition: libaomdec.c:43
AVCodecContext::color_primaries
enum AVColorPrimaries color_primaries
Chromaticity coordinates of the source primaries.
Definition: avcodec.h:645
AV_LOG_ERROR
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:210
av_cold
#define av_cold
Definition: attributes.h:90
AV_FRAME_FLAG_KEY
#define AV_FRAME_FLAG_KEY
A flag to mark frames that are keyframes.
Definition: frame.h:642
FF_CODEC_DECODE_CB
#define FF_CODEC_DECODE_CB(func)
Definition: codec_internal.h:346
AV_CODEC_CAP_OTHER_THREADS
#define AV_CODEC_CAP_OTHER_THREADS
Codec supports multithreading through a method other than slice- or frame-level multithreading.
Definition: codec.h:109
GetByteContext::buffer
const uint8_t * buffer
Definition: bytestream.h:34
ctx
AVFormatContext * ctx
Definition: movenc.c:49
decode.h
ff_av1_profiles
const AVProfile ff_av1_profiles[]
Definition: profiles.c:163
AV_PIX_FMT_YUV420P
@ AV_PIX_FMT_YUV420P
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
Definition: pixfmt.h:73
CODEC_LONG_NAME
#define CODEC_LONG_NAME(str)
Definition: codec_internal.h:331
AV_PIX_FMT_GRAY10
#define AV_PIX_FMT_GRAY10
Definition: pixfmt.h:519
NULL
#define NULL
Definition: coverity.c:32
AVCodecContext::color_range
enum AVColorRange color_range
MPEG vs JPEG YUV range.
Definition: avcodec.h:669
AV_CODEC_ID_AV1
@ AV_CODEC_ID_AV1
Definition: codec_id.h:284
ff_libaom_av1_decoder
const FFCodec ff_libaom_av1_decoder
Definition: libaomdec.c:298
AV_PICTURE_TYPE_I
@ AV_PICTURE_TYPE_I
Intra.
Definition: avutil.h:278
profiles.h
ff_set_sar
int ff_set_sar(AVCodecContext *avctx, AVRational sar)
Check that the provided sample aspect ratio is valid and set it on the codec context.
Definition: utils.c:106
AV_PIX_FMT_YUV422P10
#define AV_PIX_FMT_YUV422P10
Definition: pixfmt.h:540
AV_PIX_FMT_GRAY8
@ AV_PIX_FMT_GRAY8
Y , 8bpp.
Definition: pixfmt.h:81
AV_PICTURE_TYPE_SP
@ AV_PICTURE_TYPE_SP
Switching Predicted.
Definition: avutil.h:283
av_cpu_count
int av_cpu_count(void)
Definition: cpu.c:221
AVFrame::pict_type
enum AVPictureType pict_type
Picture type of the frame.
Definition: frame.h:519
ff_get_buffer
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
Get a buffer for a frame.
Definition: decode.c:1720
init
int(* init)(AVBSFContext *ctx)
Definition: dts2pts.c:368
AV_CODEC_CAP_DR1
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators.
Definition: codec.h:52
AVPacket::size
int size
Definition: packet.h:559
NULL_IF_CONFIG_SMALL
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
Definition: internal.h:94
av1_init
static av_cold int av1_init(AVCodecContext *avctx)
Definition: libaomdec.c:293
codec_internal.h
cpu.h
AV_PIX_FMT_YUV422P12
#define AV_PIX_FMT_YUV422P12
Definition: pixfmt.h:544
planes
static const struct @522 planes[]
AV_PIX_FMT_YUV444P12
#define AV_PIX_FMT_YUV444P12
Definition: pixfmt.h:546
aom_decode
static int aom_decode(AVCodecContext *avctx, AVFrame *picture, int *got_frame, AVPacket *avpkt)
Definition: libaomdec.c:198
img
#define img
Definition: vf_colormatrix.c:114
AVERROR_EXTERNAL
#define AVERROR_EXTERNAL
Generic error in an external library.
Definition: error.h:59
AV_PROFILE_AV1_HIGH
#define AV_PROFILE_AV1_HIGH
Definition: defs.h:170
AV_LOG_INFO
#define AV_LOG_INFO
Standard information.
Definition: log.h:221
i
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:256
AV_PIX_FMT_GBRP12
#define AV_PIX_FMT_GBRP12
Definition: pixfmt.h:559
common.h
FFMIN
#define FFMIN(a, b)
Definition: macros.h:49
AVCodec::name
const char * name
Name of the codec implementation.
Definition: codec.h:179
AVCodecContext::height
int height
Definition: avcodec.h:592
AVCodecContext::pix_fmt
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
Definition: avcodec.h:631
AVCOL_RANGE_MPEG
@ AVCOL_RANGE_MPEG
Narrow or limited range content.
Definition: pixfmt.h:750
AVDynamicHDRPlus
This struct represents dynamic metadata for color volume transform - application 4 of SMPTE 2094-40:2...
Definition: hdr_dynamic_metadata.h:243
avcodec.h
stride
#define stride
Definition: h264pred_template.c:536
av_dynamic_hdr_plus_create_side_data
AVDynamicHDRPlus * av_dynamic_hdr_plus_create_side_data(AVFrame *frame)
Allocate a complete AVDynamicHDRPlus and add it to the frame.
Definition: hdr_dynamic_metadata.c:48
ret
ret
Definition: filter_design.txt:187
frame
these buffered frames must be flushed immediately if a new input produces new the filter must not call request_frame to get more It must just process the frame or queue it The task of requesting more frames is left to the filter s request_frame method or the application If a filter has several the filter must be ready for frames arriving randomly on any input any filter with several inputs will most likely require some kind of queuing mechanism It is perfectly acceptable to have a limited queue and to drop frames when the inputs are too unbalanced request_frame For filters that do not use the this method is called when a frame is wanted on an output For a it should directly call filter_frame on the corresponding output For a if there are queued frames already one of these frames should be pushed If the filter should request a frame on one of its repeatedly until at least one frame has been pushed Return or at least make progress towards producing a frame
Definition: filter_design.txt:265
AVFrame::sample_aspect_ratio
AVRational sample_aspect_ratio
Sample aspect ratio for the video frame, 0/1 if unknown/unspecified.
Definition: frame.h:524
AV_PIX_FMT_YUV420P12
#define AV_PIX_FMT_YUV420P12
Definition: pixfmt.h:543
AVCodecContext
main external API structure.
Definition: avcodec.h:431
AVFrame::height
int height
Definition: frame.h:499
itut35.h
buffer
the frame and frame reference mechanism is intended to as much as expensive copies of that data while still allowing the filters to produce correct results The data is stored in buffers represented by AVFrame structures Several references can point to the same frame buffer
Definition: filter_design.txt:49
AVRational::den
int den
Denominator.
Definition: rational.h:60
AVCodecContext::profile
int profile
profile
Definition: avcodec.h:1618
AV1DecodeContext
Definition: libaomdec.c:42
hdr_dynamic_metadata.h
AV_PIX_FMT_YUV444P
@ AV_PIX_FMT_YUV444P
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
Definition: pixfmt.h:78
AV_PIX_FMT_GBRP
@ AV_PIX_FMT_GBRP
planar GBR 4:4:4 24bpp
Definition: pixfmt.h:165
AV_PICTURE_TYPE_P
@ AV_PICTURE_TYPE_P
Predicted.
Definition: avutil.h:279
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:200
AV_PIX_FMT_YUV422P
@ AV_PIX_FMT_YUV422P
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
Definition: pixfmt.h:77
FF_CODEC_CAP_AUTO_THREADS
#define FF_CODEC_CAP_AUTO_THREADS
Codec handles avctx->thread_count == 0 (auto) internally.
Definition: codec_internal.h:72
ITU_T_T35_COUNTRY_CODE_US
#define ITU_T_T35_COUNTRY_CODE_US
Definition: itut35.h:24
ff_aom_image_copy_16_to_8
void ff_aom_image_copy_16_to_8(AVFrame *pic, struct aom_image *img)
Definition: libaom.c:27
AVPacket
This structure stores compressed data.
Definition: packet.h:535
AVCodecContext::priv_data
void * priv_data
Definition: avcodec.h:458
decode_metadata_itu_t_t35
static int decode_metadata_itu_t_t35(AVFrame *frame, const uint8_t *buffer, size_t buffer_size)
Definition: libaomdec.c:143
av_dynamic_hdr_plus_from_t35
int av_dynamic_hdr_plus_from_t35(AVDynamicHDRPlus *s, const uint8_t *data, size_t size)
Parse the user data registered ITU-T T.35 to AVbuffer (AVDynamicHDRPlus).
Definition: hdr_dynamic_metadata.c:61
AVCodecContext::width
int width
picture width / height.
Definition: avcodec.h:592
bytestream.h
imgutils.h
bytestream2_init
static av_always_inline void bytestream2_init(GetByteContext *g, const uint8_t *buf, int buf_size)
Definition: bytestream.h:137
AVFrame::linesize
int linesize[AV_NUM_DATA_POINTERS]
For video, a positive or negative value, which is typically indicating the size in bytes of each pict...
Definition: frame.h:472
av_log
#define av_log(a,...)
Definition: tableprint_vlc.h:27
ITU_T_T35_PROVIDER_CODE_SAMSUNG
#define ITU_T_T35_PROVIDER_CODE_SAMSUNG
Definition: itut35.h:41
AVERROR_INVALIDDATA
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
Definition: error.h:61
AV_PIX_FMT_GRAY12
#define AV_PIX_FMT_GRAY12
Definition: pixfmt.h:520
av_image_copy
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.
Definition: imgutils.c:422
libaom.h
AV_PROFILE_AV1_MAIN
#define AV_PROFILE_AV1_MAIN
Definition: defs.h:169
AVColorRange
AVColorRange
Visual content value range.
Definition: pixfmt.h:732
decode_metadata
static int decode_metadata(AVFrame *frame, const struct aom_image *img)
Definition: libaomdec.c:176