FFmpeg
Loading...
Searching...
No Matches
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"
37#include "avcodec.h"
38#include "codec_internal.h"
39#include "decode.h"
40#include "libvpx.h"
41#include "profiles.h"
42
43typedef 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;
51
52
53static 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) {
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
80static 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
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
117static 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 =
144 has_alpha_channel ? AV_PIX_FMT_YUVA422P : AV_PIX_FMT_YUV422P;
145 return 0;
146 case VPX_IMG_FMT_I440:
147 //TODO: Add alpha support once the pixel format becomes available
148 avctx->profile = AV_PROFILE_VP9_1;
150 return 0;
151 case VPX_IMG_FMT_I444:
152 avctx->profile = AV_PROFILE_VP9_1;
153 avctx->pix_fmt = avctx->colorspace == AVCOL_SPC_RGB ?
154 (has_alpha_channel ? AV_PIX_FMT_GBRAP : AV_PIX_FMT_GBRP) :
155 (has_alpha_channel ? AV_PIX_FMT_YUVA444P : AV_PIX_FMT_YUV444P);
156 return 0;
157 case VPX_IMG_FMT_I42016:
158 avctx->profile = AV_PROFILE_VP9_2;
159 if (img->bit_depth == 10) {
160 avctx->pix_fmt =
161 has_alpha_channel ? AV_PIX_FMT_YUVA420P10 : AV_PIX_FMT_YUV420P10;
162 return 0;
163 } else if (img->bit_depth == 12) {
164 //TODO: Add alpha support once the pixel format becomes available
166 return 0;
167 } else {
168 return AVERROR_INVALIDDATA;
169 }
170 case VPX_IMG_FMT_I42216:
171 avctx->profile = AV_PROFILE_VP9_3;
172 if (img->bit_depth == 10) {
173 avctx->pix_fmt =
174 has_alpha_channel ? AV_PIX_FMT_YUVA422P10 : AV_PIX_FMT_YUV422P10;
175 return 0;
176 } else if (img->bit_depth == 12) {
177 //TODO: Add alpha support once the pixel format becomes available
179 return 0;
180 } else {
181 return AVERROR_INVALIDDATA;
182 }
183 case VPX_IMG_FMT_I44016:
184 //TODO: Add alpha support once the pixel format becomes available
185 avctx->profile = AV_PROFILE_VP9_3;
186 if (img->bit_depth == 10) {
188 return 0;
189 } else if (img->bit_depth == 12) {
191 return 0;
192 } else {
193 return AVERROR_INVALIDDATA;
194 }
195 case VPX_IMG_FMT_I44416:
196 avctx->profile = AV_PROFILE_VP9_3;
197 if (img->bit_depth == 10) {
198 avctx->pix_fmt = avctx->colorspace == AVCOL_SPC_RGB ?
199 (has_alpha_channel ? AV_PIX_FMT_GBRAP10 : AV_PIX_FMT_GBRP10) :
200 (has_alpha_channel ? AV_PIX_FMT_YUVA444P10 : AV_PIX_FMT_YUV444P10);
201 return 0;
202 } else if (img->bit_depth == 12) {
203 avctx->pix_fmt = avctx->colorspace == AVCOL_SPC_RGB ?
204 (has_alpha_channel ? AV_PIX_FMT_GBRAP12 : AV_PIX_FMT_GBRP12) :
205 (has_alpha_channel ? AV_PIX_FMT_YUVA444P12 : AV_PIX_FMT_YUV444P12);
206 return 0;
207 } else {
208 return AVERROR_INVALIDDATA;
209 }
210#endif
211 default:
212 return AVERROR_INVALIDDATA;
213 }
214}
215
216static int decode_frame(AVCodecContext *avctx, vpx_codec_ctx_t *decoder,
217 const uint8_t *data, uint32_t data_sz)
218{
219 if (vpx_codec_decode(decoder, data, data_sz, NULL, 0) != VPX_CODEC_OK) {
220 const char *error = vpx_codec_error(decoder);
221 const char *detail = vpx_codec_error_detail(decoder);
222
223 av_log(avctx, AV_LOG_ERROR, "Failed to decode frame: %s\n", error);
224 if (detail) {
225 av_log(avctx, AV_LOG_ERROR, " Additional information: %s\n",
226 detail);
227 }
228 return AVERROR_INVALIDDATA;
229 }
230 return 0;
231}
232
233static int vpx_decode(AVCodecContext *avctx, AVFrame *picture,
234 int *got_frame, AVPacket *avpkt)
235{
236 VPxContext *ctx = avctx->priv_data;
237 const void *iter = NULL;
238 const void *iter_alpha = NULL;
239 struct vpx_image *img, *img_alpha;
240 int ret;
241 uint8_t *side_data = NULL;
242 size_t side_data_size;
243
244 ret = decode_frame(avctx, &ctx->decoder, avpkt->data, avpkt->size);
245 if (ret)
246 return ret;
247
248 side_data = av_packet_get_side_data(avpkt,
250 &side_data_size);
251 if (side_data_size >= 8) {
252 const uint64_t additional_id = AV_RB64(side_data);
253 side_data += 8;
254 side_data_size -= 8;
255 if (additional_id == 1) { // 1 stands for alpha channel data.
256 if (!ctx->has_alpha_channel) {
257 ctx->has_alpha_channel = 1;
258 ret = vpx_init(avctx, &ctx->decoder_alpha);
259 if (ret)
260 return ret;
261 }
262 ret = decode_frame(avctx, &ctx->decoder_alpha, side_data,
263 side_data_size);
264 if (ret)
265 return ret;
266 }
267 }
268
269 if ((img = vpx_codec_get_frame(&ctx->decoder, &iter)) &&
270 (!ctx->has_alpha_channel ||
271 (img_alpha = vpx_codec_get_frame(&ctx->decoder_alpha, &iter_alpha)))) {
272 uint8_t *planes[4];
273 int linesizes[4];
274
275 if (img->d_w > img->w || img->d_h > img->h) {
276 av_log(avctx, AV_LOG_ERROR, "Display dimensions %dx%d exceed storage %dx%d\n",
277 img->d_w, img->d_h, img->w, img->h);
278 return AVERROR_EXTERNAL;
279 }
280
281 if ((ret = set_pix_fmt(avctx, img, ctx->has_alpha_channel)) < 0) {
282 av_log(avctx, AV_LOG_ERROR, "Unsupported output colorspace (%d) / bit_depth (%d)\n",
283 img->fmt, img->bit_depth);
284 return ret;
285 }
286
287 if ((int) img->d_w != avctx->width || (int) img->d_h != avctx->height) {
288 av_log(avctx, AV_LOG_INFO, "dimension change! %dx%d -> %dx%d\n",
289 avctx->width, avctx->height, img->d_w, img->d_h);
290 ret = ff_set_dimensions(avctx, img->d_w, img->d_h);
291 if (ret < 0)
292 return ret;
293 }
294
295 if (ctx->has_alpha_channel &&
296 (img->d_w != img_alpha->d_w ||
297 img->d_h != img_alpha->d_h ||
298 img->bit_depth != img_alpha->bit_depth)) {
299 av_log(avctx, AV_LOG_ERROR,
300 "Video dimensions %dx%d@%dbpc differ from alpha dimensions %dx%d@%dbpc\n",
301 img->d_w, img->d_h, img->bit_depth,
302 img_alpha->d_w, img_alpha->d_h, img_alpha->bit_depth);
303 return AVERROR_INVALIDDATA;
304 }
305
306 planes[0] = img->planes[VPX_PLANE_Y];
307 planes[1] = img->planes[VPX_PLANE_U];
308 planes[2] = img->planes[VPX_PLANE_V];
309 planes[3] =
310 ctx->has_alpha_channel ? img_alpha->planes[VPX_PLANE_Y] : NULL;
311 linesizes[0] = img->stride[VPX_PLANE_Y];
312 linesizes[1] = img->stride[VPX_PLANE_U];
313 linesizes[2] = img->stride[VPX_PLANE_V];
314 linesizes[3] =
315 ctx->has_alpha_channel ? img_alpha->stride[VPX_PLANE_Y] : 0;
316
317 if (vpx_codec_get_caps(ctx->iface) & VPX_CODEC_CAP_EXTERNAL_FRAME_BUFFER) {
318 ret = ff_decode_frame_props(avctx, picture);
319 if (ret < 0)
320 return ret;
321 picture->buf[0] = av_buffer_ref(img->fb_priv);
322 if (!picture->buf[0])
323 return AVERROR(ENOMEM);
324 if (ctx->has_alpha_channel) {
325 picture->buf[1] = av_buffer_ref(img_alpha->fb_priv);
326 if (!picture->buf[1])
327 return AVERROR(ENOMEM);
328 }
329 for (int i = 0; i < 4; i++) {
330 picture->data[i] = planes[i];
331 picture->linesize[i] = linesizes[i];
332 }
333 } else {
334 if ((ret = ff_get_buffer(avctx, picture, 0)) < 0)
335 return ret;
336 av_image_copy2(picture->data, picture->linesize, planes,
337 linesizes, avctx->pix_fmt, img->d_w, img->d_h);
338 }
339 *got_frame = 1;
340 }
341 return avpkt->size;
342}
343
345{
346 VPxContext *ctx = avctx->priv_data;
347 vpx_codec_destroy(&ctx->decoder);
348 if (ctx->has_alpha_channel)
349 vpx_codec_destroy(&ctx->decoder_alpha);
351 return 0;
352}
353
354#if CONFIG_LIBVPX_VP8_DECODER
355static av_cold int vp8_init(AVCodecContext *avctx)
356{
357 VPxContext *ctx = avctx->priv_data;
358 ctx->iface = vpx_codec_vp8_dx();
359 return vpx_init(avctx, &ctx->decoder);
360}
361
363 .p.name = "libvpx",
364 CODEC_LONG_NAME("libvpx VP8"),
365 .p.type = AVMEDIA_TYPE_VIDEO,
366 .p.id = AV_CODEC_ID_VP8,
368 .p.wrapper_name = "libvpx",
369 .priv_data_size = sizeof(VPxContext),
370 .init = vp8_init,
371 .close = vpx_free,
373 .caps_internal = FF_CODEC_CAP_NOT_INIT_THREADSAFE |
375};
376#endif /* CONFIG_LIBVPX_VP8_DECODER */
377
378#if CONFIG_LIBVPX_VP9_DECODER
379static av_cold int vp9_init(AVCodecContext *avctx)
380{
381 VPxContext *ctx = avctx->priv_data;
382 ctx->iface = vpx_codec_vp9_dx();
383 return vpx_init(avctx, &ctx->decoder);
384}
385
387 .p.name = "libvpx-vp9",
388 CODEC_LONG_NAME("libvpx VP9"),
389 .p.type = AVMEDIA_TYPE_VIDEO,
390 .p.id = AV_CODEC_ID_VP9,
391 .p.capabilities = AV_CODEC_CAP_OTHER_THREADS,
393 .p.wrapper_name = "libvpx",
394 .priv_data_size = sizeof(VPxContext),
395 .init = vp9_init,
396 .close = vpx_free,
398 .caps_internal = FF_CODEC_CAP_NOT_INIT_THREADSAFE |
400};
401#endif /* CONFIG_LIBVPX_VP9_DECODER */
const FFCodec ff_libvpx_vp8_decoder
const FFCodec ff_libvpx_vp9_decoder
static AVFormatContext * ctx
static av_cold void close(AVCodecParserContext *s)
Definition apv_parser.c:197
Libavcodec external API header.
#define i(width, name, range_min, range_max)
Definition cbs_h264.c:63
#define FF_CODEC_CAP_NOT_INIT_THREADSAFE
The codec is not known to be init-threadsafe (i.e.
#define FF_CODEC_DECODE_CB(func)
#define CODEC_LONG_NAME(str)
#define FF_CODEC_CAP_AUTO_THREADS
Codec handles avctx->thread_count == 0 (auto) internally.
common internal and external API header
#define NULL
Definition coverity.c:32
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
Get a buffer for a frame.
Definition decode.c:1777
int ff_decode_frame_props(AVCodecContext *avctx, AVFrame *frame)
Set various frame properties from the codec context / packet data.
Definition decode.c:1598
int ff_set_dimensions(AVCodecContext *s, int width, int height)
Definition utils.c:91
#define AV_PROFILE_VP9_3
Definition defs.h:157
#define AV_PROFILE_VP9_1
Definition defs.h:155
#define AV_PROFILE_VP9_0
Definition defs.h:154
#define AV_PROFILE_VP9_2
Definition defs.h:156
int(* init)(AVBSFContext *ctx)
Definition dts2pts.c:608
#define AV_CODEC_CAP_OTHER_THREADS
Codec supports multithreading through a method other than slice- or frame-level multithreading.
Definition codec.h:112
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators.
Definition codec.h:49
@ AV_CODEC_ID_VP8
Definition codec_id.h:190
@ AV_CODEC_ID_VP9
Definition codec_id.h:217
@ AV_PKT_DATA_MATROSKA_BLOCKADDITIONAL
Data found in BlockAdditional element of matroska container.
Definition packet.h:188
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
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
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
AVBufferRef * av_buffer_ref(const AVBufferRef *buf)
Create a new reference to an AVBuffer.
Definition buffer.c:103
void av_buffer_pool_uninit(AVBufferPool **ppool)
Mark the pool as being available for freeing.
Definition buffer.c:328
AVBufferPool * av_buffer_pool_init(size_t size, AVBufferRef *(*alloc)(size_t size))
Allocate and initialize a buffer pool.
Definition buffer.c:283
AVBufferRef * av_buffer_pool_get(AVBufferPool *pool)
Allocate a new AVBuffer, reusing an old buffer from the pool when available.
Definition buffer.c:390
#define AVERROR_EXTERNAL
Generic error in an external library.
Definition error.h:59
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
Definition error.h:61
#define AVERROR(e)
Definition error.h:45
#define AV_LOG_VERBOSE
Detailed information.
Definition log.h:226
#define AV_LOG_INFO
Standard information.
Definition log.h:221
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition log.h:210
@ AVMEDIA_TYPE_VIDEO
Definition avutil.h:200
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
misc image utilities
#define AV_RB64(p)
static const chunk_decoder decoder[8]
Definition dfa.c:331
#define av_cold
Definition attributes.h:117
int av_cpu_count(void)
Definition cpu.c:228
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
Definition internal.h:88
#define MAX_VPX_THREADS
Definition libvpx.h:24
static av_cold int vpx_init(AVCodecContext *avctx, struct vpx_codec_ctx *decoder)
Definition libvpxdec.c:87
static int release_frame_buffer(void *priv, vpx_codec_frame_buffer_t *fb)
Definition libvpxdec.c:80
static av_cold int vpx_free(AVCodecContext *avctx)
Definition libvpxdec.c:344
static int decode_frame(AVCodecContext *avctx, vpx_codec_ctx_t *decoder, const uint8_t *data, uint32_t data_sz)
Definition libvpxdec.c:216
static int vpx_decode(AVCodecContext *avctx, AVFrame *picture, int *got_frame, AVPacket *avpkt)
Definition libvpxdec.c:233
static int set_pix_fmt(AVCodecContext *avctx, struct vpx_image *img, int has_alpha_channel)
Definition libvpxdec.c:117
static int get_frame_buffer(void *priv, size_t min_size, vpx_codec_frame_buffer_t *fb)
Definition libvpxdec.c:53
static const struct @257111027162314367033347246032313251342043035002 planes[]
#define FFMIN(a, b)
Definition macros.h:49
const char data[16]
Definition mxf.c:149
#define AV_PIX_FMT_GBRAP12
Definition pixfmt.h:569
#define AV_PIX_FMT_YUV444P12
Definition pixfmt.h:552
#define AV_PIX_FMT_YUV420P10
Definition pixfmt.h:545
#define AV_PIX_FMT_YUV440P12
Definition pixfmt.h:551
AVColorRange
Visual content value range.
Definition pixfmt.h:748
@ AVCOL_RANGE_MPEG
Narrow or limited range content.
Definition pixfmt.h:766
@ AVCOL_RANGE_JPEG
Full range content.
Definition pixfmt.h:783
#define AV_PIX_FMT_YUVA444P10
Definition pixfmt.h:598
#define AV_PIX_FMT_YUV420P12
Definition pixfmt.h:549
#define AV_PIX_FMT_YUVA420P10
Definition pixfmt.h:596
#define AV_PIX_FMT_YUV422P12
Definition pixfmt.h:550
#define AV_PIX_FMT_GBRP10
Definition pixfmt.h:564
#define AV_PIX_FMT_YUV422P10
Definition pixfmt.h:546
#define AV_PIX_FMT_GBRP12
Definition pixfmt.h:565
#define AV_PIX_FMT_YUVA422P10
Definition pixfmt.h:597
@ AV_PIX_FMT_YUV420P
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
Definition pixfmt.h:73
@ AV_PIX_FMT_YUV440P
planar YUV 4:4:0 (1 Cr & Cb sample per 1x2 Y samples)
Definition pixfmt.h:106
@ AV_PIX_FMT_YUV422P
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
Definition pixfmt.h:77
@ AV_PIX_FMT_YUVA420P
planar YUV 4:2:0, 20bpp, (1 Cr & Cb sample per 2x2 Y & A samples)
Definition pixfmt.h:108
@ 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_YUVA444P
planar YUV 4:4:4 32bpp, (1 Cr & Cb sample per 1x1 Y & A samples)
Definition pixfmt.h:174
@ AV_PIX_FMT_GBRAP
planar GBRA 4:4:4:4 32bpp
Definition pixfmt.h:212
@ AV_PIX_FMT_YUVA422P
planar YUV 4:2:2 24bpp, (1 Cr & Cb sample per 2x1 Y & A samples)
Definition pixfmt.h:173
@ AV_PIX_FMT_GBRP
planar GBR 4:4:4 24bpp
Definition pixfmt.h:165
#define AV_PIX_FMT_YUV440P10
Definition pixfmt.h:547
#define AV_PIX_FMT_GBRAP10
Definition pixfmt.h:568
#define AV_PIX_FMT_YUVA444P12
Definition pixfmt.h:600
#define AV_PIX_FMT_YUV444P10
Definition pixfmt.h:548
AVColorSpace
YUV colorspace type.
Definition pixfmt.h:706
@ AVCOL_SPC_BT709
also ITU-R BT1361 / IEC 61966-2-4 xvYCC709 / derived in SMPTE RP 177 Annex B
Definition pixfmt.h:708
@ 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:712
@ AVCOL_SPC_RGB
order of coefficients is actually GBR, also IEC 61966-2-1 (sRGB), YZX and ST 428-1
Definition pixfmt.h:707
@ AVCOL_SPC_BT2020_NCL
ITU-R BT2020 non-constant luminance system.
Definition pixfmt.h:717
@ AVCOL_SPC_UNSPECIFIED
Definition pixfmt.h:709
@ AVCOL_SPC_SMPTE170M
also ITU-R BT601-6 525 / ITU-R BT1358 525 / ITU-R BT1700 NTSC / functionally identical to above
Definition pixfmt.h:713
@ AVCOL_SPC_SMPTE240M
derived from 170M primaries and D65 white point, 170M is derived from BT470 System M's primaries
Definition pixfmt.h:714
@ AVCOL_SPC_RESERVED
reserved for future use by ITU-T and ISO/IEC just like 15-255 are
Definition pixfmt.h:710
const AVProfile ff_vp9_profiles[]
Definition profiles.c:155
static av_cold int vp8_init(AVFormatContext *s, int st_index, PayloadContext *vp8)
Definition rtpdec_vp8.c:263
static av_cold int vp9_init(AVFormatContext *ctx, int st_index, PayloadContext *data)
Definition rtpdec_vp9.c:34
The buffer pool.
A reference to a data buffer.
Definition buffer.h:82
uint8_t * data
The data buffer.
Definition buffer.h:90
size_t size
Size of data in bytes.
Definition buffer.h:94
main external API structure.
Definition avcodec.h:443
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
Definition avcodec.h:643
int width
picture width / height.
Definition avcodec.h:604
enum AVColorRange color_range
MPEG vs JPEG YUV range.
Definition avcodec.h:681
int profile
profile
Definition avcodec.h:1636
enum AVColorSpace colorspace
YUV colorspace type.
Definition avcodec.h:671
int thread_count
thread count is used to decide how many independent tasks should be passed to execute()
Definition avcodec.h:1579
enum AVCodecID codec_id
Definition avcodec.h:453
void * priv_data
Definition avcodec.h:470
This structure describes decoded (raw) audio or video data.
Definition frame.h:472
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
Definition frame.h:493
AVBufferRef * buf[AV_NUM_DATA_POINTERS]
AVBuffer references backing the data for this frame.
Definition frame.h:649
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:517
This structure stores compressed data.
Definition packet.h:580
int size
Definition packet.h:604
uint8_t * data
Definition packet.h:603
struct vpx_codec_ctx decoder
Definition libvpxdec.c:45
size_t pool_size
Definition libvpxdec.c:48
int has_alpha_channel
Definition libvpxdec.c:49
const struct vpx_codec_iface * iface
Definition libvpxdec.c:44
AVBufferPool * pool
Definition libvpxdec.c:47
struct vpx_codec_ctx decoder_alpha
Definition libvpxdec.c:46
#define av_log(a,...)
static void error(const char *err)
#define img