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 #define VPX_CODEC_DISABLE_COMPAT 1
27 #include <vpx/vpx_decoder.h>
28 #include <vpx/vpx_frame_buffer.h>
29 #include <vpx/vp8dx.h>
30 
31 #include "libavutil/common.h"
32 #include "libavutil/imgutils.h"
33 #include "libavutil/intreadwrite.h"
34 #include "avcodec.h"
35 #include "internal.h"
36 #include "libvpx.h"
37 #include "profiles.h"
38 
39 typedef struct VPxDecoderContext {
40  struct vpx_codec_ctx decoder;
41  struct vpx_codec_ctx decoder_alpha;
43  size_t pool_size;
45 } VPxContext;
46 
47 
48 static int get_frame_buffer(void *priv, size_t min_size, vpx_codec_frame_buffer_t *fb)
49 {
50  VPxContext *ctx = priv;
51  AVBufferRef *buf;
52 
53  if (min_size > ctx->pool_size) {
54  av_buffer_pool_uninit(&ctx->pool);
55  /* According to the libvpx docs the buffer must be zeroed out. */
56  ctx->pool = av_buffer_pool_init(min_size, av_buffer_allocz);
57  if (!ctx->pool) {
58  ctx->pool_size = 0;
59  return AVERROR(ENOMEM);
60  }
61  ctx->pool_size = min_size;
62  }
63 
64  buf = av_buffer_pool_get(ctx->pool);
65  if (!buf)
66  return AVERROR(ENOMEM);
67 
68  fb->priv = buf;
69  fb->size = ctx->pool_size;
70  fb->data = buf->data;
71 
72  return 0;
73 }
74 
75 static int release_frame_buffer(void *priv, vpx_codec_frame_buffer_t *fb)
76 {
77  AVBufferRef *buf = fb->priv;
78  av_buffer_unref(&buf);
79  return 0;
80 }
81 
82 static av_cold int vpx_init(AVCodecContext *avctx,
83  struct vpx_codec_ctx* decoder,
84  const struct vpx_codec_iface *iface)
85 {
86  struct vpx_codec_dec_cfg deccfg = {
87  .threads = FFMIN(avctx->thread_count ? avctx->thread_count : av_cpu_count(), 16)
88  };
89 
90  av_log(avctx, AV_LOG_INFO, "%s\n", vpx_codec_version_str());
91  av_log(avctx, AV_LOG_VERBOSE, "%s\n", vpx_codec_build_config());
92 
93  if (vpx_codec_dec_init(decoder, iface, &deccfg, 0) != VPX_CODEC_OK) {
94  const char *error = vpx_codec_error(decoder);
95  av_log(avctx, AV_LOG_ERROR, "Failed to initialize decoder: %s\n",
96  error);
97  return AVERROR(EINVAL);
98  }
99 
100  if (avctx->codec_id == AV_CODEC_ID_VP9)
101  vpx_codec_set_frame_buffer_functions(decoder, get_frame_buffer, release_frame_buffer, avctx->priv_data);
102 
103  return 0;
104 }
105 
106 // returns 0 on success, AVERROR_INVALIDDATA otherwise
107 static int set_pix_fmt(AVCodecContext *avctx, struct vpx_image *img,
108  int has_alpha_channel)
109 {
110  static const enum AVColorSpace colorspaces[8] = {
113  };
114 #if VPX_IMAGE_ABI_VERSION >= 4
115  static const enum AVColorRange color_ranges[] = {
117  };
118  avctx->color_range = color_ranges[img->range];
119 #endif
120  avctx->colorspace = colorspaces[img->cs];
121  if (avctx->codec_id == AV_CODEC_ID_VP8 && img->fmt != VPX_IMG_FMT_I420)
122  return AVERROR_INVALIDDATA;
123  switch (img->fmt) {
124  case VPX_IMG_FMT_I420:
125  if (avctx->codec_id == AV_CODEC_ID_VP9)
126  avctx->profile = FF_PROFILE_VP9_0;
127  avctx->pix_fmt =
128  has_alpha_channel ? AV_PIX_FMT_YUVA420P : AV_PIX_FMT_YUV420P;
129  return 0;
130 #if CONFIG_LIBVPX_VP9_DECODER
131  case VPX_IMG_FMT_I422:
132  avctx->profile = FF_PROFILE_VP9_1;
133  avctx->pix_fmt = AV_PIX_FMT_YUV422P;
134  return 0;
135  case VPX_IMG_FMT_I440:
136  avctx->profile = FF_PROFILE_VP9_1;
137  avctx->pix_fmt = AV_PIX_FMT_YUV440P;
138  return 0;
139  case VPX_IMG_FMT_I444:
140  avctx->profile = FF_PROFILE_VP9_1;
141  avctx->pix_fmt = avctx->colorspace == AVCOL_SPC_RGB ?
143  return 0;
144  case VPX_IMG_FMT_I42016:
145  avctx->profile = FF_PROFILE_VP9_2;
146  if (img->bit_depth == 10) {
147  avctx->pix_fmt = AV_PIX_FMT_YUV420P10;
148  return 0;
149  } else if (img->bit_depth == 12) {
150  avctx->pix_fmt = AV_PIX_FMT_YUV420P12;
151  return 0;
152  } else {
153  return AVERROR_INVALIDDATA;
154  }
155  case VPX_IMG_FMT_I42216:
156  avctx->profile = FF_PROFILE_VP9_3;
157  if (img->bit_depth == 10) {
158  avctx->pix_fmt = AV_PIX_FMT_YUV422P10;
159  return 0;
160  } else if (img->bit_depth == 12) {
161  avctx->pix_fmt = AV_PIX_FMT_YUV422P12;
162  return 0;
163  } else {
164  return AVERROR_INVALIDDATA;
165  }
166  case VPX_IMG_FMT_I44016:
167  avctx->profile = FF_PROFILE_VP9_3;
168  if (img->bit_depth == 10) {
169  avctx->pix_fmt = AV_PIX_FMT_YUV440P10;
170  return 0;
171  } else if (img->bit_depth == 12) {
172  avctx->pix_fmt = AV_PIX_FMT_YUV440P12;
173  return 0;
174  } else {
175  return AVERROR_INVALIDDATA;
176  }
177  case VPX_IMG_FMT_I44416:
178  avctx->profile = FF_PROFILE_VP9_3;
179  if (img->bit_depth == 10) {
180  avctx->pix_fmt = avctx->colorspace == AVCOL_SPC_RGB ?
182  return 0;
183  } else if (img->bit_depth == 12) {
184  avctx->pix_fmt = avctx->colorspace == AVCOL_SPC_RGB ?
186  return 0;
187  } else {
188  return AVERROR_INVALIDDATA;
189  }
190 #endif
191  default:
192  return AVERROR_INVALIDDATA;
193  }
194 }
195 
196 static int decode_frame(AVCodecContext *avctx, vpx_codec_ctx_t *decoder,
197  uint8_t *data, uint32_t data_sz)
198 {
199  if (vpx_codec_decode(decoder, data, data_sz, NULL, 0) != VPX_CODEC_OK) {
200  const char *error = vpx_codec_error(decoder);
201  const char *detail = vpx_codec_error_detail(decoder);
202 
203  av_log(avctx, AV_LOG_ERROR, "Failed to decode frame: %s\n", error);
204  if (detail) {
205  av_log(avctx, AV_LOG_ERROR, " Additional information: %s\n",
206  detail);
207  }
208  return AVERROR_INVALIDDATA;
209  }
210  return 0;
211 }
212 
213 static int vpx_decode(AVCodecContext *avctx,
214  void *data, int *got_frame, AVPacket *avpkt)
215 {
216  VPxContext *ctx = avctx->priv_data;
217  AVFrame *picture = data;
218  const void *iter = NULL;
219  const void *iter_alpha = NULL;
220  struct vpx_image *img, *img_alpha;
221  int ret;
222  uint8_t *side_data = NULL;
223  int side_data_size = 0;
224 
225  ret = decode_frame(avctx, &ctx->decoder, avpkt->data, avpkt->size);
226  if (ret)
227  return ret;
228 
229  side_data = av_packet_get_side_data(avpkt,
231  &side_data_size);
232  if (side_data_size >= 8) {
233  const uint64_t additional_id = AV_RB64(side_data);
234  side_data += 8;
235  side_data_size -= 8;
236  if (additional_id == 1) { // 1 stands for alpha channel data.
237  if (!ctx->has_alpha_channel) {
238  ctx->has_alpha_channel = 1;
239  ret = vpx_init(avctx,
240  &ctx->decoder_alpha,
241 #if CONFIG_LIBVPX_VP8_DECODER && CONFIG_LIBVPX_VP9_DECODER
242  (avctx->codec_id == AV_CODEC_ID_VP8) ?
243  &vpx_codec_vp8_dx_algo : &vpx_codec_vp9_dx_algo
244 #elif CONFIG_LIBVPX_VP8_DECODER
245  &vpx_codec_vp8_dx_algo
246 #else
247  &vpx_codec_vp9_dx_algo
248 #endif
249  );
250  if (ret)
251  return ret;
252  }
253  ret = decode_frame(avctx, &ctx->decoder_alpha, side_data,
254  side_data_size);
255  if (ret)
256  return ret;
257  }
258  }
259 
260  if ((img = vpx_codec_get_frame(&ctx->decoder, &iter)) &&
261  (!ctx->has_alpha_channel ||
262  (img_alpha = vpx_codec_get_frame(&ctx->decoder_alpha, &iter_alpha)))) {
263  uint8_t *planes[4];
264  int linesizes[4];
265 
266  if (img->d_w > img->w || img->d_h > img->h) {
267  av_log(avctx, AV_LOG_ERROR, "Display dimensions %dx%d exceed storage %dx%d\n",
268  img->d_w, img->d_h, img->w, img->h);
269  return AVERROR_EXTERNAL;
270  }
271 
272  if ((ret = set_pix_fmt(avctx, img, ctx->has_alpha_channel)) < 0) {
273  av_log(avctx, AV_LOG_ERROR, "Unsupported output colorspace (%d) / bit_depth (%d)\n",
274  img->fmt, img->bit_depth);
275  return ret;
276  }
277 
278  if ((int) img->d_w != avctx->width || (int) img->d_h != avctx->height) {
279  av_log(avctx, AV_LOG_INFO, "dimension change! %dx%d -> %dx%d\n",
280  avctx->width, avctx->height, img->d_w, img->d_h);
281  ret = ff_set_dimensions(avctx, img->d_w, img->d_h);
282  if (ret < 0)
283  return ret;
284  }
285 
286  if (ctx->has_alpha_channel &&
287  (img->d_w != img_alpha->d_w ||
288  img->d_h != img_alpha->d_h ||
289  img->bit_depth != img_alpha->bit_depth)) {
290  av_log(avctx, AV_LOG_ERROR,
291  "Video dimensions %dx%d@%dbpc differ from alpha dimensions %dx%d@%dbpc\n",
292  img->d_w, img->d_h, img->bit_depth,
293  img_alpha->d_w, img_alpha->d_h, img_alpha->bit_depth);
294  return AVERROR_INVALIDDATA;
295  }
296 
297  planes[0] = img->planes[VPX_PLANE_Y];
298  planes[1] = img->planes[VPX_PLANE_U];
299  planes[2] = img->planes[VPX_PLANE_V];
300  planes[3] =
301  ctx->has_alpha_channel ? img_alpha->planes[VPX_PLANE_Y] : NULL;
302  linesizes[0] = img->stride[VPX_PLANE_Y];
303  linesizes[1] = img->stride[VPX_PLANE_U];
304  linesizes[2] = img->stride[VPX_PLANE_V];
305  linesizes[3] =
306  ctx->has_alpha_channel ? img_alpha->stride[VPX_PLANE_Y] : 0;
307 
308  if (img->fb_priv && (!ctx->has_alpha_channel || img_alpha->fb_priv)) {
309  ret = ff_decode_frame_props(avctx, picture);
310  if (ret < 0)
311  return ret;
312  picture->buf[0] = av_buffer_ref(img->fb_priv);
313  if (!picture->buf[0])
314  return AVERROR(ENOMEM);
315  if (ctx->has_alpha_channel) {
316  picture->buf[1] = av_buffer_ref(img_alpha->fb_priv);
317  if (!picture->buf[1]) {
318  av_frame_unref(picture);
319  return AVERROR(ENOMEM);
320  }
321  }
322  for (int i = 0; i < 4; i++) {
323  picture->data[i] = planes[i];
324  picture->linesize[i] = linesizes[i];
325  }
326  } else {
327  if ((ret = ff_get_buffer(avctx, picture, 0)) < 0)
328  return ret;
329  av_image_copy(picture->data, picture->linesize, (const uint8_t**)planes,
330  linesizes, avctx->pix_fmt, img->d_w, img->d_h);
331  }
332  *got_frame = 1;
333  }
334  return avpkt->size;
335 }
336 
337 static av_cold int vpx_free(AVCodecContext *avctx)
338 {
339  VPxContext *ctx = avctx->priv_data;
340  vpx_codec_destroy(&ctx->decoder);
341  if (ctx->has_alpha_channel)
342  vpx_codec_destroy(&ctx->decoder_alpha);
343  av_buffer_pool_uninit(&ctx->pool);
344  return 0;
345 }
346 
347 #if CONFIG_LIBVPX_VP8_DECODER
348 static av_cold int vp8_init(AVCodecContext *avctx)
349 {
350  VPxContext *ctx = avctx->priv_data;
351  return vpx_init(avctx, &ctx->decoder, &vpx_codec_vp8_dx_algo);
352 }
353 
355  .name = "libvpx",
356  .long_name = NULL_IF_CONFIG_SMALL("libvpx VP8"),
357  .type = AVMEDIA_TYPE_VIDEO,
358  .id = AV_CODEC_ID_VP8,
359  .priv_data_size = sizeof(VPxContext),
360  .init = vp8_init,
361  .close = vpx_free,
362  .decode = vpx_decode,
364  .wrapper_name = "libvpx",
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  return vpx_init(avctx, &ctx->decoder, &vpx_codec_vp9_dx_algo);
373 }
374 
376  .name = "libvpx-vp9",
377  .long_name = NULL_IF_CONFIG_SMALL("libvpx VP9"),
378  .type = AVMEDIA_TYPE_VIDEO,
379  .id = AV_CODEC_ID_VP9,
380  .priv_data_size = sizeof(VPxContext),
381  .init = vp9_init,
382  .close = vpx_free,
383  .decode = vpx_decode,
384  .capabilities = AV_CODEC_CAP_AUTO_THREADS,
387  .wrapper_name = "libvpx",
388 };
389 #endif /* CONFIG_LIBVPX_VP9_DECODER */
error
static void error(const char *err)
Definition: target_bsf_fuzzer.c:29
ff_libvpx_vp8_decoder
AVCodec ff_libvpx_vp8_decoder
AVCodec
AVCodec.
Definition: codec.h:190
init
static av_cold int init(AVCodecContext *avctx)
Definition: avrndec.c:35
vp9_init
static av_cold int vp9_init(AVFormatContext *ctx, int st_index, PayloadContext *data)
Definition: rtpdec_vp9.c:34
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
AVCodecContext::colorspace
enum AVColorSpace colorspace
YUV colorspace type.
Definition: avcodec.h:1154
FF_PROFILE_VP9_0
#define FF_PROFILE_VP9_0
Definition: avcodec.h:1942
AVBufferPool
The buffer pool.
Definition: buffer_internal.h:77
AVBufferRef::data
uint8_t * data
The data buffer.
Definition: buffer.h:89
AVFrame
This structure describes decoded (raw) audio or video data.
Definition: frame.h:300
AVCOL_RANGE_JPEG
@ AVCOL_RANGE_JPEG
the normal 2^n-1 "JPEG" YUV ranges
Definition: pixfmt.h:535
internal.h
AVPacket::data
uint8_t * data
Definition: packet.h:355
release_frame_buffer
static int release_frame_buffer(void *priv, vpx_codec_frame_buffer_t *fb)
Definition: libvpxdec.c:75
data
const char data[16]
Definition: mxf.c:91
AV_PIX_FMT_YUV420P10
#define AV_PIX_FMT_YUV420P10
Definition: pixfmt.h:397
av_buffer_allocz
AVBufferRef * av_buffer_allocz(int size)
Same as av_buffer_alloc(), except the returned buffer will be initialized to zero.
Definition: buffer.c:83
AV_LOG_VERBOSE
#define AV_LOG_VERBOSE
Detailed information.
Definition: log.h:192
AVCOL_SPC_RGB
@ AVCOL_SPC_RGB
order of coefficients is actually GBR, also IEC 61966-2-1 (sRGB)
Definition: pixfmt.h:510
AV_PIX_FMT_YUV440P
@ AV_PIX_FMT_YUV440P
planar YUV 4:4:0 (1 Cr & Cb sample per 1x2 Y samples)
Definition: pixfmt.h:99
AVFrame::buf
AVBufferRef * buf[AV_NUM_DATA_POINTERS]
AVBuffer references backing the data for this frame.
Definition: frame.h:491
VPxDecoderContext
Definition: libvpxdec.c:39
AVFrame::data
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
Definition: frame.h:314
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:515
av_buffer_pool_init
AVBufferPool * av_buffer_pool_init(int size, AVBufferRef *(*alloc)(int size))
Allocate and initialize a buffer pool.
Definition: buffer.c:239
AVCOL_SPC_RESERVED
@ AVCOL_SPC_RESERVED
Definition: pixfmt.h:513
decoder
static const chunk_decoder decoder[8]
Definition: dfa.c:330
init_static_data
static av_cold void init_static_data(void)
Definition: mv30.c:665
AVCodecContext::thread_count
int thread_count
thread count is used to decide how many independent tasks should be passed to execute()
Definition: avcodec.h:1785
AV_PIX_FMT_GBRP10
#define AV_PIX_FMT_GBRP10
Definition: pixfmt.h:413
set_pix_fmt
static int set_pix_fmt(AVCodecContext *avctx, struct vpx_image *img, int has_alpha_channel)
Definition: libvpxdec.c:107
AV_PIX_FMT_YUV444P10
#define AV_PIX_FMT_YUV444P10
Definition: pixfmt.h:400
AV_LOG_ERROR
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:176
av_cold
#define av_cold
Definition: attributes.h:90
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:337
decode
static void decode(AVCodecContext *dec_ctx, AVPacket *pkt, AVFrame *frame, FILE *outfile)
Definition: decode_audio.c:71
VPxDecoderContext::has_alpha_channel
int has_alpha_channel
Definition: libvpxdec.c:44
intreadwrite.h
FF_PROFILE_VP9_3
#define FF_PROFILE_VP9_3
Definition: avcodec.h:1945
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:101
AVCOL_SPC_SMPTE170M
@ AVCOL_SPC_SMPTE170M
also ITU-R BT601-6 525 / ITU-R BT1358 525 / ITU-R BT1700 NTSC
Definition: pixfmt.h:516
AV_CODEC_ID_VP9
@ AV_CODEC_ID_VP9
Definition: codec_id.h:217
ctx
AVFormatContext * ctx
Definition: movenc.c:48
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:66
AVCodecContext::codec_id
enum AVCodecID codec_id
Definition: avcodec.h:536
FF_PROFILE_VP9_2
#define FF_PROFILE_VP9_2
Definition: avcodec.h:1944
av_packet_get_side_data
uint8_t * av_packet_get_side_data(const AVPacket *pkt, enum AVPacketSideDataType type, int *size)
Get side information from packet.
Definition: avpacket.c:353
NULL
#define NULL
Definition: coverity.c:32
VPxDecoderContext::pool
AVBufferPool * pool
Definition: libvpxdec.c:42
AVCodecContext::color_range
enum AVColorRange color_range
MPEG vs JPEG YUV range.
Definition: avcodec.h:1161
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:125
profiles.h
ff_vp9_init_static
av_cold void ff_vp9_init_static(AVCodec *codec)
Definition: libvpx.c:68
av_buffer_pool_uninit
void av_buffer_pool_uninit(AVBufferPool **ppool)
Mark the pool as being available for freeing.
Definition: buffer.c:276
AV_PIX_FMT_YUV440P10
#define AV_PIX_FMT_YUV440P10
Definition: pixfmt.h:399
vpx_free
static av_cold int vpx_free(AVCodecContext *avctx)
Definition: libvpxdec.c:337
AV_PIX_FMT_YUV422P10
#define AV_PIX_FMT_YUV422P10
Definition: pixfmt.h:398
av_cpu_count
int av_cpu_count(void)
Definition: cpu.c:267
VPxDecoderContext::decoder
struct vpx_codec_ctx decoder
Definition: libvpxdec.c:40
AV_CODEC_CAP_AUTO_THREADS
#define AV_CODEC_CAP_AUTO_THREADS
Codec supports avctx->thread_count == 0 (auto).
Definition: codec.h:118
ff_get_buffer
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
Get a buffer for a frame.
Definition: decode.c:1854
AV_CODEC_CAP_DR1
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() for allocating buffers and supports custom allocators.
Definition: codec.h:50
AVPacket::size
int size
Definition: packet.h:356
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:188
AV_PIX_FMT_YUV422P12
#define AV_PIX_FMT_YUV422P12
Definition: pixfmt.h:402
vpx_init
static av_cold int vpx_init(AVCodecContext *avctx, struct vpx_codec_ctx *decoder, const struct vpx_codec_iface *iface)
Definition: libvpxdec.c:82
AV_PIX_FMT_YUV444P12
#define AV_PIX_FMT_YUV444P12
Definition: pixfmt.h:404
FFMIN
#define FFMIN(a, b)
Definition: common.h:96
img
#define img
Definition: vf_colormatrix.c:116
AVERROR_EXTERNAL
#define AVERROR_EXTERNAL
Generic error in an external library.
Definition: error.h:57
AV_LOG_INFO
#define AV_LOG_INFO
Standard information.
Definition: log.h:187
planes
static const struct @315 planes[]
AVCOL_SPC_SMPTE240M
@ AVCOL_SPC_SMPTE240M
functionally identical to above
Definition: pixfmt.h:517
i
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:269
AVCOL_SPC_BT2020_NCL
@ AVCOL_SPC_BT2020_NCL
ITU-R BT2020 non-constant luminance system.
Definition: pixfmt.h:520
AV_PIX_FMT_GBRP12
#define AV_PIX_FMT_GBRP12
Definition: pixfmt.h:414
AVColorSpace
AVColorSpace
YUV colorspace type.
Definition: pixfmt.h:509
common.h
fb
#define fb(width, name)
Definition: cbs_av1.c:553
uint8_t
uint8_t
Definition: audio_convert.c:194
av_frame_unref
void av_frame_unref(AVFrame *frame)
Unreference all the buffers referenced by frame and reset the frame fields.
Definition: frame.c:554
AVCodec::name
const char * name
Name of the codec implementation.
Definition: codec.h:197
VPxDecoderContext::decoder_alpha
struct vpx_codec_ctx decoder_alpha
Definition: libvpxdec.c:41
AVCOL_SPC_UNSPECIFIED
@ AVCOL_SPC_UNSPECIFIED
Definition: pixfmt.h:512
AVCodecContext::height
int height
Definition: avcodec.h:699
AVCodecContext::pix_fmt
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
Definition: avcodec.h:736
AVCOL_RANGE_MPEG
@ AVCOL_RANGE_MPEG
the normal 219*2^(n-8) "MPEG" YUV ranges
Definition: pixfmt.h:534
avcodec.h
ret
ret
Definition: filter_design.txt:187
FF_PROFILE_VP9_1
#define FF_PROFILE_VP9_1
Definition: avcodec.h:1943
AV_PIX_FMT_YUV420P12
#define AV_PIX_FMT_YUV420P12
Definition: pixfmt.h:401
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:1685
AVCodecContext
main external API structure.
Definition: avcodec.h:526
av_image_copy
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.
Definition: imgutils.c:387
vpx_decode
static int vpx_decode(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
Definition: libvpxdec.c:213
AVCodecContext::profile
int profile
profile
Definition: avcodec.h:1859
get_frame_buffer
static int get_frame_buffer(void *priv, size_t min_size, vpx_codec_frame_buffer_t *fb)
Definition: libvpxdec.c:48
profiles
static const AVProfile profiles[]
Definition: libfdk-aacenc.c:428
av_buffer_ref
AVBufferRef * av_buffer_ref(AVBufferRef *buf)
Create a new reference to an AVBuffer.
Definition: buffer.c:93
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:71
decode_frame
static int decode_frame(AVCodecContext *avctx, vpx_codec_ctx_t *decoder, uint8_t *data, uint32_t data_sz)
Definition: libvpxdec.c:196
VPxDecoderContext::pool_size
size_t pool_size
Definition: libvpxdec.c:43
AV_PIX_FMT_GBRP
@ AV_PIX_FMT_GBRP
planar GBR 4:4:4 24bpp
Definition: pixfmt.h:168
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
ff_libvpx_vp9_decoder
AVCodec ff_libvpx_vp9_decoder
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:70
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:104
AVBufferRef
A reference to a data buffer.
Definition: buffer.h:81
AV_PKT_DATA_MATROSKA_BLOCKADDITIONAL
@ AV_PKT_DATA_MATROSKA_BLOCKADDITIONAL
Data found in BlockAdditional element of matroska container.
Definition: packet.h:191
AVPacket
This structure stores compressed data.
Definition: packet.h:332
AVCodecContext::priv_data
void * priv_data
Definition: avcodec.h:553
AVCodecContext::width
int width
picture width / height.
Definition: avcodec.h:699
imgutils.h
AV_CODEC_ID_VP8
@ AV_CODEC_ID_VP8
Definition: codec_id.h:189
AVFrame::linesize
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
Definition: frame.h:331
av_log
#define av_log(a,...)
Definition: tableprint_vlc.h:28
AVERROR_INVALIDDATA
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
Definition: error.h:59
libvpx.h
AV_PIX_FMT_YUV440P12
#define AV_PIX_FMT_YUV440P12
Definition: pixfmt.h:403
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 / SMPTE RP177 Annex B
Definition: pixfmt.h:511
AVColorRange
AVColorRange
MPEG vs JPEG YUV range.
Definition: pixfmt.h:532
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:91
ff_vp9_profiles
const AVProfile ff_vp9_profiles[]
Definition: profiles.c:133