FFmpeg
libvpxdec.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  * VP8/9 decoder support via libvpx
24  */
25 
26 #include "config_components.h"
27 
28 #define VPX_CODEC_DISABLE_COMPAT 1
29 #include <vpx/vpx_decoder.h>
30 #include <vpx/vpx_frame_buffer.h>
31 #include <vpx/vp8dx.h>
32 
33 #include "libavutil/common.h"
34 #include "libavutil/cpu.h"
35 #include "libavutil/imgutils.h"
36 #include "libavutil/intreadwrite.h"
37 #include "avcodec.h"
38 #include "codec_internal.h"
39 #include "decode.h"
40 #include "libvpx.h"
41 #include "profiles.h"
42 
43 typedef struct VPxDecoderContext {
44  const struct vpx_codec_iface *iface;
45  struct vpx_codec_ctx decoder;
46  struct vpx_codec_ctx decoder_alpha;
48  size_t pool_size;
50 } VPxContext;
51 
52 
53 static int get_frame_buffer(void *priv, size_t min_size, vpx_codec_frame_buffer_t *fb)
54 {
55  VPxContext *ctx = priv;
56  AVBufferRef *buf;
57 
58  if (min_size > ctx->pool_size) {
59  av_buffer_pool_uninit(&ctx->pool);
60  /* According to the libvpx docs the buffer must be zeroed out. */
61  ctx->pool = av_buffer_pool_init(min_size, av_buffer_allocz);
62  if (!ctx->pool) {
63  ctx->pool_size = 0;
64  return AVERROR(ENOMEM);
65  }
66  ctx->pool_size = min_size;
67  }
68 
69  buf = av_buffer_pool_get(ctx->pool);
70  if (!buf)
71  return AVERROR(ENOMEM);
72 
73  fb->priv = buf;
74  fb->size = ctx->pool_size;
75  fb->data = buf->data;
76 
77  return 0;
78 }
79 
80 static int release_frame_buffer(void *priv, vpx_codec_frame_buffer_t *fb)
81 {
82  AVBufferRef *buf = fb->priv;
83  av_buffer_unref(&buf);
84  return 0;
85 }
86 
87 static av_cold int vpx_init(AVCodecContext *avctx,
88  struct vpx_codec_ctx* decoder)
89 {
90  VPxContext *ctx = avctx->priv_data;
91  struct vpx_codec_dec_cfg deccfg = {
92  .threads = FFMIN(avctx->thread_count ? avctx->thread_count : av_cpu_count(), MAX_VPX_THREADS)
93  };
94 
95  av_log(avctx, AV_LOG_INFO, "%s\n", vpx_codec_version_str());
96  av_log(avctx, AV_LOG_VERBOSE, "%s\n", vpx_codec_build_config());
97 
98  if (vpx_codec_dec_init(decoder, ctx->iface, &deccfg, 0) != VPX_CODEC_OK) {
99  const char *error = vpx_codec_error(decoder);
100  av_log(avctx, AV_LOG_ERROR, "Failed to initialize decoder: %s\n",
101  error);
102  return AVERROR(EINVAL);
103  }
104 
105  if (vpx_codec_get_caps(ctx->iface) & VPX_CODEC_CAP_EXTERNAL_FRAME_BUFFER) {
106  if (vpx_codec_set_frame_buffer_functions(decoder, get_frame_buffer, release_frame_buffer, avctx->priv_data)) {
107  vpx_codec_destroy(decoder);
108  av_log(avctx, AV_LOG_ERROR, "Failed to set frame buffer.\n");
109  return AVERROR_EXTERNAL;
110  }
111  }
112 
113  return 0;
114 }
115 
116 // returns 0 on success, AVERROR_INVALIDDATA otherwise
117 static int set_pix_fmt(AVCodecContext *avctx, struct vpx_image *img,
118  int has_alpha_channel)
119 {
120  static const enum AVColorSpace colorspaces[8] = {
123  };
124 #if VPX_IMAGE_ABI_VERSION >= 4
125  static const enum AVColorRange color_ranges[] = {
127  };
128  avctx->color_range = color_ranges[img->range];
129 #endif
130  avctx->colorspace = colorspaces[img->cs];
131  if (avctx->codec_id == AV_CODEC_ID_VP8 && img->fmt != VPX_IMG_FMT_I420)
132  return AVERROR_INVALIDDATA;
133  switch (img->fmt) {
134  case VPX_IMG_FMT_I420:
135  if (avctx->codec_id == AV_CODEC_ID_VP9)
136  avctx->profile = AV_PROFILE_VP9_0;
137  avctx->pix_fmt =
138  has_alpha_channel ? AV_PIX_FMT_YUVA420P : AV_PIX_FMT_YUV420P;
139  return 0;
140 #if CONFIG_LIBVPX_VP9_DECODER
141  case VPX_IMG_FMT_I422:
142  avctx->profile = AV_PROFILE_VP9_1;
143  avctx->pix_fmt = AV_PIX_FMT_YUV422P;
144  return 0;
145  case VPX_IMG_FMT_I440:
146  avctx->profile = AV_PROFILE_VP9_1;
147  avctx->pix_fmt = AV_PIX_FMT_YUV440P;
148  return 0;
149  case VPX_IMG_FMT_I444:
150  avctx->profile = AV_PROFILE_VP9_1;
151  avctx->pix_fmt = avctx->colorspace == AVCOL_SPC_RGB ?
153  return 0;
154  case VPX_IMG_FMT_I42016:
155  avctx->profile = AV_PROFILE_VP9_2;
156  if (img->bit_depth == 10) {
157  avctx->pix_fmt = AV_PIX_FMT_YUV420P10;
158  return 0;
159  } else if (img->bit_depth == 12) {
160  avctx->pix_fmt = AV_PIX_FMT_YUV420P12;
161  return 0;
162  } else {
163  return AVERROR_INVALIDDATA;
164  }
165  case VPX_IMG_FMT_I42216:
166  avctx->profile = AV_PROFILE_VP9_3;
167  if (img->bit_depth == 10) {
168  avctx->pix_fmt = AV_PIX_FMT_YUV422P10;
169  return 0;
170  } else if (img->bit_depth == 12) {
171  avctx->pix_fmt = AV_PIX_FMT_YUV422P12;
172  return 0;
173  } else {
174  return AVERROR_INVALIDDATA;
175  }
176  case VPX_IMG_FMT_I44016:
177  avctx->profile = AV_PROFILE_VP9_3;
178  if (img->bit_depth == 10) {
179  avctx->pix_fmt = AV_PIX_FMT_YUV440P10;
180  return 0;
181  } else if (img->bit_depth == 12) {
182  avctx->pix_fmt = AV_PIX_FMT_YUV440P12;
183  return 0;
184  } else {
185  return AVERROR_INVALIDDATA;
186  }
187  case VPX_IMG_FMT_I44416:
188  avctx->profile = AV_PROFILE_VP9_3;
189  if (img->bit_depth == 10) {
190  avctx->pix_fmt = avctx->colorspace == AVCOL_SPC_RGB ?
192  return 0;
193  } else if (img->bit_depth == 12) {
194  avctx->pix_fmt = avctx->colorspace == AVCOL_SPC_RGB ?
196  return 0;
197  } else {
198  return AVERROR_INVALIDDATA;
199  }
200 #endif
201  default:
202  return AVERROR_INVALIDDATA;
203  }
204 }
205 
206 static int decode_frame(AVCodecContext *avctx, vpx_codec_ctx_t *decoder,
207  const uint8_t *data, uint32_t data_sz)
208 {
209  if (vpx_codec_decode(decoder, data, data_sz, NULL, 0) != VPX_CODEC_OK) {
210  const char *error = vpx_codec_error(decoder);
211  const char *detail = vpx_codec_error_detail(decoder);
212 
213  av_log(avctx, AV_LOG_ERROR, "Failed to decode frame: %s\n", error);
214  if (detail) {
215  av_log(avctx, AV_LOG_ERROR, " Additional information: %s\n",
216  detail);
217  }
218  return AVERROR_INVALIDDATA;
219  }
220  return 0;
221 }
222 
223 static int vpx_decode(AVCodecContext *avctx, AVFrame *picture,
224  int *got_frame, AVPacket *avpkt)
225 {
226  VPxContext *ctx = avctx->priv_data;
227  const void *iter = NULL;
228  const void *iter_alpha = NULL;
229  struct vpx_image *img, *img_alpha;
230  int ret;
231  uint8_t *side_data = NULL;
232  size_t side_data_size;
233 
234  ret = decode_frame(avctx, &ctx->decoder, avpkt->data, avpkt->size);
235  if (ret)
236  return ret;
237 
238  side_data = av_packet_get_side_data(avpkt,
240  &side_data_size);
241  if (side_data_size >= 8) {
242  const uint64_t additional_id = AV_RB64(side_data);
243  side_data += 8;
244  side_data_size -= 8;
245  if (additional_id == 1) { // 1 stands for alpha channel data.
246  if (!ctx->has_alpha_channel) {
247  ctx->has_alpha_channel = 1;
248  ret = vpx_init(avctx, &ctx->decoder_alpha);
249  if (ret)
250  return ret;
251  }
252  ret = decode_frame(avctx, &ctx->decoder_alpha, side_data,
253  side_data_size);
254  if (ret)
255  return ret;
256  }
257  }
258 
259  if ((img = vpx_codec_get_frame(&ctx->decoder, &iter)) &&
260  (!ctx->has_alpha_channel ||
261  (img_alpha = vpx_codec_get_frame(&ctx->decoder_alpha, &iter_alpha)))) {
262  uint8_t *planes[4];
263  int linesizes[4];
264 
265  if (img->d_w > img->w || img->d_h > img->h) {
266  av_log(avctx, AV_LOG_ERROR, "Display dimensions %dx%d exceed storage %dx%d\n",
267  img->d_w, img->d_h, img->w, img->h);
268  return AVERROR_EXTERNAL;
269  }
270 
271  if ((ret = set_pix_fmt(avctx, img, ctx->has_alpha_channel)) < 0) {
272  av_log(avctx, AV_LOG_ERROR, "Unsupported output colorspace (%d) / bit_depth (%d)\n",
273  img->fmt, img->bit_depth);
274  return ret;
275  }
276 
277  if ((int) img->d_w != avctx->width || (int) img->d_h != avctx->height) {
278  av_log(avctx, AV_LOG_INFO, "dimension change! %dx%d -> %dx%d\n",
279  avctx->width, avctx->height, img->d_w, img->d_h);
280  ret = ff_set_dimensions(avctx, img->d_w, img->d_h);
281  if (ret < 0)
282  return ret;
283  }
284 
285  if (ctx->has_alpha_channel &&
286  (img->d_w != img_alpha->d_w ||
287  img->d_h != img_alpha->d_h ||
288  img->bit_depth != img_alpha->bit_depth)) {
289  av_log(avctx, AV_LOG_ERROR,
290  "Video dimensions %dx%d@%dbpc differ from alpha dimensions %dx%d@%dbpc\n",
291  img->d_w, img->d_h, img->bit_depth,
292  img_alpha->d_w, img_alpha->d_h, img_alpha->bit_depth);
293  return AVERROR_INVALIDDATA;
294  }
295 
296  planes[0] = img->planes[VPX_PLANE_Y];
297  planes[1] = img->planes[VPX_PLANE_U];
298  planes[2] = img->planes[VPX_PLANE_V];
299  planes[3] =
300  ctx->has_alpha_channel ? img_alpha->planes[VPX_PLANE_Y] : NULL;
301  linesizes[0] = img->stride[VPX_PLANE_Y];
302  linesizes[1] = img->stride[VPX_PLANE_U];
303  linesizes[2] = img->stride[VPX_PLANE_V];
304  linesizes[3] =
305  ctx->has_alpha_channel ? img_alpha->stride[VPX_PLANE_Y] : 0;
306 
307  if (vpx_codec_get_caps(ctx->iface) & VPX_CODEC_CAP_EXTERNAL_FRAME_BUFFER) {
308  ret = ff_decode_frame_props(avctx, picture);
309  if (ret < 0)
310  return ret;
311  picture->buf[0] = av_buffer_ref(img->fb_priv);
312  if (!picture->buf[0])
313  return AVERROR(ENOMEM);
314  if (ctx->has_alpha_channel) {
315  picture->buf[1] = av_buffer_ref(img_alpha->fb_priv);
316  if (!picture->buf[1])
317  return AVERROR(ENOMEM);
318  }
319  for (int i = 0; i < 4; i++) {
320  picture->data[i] = planes[i];
321  picture->linesize[i] = linesizes[i];
322  }
323  } else {
324  if ((ret = ff_get_buffer(avctx, picture, 0)) < 0)
325  return ret;
326  av_image_copy2(picture->data, picture->linesize, planes,
327  linesizes, avctx->pix_fmt, img->d_w, img->d_h);
328  }
329  *got_frame = 1;
330  }
331  return avpkt->size;
332 }
333 
334 static av_cold int vpx_free(AVCodecContext *avctx)
335 {
336  VPxContext *ctx = avctx->priv_data;
337  vpx_codec_destroy(&ctx->decoder);
338  if (ctx->has_alpha_channel)
339  vpx_codec_destroy(&ctx->decoder_alpha);
340  av_buffer_pool_uninit(&ctx->pool);
341  return 0;
342 }
343 
344 #if CONFIG_LIBVPX_VP8_DECODER
345 static av_cold int vp8_init(AVCodecContext *avctx)
346 {
347  VPxContext *ctx = avctx->priv_data;
348  ctx->iface = vpx_codec_vp8_dx();
349  return vpx_init(avctx, &ctx->decoder);
350 }
351 
353  .p.name = "libvpx",
354  CODEC_LONG_NAME("libvpx VP8"),
355  .p.type = AVMEDIA_TYPE_VIDEO,
356  .p.id = AV_CODEC_ID_VP8,
357  .p.capabilities = AV_CODEC_CAP_OTHER_THREADS | AV_CODEC_CAP_DR1,
358  .p.wrapper_name = "libvpx",
359  .priv_data_size = sizeof(VPxContext),
360  .init = vp8_init,
361  .close = vpx_free,
363  .caps_internal = FF_CODEC_CAP_NOT_INIT_THREADSAFE |
365 };
366 #endif /* CONFIG_LIBVPX_VP8_DECODER */
367 
368 #if CONFIG_LIBVPX_VP9_DECODER
369 static av_cold int vp9_init(AVCodecContext *avctx)
370 {
371  VPxContext *ctx = avctx->priv_data;
372  ctx->iface = vpx_codec_vp9_dx();
373  return vpx_init(avctx, &ctx->decoder);
374 }
375 
377  .p.name = "libvpx-vp9",
378  CODEC_LONG_NAME("libvpx VP9"),
379  .p.type = AVMEDIA_TYPE_VIDEO,
380  .p.id = AV_CODEC_ID_VP9,
381  .p.capabilities = AV_CODEC_CAP_OTHER_THREADS,
382  .p.profiles = NULL_IF_CONFIG_SMALL(ff_vp9_profiles),
383  .p.wrapper_name = "libvpx",
384  .priv_data_size = sizeof(VPxContext),
385  .init = vp9_init,
386  .close = vpx_free,
388  .caps_internal = FF_CODEC_CAP_NOT_INIT_THREADSAFE |
390 };
391 #endif /* CONFIG_LIBVPX_VP9_DECODER */
error
static void error(const char *err)
Definition: target_bsf_fuzzer.c:32
fb
#define fb(width, name)
Definition: cbs_av1.c:617
av_buffer_pool_init
AVBufferPool * av_buffer_pool_init(size_t size, AVBufferRef *(*alloc)(size_t size))
Allocate and initialize a buffer pool.
Definition: buffer.c:283
vp9_init
static av_cold int vp9_init(AVFormatContext *ctx, int st_index, PayloadContext *data)
Definition: rtpdec_vp9.c:34
ff_libvpx_vp8_decoder
const FFCodec ff_libvpx_vp8_decoder
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
decode_frame
static int decode_frame(AVCodecContext *avctx, vpx_codec_ctx_t *decoder, const uint8_t *data, uint32_t data_sz)
Definition: libvpxdec.c:206
AVCodecContext::colorspace
enum AVColorSpace colorspace
YUV colorspace type.
Definition: avcodec.h:667
AVBufferPool
The buffer pool.
Definition: buffer_internal.h:88
AVBufferRef::data
uint8_t * data
The data buffer.
Definition: buffer.h:90
VPxDecoderContext::iface
const struct vpx_codec_iface * iface
Definition: libvpxdec.c:44
AV_PROFILE_VP9_1
#define AV_PROFILE_VP9_1
Definition: defs.h:155
AVFrame
This structure describes decoded (raw) audio or video data.
Definition: frame.h:427
AVCOL_RANGE_JPEG
@ AVCOL_RANGE_JPEG
Full range content.
Definition: pixfmt.h:777
AVPacket::data
uint8_t * data
Definition: packet.h:588
release_frame_buffer
static int release_frame_buffer(void *priv, vpx_codec_frame_buffer_t *fb)
Definition: libvpxdec.c:80
data
const char data[16]
Definition: mxf.c:149
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:701
AV_PIX_FMT_YUV440P
@ AV_PIX_FMT_YUV440P
planar YUV 4:4:0 (1 Cr & Cb sample per 1x2 Y samples)
Definition: pixfmt.h:106
av_buffer_ref
AVBufferRef * av_buffer_ref(const AVBufferRef *buf)
Create a new reference to an AVBuffer.
Definition: buffer.c:103
AVFrame::buf
AVBufferRef * buf[AV_NUM_DATA_POINTERS]
AVBuffer references backing the data for this frame.
Definition: frame.h:604
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
VPxDecoderContext
Definition: libvpxdec.c:43
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:197
AVCOL_SPC_BT470BG
@ AVCOL_SPC_BT470BG
also ITU-R BT601-6 625 / ITU-R BT1358 625 / ITU-R BT1700 625 PAL & SECAM / IEC 61966-2-4 xvYCC601
Definition: pixfmt.h:706
AVCOL_SPC_RESERVED
@ AVCOL_SPC_RESERVED
reserved for future use by ITU-T and ISO/IEC just like 15-255 are
Definition: pixfmt.h:704
decoder
static const chunk_decoder decoder[8]
Definition: dfa.c:331
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:1569
AV_PIX_FMT_GBRP10
#define AV_PIX_FMT_GBRP10
Definition: pixfmt.h:558
set_pix_fmt
static int set_pix_fmt(AVCodecContext *avctx, struct vpx_image *img, int has_alpha_channel)
Definition: libvpxdec.c:117
AV_PROFILE_VP9_3
#define AV_PROFILE_VP9_3
Definition: defs.h:157
AV_PIX_FMT_YUV444P10
#define AV_PIX_FMT_YUV444P10
Definition: pixfmt.h:542
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:106
av_buffer_pool_get
AVBufferRef * av_buffer_pool_get(AVBufferPool *pool)
Allocate a new AVBuffer, reusing an old buffer from the pool when available.
Definition: buffer.c:390
VPxDecoderContext::has_alpha_channel
int has_alpha_channel
Definition: libvpxdec.c:49
FF_CODEC_DECODE_CB
#define FF_CODEC_DECODE_CB(func)
Definition: codec_internal.h:347
intreadwrite.h
AV_PIX_FMT_YUVA420P
@ AV_PIX_FMT_YUVA420P
planar YUV 4:2:0, 20bpp, (1 Cr & Cb sample per 2x2 Y & A samples)
Definition: pixfmt.h:108
AVCOL_SPC_SMPTE170M
@ AVCOL_SPC_SMPTE170M
also ITU-R BT601-6 525 / ITU-R BT1358 525 / ITU-R BT1700 NTSC / functionally identical to above
Definition: pixfmt.h:707
AV_CODEC_ID_VP9
@ AV_CODEC_ID_VP9
Definition: codec_id.h:222
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
ff_libvpx_vp9_decoder
const FFCodec ff_libvpx_vp9_decoder
ctx
AVFormatContext * ctx
Definition: movenc.c:49
decode.h
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
MAX_VPX_THREADS
#define MAX_VPX_THREADS
Definition: libvpx.h:24
CODEC_LONG_NAME
#define CODEC_LONG_NAME(str)
Definition: codec_internal.h:332
AVCodecContext::codec_id
enum AVCodecID codec_id
Definition: avcodec.h:449
vpx_decode
static int vpx_decode(AVCodecContext *avctx, AVFrame *picture, int *got_frame, AVPacket *avpkt)
Definition: libvpxdec.c:223
NULL
#define NULL
Definition: coverity.c:32
VPxDecoderContext::pool
AVBufferPool * pool
Definition: libvpxdec.c:47
AVCodecContext::color_range
enum AVColorRange color_range
MPEG vs JPEG YUV range.
Definition: avcodec.h:677
av_buffer_unref
void av_buffer_unref(AVBufferRef **buf)
Free a given reference and automatically free the buffer if there are no more references to it.
Definition: buffer.c:139
profiles.h
av_buffer_pool_uninit
void av_buffer_pool_uninit(AVBufferPool **ppool)
Mark the pool as being available for freeing.
Definition: buffer.c:328
AV_PIX_FMT_YUV440P10
#define AV_PIX_FMT_YUV440P10
Definition: pixfmt.h:541
vpx_free
static av_cold int vpx_free(AVCodecContext *avctx)
Definition: libvpxdec.c:334
AV_PIX_FMT_YUV422P10
#define AV_PIX_FMT_YUV422P10
Definition: pixfmt.h:540
av_cpu_count
int av_cpu_count(void)
Definition: cpu.c:224
VPxDecoderContext::decoder
struct vpx_codec_ctx decoder
Definition: libvpxdec.c:45
ff_get_buffer
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
Get a buffer for a frame.
Definition: decode.c:1729
init
int(* init)(AVBSFContext *ctx)
Definition: dts2pts.c:550
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:589
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
codec_internal.h
cpu.h
AV_PIX_FMT_YUV422P12
#define AV_PIX_FMT_YUV422P12
Definition: pixfmt.h:544
AV_PIX_FMT_YUV444P12
#define AV_PIX_FMT_YUV444P12
Definition: pixfmt.h:546
img
#define img
Definition: vf_colormatrix.c:114
AVERROR_EXTERNAL
#define AVERROR_EXTERNAL
Generic error in an external library.
Definition: error.h:59
AV_LOG_INFO
#define AV_LOG_INFO
Standard information.
Definition: log.h:221
AVCOL_SPC_SMPTE240M
@ AVCOL_SPC_SMPTE240M
derived from 170M primaries and D65 white point, 170M is derived from BT470 System M's primaries
Definition: pixfmt.h:708
i
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:256
AVCOL_SPC_BT2020_NCL
@ AVCOL_SPC_BT2020_NCL
ITU-R BT2020 non-constant luminance system.
Definition: pixfmt.h:711
av_packet_get_side_data
uint8_t * av_packet_get_side_data(const AVPacket *pkt, enum AVPacketSideDataType type, size_t *size)
Get side information from packet.
Definition: packet.c:252
AV_PIX_FMT_GBRP12
#define AV_PIX_FMT_GBRP12
Definition: pixfmt.h:559
AVColorSpace
AVColorSpace
YUV colorspace type.
Definition: pixfmt.h:700
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
VPxDecoderContext::decoder_alpha
struct vpx_codec_ctx decoder_alpha
Definition: libvpxdec.c:46
AVCOL_SPC_UNSPECIFIED
@ AVCOL_SPC_UNSPECIFIED
Definition: pixfmt.h:703
AVCodecContext::height
int height
Definition: avcodec.h:600
AVCodecContext::pix_fmt
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
Definition: avcodec.h:639
AVCOL_RANGE_MPEG
@ AVCOL_RANGE_MPEG
Narrow or limited range content.
Definition: pixfmt.h:760
avcodec.h
AV_PKT_DATA_MATROSKA_BLOCKADDITIONAL
@ AV_PKT_DATA_MATROSKA_BLOCKADDITIONAL
Data found in BlockAdditional element of matroska container.
Definition: packet.h:188
av_buffer_allocz
AVBufferRef * av_buffer_allocz(size_t size)
Same as av_buffer_alloc(), except the returned buffer will be initialized to zero.
Definition: buffer.c:93
AV_PROFILE_VP9_2
#define AV_PROFILE_VP9_2
Definition: defs.h:156
ret
ret
Definition: filter_design.txt:187
AV_PIX_FMT_YUV420P12
#define AV_PIX_FMT_YUV420P12
Definition: pixfmt.h:543
ff_decode_frame_props
int ff_decode_frame_props(AVCodecContext *avctx, AVFrame *frame)
Set various frame properties from the codec context / packet data.
Definition: decode.c:1571
AVCodecContext
main external API structure.
Definition: avcodec.h:439
planes
static const struct @549 planes[]
av_image_copy2
static void av_image_copy2(uint8_t *const dst_data[4], const int dst_linesizes[4], uint8_t *const src_data[4], const int src_linesizes[4], enum AVPixelFormat pix_fmt, int width, int height)
Wrapper around av_image_copy() to workaround the limitation that the conversion from uint8_t * const ...
Definition: imgutils.h:184
AVCodecContext::profile
int profile
profile
Definition: avcodec.h:1626
get_frame_buffer
static int get_frame_buffer(void *priv, size_t min_size, vpx_codec_frame_buffer_t *fb)
Definition: libvpxdec.c:53
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_PROFILE_VP9_0
#define AV_PROFILE_VP9_0
Definition: defs.h:154
VPxDecoderContext::pool_size
size_t pool_size
Definition: libvpxdec.c:48
AV_PIX_FMT_GBRP
@ AV_PIX_FMT_GBRP
planar GBR 4:4:4 24bpp
Definition: pixfmt.h:165
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
AVBufferRef
A reference to a data buffer.
Definition: buffer.h:82
FF_CODEC_CAP_AUTO_THREADS
#define FF_CODEC_CAP_AUTO_THREADS
Codec handles avctx->thread_count == 0 (auto) internally.
Definition: codec_internal.h:72
AVPacket
This structure stores compressed data.
Definition: packet.h:565
AVCodecContext::priv_data
void * priv_data
Definition: avcodec.h:466
AVCodecContext::width
int width
picture width / height.
Definition: avcodec.h:600
imgutils.h
AV_CODEC_ID_VP8
@ AV_CODEC_ID_VP8
Definition: codec_id.h:192
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
AVERROR_INVALIDDATA
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
Definition: error.h:61
libvpx.h
AV_PIX_FMT_YUV440P12
#define AV_PIX_FMT_YUV440P12
Definition: pixfmt.h:545
vp8_init
static av_cold int vp8_init(AVFormatContext *s, int st_index, PayloadContext *vp8)
Definition: rtpdec_vp8.c:263
AVCOL_SPC_BT709
@ AVCOL_SPC_BT709
also ITU-R BT1361 / IEC 61966-2-4 xvYCC709 / derived in SMPTE RP 177 Annex B
Definition: pixfmt.h:702
AVColorRange
AVColorRange
Visual content value range.
Definition: pixfmt.h:742
AV_RB64
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_WL32 unsigned int_TMPL AV_WL24 unsigned int_TMPL AV_WL16 uint64_t_TMPL AV_RB64
Definition: bytestream.h:95
ff_vp9_profiles
const AVProfile ff_vp9_profiles[]
Definition: profiles.c:155
vpx_init
static av_cold int vpx_init(AVCodecContext *avctx, struct vpx_codec_ctx *decoder)
Definition: libvpxdec.c:87